"use strict";const e=4,t=11,s=12,o=20,n=23,i=27;class r{constructor(e=0,t=0){this.high=e,this.low=t}equal(e){return null!==e&&this.low===e.low&&this.high===e.high}toString(){var e=Number(this.high).toString(16);let t=Number(this.low).toString(16);if(t.length<8){let e=8-t.length;for(;e;)t="0"+t,e--}return e+t}}const u={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"},INDONESIA:{DEFAULT:"wss://wssidn-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT0:"wss://*w4s.my-imcloud.com",DEFAULT:"wss://wsssgp.im.qcloud.com",IPV6:"wss://wsssgpv6.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{DEFAULT0:"wss://*w4k.my-imcloud.com",DEFAULT:"wss://wsskr.im.qcloud.com",IPV6:"wss://wsskrv6.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{DEFAULT0:"wss://*w4g.my-imcloud.com",DEFAULT:"wss://wssger.im.qcloud.com",IPV6:"wss://wssgerv6.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{DEFAULT0:"wss://*w4i.my-imcloud.com",DEFAULT:"wss://wssind.my-imcloud.com",IPV6:"wss://wssindv6.im.qcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.19.46"},JPN:{DEFAULT0:"wss://*w4j.my-imcloud.com",DEFAULT:"wss://wssjpn.im.qcloud.com",IPV6:"wss://wssjpnv6.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT0:"wss://*w4u.my-imcloud.com",DEFAULT:"wss://wssusa.im.qcloud.com",IPV6:"wss://wssusav6.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{DEFAULT0:"wss://*w4y.my-imcloud.com",DEFAULT:"wss://wssidn.im.qcloud.com",IPV6:"wss://wssidnv6.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},c={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19,NS_NATIVE_APP:20,RN_NATIVE_APP:21},m="CHINA",a={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(e=m){this.CURRENT=u.PRODUCTION[e]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GRP:"group_open_http_svc",GRP_AV:"group_open_avchatroom_http_svc",GRP_COMMUNITY:"million_group_open_http_svc",GRP_ATTR:"group_open_attr_http_svc",FD:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GRP_NO_AUTH:"group_open_http_noauth_svc",BIG_GRP_POLLING:"group_open_long_polling_http_svc",BIG_GRP_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",WEB_IM:"webim",IM_COS_SIGN:"im_cos_sign_svr",CUSTOM_UPLOAD:"im_cos_msg",HEARTBEAT:"heartbeat",IM_OPEN_PUSH:"im_open_push",IM_OPEN_STATUS:"im_open_status",IM_LONG_MSG:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush",IM_MSG_AUDIT_MGR:"im_msg_audit_mgr",TUIROOM_SVR:"tui_room_svr",IM_OPEN_TRANSLATE:"im_open_translate",IM_OPEN_SPEECH:"im_open_speech",MSG_SEARCH:"message_search",GRP_SEARCH:"group_search",GRP_MEMBER_SEARCH:"group_member_search",USER_SEARCH:"user_search",FOLLOW:"follow",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},l=(new r(0,Math.pow(2,1)).toString(),new r(0,Math.pow(2,2)).toString(),new r(0,Math.pow(2,3)).toString(),new r(0,Math.pow(2,4)).toString(),new r(0,Math.pow(2,6)).toString(),new r(0,Math.pow(2,7)).toString(),new r(0,Math.pow(2,9)).toString(),new r(0,Math.pow(2,10)).toString(),new r(0,Math.pow(2,11)).toString(),new r(0,Math.pow(2,13)).toString(),new r(0,Math.pow(2,15)).toString(),new r(Math.pow(2,6)).toString(),new r(Math.pow(2,7)).toString(),new r(Math.pow(2,8)).toString(),new r(Math.pow(2,9)).toString(),new r(Math.pow(2,10)).toString(),new r(Math.pow(2,16)).toString(),new r(Math.pow(2,20)).toString(),a.HOST.setCurrent(m),"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)),g=(l&&wx.createGamePortal,"undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting)),h="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),d="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),p="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),f="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,_="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,w=l&&"object"==typeof wx.miniapp,S=l||g||h||d||p||_||f,T="undefined"==typeof window&&!S&&"undefined"!=typeof global&&void 0!==global.NativeScriptGlobals,y="undefined"!=typeof global&&(void 0!==global.nativeModuleProxy||void 0!==global.ReactNative),M="undefined"!=typeof uni?!S:"undefined"!=typeof window&&!S&&!y,I=(g?qq:h?tt:d?swan:p?my:l?wx:_?uni:f&&jd,M&&window&&window.navigator&&window.navigator.userAgent||""),A=/(micromessenger|webbrowser)/i.test(I),E=function(){let e="WEB";return A?e="WEB":g?e="QQ_MP":h?e="TT_MP":d?e="BAIDU_MP":p?e="ALI_MP":l?e=w?"DONUT_NATIVE_APP":"WX_MP":_?e="UNI_NATIVE_APP":T?e="NS_NATIVE_APP":y&&(e="RN_NATIVE_APP"),c[e]}(),P=(!function(){var e=I.match(/OS (\d+)_/i);e&&e[1]&&e[1]}(),function(){var e,t,s=I.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);s&&(e=s[1]&&parseFloat(s[1]),t=s[2]&&parseFloat(s[2]),e&&t&&parseFloat(s[1]+"."+s[2]))}(),/MSIE/.test(I)||-1{this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)},0)}}setError(e){if(!(e instanceof Error))return Z.w(this._n+".setError value not instanceof Error, please check!"),this;if(this._sentFlag)return this;let t=!0;if(t=this._netMonitorModule?this._netMonitorModule.isOnline():t)e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message);else{const e=se;this.setCode(e)}return this.setLevel("error"),this}setCode(e){return H(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),G(e)?this.code=e:Z.w(this._n+".setCode value not a number, please check!",e,typeof e)),this}setMessage(e){return H(e)||this._sentFlag||(G(e)&&(this.message=e.toString()),B(e)&&(this.message=e)),this}setCostTime(e){return this.costTime=e,this}setLevel(e){return H(e)||this._sentFlag||(this.level=he[e]),this}setMoreMessage(e){return function(e){if(null==e)return 1;if("boolean"!=typeof e){if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(j(e)){for(const t in e)if(q.call(e,t))return;return 1}return(F(e)||x(e)||k(e))&&0===e.size}}(this.moreMessage)?this.moreMessage=""+e:this.moreMessage+=" "+e,this}setNetworkType(e){return H(e)?Z.w(this._n+".setNetworkType value is undefined, please check!"):(e=de[e.toLowerCase()],H(e)||(this.networkType=e)),this}getStartTs(){return this._startts}setUIPlatform(e){return this.uiPlatform=e,this}setExtension(e){return this.extension=e,this}setEventType(e){return this.eventType=e,this}}const _e=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"];class we{constructor(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(e)}set memberNum(e){}set maxMemberNum(e){}get memberNum(){return this.memberCount}get maxMemberNum(){return this.maxMemberCount}_initGroup(e){for(const t in e)_e.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]))}updateGroup(e){e.appid=void 0,e.grossTopicNextMsgSeq=void 0,e.selfInfo&&(e.selfInfo.grossTopicReadSeq=void 0);const t=JSON.parse(JSON.stringify(e));if(t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),H(t.muteAllMembers)||("On"===t.muteAllMembers?t.muteAllMembers=!0:t.muteAllMembers=!1),t.groupCustomField){var o=this.groupCustomField;if(e=t.groupCustomField,$(o)&&$(e)){let r=!1;e.forEach(({key:t,value:e})=>{const s=o.find(e=>e.key===t);s?s.value!==e&&(s.value=e,r=!0):(o.push({key:t,value:e}),r=!0)})}}H(t.memberNum)||(this.memberCount=t.memberNum),H(t.maxMemberNum)||(this.maxMemberCount=t.maxMemberNum),H(t.isSupportTopic)||(this.isSupportTopic=G(t.isSupportTopic)?1===t.isSupportTopic:t.isSupportTopic),W(this,t,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),$(t.members)&&0{e.userID===this.selfInfo.userID&&W(this.selfInfo,e,["sequence"])})}updateSelfInfo({nameCard:e,joinTime:t,role:s,messageRemindType:r,readedSequence:o,excludedUnreadSequenceList:n}){e={nameCard:e,joinTime:t,role:s,messageRemindType:r,readedSequence:o,excludedUnreadSequenceList:n};W(this.selfInfo,{...e},[],["",null,void 0,0,NaN])}setSelfNameCard(e){this.selfInfo.nameCard=e}}const Se="Message",Te="User",ye="Group",Me="GroupMember",Ie={[Se]:me,[Te]:ge,[ye]:ae,[Me]:le};class Ae extends class{constructor(e){this._m=e,this._n=""}isLoggedIn(){return this._m.get(s).isLoggedIn()}isOversea(){return this._m.get(s).isOversea()}isPrivateNetWork(){const e=this._m.get(s);return e.isPrivateNetWork()&&!e.getFileDownloadProxy()}getFileDownloadProxy(){return this._m.get(s).getFileDownloadProxy()}getDowloadFileAuthKey(){return this._m.get(s).getDowloadFileAuthKey()}getMyUserID(){return this._m.get(s).getUserID()}getMyTinyID(){return this._m.get(s).getTinyID()}getSDKAppID(){return this._m.get(s).getSDKAppID()}isIntl(){return this._m.get(s).isIntl()}isUsingChatCore(){return this._m.get(s).isUsingChatCore()}isDevMode(){return this._m.get(s).isDevMode()}get(e){return this._m.get(e)}getPlatform(){return E}getCloudConfig(e){return this._m.get(n).getCloudConfig(e)}emitOEvt(e,t){this._m.getOEmitInst().emit(e,t)}emitIEvt(e,t){this._m.getIEmitInst().emit(e,t)}getIEmitInst(){return this._m.getIEmitInst()}req(e){return this._m.get(o).req(e)}canIUse(e){return this._m.get(i).canIUse(e)}getErrMsg(e,t,s){return this._m.getErrMsg(e,t,s)}warn(e,t,s){e=this.getErrMsg(e,t,s);e&&Z.w(e)}noUse(e){var t=ne;return ce({code:t,message:this.getErrMsg(t,e)})}}{constructor(e){super(e),this._n="CSModule"}searchCloudMessages(e){return this.search(Se,e)}searchCloudUsers(e){return this.search(Te,e)}searchCloudGroups(e){return this.search(ye,e)}searchCloudGroupMembers(e){return this.search(Me,e)}search(o,n){const e=`searchCloud${o}s`,u=this._n+"."+e;if(!n)return ce({code:ie,message:this.getErrMsg(ie,e)});var t=n["keywordList"],s=V(t);let r=n.count;if(n.count&&(r=parseInt(r)),o===Se&&!s&&!V(n.senderUserIDList)&&!V(n.messageTypeList)||o!==Se&&!s)throw Z.e(`[${e}] Missing required params: "keywordList".`),new Error("Params validate failed.");const a=Date.now(),m=new fe(e),c=`keywordList:${t} keywordListMatchType:${n.keywordListMatchType} cursor:${n.cursor} count:`+r;return Z.l(u+" "+c),this.req({P:Ie[o],data:this._genParams(o,n)}).then(t=>{var{code:s,message:r}=t.data;if(0!==s){let e=s;60020===s?e="SearchUnable":o!==Se&&27003===s?e="SearchParamsError":o!==Se&&60018===s&&(e="SearchOverLimit");const t=this.getErrMsg(e)||r,u=new te({code:s,message:t});return m.setMessage(c).setError(u).end(),ce(u)}this.get(i).isCSPluginEnabled();var{cursor:r="",totalCount:s}=t.data,e=`totalCount:${s} cost:`+(e=a,Date.now()-e+" ms"),e=(Z.l(u+` ok. cursor:${r} `+e),m.setMessage(c+" "+e).end(),this._genRes(o,n,t.data));return ee({searchResultList:e,cursor:r,totalCount:s})}).catch(e=>(m.setMessage(c).setError(e).end(),ce(e)))}_genParams(e,t){const{count:s,...r}=t;if(s&&(r.count=parseInt(s)),e===Se)return this._genMsgParams(r);var{keywordList:t,keywordListMatchType:o}=t;return r.keywords=t,r.keywordMatchType="and"===o?1:0,e===Te?this._genUserParams(r):r}_genMsgParams(e){const{conversationID:t,timePosition:s,timePeriod:r,...o}=e;return H(t)||(e=t,B(e)&&e.slice(0,3)===O&&(o.account=t.replace(O,"")),e=t,B(e)&&e.slice(0,5)===L&&(o.groupID=t.replace(L,""))),G(r)&&0{const o=e?""+L+e:""+O+t,n={conversationID:o,messageCount:s,messageList:[]};if(i&&1!!e);if(0