| 1 |
- '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 o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function t(t){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?e(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,o){return t&&a(e.prototype,t),o&&a(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function d(e,t,o){return(d=l()?Reflect.construct:function(e,t,o){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return o&&u(a,o.prototype),a}).apply(null,arguments)}function p(e){var t="function"==typeof Map?new Map:void 0;return(p=function(e){if(null===e||(o=e,-1===Function.toString.call(o).indexOf("[native code]")))return e;var o;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return d(e,arguments,c(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),u(n,e)})(e)}function g(e,t){if(null==e)return{};var o,n,a=function(e,t){if(null==e)return{};var o,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)o=s[n],t.indexOf(o)>=0||(a[o]=e[o]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)o=s[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o])}return a}function _(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 _(e)}function f(e){var t=l();return function(){var o,n=c(e);if(t){var a=c(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return h(this,o)}}function m(e,t){return v(e)||function(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==o)return;var n,a,s=[],r=!0,i=!1;try{for(o=o.call(e);!(r=(n=o.next()).done)&&(s.push(n.value),!t||s.length!==t);r=!0);}catch(c){i=!0,a=c}finally{try{r||null==o.return||o.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 o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?E(e,t):void 0}}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}function T(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function S(e,t){var o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!o){if(Array.isArray(e)||(o=y(e))||t&&e&&"number"==typeof e.length){o&&(e=o);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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(){o=o.call(e)},n:function(){var e=o.next();return r=e.done,e},e:function(e){i=!0,s=e},f:function(){try{r||null==o.return||o.return()}finally{if(i)throw s}}}}var C={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"},D={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(){n(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 O(e,t){return e(t={exports:{}},t.exports),t.exports}var R=O((function(e,t){var o,n,a,s,r,i,c,u,l,d,p,g,_,h,f,m,M,v;e.exports=(o="function"==typeof Promise,n="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,g=s&&"function"==typeof Map.prototype.entries,_=p&&Object.getPrototypeOf((new Set).entries()),h=g&&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===n)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":o&&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===_?"Set Iterator":f&&l===m?"Array Iterator":M&&l===v?"String Iterator":null===l?"Object":Object.prototype.toString.call(e).slice(8,-1)})})),L=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;n(this,e),this.high=t,this.low=o}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 o=8-t.length;o;)t="0"+t,o--;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,b="CHINA",w="OVERSEA",F="SINGAPORE",q="KOREA",V="GERMANY",K="IND",B={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]:b;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"}},H={SEARCH_MSG:new L(0,Math.pow(2,0)).toString(),SEARCH_GRP_SNS:new L(0,Math.pow(2,1)).toString(),AVCHATROOM_HISTORY_MSG:new L(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new L(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new L(0,Math.pow(2,4)).toString(),USER_STATUS:new L(0,Math.pow(2,7)).toString()};B.HOST.setCurrent(b);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,oe=("undefined"!=typeof uni||"undefined"!=typeof window)&&!te,ne=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=oe&&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),ge=function(){var e=se.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),o=e[2]&&parseFloat(e[2]);return t&&o?parseFloat(e[1]+"."+e[2]):t||null}(),_e=(pe&&/webkit/i.test(se),/Firefox/i.test(se),/Edge/i.test(se)),he=!_e&&/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),oe&&"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 Ce=function(){},De=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],Ne=De.length;Ne--;)j=De[Ne],console[j]||(Y[j]=Ce);var Ae=Y,Oe=0,Re=function(){return(new Date).getTime()+Oe},Le=function(){Oe=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 be={arguments2String:function(e){var t;if(1===e.length)t=Ue()+e[0];else{t=Ue();for(var o=0,n=e.length;o<n;o++)et(e[o])?nt(e[o])?t+=ut(e[o]):t+=JSON.stringify(e[o]):t+=e[o],t+=" "}return t},debug:function(){if(Ge<=-1){var e=this.arguments2String(arguments);Ae.debug(e)}},log:function(){if(Ge<=0){var e=this.arguments2String(arguments);Ae.log(e)}},info:function(){if(Ge<=1){var e=this.arguments2String(arguments);Ae.info(e)}},warn:function(){if(Ge<=2){var e=this.arguments2String(arguments);Ae.warn(e)}},error:function(){if(Ge<=3){var e=this.arguments2String(arguments);Ae.error(e)}},time:function(e){Pe.set(e,it.now())},timeEnd:function(e){if(Pe.has(e)){var t=it.now()-Pe.get(e);return Pe.delete(e),t}return Ae.warn("未找到对应label: ".concat(e,", 请在调用 logger.timeEnd 前,调用 logger.time")),0},setLevel:function(e){e<4&&Ae.log(Ue()+"set level from "+Ge+" to "+e),Ge=e},getLevel:function(){return Ge}},we={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},Fe={NICK:"Tag_Profile_IM_Nick",GENDER:"Tag_Profile_IM_Gender",BIRTHDAY:"Tag_Profile_IM_BirthDay",LOCATION:"Tag_Profile_IM_Location",SELFSIGNATURE:"Tag_Profile_IM_SelfSignature",ALLOWTYPE:"Tag_Profile_IM_AllowType",LANGUAGE:"Tag_Profile_IM_Language",AVATAR:"Tag_Profile_IM_Image",MESSAGESETTINGS:"Tag_Profile_IM_MsgSettings",ADMINFORBIDTYPE:"Tag_Profile_IM_AdminForbidType",LEVEL:"Tag_Profile_IM_Level",ROLE:"Tag_Profile_IM_Role"},qe={UNKNOWN:"Gender_Type_Unknown",FEMALE:"Gender_Type_Female",MALE:"Gender_Type_Male"},Ve={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},Ke={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},Be="JoinedSuccess",He="WaitAdminApproval",xe="@TGS#_",We="@TOPIC#_",Ye=["url"],je=function(e){return"file"===at(e)},$e=function(e){return null!==e&&("number"==typeof e&&!isNaN(e-0)||"object"===o(e)&&e.constructor===Number)},ze=function(e){return"string"==typeof e},Je=function(e){return null!==e&&"object"===o(e)},Xe=function(e){if("object"!==o(e)||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n},Qe=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===at(e)},Ze=function(e){return void 0===e},et=function(e){return Qe(e)||Je(e)},ot=function(e){return"function"==typeof e},nt=function(e){return e instanceof Error},at=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},st=function(e){if("string"!=typeof e)return!1;var t=e[0];return!/[^a-zA-Z0-9]/.test(t)},rt=0;Date.now||(Date.now=function(){return(new Date).getTime()});var it={now:function(){0===rt&&(rt=Date.now()-1);var e=Date.now()-rt;return e>4294967295?(rt+=4294967295,Date.now()-rt):e},utc:function(){return Math.round(Date.now()/1e3)}},ct=function e(t,o,n,a){if(!et(t)||!et(o))return 0;for(var s,r=0,i=Object.keys(o),c=0,u=i.length;c<u;c++)if(s=i[c],!(Ze(o[s])||n&&n.includes(s)))if(et(t[s])&&et(o[s]))r+=e(t[s],o[s],n,a);else{if(a&&a.includes(o[s]))continue;t[s]!==o[s]&&(t[s]=o[s],r+=1)}return r},ut=function(e){return JSON.stringify(e,["message","code"])},lt=function(e){if(0===e.length)return 0;for(var t=0,o=0,n="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";void 0!==e[t];)o+=e[t++].charCodeAt[t]<=255?1:!1===n?3:2;return o},dt=function(e){var t=e||99999999;return Math.round(Math.random()*t)},pt="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",gt=pt.length,_t=function(e,t){for(var o in e)if(e[o]===t)return!0;return!1},ht={},ft=function(){if(te)return"https:";if(oe&&"undefined"==typeof window)return"https:";var e=window.location.protocol;return["http:","https:"].indexOf(e)<0&&(e="http:"),e},mt=function(e){return-1===e.indexOf("http://")||-1===e.indexOf("https://")?"https://"+e:e.replace(/https|http/,"https")},Mt=function e(t){if(0===Object.getOwnPropertyNames(t).length)return Object.create(null);var n=Array.isArray(t)?[]:Object.create(null),a="";for(var s in t)null!==t[s]?void 0!==t[s]?(a=o(t[s]),["string","number","function","boolean"].indexOf(a)>=0?n[s]=t[s]:n[s]=e(t[s])):n[s]=void 0:n[s]=null;return n};function vt(e,t){Qe(e)&&Qe(t)?t.forEach((function(t){var o=t.key,n=t.value,a=e.find((function(e){return e.key===o}));a?a.value=n:e.push({key:o,value:n})})):be.warn("updateCustomField target 或 source 不是数组,忽略此次更新。")}var It=function(e){return e===D.GRP_PUBLIC},yt=function(e){return e===D.GRP_AVCHATROOM},Et=function(e){var t=e.type,o=e.groupID;return t===D.GRP_COMMUNITY||"".concat(o).startsWith(xe)&&!"".concat(o).includes(We)},Tt=function(e){return"".concat(e).startsWith(xe)&&"".concat(e).includes(We)},St=function(e){return ze(e)&&e.slice(0,3)===D.CONV_C2C},Ct=function(e){return ze(e)&&e.slice(0,5)===D.CONV_GROUP},Dt=function(e){return ze(e)&&e===D.CONV_SYSTEM};function Nt(e,t){var o={};return Object.keys(e).forEach((function(n){o[n]=t(e[n],n)})),o}function At(e){return te?new Promise((function(t,o){ne.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,o){var n=new Image;n.onload=function(){t({width:this.width,height:this.height}),n=null},n.onerror=function(){t({width:0,height:0}),n=null},n.src=e}))}function Ot(){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 Rt(){var e="unknown";if(ye&&(e="mac"),Ie&&(e="windows"),le&&(e="ios"),pe&&(e="android"),te)try{var t=ne.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(o){}return e}function Lt(e,t){e=e.split("."),t=t.split(".");for(var o=Math.max(e.length,t.length);e.length<o;)e.push("0");for(;t.length<o;)t.push("0");for(var n=0;n<o;n++){var a=parseInt(e[n]),s=parseInt(t[n]);if(a>s)return 1;if(a<s)return-1}return 0}function kt(e){var t=e.originUrl,o=void 0===t?void 0:t,n=e.originWidth,a=e.originHeight,s=e.min,r=void 0===s?198:s,i=parseInt(n),c=parseInt(a),u={url:void 0,width:0,height:0};if((i<=c?i:c)<=r)u.url=o,u.width=i,u.height=c;else{c<=i?(u.width=Math.ceil(i*r/c),u.height=r):(u.width=r,u.height=Math.ceil(c*r/i));var l=o&&o.indexOf("?")>-1?"".concat(o,"&"):"".concat(o,"?");u.url="".concat(l,198===r?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")}return Ze(o)?g(u,Ye):u}function Gt(e){var t=e[2];e[2]=e[1],e[1]=t;for(var o=0;o<e.length;o++)e[o].setType(o)}function Pt(e){var t=e.servcmd;return t.slice(t.indexOf(".")+1)}function Ut(e,t){return Math.round(Number(e)*Math.pow(10,t))/Math.pow(10,t)}function bt(e,t){return e.includes(t)}function wt(e,t){return e.includes(t)}function Ft(e){return e.split(We)[0]}var qt=function(e,t){if(Ze(t))return"";switch(e){case D.MSG_TEXT:return t.text;case D.MSG_IMAGE:return"[图片]";case D.MSG_LOCATION:return"[位置]";case D.MSG_AUDIO:return"[语音]";case D.MSG_VIDEO:return"[视频]";case D.MSG_FILE:return"[文件]";case D.MSG_CUSTOM:return"[自定义消息]";case D.MSG_GRP_TIP:return"[群提示消息]";case D.MSG_GRP_SYS_NOTICE:return"[群系统通知]";case D.MSG_FACE:return"[动画表情]";case D.MSG_MERGER:return"[聊天记录]";default:return""}};function Vt(e){return e===D.MSG_TEXT||e===D.MSG_CUSTOM||e===D.MSG_LOCATION||e===D.MSG_FACE}var Kt=Object.prototype.hasOwnProperty;function Bt(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(Xe(e)){for(var t in e)if(Kt.call(e,t))return!1;return!0}return!("map"!==at(e)&&!function(e){return"set"===at(e)}(e)&&!je(e))&&0===e.size}function Ht(e,t,o){if(void 0===t)return!0;var n=!0;if("object"===R(t).toLowerCase())Object.keys(t).forEach((function(a){var s=1===e.length?e[0][a]:void 0;n=!!xt(s,t[a],o,a)&&n}));else if("array"===R(t).toLowerCase())for(var a=0;a<t.length;a++)n=!!xt(e[a],t[a],o,t[a].name)&&n;if(n)return n;throw new Error("Params validate failed.")}function xt(e,t,o,n){if(void 0===t)return!0;var a=!0;return t.required&&Bt(e)&&(Ae.error("TIM [".concat(o,'] Missing required params: "').concat(n,'".')),a=!1),Bt(e)||R(e).toLowerCase()===t.type.toLowerCase()||(Ae.error("TIM [".concat(o,'] Invalid params: type check failed for "').concat(n,'".Expected ').concat(t.type,".")),a=!1),t.validator&&!t.validator(e)&&(Ae.error("TIM [".concat(o,"] Invalid params: custom validator check failed for params.")),a=!1),a}var Wt,Yt={UNSEND:"unSend",SUCCESS:"success",FAIL:"fail"},jt={NOT_START:"notStart",PENDING:"pengding",RESOLVED:"resolved",REJECTED:"rejected"},$t=function(e){return!!e&&(!!(St(e)||Ct(e)||Dt(e))||(console.warn("非法的会话 ID:".concat(e,"。会话 ID 组成方式:C2C + userID(单聊)GROUP + groupID(群聊)@TIM#SYSTEM(系统通知会话)")),!1))},zt="请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#",Jt=function(e){return e.param?"".concat(e.api," ").concat(e.param," ").concat(e.desc,"。").concat(zt).concat(e.api):"".concat(e.api," ").concat(e.desc,"。").concat(zt).concat(e.api)},Xt={type:"String",required:!0},Qt={type:"Array",required:!0},Zt={type:"Object",required:!0},eo={login:{userID:Xt,userSig:Xt},addToBlacklist:{userIDList:Qt},on:[{name:"eventName",type:"String",validator:function(e){return"string"==typeof e&&0!==e.length||(console.warn(Jt({api:"on",param:"eventName",desc:"类型必须为 String,且不能为空"})),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(console.warn(Jt({api:"on",param:"handler",desc:"参数必须为 Function"})),!1):(""===e.name&&console.warn("on 接口的 handler 参数推荐使用具名函数。具名函数可以使用 off 接口取消订阅,匿名函数无法取消订阅。"),!0)}}],once:[{name:"eventName",type:"String",validator:function(e){return"string"==typeof e&&0!==e.length||(console.warn(Jt({api:"once",param:"eventName",desc:"类型必须为 String,且不能为空"})),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(console.warn(Jt({api:"once",param:"handler",desc:"参数必须为 Function"})),!1):(""===e.name&&console.warn("once 接口的 handler 参数推荐使用具名函数。"),!0)}}],off:[{name:"eventName",type:"String",validator:function(e){return"string"==typeof e&&0!==e.length||(console.warn(Jt({api:"off",param:"eventName",desc:"类型必须为 String,且不能为空"})),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(console.warn(Jt({api:"off",param:"handler",desc:"参数必须为 Function"})),!1):(""===e.name&&console.warn("off 接口无法为匿名函数取消监听事件。"),!0)}}],sendMessage:[t({name:"message"},Zt)],getMessageList:{conversationID:t(t({},Xt),{},{validator:function(e){return $t(e)}}),nextReqMessageID:{type:"String"},count:{type:"Number",validator:function(e){return!(!Ze(e)&&!/^[1-9][0-9]*$/.test(e))||(console.warn(Jt({api:"getMessageList",param:"count",desc:"必须为正整数"})),!1)}}},getMessageListHopping:{conversationID:t(t({},Xt),{},{validator:function(e){return $t(e)}}),sequence:{type:"Number"},time:{type:"Number"},direction:{type:"Number",validator:function(e){return!(!Ze(e)&&0!==e&&1!==e)||(console.warn(Jt({api:"getMessageListHopping",param:"direction",desc:"必须传 0 或 1"})),!1)}},count:{type:"Number",validator:function(e){return!(!Ze(e)&&!/^[1-9][0-9]*$/.test(e))||(console.warn(Jt({api:"getMessageListHopping",param:"count",desc:"必须为正整数"})),!1)}}},setMessageRead:{conversationID:t(t({},Xt),{},{validator:function(e){return $t(e)}})},setAllMessageRead:{scope:{type:"String",required:!1,validator:function(e){return!e||-1!==[D.READ_ALL_C2C_MSG,D.READ_ALL_GROUP_MSG,D.READ_ALL_MSG].indexOf(e)||(console.warn(Jt({api:"setAllMessageRead",param:"scope",desc:"取值必须为 TIM.TYPES.READ_ALL_C2C_MSG, TIM.TYPES.READ_ALL_GROUP_MSG 或 TIM.TYPES.READ_ALL_MSG"})),!1)}}},getConversationProfile:[t(t({name:"conversationID"},Xt),{},{validator:function(e){return $t(e)}})],deleteConversation:[t(t({name:"conversationID"},Xt),{},{validator:function(e){return $t(e)}})],pinConversation:{conversationID:t(t({},Xt),{},{validator:function(e){return $t(e)}}),isPinned:t({},{type:"Boolean",required:!0})},getConversationList:[{name:"options",type:"Array",validator:function(e){return!!Ze(e)||(0!==e.length||(console.warn(Jt({api:"getConversationList",desc:"获取指定会话时不能传入空数组"})),!1))}}],getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:Xt,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:Qt},createGroup:{name:Xt},joinGroup:{groupID:Xt,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[t({name:"groupID"},Xt)],handleApplication:{message:Zt,handleAction:Xt,handleMessage:{type:"String"}},changeGroupOwner:{groupID:Xt,newOwnerID:Xt},updateGroupProfile:{groupID:Xt,muteAllMembers:{type:"Boolean"}},dismissGroup:[t({name:"groupID"},Xt)],searchGroupByID:[t({name:"groupID"},Xt)],initGroupAttributes:{groupID:Xt,groupAttributes:t(t({},Zt),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(o){if(!ze(e[o]))return console.warn(Jt({api:"initGroupAttributes",desc:"群属性 value 必须是字符串"})),t=!1})),t}})},setGroupAttributes:{groupID:Xt,groupAttributes:t(t({},Zt),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(o){if(!ze(e[o]))return console.warn(Jt({api:"setGroupAttributes",desc:"群属性 value 必须是字符串"})),t=!1})),t}})},deleteGroupAttributes:{groupID:Xt,keyList:{type:"Array",validator:function(e){if(Ze(e))return console.warn(Jt({api:"deleteGroupAttributes",desc:"缺少必填参数:keyList"})),!1;if(!Qe(e))return!1;if(!Bt(e)){var t=!0;return e.forEach((function(e){if(!ze(e))return console.warn(Jt({api:"deleteGroupAttributes",desc:"群属性 key 必须是字符串"})),t=!1})),t}return!0}}},getGroupAttributes:{groupID:Xt,keyList:{type:"Array",validator:function(e){if(Ze(e))return console.warn(Jt({api:"getGroupAttributes",desc:"缺少必填参数:keyList"})),!1;if(!Qe(e))return!1;if(!Bt(e)){var t=!0;return e.forEach((function(e){if(!ze(e))return console.warn(Jt({api:"getGroupAttributes",desc:"群属性 key 必须是字符串"})),t=!1})),t}return!0}}},getGroupMemberList:{groupID:Xt,count:{type:"Number"}},getGroupMemberProfile:{groupID:Xt,userIDList:Qt,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:Xt,userIDList:Qt},setGroupMemberRole:{groupID:Xt,userID:Xt,role:Xt},setGroupMemberMuteTime:{groupID:Xt,userID:Xt,muteTime:{type:"Number",validator:function(e){return e>=0}}},setGroupMemberNameCard:{groupID:Xt,userID:{type:"String"},nameCard:{type:"String",validator:function(e){return ze(e)?(e.length,!0):(console.warn(Jt({api:"setGroupMemberNameCard",param:"nameCard",desc:"类型必须为 String"})),!1)}}},setGroupMemberCustomField:{groupID:Xt,userID:{type:"String"},memberCustomField:Qt},deleteGroupMember:{groupID:Xt},createTextMessage:{to:Xt,conversationType:Xt,payload:t(t({},Zt),{},{validator:function(e){return Xe(e)?ze(e.text)?0!==e.text.length||(console.warn(Jt({api:"createTextMessage",desc:"消息内容不能为空"})),!1):(console.warn(Jt({api:"createTextMessage",param:"payload.text",desc:"类型必须为 String"})),!1):(console.warn(Jt({api:"createTextMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createTextAtMessage:{to:Xt,conversationType:Xt,payload:t(t({},Zt),{},{validator:function(e){return Xe(e)?ze(e.text)?0===e.text.length?(console.warn(Jt({api:"createTextAtMessage",desc:"消息内容不能为空"})),!1):!(e.atUserList&&!Qe(e.atUserList))||(console.warn(Jt({api:"createTextAtMessage",desc:"payload.atUserList 类型必须为数组"})),!1):(console.warn(Jt({api:"createTextAtMessage",param:"payload.text",desc:"类型必须为 String"})),!1):(console.warn(Jt({api:"createTextAtMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createCustomMessage:{to:Xt,conversationType:Xt,payload:t(t({},Zt),{},{validator:function(e){return Xe(e)?e.data&&!ze(e.data)?(console.warn(Jt({api:"createCustomMessage",param:"payload.data",desc:"类型必须为 String"})),!1):e.description&&!ze(e.description)?(console.warn(Jt({api:"createCustomMessage",param:"payload.description",desc:"类型必须为 String"})),!1):!(e.extension&&!ze(e.extension))||(console.warn(Jt({api:"createCustomMessage",param:"payload.extension",desc:"类型必须为 String"})),!1):(console.warn(Jt({api:"createCustomMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createImageMessage:{to:Xt,conversationType:Xt,payload:t(t({},Zt),{},{validator:function(e){if(!Xe(e))return console.warn(Jt({api:"createImageMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(Ze(e.file))return console.warn(Jt({api:"createImageMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(oe){if(!(e.file instanceof HTMLInputElement||je(e.file)))return Xe(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(console.warn(Jt({api:"createImageMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1):(console.warn(Jt({api:"createImageMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(Jt({api:"createImageMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e){return Ze(e)&&console.warn(Jt({api:"createImageMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}})},createAudioMessage:{to:Xt,conversationType:Xt,payload:t(t({},Zt),{},{validator:function(e){return!!Xe(e)||(console.warn(Jt({api:"createAudioMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e){return Ze(e)&&console.warn(Jt({api:"createAudioMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},createVideoMessage:{to:Xt,conversationType:Xt,payload:t(t({},Zt),{},{validator:function(e){if(!Xe(e))return console.warn(Jt({api:"createVideoMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(Ze(e.file))return console.warn(Jt({api:"createVideoMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(oe){if(!(e.file instanceof HTMLInputElement||je(e.file)))return Xe(e.file)&&"undefined"!=typeof uni?!!je(e.file.tempFile)||(console.warn(Jt({api:"createVideoMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1):(console.warn(Jt({api:"createVideoMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(Jt({api:"createVideoMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return Ze(e)&&console.warn(Jt({api:"createVideoMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},createFaceMessage:{to:Xt,conversationType:Xt,payload:t(t({},Zt),{},{validator:function(e){return Xe(e)?$e(e.index)?!!ze(e.data)||(console.warn(Jt({api:"createFaceMessage",param:"payload.data",desc:"类型必须为 String"})),!1):(console.warn(Jt({api:"createFaceMessage",param:"payload.index",desc:"类型必须为 Number"})),!1):(console.warn(Jt({api:"createFaceMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createFileMessage:{to:Xt,conversationType:Xt,payload:t(t({},Zt),{},{validator:function(e){if(!Xe(e))return console.warn(Jt({api:"createFileMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(Ze(e.file))return console.warn(Jt({api:"createFileMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(oe){if(!(e.file instanceof HTMLInputElement||je(e.file)))return Xe(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(console.warn(Jt({api:"createFileMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1):(console.warn(Jt({api:"createFileMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(Jt({api:"createFileMessage",desc:"您没有选择文件,无法发送"})),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return Ze(e)&&console.warn(Jt({api:"createFileMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},createLocationMessage:{to:Xt,conversationType:Xt,payload:t(t({},Zt),{},{validator:function(e){return Xe(e)?ze(e.description)?$e(e.longitude)?!!$e(e.latitude)||(console.warn(Jt({api:"createLocationMessage",param:"payload.latitude",desc:"类型必须为 Number"})),!1):(console.warn(Jt({api:"createLocationMessage",param:"payload.longitude",desc:"类型必须为 Number"})),!1):(console.warn(Jt({api:"createLocationMessage",param:"payload.description",desc:"类型必须为 String"})),!1):(console.warn(Jt({api:"createLocationMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createMergerMessage:{to:Xt,conversationType:Xt,payload:t(t({},Zt),{},{validator:function(e){if(Bt(e.messageList))return console.warn(Jt({api:"createMergerMessage",desc:"不能为空数组"})),!1;if(Bt(e.compatibleText))return console.warn(Jt({api:"createMergerMessage",desc:"类型必须为 String,且不能为空"})),!1;var t=!1;return e.messageList.forEach((function(e){e.status===Yt.FAIL&&(t=!0)})),!t||(console.warn(Jt({api:"createMergerMessage",desc:"不支持合并已发送失败的消息"})),!1)}})},revokeMessage:[t(t({name:"message"},Zt),{},{validator:function(e){return Bt(e)?(console.warn(Jt({api:"revokeMessage",desc:"请传入消息(Message)实例"})),!1):e.conversationType===D.CONV_SYSTEM?(console.warn(Jt({api:"revokeMessage",desc:"不能撤回系统会话消息,只能撤回单聊消息或群消息"})),!1):!0!==e.isRevoked||(console.warn(Jt({api:"revokeMessage",desc:"消息已经被撤回,请勿重复操作"})),!1)}})],deleteMessage:[t(t({name:"messageList"},Qt),{},{validator:function(e){return!Bt(e)||(console.warn(Jt({api:"deleteMessage",param:"messageList",desc:"不能为空数组"})),!1)}})],modifyMessage:[t(t({name:"message"},Zt),{},{validator:function(e){return Bt(e)?(console.warn(Jt({api:"modifyMessage",desc:"请传入消息(Message)实例"})),!1):e.conversationType===D.CONV_SYSTEM?(console.warn(Jt({api:"modifyMessage",desc:"不支持修改系统会话消息,只能修改单聊消息或群消息"})),!1):!0!==e._onlineOnlyFlag||(console.warn(Jt({api:"modifyMessage",desc:"不支持修改在线消息"})),!1)}})],getUserProfile:{userIDList:{type:"Array",validator:function(e){return Qe(e)?(0===e.length&&console.warn(Jt({api:"getUserProfile",param:"userIDList",desc:"不能为空数组"})),!0):(console.warn(Jt({api:"getUserProfile",param:"userIDList",desc:"必须为数组"})),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e){return!!Ze(e)||(!!Qe(e)||(console.warn(Jt({api:"updateMyProfile",param:"profileCustomField",desc:"必须为数组"})),!1))}}},setSelfStatus:{customStatus:{type:"String",validator:function(e){return!!ze(e)||(console.warn(Jt({api:"setSelfStatus",param:"customStatus",desc:Xt})),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(e){return Qe(e)?0!==e.length||(console.warn(Jt({api:"getUserStatus",param:"userIDList",desc:"不能为空数组"})),!1):(console.warn(Jt({api:"getUserStatus",param:"userIDList",desc:"必须为数组"})),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return Qe(e)?0!==e.length||(console.warn(Jt({api:"subscribeUserStatus",param:"userIDList",desc:"不能为空数组"})),!1):(console.warn(Jt({api:"subscribeUserStatus",param:"userIDList",desc:"必须为数组"})),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return!e||(!!Qe(e)||(console.warn(Jt({api:"subscribeUserStatus",param:"userIDList",desc:"必须为数组"})),!1))}}},addFriend:{to:Xt,source:{type:"String",required:!0,validator:function(e){return!!e&&(e.startsWith("AddSource_Type_")?!(e.replace("AddSource_Type_","").length>8)||(console.warn(Jt({api:"addFriend",desc:"加好友来源字段的关键字长度不得超过8字节"})),!1):(console.warn(Jt({api:"addFriend",desc:"加好友来源字段的前缀必须是:AddSource_Type_"})),!1))}},remark:{type:"String",required:!1,validator:function(e){return!(ze(e)&&e.length>96)||(console.warn(Jt({api:"updateFriend",desc:" 备注长度最长不得超过 96 个字节"})),!1)}}},deleteFriend:{userIDList:Qt},checkFriend:{userIDList:Qt},getFriendProfile:{userIDList:Qt},updateFriend:{userID:Xt,remark:{type:"String",required:!1,validator:function(e){return!(ze(e)&&e.length>96)||(console.warn(Jt({api:"updateFriend",desc:" 备注长度最长不得超过 96 个字节"})),!1)}},friendCustomField:{type:"Array",required:!1,validator:function(e){if(e){if(!Qe(e))return console.warn(Jt({api:"updateFriend",param:"friendCustomField",desc:"必须为数组"})),!1;var t=!0;return e.forEach((function(e){return ze(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?ze(e.value)?e.value.length>8?(console.warn(Jt({api:"updateFriend",desc:"好友自定义字段的关键字长度不得超过8字节"})),t=!1):void 0:(console.warn(Jt({api:"updateFriend",desc:"类型必须为 String"})),t=!1):(console.warn(Jt({api:"updateFriend",desc:"好友自定义字段的前缀必须是 Tag_SNS_Custom"})),t=!1)})),t}return!0}}},acceptFriendApplication:{userID:Xt},refuseFriendApplication:{userID:Xt},deleteFriendApplication:{userID:Xt},createFriendGroup:{name:Xt},deleteFriendGroup:{name:Xt},addToFriendGroup:{name:Xt,userIDList:Qt},removeFromFriendGroup:{name:Xt,userIDList:Qt},renameFriendGroup:{oldName:Xt,newName:Xt},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(e){return Qe(e)?0!==e.length||(console.warn(Jt({api:"sendMessageReadReceipt",param:"messageList",desc:"不能为空数组"})),!1):(console.warn(Jt({api:"sendMessageReadReceipt",param:"messageList",desc:"必须为数组"})),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(e){return Qe(e)?0!==e.length||(console.warn(Jt({api:"getMessageReadReceiptList",param:"messageList",desc:"不能为空数组"})),!1):(console.warn(Jt({api:"getMessageReadReceiptList",param:"messageList",desc:"必须为数组"})),!1)}}],createTopicInCommunity:{groupID:Xt,topicName:Xt},deleteTopicFromCommunity:{groupID:Xt,topicIDList:{type:"Array",validator:function(e){return!e||(!!Qe(e)||(console.warn(Jt({api:"deleteTopicFromCommunity",param:"topicIDList",desc:"必须为数组"})),!1))}}},updateTopicProfile:{groupID:Xt,topicID:Xt},getTopicList:{groupID:Xt,topicIDList:{type:"Array",validator:function(e){return!e||(!!Qe(e)||(console.warn(Jt({api:"getTopicList",param:"topicIDList",desc:"必须为数组"})),!1))}}}},to={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"},oo="sign",no="message",ao="user",so="c2c",ro="group",io="sns",co="groupMember",uo="Topic",lo="conversation",po="context",go="storage",_o="eventStat",ho="netMonitor",fo="bigDataChannel",mo="upload",Mo="plugin",vo="syncUnreadMessage",Io="session",yo="channel",Eo="message_loss_detection",To="cloudControl",So="workerTimer",Co="pullGroupMessage",Do="qualityStat",No="commercialConfig",Ao=function(){function e(t){n(this,e),this._moduleManager=t,this._className=""}return s(e,[{key:"isLoggedIn",value:function(){return this._moduleManager.getModule(po).isLoggedIn()}},{key:"isOversea",value:function(){return this._moduleManager.getModule(po).isOversea()}},{key:"isPrivateNetWork",value:function(){return this._moduleManager.getModule(po).isPrivateNetWork()}},{key:"getMyUserID",value:function(){return this._moduleManager.getModule(po).getUserID()}},{key:"getMyTinyID",value:function(){return this._moduleManager.getModule(po).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(ho).getNetworkType()}},{key:"probeNetwork",value:function(e){return this.isPrivateNetWork()?Promise.resolve([!0,this.getNetworkType()]):this._moduleManager.getModule(ho).probe(e)}},{key:"getCloudConfig",value:function(e){return this._moduleManager.getModule(To).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(po).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(C.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(Io).request(e)}}]),e}(),Oo="wslogin",Ro="wslogout",Lo="wshello",ko="KickOther",Go="getmsg",Po="authkey",Uo="sendmsg",bo="send_group_msg",wo="portrait_get_all",Fo="portrait_set",qo="black_list_get",Vo="black_list_add",Ko="black_list_delete",Bo="msgwithdraw",Ho="msgreaded",xo="set_c2c_peer_mute_notifications",Wo="get_c2c_peer_mute_notifications",Yo="getroammsg",jo="get_peer_read_time",$o="delete_c2c_msg_ramble",zo="modify_c2c_msg",Jo="page_get",Xo="get",Qo="delete",Zo="top",en="deletemsg",tn="get_joined_group_list",on="get_group_self_member_info",nn="create_group",an="destroy_group",sn="modify_group_base_info",rn="apply_join_group",cn="apply_join_group_noauth",un="quit_group",ln="get_group_public_info",dn="change_group_owner",pn="handle_apply_join_group",gn="handle_invite_join_group",_n="group_msg_recall",hn="msg_read_report",fn="read_all_unread_msg",mn="group_msg_get",Mn="get_group_msg_receipt",vn="group_msg_receipt",In="c2c_msg_read_receipt",yn="get_group_msg_receipt_detail",En="get_pendency",Tn="deletemsg",Sn="get_msg",Cn="get_msg_noauth",Dn="get_online_member_num",Nn="delete_group_ramble_msg_by_seq",An="modify_group_msg",On="set_group_attr",Rn="modify_group_attr",Ln="delete_group_attr",kn="clear_group_attr",Gn="get_group_attr",Pn="get_group_member_info",Un="get_specified_group_member_info",bn="add_group_member",wn="delete_group_member",Fn="modify_group_member_info",qn="cos",Vn="pre_sig",Kn="video_cover",Bn="tim_web_report_v2",Hn="alive",xn="msg_push",Wn="multi_msg_push_ws",Yn="ws_msg_push_ack",jn="stat_forceoffline",$n="save_relay_json_msg",zn="get_relay_json_msg",Jn="fetch_config",Xn="push_configv2",Qn="fetch_imsdk_purchase_bitsv2",Zn="push_imsdk_purchase_bitsv2",ea="notify2",ta="create_topic",oa="destroy_topic",na="modify_topic",aa="get_topic",sa="ws_set_custom_status",ra="ws_get_user_status",ia="ws_status_subscribe",ca="ws_status_unsubscribe",ua={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},la={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:"套餐包不支持该接口的使用,请升级到旗舰版套餐"},da="networkRTT",pa="messageE2EDelay",ga="sendMessageC2C",_a="sendMessageGroup",ha="sendMessageGroupAV",fa="sendMessageRichMedia",ma="cosUpload",Ma="messageReceivedGroup",va="messageReceivedGroupAVPush",Ia="messageReceivedGroupAVPull",ya=(r(Wt={},da,2),r(Wt,pa,3),r(Wt,ga,4),r(Wt,_a,5),r(Wt,ha,6),r(Wt,fa,7),r(Wt,Ma,8),r(Wt,va,9),r(Wt,Ia,10),r(Wt,ma,11),Wt),Ea={info:4,warning:5,error:6},Ta={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},Sa={login:4},Ca=function(){function e(t){n(this,e),this.eventType=Sa[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 o=Re();0===this.costTime&&(this.costTime=o-this._startts),this.setMoreMessage("startts:".concat(this._startts," endts:").concat(o)),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,o){return e instanceof Error?(this._sentFlag||(this.setNetworkType(o),t?(e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message)):(this.setCode(ua.NO_NETWORK),this.setMoreMessage(la.NO_NETWORK)),this.setLevel("error")),this):(be.warn("SSOLogData.setError value not instanceof Error, please check!"),this)}},{key:"setCode",value:function(e){return Ze(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),$e(e)?this.code=e:be.warn("SSOLogData.setCode value not a number, please check!",e,o(e))),this}},{key:"setMessage",value:function(e){return Ze(e)||this._sentFlag||($e(e)&&(this.message=e.toString()),ze(e)&&(this.message=e)),this}},{key:"setCostTime",value:function(e){return this.costTime=e,this}},{key:"setLevel",value:function(e){return Ze(e)||this._sentFlag||(this.level=Ea[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(Ze(e))be.warn("SSOLogData.setNetworkType value is undefined, please check!");else{var t=Ta[e.toLowerCase()];Ze(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}(),Da={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"},Na=function(){function e(t){n(this,e),this.type=D.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}(),Aa=function(){function e(t){n(this,e),this._imageMemoryURL="",te?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=D.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||we.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=dt(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,o=null,n=null;t<=2;)n=Ze(e)||Ze(e[t])?{type:0,size:0,width:0,height:0,url:""}:e[t],(o=new this._ImageInfoModel(n)).setSizeType(t+1),o.setType(t),this.addImageInfo(o),t++;this.updateAccessSideImageInfoArray()}},{key:"updateImageInfoArray",value:function(e){for(var t,o=this.content.imageInfoArray.length,n=0;n<o;n++)t=this.content.imageInfoArray[n],e[n].size&&(t.size=e[n].size),e[n].url&&t.setImageUrl(e[n].url),e[n].width&&(t.width=e[n].width),e[n].height&&(t.height=e[n].height)}},{key:"_autoFixUrl",value:function(){for(var e=this.content.imageInfoArray.length,t="",o="",n=["http","https"],a=null,s=0;s<e;s++)this.content.imageInfoArray[s].url&&""!==(a=this.content.imageInfoArray[s]).imageUrl&&(o=a.imageUrl.slice(0,a.imageUrl.indexOf("://")+1),t=a.imageUrl.slice(a.imageUrl.indexOf("://")+1),n.indexOf(o)<0&&(o="https:"),this.content.imageInfoArray[s].setImageUrl([o,t].join("")))}},{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateImageFormat",value:function(e){this.content.imageFormat=we[e.toUpperCase()]||we.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],o=t.width,n=void 0===o?0:o,a=t.height,s=void 0===a?0:a;0!==n&&0!==s&&(Gt(e),Object.assign(e[2],kt({originWidth:n,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}(),Oa=function(){function e(t){n(this,e),this.type=D.MSG_FACE,this.content=t||null}return s(e,[{key:"sendable",value:function(){return null!==this.content}}]),e}(),Ra=function(){function e(t){n(this,e),this.type=D.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}(),La={from:!0,groupID:!0,groupName:!0,to:!0},ka=function(){function e(t){n(this,e),this.type=D.MSG_GRP_TIP,this.content={},this._initContent(t)}return s(e,[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(o){switch(o){case"remarkInfo":break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[o]);break;case"operatorInfo":break;case"memberInfoList":case"msgMemberInfo":t._updateMemberList(e[o]);break;case"onlineMemberInfo":break;case"memberNum":t.content[o]=e[o],t.content.memberCount=e[o];break;case"newGroupProfile":t.content.newGroupProfile={},t._initNewGroupProfile(e[o]);break;default:t.content[o]=e[o]}})),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),o=0;o<t.length;o++){var n=t[o];La[n]&&(this.content.groupProfile[n]=e[n])}}},{key:"_updateMemberList",value:function(e){Bt(this.content.memberList)?this.content.memberList=e:this.content.memberList.forEach((function(t){e.forEach((function(e){t.userID===e.userID&&Object.assign(t,e)}))}))}},{key:"_initNewGroupProfile",value:function(e){for(var t=Object.keys(e),o=0;o<t.length;o++){var n=t[o];"muteAllMembers"!==n?this.content.newGroupProfile[n]=e[n]:this.content.newGroupProfile[n]=1===e[n]}}}]),e}(),Ga={from:!0,groupID:!0,groupName:!0,to:!0},Pa=function(){function e(t){n(this,e),this.type=D.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(t)}return s(e,[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(o){switch(o){case"memberInfoList":break;case"remarkInfo":t.content.handleMessage=e[o];break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[o]);break;default:t.content[o]=e[o]}}))}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),o=0;o<t.length;o++){var n=t[o];Ga[n]&&("groupName"===n?this.content.groupProfile.name=e[n]:this.content.groupProfile[n]=e[n])}}}]),e}(),Ua=function(){function e(t){n(this,e),this.type=D.MSG_FILE,this._percent=0;var o=this._getFileInfo(t);this.content={downloadFlag:2,fileUrl:t.url||"",uuid:t.uuid,fileName:o.name||"",fileSize:o.size||0}}return s(e,[{key:"_getFileInfo",value:function(e){if(!Ze(e.fileName)&&!Ze(e.fileSize))return{size:e.fileSize,name:e.fileName};var t=e.file.files[0];if(Z){if(t.path&&-1!==t.path.indexOf(".")){var o=t.path.slice(t.path.lastIndexOf(".")+1).toLowerCase();t.type=o,t.name||(t.name="".concat(dt(999999),".").concat(o))}t.name||(t.type="",t.name=t.path.slice(t.path.lastIndexOf("/")+1).toLowerCase()),t.suffix&&(t.type=t.suffix),t.url||(t.url=t.path)}return{size:t.size,name:t.name}}},{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(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}(),ba=function(){function e(t){n(this,e),this.type=D.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}(),wa=function(){function e(t){n(this,e),this.type=D.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,o=e.snapshotWidth,n=e.snapshotHeight;Bt(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),Bt(o)||(this.content.thumbWidth=this.content.snapshotWidth=Number(o)),Bt(n)||(this.content.thumbHeight=this.content.snapshotHeight=Number(n))}},{key:"sendable",value:function(){return""!==this.content.remoteVideoUrl}}]),e}(),Fa=function(){function e(t){n(this,e),this.type=D.MSG_LOCATION;var o=t.description,a=t.longitude,s=t.latitude;this.content={description:o,longitude:a,latitude:s}}return s(e,[{key:"sendable",value:function(){return!0}}]),e}(),qa=function(){function e(t){if(n(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(D.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(D.CONV_GROUP)&&(this.receiverGroupID=t.to),this.messageReceiver=t.to;else{this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[];var o=t.elements[0].type,a=t.elements[0].content;this._patchRichMediaPayload(o,a),o===D.MSG_MERGER?this.messageBody.push({type:o,payload:new Va(a).content}):this.messageBody.push({type:o,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===D.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===D.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===D.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===D.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}}]),e}(),Va=function(){function e(t){if(n(this,e),this.type=D.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},t.downloadKey){var o=t.downloadKey,a=t.pbDownloadKey,s=t.title,r=t.abstractList,i=t.compatibleText,c=t.version;this.content.downloadKey=o,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,g=t.version,_=[];u.forEach((function(e){if(!Bt(e)){var t=new qa(e);_.push(t)}})),this.content.messageList=_,this.content.title=l,this.content.abstractList=d,this.content.compatibleText=p,this.content.version=g||0}be.debug("MergerElement.content:",this.content)}return s(e,[{key:"sendable",value:function(){return!Bt(this.content.messageList)||!Bt(this.content.downloadKey)}}]),e}(),Ka={1:D.MSG_PRIORITY_HIGH,2:D.MSG_PRIORITY_NORMAL,3:D.MSG_PRIORITY_LOW,4:D.MSG_PRIORITY_LOWEST},Ba=function(){function e(t){n(this,e),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||D.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:dt(),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||Yt.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 be.warn("!!!Message 实例的 elements 属性即将废弃,请尽快修改。使用 type 和 payload 属性处理单条消息,兼容组合消息使用 _elements 属性!!!"),this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){if(null!==e){ze(e.nick)&&(this.nick=e.nick),ze(e.avatar)&&(this.avatar=e.avatar);var t=e.messageFromAccountExtraInformation;Xe(t)&&ze(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!==D.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(D.MSG_AT_ALL))})),Qe(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(D.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?Yt.SUCCESS:Yt.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?(be.warn("".concat(this._elements[0].type,' need "boolean : sendable()" method')),!1):this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===D.CONV_GROUP&&(this.to=e.groupID)}},{key:"_initSequence",value:function(e){0===this.clientSequence&&e&&(this.clientSequence=function(e){if(!e)return be.error("autoIncrementIndex(string: key) need key parameter"),!1;if(void 0===ht[e]){var t=new Date,o="3".concat(t.getHours()).slice(-2),n="0".concat(t.getMinutes()).slice(-2),a="0".concat(t.getSeconds()).slice(-2);ht[e]=parseInt([o,n,a,"0001"].join("")),o=null,n=null,a=null,be.log("autoIncrementIndex start index:".concat(ht[e]))}return ht[e]++}(e)),0===this.sequence&&this.conversationType===D.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===D.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,o="",n=this.conversationType;n!==D.CONV_SYSTEM?(o=n===D.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID="".concat(n).concat(o)):this.conversationID=D.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof Na||e instanceof Aa||e instanceof Oa||e instanceof Ra||e instanceof Ua||e instanceof wa||e instanceof ka||e instanceof Pa||e instanceof ba||e instanceof Fa||e instanceof Va}},{key:"setElement",value:function(e){var t=this;if(this.isElement(e))return this._elements=[e],void this._initProxy();var o=function(e){if(e.type&&e.content)switch(e.type){case D.MSG_TEXT:t.setTextElement(e.content);break;case D.MSG_IMAGE:t.setImageElement(e.content);break;case D.MSG_AUDIO:t.setAudioElement(e.content);break;case D.MSG_FILE:t.setFileElement(e.content);break;case D.MSG_VIDEO:t.setVideoElement(e.content);break;case D.MSG_CUSTOM:t.setCustomElement(e.content);break;case D.MSG_LOCATION:t.setLocationElement(e.content);break;case D.MSG_GRP_TIP:t.setGroupTipElement(e.content);break;case D.MSG_GRP_SYS_NOTICE:t.setGroupSystemNoticeElement(e.content);break;case D.MSG_FACE:t.setFaceElement(e.content);break;case D.MSG_MERGER:t.setMergerElement(e.content);break;default:be.warn(e.type,e.content,"no operation......")}};if(Qe(e))for(var n=0;n<e.length;n++)o(e[n]);else o(e);this._initProxy()}},{key:"clearElement",value:function(){this._elements.length=0}},{key:"setTextElement",value:function(e){var t="string"==typeof e?e:e.text,o=new Na({text:t});this._elements.push(o)}},{key:"setImageElement",value:function(e){var t=new Aa(e);this._elements.push(t)}},{key:"setAudioElement",value:function(e){var t=new Ra(e);this._elements.push(t)}},{key:"setFileElement",value:function(e){var t=new Ua(e);this._elements.push(t)}},{key:"setVideoElement",value:function(e){var t=new wa(e);this._elements.push(t)}},{key:"setLocationElement",value:function(e){var t=new Fa(e);this._elements.push(t)}},{key:"setCustomElement",value:function(e){var t=new ba(e);this._elements.push(t)}},{key:"setGroupTipElement",value:function(e){var t={},o=e.operationType;Bt(e.memberInfoList)?e.operatorInfo&&(t=e.operatorInfo):o!==D.GRP_TIP_MBR_JOIN&&o!==D.GRP_TIP_MBR_KICKED_OUT&&o!==D.GRP_TIP_MBR_SET_ADMIN&&o!==D.GRP_TIP_MBR_CANCELED_ADMIN||(t=e.memberInfoList[0]);var n=t,a=n.nick,s=n.avatar;ze(a)&&(this.nick=a),ze(s)&&(this.avatar=s);var r=new ka(e);this._elements.push(r)}},{key:"setGroupSystemNoticeElement",value:function(e){var t=new Pa(e);this._elements.push(t)}},{key:"setFaceElement",value:function(e){var t=new Oa(e);this._elements.push(t)}},{key:"setMergerElement",value:function(e){var t=new Va(e);this._elements.push(t)}},{key:"setIsRead",value:function(e){this.isRead=e}},{key:"setRelayFlag",value:function(e){this._relayFlag=e}},{key:"getRelayFlag",value:function(){return this._relayFlag}},{key:"_computePriority",value:function(e){if(Ze(e))return D.MSG_PRIORITY_NORMAL;if(ze(e)&&-1!==Object.values(Ka).indexOf(e))return e;if($e(e)){var t=""+e;if(-1!==Object.keys(Ka).indexOf(t))return Ka[t]}return D.MSG_PRIORITY_NORMAL}},{key:"setNickAndAvatar",value:function(e){var t=e.nick,o=e.avatar;ze(t)&&(this.nick=t),ze(o)&&(this.avatar=o)}},{key:"setNameCard",value:function(e){ze(e)&&(this.nameCard=e)}}]),e}(),Ha=function(e){return{code:0,data:e||{}}},xa="https://cloud.tencent.com/document/product/",Wa="您可以在即时通信 IM 控制台的【开发辅助工具(https://console.cloud.tencent.com/im-detail/tool-usersig)】 页面校验 UserSig。",Ya="UserSig 非法,请使用官网提供的 API 重新生成 UserSig(".concat(xa,"269/32688)。"),ja="#.E6.B6.88.E6.81.AF.E5.85.83.E7.B4.A0-timmsgelement",$a={70001:"UserSig 已过期,请重新生成。建议 UserSig 有效期设置不小于24小时。",70002:"UserSig 长度为0,请检查传入的 UserSig 是否正确。",70003:Ya,70005:Ya,70009:"UserSig 验证失败,可能因为生成 UserSig 时混用了其他 SDKAppID 的私钥或密钥导致,请使用对应 SDKAppID 下的私钥或密钥重新生成 UserSig(".concat(xa,"269/32688)。"),70013:"请求中的 UserID 与生成 UserSig 时使用的 UserID 不匹配。".concat(Wa),70014:"请求中的 SDKAppID 与生成 UserSig 时使用的 SDKAppID 不匹配。".concat(Wa),70016:"密钥不存在,UserSig 验证失败,请在即时通信 IM 控制台获取密钥(".concat(xa,"269/32578#.E8.8E.B7.E5.8F.96.E5.AF.86.E9.92.A5)。"),70020:"SDKAppID 未找到,请在即时通信 IM 控制台确认应用信息。",70050:"UserSig 验证次数过于频繁。请检查 UserSig 是否正确,并于1分钟后重新验证。".concat(Wa),70051:"帐号被拉入黑名单。",70052:"UserSig 已经失效,请重新生成,再次尝试。",70107:"因安全原因被限制登录,请不要频繁登录。",70169:"请求的用户帐号不存在。",70114:"".concat("服务端内部超时,请稍后重试。"),70202:"".concat("服务端内部超时,请稍后重试。"),70206:"请求中批量数量不合法。",70402:"参数非法,请检查必填字段是否填充,或者字段的填充是否满足协议要求。",70403:"请求失败,需要 App 管理员权限。",70398:"帐号数超限。如需创建多于100个帐号,请将应用升级为专业版,具体操作指引请参见购买指引(".concat(xa,"269/32458)。"),70500:"".concat("服务端内部错误,请重试。"),71e3:"删除帐号失败。仅支持删除体验版帐号,您当前应用为专业版,暂不支持帐号删除。",20001:"请求包非法。",20002:"UserSig 或 A2 失效。",20003:"消息发送方或接收方 UserID 无效或不存在,请检查 UserID 是否已导入即时通信 IM。",20004:"网络异常,请重试。",20005:"".concat("服务端内部错误,请重试。"),20006:"触发发送".concat("单聊消息","之前回调,App 后台返回禁止下发该消息。"),20007:"发送".concat("单聊消息",",被对方拉黑,禁止发送。消息发送状态默认展示为失败,您可以登录控制台修改该场景下的消息发送状态展示结果,具体操作请参见消息保留设置(").concat(xa,"269/38656)。"),20009:"消息发送双方互相不是好友,禁止发送(配置".concat("单聊消息","校验好友关系才会出现)。"),20010:"发送".concat("单聊消息",",自己不是对方的好友(单向关系),禁止发送。"),20011:"发送".concat("单聊消息",",对方不是自己的好友(单向关系),禁止发送。"),20012:"发送方被禁言,该条消息被禁止发送。",20016:"消息撤回超过了时间限制(默认2分钟)。",20018:"删除漫游内部错误。",90001:"JSON 格式解析失败,请检查请求包是否符合 JSON 规范。",90002:"".concat("JSON 格式请求包体","中 MsgBody 不符合消息格式描述,或者 MsgBody 不是 Array 类型,请参考 TIMMsgElement 对象的定义(").concat(xa,"269/2720").concat(ja,")。"),90003:"".concat("JSON 格式请求包体","中缺少 To_Account 字段或者 To_Account 帐号不存在。"),90005:"".concat("JSON 格式请求包体","中缺少 MsgRandom 字段或者 MsgRandom 字段不是 Integer 类型。"),90006:"".concat("JSON 格式请求包体","中缺少 MsgTimeStamp 字段或者 MsgTimeStamp 字段不是 Integer 类型。"),90007:"".concat("JSON 格式请求包体","中 MsgBody 类型不是 Array 类型,请将其修改为 Array 类型。"),90008:"".concat("JSON 格式请求包体","中缺少 From_Account 字段或者 From_Account 帐号不存在。"),90009:"请求需要 App 管理员权限。",90010:"".concat("JSON 格式请求包体","不符合消息格式描述,请参考 TIMMsgElement 对象的定义(").concat(xa,"269/2720").concat(ja,")。"),90011:"批量发消息目标帐号超过500,请减少 To_Account 中目标帐号数量。",90012:"To_Account 没有注册或不存在,请确认 To_Account 是否导入即时通信 IM 或者是否拼写错误。",90026:"消息离线存储时间错误(最多不能超过7天)。",90031:"".concat("JSON 格式请求包体","中 SyncOtherMachine 字段不是 Integer 类型。"),90044:"".concat("JSON 格式请求包体","中 MsgLifeTime 字段不是 Integer 类型。"),90048:"请求的用户帐号不存在。",90054:"撤回请求中的 MsgKey 不合法。",90994:"".concat("服务端内部错误,请重试。"),90995:"".concat("服务端内部错误,请重试。"),91e3:"".concat("服务端内部错误,请重试。"),90992:"".concat("服务端内部错误,请重试。","如果所有请求都返回该错误码,且 App 配置了第三方回调,请检查 App 服务端是否正常向即时通信 IM 后台服务端返回回调结果。"),93e3:"JSON 数据包超长,消息包体请不要超过8k。",91101:"Web 端长轮询被踢(Web 端同时在线实例个数超出限制)。",10002:"".concat("服务端内部错误,请重试。"),10003:"请求中的接口名称错误,请核对接口名称并重试。",10004:"参数非法,请根据错误描述检查请求是否正确。",10005:"请求包体中携带的帐号数量过多。",10006:"操作频率限制,请尝试降低调用的频率。",10007:"操作权限不足,例如 Work ".concat("群组","中普通成员尝试执行踢人操作,但只有 App 管理员才有权限。"),10008:"请求非法,可能是请求中携带的签名信息验证不正确,请再次尝试。",10009:"该群不允许群主主动退出。",10010:"".concat("群组","不存在,或者曾经存在过,但是目前已经被解散。"),10011:"解析 JSON 包体失败,请检查包体的格式是否符合 JSON 格式。",10012:"发起操作的 UserID 非法,请检查发起操作的用户 UserID 是否填写正确。",10013:"被邀请加入的用户已经是群成员。",10014:"群已满员,无法将请求中的用户加入".concat("群组",",如果是批量加人,可以尝试减少加入用户的数量。"),10015:"找不到指定 ID 的".concat("群组","。"),10016:"App 后台通过第三方回调拒绝本次操作。",10017:"因被禁言而不能发送消息,请检查发送者是否被设置禁言。",10018:"应答包长度超过最大包长(1MB),请求的内容过多,请尝试减少单次请求的数据量。",10019:"请求的用户帐号不存在。",10021:"".concat("群组"," ID 已被使用,请选择其他的").concat("群组"," ID。"),10023:"发消息的频率超限,请延长两次发消息时间的间隔。",10024:"此邀请或者申请请求已经被处理。",10025:"".concat("群组"," ID 已被使用,并且操作者为群主,可以直接使用。"),10026:"该 SDKAppID 请求的命令字已被禁用。",10030:"请求撤回的消息不存在。",10031:"消息撤回超过了时间限制(默认2分钟)。",10032:"请求撤回的消息不支持撤回操作。",10033:"".concat("群组","类型不支持消息撤回操作。"),10034:"该消息类型不支持删除操作。",10035:"直播群和在线成员广播大群不支持删除消息。",10036:"直播群创建数量超过了限制,请参考价格说明(".concat(xa,"269/11673)购买预付费套餐“IM直播群”。"),10037:"单个用户可创建和加入的".concat("群组","数量超过了限制,请参考价格说明(").concat(xa,"269/11673)购买或升级预付费套餐“单人可创建与加入").concat("群组","数”。"),10038:"群成员数量超过限制,请参考价格说明(".concat(xa,"269/11673)购买或升级预付费套餐“扩展群人数上限”。"),10041:"该应用(SDKAppID)已配置不支持群消息撤回。",10050:"群属性 key 不存在",10056:"请在写入群属性前先使用 getGroupAttributes 接口更新本地群属性,避免冲突。",10059:"非旗舰版",10060:"群人数超过已读回执人数上限",10061:"在线消息不支持已读回执",10062:"找不到群消息的已读回执信息",20026:"消息不存在",20029:"该群类型不支持修改消息。",30001:"请求参数错误,请根据错误描述检查请求参数",30002:"SDKAppID 不匹配",30003:"请求的用户帐号不存在",30004:"请求需要 App 管理员权限",30005:"关系链字段中包含敏感词",30006:"".concat("服务端内部错误,请重试。"),30007:"".concat("网络超时,请稍后重试. "),30008:"并发写导致写冲突,建议使用批量方式",30009:"后台禁止该用户发起加好友请求",30010:"自己的好友数已达系统上限",30011:"分组已达系统上限",30012:"未决数已达系统上限",30014:"对方的好友数已达系统上限",30515:"请求添加好友时,对方在自己的黑名单中,不允许加好友",30516:"请求添加好友时,对方的加好友验证方式是不允许任何人添加自己为好友",30525:"请求添加好友时,自己在对方的黑名单中,不允许加好友",30539:"等待对方同意",30540:"添加好友请求被安全策略打击,请勿频繁发起添加好友请求",31704:"与请求删除的帐号之间不存在好友关系",31707:"删除好友请求被安全策略打击,请勿频繁发起删除好友请求"},za=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this)).code=e.code,a.message=$a[e.code]||e.message,a.data=e.data||{},a}return s(o)}(p(Error)),Ja=null,Xa=function(e){Ja=e},Qa=function(e){return Promise.resolve(Ha(e))},Za=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof za)return t&&null!==Ja&&Ja.emit(C.ERROR,e),Promise.reject(e);if(e instanceof Error){var o=new za({code:ua.UNCAUGHT_ERROR,message:e.message});return t&&null!==Ja&&Ja.emit(C.ERROR,o),Promise.reject(o)}if(Ze(e)||Ze(e.code)||Ze(e.message))be.error("IMPromise.reject 必须指定code(错误码)和message(错误信息)!!!");else{if($e(e.code)&&ze(e.message)){var n=new za(e);return t&&null!==Ja&&Ja.emit(C.ERROR,n),Promise.reject(n)}be.error("IMPromise.reject code(错误码)必须为数字,message(错误信息)必须为字符串!!!")}},es=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="C2CModule",t._messageFromUnreadDBMap=new Map,t}return s(a,[{key:"onNewC2CMessage",value:function(e){var t=e.dataList,o=e.isInstantMessage,n=e.C2CRemainingUnreadList,a=e.C2CPairUnreadList;be.debug("".concat(this._className,".onNewC2CMessage count:").concat(t.length," isInstantMessage:").concat(o));var s=this._newC2CMessageStoredAndSummary({dataList:t,C2CRemainingUnreadList:n,C2CPairUnreadList:a,isInstantMessage:o}),r=s.conversationOptionsList,i=s.messageList,c=s.isUnreadC2CMessage;(this.filterModifiedMessage(i),r.length>0)&&this.getModule(lo).onNewMessage({conversationOptionsList:r,isInstantMessage:o,isUnreadC2CMessage:c});var u=this.filterUnmodifiedMessage(i);o&&u.length>0&&this.emitOuterEvent(C.MESSAGE_RECEIVED,u),i.length=0}},{key:"_newC2CMessageStoredAndSummary",value:function(e){for(var t=e.dataList,o=e.C2CRemainingUnreadList,n=e.C2CPairUnreadList,a=e.isInstantMessage,s=null,r=[],i=[],c={},u=this.getModule(fo),l=this.getModule(Do),d=!1,p=this.getModule(lo),g=0,_=t.length;g<_;g++){var h=t[g];h.currentUser=this.getMyUserID(),h.conversationType=D.CONV_C2C,h.isSystemMessage=!!h.isSystemMessage,(Ze(h.nick)||Ze(h.avatar))&&(d=!0,be.debug("".concat(this._className,"._newC2CMessageStoredAndSummary nick or avatar missing!"))),s=new Ba(h),h.elements=u.parseElements(h.elements,h.from),s.setElement(h.elements),s.setNickAndAvatar({nick:h.nick,avatar:h.avatar});var f=s.conversationID;if(a){if(1===this._messageFromUnreadDBMap.get(s.ID))continue;var m=!1;if(s.from!==this.getMyUserID()){var M=p.getLatestMessageSentByPeer(f);if(M){var v=M.nick,I=M.avatar;d?s.setNickAndAvatar({nick:v,avatar:I}):v===s.nick&&I===s.avatar||(m=!0)}}else{var y=p.getLatestMessageSentByMe(f);if(y){var E=y.nick,T=y.avatar;E===s.nick&&T===s.avatar||p.modifyMessageSentByMe({conversationID:f,latestNick:s.nick,latestAvatar:s.avatar})}}var S=1===t[g].isModified;if(p.isMessageSentByCurrentInstance(s)?s.isModified=S:S=!1,0===h.msgLifeTime)s._onlineOnlyFlag=!0,p.isMessageSentByCurrentInstance(s)||i.push(s);else{if(!p.pushIntoMessageList(i,s,S))continue;m&&(p.modifyMessageSentByPeer({conversationID:f,latestNick:s.nick,latestAvatar:s.avatar}),p.updateUserProfileSpecifiedKey({conversationID:f,nick:s.nick,avatar:s.avatar}))}a&&s.clientTime>0&&l.addMessageDelay(s.clientTime)}else this._messageFromUnreadDBMap.set(s.ID,1);if(0!==h.msgLifeTime){if(!1===s._onlineOnlyFlag){var C=p.getLastMessageTime(f);if($e(C)&&s.time<C)continue;if(Ze(c[f])){var N=0;"in"===s.flow&&(s._isExcludedFromUnreadCount||(N=1)),c[f]=r.push({conversationID:f,unreadCount:N,type:s.conversationType,subType:s.conversationSubType,lastMessage:s._isExcludedFromLastMessage?"":s})-1}else{var A=c[f];r[A].type=s.conversationType,r[A].subType=s.conversationSubType,r[A].lastMessage=s._isExcludedFromLastMessage?"":s,"in"===s.flow&&(s._isExcludedFromUnreadCount||r[A].unreadCount++)}}}else s._onlineOnlyFlag=!0}var O=!1;if(Qe(n))for(var R=function(e,t){if(n[e].unreadCount>0){O=!0;var o=r.find((function(t){return t.conversationID==="C2C".concat(n[e].from)}));o?o.unreadCount=n[e].unreadCount:r.push({conversationID:"C2C".concat(n[e].from),unreadCount:n[e].unreadCount,type:D.CONV_C2C})}},L=0,k=n.length;L<k;L++)R(L);if(Qe(o))for(var G=function(e,t){r.find((function(t){return t.conversationID==="C2C".concat(o[e].from)}))||r.push({conversationID:"C2C".concat(o[e].from),type:D.CONV_C2C,lastMsgTime:o[e].lastMsgTime})},P=0,U=o.length;P<U;P++)G(P);return{conversationOptionsList:r,messageList:i,isUnreadC2CMessage:O}}},{key:"onC2CMessageRevoked",value:function(e){var t=this;be.debug("".concat(this._className,".onC2CMessageRevoked count:").concat(e.dataList.length));var o=this.getModule(lo),n=[],a=null;e.dataList.forEach((function(e){if(e.c2cMessageRevokedNotify){var s=e.c2cMessageRevokedNotify.revokedInfos;Ze(s)||s.forEach((function(e){var s=t.getMyUserID()===e.from?"".concat(D.CONV_C2C).concat(e.to):"".concat(D.CONV_C2C).concat(e.from);(a=o.revoke(s,e.sequence,e.random))&&n.push(a)}))}})),0!==n.length&&(o.onMessageRevoked(n),this.emitOuterEvent(C.MESSAGE_REVOKED,n))}},{key:"onC2CMessageReadReceipt",value:function(e){var t=this;e.dataList.forEach((function(e){if(!Bt(e.c2cMessageReadReceipt)){var o=e.c2cMessageReadReceipt.to;e.c2cMessageReadReceipt.uinPairReadArray.forEach((function(e){var n=e.peerReadTime;be.debug("".concat(t._className,"._onC2CMessageReadReceipt to:").concat(o," peerReadTime:").concat(n));var a="".concat(D.CONV_C2C).concat(o),s=t.getModule(lo);s.recordPeerReadTime(a,n),s.updateMessageIsPeerReadProperty(a,n)}))}}))}},{key:"onC2CMessageReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){if(!Bt(e.c2cMessageReadNotice)){var o=t.getModule(lo);e.c2cMessageReadNotice.uinPairReadArray.forEach((function(e){var n=e.from,a=e.peerReadTime;be.debug("".concat(t._className,".onC2CMessageReadNotice from:").concat(n," lastReadTime:").concat(a));var s="".concat(D.CONV_C2C).concat(n);o.updateIsReadAfterReadReport({conversationID:s,lastMessageTime:a}),o.updateUnreadCount(s)}))}}))}},{key:"onC2CMessageModified",value:function(e){be.debug("".concat(this._className,".onC2CMessageModified options:"),JSON.stringify(e));var o=this.getModule(lo);e.dataList.forEach((function(e){o.onMessageModified(t(t({},e),{},{conversationType:D.CONV_C2C}))}))}},{key:"onReadReceiptList",value:function(e){be.debug("".concat(this._className,".onReadReceiptList options:"),JSON.stringify(e));var t=e.dataList,o=t.userID,n=t.readReceiptList;this.getModule(lo).updateReadReceiptInfo({userID:o,readReceiptList:n})}},{key:"sendMessage",value:function(e,t){var o=this._createC2CMessagePack(e,t);return this.request(o)}},{key:"_createC2CMessagePack",value:function(e,t){var o=null;t&&(t.offlinePushInfo&&(o=t.offlinePushInfo),!0===t.onlineUserOnly&&(o?o.disablePush=!0:o={disablePush:!0}));var n="";ze(e.cloudCustomData)&&e.cloudCustomData.length>0&&(n=e.cloudCustomData);var a=[];if(Xe(t)&&Xe(t.messageControlInfo)){var s=t.messageControlInfo,r=s.excludedFromUnreadCount,i=s.excludedFromLastMessage;!0===r&&a.push("NoUnread"),!0===i&&a.push("NoLastMsg")}return{protocolName:Uo,tjgID:this.generateTjgID(e),requestData:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:e.getElements(),cloudCustomData:n,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:this.isOnlineMessage(e,t)?0:void 0,nick:e.nick,avatar:e.avatar,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,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:Bo,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,o=e.keyList;return be.log("".concat(this._className,".deleteMessage toAccount:").concat(t," count:").concat(o.length)),this.request({protocolName:$o,requestData:{fromAccount:this.getMyUserID(),to:t,keyList:o}})}},{key:"modifyRemoteMessage",value:function(e){var t=e.from,o=e.to,n=e.version,a=void 0===n?0:n,s=e.sequence,r=e.random,i=e.time,c=e.payload,u=e.type,l=e.cloudCustomData,d=void 0;return Vt(u)&&(d=[]).push({type:u,content:c}),this.request({protocolName:zo,requestData:{from:t,to:o,version:a,sequence:s,random:r,time:i,elements:d,cloudCustomData:l}})}},{key:"setMessageRead",value:function(e){var t=this,o=e.conversationID,n=e.lastMessageTime,a="".concat(this._className,".setMessageRead");be.log("".concat(a," conversationID:").concat(o," lastMessageTime:").concat(n)),$e(n)||be.warn("".concat(a," 请勿修改 Conversation.lastMessage.lastTime,否则可能会导致已读上报结果不准确"));var s=new Ca(Da.SET_C2C_MESSAGE_READ);return s.setMessage("conversationID:".concat(o," lastMessageTime:").concat(n)),this.request({protocolName:Ho,requestData:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:o.replace("C2C",""),lastMessageTime:n,receipt:1}]}}}).then((function(){s.setNetworkType(t.getNetworkType()).end(),be.log("".concat(a," ok"));var e=t.getModule(lo);return e.updateIsReadAfterReadReport({conversationID:o,lastMessageTime:n}),e.updateUnreadCount(o),Ha()})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),be.log("".concat(a," failed. error:"),e),Za(e)}))}},{key:"getRoamingMessage",value:function(e){var t=this,o="".concat(this._className,".getRoamingMessage"),n=e.peerAccount,a=e.conversationID,s=e.count,r=e.lastMessageTime,i=e.messageKey,c="peerAccount:".concat(n," count:").concat(s||15," lastMessageTime:").concat(r||0," messageKey:").concat(i);be.log("".concat(o," ").concat(c));var u=new Ca(Da.GET_C2C_ROAMING_MESSAGES);return this.request({protocolName:Yo,requestData:{peerAccount:n,count:s||15,lastMessageTime:r||0,messageKey:i}}).then((function(e){var n=e.data,s=n.complete,r=n.messageList,i=n.messageKey,l=n.lastMessageTime;Ze(r)?be.log("".concat(o," ok. complete:").concat(s," but messageList is undefined!")):be.log("".concat(o," 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(lo);1===s&&d.setCompleted(a);var p=d.onRoamingMessage(r,a);d.modifyMessageList(a),d.updateIsRead(a),d.updateRoamingMessageKeyAndTime(a,i,l);var g=d.getPeerReadTime(a);if(be.log("".concat(o," update isPeerRead property. conversationID:").concat(a," peerReadTime:").concat(g)),g)d.updateMessageIsPeerReadProperty(a,g);else{var _=a.replace(D.CONV_C2C,"");t.getRemotePeerReadTime([_]).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 be.log("".concat(o," nextReqID:").concat(h," stored message count:").concat(p.length)),{nextReqID:h,storedMessageList:p}})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];u.setMessage(c).setError(e,n,a).end()})),be.warn("".concat(o," failed. error:"),e),Za(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,o="".concat(this._className,".getRoamingMessagesHopping"),n=e.peerAccount,a=e.time,s=void 0===a?0:a,r=e.count,i=e.direction,c="".concat(D.CONV_C2C).concat(n),u="peerAccount:".concat(n," count:").concat(r," time:").concat(s," direction:").concat(i);be.log("".concat(o," ").concat(u));var l=new Ca(Da.GET_C2C_ROAMING_MESSAGES_HOPPING);return this.request({protocolName:Yo,requestData:{peerAccount:n,count:r+1,lastMessageTime:s,direction:i}}).then((function(e){var n=e.data,a=n.complete,s=n.messageList,r=void 0===s?[]:s,d=n.lastMessageTime;be.log("".concat(o," 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(lo).onRoamingMessage(r,c,!1);t._modifyMessageList(c,p);var g=t._computeResult({complete:a,lastMessageTime:d,resultList:p});return Ha(g)})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setMessage(u).setError(e,n,a).end()})),be.warn("".concat(o," failed. error:"),e),Za(e)}))}},{key:"_computeResult",value:function(e){var t=e.complete,o=void 0===t?0:t,n=e.lastMessageTime,a=e.resultList,s={messageList:M(void 0===a?[]:a),isCompleted:!1,nextMessageTime:""};return 1===o?(s.isCompleted=!0,s):(s.nextMessageTime=n,s)}},{key:"_modifyMessageList",value:function(e,t){var o=this.getModule(lo).getLocalConversation(e);if(o)for(var n=o.userProfile.nick,a=o.userProfile.avatar,s=this.getModule(ao).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!==n&&u.setNickAndAvatar({nick:n}),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,o="".concat(this._className,".getRemotePeerReadTime");if(Bt(e))return be.warn("".concat(o," userIDList is empty!")),Promise.resolve();var n=new Ca(Da.GET_PEER_READ_TIME);return be.log("".concat(o," userIDList:").concat(e)),this.request({protocolName:jo,requestData:{userIDList:e}}).then((function(a){var s=a.data.peerReadTimeList;be.log("".concat(o," ok. peerReadTimeList:").concat(s));for(var r="",i=t.getModule(lo),c=0;c<e.length;c++)r+="".concat(e[c],"-").concat(s[c]," "),s[c]>0&&i.recordPeerReadTime("C2C".concat(e[c]),s[c]);n.setNetworkType(t.getNetworkType()).setMessage(r).end()})).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()})),be.warn("".concat(o," failed. error:"),e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,o=e[0].conversationID.replace(D.CONV_C2C,""),n=new Ca(Da.SEND_C2C_READ_RECEIPT);n.setMessage("peerAccount:".concat(o));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 Za({code:ua.READ_RECEIPT_MESSAGE_LIST_EMPTY,message:la.READ_RECEIPT_MESSAGE_LIST_EMPTY});var r="".concat(this._className,".sendReadReceipt");return be.log("".concat(r,". peerAccount:").concat(o," messageInfoList length:").concat(s.length)),this.request({protocolName:In,requestData:{peerAccount:o,messageInfoList:s}}).then((function(e){return n.end(),be.log("".concat(r," ok")),Ha()})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),be.warn("".concat(r," failed. error:"),e),Za(e)}))}},{key:"getReadReceiptList",value:function(e){var t="".concat(this._className,".getReadReceiptList"),o=this.getMyUserID(),n=e.filter((function(e){return e.from===o&&!0===e.needReadReceipt}));return be.log("".concat(t," userID:").concat(o," messageList length:").concat(n.length)),Qa({messageList:n})}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._messageFromUnreadDBMap.clear()}}]),a}(Ao),ts=function(){function e(){n(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],o=e.conversationID,n=!0;this.list.has(o)||this.list.set(o,new Map);var a=this._getUniqueIDOfMessage(e),s=this.list.get(o).has(a);if(s){var r=this.list.get(o).get(a);if(!t||!0===r.isModified)return n=!1}return this.list.get(o).set(a,e),this._setLatestMessageSentByPeer(o,e),this._setLatestMessageSentByMe(o,e),this._setGroupLocalLastMessageSequence(o,e),n}},{key:"unshift",value:function(e,t){var o;if(Qe(e)){if(e.length>0){o=e[0].conversationID;var n=e.length;this._unshiftMultipleMessages(e,t),this._setGroupLocalLastMessageSequence(o,e[n-1])}}else o=e.conversationID,this._unshiftSingleMessage(e,t),this._setGroupLocalLastMessageSequence(o,e);if(o&&o.startsWith(D.CONV_C2C)){var a=Array.from(this.list.get(o).values()),s=a.length;if(0===s)return;for(var r=s-1;r>=0;r--)if("out"===a[r].flow){this._setLatestMessageSentByMe(o,a[r]);break}for(var i=s-1;i>=0;i--)if("in"===a[i].flow){this._setLatestMessageSentByPeer(o,a[i]);break}}}},{key:"_unshiftSingleMessage",value:function(e,t){var o=e.conversationID,n=this._getUniqueIDOfMessage(e);if(!this.list.has(o))return this.list.set(o,new Map),this.list.get(o).set(n,e),void t.push(e);var a=this.list.get(o),s=Array.from(a);a.has(n)||(s.unshift([n,e]),this.list.set(o,new Map(s)),t.push(e))}},{key:"_unshiftMultipleMessages",value:function(e,t){for(var o=e.length,n=[],a=e[0].conversationID,s=this.list.get(a),r=this.list.has(a)?Array.from(s):[],i=0;i<o;i++){var c=this._getUniqueIDOfMessage(e[i]);s&&s.has(c)||(n.push([c,e[i]]),t.push(e[i]))}this.list.set(a,new Map(n.concat(r)))}},{key:"remove",value:function(e){var t=e.conversationID,o=this._getUniqueIDOfMessage(e);this.list.has(t)&&this.list.get(t).delete(o)}},{key:"revoke",value:function(e,t,o){if(be.debug("revoke message",e,t,o),this.list.has(e)){var n,a=S(this.list.get(e));try{for(a.s();!(n=a.n()).done;){var s=m(n.value,2)[1];if(s.sequence===t&&!s.isRevoked&&(Ze(o)||s.random===o))return s.isRevoked=!0,s}}catch(r){a.e(r)}finally{a.f()}}return null}},{key:"removeByConversationID",value:function(e){this.list.has(e)&&(this.list.delete(e),this._latestMessageSentByPeerMap.delete(e),this._latestMessageSentByMeMap.delete(e))}},{key:"findMessage",value:function(e){var t,o=null,n=S(this.list);try{for(n.s();!(t=n.n()).done;)for(var a=M(m(t.value,2)[1].values()),s=a.length,r=0;r<s;r++)if(a[r].ID===e){o=a[r];break}}catch(i){n.e(i)}finally{n.f()}return o}},{key:"updateMessageIsPeerReadProperty",value:function(e,t){var o=[];if(this.list.has(e)){var n,a=S(this.list.get(e));try{for(a.s();!(n=a.n()).done;){var s=m(n.value,2)[1];s.time<=t&&!s.isPeerRead&&"out"===s.flow&&(s.isPeerRead=!0,o.push(s))}}catch(r){a.e(r)}finally{a.f()}be.log("".concat(this._className,".updateMessageIsPeerReadProperty conversationID:").concat(e," peerReadTime:").concat(t," count:").concat(o.length))}return o}},{key:"updateMessageIsModifiedProperty",value:function(e){var t=e.conversationID;if(this.list.has(t)){var o=this._getUniqueIDOfMessage(e),n=this.list.get(t).get(o);n&&(n.isModified=!0)}}},{key:"hasLocalMessageList",value:function(e){return this.list.has(e)}},{key:"getLocalMessageList",value:function(e){return this.hasLocalMessageList(e)?M(this.list.get(e).values()):[]}},{key:"hasLocalMessage",value:function(e,t){for(var o=!1,n=this.getLocalMessageList(e),a=n.length,s=0;s<a;s++)n[s].ID===t&&(o=!0);return o}},{key:"getLocalMessage",value:function(e,t){for(var o=null,n=this.getLocalMessageList(e),a=n.length,s=0;s<a;s++)if(n[s].ID===t){o=n[s];break}return o}},{key:"getLocalLastMessage",value:function(e){var t=this.getLocalMessageList(e);return t[t.length-1]}},{key:"getLocalOldestMessage",value:function(e){return this.getLocalMessageList(e)[0]}},{key:"_setLatestMessageSentByPeer",value:function(e,t){e.startsWith(D.CONV_C2C)&&"in"===t.flow&&this._latestMessageSentByPeerMap.set(e,t)}},{key:"_setLatestMessageSentByMe",value:function(e,t){e.startsWith(D.CONV_C2C)&&"out"===t.flow&&this._latestMessageSentByMeMap.set(e,t)}},{key:"_setGroupLocalLastMessageSequence",value:function(e,t){e.startsWith(D.CONV_GROUP)&&this._groupLocalLastMessageSequenceMap.set(e,t.sequence)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._latestMessageSentByPeerMap.get(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._latestMessageSentByMeMap.get(e)}},{key:"getGroupLocalLastMessageSequence",value:function(e){return this._groupLocalLastMessageSequenceMap.get(e)||0}},{key:"modifyMessageSentByPeer",value:function(e){var t=e.conversationID,o=e.latestNick,n=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--)"in"===s[l].flow&&((i=s[l]).nick!==o&&(i.setNickAndAvatar({nick:o}),u=!0),i.avatar!==n&&(i.setNickAndAvatar({avatar:n}),u=!0),u&&(c+=1));be.log("".concat(this._className,".modifyMessageSentByPeer conversationID:").concat(t," count:").concat(c))}}}},{key:"modifyMessageSentByMe",value:function(e){var t=e.conversationID,o=e.latestNick,n=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!==o&&(i.setNickAndAvatar({nick:o}),u=!0),i.avatar!==n&&(i.setNickAndAvatar({avatar:n}),u=!0),u&&(c+=1));be.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(D.CONV_GROUP).concat(e))}))}},{key:"traversal",value:function(){if(0!==this.list.size&&-1===be.getLevel()){console.group("conversationID-messageCount");var e,t=S(this.list);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2),n=o[0],a=o[1];console.log("".concat(n,"-").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 o=this._getUniqueIDOfMessage(t),n=this.list.get(e).has(o);if(be.debug("".concat(this._className,".onMessageModified conversationID:").concat(e," uniqueID:").concat(o," has:").concat(n)),n){var a=this.list.get(e).get(o),s=t.messageVersion,r=t.elements,i=t.cloudCustomData;return a.version<s?(a.version=s,a._elements=JSON.parse(JSON.stringify(r)),a.payload=JSON.parse(JSON.stringify(r[0].content)),a.type=r[0].type,a.cloudCustomData=i,a.isModified=!0,{isUpdated:!0,message:a}):{isUpdated:!1,message:a}}return{isUpdated:!1,message:null}}},{key:"_getUniqueIDOfMessage",value:function(e){var t=e.from,o=e.to,n=e.random,a=e.sequence,s=e.time;return"".concat(t,"-").concat(o,"-").concat(n,"-").concat(a,"-").concat(s)}},{key:"reset",value:function(){this.list.clear(),this._latestMessageSentByPeerMap.clear(),this._latestMessageSentByMeMap.clear(),this._groupLocalLastMessageSequenceMap.clear()}}]),e}(),os="_a2KeyAndTinyIDUpdated",ns="_cloudConfigUpdated",as="_profileUpdated";function ss(e){this.mixin(e)}ss.mixin=function(e){var t=e.prototype||e;t._isReady=!1,t.ready=function(e){var t=arguments.length>1&&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 rs=["jpg","jpeg","gif","png","bmp","image","webp"],is=["mp4"],cs=1,us=2,ls=3,ds=255,ps=function(){function e(t){var o=this;n(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||D.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||D.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){o.profileCustomField.push({key:e.key,value:e.value})})))}return s(e,[{key:"validate",value:function(e){var t=!0,o="";if(Bt(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var n=e.profileCustomField.length,a=null,s=0;s<n;s++){if(a=e.profileCustomField[s],!ze(a.key)||-1===a.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"自定义资料字段的前缀必须是 Tag_Profile_Custom"};if(!ze(a.value))return{valid:!1,tips:"自定义资料字段的 value 必须是字符串"}}for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if("profileCustomField"===r)continue;if(Bt(e[r])&&!ze(e[r])&&!$e(e[r])){o="key:"+r+", invalid value:"+e[r],t=!1;continue}switch(r){case"nick":ze(e[r])||(o="nick should be a string",t=!1),lt(e[r])>500&&(o="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(lt(e[r])," bytes"),t=!1);break;case"gender":_t(qe,e.gender)||(o="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":$e(e.birthday)||(o="birthday should be a number",t=!1);break;case"location":ze(e.location)||(o="location should be a string",t=!1);break;case"selfSignature":ze(e.selfSignature)||(o="selfSignature should be a string",t=!1);break;case"allowType":_t(Ke,e.allowType)||(o="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":$e(e.language)||(o="language should be a number",t=!1);break;case"avatar":ze(e.avatar)||(o="avatar should be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(o="messageSettings should be 0 or 1",t=!1);break;case"adminForbidType":_t(Ve,e.adminForbidType)||(o="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":$e(e.level)||(o="level should be a number",t=!1);break;case"role":$e(e.role)||(o="role should be a number",t=!1);break;default:o="unknown key:"+r+" "+e[r],t=!1}}return{valid:t,tips:o}}}]),e}(),gs=s((function e(t){n(this,e),this.value=t,this.next=null})),_s=function(){function e(t){n(this,e),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map,be.debug("SinglyLinkedList init MAX_LENGTH:".concat(this.MAX_LENGTH))}return s(e,[{key:"set",value:function(e){var t=new gs(e);if(this.map.size<this.MAX_LENGTH)null===this.pTail?(this.pTail=t,this.pNodeToDel=t):(this.pTail.next=t,this.pTail=t),this.map.set(e,1);else{var o=this.pNodeToDel;this.pNodeToDel=this.pNodeToDel.next,this.map.delete(o.value),o.next=null,o=null,this.pTail.next=t,this.pTail=t,this.map.set(e,1)}}},{key:"has",value:function(e){return this.map.has(e)}},{key:"delete",value:function(e){this.has(e)&&this.map.delete(e)}},{key:"tail",value:function(){return this.pTail}},{key:"size",value:function(){return this.map.size}},{key:"data",value:function(){return Array.from(this.map.keys())}},{key:"reset",value:function(){for(var e;null!==this.pNodeToDel;)e=this.pNodeToDel,this.pNodeToDel=this.pNodeToDel.next,e.next=null,e=null;this.pTail=null,this.map.clear()}}]),e}(),hs=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic"],fs=function(){function e(t){n(this,e),this.groupID="",this.name="",this.avatar="",this.type="",this.introduction="",this.notification="",this.ownerID="",this.createTime="",this.infoSequence="",this.lastInfoTime="",this.selfInfo={messageRemindType:"",joinTime:"",nameCard:"",role:"",userID:"",memberCustomField:void 0,readedSequence:0,excludedUnreadSequenceList:void 0},this.lastMessage={lastTime:"",lastSequence:"",fromAccount:"",messageForShow:""},this.nextMessageSeq="",this.memberNum="",this.memberCount="",this.maxMemberNum="",this.maxMemberCount="",this.joinOption="",this.groupCustomField=[],this.muteAllMembers=!1,this.isSupportTopic=!1,this._initGroup(t)}return s(e,[{key:"memberNum",get:function(){return be.warn("!!!v2.8.0起弃用memberNum,请使用 memberCount"),this.memberCount},set:function(e){}},{key:"maxMemberNum",get:function(){return be.warn("!!!v2.8.0起弃用maxMemberNum,请使用 maxMemberCount"),this.maxMemberCount},set:function(e){}},{key:"_initGroup",value:function(e){for(var t in e)hs.indexOf(t)<0||("selfInfo"!==t?("memberNum"===t&&(this.memberCount=e[t]),"maxMemberNum"===t&&(this.maxMemberCount=e[t]),"isSupportTopic"!==t?this[t]=e[t]:this.isSupportTopic=1===e[t]):this.updateSelfInfo(e[t]))}},{key:"updateGroup",value:function(e){var t=this,o=JSON.parse(JSON.stringify(e));o.lastMsgTime&&(this.lastMessage.lastTime=o.lastMsgTime),Ze(o.muteAllMembers)||("On"===o.muteAllMembers?o.muteAllMembers=!0:o.muteAllMembers=!1),o.groupCustomField&&vt(this.groupCustomField,o.groupCustomField),Ze(o.memberNum)||(this.memberCount=o.memberNum),Ze(o.maxMemberNum)||(this.maxMemberCount=o.maxMemberNum),Ze(o.isSupportTopic)||(this.isSupportTopic=$e(o.isSupportTopic)?1===o.isSupportTopic:o.isSupportTopic),ct(this,o,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),Qe(o.members)&&o.members.length>0&&o.members.forEach((function(e){e.userID===t.selfInfo.userID&&ct(t.selfInfo,e,["sequence"])}))}},{key:"updateSelfInfo",value:function(e){var o={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList};ct(this.selfInfo,t({},o),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}}]),e}(),ms=function(e){return Ze(e)?{lastTime:0,lastSequence:0,fromAccount:0,messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1}:e instanceof Ba?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:qt(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:qt(e.type,e.payload)})},Ms=function(){function e(t){n(this,e),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=ms(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(D.CONV_C2C)?this.conversationID.replace(D.CONV_C2C,""):this.conversationID.startsWith(D.CONV_GROUP)?this.conversationID.replace(D.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(o){switch(o){case"userProfile":t.userProfile=e.userProfile;break;case"groupProfile":t.groupProfile=e.groupProfile}})),Ze(this.userProfile)&&this.type===D.CONV_C2C?this.userProfile=new ps({userID:e.conversationID.replace("C2C","")}):Ze(this.groupProfile)&&this.type===D.CONV_GROUP&&(this.groupProfile=new fs({groupID:e.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(e){var t=e.nextUnreadCount,o=e.isFromGetConversations,n=e.isUnreadC2CMessage;Ze(t)||(yt(this.subType)?this.unreadCount=0:o&&this.type===D.CONV_GROUP||o&&this.type===D.CONV_TOPIC||n&&this.type===D.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:"updateLastMessage",value:function(e){this.lastMessage=ms(e)}},{key:"updateGroupAtInfoList",value:function(e){if(!this._isNeedMergeGroupAtInfo(e)){var t,o=(v(t=e.groupAtType)||I(t)||y(t)||T()).slice(0);-1!==o.indexOf(D.CONV_AT_ME)&&-1!==o.indexOf(D.CONV_AT_ALL)&&(o=[D.CONV_AT_ALL_AT_ME]);var n={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:o,__random:e.__random,__sequence:e.__sequence};this.groupAtInfoList.push(n),be.debug("Conversation.updateGroupAtInfoList conversationID:".concat(this.conversationID),this.groupAtInfoList)}}},{key:"_isNeedMergeGroupAtInfo",value:function(e){var t=e.groupID,o=e.sequence;if(!Et({groupID:t}))return!1;var n=!1;return this.groupAtInfoList.forEach((function(t){t.messageSequence===o&&(t.atTypeArray.indexOf(D.CONV_AT_ME)>-1&&e.groupAtType.indexOf(D.CONV_AT_ALL)>-1&&(t.atTypeArray=[D.CONV_AT_ALL_AT_ME]),t.atTypeArray.indexOf(D.CONV_AT_ALL)>-1&&e.groupAtType.indexOf(D.CONV_AT_ME)>-1&&(t.atTypeArray=[D.CONV_AT_ALL_AT_ME],t.__random=e.__random,t.__sequence=e.__sequence),n=!0)})),n}},{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,o=e.time;return this.type===D.CONV_C2C&&t===this.lastMessage.lastSequence&&o===this.lastMessage.lastTime||this.type===D.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}}]),e}(),vs=function(){function e(t){n(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:Wo,updateSequence:this._updateSequence}).then((function(o){be.log("".concat(t," ok"));var n=o.data,a=n.updateSequence,s=n.muteFlagList;e._updateSequence=a,e._patchC2CMessageRemindType(s)})).catch((function(e){be.error("".concat(t," failed. error:"),e)}))}},{key:"_patchC2CMessageRemindType",value:function(e){var t=this,o=0,n="";Qe(e)&&e.length>0&&e.forEach((function(e){var a=e.userID,s=e.muteFlag;0===s?n=D.MSG_REMIND_ACPT_AND_NOTE:1===s?n=D.MSG_REMIND_DISCARD:2===s&&(n=D.MSG_REMIND_ACPT_NOT_NOTE),!0===t._conversationModule.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:n})&&(o+=1)})),be.log("".concat(this._className,"._patchC2CMessageRemindType count:").concat(o))}},{key:"set",value:function(e){return e.groupID?this._setGroupMessageRemindType(e):Qe(e.userIDList)?this._setC2CMessageRemindType(e):void 0}},{key:"_setGroupMessageRemindType",value:function(e){var t=this,o="".concat(this._className,"._setGroupMessageRemindType"),n=e.groupID,a=e.messageRemindType,s="groupID:".concat(n," messageRemindType:").concat(a),r=new Ca(Da.SET_MESSAGE_REMIND_TYPE);return r.setMessage(s),this._getModule(co).modifyGroupMemberInfo({groupID:n,messageRemindType:a,userID:this._conversationModule.getMyUserID()}).then((function(){r.setNetworkType(t._conversationModule.getNetworkType()).end(),be.log("".concat(o," ok. ").concat(s));var n=t.onGroupMessageRemindTypeUpdated(e);return Ha(n)})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"onGroupMessageRemindTypeUpdated",value:function(e){var t=e.groupID,o=e.messageRemindType,n=this._getModule(ro).getLocalGroupProfile(t);if(n&&(n.selfInfo.messageRemindType=o),Tt(t)){var a=t,s=Ft(a),r=this._getModule(uo).getLocalTopic(s,a);return r&&(r.updateSelfInfo({messageRemindType:o}),this._conversationModule.emitOuterEvent(C.TOPIC_UPDATED,{groupID:s,topic:r})),{topic:r}}return this._conversationModule.patchMessageRemindType({ID:t,isC2CConversation:!1,messageRemindType:o})&&this._emitConversationUpdate(),{group:n}}},{key:"_setC2CMessageRemindType",value:function(e){var t=this,o="".concat(this._className,"._setC2CMessageRemindType"),n=e.userIDList,a=e.messageRemindType,s=n.slice(0,30),r=0;a===D.MSG_REMIND_DISCARD?r=1:a===D.MSG_REMIND_ACPT_NOT_NOTE&&(r=2);var i="userIDList:".concat(s," messageRemindType:").concat(a),c=new Ca(Da.SET_MESSAGE_REMIND_TYPE);return c.setMessage(i),this._conversationModule.request({protocolName:xo,requestData:{userIDList:s,muteFlag:r}}).then((function(e){c.setNetworkType(t._conversationModule.getNetworkType()).end();var n=e.data,r=n.updateSequence,i=n.errorList;t._updateSequence=r;var u=[],l=[];Qe(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)}));be.log("".concat(o," 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,Qa({successUserIDList:d.map((function(e){return{userID:e}})),failureUserIDList:l})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(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(){be.log("".concat(this._className,".reset")),this._updateSequence=0}}]),e}(),Is=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="ConversationModule",ss.mixin(_(t)),t._messageListHandler=new ts,t._messageRemindHandler=new vs(_(t)),t.singlyLinkedList=new _s(100),t._pagingStatus=jt.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(os,this._initLocalConversationList,this),e.on(as,this._onProfileUpdated,this)}},{key:"onCheckTimer",value:function(e){e%60==0&&this._messageListHandler.traversal()}},{key:"_initLocalConversationList",value:function(){var e=this,t=new Ca(Da.GET_CONVERSATION_LIST_IN_STORAGE);be.log("".concat(this._className,"._initLocalConversationList."));var o="",n=this._getStorageConversationList();if(n){for(var a=n.length,s=0;s<a;s++){var r=n[s];if(r){if(r.conversationID==="".concat(D.CONV_C2C,"@TLS#ERROR")||r.conversationID==="".concat(D.CONV_C2C,"@TLS#NOT_FOUND"))continue;if(r.groupProfile){var i=r.groupProfile.type;if(yt(i))continue}}this._conversationMap.set(n[s].conversationID,new Ms(n[s]))}this.emitConversationUpdate(!0,!1),o="count:".concat(a)}else o="count:0";t.setNetworkType(this.getNetworkType()).setMessage(o).end(),this.getModule(so)||this.triggerReady(),this.ready((function(){e._tmpGroupList.length>0&&(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,o=e.conversationOptionsList,n=e.isInstantMessage,a=void 0===n||n,s=e.isUnreadC2CMessage,r=void 0!==s&&s;this._isReady?0!==o.length&&(this._getC2CPeerReadTime(o),this._updateLocalConversationList({conversationOptionsList:o,isInstantMessage:a,isUnreadC2CMessage:r,isFromGetConversations:!1}),this._setStorageConversationList(),o.filter((function(e){return e.type===D.CONV_TOPIC})).length>0||this.emitConversationUpdate()):this.ready((function(){t._onSendOrReceiveMessage(e)}))}},{key:"updateConversationGroupProfile",value:function(e){var t=this;if(!Qe(e)||0!==e.length)if(0!==this._conversationMap.size){var o=!1;e.forEach((function(e){var n="GROUP".concat(e.groupID);if(t._conversationMap.has(n)){o=!0;var a=t._conversationMap.get(n);a.groupProfile=JSON.parse(JSON.stringify(e)),a.lastMessage.lastSequence<e.nextMessageSeq&&(a.lastMessage.lastSequence=e.nextMessageSeq-1),a.subType||(a.subType=e.type)}})),o&&this.emitConversationUpdate(!0,!1)}else this._tmpGroupList=e}},{key:"_updateConversationUserProfile",value:function(e){var t=this;e.data.forEach((function(e){var o="C2C".concat(e.userID);t._conversationMap.has(o)&&(t._conversationMap.get(o).userProfile=e)})),this.emitConversationUpdate(!0,!1)}},{key:"onMessageRevoked",value:function(e){var t=this;if(0!==e.length){var o=null,n=!1;e.forEach((function(e){(o=t._conversationMap.get(e.conversationID))&&(o.reduceUnreadCount(),o.isLastMessageRevoked(e)&&(n=!0,o.setLastMessageRevoked(!0)))})),n&&this.emitConversationUpdate(!0,!1)}}},{key:"onMessageDeleted",value:function(e){var t=this;if(0!==e.length){var o=null;e.forEach((function(e){(o=t._messageListHandler.getLocalMessage(e.conversationID,e.ID))&&(o.isDeleted=!0),e!==o&&(e.isDeleted=!0)}));for(var n=e[0].conversationID,a=this._messageListHandler.getLocalMessageList(n),s={},r=a.length-1;r>=0;r--)if(!a[r].isDeleted){s=a[r];break}var i=this._conversationMap.get(n);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!==D.CONV_TOPIC&&(c=!0),be.log("".concat(this._className,".onMessageDeleted. update conversationID:").concat(n," with lastMessage:"),i.lastMessage)),n.startsWith(D.CONV_C2C)&&this.updateUnreadCount(n),c&&this.emitConversationUpdate(!0,!1)}}}},{key:"onMessageModified",value:function(e){var t=e.conversationType,o=e.from,n=e.to,a=e.time,s=e.sequence,r=e.elements,i=e.cloudCustomData,c=e.messageVersion,u=this.getMyUserID(),l="".concat(t).concat(n);n===u&&t===D.CONV_C2C&&(l="".concat(t).concat(o));var d=this._messageListHandler.onMessageModified(l,e),p=d.isUpdated,g=d.message;!0===p&&this.emitOuterEvent(C.MESSAGE_MODIFIED,[g]);var _=this._isTopicConversation(l);if(be.log("".concat(this._className,".onMessageModified isUpdated:").concat(p," isTopicMessage:").concat(_," from:").concat(o," to:").concat(n)),_){this.getModule(uo).onMessageModified(e)}else{var h=this._conversationMap.get(l);if(h){var f=h.lastMessage;be.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=qt(f.type,f.payload),f.cloudCustomData=i,f.version=c,this.emitConversationUpdate(!0,!1))}}return g}},{key:"onNewGroupAtTips",value:function(e){var o=this,n=e.dataList,a=null;n.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,o._tmpGroupAtTipsList.push(a)})),be.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(o){var n=o.groupID,a=o.from,s=o.topicID,r=void 0===s?void 0:s,i=o.sync,c=void 0!==i&&i;if(a!==e.getMyUserID())if(Ze(r)){var u=e._conversationMap.get("".concat(D.CONV_GROUP).concat(n));u&&(u.updateGroupAtInfoList(o),t=!0)}else{var l=e._conversationMap.get("".concat(D.CONV_GROUP).concat(r));if(l){l.updateGroupAtInfoList(o);var d=e.getModule(uo),p=l.groupAtInfoList;d.onConversationProxy({topicID:r,groupAtInfoList:p})}if(Bt(l)&&c)e.updateTopicConversation([{conversationID:"".concat(D.CONV_GROUP).concat(r),type:D.CONV_TOPIC}]),e._conversationMap.get("".concat(D.CONV_GROUP).concat(r)).updateGroupAtInfoList(o)}})),t&&this.emitConversationUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}},{key:"_getC2CPeerReadTime",value:function(e){var t=this,o=[];if(e.forEach((function(e){t._conversationMap.has(e.conversationID)||e.type!==D.CONV_C2C||o.push(e.conversationID.replace(D.CONV_C2C,""))})),o.length>0){be.debug("".concat(this._className,"._getC2CPeerReadTime userIDList:").concat(o));var n=this.getModule(so);n&&n.getRemotePeerReadTime(o)}}},{key:"_getStorageConversationList",value:function(){return this.getModule(go).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(go).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],o=this.getLocalConversationList();if(t){var n=this.getModule(ro);n&&n.updateGroupLastMessage(o)}e&&this.emitOuterEvent(C.CONVERSATION_LIST_UPDATED)}},{key:"getLocalConversationList",value:function(){return M(this._conversationMap.values()).filter((function(e){return e.type!==D.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 Ca(Da.SYNC_CONVERSATION_LIST);return this._pagingStatus===jt.NOT_START&&this._conversationMap.clear(),this._pagingGetConversationList().then((function(o){return e._pagingStatus=jt.RESOLVED,e._setStorageConversationList(),e._handleC2CPeerReadTime(),e._patchConversationProperties(),t.setMessage(e._conversationMap.size).setNetworkType(e.getNetworkType()).end(),o})).catch((function(o){return e._pagingStatus=jt.REJECTED,t.setMessage(e._pagingTimeStamp),e.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];t.setError(o,a,s).end()})),Za(o)}))}},{key:"_patchConversationProperties",value:function(){var e=this,t=Date.now(),o=this.checkAndPatchRemark(),n=this._messageRemindHandler.getC2CMessageRemindType(),a=this.getModule(ro).getGroupList();Promise.all([o,n,a]).then((function(){var o=Date.now()-t;be.log("".concat(e._className,"._patchConversationProperties ok. cost ").concat(o," ms")),e.emitConversationUpdate(!0,!1)}))}},{key:"_pagingGetConversationList",value:function(){var e=this,t="".concat(this._className,"._pagingGetConversationList");return be.log("".concat(t," timeStamp:").concat(this._pagingTimeStamp," startIndex:").concat(this._pagingStartIndex)+" pinnedTimeStamp:".concat(this._pagingPinnedTimeStamp," pinnedStartIndex:").concat(this._pagingPinnedStartIndex)),this._pagingStatus=jt.PENDING,this.request({protocolName:Jo,requestData:{fromAccount:this.getMyUserID(),timeStamp:this._pagingTimeStamp,startIndex:this._pagingStartIndex,pinnedTimeStamp:this._pagingPinnedTimeStamp,pinnedStartIndex:this._pagingStartIndex,orderType:1}}).then((function(o){var n=o.data,a=n.completeFlag,s=n.conversations,r=void 0===s?[]:s,i=n.timeStamp,c=n.startIndex,u=n.pinnedTimeStamp,l=n.pinnedStartIndex;if(be.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 Qa();e.triggerReady()}return e._pagingTimeStamp=i,e._pagingStartIndex=c,e._pagingPinnedTimeStamp=u,e._pagingPinnedStartIndex=l,1!==a?e._pagingGetConversationList():(e._handleGroupAtTipsList(),Qa())})).catch((function(o){throw e.isLoggedIn()&&(e._isReady||(be.warn("".concat(t," failed. error:"),o),e.triggerReady())),o}))}},{key:"_updateLocalConversationList",value:function(e){var t,o=e.isFromGetConversations,n=Date.now();t=this._getTmpConversationListMapping(e),this._conversationMap=new Map(this._sortConversationList([].concat(M(t.toBeUpdatedConversationList),M(this._conversationMap)))),o||this._updateUserOrGroupProfile(t.newConversationList),be.debug("".concat(this._className,"._updateLocalConversationList cost ").concat(Date.now()-n," ms"))}},{key:"_getTmpConversationListMapping",value:function(e){for(var t=e.conversationOptionsList,o=e.isFromGetConversations,n=e.isInstantMessage,a=e.isUnreadC2CMessage,s=void 0!==a&&a,r=[],i=[],c=this.getModule(ro),u=this.getModule(io),l=0,d=t.length;l<d;l++){var p=new Ms(t[l]),g=p.conversationID;if(g!=="".concat(D.CONV_C2C,"@TLS#ERROR")&&g!=="".concat(D.CONV_C2C,"@TLS#NOT_FOUND"))if(this._conversationMap.has(g)){var _=this._conversationMap.get(g),h=["unreadCount","allowType","adminForbidType","payload","isPinned"];!1===n&&h.push("lastMessage");var f=t[l].lastMessage,m=!Ze(f);m||t[l].type===D.CONV_TOPIC||this._onLastMessageNotExist(t[l]),Ze(n)&&m&&null===_.lastMessage.payload&&(_.lastMessage.payload=f.payload),ct(_,p,h,[null,void 0,"",0,NaN]),_.updateUnreadCount({nextUnreadCount:p.unreadCount,isFromGetConversations:o,isUnreadC2CMessage:s}),n&&m&&(f.payload&&(_.lastMessage.payload=f.payload),_.type===D.CONV_GROUP&&(_.lastMessage.nameCard=f.nameCard,_.lastMessage.nick=f.nick)),m&&_.lastMessage.cloudCustomData!==f.cloudCustomData&&(_.lastMessage.cloudCustomData=f.cloudCustomData||""),this._conversationMap.delete(g),r.push([g,_])}else{if(p.type===D.CONV_GROUP&&c){var M=p.groupProfile.groupID,v=c.getLocalGroupProfile(M);v&&(p.groupProfile=v,p.updateUnreadCount({nextUnreadCount:0}))}else if(p.type===D.CONV_C2C){var I=g.replace(D.CONV_C2C,"");u&&u.isMyFriend(I)&&(p.remark=u.getFriendRemark(I))}i.push(p),r.push([g,p])}}var y=this.getModule(uo);return r.forEach((function(e){if(e[1].type===D.CONV_TOPIC){var t=e[1],o=t.conversationID,n=t.unreadCount,a=t.groupAtInfoList;y.onConversationProxy({topicID:o.replace(D.CONV_GROUP,""),unreadCount:n,groupAtInfoList:Bt(a)?void 0:a})}})),{toBeUpdatedConversationList:r,newConversationList:i}}},{key:"_onLastMessageNotExist",value:function(e){new Ca(Da.LAST_MESSAGE_NOT_EXIST).setMessage("".concat(JSON.stringify(e))).setNetworkType(this.getNetworkType()).end()}},{key:"_sortConversationList",value:function(e){var t=[],o=[];return e.forEach((function(e){!0===e[1].isPinned?t.push(e):o.push(e)})),t.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})).concat(o.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})))}},{key:"_sortConversationListAndEmitEvent",value:function(){this._conversationMap=new Map(this._sortConversationList(M(this._conversationMap))),this.emitConversationUpdate(!0,!1)}},{key:"_updateUserOrGroupProfile",value:function(e){var t=this;if(0!==e.length){var o=[],n=[],a=this.getModule(ao),s=this.getModule(ro);e.forEach((function(e){if(e.type===D.CONV_C2C)o.push(e.toAccount);else if(e.type===D.CONV_GROUP){var t=e.toAccount;s.hasLocalGroup(t)?e.groupProfile=s.getLocalGroupProfile(t):n.push(t)}})),be.log("".concat(this._className,"._updateUserOrGroupProfile c2cUserIDList:").concat(o," groupIDList:").concat(n)),o.length>0&&a.getUserProfile({userIDList:o}).then((function(e){var o=e.data;Qe(o)?o.forEach((function(e){t._conversationMap.get("C2C".concat(e.userID)).userProfile=e})):t._conversationMap.get("C2C".concat(o.userID)).userProfile=o})),n.length>0&&s.getGroupProfileAdvance({groupIDList:n,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then((function(e){e.data.successGroupList.forEach((function(e){var o="GROUP".concat(e.groupID);if(t._conversationMap.has(o)){var n=t._conversationMap.get(o);ct(n.groupProfile,e,[],[null,void 0,"",0,NaN]),!n.subType&&e.type&&(n.subType=e.type)}}))}))}}},{key:"_getConversationOptions",value:function(e){var o=this,n=[],a=e.filter((function(e){var t=e.lastMsg;return Xe(t)})).filter((function(e){var t=e.type,o=e.userID;return 1===t&&"@TLS#NOT_FOUND"!==o&&"@TLS#ERROR"!==o||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 n.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 ps(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},o._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||"",nameCard:e.senderNameCard||""}),groupProfile:new fs({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage}),unreadCount:e.unreadCount,peerReadTime:0,isPinned:1===e.isPinned,messageRemindType:"",version:0}}));n.length>0&&this.getModule(ao).onConversationsProfileUpdated(n);return r}},{key:"_patchTypeAndPayload",value:function(e){var o=e.lastMsg,n=o.event,a=void 0===n?void 0:n,s=o.elements,r=void 0===s?[]:s,i=o.groupTips,c=void 0===i?{}:i;if(!Ze(a)&&!Bt(c)){var u=new Ba(c);u.setElement({type:D.MSG_GRP_TIP,content:t(t({},c.elements),{},{groupProfile:c.groupProfile})});var l=JSON.parse(JSON.stringify(u.payload));return u=null,{type:D.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 Ba&&this._messageListHandler.remove(e)}},{key:"onConversationDeleted",value:function(e){var t=this;be.log("".concat(this._className,".onConversationDeleted")),Qe(e)&&e.forEach((function(e){var o=e.type,n=e.userID,a=e.groupID,s="";1===o?s="".concat(D.CONV_C2C).concat(n):2===o&&(s="".concat(D.CONV_GROUP).concat(a)),t.deleteLocalConversation(s)}))}},{key:"onConversationPinned",value:function(e){var t=this;if(Qe(e)){var o=!1;e.forEach((function(e){var n,a=e.type,s=e.userID,r=e.groupID;1===a?n=t.getLocalConversation("".concat(D.CONV_C2C).concat(s)):2===a&&(n=t.getLocalConversation("".concat(D.CONV_GROUP).concat(r))),n&&(be.log("".concat(t._className,".onConversationPinned conversationID:").concat(n.conversationID," isPinned:").concat(n.isPinned)),n.isPinned||(n.isPinned=!0,o=!0))})),o&&this._sortConversationListAndEmitEvent()}}},{key:"onConversationUnpinned",value:function(e){var t=this;if(Qe(e)){var o=!1;e.forEach((function(e){var n,a=e.type,s=e.userID,r=e.groupID;1===a?n=t.getLocalConversation("".concat(D.CONV_C2C).concat(s)):2===a&&(n=t.getLocalConversation("".concat(D.CONV_GROUP).concat(r))),n&&(be.log("".concat(t._className,".onConversationUnpinned conversationID:").concat(n.conversationID," isPinned:").concat(n.isPinned)),n.isPinned&&(n.isPinned=!1,o=!0))})),o&&this._sortConversationListAndEmitEvent()}}},{key:"getMessageList",value:function(e){var t=this,o=e.conversationID,n=e.nextReqMessageID,a=e.count,s="".concat(this._className,".getMessageList"),r=this.getLocalConversation(o),i="";if(r&&r.groupProfile&&(i=r.groupProfile.type),yt(i))return be.log("".concat(s," not available in avchatroom. conversationID:").concat(o)),Qa({messageList:[],nextReqMessageID:"",isCompleted:!0});(Ze(a)||a>15)&&(a=15),!n&&this._isNotInCommunity(o)&&(this._messageListHandler.removeByConversationID(o),this._completedMap.delete(o),this._roamingMessageSequenceMap.delete(o));var c=this._computeRemainingCount({conversationID:o,nextReqMessageID:n}),u=this._completedMap.has(o);if(be.log("".concat(s," conversationID:").concat(o," nextReqMessageID:").concat(n)+" remainingCount:".concat(c," count:").concat(a," isCompleted:").concat(u)),this._needGetHistory({conversationID:o,remainingCount:c,count:a}))return this.getHistoryMessages({conversationID:o,nextReqMessageID:n,count:20}).then((function(e){var n=e.nextReqID,a=e.storedMessageList,r=t._completedMap.has(o),i=a;c>0&&(i=t._messageListHandler.getLocalMessageList(o).slice(0,a.length+c));var u={nextReqMessageID:r?"":n,messageList:i,isCompleted:r};return be.log("".concat(s," ret.nextReqMessageID:").concat(u.nextReqMessageID," ret.isCompleted:").concat(u.isCompleted," ret.length:").concat(i.length)),Ha(u)}));this.modifyMessageList(o);var l=this._getMessageListFromMemory({conversationID:o,nextReqMessageID:n,count:a});return Qa(l)}},{key:"_getMessageListFromMemory",value:function(e){var t=e.conversationID,o=e.nextReqMessageID,n=e.count,a="".concat(this._className,"._getMessageListFromMemory"),s=this._messageListHandler.getLocalMessageList(t),r=s.length,i=0,c={isCompleted:!1,nextReqMessageID:"",messageList:[]};return o?(i=s.findIndex((function(e){return e.ID===o})))>n?(c.messageList=s.slice(i-n,i),c.nextReqMessageID=s[i-n].ID):(c.messageList=s.slice(0,i),c.isCompleted=!0):r>n?(i=r-n,c.messageList=s.slice(i,r),c.nextReqMessageID=s[i].ID):(c.messageList=s.slice(0,r),c.isCompleted=!0),be.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,o=e.sequence,n=e.time,a=e.count,s=e.direction,r=void 0===s?0:s;if((Ze(a)||a>15)&&(a=15),t.startsWith(D.CONV_C2C)){var i=this.getModule(so),c=t.replace(D.CONV_C2C,"");return i.getRoamingMessagesHopping({peerAccount:c,time:n,count:a,direction:r})}if(t.startsWith(D.CONV_GROUP)){var u=this.getModule(ro),l=t.replace(D.CONV_GROUP,"");return u.getRoamingMessagesHopping({groupID:l,sequence:o,count:a,direction:r})}}},{key:"_computeRemainingCount",value:function(e){var t=e.conversationID,o=e.nextReqMessageID,n=this._messageListHandler.getLocalMessageList(t),a=n.length;if(!o)return a;var s=0;return St(t)?s=n.findIndex((function(e){return e.ID===o})):Ct(t)&&(s=-1!==o.indexOf("-")?n.findIndex((function(e){return e.ID===o})):n.findIndex((function(e){return e.sequence===o}))),-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,o=e.remainingCount,n=e.count,a=this.getLocalConversation(t),s="";return a&&a.groupProfile&&(s=a.groupProfile.type),!Dt(t)&&!yt(s)&&(!(Ct(t)&&this._isPagingGetGroupListCompleted()&&!this._hasLocalGroup(t)&&!this._isTopicConversation(t))&&(o<=n&&!this._completedMap.has(t)))}},{key:"_isTopicConversation",value:function(e){var t=e.replace(D.CONV_GROUP,"");return Tt(t)}},{key:"getHistoryMessages",value:function(e){var t=e.conversationID,o=e.count;if(t===D.CONV_SYSTEM)return Qa();var n=15;o>20&&(n=20);var a=null;if(St(t)){var s=this._roamingMessageKeyAndTimeMap.has(t);return(a=this.getModule(so))?a.getRoamingMessage({conversationID:t,peerAccount:t.replace(D.CONV_C2C,""),count:n,lastMessageTime:s?this._roamingMessageKeyAndTimeMap.get(t).lastMessageTime:0,messageKey:s?this._roamingMessageKeyAndTimeMap.get(t).messageKey:""}):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}if(Ct(t)){if(!(a=this.getModule(ro)))return Za({code:ua.CANNOT_FIND_MODULE,message:la.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(D.CONV_GROUP,""),count:n,sequence:c||i})}return Qa()}},{key:"patchConversationLastMessage",value:function(e){var t=this.getLocalConversation(e);if(t){var o=t.lastMessage,n=o.messageForShow,a=o.payload;if(Bt(n)||Bt(a)){var s=this._messageListHandler.getLocalMessageList(e);if(0===s.length)return;var r=s[s.length-1];be.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]:[],o=arguments.length>1?arguments[1]:void 0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=o.startsWith(D.CONV_C2C)?D.CONV_C2C:D.CONV_GROUP,s=null,r=[],i=[],c=0,u=e.length,l=null,d=a===D.CONV_GROUP,p=this.getModule(fo),g=function(){c=d?e.length-1:0,u=d?0:e.length},_=function(){d?--c:++c},h=function(){return d?c>=u:c<u};for(g();h();_())if(d&&1===e[c].sequence&&n&&this.setCompleted(o),1!==e[c].isPlaceMessage)if((s=new Ba(e[c])).to=e[c].to,a!==D.CONV_GROUP||Ze(e[c].topicID)||(s.to=e[c].topicID),s.isSystemMessage=!!e[c].isSystemMessage,s.conversationType=a,4===e[c].event?l={type:D.MSG_GRP_TIP,content:t(t({},e[c].elements),{},{groupProfile:e[c].groupProfile})}:(e[c].elements=p.parseElements(e[c].elements,e[c].from),l=e[c].elements),d||s.setNickAndAvatar({nick:e[c].nick,avatar:e[c].avatar}),Bt(l)){var f=new Ca(Da.EMPTY_MESSAGE_BODY);f.setMessage("from:".concat(s.from," to:").concat(s.to," sequence:").concat(s.sequence," event:").concat(e[c].event)),f.setNetworkType(this.getNetworkType()).setLevel("warning").end()}else s.setElement(l),s.reInitialize(this.getMyUserID()),r.push(s);return g=_=h=null,n?(this._messageListHandler.unshift(r,i),r=null,i):(i=null,r)}},{key:"findMessage",value:function(e){return this._messageListHandler.findMessage(e)}},{key:"_isNotInCommunity",value:function(e){var t=!1;if(e.startsWith(D.CONV_GROUP)&&this._isTopicConversation(e)){var o=Ft(e.replace(D.CONV_GROUP,""));this.getModule(ro).hasLocalGroup(o)||(t=!0)}return t}},{key:"deleteTopicRoamingMessageInfo",value:function(e){var t=this;Et({groupID:e})&&this._messageListHandler.getTopicConversationIDList(e).forEach((function(e){t._messageListHandler.removeByConversationID(e),t._completedMap.delete(e),t._roamingMessageSequenceMap.delete(e)}))}},{key:"deleteGroupRomaingMessageInfo",value:function(e){var t="".concat(D.CONV_GROUP).concat(e);this._messageListHandler.removeByConversationID(t),this._completedMap.delete(t),this._roamingMessageSequenceMap.delete(t)}},{key:"setMessageRead",value:function(e){var t=e.conversationID,o=this.getLocalConversation(t);if(be.log("".concat(this._className,".setMessageRead conversationID:").concat(t," unreadCount:").concat(o?o.unreadCount:0)),!o)return Qa();if(o.type!==D.CONV_GROUP&&o.type!==D.CONV_TOPIC||Bt(o.groupAtInfoList)||this.deleteGroupAtTips(t),0===o.unreadCount)return Qa();if(o.type===D.CONV_GROUP&&!this._hasLocalGroup(t))return 0!==o.unreadCount&&(o.unreadCount=0,this.emitConversationUpdate(!0,!1)),Qa();var n=this._messageListHandler.getLocalLastMessage(t),a=o.lastMessage.lastTime;n&&a<n.time&&(a=n.time);var s=o.lastMessage.lastSequence;if(n&&s<n.sequence&&(s=n.sequence),o.type===D.CONV_TOPIC&&Ze(n)){var r=this.getModule(uo),i=t.replace(D.CONV_GROUP,""),c=Ft(i),u=r.getLocalTopic(c,i);u&&(s=u.nextMessageSeq-1)}var l=null;switch(o.type){case D.CONV_C2C:return(l=this.getModule(so))?l.setMessageRead({conversationID:t,lastMessageTime:a}):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE});case D.CONV_GROUP:case D.CONV_TOPIC:return(l=this.getModule(ro))?l.setMessageRead({conversationID:t,lastMessageSeq:s}):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE});case D.CONV_SYSTEM:return o.unreadCount=0,this.emitConversationUpdate(!0,!1),Qa();default:return Qa()}}},{key:"setAllMessageRead",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o="".concat(this._className,".setAllMessageRead");t.scope||(t.scope=D.READ_ALL_MSG),be.log("".concat(o," options:"),t);var n=this._createSetAllMessageReadPack(t);if(0===n.readAllC2CMessage&&0===n.groupMessageReadInfoList.length)return Qa();var a=new Ca(Da.SET_ALL_MESSAGE_READ);return this.request({protocolName:fn,requestData:n}).then((function(o){var n=o.data,s=e._handleAllMessageRead(n);return a.setMessage("scope:".concat(t.scope," failureGroups:").concat(JSON.stringify(s))).setNetworkType(e.getNetworkType()).end(),Qa()})).catch((function(t){return e.probeNetwork().then((function(e){var o=m(e,2),n=o[0],s=o[1];a.setError(t,n,s).end()})),be.warn("".concat(o," failed. error:"),t),Za({code:t&&t.code?t.code:ua.MESSAGE_UNREAD_ALL_FAIL,message:t&&t.message?t.message:la.MESSAGE_UNREAD_ALL_FAIL})}))}},{key:"_getConversationLastMessageSequence",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),o=e.lastMessage.lastSequence;return t&&o<t.sequence&&(o=t.sequence),o}},{key:"_getConversationLastMessageTime",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),o=e.lastMessage.lastTime;return t&&o<t.time&&(o=t.time),o}},{key:"_createSetAllMessageReadPack",value:function(e){var t,o={readAllC2CMessage:0,groupMessageReadInfoList:[]},n=e.scope,a=S(this._conversationMap);try{for(a.s();!(t=a.n()).done;){var s=m(t.value,2)[1];if(s.unreadCount>0)if(s.type===D.CONV_C2C&&0===o.readAllC2CMessage){if(n===D.READ_ALL_MSG)o.readAllC2CMessage=1;else if(n===D.READ_ALL_C2C_MSG){o.readAllC2CMessage=1;break}}else if(s.type===D.CONV_GROUP&&(n===D.READ_ALL_GROUP_MSG||n===D.READ_ALL_MSG)){var r=this._getConversationLastMessageSequence(s);o.groupMessageReadInfoList.push({groupID:s.groupProfile.groupID,messageSequence:r})}}}catch(i){a.e(i)}finally{a.f()}return o}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMessageRead(e)}},{key:"_handleAllMessageRead",value:function(e){var t=e.groupMessageReadInfoList,o=e.readAllC2CMessage,n=this._parseGroupReadInfo(t);return this._updateAllConversationUnreadCount({readAllC2CMessage:o})>=1&&this.emitConversationUpdate(!0,!1),n}},{key:"_parseGroupReadInfo",value:function(e){var t=[];if(e&&e.length)for(var o=0,n=e.length;o<n;o++){var a=e[o],s=a.groupID,r=a.sequence,i=a.retCode,c=a.lastMessageSeq;Ze(i)?this._remoteGroupReadSequenceMap.set(s,c):(this._remoteGroupReadSequenceMap.set(s,r),0!==i&&t.push("".concat(s,"-").concat(r,"-").concat(i)))}return t}},{key:"_updateAllConversationUnreadCount",value:function(e){var t,o=e.readAllC2CMessage,n=0,a=S(this._conversationMap);try{for(a.s();!(t=a.n()).done;){var s=m(t.value,2),r=s[0],i=s[1];if(i.unreadCount>=1){if(1===o&&i.type===D.CONV_C2C){var c=this._getConversationLastMessageTime(i);this.updateIsReadAfterReadReport({conversationID:r,lastMessageTime:c})}else if(i.type===D.CONV_GROUP){var u=r.replace(D.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)&&(n+=1)}}}catch(p){a.e(p)}finally{a.f()}return n}},{key:"isRemoteRead",value:function(e){var t=e.conversationID,o=e.sequence,n=t.replace(D.CONV_GROUP,""),a=!1;if(this._remoteGroupReadSequenceMap.has(n)){var s=this._remoteGroupReadSequenceMap.get(n);o<=s&&(a=!0,be.log("".concat(this._className,".isRemoteRead conversationID:").concat(t," messageSequence:").concat(o," remoteReadSequence:").concat(s))),o>=s+10&&this._remoteGroupReadSequenceMap.delete(n)}return a}},{key:"updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,o=e.lastMessageSeq,n=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],!(n&&s.time>n||o&&s.sequence>o)){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],o=!1,n=this.getLocalConversation(e),a=this._messageListHandler.getLocalMessageList(e);if(n){var s=n.unreadCount,r=a.filter((function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted})).length;if(s!==r&&(n.unreadCount=r,o=!0,be.log("".concat(this._className,".updateUnreadCount from ").concat(s," to ").concat(r,", conversationID:").concat(e)),!0===t&&this.emitConversationUpdate(!0,!1)),o&&n.type===D.CONV_TOPIC){var i=n.unreadCount,c=this.getModule(uo),u=e.replace(D.CONV_GROUP,"");c.onConversationProxy({topicID:u,unreadCount:i})}return o}}},{key:"clearGroupAtInfoList",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=this.getLocalConversation(e);if(o&&o.groupAtInfoList.length>0){if(o.clearGroupAtInfoList(),be.log("".concat(this._className,".clearGroupAtInfoList conversationID:").concat(e)),o.type===D.CONV_TOPIC){var n=o.groupAtInfoList,a=this.getModule(uo),s=e.replace(D.CONV_GROUP,"");a.onConversationProxy({topicID:s,groupAtInfoList:n})}!0===t&&this.emitConversationUpdate(!0,!1)}}},{key:"updateReadReceiptInfo",value:function(e){var t=this,o=e.userID,n=void 0===o?void 0:o,a=e.groupID,s=void 0===a?void 0:a,r=e.readReceiptList;if(!Bt(r)){var i=[];if(Ze(n)){if(!Ze(s)){var c="".concat(D.CONV_GROUP).concat(s);r.forEach((function(e){var o=e.tinyID,n=e.clientTime,a=e.random,r=e.readCount,u=e.unreadCount,l="".concat(o,"-").concat(n,"-").concat(a),d=t._messageListHandler.getLocalMessage(c,l),p={groupID:s,messageID:l,readCount:0,unreadCount:0};d&&($e(r)&&(d.readReceiptInfo.readCount=r,p.readCount=r),$e(u)&&(d.readReceiptInfo.unreadCount=u,p.unreadCount=u),i.push(p))}))}}else{var u="".concat(D.CONV_C2C).concat(n);r.forEach((function(e){var o=e.tinyID,a=e.clientTime,s=e.random,r="".concat(o,"-").concat(a,"-").concat(s),c=t._messageListHandler.getLocalMessage(u,r);if(c&&!c.isPeerRead){c.isPeerRead=!0;var l={userID:n,messageID:r,isPeerRead:!0};i.push(l)}}))}i.length>0&&this.emitOuterEvent(C.MESSAGE_READ_RECEIPT_RECEIVED,i)}}},{key:"recomputeGroupUnreadCount",value:function(e){var t=e.conversationID,o=e.count,n=this.getLocalConversation(t);if(n){var a=n.unreadCount,s=a-o;s<0&&(s=0),n.unreadCount=s,be.log("".concat(this._className,".recomputeGroupUnreadCount from ").concat(a," to ").concat(s,", conversationID:").concat(t))}}},{key:"updateIsRead",value:function(e){var t=this.getLocalConversation(e),o=this.getLocalMessageList(e);if(t&&0!==o.length&&!Dt(t.type)){for(var n=[],a=0,s=o.length;a<s;a++)"in"!==o[a].flow?"out"!==o[a].flow||o[a].isRead||o[a].setIsRead(!0):n.push(o[a]);var r=0;if(t.type===D.CONV_C2C){var i=n.slice(-t.unreadCount).filter((function(e){return e.isRevoked})).length;r=n.length-t.unreadCount-i}else r=n.length-t.unreadCount;for(var c=0;c<r&&!n[c].isRead;c++)n[c].setIsRead(!0)}}},{key:"deleteGroupAtTips",value:function(e){var t=this,o="".concat(this._className,".deleteGroupAtTips");be.log("".concat(o));var n=this._conversationMap.get(e);if(!n)return Promise.resolve();var a=n.groupAtInfoList;if(0===a.length)return Promise.resolve();var s=void 0;e.startsWith(D.CONV_GROUP)&&(s=e.replace(D.CONV_GROUP,""));var r=M(a);if((Et({groupID:s})||Tt(s))&&0===(r=a.filter((function(e){return!e.atTypeArray.includes(D.CONV_AT_ALL)}))).length)return this.clearGroupAtInfoList(e,!1),Promise.resolve();var i=this.getMyUserID();return this.request({protocolName:en,requestData:{messageListToDelete:r.map((function(e){return{from:e.from,to:i,messageSeq:e.__sequence,messageRandom:e.__random,groupID:Ze(e.topicID)?e.groupID:e.topicID}}))}}).then((function(){return be.log("".concat(o," ok. count:").concat(a.length)),t.clearGroupAtInfoList(e,!1),Promise.resolve()})).catch((function(e){return be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"appendToMessageList",value:function(e){this._messageListHandler.pushIn(e)}},{key:"setMessageRandom",value:function(e){this.singlyLinkedList.set(e.random)}},{key:"deleteMessageRandom",value:function(e){this.singlyLinkedList.delete(e.random)}},{key:"pushIntoMessageList",value:function(e,t,o){return!(!this._messageListHandler.pushIn(t,o)||this._isMessageFromCurrentInstance(t)&&!o)&&(e.push(t),!0)}},{key:"_isMessageFromCurrentInstance",value:function(e){return this.singlyLinkedList.has(e.random)}},{key:"revoke",value:function(e,t,o){return this._messageListHandler.revoke(e,t,o)}},{key:"getPeerReadTime",value:function(e){return this._peerReadTimeMap.get(e)}},{key:"recordPeerReadTime",value:function(e,t){this._peerReadTimeMap.has(e)?this._peerReadTimeMap.get(e)<t&&this._peerReadTimeMap.set(e,t):this._peerReadTimeMap.set(e,t)}},{key:"updateMessageIsPeerReadProperty",value:function(e,t){if(e.startsWith(D.CONV_C2C)&&t>0){var o=this._messageListHandler.updateMessageIsPeerReadProperty(e,t);if(o.length>0&&this.emitOuterEvent(C.MESSAGE_READ_BY_PEER,o),this._conversationMap.has(e)){var n=this._conversationMap.get(e).lastMessage;Bt(n)||n.fromAccount===this.getMyUserID()&&n.lastTime<=t&&!n.isPeerRead&&(n.isPeerRead=!0,this.emitConversationUpdate(!0,!1))}}}},{key:"updateMessageIsModifiedProperty",value:function(e){this._messageListHandler.updateMessageIsModifiedProperty(e)}},{key:"setCompleted",value:function(e){be.log("".concat(this._className,".setCompleted. conversationID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMessageKeyAndTime",value:function(e,t,o){this._roamingMessageKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:o})}},{key:"updateRoamingMessageSequence",value:function(e,t){this._roamingMessageSequenceMap.set(e,t)}},{key:"getConversationList",value:function(e){var t=this,o="".concat(this._className,".getConversationList"),n="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._conversationMap.size,", options:").concat(e);if(be.log("".concat(o,". ").concat(n)),this._pagingStatus===jt.REJECTED){var a=new Ca(Da.GET_CONVERSATION_LIST);return a.setMessage(n),this.syncConversationList().then((function(){a.setNetworkType(t.getNetworkType()).end();var o=t._getConversationList(e);return Ha({conversationList:o})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}if(0===this._conversationMap.size){var s=new Ca(Da.GET_CONVERSATION_LIST);return s.setMessage(n),this.syncConversationList().then((function(){s.setNetworkType(t.getNetworkType()).end();var o=t._getConversationList(e);return Ha({conversationList:o})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}var r=this._getConversationList(e);return be.log("".concat(o,". returned conversation count:").concat(r.length)),Qa({conversationList:r})}},{key:"_getConversationList",value:function(e){var t=this;if(Ze(e))return this.getLocalConversationList();if(Qe(e)){var o=[];return e.forEach((function(e){if(t._conversationMap.has(e)){var n=t.getLocalConversation(e);o.push(n)}})),o}}},{key:"_handleC2CPeerReadTime",value:function(){var e,t=S(this._conversationMap);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2),n=o[0],a=o[1];a.type===D.CONV_C2C&&(be.debug("".concat(this._className,"._handleC2CPeerReadTime conversationID:").concat(n," peerReadTime:").concat(a.peerReadTime)),this.recordPeerReadTime(n,a.peerReadTime))}}catch(s){t.e(s)}finally{t.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){return this.getModule(ro).isPagingGetCompleted()}},{key:"_hasLocalGroup",value:function(e){return this.getModule(ro).hasLocalGroup(e.replace(D.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(e){var t,o=this;if((t=this._conversationMap.has(e)?this._conversationMap.get(e):new Ms({conversationID:e,type:e.slice(0,3)===D.CONV_C2C?D.CONV_C2C:D.CONV_GROUP}))._isInfoCompleted||t.type===D.CONV_SYSTEM)return Qa({conversation:t});if(Ct(e)&&!this._hasLocalGroup(e))return Qa({conversation:t});var n=new Ca(Da.GET_CONVERSATION_PROFILE),a="".concat(this._className,".getConversationProfile");return be.log("".concat(a,". conversationID:").concat(e," remark:").concat(t.remark," lastMessage:"),t.lastMessage),this._updateUserOrGroupProfileCompletely(t).then((function(s){n.setNetworkType(o.getNetworkType()).setMessage("conversationID:".concat(e," unreadCount:").concat(s.data.conversation.unreadCount)).end();var r=o.getModule(io);if(r&&t.type===D.CONV_C2C){var i=e.replace(D.CONV_C2C,"");if(r.isMyFriend(i)){var c=r.getFriendRemark(i);t.remark!==c&&(t.remark=c,be.log("".concat(a,". conversationID:").concat(e," patch remark:").concat(t.remark)))}}return be.log("".concat(a," ok. conversationID:").concat(e)),s})).catch((function(t){return o.probeNetwork().then((function(o){var a=m(o,2),s=a[0],r=a[1];n.setError(t,s,r).setMessage("conversationID:".concat(e)).end()})),be.error("".concat(a," failed. error:"),t),Za(t)}))}},{key:"_updateUserOrGroupProfileCompletely",value:function(e){var t=this;return e.type===D.CONV_C2C?this.getModule(ao).getUserProfile({userIDList:[e.toAccount]}).then((function(o){var n=o.data;return 0===n.length?Za(new za({code:ua.USER_OR_GROUP_NOT_FOUND,message:la.USER_OR_GROUP_NOT_FOUND})):(e.userProfile=n[0],e._isInfoCompleted=!0,t._unshiftConversation(e),Qa({conversation:e}))})):this.getModule(ro).getGroupProfile({groupID:e.toAccount}).then((function(o){return e.groupProfile=o.data.group,e._isInfoCompleted=!0,t._unshiftConversation(e),Qa({conversation:e})}))}},{key:"_unshiftConversation",value:function(e){e instanceof Ms&&!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 o=e.userID;if(o===t.getMyUserID())t._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar});else{var n=t._conversationMap.get("".concat(D.CONV_C2C).concat(o));n&&(n.userProfile=e)}}))}},{key:"deleteConversation",value:function(e){var t=this,o={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e)){var n=new za({code:ua.CONVERSATION_NOT_FOUND,message:la.CONVERSATION_NOT_FOUND});return Za(n)}var a=this._conversationMap.get(e).type;if(a===D.CONV_C2C)o.type=1,o.toAccount=e.replace(D.CONV_C2C,"");else{if(a!==D.CONV_GROUP){if(a===D.CONV_SYSTEM)return this.getModule(ro).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),this.deleteLocalConversation(e),Qa({conversationID:e});var s=new za({code:ua.CONVERSATION_UN_RECORDED_TYPE,message:la.CONVERSATION_UN_RECORDED_TYPE});return Za(s)}if(!this._hasLocalGroup(e))return this.deleteLocalConversation(e),Qa({conversationID:e});o.type=2,o.toGroupID=e.replace(D.CONV_GROUP,"")}var r=new Ca(Da.DELETE_CONVERSATION);r.setMessage("conversationID:".concat(e));var i="".concat(this._className,".deleteConversation");return be.log("".concat(i,". conversationID:").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:Qo,requestData:o})})).then((function(){return r.setNetworkType(t.getNetworkType()).end(),be.log("".concat(i," ok")),t.deleteLocalConversation(e),Qa({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),be.error("".concat(i," failed. error:"),e),Za(e)}))}},{key:"pinConversation",value:function(e){var t=this,o=e.conversationID,n=e.isPinned;if(!this._conversationMap.has(o))return Za({code:ua.CONVERSATION_NOT_FOUND,message:la.CONVERSATION_NOT_FOUND});var a=this.getLocalConversation(o);if(a.isPinned===n)return Qa({conversationID:o});var s=new Ca(Da.PIN_CONVERSATION);s.setMessage("conversationID:".concat(o," isPinned:").concat(n));var r="".concat(this._className,".pinConversation");be.log("".concat(r,". conversationID:").concat(o," isPinned:").concat(n));var i=null;return St(o)?i={type:1,toAccount:o.replace(D.CONV_C2C,"")}:Ct(o)&&(i={type:2,groupID:o.replace(D.CONV_GROUP,"")}),this.request({protocolName:Zo,requestData:{fromAccount:this.getMyUserID(),operationType:!0===n?1:2,itemList:[i]}}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),be.log("".concat(r," ok")),a.isPinned!==n&&(a.isPinned=n,t._sortConversationListAndEmitEvent()),Ha({conversationID:o})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),be.error("".concat(r," failed. error:"),e),Za(e)}))}},{key:"setMessageRemindType",value:function(e){return this._messageRemindHandler.set(e)}},{key:"patchMessageRemindType",value:function(e){var t=e.ID,o=e.isC2CConversation,n=e.messageRemindType,a=!1,s=this.getLocalConversation(o?"".concat(D.CONV_C2C).concat(t):"".concat(D.CONV_GROUP).concat(t));return s&&s.messageRemindType!==n&&(s.messageRemindType=n,a=!0),be.debug("".concat(this._className,".patchMessageRemindType options:"),e,"ret:".concat(a)),a}},{key:"onC2CMessageRemindTypeSynced",value:function(e){var t=this;be.debug("".concat(this._className,".onC2CMessageRemindTypeSynced options:"),e),e.dataList.forEach((function(e){if(!Bt(e.muteNotificationsSync)){var o,n=e.muteNotificationsSync,a=n.to,s=n.updateSequence,r=n.muteFlag;t._messageRemindHandler.setUpdateSequence(s),0===r?o=D.MSG_REMIND_ACPT_AND_NOTE:1===r?o=D.MSG_REMIND_DISCARD:2===r&&(o=D.MSG_REMIND_ACPT_NOT_NOTE);var i=0;t.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:o})&&(i+=1),be.log("".concat(t._className,".onC2CMessageRemindTypeSynced updateCount:").concat(i)),i>=1&&t.emitConversationUpdate(!0,!1)}}))}},{key:"onGroupMessageRemindTypeSynced",value:function(e){be.debug("".concat(this._className,".onGroupMessageRemindTypeSynced options:"),e),this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e)}},{key:"deleteLocalConversation",value:function(e){var t=this._conversationMap.has(e);if(be.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 o=!this._isTopicConversation(e);this.emitConversationUpdate(o,!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(D.CONV_C2C)&&this._conversationMap.has(e)){var t=this._conversationMap.get(e),o=Date.now();this._messageListHandler.modifyMessageSentByPeer({conversationID:e,latestNick:t.userProfile.nick,latestAvatar:t.userProfile.avatar});var n=this.getModule(ao).getNickAndAvatarByUserID(this.getMyUserID());this._messageListHandler.modifyMessageSentByMe({conversationID:e,latestNick:n.nick,latestAvatar:n.avatar}),be.log("".concat(this._className,".modifyMessageList conversationID:").concat(e," cost ").concat(Date.now()-o," ms"))}}},{key:"updateUserProfileSpecifiedKey",value:function(e){be.log("".concat(this._className,".updateUserProfileSpecifiedKey options:"),e);var t=e.conversationID,o=e.nick,n=e.avatar;if(this._conversationMap.has(t)){var a=this._conversationMap.get(t).userProfile;ze(o)&&a.nick!==o&&(a.nick=o),ze(n)&&a.avatar!==n&&(a.avatar=n),this.emitConversationUpdate(!0,!1)}}},{key:"_onMyProfileModified",value:function(e){var o=this,n=this.getLocalConversationList(),a=Date.now();n.forEach((function(n){o.modifyMessageSentByMe(t({conversationID:n.conversationID},e))})),be.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(io);if(!t)return e;var o=M(this._conversationMap.values()).filter((function(e){return e.type===D.CONV_C2C}));if(0===o.length)return e;var n=0;return o.forEach((function(e){var o=e.conversationID.replace(D.CONV_C2C,"");if(t.isMyFriend(o)){var a=t.getFriendRemark(o);e.remark!==a&&(e.remark=a,n+=1)}})),be.log("".concat(this._className,".checkAndPatchRemark. c2c conversation count:").concat(o.length,", patched count:").concat(n)),e}},{key:"updateTopicConversation",value:function(e){this._updateLocalConversationList({conversationOptionsList:e,isFromGetConversations:!0})}},{key:"sendReadReceipt",value:function(e){var t=e[0],o=null;return t.conversationType===D.CONV_C2C?o=this._moduleManager.getModule(so):t.conversationType===D.CONV_GROUP&&(o=this._moduleManager.getModule(ro)),o?o.sendReadReceipt(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"getReadReceiptList",value:function(e){var t=e[0],o=null;return t.conversationType===D.CONV_C2C?o=this._moduleManager.getModule(so):t.conversationType===D.CONV_GROUP&&(o=this._moduleManager.getModule(ro)),o?o.getReadReceiptList(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"getLastMessageTime",value:function(e){var t=this.getLocalConversation(e);return t?t.lastMessage.lastTime:0}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._pagingStatus=jt.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}(Ao),ys=function(){function e(t){n(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,o){var n=e._checkCountMap.get(o),a=e._groupModule.hasLocalGroup(o);be.log("".concat(e._className,"._checkCachedGroupTips groupID:").concat(o," hasLocalGroup:").concat(a," checkCount:").concat(n)),a?(e._notifyCachedGroupTips(o),e._checkCountMap.delete(o),e._groupModule.deleteUnjoinedAVChatRoom(o)):n>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(o),e._checkCountMap.delete(o)):(n++,e._checkCountMap.set(o,n))}))}},{key:"onNewGroupTips",value:function(e){be.debug("".concat(this._className,".onReceiveGroupTips count:").concat(e.dataList.length));var t=this.newGroupTipsStoredAndSummary(e),o=t.eventDataList,n=t.result,a=t.AVChatRoomMessageList;(a.length>0&&this._groupModule.onAVChatRoomMessage(a),o.length>0)&&(this._groupModule.updateNextMessageSeq(o),this._groupModule.getModule(lo).onNewMessage({conversationOptionsList:o,isInstantMessage:!0}));n.length>0&&(this._groupModule.emitOuterEvent(C.MESSAGE_RECEIVED,n),this.handleMessageList(n))}},{key:"newGroupTipsStoredAndSummary",value:function(e){for(var o=this,n=e.event,a=e.dataList,s=null,r=[],i=[],c={},u=[],l=function(e,l){var d=Mt(a[e]),p=d.groupProfile,g=p.groupID,_=p.communityType,h=void 0===_?0:_,f=p.topicID,m=void 0===f?void 0:f,M=void 0,v=2===h&&!Bt(m);if(v){M=D.CONV_TOPIC,d.to=m;var I=o._groupModule.getModule(uo);I.hasLocalTopic(g,m)||o._getTopicPendingMap.has(m)||(o._getTopicPendingMap.set(m,1),I.getTopicList({groupID:g,topicIDList:[m]}).finally((function(){o._getTopicPendingMap.delete(m)})))}if(2===h&&Bt(m))return"continue";var y=o._groupModule.hasLocalGroup(g);if(!y&&o._groupModule.isUnjoinedAVChatRoom(g))return"continue";if(!y&&!v)return o._cacheGroupTipsAndProbe({groupID:g,event:n,item:d}),"continue";if(o._groupModule.isMessageFromOrToAVChatroom(g))return d.event=n,u.push(d),"continue";d.currentUser=o._groupModule.getMyUserID(),d.conversationType=D.CONV_GROUP,(s=new Ba(d)).setElement({type:D.MSG_GRP_TIP,content:t(t({},d.elements),{},{groupProfile:d.groupProfile})}),s.isSystemMessage=!1;var E=o._groupModule.getModule(lo),T=s,S=T.conversationID,C=T.sequence;if(6===n)s._onlineOnlyFlag=!0,i.push(s);else if(!E.pushIntoNoticeResult(i,s))return"continue";if(6===n&&E.getLocalConversation(S))return"continue";6!==n&&o._groupModule.getModule(Do).addMessageSequence({key:Ma,message:s});var N=E.isRemoteRead({conversationID:S,sequence:C});if(Ze(c[S])){var A=0;"in"===s.flow&&(s._isExcludedFromUnreadCount||s._onlineOnlyFlag||N||(A=1)),c[S]=r.push({conversationID:S,unreadCount:A,type:Ze(M)?s.conversationType:M,subType:s.conversationSubType,lastMessage:s._isExcludedFromLastMessage?"":s})-1}else{var O=c[S];r[O].type=s.conversationType,r[O].subType=s.conversationSubType,r[O].lastMessage=s._isExcludedFromLastMessage?"":s,"in"===s.flow&&(s._isExcludedFromUnreadCount||s._onlineOnlyFlag||N||r[O].unreadCount++)}},d=0,p=a.length;d<p;d++)l(d);return{eventDataList:r,result:i,AVChatRoomMessageList:u}}},{key:"handleMessageList",value:function(e){var t=this;e.forEach((function(e){switch(e.payload.operationType){case 1:t._onNewMemberComeIn(e);break;case 2:t._onMemberQuit(e);break;case 3:t._onMemberKickedOut(e);break;case 4:t._onMemberSetAdmin(e);break;case 5:t._onMemberCancelledAdmin(e);break;case 6:t._onGroupProfileModified(e);break;case 7:t._onMemberInfoModified(e);break;case 8:t._onTopicProfileUpdated(e);break;default:be.warn("".concat(t._className,".handleMessageList unknown operationType:").concat(e.payload.operationType))}}))}},{key:"_onNewMemberComeIn",value:function(e){var t=e.payload,o=t.memberNum,n=t.groupProfile.groupID,a=this._groupModule.getLocalGroupProfile(n);a&&$e(o)&&a.memberCount!==o&&(a.memberCount=o,this._updateConversationGroupProfile(a))}},{key:"_onMemberQuit",value:function(e){var t=e.payload,o=t.memberNum,n=t.groupProfile.groupID,a=this._groupModule.getLocalGroupProfile(n);a&&$e(o)&&a.memberCount!==o&&(a.memberCount=o,this._updateConversationGroupProfile(a)),this._groupModule.getModule(co).deleteLocalGroupMembers(n,e.payload.userIDList)}},{key:"_onMemberKickedOut",value:function(e){var t=e.payload,o=t.memberNum,n=t.groupProfile.groupID,a=this._groupModule.getLocalGroupProfile(n);a&&$e(o)&&a.memberCount!==o&&(a.memberCount=o,this._updateConversationGroupProfile(a)),this._groupModule.getModule(co).deleteLocalGroupMembers(n,e.payload.userIDList)}},{key:"_updateConversationGroupProfile",value:function(e){this._groupModule.getModule(lo).updateConversationGroupProfile([e])}},{key:"_onMemberSetAdmin",value:function(e){var t=e.payload.groupProfile.groupID,o=e.payload.userIDList,n=this._groupModule.getModule(co);o.forEach((function(e){var o=n.getLocalGroupMemberInfo(t,e);o&&o.updateRole(D.GRP_MBR_ROLE_ADMIN)}))}},{key:"_onMemberCancelledAdmin",value:function(e){var t=e.payload.groupProfile.groupID,o=e.payload.userIDList,n=this._groupModule.getModule(co);o.forEach((function(e){var o=n.getLocalGroupMemberInfo(t,e);o&&o.updateRole(D.GRP_MBR_ROLE_MEMBER)}))}},{key:"_onGroupProfileModified",value:function(e){var t=this,o=e.payload,n=o.newGroupProfile,a=o.groupProfile.groupID,s=this._groupModule.getLocalGroupProfile(a);Object.keys(n).forEach((function(e){switch(e){case"ownerID":t._ownerChanged(s,n);break;case"muteAllMembers":s.muteAllMembers=n.muteAllMembers;break;case"joinOption":s.joinOption=n.joinOption;break;default:s[e]=n[e]}}));var r=!s.isSupportTopic;this._groupModule.emitGroupListUpdate(!0,r)}},{key:"_ownerChanged",value:function(e,t){var o=e.groupID,n=this._groupModule.getLocalGroupProfile(o),a=this._groupModule.getMyUserID();if(a===t.ownerID){n.updateGroup({selfInfo:{role:D.GRP_MBR_ROLE_OWNER}});var s=this._groupModule.getModule(co),r=s.getLocalGroupMemberInfo(o,a),i=this._groupModule.getLocalGroupProfile(o).ownerID,c=s.getLocalGroupMemberInfo(o,i);r&&r.updateRole(D.GRP_MBR_ROLE_OWNER),c&&c.updateRole(D.GRP_MBR_ROLE_MEMBER)}}},{key:"_onMemberInfoModified",value:function(e){var t=e.to,o=e.payload,n=o.groupProfile,a=o.memberList,s=n.groupID;Tt(t)&&this._updateTopicMuteTime(e);var r=this._groupModule.getModule(co);a.forEach((function(e){var t=r.getLocalGroupMemberInfo(s,e.userID);t&&$e(e.muteTime)&&t.updateMuteUntil(e.muteTime)}))}},{key:"_updateTopicMuteTime",value:function(e){var t=e.to,o=e.payload,n=o.groupProfile,a=o.memberList,s=void 0===a?[]:a,r=this._groupModule.getModule(uo),i=n.groupID,c=r.getLocalTopic(i,t);if(c){for(var u=!1,l=0;l<s.length;l++){var d=s[l];if(d.userID===this._groupModule.getMyUserID()&&d.muteTime>=0){c.updateSelfInfo({muteTime:d.muteTime}),u=!0;break}}u&&this._groupModule.emitOuterEvent(C.TOPIC_UPDATED,{groupID:i,topic:c})}}},{key:"_onTopicProfileUpdated",value:function(e){var o=e.payload,n=o.groupProfile.groupID,a=o.newTopicInfo;this._groupModule.getModule(uo).onTopicProfileUpdated(t({groupID:n,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,o=this._cachedGroupTipsMap.get(e)||[];o.forEach((function(e){t.onNewGroupTips(e)})),this._deleteCachedGroupTips(e),be.log("".concat(this._className,"._notifyCachedGroupTips groupID:").concat(e," count:").concat(o.length))}},{key:"_cacheGroupTipsAndProbe",value:function(e){var t=this,o=e.groupID,n=e.event,a=e.item;this._cacheGroupTips(o,{event:n,dataList:[a]}),this._groupModule.getGroupSimplifiedInfo(o).then((function(e){e.type===D.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(o)?t._notifyCachedGroupTips(o):t._groupModule.setUnjoinedAVChatRoom(o):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupTips(o))})),this._checkCountMap.has(o)||this._checkCountMap.set(o,0),be.log("".concat(this._className,"._cacheGroupTipsAndProbe groupID:").concat(o))}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear()}}]),e}(),Es=function(){function e(t){n(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(os,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,o){var n=e._checkCountMap.get(o),a=e._groupModule.hasLocalGroup(o);be.log("".concat(e._className,"._checkCachedGroupMessage groupID:").concat(o," hasLocalGroup:").concat(a," checkCount:").concat(n)),a?(e._notifyCachedGroupMessage(o),e._checkCountMap.delete(o),e._groupModule.deleteUnjoinedAVChatRoom(o)):n>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(o),e._checkCountMap.delete(o)):(n++,e._checkCountMap.set(o,n))}))}},{key:"_initGroupList",value:function(){var e=this;be.log("".concat(this._className,"._initGroupList"));var t=new Ca(Da.GET_GROUP_LIST_IN_STORAGE),o=this._groupModule.getStorageGroupList();if(Qe(o)&&o.length>0){o.forEach((function(t){e._groupModule.initGroupMap(t)})),this._groupModule.emitGroupListUpdate(!0,!1);var n=this._groupModule.getLocalGroupList().length;t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:".concat(n)).end()}else t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:0").end();be.log("".concat(this._className,"._initGroupList ok"))}},{key:"handleUpdateGroupLastMessage",value:function(e){var t="".concat(this._className,".handleUpdateGroupLastMessage");if(be.debug("".concat(t," conversation count:").concat(e.length,", local group count:").concat(this._groupModule.getLocalGroupList().length)),0!==this._groupModule.getGroupMap().size){for(var o,n,a,s=!1,r=0,i=e.length;r<i;r++)(o=e[r]).type===D.CONV_GROUP&&(n=o.conversationID.split(/^GROUP/)[1],(a=this._groupModule.getLocalGroupProfile(n))&&(a.lastMessage=o.lastMessage,s=!0));s&&(this._groupModule.sortLocalGroupList(),this._groupModule.emitGroupListUpdate(!0,!1))}else this.tempConversationList=e}},{key:"onNewGroupMessage",value:function(e){be.debug("".concat(this._className,".onNewGroupMessage count:").concat(e.dataList.length));var t=this._newGroupMessageStoredAndSummary(e),o=t.conversationOptionsList,n=t.messageList,a=t.AVChatRoomMessageList;(a.length>0&&this._groupModule.onAVChatRoomMessage(a),this._groupModule.filterModifiedMessage(n),o.length>0)&&(this._groupModule.updateNextMessageSeq(o),this._groupModule.getModule(lo).onNewMessage({conversationOptionsList:o,isInstantMessage:!0}));var s=this._groupModule.filterUnmodifiedMessage(n);s.length>0&&this._groupModule.emitOuterEvent(C.MESSAGE_RECEIVED,s),n.length=0}},{key:"_newGroupMessageStoredAndSummary",value:function(e){var t=this,o=e.dataList,n=e.event,a=e.isInstantMessage,s=null,r=[],i=[],c=[],u={},l=this._groupModule.getModule(fo),d=this._groupModule.getModule(Do),p=o.length;p>1&&o.sort((function(e,t){return e.sequence-t.sequence}));for(var g=function(e){var p=Mt(o[e]),g=p.groupProfile,_=g.groupID,h=g.communityType,f=void 0===h?0:h,m=g.topicID,M=void 0===m?void 0:m,v=void 0,I=2===f&&!Bt(M);if(I){v=D.CONV_TOPIC,p.to=M;var y=t._groupModule.getModule(uo);y.hasLocalTopic(_,M)||t._getTopicPendingMap.has(M)||(t._getTopicPendingMap.set(M,1),y.getTopicList({groupID:_,topicIDList:[M]}).finally((function(){t._getTopicPendingMap.delete(M)})))}if(2===f&&Bt(M))return"continue";var E=t._groupModule.hasLocalGroup(_);if(!E&&t._groupModule.isUnjoinedAVChatRoom(_))return"continue";if(!E&&!I)return t._cacheGroupMessageAndProbe({groupID:_,event:n,item:p}),"continue";if(t._groupModule.isMessageFromOrToAVChatroom(_))return p.event=n,c.push(p),"continue";p.currentUser=t._groupModule.getMyUserID(),p.conversationType=D.CONV_GROUP,p.isSystemMessage=!!p.isSystemMessage,s=new Ba(p),p.elements=l.parseElements(p.elements,p.from),s.setElement(p.elements);var T=1===o[e].isModified,S=t._groupModule.getModule(lo);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:Ma,message:s}),a&&s.clientTime>0&&d.addMessageDelay(s.clientTime);var C=s,N=C.conversationID,A=C.sequence,O=S.isRemoteRead({conversationID:N,sequence:A});if(Ze(u[N])){var R=0;"in"===s.flow&&(s._isExcludedFromUnreadCount||O||(R=1)),u[N]=r.push({conversationID:N,unreadCount:R,type:Ze(v)?s.conversationType:v,subType:s.conversationSubType,lastMessage:s._isExcludedFromLastMessage?"":s})-1}else{var L=u[N];r[L].type=Ze(v)?s.conversationType:v,r[L].subType=s.conversationSubType,r[L].lastMessage=s._isExcludedFromLastMessage?"":s,"in"===s.flow&&(s._isExcludedFromUnreadCount||O||r[L].unreadCount++)}}},_=0;_<p;_++)g(_);return{conversationOptionsList:r,messageList:i,AVChatRoomMessageList:c}}},{key:"onGroupMessageRevoked",value:function(e){be.debug("".concat(this._className,".onGroupMessageRevoked nums:").concat(e.dataList.length));var t=this._groupModule.getModule(lo),o=[],n=null;e.dataList.forEach((function(e){var a=e.elements.revokedInfos;Ze(a)||a.forEach((function(e){var a=Ze(e.topicID)?"GROUP".concat(e.groupID):"GROUP".concat(e.topicID);(n=t.revoke(a,e.sequence,e.random))&&o.push(n)}))})),0!==o.length&&(t.onMessageRevoked(o),this._groupModule.emitOuterEvent(C.MESSAGE_REVOKED,o))}},{key:"_groupListTreeShaking",value:function(e){for(var t=new Map(M(this._groupModule.getGroupMap())),o=0,n=e.length;o<n;o++)t.delete(e[o].groupID);this._groupModule.hasJoinedAVChatRoom()&&this._groupModule.getJoinedAVChatRoom().forEach((function(e){t.delete(e)}));this._groupModule.getGroupMap().forEach((function(e,o){e.isSupportTopic&&t.delete(o)}));for(var a=M(t.keys()),s=0,r=a.length;s<r;s++)this._groupModule.deleteGroup(a[s])}},{key:"getGroupList",value:function(e){var t=this,o="".concat(this._className,".getGroupList"),n=new Ca(Da.GET_GROUP_LIST);be.log("".concat(o));var a={introduction:"Introduction",notification:"Notification",createTime:"CreateTime",ownerID:"Owner_Account",lastInfoTime:"LastInfoTime",memberNum:"MemberNum",maxMemberNum:"MaxMemberNum",joinOption:"ApplyJoinOption",muteAllMembers:"ShutUpAllMember"},s=["Type","Name","FaceUrl","NextMsgSeq","LastMsgTime","AtInfoList"],r=[];e&&e.groupProfileFilter&&e.groupProfileFilter.forEach((function(e){a[e]&&s.push(a[e])}));var i=(e||{}).isGroupWithTopicOnly,c=void 0!==i&&i;return this._pagingGetGroupList({limit:50,offset:0,groupBaseInfoFilter:s,groupList:r,isGroupWithTopicOnly:c}).then((function(){be.log("".concat(o," ok. count:").concat(r.length," isGroupWithTopicOnly:").concat(c)),c||t._groupListTreeShaking(r),t._groupModule.updateGroupMap(r);var e=t._groupModule.getLocalGroupList().length;n.setNetworkType(t._groupModule.getNetworkType()).setMessage("remote count:".concat(r.length,", after tree shaking, local count:").concat(e,", isGroupWithTopicOnly:").concat(c)).end(),t.tempConversationList&&(be.log("".concat(o," update last message with tempConversationList, count:").concat(t.tempConversationList.length)),t.handleUpdateGroupLastMessage({data:t.tempConversationList}),t.tempConversationList=null),t._groupModule.patchGroupMessageRemindType(),t._groupModule.recomputeUnreadCount(),t._groupModule.emitGroupListUpdate(!0,!c);var a=t._groupModule.getLocalGroupList();if(c){var s=a.filter((function(e){return!0===e.isSupportTopic}));return Ha({groupList:s})}return t._isPagingGetCompleted=!0,Ha({groupList:a})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"isPagingGetCompleted",value:function(){return this._isPagingGetCompleted}},{key:"_pagingGetGroupList",value:function(e){var t=this,o="".concat(this._className,"._pagingGetGroupList"),n=e.isCommunityRelay,a=void 0!==n&&n,s=e.isGroupWithTopicOnly,r=void 0!==s&&s,i=e.limit,c=e.offset,u=e.groupBaseInfoFilter,l=e.groupList;if(r)return this._pagingGetGroupListWithTopic({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l});var d=new Ca(Da.PAGING_GET_GROUP_LIST);return this._groupModule.request({protocolName:tn,requestData:{type:a?D.GRP_COMMUNITY:void 0,memberAccount:this._groupModule.getMyUserID(),limit:i,offset:c,responseFilter:{groupBaseInfoFilter:u,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]}}}).then((function(e){var n=e.data,s=n.groups,r=void 0===s?[]:s,p=n.totalCount;l.push.apply(l,M(r)),t._handleGroupAtInfoWithoutTopic(a,r);var g=c+i,_=!(p>g),h="offset:".concat(c," totalCount:").concat(p," isCompleted:").concat(_," ")+"currentCount:".concat(l.length," isCommunityRelay:").concat(a);return d.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(h)).end(),a||_?!a&&_?(be.log("".concat(o," start to get community list")),c=0,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l,isCommunityRelay:!0})):a&&!_?(c=g,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l,isCommunityRelay:!0})):(be.log("".concat(o," ok. totalCount:").concat(l.length)),Ha({groupList:l})):(c=g,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l}))})).catch((function(e){return 11e3!==e.code&&t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];d.setMessage("isCommunityRelay:".concat(a)).setError(e,n,s).end()})),a?(11e3===e.code&&(d=null,be.log("".concat(o," ok. community unavailable"))),Qa({groupList:l})):Za(e)}))}},{key:"_pagingGetGroupListWithTopic",value:function(e){var t=this,o="".concat(this._className,"._pagingGetGroupListWithTopic"),n=e.limit,a=e.offset,s=e.groupBaseInfoFilter,r=e.groupList,i=new Ca(Da.PAGING_GET_GROUP_LIST_WITH_TOPIC);return this._groupModule.request({protocolName:tn,requestData:{type:D.GRP_COMMUNITY,memberAccount:this._groupModule.getMyUserID(),limit:n,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+n,g=!(d>p),_="offset:".concat(a," totalCount:").concat(d," isCompleted:").concat(g," ")+"currentCount:".concat(r.length);return i.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(_)).end(),g?(be.log("".concat(o," ok. totalCount:").concat(r.length)),Ha({groupList:r})):(a=p,t._pagingGetGroupListWithTopic({limit:n,offset:a,groupBaseInfoFilter:s,groupList:r}))})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];i.setError(e,n,a).end()})),Za(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,o=this._cachedGroupMessageMap.get(e)||[];o.forEach((function(e){t.onNewGroupMessage(e)})),this._deleteCachedGroupMessage(e),be.log("".concat(this._className,"._notifyCachedGroupMessage groupID:").concat(e," count:").concat(o.length))}},{key:"_cacheGroupMessageAndProbe",value:function(e){var t=this,o=e.groupID,n=e.event,a=e.item;this._cacheGroupMessage(o,{event:n,dataList:[a]}),this._groupModule.getGroupSimplifiedInfo(o).then((function(e){e.type===D.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(o)?t._notifyCachedGroupMessage(o):t._groupModule.setUnjoinedAVChatRoom(o):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupMessage(o))})),this._checkCountMap.has(o)||this._checkCountMap.set(o,0),be.log("".concat(this._className,"._cacheGroupMessageAndProbe groupID:").concat(o))}},{key:"_handleGroupAtInfoWithoutTopic",value:function(e,o){var n=this;e&&0!==o.length&&o.forEach((function(e){var o=e.groupID,a=e.groupAtInfoList,s=[];Ze(a)||(a.forEach((function(e){s.push(t(t({},e),{},{groupID:o}))})),n._groupModule.getModule(lo).onNewGroupAtTips({dataList:s}))}))}},{key:"reset",value:function(){this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear(),this._isPagingGetCompleted=!1,this._groupModule.getInnerEmitterInstance().once(os,this._initGroupList,this)}}]),e}(),Ts={1:"init",2:"modify",3:"clear",4:"delete"},Ss=function(){function e(t){n(this,e),this._groupModule=t,this._className="GroupAttributesHandler",this._groupAttributesMap=new Map,this.CACHE_EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(ns,this._onCloudConfigUpdated,this)}return s(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_attr_cache_time");Ze(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,o=e.groupID,n=e.groupAttributeOption,a=n.mainSequence,s=n.hasChangedAttributeInfo,r=n.groupAttributeList,i=void 0===r?[]:r,c=n.operationType;if(be.log("".concat(this._className,".onGroupAttributesUpdated. groupID:").concat(o," hasChangedAttributeInfo:").concat(s," operationType:").concat(c)),!Ze(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:o,remoteMainSequence:a,groupAttributeList:i,operationType:Ts[c]}),void this._emitGroupAttributesUpdated(o)}if(this._groupAttributesMap.has(o)){var l=this._groupAttributesMap.get(o).avChatRoomKey;this._getGroupAttributes({groupID:o,avChatRoomKey:l}).then((function(){t._emitGroupAttributesUpdated(o)}))}}}},{key:"initGroupAttributesCache",value:function(e){var t=e.groupID,o=e.avChatRoomKey;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:o}),be.log("".concat(this._className,".initGroupAttributesCache groupID:").concat(t," avChatRoomKey:").concat(o))}},{key:"initGroupAttributes",value:function(e){var t=this,o=e.groupID,n=e.groupAttributes,a=this._checkCachedGroupAttributes({groupID:o,funcName:"initGroupAttributes"});if(!0!==a)return Za(a);var s=this._groupAttributesMap.get(o),r=s.remoteMainSequence,i=s.avChatRoomKey,c=new Ca(Da.INIT_GROUP_ATTRIBUTES);return c.setMessage("groupID:".concat(o," mainSequence:").concat(r," groupAttributes:").concat(JSON.stringify(n))),this._groupModule.request({protocolName:On,requestData:{groupID:o,avChatRoomKey:i,mainSequence:r,groupAttributeList:this._transformGroupAttributes(n)}}).then((function(e){var a=e.data,s=a.mainSequence,r=M(a.groupAttributeList);return r.forEach((function(e){e.value=n[e.key]})),t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:s,groupAttributeList:r,operationType:"init"}),c.setNetworkType(t._groupModule.getNetworkType()).end(),be.log("".concat(t._className,".initGroupAttributes ok. groupID:").concat(o)),Ha({groupAttributes:n})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Za(e)}))}},{key:"setGroupAttributes",value:function(e){var t=this,o=e.groupID,n=e.groupAttributes,a=this._checkCachedGroupAttributes({groupID:o,funcName:"setGroupAttributes"});if(!0!==a)return Za(a);var s=this._groupAttributesMap.get(o),r=s.remoteMainSequence,i=s.avChatRoomKey,c=s.attributes,u=this._transformGroupAttributes(n);u.forEach((function(e){var t=e.key;e.sequence=0,c.has(t)&&(e.sequence=c.get(t).sequence)}));var l=new Ca(Da.SET_GROUP_ATTRIBUTES);return l.setMessage("groupID:".concat(o," mainSequence:").concat(r," groupAttributes:").concat(JSON.stringify(n))),this._groupModule.request({protocolName:Rn,requestData:{groupID:o,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=n[e.key]})),t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:s,groupAttributeList:r,operationType:"modify"}),l.setNetworkType(t._groupModule.getNetworkType()).end(),be.log("".concat(t._className,".setGroupAttributes ok. groupID:").concat(o)),Ha({groupAttributes:n})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setError(e,n,a).end()})),Za(e)}))}},{key:"deleteGroupAttributes",value:function(e){var t=this,o=e.groupID,n=e.keyList,a=void 0===n?[]:n,s=this._checkCachedGroupAttributes({groupID:o,funcName:"deleteGroupAttributes"});if(!0!==s)return Za(s);var r=this._groupAttributesMap.get(o),i=r.remoteMainSequence,c=r.avChatRoomKey,u=r.attributes,l=M(u.keys()),d=kn,p="clear",g={groupID:o,avChatRoomKey:c,mainSequence:i};if(a.length>0){var _=[];l=[],d=Ln,p="delete",a.forEach((function(e){var t=0;u.has(e)&&(t=u.get(e).sequence,l.push(e)),_.push({key:e,sequence:t})})),g.groupAttributeList=_}var h=new Ca(Da.DELETE_GROUP_ATTRIBUTES);return h.setMessage("groupID:".concat(o," mainSequence:").concat(i," keyList:").concat(a," protocolName:").concat(d)),this._groupModule.request({protocolName:d,requestData:g}).then((function(e){var n=e.data.mainSequence;return t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:n,groupAttributeList:a,operationType:p}),h.setNetworkType(t._groupModule.getNetworkType()).end(),be.log("".concat(t._className,".deleteGroupAttributes ok. groupID:").concat(o)),Ha({keyList:l})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];h.setError(e,n,a).end()})),Za(e)}))}},{key:"getGroupAttributes",value:function(e){var t=this,o=e.groupID,n=this._checkCachedGroupAttributes({groupID:o,funcName:"getGroupAttributes"});if(!0!==n)return Za(n);var a=this._groupAttributesMap.get(o),s=a.avChatRoomKey,r=a.lastUpdateTime,i=a.localMainSequence,c=a.remoteMainSequence,u=new Ca(Da.GET_GROUP_ATTRIBUTES);if(u.setMessage("groupID:".concat(o," localMainSequence:").concat(i," remoteMainSequence:").concat(c," keyList:").concat(e.keyList)),Date.now()-r>=this.CACHE_EXPIRE_TIME||i<c)return this._getGroupAttributes({groupID:o,avChatRoomKey:s}).then((function(n){u.setMoreMessage("get attributes from remote. count:".concat(n.length)).setNetworkType(t._groupModule.getNetworkType()).end(),be.log("".concat(t._className,".getGroupAttributes from remote. groupID:").concat(o));var a=t._getLocalGroupAttributes(e);return Ha({groupAttributes:a})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];u.setError(e,n,a).end()})),Za(e)}));u.setMoreMessage("get attributes from cache").setNetworkType(this._groupModule.getNetworkType()).end(),be.log("".concat(this._className,".getGroupAttributes from cache. groupID:").concat(o));var l=this._getLocalGroupAttributes(e);return Qa({groupAttributes:l})}},{key:"_getGroupAttributes",value:function(e){var o=this;return this._groupModule.request({protocolName:Gn,requestData:t({},e)}).then((function(t){var n=t.data,a=n.mainSequence,s=n.groupAttributeList,r=M(s);return Ze(a)||o._refreshCachedGroupAttributes({groupID:e.groupID,remoteMainSequence:a,groupAttributeList:r,operationType:"get"}),be.log("".concat(o._className,"._getGroupAttributes ok. groupID:").concat(e.groupID)),s})).catch((function(e){return Za(e)}))}},{key:"_getLocalGroupAttributes",value:function(e){var t=e.groupID,o=e.keyList,n=void 0===o?[]:o,a={};if(!this._groupAttributesMap.has(t))return a;var s=this._groupAttributesMap.get(t).attributes;if(n.length>0)n.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,o=e.remoteMainSequence,n=e.groupAttributeList,a=e.operationType;if(this._groupAttributesMap.has(t)){var s=this._groupAttributesMap.get(t),r=s.localMainSequence;if("get"===a||o-r==1)s.remoteMainSequence=o,s.localMainSequence=o,s.lastUpdateTime=Date.now(),this._updateCachedAttributes({groupAttributes:s,groupAttributeList:n,operationType:a});else{if(r===o)return;s.remoteMainSequence=o}this._groupAttributesMap.set(t,s);var i="operationType:".concat(a," localMainSequence:").concat(r," remoteMainSequence:").concat(o);be.log("".concat(this._className,"._refreshCachedGroupAttributes. ").concat(i))}}},{key:"_updateCachedAttributes",value:function(e){var t=e.groupAttributes,o=e.groupAttributeList,n=e.operationType;"clear"!==n?"delete"!==n?("init"===n&&t.attributes.clear(),o.forEach((function(e){var o=e.key,n=e.value,a=e.sequence;t.attributes.set(o,{value:n,sequence:a})}))):o.forEach((function(e){t.attributes.delete(e)})):t.attributes.clear()}},{key:"_checkCachedGroupAttributes",value:function(e){var t=e.groupID,o=e.funcName;if(this._groupModule.hasLocalGroup(t)&&this._groupModule.getLocalGroupProfile(t).type!==D.GRP_AVCHATROOM){return be.warn("".concat(this._className,"._checkCachedGroupAttributes. ").concat("非直播群不能使用群属性 API")),new za({code:ua.CANNOT_USE_GRP_ATTR_NOT_AVCHATROOM,message:"非直播群不能使用群属性 API"})}var n=this._groupAttributesMap.get(t);if(Ze(n)){var a="如果 groupID:".concat(t," 是直播群,使用 ").concat(o," 前先使用 joinGroup 接口申请加入群组,详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#joinGroup");return be.warn("".concat(this._className,"._checkCachedGroupAttributes. ").concat(a)),new za({code:ua.CANNOT_USE_GRP_ATTR_AVCHATROOM_UNJOIN,message:a})}return!0}},{key:"_transformGroupAttributes",value:function(e){var t=[];return Object.keys(e).forEach((function(o){t.push({key:o,value:e[o]})})),t}},{key:"_emitGroupAttributesUpdated",value:function(e){var t=this._getLocalGroupAttributes({groupID:e});this._groupModule.emitOuterEvent(C.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t})}},{key:"reset",value:function(){this._groupAttributesMap.clear(),this.CACHE_EXPIRE_TIME=3e4}}]),e}(),Cs=function(){function e(t){n(this,e);var o=t.manager,a=t.groupID,s=t.onInit,r=t.onSuccess,i=t.onFail;this._className="Polling",this._manager=o,this._groupModule=o._groupModule,this._onInit=s,this._onSuccess=r,this._onFail=i,this._groupID=a,this._timeoutID=-1,this._isRunning=!1,this._protocolName=Sn}return s(e,[{key:"start",value:function(){var e=this._groupModule.isLoggedIn();e||(this._protocolName=Cn),be.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(){be.log("".concat(this._className,".stop")),this._timeoutID>0&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}}]),e}(),Ds={3:!0,4:!0,5:!0,6:!0,17:!0},Ns=function(){function e(t){n(this,e),this._groupModule=t,this._className="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this.sequencesLinkedList=new _s(200),this.messageIDLinkedList=new _s(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 o=this._pollingRequestInfoMap.get(e);return e===M(this._pollingInstanceMap.keys())[0]?t(t({},o),{},{startBroadcastSeq:this._startBroadcastSeq}):t({},o)}},{key:"_handleSuccess",value:function(e,t){var o=t.data,n=o.key,a=o.nextSeq,s=o.rspMsgList,r=o.errorCode,i=o.nextBroadcastSeq,c=o.broadcastMessageList;if(0!==r){var u=this._pollingRequestInfoMap.get(e),l=new Ca(Da.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;ze(n)&&$e(a)&&this._pollingRequestInfoMap.set(e,{key:n,startSeq:a}),$e(i)&&i>this._startBroadcastSeq&&(this._startBroadcastSeq=i),Qe(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(Qe(e)&&0!==e.length){0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL);var t=null,o=[],n=this._getModule(lo),a=this._getModule(Do),s=e.length;s>1&&e.sort((function(e,t){return e.sequence-t.sequence}));for(var r=this._getModule(po),i=0;i<s;i++)if(Ds[e[i].event]){this.receivedMessageCount+=1,t=this.packMessage(e[i],e[i].event);var c=1===e[i].isModified,u=1===e[i].isHistoryMessage;if((r.isUnlimitedAVChatRoom()||!this.sequencesLinkedList.has(t.sequence))&&!this.messageIDLinkedList.has(t.ID)){var l=t.conversationID;if(this.receivedMessageCount%50==0?this._getModule(Eo).detectFirstRound(l,this.sequencesLinkedList.data()):this.receivedMessageCount%80==0&&this._getModule(Eo).detectSecondRound(l,this.sequencesLinkedList.data()),null!==this.sequencesLinkedList.tail()){var d=this.sequencesLinkedList.tail().value,p=t.sequence-d;p>1&&p<=20?this._getModule(Eo).onMessageMaybeLost(l,d+1,p-1):p<-1&&p>=-20&&this._getModule(Eo).onMessageMaybeLost(l,t.sequence+1,Math.abs(p)-1)}this.sequencesLinkedList.set(t.sequence),this.messageIDLinkedList.set(t.ID);var g=!1;if(this._isMessageSentByCurrentInstance(t)?c&&(g=!0,t.isModified=c,n.updateMessageIsModifiedProperty(t)):g=!0,g){if(t.conversationType===D.CONV_SYSTEM&&5===t.payload.operationType&&this._onGroupDismissed(t.payload.groupProfile.groupID),!u&&t.conversationType!==D.CONV_SYSTEM){var _=t.conversationID.replace(D.CONV_GROUP,"");this._pollingInstanceMap.has(_)?a.addMessageSequence({key:Ia,message:t}):(t.type!==D.MSG_GRP_TIP&&t.clientTime>0&&a.addMessageDelay(t.clientTime),a.addMessageSequence({key:va,message:t}))}o.push(t)}}}else be.warn("".concat(this._className,".onMessage 未处理的 event 类型: ").concat(e[i].event));if(0!==o.length){this._groupModule.filterModifiedMessage(o);var h=this.packConversationOption(o);if(h.length>0)this._getModule(lo).onNewMessage({conversationOptionsList:h,isInstantMessage:!0});be.debug("".concat(this._className,".onMessage count:").concat(o.length)),this._checkMessageStacked(o);var f=this._groupModule.filterUnmodifiedMessage(o);f.length>0&&this._groupModule.emitOuterEvent(C.MESSAGE_RECEIVED,f),o.length=0}}}},{key:"_onGroupDismissed",value:function(e){be.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&&(be.warn("".concat(this._className,"._checkMessageStacked 直播群消息堆积数:").concat(e.length,'!可能会导致微信小程序渲染时遇到 "Dom limit exceeded" 的错误,建议接入侧此时只渲染最近的10条消息')),this._reportMessageStackedCount<5&&(new Ca(Da.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(lo).isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(e,t){e.currentUser=this._groupModule.getMyUserID(),e.conversationType=5===t?D.CONV_SYSTEM:D.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var o=new Ba(e),n=this.packElements(e,t);return o.setElement(n),o}},{key:"packElements",value:function(e,o){return 4===o||6===o?(this._updateMemberCountByGroupTips(e),this._onGroupAttributesUpdated(e),{type:D.MSG_GRP_TIP,content:t(t({},e.elements),{},{groupProfile:e.groupProfile})}):5===o?{type:D.MSG_GRP_SYS_NOTICE,content:t(t({},e.elements),{},{groupProfile:t(t({},e.groupProfile),{},{groupID:e.groupID})})}:this._getModule(fo).parseElements(e.elements,e.from)}},{key:"packConversationOption",value:function(e){for(var t=new Map,o=0;o<e.length;o++){var n=e[o],a=n.conversationID;if(t.has(a)){var s=t.get(a);s.lastMessage=n,"in"===n.flow&&s.unreadCount++}else t.set(a,{conversationID:n.conversationID,unreadCount:"out"===n.flow?0:1,type:n.conversationType,subType:n.conversationSubType,lastMessage:n})}return M(t.values())}},{key:"_updateMemberCountByGroupTips",value:function(e){var t=e.groupProfile.groupID,o=e.elements.onlineMemberInfo,n=void 0===o?void 0:o;if(!Bt(n)){var a=n.onlineMemberNum,s=void 0===a?0:a,r=n.expireTime,i=void 0===r?this.DEFAULT_EXPIRE_TIME:r,c=this._onlineMemberCountMap.get(t)||{},u=Date.now();Bt(c)?Object.assign(c,{lastReqTime:0,lastSyncTime:0,latestUpdateTime:u,memberCount:s,expireTime:i}):(c.latestUpdateTime=u,c.memberCount=s),be.debug("".concat(this._className,"._updateMemberCountByGroupTips info:"),c),this._onlineMemberCountMap.set(t,c)}}},{key:"_onBroadcastMessage",value:function(e){if(!Bt(e)){for(var t=[],o=e.length,n=null,a=0;a<o;a++)Ds[e[a].event]?((n=this.packMessage(e[a],e[a].event)).isBroadcastMessage=!0,this._broadcastMessageIDMap.has(n.ID)||(t.push(n),this._broadcastMessageIDMap.set(n.ID,1))):be.warn("".concat(this._className,"._onBroadcastMessage 未处理的 event 类型: ").concat(e[a].event));t.length>0&&this._groupModule.emitOuterEvent(C.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 o=new Cs({manager:this,groupID:e,onInit:this._updateRequestData.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});o.start(),this._pollingInstanceMap.set(e,o),be.log("".concat(this._className,".start groupID:").concat(e))}}},{key:"handleJoinResult",value:function(e){var t=this;return this._preCheck().then((function(){var o=e.longPollingKey,n=e.group,a=n.groupID;return t._joinedGroupMap.set(a,n),t._groupModule.updateGroupMap([n]),t._groupModule.deleteUnjoinedAVChatRoom(a),t._groupModule.emitGroupListUpdate(!0,!1),Ze(o)?Qa({status:Be,group:n}):Promise.resolve()}))}},{key:"startRunLoop",value:function(e){var t=this;return this.handleJoinResult(e).then((function(){var o=e.longPollingKey,n=e.group,a=e.startSeq,s=void 0===a?0:a,r=n.groupID;return t._pollingRequestInfoMap.set(r,{key:o,startSeq:s}),t.start(r),t._groupModule.isLoggedIn()?Qa({status:Be,group:n}):Qa({status:Be})}))}},{key:"_preCheck",value:function(){if(this._getModule(po).isUnlimitedAVChatRoom())return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();var e=m(this._joinedGroupMap.entries().next().value,2),t=e[0],o=e[1];if(this._groupModule.isLoggedIn()){if(!(o.selfInfo.role===D.GRP_MBR_ROLE_OWNER||o.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,o=e.groupID,n="".concat(this._className,".joinWithoutAuth"),a=new Ca(Da.JOIN_WITHOUT_AUTH);return this._groupModule.request({protocolName:cn,requestData:e}).then((function(e){var s=e.data.longPollingKey;if(t._groupModule.probeNetwork().then((function(e){var t=m(e,2),n=(t[0],t[1]);a.setNetworkType(n).setMessage("groupID:".concat(o," longPollingKey:").concat(s)).end(!0)})),Ze(s))return Za(new za({code:ua.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN,message:la.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN}));be.log("".concat(n," ok. groupID:").concat(o)),t._getModule(lo).setCompleted("".concat(D.CONV_GROUP).concat(o));var r=new fs({groupID:o});return t.startRunLoop({group:r,longPollingKey:s}),Ha({status:Be})})).catch((function(e){return be.error("".concat(n," failed. groupID:").concat(o," error:"),e),t._groupModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];a.setError(e,s,r).setMessage("groupID:".concat(o)).end(!0)})),Za(e)})).finally((function(){t._groupModule.getModule(_o).reportAtOnce()}))}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},o=Date.now();return Bt(t)||o-t.lastSyncTime>1e3*t.expireTime&&o-t.latestUpdateTime>1e4&&o-t.lastReqTime>3e3?(t.lastReqTime=o,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then((function(e){return Ha({memberCount:e.memberCount})})).catch((function(e){return Za(e)}))):Qa({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(e){var t=this,o="".concat(this._className,"._getGroupOnlineMemberCount");return this._groupModule.request({protocolName:Dn,requestData:{groupID:e}}).then((function(n){var a=t._onlineMemberCountMap.get(e)||{},s=n.data,r=s.onlineMemberNum,i=void 0===r?0:r,c=s.expireTime,u=void 0===c?t.DEFAULT_EXPIRE_TIME:c;be.log("".concat(o," 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(n){return be.warn("".concat(o," failed. error:"),n),new Ca(Da.GET_GROUP_ONLINE_MEMBER_COUNT).setCode(n.code).setMessage("groupID:".concat(e," error:").concat(JSON.stringify(n))).setNetworkType(t._groupModule.getNetworkType()).end(),Promise.reject(n)}))}},{key:"_onGroupAttributesUpdated",value:function(e){var t=e.groupID,o=e.elements,n=o.operationType,a=o.newGroupProfile;if(6===n){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){Ze(e)||($e(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:"setPollingIntervalPlus",value:function(e){Ze(e)||($e(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:"setPollingNoMessageCount",value:function(e){Ze(e)||($e(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){be.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{be.log("".concat(this._className,".reset all"));var o,n=S(this._pollingInstanceMap.values());try{for(n.s();!(o=n.n()).done;){o.value.stop()}}catch(a){n.e(a)}finally{n.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}(),As=1,Os=15,Rs=function(){function e(t){n(this,e),this._groupModule=t,this._className="GroupSystemNoticeHandler",this.pendencyMap=new Map}return s(e,[{key:"onNewGroupSystemNotice",value:function(e){var t=e.dataList,o=e.isSyncingEnded,n=e.isInstantMessage;be.debug("".concat(this._className,".onReceiveSystemNotice count:").concat(t.length));var a=this.newSystemNoticeStoredAndSummary({notifiesList:t,isInstantMessage:n}),s=a.eventDataList,r=a.result;s.length>0&&(this._groupModule.getModule(lo).onNewMessage({conversationOptionsList:s,isInstantMessage:n}),this._onReceivedGroupSystemNotice({result:r,isInstantMessage:n}));n?r.length>0&&this._groupModule.emitOuterEvent(C.MESSAGE_RECEIVED,r):!0===o&&this._clearGroupSystemNotice()}},{key:"newSystemNoticeStoredAndSummary",value:function(e){var o=e.notifiesList,n=e.isInstantMessage,a=null,s=o.length,r=0,i=[],c={conversationID:D.CONV_SYSTEM,unreadCount:0,type:D.CONV_SYSTEM,subType:null,lastMessage:null};for(r=0;r<s;r++){var u=o[r],l=u.groupProfile,d=l.communityType,p=void 0===d?0:d,g=l.topicID,_=void 0===g?void 0:g,h=u.elements,f=h.topicIDList,m=void 0===f?void 0:f,M=h.operationType;if(!(2!==p||Bt(_)&&Bt(m))){if([17,18,20].includes(M)){this._handleTopicSystemNotice(u);continue}Bt(_)||(u.to=_)}if(u.elements.operationType!==Os)u.currentUser=this._groupModule.getMyUserID(),u.conversationType=D.CONV_SYSTEM,u.conversationID=D.CONV_SYSTEM,(a=new Ba(u)).setElement({type:D.MSG_GRP_SYS_NOTICE,content:t(t({},u.elements),{},{groupProfile:t({},u.groupProfile)})}),a.isSystemMessage=!0,(1===a.sequence&&1===a.random||2===a.sequence&&2===a.random)&&(a.sequence=dt(),a.random=dt(),a.generateMessageID(),be.log("".concat(this._className,".newSystemNoticeStoredAndSummary sequence and random maybe duplicated, regenerate. ID:").concat(a.ID))),this._groupModule.getModule(lo).pushIntoNoticeResult(i,a)&&(n?c.unreadCount++:a.setIsRead(!0),c.subType=a.conversationSubType)}return c.lastMessage=i[i.length-1],{eventDataList:i.length>0?[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 o=e._groupModule.getModule(lo).getLocalMessageList(D.CONV_SYSTEM),n=[];o.forEach((function(t){var o=t.payload,a=o.operatorID,s=o.operationType,r=o.groupProfile;if(s===As){var i="".concat(a,"_").concat(r.groupID,"_").concat(r.to),c=e.pendencyMap.get(i);c&&$e(c.handled)&&0!==c.handled&&n.push(t)}})),e.deleteGroupSystemNotice({messageList:n})}))}},{key:"deleteGroupSystemNotice",value:function(e){var t=this,o="".concat(this._className,".deleteGroupSystemNotice");return Qe(e.messageList)&&0!==e.messageList.length?(be.log("".concat(o," ")+e.messageList.map((function(e){return e.ID}))),this._groupModule.request({protocolName:Tn,requestData:{messageListToDelete:e.messageList.map((function(e){return{from:D.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){be.log("".concat(o," ok"));var n=t._groupModule.getModule(lo);return e.messageList.forEach((function(e){n.deleteLocalMessage(e)})),Ha()})).catch((function(e){return be.error("".concat(o," error:"),e),Za(e)}))):Qa()}},{key:"getPendencyList",value:function(e){var t=this;return this._groupModule.request({protocolName:En,requestData:{startTime:e&&e.startTime?e.startTime:0,limit:e&&e.limit?e.limit:10,handleAccount:this._groupModule.getMyUserID()}}).then((function(e){var o=e.data.pendencyList;return 0!==e.data.nextStartTime?t.getPendencyList({startTime:e.data.nextStartTime}).then((function(e){return[].concat(M(o),M(e))})):o}))}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,o=e.result;e.isInstantMessage&&o.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,o=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(o)||this._groupModule.getGroupProfile({groupID:o}).then((function(e){var o=e.data.group;if(o){t._groupModule.updateGroupMap([o]);var n=!o.isSupportTopic;t._groupModule.emitGroupListUpdate(!0,n)}}))}},{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 o=this._groupModule._AVChatRoomHandler;o&&o.checkJoinedAVChatRoomByID(t)&&o.reset(t)}},{key:"_onInviteGroup",value:function(e){var t=this,o=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(o)||this._groupModule.getGroupProfile({groupID:o}).then((function(e){var o=e.data.group;o&&(t._groupModule.updateGroupMap([o]),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,o=t.to,n=t.groupID,a=this._groupModule.getModule(co).getLocalGroupMemberInfo(n,o);a&&a.updateRole(D.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(e){var t=e.payload.groupProfile,o=t.to,n=t.groupID,a=this._groupModule.getModule(co).getLocalGroupMemberInfo(n,o);a&&a.updateRole(D.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(e){var t=e.payload.groupProfile.groupID,o=e.payload.messageRemindType;this._groupModule.getModule(lo).onGroupMessageRemindTypeSynced({groupID:t,messageRemindType:o})}},{key:"_handleTopicSystemNotice",value:function(e){var t=e.groupProfile,o=t.groupID,n=t.topicID,a=e.elements,s=a.operationType,r=a.topicIDList,i=a.messageRemindType,c=this._groupModule.getModule(uo);17===s?c.onTopicCreated({groupID:o,topicID:n}):18===s?c.onTopicDeleted({groupID:o,topicIDList:r}):20===s&&c.onTopicMessageRemindTypeUpdated({groupID:o,topicID:n,messageRemindType:i})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),e}(),Ls=["relayFlag"],ks=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="GroupModule",t._commonGroupHandler=null,t._AVChatRoomHandler=null,t._groupSystemNoticeHandler=null,t._commonGroupHandler=new Es(_(t)),t._groupAttributesHandler=new Ss(_(t)),t._AVChatRoomHandler=new Ns(_(t)),t._groupTipsHandler=new ys(_(t)),t._groupSystemNoticeHandler=new Rs(_(t)),t.groupMap=new Map,t._unjoinedAVChatRoomList=new Map,t._receiptDetailCompleteMap=new Map,t.getInnerEmitterInstance().on(ns,t._onCloudConfigUpdated,_(t)),t}return s(a,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("polling_interval"),t=this.getCloudConfig("polling_interval_plus"),o=this.getCloudConfig("polling_no_msg_count");this._AVChatRoomHandler&&(be.log("".concat(this._className,"._onCloudConfigUpdated pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(t," pollingNoMessageCount:").concat(o)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(o))}},{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===D.CONV_GROUP){var o=Tt(e.to)?Ft(e.to):e.to;return this.hasLocalGroup(o)?Qa():this.getGroupProfile({groupID:o}).then((function(n){var a=n.data.group.type;if(be.log("".concat(t._className,".guardForAVChatRoom. groupID:").concat(o," type:").concat(a)),a===D.GRP_AVCHATROOM){var s="userId:".concat(e.from," 未加入群 groupID:").concat(o,"。发消息前先使用 joinGroup 接口申请加群,详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#joinGroup");return be.warn("".concat(t._className,".guardForAVChatRoom sendMessage not allowed. ").concat(s)),Za(new za({code:ua.MESSAGE_SEND_FAIL,message:s,data:{message:e}}))}return Qa()}))}return Qa()}},{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(Qe(e)){var o=this.getModule(uo);e.forEach((function(e){var n=e.conversationID.replace(D.CONV_GROUP,"");if(Tt(n)){var a=n,s=e.lastMessage.sequence+1;n=Ft(a);var r=o.getLocalTopic(n,a);r&&(r.updateNextMessageSeq(s),r.updateLastMessage(e.lastMessage))}t.groupMap.has(n)&&(t.groupMap.get(n).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 o=e.elements.groupMessageReadNotice;if(!Ze(o)){var n=t.getModule(lo);o.forEach((function(e){var o=e.groupID,a=e.topicID,s=void 0===a?void 0:a,r=e.lastMessageSeq;be.debug("".concat(t._className,".onGroupMessageReadNotice groupID:").concat(o," lastMessageSeq:").concat(r));var i="".concat(D.CONV_GROUP).concat(o),c=!0;Bt(s)||(i="".concat(D.CONV_GROUP).concat(s),c=!1),n.updateIsReadAfterReadReport({conversationID:i,lastMessageSeq:r}),n.updateUnreadCount(i,c),n.clearGroupAtInfoList(i,c)}))}}))}},{key:"onReadReceiptList",value:function(e){var t=this;be.debug("".concat(this._className,".onReadReceiptList options:"),JSON.stringify(e)),e.dataList.forEach((function(e){var o=e.groupProfile,n=e.elements,a=o.groupID,s=t.getModule(lo),r=n.readReceiptList;s.updateReadReceiptInfo({groupID:a,readReceiptList:r})}))}},{key:"onGroupMessageModified",value:function(e){be.debug("".concat(this._className,".onGroupMessageModified options:"),JSON.stringify(e));var o=this.getModule(lo);e.dataList.forEach((function(e){o.onMessageModified(t(t({},e),{},{conversationType:D.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 fs(e))}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var t,o=this,n=this.getModule(lo);e.forEach((function(e){t=e.groupID,o.groupMap.has(t)?o.groupMap.get(t).updateGroup(e):(o.groupMap.set(t,new fs(e)),n.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(go).getItem("groupMap")}},{key:"_setStorageGroupList",value:function(){var e=this.getLocalGroupList().filter((function(e){var t=e.type;return!yt(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(go).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],o=this.getLocalGroupList();if(e&&this.emitOuterEvent(C.GROUP_LIST_UPDATED),t){var n=JSON.parse(JSON.stringify(o)),a=this.getModule(lo);a.updateConversationGroupProfile(n)}}},{key:"patchGroupMessageRemindType",value:function(){var e=this.getLocalGroupList(),t=this.getModule(lo),o=0;e.forEach((function(e){!0===t.patchMessageRemindType({ID:e.groupID,isC2CConversation:!1,messageRemindType:e.selfInfo.messageRemindType})&&(o+=1)})),be.log("".concat(this._className,".patchGroupMessageRemindType count:").concat(o))}},{key:"recomputeUnreadCount",value:function(){var e=this.getLocalGroupList(),t=this.getModule(lo);e.forEach((function(e){var o=e.groupID,n=e.selfInfo,a=n.excludedUnreadSequenceList,s=n.readedSequence;if(Qe(a)){var r=0;a.forEach((function(t){t>=s&&t<=e.nextMessageSeq-1&&(r+=1)})),r>=1&&t.recomputeGroupUnreadCount({conversationID:"".concat(D.CONV_GROUP).concat(o),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):Qa()}},{key:"getGroupProfile",value:function(e){var t=this,o=new Ca(Da.GET_GROUP_PROFILE),n="".concat(this._className,".getGroupProfile"),a=e.groupID,s=e.groupCustomFieldFilter;be.log("".concat(n," 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(be.log("".concat(n," ok")),c.length>0)return Za(c[0]);(yt(i[0].type)&&!t.hasLocalGroup(a)?s=new fs(i[0]):(t.updateGroupMap(i),s=t.getLocalGroupProfile(a)),s.isSupportTopic)||t.getModule(lo).updateConversationGroupProfile([s]);return o.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(a," type:").concat(s.type," muteAllMembers:").concat(s.muteAllMembers," ownerID:").concat(s.ownerID)).end(),Ha({group:s})})).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("groupID:".concat(e.groupID)).end()})),be.error("".concat(n," failed. error:"),a),Za(a)}))}},{key:"getGroupProfileAdvance",value:function(e){var o=this,n="".concat(this._className,".getGroupProfileAdvance"),a=e.groupIDList;Qe(a)&&a.length>50&&(be.warn("".concat(n," 获取群资料的数量不能超过50个")),a.length=50);var s=[],r=[];a.forEach((function(e){Et({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=[],o=[];return e.forEach((function(e){t.push.apply(t,M(e.successGroupList)),o.push.apply(o,M(e.failureGroupList))})),Ha({successGroupList:t,failureGroupList:o})})).catch((function(e){return be.error("".concat(o._className,"._getGroupProfileAdvance failed. error:"),e),Za(e)}))}},{key:"_getGroupProfileAdvance",value:function(e){var t=this,o=e.relayFlag,n=void 0!==o&&o,a=g(e,Ls);return this.request({protocolName:on,requestData:a}).then((function(e){be.log("".concat(t._className,"._getGroupProfileAdvance ok."));var o=e.data.groups;return{successGroupList:o.filter((function(e){return Ze(e.errorCode)||0===e.errorCode})),failureGroupList:o.filter((function(e){return e.errorCode&&0!==e.errorCode})).map((function(e){return new za({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}))}})).catch((function(t){return n&&Et({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:Za(t)}))}},{key:"createGroup",value:function(e){var o=this,n="".concat(this._className,".createGroup"),a=e.type,s=e.groupID;if(!["Public","Private","ChatRoom","AVChatRoom","Community"].includes(a))return Za({code:ua.ILLEGAL_GROUP_TYPE,message:la.ILLEGAL_GROUP_TYPE});if(!Et({type:a})){if(!Bt(s)&&Et({groupID:s}))return Za({code:ua.ILLEGAL_GROUP_ID,message:la.ILLEGAL_GROUP_ID});e.isSupportTopic=void 0}if(yt(a)&&!Ze(e.memberList)&&e.memberList.length>0&&(be.warn("".concat(n," 创建 AVChatRoom 时不能添加群成员,自动忽略该字段")),e.memberList=void 0),It(a)||Ze(e.joinOption)||(be.warn("".concat(n," 创建 Work/Meeting/AVChatRoom/Community 群时不能设置字段 joinOption,自动忽略该字段")),e.joinOption=void 0),Et({type:a})){if(!Bt(s)&&!Et({groupID:s}))return Za({code:ua.ILLEGAL_GROUP_ID,message:la.ILLEGAL_GROUP_ID});e.isSupportTopic=!0===e.isSupportTopic?1:0}var r=new Ca(Da.CREATE_GROUP);be.log("".concat(n," options:"),e);var i=[];return this.request({protocolName:nn,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(o.getNetworkType()).setMessage("groupType:".concat(e.type," groupID:").concat(c," overLimitUserIDList=").concat(l)).end(),be.log("".concat(n," ok groupID:").concat(c," overLimitUserIDList:"),l),e.type===D.GRP_AVCHATROOM)return o.getGroupProfile({groupID:c});if(e.type===D.GRP_COMMUNITY&&1===e.isSupportTopic)return o.getGroupProfile({groupID:c});Bt(e.memberList)||Bt(l)||(e.memberList=e.memberList.filter((function(e){return-1===l.indexOf(e.userID)}))),o.updateGroupMap([t(t({},e),{},{groupID:c})]);var d=o.getModule(no),p=d.createCustomMessage({to:c,conversationType:D.CONV_GROUP,payload:{data:"group_create",extension:"".concat(o.getMyUserID(),"创建群组")}});return d.sendMessageInstance(p),o.emitGroupListUpdate(),o.getGroupProfile({groupID:c})})).then((function(e){var t=e.data.group,o=t.selfInfo,n=o.nameCard,a=o.joinTime;return t.updateSelfInfo({nameCard:n,joinTime:a,messageRemindType:D.MSG_REMIND_ACPT_AND_NOTE,role:D.GRP_MBR_ROLE_OWNER}),Ha({group:t,overLimitUserIDList:i})})).catch((function(t){return r.setMessage("groupType:".concat(e.type)),o.probeNetwork().then((function(e){var o=m(e,2),n=o[0],a=o[1];r.setError(t,n,a).end()})),be.error("".concat(n," failed. error:"),t),Za(t)}))}},{key:"dismissGroup",value:function(e){var t=this,o="".concat(this._className,".dismissGroup");if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===D.GRP_WORK)return Za(new za({code:ua.CANNOT_DISMISS_WORK,message:la.CANNOT_DISMISS_WORK}));var n=new Ca(Da.DISMISS_GROUP);return n.setMessage("groupID:".concat(e)),be.log("".concat(o," groupID:").concat(e)),this.request({protocolName:an,requestData:{groupID:e}}).then((function(){return n.setNetworkType(t.getNetworkType()).end(),be.log("".concat(o," ok")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),Ha({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"updateGroupProfile",value:function(e){var t=this,o="".concat(this._className,".updateGroupProfile");!this.hasLocalGroup(e.groupID)||It(this.getLocalGroupProfile(e.groupID).type)||Ze(e.joinOption)||(be.warn("".concat(o," Work/Meeting/AVChatRoom/Community 群不能设置字段 joinOption,自动忽略该字段")),e.joinOption=void 0),Ze(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off");var n=new Ca(Da.UPDATE_GROUP_PROFILE);return n.setMessage(JSON.stringify(e)),be.log("".concat(o," groupID:").concat(e.groupID)),this.request({protocolName:sn,requestData:e}).then((function(){(n.setNetworkType(t.getNetworkType()).end(),be.log("".concat(o," ok")),t.hasLocalGroup(e.groupID))&&(t.groupMap.get(e.groupID).updateGroup(e),t._setStorageGroupList());return Ha({group:t.groupMap.get(e.groupID)})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),be.log("".concat(o," failed. error:"),e),Za(e)}))}},{key:"joinGroup",value:function(e){var t=this,o=e.groupID,n=e.type,a="".concat(this._className,".joinGroup");if(n===D.GRP_WORK){var s=new za({code:ua.CANNOT_JOIN_WORK,message:la.CANNOT_JOIN_WORK});return Za(s)}if(this.deleteUnjoinedAVChatRoom(o),this.hasLocalGroup(o)){if(!this.isLoggedIn())return Qa({status:D.JOIN_STATUS_ALREADY_IN_GROUP});var r=new Ca(Da.APPLY_JOIN_GROUP);return this.getGroupProfile({groupID:o}).then((function(){return r.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(o," joinedStatus:").concat(D.JOIN_STATUS_ALREADY_IN_GROUP)).end(),Qa({status:D.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(n){return r.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(o," unjoined")).end(),be.warn("".concat(a," ").concat(o," was unjoined, now join!")),t.groupMap.delete(o),t.applyJoinGroup(e)}))}return be.log("".concat(a," groupID:").concat(o)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e)}},{key:"applyJoinGroup",value:function(e){var o=this,n="".concat(this._className,".applyJoinGroup"),a=e.groupID,s=new Ca(Da.APPLY_JOIN_GROUP),r=t({},e),i=this.getModule(No).canIUse(H.AVCHATROOM_HISTORY_MSG);return i&&(r.historyMessageFlag=1),this.getModule(lo).deleteTopicRoamingMessageInfo(a),this.request({protocolName:rn,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,g="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(o.getNetworkType()).setMessage("".concat(g)).end(),be.log("".concat(n," ok. ").concat(g)),r){case He:return Ha({status:He});case Be:return o.getGroupProfile({groupID:a}).then((function(e){var t,n=e.data.group,s={status:Be,group:n};return 1===l?(o.getModule(lo).setCompleted("".concat(D.CONV_GROUP).concat(a)),o._groupAttributesHandler.initGroupAttributesCache({groupID:a,avChatRoomKey:d}),(t=Ze(c)?o._AVChatRoomHandler.handleJoinResult({group:n}):o._AVChatRoomHandler.startRunLoop({longPollingKey:c,group:n,startSeq:u})).then((function(){o._onAVChatRoomHistoryMessage(p)})),t):(o.emitGroupListUpdate(!0,!1),Ha(s))}));default:var _=new za({code:ua.JOIN_GROUP_FAIL,message:la.JOIN_GROUP_FAIL});return be.error("".concat(n," error:"),_),Za(_)}})).catch((function(t){return s.setMessage("groupID:".concat(e.groupID)),o.probeNetwork().then((function(e){var o=m(e,2),n=o[0],a=o[1];s.setError(t,n,a).end()})),be.error("".concat(n," error:"),t),Za(t)}))}},{key:"quitGroup",value:function(e){var t=this,o="".concat(this._className,".quitGroup");be.log("".concat(o," groupID:").concat(e));var n=this.checkJoinedAVChatRoomByID(e);if(!n&&!this.hasLocalGroup(e)){var a=new za({code:ua.MEMBER_NOT_IN_GROUP,message:la.MEMBER_NOT_IN_GROUP});return Za(a)}if(n&&!this.isLoggedIn())return be.log("".concat(o," anonymously ok. groupID:").concat(e)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),Qa({groupID:e});var s=new Ca(Da.QUIT_GROUP);return s.setMessage("groupID:".concat(e)),this.request({protocolName:un,requestData:{groupID:e}}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),be.log("".concat(o," ok")),t.deleteLocalGroupAndConversation(e),n&&t._AVChatRoomHandler.reset(e),Ha({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"searchGroupByID",value:function(e){var t=this,o="".concat(this._className,".searchGroupByID"),n={groupIDList:[e]},a=new Ca(Da.SEARCH_GROUP_BY_ID);return a.setMessage("groupID:".concat(e)),be.log("".concat(o," groupID:").concat(e)),this.request({protocolName:ln,requestData:n}).then((function(e){var n=e.data.groupProfile;if(0!==n[0].errorCode)throw new za({code:n[0].errorCode,message:n[0].errorInfo});return a.setNetworkType(t.getNetworkType()).end(),be.log("".concat(o," ok")),Ha({group:new fs(n[0])})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),be.warn("".concat(o," failed. error:"),e),Za(e)}))}},{key:"changeGroupOwner",value:function(e){var t=this,o="".concat(this._className,".changeGroupOwner");if(this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===D.GRP_AVCHATROOM)return Za(new za({code:ua.CANNOT_CHANGE_OWNER_IN_AVCHATROOM,message:la.CANNOT_CHANGE_OWNER_IN_AVCHATROOM}));if(e.newOwnerID===this.getMyUserID())return Za(new za({code:ua.CANNOT_CHANGE_OWNER_TO_SELF,message:la.CANNOT_CHANGE_OWNER_TO_SELF}));var n=new Ca(Da.CHANGE_GROUP_OWNER);return n.setMessage("groupID:".concat(e.groupID," newOwnerID:").concat(e.newOwnerID)),be.log("".concat(o," groupID:").concat(e.groupID)),this.request({protocolName:dn,requestData:e}).then((function(){n.setNetworkType(t.getNetworkType()).end(),be.log("".concat(o," ok"));var a=e.groupID,s=e.newOwnerID;t.groupMap.get(a).ownerID=s;var r=t.getModule(co).getLocalGroupMemberList(a);if(r instanceof Map){var i=r.get(t.getMyUserID());Ze(i)||(i.updateRole("Member"),t.groupMap.get(a).selfInfo.role="Member");var c=r.get(s);Ze(c)||c.updateRole("Owner")}return t.emitGroupListUpdate(!0,!1),Ha({group:t.groupMap.get(a)})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"handleGroupApplication",value:function(e){var o=this,n="".concat(this._className,".handleGroupApplication"),a=e.message.payload,s=a.groupProfile.groupID,r=a.authentication,i=a.messageKey,c=a.operatorID,u=new Ca(Da.HANDLE_GROUP_APPLICATION);return u.setMessage("groupID:".concat(s)),be.log("".concat(n," groupID:").concat(s)),this.request({protocolName:pn,requestData:t(t({},e),{},{applicant:c,groupID:s,authentication:r,messageKey:i})}).then((function(){return u.setNetworkType(o.getNetworkType()).end(),be.log("".concat(n," ok")),o._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Ha({group:o.getLocalGroupProfile(s)})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];u.setError(e,n,a).end()})),be.error("".concat(n," failed. error"),e),Za(e)}))}},{key:"handleGroupInvitation",value:function(e){var o=this,n="".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 Ca(Da.HANDLE_GROUP_INVITATION);return l.setMessage("groupID:".concat(s," inviter:").concat(c," handleAction:").concat(u)),be.log("".concat(n," groupID:").concat(s," inviter:").concat(c," handleAction:").concat(u)),this.request({protocolName:gn,requestData:t(t({},e),{},{inviter:c,groupID:s,authentication:r,messageKey:i})}).then((function(){return l.setNetworkType(o.getNetworkType()).end(),be.log("".concat(n," ok")),o._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Ha({group:o.getLocalGroupProfile(s)})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setError(e,n,a).end()})),be.error("".concat(n," failed. error"),e),Za(e)}))}},{key:"getGroupOnlineMemberCount",value:function(e){return this._AVChatRoomHandler?this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)?this._AVChatRoomHandler.getGroupOnlineMemberCount(e):Qa({memberCount:0}):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var t=this.checkJoinedAVChatRoomByID(e);(be.log("".concat(this._className,".deleteLocalGroupAndConversation isJoinedAVChatRoom:").concat(t)),t)&&this.getModule(lo).deleteLocalConversation("".concat(D.CONV_GROUP).concat(e));if(Et({groupID:e})){var o=this.getLocalGroupProfile(e);if(o&&!0===o.isSupportTopic)this.getModule(uo).deleteTopicListInCommunity(e)}this._deleteLocalGroup(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this.getModule(co).deleteGroupMemberList(e),this._setStorageGroupList()}},{key:"sendMessage",value:function(e,t){var o=this.createGroupMessagePack(e,t);return this.request(o)}},{key:"createGroupMessagePack",value:function(e,t){var o=null;t&&t.offlinePushInfo&&(o=t.offlinePushInfo);var n="";ze(e.cloudCustomData)&&e.cloudCustomData.length>0&&(n=e.cloudCustomData);var a=[];if(Xe(t)&&Xe(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:n,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==D.MSG_TEXT||Bt(c)?void 0:c,onlineOnlyFlag:this.isOnlineMessage(e,t)?1:0,clientTime:e.clientTime,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,messageControlInfo:a,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1};return Tt(e.to)&&(u.groupID=Ft(e.to),u.topicID=e.to),{protocolName:bo,tjgID:this.generateTjgID(e),requestData:u}}},{key:"revokeMessage",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return Tt(e.to)&&(t.groupID=Ft(e.to),t.topicID=e.to),this.request({protocolName:_n,requestData:t})}},{key:"deleteMessage",value:function(e){var t=e.to,o=e.keyList;be.log("".concat(this._className,".deleteMessage groupID:").concat(t," count:").concat(o.length));var n={groupID:t,deleter:this.getMyUserID(),keyList:o};return Tt(t)&&(n.groupID=Ft(t),n.topicID=t),this.request({protocolName:Nn,requestData:n})}},{key:"modifyRemoteMessage",value:function(e){var t=e.to,o=e.sequence,n=e.payload,a=e.type,s=e.version,r=void 0===s?0:s,i=e.cloudCustomData,c=t,u=void 0;Tt(t)&&(c=Ft(t),u=t);var l=void 0;return Vt(a)&&(l=[]).push({type:a,content:n}),this.request({protocolName:An,requestData:{groupID:c,topicID:u,sequence:o,version:r,elements:l,cloudCustomData:i}})}},{key:"getRoamingMessage",value:function(e){var t=this,o="".concat(this._className,".getRoamingMessage"),n=e.conversationID,a=e.groupID,s=e.sequence,r=new Ca(Da.GET_GROUP_ROAMING_MESSAGES),i=0,c=void 0;return Tt(a)&&(a=Ft(c=a)),this._computeLastSequence({groupID:a,topicID:c,sequence:s}).then((function(e){return i=e,be.log("".concat(o," groupID:").concat(a," startSequence:").concat(i)),t.request({protocolName:mn,requestData:{groupID:a,count:21,sequence:i,topicID:c}})})).then((function(e){var s=e.data,u=s.messageList,l=s.complete;Ze(u)?be.log("".concat(o," ok. complete:").concat(l," but messageList is undefined!")):be.log("".concat(o," 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(lo);if(2===l||Bt(u))return d.setCompleted(n),{nextReqID:"",storedMessageList:[]};var p=u[u.length-1].sequence-1;d.updateRoamingMessageSequence(n,p);var g=d.onRoamingMessage(u,n);return d.updateIsRead(n),d.patchConversationLastMessage(n),be.log("".concat(o," nextReqID:").concat(p," stored message count:").concat(g.length)),{nextReqID:p+"",storedMessageList:g}})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];r.setError(e,n,s).setMessage("groupID:".concat(a," topicID:").concat(c," startSequence:").concat(i)).end()})),be.warn("".concat(o," failed. error:"),e),Za(e)}))}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(D.CONV_GROUP,"")}},{key:"getReadReceiptList",value:function(e){var t=this,o="".concat(this._className,".getReadReceiptList"),n=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(be.log("".concat(o," groupID:").concat(n," sequenceList:").concat(JSON.stringify(s))),0===s.length)return Qa({messageList:e});var r=new Ca(Da.GET_READ_RECEIPT);return r.setMessage("groupID:".concat(n)),this.request({protocolName:Mn,requestData:{groupID:n,sequenceList:s}}).then((function(t){r.end(),be.log("".concat(o," ok"));var n=t.data.readReceiptList;return Qe(n)&&n.forEach((function(t){e.forEach((function(e){0===t.code&&t.sequence===e.sequence&&(e.readReceiptInfo.readCount=t.readCount,e.readReceiptInfo.unreadCount=t.unreadCount)}))})),Ha({messageList:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),be.warn("".concat(o," failed. error:"),e),Za(e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,o=this._getGroupIDOfMessage(e[0]),n=new Ca(Da.SEND_READ_RECEIPT);n.setMessage("groupID:".concat(o));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 Za({code:ua.READ_RECEIPT_MESSAGE_LIST_EMPTY,message:la.READ_RECEIPT_MESSAGE_LIST_EMPTY});var r="".concat(this._className,".sendReadReceipt");return be.log("".concat(r,". sequenceList:").concat(JSON.stringify(s))),this.request({protocolName:vn,requestData:{groupID:o,sequenceList:s}}).then((function(e){return n.end(),be.log("".concat(r," ok")),Ha()})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),be.warn("".concat(r," failed. error:"),e),Za(e)}))}},{key:"getReadReceiptDetail",value:function(e){var t=this,o=e.message,n=e.filter,a=e.cursor,s=e.count,r=this._getGroupIDOfMessage(o),i=o.ID,c=o.sequence,u="".concat(this._className,".getReadReceiptDetail"),l=this._receiptDetailCompleteMap.get(i)||!1,d=0!==n&&1!==n?0:n,p=ze(a)?a:"",g=!$e(s)||s<=0||s>=100?100:s,_="groupID:".concat(r," sequence:").concat(c," cursor:").concat(p," filter:").concat(d," completeFlag:").concat(l);be.log("".concat(u," ").concat(_));var h={cursor:"",isCompleted:!1,messageID:i,unreadUserIDList:[],readUserIDList:[]},f=new Ca(Da.GET_READ_RECEIPT_DETAIL);return f.setMessage(_),this.request({protocolName:yn,requestData:{groupID:r,sequence:c,flag:d,cursor:p,count:g}}).then((function(e){f.end();var o=e.data,n=o.cursor,a=o.isCompleted,s=o.unreadUserIDList,r=o.readUserIDList;return h.cursor=n,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}))),be.log("".concat(u," ok")),Ha(h)})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];f.setError(e,n,a).end()})),be.warn("".concat(u," failed. error:"),e),Za(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,o="".concat(this._className,".getRoamingMessagesHopping"),n=new Ca(Da.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;Tt(a)&&(a=Ft(u=a));var l="".concat(u?"topicID:".concat(u):"groupID:".concat(a)," sequence:").concat(r," direction:").concat(i);return be.log("".concat(o," ").concat(l)),this.request({protocolName:mn,requestData:{groupID:a,topicID:u,count:s,sequence:c}}).then((function(a){var s=a.data,c=s.messageList,d=s.complete;if(be.log("".concat(o," ok. complete:").concat(d," count:").concat(c?c.length:0)),n.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 Ha(p)}var g="".concat(D.CONV_GROUP).concat(e.groupID),_=t.getModule(lo).onRoamingMessage(c,g,!1),h=t._computeResult({direction:i,sequence:r,topicID:u,messageList:c,resultList:_});return Ha(h)})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),i=o[0],c=o[1];n.setError(e,i,c).setMessage("groupID:".concat(a," sequence:").concat(r," count:").concat(s)).end()})),be.warn("".concat(o," failed. error:"),e),Za(e)}))}},{key:"_computeResult",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:""};if(Ze(e))return t.isCompleted=!0,t;var o=e.direction,n=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===o){if(t.nextMessageSeq=r[0].sequence+1,!Ze(a)){var l=c.findIndex((function(e){return e.sequence===n}));return-1===l?(c[c.length-1].sequence<n?(t.isCompleted=!0,t.nextMessageSeq=""):t.messageList=M(c),t):(t.messageList=c.slice(l),t)}return t.messageList=M(c),t}return t.nextMessageSeq=r[u-1].sequence-1,t.messageList=M(c),0===t.nextMessageSeq&&(t.isCompleted=!0,t.nextMessageSeq=""),t}},{key:"setMessageRead",value:function(e){var t=this,o=e.conversationID,n=e.lastMessageSeq,a="".concat(this._className,".setMessageRead");be.log("".concat(a," conversationID:").concat(o," lastMessageSeq:").concat(n)),$e(n)||be.warn("".concat(a," 请勿修改 Conversation.lastMessage.lastSequence,否则可能会导致已读上报结果不准确"));var s=new Ca(Da.SET_GROUP_MESSAGE_READ);s.setMessage("".concat(o,"-").concat(n));var r=o.replace(D.CONV_GROUP,""),i=void 0;return Tt(r)&&(r=Ft(i=r)),this.request({protocolName:hn,requestData:{groupID:r,topicID:i,messageReadSeq:n}}).then((function(){s.setNetworkType(t.getNetworkType()).end(),be.log("".concat(a," ok."));var e=t.getModule(lo);e.updateIsReadAfterReadReport({conversationID:o,lastMessageSeq:n});var c=!0;if(!Ze(i)){c=!1;var u=t.getModule(uo).getLocalTopic(r,i);u&&u.updateSelfInfo({readedSequence:n})}return e.updateUnreadCount(o,c),Ha()})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),be.log("".concat(a," failed. error:"),e),Za(e)}))}},{key:"_computeLastSequence",value:function(e){var t=e.groupID,o=e.topicID,n=void 0===o?void 0:o,a=e.sequence;return a>0?Promise.resolve(a):Ze(n)||this.hasLocalGroup(t)?Ze(n)?this.getGroupLastSequence(t):this.getTopicLastSequence({groupID:t,topicID:n}):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var t=this,o="".concat(this._className,".getGroupLastSequence"),n=new Ca(Da.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),be.log("".concat(o," ").concat(s)),n.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),be.log("".concat(o," ").concat(s)),n.setNetworkType(this.getNetworkType()).setMessage("".concat(s)).end(),Promise.resolve(a)}var c="GROUP".concat(e),u=this.getModule(lo).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),be.log("".concat(o," ").concat(s)),n.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)?be.log("".concat(o," successGroupList is empty. groupID:").concat(e)):(a=i[0].nextMessageSeq-1,s="got lastSequence:".concat(a," from getGroupProfileAdvance. groupID:").concat(e),be.log("".concat(o," ").concat(s))),n.setNetworkType(t.getNetworkType()).setMessage("".concat(s)).end(),a})).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("get lastSequence failed from getGroupProfileAdvance. groupID:".concat(e)).end()})),be.warn("".concat(o," failed. error:"),a),Za(a)}))}},{key:"getTopicLastSequence",value:function(e){var t=this,o=e.groupID,n=e.topicID,a="".concat(this._className,".getTopicLastSequence"),s=new Ca(Da.GET_TOPIC_LAST_SEQUENCE),r=0,i="",c=this.getModule(uo);return c.hasLocalTopic(o,n)?(r=c.getLocalTopic(o,n).nextMessageSeq-1,i="get lastSequence:".concat(r," from local topic info[nextMessageSeq]. topicID:").concat(n),be.log("".concat(a," ").concat(i)),s.setNetworkType(this.getNetworkType()).setMessage("".concat(i)).end(),Promise.resolve(r)):c.getTopicList({groupID:o,topicIDList:[n]}).then((function(e){var o=e.data.successTopicList;return Bt(o)?be.log("".concat(a," successTopicList is empty. topicID:").concat(n)):(r=o[0].nextMessageSeq-1,i="get lastSequence:".concat(r," from getTopicList. topicID:").concat(n),be.log("".concat(a," ").concat(i))),s.setNetworkType(t.getNetworkType()).setMessage("".concat(i)).end(),r})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],r=o[1];s.setError(e,a,r).setMessage("get lastSequence failed from getTopicList. topicID:".concat(n)).end()})),be.warn("".concat(a," failed. error:"),e),Za(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!==D.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e){if(!Bt(e)){be.log("".concat(this._className,"._onAVChatRoomHistoryMessage count:").concat(e.length));var o=[];e.forEach((function(e){o.push(t(t({},e),{},{isHistoryMessage:1}))})),this.onAVChatRoomMessage(o)}}},{key:"onAVChatRoomMessage",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onMessage(e)}},{key:"getGroupSimplifiedInfo",value:function(e){var t=this,o=new Ca(Da.GET_GROUP_SIMPLIFIED_INFO),n={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["Type","Name"]}};return this.getGroupProfileAdvance(n).then((function(n){var a=n.data.successGroupList;return o.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(e," type:").concat(a[0].type)).end(),a[0]})).catch((function(n){t.probeNetwork().then((function(t){var a=m(t,2),s=a[0],r=a[1];o.setError(n,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}(Ao),Gs=function(){function e(t){n(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&&vt(this.memberCustomField,e.memberCustomField),ct(this,e,["memberCustomField"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){Ze(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){Ze(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&vt(this.memberCustomField,e)}}]),e}(),Ps=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="GroupMemberModule",t.groupMemberListMap=new Map,t.getInnerEmitterInstance().on(as,t._onProfileUpdated,_(t)),t}return s(a,[{key:"_onProfileUpdated",value:function(e){for(var t=this,o=e.data,n=function(e){var n=o[e];t.groupMemberListMap.forEach((function(e){e.has(n.userID)&&e.get(n.userID).updateMember({nick:n.nick,avatar:n.avatar})}))},a=0;a<o.length;a++)n(a)}},{key:"deleteGroupMemberList",value:function(e){this.groupMemberListMap.delete(e)}},{key:"getGroupMemberList",value:function(e){var t=this,o=e.groupID,n=e.offset,a=void 0===n?0:n,s=e.count,r=void 0===s?15:s,i="".concat(this._className,".getGroupMemberList"),c=this.getModule(ro).hasLocalGroup(o);if(be.log("".concat(i," groupID:").concat(o," offset:").concat(a," count:").concat(r," hasLocalGroup:").concat(c)),!c)return Qa({memberList:[],offset:0});var u=new Ca(Da.GET_GROUP_MEMBER_LIST),l=0,d={groupID:o,limit:r>100?100:r};Et({groupID:o})?d.next="".concat(a):(d.offset=a,l=a+1);var p=[];return this.request({protocolName:Pn,requestData:d}).then((function(e){var n=e.data,a=n.members,s=n.memberNum,r=n.next,i=void 0===r?void 0:r;if(Ze(i)||(l=Bt(i)?0:i),!Qe(a)||0===a.length)return l=0,Promise.resolve([]);var c=t.getModule(ro);return c.hasLocalGroup(o)&&(c.getLocalGroupProfile(o).memberNum=s),p=t._updateLocalGroupMemberMap(o,a),t.getModule(ao).getUserProfile({userIDList:a.map((function(e){return e.userID})),tagList:[Fe.NICK,Fe.AVATAR]})})).then((function(e){var n=e.data;if(!Qe(n)||0===n.length)return Qa({memberList:[],offset:l});var a=n.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));return t._updateLocalGroupMemberMap(o,a),u.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(o," offset:").concat(l," count:").concat(r)).end(),be.log("".concat(i," ok.")),Ha({memberList:p,offset:l})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];u.setError(e,n,a).end()})),be.error("".concat(i," failed. error:"),e),Za(e)}))}},{key:"getGroupMemberProfile",value:function(e){var o=this,n="".concat(this._className,".getGroupMemberProfile"),a=new Ca(Da.GET_GROUP_MEMBER_PROFILE);a.setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)),be.log("".concat(n," 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 Qe(t)&&0!==t.length?(o._updateLocalGroupMemberMap(s,t),o.getModule(ao).getUserProfile({userIDList:t.map((function(e){return e.userID})),tagList:[Fe.NICK,Fe.AVATAR]})):Qa([])})).then((function(e){var t=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));o._updateLocalGroupMemberMap(s,t);var n=r.filter((function(e){return o.hasLocalGroupMember(s,e)})).map((function(e){return o.getLocalGroupMemberInfo(s,e)}));return a.setNetworkType(o.getNetworkType()).end(),Ha({memberList:n})}))}},{key:"addGroupMember",value:function(e){var t=this,o="".concat(this._className,".addGroupMember"),n=e.groupID,a=this.getModule(ro).getLocalGroupProfile(n),s=a.type,r=new Ca(Da.ADD_GROUP_MEMBER);if(r.setMessage("groupID:".concat(n," groupType:").concat(s)),yt(s)){var i=new za({code:ua.CANNOT_ADD_MEMBER_IN_AVCHATROOM,message:la.CANNOT_ADD_MEMBER_IN_AVCHATROOM});return r.setCode(ua.CANNOT_ADD_MEMBER_IN_AVCHATROOM).setError(la.CANNOT_ADD_MEMBER_IN_AVCHATROOM).setNetworkType(this.getNetworkType()).end(),Za(i)}return e.userIDList=e.userIDList.map((function(e){return{userID:e}})),be.log("".concat(o," groupID:").concat(n)),this.request({protocolName:bn,requestData:e}).then((function(n){var s=n.data.members;be.log("".concat(o," 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?Ha({successUserIDList:i,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l}):(a.memberCount+=i.length,t._updateConversationGroupProfile(a),Ha({successUserIDList:i,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l,group:a}))})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"deleteGroupMember",value:function(e){var t=this,o="".concat(this._className,".deleteGroupMember"),n=e.groupID,a=e.userIDList,s=new Ca(Da.DELETE_GROUP_MEMBER),r="groupID:".concat(n," ").concat(a.length>5?"userIDList.length:".concat(a.length):"userIDList:".concat(a));s.setMessage(r),be.log("".concat(o," groupID:").concat(n," userIDList:"),a);var i=this.getModule(ro).getLocalGroupProfile(n);return yt(i.type)?Za(new za({code:ua.CANNOT_KICK_MEMBER_IN_AVCHATROOM,message:la.CANNOT_KICK_MEMBER_IN_AVCHATROOM})):this.request({protocolName:wn,requestData:e}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),be.log("".concat(o," ok")),i.memberCount-=1,t._updateConversationGroupProfile(i),t.deleteLocalGroupMembers(n,a),Ha({group:i,userIDList:a})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"_updateConversationGroupProfile",value:function(e){this.getModule(lo).updateConversationGroupProfile([e])}},{key:"setGroupMemberMuteTime",value:function(e){var t=this,o=e.groupID,n=e.userID,a=e.muteTime,s="".concat(this._className,".setGroupMemberMuteTime");if(n===this.getMyUserID())return Za(new za({code:ua.CANNOT_MUTE_SELF,message:la.CANNOT_MUTE_SELF}));be.log("".concat(s," groupID:").concat(o," userID:").concat(n));var r=new Ca(Da.SET_GROUP_MEMBER_MUTE_TIME);return r.setMessage("groupID:".concat(o," userID:").concat(n," muteTime:").concat(a)),this.modifyGroupMemberInfo({groupID:o,userID:n,muteTime:a}).then((function(e){r.setNetworkType(t.getNetworkType()).end(),be.log("".concat(s," ok"));var n=t.getModule(ro);return Ha({group:n.getLocalGroupProfile(o),member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),be.error("".concat(s," failed. error:"),e),Za(e)}))}},{key:"setGroupMemberRole",value:function(e){var t=this,o="".concat(this._className,".setGroupMemberRole"),n=e.groupID,a=e.userID,s=e.role,r=this.getModule(ro).getLocalGroupProfile(n);if(r.selfInfo.role!==D.GRP_MBR_ROLE_OWNER)return Za({code:ua.NOT_OWNER,message:la.NOT_OWNER});if([D.GRP_WORK,D.GRP_AVCHATROOM].includes(r.type))return Za({code:ua.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM,message:la.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM});var i=[D.GRP_MBR_ROLE_ADMIN,D.GRP_MBR_ROLE_MEMBER];if(Et({groupID:n})&&i.push(D.GRP_MBR_ROLE_CUSTOM),i.indexOf(s)<0)return Za({code:ua.INVALID_MEMBER_ROLE,message:la.INVALID_MEMBER_ROLE});if(a===this.getMyUserID())return Za({code:ua.CANNOT_SET_SELF_MEMBER_ROLE,message:la.CANNOT_SET_SELF_MEMBER_ROLE});var c=new Ca(Da.SET_GROUP_MEMBER_ROLE);return c.setMessage("groupID:".concat(n," userID:").concat(a," role:").concat(s)),be.log("".concat(o," groupID:").concat(n," userID:").concat(a)),this.modifyGroupMemberInfo({groupID:n,userID:a,role:s}).then((function(e){return c.setNetworkType(t.getNetworkType()).end(),be.log("".concat(o," ok")),Ha({group:r,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"setGroupMemberNameCard",value:function(e){var t=this,o="".concat(this._className,".setGroupMemberNameCard"),n=e.groupID,a=e.userID,s=void 0===a?this.getMyUserID():a,r=e.nameCard;be.log("".concat(o," groupID:").concat(n," userID:").concat(s));var i=new Ca(Da.SET_GROUP_MEMBER_NAME_CARD);return i.setMessage("groupID:".concat(n," userID:").concat(s," nameCard:").concat(r)),this.modifyGroupMemberInfo({groupID:n,userID:s,nameCard:r}).then((function(e){be.log("".concat(o," ok")),i.setNetworkType(t.getNetworkType()).end();var a=t.getModule(ro).getLocalGroupProfile(n);return s===t.getMyUserID()&&a&&a.setSelfNameCard(r),Ha({group:a,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];i.setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"setGroupMemberCustomField",value:function(e){var t=this,o="".concat(this._className,".setGroupMemberCustomField"),n=e.groupID,a=e.userID,s=void 0===a?this.getMyUserID():a,r=e.memberCustomField;be.log("".concat(o," groupID:").concat(n," userID:").concat(s));var i=new Ca(Da.SET_GROUP_MEMBER_CUSTOM_FIELD);return i.setMessage("groupID:".concat(n," userID:").concat(s," memberCustomField:").concat(JSON.stringify(r))),this.modifyGroupMemberInfo({groupID:n,userID:s,memberCustomField:r}).then((function(e){i.setNetworkType(t.getNetworkType()).end(),be.log("".concat(o," ok"));var a=t.getModule(ro).getLocalGroupProfile(n);return Ha({group:a,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];i.setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"modifyGroupMemberInfo",value:function(e){var o=this,n=e.groupID,a=e.userID,s=void 0;return Tt(n)&&(n=Ft(s=n)),this.request({protocolName:Fn,requestData:t(t({},e),{},{groupID:n,topicID:s})}).then((function(){if(o.hasLocalGroupMember(n,a)){var t=o.getLocalGroupMemberInfo(n,a);return Ze(e.muteTime)||t.updateMuteUntil(e.muteTime),Ze(e.role)||t.updateRole(e.role),Ze(e.nameCard)||t.updateNameCard(e.nameCard),Ze(e.memberCustomField)||t.updateMemberCustomField(e.memberCustomField),t}return o.getGroupMemberProfile({groupID:n,userIDList:[a]}).then((function(e){return m(e.data.memberList,1)[0]}))}))}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this.request({protocolName:Un,requestData:t(t({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:["Role","JoinTime","NameCard","ShutUpUntil"]})})}},{key:"_updateLocalGroupMemberMap",value:function(e,t){var o=this;return Qe(t)&&0!==t.length?t.map((function(t){return o.hasLocalGroupMember(e,t.userID)?o.getLocalGroupMemberInfo(e,t.userID).updateMember(t):o.setLocalGroupMember(e,new Gs(t)),o.getLocalGroupMemberInfo(e,t.userID)})):[]}},{key:"deleteLocalGroupMembers",value:function(e,t){var o=this.groupMemberListMap.get(e);o&&t.forEach((function(e){o.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 o=(new Map).set(t.userID,t);this.groupMemberListMap.set(e,o)}}},{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}(Ao),Us=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],bs=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:qt(e.type,e.payload),nick:e.nick||"",version:e.version||0,cloudCustomData:e.cloudCustomData||""}},ws=function(){function e(t){n(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=bs(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)Us.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=bs(e)}},{key:"updateGroupAtInfoList",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:"updateTopic",value:function(e){Ze(e.selfInfo)||this.updateSelfInfo(e.selfInfo),Ze(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),ct(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers"])}},{key:"updateSelfInfo",value:function(e){return 0!==ct(this.selfInfo,e,[],[""])}}]),e}(),Fs=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.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(ns,t._onCloudConfigUpdated,_(t)),t}return s(a,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");Ze(e)||(this.TOPIC_CACHE_TIME=Number(e)),Ze(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:"onTopicCreated",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOuterEvent(C.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var t=this,o=e.groupID,n=e.topicIDList;(void 0===n?[]:n).forEach((function(e){t._deleteLocalTopic(o,e)})),this.emitOuterEvent(C.TOPIC_DELETED,e)}},{key:"onTopicMessageRemindTypeUpdated",value:function(e){var t=e.groupID,o=e.topicID,n=e.messageRemindType,a=this.getLocalTopic(t,o);if(a){var s=a.updateSelfInfo({messageRemindType:n});s&&this.emitOuterEvent(C.TOPIC_UPDATED,{groupID:t,topic:a}),be.debug("".concat(this._className,".onTopicMessageRemindTypeUpdated topicID:").concat(o)+" messageRemindType:".concat(n," isTopicUpdated:").concat(s))}}},{key:"onTopicProfileUpdated",value:function(e){var t=e.groupID,o=e.topicID,n=this.getLocalTopic(t,o);n&&(n.updateTopic(e),this.emitOuterEvent(C.TOPIC_UPDATED,{groupID:t,topic:n}))}},{key:"onConversationProxy",value:function(e){var t=e.topicID,o=e.unreadCount,n=e.groupAtInfoList,a=Ft(t),s=this.getLocalTopic(a,t),r=!1;s&&(Ze(o)||s.unreadCount===o||(s.updateUnreadCount(o),r=!0),Ze(n)||(s.updateGroupAtInfoList(n),r=!0)),r&&this.emitOuterEvent(C.TOPIC_UPDATED,{groupID:a,topic:s})}},{key:"onMessageSent",value:function(e){var t=e.groupID,o=e.topicID,n=e.lastMessage,a=this.getLocalTopic(t,o);a&&(a.nextMessageSeq+=1,a.updateLastMessage(n),this.emitOuterEvent(C.TOPIC_UPDATED,{groupID:t,topic:a}))}},{key:"onMessageModified",value:function(e){var t=e.to,o=e.time,n=e.sequence,a=e.elements,s=e.cloudCustomData,r=e.messageVersion,i=Ft(t),c=this.getLocalTopic(i,t);if(c){var u=c.lastMessage;be.debug("".concat(this._className,".onMessageModified topicID:").concat(t," lastMessage:"),JSON.stringify(u),"options:",JSON.stringify(e)),u&&(null===u.payload||u.lastTime===o&&u.lastSequence===n&&u.version!==r)&&(u.type=a[0].type,u.payload=a[0].content,u.messageForShow=qt(u.type,u.payload),u.cloudCustomData=s,u.version=r,u.lastSequence=n,u.lastTime=o,this.emitOuterEvent(C.TOPIC_UPDATED,{groupID:i,topic:c}))}}},{key:"getJoinedCommunityList",value:function(){return this.getModule(ro).getGroupList({isGroupWithTopicOnly:!0}).then((function(e){var t=e.data.groupList;return Ha({groupList:void 0===t?[]:t})})).catch((function(e){return Za(e)}))}},{key:"createTopicInCommunity",value:function(e){var o=this,n="".concat(this._className,".createTopicInCommunity"),a=e.topicID;if(!Ze(a)&&!Tt(a))return Za({code:ua.ILLEGAL_TOPIC_ID,message:la.ILLEGAL_TOPIC_ID});var s=new Ca(Da.CREATE_TOPIC);return this.request({protocolName:ta,requestData:t({},e)}).then((function(a){var r=a.data.topicID;return s.setMessage("topicID:".concat(r)).setNetworkType(o.getNetworkType()).end(),be.log("".concat(n," ok")),o._updateTopicMap([t(t({},e),{},{topicID:r})]),Ha({topicID:r})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),be.error("".concat(n," failed. error:"),e),Za(e)}))}},{key:"deleteTopicFromCommunity",value:function(e){var t=this,o="".concat(this._className,".deleteTopicFromCommunity"),n=e.groupID,a=e.topicIDList,s=void 0===a?[]:a,r=new Ca(Da.DELETE_TOPIC);return r.setMessage("groupID:".concat(n," topicIDList:").concat(s)),this.request({protocolName:oa,requestData:{groupID:n,topicIDList:s}}).then((function(e){var o=e.data.resultList,a=[],s=[];(void 0===o?[]:o).forEach((function(e){var t=e.topicID,o=e.errorCode,n=e.errorInfo;0===o?a.push({topicID:t}):s.push({topicID:t,code:o,message:n})}));var i="success count:".concat(a.length,", fail count:").concat(s.length);return r.setMoreMessage("".concat(i)).setNetworkType(t.getNetworkType()).end(),be.log("".concat(i)),a.forEach((function(e){t._deleteLocalTopic(n,e.topicID)})),Ha({successTopicList:a,failureTopicList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"updateTopicProfile",value:function(e){var o=this,n="".concat(this._className,".updateTopicProfile"),a=new Ca(Da.UPDATE_TOPIC_PROFILE);return a.setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),be.log("".concat(n," options:"),e),Ze(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.request({protocolName:na,requestData:t({},e)}).then((function(){return a.setNetworkType(o.getNetworkType()).end(),be.log("".concat(n," ok")),o._updateTopicMap([e]),Ha({topic:o.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),be.error("".concat(n," failed. error:"),e),Za(e)}))}},{key:"getTopicList",value:function(e){var o=this,n="".concat(this._className,".getTopicList"),a=e.groupID,s=e.topicIDList,r=void 0===s?[]:s,i=0===r.length,c=new Ca(Da.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(),be.log("".concat(n," groupID:").concat(a," from cache, topic count:").concat(p.length)),Qa({successTopicList:p,failureTopicList:[]})}}return this.request({protocolName:aa,requestData:{groupID:a,topicIDList:r}}).then((function(e){var s=e.data.topicInfoList,r=[],u=[],l=[];(void 0===s?[]:s).forEach((function(e){var o=e.topic,n=e.selfInfo,a=e.errorCode,s=e.errorInfo,i=o.topicID;0===a?(r.push(t(t({},o),{},{selfInfo:n})),u.push(i)):l.push({topicID:i,code:a,message:s})})),o._updateTopicMap(r),o._handleTopicAtInfo(r);var d="success count:".concat(u.length,", fail count:").concat(l.length);c.setNetworkType(o.getNetworkType()).setMoreMessage("".concat(d)).end(),be.log("".concat(n," groupID:").concat(a," from remote, ").concat(d));var p=[];return Bt(u)||(o._getTopicTimeMap.set(a,{time:Date.now(),isGetAll:i}),p=o._getLocalTopicList(a,u)),Ha({successTopicList:p,failureTopicList:l})})).catch((function(e){return o.probeNetwork(e).then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),be.error("".concat(n," failed. error:"),e),Za(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 o=null;return this._topicMap.has(e)&&(o=this._topicMap.get(e).get(t)),o}},{key:"_getLocalTopicList",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=this._topicMap.get(e),n=[];return o&&(n=M(o.values())),0===t.length?n:n.filter((function(e){return t.includes(e.topicID)}))}},{key:"_deleteLocalTopic",value:function(e,t){this._topicMap.has(e)&&(this._topicMap.get(e).delete(t),be.log("".concat(this._className,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(t)))}},{key:"_updateTopicMap",value:function(e){var t=this,o=[];(e.forEach((function(e){var n=e.groupID,a=e.topicID,s=null;t._topicMap.has(n)||t._topicMap.set(n,new Map),t._topicMap.get(n).has(a)?(s=t._topicMap.get(n).get(a)).updateTopic(e):(t._getTopicLastMessage(e),s=new ws(e),t._topicMap.get(n).set(a,s));var r=s.nextMessageSeq-s.selfInfo.readedSequence-1,i=r>0?r:0;s.updateUnreadCount(i),o.push({conversationID:"".concat(D.CONV_GROUP).concat(a),type:D.CONV_TOPIC,unreadCount:i})})),o.length>0)&&this.getModule(lo).updateTopicConversation(o)}},{key:"resetGetTopicTime",value:function(e){var t=this;Ze(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()),o=[];t.forEach((function(t){var n=[];e._getLocalTopicList(t).forEach((function(t){var o=t.lastMessage.lastTime,a=void 0===o?0:o;Date.now()-1e3*a<1e3*e.TOPIC_LAST_ACTIVE_TIME&&n.push(t.topicID)})),n.length>0&&o.push({groupID:t,topicIDList:n})})),be.log("".concat(this._className,".getTopicListOnReconnected. active community count:").concat(o.length)),this._relayGetTopicList(o)}},{key:"_relayGetTopicList",value:function(e){var t=this;if(0!==e.length){var o=e.shift(),n=o.topicIDList.length>5?"topicIDList.length:".concat(o.topicIDList.length):"topicIDList:".concat(o.topicIDList),a=new Ca(Da.RELAY_GET_TOPIC_LIST);a.setMessage(n),be.log("".concat(this._className,"._relayGetTopicList. ").concat(n)),this.getTopicList(o).then((function(){a.setNetworkType(t.getNetworkType()).end(),t._relayGetTopicList(e)})).catch((function(o){t.probeNetwork().then((function(e){var t=m(e,2),n=t[0],s=t[1];a.setError(o,n,s).end()})),t._relayGetTopicList(e)}))}}},{key:"_handleTopicAtInfo",value:function(e){var o=this;0!==e.length&&e.forEach((function(e){var n=e.groupID,a=e.topicID,s=e.groupAtInfoList,r=[];Ze(s)||(s.forEach((function(e){r.push(t(t({},e),{},{groupID:n,topicID:a}))})),o.getModule(lo).onNewGroupAtTips({dataList:r}))}))}},{key:"_getTopicLastMessage",value:function(e){if(!Ze(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,o=this._getLocalTopicList(e),n=this.getModule(lo);o.forEach((function(o){var a=o.topicID;t._deleteLocalTopic(e,a),t._getTopicTimeMap.delete(e),n.deleteLocalConversation("".concat(D.CONV_GROUP).concat(a))}))}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),a}(Ao),qs=function(){function e(t){n(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,o=e.userIDList;e.fromAccount=this._userModule.getMyAccount(),o.length>100&&(be.warn("".concat(this._className,".getUserProfile 获取用户资料人数不能超过100人")),o.length=100);for(var n,a=[],s=[],r=0,i=o.length;r<i;r++)n=o[r],this._userModule.isMyFriend(n)&&this._containsAccount(n)?s.push(this._getProfileFromMap(n)):a.push(n);if(0===a.length)return Qa(s);e.toAccount=a;var c=e.bFromGetMyProfile||!1,u=[];e.toAccount.forEach((function(e){u.push({toAccount:e,standardSequence:0,customSequence:0})})),e.userItem=u;var l=new Ca(Da.GET_USER_PROFILE);return l.setMessage(o.length>5?"userIDList.length:".concat(o.length):"userIDList:".concat(o)),this._userModule.request({protocolName:wo,requestData:e}).then((function(e){l.setNetworkType(t._userModule.getNetworkType()).end(),be.info("".concat(t._className,".getUserProfile ok"));var o=t._handleResponse(e).concat(s);return Ha(c?o[0]:o)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setError(e,n,a).end()})),be.error("".concat(t._className,".getUserProfile failed. error:"),e),Za(e)}))}},{key:"getMyProfile",value:function(){var e=this._userModule.getMyAccount();if(be.log("".concat(this._className,".getMyProfile myAccount:").concat(e)),this._fillMap(),this._containsAccount(e)){var t=this._getProfileFromMap(e);return be.debug("".concat(this._className,".getMyProfile from cache, myProfile:")+JSON.stringify(t)),Qa(t)}return this.getUserProfile({fromAccount:e,userIDList:[e],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){for(var t,o,n=it.now(),a=e.data.userProfileItem,s=[],r=0,i=a.length;r<i;r++)"@TLS#NOT_FOUND"!==a[r].to&&""!==a[r].to&&(t=a[r].to,o=this._updateMap(t,this._getLatestProfileFromResponse(t,a[r].profileItem)),s.push(o));return be.log("".concat(this._className,"._handleResponse cost ").concat(it.now()-n," ms")),s}},{key:"_getLatestProfileFromResponse",value:function(e,t){var o={};if(o.userID=e,o.profileCustomField=[],!Bt(t))for(var n=0,a=t.length;n<a;n++)if(t[n].tag.indexOf("Tag_Profile_Custom")>-1)o.profileCustomField.push({key:t[n].tag,value:t[n].value});else switch(t[n].tag){case Fe.NICK:o.nick=t[n].value;break;case Fe.GENDER:o.gender=t[n].value;break;case Fe.BIRTHDAY:o.birthday=t[n].value;break;case Fe.LOCATION:o.location=t[n].value;break;case Fe.SELFSIGNATURE:o.selfSignature=t[n].value;break;case Fe.ALLOWTYPE:o.allowType=t[n].value;break;case Fe.LANGUAGE:o.language=t[n].value;break;case Fe.AVATAR:o.avatar=t[n].value;break;case Fe.MESSAGESETTINGS:o.messageSettings=t[n].value;break;case Fe.ADMINFORBIDTYPE:o.adminForbidType=t[n].value;break;case Fe.LEVEL:o.level=t[n].value;break;case Fe.ROLE:o.role=t[n].value;break;default:be.warn("".concat(this._className,"._handleResponse unknown tag:"),t[n].tag,t[n].value)}return o}},{key:"updateMyProfile",value:function(e){var t=this,o="".concat(this._className,".updateMyProfile"),n=new Ca(Da.UPDATE_MY_PROFILE);n.setMessage(JSON.stringify(e));var a=(new ps).validate(e);if(!a.valid)return n.setCode(ua.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("".concat(o," info:").concat(a.tips)).setNetworkType(this._userModule.getNetworkType()).end(),be.error("".concat(o," info:").concat(a.tips,",请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#updateMyProfile")),Za({code:ua.UPDATE_PROFILE_INVALID_PARAM,message:la.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?(n.setCode(ua.UPDATE_PROFILE_NO_KEY).setMoreMessage(la.UPDATE_PROFILE_NO_KEY).setNetworkType(this._userModule.getNetworkType()).end(),be.error("".concat(o," info:").concat(la.UPDATE_PROFILE_NO_KEY,",请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#updateMyProfile")),Za({code:ua.UPDATE_PROFILE_NO_KEY,message:la.UPDATE_PROFILE_NO_KEY})):this._userModule.request({protocolName:Fo,requestData:{fromAccount:this._userModule.getMyAccount(),profileItem:s}}).then((function(a){n.setNetworkType(t._userModule.getNetworkType()).end(),be.info("".concat(o," ok"));var s=t._updateMap(t._userModule.getMyAccount(),e);return t._userModule.emitOuterEvent(C.PROFILE_UPDATED,[s]),Qa(s)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"onProfileModified",value:function(e){var t=e.dataList;if(!Bt(t)){var o,n,a=t.length;be.debug("".concat(this._className,".onProfileModified count:").concat(a," dataList:"),e.dataList);for(var s=[],r=0;r<a;r++)o=t[r].userID,n=this._updateMap(o,this._getLatestProfileFromResponse(o,t[r].profileList)),s.push(n);s.length>0&&(this._userModule.emitInnerEvent(as,s),this._userModule.emitOuterEvent(C.PROFILE_UPDATED,s))}}},{key:"_fillMap",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),o=0,n=e.length;o<n;o++)t-e[o].lastUpdatedTime<this.expirationTime&&this.accountProfileMap.set(e[o].userID,e[o]);be.log("".concat(this._className,"._fillMap from cache, map.size:").concat(this.accountProfileMap.size))}}},{key:"_updateMap",value:function(e,t){var o,n=Date.now();return this._containsAccount(e)?(o=this._getProfileFromMap(e),t.profileCustomField&&vt(o.profileCustomField,t.profileCustomField),ct(o,t,["profileCustomField"]),o.lastUpdatedTime=n):(o=new ps(t),(this._userModule.isMyFriend(e)||e===this._userModule.getMyAccount())&&(o.lastUpdatedTime=n,this.accountProfileMap.set(e,o))),this._flushMap(e===this._userModule.getMyAccount()),o}},{key:"_flushMap",value:function(e){var t=M(this.accountProfileMap.values()),o=this._userModule.getStorageModule();be.debug("".concat(this._className,"._flushMap length:").concat(t.length," flushAtOnce:").concat(e)),o.setItem(this.TAG,t,e)}},{key:"_containsAccount",value:function(e){return this.accountProfileMap.has(e)}},{key:"_getProfileFromMap",value:function(e){return this.accountProfileMap.get(e)}},{key:"_getCachedProfiles",value:function(){var e=this._userModule.getStorageModule().getItem(this.TAG);return Bt(e)?[]:e}},{key:"onConversationsProfileUpdated",value:function(e){for(var t,o,n,a=[],s=0,r=e.length;s<r;s++)o=(t=e[s]).userID,this._userModule.isMyFriend(o)||(this._containsAccount(o)?(n=this._getProfileFromMap(o),ct(n,t)>0&&a.push(o)):a.push(t.userID));0!==a.length&&(be.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}(),Vs=s((function e(t){n(this,e),Bt||(this.userID=t.userID||"",this.timeStamp=t.timeStamp||0)})),Ks=function(){function e(t){n(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"),o={fromAccount:this._userModule.getMyAccount(),maxLimited:this.maxLimited,startIndex:0,lastSequence:this.currentSequence},n=new Ca(Da.GET_BLACKLIST);return this._userModule.request({protocolName:qo,requestData:o}).then((function(o){var a=o.data,s=a.blackListItem,r=a.currentSequence,i=Bt(s)?0:s.length;n.setNetworkType(e._userModule.getNetworkType()).setMessage("blackList count:".concat(i)).end(),be.info("".concat(t," ok")),e.currentSequence=r,e._handleResponse(s,!0),e._userModule.emitOuterEvent(C.BLACKLIST_UPDATED,M(e._blacklistMap.keys()))})).catch((function(o){return e._userModule.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];n.setError(o,a,s).end()})),be.error("".concat(t," failed. error:"),o),Za(o)}))}},{key:"addBlacklist",value:function(e){var t=this,o="".concat(this._className,".addBlacklist"),n=new Ca(Da.ADD_TO_BLACKLIST);if(!Qe(e.userIDList))return n.setCode(ua.ADD_BLACKLIST_INVALID_PARAM).setMessage(la.ADD_BLACKLIST_INVALID_PARAM).setNetworkType(this._userModule.getNetworkType()).end(),be.error("".concat(o," options.userIDList 必需是数组")),Za({code:ua.ADD_BLACKLIST_INVALID_PARAM,message:la.ADD_BLACKLIST_INVALID_PARAM});var a=this._userModule.getMyAccount();return 1===e.userIDList.length&&e.userIDList[0]===a?(n.setCode(ua.CANNOT_ADD_SELF_TO_BLACKLIST).setMessage(la.CANNOT_ADD_SELF_TO_BLACKLIST).setNetworkType(this._userModule.getNetworkType()).end(),be.error("".concat(o," 不能把自己拉黑")),Za({code:ua.CANNOT_ADD_SELF_TO_BLACKLIST,message:la.CANNOT_ADD_SELF_TO_BLACKLIST})):(e.userIDList.includes(a)&&(e.userIDList=e.userIDList.filter((function(e){return e!==a})),be.warn("".concat(o," 不能把自己拉黑,已过滤"))),e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Vo,requestData:e}).then((function(a){return n.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),be.info("".concat(o," ok")),t._handleResponse(a.resultItem,!0),Ha(M(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),be.error("".concat(o," failed. error:"),e),Za(e)})))}},{key:"_handleResponse",value:function(e,t){if(!Bt(e))for(var o,n,a,s=0,r=e.length;s<r;s++)n=e[s].to,a=e[s].resultCode,(Ze(a)||0===a)&&(t?((o=this._blacklistMap.has(n)?this._blacklistMap.get(n):new Vs).userID=n,!Bt(e[s].addBlackTimeStamp)&&(o.timeStamp=e[s].addBlackTimeStamp),this._blacklistMap.set(n,o)):this._blacklistMap.has(n)&&(o=this._blacklistMap.get(n),this._blacklistMap.delete(n)));be.log("".concat(this._className,"._handleResponse total:").concat(this._blacklistMap.size," bAdd:").concat(t))}},{key:"deleteBlacklist",value:function(e){var t=this,o="".concat(this._className,".deleteBlacklist"),n=new Ca(Da.REMOVE_FROM_BLACKLIST);return Qe(e.userIDList)?(e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Ko,requestData:e}).then((function(a){return n.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),be.info("".concat(o," ok")),t._handleResponse(a.data.resultItem,!1),Ha(M(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))):(n.setCode(ua.DEL_BLACKLIST_INVALID_PARAM).setMessage(la.DEL_BLACKLIST_INVALID_PARAM).setNetworkType(this._userModule.getNetworkType()).end(),be.error("".concat(o," options.userIDList 必需是数组")),Za({code:ua.DEL_BLACKLIST_INVALID_PARAM,message:la.DEL_BLACKLIST_INVALID_PARAM}))}},{key:"onAccountDeleted",value:function(e){for(var t,o=[],n=0,a=e.length;n<a;n++)t=e[n],this._blacklistMap.has(t)&&(this._blacklistMap.delete(t),o.push(t));o.length>0&&(be.log("".concat(this._className,".onAccountDeleted count:").concat(o.length," userIDList:"),o),this._userModule.emitOuterEvent(C.BLACKLIST_UPDATED,M(this._blacklistMap.keys())))}},{key:"onAccountAdded",value:function(e){for(var t,o=[],n=0,a=e.length;n<a;n++)t=e[n],this._blacklistMap.has(t)||(this._blacklistMap.set(t,new Vs({userID:t})),o.push(t));o.length>0&&(be.log("".concat(this._className,".onAccountAdded count:").concat(o.length," userIDList:"),o),this._userModule.emitOuterEvent(C.BLACKLIST_UPDATED,M(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.currentSequence=0}}]),e}(),Bs=function(e){var t=String(e).replace(/[=]+$/,""),o="";if(t.length%4==1)return be.warn("decodeBase64 failed: ".concat(e," to be decoded is not correctly encoded.")),"";for(var n,a,s=0,r=0;a=t.charAt(r++);~a&&(n=s%4?64*n+a:a,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a);try{return decodeURIComponent(escape(o))}catch(i){return be.warn("decodeBase64 failed: ".concat(e," to be decoded is not correctly encoded.")),""}},Hs=function(){function e(t){n(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(ns,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"),o=this._userModule.getCloudConfig("status_unsub_count");be.log("".concat(this._className,"._onCloudConfigUpdated statusQueryCount:").concat(e," statusSubscribeCount:").concat(t)+" statusUnsubscribeCount:".concat(o)),Ze(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),Ze(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),Ze(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(o,10))}},{key:"onUserStatusUpdated",value:function(e){var t=e.dataList,o=this._userModule.getMyUserID(),n=this._userModule.getModule(po),a=t.map((function(e){var t=e.to,a=e.statusType,s=e.customStatus,r=Bs(s);return t===o&&n.setCustomStatus(r),{userID:t,statusType:a,customStatus:r}}));this._userModule.emitOuterEvent(C.USER_STATUS_UPDATED,a)}},{key:"setSelfStatus",value:function(e){var t=this,o="".concat(this._className,".setSelfStatus"),n=e.customStatus,a=new Ca(Da.SET_SELF_STATUS);return this._userModule.request({protocolName:sa,requestData:{customStatus:n}}).then((function(e){return a.setNetworkType(t._userModule.getNetworkType()).setMessage("customStatus:".concat(n)).end(),be.log("".concat(o," ok. customStatus:").concat(n)),t._userModule.getModule(po).setCustomStatus(n),Ha({userID:t._userModule.getMyUserID(),statusType:1,customStatus:n})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"getUserStatus",value:function(e){var t=this,o="".concat(this._className,".getUserStatus"),n=e.userIDList,a=void 0===n?[]:n,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(po).getCustomStatus();i={userID:s,statusType:1,customStatus:u}}if(0===r.length)return Qa({successUserList:[i],failureUserList:[]});if(!this._canIUseUserStatus())return Za({code:ua.CANNOT_USE_COMMERCIAL_ABILITY,message:la.CANNOT_USE_COMMERCIAL_ABILITY});r.length>this.MAX_QUERY_USER_COUNT&&(be.warn("".concat(o," 查询用户状态单次请求不能超过").concat(this.MAX_QUERY_USER_COUNT,"个用户")),r=a.slice(0,this.MAX_QUERY_USER_COUNT));var l=new Ca(Da.GET_USER_STATUS);return this._userModule.request({protocolName:ra,requestData:{userIDList:r}}).then((function(e){var n=e.data,s=n.successUserList,r=void 0===s?[]:s,c=n.failureUserList,u=void 0===c?[]:c,d=r.map((function(e){var t=e.userID,o=e.statusType,n=e.customStatus;return{userID:t,statusType:o,customStatus:Bs(n)}})),p=u.map((function(e){var t=e.userID,o=e.invalidUserID,n=e.errorCode,a=e.errorInfo;return{userID:Bt(o)?t:o,code:n,message:a}}));Ze(i)||d.unshift(i);var g="userID count:".concat(a.length,", success count:").concat(d.length,", fail count:").concat(p.length);return l.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(g)).end(),be.log("".concat(o," ok. ").concat(g,".")),Ha({successUserList:d,failureUserList:p})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];l.setMessage("userID count:".concat(a.length)).setError(e,n,s).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"subscribeUserStatus",value:function(e){var t=this;if(!this._canIUseUserStatus())return Za({code:ua.CANNOT_USE_COMMERCIAL_ABILITY,message:la.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._className,".subscribeUserStatus"),n=e.userIDList,a=void 0===n?[]:n,s=M(a);s.length>this.MAX_SUBSCRIBE_USER_COUNT&&(be.warn("".concat(o," 订阅用户状态单次请求不能超过").concat(this.MAX_SUBSCRIBE_USER_COUNT,"个用户")),s=a.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));var r=new Ca(Da.SUBSCRIBE_USER_STATUS),i="userID count:".concat(a.length);return be.log("".concat(o," ").concat(i)),this._userModule.request({protocolName:ia,requestData:{userIDList:s}}).then((function(e){var n=e.data.failureUserList,a=(void 0===n?[]:n).map((function(e){var t=e.userID,o=e.invalidUserID,n=e.errorCode,a=e.errorInfo;return{userID:Bt(o)?t:o,code:n,message:a}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(a.length)).end(),be.log("".concat(o," ok. fail count:").concat(a.length,".")),Ha({failureUserList:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setMessage("".concat(i)).setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"unsubscribeUserStatus",value:function(e){var t=this;if(!this._canIUseUserStatus())return Za({code:ua.CANNOT_USE_COMMERCIAL_ABILITY,message:la.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._className,".unsubscribeUserStatus"),n=(e||{}).userIDList,a=void 0===n?[]:n,s=M(a);a.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(be.warn("".concat(o," 取消订阅用户状态单次请求不能超过").concat(this.MAX_UNSUBSCRIBE_USER_COUNT,"个用户")),s=a.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));var r=new Ca(Da.UNSUBSCRIBE_USER_STATUS),i="userID count:".concat(a.length);be.log("".concat(o," ").concat(i));var c={userIDList:s};return 0===s.length&&(c.userIDList=void 0,c.unsubscribeAll=1),this._userModule.request({protocolName:ca,requestData:c}).then((function(e){var n=e.data.failureUserList,a=(void 0===n?[]:n).map((function(e){var t=e.userID,o=e.invalidUserID,n=e.errorCode,a=e.errorInfo;return{userID:Bt(o)?t:o,code:n,message:a}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(a.length)).end(),be.log("".concat(o," ok. fail count:").concat(a.length,".")),Ha({failureUserList:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setMessage("".concat(i)).setError(e,n,a).end()})),be.error("".concat(o," failed. error:"),e),Za(e)}))}},{key:"_canIUseUserStatus",value:function(){return this._userModule.getModule(No).canIUse(H.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}(),xs=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="UserModule",a._profileHandler=new qs(_(a)),a._blacklistHandler=new Ks(_(a)),a._userStatusHandler=new Hs(_(a)),a.getInnerEmitterInstance().on(os,a.onContextUpdated,_(a)),a}return s(o,[{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 o=[];t.forEach((function(e){e.blackListDelAccount&&o.push.apply(o,M(e.blackListDelAccount))})),o.length>0&&this._blacklistHandler.onAccountDeleted(o);var n=[];t.forEach((function(e){e.blackListAddAccount&&n.push.apply(n,M(e.blackListAddAccount))})),n.length>0&&this._blacklistHandler.onAccountAdded(n)}}},{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(go)}},{key:"isMyFriend",value:function(e){var t=this.getModule(io);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 Qa(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(){be.log("".concat(this._className,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),o}(Ao),Ws=function(){function e(t,o){n(this,e),this._moduleManager=t,this._isLoggedIn=!1,this._SDKAppID=o.SDKAppID,this._userID=o.userID||"",this._userSig=o.userSig||"",this._version="2.21.2",this._a2Key="",this._tinyID="",this._customStatus="",this._contentType="json",this._unlimitedAVChatRoom=o.unlimitedAVChatRoom,this._scene=o.scene||"",this._oversea=o.oversea,this._instanceID=o.instanceID,this._statusInstanceID=0,this._isDevMode=o.devMode,this._proxyServer=o.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,o=!1,n=!1,a=[];te&&(a=Object.keys(ne)),oe&&(a=ee?Object.keys(uni):Object.keys(window));for(var s=0,r=a.length;s<r;s++)if(a[s].toLowerCase().includes("uikit")){e=!0;break}if(a=null,te&&ot(getApp)){var i=getApp().globalData;Xe(i)&&!0===i.isTUIKit&&(t=!0)}!0===this._moduleManager.getModule(go).getStorageSync("TIM_".concat(this._SDKAppID,"_isTUIKit"))&&(o=!0);var c=null;if($&&!J&&"undefined"==typeof uni&&__wxConfig&&(c=__wxConfig.pages),z&&"undefined"==typeof uni&&__qqConfig&&(c=__qqConfig.pages),Qe(c)&&c.length>0){for(var u=0,l=c.length;u<l;u++)if(c[u].toLowerCase().includes("tui")){n=!0;break}c=null}return e||t||o||n}},{key:"reset",value:function(){this._isLoggedIn=!1,this._userSig="",this._a2Key="",this._tinyID="",this._customStatus="",this._statusInstanceID=0}}]),e}(),Ys=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="SignModule",a._helloInterval=120,a._lastLoginTs=0,a._lastWsHelloTs=0,ss.mixin(_(a)),a}return s(o,[{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this._helloInterval==0&&this._hello()}},{key:"login",value:function(e){if(this.isLoggedIn()){var t="您已经登录帐号".concat(e.userID,"!如需切换帐号登录,请先调用 logout 接口登出,再调用 login 接口登录。");return be.warn(t),Qa({actionStatus:"OK",errorCode:0,errorInfo:t,repeatLogin:!0})}if(Date.now()-this._lastLoginTs<=15e3)return be.warn("您正在尝试登录帐号".concat(e.userID,"!请勿重复登录。")),Za({code:ua.REPEAT_LOGIN,message:la.REPEAT_LOGIN});be.log("".concat(this._className,".login userID:").concat(e.userID));var o=this._checkLoginInfo(e);if(0!==o.code)return Za(o);var n=this.getModule(po),a=e.userID,s=e.userSig;return n.setUserID(a),n.setUserSig(s),this.getModule(Io).updateProtocolConfig(),this._login()}},{key:"_login",value:function(){var e=this,t=this.getModule(po),o=t.getScene(),n=new Ca(Da.LOGIN);return n.setMessage("".concat(o)).setMoreMessage("identifier:".concat(this.getMyUserID())),ee?"tuikit"===o?n.setUIPlatform(4):n.setUIPlatform(3):te?"tuikit"===o?n.setUIPlatform(12):n.setUIPlatform(11):oe&&(Te?"tuikit"===o?n.setUIPlatform(17):n.setUIPlatform(16):"tuikit"===o?n.setUIPlatform(14):n.setUIPlatform(13)),this._lastLoginTs=Date.now(),this.request({protocolName:Oo}).then((function(a){e._lastLoginTs=0;var s=Date.now(),r=null,i=a.data,c=i.a2Key,u=i.tinyID,l=i.helloInterval,d=i.instanceID,p=i.timeStamp,g=i.customStatus,_=void 0===g?"":g;be.log("".concat(e._className,".login ok. scene:").concat(o," helloInterval:").concat(l," instanceID:").concat(d," timeStamp:").concat(p));var h=1e3*p,f=s-n.getStartTs(),m=h+parseInt(f/2)-s,M=n.getStartTs()+m;if(n.start(M),function(e,t){Oe=t;var o=new Date;o.setTime(e),be.info("baseTime from server: ".concat(o," offset: ").concat(Oe))}(h,m),!u)throw r=new za({code:ua.NO_TINYID,message:la.NO_TINYID}),n.setError(r,!0,e.getNetworkType()).end(),r;if(!c)throw r=new za({code:ua.NO_A2KEY,message:la.NO_A2KEY}),n.setError(r,!0,e.getNetworkType()).end(),r;n.setNetworkType(e.getNetworkType()).setMoreMessage("helloInterval:".concat(l," instanceID:").concat(d," offset:").concat(m)).end(),t.setA2Key(c),t.setTinyID(u),t.setStatusInstanceID(d);var v=Bs(_);return t.setCustomStatus(v),e.getModule(Io).updateProtocolConfig(),e.emitInnerEvent(os),e._helloInterval=l,e.triggerReady(),e._fetchCloudControlConfig(),a})).catch((function(t){return e.probeNetwork().then((function(e){var o=m(e,2),a=o[0],s=o[1];n.setError(t,a,s).end(!0)})),e._moduleManager.setNotReadyReason(ua.LOGIN_FAILED),be.error("".concat(e._className,".login failed. error:"),t),e._lastLoginTs=0,e._moduleManager.onLoginFailed(),Za(t)}))}},{key:"logout",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!this.isLoggedIn())return Za({code:ua.USER_NOT_LOGGED_IN,message:la.USER_NOT_LOGGED_IN});var o=new Ca(Da.LOGOUT);return o.setNetworkType(this.getNetworkType()).setMessage("identifier:".concat(this.getMyUserID())).end(!0),be.info("".concat(this._className,".logout type:").concat(t)),0===t&&this._moduleManager.setNotReadyReason(ua.LOGGED_OUT),this.request({protocolName:Ro,requestData:{type:t}}).then((function(){return e.resetReady(),Qa({})})).catch((function(t){return be.error("".concat(e._className,"._logout error:"),t),e.resetReady(),Qa({})}))}},{key:"_fetchCloudControlConfig",value:function(){this.getModule(To).fetchConfig()}},{key:"_hello",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.request({protocolName:Lo}).catch((function(t){be.warn("".concat(e._className,"._hello error:"),t)}))}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var t=0,o="";return Bt(this.getModule(po).getSDKAppID())?(t=ua.NO_SDKAPPID,o=la.NO_SDKAPPID):Bt(e.userID)?(t=ua.NO_IDENTIFIER,o=la.NO_IDENTIFIER):Bt(e.userSig)&&(t=ua.NO_USERSIG,o=la.NO_USERSIG),{code:t,message:o}}},{key:"onMultipleAccountKickedOut",value:function(e){var t=this;new Ca(Da.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(D.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),be.warn("".concat(this._className,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(C.KICKED_OUT,{type:D.KICKED_OUT_MULT_ACCOUNT}),t._moduleManager.setNotReadyReason(ua.KICKED_OUT_MULT_ACCOUNT),t._moduleManager.reset()}))}},{key:"onMultipleDeviceKickedOut",value:function(e){var t=this;new Ca(Da.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(D.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),be.warn("".concat(this._className,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(C.KICKED_OUT,{type:D.KICKED_OUT_MULT_DEVICE}),t._moduleManager.setNotReadyReason(ua.KICKED_OUT_MULT_DEVICE),t._moduleManager.reset()}))}},{key:"onUserSigExpired",value:function(){new Ca(Da.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage(D.KICKED_OUT_USERSIG_EXPIRED).end(!0),be.warn("".concat(this._className,".onUserSigExpired: userSig 签名过期被踢下线")),0!==this.getModule(po).getStatusInstanceID()&&(this.emitOuterEvent(C.KICKED_OUT,{type:D.KICKED_OUT_USERSIG_EXPIRED}),this._moduleManager.setNotReadyReason(ua.KICKED_OUT_USERSIG_EXPIRED),this._moduleManager.reset())}},{key:"onRestApiKickedOut",value:function(e){(new Ca(Da.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(D.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),be.warn("".concat(this._className,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),0!==this.getModule(po).getStatusInstanceID())&&(this.emitOuterEvent(C.KICKED_OUT,{type:D.KICKED_OUT_REST_API}),this._moduleManager.setNotReadyReason(ua.KICKED_OUT_REST_API),this._moduleManager.reset(),this.getModule(yo).onRestApiKickedOut())}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0}}]),o}(Ao);function js(){return null}var $s=function(){function e(t){n(this,e),this._moduleManager=t,this._className="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}return s(e,[{key:"_errorTolerantHandle",value:function(){te||!Ze(window)&&!Ze(window.localStorage)||(this.getItem=js,this.setItem=js,this.removeItem=js,this.clear=js)}},{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 o=m(e.value,2),n=o[0],a=o[1];this._setStorageSync(this._getKey(n),a)}}catch(s){t.e(s)}finally{t.f()}this._storageQueue.clear()}catch(r){be.warn("".concat(this._className,"._doFlush error:"),r)}}},{key:"_getPrefix",value:function(){var e=this._moduleManager.getModule(po);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 o=t?this._getKey(e):e;return this.getStorageSync(o)}catch(n){return be.warn("".concat(this._className,".getItem error:"),n),{}}}},{key:"setItem",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(o){var a=n?this._getKey(e):e;this._setStorageSync(a,t)}else this._storageQueue.set(e,t)}},{key:"clear",value:function(){try{te?ne.clearStorageSync():localStorage&&localStorage.clear()}catch(e){be.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 o=t?this._getKey(e):e;this._removeStorageSync(o)}catch(n){be.warn("".concat(this._className,".removeItem error:"),n)}}},{key:"getSize",value:function(e){var t=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"b";try{var n={size:0,limitSize:5242880,unit:o};if(Object.defineProperty(n,"leftSize",{enumerable:!0,get:function(){return n.limitSize-n.size}}),te&&(n.limitSize=1024*ne.getStorageInfoSync().limitSize),e)n.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(te){var a=ne.getStorageInfoSync(),s=a.keys;s.forEach((function(e){n.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length}))}else if(localStorage)for(var r in localStorage)localStorage.hasOwnProperty(r)&&(n.size+=localStorage.getItem(r).length+r.length);return this._convertUnit(n)}catch(i){be.warn("".concat(this._className," error:"),i)}}},{key:"_convertUnit",value:function(e){var t={},o=e.unit;for(var n in t.unit=o,e)"number"==typeof e[n]&&("kb"===o.toLowerCase()?t[n]=Math.round(e[n]/1024):"mb"===o.toLowerCase()?t[n]=Math.round(e[n]/1024/1024):t[n]=e[n]);return t}},{key:"_setStorageSync",value:function(e,t){te?Q?my.setStorageSync({key:e,data:t}):ne.setStorageSync(e,t):localStorage&&localStorage.setItem(e,JSON.stringify(t))}},{key:"getStorageSync",value:function(e){return te?Q?my.getStorageSync({key:e}).data:ne.getStorageSync(e):localStorage?JSON.parse(localStorage.getItem(e)):{}}},{key:"_removeStorageSync",value:function(e){te?Q?my.removeStorageSync({key:e}):ne.removeStorageSync(e):localStorage&&localStorage.removeItem(e)}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._doFlush()}}]),e}(),zs=function(){function e(t){n(this,e),this._className="SSOLogBody",this._report=[]}return s(e,[{key:"pushIn",value:function(e){be.debug("".concat(this._className,".pushIn"),this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;Qe(e)&&0!==e.length&&(be.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}(),Js=function(e){var t=e.getModule(po);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:Re()}},Xs=function(e){i(a,e);var o=f(a);function a(e){var t;n(this,a),(t=o.call(this,e))._className="EventStatModule",t.TAG="im-ssolog-event",t._reportBody=new zs,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(os,t._onLoginSuccess,_(t)),s.on(ns,t._onCloudConfigUpdated,_(t)),t}return s(a,[{key:"reportAtOnce",value:function(){be.debug("".concat(this._className,".reportAtOnce")),this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,t=this.getModule(go),o=t.getItem(this.TAG,!1);!Bt(o)&&ot(o.forEach)&&(be.log("".concat(this._className,"._onLoginSuccess get ssolog in storage, count:").concat(o.length)),o.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"),o=this.getCloudConfig("evt_rpt_level"),n=this.getCloudConfig("evt_rpt_sdkappid_bl"),a=this.getCloudConfig("evt_rpt_tinyid_wl");Ze(e)||(this.MIN_THRESHOLD=Number(e)),Ze(t)||(this.WAITING_TIME=Number(t)),Ze(o)||(this.REPORT_LEVEL=o.split(",").map((function(e){return Number(e)}))),Ze(n)||(this.REPORT_SDKAPPID_BLACKLIST=n.split(",").map((function(e){return Number(e)}))),Ze(a)||(this.REPORT_TINYID_WHITELIST=a.split(","))}},{key:"pushIn",value:function(e){e instanceof Ca&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}},{key:"onCheckTimer",value:function(){Date.now()<this._lastReportTime+this.WAITING_TIME||this._reportBody.isEmpty()||this._report()}},{key:"_filterLogs",value:function(e){var t=this,o=this.getModule(po),n=o.getSDKAppID(),a=o.getTinyID();return bt(this.REPORT_SDKAPPID_BLACKLIST,n)&&!wt(this.REPORT_TINYID_WHITELIST,a)?[]:e.filter((function(e){return t.REPORT_LEVEL.includes(e.level)}))}},{key:"_report",value:function(){var e=this;if(!this._reportBody.isEmpty()){var o=this._reportBody.getLogsInMemory(),n=this._filterLogs(o);if(0!==n.length){var a={header:Js(this),event:n};this.request({protocolName:Bn,requestData:t({},a)}).then((function(){e._lastReportTime=Date.now()})).catch((function(t){be.warn("".concat(e._className,".report failed. networkType:").concat(e.getNetworkType()," error:"),t),e._reportBody.backfill(o),e._reportBody.getLogsNumInMemory()>e.MAX_THRESHOLD&&e._flushAtOnce()}))}else this._lastReportTime=Date.now()}}},{key:"_flushAtOnce",value:function(){var e=this.getModule(go),t=e.getItem(this.TAG,!1),o=this._reportBody.getLogsInMemory();if(Bt(t))be.log("".concat(this._className,"._flushAtOnce count:").concat(o.length)),e.setItem(this.TAG,o,!0,!1);else{var n=o.concat(t);n.length>this.MAX_THRESHOLD&&(n=n.slice(0,this.MAX_THRESHOLD)),be.log("".concat(this._className,"._flushAtOnce count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)}}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),a}(Ao),Qs="none",Zs="online",er=[ua.OVER_FREQUENCY_LIMIT,ua.OPEN_SERVICE_OVERLOAD_ERROR],tr=function(){function e(t){n(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?(ne.getNetworkType({success:function(t){e._networkType=t.networkType,t.networkType===Qs?be.warn("".concat(e._className,".start no network, please check!")):be.info("".concat(e._className,".start networkType:").concat(t.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),ne.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=Zs,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:Zs})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:Qs})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,o=e.networkType,n=!1;t?(be.info("".concat(this._className,"._onNetworkStatusChange previousNetworkType:").concat(this._networkType," currentNetworkType:").concat(o)),this._networkType!==o&&(n=!0,this._moduleManager.getModule(yo).reConnect(!0))):this._networkType!==o&&(n=!0,be.warn("".concat(this._className,"._onNetworkStatusChange no network, please check!")),this._moduleManager.getModule(yo).offline());n&&(new Ca(Da.NETWORK_CHANGE).setMessage("isConnected:".concat(t," previousNetworkType:").concat(this._networkType," networkType:").concat(o)).end(),this._networkType=o)}},{key:"probe",value:function(e){var t=this;return!Ze(e)&&er.includes(e.code)?Promise.resolve([!0,this._networkType]):new Promise((function(e,o){if(te)ne.getNetworkType({success:function(o){t._networkType=o.networkType,o.networkType===Qs?(be.warn("".concat(t._className,".probe no network, please check!")),e([!1,o.networkType])):(be.info("".concat(t._className,".probe networkType:").concat(o.networkType)),e([!0,o.networkType]))}});else if(window&&window.fetch)fetch("".concat(ft(),"//web.sdk.qcloud.com/im/assets/speed.xml?random=").concat(Math.random())).then((function(t){t.ok?e([!0,Zs]):e([!1,Qs])})).catch((function(t){e([!1,Qs])}));else{var n=new XMLHttpRequest,a=setTimeout((function(){be.warn("".concat(t._className,".probe fetch timeout. Probably no network, please check!")),n.abort(),t._networkType=Qs,e([!1,Qs])}),t.MAX_WAIT_TIME);n.onreadystatechange=function(){4===n.readyState&&(clearTimeout(a),200===n.status||304===n.status||514===n.status?(this._networkType=Zs,e([!0,Zs])):(be.warn("".concat(this.className,".probe fetch status:").concat(n.status,". Probably no network, please check!")),this._networkType=Qs,e([!1,Qs])))},n.open("GET","".concat(ft(),"//web.sdk.qcloud.com/im/assets/speed.xml?random=").concat(Math.random())),n.send()}}))}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),te?null!==this._mpNetworkStatusCallback&&(ne.offNetworkStatusChange&&(Z||J?ne.offNetworkStatusChange(this._mpNetworkStatusCallback):ne.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}(),or=O((function(e){var t=Object.prototype.hasOwnProperty,o="~";function n(){}function a(e,t,o){this.fn=e,this.context=t,this.once=o||!1}function s(e,t,n,s,r){if("function"!=typeof n)throw new TypeError("The listener must be a function");var i=new a(n,s||e,r),c=o?o+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 n:delete e._events[t]}function i(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(o=!1)),i.prototype.eventNames=function(){var e,n,a=[];if(0===this._eventsCount)return a;for(n in e=this._events)t.call(e,n)&&a.push(o?n.slice(1):n);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},i.prototype.listeners=function(e){var t=o?o+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var a=0,s=n.length,r=new Array(s);a<s;a++)r[a]=n[a].fn;return r},i.prototype.listenerCount=function(e){var t=o?o+e:e,n=this._events[t];return n?n.fn?1:n.length:0},i.prototype.emit=function(e,t,n,a,s,r){var i=o?o+e:e;if(!this._events[i])return!1;var c,u,l=this._events[i],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,a),!0;case 5:return l.fn.call(l.context,t,n,a,s),!0;case 6:return l.fn.call(l.context,t,n,a,s,r),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var p,g=l.length;for(u=0;u<g;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,n);break;case 4:l[u].fn.call(l[u].context,t,n,a);break;default:if(!c)for(p=1,c=new Array(d-1);p<d;p++)c[p-1]=arguments[p];l[u].fn.apply(l[u].context,c)}}return!0},i.prototype.on=function(e,t,o){return s(this,e,t,o,!1)},i.prototype.once=function(e,t,o){return s(this,e,t,o,!0)},i.prototype.removeListener=function(e,t,n,a){var s=o?o+e:e;if(!this._events[s])return this;if(!t)return r(this,s),this;var i=this._events[s];if(i.fn)i.fn!==t||a&&!i.once||n&&i.context!==n||r(this,s);else{for(var c=0,u=[],l=i.length;c<l;c++)(i[c].fn!==t||a&&!i[c].once||n&&i[c].context!==n)&&u.push(i[c]);u.length?this._events[s]=1===u.length?u[0]:u:r(this,s)}return this},i.prototype.removeAllListeners=function(e){var t;return e?(t=o?o+e:e,this._events[t]&&r(this,t)):(this._events=new n,this._eventsCount=0),this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prefixed=o,i.EventEmitter=i,e.exports=i})),nr=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="BigDataChannelModule",a.FILETYPE={SOUND:2106,FILE:2107,VIDEO:2113},a._bdh_download_server="grouptalk.c2c.qq.com",a._BDHBizID=10001,a._authKey="",a._expireTime=0,a.getInnerEmitterInstance().on(os,a._getAuthKey,_(a)),a}return s(o,[{key:"_getAuthKey",value:function(){var e=this;this.request({protocolName:Po}).then((function(t){t.data.authKey&&(e._authKey=t.data.authKey,e._expireTime=parseInt(t.data.expireTime))}))}},{key:"_isFromOlderVersion",value:function(e){return!(!e.content||2===e.content.downloadFlag)}},{key:"parseElements",value:function(e,t){if(!Qe(e)||!t)return[];for(var o=[],n=null,a=0;a<e.length;a++)n=e[a],this._needParse(n)?o.push(this._parseElement(n,t)):o.push(e[a]);return o}},{key:"_needParse",value:function(e){return!e.cloudCustomData&&!(!this._isFromOlderVersion(e)||e.type!==D.MSG_AUDIO&&e.type!==D.MSG_FILE&&e.type!==D.MSG_VIDEO)}},{key:"_parseElement",value:function(e,t){switch(e.type){case D.MSG_AUDIO:return this._parseAudioElement(e,t);case D.MSG_FILE:return this._parseFileElement(e,t);case D.MSG_VIDEO:return this._parseVideoElement(e,t)}}},{key:"_parseAudioElement",value:function(e,t){return e.content.url=this._genAudioUrl(e.content.uuid,t),e}},{key:"_parseFileElement",value:function(e,t){return e.content.url=this._genFileUrl(e.content.uuid,t,e.content.fileName),e}},{key:"_parseVideoElement",value:function(e,t){return e.content.url=this._genVideoUrl(e.content.uuid,t),e}},{key:"_genAudioUrl",value:function(e,t){if(""===this._authKey)return be.warn("".concat(this._className,"._genAudioUrl no authKey!")),"";var o=this.getModule(po).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(o,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.SOUND,"&openid=").concat(t,"&ver=0")}},{key:"_genFileUrl",value:function(e,t,o){if(""===this._authKey)return be.warn("".concat(this._className,"._genFileUrl no authKey!")),"";o||(o="".concat(Math.floor(1e5*Math.random()),"-").concat(Date.now()));var n=this.getModule(po).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(n,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.FILE,"&openid=").concat(t,"&ver=0&filename=").concat(encodeURIComponent(o))}},{key:"_genVideoUrl",value:function(e,t){if(""===this._authKey)return be.warn("".concat(this._className,"._genVideoUrl no authKey!")),"";var o=this.getModule(po).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(o,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.VIDEO,"&openid=").concat(t,"&ver=0")}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._authKey="",this.expireTime=0}}]),o}(Ao),ar=["requestSnapshotUrl"],sr=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="UploadModule",t.TIMUploadPlugin=null,t.timUploadPlugin=null,t.COSSDK=null,t._cosUploadMethod=null,t.expiredTimeLimit=600,t.appid=0,t.bucketName="",t.ciUrl="",t.directory="",t.downloadUrl="",t.uploadUrl="",t.region="ap-shanghai",t.cos=null,t.cosOptions={secretId:"",secretKey:"",sessionToken:"",expiredTime:0},t.uploadFileType="",t.duration=900,t.tryCount=0,t.getInnerEmitterInstance().on(os,t._init,_(t)),t}return s(a,[{key:"_init",value:function(){var e="".concat(this._className,"._init"),t=this.getModule(Mo);if(this.TIMUploadPlugin=t.getPlugin("tim-upload-plugin"),this.TIMUploadPlugin)this._initUploaderMethod();else{var o=te?"cos-wx-sdk":"cos-js-sdk";this.COSSDK=t.getPlugin(o),this.COSSDK?(this._getAuthorizationKey(),be.warn("".concat(e," v2.9.2起推荐使用 tim-upload-plugin 代替 ").concat(o,",上传更快更安全。详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#registerPlugin"))):be.warn("".concat(e," 没有检测到上传插件,将无法发送图片、音频、视频、文件等类型的消息。详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#registerPlugin"))}}},{key:"_getAuthorizationKey",value:function(){var e=this,t=new Ca(Da.GET_COS_AUTH_KEY),o=Math.ceil(Date.now()/1e3);this.request({protocolName:qn,requestData:{duration:this.expiredTimeLimit}}).then((function(n){var a=n.data;be.log("".concat(e._className,"._getAuthorizationKey ok. data:"),a);var s=a.expiredTime-o;t.setMessage("requestId:".concat(a.requestId," requestTime:").concat(o," expiredTime:").concat(a.expiredTime," diff:").concat(s,"s")).setNetworkType(e.getNetworkType()).end(),!te&&a.region&&(e.region=a.region),e.appid=a.appid,e.bucketName=a.bucketName,e.ciUrl=a.ciUrl,e.directory=a.directory,e.downloadUrl=a.downloadUrl,e.uploadUrl=a.uploadUrl,e.cosOptions={secretId:a.secretId,secretKey:a.secretKey,sessionToken:a.sessionToken,expiredTime:a.expiredTime},be.log("".concat(e._className,"._getAuthorizationKey ok. region:").concat(e.region," bucketName:").concat(e.bucketName)),e._initUploaderMethod()})).catch((function(o){e.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];t.setError(o,a,s).end()})),be.warn("".concat(e._className,"._getAuthorizationKey failed. error:"),o)}))}},{key:"_getCosPreSigUrl",value:function(e){var t=this,o="".concat(this._className,"._getCosPreSigUrl"),n=Math.ceil(Date.now()/1e3),a=new Ca(Da.GET_COS_PRE_SIG_URL);return this.request({protocolName:Vn,requestData:{fileType:e.fileType,fileName:e.fileName,uploadMethod:e.uploadMethod,duration:e.duration}}).then((function(e){t.tryCount=0;var s=e.data||{},r=s.expiredTime-n;return be.log("".concat(o," ok. data:"),s),a.setMessage("requestId:".concat(s.requestId," expiredTime:").concat(s.expiredTime," diff:").concat(r,"s")).setNetworkType(t.getNetworkType()).end(),s})).catch((function(n){return-1===n.code&&(n.code=ua.COS_GET_SIG_FAIL),t.probeNetwork().then((function(e){var t=m(e,2),o=t[0],s=t[1];a.setError(n,o,s).end()})),be.warn("".concat(o," failed. error:"),n),t.tryCount<1?(t.tryCount++,t._getCosPreSigUrl(e)):(t.tryCount=0,Za({code:ua.COS_GET_SIG_FAIL,message:la.COS_GET_SIG_FAIL}))}))}},{key:"_initUploaderMethod",value:function(){var e=this;if(this.TIMUploadPlugin)return this.timUploadPlugin=new this.TIMUploadPlugin,void(this._cosUploadMethod=function(t,o){e.timUploadPlugin.uploadFile(t,o)});this.appid&&(this.cos=te?new this.COSSDK({ForcePathStyle:!0,getAuthorization:this._getAuthorization.bind(this)}):new this.COSSDK({getAuthorization:this._getAuthorization.bind(this)}),this._cosUploadMethod=te?function(t,o){e.cos.postObject(t,o)}:function(t,o){e.cos.uploadFiles(t,o)})}},{key:"onCheckTimer",value:function(e){this.COSSDK&&(this.TIMUploadPlugin||this.isLoggedIn()&&e%60==0&&Math.ceil(Date.now()/1e3)>=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(Do);switch(e.type){case D.MSG_IMAGE:return t.addTotalCount(ma),this._uploadImage(e);case D.MSG_FILE:return t.addTotalCount(ma),this._uploadFile(e);case D.MSG_AUDIO:return t.addTotalCount(ma),this._uploadAudio(e);case D.MSG_VIDEO:return t.addTotalCount(ma),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var o=this,n=this.getModule(no),a=e.getElements()[0],s=n.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 Za({code:ua.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:la.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,r=n.fileType,i=n.fileSize,c=n.width,u=n.height,l=o.isPrivateNetWork()?s:mt(s);a.updateImageFormat(r);var d=kt({originUrl:l,originWidth:c,originHeight:u,min:198}),p=kt({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,o=this.getModule(no),n=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadFile({file:a.payload.file,to:a.to,onProgress:function(e){if(n.updatePercent(e),ot(a.onProgress))try{a.onProgress(e)}catch(t){return Za({code:ua.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:la.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a=o.location,s=t.isPrivateNetWork()?a:mt(a);return n.updateFileUrl(s),e}))}},{key:"_uploadAudio",value:function(e){var t=this,o=this.getModule(no),n=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadAudio({file:a.payload.file,to:a.to,onProgress:function(e){if(n.updatePercent(e),ot(a.onProgress))try{a.onProgress(e)}catch(t){return Za({code:ua.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:la.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a=o.location,s=t.isPrivateNetWork()?a:mt(a);return n.updateAudioUrl(s),e}))}},{key:"_uploadVideo",value:function(e){var t=this,o=this.getModule(no),n=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadVideo({file:a.payload.file,to:a.to,onProgress:function(e){if(n.updatePercent(e),ot(a.onProgress))try{a.onProgress(e)}catch(t){return Za({code:ua.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:la.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a=o.location,s=o.snapshotInfo,r=t.isPrivateNetWork()?a:mt(a);return n.updateVideoUrl(r),Bt(s)||n.updateSnapshotInfo(s),e}))}},{key:"doUploadImage",value:function(e){var t=this;if(!e.file)return Za({code:ua.MESSAGE_IMAGE_SELECT_FILE_FIRST,message:la.MESSAGE_IMAGE_SELECT_FILE_FIRST});var o=this._checkImageType(e.file);if(!0!==o)return o;var n=this._checkImageSize(e.file);if(!0!==n)return n;var a=null;return this._setUploadFileType(cs),this.uploadByCOS(e).then((function(e){return a=e,t.isPrivateNetWork()?At(e.location):At("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),rs.indexOf(t.toLowerCase())>=0||Za({code:ua.MESSAGE_IMAGE_TYPES_LIMIT,message:la.MESSAGE_IMAGE_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){var t=0;return 0===(t=te?e.size:e.files[0].size)?Za({code:ua.MESSAGE_FILE_IS_EMPTY,message:"".concat(la.MESSAGE_FILE_IS_EMPTY)}):t<20971520||Za({code:ua.MESSAGE_IMAGE_SIZE_LIMIT,message:"".concat(la.MESSAGE_IMAGE_SIZE_LIMIT)})}},{key:"doUploadFile",value:function(e){var t=null;return e.file?e.file.files[0].size>104857600?Za(t={code:ua.MESSAGE_FILE_SIZE_LIMIT,message:la.MESSAGE_FILE_SIZE_LIMIT}):0===e.file.files[0].size?(t={code:ua.MESSAGE_FILE_IS_EMPTY,message:"".concat(la.MESSAGE_FILE_IS_EMPTY)},Za(t)):(this._setUploadFileType(ds),this.uploadByCOS(e)):Za(t={code:ua.MESSAGE_FILE_SELECT_FILE_FIRST,message:la.MESSAGE_FILE_SELECT_FILE_FIRST})}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>104857600?Za({code:ua.MESSAGE_VIDEO_SIZE_LIMIT,message:"".concat(la.MESSAGE_VIDEO_SIZE_LIMIT)}):0===e.file.videoFile.size?Za({code:ua.MESSAGE_FILE_IS_EMPTY,message:"".concat(la.MESSAGE_FILE_IS_EMPTY)}):-1===is.indexOf(e.file.videoFile.type)?Za({code:ua.MESSAGE_VIDEO_TYPES_LIMIT,message:"".concat(la.MESSAGE_VIDEO_TYPES_LIMIT)}):(this._setUploadFileType(us),te?this.handleVideoUpload({file:e.file.videoFile,onProgress:e.onProgress}):oe?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var t=this;return new Promise((function(o,n){t.uploadByCOS(e).then((function(e){o(e)})).catch((function(){t.uploadByCOS(e).then((function(e){o(e)})).catch((function(){n(new za({code:ua.MESSAGE_VIDEO_UPLOAD_FAIL,message:la.MESSAGE_VIDEO_UPLOAD_FAIL}))}))}))}))}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>20971520?Za(new za({code:ua.MESSAGE_AUDIO_SIZE_LIMIT,message:"".concat(la.MESSAGE_AUDIO_SIZE_LIMIT)})):0===e.file.size?Za(new za({code:ua.MESSAGE_FILE_IS_EMPTY,message:"".concat(la.MESSAGE_FILE_IS_EMPTY)})):(this._setUploadFileType(ls),this.uploadByCOS(e)):Za(new za({code:ua.MESSAGE_AUDIO_UPLOAD_FAIL,message:la.MESSAGE_AUDIO_UPLOAD_FAIL}))}},{key:"uploadByCOS",value:function(e){var t=this,o="".concat(this._className,".uploadByCOS");if(!ot(this._cosUploadMethod))return be.warn("".concat(o," 没有检测到上传插件,将无法发送图片、音频、视频、文件等类型的消息。详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#registerPlugin")),Za({code:ua.COS_UNDETECTED,message:la.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var n=new Ca(Da.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||Qe(c.files)&&c.files[0].error){var d=new za({code:ua.MESSAGE_FILE_UPLOAD_FAIL,message:la.MESSAGE_FILE_UPLOAD_FAIL});return n.setError(d,!0,t.getNetworkType()).end(),be.log("".concat(o," failed. error:"),c.files[0].error),403===c.files[0].error.statusCode&&(be.warn("".concat(o," 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,g=u._formatFileSize(s.size),_=u._formatSpeed(1e3*s.size/p),h="size:".concat(g," time:").concat(p,"ms speed:").concat(_);be.log("".concat(o," success. name:").concat(s.name," ").concat(h)),r(l);var f=t.getModule(Do);return f.addCost(ma,p),f.addFileSize(ma,s.size),void n.setNetworkType(t.getNetworkType()).setMessage(h).end()}var m=new za({code:ua.MESSAGE_FILE_UPLOAD_FAIL,message:la.MESSAGE_FILE_UPLOAD_FAIL});n.setError(m,!0,u.getNetworkType()).end(),be.warn("".concat(o," failed. error:"),e),403===e.statusCode&&(be.warn("".concat(o," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),i(m)}))}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,o="".concat(this._className,"._uploadWithPreSigUrl"),n=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(a,s){var r=new Ca(Da.UPLOAD),i=e.requestSnapshotUrl,c=void 0===i?void 0:i,u=g(e,ar),l=Date.now();t._cosUploadMethod(u,(function(e,i){var u=Object.create(null);if(e||403===i.statusCode)return r.setError(new za(e),!0,t.getNetworkType()).end(),be.log("".concat(o," failed, error:"),e),void s(new za({code:ua.MESSAGE_FILE_UPLOAD_FAIL,message:la.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=n.name,u.fileSize=n.size,u.fileType=n.type.slice(n.type.indexOf("/")+1).toLowerCase(),u.location=d;var p=Date.now()-l,g=t._formatFileSize(n.size),_=t._formatSpeed(1e3*n.size/p),h="size:".concat(g,",time:").concat(p,"ms,speed:").concat(_," res:").concat(JSON.stringify(i.data));be.log("".concat(o," success name:").concat(n.name,",").concat(h)),r.setNetworkType(t.getNetworkType()).setMessage(h).end();var f=t.getModule(Do);if(f.addCost(ma,p),f.addFileSize(ma,n.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 Qe(e.file.files)||(t=e.file.files,"filelist"===at(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?Ut(e/1024,1)+"KB/s":Ut(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var t=this._getFile(e),o=t.name,n=o.slice(o.lastIndexOf(".")),a=this._genFileName("".concat(dt(999999)).concat(n));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(o){be.warn("onProgress callback error:",o)}},onFileFinish:function(e,t,o){}}}},{key:"_createCosOptionsWXMiniApp",value:function(e){var t=this._getFile(e),o=this._genFileName(t.name),n=t.url;return{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(o),FilePath:n,onProgress:function(t){if(be.log(JSON.stringify(t)),"function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(o){be.warn("onProgress callback error:",o)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var t=this,o="",n="",a=0,s=this._getFile(e);if(te)o=this._genFileName(s.name),n=s.url,a=1;else{var r=s.name,i=r.slice(r.lastIndexOf("."));o=this._genFileName("".concat(dt(999999)).concat(i)),n=s,a=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:o,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:o,resources:n,downloadUrl:r,requestSnapshotUrl:c,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(o){be.warn("onProgress callback error:",o),be.error(o)}}}}))}},{key:"_genFileName",value:function(e){return"".concat(Ot(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e){var t=this,o=new Ca(Da.GET_SNAPSHOT_INFO);return this.request({protocolName:Kn,requestData:{platform:this.getPlatform(),coverName:this._genFileName(dt(99999)),requestSnapshotUrl:e}}).then((function(e){var t=(e.data||{}).snapshotUrl;return o.setMessage("snapshotUrl:".concat(t)).end(),Bt(t)?{}:At(t).then((function(e){return{snapshotUrl:t,snapshotWidth:e.width,snapshotHeight:e.height}}))})).catch((function(e){return be.warn("".concat(t._className,"._getSnapshotInfoByUrl failed. error:"),e),o.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}}))}},{key:"reset",value:function(){be.log("".concat(this._className,".reset"))}}]),a}(Ao),rr=["downloadKey","pbDownloadKey","messageList"],ir=function(){function e(t){n(this,e),this._className="MergerMessageHandler",this._messageModule=t}return s(e,[{key:"uploadMergerMessage",value:function(e,t){var o=this;be.debug("".concat(this._className,".uploadMergerMessage message:"),e,"messageBytes:".concat(t));var n=e.payload.messageList,a=n.length,s=new Ca(Da.UPLOAD_MERGER_MESSAGE);return this._messageModule.request({protocolName:$n,requestData:{messageList:n}}).then((function(e){be.debug("".concat(o._className,".uploadMergerMessage ok. response:"),e.data);var n=e.data,r=n.pbDownloadKey,i=n.downloadKey,c={pbDownloadKey:r,downloadKey:i,messageNumber:a};return s.setNetworkType(o._messageModule.getNetworkType()).setMessage("".concat(a,"-").concat(t,"-").concat(i)).end(),c})).catch((function(e){throw be.warn("".concat(o._className,".uploadMergerMessage failed. error:"),e),o._messageModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),e}))}},{key:"downloadMergerMessage",value:function(e){var o=this;be.debug("".concat(this._className,".downloadMergerMessage message:"),e);var n=e.payload.downloadKey,a=new Ca(Da.DOWNLOAD_MERGER_MESSAGE);return a.setMessage("downloadKey:".concat(n)),this._messageModule.request({protocolName:zn,requestData:{downloadKey:n}}).then((function(n){if(be.debug("".concat(o._className,".downloadMergerMessage ok. response:"),n.data),ot(e.clearElement)){var s=e.payload,r=(s.downloadKey,s.pbDownloadKey,s.messageList,g(s,rr));e.clearElement(),e.setElement({type:e.type,content:t({messageList:n.data.messageList},r)})}else{var i=[];n.data.messageList.forEach((function(e){if(!Bt(e)){var t=new qa(e);i.push(t)}})),e.payload.messageList=i,e.payload.downloadKey="",e.payload.pbDownloadKey=""}return a.setNetworkType(o._messageModule.getNetworkType()).end(),e})).catch((function(e){throw be.warn("".concat(o._className,".downloadMergerMessage failed. key:").concat(n," error:"),e),o._messageModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),e}))}},{key:"createMergerMessagePack",value:function(e,t,o){return e.conversationType===D.CONV_C2C?this._createC2CMergerMessagePack(e,t,o):this._createGroupMergerMessagePack(e,t,o)}},{key:"_createC2CMergerMessagePack",value:function(e,t,o){var n=null;t&&(t.offlinePushInfo&&(n=t.offlinePushInfo),!0===t.onlineUserOnly&&(n?n.disablePush=!0:n={disablePush:!0}));var a="";ze(e.cloudCustomData)&&e.cloudCustomData.length>0&&(a=e.cloudCustomData);var s=o.pbDownloadKey,r=o.downloadKey,i=o.messageNumber,c=e.payload,u=c.title,l=c.abstractList,d=c.compatibleText,p=this._messageModule.getModule(so);return{protocolName:Uo,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: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}}}},{key:"_createGroupMergerMessagePack",value:function(e,t,o){var n=null;t&&t.offlinePushInfo&&(n=t.offlinePushInfo);var a="";ze(e.cloudCustomData)&&e.cloudCustomData.length>0&&(a=e.cloudCustomData);var s=o.pbDownloadKey,r=o.downloadKey,i=o.messageNumber,c=e.payload,u=c.title,l=c.abstractList,d=c.compatibleText,p=this._messageModule.getModule(ro);return{protocolName:bo,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: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,clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||p.isMessageFromOrToAVChatroom(e.to)?0:1}}}}]),e}(),cr={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},ur=[ua.MESSAGE_ONPROGRESS_FUNCTION_ERROR,ua.MESSAGE_IMAGE_SELECT_FILE_FIRST,ua.MESSAGE_IMAGE_TYPES_LIMIT,ua.MESSAGE_FILE_IS_EMPTY,ua.MESSAGE_IMAGE_SIZE_LIMIT,ua.MESSAGE_FILE_SELECT_FILE_FIRST,ua.MESSAGE_FILE_SIZE_LIMIT,ua.MESSAGE_VIDEO_SIZE_LIMIT,ua.MESSAGE_VIDEO_TYPES_LIMIT,ua.MESSAGE_AUDIO_UPLOAD_FAIL,ua.MESSAGE_AUDIO_SIZE_LIMIT,ua.COS_UNDETECTED];var lr=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="MessageModule",t._messageOptionsMap=new Map,t._mergerMessageHandler=new ir(_(t)),t}return s(a,[{key:"createTextMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Ba(e),n="string"==typeof e.payload?e.payload:e.payload.text,a=new Na({text:n}),s=this._getNickAndAvatarByUserID(t);return o.setElement(a),o.setNickAndAvatar(s),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"createImageMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Ba(e);if(te){var n=e.payload.file;if(je(n))return void be.warn("小程序环境下调用 createImageMessage 接口时,payload.file 不支持传入 File 对象");var a=n.tempFilePaths[0],s={url:a,name:a.slice(a.lastIndexOf("/")+1),size:n.tempFiles&&n.tempFiles[0].size||1,type:a.slice(a.lastIndexOf(".")+1).toLowerCase()};e.payload.file=s}else if(oe)if(je(e.payload.file)){var r=e.payload.file;e.payload.file={files:[r]}}else if(Xe(e.payload.file)&&"undefined"!=typeof uni){var i=e.payload.file.tempFiles[0];e.payload.file={files:[i]}}var c=new Aa({imageFormat:we.UNKNOWN,uuid:this._generateUUID(),file:e.payload.file}),u=this._getNickAndAvatarByUserID(t);return o.setElement(c),o.setNickAndAvatar(u),o.setNameCard(this._getNameCardByGroupID(o)),this._messageOptionsMap.set(o.clientSequence,e),o}},{key:"createAudioMessage",value:function(e){var t=e.payload.file;if(te){var o={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=o}var n=this.getMyUserID();e.currentUser=n,e.senderTinyID=this.getMyTinyID();var a=new Ba(e),s=new Ra({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size,url:t.tempFilePath,uuid:this._generateUUID()}),r=this._getNickAndAvatarByUserID(n);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 o={};if(te){if(Q)return void be.warn("createVideoMessage 不支持在支付宝小程序环境下使用");if(je(e.payload.file))return void be.warn("小程序环境下调用 createVideoMessage 接口时,payload.file 不支持传入 File 对象");var n=e.payload.file;o.url=n.tempFilePath,o.name=n.tempFilePath.slice(n.tempFilePath.lastIndexOf("/")+1),o.size=n.size,o.second=n.duration,o.type=n.tempFilePath.slice(n.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else if(oe){if(je(e.payload.file)){var a=e.payload.file;e.payload.file.files=[a]}else if(Xe(e.payload.file)&&"undefined"!=typeof uni){var s=e.payload.file.tempFile;e.payload.file.files=[s]}var r=e.payload.file;o.url=window.URL.createObjectURL(r.files[0]),o.name=r.files[0].name,o.size=r.files[0].size,o.second=r.files[0].duration||0,o.type=r.files[0].type.split("/")[1]}e.payload.file.videoFile=o;var i=new Ba(e),c=new wa({videoFormat:o.type,videoSecond:Ut(o.second,0),videoSize:o.size,remoteVideoUrl:"",videoUrl:o.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 o=new Ba(e),n=new ba({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),a=this._getNickAndAvatarByUserID(t);return o.setElement(n),o.setNickAndAvatar(a),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"createFaceMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Ba(e),n=new Oa(e.payload),a=this._getNickAndAvatarByUserID(t);return o.setElement(n),o.setNickAndAvatar(a),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"createMergerMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=this._getNickAndAvatarByUserID(t),n=new Ba(e),a=new Va(e.payload);return n.setElement(a),n.setNickAndAvatar(o),n.setNameCard(this._getNameCardByGroupID(n)),n.setRelayFlag(!0),n}},{key:"createForwardMessage",value:function(e){var t=e.to,o=e.conversationType,n=e.priority,a=e.payload,s=e.needReadReceipt,r=this.getMyUserID(),i=this._getNickAndAvatarByUserID(r);if(a.type===D.MSG_GRP_TIP)return Za(new za({code:ua.MESSAGE_FORWARD_TYPE_INVALID,message:la.MESSAGE_FORWARD_TYPE_INVALID}));var c={to:t,conversationType:o,conversationID:"".concat(o).concat(t),priority:n,isPlaceMessage:0,status:Yt.UNSEND,currentUser:r,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||a.cloudCustomData||"",needReadReceipt:s},u=new Ba(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 o,n="createFileMessage 接口不可用!";if(!$&&!z&&!Z)return void be.warn("小程序目前不支持选择文件,".concat(n));var a=ne.getSystemInfoSync().SDKVersion;if($&&Lt(a,o="2.5.0")<0)return void be.warn("wx.chooseMessageFile 需要基础库".concat(o,"或更高版本,").concat(n));if(z&&Lt(a,o="1.18.0")<0)return void be.warn("qq.chooseMessageFile 需要基础库".concat(o,"或更高版本,").concat(n))}if(oe||Z){if(je(e.payload.file)){var s=e.payload.file;e.payload.file={files:[s]}}else if(Xe(e.payload.file)&&"undefined"!=typeof uni){var r=e.payload.file,i=r.tempFiles,c=r.files,u=null;Qe(i)?u=i[0]:Qe(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 g=new Ba(e),_=new Ua({uuid:this._generateUUID(),file:e.payload.file}),h=this._getNickAndAvatarByUserID(p);return g.setElement(_),g.setNickAndAvatar(h),g.setNameCard(this._getNameCardByGroupID(g)),this._messageOptionsMap.set(g.clientSequence,e),g}},{key:"createLocationMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Ba(e),n=new Fa(e.payload),a=this._getNickAndAvatarByUserID(t);return o.setElement(n),o.setNickAndAvatar(a),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"_onCannotFindModule",value:function(){return Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"sendMessageInstance",value:function(e,t){var o,n=this,a=null;switch(e.conversationType){case D.CONV_C2C:if(!(a=this.getModule(so)))return this._onCannotFindModule();break;case D.CONV_GROUP:if(!(a=this.getModule(ro)))return this._onCannotFindModule();if(Et({groupID:e.to})){var s=a.getLocalGroupProfile(e.to);if(s&&s.isSupportTopic)return Za({code:ua.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL,message:la.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL});if(!Ze(t)&&!Ze(t.messageControlInfo))return Za({code:ua.MESSAGE_CONTROL_INFO_FAIL,message:la.MESSAGE_CONTROL_INFO_FAIL})}break;default:return Za({code:ua.MESSAGE_SEND_INVALID_CONVERSATION_TYPE,message:la.MESSAGE_SEND_INVALID_CONVERSATION_TYPE})}var r=this.getModule(mo),i=this.getModule(ro);return r.upload(e).then((function(){n._getSendMessageSpecifiedKey(e)===fa&&n.getModule(Do).addSuccessCount(ma);return i.guardForAVChatRoom(e).then((function(){if(!e.isSendable())return Za({code:ua.MESSAGE_FILE_URL_IS_EMPTY,message:la.MESSAGE_FILE_URL_IS_EMPTY});n._addSendMessageTotalCount(e),o=Date.now();var s=function(e){var t="utf-8";oe&&document&&(t=document.charset.toLowerCase());var o,n,a=0;if(n=e.length,"utf-8"===t||"utf8"===t)for(var s=0;s<n;s++)(o=e.codePointAt(s))<=127?a+=1:o<=2047?a+=2:o<=65535?a+=3:(a+=4,s++);else if("utf-16"===t||"utf16"===t)for(var r=0;r<n;r++)(o=e.codePointAt(r))<=65535?a+=2:(a+=4,r++);else a=e.replace(/[^\x00-\xff]/g,"aa").length;return a}(JSON.stringify(e));return e.type===D.MSG_MERGER&&s>7e3?n._mergerMessageHandler.uploadMergerMessage(e,s).then((function(o){var a=n._mergerMessageHandler.createMergerMessagePack(e,t,o);return n.request(a)})):(n.getModule(lo).setMessageRandom(e),e.conversationType===D.CONV_C2C||e.conversationType===D.CONV_GROUP?a.sendMessage(e,t):void 0)})).then((function(s){var r=s.data,i=r.time,c=r.sequence,u=r.readReceiptCode;$e(u)&&0!==u&&(new Ca(Da.SEND_MESSAGE_WITH_RECEIPT).setMessage("from:".concat(e.from," to:").concat(e.to," sequence:").concat(c," readReceiptCode:").concat(u)).end(),be.warn("".concat(n._className,".sendMessageInstance readReceiptCode:").concat(u," message:").concat($a[u])));n._addSendMessageSuccessCount(e,o),n._messageOptionsMap.delete(e.clientSequence);var l=n.getModule(lo);e.status=Yt.SUCCESS,e.time=i;var d=!1;if(e.conversationType===D.CONV_GROUP)e.sequence=c;else if(e.conversationType===D.CONV_C2C){var p=l.getLatestMessageSentByMe(e.conversationID);if(p){var g=p.nick,_=p.avatar;g===e.nick&&_===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;Xe(t)&&Xe(t.messageControlInfo)&&(!0===t.messageControlInfo.excludedFromLastMessage&&(e._isExcludedFromLastMessage=!0,h=""),!0===t.messageControlInfo.excludedFromUnreadCount&&(e._isExcludedFromUnreadCount=!0));var f=e.conversationType;if(Tt(e.to))f=D.CONV_TOPIC,n.getModule(uo).onMessageSent({groupID:Ft(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||Gt(e.payload.imageInfoArray),Ha({message:e})}))})).catch((function(t){return n._onSendMessageFailed(e,t)}))}},{key:"_onSendMessageFailed",value:function(e,t){e.status=Yt.FAIL,this.getModule(lo).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var o=new Ca(Da.SEND_MESSAGE);return o.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 n=m(e,2),a=n[0],s=n[1];o.setError(t,a,s).end()})),be.error("".concat(this._className,"._onSendMessageFailed error:"),t),Za(new za({code:t&&t.code?t.code:ua.MESSAGE_SEND_FAIL,message:t&&t.message?t.message:la.MESSAGE_SEND_FAIL,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([D.MSG_IMAGE,D.MSG_AUDIO,D.MSG_VIDEO,D.MSG_FILE].includes(e.type))return fa;if(e.conversationType===D.CONV_C2C)return ga;if(e.conversationType===D.CONV_GROUP){var t=this.getModule(ro).getLocalGroupProfile(e.to);if(!t)return;var o=t.type;return yt(o)?ha:_a}}},{key:"_addSendMessageTotalCount",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule(Do).addTotalCount(t)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var o=Math.abs(Date.now()-t),n=this._getSendMessageSpecifiedKey(e);if(n){var a=this.getModule(Do);a.addSuccessCount(n),a.addCost(n,o)}}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var o,n,a=t.code,s=void 0===a?-1:a,r=this.getModule(Do),i=this._getSendMessageSpecifiedKey(e);i===fa&&(o=s,n=!1,ur.includes(o)&&(n=!0),n)?r.addFailedCountOfUserSide(ma):function(e){var t=!1;return Object.values(cr).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=Yt.UNSEND,this.sendMessageInstance(e)}},{key:"revokeMessage",value:function(e){var t=this,o=null;if(e.conversationType===D.CONV_C2C){if(!(o=this.getModule(so)))return this._onCannotFindModule()}else if(e.conversationType===D.CONV_GROUP&&!(o=this.getModule(ro)))return this._onCannotFindModule();var n=new Ca(Da.REVOKE_MESSAGE);return n.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),o.revokeMessage(e).then((function(o){var a=o.data.recallRetList;if(!Bt(a)&&0!==a[0].retCode){var s=new za({code:a[0].retCode,message:$a[a[0].retCode]||la.MESSAGE_REVOKE_FAIL,data:{message:e}});return n.setCode(s.code).setMoreMessage(s.message).end(),Za(s)}return be.info("".concat(t._className,".revokeMessage ok. ID:").concat(e.ID)),e.isRevoked=!0,n.end(),t.getModule(lo).onMessageRevoked([e]),Ha({message:e})})).catch((function(o){t.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];n.setError(o,a,s).end()}));var a=new za({code:o&&o.code?o.code:ua.MESSAGE_REVOKE_FAIL,message:o&&o.message?o.message:la.MESSAGE_REVOKE_FAIL,data:{message:e}});return be.warn("".concat(t._className,".revokeMessage failed. error:"),o),Za(a)}))}},{key:"deleteMessage",value:function(e){var t=this,o=null,n=e[0],a=n.conversationID,s="",r=[],i=[];if(n.conversationType===D.CONV_C2C)o=this.getModule(so),s=a.replace(D.CONV_C2C,""),e.forEach((function(e){e&&e.status===Yt.SUCCESS&&e.conversationID===a&&(e._onlineOnlyFlag||r.push("".concat(e.sequence,"_").concat(e.random,"_").concat(e.time)),i.push(e))}));else if(n.conversationType===D.CONV_GROUP)o=this.getModule(ro),s=a.replace(D.CONV_GROUP,""),e.forEach((function(e){e&&e.status===Yt.SUCCESS&&e.conversationID===a&&(e._onlineOnlyFlag||r.push("".concat(e.sequence)),i.push(e))}));else if(n.conversationType===D.CONV_SYSTEM)return Za({code:ua.CANNOT_DELETE_GROUP_SYSTEM_NOTICE,message:la.CANNOT_DELETE_GROUP_SYSTEM_NOTICE});if(!o)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 Ca(Da.DELETE_MESSAGE);return c.setMessage("to:".concat(s," count:").concat(r.length)),o.deleteMessage({to:s,keyList:r}).then((function(e){return c.end(),be.info("".concat(t._className,".deleteMessage ok")),t._onMessageDeleted(i)})).catch((function(e){t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),be.warn("".concat(t._className,".deleteMessage failed. error:"),e);var o=new za({code:e&&e.code?e.code:ua.MESSAGE_DELETE_FAIL,message:e&&e.message?e.message:la.MESSAGE_DELETE_FAIL});return Za(o)}))}},{key:"_onMessageDeleted",value:function(e){return this.getModule(lo).onMessageDeleted(e),Qa({messageList:e})}},{key:"modifyRemoteMessage",value:function(e){var t=this,o=null,n=e.conversationType,a=e.to;if(this.getModule(ro).isMessageFromOrToAVChatroom(a))return Za({code:ua.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,message:la.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,data:{message:e}});n===D.CONV_C2C?o=this.getModule(so):n===D.CONV_GROUP&&(o=this.getModule(ro));var s=new Ca(Da.MODIFY_MESSAGE);return s.setMessage("to:".concat(a)),o.modifyRemoteMessage(e).then((function(o){s.end(),be.info("".concat(t._className,".modifyRemoteMessage ok"));var n=t._onModifyRemoteMessageResp(e,o.data);return Ha({message:n})})).catch((function(o){if(s.setCode(o.code).setMoreMessage(o.message).end(),be.warn("".concat(t._className,".modifyRemoteMessage failed. error:"),o),20027===o.code){var n=t._onModifyRemoteMessageResp(e,o.data);return Za({code:ua.MESSAGE_MODIFY_CONFLICT,message:la.MESSAGE_MODIFY_CONFLICT,data:{message:n}})}return Za({code:o.code,message:o.message,data:{message:e}})}))}},{key:"_onModifyRemoteMessageResp",value:function(e,t){be.debug("".concat(this._className,"._onModifyRemoteMessageResp options:"),t);var o=e.conversationType,n=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(lo).onMessageModified({conversationType:o,from:n,to:a,time:i,random:s,sequence:r,elements:c,cloudCustomData:d,messageVersion:u})}},{key:"_generateUUID",value:function(){var e=this.getModule(po);return"".concat(e.getSDKAppID(),"-").concat(e.getUserID(),"-").concat(function(){for(var e="",t=32;t>0;--t)e+=pt[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(ao).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===D.CONV_GROUP){var t=this.getModule(ro);if(t)return t.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._messageOptionsMap.clear()}}]),a}(Ao),dr=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="PluginModule",a.plugins={},a}return s(o,[{key:"registerPlugin",value:function(e){var t=this;Object.keys(e).forEach((function(o){t.plugins[o]=e[o]})),new Ca(Da.REGISTER_PLUGIN).setMessage("key=".concat(Object.keys(e))).end()}},{key:"getPlugin",value:function(e){return this.plugins[e]}},{key:"reset",value:function(){be.log("".concat(this._className,".reset"))}}]),o}(Ao),pr=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="SyncUnreadMessageModule",a._cookie="",a._onlineSyncFlag=!1,a.getInnerEmitterInstance().on(os,a._onLoginSuccess,_(a)),a}return s(o,[{key:"_onLoginSuccess",value:function(e){this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"_startSync",value:function(e){var t=this,o=e.cookie,n=e.syncFlag,a=e.isOnlineSync;be.log("".concat(this._className,"._startSync cookie:").concat(o," syncFlag:").concat(n," isOnlineSync:").concat(a)),this.request({protocolName:Go,requestData:{cookie:o,syncFlag:n,isOnlineSync:a}}).then((function(e){var o=e.data,n=o.cookie,a=o.syncFlag,s=o.eventArray,r=o.messageList,i=o.C2CRemainingUnreadList,c=o.C2CPairUnreadList;if(t._cookie=n,Bt(n));else if(0===a||1===a){if(s)t.getModule(Io).onMessage({head:{},body:{eventArray:s,isInstantMessage:t._onlineSyncFlag,isSyncingEnded:!1}});t.getModule(so).onNewC2CMessage({dataList:r,isInstantMessage:!1,C2CRemainingUnreadList:i,C2CPairUnreadList:c}),t._startSync({cookie:n,syncFlag:a,isOnlineSync:0})}else if(2===a){if(s)t.getModule(Io).onMessage({head:{},body:{eventArray:s,isInstantMessage:t._onlineSyncFlag,isSyncingEnded:!0}});t.getModule(so).onNewC2CMessage({dataList:r,isInstantMessage:t._onlineSyncFlag,C2CRemainingUnreadList:i,C2CPairUnreadList:c})}})).catch((function(e){be.error("".concat(t._className,"._startSync failed. error:"),e)}))}},{key:"startOnlineSync",value:function(){be.log("".concat(this._className,".startOnlineSync")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:1})}},{key:"startSyncOnReconnected",value:function(){be.log("".concat(this._className,".startSyncOnReconnected.")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._onlineSyncFlag=!1,this._cookie=""}}]),o}(Ao),gr={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 _r(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 o;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=hr(e)),e=e.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(function(e,t){return t.toUpperCase()})).replace(/\d+(\w|$)/g,(function(e){return e.toUpperCase()})),o=e,t.pascalCase?o.charAt(0).toUpperCase()+o.slice(1):o)}var hr=function(e){for(var t=!1,o=!1,n=!1,a=0;a<e.length;a++){var s=e[a];t&&/[a-zA-Z]/.test(s)&&s.toUpperCase()===s?(e=e.slice(0,a)+"-"+e.slice(a),t=!1,n=o,o=!0,a++):o&&n&&/[a-zA-Z]/.test(s)&&s.toLowerCase()===s?(e=e.slice(0,a-1)+"-"+e.slice(a-1),n=o,o=!1,t=!0):(t=s.toLowerCase()===s&&s.toUpperCase()!==s,n=o,o=s.toUpperCase()===s&&s.toLowerCase()!==s)}return e};function fr(e,t){var o=0;return function e(t,n){if(++o>100)return o--,t;if(Qe(t)){var a=t.map((function(t){return Je(t)?e(t,n):t}));return o--,a}if(Je(t)){var s=(r=t,i=function(e,t){if(!st(t))return!1;if((a=t)!==_r(a))for(var o=0;o<gr.ignoreKeyWord.length&&!t.includes(gr.ignoreKeyWord[o]);o++);var a;return Ze(n[t])?function(e){return"OPPOChannelID"===e?e:e[0].toUpperCase()+_r(e).slice(1)}(t):n[t]},c=Object.create(null),Object.keys(r).forEach((function(e){var t=i(r[e],e);t&&(c[t]=r[e])})),c);return s=Nt(s,(function(t,o){return Qe(t)||Je(t)?e(t,n):t})),o--,s}var r,i,c}(e,t)}function mr(e,t){if(Qe(e))return e.map((function(e){return Je(e)?mr(e,t):e}));if(Je(e)){var o=(n=e,a=function(e,o){return Ze(t[o])?_r(o):t[o]},s={},Object.keys(n).forEach((function(e){s[a(n[e],e)]=n[e]})),s);return o=Nt(o,(function(e){return Qe(e)||Je(e)?mr(e,t):e}))}var n,a,s}var Mr=String.fromCharCode,vr=function(e){var t=0|e.charCodeAt(0);if(55296<=t)if(t<56320){var o=0|e.charCodeAt(1);if(56320<=o&&o<=57343){if((t=(t<<10)+o-56613888|0)>65535)return Mr(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?Mr(192|t>>>6,128|63&t):Mr(224|t>>>12,128|t>>>6&63,128|63&t)},Ir=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,vr),o=0|t.length,n=new Uint8Array(o),a=0;a<o;a=a+1|0)n[a]=0|t.charCodeAt(a);return n},yr=function(e){for(var t=new Uint8Array(e),o="",n=0,a=t.length;n<a;){var s=t[n],r=0,i=0;if(s<=127?(r=0,i=255&s):s<=223?(r=1,i=31&s):s<=239?(r=2,i=15&s):s<=244&&(r=3,i=7&s),a-n-r>0)for(var c=0;c<r;)i=i<<6|63&(s=t[n+c+1]),c+=1;else i=65533,r=a-n;o+=String.fromCodePoint(i),n+=r+1}return o},Er=function(){function e(t){n(this,e),this._handler=t;var o=t.getURL();if(this._socket=null,this._workerSocket=null,this._id=dt(),this._handler.getIsWorkerEnabled()){var a=URL.createObjectURL(new Blob([';let _socket = null;onmessage = function(event) { if (event.data.cmd === "start") { const url = event.data.url; _socket = new WebSocket(url); _socket.binaryType = "arraybuffer"; _socket.onopen = function() { postMessage({ callback: "onOpen" }); }; _socket.onclose = function(e) { postMessage({ callback: "onOpen", e: { code: e.code, reason: e.reason } }); }; _socket.onmessage = function(e) { postMessage({ callback: "onMessage", data: e.data }); }; _socket.onerror = function(e) { postMessage({ callback: "onError", e: { isTrusted: "true" } }); }; } else if (event.data.cmd === "sendMessage") { if (_socket !== null) { _socket.send(event.data.data); } } else if (event.data.cmd === "stop") { if (_socket !== null) { _socket.close(event.data.code); _socket = null; } }};'],{type:"application/javascript; charset=utf-8"}));this._workerSocket=new Worker(a);var s=this;this._workerSocket.onmessage=function(e){var t=e.data,o=t.callback,n=t.e;"onOpen"===o?s._onOpen():"onClose"===o?s._onClose(n):"onError"===o?s._onError(n):"onMessage"===o&&s._onMessage(e.data)},this._workerSocket.postMessage({cmd:"start",id:this._id,url:o})}else te?Q?(ne.connectSocket({url:o,header:{"content-type":"application/json"}}),ne.onSocketClose(this._onClose.bind(this)),ne.onSocketOpen(this._onOpen.bind(this)),ne.onSocketMessage(this._onMessage.bind(this)),ne.onSocketError(this._onError.bind(this))):(this._socket=ne.connectSocket({url:o,header:{"content-type":"application/json"},complete:function(){}}),this._socket.onClose(this._onClose.bind(this)),this._socket.onOpen(this._onOpen.bind(this)),this._socket.onMessage(this._onMessage.bind(this)),this._socket.onError(this._onError.bind(this))):oe&&(this._socket=new WebSocket(o),this._socket.binaryType="arraybuffer",this._socket.onopen=this._onOpen.bind(this),this._socket.onmessage=this._onMessage.bind(this),this._socket.onclose=this._onClose.bind(this),this._socket.onerror=this._onError.bind(this));this._canIUseBinaryFrame=t.canIUseBinaryFrame()}return s(e,[{key:"getID",value:function(){return this._id}},{key:"_onOpen",value:function(){this._handler.onOpen({id:this._id})}},{key:"_onClose",value:function(e){this._handler.onClose({id:this._id,e:e})}},{key:"_onMessage",value:function(e){this._handler.onMessage({data:this._canIUseBinaryFrame?yr(e.data):e.data})}},{key:"_onError",value:function(e){this._handler.onError({id:this._id,e:e})}},{key:"setIsWorkerEnabled",value:function(e){this._isWorkerEnabled=!0}},{key:"close",value:function(e){if(this._workerSocket&&(this._workerSocket.postMessage({cmd:"stop",code:e}),this._workerSocket.terminate(),this._workerSocket=null),Q)return ne.offSocketClose(),ne.offSocketMessage(),ne.offSocketOpen(),ne.offSocketError(),void ne.closeSocket();this._socket&&(te?(this._socket.onClose((function(){})),this._socket.onOpen((function(){})),this._socket.onMessage((function(){})),this._socket.onError((function(){}))):oe&&(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null),X?this._socket.close({code:e}):this._socket.close(e),this._socket=null)}},{key:"send",value:function(e){if(this._workerSocket)this._workerSocket.postMessage({cmd:"sendMessage",data:this._canIUseBinaryFrame?Ir(e.data).buffer:e.data});else{if(Q)return void ne.sendSocketMessage({data:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}});this._socket&&(te?this._socket.send({data:this._canIUseBinaryFrame?Ir(e.data).buffer:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}}):oe&&this._socket.send(this._canIUseBinaryFrame?Ir(e.data).buffer:e.data))}}}]),e}(),Tr=4e3,Sr=4001,Cr=["keyMap"],Dr=["keyMap"],Nr="connected",Ar="connecting",Or="disconnected",Rr=function(){function e(t){n(this,e),this._channelModule=t,this._className="SocketHandler",this._promiseMap=new Map,this._readyState=Or,this._simpleRequestMap=new Map,this.MAX_SIZE=100,this._startSequence=dt(),this._startTs=0,this._reConnectFlag=!1,this._nextPingTs=0,this._reConnectCount=0,this.MAX_RECONNECT_COUNT=3,this._socketID=-1,this._random=0,this._socket=null,this._url="",this._onOpenTs=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0,this._setWebsocketHost(),this._initConnection()}return s(e,[{key:"_setWebsocketHost",value:function(){var e=this._channelModule.getModule(po),t=b;this._channelModule.isOversea()&&(t=w),e.isSingaporeSite()?t=F:e.isKoreaSite()?t=q:e.isGermanySite()?t=V:e.isIndiaSite()&&(t=K),B.HOST.setCurrent(t)}},{key:"_initConnection",value:function(){Ze(B.HOST.CURRENT.BACKUP)||""===this._url?this._url=B.HOST.CURRENT.DEFAULT:this._url===B.HOST.CURRENT.DEFAULT?this._url=B.HOST.CURRENT.BACKUP:this._url===B.HOST.CURRENT.BACKUP&&(this._url=B.HOST.CURRENT.DEFAULT);var e=this._channelModule.getModule(po).getProxyServer();Bt(e)||(this._url=e),this._connect(),this._nextPingTs=0}},{key:"onCheckTimer",value:function(e){e%1==0&&this._checkPromiseMap()}},{key:"_checkPromiseMap",value:function(){var e=this;0!==this._promiseMap.size&&this._promiseMap.forEach((function(t,o){var n=t.reject,a=t.timestamp,s=15e3;-1!==o.indexOf(Oo)&&(s=9e4),Date.now()-a>=s&&(be.log("".concat(e._className,"._checkPromiseMap request timeout, delete requestID:").concat(o)),e._promiseMap.delete(o),n(new za({code:ua.NETWORK_TIMEOUT,message:la.NETWORK_TIMEOUT})),e._channelModule.onRequestTimeout(o))}))}},{key:"onOpen",value:function(e){if(""!==this._readyState){this._onOpenTs=Date.now();var t=e.id;this._socketID=t;var o=Date.now()-this._startTs;be.log("".concat(this._className,"._onOpen cost ").concat(o," ms. socketID:").concat(t)),new Ca(Da.WS_ON_OPEN).setMessage(o).setCostTime(o).setMoreMessage("socketID:".concat(t)).end(),e.id===this._socketID&&(this._readyState=Nr,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 Ca(Da.WS_ON_CLOSE),o=e.id,n=e.e,a="sourceSocketID:".concat(o," currentSocketID:").concat(this._socketID," code:").concat(n.code," reason:").concat(n.reason),s=0;0!==this._onOpenTs&&(s=Date.now()-this._onOpenTs),t.setMessage(s).setCostTime(s).setMoreMessage(a).setCode(n.code).end(),be.log("".concat(this._className,"._onClose ").concat(a," onlineTime:").concat(s)),o===this._socketID&&(this._readyState=Or,s<1e3?this._channelModule.onReconnectFailed():this._channelModule.onClose())}},{key:"onError",value:function(e){var t=e.id,o=e.e,n="sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID);new Ca(Da.WS_ON_ERROR).setMessage(o.errMsg||ut(o)).setMoreMessage(n).setLevel("error").end(),be.warn("".concat(this._className,"._onError"),o,n),t===this._socketID&&(this._readyState="",this._channelModule.onError())}},{key:"onMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(u){new Ca(Da.JSON_PARSE_ERROR).setMessage(e.data).end()}if(t&&t.head){var o=this._getRequestIDFromHead(t.head),n=Pt(t.head),a=mr(t.body,this._getResponseKeyMap(n));if(be.debug("".concat(this._className,".onMessage ret:").concat(JSON.stringify(a)," requestID:").concat(o," has:").concat(this._promiseMap.has(o))),this._setNextPingTs(),this._promiseMap.has(o)){var s=this._promiseMap.get(o),r=s.resolve,i=s.reject,c=s.timestamp;return this._promiseMap.delete(o),this._calcRTT(c),void(a.errorCode&&0!==a.errorCode?(this._channelModule.onErrorCodeNotZero(a),i(new za({code:a.errorCode,message:a.errorInfo||"",data:{elements:a.elements,messageVersion:a.messageVersion,cloudCustomData:a.cloudCustomData}}))):r(Ha(a)))}this._channelModule.onMessage({head:t.head,body:a})}}},{key:"_calcRTT",value:function(e){var t=Date.now()-e;this._channelModule.getModule(Do).addRTT(t)}},{key:"_connect",value:function(){this._startTs=Date.now(),this._onOpenTs=0,this._socket=new Er(this),this._socketID=this._socket.getID(),this._readyState=Ar,be.log("".concat(this._className,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new Ca(Da.WS_CONNECT).setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end()}},{key:"getURL",value:function(){var e=this._channelModule.getModule(po);e.isDevMode()&&(this._canIUseBinaryFrame=!1);var t=Rt();(Q||$&&"windows"===t||Z)&&(this._canIUseBinaryFrame=!1);var o=-1;"ios"===t?o=de||-1:"android"===t&&(o=ge||-1);var n=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(n,"&host=").concat(t,"&version=").concat(o):"".concat(this._url,"/info?sdkappid=").concat(a,"&instanceid=").concat(s,"&random=").concat(this._getRandom(),"&platform=").concat(n,"&host=").concat(t,"&version=").concat(o)}},{key:"_closeConnection",value:function(e){be.log("".concat(this._className,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=Or)}},{key:"_resend",value:function(){var e=this;if(be.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,o){var n=t.uplinkData,a=t.resolve,s=t.reject;e._promiseMap.set(o,{resolve:a,reject:s,timestamp:Date.now(),uplinkData:n}),e._execute(o,n)})),this._simpleRequestMap.size>0){var t,o=S(this._simpleRequestMap);try{for(o.s();!(t=o.n()).done;){var n=m(t.value,2),a=n[0],s=n[1];this._execute(a,s)}}catch(r){o.e(r)}finally{o.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 o=g(e,Cr),n=this._getRequestIDFromHead(e.head),a=JSON.stringify(o);return new Promise((function(e,s){(t._promiseMap.set(n,{resolve:e,reject:s,timestamp:Date.now(),uplinkData:a}),be.debug("".concat(t._className,".send uplinkData:").concat(JSON.stringify(o)," requestID:").concat(n," readyState:").concat(t._readyState)),t._readyState!==Nr)?t._reConnect():(t._execute(n,a),t._channelModule.getModule(Do).addRequestCount())}))}},{key:"simplySend",value:function(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3);e.keyMap;var t=g(e,Dr),o=this._getRequestIDFromHead(e.head),n=JSON.stringify(t);this._readyState!==Nr?(this._simpleRequestMap.size<this.MAX_SIZE?this._simpleRequestMap.set(o,n):be.log("".concat(this._className,".simplySend. simpleRequestMap is full, drop request!")),this._reConnect()):this._execute(o,n)}},{key:"_execute",value:function(e,t){this._socket.send({data:t,fail:te?this._onSendFail.bind(this):void 0,requestID:e})}},{key:"_onSendFail",value:function(e){be.log("".concat(this._className,"._onSendFail requestID:").concat(e))}},{key:"_getSequence",value:function(){var e;if(this._startSequence<2415919103)return e=this._startSequence,this._startSequence+=1,2415919103===this._startSequence&&(this._startSequence=dt()),e}},{key:"_getRequestIDFromHead",value:function(e){return e.servcmd+e.seq}},{key:"_getResponseKeyMap",value:function(e){var o=this._channelModule.getKeyMap(e);return t(t({},gr.response),o.response)}},{key:"_reConnect",value:function(){this._readyState!==Nr&&this._readyState!==Ar&&this.forcedReconnect()}},{key:"forcedReconnect",value:function(){var e=this;be.log("".concat(this._className,".forcedReconnect count:").concat(this._reConnectCount," readyState:").concat(this._readyState)),this._reConnectFlag=!0,this._resetRandom(),this._reConnectCount<this.MAX_RECONNECT_COUNT?(this._reConnectCount+=1,this._closeConnection(Sr),this._initConnection()):(this._reConnectCount=0,this._channelModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0];o[1];n?(be.warn("".concat(e._className,".forcedReconnect disconnected from wsserver but network is ok, continue...")),e._closeConnection(Sr),e._initConnection()):e._channelModule.onReconnectFailed()})))}},{key:"getReconnectFlag",value:function(){return this._reConnectFlag}},{key:"_setNextPingTs",value:function(){this._nextPingTs=Date.now()+1e4}},{key:"getNextPingTs",value:function(){return this._nextPingTs}},{key:"isConnected",value:function(){return this._readyState===Nr}},{key:"canIUseBinaryFrame",value:function(){return this._canIUseBinaryFrame}},{key:"setIsWorkerEnabled",value:function(e){be.log("".concat(this._className,".setIsWorkerEnabled flag:").concat(e)),this._isWorkerEnabled=e}},{key:"getIsWorkerEnabled",value:function(){return this._isWorkerEnabled&&Ee}},{key:"_getRandom",value:function(){return 0===this._random&&(this._random=Math.random()),this._random}},{key:"_resetRandom",value:function(){this._random=0}},{key:"close",value:function(){be.log("".concat(this._className,".close")),this._closeConnection(Tr),this._promiseMap.clear(),this._startSequence=dt(),this._readyState=Or,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}]),e}(),Lr=function(e){i(o,e);var t=f(o);function o(e){var a;if(n(this,o),(a=t.call(this,e))._className="ChannelModule",a._socketHandler=new Rr(_(a)),a._probing=!1,a._isAppShowing=!0,a._previousState=D.NET_STATE_CONNECTED,te&&"function"==typeof ne.onAppShow&&"function"==typeof ne.onAppHide){var s=a._onAppHide.bind(_(a)),r=a._onAppShow.bind(_(a));"function"==typeof ne.offAppHide&&ne.offAppHide(s),"function"==typeof ne.offAppShow&&ne.offAppShow(r),ne.onAppHide(s),ne.onAppShow(r)}return a._timerForNotLoggedIn=-1,a._timerForNotLoggedIn=setInterval(a.onCheckTimer.bind(_(a)),1e3),a._fatalErrorFlag=!1,a}return s(o,[{key:"onCheckTimer",value:function(e){this._socketHandler&&(this.isLoggedIn()?(this._timerForNotLoggedIn>0&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:"onErrorCodeNotZero",value:function(e){this.getModule(Io).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.getModule(Io).onMessage(e)}},{key:"send",value:function(e){return this._socketHandler?this._previousState!==D.NET_STATE_CONNECTED&&e.head.servcmd.includes(Bn)?(this.reConnect(),this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:"_sendLogViaHTTP",value:function(e){var t=B.HOST.CURRENT.STAT;return new Promise((function(o,n){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)ne.request({url:a,data:s,method:"POST",timeout:3e3,header:{"content-type":r},success:function(){o()},fail:function(){n(new za({code:ua.NETWORK_ERROR,message:la.NETWORK_ERROR}))}});else{var i=new XMLHttpRequest,c=setTimeout((function(){i.abort(),n(new za({code:ua.NETWORK_TIMEOUT,message:la.NETWORK_TIMEOUT}))}),3e3);i.onreadystatechange=function(){4===i.readyState&&(clearTimeout(c),200===i.status||304===i.status?o():n(new za({code:ua.NETWORK_ERROR,message:la.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(D.NET_STATE_DISCONNECTED));this.reConnect()}},{key:"onError",value:function(){te&&!Z&&be.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(D.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.getModule(Io).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(){be.log("".concat(this._className,".onReconnected")),this.getModule(Io).onReconnected(),this._emitNetStateChangeEvent(D.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){be.log("".concat(this._className,".onReconnectFailed")),this._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(D.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 o="forcedFlag:".concat(e," fatalErrorFlag:").concat(this._fatalErrorFlag," previousState:").concat(this._previousState," reconnectFlag:").concat(t);if(be.log("".concat(this._className,".reConnect ").concat(o)),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===D.NET_STATE_CONNECTING&&t)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(D.NET_STATE_CONNECTING)}}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(be.log("".concat(this._className,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),this._previousState=e,this.emitOuterEvent(C.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e=this;if(!0!==this._probing){this._probing=!0;var t=this.getModule(Io).getProtocolData({protocolName:Hn});this.send(t).then((function(){e._probing=!1})).catch((function(t){if(be.warn("".concat(e._className,"._ping failed. error:"),t),e._probing=!1,t&&60002===t.code)return new Ca(Da.ERROR).setMessage("code:".concat(t.code," message:").concat(t.message)).setNetworkType(e.getModule(ho).getNetworkType()).end(),e._fatalErrorFlag=!0,void e._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED);e.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];be.log("".concat(e._className,"._ping failed. probe network, isAppShowing:").concat(e._isAppShowing," online:").concat(n," networkType:").concat(a)),n?e.reConnect():e._emitNetStateChangeEvent(D.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(){be.log("".concat(this._className,".reset")),this._previousState=D.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3)}}]),o}(Ao),kr=["a2","tinyid"],Gr=["a2","tinyid"],Pr=function(){function e(t){n(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(),o=this._sessionModule.genCosSpecifiedHead(),n=this._sessionModule.genSSOReportHead();this._configMap.set(Oo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(B.CMD.LOGIN)}),body:{state:"Online"},keyMap:{response:{InstId:"instanceID",HelloInterval:"helloInterval"}}}}(e)),this._configMap.set(Ro,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(B.CMD.LOGOUT)}),body:{type:0},keyMap:{request:{type:"wslogout_type"}}}}(e)),this._configMap.set(Lo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(B.CMD.HELLO)}),body:{},keyMap:{response:{NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(ko,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.STAT_SERVICE,".").concat(B.CMD.KICK_OTHER)}),body:{}}}(e)),this._configMap.set(qn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_COS_SIGN,".").concat(B.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"}}}}(o)),this._configMap.set(Vn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.CUSTOM_UPLOAD,".").concat(B.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"}}}}(o)),this._configMap.set(Kn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.CUSTOM_UPLOAD,".").concat(B.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"}}}}(o)),this._configMap.set(Qn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_CONFIG_MANAGER,".").concat(B.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(Zn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_CONFIG_MANAGER,".").concat(B.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(Jn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_CONFIG_MANAGER,".").concat(B.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(Xn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_CONFIG_MANAGER,".").concat(B.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(ea,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OVERLOAD_PUSH,".").concat(B.CMD.OVERLOAD_NOTIFY)}),body:{},keyMap:{response:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}}(e)),this._configMap.set(Go,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.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(Po,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.CMD.BIG_DATA_HALLWAY_AUTH_KEY)}),body:{}}}(e)),this._configMap.set(Uo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.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(bo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(Bo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.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(_n,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.REVOKE_GROUP_MESSAGE)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{request:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}}(e)),this._configMap.set(Yo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.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(zo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.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(mn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(Ho,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.CMD.SET_C2C_MESSAGE_READ)}),body:{C2CMsgReaded:void 0},keyMap:{request:{lastMessageTime:"LastedMsgTime"}}}}(e)),this._configMap.set(xo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.CMD.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{request:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}}(e)),this._configMap.set(Wo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.CMD.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{updateSequence:0},keyMap:{response:{MuteNotificationsList:"muteFlagList"}}}}(e)),this._configMap.set(hn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.SET_GROUP_MESSAGE_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{request:{messageReadSeq:"MsgReadedSeq"}}}}(e)),this._configMap.set(fn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.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($o,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.CMD.DELETE_C2C_MESSAGE)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{request:{keyList:"MsgKeyList"}}}}(e)),this._configMap.set(Nn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.DELETE_GROUP_MESSAGE)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{request:{deleter:"Deleter_Account",keyList:"Seqs"}}}}(e)),this._configMap.set(An,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.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(Mn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequence:"MsgSeq"}}}}(e)),this._configMap.set(In,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.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(vn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}}(e)),this._configMap.set(yn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(jo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.CMD.GET_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{request:{userIDList:"To_Account"},response:{ReadTime:"peerReadTimeList"}}}}(e)),this._configMap.set(Xo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(B.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(Jo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(B.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(Qo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(B.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(Zo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(B.CMD.PIN_CONVERSATION)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{request:{itemList:"RecentContactItem"}}}}(e)),this._configMap.set(en,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.CMD.DELETE_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(wo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.PROFILE,".").concat(B.CMD.PORTRAIT_GET)}),body:{fromAccount:"",userItem:[]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(Fo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.PROFILE,".").concat(B.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(qo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(B.CMD.GET_BLACKLIST)}),body:{fromAccount:"",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{response:{CurruentSequence:"currentSequence"}}}}(e)),this._configMap.set(Vo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(B.CMD.ADD_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(Ko,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(B.CMD.DELETE_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(sa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(B.CMD.SET_SELF_STATUS)}),body:{customStatus:""},keyMap:{}}}(e)),this._configMap.set(ra,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(B.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(ia,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(B.CMD.SUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(ca,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(B.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(tn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(on,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(nn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(an,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.DESTROY_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(sn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(rn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(cn,function(e){e.a2,e.tinyid;return{head:t(t({},g(e,kr)),{},{servcmd:"".concat(B.NAME.BIG_GROUP_NO_AUTH,".").concat(B.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(un,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.QUIT_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(ln,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(dn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.CHANGE_GROUP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{request:{newOwnerID:"NewOwner_Account"}}}}(e)),this._configMap.set(pn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(gn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(En,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.GET_GROUP_APPLICATION)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{request:{handleAccount:"Handle_Account"}}}}(e)),this._configMap.set(Tn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.CMD.DELETE_GROUP_SYSTEM_MESSAGE)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(Sn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.BIG_GROUP_LONG_POLLING,".").concat(B.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(Cn,function(e){e.a2,e.tinyid;return{head:t(t({},g(e,Gr)),{},{servcmd:"".concat(B.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,".").concat(B.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(Dn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.GET_ONLINE_MEMBER_NUM)}),body:{groupID:void 0}}}(e)),this._configMap.set(On,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(Rn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(Ln,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(kn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.CLEAR_GROUP_ATTRIBUTES)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}}(e)),this._configMap.set(Gn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_ATTR,".").concat(B.CMD.GET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{request:{avChatRoomKey:"Key",groupType:"GroupType"}}}}(e)),this._configMap.set(ta,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_COMMUNITY,".").concat(B.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(oa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_COMMUNITY,".").concat(B.CMD.DELETE_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:"TopicIdList"},response:{DestroyResultItem:"resultList"}}}}(e)),this._configMap.set(na,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_COMMUNITY,".").concat(B.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(aa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_COMMUNITY,".").concat(B.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(Pn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(Un,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(bn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(wn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.CMD.DELETE_GROUP_MEMBER)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{request:{userIDList:"MemberToDel_Account"}}}}(e)),this._configMap.set(Fn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(B.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(Bn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STAT,".").concat(B.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"}}}}(n)),this._configMap.set(Hn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.HEARTBEAT,".").concat(B.CMD.ALIVE)}),body:{}}}(e)),this._configMap.set(xn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_PUSH,".").concat(B.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(Wn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_PUSH,".").concat(B.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(Yn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(B.CMD.MESSAGE_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{request:{sessionData:"SessionData"}}}}(e)),this._configMap.set(jn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(B.CMD.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{response:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(zn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_LONG_MESSAGE,".").concat(B.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($n,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_LONG_MESSAGE,".").concat(B.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||{}:(be.warn("".concat(this._className,".getKeyMap unknown protocolName:").concat(e)),{})}},{key:"getProtocolData",value:function(e){var t=e.protocolName,o=e.requestData,n=this.get(t),a=null;if(o){var s=this._simpleDeepCopy(n),r=this._updateService(o,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===o[u])continue;c[u]=o[u]}r.body=c,a=this._getUplinkData(r)}else a=this._getUplinkData(n);return a}},{key:"_getUplinkData",value:function(e){var t=this._requestDataCleaner(e),o=Pt(t.head),n=fr(t.body,this._getRequestKeyMap(o));return t.body=n,t}},{key:"_updateService",value:function(e,t){var o=Pt(t.head);if(t.head.servcmd.includes(B.NAME.GROUP)){var n=e.type,a=e.groupID,s=void 0===a?void 0:a,r=e.groupIDList,i=void 0===r?[]:r;Ze(s)&&(s=i[0]||""),Et({type:n,groupID:s})&&(t.head.servcmd="".concat(B.NAME.GROUP_COMMUNITY,".").concat(o))}return t}},{key:"_getRequestKeyMap",value:function(e){var o=this.getKeyMap(e);return t(t({},gr.request),o.request)}},{key:"_requestDataCleaner",value:function(e){var t=Array.isArray(e)?[]:Object.create(null);for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&st(n)&&null!==e[n]&&void 0!==e[n]&&("object"!==o(e[n])?t[n]=e[n]:t[n]=this._requestDataCleaner.bind(this)(e[n]));return t}},{key:"_simpleDeepCopy",value:function(e){for(var t,o=Object.keys(e),n={},a=0,s=o.length;a<s;a++)t=o[a],Qe(e[t])?n[t]=Array.from(e[t]):Je(e[t])?n[t]=this._simpleDeepCopy(e[t]):n[t]=e[t];return n}}]),e}(),Ur=[Yn],br=function(){function e(t){n(this,e),this._sessionModule=t,this._className="DownlinkHandler",this._eventHandlerMap=new Map,this._eventHandlerMap.set("C2CMessageArray",this._c2cMessageArrayHandler.bind(this)),this._eventHandlerMap.set("groupMessageArray",this._groupMessageArrayHandler.bind(this)),this._eventHandlerMap.set("groupTips",this._groupTipsHandler.bind(this)),this._eventHandlerMap.set("C2CNotifyMessageArray",this._C2CNotifyMessageArrayHandler.bind(this)),this._eventHandlerMap.set("C2CReadReceiptArray",this._C2CReadReceiptArrayHandler.bind(this)),this._eventHandlerMap.set("profileModify",this._profileHandler.bind(this)),this._eventHandlerMap.set("friendListMod",this._relationChainHandler.bind(this)),this._eventHandlerMap.set("recentContactMod",this._recentContactHandler.bind(this)),this._eventHandlerMap.set("readAllC2CMessage",this._allMessageReadHandler.bind(this)),this._eventHandlerMap.set("c2cMessageModified",this._c2cMessageModifiedHandler.bind(this)),this._eventHandlerMap.set("groupMessageModified",this._groupMessageModifiedHandler.bind(this)),this._eventHandlerMap.set("userStatusList",this._userStatusListHandler.bind(this)),this._keys=M(this._eventHandlerMap.keys())}return s(e,[{key:"_c2cMessageArrayHandler",value:function(e){var t=this._sessionModule.getModule(so);if(t){if(e.dataList.forEach((function(e){if(1===e.isSyncMessage){var t=e.from;e.from=e.to,e.to=t}})),1===e.needSync)this._sessionModule.getModule(vo).startOnlineSync();t.onNewC2CMessage({dataList:e.dataList,isInstantMessage:!0})}}},{key:"_c2cMessageModifiedHandler",value:function(e){var t=this._sessionModule.getModule(so);t&&t.onC2CMessageModified(e)}},{key:"_groupMessageArrayHandler",value:function(e){var t=this._sessionModule.getModule(ro);t&&t.onNewGroupMessage({event:e.event,dataList:e.dataList,isInstantMessage:!0})}},{key:"_groupMessageModifiedHandler",value:function(e){var t=this._sessionModule.getModule(ro);t&&t.onGroupMessageModified(e)}},{key:"_groupTipsHandler",value:function(e){var t=this._sessionModule.getModule(ro);if(t){var o=e.event,n=e.dataList,a=e.isInstantMessage,s=void 0===a||a,r=e.isSyncingEnded;switch(o){case 4:case 6:t.onNewGroupTips({event:o,dataList:n});break;case 5:n.forEach((function(e){Qe(e.elements.revokedInfos)?t.onGroupMessageRevoked({dataList:n}):Qe(e.elements.groupMessageReadNotice)?t.onGroupMessageReadNotice({dataList:n}):Qe(e.elements.readReceiptList)?t.onReadReceiptList({dataList:n}):t.onNewGroupSystemNotice({dataList:n,isInstantMessage:s,isSyncingEnded:r})}));break;case 12:this._sessionModule.getModule(lo).onNewGroupAtTips({dataList:n});break;default:be.log("".concat(this._className,"._groupTipsHandler unknown event:").concat(o," dataList:"),n)}}}},{key:"_C2CNotifyMessageArrayHandler",value:function(e){var t=this,o=e.dataList;if(Qe(o)){var n=this._sessionModule.getModule(so);o.forEach((function(e){if(Xe(e))if(e.hasOwnProperty("kickoutMsgNotify")){var a=e.kickoutMsgNotify,s=a.kickType,r=a.newInstanceInfo,i=void 0===r?{}:r;1===s?t._sessionModule.onMultipleAccountKickedOut(i):2===s?t._sessionModule.onMultipleDeviceKickedOut(i):3===s&&t._sessionModule.onRestApiKickedOut(i)}else if(e.hasOwnProperty("c2cMessageRevokedNotify"))n&&n.onC2CMessageRevoked({dataList:o});else if(e.hasOwnProperty("c2cMessageReadReceipt"))n&&n.onC2CMessageReadReceipt({dataList:o});else if(e.hasOwnProperty("c2cMessageReadNotice"))n&&n.onC2CMessageReadNotice({dataList:o});else if(e.hasOwnProperty("muteNotificationsSync")){t._sessionModule.getModule(lo).onC2CMessageRemindTypeSynced({dataList:o})}}))}}},{key:"_C2CReadReceiptArrayHandler",value:function(e){this._sessionModule.getModule(so).onReadReceiptList(e)}},{key:"_profileHandler",value:function(e){this._sessionModule.getModule(ao).onProfileModified({dataList:e.dataList});var t=this._sessionModule.getModule(io);t&&t.onFriendProfileModified({dataList:e.dataList})}},{key:"_relationChainHandler",value:function(e){this._sessionModule.getModule(ao).onRelationChainModified({dataList:e.dataList});var t=this._sessionModule.getModule(io);t&&t.onRelationChainModified({dataList:e.dataList})}},{key:"_recentContactHandler",value:function(e){var t=e.dataList;if(Qe(t)){var o=this._sessionModule.getModule(lo);o&&t.forEach((function(e){var t=e.pushType,n=e.recentContactTopItem,a=e.recentContactDeleteItem;1===t?o.onConversationDeleted(a.recentContactList):2===t?o.onConversationPinned(n.recentContactList):3===t&&o.onConversationUnpinned(n.recentContactList)}))}}},{key:"_allMessageReadHandler",value:function(e){var t=e.dataList,o=this._sessionModule.getModule(lo);o&&o.onPushedAllMessageRead(t)}},{key:"_userStatusListHandler",value:function(e){this._sessionModule.getModule(ao).onUserStatusUpdated(e)}},{key:"onMessage",value:function(e){var t=this,o=e.body;if(this._filterMessageFromIMOpenPush(e)){var n=o.eventArray,a=o.isInstantMessage,s=o.isSyncingEnded,r=o.needSync;if(Qe(n))for(var i=null,c=null,u=0,l=0,d=n.length;l<d;l++){u=(i=n[l]).event;var p=Object.keys(i).find((function(e){return-1!==t._keys.indexOf(e)}));p?(c=14===u?{readAllC2CMessage:i[p],groupMessageReadInfoList:i.groupMessageReadNotice||[]}:16===u?{userID:i.userID,readReceiptList:i[p]}:i[p],this._eventHandlerMap.get(p)({event:u,dataList:c,isInstantMessage:a,isSyncingEnded:s,needSync:r})):be.log("".concat(this._className,".onMessage unknown eventItem:").concat(i))}}}},{key:"_filterMessageFromIMOpenPush",value:function(e){var t=e.head,o=e.body,n=t.servcmd,a=!1;if(Ze(n)||(a=n.includes(B.NAME.IM_CONFIG_MANAGER)||n.includes(B.NAME.OVERLOAD_PUSH)||n.includes(B.NAME.STAT_SERVICE)),!a)return!0;if(n.includes(B.CMD.PUSHED_CLOUD_CONTROL_CONFIG))this._sessionModule.getModule(To).onPushedCloudControlConfig(o);else if(n.includes(B.CMD.PUSHED_COMMERCIAL_CONFIG)){this._sessionModule.getModule(No).onPushedConfig(o)}else if(n.includes(B.CMD.OVERLOAD_NOTIFY))this._sessionModule.onPushedServerOverload(o);else if(n.includes(B.CMD.KICK_OTHER)){var s=Date.now();this._sessionModule.reLoginOnKickOther();var r=new Ca(Da.KICK_OTHER),i=this._sessionModule.getModule(oo).getLastWsHelloTs(),c=s-i;r.setMessage("last wshello time:".concat(i," diff:").concat(c,"ms")).setNetworkType(this._sessionModule.getNetworkType()).end()}return!1}}]),e}(),wr=[{cmd:B.CMD.GET_GROUP_INFO,interval:1,count:20},{cmd:B.CMD.GET_TOPIC_LIST,interval:1,count:10},{cmd:B.CMD.SET_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:B.CMD.MODIFY_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:B.CMD.DELETE_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:B.CMD.CLEAR_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:B.CMD.GET_GROUP_ATTRIBUTES,interval:5,count:20},{cmd:B.CMD.SET_ALL_MESSAGE_READ,interval:1,count:1},{cmd:B.CMD.GET_USER_STATUS,interval:5,count:20},{cmd:B.CMD.SUBSCRIBE_USER_STATUS,interval:5,count:20},{cmd:B.CMD.UNSUBSCRIBE_USER_STATUS,interval:5,count:20}],Fr=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="SessionModule",a._platform=a.getPlatform(),a._protocolHandler=new Pr(_(a)),a._messageDispatcher=new br(_(a)),a._commandFrequencyLimitMap=new Map,a._commandRequestInfoMap=new Map,a._serverOverloadInfoMap=new Map,a._init(),a.getInnerEmitterInstance().on(ns,a._onCloudConfigUpdated,_(a)),a}return s(o,[{key:"_init",value:function(){this._updateCommandFrequencyLimitMap(wr)}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");Ze(e)||(e=JSON.parse(e),this._updateCommandFrequencyLimitMap(e))}},{key:"_updateCommandFrequencyLimitMap",value:function(e){var t=this;e.forEach((function(e){t._commandFrequencyLimitMap.set(e.cmd,{interval:e.interval,count:e.count})}))}},{key:"updateProtocolConfig",value:function(){this._protocolHandler.update()}},{key:"request",value:function(e){be.debug("".concat(this._className,".request options:"),e);var t=e.protocolName,o=e.tjgID;if(!this._protocolHandler.has(t))return be.warn("".concat(this._className,".request unknown protocol:").concat(t)),Za({code:ua.CANNOT_FIND_PROTOCOL,message:la.CANNOT_FIND_PROTOCOL});var n=this.getProtocolData(e),a=n.head.servcmd;if(this._isFrequencyOverLimit(a))return Za({code:ua.OVER_FREQUENCY_LIMIT,message:la.OVER_FREQUENCY_LIMIT});if(this._isServerOverload(a))return Za({code:ua.OPEN_SERVICE_OVERLOAD_ERROR,message:la.OPEN_SERVICE_OVERLOAD_ERROR});Bt(o)||(n.head.tjgID=o);var s=this.getModule(yo);return Ur.includes(t)?s.simplySend(n):s.send(n)}},{key:"getKeyMap",value:function(e){return this._protocolHandler.getKeyMap(e)}},{key:"genCommonHead",value:function(){var e=this.getModule(po);return{ver:"v4",platform:this._platform,websdkappid:U,websdkversion:P,a2:e.getA2Key()||void 0,tinyid:e.getTinyID()||void 0,status_instid:e.getStatusInstanceID(),sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getA2Key()?void 0:e.getUserID(),usersig:e.getA2Key()?void 0:e.getUserSig(),sdkability:3635,tjgID:""}}},{key:"genCosSpecifiedHead",value:function(){var e=this.getModule(po);return{ver:"v4",platform:this._platform,websdkappid:U,websdkversion:P,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:3635}}},{key:"genSSOReportHead",value:function(){var e=this.getModule(po);return{ver:"v4",platform:this._platform,websdkappid:U,websdkversion:P,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:3635}}},{key:"getProtocolData",value:function(e){return this._protocolHandler.getProtocolData(e)}},{key:"onErrorCodeNotZero",value:function(e){var t=e.errorCode;if(t===ua.HELLO_ANSWER_KICKED_OUT){var o=e.kickType,n=e.newInstanceInfo,a=void 0===n?{}:n;1===o?this.onMultipleAccountKickedOut(a):2===o?this.onMultipleDeviceKickedOut(a):3===o&&this.onRestApiKickedOut(a)}t!==ua.MESSAGE_A2KEY_EXPIRED&&t!==ua.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.getModule(yo).reConnect())}},{key:"onMessage",value:function(e){var t=e.body,o=t.needAck,n=void 0===o?0:o,a=t.sessionData;1===n&&this._sendACK(a),this._messageDispatcher.onMessage(e)}},{key:"onReconnected",value:function(){this._reLoginOnReconnected()}},{key:"reLoginOnKickOther",value:function(){be.log("".concat(this._className,".reLoginOnKickOther")),this._reLogin()}},{key:"_reLoginOnReconnected",value:function(){be.log("".concat(this._className,"._reLoginOnReconnected")),this._reLogin()}},{key:"_reLogin",value:function(){var e=this;this.isLoggedIn()&&this.request({protocolName:Oo}).then((function(t){var o=t.data.instanceID;e.getModule(po).setStatusInstanceID(o),be.log("".concat(e._className,"._reLogin ok. start to sync unread messages")),e.getModule(vo).startSyncOnReconnected(),e.getModule(lo).syncConversationList(),e.getModule(Co).startPull(),e.getModule(ro).updateLocalMainSequenceOnReconnected();var n=e.getModule(uo);n.resetGetTopicTime(),n.getTopicListOnReconnected()}))}},{key:"onMultipleAccountKickedOut",value:function(e){this.getModule(oo).onMultipleAccountKickedOut(e)}},{key:"onMultipleDeviceKickedOut",value:function(e){this.getModule(oo).onMultipleDeviceKickedOut(e)}},{key:"_onUserSigExpired",value:function(){this.getModule(oo).onUserSigExpired()}},{key:"onRestApiKickedOut",value:function(e){this.getModule(oo).onRestApiKickedOut(e)}},{key:"_sendACK",value:function(e){this.request({protocolName:Yn,requestData:{sessionData:e}})}},{key:"_isFrequencyOverLimit",value:function(e){var t=e.split(".")[1];if(!this._commandFrequencyLimitMap.has(t))return!1;if(!this._commandRequestInfoMap.has(t))return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;var o=this._commandFrequencyLimitMap.get(t),n=o.count,a=o.interval,s=this._commandRequestInfoMap.get(t),r=s.startTime,i=s.requestCount;if(Date.now()-r>1e3*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>n&&(c=!0),c}},{key:"_isServerOverload",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var t=this._serverOverloadInfoMap.get(e),o=t.overloadTime,n=t.waitingTime,a=!1;return Date.now()-o<=1e3*n?a=!0:(this._serverOverloadInfoMap.delete(e),a=!1),a}},{key:"onPushedServerOverload",value:function(e){var t=e.overloadCommand,o=e.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:o}),be.warn("".concat(this._className,".onPushedServerOverload waitingTime:").concat(o,"s"))}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._updateCommandFrequencyLimitMap(wr),this._commandRequestInfoMap.clear(),this._serverOverloadInfoMap.clear()}}]),o}(Ao),qr=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="MessageLossDetectionModule",a._maybeLostSequencesMap=new Map,a._firstRoundRet=[],a}return s(o,[{key:"onMessageMaybeLost",value:function(e,t,o){this._maybeLostSequencesMap.has(e)||this._maybeLostSequencesMap.set(e,[]);for(var n=this._maybeLostSequencesMap.get(e),a=0;a<o;a++)-1===n.indexOf(t+a)&&n.push(t+a)}},{key:"detectFirstRound",value:function(e,t){var o=this._maybeLostSequencesMap.get(e);if(!Bt(o)&&!Bt(t)){var n=o.filter((function(e){return-1===t.indexOf(e)}));0===n.length?be.info("".concat(this._className,".detectFirstRound no message loss. conversationID:").concat(e)):this._firstRoundRet=this._firstRoundRet.concat(n),o.length=0}}},{key:"detectSecondRound",value:function(e,t){if(!Bt(this._firstRoundRet)&&!Bt(t)){var o=this._firstRoundRet.filter((function(e){return-1===t.indexOf(e)}));this._firstRoundRet.length=0;var n,a=o.length;if(0!==a)a<=5?n=e+"-"+o.join("-"):(o.sort((function(e,t){return e-t})),n=e+" start:"+o[0]+" end:"+o[a-1]+" count:"+a),new Ca(Da.MESSAGE_LOSS).setMessage(n).setNetworkType(this.getNetworkType()).setLevel("warning").end(),be.info("".concat(this._className,".detectSecondRound message loss detected. conversationID:").concat(e," lostSequences:").concat(o))}}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._maybeLostSequencesMap.clear(),this._firstRoundRet.length=0}}]),o}(Ao),Vr=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="CloudControlModule",a._cloudConfig=new Map,a._expiredTime=0,a._version=0,a._isFetching=!1,a}return s(o,[{key:"getCloudConfig",value:function(e){return Ze(e)?this._cloudConfig:this._cloudConfig.has(e)?this._cloudConfig.get(e):void 0}},{key:"_canFetchConfig",value:function(){return this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetchConfig();if(be.log("".concat(this._className,".fetchConfig canFetchConfig:").concat(t)),t){var o=new Ca(Da.FETCH_CLOUD_CONTROL_CONFIG),n=this.getModule(po).getSDKAppID();this._isFetching=!0,this.request({protocolName:Jn,requestData:{SDKAppID:n,version:this._version}}).then((function(t){e._isFetching=!1,o.setMessage("version:".concat(e._version," newVersion:").concat(t.data.version," config:").concat(t.data.cloudControlConfig)).setNetworkType(e.getNetworkType()).end(),be.log("".concat(e._className,".fetchConfig ok")),e._parseCloudControlConfig(t.data)})).catch((function(t){e._isFetching=!1,e.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];o.setError(t,a,s).end()})),be.log("".concat(e._className,".fetchConfig failed. error:"),t),e._setExpiredTimeOnResponseError(12e4)}))}}},{key:"onPushedCloudControlConfig",value:function(e){be.log("".concat(this._className,".onPushedCloudControlConfig")),new Ca(Da.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,o="".concat(this._className,"._parseCloudControlConfig"),n=e.errorCode,a=e.errorMessage,s=e.cloudControlConfig,r=e.version,i=e.expiredTime;if(0===n){if(this._version!==r){var c=null;try{c=JSON.parse(s)}catch(u){be.error("".concat(o," 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(ns))}this._expiredTime=Date.now()+1e3*i}else Ze(n)?(be.log("".concat(o," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(be.error("".concat(o," errorCode:").concat(n," errorMessage:").concat(a)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),o}(Ao),Kr=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="PullGroupMessageModule",a._remoteLastMessageSequenceMap=new Map,a.PULL_LIMIT_COUNT=15,a}return s(o,[{key:"startPull",value:function(){var e=this,t=this._getNeedPullConversationList();this._getRemoteLastMessageSequenceList().then((function(){var o=e.getModule(lo);t.forEach((function(t){var n=t.conversationID,a=n.replace(D.CONV_GROUP,""),s=o.getGroupLocalLastMessageSequence(n),r=e._remoteLastMessageSequenceMap.get(a)||0,i=r-s;be.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(lo).getLocalConversationList().filter((function(e){return e.type===D.CONV_GROUP&&e.groupProfile.type!==D.GRP_AVCHATROOM}))}},{key:"_getRemoteLastMessageSequenceList",value:function(){var e=this;return this.getModule(ro).getGroupList().then((function(t){for(var o=t.data.groupList,n=void 0===o?[]:o,a=0;a<n.length;a++){var s=n[a],r=s.groupID,i=s.nextMessageSeq;if(s.type!==D.GRP_AVCHATROOM){var c=i-1;e._remoteLastMessageSequenceMap.set(r,c)}}}))}},{key:"_pullMissingMessage",value:function(e){var t=this,o=e.localLastMessageSequence,n=e.remoteLastMessageSequence,a=e.diff;e.count=a>this.PULL_LIMIT_COUNT?this.PULL_LIMIT_COUNT:a,e.sequence=a>this.PULL_LIMIT_COUNT?o+this.PULL_LIMIT_COUNT:o+a,this._getGroupMissingMessage(e).then((function(s){s.length>0&&(s[0].sequence+1<=n&&(e.localLastMessageSequence=o+t.PULL_LIMIT_COUNT,e.diff=a-t.PULL_LIMIT_COUNT,t._pullMissingMessage(e)),t.getModule(ro).onNewGroupMessage({dataList:s,isInstantMessage:!1}))}))}},{key:"_getGroupMissingMessage",value:function(e){var t=this,o=new Ca(Da.GET_GROUP_MISSING_MESSAGE);return this.request({protocolName:mn,requestData:{groupID:e.groupID,count:e.count,sequence:e.sequence}}).then((function(n){var a=n.data.messageList,s=void 0===a?[]:a;return o.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 n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()}))}))}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),this._remoteLastMessageSequenceMap.clear()}}]),o}(Ao),Br=function(){function e(){n(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 o=0;return e.forEach((function(e){o+=e})),Ut(o/t,1)}},{key:"_calcCountWithLimit",value:function(e){var t=e.e2eDelayArray,o=e.min,n=e.max;return t.filter((function(e){return o<=e&&e<n})).length}},{key:"_calcPercent",value:function(e,t){var o=Ut(e/t*100,2);return o>100&&(o=100),o}},{key:"_checkE2EDelayException",value:function(e,t){var o=e.filter((function(e){return e>t}));if(o.length>0){var n=o.length,a=Math.min.apply(Math,M(o)),s=Math.max.apply(Math,M(o)),r=this._calcAvg(o,n),i=Ut(n/e.length*100,2);if(i>50)new Ca(Da.MESSAGE_E2E_DELAY_EXCEPTION).setMessage("message e2e delay exception. count:".concat(n," 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),o=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),n=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),a=this._calcPercent(o,e),s=this._calcPercent(n,e),r=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:o,percentOfCountLessThan1Second:a,countLessThan3Second:n,percentOfCountLessThan3Second:s,avgDelay:r}}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),e}(),Hr=function(){function e(){n(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 o=Ut(e/t*100,2);return o>100&&(o=100),o}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var o=0;return e.forEach((function(e){o+=e})),parseInt(o/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 o=this._calcRTTCount(t),n=this._calcSuccessRateOfRequest(o,e),a=this._calcAvg(t,o);return be.log("".concat(this._className,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(a)),this.reset(),{totalCount:e,rttCount:o,successRateOfRequest:n,avgRTT:a}}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),e}(),xr=function(){function e(){n(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!(Ze(e)||!this._map.has(e))&&(this._map.get(e).totalCount+=1,!0)}},{key:"addSuccessCount",value:function(e){return!(Ze(e)||!this._map.has(e))&&(this._map.get(e).successCount+=1,!0)}},{key:"addFailedCountOfUserSide",value:function(e){return!(Ze(e)||!this._map.has(e))&&(this._map.get(e).failedCountOfUserSide+=1,!0)}},{key:"addCost",value:function(e,t){return!(Ze(e)||!this._map.has(e))&&(this._map.get(e).costArray.push(t),!0)}},{key:"addFileSize",value:function(e,t){return!(Ze(e)||!this._map.has(e))&&(this._map.get(e).fileSizeArray.push(t),!0)}},{key:"_calcSuccessRateOfBusiness",value:function(e){if(Ze(e)||!this._map.has(e))return-1;var t=this._map.get(e),o=Ut(t.successCount/t.totalCount*100,2);return o>100&&(o=100),o}},{key:"_calcSuccessRateOfPlatform",value:function(e){if(Ze(e)||!this._map.has(e))return-1;var t=this._map.get(e),o=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return(o=Ut(o,2))>100&&(o=100),o}},{key:"_calcTotalCount",value:function(e){return Ze(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(e){return Ze(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(e){if(Ze(e)||!this._map.has(e))return-1;var t=this._map.get(e);return t.successCount+t.failedCountOfUserSide}},{key:"_calcAvg",value:function(e){return Ze(e)||!this._map.has(e)?-1:e===ma?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 o=0;return this._map.get(e).costArray.forEach((function(e){o+=e})),parseInt(o/t)}},{key:"_calcAvgSpeed",value:function(e){var t=0,o=0;return this._map.get(e).costArray.forEach((function(e){t+=e})),this._map.get(e).fileSizeArray.forEach((function(e){o+=e})),parseInt(1e3*o/t)}},{key:"getStatResult",value:function(e){var t=this._calcTotalCount(e);if(0===t)return null;var o=this._calcSuccessCountOfBusiness(e),n=this._calcSuccessRateOfBusiness(e),a=this._calcSuccessCountOfPlatform(e),s=this._calcSuccessRateOfPlatform(e),r=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:o,successRateOfBusiness:n,successCountOfPlatform:a,successRateOfPlatform:s,avgValue:r}}},{key:"reset",value:function(e){Ze(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),e}(),Wr=function(){function e(){n(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,o=e.message;if(Ze(t)||!this._lastMap.has(t)||!this._currentMap.has(t))return!1;var n=o.conversationID,a=o.sequence,s=n.replace(D.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]&&a<r[i]?(r.push(a),r.sort(),this._lastMap.get(t).set(s,r)):this._addCurrentMap(e)}else this._addCurrentMap(e);return!0}},{key:"_addCurrentMap",value:function(e){var t=e.key,o=e.message,n=o.conversationID,a=o.sequence,s=n.replace(D.CONV_GROUP,"");this._currentMap.get(t).has(s)||this._currentMap.get(t).set(s,[]),this._currentMap.get(t).get(s).push(a)}},{key:"_copyData",value:function(e){if(!Ze(e)){this._lastMap.set(e,new Map);var t,o=this._lastMap.get(e),n=S(this._currentMap.get(e));try{for(n.s();!(t=n.n()).done;){var a=m(t.value,2),s=a[0],r=a[1];o.set(s,r)}}catch(i){n.e(i)}finally{n.f()}o=null,this._currentMap.set(e,new Map)}}},{key:"getStatResult",value:function(e){if(Ze(this._currentMap.get(e))||Ze(this._lastMap.get(e)))return null;if(0===this._lastMap.get(e).size)return this._copyData(e),null;var t=0,o=0;if(this._lastMap.get(e).forEach((function(e,n){var a=M(e.values()),s=a.length,r=a[s-1]-a[0]+1;t+=r,o+=s})),0===t)return null;var n=Ut(o/t*100,2);return n>100&&(n=100),this._copyData(e),{totalCount:t,successCountOfMessageReceived:o,successRateOfMessageReceived:n}}},{key:"reset",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),e}(),Yr=function(e){i(a,e);var o=f(a);function a(e){var t;n(this,a),(t=o.call(this,e))._className="QualityStatModule",t.TAG="im-ssolog-quality-stat",t.reportIndex=0,t.wholePeriod=!1,t._qualityItems=[da,pa,ga,_a,ha,fa,ma,Ma,va,Ia],t._messageSentItems=[ga,_a,ha,fa,ma],t._messageReceivedItems=[Ma,va,Ia],t.REPORT_INTERVAL=120,t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._statInfoArr=[],t._avgRTT=new Hr,t._avgE2EDelay=new Br,t._rateMessageSent=new xr,t._rateMessageReceived=new Wr;var s=t.getInnerEmitterInstance();return s.on(os,t._onLoginSuccess,_(t)),s.on(ns,t._onCloudConfigUpdated,_(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(go),o=t.getItem(this.TAG,!1);!Bt(o)&&ot(o.forEach)&&(be.log("".concat(this._className,"._onLoginSuccess.get quality stat log in storage, nums=").concat(o.length)),o.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"),o=this.getCloudConfig("q_rpt_tinyid_wl");Ze(e)||(this.REPORT_INTERVAL=Number(e)),Ze(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map((function(e){return Number(e)}))),Ze(o)||(this.REPORT_TINYID_WHITELIST=o.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)||be.warn("".concat(this._className,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||be.warn("".concat(this._className,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||be.warn("".concat(this._className,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,t){this._rateMessageSent.addCost(e,t)||be.warn("".concat(this._className,".addCost invalid key or cost:"),e,t)}},{key:"addFileSize",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||be.warn("".concat(this._className,".addFileSize invalid key or size:"),e,t)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||be.warn("".concat(this._className,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var o={},n=Ta[this.getNetworkType()];Ze(n)&&(n=8);var a={qualityType:ya[e],timestamp:Re(),networkType:n,extension:""};switch(e){case da:o=this._avgRTT.getStatResult();break;case pa:o=this._avgE2EDelay.getStatResult();break;case ga:case _a:case ha:case fa:case ma:o=this._rateMessageSent.getStatResult(e);break;case Ma:case va:case Ia:o=this._rateMessageReceived.getStatResult(e)}return null===o?null:t(t({},a),o)}},{key:"_report",value:function(e){var t=this,o=[],n=null;Ze(e)?this._qualityItems.forEach((function(e){null!==(n=t._getQualityItem(e))&&(n.reportIndex=t.reportIndex,n.wholePeriod=t.wholePeriod,o.push(n))})):null!==(n=this._getQualityItem(e))&&(n.reportIndex=this.reportIndex,n.wholePeriod=this.wholePeriod,o.push(n)),be.debug("".concat(this._className,"._report"),o),this._statInfoArr.length>0&&(o=o.concat(this._statInfoArr),this._statInfoArr=[]);var a=this.getModule(po),s=a.getSDKAppID(),r=a.getTinyID();bt(this.REPORT_SDKAPPID_BLACKLIST,s)&&!wt(this.REPORT_TINYID_WHITELIST,r)&&(o=[]),o.length>0&&this._doReport(o)}},{key:"_doReport",value:function(e){var o=this,n={header:Js(this),quality:e};this.request({protocolName:Bn,requestData:t({},n)}).then((function(){o.reportIndex++,o.wholePeriod=!1})).catch((function(t){be.warn("".concat(o._className,"._doReport, online:").concat(o.getNetworkType()," error:"),t),o._statInfoArr=o._statInfoArr.concat(e),o._flushAtOnce()}))}},{key:"_flushAtOnce",value:function(){var e=this.getModule(go),t=e.getItem(this.TAG,!1),o=this._statInfoArr;if(Bt(t))be.log("".concat(this._className,"._flushAtOnce count:").concat(o.length)),e.setItem(this.TAG,o,!0,!1);else{var n=o.concat(t);n.length>10&&(n=n.slice(0,10)),be.log("".concat(this.className,"._flushAtOnce count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)}this._statInfoArr=[]}},{key:"reset",value:function(){be.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}(Ao),jr=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="WorkerTimerModule",a._isWorkerEnabled=!0,a._workerTimer=null,a._init(),a.getInnerEmitterInstance().on(ns,a._onCloudConfigUpdated,_(a)),a}return s(o,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&Ee}},{key:"startWorkerTimer",value:function(){be.log("".concat(this._className,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){be.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");be.log("".concat(this._className,"._onCloudConfigUpdated enableWorker:").concat(e)),Ze(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(){be.log("".concat(this._className,".terminate")),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null)}},{key:"reset",value:function(){be.log("".concat(this._className,".reset"))}}]),o}(Ao),$r=function(){function e(){n(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 o=null,n=e.length-1,a=0;n>=0;n--,a++)o=a<32?new L(0,Math.pow(2,a)).toString():new L(Math.pow(2,a-32),0).toString(),"1"===e[n]?this._purchasedFeatureMap.set(o,!0):this._purchasedFeatureMap.set(o,!1)}else be.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),o=void 0,n=!0,a=t.length-1,s=0;a>=0;a--,s++)if("1"===t.charAt(a)&&(o=s<32?new L(0,Math.pow(2,s)).toString():new L(Math.pow(2,s-32),0).toString(),!this._purchasedFeatureMap.get(o))){n=!1;break}return be.log("".concat(this._className,".isFeatureEnabled decimalNumber:").concat(e," binaryString:").concat(t," ret:").concat(n)),Qa({enabled:n})}},{key:"clear",value:function(){this._purchasedFeatureMap.clear()}}]),e}(),zr=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="CommercialConfigModule",a._expiredTime=0,a._isFetching=!1,a._purchasedFeatureHandler=new $r,a}return s(o,[{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(),o="".concat(this._className,".fetchConfig");if(be.log("".concat(o," canFetch:").concat(t)),t){var n=new Ca(Da.FETCH_COMMERCIAL_CONFIG);n.setNetworkType(this.getNetworkType());var a=this.getModule(po).getSDKAppID();this._isFetching=!0,this.request({protocolName:Qn,requestData:{SDKAppID:a}}).then((function(t){n.setMessage("purchaseBits:".concat(t.data.purchaseBits)).end(),be.log("".concat(o," ok.")),e._parseConfig(t.data),e._isFetching=!1})).catch((function(t){e.probeNetwork().then((function(e){var o=m(e,2),a=o[0],s=o[1];n.setError(t,a,s).end()})),e._isFetching=!1}))}}},{key:"onPushedConfig",value:function(e){var t="".concat(this._className,".onPushedConfig");be.log("".concat(t)),new Ca(Da.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"),o=e.errorCode,n=e.errorMessage,a=e.purchaseBits,s=e.expiredTime;0===o?(this._purchasedFeatureHandler.parsePurchaseBits(a),this._expiredTime=Date.now()+1e3*s):Ze(o)?(be.log("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(be.error("".concat(t," errorCode:").concat(o," errorMessage:").concat(n)),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(){be.log("".concat(this._className,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),o}(Ao),Jr=function(){function e(t){n(this,e);var o=new Ca(Da.SDK_CONSTRUCT);this._className="ModuleManager",this._isReady=!1,this._reason=ua.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(po,new Ws(this,t)),this._moduleMap.set(No,new zr(this)),this._moduleMap.set(To,new Vr(this)),this._moduleMap.set(So,new jr(this)),this._moduleMap.set(Do,new Yr(this)),this._moduleMap.set(yo,new Lr(this)),this._moduleMap.set(Io,new Fr(this)),this._moduleMap.set(oo,new Ys(this)),this._moduleMap.set(no,new lr(this)),this._moduleMap.set(ao,new xs(this)),this._moduleMap.set(so,new es(this)),this._moduleMap.set(lo,new Is(this)),this._moduleMap.set(ro,new ks(this)),this._moduleMap.set(co,new Ps(this)),this._moduleMap.set(uo,new Fs(this)),this._moduleMap.set(go,new $s(this)),this._moduleMap.set(_o,new Xs(this)),this._moduleMap.set(ho,new tr(this)),this._moduleMap.set(fo,new nr(this)),this._moduleMap.set(mo,new sr(this)),this._moduleMap.set(Mo,new dr(this)),this._moduleMap.set(vo,new pr(this)),this._moduleMap.set(Eo,new qr(this)),this._moduleMap.set(Co,new Kr(this)),this._eventThrottleMap=new Map;var a=t.instanceID,s=t.oversea,r=t.SDKAppID,i="instanceID:".concat(a," SDKAppID:").concat(r," host:").concat(Rt()," oversea:").concat(s," inBrowser:").concat(oe," inMiniApp:").concat(te)+" workerAvailable:".concat(Ee," UserAgent:").concat(se);Ca.bindEventStatModule(this._moduleMap.get(_o)),o.setMessage("".concat(i," ").concat(function(){var e="";if(te)try{var t=ne.getSystemInfoSync(),o=t.model,n=t.version,a=t.system,s=t.platform,r=t.SDKVersion;e="model:".concat(o," version:").concat(n," system:").concat(a," platform:").concat(s," SDKVersion:").concat(r)}catch(i){e=""}return e}())).end(),be.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(So),t=e.isWorkerEnabled();be.log("".concat(this._className,".startTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.startWorkerTimer():this._startMainThreadTimer()}},{key:"_startMainThreadTimer",value:function(){be.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(So),t=e.isWorkerEnabled();be.log("".concat(this._className,".stopTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.stopWorkerTimer():this._stopMainThreadTimer()}},{key:"_stopMainThreadTimer",value:function(){be.log("".concat(this._className,"._stopMainThreadTimer")),this._checkTimer>0&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){be.log("".concat(this._className,"._stopMainThreadSocket"));var e=this._moduleMap.get(yo);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:"_startMainThreadSocket",value:function(){be.log("".concat(this._className,"._startMainThreadSocket"));var e=this._moduleMap.get(yo);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){be.log("".concat(this._className,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){be.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 o=m(e.value,2)[1];o.onCheckTimer&&o.onCheckTimer(this._checkCount)}}catch(n){t.e(n)}finally{t.f()}}},{key:"_initReadyList",value:function(){var e=this;this._readyList=[this._moduleMap.get(oo),this._moduleMap.get(lo)],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(C.SDK_READY);var t=Date.now()-this._startLoginTs;be.warn("SDK is ready. cost ".concat(t," ms")),this._startLoginTs=Date.now();var o=this._moduleMap.get(ho).getNetworkType(),n=this._ssoLogForReady.getStartTs()+Oe;this._ssoLogForReady.setNetworkType(o).setMessage(t).start(n).end()}}},{key:"login",value:function(){0===this._startLoginTs&&(Le(),this._startLoginTs=Date.now(),this._startTimer(),this._moduleMap.get(ho).start(),this._ssoLogForReady=new Ca(Da.SDK_READY),this._reason=ua.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOuterEmitterInstance",value:function(){return null===this._outerEmitter&&(this._outerEmitter=new or,Xa(this._outerEmitter),this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(e,t){var o=this;if(e===C.CONVERSATION_LIST_UPDATED||e===C.FRIEND_LIST_UPDATED||e===C.GROUP_LIST_UPDATED)if(this._eventThrottleMap.has(e)){var n=Date.now(),a=this._eventThrottleMap.get(e);n-a.last<1e3?(a.timeoutID&&clearTimeout(a.timeoutID),a.timeoutID=setTimeout((function(){a.last=n,o._outerEmitter._emit.apply(o._outerEmitter,[e,{name:e,data:o._getEventData(e)}])}),500)):(a.last=n,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===C.CONVERSATION_LIST_UPDATED?this._moduleMap.get(lo).getLocalConversationList():e===C.FRIEND_LIST_UPDATED?this._moduleMap.get(io).getLocalFriendList(!1):e===C.GROUP_LIST_UPDATED?this._moduleMap.get(ro).getLocalGroupList():void 0}},{key:"getInnerEmitterInstance",value:function(){return null===this._innerEmitter&&(this._innerEmitter=new or,this._innerEmitter._emit=this._innerEmitter.emit,this._innerEmitter.emit=function(e,t){var o;Xe(arguments[1])&&arguments[1].data?(be.warn("inner eventData has data property, please check!"),o=[e,{name:arguments[0],data:arguments[1].data}]):o=[e,{name:arguments[0],data:arguments[1]}],this._innerEmitter._emit.apply(this._innerEmitter,o)}.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){be.warn("Oops! code:".concat(e.code," message:").concat(e.message)),new Ca(Da.ERROR).setMessage("code:".concat(e.code," message:").concat(e.message)).setNetworkType(this.getModule(ho).getNetworkType()).setLevel("error").end(),this.getOuterEmitterInstance().emit(C.ERROR,e)}},{key:"reset",value:function(){be.log("".concat(this._className,".reset")),Le();var e,t=S(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2)[1];o.reset&&o.reset()}}catch(r){t.e(r)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._outerEmitter.emit(C.SDK_NOT_READY);var n,a=S(this._eventThrottleMap);try{for(a.s();!(n=a.n()).done;){var s=m(n.value,2)[1];s.timeoutID&&clearTimeout(s.timeoutID)}}catch(r){a.e(r)}finally{a.f()}this._eventThrottleMap.clear()}}]),e}(),Xr=function(){function e(){n(this,e),this._funcMap=new Map}return s(e,[{key:"defense",value:function(e,t){var o=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 n=null;return this._funcMap.get(e).has(t)?n=this._funcMap.get(e).get(t):(n=this._pack(e,t,o),this._funcMap.get(e).set(t,n)),n}},{key:"defenseOnce",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return"function"!=typeof t?null:this._pack(e,t,o)}},{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):(be.log("SafetyCallback.find: 找不到 func —— ".concat(e,"/").concat(""!==t.name?t.name:"[anonymous]")),null):(be.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,o){return function(){try{t.apply(o,Array.from(arguments))}catch(r){var n=Object.values(C).indexOf(e);if(-1!==n){var a=Object.keys(C)[n];be.warn("接入侧事件 TIM.EVENT.".concat(a," 对应的回调函数逻辑存在问题,请检查!"),r)}var s=new Ca(Da.CALLBACK_FUNCTION_ERROR);s.setMessage("eventName:".concat(e)).setMoreMessage(r.message).end()}}}}]),e}(),Qr=function(){function e(t){n(this,e);var o={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||"",oversea:t.oversea||!1,instanceID:Ot(),devMode:t.devMode||!1,proxyServer:t.proxyServer||void 0};this._moduleManager=new Jr(o),this._safetyCallbackFactory=new Xr}return s(e,[{key:"onError",value:function(e){this._moduleManager.onError(e)}},{key:"login",value:function(e){return this._moduleManager.login(),this._moduleManager.getModule(oo).login(e)}},{key:"logout",value:function(){var e=this;return this._moduleManager.getModule(oo).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(So).terminate(),e._moduleManager.getModule(yo).dealloc();var t=e._moduleManager.getOuterEmitterInstance(),o=e._moduleManager.getModule(po);t.emit(C.SDK_DESTROY,{SDKAppID:o.getSDKAppID()})}))}},{key:"on",value:function(e,t,o){e===C.GROUP_SYSTEM_NOTICE_RECEIVED&&be.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"),be.debug("on","eventName:".concat(e)),this._moduleManager.getOuterEmitterInstance().on(e,this._safetyCallbackFactory.defense(e,t,o),o)}},{key:"once",value:function(e,t,o){be.debug("once","eventName:".concat(e)),this._moduleManager.getOuterEmitterInstance().once(e,this._safetyCallbackFactory.defenseOnce(e,t,o),o||this)}},{key:"off",value:function(e,t,o,n){be.debug("off","eventName:".concat(e));var a=this._safetyCallbackFactory.find(e,t);null!==a&&(this._moduleManager.getOuterEmitterInstance().off(e,a,o,n),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){this._moduleManager.getModule(Mo).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"))}be.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._moduleManager.getModule(no).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._moduleManager.getModule(no).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._moduleManager.getModule(no).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._moduleManager.getModule(no).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._moduleManager.getModule(no).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._moduleManager.getModule(no).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._moduleManager.getModule(no).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._moduleManager.getModule(no).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._moduleManager.getModule(no).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._moduleManager.getModule(no).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==D.MSG_MERGER?Za(new za({code:ua.MESSAGE_MERGER_TYPE_INVALID,message:la.MESSAGE_MERGER_TYPE_INVALID})):Bt(e.payload.downloadKey)?Za(new za({code:ua.MESSAGE_MERGER_KEY_INVALID,message:la.MESSAGE_MERGER_KEY_INVALID})):this._moduleManager.getModule(no).downloadMergerMessage(e).catch((function(e){return Za(new za({code:ua.MESSAGE_MERGER_DOWNLOAD_FAIL,message:la.MESSAGE_MERGER_DOWNLOAD_FAIL}))}))}},{key:"createForwardMessage",value:function(e){return this._moduleManager.getModule(no).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof Ba?this._moduleManager.getModule(no).sendMessageInstance(e,t):Za(new za({code:ua.MESSAGE_SEND_NEED_MESSAGE_INSTANCE,message:la.MESSAGE_SEND_NEED_MESSAGE_INSTANCE}))}},{key:"callExperimentalAPI",value:function(e,t){return"handleGroupInvitation"===e?this._moduleManager.getModule(ro).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._moduleManager.getModule(No).isFeatureEnabled(t):Za(new za({code:ua.INVALID_OPERATION,message:la.INVALID_OPERATION}))}},{key:"revokeMessage",value:function(e){return this._moduleManager.getModule(no).revokeMessage(e)}},{key:"resendMessage",value:function(e){return this._moduleManager.getModule(no).resendMessage(e)}},{key:"deleteMessage",value:function(e){return this._moduleManager.getModule(no).deleteMessage(e)}},{key:"modifyMessage",value:function(e){return this._moduleManager.getModule(no).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._moduleManager.getModule(lo).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._moduleManager.getModule(lo).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._moduleManager.getModule(lo).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._moduleManager.getModule(lo).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){return this._moduleManager.getModule(ro).getReadReceiptDetail(e)}},{key:"findMessage",value:function(e){return this._moduleManager.getModule(lo).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._moduleManager.getModule(lo).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._moduleManager.getModule(lo).getConversationList(e)}},{key:"getConversationProfile",value:function(e){return this._moduleManager.getModule(lo).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._moduleManager.getModule(lo).deleteConversation(e)}},{key:"pinConversation",value:function(e){return this._moduleManager.getModule(lo).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._moduleManager.getModule(lo).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._moduleManager.getModule(lo).setMessageRemindType(e)}},{key:"getMyProfile",value:function(){return this._moduleManager.getModule(ao).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._moduleManager.getModule(ao).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._moduleManager.getModule(ao).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._moduleManager.getModule(ao).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._moduleManager.getModule(ao).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._moduleManager.getModule(ao).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._moduleManager.getModule(ao).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._moduleManager.getModule(ao).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._moduleManager.getModule(ao).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._moduleManager.getModule(ao).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._moduleManager.getModule(io);return e?e.getLocalFriendList():Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"addFriend",value:function(e){var t=this._moduleManager.getModule(io);return t?t.addFriend(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._moduleManager.getModule(io);return t?t.deleteFriend(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"checkFriend",value:function(e){var t=this._moduleManager.getModule(io);return t?t.checkFriend(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._moduleManager.getModule(io);return t?t.getFriendProfile(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"updateFriend",value:function(e){var t=this._moduleManager.getModule(io);return t?t.updateFriend(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._moduleManager.getModule(io);return e?e.getLocalFriendApplicationList():Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._moduleManager.getModule(io);return t?t.acceptFriendApplication(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._moduleManager.getModule(io);return t?t.refuseFriendApplication(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._moduleManager.getModule(io);return t?t.deleteFriendApplication(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._moduleManager.getModule(io);return e?e.setFriendApplicationRead():Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._moduleManager.getModule(io);return e?e.getLocalFriendGroupList():Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._moduleManager.getModule(io);return t?t.createFriendGroup(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._moduleManager.getModule(io);return t?t.deleteFriendGroup(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._moduleManager.getModule(io);return t?t.addToFriendGroup(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._moduleManager.getModule(io);return t?t.removeFromFriendGroup(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._moduleManager.getModule(io);return t?t.renameFriendGroup(e):Za({code:ua.CANNOT_FIND_MODULE,message:la.CANNOT_FIND_MODULE})}},{key:"getGroupList",value:function(e){return this._moduleManager.getModule(ro).getGroupList(e)}},{key:"getGroupProfile",value:function(e){return this._moduleManager.getModule(ro).getGroupProfile(e)}},{key:"createGroup",value:function(e){return this._moduleManager.getModule(ro).createGroup(e)}},{key:"dismissGroup",value:function(e){return this._moduleManager.getModule(ro).dismissGroup(e)}},{key:"updateGroupProfile",value:function(e){return this._moduleManager.getModule(ro).updateGroupProfile(e)}},{key:"joinGroup",value:function(e){return this._moduleManager.getModule(ro).joinGroup(e)}},{key:"quitGroup",value:function(e){return this._moduleManager.getModule(ro).quitGroup(e)}},{key:"searchGroupByID",value:function(e){return this._moduleManager.getModule(ro).searchGroupByID(e)}},{key:"getGroupOnlineMemberCount",value:function(e){return this._moduleManager.getModule(ro).getGroupOnlineMemberCount(e)}},{key:"changeGroupOwner",value:function(e){return this._moduleManager.getModule(ro).changeGroupOwner(e)}},{key:"handleGroupApplication",value:function(e){return this._moduleManager.getModule(ro).handleGroupApplication(e)}},{key:"initGroupAttributes",value:function(e){return this._moduleManager.getModule(ro).initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._moduleManager.getModule(ro).setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._moduleManager.getModule(ro).deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._moduleManager.getModule(ro).getGroupAttributes(e)}},{key:"getGroupMemberList",value:function(e){return this._moduleManager.getModule(co).getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this._moduleManager.getModule(co).getGroupMemberProfile(e)}},{key:"addGroupMember",value:function(e){return this._moduleManager.getModule(co).addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this._moduleManager.getModule(co).deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this._moduleManager.getModule(co).setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this._moduleManager.getModule(co).setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this._moduleManager.getModule(co).setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this._moduleManager.getModule(co).setGroupMemberCustomField(e)}},{key:"getJoinedCommunityList",value:function(){return this._moduleManager.getModule(uo).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._moduleManager.getModule(uo).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._moduleManager.getModule(uo).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._moduleManager.getModule(uo).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._moduleManager.getModule(uo).getTopicList(e)}}]),e}(),Zr={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!==Zr[t])return!0;var o=e.getNotReadyReason(),n="";Object.getOwnPropertyNames(ua).forEach((function(e){ua[e]===o&&(n=la[e])}));var a={code:o,message:"".concat(n,"导致 sdk not ready。").concat(t," ").concat(la.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={},oi={};return oi.create=function(e){var o=0;if($e(e.SDKAppID))o=e.SDKAppID;else if(be.warn("TIM.create SDKAppID 的类型应该为 Number,请修改!"),o=parseInt(e.SDKAppID),isNaN(o))return be.error("TIM.create failed. 解析 SDKAppID 失败,请检查传参!"),null;if(o&&ti[o])return ti[o];be.log("TIM.create");var n=new Qr(t(t({},e),{},{SDKAppID:o}));n.on(C.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(to).forEach((function(o){if(e[o]){var n=to[o],a=new N;t[n]=function(){var t=Array.from(arguments);return a.use((function(t,n){var a=ei(e,o);return!0===a?n():Za(a)})).use((function(e,t){if(!0===Ht(e,eo[o],n))return t()})).use((function(t,n){return e[o].apply(e,t)})),a.run(t)}}})),t}(n);return ti[o]=a,be.log("TIM.create ok"),a},oi.TYPES=D,oi.EVENT=C,oi.VERSION="2.21.2",be.log("TIM.VERSION: ".concat(oi.VERSION)),oi}));
|