!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 l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=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.")}function q(e,t,n){return(t=J(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function t(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Y(e,t)}function V(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(V=function(){return!!e})()}function B(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function H(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function K(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;eo&&(r({api:t,paramName:n,desc:u("MaximumArrayLengthLog",n,o)}),1)):(r({api:t,paramName:n,desc:gn()}),!1)}function Nn(e,t,n,o){var i=o.allowUndefined,a=o.min,o=o.max;return N(e)?!!i||(r({api:t,paramName:n,desc:pn()}),!1):A(e)?A(a)&&e=Math.pow(2,64)&&(r({api:t,paramName:n,desc:u("NumberLessThanLog",n,"Math.pow(2,64)")}),1)):(r({api:t,paramName:n,desc:dn()}),!1)}},enableMark:y({},xn)},createConversationGroup:{conversationIDList:y({},s),groupName:y(y({},n),{},{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 Vo=["jpg","jpeg","gif","png","bmp","image","webp"],Bo=["mp4","quicktime","mov"],Ho=e(function e(t){var n=this;p(this,e),S(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.gender=t.gender||"",this.birthday=t.birthday||0,this.location=t.location||"",this.selfSignature=t.selfSignature||"",this.allowType=t.allowType||R.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||R.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],S(t.profileCustomField))||t.profileCustomField.forEach(function(e){n.profileCustomField.push({key:e.key,value:e.value})})},[{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()}}]),Wo=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"],Yo=e(function e(t){p(this,e),this.groupID="",this.name="",this.avatar="",this.type="",this.introduction="",this.notification="",this.ownerID="",this.createTime="",this.infoSequence="",this.lastInfoTime="",this.selfInfo={messageRemindType:"",joinTime:"",nameCard:"",role:"",userID:"",memberCustomField:void 0,readedSequence:0,excludedUnreadSequenceList:void 0},this.lastMessage={lastTime:"",lastSequence:"",fromAccount:"",messageForShow:""},this.nextMessageSeq="",this.memberNum="",this.memberCount="",this.maxMemberNum="",this.maxMemberCount="",this.joinOption="",this.inviteOption="",this.groupCustomField=[],this.muteAllMembers=!1,this.isSupportTopic=!1,this._lastRevokedTime=0,this._initGroup(t)},[{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)Wo.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&&Rt(this.groupCustomField,e.groupCustomField),N(e.memberNum)||(this.memberCount=e.memberNum),N(e.maxMemberNum)||(this.maxMemberCount=e.maxMemberNum),N(e.isSupportTopic)||(this.isSupportTopic=A(e.isSupportTopic)?1===e.isSupportTopic:e.isSupportTopic),ht(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 T({counters:e})}).catch(function(e){return s.setError(e).end(),E(e)});s.setMoreMessage("from cache").end(),M.l("".concat(n," from cache. groupID:").concat(o));e=this._getLocalCounters(o,i);return D({counters:e})}},{key:"_getRemoteGroupCounters",value:function(n){var o=this;return this._grpM.req({P:G.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 E(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:G.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 E(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)}),(Pt({groupID:n})||Ut(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=Xt(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=Xt(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=Xt(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=Xt(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(R.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)||Ut(e)?t.topicName&&!1===this._filterProfanity("topicName",t)||t.introduction&&!1===this._filterProfanity("introduction",t)||t.notification&&!1===this._filterProfanity("notification",t)?E({code:k.PROFANITY_FOUND}):(n=new P("createTopicInCommunity"),this.req({P:G.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})]),T({topicID:e})}).catch(function(e){return n.setError(e).end(),M.e("".concat(i," failed. error:"),e),E(e)})):E({code:k.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 P("deleteTopicFromCommunity");return s.setMessage("groupID:".concat(a," topicIDList:").concat(e)),this.req({P:G.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)}),T({successTopicList:o,failureTopicList:i})}).catch(function(e){return s.setError(e).end(),M.e("".concat(n," failed. error:"),e),E(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)?E({code:k.PROFANITY_FOUND}):((t=new P("updateTopicProfile")).setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),N(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.req({P:G.UPDATE_TOPIC_PROFILE,data:y({},e)}).then(function(){return t.end(),M.l("".concat(o," ok")),n._updateTopicMap([e]),T({topic:n.getLocalTopic(e.groupID,e.topicID)})}).catch(function(e){return t.setError(e).end(),M.e("".concat(o," failed. error:"),e),E(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 P("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)),D({successTopicList:s,failureTopicList:[]})}}return this.req({P:G.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)),T({successTopicList:e,failureTopicList:r})}).catch(function(e){return c.setError(e).end(),M.e("".concat(n," failed. error:"),e),E(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(tn(this.MAX_QUERY_USER_COUNT))),t=i.slice(0,this.MAX_QUERY_USER_COUNT));var s=new P("getUserStatus");return this._userM.req({P:G.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:xo(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,".")),T({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),E(e)})}},{key:"subscribeUserStatus",value:function(e){var t,n,o,i,a="subscribeUserStatus";return this._userM.canIUse(g.USER_STATUS)?(t="".concat(this._n,".").concat(a),(n=d(e=void 0===(e=e.userIDList)?[]:e)).length>this.MAX_SUBSCRIBE_USER_COUNT&&(M.w("".concat(t," ").concat(tn(this.MAX_SUBSCRIBE_USER_COUNT))),n=e.slice(0,this.MAX_SUBSCRIBE_USER_COUNT)),o=new P(a),i="userID count:".concat(e.length),M.l("".concat(t," ").concat(i)),this._userM.req({P:G.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,".")),T({failureUserList:e})}).catch(function(e){return o.setMessage(i).setError(e).end(),M.e("".concat(t," failed. error:"),e),E(e)})):this._userM.noUse(a)}},{key:"unsubscribeUserStatus",value:function(e){var t,n,o,i,a="unsubscribeUserStatus";return this._userM.canIUse(g.USER_STATUS)?(t="".concat(this._n,".").concat(a),n=d(e=void 0===(e=(e||{}).userIDList)?[]:e),e.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(M.w("".concat(t," ").concat(tn(this.MAX_UNSUBSCRIBE_USER_COUNT))),n=e.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT)),o=new P(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:G.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,".")),T({failureUserList:e})}).catch(function(e){return o.setMessage("".concat(i)).setError(e).end(),M.e("".concat(t," failed. error:"),e),E(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}}]),vi=(t(Ti,c),e(Ti,[{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:f.NICK,value:e},{tag:f.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,d(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=[]}}])),Ni="none",Gi="online",Pi=e(function e(t){p(this,e),this._m=t,this._networkType=Gi,this._n="NetMonitorModule",this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null,this._removeListener=null,this._m.getIEmitInst().on(U.A2KEY_AND_TINYID_UPDATED,this._startRN,this)},[{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===Ni?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=Gi,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:Gi})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:Ni})}},{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 P("networkChange").setMessage("isConnected:".concat(t," ").concat(i)).end()}},{key:"isOnline",value:function(){return this._networkType!==Ni}},{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)}}]);function Ui(e){p(this,Ui),(e=i(this,Ui,[e]))._n="EventStatModule",e.TAG="im-ssolog-event",e._reportBody=new Ai,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(U.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,e),t.on(U.CLOUD_CONFIG,e._onCloudConfig,e),e}function bi(e,t){return e(t={exports:{}},t.exports),t.exports}var wi=bi(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 R.MSG_IMAGE:return t.addTotalCount(Zn),this._uploadImage(e);case R.MSG_FILE:return t.addTotalCount(Zn),this._uploadFile(e);case R.MSG_AUDIO:return t.addTotalCount(Zn),this._uploadAudio(e);case R.MSG_VIDEO:return t.addTotalCount(Zn),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(v){var I=this,e=this.get(2),M=v.getElements()[0],t=e.getMessageOption(v.clientSequence);return this.doUploadImage({file:t.payload.file,to:t.to,message:v,onProgress:function(e){if(M.updatePercent(e),dt(t.onProgress))try{t.onProgress(e)}catch(e){return E({code:k.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:Mt(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?E({code:k.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?E({code:k.MSG_F_IS_EMPTY}):-1===Bo.indexOf(e.file.videoFile.type)?E({code:k.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 L({code:k.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?E({code:k.MSG_F_IS_EMPTY}):(this._setUploadFileType(3),this.uploadByCOS(e)):E({code:k.MSG_A_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(t){var c,u,l,d,p=this;return dt(this._cosUploadMethod)?this.timUploadPlugin?this._uploadWithPreSigUrl(t):(c=new P("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 L({code:k.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(Zn,n),o.addFileSize(Zn,d.size),c.setMessage(t).end()):(i=new L({code:k.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"),E({code:k.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 P("upload"),e=d.requestSnapshotUrl,c=void 0===e?void 0:e,u=W(d,qi),l=Date.now();p._cosUploadMethod(u,function(e,t){if(e||403===t.statusCode)r.setError(new L(e)).end(),o={HttpStatusCode:9999,CostTime:an(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 L({code:k.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,an(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(Zn,e),o.addFileSize(Zn,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?ua(192|t>>>6,128|63&t):ua(224|t>>>12,128|t>>>6&63,128|63&t)},da=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,la),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 L({code:k.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!==ma&&(this._onOpenTs=Date.now(),n=e.id,e=e.res,this._socketID=n,t=an(this._startTs,!1),n="socketID:".concat(n," res:").concat(e),M.l("".concat(this._n,"._onOpen cost:").concat(t," ms. ").concat(n)),new P("wsOnOpen").setMessage(t).setCostTime(t).setMoreMessage(n).end(),this._readyState=ga,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 P("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=ma,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 P("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=ma,this._chM.onError())}},{key:"onMessage",value:function(t){var e,n,o,i,a,s;try{e=JSON.parse(t.data)}catch(e){new P("jsonParseError").setMessage(t.data).end()}e&&e.head&&(t=this._getRequestIDFromHead(e.head),n=e.body,this._chM.get(30).isTRTCCommand(t)||(s=Yt(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])?sa(t):n[t]},a={},Object.keys(o).forEach(function(e){a[i(o[e],e)]=o[e]}),qt(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 L({code:n.errorCode,message:n.errorInfo||"",data:t.includes(G.MODIFY_C2C_MSG)||t.includes(G.MODIFY_GRP_MSG)?{elements:n.elements,messageVersion:n.messageVersion,cloudCustomData:n.cloudCustomData,headSeq:s}:{headSeq:s}}))):o(T(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!==fa&&this._readyState!==ga&&(this._startTs=Date.now(),this._onOpenTs=0,this._readyState=fa,this._socket=new pa(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 P("wsConnect").setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end())}},{key:"getURL",value:function(){this._chM.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=Bt(),t=((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.5.5");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=ma)}},{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>>1^3988292384:o>>>=1}return(4294967295^o)>>>0}},{key:"close",value:function(){M.l("".concat(this._n,".close")),this._closeConnection(4e3),this._promiseMap.clear(),this._startSequence=mt(),this._readyState=ma,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}]),Ia=function(a,s,r){return new Promise(function(t,e){var n,o,i="application/x-www-form-urlencoded;charset=UTF-8";v?I.request({url:s,data:r,method:a,timeout:3e3,header:{"content-type":i},success:function(e){e&&e.data&&e.data.NetCheckInfo&&M.l("".concat("getconninfo ok in"," miniapp. ret:"),e.data),t()},fail:function(){e(new L({code:k.NETWORK_ERROR}))}}):(n=new XMLHttpRequest,o=setTimeout(function(){n.abort(),e(new L({code:k.NETWORK_TIMEOUT}))},3e3),n.onreadystatechange=function(){4===n.readyState&&(o&&clearTimeout(o),200===n.status||304===n.status?(n.responseText&&-1=this._socketHandler.getNextPingTs()&&this._ping()}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),-1>>30-e)}function Pa(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(Es,c);var Ua=e(Es,[{key:"_init",value:function(){this._updateCmdFreqLimitMap(La)}},{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)?E({code:n=k.OVER_FREQUENCY_LIMIT,message:this.getErrMsg(n,this._getCmd(t))}):this._isServerOverload(t)?E({code:n=k.OPEN_SERVICE_OVERLOAD_ERROR,message:this.getErrMsg(n,this._getCmd(t))}):(n=this.get(21),Da.includes(o)?n.simplySend(e):n.send(e))):(M.w("".concat(this._n,".req unknown P:").concat(o)),E({code:k.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:oe,websdkversion:ne,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:75689843,sdkability_ext:Na(""),cappid:e.getApplicationID(),cs:0}}},{key:"genCosSpecifiedHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:oe,websdkversion:ne,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:75689843,sdkability_ext:Na(""),cappid:e.getApplicationID(),cs:0}}},{key:"genSSOReportHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:oe,websdkversion:ne,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:75689843,sdkability_ext:Na(""),cappid:e.getApplicationID(),cs:0}}},{key:"getProtocolData",value:function(e){return this._pHandler.getProtocolData(e)}},{key:"trans",value:function(e){var t=e.servcmd,e=e.data,t={head:y(y({},this.genCommonHead()),{},{servcmd:t}),body:e};return this.get(21).send(t)}},{key:"sendComboMessage",value:function(e){var t=e.servcmd,e=e.data,t={head:y(y({},this.genCommonHead()),{},{servcmd:t}),body:e};return this.get(21).send(t)}},{key:"onErrorCodeNotZero",value:function(e){var t,n=e.errorCode;n===k.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!==k.MSG_A2KEY_EXPIRED&&n!==k.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 P("reLogin"),this.req({P:G.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=xo(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:R.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)),o=(n&&n.clearCacheOnReconnected(),r.get(8));o&&o.updateCacheOnReconnected()}))}},{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:G.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 P("fetchCloudCtrlConfig"),e=this.get(12).getSDKAppID(),this._isFetching=!0,this.req({P:G.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 P("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(U.CLOUD_CONFIG),this.emitOEvt(h.SERVER_CONFIG_UPDATED,{config:c}))}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}}])),wa=(t(Ts,c),e(Ts,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var n,o,i,a,s=this,e=this._getLocalConvList().filter(function(e){return e.type===R.CONV_GROUP&&e.groupProfile.type!==R.GRP_AVCHATROOM}),r=this.get(11),c=[];e.forEach(function(e){var t=e.conversationID,e=e.lastMessage;n=t.replace(R.CONV_GROUP,""),o=r.getLocalLastMessage(t),e&&0!==e.lastSequence&&o&&(i=e.lastSequence,o=o.sequence,a=i-o,0n[0])&&a",n[r].tag)}this.profile=new Ho(y(y({},o),{},{profileCustomField:i}))},[{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",e[s].tag)}}();this.timestamp=Date.now(),a.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"))}}])),Za=e(function e(t){p(this,e),this._commercialConfigM=t,this._n="PurchasedFeatureHandler",this._isCSPluginReported=!1,this._featureMap=new Map},[{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 $(0,Math.pow(2,o)):new $(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 $(0,Math.pow(2,a)):new $(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)),D({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 $(0,Math.pow(2,o)):new $(Math.pow(2,o-32),0)).toString(),!this._featureMap.get(i))break;var i,a="",s=0;i===g.PLUGIN_TRANSLATE?(a="plugin_translate",s=16):i===g.PLUGIN_VOICE_TO_TEXT?(a="plugin_voice_to_text",s=17):i===g.PLUGIN_CS?(a="plugin_cs",s=14):i===g.PLUGIN_PUSH?(a="plugin_push",s=13):i===g.PLUGIN_BOT?(a="plugin_bot",s=15):i===g.MSG_REACTION&&(a="plugin_emoji_reaction",s=18),""!==a&&(i=this._commercialConfigM.get(12).getUIPlatform(),new P(a).setCode(s).setUIPlatform(i).end(),M.l("".concat(this._n,".isFeatureEnabledForStat ").concat(a," code:").concat(s," uiPlatform:").concat(i)))}}},{key:"isCSPluginEnabled",value:function(){var e;this._isCSPluginReported||(e=this._commercialConfigM.get(12).getUIPlatform(),new P("plugin_search").setCode(6).setUIPlatform(e).end(),this._isCSPluginReported=!0)}},{key:"clear",value:function(){this._featureMap.clear(),this._isCSPluginReported=!1}}]),Qa=e(function e(t){p(this,e),this._m=t,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new Za(this)},[{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 P("fetchCommercialConfig"),o=this.get(12).getSDKAppID(),e=this.get(20),this._isFetching=!0,e.req({P:G.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 P("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:"isCSPluginEnabled",value:function(){this._purchasedFeatureHandler.isCSPluginEnabled()}},{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()}}]),$a=(t(Is,c),e(Is,[{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 P("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");dt(this._offlinePushPlugin.getDeviceToken)?(c="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID),M.l("".concat(l," start. ").concat(c)),new P("_getDeviceToken").setMessage("".concat(c)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,function(e){var t,n,o,i,a=new P("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")):dt(this._offlinePushPlugin.setAppShowListener)?(new P("_setAppShowListener").end(!0),M.l("".concat(n," start")),this._offlinePushPlugin.setAppShowListener(function(e){e=(e||{}).appShow;new P("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)&&dt(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===te.IOS||a===te.IPAD||a===te.MAC?i=this._deviceToken:a===te.ANDROID&&(o=this._deviceToken),new P("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:G.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),E(e)})}},{key:"_getConvUnreadCount",value:function(){var t=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(11).getLocalConvList().forEach(function(e){e.type===R.CONV_C2C&&(t._c2cUnreadCount+=e.unreadCount),e.type===R.CONV_GROUP&&(t._groupUnreadCount+=e.unreadCount)})}},{key:"_onBackground",value:function(){var t=this,n="".concat(this._n,".").concat("_onBackground"),o=new P("_onBackground");this.req({P:G.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 P("_onForeground");this.req({P:G.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?te.IOS:"android"===e?te.ANDROID:1002===t?te.IPAD:1001===t?te.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"))}}])),es=(t(vs,c),e(vs,[{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 P("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");dt(this._pushPlugin.getPushEventCacheList)?(new P("_reportEventCacheList").end(!0),this._pushPlugin.getPushEventCacheList(function(e){var t=e.code,n=e.data.eventList,o=new P("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===R.MSG_TEXT||t===R.MSG_CUSTOM){var i,a="".concat(this._n,".filterMessage");if(M.l("".concat(a)),t===R.MSG_TEXT){if(o===R.CONV_C2C?i="c2c_text_message":o===R.CONV_GROUP&&(i="group_text_message"),!this._isConfigOn(i))return n;var s=this._plugin.filter(e.payload.text),r=s.type,s=s.modifiedText;1===r?n=!1:2===r&&(e.payload.text=s)}else if(t===R.MSG_CUSTOM){if(o===R.CONV_C2C?i="c2c_custom_message":o===R.CONV_GROUP&&(i="group_custom_message"),!this._isConfigOn(i))return n;r=this._plugin.filter(e.payload.data),s=this._plugin.filter(e.payload.description),t=this._plugin.filter(e.payload.extension);1===r.type||1===s.type||1===t.type?n=!1:(2===r.type&&(e.payload.data=r.modifiedText),2===s.type&&(e.payload.description=s.modifiedText),2===t.type&&(e.payload.extension=t.modifiedText))}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 P("profanityFilter"),p="".concat(this._n,"._getLexicon");this._isFetching=!0,this.req({P:G.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(C(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.5.5"!==e;return M.l("".concat(this._n,"._needToUpdate isTimeout:").concat(t," isDifferentVersion:").concat(e)),t||e}},{key:"_fetch",value:function(){this._m.get(12).isPrivateNetWork()||this._fetchWithRetry()}},{key:"_fetchWithRetry",value:function(){var e=this;this._fetchAdapter().catch(function(){e.CURRENT_DOMAIN!==de&&(e._generateCurrentDomain(),e._fetchWithRetry())})}},{key:"_generateCurrentDomain",value:function(){this.CURRENT_DOMAIN===ue?this.CURRENT_DOMAIN=le:this.CURRENT_DOMAIN===le&&(this.CURRENT_DOMAIN=de)}},{key:"_fetchAdapter",value:function(){var i="https://".concat(this.CURRENT_DOMAIN,"/im/download/error-message/v3/0.0.7/tim-error-message.txt"),a="application/x-www-form-urlencoded;charset=UTF-8",s="".concat(this._n,"._fetchAdapter ok in"),r=this;return new Promise(function(t,n){var e,o;v?I.request({url:i,method:"GET",timeout:3e3,header:{"content-type":a},dataType:"text",success:function(e){r._fillAndSave(e.data),M.l("".concat(s," mini program.")),t()},fail:function(e){n(e)}}):(e=new XMLHttpRequest,o=setTimeout(function(){e.abort()},3e3),e.onreadystatechange=function(){4===e.readyState&&(o&&clearTimeout(o),200===e.status||304===e.status?(M.l("".concat(s," browser.")),r._fillAndSave(e.responseText),t()):n(e.status))},e.onerror=function(e){n(e)},e.open("GET",i,!0),e.setRequestHeader("Content-type",a),e.send())})}},{key:"_fillAndSave",value:function(e){this._fillMap(e),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:e,localSavedTime:(new Date).getTime(),localSavedVersion:"3.5.5"}),!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;sHe()-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()}},{key:"onFollowNotify",value:function(e){var a=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,e=W(e,ds),o=e.from,i=W(e,ps);t.forEach(function(e){var t=e.isAdd,e=e.followType,e=void 0===e?0:e,n=a._initFollowInfo();1===t?(i.userID=o,n[e].userInfoList.push(i),n[e].isAdd=!0):(n[e].userInfoList.push(o),n[e].isAdd=!1),a._emitEvent(n)})})}},{key:"_initFollowInfo",value:function(){var t={};return Object.values(_s).forEach(function(e){e!==_s.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>>16&65535|0,s=0;0!==n;){for(n-=s=2e3>>8^i[255&(e^t[s])];return-1^e}function ks(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,R=0,A=new ie.Buf16(16),O=new ie.Buf16(16),N=null,G=0,v=0;v<=15;v++)A[v]=0;for(I=0;I_?(g=N[G+s[I]],k[R+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==--A[v]){if(v===y)break;v=t[n+s[I]]}if(C>>1:n>>>1;e[t]=n}return e}(),As=[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],Os=[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],Ns=[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],Gs=[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 Ps(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function Us(){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 bs(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 ws(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,bs(e)):-2}function Fs(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=Ss(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=Ss(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=Ss(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=Ss(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=Ss(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=Ss(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(Bs){for(xs=new ie.Buf32(512),Vs=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(ks(1,C.lens,0,288,xs,0,C.work,{bits:9}),y=0;y<32;)C.lens[y++]=5;ks(2,C.lens,0,32,Vs,0,C.work,{bits:5}),Bs=!1}if(C.lencode=xs,C.lenbits=9,C.distcode=Vs,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[H[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,m={bits:t.lenbits},f=ks(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=ks(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=ks(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=W=k=S=L=E=D=T=oe=ne=te=ee=U=P=$=Q=Z=X=z=J=j=N=Y=O=A=void 0;var T,D,E,L,S,k,R=e,K=u,A=R.state,O=R.next_in,W=R.input,Y=O+(R.avail_in-5),N=R.next_out,G=R.output,j=N-(K-R.avail_out),J=N+(R.avail_out-257),z=A.dmax,X=A.wsize,Z=A.whave,Q=A.wnext,$=A.window,P=A.hold,U=A.bits,ee=A.lencode,te=A.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+=W[O++]<>>=D=T>>>24,U-=D,!(16&(D=T>>>16&255))){if(0==(64&D)){T=te[(65535&T)+(P&(1<z){R.msg="invalid distance too far back",A.mode=30;break t}if(P>>>=D,U-=D,L>(D=N-j)){if((D=L-D)>Z&&A.sane){R.msg="invalid distance too far back",A.mode=30;break t}if(k=$,(S=0)===Q){if(S+=X-D,D>3,P&=(1<<(U-=E<<3))-1,R.next_in=O,R.next_out=N,R.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&&Ys||!c.subarray&&Ws))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]"===er.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw)&&(e=Ks.inflateSetDictionary(this.strm,t.dictionary))!==Qs.Z_OK)throw new Error($s[e])}function nr(e,t){t=new tr(t);if(t.push(e,!0),t.err)throw t.msg||$s[t.err];return t.result}tr.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?Qs.Z_FINISH:Qs.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+js[e[n]]>t?n:t}(r.output,r.next_out),a=r.next_out-i,s=zs(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!==R.MSG_MERGER?E({code:k.MSG_MERGER_TYPE_INVALID}):S(e.payload.downloadKey)?E({code:k.MSG_MERGER_KEY_INVALID}):this._get(2).downloadMergerMessage(e).catch(function(e){return E({code:k.MSG_MERGER_DOWNLOAD_FAIL})})}},{key:"createForwardMessage",value:function(e){return this._get(2).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof So?this._get(2).sendMessageInstance(e,t):E({code:k.MSG_INSTANCE_REQUIRED})}},{key:"callExperimentalAPI",value:function(e,t){return"sendComboMessage"===e?this._get(31).sendMessage(t):"handleGroupInvitation"===e?this._get(7).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._get(27).isFeatureEnabled(t):"isFeatureEnabledForStat"===e?this._get(27).isFeatureEnabledForStat(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e||"sendRoomCustomData"===e?this._get(30).sendTRTCCustomData(t):"getTimerID"===e?this._m.getTimerID():"getPollingTimerID"===e?this._m.getPollingTimerID(t):"setApplicationID"===e?(this._get(12).setApplicationID(t),void this._get(20).updateProtocolConfig()):"getServerConfig"===e?this._get(23).getServerConfig(t):"canIUseModule"===e?this._m.canIUseModule(t):"startMessageLongPolling"===e?this._get(7).startMessageLongPolling(t):"stopMessageLongPolling"===e?this._get(7).stopMessageLongPolling(t):"disableMessagePullOnInvite"===e?this._get(11).disableMsgPullOnInvite(t):"clearLocalMessage"===e?this._get(11).clearMemMsg(t,!1):"setCustomLoginInfo"===e?this._get(12).setCustomLoginInfo(t):"statTUIKeyFeatures"===e?this._m.statTUIKeyFeatures(t):"getGroupReceiptsByUsers"===e?this._get(7).getGroupReceiptsByUsers(t):E({code:k.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._get(2).revokeMessage(e)}},{key:"resendMessage",value:function(e,t){return e instanceof So?this._get(2).resendMessage(e,t):E({code:k.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):E({code:k.NO_MODULE})}},{key:"findMessage",value:function(e){return this._get(11).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._get(11).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._get(11).getConvList(e)}},{key:"getConversationProfile",value:function(e){return this._get(11).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._get(11).deleteConversation(e)}},{key:"setConversationDraft",value:function(e){return this._get(11).setConvDraft(e)}},{key:"clearHistoryMessage",value:function(e){return this._get(11).clearHistoryMessage(e)}},{key:"pinConversation",value:function(e){return this._get(11).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._get(11).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._get(11).setMessageRemindType(e)}},{key:"setAllReceiveMessageOpt",value:function(e){return this._get(11).setAllRcvMsgOpt(e)}},{key:"getAllReceiveMessageOpt",value:function(){return this._get(11).getAllRcvMsgOpt()}},{key:"getTotalUnreadMessageCount",value:function(){return this._get(11).getTotalUnreadCount()}},{key:"setConversationCustomData",value:function(e){return this._get(11).setConvCustomData(e)}},{key:"markConversation",value:function(e){return this._get(11).markConv(e)}},{key:"getConversationGroupList",value:function(){return this._get(11).getConvGroupList()}},{key:"createConversationGroup",value:function(e){return this._get(11).createConvGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._get(11).deleteConvGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._get(11).renameConvGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._get(11).addConvsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._get(11).deleteConvsFromGroup(e)}},{key:"searchCloudMessages",value:function(e){var t=this._get(38);return t?t.searchCloudMessages(e):E({code:k.NO_MODULE})}},{key:"searchCloudUsers",value:function(e){var t=this._get(38);return t?t.searchCloudUsers(e):E({code:k.NO_MODULE})}},{key:"searchCloudGroups",value:function(e){var t=this._get(38);return t?t.searchCloudGroups(e):E({code:k.NO_MODULE})}},{key:"searchCloudGroupMembers",value:function(e){var t=this._get(38);return t?t.searchCloudGroupMembers(e):E({code:k.NO_MODULE})}},{key:"getMyProfile",value:function(){return this._get(4).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._get(4).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._get(4).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._get(4).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._get(4).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._get(4).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._get(4).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._get(4).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._get(4).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._get(4).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._get(8);return e?e.getLocalFriendList():E({code:k.NO_MODULE})}},{key:"addFriend",value:function(e){var t=this._get(8);return t?t.addFriend(e):E({code:k.NO_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._get(8);return t?t.deleteFriend(e):E({code:k.NO_MODULE})}},{key:"checkFriend",value:function(e){var t=this._get(8);return t?t.checkFriend(e):E({code:k.NO_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._get(8);return t?t.getFriendProfile(e):E({code:k.NO_MODULE})}},{key:"updateFriend",value:function(e){var t=this._get(8);return t?t.updateFriend(e):E({code:k.NO_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._get(8);return e?e.getLocalFriendApplicationList():E({code:k.NO_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._get(8);return t?t.acceptFriendApplication(e):E({code:k.NO_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._get(8);return t?t.refuseFriendApplication(e):E({code:k.NO_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._get(8);return t?t.deleteFriendApplication(e):E({code:k.NO_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._get(8);return e?e.setFriendApplicationRead():E({code:k.NO_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._get(8);return e?e.getLocalFriendGroupList():E({code:k.NO_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._get(8);return t?t.createFriendGroup(e):E({code:k.NO_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._get(8);return t?t.deleteFriendGroup(e):E({code:k.NO_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._get(8);return t?t.addToFriendGroup(e):E({code:k.NO_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._get(8);return t?t.removeFromFriendGroup(e):E({code:k.NO_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._get(8);return t?t.renameFriendGroup(e):E({code:k.NO_MODULE})}},{key:"followUser",value:function(e){var t=this._get(35);return t?t.followUser(e):E({code:k.NO_MODULE})}},{key:"unfollowUser",value:function(e){var t=this._get(35);return t?t.unfollowUser(e):E({code:k.NO_MODULE})}},{key:"getMyFollowersList",value:function(e){var t=this._get(35);return t?t.getMyFollowersList(e):E({code:k.NO_MODULE})}},{key:"getMyFollowingList",value:function(e){var t=this._get(35);return t?t.getMyFollowingList(e):E({code:k.NO_MODULE})}},{key:"getMutualFollowersList",value:function(e){var t=this._get(35);return t?t.getMutualFollowersList(e):E({code:k.NO_MODULE})}},{key:"getUserFollowInfo",value:function(e){var t=this._get(35);return t?t.getUserFollowInfo(e):E({code:k.NO_MODULE})}},{key:"checkFollowType",value:function(e){var t=this._get(35);return t?t.checkFollowType(e):E({code:k.NO_MODULE})}},{key:"getGroupList",value:function(){var e=this._get(7);return e?e.getGroupList():E({code:k.NO_MODULE})}},{key:"getGroupProfile",value:function(e){var t=this._get(7);return t?t.getGroupProfile(e):E({code:k.NO_MODULE})}},{key:"createGroup",value:function(e){var t=this._get(7);return t?t.createGroup(e):E({code:k.NO_MODULE})}},{key:"dismissGroup",value:function(e){var t=this._get(7);return t?t.dismissGroup(e):E({code:k.NO_MODULE})}},{key:"updateGroupProfile",value:function(e){var t=this._get(7);return t?t.updateGroupProfile(e):E({code:k.NO_MODULE})}},{key:"joinGroup",value:function(e){var t=this._get(7);return t?t.joinGroup(e):E({code:k.NO_MODULE})}},{key:"quitGroup",value:function(e){var t=this._get(7);return t?t.quitGroup(e):E({code:k.NO_MODULE})}},{key:"searchGroupByID",value:function(e){var t=this._get(7);return t?t.searchGroupByID(e):E({code:k.NO_MODULE})}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._get(7);return t?t.getGroupOnlineMemberCount(e):E({code:k.NO_MODULE})}},{key:"changeGroupOwner",value:function(e){var t=this._get(7);return t?t.changeGroupOwner(e):E({code:k.NO_MODULE})}},{key:"getGroupApplicationList",value:function(){var e=this._get(7);return e?e.getGroupApplicationList():E({code:k.NO_MODULE})}},{key:"handleGroupApplication",value:function(e){var t=this._get(7);return t?t.handleGroupApplication(e):E({code:k.NO_MODULE})}},{key:"initGroupAttributes",value:function(e){var t=this._get(7);return t?t.initGroupAttributes(e):E({code:k.NO_MODULE})}},{key:"setGroupAttributes",value:function(e){var t=this._get(7);return t?t.setGroupAttributes(e):E({code:k.NO_MODULE})}},{key:"deleteGroupAttributes",value:function(e){var t=this._get(7);return t?t.deleteGroupAttributes(e):E({code:k.NO_MODULE})}},{key:"getGroupAttributes",value:function(e){var t=this._get(7);return t?t.getGroupAttributes(e):E({code:k.NO_MODULE})}},{key:"setGroupCounters",value:function(e){var t=this._get(7);return t?t.setGroupCounters(e):E({code:k.NO_MODULE})}},{key:"increaseGroupCounter",value:function(e){var t=this._get(7);return t?t.increaseGroupCounter(e):E({code:k.NO_MODULE})}},{key:"decreaseGroupCounter",value:function(e){var t=this._get(7);return t?t.decreaseGroupCounter(e):E({code:k.NO_MODULE})}},{key:"getGroupCounters",value:function(e){var t=this._get(7);return t?t.getGroupCounters(e):E({code:k.NO_MODULE})}},{key:"getGroupMemberList",value:function(e){var t=this._get(7);return t?t.getGroupMemberList(e):E({code:k.NO_MODULE})}},{key:"getGroupMemberProfile",value:function(e){var t=this._get(7);return t?t.getGroupMemberProfile(e):E({code:k.NO_MODULE})}},{key:"addGroupMember",value:function(e){var t=this._get(7);return t?t.addGroupMember(e):E({code:k.NO_MODULE})}},{key:"deleteGroupMember",value:function(e){var t=this._get(7);return t?t.deleteGroupMember(e):E({code:k.NO_MODULE})}},{key:"setGroupMemberMuteTime",value:function(e){var t=this._get(7);return t?t.setGroupMemberMuteTime(e):E({code:k.NO_MODULE})}},{key:"setGroupMemberRole",value:function(e){var t=this._get(7);return t?t.setGroupMemberRole(e):E({code:k.NO_MODULE})}},{key:"setGroupMemberNameCard",value:function(e){var t=this._get(7);return t?t.setGroupMemberNameCard(e):E({code:k.NO_MODULE})}},{key:"setGroupMemberCustomField",value:function(e){var t=this._get(7);return t?t.setGroupMemberCustomField(e):E({code:k.NO_MODULE})}},{key:"markGroupMemberList",value:function(e){var t=this._get(7);return t?t.markGroupMemberList(e):E({code:k.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):E({code:k.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):E({code:k.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):E({code:k.NO_MODULE})}},{key:"accept",value:function(e){var t=this._get(33);return t?t.accept(e):E({code:k.NO_MODULE})}},{key:"reject",value:function(e){var t=this._get(33);return t?t.reject(e):E({code:k.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):E({code:k.NO_MODULE})}}]),mr={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 vr(e){return p(this,vr),(e=i(this,vr,[e]))._n="CSModule",e}var Ir={},Vn={};return Vn.create=function(e){var t="TencentCloudChat.create",n=0,o=e.SDKAppID;if(A(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&&Ir[n])return Ir[n];M.l("".concat(t));var s,i,o=new fr(y(y({},e),{},{SDKAppID:n})),e=(o.on(h.SDK_DESTROY,function(e){Ir[e.data.SDKAppID]=null,delete Ir[e.data.SDKAppID]}),s=o,i=Object.create(null),Object.keys(Hn).forEach(function(a){var t;s[a]&&(t=new Q,i[a]=function(){var e=Array.from(arguments);return t.use(function(e,t){i=a;var n,o,i=!(!(n=s).isReady()&&1!==mr[i])||(o={code:o=n.getNotReadyReason(),message:"".concat(n.getErrMsg(o)," | ").concat(i," | ").concat(n.getErrMsg(k.SDK_IS_NOT_READY))},n.onError(o),o);return!0===i?t():E(i)}).use(function(e,t){if(!0===function(n,o,i){if(void 0===o)return!0;var a=!0;if(m(o))Object.keys(o).forEach(function(e){var t=1===n.length?n[0][e]:void 0;a=!!rn(t,o[e],i,e)&&a});else if(O(o))for(var e=0;e