"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 U(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;ee.length)&&(t=e.length);for(var n=0,o=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[a++]}},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 h={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"},A={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"},Q={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},$=(e(de,[{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=Math.pow(2,64)&&(c({api:t,paramName:n,desc:l("NumberLessThanLog",n,"Math.pow(2,64)")}),1)):(c({api:t,paramName:n,desc:un()}),!1)}},enableMark:y({},bn)},createConversationGroup:{conversationIDList:y({},r),groupName:y(y({},o),{},{validator:function(e,t,n){return!(!e||32=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>(-2*a&6))))i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);try{return decodeURIComponent(escape(n))}catch(e){return""}}var jo,Jo,zo,Xo,Zo,Qo=["jpg","jpeg","gif","png","bmp","image","webp"],$o=["mp4","quicktime","mov"],ei=(e(oa,[{key:"validate",value:function(e){var t,n=!0,o="";if(S(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var i=e.profileCustomField.length,a=null,s=0;s=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()}}]),na),ni=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"],oi=(e(ta,[{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)ni.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),N(e.muteAllMembers)||("On"===e.muteAllMembers?e.muteAllMembers=!0:e.muteAllMembers=!1),e.groupCustomField&&kt(this.groupCustomField,e.groupCustomField),N(e.memberNum)||(this.memberCount=e.memberNum),N(e.maxMemberNum)||(this.maxMemberCount=e.maxMemberNum),N(e.isSupportTopic)||(this.isSupportTopic=R(e.isSupportTopic)?1===e.isSupportTopic:e.isSupportTopic),_t(this,e,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),O(e.members)&&0e?(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):eo||n&&a.sequence>n)){if("in"===a.flow&&a.isRead)break;a.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t,n=!(1c&&e.sequence<=r:e.sequence>c&&e.sequencec&&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=i.MAX_CHECK_COUNT?(i._deleteCachedGroupTips(t),i._checkCountMap.delete(t)):i._checkCountMap.set(t,++n)})}},{key:"onNewGroupTips",value:function(e){M.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=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=this.CACHE_EXPIRE_TIME||r=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:o,avChatRoomKey:a}).then(function(e){s.setMoreMessage("from remote. count:".concat(e.length)).end(),M.l("".concat(n," from remote. groupID:").concat(o));e=t._getLocalCounters(o,i);return C({counters:e})}).catch(function(e){return s.setError(e).end(),D(e)});s.setMoreMessage("from cache").end(),M.l("".concat(n," from cache. groupID:").concat(o));e=this._getLocalCounters(o,i);return T({counters:e})}},{key:"_getRemoteGroupCounters",value:function(n){var o=this;return this._grpM.req({P:k.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}),M.l("".concat(o._n,"._getRemoteGroupCounters ok. groupID:").concat(n.groupID)),t}).catch(function(e){return D(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 M.l("".concat(t,". groupID:").concat(n," avChatRoomKey:").concat(o," mode:").concat(i)),this._grpM.req({P:k.UPDATE_GRP_COUNTER,data:y({},e)}).then(function(e){M.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 D(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,0this._startBroadcastSeq&&(this._startBroadcastSeq=c),O(s)&&01e3*t.expireTime&&1e4=i&&t.messageList.push(e)}),(Nt({groupID:n})||Gt(n))&&0===t.messageList.length&&a[0].sequencei.nextMessageSeq&&(i.updateNextMessageSeq(n),i.updateLastMessage(e),i.updateSelfInfo({readedSequence:t}),i.updateUnreadCount(0),this.emitOEvt(h.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=Jt(n),u=this.getLocalTopic(c,n);u&&(t=u.lastMessage,M.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=zt(t.type,t.payload,this.isIntl()),t.cloudCustomData=s,t.version=r,t.lastSequence=i,t.lastTime=o,this.emitOEvt(h.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=Jt(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(h.TOPIC_UPDATED,{groupID:o,topic:n})}},{key:"isLastMessageRevoked",value:function(e){var t=e.topicID,e=e.sequence,n=Jt(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=Jt(e),a=this.getLocalTopic(i,e);a&&(o=a.selfInfo.excludedUnreadSequenceList||[],N(n)||(o=n),t._isExcludedFromUnreadCount&&o.push(t.sequence),a.updateSelfInfo({excludedUnreadSequenceList:o}),M.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(A.CONV_GROUP).concat(e)))&&t.updateUnreadCount({nextUnreadCount:o,isFromGetConversations:!0}),this.emitOEvt(h.TOPIC_UPDATED,{groupID:i,topic:a}))}},{key:"getJoinedCommunityList",value:function(){return this.get(7).syncCommunityWithTopic()}},{key:"createTopicInCommunity",value:function(t){var n,o=this,i="".concat(this._n,".").concat("createTopicInCommunity"),e=t.topicID;return N(e)||Gt(e)?t.topicName&&!1===this._filterProfanity("topicName",t)||t.introduction&&!1===this._filterProfanity("introduction",t)||t.notification&&!1===this._filterProfanity("notification",t)?D({code:L.PROFANITY_FOUND}):(n=new G("createTopicInCommunity"),this.req({P:k.CREATE_TOPIC,data:y({},t)}).then(function(e){e=e.data.topicID;return n.setMessage("topicID:".concat(e)).end(),M.l("".concat(i," ok. topicID:").concat(e)),o._updateTopicMap([y(y({},t),{},{topicID:e})]),C({topicID:e})}).catch(function(e){return n.setError(e).end(),M.e("".concat(i," failed. error:"),e),D(e)})):D({code:L.ILLEGAL_TOPIC_ID})}},{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 G("deleteTopicFromCommunity");return s.setMessage("groupID:".concat(a," topicIDList:").concat(e)),this.req({P:k.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(),M.l("".concat(n," ok. ").concat(e)),o.forEach(function(e){t._deleteLocalTopic(a,e.topicID)}),C({successTopicList:o,failureTopicList:i})}).catch(function(e){return s.setError(e).end(),M.e("".concat(n," failed. error:"),e),D(e)})}},{key:"updateTopicProfile",value:function(e){var t,n=this,o="".concat(this._n,".").concat("updateTopicProfile");return M.l("".concat(o," options:"),e),e.topicName&&!1===this._filterProfanity("topicName",e)||e.introduction&&!1===this._filterProfanity("introduction",e)||e.notification&&!1===this._filterProfanity("notification",e)?D({code:L.PROFANITY_FOUND}):((t=new G("updateTopicProfile")).setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),N(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.req({P:k.UPDATE_TOPIC_PROFILE,data:y({},e)}).then(function(){return t.end(),M.l("".concat(o," ok")),n._updateTopicMap([e]),C({topic:n.getLocalTopic(e.groupID,e.topicID)})}).catch(function(e){return t.setError(e).end(),M.e("".concat(o," failed. error:"),e),D(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 G("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(),M.l("".concat(n," groupID:").concat(o," from cache, topic count:").concat(s.length)),T({successTopicList:s,failureTopicList:[]})}}return this.req({P:k.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(),M.l("".concat(n," groupID:").concat(o," from remote, ").concat(e)),[]);return S(s)||(t._getTopicTimeMap.set(o,{time:Date.now(),isGetAll:i}),e=t._getLocalTopicList(o,s)),C({successTopicList:e,failureTopicList:r})}).catch(function(e){return c.setError(e).end(),M.e("".concat(n," failed. error:"),e),D(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=1this.MAX_QUERY_USER_COUNT&&(M.w("".concat(o," ").concat($t(this.MAX_QUERY_USER_COUNT))),t=i.slice(0,this.MAX_QUERY_USER_COUNT));var s=new G("getUserStatus");return this._userM.req({P:k.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:Wo(e)}}),e=e.map(function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,e=e.errorInfo;return{userID:S(n)?t:n,code:o,message:e}}),n=(N(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(),M.l("".concat(o," ok. ").concat(n,".")),C({successUserList:t,failureUserList:e})}).catch(function(e){return s.setMessage("userID count:".concat(i.length)).setError(e).end(),M.e("".concat(o," failed. error:"),e),D(e)})}},{key:"subscribeUserStatus",value:function(e){var t,n,o,i,a="subscribeUserStatus";return this._userM.canIUse(_.USER_STATUS)?(t="".concat(this._n,".").concat(a),(n=p(e=void 0===(e=e.userIDList)?[]:e)).length>this.MAX_SUBSCRIBE_USER_COUNT&&(M.w("".concat(t," ").concat($t(this.MAX_SUBSCRIBE_USER_COUNT))),n=e.slice(0,this.MAX_SUBSCRIBE_USER_COUNT)),o=new G(a),i="userID count:".concat(e.length),M.l("".concat(t," ").concat(i)),this._userM.req({P:k.SUB_USER_STATUS,data:{userIDList:n}}).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:S(n)?t:n,code:o,message:e}});return o.setMessage("".concat(i," fail count:").concat(e.length)).end(),M.l("".concat(t," ok. fail count:").concat(e.length,".")),C({failureUserList:e})}).catch(function(e){return o.setMessage(i).setError(e).end(),M.e("".concat(t," failed. error:"),e),D(e)})):this._userM.noUse(a)}},{key:"unsubscribeUserStatus",value:function(e){var t,n,o,i,a="unsubscribeUserStatus";return this._userM.canIUse(_.USER_STATUS)?(t="".concat(this._n,".").concat(a),n=p(e=void 0===(e=(e||{}).userIDList)?[]:e),e.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(M.w("".concat(t," ").concat($t(this.MAX_UNSUBSCRIBE_USER_COUNT))),n=e.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT)),o=new G(a),i="userID count:".concat(e.length),M.l("".concat(t," ").concat(i)),e={userIDList:n},0===n.length&&(e.userIDList=void 0,e.unsubscribeAll=1),this._userM.req({P:k.UNSUB_USER_STATUS,data:e}).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:S(n)?t:n,code:o,message:e}});return o.setMessage("".concat(i," fail count:").concat(e.length)).end(),M.l("".concat(t," ok. fail count:").concat(e.length,".")),C({failureUserList:e})}).catch(function(e){return o.setMessage("".concat(i)).setError(e).end(),M.e("".concat(t," failed. error:"),e),D(e)})):this._userM.noUse(a)}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),bi),Ai=(t(Ui,u),Jo=n(Ui),e(Ui,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"mockOnNickAvatarModified",value:function(e,t){M.l("".concat(this._n,"._mockOnNickAvatarModified nick:").concat(e," avatar:").concat(t)),this.onProfileModified({dataList:[{pushType:1,userID:this.getMyUserID(),profileList:[{tag:g.NICK,value:e},{tag:g.AVATAR,value:t}]}]})}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t,n,e=e.dataList;S(e)||(t=[],e.forEach(function(e){e.blackListDelAccount&&t.push.apply(t,p(e.blackListDelAccount))}),0=this.MIN_THRESHOLD)&&this._report()}},{key:"onCheckTimer",value:function(){Date.now()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");S(t)?(M.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)),M.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1))}},{key:"reset",value:function(){M.l("".concat(this._n,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),ha),la="none",da="online",pa=(e(_a,[{key:"_startRN",value:function(){var e,n=this;ye&&(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");v?(I.getNetworkType({success:function(e){t._networkType=e.networkType||e.subtype||"",e.networkType===la?M.w("".concat(n," no network, please check!")):M.i("".concat(n," networkType:").concat(e.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),I.onNetworkStatusChange(this._mpNetworkStatusCallback)):Ce&&(this._networkType=da,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:da})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:la})}},{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?(M.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,M.w("".concat(n," no network, please check!")),this._m.get(21).offline()),o&&new G("networkChange").setMessage("isConnected:".concat(t," ").concat(i)).end()}},{key:"isOnline",value:function(){return this._networkType!==la}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){M.l("".concat(this._n,".reset")),v?null!==this._mpNetworkStatusCallback&&(I.offNetworkStatusChange&&I.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)):ye&&this._removeListener&&(this._removeListener(),this._removeListener=null)}}]),_a);function _a(e){d(this,_a),this._m=e,this._networkType=da,this._n="NetMonitorModule",this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null,this._removeListener=null,this._m.getIEmitInst().on(P.A2KEY_AND_TINYID_UPDATED,this._startRN,this)}function ha(e){d(this,ha),(e=sa.call(this,e))._n="EventStatModule",e.TAG="im-ssolog-event",e._reportBody=new ca,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(P.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,i(e)),t.on(P.CLOUD_CONFIG,e._onCloudConfig,i(e)),e}function ga(e){d(this,ga),this._n="SSOLogBody",this._report=[]}function fa(e){d(this,fa),this._m=e,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}function ma(e,t){return e(t={exports:{}},t.exports),t.exports}var va,Ia=ma(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=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 A.MSG_IMAGE:return t.addTotalCount(Wn),this._uploadImage(e);case A.MSG_FILE:return t.addTotalCount(Wn),this._uploadFile(e);case A.MSG_AUDIO:return t.addTotalCount(Wn),this._uploadAudio(e);case A.MSG_VIDEO:return t.addTotalCount(Wn),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),lt(t.onProgress))try{t.onProgress(e)}catch(e){return D({code:L.MSG_ONPROGRESS_ERR})}}}).then(function(e){var t=e.location,n=e.fileType,o=e.fileSize,i=e.width,a=e.height,s=e.smallImageUrl,r=e.smallImageWidth,c=e.smallImageHeight,u=e.largeImageUrl,l=e.largeImageWidth,d=e.largeImageHeight,p=e.imageInfoArray,e=I.isPrivateNetWork()?t:It(t);M.updateImageFormat(n);var _,h,g={size:o,url:e,width:i,height:a};if(p&&0this.UPLOAD_SIZE_LIMIT.F?this._checkSizeError("F"):0===e.file.files[0].size?D({code:L.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?D({code:L.MSG_F_IS_EMPTY}):-1===$o.indexOf(e.file.videoFile.type)?D({code:L.MSG_V_TYPES_LIMIT}):(this._setUploadFileType(2),v||ye?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 E({code:L.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?D({code:L.MSG_F_IS_EMPTY}):(this._setUploadFileType(3),this.uploadByCOS(e)):D({code:L.MSG_A_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(t){var c,u,l,d,p=this;return lt(this._cosUploadMethod)?this.timUploadPlugin?this._uploadWithPreSigUrl(t):(c=new G("upload"),u="".concat(this._n,".uploadByCOS"),l=Date.now(),d=this._getFile(t),new Promise(function(a,s){var e=v?p._createCosOptionsWXMiniApp(t):p._createCosOptionsWeb(t),r=p;p._cosUploadMethod(e,function(e,t){var n,o,i=Object.create(null);t?e||O(t.files)&&t.files[0].error?(n=new E({code:L.MSG_F_UPLOAD_FAIL}),c.setError(n).end(),M.l("".concat(u," failed. error:"),t.files[0].error),403===t.files[0].error.statusCode&&p._getAuthorizationKey(),s(n)):(i.fileName=d.name,i.fileSize=d.size,i.fileType=d.type.slice(d.type.indexOf("/")+1).toLowerCase(),i.location=(v?t:t.files[0].data).Location,n=Date.now()-l,t=r._formatFileSize(d.size),o=r._formatSpeed(1e3*d.size/n),t="size:".concat(t," time:").concat(n,"ms speed:").concat(o),M.l("".concat(u," success. name:").concat(d.name," ").concat(t)),a(i),(o=p.get(26)).addCost(Wn,n),o.addFileSize(Wn,d.size),c.setMessage(t).end()):(i=new E({code:L.MSG_F_UPLOAD_FAIL}),c.setError(i).end(),M.w("".concat(u," failed. error:"),e),403===e.statusCode&&p._getAuthorizationKey(),s(i))})})):(this.warn("PluginUndetected"),D({code:L.COS_UNDETECTED}))}},{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 G("upload"),e=d.requestSnapshotUrl,c=void 0===e?void 0:e,u=K(d,ya),l=Date.now();p._cosUploadMethod(u,function(e,t){if(e||403===t.statusCode)r.setError(new E(e)).end(),o={HttpStatusCode:9999,CostTime:nn(l,!1),error:e,url:d.url},t.data&&t.data.uploadIP&&(o.uploadIP=t.data.uploadIP),p._uploadSSOLog(o),M.l("".concat(_," failed, error:"),e),s(new E({code:L.MSG_F_UPLOAD_FAIL}));else{var n=Object.create(null),o=t.data.location||"",e=(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,nn(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)),i=(M.l("".concat(_," ok. name:").concat(h.name," ").concat(o)),r.setMessage(o).end(),{HttpStatusCode:t.statusCode,FileSize:h.size,CostTime:e,url:d.url}),o=(t.data&&t.data.uploadIP&&(i.uploadIP=t.data.uploadIP),p._uploadSSOLog(i),p.get(26)),i=(o.addCost(Wn,e),o.addFileSize(Wn,h.size),[]);if(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>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533}else t<=57343&&(t=65533);return t<=2047?es(192|t>>>6,128|63&t):es(224|t>>>12,128|t>>>6&63,128|63&t)},ns=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,ts),n=0|t.length,o=new Uint8Array(n),i=0;i=i&&(M.l("".concat(a._n,"._checkPromiseMap request timeout, delete requestID:").concat(t)),a._promiseMap.delete(t),n(new E({code:L.NETWORK_TIMEOUT,data:{headSeq:e}})),a._chM.onRequestTimeout())})}},{key:"_checkNativeAppWS",value:function(){Ie&&!this.isConnected()&&this._reConnect()}},{key:"onOpen",value:function(e){var t,n;this._readyState!==cs&&(this._onOpenTs=Date.now(),n=e.id,e=e.res,this._socketID=n,t=nn(this._startTs,!1),n="socketID:".concat(n," res:").concat(e),M.l("".concat(this._n,"._onOpen cost:").concat(t," ms. ").concat(n)),new G("wsOnOpen").setMessage(t).setCostTime(t).setMoreMessage(n).end(),this._readyState=ss,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 G("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),M.l("".concat(this._n,"._onClose ").concat(o," onlineTime:").concat(i)),n===this._socketID&&(this._readyState=cs,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 G("wsOnError").setMessage(e.errMsg||JSON.stringify(e,["message","code"])).setMoreMessage(n).setLevel("error").end(!0),M.w("".concat(this._n,"._onError"),e,n),t===this._socketID&&(this._readyState=cs,this._chM.onError())}},{key:"onMessage",value:function(t){var e,n,o,i,a,s;try{e=JSON.parse(t.data)}catch(e){new G("jsonParseError").setMessage(t.data).end()}e&&e.head&&(t=this._getRequestIDFromHead(e.head),n=e.body,this._chM.get(30).isTRTCCommand(t)||(s=Kt(e.head),n=function t(e,n){var o,i,a;return O(e)?e.map(function(e){return ut(e)?t(e,n):e}):ut(e)?(o=e,i=function(e,t){return N(n[t])?Xa(t):n[t]},a={},Object.keys(o).forEach(function(e){a[i(o[e],e)]=o[e]}),wt(a,function(e){return O(e)||ut(e)?t(e,n):e})):void 0}(e.body,this._getResKeyMap(s))),M.d("".concat(this._n,".onMessage ret:").concat(JSON.stringify(n)," requestID:").concat(t," has:").concat(this._promiseMap.has(t))),this._setNextPingTs(),this._promiseMap.has(t)?(o=(s=this._promiseMap.get(t)).resolve,i=s.reject,a=s.timestamp,s=s.headSeq,this._promiseMap.delete(t),this._calcRTT(a),n.errorCode&&0!==n.errorCode?(this._chM.onErrorCodeNotZero(n),i(new E({code:n.errorCode,message:n.errorInfo||"",data:t.includes(k.MODIFY_C2C_MSG)||t.includes(k.MODIFY_GRP_MSG)?{elements:n.elements,messageVersion:n.messageVersion,cloudCustomData:n.cloudCustomData,headSeq:s}:{headSeq:s}}))):o(C(n))):this._chM.onMessage({head:e.head,body:n}))}},{key:"_calcRTT",value:function(e){e=Date.now()-e;this._chM.get(26).addRTT(e)}},{key:"_connect",value:function(){this._readyState!==rs&&this._readyState!==ss&&(this._startTs=Date.now(),this._onOpenTs=0,this._readyState=rs,this._socket=new os(this),this._socketID=this._socket.getID(),M.l("".concat(this._n,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new G("wsConnect").setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end())}},{key:"getURL",value:function(){this._chM.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=xt(),t=((ve||_e&&"windows"===e||Ie)&&(this._canIUseBinaryFrame=!1),-1),n=("ios"===e?t=Le||-1:"android"===e&&(t=ke||-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.4.7");return he&&(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){M.l("".concat(this._n,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=cs)}},{key:"_resend",value:function(){var i=this;if(M.l("".concat(this._n,"._resend reConnectFlag:").concat(this._reConnectFlag),"promiseMap.size:".concat(this._promiseMap.size," simpleRequestMap.size:").concat(this._simpleRequestMap.size)),0=this._socketHandler.getNextPingTs()&&this._ping()}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),-1>>30-e)}function As(e,t){for(var n=e.toString(16),o=t-n.length,i="0";0>>=1,i+=i)1&o&&(n=i+n);return n}t(Wr,u),xs=n(Wr),e(Wr,[{key:"_init",value:function(){this._updateCmdFreqLimitMap(ms)}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");N(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){M.d("".concat(this._n,".req options:"),e);var t,n,o=e.P;return this._pHandler.has(o)?(t=(e=this.getProtocolData(e)).head.servcmd,this._isFreqOverLimit(t)?D({code:n=L.OVER_FREQUENCY_LIMIT,message:this.getErrMsg(n,this._getCmd(t))}):this._isServerOverload(t)?D({code:n=L.OPEN_SERVICE_OVERLOAD_ERROR,message:this.getErrMsg(n,this._getCmd(t))}):(n=this.get(21),gs.includes(o)?n.simplySend(e):n.send(e))):(M.w("".concat(this._n,".req unknown P:").concat(o)),D({code:L.NO_PROTOCOL}))}},{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:ae,websdkversion:oe,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:Ss(""),cappid:e.getApplicationID()}}},{key:"genCosSpecifiedHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:ae,websdkversion:oe,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:12775283,sdkability_ext:Ss(""),cappid:e.getApplicationID()}}},{key:"genSSOReportHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:ae,websdkversion:oe,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:12775283,sdkability_ext:Ss(""),cappid:e.getApplicationID()}}},{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===L.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!==L.MSG_A2KEY_EXPIRED&&n!==L.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(){M.l("".concat(this._n,".reLoginOnKickOther")),this._reLogin()}},{key:"_reLoginOnReconnected",value:function(){M.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 G("reLogin"),this.req({P:k.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=Wo(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),M.l("".concat(c," ok. ").concat(a)),n.getCustomStatus()!==o&&r.get(4).onUserStatusUpdated({dataList:[{to:r.getMyUserID(),statusType:A.USER_STATUS_ONLINE,customStatus:e}]}),i.diagnose(),r.get(11).syncConvList(r._incrementalPullContactFlag).then(function(){M.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:k.MSG_PUSH_ACK,data:{sessionData:e}})}},{key:"_isFreqOverLimit",value:function(e){var t,n,o,i,e=e.split(".")[1];return!!this._cmdFreqLimitMap.has(e)&&(!this._cmdReqInfoMap.has(e)||(t=(n=this._cmdFreqLimitMap.get(e)).count,n=n.interval,o=(i=this._cmdReqInfoMap.get(e)).startTime,i=i.requestCount,Date.now()-o>1e3*n)?(this._cmdReqInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1):(this._cmdReqInfoMap.set(e,{startTime:o,requestCount:i+=1}),t=this._expiredTime}},{key:"fetchConfig",value:function(){var o,i=this,a="".concat(this._n,".fetchConfig"),e=this._canFetch();M.l("".concat(a," canFetch:").concat(e)),e&&(o=new G("fetchCloudCtrlConfig"),e=this.get(12).getSDKAppID(),this._isFetching=!0,this.req({P:k.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(),M.l("".concat(a," ok")),i._parse(e.data)}).catch(function(e){i._isFetching=!1,o.setError(e).end(),M.l("".concat(a," failed. error:"),e),i._setExpiredTime(12e4)}))}},{key:"onPushedConfig",value:function(e){M.l("".concat(this._n,".onPushedConfig config:"),e),new G("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()||M.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(P.CLOUD_CONFIG))}this._setExpiredTime(1e3*r)}else N(o)?(M.l("".concat(n," failed. Invalid message format:"),e),this._setExpiredTime(36e5)):(M.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(){M.l("".concat(this._n,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),Yr),Bs=(t(Kr,u),Fs=n(Kr),e(Kr,[{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===A.CONV_GROUP&&e.groupProfile.type!==A.GRP_AVCHATROOM}),r=this.get(11),c=[];e.forEach(function(e){var t=e.conversationID,e=e.lastMessage;n=t.replace(A.CONV_GROUP,""),o=r.getLocalLastMessage(t),e&&0!==e.lastSequence&&o&&(i=e.lastSequence,o=o.sequence,a=i-o,0n[0])&&a",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 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,M.l("".concat(t._n,"._init seed:").concat(t._timerID))):t._m.onCheckTimer()})}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("enable_worker");M.l("".concat(this._n,"._onCloudConfig enableWorker:").concat(e)),N(e)||"1"===e?!this._isWorkerEnabled&&Ge&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&Ge&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:"terminate",value:function(){M.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(){M.l("".concat(this._n,".reset"))}}]),Nr),or=(e(Or,[{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 ee(0,Math.pow(2,o)):new ee(Math.pow(2,o-32),0)).toString(),"1"===e[n]?this._featureMap.set(t,!0):this._featureMap.set(t,!1)}else M.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 ee(0,Math.pow(2,a)):new ee(Math.pow(2,a-32),0)).toString(),!this._featureMap.get(n))){o=!1;break}return M.l("".concat(this._n,".isFeatureEnabled decimalNumber:").concat(e," key:").concat(n," ret:").concat(o)),T({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 ee(0,Math.pow(2,o)):new ee(Math.pow(2,o-32),0)).toString(),!this._featureMap.get(i))break;var i,a="",s=0;i===_.PLUGIN_TRANSLATE?(a="plugin_translate",s=16):i===_.PLUGIN_VOICE_TO_TEXT?(a="plugin_voice_to_text",s=17):i===_.PLUGIN_CS?(a="plugin_cs",s=14):i===_.PLUGIN_PUSH?(a="plugin_push",s=13):i===_.PLUGIN_BOT?(a="plugin_bot",s=15):i===_.MSG_REACTION&&(a="plugin_emoji_reaction",s=18),""!==a&&(i=this._commercialConfigM.get(12).getUIPlatform(),new G(a).setCode(s).setUIPlatform(i).end(),M.l("".concat(this._n,".isFeatureEnabledForStat ").concat(a," code:").concat(s," uiPlatform:").concat(i)))}}},{key:"isSearchCloudMessagesEnabled",value:function(){var e;this._isSCMReported||(e=this._commercialConfigM.get(12).getUIPlatform(),new G("plugin_search").setCode(6).setUIPlatform(e).end(),this._isSCMReported=!0)}},{key:"clear",value:function(){this._featureMap.clear(),this._isSCMReported=!1}}]),Or),ir=(e(Rr,[{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");M.l("".concat(i," canFetch:").concat(o)),o&&(t=new G("fetchCommercialConfig"),o=this.get(12).getSDKAppID(),e=this.get(20),this._isFetching=!0,e.req({P:k.FETCH_COMMERCIAL_CONFIG,data:{SDKAppID:o}}).then(function(e){t.setMessage("purchaseBits:".concat(e.data.purchaseBits)).end(),M.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));M.l("".concat(t)),new G("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):N(n)?(M.l("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(M.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:"isSearchCloudMessagesEnabled",value:function(){this._purchasedFeatureHandler.isSearchCloudMessagesEnabled()}},{key:"get",value:function(e){return this._m.get(e)}},{key:"reset",value:function(){M.l("".concat(this._n,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),Rr),ar=(t(Ar,u),Ps=n(Ar),e(Ar,[{key:"registerPlugin",value:function(e){var t,n,o,i,a,s,r,c,u,l,d,p,_;Ie?(this._offlinePushPlugin=e["tim-offline-push-plugin"],t=(_=e.offlinePushConfig||{}).huaweiBusinessID,n=_.xiaomiBusinessID,o=_.xiaomiAppID,i=_.xiaomiAppKey,a=_.meizuBusinessID,s=_.meizuAppID,r=_.meizuAppKey,c=_.vivoBusinessID,u=_.oppoBusinessID,l=_.oppoAppKey,d=_.oppoAppSecret,p=_.honorBusinessID,_=_.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=u,this._androidPushConfig.oppoPushAppKey=l,this._androidPushConfig.oppoPushAppSecret=d,this._androidPushConfig.honorPushBussinessId=p,new G("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!N(this._offlinePushPlugin))).end(!0),M.l("".concat(this._n,".").concat("registerPlugin"," ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=_,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");lt(this._offlinePushPlugin.getDeviceToken)?(c="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID),M.l("".concat(l," start. ").concat(c)),new G("_getDeviceToken").setMessage("".concat(c)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,function(e){var t,n,o,i,a=new G("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),M.l("".concat(l," ok. ").concat(c)),a.setMessage(c).end(!0),u._setToken()):(a.setMessage("code:".concat(s,", msg:").concat(r)).end(!0),M.e("".concat(l," failed. error:"),e))})):M.e("".concat(l," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return Ie&&!N(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var t=this,n="".concat(this._n,".").concat("_setAppShowListener");N(this._offlinePushPlugin)?M.e("".concat(n," offlinePushPlugin is undefined")):lt(this._offlinePushPlugin.setAppShowListener)?(new G("_setAppShowListener").end(!0),M.l("".concat(n," start")),this._offlinePushPlugin.setAppShowListener(function(e){e=(e||{}).appShow;new G("setAppShowListenerRes").setMessage("appShow:".concat(e)).end(!0),M.l("".concat(n," ok. appShow:").concat(e)),t._m.isReady()&&(0===e?(t._getConvUnreadCount(),t._onBackground()):1===e&&t._onForeground())})):M.e("".concat(n," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){var e;if(!N(this._offlinePushPlugin)&<(this._offlinePushPlugin.getDeviceType))return e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType,M.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=(S(this._deviceToken)&&(n=0),this.getUniAppPlatform()),s=this.getDeviceBrand(),r=(a===ne.IOS||a===ne.IPAD||a===ne.MAC?i=this._deviceToken:a===ne.ANDROID&&(o=this._deviceToken),new G("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)),M.l("".concat(t," ").concat(a)),this.req({P:k.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(),M.l("".concat(t," ok")),e}).catch(function(e){return r.setError(e).end(),M.e("".concat(t," failed. error:"),e),D(e)})}},{key:"_getConvUnreadCount",value:function(){var t=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(11).getLocalConvList().forEach(function(e){e.type===A.CONV_C2C&&(t._c2cUnreadCount+=e.unreadCount),e.type===A.CONV_GROUP&&(t._groupUnreadCount+=e.unreadCount)})}},{key:"_onBackground",value:function(){var t=this,n="".concat(this._n,".").concat("_onBackground"),o=new G("_onBackground");this.req({P:k.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(),M.l("".concat(n," ok")),e}).catch(function(e){o.setError(e).end(),M.e("".concat(n," failed. error:"),e)})}},{key:"_onForeground",value:function(){var t="".concat(this._n,".").concat("_onForeground"),n=new G("_onForeground");this.req({P:k.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then(function(e){return n.end(),M.l("".concat(t," ok")),e}).catch(function(e){n.setError(e).end(),M.e("".concat(t," failed. error:"),e)})}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?ne.IOS:"android"===e?ne.ANDROID:1002===t?ne.IPAD:1001===t?ne.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,M.l("".concat(this._n,".reset"))}}]),Ar),sr=(t(kr,u),Gs=n(kr),e(kr,[{key:"registerPlugin",value:function(e){var t,n,o;Ie?(t="".concat(this._n,".").concat("registerPlugin"),this._pushPlugin=e["tim-push"],this._getDeviceInfo(),n=(o=e.pushConfig||{}).androidConfig,o=o.iOSConfig,ut(n)&&(this._androidPushConfig=n[this._deviceInfo.packageName]),n=(o||{}).iOSBusinessID,this._iOSBusinessID=n,o=!N(this._pushPlugin),new G("registerPlugin").setMessage(this._pluginName).setMoreMessage("isExisted:".concat(o)).end(!0),M.l("".concat(t," ok. pushConfig:").concat(JSON.stringify(e.pushConfig))),o?(this._setAppShowListener(),this._setPushEventReportListener()):M.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");lt(this._pushPlugin.getPushEventCacheList)?(new G("_reportEventCacheList").end(!0),this._pushPlugin.getPushEventCacheList(function(e){var t=e.code,n=e.data.eventList,o=new G("getPushEventCacheListRes");if(o.setCode(t),0!==t)o.setMessage("res:".concat(JSON.stringify(e))).end(!0),M.e("".concat(s," failed. error:").concat(JSON.stringify(e)));else{t=n.length<10?"eventList:".concat(JSON.stringify(n)):"eventList.length:".concat(n.length);M.l("".concat(s," ok. ").concat(t)),o.setMessage(t).end(!0);for(var i=y(y({},e.data),{},{eventList:[]});0=this._expiredTime&&this._getLexicon()}},{key:"filterMessage",value:function(e,t){var n=!0;if(this._plugin&&this._canIUseLexicon&&(!t||!t.messageControlInfo||!0!==t.messageControlInfo.excludedFromContentModeration)){var t=e.type,o=e.conversationType;if(t===A.MSG_TEXT||t===A.MSG_CUSTOM){var i,a="".concat(this._n,".filterMessage");if(M.l("".concat(a)),t===A.MSG_TEXT){if(o===A.CONV_C2C?i="c2c_text_message":o===A.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===A.MSG_CUSTOM){if(o===A.CONV_C2C?i="c2c_custom_message":o===A.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))}M.l("".concat(a," done. isAllowedToSend:").concat(n))}}return n}},{key:"filterText",value:function(e,t){var n="".concat(this._n,".filterText"),o={isAllowedToSend:!0,modifiedText:e};return this._plugin&&this._canIUseLexicon&&this._isConfigOn(t)&&(M.l("".concat(n)),e=(t=this._plugin.filter(e)).type,t=t.modifiedText,1===e?o.isAllowedToSend=!1:2===e&&(o.modifiedText=t),M.l("".concat(n," done. ret:"),o)),o}},{key:"_getLexicon",value:function(){var l=this,d=new G("profanityFilter"),p="".concat(this._n,"._getLexicon");this._isFetching=!0,this.req({P:k.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,M.w("".concat(p," failed. error:"),t),void d.setCode(c).setMessage(u).end()):(l._onFilterConfig(n),l._getToken(i),1===a?(M.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,M.l("".concat(p," failed. error:"),e)})}},{key:"_onFilterConfig",value:function(t){var n=this;S(t)||(this._filterConfigMap.clear(),Object.keys(t).forEach(function(e){n._filterConfigMap.set(e,t[e])}),M.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(m(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=this.STORAGE_EXPIRES_TIME,e=!e||"3.4.7"!==e;return M.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.6/tim-error-message.txt",t="application/x-www-form-urlencoded;charset=UTF-8",n="".concat(this._n,"._fetch ok in"),o=this,v?I.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:function(e){o._fillAndSave(e.data),M.l("".concat(n," mini program"))},fail:function(){}}):(i=new XMLHttpRequest,a=setTimeout(function(){i.abort()},3e3),i.onreadystatechange=function(){4===i.readyState&&(clearTimeout(a),200!==i.status&&304!==i.status||(M.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.4.7"}),!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;sBe()-this.EXPIRED_TIME}},{key:"_createPromiseList",value:function(e){for(var t=[],n=0;nthis.MAX_COUNT?this.MAX_COUNT:e,this._clearFollowList())}},{key:"clearCacheOnReconnected",value:function(){this._clearFollowList(),this._followType.clear()}},{key:"onFollowNotify",value:function(e){var i=this,e=e.dataList||[];M.l("".concat(this._n,".onFollowNotify followChangeList:").concat(e.length)),e.forEach(function(e){var t=e.followDiffList,t=void 0===t?[]:t,o=K(e,mr);t.forEach(function(e){var t=e.isAdd,e=e.followType,e=void 0===e?[]:e,n=i._initFollowInfo();n[e].userInfoList.push(o),n[e].isAdd=1===t,i._emitEvent(n)})})}},{key:"_initFollowInfo",value:function(){var t={};return Object.values(vr).forEach(function(e){e!==vr.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[s].tag)}this.profile=new ei(y(y({},n),{},{profileCustomField:o}))}function Fr(e){d(this,Fr),this._snsM=e,this._n="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSeq=0,this._map=new Map,this._unreadCount=0}function qr(e){d(this,qr),(e=ws.call(this,e))._n="QualityStatModule",e.TAG="im-ssolog-quality-stat",e.reportIndex=0,e.wholePeriod=!1,e._qualityItems=[xn,Vn,Hn,Bn,Kn,Yn,Wn,jn,Jn,zn],e._messageSentItems=[Hn,Bn,Kn,Yn,Wn],e._messageReceivedItems=[jn,Jn,zn],e.REPORT_INTERVAL=120,e.REPORT_SDKAPPID_BLACKLIST=[],e.REPORT_TINYID_WHITELIST=[],e._statInfoArr=[],e._avgRTT=new Ys,e._avgE2EDelay=new Ks,e._rateMessageSent=new Ws,e._rateMessageReceived=new js;var t=e.getIEmitInst();return t.on(P.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,i(e)),t.on(P.CLOUD_CONFIG,e._onCloudConfig,i(e)),e}function xr(){d(this,xr),this._lastMap=new Map,this._currentMap=new Map}function Vr(){d(this,Vr),this._map=new Map}function Hr(){d(this,Hr),this._n="AvgRTT",this._requestCount=0,this._rttArray=[]}function Br(){d(this,Br),this._n="AvgE2EDelay",this._e2eDelayArray=[]}function Kr(e){return d(this,Kr),(e=Fs.call(this,e))._n="RecoverMsgModule",e.PULL_LIMIT_COUNT=15,e}function Yr(e){return d(this,Yr),(e=qs.call(this,e))._n="CloudControlModule",e._cloudConfig=new Map,e._expiredTime=0,e._version=0,e._isFetching=!1,e}function Wr(e){return d(this,Wr),(e=xs.call(this,e))._n="SessionModule",e._platform=e.getPlatform(),e._pHandler=new hs(i(e)),e._msgDispatcher=new fs(i(e)),e._cmdFreqLimitMap=new Map,e._cmdReqInfoMap=new Map,e._serverOverloadInfoMap=new Map,e._incrementalPullContactFlag=!0,e._init(),e.getIEmitInst().on(P.CLOUD_CONFIG,e._onCloudConfig,i(e)),e}ie.assign,ie.shrinkBuf,ie.setTyped,ie.Buf8,ie.Buf16,ie.Buf32;function jr(e,t,n,o){for(var i=65535&e|0,a=e>>>16&65535|0,s=0;0!==n;){for(n-=s=2e3>>8^i[255&(e^t[s])];return-1^e}function zr(e,t,n,o,i,a,s,r){for(var c,u,l,d,p,_,h,g,f,m=r.bits,v=0,I=0,M=0,y=0,C=0,T=0,D=0,E=0,L=0,S=0,k=null,A=0,R=new ie.Buf16(16),O=new ie.Buf16(16),N=null,G=0,v=0;v<=15;v++)R[v]=0;for(I=0;I_?(g=N[G+s[I]],k[A+s[I]]):(g=96,0),c=1<<(h=v-D),M=u=1<>D)+(u-=c)]=h<<24|g<<16|f|0,0!==u;);for(c=1<>=1;if(0!==c?S=(S&c-1)+c:S=0,I++,0==--R[v]){if(v===y)break;v=t[n+s[I]]}if(C>>1:n>>>1;e[t]=n}return e}(),Zr=[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],Qr=[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],$r=[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],ec=[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 tc(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function nc(){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 ie.Buf16(320),this.work=new ie.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function oc(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 ie.Buf32(852),t.distcode=t.distdyn=new ie.Buf32(592),t.sane=1,t.back=-1,0):-2}function ic(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,oc(e)):-2}function ac(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=e.wsize?(ie.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),ie.arraySet(e.window,t,n-o,i,e.wnext),(o-=i)?(ie.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>>8&255,t.check=Jr(t.check,M,2,0),c=r=0,t.mode=2;else if(t.flags=0,t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&r)<<8)+(r>>8))%31)e.msg="incorrect header check",t.mode=30;else if(8!=(15&r))e.msg="unknown compression method",t.mode=30;else{if(c-=4,g=8+(15&(r>>>=4)),0===t.wbits)t.wbits=g;else if(g>t.wbits){e.msg="invalid window size",t.mode=30;break}t.dmax=1<>8&1),512&t.flags&&(M[0]=255&r,M[1]=r>>>8&255,t.check=Jr(t.check,M,2,0)),c=r=0,t.mode=3;case 3:for(;c<32;){if(0===a)break e;a--,r+=n[o++]<>>8&255,M[2]=r>>>16&255,M[3]=r>>>24&255,t.check=Jr(t.check,M,4,0)),c=r=0,t.mode=4;case 4:for(;c<16;){if(0===a)break e;a--,r+=n[o++]<>8),512&t.flags&&(M[0]=255&r,M[1]=r>>>8&255,t.check=Jr(t.check,M,2,0)),c=r=0,t.mode=5;case 5:if(1024&t.flags){for(;c<16;){if(0===a)break e;a--,r+=n[o++]<>>8&255,t.check=Jr(t.check,M,2,0)),c=r=0}else t.head&&(t.head.extra=null);t.mode=6;case 6:if(1024&t.flags&&((l=(l=t.length)>a?a:l)&&(t.head&&(g=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Array(t.head.extra_len)),ie.arraySet(t.head.extra,n,o,l,g)),512&t.flags&&(t.check=Jr(t.check,n,l,o)),a-=l,o+=l,t.length-=l),t.length))break e;t.length=0,t.mode=7;case 7:if(2048&t.flags){if(0===a)break e;for(l=0;g=n[o+l++],t.head&&g&&t.length<65536&&(t.head.name+=String.fromCharCode(g)),g&&l>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=12;break;case 10:for(;c<32;){if(0===a)break e;a--,r+=n[o++]<>>=7&c,c-=7&c,t.mode=27;else{for(;c<3;){if(0===a)break e;a--,r+=n[o++]<>>=1)){case 0:t.mode=14;break;case 1:y=C=void 0;var y,C=t;if(uc){for(rc=new ie.Buf32(512),cc=new ie.Buf32(32),y=0;y<144;)C.lens[y++]=8;for(;y<256;)C.lens[y++]=9;for(;y<280;)C.lens[y++]=7;for(;y<288;)C.lens[y++]=8;for(zr(1,C.lens,0,288,rc,0,C.work,{bits:9}),y=0;y<32;)C.lens[y++]=5;zr(2,C.lens,0,32,cc,0,C.work,{bits:5}),uc=!1}if(C.lencode=rc,C.lenbits=9,C.distcode=cc,C.distbits=5,t.mode=20,6!==b)break;r>>>=2,c-=2;break e;case 2:t.mode=17;break;case 3:e.msg="invalid block type",t.mode=30}r>>>=2,c-=2}break;case 14:for(r>>>=7&c,c-=7&c;c<32;){if(0===a)break e;a--,r+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",t.mode=30;break}if(t.length=65535&r,c=r=0,t.mode=15,6===b)break e;case 15:t.mode=16;case 16:if(l=t.length){if(0===(l=s<(l=a>>=5,c-=5,t.ndist=1+(31&r),r>>>=5,c-=5,t.ncode=4+(15&r),r>>>=4,c-=4,286>>=3,c-=3}for(;t.have<19;)t.lens[B[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,m={bits:t.lenbits},f=zr(0,t.lens,0,19,t.lencode,0,t.work,m),t.lenbits=m.bits,f){e.msg="invalid code lengths set",t.mode=30;break}t.have=0,t.mode=19;case 19:for(;t.have>>16&255,_=65535&I,!((d=I>>>24)<=c);){if(0===a)break e;a--,r+=n[o++]<>>=d,c-=d,t.lens[t.have++]=_;else{if(16===_){for(v=d+2;c>>=d,c-=d,0===t.have){e.msg="invalid bit length repeat",t.mode=30;break}g=t.lens[t.have-1],l=3+(3&r),r>>>=2,c-=2}else if(17===_){for(v=d+3;c>>=d)),r>>>=3,c=c-d-3}else{for(v=d+7;c>>=d)),r>>>=7,c=c-d-7}if(t.have+l>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=30;break}for(;l--;)t.lens[t.have++]=g}}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,m={bits:t.lenbits},f=zr(1,t.lens,0,t.nlen,t.lencode,0,t.work,m),t.lenbits=m.bits,f){e.msg="invalid literal/lengths set",t.mode=30;break}if(t.distbits=6,t.distcode=t.distdyn,m={bits:t.distbits},f=zr(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,m),t.distbits=m.bits,f){e.msg="invalid distances set",t.mode=30;break}if(t.mode=20,6===b)break e;case 20:t.mode=21;case 21:if(6<=a&&258<=s){e.next_out=i,e.avail_out=s,e.next_in=o,e.avail_in=a,t.hold=r,t.bits=c,G=Y=k=S=L=E=D=T=oe=ne=te=ee=U=P=$=Q=Z=X=z=J=j=N=W=O=R=void 0;var T,D,E,L,S,k,A=e,K=u,R=A.state,O=A.next_in,Y=A.input,W=O+(A.avail_in-5),N=A.next_out,G=A.output,j=N-(K-A.avail_out),J=N+(A.avail_out-257),z=R.dmax,X=R.wsize,Z=R.whave,Q=R.wnext,$=R.window,P=R.hold,U=R.bits,ee=R.lencode,te=R.distcode,ne=(1<>>=D=T>>>24,U-=D,0==(D=T>>>16&255))G[N++]=65535&T;else{if(!(16&D)){if(0==(64&D)){T=ee[(65535&T)+(P&(1<>>=D,U-=D),U<15&&(P+=Y[O++]<>>=D=T>>>24,U-=D,!(16&(D=T>>>16&255))){if(0==(64&D)){T=te[(65535&T)+(P&(1<z){A.msg="invalid distance too far back",R.mode=30;break t}if(P>>>=D,U-=D,L>(D=N-j)){if((D=L-D)>Z&&R.sane){A.msg="invalid distance too far back",R.mode=30;break t}if(k=$,(S=0)===Q){if(S+=X-D,D>3,P&=(1<<(U-=E<<3))-1,A.next_in=O,A.next_out=N,A.avail_in=O>>16&255,_=65535&I,!((d=I>>>24)<=c);){if(0===a)break e;a--,r+=n[o++]<>h)])>>>16&255,_=65535&I,!(h+(d=I>>>24)<=c);){if(0===a)break e;a--,r+=n[o++]<>>=h,c-=h,t.back+=h}if(r>>>=d,c-=d,t.back+=d,t.length=_,0===p){t.mode=26;break}if(32&p){t.back=-1,t.mode=12;break}if(64&p){e.msg="invalid literal/length code",t.mode=30;break}t.extra=15&p,t.mode=22;case 22:if(t.extra){for(v=t.extra;c>>=t.extra,c-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=23;case 23:for(;p=(I=t.distcode[r&(1<>>16&255,_=65535&I,!((d=I>>>24)<=c);){if(0===a)break e;a--,r+=n[o++]<>h)])>>>16&255,_=65535&I,!(h+(d=I>>>24)<=c);){if(0===a)break e;a--,r+=n[o++]<>>=h,c-=h,t.back+=h}if(r>>>=d,c-=d,t.back+=d,64&p){e.msg="invalid distance code",t.mode=30;break}t.offset=_,t.extra=15&p,t.mode=24;case 24:if(t.extra){for(v=t.extra;c>>=t.extra,c-=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===s)break e;if(t.offset>(l=u-s)){if((l=t.offset-l)>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=30;break}q=l>t.wnext?(l-=t.wnext,t.wsize-l):t.wnext-l,l>t.length&&(l=t.length),x=t.window}else x=w,q=i-t.offset,l=t.length;for(s-=l=s>10&1023,a[s++]=56320|1023&n)}var c=a,u=s;if(u<65534&&(c.subarray&&_c||!c.subarray&&pc))return String.fromCharCode.apply(null,ie.shrinkBuf(c,u));for(var l="",d=0;d>>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]"===yc.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw)&&(e=dc.inflateSetDictionary(this.strm,t.dictionary))!==Ic.Z_OK)throw new Error(Mc[e])}function Tc(e,t){t=new Cc(t);if(t.push(e,!0),t.err)throw t.msg||Mc[t.err];return t.result}Cc.prototype.push=function(e,t){var n,o,i,a,s,r=this.strm,c=this.options.chunkSize,u=this.options.dictionary,l=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?Ic.Z_FINISH:Ic.Z_NO_FLUSH,"string"==typeof e?r.input=function(e){for(var t=new ie.Buf8(e.length),n=0,o=t.length;ne.length?e.length:t)-1;0<=n&&128==(192&e[n]);)n--;return!(n<0||0===n)&&n+hc[e[n]]>t?n:t}(r.output,r.next_out),a=r.next_out-i,s=fc(r.output,i),r.next_out=a,r.avail_out=c-a,a&&ie.arraySet(r.output,r.output,i,a,0),this.onData(s)):this.onData(ie.shrinkBuf(r.output,r.next_out))),0===r.avail_in&&0===r.avail_out&&(l=!0)}while((0"," %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"),be)&&t&&console.warn(t),M.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!==A.MSG_MERGER?D({code:L.MSG_MERGER_TYPE_INVALID}):S(e.payload.downloadKey)?D({code:L.MSG_MERGER_KEY_INVALID}):this._get(2).downloadMergerMessage(e).catch(function(e){return D({code:L.MSG_MERGER_DOWNLOAD_FAIL})})}},{key:"createForwardMessage",value:function(e){return this._get(2).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof Do?this._get(2).sendMessageInstance(e,t):D({code:L.MSG_INSTANCE_REQUIRED})}},{key:"searchCloudMessages",value:function(e){return this._get(2).searchCloudMessages(e)}},{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):D({code:L.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._get(2).revokeMessage(e)}},{key:"resendMessage",value:function(e,t){return e instanceof Do?this._get(2).resendMessage(e,t):D({code:L.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):D({code:L.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:"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():D({code:L.NO_MODULE})}},{key:"addFriend",value:function(e){var t=this._get(8);return t?t.addFriend(e):D({code:L.NO_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._get(8);return t?t.deleteFriend(e):D({code:L.NO_MODULE})}},{key:"checkFriend",value:function(e){var t=this._get(8);return t?t.checkFriend(e):D({code:L.NO_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._get(8);return t?t.getFriendProfile(e):D({code:L.NO_MODULE})}},{key:"updateFriend",value:function(e){var t=this._get(8);return t?t.updateFriend(e):D({code:L.NO_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._get(8);return e?e.getLocalFriendApplicationList():D({code:L.NO_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._get(8);return t?t.acceptFriendApplication(e):D({code:L.NO_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._get(8);return t?t.refuseFriendApplication(e):D({code:L.NO_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._get(8);return t?t.deleteFriendApplication(e):D({code:L.NO_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._get(8);return e?e.setFriendApplicationRead():D({code:L.NO_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._get(8);return e?e.getLocalFriendGroupList():D({code:L.NO_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._get(8);return t?t.createFriendGroup(e):D({code:L.NO_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._get(8);return t?t.deleteFriendGroup(e):D({code:L.NO_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._get(8);return t?t.addToFriendGroup(e):D({code:L.NO_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._get(8);return t?t.removeFromFriendGroup(e):D({code:L.NO_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._get(8);return t?t.renameFriendGroup(e):D({code:L.NO_MODULE})}},{key:"followUser",value:function(e){var t=this._get(35);return t?t.followUser(e):D({code:L.NO_MODULE})}},{key:"unfollowUser",value:function(e){var t=this._get(35);return t?t.unfollowUser(e):D({code:L.NO_MODULE})}},{key:"getMyFollowersList",value:function(e){var t=this._get(35);return t?t.getMyFollowersList(e):D({code:L.NO_MODULE})}},{key:"getMyFollowingList",value:function(e){var t=this._get(35);return t?t.getMyFollowingList(e):D({code:L.NO_MODULE})}},{key:"getMutualFollowersList",value:function(e){var t=this._get(35);return t?t.getMutualFollowersList(e):D({code:L.NO_MODULE})}},{key:"getUserFollowInfo",value:function(e){var t=this._get(35);return t?t.getUserFollowInfo(e):D({code:L.NO_MODULE})}},{key:"checkFollowType",value:function(e){var t=this._get(35);return t?t.checkFollowType(e):D({code:L.NO_MODULE})}},{key:"getGroupList",value:function(){var e=this._get(7);return e?e.getGroupList():D({code:L.NO_MODULE})}},{key:"getGroupProfile",value:function(e){var t=this._get(7);return t?t.getGroupProfile(e):D({code:L.NO_MODULE})}},{key:"createGroup",value:function(e){var t=this._get(7);return t?t.createGroup(e):D({code:L.NO_MODULE})}},{key:"dismissGroup",value:function(e){var t=this._get(7);return t?t.dismissGroup(e):D({code:L.NO_MODULE})}},{key:"updateGroupProfile",value:function(e){var t=this._get(7);return t?t.updateGroupProfile(e):D({code:L.NO_MODULE})}},{key:"joinGroup",value:function(e){var t=this._get(7);return t?t.joinGroup(e):D({code:L.NO_MODULE})}},{key:"quitGroup",value:function(e){var t=this._get(7);return t?t.quitGroup(e):D({code:L.NO_MODULE})}},{key:"searchGroupByID",value:function(e){var t=this._get(7);return t?t.searchGroupByID(e):D({code:L.NO_MODULE})}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._get(7);return t?t.getGroupOnlineMemberCount(e):D({code:L.NO_MODULE})}},{key:"changeGroupOwner",value:function(e){var t=this._get(7);return t?t.changeGroupOwner(e):D({code:L.NO_MODULE})}},{key:"getGroupApplicationList",value:function(){var e=this._get(7);return e?e.getGroupApplicationList():D({code:L.NO_MODULE})}},{key:"handleGroupApplication",value:function(e){var t=this._get(7);return t?t.handleGroupApplication(e):D({code:L.NO_MODULE})}},{key:"initGroupAttributes",value:function(e){var t=this._get(7);return t?t.initGroupAttributes(e):D({code:L.NO_MODULE})}},{key:"setGroupAttributes",value:function(e){var t=this._get(7);return t?t.setGroupAttributes(e):D({code:L.NO_MODULE})}},{key:"deleteGroupAttributes",value:function(e){var t=this._get(7);return t?t.deleteGroupAttributes(e):D({code:L.NO_MODULE})}},{key:"getGroupAttributes",value:function(e){var t=this._get(7);return t?t.getGroupAttributes(e):D({code:L.NO_MODULE})}},{key:"setGroupCounters",value:function(e){var t=this._get(7);return t?t.setGroupCounters(e):D({code:L.NO_MODULE})}},{key:"increaseGroupCounter",value:function(e){var t=this._get(7);return t?t.increaseGroupCounter(e):D({code:L.NO_MODULE})}},{key:"decreaseGroupCounter",value:function(e){var t=this._get(7);return t?t.decreaseGroupCounter(e):D({code:L.NO_MODULE})}},{key:"getGroupCounters",value:function(e){var t=this._get(7);return t?t.getGroupCounters(e):D({code:L.NO_MODULE})}},{key:"getGroupMemberList",value:function(e){var t=this._get(7);return t?t.getGroupMemberList(e):D({code:L.NO_MODULE})}},{key:"getGroupMemberProfile",value:function(e){var t=this._get(7);return t?t.getGroupMemberProfile(e):D({code:L.NO_MODULE})}},{key:"addGroupMember",value:function(e){var t=this._get(7);return t?t.addGroupMember(e):D({code:L.NO_MODULE})}},{key:"deleteGroupMember",value:function(e){var t=this._get(7);return t?t.deleteGroupMember(e):D({code:L.NO_MODULE})}},{key:"setGroupMemberMuteTime",value:function(e){var t=this._get(7);return t?t.setGroupMemberMuteTime(e):D({code:L.NO_MODULE})}},{key:"setGroupMemberRole",value:function(e){var t=this._get(7);return t?t.setGroupMemberRole(e):D({code:L.NO_MODULE})}},{key:"setGroupMemberNameCard",value:function(e){var t=this._get(7);return t?t.setGroupMemberNameCard(e):D({code:L.NO_MODULE})}},{key:"setGroupMemberCustomField",value:function(e){var t=this._get(7);return t?t.setGroupMemberCustomField(e):D({code:L.NO_MODULE})}},{key:"markGroupMemberList",value:function(e){var t=this._get(7);return t?t.markGroupMemberList(e):D({code:L.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):D({code:L.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):D({code:L.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):D({code:L.NO_MODULE})}},{key:"accept",value:function(e){var t=this._get(33);return t?t.accept(e):D({code:L.NO_MODULE})}},{key:"reject",value:function(e){var t=this._get(33);return t?t.reject(e):D({code:L.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):D({code:L.NO_MODULE})}}]),Rc),Ac={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 Rc(e){d(this,Rc);e={SDKAppID:e.SDKAppID,unlimitedAVChatRoom:e.unlimitedAVChatRoom||!1,scene:e.scene||"",oversea:e.oversea||!1,instanceID:qt(),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,modules:e.modules||void 0};this._m=new Lc(e),this._safetyCallbackFactory=new Sc(this._m)}function Oc(e){d(this,Oc),this._funcMap=new Map,this._m=e,this._n="SafetyCallback",this._reportCount=0}function Nc(t){var n=this;d(this,Nc);var o,e=new G("sdkConstruct"),i=(this._n="ModuleManager",this._isReady=!1,this._reason=L.USER_NOT_LOGGED_IN,this._startLoginTs=0,this._map=new Map,this._optionalModuleMap=new Map,this._iEmitter=null,this._oEmitter=null,this._checkCount=0,this._checkTimer=-1,this._map.set(12,new Ri(this,t)),this._map.set(37,new Ec(this)),this._map.set(15,new pa(this)),this._map.set(27,new ir(this)),this._map.set(23,new Hs(this)),this._map.set(24,new nr(this)),this._map.set(26,new Js(this)),this._map.set(21,new ds(this)),this._map.set(20,new Vs(this)),this._map.set(1,new Ni(this)),this._map.set(2,new wa(this)),this._map.set(3,new Fa(this)),this._map.set(34,new qa(this)),this._map.set(31,new xa(this)),this._map.set(4,new Ai(this)),this._map.set(6,new qo(this)),this._map.set(11,new ci(this)),this._map.set(7,new yi(this)),this._map.set(10,new Di(this)),this._map.set(13,new ra(this)),this._map.set(32,new ur(this)),this._map.set(14,new ua(this)),this._map.set(17,new Ca(this)),this._map.set(18,new Va(this)),this._map.set(19,new Ha(this)),this._map.set(25,new Bs(this)),this._map.set(8,new tr(this)),this._map.set(28,new ar(this)),this._map.set(36,new sr(this)),this._map.set(29,new rr(this)),this._map.set(30,new cr(this)),this._map.set(33,new fr(this)),this._map.set(35,new Ir(this)),this._eventThrottleMap=new Map,this._eventThrottling=t.eventThrottling,this._map.get(12).isPartialUpdatedConvs()&&(this._eventThrottling=!1),f(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)),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(xt())+" isIOSWebView:".concat(be," platform:").concat(De," canIUseInflate:").concat(this.canIUseInflate())+" workerAvailable:".concat(Ge," eventThrottling:").concat(this._eventThrottling," UserAgent:").concat(Te);G.bindEventStatModule(this._map.get(14)),G.bindNetMonitorModule(this._map.get(15)),e.setMessage("".concat(i," ").concat(function(){var t="";if(v)try{var e=I.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(),M.i("SDK ".concat(i)),E.prototype._getErrMsg=this.getErrMsg.bind(this),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}function Gc(e){d(this,Gc),this._m=e,this._n="InflateModule",this._bLogForInflateOK=!1,this._bLogForInflateError=!1}var Pc={},o={};return o.create=function(e){var t="TencentCloudChat.create",n=0,o=e.SDKAppID;if(R(o))n=o;else if(n=parseInt(o),isNaN(o))return M.e("".concat(t," failed. Failed to parse the SDKAppID, please check the arguments")),null;if(n&&Pc[n])return Pc[n];M.l("".concat(t));var s,i,o=new kc(y(y({},e),{},{SDKAppID:n})),e=(o.on(h.SDK_DESTROY,function(e){Pc[e.data.SDKAppID]=null,delete Pc[e.data.SDKAppID]}),s=o,i=Object.create(null),Object.keys(Fn).forEach(function(a){var t;s[a]&&(t=new $,i[a]=function(){var e=Array.from(arguments);return t.use(function(e,t){i=a;var n,o,i=!(!(n=s).isReady()&&1!==Ac[i])||(o={code:o=n.getNotReadyReason(),message:"".concat(n.getErrMsg(o)," | ").concat(i," | ").concat(n.getErrMsg(L.SDK_IS_NOT_READY))},n.onError(o),o);return!0===i?t():D(i)}).use(function(e,t){if(!0===function(n,o,i){if(void 0===o)return!0;var a=!0;if(f(o))Object.keys(o).forEach(function(e){var t=1===n.length?n[0][e]:void 0;a=!!an(t,o[e],i,e)&&a});else if(O(o))for(var e=0;e