'use strict';!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).TIM=t()}(this,(function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(t){for(var n=1;n=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return g(e)}function f(e){var t=l();return function(){var n,o=c(e);if(t){var a=c(this).constructor;n=Reflect.construct(o,arguments,a)}else n=o.apply(this,arguments);return h(this,n)}}function m(e,t){return v(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var o,a,s=[],r=!0,i=!1;try{for(n=n.call(e);!(r=(o=n.next()).done)&&(s.push(o.value),!t||s.length!==t);r=!0);}catch(c){i=!0,a=c}finally{try{r||null==n.return||n.return()}finally{if(i)throw a}}return s}(e,t)||y(e,t)||T()}function M(e){return function(e){if(Array.isArray(e))return E(e)}(e)||I(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){if(Array.isArray(e))return e}function I(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function y(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,r=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return r=e.done,e},e:function(e){i=!0,s=e},f:function(){try{r||null==n.return||n.return()}finally{if(i)throw s}}}}var D={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",CONVERSATION_LIST_UPDATED:"onConversationListUpdated",GROUP_LIST_UPDATED:"onGroupListUpdated",GROUP_SYSTEM_NOTICE_RECEIVED:"receiveGroupSystemNotice",GROUP_ATTRIBUTES_UPDATED:"groupAttributesUpdated",TOPIC_CREATED:"onTopicCreated",TOPIC_DELETED:"onTopicDeleted",TOPIC_UPDATED:"onTopicUpdated",PROFILE_UPDATED:"onProfileUpdated",USER_STATUS_UPDATED:"onUserStatusUpdated",BLACKLIST_UPDATED:"blacklistUpdated",FRIEND_LIST_UPDATED:"onFriendListUpdated",FRIEND_GROUP_LIST_UPDATED:"onFriendGroupListUpdated",FRIEND_APPLICATION_LIST_UPDATED:"onFriendApplicationListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",SDK_RELOAD:"sdkReload"},C={MSG_TEXT:"TIMTextElem",MSG_IMAGE:"TIMImageElem",MSG_SOUND:"TIMSoundElem",MSG_AUDIO:"TIMSoundElem",MSG_FILE:"TIMFileElem",MSG_FACE:"TIMFaceElem",MSG_VIDEO:"TIMVideoFileElem",MSG_GEO:"TIMLocationElem",MSG_LOCATION:"TIMLocationElem",MSG_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_MERGER:"TIMRelayElem",MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest",CONV_C2C:"C2C",CONV_GROUP:"GROUP",CONV_TOPIC:"TOPIC",CONV_SYSTEM:"@TIM#SYSTEM",CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3,GRP_PRIVATE:"Private",GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_CHATROOM:"ChatRoom",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",GRP_MBR_ROLE_CUSTOM:"Custom",GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard",GENDER_UNKNOWN:"Gender_Type_Unknown",GENDER_FEMALE:"Gender_Type_Female",GENDER_MALE:"Gender_Type_Male",KICKED_OUT_MULT_ACCOUNT:"multipleAccount",KICKED_OUT_MULT_DEVICE:"multipleDevice",KICKED_OUT_USERSIG_EXPIRED:"userSigExpired",KICKED_OUT_REST_API:"REST_API_Kick",ALLOW_TYPE_ALLOW_ANY:"AllowType_Type_AllowAny",ALLOW_TYPE_NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_TYPE_DENY_ANY:"AllowType_Type_DenyAny",FORBID_TYPE_NONE:"AdminForbid_Type_None",FORBID_TYPE_SEND_OUT:"AdminForbid_Type_SendOut",JOIN_OPTIONS_FREE_ACCESS:"FreeAccess",JOIN_OPTIONS_NEED_PERMISSION:"NeedPermission",JOIN_OPTIONS_DISABLE_APPLY:"DisableApply",JOIN_STATUS_SUCCESS:"JoinedSuccess",JOIN_STATUS_ALREADY_IN_GROUP:"AlreadyInGroup",JOIN_STATUS_WAIT_APPROVAL:"WaitAdminApproval",GRP_PROFILE_OWNER_ID:"ownerID",GRP_PROFILE_CREATE_TIME:"createTime",GRP_PROFILE_LAST_INFO_TIME:"lastInfoTime",GRP_PROFILE_MEMBER_NUM:"memberNum",GRP_PROFILE_MAX_MEMBER_NUM:"maxMemberNum",GRP_PROFILE_JOIN_OPTION:"joinOption",GRP_PROFILE_INTRODUCTION:"introduction",GRP_PROFILE_NOTIFICATION:"notification",GRP_PROFILE_MUTE_ALL_MBRS:"muteAllMembers",SNS_ADD_TYPE_SINGLE:"Add_Type_Single",SNS_ADD_TYPE_BOTH:"Add_Type_Both",SNS_DELETE_TYPE_SINGLE:"Delete_Type_Single",SNS_DELETE_TYPE_BOTH:"Delete_Type_Both",SNS_APPLICATION_TYPE_BOTH:"Pendency_Type_Both",SNS_APPLICATION_SENT_TO_ME:"Pendency_Type_ComeIn",SNS_APPLICATION_SENT_BY_ME:"Pendency_Type_SendOut",SNS_APPLICATION_AGREE:"Response_Action_Agree",SNS_APPLICATION_AGREE_AND_ADD:"Response_Action_AgreeAndAdd",SNS_CHECK_TYPE_BOTH:"CheckResult_Type_Both",SNS_CHECK_TYPE_SINGLE:"CheckResult_Type_Single",SNS_TYPE_NO_RELATION:"CheckResult_Type_NoRelation",SNS_TYPE_A_WITH_B:"CheckResult_Type_AWithB",SNS_TYPE_B_WITH_A:"CheckResult_Type_BWithA",SNS_TYPE_BOTH_WAY:"CheckResult_Type_BothWay",NET_STATE_CONNECTED:"connected",NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected",MSG_AT_ALL:"__kImSDK_MesssageAtALL__",READ_ALL_C2C_MSG:"readAllC2CMessage",READ_ALL_GROUP_MSG:"readAllGroupMessage",READ_ALL_MSG:"readAllMessage",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3},N=function(){function e(){o(this,e),this.cache=[],this.options=null}return s(e,[{key:"use",value:function(e){if("function"!=typeof e)throw"middleware must be a function";return this.cache.push(e),this}},{key:"next",value:function(e){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:"run",value:function(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}]),e}(),A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function L(e,t){return e(t={exports:{}},t.exports),t.exports}var R=L((function(e,t){var n,o,a,s,r,i,c,u,l,d,p,_,g,h,f,m,M,v;e.exports=(n="function"==typeof Promise,o="object"==typeof self?self:A,a="undefined"!=typeof Symbol,s="undefined"!=typeof Map,r="undefined"!=typeof Set,i="undefined"!=typeof WeakMap,c="undefined"!=typeof WeakSet,u="undefined"!=typeof DataView,l=a&&void 0!==Symbol.iterator,d=a&&void 0!==Symbol.toStringTag,p=r&&"function"==typeof Set.prototype.entries,_=s&&"function"==typeof Map.prototype.entries,g=p&&Object.getPrototypeOf((new Set).entries()),h=_&&Object.getPrototypeOf((new Map).entries()),f=l&&"function"==typeof Array.prototype[Symbol.iterator],m=f&&Object.getPrototypeOf([][Symbol.iterator]()),M=l&&"function"==typeof String.prototype[Symbol.iterator],v=M&&Object.getPrototypeOf(""[Symbol.iterator]()),function(e){var t=typeof e;if("object"!==t)return t;if(null===e)return"null";if(e===o)return"global";if(Array.isArray(e)&&(!1===d||!(Symbol.toStringTag in e)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&e===window.location)return"Location";if("object"==typeof window.document&&e===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&e===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&e===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&e instanceof window.HTMLElement){if("BLOCKQUOTE"===e.tagName)return"HTMLQuoteElement";if("TD"===e.tagName)return"HTMLTableDataCellElement";if("TH"===e.tagName)return"HTMLTableHeaderCellElement"}}var a=d&&e[Symbol.toStringTag];if("string"==typeof a)return a;var l=Object.getPrototypeOf(e);return l===RegExp.prototype?"RegExp":l===Date.prototype?"Date":n&&l===Promise.prototype?"Promise":r&&l===Set.prototype?"Set":s&&l===Map.prototype?"Map":c&&l===WeakSet.prototype?"WeakSet":i&&l===WeakMap.prototype?"WeakMap":u&&l===DataView.prototype?"DataView":s&&l===h?"Map Iterator":r&&l===g?"Set Iterator":f&&l===m?"Array Iterator":M&&l===v?"String Iterator":null===l?"Object":Object.prototype.toString.call(e).slice(8,-1)})})),O=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;o(this,e),this.high=t,this.low=n}return s(e,[{key:"equal",value:function(e){return null!==e&&(this.low===e.low&&this.high===e.high)}},{key:"toString",value:function(){var e=Number(this.high).toString(16),t=Number(this.low).toString(16);if(t.length<8)for(var n=8-t.length;n;)t="0"+t,n--;return e+t}}]),e}(),k={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://api.im.qcloud.com"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com"},IND:{DEFAULT:"wss://wssind.im.qcloud.com",BACKUP:"wss://wssind.my-imcloud.com",STAT:"https://apiind.my-imcloud.com"}}},G={WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,UNI_NATIVE_APP:15},P="1.7.3",U=537048168,w="CHINA",b="OVERSEA",F="SINGAPORE",q="KOREA",V="GERMANY",H="IND",K={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://api.im.qcloud.com"},setCurrent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:w;this.CURRENT=k.PRODUCTION[e]}},NAME:{OPEN_IM:"openim",GROUP:"group_open_http_svc",GROUP_COMMUNITY:"million_group_open_http_svc",GROUP_ATTR:"group_open_attr_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GROUP_NO_AUTH:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_svc",BIG_GROUP_LONG_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",WEB_IM:"webim",IM_COS_SIGN:"im_cos_sign_svr",CUSTOM_UPLOAD:"im_cos_msg",HEARTBEAT:"heartbeat",IM_OPEN_PUSH:"im_open_push",IM_OPEN_STATUS:"im_open_status",IM_LONG_MESSAGE:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush"},CMD:{ACCESS_LAYER:"accesslayer",LOGIN:"wslogin",LOGOUT_LONG_POLL:"longpollinglogout",LOGOUT:"wslogout",HELLO:"wshello",PORTRAIT_GET:"portrait_get_all",PORTRAIT_SET:"portrait_set",GET_LONG_POLL_ID:"getlongpollingid",LONG_POLL:"longpolling",AVCHATROOM_LONG_POLL:"get_msg",ADD_FRIEND:"friend_add",UPDATE_FRIEND:"friend_update",GET_FRIEND_LIST:"friend_get",GET_FRIEND_PROFILE:"friend_get_list",DELETE_FRIEND:"friend_delete",CHECK_FRIEND:"friend_check",GET_FRIEND_GROUP_LIST:"group_get",RESPOND_FRIEND_APPLICATION:"friend_response",GET_FRIEND_APPLICATION_LIST:"pendency_get",DELETE_FRIEND_APPLICATION:"pendency_delete",REPORT_FRIEND_APPLICATION:"pendency_report",GET_GROUP_APPLICATION:"get_pendency",CREATE_FRIEND_GROUP:"group_add",DELETE_FRIEND_GROUP:"group_delete",UPDATE_FRIEND_GROUP:"group_update",GET_BLACKLIST:"black_list_get",ADD_BLACKLIST:"black_list_add",DELETE_BLACKLIST:"black_list_delete",CREATE_GROUP:"create_group",GET_JOINED_GROUPS:"get_joined_group_list",SET_GROUP_ATTRIBUTES:"set_group_attr",MODIFY_GROUP_ATTRIBUTES:"modify_group_attr",DELETE_GROUP_ATTRIBUTES:"delete_group_attr",CLEAR_GROUP_ATTRIBUTES:"clear_group_attr",GET_GROUP_ATTRIBUTES:"get_group_attr",SEND_MESSAGE:"sendmsg",REVOKE_C2C_MESSAGE:"msgwithdraw",DELETE_C2C_MESSAGE:"delete_c2c_msg_ramble",MODIFY_C2C_MESSAGE:"modify_c2c_msg",SEND_GROUP_MESSAGE:"send_group_msg",REVOKE_GROUP_MESSAGE:"group_msg_recall",DELETE_GROUP_MESSAGE:"delete_group_ramble_msg_by_seq",MODIFY_GROUP_MESSAGE:"modify_group_msg",GET_GROUP_INFO:"get_group_self_member_info",GET_GROUP_MEMBER_INFO:"get_specified_group_member_info",GET_GROUP_MEMBER_LIST:"get_group_member_info",QUIT_GROUP:"quit_group",CHANGE_GROUP_OWNER:"change_group_owner",DESTROY_GROUP:"destroy_group",ADD_GROUP_MEMBER:"add_group_member",DELETE_GROUP_MEMBER:"delete_group_member",SEARCH_GROUP_BY_ID:"get_group_public_info",APPLY_JOIN_GROUP:"apply_join_group",HANDLE_APPLY_JOIN_GROUP:"handle_apply_join_group",HANDLE_GROUP_INVITATION:"handle_invite_join_group",MODIFY_GROUP_INFO:"modify_group_base_info",MODIFY_GROUP_MEMBER_INFO:"modify_group_member_info",DELETE_GROUP_SYSTEM_MESSAGE:"deletemsg",DELETE_GROUP_AT_TIPS:"deletemsg",GET_CONVERSATION_LIST:"get",PAGING_GET_CONVERSATION_LIST:"page_get",DELETE_CONVERSATION:"delete",PIN_CONVERSATION:"top",GET_MESSAGES:"getmsg",GET_C2C_ROAM_MESSAGES:"getroammsg",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_GROUP_ROAM_MESSAGES:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",SET_C2C_MESSAGE_READ:"msgreaded",GET_PEER_READ_TIME:"get_peer_read_time",SET_GROUP_MESSAGE_READ:"msg_read_report",FILE_READ_AND_WRITE_AUTHKEY:"authkey",FILE_UPLOAD:"pic_up",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",VIDEO_COVER:"video_cover",TIM_WEB_REPORT_V2:"tim_web_report_v2",BIG_DATA_HALLWAY_AUTH_KEY:"authkey",GET_ONLINE_MEMBER_NUM:"get_online_member_num",ALIVE:"alive",MESSAGE_PUSH:"msg_push",MULTI_MESSAGE_PUSH:"multi_msg_push_ws",MESSAGE_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",DOWNLOAD_MERGER_MESSAGE:"get_relay_json_msg",UPLOAD_MERGER_MESSAGE:"save_relay_json_msg",FETCH_CLOUD_CONTROL_CONFIG:"fetch_config",PUSHED_CLOUD_CONTROL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",KICK_OTHER:"KickOther",OVERLOAD_NOTIFY:"notify2",SET_ALL_MESSAGE_READ:"read_all_unread_msg",CREATE_TOPIC:"create_topic",DELETE_TOPIC:"destroy_topic",UPDATE_TOPIC_PROFILE:"modify_topic",GET_TOPIC_LIST:"get_topic",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUBSCRIBE_USER_STATUS:"ws_status_subscribe",UNSUBSCRIBE_USER_STATUS:"ws_status_unsubscribe"},CHANNEL:{SOCKET:1,XHR:2,AUTO:0},NAME_VERSION:{openim:"v4",group_open_http_svc:"v4",sns:"v4",profile:"v4",recentcontact:"v4",openpic:"v4",group_open_http_noauth_svc:"v4",group_open_long_polling_http_svc:"v4",group_open_long_polling_http_noauth_svc:"v4",imopenstat:"v4",im_cos_sign_svr:"v4",im_cos_msg:"v4",webim:"v4",im_open_push:"v4",im_open_status:"v4"}},B={SEARCH_MSG:new O(0,Math.pow(2,0)).toString(),SEARCH_GRP_SNS:new O(0,Math.pow(2,1)).toString(),AVCHATROOM_HISTORY_MSG:new O(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new O(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new O(0,Math.pow(2,4)).toString(),USER_STATUS:new O(0,Math.pow(2,7)).toString()};K.HOST.setCurrent(w);var x,W,Y,j,$="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),z="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),J="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),X="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),Q="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),Z="undefined"!=typeof uni&&"undefined"==typeof window,ee="undefined"!=typeof uni,te=$||z||J||X||Q||Z,ne=("undefined"!=typeof uni||"undefined"!=typeof window)&&!te,oe=z?qq:J?tt:X?swan:Q?my:$?wx:Z?uni:{},ae=(x="WEB",ve?x="WEB":z?x="QQ_MP":J?x="TT_MP":X?x="BAIDU_MP":Q?x="ALI_MP":$?x="WX_MP":Z&&(x="UNI_NATIVE_APP"),G[x]),se=ne&&window&&window.navigator&&window.navigator.userAgent||"",re=/AppleWebKit\/([\d.]+)/i.exec(se),ie=(re&&parseFloat(re.pop()),/iPad/i.test(se)),ce=/iPhone/i.test(se)&&!ie,ue=/iPod/i.test(se),le=ce||ie||ue,de=(W=se.match(/OS (\d+)_/i))&&W[1]?W[1]:null,pe=/Android/i.test(se),_e=function(){var e=se.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),ge=(pe&&/webkit/i.test(se),/Firefox/i.test(se),/Edge/i.test(se)),he=!ge&&/Chrome/i.test(se),fe=(function(){var e=se.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),/MSIE/.test(se)||se.indexOf("Trident")>-1&&se.indexOf("rv:11.0")>-1),me=(/MSIE\s8\.0/.test(se),function(){var e=/MSIE\s(\d+)\.\d/.exec(se),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(se)&&/rv:11.0/.test(se)&&(t=11),t}()),Me=(/Safari/i.test(se),/TBS\/\d+/i.test(se)),ve=(function(){var e=se.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}(),!Me&&/MQQBrowser\/\d+/i.test(se),!Me&&/ QQBrowser\/\d+/i.test(se),/(micromessenger|webbrowser)/i.test(se)),Ie=/Windows/i.test(se),ye=/MAC OS X/i.test(se),Ee=(/MicroMessenger/i.test(se),ne&&"undefined"!=typeof Worker&&!fe),Te=pe||le,Se="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};Y="undefined"!=typeof console?console:void 0!==Se&&Se.console?Se.console:"undefined"!=typeof window&&window.console?window.console:{};for(var De=function(){},Ce=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],Ne=Ce.length;Ne--;)j=Ce[Ne],console[j]||(Y[j]=De);var Ae=Y,Le=0,Re=function(){return(new Date).getTime()+Le},Oe=function(){Le=0},ke=function(){return Math.floor(Re()/1e3)},Ge=0,Pe=new Map;function Ue(){var e,t=((e=new Date).setTime(Re()),e);return"TIM "+t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(e){var t;switch(e.toString().length){case 1:t="00"+e;break;case 2:t="0"+e;break;default:t=e}return t}(t.getMilliseconds())+":"}var we={arguments2String:function(e){var t;if(1===e.length)t=Ue()+e[0];else{t=Ue();for(var n=0,o=e.length;n4294967295?(it+=4294967295,Date.now()-it):e},utc:function(){return Math.round(Date.now()/1e3)}},ut=function e(t,n,o,a){if(!nt(t)||!nt(n))return 0;for(var s,r=0,i=Object.keys(n),c=0,u=i.length;c=0?o[s]=t[s]:o[s]=e(t[s])):o[s]=void 0:o[s]=null;return o};function It(e,t){Ze(e)&&Ze(t)?t.forEach((function(t){var n=t.key,o=t.value,a=e.find((function(e){return e.key===n}));a?a.value=o:e.push({key:n,value:o})})):we.warn("updateCustomField target 或 source 不是数组,忽略此次更新。")}var yt=function(e){return e===C.GRP_PUBLIC},Et=function(e){return e===C.GRP_AVCHATROOM},Tt=function(e){var t=e.type,n=e.groupID;return t===C.GRP_COMMUNITY||"".concat(n).startsWith(We)&&!"".concat(n).includes(Ye)},St=function(e){return"".concat(e).startsWith(We)&&"".concat(e).includes(Ye)},Dt=function(e){return Je(e)&&e.slice(0,3)===C.CONV_C2C},Ct=function(e){return Je(e)&&e.slice(0,5)===C.CONV_GROUP},Nt=function(e){return Je(e)&&e===C.CONV_SYSTEM};function At(e,t){var n={};return Object.keys(e).forEach((function(o){n[o]=t(e[o],o)})),n}function Lt(e){return te?new Promise((function(t,n){oe.getImageInfo({src:e,success:function(e){t({width:e.width,height:e.height})},fail:function(){t({width:0,height:0})}})})):fe&&9===me?Promise.resolve({width:0,height:0}):new Promise((function(t,n){var o=new Image;o.onload=function(){t({width:this.width,height:this.height}),o=null},o.onerror=function(){t({width:0,height:0}),o=null},o.src=e}))}function Rt(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return"".concat(e()+e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e())}function Ot(){var e="unknown";if(ye&&(e="mac"),Ie&&(e="windows"),le&&(e="ios"),pe&&(e="android"),te)try{var t=oe.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(n){}return e}function kt(e,t){e=e.split("."),t=t.split(".");for(var n=Math.max(e.length,t.length);e.lengths)return 1;if(a-1?"".concat(n,"&"):"".concat(n,"?");u.url="".concat(l,198===r?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")}return et(n)?_(u,je):u}function Pt(e){var t=e[2];e[2]=e[1],e[1]=t;for(var n=0;n=0}}},setGroupMemberNameCard:{groupID:Qt,userID:{type:"String"},nameCard:{type:"String",validator:function(e){return Je(e)?(e.length,!0):(console.warn(Xt({api:"setGroupMemberNameCard",param:"nameCard",desc:"类型必须为 String"})),!1)}}},setGroupMemberCustomField:{groupID:Qt,userID:{type:"String"},memberCustomField:Zt},deleteGroupMember:{groupID:Qt},createTextMessage:{to:Qt,conversationType:Qt,payload:t(t({},en),{},{validator:function(e){return Qe(e)?Je(e.text)?0!==e.text.length||(console.warn(Xt({api:"createTextMessage",desc:"消息内容不能为空"})),!1):(console.warn(Xt({api:"createTextMessage",param:"payload.text",desc:"类型必须为 String"})),!1):(console.warn(Xt({api:"createTextMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createTextAtMessage:{to:Qt,conversationType:Qt,payload:t(t({},en),{},{validator:function(e){return Qe(e)?Je(e.text)?0===e.text.length?(console.warn(Xt({api:"createTextAtMessage",desc:"消息内容不能为空"})),!1):!(e.atUserList&&!Ze(e.atUserList))||(console.warn(Xt({api:"createTextAtMessage",desc:"payload.atUserList 类型必须为数组"})),!1):(console.warn(Xt({api:"createTextAtMessage",param:"payload.text",desc:"类型必须为 String"})),!1):(console.warn(Xt({api:"createTextAtMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createCustomMessage:{to:Qt,conversationType:Qt,payload:t(t({},en),{},{validator:function(e){return Qe(e)?e.data&&!Je(e.data)?(console.warn(Xt({api:"createCustomMessage",param:"payload.data",desc:"类型必须为 String"})),!1):e.description&&!Je(e.description)?(console.warn(Xt({api:"createCustomMessage",param:"payload.description",desc:"类型必须为 String"})),!1):!(e.extension&&!Je(e.extension))||(console.warn(Xt({api:"createCustomMessage",param:"payload.extension",desc:"类型必须为 String"})),!1):(console.warn(Xt({api:"createCustomMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createImageMessage:{to:Qt,conversationType:Qt,payload:t(t({},en),{},{validator:function(e){if(!Qe(e))return console.warn(Xt({api:"createImageMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(et(e.file))return console.warn(Xt({api:"createImageMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(ne){if(!(e.file instanceof HTMLInputElement||$e(e.file)))return Qe(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(console.warn(Xt({api:"createImageMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1):(console.warn(Xt({api:"createImageMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(Xt({api:"createImageMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e){return et(e)&&console.warn(Xt({api:"createImageMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}})},createAudioMessage:{to:Qt,conversationType:Qt,payload:t(t({},en),{},{validator:function(e){return!!Qe(e)||(console.warn(Xt({api:"createAudioMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e){return et(e)&&console.warn(Xt({api:"createAudioMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},createVideoMessage:{to:Qt,conversationType:Qt,payload:t(t({},en),{},{validator:function(e){if(!Qe(e))return console.warn(Xt({api:"createVideoMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(et(e.file))return console.warn(Xt({api:"createVideoMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(ne){if(!(e.file instanceof HTMLInputElement||$e(e.file)))return Qe(e.file)&&"undefined"!=typeof uni?!!$e(e.file.tempFile)||(console.warn(Xt({api:"createVideoMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1):(console.warn(Xt({api:"createVideoMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(Xt({api:"createVideoMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return et(e)&&console.warn(Xt({api:"createVideoMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},createFaceMessage:{to:Qt,conversationType:Qt,payload:t(t({},en),{},{validator:function(e){return Qe(e)?ze(e.index)?!!Je(e.data)||(console.warn(Xt({api:"createFaceMessage",param:"payload.data",desc:"类型必须为 String"})),!1):(console.warn(Xt({api:"createFaceMessage",param:"payload.index",desc:"类型必须为 Number"})),!1):(console.warn(Xt({api:"createFaceMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createFileMessage:{to:Qt,conversationType:Qt,payload:t(t({},en),{},{validator:function(e){if(!Qe(e))return console.warn(Xt({api:"createFileMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(et(e.file))return console.warn(Xt({api:"createFileMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(ne){if(!(e.file instanceof HTMLInputElement||$e(e.file)))return Qe(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(console.warn(Xt({api:"createFileMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1):(console.warn(Xt({api:"createFileMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(Xt({api:"createFileMessage",desc:"您没有选择文件,无法发送"})),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return et(e)&&console.warn(Xt({api:"createFileMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},createLocationMessage:{to:Qt,conversationType:Qt,payload:t(t({},en),{},{validator:function(e){return Qe(e)?Je(e.description)?ze(e.longitude)?!!ze(e.latitude)||(console.warn(Xt({api:"createLocationMessage",param:"payload.latitude",desc:"类型必须为 Number"})),!1):(console.warn(Xt({api:"createLocationMessage",param:"payload.longitude",desc:"类型必须为 Number"})),!1):(console.warn(Xt({api:"createLocationMessage",param:"payload.description",desc:"类型必须为 String"})),!1):(console.warn(Xt({api:"createLocationMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createMergerMessage:{to:Qt,conversationType:Qt,payload:t(t({},en),{},{validator:function(e){if(Bt(e.messageList))return console.warn(Xt({api:"createMergerMessage",desc:"不能为空数组"})),!1;if(Bt(e.compatibleText))return console.warn(Xt({api:"createMergerMessage",desc:"类型必须为 String,且不能为空"})),!1;var t=!1;return e.messageList.forEach((function(e){e.status===jt.FAIL&&(t=!0)})),!t||(console.warn(Xt({api:"createMergerMessage",desc:"不支持合并已发送失败的消息"})),!1)}})},revokeMessage:[t(t({name:"message"},en),{},{validator:function(e){return Bt(e)?(console.warn(Xt({api:"revokeMessage",desc:"请传入消息(Message)实例"})),!1):e.conversationType===C.CONV_SYSTEM?(console.warn(Xt({api:"revokeMessage",desc:"不能撤回系统会话消息,只能撤回单聊消息或群消息"})),!1):!0!==e.isRevoked||(console.warn(Xt({api:"revokeMessage",desc:"消息已经被撤回,请勿重复操作"})),!1)}})],deleteMessage:[t(t({name:"messageList"},Zt),{},{validator:function(e){return!Bt(e)||(console.warn(Xt({api:"deleteMessage",param:"messageList",desc:"不能为空数组"})),!1)}})],modifyMessage:[t(t({name:"message"},en),{},{validator:function(e){return Bt(e)?(console.warn(Xt({api:"modifyMessage",desc:"请传入消息(Message)实例"})),!1):e.conversationType===C.CONV_SYSTEM?(console.warn(Xt({api:"modifyMessage",desc:"不支持修改系统会话消息,只能修改单聊消息或群消息"})),!1):!0!==e._onlineOnlyFlag||(console.warn(Xt({api:"modifyMessage",desc:"不支持修改在线消息"})),!1)}})],getUserProfile:{userIDList:{type:"Array",validator:function(e){return Ze(e)?(0===e.length&&console.warn(Xt({api:"getUserProfile",param:"userIDList",desc:"不能为空数组"})),!0):(console.warn(Xt({api:"getUserProfile",param:"userIDList",desc:"必须为数组"})),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e){return!!et(e)||(!!Ze(e)||(console.warn(Xt({api:"updateMyProfile",param:"profileCustomField",desc:"必须为数组"})),!1))}}},setSelfStatus:{customStatus:{type:"String",validator:function(e){return!!Je(e)||(console.warn(Xt({api:"setSelfStatus",param:"customStatus",desc:Qt})),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(e){return Ze(e)?0!==e.length||(console.warn(Xt({api:"getUserStatus",param:"userIDList",desc:"不能为空数组"})),!1):(console.warn(Xt({api:"getUserStatus",param:"userIDList",desc:"必须为数组"})),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return Ze(e)?0!==e.length||(console.warn(Xt({api:"subscribeUserStatus",param:"userIDList",desc:"不能为空数组"})),!1):(console.warn(Xt({api:"subscribeUserStatus",param:"userIDList",desc:"必须为数组"})),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return!e||(!!Ze(e)||(console.warn(Xt({api:"subscribeUserStatus",param:"userIDList",desc:"必须为数组"})),!1))}}},addFriend:{to:Qt,source:{type:"String",required:!0,validator:function(e){return!!e&&(e.startsWith("AddSource_Type_")?!(e.replace("AddSource_Type_","").length>8)||(console.warn(Xt({api:"addFriend",desc:"加好友来源字段的关键字长度不得超过8字节"})),!1):(console.warn(Xt({api:"addFriend",desc:"加好友来源字段的前缀必须是:AddSource_Type_"})),!1))}},remark:{type:"String",required:!1,validator:function(e){return!(Je(e)&&e.length>96)||(console.warn(Xt({api:"updateFriend",desc:" 备注长度最长不得超过 96 个字节"})),!1)}}},deleteFriend:{userIDList:Zt},checkFriend:{userIDList:Zt},getFriendProfile:{userIDList:Zt},updateFriend:{userID:Qt,remark:{type:"String",required:!1,validator:function(e){return!(Je(e)&&e.length>96)||(console.warn(Xt({api:"updateFriend",desc:" 备注长度最长不得超过 96 个字节"})),!1)}},friendCustomField:{type:"Array",required:!1,validator:function(e){if(e){if(!Ze(e))return console.warn(Xt({api:"updateFriend",param:"friendCustomField",desc:"必须为数组"})),!1;var t=!0;return e.forEach((function(e){return Je(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?Je(e.value)?e.value.length>8?(console.warn(Xt({api:"updateFriend",desc:"好友自定义字段的关键字长度不得超过8字节"})),t=!1):void 0:(console.warn(Xt({api:"updateFriend",desc:"类型必须为 String"})),t=!1):(console.warn(Xt({api:"updateFriend",desc:"好友自定义字段的前缀必须是 Tag_SNS_Custom"})),t=!1)})),t}return!0}}},acceptFriendApplication:{userID:Qt},refuseFriendApplication:{userID:Qt},deleteFriendApplication:{userID:Qt},createFriendGroup:{name:Qt},deleteFriendGroup:{name:Qt},addToFriendGroup:{name:Qt,userIDList:Zt},removeFromFriendGroup:{name:Qt,userIDList:Zt},renameFriendGroup:{oldName:Qt,newName:Qt},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(e){return Ze(e)?0!==e.length||(console.warn(Xt({api:"sendMessageReadReceipt",param:"messageList",desc:"不能为空数组"})),!1):(console.warn(Xt({api:"sendMessageReadReceipt",param:"messageList",desc:"必须为数组"})),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(e){return Ze(e)?0!==e.length||(console.warn(Xt({api:"getMessageReadReceiptList",param:"messageList",desc:"不能为空数组"})),!1):(console.warn(Xt({api:"getMessageReadReceiptList",param:"messageList",desc:"必须为数组"})),!1)}}],createTopicInCommunity:{groupID:Qt,topicName:Qt},deleteTopicFromCommunity:{groupID:Qt,topicIDList:{type:"Array",validator:function(e){return!e||(!!Ze(e)||(console.warn(Xt({api:"deleteTopicFromCommunity",param:"topicIDList",desc:"必须为数组"})),!1))}}},updateTopicProfile:{groupID:Qt,topicID:Qt},getTopicList:{groupID:Qt,topicIDList:{type:"Array",validator:function(e){return!e||(!!Ze(e)||(console.warn(Xt({api:"getTopicList",param:"topicIDList",desc:"必须为数组"})),!1))}}}},nn={login:"login",logout:"logout",on:"on",once:"once",off:"off",setLogLevel:"setLogLevel",registerPlugin:"registerPlugin",destroy:"destroy",createTextMessage:"createTextMessage",createTextAtMessage:"createTextAtMessage",createImageMessage:"createImageMessage",createAudioMessage:"createAudioMessage",createVideoMessage:"createVideoMessage",createCustomMessage:"createCustomMessage",createFaceMessage:"createFaceMessage",createFileMessage:"createFileMessage",createLocationMessage:"createLocationMessage",createMergerMessage:"createMergerMessage",downloadMergerMessage:"downloadMergerMessage",createForwardMessage:"createForwardMessage",sendMessage:"sendMessage",resendMessage:"resendMessage",revokeMessage:"revokeMessage",deleteMessage:"deleteMessage",modifyMessage:"modifyMessage",sendMessageReadReceipt:"sendMessageReadReceipt",getGroupMessageReadMemberList:"getGroupMessageReadMemberList",getMessageReadReceiptList:"getMessageReadReceiptList",getMessageList:"getMessageList",findMessage:"findMessage",getMessageListHopping:"getMessageListHopping",setMessageRead:"setMessageRead",setAllMessageRead:"setAllMessageRead",getConversationList:"getConversationList",getConversationProfile:"getConversationProfile",deleteConversation:"deleteConversation",pinConversation:"pinConversation",getGroupList:"getGroupList",getGroupProfile:"getGroupProfile",createGroup:"createGroup",joinGroup:"joinGroup",updateGroupProfile:"updateGroupProfile",quitGroup:"quitGroup",dismissGroup:"dismissGroup",changeGroupOwner:"changeGroupOwner",searchGroupByID:"searchGroupByID",setMessageRemindType:"setMessageRemindType",handleGroupApplication:"handleGroupApplication",initGroupAttributes:"initGroupAttributes",setGroupAttributes:"setGroupAttributes",deleteGroupAttributes:"deleteGroupAttributes",getGroupAttributes:"getGroupAttributes",getJoinedCommunityList:"getJoinedCommunityList",createTopicInCommunity:"createTopicInCommunity",deleteTopicFromCommunity:"deleteTopicFromCommunity",updateTopicProfile:"updateTopicProfile",getTopicList:"getTopicList",getGroupMemberProfile:"getGroupMemberProfile",getGroupMemberList:"getGroupMemberList",addGroupMember:"addGroupMember",deleteGroupMember:"deleteGroupMember",setGroupMemberNameCard:"setGroupMemberNameCard",setGroupMemberMuteTime:"setGroupMemberMuteTime",setGroupMemberRole:"setGroupMemberRole",setGroupMemberCustomField:"setGroupMemberCustomField",getGroupOnlineMemberCount:"getGroupOnlineMemberCount",getMyProfile:"getMyProfile",getUserProfile:"getUserProfile",updateMyProfile:"updateMyProfile",setSelfStatus:"setSelfStatus",getUserStatus:"getUserStatus",subscribeUserStatus:"subscribeUserStatus",unsubscribeUserStatus:"unsubscribeUserStatus",getBlacklist:"getBlacklist",addToBlacklist:"addToBlacklist",removeFromBlacklist:"removeFromBlacklist",getFriendList:"getFriendList",addFriend:"addFriend",deleteFriend:"deleteFriend",checkFriend:"checkFriend",updateFriend:"updateFriend",getFriendProfile:"getFriendProfile",getFriendApplicationList:"getFriendApplicationList",refuseFriendApplication:"refuseFriendApplication",deleteFriendApplication:"deleteFriendApplication",acceptFriendApplication:"acceptFriendApplication",setFriendApplicationRead:"setFriendApplicationRead",getFriendGroupList:"getFriendGroupList",createFriendGroup:"createFriendGroup",renameFriendGroup:"renameFriendGroup",deleteFriendGroup:"deleteFriendGroup",addToFriendGroup:"addToFriendGroup",removeFromFriendGroup:"removeFromFriendGroup",callExperimentalAPI:"callExperimentalAPI"},on="sign",an="message",sn="user",rn="c2c",cn="group",un="sns",ln="groupMember",dn="Topic",pn="conversation",_n="context",gn="storage",hn="eventStat",fn="netMonitor",mn="bigDataChannel",Mn="upload",vn="plugin",In="syncUnreadMessage",yn="session",En="channel",Tn="message_loss_detection",Sn="cloudControl",Dn="workerTimer",Cn="pullGroupMessage",Nn="qualityStat",An="commercialConfig",Ln=function(){function e(t){o(this,e),this._moduleManager=t,this._className=""}return s(e,[{key:"isLoggedIn",value:function(){return this._moduleManager.getModule(_n).isLoggedIn()}},{key:"isOversea",value:function(){return this._moduleManager.getModule(_n).isOversea()}},{key:"isPrivateNetWork",value:function(){return this._moduleManager.getModule(_n).isPrivateNetWork()}},{key:"getMyUserID",value:function(){return this._moduleManager.getModule(_n).getUserID()}},{key:"getMyTinyID",value:function(){return this._moduleManager.getModule(_n).getTinyID()}},{key:"getModule",value:function(e){return this._moduleManager.getModule(e)}},{key:"getPlatform",value:function(){return ae}},{key:"getNetworkType",value:function(){return this._moduleManager.getModule(fn).getNetworkType()}},{key:"probeNetwork",value:function(e){return this.isPrivateNetWork()?Promise.resolve([!0,this.getNetworkType()]):this._moduleManager.getModule(fn).probe(e)}},{key:"getCloudConfig",value:function(e){return this._moduleManager.getModule(Sn).getCloudConfig(e)}},{key:"emitOuterEvent",value:function(e,t){this._moduleManager.getOuterEmitterInstance().emit(e,t)}},{key:"emitInnerEvent",value:function(e,t){this._moduleManager.getInnerEmitterInstance().emit(e,t)}},{key:"getInnerEmitterInstance",value:function(){return this._moduleManager.getInnerEmitterInstance()}},{key:"generateTjgID",value:function(e){return this._moduleManager.getModule(_n).getTinyID()+"-"+e.random}},{key:"filterModifiedMessage",value:function(e){if(!Bt(e)){var t=e.filter((function(e){return!0===e.isModified}));t.length>0&&this.emitOuterEvent(D.MESSAGE_MODIFIED,t)}}},{key:"filterUnmodifiedMessage",value:function(e){return Bt(e)?[]:e.filter((function(e){return!1===e.isModified}))}},{key:"request",value:function(e){return this._moduleManager.getModule(yn).request(e)}}]),e}(),Rn="wslogin",On="wslogout",kn="wshello",Gn="KickOther",Pn="getmsg",Un="authkey",wn="sendmsg",bn="send_group_msg",Fn="portrait_get_all",qn="portrait_set",Vn="black_list_get",Hn="black_list_add",Kn="black_list_delete",Bn="friend_get",xn="friend_get_list",Wn="friend_check",Yn="friend_delete",jn="friend_add",$n="friend_update",zn="friend_response",Jn="pendency_get",Xn="pendency_delete",Qn="pendency_report",Zn="group_get",eo="group_add",to="group_delete",no="group_update",oo="msgwithdraw",ao="msgreaded",so="set_c2c_peer_mute_notifications",ro="get_c2c_peer_mute_notifications",io="getroammsg",co="get_peer_read_time",uo="delete_c2c_msg_ramble",lo="modify_c2c_msg",po="page_get",_o="get",go="delete",ho="top",fo="deletemsg",mo="get_joined_group_list",Mo="get_group_self_member_info",vo="create_group",Io="destroy_group",yo="modify_group_base_info",Eo="apply_join_group",To="apply_join_group_noauth",So="quit_group",Do="get_group_public_info",Co="change_group_owner",No="handle_apply_join_group",Ao="handle_invite_join_group",Lo="group_msg_recall",Ro="msg_read_report",Oo="read_all_unread_msg",ko="group_msg_get",Go="get_group_msg_receipt",Po="group_msg_receipt",Uo="c2c_msg_read_receipt",wo="get_group_msg_receipt_detail",bo="get_pendency",Fo="deletemsg",qo="get_msg",Vo="get_msg_noauth",Ho="get_online_member_num",Ko="delete_group_ramble_msg_by_seq",Bo="modify_group_msg",xo="set_group_attr",Wo="modify_group_attr",Yo="delete_group_attr",jo="clear_group_attr",$o="get_group_attr",zo="get_group_member_info",Jo="get_specified_group_member_info",Xo="add_group_member",Qo="delete_group_member",Zo="modify_group_member_info",ea="cos",ta="pre_sig",na="video_cover",oa="tim_web_report_v2",aa="alive",sa="msg_push",ra="multi_msg_push_ws",ia="ws_msg_push_ack",ca="stat_forceoffline",ua="save_relay_json_msg",la="get_relay_json_msg",da="fetch_config",pa="push_configv2",_a="fetch_imsdk_purchase_bitsv2",ga="push_imsdk_purchase_bitsv2",ha="notify2",fa="create_topic",ma="destroy_topic",Ma="modify_topic",va="get_topic",Ia="ws_set_custom_status",ya="ws_get_user_status",Ea="ws_status_subscribe",Ta="ws_status_unsubscribe",Sa={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,COS_UNDETECTED:2040,COS_GET_SIG_FAIL:2041,MESSAGE_SEND_FAIL:2100,MESSAGE_LIST_CONSTRUCTOR_NEED_OPTIONS:2103,MESSAGE_SEND_NEED_MESSAGE_INSTANCE:2105,MESSAGE_SEND_INVALID_CONVERSATION_TYPE:2106,MESSAGE_FILE_IS_EMPTY:2108,MESSAGE_ONPROGRESS_FUNCTION_ERROR:2109,MESSAGE_REVOKE_FAIL:2110,MESSAGE_DELETE_FAIL:2111,MESSAGE_UNREAD_ALL_FAIL:2112,MESSAGE_CONTROL_INFO_FAIL:2113,READ_RECEIPT_MESSAGE_LIST_EMPTY:2114,MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GROUP_SYSTEM_NOTICE:2116,MESSAGE_IMAGE_SELECT_FILE_FIRST:2251,MESSAGE_IMAGE_TYPES_LIMIT:2252,MESSAGE_IMAGE_SIZE_LIMIT:2253,MESSAGE_AUDIO_UPLOAD_FAIL:2300,MESSAGE_AUDIO_SIZE_LIMIT:2301,MESSAGE_VIDEO_UPLOAD_FAIL:2350,MESSAGE_VIDEO_SIZE_LIMIT:2351,MESSAGE_VIDEO_TYPES_LIMIT:2352,MESSAGE_FILE_UPLOAD_FAIL:2400,MESSAGE_FILE_SELECT_FILE_FIRST:2401,MESSAGE_FILE_SIZE_LIMIT:2402,MESSAGE_FILE_URL_IS_EMPTY:2403,MESSAGE_MERGER_TYPE_INVALID:2450,MESSAGE_MERGER_KEY_INVALID:2451,MESSAGE_MERGER_DOWNLOAD_FAIL:2452,MESSAGE_FORWARD_TYPE_INVALID:2453,MESSAGE_MODIFY_CONFLICT:2480,MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM:2481,CONVERSATION_NOT_FOUND:2500,USER_OR_GROUP_NOT_FOUND:2501,CONVERSATION_UN_RECORDED_TYPE:2502,ILLEGAL_GROUP_TYPE:2600,CANNOT_JOIN_WORK:2601,ILLEGAL_GROUP_ID:2602,CANNOT_CHANGE_OWNER_IN_AVCHATROOM:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,CANNOT_DISMISS_Work:2622,MEMBER_NOT_IN_GROUP:2623,CANNOT_USE_GRP_ATTR_NOT_AVCHATROOM:2641,CANNOT_USE_GRP_ATTR_AVCHATROOM_UNJOIN:2642,JOIN_GROUP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AVCHATROOM:2661,CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:2662,CANNOT_KICK_MEMBER_IN_AVCHATROOM:2680,NOT_OWNER:2681,CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:2682,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GROUP_EXISTED:2710,FRIEND_GROUP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,ADD_BLACKLIST_INVALID_PARAM:2740,DEL_BLACKLIST_INVALID_PARAM:2741,CANNOT_ADD_SELF_TO_BLACKLIST:2742,ADD_FRIEND_INVALID_PARAM:2760,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NETWORK_BASE_OPTIONS_NO_URL:2802,NETWORK_UNDEFINED_SERVER_NAME:2803,NETWORK_PACKAGE_UNDEFINED:2804,NO_NETWORK:2805,CONVERTOR_IRREGULAR_PARAMS:2900,NOTICE_RUNLOOP_UNEXPECTED_CONDITION:2901,NOTICE_RUNLOOP_OFFSET_LOST:2902,UNCAUGHT_ERROR:2903,GET_LONGPOLL_ID_FAILED:2904,INVALID_OPERATION:2905,OVER_FREQUENCY_LIMIT:2996,CANNOT_FIND_PROTOCOL:2997,CANNOT_FIND_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,CANNOT_USE_COMMERCIAL_ABILITY:3122,LONG_POLL_KICK_OUT:91101,MESSAGE_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,LONG_POLL_API_PARAM_ERROR:90001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022},Da={NO_SDKAPPID:"无 SDKAppID",NO_ACCOUNT_TYPE:"无 accountType",NO_IDENTIFIER:"无 userID",NO_USERSIG:"无 userSig",NO_TINYID:"无 tinyID",NO_A2KEY:"无 a2key",USER_NOT_LOGGED_IN:"用户未登录",REPEAT_LOGIN:"重复登录",COS_UNDETECTED:"未检测到 COS 上传插件",COS_GET_SIG_FAIL:"获取 COS 预签名 URL 失败",MESSAGE_SEND_FAIL:"消息发送失败",MESSAGE_LIST_CONSTRUCTOR_NEED_OPTIONS:"MessageController.constructor() 需要参数 options",MESSAGE_SEND_NEED_MESSAGE_INSTANCE:"需要 Message 的实例",MESSAGE_SEND_INVALID_CONVERSATION_TYPE:'Message.conversationType 只能为 "C2C" 或 "GROUP"',MESSAGE_FILE_IS_EMPTY:"无法发送空文件",MESSAGE_ONPROGRESS_FUNCTION_ERROR:"回调函数运行时遇到错误,请检查接入侧代码",MESSAGE_REVOKE_FAIL:"消息撤回失败",MESSAGE_DELETE_FAIL:"消息删除失败",MESSAGE_UNREAD_ALL_FAIL:"设置所有未读消息为已读处理失败",MESSAGE_CONTROL_INFO_FAIL:"社群不支持消息发送控制选项",READ_RECEIPT_MESSAGE_LIST_EMPTY:"消息列表中没有需要发送已读回执的消息",MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL:"不能在支持话题的群组中发消息,请检查群组 isSupportTopic 属性",CANNOT_DELETE_GROUP_SYSTEM_NOTICE:"不支持删除群系统通知",MESSAGE_IMAGE_SELECT_FILE_FIRST:"请先选择一个图片",MESSAGE_IMAGE_TYPES_LIMIT:"只允许上传 jpg png jpeg gif bmp image webp 格式的图片",MESSAGE_IMAGE_SIZE_LIMIT:"图片大小超过20M,无法发送",MESSAGE_AUDIO_UPLOAD_FAIL:"语音上传失败",MESSAGE_AUDIO_SIZE_LIMIT:"语音大小大于20M,无法发送",MESSAGE_VIDEO_UPLOAD_FAIL:"视频上传失败",MESSAGE_VIDEO_SIZE_LIMIT:"视频大小超过100M,无法发送",MESSAGE_VIDEO_TYPES_LIMIT:"只允许上传 mp4 格式的视频",MESSAGE_FILE_UPLOAD_FAIL:"文件上传失败",MESSAGE_FILE_SELECT_FILE_FIRST:"请先选择一个文件",MESSAGE_FILE_SIZE_LIMIT:"文件大小超过100M,无法发送 ",MESSAGE_FILE_URL_IS_EMPTY:"缺少必要的参数文件 URL",MESSAGE_MERGER_TYPE_INVALID:"非合并消息",MESSAGE_MERGER_KEY_INVALID:"合并消息的 messageKey 无效",MESSAGE_MERGER_DOWNLOAD_FAIL:"下载合并消息失败",MESSAGE_FORWARD_TYPE_INVALID:"选择的消息类型(如群提示消息)不可以转发",MESSAGE_MODIFY_CONFLICT:"修改消息时发生冲突",MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM:"直播群不支持修改消息",CONVERSATION_NOT_FOUND:"没有找到相应的会话,请检查传入参数",USER_OR_GROUP_NOT_FOUND:"没有找到相应的用户或群组,请检查传入参数",CONVERSATION_UN_RECORDED_TYPE:"未记录的会话类型",ILLEGAL_GROUP_TYPE:"非法的群类型,请检查传入参数",CANNOT_JOIN_WORK:"不能加入 Work 类型的群组",ILLEGAL_GROUP_ID:"群组 ID 非法,非 Community 类型群组不能以 @TGS#_ 为前缀,Community 类型群组必须以 @TGS#_ 为前缀且不能包含 @TOPIC#_ 字符串",CANNOT_CHANGE_OWNER_IN_AVCHATROOM:"AVChatRoom 类型的群组不能转让群主",CANNOT_CHANGE_OWNER_TO_SELF:"不能把群主转让给自己",CANNOT_DISMISS_WORK:"不能解散 Work 类型的群组",MEMBER_NOT_IN_GROUP:"用户不在该群组内",JOIN_GROUP_FAIL:"加群失败,请检查传入参数或重试",CANNOT_ADD_MEMBER_IN_AVCHATROOM:"AVChatRoom 类型的群不支持邀请群成员",CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:"非 AVChatRoom 类型的群组不允许匿名加群,请先登录后再加群",CANNOT_KICK_MEMBER_IN_AVCHATROOM:"不能在 AVChatRoom 类型的群组踢人",NOT_OWNER:"你不是群主,只有群主才有权限操作",CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:"不能在 Work / AVChatRoom 类型的群中设置群成员身份",INVALID_MEMBER_ROLE:"不合法的群成员身份,请检查传入参数",CANNOT_SET_SELF_MEMBER_ROLE:"不能设置自己的群成员身份,请检查传入参数",CANNOT_MUTE_SELF:"不能将自己禁言,请检查传入参数",NOT_MY_FRIEND:"非好友关系",ALREADY_MY_FRIEND:"已经是好友关系",FRIEND_GROUP_EXISTED:"好友分组已存在",FRIEND_GROUP_NOT_EXIST:"好友分组不存在",FRIEND_APPLICATION_NOT_EXIST:"好友申请不存在",UPDATE_PROFILE_INVALID_PARAM:"传入 updateMyProfile 接口的参数无效",UPDATE_PROFILE_NO_KEY:"updateMyProfile 无标配资料字段或自定义资料字段",ADD_BLACKLIST_INVALID_PARAM:"传入 addToBlacklist 接口的参数无效",DEL_BLACKLIST_INVALID_PARAM:"传入 removeFromBlacklist 接口的参数无效",CANNOT_ADD_SELF_TO_BLACKLIST:"不能拉黑自己",ADD_FRIEND_INVALID_PARAM:"传入 addFriend 接口的参数无效",NETWORK_ERROR:"网络错误",NETWORK_TIMEOUT:"请求超时",NETWORK_BASE_OPTIONS_NO_URL:"网络层初始化错误,缺少 URL 参数",NETWORK_UNDEFINED_SERVER_NAME:"打包错误,未定义的 serverName",NETWORK_PACKAGE_UNDEFINED:"未定义的 packageConfig",NO_NETWORK:"未连接到网络",CONVERTOR_IRREGULAR_PARAMS:"不规范的参数名称",NOTICE_RUNLOOP_UNEXPECTED_CONDITION:"意料外的通知条件",NOTICE_RUNLOOP_OFFSET_LOST:"_syncOffset 丢失",GET_LONGPOLL_ID_FAILED:"获取 longpolling id 失败",UNCAUGHT_ERROR:"未经明确定义的错误",INVALID_OPERATION:"无效操作,如调用了未定义或者未实现的方法等",CANNOT_FIND_PROTOCOL:"无法找到协议",CANNOT_FIND_MODULE:"无法找到模块,请参考:https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-03-sns.html",SDK_IS_NOT_READY:"接口需要 SDK 处于 ready 状态后才能调用",LOGGING_IN:"用户正在登录中",LOGIN_FAILED:"用户登录失败",KICKED_OUT_MULT_DEVICE:"用户多终端登录被踢出",KICKED_OUT_MULT_ACCOUNT:"用户多实例登录被踢出",KICKED_OUT_USERSIG_EXPIRED:"用户 userSig 过期被踢出",LOGGED_OUT:"用户已登出",KICKED_OUT_REST_API:"用户被 REST API - kick 接口: https://cloud.tencent.com/document/product/269/3853 踢出",OVER_FREQUENCY_LIMIT:"超出 SDK 频率控制",LONG_POLL_KICK_OUT:"检测到多个 web 实例登录,消息通道下线",OPEN_SERVICE_OVERLOAD_ERROR:"后台服务正忙,请稍后再试",MESSAGE_A2KEY_EXPIRED:"消息错误码:UserSig 或 A2 失效。",ACCOUNT_A2KEY_EXPIRED:"帐号错误码:UserSig 已过期,请重新生成。建议 UserSig 有效期设置不小于24小时。",LONG_POLL_API_PARAM_ERROR:"longPoll API parameters error",ILLEGAL_TOPIC_ID:"topicID 非法",CANNOT_USE_COMMERCIAL_ABILITY:"套餐包不支持该接口的使用,请升级到旗舰版套餐"},Ca="networkRTT",Na="messageE2EDelay",Aa="sendMessageC2C",La="sendMessageGroup",Ra="sendMessageGroupAV",Oa="sendMessageRichMedia",ka="cosUpload",Ga="messageReceivedGroup",Pa="messageReceivedGroupAVPush",Ua="messageReceivedGroupAVPull",wa=(r(Yt={},Ca,2),r(Yt,Na,3),r(Yt,Aa,4),r(Yt,La,5),r(Yt,Ra,6),r(Yt,Oa,7),r(Yt,Ga,8),r(Yt,Pa,9),r(Yt,Ua,10),r(Yt,ka,11),Yt),ba={info:4,warning:5,error:6},Fa={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},qa={login:4},Va=function(){function e(t){o(this,e),this.eventType=qa[t]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=t,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=Re()}return s(e,[{key:"updateTimeStamp",value:function(){this.timestamp=Re()}},{key:"start",value:function(e){return this._startts=e,this}},{key:"end",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._sentFlag){var n=Re();0===this.costTime&&(this.costTime=n-this._startts),this.setMoreMessage("startts:".concat(this._startts," endts:").concat(n)),t?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout((function(){e._sentFlag=!0,e._eventStatModule&&e._eventStatModule.pushIn(e)}),0)}}},{key:"setError",value:function(e,t,n){return e instanceof Error?(this._sentFlag||(this.setNetworkType(n),t?(e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message)):(this.setCode(Sa.NO_NETWORK),this.setMoreMessage(Da.NO_NETWORK)),this.setLevel("error")),this):(we.warn("SSOLogData.setError value not instanceof Error, please check!"),this)}},{key:"setCode",value:function(e){return et(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),ze(e)?this.code=e:we.warn("SSOLogData.setCode value not a number, please check!",e,n(e))),this}},{key:"setMessage",value:function(e){return et(e)||this._sentFlag||(ze(e)&&(this.message=e.toString()),Je(e)&&(this.message=e)),this}},{key:"setCostTime",value:function(e){return this.costTime=e,this}},{key:"setLevel",value:function(e){return et(e)||this._sentFlag||(this.level=ba[e]),this}},{key:"setMoreMessage",value:function(e){return Bt(this.moreMessage)?this.moreMessage="".concat(e):this.moreMessage+=" ".concat(e),this}},{key:"setNetworkType",value:function(e){if(et(e))we.warn("SSOLogData.setNetworkType value is undefined, please check!");else{var t=Fa[e.toLowerCase()];et(t)||(this.networkType=t)}return this}},{key:"getStartTs",value:function(){return this._startts}},{key:"setUIPlatform",value:function(e){this.uiPlatform=e}}],[{key:"bindEventStatModule",value:function(t){e.prototype._eventStatModule=t}}]),e}(),Ha={SDK_CONSTRUCT:"sdkConstruct",SDK_READY:"sdkReady",LOGIN:"login",LOGOUT:"logout",KICKED_OUT:"kickedOut",REGISTER_PLUGIN:"registerPlugin",KICK_OTHER:"kickOther",WS_CONNECT:"wsConnect",WS_ON_OPEN:"wsOnOpen",WS_ON_CLOSE:"wsOnClose",WS_ON_ERROR:"wsOnError",NETWORK_CHANGE:"networkChange",GET_COS_AUTH_KEY:"getCosAuthKey",GET_COS_PRE_SIG_URL:"getCosPreSigUrl",GET_SNAPSHOT_INFO:"getSnapshotInfo",UPLOAD:"upload",SEND_MESSAGE:"sendMessage",SEND_MESSAGE_WITH_RECEIPT:"sendMessageWithReceipt",SEND_COMBO_MESSAGE:"sendComboMessage",GET_C2C_ROAMING_MESSAGES:"getC2CRoamingMessages",GET_GROUP_ROAMING_MESSAGES:"getGroupRoamingMessages",GET_C2C_ROAMING_MESSAGES_HOPPING:"getC2CRoamingMessagesHopping",GET_GROUP_ROAMING_MESSAGES_HOPPING:"getGroupRoamingMessagesHopping",GET_READ_RECEIPT:"getReadReceipt",GET_READ_RECEIPT_DETAIL:"getReadReceiptDetail",SEND_READ_RECEIPT:"sendReadReceipt",SEND_C2C_READ_RECEIPT:"sendC2CReadReceipt",REVOKE_MESSAGE:"revokeMessage",DELETE_MESSAGE:"deleteMessage",EDIT_MESSAGE:"modifyMessage",SET_C2C_MESSAGE_READ:"setC2CMessageRead",SET_GROUP_MESSAGE_READ:"setGroupMessageRead",EMPTY_MESSAGE_BODY:"emptyMessageBody",GET_PEER_READ_TIME:"getPeerReadTime",UPLOAD_MERGER_MESSAGE:"uploadMergerMessage",DOWNLOAD_MERGER_MESSAGE:"downloadMergerMessage",JSON_PARSE_ERROR:"jsonParseError",MESSAGE_E2E_DELAY_EXCEPTION:"messageE2EDelayException",GET_CONVERSATION_LIST:"getConversationList",GET_CONVERSATION_PROFILE:"getConversationProfile",DELETE_CONVERSATION:"deleteConversation",PIN_CONVERSATION:"pinConversation",GET_CONVERSATION_LIST_IN_STORAGE:"getConversationListInStorage",SYNC_CONVERSATION_LIST:"syncConversationList",SET_ALL_MESSAGE_READ:"setAllMessageRead",CREATE_GROUP:"createGroup",APPLY_JOIN_GROUP:"applyJoinGroup",QUIT_GROUP:"quitGroup",SEARCH_GROUP_BY_ID:"searchGroupByID",CHANGE_GROUP_OWNER:"changeGroupOwner",HANDLE_GROUP_APPLICATION:"handleGroupApplication",HANDLE_GROUP_INVITATION:"handleGroupInvitation",SET_MESSAGE_REMIND_TYPE:"setMessageRemindType",DISMISS_GROUP:"dismissGroup",UPDATE_GROUP_PROFILE:"updateGroupProfile",GET_GROUP_LIST:"getGroupList",GET_GROUP_PROFILE:"getGroupProfile",GET_GROUP_LIST_IN_STORAGE:"getGroupListInStorage",GET_GROUP_LAST_SEQUENCE:"getGroupLastSequence",GET_GROUP_MISSING_MESSAGE:"getGroupMissingMessage",PAGING_GET_GROUP_LIST:"pagingGetGroupList",PAGING_GET_GROUP_LIST_WITH_TOPIC:"pagingGetGroupListWithTopic",GET_GROUP_SIMPLIFIED_INFO:"getGroupSimplifiedInfo",JOIN_WITHOUT_AUTH:"joinWithoutAuth",INIT_GROUP_ATTRIBUTES:"initGroupAttributes",SET_GROUP_ATTRIBUTES:"setGroupAttributes",DELETE_GROUP_ATTRIBUTES:"deleteGroupAttributes",GET_GROUP_ATTRIBUTES:"getGroupAttributes",GET_GROUP_MEMBER_LIST:"getGroupMemberList",GET_GROUP_MEMBER_PROFILE:"getGroupMemberProfile",ADD_GROUP_MEMBER:"addGroupMember",DELETE_GROUP_MEMBER:"deleteGroupMember",SET_GROUP_MEMBER_MUTE_TIME:"setGroupMemberMuteTime",SET_GROUP_MEMBER_NAME_CARD:"setGroupMemberNameCard",SET_GROUP_MEMBER_ROLE:"setGroupMemberRole",SET_GROUP_MEMBER_CUSTOM_FIELD:"setGroupMemberCustomField",GET_GROUP_ONLINE_MEMBER_COUNT:"getGroupOnlineMemberCount",SYNC_MESSAGE:"syncMessage",LONG_POLLING_AV_ERROR:"longPollingAVError",MESSAGE_LOSS:"messageLoss",MESSAGE_STACKED:"messageStacked",GET_USER_PROFILE:"getUserProfile",UPDATE_MY_PROFILE:"updateMyProfile",GET_BLACKLIST:"getBlacklist",ADD_TO_BLACKLIST:"addToBlacklist",REMOVE_FROM_BLACKLIST:"removeFromBlacklist",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUBSCRIBE_USER_STATUS:"ws_status_subscribe",UNSUBSCRIBE_USER_STATUS:"ws_status_unsubscribe",ADD_FRIEND:"addFriend",CHECK_FRIEND:"checkFriend",DELETE_FRIEND:"removeFromFriendList",GET_FRIEND_PROFILE:"getFriendProfile",GET_FRIEND_LIST:"getFriendList",UPDATE_FRIEND:"updateFriend",GET_FRIEND_APPLICATION_LIST:"getFriendApplicationList",DELETE_FRIEND_APPLICATION:"deleteFriendApplication",ACCEPT_FRIEND_APPLICATION:"acceptFriendApplication",REFUSE_FRIEND_APPLICATION:"refuseFriendApplication",SET_FRIEND_APPLICATION_READ:"setFriendApplicationRead",CREATE_FRIEND_GROUP:"createFriendGroup",DELETE_FRIEND_GROUP:"deleteFriendGroup",RENAME_FRIEND_GROUP:"renameFriendGroup",ADD_TO_FRIEND_GROUP:"addToFriendGroup",REMOVE_FROM_FRIEND_GROUP:"removeFromFriendGroup",GET_FRIEND_GROUP_LIST:"getFriendGroupList",CREATE_TOPIC:"createTopic",DELETE_TOPIC:"deleteTopic",UPDATE_TOPIC_PROFILE:"updateTopicProfile",GET_TOPIC_LIST:"getTopicList",RELAY_GET_TOPIC_LIST:"relayGetTopicList",GET_TOPIC_LAST_SEQUENCE:"getTopicLastSequence",MP_HIDE_TO_SHOW:"mpHideToShow",CALLBACK_FUNCTION_ERROR:"callbackFunctionError",FETCH_CLOUD_CONTROL_CONFIG:"fetchCloudControlConfig",PUSHED_CLOUD_CONTROL_CONFIG:"pushedCloudControlConfig",FETCH_COMMERCIAL_CONFIG:"fetchCommercialConfig",PUSHED_COMMERCIAL_CONFIG:"pushedCommercialConfig",ERROR:"error",LAST_MESSAGE_NOT_EXIST:"lastMessageNotExist"},Ka=function(){function e(t){o(this,e),this.type=C.MSG_TEXT,this.content={text:t.text||""}}return s(e,[{key:"setText",value:function(e){this.content.text=e}},{key:"sendable",value:function(){return 0!==this.content.text.length}}]),e}(),Ba=function(){function e(t){o(this,e),this._imageMemoryURL="",te?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=C.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||be.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._defaultImage="http://imgcache.qq.com/open/qcloud/video/act/webim-images/default.jpg",this._autoFixUrl()}return s(e,[{key:"_initImageInfoModel",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=pt(9999999),this.sizeType=t.type||0,this.type=0,this.size=t.size||0,this.width=t.width||0,this.height=t.height||0,this.imageUrl=t.url||"",this.url=t.url||e._imageMemoryURL||e._defaultImage},this._ImageInfoModel.prototype={setSizeType:function(e){this.sizeType=e},setType:function(e){this.type=e},setImageUrl:function(e){e&&(this.imageUrl=e)},getImageUrl:function(){return this.imageUrl}}}},{key:"initImageInfoArray",value:function(e){for(var t=0,n=null,o=null;t<=2;)o=et(e)||et(e[t])?{type:0,size:0,width:0,height:0,url:""}:e[t],(n=new this._ImageInfoModel(o)).setSizeType(t+1),n.setType(t),this.addImageInfo(n),t++;this.updateAccessSideImageInfoArray()}},{key:"updateImageInfoArray",value:function(e){for(var t,n=this.content.imageInfoArray.length,o=0;o1&&(this._percent=1)}},{key:"updateImageFormat",value:function(e){this.content.imageFormat=be[e.toUpperCase()]||be.UNKNOWN}},{key:"createImageDataASURLInWeb",value:function(e){void 0!==e&&e.files.length>0&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:"createImageDataASURLInWXMiniApp",value:function(e){e&&e.url&&(this._imageMemoryURL=e.url)}},{key:"replaceImageInfo",value:function(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}},{key:"addImageInfo",value:function(e){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(e)}},{key:"updateAccessSideImageInfoArray",value:function(){var e=this.content.imageInfoArray,t=e[0],n=t.width,o=void 0===n?0:n,a=t.height,s=void 0===a?0:a;0!==o&&0!==s&&(Pt(e),Object.assign(e[2],Gt({originWidth:o,originHeight:s,min:720})))}},{key:"sendable",value:function(){return 0!==this.content.imageInfoArray.length&&(""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size)}}]),e}(),xa=function(){function e(t){o(this,e),this.type=C.MSG_FACE,this.content=t||null}return s(e,[{key:"sendable",value:function(){return null!==this.content}}]),e}(),Wa=function(){function e(t){o(this,e),this.type=C.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:t.second,size:t.size,url:t.url,remoteAudioUrl:t.url||"",uuid:t.uuid}}return s(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateAudioUrl",value:function(e){this.content.remoteAudioUrl=e}},{key:"sendable",value:function(){return""!==this.content.remoteAudioUrl}}]),e}(),Ya={from:!0,groupID:!0,groupName:!0,to:!0},ja=function(){function e(t){o(this,e),this.type=C.MSG_GRP_TIP,this.content={},this._initContent(t)}return s(e,[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"remarkInfo":break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[n]);break;case"operatorInfo":break;case"memberInfoList":case"msgMemberInfo":t._updateMemberList(e[n]);break;case"onlineMemberInfo":break;case"memberNum":t.content[n]=e[n],t.content.memberCount=e[n];break;case"newGroupProfile":t.content.newGroupProfile={},t._initNewGroupProfile(e[n]);break;default:t.content[n]=e[n]}})),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n1&&(this._percent=1)}},{key:"updateFileUrl",value:function(e){this.content.fileUrl=e}},{key:"sendable",value:function(){return""!==this.content.fileUrl&&(""!==this.content.fileName&&0!==this.content.fileSize)}}]),e}(),Xa=function(){function e(t){o(this,e),this.type=C.MSG_CUSTOM,this.content={data:t.data||"",description:t.description||"",extension:t.extension||""}}return s(e,[{key:"setData",value:function(e){return this.content.data=e,this}},{key:"setDescription",value:function(e){return this.content.description=e,this}},{key:"setExtension",value:function(e){return this.content.extension=e,this}},{key:"sendable",value:function(){return 0!==this.content.data.length||0!==this.content.description.length||0!==this.content.extension.length}}]),e}(),Qa=function(){function e(t){o(this,e),this.type=C.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:t.remoteVideoUrl||t.videoUrl||"",videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:t.videoUrl,videoDownloadFlag:2,videoUUID:t.videoUUID,thumbUUID:t.thumbUUID,thumbFormat:t.thumbFormat,thumbWidth:t.thumbWidth,snapshotWidth:t.thumbWidth,thumbHeight:t.thumbHeight,snapshotHeight:t.thumbHeight,thumbSize:t.thumbSize,snapshotSize:t.thumbSize,thumbDownloadFlag:2,thumbUrl:t.thumbUrl,snapshotUrl:t.thumbUrl}}return s(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateVideoUrl",value:function(e){e&&(this.content.remoteVideoUrl=e)}},{key:"updateSnapshotInfo",value:function(e){var t=e.snapshotUrl,n=e.snapshotWidth,o=e.snapshotHeight;Bt(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),Bt(n)||(this.content.thumbWidth=this.content.snapshotWidth=Number(n)),Bt(o)||(this.content.thumbHeight=this.content.snapshotHeight=Number(o))}},{key:"sendable",value:function(){return""!==this.content.remoteVideoUrl}}]),e}(),Za=function(){function e(t){o(this,e),this.type=C.MSG_LOCATION;var n=t.description,a=t.longitude,s=t.latitude;this.content={description:n,longitude:a,latitude:s}}return s(e,[{key:"sendable",value:function(){return!0}}]),e}(),es=function(){function e(t){if(o(this,e),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||"",this.clientTime=t.clientTime||void 0,t.ID)this.ID=t.ID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType.startsWith(C.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(C.CONV_GROUP)&&(this.receiverGroupID=t.to),this.messageReceiver=t.to;else{this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[];var n=t.elements[0].type,a=t.elements[0].content;this._patchRichMediaPayload(n,a),n===C.MSG_MERGER?this.messageBody.push({type:n,payload:new ts(a).content}):this.messageBody.push({type:n,payload:a}),t.groupID&&(this.receiverGroupID=t.groupID,this.messageReceiver=t.groupID),t.to&&(this.receiverUserID=t.to,this.messageReceiver=t.to),this.ID="".concat(t.tinyID,"-").concat(t.clientTime,"-").concat(t.random)}}return s(e,[{key:"_patchRichMediaPayload",value:function(e,t){e===C.MSG_IMAGE?t.imageInfoArray.forEach((function(e){!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,1===e.type?e.type=0:3===e.type&&(e.type=1))})):e===C.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===C.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===C.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}}]),e}(),ts=function(){function e(t){if(o(this,e),this.type=C.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},t.downloadKey){var n=t.downloadKey,a=t.pbDownloadKey,s=t.title,r=t.abstractList,i=t.compatibleText,c=t.version;this.content.downloadKey=n,this.content.pbDownloadKey=a,this.content.title=s,this.content.abstractList=r,this.content.compatibleText=i,this.content.version=c||0}else if(Bt(t.messageList))1===t.layersOverLimit&&(this.content.layersOverLimit=!0);else{var u=t.messageList,l=t.title,d=t.abstractList,p=t.compatibleText,_=t.version,g=[];u.forEach((function(e){if(!Bt(e)){var t=new es(e);g.push(t)}})),this.content.messageList=g,this.content.title=l,this.content.abstractList=d,this.content.compatibleText=p,this.content.version=_||0}we.debug("MergerElement.content:",this.content)}return s(e,[{key:"sendable",value:function(){return!Bt(this.content.messageList)||!Bt(this.content.downloadKey)}}]),e}(),ns={1:C.MSG_PRIORITY_HIGH,2:C.MSG_PRIORITY_NORMAL,3:C.MSG_PRIORITY_LOW,4:C.MSG_PRIORITY_LOWEST},os=function(){function e(t){o(this,e),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||C.CONV_C2C,this.conversationSubType=t.conversationSubType,this.time=t.time||Math.ceil(Date.now()/1e3),this.sequence=t.sequence||0,this.clientSequence=t.clientSequence||t.sequence||0,this.random=t.random||0===t.random?t.random:pt(),this.priority=this._computePriority(t.priority),this.nick=t.nick||"",this.avatar=t.avatar||"",this.isPeerRead=1===t.isPeerRead||!1,this.nameCard="",this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=2===t.isPlaceMessage||8===t.msgFlagBits,this.from=t.from||null,this.to=t.to||null,this.flow="",this.isSystemMessage=t.isSystemMessage||!1,this.protocol=t.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=t.status||jt.SUCCESS,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=t.cloudCustomData||"",this.isDeleted=!1,this.isModified=!1,this._isExcludedFromUnreadCount=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromLastMessage),this.clientTime=t.clientTime||ke()||0,this.senderTinyID=t.senderTinyID||t.tinyID||"",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0},this.needReadReceipt=!0===t.needReadReceipt||1===t.needReadReceipt,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t)}return s(e,[{key:"elements",get:function(){return we.warn("!!!Message 实例的 elements 属性即将废弃,请尽快修改。使用 type 和 payload 属性处理单条消息,兼容组合消息使用 _elements 属性!!!"),this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){if(null!==e){Je(e.nick)&&(this.nick=e.nick),Je(e.avatar)&&(this.avatar=e.avatar);var t=e.messageFromAccountExtraInformation;Qe(t)&&Je(t.nameCard)&&(this.nameCard=t.nameCard)}}},{key:"handleGroupAtInfo",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach((function(e){e!==C.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(C.MSG_AT_ALL))})),Ze(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(C.MSG_AT_ALL)}))}},{key:"getGroupAtInfoList",value:function(){return this._groupAtInfoList}},{key:"_initProxy",value:function(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}},{key:"reInitialize",value:function(e){e&&(this.status=this.from?jt.SUCCESS:jt.UNSEND,!this.from&&(this.from=e)),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}},{key:"isSendable",value:function(){return 0!==this._elements.length&&("function"!=typeof this._elements[0].sendable?(we.warn("".concat(this._elements[0].type,' need "boolean : sendable()" method')),!1):this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===C.CONV_GROUP&&(this.to=e.groupID)}},{key:"_initSequence",value:function(e){0===this.clientSequence&&e&&(this.clientSequence=function(e){if(!e)return we.error("autoIncrementIndex(string: key) need key parameter"),!1;if(void 0===ft[e]){var t=new Date,n="3".concat(t.getHours()).slice(-2),o="0".concat(t.getMinutes()).slice(-2),a="0".concat(t.getSeconds()).slice(-2);ft[e]=parseInt([n,o,a,"0001"].join("")),n=null,o=null,a=null,we.log("autoIncrementIndex start index:".concat(ft[e]))}return ft[e]++}(e)),0===this.sequence&&this.conversationType===C.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===C.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID="".concat(this.senderTinyID,"-").concat(this.clientTime,"-").concat(this.random)}},{key:"_initFlow",value:function(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}},{key:"_concatConversationID",value:function(e){var t=this.to,n="",o=this.conversationType;o!==C.CONV_SYSTEM?(n=o===C.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID="".concat(o).concat(n)):this.conversationID=C.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof Ka||e instanceof Ba||e instanceof xa||e instanceof Wa||e instanceof Ja||e instanceof Qa||e instanceof ja||e instanceof za||e instanceof Xa||e instanceof Za||e instanceof ts}},{key:"setElement",value:function(e){var t=this;if(this.isElement(e))return this._elements=[e],void this._initProxy();var n=function(e){if(e.type&&e.content)switch(e.type){case C.MSG_TEXT:t.setTextElement(e.content);break;case C.MSG_IMAGE:t.setImageElement(e.content);break;case C.MSG_AUDIO:t.setAudioElement(e.content);break;case C.MSG_FILE:t.setFileElement(e.content);break;case C.MSG_VIDEO:t.setVideoElement(e.content);break;case C.MSG_CUSTOM:t.setCustomElement(e.content);break;case C.MSG_LOCATION:t.setLocationElement(e.content);break;case C.MSG_GRP_TIP:t.setGroupTipElement(e.content);break;case C.MSG_GRP_SYS_NOTICE:t.setGroupSystemNoticeElement(e.content);break;case C.MSG_FACE:t.setFaceElement(e.content);break;case C.MSG_MERGER:t.setMergerElement(e.content);break;default:we.warn(e.type,e.content,"no operation......")}};if(Ze(e))for(var o=0;o1&&void 0!==arguments[1]&&arguments[1];if(e instanceof ls)return t&&null!==ds&&ds.emit(D.ERROR,e),Promise.reject(e);if(e instanceof Error){var n=new ls({code:Sa.UNCAUGHT_ERROR,message:e.message});return t&&null!==ds&&ds.emit(D.ERROR,n),Promise.reject(n)}if(et(e)||et(e.code)||et(e.message))we.error("IMPromise.reject 必须指定code(错误码)和message(错误信息)!!!");else{if(ze(e.code)&&Je(e.message)){var o=new ls(e);return t&&null!==ds&&ds.emit(D.ERROR,o),Promise.reject(o)}we.error("IMPromise.reject code(错误码)必须为数字,message(错误信息)必须为字符串!!!")}},hs=function(e){i(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._className="C2CModule",t._messageFromUnreadDBMap=new Map,t}return s(a,[{key:"onNewC2CMessage",value:function(e){var t=e.dataList,n=e.isInstantMessage,o=e.C2CRemainingUnreadList,a=e.C2CPairUnreadList;we.debug("".concat(this._className,".onNewC2CMessage count:").concat(t.length," isInstantMessage:").concat(n));var s=this._newC2CMessageStoredAndSummary({dataList:t,C2CRemainingUnreadList:o,C2CPairUnreadList:a,isInstantMessage:n}),r=s.conversationOptionsList,i=s.messageList,c=s.isUnreadC2CMessage;(this.filterModifiedMessage(i),r.length>0)&&this.getModule(pn).onNewMessage({conversationOptionsList:r,isInstantMessage:n,isUnreadC2CMessage:c});var u=this.filterUnmodifiedMessage(i);n&&u.length>0&&this.emitOuterEvent(D.MESSAGE_RECEIVED,u),i.length=0}},{key:"_newC2CMessageStoredAndSummary",value:function(e){for(var t=e.dataList,n=e.C2CRemainingUnreadList,o=e.C2CPairUnreadList,a=e.isInstantMessage,s=null,r=[],i=[],c={},u=this.getModule(mn),l=this.getModule(Nn),d=!1,p=this.getModule(pn),_=0,g=t.length;_0&&l.addMessageDelay(s.clientTime)}else this._messageFromUnreadDBMap.set(s.ID,1);if(0!==h.msgLifeTime){if(!1===s._onlineOnlyFlag){var D=p.getLastMessageTime(f);if(ze(D)&&s.time0){L=!0;var n=r.find((function(t){return t.conversationID==="C2C".concat(o[e].from)}));n?n.unreadCount=o[e].unreadCount:r.push({conversationID:"C2C".concat(o[e].from),unreadCount:o[e].unreadCount,type:C.CONV_C2C})}},O=0,k=o.length;O0&&(o=e.cloudCustomData);var a=[];if(Qe(t)&&Qe(t.messageControlInfo)){var s=t.messageControlInfo,r=s.excludedFromUnreadCount,i=s.excludedFromLastMessage;!0===r&&a.push("NoUnread"),!0===i&&a.push("NoLastMsg")}return{protocolName:wn,tjgID:this.generateTjgID(e),requestData:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:e.getElements(),cloudCustomData:o,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:this.isOnlineMessage(e,t)?0:void 0,nick:e.nick,avatar:e.avatar,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:a,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0}}}},{key:"isOnlineMessage",value:function(e,t){return!(!t||!0!==t.onlineUserOnly)}},{key:"revokeMessage",value:function(e){return this.request({protocolName:oo,requestData:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}},{key:"deleteMessage",value:function(e){var t=e.to,n=e.keyList;return we.log("".concat(this._className,".deleteMessage toAccount:").concat(t," count:").concat(n.length)),this.request({protocolName:uo,requestData:{fromAccount:this.getMyUserID(),to:t,keyList:n}})}},{key:"modifyRemoteMessage",value:function(e){var t=e.from,n=e.to,o=e.version,a=void 0===o?0:o,s=e.sequence,r=e.random,i=e.time,c=e.payload,u=e.type,l=e.cloudCustomData,d=void 0;return Ht(u)&&(d=[]).push({type:u,content:c}),this.request({protocolName:lo,requestData:{from:t,to:n,version:a,sequence:s,random:r,time:i,elements:d,cloudCustomData:l}})}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,o=e.lastMessageTime,a="".concat(this._className,".setMessageRead");we.log("".concat(a," conversationID:").concat(n," lastMessageTime:").concat(o)),ze(o)||we.warn("".concat(a," 请勿修改 Conversation.lastMessage.lastTime,否则可能会导致已读上报结果不准确"));var s=new Va(Ha.SET_C2C_MESSAGE_READ);return s.setMessage("conversationID:".concat(n," lastMessageTime:").concat(o)),this.request({protocolName:ao,requestData:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:n.replace("C2C",""),lastMessageTime:o,receipt:1}]}}}).then((function(){s.setNetworkType(t.getNetworkType()).end(),we.log("".concat(a," ok"));var e=t.getModule(pn);return e.updateIsReadAfterReadReport({conversationID:n,lastMessageTime:o}),e.updateUnreadCount(n),as()})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.log("".concat(a," failed. error:"),e),gs(e)}))}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._className,".getRoamingMessage"),o=e.peerAccount,a=e.conversationID,s=e.count,r=e.lastMessageTime,i=e.messageKey,c="peerAccount:".concat(o," count:").concat(s||15," lastMessageTime:").concat(r||0," messageKey:").concat(i);we.log("".concat(n," ").concat(c));var u=new Va(Ha.GET_C2C_ROAMING_MESSAGES);return this.request({protocolName:io,requestData:{peerAccount:o,count:s||15,lastMessageTime:r||0,messageKey:i}}).then((function(e){var o=e.data,s=o.complete,r=o.messageList,i=o.messageKey,l=o.lastMessageTime;et(r)?we.log("".concat(n," ok. complete:").concat(s," but messageList is undefined!")):we.log("".concat(n," ok. complete:").concat(s," count:").concat(r.length)),u.setNetworkType(t.getNetworkType()).setMessage("".concat(c," complete:").concat(s," length:").concat(r.length)).end();var d=t.getModule(pn);1===s&&d.setCompleted(a);var p=d.onRoamingMessage(r,a);d.modifyMessageList(a),d.updateIsRead(a),d.updateRoamingMessageKeyAndTime(a,i,l);var _=d.getPeerReadTime(a);if(we.log("".concat(n," update isPeerRead property. conversationID:").concat(a," peerReadTime:").concat(_)),_)d.updateMessageIsPeerReadProperty(a,_);else{var g=a.replace(C.CONV_C2C,"");t.getRemotePeerReadTime([g]).then((function(){d.updateMessageIsPeerReadProperty(a,d.getPeerReadTime(a))}))}var h="";if(p.length>0)h=p[0].ID;else{var f=d.getLocalOldestMessage(a);f&&(h=f.ID)}return we.log("".concat(n," nextReqID:").concat(h," stored message count:").concat(p.length)),{nextReqID:h,storedMessageList:p}})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];u.setMessage(c).setError(e,o,a).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._className,".getRoamingMessagesHopping"),o=e.peerAccount,a=e.time,s=void 0===a?0:a,r=e.count,i=e.direction,c="".concat(C.CONV_C2C).concat(o),u="peerAccount:".concat(o," count:").concat(r," time:").concat(s," direction:").concat(i);we.log("".concat(n," ").concat(u));var l=new Va(Ha.GET_C2C_ROAMING_MESSAGES_HOPPING);return this.request({protocolName:io,requestData:{peerAccount:o,count:r+1,lastMessageTime:s,direction:i}}).then((function(e){var o=e.data,a=o.complete,s=o.messageList,r=void 0===s?[]:s,d=o.lastMessageTime;we.log("".concat(n," ok. complete:").concat(a," count:").concat(r.length)),l.setNetworkType(t.getNetworkType()).setMessage("".concat(u," complete:").concat(a," length:").concat(r.length)).end(),1!==a&&(1===i?r.pop():r.shift());var p=t.getModule(pn).onRoamingMessage(r,c,!1);t._modifyMessageList(c,p);var _=t._computeResult({complete:a,lastMessageTime:d,resultList:p});return as(_)})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];l.setMessage(u).setError(e,o,a).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"_computeResult",value:function(e){var t=e.complete,n=void 0===t?0:t,o=e.lastMessageTime,a=e.resultList,s={messageList:M(void 0===a?[]:a),isCompleted:!1,nextMessageTime:""};return 1===n?(s.isCompleted=!0,s):(s.nextMessageTime=o,s)}},{key:"_modifyMessageList",value:function(e,t){var n=this.getModule(pn).getLocalConversation(e);if(n)for(var o=n.userProfile.nick,a=n.userProfile.avatar,s=this.getModule(sn).getNickAndAvatarByUserID(this.getMyUserID()),r=s.nick,i=s.avatar,c=t.length-1;c>=0;c--){var u=t[c];"in"===u.flow&&(u.nick!==o&&u.setNickAndAvatar({nick:o}),u.avatar!==a&&u.setNickAndAvatar({avatar:a})),"out"===u.flow&&(u.nick!==r&&u.setNickAndAvatar({nick:r}),u.avatar!==i&&u.setNickAndAvatar({avatar:i}))}}},{key:"getRemotePeerReadTime",value:function(e){var t=this,n="".concat(this._className,".getRemotePeerReadTime");if(Bt(e))return we.warn("".concat(n," userIDList is empty!")),Promise.resolve();var o=new Va(Ha.GET_PEER_READ_TIME);return we.log("".concat(n," userIDList:").concat(e)),this.request({protocolName:co,requestData:{userIDList:e}}).then((function(a){var s=a.data.peerReadTimeList;we.log("".concat(n," ok. peerReadTimeList:").concat(s));for(var r="",i=t.getModule(pn),c=0;c0&&i.recordPeerReadTime("C2C".concat(e[c]),s[c]);o.setNetworkType(t.getNetworkType()).setMessage(r).end()})).catch((function(e){t.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),we.warn("".concat(n," failed. error:"),e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,n=e[0].conversationID.replace(C.CONV_C2C,""),o=new Va(Ha.SEND_C2C_READ_RECEIPT);o.setMessage("peerAccount:".concat(n));var a=this.getMyUserID(),s=e.filter((function(e){return e.from!==a&&!0===e.needReadReceipt})).map((function(e){return{fromAccount:e.from,toAccount:e.to,sequence:e.sequence,random:e.random,time:e.time,clientTime:e.clientTime}}));if(0===s.length)return gs({code:Sa.READ_RECEIPT_MESSAGE_LIST_EMPTY,message:Da.READ_RECEIPT_MESSAGE_LIST_EMPTY});var r="".concat(this._className,".sendReadReceipt");return we.log("".concat(r,". peerAccount:").concat(n," messageInfoList length:").concat(s.length)),this.request({protocolName:Uo,requestData:{peerAccount:n,messageInfoList:s}}).then((function(e){return o.end(),we.log("".concat(r," ok")),as()})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),we.warn("".concat(r," failed. error:"),e),gs(e)}))}},{key:"getReadReceiptList",value:function(e){var t="".concat(this._className,".getReadReceiptList"),n=this.getMyUserID(),o=e.filter((function(e){return e.from===n&&!0===e.needReadReceipt}));return we.log("".concat(t," userID:").concat(n," messageList length:").concat(o.length)),_s({messageList:o})}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._messageFromUnreadDBMap.clear()}}]),a}(Ln),fs=function(){function e(){o(this,e),this.list=new Map,this._className="MessageListHandler",this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map,this._groupLocalLastMessageSequenceMap=new Map}return s(e,[{key:"getLocalOldestMessageByConversationID",value:function(e){if(!e)return null;if(!this.list.has(e))return null;var t=this.list.get(e).values();return t?t.next().value:null}},{key:"pushIn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.conversationID,o=!0;this.list.has(n)||this.list.set(n,new Map);var a=this._getUniqueIDOfMessage(e),s=this.list.get(n).has(a);if(s){var r=this.list.get(n).get(a);if(!t||!0===r.isModified)return o=!1}return this.list.get(n).set(a,e),this._setLatestMessageSentByPeer(n,e),this._setLatestMessageSentByMe(n,e),this._setGroupLocalLastMessageSequence(n,e),o}},{key:"unshift",value:function(e,t){var n;if(Ze(e)){if(e.length>0){n=e[0].conversationID;var o=e.length;this._unshiftMultipleMessages(e,t),this._setGroupLocalLastMessageSequence(n,e[o-1])}}else n=e.conversationID,this._unshiftSingleMessage(e,t),this._setGroupLocalLastMessageSequence(n,e);if(n&&n.startsWith(C.CONV_C2C)){var a=Array.from(this.list.get(n).values()),s=a.length;if(0===s)return;for(var r=s-1;r>=0;r--)if("out"===a[r].flow){this._setLatestMessageSentByMe(n,a[r]);break}for(var i=s-1;i>=0;i--)if("in"===a[i].flow){this._setLatestMessageSentByPeer(n,a[i]);break}}}},{key:"_unshiftSingleMessage",value:function(e,t){var n=e.conversationID,o=this._getUniqueIDOfMessage(e);if(!this.list.has(n))return this.list.set(n,new Map),this.list.get(n).set(o,e),void t.push(e);var a=this.list.get(n),s=Array.from(a);a.has(o)||(s.unshift([o,e]),this.list.set(n,new Map(s)),t.push(e))}},{key:"_unshiftMultipleMessages",value:function(e,t){for(var n=e.length,o=[],a=e[0].conversationID,s=this.list.get(a),r=this.list.has(a)?Array.from(s):[],i=0;i=0;l--)"in"===s[l].flow&&((i=s[l]).nick!==n&&(i.setNickAndAvatar({nick:n}),u=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),u=!0),u&&(c+=1));we.log("".concat(this._className,".modifyMessageSentByPeer conversationID:").concat(t," count:").concat(c))}}}},{key:"modifyMessageSentByMe",value:function(e){var t=e.conversationID,n=e.latestNick,o=e.latestAvatar,a=this.list.get(t);if(!Bt(a)){var s=Array.from(a.values()),r=s.length;if(0!==r){for(var i=null,c=0,u=!1,l=r-1;l>=0;l--)"out"===s[l].flow&&((i=s[l]).nick!==n&&(i.setNickAndAvatar({nick:n}),u=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),u=!0),u&&(c+=1));we.log("".concat(this._className,".modifyMessageSentByMe conversationID:").concat(t," count:").concat(c))}}}},{key:"getTopicConversationIDList",value:function(e){return M(this.list.keys()).filter((function(t){return t.startsWith("".concat(C.CONV_GROUP).concat(e))}))}},{key:"traversal",value:function(){if(0!==this.list.size&&-1===we.getLevel()){console.group("conversationID-messageCount");var e,t=S(this.list);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2),o=n[0],a=n[1];console.log("".concat(o,"-").concat(a.size))}}catch(s){t.e(s)}finally{t.f()}console.groupEnd()}}},{key:"onMessageModified",value:function(e,t){if(!this.list.has(e))return{isUpdated:!1,message:null};var n=this._getUniqueIDOfMessage(t),o=this.list.get(e).has(n);if(we.debug("".concat(this._className,".onMessageModified conversationID:").concat(e," uniqueID:").concat(n," has:").concat(o)),o){var a=this.list.get(e).get(n),s=t.messageVersion,r=t.elements,i=t.cloudCustomData;return a.version1&&void 0!==arguments[1]&&arguments[1];if(e)return this._isReady?void(t?e.call(this):setTimeout(e,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(e))},t.triggerReady=function(){var e=this;this._isReady=!0,setTimeout((function(){var t=e._readyQueue;e._readyQueue=[],t&&t.length>0&&t.forEach((function(e){e.call(this)}),e)}),1)},t.resetReady=function(){this._isReady=!1,this._readyQueue=[]},t.isReady=function(){return this._isReady}};var ys=["jpg","jpeg","gif","png","bmp","image","webp"],Es=["mp4"],Ts=1,Ss=2,Ds=3,Cs=255,Ns=function(){function e(t){var n=this;o(this,e),Bt(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.gender=t.gender||"",this.birthday=t.birthday||0,this.location=t.location||"",this.selfSignature=t.selfSignature||"",this.allowType=t.allowType||C.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||C.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],Bt(t.profileCustomField)||t.profileCustomField.forEach((function(e){n.profileCustomField.push({key:e.key,value:e.value})})))}return s(e,[{key:"validate",value:function(e){var t=!0,n="";if(Bt(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,a=null,s=0;s500&&(n="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(dt(e[r])," bytes"),t=!1);break;case"gender":ht(Ve,e.gender)||(n="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":ze(e.birthday)||(n="birthday should be a number",t=!1);break;case"location":Je(e.location)||(n="location should be a string",t=!1);break;case"selfSignature":Je(e.selfSignature)||(n="selfSignature should be a string",t=!1);break;case"allowType":ht(Ke,e.allowType)||(n="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":ze(e.language)||(n="language should be a number",t=!1);break;case"avatar":Je(e.avatar)||(n="avatar should be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n="messageSettings should be 0 or 1",t=!1);break;case"adminForbidType":ht(He,e.adminForbidType)||(n="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":ze(e.level)||(n="level should be a number",t=!1);break;case"role":ze(e.role)||(n="role should be a number",t=!1);break;default:n="unknown key:"+r+" "+e[r],t=!1}}return{valid:t,tips:n}}}]),e}(),As=s((function e(t){o(this,e),this.value=t,this.next=null})),Ls=function(){function e(t){o(this,e),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map,we.debug("SinglyLinkedList init MAX_LENGTH:".concat(this.MAX_LENGTH))}return s(e,[{key:"set",value:function(e){var t=new As(e);if(this.map.size0&&n.members.forEach((function(e){e.userID===t.selfInfo.userID&&ut(t.selfInfo,e,["sequence"])}))}},{key:"updateSelfInfo",value:function(e){var n={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList};ut(this.selfInfo,t({},n),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}}]),e}(),ks=function(e){return et(e)?{lastTime:0,lastSequence:0,fromAccount:0,messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1}:e instanceof os?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:Vt(e.type,e.payload),payload:e.payload||null,type:e.type||null,isRevoked:e.isRevoked||!1,cloudCustomData:e.cloudCustomData||"",onlineOnlyFlag:e._onlineOnlyFlag||!1,nick:e.nick||"",nameCard:e.nameCard||"",version:e.version||0,isPeerRead:e.isPeerRead||!1}:t(t({},e),{},{messageForShow:Vt(e.type,e.payload)})},Gs=function(){function e(t){o(this,e),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=ks(t.lastMessage),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark="",this.isPinned=t.isPinned||!1,this.messageRemindType="",this._initProfile(t)}return s(e,[{key:"toAccount",get:function(){return this.conversationID.startsWith(C.CONV_C2C)?this.conversationID.replace(C.CONV_C2C,""):this.conversationID.startsWith(C.CONV_GROUP)?this.conversationID.replace(C.CONV_GROUP,""):""}},{key:"subType",get:function(){return this.groupProfile?this.groupProfile.type:""}},{key:"_initProfile",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"userProfile":t.userProfile=e.userProfile;break;case"groupProfile":t.groupProfile=e.groupProfile}})),et(this.userProfile)&&this.type===C.CONV_C2C?this.userProfile=new Ns({userID:e.conversationID.replace("C2C","")}):et(this.groupProfile)&&this.type===C.CONV_GROUP&&(this.groupProfile=new Os({groupID:e.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(e){var t=e.nextUnreadCount,n=e.isFromGetConversations,o=e.isUnreadC2CMessage;et(t)||(Et(this.subType)?this.unreadCount=0:n&&this.type===C.CONV_GROUP||n&&this.type===C.CONV_TOPIC||o&&this.type===C.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:"updateLastMessage",value:function(e){this.lastMessage=ks(e)}},{key:"updateGroupAtInfoList",value:function(e){if(!this._isNeedMergeGroupAtInfo(e)){var t,n=(v(t=e.groupAtType)||I(t)||y(t)||T()).slice(0);-1!==n.indexOf(C.CONV_AT_ME)&&-1!==n.indexOf(C.CONV_AT_ALL)&&(n=[C.CONV_AT_ALL_AT_ME]);var o={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:n,__random:e.__random,__sequence:e.__sequence};this.groupAtInfoList.push(o),we.debug("Conversation.updateGroupAtInfoList conversationID:".concat(this.conversationID),this.groupAtInfoList)}}},{key:"_isNeedMergeGroupAtInfo",value:function(e){var t=e.groupID,n=e.sequence;if(!Tt({groupID:t}))return!1;var o=!1;return this.groupAtInfoList.forEach((function(t){t.messageSequence===n&&(t.atTypeArray.indexOf(C.CONV_AT_ME)>-1&&e.groupAtType.indexOf(C.CONV_AT_ALL)>-1&&(t.atTypeArray=[C.CONV_AT_ALL_AT_ME]),t.atTypeArray.indexOf(C.CONV_AT_ALL)>-1&&e.groupAtType.indexOf(C.CONV_AT_ME)>-1&&(t.atTypeArray=[C.CONV_AT_ALL_AT_ME],t.__random=e.__random,t.__sequence=e.__sequence),o=!0)})),o}},{key:"clearGroupAtInfoList",value:function(){this.groupAtInfoList.length=0}},{key:"reduceUnreadCount",value:function(){this.unreadCount>=1&&(this.unreadCount-=1)}},{key:"isLastMessageRevoked",value:function(e){var t=e.sequence,n=e.time;return this.type===C.CONV_C2C&&t===this.lastMessage.lastSequence&&n===this.lastMessage.lastTime||this.type===C.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}}]),e}(),Ps=function(){function e(t){o(this,e),this._conversationModule=t,this._className="MessageRemindHandler",this._updateSequence=0}return s(e,[{key:"getC2CMessageRemindType",value:function(){var e=this,t="".concat(this._className,".getC2CMessageRemindType");return this._conversationModule.request({protocolName:ro,updateSequence:this._updateSequence}).then((function(n){we.log("".concat(t," ok"));var o=n.data,a=o.updateSequence,s=o.muteFlagList;e._updateSequence=a,e._patchC2CMessageRemindType(s)})).catch((function(e){we.error("".concat(t," failed. error:"),e)}))}},{key:"_patchC2CMessageRemindType",value:function(e){var t=this,n=0,o="";Ze(e)&&e.length>0&&e.forEach((function(e){var a=e.userID,s=e.muteFlag;0===s?o=C.MSG_REMIND_ACPT_AND_NOTE:1===s?o=C.MSG_REMIND_DISCARD:2===s&&(o=C.MSG_REMIND_ACPT_NOT_NOTE),!0===t._conversationModule.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:o})&&(n+=1)})),we.log("".concat(this._className,"._patchC2CMessageRemindType count:").concat(n))}},{key:"set",value:function(e){return e.groupID?this._setGroupMessageRemindType(e):Ze(e.userIDList)?this._setC2CMessageRemindType(e):void 0}},{key:"_setGroupMessageRemindType",value:function(e){var t=this,n="".concat(this._className,"._setGroupMessageRemindType"),o=e.groupID,a=e.messageRemindType,s="groupID:".concat(o," messageRemindType:").concat(a),r=new Va(Ha.SET_MESSAGE_REMIND_TYPE);return r.setMessage(s),this._getModule(ln).modifyGroupMemberInfo({groupID:o,messageRemindType:a,userID:this._conversationModule.getMyUserID()}).then((function(){r.setNetworkType(t._conversationModule.getNetworkType()).end(),we.log("".concat(n," ok. ").concat(s));var o=t.onGroupMessageRemindTypeUpdated(e);return as(o)})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"onGroupMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.messageRemindType,o=this._getModule(cn).getLocalGroupProfile(t);if(o&&(o.selfInfo.messageRemindType=n),St(t)){var a=t,s=qt(a),r=this._getModule(dn).getLocalTopic(s,a);return r&&(r.updateSelfInfo({messageRemindType:n}),this._conversationModule.emitOuterEvent(D.TOPIC_UPDATED,{groupID:s,topic:r})),{topic:r}}return this._conversationModule.patchMessageRemindType({ID:t,isC2CConversation:!1,messageRemindType:n})&&this._emitConversationUpdate(),{group:o}}},{key:"_setC2CMessageRemindType",value:function(e){var t=this,n="".concat(this._className,"._setC2CMessageRemindType"),o=e.userIDList,a=e.messageRemindType,s=o.slice(0,30),r=0;a===C.MSG_REMIND_DISCARD?r=1:a===C.MSG_REMIND_ACPT_NOT_NOTE&&(r=2);var i="userIDList:".concat(s," messageRemindType:").concat(a),c=new Va(Ha.SET_MESSAGE_REMIND_TYPE);return c.setMessage(i),this._conversationModule.request({protocolName:so,requestData:{userIDList:s,muteFlag:r}}).then((function(e){c.setNetworkType(t._conversationModule.getNetworkType()).end();var o=e.data,r=o.updateSequence,i=o.errorList;t._updateSequence=r;var u=[],l=[];Ze(i)&&i.forEach((function(e){u.push(e.userID),l.push({userID:e.userID,code:e.errorCode})}));var d=s.filter((function(e){return-1===u.indexOf(e)}));we.log("".concat(n," ok. successUserIDList:").concat(d," failureUserIDList:").concat(JSON.stringify(l)));var p=0;return d.forEach((function(e){t._conversationModule.patchMessageRemindType({ID:e,isC2CConversation:!0,messageRemindType:a})&&(p+=1)})),p>=1&&t._emitConversationUpdate(),s.length=u.length=0,_s({successUserIDList:d.map((function(e){return{userID:e}})),failureUserIDList:l})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];c.setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"_getModule",value:function(e){return this._conversationModule.getModule(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"setUpdateSequence",value:function(e){this._updateSequence=e}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._updateSequence=0}}]),e}(),Us=function(e){i(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._className="ConversationModule",Is.mixin(g(t)),t._messageListHandler=new fs,t._messageRemindHandler=new Ps(g(t)),t.singlyLinkedList=new Ls(100),t._pagingStatus=$t.NOT_START,t._pagingTimeStamp=0,t._pagingStartIndex=0,t._pagingPinnedTimeStamp=0,t._pagingPinnedStartIndex=0,t._conversationMap=new Map,t._tmpGroupList=[],t._tmpGroupAtTipsList=[],t._peerReadTimeMap=new Map,t._completedMap=new Map,t._roamingMessageKeyAndTimeMap=new Map,t._roamingMessageSequenceMap=new Map,t._remoteGroupReadSequenceMap=new Map,t._initListeners(),t}return s(a,[{key:"_initListeners",value:function(){var e=this.getInnerEmitterInstance();e.on(ms,this._initLocalConversationList,this),e.on(vs,this._onProfileUpdated,this)}},{key:"onCheckTimer",value:function(e){e%60==0&&this._messageListHandler.traversal()}},{key:"_initLocalConversationList",value:function(){var e=this,t=new Va(Ha.GET_CONVERSATION_LIST_IN_STORAGE);we.log("".concat(this._className,"._initLocalConversationList."));var n="",o=this._getStorageConversationList();if(o){for(var a=o.length,s=0;s0&&(e.updateConversationGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)})),this.syncConversationList()}},{key:"onMessageSent",value:function(e){this._onSendOrReceiveMessage({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:"onNewMessage",value:function(e){this._onSendOrReceiveMessage(e)}},{key:"_onSendOrReceiveMessage",value:function(e){var t=this,n=e.conversationOptionsList,o=e.isInstantMessage,a=void 0===o||o,s=e.isUnreadC2CMessage,r=void 0!==s&&s;this._isReady?0!==n.length&&(this._getC2CPeerReadTime(n),this._updateLocalConversationList({conversationOptionsList:n,isInstantMessage:a,isUnreadC2CMessage:r,isFromGetConversations:!1}),this._setStorageConversationList(),n.filter((function(e){return e.type===C.CONV_TOPIC})).length>0||this.emitConversationUpdate()):this.ready((function(){t._onSendOrReceiveMessage(e)}))}},{key:"updateConversationGroupProfile",value:function(e){var t=this;if(!Ze(e)||0!==e.length)if(0!==this._conversationMap.size){var n=!1;e.forEach((function(e){var o="GROUP".concat(e.groupID);if(t._conversationMap.has(o)){n=!0;var a=t._conversationMap.get(o);a.groupProfile=JSON.parse(JSON.stringify(e)),a.lastMessage.lastSequence=0;r--)if(!a[r].isDeleted){s=a[r];break}var i=this._conversationMap.get(o);if(i){var c=!1;i.lastMessage.lastSequence===s.sequence&&i.lastMessage.lastTime===s.time||(Bt(s)&&(s=void 0),i.updateLastMessage(s),i.type!==C.CONV_TOPIC&&(c=!0),we.log("".concat(this._className,".onMessageDeleted. update conversationID:").concat(o," with lastMessage:"),i.lastMessage)),o.startsWith(C.CONV_C2C)&&this.updateUnreadCount(o),c&&this.emitConversationUpdate(!0,!1)}}}},{key:"onMessageModified",value:function(e){var t=e.conversationType,n=e.from,o=e.to,a=e.time,s=e.sequence,r=e.elements,i=e.cloudCustomData,c=e.messageVersion,u=this.getMyUserID(),l="".concat(t).concat(o);o===u&&t===C.CONV_C2C&&(l="".concat(t).concat(n));var d=this._messageListHandler.onMessageModified(l,e),p=d.isUpdated,_=d.message;!0===p&&this.emitOuterEvent(D.MESSAGE_MODIFIED,[_]);var g=this._isTopicConversation(l);if(we.log("".concat(this._className,".onMessageModified isUpdated:").concat(p," isTopicMessage:").concat(g," from:").concat(n," to:").concat(o)),g){this.getModule(dn).onMessageModified(e)}else{var h=this._conversationMap.get(l);if(h){var f=h.lastMessage;we.debug("".concat(this._className.onMessageModified," lastMessage:"),JSON.stringify(f),"options:",JSON.stringify(e)),f&&f.lastTime===a&&f.lastSequence===s&&f.version!==c&&(f.type=r[0].type,f.payload=r[0].content,f.messageForShow=Vt(f.type,f.payload),f.cloudCustomData=i,f.version=c,this.emitConversationUpdate(!0,!1))}}return _}},{key:"onNewGroupAtTips",value:function(e){var n=this,o=e.dataList,a=null;o.forEach((function(e){e.groupAtTips?a=e.groupAtTips:e.elements?a=t(t({},e.elements),{},{sync:!0}):e.groupAtType&&(a=t(t({},e),{},{sync:!0})),a.__random=e.random,a.__sequence=e.clientSequence,n._tmpGroupAtTipsList.push(a)})),we.debug("".concat(this._className,".onNewGroupAtTips isReady:").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var e=this;if(0!==this._tmpGroupAtTipsList.length){var t=!1;this._tmpGroupAtTipsList.forEach((function(n){var o=n.groupID,a=n.from,s=n.topicID,r=void 0===s?void 0:s,i=n.sync,c=void 0!==i&&i;if(a!==e.getMyUserID())if(et(r)){var u=e._conversationMap.get("".concat(C.CONV_GROUP).concat(o));u&&(u.updateGroupAtInfoList(n),t=!0)}else{var l=e._conversationMap.get("".concat(C.CONV_GROUP).concat(r));if(l){l.updateGroupAtInfoList(n);var d=e.getModule(dn),p=l.groupAtInfoList;d.onConversationProxy({topicID:r,groupAtInfoList:p})}if(Bt(l)&&c)e.updateTopicConversation([{conversationID:"".concat(C.CONV_GROUP).concat(r),type:C.CONV_TOPIC}]),e._conversationMap.get("".concat(C.CONV_GROUP).concat(r)).updateGroupAtInfoList(n)}})),t&&this.emitConversationUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}},{key:"_getC2CPeerReadTime",value:function(e){var t=this,n=[];if(e.forEach((function(e){t._conversationMap.has(e.conversationID)||e.type!==C.CONV_C2C||n.push(e.conversationID.replace(C.CONV_C2C,""))})),n.length>0){we.debug("".concat(this._className,"._getC2CPeerReadTime userIDList:").concat(n));var o=this.getModule(rn);o&&o.getRemotePeerReadTime(n)}}},{key:"_getStorageConversationList",value:function(){return this.getModule(gn).getItem("conversationMap")}},{key:"_setStorageConversationList",value:function(){var e=this.getLocalConversationList().slice(0,20).map((function(e){return{conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}}));this.getModule(gn).setItem("conversationMap",e)}},{key:"emitConversationUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversationList();if(t){var o=this.getModule(cn);o&&o.updateGroupLastMessage(n)}e&&this.emitOuterEvent(D.CONVERSATION_LIST_UPDATED)}},{key:"getLocalConversationList",value:function(){return M(this._conversationMap.values()).filter((function(e){return e.type!==C.CONV_TOPIC}))}},{key:"getLocalConversation",value:function(e){return this._conversationMap.get(e)}},{key:"getLocalOldestMessage",value:function(e){return this._messageListHandler.getLocalOldestMessage(e)}},{key:"syncConversationList",value:function(){var e=this,t=new Va(Ha.SYNC_CONVERSATION_LIST);return this._pagingStatus===$t.NOT_START&&this._conversationMap.clear(),this._pagingGetConversationList().then((function(n){return e._pagingStatus=$t.RESOLVED,e._setStorageConversationList(),e._handleC2CPeerReadTime(),e._patchConversationProperties(),t.setMessage(e._conversationMap.size).setNetworkType(e.getNetworkType()).end(),n})).catch((function(n){return e._pagingStatus=$t.REJECTED,t.setMessage(e._pagingTimeStamp),e.probeNetwork().then((function(e){var o=m(e,2),a=o[0],s=o[1];t.setError(n,a,s).end()})),gs(n)}))}},{key:"_patchConversationProperties",value:function(){var e=this,t=Date.now(),n=this.checkAndPatchRemark(),o=this._messageRemindHandler.getC2CMessageRemindType(),a=this.getModule(cn).getGroupList();Promise.all([n,o,a]).then((function(){var n=Date.now()-t;we.log("".concat(e._className,"._patchConversationProperties ok. cost ").concat(n," ms")),e.emitConversationUpdate(!0,!1)}))}},{key:"_pagingGetConversationList",value:function(){var e=this,t="".concat(this._className,"._pagingGetConversationList");return we.log("".concat(t," timeStamp:").concat(this._pagingTimeStamp," startIndex:").concat(this._pagingStartIndex)+" pinnedTimeStamp:".concat(this._pagingPinnedTimeStamp," pinnedStartIndex:").concat(this._pagingPinnedStartIndex)),this._pagingStatus=$t.PENDING,this.request({protocolName:po,requestData:{fromAccount:this.getMyUserID(),timeStamp:this._pagingTimeStamp,startIndex:this._pagingStartIndex,pinnedTimeStamp:this._pagingPinnedTimeStamp,pinnedStartIndex:this._pagingStartIndex,orderType:1}}).then((function(n){var o=n.data,a=o.completeFlag,s=o.conversations,r=void 0===s?[]:s,i=o.timeStamp,c=o.startIndex,u=o.pinnedTimeStamp,l=o.pinnedStartIndex;if(we.log("".concat(t," ok. completeFlag:").concat(a," count:").concat(r.length," isReady:").concat(e._isReady)),r.length>0){var d=e._getConversationOptions(r);e._updateLocalConversationList({conversationOptionsList:d,isFromGetConversations:!0}),e.isLoggedIn()&&e.emitConversationUpdate()}if(!e._isReady){if(!e.isLoggedIn())return _s();e.triggerReady()}return e._pagingTimeStamp=i,e._pagingStartIndex=c,e._pagingPinnedTimeStamp=u,e._pagingPinnedStartIndex=l,1!==a?e._pagingGetConversationList():(e._handleGroupAtTipsList(),_s())})).catch((function(n){throw e.isLoggedIn()&&(e._isReady||(we.warn("".concat(t," failed. error:"),n),e.triggerReady())),n}))}},{key:"_updateLocalConversationList",value:function(e){var t,n=e.isFromGetConversations,o=Date.now();t=this._getTmpConversationListMapping(e),this._conversationMap=new Map(this._sortConversationList([].concat(M(t.toBeUpdatedConversationList),M(this._conversationMap)))),n||this._updateUserOrGroupProfile(t.newConversationList),we.debug("".concat(this._className,"._updateLocalConversationList cost ").concat(Date.now()-o," ms"))}},{key:"_getTmpConversationListMapping",value:function(e){for(var t=e.conversationOptionsList,n=e.isFromGetConversations,o=e.isInstantMessage,a=e.isUnreadC2CMessage,s=void 0!==a&&a,r=[],i=[],c=this.getModule(cn),u=this.getModule(un),l=0,d=t.length;l0&&a.getUserProfile({userIDList:n}).then((function(e){var n=e.data;Ze(n)?n.forEach((function(e){t._conversationMap.get("C2C".concat(e.userID)).userProfile=e})):t._conversationMap.get("C2C".concat(n.userID)).userProfile=n})),o.length>0&&s.getGroupProfileAdvance({groupIDList:o,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then((function(e){e.data.successGroupList.forEach((function(e){var n="GROUP".concat(e.groupID);if(t._conversationMap.has(n)){var o=t._conversationMap.get(n);ut(o.groupProfile,e,[],[null,void 0,"",0,NaN]),!o.subType&&e.type&&(o.subType=e.type)}}))}))}}},{key:"_getConversationOptions",value:function(e){var n=this,o=[],a=e.filter((function(e){var t=e.lastMsg;return Qe(t)})).filter((function(e){var t=e.type,n=e.userID;return 1===t&&"@TLS#NOT_FOUND"!==n&&"@TLS#ERROR"!==n||2===t})),s=this.getMyUserID(),r=a.map((function(e){if(1===e.type){var a={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar};return o.push(a),{conversationID:"C2C".concat(e.userID),type:"C2C",lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,messageForShow:e.messageShow,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:e.lastC2CMsgFromAccount===s&&e.time<=e.c2cPeerReadTime},userProfile:new Ns(a),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,messageRemindType:""}}return{conversationID:"GROUP".concat(e.groupID),type:"GROUP",lastMessage:t(t({lastTime:e.time,lastSequence:e.messageReadSeq+e.unreadCount,fromAccount:e.msgGroupFromAccount,messageForShow:e.messageShow},n._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||"",nameCard:e.senderNameCard||""}),groupProfile:new Os({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage}),unreadCount:e.unreadCount,peerReadTime:0,isPinned:1===e.isPinned,messageRemindType:"",version:0}}));o.length>0&&this.getModule(sn).onConversationsProfileUpdated(o);return r}},{key:"_patchTypeAndPayload",value:function(e){var n=e.lastMsg,o=n.event,a=void 0===o?void 0:o,s=n.elements,r=void 0===s?[]:s,i=n.groupTips,c=void 0===i?{}:i;if(!et(a)&&!Bt(c)){var u=new os(c);u.setElement({type:C.MSG_GRP_TIP,content:t(t({},c.elements),{},{groupProfile:c.groupProfile})});var l=JSON.parse(JSON.stringify(u.payload));return u=null,{type:C.MSG_GRP_TIP,payload:l}}return{type:r[0]?r[0].type:null,payload:r[0]?r[0].content:null}}},{key:"getLocalMessageList",value:function(e){return this._messageListHandler.getLocalMessageList(e)}},{key:"deleteLocalMessage",value:function(e){e instanceof os&&this._messageListHandler.remove(e)}},{key:"onConversationDeleted",value:function(e){var t=this;we.log("".concat(this._className,".onConversationDeleted")),Ze(e)&&e.forEach((function(e){var n=e.type,o=e.userID,a=e.groupID,s="";1===n?s="".concat(C.CONV_C2C).concat(o):2===n&&(s="".concat(C.CONV_GROUP).concat(a)),t.deleteLocalConversation(s)}))}},{key:"onConversationPinned",value:function(e){var t=this;if(Ze(e)){var n=!1;e.forEach((function(e){var o,a=e.type,s=e.userID,r=e.groupID;1===a?o=t.getLocalConversation("".concat(C.CONV_C2C).concat(s)):2===a&&(o=t.getLocalConversation("".concat(C.CONV_GROUP).concat(r))),o&&(we.log("".concat(t._className,".onConversationPinned conversationID:").concat(o.conversationID," isPinned:").concat(o.isPinned)),o.isPinned||(o.isPinned=!0,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:"onConversationUnpinned",value:function(e){var t=this;if(Ze(e)){var n=!1;e.forEach((function(e){var o,a=e.type,s=e.userID,r=e.groupID;1===a?o=t.getLocalConversation("".concat(C.CONV_C2C).concat(s)):2===a&&(o=t.getLocalConversation("".concat(C.CONV_GROUP).concat(r))),o&&(we.log("".concat(t._className,".onConversationUnpinned conversationID:").concat(o.conversationID," isPinned:").concat(o.isPinned)),o.isPinned&&(o.isPinned=!1,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:"getMessageList",value:function(e){var t=this,n=e.conversationID,o=e.nextReqMessageID,a=e.count,s="".concat(this._className,".getMessageList"),r=this.getLocalConversation(n),i="";if(r&&r.groupProfile&&(i=r.groupProfile.type),Et(i))return we.log("".concat(s," not available in avchatroom. conversationID:").concat(n)),_s({messageList:[],nextReqMessageID:"",isCompleted:!0});(et(a)||a>15)&&(a=15),!o&&this._isNotInCommunity(n)&&(this._messageListHandler.removeByConversationID(n),this._completedMap.delete(n),this._roamingMessageSequenceMap.delete(n));var c=this._computeRemainingCount({conversationID:n,nextReqMessageID:o}),u=this._completedMap.has(n);if(we.log("".concat(s," conversationID:").concat(n," nextReqMessageID:").concat(o)+" remainingCount:".concat(c," count:").concat(a," isCompleted:").concat(u)),this._needGetHistory({conversationID:n,remainingCount:c,count:a}))return this.getHistoryMessages({conversationID:n,nextReqMessageID:o,count:20}).then((function(e){var o=e.nextReqID,a=e.storedMessageList,r=t._completedMap.has(n),i=a;c>0&&(i=t._messageListHandler.getLocalMessageList(n).slice(0,a.length+c));var u={nextReqMessageID:r?"":o,messageList:i,isCompleted:r};return we.log("".concat(s," ret.nextReqMessageID:").concat(u.nextReqMessageID," ret.isCompleted:").concat(u.isCompleted," ret.length:").concat(i.length)),as(u)}));this.modifyMessageList(n);var l=this._getMessageListFromMemory({conversationID:n,nextReqMessageID:o,count:a});return _s(l)}},{key:"_getMessageListFromMemory",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=e.count,a="".concat(this._className,"._getMessageListFromMemory"),s=this._messageListHandler.getLocalMessageList(t),r=s.length,i=0,c={isCompleted:!1,nextReqMessageID:"",messageList:[]};return n?(i=s.findIndex((function(e){return e.ID===n})))>o?(c.messageList=s.slice(i-o,i),c.nextReqMessageID=s[i-o].ID):(c.messageList=s.slice(0,i),c.isCompleted=!0):r>o?(i=r-o,c.messageList=s.slice(i,r),c.nextReqMessageID=s[i].ID):(c.messageList=s.slice(0,r),c.isCompleted=!0),we.log("".concat(a," conversationID:").concat(t)+" ret.nextReqMessageID:".concat(c.nextReqMessageID," ret.isCompleted:").concat(c.isCompleted," ret.length:").concat(c.messageList.length)),c}},{key:"getMessageListHopping",value:function(e){var t=e.conversationID,n=e.sequence,o=e.time,a=e.count,s=e.direction,r=void 0===s?0:s;if((et(a)||a>15)&&(a=15),t.startsWith(C.CONV_C2C)){var i=this.getModule(rn),c=t.replace(C.CONV_C2C,"");return i.getRoamingMessagesHopping({peerAccount:c,time:o,count:a,direction:r})}if(t.startsWith(C.CONV_GROUP)){var u=this.getModule(cn),l=t.replace(C.CONV_GROUP,"");return u.getRoamingMessagesHopping({groupID:l,sequence:n,count:a,direction:r})}}},{key:"_computeRemainingCount",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=this._messageListHandler.getLocalMessageList(t),a=o.length;if(!n)return a;var s=0;return Dt(t)?s=o.findIndex((function(e){return e.ID===n})):Ct(t)&&(s=-1!==n.indexOf("-")?o.findIndex((function(e){return e.ID===n})):o.findIndex((function(e){return e.sequence===n}))),-1===s&&(s=0),s}},{key:"_getMessageListSize",value:function(e){return this._messageListHandler.getLocalMessageList(e).length}},{key:"_needGetHistory",value:function(e){var t=e.conversationID,n=e.remainingCount,o=e.count,a=this.getLocalConversation(t),s="";return a&&a.groupProfile&&(s=a.groupProfile.type),!Nt(t)&&!Et(s)&&(!(Ct(t)&&this._isPagingGetGroupListCompleted()&&!this._hasLocalGroup(t)&&!this._isTopicConversation(t))&&(n<=o&&!this._completedMap.has(t)))}},{key:"_isTopicConversation",value:function(e){var t=e.replace(C.CONV_GROUP,"");return St(t)}},{key:"getHistoryMessages",value:function(e){var t=e.conversationID,n=e.count;if(t===C.CONV_SYSTEM)return _s();var o=15;n>20&&(o=20);var a=null;if(Dt(t)){var s=this._roamingMessageKeyAndTimeMap.has(t);return(a=this.getModule(rn))?a.getRoamingMessage({conversationID:t,peerAccount:t.replace(C.CONV_C2C,""),count:o,lastMessageTime:s?this._roamingMessageKeyAndTimeMap.get(t).lastMessageTime:0,messageKey:s?this._roamingMessageKeyAndTimeMap.get(t).messageKey:""}):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}if(Ct(t)){if(!(a=this.getModule(cn)))return gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE});var r=null;this._conversationMap.has(t)&&(r=this._conversationMap.get(t).lastMessage);var i=0;r&&(i=r.lastSequence);var c=this._roamingMessageSequenceMap.get(t);return a.getRoamingMessage({conversationID:t,groupID:t.replace(C.CONV_GROUP,""),count:o,sequence:c||i})}return _s()}},{key:"patchConversationLastMessage",value:function(e){var t=this.getLocalConversation(e);if(t){var n=t.lastMessage,o=n.messageForShow,a=n.payload;if(Bt(o)||Bt(a)){var s=this._messageListHandler.getLocalMessageList(e);if(0===s.length)return;var r=s[s.length-1];we.log("".concat(this._className,".patchConversationLastMessage conversationID:").concat(e," payload:"),r.payload),t.updateLastMessage(r)}}}},{key:"onRoamingMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=n.startsWith(C.CONV_C2C)?C.CONV_C2C:C.CONV_GROUP,s=null,r=[],i=[],c=0,u=e.length,l=null,d=a===C.CONV_GROUP,p=this.getModule(mn),_=function(){c=d?e.length-1:0,u=d?0:e.length},g=function(){d?--c:++c},h=function(){return d?c>=u:c0&&void 0!==arguments[0]?arguments[0]:{},n="".concat(this._className,".setAllMessageRead");t.scope||(t.scope=C.READ_ALL_MSG),we.log("".concat(n," options:"),t);var o=this._createSetAllMessageReadPack(t);if(0===o.readAllC2CMessage&&0===o.groupMessageReadInfoList.length)return _s();var a=new Va(Ha.SET_ALL_MESSAGE_READ);return this.request({protocolName:Oo,requestData:o}).then((function(n){var o=n.data,s=e._handleAllMessageRead(o);return a.setMessage("scope:".concat(t.scope," failureGroups:").concat(JSON.stringify(s))).setNetworkType(e.getNetworkType()).end(),_s()})).catch((function(t){return e.probeNetwork().then((function(e){var n=m(e,2),o=n[0],s=n[1];a.setError(t,o,s).end()})),we.warn("".concat(n," failed. error:"),t),gs({code:t&&t.code?t.code:Sa.MESSAGE_UNREAD_ALL_FAIL,message:t&&t.message?t.message:Da.MESSAGE_UNREAD_ALL_FAIL})}))}},{key:"_getConversationLastMessageSequence",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),n=e.lastMessage.lastSequence;return t&&n0)if(s.type===C.CONV_C2C&&0===n.readAllC2CMessage){if(o===C.READ_ALL_MSG)n.readAllC2CMessage=1;else if(o===C.READ_ALL_C2C_MSG){n.readAllC2CMessage=1;break}}else if(s.type===C.CONV_GROUP&&(o===C.READ_ALL_GROUP_MSG||o===C.READ_ALL_MSG)){var r=this._getConversationLastMessageSequence(s);n.groupMessageReadInfoList.push({groupID:s.groupProfile.groupID,messageSequence:r})}}}catch(i){a.e(i)}finally{a.f()}return n}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMessageRead(e)}},{key:"_handleAllMessageRead",value:function(e){var t=e.groupMessageReadInfoList,n=e.readAllC2CMessage,o=this._parseGroupReadInfo(t);return this._updateAllConversationUnreadCount({readAllC2CMessage:n})>=1&&this.emitConversationUpdate(!0,!1),o}},{key:"_parseGroupReadInfo",value:function(e){var t=[];if(e&&e.length)for(var n=0,o=e.length;n=1){if(1===n&&i.type===C.CONV_C2C){var c=this._getConversationLastMessageTime(i);this.updateIsReadAfterReadReport({conversationID:r,lastMessageTime:c})}else if(i.type===C.CONV_GROUP){var u=r.replace(C.CONV_GROUP,"");if(this._remoteGroupReadSequenceMap.has(u)){var l=this._remoteGroupReadSequenceMap.get(u),d=this._getConversationLastMessageSequence(i);this.updateIsReadAfterReadReport({conversationID:r,remoteReadSequence:l}),d>=l&&this._remoteGroupReadSequenceMap.delete(u)}}this.updateUnreadCount(r,!1)&&(o+=1)}}}catch(p){a.e(p)}finally{a.f()}return o}},{key:"isRemoteRead",value:function(e){var t=e.conversationID,n=e.sequence,o=t.replace(C.CONV_GROUP,""),a=!1;if(this._remoteGroupReadSequenceMap.has(o)){var s=this._remoteGroupReadSequenceMap.get(o);n<=s&&(a=!0,we.log("".concat(this._className,".isRemoteRead conversationID:").concat(t," messageSequence:").concat(n," remoteReadSequence:").concat(s))),n>=s+10&&this._remoteGroupReadSequenceMap.delete(o)}return a}},{key:"updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,n=e.lastMessageSeq,o=e.lastMessageTime,a=this._messageListHandler.getLocalMessageList(t);if(0!==a.length)for(var s,r=a.length-1;r>=0;r--)if(s=a[r],!(o&&s.time>o||n&&s.sequence>n)){if("in"===s.flow&&s.isRead)break;s.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!1,o=this.getLocalConversation(e),a=this._messageListHandler.getLocalMessageList(e);if(o){var s=o.unreadCount,r=a.filter((function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted})).length;if(s!==r&&(o.unreadCount=r,n=!0,we.log("".concat(this._className,".updateUnreadCount from ").concat(s," to ").concat(r,", conversationID:").concat(e)),!0===t&&this.emitConversationUpdate(!0,!1)),n&&o.type===C.CONV_TOPIC){var i=o.unreadCount,c=this.getModule(dn),u=e.replace(C.CONV_GROUP,"");c.onConversationProxy({topicID:u,unreadCount:i})}return n}}},{key:"clearGroupAtInfoList",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversation(e);if(n&&n.groupAtInfoList.length>0){if(n.clearGroupAtInfoList(),we.log("".concat(this._className,".clearGroupAtInfoList conversationID:").concat(e)),n.type===C.CONV_TOPIC){var o=n.groupAtInfoList,a=this.getModule(dn),s=e.replace(C.CONV_GROUP,"");a.onConversationProxy({topicID:s,groupAtInfoList:o})}!0===t&&this.emitConversationUpdate(!0,!1)}}},{key:"updateReadReceiptInfo",value:function(e){var t=this,n=e.userID,o=void 0===n?void 0:n,a=e.groupID,s=void 0===a?void 0:a,r=e.readReceiptList;if(!Bt(r)){var i=[];if(et(o)){if(!et(s)){var c="".concat(C.CONV_GROUP).concat(s);r.forEach((function(e){var n=e.tinyID,o=e.clientTime,a=e.random,r=e.readCount,u=e.unreadCount,l="".concat(n,"-").concat(o,"-").concat(a),d=t._messageListHandler.getLocalMessage(c,l),p={groupID:s,messageID:l,readCount:0,unreadCount:0};d&&(ze(r)&&(d.readReceiptInfo.readCount=r,p.readCount=r),ze(u)&&(d.readReceiptInfo.unreadCount=u,p.unreadCount=u),i.push(p))}))}}else{var u="".concat(C.CONV_C2C).concat(o);r.forEach((function(e){var n=e.tinyID,a=e.clientTime,s=e.random,r="".concat(n,"-").concat(a,"-").concat(s),c=t._messageListHandler.getLocalMessage(u,r);if(c&&!c.isPeerRead){c.isPeerRead=!0;var l={userID:o,messageID:r,isPeerRead:!0};i.push(l)}}))}i.length>0&&this.emitOuterEvent(D.MESSAGE_READ_RECEIPT_RECEIVED,i)}}},{key:"recomputeGroupUnreadCount",value:function(e){var t=e.conversationID,n=e.count,o=this.getLocalConversation(t);if(o){var a=o.unreadCount,s=a-n;s<0&&(s=0),o.unreadCount=s,we.log("".concat(this._className,".recomputeGroupUnreadCount from ").concat(a," to ").concat(s,", conversationID:").concat(t))}}},{key:"updateIsRead",value:function(e){var t=this.getLocalConversation(e),n=this.getLocalMessageList(e);if(t&&0!==n.length&&!Nt(t.type)){for(var o=[],a=0,s=n.length;a0){var n=this._messageListHandler.updateMessageIsPeerReadProperty(e,t);if(n.length>0&&this.emitOuterEvent(D.MESSAGE_READ_BY_PEER,n),this._conversationMap.has(e)){var o=this._conversationMap.get(e).lastMessage;Bt(o)||o.fromAccount===this.getMyUserID()&&o.lastTime<=t&&!o.isPeerRead&&(o.isPeerRead=!0,this.emitConversationUpdate(!0,!1))}}}},{key:"updateMessageIsModifiedProperty",value:function(e){this._messageListHandler.updateMessageIsModifiedProperty(e)}},{key:"setCompleted",value:function(e){we.log("".concat(this._className,".setCompleted. conversationID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMessageKeyAndTime",value:function(e,t,n){this._roamingMessageKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:n})}},{key:"updateRoamingMessageSequence",value:function(e,t){this._roamingMessageSequenceMap.set(e,t)}},{key:"getConversationList",value:function(e){var t=this,n="".concat(this._className,".getConversationList"),o="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._conversationMap.size,", options:").concat(e);if(we.log("".concat(n,". ").concat(o)),this._pagingStatus===$t.REJECTED){var a=new Va(Ha.GET_CONVERSATION_LIST);return a.setMessage(o),this.syncConversationList().then((function(){a.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return as({conversationList:n})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}if(0===this._conversationMap.size){var s=new Va(Ha.GET_CONVERSATION_LIST);return s.setMessage(o),this.syncConversationList().then((function(){s.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return as({conversationList:n})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}var r=this._getConversationList(e);return we.log("".concat(n,". returned conversation count:").concat(r.length)),_s({conversationList:r})}},{key:"_getConversationList",value:function(e){var t=this;if(et(e))return this.getLocalConversationList();if(Ze(e)){var n=[];return e.forEach((function(e){if(t._conversationMap.has(e)){var o=t.getLocalConversation(e);n.push(o)}})),n}}},{key:"_handleC2CPeerReadTime",value:function(){var e,t=S(this._conversationMap);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2),o=n[0],a=n[1];a.type===C.CONV_C2C&&(we.debug("".concat(this._className,"._handleC2CPeerReadTime conversationID:").concat(o," peerReadTime:").concat(a.peerReadTime)),this.recordPeerReadTime(o,a.peerReadTime))}}catch(s){t.e(s)}finally{t.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){return this.getModule(cn).isPagingGetCompleted()}},{key:"_hasLocalGroup",value:function(e){return this.getModule(cn).hasLocalGroup(e.replace(C.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(e){var t,n=this;if((t=this._conversationMap.has(e)?this._conversationMap.get(e):new Gs({conversationID:e,type:e.slice(0,3)===C.CONV_C2C?C.CONV_C2C:C.CONV_GROUP}))._isInfoCompleted||t.type===C.CONV_SYSTEM)return _s({conversation:t});if(Ct(e)&&!this._hasLocalGroup(e))return _s({conversation:t});var o=new Va(Ha.GET_CONVERSATION_PROFILE),a="".concat(this._className,".getConversationProfile");return we.log("".concat(a,". conversationID:").concat(e," remark:").concat(t.remark," lastMessage:"),t.lastMessage),this._updateUserOrGroupProfileCompletely(t).then((function(s){o.setNetworkType(n.getNetworkType()).setMessage("conversationID:".concat(e," unreadCount:").concat(s.data.conversation.unreadCount)).end();var r=n.getModule(un);if(r&&t.type===C.CONV_C2C){var i=e.replace(C.CONV_C2C,"");if(r.isMyFriend(i)){var c=r.getFriendRemark(i);t.remark!==c&&(t.remark=c,we.log("".concat(a,". conversationID:").concat(e," patch remark:").concat(t.remark)))}}return we.log("".concat(a," ok. conversationID:").concat(e)),s})).catch((function(t){return n.probeNetwork().then((function(n){var a=m(n,2),s=a[0],r=a[1];o.setError(t,s,r).setMessage("conversationID:".concat(e)).end()})),we.error("".concat(a," failed. error:"),t),gs(t)}))}},{key:"_updateUserOrGroupProfileCompletely",value:function(e){var t=this;return e.type===C.CONV_C2C?this.getModule(sn).getUserProfile({userIDList:[e.toAccount]}).then((function(n){var o=n.data;return 0===o.length?gs(new ls({code:Sa.USER_OR_GROUP_NOT_FOUND,message:Da.USER_OR_GROUP_NOT_FOUND})):(e.userProfile=o[0],e._isInfoCompleted=!0,t._unshiftConversation(e),_s({conversation:e}))})):this.getModule(cn).getGroupProfile({groupID:e.toAccount}).then((function(n){return e.groupProfile=n.data.group,e._isInfoCompleted=!0,t._unshiftConversation(e),_s({conversation:e})}))}},{key:"_unshiftConversation",value:function(e){e instanceof Gs&&!this._conversationMap.has(e.conversationID)&&(this._conversationMap=new Map([[e.conversationID,e]].concat(M(this._conversationMap))),this._setStorageConversationList(),this.emitConversationUpdate(!0,!1))}},{key:"_onProfileUpdated",value:function(e){var t=this;e.data.forEach((function(e){var n=e.userID;if(n===t.getMyUserID())t._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar});else{var o=t._conversationMap.get("".concat(C.CONV_C2C).concat(n));o&&(o.userProfile=e)}}))}},{key:"deleteConversation",value:function(e){var t=this,n={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e)){var o=new ls({code:Sa.CONVERSATION_NOT_FOUND,message:Da.CONVERSATION_NOT_FOUND});return gs(o)}var a=this._conversationMap.get(e).type;if(a===C.CONV_C2C)n.type=1,n.toAccount=e.replace(C.CONV_C2C,"");else{if(a!==C.CONV_GROUP){if(a===C.CONV_SYSTEM)return this.getModule(cn).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),this.deleteLocalConversation(e),_s({conversationID:e});var s=new ls({code:Sa.CONVERSATION_UN_RECORDED_TYPE,message:Da.CONVERSATION_UN_RECORDED_TYPE});return gs(s)}if(!this._hasLocalGroup(e))return this.deleteLocalConversation(e),_s({conversationID:e});n.type=2,n.toGroupID=e.replace(C.CONV_GROUP,"")}var r=new Va(Ha.DELETE_CONVERSATION);r.setMessage("conversationID:".concat(e));var i="".concat(this._className,".deleteConversation");return we.log("".concat(i,". conversationID:").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:go,requestData:n})})).then((function(){return r.setNetworkType(t.getNetworkType()).end(),we.log("".concat(i," ok")),t.deleteLocalConversation(e),_s({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),we.error("".concat(i," failed. error:"),e),gs(e)}))}},{key:"pinConversation",value:function(e){var t=this,n=e.conversationID,o=e.isPinned;if(!this._conversationMap.has(n))return gs({code:Sa.CONVERSATION_NOT_FOUND,message:Da.CONVERSATION_NOT_FOUND});var a=this.getLocalConversation(n);if(a.isPinned===o)return _s({conversationID:n});var s=new Va(Ha.PIN_CONVERSATION);s.setMessage("conversationID:".concat(n," isPinned:").concat(o));var r="".concat(this._className,".pinConversation");we.log("".concat(r,". conversationID:").concat(n," isPinned:").concat(o));var i=null;return Dt(n)?i={type:1,toAccount:n.replace(C.CONV_C2C,"")}:Ct(n)&&(i={type:2,groupID:n.replace(C.CONV_GROUP,"")}),this.request({protocolName:ho,requestData:{fromAccount:this.getMyUserID(),operationType:!0===o?1:2,itemList:[i]}}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),we.log("".concat(r," ok")),a.isPinned!==o&&(a.isPinned=o,t._sortConversationListAndEmitEvent()),as({conversationID:n})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.error("".concat(r," failed. error:"),e),gs(e)}))}},{key:"setMessageRemindType",value:function(e){return this._messageRemindHandler.set(e)}},{key:"patchMessageRemindType",value:function(e){var t=e.ID,n=e.isC2CConversation,o=e.messageRemindType,a=!1,s=this.getLocalConversation(n?"".concat(C.CONV_C2C).concat(t):"".concat(C.CONV_GROUP).concat(t));return s&&s.messageRemindType!==o&&(s.messageRemindType=o,a=!0),we.debug("".concat(this._className,".patchMessageRemindType options:"),e,"ret:".concat(a)),a}},{key:"onC2CMessageRemindTypeSynced",value:function(e){var t=this;we.debug("".concat(this._className,".onC2CMessageRemindTypeSynced options:"),e),e.dataList.forEach((function(e){if(!Bt(e.muteNotificationsSync)){var n,o=e.muteNotificationsSync,a=o.to,s=o.updateSequence,r=o.muteFlag;t._messageRemindHandler.setUpdateSequence(s),0===r?n=C.MSG_REMIND_ACPT_AND_NOTE:1===r?n=C.MSG_REMIND_DISCARD:2===r&&(n=C.MSG_REMIND_ACPT_NOT_NOTE);var i=0;t.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:n})&&(i+=1),we.log("".concat(t._className,".onC2CMessageRemindTypeSynced updateCount:").concat(i)),i>=1&&t.emitConversationUpdate(!0,!1)}}))}},{key:"onGroupMessageRemindTypeSynced",value:function(e){we.debug("".concat(this._className,".onGroupMessageRemindTypeSynced options:"),e),this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e)}},{key:"deleteLocalConversation",value:function(e){var t=this._conversationMap.has(e);if(we.log("".concat(this._className,".deleteLocalConversation conversationID:").concat(e," has:").concat(t)),t){this._conversationMap.delete(e),this._roamingMessageKeyAndTimeMap.has(e)&&this._roamingMessageKeyAndTimeMap.delete(e),this._roamingMessageSequenceMap.has(e)&&this._roamingMessageSequenceMap.delete(e),this._setStorageConversationList(),this._messageListHandler.removeByConversationID(e),this._completedMap.delete(e);var n=!this._isTopicConversation(e);this.emitConversationUpdate(n,!1)}}},{key:"isMessageSentByCurrentInstance",value:function(e){return!(!this._messageListHandler.hasLocalMessage(e.conversationID,e.ID)&&!this.singlyLinkedList.has(e.random))}},{key:"modifyMessageList",value:function(e){if(e.startsWith(C.CONV_C2C)&&this._conversationMap.has(e)){var t=this._conversationMap.get(e),n=Date.now();this._messageListHandler.modifyMessageSentByPeer({conversationID:e,latestNick:t.userProfile.nick,latestAvatar:t.userProfile.avatar});var o=this.getModule(sn).getNickAndAvatarByUserID(this.getMyUserID());this._messageListHandler.modifyMessageSentByMe({conversationID:e,latestNick:o.nick,latestAvatar:o.avatar}),we.log("".concat(this._className,".modifyMessageList conversationID:").concat(e," cost ").concat(Date.now()-n," ms"))}}},{key:"updateUserProfileSpecifiedKey",value:function(e){we.log("".concat(this._className,".updateUserProfileSpecifiedKey options:"),e);var t=e.conversationID,n=e.nick,o=e.avatar;if(this._conversationMap.has(t)){var a=this._conversationMap.get(t).userProfile;Je(n)&&a.nick!==n&&(a.nick=n),Je(o)&&a.avatar!==o&&(a.avatar=o),this.emitConversationUpdate(!0,!1)}}},{key:"_onMyProfileModified",value:function(e){var n=this,o=this.getLocalConversationList(),a=Date.now();o.forEach((function(o){n.modifyMessageSentByMe(t({conversationID:o.conversationID},e))})),we.log("".concat(this._className,"._onMyProfileModified. modify all messages sent by me, cost ").concat(Date.now()-a," ms"))}},{key:"modifyMessageSentByMe",value:function(e){this._messageListHandler.modifyMessageSentByMe(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._messageListHandler.getLatestMessageSentByMe(e)}},{key:"modifyMessageSentByPeer",value:function(e){this._messageListHandler.modifyMessageSentByPeer(e)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._messageListHandler.getLatestMessageSentByPeer(e)}},{key:"pushIntoNoticeResult",value:function(e,t){return!(!this._messageListHandler.pushIn(t)||this.singlyLinkedList.has(t.random))&&(e.push(t),!0)}},{key:"getGroupLocalLastMessageSequence",value:function(e){return this._messageListHandler.getGroupLocalLastMessageSequence(e)}},{key:"checkAndPatchRemark",value:function(){var e=Promise.resolve();if(0===this._conversationMap.size)return e;var t=this.getModule(un);if(!t)return e;var n=M(this._conversationMap.values()).filter((function(e){return e.type===C.CONV_C2C}));if(0===n.length)return e;var o=0;return n.forEach((function(e){var n=e.conversationID.replace(C.CONV_C2C,"");if(t.isMyFriend(n)){var a=t.getFriendRemark(n);e.remark!==a&&(e.remark=a,o+=1)}})),we.log("".concat(this._className,".checkAndPatchRemark. c2c conversation count:").concat(n.length,", patched count:").concat(o)),e}},{key:"updateTopicConversation",value:function(e){this._updateLocalConversationList({conversationOptionsList:e,isFromGetConversations:!0})}},{key:"sendReadReceipt",value:function(e){var t=e[0],n=null;return t.conversationType===C.CONV_C2C?n=this._moduleManager.getModule(rn):t.conversationType===C.CONV_GROUP&&(n=this._moduleManager.getModule(cn)),n?n.sendReadReceipt(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"getReadReceiptList",value:function(e){var t=e[0],n=null;return t.conversationType===C.CONV_C2C?n=this._moduleManager.getModule(rn):t.conversationType===C.CONV_GROUP&&(n=this._moduleManager.getModule(cn)),n?n.getReadReceiptList(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"getLastMessageTime",value:function(e){var t=this.getLocalConversation(e);return t?t.lastMessage.lastTime:0}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._pagingStatus=$t.NOT_START,this._messageListHandler.reset(),this._messageRemindHandler.reset(),this._roamingMessageKeyAndTimeMap.clear(),this._roamingMessageSequenceMap.clear(),this.singlyLinkedList.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._conversationMap.clear(),this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._remoteGroupReadSequenceMap.clear(),this.resetReady()}}]),a}(Ln),ws=function(){function e(t){o(this,e),this._groupModule=t,this._className="GroupTipsHandler",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map}return s(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupTipsMap.size>0&&this._checkCachedGroupTips()}},{key:"_checkCachedGroupTips",value:function(){var e=this;this._cachedGroupTipsMap.forEach((function(t,n){var o=e._checkCountMap.get(n),a=e._groupModule.hasLocalGroup(n);we.log("".concat(e._className,"._checkCachedGroupTips groupID:").concat(n," hasLocalGroup:").concat(a," checkCount:").concat(o)),a?(e._notifyCachedGroupTips(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"onNewGroupTips",value:function(e){we.debug("".concat(this._className,".onReceiveGroupTips count:").concat(e.dataList.length));var t=this.newGroupTipsStoredAndSummary(e),n=t.eventDataList,o=t.result,a=t.AVChatRoomMessageList;(a.length>0&&this._groupModule.onAVChatRoomMessage(a),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(pn).onNewMessage({conversationOptionsList:n,isInstantMessage:!0}));o.length>0&&(this._groupModule.emitOuterEvent(D.MESSAGE_RECEIVED,o),this.handleMessageList(o))}},{key:"newGroupTipsStoredAndSummary",value:function(e){for(var n=this,o=e.event,a=e.dataList,s=null,r=[],i=[],c={},u=[],l=function(e,l){var d=vt(a[e]),p=d.groupProfile,_=p.groupID,g=p.communityType,h=void 0===g?0:g,f=p.topicID,m=void 0===f?void 0:f,M=void 0,v=2===h&&!Bt(m);if(v){M=C.CONV_TOPIC,d.to=m;var I=n._groupModule.getModule(dn);I.hasLocalTopic(_,m)||n._getTopicPendingMap.has(m)||(n._getTopicPendingMap.set(m,1),I.getTopicList({groupID:_,topicIDList:[m]}).finally((function(){n._getTopicPendingMap.delete(m)})))}if(2===h&&Bt(m))return"continue";var y=n._groupModule.hasLocalGroup(_);if(!y&&n._groupModule.isUnjoinedAVChatRoom(_))return"continue";if(!y&&!v)return n._cacheGroupTipsAndProbe({groupID:_,event:o,item:d}),"continue";if(n._groupModule.isMessageFromOrToAVChatroom(_))return d.event=o,u.push(d),"continue";d.currentUser=n._groupModule.getMyUserID(),d.conversationType=C.CONV_GROUP,(s=new os(d)).setElement({type:C.MSG_GRP_TIP,content:t(t({},d.elements),{},{groupProfile:d.groupProfile})}),s.isSystemMessage=!1;var E=n._groupModule.getModule(pn),T=s,S=T.conversationID,D=T.sequence;if(6===o)s._onlineOnlyFlag=!0,i.push(s);else if(!E.pushIntoNoticeResult(i,s))return"continue";if(6===o&&E.getLocalConversation(S))return"continue";6!==o&&n._groupModule.getModule(Nn).addMessageSequence({key:Ga,message:s});var N=E.isRemoteRead({conversationID:S,sequence:D});if(et(c[S])){var A=0;"in"===s.flow&&(s._isExcludedFromUnreadCount||s._onlineOnlyFlag||N||(A=1)),c[S]=r.push({conversationID:S,unreadCount:A,type:et(M)?s.conversationType:M,subType:s.conversationSubType,lastMessage:s._isExcludedFromLastMessage?"":s})-1}else{var L=c[S];r[L].type=s.conversationType,r[L].subType=s.conversationSubType,r[L].lastMessage=s._isExcludedFromLastMessage?"":s,"in"===s.flow&&(s._isExcludedFromUnreadCount||s._onlineOnlyFlag||N||r[L].unreadCount++)}},d=0,p=a.length;d=0){c.updateSelfInfo({muteTime:d.muteTime}),u=!0;break}}u&&this._groupModule.emitOuterEvent(D.TOPIC_UPDATED,{groupID:i,topic:c})}}},{key:"_onTopicProfileUpdated",value:function(e){var n=e.payload,o=n.groupProfile.groupID,a=n.newTopicInfo;this._groupModule.getModule(dn).onTopicProfileUpdated(t({groupID:o,topicID:e.to},a))}},{key:"_cacheGroupTips",value:function(e,t){this._cachedGroupTipsMap.has(e)||this._cachedGroupTipsMap.set(e,[]),this._cachedGroupTipsMap.get(e).push(t)}},{key:"_deleteCachedGroupTips",value:function(e){this._cachedGroupTipsMap.has(e)&&this._cachedGroupTipsMap.delete(e)}},{key:"_notifyCachedGroupTips",value:function(e){var t=this,n=this._cachedGroupTipsMap.get(e)||[];n.forEach((function(e){t.onNewGroupTips(e)})),this._deleteCachedGroupTips(e),we.log("".concat(this._className,"._notifyCachedGroupTips groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupTipsAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,a=e.item;this._cacheGroupTips(n,{event:o,dataList:[a]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===C.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupTips(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupTips(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),we.log("".concat(this._className,"._cacheGroupTipsAndProbe groupID:").concat(n))}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear()}}]),e}(),bs=function(){function e(t){o(this,e),this._groupModule=t,this._className="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map,this._isPagingGetCompleted=!1,t.getInnerEmitterInstance().once(ms,this._initGroupList,this)}return s(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupMessageMap.size>0&&this._checkCachedGroupMessage()}},{key:"_checkCachedGroupMessage",value:function(){var e=this;this._cachedGroupMessageMap.forEach((function(t,n){var o=e._checkCountMap.get(n),a=e._groupModule.hasLocalGroup(n);we.log("".concat(e._className,"._checkCachedGroupMessage groupID:").concat(n," hasLocalGroup:").concat(a," checkCount:").concat(o)),a?(e._notifyCachedGroupMessage(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"_initGroupList",value:function(){var e=this;we.log("".concat(this._className,"._initGroupList"));var t=new Va(Ha.GET_GROUP_LIST_IN_STORAGE),n=this._groupModule.getStorageGroupList();if(Ze(n)&&n.length>0){n.forEach((function(t){e._groupModule.initGroupMap(t)})),this._groupModule.emitGroupListUpdate(!0,!1);var o=this._groupModule.getLocalGroupList().length;t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:".concat(o)).end()}else t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:0").end();we.log("".concat(this._className,"._initGroupList ok"))}},{key:"handleUpdateGroupLastMessage",value:function(e){var t="".concat(this._className,".handleUpdateGroupLastMessage");if(we.debug("".concat(t," conversation count:").concat(e.length,", local group count:").concat(this._groupModule.getLocalGroupList().length)),0!==this._groupModule.getGroupMap().size){for(var n,o,a,s=!1,r=0,i=e.length;r0&&this._groupModule.onAVChatRoomMessage(a),this._groupModule.filterModifiedMessage(o),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(pn).onNewMessage({conversationOptionsList:n,isInstantMessage:!0}));var s=this._groupModule.filterUnmodifiedMessage(o);s.length>0&&this._groupModule.emitOuterEvent(D.MESSAGE_RECEIVED,s),o.length=0}},{key:"_newGroupMessageStoredAndSummary",value:function(e){var t=this,n=e.dataList,o=e.event,a=e.isInstantMessage,s=null,r=[],i=[],c=[],u={},l=this._groupModule.getModule(mn),d=this._groupModule.getModule(Nn),p=n.length;p>1&&n.sort((function(e,t){return e.sequence-t.sequence}));for(var _=function(e){var p=vt(n[e]),_=p.groupProfile,g=_.groupID,h=_.communityType,f=void 0===h?0:h,m=_.topicID,M=void 0===m?void 0:m,v=void 0,I=2===f&&!Bt(M);if(I){v=C.CONV_TOPIC,p.to=M;var y=t._groupModule.getModule(dn);y.hasLocalTopic(g,M)||t._getTopicPendingMap.has(M)||(t._getTopicPendingMap.set(M,1),y.getTopicList({groupID:g,topicIDList:[M]}).finally((function(){t._getTopicPendingMap.delete(M)})))}if(2===f&&Bt(M))return"continue";var E=t._groupModule.hasLocalGroup(g);if(!E&&t._groupModule.isUnjoinedAVChatRoom(g))return"continue";if(!E&&!I)return t._cacheGroupMessageAndProbe({groupID:g,event:o,item:p}),"continue";if(t._groupModule.isMessageFromOrToAVChatroom(g))return p.event=o,c.push(p),"continue";p.currentUser=t._groupModule.getMyUserID(),p.conversationType=C.CONV_GROUP,p.isSystemMessage=!!p.isSystemMessage,s=new os(p),p.elements=l.parseElements(p.elements,p.from),s.setElement(p.elements);var T=1===n[e].isModified,S=t._groupModule.getModule(pn);if(S.isMessageSentByCurrentInstance(s)?s.isModified=T:T=!1,1===p.onlineOnlyFlag)s._onlineOnlyFlag=!0,S.isMessageSentByCurrentInstance(s)||i.push(s);else{if(!S.pushIntoMessageList(i,s,T))return"continue";d.addMessageSequence({key:Ga,message:s}),a&&s.clientTime>0&&d.addMessageDelay(s.clientTime);var D=s,N=D.conversationID,A=D.sequence,L=S.isRemoteRead({conversationID:N,sequence:A});if(et(u[N])){var R=0;"in"===s.flow&&(s._isExcludedFromUnreadCount||L||(R=1)),u[N]=r.push({conversationID:N,unreadCount:R,type:et(v)?s.conversationType:v,subType:s.conversationSubType,lastMessage:s._isExcludedFromLastMessage?"":s})-1}else{var O=u[N];r[O].type=et(v)?s.conversationType:v,r[O].subType=s.conversationSubType,r[O].lastMessage=s._isExcludedFromLastMessage?"":s,"in"===s.flow&&(s._isExcludedFromUnreadCount||L||r[O].unreadCount++)}}},g=0;g_),h="offset:".concat(c," totalCount:").concat(p," isCompleted:").concat(g," ")+"currentCount:".concat(l.length," isCommunityRelay:").concat(a);return d.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(h)).end(),a||g?!a&&g?(we.log("".concat(n," start to get community list")),c=0,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l,isCommunityRelay:!0})):a&&!g?(c=_,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l,isCommunityRelay:!0})):(we.log("".concat(n," ok. totalCount:").concat(l.length)),as({groupList:l})):(c=_,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l}))})).catch((function(e){return 11e3!==e.code&&t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];d.setMessage("isCommunityRelay:".concat(a)).setError(e,o,s).end()})),a?(11e3===e.code&&(d=null,we.log("".concat(n," ok. community unavailable"))),_s({groupList:l})):gs(e)}))}},{key:"_pagingGetGroupListWithTopic",value:function(e){var t=this,n="".concat(this._className,"._pagingGetGroupListWithTopic"),o=e.limit,a=e.offset,s=e.groupBaseInfoFilter,r=e.groupList,i=new Va(Ha.PAGING_GET_GROUP_LIST_WITH_TOPIC);return this._groupModule.request({protocolName:mo,requestData:{type:C.GRP_COMMUNITY,memberAccount:this._groupModule.getMyUserID(),limit:o,offset:a,responseFilter:{groupBaseInfoFilter:s,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]},isSupportTopic:1}}).then((function(e){var c=e.data,u=c.groups,l=void 0===u?[]:u,d=c.totalCount;r.push.apply(r,M(l));var p=a+o,_=!(d>p),g="offset:".concat(a," totalCount:").concat(d," isCompleted:").concat(_," ")+"currentCount:".concat(r.length);return i.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(g)).end(),_?(we.log("".concat(n," ok. totalCount:").concat(r.length)),as({groupList:r})):(a=p,t._pagingGetGroupListWithTopic({limit:o,offset:a,groupBaseInfoFilter:s,groupList:r}))})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),gs(e)}))}},{key:"_cacheGroupMessage",value:function(e,t){this._cachedGroupMessageMap.has(e)||this._cachedGroupMessageMap.set(e,[]),this._cachedGroupMessageMap.get(e).push(t)}},{key:"_deleteCachedGroupMessage",value:function(e){this._cachedGroupMessageMap.has(e)&&this._cachedGroupMessageMap.delete(e)}},{key:"_notifyCachedGroupMessage",value:function(e){var t=this,n=this._cachedGroupMessageMap.get(e)||[];n.forEach((function(e){t.onNewGroupMessage(e)})),this._deleteCachedGroupMessage(e),we.log("".concat(this._className,"._notifyCachedGroupMessage groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupMessageAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,a=e.item;this._cacheGroupMessage(n,{event:o,dataList:[a]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===C.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupMessage(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupMessage(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),we.log("".concat(this._className,"._cacheGroupMessageAndProbe groupID:").concat(n))}},{key:"_handleGroupAtInfoWithoutTopic",value:function(e,n){var o=this;e&&0!==n.length&&n.forEach((function(e){var n=e.groupID,a=e.groupAtInfoList,s=[];et(a)||(a.forEach((function(e){s.push(t(t({},e),{},{groupID:n}))})),o._groupModule.getModule(pn).onNewGroupAtTips({dataList:s}))}))}},{key:"reset",value:function(){this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear(),this._isPagingGetCompleted=!1,this._groupModule.getInnerEmitterInstance().once(ms,this._initGroupList,this)}}]),e}(),Fs={1:"init",2:"modify",3:"clear",4:"delete"},qs=function(){function e(t){o(this,e),this._groupModule=t,this._className="GroupAttributesHandler",this._groupAttributesMap=new Map,this.CACHE_EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(Ms,this._onCloudConfigUpdated,this)}return s(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_attr_cache_time");et(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesMap.forEach((function(e){e.localMainSequence=0}))}},{key:"onGroupAttributesUpdated",value:function(e){var t=this,n=e.groupID,o=e.groupAttributeOption,a=o.mainSequence,s=o.hasChangedAttributeInfo,r=o.groupAttributeList,i=void 0===r?[]:r,c=o.operationType;if(we.log("".concat(this._className,".onGroupAttributesUpdated. groupID:").concat(n," hasChangedAttributeInfo:").concat(s," operationType:").concat(c)),!et(c)){if(1===s){if(4===c){var u=[];i.forEach((function(e){u.push(e.key)})),i=M(u),u=null}return this._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:a,groupAttributeList:i,operationType:Fs[c]}),void this._emitGroupAttributesUpdated(n)}if(this._groupAttributesMap.has(n)){var l=this._groupAttributesMap.get(n).avChatRoomKey;this._getGroupAttributes({groupID:n,avChatRoomKey:l}).then((function(){t._emitGroupAttributesUpdated(n)}))}}}},{key:"initGroupAttributesCache",value:function(e){var t=e.groupID,n=e.avChatRoomKey;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:n}),we.log("".concat(this._className,".initGroupAttributesCache groupID:").concat(t," avChatRoomKey:").concat(n))}},{key:"initGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.groupAttributes,a=this._checkCachedGroupAttributes({groupID:n,funcName:"initGroupAttributes"});if(!0!==a)return gs(a);var s=this._groupAttributesMap.get(n),r=s.remoteMainSequence,i=s.avChatRoomKey,c=new Va(Ha.INIT_GROUP_ATTRIBUTES);return c.setMessage("groupID:".concat(n," mainSequence:").concat(r," groupAttributes:").concat(JSON.stringify(o))),this._groupModule.request({protocolName:xo,requestData:{groupID:n,avChatRoomKey:i,mainSequence:r,groupAttributeList:this._transformGroupAttributes(o)}}).then((function(e){var a=e.data,s=a.mainSequence,r=M(a.groupAttributeList);return r.forEach((function(e){e.value=o[e.key]})),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:s,groupAttributeList:r,operationType:"init"}),c.setNetworkType(t._groupModule.getNetworkType()).end(),we.log("".concat(t._className,".initGroupAttributes ok. groupID:").concat(n)),as({groupAttributes:o})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];c.setError(e,o,a).end()})),gs(e)}))}},{key:"setGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.groupAttributes,a=this._checkCachedGroupAttributes({groupID:n,funcName:"setGroupAttributes"});if(!0!==a)return gs(a);var s=this._groupAttributesMap.get(n),r=s.remoteMainSequence,i=s.avChatRoomKey,c=s.attributes,u=this._transformGroupAttributes(o);u.forEach((function(e){var t=e.key;e.sequence=0,c.has(t)&&(e.sequence=c.get(t).sequence)}));var l=new Va(Ha.SET_GROUP_ATTRIBUTES);return l.setMessage("groupID:".concat(n," mainSequence:").concat(r," groupAttributes:").concat(JSON.stringify(o))),this._groupModule.request({protocolName:Wo,requestData:{groupID:n,avChatRoomKey:i,mainSequence:r,groupAttributeList:u}}).then((function(e){var a=e.data,s=a.mainSequence,r=M(a.groupAttributeList);return r.forEach((function(e){e.value=o[e.key]})),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:s,groupAttributeList:r,operationType:"modify"}),l.setNetworkType(t._groupModule.getNetworkType()).end(),we.log("".concat(t._className,".setGroupAttributes ok. groupID:").concat(n)),as({groupAttributes:o})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];l.setError(e,o,a).end()})),gs(e)}))}},{key:"deleteGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.keyList,a=void 0===o?[]:o,s=this._checkCachedGroupAttributes({groupID:n,funcName:"deleteGroupAttributes"});if(!0!==s)return gs(s);var r=this._groupAttributesMap.get(n),i=r.remoteMainSequence,c=r.avChatRoomKey,u=r.attributes,l=M(u.keys()),d=jo,p="clear",_={groupID:n,avChatRoomKey:c,mainSequence:i};if(a.length>0){var g=[];l=[],d=Yo,p="delete",a.forEach((function(e){var t=0;u.has(e)&&(t=u.get(e).sequence,l.push(e)),g.push({key:e,sequence:t})})),_.groupAttributeList=g}var h=new Va(Ha.DELETE_GROUP_ATTRIBUTES);return h.setMessage("groupID:".concat(n," mainSequence:").concat(i," keyList:").concat(a," protocolName:").concat(d)),this._groupModule.request({protocolName:d,requestData:_}).then((function(e){var o=e.data.mainSequence;return t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:o,groupAttributeList:a,operationType:p}),h.setNetworkType(t._groupModule.getNetworkType()).end(),we.log("".concat(t._className,".deleteGroupAttributes ok. groupID:").concat(n)),as({keyList:l})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];h.setError(e,o,a).end()})),gs(e)}))}},{key:"getGroupAttributes",value:function(e){var t=this,n=e.groupID,o=this._checkCachedGroupAttributes({groupID:n,funcName:"getGroupAttributes"});if(!0!==o)return gs(o);var a=this._groupAttributesMap.get(n),s=a.avChatRoomKey,r=a.lastUpdateTime,i=a.localMainSequence,c=a.remoteMainSequence,u=new Va(Ha.GET_GROUP_ATTRIBUTES);if(u.setMessage("groupID:".concat(n," localMainSequence:").concat(i," remoteMainSequence:").concat(c," keyList:").concat(e.keyList)),Date.now()-r>=this.CACHE_EXPIRE_TIME||i0)o.forEach((function(e){s.has(e)&&(a[e]=s.get(e).value)}));else{var r,i=S(s.keys());try{for(i.s();!(r=i.n()).done;){var c=r.value;a[c]=s.get(c).value}}catch(u){i.e(u)}finally{i.f()}}return a}},{key:"_refreshCachedGroupAttributes",value:function(e){var t=e.groupID,n=e.remoteMainSequence,o=e.groupAttributeList,a=e.operationType;if(this._groupAttributesMap.has(t)){var s=this._groupAttributesMap.get(t),r=s.localMainSequence;if("get"===a||n-r==1)s.remoteMainSequence=n,s.localMainSequence=n,s.lastUpdateTime=Date.now(),this._updateCachedAttributes({groupAttributes:s,groupAttributeList:o,operationType:a});else{if(r===n)return;s.remoteMainSequence=n}this._groupAttributesMap.set(t,s);var i="operationType:".concat(a," localMainSequence:").concat(r," remoteMainSequence:").concat(n);we.log("".concat(this._className,"._refreshCachedGroupAttributes. ").concat(i))}}},{key:"_updateCachedAttributes",value:function(e){var t=e.groupAttributes,n=e.groupAttributeList,o=e.operationType;"clear"!==o?"delete"!==o?("init"===o&&t.attributes.clear(),n.forEach((function(e){var n=e.key,o=e.value,a=e.sequence;t.attributes.set(n,{value:o,sequence:a})}))):n.forEach((function(e){t.attributes.delete(e)})):t.attributes.clear()}},{key:"_checkCachedGroupAttributes",value:function(e){var t=e.groupID,n=e.funcName;if(this._groupModule.hasLocalGroup(t)&&this._groupModule.getLocalGroupProfile(t).type!==C.GRP_AVCHATROOM){return we.warn("".concat(this._className,"._checkCachedGroupAttributes. ").concat("非直播群不能使用群属性 API")),new ls({code:Sa.CANNOT_USE_GRP_ATTR_NOT_AVCHATROOM,message:"非直播群不能使用群属性 API"})}var o=this._groupAttributesMap.get(t);if(et(o)){var a="如果 groupID:".concat(t," 是直播群,使用 ").concat(n," 前先使用 joinGroup 接口申请加入群组,详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#joinGroup");return we.warn("".concat(this._className,"._checkCachedGroupAttributes. ").concat(a)),new ls({code:Sa.CANNOT_USE_GRP_ATTR_AVCHATROOM_UNJOIN,message:a})}return!0}},{key:"_transformGroupAttributes",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_emitGroupAttributesUpdated",value:function(e){var t=this._getLocalGroupAttributes({groupID:e});this._groupModule.emitOuterEvent(D.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t})}},{key:"reset",value:function(){this._groupAttributesMap.clear(),this.CACHE_EXPIRE_TIME=3e4}}]),e}(),Vs=function(){function e(t){o(this,e);var n=t.manager,a=t.groupID,s=t.onInit,r=t.onSuccess,i=t.onFail;this._className="Polling",this._manager=n,this._groupModule=n._groupModule,this._onInit=s,this._onSuccess=r,this._onFail=i,this._groupID=a,this._timeoutID=-1,this._isRunning=!1,this._protocolName=qo}return s(e,[{key:"start",value:function(){var e=this._groupModule.isLoggedIn();e||(this._protocolName=Vo),we.log("".concat(this._className,".start pollingInterval:").concat(this._manager.getPollingInterval()," isLoggedIn:").concat(e)),this._isRunning=!0,this._request()}},{key:"isRunning",value:function(){return this._isRunning}},{key:"_request",value:function(){var e=this,t=this._onInit(this._groupID);this._groupModule.request({protocolName:this._protocolName,requestData:t}).then((function(t){e._onSuccess(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.getPollingInterval()))})).catch((function(t){e._onFail(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.MAX_POLLING_INTERVAL))}))}},{key:"stop",value:function(){we.log("".concat(this._className,".stop")),this._timeoutID>0&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}}]),e}(),Hs={3:!0,4:!0,5:!0,6:!0,17:!0},Ks=function(){function e(t){o(this,e),this._groupModule=t,this._className="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this.sequencesLinkedList=new Ls(200),this.messageIDLinkedList=new Ls(100),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map}return s(e,[{key:"hasJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._joinedGroupMap.has(e)}},{key:"getJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0?M(this._joinedGroupMap.keys()):null}},{key:"_updateRequestData",value:function(e){var n=this._pollingRequestInfoMap.get(e);return e===M(this._pollingInstanceMap.keys())[0]?t(t({},n),{},{startBroadcastSeq:this._startBroadcastSeq}):t({},n)}},{key:"_handleSuccess",value:function(e,t){var n=t.data,o=n.key,a=n.nextSeq,s=n.rspMsgList,r=n.errorCode,i=n.nextBroadcastSeq,c=n.broadcastMessageList;if(0!==r){var u=this._pollingRequestInfoMap.get(e),l=new Va(Ha.LONG_POLLING_AV_ERROR),d=u?"".concat(u.key,"-").concat(u.startSeq):"requestInfo is undefined";l.setMessage("".concat(e,"-").concat(d,"-").concat(t.errorInfo)).setCode(t.errorCode).setNetworkType(this._groupModule.getNetworkType()).end(!0)}else{if(!this.checkJoinedAVChatRoomByID(e))return;Je(o)&&ze(a)&&this._pollingRequestInfoMap.set(e,{key:o,startSeq:a}),ze(i)&&i>this._startBroadcastSeq&&(this._startBroadcastSeq=i),Ze(s)&&s.length>0?(s.forEach((function(e){e.to=e.groupID})),this.onMessage(s)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(c)}}},{key:"_handleFailure",value:function(e,t){}},{key:"onMessage",value:function(e){if(Ze(e)&&0!==e.length){0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL);var t=null,n=[],o=this._getModule(pn),a=this._getModule(Nn),s=e.length;s>1&&e.sort((function(e,t){return e.sequence-t.sequence}));for(var r=this._getModule(_n),i=0;i1&&p<=20?this._getModule(Tn).onMessageMaybeLost(l,d+1,p-1):p<-1&&p>=-20&&this._getModule(Tn).onMessageMaybeLost(l,t.sequence+1,Math.abs(p)-1)}this.sequencesLinkedList.set(t.sequence),this.messageIDLinkedList.set(t.ID);var _=!1;if(this._isMessageSentByCurrentInstance(t)?c&&(_=!0,t.isModified=c,o.updateMessageIsModifiedProperty(t)):_=!0,_){if(t.conversationType===C.CONV_SYSTEM&&5===t.payload.operationType&&this._onGroupDismissed(t.payload.groupProfile.groupID),!u&&t.conversationType!==C.CONV_SYSTEM){var g=t.conversationID.replace(C.CONV_GROUP,"");this._pollingInstanceMap.has(g)?a.addMessageSequence({key:Ua,message:t}):(t.type!==C.MSG_GRP_TIP&&t.clientTime>0&&a.addMessageDelay(t.clientTime),a.addMessageSequence({key:Pa,message:t}))}n.push(t)}}}else we.warn("".concat(this._className,".onMessage 未处理的 event 类型: ").concat(e[i].event));if(0!==n.length){this._groupModule.filterModifiedMessage(n);var h=this.packConversationOption(n);if(h.length>0)this._getModule(pn).onNewMessage({conversationOptionsList:h,isInstantMessage:!0});we.debug("".concat(this._className,".onMessage count:").concat(n.length)),this._checkMessageStacked(n);var f=this._groupModule.filterUnmodifiedMessage(n);f.length>0&&this._groupModule.emitOuterEvent(D.MESSAGE_RECEIVED,f),n.length=0}}}},{key:"_onGroupDismissed",value:function(e){we.log("".concat(this._className,"._onGroupDismissed groupID:").concat(e)),this._groupModule.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"_checkMessageStacked",value:function(e){var t=e.length;t>=100&&(we.warn("".concat(this._className,"._checkMessageStacked 直播群消息堆积数:").concat(e.length,'!可能会导致微信小程序渲染时遇到 "Dom limit exceeded" 的错误,建议接入侧此时只渲染最近的10条消息')),this._reportMessageStackedCount<5&&(new Va(Ha.MESSAGE_STACKED).setNetworkType(this._groupModule.getNetworkType()).setMessage("count:".concat(t," groupID:").concat(M(this._joinedGroupMap.keys()))).setLevel("warning").end(),this._reportMessageStackedCount+=1))}},{key:"_isMessageSentByCurrentInstance",value:function(e){return!!this._getModule(pn).isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(e,t){e.currentUser=this._groupModule.getMyUserID(),e.conversationType=5===t?C.CONV_SYSTEM:C.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var n=new os(e),o=this.packElements(e,t);return n.setElement(o),n}},{key:"packElements",value:function(e,n){return 4===n||6===n?(this._updateMemberCountByGroupTips(e),this._onGroupAttributesUpdated(e),{type:C.MSG_GRP_TIP,content:t(t({},e.elements),{},{groupProfile:e.groupProfile})}):5===n?{type:C.MSG_GRP_SYS_NOTICE,content:t(t({},e.elements),{},{groupProfile:t(t({},e.groupProfile),{},{groupID:e.groupID})})}:this._getModule(mn).parseElements(e.elements,e.from)}},{key:"packConversationOption",value:function(e){for(var t=new Map,n=0;n0&&this._groupModule.emitOuterEvent(D.MESSAGE_RECEIVED,t)}}},{key:"start",value:function(e){if(this._pollingInstanceMap.has(e)){var t=this._pollingInstanceMap.get(e);t.isRunning()||t.start()}else{var n=new Vs({manager:this,groupID:e,onInit:this._updateRequestData.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});n.start(),this._pollingInstanceMap.set(e,n),we.log("".concat(this._className,".start groupID:").concat(e))}}},{key:"handleJoinResult",value:function(e){var t=this;return this._preCheck().then((function(){var n=e.longPollingKey,o=e.group,a=o.groupID;return t._joinedGroupMap.set(a,o),t._groupModule.updateGroupMap([o]),t._groupModule.deleteUnjoinedAVChatRoom(a),t._groupModule.emitGroupListUpdate(!0,!1),et(n)?_s({status:Be,group:o}):Promise.resolve()}))}},{key:"startRunLoop",value:function(e){var t=this;return this.handleJoinResult(e).then((function(){var n=e.longPollingKey,o=e.group,a=e.startSeq,s=void 0===a?0:a,r=o.groupID;return t._pollingRequestInfoMap.set(r,{key:n,startSeq:s}),t.start(r),t._groupModule.isLoggedIn()?_s({status:Be,group:o}):_s({status:Be})}))}},{key:"_preCheck",value:function(){if(this._getModule(_n).isUnlimitedAVChatRoom())return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();var e=m(this._joinedGroupMap.entries().next().value,2),t=e[0],n=e[1];if(this._groupModule.isLoggedIn()){if(!(n.selfInfo.role===C.GRP_MBR_ROLE_OWNER||n.ownerID===this._groupModule.getMyUserID()))return this._groupModule.quitGroup(t);this._groupModule.deleteLocalGroupAndConversation(t)}else this._groupModule.deleteLocalGroupAndConversation(t);return this.reset(t),Promise.resolve()}},{key:"joinWithoutAuth",value:function(e){var t=this,n=e.groupID,o="".concat(this._className,".joinWithoutAuth"),a=new Va(Ha.JOIN_WITHOUT_AUTH);return this._groupModule.request({protocolName:To,requestData:e}).then((function(e){var s=e.data.longPollingKey;if(t._groupModule.probeNetwork().then((function(e){var t=m(e,2),o=(t[0],t[1]);a.setNetworkType(o).setMessage("groupID:".concat(n," longPollingKey:").concat(s)).end(!0)})),et(s))return gs(new ls({code:Sa.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN,message:Da.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN}));we.log("".concat(o," ok. groupID:").concat(n)),t._getModule(pn).setCompleted("".concat(C.CONV_GROUP).concat(n));var r=new Os({groupID:n});return t.startRunLoop({group:r,longPollingKey:s}),as({status:Be})})).catch((function(e){return we.error("".concat(o," failed. groupID:").concat(n," error:"),e),t._groupModule.probeNetwork().then((function(t){var o=m(t,2),s=o[0],r=o[1];a.setError(e,s,r).setMessage("groupID:".concat(n)).end(!0)})),gs(e)})).finally((function(){t._groupModule.getModule(hn).reportAtOnce()}))}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},n=Date.now();return Bt(t)||n-t.lastSyncTime>1e3*t.expireTime&&n-t.latestUpdateTime>1e4&&n-t.lastReqTime>3e3?(t.lastReqTime=n,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then((function(e){return as({memberCount:e.memberCount})})).catch((function(e){return gs(e)}))):_s({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(e){var t=this,n="".concat(this._className,"._getGroupOnlineMemberCount");return this._groupModule.request({protocolName:Ho,requestData:{groupID:e}}).then((function(o){var a=t._onlineMemberCountMap.get(e)||{},s=o.data,r=s.onlineMemberNum,i=void 0===r?0:r,c=s.expireTime,u=void 0===c?t.DEFAULT_EXPIRE_TIME:c;we.log("".concat(n," ok. groupID:").concat(e," memberCount:").concat(i," expireTime:").concat(u));var l=Date.now();return Bt(a)&&(a.lastReqTime=l),t._onlineMemberCountMap.set(e,Object.assign(a,{lastSyncTime:l,latestUpdateTime:l,memberCount:i,expireTime:u})),{memberCount:i}})).catch((function(o){return we.warn("".concat(n," failed. error:"),o),new Va(Ha.GET_GROUP_ONLINE_MEMBER_COUNT).setCode(o.code).setMessage("groupID:".concat(e," error:").concat(JSON.stringify(o))).setNetworkType(t._groupModule.getNetworkType()).end(),Promise.reject(o)}))}},{key:"_onGroupAttributesUpdated",value:function(e){var t=e.groupID,n=e.elements,o=n.operationType,a=n.newGroupProfile;if(6===o){var s=(void 0===a?void 0:a).groupAttributeOption;Bt(s)||this._groupModule.onGroupAttributesUpdated({groupID:t,groupAttributeOption:s})}}},{key:"_getModule",value:function(e){return this._groupModule.getModule(e)}},{key:"setPollingInterval",value:function(e){et(e)||(ze(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:"setPollingIntervalPlus",value:function(e){et(e)||(ze(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:"setPollingNoMessageCount",value:function(e){et(e)||(ze(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:"getPollingInterval",value:function(){return this._pollingInterval}},{key:"reset",value:function(e){if(e){we.log("".concat(this._className,".reset groupID:").concat(e));var t=this._pollingInstanceMap.get(e);t&&t.stop(),this._pollingInstanceMap.delete(e),this._joinedGroupMap.delete(e),this._pollingRequestInfoMap.delete(e),this._onlineMemberCountMap.delete(e)}else{we.log("".concat(this._className,".reset all"));var n,o=S(this._pollingInstanceMap.values());try{for(o.s();!(n=o.n()).done;){n.value.stop()}}catch(a){o.e(a)}finally{o.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this.sequencesLinkedList.reset(),this.messageIDLinkedList.reset(),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0}}]),e}(),Bs=1,xs=15,Ws=function(){function e(t){o(this,e),this._groupModule=t,this._className="GroupSystemNoticeHandler",this.pendencyMap=new Map}return s(e,[{key:"onNewGroupSystemNotice",value:function(e){var t=e.dataList,n=e.isSyncingEnded,o=e.isInstantMessage;we.debug("".concat(this._className,".onReceiveSystemNotice count:").concat(t.length));var a=this.newSystemNoticeStoredAndSummary({notifiesList:t,isInstantMessage:o}),s=a.eventDataList,r=a.result;s.length>0&&(this._groupModule.getModule(pn).onNewMessage({conversationOptionsList:s,isInstantMessage:o}),this._onReceivedGroupSystemNotice({result:r,isInstantMessage:o}));o?r.length>0&&this._groupModule.emitOuterEvent(D.MESSAGE_RECEIVED,r):!0===n&&this._clearGroupSystemNotice()}},{key:"newSystemNoticeStoredAndSummary",value:function(e){var n=e.notifiesList,o=e.isInstantMessage,a=null,s=n.length,r=0,i=[],c={conversationID:C.CONV_SYSTEM,unreadCount:0,type:C.CONV_SYSTEM,subType:null,lastMessage:null};for(r=0;r0?[c]:[],result:i}}},{key:"_clearGroupSystemNotice",value:function(){var e=this;this.getPendencyList().then((function(t){t.forEach((function(t){e.pendencyMap.set("".concat(t.from,"_").concat(t.groupID,"_").concat(t.to),t)}));var n=e._groupModule.getModule(pn).getLocalMessageList(C.CONV_SYSTEM),o=[];n.forEach((function(t){var n=t.payload,a=n.operatorID,s=n.operationType,r=n.groupProfile;if(s===Bs){var i="".concat(a,"_").concat(r.groupID,"_").concat(r.to),c=e.pendencyMap.get(i);c&&ze(c.handled)&&0!==c.handled&&o.push(t)}})),e.deleteGroupSystemNotice({messageList:o})}))}},{key:"deleteGroupSystemNotice",value:function(e){var t=this,n="".concat(this._className,".deleteGroupSystemNotice");return Ze(e.messageList)&&0!==e.messageList.length?(we.log("".concat(n," ")+e.messageList.map((function(e){return e.ID}))),this._groupModule.request({protocolName:Fo,requestData:{messageListToDelete:e.messageList.map((function(e){return{from:C.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){we.log("".concat(n," ok"));var o=t._groupModule.getModule(pn);return e.messageList.forEach((function(e){o.deleteLocalMessage(e)})),as()})).catch((function(e){return we.error("".concat(n," error:"),e),gs(e)}))):_s()}},{key:"getPendencyList",value:function(e){var t=this;return this._groupModule.request({protocolName:bo,requestData:{startTime:e&&e.startTime?e.startTime:0,limit:e&&e.limit?e.limit:10,handleAccount:this._groupModule.getMyUserID()}}).then((function(e){var n=e.data.pendencyList;return 0!==e.data.nextStartTime?t.getPendencyList({startTime:e.data.nextStartTime}).then((function(e){return[].concat(M(n),M(e))})):n}))}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,n=e.result;e.isInstantMessage&&n.forEach((function(e){switch(e.payload.operationType){case 1:break;case 2:t._onApplyGroupRequestAgreed(e);break;case 3:break;case 4:t._onMemberKicked(e);break;case 5:t._onGroupDismissed(e);break;case 6:break;case 7:t._onInviteGroup(e);break;case 8:t._onQuitGroup(e);break;case 9:t._onSetManager(e);break;case 10:t._onDeleteManager(e);break;case 11:case 12:case 15:break;case 20:t._onMessageRemindTypeSynced(e)}}))}},{key:"_onApplyGroupRequestAgreed",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;if(n){t._groupModule.updateGroupMap([n]);var o=!n.isSupportTopic;t._groupModule.emitGroupListUpdate(!0,o)}}))}},{key:"_onMemberKicked",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onGroupDismissed",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t);var n=this._groupModule._AVChatRoomHandler;n&&n.checkJoinedAVChatRoomByID(t)&&n.reset(t)}},{key:"_onInviteGroup",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;n&&(t._groupModule.updateGroupMap([n]),t._groupModule.emitGroupListUpdate())}))}},{key:"_onQuitGroup",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onSetManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,a=this._groupModule.getModule(ln).getLocalGroupMemberInfo(o,n);a&&a.updateRole(C.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,a=this._groupModule.getModule(ln).getLocalGroupMemberInfo(o,n);a&&a.updateRole(C.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.messageRemindType;this._groupModule.getModule(pn).onGroupMessageRemindTypeSynced({groupID:t,messageRemindType:n})}},{key:"_handleTopicSystemNotice",value:function(e){var t=e.groupProfile,n=t.groupID,o=t.topicID,a=e.elements,s=a.operationType,r=a.topicIDList,i=a.messageRemindType,c=this._groupModule.getModule(dn);17===s?c.onTopicCreated({groupID:n,topicID:o}):18===s?c.onTopicDeleted({groupID:n,topicIDList:r}):20===s&&c.onTopicMessageRemindTypeUpdated({groupID:n,topicID:o,messageRemindType:i})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),e}(),Ys=["relayFlag"],js=function(e){i(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._className="GroupModule",t._commonGroupHandler=null,t._AVChatRoomHandler=null,t._groupSystemNoticeHandler=null,t._commonGroupHandler=new bs(g(t)),t._groupAttributesHandler=new qs(g(t)),t._AVChatRoomHandler=new Ks(g(t)),t._groupTipsHandler=new ws(g(t)),t._groupSystemNoticeHandler=new Ws(g(t)),t.groupMap=new Map,t._unjoinedAVChatRoomList=new Map,t._receiptDetailCompleteMap=new Map,t.getInnerEmitterInstance().on(Ms,t._onCloudConfigUpdated,g(t)),t}return s(a,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("polling_interval"),t=this.getCloudConfig("polling_interval_plus"),n=this.getCloudConfig("polling_no_msg_count");this._AVChatRoomHandler&&(we.log("".concat(this._className,"._onCloudConfigUpdated pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(t," pollingNoMessageCount:").concat(n)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(n))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:"guardForAVChatRoom",value:function(e){var t=this;if(e.conversationType===C.CONV_GROUP){var n=St(e.to)?qt(e.to):e.to;return this.hasLocalGroup(n)?_s():this.getGroupProfile({groupID:n}).then((function(o){var a=o.data.group.type;if(we.log("".concat(t._className,".guardForAVChatRoom. groupID:").concat(n," type:").concat(a)),a===C.GRP_AVCHATROOM){var s="userId:".concat(e.from," 未加入群 groupID:").concat(n,"。发消息前先使用 joinGroup 接口申请加群,详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#joinGroup");return we.warn("".concat(t._className,".guardForAVChatRoom sendMessage not allowed. ").concat(s)),gs(new ls({code:Sa.MESSAGE_SEND_FAIL,message:s,data:{message:e}}))}return _s()}))}return _s()}},{key:"checkJoinedAVChatRoomByID",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"onNewGroupMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onNewGroupMessage(e)}},{key:"updateNextMessageSeq",value:function(e){var t=this;if(Ze(e)){var n=this.getModule(dn);e.forEach((function(e){var o=e.conversationID.replace(C.CONV_GROUP,"");if(St(o)){var a=o,s=e.lastMessage.sequence+1;o=qt(a);var r=n.getLocalTopic(o,a);r&&(r.updateNextMessageSeq(s),r.updateLastMessage(e.lastMessage))}t.groupMap.has(o)&&(t.groupMap.get(o).nextMessageSeq=e.lastMessage.sequence+1)}))}}},{key:"onNewGroupTips",value:function(e){this._groupTipsHandler&&this._groupTipsHandler.onNewGroupTips(e)}},{key:"onGroupMessageRevoked",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onGroupMessageRevoked(e)}},{key:"onNewGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:"onGroupMessageReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){var n=e.elements.groupMessageReadNotice;if(!et(n)){var o=t.getModule(pn);n.forEach((function(e){var n=e.groupID,a=e.topicID,s=void 0===a?void 0:a,r=e.lastMessageSeq;we.debug("".concat(t._className,".onGroupMessageReadNotice groupID:").concat(n," lastMessageSeq:").concat(r));var i="".concat(C.CONV_GROUP).concat(n),c=!0;Bt(s)||(i="".concat(C.CONV_GROUP).concat(s),c=!1),o.updateIsReadAfterReadReport({conversationID:i,lastMessageSeq:r}),o.updateUnreadCount(i,c),o.clearGroupAtInfoList(i,c)}))}}))}},{key:"onReadReceiptList",value:function(e){var t=this;we.debug("".concat(this._className,".onReadReceiptList options:"),JSON.stringify(e)),e.dataList.forEach((function(e){var n=e.groupProfile,o=e.elements,a=n.groupID,s=t.getModule(pn),r=o.readReceiptList;s.updateReadReceiptInfo({groupID:a,readReceiptList:r})}))}},{key:"onGroupMessageModified",value:function(e){we.debug("".concat(this._className,".onGroupMessageModified options:"),JSON.stringify(e));var n=this.getModule(pn);e.dataList.forEach((function(e){n.onMessageModified(t(t({},e),{},{conversationType:C.CONV_GROUP,to:e.topicID?e.topicID:e.groupID}))}))}},{key:"deleteGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:"initGroupMap",value:function(e){this.groupMap.set(e.groupID,new Os(e))}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var t,n=this,o=this.getModule(pn);e.forEach((function(e){t=e.groupID,n.groupMap.has(t)?n.groupMap.get(t).updateGroup(e):(n.groupMap.set(t,new Os(e)),o.deleteGroupRomaingMessageInfo(t))}));var a,s=this.getMyUserID(),r=S(this.groupMap);try{for(r.s();!(a=r.n()).done;){m(a.value,2)[1].selfInfo.userID=s}}catch(i){r.e(i)}finally{r.f()}this._setStorageGroupList()}},{key:"getStorageGroupList",value:function(){return this.getModule(gn).getItem("groupMap")}},{key:"_setStorageGroupList",value:function(){var e=this.getLocalGroupList().filter((function(e){var t=e.type;return!Et(t)})).filter((function(e){return!e.isSupportTopic})).slice(0,20).map((function(e){return{groupID:e.groupID,name:e.name,avatar:e.avatar,type:e.type}}));this.getModule(gn).setItem("groupMap",e)}},{key:"getGroupMap",value:function(){return this.groupMap}},{key:"getLocalGroupList",value:function(){return M(this.groupMap.values())}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"sortLocalGroupList",value:function(){var e=M(this.groupMap).filter((function(e){var t=m(e,2);t[0];return!Bt(t[1].lastMessage)}));e.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})),this.groupMap=new Map(M(e))}},{key:"updateGroupLastMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.handleUpdateGroupLastMessage(e)}},{key:"emitGroupListUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalGroupList();if(e&&this.emitOuterEvent(D.GROUP_LIST_UPDATED),t){var o=JSON.parse(JSON.stringify(n)),a=this.getModule(pn);a.updateConversationGroupProfile(o)}}},{key:"patchGroupMessageRemindType",value:function(){var e=this.getLocalGroupList(),t=this.getModule(pn),n=0;e.forEach((function(e){!0===t.patchMessageRemindType({ID:e.groupID,isC2CConversation:!1,messageRemindType:e.selfInfo.messageRemindType})&&(n+=1)})),we.log("".concat(this._className,".patchGroupMessageRemindType count:").concat(n))}},{key:"recomputeUnreadCount",value:function(){var e=this.getLocalGroupList(),t=this.getModule(pn);e.forEach((function(e){var n=e.groupID,o=e.selfInfo,a=o.excludedUnreadSequenceList,s=o.readedSequence;if(Ze(a)){var r=0;a.forEach((function(t){t>=s&&t<=e.nextMessageSeq-1&&(r+=1)})),r>=1&&t.recomputeGroupUnreadCount({conversationID:"".concat(C.CONV_GROUP).concat(n),count:r})}}))}},{key:"getMyNameCardByGroupID",value:function(e){var t=this.getLocalGroupProfile(e);return t?t.selfInfo.nameCard:""}},{key:"isPagingGetCompleted",value:function(){return!!this._commonGroupHandler&&this._commonGroupHandler.isPagingGetCompleted()}},{key:"getGroupList",value:function(e){return this._commonGroupHandler?this._commonGroupHandler.getGroupList(e):_s()}},{key:"getGroupProfile",value:function(e){var t=this,n=new Va(Ha.GET_GROUP_PROFILE),o="".concat(this._className,".getGroupProfile"),a=e.groupID,s=e.groupCustomFieldFilter;we.log("".concat(o," groupID:").concat(a));var r={groupIDList:[a],responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember"],groupCustomFieldFilter:s,memberInfoFilter:["Role","JoinTime","MsgSeq","MsgFlag","NameCard"]}};return this.getGroupProfileAdvance(r).then((function(e){var s,r=e.data,i=r.successGroupList,c=r.failureGroupList;if(we.log("".concat(o," ok")),c.length>0)return gs(c[0]);(Et(i[0].type)&&!t.hasLocalGroup(a)?s=new Os(i[0]):(t.updateGroupMap(i),s=t.getLocalGroupProfile(a)),s.isSupportTopic)||t.getModule(pn).updateConversationGroupProfile([s]);return n.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(a," type:").concat(s.type," muteAllMembers:").concat(s.muteAllMembers," ownerID:").concat(s.ownerID)).end(),as({group:s})})).catch((function(a){return t.probeNetwork().then((function(t){var o=m(t,2),s=o[0],r=o[1];n.setError(a,s,r).setMessage("groupID:".concat(e.groupID)).end()})),we.error("".concat(o," failed. error:"),a),gs(a)}))}},{key:"getGroupProfileAdvance",value:function(e){var n=this,o="".concat(this._className,".getGroupProfileAdvance"),a=e.groupIDList;Ze(a)&&a.length>50&&(we.warn("".concat(o," 获取群资料的数量不能超过50个")),a.length=50);var s=[],r=[];a.forEach((function(e){Tt({groupID:e})?r.push(e):s.push(e)}));var i=[];if(s.length>0){var c=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:s}));i.push(c)}if(r.length>0){var u=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:r,relayFlag:s.length>0}));i.push(u)}return Promise.all(i).then((function(e){var t=[],n=[];return e.forEach((function(e){t.push.apply(t,M(e.successGroupList)),n.push.apply(n,M(e.failureGroupList))})),as({successGroupList:t,failureGroupList:n})})).catch((function(e){return we.error("".concat(n._className,"._getGroupProfileAdvance failed. error:"),e),gs(e)}))}},{key:"_getGroupProfileAdvance",value:function(e){var t=this,n=e.relayFlag,o=void 0!==n&&n,a=_(e,Ys);return this.request({protocolName:Mo,requestData:a}).then((function(e){we.log("".concat(t._className,"._getGroupProfileAdvance ok."));var n=e.data.groups;return{successGroupList:n.filter((function(e){return et(e.errorCode)||0===e.errorCode})),failureGroupList:n.filter((function(e){return e.errorCode&&0!==e.errorCode})).map((function(e){return new ls({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}))}})).catch((function(t){return o&&Tt({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:gs(t)}))}},{key:"createGroup",value:function(e){var n=this,o="".concat(this._className,".createGroup"),a=e.type,s=e.groupID;if(!["Public","Private","ChatRoom","AVChatRoom","Community"].includes(a))return gs({code:Sa.ILLEGAL_GROUP_TYPE,message:Da.ILLEGAL_GROUP_TYPE});if(!Tt({type:a})){if(!Bt(s)&&Tt({groupID:s}))return gs({code:Sa.ILLEGAL_GROUP_ID,message:Da.ILLEGAL_GROUP_ID});e.isSupportTopic=void 0}if(Et(a)&&!et(e.memberList)&&e.memberList.length>0&&(we.warn("".concat(o," 创建 AVChatRoom 时不能添加群成员,自动忽略该字段")),e.memberList=void 0),yt(a)||et(e.joinOption)||(we.warn("".concat(o," 创建 Work/Meeting/AVChatRoom/Community 群时不能设置字段 joinOption,自动忽略该字段")),e.joinOption=void 0),Tt({type:a})){if(!Bt(s)&&!Tt({groupID:s}))return gs({code:Sa.ILLEGAL_GROUP_ID,message:Da.ILLEGAL_GROUP_ID});e.isSupportTopic=!0===e.isSupportTopic?1:0}var r=new Va(Ha.CREATE_GROUP);we.log("".concat(o," options:"),e);var i=[];return this.request({protocolName:vo,requestData:t(t({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then((function(a){var s=a.data,c=s.groupID,u=s.overLimitUserIDList,l=void 0===u?[]:u;if(i=l,r.setNetworkType(n.getNetworkType()).setMessage("groupType:".concat(e.type," groupID:").concat(c," overLimitUserIDList=").concat(l)).end(),we.log("".concat(o," ok groupID:").concat(c," overLimitUserIDList:"),l),e.type===C.GRP_AVCHATROOM)return n.getGroupProfile({groupID:c});if(e.type===C.GRP_COMMUNITY&&1===e.isSupportTopic)return n.getGroupProfile({groupID:c});Bt(e.memberList)||Bt(l)||(e.memberList=e.memberList.filter((function(e){return-1===l.indexOf(e.userID)}))),n.updateGroupMap([t(t({},e),{},{groupID:c})]);var d=n.getModule(an),p=d.createCustomMessage({to:c,conversationType:C.CONV_GROUP,payload:{data:"group_create",extension:"".concat(n.getMyUserID(),"创建群组")}});return d.sendMessageInstance(p),n.emitGroupListUpdate(),n.getGroupProfile({groupID:c})})).then((function(e){var t=e.data.group,n=t.selfInfo,o=n.nameCard,a=n.joinTime;return t.updateSelfInfo({nameCard:o,joinTime:a,messageRemindType:C.MSG_REMIND_ACPT_AND_NOTE,role:C.GRP_MBR_ROLE_OWNER}),as({group:t,overLimitUserIDList:i})})).catch((function(t){return r.setMessage("groupType:".concat(e.type)),n.probeNetwork().then((function(e){var n=m(e,2),o=n[0],a=n[1];r.setError(t,o,a).end()})),we.error("".concat(o," failed. error:"),t),gs(t)}))}},{key:"dismissGroup",value:function(e){var t=this,n="".concat(this._className,".dismissGroup");if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===C.GRP_WORK)return gs(new ls({code:Sa.CANNOT_DISMISS_WORK,message:Da.CANNOT_DISMISS_WORK}));var o=new Va(Ha.DISMISS_GROUP);return o.setMessage("groupID:".concat(e)),we.log("".concat(n," groupID:").concat(e)),this.request({protocolName:Io,requestData:{groupID:e}}).then((function(){return o.setNetworkType(t.getNetworkType()).end(),we.log("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),as({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"updateGroupProfile",value:function(e){var t=this,n="".concat(this._className,".updateGroupProfile");!this.hasLocalGroup(e.groupID)||yt(this.getLocalGroupProfile(e.groupID).type)||et(e.joinOption)||(we.warn("".concat(n," Work/Meeting/AVChatRoom/Community 群不能设置字段 joinOption,自动忽略该字段")),e.joinOption=void 0),et(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off");var o=new Va(Ha.UPDATE_GROUP_PROFILE);return o.setMessage(JSON.stringify(e)),we.log("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:yo,requestData:e}).then((function(){(o.setNetworkType(t.getNetworkType()).end(),we.log("".concat(n," ok")),t.hasLocalGroup(e.groupID))&&(t.groupMap.get(e.groupID).updateGroup(e),t._setStorageGroupList());return as({group:t.groupMap.get(e.groupID)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),we.log("".concat(n," failed. error:"),e),gs(e)}))}},{key:"joinGroup",value:function(e){var t=this,n=e.groupID,o=e.type,a="".concat(this._className,".joinGroup");if(o===C.GRP_WORK){var s=new ls({code:Sa.CANNOT_JOIN_WORK,message:Da.CANNOT_JOIN_WORK});return gs(s)}if(this.deleteUnjoinedAVChatRoom(n),this.hasLocalGroup(n)){if(!this.isLoggedIn())return _s({status:C.JOIN_STATUS_ALREADY_IN_GROUP});var r=new Va(Ha.APPLY_JOIN_GROUP);return this.getGroupProfile({groupID:n}).then((function(){return r.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," joinedStatus:").concat(C.JOIN_STATUS_ALREADY_IN_GROUP)).end(),_s({status:C.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(o){return r.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," unjoined")).end(),we.warn("".concat(a," ").concat(n," was unjoined, now join!")),t.groupMap.delete(n),t.applyJoinGroup(e)}))}return we.log("".concat(a," groupID:").concat(n)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e)}},{key:"applyJoinGroup",value:function(e){var n=this,o="".concat(this._className,".applyJoinGroup"),a=e.groupID,s=new Va(Ha.APPLY_JOIN_GROUP),r=t({},e),i=this.getModule(An).canIUse(B.AVCHATROOM_HISTORY_MSG);return i&&(r.historyMessageFlag=1),this.getModule(pn).deleteTopicRoamingMessageInfo(a),this.request({protocolName:Eo,requestData:r}).then((function(e){var t=e.data,r=t.joinedStatus,c=t.longPollingKey,u=t.startSeq,l=t.avChatRoomFlag,d=t.avChatRoomKey,p=t.messageList,_="groupID:".concat(a," joinedStatus:").concat(r," longPollingKey:").concat(c," startSeq:").concat(u)+" avChatRoomFlag:".concat(l," canGetAVChatRoomHistoryMessage:").concat(i,",")+" history message count:".concat(Bt(p)?0:p.length);switch(s.setNetworkType(n.getNetworkType()).setMessage("".concat(_)).end(),we.log("".concat(o," ok. ").concat(_)),r){case xe:return as({status:xe});case Be:return n.getGroupProfile({groupID:a}).then((function(e){var t,o=e.data.group,s={status:Be,group:o};return 1===l?(n.getModule(pn).setCompleted("".concat(C.CONV_GROUP).concat(a)),n._groupAttributesHandler.initGroupAttributesCache({groupID:a,avChatRoomKey:d}),(t=et(c)?n._AVChatRoomHandler.handleJoinResult({group:o}):n._AVChatRoomHandler.startRunLoop({longPollingKey:c,group:o,startSeq:u})).then((function(){n._onAVChatRoomHistoryMessage(p)})),t):(n.emitGroupListUpdate(!0,!1),as(s))}));default:var g=new ls({code:Sa.JOIN_GROUP_FAIL,message:Da.JOIN_GROUP_FAIL});return we.error("".concat(o," error:"),g),gs(g)}})).catch((function(t){return s.setMessage("groupID:".concat(e.groupID)),n.probeNetwork().then((function(e){var n=m(e,2),o=n[0],a=n[1];s.setError(t,o,a).end()})),we.error("".concat(o," error:"),t),gs(t)}))}},{key:"quitGroup",value:function(e){var t=this,n="".concat(this._className,".quitGroup");we.log("".concat(n," groupID:").concat(e));var o=this.checkJoinedAVChatRoomByID(e);if(!o&&!this.hasLocalGroup(e)){var a=new ls({code:Sa.MEMBER_NOT_IN_GROUP,message:Da.MEMBER_NOT_IN_GROUP});return gs(a)}if(o&&!this.isLoggedIn())return we.log("".concat(n," anonymously ok. groupID:").concat(e)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),_s({groupID:e});var s=new Va(Ha.QUIT_GROUP);return s.setMessage("groupID:".concat(e)),this.request({protocolName:So,requestData:{groupID:e}}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),we.log("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),o&&t._AVChatRoomHandler.reset(e),as({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"searchGroupByID",value:function(e){var t=this,n="".concat(this._className,".searchGroupByID"),o={groupIDList:[e]},a=new Va(Ha.SEARCH_GROUP_BY_ID);return a.setMessage("groupID:".concat(e)),we.log("".concat(n," groupID:").concat(e)),this.request({protocolName:Do,requestData:o}).then((function(e){var o=e.data.groupProfile;if(0!==o[0].errorCode)throw new ls({code:o[0].errorCode,message:o[0].errorInfo});return a.setNetworkType(t.getNetworkType()).end(),we.log("".concat(n," ok")),as({group:new Os(o[0])})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"changeGroupOwner",value:function(e){var t=this,n="".concat(this._className,".changeGroupOwner");if(this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===C.GRP_AVCHATROOM)return gs(new ls({code:Sa.CANNOT_CHANGE_OWNER_IN_AVCHATROOM,message:Da.CANNOT_CHANGE_OWNER_IN_AVCHATROOM}));if(e.newOwnerID===this.getMyUserID())return gs(new ls({code:Sa.CANNOT_CHANGE_OWNER_TO_SELF,message:Da.CANNOT_CHANGE_OWNER_TO_SELF}));var o=new Va(Ha.CHANGE_GROUP_OWNER);return o.setMessage("groupID:".concat(e.groupID," newOwnerID:").concat(e.newOwnerID)),we.log("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:Co,requestData:e}).then((function(){o.setNetworkType(t.getNetworkType()).end(),we.log("".concat(n," ok"));var a=e.groupID,s=e.newOwnerID;t.groupMap.get(a).ownerID=s;var r=t.getModule(ln).getLocalGroupMemberList(a);if(r instanceof Map){var i=r.get(t.getMyUserID());et(i)||(i.updateRole("Member"),t.groupMap.get(a).selfInfo.role="Member");var c=r.get(s);et(c)||c.updateRole("Owner")}return t.emitGroupListUpdate(!0,!1),as({group:t.groupMap.get(a)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"handleGroupApplication",value:function(e){var n=this,o="".concat(this._className,".handleGroupApplication"),a=e.message.payload,s=a.groupProfile.groupID,r=a.authentication,i=a.messageKey,c=a.operatorID,u=new Va(Ha.HANDLE_GROUP_APPLICATION);return u.setMessage("groupID:".concat(s)),we.log("".concat(o," groupID:").concat(s)),this.request({protocolName:No,requestData:t(t({},e),{},{applicant:c,groupID:s,authentication:r,messageKey:i})}).then((function(){return u.setNetworkType(n.getNetworkType()).end(),we.log("".concat(o," ok")),n._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),as({group:n.getLocalGroupProfile(s)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),we.error("".concat(o," failed. error"),e),gs(e)}))}},{key:"handleGroupInvitation",value:function(e){var n=this,o="".concat(this._className,".handleGroupInvitation"),a=e.message.payload,s=a.groupProfile.groupID,r=a.authentication,i=a.messageKey,c=a.operatorID,u=e.handleAction,l=new Va(Ha.HANDLE_GROUP_INVITATION);return l.setMessage("groupID:".concat(s," inviter:").concat(c," handleAction:").concat(u)),we.log("".concat(o," groupID:").concat(s," inviter:").concat(c," handleAction:").concat(u)),this.request({protocolName:Ao,requestData:t(t({},e),{},{inviter:c,groupID:s,authentication:r,messageKey:i})}).then((function(){return l.setNetworkType(n.getNetworkType()).end(),we.log("".concat(o," ok")),n._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),as({group:n.getLocalGroupProfile(s)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];l.setError(e,o,a).end()})),we.error("".concat(o," failed. error"),e),gs(e)}))}},{key:"getGroupOnlineMemberCount",value:function(e){return this._AVChatRoomHandler?this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)?this._AVChatRoomHandler.getGroupOnlineMemberCount(e):_s({memberCount:0}):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var t=this.checkJoinedAVChatRoomByID(e);(we.log("".concat(this._className,".deleteLocalGroupAndConversation isJoinedAVChatRoom:").concat(t)),t)&&this.getModule(pn).deleteLocalConversation("".concat(C.CONV_GROUP).concat(e));if(Tt({groupID:e})){var n=this.getLocalGroupProfile(e);if(n&&!0===n.isSupportTopic)this.getModule(dn).deleteTopicListInCommunity(e)}this._deleteLocalGroup(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this.getModule(ln).deleteGroupMemberList(e),this._setStorageGroupList()}},{key:"sendMessage",value:function(e,t){var n=this.createGroupMessagePack(e,t);return this.request(n)}},{key:"createGroupMessagePack",value:function(e,t){var n=null;t&&t.offlinePushInfo&&(n=t.offlinePushInfo);var o="";Je(e.cloudCustomData)&&e.cloudCustomData.length>0&&(o=e.cloudCustomData);var a=[];if(Qe(t)&&Qe(t.messageControlInfo)){var s=t.messageControlInfo,r=s.excludedFromUnreadCount,i=s.excludedFromLastMessage;!0===r&&a.push("NoUnread"),!0===i&&a.push("NoLastMsg")}var c=e.getGroupAtInfoList(),u={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:e.getElements(),cloudCustomData:o,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==C.MSG_TEXT||Bt(c)?void 0:c,onlineOnlyFlag:this.isOnlineMessage(e,t)?1:0,clientTime:e.clientTime,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:a,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1};return St(e.to)&&(u.groupID=qt(e.to),u.topicID=e.to),{protocolName:bn,tjgID:this.generateTjgID(e),requestData:u}}},{key:"revokeMessage",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return St(e.to)&&(t.groupID=qt(e.to),t.topicID=e.to),this.request({protocolName:Lo,requestData:t})}},{key:"deleteMessage",value:function(e){var t=e.to,n=e.keyList;we.log("".concat(this._className,".deleteMessage groupID:").concat(t," count:").concat(n.length));var o={groupID:t,deleter:this.getMyUserID(),keyList:n};return St(t)&&(o.groupID=qt(t),o.topicID=t),this.request({protocolName:Ko,requestData:o})}},{key:"modifyRemoteMessage",value:function(e){var t=e.to,n=e.sequence,o=e.payload,a=e.type,s=e.version,r=void 0===s?0:s,i=e.cloudCustomData,c=t,u=void 0;St(t)&&(c=qt(t),u=t);var l=void 0;return Ht(a)&&(l=[]).push({type:a,content:o}),this.request({protocolName:Bo,requestData:{groupID:c,topicID:u,sequence:n,version:r,elements:l,cloudCustomData:i}})}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._className,".getRoamingMessage"),o=e.conversationID,a=e.groupID,s=e.sequence,r=new Va(Ha.GET_GROUP_ROAMING_MESSAGES),i=0,c=void 0;return St(a)&&(a=qt(c=a)),this._computeLastSequence({groupID:a,topicID:c,sequence:s}).then((function(e){return i=e,we.log("".concat(n," groupID:").concat(a," startSequence:").concat(i)),t.request({protocolName:ko,requestData:{groupID:a,count:21,sequence:i,topicID:c}})})).then((function(e){var s=e.data,u=s.messageList,l=s.complete;et(u)?we.log("".concat(n," ok. complete:").concat(l," but messageList is undefined!")):we.log("".concat(n," ok. complete:").concat(l," count:").concat(u.length)),r.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(a," topicID:").concat(c," startSequence:").concat(i," complete:").concat(l," count:").concat(u?u.length:"undefined")).end();var d=t.getModule(pn);if(2===l||Bt(u))return d.setCompleted(o),{nextReqID:"",storedMessageList:[]};var p=u[u.length-1].sequence-1;d.updateRoamingMessageSequence(o,p);var _=d.onRoamingMessage(u,o);return d.updateIsRead(o),d.patchConversationLastMessage(o),we.log("".concat(n," nextReqID:").concat(p," stored message count:").concat(_.length)),{nextReqID:p+"",storedMessageList:_}})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).setMessage("groupID:".concat(a," topicID:").concat(c," startSequence:").concat(i)).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(C.CONV_GROUP,"")}},{key:"getReadReceiptList",value:function(e){var t=this,n="".concat(this._className,".getReadReceiptList"),o=this._getGroupIDOfMessage(e[0]),a=this.getMyUserID(),s=e.filter((function(e){return e.from===a&&!0===e.needReadReceipt})).map((function(e){return{sequence:e.sequence}}));if(we.log("".concat(n," groupID:").concat(o," sequenceList:").concat(JSON.stringify(s))),0===s.length)return _s({messageList:e});var r=new Va(Ha.GET_READ_RECEIPT);return r.setMessage("groupID:".concat(o)),this.request({protocolName:Go,requestData:{groupID:o,sequenceList:s}}).then((function(t){r.end(),we.log("".concat(n," ok"));var o=t.data.readReceiptList;return Ze(o)&&o.forEach((function(t){e.forEach((function(e){0===t.code&&t.sequence===e.sequence&&(e.readReceiptInfo.readCount=t.readCount,e.readReceiptInfo.unreadCount=t.unreadCount)}))})),as({messageList:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,n=this._getGroupIDOfMessage(e[0]),o=new Va(Ha.SEND_READ_RECEIPT);o.setMessage("groupID:".concat(n));var a=this.getMyUserID(),s=e.filter((function(e){return e.from!==a&&!0===e.needReadReceipt})).map((function(e){return{sequence:e.sequence}}));if(0===s.length)return gs({code:Sa.READ_RECEIPT_MESSAGE_LIST_EMPTY,message:Da.READ_RECEIPT_MESSAGE_LIST_EMPTY});var r="".concat(this._className,".sendReadReceipt");return we.log("".concat(r,". sequenceList:").concat(JSON.stringify(s))),this.request({protocolName:Po,requestData:{groupID:n,sequenceList:s}}).then((function(e){return o.end(),we.log("".concat(r," ok")),as()})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),we.warn("".concat(r," failed. error:"),e),gs(e)}))}},{key:"getReadReceiptDetail",value:function(e){var t=this,n=e.message,o=e.filter,a=e.cursor,s=e.count,r=this._getGroupIDOfMessage(n),i=n.ID,c=n.sequence,u="".concat(this._className,".getReadReceiptDetail"),l=this._receiptDetailCompleteMap.get(i)||!1,d=0!==o&&1!==o?0:o,p=Je(a)?a:"",_=!ze(s)||s<=0||s>=100?100:s,g="groupID:".concat(r," sequence:").concat(c," cursor:").concat(p," filter:").concat(d," completeFlag:").concat(l);we.log("".concat(u," ").concat(g));var h={cursor:"",isCompleted:!1,messageID:i,unreadUserIDList:[],readUserIDList:[]},f=new Va(Ha.GET_READ_RECEIPT_DETAIL);return f.setMessage(g),this.request({protocolName:wo,requestData:{groupID:r,sequence:c,flag:d,cursor:p,count:_}}).then((function(e){f.end();var n=e.data,o=n.cursor,a=n.isCompleted,s=n.unreadUserIDList,r=n.readUserIDList;return h.cursor=o,1===a&&(h.isCompleted=!0,t._receiptDetailCompleteMap.set(i,!0)),0===d?h.readUserIDList=r.map((function(e){return e.userID})):1===d&&(h.unreadUserIDList=s.map((function(e){return e.userID}))),we.log("".concat(u," ok")),as(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];f.setError(e,o,a).end()})),we.warn("".concat(u," failed. error:"),e),gs(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._className,".getRoamingMessagesHopping"),o=new Va(Ha.GET_GROUP_ROAMING_MESSAGES_HOPPING),a=e.groupID,s=e.count,r=e.sequence,i=e.direction,c=r;1===i&&(c=r+s-1);var u=void 0;St(a)&&(a=qt(u=a));var l="".concat(u?"topicID:".concat(u):"groupID:".concat(a)," sequence:").concat(r," direction:").concat(i);return we.log("".concat(n," ").concat(l)),this.request({protocolName:ko,requestData:{groupID:a,topicID:u,count:s,sequence:c}}).then((function(a){var s=a.data,c=s.messageList,d=s.complete;if(we.log("".concat(n," ok. complete:").concat(d," count:").concat(c?c.length:0)),o.setNetworkType(t.getNetworkType()).setMessage("".concat(l," complete:").concat(d," count:").concat(c?c.length:0)).end(),2===d||Bt(c)){var p=t._computeResult();return as(p)}var _="".concat(C.CONV_GROUP).concat(e.groupID),g=t.getModule(pn).onRoamingMessage(c,_,!1),h=t._computeResult({direction:i,sequence:r,topicID:u,messageList:c,resultList:g});return as(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),i=n[0],c=n[1];o.setError(e,i,c).setMessage("groupID:".concat(a," sequence:").concat(r," count:").concat(s)).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"_computeResult",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:""};if(et(e))return t.isCompleted=!0,t;var n=e.direction,o=e.sequence,a=e.topicID,s=e.messageList,r=void 0===s?[]:s,i=e.resultList,c=void 0===i?[]:i,u=r.length;if(1===n){if(t.nextMessageSeq=r[0].sequence+1,!et(a)){var l=c.findIndex((function(e){return e.sequence===o}));return-1===l?(c[c.length-1].sequence0?Promise.resolve(a):et(o)||this.hasLocalGroup(t)?et(o)?this.getGroupLastSequence(t):this.getTopicLastSequence({groupID:t,topicID:o}):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var t=this,n="".concat(this._className,".getGroupLastSequence"),o=new Va(Ha.GET_GROUP_LAST_SEQUENCE),a=0,s="";if(this.hasLocalGroup(e)){var r=this.getLocalGroupProfile(e),i=r.lastMessage;if(i.lastSequence>0&&!1===i.onlineOnlyFlag)return a=i.lastSequence,s="got lastSequence:".concat(a," from local group profile[lastMessage.lastSequence]. groupID:").concat(e),we.log("".concat(n," ").concat(s)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(s)).end(),Promise.resolve(a);if(r.nextMessageSeq>1)return a=r.nextMessageSeq-1,s="got lastSequence:".concat(a," from local group profile[nextMessageSeq]. groupID:").concat(e),we.log("".concat(n," ").concat(s)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(s)).end(),Promise.resolve(a)}var c="GROUP".concat(e),u=this.getModule(pn).getLocalConversation(c);if(u&&u.lastMessage.lastSequence&&!1===u.lastMessage.onlineOnlyFlag)return a=u.lastMessage.lastSequence,s="got lastSequence:".concat(a," from local conversation profile[lastMessage.lastSequence]. groupID:").concat(e),we.log("".concat(n," ").concat(s)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(s)).end(),Promise.resolve(a);var l={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}};return this.getGroupProfileAdvance(l).then((function(r){var i=r.data.successGroupList;return Bt(i)?we.log("".concat(n," successGroupList is empty. groupID:").concat(e)):(a=i[0].nextMessageSeq-1,s="got lastSequence:".concat(a," from getGroupProfileAdvance. groupID:").concat(e),we.log("".concat(n," ").concat(s))),o.setNetworkType(t.getNetworkType()).setMessage("".concat(s)).end(),a})).catch((function(a){return t.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(a,s,r).setMessage("get lastSequence failed from getGroupProfileAdvance. groupID:".concat(e)).end()})),we.warn("".concat(n," failed. error:"),a),gs(a)}))}},{key:"getTopicLastSequence",value:function(e){var t=this,n=e.groupID,o=e.topicID,a="".concat(this._className,".getTopicLastSequence"),s=new Va(Ha.GET_TOPIC_LAST_SEQUENCE),r=0,i="",c=this.getModule(dn);return c.hasLocalTopic(n,o)?(r=c.getLocalTopic(n,o).nextMessageSeq-1,i="get lastSequence:".concat(r," from local topic info[nextMessageSeq]. topicID:").concat(o),we.log("".concat(a," ").concat(i)),s.setNetworkType(this.getNetworkType()).setMessage("".concat(i)).end(),Promise.resolve(r)):c.getTopicList({groupID:n,topicIDList:[o]}).then((function(e){var n=e.data.successTopicList;return Bt(n)?we.log("".concat(a," successTopicList is empty. topicID:").concat(o)):(r=n[0].nextMessageSeq-1,i="get lastSequence:".concat(r," from getTopicList. topicID:").concat(o),we.log("".concat(a," ").concat(i))),s.setNetworkType(t.getNetworkType()).setMessage("".concat(i)).end(),r})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),a=n[0],r=n[1];s.setError(e,a,r).setMessage("get lastSequence failed from getTopicList. topicID:".concat(o)).end()})),we.warn("".concat(a," failed. error:"),e),gs(e)}))}},{key:"isMessageFromOrToAVChatroom",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"hasJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.hasJoinedAVChatRoom():0}},{key:"getJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.getJoinedAVChatRoom():[]}},{key:"isOnlineMessage",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||!0!==t.onlineUserOnly)}},{key:"_canIUseOnlineOnlyFlag",value:function(e){var t=this.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==C.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e){if(!Bt(e)){we.log("".concat(this._className,"._onAVChatRoomHistoryMessage count:").concat(e.length));var n=[];e.forEach((function(e){n.push(t(t({},e),{},{isHistoryMessage:1}))})),this.onAVChatRoomMessage(n)}}},{key:"onAVChatRoomMessage",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onMessage(e)}},{key:"getGroupSimplifiedInfo",value:function(e){var t=this,n=new Va(Ha.GET_GROUP_SIMPLIFIED_INFO),o={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["Type","Name"]}};return this.getGroupProfileAdvance(o).then((function(o){var a=o.data.successGroupList;return n.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(e," type:").concat(a[0].type)).end(),a[0]})).catch((function(o){t.probeNetwork().then((function(t){var a=m(t,2),s=a[0],r=a[1];n.setError(o,s,r).setMessage("groupID:".concat(e)).end()}))}))}},{key:"setUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.set(e,1)}},{key:"deleteUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.has(e)&&this._unjoinedAVChatRoomList.delete(e)}},{key:"isUnjoinedAVChatRoom",value:function(e){return this._unjoinedAVChatRoomList.has(e)}},{key:"onGroupAttributesUpdated",value:function(e){this._groupAttributesHandler&&this._groupAttributesHandler.onGroupAttributesUpdated(e)}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesHandler&&this._groupAttributesHandler.updateLocalMainSequenceOnReconnected()}},{key:"initGroupAttributes",value:function(e){return this._groupAttributesHandler.initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._groupAttributesHandler.setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._groupAttributesHandler.deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._groupAttributesHandler.getGroupAttributes(e)}},{key:"reset",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._AVChatRoomHandler&&this._AVChatRoomHandler.reset()}}]),a}(Ln),$s=function(){function e(t){o(this,e),this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.lastSendMsgTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this._initMember(t)}return s(e,[{key:"_initMember",value:function(e){this.updateMember(e)}},{key:"updateMember",value:function(e){var t=[null,void 0,"",0,NaN];e.memberCustomField&&It(this.memberCustomField,e.memberCustomField),ut(this,e,["memberCustomField"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){et(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){et(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&It(this.memberCustomField,e)}}]),e}(),zs=function(e){i(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._className="GroupMemberModule",t.groupMemberListMap=new Map,t.getInnerEmitterInstance().on(vs,t._onProfileUpdated,g(t)),t}return s(a,[{key:"_onProfileUpdated",value:function(e){for(var t=this,n=e.data,o=function(e){var o=n[e];t.groupMemberListMap.forEach((function(e){e.has(o.userID)&&e.get(o.userID).updateMember({nick:o.nick,avatar:o.avatar})}))},a=0;a100?100:r};Tt({groupID:n})?d.next="".concat(a):(d.offset=a,l=a+1);var p=[];return this.request({protocolName:zo,requestData:d}).then((function(e){var o=e.data,a=o.members,s=o.memberNum,r=o.next,i=void 0===r?void 0:r;if(et(i)||(l=Bt(i)?0:i),!Ze(a)||0===a.length)return l=0,Promise.resolve([]);var c=t.getModule(cn);return c.hasLocalGroup(n)&&(c.getLocalGroupProfile(n).memberNum=s),p=t._updateLocalGroupMemberMap(n,a),t.getModule(sn).getUserProfile({userIDList:a.map((function(e){return e.userID})),tagList:[Fe.NICK,Fe.AVATAR]})})).then((function(e){var o=e.data;if(!Ze(o)||0===o.length)return _s({memberList:[],offset:l});var a=o.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));return t._updateLocalGroupMemberMap(n,a),u.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," offset:").concat(l," count:").concat(r)).end(),we.log("".concat(i," ok.")),as({memberList:p,offset:l})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),we.error("".concat(i," failed. error:"),e),gs(e)}))}},{key:"getGroupMemberProfile",value:function(e){var n=this,o="".concat(this._className,".getGroupMemberProfile"),a=new Va(Ha.GET_GROUP_MEMBER_PROFILE);a.setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)),we.log("".concat(o," groupID:").concat(e.groupID," userIDList:").concat(e.userIDList.join(","))),e.userIDList.length>50&&(e.userIDList=e.userIDList.slice(0,50));var s=e.groupID,r=e.userIDList;return this._getGroupMemberProfileAdvance(t(t({},e),{},{userIDList:r})).then((function(e){var t=e.data.members;return Ze(t)&&0!==t.length?(n._updateLocalGroupMemberMap(s,t),n.getModule(sn).getUserProfile({userIDList:t.map((function(e){return e.userID})),tagList:[Fe.NICK,Fe.AVATAR]})):_s([])})).then((function(e){var t=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));n._updateLocalGroupMemberMap(s,t);var o=r.filter((function(e){return n.hasLocalGroupMember(s,e)})).map((function(e){return n.getLocalGroupMemberInfo(s,e)}));return a.setNetworkType(n.getNetworkType()).end(),as({memberList:o})}))}},{key:"addGroupMember",value:function(e){var t=this,n="".concat(this._className,".addGroupMember"),o=e.groupID,a=this.getModule(cn).getLocalGroupProfile(o),s=a.type,r=new Va(Ha.ADD_GROUP_MEMBER);if(r.setMessage("groupID:".concat(o," groupType:").concat(s)),Et(s)){var i=new ls({code:Sa.CANNOT_ADD_MEMBER_IN_AVCHATROOM,message:Da.CANNOT_ADD_MEMBER_IN_AVCHATROOM});return r.setCode(Sa.CANNOT_ADD_MEMBER_IN_AVCHATROOM).setError(Da.CANNOT_ADD_MEMBER_IN_AVCHATROOM).setNetworkType(this.getNetworkType()).end(),gs(i)}return e.userIDList=e.userIDList.map((function(e){return{userID:e}})),we.log("".concat(n," groupID:").concat(o)),this.request({protocolName:Xo,requestData:e}).then((function(o){var s=o.data.members;we.log("".concat(n," ok"));var i=s.filter((function(e){return 1===e.result})).map((function(e){return e.userID})),c=s.filter((function(e){return 0===e.result})).map((function(e){return e.userID})),u=s.filter((function(e){return 2===e.result})).map((function(e){return e.userID})),l=s.filter((function(e){return 4===e.result})).map((function(e){return e.userID})),d="groupID:".concat(e.groupID,", ")+"successUserIDList:".concat(i,", ")+"failureUserIDList:".concat(c,", ")+"existedUserIDList:".concat(u,", ")+"overLimitUserIDList:".concat(l);return r.setNetworkType(t.getNetworkType()).setMoreMessage(d).end(),0===i.length?as({successUserIDList:i,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l}):(a.memberCount+=i.length,t._updateConversationGroupProfile(a),as({successUserIDList:i,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l,group:a}))})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"deleteGroupMember",value:function(e){var t=this,n="".concat(this._className,".deleteGroupMember"),o=e.groupID,a=e.userIDList,s=new Va(Ha.DELETE_GROUP_MEMBER),r="groupID:".concat(o," ").concat(a.length>5?"userIDList.length:".concat(a.length):"userIDList:".concat(a));s.setMessage(r),we.log("".concat(n," groupID:").concat(o," userIDList:"),a);var i=this.getModule(cn).getLocalGroupProfile(o);return Et(i.type)?gs(new ls({code:Sa.CANNOT_KICK_MEMBER_IN_AVCHATROOM,message:Da.CANNOT_KICK_MEMBER_IN_AVCHATROOM})):this.request({protocolName:Qo,requestData:e}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),we.log("".concat(n," ok")),i.memberCount-=1,t._updateConversationGroupProfile(i),t.deleteLocalGroupMembers(o,a),as({group:i,userIDList:a})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"_updateConversationGroupProfile",value:function(e){this.getModule(pn).updateConversationGroupProfile([e])}},{key:"setGroupMemberMuteTime",value:function(e){var t=this,n=e.groupID,o=e.userID,a=e.muteTime,s="".concat(this._className,".setGroupMemberMuteTime");if(o===this.getMyUserID())return gs(new ls({code:Sa.CANNOT_MUTE_SELF,message:Da.CANNOT_MUTE_SELF}));we.log("".concat(s," groupID:").concat(n," userID:").concat(o));var r=new Va(Ha.SET_GROUP_MEMBER_MUTE_TIME);return r.setMessage("groupID:".concat(n," userID:").concat(o," muteTime:").concat(a)),this.modifyGroupMemberInfo({groupID:n,userID:o,muteTime:a}).then((function(e){r.setNetworkType(t.getNetworkType()).end(),we.log("".concat(s," ok"));var o=t.getModule(cn);return as({group:o.getLocalGroupProfile(n),member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),we.error("".concat(s," failed. error:"),e),gs(e)}))}},{key:"setGroupMemberRole",value:function(e){var t=this,n="".concat(this._className,".setGroupMemberRole"),o=e.groupID,a=e.userID,s=e.role,r=this.getModule(cn).getLocalGroupProfile(o);if(r.selfInfo.role!==C.GRP_MBR_ROLE_OWNER)return gs({code:Sa.NOT_OWNER,message:Da.NOT_OWNER});if([C.GRP_WORK,C.GRP_AVCHATROOM].includes(r.type))return gs({code:Sa.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM,message:Da.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM});var i=[C.GRP_MBR_ROLE_ADMIN,C.GRP_MBR_ROLE_MEMBER];if(Tt({groupID:o})&&i.push(C.GRP_MBR_ROLE_CUSTOM),i.indexOf(s)<0)return gs({code:Sa.INVALID_MEMBER_ROLE,message:Da.INVALID_MEMBER_ROLE});if(a===this.getMyUserID())return gs({code:Sa.CANNOT_SET_SELF_MEMBER_ROLE,message:Da.CANNOT_SET_SELF_MEMBER_ROLE});var c=new Va(Ha.SET_GROUP_MEMBER_ROLE);return c.setMessage("groupID:".concat(o," userID:").concat(a," role:").concat(s)),we.log("".concat(n," groupID:").concat(o," userID:").concat(a)),this.modifyGroupMemberInfo({groupID:o,userID:a,role:s}).then((function(e){return c.setNetworkType(t.getNetworkType()).end(),we.log("".concat(n," ok")),as({group:r,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];c.setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"setGroupMemberNameCard",value:function(e){var t=this,n="".concat(this._className,".setGroupMemberNameCard"),o=e.groupID,a=e.userID,s=void 0===a?this.getMyUserID():a,r=e.nameCard;we.log("".concat(n," groupID:").concat(o," userID:").concat(s));var i=new Va(Ha.SET_GROUP_MEMBER_NAME_CARD);return i.setMessage("groupID:".concat(o," userID:").concat(s," nameCard:").concat(r)),this.modifyGroupMemberInfo({groupID:o,userID:s,nameCard:r}).then((function(e){we.log("".concat(n," ok")),i.setNetworkType(t.getNetworkType()).end();var a=t.getModule(cn).getLocalGroupProfile(o);return s===t.getMyUserID()&&a&&a.setSelfNameCard(r),as({group:a,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"setGroupMemberCustomField",value:function(e){var t=this,n="".concat(this._className,".setGroupMemberCustomField"),o=e.groupID,a=e.userID,s=void 0===a?this.getMyUserID():a,r=e.memberCustomField;we.log("".concat(n," groupID:").concat(o," userID:").concat(s));var i=new Va(Ha.SET_GROUP_MEMBER_CUSTOM_FIELD);return i.setMessage("groupID:".concat(o," userID:").concat(s," memberCustomField:").concat(JSON.stringify(r))),this.modifyGroupMemberInfo({groupID:o,userID:s,memberCustomField:r}).then((function(e){i.setNetworkType(t.getNetworkType()).end(),we.log("".concat(n," ok"));var a=t.getModule(cn).getLocalGroupProfile(o);return as({group:a,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"modifyGroupMemberInfo",value:function(e){var n=this,o=e.groupID,a=e.userID,s=void 0;return St(o)&&(o=qt(s=o)),this.request({protocolName:Zo,requestData:t(t({},e),{},{groupID:o,topicID:s})}).then((function(){if(n.hasLocalGroupMember(o,a)){var t=n.getLocalGroupMemberInfo(o,a);return et(e.muteTime)||t.updateMuteUntil(e.muteTime),et(e.role)||t.updateRole(e.role),et(e.nameCard)||t.updateNameCard(e.nameCard),et(e.memberCustomField)||t.updateMemberCustomField(e.memberCustomField),t}return n.getGroupMemberProfile({groupID:o,userIDList:[a]}).then((function(e){return m(e.data.memberList,1)[0]}))}))}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this.request({protocolName:Jo,requestData:t(t({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:["Role","JoinTime","NameCard","ShutUpUntil"]})})}},{key:"_updateLocalGroupMemberMap",value:function(e,t){var n=this;return Ze(t)&&0!==t.length?t.map((function(t){return n.hasLocalGroupMember(e,t.userID)?n.getLocalGroupMemberInfo(e,t.userID).updateMember(t):n.setLocalGroupMember(e,new $s(t)),n.getLocalGroupMemberInfo(e,t.userID)})):[]}},{key:"deleteLocalGroupMembers",value:function(e,t){var n=this.groupMemberListMap.get(e);n&&t.forEach((function(e){n.delete(e)}))}},{key:"getLocalGroupMemberInfo",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:"setLocalGroupMember",value:function(e,t){if(this.groupMemberListMap.has(e))this.groupMemberListMap.get(e).set(t.userID,t);else{var n=(new Map).set(t.userID,t);this.groupMemberListMap.set(e,n)}}},{key:"getLocalGroupMemberList",value:function(e){return this.groupMemberListMap.get(e)}},{key:"hasLocalGroupMember",value:function(e,t){return this.groupMemberListMap.has(e)&&this.groupMemberListMap.get(e).has(t)}},{key:"hasLocalGroupMemberMap",value:function(e){return this.groupMemberListMap.has(e)}},{key:"reset",value:function(){this.groupMemberListMap.clear()}}]),a}(Ln),Js=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],Xs=function(e){return Bt(e)?{lastTime:0,lastSequence:0,fromAccount:"",payload:null,type:"",messageForShow:"",nick:"",version:0,cloudCustomData:""}:{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",payload:e.payload||null,type:e.type||"",messageForShow:Vt(e.type,e.payload),nick:e.nick||"",version:e.version||0,cloudCustomData:e.cloudCustomData||""}},Qs=function(){function e(t){o(this,e),this.topicID="",this.topicName="",this.avatar="",this.introduction="",this.notification="",this.unreadCount=0,this.muteAllMembers=!1,this.customData="",this.groupAtInfoList=[],this.nextMessageSeq=0,this.lastMessage=Xs(t.lastMessage),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:""},this._initTopic(t)}return s(e,[{key:"_initTopic",value:function(e){for(var t in e)Js.indexOf(t)<0||("selfInfo"===t?this.updateSelfInfo(e[t]):this[t]="muteAllMembers"===t?1===e[t]:e[t])}},{key:"updateUnreadCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.unreadCount=e}},{key:"updateNextMessageSeq",value:function(e){this.nextMessageSeq=e}},{key:"updateLastMessage",value:function(e){this.lastMessage=Xs(e)}},{key:"updateGroupAtInfoList",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:"updateTopic",value:function(e){et(e.selfInfo)||this.updateSelfInfo(e.selfInfo),et(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),ut(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers"])}},{key:"updateSelfInfo",value:function(e){return 0!==ut(this.selfInfo,e,[],[""])}}]),e}(),Zs=function(e){i(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._className="TopicModule",t._topicMap=new Map,t._getTopicTimeMap=new Map,t.TOPIC_CACHE_TIME=300,t.TOPIC_LAST_ACTIVE_TIME=3600,t.getInnerEmitterInstance().on(Ms,t._onCloudConfigUpdated,g(t)),t}return s(a,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");et(e)||(this.TOPIC_CACHE_TIME=Number(e)),et(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:"onTopicCreated",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOuterEvent(D.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var t=this,n=e.groupID,o=e.topicIDList;(void 0===o?[]:o).forEach((function(e){t._deleteLocalTopic(n,e)})),this.emitOuterEvent(D.TOPIC_DELETED,e)}},{key:"onTopicMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=e.messageRemindType,a=this.getLocalTopic(t,n);if(a){var s=a.updateSelfInfo({messageRemindType:o});s&&this.emitOuterEvent(D.TOPIC_UPDATED,{groupID:t,topic:a}),we.debug("".concat(this._className,".onTopicMessageRemindTypeUpdated topicID:").concat(n)+" messageRemindType:".concat(o," isTopicUpdated:").concat(s))}}},{key:"onTopicProfileUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=this.getLocalTopic(t,n);o&&(o.updateTopic(e),this.emitOuterEvent(D.TOPIC_UPDATED,{groupID:t,topic:o}))}},{key:"onConversationProxy",value:function(e){var t=e.topicID,n=e.unreadCount,o=e.groupAtInfoList,a=qt(t),s=this.getLocalTopic(a,t),r=!1;s&&(et(n)||s.unreadCount===n||(s.updateUnreadCount(n),r=!0),et(o)||(s.updateGroupAtInfoList(o),r=!0)),r&&this.emitOuterEvent(D.TOPIC_UPDATED,{groupID:a,topic:s})}},{key:"onMessageSent",value:function(e){var t=e.groupID,n=e.topicID,o=e.lastMessage,a=this.getLocalTopic(t,n);a&&(a.nextMessageSeq+=1,a.updateLastMessage(o),this.emitOuterEvent(D.TOPIC_UPDATED,{groupID:t,topic:a}))}},{key:"onMessageModified",value:function(e){var t=e.to,n=e.time,o=e.sequence,a=e.elements,s=e.cloudCustomData,r=e.messageVersion,i=qt(t),c=this.getLocalTopic(i,t);if(c){var u=c.lastMessage;we.debug("".concat(this._className,".onMessageModified topicID:").concat(t," lastMessage:"),JSON.stringify(u),"options:",JSON.stringify(e)),u&&(null===u.payload||u.lastTime===n&&u.lastSequence===o&&u.version!==r)&&(u.type=a[0].type,u.payload=a[0].content,u.messageForShow=Vt(u.type,u.payload),u.cloudCustomData=s,u.version=r,u.lastSequence=o,u.lastTime=n,this.emitOuterEvent(D.TOPIC_UPDATED,{groupID:i,topic:c}))}}},{key:"getJoinedCommunityList",value:function(){return this.getModule(cn).getGroupList({isGroupWithTopicOnly:!0}).then((function(e){var t=e.data.groupList;return as({groupList:void 0===t?[]:t})})).catch((function(e){return gs(e)}))}},{key:"createTopicInCommunity",value:function(e){var n=this,o="".concat(this._className,".createTopicInCommunity"),a=e.topicID;if(!et(a)&&!St(a))return gs({code:Sa.ILLEGAL_TOPIC_ID,message:Da.ILLEGAL_TOPIC_ID});var s=new Va(Ha.CREATE_TOPIC);return this.request({protocolName:fa,requestData:t({},e)}).then((function(a){var r=a.data.topicID;return s.setMessage("topicID:".concat(r)).setNetworkType(n.getNetworkType()).end(),we.log("".concat(o," ok")),n._updateTopicMap([t(t({},e),{},{topicID:r})]),as({topicID:r})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.error("".concat(o," failed. error:"),e),gs(e)}))}},{key:"deleteTopicFromCommunity",value:function(e){var t=this,n="".concat(this._className,".deleteTopicFromCommunity"),o=e.groupID,a=e.topicIDList,s=void 0===a?[]:a,r=new Va(Ha.DELETE_TOPIC);return r.setMessage("groupID:".concat(o," topicIDList:").concat(s)),this.request({protocolName:ma,requestData:{groupID:o,topicIDList:s}}).then((function(e){var n=e.data.resultList,a=[],s=[];(void 0===n?[]:n).forEach((function(e){var t=e.topicID,n=e.errorCode,o=e.errorInfo;0===n?a.push({topicID:t}):s.push({topicID:t,code:n,message:o})}));var i="success count:".concat(a.length,", fail count:").concat(s.length);return r.setMoreMessage("".concat(i)).setNetworkType(t.getNetworkType()).end(),we.log("".concat(i)),a.forEach((function(e){t._deleteLocalTopic(o,e.topicID)})),as({successTopicList:a,failureTopicList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"updateTopicProfile",value:function(e){var n=this,o="".concat(this._className,".updateTopicProfile"),a=new Va(Ha.UPDATE_TOPIC_PROFILE);return a.setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),we.log("".concat(o," options:"),e),et(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.request({protocolName:Ma,requestData:t({},e)}).then((function(){return a.setNetworkType(n.getNetworkType()).end(),we.log("".concat(o," ok")),n._updateTopicMap([e]),as({topic:n.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),we.error("".concat(o," failed. error:"),e),gs(e)}))}},{key:"getTopicList",value:function(e){var n=this,o="".concat(this._className,".getTopicList"),a=e.groupID,s=e.topicIDList,r=void 0===s?[]:s,i=0===r.length,c=new Va(Ha.GET_TOPIC_LIST);if(c.setMessage("groupID:".concat(a)),this._getTopicTimeMap.has(a)){var u=this._getTopicTimeMap.get(a),l=u.isGetAll,d=u.time;if((l||!l&&!i)&&Date.now()-d<1e3*this.TOPIC_CACHE_TIME){var p=this._getLocalTopicList(a,r);if(i||p.length===r.length)return c.setNetworkType(this.getNetworkType()).setMoreMessage("from cache, topic count:".concat(p.length)).end(),we.log("".concat(o," groupID:").concat(a," from cache, topic count:").concat(p.length)),_s({successTopicList:p,failureTopicList:[]})}}return this.request({protocolName:va,requestData:{groupID:a,topicIDList:r}}).then((function(e){var s=e.data.topicInfoList,r=[],u=[],l=[];(void 0===s?[]:s).forEach((function(e){var n=e.topic,o=e.selfInfo,a=e.errorCode,s=e.errorInfo,i=n.topicID;0===a?(r.push(t(t({},n),{},{selfInfo:o})),u.push(i)):l.push({topicID:i,code:a,message:s})})),n._updateTopicMap(r),n._handleTopicAtInfo(r);var d="success count:".concat(u.length,", fail count:").concat(l.length);c.setNetworkType(n.getNetworkType()).setMoreMessage("".concat(d)).end(),we.log("".concat(o," groupID:").concat(a," from remote, ").concat(d));var p=[];return Bt(u)||(n._getTopicTimeMap.set(a,{time:Date.now(),isGetAll:i}),p=n._getLocalTopicList(a,u)),as({successTopicList:p,failureTopicList:l})})).catch((function(e){return n.probeNetwork(e).then((function(t){var n=m(t,2),o=n[0],a=n[1];c.setError(e,o,a).end()})),we.error("".concat(o," failed. error:"),e),gs(e)}))}},{key:"hasLocalTopic",value:function(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}},{key:"getLocalTopic",value:function(e,t){var n=null;return this._topicMap.has(e)&&(n=this._topicMap.get(e).get(t)),n}},{key:"_getLocalTopicList",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this._topicMap.get(e),o=[];return n&&(o=M(n.values())),0===t.length?o:o.filter((function(e){return t.includes(e.topicID)}))}},{key:"_deleteLocalTopic",value:function(e,t){this._topicMap.has(e)&&(this._topicMap.get(e).delete(t),we.log("".concat(this._className,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(t)))}},{key:"_updateTopicMap",value:function(e){var t=this,n=[];(e.forEach((function(e){var o=e.groupID,a=e.topicID,s=null;t._topicMap.has(o)||t._topicMap.set(o,new Map),t._topicMap.get(o).has(a)?(s=t._topicMap.get(o).get(a)).updateTopic(e):(t._getTopicLastMessage(e),s=new Qs(e),t._topicMap.get(o).set(a,s));var r=s.nextMessageSeq-s.selfInfo.readedSequence-1,i=r>0?r:0;s.updateUnreadCount(i),n.push({conversationID:"".concat(C.CONV_GROUP).concat(a),type:C.CONV_TOPIC,unreadCount:i})})),n.length>0)&&this.getModule(pn).updateTopicConversation(n)}},{key:"resetGetTopicTime",value:function(e){var t=this;et(e)?M(this._getTopicTimeMap.keys()).forEach((function(e){t._getTopicTimeMap.set(e,0)})):this._getTopicTimeMap.set(e,0)}},{key:"getTopicListOnReconnected",value:function(){var e=this,t=M(this._topicMap.keys()),n=[];t.forEach((function(t){var o=[];e._getLocalTopicList(t).forEach((function(t){var n=t.lastMessage.lastTime,a=void 0===n?0:n;Date.now()-1e3*a<1e3*e.TOPIC_LAST_ACTIVE_TIME&&o.push(t.topicID)})),o.length>0&&n.push({groupID:t,topicIDList:o})})),we.log("".concat(this._className,".getTopicListOnReconnected. active community count:").concat(n.length)),this._relayGetTopicList(n)}},{key:"_relayGetTopicList",value:function(e){var t=this;if(0!==e.length){var n=e.shift(),o=n.topicIDList.length>5?"topicIDList.length:".concat(n.topicIDList.length):"topicIDList:".concat(n.topicIDList),a=new Va(Ha.RELAY_GET_TOPIC_LIST);a.setMessage(o),we.log("".concat(this._className,"._relayGetTopicList. ").concat(o)),this.getTopicList(n).then((function(){a.setNetworkType(t.getNetworkType()).end(),t._relayGetTopicList(e)})).catch((function(n){t.probeNetwork().then((function(e){var t=m(e,2),o=t[0],s=t[1];a.setError(n,o,s).end()})),t._relayGetTopicList(e)}))}}},{key:"_handleTopicAtInfo",value:function(e){var n=this;0!==e.length&&e.forEach((function(e){var o=e.groupID,a=e.topicID,s=e.groupAtInfoList,r=[];et(s)||(s.forEach((function(e){r.push(t(t({},e),{},{groupID:o,topicID:a}))})),n.getModule(pn).onNewGroupAtTips({dataList:r}))}))}},{key:"_getTopicLastMessage",value:function(e){if(!et(e.lastMsg)){var t={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:"",nick:e.lastMsg.nick,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData};e.lastMessage=t}}},{key:"deleteTopicListInCommunity",value:function(e){var t=this,n=this._getLocalTopicList(e),o=this.getModule(pn);n.forEach((function(n){var a=n.topicID;t._deleteLocalTopic(e,a),t._getTopicTimeMap.delete(e),o.deleteLocalConversation("".concat(C.CONV_GROUP).concat(a))}))}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),a}(Ln),er=function(){function e(t){o(this,e),this._userModule=t,this._className="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}return s(e,[{key:"setExpirationTime",value:function(e){this.expirationTime=e}},{key:"getUserProfile",value:function(e){var t=this,n=e.userIDList;e.fromAccount=this._userModule.getMyAccount(),n.length>100&&(we.warn("".concat(this._className,".getUserProfile 获取用户资料人数不能超过100人")),n.length=100);for(var o,a=[],s=[],r=0,i=n.length;r5?"userIDList.length:".concat(n.length):"userIDList:".concat(n)),this._userModule.request({protocolName:Fn,requestData:e}).then((function(e){l.setNetworkType(t._userModule.getNetworkType()).end(),we.info("".concat(t._className,".getUserProfile ok"));var n=t._handleResponse(e).concat(s);return as(c?n[0]:n)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];l.setError(e,o,a).end()})),we.error("".concat(t._className,".getUserProfile failed. error:"),e),gs(e)}))}},{key:"getMyProfile",value:function(){var e=this._userModule.getMyAccount();if(we.log("".concat(this._className,".getMyProfile myAccount:").concat(e)),this._fillMap(),this._containsAccount(e)){var t=this._getProfileFromMap(e);return we.debug("".concat(this._className,".getMyProfile from cache, myProfile:")+JSON.stringify(t)),_s(t)}return this.getUserProfile({fromAccount:e,userIDList:[e],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){for(var t,n,o=ct.now(),a=e.data.userProfileItem,s=[],r=0,i=a.length;r-1)n.profileCustomField.push({key:t[o].tag,value:t[o].value});else switch(t[o].tag){case Fe.NICK:n.nick=t[o].value;break;case Fe.GENDER:n.gender=t[o].value;break;case Fe.BIRTHDAY:n.birthday=t[o].value;break;case Fe.LOCATION:n.location=t[o].value;break;case Fe.SELFSIGNATURE:n.selfSignature=t[o].value;break;case Fe.ALLOWTYPE:n.allowType=t[o].value;break;case Fe.LANGUAGE:n.language=t[o].value;break;case Fe.AVATAR:n.avatar=t[o].value;break;case Fe.MESSAGESETTINGS:n.messageSettings=t[o].value;break;case Fe.ADMINFORBIDTYPE:n.adminForbidType=t[o].value;break;case Fe.LEVEL:n.level=t[o].value;break;case Fe.ROLE:n.role=t[o].value;break;default:we.warn("".concat(this._className,"._handleResponse unknown tag:"),t[o].tag,t[o].value)}return n}},{key:"updateMyProfile",value:function(e){var t=this,n="".concat(this._className,".updateMyProfile"),o=new Va(Ha.UPDATE_MY_PROFILE);o.setMessage(JSON.stringify(e));var a=(new Ns).validate(e);if(!a.valid)return o.setCode(Sa.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("".concat(n," info:").concat(a.tips)).setNetworkType(this._userModule.getNetworkType()).end(),we.error("".concat(n," info:").concat(a.tips,",请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#updateMyProfile")),gs({code:Sa.UPDATE_PROFILE_INVALID_PARAM,message:Da.UPDATE_PROFILE_INVALID_PARAM});var s=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&("profileCustomField"===r?e.profileCustomField.forEach((function(e){s.push({tag:e.key,value:e.value})})):s.push({tag:Fe[r.toUpperCase()],value:e[r]}));return 0===s.length?(o.setCode(Sa.UPDATE_PROFILE_NO_KEY).setMoreMessage(Da.UPDATE_PROFILE_NO_KEY).setNetworkType(this._userModule.getNetworkType()).end(),we.error("".concat(n," info:").concat(Da.UPDATE_PROFILE_NO_KEY,",请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#updateMyProfile")),gs({code:Sa.UPDATE_PROFILE_NO_KEY,message:Da.UPDATE_PROFILE_NO_KEY})):this._userModule.request({protocolName:qn,requestData:{fromAccount:this._userModule.getMyAccount(),profileItem:s}}).then((function(a){o.setNetworkType(t._userModule.getNetworkType()).end(),we.info("".concat(n," ok"));var s=t._updateMap(t._userModule.getMyAccount(),e);return t._userModule.emitOuterEvent(D.PROFILE_UPDATED,[s]),_s(s)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"onProfileModified",value:function(e){var t=e.dataList;if(!Bt(t)){var n,o,a=t.length;we.debug("".concat(this._className,".onProfileModified count:").concat(a," dataList:"),e.dataList);for(var s=[],r=0;r0&&(this._userModule.emitInnerEvent(vs,s),this._userModule.emitOuterEvent(D.PROFILE_UPDATED,s))}}},{key:"_fillMap",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),n=0,o=e.length;n0&&a.push(n)):a.push(t.userID));0!==a.length&&(we.info("".concat(this._className,".onConversationsProfileUpdated toAccountList:").concat(a)),this.getUserProfile({userIDList:a}))}},{key:"getNickAndAvatarByUserID",value:function(e){if(this._containsAccount(e)){var t=this._getProfileFromMap(e);return{nick:t.nick,avatar:t.avatar}}return{nick:"",avatar:""}}},{key:"reset",value:function(){this._flushMap(!0),this.accountProfileMap.clear()}}]),e}(),tr=s((function e(t){o(this,e),Bt||(this.userID=t.userID||"",this.timeStamp=t.timeStamp||0)})),nr=function(){function e(t){o(this,e),this._userModule=t,this._className="BlacklistHandler",this._blacklistMap=new Map,this.startIndex=0,this.maxLimited=100,this.currentSequence=0}return s(e,[{key:"getLocalBlacklist",value:function(){return M(this._blacklistMap.keys())}},{key:"getBlacklist",value:function(){var e=this,t="".concat(this._className,".getBlacklist"),n={fromAccount:this._userModule.getMyAccount(),maxLimited:this.maxLimited,startIndex:0,lastSequence:this.currentSequence},o=new Va(Ha.GET_BLACKLIST);return this._userModule.request({protocolName:Vn,requestData:n}).then((function(n){var a=n.data,s=a.blackListItem,r=a.currentSequence,i=Bt(s)?0:s.length;o.setNetworkType(e._userModule.getNetworkType()).setMessage("blackList count:".concat(i)).end(),we.info("".concat(t," ok")),e.currentSequence=r,e._handleResponse(s,!0),e._userModule.emitOuterEvent(D.BLACKLIST_UPDATED,M(e._blacklistMap.keys()))})).catch((function(n){return e._userModule.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];o.setError(n,a,s).end()})),we.error("".concat(t," failed. error:"),n),gs(n)}))}},{key:"addBlacklist",value:function(e){var t=this,n="".concat(this._className,".addBlacklist"),o=new Va(Ha.ADD_TO_BLACKLIST);if(!Ze(e.userIDList))return o.setCode(Sa.ADD_BLACKLIST_INVALID_PARAM).setMessage(Da.ADD_BLACKLIST_INVALID_PARAM).setNetworkType(this._userModule.getNetworkType()).end(),we.error("".concat(n," options.userIDList 必需是数组")),gs({code:Sa.ADD_BLACKLIST_INVALID_PARAM,message:Da.ADD_BLACKLIST_INVALID_PARAM});var a=this._userModule.getMyAccount();return 1===e.userIDList.length&&e.userIDList[0]===a?(o.setCode(Sa.CANNOT_ADD_SELF_TO_BLACKLIST).setMessage(Da.CANNOT_ADD_SELF_TO_BLACKLIST).setNetworkType(this._userModule.getNetworkType()).end(),we.error("".concat(n," 不能把自己拉黑")),gs({code:Sa.CANNOT_ADD_SELF_TO_BLACKLIST,message:Da.CANNOT_ADD_SELF_TO_BLACKLIST})):(e.userIDList.includes(a)&&(e.userIDList=e.userIDList.filter((function(e){return e!==a})),we.warn("".concat(n," 不能把自己拉黑,已过滤"))),e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Hn,requestData:e}).then((function(a){return o.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),we.info("".concat(n," ok")),t._handleResponse(a.resultItem,!0),as(M(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),we.error("".concat(n," failed. error:"),e),gs(e)})))}},{key:"_handleResponse",value:function(e,t){if(!Bt(e))for(var n,o,a,s=0,r=e.length;s5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),we.info("".concat(n," ok")),t._handleResponse(a.data.resultItem,!1),as(M(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))):(o.setCode(Sa.DEL_BLACKLIST_INVALID_PARAM).setMessage(Da.DEL_BLACKLIST_INVALID_PARAM).setNetworkType(this._userModule.getNetworkType()).end(),we.error("".concat(n," options.userIDList 必需是数组")),gs({code:Sa.DEL_BLACKLIST_INVALID_PARAM,message:Da.DEL_BLACKLIST_INVALID_PARAM}))}},{key:"onAccountDeleted",value:function(e){for(var t,n=[],o=0,a=e.length;o0&&(we.log("".concat(this._className,".onAccountDeleted count:").concat(n.length," userIDList:"),n),this._userModule.emitOuterEvent(D.BLACKLIST_UPDATED,M(this._blacklistMap.keys())))}},{key:"onAccountAdded",value:function(e){for(var t,n=[],o=0,a=e.length;o0&&(we.log("".concat(this._className,".onAccountAdded count:").concat(n.length," userIDList:"),n),this._userModule.emitOuterEvent(D.BLACKLIST_UPDATED,M(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.currentSequence=0}}]),e}(),or=function(e){var t=String(e).replace(/[=]+$/,""),n="";if(t.length%4==1)return we.warn("decodeBase64 failed: ".concat(e," to be decoded is not correctly encoded.")),"";for(var o,a,s=0,r=0;a=t.charAt(r++);~a&&(o=s%4?64*o+a:a,s++%4)?n+=String.fromCharCode(255&o>>(-2*s&6)):0)a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a);try{return decodeURIComponent(escape(n))}catch(i){return we.warn("decodeBase64 failed: ".concat(e," to be decoded is not correctly encoded.")),""}},ar=function(){function e(t){o(this,e),this._userModule=t,this._className="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userModule.getInnerEmitterInstance().on(Ms,this._onCloudConfigUpdated,this)}return s(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._userModule.getCloudConfig("status_query_count"),t=this._userModule.getCloudConfig("status_sub_count"),n=this._userModule.getCloudConfig("status_unsub_count");we.log("".concat(this._className,"._onCloudConfigUpdated statusQueryCount:").concat(e," statusSubscribeCount:").concat(t)+" statusUnsubscribeCount:".concat(n)),et(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),et(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),et(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(n,10))}},{key:"onUserStatusUpdated",value:function(e){var t=e.dataList,n=this._userModule.getMyUserID(),o=this._userModule.getModule(_n),a=t.map((function(e){var t=e.to,a=e.statusType,s=e.customStatus,r=or(s);return t===n&&o.setCustomStatus(r),{userID:t,statusType:a,customStatus:r}}));this._userModule.emitOuterEvent(D.USER_STATUS_UPDATED,a)}},{key:"setSelfStatus",value:function(e){var t=this,n="".concat(this._className,".setSelfStatus"),o=e.customStatus,a=new Va(Ha.SET_SELF_STATUS);return this._userModule.request({protocolName:Ia,requestData:{customStatus:o}}).then((function(e){return a.setNetworkType(t._userModule.getNetworkType()).setMessage("customStatus:".concat(o)).end(),we.log("".concat(n," ok. customStatus:").concat(o)),t._userModule.getModule(_n).setCustomStatus(o),as({userID:t._userModule.getMyUserID(),statusType:1,customStatus:o})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"getUserStatus",value:function(e){var t=this,n="".concat(this._className,".getUserStatus"),o=e.userIDList,a=void 0===o?[]:o,s=this._userModule.getMyUserID(),r=M(a),i=void 0,c=r.indexOf(s);if(c>-1){r.splice(c,1);var u=this._userModule.getModule(_n).getCustomStatus();i={userID:s,statusType:1,customStatus:u}}if(0===r.length)return _s({successUserList:[i],failureUserList:[]});if(!this._canIUseUserStatus())return gs({code:Sa.CANNOT_USE_COMMERCIAL_ABILITY,message:Da.CANNOT_USE_COMMERCIAL_ABILITY});r.length>this.MAX_QUERY_USER_COUNT&&(we.warn("".concat(n," 查询用户状态单次请求不能超过").concat(this.MAX_QUERY_USER_COUNT,"个用户")),r=a.slice(0,this.MAX_QUERY_USER_COUNT));var l=new Va(Ha.GET_USER_STATUS);return this._userModule.request({protocolName:ya,requestData:{userIDList:r}}).then((function(e){var o=e.data,s=o.successUserList,r=void 0===s?[]:s,c=o.failureUserList,u=void 0===c?[]:c,d=r.map((function(e){var t=e.userID,n=e.statusType,o=e.customStatus;return{userID:t,statusType:n,customStatus:or(o)}})),p=u.map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,a=e.errorInfo;return{userID:Bt(n)?t:n,code:o,message:a}}));et(i)||d.unshift(i);var _="userID count:".concat(a.length,", success count:").concat(d.length,", fail count:").concat(p.length);return l.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(_)).end(),we.log("".concat(n," ok. ").concat(_,".")),as({successUserList:d,failureUserList:p})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];l.setMessage("userID count:".concat(a.length)).setError(e,o,s).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"subscribeUserStatus",value:function(e){var t=this;if(!this._canIUseUserStatus())return gs({code:Sa.CANNOT_USE_COMMERCIAL_ABILITY,message:Da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._className,".subscribeUserStatus"),o=e.userIDList,a=void 0===o?[]:o,s=M(a);s.length>this.MAX_SUBSCRIBE_USER_COUNT&&(we.warn("".concat(n," 订阅用户状态单次请求不能超过").concat(this.MAX_SUBSCRIBE_USER_COUNT,"个用户")),s=a.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));var r=new Va(Ha.SUBSCRIBE_USER_STATUS),i="userID count:".concat(a.length);return we.log("".concat(n," ").concat(i)),this._userModule.request({protocolName:Ea,requestData:{userIDList:s}}).then((function(e){var o=e.data.failureUserList,a=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,a=e.errorInfo;return{userID:Bt(n)?t:n,code:o,message:a}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(a.length)).end(),we.log("".concat(n," ok. fail count:").concat(a.length,".")),as({failureUserList:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setMessage("".concat(i)).setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"unsubscribeUserStatus",value:function(e){var t=this;if(!this._canIUseUserStatus())return gs({code:Sa.CANNOT_USE_COMMERCIAL_ABILITY,message:Da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._className,".unsubscribeUserStatus"),o=(e||{}).userIDList,a=void 0===o?[]:o,s=M(a);a.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(we.warn("".concat(n," 取消订阅用户状态单次请求不能超过").concat(this.MAX_UNSUBSCRIBE_USER_COUNT,"个用户")),s=a.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));var r=new Va(Ha.UNSUBSCRIBE_USER_STATUS),i="userID count:".concat(a.length);we.log("".concat(n," ").concat(i));var c={userIDList:s};return 0===s.length&&(c.userIDList=void 0,c.unsubscribeAll=1),this._userModule.request({protocolName:Ta,requestData:c}).then((function(e){var o=e.data.failureUserList,a=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,a=e.errorInfo;return{userID:Bt(n)?t:n,code:o,message:a}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(a.length)).end(),we.log("".concat(n," ok. fail count:").concat(a.length,".")),as({failureUserList:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setMessage("".concat(i)).setError(e,o,a).end()})),we.error("".concat(n," failed. error:"),e),gs(e)}))}},{key:"_canIUseUserStatus",value:function(){return this._userModule.getModule(An).canIUse(B.USER_STATUS)}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),e}(),sr=function(e){i(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._className="UserModule",a._profileHandler=new er(g(a)),a._blacklistHandler=new nr(g(a)),a._userStatusHandler=new ar(g(a)),a.getInnerEmitterInstance().on(ms,a.onContextUpdated,g(a)),a}return s(n,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t=e.dataList;if(!Bt(t)){var n=[];t.forEach((function(e){e.blackListDelAccount&&n.push.apply(n,M(e.blackListDelAccount))})),n.length>0&&this._blacklistHandler.onAccountDeleted(n);var o=[];t.forEach((function(e){e.blackListAddAccount&&o.push.apply(o,M(e.blackListAddAccount))})),o.length>0&&this._blacklistHandler.onAccountAdded(o)}}},{key:"onConversationsProfileUpdated",value:function(e){this._profileHandler.onConversationsProfileUpdated(e)}},{key:"getMyAccount",value:function(){return this.getMyUserID()}},{key:"getMyProfile",value:function(){return this._profileHandler.getMyProfile()}},{key:"getStorageModule",value:function(){return this.getModule(gn)}},{key:"isMyFriend",value:function(e){var t=this.getModule(un);return!!t&&t.isMyFriend(e)}},{key:"getUserProfile",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:"getNickAndAvatarByUserID",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:"getLocalBlacklist",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return _s(e)}},{key:"addBlacklist",value:function(e){return this._blacklistHandler.addBlacklist(e)}},{key:"deleteBlacklist",value:function(e){return this._blacklistHandler.deleteBlacklist(e)}},{key:"onUserStatusUpdated",value:function(e){this._userStatusHandler.onUserStatusUpdated(e)}},{key:"setSelfStatus",value:function(e){return this._userStatusHandler.setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._userStatusHandler.getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._userStatusHandler.subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._userStatusHandler.unsubscribeUserStatus(e)}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),n}(Ln),rr=function(){function e(t,n){o(this,e),this._moduleManager=t,this._isLoggedIn=!1,this._SDKAppID=n.SDKAppID,this._userID=n.userID||"",this._userSig=n.userSig||"",this._version="2.21.2",this._a2Key="",this._tinyID="",this._customStatus="",this._contentType="json",this._unlimitedAVChatRoom=n.unlimitedAVChatRoom,this._scene=n.scene||"",this._oversea=n.oversea,this._instanceID=n.instanceID,this._statusInstanceID=0,this._isDevMode=n.devMode,this._proxyServer=n.proxyServer}return s(e,[{key:"isLoggedIn",value:function(){return this._isLoggedIn}},{key:"isOversea",value:function(){return this._oversea}},{key:"isPrivateNetWork",value:function(){return this._proxyServer}},{key:"isDevMode",value:function(){return this._isDevMode}},{key:"isSingaporeSite",value:function(){return this._SDKAppID>=2e7&&this._SDKAppID<3e7}},{key:"isKoreaSite",value:function(){return this._SDKAppID>=3e7&&this._SDKAppID<4e7}},{key:"isGermanySite",value:function(){return this._SDKAppID>=4e7&&this._SDKAppID<5e7}},{key:"isIndiaSite",value:function(){return this._SDKAppID>=5e7&&this._SDKAppID<6e7}},{key:"isUnlimitedAVChatRoom",value:function(){return this._unlimitedAVChatRoom}},{key:"setUserID",value:function(e){this._userID=e}},{key:"getUserID",value:function(){return this._userID}},{key:"setUserSig",value:function(e){this._userSig=e}},{key:"getUserSig",value:function(){return this._userSig}},{key:"getSDKAppID",value:function(){return this._SDKAppID}},{key:"setTinyID",value:function(e){this._tinyID=e,this._isLoggedIn=!0}},{key:"getTinyID",value:function(){return this._tinyID}},{key:"setCustomStatus",value:function(e){this._customStatus=e}},{key:"getCustomStatus",value:function(){return this._customStatus}},{key:"getScene",value:function(){return this._isTUIKit()?"tuikit":this._scene}},{key:"getInstanceID",value:function(){return this._instanceID}},{key:"getStatusInstanceID",value:function(){return this._statusInstanceID}},{key:"setStatusInstanceID",value:function(e){this._statusInstanceID=e}},{key:"getVersion",value:function(){return this._version}},{key:"getA2Key",value:function(){return this._a2Key}},{key:"setA2Key",value:function(e){this._a2Key=e}},{key:"getContentType",value:function(){return this._contentType}},{key:"getProxyServer",value:function(){return this._proxyServer}},{key:"_isTUIKit",value:function(){var e=!1,t=!1,n=!1,o=!1,a=[];te&&(a=Object.keys(oe)),ne&&(a=ee?Object.keys(uni):Object.keys(window));for(var s=0,r=a.length;s0){for(var u=0,l=c.length;u0&&void 0!==arguments[0]?arguments[0]:0;if(!this.isLoggedIn())return gs({code:Sa.USER_NOT_LOGGED_IN,message:Da.USER_NOT_LOGGED_IN});var n=new Va(Ha.LOGOUT);return n.setNetworkType(this.getNetworkType()).setMessage("identifier:".concat(this.getMyUserID())).end(!0),we.info("".concat(this._className,".logout type:").concat(t)),0===t&&this._moduleManager.setNotReadyReason(Sa.LOGGED_OUT),this.request({protocolName:On,requestData:{type:t}}).then((function(){return e.resetReady(),_s({})})).catch((function(t){return we.error("".concat(e._className,"._logout error:"),t),e.resetReady(),_s({})}))}},{key:"_fetchCloudControlConfig",value:function(){this.getModule(Sn).fetchConfig()}},{key:"_hello",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.request({protocolName:kn}).catch((function(t){we.warn("".concat(e._className,"._hello error:"),t)}))}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var t=0,n="";return Bt(this.getModule(_n).getSDKAppID())?(t=Sa.NO_SDKAPPID,n=Da.NO_SDKAPPID):Bt(e.userID)?(t=Sa.NO_IDENTIFIER,n=Da.NO_IDENTIFIER):Bt(e.userSig)&&(t=Sa.NO_USERSIG,n=Da.NO_USERSIG),{code:t,message:n}}},{key:"onMultipleAccountKickedOut",value:function(e){var t=this;new Va(Ha.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(C.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),we.warn("".concat(this._className,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(D.KICKED_OUT,{type:C.KICKED_OUT_MULT_ACCOUNT}),t._moduleManager.setNotReadyReason(Sa.KICKED_OUT_MULT_ACCOUNT),t._moduleManager.reset()}))}},{key:"onMultipleDeviceKickedOut",value:function(e){var t=this;new Va(Ha.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(C.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),we.warn("".concat(this._className,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(D.KICKED_OUT,{type:C.KICKED_OUT_MULT_DEVICE}),t._moduleManager.setNotReadyReason(Sa.KICKED_OUT_MULT_DEVICE),t._moduleManager.reset()}))}},{key:"onUserSigExpired",value:function(){new Va(Ha.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage(C.KICKED_OUT_USERSIG_EXPIRED).end(!0),we.warn("".concat(this._className,".onUserSigExpired: userSig 签名过期被踢下线")),0!==this.getModule(_n).getStatusInstanceID()&&(this.emitOuterEvent(D.KICKED_OUT,{type:C.KICKED_OUT_USERSIG_EXPIRED}),this._moduleManager.setNotReadyReason(Sa.KICKED_OUT_USERSIG_EXPIRED),this._moduleManager.reset())}},{key:"onRestApiKickedOut",value:function(e){(new Va(Ha.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(C.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),we.warn("".concat(this._className,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),0!==this.getModule(_n).getStatusInstanceID())&&(this.emitOuterEvent(D.KICKED_OUT,{type:C.KICKED_OUT_REST_API}),this._moduleManager.setNotReadyReason(Sa.KICKED_OUT_REST_API),this._moduleManager.reset(),this.getModule(En).onRestApiKickedOut())}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0}}]),n}(Ln);function cr(){return null}var ur=function(){function e(t){o(this,e),this._moduleManager=t,this._className="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}return s(e,[{key:"_errorTolerantHandle",value:function(){te||!et(window)&&!et(window.localStorage)||(this.getItem=cr,this.setItem=cr,this.removeItem=cr,this.clear=cr)}},{key:"onCheckTimer",value:function(e){if(e%20==0){if(0===this._storageQueue.size)return;this._doFlush()}}},{key:"_doFlush",value:function(){try{var e,t=S(this._storageQueue);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2),o=n[0],a=n[1];this._setStorageSync(this._getKey(o),a)}}catch(s){t.e(s)}finally{t.f()}this._storageQueue.clear()}catch(r){we.warn("".concat(this._className,"._doFlush error:"),r)}}},{key:"_getPrefix",value:function(){var e=this._moduleManager.getModule(_n);return"TIM_".concat(e.getSDKAppID(),"_").concat(e.getUserID(),"_")}},{key:"_getKey",value:function(e){return"".concat(this._getPrefix()).concat(e)}},{key:"getItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;return this.getStorageSync(n)}catch(o){return we.warn("".concat(this._className,".getItem error:"),o),{}}}},{key:"setItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(n){var a=o?this._getKey(e):e;this._setStorageSync(a,t)}else this._storageQueue.set(e,t)}},{key:"clear",value:function(){try{te?oe.clearStorageSync():localStorage&&localStorage.clear()}catch(e){we.warn("".concat(this._className,".clear error:"),e)}}},{key:"removeItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;this._removeStorageSync(n)}catch(o){we.warn("".concat(this._className,".removeItem error:"),o)}}},{key:"getSize",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"b";try{var o={size:0,limitSize:5242880,unit:n};if(Object.defineProperty(o,"leftSize",{enumerable:!0,get:function(){return o.limitSize-o.size}}),te&&(o.limitSize=1024*oe.getStorageInfoSync().limitSize),e)o.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(te){var a=oe.getStorageInfoSync(),s=a.keys;s.forEach((function(e){o.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length}))}else if(localStorage)for(var r in localStorage)localStorage.hasOwnProperty(r)&&(o.size+=localStorage.getItem(r).length+r.length);return this._convertUnit(o)}catch(i){we.warn("".concat(this._className," error:"),i)}}},{key:"_convertUnit",value:function(e){var t={},n=e.unit;for(var o in t.unit=n,e)"number"==typeof e[o]&&("kb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024):"mb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024/1024):t[o]=e[o]);return t}},{key:"_setStorageSync",value:function(e,t){te?Q?my.setStorageSync({key:e,data:t}):oe.setStorageSync(e,t):localStorage&&localStorage.setItem(e,JSON.stringify(t))}},{key:"getStorageSync",value:function(e){return te?Q?my.getStorageSync({key:e}).data:oe.getStorageSync(e):localStorage?JSON.parse(localStorage.getItem(e)):{}}},{key:"_removeStorageSync",value:function(e){te?Q?my.removeStorageSync({key:e}):oe.removeStorageSync(e):localStorage&&localStorage.removeItem(e)}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._doFlush()}}]),e}(),lr=function(){function e(t){o(this,e),this._className="SSOLogBody",this._report=[]}return s(e,[{key:"pushIn",value:function(e){we.debug("".concat(this._className,".pushIn"),this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;Ze(e)&&0!==e.length&&(we.debug("".concat(this._className,".backfill"),this._report.length,e.length),(t=this._report).unshift.apply(t,M(e)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return 0===this._report.length}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getLogsInMemory",value:function(){var e=this._report.slice();return this._reset(),e}}]),e}(),dr=function(e){var t=e.getModule(_n);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:Re()}},pr=function(e){i(a,e);var n=f(a);function a(e){var t;o(this,a),(t=n.call(this,e))._className="EventStatModule",t.TAG="im-ssolog-event",t._reportBody=new lr,t.MIN_THRESHOLD=20,t.MAX_THRESHOLD=100,t.WAITING_TIME=6e4,t.REPORT_LEVEL=[4,5,6],t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._lastReportTime=Date.now();var s=t.getInnerEmitterInstance();return s.on(ms,t._onLoginSuccess,g(t)),s.on(Ms,t._onCloudConfigUpdated,g(t)),t}return s(a,[{key:"reportAtOnce",value:function(){we.debug("".concat(this._className,".reportAtOnce")),this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,t=this.getModule(gn),n=t.getItem(this.TAG,!1);!Bt(n)&&ot(n.forEach)&&(we.log("".concat(this._className,"._onLoginSuccess get ssolog in storage, count:").concat(n.length)),n.forEach((function(t){e._reportBody.pushIn(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("evt_rpt_threshold"),t=this.getCloudConfig("evt_rpt_waiting"),n=this.getCloudConfig("evt_rpt_level"),o=this.getCloudConfig("evt_rpt_sdkappid_bl"),a=this.getCloudConfig("evt_rpt_tinyid_wl");et(e)||(this.MIN_THRESHOLD=Number(e)),et(t)||(this.WAITING_TIME=Number(t)),et(n)||(this.REPORT_LEVEL=n.split(",").map((function(e){return Number(e)}))),et(o)||(this.REPORT_SDKAPPID_BLACKLIST=o.split(",").map((function(e){return Number(e)}))),et(a)||(this.REPORT_TINYID_WHITELIST=a.split(","))}},{key:"pushIn",value:function(e){e instanceof Va&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}},{key:"onCheckTimer",value:function(){Date.now()e.MAX_THRESHOLD&&e._flushAtOnce()}))}else this._lastReportTime=Date.now()}}},{key:"_flushAtOnce",value:function(){var e=this.getModule(gn),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory();if(Bt(t))we.log("".concat(this._className,"._flushAtOnce count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var o=n.concat(t);o.length>this.MAX_THRESHOLD&&(o=o.slice(0,this.MAX_THRESHOLD)),we.log("".concat(this._className,"._flushAtOnce count:").concat(o.length)),e.setItem(this.TAG,o,!0,!1)}}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),a}(Ln),_r="none",gr="online",hr=[Sa.OVER_FREQUENCY_LIMIT,Sa.OPEN_SERVICE_OVERLOAD_ERROR],fr=function(){function e(t){o(this,e),this._moduleManager=t,this._networkType="",this._className="NetMonitorModule",this.MAX_WAIT_TIME=3e3,this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null}return s(e,[{key:"start",value:function(){var e=this;te?(oe.getNetworkType({success:function(t){e._networkType=t.networkType,t.networkType===_r?we.warn("".concat(e._className,".start no network, please check!")):we.info("".concat(e._className,".start networkType:").concat(t.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),oe.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=gr,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window&&(window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback)))}},{key:"_onWebOnline",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:gr})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:_r})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,n=e.networkType,o=!1;t?(we.info("".concat(this._className,"._onNetworkStatusChange previousNetworkType:").concat(this._networkType," currentNetworkType:").concat(n)),this._networkType!==n&&(o=!0,this._moduleManager.getModule(En).reConnect(!0))):this._networkType!==n&&(o=!0,we.warn("".concat(this._className,"._onNetworkStatusChange no network, please check!")),this._moduleManager.getModule(En).offline());o&&(new Va(Ha.NETWORK_CHANGE).setMessage("isConnected:".concat(t," previousNetworkType:").concat(this._networkType," networkType:").concat(n)).end(),this._networkType=n)}},{key:"probe",value:function(e){var t=this;return!et(e)&&hr.includes(e.code)?Promise.resolve([!0,this._networkType]):new Promise((function(e,n){if(te)oe.getNetworkType({success:function(n){t._networkType=n.networkType,n.networkType===_r?(we.warn("".concat(t._className,".probe no network, please check!")),e([!1,n.networkType])):(we.info("".concat(t._className,".probe networkType:").concat(n.networkType)),e([!0,n.networkType]))}});else if(window&&window.fetch)fetch("".concat(mt(),"//web.sdk.qcloud.com/im/assets/speed.xml?random=").concat(Math.random())).then((function(t){t.ok?e([!0,gr]):e([!1,_r])})).catch((function(t){e([!1,_r])}));else{var o=new XMLHttpRequest,a=setTimeout((function(){we.warn("".concat(t._className,".probe fetch timeout. Probably no network, please check!")),o.abort(),t._networkType=_r,e([!1,_r])}),t.MAX_WAIT_TIME);o.onreadystatechange=function(){4===o.readyState&&(clearTimeout(a),200===o.status||304===o.status||514===o.status?(this._networkType=gr,e([!0,gr])):(we.warn("".concat(this.className,".probe fetch status:").concat(o.status,". Probably no network, please check!")),this._networkType=_r,e([!1,_r])))},o.open("GET","".concat(mt(),"//web.sdk.qcloud.com/im/assets/speed.xml?random=").concat(Math.random())),o.send()}}))}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),te?null!==this._mpNetworkStatusCallback&&(oe.offNetworkStatusChange&&(Z||J?oe.offNetworkStatusChange(this._mpNetworkStatusCallback):oe.offNetworkStatusChange()),this._mpNetworkStatusCallback=null):window&&(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null))}}]),e}(),mr=L((function(e){var t=Object.prototype.hasOwnProperty,n="~";function o(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,o,s,r){if("function"!=typeof o)throw new TypeError("The listener must be a function");var i=new a(o,s||e,r),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],i]:e._events[c].push(i):(e._events[c]=i,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function i(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),i.prototype.eventNames=function(){var e,o,a=[];if(0===this._eventsCount)return a;for(o in e=this._events)t.call(e,o)&&a.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},i.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var a=0,s=o.length,r=new Array(s);a=this.cosOptions.expiredTime-120&&this._getAuthorizationKey())}},{key:"_getAuthorization",value:function(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}},{key:"upload",value:function(e){if(!0===e.getRelayFlag())return Promise.resolve();var t=this.getModule(Nn);switch(e.type){case C.MSG_IMAGE:return t.addTotalCount(ka),this._uploadImage(e);case C.MSG_FILE:return t.addTotalCount(ka),this._uploadFile(e);case C.MSG_AUDIO:return t.addTotalCount(ka),this._uploadAudio(e);case C.MSG_VIDEO:return t.addTotalCount(ka),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var n=this,o=this.getModule(an),a=e.getElements()[0],s=o.getMessageOption(e.clientSequence);return this.doUploadImage({file:s.payload.file,to:s.to,onProgress:function(e){if(a.updatePercent(e),ot(s.onProgress))try{s.onProgress(e)}catch(t){return gs({code:Sa.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:Da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var s=o.location,r=o.fileType,i=o.fileSize,c=o.width,u=o.height,l=n.isPrivateNetWork()?s:Mt(s);a.updateImageFormat(r);var d=Gt({originUrl:l,originWidth:c,originHeight:u,min:198}),p=Gt({originUrl:l,originWidth:c,originHeight:u,min:720});return a.updateImageInfoArray([{size:i,url:l,width:c,height:u},t({},p),t({},d)]),e}))}},{key:"_uploadFile",value:function(e){var t=this,n=this.getModule(an),o=e.getElements()[0],a=n.getMessageOption(e.clientSequence);return this.doUploadFile({file:a.payload.file,to:a.to,onProgress:function(e){if(o.updatePercent(e),ot(a.onProgress))try{a.onProgress(e)}catch(t){return gs({code:Sa.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:Da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var a=n.location,s=t.isPrivateNetWork()?a:Mt(a);return o.updateFileUrl(s),e}))}},{key:"_uploadAudio",value:function(e){var t=this,n=this.getModule(an),o=e.getElements()[0],a=n.getMessageOption(e.clientSequence);return this.doUploadAudio({file:a.payload.file,to:a.to,onProgress:function(e){if(o.updatePercent(e),ot(a.onProgress))try{a.onProgress(e)}catch(t){return gs({code:Sa.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:Da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var a=n.location,s=t.isPrivateNetWork()?a:Mt(a);return o.updateAudioUrl(s),e}))}},{key:"_uploadVideo",value:function(e){var t=this,n=this.getModule(an),o=e.getElements()[0],a=n.getMessageOption(e.clientSequence);return this.doUploadVideo({file:a.payload.file,to:a.to,onProgress:function(e){if(o.updatePercent(e),ot(a.onProgress))try{a.onProgress(e)}catch(t){return gs({code:Sa.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:Da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var a=n.location,s=n.snapshotInfo,r=t.isPrivateNetWork()?a:Mt(a);return o.updateVideoUrl(r),Bt(s)||o.updateSnapshotInfo(s),e}))}},{key:"doUploadImage",value:function(e){var t=this;if(!e.file)return gs({code:Sa.MESSAGE_IMAGE_SELECT_FILE_FIRST,message:Da.MESSAGE_IMAGE_SELECT_FILE_FIRST});var n=this._checkImageType(e.file);if(!0!==n)return n;var o=this._checkImageSize(e.file);if(!0!==o)return o;var a=null;return this._setUploadFileType(Ts),this.uploadByCOS(e).then((function(e){return a=e,t.isPrivateNetWork()?Lt(e.location):Lt("https://".concat(e.location))})).then((function(e){return a.width=e.width,a.height=e.height,Promise.resolve(a)}))}},{key:"_checkImageType",value:function(e){var t="";return t=te?e.url.slice(e.url.lastIndexOf(".")+1):e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1),ys.indexOf(t.toLowerCase())>=0||gs({code:Sa.MESSAGE_IMAGE_TYPES_LIMIT,message:Da.MESSAGE_IMAGE_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){var t=0;return 0===(t=te?e.size:e.files[0].size)?gs({code:Sa.MESSAGE_FILE_IS_EMPTY,message:"".concat(Da.MESSAGE_FILE_IS_EMPTY)}):t<20971520||gs({code:Sa.MESSAGE_IMAGE_SIZE_LIMIT,message:"".concat(Da.MESSAGE_IMAGE_SIZE_LIMIT)})}},{key:"doUploadFile",value:function(e){var t=null;return e.file?e.file.files[0].size>104857600?gs(t={code:Sa.MESSAGE_FILE_SIZE_LIMIT,message:Da.MESSAGE_FILE_SIZE_LIMIT}):0===e.file.files[0].size?(t={code:Sa.MESSAGE_FILE_IS_EMPTY,message:"".concat(Da.MESSAGE_FILE_IS_EMPTY)},gs(t)):(this._setUploadFileType(Cs),this.uploadByCOS(e)):gs(t={code:Sa.MESSAGE_FILE_SELECT_FILE_FIRST,message:Da.MESSAGE_FILE_SELECT_FILE_FIRST})}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>104857600?gs({code:Sa.MESSAGE_VIDEO_SIZE_LIMIT,message:"".concat(Da.MESSAGE_VIDEO_SIZE_LIMIT)}):0===e.file.videoFile.size?gs({code:Sa.MESSAGE_FILE_IS_EMPTY,message:"".concat(Da.MESSAGE_FILE_IS_EMPTY)}):-1===Es.indexOf(e.file.videoFile.type)?gs({code:Sa.MESSAGE_VIDEO_TYPES_LIMIT,message:"".concat(Da.MESSAGE_VIDEO_TYPES_LIMIT)}):(this._setUploadFileType(Ss),te?this.handleVideoUpload({file:e.file.videoFile,onProgress:e.onProgress}):ne?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var t=this;return new Promise((function(n,o){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){o(new ls({code:Sa.MESSAGE_VIDEO_UPLOAD_FAIL,message:Da.MESSAGE_VIDEO_UPLOAD_FAIL}))}))}))}))}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>20971520?gs(new ls({code:Sa.MESSAGE_AUDIO_SIZE_LIMIT,message:"".concat(Da.MESSAGE_AUDIO_SIZE_LIMIT)})):0===e.file.size?gs(new ls({code:Sa.MESSAGE_FILE_IS_EMPTY,message:"".concat(Da.MESSAGE_FILE_IS_EMPTY)})):(this._setUploadFileType(Ds),this.uploadByCOS(e)):gs(new ls({code:Sa.MESSAGE_AUDIO_UPLOAD_FAIL,message:Da.MESSAGE_AUDIO_UPLOAD_FAIL}))}},{key:"uploadByCOS",value:function(e){var t=this,n="".concat(this._className,".uploadByCOS");if(!ot(this._cosUploadMethod))return we.warn("".concat(n," 没有检测到上传插件,将无法发送图片、音频、视频、文件等类型的消息。详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#registerPlugin")),gs({code:Sa.COS_UNDETECTED,message:Da.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var o=new Va(Ha.UPLOAD),a=Date.now(),s=this._getFile(e);return new Promise((function(r,i){var c=te?t._createCosOptionsWXMiniApp(e):t._createCosOptionsWeb(e),u=t;t._cosUploadMethod(c,(function(e,c){var l=Object.create(null);if(c){if(e||Ze(c.files)&&c.files[0].error){var d=new ls({code:Sa.MESSAGE_FILE_UPLOAD_FAIL,message:Da.MESSAGE_FILE_UPLOAD_FAIL});return o.setError(d,!0,t.getNetworkType()).end(),we.log("".concat(n," failed. error:"),c.files[0].error),403===c.files[0].error.statusCode&&(we.warn("".concat(n," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),void i(d)}l.fileName=s.name,l.fileSize=s.size,l.fileType=s.type.slice(s.type.indexOf("/")+1).toLowerCase(),l.location=te?c.Location:c.files[0].data.Location;var p=Date.now()-a,_=u._formatFileSize(s.size),g=u._formatSpeed(1e3*s.size/p),h="size:".concat(_," time:").concat(p,"ms speed:").concat(g);we.log("".concat(n," success. name:").concat(s.name," ").concat(h)),r(l);var f=t.getModule(Nn);return f.addCost(ka,p),f.addFileSize(ka,s.size),void o.setNetworkType(t.getNetworkType()).setMessage(h).end()}var m=new ls({code:Sa.MESSAGE_FILE_UPLOAD_FAIL,message:Da.MESSAGE_FILE_UPLOAD_FAIL});o.setError(m,!0,u.getNetworkType()).end(),we.warn("".concat(n," failed. error:"),e),403===e.statusCode&&(we.warn("".concat(n," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),i(m)}))}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,n="".concat(this._className,"._uploadWithPreSigUrl"),o=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(a,s){var r=new Va(Ha.UPLOAD),i=e.requestSnapshotUrl,c=void 0===i?void 0:i,u=_(e,vr),l=Date.now();t._cosUploadMethod(u,(function(e,i){var u=Object.create(null);if(e||403===i.statusCode)return r.setError(new ls(e),!0,t.getNetworkType()).end(),we.log("".concat(n," failed, error:"),e),void s(new ls({code:Sa.MESSAGE_FILE_UPLOAD_FAIL,message:Da.MESSAGE_FILE_UPLOAD_FAIL}));var d=i.data.location||"";t.isPrivateNetWork()||0!==d.indexOf("https://")&&0!==d.indexOf("http://")||(d=d.split("//")[1]),u.fileName=o.name,u.fileSize=o.size,u.fileType=o.type.slice(o.type.indexOf("/")+1).toLowerCase(),u.location=d;var p=Date.now()-l,_=t._formatFileSize(o.size),g=t._formatSpeed(1e3*o.size/p),h="size:".concat(_,",time:").concat(p,"ms,speed:").concat(g," res:").concat(JSON.stringify(i.data));we.log("".concat(n," success name:").concat(o.name,",").concat(h)),r.setNetworkType(t.getNetworkType()).setMessage(h).end();var f=t.getModule(Nn);if(f.addCost(ka,p),f.addFileSize(ka,o.size),!Bt(c))return t._getSnapshotInfoByUrl(c).then((function(e){u.snapshotInfo=e,a(u)}));a(u)}))}))}))}},{key:"_getFile",value:function(e){var t;return Ze(e.file.files)||(t=e.file.files,"filelist"===st(t))?e.file.files[0]:e.file}},{key:"_formatFileSize",value:function(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}},{key:"_formatSpeed",value:function(e){return e<=1048576?wt(e/1024,1)+"KB/s":wt(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var t=this._getFile(e),n=t.name,o=n.slice(n.lastIndexOf(".")),a=this._genFileName("".concat(pt(999999)).concat(o));return{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(a),Body:t}],SliceSize:1048576,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){we.warn("onProgress callback error:",n)}},onFileFinish:function(e,t,n){}}}},{key:"_createCosOptionsWXMiniApp",value:function(e){var t=this._getFile(e),n=this._genFileName(t.name),o=t.url;return{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(n),FilePath:o,onProgress:function(t){if(we.log(JSON.stringify(t)),"function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){we.warn("onProgress callback error:",n)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var t=this,n="",o="",a=0,s=this._getFile(e);if(te)n=this._genFileName(s.name),o=s.url,a=1;else{var r=s.name,i=r.slice(r.lastIndexOf("."));n=this._genFileName("".concat(pt(999999)).concat(i)),o=s,a=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:n,uploadMethod:a,duration:this.duration}).then((function(a){var s=a.uploadUrl,r=a.downloadUrl,i=a.requestSnapshotUrl,c=void 0===i?void 0:i;return{url:s,fileType:t.uploadFileType,fileName:n,resources:o,downloadUrl:r,requestSnapshotUrl:c,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){we.warn("onProgress callback error:",n),we.error(n)}}}}))}},{key:"_genFileName",value:function(e){return"".concat(Rt(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e){var t=this,n=new Va(Ha.GET_SNAPSHOT_INFO);return this.request({protocolName:na,requestData:{platform:this.getPlatform(),coverName:this._genFileName(pt(99999)),requestSnapshotUrl:e}}).then((function(e){var t=(e.data||{}).snapshotUrl;return n.setMessage("snapshotUrl:".concat(t)).end(),Bt(t)?{}:Lt(t).then((function(e){return{snapshotUrl:t,snapshotWidth:e.width,snapshotHeight:e.height}}))})).catch((function(e){return we.warn("".concat(t._className,"._getSnapshotInfoByUrl failed. error:"),e),n.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}}))}},{key:"reset",value:function(){we.log("".concat(this._className,".reset"))}}]),a}(Ln),yr=["downloadKey","pbDownloadKey","messageList"],Er=function(){function e(t){o(this,e),this._className="MergerMessageHandler",this._messageModule=t}return s(e,[{key:"uploadMergerMessage",value:function(e,t){var n=this;we.debug("".concat(this._className,".uploadMergerMessage message:"),e,"messageBytes:".concat(t));var o=e.payload.messageList,a=o.length,s=new Va(Ha.UPLOAD_MERGER_MESSAGE);return this._messageModule.request({protocolName:ua,requestData:{messageList:o}}).then((function(e){we.debug("".concat(n._className,".uploadMergerMessage ok. response:"),e.data);var o=e.data,r=o.pbDownloadKey,i=o.downloadKey,c={pbDownloadKey:r,downloadKey:i,messageNumber:a};return s.setNetworkType(n._messageModule.getNetworkType()).setMessage("".concat(a,"-").concat(t,"-").concat(i)).end(),c})).catch((function(e){throw we.warn("".concat(n._className,".uploadMergerMessage failed. error:"),e),n._messageModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),e}))}},{key:"downloadMergerMessage",value:function(e){var n=this;we.debug("".concat(this._className,".downloadMergerMessage message:"),e);var o=e.payload.downloadKey,a=new Va(Ha.DOWNLOAD_MERGER_MESSAGE);return a.setMessage("downloadKey:".concat(o)),this._messageModule.request({protocolName:la,requestData:{downloadKey:o}}).then((function(o){if(we.debug("".concat(n._className,".downloadMergerMessage ok. response:"),o.data),ot(e.clearElement)){var s=e.payload,r=(s.downloadKey,s.pbDownloadKey,s.messageList,_(s,yr));e.clearElement(),e.setElement({type:e.type,content:t({messageList:o.data.messageList},r)})}else{var i=[];o.data.messageList.forEach((function(e){if(!Bt(e)){var t=new es(e);i.push(t)}})),e.payload.messageList=i,e.payload.downloadKey="",e.payload.pbDownloadKey=""}return a.setNetworkType(n._messageModule.getNetworkType()).end(),e})).catch((function(e){throw we.warn("".concat(n._className,".downloadMergerMessage failed. key:").concat(o," error:"),e),n._messageModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),e}))}},{key:"createMergerMessagePack",value:function(e,t,n){return e.conversationType===C.CONV_C2C?this._createC2CMergerMessagePack(e,t,n):this._createGroupMergerMessagePack(e,t,n)}},{key:"_createC2CMergerMessagePack",value:function(e,t,n){var o=null;t&&(t.offlinePushInfo&&(o=t.offlinePushInfo),!0===t.onlineUserOnly&&(o?o.disablePush=!0:o={disablePush:!0}));var a="";Je(e.cloudCustomData)&&e.cloudCustomData.length>0&&(a=e.cloudCustomData);var s=n.pbDownloadKey,r=n.downloadKey,i=n.messageNumber,c=e.payload,u=c.title,l=c.abstractList,d=c.compatibleText,p=this._messageModule.getModule(rn);return{protocolName:wn,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:s,downloadKey:r,title:u,abstractList:l,compatibleText:d,messageNumber:i}}],cloudCustomData:a,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:p&&p.isOnlineMessage(e,t)?0:void 0,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0}}}},{key:"_createGroupMergerMessagePack",value:function(e,t,n){var o=null;t&&t.offlinePushInfo&&(o=t.offlinePushInfo);var a="";Je(e.cloudCustomData)&&e.cloudCustomData.length>0&&(a=e.cloudCustomData);var s=n.pbDownloadKey,r=n.downloadKey,i=n.messageNumber,c=e.payload,u=c.title,l=c.abstractList,d=c.compatibleText,p=this._messageModule.getModule(cn);return{protocolName:bn,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:s,downloadKey:r,title:u,abstractList:l,compatibleText:d,messageNumber:i}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:a,onlineOnlyFlag:p&&p.isOnlineMessage(e,t)?1:0,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||p.isMessageFromOrToAVChatroom(e.to)?0:1}}}}]),e}(),Tr={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MESSAGE_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},Sr=[Sa.MESSAGE_ONPROGRESS_FUNCTION_ERROR,Sa.MESSAGE_IMAGE_SELECT_FILE_FIRST,Sa.MESSAGE_IMAGE_TYPES_LIMIT,Sa.MESSAGE_FILE_IS_EMPTY,Sa.MESSAGE_IMAGE_SIZE_LIMIT,Sa.MESSAGE_FILE_SELECT_FILE_FIRST,Sa.MESSAGE_FILE_SIZE_LIMIT,Sa.MESSAGE_VIDEO_SIZE_LIMIT,Sa.MESSAGE_VIDEO_TYPES_LIMIT,Sa.MESSAGE_AUDIO_UPLOAD_FAIL,Sa.MESSAGE_AUDIO_SIZE_LIMIT,Sa.COS_UNDETECTED];var Dr=function(e){i(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._className="MessageModule",t._messageOptionsMap=new Map,t._mergerMessageHandler=new Er(g(t)),t}return s(a,[{key:"createTextMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new os(e),o="string"==typeof e.payload?e.payload:e.payload.text,a=new Ka({text:o}),s=this._getNickAndAvatarByUserID(t);return n.setElement(a),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createImageMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new os(e);if(te){var o=e.payload.file;if($e(o))return void we.warn("小程序环境下调用 createImageMessage 接口时,payload.file 不支持传入 File 对象");var a=o.tempFilePaths[0],s={url:a,name:a.slice(a.lastIndexOf("/")+1),size:o.tempFiles&&o.tempFiles[0].size||1,type:a.slice(a.lastIndexOf(".")+1).toLowerCase()};e.payload.file=s}else if(ne)if($e(e.payload.file)){var r=e.payload.file;e.payload.file={files:[r]}}else if(Qe(e.payload.file)&&"undefined"!=typeof uni){var i=e.payload.file.tempFiles[0];e.payload.file={files:[i]}}var c=new Ba({imageFormat:be.UNKNOWN,uuid:this._generateUUID(),file:e.payload.file}),u=this._getNickAndAvatarByUserID(t);return n.setElement(c),n.setNickAndAvatar(u),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createAudioMessage",value:function(e){var t=e.payload.file;if(te){var n={url:t.tempFilePath,name:t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/")+1),size:t.fileSize,second:parseInt(t.duration)/1e3,type:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".")+1).toLowerCase()};e.payload.file=n}var o=this.getMyUserID();e.currentUser=o,e.senderTinyID=this.getMyTinyID();var a=new os(e),s=new Wa({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size,url:t.tempFilePath,uuid:this._generateUUID()}),r=this._getNickAndAvatarByUserID(o);return a.setElement(s),a.setNickAndAvatar(r),a.setNameCard(this._getNameCardByGroupID(a)),this._messageOptionsMap.set(a.clientSequence,e),a}},{key:"createVideoMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl="https://web.sdk.qcloud.com/im/assets/images/transparent.png",e.payload.file.thumbSize=1668;var n={};if(te){if(Q)return void we.warn("createVideoMessage 不支持在支付宝小程序环境下使用");if($e(e.payload.file))return void we.warn("小程序环境下调用 createVideoMessage 接口时,payload.file 不支持传入 File 对象");var o=e.payload.file;n.url=o.tempFilePath,n.name=o.tempFilePath.slice(o.tempFilePath.lastIndexOf("/")+1),n.size=o.size,n.second=o.duration,n.type=o.tempFilePath.slice(o.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else if(ne){if($e(e.payload.file)){var a=e.payload.file;e.payload.file.files=[a]}else if(Qe(e.payload.file)&&"undefined"!=typeof uni){var s=e.payload.file.tempFile;e.payload.file.files=[s]}var r=e.payload.file;n.url=window.URL.createObjectURL(r.files[0]),n.name=r.files[0].name,n.size=r.files[0].size,n.second=r.files[0].duration||0,n.type=r.files[0].type.split("/")[1]}e.payload.file.videoFile=n;var i=new os(e),c=new Qa({videoFormat:n.type,videoSecond:wt(n.second,0),videoSize:n.size,remoteVideoUrl:"",videoUrl:n.url,videoUUID:this._generateUUID(),thumbUUID:this._generateUUID(),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:e.payload.file.thumbUrl.slice(e.payload.file.thumbUrl.lastIndexOf(".")+1).toLowerCase()}),u=this._getNickAndAvatarByUserID(t);return i.setElement(c),i.setNickAndAvatar(u),i.setNameCard(this._getNameCardByGroupID(i)),this._messageOptionsMap.set(i.clientSequence,e),i}},{key:"createCustomMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new os(e),o=new Xa({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),a=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(a),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createFaceMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new os(e),o=new xa(e.payload),a=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(a),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createMergerMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=this._getNickAndAvatarByUserID(t),o=new os(e),a=new ts(e.payload);return o.setElement(a),o.setNickAndAvatar(n),o.setNameCard(this._getNameCardByGroupID(o)),o.setRelayFlag(!0),o}},{key:"createForwardMessage",value:function(e){var t=e.to,n=e.conversationType,o=e.priority,a=e.payload,s=e.needReadReceipt,r=this.getMyUserID(),i=this._getNickAndAvatarByUserID(r);if(a.type===C.MSG_GRP_TIP)return gs(new ls({code:Sa.MESSAGE_FORWARD_TYPE_INVALID,message:Da.MESSAGE_FORWARD_TYPE_INVALID}));var c={to:t,conversationType:n,conversationID:"".concat(n).concat(t),priority:o,isPlaceMessage:0,status:jt.UNSEND,currentUser:r,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||a.cloudCustomData||"",needReadReceipt:s},u=new os(c);return u.setElement(a.getElements()[0]),u.setNickAndAvatar(i),u.setNameCard(this._getNameCardByGroupID(a)),u.setRelayFlag(!0),u}},{key:"downloadMergerMessage",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:"createFileMessage",value:function(e){if(te){var n,o="createFileMessage 接口不可用!";if(!$&&!z&&!Z)return void we.warn("小程序目前不支持选择文件,".concat(o));var a=oe.getSystemInfoSync().SDKVersion;if($&&kt(a,n="2.5.0")<0)return void we.warn("wx.chooseMessageFile 需要基础库".concat(n,"或更高版本,").concat(o));if(z&&kt(a,n="1.18.0")<0)return void we.warn("qq.chooseMessageFile 需要基础库".concat(n,"或更高版本,").concat(o))}if(ne||Z){if($e(e.payload.file)){var s=e.payload.file;e.payload.file={files:[s]}}else if(Qe(e.payload.file)&&"undefined"!=typeof uni){var r=e.payload.file,i=r.tempFiles,c=r.files,u=null;Ze(i)?u=i[0]:Ze(c)&&(u=c[0]),e.payload.file={files:[u]}}}else if($||z){var l=e.payload.file.tempFiles,d=t(t({},l[0]),{},{url:l[0].path});e.payload.file={files:[d]}}var p=this.getMyUserID();e.currentUser=p,e.senderTinyID=this.getMyTinyID();var _=new os(e),g=new Ja({uuid:this._generateUUID(),file:e.payload.file}),h=this._getNickAndAvatarByUserID(p);return _.setElement(g),_.setNickAndAvatar(h),_.setNameCard(this._getNameCardByGroupID(_)),this._messageOptionsMap.set(_.clientSequence,e),_}},{key:"createLocationMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new os(e),o=new Za(e.payload),a=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(a),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"_onCannotFindModule",value:function(){return gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"sendMessageInstance",value:function(e,t){var n,o=this,a=null;switch(e.conversationType){case C.CONV_C2C:if(!(a=this.getModule(rn)))return this._onCannotFindModule();break;case C.CONV_GROUP:if(!(a=this.getModule(cn)))return this._onCannotFindModule();if(Tt({groupID:e.to})){var s=a.getLocalGroupProfile(e.to);if(s&&s.isSupportTopic)return gs({code:Sa.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL,message:Da.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL});if(!et(t)&&!et(t.messageControlInfo))return gs({code:Sa.MESSAGE_CONTROL_INFO_FAIL,message:Da.MESSAGE_CONTROL_INFO_FAIL})}break;default:return gs({code:Sa.MESSAGE_SEND_INVALID_CONVERSATION_TYPE,message:Da.MESSAGE_SEND_INVALID_CONVERSATION_TYPE})}var r=this.getModule(Mn),i=this.getModule(cn);return r.upload(e).then((function(){o._getSendMessageSpecifiedKey(e)===Oa&&o.getModule(Nn).addSuccessCount(ka);return i.guardForAVChatRoom(e).then((function(){if(!e.isSendable())return gs({code:Sa.MESSAGE_FILE_URL_IS_EMPTY,message:Da.MESSAGE_FILE_URL_IS_EMPTY});o._addSendMessageTotalCount(e),n=Date.now();var s=function(e){var t="utf-8";ne&&document&&(t=document.charset.toLowerCase());var n,o,a=0;if(o=e.length,"utf-8"===t||"utf8"===t)for(var s=0;s7e3?o._mergerMessageHandler.uploadMergerMessage(e,s).then((function(n){var a=o._mergerMessageHandler.createMergerMessagePack(e,t,n);return o.request(a)})):(o.getModule(pn).setMessageRandom(e),e.conversationType===C.CONV_C2C||e.conversationType===C.CONV_GROUP?a.sendMessage(e,t):void 0)})).then((function(s){var r=s.data,i=r.time,c=r.sequence,u=r.readReceiptCode;ze(u)&&0!==u&&(new Va(Ha.SEND_MESSAGE_WITH_RECEIPT).setMessage("from:".concat(e.from," to:").concat(e.to," sequence:").concat(c," readReceiptCode:").concat(u)).end(),we.warn("".concat(o._className,".sendMessageInstance readReceiptCode:").concat(u," message:").concat(us[u])));o._addSendMessageSuccessCount(e,n),o._messageOptionsMap.delete(e.clientSequence);var l=o.getModule(pn);e.status=jt.SUCCESS,e.time=i;var d=!1;if(e.conversationType===C.CONV_GROUP)e.sequence=c;else if(e.conversationType===C.CONV_C2C){var p=l.getLatestMessageSentByMe(e.conversationID);if(p){var _=p.nick,g=p.avatar;_===e.nick&&g===e.avatar||(d=!0)}}if(d&&l.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),a.isOnlineMessage(e,t))e._onlineOnlyFlag=!0;else{l.appendToMessageList(e);var h=e;Qe(t)&&Qe(t.messageControlInfo)&&(!0===t.messageControlInfo.excludedFromLastMessage&&(e._isExcludedFromLastMessage=!0,h=""),!0===t.messageControlInfo.excludedFromUnreadCount&&(e._isExcludedFromUnreadCount=!0));var f=e.conversationType;if(St(e.to))f=C.CONV_TOPIC,o.getModule(dn).onMessageSent({groupID:qt(e.to),topicID:e.to,lastMessage:h});l.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:f,subType:e.conversationSubType,lastMessage:h}]})}return e.getRelayFlag()||"TIMImageElem"!==e.type||Pt(e.payload.imageInfoArray),as({message:e})}))})).catch((function(t){return o._onSendMessageFailed(e,t)}))}},{key:"_onSendMessageFailed",value:function(e,t){e.status=jt.FAIL,this.getModule(pn).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var n=new Va(Ha.SEND_MESSAGE);return n.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),this.probeNetwork().then((function(e){var o=m(e,2),a=o[0],s=o[1];n.setError(t,a,s).end()})),we.error("".concat(this._className,"._onSendMessageFailed error:"),t),gs(new ls({code:t&&t.code?t.code:Sa.MESSAGE_SEND_FAIL,message:t&&t.message?t.message:Da.MESSAGE_SEND_FAIL,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([C.MSG_IMAGE,C.MSG_AUDIO,C.MSG_VIDEO,C.MSG_FILE].includes(e.type))return Oa;if(e.conversationType===C.CONV_C2C)return Aa;if(e.conversationType===C.CONV_GROUP){var t=this.getModule(cn).getLocalGroupProfile(e.to);if(!t)return;var n=t.type;return Et(n)?Ra:La}}},{key:"_addSendMessageTotalCount",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule(Nn).addTotalCount(t)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n=Math.abs(Date.now()-t),o=this._getSendMessageSpecifiedKey(e);if(o){var a=this.getModule(Nn);a.addSuccessCount(o),a.addCost(o,n)}}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var n,o,a=t.code,s=void 0===a?-1:a,r=this.getModule(Nn),i=this._getSendMessageSpecifiedKey(e);i===Oa&&(n=s,o=!1,Sr.includes(n)&&(o=!0),o)?r.addFailedCountOfUserSide(ka):function(e){var t=!1;return Object.values(Tr).includes(e)&&(t=!0),(e>=120001&&e<=13e4||e>=10100&&e<=10200)&&(t=!0),t}(s)&&i&&r.addFailedCountOfUserSide(i)}},{key:"resendMessage",value:function(e){return e.isResend=!0,e.status=jt.UNSEND,this.sendMessageInstance(e)}},{key:"revokeMessage",value:function(e){var t=this,n=null;if(e.conversationType===C.CONV_C2C){if(!(n=this.getModule(rn)))return this._onCannotFindModule()}else if(e.conversationType===C.CONV_GROUP&&!(n=this.getModule(cn)))return this._onCannotFindModule();var o=new Va(Ha.REVOKE_MESSAGE);return o.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),n.revokeMessage(e).then((function(n){var a=n.data.recallRetList;if(!Bt(a)&&0!==a[0].retCode){var s=new ls({code:a[0].retCode,message:us[a[0].retCode]||Da.MESSAGE_REVOKE_FAIL,data:{message:e}});return o.setCode(s.code).setMoreMessage(s.message).end(),gs(s)}return we.info("".concat(t._className,".revokeMessage ok. ID:").concat(e.ID)),e.isRevoked=!0,o.end(),t.getModule(pn).onMessageRevoked([e]),as({message:e})})).catch((function(n){t.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];o.setError(n,a,s).end()}));var a=new ls({code:n&&n.code?n.code:Sa.MESSAGE_REVOKE_FAIL,message:n&&n.message?n.message:Da.MESSAGE_REVOKE_FAIL,data:{message:e}});return we.warn("".concat(t._className,".revokeMessage failed. error:"),n),gs(a)}))}},{key:"deleteMessage",value:function(e){var t=this,n=null,o=e[0],a=o.conversationID,s="",r=[],i=[];if(o.conversationType===C.CONV_C2C)n=this.getModule(rn),s=a.replace(C.CONV_C2C,""),e.forEach((function(e){e&&e.status===jt.SUCCESS&&e.conversationID===a&&(e._onlineOnlyFlag||r.push("".concat(e.sequence,"_").concat(e.random,"_").concat(e.time)),i.push(e))}));else if(o.conversationType===C.CONV_GROUP)n=this.getModule(cn),s=a.replace(C.CONV_GROUP,""),e.forEach((function(e){e&&e.status===jt.SUCCESS&&e.conversationID===a&&(e._onlineOnlyFlag||r.push("".concat(e.sequence)),i.push(e))}));else if(o.conversationType===C.CONV_SYSTEM)return gs({code:Sa.CANNOT_DELETE_GROUP_SYSTEM_NOTICE,message:Da.CANNOT_DELETE_GROUP_SYSTEM_NOTICE});if(!n)return this._onCannotFindModule();if(0===r.length)return this._onMessageDeleted(i);r.length>30&&(r=r.slice(0,30),i=i.slice(0,30));var c=new Va(Ha.DELETE_MESSAGE);return c.setMessage("to:".concat(s," count:").concat(r.length)),n.deleteMessage({to:s,keyList:r}).then((function(e){return c.end(),we.info("".concat(t._className,".deleteMessage ok")),t._onMessageDeleted(i)})).catch((function(e){t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];c.setError(e,o,a).end()})),we.warn("".concat(t._className,".deleteMessage failed. error:"),e);var n=new ls({code:e&&e.code?e.code:Sa.MESSAGE_DELETE_FAIL,message:e&&e.message?e.message:Da.MESSAGE_DELETE_FAIL});return gs(n)}))}},{key:"_onMessageDeleted",value:function(e){return this.getModule(pn).onMessageDeleted(e),_s({messageList:e})}},{key:"modifyRemoteMessage",value:function(e){var t=this,n=null,o=e.conversationType,a=e.to;if(this.getModule(cn).isMessageFromOrToAVChatroom(a))return gs({code:Sa.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,message:Da.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,data:{message:e}});o===C.CONV_C2C?n=this.getModule(rn):o===C.CONV_GROUP&&(n=this.getModule(cn));var s=new Va(Ha.MODIFY_MESSAGE);return s.setMessage("to:".concat(a)),n.modifyRemoteMessage(e).then((function(n){s.end(),we.info("".concat(t._className,".modifyRemoteMessage ok"));var o=t._onModifyRemoteMessageResp(e,n.data);return as({message:o})})).catch((function(n){if(s.setCode(n.code).setMoreMessage(n.message).end(),we.warn("".concat(t._className,".modifyRemoteMessage failed. error:"),n),20027===n.code){var o=t._onModifyRemoteMessageResp(e,n.data);return gs({code:Sa.MESSAGE_MODIFY_CONFLICT,message:Da.MESSAGE_MODIFY_CONFLICT,data:{message:o}})}return gs({code:n.code,message:n.message,data:{message:e}})}))}},{key:"_onModifyRemoteMessageResp",value:function(e,t){we.debug("".concat(this._className,"._onModifyRemoteMessageResp options:"),t);var n=e.conversationType,o=e.from,a=e.to,s=e.random,r=e.sequence,i=e.time,c=t.elements,u=t.messageVersion,l=t.cloudCustomData,d=void 0===l?"":l;return this.getModule(pn).onMessageModified({conversationType:n,from:o,to:a,time:i,random:s,sequence:r,elements:c,cloudCustomData:d,messageVersion:u})}},{key:"_generateUUID",value:function(){var e=this.getModule(_n);return"".concat(e.getSDKAppID(),"-").concat(e.getUserID(),"-").concat(function(){for(var e="",t=32;t>0;--t)e+=_t[Math.floor(Math.random()*gt)];return e}())}},{key:"getMessageOption",value:function(e){return this._messageOptionsMap.get(e)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.getModule(sn).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===C.CONV_GROUP){var t=this.getModule(cn);if(t)return t.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._messageOptionsMap.clear()}}]),a}(Ln),Cr=function(e){i(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._className="PluginModule",a.plugins={},a}return s(n,[{key:"registerPlugin",value:function(e){var t=this;Object.keys(e).forEach((function(n){t.plugins[n]=e[n]})),new Va(Ha.REGISTER_PLUGIN).setMessage("key=".concat(Object.keys(e))).end()}},{key:"getPlugin",value:function(e){return this.plugins[e]}},{key:"reset",value:function(){we.log("".concat(this._className,".reset"))}}]),n}(Ln),Nr=function(e){i(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._className="SyncUnreadMessageModule",a._cookie="",a._onlineSyncFlag=!1,a.getInnerEmitterInstance().on(ms,a._onLoginSuccess,g(a)),a}return s(n,[{key:"_onLoginSuccess",value:function(e){this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"_startSync",value:function(e){var t=this,n=e.cookie,o=e.syncFlag,a=e.isOnlineSync;we.log("".concat(this._className,"._startSync cookie:").concat(n," syncFlag:").concat(o," isOnlineSync:").concat(a)),this.request({protocolName:Pn,requestData:{cookie:n,syncFlag:o,isOnlineSync:a}}).then((function(e){var n=e.data,o=n.cookie,a=n.syncFlag,s=n.eventArray,r=n.messageList,i=n.C2CRemainingUnreadList,c=n.C2CPairUnreadList;if(t._cookie=o,Bt(o));else if(0===a||1===a){if(s)t.getModule(yn).onMessage({head:{},body:{eventArray:s,isInstantMessage:t._onlineSyncFlag,isSyncingEnded:!1}});t.getModule(rn).onNewC2CMessage({dataList:r,isInstantMessage:!1,C2CRemainingUnreadList:i,C2CPairUnreadList:c}),t._startSync({cookie:o,syncFlag:a,isOnlineSync:0})}else if(2===a){if(s)t.getModule(yn).onMessage({head:{},body:{eventArray:s,isInstantMessage:t._onlineSyncFlag,isSyncingEnded:!0}});t.getModule(rn).onNewC2CMessage({dataList:r,isInstantMessage:t._onlineSyncFlag,C2CRemainingUnreadList:i,C2CPairUnreadList:c})}})).catch((function(e){we.error("".concat(t._className,"._startSync failed. error:"),e)}))}},{key:"startOnlineSync",value:function(){we.log("".concat(this._className,".startOnlineSync")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:1})}},{key:"startSyncOnReconnected",value:function(){we.log("".concat(this._className,".startSyncOnReconnected.")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._onlineSyncFlag=!1,this._cookie=""}}]),n}(Ln),Ar={request:{toAccount:"To_Account",fromAccount:"From_Account",to:"To_Account",from:"From_Account",groupID:"GroupId",groupAtUserID:"GroupAt_Account",extension:"Ext",data:"Data",description:"Desc",elements:"MsgBody",sizeType:"Type",downloadFlag:"Download_Flag",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",videoUrl:"",imageUrl:"URL",fileUrl:"Url",uuid:"UUID",priority:"MsgPriority",receiverUserID:"To_Account",receiverGroupID:"GroupId",messageSender:"SenderId",messageReceiver:"ReceiverId",nick:"From_AccountNick",avatar:"From_AccountHeadurl",messageNumber:"MsgNum",pbDownloadKey:"PbMsgKey",downloadKey:"JsonMsgKey",applicationType:"PendencyType",userIDList:"To_Account",groupNameList:"GroupName",userID:"To_Account",groupAttributeList:"GroupAttr",mainSequence:"AttrMainSeq",avChatRoomKey:"BytesKey",attributeControl:"AttrControl",sequence:"seq",messageControlInfo:"SendMsgControl",updateSequence:"UpdateSeq",clientTime:"MsgClientTime",sequenceList:"MsgSeqList",topicID:"TopicId",customData:"CustomString",isSupportTopic:"SupportTopic"},response:{MsgPriority:"priority",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",Download_Flag:"downloadFlag",GroupId:"groupID",Member_Account:"userID",MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",MsgSeq:"sequence",MsgRandom:"random",MsgTime:"time",MsgTimeStamp:"time",MsgContent:"content",MsgBody:"elements",From_AccountNick:"nick",From_AccountHeadurl:"avatar",GroupWithdrawInfoArray:"revokedInfos",GroupReadInfoArray:"groupMessageReadNotice",LastReadMsgSeq:"lastMessageSeq",WithdrawC2cMsgNotify:"c2cMessageRevokedNotify",C2cWithdrawInfoArray:"revokedInfos",C2cReadedReceipt:"c2cMessageReadReceipt",ReadC2cMsgNotify:"c2cMessageReadNotice",LastReadTime:"peerReadTime",MsgRand:"random",MsgType:"type",MsgShow:"messageShow",NextMsgSeq:"nextMessageSeq",FaceUrl:"avatar",ProfileDataMod:"profileModify",Profile_Account:"userID",ValueBytes:"value",ValueNum:"value",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgFrom_AccountExtraInfo:"messageFromAccountExtraInformation",Operator_Account:"operatorID",OpType:"operationType",ReportType:"operationType",UserId:"userID",User_Account:"userID",List_Account:"userIDList",MsgOperatorMemberExtraInfo:"operatorInfo",MsgMemberExtraInfo:"memberInfoList",ImageUrl:"avatar",NickName:"nick",MsgGroupNewInfo:"newGroupProfile",MsgAppDefinedData:"groupCustomField",Owner_Account:"ownerID",GroupFaceUrl:"avatar",GroupIntroduction:"introduction",GroupNotification:"notification",GroupApplyJoinOption:"joinOption",MsgKey:"messageKey",GroupInfo:"groupProfile",ShutupTime:"muteTime",Desc:"description",Ext:"extension",GroupAt_Account:"groupAtUserID",MsgNum:"messageNumber",PbMsgKey:"pbDownloadKey",JsonMsgKey:"downloadKey",MsgModifiedFlag:"isModified",PendencyItem:"applicationItem",PendencyType:"applicationType",AddTime:"time",AddSource:"source",AddWording:"wording",ProfileImImage:"avatar",PendencyAdd:"friendApplicationAdded",FrienPencydDel_Account:"friendApplicationDeletedUserIDList",Peer_Account:"userID",GroupAttr:"groupAttributeList",GroupAttrAry:"groupAttributeList",AttrMainSeq:"mainSequence",seq:"sequence",GroupAttrOption:"groupAttributeOption",BytesChangedKeys:"changedKeyList",GroupAttrInfo:"groupAttributeList",GroupAttrSeq:"mainSequence",PushChangedAttrValFlag:"hasChangedAttributeInfo",SubKeySeq:"sequence",Val:"value",MsgGroupFromCardName:"senderNameCard",MsgGroupFromNickName:"senderNick",C2cNick:"peerNick",C2cImage:"peerAvatar",SendMsgControl:"messageControlInfo",NoLastMsg:"excludedFromLastMessage",NoUnread:"excludedFromUnreadCount",UpdateSeq:"updateSequence",MuteNotifications:"muteFlag",MsgClientTime:"clientTime",TinyId:"tinyID",GroupMsgReceiptList:"readReceiptList",ReadNum:"readCount",UnreadNum:"unreadCount",TopicId:"topicID",MillionGroupFlag:"communityType",SupportTopic:"isSupportTopic",MsgTopicNewInfo:"newTopicInfo",ShutupAll:"muteAllMembers",CustomString:"customData",TopicFaceUrl:"avatar",TopicIntroduction:"introduction",TopicNotification:"notification",TopicIdArray:"topicIDList",MsgVersion:"messageVersion",C2cMsgModNotifys:"c2cMessageModified",GroupMsgModNotifys:"groupMessageModified",ApplyJoinOption:"joinOption",MsgFlag:"messageRemindType",AtInfoList:"groupAtInfoList",AtFlagList:"groupAtType",AtMsgSeq:"sequence"},ignoreKeyWord:["C2C","ID","USP"]};function Lr(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");t=Object.assign({pascalCase:!1},t);var n;return 0===(e=Array.isArray(e)?e.map((function(e){return e.trim()})).filter((function(e){return e.length})).join("-"):e.trim()).length?"":1===e.length?t.pascalCase?e.toUpperCase():e.toLowerCase():(e!==e.toLowerCase()&&(e=Rr(e)),e=e.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(function(e,t){return t.toUpperCase()})).replace(/\d+(\w|$)/g,(function(e){return e.toUpperCase()})),n=e,t.pascalCase?n.charAt(0).toUpperCase()+n.slice(1):n)}var Rr=function(e){for(var t=!1,n=!1,o=!1,a=0;a100)return n--,t;if(Ze(t)){var a=t.map((function(t){return Xe(t)?e(t,o):t}));return n--,a}if(Xe(t)){var s=(r=t,i=function(e,t){if(!rt(t))return!1;if((a=t)!==Lr(a))for(var n=0;n65535)return Gr(240|t>>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533}else t<=57343&&(t=65533);return t<=2047?Gr(192|t>>>6,128|63&t):Gr(224|t>>>12,128|t>>>6&63,128|63&t)},Ur=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,Pr),n=0|t.length,o=new Uint8Array(n),a=0;a0)for(var c=0;c=s&&(we.log("".concat(e._className,"._checkPromiseMap request timeout, delete requestID:").concat(n)),e._promiseMap.delete(n),o(new ls({code:Sa.NETWORK_TIMEOUT,message:Da.NETWORK_TIMEOUT})),e._channelModule.onRequestTimeout(n))}))}},{key:"onOpen",value:function(e){if(""!==this._readyState){this._onOpenTs=Date.now();var t=e.id;this._socketID=t;var n=Date.now()-this._startTs;we.log("".concat(this._className,"._onOpen cost ").concat(n," ms. socketID:").concat(t)),new Va(Ha.WS_ON_OPEN).setMessage(n).setCostTime(n).setMoreMessage("socketID:".concat(t)).end(),e.id===this._socketID&&(this._readyState=Kr,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._channelModule.onReconnected(),this._reConnectFlag=!1),this._channelModule.onOpen())}}},{key:"onClose",value:function(e){var t=new Va(Ha.WS_ON_CLOSE),n=e.id,o=e.e,a="sourceSocketID:".concat(n," currentSocketID:").concat(this._socketID," code:").concat(o.code," reason:").concat(o.reason),s=0;0!==this._onOpenTs&&(s=Date.now()-this._onOpenTs),t.setMessage(s).setCostTime(s).setMoreMessage(a).setCode(o.code).end(),we.log("".concat(this._className,"._onClose ").concat(a," onlineTime:").concat(s)),n===this._socketID&&(this._readyState=xr,s<1e3?this._channelModule.onReconnectFailed():this._channelModule.onClose())}},{key:"onError",value:function(e){var t=e.id,n=e.e,o="sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID);new Va(Ha.WS_ON_ERROR).setMessage(n.errMsg||lt(n)).setMoreMessage(o).setLevel("error").end(),we.warn("".concat(this._className,"._onError"),n,o),t===this._socketID&&(this._readyState="",this._channelModule.onError())}},{key:"onMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(u){new Va(Ha.JSON_PARSE_ERROR).setMessage(e.data).end()}if(t&&t.head){var n=this._getRequestIDFromHead(t.head),o=Ut(t.head),a=kr(t.body,this._getResponseKeyMap(o));if(we.debug("".concat(this._className,".onMessage ret:").concat(JSON.stringify(a)," requestID:").concat(n," has:").concat(this._promiseMap.has(n))),this._setNextPingTs(),this._promiseMap.has(n)){var s=this._promiseMap.get(n),r=s.resolve,i=s.reject,c=s.timestamp;return this._promiseMap.delete(n),this._calcRTT(c),void(a.errorCode&&0!==a.errorCode?(this._channelModule.onErrorCodeNotZero(a),i(new ls({code:a.errorCode,message:a.errorInfo||"",data:{elements:a.elements,messageVersion:a.messageVersion,cloudCustomData:a.cloudCustomData}}))):r(as(a)))}this._channelModule.onMessage({head:t.head,body:a})}}},{key:"_calcRTT",value:function(e){var t=Date.now()-e;this._channelModule.getModule(Nn).addRTT(t)}},{key:"_connect",value:function(){this._startTs=Date.now(),this._onOpenTs=0,this._socket=new br(this),this._socketID=this._socket.getID(),this._readyState=Br,we.log("".concat(this._className,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new Va(Ha.WS_CONNECT).setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end()}},{key:"getURL",value:function(){var e=this._channelModule.getModule(_n);e.isDevMode()&&(this._canIUseBinaryFrame=!1);var t=Ot();(Q||$&&"windows"===t||Z)&&(this._canIUseBinaryFrame=!1);var n=-1;"ios"===t?n=de||-1:"android"===t&&(n=_e||-1);var o=this._channelModule.getPlatform(),a=e.getSDKAppID(),s=e.getInstanceID();return this._canIUseBinaryFrame?"".concat(this._url,"/binfo?sdkappid=").concat(a,"&instanceid=").concat(s,"&random=").concat(this._getRandom(),"&platform=").concat(o,"&host=").concat(t,"&version=").concat(n):"".concat(this._url,"/info?sdkappid=").concat(a,"&instanceid=").concat(s,"&random=").concat(this._getRandom(),"&platform=").concat(o,"&host=").concat(t,"&version=").concat(n)}},{key:"_closeConnection",value:function(e){we.log("".concat(this._className,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=xr)}},{key:"_resend",value:function(){var e=this;if(we.log("".concat(this._className,"._resend reConnectFlag:").concat(this._reConnectFlag),"promiseMap.size:".concat(this._promiseMap.size," simpleRequestMap.size:").concat(this._simpleRequestMap.size)),this._promiseMap.size>0&&this._promiseMap.forEach((function(t,n){var o=t.uplinkData,a=t.resolve,s=t.reject;e._promiseMap.set(n,{resolve:a,reject:s,timestamp:Date.now(),uplinkData:o}),e._execute(n,o)})),this._simpleRequestMap.size>0){var t,n=S(this._simpleRequestMap);try{for(n.s();!(t=n.n()).done;){var o=m(t.value,2),a=o[0],s=o[1];this._execute(a,s)}}catch(r){n.e(r)}finally{n.f()}this._simpleRequestMap.clear()}}},{key:"send",value:function(e){var t=this;e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3);e.keyMap;var n=_(e,Vr),o=this._getRequestIDFromHead(e.head),a=JSON.stringify(n);return new Promise((function(e,s){(t._promiseMap.set(o,{resolve:e,reject:s,timestamp:Date.now(),uplinkData:a}),we.debug("".concat(t._className,".send uplinkData:").concat(JSON.stringify(n)," requestID:").concat(o," readyState:").concat(t._readyState)),t._readyState!==Kr)?t._reConnect():(t._execute(o,a),t._channelModule.getModule(Nn).addRequestCount())}))}},{key:"simplySend",value:function(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3);e.keyMap;var t=_(e,Hr),n=this._getRequestIDFromHead(e.head),o=JSON.stringify(t);this._readyState!==Kr?(this._simpleRequestMap.size0&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:"onErrorCodeNotZero",value:function(e){this.getModule(yn).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.getModule(yn).onMessage(e)}},{key:"send",value:function(e){return this._socketHandler?this._previousState!==C.NET_STATE_CONNECTED&&e.head.servcmd.includes(oa)?(this.reConnect(),this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:"_sendLogViaHTTP",value:function(e){var t=K.HOST.CURRENT.STAT;return new Promise((function(n,o){var a="".concat(t,"/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e.head.sdkappid,"&reqtime=").concat(Date.now()),s=JSON.stringify(e.body),r="application/x-www-form-urlencoded;charset=UTF-8";if(te)oe.request({url:a,data:s,method:"POST",timeout:3e3,header:{"content-type":r},success:function(){n()},fail:function(){o(new ls({code:Sa.NETWORK_ERROR,message:Da.NETWORK_ERROR}))}});else{var i=new XMLHttpRequest,c=setTimeout((function(){i.abort(),o(new ls({code:Sa.NETWORK_TIMEOUT,message:Da.NETWORK_TIMEOUT}))}),3e3);i.onreadystatechange=function(){4===i.readyState&&(clearTimeout(c),200===i.status||304===i.status?n():o(new ls({code:Sa.NETWORK_ERROR,message:Da.NETWORK_ERROR})))},i.open("POST",a,!0),i.setRequestHeader("Content-type",r),i.send(s)}}))}},{key:"simplySend",value:function(e){return this._socketHandler?this._socketHandler.simplySend(e):Promise.reject()}},{key:"onOpen",value:function(){this._ping()}},{key:"onClose",value:function(){this._socketHandler&&(this._socketHandler.getReconnectFlag()&&this._emitNetStateChangeEvent(C.NET_STATE_DISCONNECTED));this.reConnect()}},{key:"onError",value:function(){te&&!Z&&we.error("".concat(this._className,".onError 从v2.11.2起,SDK 支持了 WebSocket,如您未添加相关受信域名,请先添加!(如已添加请忽略),升级指引: https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-02-upgradeguideline.html")),this._emitNetStateChangeEvent(C.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.getModule(yn).getKeyMap(e)}},{key:"_onAppHide",value:function(){this._isAppShowing=!1}},{key:"_onAppShow",value:function(){this._isAppShowing=!0}},{key:"onRequestTimeout",value:function(e){}},{key:"onReconnected",value:function(){we.log("".concat(this._className,".onReconnected")),this.getModule(yn).onReconnected(),this._emitNetStateChangeEvent(C.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){we.log("".concat(this._className,".onReconnectFailed")),this._emitNetStateChangeEvent(C.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(C.NET_STATE_DISCONNECTED)}},{key:"reConnect",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!1;this._socketHandler&&(t=this._socketHandler.getReconnectFlag());var n="forcedFlag:".concat(e," fatalErrorFlag:").concat(this._fatalErrorFlag," previousState:").concat(this._previousState," reconnectFlag:").concat(t);if(we.log("".concat(this._className,".reConnect ").concat(n)),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===C.NET_STATE_CONNECTING&&t)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(C.NET_STATE_CONNECTING)}}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(we.log("".concat(this._className,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),this._previousState=e,this.emitOuterEvent(D.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e=this;if(!0!==this._probing){this._probing=!0;var t=this.getModule(yn).getProtocolData({protocolName:aa});this.send(t).then((function(){e._probing=!1})).catch((function(t){if(we.warn("".concat(e._className,"._ping failed. error:"),t),e._probing=!1,t&&60002===t.code)return new Va(Ha.ERROR).setMessage("code:".concat(t.code," message:").concat(t.message)).setNetworkType(e.getModule(fn).getNetworkType()).end(),e._fatalErrorFlag=!0,void e._emitNetStateChangeEvent(C.NET_STATE_DISCONNECTED);e.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];we.log("".concat(e._className,"._ping failed. probe network, isAppShowing:").concat(e._isAppShowing," online:").concat(o," networkType:").concat(a)),o?e.reConnect():e._emitNetStateChangeEvent(C.NET_STATE_DISCONNECTED)}))}))}}},{key:"_checkNextPing",value:function(){this._socketHandler&&(this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping())}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),this._timerForNotLoggedIn>-1&&clearInterval(this._timerForNotLoggedIn)}},{key:"onRestApiKickedOut",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._previousState=C.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3)}}]),n}(Ln),jr=["a2","tinyid"],$r=["a2","tinyid"],zr=function(){function e(t){o(this,e),this._className="ProtocolHandler",this._sessionModule=t,this._configMap=new Map,this._fillConfigMap()}return s(e,[{key:"_fillConfigMap",value:function(){this._configMap.clear();var e=this._sessionModule.genCommonHead(),n=this._sessionModule.genCosSpecifiedHead(),o=this._sessionModule.genSSOReportHead();this._configMap.set(Rn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_OPEN_STATUS,".").concat(K.CMD.LOGIN)}),body:{state:"Online"},keyMap:{response:{InstId:"instanceID",HelloInterval:"helloInterval"}}}}(e)),this._configMap.set(On,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_OPEN_STATUS,".").concat(K.CMD.LOGOUT)}),body:{type:0},keyMap:{request:{type:"wslogout_type"}}}}(e)),this._configMap.set(kn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_OPEN_STATUS,".").concat(K.CMD.HELLO)}),body:{},keyMap:{response:{NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(Gn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.STAT_SERVICE,".").concat(K.CMD.KICK_OTHER)}),body:{}}}(e)),this._configMap.set(ea,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_COS_SIGN,".").concat(K.CMD.COS_SIGN)}),body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{request:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},response:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}}(n)),this._configMap.set(ta,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.CUSTOM_UPLOAD,".").concat(K.CMD.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{request:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},response:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}}(n)),this._configMap.set(na,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.CUSTOM_UPLOAD,".").concat(K.CMD.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{request:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},response:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}}(n)),this._configMap.set(_a,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_CONFIG_MANAGER,".").concat(K.CMD.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{request:{SDKAppID:"uint32_sdkappid"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(ga,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_CONFIG_MANAGER,".").concat(K.CMD.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(da,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_CONFIG_MANAGER,".").concat(K.CMD.FETCH_CLOUD_CONTROL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{request:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(pa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_CONFIG_MANAGER,".").concat(K.CMD.PUSHED_CLOUD_CONTROL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(ha,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OVERLOAD_PUSH,".").concat(K.CMD.OVERLOAD_NOTIFY)}),body:{},keyMap:{response:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}}(e)),this._configMap.set(Pn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.GET_MESSAGES)}),body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},response:{MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",ClientSeq:"clientSequence",MsgSeq:"sequence",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgRandom:"random",MsgTimeStamp:"time",MsgContent:"content",ToGroupId:"groupID",MsgKey:"messageKey",GroupTips:"groupTips",MsgBody:"elements",MsgType:"type",C2CRemainingUnreadCount:"C2CRemainingUnreadList",C2CPairUnreadCount:"C2CPairUnreadList"}}}}(e)),this._configMap.set(Un,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.BIG_DATA_HALLWAY_AUTH_KEY)}),body:{}}}(e)),this._configMap.set(wn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.SEND_MESSAGE)}),body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0},androidInfo:{OPPOChannelID:""}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",count:"MaxCnt",lastMessageTime:"LastMsgTime",messageKey:"MsgKey",peerAccount:"Peer_Account",data:"Data",description:"Desc",extension:"Ext",type:"MsgType",content:"MsgContent",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",nick:"From_AccountNick",avatar:"From_AccountHeadurl",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"IsNeedReadReceipt"}}}}(e)),this._configMap.set(bn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.SEND_GROUP_MESSAGE)}),body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0},androidInfo:{OPPOChannelID:""}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0},keyMap:{request:{to:"GroupId",extension:"Ext",data:"Data",description:"Desc",random:"Random",sequence:"ReqMsgSeq",count:"ReqMsgNumber",type:"MsgType",priority:"MsgPriority",content:"MsgContent",elements:"MsgBody",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",clientSequence:"ClientSeq",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"NeedReadReceipt"},response:{MsgTime:"time",MsgSeq:"sequence"}}}}(e)),this._configMap.set(oo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.REVOKE_C2C_MESSAGE)}),body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{request:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}}(e)),this._configMap.set(Lo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.REVOKE_GROUP_MESSAGE)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{request:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}}(e)),this._configMap.set(io,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.GET_C2C_ROAM_MESSAGES)}),body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{request:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},response:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt"}}}}(e)),this._configMap.set(lo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.MODIFY_C2C_MESSAGE)}),body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(ko,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.GET_GROUP_ROAM_MESSAGES)}),body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{request:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},response:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",IsPlaceMsg:"isPlaceMessage",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgPriority:"priority",MsgBody:"elements",MsgType:"type",MsgContent:"content",IsFinished:"complete",Download_Flag:"downloadFlag",ClientSeq:"clientSequence",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",ToTopicId:"topicID"}}}}(e)),this._configMap.set(ao,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.SET_C2C_MESSAGE_READ)}),body:{C2CMsgReaded:void 0},keyMap:{request:{lastMessageTime:"LastedMsgTime"}}}}(e)),this._configMap.set(so,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{request:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}}(e)),this._configMap.set(ro,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{updateSequence:0},keyMap:{response:{MuteNotificationsList:"muteFlagList"}}}}(e)),this._configMap.set(Ro,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.SET_GROUP_MESSAGE_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{request:{messageReadSeq:"MsgReadedSeq"}}}}(e)),this._configMap.set(Oo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.SET_ALL_MESSAGE_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{request:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},response:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}}(e)),this._configMap.set(uo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.DELETE_C2C_MESSAGE)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{request:{keyList:"MsgKeyList"}}}}(e)),this._configMap.set(Ko,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.DELETE_GROUP_MESSAGE)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{request:{deleter:"Deleter_Account",keyList:"Seqs"}}}}(e)),this._configMap.set(Bo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.MODIFY_GROUP_MESSAGE)}),body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(Go,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequence:"MsgSeq"}}}}(e)),this._configMap.set(Uo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:"",messageInfoList:void 0},keyMap:{request:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}}(e)),this._configMap.set(Po,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}}(e)),this._configMap.set(wo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.GET_READ_RECEIPT_DETAIL)}),body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{request:{sequence:"MsgSeq",count:"Num"},response:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}}(e)),this._configMap.set(co,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.GET_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{request:{userIDList:"To_Account"},response:{ReadTime:"peerReadTimeList"}}}}(e)),this._configMap.set(_o,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.RECENT_CONTACT,".").concat(K.CMD.GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,count:0},keyMap:{request:{},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime"}}}}(e)),this._configMap.set(po,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.RECENT_CONTACT,".").concat(K.CMD.PAGING_GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:4,assistFlag:15},keyMap:{request:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex"}}}}(e)),this._configMap.set(go,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.RECENT_CONTACT,".").concat(K.CMD.DELETE_CONVERSATION)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0,clearHistoryMessage:1},keyMap:{request:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble"}}}}(e)),this._configMap.set(ho,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.RECENT_CONTACT,".").concat(K.CMD.PIN_CONVERSATION)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{request:{itemList:"RecentContactItem"}}}}(e)),this._configMap.set(fo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.DELETE_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(Fn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.PROFILE,".").concat(K.CMD.PORTRAIT_GET)}),body:{fromAccount:"",userItem:[]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(qn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.PROFILE,".").concat(K.CMD.PORTRAIT_SET)}),body:{fromAccount:"",profileItem:[{tag:Fe.NICK,value:""},{tag:Fe.GENDER,value:""},{tag:Fe.ALLOWTYPE,value:""},{tag:Fe.AVATAR,value:""}]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(Vn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.GET_BLACKLIST)}),body:{fromAccount:"",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{response:{CurruentSequence:"currentSequence"}}}}(e)),this._configMap.set(Hn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.ADD_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(Kn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.DELETE_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(Ia,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_OPEN_STATUS,".").concat(K.CMD.SET_SELF_STATUS)}),body:{customStatus:""},keyMap:{}}}(e)),this._configMap.set(ya,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_OPEN_STATUS,".").concat(K.CMD.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}}(e)),this._configMap.set(Ea,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_OPEN_STATUS,".").concat(K.CMD.SUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(Ta,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_OPEN_STATUS,".").concat(K.CMD.UNSUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(Bn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.GET_FRIEND_LIST)}),body:{fromAccount:"",startIndex:0,standardSequence:0,customSequence:0},keyMap:{response:{FriendNum:"friendCount",UserDataItem:"resultList",ValueItem:"tagValueList"}}}}(e)),this._configMap.set(jn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.ADD_FRIEND)}),body:{fromAccount:"",addFriendItem:[],type:""},keyMap:{request:{source:"AddSource",wording:"AddWording",type:"AddType"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set($n,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.UPDATE_FRIEND)}),body:{fromAccount:"",updateItem:void 0},keyMap:{request:{snsItem:"SnsItem"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Yn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.DELETE_FRIEND)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{request:{type:"DeleteType"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(xn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.GET_FRIEND_PROFILE)}),body:{fromAccount:"",userIDList:void 0,tagList:void 0},keyMap:{response:{InfoItem:"resultList",SnsProfileItem:"tagValueList"}}}}(e)),this._configMap.set(Wn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.CHECK_FRIEND)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{request:{type:"CheckType"},response:{InfoItem:"resultList"}}}}(e)),this._configMap.set(Jn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.GET_FRIEND_APPLICATION_LIST)}),body:{fromAccount:"",applicationType:"",startTime:0,maxLimited:0,lastSequence:0},keyMap:{response:{PendencyItem:"resultList",AddSource:"source",AddTime:"time",AddWording:"wording",Image:"avatar",UnreadPendencyCount:"unreadCount",To_Account:"userID",PendencyType:"type"}}}}(e)),this._configMap.set(zn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.RESPOND_FRIEND_APPLICATION)}),body:{fromAccount:"",responseFriendItem:[]},keyMap:{request:{tag:"TagName",action:"ResponseAction"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Xn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.DELETE_FRIEND_APPLICATION)}),body:{fromAccount:"",type:"",userIDList:void 0},keyMap:{request:{type:"PendencyType",userIDList:"To_Account"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Qn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.REPORT_FRIEND_APPLICATION)}),body:{fromAccount:"",latestTimeStamp:""},keyMap:{request:{latestTimeStamp:"LatestPendencyTimeStamp"}}}}(e)),this._configMap.set(eo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.CREATE_FRIEND_GROUP)}),body:{fromAccount:"",groupName:void 0,userIDList:void 0},keyMap:{request:{groupName:"GroupName",userIDList:"To_Account"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(to,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.DELETE_FRIEND_GROUP)}),body:{fromAccount:"",nameList:void 0},keyMap:{request:{nameList:"GroupName"}}}}(e)),this._configMap.set(Zn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.GET_FRIEND_GROUP_LIST)}),body:{fromAccount:"",lastSequence:0,needFriend:"Need_Friend_Type_Yes"},keyMap:{response:{ResultItem:"resultList",GroupName:"name",FriendNumber:"friendCount",To_Account:"userIDList"}}}}(e)),this._configMap.set(no,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.FRIEND,".").concat(K.CMD.UPDATE_FRIEND_GROUP)}),body:{fromAccount:"",oldName:"",newName:void 0,updateGroupItem:void 0},keyMap:{request:{oldName:"GroupOldName",newName:"GroupNewName"},response:{UpdateType:"type",ResultItem:"resultList"}}}}(e)),this._configMap.set(mo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.GET_JOINED_GROUPS)}),body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0},keyMap:{request:{memberAccount:"Member_Account"},response:{GroupIdList:"groups",NoUnreadSeqList:"excludedUnreadSequenceList",MsgSeq:"readedSequence"}}}}(e)),this._configMap.set(Mo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.GET_GROUP_INFO)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember"],groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{request:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(vo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.CREATE_GROUP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:"",isSupportTopic:void 0},keyMap:{request:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData"},response:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}}(e)),this._configMap.set(Io,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.DESTROY_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(yo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.MODIFY_GROUP_INFO)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,maxMemberNum:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0},keyMap:{request:{maxMemberNum:"MaxMemberCount",groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl"},response:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(Eo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{request:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},response:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}}(e)),this._configMap.set(To,function(e){e.a2,e.tinyid;return{head:t(t({},_(e,jr)),{},{servcmd:"".concat(K.NAME.BIG_GROUP_NO_AUTH,".").concat(K.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{request:{applyMessage:"ApplyMsg"},response:{HugeGroupFlag:"avChatRoomFlag"}}}}(e)),this._configMap.set(So,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.QUIT_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(Do,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.SEARCH_GROUP_BY_ID)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption"]}},keyMap:{response:{}}}}(e)),this._configMap.set(Co,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.CHANGE_GROUP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{request:{newOwnerID:"NewOwner_Account"}}}}(e)),this._configMap.set(No,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.HANDLE_APPLY_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(Ao,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.HANDLE_GROUP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(bo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.GET_GROUP_APPLICATION)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{request:{handleAccount:"Handle_Account"}}}}(e)),this._configMap.set(Fo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.DELETE_GROUP_SYSTEM_MESSAGE)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(qo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.BIG_GROUP_LONG_POLLING,".").concat(K.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(e)),this._configMap.set(Vo,function(e){e.a2,e.tinyid;return{head:t(t({},_(e,$r)),{},{servcmd:"".concat(K.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,".").concat(K.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID"}}}}(e)),this._configMap.set(Ho,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.GET_ONLINE_MEMBER_NUM)}),body:{groupID:void 0}}}(e)),this._configMap.set(xo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.SET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(Wo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.MODIFY_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(Yo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.DELETE_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key"}}}}(e)),this._configMap.set(jo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.CLEAR_GROUP_ATTRIBUTES)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}}(e)),this._configMap.set($o,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP_ATTR,".").concat(K.CMD.GET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{request:{avChatRoomKey:"Key",groupType:"GroupType"}}}}(e)),this._configMap.set(fa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP_COMMUNITY,".").concat(K.CMD.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{request:{avatar:"FaceUrl"}}}}(e)),this._configMap.set(ma,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP_COMMUNITY,".").concat(K.CMD.DELETE_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:"TopicIdList"},response:{DestroyResultItem:"resultList"}}}}(e)),this._configMap.set(Ma,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP_COMMUNITY,".").concat(K.CMD.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{request:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}}(e)),this._configMap.set(va,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP_COMMUNITY,".").concat(K.CMD.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:"TopicIdList"},response:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence"}}}}(e)),this._configMap.set(zo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.GET_GROUP_MEMBER_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:["Role","NameCard","ShutUpUntil","JoinTime"],memberCustomFieldFilter:void 0},keyMap:{request:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}}(e)),this._configMap.set(Jo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.GET_GROUP_MEMBER_INFO)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{request:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}}(e)),this._configMap.set(Xo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.ADD_GROUP_MEMBER)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{request:{userID:"Member_Account",userIDList:"MemberList"},response:{MemberList:"members"}}}}(e)),this._configMap.set(Qo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.DELETE_GROUP_MEMBER)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{request:{userIDList:"MemberToDel_Account"}}}}(e)),this._configMap.set(Zo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.GROUP,".").concat(K.CMD.MODIFY_GROUP_MEMBER_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{request:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}}(e)),this._configMap.set(oa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_OPEN_STAT,".").concat(K.CMD.TIM_WEB_REPORT_V2)}),body:{header:{},event:[],quality:[]},keyMap:{request:{SDKType:"sdk_type",SDKVersion:"sdk_version",deviceType:"device_type",platform:"platform",instanceID:"instance_id",traceID:"trace_id",SDKAppID:"sdk_app_id",userID:"user_id",tinyID:"tiny_id",extension:"extension",timestamp:"timestamp",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",qualityType:"quality_type",reportIndex:"report_index",wholePeriod:"whole_period",totalCount:"total_count",rttCount:"success_count_business",successRateOfRequest:"percent_business",countLessThan1Second:"success_count_business",percentOfCountLessThan1Second:"percent_business",countLessThan3Second:"success_count_platform",percentOfCountLessThan3Second:"percent_platform",successCountOfBusiness:"success_count_business",successRateOfBusiness:"percent_business",successCountOfPlatform:"success_count_platform",successRateOfPlatform:"percent_platform",successCountOfMessageReceived:"success_count_business",successRateOfMessageReceived:"percent_business",avgRTT:"average_value",avgDelay:"average_value",avgValue:"average_value",uiPlatform:"ui_platform"}}}}(o)),this._configMap.set(aa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.HEARTBEAT,".").concat(K.CMD.ALIVE)}),body:{}}}(e)),this._configMap.set(sa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_OPEN_PUSH,".").concat(K.CMD.MESSAGE_PUSH)}),body:{},keyMap:{response:{C2cMsgArray:"C2CMessageArray",GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",C2cNotifyMsgArray:"C2CNotifyMessageArray",C2cMsgInfo:"C2CReadReceiptArray",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyAdd_Account:"userID",ProfileImNick:"nick",PendencyType:"applicationType",C2CReadAllMsg:"readAllC2CMessage",IsNeedReadReceipt:"needReadReceipt",Status:"statusType"}}}}(e)),this._configMap.set(ra,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_OPEN_PUSH,".").concat(K.CMD.MULTI_MESSAGE_PUSH)}),body:{},keyMap:{response:{GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyType:"applicationType"}}}}(e)),this._configMap.set(ia,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.OPEN_IM,".").concat(K.CMD.MESSAGE_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{request:{sessionData:"SessionData"}}}}(e)),this._configMap.set(ca,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_OPEN_STATUS,".").concat(K.CMD.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{response:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(la,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_LONG_MESSAGE,".").concat(K.CMD.DOWNLOAD_MERGER_MESSAGE)}),body:{downloadKey:""},keyMap:{response:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}}(e)),this._configMap.set(ua,function(e){return{head:t(t({},e),{},{servcmd:"".concat(K.NAME.IM_LONG_MESSAGE,".").concat(K.CMD.UPLOAD_MERGER_MESSAGE)}),body:{messageList:[]},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",type:"MsgType",content:"MsgContent",data:"Data",description:"Desc",extension:"Ext",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody"}}}}(e))}},{key:"has",value:function(e){return this._configMap.has(e)}},{key:"get",value:function(e){return this._configMap.get(e)}},{key:"update",value:function(){this._fillConfigMap()}},{key:"getKeyMap",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(we.warn("".concat(this._className,".getKeyMap unknown protocolName:").concat(e)),{})}},{key:"getProtocolData",value:function(e){var t=e.protocolName,n=e.requestData,o=this.get(t),a=null;if(n){var s=this._simpleDeepCopy(o),r=this._updateService(n,s),i=r.body,c=Object.create(null);for(var u in i)if(Object.prototype.hasOwnProperty.call(i,u)){if(c[u]=i[u],void 0===n[u])continue;c[u]=n[u]}r.body=c,a=this._getUplinkData(r)}else a=this._getUplinkData(o);return a}},{key:"_getUplinkData",value:function(e){var t=this._requestDataCleaner(e),n=Ut(t.head),o=Or(t.body,this._getRequestKeyMap(n));return t.body=o,t}},{key:"_updateService",value:function(e,t){var n=Ut(t.head);if(t.head.servcmd.includes(K.NAME.GROUP)){var o=e.type,a=e.groupID,s=void 0===a?void 0:a,r=e.groupIDList,i=void 0===r?[]:r;et(s)&&(s=i[0]||""),Tt({type:o,groupID:s})&&(t.head.servcmd="".concat(K.NAME.GROUP_COMMUNITY,".").concat(n))}return t}},{key:"_getRequestKeyMap",value:function(e){var n=this.getKeyMap(e);return t(t({},Ar.request),n.request)}},{key:"_requestDataCleaner",value:function(e){var t=Array.isArray(e)?[]:Object.create(null);for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&rt(o)&&null!==e[o]&&void 0!==e[o]&&("object"!==n(e[o])?t[o]=e[o]:t[o]=this._requestDataCleaner.bind(this)(e[o]));return t}},{key:"_simpleDeepCopy",value:function(e){for(var t,n=Object.keys(e),o={},a=0,s=n.length;a1e3*a)return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;i+=1,this._commandRequestInfoMap.set(t,{startTime:r,requestCount:i});var c=!1;return i>o&&(c=!0),c}},{key:"_isServerOverload",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var t=this._serverOverloadInfoMap.get(e),n=t.overloadTime,o=t.waitingTime,a=!1;return Date.now()-n<=1e3*o?a=!0:(this._serverOverloadInfoMap.delete(e),a=!1),a}},{key:"onPushedServerOverload",value:function(e){var t=e.overloadCommand,n=e.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:n}),we.warn("".concat(this._className,".onPushedServerOverload waitingTime:").concat(n,"s"))}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._updateCommandFrequencyLimitMap(Qr),this._commandRequestInfoMap.clear(),this._serverOverloadInfoMap.clear()}}]),n}(Ln),ei=function(e){i(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._className="MessageLossDetectionModule",a._maybeLostSequencesMap=new Map,a._firstRoundRet=[],a}return s(n,[{key:"onMessageMaybeLost",value:function(e,t,n){this._maybeLostSequencesMap.has(e)||this._maybeLostSequencesMap.set(e,[]);for(var o=this._maybeLostSequencesMap.get(e),a=0;a=this._expiredTime}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetchConfig();if(we.log("".concat(this._className,".fetchConfig canFetchConfig:").concat(t)),t){var n=new Va(Ha.FETCH_CLOUD_CONTROL_CONFIG),o=this.getModule(_n).getSDKAppID();this._isFetching=!0,this.request({protocolName:da,requestData:{SDKAppID:o,version:this._version}}).then((function(t){e._isFetching=!1,n.setMessage("version:".concat(e._version," newVersion:").concat(t.data.version," config:").concat(t.data.cloudControlConfig)).setNetworkType(e.getNetworkType()).end(),we.log("".concat(e._className,".fetchConfig ok")),e._parseCloudControlConfig(t.data)})).catch((function(t){e._isFetching=!1,e.probeNetwork().then((function(e){var o=m(e,2),a=o[0],s=o[1];n.setError(t,a,s).end()})),we.log("".concat(e._className,".fetchConfig failed. error:"),t),e._setExpiredTimeOnResponseError(12e4)}))}}},{key:"onPushedCloudControlConfig",value:function(e){we.log("".concat(this._className,".onPushedCloudControlConfig")),new Va(Ha.PUSHED_CLOUD_CONTROL_CONFIG).setNetworkType(this.getNetworkType()).setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parseCloudControlConfig(e)}},{key:"onCheckTimer",value:function(e){this._canFetchConfig()&&this.fetchConfig()}},{key:"_parseCloudControlConfig",value:function(e){var t=this,n="".concat(this._className,"._parseCloudControlConfig"),o=e.errorCode,a=e.errorMessage,s=e.cloudControlConfig,r=e.version,i=e.expiredTime;if(0===o){if(this._version!==r){var c=null;try{c=JSON.parse(s)}catch(u){we.error("".concat(n," JSON parse error:").concat(s))}c&&(this._cloudConfig.clear(),Object.keys(c).forEach((function(e){t._cloudConfig.set(e,c[e])})),this._version=r,this.emitInnerEvent(Ms))}this._expiredTime=Date.now()+1e3*i}else et(o)?(we.log("".concat(n," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(we.error("".concat(n," errorCode:").concat(o," errorMessage:").concat(a)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),n}(Ln),ni=function(e){i(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._className="PullGroupMessageModule",a._remoteLastMessageSequenceMap=new Map,a.PULL_LIMIT_COUNT=15,a}return s(n,[{key:"startPull",value:function(){var e=this,t=this._getNeedPullConversationList();this._getRemoteLastMessageSequenceList().then((function(){var n=e.getModule(pn);t.forEach((function(t){var o=t.conversationID,a=o.replace(C.CONV_GROUP,""),s=n.getGroupLocalLastMessageSequence(o),r=e._remoteLastMessageSequenceMap.get(a)||0,i=r-s;we.log("".concat(e._className,".startPull groupID:").concat(a," localLastMessageSequence:").concat(s," ")+"remoteLastMessageSequence:".concat(r," diff:").concat(i)),s>0&&i>=1&&i<300&&e._pullMissingMessage({groupID:a,localLastMessageSequence:s,remoteLastMessageSequence:r,diff:i})}))}))}},{key:"_getNeedPullConversationList",value:function(){return this.getModule(pn).getLocalConversationList().filter((function(e){return e.type===C.CONV_GROUP&&e.groupProfile.type!==C.GRP_AVCHATROOM}))}},{key:"_getRemoteLastMessageSequenceList",value:function(){var e=this;return this.getModule(cn).getGroupList().then((function(t){for(var n=t.data.groupList,o=void 0===n?[]:n,a=0;athis.PULL_LIMIT_COUNT?this.PULL_LIMIT_COUNT:a,e.sequence=a>this.PULL_LIMIT_COUNT?n+this.PULL_LIMIT_COUNT:n+a,this._getGroupMissingMessage(e).then((function(s){s.length>0&&(s[0].sequence+1<=o&&(e.localLastMessageSequence=n+t.PULL_LIMIT_COUNT,e.diff=a-t.PULL_LIMIT_COUNT,t._pullMissingMessage(e)),t.getModule(cn).onNewGroupMessage({dataList:s,isInstantMessage:!1}))}))}},{key:"_getGroupMissingMessage",value:function(e){var t=this,n=new Va(Ha.GET_GROUP_MISSING_MESSAGE);return this.request({protocolName:ko,requestData:{groupID:e.groupID,count:e.count,sequence:e.sequence}}).then((function(o){var a=o.data.messageList,s=void 0===a?[]:a;return n.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(e.groupID," count:").concat(e.count," sequence:").concat(e.sequence," messageList length:").concat(s.length)).end(),s})).catch((function(e){t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()}))}))}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._remoteLastMessageSequenceMap.clear()}}]),n}(Ln),oi=function(){function e(){o(this,e),this._className="AvgE2EDelay",this._e2eDelayArray=[]}return s(e,[{key:"addMessageDelay",value:function(e){var t=ke()-e;t>=0&&this._e2eDelayArray.push(t)}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),wt(n/t,1)}},{key:"_calcCountWithLimit",value:function(e){var t=e.e2eDelayArray,n=e.min,o=e.max;return t.filter((function(e){return n<=e&&e100&&(n=100),n}},{key:"_checkE2EDelayException",value:function(e,t){var n=e.filter((function(e){return e>t}));if(n.length>0){var o=n.length,a=Math.min.apply(Math,M(n)),s=Math.max.apply(Math,M(n)),r=this._calcAvg(n,o),i=wt(o/e.length*100,2);if(i>50)new Va(Ha.MESSAGE_E2E_DELAY_EXCEPTION).setMessage("message e2e delay exception. count:".concat(o," min:").concat(a," max:").concat(s," avg:").concat(r," percent:").concat(i)).setLevel("warning").end()}}},{key:"getStatResult",value:function(){var e=this._e2eDelayArray.length;if(0===e)return null;var t=M(this._e2eDelayArray),n=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),o=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),a=this._calcPercent(n,e),s=this._calcPercent(o,e),r=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:n,percentOfCountLessThan1Second:a,countLessThan3Second:o,percentOfCountLessThan3Second:s,avgDelay:r}}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),e}(),ai=function(){function e(){o(this,e),this._className="AvgRTT",this._requestCount=0,this._rttArray=[]}return s(e,[{key:"addRequestCount",value:function(){this._requestCount+=1}},{key:"addRTT",value:function(e){this._rttArray.push(e)}},{key:"_calcTotalCount",value:function(){return this._requestCount}},{key:"_calcRTTCount",value:function(e){return e.length}},{key:"_calcSuccessRateOfRequest",value:function(e,t){if(0===t)return 0;var n=wt(e/t*100,2);return n>100&&(n=100),n}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),parseInt(n/t)}},{key:"_calcMax",value:function(){return Math.max.apply(Math,M(this._rttArray))}},{key:"_calcMin",value:function(){return Math.min.apply(Math,M(this._rttArray))}},{key:"getStatResult",value:function(){var e=this._calcTotalCount(),t=M(this._rttArray);if(0===e)return null;var n=this._calcRTTCount(t),o=this._calcSuccessRateOfRequest(n,e),a=this._calcAvg(t,n);return we.log("".concat(this._className,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(a)),this.reset(),{totalCount:e,rttCount:n,successRateOfRequest:o,avgRTT:a}}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),e}(),si=function(){function e(){o(this,e),this._map=new Map}return s(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}))}},{key:"addTotalCount",value:function(e){return!(et(e)||!this._map.has(e))&&(this._map.get(e).totalCount+=1,!0)}},{key:"addSuccessCount",value:function(e){return!(et(e)||!this._map.has(e))&&(this._map.get(e).successCount+=1,!0)}},{key:"addFailedCountOfUserSide",value:function(e){return!(et(e)||!this._map.has(e))&&(this._map.get(e).failedCountOfUserSide+=1,!0)}},{key:"addCost",value:function(e,t){return!(et(e)||!this._map.has(e))&&(this._map.get(e).costArray.push(t),!0)}},{key:"addFileSize",value:function(e,t){return!(et(e)||!this._map.has(e))&&(this._map.get(e).fileSizeArray.push(t),!0)}},{key:"_calcSuccessRateOfBusiness",value:function(e){if(et(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=wt(t.successCount/t.totalCount*100,2);return n>100&&(n=100),n}},{key:"_calcSuccessRateOfPlatform",value:function(e){if(et(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return(n=wt(n,2))>100&&(n=100),n}},{key:"_calcTotalCount",value:function(e){return et(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(e){return et(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(e){if(et(e)||!this._map.has(e))return-1;var t=this._map.get(e);return t.successCount+t.failedCountOfUserSide}},{key:"_calcAvg",value:function(e){return et(e)||!this._map.has(e)?-1:e===ka?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:"_calcAvgCost",value:function(e){var t=this._map.get(e).costArray.length;if(0===t)return 0;var n=0;return this._map.get(e).costArray.forEach((function(e){n+=e})),parseInt(n/t)}},{key:"_calcAvgSpeed",value:function(e){var t=0,n=0;return this._map.get(e).costArray.forEach((function(e){t+=e})),this._map.get(e).fileSizeArray.forEach((function(e){n+=e})),parseInt(1e3*n/t)}},{key:"getStatResult",value:function(e){var t=this._calcTotalCount(e);if(0===t)return null;var n=this._calcSuccessCountOfBusiness(e),o=this._calcSuccessRateOfBusiness(e),a=this._calcSuccessCountOfPlatform(e),s=this._calcSuccessRateOfPlatform(e),r=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:n,successRateOfBusiness:o,successCountOfPlatform:a,successRateOfPlatform:s,avgValue:r}}},{key:"reset",value:function(e){et(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),e}(),ri=function(){function e(){o(this,e),this._lastMap=new Map,this._currentMap=new Map}return s(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._lastMap.set(e,new Map),t._currentMap.set(e,new Map)}))}},{key:"addMessageSequence",value:function(e){var t=e.key,n=e.message;if(et(t)||!this._lastMap.has(t)||!this._currentMap.has(t))return!1;var o=n.conversationID,a=n.sequence,s=o.replace(C.CONV_GROUP,"");if(0===this._lastMap.get(t).size)this._addCurrentMap(e);else if(this._lastMap.get(t).has(s)){var r=this._lastMap.get(t).get(s),i=r.length-1;a>r[0]&&a100&&(o=100),this._copyData(e),{totalCount:t,successCountOfMessageReceived:n,successRateOfMessageReceived:o}}},{key:"reset",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),e}(),ii=function(e){i(a,e);var n=f(a);function a(e){var t;o(this,a),(t=n.call(this,e))._className="QualityStatModule",t.TAG="im-ssolog-quality-stat",t.reportIndex=0,t.wholePeriod=!1,t._qualityItems=[Ca,Na,Aa,La,Ra,Oa,ka,Ga,Pa,Ua],t._messageSentItems=[Aa,La,Ra,Oa,ka],t._messageReceivedItems=[Ga,Pa,Ua],t.REPORT_INTERVAL=120,t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._statInfoArr=[],t._avgRTT=new ai,t._avgE2EDelay=new oi,t._rateMessageSent=new si,t._rateMessageReceived=new ri;var s=t.getInnerEmitterInstance();return s.on(ms,t._onLoginSuccess,g(t)),s.on(Ms,t._onCloudConfigUpdated,g(t)),t}return s(a,[{key:"_onLoginSuccess",value:function(){var e=this;this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems);var t=this.getModule(gn),n=t.getItem(this.TAG,!1);!Bt(n)&&ot(n.forEach)&&(we.log("".concat(this._className,"._onLoginSuccess.get quality stat log in storage, nums=").concat(n.length)),n.forEach((function(t){e._statInfoArr.push(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),n=this.getCloudConfig("q_rpt_tinyid_wl");et(e)||(this.REPORT_INTERVAL=Number(e)),et(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map((function(e){return Number(e)}))),et(n)||(this.REPORT_TINYID_WHITELIST=n.split(","))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}},{key:"addRequestCount",value:function(){this._avgRTT.addRequestCount()}},{key:"addRTT",value:function(e){this._avgRTT.addRTT(e)}},{key:"addMessageDelay",value:function(e){this._avgE2EDelay.addMessageDelay(e)}},{key:"addTotalCount",value:function(e){this._rateMessageSent.addTotalCount(e)||we.warn("".concat(this._className,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||we.warn("".concat(this._className,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||we.warn("".concat(this._className,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,t){this._rateMessageSent.addCost(e,t)||we.warn("".concat(this._className,".addCost invalid key or cost:"),e,t)}},{key:"addFileSize",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||we.warn("".concat(this._className,".addFileSize invalid key or size:"),e,t)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||we.warn("".concat(this._className,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var n={},o=Fa[this.getNetworkType()];et(o)&&(o=8);var a={qualityType:wa[e],timestamp:Re(),networkType:o,extension:""};switch(e){case Ca:n=this._avgRTT.getStatResult();break;case Na:n=this._avgE2EDelay.getStatResult();break;case Aa:case La:case Ra:case Oa:case ka:n=this._rateMessageSent.getStatResult(e);break;case Ga:case Pa:case Ua:n=this._rateMessageReceived.getStatResult(e)}return null===n?null:t(t({},a),n)}},{key:"_report",value:function(e){var t=this,n=[],o=null;et(e)?this._qualityItems.forEach((function(e){null!==(o=t._getQualityItem(e))&&(o.reportIndex=t.reportIndex,o.wholePeriod=t.wholePeriod,n.push(o))})):null!==(o=this._getQualityItem(e))&&(o.reportIndex=this.reportIndex,o.wholePeriod=this.wholePeriod,n.push(o)),we.debug("".concat(this._className,"._report"),n),this._statInfoArr.length>0&&(n=n.concat(this._statInfoArr),this._statInfoArr=[]);var a=this.getModule(_n),s=a.getSDKAppID(),r=a.getTinyID();bt(this.REPORT_SDKAPPID_BLACKLIST,s)&&!Ft(this.REPORT_TINYID_WHITELIST,r)&&(n=[]),n.length>0&&this._doReport(n)}},{key:"_doReport",value:function(e){var n=this,o={header:dr(this),quality:e};this.request({protocolName:oa,requestData:t({},o)}).then((function(){n.reportIndex++,n.wholePeriod=!1})).catch((function(t){we.warn("".concat(n._className,"._doReport, online:").concat(n.getNetworkType()," error:"),t),n._statInfoArr=n._statInfoArr.concat(e),n._flushAtOnce()}))}},{key:"_flushAtOnce",value:function(){var e=this.getModule(gn),t=e.getItem(this.TAG,!1),n=this._statInfoArr;if(Bt(t))we.log("".concat(this._className,"._flushAtOnce count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var o=n.concat(t);o.length>10&&(o=o.slice(0,10)),we.log("".concat(this.className,"._flushAtOnce count:").concat(o.length)),e.setItem(this.TAG,o,!0,!1)}this._statInfoArr=[]}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._report(),this.reportIndex=0,this.wholePeriod=!1,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._avgRTT.reset(),this._avgE2EDelay.reset(),this._rateMessageSent.reset(),this._rateMessageReceived.reset()}}]),a}(Ln),ci=s((function e(t){o(this,e),Bt(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",this.time=t.time||0,this.source=t.source||"",this.wording=t.wording||"",this.type=t.type||"")})),ui=function(){function e(t){o(this,e),this._snsModule=t,this._className="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSequence=0,this._friendApplicationMap=new Map,this._unreadCount=0}return s(e,[{key:"getLocalFriendApplicationList",value:function(){return{friendApplicationList:M(this._friendApplicationMap.values()),unreadCount:this._unreadCount}}},{key:"_onFriendApplicationListUpdated",value:function(){this._snsModule.emitOuterEvent(D.FRIEND_APPLICATION_LIST_UPDATED,{friendApplicationList:M(this._friendApplicationMap.values()),unreadCount:this._unreadCount})}},{key:"onFriendApplicationRead",value:function(){this._unreadCount=0,this._onFriendApplicationListUpdated()}},{key:"onFriendApplicationAdded",value:function(e,n){var o=this;if(!Bt(e)){var a="";a=n===this._snsModule.getMyUserID()?C.SNS_APPLICATION_SENT_BY_ME:C.SNS_APPLICATION_SENT_TO_ME;var s=!1;e.forEach((function(e){var n="".concat(e.userID,"_").concat(a);a!==C.SNS_APPLICATION_SENT_TO_ME||o._friendApplicationMap.has(n)||(o._unreadCount+=1),o._friendApplicationMap.set(n,new ci(t(t({},e),{},{type:a}))),s=!0})),s&&this._onFriendApplicationListUpdated()}}},{key:"onFriendApplicationDeleted",value:function(e){Bt(e)||this.getFriendApplicationList()}},{key:"getFriendApplicationList",value:function(){var e=this,t=new Va(Ha.GET_FRIEND_APPLICATION_LIST),n="".concat(this._className,".getFriendApplicationList");return this._snsModule.request({protocolName:Jn,requestData:{applicationType:C.SNS_APPLICATION_TYPE_BOTH,fromAccount:this._snsModule.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSequence}}).then((function(o){var a=o.data,s=a.resultList,r=a.unreadCount,i=a.startTime,c=a.currentSequence;e._startTime=i,e._currentSequence=c,e._unreadCount=r;var u=Ze(s)?s.length:0;t.setNetworkType(e._snsModule.getNetworkType()).setMessage("applicationCount:".concat(u," unreadCount:").concat(r)).end(),we.info("".concat(n," ok. applicationCount:").concat(u," unreadCount:").concat(r)),e._friendApplicationMap.clear(),Ze(s)&&s.forEach((function(t){var n=t.userID,o=t.type,a=new ci(t);e._friendApplicationMap.set("".concat(n,"_").concat(o),a)})),e._onFriendApplicationListUpdated()})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];t.setError(o,a,s).end()})),we.warn("".concat(n," failed. error:"),o),gs(o)}))}},{key:"deleteFriendApplication",value:function(e){var t=this,n="".concat(this._className,".deleteFriendApplication"),o=e.userID,a=e.type;if((!a||a!==C.SNS_APPLICATION_SENT_BY_ME&&a!==C.SNS_APPLICATION_SENT_TO_ME)&&(a=C.SNS_APPLICATION_SENT_TO_ME),!this._friendApplicationMap.has("".concat(o,"_").concat(a)))return gs({code:Sa.FRIEND_APPLICATION_NOT_EXIST,message:Da.FRIEND_APPLICATION_NOT_EXIST});var s=new Va(Ha.DELETE_FRIEND_APPLICATION);return s.setMessage("userID:".concat(o," type:").concat(a)),this._snsModule.request({protocolName:Xn,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:[o],type:a}}).then((function(e){var r=e.data.resultList,i=r[0],c=i.to,u=i.resultCode,l=i.resultInfo;return s.setNetworkType(t._snsModule.getNetworkType()).setMoreMessage("resultList:".concat(JSON.stringify(r))).end(),we.info("".concat(n," ok. userID:").concat(o," type:").concat(a)),0===u?as():gs({userID:c,code:u,message:l})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"acceptFriendApplication",value:function(e){var t=this,n="".concat(this._className,".acceptFriendApplication"),o=e.userID,a=e.remark,s=e.tag,r=e.type;(!r||r!==C.SNS_APPLICATION_AGREE&&r!==C.SNS_APPLICATION_AGREE_AND_ADD)&&(r=C.SNS_APPLICATION_AGREE_AND_ADD);var i=new Va(Ha.ACCEPT_FRIEND_APPLICATION);return i.setMessage("userID:".concat(o," type:").concat(r)),this._snsModule.request({protocolName:zn,requestData:{fromAccount:this._snsModule.getMyUserID(),responseFriendItem:[{userID:o,remark:a,tag:s,action:r}]}}).then((function(e){i.setNetworkType(t._snsModule.getNetworkType()).end();var a=e.data.resultList[0],s=a.resultCode,c=a.resultInfo;if(0!==s)return gs({code:s,message:c});we.info("".concat(n," ok. userID:").concat(o," type:").concat(r))})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"refuseFriendApplication",value:function(e){var t=this,n="".concat(this._className,".refuseFriendApplication"),o=e.userID,a=new Va(Ha.REFUSE_FRIEND_APPLICATION);return a.setMessage("userID:".concat(o)),this._snsModule.request({protocolName:zn,requestData:{fromAccount:this._snsModule.getMyUserID(),responseFriendItem:[{userID:o,action:"Response_Action_Reject"}]}}).then((function(e){a.setNetworkType(t._snsModule.getNetworkType()).end();var s=e.data.resultList[0],r=s.resultCode,i=s.resultInfo;if(0!==r)return gs({code:r,message:i});we.info("".concat(n," ok. userID:").concat(o))})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"_onFriendApplicationProcessed",value:function(e){var t=this;if(0!==e.length){var n=!1;e.forEach((function(e){var o="".concat(e.to,"_").concat(C.SNS_APPLICATION_SENT_TO_ME);t._friendApplicationMap.has(o)&&(t._friendApplicationMap.delete(o),t._unreadCount-=1,n=!0)})),this._unreadCount<0&&(this._unreadCount=0),n&&this._onFriendApplicationListUpdated()}}},{key:"setFriendApplicationRead",value:function(){var e=this,t="".concat(this._className,".setFriendApplicationRead"),n=new Va(Ha.SET_FRIEND_APPLICATION_READ);return this._snsModule.request({protocolName:Qn,requestData:{fromAccount:this._snsModule.getMyUserID(),latestTimeStamp:wt(Re()/1e3,0)}}).then((function(o){n.setNetworkType(e._snsModule.getNetworkType()).end(),we.info("".concat(t," ok")),e._unreadCount=0})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];n.setError(o,a,s).end()})),we.warn("".concat(t," failed. error:"),o),gs(o)}))}},{key:"reset",value:function(){this._startIndex=0,this._maxLimited=100,this._currentSequence=0,this._unreadCount=0,this._friendApplicationMap.clear()}}]),e}(),li=function(){function e(t,n){o(this,e),this.userID=t,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;var a={};if(a.userID=t,!Bt(n))for(var s="",r="",i=0,c=n.length;i-1)this.friendCustomField.push({key:s,value:r});else switch(s){case Fe.NICK:a.nick=r;break;case Fe.GENDER:a.gender=r;break;case Fe.BIRTHDAY:a.birthday=r;break;case Fe.LOCATION:a.location=r;break;case Fe.SELFSIGNATURE:a.selfSignature=r;break;case Fe.ALLOWTYPE:a.allowType=r;break;case Fe.LANGUAGE:a.language=r;break;case Fe.AVATAR:a.avatar=r;break;case Fe.MESSAGESETTINGS:a.messageSettings=r;break;case Fe.ADMINFORBIDTYPE:a.adminForbidType=r;break;case Fe.LEVEL:a.level=r;break;case Fe.ROLE:a.role=r;break;case qe.REMARK:this.remark=r;break;case qe.ADDTIME:this.addTime=r;break;case qe.GROUP:this.groupList=JSON.parse(JSON.stringify(r));break;case qe.ADDSOURCE:this.source=r;break;case qe.ADDWORDING:break;default:we.log("snsProfileItem unkown tag->",n[i].tag)}this.profile=new Ns(a)}return s(e,[{key:"validate",value:function(e){var t=!0,n="";if(Bt(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,a=null,s=0;s500&&(n="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(dt(e[r])," bytes"),t=!1);break;case"gender":ht(Ve,e.gender)||(n="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":ze(e.birthday)||(n="birthday should be a number",t=!1);break;case"location":Je(e.location)||(n="location should be a string",t=!1);break;case"selfSignature":Je(e.selfSignature)||(n="selfSignature should be a string",t=!1);break;case"allowType":ht(Ke,e.allowType)||(n="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":ze(e.language)||(n="language should be a number",t=!1);break;case"avatar":Je(e.avatar)||(n="avatar should be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n="messageSettings should be 0 or 1",t=!1);break;case"adminForbidType":ht(He,e.adminForbidType)||(n="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":ze(e.level)||(n="level should be a number",t=!1);break;case"role":ze(e.role)||(n="role should be a number",t=!1);break;default:n="unknown key:"+r+" "+e[r],t=!1}}return{valid:t,tips:n}}},{key:"update",value:function(e){for(var t="",n="",o=0,a=e.length;o-1)this.friendCustomField.forEach((function(e){e.key===t&&(e.value=n)}));else if(t.indexOf("Tag_Profile_Custom")>-1)this.profile.profileCustomField.forEach((function(e){e.key===t&&(e.value=n)}));else switch(t){case Fe.NICK:this.profile.nick=n;break;case Fe.GENDER:this.profile.gender=n;break;case Fe.BIRTHDAY:this.profile.birthday=n;break;case Fe.LOCATION:this.profile.location=n;break;case Fe.SELFSIGNATURE:this.profile.selfSignature=n;break;case Fe.ALLOWTYPE:this.profile.allowType=n;break;case Fe.LANGUAGE:this.profile.language=n;break;case Fe.AVATAR:this.profile.avatar=n;break;case Fe.MESSAGESETTINGS:this.profile.messageSettings=n;break;case Fe.ADMINFORBIDTYPE:this.profile.adminForbidType=n;break;case Fe.LEVEL:this.profile.level=n;break;case Fe.ROLE:this.profile.role=n;break;case qe.REMARK:this.remark=n;break;case qe.ADDTIME:this.addTime=n;break;case qe.GROUP:this.groupList=JSON.parse(JSON.stringify(n));break;case qe.ADDSOURCE:this.source=n;break;case qe.ADDWORDING:break;default:we.log("snsProfileItem unkown tag->",e[o].tag)}this.timestamp=Date.now()}},{key:"updateProfile",value:function(e){this.profile=JSON.parse(JSON.stringify(e)),this.timestamp=Date.now()}},{key:"addToGroupList",value:function(e){-1===this.groupList.indexOf(e)&&(this.groupList.push(e),this.count=this.groupList.length)}},{key:"removeFromGroupList",value:function(e){var t=this.groupList.indexOf(e);t>-1&&(this.groupList.splice(t,1),this.count=this.groupList.length)}}]),e}(),di=function(){function e(t){o(this,e),this._snsModule=t,this._className="FriendHandler",this._friendMap=new Map,this._startIndex=0,this._standardSequence=0,this._customSequence=0,this._expirationTime=18e4}return s(e,[{key:"getLocalFriendList",value:function(){return M(this._friendMap.values())}},{key:"getFriendRemark",value:function(e){return this._friendMap.has(e)?this._friendMap.get(e).remark:""}},{key:"onFriendProfileModified",value:function(e){var t=this,n=e.dataList;if(!Bt(n)){var o=this._snsModule.getModule(pn);n.forEach((function(e){var n=e.userID,a=e.profileList;if(t.isMyFriend(n)){we.log("".concat(t._className,".onFriendProfileModified. friend userID:").concat(n));var s=t._friendMap.get(n);s.update(a),o.modifyMessageSentByPeer({conversationID:"".concat(C.CONV_C2C).concat(n),latestNick:s.profile.nick,latestAvatar:s.profile.avatar})}}))}}},{key:"onFriendAdded",value:function(e){var t=this;0!==e.length&&(we.log("".concat(this._className,".onFriendAdded userIDList:").concat(e)),e.forEach((function(e){t._friendMap.set(e,new li(e))})),this.getFriendProfile({userIDList:e}).then((function(n){e.forEach((function(e){var n=t._friendMap.get(e);n.groupList.length>0&&t._snsModule.updateWhenFriendAdded({nameList:n.groupList,userID:e})})),t._onFriendListUpdated()})))}},{key:"onFriendDeleted",value:function(e){var t=this;0!==e.length&&(we.log("".concat(this._className,".onFriendDeleted userIDList:").concat(e)),e.forEach((function(e){var n=t._friendMap.get(e);n.groupList.length>0&&t._snsModule.updateWhenFriendDeleted({nameList:n.groupList,userID:e}),t._friendMap.delete(e)})),this._onFriendListUpdated())}},{key:"_onFriendListUpdated",value:function(){this._snsModule.emitOuterEvent(D.FRIEND_LIST_UPDATED),this._snsModule.getModule(pn).checkAndPatchRemark()}},{key:"getFriendProfile",value:function(e){var t=this,n="".concat(this._className,".getFriendProfile"),o=e.userIDList,a=[],s=[],r=[];if(o.forEach((function(e){if(t._friendMap.has(e)){var n=t._friendMap.get(e);Date.now()-n.timestamp1e3&&(we.warn("".concat(n," 删除好友人数不能超过1000人")),o.length=1e3);var s=[],r=[],i=[];if(o.forEach((function(e){t._friendMap.has(e)?i.push(e):s.push({userID:e,code:Sa.NOT_MY_FRIEND,message:Da.NOT_MY_FRIEND})})),0===i.length)return _s({successUserIDList:r,failureUserIDList:s});var c=a;(!c||c!==C.SNS_DELETE_TYPE_SINGLE&&c!==C.SNS_DELETE_TYPE_BOTH)&&(c=C.SNS_DELETE_TYPE_BOTH);var u=new Va(Ha.DELETE_FRIEND);return u.setMessage("userIDList:".concat(i," type:").concat(c)),this._snsModule.request({protocolName:Yn,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:i,type:c}}).then((function(e){u.setNetworkType(t._snsModule.getNetworkType()).end(),we.info("".concat(n," ok"));var o=e.data.resultList;return Bt(o)||o.forEach((function(e){var t=e.to,n=e.resultCode,o=e.resultInfo;et(n)||0===n?r.push({userID:t}):s.push({userID:t,code:n,message:o})})),as({successUserIDList:r,failureUserIDList:s})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),we.warn("".concat(n," error:"),e),gs(e)}))}},{key:"updateFriend",value:function(e){var t=this,n=e.userID,o=e.remark,a=e.friendCustomField;if(!this._friendMap.has(n))return gs({code:Sa.NOT_MY_FRIEND,message:Da.NOT_MY_FRIEND});var s=new Va(Ha.UPDATE_FRIEND);s.setMessage("userID:".concat(n," remark:").concat(o," friendCustomField:").concat(a));var r="".concat(this._className,".updateFriend"),i=[];return et(o)||i.push({tag:qe.REMARK,value:o}),Ze(a)&&a.length>0&&a.forEach((function(e){i.push({tag:e.key,value:e.value})})),this._snsModule.request({protocolName:$n,requestData:{fromAccount:this._snsModule.getMyUserID(),updateItem:[{to:n,snsItem:i}]}}).then((function(e){s.setNetworkType(t._snsModule.getNetworkType()).end(),we.info("".concat(r," ok"));var n=e.data.resultList[0],i=n.to,c=n.resultCode,u=n.resultInfo;if(et(c)||0===c){var l=t._friendMap.get(i);return l&&(et(o)||(l.remark=o),Ze(a)&&a.length>0&&It(l.friendCustomField,a),t._onFriendListUpdated()),as(l)}return gs({code:c,message:u})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.warn("".concat(r," failed. error:"),e),gs(e)}))}},{key:"checkFriend",value:function(e){var t=this,n="".concat(this._className,".checkFriend"),o=e.userIDList,a=e.type;(!a||a!==C.SNS_CHECK_TYPE_SINGLE&&a!==C.SNS_CHECK_TYPE_BOTH)&&(a=C.SNS_CHECK_TYPE_BOTH);var s=new Va(Ha.CHECK_FRIEND);return s.setMessage("userIDList:".concat(o," type:").concat(a)),this._snsModule.request({protocolName:Wn,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:o,type:a}}).then((function(e){s.setNetworkType(t._snsModule.getNetworkType()).end(),we.info("".concat(n," ok. userIDList:").concat(o," type:").concat(a));var r=[],i=[],c=e.data.resultList;return Ze(c)&&c.forEach((function(e){var t=e.to,n=e.relation,o=e.resultCode,a=e.resultInfo;et(o)||0===o?r.push({userID:t,code:0,relation:n}):i.push({userID:t,code:o,message:a})})),as({successUserIDList:r,failureUserIDList:i})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"updateWhenAddedToFriendGroup",value:function(e){var t=this,n=e.name,o=e.userIDList;we.log("".concat(this._className,".updateWhenAddedToFriendGroup groupName:").concat(n," userIDList:").concat(o)),n&&!Bt(o)&&o.forEach((function(e){t._friendMap.has(e)&&t._friendMap.get(e).addToGroupList(n)}))}},{key:"updateWhenRemovedFromFriendGroup",value:function(e){var t=this,n=e.name,o=e.userIDList;we.log("".concat(this._className,".updateWhenRemovedFromFriendGroup groupName:").concat(n," userIDList:").concat(o)),n&&!Bt(o)&&o.forEach((function(e){t._friendMap.has(e)&&t._friendMap.get(e).removeFromGroupList(n)}))}},{key:"reset",value:function(){this._friendMap.clear(),this._startIndex=0,this._standardSequence=0,this._customSequence=0}}]),e}(),pi=function(){function e(t){o(this,e),Bt(t)||(this.name=t.name||"",this.userIDList=t.userIDList||[],this.count=this.userIDList.length||0)}return s(e,[{key:"addToUserIDList",value:function(e){-1===this.userIDList.indexOf(e)&&(this.userIDList.push(e),this.count=this.userIDList.length)}},{key:"removeFromUserIDList",value:function(e){var t=this.userIDList.indexOf(e);t>-1&&(this.userIDList.splice(t,1),this.count=this.userIDList.length)}}]),e}(),_i=function(){function e(t){o(this,e),this._snsModule=t,this._className="FriendGroupHandler",this._friendGroupMap=new Map}return s(e,[{key:"getLocalFriendGroupList",value:function(){return M(this._friendGroupMap.values())}},{key:"_emitFriendGroupListUpdated",value:function(){var e=M(this._friendGroupMap.values());this._snsModule.emitOuterEvent(D.FRIEND_GROUP_LIST_UPDATED,e)}},{key:"getFriendGroupList",value:function(){var e=this,t=new Va(Ha.GET_FRIEND_GROUP_LIST),n="".concat(this._className,".getFriendGroupList");return this._snsModule.request({protocolName:Zn,requestData:{fromAccount:this._snsModule.getMyUserID()}}).then((function(o){t.setNetworkType(e._snsModule.getNetworkType()).end();var a=o.data.resultList;Bt(a)?we.info("".concat(n," ok. friend group count:0")):(we.info("".concat(n," ok. friend group count:").concat(a.length)),e._friendGroupMap.clear(),a.forEach((function(t){var n=new pi(t);e._friendGroupMap.set(t.name,n)})),e._emitFriendGroupListUpdated())})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];t.setError(o,a,s).end()})),we.warn("".concat(n," error:"),o),gs(o)}))}},{key:"createFriendGroup",value:function(e){var t=this,n="".concat(this._className,".createFriendGroup"),o=e.name,a=e.userIDList;if(this._friendGroupMap.has(o))return we.warn("".concat(n," 好友分组 ").concat(o," 已经存在!")),gs({code:Sa.FRIEND_GROUP_EXISTED,message:Da.FRIEND_GROUP_EXISTED});var s=new Va(Ha.CREATE_FRIEND_GROUP);return s.setMessage("name:".concat(o," userIDList:").concat(a)),this._snsModule.request({protocolName:eo,requestData:{fromAccount:this._snsModule.getMyUserID(),groupName:[o],userIDList:Ze(a)?a:void 0}}).then((function(e){s.setNetworkType(t._snsModule.getNetworkType()).end(),we.log("".concat(n," ok. name:").concat(o," userIDList:").concat(a));var r=e.data.resultList,i=[],c=[];r&&r.forEach((function(e){var t=e.to,n=e.resultCode,o=e.resultInfo;if(et(n)||0===n)i.push(t);else{var a={userID:e.to,code:n,message:o};c.push(a)}}));var u=new pi({name:o,userIDList:i});return t._friendGroupMap.set(o,u),t._snsModule.updateWhenAddedToFriendGroup({name:o,userIDList:i}),t._emitFriendGroupListUpdated(),as({friendGroup:u,failureUserIDList:c})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"deleteFriendGroup",value:function(e){var t=this,n="".concat(this._className,".deleteFriendGroup"),o=e.name;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist(o);var a=new Va(Ha.DELETE_FRIEND_GROUP);return a.setMessage("name:".concat(o)),this._snsModule.request({protocolName:to,requestData:{fromAccount:this._snsModule.getMyUserID(),nameList:[o]}}).then((function(e){a.setNetworkType(t._snsModule.getNetworkType()).end(),we.log("".concat(n," ok. name:").concat(o));var s=t._friendGroupMap.get(o);return s&&(t._snsModule.updateWhenRemovedFromFriendGroup({name:o,userIDList:s.userIDList}),t._friendGroupMap.delete(o),s.userIDList.length=0),t._emitFriendGroupListUpdated(),as(s)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"_onFriendGroupNotExist",value:function(e){return we.warn("".concat(this._className,"._onFriendGroupNotExist 好友分组 ").concat(e," 不存在!")),gs({code:Sa.FRIEND_GROUP_NOT_EXIST,message:Da.FRIEND_GROUP_NOT_EXIST})}},{key:"renameFriendGroup",value:function(e){var t=this,n="".concat(this._className,".renameFriendGroup"),o=e.oldName,a=e.newName;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist();var s=new Va(Ha.RENAME_FRIEND_GROUP).setMessage("oldName:".concat(o," newName:").concat(a));return this._snsModule.request({protocolName:no,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,newName:a}}).then((function(){if(s.setNetworkType(t._snsModule.getNetworkType()).end(),we.log("".concat(n," ok. oldName:").concat(o," newName:").concat(a)),t._friendGroupMap.has(o)){var e=t._friendGroupMap.get(o);return e.name=a,t._friendGroupMap.delete(o),t._friendGroupMap.set(a,e),t._snsModule.updateWhenRemovedFromFriendGroup({name:o,userIDList:e.userIDList}),t._snsModule.updateWhenAddedToFriendGroup({name:a,userIDList:e.userIDList}),t._emitFriendGroupListUpdated(),as(e)}return as()})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"addToFriendGroup",value:function(e){var t=this,n="".concat(this._className,".addToFriendGroup"),o=e.name,a=e.userIDList;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist(o);var s=new Va(Ha.ADD_TO_FRIEND_GROUP);return s.setMessage("name:".concat(o," userIDList:").concat(a)),we.log("".concat(this._className,".addToFriendGroup name:").concat(o," userIDList:").concat(a)),this._snsModule.request({protocolName:no,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,updateGroupItem:a.filter((function(e){return t._snsModule.isMyFriend(e)})).map((function(e){return{to:e,updateType:"Update_Type_Add"}}))}}).then((function(e){return s.setNetworkType(t._snsModule.getNetworkType()).end(),t._onFriendGroupUpdated(o,e)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"removeFromFriendGroup",value:function(e){var t=this,n="".concat(this._className,".removeFromFriendGroup"),o=e.name,a=e.userIDList;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist(o);var s=new Va(Ha.REMOVE_FROM_FRIEND_GROUP);return s.setMessage("name:".concat(o," userIDList:").concat(a)),we.log("".concat(n," name:").concat(o," userIDList:").concat(a)),this._snsModule.request({protocolName:no,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,updateGroupItem:a.filter((function(e){return t._snsModule.isMyFriend(e)})).map((function(e){return{to:e,updateType:"Update_Type_Delete"}}))}}).then((function(e){return s.setNetworkType(t._snsModule.getNetworkType()).end(),t._onFriendGroupUpdated(o,e)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),we.warn("".concat(n," failed. error:"),e),gs(e)}))}},{key:"_onFriendGroupUpdated",value:function(e,t){var n=t.data.resultList,o=this._friendGroupMap.get(e),a=[],s=[],r=[];return Ze(n)&&n.forEach((function(e){var t=e.to,n=e.resultCode,i=e.resultInfo,c=e.type;0===n?"Update_Type_Add"===c?o&&(o.addToUserIDList(t),s.push(t)):"Update_Type_Delete"===c&&o&&(o.removeFromUserIDList(t),r.push(t)):a.push({to:e.to,code:n,message:i})})),we.log("".concat(this._className,"._onFriendGroupUpdated name:").concat(e," userIDList:").concat(o.userIDList)),s.length>0&&this._snsModule.updateWhenAddedToFriendGroup({name:e,userIDList:s}),r.length>0&&this._snsModule.updateWhenRemovedFromFriendGroup({name:e,userIDList:r}),as({friendGroup:o,failureUserIDList:a})}},{key:"updateWhenFriendAdded",value:function(e){var t=this,n=e.nameList,o=e.userID;we.log("".concat(this._className,".updateWhenFriendAdded userID:").concat(o," nameList:").concat(n)),Bt(n)||n.forEach((function(e){t._friendGroupMap.has(e)&&t._friendGroupMap.get(e).addToUserIDList(o)}))}},{key:"updateWhenFriendDeleted",value:function(e){var t=this,n=e.nameList,o=e.userID;we.log("".concat(this._className,".updateWhenFriendDeleted userID:").concat(o," nameList:").concat(n)),Bt(n)||n.forEach((function(e){t._friendGroupMap.has(e)&&t._friendGroupMap.get(e).removeFromUserIDList(o)}))}},{key:"reset",value:function(){this._friendGroupMap.clear()}}]),e}(),gi=function(e){i(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._className="SnsModule",a._friendHandler=new di(g(a)),a._friendApplicationHandler=new ui(g(a)),a._friendGroupHandler=new _i(g(a)),a.getInnerEmitterInstance().on(ms,a.onContextUpdated,g(a)),a}return s(n,[{key:"onContextUpdated",value:function(e){this._friendHandler.pagingGetFriendList(),this._friendGroupHandler.getFriendGroupList(),this._friendApplicationHandler.getFriendApplicationList()}},{key:"onRelationChainModified",value:function(e){var t=e.dataList;if(!Bt(t)){var n=[],o=[],a=[],s=[],r=!1,i="";t.forEach((function(e){3!==e.pushType&&4!==e.pushType||!e.from||(i=e.from),e.friendAddAccount&&(n.push.apply(n,M(e.friendAddAccount)),s.push.apply(s,M(e.friendAddAccount))),e.friendDelAccount&&o.push.apply(o,M(e.friendDelAccount)),e.friendApplicationAdded&&a.push.apply(a,M(e.friendApplicationAdded)),e.friendApplicationDeletedUserIDList&&s.push.apply(s,M(e.friendApplicationDeletedUserIDList)),e.reportTime&&7===e.pushType&&(r=!0)})),r&&this._friendApplicationHandler.onFriendApplicationRead(),this._friendApplicationHandler.onFriendApplicationAdded(a,i),this._friendApplicationHandler.onFriendApplicationDeleted(s),this._friendHandler.onFriendAdded(n),this._friendHandler.onFriendDeleted(o)}}},{key:"isMyFriend",value:function(e){return this._friendHandler.isMyFriend(e)}},{key:"onFriendProfileModified",value:function(e){this._friendHandler.onFriendProfileModified(e)}},{key:"getLocalFriendList",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this._friendHandler.getLocalFriendList();return e?_s(t):t}},{key:"getFriendRemark",value:function(e){return this._friendHandler.getFriendRemark(e)}},{key:"getFriendList",value:function(){return this._friendHandler.pagingGetFriendList()}},{key:"addFriend",value:function(e){return this._friendHandler.addFriend(e)}},{key:"deleteFriend",value:function(e){return this._friendHandler.deleteFriend(e)}},{key:"checkFriend",value:function(e){return this._friendHandler.checkFriend(e)}},{key:"getFriendProfile",value:function(e){return this._friendHandler.getFriendProfile(e)}},{key:"updateFriend",value:function(e){return this._friendHandler.updateFriend(e)}},{key:"updateWhenAddedToFriendGroup",value:function(e){this._friendHandler.updateWhenAddedToFriendGroup(e)}},{key:"updateWhenRemovedFromFriendGroup",value:function(e){this._friendHandler.updateWhenRemovedFromFriendGroup(e)}},{key:"getLocalFriendApplicationList",value:function(){var e=this._friendApplicationHandler.getLocalFriendApplicationList();return _s(e)}},{key:"deleteFriendApplication",value:function(e){return this._friendApplicationHandler.deleteFriendApplication(e)}},{key:"refuseFriendApplication",value:function(e){return this._friendApplicationHandler.refuseFriendApplication(e)}},{key:"acceptFriendApplication",value:function(e){return this._friendApplicationHandler.acceptFriendApplication(e)}},{key:"setFriendApplicationRead",value:function(e){return this._friendApplicationHandler.setFriendApplicationRead(e)}},{key:"getLocalFriendGroupList",value:function(){var e=this._friendGroupHandler.getLocalFriendGroupList();return _s(e)}},{key:"createFriendGroup",value:function(e){return this._friendGroupHandler.createFriendGroup(e)}},{key:"deleteFriendGroup",value:function(e){return this._friendGroupHandler.deleteFriendGroup(e)}},{key:"addToFriendGroup",value:function(e){return this._friendGroupHandler.addToFriendGroup(e)}},{key:"removeFromFriendGroup",value:function(e){return this._friendGroupHandler.removeFromFriendGroup(e)}},{key:"renameFriendGroup",value:function(e){return this._friendGroupHandler.renameFriendGroup(e)}},{key:"onAddToFriendGroup",value:function(e){return this._friendGroupHandler.onAddToFriendGroup(e)}},{key:"updateWhenFriendAdded",value:function(e){this._friendGroupHandler.updateWhenFriendAdded(e)}},{key:"updateWhenFriendDeleted",value:function(e){this._friendGroupHandler.updateWhenFriendDeleted(e)}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}]),n}(Ln),hi=function(e){i(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._className="WorkerTimerModule",a._isWorkerEnabled=!0,a._workerTimer=null,a._init(),a.getInnerEmitterInstance().on(Ms,a._onCloudConfigUpdated,g(a)),a}return s(n,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&Ee}},{key:"startWorkerTimer",value:function(){we.log("".concat(this._className,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){we.log("".concat(this._className,".stopWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("stop")}},{key:"_init",value:function(){if(Ee){var e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(""); }, 1000) } else if (event.data === "stop") { clearInterval(interval); interval = -1; }};'],{type:"application/javascript; charset=utf-8"}));this._workerTimer=new Worker(e);var t=this;this._workerTimer.onmessage=function(){t._moduleManager.onCheckTimer()}}}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("enable_worker");we.log("".concat(this._className,"._onCloudConfigUpdated enableWorker:").concat(e)),et(e)||"1"===e?!this._isWorkerEnabled&&Ee&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._moduleManager.onWorkerTimerEnabled()):this._isWorkerEnabled&&Ee&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._moduleManager.onWorkerTimerDisabled())}},{key:"terminate",value:function(){we.log("".concat(this._className,".terminate")),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null)}},{key:"reset",value:function(){we.log("".concat(this._className,".reset"))}}]),n}(Ln),fi=function(){function e(){o(this,e),this._className="PurchasedFeatureHandler",this._purchasedFeatureMap=new Map}return s(e,[{key:"isValidPurchaseBits",value:function(e){return e&&"string"==typeof e&&e.length>=1&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){var t="".concat(this._className,".parsePurchaseBits");if(this.isValidPurchaseBits(e)){this._purchasedFeatureMap.clear();for(var n=null,o=e.length-1,a=0;o>=0;o--,a++)n=a<32?new O(0,Math.pow(2,a)).toString():new O(Math.pow(2,a-32),0).toString(),"1"===e[o]?this._purchasedFeatureMap.set(n,!0):this._purchasedFeatureMap.set(n,!1)}else we.warn("".concat(t," invalid purchase bits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._purchasedFeatureMap.get(e)}},{key:"isFeatureEnabled",value:function(e){for(var t=parseInt(e).toString(2),n=void 0,o=!0,a=t.length-1,s=0;a>=0;a--,s++)if("1"===t.charAt(a)&&(n=s<32?new O(0,Math.pow(2,s)).toString():new O(Math.pow(2,s-32),0).toString(),!this._purchasedFeatureMap.get(n))){o=!1;break}return we.log("".concat(this._className,".isFeatureEnabled decimalNumber:").concat(e," binaryString:").concat(t," ret:").concat(o)),_s({enabled:o})}},{key:"clear",value:function(){this._purchasedFeatureMap.clear()}}]),e}(),mi=function(e){i(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._className="CommercialConfigModule",a._expiredTime=0,a._isFetching=!1,a._purchasedFeatureHandler=new fi,a}return s(n,[{key:"_canFetch",value:function(){return this.isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetch(),n="".concat(this._className,".fetchConfig");if(we.log("".concat(n," canFetch:").concat(t)),t){var o=new Va(Ha.FETCH_COMMERCIAL_CONFIG);o.setNetworkType(this.getNetworkType());var a=this.getModule(_n).getSDKAppID();this._isFetching=!0,this.request({protocolName:_a,requestData:{SDKAppID:a}}).then((function(t){o.setMessage("purchaseBits:".concat(t.data.purchaseBits)).end(),we.log("".concat(n," ok.")),e._parseConfig(t.data),e._isFetching=!1})).catch((function(t){e.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];o.setError(t,a,s).end()})),e._isFetching=!1}))}}},{key:"onPushedConfig",value:function(e){var t="".concat(this._className,".onPushedConfig");we.log("".concat(t)),new Va(Ha.PUSHED_COMMERCIAL_CONFIG).setNetworkType(this.getNetworkType()).setMessage("purchaseBits:".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:"_parseConfig",value:function(e){var t="".concat(this._className,"._parseConfig"),n=e.errorCode,o=e.errorMessage,a=e.purchaseBits,s=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(a),this._expiredTime=Date.now()+1e3*s):et(n)?(we.log("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(we.error("".concat(t," errorCode:").concat(n," errorMessage:").concat(o)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"canIUse",value:function(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}},{key:"isFeatureEnabled",value:function(e){return this._purchasedFeatureHandler.isFeatureEnabled(e)}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),n}(Ln),Mi=function(){function e(t){o(this,e);var n=new Va(Ha.SDK_CONSTRUCT);this._className="ModuleManager",this._isReady=!1,this._reason=Sa.USER_NOT_LOGGED_IN,this._startLoginTs=0,this._moduleMap=new Map,this._innerEmitter=null,this._outerEmitter=null,this._checkCount=0,this._checkTimer=-1,this._moduleMap.set(_n,new rr(this,t)),this._moduleMap.set(An,new mi(this)),this._moduleMap.set(Sn,new ti(this)),this._moduleMap.set(Dn,new hi(this)),this._moduleMap.set(Nn,new ii(this)),this._moduleMap.set(En,new Yr(this)),this._moduleMap.set(yn,new Zr(this)),this._moduleMap.set(on,new ir(this)),this._moduleMap.set(an,new Dr(this)),this._moduleMap.set(sn,new sr(this)),this._moduleMap.set(rn,new hs(this)),this._moduleMap.set(pn,new Us(this)),this._moduleMap.set(cn,new js(this)),this._moduleMap.set(ln,new zs(this)),this._moduleMap.set(dn,new Zs(this)),this._moduleMap.set(gn,new ur(this)),this._moduleMap.set(hn,new pr(this)),this._moduleMap.set(fn,new fr(this)),this._moduleMap.set(mn,new Mr(this)),this._moduleMap.set(Mn,new Ir(this)),this._moduleMap.set(vn,new Cr(this)),this._moduleMap.set(In,new Nr(this)),this._moduleMap.set(Tn,new ei(this)),this._moduleMap.set(Cn,new ni(this)),this._moduleMap.set(un,new gi(this)),this._eventThrottleMap=new Map;var a=t.instanceID,s=t.oversea,r=t.SDKAppID,i="instanceID:".concat(a," SDKAppID:").concat(r," host:").concat(Ot()," oversea:").concat(s," inBrowser:").concat(ne," inMiniApp:").concat(te)+" workerAvailable:".concat(Ee," UserAgent:").concat(se);Va.bindEventStatModule(this._moduleMap.get(hn)),n.setMessage("".concat(i," ").concat(function(){var e="";if(te)try{var t=oe.getSystemInfoSync(),n=t.model,o=t.version,a=t.system,s=t.platform,r=t.SDKVersion;e="model:".concat(n," version:").concat(o," system:").concat(a," platform:").concat(s," SDKVersion:").concat(r)}catch(i){e=""}return e}())).end(),we.info("SDK ".concat(i)),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}return s(e,[{key:"_startTimer",value:function(){var e=this._moduleMap.get(Dn),t=e.isWorkerEnabled();we.log("".concat(this._className,".startTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.startWorkerTimer():this._startMainThreadTimer()}},{key:"_startMainThreadTimer",value:function(){we.log("".concat(this._className,"._startMainThreadTimer")),this._checkTimer<0&&(this._checkTimer=setInterval(this.onCheckTimer.bind(this),1e3))}},{key:"stopTimer",value:function(){var e=this._moduleMap.get(Dn),t=e.isWorkerEnabled();we.log("".concat(this._className,".stopTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.stopWorkerTimer():this._stopMainThreadTimer()}},{key:"_stopMainThreadTimer",value:function(){we.log("".concat(this._className,"._stopMainThreadTimer")),this._checkTimer>0&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){we.log("".concat(this._className,"._stopMainThreadSocket"));var e=this._moduleMap.get(En);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:"_startMainThreadSocket",value:function(){we.log("".concat(this._className,"._startMainThreadSocket"));var e=this._moduleMap.get(En);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){we.log("".concat(this._className,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){we.log("".concat(this._className,".onWorkerTimerDisabled, enable main thread timer and socket")),this._startMainThreadTimer(),this._startMainThreadSocket()}},{key:"onCheckTimer",value:function(){this._checkCount+=1;var e,t=S(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2)[1];n.onCheckTimer&&n.onCheckTimer(this._checkCount)}}catch(o){t.e(o)}finally{t.f()}}},{key:"_initReadyList",value:function(){var e=this;this._readyList=[this._moduleMap.get(on),this._moduleMap.get(pn)],this._readyList.forEach((function(t){t.ready((function(){return e._onModuleReady()}))}))}},{key:"_onModuleReady",value:function(){var e=!0;if(this._readyList.forEach((function(t){t.isReady()||(e=!1)})),e&&!this._isReady){this._isReady=!0,this._outerEmitter.emit(D.SDK_READY);var t=Date.now()-this._startLoginTs;we.warn("SDK is ready. cost ".concat(t," ms")),this._startLoginTs=Date.now();var n=this._moduleMap.get(fn).getNetworkType(),o=this._ssoLogForReady.getStartTs()+Le;this._ssoLogForReady.setNetworkType(n).setMessage(t).start(o).end()}}},{key:"login",value:function(){0===this._startLoginTs&&(Oe(),this._startLoginTs=Date.now(),this._startTimer(),this._moduleMap.get(fn).start(),this._ssoLogForReady=new Va(Ha.SDK_READY),this._reason=Sa.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOuterEmitterInstance",value:function(){return null===this._outerEmitter&&(this._outerEmitter=new mr,ps(this._outerEmitter),this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(e,t){var n=this;if(e===D.CONVERSATION_LIST_UPDATED||e===D.FRIEND_LIST_UPDATED||e===D.GROUP_LIST_UPDATED)if(this._eventThrottleMap.has(e)){var o=Date.now(),a=this._eventThrottleMap.get(e);o-a.last<1e3?(a.timeoutID&&clearTimeout(a.timeoutID),a.timeoutID=setTimeout((function(){a.last=o,n._outerEmitter._emit.apply(n._outerEmitter,[e,{name:e,data:n._getEventData(e)}])}),500)):(a.last=o,this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]))}else this._eventThrottleMap.set(e,{last:Date.now(),timeoutID:-1}),this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]);else this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:arguments[1]}])}.bind(this)),this._outerEmitter}},{key:"_getEventData",value:function(e){return e===D.CONVERSATION_LIST_UPDATED?this._moduleMap.get(pn).getLocalConversationList():e===D.FRIEND_LIST_UPDATED?this._moduleMap.get(un).getLocalFriendList(!1):e===D.GROUP_LIST_UPDATED?this._moduleMap.get(cn).getLocalGroupList():void 0}},{key:"getInnerEmitterInstance",value:function(){return null===this._innerEmitter&&(this._innerEmitter=new mr,this._innerEmitter._emit=this._innerEmitter.emit,this._innerEmitter.emit=function(e,t){var n;Qe(arguments[1])&&arguments[1].data?(we.warn("inner eventData has data property, please check!"),n=[e,{name:arguments[0],data:arguments[1].data}]):n=[e,{name:arguments[0],data:arguments[1]}],this._innerEmitter._emit.apply(this._innerEmitter,n)}.bind(this)),this._innerEmitter}},{key:"hasModule",value:function(e){return this._moduleMap.has(e)}},{key:"getModule",value:function(e){return this._moduleMap.get(e)}},{key:"isReady",value:function(){return this._isReady}},{key:"getNotReadyReason",value:function(){return this._reason}},{key:"setNotReadyReason",value:function(e){this._reason=e}},{key:"onError",value:function(e){we.warn("Oops! code:".concat(e.code," message:").concat(e.message)),new Va(Ha.ERROR).setMessage("code:".concat(e.code," message:").concat(e.message)).setNetworkType(this.getModule(fn).getNetworkType()).setLevel("error").end(),this.getOuterEmitterInstance().emit(D.ERROR,e)}},{key:"reset",value:function(){we.log("".concat(this._className,".reset")),Oe();var e,t=S(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2)[1];n.reset&&n.reset()}}catch(r){t.e(r)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._outerEmitter.emit(D.SDK_NOT_READY);var o,a=S(this._eventThrottleMap);try{for(a.s();!(o=a.n()).done;){var s=m(o.value,2)[1];s.timeoutID&&clearTimeout(s.timeoutID)}}catch(r){a.e(r)}finally{a.f()}this._eventThrottleMap.clear()}}]),e}(),vi=function(){function e(){o(this,e),this._funcMap=new Map}return s(e,[{key:"defense",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if("string"!=typeof e)return null;if(0===e.length)return null;if("function"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);var o=null;return this._funcMap.get(e).has(t)?o=this._funcMap.get(e).get(t):(o=this._pack(e,t,n),this._funcMap.get(e).set(t,o)),o}},{key:"defenseOnce",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return"function"!=typeof t?null:this._pack(e,t,n)}},{key:"find",value:function(e,t){return"string"!=typeof e||0===e.length||"function"!=typeof t?null:this._funcMap.has(e)?this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(we.log("SafetyCallback.find: 找不到 func —— ".concat(e,"/").concat(""!==t.name?t.name:"[anonymous]")),null):(we.log("SafetyCallback.find: 找不到 eventName-".concat(e," 对应的 func")),null)}},{key:"delete",value:function(e,t){return"function"==typeof t&&(!!this._funcMap.has(e)&&(!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),0===this._funcMap.get(e).size&&this._funcMap.delete(e),!0)))}},{key:"_pack",value:function(e,t,n){return function(){try{t.apply(n,Array.from(arguments))}catch(r){var o=Object.values(D).indexOf(e);if(-1!==o){var a=Object.keys(D)[o];we.warn("接入侧事件 TIM.EVENT.".concat(a," 对应的回调函数逻辑存在问题,请检查!"),r)}var s=new Va(Ha.CALLBACK_FUNCTION_ERROR);s.setMessage("eventName:".concat(e)).setMoreMessage(r.message).end()}}}}]),e}(),Ii=function(){function e(t){o(this,e);var n={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||"",oversea:t.oversea||!1,instanceID:Rt(),devMode:t.devMode||!1,proxyServer:t.proxyServer||void 0};this._moduleManager=new Mi(n),this._safetyCallbackFactory=new vi}return s(e,[{key:"onError",value:function(e){this._moduleManager.onError(e)}},{key:"login",value:function(e){return this._moduleManager.login(),this._moduleManager.getModule(on).login(e)}},{key:"logout",value:function(){var e=this;return this._moduleManager.getModule(on).logout().then((function(t){return e._moduleManager.reset(),t}))}},{key:"isReady",value:function(){return this._moduleManager.isReady()}},{key:"getNotReadyReason",value:function(){return this._moduleManager.getNotReadyReason()}},{key:"destroy",value:function(){var e=this;return this.logout().finally((function(){e._moduleManager.stopTimer(),e._moduleManager.getModule(Dn).terminate(),e._moduleManager.getModule(En).dealloc();var t=e._moduleManager.getOuterEmitterInstance(),n=e._moduleManager.getModule(_n);t.emit(D.SDK_DESTROY,{SDKAppID:n.getSDKAppID()})}))}},{key:"on",value:function(e,t,n){e===D.GROUP_SYSTEM_NOTICE_RECEIVED&&we.warn("!!!TIM.EVENT.GROUP_SYSTEM_NOTICE_RECEIVED v2.6.0起弃用,为了更好的体验,请在 TIM.EVENT.MESSAGE_RECEIVED 事件回调内接收处理群系统通知,详细请参考:https://web.sdk.qcloud.com/im/doc/zh-cn/Message.html#.GroupSystemNoticePayload"),we.debug("on","eventName:".concat(e)),this._moduleManager.getOuterEmitterInstance().on(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"once",value:function(e,t,n){we.debug("once","eventName:".concat(e)),this._moduleManager.getOuterEmitterInstance().once(e,this._safetyCallbackFactory.defenseOnce(e,t,n),n||this)}},{key:"off",value:function(e,t,n,o){we.debug("off","eventName:".concat(e));var a=this._safetyCallbackFactory.find(e,t);null!==a&&(this._moduleManager.getOuterEmitterInstance().off(e,a,n,o),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){this._moduleManager.getModule(vn).registerPlugin(e)}},{key:"setLogLevel",value:function(e){if(e<=0){console.log([""," ________ ______ __ __ __ __ ________ _______","| \\| \\| \\ / \\| \\ _ | \\| \\| \\"," \\$$$$$$$$ \\$$$$$$| $$\\ / $$| $$ / \\ | $$| $$$$$$$$| $$$$$$$\\"," | $$ | $$ | $$$\\ / $$$| $$/ $\\| $$| $$__ | $$__/ $$"," | $$ | $$ | $$$$\\ $$$$| $$ $$$\\ $$| $$ \\ | $$ $$"," | $$ | $$ | $$\\$$ $$ $$| $$ $$\\$$\\$$| $$$$$ | $$$$$$$\\"," | $$ _| $$_ | $$ \\$$$| $$| $$$$ \\$$$$| $$_____ | $$__/ $$"," | $$ | $$ \\| $$ \\$ | $$| $$$ \\$$$| $$ \\| $$ $$"," \\$$ \\$$$$$$ \\$$ \\$$ \\$$ \\$$ \\$$$$$$$$ \\$$$$$$$","",""].join("\n")),console.log("%cIM 智能客服,随时随地解决您的问题 →_→ https://cloud.tencent.com/act/event/smarty-service?from=im-doc","color:#006eff"),console.log("%c从v2.11.2起,SDK 支持了 WebSocket,小程序需要添加受信域名!升级指引: https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-02-upgradeguideline.html","color:#ff0000");console.log(["","参考以下文档,会更快解决问题哦!(#^.^#)\n","SDK 更新日志: https://cloud.tencent.com/document/product/269/38492\n","SDK 接口文档: https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html\n","常见问题: https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-01-faq.html\n","反馈问题?戳我提 issue: https://github.com/tencentyun/TIMSDK/issues\n","如果您需要在生产环境关闭上面的日志,请 tim.setLogLevel(1)\n"].join("\n"))}we.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._moduleManager.getModule(an).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._moduleManager.getModule(an).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._moduleManager.getModule(an).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._moduleManager.getModule(an).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._moduleManager.getModule(an).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._moduleManager.getModule(an).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._moduleManager.getModule(an).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._moduleManager.getModule(an).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._moduleManager.getModule(an).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._moduleManager.getModule(an).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==C.MSG_MERGER?gs(new ls({code:Sa.MESSAGE_MERGER_TYPE_INVALID,message:Da.MESSAGE_MERGER_TYPE_INVALID})):Bt(e.payload.downloadKey)?gs(new ls({code:Sa.MESSAGE_MERGER_KEY_INVALID,message:Da.MESSAGE_MERGER_KEY_INVALID})):this._moduleManager.getModule(an).downloadMergerMessage(e).catch((function(e){return gs(new ls({code:Sa.MESSAGE_MERGER_DOWNLOAD_FAIL,message:Da.MESSAGE_MERGER_DOWNLOAD_FAIL}))}))}},{key:"createForwardMessage",value:function(e){return this._moduleManager.getModule(an).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof os?this._moduleManager.getModule(an).sendMessageInstance(e,t):gs(new ls({code:Sa.MESSAGE_SEND_NEED_MESSAGE_INSTANCE,message:Da.MESSAGE_SEND_NEED_MESSAGE_INSTANCE}))}},{key:"callExperimentalAPI",value:function(e,t){return"handleGroupInvitation"===e?this._moduleManager.getModule(cn).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._moduleManager.getModule(An).isFeatureEnabled(t):gs(new ls({code:Sa.INVALID_OPERATION,message:Da.INVALID_OPERATION}))}},{key:"revokeMessage",value:function(e){return this._moduleManager.getModule(an).revokeMessage(e)}},{key:"resendMessage",value:function(e){return this._moduleManager.getModule(an).resendMessage(e)}},{key:"deleteMessage",value:function(e){return this._moduleManager.getModule(an).deleteMessage(e)}},{key:"modifyMessage",value:function(e){return this._moduleManager.getModule(an).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._moduleManager.getModule(pn).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._moduleManager.getModule(pn).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._moduleManager.getModule(pn).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._moduleManager.getModule(pn).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){return this._moduleManager.getModule(cn).getReadReceiptDetail(e)}},{key:"findMessage",value:function(e){return this._moduleManager.getModule(pn).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._moduleManager.getModule(pn).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._moduleManager.getModule(pn).getConversationList(e)}},{key:"getConversationProfile",value:function(e){return this._moduleManager.getModule(pn).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._moduleManager.getModule(pn).deleteConversation(e)}},{key:"pinConversation",value:function(e){return this._moduleManager.getModule(pn).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._moduleManager.getModule(pn).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._moduleManager.getModule(pn).setMessageRemindType(e)}},{key:"getMyProfile",value:function(){return this._moduleManager.getModule(sn).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._moduleManager.getModule(sn).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._moduleManager.getModule(sn).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._moduleManager.getModule(sn).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._moduleManager.getModule(sn).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._moduleManager.getModule(sn).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._moduleManager.getModule(sn).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._moduleManager.getModule(sn).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._moduleManager.getModule(sn).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._moduleManager.getModule(sn).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._moduleManager.getModule(un);return e?e.getLocalFriendList():gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"addFriend",value:function(e){var t=this._moduleManager.getModule(un);return t?t.addFriend(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._moduleManager.getModule(un);return t?t.deleteFriend(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"checkFriend",value:function(e){var t=this._moduleManager.getModule(un);return t?t.checkFriend(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._moduleManager.getModule(un);return t?t.getFriendProfile(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"updateFriend",value:function(e){var t=this._moduleManager.getModule(un);return t?t.updateFriend(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._moduleManager.getModule(un);return e?e.getLocalFriendApplicationList():gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._moduleManager.getModule(un);return t?t.acceptFriendApplication(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._moduleManager.getModule(un);return t?t.refuseFriendApplication(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._moduleManager.getModule(un);return t?t.deleteFriendApplication(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._moduleManager.getModule(un);return e?e.setFriendApplicationRead():gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._moduleManager.getModule(un);return e?e.getLocalFriendGroupList():gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._moduleManager.getModule(un);return t?t.createFriendGroup(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._moduleManager.getModule(un);return t?t.deleteFriendGroup(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._moduleManager.getModule(un);return t?t.addToFriendGroup(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._moduleManager.getModule(un);return t?t.removeFromFriendGroup(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._moduleManager.getModule(un);return t?t.renameFriendGroup(e):gs({code:Sa.CANNOT_FIND_MODULE,message:Da.CANNOT_FIND_MODULE})}},{key:"getGroupList",value:function(e){return this._moduleManager.getModule(cn).getGroupList(e)}},{key:"getGroupProfile",value:function(e){return this._moduleManager.getModule(cn).getGroupProfile(e)}},{key:"createGroup",value:function(e){return this._moduleManager.getModule(cn).createGroup(e)}},{key:"dismissGroup",value:function(e){return this._moduleManager.getModule(cn).dismissGroup(e)}},{key:"updateGroupProfile",value:function(e){return this._moduleManager.getModule(cn).updateGroupProfile(e)}},{key:"joinGroup",value:function(e){return this._moduleManager.getModule(cn).joinGroup(e)}},{key:"quitGroup",value:function(e){return this._moduleManager.getModule(cn).quitGroup(e)}},{key:"searchGroupByID",value:function(e){return this._moduleManager.getModule(cn).searchGroupByID(e)}},{key:"getGroupOnlineMemberCount",value:function(e){return this._moduleManager.getModule(cn).getGroupOnlineMemberCount(e)}},{key:"changeGroupOwner",value:function(e){return this._moduleManager.getModule(cn).changeGroupOwner(e)}},{key:"handleGroupApplication",value:function(e){return this._moduleManager.getModule(cn).handleGroupApplication(e)}},{key:"initGroupAttributes",value:function(e){return this._moduleManager.getModule(cn).initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._moduleManager.getModule(cn).setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._moduleManager.getModule(cn).deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._moduleManager.getModule(cn).getGroupAttributes(e)}},{key:"getGroupMemberList",value:function(e){return this._moduleManager.getModule(ln).getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this._moduleManager.getModule(ln).getGroupMemberProfile(e)}},{key:"addGroupMember",value:function(e){return this._moduleManager.getModule(ln).addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this._moduleManager.getModule(ln).deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this._moduleManager.getModule(ln).setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this._moduleManager.getModule(ln).setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this._moduleManager.getModule(ln).setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this._moduleManager.getModule(ln).setGroupMemberCustomField(e)}},{key:"getJoinedCommunityList",value:function(){return this._moduleManager.getModule(dn).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._moduleManager.getModule(dn).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._moduleManager.getModule(dn).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._moduleManager.getModule(dn).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._moduleManager.getModule(dn).getTopicList(e)}}]),e}(),yi={login:"login",logout:"logout",destroy:"destroy",on:"on",off:"off",ready:"ready",setLogLevel:"setLogLevel",joinGroup:"joinGroup",quitGroup:"quitGroup",registerPlugin:"registerPlugin",getGroupOnlineMemberCount:"getGroupOnlineMemberCount"};function Ei(e,t){if(e.isReady()||void 0!==yi[t])return!0;var n=e.getNotReadyReason(),o="";Object.getOwnPropertyNames(Sa).forEach((function(e){Sa[e]===n&&(o=Da[e])}));var a={code:n,message:"".concat(o,"导致 sdk not ready。").concat(t," ").concat(Da.SDK_IS_NOT_READY,",请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/module-EVENT.html#.SDK_READY")};return e.onError(a),a}var Ti={},Si={};return Si.create=function(e){var n=0;if(ze(e.SDKAppID))n=e.SDKAppID;else if(we.warn("TIM.create SDKAppID 的类型应该为 Number,请修改!"),n=parseInt(e.SDKAppID),isNaN(n))return we.error("TIM.create failed. 解析 SDKAppID 失败,请检查传参!"),null;if(n&&Ti[n])return Ti[n];we.log("TIM.create");var o=new Ii(t(t({},e),{},{SDKAppID:n}));o.on(D.SDK_DESTROY,(function(e){Ti[e.data.SDKAppID]=null,delete Ti[e.data.SDKAppID]}));var a=function(e){var t=Object.create(null);return Object.keys(nn).forEach((function(n){if(e[n]){var o=nn[n],a=new N;t[o]=function(){var t=Array.from(arguments);return a.use((function(t,o){var a=Ei(e,n);return!0===a?o():gs(a)})).use((function(e,t){if(!0===xt(e,tn[n],o))return t()})).use((function(t,o){return e[n].apply(e,t)})),a.run(t)}}})),t}(o);return Ti[n]=a,we.log("TIM.create ok"),a},Si.TYPES=C,Si.EVENT=D,Si.VERSION="2.21.2",we.log("TIM.VERSION: ".concat(Si.VERSION)),Si}));