!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 d(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[s++]}},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,s=o.min,o=o.max;return P(e)?!!i||(r({api:t,paramName:n,desc:pn()}),!1):O(e)?O(s)&&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({},a),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*s&6))))i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);try{return decodeURIComponent(escape(n))}catch(e){return""}}var qo=["jpg","jpeg","gif","png","bmp","image","webp"],xo=["mp4","quicktime","mov","video"],Vo=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||A.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||A.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=t.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,s=null,a=0;a=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()}}]),Ho=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"],Ko=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)Ho.indexOf(t)<0||("selfInfo"!==t?("memberNum"===t&&(this.memberCount=e[t]),"maxMemberNum"===t&&(this.maxMemberCount=e[t]),"isSupportTopic"!==t?"muteAllMembers"===t&&C(e[t])?this.muteAllMembers="On"===e[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),P(e.muteAllMembers)||("On"===e.muteAllMembers?e.muteAllMembers=!0:e.muteAllMembers=!1),e.groupCustomField&&Rt(this.groupCustomField,e.groupCustomField),P(e.memberNum)||(this.memberCount=e.memberNum),P(e.maxMemberNum)||(this.maxMemberCount=e.maxMemberNum),P(e.isSupportTopic)||(this.isSupportTopic=O(e.isSupportTopic)?1===e.isSupportTopic:e.isSupportTopic),gt(this,e,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),N(e.members)&&0e?(c.messageList=i.slice(r-e,r),c.nextReqMessageID=a?i[r-e].ID:i[r-e].sequence+""):(c.messageList=i.slice(0,r),c.isCompleted=!0):eo||n&&s.sequence>n)){if("in"===s.flow&&s.isRead)break;s.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,s,a,r,c,e):u._emitMsgReceived(s,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,s,a=!1,r=e.length,c=0;c=this.CACHE_EXPIRE_TIME||r=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:o,avChatRoomKey:s}).then(function(e){a.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 a.setError(e).end(),E(e)});a.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:R.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:R.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,s=e.counterList,s=void 0===s?[]:s,e=e.groupCounterSeq;this._hasLocalGroupCounters(i)&&(o=this._getLocalGroupCounters(i),n=o.counters,t=o.avChatRoomKey,o=o.groupCounterSeq,0this._startBroadcastSeq&&(this._startBroadcastSeq=c),N(a)&&01e3*t.expireTime&&1e41e3*this.avChatRoomMembersFreqInterval)?(this.avChatRoomMembersReqInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1):(this.avChatRoomMembersReqInfoMap.set(e,{startTime:t,requestCount:n+=1}),n>this.avChatRoomMembersFreqCount)}},{key:"getGroupMemberProfile",value:function(e){var t,n=this,o="getGroupMemberProfile",i="".concat(this._n,".").concat(o),s="groupID:".concat(e.groupID),a=(5=i&&t.messageList.push(e)}),(Gt({groupID:n})||Ut(n))&&0===t.messageList.length&&s[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,s=e.elements,a=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=s[0].type,t.payload=s[0].content,t.messageForShow=Zt(t.type,t.payload,this.isIntl()),t.cloudCustomData=a,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,s=this;0!==e.length&&(o=n=null,i=!1,e.forEach(function(e){var t=e.to;o=Xt(t),(n=s.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),s=this.getLocalTopic(i,e);s&&(o=s.selfInfo.excludedUnreadSequenceList||[],P(n)||(o=n),t._isExcludedFromUnreadCount&&o.push(t.sequence),s.updateSelfInfo({excludedUnreadSequenceList:o}),M.l("".concat(this._n,".updateUnreadCountAndLastMsg seq:").concat(t.sequence," lastSeq:").concat(s.lastMessage.lastSequence)),t.sequence>s.lastMessage.lastSequence)&&(s.updateLastMessage(t),n=t.sequence+1,s.updateNextMessageSeq(n),o=this._computeUnreadCount(s),s.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:s}))}},{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 P(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 G("createTopicInCommunity"),this.req({P:R.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"),s=e.groupID,e=e.topicIDList,e=void 0===e?[]:e,a=new G("deleteTopicFromCommunity");return a.setMessage("groupID:".concat(s," topicIDList:").concat(e)),this.req({P:R.DEL_TOPIC,data:{groupID:s,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 a.setMoreMessage(e).end(),M.l("".concat(n," ok. ").concat(e)),o.forEach(function(e){t._deleteLocalTopic(s,e.topicID)}),T({successTopicList:o,failureTopicList:i})}).catch(function(e){return a.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 G("updateTopicProfile")).setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),P(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.req({P:R.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 G("getTopicList");if(c.setMessage("groupID:".concat(o)),this._getTopicTimeMap.has(o)){var s=this._getTopicTimeMap.get(o),a=s.isGetAll,s=s.time;if((a||!a&&!i)&&Date.now()-s<1e3*this.TOPIC_CACHE_TIME){a=this._getLocalTopicList(o,e);if(i||a.length===e.length)return c.setMoreMessage("from cache, topic count:".concat(a.length)).end(),M.l("".concat(n," groupID:").concat(o," from cache, topic count:").concat(a.length)),D({successTopicList:a,failureTopicList:[]})}}return this.req({P:R.GET_TOPIC_LIST,data:{groupID:o,topicIDList:e}}).then(function(e){var e=e.data.topicInfoList,s=[],a=[],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?(s.push(y(y({},t),{},{selfInfo:n})),a.push(i)):r.push({topicID:i,code:o,message:e})}),t._updateTopicMap(s),t._handleTopicAtInfo(s),"success count:".concat(a.length,", fail count:").concat(r.length)),e=(c.setMoreMessage(e).end(),M.l("".concat(n," groupID:").concat(o," from remote, ").concat(e)),[]);return S(a)||(t._getTopicTimeMap.set(o,{time:Date.now(),isGetAll:i}),e=t._getLocalTopicList(o,a)),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_USER_COUNT&&(M.w("".concat(s," ").concat(tn(this.MAX_USER_COUNT))),i.length=this.MAX_USER_COUNT);var p=[],_=this._userM.getMyAccount(),h=(this._chunkUserIDList(i,this.CHUNK_SIZE).forEach(function(e){p.push(n._getUserProfile(y(y({},t),{},{userIDList:e,fromAccount:_})))}),i.length),g=new G("getUserProfile"),f=(g.setMessage(51e3*this.strangerProfileExpirationTime)}},{key:"_getUserProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("_getUserProfile"),o=e.userIDList,i=[];return o.forEach(function(e){i.push({toAccount:e,standardSequence:0,customSequence:0})}),e.userItem=i,this._userM.req({P:R.GET_USER_PROFILE,data:e}).then(function(e){return t._handleResponse(e)}).catch(function(e){return M.e("".concat(n," failed. error:"),e),E(e)})}},{key:"getMyProfile",value:function(){var e,t=this._userM.getMyAccount(),n="".concat(this._n,".getMyProfile");return M.l("".concat(n," myAccount:").concat(t)),this._fill(),this._contains(t)?(e=this._getProfileFromMap(t),M.d("".concat(n," from cache, myProfile:").concat(JSON.stringify(e))),D(e)):this.getUserProfile({fromAccount:t,userIDList:[t],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){var t=e.data.userProfileItem;if(!N(t))return[];for(var n=[],e=Date.now(),o=0,i=t.length;othis.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 a=new G("getUserStatus");return this._userM.req({P:R.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:Fo(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=(P(s)||t.unshift(s),"userID count:".concat(i.length,", success count:").concat(t.length,", fail count:").concat(e.length));return a.setMessage("".concat(n)).end(),M.l("".concat(o," ok. ").concat(n,".")),T({successUserList:t,failureUserList:e})}).catch(function(e){return a.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,s="subscribeUserStatus";return this._userM.canIUse(_.USER_STATUS)?(t="".concat(this._n,".").concat(s),(n=m(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 G(s),i="userID count:".concat(e.length),M.l("".concat(t," ").concat(i)),this._userM.req({P:R.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(s)}},{key:"unsubscribeUserStatus",value:function(e){var t,n,o,i,s="unsubscribeUserStatus";return this._userM.canIUse(_.USER_STATUS)?(t="".concat(this._n,".").concat(s),n=m(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 G(s),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:R.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(s)}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),mi=(t(Ci,c),e(Ci,[{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,m(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=[]}}])),Oi="none",Ni="online",Pi=e(function e(t){p(this,e),this._m=t,this._networkType=Ni,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;Ce&&(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===Oi?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)):Te&&(this._networkType=Ni,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:Ni})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:Oi})}},{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!==Oi}},{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):Te?(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null)):Ce&&this._removeListener&&(this._removeListener(),this._removeListener=null)}}]);function Gi(e){p(this,Gi),(e=i(this,Gi,[e]))._n="EventStatModule",e.TAG="im-ssolog-event",e._reportBody=new Ri,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 Ui(e,t){return e(t={exports:{}},t.exports),t.exports}var bi=Ui(function(e){var o=Object.prototype.hasOwnProperty,_="~";function n(){}function s(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 s(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(Zn),this._uploadImage(e);case A.MSG_FILE:return t.addTotalCount(Zn),this._uploadFile(e);case A.MSG_AUDIO:return t.addTotalCount(Zn),this._uploadAudio(e);case A.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,customFileName:t.payload.customFileName,to:t.to,message:v,onProgress:function(e){if(M.updatePercent(e),pt(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,s=e.height,a=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:s};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===xo.indexOf(e.file.videoFile.type)?E({code:k.MSG_V_TYPES_LIMIT}):(this._setUploadFileType(2),v||Ce?this.handleVideoUpload(y(y({},e),{},{file:e.file.videoFile})):Te?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 pt(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(s,a){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||N(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(),a(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)),s(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(),a(i))})})):(this.warn("PluginUndetected"),E({code:k.COS_UNDETECTED}))}},{key:"_uploadWithPreSigUrl",value:function(e){var c=this,u="".concat(this._n,"._uploadWithPreSigUrl"),l=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then(function(r){return new Promise(function(o,i){var s=new G("upload"),e=r.existFlag,t=W(r,Fi),a=Date.now();1!==e?c._cosUploadMethod(t,function(e,t){var n;e||403===t.statusCode?(n="".concat(P(e)?"":JSON.stringify(e)," ").concat(P(t)?"":JSON.stringify(t)),s.setMessage(n).end(),e={HttpStatusCode:9999,CostTime:sn(a,!1),error:e,url:r.url},t.data&&t.data.uploadIP&&(e.uploadIP=t.data.uploadIP),c._uploadSSOLog(e),M.l("".concat(u," failed, error:").concat(n)),i(new L({code:k.MSG_F_UPLOAD_FAIL}))):c._handleUploadSuccessResult({ssoLog:s,startTs:a,file:l,uploadOptions:r,uploadResult:t},o)}):c._handleUploadSuccessResult({ssoLog:s,startTs:a,file:l,uploadOptions:r,uploadResult:{data:{location:t.downloadUrl,statusCode:200}}},o)})})}},{key:"_handleUploadSuccessResult",value:function(e,t){var n=e.ssoLog,o=e.startTs,i=e.file,s=e.uploadOptions,a=s.existFlag,r=s.fileType,c=s.url,u=s.downloadUrl,l=s.requestSnapshotUrl,d=s.thumbUrl,p=s.largeUrl,s=s.imageInfoArray,s=void 0===s?[]:s,e=e.uploadResult,_=Object.create(null),h=e.data.location||"",h=(this.isPrivateNetWork()||0!==h.indexOf("https://")&&0!==h.indexOf("http://")||(h=h.split("//")[1]),_.fileName=i.name,_.fileSize=i.size,_.fileType=i.type.slice(i.type.indexOf("/")+1).toLowerCase(),_.location=h,sn(o,!1)),o=this._formatFileSize(i.size),g=this._formatSpeed(1e3*i.size/(h||1)),o="exist:".concat(a," fileType:").concat(r," bytes:").concat(i.size," size:").concat(o," time:").concat(h,"ms speed:").concat(g," res:").concat(JSON.stringify(e)),g=(M.l("".concat(this._n,"._uploadWithPreSigUrl ok. name:").concat(i.name," ").concat(o)),n.setMessage(o).end(),{HttpStatusCode:e.statusCode,FileSize:i.size,CostTime:h,url:c}),n=(e.data&&e.data.uploadIP&&(g.uploadIP=e.data.uploadIP),this._uploadSSOLog(g),this.get(26));if(n.addCost(Zn,h),n.addFileSize(Zn,i.size),1===a){if(0>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533}else t<=57343&&(t=65533);return t<=2047?cs(192|t>>>6,128|63&t):cs(224|t>>>12,128|t>>>6&63,128|63&t)},ls=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,us),n=0|t.length,o=new Uint8Array(n),i=0;i=i&&(M.l("".concat(s._n,"._checkPromiseMap request timeout, delete requestID:").concat(t)),s._promiseMap.delete(t),n(new L({code:k.NETWORK_TIMEOUT,data:{headSeq:e}})),s._chM.onRequestTimeout())})}},{key:"_checkNativeAppWS",value:function(){Me&&!this.isConnected()&&this._reConnect()}},{key:"onOpen",value:function(e){var t,n;this._readyState!==fs&&(this._onOpenTs=Date.now(),n=e.id,e=e.res,this._socketID=n,t=sn(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=hs,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||Ie&&!0===this._reConnectFlag&&n===this._socketID&&0===i||(this._readyState=fs,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=fs,this._chM.onError())}},{key:"onFail",value:function(e){this._readyState=fs;var t=e.id,e=e.e,t="currentSocketID:".concat(t," code:").concat(e.code," reason:").concat(e.reason);new G("wsOnFail").setMessage(t).setCode(e.code).end(!0),M.l("".concat(this._n,"._onFail ").concat(t))}},{key:"onMessage",value:function(t){var e,n,o,i,s,a;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)||(a=Yt(e.head),n=function t(e,n){var o,i,s;return N(e)?e.map(function(e){return lt(e)?t(e,n):e}):lt(e)?(o=e,i=function(e,t){return P(n[t])?ss(t):n[t]},s={},Object.keys(o).forEach(function(e){s[i(o[e],e)]=o[e]}),qt(s,function(e){return N(e)||lt(e)?t(e,n):e})):void 0}(e.body,this._getResKeyMap(a))),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=(a=this._promiseMap.get(t)).resolve,i=a.reject,s=a.timestamp,a=a.headSeq,this._promiseMap.delete(t),this._calcRTT(s),n.errorCode&&0!==n.errorCode?(this._chM.onErrorCodeNotZero(n),i(new L({code:n.errorCode,message:n.errorInfo||"",data:t.includes(R.MODIFY_C2C_MSG)||t.includes(R.MODIFY_GRP_MSG)?{elements:n.elements,messageVersion:n.messageVersion,cloudCustomData:n.cloudCustomData,headSeq:a}:{headSeq:a}}))):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(){if(this._readyState!==gs&&this._readyState!==hs){if(this._startTs=Date.now(),this._onOpenTs=0,this._readyState=gs,this._socket=new ds(this),this._socketID=this._socket.getID(),me){var e=this._socket.getClient().readyState;if(P(e))return void(this._readyState=fs)}new G("wsConnect").setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end(),M.l("".concat(this._n,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL()))}}},{key:"getURL",value:function(){this._chM.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=Bt(),t=((Ie||he&&"windows"===e)&&(this._canIUseBinaryFrame=!1),Me&&(o=I.getSystemInfoSync().uniRuntimeVersion,n=j((o=void 0===o?"":o).split(".").map(Number),3),i=void 0===(i=n[0])?0:i,t=void 0===(t=n[1])?0:t,n=n[2],i=2>>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=vt(),this._readyState=fs,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}]),vs=function(s,a,r){return new Promise(function(t,e){var n,o,i="application/x-www-form-urlencoded;charset=UTF-8";v?I.request({url:a,data:r,method:s,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 Ps(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(Da,c);var Gs=e(Da,[{key:"_init",value:function(){this._updateCmdFreqLimitMap(Es)}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");P(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),Ts.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:se,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:75689843,sdkability_ext:Os(""),cappid:e.getApplicationID(),cs:0}}},{key:"genCosSpecifiedHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:se,websdkversion:oe,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:75689843,sdkability_ext:Os(""),cappid:e.getApplicationID(),cs:0}}},{key:"genSSOReportHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:se,websdkversion:oe,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:75689843,sdkability_ext:Os(""),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,a,r=this,c="".concat(this._n,"._reLogin");this.isLoggedIn()&&(e=0,(t=this.get(1).getPushModule())&&(e=t.getUniAppPlatform()),a=new G("reLogin"),this.req({P:R.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=Fo(e),i=(n.setStatusInstanceID(t),r.get(21)),s=i.getSocketID(),s="socketID:".concat(s," instanceID:").concat(t," customStatus:").concat(o),t=(a.setMessage(s).end(!0),M.l("".concat(c," ok. ").concat(s)),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)),s=(t&&t.updateLocalMainSequenceOnReconnected(),r.get(10)),n=(s.resetGetTopicTime(),s.getTopicListOnReconnected(),r.get(8));n&&n.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:R.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,s="".concat(this._n,".fetchConfig"),e=this._canFetch();M.l("".concat(s," canFetch:").concat(e)),e&&(o=new G("fetchCloudCtrlConfig"),e=this.get(12).getSDKAppID(),this._isFetching=!0,this.req({P:R.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(s," ok")),i._parse(e.data)}).catch(function(e){i._isFetching=!1,o.setError(e).end(),M.l("".concat(s," 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,s=e.cloudControlConfig,a=e.version,r=e.expiredTime;if(0===o){if(this._version!==a){var c=null;try{c=JSON.parse(s)}catch(e){this.isPrivateNetWork()||M.e("".concat(n," failed. config:"),s)}c&&(this._cloudConfig.clear(),Object.keys(c).forEach(function(e){t._cloudConfig.set(e,c[e])}),this._version=a,this.emitIEvt(U.CLOUD_CONFIG),this.emitOEvt(h.SERVER_CONFIG_UPDATED,{config:c}))}this._setExpiredTime(1e3*r)}else P(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}}])),bs=(t(Ca,c),e(Ca,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var n,o,i,s,a=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,s=i-o,0n[0])&&s",n[r].tag)}this.profile=new Vo(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,s=null,a=0;a",e[a].tag)}}();this.timestamp=Date.now(),s.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)),P(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"))}}])),Xs=e(function e(t){p(this,e),this._commercialConfigM=t,this._n="PurchasedFeatureHandler",this._isCSPluginReported=!1,this._featureMap=new Map,this._commercialAbility="0"},[{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._commercialAbility=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,s=0;0<=i;i--,s++)if("1"===t.charAt(i)&&(n=(s<32?new ee(0,Math.pow(2,s)):new ee(Math.pow(2,s-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 ee(0,Math.pow(2,o)):new ee(Math.pow(2,o-32),0)).toString(),!this._featureMap.get(i))break;var i,s="",a=0;i===_.PLUGIN_TRANSLATE?(s="plugin_translate",a=16):i===_.PLUGIN_VOICE_TO_TEXT?(s="plugin_voice_to_text",a=17):i===_.PLUGIN_CS?(s="plugin_cs",a=14):i===_.PLUGIN_PUSH?(s="plugin_push",a=13):i===_.PLUGIN_BOT?(s="plugin_bot",a=15):i===_.MSG_REACTION&&(s="plugin_emoji_reaction",a=18),""!==s&&(i=this._commercialConfigM.get(12).getUIPlatform(),new G(s).setCode(a).setUIPlatform(i).end(),M.l("".concat(this._n,".isFeatureEnabledForStat ").concat(s," code:").concat(a," uiPlatform:").concat(i)))}}},{key:"isCSPluginEnabled",value:function(){var e;this._isCSPluginReported||(e=this._commercialConfigM.get(12).getUIPlatform(),new G("plugin_search").setCode(6).setUIPlatform(e).end(),this._isCSPluginReported=!0)}},{key:"queryCommercialAbility",value:function(){return this._commercialAbility}},{key:"clear",value:function(){this._featureMap.clear(),this._isCSPluginReported=!1,this._commercialAbility="0"}}]),Zs=e(function e(t){p(this,e),this._m=t,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new Xs(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 G("fetchCommercialConfig"),o=this.get(12).getSDKAppID(),e=this.get(20),this._isFetching=!0,e.req({P:R.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,s=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(i),this._expiredTime=Date.now()+1e3*s):P(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:"queryCommercialAbility",value:function(){return this._purchasedFeatureHandler.queryCommercialAbility()}},{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()}}]),Qs=(t(va,c),e(va,[{key:"registerPlugin",value:function(e){var t,n,o,i,s,a,r,c,u,l,d,p,_;Me?(this._offlinePushPlugin=e["tim-offline-push-plugin"],t=(_=e.offlinePushConfig||{}).huaweiBusinessID,n=_.xiaomiBusinessID,o=_.xiaomiAppID,i=_.xiaomiAppKey,s=_.meizuBusinessID,a=_.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=s,this._androidPushConfig.meizuPushAppId=a,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(!P(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");pt(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,s=new G("getDeviceTokenRes"),a=e.code,r=e.msg;0===a?(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)),s.setMessage(c).end(!0),u._setToken()):(s.setMessage("code:".concat(a,", 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 Me&&!P(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var t=this,n="".concat(this._n,".").concat("_setAppShowListener");P(this._offlinePushPlugin)?M.e("".concat(n," offlinePushPlugin is undefined")):pt(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(!P(this._offlinePushPlugin)&&pt(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="",s=(S(this._deviceToken)&&(n=0),this.getUniAppPlatform()),a=this.getDeviceBrand(),r=(s===ne.IOS||s===ne.IPAD||s===ne.MAC?i=this._deviceToken:s===ne.ANDROID&&(o=this._deviceToken),new G("offlinePushSetToken")),s="deviceToken:".concat(i||o,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(a,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(n,", platform:").concat(s);return r.setMessage("".concat(s)),M.l("".concat(t," ").concat(s)),this.req({P:R.SET_TOKEN,data:{tokenID:o,pushMsg:n,sdkAppID:e.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:a,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===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:R.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:R.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"))}}])),$s=(t(ma,c),e(ma,[{key:"registerPlugin",value:function(e){var t,n,o;Me?(t="".concat(this._n,".").concat("registerPlugin"),this._pushPlugin=e["tim-push"],this._getDeviceInfo(),n=(o=e.pushConfig||{}).androidConfig,o=o.iOSConfig,lt(n)&&(this._androidPushConfig=n[this._deviceInfo.packageName]),n=(o||{}).iOSBusinessID,this._iOSBusinessID=n,o=!P(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 s=this,a="".concat(this._n,".").concat("_reportEventCacheList");pt(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(a," failed. error:").concat(JSON.stringify(e)));else{t=n.length<10?"eventList:".concat(JSON.stringify(n)):"eventList.length:".concat(n.length);M.l("".concat(a," 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,s="".concat(this._n,".filterMessage");if(M.l("".concat(s)),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 a=this._plugin.filter(e.payload.text),r=a.type,a=a.modifiedText;1===r?n=!1:2===r&&(e.payload.text=a)}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),a=this._plugin.filter(e.payload.description),t=this._plugin.filter(e.payload.extension);1===r.type||1===a.type||1===t.type?n=!1:(2===r.type&&(e.payload.data=r.modifiedText),2===a.type&&(e.payload.description=a.modifiedText),2===t.type&&(e.payload.extension=t.modifiedText))}M.l("".concat(s," 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:R.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,s=e.completeFlag,a=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===s?(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=a,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.6.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!==pe&&(e._generateCurrentDomain(),e._fetchWithRetry())})}},{key:"_generateCurrentDomain",value:function(){this.CURRENT_DOMAIN===le?this.CURRENT_DOMAIN=de:this.CURRENT_DOMAIN===de&&(this.CURRENT_DOMAIN=pe)}},{key:"_fetchAdapter",value:function(){var i="https://".concat(this.CURRENT_DOMAIN,"/im/download/error-message/v3/0.0.7/tim-error-message.txt"),s="application/x-www-form-urlencoded;charset=UTF-8",a="".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":s},dataType:"text",success:function(e){r._fillAndSave(e.data),M.l("".concat(a," 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(a," browser.")),r._fillAndSave(e.responseText),t()):n(e.status))},e.onerror=function(e){n(e)},e.open("GET",i,!0),e.setRequestHeader("Content-type",s),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.6.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,s=new RegExp(/'/g),a=0;aKe()-this.EXPIRED_TIME}},{key:"_createPromiseList",value:function(e){for(var t=[],n=0;nthis.MAX_COUNT?this.MAX_COUNT:e)}},{key:"onFollowNotify",value:function(e){var s=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,la),o=e.from,i=W(e,da);t.forEach(function(e){var t=e.isAdd,e=e.followType,e=void 0===e?0:e,n=s._initFollowInfo();1===t?(i.userID=o,n[e].userInfoList.push(i),n[e].isAdd=!0):(n[e].userInfoList.push(o),n[e].isAdd=!1),s._emitEvent(n)})})}},{key:"_initFollowInfo",value:function(){var t={};return Object.values(pa).forEach(function(e){e!==pa.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,a=0;0!==n;){for(n-=a=2e3>>8^i[255&(e^t[a])];return-1^e}function Sa(e,t,n,o,i,s,a,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,P=0,v=0;v<=15;v++)A[v]=0;for(I=0;I_?(g=N[P+a[I]],k[R+a[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+a[I]]}if(C>>1:n>>>1;e[t]=n}return e}(),Ra=[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],Aa=[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],Oa=[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],Na=[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 Pa(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function Ga(){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 Ua(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 ba(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,Ua(e)):-2}function wa(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=La(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=La(t.check,M,2,0)),c=r=0,t.mode=3;case 3:for(;c<32;){if(0===s)break e;s--,r+=n[o++]<>>8&255,M[2]=r>>>16&255,M[3]=r>>>24&255,t.check=La(t.check,M,4,0)),c=r=0,t.mode=4;case 4:for(;c<16;){if(0===s)break e;s--,r+=n[o++]<>8),512&t.flags&&(M[0]=255&r,M[1]=r>>>8&255,t.check=La(t.check,M,2,0)),c=r=0,t.mode=5;case 5:if(1024&t.flags){for(;c<16;){if(0===s)break e;s--,r+=n[o++]<>>8&255,t.check=La(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)>s?s: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=La(t.check,n,l,o)),s-=l,o+=l,t.length-=l),t.length))break e;t.length=0,t.mode=7;case 7:if(2048&t.flags){if(0===s)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===s)break e;s--,r+=n[o++]<>>=7&c,c-=7&c,t.mode=27;else{for(;c<3;){if(0===s)break e;s--,r+=n[o++]<>>=1)){case 0:t.mode=14;break;case 1:y=C=void 0;var y,C=t;if(Va){for(qa=new ie.Buf32(512),xa=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(Sa(1,C.lens,0,288,qa,0,C.work,{bits:9}),y=0;y<32;)C.lens[y++]=5;Sa(2,C.lens,0,32,xa,0,C.work,{bits:5}),Va=!1}if(C.lencode=qa,C.lenbits=9,C.distcode=xa,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===s)break e;s--,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=a<(l=s>>=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=Sa(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===s)break e;s--,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=Sa(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=Sa(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<=s&&258<=a){e.next_out=i,e.avail_out=a,e.next_in=o,e.avail_in=s,t.hold=r,t.bits=c,P=W=k=S=L=E=D=T=oe=ne=te=ee=U=G=$=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,P=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,G=A.hold,U=A.bits,ee=A.lencode,te=A.distcode,ne=(1<>>=D=T>>>24,U-=D,0==(D=T>>>16&255))P[N++]=65535&T;else{if(!(16&D)){if(0==(64&D)){T=ee[(65535&T)+(G&(1<>>=D,U-=D),U<15&&(G+=W[O++]<>>=D=T>>>24,U-=D,!(16&(D=T>>>16&255))){if(0==(64&D)){T=te[(65535&T)+(G&(1<z){R.msg="invalid distance too far back",A.mode=30;break t}if(G>>>=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,G&=(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===s)break e;s--,r+=n[o++]<>h)])>>>16&255,_=65535&I,!(h+(d=I>>>24)<=c);){if(0===s)break e;s--,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===s)break e;s--,r+=n[o++]<>h)])>>>16&255,_=65535&I,!(h+(d=I>>>24)<=c);){if(0===s)break e;s--,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===a)break e;if(t.offset>(l=u-a)){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(a-=l=a>10&1023,s[a++]=56320|1023&n)}var c=s,u=a;if(u<65534&&(c.subarray&&Wa||!c.subarray&&Ka))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]"===$a.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw)&&(e=Ha.inflateSetDictionary(this.strm,t.dictionary))!==Za.Z_OK)throw new Error(Qa[e])}function tr(e,t){t=new er(t);if(t.push(e,!0),t.err)throw t.msg||Qa[t.err];return t.result}er.prototype.push=function(e,t){var n,o,i,s,a,r=this.strm,c=this.options.chunkSize,u=this.options.dictionary,l=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?Za.Z_FINISH:Za.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+Ya[e[n]]>t?n:t}(r.output,r.next_out),s=r.next_out-i,a=Ja(r.output,i),r.next_out=s,r.avail_out=c-s,s&&ie.arraySet(r.output,r.output,i,s,0),this.onData(a)):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"),we)&&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?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 Eo?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):"queryCommercialAbility"===e?this._get(27).queryCommercialAbility():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 Eo?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:"pinGroupMessage",value:function(e){var t=this._get(7);return t?t.pinGroupMessage(e):E({code:k.NO_MODULE})}},{key:"getPinnedGroupMessageList",value:function(e){var t=this._get(7);return t?t.getPinnedGroupMessageList(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})}}]),fr={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 mr(e){return p(this,mr),(e=i(this,mr,[e]))._n="CSModule",e}var vr={},Vn={};return Vn.create=function(e){var t="TencentCloudChat.create",n=0,o=e.SDKAppID;if(O(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&&vr[n])return vr[n];M.l("".concat(t));var a,i,o=new gr(y(y({},e),{},{SDKAppID:n})),e=(o.on(h.SDK_DESTROY,function(e){vr[e.data.SDKAppID]=null,delete vr[e.data.SDKAppID]}),a=o,i=Object.create(null),Object.keys(Hn).forEach(function(s){var t;a[s]&&(t=new $,i[s]=function(){var e=Array.from(arguments);return t.use(function(e,t){i=s;var n,o,i=!(!(n=a).isReady()&&1!==fr[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 s=!0;if(f(o))Object.keys(o).forEach(function(e){var t=1===n.length?n[0][e]:void 0;s=!!rn(t,o[e],i,e)&&s});else if(N(o))for(var e=0;e