jiuyiUniapp/service/node_modules/@tencentcloud/chat/index.js

1 line
692 KiB
JavaScript

"use strict";!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).TencentCloudChat=t()}(this,function(){function o(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach(function(e){c(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function r(e){return(r="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 d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function e(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(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&&l(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(){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 _(e,t,n){return(_=p()?Reflect.construct:function(e,t,n){var o=[null],t=(o.push.apply(o,t),new(Function.bind.apply(e,o)));return n&&l(t,n.prototype),t}).apply(null,arguments)}function n(e){var n="function"==typeof Map?new Map:void 0;return function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return _(e,arguments,u(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),l(t,e)}(e)}function g(e,t){if(null==e)return{};var n,o=function(e,t){if(null==e)return{};for(var n,o={},i=Object.keys(e),a=0;a<i.length;a++)n=i[a],0<=t.indexOf(n)||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(e),a=0;a<i.length;a++)n=i[a],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(n){var o=p();return function(){var e,t=u(n),t=(e=o?(e=u(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),this);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return h(t)}}function m(e,t){return E(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,a=[],s=!0,r=!1;try{for(n=n.call(e);!(s=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);s=!0);}catch(e){r=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(r)throw i}}return a}}(e,t)||S(e,t)||O()}function D(e){return function(e){if(Array.isArray(e))return k(e)}(e)||L(e)||S(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 E(e){if(Array.isArray(e))return e}function L(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function S(e,t){if(e){if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function O(){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 N(e,t){var n,o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!o){if(Array.isArray(e)||(o=S(e))||t&&e&&"number"==typeof e.length)return o&&(e=o),n=0,{s:t=function(){},n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t};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 i,a=!0,s=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==o.return||o.return()}finally{if(s)throw i}}}}var G={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",ROOM_CUSTOM_DATA_RECEIVED:"onRoomCustomDataReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",MESSAGE_EXTENSIONS_UPDATED:"onMessageExtensionsUpdated",MESSAGE_EXTENSIONS_DELETED:"onMessageExtensionsDeleted",MESSAGE_REACTIONS_UPDATED:"onMessageReactionsUpdated",CONVERSATION_LIST_UPDATED:"onConversationListUpdated",TOTAL_UNREAD_MESSAGE_COUNT_UPDATED:"onTotalUnreadMessageCountUpdated",CONVERSATION_GROUP_LIST_UPDATED:"onConversationGroupListUpdated",CONVERSATION_IN_GROUP_UPDATED:"onConversationInGroupUpdated",GROUP_LIST_UPDATED:"onGroupListUpdated",GROUP_ATTRIBUTES_UPDATED:"groupAttributesUpdated",GROUP_COUNTER_UPDATED:"onGroupCounterUpdated",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",MY_FOLLOWERS_LIST_UPDATED:"onMyFollowersListUpdated",MY_FOLLOWING_LIST_UPDATED:"onMyFollowingListUpdated",MUTUAL_FOLLOWERS_LIST_UPDATED:"onMutualFollowersListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",ALL_RECEIVE_MESSAGE_OPT_UPDATED:"onAllReceiveMessageOptUpdated"},R={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,CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8,GRP_PRIVATE:"Private",GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_CHATROOM:"ChatRoom",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_ROOM:"Room",GRP_LIVE:"Live",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,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11,MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard",RECEIVE_WITH_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_MSG_EXCEPT_AT:"NotReceiveMsgExceptAt",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",INVITE_OPTIONS_DISABLE_INVITE:"DisableInvite",INVITE_OPTIONS_NEED_PERMISSION:"NeedPermission",INVITE_OPTIONS_FREE_ACCESS:"FreeAccess",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_INVITE_OPTION:"inviteOption",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,IOS_OFFLINE_PUSH_NO_SOUND:"push.no_sound",IOS_OFFLINE_PUSH_DEFAULT_SOUND:"default"},P={NEW_INVITATION_RECEIVED:"newInvitationReceived",INVITEE_ACCEPTED:"ts_invitee_accepted",INVITEE_REJECTED:"ts_invitee_rejected",INVITATION_CANCELLED:"ts_invitation_cancelled",INVITATION_TIMEOUT:"ts_invitation_timeout",INVITATION_MODIFIED:"ts_invitation_modified",ACTION_TYPE_UNKNOWN:0,ACTION_TYPE_INVITE:1,ACTION_TYPE_CANCEL_INVITE:2,ACTION_TYPE_ACCEPT_INVITE:3,ACTION_TYPE_REJECT_INVITE:4,ACTION_TYPE_INVITE_TIMEOUT:5},U=(e(j,[{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&&0<this.middlewares.length)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()}}]),j),b=(e(W,[{key:"equal",value:function(e){return null!==e&&this.low===e.low&&this.high===e.high}},{key:"toString",value:function(){var e=Number(this.high).toString(16),t=Number(this.low).toString(16);if(t.length<8)for(var n=8-t.length;n;)t="0"+t,n--;return e+t}}]),W),w={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"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"},INDONESIA:{DEFAULT:"wss://wssidn-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT0:"wss://*w4s.my-imcloud.com",DEFAULT:"wss://wsssgp.im.qcloud.com",IPV6:"wss://wsssgpv6.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{DEFAULT0:"wss://*w4k.my-imcloud.com",DEFAULT:"wss://wsskr.im.qcloud.com",IPV6:"wss://wsskrv6.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{DEFAULT0:"wss://*w4g.my-imcloud.com",DEFAULT:"wss://wssger.im.qcloud.com",IPV6:"wss://wssgerv6.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{DEFAULT0:"wss://*w4i.my-imcloud.com",DEFAULT:"wss://wssind.my-imcloud.com",IPV6:"wss://wssindv6.im.qcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.19.46"},JPN:{DEFAULT0:"wss://*w4j.my-imcloud.com",DEFAULT:"wss://wssjpn.im.qcloud.com",IPV6:"wss://wssjpnv6.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT0:"wss://*w4u.my-imcloud.com",DEFAULT:"wss://wssusa.im.qcloud.com",IPV6:"wss://wssusav6.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{DEFAULT0:"wss://*w4y.my-imcloud.com",DEFAULT:"wss://wssidn.im.qcloud.com",IPV6:"wss://wssidnv6.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},F={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19,NS_NATIVE_APP:20,RN_NATIVE_APP:21},q="1.7.3",x=537048168,V="CHINA",a={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent:function(){this.CURRENT=w.PRODUCTION[0<arguments.length&&void 0!==arguments[0]?arguments[0]:V]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GRP:"group_open_http_svc",GRP_AV:"group_open_avchatroom_http_svc",GRP_COMMUNITY:"million_group_open_http_svc",GRP_ATTR:"group_open_attr_http_svc",FD:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GRP_NO_AUTH:"group_open_http_noauth_svc",BIG_GRP_POLLING:"group_open_long_polling_http_svc",BIG_GRP_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_MSG:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush",IM_MSG_AUDIT_MGR:"im_msg_audit_mgr",TUIROOM_SVR:"tui_room_svr",IM_OPEN_TRANSLATE:"im_open_translate",IM_OPEN_SPEECH:"im_open_speech",MSG_SEARCH:"message_search",GRP_SEARCH:"group_search",GRP_MEMBER_SEARCH:"group_member_search",USER_SEARCH:"user_search",FOLLOW:"follow",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},H={SEARCH_GRP_SNS:new b(0,Math.pow(2,1)).toString(),AV_HISTORY_MSG:new b(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new b(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new b(0,Math.pow(2,4)).toString(),AV_MBR_LIST:new b(0,Math.pow(2,6)).toString(),USER_STATUS:new b(0,Math.pow(2,7)).toString(),CONV_MARK:new b(0,Math.pow(2,9)).toString(),CONV_GROUP:new b(0,Math.pow(2,10)).toString(),AV_BAN_MBR:new b(0,Math.pow(2,11)).toString(),MSG_EXT:new b(0,Math.pow(2,13)).toString(),GRP_COUNTER:new b(0,Math.pow(2,15)).toString(),PLUGIN_TRANSLATE:new b(Math.pow(2,6)).toString(),PLUGIN_VOICE_TO_TEXT:new b(Math.pow(2,7)).toString(),PLUGIN_CS:new b(Math.pow(2,8)).toString(),PLUGIN_PUSH:new b(Math.pow(2,9)).toString(),PLUGIN_BOT:new b(Math.pow(2,10)).toString(),MSG_REACTION:new b(Math.pow(2,16)).toString(),FOLLOW:new b(Math.pow(2,20)).toString()},B="group_profile",K=["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember","InviteJoinOption"],Y=["Role","JoinTime","MsgSeq","MsgFlag"];function W(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;d(this,W),this.high=e,this.low=t}function j(){d(this,j),this.cache=[],this.options=null}a.HOST.setCurrent(V);for(var J,z="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),X=z&&"function"==typeof wx.createGamePortal,Z="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),Q="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),$="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),ee="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),te="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,ne="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,oe=z&&"object"===r(wx.miniapp),ie="undefined"!=typeof uni,ae=z||Z||Q||$||ee||ne||te,se="undefined"==typeof window&&!ae&&"undefined"!=typeof global&&void 0!==global.NativeScriptGlobals,re="undefined"!=typeof global&&(void 0!==global.nativeModuleProxy||void 0!==global.ReactNative),ce="undefined"!=typeof uni?!ae:"undefined"!=typeof window&&!ae&&!re,ue=Z?qq:Q?tt:$?swan:ee?my:z?wx:ne?uni:te?jd:{},le=ce&&window&&window.navigator&&window.navigator.userAgent||"",de=(te="WEB",/(micromessenger|webbrowser)/i.test(le)?te="WEB":Z?te="QQ_MP":Q?te="TT_MP":$?te="BAIDU_MP":ee?te="ALI_MP":z?te=oe?"DONUT_NATIVE_APP":"WX_MP":ne?te="UNI_NATIVE_APP":se?te="NS_NATIVE_APP":re&&(te="RN_NATIVE_APP"),F[te]),oe=/iPad/i.test(le),se=/iPhone/i.test(le)&&!oe,te=/iPod/i.test(le),pe=se||oe||te,_e=(se=le.match(/OS (\d+)_/i))&&se[1]?se[1]:null,he=/Android/i.test(le),ge=function(){var e=le.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),oe=/Edge/i.test(le),te=!oe&&/Chrome/i.test(le),fe=/MSIE/.test(le)||-1<le.indexOf("Trident")&&-1<le.indexOf("rv:11.0"),me=se=!(se=(se=/MSIE\s(\d+)\.\d/.exec(le))&&parseFloat(se[1]))&&/Trident\/7.0/i.test(le)&&/rv:11.0/.test(le)?11:se,ve=/Safari/i.test(le)&&!te&&!he&&!oe,Ie=/Windows/i.test(le),Me=/MAC OS X/i.test(le),ye=ce&&"undefined"!=typeof Worker&&!fe,Ce=he||pe,Te=ce&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy,De=function(){if("undefined"==typeof window||void 0===window.navigator)return!1;var e=window.navigator.standalone;return!(!pe||e||ve)}(),Ee="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{},Le=function(){},Se=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],ke=Se.length;ke--;)J=Se[ke],console[J]||(Ee[J]=Le);function Re(){var e=new Date;return e.setTime(Pe()),e}function Ae(){Ge=0}function Oe(){return Math.floor(Pe()/1e3)}var Ne=Ee,Ge=0,Pe=function(){return(new Date).getTime()+Ge},Ue=0;function be(){return Jt()?"%c Chat %c":"Chat"}function we(){var e=Re();return e.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}(e.getMilliseconds())}var v={arguments2String:function(e){var t="";if(1===e.length)t=e[0];else for(var n=0,o=e.length;n<o;n++){if(mt(e[n]))try{t+=vt(e[n])?JSON.stringify(e[n],["message","code"]):JSON.stringify(e[n])}catch(e){t+=e?e.message:"";break}else t+=e[n];t+=" "}return t},_exec:function(e,t){Jt()?Ne[e](be(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",we(),t):Ne[e]("".concat(be()," ").concat(we()," ").concat(t))},d:function(){var e;Ue<=-1&&(e=this.arguments2String(arguments),this._exec("debug",e))},l:function(){var e;Ue<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},log:function(){var e;Ue<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},i:function(){var e;Ue<=1&&(e=this.arguments2String(arguments),this._exec("info",e))},w:function(){var e;Ue<=2&&(e=this.arguments2String(arguments),this._exec("warn",e))},e:function(){var e;Ue<=3&&(e=this.arguments2String(arguments),this._exec("error",e))},setLevel:function(e){e<4&&this._exec("log","set level from "+Ue+" to "+e),Ue=e},getLevel:function(){return Ue}},Fe={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},se="Tag_Profile_IM_",qe={NICK:"".concat(se,"Nick"),GENDER:"".concat(se,"Gender"),BIRTHDAY:"".concat(se,"BirthDay"),LOCATION:"".concat(se,"Location"),SELFSIGNATURE:"".concat(se,"SelfSignature"),ALLOWTYPE:"".concat(se,"AllowType"),LANGUAGE:"".concat(se,"Language"),AVATAR:"".concat(se,"Image"),MESSAGESETTINGS:"".concat(se,"MsgSettings"),ADMINFORBIDTYPE:"".concat(se,"AdminForbidType"),LEVEL:"".concat(se,"Level"),ROLE:"".concat(se,"Role")},xe={GROUP:"".concat("Tag_SNS_IM_","Group"),REMARK:"".concat("Tag_SNS_IM_","Remark"),ADDSOURCE:"".concat("Tag_SNS_IM_","AddSource"),ADDWORDING:"".concat("Tag_SNS_IM_","Wording"),ADDTIME:"".concat("Tag_SNS_IM_","AddTime")},te="Gender_Type_",Ve={UNKNOWN:"".concat(te,"Unknown"),FEMALE:"".concat(te,"Female"),MALE:"".concat(te,"Male")},He={NONE:"".concat("AdminForbid_Type_","None"),SEND_OUT:"".concat("AdminForbid_Type_","SendOut")},Be={NEED_CONFIRM:"".concat("AllowType_Type_","NeedConfirm"),ALLOW_ANY:"".concat("AllowType_Type_","AllowAny"),DENY_ANY:"".concat("AllowType_Type_","DenyAny")},Ke="JoinedSuccess",Ye="WaitAdminApproval",We="@TOPIC#_",je=Object.prototype.hasOwnProperty;function Je(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(et(e)){for(var t in e)if(je.call(e,t))return!1;return!0}return!!(ze(e)||Xe(e)||Ze(e))&&0===e.size}function ze(e){return"map"===It(e)}function Xe(e){return"set"===It(e)}function Ze(e){return"file"===It(e)}function Qe(e){return null!==e&&("number"==typeof e&&!isNaN(+e)||"object"===r(e)&&e.constructor===Number)}function $e(e){return null!==e&&"object"===r(e)}function et(e){if("object"===r(e)&&null!==e){if(null===(e=Object.getPrototypeOf(e)))return 1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return e===t}}function nt(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===It(e)}function ot(e){return nt(e)&&0<e.length}function it(e){return"function"==typeof e}function at(e){return"filelist"===It(e)}function st(e){return"string"==typeof e&&(e=e[0],!/[^a-zA-Z0-9]/.test(e))}function rt(e,t,n,o){if(!mt(e)||!mt(t))return 0;for(var i,a=0,s=Object.keys(t),r=0,c=s.length;r<c;r++)if(i=s[r],!(A(t[i])||n&&n.includes(i)))if(mt(e[i])&&mt(t[i]))a+=rt(e[i],t[i],n,o);else{if(o&&o.includes(t[i]))continue;e[i]!==t[i]&&(e[i]=t[i],a+=1)}return a}function ct(e,t){var n,o=new Map,i=N(e.entries());try{for(i.s();!(n=i.n()).done;){var a=m(n.value,2),s=a[0],r=a[1];r&&o.set(s,t?JSON.stringify(r):JSON.parse(JSON.stringify(r)))}}catch(e){i.e(e)}finally{i.f()}return o}function ut(e){if(0===e.length)return 0;for(var t=0,n=0,o="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";void 0!==e[t];)n+=e[t++].charCodeAt[t]<=255?1:!1===o?3:2;return n}function lt(e){return e=e||99999999,Math.round(Math.random()*e)}function dt(){for(var e="",t=32;0<t;--t)e+=Mt[Math.floor(Math.random()*yt)];return e}function pt(e,t){for(var n in e)if(e[n]===t)return 1}function _t(e){return-1===e.indexOf("http://")||-1===e.indexOf("https://")?"https://"+e:e.replace(/https|http/,"https")}function ht(e){if(0===Object.getOwnPropertyNames(e).length)return Object.create(null);var t,n,o=Array.isArray(e)?[]:Object.create(null);for(n in e)null!==e[n]?void 0!==e[n]?(t=r(e[n]),0<=["string","number","function","boolean"].indexOf(t)?o[n]=e[n]:o[n]=ht(e[n])):o[n]=void 0:o[n]=null;return o}var gt=["url"],ft=function(e){return"string"==typeof e},A=function(e){return void 0===e},mt=function(e){return nt(e)||$e(e)},vt=function(e){return e instanceof Error},It=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},Mt=(Date.now||(Date.now=function(){return(new Date).getTime()}),"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),yt=Mt.length,Ct={};function Tt(o,e){if(!nt(o)||!nt(e))return!1;var i=!1;return e.forEach(function(e){var t=e.key,e=e.value,n=o.find(function(e){return e.key===t});n?n.value!==e&&(n.value=e,i=!0):(o.push({key:t,value:e}),i=!0)}),i}function Dt(e){return Je(e)?[]:e.filter(function(e){return!0===e.isModified})}function Et(e){if(et(e)&&et(e.webhookInfo)){var t=[];if(e.webhookInfo.disableCloudMessagePreHook&&t.push("ForbidBeforeSendMsgCallback"),e.webhookInfo.disableCloudMessagePostHook&&t.push("ForbidAfterSendMsgCallback"),0!==t.length)return t}}function Lt(e){return Je(e)?[]:e.filter(function(e){return!1===e.isModified})}function St(e){return e===R.GRP_AVCHATROOM}function kt(e){var t=e.type,e=e.groupID;return t===R.GRP_COMMUNITY||"".concat(e).startsWith("@TGS#_")&&!"".concat(e).includes(We)}function Rt(e){return"".concat(e).startsWith("@TGS#_")&&"".concat(e).includes(We)}function At(e){return ft(e)&&e.slice(0,3)===R.CONV_C2C}function Ot(e){return ft(e)&&e.slice(0,5)===R.CONV_GROUP}function Nt(e){return ft(e)&&e===R.CONV_SYSTEM}function Gt(t,n){var o={};return Object.keys(t).forEach(function(e){o[e]=n(t[e],e)}),o}function Pt(o){return re?Promise.resolve({width:0,height:0}):ae?new Promise(function(t,e){ue.getImageInfo({src:o,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(e,t){var n=new Image;n.onload=function(){e({width:this.width,height:this.height}),n=null},n.onerror=function(){e({width:0,height:0}),n=null},n.src=o})}function Ut(){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 bt(){var e=he?"android":pe?"ios":Ie?"windows":Me?"mac":"unknown";if(ae)try{var t=ue.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(e){}return e}function wt(e,t){e=e.split("."),t=t.split(".");for(var n=Math.max(e.length,t.length);e.length<n;)e.push("0");for(;t.length<n;)t.push("0");for(var o=0;o<n;o++){var i=parseInt(e[o]),a=parseInt(t[o]);if(a<i)return 1;if(i<a)return-1}return 0}function Ft(e){var t=e.originUrl,t=void 0===t?void 0:t,n=e.originWidth,o=e.originHeight,e=e.min,e=void 0===e?198:e,n=parseInt(n),o=parseInt(o),i={url:void 0,width:0,height:0};return(n<=o?n:o)<=e?(i.url=t,i.width=n,i.height=o):(o<=n?(i.width=Math.ceil(n*e/o),i.height=e):(i.width=e,i.height=Math.ceil(o*e/n)),o=t&&-1<t.indexOf("?")?"".concat(t,"&"):"".concat(t,"?"),i.url="".concat(o,198===e?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")),A(t)?(i.url,g(i,gt)):i}function qt(e){var t=e[2];e[2]=e[1],e[1]=t;for(var n=0;n<e.length;n++)e[n].setType(n)}function xt(e){e=e.servcmd;return e.slice(e.indexOf(".")+1)}function Vt(e,t){return Math.round(Number(e)*Math.pow(10,t))/Math.pow(10,t)}function Ht(e,t){return e.includes(t)}function Bt(e,t){return e.includes(t)}function Kt(e){return e.split(We)[0]}var Yt=function(e,t,n){if(A(t))return"";switch(e){case R.MSG_TEXT:return t.text;case R.MSG_IMAGE:return n?"[Image]":"[图片]";case R.MSG_LOCATION:return n?"[Location]":"[位置]";case R.MSG_AUDIO:return n?"[Voice]":"[语音]";case R.MSG_VIDEO:return n?"[Video]":"[视频]";case R.MSG_FILE:return n?"[File]":"[文件]";case R.MSG_CUSTOM:return n?"[Custom Messages]":"[自定义消息]";case R.MSG_GRP_TIP:return n?"[Group Notification]":"[群提示消息]";case R.MSG_GRP_SYS_NOTICE:return n?"[Group System Message]":"[群系统通知]";case R.MSG_FACE:return n?"[Animated Sticker]":"[动画表情]";case R.MSG_MERGER:return n?"[Chat Record]":"[聊天记录]";default:return""}};function Wt(e){return e===R.MSG_TEXT||e===R.MSG_CUSTOM||e===R.MSG_LOCATION||e===R.MSG_FACE}function jt(e){var t=[];if(!ft(e))return t;var n=e.length;if(0===n)return t;for(var o=n-1;0<=o;o--)"1"===e[o]&&t.push(Math.pow(2,n-o-1));return t}function Jt(){return!fe&&!ae}function zt(e){return"the length of userIDList cannot exceed ".concat(e)}function Xt(e){var t;if(nt(e)&&0!==e.length)return t=0,e.forEach(function(e){t+=e}),t.toFixed(0)}function Zt(e){var t;if(nt(e)&&0!==e.length)return t=0,e.forEach(function(e){t+=e}),(t/e.length).toFixed(0)}function Qt(e,t,n){var t=!(1<arguments.length&&void 0!==t)||t,n=!(2<arguments.length&&void 0!==n)||n,o=Date.now();return t?n?"".concat(o-e," ms"):"".concat(Math.round((o-e)/1e3)," s"):n?o-e:Math.round((o-e)/1e3)}function $t(e){return e&&1<e?!0:!1}function en(e,t,n,o){if(void 0===t)return 1;var i,a,s=!0;return t.required&&Je(e)&&(v.e("[".concat(n,'] Missing required params: "').concat(o,'".')),s=!1),Je(e)||(i=It(e))!==(a=t.type.toLowerCase())&&("asyncfunction"===i&&"function"===a||(v.e("[".concat(n,'] Invalid params: type check failed for "').concat(o,'". Expected ').concat(t.type,".")),s=!1)),t.validator&&!t.validator(e,n,o)&&(v.e("[".concat(n,'] Invalid params: custom validator check failed for "').concat(o,'".')),s=!1),s}function tn(e){return!!e&&(!!(At(e)||Ot(e)||Nt(e))||((e=xn("InvalidConversationID",e))&&v.w(e),!1))}function s(e){""!==e.desc&&""!==xn("API_REFER")&&v.w("[".concat(e.api,"] | ").concat(e.paramName," | ").concat(e.desc,", ").concat(xn("API_REFER")).concat(e.api))}function nn(){return xn("StringRequiredLog")}function on(e){return xn("NonEmptyStringRequiredLog",e)}function an(){return xn("NumberRequiredLog")}function sn(){return xn("UndefinedNotAllowedLog")}function rn(){return xn("FileRequiredLog")}function cn(){return xn("FunctionRequiredLog")}function un(){return xn("ArrayRequiredLog")}function ln(){return xn("NonEmptyArrayLog")}function dn(){return xn("CallbackMissingLog")}function pn(){return xn("PositiveIntegerRequiredLog")}function _n(e,t){return xn("StringNotLongerThanLog",e,t)}function hn(e,t){return xn("NumberGreaterThanLog",e,t)}function gn(e,t){return xn("NumberGreaterOrEqualLog",e,t)}function fn(e){return xn("KeyValueStringRequiredLog",e)}function mn(){return xn("PlainObjectRequiredLog")}function vn(){return xn("NonEmptyContentRequiredLog")}function In(){return xn("FileNotSelectedLog")}function Mn(){return xn("MessageInstanceRequiredLog")}function yn(){return xn("NonAnonymousFunctionLog")}function Cn(){return xn("MessageExtensionNotAvailableLog")}function Tn(){return xn("MessageReactionRequiredLog")}function Dn(e,t){return xn("ContainsUnsupportedTypeLog",e,t)}function En(e,t,n,o){var i=o.allowUndefined,a=o.allowEmpty,o=o.maxLength;return A(e)?!!i||(s({api:t,paramName:n,desc:sn()}),!1):nt(e)?!(0===e.length&&(s({api:t,paramName:n,desc:ln()}),!a)||o&&e.length>o&&(s({api:t,paramName:n,desc:xn("MaximumArrayLengthLog",n,o)}),1)):(s({api:t,paramName:n,desc:un()}),!1)}function Ln(e,t,n,o){var i=o.allowUndefined,a=o.min,o=o.max;return A(e)?!!i||(s({api:t,paramName:n,desc:sn()}),!1):Qe(e)?Qe(a)&&e<a?(s({api:t,paramName:n,desc:0===a?gn(n,a):hn(n,a-1)}),!1):!(Qe(o)&&o<e&&(s({api:t,paramName:n,desc:xn("MaximumNumberLog",n,o)}),1)):(s({api:t,paramName:n,desc:an()}),!1)}function Sn(e){return{code:0,data:e||{}}}function kn(e){return Promise.resolve(Sn(e))}function C(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(e instanceof Bn)return t&&null!==Kn&&Kn.emit(G.ERROR,e),Promise.reject(e);if(e instanceof Error)return n=new Bn({code:T.UNCAUGHT_ERROR}),t&&null!==Kn&&Kn.emit(G.ERROR,n),Promise.reject(n);if(A(e)||A(e.code))return Promise.reject(new Bn({code:T.UNCAUGHT_ERROR}));var n=new Bn(e);return t&&null!==Kn&&Kn.emit(G.ERROR,n),Promise.reject(n)}var Rn,An="unSend",On="success",Nn="fail",Gn="notStart",Pn="pending",Un="resolved",bn="rejected",oe={type:"String",required:!0},se={type:"Array",required:!0},te={type:"Object",required:!0},wn={type:"Boolean",required:!0},Fn={type:"number",required:!0},qn={keywordListForMsg:{type:"Array",required:!1,validator:function(e,t,n){return En(e,t,n,{allowUndefined:!0,allowEmpty:!0,maxLength:5})}},keywordListExceptMsg:{type:"Array",required:!0,validator:function(e,t,n){return En(e,t,n,{allowUndefined:!1,allowEmpty:!1,maxLength:5})}},keywordListMatchType:{type:"String",required:!1,validator:function(e,t,n){return!e||"or"===e||"and"===e||s({api:t,paramName:n,desc:"".concat(e," is invalid match type")})}},cursor:{type:"String",required:!1},count:{type:"Number",required:!1,validator:function(e,t,n){return Ln(e,t,n,{allowUndefined:!0,min:1,max:100})}},groupTypeList:{type:"Array",required:!1,validator:function(e,t,n){if(!e)return!0;if(!En(e,t,n,{allowUndefined:!0,allowEmpty:!0}))return!1;var o=[R.GRP_PUBLIC,R.GRP_COMMUNITY,R.GRP_WORK,R.GRP_MEETING];return!(0<e.filter(function(e){return-1===o.indexOf(e)}).length&&(s({api:t,paramName:n,desc:Dn(n,"group")}),1))}}},xn=null,Vn={hookGetAPITips:function(e){xn=e},login:{userID:oe,userSig:oe},addToBlacklist:{userIDList:se},removeFromBlacklist:{userIDList:se},on:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(s({api:t,paramName:n,desc:on(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(s({api:t,paramName:n,desc:cn()}),!1):(""===e.name&&s({api:t,paramName:n,desc:yn()}),!0)}}],once:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(s({api:t,paramName:n,desc:on(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(s({api:t,paramName:n,desc:cn()}),!1):(""===e.name&&s({api:t,paramName:n,desc:yn()}),!0)}}],off:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(s({api:t,paramName:n,desc:on(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(s({api:t,paramName:n,desc:cn()}),!1):(""===e.name&&s({api:t,paramName:n,desc:yn()}),!0)}}],sendMessage:[y({name:"message"},te)],setMessageExtensions:[y(y({name:"message"},te),{},{validator:function(e,t,n){return e.status===On&&!0===e.isSupportExtension||(s({api:t,paramName:n,desc:Cn()}),!1)}}),y({name:"extensions"},se)],getMessageExtensions:[y(y({name:"message"},te),{},{validator:function(e,t,n){return e.status===On&&!0===e.isSupportExtension||(s({api:t,paramName:n,desc:Cn()}),!1)}})],deleteMessageExtensions:[y(y({name:"message"},te),{},{validator:function(e,t,n){return e.status===On&&!0===e.isSupportExtension||(s({api:t,paramName:n,desc:Cn()}),!1)}})],addMessageReaction:[y(y({name:"message"},te),{},{validator:function(e,t,n){return e.status===On||(s({api:t,paramName:n,desc:Tn()}),!1)}}),y({name:"reactionID"},oe)],removeMessageReaction:[y(y({name:"message"},te),{},{validator:function(e,t,n){return e.status===On||(s({api:t,paramName:n,desc:Tn()}),!1)}}),y({name:"reactionID"},oe)],getMessageReactions:{messageList:y({},se)},getAllUserListOfMessageReaction:{message:y(y({},te),{},{validator:function(e,t,n){return e.status===On||(s({api:t,paramName:n,desc:Tn()}),!1)}}),reactionID:y({},oe),nextSeq:{type:"Number"},count:{type:"Number"}},getMessageList:{conversationID:y(y({},oe),{},{validator:tn}),nextReqMessageID:{type:"String"},count:{type:"Number",validator:function(e,t,n){return!(!A(e)&&!/^[1-9][0-9]*$/.test(e)&&(s({api:t,paramName:n,desc:pn()}),1))}}},getMessageListHopping:{conversationID:y(y({},oe),{},{validator:tn}),sequence:{type:"Number"},time:{type:"Number"},direction:{type:"Number",validator:function(e,t,n){return!(!A(e)&&0!==e&&1!==e&&(s({api:t,paramName:n,desc:xn("0Or1RequiredLog")}),1))}},count:{type:"Number",validator:function(e,t,n){return!(!A(e)&&!/^[1-9][0-9]*$/.test(e)&&(s({api:t,paramName:n,desc:pn}),1))}}},setMessageRead:{conversationID:y(y({},oe),{},{validator:tn})},setAllMessageRead:{scope:{type:"String",required:!1,validator:function(e,t,n){return!e||-1!==[R.READ_ALL_C2C_MSG,R.READ_ALL_GROUP_MSG,R.READ_ALL_MSG].indexOf(e)||(s({api:t,paramName:n,desc:xn("ValidScopeRequired")}),!1)}}},getConversationProfile:[y(y({name:"conversationID"},oe),{},{validator:tn})],clearHistoryMessage:[y(y({name:"conversationID"},oe),{},{validator:tn})],pinConversation:{conversationID:y(y({},oe),{},{validator:tn}),isPinned:y({},wn)},setConversationDraft:{conversationID:y(y({},oe),{},{validator:tn}),draftText:{type:"String",validator:function(e,t,n){return!!ft(e)||(s({api:t,paramName:n,desc:nn()}),!1)}}},setConversationCustomData:{conversationIDList:y({},se),customData:{type:"String",validator:function(e,t,n){return ft(e)?!(256<e.length&&(s({api:t,paramName:n,desc:_n(n,256)}),1)):(s({api:t,paramName:n,desc:nn()}),!1)}}},markConversation:{conversationIDList:y({},se),markType:{type:"number",validator:function(e,t,n){return Qe(e)?e<=0?(s({api:t,paramName:n,desc:hn(n,0)}),!1):!(e>=Math.pow(2,64)&&(s({api:t,paramName:n,desc:xn("NumberLessThanLog",n,"Math.pow(2,64)")}),1)):(s({api:t,paramName:n,desc:an()}),!1)}},enableMark:y({},wn)},createConversationGroup:{conversationIDList:y({},se),groupName:y(y({},oe),{},{validator:function(e,t,n){return!(!e||32<e.length&&(s({api:t,paramName:n,desc:_n(n,32)}),1))}})},deleteConversationGroup:[y({name:"groupName"},oe)],renameConversationGroup:{oldName:y({},oe),newName:y(y({},oe),{},{validator:function(e,t,n){return!(!e||32<e.length&&(s({api:t,paramName:n,desc:_n(n,32)}),1))}})},addConversationsToGroup:{conversationIDList:y({},se),groupName:y({},oe)},deleteConversationsFromGroup:{conversationIDList:y({},se),groupName:y({},oe)},getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:oe,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:se},createGroup:{name:oe},joinGroup:{groupID:oe,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[y({name:"groupID"},oe)],handleApplication:{message:te,handleAction:oe,handleMessage:{type:"String"}},changeGroupOwner:{groupID:oe,newOwnerID:oe},updateGroupProfile:{groupID:oe,muteAllMembers:{type:"Boolean"}},dismissGroup:[y({name:"groupID"},oe)],searchGroupByID:[y({name:"groupID"},oe)],getGroupOnlineMemberCount:[y({name:"groupID"},oe)],initGroupAttributes:{groupID:oe,groupAttributes:y(y({},te),{},{validator:function(t,n,o){var i=!0;return Object.keys(t).forEach(function(e){if(!ft(t[e]))return s({api:n,paramName:o,desc:fn("value")}),i=!1}),i}})},setGroupAttributes:{groupID:oe,groupAttributes:y(y({},te),{},{validator:function(t,n,o){var i=!0;return Object.keys(t).forEach(function(e){if(!ft(t[e]))return s({api:n,paramName:o,desc:fn("value")}),i=!1}),i}})},deleteGroupAttributes:{groupID:oe,keyList:{type:"Array",validator:function(e,t,n){return A(e)||!nt(e)?(s({api:t,paramName:n,desc:un()}),!1):!!Je(e)||(o=!0,e.forEach(function(e){if(!ft(e))return s({api:t,paramName:n,desc:xn("StringArrayRequiredLog")}),o=!1}),o);var o}}},getGroupAttributes:{groupID:oe,keyList:{type:"Array",validator:function(e,t,n){return A(e)||!nt(e)?(s({api:t,paramName:n,desc:un()}),!1):!!Je(e)||(o=!0,e.forEach(function(e){if(!ft(e))return s({api:t,paramName:n,desc:fn("key")}),o=!1}),o);var o}}},setGroupCounters:{groupID:oe,counters:te},increaseGroupCounter:{groupID:oe,key:oe,value:Fn},decreaseGroupCounter:{groupID:oe,key:oe,value:Fn},getGroupCounters:{groupID:oe},getGroupMemberList:{groupID:oe,count:{type:"Number"}},getGroupMemberProfile:{groupID:oe,userIDList:se,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:oe,userIDList:se},setGroupMemberRole:{groupID:oe,userID:oe,role:oe},setGroupMemberMuteTime:{groupID:oe,userID:oe,muteTime:{type:"Number",validator:function(e){return 0<=e}}},setGroupMemberNameCard:{groupID:oe,userID:{type:"String"},nameCard:{type:"String",validator:function(e,t,n){return ft(e)?(e.length,!0):(s({api:t,paramName:n,desc:nn()}),!1)}}},setGroupMemberCustomField:{groupID:oe,userID:{type:"String"},memberCustomField:se},deleteGroupMember:{groupID:oe},markGroupMemberList:{groupID:oe,markType:{type:"number",validator:function(e,t,n){return Qe(e)?!(e<1e3&&(s({api:t,paramName:n,desc:gn(n,1e3)}),1)):(s({api:t,paramName:n,desc:an()}),!1)}},userIDList:y({},se),enableMark:y({},wn)},createTextMessage:{to:oe,conversationType:oe,payload:y(y({},te),{},{validator:function(e,t,n){return et(e)?ft(e.text)?0!==e.text.length||(s({api:t,paramName:"payload.text",desc:vn()}),!1):(s({api:t,paramName:"payload.text",desc:nn()}),!1):(s({api:t,paramName:n,desc:mn()}),!1)}})},createTextAtMessage:{to:oe,conversationType:oe,payload:y(y({},te),{},{validator:function(e,t,n){return et(e)?ft(e.text)?0===e.text.length?(s({api:t,paramName:"payload.text",desc:vn()}),!1):!(e.atUserList&&!nt(e.atUserList)&&(s({api:t,paramName:"payload.atUserList",desc:un()}),1)):(s({api:t,paramName:"payload.text",desc:nn()}),!1):(s({api:t,paramName:n,desc:mn()}),!1)}})},createCustomMessage:{to:oe,conversationType:oe,payload:y(y({},te),{},{validator:function(e,t,n){return et(e)?e.data&&!ft(e.data)?(s({api:t,paramName:"payload.data",desc:nn()}),!1):e.description&&!ft(e.description)?(s({api:t,paramName:"payload.description",desc:nn()}),!1):!(e.extension&&!ft(e.extension)&&(s({api:t,paramName:"payload.extension",desc:nn()}),1)):(s({api:t,paramName:"payload",desc:mn()}),!1)}})},createImageMessage:{to:oe,conversationType:oe,payload:y(y({},te),{},{validator:function(e,t,n){if(!et(e))return s({api:t,paramName:n,desc:mn()}),!1;if(A(e.file))return s({api:t,paramName:"payload.file",desc:sn()}),!1;if(ce){if(!(e.file instanceof HTMLInputElement||Ze(e.file)))return et(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(s({api:t,paramName:"payload.file",desc:In()}),!1):(s({api:t,paramName:"payload.file",desc:rn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return s({api:t,paramName:"payload.file",desc:In()}),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e,t,n){return A(e)&&s({api:t,paramName:n,desc:dn()}),!0}}})},createAudioMessage:{to:oe,conversationType:oe,payload:y(y({},te),{},{validator:function(e,t,n){return!!et(e)||(s({api:t,paramName:n,desc:mn()}),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return A(e)&&s({api:t,paramName:n,desc:dn()}),!0}}},createVideoMessage:{to:oe,conversationType:oe,payload:y(y({},te),{},{validator:function(e,t,n){if(!et(e))return s({api:t,paramName:n,desc:mn()}),!1;if(A(e.file))return s({api:t,paramName:"payload.file",desc:sn()}),!1;if(ce){if(!(e.file instanceof HTMLInputElement||Ze(e.file)))return et(e.file)&&"undefined"!=typeof uni?!!Ze(e.file.tempFile)||(s({api:t,paramName:"payload.file",desc:In()}),!1):(s({api:t,paramName:"payload.file",desc:rn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return s({api:t,paramName:"payload.file",desc:In()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return A(e)&&s({api:t,paramName:n,desc:dn()}),!0}}},createFaceMessage:{to:oe,conversationType:oe,payload:y(y({},te),{},{validator:function(e,t,n){return et(e)?Qe(e.index)?!!ft(e.data)||(s({api:t,paramName:"payload.data",desc:nn()}),!1):(s({api:t,paramName:"payload.index",desc:an()}),!1):(s({api:t,paramName:n,desc:mn()}),!1)}})},createFileMessage:{to:oe,conversationType:oe,payload:y(y({},te),{},{validator:function(e,t,n){if(!et(e))return s({api:t,paramName:n,desc:mn()}),!1;if(A(e.file))return s({api:t,paramName:"payload.file",desc:sn()}),!1;if(ce){if(!(e.file instanceof HTMLInputElement||Ze(e.file)))return et(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(s({api:t,paramName:"payload.file",desc:In()}),!1):(s({api:t,paramName:"payload.file",desc:rn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return s({api:t,paramName:"payload.file",desc:In()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return A(e)&&s({api:t,paramName:n,desc:dn()}),!0}}},createLocationMessage:{to:oe,conversationType:oe,payload:y(y({},te),{},{validator:function(e,t,n){return et(e)?ft(e.description)?Qe(e.longitude)?!!Qe(e.latitude)||(s({api:t,paramName:"payload.latitude",desc:an()}),!1):(s({api:t,paramName:"payload.longitude",desc:an()}),!1):(s({api:t,paramName:"payload.description",desc:nn()}),!1):(s({api:t,paramName:n,desc:mn()}),!1)}})},createMergerMessage:{to:oe,conversationType:oe,payload:y(y({},te),{},{validator:function(e,t,n){if(Je(e.messageList))return s({api:t,paramName:"payload.messageList",desc:ln()}),!1;if(Je(e.compatibleText))return s({api:t,paramName:"payload.compatibleText",desc:on("compatibleText")}),!1;var o=!1;return e.messageList.forEach(function(e){e.status===Nn&&(o=!0)}),!o||(s({api:t,paramName:"payload.messageList",desc:xn("MergeFailedMessageLog")}),!1)}})},revokeMessage:[y(y({name:"message"},te),{},{validator:function(e,t,n){return Je(e)?(s({api:t,paramName:n,desc:Mn()}),!1):e.conversationType===R.CONV_SYSTEM?(s({api:t,paramName:n,desc:xn("MessageCanBeRevokedDesc")}),!1):!0!==e.isRevoked||(s({api:t,paramName:n,desc:xn("MessageRevokedLog")}),!1)}})],deleteMessage:[y(y({name:"messageList"},se),{},{validator:function(e,t,n){return!Je(e)||(s({api:t,paramName:n,desc:ln()}),!1)}})],translateText:{sourceTextList:se,sourceLanguage:oe,targetLanguage:oe},convertVoiceToText:{message:y(y({},te),{},{validator:function(e,t,n){return Je(e)?(s({api:t,paramName:n,desc:Mn()}),!1):e.type===R.MSG_AUDIO&&e.status===On||(s({api:t,paramName:n,desc:xn("AudioMessageRequiredLog")}),!1)}})},modifyMessage:[y(y({name:"message"},te),{},{validator:function(e,t,n){return Je(e)?(s({api:t,paramName:n,desc:Mn()}),!1):e.conversationType===R.CONV_SYSTEM?(s({api:t,paramName:n,desc:xn("MessageCanBeModifiedLog")}),!1):!0!==e._onlineOnlyFlag||(s({api:t,paramName:n,desc:xn("OnlineMessageNotSupportLog")}),!1)}})],searchCloudMessages:{keywordList:qn.keywordListForMsg,keywordListMatchType:qn.keywordListMatchType,cursor:qn.cursor,senderUserIDList:{type:"Array",required:!1,validator:function(e,t,n){return En(e,t,n,{allowUndefined:!0,allowEmpty:!0,maxLength:5})}},messageTypeList:{type:"Array",required:!1,validator:function(e,t,n){if(!e)return!0;if(!En(e,t,n,{allowUndefined:!0,allowEmpty:!0}))return!1;var o=[R.MSG_TEXT,R.MSG_IMAGE,R.MSG_AUDIO,R.MSG_FILE,R.MSG_VIDEO,R.MSG_LOCATION,R.MSG_CUSTOM,R.MSG_MERGER];return!(0<e.filter(function(e){return-1===o.indexOf(e)}).length&&(s({api:t,paramName:n,desc:Dn(n,"message")}),1))}},conversationID:{type:"String",required:!1,validator:function(e){return!e||tn(e)}},timePosition:{type:"number",required:!1,validator:function(e,t,n){return Ln(e,t,n,{allowUndefined:!0,min:0})}},timePeriod:{type:"number",required:!1,validator:function(e,t,n){return Ln(e,t,n,{allowUndefined:!0,min:0})}}},searchCloudUsers:{keywordList:qn.keywordListExceptMsg,keywordListMatchType:qn.keywordListMatchType,cursor:qn.cursor,count:qn.count,miniBirthday:{type:"Number",required:!1,validator:function(e,t,n){return Ln(e,t,n,{allowUndefined:!0,min:0})}},maxBirthday:{type:"Number",required:!1,validator:function(e,t,n){return Ln(e,t,n,{allowUndefined:!0,min:0})}},gender:{type:"String",required:!1,validator:function(e,t,n){return!e||e===R.GENDER_FEMALE||e===R.GENDER_MALE||s({api:t,paramName:n,desc:"".concat(e," is invalid match type")})}}},searchCloudGroups:{keywordList:qn.keywordListExceptMsg,keywordListMatchType:qn.keywordListMatchType,cursor:qn.cursor,count:qn.count,groupTypeList:qn.groupTypeList},searchCloudGroupMembers:{keywordList:qn.keywordListExceptMsg,keywordListMatchType:qn.keywordListMatchType,cursor:qn.cursor,count:qn.count,groupTypeList:qn.groupTypeList,groupIDList:{type:"Array",required:!1,validator:function(e,t,n){return En(e,t,n,{allowUndefined:!0,allowEmpty:!0})}}},getUserProfile:{userIDList:{type:"Array",validator:function(e,t,n){return nt(e)?(0===e.length&&s({api:t,paramName:n,desc:ln()}),!0):(s({api:t,paramName:n,desc:un()}),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e,t,n){return!!A(e)||!!nt(e)||(s({api:t,paramName:n,desc:un()}),!1)}}},setSelfStatus:{customStatus:{type:"String",validator:function(e,t,n){return!!ft(e)||(s({api:t,paramName:n,desc:nn()}),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return nt(e)?0!==e.length||(s({api:t,paramName:n,desc:ln()}),!1):(s({api:t,paramName:n,desc:un()}),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return nt(e)?0!==e.length||(s({api:t,paramName:n,desc:ln()}),!1):(s({api:t,paramName:n,desc:un()}),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return!e||!!nt(e)||(s({api:t,paramName:n,desc:un()}),!1)}}},addFriend:{to:oe,source:{type:"String",required:!0,validator:function(e,t,n){return!(!e||(e.startsWith("AddSource_Type_")?8<e.replace("AddSource_Type_","").length&&(s({api:t,paramName:n,desc:_n("keyword",8)}),1):(s({api:t,paramName:n,desc:xn("SourcePrefixLog")}),1)))}},remark:{type:"String",required:!1,validator:function(e,t,n){return!(ft(e)&&96<e.length&&(s({api:t,paramName:n,desc:_n(n,96)}),1))}}},deleteFriend:{userIDList:se},checkFriend:{userIDList:se},getFriendProfile:{userIDList:se},updateFriend:{userID:oe,remark:{type:"String",required:!1,validator:function(e,t,n){return!(ft(e)&&96<e.length&&(s({api:t,paramName:n,desc:_n(n,96)}),1))}},friendCustomField:{type:"Array",required:!1,validator:function(e,t,n){if(e){if(!nt(e))return s({api:t,paramName:n,desc:un()}),!1;var o=!0;return e.forEach(function(e){return ft(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?ft(e.value)?8<e.key.replace("Tag_SNS_Custom_","").length?(s({api:t,paramName:n,desc:_n("keyword",8)}),o=!1):void 0:(s({api:t,paramName:n,desc:fn("value")}),o=!1):(s({api:t,paramName:n,desc:xn("FriendCustomFieldPrefixLog")}),o=!1)}),o}return!0}}},acceptFriendApplication:{userID:oe},refuseFriendApplication:{userID:oe},deleteFriendApplication:{userID:oe},createFriendGroup:{name:oe},deleteFriendGroup:{name:oe},addToFriendGroup:{name:oe,userIDList:se},removeFromFriendGroup:{name:oe,userIDList:se},renameFriendGroup:{oldName:oe,newName:oe},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(e,t,n){return nt(e)?0!==e.length||(s({api:t,paramName:n,desc:ln()}),!1):(s({api:t,paramName:n,desc:un()}),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(e,t,n){return nt(e)?0!==e.length||(s({api:t,paramName:n,desc:ln()}),!1):(s({api:t,paramName:n,desc:un()}),!1)}}],createTopicInCommunity:{groupID:oe,topicName:oe},deleteTopicFromCommunity:{groupID:oe,topicIDList:{type:"Array",validator:function(e,t,n){return!e||!!nt(e)||(s({api:t,paramName:n,desc:un()}),!1)}}},updateTopicProfile:{groupID:oe,topicID:oe},getTopicList:{groupID:oe,topicIDList:{type:"Array",validator:function(e,t,n){return!e||!!nt(e)||(s({api:t,paramName:n,desc:un()}),!1)}}},followUser:[y({name:"userIDList"},se)],unfollowUser:[y({name:"userIDList"},se)],getMyFollowingList:[y(y({name:"startIndex"},oe),{},{required:!1})],getMyFollowersList:[y(y({name:"startIndex"},oe),{},{required:!1})],getMutualFollowersList:[y(y({name:"startIndex"},oe),{},{required:!1})],getUserFollowInfo:[y(y({name:"userIDList"},se),{},{required:!1})],checkFollowType:[y({name:"userIDList"},se)],addSignalingListener:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(s({api:t,paramName:n,desc:on(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(s({api:t,paramName:n,desc:cn()}),!1):(""===e.name&&s({api:t,paramName:n,desc:yn()}),!0)}}],removeSignalingListener:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(s({api:t,paramName:n,desc:on(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(s({api:t,paramName:n,desc:cn()}),!1):(""===e.name&&s({api:t,paramName:n,desc:yn()}),!0)}}],invite:{userID:oe},inviteSync:[y(y({},te),{},{validator:function(e,t,n){return et(e)?!!ft(e.userID)||(s({api:t,paramName:"options.userID",desc:nn()}),!1):(s({api:t,paramName:"options",desc:mn()}),!1)}}),{name:"successCb",type:"Function",required:!1,validator:function(e,t,n){return A(e)&&s({api:t,paramName:n,desc:cn()}),!0}},{name:"errorCb",type:"Function",required:!1,validator:function(e,t,n){return A(e)&&s({api:t,paramName:n,desc:cn()}),!0}}],inviteInGroup:{groupID:oe,inviteeList:se},inviteInGroupSync:[y(y({},te),{},{validator:function(e,t,n){return et(e)?ft(e.groupID)?!!nt(e.inviteeList)||(s({api:t,paramName:"options.inviteeList",desc:un()}),!1):(s({api:t,paramName:"options.groupID",desc:nn()}),!1):(s({api:t,paramName:"options",desc:mn()}),!1)}}),{name:"successCb",type:"Function",required:!1,validator:function(e,t,n){return A(e)&&s({api:t,paramName:n,desc:cn()}),!0}},{name:"errorCb",type:"Function",required:!1,validator:function(e,t,n){return A(e)&&s({api:t,paramName:n,desc:cn()}),!0}}],accept:{inviteID:oe},reject:{inviteID:oe},getSignalingInfo:[y(y({name:"message"},te),{},{validator:function(e,t,n){return!Je(e)||(s({api:t,paramName:n,desc:Mn()}),!1)}})],modifyInvitation:{inviteID:oe,data:oe}},Hn={login:1,logout:1,getLoginUser:1,getServerTime:1,on:1,once:1,off:1,setLogLevel:1,registerPlugin:1,destroy:1,isReady:1,createTextMessage:1,createTextAtMessage:1,createImageMessage:1,createAudioMessage:1,createVideoMessage:1,createCustomMessage:1,createFaceMessage:1,createFileMessage:1,createLocationMessage:1,createMergerMessage:1,downloadMergerMessage:1,createForwardMessage:1,sendMessage:1,resendMessage:1,revokeMessage:1,deleteMessage:1,translateText:1,convertVoiceToText:1,modifyMessage:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageReadReceiptList:1,setMessageExtensions:1,getMessageExtensions:1,deleteMessageExtensions:1,addMessageReaction:1,removeMessageReaction:1,getMessageReactions:1,getAllUserListOfMessageReaction:1,getMessageList:1,findMessage:1,getMessageListHopping:1,setMessageRead:1,setAllMessageRead:1,getConversationList:1,getConversationProfile:1,deleteConversation:1,setConversationDraft:1,pinConversation:1,getTotalUnreadMessageCount:1,setConversationCustomData:1,markConversation:1,createConversationGroup:1,getConversationGroupList:1,deleteConversationGroup:1,renameConversationGroup:1,addConversationsToGroup:1,deleteConversationsFromGroup:1,clearHistoryMessage:1,setMessageRemindType:1,setAllReceiveMessageOpt:1,getAllReceiveMessageOpt:1,getGroupList:1,getGroupProfile:1,createGroup:1,joinGroup:1,updateGroupProfile:1,quitGroup:1,dismissGroup:1,changeGroupOwner:1,searchGroupByID:1,getGroupApplicationList:1,handleGroupApplication:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getJoinedCommunityList:1,createTopicInCommunity:1,deleteTopicFromCommunity:1,updateTopicProfile:1,getTopicList:1,getGroupMemberProfile:1,getGroupMemberList:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberNameCard:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberCustomField:1,getGroupOnlineMemberCount:1,markGroupMemberList:1,getMyProfile:1,getUserProfile:1,updateMyProfile:1,setSelfStatus:1,getUserStatus:1,subscribeUserStatus:1,unsubscribeUserStatus:1,getBlacklist:1,addToBlacklist:1,removeFromBlacklist:1,searchCloudMessages:1,searchCloudUsers:1,searchCloudGroups:1,searchCloudGroupMembers:1,getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,updateFriend:1,getFriendProfile:1,getFriendApplicationList:1,refuseFriendApplication:1,deleteFriendApplication:1,acceptFriendApplication:1,setFriendApplicationRead:1,getFriendGroupList:1,createFriendGroup:1,renameFriendGroup:1,deleteFriendGroup:1,addToFriendGroup:1,removeFromFriendGroup:1,followUser:1,unfollowUser:1,getMyFollowingList:1,getMyFollowersList:1,getMutualFollowersList:1,getUserFollowInfo:1,checkFollowType:1,callExperimentalAPI:1,addSignalingListener:1,removeSignalingListener:1,invite:1,inviteSync:1,inviteInGroup:1,inviteInGroupSync:1,cancel:1,accept:1,reject:1,getSignalingInfo:1,modifyInvitation:1},Bn=(t(uo,n(Error)),Rn=f(uo),e(uo)),T={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,MSG_SEND_FAIL:2100,MSG_SEND_FAIL_NOT_IN_AV:2101,MSG_INSTANCE_REQUIRED:2105,MSG_INVALID_CONV_TYPE:2106,MSG_F_IS_EMPTY:2108,MSG_ONPROGRESS_ERR:2109,MSG_REVOKE_FAIL:2110,MSG_DELETE_FAIL:2111,MSG_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MSG_LIST_EMPTY:2114,MSG_SEND_GRP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GRP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,VOICE_TO_TEXT_FAIL:2118,UNSUPPORTED_VOICE_FORMAT:2119,MSG_I_SELECT_F_FIRST:2251,MSG_I_TYPES_LIMIT:2252,MSG_I_SIZE_LIMIT:2253,MSG_A_UPLOAD_FAIL:2300,MSG_A_SIZE_LIMIT:2301,MSG_V_UPLOAD_FAIL:2350,MSG_V_SIZE_LIMIT:2351,MSG_V_TYPES_LIMIT:2352,MSG_F_UPLOAD_FAIL:2400,MSG_F_SELECT_F_FIRST:2401,MSG_F_SIZE_LIMIT:2402,MSG_F_URL_IS_EMPTY:2403,MSG_MERGER_TYPE_INVALID:2450,MSG_MERGER_KEY_INVALID:2451,MSG_MERGER_DOWNLOAD_FAIL:2452,MSG_FORWARD_TYPE_INVALID:2453,MSG_FORWARD_INVALID_ELEMENTS:2454,MSG_MODIFY_CONFLICT:2480,MSG_MODIFY_DISABLED_IN_AV:2481,CONV_NOT_FOUND:2500,USER_OR_GRP_NOT_FOUND:2501,CONV_UN_RECORDED_TYPE:2502,INVALID_CONV_ID:2503,ILLEGAL_GRP_TYPE:2600,ILLEGAL_GRP_ID:2602,CANNOT_FIND_GRP:2603,CANNOT_CHANGE_OWNER_IN_AV:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,MEMBER_NOT_IN_GRP:2623,JOIN_GRP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AV:2661,CANNOT_JOIN_NON_AV_WITHOUT_LOGIN:2662,NOT_OWNER:2681,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,OPERATION_NOT_SUPPORTED_IN_AV:2687,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GRP_EXISTED:2710,FRIEND_GRP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,CANNOT_ADD_SELF_TO_BLACKLIST:2742,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,INVALID_TRTC_CMD:2995,OVER_FREQUENCY_LIMIT:2996,NO_PROTOCOL:2997,NO_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,NO_USE:3122,PROFANITY_FOUND:3123,OPTIONS_IS_EMPTY:3153,MSG_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022,SIGNALING_INVALID_INVITE_ID:8010,SIGNALING_NO_PERMISSION:8011,SIGNALING_ALREADY_EXISTS:8012,INVALID_CANCEL_MESSAGE:8020},Kn=null,Fn=(e(co,[{key:"isLoggedIn",value:function(){return this._m.get(12).isLoggedIn()}},{key:"isOversea",value:function(){return this._m.get(12).isOversea()}},{key:"isPrivateNetWork",value:function(){var e=this._m.get(12);return e.isPrivateNetWork()&&!e.getFileDownloadProxy()}},{key:"getFileDownloadProxy",value:function(){return this._m.get(12).getFileDownloadProxy()}},{key:"getDowloadFileAuthKey",value:function(){return this._m.get(12).getDowloadFileAuthKey()}},{key:"getMyUserID",value:function(){return this._m.get(12).getUserID()}},{key:"getMyTinyID",value:function(){return this._m.get(12).getTinyID()}},{key:"getSDKAppID",value:function(){return this._m.get(12).getSDKAppID()}},{key:"isIntl",value:function(){return this._m.get(12).isIntl()}},{key:"isUsingChatCore",value:function(){return this._m.get(12).isUsingChatCore()}},{key:"isDevMode",value:function(){return this._m.get(12).isDevMode()}},{key:"get",value:function(e){return this._m.get(e)}},{key:"getPlatform",value:function(){return de}},{key:"getCloudConfig",value:function(e){return this._m.get(23).getCloudConfig(e)}},{key:"emitOEvt",value:function(e,t){this._m.getOEmitInst().emit(e,t)}},{key:"emitIEvt",value:function(e,t){this._m.getIEmitInst().emit(e,t)}},{key:"getIEmitInst",value:function(){return this._m.getIEmitInst()}},{key:"req",value:function(e){return this._m.get(20).req(e)}},{key:"canIUse",value:function(e){return this._m.get(27).canIUse(e)}},{key:"getErrMsg",value:function(e,t,n){return this._m.getErrMsg(e,t,n)}},{key:"warn",value:function(e,t,n){e=this.getErrMsg(e,t,n);e&&v.w(e)}},{key:"noUse",value:function(e){var t=T.NO_USE;return C({code:t,message:this.getErrMsg(t,e)})}}]),co),I={LOGIN:"wslogin",LOGOUT:"wslogout",HELLO:"wshello",KICK_OTHER:"KickOther",SYNC_UNREAD_MSG:"getmsg",SEND_C2C_MSG:"sendmsg",SEND_GRP_MSG:"send_group_msg",GET_USER_PROFILE:"portrait_get_all",UPDATE_MY_PROFILE:"portrait_set",GET_BL:"black_list_get",ADD_TO_BL:"black_list_add",RM_FROM_BL:"black_list_delete",GET_FD_LIST:"friend_get",GET_FD_PROFILE:"friend_get_specified",CHECK_FD:"friend_check",DEL_FD:"friend_delete",ADD_FD:"friend_add",UPDATE_FD:"friend_update",RESPOND_FD_APPLICATION:"friend_response",GET_FD_APPLICATION_LIST:"pendency_get",DEL_FD_APPLICATION:"pendency_delete",REFUSE_FD_APPLICATION:"pendency_refuse",REPORT_FD_APPLICATION:"pendency_report",GET_FD_GRP_LIST:"group_get",CREATE_FD_GRP:"group_add",DEL_FD_GRP:"group_delete",UPDATE_FD_GRP:"group_update",REVOKE_C2C_MSG:"msgwithdraw",SET_C2C_MSG_READ:"msgreaded",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_C2C_ROAMING_MSG:"getroammsg",GET_C2C_PEER_READ_TIME:"get_peer_read_time",DEL_C2C_MSG:"delete_c2c_msg_ramble",MODIFY_C2C_MSG:"modify_c2c_msg",MODIFY_C2C_MSG_EXT:"set_key_values",GET_C2C_MSG_EXT:"get_key_values",ADD_C2C_MSG_REACTION:"reaction_add",RM_C2C_MSG_REACTION:"reaction_del",GET_C2C_MSG_REACTIONS:"reaction_multi_stat",GET_C2C_MSG_REACTION_USER_LIST:"reaction_iterate",PAGING_GET_CONV_LIST:"page_get",DEL_CONV:"batch_delete",CLEAR_HISTORY_MSG:"clear_msg",PIN_CONV:"top",DEL_GROUP_AT_TIPS:"deletemsg",SET_CONV_CUSTOM_DATA:"set_conv_custom_data",MARK_CONV:"mark_contact",CREATE_CONV_GRP:"create_contact_group",DEL_CONV_GRP:"del_contact_group",RENAME_CONV_GRP:"update_contact_group",ADD_CONV_TO_GRP:"add_conv_to_group",DEL_CONV_FROM_GRP:"del_conv_from_group",GET_CONV_GRP_LIST:"get_contact_group",SEARCH_CONV_GRP_MARK:"search_contact_group",GET_GRP_LIST:"get_joined_group_list",GET_GRP_PROFILE:"get_group_self_member_info",CREATE_GRP:"create_group",DISMISS_GRP:"destroy_group",UPDATE_GRP_PROFILE:"modify_group_base_info",APPLY_JOIN_GRP:"apply_join_group",APPLY_JOIN_GRP_NOAUTH:"apply_join_group_noauth",QUIT_GRP:"quit_group",SEARCH_GRP:"get_group_public_info",CHANGE_GRP_OWNER:"change_group_owner",HANDLE_GRP_APPLICATION:"handle_apply_join_group",HANDLE_INVITE_JOIN_GRP:"handle_invite_join_permission_group",HANDLE_GRP_INVITATION:"handle_invite_join_group",REVOKE_GRP_MSG:"group_msg_recall",SET_GRP_MSG_READ:"msg_read_report",SET_ALL_MSG_READ:"read_all_unread_msg",GET_GRP_ROAMING_MSG:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",GET_GRP_PENDENCY:"get_pendency",DEL_GRP_SYSTEM_NOTICE:"deletemsg",AV_POLLING:"get_msg",AV_NOAUTH_POLLING:"get_msg_noauth",GET_ONLINE_MBR_NUM:"get_online_member_num",DEL_GRP_MSG:"delete_group_ramble_msg_by_seq",MODIFY_GRP_MSG:"modify_group_msg",SET_GRP_ATTR:"set_group_attr",MODIFY_GRP_ATTR:"modify_group_attr",DEL_GRP_ATTR:"delete_group_attr",CLEAR_GRP_ATTR:"clear_group_attr",GET_GRP_ATTR:"get_group_attr",MODIFY_GRP_MSG_EXT:"group_set_key_values",GET_GRP_MSG_EXT:"group_get_key_values",GET_GRP_NOTIFY:"batch_get_group_notify",UPDATE_GRP_COUNTER:"update_group_counter",GET_GRP_COUNTER:"get_group_counter",ADD_GRP_MSG_REACTION:"group_reaction_add",RM_GRP_MSG_REACTION:"group_reaction_del",GET_GRP_MSG_REACTIONS:"group_reaction_multi_stat",GET_GRP_MSG_REACTION_USER_LIST:"group_reaction_iterate",GET_GRP_MBR_LIST:"get_group_member_info",GET_AV_MBR_LIST:"get_members",GET_GRP_MBR_PROFILE:"get_specified_group_member_info",ADD_GRP_MBR:"add_group_member",DEL_GRP_MBR:"delete_group_member",BAN_AV_MBR:"ban_group_member",MODIFY_GRP_MBR_INFO:"modify_group_member_info",MARK_AV_MBR_INFO:"modify_user_info",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",SIMPLE_COS_PRE_SIG:"simple_sig",GET_IMAGE_INFO:"get_imageinfo",GET_IP:"get_final_ip",VIDEO_COVER:"video_cover",SSO_STAT:"tim_web_report_v2",PING:"alive",MSG_PUSH:"msg_push",CS:"query",GRP_CS:"query_grp",MBR_CS:"query_grp_member",USER_CS:"query_user",MULTI_MSG_PUSH:"multi_msg_push_ws",MSG_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",UPLOAD_MERGER_MSG:"save_relay_json_msg",DOWNLOAD_MERGER_MSG:"get_relay_json_msg",FETCH_CLOUD_CTRL_CONFIG:"fetch_config",PUSHED_CLOUD_CTRL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",OVERLOAD_NOTIFY:"notify2",CREATE_TOPIC:"create_topic",DEL_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",SUB_USER_STATUS:"ws_status_subscribe",UNSUB_USER_STATUS:"ws_status_unsubscribe",STAT_BACKGROUND:"ws_stat_background",STAT_FOREGROUND:"ws_stat_foreground",SET_TOKEN:"ws_stat_settoken",PUSH_REPORT:"uniapp_sdk_report",GET_PROFANITY_LIST:"get_local_words",TRANSLATE_TEXT:"ws_batch_trans_text",VOICE_TO_TEXT:"ws_sentence_recognition",FOLLOW:"follow_add",UNFOLLOW:"follow_delete",GET_FOLLOW:"follow_get",GET_FOLLOW_INFO:"follow_get_info",CHECK_FOLLOW_TYPE:"follow_check",SET_ALL_RECEIVE_MSG_OPT:"ws_set_do_not_disturb",GET_ALL_RECEIVE_MSG_OPT:"ws_get_do_not_disturb"},Yn="networkRTT",Wn="messageE2EDelay",jn="sendMessageC2C",Jn="sendMessageGroup",zn="sendMessageGroupAV",Xn="sendMessageRichMedia",Zn="cosUpload",Qn="messageReceivedGroup",$n="messageReceivedGroupAVPush",eo="messageReceivedGroupAVPull",to=(c(wn={},Yn,2),c(wn,Wn,3),c(wn,jn,4),c(wn,Jn,5),c(wn,zn,6),c(wn,Xn,7),c(wn,Qn,8),c(wn,$n,9),c(wn,eo,10),c(wn,Zn,11),wn),no={info:4,warning:5,error:6},oo={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},io={login:4,plugin_search:16,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16,plugin_emoji_reaction:16,tui_key_features:16},M=(e(ro,[{key:"updateTimeStamp",value:function(){this.timestamp=Pe()}},{key:"start",value:function(e){return this._startts=e,this}},{key:"end",value:function(){var e,t=this,n=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this._sentFlag||(this._netMonitorModule&&(e=this._netMonitorModule.getNetworkType(),this.setNetworkType(e)),e=Pe(),0===this.costTime&&(this.costTime=e-this._startts),this.setMoreMessage("startts:".concat(this._startts," endts:").concat(e)),n?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout(function(){t._sentFlag=!0,t._eventStatModule&&t._eventStatModule.pushIn(t)},0))}},{key:"setError",value:function(e){if(!(e instanceof Error))return v.w("".concat(this._n,".setError value not instanceof Error, please check!")),this;if(this._sentFlag)return this;var t=!0;return(t=this._netMonitorModule?this._netMonitorModule.isOnline():t)?(e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message)):this.setCode(T.NO_NETWORK),this.setLevel("error"),this}},{key:"setCode",value:function(e){return A(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),Qe(e)?this.code=e:v.w("".concat(this._n,".setCode value not a number, please check!"),e,r(e))),this}},{key:"setMessage",value:function(e){return A(e)||this._sentFlag||(Qe(e)&&(this.message=e.toString()),ft(e)&&(this.message=e)),this}},{key:"setCostTime",value:function(e){return this.costTime=e,this}},{key:"setLevel",value:function(e){return A(e)||this._sentFlag||(this.level=no[e]),this}},{key:"setMoreMessage",value:function(e){return Je(this.moreMessage)?this.moreMessage="".concat(e):this.moreMessage+=" ".concat(e),this}},{key:"setNetworkType",value:function(e){return A(e)?v.w("".concat(this._n,".setNetworkType value is undefined, please check!")):(e=oo[e.toLowerCase()],A(e)||(this.networkType=e)),this}},{key:"getStartTs",value:function(){return this._startts}},{key:"setUIPlatform",value:function(e){return this.uiPlatform=e,this}},{key:"setExtension",value:function(e){return this.extension=e,this}},{key:"setEventType",value:function(e){return this.eventType=e,this}}],[{key:"bindEventStatModule",value:function(e){ro.prototype._eventStatModule=e}},{key:"bindNetMonitorModule",value:function(e){ro.prototype._netMonitorModule=e}}]),ro),ao=(e(so,[{key:"setText",value:function(e){this.content.text=e}},{key:"sendable",value:function(){return 0!==this.content.text.length}}]),so);function so(e){d(this,so),this.type=R.MSG_TEXT,this.content={text:e.text||""}}function ro(e){d(this,ro),this._n="SSOLogData",this.eventType=io[e]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=e,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=Pe()}function co(e){d(this,co),this._m=e,this._n=""}function uo(e){d(this,uo),t=Rn.call(this);var t,n=e.code,o=e.message,e=e.data;return t.code=n,o?t.message=o:t._getErrMsg&&(t.message=t._getErrMsg(t.code)),t.data=e||{},t}function lo(e,t,n,o){var i,o=3<arguments.length&&void 0!==o?o:[];if(e)return i=e,t&&(e.startsWith("http://")?i=e.replace(/^http:\/\/[^/]+/,t):e.startsWith("https://")&&(i=e.replace(/^https:\/\/[^/]+/,t))),n&&-1===i.indexOf("authKey=")&&ho(i,o)?(-1<i.indexOf("?")?"".concat(i,"&authKey="):"".concat(i,"?authKey=")).concat(n):i}function po(e,t,n){var n=2<arguments.length&&void 0!==n?n:[];return e===R.MSG_VIDEO?ho((t[0].content||t[0].payload).snapshotUrl,n)&&(t[0].content?(t[0].content.snapshotUrl=_o(t[0].content.snapshotUrl),t[0].content.thumbUrl=_o(t[0].content.thumbUrl)):(t[0].payload.snapshotUrl=_o(t[0].payload.snapshotUrl),t[0].payload.thumbUrl=_o(t[0].payload.thumbUrl))):e===R.MSG_FILE?ho((t[0].content||t[0].payload).fileUrl,n)&&(t[0].content?t[0].content.fileUrl=_o(t[0].content.fileUrl):t[0].payload.fileUrl=_o(t[0].payload.fileUrl)):e===R.MSG_MERGER&&(e=(n=t[0].content||t[0].payload).downloadKey,n=void 0===(n=n.messageList)?[]:n,Je(void 0===e?"":e)&&n.forEach(function(e){po(e.messageBody[0].type,e.messageBody)})),t}function _o(e){if(!e)return e;if(-1===e.indexOf("authKey="))return e;for(var e=e.split("?"),t=e[1].split("&"),n=0,o=0;o<t.length;o++)if(-1<t[o].indexOf("authKey=")){n=o;break}return t.splice(n,1),0<t.length?"".concat(e[0],"?").concat(t.join("&")):e[0]}function ho(e,t){var n=!1;if(e){var e=e.match(/:\/\/([0-9]?\.)?(.[^/:]+)/),o=e&&e[2]||"";if(o.includes("rich-dev"))return 1;for(var i=0;i<t.length;i++)if(o.endsWith(t[i])){n=!0;break}}return n}e(Ho,[{key:"_initImageInfoModel",value:function(){var t=this;this._ImageInfoModel=function(e){this.instanceID=lt(9999999),this.sizeType=e.type||0,this.type=0,this.size=e.size||0,this.width=e.width||0,this.height=e.height||0,this.imageUrl=e.imageUrl||e.url||"",this.url=lo(e.url||t._imageMemoryURL,t._fileDownloadProxy,t._authKey,t._fileDNList)},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,n=0,o=null;n<=2;)t=A(e)||A(e[n])?{type:0,size:0,width:0,height:0,url:""}:e[n],(o=new this._ImageInfoModel(t)).setSizeType(n+1),o.setType(n),this.addImageInfo(o),n++;this.updateAccessSideImageInfoArray()}},{key:"updateImageInfoArray",value:function(e){for(var t,n=this.content.imageInfoArray.length,o=0;o<n;o++)t=this.content.imageInfoArray[o],e[o].size&&(t.size=e[o].size),e[o].url&&t.setImageUrl(e[o].url),e[o].width&&(t.width=e[o].width),e[o].height&&(t.height=e[o].height)}},{key:"_autoFixUrl",value:function(){for(var e=this.content.imageInfoArray.length,t="",n="",o=["http","https"],i=null,a=0;a<e;a++)this.content.imageInfoArray[a].url&&""!==(i=this.content.imageInfoArray[a]).imageUrl&&(n=i.imageUrl.slice(0,i.imageUrl.indexOf("://")+1),t=i.imageUrl.slice(i.imageUrl.indexOf("://")+1),o.indexOf(n)<0&&(n="https:"),this.content.imageInfoArray[a].setImageUrl([n,t].join("")))}},{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(this._percent=1)}},{key:"updateImageFormat",value:function(e){this.content.imageFormat=Fe[e.toUpperCase()]||Fe.UNKNOWN}},{key:"createImageDataASURLInWeb",value:function(e){void 0!==e&&0<e.files.length&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:"createImageDataASURL",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){3<=this.content.imageInfoArray.length||this.content.imageInfoArray.push(e)}},{key:"updateAccessSideImageInfoArray",value:function(){var e=this.content.imageInfoArray,t=e[0],n=t.width,n=void 0===n?0:n,t=t.height,t=void 0===t?0:t;0!==n&&0!==t&&(qt(e),Object.assign(e[2],Ft({originWidth:n,originHeight:t,min:720})))}},{key:"sendable",value:function(){return 0!==this.content.imageInfoArray.length&&""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size}}]);var go=Ho,fo=(e(Vo,[{key:"sendable",value:function(){return null!==this.content}}]),Vo),mo=(e(xo,[{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(this._percent=1)}},{key:"updateAudioUrl",value:function(e){this.content.remoteAudioUrl=e}},{key:"sendable",value:function(){return""!==this.content.remoteAudioUrl}}]),xo),vo={from:!0,groupID:!0,groupName:!0,to:!0},Io=(e(qo,[{key:"_initContent",value:function(t){var n=this;Object.keys(t).forEach(function(e){switch(e){case"remarkInfo":break;case"groupProfile":n.content.groupProfile={},n._initGroupProfile(t[e]);break;case"operatorInfo":n.content.operatorInfo={},n._initOperatorInfo(t[e]);break;case"memberInfoList":case"msgMemberInfo":n._updateMemberList(t[e]);break;case"memberExtraInfo":case"onlineMemberInfo":break;case"memberNum":n.content[e]=t[e],n.content.memberCount=t[e];break;case"newGroupProfile":n.content.newGroupProfile={},n._initNewGroupProfile(t[e]);break;default:n.content[e]=t[e]}}),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var o=t[n];vo[o]&&(this.content.groupProfile[o]=e[o])}}},{key:"_initOperatorInfo",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var o=t[n];this.content.operatorInfo[o]=e[o]}}},{key:"_updateMemberList",value:function(e){Je(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),n=0;n<t.length;n++){var o=t[n];this.content.newGroupProfile[o]="muteAllMembers"!==o?e[o]:1===e[o]}}}]),qo),Mo={from:!0,groupID:!0,groupName:!0,to:!0,groupType:!0},yo=(e(Fo,[{key:"_initContent",value:function(t){var n=this;Object.keys(t).forEach(function(e){switch(e){case"memberInfoList":break;case"remarkInfo":n.content.handleMessage=t[e];break;case"groupProfile":n.content.groupProfile={},n._initGroupProfile(t[e]);break;default:n.content[e]=t[e]}})}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var o=t[n];Mo[o]&&("groupName"===o?this.content.groupProfile.name=e[o]:this.content.groupProfile[o]=e[o])}}}]),Fo),Co=(e(wo,[{key:"_getFileInfo",value:function(e){if(!A(e.fileName)&&!A(e.fileSize))return{size:e.fileSize,name:e.fileName};var t,e=e.file.files[0];return ne&&(e.path&&-1!==e.path.indexOf(".")&&(t=e.path.slice(e.path.lastIndexOf(".")+1).toLowerCase(),e.type=t,e.name||(e.name="".concat(lt(999999),".").concat(t))),e.name||(e.type="",e.name=e.path.slice(e.path.lastIndexOf("/")+1).toLowerCase()),e.suffix&&(e.type=e.suffix),e.url||(e.url=e.path)),{size:e.size,name:e.name}}},{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(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}}]),wo),To=(e(bo,[{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}}]),bo),Do=(e(Uo,[{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(this._percent=1)}},{key:"updateVideoUrl",value:function(e){e&&(this.content.remoteVideoUrl=e)}},{key:"updateSnapshotInfo",value:function(e){var t=e.snapshotUrl,n=e.snapshotWidth,e=e.snapshotHeight;Je(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),Je(n)||(this.content.thumbWidth=this.content.snapshotWidth=Number(n)),Je(e)||(this.content.thumbHeight=this.content.snapshotHeight=Number(e))}},{key:"sendable",value:function(){return""!==this.content.remoteVideoUrl}}]),Uo),Eo=(e(Po,[{key:"sendable",value:function(){return!0}}]),Po),Lo=(e(Go,[{key:"_patchRichMediaPayload",value:function(e,t){e===R.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===R.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===R.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===R.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}},{key:"_updateRichMediaDownloadUrl",value:function(e,t,n,o,i){(n||o)&&(e===R.MSG_IMAGE?t.imageInfoArray.forEach(function(e){e.url=lo(e.url,n,o,i)}):e===R.MSG_VIDEO?(t.videoUrl=lo(t.videoUrl,n,o,i),t.snapshotUrl=lo(t.thumbUrl,n,o,i),t.snapshotHeight=t.thumbHeight,t.snapshotWidth=t.thumbWidth):e===R.MSG_AUDIO?t.url=lo(t.url,n,o,i):e===R.MSG_FILE&&(t.fileUrl=lo(t.fileUrl,n,o,i)))}}]),Go),So=(e(No,[{key:"sendable",value:function(){return!Je(this.content.messageList)||!Je(this.content.downloadKey)}}]),No),ko={1:R.MSG_PRIORITY_HIGH,2:R.MSG_PRIORITY_NORMAL,3:R.MSG_PRIORITY_LOW,4:R.MSG_PRIORITY_LOWEST},Ro=(e(Oo,[{key:"elements",get:function(){return this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){null!==e&&(ft(e.nick)&&(this.nick=e.nick),ft(e.avatar)&&(this.avatar=e.avatar),e=e.messageFromAccountExtraInformation,et(e)&&ft(e.nameCard)&&(this.nameCard=e.nameCard))}},{key:"handleGroupAtInfo",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach(function(e){e!==R.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(R.MSG_AT_ALL))}),nt(e.groupAtInfo)&&e.groupAtInfo.forEach(function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(R.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?On:An,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&&(!0===this._relayFlag||"function"==typeof this._elements[0].sendable&&this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===R.CONV_GROUP&&(this.to=e.groupID)}},{key:"_initSequence",value:function(e){var t,n,o;0===this.clientSequence&&e&&(this.clientSequence=!!(e=e)&&(void 0===Ct[e]&&(o=new Date,t="3".concat(o.getHours()).slice(-2),n="0".concat(o.getMinutes()).slice(-2),o="0".concat(o.getSeconds()).slice(-2),Ct[e]=parseInt([t,n,o,"0001"].join("")),o=n=t=null,v.l("autoIncrementIndex start index:".concat(Ct[e]))),Ct[e]++)),0===this.sequence&&this.conversationType===R.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===R.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID="".concat(this.senderTinyID,"-").concat(this.clientTime,"-").concat(this.random)}},{key:"_initFlow",value:function(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}},{key:"_concatConversationID",value:function(e){var t=this.to,n=this.conversationType;n!==R.CONV_SYSTEM?(e=n===R.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID=e?"".concat(n).concat(e):null):this.conversationID=R.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof ao||e instanceof go||e instanceof fo||e instanceof mo||e instanceof Co||e instanceof Do||e instanceof Io||e instanceof yo||e instanceof To||e instanceof Eo||e instanceof So}},{key:"setElement",value:function(e,t,n,o){var i=this;if(this.isElement(e))return this._elements=[e],void this._initProxy();function a(e){if(e.type&&e.content)switch(e.type){case R.MSG_TEXT:i.setTextElement(e.content);break;case R.MSG_IMAGE:i.setImageElement(e.content,t,n,o);break;case R.MSG_AUDIO:i.setAudioElement(e.content,t,n,o);break;case R.MSG_FILE:i.setFileElement(e.content,t,n,o);break;case R.MSG_VIDEO:i.setVideoElement(e.content,t,n,o);break;case R.MSG_CUSTOM:i.setCustomElement(e.content);break;case R.MSG_LOCATION:i.setLocationElement(e.content);break;case R.MSG_GRP_TIP:i.setGroupTipElement(e.content);break;case R.MSG_GRP_SYS_NOTICE:i.setGroupSystemNoticeElement(e.content);break;case R.MSG_FACE:i.setFaceElement(e.content);break;case R.MSG_MERGER:i.setMergerElement(e.content,t,n,o)}}if(nt(e))for(var s=0;s<e.length;s++)a(e[s]);else a(e);this._initProxy()}},{key:"clearElement",value:function(){this._elements.length=0}},{key:"setTextElement",value:function(e){e="string"==typeof e?e:e.text,e=new ao({text:e});this._elements.push(e)}},{key:"setImageElement",value:function(e,t,n,o){e=new go(e,t,n,o);this._elements.push(e)}},{key:"setAudioElement",value:function(e,t,n,o){e=new mo(e,t,n,o);this._elements.push(e)}},{key:"setFileElement",value:function(e,t,n,o){e=new Co(e,t,n,o);this._elements.push(e)}},{key:"setVideoElement",value:function(e,t,n,o){e=new Do(e,t,n,o);this._elements.push(e)}},{key:"setLocationElement",value:function(e){e=new Eo(e);this._elements.push(e)}},{key:"setCustomElement",value:function(e){e=new To(e);this._elements.push(e)}},{key:"setGroupTipElement",value:function(e){var t,n={},o=e.operationType;Je(e.memberInfoList)?e.operatorInfo&&(n=e.operatorInfo):o!==R.GRP_TIP_MBR_JOIN&&o!==R.GRP_TIP_MBR_KICKED_OUT&&o!==R.GRP_TIP_MBR_SET_ADMIN&&o!==R.GRP_TIP_MBR_CANCELED_ADMIN||(n=e.memberInfoList[0]),Je(e.memberExtraInfo)||(t=e.memberExtraInfo.reason,e.msgMemberInfo.forEach(function(e){e.reason=t}));o=n.nick,n=n.avatar,ft(o)&&(this.nick=o),ft(n)&&(this.avatar=n),o=new Io(e);this._elements.push(o)}},{key:"setGroupSystemNoticeElement",value:function(e){e=new yo(e);this._elements.push(e)}},{key:"setFaceElement",value:function(e){e=new fo(e);this._elements.push(e)}},{key:"setMergerElement",value:function(e,t,n,o){e=new So(e,t,n,o);this._elements.push(e)}},{key:"setIsRead",value:function(e){this.isRead=e}},{key:"setRelayFlag",value:function(e){this._relayFlag=e}},{key:"_computePriority",value:function(e){if(A(e))return R.MSG_PRIORITY_NORMAL;if(ft(e)&&-1!==Object.values(ko).indexOf(e))return e;if(Qe(e)){e=""+e;if(-1!==Object.keys(ko).indexOf(e))return ko[e]}return R.MSG_PRIORITY_NORMAL}},{key:"setNickAndAvatar",value:function(e){var t=e.nick,e=e.avatar;ft(t)&&(this.nick=t),ft(e)&&(this.avatar=e)}},{key:"setNameCard",value:function(e){ft(e)&&(this.nameCard=e)}},{key:"initC2CReadReceiptInfo",value:function(e){var t=e.readReceiptSentByPeer,e=e.timestamp,e=void 0===e?0:e;this.conversationType===R.CONV_C2C&&!0===this.needReadReceipt&&(this.readReceiptInfo.isPeerRead=1===(void 0===t?void 0:t),this.readReceiptInfo.timestamp=e)}}]),Oo),Ao=["sound","FCMChannelID"];function Oo(e){d(this,Oo),this.ID="",this.conversationID=e.conversationID||null,this.conversationType=e.conversationType||R.CONV_C2C,this.conversationSubType=e.conversationSubType,this.time=e.time||Math.ceil(Date.now()/1e3),this.sequence=e.sequence||0,this.clientSequence=e.clientSequence||e.sequence||0,this.random=e.random||0===e.random?e.random:lt(),this.priority=this._computePriority(e.priority),this.nick=e.nick||"",this.avatar=e.avatar||"",this.isPeerRead=!1,this.nameCard="",this.hasRiskContent=$t(e.checkResult),this._elements=[],this.isPlaceMessage=e.isPlaceMessage||0,this.isRevoked=2===e.isPlaceMessage||8===e.msgFlagBits,this.from=e.from||null,this.to=e.to||null,this.flow="",this.isSystemMessage=e.isSystemMessage||!1,this.protocol=e.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=e.status||On,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=e.cloudCustomData||"",this.isDeleted=!1,this.isModified=!!e.messageVersion,this._isExcludedFromUnreadCount=!(!e.messageControlInfo||1!==e.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!e.messageControlInfo||1!==e.messageControlInfo.excludedFromLastMessage),this.clientTime=e.clientTime||Oe()||0,this.senderTinyID=e.senderTinyID||e.tinyID||"",this.readReceiptInfo=e.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0,timestamp:0},this.needReadReceipt=!0===e.needReadReceipt||1===e.needReadReceipt,this.version=e.messageVersion||0,this.isBroadcastMessage=e.isBroadcastMessage||!1,this._receiverList=e.receiverList||void 0,this.isSupportExtension=!0===e.isSupportExtension||1===e.isSupportExtension,this._cmConfigID=e.customModerationConfigurationID,this.revoker=e.revokerInfo&&e.revokerInfo.revoker||"",this.revokerInfo=e.revokerInfo||{userID:"",nick:"",avatar:""},this.revokeReason=e.revokeReason||"",this.reInitialize(e.currentUser),this.extractGroupInfo(e.groupProfile||null),this.handleGroupAtInfo(e),this.initC2CReadReceiptInfo(e)}function No(e,t,n,l){var o,i,a,s,r,c,u;d(this,No),this.type=R.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},e.downloadKey?(i=e.downloadKey,a=e.pbDownloadKey,s=e.title,r=e.abstractList,c=e.compatibleText,o=e.version,this.content.downloadKey=i,this.content.pbDownloadKey=a,this.content.title=s,this.content.abstractList=r,this.content.compatibleText=c,this.content.version=o||0):Je(e.messageList)?1===e.layersOverLimit&&(this.content.layersOverLimit=!0):(i=e.messageList,a=e.title,s=e.abstractList,r=e.compatibleText,c=e.version,u=[],i.forEach(function(e){Je(e)||(e=new Lo(e,t,n,l),u.push(e))}),this.content.messageList=u,this.content.title=a,this.content.abstractList=s,this.content.compatibleText=r,this.content.version=c||0)}function Go(e,t,n,o){var i,a;d(this,Go),this.from=e.from,this.messageSender=e.from,this.time=e.time,this.messageSequence=e.sequence,this.clientSequence=e.clientSequence||e.sequence,this.messageRandom=e.random,this.cloudCustomData=e.cloudCustomData||"",this.clientTime=e.clientTime||void 0,e.ID?(this.ID=e.ID||"",this.nick=e.nick||"",this.avatar=e.avatar||"",e.messageBody?this.messageBody=JSON.parse(JSON.stringify(e.messageBody)):this.messageBody=[{type:e.type,payload:e.payload}],e.conversationType?e.conversationType.startsWith(R.CONV_C2C)?this.receiverUserID=e.to:e.conversationType.startsWith(R.CONV_GROUP)&&(this.receiverGroupID=e.to):e.receiverGroupID?this.receiverGroupID=e.receiverGroupID:e.receiverUserID&&(this.receiverUserID=e.receiverUserID),this.messageReceiver=e.to||e.messageReceiver):(this.nick=e.nick||"",this.avatar=e.avatar||"",this.messageBody=[],i=e.elements[0].type,a=e.elements[0].content,this._patchRichMediaPayload(i,a),this._updateRichMediaDownloadUrl(i,a,t,n,o),i===R.MSG_MERGER?this.messageBody.push({type:i,payload:new So(a,t,n,o).content}):this.messageBody.push({type:i,payload:a}),e.groupID&&(this.receiverGroupID=e.groupID,this.messageReceiver=e.groupID),e.to&&(this.receiverUserID=e.to,this.messageReceiver=e.to),this.ID="".concat(e.tinyID,"-").concat(e.clientTime,"-").concat(e.random))}function Po(e){d(this,Po),this.type=R.MSG_LOCATION;var t=e.description,n=e.longitude,e=e.latitude;this.content={description:t,longitude:n,latitude:e}}function Uo(e,t,n,o){d(this,Uo),this.type=R.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:e.remoteVideoUrl||e.videoUrl||"",videoFormat:e.videoFormat,videoSecond:parseInt(e.videoSecond,10),videoSize:e.videoSize,videoUrl:lo(e.videoUrl,t,n,o),videoDownloadFlag:2,videoUUID:e.videoUUID,thumbUUID:e.thumbUUID,thumbFormat:e.thumbFormat,thumbWidth:e.thumbWidth,snapshotWidth:e.thumbWidth,thumbHeight:e.thumbHeight,snapshotHeight:e.thumbHeight,thumbSize:e.thumbSize,snapshotSize:e.thumbSize,thumbDownloadFlag:2,thumbUrl:lo(e.thumbUrl,t,n,o),snapshotUrl:lo(e.thumbUrl,t,n,o)}}function bo(e){d(this,bo),this.type=R.MSG_CUSTOM,this.content={data:e.data||"",description:e.description||"",extension:e.extension||""}}function wo(e,t,n,o){d(this,wo),this.type=R.MSG_FILE,this._percent=0;var i=this._getFileInfo(e);this.content={downloadFlag:2,fileUrl:lo(e.url||e.fileUrl,t,n,o)||"",uuid:e.uuid,fileName:i.name||"",fileSize:i.size||0}}function Fo(e){d(this,Fo),this.type=R.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(e)}function qo(e){d(this,qo),this.type=R.MSG_GRP_TIP,this.content={},this._initContent(e)}function xo(e,t,n,o){d(this,xo),this.type=R.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:e.second,size:e.size,url:lo(e.url,t,n,o),remoteAudioUrl:e.url||"",uuid:e.uuid}}function Vo(e){d(this,Vo),this.type=R.MSG_FACE,this.content=e||null}function Ho(e,t,n,o){d(this,Ho),this._imageMemoryURL="",this._fileDownloadProxy=t,this._authKey=n,this._fileDNList=o,ae||re?this.createImageDataASURL(e.file):this.createImageDataASURLInWeb(e.file),this._initImageInfoModel(),this.type=R.MSG_IMAGE,this._percent=0,this.content={imageFormat:e.imageFormat||Fe.UNKNOWN,uuid:e.uuid,imageInfoArray:[]},this.initImageInfoArray(e.imageInfoArray),this._autoFixUrl()}function Bo(e){if(et(e))return{pushFlag:!0===e.disablePush?1:0,title:e.title||"",desc:e.description||"",ext:e.extension||"",apnsInfo:(n=void 0===(n=(t=e).apnsInfo)?{}:n,o=t.ignoreIOSBadge,t=t.disableVoipPush,o=!0===n.ignoreIOSBadge||!0===(void 0!==o&&o)?1:0,i=void 0,A(t)||(i=!1===t?1:0),A(n.disableVoipPush)||(i=!1===n.disableVoipPush?1:0),y(y({},n),{},{badgeMode:o,isVoipPush:i})),androidInfo:(n=void 0===(n=(t=e).androidInfo)?{}:n,t=t.androidOPPOChannelID,t=n.OPPOChannelID||(void 0===t?"":t),o=void 0===(o=n.sound)?"":o,i=void 0===(i=n.FCMChannelID)?"":i,y(y({},g(n,Ao)),{},{Sound:-1===(o=(n=o).lastIndexOf("."))?n:n.slice(0,o),OPPOChannelID:t,GoogleChannelID:i}))};var t,n,o,i}t(zo,Fn),Ko=f(zo),e(zo,[{key:"onNewMessage",value:function(e){var t=e.dataList,n=e.isInstantMessage,o=e.C2CRemainingUnreadList,i=e.C2CPairUnreadList,e=e.isSyncingEnded,t=(n||v.l("".concat(this._n,".onNewMessage C2CPairUnreadList:"),i,"C2CRemainingUnreadList:",o),this._assembly({dataList:t,C2CRemainingUnreadList:o,C2CPairUnreadList:i,isInstantMessage:n})),o=t.conversationOptionsList,i=t.messageList,t=t.isUnreadC2CMessage,a=Dt(i),a=(0<a.length&&this.emitOEvt(G.MESSAGE_MODIFIED,a),this.get(11).onNewMessage({conversationOptionsList:o,isInstantMessage:n,isUnreadC2CMessage:t,isSyncingEnded:e}),Lt(i));n&&0<a.length&&this.emitOEvt(G.MESSAGE_RECEIVED,a),i.length=0}},{key:"_assembly",value:function(e){for(var l=e.dataList,d=e.C2CRemainingUnreadList,n=e.C2CPairUnreadList,p=e.isInstantMessage,t=null,o=[],_=[],h={},g=this.get(26),f=!1,i=this.get(11),m=this.get(4),e=this.get(17),v=this.getFileDownloadProxy(),I=this.getDowloadFileAuthKey(),M=e.getFileDNList(),a=0,y=l.length;a<y;a++)if(this._isC2CNotice(l[a]))this._noticeFromUnreadDBList.push(l[a].eventArray[0].c2CNotifyMsgArray[0]);else{var s=l[a],r=(s.currentUser=this.getMyUserID(),s.conversationType=R.CONV_C2C,s.isSystemMessage=!!s.isSystemMessage,(A(s.nick)||A(s.avatar))&&(f=!0),(t=new Ro(s)).setElement(s.elements,v,I,M),t.setNickAndAvatar({nick:s.nick,avatar:s.avatar}),t.conversationID);if(p){if(this._msgFromUnreadDBMap.get(t.ID))continue;var c,u,C=!1,T=(t.from!==this.getMyUserID()?(u=i.getLatestMessageSentByPeer(r))&&(c=u.nick,u=u.avatar,f?t.setNickAndAvatar({nick:c,avatar:u}):c===t.nick&&u===t.avatar||(C=!0)):(c=i.getLatestMessageSentByMe(r))&&(u=c.nick,T=c.avatar,u===t.nick&&T===t.avatar||(i.modifyMessageSentByMe({conversationID:r,latestNick:t.nick,latestAvatar:t.avatar}),m.mockOnNickAvatarModified(t.nick,t.avatar))),1===l[a].isModified);if(i.isMessageSentByCurrentInstance(t)?t.isModified=T:T=!1,0===s.msgLifeTime)t._onlineOnlyFlag=!0,i.isMessageSentByCurrentInstance(t)||_.push(t);else{if(!i.pushIntoMessageList(_,t,T))continue;C&&(i.modifyMessageSentByPeer({conversationID:r,latestNick:t.nick,latestAvatar:t.avatar}),i.updateUserProfileSpecifiedKey({conversationID:r,nick:t.nick,avatar:t.avatar}))}p&&0<t.clientTime&&g.addMessageDelay(t.clientTime)}else this._msgFromUnreadDBMap.set(t.ID,t);if(0!==s.msgLifeTime){if(!1===t._onlineOnlyFlag){C=i.getLastMessageTime(r);if(Qe(C)&&t.time<C)continue;p&&(A(h[r])?(s=0,"in"===t.flow&&(t._isExcludedFromUnreadCount||(s=1)),h[r]=o.push({conversationID:r,unreadCount:s,type:t.conversationType,subType:t.conversationSubType,lastMessage:t._isExcludedFromLastMessage?"":t})-1):(s=h[r],o[s].type=t.conversationType,o[s].subType=t.conversationSubType,o[s].lastMessage=t._isExcludedFromLastMessage?"":t,"in"===t.flow&&(t._isExcludedFromUnreadCount||o[s].unreadCount++)))}}else t._onlineOnlyFlag=!0}this._handleNoticeFromUnreadDB();var D=!1;if(nt(n)&&0<n.length)for(var E=0,L=n.length;E<L;E++)!function(t){if(n[t].from===R.CONV_SYSTEM)return;D=!0;var e=o.find(function(e){return e.conversationID==="".concat(R.CONV_C2C).concat(n[t].from)});e?e.unreadCount=n[t].unreadCount:o.push({conversationID:"".concat(R.CONV_C2C).concat(n[t].from),unreadCount:n[t].unreadCount,type:R.CONV_C2C})}(E);if(nt(d))for(var S=0,k=d.length;S<k;S++)!function(t){o.find(function(e){return e.conversationID==="".concat(R.CONV_C2C).concat(d[t].from)})||o.push({conversationID:"".concat(R.CONV_C2C).concat(d[t].from),type:R.CONV_C2C,lastMsgTime:d[t].lastMsgTime})}(S);return{conversationOptionsList:o,messageList:_,isUnreadC2CMessage:D}}},{key:"getMessageListFromUnreadDB",value:function(){return D(this._msgFromUnreadDBMap.values())}},{key:"_isC2CNotice",value:function(e){e=e.eventArray;return!(!nt(e)||10!==e[0].event)}},{key:"_handleNoticeFromUnreadDB",value:function(){var t,e=this._noticeFromUnreadDBList.length;0!==e&&(v.l("".concat(this._n,"._handleNoticeFromUnreadDB count:").concat(e)),t=[],this._noticeFromUnreadDBList.forEach(function(e){e.hasOwnProperty("c2cMessageRevokedNotify")&&t.push(e)}),this.onMsgRevoked({dataList:t}),this._noticeFromUnreadDBList.length=0,t.length=0)}},{key:"onMsgRevoked",value:function(e,t){var a,s=this,r=this.get(11),c=[];e.dataList.forEach(function(e){e.c2cMessageRevokedNotify&&(e=e.c2cMessageRevokedNotify.revokedInfos,A(e)||e.forEach(function(e){var t=s.getMyUserID()===e.from?"".concat(R.CONV_C2C).concat(e.to):"".concat(R.CONV_C2C).concat(e.from);a=r.revoke(t,e.sequence,e.random);var n,o=e.revokerInfo&&e.revokerInfo.revoker,i=e.revokerInfo&&e.revokerInfo.reason||"";a?n=a:(n={conversationID:t,sequence:e.sequence},e.tinyID&&e.clientTime&&e.random&&(n.ID="".concat(e.tinyID,"-").concat(e.clientTime,"-").concat(e.random)),e.time&&(n.time=e.time)),n&&(n.revoker=o,n.revokeReason=i,n.revokerInfo={userID:o,nick:"",avatar:""},c.push(n))}))}),0!==c.length&&(v.l("".concat(this._n,".onMsgRevoked count:").concat(c.length," updateUnreadCount:").concat(t)),r.onMessageRevoked(c,t),r.updateRevokerInfo(c).then(function(e){s.emitOEvt(G.MESSAGE_REVOKED,e)}))}},{key:"onMsgReadReceipt",value:function(e){var i=this;e.dataList.forEach(function(e){var o;Je(e.c2cMessageReadReceipt)||(o=e.c2cMessageReadReceipt.to,e.c2cMessageReadReceipt.uinPairReadArray.forEach(function(e){var e=e.peerReadTime,t=(v.l("".concat(i._n,".onMsgReadReceipt to:").concat(o," peerReadTime:").concat(e)),"".concat(R.CONV_C2C).concat(o)),n=i.get(11);n.recordPeerReadTime(t,e),n.updateMsgIsPeerReadProp(t,e)}))})}},{key:"onMsgReadNotice",value:function(e){var o=this;e.dataList.forEach(function(e){var n;Je(e.c2cMessageReadNotice)||(n=o.get(11),e.c2cMessageReadNotice.uinPairReadArray.forEach(function(e){var t=e.from,e=e.peerReadTime,t=(v.l("".concat(o._n,".onMsgReadNotice from:").concat(t," lastReadTime:").concat(e)),"".concat(R.CONV_C2C).concat(t));n.updateIsReadAfterReadReport({conversationID:t,lastMessageTime:e}),n.updateUnreadCount(t)}))})}},{key:"onMsgModified",value:function(e){v.l("".concat(this._n,".onMsgModified options:"),e);var t=this.get(11);e.dataList.forEach(function(e){t.onMessageModified(y(y({},e),{},{conversationType:R.CONV_C2C}))})}},{key:"onReadReceiptList",value:function(e){v.l("".concat(this._n,".onReadReceiptList options:"),e),this.get(11).updateReadReceiptInfo(e.dataList)}},{key:"sendMessage",value:function(e,t){e=this._createC2CMessagePack(e,t);return this.req(e)}},{key:"_createC2CMessagePack",value:function(e,t){var n=null,o=(t&&(t.offlinePushInfo&&(n=t.offlinePushInfo),!0===t.onlineUserOnly&&(n?n.disablePush=!0:n={disablePush:!0})),""),i=(ft(e.cloudCustomData)&&0<e.cloudCustomData.length&&(o=e.cloudCustomData),[]),a=(et(t)&&et(t.messageControlInfo)&&(a=(r=t.messageControlInfo).excludedFromUnreadCount,s=r.excludedFromLastMessage,r=r.excludedFromContentModeration,!0===a&&i.push("NoUnread"),!0===s&&i.push("NoLastMsg"),!0===r&&i.push("NoMsgCheck")),this.isOnlineMessage(e,t)?0:void 0),s=JSON.parse(JSON.stringify(e.getElements())),r=this.get(17).getFileDNList();return{P:I.SEND_C2C_MSG,data:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:po(e.type,s,r),cloudCustomData:o,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:a,nick:e.nick,avatar:e.avatar,offlinePushInfo:Bo(n),messageControlInfo:0!==a?i:void 0,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0,cmConfigID:e._cmConfigID,forbidCallbackControl:Et(t)}}}},{key:"isOnlineMessage",value:function(e,t){return!(!t||!0!==t.onlineUserOnly)}},{key:"revokeMessage",value:function(e){return this.req({P:I.REVOKE_C2C_MSG,data:{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,e=e.keyList;return v.l("".concat(this._n,".deleteMessage toAccount:").concat(t," count:").concat(e.length)),this.req({P:I.DEL_C2C_MSG,data:{fromAccount:this.getMyUserID(),to:t,keyList:e}})}},{key:"modifyRemoteMessage",value:function(e){var t=e.from,n=e.to,o=e.version,o=void 0===o?0:o,i=e.sequence,a=e.random,s=e.time,r=e.payload,c=e.type,l=e.cloudCustomData,e=e._elements,u=void 0;return Wt(c)&&(1<e.length&&e.splice(0,1,{type:c,content:r}),u=e),this.req({P:I.MODIFY_C2C_MSG,data:{from:t,to:n,version:o,sequence:i,random:a,time:s,elements:u,cloudCustomData:l}})}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,o=e.lastMessageTime,i="".concat(this._n,".").concat("setMessageRead"),e="convID:".concat(n," lastMessageTime:").concat(o),a=(v.l("".concat(i," ").concat(e)),Qe(o)||this.warn("DoNotModifyLastTime"),new M("setMessageRead"));return a.setMessage(e),this.req({P:I.SET_C2C_MSG_READ,data:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:n.replace("C2C",""),lastMessageTime:o,receipt:1}]}}}).then(function(){a.end(),v.l("".concat(i," ok"));var e=t.get(11);return e.updateIsReadAfterReadReport({conversationID:n,lastMessageTime:o}),e.updateUnreadCount(n),Sn()}).catch(function(e){return a.setError(e).end(),v.l("".concat(i," failed. error:"),e),C(e)})}},{key:"getRoamingMessage",value:function(e){var s=this,r="".concat(this._n,".").concat("getRoamingMessage"),t=e.peerAccount,c=e.conversationID,n=e.count,o=e.lastMessageTime,e=e.messageKey,u="peerAccount:".concat(t," count:").concat(n||15," lastMessageTime:").concat(o||0," messageKey:").concat(e),l=(v.l("".concat(r," ").concat(u)),new M("getRoamingMessage"));return this.req({P:I.GET_C2C_ROAMING_MSG,data:{peerAccount:t,count:n||15,lastMessageTime:o||0,messageKey:e}}).then(function(e){var e=e.data,t=e.complete,n=e.messageList,o=e.messageKey,e=e.lastMessageTime,i=(A(n)?v.l("".concat(r," ok. complete:").concat(t," but messageList is undefined!")):v.l("".concat(r," ok. complete:").concat(t," count:").concat(n.length)),l.setMessage("".concat(u," complete:").concat(t," length:").concat(n.length)).end(),s.get(11)),t=1===t,a=(t&&i.setCompleted(c),[]),n=i.onRoamingMessage(n,c,!0,a),o=(i.modifyMessageList(c),i.updateIsRead(c),i.updateRoamingMsgKeyAndTime(c,o,e),i.getPeerReadTime(c)),o=(v.l("".concat(r," update isPeerRead property. convID:").concat(c," peerReadTime:").concat(o)),o?i.updateMsgIsPeerReadProp(c,o):(e=c.replace(R.CONV_C2C,""),s.getRemotePeerReadTime([e]).then(function(){i.updateMsgIsPeerReadProp(c,i.getPeerReadTime(c))})),"");return 0<n.length?o=n[0].ID:(e=i.getLocalOldestMessage(c))&&(o=e.ID),v.l("".concat(r," nextReqID:").concat(o," storedMsgCount:").concat(n.length)),{nextReqID:o,storedMessageList:n,assembledMessageList:a,isPullingCompleted:t}}).catch(function(e){return l.setMessage(u).setError(e).end(),v.w("".concat(r," failed. error:"),e),C(e)})}},{key:"getRoamingMessagesHopping",value:function(e){var a=this,s="".concat(this._n,".").concat("getRoamingMessagesHopping"),t=e.peerAccount,n=e.time,n=void 0===n?0:n,o=e.count,r=e.direction,c="".concat(R.CONV_C2C).concat(t),u="peerAccount:".concat(t," count:").concat(o," time:").concat(n," direction:").concat(r),l=(v.l("".concat(s," ").concat(u)),new M("getRoamingMessagesHopping"));return this.req({P:I.GET_C2C_ROAMING_MSG,data:{peerAccount:t,count:o+1,lastMessageTime:n,direction:r}}).then(function(e){var e=e.data,t=e.complete,n=e.messageList,n=void 0===n?[]:n,e=e.lastMessageTime,o="complete:".concat(t," count:").concat(n.length),i=(v.l("".concat(s," ok. ").concat(o)),l.setMessage("".concat(u," ").concat(o)).end(),1!==t&&(1===r?n.pop():n.shift()),a.get(11)),o=i.onRoamingMessage(n,c,!1),n=(a._modifyMessageList(c,o),a._computeResult({complete:t,lastMessageTime:e,resultList:o})),t=(i.storeHoppingMessageList(n.messageList),i.getPeerReadTime(c));return v.l("".concat(s," update isPeerRead property. convID:").concat(c," peerReadTime:").concat(t)),t?i.updateMsgIsPeerReadProp(c,t):(e=c.replace(R.CONV_C2C,""),a.getRemotePeerReadTime([e]).then(function(){i.updateMsgIsPeerReadProp(c,i.getPeerReadTime(c))})),Sn(n)}).catch(function(e){return l.setMessage(u).setError(e).end(),v.w("".concat(s," failed. error:"),e),C(e)})}},{key:"_computeResult",value:function(e){var t=e.complete,t=void 0===t?0:t,n=e.lastMessageTime,e=e.resultList,e={messageList:D(void 0===e?[]:e),isCompleted:!1,nextMessageTime:""};return 1===t?e.isCompleted=!0:e.nextMessageTime=n,e}},{key:"_modifyMessageList",value:function(e,t){e=this.get(11).getLocalConversation(e);if(e)for(var n=e.userProfile.nick,o=e.userProfile.avatar,e=this.get(4).getNickAndAvatarByUserID(this.getMyUserID()),i=e.nick,a=e.avatar,s=t.length-1;0<=s;s--){var r=t[s];"in"===r.flow&&(r.nick!==n&&r.setNickAndAvatar({nick:n}),r.avatar!==o&&r.setNickAndAvatar({avatar:o})),"out"===r.flow&&(r.nick!==i&&r.setNickAndAvatar({nick:i}),r.avatar!==a&&r.setNickAndAvatar({avatar:a}))}}},{key:"getRemotePeerReadTime",value:function(a){var s=this,r="".concat(this._n,".").concat("getRemotePeerReadTime");if(Je(a))return Promise.resolve();var c=new M("getRemotePeerReadTime");return v.l("".concat(r," userIDList:").concat(a)),this.req({P:I.GET_C2C_PEER_READ_TIME,data:{userIDList:a}}).then(function(e){var t=e.data.peerReadTimeList;v.l("".concat(r," ok. peerReadTimeList:").concat(t));for(var n="",o=s.get(11),i=0;i<a.length;i++)n+="".concat(a[i],"-").concat(t[i]," "),0<t[i]&&o.recordPeerReadTime("".concat(R.CONV_C2C).concat(a[i]),t[i]);c.setMessage(n).end()}).catch(function(e){c.setError(e).end(),v.w("".concat(r," failed. error:"),e)})}},{key:"sendReadReceipt",value:function(e){var t=e[0].conversationID.replace(R.CONV_C2C,""),n=new M("sendReadReceipt"),o=(n.setMessage("peerAccount:".concat(t)),this.getMyUserID()),e=e.filter(function(e){return e.from!==o&&!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===e.length)return C({code:T.READ_RECEIPT_MSG_LIST_EMPTY});var i="".concat(this._n,".").concat("sendReadReceipt");return v.l("".concat(i,". peerAccount:").concat(t," length:").concat(e.length)),this.req({P:I.SEND_C2C_READ_RECEIPT,data:{peerAccount:t,messageInfoList:e}}).then(function(e){return n.end(),v.l("".concat(i," ok")),Sn()}).catch(function(e){return n.setError(e).end(),v.w("".concat(i," failed. error:"),e),C(e)})}},{key:"getReadReceiptList",value:function(e){var t=e[0].conversationID.replace(R.CONV_C2C,"");return v.l("".concat(this._n,".getReadReceiptList peerAccount:").concat(t," msgCount:").concat(e.length)),kn({messageList:e})}},{key:"getMessageExtensions",value:function(e,t){return v.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.req({P:I.GET_C2C_MSG_EXT,data:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),startSequence:t}})}},{key:"modifyMsgExts",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return v.l("".concat(this._n,".modifyMsgExts operateType:").concat(n)),this.req({P:I.MODIFY_C2C_MSG_EXT,data:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),extensionList:t,operateType:n}})}},{key:"getMessageKey",value:function(e){var t=e.clientSequence,n=e.random,e=e.time;return"".concat(t,"_").concat(n,"_").concat(e)}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._msgFromUnreadDBMap.clear(),this._noticeFromUnreadDBList.length=0}}]);var Ko,Yo=zo,Wo={A2KEY_AND_TINYID_UPDATED:"_inner".concat(1),CLOUD_CONFIG:"_inner".concat(2),PROFILE_UPDATED:"_inner".concat(3),CONV_SYNC_COMPLETED:"_inner".concat(4),C2C_UNREAD_HANDLE_COMPLETED:"_inner".concat(5)},jo=(e(Jo,[{key:"_onCloudConfig",value:function(){var e=this._convM.getCloudConfig("topic_msg_limit");A(e)||(this.TOPIC_MSG_LIMIT=Number(e)),v.l("".concat(this._n,"._onCloudConfig topicMsgLimit:").concat(this.TOPIC_MSG_LIMIT))}},{key:"onCheckTimer",value:function(e){if(e%20==0&&0<this._map.size){var t,n=N(this._map);try{for(n.s();!(t=n.n()).done;){var o=m(t.value,2),i=o[0],a=o[1];i.includes(We)&&a.size>=this.TOPIC_MSG_LIMIT&&this._convM.clearMemMsg(i,!0)}}catch(e){n.e(e)}finally{n.f()}}}},{key:"pushIn",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=e.conversationID,o=!0,i=(this._map.has(n)||this._map.set(n,new Map),this._getUniqueIDOfMsg(e));if(this._map.get(n).has(i)){var a=this._map.get(n).get(i);if(!t||!0===a.isModified)return!1}return this._map.get(n).set(i,e),this._setLatestMsgSentByPeer(n,e),this._setLatestMsgSentByMe(n,e),o}},{key:"unshift",value:function(e,t){var n;if(nt(e)?0<e.length&&(n=e[0].conversationID,this._unshiftMultipleMsgs(e,t)):(n=e.conversationID,this._unshiftSingleMsg(e,t)),n){var o=Array.from(this._map.get(n).values()),e=o.length;if(0!==e){for(var i=e-1;0<=i;i--)if("out"===o[i].flow){this._setLatestMsgSentByMe(n,o[i]);break}if(n.startsWith(R.CONV_C2C))for(var a=e-1;0<=a;a--)if("in"===o[a].flow){this._setLatestMsgSentByPeer(n,o[a]);break}}}}},{key:"_unshiftSingleMsg",value:function(e,t){var n=e.conversationID,o=this._getUniqueIDOfMsg(e);if(!this._map.has(n))return this._map.set(n,new Map),this._map.get(n).set(o,e),void t.push(e);var i=this._map.get(n),a=Array.from(i);i.has(o)||(a.unshift([o,e]),this._map.set(n,new Map(a)),t.push(e))}},{key:"_unshiftMultipleMsgs",value:function(e,t){for(var n=e.length,o=[],i=e[0].conversationID,a=this._map.get(i),s=this._map.has(i)?Array.from(a):[],r=0;r<n;r++){var c=this._getUniqueIDOfMsg(e[r]);a&&a.has(c)||(o.push([c,e[r]]),t.push(e[r]))}this._map.set(i,new Map(o.concat(s)))}},{key:"remove",value:function(e){var t=e.conversationID,e=this._getUniqueIDOfMsg(e);this._map.has(t)&&this._map.get(t).delete(e)}},{key:"revoke",value:function(e,t,n){var o;return this._map.has(e)?(o=this._map.get(e),this._updateMsgIsRevoked(o,t,n)):this._hoppingMsgMap.has(e)?(o=this._hoppingMsgMap.get(e),this._updateMsgIsRevoked(o,t,n)):null}},{key:"_updateMsgIsRevoked",value:function(e,t,n){var o,i=N(e);try{for(i.s();!(o=i.n()).done;){var a=m(o.value,2)[1];if(a.sequence===t&&(A(n)||a.random===n))return a.isRevoked||(a.isRevoked=!0),a}}catch(e){i.e(e)}finally{i.f()}}},{key:"removeByConvID",value:function(e){var t=this._map.has(e);v.l("".concat(this._n,".removeByConvID convID:").concat(e," has:").concat(t)),t&&(this._map.delete(e),this._latestMsgSentByPeerMap.delete(e),this._latestMsgSentByMeMap.delete(e))}},{key:"findMessage",value:function(e){var t=null;return t=(t=this._findMsg(e,this._map))?t:this._findMsg(e,this._hoppingMsgMap)}},{key:"_findMsg",value:function(e,t){var n,o=null,i=N(t);try{for(i.s();!(n=i.n()).done;)for(var a=D(m(n.value,2)[1].values()),s=a.length,r=0;r<s;r++)if(a[r].ID===e){o=a[r];break}}catch(e){i.e(e)}finally{i.f()}return o}},{key:"updateMsgIsPeerReadProp",value:function(e,t){var n,o=[];return this._map.has(e)?(n=this._map.get(e),o=this._updateMsgIsPeerReadProp(n,t)):this._hoppingMsgMap.has(e)&&(n=this._hoppingMsgMap.get(e),o=this._updateMsgIsPeerReadProp(n,t)),v.l("".concat(this._n,".updateMsgIsPeerReadProp convID:").concat(e," peerReadTime:").concat(t," count:").concat(o.length)),o}},{key:"_updateMsgIsPeerReadProp",value:function(e,t){var n,o=[],i=N(e);try{for(i.s();!(n=i.n()).done;){var a=m(n.value,2)[1];a.time<=t&&!a.isPeerRead&&"out"===a.flow&&(a.isPeerRead=!0,o.push(a))}}catch(e){i.e(e)}finally{i.f()}return o}},{key:"updateMsgIsModifiedProp",value:function(e){var t=e.conversationID;this._map.has(t)&&(e=this._getUniqueIDOfMsg(e),(t=this._map.get(t).get(e))&&(t.isModified=!0))}},{key:"hasLocalMsgList",value:function(e){return this._map.has(e)}},{key:"getLocalMsgList",value:function(e){return this.hasLocalMsgList(e)?D(this._map.get(e).values()):[]}},{key:"getLocalMaxSeq",value:function(e){if(!this.hasLocalMsgList(e))return 0;e=D(this._map.get(e).values()).map(function(e){return e.sequence});return Math.max.apply(Math,D(e))}},{key:"getLocalMaxTime",value:function(e){if(!this.hasLocalMsgList(e))return 0;e=D(this._map.get(e).values()).map(function(e){return e.time});return Math.max.apply(Math,D(e))}},{key:"hasLocalMsg",value:function(e,t){for(var n=!1,o=this.getLocalMsgList(e),i=o.length,a=0;a<i;a++)o[a].ID===t&&(n=!0);return n}},{key:"getLocalMsg",value:function(e,t){for(var n=null,o=this.getLocalMsgList(e),i=o.length,a=0;a<i;a++)if(o[a].ID===t){n=o[a];break}return n}},{key:"getLocalLastMsg",value:function(e){e=this.getLocalMsgList(e);return e[e.length-1]}},{key:"getLocalSecondLastMsg",value:function(e){e=this.getLocalMsgList(e);return e[e.length-2]}},{key:"getLocalOldestMsg",value:function(e){return this.getLocalMsgList(e)[0]}},{key:"_setLatestMsgSentByPeer",value:function(e,t){e.startsWith(R.CONV_C2C)&&"in"===t.flow&&this._latestMsgSentByPeerMap.set(e,t)}},{key:"_setLatestMsgSentByMe",value:function(e,t){"out"===t.flow&&this._latestMsgSentByMeMap.set(e,t)}},{key:"getLatestMsgSentByPeer",value:function(e){return this._latestMsgSentByPeerMap.get(e)}},{key:"getLatestMsgSentByMe",value:function(e){return this._latestMsgSentByMeMap.get(e)}},{key:"modifyMsgSentByPeer",value:function(e){var t=e.conversationID,n=e.latestNick,o=e.latestAvatar,e=this._map.get(t);if(!Je(e)){var i=Array.from(e.values()),e=i.length;if(0!==e){for(var a=null,s=0,r=!1,c=e-1;0<=c;c--)"in"===i[c].flow&&((a=i[c]).nick!==n&&(a.setNickAndAvatar({nick:n}),r=!0),a.avatar!==o&&(a.setNickAndAvatar({avatar:o}),r=!0),r&&(s+=1));v.l("".concat(this._n,".modifyMsgSentByPeer convID:").concat(t," count:").concat(s))}}}},{key:"modifyMsgSentByMe",value:function(e){var t=e.conversationID,n=e.latestNick,o=e.latestAvatar,e=this._map.get(t);if(!Je(e)){var i=Array.from(e.values()),e=i.length;if(0!==e){for(var a=null,s=0,r=!1,c=e-1;0<=c;c--)"out"===i[c].flow&&((a=i[c]).nick!==n&&(a.setNickAndAvatar({nick:n}),r=!0),a.avatar!==o&&(a.setNickAndAvatar({avatar:o}),r=!0),r&&(s+=1));v.l("".concat(this._n,".modifyMsgSentByMe convID:").concat(t," count:").concat(s))}}}},{key:"getTopicConvIDList",value:function(t){return D(this._map.keys()).filter(function(e){return e.startsWith("".concat(R.CONV_GROUP).concat(t))})}},{key:"onMsgModified",value:function(e,t){if(!this._map.has(e)&&!this._hoppingMsgMap.has(e))return{isUpdated:!1,message:null};var n="".concat(this._n,".onMsgModified"),o=this._getUniqueIDOfMsg(t),i=this._getTargetMsg(e,o),a=!!i;return v.l("".concat(n," convID:").concat(e," uniqueID:").concat(o," has:").concat(a)),a?(e=t.messageVersion,o=t.elements,a=t.cloudCustomData,t=t.checkResult,v.l("".concat(n," localVersion:").concat(i.version," remoteVersion:").concat(e)),i.version<e?(i.version=e,i._elements=JSON.parse(JSON.stringify(o)),i.payload=i._elements[0].content,i.type=i._elements[0].type,i.cloudCustomData=a,i.isModified=!0,i.hasRiskContent=$t(t),{isUpdated:!0,message:i}):{isUpdated:!1,message:i}):{isUpdated:!1,message:null}}},{key:"_getUniqueIDOfMsg",value:function(e){var t=e.from,n=e.to,o=e.random,i=e.sequence,e=e.time;return"".concat(t,"-").concat(n,"-").concat(o,"-").concat(i,"-").concat(e)}},{key:"_getTargetMsg",value:function(e,t){if(this._map.has(e))return this._map.get(e).get(t);var n=void 0;if(this._hoppingMsgMap.has(e))for(var o=D(this._hoppingMsgMap.get(e).values()),i=0;i<o.length;i++)if(this._getUniqueIDOfMsg(o[i])===t){n=o[i];break}return n}},{key:"storeHoppingMsgList",value:function(e){if(0!==e.length){var t=e[0].conversationID,n=e.length;this._hoppingMsgMap.has(t)||this._hoppingMsgMap.set(t,new Map);for(var o=this._hoppingMsgMap.get(t),i=0;i<n;i++){var a=e[i];o.has(a.ID)||o.set(a.ID,a)}}}},{key:"getHoppingMsg",value:function(e,t){if(this._hoppingMsgMap.has(e))return this._hoppingMsgMap.get(e).get(t)}},{key:"reset",value:function(){this._map.clear(),this._latestMsgSentByPeerMap.clear(),this._latestMsgSentByMeMap.clear(),this._hoppingMsgMap.clear()}}]),Jo);function Jo(e){d(this,Jo),this._convM=e,this._map=new Map,this._n="MsgListHandler",this._latestMsgSentByPeerMap=new Map,this._latestMsgSentByMeMap=new Map,this._hoppingMsgMap=new Map,this.TOPIC_MSG_LIMIT=1e3,this._convM.getIEmitInst().on(Wo.CLOUD_CONFIG,this._onCloudConfig,this)}function zo(e){return d(this,zo),(e=Ko.call(this,e))._n="C2CModule",e._msgFromUnreadDBMap=new Map,e._noticeFromUnreadDBList=[],e}function Xo(e){this.mixin(e)}Xo.mixin=function(e){e=e.prototype||e;e._isReady=!1,e.ready=function(e){if(e)return this._isReady?void(1<arguments.length&&void 0!==arguments[1]&&arguments[1]?e.call(this):setTimeout(e,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(e))},e.triggerReady=function(){var t=this;this._isReady=!0,setTimeout(function(){var e=t._readyQueue;t._readyQueue=[],e&&0<e.length&&e.forEach(function(e){e.call(this)},t)},1)},e.resetReady=function(){this._isReady=!1,this._readyQueue=[]},e.isReady=function(){return this._isReady}};function Zo(e,t,n){return A(e)?{lastTime:0,lastSequence:0,fromAccount:"",messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}:n&&e.ID||e instanceof Ro?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:Yt(e.type,e.payload,t),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,revoker:e.revoker||null}:y(y({},e),{},{messageForShow:Yt(e.type,e.payload,t)})}function Qo(e,t){return Je(e)?{lastTime:0,lastSequence:0,fromAccount:"",payload:null,type:"",messageForShow:"",nick:"",avatar:"",version:0,cloudCustomData:"",isRevoked:!1,revoker:null}:{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",payload:e.payload||null,type:e.type||"",messageForShow:Yt(e.type,e.payload,t),nick:e.nick||"",avatar:e.avatar||"",version:e.version||0,cloudCustomData:e.cloudCustomData||"",isRevoked:e.isRevoked||!1,revoker:e.revoker||null}}function $o(e){var t=String(e).replace(/[=]+$/,""),n="";if(t.length%4==1)return"";for(var o,i,a=0,s=0;i=t.charAt(s++);~i&&(o=a%4?64*o+i:i,a++%4)&&(n+=String.fromCharCode(255&o>>(-2*a&6))))i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);try{return decodeURIComponent(escape(n))}catch(e){return""}}var ei,ti,ni,oi,ii,ai=["jpg","jpeg","gif","png","bmp","image","webp"],si=["mp4","quicktime","mov"],ri=(e(la,[{key:"validate",value:function(e){var t,n=!0,o="";if(Je(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var i=e.profileCustomField.length,a=null,s=0;s<i;s++){if(a=e.profileCustomField[s],!ft(a.key)||-1===a.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!ft(a.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if("profileCustomField"===t)continue;if(Je(e[t])&&!ft(e[t])&&!Qe(e[t])){o="key:"+t+", invalid value:"+e[t],n=!1;continue}switch(t){case"nick":ft(e[t])||(n=!(o="nick must be a string")),500<ut(e[t])&&(o="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(ut(e[t])," bytes"),n=!1);break;case"gender":pt(Ve,e.gender)||(o="key:gender, invalid value:"+e.gender,n=!1);break;case"birthday":Qe(e.birthday)||(n=!(o="birthday must be a number"));break;case"location":ft(e.location)||(n=!(o="location must be a string"));break;case"selfSignature":ft(e.selfSignature)||(n=!(o="selfSignature must be a string"));break;case"allowType":pt(Be,e.allowType)||(o="key:allowType, invalid value:"+e.allowType,n=!1);break;case"language":Qe(e.language)||(n=!(o="language must be a number"));break;case"avatar":ft(e.avatar)||(n=!(o="avatar must be a string"));break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n=!(o="messageSettings must be 0 or 1"));break;case"adminForbidType":pt(He,e.adminForbidType)||(o="key:adminForbidType, invalid value:"+e.adminForbidType,n=!1);break;case"level":Qe(e.level)||(n=!(o="level must be a number"));break;case"role":Qe(e.role)||(n=!(o="role must be a number"));break;default:o="unknown key:"+t+" "+e[t],n=!1}}return{valid:n,tips:o}}}]),la),ci=(e(ua,[{key:"set",value:function(e){var t;this.map.size>=this.MAX_LENGTH&&(t=this.map.entries().next().value[0],this.map.delete(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:"reset",value:function(){this.map.clear()}}]),ua),ui=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"],li=(e(ca,[{key:"memberNum",get:function(){return this.memberCount},set:function(e){}},{key:"maxMemberNum",get:function(){return this.maxMemberCount},set:function(e){}},{key:"_initGroup",value:function(e){for(var t in e)ui.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,e=(e.appid=void 0,e.grossTopicNextMsgSeq=void 0,e.selfInfo&&(e.selfInfo.grossTopicReadSeq=void 0),JSON.parse(JSON.stringify(e)));e.lastMsgTime&&(this.lastMessage.lastTime=e.lastMsgTime),A(e.muteAllMembers)||("On"===e.muteAllMembers?e.muteAllMembers=!0:e.muteAllMembers=!1),e.groupCustomField&&Tt(this.groupCustomField,e.groupCustomField),A(e.memberNum)||(this.memberCount=e.memberNum),A(e.maxMemberNum)||(this.maxMemberCount=e.maxMemberNum),A(e.isSupportTopic)||(this.isSupportTopic=Qe(e.isSupportTopic)?1===e.isSupportTopic:e.isSupportTopic),rt(this,e,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),nt(e.members)&&0<e.members.length&&e.members.forEach(function(e){e.userID===t.selfInfo.userID&&rt(t.selfInfo,e,["sequence"])})}},{key:"updateSelfInfo",value:function(e){e={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList};rt(this.selfInfo,y({},e),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}}]),ca),di=(e(ra,[{key:"toAccount",get:function(){return this.conversationID.startsWith(R.CONV_C2C)?this.conversationID.replace(R.CONV_C2C,""):this.conversationID.startsWith(R.CONV_GROUP)?this.conversationID.replace(R.CONV_GROUP,""):""}},{key:"_initProfile",value:function(t){var n=this;Object.keys(t).forEach(function(e){switch(e){case"userProfile":n.userProfile=t.userProfile;break;case"groupProfile":n.groupProfile=t.groupProfile}}),A(this.userProfile)&&this.type===R.CONV_C2C?this.userProfile=new ri({userID:t.conversationID.replace("C2C","")}):A(this.groupProfile)&&this.type===R.CONV_GROUP&&(this.groupProfile=new li({groupID:t.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(e){var t=e.nextUnreadCount,n=e.isFromGetConversations,e=e.isUnreadC2CMessage;A(t)||(St(this.subType)?this.unreadCount=0:n&&this.type===R.CONV_GROUP||n&&this.type===R.CONV_TOPIC||e&&this.type===R.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:"updateLastMessage",value:function(e){this.lastMessage=Zo(e)}},{key:"updateGroupAtInfoList",value:function(e){var t;this._isNeedMergeGroupAtInfo(e)||(-1!==(t=(E(t=e.groupAtType)||L(t)||S(t)||O()).slice(0)).indexOf(R.CONV_AT_ME)&&-1!==t.indexOf(R.CONV_AT_ALL)&&(t=[R.CONV_AT_ALL_AT_ME]),t={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:t,__random:e.__random,__sequence:e.__sequence},this.groupAtInfoList.push(t))}},{key:"_isNeedMergeGroupAtInfo",value:function(t){var e=t.groupID,n=t.sequence;if(!kt({groupID:e}))return!1;var o=!1;return this.groupAtInfoList.forEach(function(e){e.messageSequence===n&&(-1<e.atTypeArray.indexOf(R.CONV_AT_ME)&&-1<t.groupAtType.indexOf(R.CONV_AT_ALL)&&(e.atTypeArray=[R.CONV_AT_ALL_AT_ME]),-1<e.atTypeArray.indexOf(R.CONV_AT_ALL)&&-1<t.groupAtType.indexOf(R.CONV_AT_ME)&&(e.atTypeArray=[R.CONV_AT_ALL_AT_ME],e.__random=t.__random,e.__sequence=t.__sequence),o=!0)}),o}},{key:"clearGroupAtInfoList",value:function(){this.groupAtInfoList.length=0}},{key:"reduceUnreadCount",value:function(){return 1<=this.unreadCount&&(--this.unreadCount,!0)}},{key:"isLastMessageRevoked",value:function(e){var t=e.sequence,e=e.time;return this.type===R.CONV_C2C&&t===this.lastMessage.lastSequence&&e===this.lastMessage.lastTime||this.type===R.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}},{key:"setDraftText",value:function(e){this.draftText=e}}]),ra),pi=(c(qn={},R.MSG_REMIND_ACPT_AND_NOTE,0),c(qn,R.MSG_REMIND_DISCARD,1),c(qn,R.MSG_REMIND_ACPT_NOT_NOTE,2),qn),_i=(e(sa,[{key:"onAllRcvMsgOptNotify",value:function(e){e=this._handleResult(e);this._convM.emitOEvt(G.ALL_RECEIVE_MESSAGE_OPT_UPDATED,e)}},{key:"getC2CMsgRemindType",value:function(t){var n=this,o="".concat(this._n,".getC2CMsgRemindType");return this._convM.req({P:I.GET_C2C_PEER_MUTE_NOTIFICATIONS,data:{toAccount:this._convM.getMyUserID(),userIDList:t}}).then(function(e){v.l("".concat(o," ok. userIDList:").concat(t));e=e.data.muteFlagList;n._convM.onC2CMsgRemindTypeFetched(e)}).catch(function(e){v.e("".concat(o," failed. error:"),e)})}},{key:"set",value:function(e){return e.groupID?this._setGroupMsgRemindType(e):nt(e.userIDList)?this._setC2CMsgRemindType(e):void 0}},{key:"_setGroupMsgRemindType",value:function(t){var n=this,o="".concat(this._n,".").concat("_setGroupMsgRemindType"),e=t.groupID,i=t.messageRemindType,a="groupID:".concat(e," messageRemindType:").concat(i),s=new M("_setGroupMsgRemindType"),r=(s.setMessage(a),this._get(7));return r?r.modifyGroupMemberInfo({groupID:e,messageRemindType:i,userID:this._convM.getMyUserID()}).then(function(){s.end(),v.l("".concat(o," ok. ").concat(a));var e=n.onGroupMsgRemindTypeUpdated(t);return n._convM.onTotalUnreadCountUpdate(),Sn(e)}).catch(function(e){return s.setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)}):C({code:T.NO_MODULE})}},{key:"onGroupMsgRemindTypeUpdated",value:function(e){var t,n,o=e.groupID,e=e.messageRemindType,i=(v.l("".concat(this._n,".onGroupMsgRemindTypeUpdated groupID:").concat(o," messageRemindType:").concat(e)),this._get(7).getLocalGroupProfile(o));return i&&(i.selfInfo.messageRemindType=e),Rt(o)?(t=Kt(n=o),(n=this._get(10).getLocalTopic(t,n))&&n.updateSelfInfo({messageRemindType:e})&&this._convM.emitOEvt(G.TOPIC_UPDATED,{groupID:t,topic:n}),{topic:n}):(this._convM.patchMsgRemindType({ID:o,isC2CConversation:!1,messageRemindType:e})&&this._emitConvUpdate(),{group:i})}},{key:"_setC2CMsgRemindType",value:function(e){var i=this,a="".concat(this._n,".").concat("_setC2CMsgRemindType"),t=e.userIDList,s=e.messageRemindType,r=t.slice(0,30),e=pi[s]||0,c="userIDList:".concat(r," messageRemindType:").concat(s),u=new M("_setC2CMsgRemindType");return u.setMessage(c),this._convM.req({P:I.SET_C2C_PEER_MUTE_NOTIFICATIONS,data:{userIDList:r,muteFlag:e}}).then(function(e){u.end();var e=e.data.errorList,t=[],n=[],e=(nt(e)&&e.forEach(function(e){t.push(e.userID),n.push({userID:e.userID,code:e.errorCode})}),r.filter(function(e){return-1===t.indexOf(e)})),o=(v.l("".concat(a," ok. ").concat(c," successUserIDList:").concat(e," failureUserIDList:").concat(JSON.stringify(n))),0);return e.forEach(function(e){i._convM.patchMsgRemindType({ID:e,isC2CConversation:!0,messageRemindType:s})&&(o+=1)}),1<=o&&i._emitConvUpdate(),r.length=t.length=0,i._convM.onTotalUnreadCountUpdate(),kn({successUserIDList:e.map(function(e){return{userID:e}}),failureUserIDList:n})}).catch(function(e){return u.setError(e).end(),v.e("".concat(a," failed. error:"),e),C(e)})}},{key:"_get",value:function(e){return this._convM.get(e)}},{key:"_emitConvUpdate",value:function(){this._convM.emitConvUpdate(!0,!1)}},{key:"setAllRcvMsgOpt",value:function(e){var t="".concat(this._n,".").concat("setAllRcvMsgOpt"),n=e.messageRemindType,n=void 0===n?R.MSG_REMIND_ACPT_NOT_NOTE:n,o=e.isRepeated,o=void 0===o||o,i=this._calcStartAndEndTime(e),a=i.startTime,a=void 0===a?0:a,i=i.endTime,i=void 0===i?0:i,e=JSON.stringify(e),s=new M("setAllRcvMsgOpt");return s.setMessage(e),v.l("".concat(t," options:").concat(e)),this._convM.req({P:I.SET_ALL_RECEIVE_MSG_OPT,data:{messageRemindType:pi[n],startTime:a,endTime:i,isRepeated:o?1:0}}).then(function(e){return s.end(),v.l("".concat(t," ok.")),Sn(e)}).catch(function(e){return s.setError(e).end(),v.e("".concat(t," failed. error:"),e),C(e)})}},{key:"_calcStartAndEndTime",value:function(e){var t=e.startHour,t=void 0===t?0:t,n=e.startMinute,n=void 0===n?0:n,o=e.startSecond,o=void 0===o?0:o,i=e.duration,i=void 0===i?0:i,e=e.isRepeated,e=void 0===e||e,a=new Date,s=a.getFullYear(),r=a.getMonth(),a=a.getDate(),s=Math.round(new Date(s,r,a,t,n,o).getTime()/1e3);return{startTime:s,endTime:e&&86400<=i?s+86400:s+i}}},{key:"getAllRcvMsgOpt",value:function(){var t=this,n="".concat(this._n,".").concat("getAllRcvMsgOpt"),o=new M("getAllRcvMsgOpt");return this._convM.req({P:I.GET_ALL_RECEIVE_MSG_OPT,data:{toAccount:this._convM.getMyUserID()}}).then(function(e){e=e.data,o.setMessage(JSON.stringify(e)).end(),v.l("".concat(n," ok. data:").concat(JSON.stringify(e))),e=t._handleResult(e);return Sn(e)}).catch(function(e){return o.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"_handleResult",value:function(e){var t=e.messageRemindType,n=e.startTime,o=e.endTime,e=e.isRepeated,i=R.MSG_REMIND_ACPT_AND_NOTE;return 1===t&&(i=R.MSG_REMIND_DISCARD),{messageRemindType:i=2===t?R.MSG_REMIND_ACPT_NOT_NOTE:i,startTime:n,endTime:o,isRepeated:1===e}}},{key:"reset",value:function(){v.l("".concat(this._n,".reset"))}}]),sa),hi=(e(aa,[{key:"setConvCustomData",value:function(e){var i=this,a="".concat(this._n,".").concat("setConvCustomData"),t=e.conversationIDList,s=e.customData,r=(v.l("".concat(a," options:"),e),new M("setConvCustomData")),n=(r.setMessage(JSON.stringify(e)),{fromAccount:this._getMyUserID(),itemList:[]}),c=[],u=[];return t.forEach(function(e){if(!i._hasLocalConv(e))return i._onConvNotFound(u,e),!0;if(!At(e)&&!Ot(e))return i._onConvIDInvalid(u,e),!0;var t={operationType:2,contactItem:void 0,customMark:s};At(e)?t.contactItem={type:1,toAccount:e.replace(R.CONV_C2C,"")}:Ot(e)&&(t.contactItem={type:2,groupID:e.replace(R.CONV_GROUP,"")}),n.itemList.push(t)}),u.length===t.length?kn({successConversationIDList:c,failureConversationIDList:u}):this._convM.req({P:I.SET_CONV_CUSTOM_DATA,data:n}).then(function(e){r.end(),v.l("".concat(a," ok"));var t,n,o,e=e.data.resultItem;return nt(e)&&(o=!1,e.forEach(function(e){t=i._concatConvID(e.contactItem),0===e.resultCode?(c.push(t),(n=i._getLocalConv(t))&&n.customData!==s&&(n.customData=s,o=!0)):u.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===o&&i._emitConvUpdate()),Sn({successConversationIDList:c,failureConversationIDList:u})}).catch(function(e){return r.setError(e).end(),v.e("".concat(a," failed. error:"),e),C(e)})}},{key:"markConv",value:function(e){var a=this;if(!this._convM.canIUse(H.CONV_MARK))return this._convM.noUse("markConv");var t="".concat(this._n,".").concat("markConv"),n=e.conversationIDList,s=e.markType,r=e.enableMark,c=(v.l("".concat(t," options:"),e),new M("markConv")),o=(c.setMessage(JSON.stringify(e)),void 0),i=void 0,e=this._getFlagBit(s),d=(!0===r?i=[e]:o=[e],{fromAccount:this._getMyUserID(),itemList:[]}),u=[],l=[];return n.forEach(function(e){if(!a._hasLocalConv(e))return a._onConvNotFound(l,e),!0;if(!At(e)&&!Ot(e))return a._onConvIDInvalid(l,e),!0;var t={operationType:1,contactItem:void 0,clearMark:o,setMark:i};At(e)?t.contactItem={type:1,toAccount:e.replace(R.CONV_C2C,"")}:Ot(e)&&(t.contactItem={type:2,groupID:e.replace(R.CONV_GROUP,"")}),d.itemList.push(t)}),l.length===n.length?kn({successConversationIDList:u,failureConversationIDList:l}):this._convM.req({P:I.MARK_CONV,data:d}).then(function(e){c.end(),v.l("".concat(t," ok"));var n,o,i,e=e.data.resultItem;return nt(e)&&(i=!1,e.forEach(function(e){var t;n=a._concatConvID(e.contactItem),0===e.resultCode?(u.push(n),(o=a._getLocalConv(n))&&(t=o.markList.indexOf(s),!0===r?-1===t&&(o.markList.push(s),i=!0):-1!==t&&(o.markList.splice(t,1),i=!0))):l.push({conversationID:n,code:e.resultCode,message:e.resultInfo})}),!0===i&&a._emitConvUpdate()),Sn({successConversationIDList:u,failureConversationIDList:l})}).catch(function(e){return c.setError(e).end(),v.e("".concat(t," failed. error:"),e),C(e)})}},{key:"getLocalConvGroupList",value:function(){var e=this;return v.l("".concat(this._n,".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===bn?this.getRemoteConvGroupList().then(function(){return Sn(D(e._convGroupMap.values()))}):kn(D(this._convGroupMap.values()))}},{key:"searchConvGroupAndMark",value:function(e,t){var n=this,o="".concat(this._n,".searchConvGroupAndMark"),i=[];return e.forEach(function(e){1===t?i.push({type:1,toAccount:e}):2===t&&i.push({type:2,groupID:e})}),v.l("".concat(o," type:").concat(t," list:"),e),this._convM.req({P:I.SEARCH_CONV_GRP_MARK,data:{fromAccount:this._getMyUserID(),contactItem:i}}).then(function(e){var e=e.data,t=e.contactItem,e=e.groupItem;v.l("".concat(o," ok. contactItem:"),t,"groupItem:",e),n._fillConvGroupMap(e),n._handleContactItem(t),n._emitConvUpdate()}).catch(function(e){v.w("".concat(o," failed. error:"),e)})}},{key:"_fillConvGroupMap",value:function(e){var n=this;nt(e)&&e.forEach(function(e){var t=e.convGroupID,e=e.groupName;n._convGroupMap.set(t,e)})}},{key:"_handleContactItem",value:function(e){var a,s=this;nt(e)&&e.forEach(function(e){var t=[],n=e.standardMark,o=e.customData,i=e.convGroupIDList;nt(i)&&i.forEach(function(e){s._convGroupMap.has(e)&&t.push(s._convGroupMap.get(e))}),a=s._concatConvID(e),(a=s._getLocalConv(a))&&(a.markList=jt(n),a.customData=o||"",a.conversationGroupList=[].concat(t))})}},{key:"getRemoteConvGroupList",value:function(){var i=this,a="".concat(this._n,".getRemoteConvGroupList");return this._pagingStatus=Pn,this._convM.req({P:I.GET_CONV_GRP_LIST,data:{fromAccount:this._getMyUserID(),startIndex:this._startIndex}}).then(function(e){var e=e.data,t=e.completeFlag,n=e.contactItem,o=e.nextStartIndex,o=void 0===o?0:o,e=e.groupItem;if(i._startIndex=o,v.l("".concat(a," completeFlag:").concat(t," nextStartIndex:").concat(o,", groupItem:"),e,"contactItem:",n),i._fillConvGroupMap(e),i._handleContactItem(n),0===t)return i.getRemoteConvGroupList();1===t&&(i._pagingStatus=Un,i._emitConvUpdate(),i._emitConvGroupListUpdate())}).catch(function(e){i._pagingStatus=bn,v.w("".concat(a," failed. error:"),e)})}},{key:"createConvGroup",value:function(e){var a=this;if(!this._convM.canIUse(H.CONV_GROUP))return this._convM.noUse("createConvGroup");var s="".concat(this._n,".").concat("createConvGroup"),r=(v.l("".concat(s," options:"),e),new M("createConvGroup")),c=(r.setMessage(JSON.stringify(e)),e.groupName),e=e.conversationIDList,t={fromAccount:this._getMyUserID(),itemList:[{groupName:c,contactItem:[]}]},u=[],l=[];return e.forEach(function(e){return a._hasLocalConv(e)?At(e)||Ot(e)?void(At(e)?t.itemList[0].contactItem.push({type:1,toAccount:e.replace(R.CONV_C2C,"")}):Ot(e)&&t.itemList[0].contactItem.push({type:2,groupID:e.replace(R.CONV_GROUP,"")})):(a._onConvIDInvalid(l,e),!0):(a._onConvNotFound(l,e),!0)}),l.length===e.length?kn({successConversationIDList:u,failureConversationIDList:l}):this._convM.req({P:I.CREATE_CONV_GRP,data:t}).then(function(e){r.end(),v.l("".concat(s," ok"));var t,n,o,e=e.data.groupResultItem[0],i=e.groupItem,e=e.resultItem;return et(i)&&(a._convGroupMap.set(i.convGroupID,i.groupName),a._emitConvGroupListUpdate()),nt(e)&&(o=!1,e.forEach(function(e){t=a._concatConvID(e.contactItem),0===e.resultCode?(u.push(t),(n=a._getLocalConv(t))&&-1===n.conversationGroupList.indexOf(c)&&(n.conversationGroupList.push(c),o=!0)):l.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===o&&(a._emitConvUpdate(),a._emitConvGroupListUpdate())),Sn({successConversationIDList:u,failureConversationIDList:l})}).catch(function(e){return r.setError(e).end(),v.e("".concat(s," failed. error:"),e),C(e)})}},{key:"deleteConvGroup",value:function(n){var o=this;if(!this._convM.canIUse(H.CONV_GROUP))return this._convM.noUse("deleteConvGroup");var i="".concat(this._n,".").concat("deleteConvGroup"),a=(v.l("".concat(i," groupName:").concat(n)),new M("deleteConvGroup"));return a.setMessage(n),this._convM.req({P:I.DEL_CONV_GRP,data:{fromAccount:this._getMyUserID(),groupName:[n]}}).then(function(e){a.end(),v.l("".concat(i," ok"));var t,e=e.data.groupItem;nt(e)&&(t=!1,e.forEach(function(e){o._convGroupMap.has(e.convGroupID)&&(o._convGroupMap.delete(e.convGroupID),t=!0)}),!0===t&&o._emitConvGroupListUpdate()),o._eraseFromConversationGroupList([n])}).catch(function(e){return a.setError(e).end(),v.e("".concat(i," failed. error:"),e),C(e)})}},{key:"renameConvGroup",value:function(e){var i=this;if(!this._convM.canIUse(H.CONV_GROUP))return this._convM.noUse("renameConvGroup");var a="".concat(this._n,".").concat("renameConvGroup"),s=(v.l("".concat(a," options:"),e),new M("renameConvGroup")),r=(s.setMessage(JSON.stringify(e)),e.oldName),c=e.newName;return this._convM.req({P:I.RENAME_CONV_GRP,data:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:r,newName:c}}}).then(function(e){s.end(),v.l("".concat(a," ok"));e=e.data.updateGroupResult.convGroupID;i._convGroupMap.set(e,c),i._emitConvGroupListUpdate();var t,n,e=i._convM.getLocalConvList(),o=!1;e.forEach(function(e){t=e.conversationGroupList,-1!==(n=t.indexOf(r))&&(t.splice(n,1,c),o=!0)}),!0===o&&i._emitConvUpdate()}).catch(function(e){return s.setError(e).end(),v.e("".concat(a," failed. error:"),e),C(e)})}},{key:"addConvsToGroup",value:function(e){var i=this;if(!this._convM.canIUse(H.CONV_GROUP))return this._convM.noUse("addConvsToGroup");var a="".concat(this._n,".").concat("addConvsToGroup"),s=(v.l("".concat(a," options:"),e),new M("addConvsToGroup")),t=(s.setMessage(JSON.stringify(e)),e.conversationIDList),r=e.groupName,n={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:r,updateItem:[]}},c=[],u=[];return t.forEach(function(e){return i._hasLocalConv(e)?At(e)||Ot(e)?void(At(e)?n.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:e.replace(R.CONV_C2C,"")}}):Ot(e)&&n.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:e.replace(R.CONV_GROUP,"")}})):(i._onConvIDInvalid(u,e),!0):(i._onConvNotFound(u,e),!0)}),u.length===t.length?kn({successConversationIDList:c,failureConversationIDList:u}):this._convM.req({P:I.ADD_CONV_TO_GRP,data:n}).then(function(e){s.end(),v.l("".concat(a," ok"));var t,n,o,e=e.data.updateGroupResult.contactResultItem;return nt(e)&&(o=!1,e.forEach(function(e){t=i._concatConvID(e.contactItem),0===e.resultCode?(n=i._getLocalConv(t))&&-1===n.conversationGroupList.indexOf(r)&&(n.conversationGroupList.push(r),c.push(t),o=!0):u.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===o&&(i._emitConvUpdate(),i._emitConvInGroupUpdate(r))),Sn({successConversationIDList:c,failureConversationIDList:u})}).catch(function(e){return s.setError(e).end(),v.e("".concat(a," failed. error:"),e),C(e)})}},{key:"deleteConvsFromGroup",value:function(e){var a=this,t="deleteConvsFromGroup";if(!this._convM.canIUse(H.CONV_GROUP))return this._convM.noUse(t);var s="".concat(this._n,".").concat(t),r=(v.l("".concat(s," options:"),e),new M(t)),t=(r.setMessage(JSON.stringify(e)),e.conversationIDList),c=e.groupName,n={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:c,updateItem:[]}},u=[],l=[];return t.forEach(function(e){return a._hasLocalConv(e)?At(e)||Ot(e)?void(At(e)?n.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:e.replace(R.CONV_C2C,"")}}):Ot(e)&&n.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:e.replace(R.CONV_GROUP,"")}})):(a._onConvIDInvalid(l,e),!0):(a._onConvNotFound(l,e),!0)}),l.length===t.length?kn({successConversationIDList:u,failureConversationIDList:l}):this._convM.req({P:I.DEL_CONV_FROM_GRP,data:n}).then(function(e){r.end(),v.l("".concat(s," ok"));var n,o,i,e=e.data.updateGroupResult.contactResultItem;return nt(e)&&(i=!1,e.forEach(function(e){var t;n=a._concatConvID(e.contactItem),0===e.resultCode?!(o=a._getLocalConv(n))||-1!==(t=o.conversationGroupList.indexOf(c))&&(o.conversationGroupList.splice(t,1),u.push(n),i=!0):l.push({conversationID:n,code:e.resultCode,message:e.resultInfo})}),!0===i&&(a._emitConvUpdate(),a._emitConvInGroupUpdate(c))),Sn({successConversationIDList:u,failureConversationIDList:l})}).catch(function(e){return r.setError(e).end(),v.e("".concat(s," failed. error:"),e),C(e)})}},{key:"onConvMarkUpdated",value:function(e){var i,a,s=this;Je(e)||(v.l("".concat(this._n,".onConvMarkUpdated markItemList:"),e),a=!1,e.forEach(function(e){var t=e.recentContactItem,n=e.optType,o=e.standardMark,e=e.customMark;i=s._concatConvID(t),(i=s._getLocalConv(i))&&(1===n?a=s._diffStandardMark(i,o):2===n?a=s._diffCustomMark(i,e):3===n&&(t=s._diffStandardMark(i,o),n=s._diffCustomMark(i,e),a=t||n))}),!0===a&&this._emitConvUpdate())}},{key:"_diffStandardMark",value:function(e,t){var t=jt(t),n=!1;return!0!==function(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,o=e.length;n<o;n++)if(e[n]!==t[n])return!1;return!0}(e.markList,t)&&(e.markList=t,n=!0),n}},{key:"_diffCustomMark",value:function(e,t){var n=!1;return e.customData!==t&&void 0!==t&&(e.customData=t,n=!0),n}},{key:"onConvGroupCreated",value:function(e){var a=this,s=(v.l("".concat(this._n,".onConvGroupCreated resultList:"),e),!1),r=!1;nt(e)&&(e.forEach(function(e){var t=e.msgGroupItem,n=t.groupID,o=t.groupName;a._convGroupMap.get(n)!==o&&(a._convGroupMap.set(n,o),r=!0);var i,t=e.msgRecentContactItem;nt(t)&&t.forEach(function(e){i=a._concatConvID(e),(i=a._getLocalConv(i))&&-1===i.conversationGroupList.indexOf(o)&&(i.conversationGroupList.push(o),s=!0)})}),!0===s&&this._emitConvUpdate(),!0===r&&this._emitConvGroupListUpdate())}},{key:"onConvGroupDeleted",value:function(e){var n,o=this,i=(v.l("".concat(this._n,".onConvGroupDeleted groupItemList:"),e),[]);nt(e)&&(n=!1,e.forEach(function(e){var t=e.groupID,e=e.groupName;o._convGroupMap.has(t)&&(o._convGroupMap.delete(t),n=!0,i.push(e))}),!0===n&&this._emitConvGroupListUpdate()),this._eraseFromConversationGroupList(i)}},{key:"_eraseFromConversationGroupList",value:function(t){Je(t)||(this._convM.getLocalConvList().forEach(function(e){e.conversationGroupList=e.conversationGroupList.filter(function(e){return!t.includes(e)})}),this._emitConvUpdate())}},{key:"onConvGroupNameUpdated",value:function(e){v.l("".concat(this._n,".onConvGroupNameUpdated options:"),e);var t,n,o,i=e.groupID,a=e.groupName,s=e.oldGroupName;this._convGroupMap.get(i)!==a&&(this._convGroupMap.set(i,a),this._emitConvGroupListUpdate(),e=this._convM.getLocalConvList(),o=!1,e.forEach(function(e){t=e.conversationGroupList,-1!==(n=t.indexOf(s))&&(t.splice(n,1,a),o=!0)}),!0===o&&this._emitConvUpdate())}},{key:"onConvInGroupUpdated",value:function(e){var n,o,i,a=this,s=(v.l("".concat(this._n,".onConvInGroupUpdated options:"),e),e.oldGroupName),e=e.recentContactUpdateGroupItem;nt(e)&&(i=!1,e.forEach(function(e){var t=e.contactOptType,e=e.recentContactItem;n=a._concatConvID(e),(n=a._getLocalConv(n))&&(o=n.conversationGroupList.indexOf(s),1===t?-1===o&&(n.conversationGroupList.push(s),i=!0):2===t&&-1!==o&&(n.conversationGroupList.splice(o,1),i=!0))}),!0===i&&(this._emitConvUpdate(),this._emitConvInGroupUpdate(s)))}},{key:"onConvAddedToOrDeletedFromGroup",value:function(e){var n,o,i=this,t=(v.l("".concat(this._n,".onConvAddedToOrDeletedFromGroup options:"),e),e.msgRecentContactItem),e=e.msgRecentContactUpdateContactItem,t=this._concatConvID(t),a=this._getLocalConv(t);a&&nt(e)&&(o=!1,e.forEach(function(e){var t=e.groupOptType,e=e.recentContactGroupItem.groupName;n=a.conversationGroupList.indexOf(e),1===t?-1===n&&(a.conversationGroupList.push(e),o=!0):2===t&&-1!==n&&(a.conversationGroupList.splice(n,1),o=!0),!0===o&&i._emitConvInGroupUpdate(e)}),!0===o&&this._emitConvUpdate())}},{key:"onConvGroupListSynced",value:function(e){nt(e)&&0!==e.length&&(v.l("".concat(this._n,".onConvGroupListSynced groupItem:"),e),this._fillConvGroupMap(e))}},{key:"getConvGroupListByID",value:function(e){var t,n=this;if(!Je(e))return t=[],e.forEach(function(e){n._convGroupMap.has(e)&&t.push(n._convGroupMap.get(e))}),t}},{key:"_onConvNotFound",value:function(e,t){e.push({conversationID:t,code:T.CONV_NOT_FOUND,message:this._convM.getErrMsg(T.CONV_NOT_FOUND)})}},{key:"_onConvIDInvalid",value:function(e,t){e.push({conversationID:t,code:T.INVALID_CONV_ID,message:this._convM.getErrMsg(T.INVALID_CONV_ID)})}},{key:"_getFlagBit",value:function(e){for(var t=e.toString(2),n=t.length,o=n-1;0<=o;o--)if("1"===t[o])return n-o-1}},{key:"_concatConvID",value:function(e){var t,n=e.type,o=e.to,i=e.groupID,e=e.userID;return 1===n?A(e)?A(o)||(t="".concat(R.CONV_C2C).concat(o)):t="".concat(R.CONV_C2C).concat(e):2===n&&(t="".concat(R.CONV_GROUP).concat(i)),t}},{key:"_getMyUserID",value:function(){return this._convM.getMyUserID()}},{key:"_getLocalConv",value:function(e){return this._convM.getLocalConversation(e)}},{key:"_hasLocalConv",value:function(e){return this._convM.hasLocalConversation(e)}},{key:"_emitConvUpdate",value:function(){this._convM.emitConvUpdate(!0,!1)}},{key:"_emitConvGroupListUpdate",value:function(){this._convM.emitOEvt(G.CONVERSATION_GROUP_LIST_UPDATED,D(this._convGroupMap.values()))}},{key:"_emitConvInGroupUpdate",value:function(t){var e={groupName:t,conversationList:[]},n=this._convM.getLocalConvList();e.conversationList=n.filter(function(e){return e.conversationGroupList.includes(t)}),this._convM.emitOEvt(G.CONVERSATION_IN_GROUP_UPDATED,e)}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=Gn}}]),aa),gi=(t(ia,Fn),ii=f(ia),e(ia,[{key:"_initListeners",value:function(){var e=this.getIEmitInst();e.on(Wo.A2KEY_AND_TINYID_UPDATED,this._init,this),e.on(Wo.PROFILE_UPDATED,this._onProfileUpdated,this),e.on(Wo.CLOUD_CONFIG,this._onCloudConfig,this)}},{key:"_init",value:function(){var e=this,t=(v.l("".concat(this._n,"._init")),this.get(13).getItem("conversationMap")),n=this.isIntl(),o=this.isUsingChatCore();if(t){for(var i=t.length,a=0;a<i;a++){var s=t[a];if(s){if(this._isNonExistentAccount(s.conversationID))continue;if(s.groupProfile&&St(s.groupProfile.type))continue}this._convMap.set(s.conversationID,new di(t[a],n,o))}this.emitConvUpdate(!0,!1)}this.ready(function(){0<e._tmpGroupList.length&&(e.updateConvGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)}),this.syncConvList()}},{key:"_isNonExistentAccount",value:function(e){var t;return"@TLS#ERROR"===(t=e.startsWith(R.CONV_C2C)?e.replace(R.CONV_C2C,""):t)||"@TLS#NOT_FOUND"===t}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&this._msgListHandler.onCheckTimer(e)}},{key:"onMessageSent",value:function(e){this._onSendOrRcvMsg({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:"onNewMessage",value:function(e){this._onSendOrRcvMsg(e)}},{key:"_onSendOrRcvMsg",value:function(e){var t=this,n=e.conversationOptionsList,o=e.isInstantMessage,o=void 0===o||o,i=e.isUnreadC2CMessage,i=void 0!==i&&i,a=e.updateUnreadCount,a=void 0===a||a,s=e.isSyncingEnded,s=void 0!==s&&s;this._isReady?0!==n.length?(!0===o&&this._checkNewConv(n),this._updateLocalConvList({conversationOptionsList:n,isInstantMessage:o,isUnreadC2CMessage:i,isFromGetConversations:!1,updateUnreadCount:a}),o||(this._convIDFromUnreadDBMap=new Map([].concat(D(this._convIDFromUnreadDBMap),D(n.map(function(e){return[e.conversationID,1]})))),this._diffAndDeleteConv(),s&&this.emitIEvt(Wo.C2C_UNREAD_HANDLE_COMPLETED)),0<n.filter(function(e){return!t._isConvNeedShow(e.conversationID)}).length||this.emitConvUpdate()):s&&this.emitIEvt(Wo.C2C_UNREAD_HANDLE_COMPLETED):this.ready(function(){t._onSendOrRcvMsg(e)})}},{key:"updateConvGroupProfile",value:function(e){var n,o=this;nt(e)&&0===e.length||(0!==this._convMap.size?(n=!1,e.forEach(function(e){var t="".concat(R.CONV_GROUP).concat(e.groupID);o._convMap.has(t)&&(n=!0,(t=o._convMap.get(t)).groupProfile=JSON.parse(JSON.stringify(e)),t.lastMessage.lastSequence<e.nextMessageSeq&&(t.lastMessage.lastSequence=e.nextMessageSeq-1),t.subType||(t.subType=e.type))}),n&&this.emitConvUpdate(!0,!1)):this._tmpGroupList=e)}},{key:"onMessageRevoked",value:function(e,t){var n,o,i,a=this;0!==e.length&&(n=null,o=!1,i=[],e.forEach(function(e){(n=a._convMap.get(e.conversationID))&&(t&&n.reduceUnreadCount()&&(o=n.type!==R.CONV_TOPIC),n.type===R.CONV_TOPIC?i.push(e):n.isLastMessageRevoked({sequence:e.sequence,time:e.time})&&(n.setLastMessageRevoked(!0),n.setLastMessageRevoker(e.revoker),o=!0))}),this.get(10).onMessageRevoked(i),o&&this.emitConvUpdate(!0,!1))}},{key:"updateRevokerInfo",value:function(u){for(var e=new Set,t=0;t<u.length;t++){var n=u[t].revoker;e.add(n)}var o=D(e),i=this.get(4);return new Promise(function(c){i.getUserProfile({userIDList:o}).then(function(e){e=e.data;if(!nt(e)||0===e.length)return c(u);var t,n={},o=N(e);try{for(o.s();!(t=o.n()).done;){var i=t.value,a=i.userID,s=i.nick,r=i.avatar;n[a]={nick:s,avatar:r}}}catch(e){o.e(e)}finally{o.f()}u.forEach(function(e){var t=e.revoker;n[t]&&(e.revokerInfo.nick=n[t].nick||"",e.revokerInfo.avatar=n[t].avatar||"")}),c(u)}).catch(function(){c(u)})})}},{key:"isLastMessageRevoked",value:function(e){var t=!1,n=e.conversationID,o=e.sequence,i=e.time,a=this._convMap.get(n);return a&&(t=a.type===R.CONV_TOPIC?this.get(10).isLastMessageRevoked({topicID:n.replace(R.CONV_GROUP,""),sequence:o}):a.isLastMessageRevoked({sequence:o,time:i})),v.l("".concat(this._n,".isLastMessageRevoked options:"),e,"ret:".concat(t)),t}},{key:"onMessageDeleted",value:function(e){var t=this;if(0!==e.length){var n=null;e.forEach(function(e){(n=t._msgListHandler.getLocalMsg(e.conversationID,e.ID))&&(n.isDeleted=!0),e!==n&&(e.isDeleted=!0)});for(var e=e[0].conversationID,o=this._msgListHandler.getLocalMsgList(e),i={},a=o.length-1;0<=a;a--)if(!o[a].isDeleted){i=o[a];break}var s,r=this._convMap.get(e);r&&(s=!1,r.lastMessage.lastSequence===i.sequence&&r.lastMessage.lastTime===i.time||(Je(i)&&(i=void 0),r.updateLastMessage(i),r.type!==R.CONV_TOPIC&&(s=!0),v.l("".concat(this._n,".onMessageDeleted. update convID:").concat(e," with lastMessage:"),r.lastMessage)),e.startsWith(R.CONV_C2C)&&this.updateUnreadCount(e),s&&this.emitConvUpdate(!0,!1))}}},{key:"onMessageModified",value:function(e){var t="".concat(this._n,".onMessageModified"),n=e.conversationType,o=e.from,i=e.to,l=e.time,d=e.sequence,a=e.elements,p=e.cloudCustomData,s=e.messageVersion,r=this.getMyUserID(),c="".concat(n).concat(i),r=(i===r&&n===R.CONV_C2C&&(c="".concat(n).concat(o)),this._msgListHandler.onMsgModified(c,e)),n=r.isUpdated,r=r.message,u=(!0===n&&this.emitOEvt(G.MESSAGE_MODIFIED,[r]),this._isTopicConv(c));return null===r?v.l("".concat(t," message is null! options:"),e):v.l("".concat(t," isUpdated:").concat(n," isTopicMessage:").concat(u," from:").concat(o," to:").concat(i," sequence:").concat(r.sequence," time:").concat(r.time)),u?this.get(10).onMessageModified(e):!(n=this._convMap.get(c))||(o=n.lastMessage)&&o.lastTime===l&&o.lastSequence===d&&o.version!==s&&(v.l("".concat(t," convID:").concat(c," lastMessage updated")),o.type=a[0].type,o.payload=a[0].content,o.messageForShow=Yt(o.type,o.payload,this.isIntl()),o.cloudCustomData=p,o.version=s,this.emitConvUpdate(!0,!1)),r}},{key:"onNewGroupAtTips",value:function(e){var t=this,e=e.dataList,n=null;e.forEach(function(e){e.groupAtTips?n=e.groupAtTips:e.elements?n=y(y({},e.elements),{},{sync:!0}):e.groupAtType&&(n=y(y({},e),{},{sync:!0})),n.__random=e.random,n.__sequence=e.clientSequence,t._tmpGroupAtTipsList.push(n)}),v.l("".concat(this._n,".onNewGroupAtTips isReady:").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var a,s=this;0!==this._tmpGroupAtTipsList.length&&(a=!1,this._tmpGroupAtTipsList.forEach(function(e){var t=e.groupID,n=e.from,o=e.topicID,o=void 0===o?void 0:o,i=e.sync,i=void 0!==i&&i;n!==s.getMyUserID()&&(A(o)?(n=s._convMap.get("".concat(R.CONV_GROUP).concat(t)))&&(n.updateGroupAtInfoList(e),a=!0):((t=s._convMap.get("".concat(R.CONV_GROUP).concat(o)))&&(t.updateGroupAtInfoList(e),s.get(10).onAtInfoUpdated({topicID:o,groupAtInfoList:t.groupAtInfoList})),Je(t)&&i&&(s.updateTopicConversation([{conversationID:"".concat(R.CONV_GROUP).concat(o),type:R.CONV_TOPIC}]),s._convMap.get("".concat(R.CONV_GROUP).concat(o)).updateGroupAtInfoList(e))))}),a&&this.emitConvUpdate(!0,!1),this._tmpGroupAtTipsList.length=0)}},{key:"_checkNewConv",value:function(e){var t=this,n=[],o=[];e.forEach(function(e){t._convMap.has(e.conversationID)||(e.type===R.CONV_C2C?n.push(e.conversationID.replace(R.CONV_C2C,"")):e.type===R.CONV_GROUP&&o.push(e.conversationID.replace(R.CONV_GROUP,"")))}),0<n.length&&(this._onNewC2CConv(n),n=null),0<o.length&&(this._onNewGroupConv(o),o=null)}},{key:"_onNewC2CConv",value:function(e){var t=this.get(6);return Promise.all([t.getRemotePeerReadTime(e),this._msgRemindHandler.getC2CMsgRemindType(e),this._convGroupHandler.searchConvGroupAndMark(e,1)])}},{key:"_onNewGroupConv",value:function(e){var t=this.get(7);return t?Promise.all([t.getMsgRemindType(e),this._convGroupHandler.searchConvGroupAndMark(e,2)]):Promise.resolve()}},{key:"_setStorageConvList",value:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=this.getLocalConvList().filter(function(e){return e.type===R.CONV_C2C||e.type===R.CONV_GROUP&&e.lastMessage.type!==R.MSG_GRP_TIP}).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.get(13).setItem("conversationMap",t,e)}},{key:"emitConvUpdate",value:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this.getLocalConvList();!t||(t=this.get(7))&&t.updateGroupLastMessage(n),e&&(this.get(12).isPartialUpdatedConvs()?(this._diffConvMap(this._convMapForDiff,this._convMap),0<this._partialUpdatedConvMap.size&&(this.emitOEvt(G.CONVERSATION_LIST_UPDATED),this.onTotalUnreadCountUpdate(),this._convMapForDiff.clear(),this._convMapForDiff=ct(this._convMap,!0)),0===this._convMapForDiff.size&&(this._convMapForDiff=ct(this._convMap,!0))):(this.emitOEvt(G.CONVERSATION_LIST_UPDATED),this.onTotalUnreadCountUpdate()))}},{key:"_diffConvMap",value:function(e,t){var n,o=N(t);try{for(o.s();!(n=o.n()).done;){var i=m(n.value,2),a=i[0],s=i[1];e.has(a)&&JSON.stringify(s)===e.get(a)||this._partialUpdatedConvMap.set(a,s)}}catch(e){o.e(e)}finally{o.f()}}},{key:"getPartialUpdatedConvs",value:function(){var e=D(ct(this._partialUpdatedConvMap,!1).values());return this._partialUpdatedConvMap.clear(),e}},{key:"getLocalConvList",value:function(){var t=this;return D(this._convMap.values()).filter(function(e){return t._isConvNeedShow(e.conversationID)})}},{key:"getLocalConversation",value:function(e){return this._convMap.get(e)}},{key:"hasLocalConversation",value:function(e){return this._convMap.has(e)}},{key:"getLocalOldestMessage",value:function(e){return this._msgListHandler.getLocalOldestMsg(e)}},{key:"syncConvList",value:function(){var o=this,e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],i="syncConvList",a=new M(i);return this._pagingStatus===Gn&&this._convMap.clear(),this._pagingGetConvList(e).then(function(e){var t=Zt(o._pagingGetCostList),n=Xt(o._pagingGetCostList),n=(o._pagingGetCostList.length=0,o._pagingStatus=Un,o._diffAndDeleteConv(),o.emitConvUpdate(!0,!1),o._setStorageConvList(),o._handleC2CPeerReadTime(),o.emitIEvt(Wo.CONV_SYNC_COMPLETED),"count:".concat(o._convMap.size," sum:").concat(n," avg:").concat(t));return v.l("".concat(o._n,".").concat(i,". ").concat(n)),a.setMessage(n).end(),e}).catch(function(e){return o._pagingStatus=bn,a.setMessage(o._pagingTs).setError(e).end(),C(e)})}},{key:"_diffAndDeleteConv",value:function(){var n,o=this;this._isSyncCompleted()&&(n=[],this._convMap.forEach(function(e,t){!o._pagingConvIDMap.has(t)&&o._convIDFromUnreadDBMap.has(t)&&(o._convMap.delete(t),n.push(t))}),v.l("".concat(this._n,"._diffAndDeleteConv list:").concat(n)),n=null)}},{key:"_pagingGetConvList",value:function(){var r=this,e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],c="".concat(this._n,"._pagingGetConvList"),u=(v.l("".concat(c," incrementalPullFlag:").concat(e," ts:").concat(this._pagingTs," startIdx:").concat(this._pagingStartIdx)+" pinnedTs:".concat(this._pagingPinnedTs," pinnedStartIdx:").concat(this._pagingPinnedStartIdx)),Date.now());return this._pagingStatus=Pn,this.req({P:I.PAGING_GET_CONV_LIST,data:{fromAccount:this.getMyUserID(),timeStamp:e?this._pagingTs:0,startIndex:e?this._pagingStartIdx:0,pinnedTimeStamp:e?this._pagingPinnedTs:0,pinnedStartIndex:e?this._pagingPinnedStartIdx:0,orderType:1}}).then(function(e){var e=e.data,t=e.completeFlag,n=e.conversations,n=void 0===n?[]:n,o=e.timeStamp,i=e.startIndex,a=e.pinnedTimeStamp,s=e.pinnedStartIndex,e=e.groupItem;if(r._pagingGetCostList.push(Qt(u,!1)),v.l("".concat(c," ok. completeFlag:").concat(t," count:").concat(n.length," cost:").concat(Qt(u))),r._convGroupHandler.onConvGroupListSynced(e),0<n.length&&(e=r._getConvOptions(n),r._pagingConvIDMap=new Map([].concat(D(r._pagingConvIDMap),D(e.map(function(e){return[e.conversationID,1]})))),r._updateLocalConvList({conversationOptionsList:e,isFromGetConversations:!0,updateUnreadCount:!0}),r.isLoggedIn()&&r.emitConvUpdate()),!r._isReady){if(!r.isLoggedIn())return kn();r.triggerReady()}return r._pagingTs=o,r._pagingStartIdx=i,r._pagingPinnedTs=a,r._pagingPinnedStartIdx=s,1!==t?r._pagingGetConvList():(r._handleGroupAtTipsList(),r._convGroupHandler.getRemoteConvGroupList(),kn())}).catch(function(e){throw r.isLoggedIn()&&(r._isReady||(v.w("".concat(c," failed. error:"),e),r.triggerReady())),e})}},{key:"_updateLocalConvList",value:function(e){var t=e.isFromGetConversations,n=Date.now(),e=this._getTmpConvListMapping(e).newConvList;this._convMap=new Map(this._sortConvList(D(this._convMap))),t||this._updateUserOrGroupProfile(e),v.l("".concat(this._n,"._updateLocalConvList cost:").concat(Qt(n)))}},{key:"_getTmpConvListMapping",value:function(e){for(var t=e.conversationOptionsList,l=e.isFromGetConversations,d=e.isInstantMessage,p=e.isUnreadC2CMessage,_=void 0!==p&&p,h=e.updateUnreadCount,g=[],f=[],m=this.get(7),v=this.get(8),I=this.isIntl(),M=this.isUsingChatCore(),n=0,y=t.length;n<y;n++){var o=new di(t[n],I,M),i=o.conversationID,a=o.type;if(!this._isNonExistentAccount(i)){if(this._convMap.has(i)){var s=this._convMap.get(i);if(l&&a!==R.CONV_TOPIC){this._convMap.set(i,o),a===R.CONV_C2C?o.unreadCount=s.unreadCount:a===R.CONV_GROUP&&(o.groupProfile=JSON.parse(JSON.stringify(s.groupProfile)));continue}var r=["unreadCount","allowType","adminForbidType","payload"],c=(!1===d&&r.push("lastMessage"),"boolean"==typeof d&&r.push("isPinned"),t[n].lastMessage),u=!A(c);u||t[n].type===R.CONV_TOPIC||this._onLastMsgNotExist(t[n]),A(d)&&u&&null===s.lastMessage.payload&&(s.lastMessage.payload=c.payload),Je(s.lastMessage.revoker)||(s.lastMessage.revoker=null),rt(s,o,r,[null,void 0,"",0,NaN]),!0===h&&s.updateUnreadCount({nextUnreadCount:o.unreadCount,isFromGetConversations:l,isUnreadC2CMessage:_}),d&&u&&(c.payload&&(s.lastMessage.payload=c.payload),s.type===R.CONV_GROUP&&(s.lastMessage.nameCard=c.nameCard,s.lastMessage.nick=c.nick)),u&&s.lastMessage.cloudCustomData!==c.cloudCustomData&&(s.lastMessage.cloudCustomData=c.cloudCustomData||"")}else a===R.CONV_GROUP&&m?(r=o.groupProfile.groupID,(u=m.getLocalGroupProfile(r))&&(o.groupProfile=u,!0===h&&o.updateUnreadCount({nextUnreadCount:0}))):a===R.CONV_C2C&&(s=i.replace(R.CONV_C2C,""),v&&v.isMyFriend(s)&&(o.remark=v.getFriendRemark(s))),g.push(o),this._convMap.set(i,o);this._convMap.get(i).type===R.CONV_TOPIC&&f.push(this._convMap.get(i))}}for(var C=this.get(10),T=0,D=f.length;T<D;T++){var E=f[T],L=E.conversationID,E=E.groupAtInfoList;Je(E)||C.onAtInfoUpdated({topicID:L.replace(R.CONV_GROUP,""),groupAtInfoList:E})}return{newConvList:g}}},{key:"_onLastMsgNotExist",value:function(e){new M("lastMsgNotExist").setMessage(JSON.stringify(e)).end()}},{key:"_sortConvList",value:function(e){var t=[],n=[],o=[],i=[];return e.forEach(function(e){(!0===e[1].isPinned?Je(e[1].lastMessage.lastTime)?n:t:Je(e[1].lastMessage.lastTime)?i:o).push(e)}),t.sort(function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime}).concat(n).concat(o.sort(function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})).concat(i)}},{key:"_sortConvListAndEmitEvent",value:function(){this._convMap=new Map(this._sortConvList(D(this._convMap))),this.emitConvUpdate(!0,!1)}},{key:"_updateUserOrGroupProfile",value:function(e){var n,o,t,i,a=this;0!==e.length&&(n=[],o=[],t=this.get(4),i=this.get(7),e.forEach(function(e){var t;e.type===R.CONV_C2C?n.push(e.toAccount):e.type===R.CONV_GROUP&&(t=e.toAccount,i.hasLocalGroup(t)?e.groupProfile=i.getLocalGroupProfile(t):o.push(t))}),v.l("".concat(this._n,"._updateUserOrGroupProfile userIDList:").concat(n," groupIDList:").concat(o)),0<n.length&&t.getUserProfile({userIDList:n}).then(function(e){e=e.data;nt(e)?e.forEach(function(e){a._doUpdateUserProfile("".concat(R.CONV_C2C).concat(e.userID),e)}):a._doUpdateUserProfile("".concat(R.CONV_C2C).concat(e.userID),e)}),0<o.length&&i.getGroupProfileAdvance({groupIDList:o,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then(function(e){var e=e.data.successGroupList,n=!1;e.forEach(function(e){var t="".concat(R.CONV_GROUP).concat(e.groupID);a._convMap.has(t)&&(t=a._convMap.get(t),rt(t.groupProfile,e,[],[null,void 0,"",0,NaN]),!t.subType&&e.type&&(t.subType=e.type),n=!0)}),n&&a.emitConvUpdate()}))}},{key:"_doUpdateUserProfile",value:function(e,t){this.hasLocalConversation(e)&&(this.getLocalConversation(e).userProfile=t,this.emitConvUpdate())}},{key:"_getConvOptions",value:function(e){var n=this,o=[],e=e.filter(function(e){var t=e.type,e=e.userID;return 1===t&&!n._isNonExistentAccount(e)||2===t}),i=this.getMyUserID(),e=e.map(function(e){var t;return A(e.lastMsg)&&(e.lastMsg={elements:[]}),1===e.type?(t={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar},o.push(t),{conversationID:"".concat(R.CONV_C2C).concat(e.userID),type:R.CONV_C2C,lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?n._amendLayersOverLimitProp(e.lastMsg.elements[0].content):null,cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:e.lastC2CMsgFromAccount===i&&e.time<=e.c2cPeerReadTime,revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},unreadCount:0,userProfile:new ri(t),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,customData:e.customMark||"",markList:jt(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId),remark:e.friendRemark||"",messageRemindType:n._transMsgRemindType(e.messageRemindType)}):{conversationID:"".concat(R.CONV_GROUP).concat(e.groupID),type:R.CONV_GROUP,lastMessage:y(y({lastTime:e.time,lastSequence:e.sequence,fromAccount:e.msgGroupFromAccount},n._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||"",nameCard:e.senderNameCard||"",revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null}),groupProfile:new li({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage,type:e.groupType,nextMessageSeq:e.nextMessageSeq}),unreadCount:n._computeGroupUnreadCount(e),peerReadTime:0,isPinned:1===e.isPinned,version:0,customData:e.customMark||"",markList:jt(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId),messageRemindType:n._transMsgRemindType(e.messageRemindType)}});return 0<o.length&&this.get(4).onConvProfileUpdated(o),e}},{key:"_transMsgRemindType",value:function(e){var t="";return 0===e?t=R.MSG_REMIND_ACPT_AND_NOTE:1===e?t=R.MSG_REMIND_DISCARD:2===e?t=R.MSG_REMIND_ACPT_NOT_NOTE:3===e&&(t=R.NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT),t}},{key:"_computeGroupUnreadCount",value:function(e){var t=e.unreadCount,e=e.noUnreadCount,t=(void 0===t?0:t)-(void 0===e?0:e);return 0<t?t:0}},{key:"_patchTypeAndPayload",value:function(e){var e=e.lastMsg,t=e.event,n=e.elements,n=void 0===n?[]:n,e=e.groupTips,e=void 0===e?{}:e;return A(void 0===t?void 0:t)||Je(e)?{type:n[0]?n[0].type:null,payload:n[0]?this._amendLayersOverLimitProp(n[0].content):null}:((t=new Ro(e)).setElement({type:R.MSG_GRP_TIP,content:y(y({},e.elements),{},{groupProfile:e.groupProfile})}),n=JSON.parse(JSON.stringify(t.payload)),t=null,{type:R.MSG_GRP_TIP,payload:n})}},{key:"_amendLayersOverLimitProp",value:function(e){var t=e.layersOverLimit;return 0===t?e.layersOverLimit=!1:1===t&&(e.layersOverLimit=!0),e}},{key:"getLocalMessageList",value:function(e){return this._msgListHandler.getLocalMsgList(e)}},{key:"deleteLocalMessage",value:function(e){e instanceof Ro&&this._msgListHandler.remove(e)}},{key:"onConvDeleted",value:function(e){nt(e)&&(e=e.map(function(e){var t=e.type,n=e.userID,e=e.groupID;return 1===t?"".concat(R.CONV_C2C).concat(n):2===t?"".concat(R.CONV_GROUP).concat(e):void 0}),v.l("".concat(this._n,".onConvDeleted convIDList:").concat(e)),this.deleteLocalConvList(e))}},{key:"onConvPinnedStatus",value:function(e,i){var a,s=this;nt(e)&&(a=!1,e.forEach(function(e){var t,n=e.type,o=e.userID,e=e.groupID;1===n?t=s.getLocalConversation("".concat(R.CONV_C2C).concat(o)):2===n&&(t=s.getLocalConversation("".concat(R.CONV_GROUP).concat(e))),t&&(v.l("".concat(s._n,".onConvPinnedStatus convID:").concat(t.conversationID," localPinned:").concat(t.isPinned," remotePinned:").concat(i)),i?t.isPinned||(t.isPinned=!0,a=!0):t.isPinned&&(t.isPinned=!1,a=!0))}),a&&this._sortConvListAndEmitEvent())}},{key:"getMessageList",value:function(e){var r=this,c=e.conversationID,t=e.nextReqMessageID,e=e.count,u="".concat(this._n,".getMessageList"),n=this.getLocalConversation(c),o="";if(n&&n.groupProfile&&(o=n.groupProfile.type),St(o))return v.l("".concat(u," not available in ").concat(o,". convID:").concat(c)),kn({messageList:[],nextReqMessageID:"",isCompleted:!0});(A(e)||15<e)&&(e=15),t||this._isMeInCommunity(c)||this.clearMemMsg(c);var l=this._computeRemainingCount({conversationID:c,nextReqMessageID:t}),n=this._completedMap.has(c);if(v.l("".concat(u," convID:").concat(c," isEverCleared:").concat(this._isEverCleared(c)," nextReqMessageID:").concat(t)+" remainingCount:".concat(l," count:").concat(e," isCompleted:").concat(n)),this._needGetHistory({conversationID:c,remainingCount:l,count:e}))return this.getHistoryMessages({conversationID:c,nextReqMessageID:t,count:20}).then(function(e){var t=e.nextReqID,n=e.storedMessageList,o=e.assembledMessageList,e=e.isPullingCompleted,i=r._completedMap.has(c),a=n,s=(0<l&&(a=r._msgListHandler.getLocalMsgList(c).slice(0,n.length+l)),{nextReqMessageID:void 0,messageList:void 0,isCompleted:void 0}),n=(r._isEverCleared(c)?(s.nextReqMessageID=t,s.messageList=o,s.isCompleted=e):(s.nextReqMessageID=i?"":t,s.messageList=a,s.isCompleted=i),s.messageList.filter(function(e){return e.isRevoked})||[]),o=s.messageList.map(function(e){return e.sequence});return v.l("".concat(u," ret.nextReqMessageID:").concat(s.nextReqMessageID," ret.isCompleted:").concat(s.isCompleted," sequenceList:"),o),nt(n)&&0!==n.length?r.updateRevokerInfo(n).then(function(e){return e.forEach(function(t){var n=t.revokerInfo;s.messageList=s.messageList.map(function(e){return e.ID===t.ID&&n&&(e.revokeReason=n.reason||"",e.revokerInfo={userID:n.revoker||e.revoker,nick:n.nick,avatar:n.avatar}),e})}),Sn(s)}):Sn(s)});this.modifyMessageList(c);o=this._getMsgListFromMem({conversationID:c,nextReqMessageID:t,count:e});return kn(o)}},{key:"_isEverCleared",value:function(e){return this._everClearedMap.has(e)}},{key:"_getMsgListFromMem",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,e=e.count,o="".concat(this._n,"._getMsgListFromMem"),i=this._msgListHandler.getLocalMsgList(t),a=i.length,s=At(t),r=0,c={isCompleted:!1,nextReqMessageID:"",messageList:[]},e=(n?(r=s?i.findIndex(function(e){return e.ID===n}):i.findIndex(function(e){return e.sequence+""===n}))>e?(c.messageList=i.slice(r-e,r),c.nextReqMessageID=s?i[r-e].ID:i[r-e].sequence+""):(c.messageList=i.slice(0,r),c.isCompleted=!0):e<a?(c.messageList=i.slice(r=a-e,a),c.nextReqMessageID=s?i[r].ID:i[r].sequence+""):(c.messageList=i.slice(0,a),c.isCompleted=!0),c.messageList.map(function(e){return e.sequence}));return v.l("".concat(o," convID:").concat(t)+" ret.nextReqMessageID:".concat(c.nextReqMessageID," ret.isCompleted:").concat(c.isCompleted," sequenceList:").concat(e)),c}},{key:"getMessageListHopping",value:function(e){var t,n,o=e.conversationID,i=e.sequence,a=e.time,s=e.count,e=e.direction,e=void 0===e?0:e;return(A(s)||15<s)&&(s=15),o.startsWith(R.CONV_C2C)?(t=this.get(6),n=o.replace(R.CONV_C2C,""),t.getRoamingMessagesHopping({peerAccount:n,time:a,count:s,direction:e})):o.startsWith(R.CONV_GROUP)?(t=this.get(7),n=o.replace(R.CONV_GROUP,""),t.getRoamingMessagesHopping({groupID:n,sequence:i,count:s,direction:e})):void 0}},{key:"_computeRemainingCount",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,e=this._msgListHandler.getLocalMsgList(t),o=e.length;if(v.l("".concat(this._n,"._computeRemainingCount convID:").concat(t," nextReqMessageID:").concat(n," length:").concat(o)),!n)return o;o=0;return At(t)?o=e.findIndex(function(e){return e.ID===n}):Ot(t)&&(o=-1!==n.indexOf("-")?e.findIndex(function(e){return e.ID===n}):e.findIndex(function(e){return e.sequence+""===n})),o=-1===o?0:o}},{key:"_needGetHistory",value:function(e){var t=e.conversationID,n=e.remainingCount,e=e.count,o=this.getLocalConversation(t),i="";if(o&&o.groupProfile&&(i=o.groupProfile.type),Nt(t)||St(i))return!1;if(this._isEverCleared(t))return!0;o=n<=e&&!this._completedMap.has(t);return v.l("".concat(this._n,"._needGetHistory convID:").concat(t," ret:").concat(o)),o}},{key:"_isTopicConv",value:function(e){e=e.replace(R.CONV_GROUP,"");return Rt(e)}},{key:"getHistoryMessages",value:function(e){var t=e.conversationID,n=e.count,e=e.nextReqMessageID;if(t===R.CONV_SYSTEM)return kn();var o,i,a=15,n=(20<n&&(a=20),null);if(At(t))return c=0,o="",i=!1,r=this._roamingMsgKeyAndTimeMap.has(t),e&&(i=!0,r?(c=this._roamingMsgKeyAndTimeMap.get(t).lastMessageTime,o=this._roamingMsgKeyAndTimeMap.get(t).messageKey):(s=this._msgListHandler.findMessage(e))&&(c=s.time,v.l("".concat(this._n,".getHistoryMessages convID:").concat(t," isRelayInfoExisted:").concat(r," lastMessageTime:").concat(c)))),(n=this.get(6)).getRoamingMessage({conversationID:t,peerAccount:t.replace(R.CONV_C2C,""),count:a,lastMessageTime:i?c:0,messageKey:i?o:""});if(Ot(t)){if(!(n=this.get(7)))return C({code:T.NO_MODULE});var s=t.replace(R.CONV_GROUP,""),r=null,c=(this._convMap.has(t)&&!Rt(s)&&(r=this._convMap.get(t).lastMessage),0);return e?c=Number(e):r&&(c=r.lastSequence),n.getRoamingMessage({conversationID:t,groupID:s,count:a,sequence:c})}return kn()}},{key:"patchConvLastMessage",value:function(e){var t,n,o=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=this.getLocalConversation(e);i&&(t=(n=i.lastMessage).messageForShow,n=n.payload,!(Je(t)||Je(n)||o)||0!==(t=this._msgListHandler.getLocalMsgList(e)).length&&(n=t[t.length-1],v.l("".concat(this._n,".patchConvLastMessage bForceUpdate:").concat(o," convID:").concat(e," payload:"),n.payload),i.updateLastMessage(n)))}},{key:"onRoamingMessage",value:function(){for(var e,t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],o=1<arguments.length?arguments[1]:void 0,u=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],l=3<arguments.length?arguments[3]:void 0,i=o.startsWith(R.CONV_C2C)?R.CONV_C2C:R.CONV_GROUP,a=null,s=[],o=[],r=0,d=n.length,c=i===R.CONV_GROUP,p=this.getFileDownloadProxy(),_=this.getDowloadFileAuthKey(),h=nt(l),g=this.get(17).getFileDNList(),f=function(){c?--r:++r},m=function(){return c?d<=r:r<d},r=c?n.length-1:0,d=c?0:n.length;m();f())1!==n[r].isPlaceMessage&&((a=new Ro(n[r])).to=n[r].to,i!==R.CONV_GROUP||A(n[r].topicID)||(a.to=n[r].topicID),a.isSystemMessage=!!n[r].isSystemMessage,a.conversationType=i,e=4===n[r].event?{type:R.MSG_GRP_TIP,content:y(y({},n[r].elements),{},{groupProfile:n[r].groupProfile})}:n[r].elements,c||a.setNickAndAvatar({nick:n[r].nick,avatar:n[r].avatar}),Je(e)?((t=new M("emptyMessageBody")).setMessage("from:".concat(a.from," to:").concat(a.to," sequence:").concat(a.sequence," event:").concat(n[r].event)),t.setLevel("warning").end()):(a.setElement(e,p,_,g),a.reInitialize(this.getMyUserID()),s.push(a),h&&l.push(a)));return f=m=null,u?(this._msgListHandler.unshift(s,o),s=null,o):(o=null,s)}},{key:"findMessage",value:function(e){return this._msgListHandler.findMessage(e)}},{key:"_isMeInCommunity",value:function(e){var t=!0;return this._isTopicConv(e)&&(e=Kt(e.replace(R.CONV_GROUP,"")),this.get(7).hasLocalGroup(e)||(t=!1,v.l("".concat(this._n,"._isMeInCommunity groupID:").concat(e," ret:").concat(t)))),t}},{key:"deleteTopicRoamingInfo",value:function(e){var t=this;kt({groupID:e})&&this._msgListHandler.getTopicConvIDList(e).forEach(function(e){t.clearMemMsg(e)})}},{key:"deleteGroupRoamingInfo",value:function(e){e="".concat(R.CONV_GROUP).concat(e);0<this._msgListHandler.getLocalMsgList(e).length&&this.clearMemMsg(e)}},{key:"setMessageRead",value:function(e){var t=e.conversationID,n=this.getLocalConversation(t),e="".concat(this._n,".setMessageRead");if(v.l("".concat(e," convID:").concat(t," unreadCount:").concat(n?n.unreadCount:0)),!n)return kn();if(n.type!==R.CONV_GROUP&&n.type!==R.CONV_TOPIC||Je(n.groupAtInfoList)||this.deleteGroupAtTips(t),0===n.unreadCount)return kn();var o=this._msgListHandler.getLocalLastMsg(t),i=n.lastMessage.lastTime,a=this._msgListHandler.getLocalMaxTime(t),a=(i<a&&(v.l("".concat(e," update lastMessageTime from ").concat(i," to ").concat(a)),i=a),this._msgListHandler.getLocalMaxSeq(t)),s=n.lastMessage.lastSequence,r=(s<a&&(v.l("".concat(e," update lastMessageSeq from ").concat(s," to ").concat(a)),s=a),n.type===R.CONV_TOPIC&&A(o)&&(e=this.get(10),o=Kt(a=t.replace(R.CONV_GROUP,"")),(e=e.getLocalTopic(o,a))&&(s=e.nextMessageSeq-1)),null);switch(n.type){case R.CONV_C2C:return(r=this.get(6))?r.setMessageRead({conversationID:t,lastMessageTime:i}):C({code:T.NO_MODULE});case R.CONV_GROUP:case R.CONV_TOPIC:return(r=this.get(7))?r.setMessageRead({conversationID:t,lastMessageSeq:s}):C({code:T.NO_MODULE});case R.CONV_SYSTEM:return n.unreadCount=0,this.emitConvUpdate(!0,!1),kn();default:return kn()}}},{key:"setAllMessageRead",value:function(){var t=this,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e="setAllMessageRead",o="".concat(this._n,".").concat(e),i=(n.scope||(n.scope=R.READ_ALL_MSG),v.l("".concat(o," options:"),n),this._createSetAllMessageReadPack(n));if(0===i.readAllC2CMessage&&0===i.groupMessageReadInfoList.length)return kn();var a=new M(e);return this.req({P:I.SET_ALL_MSG_READ,data:i}).then(function(e){e=e.data,e=t._handleAllMsgRead(e);return a.setMessage("scope:".concat(n.scope," failureGroups:").concat(JSON.stringify(e))).end(),kn()}).catch(function(e){return a.setError(e).end(),v.w("".concat(o," failed. error:"),e),C({code:e&&e.code?e.code:T.MSG_UNREAD_ALL_FAIL,message:e&&e.message?e.message:void 0})})}},{key:"setConvCustomData",value:function(e){return this._convGroupHandler.setConvCustomData(e)}},{key:"markConv",value:function(e){return this._convGroupHandler.markConv(e)}},{key:"getConvGroupList",value:function(){return this._convGroupHandler.getLocalConvGroupList()}},{key:"createConvGroup",value:function(e){return this._convGroupHandler.createConvGroup(e)}},{key:"deleteConvGroup",value:function(e){return this._convGroupHandler.deleteConvGroup(e)}},{key:"renameConvGroup",value:function(e){return this._convGroupHandler.renameConvGroup(e)}},{key:"addConvsToGroup",value:function(e){return this._convGroupHandler.addConvsToGroup(e)}},{key:"deleteConvsFromGroup",value:function(e){return this._convGroupHandler.deleteConvsFromGroup(e)}},{key:"onConvMarkUpdated",value:function(e){this._convGroupHandler.onConvMarkUpdated(e)}},{key:"onConvGroupCreated",value:function(e){this._convGroupHandler.onConvGroupCreated(e)}},{key:"onConvGroupDeleted",value:function(e){this._convGroupHandler.onConvGroupDeleted(e)}},{key:"onConvGroupNameUpdated",value:function(e){this._convGroupHandler.onConvGroupNameUpdated(e)}},{key:"onConvInGroupUpdated",value:function(e){this._convGroupHandler.onConvInGroupUpdated(e)}},{key:"onConvAddedToOrDeletedFromGroup",value:function(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}},{key:"_getConvLastMessageSeq",value:function(e){var t=this._msgListHandler.getLocalLastMsg(e.conversationID),e=e.lastMessage.lastSequence;return e=t&&e<t.sequence?t.sequence:e}},{key:"_getConvLastMessageTime",value:function(e){var t=this._msgListHandler.getLocalLastMsg(e.conversationID),e=e.lastMessage.lastTime;return e=t&&e<t.time?t.time:e}},{key:"_createSetAllMessageReadPack",value:function(e){var t,n={readAllC2CMessage:0,groupMessageReadInfoList:[]},o=e.scope,i=N(this._convMap);try{for(i.s();!(t=i.n()).done;){var a,s=m(t.value,2)[1];if(0<s.unreadCount)if(s.type===R.CONV_C2C&&0===n.readAllC2CMessage){if(o===R.READ_ALL_MSG)n.readAllC2CMessage=1;else if(o===R.READ_ALL_C2C_MSG){n.readAllC2CMessage=1;break}}else s.type!==R.CONV_GROUP||o!==R.READ_ALL_GROUP_MSG&&o!==R.READ_ALL_MSG||(a=this._getConvLastMessageSeq(s),n.groupMessageReadInfoList.push({groupID:s.groupProfile.groupID,messageSequence:a}))}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMsgRead(e)}},{key:"_handleAllMsgRead",value:function(e){var t=e.groupMessageReadInfoList,e=e.readAllC2CMessage,t=this._parseGroupReadInfo(t);return 1<=this._updateAllConvUnreadCount({readAllC2CMessage:e})&&this.emitConvUpdate(!0,!1),t}},{key:"_parseGroupReadInfo",value:function(e){var t=[];if(e&&e.length)for(var n=0,o=e.length;n<o;n++){var i=e[n],a=i.groupID,s=i.sequence,r=i.retCode,i=i.lastMessageSeq;A(r)?this._remoteGroupReadSeqMap.set(a,i):(this._remoteGroupReadSeqMap.set(a,s),0!==r&&t.push("".concat(a,"-").concat(s,"-").concat(r)))}return t}},{key:"_updateAllConvUnreadCount",value:function(l){var e,d=l.readAllC2CMessage,t=0,n=N(this._convMap);try{for(n.s();!(e=n.n()).done;){var o,i,a,s,r=m(e.value,2),c=r[0],u=r[1];1<=u.unreadCount&&(1===d&&u.type===R.CONV_C2C?(o=this._getConvLastMessageTime(u),this.updateIsReadAfterReadReport({conversationID:c,lastMessageTime:o})):u.type===R.CONV_GROUP&&(i=c.replace(R.CONV_GROUP,""),this._remoteGroupReadSeqMap.has(i)&&(a=this._remoteGroupReadSeqMap.get(i),s=this._getConvLastMessageSeq(u),this.updateIsReadAfterReadReport({conversationID:c,remoteReadSequence:a}),a<=s&&this._remoteGroupReadSeqMap.delete(i))),this.updateUnreadCount(c,!1)&&(t+=1))}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"isRemoteRead",value:function(e){var t,n=e.conversationID,e=e.sequence,o=n.replace(R.CONV_GROUP,""),i=!1;return this._remoteGroupReadSeqMap.has(o)&&(e<=(t=this._remoteGroupReadSeqMap.get(o))&&(i=!0,v.l("".concat(this._n,".isRemoteRead convID:").concat(n," msgSeq:").concat(e," remoteReadSeq:").concat(t))),t+10<=e&&this._remoteGroupReadSeqMap.delete(o)),i}},{key:"updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,n=e.lastMessageSeq,o=e.lastMessageTime,i=this._msgListHandler.getLocalMsgList(t);if(0!==i.length)for(var a,s=i.length-1;0<=s;s--)if(a=i[s],!(o&&a.time>o||n&&a.sequence>n)){if("in"===a.flow&&a.isRead)break;a.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t,n=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],o=!1,i=this.getLocalConversation(e),a=this._msgListHandler.getLocalMsgList(e);if(i)return(t=i.unreadCount)!==(a=a.filter(function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted}).length)&&(i.unreadCount=a,o=!0,v.l("".concat(this._n,".updateUnreadCount from ").concat(t," to ").concat(a,", convID:").concat(e)),!0===n&&this.emitConvUpdate(!0,!1)),o&&i.type===R.CONV_TOPIC&&(t=i.unreadCount,a=this.get(10),n=e.replace(R.CONV_GROUP,""),a.onUnreadCountUpdatedFromConv(n,t)),o}},{key:"clearGroupAtInfoList",value:function(e){var t,n=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],o=this.getLocalConversation(e);o&&0<o.groupAtInfoList.length&&(o.clearGroupAtInfoList(),v.l("".concat(this._n,".clearGroupAtInfoList convID:").concat(e)),o.type===R.CONV_TOPIC&&(o=o.groupAtInfoList,t=this.get(10),e=e.replace(R.CONV_GROUP,""),t.onAtInfoUpdated({topicID:e,groupAtInfoList:o})),!0===n&&this.emitConvUpdate(!0,!1))}},{key:"updateReadReceiptInfo",value:function(e){var a,s,o,r=this,t=e.userID,i=void 0===t?void 0:t,t=e.groupID,c=void 0===t?void 0:t,t=e.readReceiptList,e=e.timestamp,u=void 0===e?0:e;Je(t)||(a=[],A(i)?A(c)||(s="".concat(R.CONV_GROUP).concat(c),t.forEach(function(e){var t=e.tinyID,n=e.clientTime,o=e.random,i=e.readCount,e=e.unreadCount,t="".concat(t,"-").concat(n,"-").concat(o),n=r._msgListHandler.getLocalMsg(s,t)||r._msgListHandler.getHoppingMsg(s,t),o={groupID:c,messageID:t,readCount:0,unreadCount:0};n&&(Qe(i)&&(n.readReceiptInfo.readCount=i,o.readCount=i),Qe(e)&&(n.readReceiptInfo.unreadCount=e,o.unreadCount=e),a.push(o))})):(o="".concat(R.CONV_C2C).concat(i),t.forEach(function(e){var t=e.tinyID,n=e.clientTime,e=e.random,t="".concat(t,"-").concat(n,"-").concat(e),n=r._msgListHandler.getLocalMsg(o,t)||r._msgListHandler.getHoppingMsg(o,t);n&&!n.readReceiptInfo.isPeerRead&&(n.readReceiptInfo.isPeerRead=!0,n.readReceiptInfo.timestamp=u,a.push({userID:i,messageID:t,isPeerRead:!0,timestamp:u}))})),0<a.length&&this.emitOEvt(G.MESSAGE_READ_RECEIPT_RECEIVED,a))}},{key:"updateIsRead",value:function(e){var t=this.getLocalConversation(e),n=this.getLocalMessageList(e);if(t&&0!==n.length&&!Nt(t.type)){for(var o=[],i=0,a=n.length;i<a;i++)"in"!==n[i].flow?"out"!==n[i].flow||n[i].isRead||n[i].setIsRead(!0):o.push(n[i]);var s=0;s=t.type===R.CONV_C2C?(e=o.slice(-t.unreadCount).filter(function(e){return e.isRevoked}).length,o.length-t.unreadCount-e):o.length-t.unreadCount;for(var r=0;r<s&&!o[r].isRead;r++)o[r].setIsRead(!0)}}},{key:"deleteGroupAtTips",value:function(e){var t=this,n="".concat(this._n,".deleteGroupAtTips"),o=(v.l("".concat(n)),this._convMap.get(e));if(!o)return Promise.resolve();var i=o.groupAtInfoList;if(0===i.length)return Promise.resolve();var o=void 0,a=(e.startsWith(R.CONV_GROUP)&&(o=e.replace(R.CONV_GROUP,"")),D(i));if((kt({groupID:o})||Rt(o))&&0===(a=i.filter(function(e){return!e.atTypeArray.includes(R.CONV_AT_ALL)})).length)return this.clearGroupAtInfoList(e,!1),Promise.resolve();var s=this.getMyUserID();return this.req({P:I.DEL_GROUP_AT_TIPS,data:{messageListToDelete:a.map(function(e){return{from:e.from,to:s,messageSeq:e.__sequence,messageRandom:e.__random,groupID:A(e.topicID)?e.groupID:e.topicID}})}}).then(function(){return v.l("".concat(n," ok. count:").concat(i.length)),t.clearGroupAtInfoList(e,!1),Promise.resolve()}).catch(function(e){return v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"appendToMessageList",value:function(e){return this._msgListHandler.pushIn(e)}},{key:"setMessageRandom",value:function(e){this._sll.set(e.random)}},{key:"deleteMessageRandom",value:function(e){this._sll.delete(e.random)}},{key:"pushIntoMessageList",value:function(e,t,n){return!(!this._msgListHandler.pushIn(t,n)||this._sll.has(t.random)&&!n||(e.push(t),0))}},{key:"revoke",value:function(e,t,n){return this._msgListHandler.revoke(e,t,n)}},{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)}},{key:"updateMsgIsPeerReadProp",value:function(e,t){var n;e.startsWith(R.CONV_C2C)&&0<t&&(0<(n=this._msgListHandler.updateMsgIsPeerReadProp(e,t)).length&&this.emitOEvt(G.MESSAGE_READ_BY_PEER,n),this._convMap.has(e)&&(Je(n=this._convMap.get(e).lastMessage)||n.fromAccount===this.getMyUserID()&&n.lastTime<=t&&!n.isPeerRead&&(n.isPeerRead=!0,this.emitConvUpdate(!0,!1))))}},{key:"updateMsgIsModifiedProp",value:function(e){this._msgListHandler.updateMsgIsModifiedProp(e)}},{key:"setCompleted",value:function(e){v.l("".concat(this._n,".setCompleted convID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMsgKeyAndTime",value:function(e,t,n){this._roamingMsgKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:n})}},{key:"getConvList",value:function(t){var n,o=this,i="".concat(this._n,".").concat("getConvList"),e="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._convMap.size,", options:").concat(JSON.stringify(t));if(v.l("".concat(i,". ").concat(e)),this._pagingStatus===bn)return(n=new M("getConvList")).setMessage(e),this.syncConvList().then(function(){n.end();var e=o._getConvList(t);return Sn({conversationList:e,isSyncCompleted:o._isSyncCompleted()})}).catch(function(e){return n.setError(e).end(),v.e("".concat(i," failed. error:"),e),C(e)});e=this._getConvList(t);return v.l("".concat(i,". returned conversation count:").concat(e.length)),kn({conversationList:e,isSyncCompleted:this._isSyncCompleted()})}},{key:"_getConvList",value:function(t){var n,o,i,a,s,r=this;return A(t)?this.getLocalConvList():nt(t)?0===t.length?[]:this.getLocalConvList().filter(function(e){return t.includes(e.conversationID)}):et(t)?(n=t.type,o=t.markType,i=t.groupName,a=t.hasUnreadCount,s=t.hasGroupAtInfo,this.getLocalConvList().filter(function(e){return r._filterType(e,n)&&r._filterMarkType(e,o)&&r._filterGroupName(e,i)&&r._filterUnreadCount(e,a)&&r._filterGroupAtInfo(e,s)})):[]}},{key:"_filterType",value:function(e,t){return t!==R.CONV_C2C&&t!==R.CONV_GROUP||e.type===t}},{key:"_filterGroupName",value:function(e,t){return!ft(t)||(""===t?0===e.conversationGroupList.length:e.conversationGroupList.includes(t))}},{key:"_filterMarkType",value:function(e,t){return!Qe(t)||(0===t?0===e.markList.length:e.markList.includes(t))}},{key:"_filterUnreadCount",value:function(e,t){var n=!0;return!0===t?n=1<=e.unreadCount:!1===t&&(n=0===e.unreadCount),n}},{key:"_filterGroupAtInfo",value:function(e,t){var n=!0;return!0===t?n=1<=e.groupAtInfoList.length:!1===t&&(n=0===e.groupAtInfoList.length),n}},{key:"_handleC2CPeerReadTime",value:function(){var e,t=N(this._convMap);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2),o=n[0],i=n[1];i.type===R.CONV_C2C&&this.recordPeerReadTime(o,i.peerReadTime)}}catch(e){t.e(e)}finally{t.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){var e=this.get(7);return!e||e.isPagingGetCompleted()}},{key:"_getLocalGroupCount",value:function(){var e=this.get(7);return e?e.getLocalGroupList().length:0}},{key:"_hasLocalGroup",value:function(e){var t=this.get(7);return!!t&&t.hasLocalGroup(e.replace(R.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(o){var i,a=this,s=!1;if(this._convMap.has(o)?i=this._convMap.get(o):(i=new di({conversationID:o,type:At(o)?R.CONV_C2C:R.CONV_GROUP},this.isIntl(),this.isUsingChatCore()),s=!0),i._isInfoCompleted||i.type===R.CONV_SYSTEM)return kn({conversation:i});if(Ot(o)){if(!this.get(7))return C({code:T.NO_MODULE});if(!this._hasLocalGroup(o))return kn({conversation:i})}var r="".concat(this._n,".").concat("getConversationProfile"),c=new M("getConversationProfile");return v.l("".concat(r,". convID:").concat(o," remark:").concat(i.remark," lastMessage:"),i.lastMessage),this._getUserOrGroupProfile(i).then(function(e){c.setMessage("convID:".concat(o," unreadCount:").concat(e.data.conversation.unreadCount)).end();var t,n=a.get(8);if(n&&i.type===R.CONV_C2C&&(t=o.replace(R.CONV_C2C,""),n.isMyFriend(t)&&(n=n.getFriendRemark(t),i.remark!==n&&(i.remark=n,v.l("".concat(r,". convID:").concat(o," patch remark:").concat(i.remark))))),v.l("".concat(r," ok. isNewConv:").concat(s," convID:").concat(o)),s){if(i.type===R.CONV_C2C)return a._onNewC2CConv([o.replace(R.CONV_C2C,"")]).then(function(){return kn({conversation:i})});if(i.type===R.CONV_GROUP)return a._onNewGroupConv([o.replace(R.CONV_GROUP,"")]).then(function(){return kn({conversation:i})})}return e}).catch(function(e){return c.setError(e).setMessage("convID:".concat(o)).end(),v.e("".concat(r," failed. error:"),e),C(e)})}},{key:"_getUserOrGroupProfile",value:function(t){var n=this;return t.type===R.CONV_C2C?this.get(4).getUserProfile({userIDList:[t.toAccount]}).then(function(e){e=e.data;return 0===e.length?C({code:T.USER_OR_GRP_NOT_FOUND}):(t.userProfile=e[0],t._isInfoCompleted=!0,n._insertConvAfterTopmost(t),kn({conversation:t}))}):this.get(7).getGroupProfile({groupID:t.toAccount}).then(function(e){return t.groupProfile=e.data.group,t._isInfoCompleted=!0,n._insertConvAfterTopmost(t),kn({conversation:t})})}},{key:"_insertConvAfterTopmost",value:function(e){var t,n;e instanceof di&&!this._convMap.has(e.conversationID)&&(n=(t=D(this._convMap)).findIndex(function(e){return!1===e[1].isPinned}),t.splice(n,0,[e.conversationID,e]),this._convMap=new Map(t),this._setStorageConvList(),this.emitConvUpdate(!0,!1))}},{key:"_onProfileUpdated",value:function(e){var n=this;e.data.forEach(function(e){var t=e.userID;t===n.getMyUserID()?n._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar}):(t=n._convMap.get("".concat(R.CONV_C2C).concat(t)))&&(t.userProfile=e)})}},{key:"_onCloudConfig",value:function(e){"0"===this.getCloudConfig("pull_on_invite")&&(this._bPullOnInvite=!1),v.l("".concat(this._n,"._onCloudConfig bPullOnInvite:").concat(this._bPullOnInvite))}},{key:"disableMsgPullOnInvite",value:function(){this._bPullOnInvite=!1}},{key:"_isSyncCompleted",value:function(){return this._pagingStatus===Un}},{key:"_errorLog",value:function(e,t,n,o){var i=new Error("Params validate failed."),a="".concat(this.getErrMsg("API_REFER")).concat(e);throw v.w("[".concat(e,"] | ").concat(t," | ").concat(this.getErrMsg(n,o),", ").concat(a)),v.e("[".concat(e,"] Invalid ").concat(t,": type check failed for ").concat(t,".")),i}},{key:"_isValidConvID",value:function(e){return At(e)||Ot(e)||Nt(e)}},{key:"deleteConversation",value:function(e){var t=this,n="deleteConversation";return ft(e)||$e(e)||this._errorLog(n,"options","StringOrObjectRequiredLog"),ft(e)?(this._isValidConvID(e)||this._errorLog(n,"options","InvalidConversationID",e),v.l("".concat(this._n,".").concat(n," convID:").concat(e)),this.deleteConvList({conversationIDList:[e],flag:1})):(nt(e.conversationIDList)||this._errorLog(n,"conversationIDList","ArrayRequiredLog"),0===e.conversationIDList.length&&this._errorLog(n,"conversationIDList","NonEmptyArrayLog"),e.conversationIDList.forEach(function(e){t._isValidConvID(e)||t._errorLog(n,"conversationIDList","InvalidConversationID",e)}),"clearHistoryMessage"in e&&"boolean"!=typeof e.clearHistoryMessage&&this._errorLog(n,"clearHistoryMessage","BooleanRequiredLog"),100<e.conversationIDList.length&&(e.conversationIDList=e.conversationIDList.slice(0,100)),this.deleteConvList(e))}},{key:"deleteConvList",value:function(e){var t=e.conversationIDList,t=void 0===t?[]:t,n=e.clearHistoryMessage,n=void 0===n||n,e=e.flag,o=void 0===e?0:e,i="".concat(this._n,".").concat("deleteConvList"),e="convIDList:".concat(t," clearHistoryMessage:").concat(n),a=(v.l("".concat(i," ").concat(e)),new M("deleteConvList"));return a.setMessage(e),Promise.all([this.rmLocalOnlyConvList(t),this.rmLocalAndRemoteConvList(t,n)]).then(function(e){a.end();e=[].concat(D(e[0]),D(e[1]));return 0===e.length?C(new Bn({code:T.CONV_NOT_FOUND})):(v.l("".concat(i," ok")),kn(1===o?{conversationID:e[0]}:{conversationIDList:e}))}).catch(function(e){return a.setError(e).end(),v.e("".concat(i," failed. error:"),e),C(e)})}},{key:"rmLocalOnlyConvList",value:function(e){var n=this;return e.filter(function(e){if(!n._convMap.has(e))return!1;var t=n.getLocalConversation(e).type;return t!==R.CONV_GROUP||n._hasLocalGroup(e)?t===R.CONV_SYSTEM&&(n.get(7).deleteGroupSystemNotice({messageList:n._msgListHandler.getLocalMsgList(e)}),n.deleteLocalConv(e),!0):(n.deleteLocalConv(e),!0)})}},{key:"rmLocalAndRemoteConvList",value:function(e,t){var n=this,o={fromAccount:this.getMyUserID(),conversationList:[],clearHistoryMessage:t?1:0};return e.forEach(function(e){var t;n._convMap.has(e)&&((t=n.getLocalConversation(e).type)===R.CONV_C2C?o.conversationList.push({toAccount:e.replace(t,""),type:1}):t===R.CONV_GROUP&&n._hasLocalGroup(e)&&o.conversationList.push({toGroupID:e.replace(t,""),type:2}))}),0===o.conversationList.length?[]:this.req({P:I.DEL_CONV,data:o}).then(function(e){var t=[];return 0<e.data.resultList.length&&e.data.resultList.map(function(e){0===e.code&&(e=1===e.type?"".concat(R.CONV_C2C).concat(e.to):"".concat(R.CONV_GROUP).concat(e.groupID),t.push(e))}),n.deleteLocalConvList(t),t})}},{key:"setConvDraft",value:function(e){var t=e.conversationID,e=e.draftText,n="".concat(this._n,".").concat("setConvDraft");if(v.l("".concat(n," convID:").concat(t," draftText:").concat(e)),!this._convMap.has(t))return C({code:T.CONV_NOT_FOUND});n=this._convMap.get(t);return n.setDraftText(e),this.emitConvUpdate(),kn({code:0,conversation:n})}},{key:"clearHistoryMessage",value:function(t){var n=this,e={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._convMap.has(t))return C({code:T.CONV_NOT_FOUND});var o=this._convMap.get(t).type;if(o===R.CONV_C2C)e.type=1,e.toAccount=t.replace(R.CONV_C2C,"");else{if(o!==R.CONV_GROUP)return o===R.CONV_SYSTEM?(this.get(7).deleteGroupSystemNotice({messageList:this._msgListHandler.getLocalMsgList(t)}),kn({conversationID:t})):C({code:T.CONV_UN_RECORDED_TYPE});e.type=2,e.toGroupID=t.replace(R.CONV_GROUP,"")}var i="".concat(this._n,".").concat("clearHistoryMessage"),a=new M("clearHistoryMessage");return a.setMessage("convID:".concat(t)),v.l("".concat(i,". convID:").concat(t)),this.setMessageRead({conversationID:t}).then(function(){return n.req({P:I.CLEAR_HISTORY_MSG,data:e})}).then(function(){a.end(),v.l("".concat(i," ok")),n.clearMemMsg(t);var e=n.getLocalConversation(t);return e&&(e.updateLastMessage(),n._sortConvListAndEmitEvent()),kn({conversationID:t})}).catch(function(e){return a.setError(e).end(),v.e("".concat(i," failed. error:"),e),C(e)})}},{key:"pinConversation",value:function(e){var t=this,n=e.conversationID,o=e.isPinned,i=this.getLocalConversation(n);if(i&&i.isPinned===o)return kn({conversationID:n});if(Nt(n))return i&&(i.isPinned=o),this._sortConvListAndEmitEvent(),kn({conversationID:n});e=null;if(At(n)?e={type:1,toAccount:n.replace(R.CONV_C2C,"")}:Ot(n)&&(e={type:2,groupID:n.replace(R.CONV_GROUP,"")}),null===e)return C({code:T.INVALID_CONV_ID});var a="".concat(this._n,".").concat("pinConversation"),s="convID:".concat(n," isPinned:").concat(o),r=new M("pinConversation");return r.setMessage(s),v.l("".concat(a,". ").concat(s)),this.req({P:I.PIN_CONV,data:{fromAccount:this.getMyUserID(),operationType:!0===o?1:2,itemList:[e]}}).then(function(){return r.end(),v.l("".concat(a," ok")),i?i.isPinned!==o&&(i.isPinned=o):t._convMap.set(n,new di({conversationID:n,type:At(n)?R.CONV_C2C:R.CONV_GROUP,isPinned:o},t.isIntl(),t.isUsingChatCore())),t._sortConvListAndEmitEvent(),Sn({conversationID:n})}).catch(function(e){return r.setError(e).end(),v.e("".concat(a," failed. error:"),e),C(e)})}},{key:"setMessageRemindType",value:function(e){return this._msgRemindHandler.set(e)}},{key:"patchMsgRemindType",value:function(e){var t=e.ID,n=e.isC2CConversation,o=e.messageRemindType,i=!1,n=this.getLocalConversation("".concat(n?R.CONV_C2C:R.CONV_GROUP).concat(t));return n&&n.messageRemindType!==o&&(n.messageRemindType=o,i=!0),v.l("".concat(this._n,".patchMsgRemindType options:"),e,"ret:".concat(i)),i}},{key:"onC2CMsgRemindTypeFetched",value:function(e){var n,o=this;nt(e)&&0<e.length&&(n=0,e.forEach(function(e){var t=e.userID,e=e.muteFlag,e=o._transMsgRemindType(e);!0===o.patchMsgRemindType({ID:t,isC2CConversation:!0,messageRemindType:e})&&(n+=1)}),v.l("".concat(this._n,".onC2CMsgRemindTypeFetched updateCount:").concat(n)),1<=n&&this.emitConvUpdate(!0,!1))}},{key:"onC2CMsgRemindTypeSynced",value:function(e){var n=this,o="".concat(this._n,".onC2CMsgRemindTypeSynced");e.dataList.forEach(function(e){var t;Je(e.muteNotificationsSync)||(t=(e=e.muteNotificationsSync).to,e=e.muteFlag,e=n._transMsgRemindType(e),n.patchMsgRemindType({ID:t,isC2CConversation:!(t=0),messageRemindType:e})&&(t+=1),v.l("".concat(o," updateCount:").concat(t)),1<=t&&n.emitConvUpdate(!0,!1))})}},{key:"onGroupMsgRemindTypeUpdated",value:function(e){this._msgRemindHandler.onGroupMsgRemindTypeUpdated(e)}},{key:"deleteLocalConv",value:function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this._convMap.has(e);v.l("".concat(this._n,".deleteLocalConv convID:").concat(e," has:").concat(n)),n&&(this._convMap.delete(e),this._convMapForDiff.delete(e),this.clearMemMsg(e),this._setStorageConvList(!0),t)&&(n=!this._isTopicConv(e),this.emitConvUpdate(n,!1))}},{key:"pullMsgOnInvite",value:function(e){var t,n,o,i,a,s=this.get(7);s&&(t="".concat(this._n,".pullMsgOnInvite"),v.l("".concat(t," flag:").concat(this._bPullOnInvite)),this._bPullOnInvite&&(a=this.getLocalLastMessage(e),n=this.getLocalSecondLastMessage(e),i=o=1,a&&(o=a.sequence),n&&(i=n.sequence),a=s.getGroupRemoteLastSeq(e.replace(R.CONV_GROUP,"")),v.l("".concat(t," convID:").concat(e," localLastSeq:").concat(o," localSecondLastSeq:").concat(i," remoteLastSeq:").concat(a)),this.clearMemMsg(e),1<o-i?this._recursiveGetMsgList([],e,!1,o,i):1<a-o&&this._recursiveGetMsgList([],e,!0,a,o)))}},{key:"_recursiveGetMsgList",value:function(i,a,s,r,c,e){var u=this;this.getMessageList({conversationID:a,nextReqMessageID:e}).then(function(e){var e=e.data,t=e.messageList,n=e.isCompleted,e=e.nextReqMessageID,o=t.filter(function(e){return s?e.sequence>c&&e.sequence<=r:e.sequence>c&&e.sequence<r});i.unshift.apply(i,D(o)),!n&&0<t.length&&t[0].sequence>c&&i.length<60?u._recursiveGetMsgList(i,a,s,r,c,e):u._emitMsgReceived(a,i)})}},{key:"_emitMsgReceived",value:function(e,t){var n,o,i=this;0<t.length&&(t=t.filter(function(t,e,n){return e===n.findIndex(function(e){return e.sequence===t.sequence})}),n=this.hasLocalConversation(e),o=t.map(function(e){return e.sequence}),v.l("".concat(this._n,"._emitMsgReceived convID:").concat(e," has:").concat(n," count:").concat(o.length," sequenceList:"),o),this.emitOEvt(G.MESSAGE_RECEIVED,t),n?this.patchConvLastMessage(e,!0):this.getConversationProfile(e).then(function(){i.patchConvLastMessage(e,!0)}))}},{key:"deleteLocalConvList",value:function(e){var t=this,n=!1;e.forEach(function(e){t._convMap.has(e)&&(t.deleteLocalConv(e,!1),n=!0)}),v.l("".concat(this._n,".deleteLocalConvList convID:").concat(e," isConvIDExisted:").concat(n)),n&&this.emitConvUpdate(!0,!1)}},{key:"isMessageSentByCurrentInstance",value:function(e){return!(!this._msgListHandler.hasLocalMsg(e.conversationID,e.ID)&&!this._sll.has(e.random))}},{key:"modifyMessageList",value:function(e){var t,n;e.startsWith(R.CONV_C2C)&&this._convMap.has(e)&&(n=this._convMap.get(e),t=Date.now(),this._msgListHandler.modifyMsgSentByPeer({conversationID:e,latestNick:n.userProfile.nick,latestAvatar:n.userProfile.avatar}),n=this.get(4).getNickAndAvatarByUserID(this.getMyUserID()),this._msgListHandler.modifyMsgSentByMe({conversationID:e,latestNick:n.nick,latestAvatar:n.avatar}),v.l("".concat(this._n,".modifyMessageList convID:").concat(e," cost:").concat(Qt(t))))}},{key:"updateUserProfileSpecifiedKey",value:function(e){v.l("".concat(this._n,".updateUserProfileSpecifiedKey options:"),e);var t=e.conversationID,n=e.nick,e=e.avatar;this._convMap.has(t)&&(t=this._convMap.get(t).userProfile,ft(n)&&t.nick!==n&&(t.nick=n),ft(e)&&t.avatar!==e&&(t.avatar=e),this.emitConvUpdate(!0,!1))}},{key:"_onMyProfileModified",value:function(t){var n=this,e=this.getLocalConvList(),o=Date.now();e.forEach(function(e){n.modifyMessageSentByMe(y({conversationID:e.conversationID},t))}),v.l("".concat(this._n,"._onMyProfileModified. modify all messages sent by me, cost:").concat(Qt(o)))}},{key:"modifyMessageSentByMe",value:function(e){this._msgListHandler.modifyMsgSentByMe(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._msgListHandler.getLatestMsgSentByMe(e)}},{key:"modifyMessageSentByPeer",value:function(e){this._msgListHandler.modifyMsgSentByPeer(e)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._msgListHandler.getLatestMsgSentByPeer(e)}},{key:"pushIntoNoticeResult",value:function(e,t){return!(!this._msgListHandler.pushIn(t)||this._sll.has(t.random)||(e.push(t),0))}},{key:"getLocalLastMessage",value:function(e){return this._msgListHandler.getLocalLastMsg(e)}},{key:"getLocalSecondLastMessage",value:function(e){return this._msgListHandler.getLocalSecondLastMsg(e)}},{key:"checkAndPatchRemark",value:function(){var e,n,o=this.get(8);0===this._convMap.size||!o||0!==(e=D(this._convMap.values()).filter(function(e){return e.type===R.CONV_C2C})).length&&(n=0,e.forEach(function(e){var t=e.conversationID.replace(R.CONV_C2C,"");o.isMyFriend(t)&&(t=o.getFriendRemark(t),e.remark!==t&&(e.remark=t,n+=1))}),v.l("".concat(this._n,".checkAndPatchRemark. c2cConvCount:").concat(e.length," patchedCount:").concat(n)),0<n&&this.emitConvUpdate(!0,!1))}},{key:"updateTopicConversation",value:function(e){this._updateLocalConvList({conversationOptionsList:e,isFromGetConversations:!0,updateUnreadCount:!0})}},{key:"sendReadReceipt",value:function(e){var t=e[0],n=null;return t.conversationType===R.CONV_C2C?n=this._m.get(6):t.conversationType===R.CONV_GROUP&&(n=this._m.get(7)),n?n.sendReadReceipt(e):C({code:T.NO_MODULE})}},{key:"getReadReceiptList",value:function(e){var t=e[0],n=null;return t.conversationType===R.CONV_C2C?n=this._m.get(6):t.conversationType===R.CONV_GROUP&&(n=this._m.get(7)),n?n.getReadReceiptList(e):C({code:T.NO_MODULE})}},{key:"getLastMessageTime",value:function(e){e=this.getLocalConversation(e);return e?e.lastMessage.lastTime:0}},{key:"getTotalUnreadCount",value:function(){var e=this.getLocalConvList(),t=0;return e.forEach(function(e){e.type!==R.CONV_SYSTEM&&(""!==e.messageRemindType&&e.messageRemindType!==R.MSG_REMIND_ACPT_AND_NOTE||(t+=e.unreadCount))}),t}},{key:"onTotalUnreadCountUpdate",value:function(){var e=this.getTotalUnreadCount();this._convTotalUnreadCount!==e&&(v.l("".concat(this._n,".onTotalUnreadCountUpdate from ").concat(this._convTotalUnreadCount," to ").concat(e)),this._convTotalUnreadCount=e,this.emitOEvt(G.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}},{key:"_isConvNeedShow",value:function(e){e=this.getLocalConversation(e);if(A(e))return!0;var t=e.type===R.CONV_TOPIC,n=e.type===R.CONV_GROUP&&e.groupProfile.type===R.GRP_ROOM,e=e.type===R.CONV_GROUP&&e.groupProfile.type===R.GRP_LIVE;return!(t||n||e)}},{key:"setAllRcvMsgOpt",value:function(e){return this._msgRemindHandler.setAllRcvMsgOpt(e)}},{key:"getAllRcvMsgOpt",value:function(){return this._msgRemindHandler.getAllRcvMsgOpt()}},{key:"onAllRcvMsgOptNotify",value:function(e){this._msgRemindHandler.onAllRcvMsgOptNotify(e)}},{key:"clearUnreadCount",value:function(e){e=this.getLocalConversation(e);e&&0<e.unreadCount&&(e.unreadCount=0,this.emitConvUpdate(!0,!1))}},{key:"storeHoppingMessageList",value:function(e){this._msgListHandler.storeHoppingMsgList(e)}},{key:"clearMemMsg",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];v.l("".concat(this._n,".clearMemMsg convID:").concat(e," isOverLimit:").concat(t)),this._msgListHandler.removeByConvID(e),this._completedMap.delete(e),this._roamingMsgKeyAndTimeMap.delete(e),this._everClearedMap.set(e,1)}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._setStorageConvList(!0),this._pagingStatus=Gn,this._msgListHandler.reset(),this._msgRemindHandler.reset(),this._roamingMsgKeyAndTimeMap.clear(),this._sll.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._convMap.clear(),this._pagingTs=0,this._pagingStartIdx=0,this._pagingPinnedTs=0,this._pagingPinnedStartIdx=0,this._remoteGroupReadSeqMap.clear(),this._convTotalUnreadCount=0,this._pagingGetCostList.length=0,this._pagingConvIDMap.clear(),this._convIDFromUnreadDBMap.clear(),this._pagingGetCostList.length=0,this._convMapForDiff.clear(),this._partialUpdatedConvMap.clear(),this._everClearedMap.clear(),this._bPullOnInvite=!0,this._convGroupHandler.reset(),this.resetReady()}}]),ia),fi=(e(oa,[{key:"onCheckTimer",value:function(e){e%1==0&&0<this._cachedGroupTipsMap.size&&this._check()}},{key:"_check",value:function(){var i=this;this._cachedGroupTipsMap.forEach(function(e,t){var n=i._checkCountMap.get(t),o=i._grpM.hasLocalGroup(t);v.l("".concat(i._n,"._check groupID:").concat(t," hasLocalGroup:").concat(o," checkCount:").concat(n)),o?(i._notifyCachedGroupTips(t),i._checkCountMap.delete(t),i._grpM.deleteUnjoinedAVChatRoom(t)):n>=i.MAX_CHECK_COUNT?(i._deleteCachedGroupTips(t),i._checkCountMap.delete(t)):i._checkCountMap.set(t,++n)})}},{key:"onNewGroupTips",value:function(e){v.l("".concat(this._n,".onNewGroupTips options:").concat(JSON.stringify(e.dataList)));var e=this._assembly(e),t=e.eventDataList,n=e.result,e=e.AVChatRoomMessageList;0<e.length&&this._grpM.onAVChatRoomMessage(e),0<n.length&&(this._grpM.emitOEvt(G.MESSAGE_RECEIVED,n),this._handleTips(n)),0<t.length&&(this._grpM.updateNextMessageSeq(t),this._grpM.get(11).onNewMessage({conversationOptionsList:t,isInstantMessage:!0}))}},{key:"_assembly",value:function(l){for(var e=l.event,d=l.dataList,t=null,n=[],p=[],_={},h=[],g=0,f=d.length;g<f;g++){var o=ht(d[g]);if(6===e){if(this._grpM.isGroupAttributesUpdatedNotice(o))continue;if(this._grpM.isGroupCountersNotice(o))continue}var i=o.groupProfile,m=i.groupID,a=i.communityType,a=void 0===a?0:a,s=i.topicID,s=void 0===s?void 0:s,r=i.invisible,i=i.groupType,i=void 0===i?void 0:i,v=void 0,c=this._grpM.isMessageFromTopic(a,s),u=(c&&(v=R.CONV_TOPIC,o.to=s),this._grpM.hasLocalGroup(m));if(u||!this._grpM.isUnjoinedAVChatRoom(m))if(u||c)if(this._grpM.isMessageFromOrToAVChatroom(m))o.event=e,h.push(o);else if(o.currentUser=this._grpM.getMyUserID(),o.conversationType=R.CONV_GROUP,(t=new Ro(o)).setElement({type:R.MSG_GRP_TIP,content:y(y({},o.elements),{},{groupProfile:o.groupProfile})}),t.isSystemMessage=!1,1!==r){var u=this._grpM.get(11),c=t,r=c.conversationID,c=c.sequence;if(6===e)t._onlineOnlyFlag=!0,p.push(t);else if(!u.pushIntoNoticeResult(p,t))continue;this._grpM.isMessageFromCommunityOfTopic(a,s)||6===e&&u.getLocalConversation(r)||(6!==e&&this._qualityStat(t),a=u.isRemoteRead({conversationID:r,sequence:c}),A(_[r])?(s=0,"in"===t.flow&&(t._isExcludedFromUnreadCount||t._onlineOnlyFlag||a||(s=1)),_[r]=n.push({conversationID:r,unreadCount:s,type:A(v)?t.conversationType:v,subType:t.conversationSubType,lastMessage:t._isExcludedFromLastMessage?"":t})-1):(n[u=_[r]].type=t.conversationType,n[u].subType=t.conversationSubType,n[u].lastMessage=t._isExcludedFromLastMessage?"":t,"in"===t.flow&&(t._isExcludedFromUnreadCount||t._onlineOnlyFlag||a||n[u].unreadCount++)))}else this._qualityStat(t);else this._cacheAndCompare({groupID:m,event:e,item:o,groupType:i})}return{eventDataList:n,result:p,AVChatRoomMessageList:h}}},{key:"_qualityStat",value:function(e){this._grpM.get(26).addMessageSequence({key:Qn,message:e})}},{key:"_handleTips",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:v.w("".concat(t._n,"._handleTips unknown operationType:").concat(e.payload.operationType))}})}},{key:"_onNewMemberComeIn",value:function(e){var e=e.payload,t=e.memberNum,e=e.groupProfile.groupID,e=this._grpM.getLocalGroupProfile(e);e&&Qe(t)&&e.memberCount!==t&&(e.memberCount=t,this._updateConvGroupProfile(e))}},{key:"_onMemberQuit",value:function(e){var t=e.payload,n=t.memberNum,t=t.groupProfile.groupID,o=this._grpM.getLocalGroupProfile(t);o&&Qe(n)&&o.memberCount!==n&&(o.memberCount=n,this._updateConvGroupProfile(o)),this._grpM.getGroupMemberHandler().deleteLocalGroupMembers(t,e.payload.userIDList)}},{key:"_onMemberKickedOut",value:function(e){var t=e.payload,n=t.memberNum,t=t.groupProfile.groupID,o=this._grpM.getLocalGroupProfile(t);o&&Qe(n)&&o.memberCount!==n&&(o.memberCount=n,this._updateConvGroupProfile(o)),this._grpM.getGroupMemberHandler().deleteLocalGroupMembers(t,e.payload.userIDList)}},{key:"_updateConvGroupProfile",value:function(e){this._grpM.get(11).updateConvGroupProfile([e])}},{key:"_onMemberSetAdmin",value:function(e){var t=e.payload.groupProfile.groupID,e=e.payload.userIDList,n=this._grpM.getGroupMemberHandler();e.forEach(function(e){e=n.getLocalGroupMemberInfo(t,e);e&&e.updateRole(R.GRP_MBR_ROLE_ADMIN)})}},{key:"_onMemberCancelledAdmin",value:function(e){var t=e.payload.groupProfile.groupID,e=e.payload.userIDList,n=this._grpM.getGroupMemberHandler();e.forEach(function(e){e=n.getLocalGroupMemberInfo(t,e);e&&e.updateRole(R.GRP_MBR_ROLE_MEMBER)})}},{key:"_onGroupProfileModified",value:function(e){var t=this,e=e.payload,n=e.newGroupProfile,o=e.groupProfile,i=e.operatorInfo,e=o.groupID,a=this._grpM.getLocalGroupProfile(e),o=(Object.keys(n).forEach(function(e){switch(e){case"ownerID":t._ownerChanged(a,n);break;case"groupName":a.name=n[e];break;default:a[e]=n[e]}}),A(i)||Object.keys(i).forEach(function(e){var t;"nameCard"===e?a.updateSelfInfo({nameCard:i[e]}):"role"===e&&(t="",400===i[e]?t=R.GRP_MBR_ROLE_OWNER:300===i[e]?t=R.GRP_MBR_ROLE_ADMIN:200===i[e]&&(t=R.GRP_MBR_ROLE_MEMBER),a.updateSelfInfo({role:t}))}),!a.isSupportTopic);this._grpM.emitGroupListUpdate(!0,o)}},{key:"_ownerChanged",value:function(e,t){var e=e.groupID,n=this._grpM.getLocalGroupProfile(e),o=this._grpM.getMyUserID();o===t.ownerID&&(n.updateGroup({selfInfo:{role:R.GRP_MBR_ROLE_OWNER}}),n=(t=this._grpM.getGroupMemberHandler()).getLocalGroupMemberInfo(e,o),o=this._grpM.getLocalGroupProfile(e).ownerID,t=t.getLocalGroupMemberInfo(e,o),n&&n.updateRole(R.GRP_MBR_ROLE_OWNER),t&&t.updateRole(R.GRP_MBR_ROLE_MEMBER))}},{key:"_onMemberInfoModified",value:function(e){var t=e.to,n=e.payload,o=n.groupProfile,n=n.memberList,i=o.groupID,a=(Rt(t)&&this._updateTopicMuteTime(e),this._grpM.getGroupMemberHandler());n.forEach(function(e){var t=a.getLocalGroupMemberInfo(i,e.userID);t&&Qe(e.muteTime)&&t.updateMuteUntil(e.muteTime)})}},{key:"_updateTopicMuteTime",value:function(e){var t=e.to,e=e.payload,n=e.groupProfile,e=e.memberList,o=void 0===e?[]:e,e=this._grpM.get(10),n=n.groupID,i=e.getLocalTopic(n,t);if(i){for(var a=!1,s=0;s<o.length;s++){var r=o[s];if(r.userID===this._grpM.getMyUserID()&&0<=r.muteTime){i.updateSelfInfo({muteTime:r.muteTime}),a=!0;break}}a&&this._grpM.emitOEvt(G.TOPIC_UPDATED,{groupID:n,topic:i})}}},{key:"_onTopicProfileUpdated",value:function(e){var t=e.payload,n=t.groupProfile.groupID,t=t.newTopicInfo;this._grpM.get(10).onTopicProfileUpdated(y({groupID:n,topicID:e.to},t))}},{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,t){var n=this,o=this._cachedGroupTipsMap.get(e)||[];v.l("".concat(this._n,"._notifyCachedGroupTips groupID:").concat(e," groupType:").concat(t," count:").concat(o.length)),o.forEach(function(e){n.onNewGroupTips(e)}),this._deleteCachedGroupTips(e)}},{key:"_cacheAndCompare",value:function(e){var t=e.groupID,n=e.event,o=e.item,e=e.groupType,n=(v.l("".concat(this._n,"._cacheAndCompare groupID:").concat(t," groupType:").concat(e)),this._cacheGroupTips(t,{event:n,dataList:[o]}),{groupID:t,type:e});e===R.GRP_AVCHATROOM?this._grpM.hasLocalGroup(t)?this._notifyCachedGroupTips(t,e):this._grpM.setUnjoinedAVChatRoom(t):(this._grpM.updateGroupMap([n]),this._notifyCachedGroupTips(t,e)),this._checkCountMap.has(t)||this._checkCountMap.set(t,0)}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear()}}]),oa),mi=(e(na,[{key:"onCheckTimer",value:function(e){e%1==0&&0<this._cachedGroupMessageMap.size&&this._check()}},{key:"_check",value:function(){var i=this;this._cachedGroupMessageMap.forEach(function(e,t){var n=i._checkCountMap.get(t),o=i._grpM.hasLocalGroup(t);v.l("".concat(i._n,"._check groupID:").concat(t," hasLocalGroup:").concat(o," checkCount:").concat(n)),o?(i._notifyCachedGroupMessage(t),i._checkCountMap.delete(t),i._grpM.deleteUnjoinedAVChatRoom(t)):n>=i.MAX_CHECK_COUNT?(i._deleteCachedGroupMessage(t),i._checkCountMap.delete(t)):i._checkCountMap.set(t,++n)})}},{key:"updateLastMsg",value:function(e){var t="".concat(this._n,".updateLastMsg");if(0!==this._grpM.getGroupMap().size){for(var n,o,i,a,s=!1,r=e.length,c=0;c<r;c++)(n=e[c]).type===R.CONV_GROUP&&0!==n.lastMessage.lastSequence&&null!==n.lastMessage.payload&&(o=n.conversationID.split(/^GROUP/)[1],(o=this._grpM.getLocalGroupProfile(o))&&(i=o.lastMessage,a=n.lastMessage,JSON.stringify(i)!==JSON.stringify(a)&&(o.lastMessage=y({},n.lastMessage),s=!0)));v.l("".concat(t," convCount:").concat(r," groupCount:").concat(this._grpM.getLocalGroupList().length," isUpdated:").concat(s)),s&&(this._grpM.sortLocalGroupList(),this._grpM.emitGroupListUpdate(!0,!1))}else this.tempConversationList=e}},{key:"onNewMessage",value:function(e){var t=this._assembly(e),n=t.conversationOptionsList,o=t.messageList,t=t.AVChatRoomMessageList,t=(0<t.length&&this._grpM.onAVChatRoomMessage(t),Dt(o)),t=(0<t.length&&this._grpM.emitOEvt(G.MESSAGE_MODIFIED,t),0<n.length&&(this._grpM.get(11).onNewMessage({conversationOptionsList:n,isInstantMessage:!1!==e.isInstantMessage,updateUnreadCount:!1!==e.updateUnreadCount}),this._grpM.updateNextMessageSeq(n)),Lt(o));0<t.length&&this._grpM.emitOEvt(G.MESSAGE_RECEIVED,t),o.length=0}},{key:"_assembly",value:function(l){var d=l.dataList,p=l.event,_=l.isInstantMessage,e=null,t=[],h=[],g=[],f={},m=this._grpM.getFileDownloadProxy(),v=this._grpM.getDowloadFileAuthKey(),I=this._grpM.get(17).getFileDNList(),M=d.length;1<M&&d.sort(function(e,t){return e.sequence-t.sequence});for(var n=this._grpM.get(11),y=this._grpM.get(4),C=0;C<M;C++){var o,i=ht(d[C]),a=i.groupProfile,T=a.groupID,s=a.communityType,s=void 0===s?0:s,r=a.topicID,r=void 0===r?void 0:r,D=a.invisible,a=a.groupType,a=void 0===a?void 0:a,E=void 0,c=this._grpM.isMessageFromTopic(s,r),u=(c&&(E=R.CONV_TOPIC,i.to=r),this._grpM.hasLocalGroup(T));!u&&this._grpM.isUnjoinedAVChatRoom(T)||(u||c?this._grpM.isMessageFromOrToAVChatroom(T)?(i.event=p,g.push(i)):(i.currentUser=this._grpM.getMyUserID(),i.conversationType=R.CONV_GROUP,i.isSystemMessage=!!i.isSystemMessage,(e=new Ro(i)).setElement(i.elements,m,v,I),1!==D?(u=1===d[C].isModified,n.isMessageSentByCurrentInstance(e)?e.isModified=u:u=!1,1===i.onlineOnlyFlag?(e._onlineOnlyFlag=!0,n.isMessageSentByCurrentInstance(e)||h.push(e)):this._grpM.isMessageFromCommunityOfTopic(s,r)?h.push(e):(e.from!==this._grpM.getMyUserID()||(c=n.getLatestMessageSentByMe(e.conversationID))&&(D=c.nick,s=c.avatar,D===e.nick&&s===e.avatar||(n.modifyMessageSentByMe({conversationID:o,latestNick:e.nick,latestAvatar:e.avatar}),y.mockOnNickAvatarModified(e.nick,e.avatar))),n.pushIntoMessageList(h,e,u)&&(this._qualityStat(_,e),o=(r=e).conversationID,c=r.sequence,D=n.isRemoteRead({conversationID:o,sequence:c}),A(f[o])?(s=0,"in"===e.flow&&(e._isExcludedFromUnreadCount||D||(s=1)),f[o]=t.push({conversationID:o,unreadCount:s,type:A(E)?e.conversationType:E,subType:e.conversationSubType,lastMessage:e._isExcludedFromLastMessage?"":e})-1):(t[u=f[o]].type=A(E)?e.conversationType:E,t[u].subType=e.conversationSubType,t[u].lastMessage=e._isExcludedFromLastMessage?"":e,"in"===e.flow&&(e._isExcludedFromUnreadCount||D||t[u].unreadCount++))))):this._qualityStat(_,e)):this._cacheAndCompare({groupID:T,event:p,item:i,groupType:a}))}return{conversationOptionsList:t,messageList:h,AVChatRoomMessageList:g}}},{key:"_qualityStat",value:function(e,t){var n=this._grpM.get(26);n.addMessageSequence({key:Qn,message:t}),e&&0<t.clientTime&&n.addMessageDelay(t.clientTime)}},{key:"onMsgRevoked",value:function(e,t){var n=this,u=this._grpM.get(11),l=[],d=[];e.dataList.forEach(function(e){var t=e.elements.revokedInfos,s=e.revokerInfo,r=e.groupProfile,c=!1;r&&(c=kt({groupID:r.groupID})||!Je(r.topicID)),A(t)||t.forEach(function(e){var t,n=Je(e.topicID)?"GROUP".concat(e.groupID):"GROUP".concat(e.topicID),o=u.getLocalConversation(n),i=e.revokerInfo&&e.revokerInfo.revoker||s&&s.revoker,a=s&&s.reason||"";o&&St(o.type)?t={conversationID:n,sequence:e.sequence,ID:"".concat(e.tinyID,"-").concat(e.clientTime,"-").concat(e.random)}:(o=u.revoke(n,e.sequence,e.random))?t=o:(t={conversationID:n,sequence:e.sequence},e.tinyID&&e.clientTime&&e.random&&(t.ID="".concat(e.tinyID,"-").concat(e.clientTime,"-").concat(e.random)),e.time&&(t.time=e.time)),t&&(t.revoker=i,t.revokeReason=a,t.revokerInfo={userID:i,nick:"",avatar:""},c?(t.revokerInfo.nick=r.nick,t.revokerInfo.avatar=r.avatar,l.push(t)):d.push(t))})}),0===d.length&&0===l.length||(u.onMessageRevoked([].concat(l,d),t),0<l.length&&this._grpM.emitOEvt(G.MESSAGE_REVOKED,l),0<d.length&&u.updateRevokerInfo(d).then(function(e){n._grpM.emitOEvt(G.MESSAGE_REVOKED,e)}))}},{key:"_groupListTreeShaking",value:function(e){for(var n=new Map(D(this._grpM.getGroupMap())),t=0,o=e.length;t<o;t++)n.delete(e[t].groupID);this._grpM.hasJoinedAVChatRoom()&&this._grpM.getJoinedAVChatRoom().forEach(function(e){n.delete(e)}),this._grpM.getGroupMap().forEach(function(e,t){e.isSupportTopic&&n.delete(t)});for(var i=D(n.keys()),a=0,s=i.length;a<s;a++)this._grpM.deleteGroup(i[a])}},{key:"syncGroupList",value:function(){var o=this,e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=(this._pagingStatus===Gn&&this._grpM.clearGroupMap(),D(K)),n=this.PAGING_GRP_COUNT_LIMIT,i=[];if(!0===e)return this._pagingGetGroupListWithTopic({limit:n,offset:0,groupBaseInfoFilter:t,groupList:i});var e="syncGroupList",a="".concat(this._n,".").concat(e),s=new M(e);return this._pagingGetGroupList({limit:n,offset:0,groupBaseInfoFilter:t,groupList:i}).then(function(){var e=Zt(o._pagingGetCostList),t=Xt(o._pagingGetCostList),n=(o._pagingGetCostList.length=0,o._pagingStatus=Un,o._groupListTreeShaking(i),o._grpM.updateGroupMap(i),o._grpM.getLocalGroupList().length),n="count:".concat(n," sum:").concat(t," avg:").concat(e);return v.l("".concat(a," ok. ").concat(n)),s.setMessage(n).end(),o.tempConversationList&&(o.updateLastMsg(o.tempConversationList),o.tempConversationList=null),o._grpM.emitGroupListUpdate(!0,!0),Sn({groupList:o._grpM.getLocalGroupList()})}).catch(function(e){return o._pagingStatus=bn,s.setError(e).end(),v.e("".concat(a," failed. error:"),e),C(e)})}},{key:"getGroupList",value:function(){var t=this,n="".concat(this._n,".").concat("getGroupList");if(v.l("".concat(n," pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===bn||this._pagingStatus===Gn)return this.syncGroupList().then(function(){var e=t._grpM.getLocalGroupList();return Sn({groupList:e,isSyncCompleted:t.isPagingGetCompleted()})}).catch(function(e){return v.e("".concat(n," failed. error:"),e),C(e)});var e=this._grpM.getLocalGroupList();return v.l("".concat(n,". returned group count:").concat(e.length)),kn({groupList:e,isSyncCompleted:this.isPagingGetCompleted()})}},{key:"isPagingGetCompleted",value:function(){return this._pagingStatus===Un}},{key:"_pagingGetGroupList",value:function(e){var o=this,i="".concat(this._n,".").concat("_pagingGetGroupList"),t=e.isCommunityRelay,a=void 0!==t&&t,s=e.limit,r=e.offset,c=e.groupBaseInfoFilter,u=e.groupList,l=Date.now();return this._grpM.req({P:I.GET_GRP_LIST,data:{type:a?R.GRP_COMMUNITY:void 0,memberAccount:this._grpM.getMyUserID(),limit:s,offset:r,responseFilter:{groupBaseInfoFilter:c,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]}}}).then(function(e){var e=e.data,t=e.groups,t=void 0===t?[]:t,e=e.totalCount,t=(u.push.apply(u,D(t)),o._handleGroupAtInfoWithoutTopic(a,t),r+s),n=!(t<e),e="offset:".concat(r," limit:").concat(s," total:").concat(e," isCompleted:").concat(n," ")+"current:".concat(u.length," isCommunityRelay:").concat(a);return o._pagingGetCostList.push(Qt(l,!1)),v.l("".concat(i," ok. ").concat(e," cost:").concat(Qt(l))),a||n?!a&&n?(v.l("".concat(i," start to get community list")),r=0,o._pagingGetGroupList({limit:s,offset:r,groupBaseInfoFilter:c,groupList:u,isCommunityRelay:!0})):a&&!n?(r=t,o._pagingGetGroupList({limit:s,offset:r,groupBaseInfoFilter:c,groupList:u,isCommunityRelay:!0})):Sn({groupList:u}):(r=t,o._pagingGetGroupList({limit:s,offset:r,groupBaseInfoFilter:c,groupList:u}))}).catch(function(e){return 10018===e.code?(v.w("".concat(o.logPrefix," response size exceeds the limit, request count:").concat(s)),s=50,o._pagingGetGroupList({limit:s,offset:r,groupBaseInfoFilter:c,groupList:u,isCommunityRelay:a})):a?(11e3===e.code&&v.l("".concat(i," ok. community unavailable")),kn({groupList:u})):C(e)})}},{key:"_pagingGetGroupListWithTopic",value:function(e){var o=this,i="".concat(this._n,"._pagingGetGroupListWithTopic"),a=e.limit,s=e.offset,r=e.groupBaseInfoFilter,c=e.groupList,u=Date.now();return this._grpM.req({P:I.GET_GRP_LIST,data:{type:R.GRP_COMMUNITY,memberAccount:this._grpM.getMyUserID(),limit:a,offset:s,responseFilter:{groupBaseInfoFilter:r,selfInfoFilter:D(Y)},isSupportTopic:1,needAppDefineData:1}}).then(function(e){var e=e.data,t=e.groups,e=e.totalCount,t=(c.push.apply(c,D(void 0===t?[]:t)),s+a),n=!(t<e);if(v.l("".concat(i," ok. offset:").concat(s," limit:").concat(a," totalCount:").concat(e," isCompleted:").concat(n," currentCount:").concat(c.length," cost:").concat(Qt(u))),!n)return s=t,o._pagingGetGroupListWithTopic({limit:a,offset:s,groupBaseInfoFilter:r,groupList:c});o._grpM.updateGroupMap(c),o._grpM.emitGroupListUpdate(!0,!1);e=o._grpM.getLocalGroupList().filter(function(e){return!0===e.isSupportTopic});return Sn({groupList:e})}).catch(function(e){return 10018===e.code?(v.w("".concat(o.logPrefix," response size exceeds the limit, request count:").concat(a)),a=50,o._pagingGetGroupListWithTopic({limit:a,offset:s,groupBaseInfoFilter:r,groupList:c})):C(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,t){var n=this,o=this._cachedGroupMessageMap.get(e)||[];v.l("".concat(this._n,"._notifyCachedGroupMessage groupID:").concat(e," groupType:").concat(t," count:").concat(o.length)),o.forEach(function(e){n.onNewMessage(e)}),this._deleteCachedGroupMessage(e)}},{key:"_cacheAndCompare",value:function(e){var t=e.groupID,n=e.event,o=e.item,e=e.groupType,n=(v.l("".concat(this._n,"._cacheAndCompare groupID:").concat(t," groupType:").concat(e)),this._cacheGroupMessage(t,{event:n,dataList:[o]}),{groupID:t,type:e});e===R.GRP_AVCHATROOM?this._grpM.hasLocalGroup(t)?this._notifyCachedGroupMessage(t,e):this._grpM.setUnjoinedAVChatRoom(t):(this._grpM.updateGroupMap([n]),this._notifyCachedGroupMessage(t,e)),this._checkCountMap.has(t)||this._checkCountMap.set(t,0)}},{key:"_handleGroupAtInfoWithoutTopic",value:function(e,t){var o=this;e&&0!==t.length&&t.forEach(function(e){var t=e.groupID,e=e.groupAtInfoList,n=[];A(e)||(e.forEach(function(e){n.push(y(y({},e),{},{groupID:t}))}),o._grpM.get(11).onNewGroupAtTips({dataList:n}))})}},{key:"setPagingGroupCount",value:function(e){A(e)||(this.PAGING_GRP_COUNT_LIMIT=parseInt(e,10))}},{key:"reset",value:function(){this.PAGING_GRP_COUNT_LIMIT=200,this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._pagingStatus=Gn,this._pagingGetCostList=[]}}]),na),vi=(e(ta,[{key:"_onCloudConfig",value:function(){var e=this._grpM.getCloudConfig("grp_attr_cache_time");A(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesMap.forEach(function(e){e.localMainSequence=0})}},{key:"isGroupAttributesUpdatedNotice",value:function(e){var t=e.to,e=e.elements.newGroupProfile,n=!A(e)&&!Je(e.groupAttributeOption);return n&&this._onGroupAttributesUpdated({groupID:t,groupAttributeOption:e.groupAttributeOption}),n}},{key:"_onGroupAttributesUpdated",value:function(e){var t=this,n=e.groupID,e=e.groupAttributeOption,o=e.mainSequence,i=e.isWithChangedAttributeInfo,a=e.groupAttributeList,a=void 0===a?[]:a,e=e.operationType;if(v.l("".concat(this._n,".onGroupAttributesUpdated. ")+"groupID:".concat(n," isWithChangedAttributeInfo:").concat(i," operationType:").concat(e)),!A(e)){this._groupAttributesCopy=this._getCachedAttributes({groupID:n});var s=o-this._getLocalGroupAttributes(n).localMainSequence;if(0!=s){if(1===i&&1==s)return this._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:o,groupAttributeList:a,operationType:e}),void this._emitGroupAttributesUpdated(n);this._hasLocalGroupAttributes(n)&&(i=this._getLocalGroupAttributes(n).avChatRoomKey,this._getGroupAttributes({groupID:n,avChatRoomKey:i}).then(function(){t._emitGroupAttributesUpdated(n)}))}}}},{key:"initGroupAttributesCache",value:function(e){var t=e.groupID,e=e.avChatRoomKey,e=void 0===e?void 0:e;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:e}),v.l("".concat(this._n,".initGroupAttributesCache groupID:").concat(t," avChatRoomKey:").concat(e))}},{key:"initGroupAttributes",value:function(e){var n=this,o=e.groupID,i=e.groupAttributes,e=this._getLocalGroupAttributes(o),t=e.remoteMainSequence,e=e.avChatRoomKey,a=new M("initGroupAttributes");return a.setMessage("groupID:".concat(o," avChatRoomKey:").concat(e," mainSequence:").concat(t)),this._grpM.req({P:I.SET_GRP_ATTR,data:{groupID:o,avChatRoomKey:e,mainSequence:t,groupAttributeList:this._transformGroupAttributes(i)}}).then(function(e){v.l("".concat(n._n,".").concat("initGroupAttributes"," ok. groupID:").concat(o));var e=e.data,t=e.mainSequence,e=D(e.groupAttributeList);return e.forEach(function(e){e.value=i[e.key]}),n._groupAttributesCopy=n._getCachedAttributes({groupID:o}),n._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:t,groupAttributeList:e,operationType:1}),n._emitGroupAttributesUpdated(o),a.end(),Sn({groupAttributes:i})}).catch(function(e){return a.setError(e).end(),C(e)})}},{key:"setGroupAttributes",value:function(e){var n=this,o="".concat(this._n,".").concat("setGroupAttributes"),i=e.groupID,a=e.groupAttributes,e=this._getLocalGroupAttributes(i),t=e.remoteMainSequence,s=e.avChatRoomKey,r=e.attributes,e=this._transformGroupAttributes(a),c=(e.forEach(function(e){var t=e.key;e.sequence=0,r.has(t)&&(e.sequence=r.get(t).sequence)}),new M("setGroupAttributes"));return c.setMessage("groupID:".concat(i," groupAttributes:").concat(JSON.stringify(a))),v.l("".concat(o,". groupID:").concat(i," mainSequence:").concat(t)),this._grpM.req({P:I.MODIFY_GRP_ATTR,data:{groupID:i,avChatRoomKey:s,mainSequence:t,groupAttributeList:e}}).then(function(e){v.l("".concat(o," ok."));var e=e.data,t=e.mainSequence,e=D(e.groupAttributeList);return e.forEach(function(e){e.value=a[e.key]}),n._groupAttributesCopy=n._getCachedAttributes({groupID:i}),n._refreshCachedGroupAttributes({groupID:i,remoteMainSequence:t,groupAttributeList:e,operationType:2}),n._emitGroupAttributesUpdated(i),c.end(),Sn({groupAttributes:a})}).catch(function(e){return c.setError(e).end(),C(e)})}},{key:"deleteGroupAttributes",value:function(e){var t=this,n=e.groupID,e=e.keyList,e=void 0===e?[]:e,o=this._getLocalGroupAttributes(n),i=o.remoteMainSequence,a=o.avChatRoomKey,s=o.attributes,r=D(s.keys()),o=I.CLEAR_GRP_ATTR,l=3,a={groupID:n,avChatRoomKey:a,mainSequence:i},c=[],u=(0<e.length&&(r=[],o=I.DEL_GRP_ATTR,l=4,e.forEach(function(e){var t=0;s.has(e)&&(t=s.get(e).sequence,r.push(e)),c.push({key:e,sequence:t})}),a.groupAttributeList=c),new M("deleteGroupAttributes"));return u.setMessage("groupID:".concat(n," mainSequence:").concat(i," keyList:").concat(e," proto:").concat(o)),this._grpM.req({P:o,data:a}).then(function(e){v.l("".concat(t._n,".").concat("deleteGroupAttributes"," ok. groupID:").concat(n));e=e.data.mainSequence;return t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:e,groupAttributeList:c,operationType:l}),t._emitGroupAttributesUpdated(n),u.end(),Sn({keyList:r})}).catch(function(e){return u.setError(e).end(),C(e)})}},{key:"getGroupAttributes",value:function(t){var n=this,o="".concat(this._n,".").concat("getGroupAttributes"),i=t.groupID,e=this._getLocalGroupAttributes(i),a=e.avChatRoomKey,s=e.lastUpdateTime,r=e.localMainSequence,e=e.remoteMainSequence,c=new M("getGroupAttributes");if(c.setMessage("groupID:".concat(i," localMainSequence:").concat(r," remoteMainSequence:").concat(e," keyList:").concat(t.keyList)),Date.now()-s>=this.CACHE_EXPIRE_TIME||r<e)return this._getGroupAttributes({groupID:i,avChatRoomKey:a}).then(function(e){c.setMoreMessage("get attributes from remote. count:".concat(e.length)).end(),v.l("".concat(o," from remote. groupID:").concat(i));e=n._getCachedAttributes(t);return Sn({groupAttributes:e})}).catch(function(e){return c.setError(e).end(),C(e)});c.setMoreMessage("get attributes from cache").end(),v.l("".concat(o," from cache. groupID:").concat(i));s=this._getCachedAttributes(t);return kn({groupAttributes:s})}},{key:"_getGroupAttributes",value:function(o){var i=this,e=0;return A(o.avChatRoomKey)||(e=1),this._grpM.req({P:I.GET_GRP_ATTR,data:y(y({},o),{},{groupType:e})}).then(function(e){v.l("".concat(i._n,"._getGroupAttributes ok. groupID:").concat(o.groupID));var e=e.data,t=e.mainSequence,e=e.groupAttributeList,n=D(e);return A(t)||i._refreshCachedGroupAttributes({groupID:o.groupID,remoteMainSequence:t,groupAttributeList:n,operationType:5}),e}).catch(function(e){return C(e)})}},{key:"_refreshCachedGroupAttributes",value:function(e){var t=e.groupID,n=e.remoteMainSequence,o=e.groupAttributeList,e=e.operationType;if(this._hasLocalGroupAttributes(t)){var i=this._getLocalGroupAttributes(t),a=i.localMainSequence;if(5===e||n-a==1)i.remoteMainSequence=n,i.localMainSequence=n,i.lastUpdateTime=Date.now(),this._updateCachedAttributes({groupAttributes:i,groupAttributeList:o,operationType:e});else{if(a===n)return;i.remoteMainSequence=n}this._groupAttributesMap.set(t,i);o="operationType:".concat(e," localMainSequence:").concat(a," remoteMainSequence:").concat(n);v.l("".concat(this._n,"._refreshCachedGroupAttributes. ").concat(o))}}},{key:"_getCachedAttributes",value:function(e){var t=e.groupID,e=e.keyList,e=void 0===e?[]:e,n={};if(this._hasLocalGroupAttributes(t)){var o=this._getLocalGroupAttributes(t).attributes;if(0<e.length)e.forEach(function(e){o.has(e)&&(n[e]=o.get(e).value)});else{var i,a=N(o.keys());try{for(a.s();!(i=a.n()).done;){var s=i.value;n[s]=o.get(s).value}}catch(e){a.e(e)}finally{a.f()}}}return n}},{key:"_updateCachedAttributes",value:function(e){var o=e.groupAttributes,t=e.groupAttributeList,e=e.operationType;3!==e?4!==e?(1===e&&o.attributes.clear(),t.forEach(function(e){var t=e.key,n=e.value,e=e.sequence;o.attributes.set(t,{value:n,sequence:e})})):t.forEach(function(e){o.attributes.delete(e.key)}):o.attributes.clear()}},{key:"_hasLocalGroupAttributes",value:function(e){return this._groupAttributesMap.has(e)}},{key:"_getLocalGroupAttributes",value:function(e){return this._hasLocalGroupAttributes(e)||this.initGroupAttributesCache({groupID:e}),this._groupAttributesMap.get(e)}},{key:"_transformGroupAttributes",value:function(t){var n=[];return Object.keys(t).forEach(function(e){n.push({key:e,value:t[e]})}),n}},{key:"_emitGroupAttributesUpdated",value:function(e){var t=this._getCachedAttributes({groupID:e}),n=this._computeAttrChangedInfo(t),o=n.updatedKeyList,n=n.deletedKeyList;v.l("".concat(this._n,"._emitGroupAttributesUpdated update:").concat(o.length,", delete:").concat(n.length)),0===o.length&&0===n.length||this._grpM.emitOEvt(G.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t,updatedKeyList:o,deletedKeyList:n})}},{key:"_computeAttrChangedInfo",value:function(t){var n=this,o=[],i=[];return Object.keys(t).forEach(function(e){t[e]!==n._groupAttributesCopy[e]&&o.push(e)}),Object.keys(this._groupAttributesCopy).forEach(function(e){A(t[e])&&i.push(e)}),this._groupAttributesCopy={},{updatedKeyList:o,deletedKeyList:i}}},{key:"deleteLocalGroupAttributes",value:function(e){this._hasLocalGroupAttributes(e)&&this._groupAttributesMap.delete(e)}},{key:"reset",value:function(){this._groupAttributesMap.clear(),this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4}}]),ta),Ii=(e(ea,[{key:"_onCloudConfig",value:function(){var e=this._grpM.getCloudConfig("grp_counter_expire_time");A(e)||(this.EXPIRE_TIME=Number(e))}},{key:"isGroupCountersNotice",value:function(e){var t=e.to,e=e.elements.groupCounterInfo,n=!1;return Je(e)||(this._onGroupCountersUpdated({groupID:t,groupCounterInfo:e}),n=!0),n}},{key:"_onGroupCountersUpdated",value:function(e){var o=this,i=e.groupID;e.groupCounterInfo.forEach(function(e){var t=e.type,n=e.groupCounterSeq,e=e.counterList,e=void 0===e?[]:e;0!==t&&2!==t||(o._updateLocalGroupCounters({groupID:i,groupCounterSeq:n,counterList:e}),e.forEach(function(e){o._grpM.emitOEvt(G.GROUP_COUNTER_UPDATED,{groupID:i,key:e.key,value:e.value})})),1===t&&o._deleteLocalGroupCounters({groupID:i,groupCounterSeq:n,counterList:e})}),v.l("".concat(this._n,"._onGroupCountersUpdated groupID:").concat(i))}},{key:"initGroupCountersCache",value:function(e){var t=e.groupID,e=e.avChatRoomKey;this._groupCountersMap.set(t,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:e}),v.l("".concat(this._n,".initGroupCountersCache groupID:").concat(t," avChatRoomKey:").concat(e))}},{key:"setGroupCounters",value:function(e){if(!this._grpM.canIUse(H.GRP_COUNTER))return this._grpM.noUse("setGroupCounters");var t="".concat(this._n,".").concat("setGroupCounters"),n=e.groupID,e=e.counters,e=this._convertObjectToList(e),o=this._getLocalGroupCounters(n).avChatRoomKey,i="groupID:".concat(n," count:").concat(e.length),a=new M("setGroupCounters");return a.setMessage("".concat(i)),v.l("".concat(t,". ").concat(i)),this._updateGroupCounters({groupID:n,counterList:e,avChatRoomKey:o,mode:"Set"}).then(function(e){return a.end(),v.l("".concat(t," ok.")),Sn({counters:e})}).catch(function(e){return a.setError(e).end(),v.e("".concat(t," failed. error:"),e),C(e)})}},{key:"increaseGroupCounter",value:function(e){var t="increaseGroupCounter";if(!this._grpM.canIUse(H.GRP_COUNTER))return this._grpM.noUse(t);var n="".concat(this._n,".").concat(t),o=e.groupID,i=e.key,e=e.value,a=this._getLocalGroupCounters(o).avChatRoomKey,s="groupID:".concat(o," key:").concat(i," value:").concat(e),r=new M(t);return r.setMessage("".concat(s)),v.l("".concat(n,". ").concat(s)),this._updateGroupCounters({groupID:o,counterList:[{key:i,value:e}],avChatRoomKey:a,mode:"Increase"}).then(function(e){return r.end(),v.l("".concat(n," ok.")),Sn({counters:e})}).catch(function(e){return r.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"decreaseGroupCounter",value:function(e){var t="decreaseGroupCounter";if(!this._grpM.canIUse(H.GRP_COUNTER))return this._grpM.noUse(t);var n="".concat(this._n,".").concat(t),o=e.groupID,i=e.key,e=e.value,a=this._getLocalGroupCounters(o).avChatRoomKey,s="groupID:".concat(o," key:").concat(i," value:").concat(e),r=new M(t);return r.setMessage("".concat(s)),v.l("".concat(n,". ").concat(s)),this._updateGroupCounters({groupID:o,counterList:[{key:i,value:e}],avChatRoomKey:a,mode:"Decrease"}).then(function(e){return r.end(),v.l("".concat(n," ok.")),Sn({counters:e})}).catch(function(e){return r.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"getGroupCounters",value:function(e){var t=this;if(!this._grpM.canIUse(H.GRP_COUNTER))return this._grpM.noUse("getGroupCounters");var n="".concat(this._n,".").concat("getGroupCounters"),o=e.groupID,e=e.keyList,i=void 0===e?[]:e,e=this._getLocalGroupCounters(o),a=e.avChatRoomKey,e=e.lastUpdateTime,s=new M("getGroupCounters");if(s.setMessage("groupID:".concat(o)),Date.now()-e>=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:o,avChatRoomKey:a}).then(function(e){s.setMoreMessage("from remote. count:".concat(e.length)).end(),v.l("".concat(n," from remote. groupID:").concat(o));e=t._getLocalCounters(o,i);return Sn({counters:e})}).catch(function(e){return s.setError(e).end(),C(e)});s.setMoreMessage("from cache").end(),v.l("".concat(n," from cache. groupID:").concat(o));e=this._getLocalCounters(o,i);return kn({counters:e})}},{key:"_getRemoteGroupCounters",value:function(n){var o=this;return this._grpM.req({P:I.GET_GRP_COUNTER,data:y({},n)}).then(function(e){var e=e.data,t=e.counterList,t=void 0===t?[]:t,e=e.groupCounterSeq;return o._updateLocalGroupCounters({groupID:n.groupID,counterList:t,groupCounterSeq:e}),v.l("".concat(o._n,"._getRemoteGroupCounters ok. groupID:").concat(n.groupID)),t}).catch(function(e){return C(e)})}},{key:"_convertObjectToList",value:function(t){var n=[];return Object.keys(t).forEach(function(e){n.push({key:e,value:t[e]})}),n}},{key:"_updateGroupCounters",value:function(e){var t="".concat(this._n,"._updateGroupCounters"),n=e.groupID,o=e.avChatRoomKey,i=e.mode;return v.l("".concat(t,". groupID:").concat(n," avChatRoomKey:").concat(o," mode:").concat(i)),this._grpM.req({P:I.UPDATE_GRP_COUNTER,data:y({},e)}).then(function(e){v.l("".concat(t," ok."));var e=e.data.counterList,n={};return(void 0===e?[]:e).forEach(function(e){var t=e.key,e=e.value;n[t]=e}),n}).catch(function(e){return C(e)})}},{key:"_hasLocalGroupCounters",value:function(e){return this._groupCountersMap.has(e)}},{key:"_getLocalGroupCounters",value:function(e){return this._hasLocalGroupCounters(e)||this.initGroupCountersCache({groupID:e}),this._groupCountersMap.get(e)}},{key:"_updateLocalGroupCounters",value:function(e){var n,t,o,i=e.groupID,a=e.counterList,a=void 0===a?[]:a,e=e.groupCounterSeq;this._hasLocalGroupCounters(i)&&(o=this._getLocalGroupCounters(i),n=o.counters,t=o.avChatRoomKey,o=o.groupCounterSeq,0<e&&e<o||(a.forEach(function(e){var t=e.key,e=e.value;n.set(t,e)}),this._groupCountersMap.set(i,{lastUpdateTime:Date.now(),groupCounterSeq:e,counters:n,avChatRoomKey:t})))}},{key:"_deleteLocalGroupCounters",value:function(e){var t,n,o=e.groupID,i=e.counterList,i=void 0===i?[]:i,e=e.groupCounterSeq;this._hasLocalGroupCounters(o)&&(n=this._getLocalGroupCounters(o),t=n.counters,n=n.avChatRoomKey,i.forEach(function(e){t.delete(e.key)}),this._groupCountersMap.set(o,{lastUpdateTime:Date.now(),groupCounterSeq:e,counters:t,avChatRoomKey:n}))}},{key:"_getLocalCounters",value:function(e,t){var n={};if(!this._hasLocalGroupCounters(e))return n;var o=this._getLocalGroupCounters(e).counters;if(0<t.length)t.forEach(function(e){o.has(e)&&(n[e]=o.get(e))});else{var i,a=N(o.keys());try{for(a.s();!(i=a.n()).done;){var s=i.value;n[s]=o.get(s)}}catch(e){a.e(e)}finally{a.f()}}return n}},{key:"reset",value:function(){this._groupCountersMap.clear(),this.EXPIRE_TIME=3e4}}]),ea),Mi=(e($i,[{key:"start",value:function(){var e=this._grpM.isLoggedIn();e||(this._proto=I.AV_NOAUTH_POLLING),v.l("".concat(this._n,".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 t=this,e=this._onInit(this._groupID);this._grpM.req({P:this._proto,data:e}).then(function(e){t._onSuccess(t._groupID,e),t.isRunning()&&(-1<t._timeoutID&&clearTimeout(t._timeoutID),t._timeoutID=setTimeout(t._request.bind(t),t._manager.getPollingInterval()))}).catch(function(e){t._onFail(t._groupID,e),t.isRunning()&&(-1<t._timeoutID&&clearTimeout(t._timeoutID),t._timeoutID=setTimeout(t._request.bind(t),t._manager.MAX_POLLING_INTERVAL))})}},{key:"stop",value:function(){v.l("".concat(this._n,".stop")),-1<this._timeoutID&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}},{key:"getPollingTimerID",value:function(){return this._timeoutID}}]),$i),yi={3:!0,4:!0,5:!0,6:!0,17:!0,20:!0,21:!0,100:!0},Ci=(e(Qi,[{key:"hasJoinedAVChatRoom",value:function(){var e=[];return 0<(e=0<this._joinedGroupMap.size?D(this._joinedGroupMap.values()).filter(function(e){return e.type===R.GRP_AVCHATROOM}):e).length}},{key:"getJoinedLiveList",value:function(){var e=[];return e=0<this._joinedGroupMap.size?D(this._joinedGroupMap.values()).filter(function(e){return e.type===R.GRP_LIVE}):e}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._joinedGroupMap.has(e)}},{key:"getJoinedAVChatRoom",value:function(){return 0<this._joinedGroupMap.size?D(this._joinedGroupMap.keys()):[]}},{key:"_updatedata",value:function(e){var t=this._pollingRequestInfoMap.get(e);return e===D(this._pollingInstanceMap.keys())[0]?y(y({},t),{},{startBroadcastSeq:this._startBroadcastSeq,simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG}):y(y({},t),{},{simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG})}},{key:"_handleSuccess",value:function(e,t){var n,o=t.data,i=o.key,a=o.nextSeq,s=o.rspMsgList,r=o.errorCode,c=o.nextBroadcastSeq,o=o.broadcastMessageList;0!==r?(r=this._pollingRequestInfoMap.get(e),n=new M("longPollingAVError"),r=r?"".concat(r.key,"-").concat(r.startSeq):"requestInfo is undefined",n.setMessage("".concat(e,"-").concat(r,"-").concat(t.errorInfo)).setCode(t.errorCode).end(!0)):this.checkJoinedAVChatRoomByID(e)&&(ft(i)&&Qe(a)&&this._pollingRequestInfoMap.set(e,{key:i,startSeq:a}),Qe(c)&&c>this._startBroadcastSeq&&(this._startBroadcastSeq=c),nt(s)&&0<s.length?(s.forEach(function(e){e.to=e.groupID}),this.onMessage(s,e)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(o))}},{key:"_handleFailure",value:function(e,t){}},{key:"onMessage",value:function(e,t){if(nt(e)&&0!==e.length){var n="".concat(this._n,".onMessage"),o=(t&&(n+=" groupID:".concat(t)),0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL),null),i=[],l=this._get(11),a=this._get(26),d=e.length,p=(1<d&&e.sort(function(e,t){return e.sequence-t.sequence}),this._get(12).isUnlimitedAVChatRoom()),s=!1;v.getLevel()<=0&&(t=e.map(function(e){return e.sequence}),v.l("".concat(n," count:").concat(t.length," sequenceList:").concat(t)),t.length=0);for(var _=0;_<d;_++){var r=this.restoreMessageFromSimplified(e[_]);if(yi[r.event]){if(6===r.event){if(this._grpM.isGroupAttributesUpdatedNotice(r))continue;if(this._grpM.isGroupCountersNotice(r))continue}if(20!==r.event)if(21!==r.event)if(100!==r.event){var o=this.packMessage(r,r.event),c=1===r.isModified,s=1===r.isHistoryMessage;if(!p){if(this._seqSll.has(o.sequence))continue;this._seqSll.set(o.sequence)}var u=this._IDSll.has(o.ID);u?v.w("".concat(n," ID:").concat(o.ID," has:").concat(u)):(this._IDSll.set(o.ID),u=!1,!s&&this._isMessageSentByCurrentInstance(o)?c&&(u=!0,o.isModified=c,l.updateMsgIsModifiedProp(o)):u=!0,u&&(o.conversationType===R.CONV_SYSTEM&&5===o.payload.operationType&&this._onGroupDismissed(o.payload.groupProfile.groupID),s||o.conversationType===R.CONV_SYSTEM||(c=o.conversationID.replace(R.CONV_GROUP,""),this._pollingInstanceMap.has(c)?this._grpM.isLoggedIn()&&a.addMessageSequence({key:eo,message:o}):(o.type!==R.MSG_GRP_TIP&&0<o.clientTime&&a.addMessageDelay(o.clientTime),a.addMessageSequence({key:$n,message:o}))),i.push(o)))}else this.onRoomCustomData(r);else this._get(34).onMessageReactionNotify({event:21,dataList:r.elements.messageReactionNotifyList});else this.handleMessageRevokedNotice(r)}else v.w("".concat(n,". unknown event:").concat(r.event))}0!==i.length&&(0<(t=Dt(i)).length&&this._grpM.emitOEvt(G.MESSAGE_MODIFIED,t),s||0<(t=this.packConversationOption(i)).length&&l.onNewMessage({conversationOptionsList:t,isInstantMessage:!0}),this._checkMessageStacked(i),0<(t=Lt(i)).length&&this._grpM.emitOEvt(G.MESSAGE_RECEIVED,t),i.length=0)}}},{key:"handleMessageRevokedNotice",value:function(e){var t=this,i=e.groupID,n=e.elements.revokeMsgList,a=e.revokerInfo,s=[];n.forEach(function(e){var t=e.tinyID,n=e.clientTime,o=e.random,e=e.sequence,t={conversationID:"".concat(R.CONV_GROUP).concat(i),ID:"".concat(t,"-").concat(n,"-").concat(o),revoker:a.revoker,revokeReason:a.reason||"",revokerInfo:{userID:a.revoker,nick:"",avatar:""},sequence:e};s.push(t)}),0!==s.length&&this._get(11).updateRevokerInfo(s).then(function(e){t._grpM.emitOEvt(G.MESSAGE_REVOKED,e)})}},{key:"isBroadcastOrNormal",value:function(e){return 3===e||17===e}},{key:"isGroupTip",value:function(e){return 4===e||6===e}},{key:"isGroupSystemNotice",value:function(e){return 5===e}},{key:"restoreGroupTipElements",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.operatorInfo,t=void 0===t?{}:t,n=e.operatorID,o=e.userIDList,o=void 0===o?[]:o,i=e.operationType,i=(Qe(e.groupJoinType)||1!==i&&2!==i||(e.groupJoinType=2===i?0:1),t.userID),a=t.avatar,t=t.nick,n=(e.operatorInfo={userID:void 0===i?n:i,avatar:void 0===a?"":a,nick:void 0===t?"":t},o.map(function(e){return{userID:e}}));return e.memberInfoList=e.memberInfoList||n,e}},{key:"restoreMessageFromSimplified",value:function(n){var e,t,o,i=n.event;return this.isBroadcastOrNormal(i)&&(n.cloudCustomData=n.cloudCustomData||"",n.elements=n.elements.map(function(e){var t;return e.type===R.MSG_CUSTOM&&(t=e.content,e.content=y({data:"",description:"",extension:""},void 0===t?{}:t)),e})),(this.isGroupTip(i)||this.isGroupSystemNotice(i))&&(n.from=n.from||"@TIM#SYSTEM"),this.isGroupTip(i)&&(n.elements=this.restoreGroupTipElements(n.elements),t=(o=void 0===(o=n.elements)?{}:o).operationType,e=o.operatorInfo,1===t&&(t=[{userID:(void 0===e?{}:e).userID}],o.memberInfoList=o.memberInfoList||t)),this.isGroupSystemNotice(i)&&(o=(e=n.elements).memberInfoList,t=e.operatorInfo,n.elements.memberInfoList=y({userID:n.elements.operatorID,avatar:"",nick:""},o=o||(void 0===t?{}:t)),n.elements=y({authentication:"",remarkInfo:"",messageKey:1e3*n.time},n.elements),i=Object.keys(n.elements).filter(function(e){return"operatorInfo"!==e}).reduce(function(e,t){return y(y({},e),{},c({},t,n.elements[t]))},{}),n.elements=i),n}},{key:"_onGroupDismissed",value:function(e){v.l("".concat(this._n,"._onGroupDismissed groupID:").concat(e)),this._grpM.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"_checkMessageStacked",value:function(e){var t="MessageStacked",e=e.length;100<=e&&(this._grpM.warn(t,e),this._reportMessageStackedCount<5&&(new M(t).setMessage("count:".concat(e," groupID:").concat(D(this._joinedGroupMap.keys()))).setLevel("warning").end(),this._reportMessageStackedCount+=1))}},{key:"_isMessageSentByCurrentInstance",value:function(e){return!!this._get(11).isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(e,t){e.currentUser=this._grpM.getMyUserID(),e.conversationType=5===t?R.CONV_SYSTEM:R.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var n=new Ro(e),e=this.packElements(e,t),t=this._grpM.getFileDownloadProxy(),o=this._grpM.getDowloadFileAuthKey(),i=this._get(17).getFileDNList();return n.setElement(e,t,o,i),n}},{key:"packElements",value:function(e,t){return 4===t||6===t?(this._updateMemberCountByGroupTips(e),{type:R.MSG_GRP_TIP,content:y(y({},e.elements),{},{groupProfile:e.groupProfile})}):5===t?{type:R.MSG_GRP_SYS_NOTICE,content:y(y({},e.elements),{},{groupProfile:y(y({},e.groupProfile),{},{groupID:e.groupID})})}:e.elements}},{key:"packConversationOption",value:function(e){for(var t=new Map,n=0;n<e.length;n++){var o,i=e[n],a=i.conversationID;t.has(a)?"in"===((o=t.get(a)).lastMessage=i).flow&&o.unreadCount++:t.set(a,{conversationID:i.conversationID,unreadCount:"out"===i.flow?0:1,type:i.conversationType,subType:i.conversationSubType,lastMessage:i})}return D(t.values())}},{key:"_updateMemberCountByGroupTips",value:function(e){var t,n,o,i=e.groupProfile.groupID,e=e.elements.onlineMemberInfo,e=void 0===e?void 0:e;Je(e)||(t=void 0===(t=e.onlineMemberNum)?0:t,e=void 0===(e=e.expireTime)?this.DEFAULT_EXPIRE_TIME:e,n=this._onlineMemberCountMap.get(i)||{},o=Date.now(),Je(n)?Object.assign(n,{lastReqTime:0,lastSyncTime:0,latestUpdateTime:o,memberCount:t,expireTime:e}):(n.latestUpdateTime=o,n.memberCount=t),this._onlineMemberCountMap.set(i,n))}},{key:"_onBroadcastMessage",value:function(e){if(!Je(e)){for(var t=[],n=e.length,o=null,i=0;i<n;i++){var a=this.restoreMessageFromSimplified(e[i]);yi[a.event]?((o=this.packMessage(a,a.event)).isBroadcastMessage=!0,this._broadcastMessageIDMap.has(o.ID)||(t.push(o),this._broadcastMessageIDMap.set(o.ID,1))):v.w("".concat(this._n,"._onBroadcastMessage unknown event:").concat(a.event))}0<t.length&&this._grpM.emitOEvt(G.MESSAGE_RECEIVED,t)}}},{key:"start",value:function(e){var t;this._pollingInstanceMap.has(e)?(t=this._pollingInstanceMap.get(e)).isRunning()||t.start():((t=new Mi({manager:this,groupID:e,onInit:this._updatedata.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)})).start(),this._pollingInstanceMap.set(e,t),v.l("".concat(this._n,".start groupID:").concat(e)))}},{key:"handleJoinResult",value:function(o){var i=this;return this._preCheck(o.group).then(function(){var e=o.longPollingKey,t=o.group,n=t.groupID;return i._joinedGroupMap.set(n,t),i._grpM.updateGroupMap([t]),i._grpM.deleteUnjoinedAVChatRoom(n),i._grpM.emitGroupListUpdate(!0,!1),A(e)?kn({status:Ke,group:t}):Promise.resolve()})}},{key:"startRunLoop",value:function(i){var a=this;return this.handleJoinResult(i).then(function(){var e=i.longPollingKey,t=i.group,n=i.startSeq,o=t.groupID;return a._pollingRequestInfoMap.set(o,{key:e,startSeq:void 0===n?0:n}),a.start(o),a._grpM.isLoggedIn()?kn({status:Ke,group:t}):kn({status:Ke})})}},{key:"_preCheck",value:function(e){if(this._get(12).isUnlimitedAVChatRoom())return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();if(e.type===R.GRP_LIVE)return Promise.resolve();var e=m(this._joinedGroupMap.entries().next().value,2),t=e[0],e=e[1];if(this._grpM.isLoggedIn()){if(e.selfInfo.role!==R.GRP_MBR_ROLE_OWNER&&e.ownerID!==this._grpM.getMyUserID())return this._grpM.quitGroup(t);this._grpM.deleteLocalGroupAndConversation(t)}else this._grpM.deleteLocalGroupAndConversation(t);return this.reset(t),Promise.resolve()}},{key:"joinWithoutAuth",value:function(e){var n=this,o=e.groupID,i="".concat(this._n,".").concat("joinWithoutAuth"),a=new M("joinWithoutAuth");return this._grpM.req({P:I.APPLY_JOIN_GRP_NOAUTH,data:e}).then(function(e){e=e.data.longPollingKey;if(a.setMessage("groupID:".concat(o," longPollingKey:").concat(e)).end(!0),A(e))return C({code:T.CANNOT_JOIN_NON_AV_WITHOUT_LOGIN});v.l("".concat(i," ok. groupID:").concat(o)),n._get(11).setCompleted("".concat(R.CONV_GROUP).concat(o));var t=new li({groupID:o});return n.startRunLoop({group:t,longPollingKey:e}),Sn({status:Ke})}).catch(function(e){return v.e("".concat(i," failed. groupID:").concat(o," error:"),e),a.setError(e).setMessage("groupID:".concat(o)).end(!0),C(e)}).finally(function(){n._grpM.get(14).reportAtOnce()})}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},n=Date.now();return Je(t)||n-t.lastSyncTime>1e3*t.expireTime&&1e4<n-t.latestUpdateTime&&3e3<n-t.lastReqTime?(t.lastReqTime=n,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then(function(e){return Sn({memberCount:e.memberCount})}).catch(function(e){return C(e)})):kn({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(i){var a=this,s="".concat(this._n,".").concat("_getGroupOnlineMemberCount"),t=new M("_getGroupOnlineMemberCount");return this._grpM.requestOnlineCount(i).then(function(e){var t=a._onlineMemberCountMap.get(i)||{},e=e.data,n=e.memberCount,n=void 0===n?0:n,e=e.expireTime,e=void 0===e?a.DEFAULT_EXPIRE_TIME:e,o=(v.l("".concat(s," ok. groupID:").concat(i," memberCount:").concat(n," expireTime:").concat(e)),Date.now());return Je(t)&&(t.lastReqTime=o),a._onlineMemberCountMap.set(i,Object.assign(t,{lastSyncTime:o,latestUpdateTime:o,memberCount:n,expireTime:e})),{memberCount:n}}).catch(function(e){return v.w("".concat(s," failed. error:"),e),t.setCode(e.code).setMessage("groupID:".concat(i," error:").concat(JSON.stringify(e))).end(),Promise.reject(e)})}},{key:"_get",value:function(e){return this._grpM.get(e)}},{key:"setPollingInterval",value:function(e){A(e)||(Qe(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:"setPollingIntervalPlus",value:function(e){A(e)||(Qe(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:"setPollingNoMessageCount",value:function(e){A(e)||(Qe(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:"setPollingSimplifiedMessage",value:function(e){A(e)||"0"!==e&&"1"!==e||(this.DEFAULT_POLLING_SIMPLIFIED_MSG=parseInt(e,10))}},{key:"getPollingInterval",value:function(){return this._pollingInterval}},{key:"onAVChatRoomMemberBanned",value:function(e){e=e.payload.groupProfile.groupID;v.l("".concat(this._n,".onAVChatRoomMemberBanned groupID:").concat(e)),this._grpM.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"restartPolling",value:function(){v.l("".concat(this._n,".restartPolling count:").concat(this._pollingInstanceMap.size));var e,t=N(this._pollingInstanceMap.values());try{for(t.s();!(e=t.n()).done;){var n=e.value;n.stop(),n.start()}}catch(e){t.e(e)}finally{t.f()}}},{key:"getPollingTimerID",value:function(e){if(!this._pollingInstanceMap.has(e))return-1;var t=this._pollingInstanceMap.get(e).getPollingTimerID();return v.l("".concat(this._n,".getPollingTimerID groupID:").concat(e," timerID:").concat(t)),t}},{key:"hasPollingInstance",value:function(e){return this._pollingInstanceMap.has(e)}},{key:"onRoomCustomData",value:function(e){var t=e.groupID,n=e.sequence,o=e.time,e=e.elements,e=e&&e.content;this._get(30).onRoomCustomDataReceived(e),v.l("".concat(this._n,".onRoomCustomData groupID:").concat(t," sequence:").concat(n," time:").concat(o," data:").concat(e))}},{key:"reset",value:function(e){if(e){v.l("".concat(this._n,".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{v.l("".concat(this._n,".reset all"));var n,o=N(this._pollingInstanceMap.values());try{for(o.s();!(n=o.n()).done;)n.value.stop()}catch(e){o.e(e)}finally{o.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this._seqSll.reset(),this._IDSll.reset(),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}}]),Qi),Ti=(e(Zi,[{key:"updateMember",value:function(e){A(e.onlineStatus)||(this.isOnline="Online"===e.onlineStatus);var t=[null,void 0,"",0,NaN];e.memberCustomField&&Tt(this.memberCustomField,e.memberCustomField),rt(this,e,["memberCustomField","marks","onlineStatus"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){A(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){A(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&Tt(this.memberCustomField,e)}}]),Zi),Di=(e(Xi,[{key:"_onProfileUpdated",value:function(e){for(var n=this,o=e.data,t=0;t<o.length;t++)!function(e){var t=o[e];n.groupMemberListMap.forEach(function(e){e.has(t.userID)&&e.get(t.userID).updateMember({nick:t.nick,avatar:t.avatar})})}(t)}},{key:"deleteGroupMemberList",value:function(e){this.groupMemberListMap.delete(e)}},{key:"getGroupMemberList",value:function(e){var t,o=this,i=e.groupID,n=e.role,n=void 0===n?void 0:n,a=e.offset,s=void 0===a?0:a,a=e.count,r=void 0===a?15:a,a=e.filter,e=void 0===a?void 0:a,c="".concat(this._n,".").concat("getGroupMemberList"),a=this._grpM.hasLocalGroup(i);if(v.l("".concat(c," groupID:").concat(i," role:").concat(n," offset:").concat(s," count:").concat(r," hasLocalGroup:").concat(a)),!a)return kn({memberList:[],offset:0});if(this._grpM.getLocalGroupProfile(i).type===R.GRP_AVCHATROOM){if(this._grpM.canIUse(H.AV_MBR_LIST))return this._getAVChatRoomMemberList({groupID:i,offset:s,filter:e});this._grpM.warn("LiveOnlineMember")}n!==R.GRP_MBR_ROLE_ADMIN&&n!==R.GRP_MBR_ROLE_OWNER&&n!==R.GRP_MBR_ROLE_MEMBER||(t=n);var l=new M("getGroupMemberList"),u=0,a={groupID:i,limit:100<r?100:r,memberRoleFilter:t?[t]:void 0,memberInfoFilter:this.DEFAULT_MEMBER_INFO_FILTER},d=(kt({groupID:i})?a.next="".concat(s):(a.offset=s,u=s+r),[]);return this._grpM.req({P:I.GET_GRP_MBR_LIST,data:a}).then(function(e){var e=e.data,t=e.members,n=e.memberNum,e=e.next,e=void 0===e?void 0:e;return A(e)||(u=Je(e)?0:e),nt(t)&&0!==t.length?(o._grpM.hasLocalGroup(i)&&(o._grpM.getLocalGroupProfile(i).memberNum=n),d=o._updateLocalGroupMemberMap(i,t),o._grpM.get(4).getUserProfile({userIDList:t.map(function(e){return e.userID}),tagList:[qe.NICK,qe.AVATAR]})):(u=0,Promise.resolve([]))}).then(function(e){e=e.data;if(!nt(e)||0===e.length)return kn({memberList:[],offset:u});e=e.map(function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}});return o._updateLocalGroupMemberMap(i,e),d.length<r&&(u=0),l.setMessage("groupID:".concat(i," offset:").concat(s," count:").concat(r)).end(),v.l("".concat(c," ok.")),Sn({memberList:d,offset:u})}).catch(function(e){return l.setError(e).end(),v.e("".concat(c," failed. error:"),e),C(e)})}},{key:"_getAVChatRoomMemberList",value:function(e){var n=this,o=e.groupID,t=e.offset,e=e.filter,i="".concat(this._n,".").concat("_getAVChatRoomMemberList"),a=new M("_getAVChatRoomMemberList");return a.setMessage("groupID:".concat(o," offset:").concat(t," filter:").concat(e)),this._grpM.req({P:I.GET_AV_MBR_LIST,data:{groupID:o,offset:t,filter:e}}).then(function(e){var e=e.data,t=e.memberList,t=void 0===t?[]:t,e=e.offset,e=void 0===e?0:e,t=(a.end(),v.l("".concat(i," ok. member count:").concat(t.length,", next request timestamp:").concat(e)),t.map(function(e){return y(y({},e),{},{onlineStatus:"Online"})})),t=n._updateLocalGroupMemberMap(o,t);return Sn({memberList:t,offset:e})}).catch(function(e){return a.setError(e).end(),v.e("".concat(i," failed. error:"),e),C(e)})}},{key:"getGroupMemberProfile",value:function(e){var t=this,n="getGroupMemberProfile",o="".concat(this._n,".").concat(n),i="groupID:".concat(e.groupID),a=(5<e.userIDList.length?i+=" userIDList.length:".concat(e.userIDList.length):i+=" userIDList:".concat(e.userIDList),v.l("".concat(o," ").concat(i)),50<e.userIDList.length&&(e.userIDList=e.userIDList.slice(0,50)),e.groupID),s=e.userIDList,o=this._grpM.getLocalGroupProfile(a);if(o&&St(o.type))return C({code:o=T.OPERATION_NOT_SUPPORTED_IN_AV,message:this._grpM.getErrMsg(o,n)});var r=new M(n);return r.setMessage(i),this._getGroupMemberProfileAdvance(y(y({},e),{},{userIDList:s})).then(function(e){e=e.data.members;return nt(e)&&0!==e.length?(t._updateLocalGroupMemberMap(a,e),t._grpM.get(4).getUserProfile({userIDList:e.map(function(e){return e.userID}),tagList:[qe.NICK,qe.AVATAR]})):kn([])}).then(function(e){e=e.data.map(function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}),t._updateLocalGroupMemberMap(a,e),e=s.filter(function(e){return t.hasLocalGroupMember(a,e)}).map(function(e){return t.getLocalGroupMemberInfo(a,e)});return r.end(),Sn({memberList:e})})}},{key:"addGroupMember",value:function(a){var s=this,r="".concat(this._n,".").concat("addGroupMember"),e=a.groupID,c=this._grpM.getLocalGroupProfile(e),t=c.type,u=new M("addGroupMember");return u.setMessage("groupID:".concat(e," groupType:").concat(t)),St(t)?(t=new Bn({code:T.CANNOT_ADD_MEMBER_IN_AV}),u.setError(t).end(),C(t)):(a.userIDList=a.userIDList.map(function(e){return{userID:e}}),v.l("".concat(r," groupID:").concat(e)),this._grpM.req({P:I.ADD_GRP_MBR,data:a}).then(function(e){var e=e.data.members,t=(v.l("".concat(r," ok")),e.filter(function(e){return 1===e.result}).map(function(e){return e.userID})),n=e.filter(function(e){return 0===e.result}).map(function(e){return e.userID}),o=e.filter(function(e){return 2===e.result}).map(function(e){return e.userID}),e=e.filter(function(e){return 4===e.result}).map(function(e){return e.userID}),i="groupID:".concat(a.groupID,", ")+"successUserIDList:".concat(t,", ")+"failureUserIDList:".concat(n,", ")+"existedUserIDList:".concat(o,", ")+"overLimitUserIDList:".concat(e);return u.setMoreMessage(i).end(),0===t.length?Sn({successUserIDList:t,failureUserIDList:n,existedUserIDList:o,overLimitUserIDList:e}):(s._updateConvGroupProfile(c),Sn({successUserIDList:t,failureUserIDList:n,existedUserIDList:o,overLimitUserIDList:e,group:c}))}).catch(function(e){return u.setError(e).end(),v.e("".concat(r," failed. error:"),e),C(e)}))}},{key:"deleteGroupMember",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteGroupMember"),o=e.groupID,i=e.userIDList,a=this._grpM.getLocalGroupProfile(o);if(A(a))return C({code:T.CANNOT_FIND_GRP});if(St(a.type))return this._grpM.canIUse(H.AV_BAN_MBR)?this._banAVChatRoomMember(e):this._grpM.noUse("deleteGroupMember");var s="groupID:".concat(o," ").concat(5<i.length?"userIDList.length:".concat(i.length):"userIDList:".concat(i)),r=(v.l("".concat(n," groupID:").concat(o," userIDList:"),i),new M("deleteGroupMember"));return r.setMessage(s),this._grpM.req({P:I.DEL_GRP_MBR,data:e}).then(function(){return r.end(),v.l("".concat(n," ok")),t._updateConvGroupProfile(a),t.deleteLocalGroupMembers(o,i),Sn({group:a,userIDList:i})}).catch(function(e){return r.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"_updateConvGroupProfile",value:function(e){this._grpM.get(11).updateConvGroupProfile([e])}},{key:"_banAVChatRoomMember",value:function(e){var t=this,n="".concat(this._n,".").concat("_banAVChatRoomMember"),o=e.groupID,i=e.userIDList,a="groupID:".concat(o," ").concat(5<i.length?"userIDList.length:".concat(i.length):"userIDList:".concat(i)),s=new M("_banAVChatRoomMember"),r=(s.setMessage(a),v.l("".concat(n," groupID:").concat(o," userIDList:"),i),this._grpM.getLocalGroupProfile(o));return A(e.duration)||0===e.duration?C({code:T.BAN_DURATION_INVALID}):this._grpM.req({P:I.BAN_AV_MBR,data:e}).then(function(){return s.end(),v.l("".concat(n," ok")),t.deleteLocalGroupMembers(o,i),Sn({group:r,userIDList:i})}).catch(function(e){return s.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"setGroupMemberMuteTime",value:function(e){var n=this,o=e.groupID,t=e.userID,e=e.muteTime,i="".concat(this._n,".").concat("setGroupMemberMuteTime");if(t===this._grpM.getMyUserID())return C({code:T.CANNOT_MUTE_SELF});var a="groupID:".concat(o," userID:").concat(t," muteTime:").concat(e),s=(v.l("".concat(i," ").concat(a)),new M("setGroupMemberMuteTime"));return s.setMessage(a),this.modifyGroupMemberInfo({groupID:o,userID:t,muteTime:e}).then(function(e){s.end(),v.l("".concat(i," ok"));var t=n._grpM.getLocalGroupProfile(o);return Sn({group:t,member:e})}).catch(function(e){return s.setError(e).end(),v.e("".concat(i," failed. error:"),e),C(e)})}},{key:"setGroupMemberRole",value:function(e){var t="".concat(this._n,".").concat("setGroupMemberRole"),n=e.groupID,o=e.userID,e=e.role,i="groupID:".concat(n," userID:").concat(o," role:").concat(e),a=this._grpM.getLocalGroupProfile(n);if(a&&a.selfInfo.role!==R.GRP_MBR_ROLE_OWNER)return C({code:T.NOT_OWNER});var s=[R.GRP_MBR_ROLE_ADMIN,R.GRP_MBR_ROLE_MEMBER];if(kt({groupID:n})&&s.push(R.GRP_MBR_ROLE_CUSTOM),s.indexOf(e)<0)return C({code:T.INVALID_MEMBER_ROLE});if(o===this._grpM.getMyUserID())return C({code:T.CANNOT_SET_SELF_MEMBER_ROLE});var r=new M("setGroupMemberRole");return r.setMessage(i),v.l("".concat(t," ").concat(i)),this.modifyGroupMemberInfo({groupID:n,userID:o,role:e}).then(function(e){return r.end(),v.l("".concat(t," ok")),Sn({group:a,member:e})}).catch(function(e){return r.setError(e).end(),v.e("".concat(t," failed. error:"),e),C(e)})}},{key:"_filterProfanity",value:function(e,t){var n=this._grpM.get(29);if(!n)return!0;var n=n.filterText(t[e],"group_member_profile"),o=n.isAllowedToSend,n=n.modifiedText;return!0===o&&(t[e]=n,!0)}},{key:"setGroupMemberNameCard",value:function(e){var n=this,t="setGroupMemberNameCard",o="".concat(this._n,".").concat(t);if(e.nameCard&&!1===this._filterProfanity("nameCard",e))return C({code:T.PROFANITY_FOUND});var i=e.groupID,a=e.userID,s=void 0===a?this._grpM.getMyUserID():a,r=e.nameCard,a="groupID:".concat(i," userID:").concat(s," nameCard:").concat(r),e=(v.l("".concat(o," ").concat(a)),this._grpM.getLocalGroupProfile(i));if(e&&St(e.type))return C({code:e=T.OPERATION_NOT_SUPPORTED_IN_AV,message:this._grpM.getErrMsg(e,t)});var c=new M(t);return c.setMessage(a),this.modifyGroupMemberInfo({groupID:i,userID:s,nameCard:r}).then(function(e){v.l("".concat(o," ok")),c.end();var t=n._grpM.getLocalGroupProfile(i);return s===n._grpM.getMyUserID()&&t&&t.setSelfNameCard(r),Sn({group:t,member:e})}).catch(function(e){return c.setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"setGroupMemberCustomField",value:function(e){var n=this,t="setGroupMemberCustomField",o="".concat(this._n,".").concat(t),i=e.groupID,a=e.userID,a=void 0===a?this._grpM.getMyUserID():a,e=e.memberCustomField,s="groupID:".concat(i," userID:").concat(a," memberCustomField:").concat(JSON.stringify(e)),r=(v.l("".concat(o," ").concat(s)),this._grpM.getLocalGroupProfile(i));if(r&&St(r.type))return C({code:r=T.OPERATION_NOT_SUPPORTED_IN_AV,message:this._grpM.getErrMsg(r,t)});var c=new M(t);return c.setMessage(s),this.modifyGroupMemberInfo({groupID:i,userID:a,memberCustomField:e}).then(function(e){c.end(),v.l("".concat(o," ok"));var t=n._grpM.getLocalGroupProfile(i);return Sn({group:t,member:e})}).catch(function(e){return c.setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"modifyGroupMemberInfo",value:function(t){var n=this,o=t.groupID,i=t.userID,e=void 0;return Rt(o)&&(o=Kt(e=o)),this._grpM.req({P:I.MODIFY_GRP_MBR_INFO,data:y(y({},t),{},{groupID:o,topicID:e})}).then(function(){if(n.hasLocalGroupMember(o,i))return e=n.getLocalGroupMemberInfo(o,i),A(t.muteTime)||e.updateMuteUntil(t.muteTime),A(t.role)||e.updateRole(t.role),A(t.nameCard)||e.updateNameCard(t.nameCard),A(t.memberCustomField)||e.updateMemberCustomField(t.memberCustomField),e;var e=n._grpM.getLocalGroupProfile(o);return e&&!St(e.type)?n.getGroupMemberProfile({groupID:o,userIDList:[i]}).then(function(e){return m(e.data.memberList,1)[0]}):void 0})}},{key:"markGroupMemberList",value:function(e){var o="".concat(this._n,".").concat("markGroupMemberList"),t=e.groupID,n=e.markType,i=e.enableMark,e=e.userIDList,a=void 0===e?[]:e,e="groupID:".concat(t," markType:").concat(n," enableMark:").concat(i," userIDList count:").concat(a.length),s=(v.l("".concat(o," ").concat(e)),2),r=[],i=(!0===i&&(s=1),D(a)),c=(500<a.length&&(i=a.slice(0,500),v.w("".concat(o," ").concat(zt(500)))),i.forEach(function(e){r.push({userID:e,markType:[n]})}),i=null,new M("markGroupMemberList"));return c.setMessage(e),this._grpM.req({P:I.MARK_AV_MBR_INFO,data:{groupID:t,operationType:s,memberList:r}}).then(function(e){var e=e.data.memberList,e=void 0===e?[]:e,t=[],n=[],e=(e.length===a.length?t.push.apply(t,D(a)):(e.forEach(function(e){t.push(e.userID)}),a.forEach(function(e){t.includes(e)||n.push(e)})),"success count:".concat(t.length," fail count:").concat(n.length));return c.setMessage(e).end(),v.l("".concat(o," ok. ").concat(e)),Sn({successUserIDList:t,failureUserIDList:n})}).catch(function(e){return c.setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this._grpM.req({P:I.GET_GRP_MBR_PROFILE,data:y(y({},e),{},{memberInfoFilter:e.memberInfoFilter||this.DEFAULT_MEMBER_INFO_FILTER})})}},{key:"_updateLocalGroupMemberMap",value:function(t,e){var n=this;return nt(e)&&0!==e.length?e.map(function(e){return n.hasLocalGroupMember(t,e.userID)?n.getLocalGroupMemberInfo(t,e.userID).updateMember(e):n.setLocalGroupMember(t,new Ti(e)),n.getLocalGroupMemberInfo(t,e.userID)}):[]}},{key:"deleteLocalGroupMembers",value:function(e,t){var n=this.groupMemberListMap.get(e);n&&t.forEach(function(e){n.delete(e)})}},{key:"getLocalGroupMemberInfo",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:"setLocalGroupMember",value:function(e,t){this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).set(t.userID,t):(t=(new Map).set(t.userID,t),this.groupMemberListMap.set(e,t))}},{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()}}]),Xi),Ei=[17,18,20],Li=(e(zi,[{key:"onNewGroupSystemNotice",value:function(e){var t=e.dataList,n=e.isSyncingEnded,e=e.isInstantMessage,t=(v.d("".concat(this._n,".onReceiveSystemNotice count:").concat(t.length)),this._assembly({notifiesList:t,isInstantMessage:e})),o=t.eventDataList,t=t.result;0<o.length&&(this._grpM.get(11).onNewMessage({conversationOptionsList:o,isInstantMessage:e}),this._onReceivedGroupSystemNotice({result:t,isInstantMessage:e})),e?0<t.length&&this._grpM.emitOEvt(G.MESSAGE_RECEIVED,t):!0===n&&this._clearGroupSystemNotice()}},{key:"_assembly",value:function(e){for(var t=e.notifiesList,l=e.isInstantMessage,n=null,d=t.length,o=0,i=[],a={conversationID:R.CONV_SYSTEM,unreadCount:0,type:R.CONV_SYSTEM,subType:null,lastMessage:null},o=0;o<d;o++){var s=t[o],r=s.groupProfile,p=r.communityType,r=r.topicID,r=void 0===r?void 0:r,c=s.elements,u=c.topicIDList,u=void 0===u?void 0:u,c=c.operationType;if(!(2!==(void 0===p?0:p)||Je(r)&&Je(u))){if(Ei.includes(c)){this._handleTopicSystemNotice(s);continue}Je(r)||(s.to=r)}15!==s.elements.operationType&&(s.currentUser=this._grpM.getMyUserID(),s.conversationType=R.CONV_SYSTEM,s.conversationID=R.CONV_SYSTEM,(n=new Ro(s)).setElement({type:R.MSG_GRP_SYS_NOTICE,content:y(y({},s.elements),{},{groupProfile:y({},s.groupProfile)})}),n.isSystemMessage=!0,(1===n.sequence&&1===n.random||2===n.sequence&&2===n.random)&&(n.sequence=lt(),n.random=lt(),n.generateMessageID(),v.l("".concat(this._n,"._assembly regenerate ID:").concat(n.ID))),this._grpM.get(11).pushIntoNoticeResult(i,n)&&(l?a.unreadCount++:n.setIsRead(!0),a.subType=n.conversationSubType))}return a.lastMessage=i[i.length-1],{eventDataList:0<i.length?[a]:[],result:i}}},{key:"_clearGroupSystemNotice",value:function(){var a=this;this._getPendencyList().then(function(e){e.forEach(function(e){a.pendencyMap.set("".concat(e.from,"_").concat(e.groupID,"_").concat(e.to),e)});var e=a._grpM.get(11).getLocalMessageList(R.CONV_SYSTEM),i=[];e.forEach(function(e){var t=e.payload,n=t.operatorID,o=t.operationType,t=t.groupProfile;1===o&&(o="".concat(n,"_").concat(t.groupID,"_").concat(t.to),(n=a.pendencyMap.get(o))&&Qe(n.handled)&&0!==n.handled&&i.push(e))}),a.deleteGroupSystemNotice({messageList:i})})}},{key:"deleteGroupSystemNotice",value:function(e){var n=this,o="".concat(this._n,".deleteGroupSystemNotice");return nt(e.messageList)&&0!==e.messageList.length?(v.l("".concat(o," ")+e.messageList.map(function(e){return e.ID})),this._grpM.req({P:I.DEL_GRP_SYSTEM_NOTICE,data:{messageListToDelete:e.messageList.map(function(e){return{from:R.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}})}}).then(function(){v.l("".concat(o," ok"));var t=n._grpM.get(11);return e.messageList.forEach(function(e){t.deleteLocalMessage(e)}),Sn()}).catch(function(e){return v.e("".concat(o," error:"),e),C(e)})):kn()}},{key:"_getPendencyList",value:function(){var n=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.type,o=e.startTime,e=e.limit;return this._grpM.req({P:I.GET_GRP_PENDENCY,data:{type:void 0===t?void 0:t,startTime:void 0===o?0:o,limit:void 0===e?20:e,handleAccount:this._grpM.getMyUserID()}}).then(function(e){var t=e.data.pendencyList;return 0!==e.data.nextStartTime?n._getPendencyList({startTime:e.data.nextStartTime}).then(function(e){return[].concat(D(t),D(e))}):t})}},{key:"getGroupApplicationList",value:function(){var n=this;return this._getPendencyList().then(function(t){return n._getPendencyList({type:R.GRP_COMMUNITY}).then(function(e){return t.push.apply(t,D(e)),n._handlePendencyResult(t)}).catch(function(e){return n._handlePendencyResult(t)})})}},{key:"_handlePendencyResult",value:function(e){var t=this,n=[];return e.forEach(function(e){t.pendencyMap.set("".concat(e.from,"_").concat(e.groupID,"_").concat(e.to),e),0===e.handled&&n.push({applicant:e.from,applicantNick:e.fromUserNickName,groupName:e.groupName,groupID:e.groupID,authentication:e.authentication,messageKey:e.time,applicationType:e.applicationType,userID:e.userID,note:e.note})}),kn({applicationList:n})}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,n=e.result;e.isInstantMessage&&n.forEach(function(e){switch(e.payload.operationType){case 1:break;case 2:t._onApplyJoinGroup(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);break;case 21:t._grpM.onAVChatRoomMemberBanned(e)}})}},{key:"_onApplyJoinGroup",value:function(e){var t=this,e=e.payload.groupProfile,n=e.groupID,e=e.groupType,o=this._grpM.hasLocalGroup(n);v.l("".concat(this._n,"._onApplyJoinGroup groupID:").concat(n," groupType:").concat(e," hasGroup:").concat(o)),o||St(e)||this._grpM.getGroupProfile({groupID:n}).then(function(e){var e=e.data.group;e&&(t._grpM.updateGroupMap([e]),e=!e.isSupportTopic,t._grpM.emitGroupListUpdate(!0,e))})}},{key:"_onMemberKicked",value:function(e){e=e.payload.groupProfile.groupID;this._grpM.hasLocalGroup(e)&&this._grpM.deleteLocalGroupAndConversation(e)}},{key:"_onGroupDismissed",value:function(e){var e=e.payload.groupProfile.groupID,t=(this._grpM.hasLocalGroup(e)&&this._grpM.deleteLocalGroupAndConversation(e),this._grpM._AVChatRoomHandler);t&&t.checkJoinedAVChatRoomByID(e)&&t.reset(e)}},{key:"_onInviteGroup",value:function(e){var t=this,n=e.payload.groupProfile.groupID,e=this._grpM.hasLocalGroup(n);v.l("".concat(this._n,"._onInviteGroup groupID:").concat(n," hasGroup:").concat(e)),this._grpM.getGroupProfile({groupID:n}).then(function(){t._grpM.emitGroupListUpdate(),t._grpM.get(11).pullMsgOnInvite("".concat(R.CONV_GROUP).concat(n))})}},{key:"_onQuitGroup",value:function(e){var e=e.payload.groupProfile,t=e.groupID,e=e.groupType,n=this._grpM.hasLocalGroup(t);v.l("".concat(this._n,"._onQuitGroup groupID:").concat(t," groupType:").concat(e," hasGroup:").concat(n)),n&&this._grpM.deleteLocalGroupAndConversation(t)}},{key:"_onSetManager",value:function(e){var e=e.payload.groupProfile,t=e.to,e=e.groupID,e=this._grpM.getGroupMemberHandler().getLocalGroupMemberInfo(e,t);e&&e.updateRole(R.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(e){var e=e.payload.groupProfile,t=e.to,e=e.groupID,e=this._grpM.getGroupMemberHandler().getLocalGroupMemberInfo(e,t);e&&e.updateRole(R.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(e){var t=e.payload.groupProfile.groupID,e=e.payload.messageRemindType;this._grpM.get(11).onGroupMsgRemindTypeUpdated({groupID:t,messageRemindType:e})}},{key:"_handleTopicSystemNotice",value:function(e){var t=e.groupProfile,n=t.groupID,t=t.topicID,e=e.elements,o=e.operationType,i=e.topicIDList,e=e.messageRemindType,a=this._grpM.get(10);17===o?a.onTopicCreated({groupID:n,topicID:t}):18===o?a.onTopicDeleted({groupID:n,topicIDList:i}):20===o&&a.onMessageRemindTypeUpdated({groupID:n,topicID:t,messageRemindType:e})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),zi),Si=["relayFlag"],ki=(t(Ji,Fn),oi=f(Ji),e(Ji,[{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("polling_interval"),t=this.getCloudConfig("polling_interval_plus"),n=this.getCloudConfig("polling_no_msg_count"),o=this.getCloudConfig("polling_simplified_msg"),i=this.getCloudConfig("paging_grp_count");v.l("".concat(this._n,"._onCloudConfig pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(t," pollingNoMessageCount:").concat(n)+" pollingSimplifiedMessage:".concat(o," pagingGroupCount:").concat(i)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(n),this._AVChatRoomHandler.setPollingSimplifiedMessage(o),this._commonGroupHandler.setPagingGroupCount(i)}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:"guardForAVChatRoom",value:function(t){var n,o=this;return t.conversationType===R.CONV_GROUP?(n=Rt(t.to)?Kt(t.to):t.to,this.hasLocalGroup(n)?kn():this.getGroupProfile({groupID:n}).then(function(e){var e=e.data.group.type;return v.l("".concat(o._n,".guardForAVChatRoom. groupID:").concat(n," type:").concat(e)),e===R.GRP_AVCHATROOM?C(new Bn({code:e=T.MSG_SEND_FAIL_NOT_IN_AV,message:o.getErrMsg(e,t.from,n),data:{message:t}})):kn()})):kn()}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"onNewMessage",value:function(e){this._commonGroupHandler.onNewMessage(e)}},{key:"updateNextMessageSeq",value:function(e){var n,o=this;nt(e)&&(n=this.get(10),e.forEach(function(e){var t=e.conversationID.replace(R.CONV_GROUP,"");Rt(t)&&n.updateUnreadCountAndLastMsg(t,e.lastMessage),o.groupMap.has(t)&&(o.groupMap.get(t).nextMessageSeq=e.lastMessage.sequence+1)}))}},{key:"onNewGroupTips",value:function(e){this._groupTipsHandler.onNewGroupTips(e)}},{key:"onMsgRevoked",value:function(e){this._commonGroupHandler.onMsgRevoked(e,!(1<arguments.length&&void 0!==arguments[1])||arguments[1])}},{key:"onNewGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:"onMsgReadNotice",value:function(e){var a=this;e.dataList.forEach(function(e){var i,e=e.elements.groupMessageReadNotice;A(e)||(i=a.get(11),e.forEach(function(e){var t=e.groupID,n=e.topicID,n=void 0===n?void 0:n,e=e.lastMessageSeq,t=(v.l("".concat(a._n,".onMsgReadNotice groupID:").concat(t," lastMessageSeq:").concat(e)),"".concat(R.CONV_GROUP).concat(t)),o=!0;Je(n)||(t="".concat(R.CONV_GROUP).concat(n),o=!1),i.updateIsReadAfterReadReport({conversationID:t,lastMessageSeq:e}),i.updateUnreadCount(t,o),i.clearGroupAtInfoList(t,o)}))})}},{key:"onReadReceiptList",value:function(e){var o=this;v.l("".concat(this._n,".onReadReceiptList options:"),e),e.dataList.forEach(function(e){var t=e.groupProfile,e=e.elements,t=t.groupID,n=o.get(11),e=e.readReceiptList;n.updateReadReceiptInfo({groupID:t,readReceiptList:e})})}},{key:"onMsgModified",value:function(e){v.l("".concat(this._n,".onMsgModified options:"),e);var t=this.get(11);e.dataList.forEach(function(e){t.onMessageModified(y(y({},e),{},{conversationType:R.CONV_GROUP,to:e.topicID||e.groupID}))})}},{key:"deleteGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:"initGroupMap",value:function(e){this.groupMap.set(e.groupID,new li(e))}},{key:"clearGroupMap",value:function(){this.groupMap.clear()}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var t,n=this,o=this.get(11);e.forEach(function(e){t=e.groupID,n.groupMap.has(t)?n.groupMap.get(t).updateGroup(e):(n.groupMap.set(t,new li(e)),o.deleteGroupRoamingInfo(t))});var i,a=this.getMyUserID(),s=N(this.groupMap);try{for(s.s();!(i=s.n()).done;){var r=m(i.value,2)[1];r.selfInfo.userID=a,"Owner"===r.selfInfo.role&&(r.ownerID=a)}}catch(e){s.e(e)}finally{s.f()}}},{key:"getGroupMap",value:function(){return this.groupMap}},{key:"getLocalGroupList",value:function(){return D(this.groupMap.values()).filter(function(e){return e.type!==R.GRP_ROOM&&e.type!==R.GRP_LIVE})}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"sortLocalGroupList",value:function(){var e=D(this.groupMap).filter(function(e){e=m(e,2);return e[0],!Je(e[1].lastMessage)});e.sort(function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime}),this.groupMap=new Map(D(e))}},{key:"updateGroupLastMessage",value:function(e){this._commonGroupHandler.updateLastMsg(e)}},{key:"emitGroupListUpdate",value:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this.getLocalGroupList();e&&this.emitOEvt(G.GROUP_LIST_UPDATED),t&&(e=JSON.parse(JSON.stringify(n)),this.get(11).updateConvGroupProfile(e))}},{key:"getMyNameCardByGroupID",value:function(e){e=this.getLocalGroupProfile(e);return e?e.selfInfo.nameCard:""}},{key:"isPagingGetCompleted",value:function(){return this._commonGroupHandler.isPagingGetCompleted()}},{key:"getMsgRemindType",value:function(e){var n=this;if(!nt(e)||0===e.length)return Promise.resolve();e=e.filter(function(e){return!St(n.getLocalGroupProfile(e).type)});return 0===e.length?Promise.resolve():(v.l("".concat(this._n,".getMsgRemindType groupIDList:").concat(e)),this.getGroupProfileAdvance({groupIDList:e,responseFilter:{memberInfoFilter:["MsgFlag"]}}).then(function(e){var e=e.data.successGroupList,t=n.get(11);e.forEach(function(e){t.onGroupMsgRemindTypeUpdated({groupID:e.groupID,messageRemindType:nt(e.members)?e.members[0].messageRemindType:""})})}))}},{key:"getGroupList",value:function(){return this._commonGroupHandler.getGroupList()}},{key:"syncCommunityWithTopic",value:function(){return this._commonGroupHandler.syncGroupList(!0)}},{key:"getGroupProfile",value:function(t){var n=this,o="".concat(this._n,".").concat("getGroupProfile"),i=new M("getGroupProfile"),a=t.groupID,e=t.groupCustomFieldFilter,e=(v.l("".concat(o," groupID:").concat(a)),{groupIDList:[a],responseFilter:{groupBaseInfoFilter:D(K),groupCustomFieldFilter:e,memberInfoFilter:[].concat(D(Y),["NameCard"])}});return this.getGroupProfileAdvance(e).then(function(e){var e=e.data,t=e.successGroupList,e=e.failureGroupList;return v.l("".concat(o," ok")),0<e.length?C(e[0]):((e=St(t[0].type)&&!n.hasLocalGroup(a)?new li(t[0]):(n.updateGroupMap(t),n.getLocalGroupProfile(a))).isSupportTopic||n.get(11).updateConvGroupProfile([e]),i.setMessage("groupID:".concat(a," type:").concat(e.type," muteAllMembers:").concat(e.muteAllMembers," ownerID:").concat(e.ownerID)).end(),Sn({group:e}))}).catch(function(e){return i.setError(e).setMessage("groupID:".concat(t.groupID)).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"getGroupProfileAdvance",value:function(e){var t,n="".concat(this._n,".getGroupProfileAdvance"),o=e.groupIDList,i=(nt(o)&&50<o.length&&(this.warn("GetGroupProfileLimit"),o.length=50),[]),a=[],o=(o.forEach(function(e){(kt({groupID:e})?a:i).push(e)}),[]);return 0<i.length&&(t=this._getGroupProfileAdvance(y(y({},e),{},{groupIDList:i})),o.push(t)),0<a.length&&(t=this._getGroupProfileAdvance(y(y({},e),{},{groupIDList:a,relayFlag:0<i.length})),o.push(t)),Promise.all(o).then(function(e){var t=[],n=[];return e.forEach(function(e){t.push.apply(t,D(e.successGroupList)),n.push.apply(n,D(e.failureGroupList))}),Sn({successGroupList:t,failureGroupList:n})}).catch(function(e){return v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"_getGroupProfileAdvance",value:function(t){var n=this,e=t.relayFlag,o=void 0!==e&&e,i=g(t,Si);return this.req({P:I.GET_GRP_PROFILE,data:i}).then(function(e){v.l("".concat(n._n,"._getGroupProfileAdvance ok. options:"),i);e=e.data.groups;return{successGroupList:e.filter(function(e){return A(e.errorCode)||0===e.errorCode}),failureGroupList:e.filter(function(e){return e.errorCode&&0!==e.errorCode}).map(function(e){return new Bn({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})})}}).catch(function(e){return o&&kt({groupID:t.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:C(e)})}},{key:"createGroup",value:function(s){var r=this,e=[R.GRP_PUBLIC,R.GRP_WORK,R.GRP_MEETING,R.GRP_AVCHATROOM,R.GRP_COMMUNITY],c="".concat(this._n,".").concat("createGroup"),t=s.type,n=s.groupID;if(s.name&&!1===this._filterProfanity("name",s))return C({code:T.PROFANITY_FOUND});if(s.introduction&&!1===this._filterProfanity("introduction",s))return C({code:T.PROFANITY_FOUND});if(s.notification&&!1===this._filterProfanity("notification",s))return C({code:T.PROFANITY_FOUND});if(!e.includes(t))return C({code:T.ILLEGAL_GRP_TYPE});if(!kt({type:t})){if(!Je(n)&&kt({groupID:n}))return C({code:T.ILLEGAL_GRP_ID});s.isSupportTopic=void 0}if(St(t)&&!A(s.memberList)&&0<s.memberList.length&&(s.memberList=void 0),this._canIUseJoinOption(t)||A(s.joinOption)||(s.joinOption=void 0),kt({type:t})){if(!Je(n)&&!kt({groupID:n}))return C({code:T.ILLEGAL_GRP_ID});s.isSupportTopic=!0===s.isSupportTopic?1:0}var u=new M("createGroup"),l=(v.l("".concat(c," options:"),s),null),d=[];return this.req({P:I.CREATE_GRP,data:y(y({},s),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then(function(e){var e=e.data,t=e.groupID,e=e.overLimitUserIDList,n=void 0===e?[]:e,e=(l=t,d=n,"groupType:".concat(s.type," groupID:").concat(t," overLimitUserIDList:").concat(n));if(u.setMessage(e).end(),v.l("".concat(c," ok. ").concat(e)),s.type===R.GRP_AVCHATROOM)return r.getGroupProfile({groupID:t});if(s.type===R.GRP_COMMUNITY&&1===s.isSupportTopic)return r.getGroupProfile({groupID:t});Je(s.memberList)||Je(n)||(s.memberList=s.memberList.filter(function(e){return-1===n.indexOf(e.userID)})),r.updateGroupMap([y(y({},s),{},{groupID:t})]);var e=r.get(2),o="",i=0,a=(s.type===R.GRP_COMMUNITY?(o=r.isIntl()?"Create Community":"创建社群",i=1):o=r.isIntl()?"Create Group":"创建群组",r.get(4).getMyNick()),o=e.createCustomMessage({to:t,conversationType:R.CONV_GROUP,payload:{data:JSON.stringify({businessID:"group_create",content:o,cmd:i,opUser:a||r.getMyUserID(),version:4})}});return e.sendMessageInstance(o),r.emitGroupListUpdate(),r.getGroupProfile({groupID:t})}).then(function(e){var e=e.data.group,t=e.selfInfo,n=t.nameCard,t=t.joinTime;return e.updateSelfInfo({nameCard:n,joinTime:t,messageRemindType:R.MSG_REMIND_ACPT_AND_NOTE,role:R.GRP_MBR_ROLE_OWNER}),Sn({group:e,overLimitUserIDList:d})}).catch(function(e){var t;return u.setMessage("groupType:".concat(s.type)).setError(e).end(),10010===e.code||10007===e.code?(r._silentlyGetGroupProfile(e.code,l),r.updateGroupMap([y(y({},s),{},{groupID:l})]),(t=r.getLocalGroupProfile(l)).selfInfo.role=R.GRP_MBR_ROLE_OWNER,Sn({group:t,overLimitUserIDList:d})):(v.e("".concat(c," failed. error:"),e),C(e))})}},{key:"dismissGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("dismissGroup"),o="groupID:".concat(e),i=new M("dismissGroup");return i.setMessage(o),v.l("".concat(n," ").concat(o)),this.req({P:I.DISMISS_GRP,data:{groupID:e}}).then(function(){return i.end(),v.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),Sn({groupID:e})}).catch(function(e){return i.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"updateGroupProfile",value:function(e){var t,n=this,o="".concat(this._n,".").concat("updateGroupProfile");if(this.hasLocalGroup(e.groupID)&&(t=this.getLocalGroupProfile(e.groupID).type,this._canIUseJoinOption(t)||A(e.joinOption)||(v.w("".concat(o," joinOption is unavailable for Work/Meeting/AVChatRoom")),e.joinOption=void 0)),A(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off"),e.name&&!1===this._filterProfanity("name",e))return C({code:T.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return C({code:T.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return C({code:T.PROFANITY_FOUND});var i=new M("updateGroupProfile");return i.setMessage(JSON.stringify(e)),v.l("".concat(o," groupID:").concat(e.groupID)),this.req({P:I.UPDATE_GRP_PROFILE,data:e}).then(function(){return i.end(),v.l("".concat(o," ok")),n.hasLocalGroup(e.groupID)&&n.groupMap.get(e.groupID).updateGroup(e),Sn({group:n.groupMap.get(e.groupID)})}).catch(function(e){return i.setError(e).end(),v.l("".concat(o," failed. error:"),e),C(e)})}},{key:"_filterProfanity",value:function(e,t){var n=this.get(29);if(!n)return!0;var n=n.filterText(t[e],B),o=n.isAllowedToSend,n=n.modifiedText;return!0===o&&(t[e]=n,!0)}},{key:"joinGroup",value:function(t){var n=this,o=t.groupID,i="".concat(this._n,".joinGroup");if(this.deleteUnjoinedAVChatRoom(o),this.hasLocalGroup(o)){if(!this.isLoggedIn())return kn({status:R.JOIN_STATUS_ALREADY_IN_GROUP});var a=new M("applyJoinGroup");return this.getGroupProfile({groupID:o}).then(function(){return a.setMessage("groupID:".concat(o," joinedStatus:").concat(R.JOIN_STATUS_ALREADY_IN_GROUP)).end(),kn({status:R.JOIN_STATUS_ALREADY_IN_GROUP})}).catch(function(e){return a.setMessage("groupID:".concat(o," unjoined")).end(),v.w("".concat(i," ").concat(o," was unjoined, now join!")),n.groupMap.delete(o),n.applyJoinGroup(t)})}return v.l("".concat(i," groupID:").concat(o)),this.isLoggedIn()?this.applyJoinGroup(t):this._AVChatRoomHandler.joinWithoutAuth(t)}},{key:"applyJoinGroup",value:function(e){var c=this,u="".concat(this._n,".").concat("applyJoinGroup"),l=e.groupID;if(!Je(e.applyMessage)&&!1===this._filterProfanity("applyMessage",e))return C({code:T.PROFANITY_FOUND});var d=new M("applyJoinGroup"),e=y({},e),p=this.canIUse(H.AV_HISTORY_MSG);return p&&(e.historyMessageFlag=1),this.get(11).deleteTopicRoamingInfo(l),this.req({P:I.APPLY_JOIN_GRP,data:e}).then(function(e){var e=e.data,t=e.joinedStatus,n=e.longPollingKey,o=e.startSeq,i=e.avChatRoomFlag,a=e.avChatRoomKey,s=e.messageList,e="groupID:".concat(l," joinedStatus:").concat(t," longPollingKey:").concat(n," startSeq:").concat(o)+" avChatRoomFlag:".concat(i," canGetAVChatRoomHistoryMsg:").concat(p,",")+" historyMsgCount:".concat(Je(s)?0:s.length);switch(d.setMessage(e).end(),v.l("".concat(u," ok. ").concat(e)),t){case Ye:return Sn({status:Ye});case Ke:return c.getGroupProfile({groupID:l}).then(function(e){e=e.data.group;return c._handleJoinResult({group:e,avChatRoomFlag:i,longPollingKey:n,startSeq:o,avChatRoomKey:a,messageList:s})}).catch(function(e){var t;return 10010===e.code||10007===e.code?(c._silentlyGetGroupProfile(e.code,l),t=new li({groupID:l}),c.updateGroupMap([t]),c._handleJoinResult({group:t,avChatRoomFlag:i,longPollingKey:n,startSeq:o,avChatRoomKey:a,messageList:s})):(v.e("".concat(u," failed. error:"),e),C(e))});default:var r=new Bn({code:T.JOIN_GRP_FAIL});return v.e("".concat(u," failed. error:"),r),C(r)}}).catch(function(e){return d.setMessage("groupID:".concat(l)).setError(e).end(),v.e("".concat(u," failed. error:"),e),C(e)})}},{key:"_handleJoinResult",value:function(e){var t=this,n=e.group,o=e.avChatRoomFlag,i=e.longPollingKey,a=e.startSeq,s=e.avChatRoomKey,r=e.messageList,c=n.groupID;return 1===o?(this.get(11).setCompleted("".concat(R.CONV_GROUP).concat(c)),this._groupAttributesHandler.initGroupAttributesCache({groupID:c,avChatRoomKey:s}),this._groupCountersHandler.initGroupCountersCache({groupID:c,avChatRoomKey:s}),(e=A(i)?this._AVChatRoomHandler.handleJoinResult({group:n}):this._AVChatRoomHandler.startRunLoop({group:n,longPollingKey:i,startSeq:a})).then(function(){t._onAVChatRoomHistoryMessage(r,c)}),e):(this.emitGroupListUpdate(!0,!1),Sn({status:Ke,group:n}))}},{key:"quitGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("quitGroup"),o="groupID:".concat(e),i=(v.l("".concat(n," ").concat(o)),this.checkJoinedAVChatRoomByID(e));if(!i&&!this.hasLocalGroup(e))return C({code:T.MEMBER_NOT_IN_GRP});if(i&&!this.isLoggedIn())return v.l("".concat(n," anonymously ok. ").concat(o)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),kn({groupID:e});var a=new M("quitGroup");return a.setMessage(o),this.req({P:I.QUIT_GRP,data:{groupID:e}}).then(function(){return a.end(),v.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),i&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),Sn({groupID:e})}).catch(function(e){return a.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"searchGroupByID",value:function(e){var t="".concat(this._n,".").concat("searchGroupByID"),n={groupIDList:[e]},o=new M("searchGroupByID");return o.setMessage("groupID:".concat(e)),v.l("".concat(t," groupID:").concat(e)),this.req({P:I.SEARCH_GRP,data:n}).then(function(e){e=e.data.groupProfile;if(0!==e[0].errorCode)throw new Bn({code:e[0].errorCode,message:e[0].errorInfo});return o.end(),v.l("".concat(t," ok")),Sn({group:new li(e[0])})}).catch(function(e){return o.setError(e).end(),v.w("".concat(t," failed. error:"),e),C(e)})}},{key:"changeGroupOwner",value:function(i){var a=this,s="".concat(this._n,".").concat("changeGroupOwner");if(this.hasLocalGroup(i.groupID)&&this.getLocalGroupProfile(i.groupID).type===R.GRP_AVCHATROOM)return C({code:T.CANNOT_CHANGE_OWNER_IN_AV});if(i.newOwnerID===this.getMyUserID())return C({code:T.CANNOT_CHANGE_OWNER_TO_SELF});var r=new M("changeGroupOwner");return r.setMessage("groupID:".concat(i.groupID," newOwnerID:").concat(i.newOwnerID)),v.l("".concat(s," groupID:").concat(i.groupID)),this.req({P:I.CHANGE_GRP_OWNER,data:i}).then(function(){r.end(),v.l("".concat(s," ok"));var e,t=i.groupID,n=i.newOwnerID,o=(a.groupMap.get(t).ownerID=n,a._groupMemberHandler.getLocalGroupMemberList(t));return o instanceof Map&&(e=o.get(a.getMyUserID()),A(e)||(e.updateRole("Member"),a.groupMap.get(t).selfInfo.role="Member"),e=o.get(n),A(e)||e.updateRole("Owner")),a.emitGroupListUpdate(!0,!1),Sn({group:a.groupMap.get(t)})}).catch(function(e){return r.setError(e).end(),v.e("".concat(s," failed. error:"),e),C(e)})}},{key:"getGroupApplicationList",value:function(){return this._groupSystemNoticeHandler.getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){var t,n,o,i,a,l=this,s="".concat(this._n,".").concat("handleGroupApplication"),d=e.handleAction,p=e.handleMessage,r=e.message,c=e.application,_=(r?(t=r.payload.operatorID,n=r.payload.groupProfile.groupID,o=r.payload.authentication,i=r.payload.messageKey):c&&(t=c.applicant,n=c.groupID,o=c.authentication,i=c.messageKey),I.HANDLE_GRP_APPLICATION),u=(c&&2===c.applicationType&&(_=I.HANDLE_INVITE_JOIN_GRP,a=c.userID),new M("handleGroupApplication"));return u.setMessage("groupID:".concat(n)),v.l("".concat(s," groupID:").concat(n)),this.req({P:_,data:{handleAction:d,handleMessage:p,applicant:t,invitee:a,groupID:n,authentication:o,messageKey:i}}).then(function(){return u.end(),v.l("".concat(s," ok")),r&&l._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Sn({group:l.getLocalGroupProfile(n)})}).catch(function(e){return u.setError(e).end(),v.e("".concat(s," failed. error"),e),C(e)})}},{key:"handleGroupInvitation",value:function(e){var t=this,n="".concat(this._n,".").concat("handleGroupInvitation"),o=e.message.payload,i=o.groupProfile.groupID,a=o.authentication,s=o.messageKey,o=o.operatorID,r=e.handleAction,c=new M("handleGroupInvitation");return c.setMessage("groupID:".concat(i," inviter:").concat(o," handleAction:").concat(r)),v.l("".concat(n," groupID:").concat(i," inviter:").concat(o," handleAction:").concat(r)),this.req({P:I.HANDLE_GRP_INVITATION,data:y(y({},e),{},{inviter:o,groupID:i,authentication:a,messageKey:s})}).then(function(){return c.end(),v.l("".concat(n," ok")),t._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Sn({group:t.getLocalGroupProfile(i)})}).catch(function(e){return c.setError(e).end(),v.e("".concat(n," failed. error"),e),C(e)})}},{key:"getGroupOnlineMemberCount",value:function(t){var n=this,o="".concat(this._n,".getGroupOnlineMemberCount"),e=this._AVChatRoomHandler.checkJoinedAVChatRoomByID(t),i=this.hasLocalGroup(t);if(v.l("".concat(o," groupID:").concat(t," isAVChatRoom:").concat(e," has:").concat(i)),e)return this._AVChatRoomHandler.getGroupOnlineMemberCount(t);if(!i)return kn({memberCount:0});e=Date.now();if(this._onlineMemberCountMap.has(t)){i=this._onlineMemberCountMap.get(t);if(e-i.lastReqTime<=6e4)return kn({memberCount:i.memberCount});i.lastReqTime=e}return this.requestOnlineCount(t).then(function(e){e=e.data.memberCount,e=void 0===e?0:e;return n._onlineMemberCountMap.set(t,{lastReqTime:Date.now(),memberCount:e}),v.l("".concat(o," ok. groupID:").concat(t," memberCount:").concat(e)),kn({memberCount:e})}).catch(function(e){return v.w("".concat(o," failed. error:"),e),Promise.reject(e)})}},{key:"requestOnlineCount",value:function(e){return this.req({P:I.GET_ONLINE_MBR_NUM,data:{groupID:e}})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var t,n=this.checkJoinedAVChatRoomByID(e),o=(v.l("".concat(this._n,".deleteLocalGroupAndConversation groupID:").concat(e," isJoinedAVChatRoom:").concat(n)),this.get(11)),i="".concat(R.CONV_GROUP).concat(e);n&&(this.stopMessageLongPolling({groupID:e}),o.deleteLocalConv(i)),kt({groupID:e})&&(t=this.getLocalGroupProfile(e))&&!0===t.isSupportTopic&&this.get(10).deleteTopicListInCommunity(e),o.clearUnreadCount(i),o.setCompleted(i),this._deleteLocalGroup(e),this._onlineMemberCountMap.delete(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this._groupMemberHandler.deleteGroupMemberList(e)}},{key:"sendMessage",value:function(e,t){if(nt(e._receiverList)&&0<e._receiverList.length&&!this.canIUse(H.MSG_TO_SPECIFIED_GRP_MBR))return this.noUse("Targeted Group Message");e=this.createGroupMessagePack(e,t);return this.req(e)}},{key:"createGroupMessagePack",value:function(e,t){var n=null,o=(t&&t.offlinePushInfo&&(n=t.offlinePushInfo),""),i=(ft(e.cloudCustomData)&&0<e.cloudCustomData.length&&(o=e.cloudCustomData),[]),a=(et(t)&&et(t.messageControlInfo)&&(a=(r=t.messageControlInfo).excludedFromUnreadCount,s=r.excludedFromLastMessage,r=r.excludedFromContentModeration,!0===a&&i.push("NoUnread"),!0===s&&i.push("NoLastMsg"),!0===r&&i.push("NoMsgCheck")),void 0),s=(nt(e._receiverList)&&0<e._receiverList.length&&(a=e._receiverList,50<e._receiverList.length&&(a=e._receiverList.slice(0,50),this.warn("ReceiverListLimit"))),this.isOnlineMessage(e,t)?1:0),r=JSON.parse(JSON.stringify(e.getElements())),c=this.get(17).getFileDNList(),u=e.getGroupAtInfoList(),r={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:po(e.type,r,c),cloudCustomData:o,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==R.MSG_TEXT||Je(u)?void 0:u,onlineOnlyFlag:s,clientTime:e.clientTime,offlinePushInfo:Bo(n),messageControlInfo:0==s?i:void 0,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1,receiverList:a,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0,cmConfigID:e._cmConfigID,forbidCallbackControl:Et(t)};return Rt(e.to)&&(r.groupID=Kt(e.to),r.topicID=e.to),{P:I.SEND_GRP_MSG,data:r}}},{key:"revokeMessage",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return Rt(e.to)&&(t.groupID=Kt(e.to),t.topicID=e.to),this.req({P:I.REVOKE_GRP_MSG,data:t})}},{key:"deleteMessage",value:function(e){var t=e.to,e=e.keyList,e=(v.l("".concat(this._n,".deleteMessage groupID:").concat(t," count:").concat(e.length)),{groupID:t,deleter:this.getMyUserID(),keyList:e});return Rt(t)&&(e.groupID=Kt(t),e.topicID=t),this.req({P:I.DEL_GRP_MSG,data:e})}},{key:"modifyRemoteMessage",value:function(e){var t=e.to,n=e.sequence,o=e.payload,i=e.type,a=e.version,a=void 0===a?0:a,s=e.cloudCustomData,e=e._elements,r=t,c=void 0,t=(Rt(t)&&(r=Kt(t),c=t),void 0);return Wt(i)&&(1<e.length&&e.splice(0,1,{type:i,content:o}),t=e),this.req({P:I.MODIFY_GRP_MSG,data:{groupID:r,topicID:c,sequence:n,version:a,elements:t,cloudCustomData:s}})}},{key:"getRoamingMessage",value:function(e){var r=this,c="".concat(this._n,".").concat("getRoamingMessage"),u=e.conversationID,l=e.groupID,e=e.sequence,d=new M("getRoamingMessage"),p=0,_=void 0;return Rt(l)&&(l=Kt(_=l)),this._computeLastSequence({groupID:l,topicID:_,sequence:e}).then(function(e){return p=e,v.l("".concat(c," groupID:").concat(l," startSequence:").concat(p)),r.req({P:I.GET_GRP_ROAMING_MSG,data:{groupID:l,count:21,sequence:p,topicID:_}})}).then(function(e){var t=e.data,n=t.messageList,o=t.complete,t=t.invisibleSequenceList,t=void 0===t?[]:t,e=e.data.nextSequence,e=void 0===e?0:e,i=(A(n)?v.l("".concat(c," ok. complete:").concat(o," nextSequence:").concat(e," but messageList is undefined!")):v.l("".concat(c," ok. complete:").concat(o," nextSequence:").concat(e," count:").concat(n.length)),d.setMessage("groupID:".concat(l," topicID:").concat(_," startSequence:").concat(p," complete:").concat(o," nextSequence:").concat(e)).end(),r.get(11)),a=[],s=[],n=(Je(n)||(a=i.onRoamingMessage(n,u,!0,s),i.updateIsRead(u),i.patchConvLastMessage(u)),2===o||e<1);return n&&(i.setCompleted(u),e=""),v.l("".concat(c," isPullingCompleted:").concat(n," nextReqID:").concat(e," storedMsgCount:").concat(a.length)+" invisibleSeqCount:".concat(t.length)),{nextReqID:e+"",storedMessageList:a,assembledMessageList:s,isPullingCompleted:n}}).catch(function(e){return d.setError(e).setMessage("groupID:".concat(l," topicID:").concat(_," startSequence:").concat(p)).end(),v.w("".concat(c," failed. error:"),e),C(e)})}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(R.CONV_GROUP,"")}},{key:"getReadReceiptList",value:function(n){var t="".concat(this._n,".").concat("getReadReceiptList"),e=this._getGroupIDOfMessage(n[0]),o=this.getMyUserID(),i=n.filter(function(e){return e.from===o&&!0===e.needReadReceipt}).map(function(e){return{sequence:e.sequence}});if(v.l("".concat(t," groupID:").concat(e," sequenceList:").concat(JSON.stringify(i))),0===i.length)return kn({messageList:n});var a=new M("getReadReceiptList");return a.setMessage("groupID:".concat(e)),this.req({P:I.GET_READ_RECEIPT,data:{groupID:e,sequenceList:i}}).then(function(e){a.end(),v.l("".concat(t," ok"));e=e.data.readReceiptList;return nt(e)&&e.forEach(function(t){n.forEach(function(e){0===t.code&&t.sequence===e.sequence&&(e.readReceiptInfo.readCount=t.readCount,e.readReceiptInfo.unreadCount=t.unreadCount)})}),Sn({messageList:n})}).catch(function(e){return a.setError(e).end(),v.w("".concat(t," failed. error:"),e),C(e)})}},{key:"sendReadReceipt",value:function(e){var t="".concat(this._n,".").concat("sendReadReceipt"),n=this._getGroupIDOfMessage(e[0]),o=new M("sendReadReceipt"),i=(o.setMessage("groupID:".concat(n)),this.getMyUserID()),e=e.filter(function(e){return e.from!==i&&!0===e.needReadReceipt}).map(function(e){return{sequence:e.sequence}});return 0===e.length?C({code:T.READ_RECEIPT_MSG_LIST_EMPTY}):(v.l("".concat(t,". sequenceList:").concat(JSON.stringify(e))),this.req({P:I.SEND_READ_RECEIPT,data:{groupID:n,sequenceList:e}}).then(function(e){return o.end(),v.l("".concat(t," ok")),Sn()}).catch(function(e){return o.setError(e).end(),v.w("".concat(t," failed. error:"),e),C(e)}))}},{key:"getReadReceiptDetail",value:function(e){var l=this,t=e.message,n=e.filter,o=e.cursor,e=e.count,i=this._getGroupIDOfMessage(t),a=t.ID,t=t.sequence,s="".concat(this._n,".").concat("getReadReceiptDetail"),d=this._receiptDetailCompleteMap.get(a)||!1,r=0!==n&&1!==n?0:n,n=ft(o)?o:"",o=!Qe(e)||e<=0||100<=e?100:e,e="groupID:".concat(i," sequence:").concat(t," cursor:").concat(n," filter:").concat(r," completeFlag:").concat(d),c=(v.l("".concat(s," ").concat(e)),{cursor:"",isCompleted:!1,messageID:a,unreadUserIDList:[],readUserIDList:[]}),u=new M("getReadReceiptDetail");return u.setMessage(e),this.req({P:I.GET_READ_RECEIPT_DETAIL,data:{groupID:i,sequence:t,flag:r,cursor:n,count:o}}).then(function(e){u.end();var e=e.data,t=e.cursor,n=e.isCompleted,o=e.unreadUserIDList,e=e.readUserIDList;return c.cursor=t,1===n&&(c.isCompleted=!0,l._receiptDetailCompleteMap.set(a,!0)),0===r?c.readUserIDList=e.map(function(e){return e.userID}):1===r&&(c.unreadUserIDList=o.map(function(e){return e.userID})),v.l("".concat(s," ok")),Sn(c)}).catch(function(e){return u.setError(e).end(),v.w("".concat(s," failed. error:"),e),C(e)})}},{key:"getRoamingMessagesHopping",value:function(c){var u=this,l="".concat(this._n,".").concat("getRoamingMessagesHopping"),t=c.groupID,n=c.count,d=c.sequence,p=c.direction,o=void 0;return A(d)&&1===p?kn({messageList:[],isCompleted:!0,nextMessageSeq:""}):(Rt(t)&&(t=Kt(o=t)),this._computeReqSeqHopping({groupID:t,topicID:o,sequence:d}).then(function(e){A(d)||1!==p||(e=d+n-1);var s="".concat(o?"topicID:".concat(o):"groupID:".concat(t)," sequence:").concat(d," reqSeq:").concat(e," direction:").concat(p),r=(v.l("".concat(l," ").concat(s)),new M("getRoamingMessagesHopping"));return u.req({P:I.GET_GRP_ROAMING_MSG,data:{groupID:t,topicID:o,count:n,sequence:e}}).then(function(e){var e=e.data,t=e.messageList,t=void 0===t?[]:t,n=e.complete,o=e.nextSequence,o=void 0===o?0:o,e=e.invisibleSequenceList,e=void 0===e?[]:e,i="complete:".concat(n," nextSequence:").concat(o," remoteMsgCount:").concat(t.length," invisibleSequenceList:").concat(e),i=(r.setMessage("".concat(s," ").concat(i)).end(),v.l("".concat(l," ok. ").concat(i)),"".concat(R.CONV_GROUP).concat(c.groupID)),a=u.get(11),i=a.onRoamingMessage(t,i,!1),t=u._computeResult({groupID:c.groupID,direction:p,sequence:d,remoteMessageList:t,processedMessageList:i,complete:n,nextSequence:o,invisibleSequenceList:e});return a.storeHoppingMessageList(t.messageList),Sn(t)}).catch(function(e){return r.setError(e).setMessage("groupID:".concat(t," sequence:").concat(d," count:").concat(n)).end(),v.w("".concat(l," failed. error:"),e),C(e)})}))}},{key:"_computeReqSeqHopping",value:function(e){var n=this,o=e.groupID,t=e.topicID,t=void 0===t?void 0:t,e=e.sequence,e=void 0===e?void 0:e;return 0<e?Promise.resolve(e):A(t)?this.getGroupProfileAdvance({groupIDList:[o],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}}).then(function(e){var e=e.data.successGroupList,t=0;return Je(e)||(t=e[0].nextMessageSeq-1),v.l("".concat(n._n,"._computeReqSeqHopping groupID:").concat(o," lastSequence:").concat(t," from remote")),t}).catch(function(e){return C(e)}):Promise.resolve(0)}},{key:"_computeResult",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:""},n=e.groupID,o=e.direction,i=e.sequence,a=e.remoteMessageList,a=void 0===a?[]:a,s=e.processedMessageList,s=void 0===s?[]:s,r=e.complete,c=e.nextSequence,e=e.invisibleSequenceList;if(0===o)return t.nextMessageSeq=c,(2===r||c<1)&&(t.isCompleted=!0,t.nextMessageSeq=""),t.messageList=s,t;if(1===o){if(Je(a)){if(Je(e))return t.isCompleted=!0,t.nextMessageSeq="",t;t.nextMessageSeq=e[0]+1}else{r=a[0].sequence,c=e[0]||0;t.nextMessageSeq=c<r?r+1:c+1}return s.forEach(function(e){e.sequence>=i&&t.messageList.push(e)}),(kt({groupID:n})||Rt(n))&&0===t.messageList.length&&a[0].sequence<i&&(t.isCompleted=!0,t.nextMessageSeq=""),t}}},{key:"setMessageRead",value:function(e){var o=this,i=e.conversationID,a=e.lastMessageSeq,s="".concat(this._n,".").concat("setMessageRead"),e="convID:".concat(i," lastMessageSeq:").concat(a),r=(v.l("".concat(s," ").concat(e)),Qe(a)||this.warn("DoNotModifyLastSeq"),new M("setMessageRead")),c=(r.setMessage(e),i.replace(R.CONV_GROUP,"")),u=void 0;return Rt(c)&&(c=Kt(u=c)),this.req({P:I.SET_GRP_MSG_READ,data:{groupID:c,topicID:u,messageReadSeq:a}}).then(function(){r.end(),v.l("".concat(s," ok"));var e,t=o.get(11),n=(t.updateIsReadAfterReadReport({conversationID:i,lastMessageSeq:a}),!0);return A(u)||(n=!1,(e=o.get(10).getLocalTopic(c,u))&&e.updateSelfInfo({readedSequence:a})),t.updateUnreadCount(i,n),Sn()}).catch(function(e){return r.setError(e).end(),v.l("".concat(s," failed. error:"),e),C(e)})}},{key:"_computeLastSequence",value:function(e){var t=e.groupID,n=e.topicID,n=void 0===n?void 0:n,e=e.sequence;return 0<e?Promise.resolve(e):A(n)?this.getGroupLastSequence(t):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var t="".concat(this._n,".").concat("getGroupLastSequence"),n=new M("getGroupLastSequence"),o=0,i="",a="groupID:".concat(e);if(this.hasLocalGroup(e)){var s=this.getLocalGroupProfile(e),r=s.lastMessage;if(0<r.lastSequence&&!1===r.onlineOnlyFlag)return o=r.lastSequence,i="".concat(a,", ").concat(o," from group.lastMessage.lastSequence"),v.l("".concat(t," ").concat(i)),n.setMessage(i).end(),Promise.resolve(o);if(1<s.nextMessageSeq)return o=s.nextMessageSeq-1,i="".concat(a,", ").concat(o," from group.nextMessageSeq"),v.l("".concat(t," ").concat(i)),n.setMessage(i).end(),Promise.resolve(o)}r=this.get(11).getLocalConversation("GROUP".concat(e));return r&&r.lastMessage.lastSequence&&!1===r.lastMessage.onlineOnlyFlag?(o=r.lastMessage.lastSequence,i="".concat(a,", ").concat(o," from conversation.lastMessage.lastSequence"),v.l("".concat(t," ").concat(i)),n.setMessage(i).end(),Promise.resolve(o)):this.getGroupProfileAdvance({groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}}).then(function(e){e=e.data.successGroupList;return Je(e)?v.w("".concat(t," ").concat(a,", empty successGroupList")):(o=e[0].nextMessageSeq-1,i="".concat(a,", ").concat(o," from remote"),v.l("".concat(t," ").concat(i))),n.setMessage(i).end(),o}).catch(function(e){return n.setError(e).setMessage(a).end(),v.w("".concat(t," failed. error:"),e),C(e)})}},{key:"isMessageFromOrToAVChatroom",value:function(e){return this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"hasJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler.hasJoinedAVChatRoom()}},{key:"getJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler.getJoinedAVChatRoom()}},{key:"getGroupRemoteLastSeq",value:function(e){e=this.getLocalGroupProfile(e);return e?e.nextMessageSeq-1:1}},{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!==R.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e,t){var n;Je(e)||(v.l("".concat(this._n,"._onAVChatRoomHistoryMessage groupID:").concat(t," count:").concat(e.length)),n=[],e.forEach(function(e){n.push(y(y({},e),{},{isHistoryMessage:1}))}),this.onAVChatRoomMessage(n,t))}},{key:"onAVChatRoomMessage",value:function(e){this._AVChatRoomHandler.onMessage(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:"")}},{key:"onAVChatRoomMemberBanned",value:function(e){this._AVChatRoomHandler.onAVChatRoomMemberBanned(e)}},{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:"isGroupAttributesUpdatedNotice",value:function(e){return this._groupAttributesHandler.isGroupAttributesUpdatedNotice(e)}},{key:"updateLocalMainSequenceOnReconnected",value:function(){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:"isMessageFromTopic",value:function(e,t){return 2===e&&!Je(t)}},{key:"isMessageFromCommunityOfTopic",value:function(e,t){return 2===e&&Je(t)}},{key:"getMessageExtensions",value:function(e,t){return v.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.req({P:I.GET_GRP_MSG_EXT,data:{groupID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMsgExts",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return v.l("".concat(this._n,".modifyMsgExts operateType:").concat(n)),this.req({P:I.MODIFY_GRP_MSG_EXT,data:{groupID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"_genNotifyReqList",value:function(e){for(var t,n,o,i,a=[],s=0,r=e.length;s<r;s++)t=e[s],i=this.getLocalGroupProfile(t).type,n=this._getGroupLastRevokedTime(t),o=1e3*Pe(),i={notifyType:1,limit:20,type:kt({type:i,groupID:t})?R.GRP_COMMUNITY:void 0,groupID:t,beginTime:n,endTime:o},a.push(i);return a}},{key:"getNotice",value:function(e){var r=this,t="".concat(this._n,".getNotice"),e=e.filter(function(e){if(!r.hasLocalGroup(e))return!1;var e=r.getLocalGroupProfile(e),t=e.type,e=e.isSupportTopic;return!St(t)&&!e});0!==e.length&&(v.l("".concat(t," list:").concat(e)),this.req({P:I.GET_GRP_NOTIFY,data:{notifyReqList:this._genNotifyReqList(e)}}).then(function(e){var i,a,e=e.data.notifyRspList,s=[];nt(e)&&(i={dataList:[]},a="".concat(t," ok."),e.forEach(function(e){var t=e.nextRevokedTime,n=e.groupID,o=e.notifyList;a+=" groupID:".concat(n," nextRevokedTime:").concat(t," count:").concat(o.length,"\n"),i.dataList.push({elements:{revokedInfos:r._genRevokedInfos(e)}}),0!==t?(r._setGroupLastRevokedTime(n,t),s.push(n)):r._setGroupLastRevokedTime(n,1e3*Pe())}),v.l(a),r.onMsgRevoked(i,!1)),0<s.length&&r.getNotice(s)}).catch(function(e){v.e("".concat(t," failed. error:"),e)}))}},{key:"_genRevokedInfos",value:function(e){var t=e.notifyList,n=e.groupID,o=[];return nt(t)&&t.forEach(function(e){o.push({groupID:n,sequence:e.sequence,random:e.random,revokerInfo:y({},e.revokerInfo)})}),o}},{key:"_getGroupLastRevokedTime",value:function(e){return this.hasLocalGroup(e)?this.getLocalGroupProfile(e)._lastRevokedTime:0}},{key:"_setGroupLastRevokedTime",value:function(e,t){this.hasLocalGroup(e)&&(this.getLocalGroupProfile(e)._lastRevokedTime=t)}},{key:"isGroupCountersNotice",value:function(e){return this._groupCountersHandler.isGroupCountersNotice(e)}},{key:"setGroupCounters",value:function(e){return this._groupCountersHandler.setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._groupCountersHandler.increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._groupCountersHandler.decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._groupCountersHandler.getGroupCounters(e)}},{key:"getGroupMemberHandler",value:function(){return this._groupMemberHandler}},{key:"getGroupMemberList",value:function(e){return this._groupMemberHandler.getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this._groupMemberHandler.getGroupMemberProfile(e)}},{key:"addGroupMember",value:function(e){return this._groupMemberHandler.addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this._groupMemberHandler.deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this._groupMemberHandler.setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this._groupMemberHandler.setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this._groupMemberHandler.setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this._groupMemberHandler.setGroupMemberCustomField(e)}},{key:"markGroupMemberList",value:function(e){return this._groupMemberHandler.markGroupMemberList(e)}},{key:"modifyGroupMemberInfo",value:function(e){return this._groupMemberHandler.modifyGroupMemberInfo(e)}},{key:"restartPolling",value:function(){this._AVChatRoomHandler.restartPolling()}},{key:"getPollingTimerID",value:function(e){if(!e)return-1;var t=this.getLocalGroupProfile(e);return t&&St(t.type)?this._AVChatRoomHandler.getPollingTimerID(e):-1}},{key:"_canIUseJoinOption",value:function(e){return e===R.GRP_PUBLIC||kt({type:e})}},{key:"_silentlyGetGroupProfile",value:function(e,t){var n=setTimeout(this.getGroupProfile.bind(this,{groupID:t}),3e3);this._timeoutIDs.push(n),v.l("".concat(this._n,"._silentlyGetGroupProfile errorCode:").concat(e," groupID:").concat(t," timeoutIDs:").concat(this._timeoutIDs))}},{key:"_clearTimeoutIDs",value:function(){this._timeoutIDs.forEach(function(e){e&&clearTimeout(e)}),this._timeoutIDs=[]}},{key:"startMessageLongPolling",value:function(e){var t=e.groupID,n=e.longPollingKey,e=e.longPollingSequence,e=void 0===e?1:e,o=this.get(12).isUnlimitedAVChatRoom(),i=(this._AVChatRoomHandler.hasPollingInstance(t)&&this.stopMessageLongPolling({groupID:t}),this._AVChatRoomHandler.getJoinedLiveList()),o=(!o&&0<i.length&&this.stopMessageLongPolling({groupID:i[0]}),new li({groupID:t,type:R.GRP_LIVE}));return v.l("".concat(this._n,".startMessageLongPolling groupID:").concat(t," longPollingKey:").concat(n," longPollingSequence:").concat(e)),this._AVChatRoomHandler.startRunLoop({group:o,longPollingKey:n,startSeq:e})}},{key:"stopMessageLongPolling",value:function(e){var e=e.groupID,t=this.get(11);return this._AVChatRoomHandler.reset(e),this._deleteLocalGroup(e),t.deleteLocalConv("".concat(R.CONV_GROUP).concat(e)),v.l("".concat(this._n,".stopMessageLongPolling ok, groupID:").concat(e)),kn({groupID:e})}},{key:"reset",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._onlineMemberCountMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._groupAttributesHandler.reset(),this._groupCountersHandler.reset(),this._AVChatRoomHandler.reset(),this._groupMemberHandler.reset(),this._clearTimeoutIDs()}}]),Ji),Ri=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],Ai=(e(ji,[{key:"_initTopic",value:function(e){for(var t in e)Ri.indexOf(t)<0||("selfInfo"===t?this.updateSelfInfo(e[t]):this[t]="muteAllMembers"===t?1===e[t]:e[t])}},{key:"updateUnreadCount",value:function(){this.unreadCount=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0}},{key:"updateNextMessageSeq",value:function(e){this.nextMessageSeq=e}},{key:"updateLastMessage",value:function(e){this.lastMessage=Qo(e)}},{key:"updateGroupAtInfoList",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:"updateTopic",value:function(e){A(e.selfInfo)||this.updateSelfInfo(e.selfInfo),A(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),rt(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers","lastMsg"])}},{key:"updateSelfInfo",value:function(e){return 0===rt(this.selfInfo,e,[],[""])}},{key:"reduceUnreadCount",value:function(){return 1<=this.unreadCount&&(--this.unreadCount,!0)}},{key:"isLastMessageRevoked",value:function(e){return e.sequence===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}}]),ji),Oi=(t(Wi,Fn),ni=f(Wi),e(Wi,[{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");A(e)||(this.TOPIC_CACHE_TIME=Number(e)),A(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:"onTopicCreated",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOEvt(G.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var t=this,n=e.groupID,o=e.topicIDList;(void 0===o?[]:o).forEach(function(e){t._deleteLocalTopic(n,e)}),this.emitOEvt(G.TOPIC_DELETED,e)}},{key:"onTopicProfileUpdated",value:function(e){var t=e.groupID,n=e.topicID,n=this.getLocalTopic(t,n);n&&(n.updateTopic(e),this.emitOEvt(G.TOPIC_UPDATED,{groupID:t,topic:n}))}},{key:"onTopicLatestMsg",value:function(e){var t,n,e=e||{},o=e.topicLatestMessage,e=e.excludedUnreadSequenceList;Je(o)||(t=o.groupProfile.topicID,o.conversationType=R.CONV_GROUP,o.to=t,(n=new Ro(o)).setElement(o.elements),this.updateUnreadCountAndLastMsg(t,n,e))}},{key:"onMessageRemindTypeUpdated",value:function(e){var t,n=e.groupID,o=e.topicID,e=e.messageRemindType,i=this.getLocalTopic(n,o);i&&((t=i.updateSelfInfo({messageRemindType:e}))&&this.emitOEvt(G.TOPIC_UPDATED,{groupID:n,topic:i}),v.l("".concat(this._n,".onMessageRemindTypeUpdated topicID:").concat(o," messageRemindType:").concat(e," isUpdated:").concat(t)))}},{key:"onAtInfoUpdated",value:function(e){var t=e.topicID,e=e.groupAtInfoList,n=Kt(t),t=this.getLocalTopic(n,t);t&&!A(e)&&(t.updateGroupAtInfoList(e),this.emitOEvt(G.TOPIC_UPDATED,{groupID:n,topic:t}))}},{key:"onUnreadCountUpdatedFromConv",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=Kt(e),e=this.getLocalTopic(n,e);e&&e.unreadCount!==t&&(e.updateUnreadCount(t),0===t&&e.updateSelfInfo({readedSequence:e.lastMessage.lastSequence}),this.emitOEvt(G.TOPIC_UPDATED,{groupID:n,topic:e}))}},{key:"onMessageSent",value:function(e){var t,n,o=e.groupID,i=e.topicID,e=e.lastMessage,i=this.getLocalTopic(o,i);!i||(n=(t=void 0===(t=e.sequence)?0:t)+1)>i.nextMessageSeq&&(i.updateNextMessageSeq(n),i.updateLastMessage(e),i.updateSelfInfo({readedSequence:t}),i.updateUnreadCount(0),this.emitOEvt(G.TOPIC_UPDATED,{groupID:o,topic:i}))}},{key:"onMessageModified",value:function(e){var t,n=e.to,o=e.time,i=e.sequence,a=e.elements,s=e.cloudCustomData,r=e.messageVersion,c=Kt(n),u=this.getLocalTopic(c,n);u&&(t=u.lastMessage,v.d("".concat(this._n,".onMessageModified topicID:").concat(n," lastMessage:"),JSON.stringify(t),"options:",JSON.stringify(e)),t&&(null===t.payload||t.lastTime===o&&t.lastSequence===i&&t.version!==r)&&(t.type=a[0].type,t.payload=a[0].content,t.messageForShow=Yt(t.type,t.payload,this.isIntl()),t.cloudCustomData=s,t.version=r,t.lastSequence=i,t.lastTime=o,this.emitOEvt(G.TOPIC_UPDATED,{groupID:c,topic:u})))}},{key:"onMessageRevoked",value:function(e){var n,o,i,a=this;0!==e.length&&(o=n=null,i=!1,e.forEach(function(e){var t=e.to;o=Kt(t),(n=a.getLocalTopic(o,t))&&(n.reduceUnreadCount()&&(i=!0),n.isLastMessageRevoked(e)&&(n.setLastMessageRevoked(!0),n.setLastMessageRevoker(e.revoker),i=!0),(t=n.selfInfo.excludedUnreadSequenceList||[]).push(e.sequence),n.updateSelfInfo({excludedUnreadSequenceList:t}))}),i&&this.emitOEvt(G.TOPIC_UPDATED,{groupID:o,topic:n}))}},{key:"isLastMessageRevoked",value:function(e){var t=e.topicID,e=e.sequence,n=Kt(t),n=this.getLocalTopic(n,t),t=!1;return t=n?n.isLastMessageRevoked({sequence:e}):t}},{key:"updateUnreadCountAndLastMsg",value:function(e,t,n){var o,i=Kt(e),a=this.getLocalTopic(i,e);a&&(o=a.selfInfo.excludedUnreadSequenceList||[],A(n)||(o=n),t._isExcludedFromUnreadCount&&o.push(t.sequence),a.updateSelfInfo({excludedUnreadSequenceList:o}),v.l("".concat(this._n,".updateUnreadCountAndLastMsg seq:").concat(t.sequence," lastSeq:").concat(a.lastMessage.lastSequence)),t.sequence>a.lastMessage.lastSequence&&(a.updateLastMessage(t),n=t.sequence+1,a.updateNextMessageSeq(n),o=this._computeUnreadCount(a),a.updateUnreadCount(o),(t=this.get(11).getLocalConversation("".concat(R.CONV_GROUP).concat(e)))&&t.updateUnreadCount({nextUnreadCount:o,isFromGetConversations:!0}),this.emitOEvt(G.TOPIC_UPDATED,{groupID:i,topic:a})))}},{key:"getJoinedCommunityList",value:function(){return this.get(7).syncCommunityWithTopic()}},{key:"createTopicInCommunity",value:function(t){var n=this,o="".concat(this._n,".").concat("createTopicInCommunity"),e=t.topicID;if(!A(e)&&!Rt(e))return C({code:T.ILLEGAL_TOPIC_ID});if(t.topicName&&!1===this._filterProfanity("topicName",t))return C({code:T.PROFANITY_FOUND});if(t.introduction&&!1===this._filterProfanity("introduction",t))return C({code:T.PROFANITY_FOUND});if(t.notification&&!1===this._filterProfanity("notification",t))return C({code:T.PROFANITY_FOUND});var i=new M("createTopicInCommunity");return this.req({P:I.CREATE_TOPIC,data:y({},t)}).then(function(e){e=e.data.topicID;return i.setMessage("topicID:".concat(e)).end(),v.l("".concat(o," ok. topicID:").concat(e)),n._updateTopicMap([y(y({},t),{},{topicID:e})]),Sn({topicID:e})}).catch(function(e){return i.setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"deleteTopicFromCommunity",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteTopicFromCommunity"),a=e.groupID,e=e.topicIDList,e=void 0===e?[]:e,s=new M("deleteTopicFromCommunity");return s.setMessage("groupID:".concat(a," topicIDList:").concat(e)),this.req({P:I.DEL_TOPIC,data:{groupID:a,topicIDList:e}}).then(function(e){var e=e.data.resultList,o=[],i=[],e=((void 0===e?[]:e).forEach(function(e){var t=e.topicID,n=e.errorCode,e=e.errorInfo;0===n?o.push({topicID:t}):i.push({topicID:t,code:n,message:e})}),"success count:".concat(o.length,", fail count:").concat(i.length));return s.setMoreMessage(e).end(),v.l("".concat(n," ok. ").concat(e)),o.forEach(function(e){t._deleteLocalTopic(a,e.topicID)}),Sn({successTopicList:o,failureTopicList:i})}).catch(function(e){return s.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"updateTopicProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("updateTopicProfile");if(v.l("".concat(n," options:"),e),e.topicName&&!1===this._filterProfanity("topicName",e))return C({code:T.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return C({code:T.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return C({code:T.PROFANITY_FOUND});var o=new M("updateTopicProfile");return o.setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),A(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.req({P:I.UPDATE_TOPIC_PROFILE,data:y({},e)}).then(function(){return o.end(),v.l("".concat(n," ok")),t._updateTopicMap([e]),Sn({topic:t.getLocalTopic(e.groupID,e.topicID)})}).catch(function(e){return o.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"getTopicList",value:function(e){var t=this,n="".concat(this._n,".").concat("getTopicList"),o=e.groupID,e=e.topicIDList,e=void 0===e?[]:e,i=0===e.length,c=new M("getTopicList");if(c.setMessage("groupID:".concat(o)),this._getTopicTimeMap.has(o)){var a=this._getTopicTimeMap.get(o),s=a.isGetAll,a=a.time;if((s||!s&&!i)&&Date.now()-a<1e3*this.TOPIC_CACHE_TIME){s=this._getLocalTopicList(o,e);if(i||s.length===e.length)return c.setMoreMessage("from cache, topic count:".concat(s.length)).end(),v.l("".concat(n," groupID:").concat(o," from cache, topic count:").concat(s.length)),kn({successTopicList:s,failureTopicList:[]})}}return this.req({P:I.GET_TOPIC_LIST,data:{groupID:o,topicIDList:e}}).then(function(e){var e=e.data.topicInfoList,a=[],s=[],r=[],e=((void 0===e?[]:e).forEach(function(e){var t=e.topic,n=e.selfInfo,o=e.errorCode,e=e.errorInfo,i=t.topicID;0===o?(a.push(y(y({},t),{},{selfInfo:n})),s.push(i)):r.push({topicID:i,code:o,message:e})}),t._updateTopicMap(a),t._handleTopicAtInfo(a),"success count:".concat(s.length,", fail count:").concat(r.length)),e=(c.setMoreMessage(e).end(),v.l("".concat(n," groupID:").concat(o," from remote, ").concat(e)),[]);return Je(s)||(t._getTopicTimeMap.set(o,{time:Date.now(),isGetAll:i}),e=t._getLocalTopicList(o,s)),Sn({successTopicList:e,failureTopicList:r})}).catch(function(e){return c.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"hasLocalTopic",value:function(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}},{key:"getLocalTopic",value:function(e,t){var n=null;return n=this._topicMap.has(e)?this._topicMap.get(e).get(t):n}},{key:"_getLocalTopicList",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],e=this._topicMap.get(e),n=[];return e&&(n=D(e.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).has(t)&&(this._topicMap.get(e).delete(t),v.l("".concat(this._n,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(t)))}},{key:"_updateTopicMap",value:function(e){var i=this,a=[];e.forEach(function(e){var t=e.groupID,n=e.topicID,o=null,e=(i._topicMap.has(t)||i._topicMap.set(t,new Map),i._topicMap.get(t).has(n)?(o=i._topicMap.get(t).get(n)).updateTopic(e):(i._getTopicLastMessage(e),o=new Ai(e,i.isIntl()),i._topicMap.get(t).set(n,o)),i._computeUnreadCount(o));o.updateUnreadCount(e),a.push({conversationID:"".concat(R.CONV_GROUP).concat(n),type:R.CONV_TOPIC,unreadCount:e})}),0<a.length&&this.get(11).updateTopicConversation(a)}},{key:"resetGetTopicTime",value:function(e){var t=this;A(e)?D(this._getTopicTimeMap.keys()).forEach(function(e){t._getTopicTimeMap.set(e,0)}):this._getTopicTimeMap.set(e,0)}},{key:"getTopicListOnReconnected",value:function(){var o=this,e=D(this._topicMap.keys()),i=[],a=this.get(11);e.forEach(function(e){var n=[],t=o._getLocalTopicList(e);a.deleteTopicRoamingInfo(e),t.forEach(function(e){var t=e.lastMessage.lastTime,t=void 0===t?0:t;Date.now()-1e3*t<1e3*o.TOPIC_LAST_ACTIVE_TIME&&n.push(e.topicID)}),0<n.length&&i.push({groupID:e,topicIDList:n})}),v.l("".concat(this._n,".getTopicListOnReconnected. active community count:").concat(i.length)),this._relayGetTopicList(i)}},{key:"_relayGetTopicList",value:function(t){var e,n,o,i=this;0!==t.length&&(n=5<(e=t.shift()).topicIDList.length?"topicIDList.length:".concat(e.topicIDList.length):"topicIDList:".concat(e.topicIDList),(o=new M("relayGetTopicList")).setMessage(n),v.l("".concat(this._n,"._relayGetTopicList. ").concat(n)),this.getTopicList(e).then(function(){o.end(),i._relayGetTopicList(t)}).catch(function(e){o.setError(e).end(),i._relayGetTopicList(t)}))}},{key:"_handleTopicAtInfo",value:function(e){var i=this;0!==e.length&&e.forEach(function(e){var t=e.groupID,n=e.topicID,e=e.groupAtInfoList,o=[];A(e)||(e.forEach(function(e){o.push(y(y({},e),{},{groupID:t,topicID:n}))}),i.get(11).onNewGroupAtTips({dataList:o}))})}},{key:"_getTopicLastMessage",value:function(e){var t;A(e.lastMsg)||(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,avatar:e.lastMsg.avatar,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:2===e.lastMsg.isPlaceMessage,revoker:Je(e.lastMsg.revokerInfo)?null:e.lastMsg.revokerInfo.revoker},e.lastMessage=t)}},{key:"deleteTopicListInCommunity",value:function(t){var n=this,e=this._getLocalTopicList(t),o=this.get(11);e.forEach(function(e){e=e.topicID;n._deleteLocalTopic(t,e),n._getTopicTimeMap.delete(t),o.deleteLocalConv("".concat(R.CONV_GROUP).concat(e))})}},{key:"_computeUnreadCount",value:function(t){var n,e=t.selfInfo,o=e.excludedUnreadSequenceList,i=e.readedSequence,e=t.nextMessageSeq-t.selfInfo.readedSequence-1;return nt(o)&&(n=0,o.forEach(function(e){i<e&&e<=t.nextMessageSeq-1&&(n+=1)}),1<=n&&(e-=n)),e<0?0:e}},{key:"_filterProfanity",value:function(e,t){var n=this.get(29);if(!n)return!0;var n=n.filterText(t[e],B),o=n.isAllowedToSend,n=n.modifiedText;return!0===o&&(t[e]=n,!0)}},{key:"getMessageExtensions",value:function(e,t){v.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t));var n=Kt(e.to);return this.req({P:I.GET_GRP_MSG_EXT,data:{groupID:n,topicID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMsgExts",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=(v.l("".concat(this._n,".modifyMsgExts operateType:").concat(n)),Kt(e.to));return this.req({P:I.MODIFY_GRP_MSG_EXT,data:{groupID:o,topicID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),Wi),Ni=(e(Yi,[{key:"setExpirationTime",value:function(e){this.expirationTime=e}},{key:"getUserProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getUserProfile"),o=e.userIDList;e.fromAccount=this._userM.getMyAccount(),100<o.length&&(v.w("".concat(n," ").concat(zt(100))),o.length=100);for(var i,a=[],s=[],r=0,l=o.length;r<l;r++)i=o[r],this._userM.isMyFriend(i)&&this._contains(i)?s.push(this._getProfileFromMap(i)):a.push(i);if(0===a.length)return kn(s);e.toAccount=a;var d=e.bFromGetMyProfile||!1,c=[],u=(e.toAccount.forEach(function(e){c.push({toAccount:e,standardSequence:0,customSequence:0})}),e.userItem=c,new M("getUserProfile"));return u.setMessage(5<o.length?"userIDList.length:".concat(o.length):"userIDList:".concat(o)),this._userM.req({P:I.GET_USER_PROFILE,data:e}).then(function(e){u.end(),v.i("".concat(n," ok"));e=t._handleResponse(e).concat(s);return Sn(d?e[0]:e)}).catch(function(e){return u.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"getMyProfile",value:function(){var e,t=this._userM.getMyAccount(),n="".concat(this._n,".getMyProfile");return v.l("".concat(n," myAccount:").concat(t)),this._fill(),this._contains(t)?(e=this._getProfileFromMap(t),v.d("".concat(n," from cache, myProfile:").concat(JSON.stringify(e))),kn(e)):this.getUserProfile({fromAccount:t,userIDList:[t],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){var t=e.data.userProfileItem;if(!nt(t))return[];for(var n=[],e=Date.now(),o=0,i=t.length;o<i;o++){var a=t[o],s=a.to,a=a.profileItem;"@TLS#NOT_FOUND"!==s&&""!==s&&(s=this._update(s,this._getLatestProfileFromResponse(s,a)).latestProfile,n.push(s))}return v.l("".concat(this._n,"._handleResponse cost:").concat(Qt(e))),n}},{key:"_getLatestProfileFromResponse",value:function(e,t){var n={userID:e,profileCustomField:[]};if(!Je(t))for(var o=0,i=t.length;o<i;o++)if(-1<t[o].tag.indexOf("Tag_Profile_Custom"))n.profileCustomField.push({key:t[o].tag,value:t[o].value});else switch(t[o].tag){case qe.NICK:n.nick=t[o].value;break;case qe.GENDER:n.gender=t[o].value;break;case qe.BIRTHDAY:n.birthday=t[o].value;break;case qe.LOCATION:n.location=t[o].value;break;case qe.SELFSIGNATURE:n.selfSignature=t[o].value;break;case qe.ALLOWTYPE:n.allowType=t[o].value;break;case qe.LANGUAGE:n.language=t[o].value;break;case qe.AVATAR:n.avatar=t[o].value;break;case qe.MESSAGESETTINGS:n.messageSettings=t[o].value;break;case qe.ADMINFORBIDTYPE:n.adminForbidType=t[o].value;break;case qe.LEVEL:n.level=t[o].value;break;case qe.ROLE:n.role=t[o].value;break;default:v.w("".concat(this._n,"._getLatestProfileFromResponse unknown tag:"),t[o].tag,t[o].value)}return n}},{key:"updateMyProfile",value:function(o){var i=this,a="".concat(this._n,".").concat("updateMyProfile");if(o.nick&&!1===this._userM.filterProfanity("nick",o))return C({code:T.PROFANITY_FOUND});if(o.selfSignature&&!1===this._userM.filterProfanity("selfSignature",o))return C({code:T.PROFANITY_FOUND});var s=new M("updateMyProfile"),e=(s.setMessage(JSON.stringify(o)),(new ri).validate(o));if(!e.valid)return s.setCode(T.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:".concat(e.tips)).end(),v.e("".concat(a," info:").concat(e.tips)),C({code:T.UPDATE_PROFILE_INVALID_PARAM});var t,n=[];for(t in o)Object.prototype.hasOwnProperty.call(o,t)&&("profileCustomField"===t?o.profileCustomField.forEach(function(e){n.push({tag:e.key,value:e.value})}):n.push({tag:qe[t.toUpperCase()],value:o[t]}));if(0===n.length)return e=new Bn({code:T.UPDATE_PROFILE_NO_KEY}),s.setError(e).end(),v.e("".concat(a," failed. error:"),e),C(e);var r=this._userM.getMyAccount();return this._userM.req({P:I.UPDATE_MY_PROFILE,data:{fromAccount:r,profileItem:n}}).then(function(e){s.end(),v.i("".concat(a," ok"));var t=i._update(r,o),n=t.isProfileUpdated,t=t.latestProfile;return!0===n&&i._userM.emitOEvt(G.PROFILE_UPDATED,[t]),kn(t)}).catch(function(e){return s.setError(e).end(),v.e("".concat(a," failed. error:"),e),C(e)})}},{key:"onProfileModified",value:function(e){var t=e.dataList;if(!Je(t)){var n=t.length;v.d("".concat(this._n,".onProfileModified count:").concat(n," dataList:"),e.dataList);for(var o=[],i=0;i<n;i++){var a=t[i].userID,a=this._update(a,this._getLatestProfileFromResponse(a,t[i].profileList)),s=a.isProfileUpdated,a=a.latestProfile;!0===s&&o.push(a)}0<o.length&&(this._userM.emitIEvt(Wo.PROFILE_UPDATED,o),this._userM.emitOEvt(G.PROFILE_UPDATED,o))}}},{key:"_fill",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),n=0,o=e.length;n<o;n++)t-e[n].lastUpdatedTime<this.expirationTime&&this.accountProfileMap.set(e[n].userID,e[n]);v.l("".concat(this._n,"._fill from cache, size:").concat(this.accountProfileMap.size))}}},{key:"_update",value:function(e,t){var n,o=!1,i=Date.now();return this._contains(e)?(n=this._getProfileFromMap(e),t.profileCustomField&&!0===Tt(n.profileCustomField,t.profileCustomField)&&(n.lastUpdatedTime=i,o=!0),0<rt(n,t,["profileCustomField"])&&(n.lastUpdatedTime=i,o=!0)):(n=new ri(t),!this._userM.isMyFriend(e)&&e!==this._userM.getMyAccount()||(n.lastUpdatedTime=i,o=!0,this.accountProfileMap.set(e,n))),this._flush(e===this._userM.getMyAccount()),!0===o&&v.l("".concat(this._n,"._update account:").concat(e," isUpdated:").concat(o)),{isProfileUpdated:o,latestProfile:n}}},{key:"_flush",value:function(e){var t=D(this.accountProfileMap.values()),n=this._userM.getStorageModule();v.d("".concat(this._n,"._flush length:").concat(t.length," flushAtOnce:").concat(e)),n.setItem(this.TAG,t,e)}},{key:"_contains",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._userM.getStorageModule().getItem(this.TAG);return Je(e)?[]:e}},{key:"onConvProfileUpdated",value:function(e){for(var t,n,o,i=[],a=0,s=e.length;a<s;a++)n=(t=e[a]).userID,this._userM.isMyFriend(n)&&(this._contains(n)?(o=this._getProfileFromMap(n),0<rt(o,t)&&i.push(n)):i.push(t.userID));0!==i.length&&(v.l("".concat(this._n,".onConvProfileUpdated toAccountList:").concat(i)),this.getUserProfile({userIDList:i}))}},{key:"getNickAndAvatarByUserID",value:function(e){return this._contains(e)?{nick:(e=this._getProfileFromMap(e)).nick,avatar:e.avatar}:{nick:"",avatar:""}}},{key:"getUserNickAndAvatar",value:function(e){var t=this,n=D(new Set(e)),o=(v.l("".concat(this._n,".getUserNickAndAvatar userIDList.length:").concat(e.length," uniqueUserIDList.length:").concat(n.length)),[]);if(0===e.length)return Promise.resolve(o);var e=this._createUserIDListGroup(n),i=[];return e.forEach(function(e){i.push(t.getUserProfile({userIDList:e}))}),Promise.all(i).then(function(e){return e.forEach(function(e){e=e.data.map(function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}});o.push.apply(o,D(e))}),o})}},{key:"_createUserIDListGroup",value:function(e){for(var t=[],n=0;n<e.length;)t.push(e.slice(n,n+=100));return t}},{key:"reset",value:function(){this._flush(!0),this.accountProfileMap.clear()}}]),Yi),Gi=e(function e(t){d(this,e)}),Pi=(e(Ki,[{key:"getLocalBlacklist",value:function(){return D(this._blacklistMap.keys())}},{key:"getBlacklist",value:function(){var o=this,i="".concat(this._n,".getBlacklist"),e={fromAccount:this._userM.getMyAccount(),maxLimited:100,startIndex:this._startIndex},a=new M("getBlacklist");return this._userM.req({P:I.GET_BL,data:e}).then(function(e){var e=e.data,t=e.blackListItem,e=e.startIndex,n=Je(t)?0:t.length;a.setMessage("count:".concat(n)).end(),v.i("".concat(i," ok")),o._startIndex=e,o._handleResponse(t,!0),o._userM.emitOEvt(G.BLACKLIST_UPDATED,D(o._blacklistMap.keys())),0!==o._startIndex&&o.getBlacklist()}).catch(function(e){return a.setError(e).end(),v.e("".concat(i," failed. error:"),e),C(e)})}},{key:"addBlacklist",value:function(t){var e,n,o=this,i=new M("addToBlacklist"),a="".concat(this._n,".addBlacklist"),s=this._userM.getMyAccount();return 1===t.userIDList.length&&t.userIDList[0]===s?(n=this._userM.getErrMsg(e=T.CANNOT_ADD_SELF_TO_BLACKLIST),i.setCode(e).setMessage(n).end(),n=new Bn({code:e}),v.e("".concat(a," failed. error:"),n),C(n)):(t.userIDList.includes(s)&&(t.userIDList=t.userIDList.filter(function(e){return e!==s})),t.fromAccount=this._userM.getMyAccount(),t.toAccount=t.userIDList,this._userM.req({P:I.ADD_TO_BL,data:t}).then(function(e){return i.setMessage(5<t.userIDList.length?"userIDList.length:".concat(t.userIDList.length):"userIDList:".concat(t.userIDList)).end(),v.i("".concat(a," ok")),o._handleResponse(e.resultItem,!0),Sn(D(o._blacklistMap.keys()))}).catch(function(e){return i.setError(e).end(),v.e("".concat(a," failed. error:"),e),C(e)}))}},{key:"_handleResponse",value:function(e,t){if(!Je(e))for(var n,o,i,a=0,s=e.length;a<s;a++)o=e[a].to,i=e[a].resultCode,!A(i)&&0!==i||(t?((n=this._blacklistMap.has(o)?this._blacklistMap.get(o):new Gi).userID=o,Je(e[a].addBlackTimeStamp)||(n.timeStamp=e[a].addBlackTimeStamp),this._blacklistMap.set(o,n)):this._blacklistMap.has(o)&&(n=this._blacklistMap.get(o),this._blacklistMap.delete(o)));v.l("".concat(this._n,"._handleResponse total:").concat(this._blacklistMap.size," bAdd:").concat(t))}},{key:"deleteBlacklist",value:function(t){var n=this,o="".concat(this._n,".deleteBlacklist"),i=new M("removeFromBlacklist");return t.fromAccount=this._userM.getMyAccount(),t.toAccount=t.userIDList,this._userM.req({P:I.RM_FROM_BL,data:t}).then(function(e){return i.setMessage(5<t.userIDList.length?"userIDList.length:".concat(t.userIDList.length):"userIDList:".concat(t.userIDList)).end(),v.i("".concat(o," ok")),n._handleResponse(e.data.resultItem,!1),Sn(D(n._blacklistMap.keys()))}).catch(function(e){return i.setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"onAccountDeleted",value:function(e){for(var t=0,n=e.length;t<n;t++){var o=e[t];this._blacklistMap.has(o)&&this._blacklistMap.delete(o)}var i=e.length;0<i&&(v.l("".concat(this._n,".onAccountDeleted count:").concat(i," ").concat(i<30?"userIDList:".concat(e):"")),this._userM.emitOEvt(G.BLACKLIST_UPDATED,D(this._blacklistMap.keys())))}},{key:"onAccountAdded",value:function(e){for(var t,n=[],o=0,i=e.length;o<i;o++)t=e[o],this._blacklistMap.has(t)||(this._blacklistMap.set(t,new Gi({userID:t})),n.push(t));0<n.length&&(v.l("".concat(this._n,".onAccountAdded count:").concat(n.length," userIDList:"),n),this._userM.emitOEvt(G.BLACKLIST_UPDATED,D(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this._startIndex=0}}]),Ki),Ui=(e(Bi,[{key:"_onCloudConfig",value:function(){var e=this._userM.getCloudConfig("status_query_count"),t=this._userM.getCloudConfig("status_sub_count"),n=this._userM.getCloudConfig("status_unsub_count");v.l("".concat(this._n,"._onCloudConfig statusQueryCount:").concat(e," statusSubscribeCount:").concat(t)+" statusUnsubscribeCount:".concat(n)),A(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),A(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),A(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(n,10))}},{key:"onUserStatusUpdated",value:function(e){var e=e.dataList,o=this._userM.getMyUserID(),i=this._userM.get(12),e=e.map(function(e){var t=e.to,n=e.statusType,e=e.customStatus,e=$o(e);return t===o&&i.setCustomStatus(e),{userID:t,statusType:n,customStatus:e}});v.l("".concat(this._n,".onUserStatusUpdated list:").concat(JSON.stringify(e))),this._userM.emitOEvt(G.USER_STATUS_UPDATED,e)}},{key:"setSelfStatus",value:function(e){var t=this,n="".concat(this._n,".setSelfStatus");if(!1===this._userM.filterProfanity("customStatus",e))return C({code:T.PROFANITY_FOUND});var o=new M("setSelfStatus"),i=e.customStatus;return this._userM.req({P:I.SET_SELF_STATUS,data:{customStatus:i}}).then(function(e){return o.setMessage("customStatus:".concat(i)).end(),v.l("".concat(n," ok. customStatus:").concat(i)),t._userM.get(12).setCustomStatus(i),Sn({userID:t._userM.getMyUserID(),statusType:1,customStatus:i})}).catch(function(e){return o.setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"getUserStatus",value:function(e){var o="".concat(this._n,".").concat("getUserStatus"),e=e.userIDList,i=void 0===e?[]:e,e=this._userM.getMyUserID(),t=D(i),a=void 0,n=t.indexOf(e);if(-1<n&&(t.splice(n,1),a={userID:e,statusType:1,customStatus:this._userM.get(12).getCustomStatus()}),0===t.length)return kn({successUserList:[a],failureUserList:[]});if(!this._userM.canIUse(H.USER_STATUS))return this._userM.noUse("getUserStatus");t.length>this.MAX_QUERY_USER_COUNT&&(v.w("".concat(o," ").concat(zt(this.MAX_QUERY_USER_COUNT))),t=i.slice(0,this.MAX_QUERY_USER_COUNT));var s=new M("getUserStatus");return this._userM.req({P:I.GET_USER_STATUS,data:{userIDList:t}}).then(function(e){var e=e.data,t=e.successUserList,t=void 0===t?[]:t,e=e.failureUserList,e=void 0===e?[]:e,t=t.map(function(e){var t=e.userID,n=e.statusType,e=e.customStatus;return{userID:t,statusType:n,customStatus:$o(e)}}),e=e.map(function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,e=e.errorInfo;return{userID:Je(n)?t:n,code:o,message:e}}),n=(A(a)||t.unshift(a),"userID count:".concat(i.length,", success count:").concat(t.length,", fail count:").concat(e.length));return s.setMessage("".concat(n)).end(),v.l("".concat(o," ok. ").concat(n,".")),Sn({successUserList:t,failureUserList:e})}).catch(function(e){return s.setMessage("userID count:".concat(i.length)).setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"subscribeUserStatus",value:function(e){var t="subscribeUserStatus";if(!this._userM.canIUse(H.USER_STATUS))return this._userM.noUse(t);var n="".concat(this._n,".").concat(t),e=e.userIDList,e=void 0===e?[]:e,o=D(e),i=(o.length>this.MAX_SUBSCRIBE_USER_COUNT&&(v.w("".concat(n," ").concat(zt(this.MAX_SUBSCRIBE_USER_COUNT))),o=e.slice(0,this.MAX_SUBSCRIBE_USER_COUNT)),new M(t)),a="userID count:".concat(e.length);return v.l("".concat(n," ").concat(a)),this._userM.req({P:I.SUB_USER_STATUS,data:{userIDList:o}}).then(function(e){e=e.data.failureUserList,e=(void 0===e?[]:e).map(function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,e=e.errorInfo;return{userID:Je(n)?t:n,code:o,message:e}});return i.setMessage("".concat(a," fail count:").concat(e.length)).end(),v.l("".concat(n," ok. fail count:").concat(e.length,".")),Sn({failureUserList:e})}).catch(function(e){return i.setMessage(a).setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"unsubscribeUserStatus",value:function(e){var t="unsubscribeUserStatus";if(!this._userM.canIUse(H.USER_STATUS))return this._userM.noUse(t);var n="".concat(this._n,".").concat(t),e=(e||{}).userIDList,e=void 0===e?[]:e,o=D(e),i=(e.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(v.w("".concat(n," ").concat(zt(this.MAX_UNSUBSCRIBE_USER_COUNT))),o=e.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT)),new M(t)),a="userID count:".concat(e.length),t=(v.l("".concat(n," ").concat(a)),{userIDList:o});return 0===o.length&&(t.userIDList=void 0,t.unsubscribeAll=1),this._userM.req({P:I.UNSUB_USER_STATUS,data:t}).then(function(e){e=e.data.failureUserList,e=(void 0===e?[]:e).map(function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,e=e.errorInfo;return{userID:Je(n)?t:n,code:o,message:e}});return i.setMessage("".concat(a," fail count:").concat(e.length)).end(),v.l("".concat(n," ok. fail count:").concat(e.length,".")),Sn({failureUserList:e})}).catch(function(e){return i.setMessage("".concat(a)).setError(e).end(),v.e("".concat(n," failed. error:"),e),C(e)})}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),Bi),bi=(t(Hi,Fn),ti=f(Hi),e(Hi,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"mockOnNickAvatarModified",value:function(e,t){v.l("".concat(this._n,"._mockOnNickAvatarModified nick:").concat(e," avatar:").concat(t)),this.onProfileModified({dataList:[{pushType:1,userID:this.getMyUserID(),profileList:[{tag:qe.NICK,value:e},{tag:qe.AVATAR,value:t}]}]})}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t,n,e=e.dataList;Je(e)||(t=[],e.forEach(function(e){e.blackListDelAccount&&t.push.apply(t,D(e.blackListDelAccount))}),0<t.length&&this._blacklistHandler.onAccountDeleted(t),n=[],e.forEach(function(e){e.blackListAddAccount&&n.push.apply(n,D(e.blackListAddAccount))}),0<n.length&&this._blacklistHandler.onAccountAdded(n))}},{key:"onConvProfileUpdated",value:function(e){this._profileHandler.onConvProfileUpdated(e)}},{key:"getMyAccount",value:function(){return this.getMyUserID()}},{key:"getMyNick",value:function(){return this._profileHandler.getNickAndAvatarByUserID(this.getMyUserID()).nick}},{key:"getMyProfile",value:function(){return this._profileHandler.getMyProfile()}},{key:"getStorageModule",value:function(){return this.get(13)}},{key:"filterProfanity",value:function(e,t){var n=this.get(29);if(!n)return!0;var n=n.filterText(t[e],"user_profile"),o=n.isAllowedToSend,n=n.modifiedText;return!0===o&&(t[e]=n,!0)}},{key:"isMyFriend",value:function(e){var t=this.get(8);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:"getUserNickAndAvatar",value:function(e){return this._profileHandler.getUserNickAndAvatar(e)}},{key:"getLocalBlacklist",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return kn(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(){v.l("".concat(this._n,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),Hi),wi=(e(Vi,[{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:"isTestEnv",value:function(){return this._isTestEnv}},{key:"isPartialUpdatedConvs",value:function(){return this._isPartialUpdatedConvs}},{key:"isIndependentDomainDisabled",value:function(){return this._isIndependentDomainDisabled}},{key:"isSingaporeSite",value:function(){return 2e7<=this._SDKAppID&&this._SDKAppID<3e7||172e7<=this._SDKAppID&&this._SDKAppID<173e7}},{key:"isKoreaSite",value:function(){return 3e7<=this._SDKAppID&&this._SDKAppID<4e7||173e7<=this._SDKAppID&&this._SDKAppID<174e7}},{key:"isGermanySite",value:function(){return 4e7<=this._SDKAppID&&this._SDKAppID<5e7||174e7<=this._SDKAppID&&this._SDKAppID<175e7}},{key:"isIndiaSite",value:function(){return 5e7<=this._SDKAppID&&this._SDKAppID<6e7||175e7<=this._SDKAppID&&this._SDKAppID<176e7}},{key:"isJapanSite",value:function(){return 6e7<=this._SDKAppID&&this._SDKAppID<7e7||176e7<=this._SDKAppID&&this._SDKAppID<177e7}},{key:"isUSASite",value:function(){return 7e7<=this._SDKAppID&&this._SDKAppID<8e7||177e7<=this._SDKAppID&&this._SDKAppID<178e7}},{key:"isIndonesiaSite",value:function(){return 8e7<=this._SDKAppID&&this._SDKAppID<9e7||178e7<=this._SDKAppID&&this._SDKAppID<179e7}},{key:"isIntl",value:function(){return 0===(e=this._SDKAppID)||2e7<=e&&e<9e7||172e7<=e&&e<179e7;var e}},{key:"isUnlimitedAVChatRoom",value:function(){return this._unlimitedAVChatRoom}},{key:"isUsingChatCore",value:function(){return this._isUsingChatCore}},{key:"setUsingChatCore",value:function(e){this._isUsingChatCore=e}},{key:"getUIPlatform",value:function(){return this._uiPlatform}},{key:"setUIPlatform",value:function(e){this._uiPlatform=e}},{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 Te?window.tencent_cloud_im_csig_flutter_for_web_25F_cy: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:"getFileUploadProxy",value:function(){return this._fileUploadProxy}},{key:"getFileDownloadProxy",value:function(){return this._fileDownloadProxy}},{key:"setApplicationID",value:function(e){this._applicationID=e}},{key:"getApplicationID",value:function(){return this._applicationID}},{key:"setDowloadFileAuthKey",value:function(e){this._authKey=e}},{key:"getDowloadFileAuthKey",value:function(){return this._authKey}},{key:"setCustomLoginInfo",value:function(e){this._customLoginInfo=e}},{key:"getCustomLoginInfo",value:function(){return this._customLoginInfo}},{key:"_isTUIKit",value:function(){var e=!1,t=!1,n=!1,o=!1,i=[];ae&&(i=Object.keys(ue));for(var a=0,s=(i=ce?ie?Object.keys(uni):Object.keys(window):i).length;a<s;a++)if(i[a].toLowerCase().includes("uikit")){e=!0;break}var r,i=null,c=(ae&&!it(ue.createGamePortal)&&it(getApp)&&!A(getApp())&&(r=getApp().globalData,et(r)&&!0===r.isTUIKit&&(t=!0)),!0===this._m.get(13).getStorageSync("TIM_".concat(this._SDKAppID,"_isTUIKit"))&&(n=!0),null);if(z&&!Q&&"undefined"==typeof uni&&__wxConfig&&(c=__wxConfig.pages),Z&&"undefined"==typeof uni&&__qqConfig&&(c=__qqConfig.pages),nt(c)&&0<c.length){for(var u=0,l=c.length;u<l;u++)if(c[u].toLowerCase().includes("tui")){o=!0;break}c=null}return e||t||n||o}},{key:"reset",value:function(){this._isLoggedIn=!1,this._userSig="",this._a2Key="",this._tinyID="",this._customStatus="",this._statusInstanceID=0}}]),Vi),Fi={"k-vue2-pc":1,"k-vue2-h5":2,"k-vue2-h5-uni":3,"k-vue2-app-uni":4,"k-vue2-mp-uni":5,"k-vue2-pc-uni":6,"k-vue3-pc":7,"k-vue3-h5":8,"k-vue3-h5-uni":9,"k-vue3-app-uni":10,"k-vue3-mp-uni":11,"k-vue3-pc-uni":12,"k-rn":13},qi=(t(xi,Fn),ei=f(xi),e(xi,[{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this._helloInterval==0&&this._hello()}},{key:"getPushModule",value:function(){var e=void 0,t=this.get(36),n=this.get(28);return t.canIUseTIMPush()?e=t:n.canIUseOfflinePush()&&(e=n),e}},{key:"login",value:function(e){if(this.isLoggedIn())return t=this.getMyUserID(),(t=this.getErrMsg("RepeatLogin",t))&&v.w(t),kn({actionStatus:"OK",errorCode:0,errorInfo:t,repeatLogin:!0});if(Date.now()-this._lastLoginTs<=15e3)return this.warn("LoggingIn",e.userID),C({code:T.REPEAT_LOGIN});v.l("".concat(this._n,".login userID:").concat(e.userID));var t=this._checkLoginInfo(e);if(0!==t.code)return C(t);var t=this.get(12),n=e.userID,e=e.userSig;return t.setUserID(n),t.setUserSig(e),this.get(20).updateProtocolConfig(),this._login()}},{key:"_login",value:function(){var _=this,h=this.get(12),g=h.getScene(),e=0,t=g,f=(g&&g.startsWith("k-")&&(t=Fi[g],g="tuikit"),new M("login")),n=(f.setMessage("".concat(t)).setMoreMessage("identifier:".concat(this.getMyUserID())),"tuikit"===g),o=0,n=(ie?o=n?3===t||4===t||5===t||6===t?31:9===t||10===t||11===t||12===t?32:4:3:ae?o=X?36:"tuikit"===g?12:11:ce?o=Te?"flutter_web_uikit"===g?21:20:this._isReactUIKit()?Ce?25:24:n?1===t||2===t?29:7===t||8===t?30:Ce?17:14:Ce?16:13:13===t&&(o=38),f.setUIPlatform(o),h.setUIPlatform(o),this.getPushModule()),m=(n&&(this._isWebUniapp=n.getUniAppPlatform(),t=this._getStatusInstanceID(),h.setStatusInstanceID(t),this.get(20).updateProtocolConfig(),e=n.getDeviceBrand()),"".concat(this._n,"._login"));return this._lastLoginTs=Date.now(),this.req({P:I.LOGIN,data:{deviceBrand:e,isWebUniapp:this._isWebUniapp,customInfo:h.getCustomLoginInfo()}}).then(function(e){_._lastLoginTs=0;var t=Date.now(),n=null,o=e.data,i=o.a2Key,l=o.tinyID,d=o.helloInterval,a=o.instanceID,s=o.timeStamp,r=o.customStatus,r=void 0===r?"":r,p=o.purchaseBits,o=o.authKey,o=void 0===o?"":o,c=1e3*s,u=t-f.getStartTs(),u=c+parseInt(u/2)-t,t=f.getStartTs()+u;if(f.start(t),t=c,Ge=u,(c=new Date).setTime(t),v.i("baseTime from server:".concat(c," offset:").concat(Ge)),!l)throw n=new Bn({code:T.NO_TINYID}),f.setError(n).end(),n;if(!i)throw n=new Bn({code:T.NO_A2KEY}),f.setError(n).end(),n;t=_.get(21).getSocketID(),c=$o(r),n="socketID:".concat(t," scene:").concat(g," helloInterval:").concat(d," instanceID:").concat(a," timeStamp:").concat(s)+" offset:".concat(u," customStatus:").concat(c," isWebUniapp:").concat(_._isWebUniapp),v.l("".concat(m," ok. ").concat(n)),r="",t="",z&&it(ue.getAccountInfoSync)&&((s=ue.getAccountInfoSync().miniProgram)&&(r=s.appId,t=s.envVersion)),f.setMoreMessage("".concat(n," href:").concat(ce?window.location.href:""," mpAppId:").concat(r," envVersion:").concat(t," authKey:").concat(o)).end(),h.setA2Key(i),h.setTinyID(l),h.setStatusInstanceID(a),h.setCustomStatus(c),h.setDowloadFileAuthKey(o),p&&_.get(27).onPushedConfig({errorCode:0,expiredTime:0,purchaseBits:p}),_.get(20).updateProtocolConfig(),_.emitIEvt(Wo.A2KEY_AND_TINYID_UPDATED),_._helloInterval=d,_.triggerReady(),u=_.getPushModule();return u&&(uni.setStorageSync("timUniAppInstanceID",a),u.init()),_._fetchCloudControlConfig(),_.get(29).init(),e}).catch(function(e){return f.setError(e).end(!0),_._m.setNotReadyReason(T.LOGIN_FAILED),v.e("".concat(m," failed. error:"),e),_._lastLoginTs=0,_._m.onLoginFailed(),C(e)})}},{key:"logout",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,n="".concat(this._n,".logout"),o=this.isLoggedIn();return v.i("".concat(n," type:").concat(e," isLoggedIn:").concat(o," isWebUniapp:").concat(this._isWebUniapp)),o?(new M("logout").setMessage("identifier:".concat(this.getMyUserID())).end(!0),0===e&&this._m.setNotReadyReason(T.LOGGED_OUT),this.req({P:I.LOGOUT,data:{type:e,isWebUniapp:this._isWebUniapp}}).then(function(){return t.resetReady(),kn({})}).catch(function(e){return v.e("".concat(n," error:"),e),t.resetReady(),kn({})})):C({code:T.USER_NOT_LOGGED_IN})}},{key:"getLoginUser",value:function(){return this.isLoggedIn()?this.getMyUserID():""}},{key:"_fetchCloudControlConfig",value:function(){this.get(23).fetchConfig()}},{key:"_getStatusInstanceID",value:function(){return uni.getStorageSync("timUniAppInstanceID")||0}},{key:"_hello",value:function(){var t=this;this._lastWsHelloTs=Date.now(),this.req({P:I.HELLO,data:{isWebUniapp:this._isWebUniapp}}).catch(function(e){v.w("".concat(t._n,"._hello error:"),e)})}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var t=0;return Je(this.get(12).getSDKAppID())?t=T.NO_SDKAPPID:Je(e.userID)?t=T.NO_IDENTIFIER:Je(e.userSig)&&(t=T.NO_USERSIG),{code:t}}},{key:"_isReactUIKit",value:function(){return ce&&void 0!==window.tencent_cloud_im_csig_react_uikit_23F_xa}},{key:"onMultipleAccountKickedOut",value:function(e){var t=this;new M("kickedOut").setMessage("type:".concat(R.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),v.w("".concat(this._n,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then(function(){t.emitOEvt(G.KICKED_OUT,{type:R.KICKED_OUT_MULT_ACCOUNT}),t._m.setNotReadyReason(T.KICKED_OUT_MULT_ACCOUNT),t._m.reset()})}},{key:"onMultipleDeviceKickedOut",value:function(e){var t=this;new M("kickedOut").setMessage("type:".concat(R.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),v.w("".concat(this._n,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then(function(){t.emitOEvt(G.KICKED_OUT,{type:R.KICKED_OUT_MULT_DEVICE}),t._m.setNotReadyReason(T.KICKED_OUT_MULT_DEVICE),t._m.reset()})}},{key:"onUserSigExpired",value:function(){new M("kickedOut").setMessage(R.KICKED_OUT_USERSIG_EXPIRED).end(!0),v.w("".concat(this._n,".onUserSigExpired userID:").concat(this.getMyUserID())),0!==this.get(12).getStatusInstanceID()&&(this.emitOEvt(G.KICKED_OUT,{type:R.KICKED_OUT_USERSIG_EXPIRED}),this._m.setNotReadyReason(T.KICKED_OUT_USERSIG_EXPIRED),this._m.reset())}},{key:"onRestApiKickedOut",value:function(e){new M("kickedOut").setMessage("type:".concat(R.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),v.w("".concat(this._n,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),0!==this.get(12).getStatusInstanceID()&&(this.emitOEvt(G.KICKED_OUT,{type:R.KICKED_OUT_REST_API}),this._m.setNotReadyReason(T.KICKED_OUT_REST_API),this._m.reset(),this.get(21).onRestApiKickedOut())}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}]),xi);function xi(e){return d(this,xi),(e=ei.call(this,e))._n="SignModule",e._helloInterval=120,e._lastLoginTs=0,e._lastWsHelloTs=0,e._isWebUniapp=0,Xo.mixin(h(e)),e}function Vi(e,t){d(this,Vi),this._m=e,this._isLoggedIn=!1,this._SDKAppID=t.SDKAppID,this._userID=t.userID||"",this._userSig=t.userSig||"",this._version="3.5.2",this._a2Key="",this._tinyID="",this._customStatus="",this._contentType="json",this._unlimitedAVChatRoom=t.unlimitedAVChatRoom,this._scene=t.scene||"",this._oversea=t.oversea,this._instanceID=t.instanceID,this._statusInstanceID=0,this._isDevMode=t.devMode,this._isTestEnv=t.testEnv,this._proxyServer=t.proxyServer,this._fileUploadProxy=t.fileUploadProxy,this._fileDownloadProxy=t.fileDownloadProxy,this._applicationID=0,this._isPartialUpdatedConvs=t.partialUpdatedConversations,this._isIndependentDomainDisabled=t.disableIndependentDomain,this._isUsingChatCore=!1,this._uiPlatform=0,this._authKey="",this._customLoginInfo=""}function Hi(e){return d(this,Hi),(e=ti.call(this,e))._n="UserModule",e._profileHandler=new Ni(h(e)),e._blacklistHandler=new Pi(h(e)),e._userStatusHandler=new Ui(h(e)),e.getIEmitInst().on(Wo.A2KEY_AND_TINYID_UPDATED,e.onContextUpdated,h(e)),e}function Bi(e){d(this,Bi),this._userM=e,this._n="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userM.getIEmitInst().on(Wo.CLOUD_CONFIG,this._onCloudConfig,this)}function Ki(e){d(this,Ki),this._userM=e,this._n="BlacklistHandler",this._blacklistMap=new Map,this._startIndex=0}function Yi(e){d(this,Yi),this._userM=e,this._n="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}function Wi(e){return d(this,Wi),(e=ni.call(this,e))._n="TopicModule",e._topicMap=new Map,e._getTopicTimeMap=new Map,e.TOPIC_CACHE_TIME=300,e.TOPIC_LAST_ACTIVE_TIME=3600,e.getIEmitInst().on(Wo.CLOUD_CONFIG,e._onCloudConfig,h(e)),e}function ji(e,t){d(this,ji),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=Qo(e.lastMessage,t),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:"",excludedUnreadSequenceList:void 0},this._initTopic(e)}function Ji(e){return d(this,Ji),(e=oi.call(this,e))._n="GroupModule",e._commonGroupHandler=new mi(h(e)),e._groupAttributesHandler=new vi(h(e)),e._groupCountersHandler=new Ii(h(e)),e._AVChatRoomHandler=new Ci(h(e)),e._groupTipsHandler=new fi(h(e)),e._groupSystemNoticeHandler=new Li(h(e)),e._groupMemberHandler=new Di(h(e)),e.groupMap=new Map,e._unjoinedAVChatRoomList=new Map,e._receiptDetailCompleteMap=new Map,e._onlineMemberCountMap=new Map,e._timeoutIDs=[],e.getIEmitInst().on(Wo.CLOUD_CONFIG,e._onCloudConfig,h(e)),e}function zi(e){d(this,zi),this._grpM=e,this._n="GroupSystemNoticeHandler",this.pendencyMap=new Map}function Xi(e){d(this,Xi),this._grpM=e,this._n="GroupMemberHandler",this.groupMemberListMap=new Map,this.DEFAULT_MEMBER_INFO_FILTER=["Role","JoinTime","NameCard","ShutUpUntil","OnlineStatus"],this._grpM.getIEmitInst().on(Wo.PROFILE_UPDATED,this._onProfileUpdated,this)}function Zi(e){d(this,Zi),this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.lastSendMsgTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this.isOnline=!1,this.updateMember(e)}function Qi(e){d(this,Qi),this._grpM=e,this._n="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this._seqSll=new ci(200),this._IDSll=new ci(100),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,this.DEFAULT_POLLING_SIMPLIFIED_MSG=0}function $i(e){d(this,$i);var t=e.manager,n=e.groupID,o=e.onInit,i=e.onSuccess,e=e.onFail;this._n="Polling",this._manager=t,this._grpM=t._grpM,this._onInit=o,this._onSuccess=i,this._onFail=e,this._groupID=n,this._timeoutID=-1,this._isRunning=!1,this._proto=I.AV_POLLING}function ea(e){d(this,ea),this._grpM=e,this._n="GroupCountersHandler",this._groupCountersMap=new Map,this.EXPIRE_TIME=3e4,this._grpM.getIEmitInst().on(Wo.CLOUD_CONFIG,this._onCloudConfig,this)}function ta(e){d(this,ta),this._grpM=e,this._n="GroupAttributesHandler",this._groupAttributesMap=new Map,this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4,this._grpM.getIEmitInst().on(Wo.CLOUD_CONFIG,this._onCloudConfig,this)}function na(e){d(this,na),this._grpM=e,this._n="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this.PAGING_GRP_COUNT_LIMIT=200,this._pagingStatus=Gn,this._pagingGetCostList=[],e.getIEmitInst().on(Wo.A2KEY_AND_TINYID_UPDATED,this.syncGroupList,this)}function oa(e){d(this,oa),this._grpM=e,this._n="GroupTipsHandler",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4}function ia(e){return d(this,ia),(e=ii.call(this,e))._n="ConvModule",Xo.mixin(h(e)),e._msgListHandler=new jo(h(e)),e._msgRemindHandler=new _i(h(e)),e._convGroupHandler=new hi(h(e)),e._sll=new ci(100),e._pagingStatus=Gn,e._pagingTs=0,e._pagingStartIdx=0,e._pagingPinnedTs=0,e._pagingPinnedStartIdx=0,e._pagingConvIDMap=new Map,e._convIDFromUnreadDBMap=new Map,e._convMap=new Map,e._tmpGroupList=[],e._tmpGroupAtTipsList=[],e._peerReadTimeMap=new Map,e._completedMap=new Map,e._roamingMsgKeyAndTimeMap=new Map,e._remoteGroupReadSeqMap=new Map,e._convTotalUnreadCount=0,e._pagingGetCostList=[],e._convMapForDiff=new Map,e._partialUpdatedConvMap=new Map,e._everClearedMap=new Map,e._bPullOnInvite=!0,e._initListeners(),e}function aa(e){d(this,aa),this._convM=e,this._n="ConvGroupHandler",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=Gn}function sa(e){d(this,sa),this._convM=e,this._n="MsgRemindHandler"}function ra(e,t){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];d(this,ra),this.conversationID=e.conversationID||"",this.unreadCount=e.unreadCount||0,this.type=e.type||"",this.lastMessage=Zo(e.lastMessage,t,n),e.lastMsgTime&&(this.lastMessage.lastTime=e.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=e.peerReadTime||0,this.groupAtInfoList=[],this.remark="",this.isPinned=e.isPinned||!1,this.messageRemindType=e.messageRemindType,this.markList=e.markList||[],this.customData=e.customData||"",this.conversationGroupList=e.conversationGroupList||[],this.draftText=e.draftText||"",this._initProfile(e),this.subType=this.groupProfile?this.groupProfile.type:""}function ca(e){d(this,ca),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.inviteOption="",this.groupCustomField=[],this.muteAllMembers=!1,this.isSupportTopic=!1,this._lastRevokedTime=0,this._initGroup(e)}function ua(e){d(this,ua),this.MAX_LENGTH=e,this.map=new Map}function la(e){var t=this;d(this,la),Je(e)||(this.userID=e.userID||"",this.nick=e.nick||"",this.gender=e.gender||"",this.birthday=e.birthday||0,this.location=e.location||"",this.selfSignature=e.selfSignature||"",this.allowType=e.allowType||R.ALLOW_TYPE_ALLOW_ANY,this.language=e.language||0,this.avatar=e.avatar||"",this.messageSettings=e.messageSettings||0,this.adminForbidType=e.adminForbidType||R.FORBID_TYPE_NONE,this.level=e.level||0,this.role=e.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],Je(e.profileCustomField)||e.profileCustomField.forEach(function(e){t.profileCustomField.push({key:e.key,value:e.value})}))}function da(){return null}function pa(e){var t=e.get(12);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:Pe()}}e(Ta,[{key:"_errorTolerantHandle",value:function(){ae||"undefined"!=typeof window&&this._canIUseCookies()||(this.getItem=da,this.setItem=da,this.removeItem=da,this.clear=da)}},{key:"onCheckTimer",value:function(e){e%20==0&&0!==this._storageQueue.size&&this._doFlush()}},{key:"_doFlush",value:function(){try{var e,t=N(this._storageQueue);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2),o=n[0],i=n[1];this._setStorageSync(this._getKey(o),i)}}catch(e){t.e(e)}finally{t.f()}this._storageQueue.clear()}catch(e){v.w("".concat(this._n,"._doFlush error:"),e)}}},{key:"_getPrefix",value:function(){var e=this._m.get(12);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=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;return this.getStorageSync(n)}catch(e){return v.w("".concat(this._n,".getItem error:"),e),{}}}},{key:"setItem",value:function(e,t){var n;2<arguments.length&&void 0!==arguments[2]&&arguments[2]?(n=!(3<arguments.length&&void 0!==arguments[3])||arguments[3]?this._getKey(e):e,this._setStorageSync(n,t)):this._storageQueue.set(e,t)}},{key:"clear",value:function(){try{ae?ue.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){v.w("".concat(this._n,".clear error:"),e)}}},{key:"removeItem",value:function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;this._removeStorageSync(n)}catch(e){v.w("".concat(this._n,".removeItem error:"),e)}}},{key:"getSize",value:function(e){var t=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"b";try{var o={size:0,limitSize:5242880,unit:n};if(Object.defineProperty(o,"leftSize",{enumerable:!0,get:function(){return o.limitSize-o.size}}),ae&&(o.limitSize=1024*ue.getStorageInfoSync().limitSize),e)o.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(ae)ue.getStorageInfoSync().keys.forEach(function(e){o.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length});else if(this._canIUseCookies())for(var i in localStorage)localStorage.hasOwnProperty(i)&&(o.size+=localStorage.getItem(i).length+i.length);return this._convertUnit(o)}catch(e){v.w("".concat(this._n," error:"),e)}}},{key:"_convertUnit",value:function(e){var t,n={},o=e.unit;for(t in n.unit=o,e)"number"==typeof e[t]&&("kb"===o.toLowerCase()?n[t]=Math.round(e[t]/1024):"mb"===o.toLowerCase()?n[t]=Math.round(e[t]/1024/1024):n[t]=e[t]);return n}},{key:"_setStorageSync",value:function(e,t){ae?ee?my.setStorageSync({key:e,data:t}):ue.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}},{key:"getStorageSync",value:function(e){return ae?ee?my.getStorageSync({key:e}).data:ue.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}},{key:"_removeStorageSync",value:function(e){ae?ee?my.removeStorageSync({key:e}):ue.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}},{key:"_canIUseCookies",value:function(){return"undefined"!=typeof window&&navigator&&navigator.cookieEnabled&&localStorage}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._doFlush()}}]);var _a,ha=Ta,ga=(e(Ca,[{key:"pushIn",value:function(e){v.d("".concat(this._n,".pushIn"),this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;nt(e)&&0!==e.length&&(v.d("".concat(this._n,".backfill"),this._report.length,e.length),(t=this._report).unshift.apply(t,D(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}}]),Ca),fa=(t(ya,Fn),_a=f(ya),e(ya,[{key:"reportAtOnce",value:function(){this._report()}},{key:"_onLoginSuccess",value:function(){var t=this,e=this.get(13),n=e.getItem(this.TAG,!1);!Je(n)&&it(n.forEach)&&(v.l("".concat(this._n,"._onLoginSuccess. logs count:").concat(n.length)),n.forEach(function(e){t._reportBody.pushIn(e)}),e.removeItem(this.TAG,!1))}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("evt_rpt_threshold"),t=this.getCloudConfig("evt_rpt_waiting"),n=this.getCloudConfig("evt_rpt_level"),o=this.getCloudConfig("evt_rpt_sdkappid_bl"),i=this.getCloudConfig("evt_rpt_tinyid_wl");A(e)||(this.MIN_THRESHOLD=Number(e)),A(t)||(this.WAITING_TIME=Number(t)),A(n)||(this.REPORT_LEVEL=n.split(",").map(function(e){return Number(e)})),A(o)||(this.REPORT_SDKAPPID_BLACKLIST=o.split(",").map(function(e){return Number(e)})),A(i)||(this.REPORT_TINYID_WHITELIST=i.split(","))}},{key:"pushIn",value:function(e){e instanceof M&&(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,n=this.get(12),o=n.getSDKAppID(),n=n.getTinyID();return Ht(this.REPORT_SDKAPPID_BLACKLIST,o)&&!Bt(this.REPORT_TINYID_WHITELIST,n)?[]:e.filter(function(e){return t.REPORT_LEVEL.includes(e.level)})}},{key:"_report",value:function(){var t,e,n=this;this._reportBody.isEmpty()||(t=this._reportBody.getLogsInMemory(),0!==(e=this._filterLogs(t)).length?(e={header:pa(this),event:e},this.req({P:I.SSO_STAT,data:y({},e)}).then(function(){n._lastReportTime=Date.now()}).catch(function(e){v.w("".concat(n._n,"._report failed. error:"),e),n._lastReportTime=Date.now(),n._reportBody.backfill(t),n._reportBody.getLogsNumInMemory()>n.MAX_THRESHOLD&&n._flushAtOnce()})):this._lastReportTime=Date.now())}},{key:"_flushAtOnce",value:function(){var e=this.get(13),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory(),o="".concat(this._n,"._flushAtOnce");Je(t)?(v.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)):((n=n.concat(t)).length>this.MAX_THRESHOLD&&(n=n.slice(0,this.MAX_THRESHOLD)),v.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1))}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),ya),ma="none",va="online",Ia=(e(Ma,[{key:"_startRN",value:function(){var e,n=this;!re||(e=this._m.get(18).getPlugin("chat-network-monitor"))&&(this._removeListener=e.addEventListener(function(e){var t=e.isConnected,e=e.type;n._networkType!==e&&n._onNetworkStatusChange({isConnected:void 0!==t&&t,networkType:e})}))}},{key:"start",value:function(){var t=this,n="".concat(this._n,".start");ae?(ue.getNetworkType({success:function(e){t._networkType=e.networkType||e.subtype||"",e.networkType===ma?v.w("".concat(n," no network, please check!")):v.i("".concat(n," networkType:").concat(e.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),ue.onNetworkStatusChange(this._mpNetworkStatusCallback)):ce&&(this._networkType=va,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback))}},{key:"_onWebOnline",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:va})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:ma})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,e=e.networkType,n="".concat(this._n,"._onNetworkStatusChange"),o=!1,i="previous:".concat(this._networkType," current:").concat(e);t?(v.i("".concat(n," ").concat(i)),this._networkType!==e&&(o=!0,this._networkType=e,this._m.get(21).reConnect(!0))):this._networkType!==e&&(o=!0,this._networkType=e,v.w("".concat(n," no network, please check!")),this._m.get(21).offline()),o&&new M("networkChange").setMessage("isConnected:".concat(t," ").concat(i)).end()}},{key:"isOnline",value:function(){return this._networkType!==ma}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),ae?null!==this._mpNetworkStatusCallback&&(ue.offNetworkStatusChange&&ue.offNetworkStatusChange(this._mpNetworkStatusCallback),this._mpNetworkStatusCallback=null):ce?(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null)):re&&this._removeListener&&(this._removeListener(),this._removeListener=null)}}]),Ma);function Ma(e){d(this,Ma),this._m=e,this._networkType=va,this._n="NetMonitorModule",this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null,this._removeListener=null,this._m.getIEmitInst().on(Wo.A2KEY_AND_TINYID_UPDATED,this._startRN,this)}function ya(e){d(this,ya),(e=_a.call(this,e))._n="EventStatModule",e.TAG="im-ssolog-event",e._reportBody=new ga,e.MIN_THRESHOLD=20,e.MAX_THRESHOLD=100,e.WAITING_TIME=6e4,e.REPORT_LEVEL=[4,5,6],e.REPORT_SDKAPPID_BLACKLIST=[],e.REPORT_TINYID_WHITELIST=[],e._lastReportTime=Date.now();var t=e.getIEmitInst();return t.on(Wo.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,h(e)),t.on(Wo.CLOUD_CONFIG,e._onCloudConfig,h(e)),e}function Ca(e){d(this,Ca),this._n="SSOLogBody",this._report=[]}function Ta(e){d(this,Ta),this._m=e,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}function Da(e,t){return e(t={exports:{}},t.exports),t.exports}var Ea,La=Da(function(e){var o=Object.prototype.hasOwnProperty,_="~";function n(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,n,o,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");n=new a(n,o||e,i),o=_?_+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],n]:e._events[o].push(n):(e._events[o]=n,e._eventsCount++),e}function c(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function t(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(_=!1)),t.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)o.call(e,t)&&n.push(_?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},t.prototype.listeners=function(e){var e=_?_+e:e,t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var n=0,o=t.length,i=new Array(o);n<o;n++)i[n]=t[n].fn;return i},t.prototype.listenerCount=function(e){e=_?_+e:e,e=this._events[e];return e?e.fn?1:e.length:0},t.prototype.emit=function(e,t,n,o,u,l){var d=_?_+e:e;if(!this._events[d])return!1;var i,a=this._events[d],s=arguments.length;if(a.fn){switch(a.once&&this.removeListener(e,a.fn,void 0,!0),s){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,t),!0;case 3:return a.fn.call(a.context,t,n),!0;case 4:return a.fn.call(a.context,t,n,o),!0;case 5:return a.fn.call(a.context,t,n,o,u),!0;case 6:return a.fn.call(a.context,t,n,o,u,l),!0}for(c=1,i=new Array(s-1);c<s;c++)i[c-1]=arguments[c];a.fn.apply(a.context,i)}else for(var r,p=a.length,c=0;c<p;c++)switch(a[c].once&&this.removeListener(e,a[c].fn,void 0,!0),s){case 1:a[c].fn.call(a[c].context);break;case 2:a[c].fn.call(a[c].context,t);break;case 3:a[c].fn.call(a[c].context,t,n);break;case 4:a[c].fn.call(a[c].context,t,n,o);break;default:if(!i)for(r=1,i=new Array(s-1);r<s;r++)i[r-1]=arguments[r];a[c].fn.apply(a[c].context,i)}return!0},t.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},t.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},t.prototype.removeListener=function(e,t,n,o){e=_?_+e:e;if(!this._events[e])return this;if(!t)return c(this,e),this;var i=this._events[e];if(i.fn)i.fn!==t||o&&!i.once||n&&i.context!==n||c(this,e);else{for(var a=0,s=[],r=i.length;a<r;a++)(i[a].fn!==t||o&&!i[a].once||n&&i[a].context!==n)&&s.push(i[a]);s.length?this._events[e]=1===s.length?s[0]:s:c(this,e)}return this},t.prototype.removeAllListeners=function(e){return e?(e=_?_+e:e,this._events[e]&&c(this,e)):(this._events=new n,this._eventsCount=0),this},t.prototype.off=t.prototype.removeListener,t.prototype.addListener=t.prototype.on,t.prefixed=_,e.exports=t.EventEmitter=t}),Sa=["rich.my-imcloud.com","imrich.qcloud.com"],ka=["requestSnapshotUrl"],Ra=(t(Ua,Fn),Ea=f(Ua),e(Ua,[{key:"_init",value:function(){this._fileDownloadProxy=this.getFileDownloadProxy(),this._authKey=this.getDowloadFileAuthKey();var e=this.get(18);this.TIMUploadPlugin=e.getPlugin("tim-upload-plugin"),this.TIMUploadPlugin?this._initUploaderMethod():(this.COSSDK=e.getPlugin(e=ae?"cos-wx-sdk":"cos-js-sdk"),this.COSSDK?(this._getAuthorizationKey(),this.warn("CosReplacement",e)):this.warn("PluginUndetected"))}},{key:"_onCloudConfig",value:function(){var t=this,e="".concat(this._n,"._onCloudConfig"),n=this.getCloudConfig("upload_size_limit"),o=this.getCloudConfig("simple_cos"),i=this.getCloudConfig("file_dn_list");if(v.l("".concat(e," uploadSizeLimit:").concat(n," simpleCos:").concat(o)),!A(n))try{var a=JSON.parse(n);this.UPLOAD_SIZE_LIMIT={A:a.a?1048576*parseInt(a.a):this.UPLOAD_SIZE_LIMIT.A,F:a.f?1048576*parseInt(a.f):this.UPLOAD_SIZE_LIMIT.F,I:a.i?1048576*parseInt(a.i):this.UPLOAD_SIZE_LIMIT.I,V:a.v?1048576*parseInt(a.v):this.UPLOAD_SIZE_LIMIT.V}}catch(e){}if(A(o)||(this.isSimpleCos="1"===o),!A(i))try{JSON.parse(i).forEach(function(e){t._fileDNList.includes(e)||t._fileDNList.push(e)})}catch(e){}}},{key:"_getAuthorizationKey",value:function(){var n=this,o="".concat(this._n,".").concat("_getAuthorizationKey"),i=new M("_getAuthorizationKey"),a=Math.ceil(Date.now()/1e3);this.req({P:I.COS_SIGN,data:{duration:this.expiredTimeLimit}}).then(function(e){var e=e.data,t=(v.l("".concat(o," ok. data:"),e),e.expiredTime-a);i.setMessage("requestId:".concat(e.requestId," requestTime:").concat(a," expiredTime:").concat(e.expiredTime," diff:").concat(t,"s")).end(),!ae&&e.region&&(n.region=e.region),n.appid=e.appid,n.bucketName=e.bucketName,n.ciUrl=e.ciUrl,n.directory=e.directory,n.downloadUrl=e.downloadUrl,n.uploadUrl=e.uploadUrl,n.cosOptions={secretId:e.secretId,secretKey:e.secretKey,sessionToken:e.sessionToken,expiredTime:e.expiredTime},v.l("".concat(o," ok. region:").concat(n.region," bucketName:").concat(n.bucketName)),n._initUploaderMethod()}).catch(function(e){i.setError(e).end(),v.w("".concat(o," failed. error:"),e)})}},{key:"_getCosPreSigUrl",value:function(t){var i=this,a="".concat(this._n,".").concat("_getCosPreSigUrl"),s=Math.ceil(Date.now()/1e3),r=new M("_getCosPreSigUrl"),e={uploadMethod:t.uploadMethod,platform:this.getPlatform(),SDKAppID:this.getSDKAppID(),userID:t.userID,conversationType:t.conversationType,uploadConfig:[{fileID:1,fileType:t.fileType,fileName:t.fileName}]},n=I.SIMPLE_COS_PRE_SIG;return this.isSimpleCos||(e={fileType:t.fileType,fileName:t.fileName,uploadMethod:t.uploadMethod,duration:t.duration},n=I.COS_PRE_SIG),this.req({P:n,data:e}).then(function(e){i.tryCount=0;var t,n,e=e.data||{},o=(v.l("".concat(a," ok. isSimpleCos:").concat(i.isSimpleCos," data:"),e),"");return o=i.isSimpleCos?(t=(n=e.preSig[0]).uploadUrl,n=n.fileKey,"uploadIP:".concat(e.uploadIP," uploadUrl:").concat(t," fileKey:").concat(n," cost:").concat(Qt(s))):"requestId:".concat(e.requestId," expiredTime:").concat(e.expiredTime," diff:").concat(e.expiredTime-s,"s"),r.setMessage(o).end(),e}).catch(function(e){return-1===e.code&&(e.code=T.COS_GET_SIG_FAIL),r.setError(e).end(),v.w("".concat(a," failed. error:"),e),i.tryCount<1?(i.tryCount++,i._getCosPreSigUrl(t)):(i.tryCount=0,C({code:T.COS_GET_SIG_FAIL}))})}},{key:"_initUploaderMethod",value:function(){var n=this;if(this.TIMUploadPlugin)return this.timUploadPlugin=new this.TIMUploadPlugin,void(this._cosUploadMethod=function(e,t){n.timUploadPlugin.uploadFile(e,t)});this.appid&&(this.cos=ae?new this.COSSDK({ForcePathStyle:!0,getAuthorization:this._getAuthorization.bind(this)}):new this.COSSDK({getAuthorization:this._getAuthorization.bind(this)}),this._cosUploadMethod=ae?function(e,t){n.cos.postObject(e,t)}:function(e,t){n.cos.uploadFiles(e,t)})}},{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:"getFileDNList",value:function(){return this._fileDNList}},{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._relayFlag)return Promise.resolve();var t=this.get(26);switch(e.type){case R.MSG_IMAGE:return t.addTotalCount(Zn),this._uploadImage(e);case R.MSG_FILE:return t.addTotalCount(Zn),this._uploadFile(e);case R.MSG_AUDIO:return t.addTotalCount(Zn),this._uploadAudio(e);case R.MSG_VIDEO:return t.addTotalCount(Zn),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(v){var I=this,e=this.get(2),M=v.getElements()[0],t=e.getMessageOption(v.clientSequence);return this.doUploadImage({file:t.payload.file,to:t.to,message:v,onProgress:function(e){if(M.updatePercent(e),it(t.onProgress))try{t.onProgress(e)}catch(e){return C({code:T.MSG_ONPROGRESS_ERR})}}}).then(function(e){var t=e.location,l=e.fileType,d=e.fileSize,n=e.width,o=e.height,p=e.smallImageUrl,_=e.smallImageWidth,h=e.smallImageHeight,g=e.largeImageUrl,f=e.largeImageWidth,m=e.largeImageHeight,i=e.imageInfoArray,e=I.isPrivateNetWork()?t:_t(t);M.updateImageFormat(l);var a,s,r={size:d,url:e,width:n,height:o};if(i&&0<i.length)for(var c=0;c<i.length;c++){var u=i[c];1===u.type?a=u:2===u.type?s=u:r=y(y({},r),u)}else s=p&&g?(a={url:p,width:_,height:h},{url:g,width:f,height:m}):(a=Ft({originUrl:e,originWidth:n,originHeight:o,min:198}),Ft({originUrl:e,originWidth:n,originHeight:o,min:720}));return M.updateImageInfoArray([y({},r),y({},s),y({},a)]),v})}},{key:"_uploadFile",value:function(n){var o=this,e=this.get(2),i=n.getElements()[0],t=e.getMessageOption(n.clientSequence);return this.doUploadFile({file:t.payload.file,to:t.to,message:n,onProgress:function(e){if(i.updatePercent(e),it(t.onProgress))try{t.onProgress(e)}catch(e){return C({code:T.MSG_ONPROGRESS_ERR})}}}).then(function(e){var e=e.location,t=e;return o.isPrivateNetWork()||(t=lo(t=_t(e),o._fileDownloadProxy,o._authKey,o._fileDNList)),i.updateFileUrl(t),n})}},{key:"_uploadAudio",value:function(t){var n=this,e=this.get(2),o=t.getElements()[0],i=e.getMessageOption(t.clientSequence);return this.doUploadAudio({file:i.payload.file,to:i.to,message:t,onProgress:function(e){if(o.updatePercent(e),it(i.onProgress))try{i.onProgress(e)}catch(e){return C({code:T.MSG_ONPROGRESS_ERR})}}}).then(function(e){e=e.location,e=n.isPrivateNetWork()?e:_t(e);return o.updateAudioUrl(e),t})}},{key:"_uploadVideo",value:function(n){var o=this,e=this.get(2),i=n.getElements()[0],t=e.getMessageOption(n.clientSequence);return this.doUploadVideo({file:t.payload.file,to:t.to,message:n,onProgress:function(e){if(i.updatePercent(e),it(t.onProgress))try{t.onProgress(e)}catch(e){return C({code:T.MSG_ONPROGRESS_ERR})}}}).then(function(e){var t=e.location,e=e.snapshotInfo,t=o.isPrivateNetWork()?t:_t(t);return i.updateVideoUrl(t),Je(e)||i.updateSnapshotInfo(e),n})}},{key:"_checkSizeError",value:function(e){var t="";return"A"===e?t="audio":"I"===e?t="image":"V"===e?t="video":"F"===e&&(t="file"),C({code:T["MSG_".concat(e,"_SIZE_LIMIT")],message:this.getErrMsg("UploadSizeLimit",t,"".concat(this.UPLOAD_SIZE_LIMIT[e]/1048576,"MB"))})}},{key:"doUploadImage",value:function(o){var i=this;if(!o.file||this._isEmptyFileList(o.file.files))return C({code:T.MSG_I_SELECT_F_FIRST});var e=this._checkImageType(o.file);if(!0!==e)return e;e=this._checkImageSize(o.file);if(!0!==e)return e;var a=null;return this._setUploadFileType(1),this.uploadByCOS(o).then(function(e){if(a=e,i.isPrivateNetWork())return Pt(n);if(nt(a.imageInfoArray)){var t=a.imageInfoArray.find(function(e){return 3===e.type});if(t)return t}if(re)return{width:o.file.width,height:o.file.height};var n=_t(e.location);return i.COSSDK?Pt(n):Pt(n=lo(n,i._fileDownloadProxy,i._authKey,i._fileDNList))}).then(function(e){return a.width=e.width,a.height=e.height,Promise.resolve(a)})}},{key:"_checkImageType",value:function(e){var t="",t=ae?e.url.slice(e.url.lastIndexOf(".")+1):re?e.type.split("/")[1]:e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1);return 0<=ai.indexOf(t.toLowerCase())||C({code:T.MSG_I_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){return 0===(e=(ae||re?e:e.files[0]).size)?C({code:T.MSG_F_IS_EMPTY}):e<this.UPLOAD_SIZE_LIMIT.I||this._checkSizeError("I")}},{key:"doUploadFile",value:function(e){return!e.file||this._isEmptyFileList(e.file.files)?C({code:T.MSG_F_SELECT_F_FIRST}):e.file.files[0].size>this.UPLOAD_SIZE_LIMIT.F?this._checkSizeError("F"):0===e.file.files[0].size?C({code:T.MSG_F_IS_EMPTY}):(this._setUploadFileType(255),this.uploadByCOS(e))}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.V?this._checkSizeError("V"):0===e.file.videoFile.size?C({code:T.MSG_F_IS_EMPTY}):-1===si.indexOf(e.file.videoFile.type)?C({code:T.MSG_V_TYPES_LIMIT}):(this._setUploadFileType(2),ae||re?this.handleVideoUpload(y(y({},e),{},{file:e.file.videoFile})):ce?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(n){var o=this;return new Promise(function(t,e){o.uploadByCOS(n).then(function(e){t(e)}).catch(function(){o.uploadByCOS(n).then(function(e){t(e)}).catch(function(){e(new Bn({code:T.MSG_V_UPLOAD_FAIL}))})})})}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.A?this._checkSizeError("A"):0===e.file.size?C({code:T.MSG_F_IS_EMPTY}):(this._setUploadFileType(3),this.uploadByCOS(e)):C({code:T.MSG_A_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(t){var c=this;if(!it(this._cosUploadMethod))return this.warn("PluginUndetected"),C({code:T.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(t);var u=new M("upload"),l="".concat(this._n,".uploadByCOS"),d=Date.now(),p=this._getFile(t);return new Promise(function(a,s){var e=ae?c._createCosOptionsWXMiniApp(t):c._createCosOptionsWeb(t),r=c;c._cosUploadMethod(e,function(e,t){var n=Object.create(null);if(t){if(e||nt(t.files)&&t.files[0].error)return o=new Bn({code:T.MSG_F_UPLOAD_FAIL}),u.setError(o).end(),v.l("".concat(l," failed. error:"),t.files[0].error),403===t.files[0].error.statusCode&&c._getAuthorizationKey(),void s(o);n.fileName=p.name,n.fileSize=p.size,n.fileType=p.type.slice(p.type.indexOf("/")+1).toLowerCase(),n.location=(ae?t:t.files[0].data).Location;var o=Date.now()-d,t=r._formatFileSize(p.size),i=r._formatSpeed(1e3*p.size/o),t="size:".concat(t," time:").concat(o,"ms speed:").concat(i),i=(v.l("".concat(l," success. name:").concat(p.name," ").concat(t)),a(n),c.get(26));return i.addCost(Zn,o),i.addFileSize(Zn,p.size),void u.setMessage(t).end()}n=new Bn({code:T.MSG_F_UPLOAD_FAIL});u.setError(n).end(),v.w("".concat(l," failed. error:"),e),403===e.statusCode&&c._getAuthorizationKey(),s(n)})})}},{key:"_uploadWithPreSigUrl",value:function(e){var p=this,_="".concat(this._n,"._uploadWithPreSigUrl"),h=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then(function(d){return new Promise(function(a,s){var r=new M("upload"),e=d.requestSnapshotUrl,c=void 0===e?void 0:e,u=g(d,ka),l=Date.now();p._cosUploadMethod(u,function(e,t){var n,o,i;return e||403===t.statusCode?(r.setError(new Bn(e)).end(),o={HttpStatusCode:9999,CostTime:Qt(l,!1),error:e,url:d.url},t.data&&t.data.uploadIP&&(o.uploadIP=t.data.uploadIP),p._uploadSSOLog(o),v.l("".concat(_," failed, error:"),e),void s(new Bn({code:T.MSG_F_UPLOAD_FAIL}))):(n=Object.create(null),o=t.data.location||"",p.isPrivateNetWork()||0!==o.indexOf("https://")&&0!==o.indexOf("http://")||(o=o.split("//")[1]),n.fileName=h.name,n.fileSize=h.size,n.fileType=h.type.slice(h.type.indexOf("/")+1).toLowerCase(),n.location=o,e=Qt(l,!1),o=p._formatFileSize(h.size),i=p._formatSpeed(1e3*h.size/e),o="size:".concat(o," time:").concat(e,"ms speed:").concat(i," res:").concat(JSON.stringify(t.data)),v.l("".concat(_," ok. name:").concat(h.name," ").concat(o)),r.setMessage(o).end(),i={HttpStatusCode:t.statusCode,FileSize:h.size,CostTime:e,url:d.url},t.data&&t.data.uploadIP&&(i.uploadIP=t.data.uploadIP),p._uploadSSOLog(i),(o=p.get(26)).addCost(Zn,e),o.addFileSize(Zn,h.size),i=[],u.thumbUrl&&u.largeUrl&&i.push.apply(i,[p._getSmallImageInfoByUrl(u.thumbUrl,n),p._getLargeImageInfoByUrl(u.largeUrl,n)]),1===p.uploadFileType&&p.isSimpleCos&&!p.isPrivateNetWork()&&(i.push(p._getImageInfoArray(u.downloadUrl,n)),t.data.uploadIP&&i.push(p._getDownloadIP(u.downloadUrl.split("//")[1].split("/")[0],n))),c&&i.push(p._getSnapshotInfoByUrl(c,n)),0<i.length?Promise.all(i).then(function(){a(n)}):void a(n))})})})}},{key:"_getDownloadIP",value:function(e,n){var o="".concat(this._n,"._getDownloadIP"),i=Date.now();return this.req({P:I.GET_IP,data:{domainName:e}}).then(function(e){var t;e.data&&e.data.ip&&(v.l("".concat(o," ok. downloadIP:").concat(e.data.ip," cost:").concat(Qt(i))),(t=n.location.split("/"))[0]=e.data.ip,n.location=t.join("/"))}).catch(function(e){})}},{key:"_getImageInfoArray",value:function(t,n){var o=this,i="".concat(this._n,"._getImageInfoArray"),a=Date.now();return this.req({P:I.GET_IMAGE_INFO,data:{imageUrl:t}}).then(function(e){e=e.data||{};return v.l("".concat(i," ok. data: ").concat(JSON.stringify(e)," cost:").concat(Qt(a))),n.imageInfoArray=e.imageInfoArray,e}).catch(function(e){n.imageInfoArray=void 0,o._uploadSSOLog({HttpStatusCode:1e4,CostTime:Qt(a,!1),url:t})})}},{key:"_uploadSSOLog",value:function(e){var t,n;this.isSimpleCos&&((t=new M).setEventType(18),e.error&&t.setError(new Bn(e.error)),n="HttpStatusCode:".concat(e.HttpStatusCode,"|CosRequestId:").concat(e.CosRequestId||"","|")+"FileAlreadyExist:".concat(e.FileAlreadyExist||0,"|FileSize:").concat(e.FileSize||0,"|CostTime:").concat(e.CostTime),e.uploadIP&&(n+="|FinalIP:".concat(e.uploadIP)),t.setMessage("OK").setMoreMessage(e.url).setExtension(n).end())}},{key:"_getRawOrUploadProxyUrl",value:function(e){var t=this.get(12).getFileUploadProxy(),n=e;return n=t?e.replace(/^https:\/\/[^/]+/,t):n}},{key:"_getFile",value:function(e){return nt(e.file.files)||at(e.file.files)?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?Vt(e/1024,1)+"KB/s":Vt(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(t){var e=this._getFile(t),n=e.name,n=n.slice(n.lastIndexOf(".")),n=this._genFileName("".concat(lt(999999)).concat(n));return{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(n),Body:e}],SliceSize:1048576,onProgress:function(e){if("function"==typeof t.onProgress)try{t.onProgress(e.percent)}catch(e){v.w("onProgress callback error:",e)}},onFileFinish:function(e,t,n){}}}},{key:"_createCosOptionsWXMiniApp",value:function(t){var e=this._getFile(t),n=this._genFileName(e.name),e=e.url;return{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(n),FilePath:e,onProgress:function(e){if(v.l(JSON.stringify(e)),"function"==typeof t.onProgress)try{t.onProgress(e.percent)}catch(e){v.w("onProgress callback error:",e)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(r){var e,c=this,u="",l="",t=0,n=this._getFile(r),t=ae||re?(u=r.message.type===R.MSG_FILE?(e=(e=n.name).slice(e.lastIndexOf(".")),this._genFileName("".concat(lt(999999)).concat(e))):this._genFileName(n.name),l=n.url,1):(e=(e=n.name).slice(e.lastIndexOf(".")),u=this._genFileName("".concat(lt(999999)).concat(e)),l=n,0);return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:u,uploadMethod:t,duration:this.duration,userID:r.message.from,conversationType:At(r.message.conversationID)?1:2}).then(function(e){var t=c.isSimpleCos?e.preSig[0]:e,n=t.uploadUrl,o=t.downloadUrl,i=t.requestSnapshotUrl,i=void 0===i?void 0:i,a=t.thumbUrl,s=t.largeUrl,t=t.fileKey,e=e.uploadIP,e=void 0===e?"":e;return{url:c._getRawOrUploadProxyUrl(n),fileType:c.uploadFileType,fileName:u,resources:l,downloadUrl:o,requestSnapshotUrl:i,thumbUrl:a,largeUrl:s,fileKey:t,uploadIP:!c.isPrivateNetWork()&&e,onProgress:function(e){if("function"==typeof r.onProgress)try{r.onProgress(e.percent)}catch(e){v.w("onProgress callback error:",e),v.e(e)}}}})}},{key:"_genFileName",value:function(e){return"".concat(Ut(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e,n){var o=this,i="_getSnapshotInfoByUrl",a=new M(i);return this.req({P:I.VIDEO_COVER,data:{platform:this.getPlatform(),coverName:this._genFileName(lt(99999)),requestSnapshotUrl:e}}).then(function(e){e=(e.data||{}).snapshotUrl;if(v.l("".concat(o._n,".").concat(i," ok. snapshotUrl:").concat(e)),a.setMessage("snapshotUrl:".concat(e)).end(),Je(e))return{};var t=lo(e,o._fileDownloadProxy,o._authKey,o._fileDNList);return Pt(t).then(function(e){n.snapshotInfo={snapshotUrl:t,snapshotWidth:e.width,snapshotHeight:e.height}})}).catch(function(e){return v.w("".concat(o._n,".").concat(i," failed. error:"),e),a.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}})}},{key:"_getSmallImageInfoByUrl",value:function(t,n){return Pt(lo(t,this._fileDownloadProxy,this._authKey,this._fileDNList)).then(function(e){n.smallImageUrl=t,n.smallImageWidth=e.width,n.smallImageHeight=e.height})}},{key:"_getLargeImageInfoByUrl",value:function(t,n){return Pt(lo(t,this._fileDownloadProxy,this._authKey,this._fileDNList)).then(function(e){n.largeImageUrl=t,n.largeImageWidth=e.width,n.largeImageHeight=e.height})}},{key:"_isEmptyFileList",value:function(e){return!(!at(e)||0!==e.length)}},{key:"reset",value:function(){v.l("".concat(this._n,".reset"))}}]),Ua),Aa=["downloadKey","pbDownloadKey","messageList"],Oa=(e(Pa,[{key:"uploadMergerMessage",value:function(e,n){var o="".concat(this._n,".").concat("uploadMergerMessage"),e=(v.d("".concat(o," message:"),e,"messageBytes:".concat(n)),JSON.parse(JSON.stringify(e.payload)).messageList),i=e.length,t=this._msgM.get(17).getFileDNList(),a=new M("uploadMergerMessage");return e.forEach(function(e){po(e.messageBody[0].type,e.messageBody,t)}),this._msgM.req({P:I.UPLOAD_MERGER_MSG,data:{messageList:e}}).then(function(e){v.d("".concat(o," ok. response:"),e.data);var e=e.data,t=e.pbDownloadKey,e=e.downloadKey,t={pbDownloadKey:t,downloadKey:e,messageNumber:i};return a.setMessage("".concat(i,"-").concat(n,"-").concat(e)).end(),t}).catch(function(e){throw v.w("".concat(o," failed. error:"),e),a.setError(e).end(),e})}},{key:"downloadMergerMessage",value:function(i){var a=this,s="".concat(this._n,".").concat("downloadMergerMessage"),t=(v.d("".concat(s," message:"),i),i.payload.downloadKey),r=this._msgM.getFileDownloadProxy(),c=this._msgM.getDowloadFileAuthKey(),u=new M("downloadMergerMessage");return u.setMessage("downloadKey:".concat(t)),this._msgM.req({P:I.DOWNLOAD_MERGER_MSG,data:{downloadKey:t}}).then(function(e){v.d("".concat(s," ok. response:"),e.data);var t,n,o=a._msgM.get(17).getFileDNList();return it(i.clearElement)?((t=i.payload).downloadKey,t.pbDownloadKey,t.messageList,t=g(t,Aa),i.clearElement(),i.setElement({type:i.type,content:y({messageList:e.data.messageList},t)},r,c,o)):(n=[],e.data.messageList.forEach(function(e){Je(e)||(e=new Lo(e,r,c,o),n.push(e))}),i.payload.messageList=n,i.payload.downloadKey="",i.payload.pbDownloadKey=""),u.end(),i}).catch(function(e){throw v.w("".concat(s," failed. key:").concat(t," error:"),e),u.setError(e).end(),e})}},{key:"createMergerMessagePack",value:function(e,t,n){return e.conversationType===R.CONV_C2C?this._createC2CMergerMessagePack(e,t,n):this._createGroupMergerMessagePack(e,t,n)}},{key:"_createC2CMergerMessagePack",value:function(e,t,n){var o=null,i=(t&&(t.offlinePushInfo&&(o=t.offlinePushInfo),!0===t.onlineUserOnly&&(o?o.disablePush=!0:o={disablePush:!0})),[]),a=(et(t)&&et(t.messageControlInfo)&&(a=(r=t.messageControlInfo).excludedFromUnreadCount,s=r.excludedFromLastMessage,r=r.excludedFromContentModeration,!0===a&&i.push("NoUnread"),!0===s&&i.push("NoLastMsg"),!0===r&&i.push("NoMsgCheck")),""),s=(ft(e.cloudCustomData)&&0<e.cloudCustomData.length&&(a=e.cloudCustomData),n.pbDownloadKey),r=n.downloadKey,n=n.messageNumber,c=e.payload,l=c.title,d=c.abstractList,c=c.compatibleText,u=this._msgM.get(6),u=u&&u.isOnlineMessage(e,t)?0:void 0;return{P:I.SEND_C2C_MSG,data:{fromAccount:this._msgM.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:s,downloadKey:r,title:l,abstractList:d,compatibleText:c,messageNumber:n}}],cloudCustomData:a,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:u,offlinePushInfo:Bo(o),messageControlInfo:0!==u?i:void 0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0}}}},{key:"_createGroupMergerMessagePack",value:function(e,t,n){var o=null,i=(t&&t.offlinePushInfo&&(o=t.offlinePushInfo),[]),a=(et(t)&&et(t.messageControlInfo)&&(a=(r=t.messageControlInfo).excludedFromUnreadCount,s=r.excludedFromLastMessage,r=r.excludedFromContentModeration,!0===a&&i.push("NoUnread"),!0===s&&i.push("NoLastMsg"),!0===r&&i.push("NoMsgCheck")),""),s=(ft(e.cloudCustomData)&&0<e.cloudCustomData.length&&(a=e.cloudCustomData),n.pbDownloadKey),r=n.downloadKey,n=n.messageNumber,c=e.payload,l=c.title,d=c.abstractList,c=c.compatibleText,u=this._msgM.get(7),t=u&&u.isOnlineMessage(e,t)?1:0;return{P:I.SEND_GRP_MSG,data:{fromAccount:this._msgM.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:s,downloadKey:r,title:l,abstractList:d,compatibleText:c,messageNumber:n}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:a,onlineOnlyFlag:t,offlinePushInfo:Bo(o),clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||u.isMessageFromOrToAVChatroom(e.to)?0:1,messageControlInfo:0==t?i:void 0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0}}}}]),Pa),Na={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,MSG_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},Ga=[T.MSG_ONPROGRESS_ERR,T.MSG_I_SELECT_F_FIRST,T.MSG_I_TYPES_LIMIT,T.MSG_F_IS_EMPTY,T.MSG_I_SIZE_LIMIT,T.MSG_F_SELECT_F_FIRST,T.MSG_F_SIZE_LIMIT,T.MSG_V_SIZE_LIMIT,T.MSG_V_TYPES_LIMIT,T.MSG_A_UPLOAD_FAIL,T.MSG_A_SIZE_LIMIT,T.COS_UNDETECTED];function Pa(e){d(this,Pa),this._n="MergerMessageHandler",this._msgM=e}function Ua(e){d(this,Ua),(e=Ea.call(this,e))._n="UploadModule",e.TIMUploadPlugin=null,e.timUploadPlugin=null,e.COSSDK=null,e._cosUploadMethod=null,e.expiredTimeLimit=600,e.appid=0,e.bucketName="",e.ciUrl="",e.directory="",e.downloadUrl="",e.uploadUrl="",e.region="ap-shanghai",e.cos=null,e.cosOptions={secretId:"",secretKey:"",sessionToken:"",expiredTime:0},e.uploadFileType="",e.duration=900,e.tryCount=0,e.UPLOAD_SIZE_LIMIT={A:20971520,F:104857600,I:20971520,V:104857600},e.isSimpleCos=!1,e._fileDownloadProxy="",e._authKey="",e._fileDNList=Sa;var t=e.getIEmitInst();return t.on(Wo.A2KEY_AND_TINYID_UPDATED,e._init,h(e)),t.on(Wo.CLOUD_CONFIG,e._onCloudConfig,h(e)),e}function ba(e){var t=!1;return Object.values(Na).includes(e)&&(t=!0),t=120001<=e&&e<=13e4||10100<=e&&e<=10200?!0:t}t(ts,Fn),Ha=f(ts),e(ts,[{key:"createTextMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new Ro(e)),e=ft(e.payload)?e.payload:e.payload.text,e=new ao({text:e}),t=this._getNickAndAvatarByUserID(t);return n.setElement(e),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createImageMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new Ro(e));if(ae){var o=e.payload.file;if(Ze(o))return void this.warn("FileUnsupportedInMP","createImageMessage");var i=o.tempFiles[0].path||o.tempFiles[0].tempFilePath,o={url:i,name:i.slice(i.lastIndexOf("/")+1),size:o.tempFiles&&o.tempFiles[0].size||1,type:i.slice(i.lastIndexOf(".")+1).toLowerCase()};e.payload.file=o}else re?(o={url:(i=e.payload.file).uri,name:i.fileName,size:i.fileSize||1,type:i.type,width:i.width,height:i.height},e.payload.file=o):ce&&(Ze(e.payload.file)?(i=e.payload.file,e.payload.file={files:[i]}):et(e.payload.file)&&"undefined"!=typeof uni&&(o=e.payload.file.tempFiles[0],e.payload.file={files:[o]}));i=new go({imageFormat:Fe.UNKNOWN,uuid:this._generateUUID(e.payload.file),file:e.payload.file}),o=this._getNickAndAvatarByUserID(t);return n.setElement(i),n.setNickAndAvatar(o),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createAudioMessage",value:function(e){var t=e.payload.file,n=(ae&&(n={url:t.tempFilePath,name:t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/")+1),size:t.fileSize,second:parseInt(t.duration)/1e3,type:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".")+1).toLowerCase()},e.payload.file=n),re&&(n={url:t.uri,name:t.uri.slice(t.uri.lastIndexOf("/")+1),size:t.fileSize||1,second:Math.floor(t.duration/1e3),type:t.uri.slice(t.uri.lastIndexOf(".")+1).toLowerCase()},e.payload.file=n,Je(t.uri)&&this.warn("VoiceFileInRN")),this.getMyUserID()),o=(e.currentUser=n,e.senderTinyID=this.getMyTinyID(),new Ro(e)),t=new mo({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size||1,url:t.tempFilePath||t.uri,uuid:this._generateUUID(e.payload.file)}),n=this._getNickAndAvatarByUserID(n);return o.setElement(t),o.setNickAndAvatar(n),o.setNameCard(this._getNameCardByGroupID(o)),this._messageOptionsMap.set(o.clientSequence,e),o}},{key:"createVideoMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl="",e.payload.file.thumbSize=0,{});if(ae){if(ee)return void this.warn("VideoUnsupportedInAlipay");if(Ze(e.payload.file))return void this.warn("FileUnsupportedInMP","createVideoMessage");var o=e.payload.file;nt(o.tempFiles)&&(o=o.tempFiles[0]),n.url=o.tempFilePath,n.name=o.tempFilePath.slice(o.tempFilePath.lastIndexOf("/")+1),n.size=o.size||1,n.second=o.duration||0,n.type=o.tempFilePath.slice(o.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else re?(o=e.payload.file,n.url=o.uri,n.name=o.fileName,n.size=o.fileSize||1,n.second=o.duration||0,n.type=o.type.split("/")[1]):ce&&(Ze(e.payload.file)?(o=e.payload.file,e.payload.file.files=[o]):et(e.payload.file)&&"undefined"!=typeof uni&&(o=e.payload.file.tempFile,e.payload.file.files=[o]),o=e.payload.file,n.url=window.URL.createObjectURL(o.files[0]),n.name=o.files[0].name,n.size=o.files[0].size||1,n.second=o.files[0].duration||0,n.type=o.files[0].type.split("/")[1]);e.payload.file.videoFile=n;o=new Ro(e),n=new Do({videoFormat:n.type,videoSecond:Vt(n.second,0),videoSize:n.size,remoteVideoUrl:"",videoUrl:n.url,videoUUID:this._generateUUID(e.payload.file.videoFile),thumbUUID:this._generateUUID(e.payload.file.videoFile),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()}),t=this._getNickAndAvatarByUserID(t);return o.setElement(n),o.setNickAndAvatar(t),o.setNameCard(this._getNameCardByGroupID(o)),this._messageOptionsMap.set(o.clientSequence,e),o}},{key:"createCustomMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new Ro(e)),e=new To({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),t=this._getNickAndAvatarByUserID(t);return n.setElement(e),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createFaceMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new Ro(e)),e=new fo(e.payload),t=this._getNickAndAvatarByUserID(t);return n.setElement(e),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createMergerMessage",value:function(e){var t=this.getMyUserID(),t=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),this._getNickAndAvatarByUserID(t)),n=new Ro(e),e=new So(e.payload);return n.setElement(e),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),n.setRelayFlag(!0),n}},{key:"createForwardMessage",value:function(e){var t=e.to,n=e.conversationType,o=e.priority,i=e.payload,a=e.needReadReceipt,s=e.receiverList;if(!nt(i._elements))return C({code:T.MSG_FORWARD_INVALID_ELEMENTS});var r=this.getMyUserID(),c=this._getNickAndAvatarByUserID(r);if(i.type===R.MSG_GRP_TIP)return C({code:T.MSG_FORWARD_TYPE_INVALID});n={to:t,conversationType:n,conversationID:"".concat(n).concat(t),priority:o,isPlaceMessage:0,status:An,currentUser:r,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||i.cloudCustomData||"",needReadReceipt:a,receiverList:s,isSupportExtension:e.isSupportExtension||!1},t=new Ro(n);return t.setElement(i._elements[0]),t.setNickAndAvatar(c),t.setNameCard(this._getNameCardByGroupID(i)),t.setRelayFlag(!0),t}},{key:"downloadMergerMessage",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:"createFileMessage",value:function(e){if(ae){if(!z&&!Z&&!ne)return;var t=ue.getSystemInfoSync().SDKVersion;if(z&&wt(t,"2.5.0")<0)return void this.warn("WXChooseMessageFile");if(Z&&wt(t,"1.18.0")<0)return void this.warn("QQChooseMessageFile")}ce||ne?Ze(e.payload.file)?(t=e.payload.file,e.payload.file={files:[t]}):et(e.payload.file)&&"undefined"!=typeof uni&&(o=(t=e.payload.file).tempFiles,t=t.files,n=null,nt(o)?n=o[0]:nt(t)&&(n=t[0]),e.payload.file={files:[n]}):z||Z?(t=y(y({},(o=e.payload.file.tempFiles)[0]),{},{url:o[0].path}),e.payload.file={files:[t]}):re&&(o=y(y({},n=e.payload.file),{},{url:n.uri}),e.payload.file={files:[o]});var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new Ro(e)),o=new Co({uuid:this._generateUUID(e.payload.file),file:e.payload.file}),t=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createLocationMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new Ro(e)),e=new Eo(e.payload),t=this._getNickAndAvatarByUserID(t);return n.setElement(e),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"_onNoModule",value:function(){return C({code:T.NO_MODULE})}},{key:"sendMessageInstance",value:function(a,s){var r=this;if(!1===this.get(29).filterMessage(a,s))return a.hasRiskContent=!0,this._onSendMessageFailed(a,new Bn({code:T.PROFANITY_FOUND}));var t=null;if(a.conversationType===R.CONV_C2C)t=this.get(6);else{if(a.conversationType!==R.CONV_GROUP)return C({code:T.MSG_INVALID_CONV_TYPE});t=this.get(7)}if(!t)return this._onNoModule();var c,u="".concat(this._n,".sendMessageInstance"),l=this.get(11),d=t.isOnlineMessage(a,s);return this.get(17).upload(a).then(function(){return r._getSendMessageSpecifiedKey(a)===Xn&&r.get(26).addSuccessCount(Zn),r._guardForGroup(a).then(function(){if(!a.isSendable())return C({code:T.MSG_F_URL_IS_EMPTY});r._addSendMessageTotalCount(a),c=Date.now();var e=function(e){var t="utf-8";ce&&document&&(t=document.charset.toLowerCase());var n,o=0,i=e.length;if("utf-8"===t||"utf8"===t)for(var a=0;a<i;a++)(n=e.codePointAt(a))<=127?o+=1:n<=2047?o+=2:n<=65535?o+=3:(o+=4,a++);else if("utf-16"===t||"utf16"===t)for(var s=0;s<i;s++)(n=e.codePointAt(s))<=65535?o+=2:(o+=4,s++);else o=e.replace(/[^\x00-\xff]/g,"aa").length;return o}(JSON.stringify(a));return a.type===R.MSG_MERGER&&11264<e?r._mergerMessageHandler.uploadMergerMessage(a,e).then(function(e){e=r._mergerMessageHandler.createMergerMessagePack(a,s,e);return r.req(e)}):(l.setMessageRandom(a),t.sendMessage(a,s))}).then(function(e){var t,e=e.data,n=e.time,o=e.sequence,i=e.readReceiptCode,e=e.messageDropReason,i=(Qe(i)&&0!==i&&(new M("sendMessageWithReceipt").setMessage("from:".concat(a.from," to:").concat(a.to," sequence:").concat(o," readReceiptCode:").concat(i)).end(),v.w("".concat(u," readReceiptCode:").concat(i," message:").concat(r.getErrMsg(i)))),e&&(i=new M("messageDropReason"),e="from:".concat(a.from," to:").concat(a.to," sequence:").concat(o," messageDropReason:").concat(e),i.setMessage(e).end(),v.w("".concat(u," ").concat(e))),r._addSendMessageSuccessCount(a,c),r._messageOptionsMap.delete(a.clientSequence),!0===a.isResend&&(t=l.findMessage(a.ID))&&(v.l("".concat(u," resend ok. ID:").concat(t.ID)),l.deleteLocalMessage(t)),a.status=On,a.time=n,!1);return a.conversationType===R.CONV_GROUP?a.sequence=o:a.conversationType!==R.CONV_C2C||(e=l.getLatestMessageSentByMe(a.conversationID))&&(t=e.nick,n=e.avatar,t===a.nick&&n===a.avatar||(i=!0)),i&&l.modifyMessageSentByMe({conversationID:a.conversationID,latestNick:a.nick,latestAvatar:a.avatar}),!0===d?a._onlineOnlyFlag=!0:(l.appendToMessageList(a),o=a,et(s)&&et(s.messageControlInfo)&&(!0===s.messageControlInfo.excludedFromLastMessage&&(a._isExcludedFromLastMessage=!0,o=""),!0===s.messageControlInfo.excludedFromUnreadCount&&(a._isExcludedFromUnreadCount=!0)),e=a.conversationType,Rt(a.to)&&(e=R.CONV_TOPIC,r.get(10).onMessageSent({groupID:Kt(a.to),topicID:a.to,lastMessage:o})),l.onMessageSent({conversationOptionsList:[{conversationID:a.conversationID,unreadCount:0,type:e,subType:a.conversationSubType,lastMessage:o}]})),a._relayFlag||"TIMImageElem"!==a.type||qt(a.payload.imageInfoArray),Sn({message:a})})}).catch(function(e){return r._onSendMessageFailed(a,e,d)})}},{key:"_guardForGroup",value:function(e){if(e.conversationType!==R.CONV_GROUP)return Promise.resolve();var t=this.get(7);if(!t)return this._onNoModule();if(kt({groupID:e.to})){var n=t.getLocalGroupProfile(e.to);if(n&&n.isSupportTopic)return C({code:T.MSG_SEND_GRP_WITH_TOPIC_FAIL})}return t.guardForAVChatRoom(e)}},{key:"_onSendMessageFailed",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],o="".concat(this._n,"._onSendMessageFailed"),i=(e.status=Nn,80001!==t.code&&80004!==t.code||(e.hasRiskContent=!0),this.get(11)),a=(i.deleteMessageRandom(e),10100<=t.code&&t.code<=10200||120001<=t.code&&t.code<=13e4),n=(n||a||!0===i.appendToMessageList(e)&&v.l("".concat(o," message stored, ID:").concat(e.ID)),this._addSendMessageFailCountOnUser(e,t),new M("sendMessage")),a="head.seq:".concat(t.data.headSeq," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to);return ce&&("connection"in navigator&&(i=navigator.connection,a+=" downlink:".concat(i.downlink," effectiveType:").concat(i.effectiveType," rtt:").concat(i.rtt)),"memory"in window.performance&&(i=window.performance.memory,a+=" usedJSHeapSize:".concat(i.usedJSHeapSize," totalJSHeapSize:").concat(i.totalJSHeapSize," jsHeapSizeLimit:").concat(i.jsHeapSizeLimit))),n.setMessage(a).setError(t).end(),v.e("".concat(o," ").concat(a," error:"),t),C(new Bn({code:t&&t.code?t.code:T.MSG_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([R.MSG_IMAGE,R.MSG_AUDIO,R.MSG_VIDEO,R.MSG_FILE].includes(e.type))return Xn;if(e.conversationType===R.CONV_C2C)return jn;if(e.conversationType===R.CONV_GROUP){var t=this.get(7);if(t){t=t.getLocalGroupProfile(e.to);if(t)return e=t.type,St(e)?zn:Jn}}}},{key:"_addSendMessageTotalCount",value:function(e){e=this._getSendMessageSpecifiedKey(e);e&&this.get(26).addTotalCount(e)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n,e=this._getSendMessageSpecifiedKey(e);e&&((n=this.get(26)).addSuccessCount(e),n.addCost(e,Qt(t,!1)))}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var n,t=t.code,t=void 0===t?-1:t,o=this.get(26),e=this._getSendMessageSpecifiedKey(e);e===Xn&&(n=!1,n=Ga.includes(t)?!0:n)?o.addFailedCountOfUserSide(Zn):ba(t)&&e&&o.addFailedCountOfUserSide(e)}},{key:"resendMessage",value:function(e,t){return e.isResend=!0,e.status=An,this.sendMessageInstance(e,t)}},{key:"revokeMessage",value:function(n){var t=this,e=null;if(n.conversationType===R.CONV_C2C?e=this.get(6):n.conversationType===R.CONV_GROUP&&(e=this.get(7)),!e)return this._onNoModule();var o=new M("revokeMessage"),i=(o.setMessage("type:".concat(n.type," from:").concat(n.from," to:").concat(n.to)),"".concat(this._n,".").concat("revokeMessage"));return e.revokeMessage(n).then(function(e){var e=e.data.recallRetList;return Je(e)||0===e[0].retCode?(v.i("".concat(i," ok. ID:").concat(n.ID)),n.isRevoked=!0,o.end(),t.get(11).onMessageRevoked([n]),Sn({message:n})):(e=new Bn({code:e[0].retCode,data:{message:n}}),o.setCode(e.code).setMoreMessage(e.message).end(),C(e))}).catch(function(e){o.setError(e).end();var t=new Bn({code:e&&e.code?e.code:T.MSG_REVOKE_FAIL,message:e&&e.message?e.message:void 0,data:{message:n}});return v.w("".concat(i," failed. error:"),e),C(t)})}},{key:"deleteMessage",value:function(e){var t=this,n=null,o=e[0],i=o.conversationID,a="",s=[],r=[];if(o.conversationType===R.CONV_C2C)n=this.get(6),a=i.replace(R.CONV_C2C,""),e.forEach(function(e){e&&e.status===On&&e.conversationID===i&&(e._onlineOnlyFlag||s.push("".concat(e.sequence,"_").concat(e.random,"_").concat(e.time)),r.push(e))});else if(o.conversationType===R.CONV_GROUP)n=this.get(7),a=i.replace(R.CONV_GROUP,""),e.forEach(function(e){e&&e.status===On&&e.conversationID===i&&(e._onlineOnlyFlag||s.push("".concat(e.sequence)),r.push(e))});else if(o.conversationType===R.CONV_SYSTEM)return C({code:T.CANNOT_DELETE_GRP_SYSTEM_NOTICE});if(!n)return this._onNoModule();if(0===s.length)return this._onMessageDeleted(r);30<s.length&&(s=s.slice(0,30),r=r.slice(0,30));var c=new M("deleteMessage"),u=(c.setMessage("to:".concat(a," count:").concat(s.length)),"".concat(this._n,".").concat("deleteMessage"));return n.deleteMessage({to:a,keyList:s}).then(function(e){return c.end(),v.i("".concat(u," ok")),t._onMessageDeleted(r)}).catch(function(e){c.setError(e).end(),v.w("".concat(u," failed. error:"),e);e=new Bn({code:e&&e.code?e.code:T.MSG_DELETE_FAIL,message:e&&e.message?e.message:void 0});return C(e)})}},{key:"_onMessageDeleted",value:function(e){return this.get(11).onMessageDeleted(e),kn({messageList:e})}},{key:"translateText",value:function(e){var o="".concat(this._n,".").concat("translateText"),t=e.sourceTextList,n=e.sourceLanguage,e=e.targetLanguage,i=new M("translateText");return i.setMessage("sourceLanguage:".concat(n," targetLanguage:").concat(e)),this.req({P:I.TRANSLATE_TEXT,data:{sourceTextList:t,source:n||"auto",target:e,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then(function(e){var e=e.data,t=e.error,n=e.requestID,e=e.translatedTextList;if(0===t.code)return i.end(),v.i("".concat(o," ok. requestID:").concat(n)),Sn({translatedTextList:e});throw y(y({},t),{},{requestID:n})}).catch(function(e){return i.setCode(e.code).setMoreMessage(e.requestID).end(),v.w("".concat(o," failed. error:"),e),C({code:T.TRANSLATE_TEXT_FAIL})})}},{key:"convertVoiceToText",value:function(e){var t=e.message,e=e.language,n=t.payload.url,t=(t.from===this.getMyUserID()&&"out"===t.flow&&(n=t.payload.remoteAudioUrl),/\.(wav|pcm|ogg-opus|speex|silk|mp3|m4a|aac|amr)/);if(!t.test(n))return C({code:T.UNSUPPORTED_VOICE_FORMAT});var t=t.exec(n)[1]||"mp3",o="16k_zh-PY",e=(e?"zh (cmn-Hans-CN)"===e?o="16k_zh":"en-US"===e?o="16k_en":"yue-Hant-HK"===e?o="16k_yue":"ja-JP"===e&&(o="16k_ja"):o="16k_zh-PY","serviceType:".concat(o," url:").concat(n)),i="".concat(this._n,".").concat("convertVoiceToText"),a=(v.i("".concat(i," ").concat(e)),new M("convertVoiceToText"));return a.setMessage(e),this.req({P:I.VOICE_TO_TEXT,data:{url:n,language:o,SDKAppID:this.getSDKAppID(),format:t}}).then(function(e){var e=e.data,t=e.error,n=e.requestID,e=e.result;if(0===t.code)return a.end(),v.i("".concat(i," ok. requestID:").concat(n)),Sn({result:e});throw y(y({},t),{},{requestID:n})}).catch(function(e){return a.setCode(e.code).setMoreMessage(e.requestID||"").end(),v.w("".concat(i," failed. error:"),e),C({code:T.VOICE_TO_TEXT_FAIL})})}},{key:"modifyRemoteMessage",value:function(n){var o=this;if(!1===this.get(29).filterMessage(n))return n.hasRiskContent=!0,C({code:T.PROFANITY_FOUND,data:{message:n}});var e=null,t=n.conversationType,i=n.to;if(t===R.CONV_C2C)e=this.get(6);else if(t===R.CONV_GROUP){if(!(e=this.get(7)))return this._onNoModule();if(e.isMessageFromOrToAVChatroom(i))return C({code:T.MSG_MODIFY_DISABLED_IN_AV,data:{message:n}})}var a=new M("modifyMessage"),s=(a.setMessage("to:".concat(i)),"".concat(this._n,".modifyRemoteMessage"));return e.modifyRemoteMessage(n).then(function(e){a.end(),v.i("".concat(s," ok"));e=o._onModifyRemoteMessageResp(n,e.data);return Sn({message:e})}).catch(function(e){var t;return a.setCode(e.code).setMoreMessage(e.message).end(),v.w("".concat(s," failed. error:"),e),20027===e.code?(t=o._onModifyRemoteMessageResp(n,e.data),C({code:T.MSG_MODIFY_CONFLICT,data:{message:t}})):C({code:e.code,message:e.message,data:{message:n}})})}},{key:"_onModifyRemoteMessageResp",value:function(e,t){v.d("".concat(this._n,"._onModifyRemoteMessageResp options:"),t);var n=e.conversationType,o=e.from,i=e.to,a=e.random,s=e.sequence,e=e.time,r=t.elements,c=t.messageVersion,t=t.cloudCustomData,t=void 0===t?"":t;return this.get(11).onMessageModified({conversationType:n,from:o,to:i,time:e,random:a,sequence:s,elements:r,cloudCustomData:t,messageVersion:c})}},{key:"_generateUUID",value:function(e){var t=this.get(12),t="".concat(t.getSDKAppID(),"-").concat(t.getUserID(),"-").concat(dt()),e=e.name||e.value||e.url||e.tempFilePath,e=e&&e.slice(e.lastIndexOf(".")+1);return t=e?"".concat(t,".").concat(e):t}},{key:"getMessageOption",value:function(e){return this._messageOptionsMap.get(e)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.get(4).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===R.CONV_GROUP){var t=this.get(7);if(t)return t.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._messageOptionsMap.clear()}}]);var wa,Fa,qa,xa,Va,Ha,Ba=ts,Ka=(t(es,Fn),Va=f(es),e(es,[{key:"onMsgExtNotify",value:function(e){var o=this,e=e.dataList,t=e.messageInfo,i=e.operateType,n=e.operateResultList,l=e.tinyID,e=e.globalSequence,d=t.clientTime,t=t.random,a="".concat(l,"-").concat(d,"-").concat(t),s=[],r=[],c=(v.l("".concat(this._n,".onMsgExtNotify messageID:").concat(a," operateType:").concat(i," globalSequence:").concat(e)),this._updateGlobalSeq(a,e),!1),u=!1;n.forEach(function(e){var t=e.extensions,t=void 0===t?[]:t,n=e.clearSequence;1===i?(c=!0,t.forEach(function(e){s.push({key:e.key,value:e.value})}),o._updateLocalExt(a,t)):2===i?(u=!0,t.forEach(function(e){r.push(e.key)}),o._updateLocalExt(a,t)):3===i&&(u=!0,o._hasLocalExt(a)&&o._getLocalExt(a).forEach(function(e,t){e.seq<=n&&!Je(e.value)&&r.push(t)}),o._clearLocalExt(a,n))}),c&&this.emitOEvt(G.MESSAGE_EXTENSIONS_UPDATED,{messageID:a,extensions:s}),u&&this.emitOEvt(G.MESSAGE_EXTENSIONS_DELETED,{messageID:a,keyList:r})}},{key:"setMessageExtensions",value:function(e,t){var n="setMessageExtensions";if(!this.canIUse(H.MSG_EXT))return this.noUse(n);var o="".concat(this._n,".").concat(n),i=e.ID,a=e.conversationID,s=e.sequence,r=e.time,c=D(t),t=(20<t.length&&(c=t.slice(0,20),v.w("".concat(o,". the length of extensions cannot exceed 20."))),"convID:".concat(a," messageID:").concat(i," sequence:").concat(s," time:").concat(r," count:").concat(c.length)),u=new M(n);return u.setMessage(t),v.l("".concat(o," ").concat(t)),this._modifyMsgExts(e,c).then(function(e){var t=e.resultList,n=e.successCount,e=e.failureCount,n="successCount:".concat(n," failCount:").concat(e);return u.setMoreMessage(n).end(),v.l("".concat(o," ok. ").concat(n)),Sn({extensions:t})}).catch(function(e){return u.setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"getMessageExtensions",value:function(e){var t=this,n="getMessageExtensions";if(!this.canIUse(H.MSG_EXT))return this.noUse(n);var o="".concat(this._n,".").concat(n),i=e.ID,a=e.conversationID,s=e.sequence,r=e.time,a="convID:".concat(a," messageID:").concat(i," sequence:").concat(s," time:").concat(r),c=new M(n),u=(c.setMessage(a),v.l("".concat(o," ").concat(a)),void 0);return this.getMsgExtsMap.has(i)&&(u=this._getGlobalSeq(i)),this._getMsgExts(e,u).then(function(e){return c.end(),v.l("".concat(o," ok. extCount:").concat(e.length)),A(u)&&0<e.length&&t.getMsgExtsMap.set(i,1),Sn({extensions:e})}).catch(function(e){return c.setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"deleteMessageExtensions",value:function(e,t){var n="deleteMessageExtensions";if(!this.canIUse(H.MSG_EXT))return this.noUse(n);var i="".concat(this._n,".").concat(n),o=[],a=3,t=(Je(t)||(a=2,t.forEach(function(e){o.push({key:e,value:"",seq:0})})),e.ID),s=e.conversationID,r=e.sequence,c=e.time,s="convID:".concat(s," messageID:").concat(t," sequence:").concat(r," time:").concat(c," operateType:").concat(a),u=new M(n);return u.setMessage(s),v.l("".concat(i," ").concat(s)),this._modifyMsgExts(e,o,a).then(function(e){var t=e.resultList,n=e.successCount,e=e.failureCount,o="";return 2===a&&(o="success count:".concat(n," fail count:").concat(e)),u.setMoreMessage("".concat(o)).end(),v.l("".concat(i," ok. ").concat(o)),Sn({extensions:t})}).catch(function(e){return u.setError(e).end(),v.e("".concat(i," failed. error:"),e),C(e)})}},{key:"_modifyMsgExts",value:function(n,e){var o=this,t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=Rt(n.to)?R.CONV_TOPIC:n.conversationType,a=void 0,s=(3!==t&&(a=this._getReqExts(n,e)),null);switch(i){case R.CONV_C2C:s=this.get(6);break;case R.CONV_GROUP:s=this.get(7);break;case R.CONV_TOPIC:s=this.get(10);break;default:return C({code:T.NO_MODULE})}return s.modifyMsgExts(n,a,t).then(function(e){var e=e.data,t=e.extensions,e=e.seq,i=[],a=0,s=0,r=[];return(t=Je(t)?[]:t).forEach(function(e){var t=e.errorCode,e=e.extension,n=e.key,o=e.value,e=e.seq;i.push({code:t,key:n,value:o}),0===t?a++:s++,r.push({key:n,value:o,seq:e})}),o._updateGlobalSeq(n.ID,e),0<r.length&&(o._updateLocalExt(n.ID,r),r=null),{resultList:i,successCount:a,failureCount:s}}).catch(function(e){return C(e)})}},{key:"_getReqExts",value:function(e,t){var o,i=[];return this._hasLocalExt(e.ID)?(o=this._getLocalExt(e.ID),t.forEach(function(e){var t=e.key,e=e.value,n=0;o.has(t)&&(n=o.get(t).seq),i.push({key:t,value:e,seq:n})})):t.forEach(function(e){var t=e.key,e=e.value;i.push({key:t,value:e,seq:0})}),i}},{key:"_getMsgExts",value:function(i,e){var a=this,s="".concat(this._n,"._getMsgExts"),r=i.ID,t=i.to,n=null;switch(Rt(t)?R.CONV_TOPIC:i.conversationType){case R.CONV_C2C:n=this.get(6);break;case R.CONV_GROUP:n=this.get(7);break;case R.CONV_TOPIC:n=this.get(10);break;default:return C({code:T.NO_MODULE})}return n.getMessageExtensions(i,e).then(function(e){var e=e.data,t=e.extensions,n=e.completeFlag,o=e.globalSequence,e=e.clearSequence,t=Je(t)?[]:t;return v.l("".concat(s," ok. completeFlag:").concat(n," globalSequence:").concat(o," clearSequence:").concat(e," count:").concat(t.length)),a._updateLocalExt(r,t),a._clearLocalExt(r,e),a._updateGlobalSeq(r,o),1!==n?(e=t.slice(-1)[0].seq+1,a._getMsgExts(i,e)):a._getLocalExtList(r)}).catch(function(e){return C(e)})}},{key:"_hasLocalExt",value:function(e){return this.msgExtMap.has(e)}},{key:"_getLocalExt",value:function(e){return this.msgExtMap.get(e)}},{key:"_updateLocalExt",value:function(e,t){this._hasLocalExt(e)||this.msgExtMap.set(e,new Map);var o=this._getLocalExt(e);t.forEach(function(e){var t=e.key,n=e.value,e=e.seq;o.set(t,{value:void 0===n?"":n,seq:e})})}},{key:"_clearLocalExt",value:function(e,n){var o;n<=0||!this._hasLocalExt(e)||(o=this._getLocalExt(e)).forEach(function(e,t){e.seq<=n&&o.delete(t)})}},{key:"_getLocalExtList",value:function(e){var n=[];return this._hasLocalExt(e)&&this._getLocalExt(e).forEach(function(e,t){e=e.value;Je(e)||n.push({key:t,value:e})}),n}},{key:"_getGlobalSeq",value:function(e){return this.globalSeqMap.get(e)}},{key:"_updateGlobalSeq",value:function(e,t){this.globalSeqMap.set(e,t)}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this.msgExtMap.clear(),this.globalSeqMap.clear(),this.getMsgExtsMap.clear()}}]),es),Ya=(t($a,Fn),xa=f($a),e($a,[{key:"onReactionNotifyList",value:function(e){var a=this,e=(e||{}).dataList;(void 0===e?[]:e).forEach(function(e){var t=e.C2CMessageInfo,n=e.groupMessageInfo,n=void 0===n?{}:n,e=e.reactionList,e=void 0===e?[]:e,t=y(y({},void 0===t?{}:t),n),n=t.tinyID,o=t.clientTime,t=t.random,n="".concat(n,"-").concat(o,"-").concat(t),i=[];e.forEach(function(e){A(e.userIDList)&&(e.userIDList=[],e.count=0),i.push.apply(i,D(e.userIDList))}),v.l("".concat(a._n,".onReactionNotifyList messageID:").concat(n," reactionList:").concat(e.length)),a._handleReactionSummary([{messageID:n,reactionList:e}],i).then(function(e){a.emitOEvt(G.MESSAGE_REACTIONS_UPDATED,y({},e[0]))})})}},{key:"onReactionNotify",value:function(e){var e=e.dataList||{},t=e.C2CMessageInfo,n=e.groupMessageInfo,n=void 0===n?{}:n,o=e.reactionID,e=e.operateType,t=y(y({},void 0===t?{}:t),n),n=t.tinyID,i=t.clientTime,t=t.random,n="".concat(n,"-").concat(i,"-").concat(t),i=(v.l("".concat(this._n,".onReactionNotify messageID:").concat(n," reactionID:").concat(o," operateType:").concat(e)),1===e?this._addReactedByMyselfMap(n,o):this._removeReactedByMyselfMap(n,o),"".concat(n,"-").concat(o));this._reactionInfoMap.has(i)&&((t=this._reactionInfoMap.get(i)).reactedByMyself=1===e,this.emitOEvt(G.MESSAGE_REACTIONS_UPDATED,{messageID:n,reactionList:[t]}))}},{key:"addMessageReaction",value:function(t,n){var o=this,e="addMessageReaction";if(!this.canIUse(H.MSG_REACTION))return this.noUse(e);var i="".concat(this._n,".").concat(e),a=t.ID,s=t.conversationID,s="convID:".concat(s," messageID:").concat(a," reactionID:").concat(n),r=new M(e),a=(r.setMessage(s),v.l("".concat(i," ").concat(s)),this._createReactionOperationPack(t,n,1));return this._addReactedByMyselfMap(t.ID,n),this.req(a).then(function(){return r.end(),v.l("".concat(i," ok.")),Sn()}).catch(function(e){return o._removeReactedByMyselfMap(t.ID,n),r.setError(e).end(),v.e("".concat(i," failed. error:"),e),C(e)})}},{key:"removeMessageReaction",value:function(e,t){var n="removeMessageReaction";if(!this.canIUse(H.MSG_REACTION))return this.noUse(n);var o="".concat(this._n,".").concat(n),i=e.ID,a=e.conversationID,a="convID:".concat(a," messageID:").concat(i," reactionID:").concat(t),s=new M(n),i=(s.setMessage(a),v.l("".concat(o," ").concat(a)),this._createReactionOperationPack(e,t,2));return this._removeReactedByMyselfMap(e.ID,t),this.req(i).then(function(){return s.end(),v.l("".concat(o," ok.")),Sn()}).catch(function(e){return s.setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"getMessageReactions",value:function(e){var t=this,n="getMessageReactions";if(!this.canIUse(H.MSG_REACTION))return this.noUse(n);var o="".concat(this._n,".").concat(n),i=e.messageList,a=e.maxUserCountPerReaction,s=i[0].conversationID,s="convID:".concat(s," maxUserCountPerReaction:").concat(a," msgCount:").concat(i.length),r=new M(n),c=(r.setMessage(s),v.l("".concat(o," ").concat(s)),new Map),a=this._createReactionSummaryPack(y(y({},e),{},{messageIDMap:c}));return this.req(a).then(function(e){var e=e.data.resultList,o=[],i=[];return(void 0===e?[]:e).forEach(function(e){var t=e.messageKey,t=void 0===t?void 0:t,n=e.messageSequence,n=void 0===n?void 0:n,e=e.reactionList,e=void 0===e?[]:e,n=A(t)?c.get(n):c.get(t);o.push({messageID:n,reactionList:e}),e.forEach(function(e){i.push.apply(i,D(e.userIDList))})}),t._handleReactionSummary(o,i)}).then(function(e){return r.end(),v.l("".concat(o," ok.")),c.clear(),Sn({resultList:e})}).catch(function(e){return r.setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"getAllUserListOfMessageReaction",value:function(e){var n=this,t="getAllUserListOfMessageReaction";if(!this.canIUse(H.MSG_REACTION))return this.noUse(t);var o="".concat(this._n,".").concat(t),i=e.message,a=e.reactionID,s=e.nextSeq,l=e.count,r=i.ID,i=i.conversationID,i="convID:".concat(i," messageID:").concat(r," reactionID:").concat(a," nextSeq:").concat(s," count:").concat(l),c=new M(t),u=(c.setMessage(i),v.l("".concat(o," ").concat(i)),{userList:[],nextSeq:0,isCompleted:!1}),r=this._createReactionUserListPack(e);return this.req(r).then(function(e){var e=e.data,t=e.userIDList,t=void 0===t?[]:t,e=e.nextSeq,e=void 0===e?0:e;return u.nextSeq=e,u.isCompleted=0===e,n.get(4).getUserNickAndAvatar(t)}).then(function(e){return u.userList=e,c.end(),v.l("".concat(o," ok.")),Sn(u)}).catch(function(e){return c.setError(e).end(),v.e("".concat(o," failed. error:"),e),C(e)})}},{key:"_createReactionOperationPack",value:function(e,t,n){var o,i,a=void 0,t={reactionID:t,userIDList:[this.getMyUserID()]};return e.conversationType===R.CONV_C2C&&(o=this.get(6),a=1===n?I.ADD_C2C_MSG_REACTION:I.RM_C2C_MSG_REACTION,t.from=e.from,t.to=e.to,t.messageKey=o.getMessageKey(e)),e.conversationType===R.CONV_GROUP&&(o=void 0,i=e.to,Rt(e.to)&&(i=Kt(o=e.to)),a=1===n?I.ADD_GRP_MSG_REACTION:I.RM_GRP_MSG_REACTION,t.groupID=i,t.topicID=o,t.messageSequence=e.sequence),{P:a,data:t}}},{key:"_createReactionSummaryPack",value:function(e){var n,t,o,i=e.messageList,a=e.maxUserCountPerReaction,a=void 0===a?10:a,s=e.messageIDMap,e=i[0],r=void 0,c=void 0;return e.conversationType===R.CONV_C2C&&(n=this.get(6),t=i.map(function(e){var t=n.getMessageKey(e);return s.set(t,e.ID),t}),r=I.GET_C2C_MSG_REACTIONS,c={from:e.from,to:e.to,messageKeyList:t,count:a}),e.conversationType===R.CONV_GROUP&&(t=void 0,o=e.to,Rt(e.to)&&(o=Kt(t=e.to)),e=i.map(function(e){return s.set(e.sequence,e.ID),e.sequence}),r=I.GET_GRP_MSG_REACTIONS,c={groupID:o,topicID:t,messageSequenceList:e,count:a}),{P:r,data:c}}},{key:"_createReactionUserListPack",value:function(e){var t=e.message,n=e.reactionID,o=e.nextSeq,e=e.count,e=void 0===e?100:e,i=void 0,n={reactionID:n,nextSeq:void 0===o?0:o,count:100<e?100:e};return t.conversationType===R.CONV_C2C&&(o=this.get(6),i=I.GET_C2C_MSG_REACTION_USER_LIST,n.from=t.from,n.to=t.to,n.messageKey=o.getMessageKey(t)),t.conversationType===R.CONV_GROUP&&(e=void 0,o=t.to,Rt(t.to)&&(o=Kt(e=t.to)),i=I.GET_GRP_MSG_REACTION_USER_LIST,n.groupID=o,n.topicID=e,n.messageSequence=t.sequence),{P:i,data:n}}},{key:"_handleReactionSummary",value:function(t,e){var c=this;return this.get(4).getUserNickAndAvatar(e).then(function(r){var e=[];return t.forEach(function(a){var s=[];a.reactionList.forEach(function(e){var t=e.reactionID,n=e.count,o=e.userIDList,e=e.reactedByMyself,e=void 0===e?void 0:e,i=[],o=(o.forEach(function(t){r.forEach(function(e){t===e.userID&&i.push(e)})}),{reactionID:t,totalUserCount:n,partialUserList:i,reactedByMyself:c._computeReactedByMyself({reactedByMyself:e,messageID:a.messageID,reactionID:t})});s.push(o),A(e)&&!c._reactedByMyselfMap.has(a.messageID)&&(n="".concat(a.messageID,"-").concat(t),c._reactionInfoMap.set(n,o))}),e.push({messageID:a.messageID,reactionList:s})}),e})}},{key:"_addReactedByMyselfMap",value:function(e,t){this._reactedByMyselfMap.has(e)||this._reactedByMyselfMap.set(e,[]);e=this._reactedByMyselfMap.get(e);-1===e.indexOf(t)&&e.push(t)}},{key:"_removeReactedByMyselfMap",value:function(e,t){!this._reactedByMyselfMap.has(e)||-1<(t=(e=this._reactedByMyselfMap.get(e)).indexOf(t))&&e.splice(t,1)}},{key:"_computeReactedByMyself",value:function(e){var t=e.reactedByMyself,n=e.messageID,e=e.reactionID;return A(t)?!!this._reactedByMyselfMap.has(n)&&this._reactedByMyselfMap.get(n).includes(e):1===t}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._reactedByMyselfMap.clear(),this._reactionInfoMap.clear()}}]),$a),Wa=(t(Qa,Fn),qa=f(Qa),e(Qa,[{key:"sendMessage",value:function(e){var o=this,i=this._createMsg(e);if(null===i)return C({code:T.MSG_SEND_FAIL});this._addSendMessageTotalCount(i);var a=Date.now();return this.get(11).setMessageRandom(i),this._sendComboMessage(i,e).then(function(e){var e=e.data,t=e.time,n=e.sequence,e=e.readReceiptCode,e=(Qe(e)&&0!==e&&(new M("sendMessageWithReceipt").setMessage("from:".concat(i.from," to:").concat(i.to," sequence:").concat(n," readReceiptCode:").concat(e)).end(),v.w("".concat(o._n,".sendMessage readReceiptCode:").concat(e," message:").concat(o.getErrMsg(e)))),o._addSendMessageSuccessCount(i,a),o.get(11)),t=(i.status=On,i.time=t,i.conversationType===R.CONV_GROUP&&(i.sequence=n),e.appendToMessageList(i),i);return!0===i._isExcludedFromLastMessage&&(t=""),e.onMessageSent({conversationOptionsList:[{conversationID:i.conversationID,unreadCount:0,type:i.conversationType,subType:i.conversationSubType,lastMessage:t}]}),Sn({message:i})}).catch(function(e){return o._onSendMessageFailed(i,e)})}},{key:"_sendComboMessage",value:function(e,t){var n=this._m.get(20),o="";return e.conversationType===R.CONV_C2C&&(o="".concat(a.NAME.OPEN_IM,".").concat(I.SEND_C2C_MSG)),e.conversationType===R.CONV_GROUP&&(o="".concat(a.NAME.GRP,".").concat(I.SEND_GRP_MSG)),n.sendComboMessage({servcmd:o,data:t})}},{key:"_createMsg",value:function(e){var t="".concat(this._n,"._createMsg"),n=null;try{var o,i=this.getMyUserID(),a={};a.senderTinyID=this.getMyTinyID(),a.currentUser=i,a.from=e.From_Account||i,e.GroupId?(a.conversationID="".concat(R.CONV_GROUP).concat(e.GroupId),a.conversationType=R.CONV_GROUP,a.to=e.GroupId):e.To_Account&&(a.conversationID="".concat(R.CONV_C2C).concat(e.To_Account),a.conversationType=R.CONV_C2C,a.to=e.To_Account),a.time=e.MsgTimeStamp||0,a.random=e.Random||e.MsgRandom||0,a.priority=e.MsgPriority,ft(e.CloudCustomData)&&0<e.CloudCustomData.length&&(a.cloudCustomData=e.CloudCustomData),nt(e.SendMsgControl)&&(a.messageControlInfo={},e.SendMsgControl.includes("NoUnread")&&(a.messageControlInfo.excludedFromUnreadCount=1),e.SendMsgControl.includes("NoLastMsg")&&(a.messageControlInfo.excludedFromLastMessage=1)),a.conversationType===R.CONV_GROUP&&nt(e.To_Account)&&0<e.To_Account.length&&(o=e.To_Account,50<e.To_Account.length&&(o=e.To_Account.slice(0,50),v.w("".concat(t," To_Account must be less than or equal to 50."))),a.receiverList=D(o),e.To_Account=D(o)),1!==e.IsNeedReadReceipt&&1!==e.NeedReadReceipt||(a.needReadReceipt=!0),1===e.SupportMessageExtension&&(a.isSupportExtension=!0),(n=new Ro(a)).status=An,e.MsgClientTime=n.clientTime,n.conversationType===R.CONV_C2C&&(e.MsgSeq=n.sequence);for(var s,r=e.MsgBody.length,c=0;c<r;c++)"TIMTextElem"===(s=e.MsgBody[c]).MsgType?n.setTextElement(s.MsgContent.Text):"TIMCustomElem"===s.MsgType?n.setCustomElement({data:s.MsgContent.Data||"",description:s.MsgContent.Desc||"",extension:s.MsgContent.Ext||""}):"TIMFaceElem"===s.MsgType&&n.setFaceElement({index:s.MsgContent.Index,data:s.MsgContent.Data});var u=n.getElements();n.payload=u[0].content,n.type=u[0].type}catch(e){n=null,v.e("".concat(t," failed. error:"),e)}return n}},{key:"_onSendMessageFailed",value:function(e,t){e.status=Nn,this.get(11).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var n=new M("sendMessage"),o="head.seq:".concat(t.data.headSeq," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to);return n.setMessage(o).setError(t).end(),v.e("".concat(this._n,"._onSendMessageFailed ").concat(o," error:"),t),C(new Bn({code:t&&t.code?t.code:T.MSG_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if(e.conversationType===R.CONV_C2C)return jn;if(e.conversationType===R.CONV_GROUP){var e=this.get(7).getLocalGroupProfile(e.to);if(e)return e=e.type,St(e)?zn:Jn}}},{key:"_addSendMessageTotalCount",value:function(e){e=this._getSendMessageSpecifiedKey(e);e&&this.get(26).addTotalCount(e)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n,e=this._getSendMessageSpecifiedKey(e);e&&((n=this.get(26)).addSuccessCount(e),n.addCost(e,Qt(t,!1)))}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var t=t.code,t=void 0===t?-1:t,n=this.get(26),e=this._getSendMessageSpecifiedKey(e);ba(t)&&e&&n.addFailedCountOfUserSide(e)}}]),Qa),ja=(t(Za,Fn),Fa=f(Za),e(Za,[{key:"registerPlugin",value:function(t){var n=this,o="0";Object.keys(t).forEach(function(e){n.plugins[e]=t[e],"tim-upload-plugin"===e&&"function"==typeof t[e].getVersion&&(o=t[e].getVersion())}),new M("registerPlugin").setMessage("".concat(Object.keys(t))).setMoreMessage("version:".concat(o)).end()}},{key:"getPlugin",value:function(e){return this.plugins[e]}},{key:"reset",value:function(){}}]),Za),Ja=(t(Xa,Fn),wa=f(Xa),e(Xa,[{key:"_init",value:function(){this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"_startSync",value:function(e){var i=this,t=e.cookie,n=e.syncFlag,o=e.isOnlineSync,a="".concat(this._n,"._startSync"),s=(v.l("".concat(a," options:"),e),new M("syncUnread"));s.setMessage(JSON.stringify(e)),this.req({P:I.SYNC_UNREAD_MSG,data:{cookie:t,syncFlag:n,isOnlineSync:o}}).then(function(e){var t=e.data,n=t.cookie,t=t.syncFlag,o="$cookie:".concat(n," syncFlag:").concat(t);v.l("".concat(a," ok. ").concat(o)),i._cookie=n,s.setMoreMessage(o).end(),Je(n)||(0===t||1===t?(i._dispatch(y(y({},e.data),{},{isSyncingEnded:!1})),i._startSync({cookie:n,syncFlag:t,isOnlineSync:0})):2===t&&i._dispatch(y(y({},e.data),{},{isSyncingEnded:!0})))}).catch(function(e){s.setError(e).end(),v.e("".concat(a," failed. error:"),e)})}},{key:"_dispatch",value:function(e){e.eventArray&&this.get(20).onMessage({head:{},body:{eventArray:e.eventArray,isInstantMessage:this._onlineSyncFlag,isSyncingEnded:e.isSyncingEnded}}),this.get(6).onNewMessage({dataList:e.messageList,isInstantMessage:!!e.isSyncingEnded&&this._onlineSyncFlag,C2CRemainingUnreadList:e.C2CRemainingUnreadList,C2CPairUnreadList:e.C2CPairUnreadList,isSyncingEnded:e.isSyncingEnded})}},{key:"syncOnNeed",value:function(){v.l("".concat(this._n,".syncOnNeed cookie:").concat(this._cookie)),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:1})}},{key:"syncOnReconnected",value:function(){v.l("".concat(this._n,".syncOnReconnected cookie:").concat(this._cookie)),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._onlineSyncFlag=!1,this._cookie=""}}]),Xa),za={req:{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",isWebUniapp:"is_web_uniapp",isSupportExtension:"SupportMessageExtension",messageSequence:"MsgSeq",messageKey:"MsgKey",startSequence:"startSeq",simplifiedMessage:"DownsizeFlag",isRelayMessage:"IsRelayMsg",reactionID:"Reaction",messageSequenceList:"MsgSeqList",messageKeyList:"MsgKeyList",cmConfigID:"CustomModerationConfigID"},res:{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:"isWithChangedAttributeInfo",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",BanDuration:"duration",BanDescription:"reason",NotVisible:"invisible",BytesTag:"tag",BytesValue:"value",RptBytesValue:"value",LatestSeq:"globalSequence",ClearSeq:"clearSequence",SupportMessageExtension:"isSupportExtension",ExtensionList:"extensions",GroupCounter:"counterList",Revoker_Account:"revoker",MsgExtensionNotify:"messageExtensionNotify",ExtensionC2cMsgInfo:"messageInfo",ExtensionGroupMsgInfo:"messageInfo",MsgOptType:"operateType",SetKVInfo:"operateResultList",DeleteKVInfo:"operateResultList",ClearKVInfo:"operateResultList",MsgKeyValue:"extensions",ClearMsgSeq:"clearSequence",MsgLastSeq:"globalSequence",InviteJoinOption:"inviteOption",MemberList_Account:"inviteeList",MsgMemberExtraInfoList:"inviteeInfoList",E:"event",GInf:"groupProfile",MCT:"clientTime",MR:"random",MP:"priority",MTS:"time",GId:"groupID",MS:"sequence",CCD:"cloudCustomData",F_Account:"from",F_Hd:"avatar",F_NN:"nick",GN:"groupName",GT:"groupType",IsSys:"isSystemMessage",OpInf:"operatorInfo",Img:"avatar",NN:"nick",OnlineInf:"onlineMemberInfo",ET:"expireTime",Num:"onlineMemberNum",Opt:"operationType",O_Account:"operatorID",RT:"operationType",UDF:"userDefinedField",L_Account:"userIDList",IsPlaceMsg:"isPlaceMessage",MsgCheckResult:"checkResult",Results:"resultList",Reaction:"reactionID",Reaction_Account:"userIDList",MsgReactionNotifyList:"messageReactionNotifyList",MsgReactionNotify:"messageReactionNotify",MsgReactionSummary:"reactionList",C2CMsgInfo:"C2CMessageInfo",GroupMsgInfo:"groupMessageInfo",int32_err_code:"errorCode",str_err_msg:"errorMsg",MsgDropReason:"messageDropReason",ReactedByMe:"reactedByMyself",Level:"messageRemindType",PeerReadTime:"timestamp",NoUnreadSeqList:"excludedUnreadSequenceList",NewMsg:"topicLatestMessage"},ignoreKeyWord:["C2C","ID","USP"]};function Xa(e){return d(this,Xa),(e=wa.call(this,e))._n="SyncUnreadMsgModule",e._cookie="",e._onlineSyncFlag=!1,e.getIEmitInst().on(Wo.A2KEY_AND_TINYID_UPDATED,e._init,h(e)),e}function Za(e){return d(this,Za),(e=Fa.call(this,e))._n="PluginModule",e.plugins={},e}function Qa(e){return d(this,Qa),(e=qa.call(this,e))._n="ComboMsgModule",e}function $a(e){return d(this,$a),(e=xa.call(this,e))._n="MsgReactionModule",e._reactedByMyselfMap=new Map,e._reactionInfoMap=new Map,e}function es(e){return d(this,es),(e=Va.call(this,e))._n="MsgExtModule",e.msgExtMap=new Map,e.globalSeqMap=new Map,e.getMsgExtsMap=new Map,e}function ts(e){return d(this,ts),(e=Ha.call(this,e))._n="MessageModule",e._messageOptionsMap=new Map,e._mergerMessageHandler=new Oa(h(e)),e}function ns(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");return t=Object.assign({pascalCase:!1},t),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=(e=e!==e.toLowerCase()?os(e):e).replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,function(e,t){return t.toUpperCase()}).replace(/\d+(\w|$)/g,function(e){return e.toUpperCase()}),t.pascalCase?e.charAt(0).toUpperCase()+e.slice(1):e)}var os=function(e){for(var t=!1,n=!1,o=!1,i=0;i<e.length;i++){var a=e[i];t&&/[a-zA-Z]/.test(a)&&a.toUpperCase()===a?(e=e.slice(0,i)+"-"+e.slice(i),o=n,n=!(t=!1),i++):n&&o&&/[a-zA-Z]/.test(a)&&a.toLowerCase()===a?(e=e.slice(0,i-1)+"-"+e.slice(i-1),o=n,t=!(n=!1)):(t=a.toLowerCase()===a&&a.toUpperCase()!==a,o=n,n=a.toUpperCase()===a&&a.toLowerCase()!==a)}return e};function is(e,t){var r=0;return function n(e,i){return 100<++r?(r--,e):nt(e)?(t=e.map(function(e){return $e(e)?n(e,i):e}),r--,t):$e(e)?(o=e,a=function(e,t){if(!st(t))return!1;if(t!==ns(t))for(var n=0;n<za.ignoreKeyWord.length&&!t.includes(za.ignoreKeyWord[n]);n++);var o;return A(i[t])?(o=t)[0].toUpperCase()+ns(o).slice(1):i[t]},s=Object.create(null),Object.keys(o).forEach(function(e){var t=a(o[e],e);t&&(s[t]=o[e])}),t=Gt(t=s,function(e,t){return nt(e)||$e(e)?n(e,i):e}),r--,t):void 0;var t,o,a,s}(e,t)}for(var as,ss=String.fromCharCode,rs=function(e){var t=0|e.charCodeAt(0);if(55296<=t)if(t<56320){e=0|e.charCodeAt(1);if(56320<=e&&e<=57343){if(65535<(t=(t<<10)+e-56613888|0))return ss(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?ss(192|t>>>6,128|63&t):ss(224|t>>>12,128|t>>>6&63,128|63&t)},cs=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,rs),n=0|t.length,o=new Uint8Array(n),i=0;i<n;i=i+1|0)o[i]=0|t.charCodeAt(i);return o},us=(e(Ns,[{key:"getID",value:function(){return this._id}},{key:"_onOpen",value:function(e){this._handler.onOpen({id:this._id,res:JSON.stringify(e)})}},{key:"_onClose",value:function(e){this._handler.onClose({id:this._id,e:e})}},{key:"_onMessage",value:function(e){e=this._canIUseBinaryFrame?this._isAppCompressedData(e.data)?this._handler.inflate(e.data):function(e){for(var t=new Uint8Array(e),n="",o=0,i=t.length;o<i;){var a=t[o],s=0,r=0;if(a<=127?(s=0,r=255&a):a<=223?(s=1,r=31&a):a<=239?(s=2,r=15&a):a<=244&&(s=3,r=7&a),0<i-o-s)for(var c=0;c<s;)r=r<<6|63&(a=t[o+c+1]),c+=1;else r=65533,s=i-o;n+=String.fromCodePoint(r),o+=s+1}return n}(e.data):e.data;this._handler.onMessage({data:e})}},{key:"_isAppCompressedData",value:function(e){e=new Uint8Array(e);return 67===e[0]&&79===e[1]&&77===e[2]&&80===e[3]}},{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),ee)return ue.offSocketClose(),ue.offSocketMessage(),ue.offSocketOpen(),ue.offSocketError(),void ue.closeSocket();this._socket&&(ae?(this._socket.onClose(function(){}),this._socket.onOpen(function(){}),this._socket.onMessage(function(){}),this._socket.onError(function(){})):(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null),$?this._socket.close({code:e}):this._socket.close(e),this._socket=null)}},{key:"send",value:function(e){this._workerSocket?this._workerSocket.postMessage({cmd:"sendMessage",data:this._canIUseBinaryFrame?cs(e.data).buffer:e.data}):ee?ue.sendSocketMessage({data:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}}):this._socket&&(ae?this._socket.send({data:this._canIUseBinaryFrame?cs(e.data).buffer:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}}):this._socket.send(this._canIUseBinaryFrame?cs(e.data):e.data))}}]),Ns),ls=["keyMap"],ds=["keyMap"],ps="connected",_s="connecting",hs="disconnected",gs=(e(Os,[{key:"_setWebsocketHost",value:function(){var e=this._chM.get(12);this._currentSite=V,this._chM.isOversea()&&(this._currentSite="OVERSEA"),e.isSingaporeSite()?this._currentSite="SINGAPORE":e.isKoreaSite()?this._currentSite="KOREA":e.isGermanySite()?this._currentSite="GERMANY":e.isIndiaSite()?this._currentSite="IND":e.isJapanSite()?this._currentSite="JPN":e.isUSASite()?this._currentSite="USA":e.isIndonesiaSite()&&(this._currentSite="INDONESIA"),a.HOST.setCurrent(this._currentSite)}},{key:"_initConnection",value:function(){var e=this._chM.get(12).getSDKAppID()+"",t=this._chM.get(12).isIndependentDomainDisabled(),t=(A(a.HOST.CURRENT.BACKUP)?this._url=a.HOST.CURRENT.DEFAULT:""===this._url?this._url=t?a.HOST.CURRENT.DEFAULT:a.HOST.CURRENT.DEFAULT0.replace("*",e):-1<this._url.indexOf(e)?this._url=a.HOST.CURRENT.DEFAULT:this._url===a.HOST.CURRENT.DEFAULT?this._url=a.HOST.CURRENT.IPV6||a.HOST.CURRENT.BACKUP:this._url===a.HOST.CURRENT.IPV6?this._url=a.HOST.CURRENT.BACKUP:this._url===a.HOST.CURRENT.BACKUP?this._url=this._canIUseAnyCast()?a.HOST.CURRENT.ANYCAST:a.HOST.CURRENT.DEFAULT:this._url===a.HOST.CURRENT.ANYCAST&&(a.HOST.CURRENT.ANYCAST="",this._url=a.HOST.CURRENT.DEFAULT),this._chM.get(12)),e=t.getProxyServer();Je(e)||(this._url=e),t.isTestEnv()&&(this._url=w.TEST[this._currentSite].DEFAULT),this._connect(),this._nextPingTs=0}},{key:"_canIUseAnyCast",value:function(){return ce&&a.HOST.CURRENT.ANYCAST}},{key:"onCheckTimer",value:function(e){e%1==0&&(this._checkPromiseMap(),this._checkNativeAppWS())}},{key:"_checkPromiseMap",value:function(){var a=this;0!==this._promiseMap.size&&this._promiseMap.forEach(function(e,t){var n=e.reject,o=e.timestamp,e=e.headSeq,i=15e3;-1!==t.indexOf(I.LOGIN)?i=9e4:-1!==t.indexOf(I.PING)&&(i=3e3),Date.now()-o>=i&&(v.l("".concat(a._n,"._checkPromiseMap request timeout, delete requestID:").concat(t)),a._promiseMap.delete(t),n(new Bn({code:T.NETWORK_TIMEOUT,data:{headSeq:e}})),a._chM.onRequestTimeout())})}},{key:"_checkNativeAppWS",value:function(){ne&&!this.isConnected()&&this._reConnect()}},{key:"onOpen",value:function(e){var t,n;this._readyState!==hs&&(this._onOpenTs=Date.now(),n=e.id,e=e.res,this._socketID=n,t=Qt(this._startTs,!1),n="socketID:".concat(n," res:").concat(e),v.l("".concat(this._n,"._onOpen cost:").concat(t," ms. ").concat(n)),new M("wsOnOpen").setMessage(t).setCostTime(t).setMoreMessage(n).end(),this._readyState=ps,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._chM.onReconnected(),this._reConnectFlag=!1),this._chM.onOpen())}},{key:"onClose",value:function(e){var t=new M("wsOnClose"),n=e.id,e=e.e,o="sourceSocketID:".concat(n," currentSocketID:").concat(this._socketID," code:").concat(e.code," reason:").concat(e.reason),i=0;0!==this._onOpenTs&&(i=Date.now()-this._onOpenTs),t.setMessage(i).setCostTime(i).setMoreMessage(o).setCode(e.code).end(!0),v.l("".concat(this._n,"._onClose ").concat(o," onlineTime:").concat(i)),n===this._socketID&&(this._readyState=hs,i<1e3?this._chM.onReconnectFailed():this._chM.onClose())}},{key:"onError",value:function(e){var t=e.id,e=e.e,n="sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID);new M("wsOnError").setMessage(e.errMsg||JSON.stringify(e,["message","code"])).setMoreMessage(n).setLevel("error").end(!0),v.w("".concat(this._n,"._onError"),e,n),t===this._socketID&&(this._readyState=hs,this._chM.onError())}},{key:"onMessage",value:function(t){var e;try{e=JSON.parse(t.data)}catch(e){new M("jsonParseError").setMessage(t.data).end()}if(e&&e.head){var n,o,i,a,t=this._getRequestIDFromHead(e.head),s=e.body;if(this._chM.get(30).isTRTCCommand(t)||(a=xt(e.head),s=function t(e,n){return nt(e)?e.map(function(e){return $e(e)?t(e,n):e}):$e(e)?(o=e,i=function(e,t){return A(n[t])?ns(t):n[t]},a={},Object.keys(o).forEach(function(e){a[i(o[e],e)]=o[e]}),Gt(a,function(e){return nt(e)||$e(e)?t(e,n):e})):void 0;var o,i,a}(e.body,this._getResKeyMap(a))),v.d("".concat(this._n,".onMessage ret:").concat(JSON.stringify(s)," requestID:").concat(t," has:").concat(this._promiseMap.has(t))),this._setNextPingTs(),this._promiseMap.has(t))return n=(a=this._promiseMap.get(t)).resolve,o=a.reject,i=a.timestamp,a=a.headSeq,this._promiseMap.delete(t),this._calcRTT(i),void(s.errorCode&&0!==s.errorCode?(this._chM.onErrorCodeNotZero(s),o(new Bn({code:s.errorCode,message:s.errorInfo||"",data:t.includes(I.MODIFY_C2C_MSG)||t.includes(I.MODIFY_GRP_MSG)?{elements:s.elements,messageVersion:s.messageVersion,cloudCustomData:s.cloudCustomData,headSeq:a}:{headSeq:a}}))):n(Sn(s)));this._chM.onMessage({head:e.head,body:s})}}},{key:"_calcRTT",value:function(e){e=Date.now()-e;this._chM.get(26).addRTT(e)}},{key:"_connect",value:function(){this._readyState!==_s&&this._readyState!==ps&&(this._startTs=Date.now(),this._onOpenTs=0,this._readyState=_s,this._socket=new us(this),this._socketID=this._socket.getID(),v.l("".concat(this._n,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new M("wsConnect").setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end())}},{key:"getURL",value:function(){this._chM.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=bt(),t=((ee||z&&"windows"===e||ne)&&(this._canIUseBinaryFrame=!1),-1),n=("ios"===e?t=_e||-1:"android"===e&&(t=ge||-1),this._chM.get(12)),o=this._chM.getPlatform(),i=n.getSDKAppID(),n=n.getInstanceID(),i="sdkappid=".concat(i,"&instanceid=").concat(n,"&random=").concat(this._getRandom(),"&platform=").concat(o,"&host=").concat(e)+"&version=".concat(t,"&sdkversion=").concat("3.5.2");return X&&(i+="&isminigame=1"),this._chM.canIUseInflate()&&(i+="&compress=gzip"),(this._canIUseBinaryFrame?"".concat(this._url,"/binfo?"):"".concat(this._url,"/info?")).concat(i)}},{key:"_closeConnection",value:function(e){v.l("".concat(this._n,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=hs)}},{key:"_resend",value:function(){var i=this;if(v.l("".concat(this._n,"._resend reConnectFlag:").concat(this._reConnectFlag),"promiseMap.size:".concat(this._promiseMap.size," simpleRequestMap.size:").concat(this._simpleRequestMap.size)),0<this._promiseMap.size&&this._promiseMap.forEach(function(e,t){var n=e.uplinkData,o=e.resolve,e=e.reject;-1!==t.indexOf(I.AV_POLLING)?i._promiseMap.delete(t):(i._promiseMap.set(t,{resolve:o,reject:e,timestamp:Date.now(),uplinkData:n}),i._execute(t,n))}),0<this._simpleRequestMap.size){var e,t=N(this._simpleRequestMap);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2),o=n[0],a=n[1];this._execute(o,a)}}catch(e){t.e(e)}finally{t.f()}this._simpleRequestMap.clear()}}},{key:"send",value:function(n){var o=this,i=(n.head.seq=this._getSequence(),n.head.reqtime=Math.floor(Date.now()/1e3),n.head.cs=this._calcCheckSum(n.head.servcmd,n.body),n.keyMap,g(n,ls)),a=this._getRequestIDFromHead(n.head),s=JSON.stringify(i);return new Promise(function(e,t){o._promiseMap.set(a,{resolve:e,reject:t,timestamp:Date.now(),uplinkData:s,headSeq:n.head.seq}),v.d("".concat(o._n,".send uplinkData:").concat(JSON.stringify(i)," requestID:").concat(a," readyState:").concat(o._readyState)),o._readyState!==ps?o._reConnect():(o._execute(a,s),o._chM.get(26).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,ds),e=this._getRequestIDFromHead(e.head),t=JSON.stringify(t);this._readyState!==ps?(this._simpleRequestMap.size<this.MAX_SIZE?this._simpleRequestMap.set(e,t):v.l("".concat(this._n,".simplySend. simpleRequestMap is full, drop request!")),this._reConnect()):this._execute(e,t)}},{key:"_execute",value:function(e,t){this._socket.send({data:t,fail:ae?this._onSendFail.bind(this):void 0,requestID:e})}},{key:"_onSendFail",value:function(e){v.l("".concat(this._n,"._onSendFail requestID:").concat(e)),this._chM.onSendFail()}},{key:"_getSequence",value:function(){var e;if(this._startSequence<2415919103)return e=this._startSequence,this._startSequence+=1,2415919103===this._startSequence&&(this._startSequence=lt()),e}},{key:"_getRequestIDFromHead",value:function(e){return e.servcmd+e.seq}},{key:"_getResKeyMap",value:function(e){e=this._chM.getKeyMap(e);return y(y({},za.res),e.res)}},{key:"_reConnect",value:function(){this._readyState!==ps&&this._readyState!==_s&&this.forcedReconnect()}},{key:"forcedReconnect",value:function(){var e="".concat(this._n,".forcedReconnect");v.l("".concat(e," count:").concat(this._reConnectCount," readyState:").concat(this._readyState)),this._reConnectFlag=!0,this._resetRandom(),this._reConnectCount<this.MAX_RECONNECT_COUNT?(this._reConnectCount+=1,this._closeConnection(4001),this._initConnection()):(this._reConnectCount=0,this._chM.get(15).isOnline()?(v.w("".concat(e," disconnected from wsserver but network is ok, continue...")),this._closeConnection(4001),this._initConnection()):this._chM.onReconnectFailed())}},{key:"getReconnectFlag",value:function(){return this._reConnectFlag}},{key:"_setNextPingTs",value:function(){this._nextPingTs=ne?Date.now()+5e3:Date.now()+1e4}},{key:"getNextPingTs",value:function(){return this._nextPingTs}},{key:"isConnected",value:function(){return this._readyState===ps}},{key:"canIUseBinaryFrame",value:function(){return this._canIUseBinaryFrame}},{key:"getSocketID",value:function(){return this._socketID}},{key:"inflate",value:function(e){if(this._chM.canIUseInflate())return this._chM.get(37).inflate(e)}},{key:"setIsWorkerEnabled",value:function(e){v.l("".concat(this._n,".setIsWorkerEnabled flag:").concat(e)),this._isWorkerEnabled=e}},{key:"getIsWorkerEnabled",value:function(){return this._isWorkerEnabled&&ye}},{key:"_getRandom",value:function(){return 0===this._random&&(this._random=Math.random()),this._random}},{key:"_resetRandom",value:function(){this._random=0}},{key:"_calcCheckSum",value:function(e,t){if(-1!==e.indexOf(I.PING)||-1!==e.indexOf(I.LOGIN)||-1!==e.indexOf(I.LOGOUT)||-1!==e.indexOf(I.AV_POLLING)||-1!==e.indexOf(I.AV_NOAUTH_POLLING))return 0;for(var n=cs(JSON.stringify(t)),o=4294967295,i=0,a=n.length;i<a;i++){o^=n[i];for(var s=0;s<8;s++)1==(1&o)?o=o>>>1^3988292384:o>>>=1}return(4294967295^o)>>>0}},{key:"close",value:function(){v.l("".concat(this._n,".close")),this._closeConnection(4e3),this._promiseMap.clear(),this._startSequence=lt(),this._readyState=hs,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}]),Os),fs=function(a,s,r){return new Promise(function(t,e){var n,o,i="application/x-www-form-urlencoded;charset=UTF-8";ae?ue.request({url:s,data:r,method:a,timeout:3e3,header:{"content-type":i},success:function(e){e&&e.data&&e.data.NetCheckInfo&&v.l("".concat("getconninfo ok in"," miniapp. ret:"),e.data),t()},fail:function(){e(new Bn({code:T.NETWORK_ERROR}))}}):(n=new XMLHttpRequest,o=setTimeout(function(){n.abort(),e(new Bn({code:T.NETWORK_TIMEOUT}))},3e3),n.onreadystatechange=function(){4===n.readyState&&(o&&clearTimeout(o),200===n.status||304===n.status?(n.responseText&&-1<n.responseText.indexOf("NetCheckInfo")&&v.l("".concat("getconninfo ok in"," web. ret:"),JSON.parse(n.responseText)),t()):e(new Bn({code:T.NETWORK_ERROR})))},n.open(a,s,!0),n.setRequestHeader("Content-type",i),r?n.send(r):n.send())})},ms=(t(As,Fn),as=f(As),e(As,[{key:"onCheckTimer",value:function(e){this._socketHandler&&(this.isLoggedIn()?(0<this._timerForNotLoggedIn&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:"onErrorCodeNotZero",value:function(e){this.get(20).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.get(20).onMessage(e)}},{key:"send",value:function(e){return this._socketHandler?this._previousState!==R.NET_STATE_CONNECTED&&e.head.servcmd.includes(I.SSO_STAT)?(this.reConnect(),this.isPrivateNetWork()?Promise.resolve():this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:"_sendLogViaHTTP",value:function(e){var t=a.HOST.CURRENT.STAT,t="".concat(t,"/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e.head.sdkappid,"&reqtime=").concat(Date.now()),e=JSON.stringify(e.body);return fs("POST",t,e)}},{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(R.NET_STATE_DISCONNECTED),this.reConnect()}},{key:"onError",value:function(){ae&&!ne&&this.warn("DomainNameInMP"),this._emitNetStateChangeEvent(R.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.get(20).getKeyMap(e)}},{key:"onRequestTimeout",value:function(){3e4<=Date.now()-this._lastDiagnoseTS&&this.diagnose()}},{key:"onSendFail",value:function(){this._emitNetStateChangeEvent(R.NET_STATE_DISCONNECTED)}},{key:"onReconnected",value:function(){v.l("".concat(this._n,".onReconnected cost:").concat(Qt(this._disconnectedTS,!0,!0))),this._m.restartTimer(),this.get(20).onReconnected(Qt(this._disconnectedTS,!1,!1)),this._disconnectedTS=0,this._emitNetStateChangeEvent(R.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){v.l("".concat(this._n,".onReconnectFailed")),this._emitNetStateChangeEvent(R.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(R.NET_STATE_DISCONNECTED)}},{key:"reConnect",value:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=!1,n=(this._socketHandler&&(t=this._socketHandler.getReconnectFlag()),"forcedFlag:".concat(e," fatalErrorFlag:").concat(this._fatalErrorFlag," previousState:").concat(this._previousState," reconnectFlag:").concat(t));if(v.l("".concat(this._n,".reConnect ").concat(n)),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===R.NET_STATE_CONNECTING&&t)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(R.NET_STATE_CONNECTING)}}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(v.l("".concat(this._n,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),e===R.NET_STATE_DISCONNECTED&&0===this._disconnectedTS&&(this._disconnectedTS=Date.now(),this.diagnose()),this._previousState=e,this.emitOEvt(G.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e,n=this;!0!==this._probing&&(this._probing=!0,e=this.get(20).getProtocolData({P:I.PING}),this.send(e).then(function(){n._probing=!1}).catch(function(e){n._probing=!1;var t=n.get(15).isOnline();if(v.w("".concat(n._n,"._ping failed. bOnline:").concat(t," error:"),e),e&&60002===e.code)return new M("error").setMessage("code:".concat(e.code," message:").concat(e.message)).end(),n._fatalErrorFlag=!0,void n._emitNetStateChangeEvent(R.NET_STATE_DISCONNECTED);t?n.reConnect():n._emitNetStateChangeEvent(R.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),-1<this._timerForNotLoggedIn&&clearInterval(this._timerForNotLoggedIn)}},{key:"onRestApiKickedOut",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:"canIUseInflate",value:function(){return this._m.canIUseInflate()}},{key:"getSocketID",value:function(){if(this._socketHandler)return this._socketHandler.getSocketID()}},{key:"diagnose",value:function(){this.isPrivateNetWork()||(this._lastDiagnoseTS=Date.now(),this._diagnoseBySSO(),this._diagnoseByCDN())}},{key:"_diagnoseBySSO",value:function(){var t=this,e=this._socketHandler.getURL(),n=e.split("/")[2];n.startsWith("ws")&&(e=e.slice(e.indexOf("info?")+5),n="https://".concat(n,"/v3/netcheck/getconninfo?").concat(e,"&reqtime=").concat(Date.now()),fs("GET",n).catch(function(e){v.w("".concat(t._n,"._diagnoseBySSO failed. error:"),e)}))}},{key:"_diagnoseByCDN",value:function(){var t=this,e=this._socketHandler.getURL(),e=e.slice(e.indexOf("info?")+5),e="https://boce-cdn.my-imcloud.com/v3/netcheck/getconninfo?".concat(e,"&reqtime=").concat(Date.now());fs("GET",e).catch(function(e){v.w("".concat(t._n,"._diagnoseByCDN failed. error:"),e)})}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._previousState=R.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3),this._disconnectedTS=0,this._lastDiagnoseTS=0}}]),As),vs=["a2","tinyid"],Is=["a2","tinyid"],Ms=(e(Rs,[{key:"_fillMap",value:function(){this._map.clear();var e=this._sessionM.genCommonHead(),t=this._sessionM.genCosSpecifiedHead(),n=this._sessionM.genSSOReportHead();this._map.set(I.LOGIN,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_STATUS,".").concat(I.LOGIN)}),body:{state:"Online",isWebUniapp:0,deviceBrand:0,customInfo:""},keyMap:{req:{deviceBrand:"InstType"},res:{InstId:"instanceID",HelloInterval:"helloInterval",RichMsgAuthKey:"authKey"}}}),this._map.set(I.LOGOUT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_STATUS,".").concat(I.LOGOUT)}),body:{type:0,isWebUniapp:0},keyMap:{req:{type:"wslogout_type"}}}),this._map.set(I.HELLO,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_STATUS,".").concat(I.HELLO)}),body:{isWebUniapp:0},keyMap:{res:{NewInstInfo:"newInstanceInfo"}}}),this._map.set(I.KICK_OTHER,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.STAT_SERVICE,".").concat(I.KICK_OTHER)}),body:{}}),this._map.set(I.COS_SIGN,{head:y(y({},t),{},{servcmd:"".concat(a.NAME.IM_COS_SIGN,".").concat(I.COS_SIGN)}),body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{req:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},res:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}),this._map.set(I.COS_PRE_SIG,{head:y(y({},t),{},{servcmd:"".concat(a.NAME.CUSTOM_UPLOAD,".").concat(I.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{req:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},res:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}),this._map.set(I.SIMPLE_COS_PRE_SIG,{head:y(y({},t),{},{servcmd:"".concat(a.NAME.CUSTOM_UPLOAD,".").concat(I.SIMPLE_COS_PRE_SIG)}),body:{uploadMethod:0,platform:2,SDKAppID:0,userID:"",conversationType:1,uploadConfig:[{fileID:1,fileType:1,fileName:""}]},keyMap:{req:{platform:"uint32_platform",SDKAppID:"uint32_sdkappid",userID:"str_user_id",uploadMethod:"uint32_upload_method",conversationType:"uint32_scene",uploadConfig:"rpt_upload_object",fileID:"uint32_file_id",fileType:"uint32_file_type",fileName:"str_file_name"},res:{str_final_ip:"uploadIP",rpt_pre_sig:"preSig",uint32_file_id:"fileID",uint32_exist_flag:"existFlag",str_download_url:"downloadUrl",str_upload_url:"uploadUrl",str_snapshot_url:"requestSnapshotUrl",str_file_key:"fileKey"}}}),this._map.set(I.GET_IMAGE_INFO,{head:y(y({},t),{},{servcmd:"".concat(a.NAME.CUSTOM_UPLOAD,".").concat(I.GET_IMAGE_INFO)}),body:{imageUrl:""},keyMap:{req:{imageUrl:"str_image_url"},res:{rpt_msg_image_info:"imageInfoArray",uint32_image_type:"type",str_url:"url",uint32_width:"width",uint32_height:"height",str_image_format:"imageFormat"}}}),this._map.set(I.GET_IP,{head:y(y({},t),{},{servcmd:"".concat(a.NAME.CUSTOM_UPLOAD,".").concat(I.GET_IP)}),body:{domainName:""},keyMap:{req:{domainName:"str_domain"},res:{str_final_ip:"ip"}}}),this._map.set(I.VIDEO_COVER,{head:y(y({},t),{},{servcmd:"".concat(a.NAME.CUSTOM_UPLOAD,".").concat(I.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{req:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},res:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}),this._map.set(I.FETCH_COMMERCIAL_CONFIG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_CONFIG_MANAGER,".").concat(I.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{req:{SDKAppID:"uint32_sdkappid"},res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}),this._map.set(I.PUSHED_COMMERCIAL_CONFIG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_CONFIG_MANAGER,".").concat(I.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}),this._map.set(I.FETCH_CLOUD_CTRL_CONFIG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_CONFIG_MANAGER,".").concat(I.FETCH_CLOUD_CTRL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{req:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}),this._map.set(I.PUSHED_CLOUD_CTRL_CONFIG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_CONFIG_MANAGER,".").concat(I.PUSHED_CLOUD_CTRL_CONFIG)}),body:{},keyMap:{res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}),this._map.set(I.OVERLOAD_NOTIFY,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OVERLOAD_PUSH,".").concat(I.OVERLOAD_NOTIFY)}),body:{},keyMap:{res:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}),this._map.set(I.SYNC_UNREAD_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.SYNC_UNREAD_MSG)}),body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0,needSignaling:1,needCachedMsg:1},keyMap:{req:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},res:{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:"to",MsgKey:"messageKey",GroupTips:"groupTips",MsgBody:"elements",MsgType:"type",C2CRemainingUnreadCount:"C2CRemainingUnreadList",C2CPairUnreadCount:"C2CPairUnreadList"}}}),this._map.set(I.GET_PROFANITY_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_MSG_AUDIT_MGR,".").concat(I.GET_PROFANITY_LIST)}),body:{version:0,deviceID:"",startIndex:void 0},keyMap:{req:{version:"uint64_version",deviceID:"str_device_id",startIndex:"uint64_start_index"},res:{msg_cmd_error_code:"errorInfo",str_err_msg:"errorMessage",uint32_code:"errorCode",msg_scene_ctl_config:"filterConfig",uint64_c2c_custom_msg_flag:"c2c_custom_message",uint64_c2c_text_msg_flag:"c2c_text_message",uint64_group_custom_msg_flag:"group_custom_message",uint64_group_text_msg_flag:"group_text_message",uint64_group_info_flag:"group_profile",uint64_group_member_info_flag:"group_member_profile",uint64_relation_chain_flag:"sns",uint64_user_info_flag:"user_profile",rpt_msg_dirty_word:"lexicon",str_dirty_word:"profanity",str_replaced_content:"replacement",uint64_filter_type:"filterType",uint64_id:"id",uint64_word_type:"profanityType",uint64_complete_flag:"completeFlag",uint64_next_start_index:"nextStartIndex",uint64_version:"version",uint64_expired_time:"expiredTime"}}}),this._map.set(I.SEND_C2C_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.SEND_C2C_MSG)}),body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{sound:"",badgeMode:0,isVoipPush:void 0,image:""},androidInfo:{sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",OPPOCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:"",HonorImportance:""}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0,isRelayMessage:0,cmConfigID:void 0,forbidCallbackControl:void 0},keyMap:{req:{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",GoogleChannelID:"GoogleChannelID",XiaoMiChannelID:"XiaoMiChannelID",OPPOChannelID:"OPPOChannelID",OPPOCategory:"OPPOCategory",VIVOClassification:"VIVOClassification",VIVOCategory:"VIVOCategory",HonorImportance:"HonorImportance"}}}),this._map.set(I.SEND_GRP_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.SEND_GRP_MSG)}),body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{sound:"",badgeMode:0,isVoipPush:void 0,image:""},androidInfo:{sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",OPPOCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:"",HonorImportance:""}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0,isRelayMessage:0,cmConfigID:void 0,forbidCallbackControl:void 0},keyMap:{req:{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",receiverList:"To_Account",GoogleChannelID:"GoogleChannelID",XiaoMiChannelID:"XiaoMiChannelID",OPPOChannelID:"OPPOChannelID",OPPOCategory:"OPPOCategory",VIVOClassification:"VIVOClassification",VIVOCategory:"VIVOCategory",HonorImportance:"HonorImportance"},res:{MsgTime:"time",MsgSeq:"sequence"}}}),this._map.set(I.REVOKE_C2C_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.REVOKE_C2C_MSG)}),body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{req:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}),this._map.set(I.REVOKE_GRP_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.REVOKE_GRP_MSG)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{req:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}),this._map.set(I.GET_C2C_ROAMING_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.GET_C2C_ROAMING_MSG)}),body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{req:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},res:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer"}}}),this._map.set(I.MODIFY_C2C_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.MODIFY_C2C_MSG)}),body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{req:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}),this._map.set(I.GET_GRP_ROAMING_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.GET_GRP_ROAMING_MSG)}),body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{req:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},res:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",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",InvisibleMsgSeq:"invisibleSequenceList",NextReqMsgSeq:"nextSequence"}}}),this._map.set(I.SET_C2C_MSG_READ,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.SET_C2C_MSG_READ)}),body:{C2CMsgReaded:void 0},keyMap:{req:{lastMessageTime:"LastedMsgTime"}}}),this._map.set(I.SET_C2C_PEER_MUTE_NOTIFICATIONS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{req:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}),this._map.set(I.GET_C2C_PEER_MUTE_NOTIFICATIONS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{toAccount:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Peer_Account"},res:{MuteNotificationsList:"muteFlagList"}}}),this._map.set(I.SET_GRP_MSG_READ,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.SET_GRP_MSG_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{req:{messageReadSeq:"MsgReadedSeq"}}}),this._map.set(I.SET_ALL_MSG_READ,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.SET_ALL_MSG_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{req:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},res:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}),this._map.set(I.DEL_C2C_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.DEL_C2C_MSG)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{req:{keyList:"MsgKeyList"}}}),this._map.set(I.DEL_GRP_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.DEL_GRP_MSG)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{req:{deleter:"Deleter_Account",keyList:"Seqs"}}}),this._map.set(I.TRANSLATE_TEXT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_TRANSLATE,".").concat(I.TRANSLATE_TEXT)}),body:{sourceTextList:void 0,SDKAppID:0,from:0,source:"",target:""},keyMap:{req:{sourceTextList:"SourceText",SDKAppID:"SdkAppId",from:"FromAccount"},res:{TargetText:"translatedTextList",RequestId:"requestID",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}),this._map.set(I.VOICE_TO_TEXT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_SPEECH,".").concat(I.VOICE_TO_TEXT)}),body:{url:"",SDKAppID:0,format:"",sourceType:0,language:""},keyMap:{req:{url:"BytesUrl",SDKAppID:"Uint32Sdkappid",format:"BytesVoiceFormat",sourceType:"Uint64SourceType",language:"BytesEngServiceType"},res:{BytesRequestid:"requestID",BytesResult:"result",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}),this._map.set(I.MODIFY_GRP_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.MODIFY_GRP_MSG)}),body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{req:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}),this._map.set(I.GET_READ_RECEIPT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{req:{sequence:"MsgSeq"}}}),this._map.set(I.SEND_C2C_READ_RECEIPT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:"",messageInfoList:void 0},keyMap:{req:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}),this._map.set(I.SEND_READ_RECEIPT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{req:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}),this._map.set(I.GET_READ_RECEIPT_DETAIL,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.GET_READ_RECEIPT_DETAIL)}),body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{req:{sequence:"MsgSeq",count:"Num"},res:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}),this._map.set(I.MODIFY_C2C_MSG_EXT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.MODIFY_C2C_MSG_EXT)}),body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}),this._map.set(I.GET_C2C_MSG_EXT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.GET_C2C_MSG_EXT)}),body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}),this._map.set(I.MODIFY_GRP_MSG_EXT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.MODIFY_GRP_MSG_EXT)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}),this._map.set(I.GET_GRP_MSG_EXT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.GET_GRP_MSG_EXT)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,startSequence:void 0}}),this._map.set(I.ADD_C2C_MSG_REACTION,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.ADD_C2C_MSG_REACTION)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Add_Account"}}}),this._map.set(I.RM_C2C_MSG_REACTION,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.RM_C2C_MSG_REACTION)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Del_Account"}}}),this._map.set(I.GET_C2C_MSG_REACTIONS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.GET_C2C_MSG_REACTIONS)}),body:{from:void 0,to:void 0,messageKeyList:void 0,count:void 0}}),this._map.set(I.GET_C2C_MSG_REACTION_USER_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.GET_C2C_MSG_REACTION_USER_LIST)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,count:void 0}}),this._map.set(I.ADD_GRP_MSG_REACTION,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.ADD_GRP_MSG_REACTION)}),body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Add_Account"}}}),this._map.set(I.RM_GRP_MSG_REACTION,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.RM_GRP_MSG_REACTION)}),body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Del_Account"}}}),this._map.set(I.GET_GRP_MSG_REACTIONS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.GET_GRP_MSG_REACTIONS)}),body:{groupID:void 0,topicID:void 0,messageSequenceList:void 0,count:void 0},keyMap:{res:{MsgSeq:"messageSequence"}}}),this._map.set(I.GET_GRP_MSG_REACTION_USER_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM_MSG_EXT,".").concat(I.GET_GRP_MSG_REACTION_USER_LIST)}),body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,nextSeq:void 0,count:void 0}}),this._map.set(I.GET_C2C_PEER_READ_TIME,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.GET_C2C_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{req:{userIDList:"To_Account"},res:{ReadTime:"peerReadTimeList"}}}),this._map.set(I.PAGING_GET_CONV_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.PAGING_GET_CONV_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:15,assistFlag:31},keyMap:{req:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},res:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex",GroupId:"convGroupID",C2cRemark:"friendRemark",MsgRecvOption:"messageRemindType",GroupIgnoredUnreadSeqCount:"noUnreadCount",GroupNextMsgSeq:"nextMessageSeq"}}}),this._map.set(I.DEL_CONV,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.DEL_CONV)}),body:{fromAccount:"",conversationList:void 0,clearHistoryMessage:void 0},keyMap:{req:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble",conversationList:"ContactItem"},res:{ResultItem:"resultList",ToGroupid:"groupID",ResultCode:"code",ResultInfo:"info"}}}),this._map.set(I.CLEAR_HISTORY_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.CLEAR_HISTORY_MSG)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{req:{toGroupID:"ToGroupid"}}}),this._map.set(I.PIN_CONV,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.PIN_CONV)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{req:{itemList:"RecentContactItem"}}}),this._map.set(I.DEL_GROUP_AT_TIPS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.DEL_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{req:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}),this._map.set(I.SET_CONV_CUSTOM_DATA,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.MARK_CONV)}),body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},res:{ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(I.MARK_CONV,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.MARK_CONV)}),body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},res:{ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(I.CREATE_CONV_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.CREATE_CONV_GRP)}),body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"GroupContactItem",groupID:"ToGroupId"},res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(I.DEL_CONV_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.DEL_CONV_GRP)}),body:{fromAccount:"",groupName:void 0},keyMap:{res:{GroupId:"convGroupID"}}}),this._map.set(I.RENAME_CONV_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.RENAME_CONV_GRP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{req:{oldName:"OldGroupName",newName:"NewGroupName",groupID:"ToGroupId",operationType:"ContactOptType",groupName:"OldGroupName",updateItem:"ContactUpdateItem"},res:{ContactOptType:"operationType",ToGroupId:"groupID",GroupId:"convGroupID"}}}),this._map.set(I.ADD_CONV_TO_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.RENAME_CONV_GRP)}),body:{fromAccount:"",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}}}),this._map.set(I.DEL_CONV_FROM_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.RENAME_CONV_GRP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0}}),this._map.set(I.GET_CONV_GRP_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.GET_CONV_GRP_LIST)}),body:{fromAccount:"",startIndex:void 0},keyMap:{res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList"}}}),this._map.set(I.SEARCH_CONV_GRP_MARK,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.RECENT_CONTACT,".").concat(I.SEARCH_CONV_GRP_MARK)}),body:{fromAccount:"",contactItem:void 0},keyMap:{req:{groupID:"ToGroupId"},res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList",ContactResultItem:"contactItem"}}}),this._map.set(I.GET_USER_PROFILE,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.PROFILE,".").concat(I.GET_USER_PROFILE)}),body:{fromAccount:"",userItem:[]},keyMap:{req:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}),this._map.set(I.UPDATE_MY_PROFILE,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.PROFILE,".").concat(I.UPDATE_MY_PROFILE)}),body:{fromAccount:"",profileItem:[{tag:qe.NICK,value:""},{tag:qe.GENDER,value:""},{tag:qe.ALLOWTYPE,value:""},{tag:qe.AVATAR,value:""}]},keyMap:{req:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}),this._map.set(I.GET_BL,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.GET_BL)}),body:{fromAccount:"",startIndex:0,maxLimited:30}}),this._map.set(I.ADD_TO_BL,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.ADD_TO_BL)}),body:{fromAccount:"",toAccount:[]}}),this._map.set(I.RM_FROM_BL,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.RM_FROM_BL)}),body:{fromAccount:"",toAccount:[]}}),this._map.set(I.SET_SELF_STATUS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_STATUS,".").concat(I.SET_SELF_STATUS)}),body:{customStatus:""}}),this._map.set(I.GET_USER_STATUS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_STATUS,".").concat(I.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{res:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}),this._map.set(I.SUB_USER_STATUS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_STATUS,".").concat(I.SUB_USER_STATUS)}),body:{userIDList:void 0},keyMap:{res:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}),this._map.set(I.UNSUB_USER_STATUS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_STATUS,".").concat(I.UNSUB_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{res:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}),this._map.set(I.GET_FD_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.GET_FD_LIST)}),body:{fromAccount:"",startIndex:0,standardSequence:0,customSequence:0},keyMap:{res:{FriendNum:"friendCount",UserDataItem:"resultList",ValueItem:"tagValueList"}}}),this._map.set(I.ADD_FD,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.ADD_FD)}),body:{fromAccount:"",addFriendItem:[],type:""},keyMap:{req:{source:"AddSource",wording:"AddWording",type:"AddType"},res:{ResultItem:"resultList"}}}),this._map.set(I.UPDATE_FD,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.UPDATE_FD)}),body:{fromAccount:"",updateItem:void 0},keyMap:{req:{snsItem:"SnsItem"},res:{ResultItem:"resultList"}}}),this._map.set(I.DEL_FD,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.DEL_FD)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{req:{type:"DeleteType"},res:{ResultItem:"resultList"}}}),this._map.set(I.GET_FD_PROFILE,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.GET_FD_PROFILE)}),body:{fromAccount:"",userIDList:void 0},keyMap:{res:{InfoItem:"resultList",SnsProfileItem:"tagValueList"}}}),this._map.set(I.CHECK_FD,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.CHECK_FD)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{req:{type:"CheckType"},res:{InfoItem:"resultList"}}}),this._map.set(I.GET_FD_APPLICATION_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.GET_FD_APPLICATION_LIST)}),body:{fromAccount:"",applicationType:"",startTime:0,maxLimited:0,lastSequence:0},keyMap:{res:{PendencyItem:"resultList",AddSource:"source",AddTime:"time",AddWording:"wording",Image:"avatar",UnreadPendencyCount:"unreadCount",To_Account:"userID",PendencyType:"type"}}}),this._map.set(I.RESPOND_FD_APPLICATION,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.RESPOND_FD_APPLICATION)}),body:{fromAccount:"",responseFriendItem:[]},keyMap:{req:{tag:"TagName",action:"ResponseAction"},res:{ResultItem:"resultList"}}}),this._map.set(I.DEL_FD_APPLICATION,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.DEL_FD_APPLICATION)}),body:{fromAccount:"",type:"",userIDList:void 0},keyMap:{req:{type:"PendencyType",userIDList:"To_Account"},res:{ResultItem:"resultList"}}}),this._map.set(I.REPORT_FD_APPLICATION,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.REPORT_FD_APPLICATION)}),body:{fromAccount:"",latestTimeStamp:""},keyMap:{req:{latestTimeStamp:"LatestPendencyTimeStamp"}}}),this._map.set(I.CREATE_FD_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.CREATE_FD_GRP)}),body:{fromAccount:"",groupName:void 0,userIDList:void 0},keyMap:{req:{groupName:"GroupName",userIDList:"To_Account"},res:{ResultItem:"resultList"}}}),this._map.set(I.DEL_FD_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.DEL_FD_GRP)}),body:{fromAccount:"",nameList:void 0},keyMap:{req:{nameList:"GroupName"}}}),this._map.set(I.GET_FD_GRP_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.GET_FD_GRP_LIST)}),body:{fromAccount:"",lastSequence:0,needFriend:"Need_Friend_Type_Yes"},keyMap:{res:{ResultItem:"resultList",GroupName:"name",FriendNumber:"friendCount",To_Account:"userIDList"}}}),this._map.set(I.UPDATE_FD_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FD,".").concat(I.UPDATE_FD_GRP)}),body:{fromAccount:"",oldName:"",newName:void 0,updateGroupItem:void 0},keyMap:{req:{oldName:"GroupOldName",newName:"GroupNewName"},res:{UpdateType:"type",ResultItem:"resultList"}}}),this._map.set(I.GET_GRP_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.GET_GRP_LIST)}),body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0,needAppDefineData:1},keyMap:{req:{memberAccount:"Member_Account"},res:{GroupIdList:"groups",MsgSeq:"readedSequence",LastRecallTime:"_lastRevokedTime",AppDefinedData:"groupCustomField"}}}),this._map.set(I.GET_GRP_PROFILE,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.GET_GRP_PROFILE)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:void 0,groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{req:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}),this._map.set(I.CREATE_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.CREATE_GRP)}),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,inviteOption:void 0},keyMap:{req:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",inviteOption:"InviteJoinOption"},res:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}),this._map.set(I.DISMISS_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.DISMISS_GRP)}),body:{groupID:void 0}}),this._map.set(I.UPDATE_GRP_PROFILE,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.UPDATE_GRP_PROFILE)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0,inviteOption:void 0},keyMap:{req:{groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl",inviteOption:"InviteJoinOption"},res:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}),this._map.set(I.APPLY_JOIN_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.APPLY_JOIN_GRP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{req:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},res:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}),this._map.set(I.APPLY_JOIN_GRP_NOAUTH,(e.a2,e.tinyid,{head:y(y({},g(e,vs)),{},{servcmd:"".concat(a.NAME.BIG_GRP_NO_AUTH,".").concat(I.APPLY_JOIN_GRP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{req:{applyMessage:"ApplyMsg"},res:{HugeGroupFlag:"avChatRoomFlag"}}})),this._map.set(I.QUIT_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.QUIT_GRP)}),body:{groupID:void 0}}),this._map.set(I.SEARCH_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.SEARCH_GRP)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"]}}}),this._map.set(I.CHANGE_GRP_OWNER,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.CHANGE_GRP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{req:{newOwnerID:"NewOwner_Account"}}}),this._map.set(I.HANDLE_GRP_APPLICATION,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.HANDLE_GRP_APPLICATION)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{req:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}),this._map.set(I.HANDLE_INVITE_JOIN_GRP,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.HANDLE_INVITE_JOIN_GRP)}),body:{groupID:void 0,applicant:void 0,invitee:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,userDefinedField:void 0},keyMap:{req:{applicant:"Applicant_Account",invitee:"Invited_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg"}}}),this._map.set(I.HANDLE_GRP_INVITATION,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.HANDLE_GRP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{req:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}),this._map.set(I.GET_GRP_PENDENCY,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.GET_GRP_PENDENCY)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{req:{handleAccount:"Handle_Account"},res:{To_Account:"userID",ApplyInviteMsg:"note"}}}),this._map.set(I.DEL_GRP_SYSTEM_NOTICE,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.DEL_GRP_SYSTEM_NOTICE)}),body:{messageListToDelete:void 0},keyMap:{req:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}),this._map.set(I.AV_POLLING,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.BIG_GRP_POLLING,".").concat(I.AV_POLLING)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{req:{USP:"USP"},res:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}),this._map.set(I.AV_NOAUTH_POLLING,(e.a2,e.tinyid,{head:y(y({},g(e,Is)),{},{servcmd:"".concat(a.NAME.BIG_GRP_POLLING_NO_AUTH,".").concat(I.AV_POLLING)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{req:{USP:"USP"},res:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}})),this._map.set(I.GET_ONLINE_MBR_NUM,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.GET_ONLINE_MBR_NUM)}),body:{groupID:void 0},keyMap:{res:{OnlineMemberNum:"memberCount"}}}),this._map.set(I.SET_GRP_ATTR,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.SET_GRP_ATTR)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key",value:"value"}}}),this._map.set(I.MODIFY_GRP_ATTR,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.MODIFY_GRP_ATTR)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key",value:"value"}}}),this._map.set(I.DEL_GRP_ATTR,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.DEL_GRP_ATTR)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key"}}}),this._map.set(I.CLEAR_GRP_ATTR,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.CLEAR_GRP_ATTR)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}),this._map.set(I.GET_GRP_ATTR,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP_ATTR,".").concat(I.GET_GRP_ATTR)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{req:{avChatRoomKey:"Key",groupType:"GroupType"}}}),this._map.set(I.GET_GRP_NOTIFY,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.GET_GRP_NOTIFY)}),body:{notifyReqList:[]},keyMap:{req:{notifyReqList:"NotifyReqList"},res:{NextMsgTime:"nextRevokedTime",NotifyMsgList:"notifyList",NotifyRspList:"notifyRspList"}}}),this._map.set(I.UPDATE_GRP_COUNTER,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.UPDATE_GRP_COUNTER)}),body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{req:{counterList:"GroupCounter"}}}),this._map.set(I.GET_GRP_COUNTER,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.GET_GRP_COUNTER)}),body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{req:{keyList:"GroupCounterKeys"}}}),this._map.set(I.CREATE_TOPIC,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP_COMMUNITY,".").concat(I.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:{req:{avatar:"FaceUrl"}}}),this._map.set(I.DEL_TOPIC,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP_COMMUNITY,".").concat(I.DEL_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{req:{topicIDList:"TopicIdList"},res:{DestroyResultItem:"resultList"}}}),this._map.set(I.UPDATE_TOPIC_PROFILE,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP_COMMUNITY,".").concat(I.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:{req:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}),this._map.set(I.GET_TOPIC_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP_COMMUNITY,".").concat(I.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:["NoUnreadSeqList"]},keyMap:{req:{topicIDList:"TopicIdList"},res:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence"}}}),this._map.set(I.GET_GRP_MBR_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.GET_GRP_MBR_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{req:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}),this._map.set(I.GET_AV_MBR_LIST,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP_AV,".").concat(I.GET_AV_MBR_LIST)}),body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{req:{offset:"Timestamp",filter:"Mark"},res:{NextTimestamp:"offset"}}}),this._map.set(I.GET_GRP_MBR_PROFILE,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.GET_GRP_MBR_PROFILE)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{req:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}),this._map.set(I.ADD_GRP_MBR,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.ADD_GRP_MBR)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{req:{userID:"Member_Account",userIDList:"MemberList"},res:{MemberList:"members"}}}),this._map.set(I.DEL_GRP_MBR,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.DEL_GRP_MBR)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{req:{userIDList:"MemberToDel_Account"}}}),this._map.set(I.BAN_AV_MBR,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.BAN_AV_MBR)}),body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:""},keyMap:{req:{userIDList:"Members_Account",duration:"Duration",reason:"Description"}}}),this._map.set(I.MODIFY_GRP_MBR_INFO,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP,".").concat(I.MODIFY_GRP_MBR_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:{req:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}),this._map.set(I.MARK_AV_MBR_INFO,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP_AV,".").concat(I.MARK_AV_MBR_INFO)}),body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{req:{operationType:"CommandType",memberList:"MemberList",markType:"Marks",userID:"Member_Account"},res:{CommandType:"operationType",Marks:"markType",Member_Account:"userID"}}}),this._map.set(I.CS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.MSG_SEARCH,".").concat(I.CS)}),body:{keywordList:void 0,keywordListMatchType:"or",account:void 0,groupID:void 0,count:100,cursor:void 0,messageTypeList:void 0,senderUserIDList:void 0,startTime:void 0,endTime:void 0},keyMap:{req:{keywordListMatchType:"MatchType",account:"PeerAccount",groupID:"GroupID",messageTypeList:"MsgTypeList",senderUserIDList:"SendUserIDList",keywords:"Keywords",keywordMatchType:"KeywordMatchType",count:"Count",miniBirthday:"UserBirthStart",maxBirthday:"UserBirthEnd",gender:"UserGenderType",groupTypeList:"GroupType",groupIDList:"GroupIdList"},res:{GroupID:"groupID",UserID:"userID",ErrorCode:"code",ErrorInfo:"message",TotalCount:"totalCount",Count:"messageCount",LastMsgTime:"lastMessageTime",ConversationMsgs:"searchResult",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer",MsgSeq:"sequence",ReqMsgSeq:"sequence",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgContent:"content",ClientSeq:"clientSequence",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList",Users:"userList",ProfileItems:"profileItems",StrValue:"value",IntValue:"value",Groups:"groupList",GroupFaceUrl:"avatar",GroupIntroduction:"introduction",GroupOwnerUserID:"ownerID",GroupOwnerUserName:"ownerNick",GroupOwnerTinyID:"ownerTinyID",GroupMemberNum:"memberNum",GroupName:"name",GroupType:"type",GroupMembers:"groupMemberList",GroupMemberUserID:"userID",GroupMemberTinyID:"userTinyID",GroupMemberUserName:"nick",GroupMemberNameCard:"nameCard"}}}),this._map.set(I.USER_CS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.USER_SEARCH,".").concat(I.CS)}),body:{keywords:void 0,keywordMatchType:0,miniBirthday:void 0,maxBirthday:void 0,gender:void 0,count:20,cursor:void 0}}),this._map.set(I.GRP_CS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP_SEARCH,".").concat(I.CS)}),body:{keywords:void 0,keywordMatchType:0,groupType:void 0,count:20,cursor:void 0}}),this._map.set(I.MBR_CS,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.GRP_MEMBER_SEARCH,".").concat(I.CS)}),body:{keywords:void 0,keywordMatchType:0,groupType:void 0,groupIDList:void 0,count:20,cursor:void 0}}),this._map.set(I.SSO_STAT,{head:y(y({},n),{},{servcmd:"".concat(a.NAME.IM_OPEN_STAT,".").concat(I.SSO_STAT)}),body:{header:{},event:[],quality:[]},keyMap:{req:{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"}}}),this._map.set(I.PING,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.HEARTBEAT,".").concat(I.PING)}),body:{}}),this._map.set(I.MSG_PUSH,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_PUSH,".").concat(I.MSG_PUSH)}),body:{},keyMap:{res:{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"}}}),this._map.set(I.MULTI_MSG_PUSH,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_PUSH,".").concat(I.MULTI_MSG_PUSH)}),body:{},keyMap:{res:{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"}}}),this._map.set(I.MSG_PUSH_ACK,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OPEN_IM,".").concat(I.MSG_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{req:{sessionData:"SessionData"}}}),this._map.set(I.STATUS_FORCE_OFFLINE,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_STATUS,".").concat(I.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{res:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}),this._map.set(I.DOWNLOAD_MERGER_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_LONG_MSG,".").concat(I.DOWNLOAD_MERGER_MSG)}),body:{downloadKey:""},keyMap:{res:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}),this._map.set(I.UPLOAD_MERGER_MSG,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_LONG_MSG,".").concat(I.UPLOAD_MERGER_MSG)}),body:{messageList:[]},keyMap:{req:{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"}}}),this._map.set(I.FOLLOW,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FOLLOW,".").concat(I.FOLLOW)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"FollowItem"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(I.UNFOLLOW,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FOLLOW,".").concat(I.UNFOLLOW)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(I.GET_FOLLOW_INFO,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FOLLOW,".").concat(I.GET_FOLLOW_INFO)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{FollowInfo:"followInfoList",To_Account:"userID",FollowerCount:"followersCount",FollowingCount:"followingCount",MutualFollowingCount:"mutualFollowersCount"}}}),this._map.set(I.GET_FOLLOW,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FOLLOW,".").concat(I.GET_FOLLOW)}),body:{fromAccount:"",type:1,nextCursor:"",count:500},keyMap:{req:{type:"FollowType",nextCursor:"StartCursor",count:"WantNum"},res:{FollowItem:"resultList",To_Account:"userID",ProfileItem:"profileList"}}}),this._map.set(I.CHECK_FOLLOW_TYPE,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.FOLLOW,".").concat(I.CHECK_FOLLOW_TYPE)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(I.SET_TOKEN,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_STATUS,".").concat(I.SET_TOKEN)}),body:{tokenID:"",pushMsg:0,sdkAppID:0,businessID:"",deviceBrand:"",deviceToken:"",isTpns:0,isWebUniapp:0,notificationStatus:0,deviceModel:"",systemVersion:"",pushVersion:""},keyMap:{req:{tokenID:"TokenID",pushMsg:"PushMsg",sdkAppID:"EnterVersion",businessID:"BusiID",deviceBrand:"InstType",deviceToken:"VarToken",isTpns:"IsTpns",notificationStatus:"NotificationStatus",deviceModel:"DeviceModel",systemVersion:"SystemVersion",pushVersion:"PushPluginVersion"}}}),this._map.set(I.STAT_FOREGROUND,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_STATUS,".").concat(I.STAT_FOREGROUND)}),body:{isWebUniapp:0}}),this._map.set(I.STAT_BACKGROUND,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_OPEN_STATUS,".").concat(I.STAT_BACKGROUND)}),body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{req:{c2cUnreadCount:"C2cUnread",groupUnreadCount:"GrpUnread"}}}),this._map.set(I.PUSH_REPORT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.OFFLINE_PUSH_REPORT,".").concat(I.PUSH_REPORT)}),body:{eventList:[]},keyMap:{req:{eventList:"UinappPushEvents",type:"EventType",time:"EventTime",pushId:"ClickExt"}}}),this._map.set(I.SET_ALL_RECEIVE_MSG_OPT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_MSG_LOGIC,".").concat(I.SET_ALL_RECEIVE_MSG_OPT)}),body:{startTime:0,endTime:0,isRepeated:0,messageRemindType:0},keyMap:{req:{messageRemindType:"Level"}}}),this._map.set(I.GET_ALL_RECEIVE_MSG_OPT,{head:y(y({},e),{},{servcmd:"".concat(a.NAME.IM_MSG_LOGIC,".").concat(I.GET_ALL_RECEIVE_MSG_OPT)}),body:{toAccount:void 0}})}},{key:"has",value:function(e){return this._map.has(e)}},{key:"get",value:function(e){return this._map.get(e)}},{key:"update",value:function(){this._fillMap()}},{key:"getKeyMap",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(v.w("".concat(this._n,".getKeyMap unknown P:").concat(e)),{})}},{key:"getProtocolData",value:function(e){var t=e.P,n=e.data,e=this.get(t),t=null;if(n){var o,i=this._simpleDeepCopy(e),i=this._updateService(n,i),a=i.body,s=Object.create(null);for(o in a)if(Object.prototype.hasOwnProperty.call(a,o)){if(s[o]=a[o],void 0===n[o])continue;s[o]=n[o]}i.body=s,t=this._getUplinkData(i)}else t=this._getUplinkData(e);return t}},{key:"_getUplinkData",value:function(e){var e=this._dataCleaner(e),t=xt(e.head),t=is(e.body,this._getReqKeyMap(t));return e.body=t,e}},{key:"_updateService",value:function(e,t){var n,o,i=xt(t.head);return this._isFromGroupRequest(t)&&(n=e.type,o=e.groupID,e=void 0===(e=e.groupIDList)?[]:e,A(o=void 0===o?void 0:o)&&(o=e[0]||""),kt({type:n,groupID:o})&&(t.head.servcmd="".concat(a.NAME.GRP_COMMUNITY,".").concat(i))),t}},{key:"_isFromGroupRequest",value:function(e){return e.head.servcmd.includes(a.NAME.GRP)||e.head.servcmd.includes(a.NAME.GRP_ATTR)}},{key:"_getReqKeyMap",value:function(e){e=this.getKeyMap(e);return y(y({},za.req),e.req)}},{key:"_dataCleaner",value:function(e){var t,n=Array.isArray(e)?[]:Object.create(null);for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&st(t)&&null!==e[t]&&void 0!==e[t]&&("object"!==r(e[t])?n[t]=e[t]:n[t]=this._dataCleaner.bind(this)(e[t]));return n}},{key:"_simpleDeepCopy",value:function(e){for(var t,n=Object.keys(e),o={},i=0,a=n.length;i<a;i++)t=n[i],nt(e[t])?o[t]=Array.from(e[t]):$e(e[t])?o[t]=this._simpleDeepCopy(e[t]):o[t]=e[t];return o}}]),Rs),ys=[I.MSG_PUSH_ACK],Cs=(e(ks,[{key:"_onC2CMsgArray",value:function(e){var t=this._sessionM.get(6);e.dataList.forEach(function(e){var t;1===e.isSyncMessage&&(t=e.from,e.from=e.to,e.to=t)}),1===e.needSync&&this._sessionM.get(19).syncOnNeed(),t.onNewMessage({dataList:e.dataList,isInstantMessage:!0})}},{key:"_onC2CMsgModified",value:function(e){this._sessionM.get(6).onMsgModified(e)}},{key:"_onGroupMsgArray",value:function(e){var t=this._sessionM.get(7);t&&t.onNewMessage({event:e.event,dataList:e.dataList,isInstantMessage:!0})}},{key:"_onGroupMsgModified",value:function(e){var t=this._sessionM.get(7);t&&t.onMsgModified(e)}},{key:"_onGroupTips",value:function(e){var t=this._sessionM.get(7);if(t){var n=e.event,o=e.dataList,i=e.isInstantMessage,a=void 0===i||i,s=e.isSyncingEnded;switch(n){case 4:case 6:t.onNewGroupTips({event:n,dataList:o});break;case 5:for(var r=0;r<o.length;r++)if(nt(o[r].elements.revokedInfos))t.onMsgRevoked({dataList:o});else if(nt(o[r].elements.groupMessageReadNotice))t.onMsgReadNotice({dataList:o});else{if(!nt(o[r].elements.readReceiptList)){t.onNewGroupSystemNotice({dataList:o,isInstantMessage:a,isSyncingEnded:s});break}t.onReadReceiptList({dataList:o})}break;case 12:this._sessionM.get(11).onNewGroupAtTips({dataList:o});break;default:v.l("".concat(this._n,"._onGroupTips unknown event:").concat(n," dataList:"),o)}}}},{key:"_onC2CNotifyMsgArray",value:function(e){var o,i=this,a=e.dataList;nt(a)&&(o=this._sessionM.get(6),a.forEach(function(e){var t,n;et(e)&&(e.hasOwnProperty("kickoutMsgNotify")?(t=(n=e.kickoutMsgNotify).kickType,n=void 0===(n=n.newInstanceInfo)?{}:n,1===t?i._sessionM.onMultipleAccountKickedOut(n):2===t?i._sessionM.onMultipleDeviceKickedOut(n):3===t&&i._sessionM.onRestApiKickedOut(n)):e.hasOwnProperty("c2cMessageRevokedNotify")?o&&o.onMsgRevoked({dataList:a},!0):e.hasOwnProperty("c2cMessageReadReceipt")?o&&o.onMsgReadReceipt({dataList:a}):e.hasOwnProperty("c2cMessageReadNotice")?o&&o.onMsgReadNotice({dataList:a}):e.hasOwnProperty("muteNotificationsSync")&&i._sessionM.get(11).onC2CMsgRemindTypeSynced({dataList:a}))}))}},{key:"_onC2CReadReceiptArray",value:function(e){this._sessionM.get(6).onReadReceiptList(e)}},{key:"_onProfileModified",value:function(e){this._sessionM.get(4).onProfileModified({dataList:e.dataList});var t=this._sessionM.get(8);t&&t.onFriendProfileModified({dataList:e.dataList})}},{key:"_onRelationChainModified",value:function(e){this._sessionM.get(4).onRelationChainModified({dataList:e.dataList});var t=this._sessionM.get(8);t&&t.onRelationChainModified({dataList:e.dataList})}},{key:"_onRecentContact",value:function(e){var i,e=e.dataList;!nt(e)||(i=this._sessionM.get(11))&&e.forEach(function(e){var t,n,o=e.pushType;1===o?(t=e.recentContactDeleteItem,i.onConvDeleted(t.recentContactList)):2===o?(t=e.recentContactTopItem,i.onConvPinnedStatus(t.recentContactList,!0)):3===o?(t=e.recentContactTopItem,i.onConvPinnedStatus(t.recentContactList,!1)):4===o?(t=e.recentContactMarkContact,i.onConvMarkUpdated(t.recentContactMarkContactItem)):5===o?(t=e.recentContactCreateContactGroup,i.onConvGroupCreated(t.msgContactGroupContactItem)):6===o?(t=e.recentContactDelContactGroup,i.onConvGroupDeleted(t.msgGroupItem)):7===o&&(o=(t=e.recentContactUpdateContactGroup).updateType,e=t.msgUpdateGroup,t=t.msgUpdateContact,1===o?1===(n=e.updateGroupType)?i.onConvGroupNameUpdated(e):2===n&&i.onConvInGroupUpdated(e):2===o&&i.onConvAddedToOrDeletedFromGroup(t))})}},{key:"_onAllMsgRead",value:function(e){var e=e.dataList,t=this._sessionM.get(11);t&&t.onPushedAllMessageRead(e)}},{key:"_onUserStatusList",value:function(e){this._sessionM.get(4).onUserStatusUpdated(e)}},{key:"_onMsgExtNotify",value:function(e){this._sessionM.get(3).onMsgExtNotify(e)}},{key:"_onMsgReactionNotifyList",value:function(e){this._sessionM.get(34).onReactionNotifyList(e)}},{key:"_onMsgReactionNotify",value:function(e){this._sessionM.get(34).onReactionNotify(e)}},{key:"_onFollowNotify",value:function(e){this._sessionM.get(35).onFollowNotify(e)}},{key:"_onTopicLatestMsg",value:function(e){this._sessionM.get(10).onTopicLatestMsg(e)}},{key:"onMessage",value:function(e){var t=this,n=e.body;if(this._filterMsgFromIMOpenPush(e)){var o,i=n.eventArray,a=n.isInstantMessage,l=n.isSyncingEnded,d=n.needSync;if(nt(i))for(var s,r,c,u=0,p=i.length;u<p;u++)100!==(c=(s=i[u]).event)?24!==c?26!==c?(o=Object.keys(s).find(function(e){return-1!==t._keys.indexOf(e)}))?(r=14===c?{readAllC2CMessage:s[o],groupMessageReadInfoList:s.groupMessageReadNotice||[]}:16===c?{userID:s.userID,timestamp:s.timestamp,readReceiptList:s[o]}:s[o],this._eventHandlerMap.get(o)({event:c,dataList:r,isInstantMessage:a,isSyncingEnded:l,needSync:d})):v.l("".concat(this._n,".onMessage unknown eventItem:"),s):this._onTopicLatestMsg(s):this._onAllRcvMsgOptNotify(s):this._onRoomCustomData(s.content)}}},{key:"_onRoomCustomData",value:function(e){this._sessionM.get(30).onRoomCustomDataReceived(e),v.l("".concat(this._n,"._onRoomCustomData data:").concat(e))}},{key:"_onAllRcvMsgOptNotify",value:function(e){this._sessionM.get(11).onAllRcvMsgOptNotify(e)}},{key:"_filterMsgFromIMOpenPush",value:function(e){var t=e.head,e=e.body,t=t.servcmd,n=!1;return!(n=A(t)?n:t.includes(a.NAME.IM_CONFIG_MANAGER)||t.includes(a.NAME.OVERLOAD_PUSH)||t.includes(a.NAME.STAT_SERVICE))||(t.includes(I.PUSHED_CLOUD_CTRL_CONFIG)?this._sessionM.get(23).onPushedConfig(e):t.includes(I.PUSHED_COMMERCIAL_CONFIG)?this._sessionM.get(27).onPushedConfig(e):t.includes(I.OVERLOAD_NOTIFY)?this._sessionM.onPushedServerOverload(e):t.includes(I.KICK_OTHER)&&(n=Date.now(),this._sessionM.reLoginOnKickOther(),e=new M("kickOther"),n=n-(t=this._sessionM.get(1).getLastWsHelloTs()),e.setMessage("last wshello time:".concat(t," diff:").concat(n,"ms")).end()),!1)}}]),ks),Ts=[{cmd:I.GET_GRP_PROFILE,interval:1,count:8},{cmd:I.UPDATE_GRP_PROFILE,interval:1,count:8},{cmd:I.GET_AV_MBR_LIST,interval:3,count:1},{cmd:I.GET_GRP_PENDENCY,interval:1,count:15},{cmd:I.GET_TOPIC_LIST,interval:1,count:10},{cmd:I.SET_GRP_ATTR,interval:5,count:10},{cmd:I.MODIFY_GRP_ATTR,interval:5,count:10},{cmd:I.DEL_GRP_ATTR,interval:5,count:10},{cmd:I.CLEAR_GRP_ATTR,interval:5,count:10},{cmd:I.GET_GRP_ATTR,interval:5,count:20},{cmd:I.UPDATE_GRP_COUNTER,interval:5,count:20},{cmd:I.GET_GRP_COUNTER,interval:5,count:20},{cmd:I.SET_ALL_MSG_READ,interval:1,count:1},{cmd:I.GET_USER_STATUS,interval:5,count:20},{cmd:I.SUB_USER_STATUS,interval:5,count:20},{cmd:I.UNSUB_USER_STATUS,interval:5,count:20},{cmd:I.CS,interval:5,count:20},{cmd:I.GRP_CS,interval:5,count:20},{cmd:I.MBR_CS,interval:5,count:20},{cmd:I.USER_CS,interval:5,count:20},{cmd:I.CHECK_FOLLOW_TYPE,interval:5,count:20},{cmd:I.GET_GRP_ROAMING_MSG,interval:1,count:20},{cmd:I.GET_C2C_ROAMING_MSG,interval:1,count:20}],Ds=new Map,Es=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],Ls=0,Ss=Es.length;Ls<Ss;Ls++)Ds.set(Ls,Es[Ls]);function ks(e){d(this,ks),this._sessionM=e,this._n="MsgDispatcher",this._eventHandlerMap=new Map,this._eventHandlerMap.set("C2CMessageArray",this._onC2CMsgArray.bind(this)),this._eventHandlerMap.set("groupMessageArray",this._onGroupMsgArray.bind(this)),this._eventHandlerMap.set("groupTips",this._onGroupTips.bind(this)),this._eventHandlerMap.set("C2CNotifyMessageArray",this._onC2CNotifyMsgArray.bind(this)),this._eventHandlerMap.set("C2CReadReceiptArray",this._onC2CReadReceiptArray.bind(this)),this._eventHandlerMap.set("profileModify",this._onProfileModified.bind(this)),this._eventHandlerMap.set("friendListMod",this._onRelationChainModified.bind(this)),this._eventHandlerMap.set("recentContactMod",this._onRecentContact.bind(this)),this._eventHandlerMap.set("readAllC2CMessage",this._onAllMsgRead.bind(this)),this._eventHandlerMap.set("c2cMessageModified",this._onC2CMsgModified.bind(this)),this._eventHandlerMap.set("groupMessageModified",this._onGroupMsgModified.bind(this)),this._eventHandlerMap.set("userStatusList",this._onUserStatusList.bind(this)),this._eventHandlerMap.set("messageExtensionNotify",this._onMsgExtNotify.bind(this)),this._eventHandlerMap.set("messageReactionNotifyList",this._onMsgReactionNotifyList.bind(this)),this._eventHandlerMap.set("messageReactionNotify",this._onMsgReactionNotify.bind(this)),this._eventHandlerMap.set("followChangeList",this._onFollowNotify.bind(this)),this._keys=D(this._eventHandlerMap.keys())}function Rs(e){d(this,Rs),this._n="PHandler",this._sessionM=e,this._map=new Map,this._fillMap()}function As(e){return d(this,As),(e=as.call(this,e))._n="ChannelModule",e._socketHandler=new gs(h(e)),e._probing=!1,e._isAppShowing=!0,e._previousState=R.NET_STATE_CONNECTED,e._timerForNotLoggedIn=-1,e._timerForNotLoggedIn=setInterval(e.onCheckTimer.bind(h(e)),1e3),e._fatalErrorFlag=!1,e._disconnectedTS=0,e._lastDiagnoseTS=0,e}function Os(e){d(this,Os),this._chM=e,this._n="SocketHandler",this._promiseMap=new Map,this._readyState=hs,this._simpleRequestMap=new Map,this.MAX_SIZE=100,this._startSequence=lt(),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._currentSite=V,this._setWebsocketHost(),this._initConnection()}function Ns(e){d(this,Ns);var t,i,n=(this._handler=e).getURL();this._socket=null,this._workerSocket=null,this._id=lt(),this._handler.getIsWorkerEnabled()?(t=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", extensions: _socket.extensions }); }; _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(t),(i=this)._workerSocket.onmessage=function(e){var t=e.data,n=t.callback,o=t.e,t=t.extensions;"onOpen"===n?i._onOpen(t):"onClose"===n?i._onClose(o):"onError"===n?i._onError(o):"onMessage"===n&&i._onMessage(e.data)},this._workerSocket.postMessage({cmd:"start",id:this._id,url:n})):ae?ee?(ue.connectSocket({url:n,header:{"content-type":"application/json"}}),ue.onSocketClose(this._onClose.bind(this)),ue.onSocketOpen(this._onOpen.bind(this)),ue.onSocketMessage(this._onMessage.bind(this)),ue.onSocketError(this._onError.bind(this))):(this._socket=ue.connectSocket({url:n,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))):(this._socket=new WebSocket(n),this._socket.binaryType="arraybuffer",this._socket.onopen=this._onOpen.bind(this,this._socket.extensions),this._socket.onmessage=this._onMessage.bind(this),this._socket.onclose=this._onClose.bind(this),this._socket.onerror=this._onError.bind(this)),this._canIUseBinaryFrame=e.canIUseBinaryFrame()}function Gs(e){for(var t,n,o=e,i="",a=0,s=(o=e.length%8!=0?"0".repeat(8-e.length%8)+e:o).length;a<s;a+=8)t=parseInt(o.slice(a,a+4),2),n=parseInt(o.slice(a+4,a+8),2),i+=Ds.get(t)+Ds.get(n);return i}function Ps(e){if(e<0||53<e)return NaN;var t=0|1073741824*Math.random();return 30<e?t+1073741824*(0|Math.random()*(1<<e-30)):t>>>30-e}function Us(e,t){for(var n=e.toString(16),o=t-n.length,i="0";0<o;o>>>=1,i+=i)1&o&&(n=i+n);return n}t(ec,Fn),Ws=f(ec),e(ec,[{key:"_init",value:function(){this._updateCmdFreqLimitMap(Ts)}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");A(e)||(e=JSON.parse(e),this._updateCmdFreqLimitMap(e))}},{key:"_updateCmdFreqLimitMap",value:function(e){var t=this;e.forEach(function(e){t._cmdFreqLimitMap.set(e.cmd,{interval:e.interval,count:e.count})})}},{key:"updateProtocolConfig",value:function(){this._pHandler.update()}},{key:"req",value:function(e){v.d("".concat(this._n,".req options:"),e);var t=e.P;if(!this._pHandler.has(t))return v.w("".concat(this._n,".req unknown P:").concat(t)),C({code:T.NO_PROTOCOL});var e=this.getProtocolData(e),n=e.head.servcmd;if(this._isFreqOverLimit(n))return C({code:o=T.OVER_FREQUENCY_LIMIT,message:this.getErrMsg(o,this._getCmd(n))});if(this._isServerOverload(n))return C({code:o=T.OPEN_SERVICE_OVERLOAD_ERROR,message:this.getErrMsg(o,this._getCmd(n))});var o=this.get(21);return ys.includes(t)?o.simplySend(e):o.send(e)}},{key:"getKeyMap",value:function(e){return this._pHandler.getKeyMap(e)}},{key:"genCommonHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:x,websdkversion:q,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:12775283,sdkability_ext:Gs(""),cappid:e.getApplicationID(),cs:0}}},{key:"genCosSpecifiedHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:x,websdkversion:q,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:12775283,sdkability_ext:Gs(""),cappid:e.getApplicationID(),cs:0}}},{key:"genSSOReportHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:x,websdkversion:q,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:12775283,sdkability_ext:Gs(""),cappid:e.getApplicationID(),cs:0}}},{key:"getProtocolData",value:function(e){return this._pHandler.getProtocolData(e)}},{key:"trans",value:function(e){var t=e.servcmd,e=e.data,t={head:y(y({},this.genCommonHead()),{},{servcmd:t}),body:e};return this.get(21).send(t)}},{key:"sendComboMessage",value:function(e){var t=e.servcmd,e=e.data,t={head:y(y({},this.genCommonHead()),{},{servcmd:t}),body:e};return this.get(21).send(t)}},{key:"onErrorCodeNotZero",value:function(e){var t,n=e.errorCode;n===T.HELLO_ANSWER_KICKED_OUT&&(t=e.kickType,e=void 0===(e=e.newInstanceInfo)?{}:e,1===t?this.onMultipleAccountKickedOut(e):2===t?this.onMultipleDeviceKickedOut(e):3===t&&this.onRestApiKickedOut(e)),n!==T.MSG_A2KEY_EXPIRED&&n!==T.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.get(21).reConnect())}},{key:"onMessage",value:function(e){var t=e.body,n=t.needAck,t=t.sessionData;1===(void 0===n?0:n)&&this._sendACK(t),this._msgDispatcher.onMessage(e)}},{key:"onReconnected",value:function(e){this._incrementalPullContactFlag=e<=300,this._reLoginOnReconnected()}},{key:"reLoginOnKickOther",value:function(){v.l("".concat(this._n,".reLoginOnKickOther")),this._reLogin()}},{key:"_reLoginOnReconnected",value:function(){v.l("".concat(this._n,"._reLoginOnReconnected")),this._reLogin()}},{key:"_reLogin",value:function(){var e,t,s,r=this,c="".concat(this._n,"._reLogin");this.isLoggedIn()&&(e=0,(t=this.get(1).getPushModule())&&(e=t.getUniAppPlatform()),s=new M("reLogin"),this.req({P:I.LOGIN,data:{isWebUniapp:e,customInfo:this.get(12).getCustomLoginInfo()}}).then(function(e){var e=e.data,t=e.instanceID,e=e.customStatus,n=r.get(12),o=$o(e),i=(n.setStatusInstanceID(t),r.get(21)),a=i.getSocketID(),a="socketID:".concat(a," instanceID:").concat(t," customStatus:").concat(o),t=(s.setMessage(a).end(!0),v.l("".concat(c," ok. ").concat(a)),n.getCustomStatus()!==o&&r.get(4).onUserStatusUpdated({dataList:[{to:r.getMyUserID(),statusType:R.USER_STATUS_ONLINE,customStatus:e}]}),i.diagnose(),r.get(11).syncConvList(r._incrementalPullContactFlag).then(function(){v.l("".concat(c,", sync conv list ok.")),r.get(25).start()}),r.get(7)),a=(t&&t.updateLocalMainSequenceOnReconnected(),r.get(10)),n=(a.resetGetTopicTime(),a.getTopicListOnReconnected(),r.get(35));n&&n.clearCacheOnReconnected()}))}},{key:"onMultipleAccountKickedOut",value:function(e){this.get(1).onMultipleAccountKickedOut(e)}},{key:"onMultipleDeviceKickedOut",value:function(e){this.get(1).onMultipleDeviceKickedOut(e)}},{key:"_onUserSigExpired",value:function(){this.get(1).onUserSigExpired()}},{key:"onRestApiKickedOut",value:function(e){this.get(1).onRestApiKickedOut(e)}},{key:"_sendACK",value:function(e){this.req({P:I.MSG_PUSH_ACK,data:{sessionData:e}})}},{key:"_isFreqOverLimit",value:function(e){e=e.split(".")[1];if(!this._cmdFreqLimitMap.has(e))return!1;if(!this._cmdReqInfoMap.has(e))return this._cmdReqInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1;var t=this._cmdFreqLimitMap.get(e),n=t.count,t=t.interval,o=this._cmdReqInfoMap.get(e),i=o.startTime,o=o.requestCount;return Date.now()-i>1e3*t?(this._cmdReqInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1):(this._cmdReqInfoMap.set(e,{startTime:i,requestCount:o+=1}),n<o)}},{key:"_isServerOverload",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var t=this._serverOverloadInfoMap.get(e),n=t.overloadTime,t=t.waitingTime;return Date.now()-n<=1e3*t||(this._serverOverloadInfoMap.delete(e),!1)}},{key:"_getCmd",value:function(e){var t="";if(!e.includes("."))return t;var n,o=e.split(".")[1];for(n in I)if(I[n]===o){t=n;break}return t}},{key:"onPushedServerOverload",value:function(e){var t=e.overloadCommand,e=e.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:e}),v.w("".concat(this._n,".onPushedServerOverload waitingTime:").concat(e,"s cmd:").concat(this._getCmd(t)))}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._updateCmdFreqLimitMap(Ts),this._cmdReqInfoMap.clear(),this._serverOverloadInfoMap.clear(),this._incrementalPullContactFlag=!0}}]);var bs,ws,Fs,qs,xs,Vs,Hs,Bs,Ks,Ys,Ws,js=ec,Js=(t($r,Fn),Ys=f($r),e($r,[{key:"getCloudConfig",value:function(e){return A(e)?this._cloudConfig:this._cloudConfig.has(e)?this._cloudConfig.get(e):void 0}},{key:"getServerConfig",value:function(e){var t={code:0,data:""};return!A(e)&&this._cloudConfig.has(e)&&(t.data=this._cloudConfig.get(e)),Promise.resolve(t)}},{key:"_canFetch",value:function(){return this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime}},{key:"fetchConfig",value:function(){var o,i=this,a="".concat(this._n,".fetchConfig"),e=this._canFetch();v.l("".concat(a," canFetch:").concat(e)),e&&(o=new M("fetchCloudCtrlConfig"),e=this.get(12).getSDKAppID(),this._isFetching=!0,this.req({P:I.FETCH_CLOUD_CTRL_CONFIG,data:{SDKAppID:e,version:this._version}}).then(function(e){i._isFetching=!1;var t=e.data,n=t.version,t=t.cloudControlConfig;o.setMessage("version:".concat(i._version," newVersion:").concat(n," config:").concat(t)).end(),v.l("".concat(a," ok")),i._parse(e.data)}).catch(function(e){i._isFetching=!1,o.setError(e).end(),v.l("".concat(a," failed. error:"),e),i._setExpiredTime(12e4)}))}},{key:"onPushedConfig",value:function(e){v.l("".concat(this._n,".onPushedConfig config:"),e),new M("pushedCloudCtrlConfig").setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parse(e)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"_parse",value:function(e){var t=this,n="".concat(this._n,"._parse"),o=e.errorCode,i=e.errorMessage,a=e.cloudControlConfig,s=e.version,r=e.expiredTime;if(0===o){if(this._version!==s){var c=null;try{c=JSON.parse(a)}catch(e){this.isPrivateNetWork()||v.e("".concat(n," failed. config:"),a)}c&&(this._cloudConfig.clear(),Object.keys(c).forEach(function(e){t._cloudConfig.set(e,c[e])}),this._version=s,this.emitIEvt(Wo.CLOUD_CONFIG))}this._setExpiredTime(1e3*r)}else A(o)?(v.l("".concat(n," failed. Invalid message format:"),e),this._setExpiredTime(36e5)):(v.e("".concat(n," errorCode:").concat(o," errorMessage:").concat(i)),this._setExpiredTime(12e4))}},{key:"_setExpiredTime",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),$r),zs=(t(Qr,Fn),Ks=f(Qr),e(Qr,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var n,o,i,a,s=this,e=this._getLocalConvList().filter(function(e){return e.type===R.CONV_GROUP&&e.groupProfile.type!==R.GRP_AVCHATROOM}),r=this.get(11),c=[];e.forEach(function(e){var t=e.conversationID,e=e.lastMessage;n=t.replace(R.CONV_GROUP,""),o=r.getLocalLastMessage(t),e&&0!==e.lastSequence&&o?(i=e.lastSequence,o=o.sequence,a=i-o,0<o&&1<=a&&a<300?s._recoverGroupMsg({groupID:n,localLastMessageSequence:o,remoteLastMessageSequence:i}):c.push(n)):c.push(n)}),this._getGroupNotice(c)}},{key:"_recoverC2CChat",value:function(){var n,o,i,a=this,e=this._getLocalConvList().filter(function(e){return e.type===R.CONV_C2C}),s=this.get(11),r=[Promise.resolve()];e.forEach(function(e){var t=e.conversationID,e=e.lastMessage;n=s.getLocalLastMessage(t),e&&0!==e.lastTime&&n&&(o=e.lastTime,n=n.time,i=o-n,0<n&&1<=i&&i<=600&&r.push(a._recoverC2CMsg({conversationID:t,localLastMessageTime:n,remoteLastMessageTime:o})))}),Promise.all(r).then(function(){v.l("".concat(a._n,"._recoverC2CChat all done")),a.get(19).syncOnReconnected()})}},{key:"_getLocalConvList",value:function(){return this.get(11).getLocalConvList()}},{key:"_recoverGroupMsg",value:function(e){var d=this,p="".concat(this._n,".").concat("_recoverGroupMsg"),_=(v.l("".concat(p," options:"),e),e.groupID),h=e.localLastMessageSequence,g=e.remoteLastMessageSequence,f=JSON.stringify(e),m=new M("_recoverGroupMsg");m.setMessage(f),this._getGroupRoamingMsg({groupID:_,sequence:h}).then(function(e){var e=e.data,t=e.complete,n=e.messageList;if(!A(n)){var e=n[0].sequence,o=n.map(function(e){return e.sequence}),o="".concat(f," complete:").concat(t," sequenceList:").concat(o),i=(v.l("".concat(p," ").concat(o)),e!==h&&e<g&&2!==t&&d._recoverGroupMsg({groupID:_,localLastMessageSequence:e,remoteLastMessageSequence:g}),m.setMessage(o).end(),d.get(7));1<n.length&&n.sort(function(e,t){return e.sequence-t.sequence});for(var a=!1,s=0,r=n.length;s<r;s++)if(n[s].from===R.CONV_SYSTEM){a=!0;break}if(a)for(var c=0,l=n.length;c<l;c++){var u=n[c];u.from!==R.CONV_SYSTEM?i.onNewMessage({dataList:[u],isInstantMessage:!1,updateUnreadCount:!1}):i.onNewGroupTips({event:u.event,dataList:[u]})}else i.onNewMessage({dataList:n,isInstantMessage:!1,updateUnreadCount:!1})}}).catch(function(e){m.setError(e).end(),v.w("".concat(p," failed. error:"),e)})}},{key:"_getGroupNotice",value:function(e){var t=e.length;if(v.l("".concat(this._n,"._getGroupNotice length:").concat(t)),0!==t){var n=this.get(7);if(t<=10)n.getNotice(e);else{var o=Math.floor(t/10);5<=o&&(o=5);for(var i=0;i<=o;i++)n.getNotice(e.slice(10*i,10*(i+1)))}}}},{key:"_getGroupRoamingMsg",value:function(e){var t=e.groupID,e=e.sequence;return this.req({P:I.GET_GRP_ROAMING_MSG,data:{groupID:t,count:this.PULL_LIMIT_COUNT,sequence:e+this.PULL_LIMIT_COUNT-1}})}},{key:"_recoverC2CMsg",value:function(e){var o=this,i="".concat(this._n,".").concat("_recoverC2CMsg"),a=(v.l("".concat(i," options:"),e),e.conversationID),t=e.localLastMessageTime,s=e.remoteLastMessageTime,r=JSON.stringify(e),c=new M("_recoverC2CMsg");return c.setMessage(r),this._getC2CRoamingMsg({conversationID:a,time:t}).then(function(e){var e=e.data,t=e.complete,e=e.messageList;if(!A(e)){var n=e.length,n=(o.get(6).onNewMessage({dataList:e,isInstantMessage:!0}),e[n-1].time),e=e.map(function(e){return e.random}),e="".concat(r," complete:").concat(t," randomList:").concat(e);if(v.l("".concat(i," ").concat(e)),c.setMessage(e).end(),n<s&&1!==t)return o._recoverC2CMsg({conversationID:a,localLastMessageTime:n,remoteLastMessageTime:s})}}).catch(function(e){c.setError(e).end(),v.w("".concat(i," failed. error:"),e)})}},{key:"_getC2CRoamingMsg",value:function(e){var t=e.conversationID,e=e.time;return this.req({P:I.GET_C2C_ROAMING_MSG,data:{peerAccount:t.replace(R.CONV_C2C,""),count:this.PULL_LIMIT_COUNT+1,lastMessageTime:e,direction:1}})}},{key:"reset",value:function(){v.l("".concat(this._n,".reset"))}}]),Qr),Xs=(e(Zr,[{key:"addMessageDelay",value:function(e){e=Oe()-e;0<=e&&this._e2eDelayArray.push(e)}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach(function(e){n+=e}),Vt(n/t,1)}},{key:"_calcCountWithLimit",value:function(e){var t=e.e2eDelayArray,n=e.min,o=e.max;return t.filter(function(e){return n<=e&&e<o}).length}},{key:"_calcPercent",value:function(e,t){e=Vt(e/t*100,2);return e=100<e?100:e}},{key:"_checkE2EDelayException",value:function(e,t){var n,o,i,a=e.filter(function(e){return t<e});0<a.length&&(n=a.length,o=Math.min.apply(Math,D(a)),i=Math.max.apply(Math,D(a)),a=this._calcAvg(a,n),50<(e=Vt(n/e.length*100,2))&&new M("messageE2EDelayException").setMessage("count:".concat(n," min:").concat(o," max:").concat(i," avg:").concat(a," percent:").concat(e)).setLevel("warning").end())}},{key:"getStatResult",value:function(){var e=this._e2eDelayArray.length;if(0===e)return null;var t=D(this._e2eDelayArray),n=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),o=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),i=this._calcPercent(n,e),a=this._calcPercent(o,e),s=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:n,percentOfCountLessThan1Second:i,countLessThan3Second:o,percentOfCountLessThan3Second:a,avgDelay:s}}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),Zr),Zs=(e(Xr,[{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;e=Vt(e/t*100,2);return e=100<e?100:e}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach(function(e){n+=e}),parseInt(n/t)}},{key:"_calcMax",value:function(){return Math.max.apply(Math,D(this._rttArray))}},{key:"_calcMin",value:function(){return Math.min.apply(Math,D(this._rttArray))}},{key:"getStatResult",value:function(){var e=this._calcTotalCount(),t=D(this._rttArray);if(0===e)return null;var n=this._calcRTTCount(t),o=this._calcSuccessRateOfRequest(n,e),t=this._calcAvg(t,n);return v.l("".concat(this._n,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(t)),this.reset(),{totalCount:e,rttCount:n,successRateOfRequest:o,avgRTT:t}}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),Xr),Qs=(e(zr,[{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!(A(e)||!this._map.has(e)||(this._map.get(e).totalCount+=1,0))}},{key:"addSuccessCount",value:function(e){return!(A(e)||!this._map.has(e)||(this._map.get(e).successCount+=1,0))}},{key:"addFailedCountOfUserSide",value:function(e){return!(A(e)||!this._map.has(e)||(this._map.get(e).failedCountOfUserSide+=1,0))}},{key:"addCost",value:function(e,t){return!(A(e)||!this._map.has(e)||(this._map.get(e).costArray.push(t),0))}},{key:"addFileSize",value:function(e,t){return!(A(e)||!this._map.has(e)||(this._map.get(e).fileSizeArray.push(t),0))}},{key:"_calcSuccessRateOfBusiness",value:function(e){if(A(e)||!this._map.has(e))return-1;e=this._map.get(e),e=Vt(e.successCount/e.totalCount*100,2);return e=100<e?100:e}},{key:"_calcSuccessRateOfPlatform",value:function(e){if(A(e)||!this._map.has(e))return-1;var t=this._map.get(e),e=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return e=100<(e=Vt(e,2))?100:e}},{key:"_calcTotalCount",value:function(e){return A(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(e){return A(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(e){if(A(e)||!this._map.has(e))return-1;e=this._map.get(e);return e.successCount+e.failedCountOfUserSide}},{key:"_calcAvg",value:function(e){return A(e)||!this._map.has(e)?-1:e===Zn?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:"_calcAvgCost",value:function(e){var t=this._map.get(e).costArray.length;if(0===t)return 0;var n=0;return this._map.get(e).costArray.forEach(function(e){n+=e}),parseInt(n/t)}},{key:"_calcAvgSpeed",value:function(e){var t=0,n=0;return this._map.get(e).costArray.forEach(function(e){t+=e}),this._map.get(e).fileSizeArray.forEach(function(e){n+=e}),parseInt(1e3*n/t)}},{key:"getStatResult",value:function(e){var t=this._calcTotalCount(e);if(0===t)return null;var n=this._calcSuccessCountOfBusiness(e),o=this._calcSuccessRateOfBusiness(e),i=this._calcSuccessCountOfPlatform(e),a=this._calcSuccessRateOfPlatform(e),s=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:n,successRateOfBusiness:o,successCountOfPlatform:i,successRateOfPlatform:a,avgValue:s}}},{key:"reset",value:function(e){A(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),zr),$s=(e(Jr,[{key:"initMap",value:function(e){var t=this;e.forEach(function(e){t._lastMap.set(e,new Map),t._currentMap.set(e,new Map)})}},{key:"addMessageSequence",value:function(e){var t=e.key,n=e.message;if(A(t)||!this._lastMap.has(t)||!this._currentMap.has(t))return!1;var o,i,a=n.conversationID,n=n.sequence,a=a.replace(R.CONV_GROUP,"");return 0!==this._lastMap.get(t).size&&this._lastMap.get(t).has(a)?(i=(o=this._lastMap.get(t).get(a)).length-1,n>o[0]&&n<o[i]?(o.push(n),o.sort(),this._lastMap.get(t).set(a,o)):this._addCurrentMap(e)):this._addCurrentMap(e),!0}},{key:"_addCurrentMap",value:function(e){var t=e.key,e=e.message,n=e.conversationID,e=e.sequence,n=n.replace(R.CONV_GROUP,"");this._currentMap.get(t).has(n)||this._currentMap.get(t).set(n,[]),this._currentMap.get(t).get(n).push(e)}},{key:"_copyData",value:function(e){if(!A(e)){this._lastMap.set(e,new Map);var t,n=this._lastMap.get(e),o=N(this._currentMap.get(e));try{for(o.s();!(t=o.n()).done;){var i=m(t.value,2),a=i[0],s=i[1];n.set(a,s)}}catch(e){o.e(e)}finally{o.f()}n=null,this._currentMap.set(e,new Map)}}},{key:"getStatResult",value:function(e){if(A(this._currentMap.get(e))||A(this._lastMap.get(e)))return null;if(0===this._lastMap.get(e).size)return this._copyData(e),null;var o=0,i=0;if(this._lastMap.get(e).forEach(function(e,t){var e=D(e.values()),n=e.length,e=e[n-1]-e[0]+1;o+=e,i+=n}),0===o)return null;var t=Vt(i/o*100,2);return 100<t&&(t=100),this._copyData(e),{totalCount:o,successCountOfMessageReceived:i,successRateOfMessageReceived:t}}},{key:"reset",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),Jr),er=(t(jr,Fn),Bs=f(jr),e(jr,[{key:"_onLoginSuccess",value:function(){var t=this,e=(this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems),this.get(13)),n=e.getItem(this.TAG,!1);!Je(n)&&it(n.forEach)&&(v.l("".concat(this._n,"._onLoginSuccess. logs count:").concat(n.length)),n.forEach(function(e){t._statInfoArr.push(e)}),e.removeItem(this.TAG,!1))}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),n=this.getCloudConfig("q_rpt_tinyid_wl");A(e)||(this.REPORT_INTERVAL=Number(e)),A(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map(function(e){return Number(e)})),A(n)||(this.REPORT_TINYID_WHITELIST=n.split(","))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}},{key:"addRequestCount",value:function(){this._avgRTT.addRequestCount()}},{key:"addRTT",value:function(e){this._avgRTT.addRTT(e)}},{key:"addMessageDelay",value:function(e){this._avgE2EDelay.addMessageDelay(e)}},{key:"addTotalCount",value:function(e){this._rateMessageSent.addTotalCount(e)||v.w("".concat(this._n,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||v.w("".concat(this._n,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||v.w("".concat(this._n,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,t){this._rateMessageSent.addCost(e,t)||v.w("".concat(this._n,".addCost invalid key or cost:"),e,t)}},{key:"addFileSize",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||v.w("".concat(this._n,".addFileSize invalid key or size:"),e,t)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||v.w("".concat(this._n,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var t={},n=oo[this.get(15).getNetworkType()],n=(A(n)&&(n=8),{qualityType:to[e],timestamp:Pe(),networkType:n,extension:""});switch(e){case Yn:t=this._avgRTT.getStatResult();break;case Wn:t=this._avgE2EDelay.getStatResult();break;case jn:case Jn:case zn:case Xn:case Zn:t=this._rateMessageSent.getStatResult(e);break;case Qn:case $n:case eo:t=this._rateMessageReceived.getStatResult(e)}return null===t?null:y(y({},n),t)}},{key:"_report",value:function(e){var t=this,n=[],o=null,e=(A(e)?this._qualityItems.forEach(function(e){null!==(o=t._getQualityItem(e))&&(o.reportIndex=t.reportIndex,o.wholePeriod=t.wholePeriod,n.push(o))}):null!==(o=this._getQualityItem(e))&&(o.reportIndex=this.reportIndex,o.wholePeriod=this.wholePeriod,n.push(o)),v.d("".concat(this._n,"._report"),n),0<this._statInfoArr.length&&(n=n.concat(this._statInfoArr),this._statInfoArr=[]),this.get(12)),i=e.getSDKAppID(),e=e.getTinyID();0<(n=Ht(this.REPORT_SDKAPPID_BLACKLIST,i)&&!Bt(this.REPORT_TINYID_WHITELIST,e)?[]:n).length&&this._doReport(n)}},{key:"_doReport",value:function(t){var n=this,e={header:pa(this),quality:t};this.req({P:I.SSO_STAT,data:y({},e)}).then(function(){n.reportIndex++,n.wholePeriod=!1}).catch(function(e){v.w("".concat(n._n,"._doReport failed. error:"),e),n._statInfoArr=n._statInfoArr.concat(t),n._flushAtOnce()})}},{key:"_flushAtOnce",value:function(){var e=this.get(13),t=e.getItem(this.TAG,!1),n=this._statInfoArr,o="".concat(this._n,"._flushAtOnce");Je(t)?(v.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)):(10<(n=n.concat(t)).length&&(n=n.slice(0,10)),v.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)),this._statInfoArr=[]}},{key:"reset",value:function(){v.l("".concat(this._n,".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()}}]),jr),tr=e(function e(t){d(this,e),Je(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",this.time=t.time||0,this.source=t.source||"",this.wording=t.wording||"",this.type=t.type||"")}),nr=(e(Wr,[{key:"getLocalApplicationList",value:function(){return{friendApplicationList:D(this._map.values()),unreadCount:this._unreadCount}}},{key:"_onApplicationListUpdated",value:function(){this._snsM.emitOEvt(G.FRIEND_APPLICATION_LIST_UPDATED,{friendApplicationList:D(this._map.values()),unreadCount:this._unreadCount})}},{key:"onApplicationRead",value:function(){this._unreadCount=0,this._onApplicationListUpdated()}},{key:"onApplicationAdded",value:function(e,t){var n,o,i=this;Je(e)||(n="",n=t===this._snsM.getMyUserID()?R.SNS_APPLICATION_SENT_BY_ME:R.SNS_APPLICATION_SENT_TO_ME,o=!1,e.forEach(function(e){var t="".concat(e.userID,"_").concat(n);n!==R.SNS_APPLICATION_SENT_TO_ME||i._map.has(t)||(i._unreadCount+=1),i._map.set(t,new tr(y(y({},e),{},{type:n}))),o=!0}),o&&this._onApplicationListUpdated())}},{key:"onApplicationDeleted",value:function(e){Je(e)||(this._startTime=0,this._currentSeq=0,this.getApplicationList())}},{key:"getApplicationList",value:function(){var a=this,s="".concat(this._n,".").concat("getApplicationList"),r=new M("getApplicationList");return this._snsM.req({P:I.GET_FD_APPLICATION_LIST,data:{applicationType:R.SNS_APPLICATION_TYPE_BOTH,fromAccount:this._snsM.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSeq}}).then(function(e){var e=e.data,t=e.resultList,n=e.unreadCount,o=e.startTime,e=e.currentSequence,i=(a._startTime=o,a._currentSeq=e,a._unreadCount=n,nt(t)?t.length:0),i="applicationCount:".concat(i," unreadCount:").concat(n," startTime:").concat(o," currentSequence:").concat(e);r.setMessage(i).end(),v.i("".concat(s," ok. ").concat(i)),a._map.clear(),nt(t)&&t.forEach(function(e){var t=e.userID,n=e.type,e=new tr(e);a._map.set("".concat(t,"_").concat(n),e)}),a._onApplicationListUpdated()}).catch(function(e){return r.setError(e).end(),v.w("".concat(s," failed. error:"),e),C(e)})}},{key:"deleteApplication",value:function(e){var i="".concat(this._n,".").concat("deleteApplication"),a=e.userID,s=e.type;if(s&&(s===R.SNS_APPLICATION_SENT_BY_ME||s===R.SNS_APPLICATION_SENT_TO_ME)||(s=R.SNS_APPLICATION_SENT_TO_ME),!this._map.has("".concat(a,"_").concat(s)))return C({code:T.FRIEND_APPLICATION_NOT_EXIST});var r=new M("deleteApplication");return r.setMessage("userID:".concat(a," type:").concat(s)),this._snsM.req({P:I.DEL_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),userIDList:[a],type:s}}).then(function(e){var e=e.data.resultList,t=e[0],n=t.to,o=t.resultCode,t=t.resultInfo;return r.setMoreMessage("resultList:".concat(JSON.stringify(e))).end(),v.i("".concat(i," ok. userID:").concat(a," type:").concat(s)),0===o?Sn():C({userID:n,code:o,message:t})}).catch(function(e){return r.setError(e).end(),v.w("".concat(i," failed. error:"),e),C(e)})}},{key:"acceptApplication",value:function(e){var n="".concat(this._n,".").concat("acceptApplication"),o=e.userID,t=e.remark,i=e.tag,a=e.type,s=(a&&(a===R.SNS_APPLICATION_AGREE||a===R.SNS_APPLICATION_AGREE_AND_ADD)||(a=R.SNS_APPLICATION_AGREE_AND_ADD),new M("acceptApplication"));return s.setMessage("userID:".concat(o," type:").concat(a)),this._snsM.req({P:I.RESPOND_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:o,remark:t,tag:i,action:a}]}}).then(function(e){s.end();var e=e.data.resultList[0],t=e.resultCode,e=e.resultInfo;if(0!==t)return C({code:t,message:e});v.i("".concat(n," ok. userID:").concat(o," type:").concat(a))}).catch(function(e){return s.setError(e).end(),v.w("".concat(n," failed. error:"),e),C(e)})}},{key:"refuseApplication",value:function(e){var n="".concat(this._n,".").concat("refuseApplication"),o=e.userID,i=new M("refuseApplication");return i.setMessage("userID:".concat(o)),this._snsM.req({P:I.RESPOND_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:o,action:"Response_Action_Reject"}]}}).then(function(e){i.end();var e=e.data.resultList[0],t=e.resultCode,e=e.resultInfo;if(0!==t)return C({code:t,message:e});v.i("".concat(n," ok. userID:").concat(o))}).catch(function(e){return i.setError(e).end(),v.w("".concat(n," failed. error:"),e),C(e)})}},{key:"setApplicationRead",value:function(){var t=this,n="".concat(this._n,".").concat("setApplicationRead"),o=new M("setApplicationRead");return this._snsM.req({P:I.REPORT_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),latestTimeStamp:Vt(Pe()/1e3,0)}}).then(function(e){o.end(),v.i("".concat(n," ok")),t._unreadCount=0}).catch(function(e){return o.setError(e).end(),v.w("".concat(n," failed. error:"),e),C(e)})}},{key:"reset",value:function(){this._maxLimited=100,this._currentSeq=0,this._unreadCount=0,this._map.clear()}}]),Wr),or=(e(Yr,[{key:"validate",value:function(e){var t,n=!0,o="";if(Je(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var i=e.profileCustomField.length,a=null,s=0;s<i;s++){if(a=e.profileCustomField[s],!ft(a.key)||-1===a.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!ft(a.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if("profileCustomField"===t)continue;if(Je(e[t])&&!ft(e[t])&&!Qe(e[t])){o="key:"+t+", invalid value:"+e[t],n=!1;continue}switch(t){case"nick":ft(e[t])||(n=!(o="nick must be a string")),500<ut(e[t])&&(o="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(ut(e[t])," bytes"),n=!1);break;case"gender":pt(Ve,e.gender)||(o="key:gender, invalid value:"+e.gender,n=!1);break;case"birthday":Qe(e.birthday)||(n=!(o="birthday must be a number"));break;case"location":ft(e.location)||(n=!(o="location must be a string"));break;case"selfSignature":ft(e.selfSignature)||(n=!(o="selfSignature must be a string"));break;case"allowType":pt(Be,e.allowType)||(o="key:allowType, invalid value:"+e.allowType,n=!1);break;case"language":Qe(e.language)||(n=!(o="language must be a number"));break;case"avatar":ft(e.avatar)||(n=!(o="avatar must be a string"));break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n=!(o="messageSettings must be 0 or 1"));break;case"adminForbidType":pt(He,e.adminForbidType)||(o="key:adminForbidType, invalid value:"+e.adminForbidType,n=!1);break;case"level":Qe(e.level)||(n=!(o="level must be a number"));break;case"role":Qe(e.role)||(n=!(o="role must be a number"));break;default:o="unknown key:"+t+" "+e[t],n=!1}}return{valid:n,tips:o}}},{key:"update",value:function(e){var t,n="",o=[];this.friendCustomField.forEach(function(e){o.push(e.key)});for(var i=0,a=e.length;i<a;i++)if(n=e[i].tag,t=e[i].value,-1<n.indexOf("Tag_SNS_Custom"))-1<o.indexOf(n)?this.friendCustomField.forEach(function(e){e.key===n&&(e.value=t)}):this.friendCustomField.push({key:n,value:t});else if(-1<n.indexOf("Tag_Profile_Custom")){var s=!1;this.profile.profileCustomField.forEach(function(e){e.key===n&&(e.value=t,s=!0)}),s||this.profile.profileCustomField.push({key:n,value:t})}else switch(n){case qe.NICK:this.profile.nick=t;break;case qe.GENDER:this.profile.gender=t;break;case qe.BIRTHDAY:this.profile.birthday=t;break;case qe.LOCATION:this.profile.location=t;break;case qe.SELFSIGNATURE:this.profile.selfSignature=t;break;case qe.ALLOWTYPE:this.profile.allowType=t;break;case qe.LANGUAGE:this.profile.language=t;break;case qe.AVATAR:this.profile.avatar=t;break;case qe.MESSAGESETTINGS:this.profile.messageSettings=t;break;case qe.ADMINFORBIDTYPE:this.profile.adminForbidType=t;break;case qe.LEVEL:this.profile.level=t;break;case qe.ROLE:this.profile.role=t;break;case xe.REMARK:this.remark=t;break;case xe.ADDTIME:this.addTime=t;break;case xe.GROUP:this.groupList=JSON.parse(JSON.stringify(t));break;case xe.ADDSOURCE:this.source=t;break;case xe.ADDWORDING:break;default:v.d("snsProfileItem unkown tag->",e[i].tag)}this.timestamp=Date.now(),o.length=0}},{key:"updateProfile",value:function(e){this.profile=JSON.parse(JSON.stringify(e)),this.timestamp=Date.now()}},{key:"addToGroupList",value:function(e){-1===this.groupList.indexOf(e)&&(this.groupList.push(e),this.count=this.groupList.length)}},{key:"removeFromGroupList",value:function(e){e=this.groupList.indexOf(e);-1<e&&(this.groupList.splice(e,1),this.count=this.groupList.length)}}]),Yr),ir=(e(Kr,[{key:"getLocalFriendList",value:function(){return D(this._map.values())}},{key:"getFriendRemark",value:function(e){return this._map.has(e)?this._map.get(e).remark:""}},{key:"onFriendProfileModified",value:function(e){var o,i=this,e=e.dataList;Je(e)||(o=this._snsM.get(11),e.forEach(function(e){var t,n=e.userID,e=e.profileList;i.isMyFriend(n)&&(v.l("".concat(i._n,".onFriendProfileModified. friend account:").concat(n,", profileList:").concat(JSON.stringify(e))),(t=i._map.get(n)).update(e),o.modifyMessageSentByPeer({conversationID:"".concat(R.CONV_C2C).concat(n),latestNick:t.profile.nick,latestAvatar:t.profile.avatar}))}),this._onFriendListUpdated())}},{key:"onFriendAdded",value:function(t){var n=this;0!==t.length&&(v.l("".concat(this._n,".onFriendAdded userIDList:").concat(t)),t.forEach(function(e){n._map.set(e,new or(e))}),this.getFriendProfile({userIDList:t}).then(function(e){t.forEach(function(e){var t=n._map.get(e);0<t.groupList.length&&n._snsM.updateWhenFriendAdded({nameList:t.groupList,userID:e})}),n._onFriendListUpdated()}))}},{key:"onFriendDeleted",value:function(e){var n=this;0!==e.length&&(v.l("".concat(this._n,".onFriendDeleted userIDList:").concat(e)),e.forEach(function(e){var t=n._map.get(e);0<t.groupList.length&&n._snsM.updateWhenFriendDeleted({nameList:t.groupList,userID:e}),n._map.delete(e)}),this._onFriendListUpdated())}},{key:"_onFriendListUpdated",value:function(){this._snsM.emitOEvt(G.FRIEND_LIST_UPDATED),this._snsM.get(11).checkAndPatchRemark()}},{key:"getFriendProfile",value:function(e){var a=this,t="".concat(this._n,".").concat("getFriendProfile"),e=e.userIDList,s=[],r=[],n=[];if(e.forEach(function(e){var t;a._map.has(e)?(t=a._map.get(e),Date.now()-t.timestamp<a._expirationTime?r.push(t):n.push(e)):s.push({userID:e,code:T.NOT_MY_FRIEND,message:a._snsM.getErrMsg(T.NOT_MY_FRIEND)})}),0===n.length)return v.i("".concat(t," newUserIDList is empty")),kn({friendList:r,failureUserIDList:s});var o=new M("getFriendProfile");return o.setMessage("userIDList:".concat(n)),v.i("".concat(t," userIDList:").concat(n)),this._snsM.req({P:I.GET_FD_PROFILE,data:{fromAccount:this._snsM.getMyUserID(),userIDList:n}}).then(function(e){return o.end(),v.i("".concat(t," ok")),e.data.resultList.forEach(function(e){var t,n=e.to,o=e.resultCode,i=e.resultInfo,e=e.tagValueList;A(o)||0===o?(a._map.has(n)?(t=a._map.get(n)).update(e):(t=new or(n,e),a._map.set(n,t)),r.push(t)):s.push({userID:n,code:o,message:i})}),Sn({friendList:r,failureUserIDList:s})}).catch(function(e){return o.setError(e).end(),v.w("".concat(t," failed. error:"),e),C(e)})}},{key:"isMyFriend",value:function(e){return this._map.has(e)}},{key:"pagingGetFriendList",value:function(){var s=this,r="".concat(this._n,".").concat("getFriendList"),c=new M("getFriendList"),u=Date.now();this._snsM.req({P:I.GET_FD_LIST,data:{fromAccount:this._snsM.getMyUserID(),startIndex:this._startIdx,standardSequence:this._standardSeq,customSequence:this._customSeq}}).then(function(e){var e=e.data,t=e.friendCount,n=e.resultList,o=e.nextStartIndex,i=e.standardSequence,a=e.customSequence,e=e.completeFlag,t=(s._startIdx=o,s._standardSeq=i,s._customSeq=a,"friendCount:".concat(t," nextStartIndex:").concat(o," standardSequence:").concat(i," ")+"customSequence:".concat(a," completeFlag:").concat(e," cost:").concat(Qt(u)));c.setMessage(t).end(),v.i("".concat(r," ok."),t),Je(n)||n.forEach(function(e){var t=e.to,e=e.tagValueList;s._map.set(t,new or(t,e))}),0===e?s.pagingGetFriendList():(s._snsM.emitOEvt(G.FRIEND_LIST_UPDATED),s._pagingGetFriendProfile())}).catch(function(e){return c.setError(e).end(),v.w("".concat(r," failed. error:"),e),C(e)})}},{key:"_pagingGetFriendProfile",value:function(){var n=this,e=D(this._map.keys()),t=this._snsM.get(4),o=e.length,i=o<=100?1:Math.ceil(o/100);v.l("".concat(this._n,"._pagingGetFriendProfile friendCount:").concat(o," pageCount:").concat(i));for(var a=0;a<i;a++)t.getUserProfile({userIDList:e.slice(100*a,100*(a+1))}).then(function(e){e.data.forEach(function(e){var t=n._map.get(e.userID);t&&t.updateProfile(e)}),n._onFriendListUpdated()})}},{key:"addFriend",value:function(e){var o=this,i="".concat(this._n,".").concat("addFriend");if(this._map.has(e.to))return C({code:T.ALREADY_MY_FRIEND});if(e.wording&&!1===this._snsM.filterProfanity("wording",e))return C({code:T.PROFANITY_FOUND});var t=e.to,n=e.source,a=e.type,s=e.wording,r=e.remark,e=e.groupName,c=a,u=(c&&(c===R.SNS_ADD_TYPE_SINGLE||c===R.SNS_ADD_TYPE_BOTH)||(c=R.SNS_ADD_TYPE_BOTH),new M("addFriend"));return u.setMessage("to:".concat(t," source:").concat(n," type:").concat(c)),this._snsM.req({P:I.ADD_FD,data:{fromAccount:this._snsM.getMyUserID(),addFriendItem:[{to:t,source:n,wording:s,remark:r,groupName:e}],type:c}}).then(function(e){var e=e.data.resultList,e=(u.setMoreMessage("resultList:".concat(JSON.stringify(e))).end(),e[0]),t=e.to,n=e.resultCode,e=e.resultInfo;return v.i("".concat(i," ok. to:").concat(t," type:").concat(c," code:").concat(n)),A(n)||0===n?Sn({userID:t,code:0}):30539===n?Sn({userID:t,code:n,message:o._snsM.getErrMsg(n)}):C({userID:t,code:n,message:o._snsM.getErrMsg(n)||e})}).catch(function(e){return u.setError(e).end(),v.w("".concat(i," failed. error:"),e),C(e)})}},{key:"deleteFriend",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteFriend"),o=e.userIDList,e=e.type,i=(1e3<o.length&&(v.w("".concat(n," ").concat(zt(1e3))),o.length=1e3),[]),a=[],s=[];if(o.forEach(function(e){t._map.has(e)?s.push(e):i.push({userID:e,code:T.NOT_MY_FRIEND,message:t._snsM.getErrMsg(T.NOT_MY_FRIEND)})}),0===s.length)return kn({successUserIDList:a,failureUserIDList:i});var o=e,r=(o&&(o===R.SNS_DELETE_TYPE_SINGLE||o===R.SNS_DELETE_TYPE_BOTH)||(o=R.SNS_DELETE_TYPE_BOTH),new M("deleteFriend"));return r.setMessage("userIDList:".concat(s," type:").concat(o)),this._snsM.req({P:I.DEL_FD,data:{fromAccount:this._snsM.getMyUserID(),userIDList:s,type:o}}).then(function(e){r.end(),v.i("".concat(n," ok"));e=e.data.resultList;return Je(e)||e.forEach(function(e){var t=e.to,n=e.resultCode,e=e.resultInfo;A(n)||0===n?a.push({userID:t}):i.push({userID:t,code:n,message:e})}),Sn({successUserIDList:a,failureUserIDList:i})}).catch(function(e){return r.setError(e).end(),v.w("".concat(n," error:"),e),C(e)})}},{key:"updateFriend",value:function(e){var o=this,t=e.userID,i=e.remark,a=e.friendCustomField;if(!this._map.has(t))return C({code:T.NOT_MY_FRIEND});var s="".concat(this._n,".").concat("updateFriend"),r=new M("updateFriend"),n=(r.setMessage("userID:".concat(t," remark:").concat(i," friendCustomField:").concat(a)),[]);return A(i)||n.push({tag:xe.REMARK,value:i}),nt(a)&&0<a.length&&a.forEach(function(e){n.push({tag:e.key,value:e.value})}),this._snsM.req({P:I.UPDATE_FD,data:{fromAccount:this._snsM.getMyUserID(),updateItem:[{to:t,snsItem:n}]}}).then(function(e){r.end(),v.i("".concat(s," ok"));var e=e.data.resultList[0],t=e.to,n=e.resultCode,e=e.resultInfo;return A(n)||0===n?((t=o._map.get(t))&&(A(i)||(t.remark=i),nt(a)&&0<a.length&&Tt(t.friendCustomField,a),o._onFriendListUpdated()),Sn(t)):C({code:n,message:e})}).catch(function(e){return r.setError(e).end(),v.w("".concat(s," failed. error:"),e),C(e)})}},{key:"checkFriend",value:function(e){var t="".concat(this._n,".").concat("checkFriend"),n=e.userIDList,o=e.type,s=(o&&(o===R.SNS_CHECK_TYPE_SINGLE||o===R.SNS_CHECK_TYPE_BOTH)||(o=R.SNS_CHECK_TYPE_BOTH),new M("checkFriend"));return s.setMessage("userIDList:".concat(n," type:").concat(o)),this._snsM.req({P:I.CHECK_FD,data:{fromAccount:this._snsM.getMyUserID(),userIDList:n,type:o}}).then(function(e){s.end(),v.i("".concat(t," ok. userIDList:").concat(n," type:").concat(o));var i=[],a=[],e=e.data.resultList;return nt(e)&&e.forEach(function(e){var t=e.to,n=e.relation,o=e.resultCode,e=e.resultInfo;A(o)||0===o?i.push({userID:t,code:0,relation:n}):a.push({userID:t,code:o,message:e})}),Sn({successUserIDList:i,failureUserIDList:a})}).catch(function(e){return s.setError(e).end(),v.w("".concat(t," failed. error:"),e),C(e)})}},{key:"onAddedToFriendGroup",value:function(e){var t=this,n=e.name,e=e.userIDList;v.l("".concat(this._n,".onAddedToFriendGroup groupName:").concat(n," userIDList:").concat(e)),n&&!Je(e)&&e.forEach(function(e){t._map.has(e)&&t._map.get(e).addToGroupList(n)})}},{key:"onRemovedFromFriendGroup",value:function(e){var t=this,n=e.name,e=e.userIDList;v.l("".concat(this._n,".onRemovedFromFriendGroup groupName:").concat(n," userIDList:").concat(e)),n&&!Je(e)&&e.forEach(function(e){t._map.has(e)&&t._map.get(e).removeFromGroupList(n)})}},{key:"reset",value:function(){this._map.clear(),this._startIdx=0,this._standardSeq=0,this._customSeq=0}}]),Kr),ar=(e(Br,[{key:"addToUserIDList",value:function(e){-1===this.userIDList.indexOf(e)&&(this.userIDList.push(e),this.count=this.userIDList.length)}},{key:"removeFromUserIDList",value:function(e){e=this.userIDList.indexOf(e);-1<e&&(this.userIDList.splice(e,1),this.count=this.userIDList.length)}}]),Br),sr=(e(Hr,[{key:"getLocalGroupList",value:function(){return D(this._map.values())}},{key:"_onGroupListUpdated",value:function(){var e=D(this._map.values());this._snsM.emitOEvt(G.FRIEND_GROUP_LIST_UPDATED,e)}},{key:"getGroupList",value:function(){var n=this,t="".concat(this._n,".").concat("getGroupList"),o=new M("getGroupList");return this._snsM.req({P:I.GET_FD_GRP_LIST,data:{fromAccount:this._snsM.getMyUserID()}}).then(function(e){o.end();e=e.data.resultList;Je(e)?v.i("".concat(t," ok. count:0")):(v.i("".concat(t," ok. count:").concat(e.length)),n._map.clear(),e.forEach(function(e){var t=new ar(e);n._map.set(e.name,t)}),n._onGroupListUpdated())}).catch(function(e){return o.setError(e).end(),v.w("".concat(t," error:"),e),C(e)})}},{key:"createGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("createGroup"),o=e.name,e=e.userIDList;if(this._map.has(o))return C({code:T.FRIEND_GRP_EXISTED});var s="name:".concat(o," userIDList:").concat(e),r=new M("createGroup");return r.setMessage(s),this._snsM.req({P:I.CREATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),groupName:[o],userIDList:nt(e)?e:void 0}}).then(function(e){r.end(),v.l("".concat(n," ok. ").concat(s));var e=e.data.resultList,i=[],a=[],e=(e&&e.forEach(function(e){var t=e.to,n=e.resultCode,o=e.resultInfo;A(n)||0===n?i.push(t):(t={userID:e.to,code:n,message:o},a.push(t))}),new ar({name:o,userIDList:i}));return t._map.set(o,e),t._snsM.onAddedToFriendGroup({name:o,userIDList:i}),t._onGroupListUpdated(),Sn({friendGroup:e,failureUserIDList:a})}).catch(function(e){return r.setError(e).end(),v.w("".concat(n," failed. error:"),e),C(e)})}},{key:"deleteGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("deleteGroup"),i=e.name;if(!this._map.has(i))return this._onGroupNotExist();var a="name:".concat(i),s=new M("deleteGroup");return s.setMessage(a),this._snsM.req({P:I.DEL_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),nameList:[i]}}).then(function(e){s.end(),v.l("".concat(o," ok. ").concat(a));var t=n._map.get(i);return t&&(n._snsM.onRemovedFromFriendGroup({name:i,userIDList:t.userIDList}),n._map.delete(i),t.userIDList.length=0),n._onGroupListUpdated(),Sn(t)}).catch(function(e){return s.setError(e).end(),v.w("".concat(o," failed. error:"),e),C(e)})}},{key:"renameGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("renameGroup"),o=e.oldName,i=e.newName;if(!this._map.has(o))return this._onGroupNotExist();var a="oldName:".concat(o," newName:").concat(i),s=new M("renameGroup");return s.setMessage(a),this._snsM.req({P:I.UPDATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),oldName:o,newName:i}}).then(function(){var e;return s.end(),v.l("".concat(n," ok. ").concat(a)),t._map.has(o)?((e=t._map.get(o)).name=i,t._map.delete(o),t._map.set(i,e),t._snsM.onRemovedFromFriendGroup({name:o,userIDList:e.userIDList}),t._snsM.onAddedToFriendGroup({name:i,userIDList:e.userIDList}),t._onGroupListUpdated(),Sn(e)):Sn()}).catch(function(e){return s.setError(e).end(),v.w("".concat(n," failed. error:"),e),C(e)})}},{key:"addToGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("addToGroup"),o=e.name,e=e.userIDList;if(!this._map.has(o))return this._onGroupNotExist();var i="name:".concat(o," userIDList:").concat(e),a=new M("addToGroup");return a.setMessage(i),this._snsM.req({P:I.UPDATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),oldName:o,updateGroupItem:e.filter(function(e){return t._snsM.isMyFriend(e)}).map(function(e){return{to:e,updateType:"Update_Type_Add"}})}}).then(function(e){return a.end(),v.l("".concat(n," ok. ").concat(i)),t._onGroupUpdated(o,e)}).catch(function(e){return a.setError(e).end(),v.w("".concat(n," failed. error:"),e),C(e)})}},{key:"removeFromGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("removeFromGroup"),o=e.name,e=e.userIDList;if(!this._map.has(o))return this._onGroupNotExist();var i="name:".concat(o," userIDList:").concat(e),a=new M("removeFromGroup");return a.setMessage(i),this._snsM.req({P:I.UPDATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),oldName:o,updateGroupItem:e.filter(function(e){return t._snsM.isMyFriend(e)}).map(function(e){return{to:e,updateType:"Update_Type_Delete"}})}}).then(function(e){return a.end(),v.l("".concat(n," ok. ").concat(i)),t._onGroupUpdated(o,e)}).catch(function(e){return a.setError(e).end(),v.w("".concat(n," failed. error:"),e),C(e)})}},{key:"_onGroupUpdated",value:function(e,t){var t=t.data.resultList,a=this._map.get(e),s=[],r=[],c=[];return nt(t)&&t.forEach(function(e){var t=e.to,n=e.resultCode,o=e.resultInfo,i=e.type;0===n?"Update_Type_Add"===i?a&&(a.addToUserIDList(t),r.push(t)):"Update_Type_Delete"===i&&a&&(a.removeFromUserIDList(t),c.push(t)):s.push({to:e.to,code:n,message:o})}),v.l("".concat(this._n,"._onGroupUpdated name:").concat(e," userIDList:").concat(a.userIDList)),0<r.length&&this._snsM.onAddedToFriendGroup({name:e,userIDList:r}),0<c.length&&this._snsM.onRemovedFromFriendGroup({name:e,userIDList:c}),Sn({friendGroup:a,failureUserIDList:s})}},{key:"updateWhenFriendAdded",value:function(e){var t=this,n=e.nameList,o=e.userID;v.l("".concat(this._n,".updateWhenFriendAdded userID:").concat(o," nameList:").concat(n)),Je(n)||n.forEach(function(e){t._map.has(e)&&t._map.get(e).addToUserIDList(o)})}},{key:"updateWhenFriendDeleted",value:function(e){var t=this,n=e.nameList,o=e.userID;v.l("".concat(this._n,".updateWhenFriendDeleted userID:").concat(o," nameList:").concat(n)),Je(n)||n.forEach(function(e){t._map.has(e)&&t._map.get(e).removeFromUserIDList(o)})}},{key:"_onGroupNotExist",value:function(e){return C({code:T.FRIEND_GRP_NOT_EXIST})}},{key:"reset",value:function(){this._map.clear()}}]),Hr),rr=(t(Vr,Fn),Hs=f(Vr),e(Vr,[{key:"onContextUpdated",value:function(e){this._friendHandler.pagingGetFriendList(),this._friendGroupHandler.getGroupList(),this._friendApplicationHandler.getApplicationList()}},{key:"onRelationChainModified",value:function(e){var n,o,i,a,s,r,c=this,e=e.dataList;Je(e)||(n=[],o=[],i=[],s=!(a=[]),r="",e.forEach(function(e){var t;3!==e.pushType&&4!==e.pushType||!e.from||(r=e.from),e.friendAddAccount&&(n.push.apply(n,D(e.friendAddAccount)),a.push.apply(a,D(e.friendAddAccount))),e.friendDelAccount&&o.push.apply(o,D(e.friendDelAccount)),e.friendApplicationAdded&&i.push.apply(i,D(e.friendApplicationAdded)),e.friendApplicationDeletedUserIDList&&a.push.apply(a,D(e.friendApplicationDeletedUserIDList)),e.reportTime&&7===e.pushType&&(s=!0),e.friendUpInfo&&(t={dataList:[]},e.friendUpInfo.forEach(function(e){t.dataList.push({userID:e.friendAccount,profileList:D(e.sns)})}),c.onFriendProfileModified(t))}),s&&this._friendApplicationHandler.onApplicationRead(),this._friendApplicationHandler.onApplicationAdded(i,r),this._friendApplicationHandler.onApplicationDeleted(a),this._friendHandler.onFriendAdded(n),this._friendHandler.onFriendDeleted(o))}},{key:"isMyFriend",value:function(e){return this._friendHandler.isMyFriend(e)}},{key:"filterProfanity",value:function(e,t){var n=this.get(29);if(!n)return!0;var n=n.filterText(t[e],"sns"),o=n.isAllowedToSend,n=n.modifiedText;return!0===o&&(t[e]=n,!0)}},{key:"onFriendProfileModified",value:function(e){this._friendHandler.onFriendProfileModified(e)}},{key:"getLocalFriendList",value:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=this._friendHandler.getLocalFriendList();return e?kn(t):t}},{key:"getFriendRemark",value:function(e){return this._friendHandler.getFriendRemark(e)}},{key:"getFriendList",value:function(){return this._friendHandler.pagingGetFriendList()}},{key:"addFriend",value:function(e){return this._friendHandler.addFriend(e)}},{key:"deleteFriend",value:function(e){return this._friendHandler.deleteFriend(e)}},{key:"checkFriend",value:function(e){return this._friendHandler.checkFriend(e)}},{key:"getFriendProfile",value:function(e){return this._friendHandler.getFriendProfile(e)}},{key:"updateFriend",value:function(e){return this._friendHandler.updateFriend(e)}},{key:"onAddedToFriendGroup",value:function(e){this._friendHandler.onAddedToFriendGroup(e)}},{key:"onRemovedFromFriendGroup",value:function(e){this._friendHandler.onRemovedFromFriendGroup(e)}},{key:"getLocalFriendApplicationList",value:function(){var e=this._friendApplicationHandler.getLocalApplicationList();return kn(e)}},{key:"deleteFriendApplication",value:function(e){return this._friendApplicationHandler.deleteApplication(e)}},{key:"refuseFriendApplication",value:function(e){return this._friendApplicationHandler.refuseApplication(e)}},{key:"acceptFriendApplication",value:function(e){return this._friendApplicationHandler.acceptApplication(e)}},{key:"setFriendApplicationRead",value:function(e){return this._friendApplicationHandler.setApplicationRead(e)}},{key:"getLocalFriendGroupList",value:function(){var e=this._friendGroupHandler.getLocalGroupList();return kn(e)}},{key:"createFriendGroup",value:function(e){return this._friendGroupHandler.createGroup(e)}},{key:"deleteFriendGroup",value:function(e){return this._friendGroupHandler.deleteGroup(e)}},{key:"addToFriendGroup",value:function(e){return this._friendGroupHandler.addToGroup(e)}},{key:"removeFromFriendGroup",value:function(e){return this._friendGroupHandler.removeFromGroup(e)}},{key:"renameFriendGroup",value:function(e){return this._friendGroupHandler.renameGroup(e)}},{key:"updateWhenFriendAdded",value:function(e){this._friendGroupHandler.updateWhenFriendAdded(e)}},{key:"updateWhenFriendDeleted",value:function(e){this._friendGroupHandler.updateWhenFriendDeleted(e)}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}]),Vr),cr=(t(xr,Fn),Vs=f(xr),e(xr,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&ye}},{key:"startWorkerTimer",value:function(){v.l("".concat(this._n,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){v.l("".concat(this._n,".stopWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("stop")}},{key:"_init",value:function(){var e,t;ye&&(e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(""); }, 1000); postMessage(interval); } else if (event.data === "stop") { clearInterval(interval); interval = -1; }};'],{type:"application/javascript; charset=utf-8"})),this._workerTimer=new Worker(e),(t=this)._workerTimer.onmessage=function(e){e.data?(t._timerID=e.data,v.l("".concat(t._n,"._init seed:").concat(t._timerID))):t._m.onCheckTimer()})}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("enable_worker");v.l("".concat(this._n,"._onCloudConfig enableWorker:").concat(e)),A(e)||"1"===e?!this._isWorkerEnabled&&ye&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&ye&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:"terminate",value:function(){v.l("".concat(this._n,".terminate")),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null,this._timerID=-1)}},{key:"getTimerID",value:function(){return this._timerID}},{key:"reset",value:function(){v.l("".concat(this._n,".reset"))}}]),xr),ur=(e(qr,[{key:"isValidPurchaseBits",value:function(e){return e&&"string"==typeof e&&1<=e.length&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){if(this.isValidPurchaseBits(e)){this._featureMap.clear();for(var t,n=e.length-1,o=0;0<=n;n--,o++)t=(o<32?new b(0,Math.pow(2,o)):new b(Math.pow(2,o-32),0)).toString(),"1"===e[n]?this._featureMap.set(t,!0):this._featureMap.set(t,!1)}else v.w("".concat(this._n,".parsePurchaseBits invalid purchasebits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._featureMap.get(e)}},{key:"isFeatureEnabled",value:function(e){for(var t=parseInt(e).toString(2),n=void 0,o=!0,i=t.length-1,a=0;0<=i;i--,a++)if("1"===t.charAt(i)&&(n=(a<32?new b(0,Math.pow(2,a)):new b(Math.pow(2,a-32),0)).toString(),!this._featureMap.get(n))){o=!1;break}return v.l("".concat(this._n,".isFeatureEnabled decimalNumber:").concat(e," key:").concat(n," ret:").concat(o)),kn({enabled:o})}},{key:"isFeatureEnabledForStat",value:function(e){for(var t=parseInt(e).toString(2),n=t.length-1,o=0;0<=n;n--,o++)if("1"===t.charAt(n)){if(i=(o<32?new b(0,Math.pow(2,o)):new b(Math.pow(2,o-32),0)).toString(),!this._featureMap.get(i))break;var i,a="",s=0;i===H.PLUGIN_TRANSLATE?(a="plugin_translate",s=16):i===H.PLUGIN_VOICE_TO_TEXT?(a="plugin_voice_to_text",s=17):i===H.PLUGIN_CS?(a="plugin_cs",s=14):i===H.PLUGIN_PUSH?(a="plugin_push",s=13):i===H.PLUGIN_BOT?(a="plugin_bot",s=15):i===H.MSG_REACTION&&(a="plugin_emoji_reaction",s=18),""!==a&&(i=this._commercialConfigM.get(12).getUIPlatform(),new M(a).setCode(s).setUIPlatform(i).end(),v.l("".concat(this._n,".isFeatureEnabledForStat ").concat(a," code:").concat(s," uiPlatform:").concat(i)))}}},{key:"isCSPluginEnabled",value:function(){var e;this._isCSPluginReported||(e=this._commercialConfigM.get(12).getUIPlatform(),new M("plugin_search").setCode(6).setUIPlatform(e).end(),this._isCSPluginReported=!0)}},{key:"clear",value:function(){this._featureMap.clear(),this._isCSPluginReported=!1}}]),qr),lr=(e(Fr,[{key:"_canFetch",value:function(){return this.get(12).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 t,e,n=this,o=this._canFetch(),i="".concat(this._n,".fetchConfig");v.l("".concat(i," canFetch:").concat(o)),o&&(t=new M("fetchCommercialConfig"),o=this.get(12).getSDKAppID(),e=this.get(20),this._isFetching=!0,e.req({P:I.FETCH_COMMERCIAL_CONFIG,data:{SDKAppID:o}}).then(function(e){t.setMessage("purchaseBits:".concat(e.data.purchaseBits)).end(),v.l("".concat(i," ok.")),n._parseConfig(e.data),n._isFetching=!1}).catch(function(e){t.setError(e).end(),n._isFetching=!1}))}},{key:"onPushedConfig",value:function(e){var t="".concat(this._n,".onPushedConfig data:").concat(JSON.stringify(e));v.l("".concat(t)),new M("pushedCommercialConfig").setMessage("purchaseBits:".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:"_parseConfig",value:function(e){var t="".concat(this._n,"._parseConfig"),n=e.errorCode,o=e.errorMessage,i=e.purchaseBits,a=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(i),this._expiredTime=Date.now()+1e3*a):A(n)?(v.l("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(v.e("".concat(t," errorCode:").concat(n," errorMessage:").concat(o)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"canIUse",value:function(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}},{key:"isFeatureEnabled",value:function(e){return this._purchasedFeatureHandler.isFeatureEnabled(e)}},{key:"isFeatureEnabledForStat",value:function(e){this._purchasedFeatureHandler.isFeatureEnabledForStat(e)}},{key:"isCSPluginEnabled",value:function(){this._purchasedFeatureHandler.isCSPluginEnabled()}},{key:"get",value:function(e){return this._m.get(e)}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),Fr),dr=(t(wr,Fn),xs=f(wr),e(wr,[{key:"registerPlugin",value:function(e){var t,n,o,i,a,s,r,c,l,d,p,_,u;ne?(this._offlinePushPlugin=e["tim-offline-push-plugin"],t=(u=e.offlinePushConfig||{}).huaweiBusinessID,n=u.xiaomiBusinessID,o=u.xiaomiAppID,i=u.xiaomiAppKey,a=u.meizuBusinessID,s=u.meizuAppID,r=u.meizuAppKey,c=u.vivoBusinessID,l=u.oppoBusinessID,d=u.oppoAppKey,p=u.oppoAppSecret,_=u.honorBusinessID,u=u.iosBusinessID,this._androidPushConfig.huaweiPushBussinessId=t,this._androidPushConfig.xiaomiPushBussinessId=n,this._androidPushConfig.xiaomiPushAppId=o,this._androidPushConfig.xiaomiPushAppKey=i,this._androidPushConfig.meizuPushBussinessId=a,this._androidPushConfig.meizuPushAppId=s,this._androidPushConfig.meizuPushAppKey=r,this._androidPushConfig.vivoPushBussinessId=c,this._androidPushConfig.oppoPushBussinessId=l,this._androidPushConfig.oppoPushAppKey=d,this._androidPushConfig.oppoPushAppSecret=p,this._androidPushConfig.honorPushBussinessId=_,new M("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!A(this._offlinePushPlugin))).end(!0),v.l("".concat(this._n,".").concat("registerPlugin"," ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=u,this._setAppShowListener()):this.warn("OfflinePushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:"_getDeviceToken",value:function(){var c,u=this,l="".concat(this._n,".").concat("_getDeviceToken");it(this._offlinePushPlugin.getDeviceToken)?(c="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID),v.l("".concat(l," start. ").concat(c)),new M("_getDeviceToken").setMessage("".concat(c)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,function(e){var t,n,o,i,a=new M("getDeviceTokenRes"),s=e.code,r=e.msg;0===s?(t=(i=e.data).deviceToken,n=i.deviceBrand,o=i.deviceType,i=i.bussinessId,u._deviceToken=t,u._businessID=i||u._iosBusinessID,c="deviceToken:".concat(t,", deviceBrand:").concat(n||o,", businessID:").concat(u._businessID),v.l("".concat(l," ok. ").concat(c)),a.setMessage(c).end(!0),u._setToken()):(a.setMessage("code:".concat(s,", msg:").concat(r)).end(!0),v.e("".concat(l," failed. error:"),e))})):v.e("".concat(l," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return ne&&!A(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var t=this,n="".concat(this._n,".").concat("_setAppShowListener");A(this._offlinePushPlugin)?v.e("".concat(n," offlinePushPlugin is undefined")):it(this._offlinePushPlugin.setAppShowListener)?(new M("_setAppShowListener").end(!0),v.l("".concat(n," start")),this._offlinePushPlugin.setAppShowListener(function(e){e=(e||{}).appShow;new M("setAppShowListenerRes").setMessage("appShow:".concat(e)).end(!0),v.l("".concat(n," ok. appShow:").concat(e)),t._m.isReady()&&(0===e?(t._getConvUnreadCount(),t._onBackground()):1===e&&t._onForeground())})):v.e("".concat(n," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){var e;if(!A(this._offlinePushPlugin)&&it(this._offlinePushPlugin.getDeviceType))return e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType,v.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}},{key:"_setToken",value:function(){var t="".concat(this._n,"._setToken"),e=this.get(12),n=1,o="",i="",a=(Je(this._deviceToken)&&(n=0),this.getUniAppPlatform()),s=this.getDeviceBrand(),r=(a===F.IOS||a===F.IPAD||a===F.MAC?i=this._deviceToken:a===F.ANDROID&&(o=this._deviceToken),new M("offlinePushSetToken")),a="deviceToken:".concat(i||o,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(s,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(n,", platform:").concat(a);return r.setMessage("".concat(a)),v.l("".concat(t," ").concat(a)),this.req({P:I.SET_TOKEN,data:{tokenID:o,pushMsg:n,sdkAppID:e.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:s,deviceToken:i,isWebUniapp:this._isWebUniapp}}).then(function(e){return r.end(),v.l("".concat(t," ok")),e}).catch(function(e){return r.setError(e).end(),v.e("".concat(t," failed. error:"),e),C(e)})}},{key:"_getConvUnreadCount",value:function(){var t=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(11).getLocalConvList().forEach(function(e){e.type===R.CONV_C2C&&(t._c2cUnreadCount+=e.unreadCount),e.type===R.CONV_GROUP&&(t._groupUnreadCount+=e.unreadCount)})}},{key:"_onBackground",value:function(){var t=this,n="".concat(this._n,".").concat("_onBackground"),o=new M("_onBackground");this.req({P:I.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then(function(e){return o.setMessage("c2cUnreadCount: ".concat(t._c2cUnreadCount,", groupUnreadCount: ").concat(t._groupUnreadCount)).end(),v.l("".concat(n," ok")),e}).catch(function(e){o.setError(e).end(),v.e("".concat(n," failed. error:"),e)})}},{key:"_onForeground",value:function(){var t="".concat(this._n,".").concat("_onForeground"),n=new M("_onForeground");this.req({P:I.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then(function(e){return n.end(),v.l("".concat(t," ok")),e}).catch(function(e){n.setError(e).end(),v.e("".concat(t," failed. error:"),e)})}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?F.IOS:"android"===e?F.ANDROID:1002===t?F.IPAD:1001===t?F.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,v.l("".concat(this._n,".reset"))}}]),wr),pr=(t(br,Fn),qs=f(br),e(br,[{key:"registerPlugin",value:function(e){var t,n,o;ne?(t="".concat(this._n,".").concat("registerPlugin"),this._pushPlugin=e["tim-push"],this._getDeviceInfo(),n=(o=e.pushConfig||{}).androidConfig,o=o.iOSConfig,$e(n)&&(this._androidPushConfig=n[this._deviceInfo.packageName]),n=(o||{}).iOSBusinessID,this._iOSBusinessID=n,o=!A(this._pushPlugin),new M("registerPlugin").setMessage(this._pluginName).setMoreMessage("isExisted:".concat(o)).end(!0),v.l("".concat(t," ok. pushConfig:").concat(JSON.stringify(e.pushConfig))),o?(this._setAppShowListener(),this._setPushEventReportListener()):v.e("".concat(t," ").concat(this._pluginName," is undefined"))):this.warn("TIMPushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._reportEventCacheList(),this._getDeviceToken(),this.get(27).isFeatureEnabledForStat(Math.pow(2,41))}},{key:"_reportEventCacheList",value:function(){var a=this,s="".concat(this._n,".").concat("_reportEventCacheList");it(this._pushPlugin.getPushEventCacheList)?(new M("_reportEventCacheList").end(!0),this._pushPlugin.getPushEventCacheList(function(e){var t=e.code,n=e.data.eventList,o=new M("getPushEventCacheListRes");if(o.setCode(t),0!==t)o.setMessage("res:".concat(JSON.stringify(e))).end(!0),v.e("".concat(s," failed. error:").concat(JSON.stringify(e)));else{t=n.length<10?"eventList:".concat(JSON.stringify(n)):"eventList.length:".concat(n.length);v.l("".concat(s," ok. ").concat(t)),o.setMessage(t).end(!0);for(var i=y(y({},e.data),{},{eventList:[]});0<n.length;)i.eventList=n.splice(0,40),a._pushReport(i)}})):v.e("".concat(this._pluginName,".getPushEventCacheList is not a function"))}},{key:"_getDeviceToken",value:function(){var r,c=this,u="".concat(this._n,".").concat("_getDeviceToken");it(this._pushPlugin.getDeviceToken)?(r="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig)," iOSBusinessID:").concat(this._iOSBusinessID),v.l("".concat(u," start. ").concat(r)),new M("_getDeviceToken").setMessage("".concat(r)).end(!0),this._pushPlugin.getDeviceToken(this._androidPushConfig,function(e){var t,n,o,i=e.code,a=e.msg,s=new M("getDeviceTokenRes");if(s.setCode(i),0===i)return t=(i=e.data).deviceToken,n=i.deviceBrand,o=i.deviceType,i=i.bussinessId,c._deviceToken=t,c._businessID=i||c._iOSBusinessID,r="deviceToken:".concat(t," deviceBrand:").concat(n||o," businessID:").concat(c._businessID),v.l("".concat(u," ok. ").concat(r)),s.setMessage(r).end(!0),void c._setToken();s.setMessage(a).end(!0),v.e("".concat(u," failed. error:").concat(JSON.stringify(e)))})):v.e("".concat(this._pluginName,".getDeviceToken is not a function"))}},{key:"_getDeviceInfo",value:function(){var e="".concat(this._n,".").concat("_getDeviceInfo");if(it(this._pushPlugin.getDeviceInfo)){var t=this._pushPlugin.getDeviceInfo(),n=t.code,o=t.data,i=new M("_getDeviceInfo");if(i.setCode(n),0===n)return this._deviceInfo=y(y({},this._deviceInfo),o),this._deviceInfo.pushVersion||(this._deviceInfo.pushVersion="1.0.1"),n="deviceInfo:".concat(JSON.stringify(this._deviceInfo)),v.l("".concat(e," ok. ").concat(n)),void i.setMessage(n).end(!0);i.setMessage("deviceInfoRes:".concat(JSON.stringify(t))).end(!0),v.e("".concat(e," failed. error:").concat(JSON.stringify(t)))}else v.e("".concat(this._pluginName,".getDeviceInfo is not a function"))}},{key:"canIUseTIMPush",value:function(){return ne&&!A(this._pushPlugin)}},{key:"_setAppShowListener",value:function(){var t=this,n="".concat(this._n,".").concat("_setAppShowListener");it(this._pushPlugin.setAppShowListener)?(new M("_setAppShowListener").end(!0),v.l("".concat(n," start")),this._pushPlugin.setAppShowListener(function(e){e=(e||{}).appShow;new M("setAppShowListenerRes").setMessage("appShow:".concat(e)).end(!0),v.l("".concat(n," ok. appShow:").concat(e)),t._m.isReady()&&(0===e?(t._getConvUnreadCount(),t._onBackground()):1===e&&t._onForeground())})):v.e("".concat(this._pluginName,".setAppShowListener is not a function"))}},{key:"_setPushEventReportListener",value:function(){var a=this,s="".concat(this._n,".").concat("_setPushEventReportListener");it(this._pushPlugin.setPushEventReportListener)?(new M("_setPushEventReportListener").end(!0),this._pushPlugin.setPushEventReportListener(function(e){var t=e.code,n=e.data,o=n.eventList,i=new M("setPushEventReportListenerRes");if(i.setCode(t),0===t)return t="eventList:".concat(JSON.stringify(o)),v.l("".concat(s," ok. ").concat(t)),i.setMessage(t).end(!0),void(a._m.isReady()&&nt(o)&&0<o.length&&a._pushReport(n));i.setMessage("res:".concat(JSON.stringify(e))).end(!0),v.e("".concat(s," failed. error:").concat(JSON.stringify(e)))})):v.e("".concat(this._pluginName,".setPushEventReportListener is not a function"))}},{key:"getDeviceBrand",value:function(){var e;if(!A(this._pushPlugin)&&it(this._pushPlugin.getDeviceType))return e=(this._pushPlugin.getDeviceType()||{}).deviceType,v.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}},{key:"_setToken",value:function(){var t="".concat(this._n,".").concat("_setToken"),e=this.get(12),n=1,o="",i="",a=(Je(this._deviceToken)&&(n=0),this.getUniAppPlatform()),s=this.getDeviceBrand(),a=(a===F.IOS||a===F.IPAD||a===F.MAC?i=this._deviceToken:a===F.ANDROID&&(o=this._deviceToken),y({tokenID:o,pushMsg:n,sdkAppID:e.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:s,deviceToken:i,isWebUniapp:this._isWebUniapp},this._deviceInfo)),r=new M("_setToken"),o="data:".concat(JSON.stringify(a));r.setMessage("".concat(o)),v.l("".concat(t," ").concat(o)),this.req({P:I.SET_TOKEN,data:a}).then(function(){r.end(),v.w("".concat(t," ok"))}).catch(function(e){r.setError(e).end(),v.e("".concat(t," failed. error:"),e),C(e)})}},{key:"_getConvUnreadCount",value:function(){var t=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(11).getLocalConvList().forEach(function(e){e.type===R.CONV_C2C&&(t._c2cUnreadCount+=e.unreadCount),e.type===R.CONV_GROUP&&(t._groupUnreadCount+=e.unreadCount)})}},{key:"_onBackground",value:function(){var e=this,t="".concat(this._n,".").concat("_onBackground"),n=new M("_onBackground");this.req({P:I.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then(function(){n.setMessage("c2cUnreadCount:".concat(e._c2cUnreadCount," groupUnreadCount:").concat(e._groupUnreadCount)).end(),v.l("".concat(t," ok"))}).catch(function(e){n.setError(e).end(),v.e("".concat(t," failed. error:"),e)})}},{key:"_onForeground",value:function(){var t="".concat(this._n,".").concat("_onForeground"),n=new M("_onForeground");this.req({P:I.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then(function(){n.end(),v.l("".concat(t," ok"))}).catch(function(e){n.setError(e).end(),v.e("".concat(t," failed. error:"),e)})}},{key:"_pushReport",value:function(e){var t=this,n="".concat(this._n,".").concat("_pushReport"),o=new M("_pushReport");this.req({P:I.PUSH_REPORT,data:{eventList:e.eventList}}).then(function(){o.end(),t._notifyReportSuccess(e)}).catch(function(e){o.setError(e).end(),v.e("".concat(n," failed. error:"),e)})}},{key:"_notifyReportSuccess",value:function(e){!A(this._pushPlugin)&&it(this._pushPlugin.notifyReportSuccess)&&(this._pushPlugin.notifyReportSuccess(e),v.l("".concat(this._n,"._notifyReportSuccess ok")))}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?F.IOS:"android"===e?F.ANDROID:1002===t?F.IPAD:1001===t?F.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,v.l("".concat(this._n,".reset"))}}]),br),_r=(t(Ur,Fn),Fs=f(Ur),e(Ur,[{key:"init",value:function(){var e=this.get(18).getPlugin("tim-profanity-filter-plugin");e&&(this._plugin=new e({logger:v,isArray:nt,isMap:ze,isDevMode:this.isDevMode()}),this._getLexicon())}},{key:"onCheckTimer",value:function(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}},{key:"filterMessage",value:function(e,t){var n=!0;if(!this._plugin||!this._canIUseLexicon)return n;if(t&&t.messageControlInfo&&!0===t.messageControlInfo.excludedFromContentModeration)return n;var t=e.type,o=e.conversationType;if(t!==R.MSG_TEXT&&t!==R.MSG_CUSTOM)return n;var i,a="".concat(this._n,".filterMessage");if(v.l("".concat(a)),t===R.MSG_TEXT){if(o===R.CONV_C2C?i="c2c_text_message":o===R.CONV_GROUP&&(i="group_text_message"),!this._isConfigOn(i))return n;var s=this._plugin.filter(e.payload.text),r=s.type,s=s.modifiedText;1===r?n=!1:2===r&&(e.payload.text=s)}else if(t===R.MSG_CUSTOM){if(o===R.CONV_C2C?i="c2c_custom_message":o===R.CONV_GROUP&&(i="group_custom_message"),!this._isConfigOn(i))return n;r=this._plugin.filter(e.payload.data),s=this._plugin.filter(e.payload.description),t=this._plugin.filter(e.payload.extension);1===r.type||1===s.type||1===t.type?n=!1:(2===r.type&&(e.payload.data=r.modifiedText),2===s.type&&(e.payload.description=s.modifiedText),2===t.type&&(e.payload.extension=t.modifiedText))}return v.l("".concat(a," done. isAllowedToSend:").concat(n)),n}},{key:"filterText",value:function(e,t){var n="".concat(this._n,".filterText"),o={isAllowedToSend:!0,modifiedText:e};if(!this._plugin||!this._canIUseLexicon)return o;if(!this._isConfigOn(t))return o;v.l("".concat(n));t=this._plugin.filter(e),e=t.type,t=t.modifiedText;return 1===e?o.isAllowedToSend=!1:2===e&&(o.modifiedText=t),v.l("".concat(n," done. ret:"),o),o}},{key:"_getLexicon",value:function(){var l=this,d=new M("profanityFilter"),p="".concat(this._n,"._getLexicon");this._isFetching=!0,this.req({P:I.GET_PROFANITY_LIST,data:{startIndex:this._startIndex,version:this._version}}).then(function(e){var e=e.data,t=e.errorInfo,n=e.filterConfig,o=e.lexicon,i=e.strToken,a=e.completeFlag,s=e.nextStartIndex,r=e.version,e=e.expiredTime,c=t.errorCode,u=t.errorMessage;return 0!==c?(l._isFetching=!1,v.w("".concat(p," failed. error:"),t),void d.setCode(c).setMessage(u).end()):(l._onFilterConfig(n),l._getToken(i),1===a?(v.l("".concat(p," done. version:").concat(r," expiredTime:").concat(e)),l._version=r,l._canIUseLexicon=!0,l._isFetching=!1,l._expiredTime=Date.now()+1e3*e,void l._plugin.onLexiconCompleted(o)):(l._startIndex=s,l._plugin.onLexiconSliced(o),void l._getLexicon()))}).catch(function(e){d.setError(e).end(),l._isFetching=!1,v.l("".concat(p," failed. error:"),e)})}},{key:"_onFilterConfig",value:function(t){var n=this;Je(t)||(this._filterConfigMap.clear(),Object.keys(t).forEach(function(e){n._filterConfigMap.set(e,t[e])}),v.l("".concat(this._n,"._onFilterConfig. keys:").concat(Array.from(this._filterConfigMap.keys())," values:").concat(Array.from(this._filterConfigMap.values()))))}},{key:"_isConfigOn",value:function(e){return 1===this._filterConfigMap.get(e)}},{key:"_getToken",value:function(e){if(ft(e)){var t=e.length,n="";if(t%2==0)for(var o=0;o<=t-1;o+=2)n=(n+=e[o+1])+e[o];else{for(var i=0;i<t-1;i+=2)n=(n+=e[i+1])+e[i];n+=e[t-1]}this._plugin.onToken(n)}}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._plugin&&(this._plugin.reset(),this._plugin=null),this._filterConfigMap.clear(),this._startIndex=0,this._version=0,this._canIUseLexicon=!1,this._isFetching=!1,this._expiredTime=0}}]),Ur),hr=(e(Pr,[{key:"_onCloudConfig",value:function(){var t=this,e=this._m.get(23).getCloudConfig("rtc_cmd");A(e)||((e=JSON.parse(e)).forEach(function(e){t._TRTCCommandList.includes(e)||t._TRTCCommandList.push(e)}),this._setTRTCCommandMap())}},{key:"_setTRTCCommandMap",value:function(){for(var e,t=0,n=this._TRTCCommandList.length;t<n;t++)e=this._TRTCCommandList[t].split(".")[0],this._TRTCCommandMap.set(e,1)}},{key:"onRoomCustomDataReceived",value:function(e){this._m.getOEmitInst().emit(G.ROOM_CUSTOM_DATA_RECEIVED,e)}},{key:"sendTRTCCustomData",value:function(e){var t=e.serviceCommand,e=e.data,n="".concat(a.NAME.TUIROOM_SVR,".*");return A(t)||(n=t),this._isValidServiceCommand(n)?this._trans({servcmd:n,data:e}):C({code:T.INVALID_TRTC_CMD})}},{key:"_trans",value:function(e){v.d("".concat(this._n,"._trans. options:").concat(JSON.stringify(e)));var t=e.servcmd,e=e.data;return this._m.get(20).trans({servcmd:t,data:ft(e)?JSON.parse(e):e})}},{key:"_isValidServiceCommand",value:function(e){if(e.endsWith(".*"))return this._TRTCCommandList.includes(e);e=e.split(".")[0];return this._TRTCCommandMap.has(e)}},{key:"isTRTCCommand",value:function(e){e=e.split(".")[0];return this._TRTCCommandMap.has(e)}},{key:"reset",value:function(){v.l("".concat(this._n,".reset"))}}]),Pr),gr=(e(Gr,[{key:"_init",value:function(){var e,t=this._getStorageModule().getItem(this.TIM_ERROR_ASSISTANCE,!1);if(t){try{e=JSON.parse(t)}catch(e){this._getStorageModule().removeItem(this.TIM_ERROR_ASSISTANCE,!1),v.w("".concat(this._n,"._init error:"),e)}e&&(this._needToUpdate(e)?this._fetch():this._fillMap(e.message))}else this._fetch()}},{key:"_needToUpdate",value:function(e){var t=e.localSavedTime,e=e.localSavedVersion,t=t&&(new Date).getTime()-t>=this.STORAGE_EXPIRES_TIME,e=!e||"3.5.2"!==e;return v.l("".concat(this._n,"._needToUpdate isTimeout:").concat(t," isDifferentVersion:").concat(e)),t||e}},{key:"_fetch",value:function(){var e,t,n,o,i,a;this._m.get(12).isPrivateNetWork()||(e="https://web.sdk.qcloud.com/im/download/error-message/v3/0.0.7/tim-error-message.txt",t="application/x-www-form-urlencoded;charset=UTF-8",n="".concat(this._n,"._fetch ok in"),o=this,ae?ue.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:function(e){o._fillAndSave(e.data),v.l("".concat(n," mini program"))},fail:function(){}}):(i=new XMLHttpRequest,a=setTimeout(function(){i.abort()},3e3),i.onreadystatechange=function(){4===i.readyState&&(a&&clearTimeout(a),200!==i.status&&304!==i.status||(v.l("".concat(n," browser")),o._fillAndSave(i.responseText)))},i.open("GET",e,!0),i.setRequestHeader("Content-type",t),i.send()))}},{key:"_fillAndSave",value:function(e){this._fillMap(e),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:e,localSavedTime:(new Date).getTime(),localSavedVersion:"3.5.2"}),!0,!1)}},{key:"_getStorageModule",value:function(){return this._m.get(13)}},{key:"_fillMap",value:function(e){this._map.clear();for(var t,n,o=e.split(";\n"),i=o.length,a=new RegExp(/'/g),s=0;s<i;s++)if(n=o[s].indexOf(":"),t=o[s].slice(0,n),n=o[s].slice(n+1,o[s].length),!t.startsWith("//")){if(A(n))continue;this._map.set(t,n.replace(a,""))}}},{key:"get",value:function(e){var t=e.isIntl,n=e.key,o=e.replacement1,e=e.replacement2,t="".concat(n,t?"_en":"_cn"),n=(!this._map.has(t)&&this._map.has(n)&&(t=n),"");return this._map.has(t)&&(n=this._map.get(t),A(o)||(n=n.replace("$replacement1",o)),A(e)||(n=n.replace("$replacement2",e))),n}},{key:"reset",value:function(){v.l("".concat(this._n,".reset"))}}]),Gr),fr=(e(Nr,[{key:"onNewMessageList",value:function(e){var n=this;e.forEach(function(e){var t=n.getPayloadData(e);t&&n._handleActionType(t,e)})}},{key:"onMessageModified",value:function(e){var n=this;e.forEach(function(e){var t=n.getPayloadData(e);t&&n._onInvitationModified(t,e)})}},{key:"getPayloadData",value:function(t){var n="".concat(this._n,".getPayloadData"),t=t.payload.data;try{return JSON.parse(t)}catch(e){return v.e("".concat(n," JSON parse error. signalingData:").concat(t)),null}}},{key:"_handleActionType",value:function(e,t){switch(e.actionType){case P.ACTION_TYPE_INVITE:this._onNewInvitationReceived(e,t);break;case P.ACTION_TYPE_REJECT_INVITE:this._onInviteeRejected(e);break;case P.ACTION_TYPE_ACCEPT_INVITE:this._onInviteeAccepted(e);break;case P.ACTION_TYPE_CANCEL_INVITE:this._onInvitationCancelled(e);break;case P.ACTION_TYPE_INVITE_TIMEOUT:this._onInvitationTimeout(e)}}},{key:"_genBaseEmitData",value:function(e){return{inviteID:e.inviteID,inviter:e.inviter,groupID:e.groupID,data:e.data||""}}},{key:"_onNewInvitationReceived",value:function(e,t){var n="".concat(this._n,"._onNewInvitationReceived"),o=e.inviteID,i=e.inviteeList,a=e.groupID,l=e.inviter,s=this._sigM.getMyUserID(),r=i.includes(s),c=e.timeout,u=(Re().getTime()-1e3*t.time)/1e3,n=(0<c&&0<u&&u<c&&(c-=u),"".concat(n," myselfIncluded:").concat(r," groupID:").concat(a," signalObj:").concat(JSON.stringify(e)));v.l("".concat(n," timeout:").concat(c,"s delta:").concat(u,"s")),(a&&r||!a)&&((n=this._sigM.getInviteInfo(o))&&n===e||(n||this._sigM.setInviteInfo(o,y(y({},e),{},{message:t})),this._sigM.emitEvent(P.NEW_INVITATION_RECEIVED,y(y({},this._genBaseEmitData(e)),{},{inviteeList:i})),l!==s&&this._sigM.startTimer(y(y({},e),{},{timeout:c}))))}},{key:"_onInviteeRejected",value:function(e){var t="".concat(this._n,"._onInviteeRejected"),n=e.inviteID,o=e.inviter,i=e.groupID,a=this._sigM.hasInviteInfo(n);v.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(a," inviter:").concat(o," groupID:").concat(i)),a&&(this._sigM.updateInviteInfo(e),this._sigM.emitEvent(P.INVITEE_REJECTED,y(y({},this._genBaseEmitData(e)),{},{invitee:e.inviteeList[0]})))}},{key:"_onInviteeAccepted",value:function(e){var t="".concat(this._n,"._onInviteeAccepted"),n=e.inviteID,o=e.inviter,i=e.groupID,a=this._sigM.hasInviteInfo(n);v.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(a," inviter:").concat(o," groupID:").concat(i)),a&&(this._sigM.updateInviteInfo(e),this._sigM.emitEvent(P.INVITEE_ACCEPTED,y(y({},this._genBaseEmitData(e)),{},{invitee:e.inviteeList[0]})))}},{key:"_onInvitationCancelled",value:function(e){var t="".concat(this._n,"._onInvitationCancelled"),n=e.inviteID,o=e.inviter,i=e.groupID,a=this._sigM.hasInviteInfo(n);v.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(a," inviter:").concat(o," groupID:").concat(i)),a&&(this._sigM.deleteInviteInfo(n),this._sigM.emitEvent(P.INVITATION_CANCELLED,this._genBaseEmitData(e)))}},{key:"_onInvitationTimeout",value:function(e){var t="".concat(this._n,"._onInvitationTimeout"),n=e.inviteID,o=e.inviter,i=e.groupID,a=e.inviteeList,s=this._sigM.hasInviteInfo(n);v.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(s," inviter:").concat(o," groupID:").concat(i," data:").concat(e.data)),s&&(this._sigM.updateInviteInfo(e),this._sigM.emitEvent(P.INVITATION_TIMEOUT,y(y({},this._genBaseEmitData(e)),{},{inviteeList:a,isSelfTimeout:!1})))}},{key:"_onInvitationModified",value:function(e,t){var n="".concat(this._n,"._onInvitationModified"),o=e.inviteID,i=e.data,a=this._sigM.hasInviteInfo(o);v.l("".concat(n," inviteID:").concat(o," hasInviteID:").concat(a," data:").concat(i)),a&&(this._sigM.setInviteInfo(o,y(y({},e),{},{message:t})),this._sigM.emitEvent(P.INVITATION_MODIFIED,{inviteID:o,data:i}))}}]),Nr),mr=(e(Or,[{key:"generateInviteID",value:function(){var e,t=(t=Us)((e=Ps)(32),8)+"-"+t(e(16),4)+"-"+t(16384|e(12),4)+"-"+t(32768|e(14),4)+"-"+t(e(48),12);return v.l("".concat(this._n,".generateInviteID inviteID:").concat(t)),t}},{key:"createInviteInfo",value:function(e){var t=this.generateInviteID(),e=this.createInviteCustomData(y(y({},e),{},{inviteID:t})),n=e.groupID,o=e.inviteeList,n=n||o[0];return{customData:e,message:this._sigM.createSignaling(e,n),inviteID:t}}},{key:"_genBaseCustomData",value:function(e){var t=e.data,n=e.inviteID,e=e.groupID;return{businessID:1,timeout:0,data:void 0===t?"":t,inviteID:void 0===n?"":n,groupID:void 0===e?"":e}}},{key:"createInviteCustomData",value:function(e){var t=e.userID,n=e.timeout,n=void 0===n?0:n,o=e.groupID,o=void 0===o?"":o,i=this._sigM.getMyUserID(),i=y(y({},this._genBaseCustomData(e)),{},{actionType:P.ACTION_TYPE_INVITE,inviter:i,inviteeList:o?e.inviteeList:[t],timeout:n});return v.l("".concat(this._n,".createInviteCustomData customData:"),i),i}},{key:"createCancelCustomData",value:function(e){var t,n="".concat(this._n,".createCancelCustomData"),o=e.inviteID,i=this._sigM.getMyUserID(),o=this._sigM.getInviteInfo(o),a=o.inviteeList,s=o.groupID,o=o.inviter;return o===i?t=y(y({},this._genBaseCustomData(e)),{},{actionType:P.ACTION_TYPE_CANCEL_INVITE,groupID:s,inviter:i,inviteeList:a}):v.e("".concat(n," unmatched inviter:").concat(o," and my userID:").concat(i)),v.l("".concat(n," customData:"),t),t}},{key:"createAcceptCustomData",value:function(e){var t,n="".concat(this._n,".createAcceptCustomData"),o=e.inviteID,i=this._sigM.getMyUserID(),a=this._sigM.getInviteInfo(o),s=a.inviter,r=a.groupID;return a.inviteeList.includes(i)?t=y(y({},this._genBaseCustomData(e)),{},{actionType:P.ACTION_TYPE_ACCEPT_INVITE,groupID:r,inviter:s,inviteeList:[i]}):v.e("".concat(n," userID:").concat(i," not in inviteeList. inviteID:").concat(o," groupID:").concat(r)),v.l("".concat(n," customData:"),t),t}},{key:"createRejectCustomData",value:function(e){var t,n="".concat(this._n,".createRejectCustomData"),o=e.inviteID,i=this._sigM.getMyUserID(),a=this._sigM.getInviteInfo(o),s=a.inviter,r=a.groupID;return a.inviteeList.includes(i)?t=y(y({},this._genBaseCustomData(e)),{},{actionType:P.ACTION_TYPE_REJECT_INVITE,groupID:r,inviter:s,inviteeList:[i]}):v.e("".concat(n," userID:").concat(i," not in inviteeList. inviteID:").concat(o," groupID:").concat(r)),v.l("".concat(n," customData:"),t),t}},{key:"createTimeoutCustomData",value:function(e){var t="".concat(this._n,".createTimeoutCustomData"),n=e.inviteeList,o=e.inviter,i=e.isInviter,i=void 0!==i&&i,a=this._sigM.getMyUserID(),e=y(y({},this._genBaseCustomData(e)),{},{actionType:P.ACTION_TYPE_INVITE_TIMEOUT,inviter:o,inviteeList:i?n:[a]});return v.l("".concat(t," customData:"),e),e}}]),Or),vr=(e(Ar,[{key:"setCloudConfig",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:20,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:300;this.COUNT=e,this.EXPIRED_TIME=t,v.l("".concat(this._n,".setCloudConfig count:").concat(e,", time:").concat(t))}},{key:"getHistorySignaling",value:function(){var t=this,e=this._sigM.get(11).getLocalConvList();Je(e)||(this._getC2CSignalingList(),e=this._getValidGroupConvList(e),this._getGroupSignalingList(e).then(function(e){t._handleSignalingList(e)}))}},{key:"_getC2CSignalingList",value:function(){var e=this._sigM.get(6).getMessageListFromUnreadDB(),e=this._sigM.filterMessageList(e);this._getRelatedToMeMap(e)}},{key:"_getGroupSignalingList",value:function(e){var n=this,e=this._createPromiseList(e);return 0===e.length?Promise.resolve(this._sortSignaling(this._relatedToMeMap)):this._concurrentGetMessageList(e).then(function(e){var t=new Map;return e.forEach(function(e){e=e.list,e=n._getRelatedToMeMap(e);t=new Map([].concat(D(t),D(e)))}),n._sortSignaling(t)})}},{key:"_handleSignalingList",value:function(e){Je(e)||this._sigM.onNewMessageList(e)}},{key:"_getValidGroupConvList",value:function(e){for(var t=[],n=0,o=e.length;n<o;n++){var i=e[n],a=i.type,s=i.unreadCount,i=i.lastMessage,a=a===R.CONV_GROUP,i=this._isNotExpired(i);a&&s&&i&&t.push(e[n])}return t}},{key:"_isNotExpired",value:function(e){return!(!e||!e.lastTime)&&e.lastTime>Oe()-this.EXPIRED_TIME}},{key:"_createPromiseList",value:function(e){for(var t=[],n=0;n<e.length;n++){var o=e[n],i=o.conversationID,o=o.unreadCount,o=o<this.COUNT?o:this.COUNT,o=(this._map.set(i,{msgCount:o,list:[]}),this._sigM.get(11).getMessageList({conversationID:i}));t.push(o)}return t}},{key:"_concurrentGetMessageList",value:function(e){var i=this,a=[];return Promise.all(e).then(function(e){for(var t=0;t<e.length;t++){var n=e[t],o=n.code,n=n.data;0===o&&0!==n.messageList.length&&(i._handleMessageList(n.messageList),(o=i._relayGetMessageList(n))&&a.push(o))}return 0<a.length?i._concurrentGetMessageList(a):i._map})}},{key:"_relayGetMessageList",value:function(e){var t=e.messageList,n=e.nextReqMessageID,e=e.isCompleted;if(0===t.length)return null;var t=t[0].conversationID,o=this._map.get(t).msgCount;return 0===o||e?null:this._sigM.get(11).getMessageList({conversationID:t,nextReqMessageID:n,count:o})}},{key:"_handleMessageList",value:function(e){var t=e.length,n=e[0].conversationID,o=this._map.get(n),i=o.msgCount,o=o.list;this._map.set(n,{msgCount:0<i-t?i-t:0,list:o.concat(this._sigM.filterMessageList(e))})}},{key:"_getRelatedToMeMap",value:function(e){for(var t=0;t<e.length;t++){var n=e[t];this._saveRelatedToMe(n)}return this._relatedToMeMap}},{key:"_saveRelatedToMe",value:function(e){var t=this._sigM.getPayloadData(e)||{},n=t.actionType,t=t.inviteID,o=void 0===t?"":t;switch(void 0===n?"":n){case P.ACTION_TYPE_INVITE:this._setHistoryInvite(e);break;case P.ACTION_TYPE_REJECT_INVITE:case P.ACTION_TYPE_ACCEPT_INVITE:this._updateHistoryInvite(e);break;case P.ACTION_TYPE_CANCEL_INVITE:this._delHistoryInvite(o);break;case P.ACTION_TYPE_INVITE_TIMEOUT:this._updateHistoryInvite(e)}}},{key:"_setHistoryInvite",value:function(e){var t=this._sigM.getPayloadData(e)||{},n=t.inviteID,n=void 0===n?"":n,o=t.inviteeList,o=void 0===o?[]:o,i=t.timeout,i=void 0===i?0:i,a=this._sigM.getMyUserID();o.includes(a)&&(o=Oe()-e.time,0<i&&i<o&&0!==i||this._relatedToMeMap.set(n,y(y({},t),{},{messageList:[e]})))}},{key:"_delHistoryInvite",value:function(e){this._relatedToMeMap.has(e)&&this._relatedToMeMap.delete(e)}},{key:"_updateHistoryInvite",value:function(e){var t=this._sigM.getPayloadData(e)||{},n=t.inviteID,n=void 0===n?"":n,t=t.inviteeList,o=void 0===t?[]:t;if(this._relatedToMeMap.has(n)){for(var t=this._relatedToMeMap.get(n),i=t.inviteeList,t=t.messageList,a=0;a<o.length;a++){var s=o[a];i.includes(s)&&i.splice(i.indexOf(s),1)}0===i.length?this._delHistoryInvite(n):t.push(e)}else this._delHistoryInvite(n)}},{key:"_sortSignaling",value:function(e){var t=[];return e.forEach(function(e){t=[].concat(D(t),D(e.messageList))}),t.sort(function(e,t){return e.time-t.time})}},{key:"reset",value:function(){this._map.clear(),this._relatedToMeMap.clear()}}]),Ar),Ir=e(function e(t,n){d(this,e),this.businessID=t.businessID||1,this.inviteID=t.inviteID,this.groupID=t.groupID||"",this.inviter=t.inviter||"",this.inviteeList=t.inviteeList||[],this.data=t.data||"",this.actionType=t.actionType||P.ACTION_TYPE_INVITE,this.timeout=t.timeout||0}),Mr=["message"],yr=["message"],Cr=(t(Rr,Fn),ws=f(Rr),e(Rr,[{key:"onC2CUnreadHandleCompleted",value:function(){this._isC2CUnreadHandleCompleted=!0,this._isCloudConfigCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}},{key:"onConvSyncCompleted",value:function(){this._isConvSyncCompleted=!0,this._isC2CUnreadHandleCompleted&&this._isCloudConfigCompleted&&!this._isSyncCompleted&&this.onReady()}},{key:"onCloudConfig",value:function(){this._isCloudConfigCompleted=!0;var e=this.getCloudConfig("history_s_count"),t=this.getCloudConfig("history_s_time");A(e)||(e=Number(e)),A(t)||(t=Number(t)),this._historySignalingHandler.setCloudConfig(e,t),this._isC2CUnreadHandleCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}},{key:"_isListenerExisted",value:function(){return-1<this._m.getOEmitInst().eventNames().indexOf(P.NEW_INVITATION_RECEIVED)}},{key:"onReady",value:function(){this._isSyncCompleted=!0;var e=this._isListenerExisted();v.l("".concat(this._n,".onReady. isListenerExisted: ").concat(e)),e&&this._historySignalingHandler.getHistorySignaling()}},{key:"onNewMessageList",value:function(e){e=this.filterMessageList(e);if(0<e.length)return this._remoteSignalingHandler.onNewMessageList(e)}},{key:"onMessageModified",value:function(e){e=this.filterMessageList(e);if(0<e.length)return this._remoteSignalingHandler.onMessageModified(e)}},{key:"hasInviteInfo",value:function(e){return this._inviteInfoMap.has(e)}},{key:"getInviteInfo",value:function(e){return this._inviteInfoMap.get(e)}},{key:"setInviteInfo",value:function(e,t){var n=t.message,t=g(t,Mr);v.l("".concat(this._n,".setInviteInfo inviteID:").concat(e," data:"),t),this._inviteInfoMap.set(e,y(y({},t),{},{message:n}))}},{key:"deleteInviteInfo",value:function(e){this.hasInviteInfo(e)&&(v.l("".concat(this._n,".deleteInviteInfo inviteID:").concat(e,".")),this._inviteInfoMap.delete(e))}},{key:"updateInviteInfo",value:function(e){var t="".concat(this._n,".updateInviteInfo"),n=e.inviteID,o=e.inviter,i=e.inviteeList,e=e.groupID;v.l("".concat(t," inviteID:").concat(n," inviter:").concat(o," groupID:").concat(e)),e&&this.hasInviteInfo(n)?(o=i[0],(e=this.getInviteInfo(n).inviteeList).includes(o)&&(e.splice(e.indexOf(o),1),v.l("".concat(t," remove ").concat(o,". localInviteeList.length:").concat(e.length))),0===e.length&&this.deleteInviteInfo(n)):this.deleteInviteInfo(n)}},{key:"canIUseSignaling",value:function(){return this._canIUseSignaling}},{key:"emitEvent",value:function(e,t){this.emitOEvt(e,t)}},{key:"addSignalingListener",value:function(e,t,n){this._canIUseSignaling||(this._canIUseSignaling=!0),this._m.getOEmitInst().on(e,t,n)}},{key:"removeSignalingListener",value:function(e,t,n){this._m.getOEmitInst().off(e,t,n),this._isListenerExisted()||(this._canIUseSignaling=!1)}},{key:"invite",value:function(e){var t=this,n="".concat(this._n,".").concat("invite"),o=this._localSignalingHandler.createInviteInfo(e),i=o.message,a=o.customData,s=o.inviteID;return v.l("".concat(n," options:").concat(JSON.stringify(e)," inviteID:").concat(s)),this.sendSignaling(i,e).then(function(e){return e&&0===e.code?(t.setInviteInfo(s,y(y({},a),{},{message:i})),t.startTimer(y(y({},a),{},{inviteID:s})),y(y({},e),{},{inviteID:s})):e}).catch(function(e){return C(e)})}},{key:"inviteSync",value:function(e,t,n){var o=this,i="".concat(this._n,".").concat("inviteSync"),a=this._localSignalingHandler.createInviteInfo(e),s=a.message,r=a.customData,c=a.inviteID;return v.l("".concat(i," options:").concat(JSON.stringify(e)," inviteID:").concat(c)),this.sendSignaling(s,e).then(function(e){if(e&&0===e.code)return o.setInviteInfo(c,y(y({},r),{},{message:s})),o.startTimer(y(y({},r),{},{inviteID:c})),t&&t({inviteID:c}),{inviteID:c};n&&n(0===e.code,e.message||"")}).catch(function(e){return n&&n(e.code,e.message),C(e)}),c}},{key:"_handleImResponse",value:function(e,t,n){t&&0===t.code&&(this._isHandling=!1,n?this.deleteInviteInfo(e.inviteID):this.updateInviteInfo(e))}},{key:"cancel",value:function(t){var n=this,e="".concat(this._n,".").concat("cancel");if(v.l("".concat(e," options:").concat(JSON.stringify(t))),!this.hasInviteInfo(t.inviteID)||this._isHandling)return C({code:T.INVALID_CANCEL_MESSAGE});this._isHandling=!0;var o=this._localSignalingHandler.createCancelCustomData(t);if(!o)return this._isHandling=!1,C({code:T.SIGNALING_NO_PERMISSION});var e=o.groupID,i=o.inviteeList,e=e||i[0],i=this.createSignaling(o,e);return this.sendSignaling(i,t).then(function(e){return n._handleImResponse(o,e,!0),0===e.code?y(y({},e),{},{inviteID:t.inviteID}):e}).catch(function(e){return C(e)})}},{key:"accept",value:function(t){var n=this,e="".concat(this._n,".").concat("accept");if(v.l("".concat(e," options:").concat(JSON.stringify(t))),!this.hasInviteInfo(t.inviteID)||this._isHandling)return C({code:T.SIGNALING_INVALID_INVITE_ID});this._isHandling=!0;var o=this._localSignalingHandler.createAcceptCustomData(t);if(!o)return this._isHandling=!1,C({code:T.SIGNALING_NO_PERMISSION});e=this.createSignaling(o);return this.sendSignaling(e,t).then(function(e){return n._handleImResponse(o,e),0===e.code?y(y({},e),{},{inviteID:t.inviteID}):e}).catch(function(e){return C(e)})}},{key:"reject",value:function(t){var n=this,e="".concat(this._n,".").concat("reject");if(v.l("".concat(e," options:").concat(JSON.stringify(t))),!this.hasInviteInfo(t.inviteID)||this._isHandling)return C({code:T.SIGNALING_INVALID_INVITE_ID});this._isHandling=!0;var o=this._localSignalingHandler.createRejectCustomData(t);if(!o)return this._isHandling=!1,C({code:T.SIGNALING_NO_PERMISSION});e=this.createSignaling(o);return this.sendSignaling(e,t).then(function(e){return n._handleImResponse(o,e,!0),0===e.code?y(y({},e),{},{inviteID:t.inviteID}):e}).catch(function(e){return C(e)})}},{key:"getSignalingInfo",value:function(e){var t="".concat(this._n,".getSignalingInfo"),n=e.ID,o=e.from,i=e.to,a=this._filterSignaling(e),s=null,e=(a&&(e=this.getPayloadData(e),s=new Ir(e)),a?"actionType:".concat(s.actionType):"");return v.l("".concat(t," messageID:").concat(n," from:").concat(o," to:").concat(i," ")+"".concat(e," isSignaling:").concat(a)),s}},{key:"modifyInvitation",value:function(e){var t=this,n=e.inviteID,e=e.data;if(!this.hasInviteInfo(n))return C({code:T.SIGNALING_INVALID_INVITE_ID});var o=this.getInviteInfo(n),i=o.message,a=g(o,yr),s=i.payload.data;return a.data=e,i.payload.data=JSON.stringify(a),this.get(2).modifyRemoteMessage(i).then(function(e){return t.hasInviteInfo(n)&&t.setInviteInfo(n,y(y({},a),{},{message:i})),e}).catch(function(e){return i.payload.data=s,C(e)})}},{key:"_genMsgCtrlInfo",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.data,t=void 0===t?"":t,n=e.onlineUserOnly,o=e.inviteID,o=void 0===o?"":o,i=e.offlinePushInfo,e=e.actionType,a={_onlineOnlyFlag:!1},o={onlineUserOnly:(a=o&&this.getInviteInfo(o)?this.getInviteInfo(o).message:a)._onlineOnlyFlag||n||!1,offlinePushInfo:i,messageControlInfo:{excludedFromContentModeration:!0,excludedFromUnreadCount:!1,excludedFromLastMessage:!1}};if(e===P.ACTION_TYPE_INVITE_TIMEOUT)return a=!!t.match(/excludeTimeoutSignalingFromHistoryMessage/),o.messageControlInfo.excludedFromUnreadCount=a,o.messageControlInfo.excludedFromLastMessage=a,o;n=!!t.match(/excludeFromHistoryMessage/),i=!!t.match(/excludeOriginalSignalingFromHistoryMessage/);return o.messageControlInfo.excludedFromUnreadCount=n||i,o.messageControlInfo.excludedFromLastMessage=n||i,o}},{key:"sendSignaling",value:function(e,t){var n=this;return this.get(2).sendMessageInstance(e,this._genMsgCtrlInfo(t)).catch(function(e){return n._isHandling=!1,C(e)})}},{key:"filterMessageList",value:function(e){var t=this;return e.filter(function(e){return t._filterSignaling(e)})}},{key:"getPayloadData",value:function(e){return this._remoteSignalingHandler.getPayloadData(e)}},{key:"createSignaling",value:function(e,t){var n=e.groupID,o=e.inviter,t={to:t||n||o,conversationType:n?R.CONV_GROUP:R.CONV_C2C,priority:R.MSG_PRIORITY_HIGH,payload:{data:JSON.stringify(e)}},o=this.get(2).createCustomMessage(t);return v.l("".concat(this._n,".createSignaling. message:"),o),o}},{key:"_filterSignaling",value:function(e){var t,n,o=!1;return e.type&&e.type===R.MSG_CUSTOM&&(t=e.cloudCustomData,e=void 0===(e=e.payload.data)?"":e,t=(void 0===t?"":t).match(/"type":"tsignaling"/),n=e.match(/inviteID/),e=e.match(/actionType/),o=t||n&&e),!!o}},{key:"startTimer",value:function(t){var n,o,i,a=this,s="".concat(this._n,".startTimer"),e=t.timeout,r=t.inviteID,c=t.inviter,l=t.groupID,u=c===this.getMyUserID();v.l("".concat(s," timeout:").concat(e," isInviter:").concat(u," groupID:").concat(l)),e<=0||(n=u?e+5:e,o=1,i=setInterval(function(){var e=a._hasLocalInviteInfo(t,u);o<n&&e?++o:(e&&a._sendTimeoutNotice(r,u),v.l("".concat(s," end.")),clearInterval(i))},1e3))}},{key:"_hasLocalInviteInfo",value:function(e,t){var n=e.inviteID,e=e.groupID;if(!this.hasInviteInfo(n))return!1;var o="".concat(this._n,"._hasLocalInviteInfo"),i=this.getInviteInfo(n).inviteeList;return v.l("".concat(o," inviteID:").concat(n," inviteeList:").concat(i," groupID:").concat(e)),!e||(t?0<i.length:0<i.length&&i.includes(this.getMyUserID()))}},{key:"_getReceiver",value:function(e,t){var n=t.groupID,o=t.inviteeList,t=t.inviter;return e?n||o[0]:n||t}},{key:"_sendTimeoutNotice",value:function(i,a){var s=this,e=this.getInviteInfo(i),t=this._getReceiver(a,e),r=(v.l("".concat(this._n,"._sendTimeoutNotice inviteID:").concat(i," to:").concat(t," isInviter:").concat(a)),this._localSignalingHandler.createTimeoutCustomData(y(y({},e),{},{isInviter:a}))),c=this.createSignaling(r,t);return this.sendSignaling(c,r).then(function(e){var t,n,o;e&&0===e.code&&(e=r.data,t=r.groupID,n=r.inviteeList,o=r.inviter,s.emitEvent(P.INVITATION_TIMEOUT,{data:e,groupID:t,inviteID:i,inviteeList:n,inviter:o,isSelfTimeout:!0,message:c}),a?s.deleteInviteInfo(i):s.updateInviteInfo(r))})}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._inviteInfoMap.clear(),this._canIUseSignaling=!1,this._isHandling=!1,this._historySignalingHandler.reset(),this._isC2CUnreadHandleCompleted=!1,this._isConvSyncCompleted=!1,this._isSyncCompleted=!1,this._isCloudConfigCompleted=!1}}]),Rr),Tr=["followDiffList"],Dr=["from"],Er={NONE:0,FOLLOWERS:1,FOLLOWING:2,MUTUAL:3},Lr=(t(kr,Fn),bs=f(kr),e(kr,[{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("follow_req_count");A(e)||(e=Number(e),this.DEFAULT_COUNT=e>this.MAX_COUNT?this.MAX_COUNT:e,this._clearFollowList())}},{key:"clearCacheOnReconnected",value:function(){this._clearFollowList()}},{key:"onFollowNotify",value:function(e){var a=this,e=e.dataList||[];v.l("".concat(this._n,".onFollowNotify followChangeList:").concat(e.length)),e.forEach(function(e){var t=e.followDiffList,t=void 0===t?[]:t,e=g(e,Tr),o=e.from,i=g(e,Dr);t.forEach(function(e){var t=e.isAdd,e=e.followType,e=void 0===e?0:e,n=a._initFollowInfo();1===t?(i.userID=o,n[e].userInfoList.push(i),n[e].isAdd=!0):(n[e].userInfoList.push(o),n[e].isAdd=!1),a._emitEvent(n)})})}},{key:"_initFollowInfo",value:function(){var t={};return Object.values(Er).forEach(function(e){e!==Er.NONE&&(t[e]={userInfoList:[],isAdd:!1})}),t}},{key:"_emitEvent",value:function(n){var o=this;Object.keys(n).forEach(function(e){var e=Number(e),t=n[e];0<t.userInfoList.length&&(e===Er.FOLLOWERS&&(o._clearFollowList(Er.FOLLOWERS),o.emitOEvt(G.MY_FOLLOWERS_LIST_UPDATED,t)),e===Er.FOLLOWING&&(o._clearFollowList(Er.FOLLOWING),o.emitOEvt(G.MY_FOLLOWING_LIST_UPDATED,t)),e===Er.MUTUAL&&(o._clearFollowList(Er.MUTUAL),o.emitOEvt(G.MUTUAL_FOLLOWERS_LIST_UPDATED,t)))})}},{key:"followUser",value:function(e){if(!this.canIUse(H.FOLLOW))return this.noUse("followUser");var t="".concat(this._n,".").concat("followUser"),n="userIDList:".concat(e.length),o=new M("followUser");return o.setMessage(n),v.l("".concat(t," ").concat(n)),this.req({P:I.FOLLOW,data:{fromAccount:this.getMyUserID(),userIDList:e.map(function(e){return{userID:e}})}}).then(function(e){return o.end(),v.l("".concat(t," ok.")),Sn(e.data.resultList)}).catch(function(e){return o.setError(e).end(),v.e("".concat(t," failed. error:"),e),C(e)})}},{key:"unfollowUser",value:function(e){if(!this.canIUse(H.FOLLOW))return this.noUse("unfollowUser");var t="".concat(this._n,".").concat("unfollowUser"),n="userIDList:".concat(e.length),o=new M("unfollowUser");return o.setMessage(n),v.l("".concat(t," ").concat(n)),this.req({P:I.UNFOLLOW,data:{fromAccount:this.getMyUserID(),userIDList:e}}).then(function(e){return o.end(),v.l("".concat(t," ok.")),Sn(e.data.resultList)}).catch(function(e){return o.setError(e).end(),v.e("".concat(t," failed. error:"),e),C(e)})}},{key:"getMyFollowersList",value:function(){var t=this,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",o="getMyFollowersList";if(!this.canIUse(H.FOLLOW))return this.noUse(o);var i=n||this.FIRST_PAGE_INDEX;if(this._myFollowersList.has(i)){var e=this._myFollowersList.get(i),a=e.resultList,s=e.nextCursor,e=e.lastUpdateTime;if(Date.now()-e<this.MAX_CATCH_TIME&&0<a.length)return v.l("".concat(this._n,".").concat(o," nextCursor:").concat(n," from local.")),kn({resultList:a,nextCursor:s})}return this._getFollowList(n,Er.FOLLOWERS).then(function(e){return t._myFollowersList.set(i,y(y({},e),{},{lastUpdateTime:Date.now()})),v.l("".concat(t._n,".").concat(o," nextCursor:").concat(n," from remote.")),Sn(e)})}},{key:"getMyFollowingList",value:function(){var t=this,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",o="getMyFollowingList";if(!this.canIUse(H.FOLLOW))return this.noUse(o);var i=n||this.FIRST_PAGE_INDEX;if(this._myFollowingList.has(i)){var e=this._myFollowingList.get(i),a=e.resultList,s=e.nextCursor,e=e.lastUpdateTime;if(Date.now()-e<this.MAX_CATCH_TIME&&0<a.length)return v.l("".concat(this._n,".").concat(o," nextCursor:").concat(n," from local.")),kn({resultList:a,nextCursor:s})}return this._getFollowList(n,Er.FOLLOWING).then(function(e){return t._myFollowingList.set(i,y(y({},e),{},{lastUpdateTime:Date.now()})),v.l("".concat(t._n,".").concat(o," nextCursor:").concat(n," from remote.")),Sn(e)})}},{key:"getMutualFollowersList",value:function(){var t=this,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",o="getMutualFollowersList";if(!this.canIUse(H.FOLLOW))return this.noUse(o);var i=n||this.FIRST_PAGE_INDEX;if(this._myMutualFollowersList.has(i)){var e=this._myMutualFollowersList.get(i),a=e.resultList,s=e.nextCursor,e=e.lastUpdateTime;if(Date.now()-e<this.MAX_CATCH_TIME&&0<a.length)return v.l("".concat(this._n,".").concat(o," nextCursor:").concat(n," from local.")),kn({resultList:a,nextCursor:s})}return this._getFollowList(n,Er.MUTUAL).then(function(e){return t._myMutualFollowersList.set(i,y(y({},e),{},{lastUpdateTime:Date.now()})),v.l("".concat(t._n,".").concat(o," nextCursor:").concat(n," from remote.")),Sn(e)})}},{key:"_getFollowList",value:function(e,t){var i=this,n=new M("_getFollowList");return n.setMessage("nextCursor:".concat(e," type:").concat(t)),this.req({P:I.GET_FOLLOW,data:{fromAccount:this.getMyUserID(),count:this.DEFAULT_COUNT,nextCursor:e,type:t}}).then(function(e){n.end();var e=e.data,t=e.resultList,t=void 0===t?[]:t,e=e.nextCursor,e=void 0===e?"":e,o=[];return t.forEach(function(e){var t=e.userID,n=e.followTime,e=e.profileList;o.push(y({userID:t,followTime:n},i._handleProfileItem(void 0===e?[]:e)))}),{resultList:o,nextCursor:e}}).catch(function(e){return n.setError(e).end(),v.e("".concat(i._n,"._getFollowList failed. error:"),e),C(e)})}},{key:"_handleProfileItem",value:function(e){var t={};return e.forEach(function(e){switch(e.tag){case qe.NICK:t.nick=e.value;break;case qe.GENDER:t.gender=e.value;break;case qe.BIRTHDAY:t.birthday=e.value;break;case qe.LOCATION:t.location=e.value;break;case qe.SELFSIGNATURE:t.selfSignature=e.value;break;case qe.ALLOWTYPE:t.allowType=e.value;break;case qe.LANGUAGE:t.language=e.value;break;case qe.AVATAR:t.avatar=e.value;break;case qe.MESSAGESETTINGS:t.messageSettings=e.value;break;case qe.ADMINFORBIDTYPE:t.adminForbidType=e.value;break;case qe.LEVEL:t.level=e.value;break;case qe.ROLE:t.role=e.value;break;default:t[e.tag]=e.value}}),t}},{key:"getUserFollowInfo",value:function(e){if(!this.canIUse(H.FOLLOW))return this.noUse("getUserFollowInfo");var t=e,n=!1,i=(A(e)&&(t=[this.getMyUserID()],n=!0),"".concat(this._n,".").concat("getUserFollowInfo")),e="userIDList:".concat(t.length," isGetMyFollowInfo:").concat(n),a=new M("getUserFollowInfo");return a.setMessage(e),v.l("".concat(i," ").concat(e)),this.req({P:I.GET_FOLLOW_INFO,data:{fromAccount:this.getMyUserID(),userIDList:t}}).then(function(e){a.end(),v.l("".concat(i," ok."));var e=e.data.followInfoList,o=[];return(void 0===e?[]:e).forEach(function(e){var t=e.followersCount,n=e.followingCount,e=e.mutualFollowersCount;o.push({followersCount:t,followingCount:n,mutualFollowersCount:e})}),Sn(o)}).catch(function(e){return a.setError(e).end(),v.e("".concat(i," failed. error:"),e),C(e)})}},{key:"checkFollowType",value:function(e){if(!this.canIUse(H.FOLLOW))return this.noUse("checkFollowType");100<e.length&&(e=e.slice(0,100),v.w("".concat(t," ").concat(zt(100))));var t="".concat(this._n,".").concat("checkFollowType"),n="userIDList length:".concat(e.length," "),o=new M("checkFollowType");return o.setMessage(n),v.l("".concat(t," ").concat(n)),this.req({P:I.CHECK_FOLLOW_TYPE,data:{fromAccount:this.getMyUserID(),userIDList:e}}).then(function(e){o.end(),v.l("".concat(t," ok."));var e=e.data.resultList,n=[];return(void 0===e?[]:e).forEach(function(e){var t=e.userID,e=e.followType;n.push({userID:t,followType:e})}),Sn(n)}).catch(function(e){return o.setError(e).end(),v.e("".concat(t," failed. error:"),e),C(e)})}},{key:"_clearFollowList",value:function(e){if(A(e))return this._myFollowersList.clear(),this._myFollowingList.clear(),void this._myMutualFollowersList.clear();e!==Er.FOLLOWERS?e!==Er.FOLLOWING?e!==Er.MUTUAL||this._myMutualFollowersList.clear():this._myFollowingList.clear():this._myFollowersList.clear()}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._clearFollowList()}}]),kr),Sr=Da(function(e,t){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;t.assign=function(e){for(var t,n,o=Array.prototype.slice.call(arguments,1);o.length;){var i=o.shift();if(i){if("object"!==r(i))throw new TypeError(i+"must be non-object");for(var a in i)t=i,n=a,Object.prototype.hasOwnProperty.call(t,n)&&(e[a]=i[a])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,n,o,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+o),i);else for(var a=0;a<o;a++)e[i+a]=t[n+a]},flattenChunks:function(e){for(var t,n,o,i=0,a=0,s=e.length;a<s;a++)i+=e[a].length;for(o=new Uint8Array(i),a=t=0,s=e.length;a<s;a++)n=e[a],o.set(n,t),t+=n.length;return o}},i={arraySet:function(e,t,n,o,i){for(var a=0;a<o;a++)e[i+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,o)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,i))},t.setTyped(n)});function kr(e){return d(this,kr),(e=bs.call(this,e))._n="FollowModule",e._myFollowersList=new Map,e._myFollowingList=new Map,e._myMutualFollowersList=new Map,e.MAX_CATCH_TIME=6e5,e.FIRST_PAGE_INDEX=dt(),e.DEFAULT_COUNT=500,e.MAX_COUNT=1e3,e.getIEmitInst().on(Wo.CLOUD_CONFIG,e._onCloudConfig,h(e)),e}function Rr(e){d(this,Rr),(e=ws.call(this,e))._n="SignalingModule",e._inviteInfoMap=new Map,e._canIUseSignaling=!1,e._isHandling=!1,e._remoteSignalingHandler=new fr(h(e)),e._localSignalingHandler=new mr(h(e)),e._historySignalingHandler=new vr(h(e)),e._isC2CUnreadHandleCompleted=!1,e._isConvSyncCompleted=!1,e._isSyncCompleted=!1,e._isCloudConfigCompleted=!1;var t=e.getIEmitInst();return t.on(Wo.C2C_UNREAD_HANDLE_COMPLETED,e.onC2CUnreadHandleCompleted,h(e)),t.on(Wo.CONV_SYNC_COMPLETED,e.onConvSyncCompleted,h(e)),t.on(Wo.CLOUD_CONFIG,e.onCloudConfig,h(e)),e}function Ar(e){d(this,Ar),this._n="HistorySignalingHandler",this._sigM=e,this.COUNT=20,this.EXPIRED_TIME=300,this._map=new Map,this._relatedToMeMap=new Map}function Or(e){d(this,Or),this._n="LocalSignalingHandler",this._sigM=e}function Nr(e){d(this,Nr),this._n="RemoteSignalingHandler",this._sigM=e}function Gr(e){d(this,Gr),this._m=e,this._n="ErrMsgModule",this.TIM_ERROR_ASSISTANCE="tim_error_assistance",this.STORAGE_EXPIRES_TIME=6048e5,this._map=new Map,this._init()}function Pr(e){d(this,Pr),this._m=e,this._n="TransCmdModule",this._TRTCCommandList=["tui_room_svr.*","callkit_records_svr.*","room_engine_srv.*","room_engine_http_srv.*","room_engine_mic.*","live_engine_srv.*","live_engine_http_srv.*","live_engine_pk.*","trtc_ai_service.*","call_engine_srv.*"],this._TRTCCommandMap=new Map,this._setTRTCCommandMap(),this._m.getIEmitInst().on(Wo.CLOUD_CONFIG,this._onCloudConfig,this)}function Ur(e){return d(this,Ur),(e=Fs.call(this,e))._n="ProfanityFilterModule",e._plugin=null,e._filterConfigMap=new Map,e._startIndex=0,e._version=0,e._canIUseLexicon=!1,e._isFetching=!1,e._expiredTime=0,e}function br(e){var t;return d(this,br),(t=qs.call(this,e))._m=e,t._n="TIMPushModule",t._pluginName="TIMPush",t._pushPlugin=void 0,t._androidPushConfig={},t._deviceToken="",t._businessID=0,t._iOSBusinessID=0,t._c2cUnreadCount=0,t._groupUnreadCount=0,t._isWebUniapp=0,t._deviceInfo={notificationStatus:0,deviceModel:"",systemVersion:"",pushVersion:"1.0.1",packageName:""},t}function wr(e){var t;return d(this,wr),(t=xs.call(this,e))._m=e,t._n="OfflinePushModule",t._offlinePushPlugin=void 0,t._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:"",honorPushBussinessId:""},t._deviceToken="",t._businessID=0,t._iosBusinessID=0,t._c2cUnreadCount=0,t._groupUnreadCount=0,t._isWebUniapp=0,t}function Fr(e){d(this,Fr),this._m=e,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new ur(this)}function qr(e){d(this,qr),this._commercialConfigM=e,this._n="PurchasedFeatureHandler",this._isCSPluginReported=!1,this._featureMap=new Map}function xr(e){return d(this,xr),(e=Vs.call(this,e))._n="WorkerTimerModule",e._isWorkerEnabled=!0,e._workerTimer=null,e._timerID=-1,e._init(),e.getIEmitInst().on(Wo.CLOUD_CONFIG,e._onCloudConfig,h(e)),e}function Vr(e){return d(this,Vr),(e=Hs.call(this,e))._n="SnsModule",e._friendHandler=new ir(h(e)),e._friendApplicationHandler=new nr(h(e)),e._friendGroupHandler=new sr(h(e)),e.getIEmitInst().on(Wo.A2KEY_AND_TINYID_UPDATED,e.onContextUpdated,h(e)),e}function Hr(e){d(this,Hr),this._snsM=e,this._n="FriendGroupHandler",this._map=new Map}function Br(e){d(this,Br),Je(e)||(this.name=e.name||"",this.userIDList=e.userIDList||[],this.count=this.userIDList.length||0)}function Kr(e){d(this,Kr),this._snsM=e,this._n="FriendHandler",this._map=new Map,this._startIdx=0,this._standardSeq=0,this._customSeq=0,this._expirationTime=18e4}function Yr(e,t){d(this,Yr),this.userID=e,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;var n={},o=[];if(n.userID=e,!Je(t))for(var i,a="",s=0,r=t.length;s<r;s++)if(a=t[s].tag,i=t[s].value,-1<a.indexOf("Tag_SNS_Custom"))this.friendCustomField.push({key:a,value:i});else if(-1<a.indexOf("Tag_Profile_Custom"))o.push({key:a,value:i});else switch(a){case qe.NICK:n.nick=i;break;case qe.GENDER:n.gender=i;break;case qe.BIRTHDAY:n.birthday=i;break;case qe.LOCATION:n.location=i;break;case qe.SELFSIGNATURE:n.selfSignature=i;break;case qe.ALLOWTYPE:n.allowType=i;break;case qe.LANGUAGE:n.language=i;break;case qe.AVATAR:n.avatar=i;break;case qe.MESSAGESETTINGS:n.messageSettings=i;break;case qe.ADMINFORBIDTYPE:n.adminForbidType=i;break;case qe.LEVEL:n.level=i;break;case qe.ROLE:n.role=i;break;case xe.REMARK:this.remark=i;break;case xe.ADDTIME:this.addTime=i;break;case xe.GROUP:this.groupList=JSON.parse(JSON.stringify(i));break;case xe.ADDSOURCE:this.source=i;break;case xe.ADDWORDING:break;default:v.l("snsProfileItem unknown tag->",t[s].tag)}this.profile=new ri(y(y({},n),{},{profileCustomField:o}))}function Wr(e){d(this,Wr),this._snsM=e,this._n="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSeq=0,this._map=new Map,this._unreadCount=0}function jr(e){d(this,jr),(e=Bs.call(this,e))._n="QualityStatModule",e.TAG="im-ssolog-quality-stat",e.reportIndex=0,e.wholePeriod=!1,e._qualityItems=[Yn,Wn,jn,Jn,zn,Xn,Zn,Qn,$n,eo],e._messageSentItems=[jn,Jn,zn,Xn,Zn],e._messageReceivedItems=[Qn,$n,eo],e.REPORT_INTERVAL=120,e.REPORT_SDKAPPID_BLACKLIST=[],e.REPORT_TINYID_WHITELIST=[],e._statInfoArr=[],e._avgRTT=new Zs,e._avgE2EDelay=new Xs,e._rateMessageSent=new Qs,e._rateMessageReceived=new $s;var t=e.getIEmitInst();return t.on(Wo.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,h(e)),t.on(Wo.CLOUD_CONFIG,e._onCloudConfig,h(e)),e}function Jr(){d(this,Jr),this._lastMap=new Map,this._currentMap=new Map}function zr(){d(this,zr),this._map=new Map}function Xr(){d(this,Xr),this._n="AvgRTT",this._requestCount=0,this._rttArray=[]}function Zr(){d(this,Zr),this._n="AvgE2EDelay",this._e2eDelayArray=[]}function Qr(e){return d(this,Qr),(e=Ks.call(this,e))._n="RecoverMsgModule",e.PULL_LIMIT_COUNT=15,e}function $r(e){return d(this,$r),(e=Ys.call(this,e))._n="CloudControlModule",e._cloudConfig=new Map,e._expiredTime=0,e._version=0,e._isFetching=!1,e}function ec(e){return d(this,ec),(e=Ws.call(this,e))._n="SessionModule",e._platform=e.getPlatform(),e._pHandler=new Ms(h(e)),e._msgDispatcher=new Cs(h(e)),e._cmdFreqLimitMap=new Map,e._cmdReqInfoMap=new Map,e._serverOverloadInfoMap=new Map,e._incrementalPullContactFlag=!0,e._init(),e.getIEmitInst().on(Wo.CLOUD_CONFIG,e._onCloudConfig,h(e)),e}Sr.assign,Sr.shrinkBuf,Sr.setTyped,Sr.Buf8,Sr.Buf16,Sr.Buf32;function tc(e,t,n,o){for(var i=65535&e|0,a=e>>>16&65535|0,s=0;0!==n;){for(n-=s=2e3<n?2e3:n;a=a+(i=i+t[o++]|0)|0,--s;);i%=65521,a%=65521}return i|a<<16|0}function nc(e,t,n,o){var i=ic,a=o+n;e^=-1;for(var s=o;s<a;s++)e=e>>>8^i[255&(e^t[s])];return-1^e}function oc(l,d,p,_,h,g,e,f){for(var t,m,v,I,M,y,C,T,D,E=f.bits,n=0,o=0,i=0,a=0,s=0,r=0,c=0,L=0,S=0,u=0,k=null,R=0,A=new Sr.Buf16(16),O=new Sr.Buf16(16),N=null,G=0,n=0;n<=15;n++)A[n]=0;for(o=0;o<_;o++)A[d[p+o]]++;for(s=E,a=15;1<=a&&0===A[a];a--);if(a<s&&(s=a),0===a)return h[g++]=20971520,h[g++]=20971520,f.bits=1,0;for(i=1;i<a&&0===A[i];i++);for(s<i&&(s=i),n=L=1;n<=15;n++)if((L=(L<<1)-A[n])<0)return-1;if(0<L&&(0===l||1!==a))return-1;for(O[1]=0,n=1;n<15;n++)O[n+1]=O[n]+A[n];for(o=0;o<_;o++)0!==d[p+o]&&(e[O[d[p+o]]++]=o);if(y=0===l?(k=N=e,19):1===l?(k=ac,R-=257,N=sc,G-=257,256):(k=rc,N=cc,-1),n=i,M=g,c=o=u=0,v=-1,I=(S=1<<(r=s))-1,1===l&&852<S||2===l&&592<S)return 1;for(;;){for(D=e[o]<y?(T=0,e[o]):e[o]>y?(T=N[G+e[o]],k[R+e[o]]):(T=96,0),t=1<<(C=n-c),i=m=1<<r;h[M+(u>>c)+(m-=t)]=C<<24|T<<16|D|0,0!==m;);for(t=1<<n-1;u&t;)t>>=1;if(0!==t?u=(u&t-1)+t:u=0,o++,0==--A[n]){if(n===a)break;n=d[p+e[o]]}if(s<n&&(u&I)!==v){for(M+=i,L=1<<(r=n-(c=0===c?s:c));r+c<a&&!((L-=A[r+c])<=0);)r++,L<<=1;if(S+=1<<r,1===l&&852<S||2===l&&592<S)return 1;h[v=u&I]=s<<24|r<<16|M-g|0}}return 0!==u&&(h[M+u]=n-c<<24|64<<16|0),f.bits=s,0}var ic=function(){for(var e=[],t=0;t<256;t++){for(var n=t,o=0;o<8;o++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n}return e}(),ac=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],sc=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],rc=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],cc=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function uc(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function lc(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Sr.Buf16(320),this.work=new Sr.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function dc(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Sr.Buf32(852),t.distcode=t.distdyn=new Sr.Buf32(592),t.sane=1,t.back=-1,0):-2}function pc(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,dc(e)):-2}function _c(e,t){var n,o;return e&&e.state?(o=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?-2:(null!==o.window&&o.wbits!==t&&(o.window=null),o.wrap=n,o.wbits=t,pc(e))):-2}function hc(e,t){var n;return e?(n=new lc,(e.state=n).window=null,0!==(n=_c(e,t))&&(e.state=null),n):-2}var gc,fc,mc=!0;function vc(e,t,n,o){var i,e=e.state;return null===e.window&&(e.wsize=1<<e.wbits,e.wnext=0,e.whave=0,e.window=new Sr.Buf8(e.wsize)),o>=e.wsize?(Sr.arraySet(e.window,t,n-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):((i=e.wsize-e.wnext)>o&&(i=o),Sr.arraySet(e.window,t,n-o,i,e.wnext),(o-=i)?(Sr.arraySet(e.window,t,n-o,o,0),e.wnext=o,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave<e.wsize&&(e.whave+=i))),0}var Ic={inflateReset:pc,inflateReset2:_c,inflateResetKeep:dc,inflateInit:function(e){return hc(e,15)},inflateInit2:hc,inflate:function(e,l){var t,n,d,o,p,i,_,a,s,h,g,r,f,m,v,I,M,y,C,T,D,E,L,S,k=0,R=new Sr.Buf8(4),A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(t=e.state).mode&&(t.mode=13),p=e.next_out,d=e.output,_=e.avail_out,o=e.next_in,n=e.input,i=e.avail_in,a=t.hold,s=t.bits,h=i,g=_,E=0;e:for(;;)switch(t.mode){case 1:if(0===t.wrap){t.mode=13;break}for(;s<16;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}if(2&t.wrap&&35615===a){R[t.check=0]=255&a,R[1]=a>>>8&255,t.check=nc(t.check,R,2,0),s=a=0,t.mode=2;break}if(t.flags=0,t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&a)<<8)+(a>>8))%31){e.msg="incorrect header check",t.mode=30;break}if(8!=(15&a)){e.msg="unknown compression method",t.mode=30;break}if(s-=4,D=8+(15&(a>>>=4)),0===t.wbits)t.wbits=D;else if(D>t.wbits){e.msg="invalid window size",t.mode=30;break}t.dmax=1<<D,e.adler=t.check=1,t.mode=512&a?10:12,s=a=0;break;case 2:for(;s<16;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}if(t.flags=a,8!=(255&t.flags)){e.msg="unknown compression method",t.mode=30;break}if(57344&t.flags){e.msg="unknown header flags set",t.mode=30;break}t.head&&(t.head.text=a>>8&1),512&t.flags&&(R[0]=255&a,R[1]=a>>>8&255,t.check=nc(t.check,R,2,0)),s=a=0,t.mode=3;case 3:for(;s<32;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}t.head&&(t.head.time=a),512&t.flags&&(R[0]=255&a,R[1]=a>>>8&255,R[2]=a>>>16&255,R[3]=a>>>24&255,t.check=nc(t.check,R,4,0)),s=a=0,t.mode=4;case 4:for(;s<16;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}t.head&&(t.head.xflags=255&a,t.head.os=a>>8),512&t.flags&&(R[0]=255&a,R[1]=a>>>8&255,t.check=nc(t.check,R,2,0)),s=a=0,t.mode=5;case 5:if(1024&t.flags){for(;s<16;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}t.length=a,t.head&&(t.head.extra_len=a),512&t.flags&&(R[0]=255&a,R[1]=a>>>8&255,t.check=nc(t.check,R,2,0)),s=a=0}else t.head&&(t.head.extra=null);t.mode=6;case 6:if(1024&t.flags&&((r=(r=t.length)>i?i:r)&&(t.head&&(D=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Array(t.head.extra_len)),Sr.arraySet(t.head.extra,n,o,r,D)),512&t.flags&&(t.check=nc(t.check,n,r,o)),i-=r,o+=r,t.length-=r),t.length))break e;t.length=0,t.mode=7;case 7:if(2048&t.flags){if(0===i)break e;for(r=0;D=n[o+r++],t.head&&D&&t.length<65536&&(t.head.name+=String.fromCharCode(D)),D&&r<i;);if(512&t.flags&&(t.check=nc(t.check,n,r,o)),i-=r,o+=r,D)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=8;case 8:if(4096&t.flags){if(0===i)break e;for(r=0;D=n[o+r++],t.head&&D&&t.length<65536&&(t.head.comment+=String.fromCharCode(D)),D&&r<i;);if(512&t.flags&&(t.check=nc(t.check,n,r,o)),i-=r,o+=r,D)break e}else t.head&&(t.head.comment=null);t.mode=9;case 9:if(512&t.flags){for(;s<16;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}if(a!==(65535&t.check)){e.msg="header crc mismatch",t.mode=30;break}s=a=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=12;break;case 10:for(;s<32;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}e.adler=t.check=uc(a),s=a=0,t.mode=11;case 11:if(0===t.havedict)return e.next_out=p,e.avail_out=_,e.next_in=o,e.avail_in=i,t.hold=a,t.bits=s,2;e.adler=t.check=1,t.mode=12;case 12:if(5===l||6===l)break e;case 13:if(t.last){a>>>=7&s,s-=7&s,t.mode=27;break}for(;s<3;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}switch(t.last=1&a,--s,3&(a>>>=1)){case 0:t.mode=14;break;case 1:O=N=void 0;var O,N=t;if(mc){for(gc=new Sr.Buf32(512),fc=new Sr.Buf32(32),O=0;O<144;)N.lens[O++]=8;for(;O<256;)N.lens[O++]=9;for(;O<280;)N.lens[O++]=7;for(;O<288;)N.lens[O++]=8;for(oc(1,N.lens,0,288,gc,0,N.work,{bits:9}),O=0;O<32;)N.lens[O++]=5;oc(2,N.lens,0,32,fc,0,N.work,{bits:5}),mc=!1}if(N.lencode=gc,N.lenbits=9,N.distcode=fc,N.distbits=5,t.mode=20,6!==l)break;a>>>=2,s-=2;break e;case 2:t.mode=17;break;case 3:e.msg="invalid block type",t.mode=30}a>>>=2,s-=2;break;case 14:for(a>>>=7&s,s-=7&s;s<32;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}if((65535&a)!=(a>>>16^65535)){e.msg="invalid stored block lengths",t.mode=30;break}if(t.length=65535&a,s=a=0,t.mode=15,6===l)break e;case 15:t.mode=16;case 16:if(r=t.length){if(0===(r=_<(r=i<r?i:r)?_:r))break e;Sr.arraySet(d,n,o,r,p),i-=r,o+=r,_-=r,p+=r,t.length-=r;break}t.mode=12;break;case 17:for(;s<14;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}if(t.nlen=257+(31&a),a>>>=5,s-=5,t.ndist=1+(31&a),a>>>=5,s-=5,t.ncode=4+(15&a),a>>>=4,s-=4,286<t.nlen||30<t.ndist){e.msg="too many length or distance symbols",t.mode=30;break}t.have=0,t.mode=18;case 18:for(;t.have<t.ncode;){for(;s<3;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}t.lens[A[t.have++]]=7&a,a>>>=3,s-=3}for(;t.have<19;)t.lens[A[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,L={bits:t.lenbits},E=oc(0,t.lens,0,19,t.lencode,0,t.work,L),t.lenbits=L.bits,E){e.msg="invalid code lengths set",t.mode=30;break}t.have=0,t.mode=19;case 19:for(;t.have<t.nlen+t.ndist;){for(;I=(k=t.lencode[a&(1<<t.lenbits)-1])>>>16&255,M=65535&k,!((v=k>>>24)<=s);){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}if(M<16)a>>>=v,s-=v,t.lens[t.have++]=M;else{if(16===M){for(S=v+2;s<S;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}if(a>>>=v,s-=v,0===t.have){e.msg="invalid bit length repeat",t.mode=30;break}D=t.lens[t.have-1],r=3+(3&a),a>>>=2,s-=2}else if(17===M){for(S=v+3;s<S;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}D=0,r=3+(7&(a>>>=v)),a>>>=3,s=s-v-3}else{for(S=v+7;s<S;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}D=0,r=11+(127&(a>>>=v)),a>>>=7,s=s-v-7}if(t.have+r>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=30;break}for(;r--;)t.lens[t.have++]=D}}if(30===t.mode)break;if(0===t.lens[256]){e.msg="invalid code -- missing end-of-block",t.mode=30;break}if(t.lenbits=9,L={bits:t.lenbits},E=oc(1,t.lens,0,t.nlen,t.lencode,0,t.work,L),t.lenbits=L.bits,E){e.msg="invalid literal/lengths set",t.mode=30;break}if(t.distbits=6,t.distcode=t.distdyn,L={bits:t.distbits},E=oc(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,L),t.distbits=L.bits,E){e.msg="invalid distances set",t.mode=30;break}if(t.mode=20,6===l)break e;case 20:t.mode=21;case 21:if(6<=i&&258<=_){e.next_out=p,e.avail_out=_,e.next_in=o,e.avail_in=i,t.hold=a,t.bits=s,K=H=w=b=U=P=c=G=oe=ne=te=ee=$=Q=Z=X=z=J=j=W=Y=u=B=V=x=void 0;var G,c,P,U,b,w,F=e,q=g,x=F.state,V=F.next_in,H=F.input,B=V+(F.avail_in-5),u=F.next_out,K=F.output,Y=u-(q-F.avail_out),W=u+(F.avail_out-257),j=x.dmax,J=x.wsize,z=x.whave,X=x.wnext,Z=x.window,Q=x.hold,$=x.bits,ee=x.lencode,te=x.distcode,ne=(1<<x.lenbits)-1,oe=(1<<x.distbits)-1;t:do{for($<15&&(Q+=H[V++]<<$,$+=8,Q+=H[V++]<<$,$+=8),G=ee[Q&ne];;){if(Q>>>=c=G>>>24,$-=c,0==(c=G>>>16&255))K[u++]=65535&G;else{if(!(16&c)){if(0==(64&c)){G=ee[(65535&G)+(Q&(1<<c)-1)];continue}if(32&c){x.mode=12;break t}F.msg="invalid literal/length code",x.mode=30;break t}for(P=65535&G,(c&=15)&&($<c&&(Q+=H[V++]<<$,$+=8),P+=Q&(1<<c)-1,Q>>>=c,$-=c),$<15&&(Q+=H[V++]<<$,$+=8,Q+=H[V++]<<$,$+=8),G=te[Q&oe];;){if(Q>>>=c=G>>>24,$-=c,!(16&(c=G>>>16&255))){if(0==(64&c)){G=te[(65535&G)+(Q&(1<<c)-1)];continue}F.msg="invalid distance code",x.mode=30;break t}if(U=65535&G,$<(c&=15)&&(Q+=H[V++]<<$,($+=8)<c&&(Q+=H[V++]<<$,$+=8)),(U+=Q&(1<<c)-1)>j){F.msg="invalid distance too far back",x.mode=30;break t}if(Q>>>=c,$-=c,U>(c=u-Y)){if((c=U-c)>z&&x.sane){F.msg="invalid distance too far back",x.mode=30;break t}if(w=Z,(b=0)===X){if(b+=J-c,c<P){for(P-=c;K[u++]=Z[b++],--c;);b=u-U,w=K}}else if(X<c){if(b+=J+X-c,(c-=X)<P){for(P-=c;K[u++]=Z[b++],--c;);if(b=0,X<P){for(P-=c=X;K[u++]=Z[b++],--c;);b=u-U,w=K}}}else if(b+=X-c,c<P){for(P-=c;K[u++]=Z[b++],--c;);b=u-U,w=K}for(;2<P;)K[u++]=w[b++],K[u++]=w[b++],K[u++]=w[b++],P-=3;P&&(K[u++]=w[b++],1<P&&(K[u++]=w[b++]))}else{for(b=u-U;K[u++]=K[b++],K[u++]=K[b++],K[u++]=K[b++],2<(P-=3););P&&(K[u++]=K[b++],1<P&&(K[u++]=K[b++]))}break}}break}}while(V<B&&u<W);V-=P=$>>3,Q&=(1<<($-=P<<3))-1,F.next_in=V,F.next_out=u,F.avail_in=V<B?B-V+5:5-(V-B),F.avail_out=u<W?W-u+257:257-(u-W),x.hold=Q,x.bits=$,p=e.next_out,d=e.output,_=e.avail_out,o=e.next_in,n=e.input,i=e.avail_in,a=t.hold,s=t.bits,12===t.mode&&(t.back=-1);break}for(t.back=0;I=(k=t.lencode[a&(1<<t.lenbits)-1])>>>16&255,M=65535&k,!((v=k>>>24)<=s);){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}if(I&&0==(240&I)){for(y=v,C=I,T=M;I=(k=t.lencode[T+((a&(1<<y+C)-1)>>y)])>>>16&255,M=65535&k,!(y+(v=k>>>24)<=s);){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}a>>>=y,s-=y,t.back+=y}if(a>>>=v,s-=v,t.back+=v,t.length=M,0===I){t.mode=26;break}if(32&I){t.back=-1,t.mode=12;break}if(64&I){e.msg="invalid literal/length code",t.mode=30;break}t.extra=15&I,t.mode=22;case 22:if(t.extra){for(S=t.extra;s<S;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}t.length+=a&(1<<t.extra)-1,a>>>=t.extra,s-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=23;case 23:for(;I=(k=t.distcode[a&(1<<t.distbits)-1])>>>16&255,M=65535&k,!((v=k>>>24)<=s);){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}if(0==(240&I)){for(y=v,C=I,T=M;I=(k=t.distcode[T+((a&(1<<y+C)-1)>>y)])>>>16&255,M=65535&k,!(y+(v=k>>>24)<=s);){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}a>>>=y,s-=y,t.back+=y}if(a>>>=v,s-=v,t.back+=v,64&I){e.msg="invalid distance code",t.mode=30;break}t.offset=M,t.extra=15&I,t.mode=24;case 24:if(t.extra){for(S=t.extra;s<S;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}t.offset+=a&(1<<t.extra)-1,a>>>=t.extra,s-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=30;break}t.mode=25;case 25:if(0===_)break e;if(t.offset>(r=g-_)){if((r=t.offset-r)>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=30;break}f=r>t.wnext?(r-=t.wnext,t.wsize-r):t.wnext-r,r>t.length&&(r=t.length),m=t.window}else m=d,f=p-t.offset,r=t.length;for(_-=r=_<r?_:r,t.length-=r;d[p++]=m[f++],--r;);0===t.length&&(t.mode=21);break;case 26:if(0===_)break e;d[p++]=t.length,_--,t.mode=21;break;case 27:if(t.wrap){for(;s<32;){if(0===i)break e;i--,a|=n[o++]<<s,s+=8}if(g-=_,e.total_out+=g,t.total+=g,g&&(e.adler=t.check=(t.flags?nc:tc)(t.check,d,g,p-g)),g=_,(t.flags?a:uc(a))!==t.check){e.msg="incorrect data check",t.mode=30;break}s=a=0}t.mode=28;case 28:if(t.wrap&&t.flags){for(;s<32;){if(0===i)break e;i--,a+=n[o++]<<s,s+=8}if(a!==(4294967295&t.total)){e.msg="incorrect length check",t.mode=30;break}s=a=0}t.mode=29;case 29:E=1;break e;case 30:E=-3;break e;case 31:return-4;default:return-2}return e.next_out=p,e.avail_out=_,e.next_in=o,e.avail_in=i,t.hold=a,t.bits=s,(t.wsize||g!==e.avail_out&&t.mode<30&&(t.mode<27||4!==l))&&vc(e,e.output,e.next_out,g-e.avail_out),h-=e.avail_in,g-=e.avail_out,e.total_in+=h,e.total_out+=g,t.total+=g,t.wrap&&g&&(e.adler=t.check=(t.flags?nc:tc)(t.check,d,g,e.next_out-g)),e.data_type=t.bits+(t.last?64:0)+(12===t.mode?128:0)+(20===t.mode||15===t.mode?256:0),E=(0==h&&0===g||4===l)&&0===E?-5:E},inflateEnd:function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},inflateGetHeader:function(e,t){var n;return!e||!e.state||0==(2&(n=e.state).wrap)?-2:((n.head=t).done=!1,0)},inflateSetDictionary:function(e,t){var n,o=t.length;return!e||!e.state||0!==(n=e.state).wrap&&11!==n.mode?-2:11===n.mode&&tc(1,t,o,0)!==n.check?-3:vc(e,t,o,o)?(n.mode=31,-4):(n.havedict=1,0)},inflateInfo:"pako inflate (from Nodeca project)"},Mc=!0,yc=!0;try{String.fromCharCode.apply(null,[0])}catch(e){Mc=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){yc=!1}for(var Cc=new Sr.Buf8(256),Tc=0;Tc<256;Tc++)Cc[Tc]=252<=Tc?6:248<=Tc?5:240<=Tc?4:224<=Tc?3:192<=Tc?2:1;Cc[254]=Cc[254]=1;function Dc(e,l){for(var t,n,o=l||e.length,i=new Array(2*o),a=0,s=0;s<o;)if((t=e[s++])<128)i[a++]=t;else if(4<(n=Cc[t]))i[a++]=65533,s+=n-1;else{for(t&=2===n?31:3===n?15:7;1<n&&s<o;)t=t<<6|63&e[s++],n--;1<n?i[a++]=65533:t<65536?i[a++]=t:(t-=65536,i[a++]=55296|t>>10&1023,i[a++]=56320|1023&t)}var r=i,c=a;if(c<65534&&(r.subarray&&yc||!r.subarray&&Mc))return String.fromCharCode.apply(null,Sr.shrinkBuf(r,c));for(var d="",u=0;u<c;u++)d+=String.fromCharCode(r[u]);return d}function Ec(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Lc(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Sc={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},kc={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Rc=Object.prototype.toString;function Ac(e){if(!(this instanceof Ac))return new Ac(e);this.options=Sr.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options,e=(t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ec,this.strm.avail_out=0,Ic.inflateInit2(this.strm,t.windowBits));if(e!==Sc.Z_OK)throw new Error(kc[e]);if(this.header=new Lc,Ic.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=function(e){for(var t,n,o,i,a=e.length,s=0,r=0;r<a;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(o=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(o-56320),r++),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Sr.Buf8(s),r=i=0;i<s;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(o=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(o-56320),r++),n<128?t[i++]=n:(n<2048?t[i++]=192|n>>>6:(n<65536?t[i++]=224|n>>>12:(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63),t[i++]=128|n>>>6&63),t[i++]=128|63&n);return t}(t.dictionary):"[object ArrayBuffer]"===Rc.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=Ic.inflateSetDictionary(this.strm,t.dictionary))!==Sc.Z_OK))throw new Error(kc[e])}function Oc(e,t){t=new Ac(t);if(t.push(e,!0),t.err)throw t.msg||kc[t.err];return t.result}Ac.prototype.push=function(e,t){var n,o,i,a,s,r=this.strm,c=this.options.chunkSize,l=this.options.dictionary,u=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?Sc.Z_FINISH:Sc.Z_NO_FLUSH,"string"==typeof e?r.input=function(e){for(var t=new Sr.Buf8(e.length),n=0,o=t.length;n<o;n++)t[n]=e.charCodeAt(n);return t}(e):"[object ArrayBuffer]"===Rc.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(0===r.avail_out&&(r.output=new Sr.Buf8(c),r.next_out=0,r.avail_out=c),(n=(n=Ic.inflate(r,Sc.Z_NO_FLUSH))===Sc.Z_NEED_DICT&&l?Ic.inflateSetDictionary(this.strm,l):n)===Sc.Z_BUF_ERROR&&!0===u&&(n=Sc.Z_OK,u=!1),n!==Sc.Z_STREAM_END&&n!==Sc.Z_OK)return this.onEnd(n),!(this.ended=!0);r.next_out&&(0!==r.avail_out&&n!==Sc.Z_STREAM_END&&(0!==r.avail_in||o!==Sc.Z_FINISH&&o!==Sc.Z_SYNC_FLUSH)||("string"===this.options.to?(i=function(e,t){for(var n=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=n&&128==(192&e[n]);)n--;return!(n<0||0===n)&&n+Cc[e[n]]>t?n:t}(r.output,r.next_out),a=r.next_out-i,s=Dc(r.output,i),r.next_out=a,r.avail_out=c-a,a&&Sr.arraySet(r.output,r.output,i,a,0),this.onData(s)):this.onData(Sr.shrinkBuf(r.output,r.next_out)))),0===r.avail_in&&0===r.avail_out&&(u=!0)}while((0<r.avail_in||0===r.avail_out)&&n!==Sc.Z_STREAM_END);return(o=n===Sc.Z_STREAM_END?Sc.Z_FINISH:o)===Sc.Z_FINISH?(n=Ic.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Sc.Z_OK):o!==Sc.Z_SYNC_FLUSH||(this.onEnd(Sc.Z_OK),!(r.avail_out=0))},Ac.prototype.onData=function(e){this.chunks.push(e)},Ac.prototype.onEnd=function(e){e===Sc.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Sr.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};se={};(0,Sr.assign)(se,{Inflate:Ac,inflate:Oc,inflateRaw:function(e,t){return(t=t||{}).raw=!0,Oc(e,t)},ungzip:Oc},Sc);var Nc,Gc=se,Pc=(e(Qc,[{key:"inflate",value:function(e){var t,e=new Uint8Array(e).slice(4),n=Date.now();try{t=Gc.inflate(e,{to:"string"}),this._bLogForInflateOK||(this._bLogForInflateOK=!0,new M("inflateOK").end())}catch(e){return this._bLogForInflateError?void 0:(this._bLogForInflateError=!0,void new M("inflateError").setMessage(e).end())}var e=e.length+4,o=t.length;return v.d("inflate ok. zipped:".concat(e," unzipped:").concat(o)+" compression ratio:".concat(Math.round(100*(o-e)/o),"% cost:").concat(Date.now()-n)),t}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._bLogForInflateOK=!1,this._bLogForInflateError=!1}}]),Qc),Uc="Message",bc="User",wc="Group",Fc="GroupMember",qc=["count"],xc=["conversationID","timePosition","timePeriod"],Vc=["miniBirthday","maxBirthday"],Hc=(c(te={},Uc,I.CS),c(te,bc,I.USER_CS),c(te,wc,I.GRP_CS),c(te,Fc,I.MBR_CS),te),Bc=(t(Zc,Fn),Nc=f(Zc),e(Zc,[{key:"searchCloudMessages",value:function(e){return this.search(Uc,e)}},{key:"searchCloudUsers",value:function(e){return this.search(bc,e)}},{key:"searchCloudGroups",value:function(e){return this.search(wc,e)}},{key:"searchCloudGroupMembers",value:function(e){return this.search(Fc,e)}},{key:"search",value:function(i,a){var s=this,e="searchCloud".concat(i,"s"),r="".concat(this._n,".").concat(e);if(!a)return C({code:T.OPTIONS_IS_EMPTY,message:this.getErrMsg(T.OPTIONS_IS_EMPTY,e)});var t=a.keywordList,n=ot(t),o=a.count;if(a.count&&(o=parseInt(o)),i===Uc&&!n&&!ot(a.senderUserIDList)&&!ot(a.messageTypeList)||i!==Uc&&!n)throw v.e("[".concat(e,'] Missing required params: "keywordList".')),new Error("Params validate failed.");var l=Date.now(),c=new M(e),u="keywordList:".concat(t," keywordListMatchType:").concat(a.keywordListMatchType," cursor:").concat(a.cursor," count:").concat(o);return v.l("".concat(r," ").concat(u)),this.req({P:Hc[i],data:this._genParams(i,a)}).then(function(e){var t=e.data,n=t.code,t=t.message;if(0!==n)return 60020===(o=n)?o="SearchUnable":i!==Uc&&27003===n?o="SearchParamsError":i!==Uc&&60018===n&&(o="SearchOverLimit"),o=s.getErrMsg(o)||t,t=new Bn({code:n,message:o}),c.setMessage(u).setError(t).end(),C(t);s.get(27).isCSPluginEnabled();var n=e.data,o=n.cursor,t=void 0===o?"":o,o=n.totalCount,n="totalCount:".concat(o," cost:").concat(Qt(l)),n=(v.l("".concat(r," ok. cursor:").concat(t," ").concat(n)),c.setMessage("".concat(u," ").concat(n)).end(),s._genRes(i,a,e.data));return Sn({searchResultList:n,cursor:t,totalCount:o})}).catch(function(e){return c.setMessage(u).setError(e).end(),C(e)})}},{key:"_genParams",value:function(e,t){var n=t.count,o=g(t,qc);if(n&&(o.count=parseInt(n)),e===Uc)return this._genMsgParams(o);n=t.keywordList,t=t.keywordListMatchType;return o.keywords=n,o.keywordMatchType="and"===t?1:0,e===bc?this._genUserParams(o):o}},{key:"_genMsgParams",value:function(e){var t=e.conversationID,n=e.timePosition,o=e.timePeriod,e=g(e,xc);return A(t)||(At(t)&&(e.account=t.replace(R.CONV_C2C,"")),Ot(t)&&(e.groupID=t.replace(R.CONV_GROUP,""))),Qe(o)&&0<o&&(Qe(n)&&0<n?e.startTime=n-o:e.startTime=Oe()-o),e.startTime&&e.startTime<0&&(e.startTime=void 0),Qe(n)&&0<n&&(e.endTime=n),e}},{key:"_genUserParams",value:function(e){var t=e.miniBirthday,n=e.maxBirthday,e=g(e,Vc);return Qe(t)&&(e.miniBirthday=parseInt(t),Qe(n)||(e.maxBirthday=4294967295)),Qe(n)&&(e.maxBirthday=parseInt(n)),e}},{key:"_genRes",value:function(e,t,n){switch(e){case Uc:return this._genMsgRes(n.searchResult,!t.conversationID);case bc:return this._genUserRes(n.userList);case wc:return this._genGrpRes(n.groupList);case Fc:return this._genMemberRes(n.groupMemberList);default:return[]}}},{key:"_genMsgRes",value:function(e,a){var s=this.get(11);return nt(e)&&0!==e.length?e.map(function(e){var t=e.groupID,n=e.userID,o=e.messageCount,e=e.messageList,e=void 0===e?[]:e,n=t?"".concat(R.CONV_GROUP).concat(t):"".concat(R.CONV_C2C).concat(n),i={conversationID:n,messageCount:o,messageList:[]};if(a&&1<o)return i;o=e.filter(function(e){return!!e});return 0<o.length&&(e=s.onRoamingMessage(o,n,!1),t&&e.reverse(),i.messageList=e,i.messageCount=e.length),i}):[]}},{key:"_genUserRes",value:function(e){var t=this.get(4)._profileHandler;if(!nt(e))return[];for(var n=[],o=0,i=e.length;o<i;o++){var a=e[o],s=a.userID,a=a.profileItems;"@TLS#NOT_FOUND"!==s&&""!==s&&(s=t._update(s,t._getLatestProfileFromResponse(s,a)).latestProfile,n.push(s))}return n}},{key:"_genGrpRes",value:function(e){if(!nt(e))return[];for(var t=[],n=0,o=e.length;n<o;n++)e[n]&&e[n].groupID&&t.push(new li(e[n]));return t}},{key:"_genMemberRes",value:function(e){if(!nt(e))return[];for(var t,n,o,i,a,s,r=new Map,c=0,u=e.length;c<u;c++)e[c]&&e[c].userID&&e[c].groupID&&(n=(t=e[c]).groupID,i=t.name,a=t.type,s=t.avatar,o=t.nick,i={groupID:n,name:i,type:a,avatar:s},a={userID:t.userID,nick:o,nameCard:t.nameCard},r.has(n)?((s=r.get(n)).memberList.push(a),r.set(n,s)):r.set(n,{groupInfo:i,memberList:[a]}));return D(r.values())}}]),Zc),Kc=(e(Xc,[{key:"_startTimer",value:function(){var e=this._map.get(24),t=e.isWorkerEnabled();v.l("".concat(this._n,".startTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.startWorkerTimer():this._startMainThreadTimer()}},{key:"_startMainThreadTimer",value:function(){this._checkTimer<0&&(this._checkTimer=setInterval(this.onCheckTimer.bind(this),1e3)),v.l("".concat(this._n,"._startMainThreadTimer seed:").concat(this._checkTimer))}},{key:"stopTimer",value:function(){var e=this._map.get(24),t=e.isWorkerEnabled();v.l("".concat(this._n,".stopTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.stopWorkerTimer():this._stopMainThreadTimer()}},{key:"_stopMainThreadTimer",value:function(){v.l("".concat(this._n,"._stopMainThreadTimer")),0<this._checkTimer&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){v.l("".concat(this._n,"._stopMainThreadSocket"));var e=this._map.get(21);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:"_startMainThreadSocket",value:function(){v.l("".concat(this._n,"._startMainThreadSocket"));var e=this._map.get(21);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){v.l("".concat(this._n,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){v.l("".concat(this._n,".onWorkerTimerDisabled, enable main thread timer and socket")),this._startMainThreadTimer(),this._startMainThreadSocket()}},{key:"onCheckTimer",value:function(){this._checkCount+=1;var e,t=N(this._map);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2)[1];n.onCheckTimer&&n.onCheckTimer(this._checkCount)}}catch(e){t.e(e)}finally{t.f()}}},{key:"_initReadyList",value:function(){var t=this;this._readyList=[this._map.get(1)],this._readyList.forEach(function(e){e.ready(function(){return t._onModuleReady()})})}},{key:"_onModuleReady",value:function(){var e,t,n=!0;this._readyList.forEach(function(e){e.isReady()||(n=!1)}),n&&!this._isReady&&(this._isReady=!0,this._oEmitter.emit(G.SDK_READY),e=Date.now()-this._startLoginTs,v.w("SDK is ready. cost ".concat(e," ms")),this._startLoginTs=Date.now(),t=this._ssoLogForReady.getStartTs()+Ge,this._ssoLogForReady.setMessage(e).start(t).end())}},{key:"login",value:function(){0===this._startLoginTs&&(Ae(),this._startLoginTs=Date.now(),this._startTimer(),this._map.get(15).start(),this._ssoLogForReady=new M("sdkReady"),this._reason=T.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOEmitInst",value:function(){return null===this._oEmitter&&(this._oEmitter=new La,e=this._oEmitter,Kn=e,this._oEmitter._emit=this._oEmitter.emit,this._oEmitter.emit=function(e,t){var n,o,i=this;this._canIUseSignaling()&&(e===G.MESSAGE_RECEIVED&&this.get(33).onNewMessageList(t),e===G.MESSAGE_MODIFIED&&this.get(33).onMessageModified(t)),e===G.CONVERSATION_LIST_UPDATED||e===G.FRIEND_LIST_UPDATED||e===G.GROUP_LIST_UPDATED||e===G.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?!1!==this._eventThrottling?this._eventThrottleMap.has(e)?(n=Date.now())-(o=this._eventThrottleMap.get(e)).last<=1e3?(-1<o.timeoutID&&clearTimeout(o.timeoutID),o.timeoutID=setTimeout(function(){o.last=Date.now(),i._oEmitter._emit.apply(i._oEmitter,[e,{name:e,data:i._getEventData(e)}])},1e3)):(o.last=n,this._oEmitter._emit.apply(this._oEmitter,[e,{name:e,data:this._getEventData(e)}])):(this._eventThrottleMap.set(e,{last:Date.now(),timeoutID:-1}),this._oEmitter._emit.apply(this._oEmitter,[e,{name:e,data:this._getEventData(e)}])):this._oEmitter._emit.apply(this._oEmitter,[e,{name:e,data:this._getEventData(e)}]):this._oEmitter._emit.apply(this._oEmitter,[e,{name:e,data:t}])}.bind(this)),this._oEmitter;var e}},{key:"_canIUseSignaling",value:function(){var e=this.get(33);return!!e&&e.canIUseSignaling()}},{key:"_getEventData",value:function(e){return e===G.CONVERSATION_LIST_UPDATED?this._map.get(12).isPartialUpdatedConvs()?this._map.get(11).getPartialUpdatedConvs():this._map.get(11).getLocalConvList():e===G.FRIEND_LIST_UPDATED?this._map.get(8).getLocalFriendList(!1):e===G.GROUP_LIST_UPDATED?this._map.get(7).getLocalGroupList():e===G.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._map.get(11).getTotalUnreadCount():e===G.CONVERSATION_ID_LIST_UPDATED?this._map.get(11).getUpdatedConvIDList():void 0}},{key:"getIEmitInst",value:function(){return null===this._iEmitter&&(this._iEmitter=new La,this._iEmitter._emit=this._iEmitter.emit,this._iEmitter.emit=function(e,t){e=et(t)&&t.data?[e,{name:e,data:t.data}]:[e,{name:e,data:t}];this._iEmitter._emit.apply(this._iEmitter,e)}.bind(this)),this._iEmitter}},{key:"hasModule",value:function(e){return this._map.has(e)}},{key:"get",value:function(e){return this._map.get(e)}},{key:"canIUseModule",value:function(e){return!this._map.get(12).isUsingChatCore()||this._optionalModuleMap.has(e)}},{key:"canIUseInflate",value:function(){return!!this._map.get(37)}},{key:"isReady",value:function(){return this._isReady}},{key:"isIntl",value:function(){return this.get(12).isIntl()}},{key:"getNotReadyReason",value:function(){return this._reason}},{key:"setNotReadyReason",value:function(e){this._reason=e}},{key:"getErrMsg",value:function(e,t,n){return this._map.get(32).get({key:e,replacement1:t,replacement2:n,isIntl:this.isIntl()})}},{key:"warn",value:function(e,t,n){e=this.getErrMsg(e,t,n);e&&v.w(e)}},{key:"onError",value:function(e){var t="code:".concat(e.code," message:").concat(e.message);v.w("Oops! ".concat(t)),new M("error").setMessage(t).setLevel("error").end(),this.getOEmitInst().emit(G.ERROR,e)}},{key:"restartTimer",value:function(){v.l("".concat(this._n,".restartTimer")),this.stopTimer(),this._startTimer();var e=this.get(7);e&&e.restartPolling()}},{key:"getTimerID",value:function(){var e=this._map.get(24);return e.isWorkerEnabled()?e.getTimerID():this._checkTimer}},{key:"getPollingTimerID",value:function(e){return this._map.get(7).getPollingTimerID(e)}},{key:"statTUIKeyFeatures",value:function(e){var t=e.code,e=e.msg,e=void 0===e?"":e,n=t+e;this._codeMsgForTUIMap.has(n)||(this._codeMsgForTUIMap.set(n,1),n=this.get(12).getUIPlatform(),new M("tui_key_features").setCode(t).setMessage(e).setUIPlatform(n).end())}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),Ae();var e,t=N(this._map);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2)[1];n.reset&&n.reset()}}catch(e){t.e(e)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._oEmitter.emit(G.SDK_NOT_READY);var o,i=N(this._eventThrottleMap);try{for(i.s();!(o=i.n()).done;){var a=m(o.value,2)[1];-1<a.timeoutID&&clearTimeout(a.timeoutID)}}catch(e){i.e(e)}finally{i.f()}this._eventThrottleMap.clear(),this._codeMsgForTUIMap.clear()}}]),Xc),Yc=(e(zc,[{key:"defense",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:void 0;if("string"!=typeof e)return null;if(0===e.length)return null;if("function"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);var o=null;return this._funcMap.get(e).has(t)?o=this._funcMap.get(e).get(t):(o=this._pack(e,t,n),this._funcMap.get(e).set(t,o)),o}},{key:"defenseOnce",value:function(e,t){return"function"!=typeof t?null:this._pack(e,t,2<arguments.length&&void 0!==arguments[2]?arguments[2]:void 0)}},{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):(this._m.warn("ListenerFnNotFound",e),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(o,e,i){var a=this;return function(){try{e.apply(i,Array.from(arguments))}catch(e){var t=Object.values(G).indexOf(o),n="CallbackError";-1!==t&&(t=Object.keys(G)[t],a._m.warn(n,t,e)),a._reportCount<5&&(new M(n).setMessage("eventName:".concat(o)).setMoreMessage(e.message).end(),a._reportCount+=1)}}}},{key:"destroy",value:function(){this._funcMap.clear()}},{key:"reset",value:function(){v.l("".concat(this._n,".reset")),this._reportCount=0}}]),zc),Wc=(e(Jc,[{key:"onError",value:function(e){this._m.onError(e)}},{key:"login",value:function(e){return this._m.login(),this._get(1).login(e)}},{key:"logout",value:function(){var t=this;return this._get(1).logout().then(function(e){return t._safetyCallbackFactory.reset(),t._m.reset(),e})}},{key:"getLoginUser",value:function(){return this._get(1).getLoginUser()}},{key:"getServerTime",value:function(){return Pe()}},{key:"isReady",value:function(){return this._m.isReady()}},{key:"isIntl",value:function(){return this._m.isIntl()}},{key:"getNotReadyReason",value:function(){return this._m.getNotReadyReason()}},{key:"getErrMsg",value:function(e,t,n){return this._m.getErrMsg(e,t,n)}},{key:"_get",value:function(e){return this._m.get(e)}},{key:"destroy",value:function(){var e=this,t=this._get(12),n=t.getSDKAppID();return v.w("destroy ".concat(n," ").concat(t.getInstanceID())),this.logout().finally(function(){e._safetyCallbackFactory.destroy(),e._m.stopTimer(),e._get(24).terminate(),e._get(21).dealloc(),e._m.getOEmitInst().emit(G.SDK_DESTROY,{SDKAppID:n})})}},{key:"on",value:function(e,t,n){v.d("on","eventName:".concat(e)),this._m.getOEmitInst().on(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"once",value:function(e,t,n){v.d("once","eventName:".concat(e)),this._m.getOEmitInst().once(e,this._safetyCallbackFactory.defenseOnce(e,t,n),n||this)}},{key:"off",value:function(e,t,n,o){v.d("off","eventName:".concat(e));var i=this._safetyCallbackFactory.find(e,t);null!==i&&(this._m.getOEmitInst().off(e,i,n,o),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){(A(e["tim-push"])?A(e["tim-offline-push-plugin"])?this._get(18):this._get(28):this._get(36)).registerPlugin(e)}},{key:"setLogLevel",value:function(e){var t;e<=0&&((t=this.getErrMsg("TIM_ASCII_ART"))&&console.log(t),(t=this.getErrMsg("API_REFER"))&&(Jt()?console.log("%c ".concat("IM SDK API ->"," %c"),"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",t):console.log("IM SDK API ->",t)),(t=this.getErrMsg("DOCS_GUIDE"))&&console.log(t),t=this.getErrMsg("IOS_WEBVIEW_WARNING"),De&&t&&console.warn(t)),v.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._get(2).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._get(2).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._get(2).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._get(2).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._get(2).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._get(2).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._get(2).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._get(2).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._get(2).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._get(2).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==R.MSG_MERGER?C({code:T.MSG_MERGER_TYPE_INVALID}):Je(e.payload.downloadKey)?C({code:T.MSG_MERGER_KEY_INVALID}):this._get(2).downloadMergerMessage(e).catch(function(e){return C({code:T.MSG_MERGER_DOWNLOAD_FAIL})})}},{key:"createForwardMessage",value:function(e){return this._get(2).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof Ro?this._get(2).sendMessageInstance(e,t):C({code:T.MSG_INSTANCE_REQUIRED})}},{key:"callExperimentalAPI",value:function(e,t){return"sendComboMessage"===e?this._get(31).sendMessage(t):"handleGroupInvitation"===e?this._get(7).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._get(27).isFeatureEnabled(t):"isFeatureEnabledForStat"===e?this._get(27).isFeatureEnabledForStat(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e||"sendRoomCustomData"===e?this._get(30).sendTRTCCustomData(t):"getTimerID"===e?this._m.getTimerID():"getPollingTimerID"===e?this._m.getPollingTimerID(t):"setApplicationID"===e?(this._get(12).setApplicationID(t),void this._get(20).updateProtocolConfig()):"getServerConfig"===e?this._get(23).getServerConfig(t):"canIUseModule"===e?this._m.canIUseModule(t):"startMessageLongPolling"===e?this._get(7).startMessageLongPolling(t):"stopMessageLongPolling"===e?this._get(7).stopMessageLongPolling(t):"disableMessagePullOnInvite"===e?this._get(11).disableMsgPullOnInvite(t):"clearLocalMessage"===e?this._get(11).clearMemMsg(t,!1):"setCustomLoginInfo"===e?this._get(12).setCustomLoginInfo(t):"statTUIKeyFeatures"===e?this._m.statTUIKeyFeatures(t):C({code:T.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._get(2).revokeMessage(e)}},{key:"resendMessage",value:function(e,t){return e instanceof Ro?this._get(2).resendMessage(e,t):C({code:T.MSG_INSTANCE_REQUIRED})}},{key:"deleteMessage",value:function(e){return this._get(2).deleteMessage(e)}},{key:"translateText",value:function(e){return this._get(2).translateText(e)}},{key:"convertVoiceToText",value:function(e){return this._get(2).convertVoiceToText(e)}},{key:"setMessageExtensions",value:function(e,t){return this._get(3).setMessageExtensions(e,t)}},{key:"getMessageExtensions",value:function(e){return this._get(3).getMessageExtensions(e)}},{key:"deleteMessageExtensions",value:function(e,t){return this._get(3).deleteMessageExtensions(e,t)}},{key:"addMessageReaction",value:function(e,t){return this._get(34).addMessageReaction(e,t)}},{key:"removeMessageReaction",value:function(e,t){return this._get(34).removeMessageReaction(e,t)}},{key:"getMessageReactions",value:function(e){return this._get(34).getMessageReactions(e)}},{key:"getAllUserListOfMessageReaction",value:function(e){return this._get(34).getAllUserListOfMessageReaction(e)}},{key:"modifyMessage",value:function(e){return this._get(2).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._get(11).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._get(11).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._get(11).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._get(11).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){var t=this._get(7);return t?t.getReadReceiptDetail(e):C({code:T.NO_MODULE})}},{key:"findMessage",value:function(e){return this._get(11).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._get(11).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._get(11).getConvList(e)}},{key:"getConversationProfile",value:function(e){return this._get(11).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._get(11).deleteConversation(e)}},{key:"setConversationDraft",value:function(e){return this._get(11).setConvDraft(e)}},{key:"clearHistoryMessage",value:function(e){return this._get(11).clearHistoryMessage(e)}},{key:"pinConversation",value:function(e){return this._get(11).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._get(11).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._get(11).setMessageRemindType(e)}},{key:"setAllReceiveMessageOpt",value:function(e){return this._get(11).setAllRcvMsgOpt(e)}},{key:"getAllReceiveMessageOpt",value:function(){return this._get(11).getAllRcvMsgOpt()}},{key:"getTotalUnreadMessageCount",value:function(){return this._get(11).getTotalUnreadCount()}},{key:"setConversationCustomData",value:function(e){return this._get(11).setConvCustomData(e)}},{key:"markConversation",value:function(e){return this._get(11).markConv(e)}},{key:"getConversationGroupList",value:function(){return this._get(11).getConvGroupList()}},{key:"createConversationGroup",value:function(e){return this._get(11).createConvGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._get(11).deleteConvGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._get(11).renameConvGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._get(11).addConvsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._get(11).deleteConvsFromGroup(e)}},{key:"searchCloudMessages",value:function(e){var t=this._get(38);return t?t.searchCloudMessages(e):C({code:T.NO_MODULE})}},{key:"searchCloudUsers",value:function(e){var t=this._get(38);return t?t.searchCloudUsers(e):C({code:T.NO_MODULE})}},{key:"searchCloudGroups",value:function(e){var t=this._get(38);return t?t.searchCloudGroups(e):C({code:T.NO_MODULE})}},{key:"searchCloudGroupMembers",value:function(e){var t=this._get(38);return t?t.searchCloudGroupMembers(e):C({code:T.NO_MODULE})}},{key:"getMyProfile",value:function(){return this._get(4).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._get(4).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._get(4).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._get(4).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._get(4).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._get(4).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._get(4).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._get(4).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._get(4).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._get(4).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._get(8);return e?e.getLocalFriendList():C({code:T.NO_MODULE})}},{key:"addFriend",value:function(e){var t=this._get(8);return t?t.addFriend(e):C({code:T.NO_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._get(8);return t?t.deleteFriend(e):C({code:T.NO_MODULE})}},{key:"checkFriend",value:function(e){var t=this._get(8);return t?t.checkFriend(e):C({code:T.NO_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._get(8);return t?t.getFriendProfile(e):C({code:T.NO_MODULE})}},{key:"updateFriend",value:function(e){var t=this._get(8);return t?t.updateFriend(e):C({code:T.NO_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._get(8);return e?e.getLocalFriendApplicationList():C({code:T.NO_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._get(8);return t?t.acceptFriendApplication(e):C({code:T.NO_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._get(8);return t?t.refuseFriendApplication(e):C({code:T.NO_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._get(8);return t?t.deleteFriendApplication(e):C({code:T.NO_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._get(8);return e?e.setFriendApplicationRead():C({code:T.NO_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._get(8);return e?e.getLocalFriendGroupList():C({code:T.NO_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._get(8);return t?t.createFriendGroup(e):C({code:T.NO_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._get(8);return t?t.deleteFriendGroup(e):C({code:T.NO_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._get(8);return t?t.addToFriendGroup(e):C({code:T.NO_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._get(8);return t?t.removeFromFriendGroup(e):C({code:T.NO_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._get(8);return t?t.renameFriendGroup(e):C({code:T.NO_MODULE})}},{key:"followUser",value:function(e){var t=this._get(35);return t?t.followUser(e):C({code:T.NO_MODULE})}},{key:"unfollowUser",value:function(e){var t=this._get(35);return t?t.unfollowUser(e):C({code:T.NO_MODULE})}},{key:"getMyFollowersList",value:function(e){var t=this._get(35);return t?t.getMyFollowersList(e):C({code:T.NO_MODULE})}},{key:"getMyFollowingList",value:function(e){var t=this._get(35);return t?t.getMyFollowingList(e):C({code:T.NO_MODULE})}},{key:"getMutualFollowersList",value:function(e){var t=this._get(35);return t?t.getMutualFollowersList(e):C({code:T.NO_MODULE})}},{key:"getUserFollowInfo",value:function(e){var t=this._get(35);return t?t.getUserFollowInfo(e):C({code:T.NO_MODULE})}},{key:"checkFollowType",value:function(e){var t=this._get(35);return t?t.checkFollowType(e):C({code:T.NO_MODULE})}},{key:"getGroupList",value:function(){var e=this._get(7);return e?e.getGroupList():C({code:T.NO_MODULE})}},{key:"getGroupProfile",value:function(e){var t=this._get(7);return t?t.getGroupProfile(e):C({code:T.NO_MODULE})}},{key:"createGroup",value:function(e){var t=this._get(7);return t?t.createGroup(e):C({code:T.NO_MODULE})}},{key:"dismissGroup",value:function(e){var t=this._get(7);return t?t.dismissGroup(e):C({code:T.NO_MODULE})}},{key:"updateGroupProfile",value:function(e){var t=this._get(7);return t?t.updateGroupProfile(e):C({code:T.NO_MODULE})}},{key:"joinGroup",value:function(e){var t=this._get(7);return t?t.joinGroup(e):C({code:T.NO_MODULE})}},{key:"quitGroup",value:function(e){var t=this._get(7);return t?t.quitGroup(e):C({code:T.NO_MODULE})}},{key:"searchGroupByID",value:function(e){var t=this._get(7);return t?t.searchGroupByID(e):C({code:T.NO_MODULE})}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._get(7);return t?t.getGroupOnlineMemberCount(e):C({code:T.NO_MODULE})}},{key:"changeGroupOwner",value:function(e){var t=this._get(7);return t?t.changeGroupOwner(e):C({code:T.NO_MODULE})}},{key:"getGroupApplicationList",value:function(){var e=this._get(7);return e?e.getGroupApplicationList():C({code:T.NO_MODULE})}},{key:"handleGroupApplication",value:function(e){var t=this._get(7);return t?t.handleGroupApplication(e):C({code:T.NO_MODULE})}},{key:"initGroupAttributes",value:function(e){var t=this._get(7);return t?t.initGroupAttributes(e):C({code:T.NO_MODULE})}},{key:"setGroupAttributes",value:function(e){var t=this._get(7);return t?t.setGroupAttributes(e):C({code:T.NO_MODULE})}},{key:"deleteGroupAttributes",value:function(e){var t=this._get(7);return t?t.deleteGroupAttributes(e):C({code:T.NO_MODULE})}},{key:"getGroupAttributes",value:function(e){var t=this._get(7);return t?t.getGroupAttributes(e):C({code:T.NO_MODULE})}},{key:"setGroupCounters",value:function(e){var t=this._get(7);return t?t.setGroupCounters(e):C({code:T.NO_MODULE})}},{key:"increaseGroupCounter",value:function(e){var t=this._get(7);return t?t.increaseGroupCounter(e):C({code:T.NO_MODULE})}},{key:"decreaseGroupCounter",value:function(e){var t=this._get(7);return t?t.decreaseGroupCounter(e):C({code:T.NO_MODULE})}},{key:"getGroupCounters",value:function(e){var t=this._get(7);return t?t.getGroupCounters(e):C({code:T.NO_MODULE})}},{key:"getGroupMemberList",value:function(e){var t=this._get(7);return t?t.getGroupMemberList(e):C({code:T.NO_MODULE})}},{key:"getGroupMemberProfile",value:function(e){var t=this._get(7);return t?t.getGroupMemberProfile(e):C({code:T.NO_MODULE})}},{key:"addGroupMember",value:function(e){var t=this._get(7);return t?t.addGroupMember(e):C({code:T.NO_MODULE})}},{key:"deleteGroupMember",value:function(e){var t=this._get(7);return t?t.deleteGroupMember(e):C({code:T.NO_MODULE})}},{key:"setGroupMemberMuteTime",value:function(e){var t=this._get(7);return t?t.setGroupMemberMuteTime(e):C({code:T.NO_MODULE})}},{key:"setGroupMemberRole",value:function(e){var t=this._get(7);return t?t.setGroupMemberRole(e):C({code:T.NO_MODULE})}},{key:"setGroupMemberNameCard",value:function(e){var t=this._get(7);return t?t.setGroupMemberNameCard(e):C({code:T.NO_MODULE})}},{key:"setGroupMemberCustomField",value:function(e){var t=this._get(7);return t?t.setGroupMemberCustomField(e):C({code:T.NO_MODULE})}},{key:"markGroupMemberList",value:function(e){var t=this._get(7);return t?t.markGroupMemberList(e):C({code:T.NO_MODULE})}},{key:"getJoinedCommunityList",value:function(){return this._get(10).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._get(10).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._get(10).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._get(10).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._get(10).getTopicList(e)}},{key:"addSignalingListener",value:function(e,t,n){var o=this._get(33);o&&o.addSignalingListener(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"removeSignalingListener",value:function(e,t,n){var o,i=this._safetyCallbackFactory.find(e,t);null===i||(o=this._get(33))&&(o.removeSignalingListener(e,i,n),this._safetyCallbackFactory.delete(e,t))}},{key:"invite",value:function(e){var t=this._get(33);return t?t.invite(e):C({code:T.NO_MODULE})}},{key:"inviteSync",value:function(e,t,n){var o=this._get(33);return o?o.inviteSync(e,t,n):""}},{key:"inviteInGroup",value:function(e){var t=this._get(33);return t?t.invite(e):C({code:T.NO_MODULE})}},{key:"inviteInGroupSync",value:function(e,t,n){var o=this._get(33);return o?o.inviteSync(e,t,n):""}},{key:"cancel",value:function(e){var t=this._get(33);return t?t.cancel(e):C({code:T.NO_MODULE})}},{key:"accept",value:function(e){var t=this._get(33);return t?t.accept(e):C({code:T.NO_MODULE})}},{key:"reject",value:function(e){var t=this._get(33);return t?t.reject(e):C({code:T.NO_MODULE})}},{key:"getSignalingInfo",value:function(e){var t=this._get(33);return t?t.getSignalingInfo(e):null}},{key:"modifyInvitation",value:function(e){var t=this._get(33);return t?t.modifyInvitation(e):C({code:T.NO_MODULE})}}]),Jc),jc={login:1,logout:1,getLoginUser:1,destroy:1,on:1,off:1,ready:1,setLogLevel:1,joinGroup:1,quitGroup:1,registerPlugin:1,getGroupOnlineMemberCount:1,isReady:1,addSignalingListener:1,removeSignalingListener:1,callExperimentalAPI:1};function Jc(e){d(this,Jc);e={SDKAppID:e.SDKAppID,unlimitedAVChatRoom:e.unlimitedAVChatRoom||!1,scene:e.scene||"",oversea:e.oversea||!1,instanceID:Ut(),devMode:e.devMode||!1,testEnv:e.testEnv||!1,proxyServer:e.proxyServer||void 0,fileUploadProxy:e.fileUploadProxy||void 0,fileDownloadProxy:e.fileDownloadProxy||e.fileUploadProxy||void 0,eventThrottling:!1!==e.eventThrottling,partialUpdatedConversations:!0===e.partialUpdatedConversations,disableIndependentDomain:!0===e.disableIndependentDomain,modules:e.modules||void 0};this._m=new Kc(e),this._safetyCallbackFactory=new Yc(this._m)}function zc(e){d(this,zc),this._funcMap=new Map,this._m=e,this._n="SafetyCallback",this._reportCount=0}function Xc(t){var n=this;d(this,Xc);var o,e=new M("sdkConstruct"),i=(this._n="ModuleManager",this._isReady=!1,this._reason=T.USER_NOT_LOGGED_IN,this._startLoginTs=0,this._map=new Map,this._optionalModuleMap=new Map,this._codeMsgForTUIMap=new Map,this._iEmitter=null,this._oEmitter=null,this._checkCount=0,this._checkTimer=-1,this._map.set(12,new wi(this,t)),this._map.set(37,new Pc(this)),this._map.set(15,new Ia(this)),this._map.set(27,new lr(this)),this._map.set(23,new Js(this)),this._map.set(24,new cr(this)),this._map.set(26,new er(this)),this._map.set(21,new ms(this)),this._map.set(20,new js(this)),this._map.set(1,new qi(this)),this._map.set(2,new Ba(this)),this._map.set(3,new Ka(this)),this._map.set(34,new Ya(this)),this._map.set(31,new Wa(this)),this._map.set(4,new bi(this)),this._map.set(6,new Yo(this)),this._map.set(11,new gi(this)),this._map.set(7,new ki(this)),this._map.set(10,new Oi(this)),this._map.set(13,new ha(this)),this._map.set(32,new gr(this)),this._map.set(14,new fa(this)),this._map.set(17,new Ra(this)),this._map.set(18,new ja(this)),this._map.set(19,new Ja(this)),this._map.set(25,new zs(this)),this._map.set(8,new rr(this)),this._map.set(28,new dr(this)),this._map.set(36,new pr(this)),this._map.set(29,new _r(this)),this._map.set(30,new hr(this)),this._map.set(33,new Cr(this)),this._map.set(35,new Lr(this)),this._map.set(38,new Bc(this)),this._eventThrottleMap=new Map,this._eventThrottling=t.eventThrottling,this._map.get(12).isPartialUpdatedConvs()&&(this._eventThrottling=!1),et(t.modules)?(Object.keys(t.modules).forEach(function(e){o=t.modules[e],"group-module"===e?n._map.set(7,new o(n)):"relationship-module"===e?n._map.set(8,new o(n)):"signaling-module"===e?n._map.set(33,new o(n)):"follow-module"===e?n._map.set(35,new o(n)):"cloud-search-module"===e&&n._map.set(38,new o(n)),n._optionalModuleMap.set(e,1)}),this._map.get(12).setUsingChatCore(!0)):this._map.has(7)||this._map.get(12).setUsingChatCore(!0),t.instanceID),a=t.SDKAppID,s=this._map.get(12).isIntl(),r=this._map.get(12).isUsingChatCore(),i="instanceID:".concat(i," SDKAppID:").concat(a," isIntl:").concat(s," isUsingChatCore:").concat(r," host:").concat(bt())+" isIOSWebView:".concat(De," platform:").concat(de," canIUseInflate:").concat(this.canIUseInflate())+" workerAvailable:".concat(ye," eventThrottling:").concat(this._eventThrottling," UserAgent:").concat(le);M.bindEventStatModule(this._map.get(14)),M.bindNetMonitorModule(this._map.get(15)),e.setMessage("".concat(i," ").concat(function(){var t="";if(ae)try{var e=ue.getSystemInfoSync(),n=e.model,o=e.version,i=e.system,a=e.platform,s=e.SDKVersion,t="model:".concat(n," version:").concat(o," system:").concat(i," platform:").concat(a," SDKVersion:").concat(s)}catch(e){t=""}return t}())).end(),v.i("SDK ".concat(i)),Bn.prototype._getErrMsg=this.getErrMsg.bind(this),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}function Zc(e){return d(this,Zc),(e=Nc.call(this,e))._n="CSModule",e}function Qc(e){d(this,Qc),this._m=e,this._n="InflateModule",this._bLogForInflateOK=!1,this._bLogForInflateError=!1}var $c={},oe={};return oe.create=function(e){var t="TencentCloudChat.create",n=0,o=e.SDKAppID;if(Qe(o))n=o;else if(n=parseInt(o),isNaN(o))return v.e("".concat(t," failed. Failed to parse the SDKAppID, please check the arguments")),null;if(n&&$c[n])return $c[n];v.l("".concat(t));var i,a,o=new Wc(y(y({},e),{},{SDKAppID:n})),e=(o.on(G.SDK_DESTROY,function(e){$c[e.data.SDKAppID]=null,delete $c[e.data.SDKAppID]}),i=o,a=Object.create(null),Object.keys(Hn).forEach(function(o){var t;i[o]&&(t=new U,a[o]=function(){var e=Array.from(arguments);return t.use(function(e,t){var n=function(e,t){if(e.isReady()||1===jc[t])return!0;var n={code:n=e.getNotReadyReason(),message:"".concat(e.getErrMsg(n)," | ").concat(t," | ").concat(e.getErrMsg(T.SDK_IS_NOT_READY))};return e.onError(n),n}(i,o);return!0===n?t():C(n)}).use(function(e,t){if(!0===function(n,o,i){if(void 0===o)return!0;var a=!0;if(et(o))Object.keys(o).forEach(function(e){var t=1===n.length?n[0][e]:void 0;a=!!en(t,o[e],i,e)&&a});else if(nt(o))for(var e=0;e<o.length;e++)a=!!en(n[e],o[e],i,o[e].name)&&a;if(a)return a;throw new Error("Params validate failed.")}(e,Vn[o],o))return t()}).use(function(e,t){return i[o].apply(i,e)}),t.run(e)})}),a);return $c[n]=e,Vn.hookGetAPITips(o.getErrMsg.bind(o)),v.l("".concat(t," ok")),e},oe.TYPES=R,oe.EVENT=G,oe.TSignaling=P,oe.VERSION="3.5.2",v.l("TencentCloudChat.VERSION:".concat(oe.VERSION)),oe});