jiuyiUniapp/service/node_modules/@tencentcloud/chat/modules/relationship-module.js

1 line
41 KiB
JavaScript

"use strict";const e={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"};let t,s;t="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};const i=function(){},r=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let n=r.length;for(;n--;)s=r[n],console[s]||(t[s]=i);var o=t;class a{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 d={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"}}},u={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},c="CHINA",l={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(e=c){this.CURRENT=d.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"}},h=(new a(0,Math.pow(2,1)).toString(),new a(0,Math.pow(2,2)).toString(),new a(0,Math.pow(2,3)).toString(),new a(0,Math.pow(2,4)).toString(),new a(0,Math.pow(2,6)).toString(),new a(0,Math.pow(2,7)).toString(),new a(0,Math.pow(2,9)).toString(),new a(0,Math.pow(2,10)).toString(),new a(0,Math.pow(2,11)).toString(),new a(0,Math.pow(2,13)).toString(),new a(0,Math.pow(2,15)).toString(),new a(Math.pow(2,6)).toString(),new a(Math.pow(2,7)).toString(),new a(Math.pow(2,8)).toString(),new a(Math.pow(2,9)).toString(),new a(Math.pow(2,10)).toString(),new a(Math.pow(2,16)).toString(),new a(Math.pow(2,20)).toString(),"sns"),p=(l.HOST.setCurrent(c),"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)),m=(p&&wx.createGamePortal,"undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting)),_="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),f="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),g="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),y="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,w="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,A=p&&"object"==typeof wx.miniapp,I=p||m||_||f||g||w||y,D="undefined"==typeof window&&!I&&"undefined"!=typeof global&&void 0!==global.NativeScriptGlobals,T="undefined"!=typeof global&&(void 0!==global.nativeModuleProxy||void 0!==global.ReactNative),M="undefined"!=typeof uni?!I:"undefined"!=typeof window&&!I&&!T,L=(m?qq:_?tt:f?swan:g?my:p?wx:w?uni:y&&jd,M&&window&&window.navigator&&window.navigator.userAgent||""),S=/(micromessenger|webbrowser)/i.test(L),F=function(){let e="WEB";return S?e="WEB":m?e="QQ_MP":_?e="TT_MP":f?e="BAIDU_MP":g?e="ALI_MP":p?e=A?"DONUT_NATIVE_APP":"WX_MP":w?e="UNI_NATIVE_APP":D?e="NS_NATIVE_APP":T&&(e="RN_NATIVE_APP"),u[e]}(),E=(!function(){var e=L.match(/OS (\d+)_/i);e&&e[1]&&e[1]}(),function(){var e,t,s=L.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(L)||-1<L.indexOf("Trident")&&-1<L.indexOf("rv:11.0")),v=(!function(){var e=/MSIE\s(\d+)\.\d/.exec(L),e=e&&parseFloat(e[1]);!e&&/Trident\/7.0/i.test(L)&&/rv:11.0/.test(L)}(),"C2C"),k="AllowType_Type_AllowAny",P="AdminForbid_Type_None",b="Add_Type_Single",U="Add_Type_Both",N="Delete_Type_Single",C="Delete_Type_Both",G="Pendency_Type_Both",O="Pendency_Type_ComeIn",$="Pendency_Type_SendOut",R="Response_Action_Agree",q="Response_Action_AgreeAndAdd",x="CheckResult_Type_Both",H="CheckResult_Type_Single",B=function(){return(new Date).getTime()+0},j="Tag_Profile_IM_Nick",V="Tag_Profile_IM_Gender",W="Tag_Profile_IM_BirthDay",K="Tag_Profile_IM_Location",Y="Tag_Profile_IM_SelfSignature",J="Tag_Profile_IM_AllowType",z="Tag_Profile_IM_Language",Q="Tag_Profile_IM_Image",X="Tag_Profile_IM_MsgSettings",Z="Tag_Profile_IM_AdminForbidType",ee="Tag_Profile_IM_Level",te="Tag_Profile_IM_Role",se={GROUP:"Tag_SNS_IM_Group",REMARK:"Tag_SNS_IM_Remark",ADDSOURCE:"Tag_SNS_IM_AddSource",ADDWORDING:"Tag_SNS_IM_Wording",ADDTIME:"Tag_SNS_IM_AddTime"},ie="Gender_Type_",re={UNKNOWN:ie+"Unknown",FEMALE:ie+"Female",MALE:ie+"Male"},ne={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},oe={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},ae=Object.prototype.hasOwnProperty;function de(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(me(e)){for(const t in e)if(ae.call(e,t))return!1;return!0}return!!(ue(e)||ce(e)||le(e))&&0===e.size}const ue=function(e){return"map"===ye(e)},ce=function(e){return"set"===ye(e)},le=function(e){return"file"===ye(e)},he=function(e){return null!==e&&("number"==typeof e&&!isNaN(+e)||"object"==typeof e&&e.constructor===Number)},pe=function(e){return"string"==typeof e},me=function(e){if("object"!=typeof e||null===e)return!1;e=Object.getPrototypeOf(e);if(null===e)return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return e===t},_e=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===ye(e)},fe=function(e){return void 0===e},ge=function(e){return e instanceof Error},ye=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},we=(Date.now||(Date.now=function(){return(new Date).getTime()}),function(e){if(0===e.length)return 0;let t=0,s=0,i;for(var r="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";void 0!==e[t];)i=e[t++].charCodeAt[t]<=255?1:!1===r?3:2,s+=i;return s}),Ae=function(e,t){for(const s in e)if(e[s]===t)return!0;return!1};function Ie(){return!E&&!I}let De=0;function Te(){return Ie()?"%c Chat %c":"Chat"}function Me(){const e=function(){const e=new Date;return e.setTime(B()),e}();return e.toLocaleTimeString("en-US",{hour12:!1})+"."+function(e){let t;switch(e.toString().length){case 1:t="00"+e;break;case 2:t="0"+e;break;default:t=e}return t}(e.getMilliseconds())}const Le={arguments2String(s){let i="";if(1===s.length)i=s[0];else for(let e=0,t=s.length;e<t;e++){if(r=s[e],_e(r)||null!==r&&"object"==typeof r)try{i+=ge(s[e])?JSON.stringify(s[e],["message","code"]):JSON.stringify(s[e])}catch(e){i+=e?e.message:"";break}else i+=s[e];i+=" "}var r;return i},_exec(e,t){Ie()?o[e](Te(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",Me(),t):o[e](`${Te()} ${Me()} `+t)},d:function(){var e;De<=-1&&(e=this.arguments2String(arguments),this._exec("debug",e))},l:function(){var e;De<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},log:function(){var e;De<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},i:function(){var e;De<=1&&(e=this.arguments2String(arguments),this._exec("info",e))},w:function(){var e;De<=2&&(e=this.arguments2String(arguments),this._exec("warn",e))},e:function(){var e;De<=3&&(e=this.arguments2String(arguments),this._exec("error",e))},setLevel:function(e){e<4&&this._exec("log","set level from "+De+" to "+e),De=e},getLevel:function(){return De}};class Se{constructor(e){de(e)||(this.userID=e.userID||"",this.nick=e.nick||"",this.avatar=e.avatar||"",this.time=e.time||0,this.source=e.source||"",this.wording=e.wording||"",this.type=e.type||"")}}const Fe=function(e){return{code:0,data:e||{}}};class Ee extends Error{constructor(e){super();var{code:e,message:t,data:s}=e;this.code=e,t?this.message=t:this._getErrMsg&&(this.message=this._getErrMsg(this.code)),this.data=s||{}}}const ve=2700,ke=2701,Pe=2710,be=2711,Ue=2716,Ne=2805,Ce=2903,Ge=3122,Oe=3123,$e="onFriendListUpdated",Re="onFriendGroupListUpdated",qe="onFriendApplicationListUpdated",xe="error";let He=null;const Be=function(e){return Promise.resolve(Fe(e))},je=function(e,t=!1){if(e instanceof Ee)return t&&null!==He&&He.emit(xe,e),Promise.reject(e);if(e instanceof Error){const e=new Ee({code:Ce});return t&&null!==He&&He.emit(xe,e),Promise.reject(e)}if(fe(e)||fe(e.code))return Promise.reject(new Ee({code:Ce}));e=new Ee(e);return t&&null!==He&&He.emit(xe,e),Promise.reject(e)},Ve="friend_get",We="friend_get_specified",Ke="friend_check",Ye="friend_delete",Je="friend_add",ze="friend_update",Qe="friend_response",Xe="pendency_get",Ze="pendency_delete",et="pendency_report",st="group_get",it="group_add",rt="group_delete",nt="group_update",ot={info:4,warning:5,error:6},at={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},dt={login:4,plugin_search:16,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16,plugin_emoji_reaction:16,tui_key_features:16};class ut{constructor(e){this._n="SSOLogData",this.eventType=dt[e]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=e,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=B()}static bindEventStatModule(e){ut.prototype._eventStatModule=e}static bindNetMonitorModule(e){ut.prototype._netMonitorModule=e}updateTimeStamp(){this.timestamp=B()}start(e){return this._startts=e,this}end(e=!1){if(!this._sentFlag){if(this._netMonitorModule){const e=this._netMonitorModule.getNetworkType();this.setNetworkType(e)}var t=B();0===this.costTime&&(this.costTime=t-this._startts),this.setMoreMessage(`startts:${this._startts} endts:`+t),e?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout(()=>{this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)},0)}}setError(e){if(!(e instanceof Error))return Le.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=Ne;this.setCode(e)}return this.setLevel("error"),this}setCode(e){return fe(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),he(e)?this.code=e:Le.w(this._n+".setCode value not a number, please check!",e,typeof e)),this}setMessage(e){return fe(e)||this._sentFlag||(he(e)&&(this.message=e.toString()),pe(e)&&(this.message=e)),this}setCostTime(e){return this.costTime=e,this}setLevel(e){return fe(e)||this._sentFlag||(this.level=ot[e]),this}setMoreMessage(e){return de(this.moreMessage)?this.moreMessage=""+e:this.moreMessage+=" "+e,this}setNetworkType(e){return fe(e)?Le.w(this._n+".setNetworkType value is undefined, please check!"):(e=at[e.toLowerCase()],fe(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}}class ct{constructor(e){this._snsM=e,this._n="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSeq=0,this._map=new Map,this._unreadCount=0}getLocalApplicationList(){return{friendApplicationList:[...this._map.values()],unreadCount:this._unreadCount}}_onApplicationListUpdated(){this._snsM.emitOEvt(qe,{friendApplicationList:[...this._map.values()],unreadCount:this._unreadCount})}onApplicationRead(){this._unreadCount=0,this._onApplicationListUpdated()}onApplicationAdded(e,t){if(!de(e)){let s,i=(s=t===this._snsM.getMyUserID()?$:O,!1);e.forEach(e=>{var t=e.userID+"_"+s;s!==O||this._map.has(t)||(this._unreadCount+=1),this._map.set(t,new Se({...e,type:s})),i=!0}),i&&this._onApplicationListUpdated()}}onApplicationDeleted(e){de(e)||(this._startTime=0,this._currentSeq=0,this.getApplicationList())}getApplicationList(){const n=this._n+".getApplicationList",o=new ut("getApplicationList");return this._snsM.req({P:Xe,data:{applicationType:G,fromAccount:this._snsM.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSeq}}).then(e=>{const{resultList:t,unreadCount:s,startTime:i,currentSequence:r}=e.data;this._startTime=i,this._currentSeq=r,this._unreadCount=s;e=`applicationCount:${_e(t)?t.length:0} unreadCount:${s} startTime:${i} currentSequence:`+r;o.setMessage(e).end(),Le.i(n+" ok. "+e),this._map.clear(),_e(t)&&t.forEach(e=>{var{userID:t,type:s}=e,e=new Se(e);this._map.set(t+"_"+s,e)}),this._onApplicationListUpdated()}).catch(e=>(o.setError(e).end(),Le.w(n+" failed. error:",e),je(e)))}deleteApplication(e){const r=this._n+".deleteApplication",{userID:n,type:t}=e;let o=t;if(o&&(o===$||o===O)||(o=O),!this._map.has(n+"_"+o))return je({code:Ue});const a=new ut("deleteApplication");return a.setMessage(`userID:${n} type:`+o),this._snsM.req({P:Ze,data:{fromAccount:this._snsM.getMyUserID(),userIDList:[n],type:o}}).then(e=>{var e=e.data["resultList"],{to:t,resultCode:s,resultInfo:i}=e[0];return a.setMoreMessage("resultList:"+JSON.stringify(e)).end(),Le.i(r+` ok. userID:${n} type:`+o),0===s?Fe():je({userID:t,code:s,message:i})}).catch(e=>(a.setError(e).end(),Le.w(r+" failed. error:",e),je(e)))}acceptApplication(e){const s=this._n+".acceptApplication",{userID:i,remark:t,tag:r,type:n}=e;let o=n;o&&(o===R||o===q)||(o=q);const a=new ut("acceptApplication");return a.setMessage(`userID:${i} type:`+o),this._snsM.req({P:Qe,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:i,remark:t,tag:r,action:o}]}}).then(e=>{a.end();var e=e.data["resultList"],{resultCode:e,resultInfo:t}=e[0];if(0!==e)return je({code:e,message:t});Le.i(s+` ok. userID:${i} type:`+o)}).catch(e=>(a.setError(e).end(),Le.w(s+" failed. error:",e),je(e)))}refuseApplication(e){const s=this._n+".refuseApplication",i=e["userID"],r=new ut("refuseApplication");return r.setMessage("userID:"+i),this._snsM.req({P:Qe,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:i,action:"Response_Action_Reject"}]}}).then(e=>{r.end();var e=e.data["resultList"],{resultCode:e,resultInfo:t}=e[0];if(0!==e)return je({code:e,message:t});Le.i(s+" ok. userID:"+i)}).catch(e=>(r.setError(e).end(),Le.w(s+" failed. error:",e),je(e)))}setApplicationRead(){const t=this._n+".setApplicationRead",s=new ut("setApplicationRead");var e;return this._snsM.req({P:et,data:{fromAccount:this._snsM.getMyUserID(),latestTimeStamp:(e=B()/1e3,Math.round(Number(e)*Math.pow(10,0))/Math.pow(10,0))}}).then(e=>{s.end(),Le.i(t+" ok"),this._unreadCount=0}).catch(e=>(s.setError(e).end(),Le.w(t+" failed. error:",e),je(e)))}reset(){this._maxLimited=100,this._currentSeq=0,this._unreadCount=0,this._map.clear()}}class lt{constructor(e){de(e)||(this.userID=e.userID||"",this.nick=e.nick||"",this.gender=e.gender||"",this.birthday=e.birthday||0,this.location=e.location||"",this.selfSignature=e.selfSignature||"",this.allowType=e.allowType||k,this.language=e.language||0,this.avatar=e.avatar||"",this.messageSettings=e.messageSettings||0,this.adminForbidType=e.adminForbidType||P,this.level=e.level||0,this.role=e.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],de(e.profileCustomField)||e.profileCustomField.forEach(e=>{this.profileCustomField.push({key:e.key,value:e.value})}))}validate(s){let i=!0,e="";if(de(s))return{valid:!1,tips:"empty options"};if(s.profileCustomField){const i=s.profileCustomField.length;let t=null;for(let e=0;e<i;e++){if(t=s.profileCustomField[e],!pe(t.key)||-1===t.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!pe(t.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}}for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)){if("profileCustomField"===t)continue;if(de(s[t])&&!pe(s[t])&&!he(s[t])){e="key:"+t+", invalid value:"+s[t],i=!1;continue}switch(t){case"nick":pe(s[t])||(e="nick must be a string",i=!1),500<we(s[t])&&(e=`nick name limited: must less than or equal to 500 bytes, current size: ${we(s[t])} bytes`,i=!1);break;case"gender":Ae(re,s.gender)||(e="key:gender, invalid value:"+s.gender,i=!1);break;case"birthday":he(s.birthday)||(e="birthday must be a number",i=!1);break;case"location":pe(s.location)||(e="location must be a string",i=!1);break;case"selfSignature":pe(s.selfSignature)||(e="selfSignature must be a string",i=!1);break;case"allowType":Ae(oe,s.allowType)||(e="key:allowType, invalid value:"+s.allowType,i=!1);break;case"language":he(s.language)||(e="language must be a number",i=!1);break;case"avatar":pe(s.avatar)||(e="avatar must be a string",i=!1);break;case"messageSettings":0!==s.messageSettings&&1!==s.messageSettings&&(e="messageSettings must be 0 or 1",i=!1);break;case"adminForbidType":Ae(ne,s.adminForbidType)||(e="key:adminForbidType, invalid value:"+s.adminForbidType,i=!1);break;case"level":he(s.level)||(e="level must be a number",i=!1);break;case"role":he(s.role)||(e="role must be a number",i=!1);break;default:e="unknown key:"+t+" "+s[t],i=!1}}return{valid:i,tips:e}}}class ht{constructor(e,r){this.userID=e,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;const n={},o=[];if(n.userID=e,!de(r)){let s="",i;for(let e=0,t=r.length;e<t;e++)if(s=r[e].tag,i=r[e].value,-1<s.indexOf("Tag_SNS_Custom"))this.friendCustomField.push({key:s,value:i});else if(-1<s.indexOf("Tag_Profile_Custom"))o.push({key:s,value:i});else switch(s){case j:n.nick=i;break;case V:n.gender=i;break;case W:n.birthday=i;break;case K:n.location=i;break;case Y:n.selfSignature=i;break;case J:n.allowType=i;break;case z:n.language=i;break;case Q:n.avatar=i;break;case X:n.messageSettings=i;break;case Z:n.adminForbidType=i;break;case ee:n.level=i;break;case te:n.role=i;break;case se.REMARK:this.remark=i;break;case se.ADDTIME:this.addTime=i;break;case se.GROUP:this.groupList=JSON.parse(JSON.stringify(i));break;case se.ADDSOURCE:this.source=i;break;case se.ADDWORDING:break;default:Le.l("snsProfileItem unknown tag->",r[e].tag)}}this.profile=new lt({...n,profileCustomField:o})}validate(s){let i=!0,e="";if(de(s))return{valid:!1,tips:"empty options"};if(s.profileCustomField){const i=s.profileCustomField.length;let t=null;for(let e=0;e<i;e++){if(t=s.profileCustomField[e],!pe(t.key)||-1===t.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!pe(t.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}}for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)){if("profileCustomField"===t)continue;if(de(s[t])&&!pe(s[t])&&!he(s[t])){e="key:"+t+", invalid value:"+s[t],i=!1;continue}switch(t){case"nick":pe(s[t])||(e="nick must be a string",i=!1),500<we(s[t])&&(e=`nick name limited: must less than or equal to 500 bytes, current size: ${we(s[t])} bytes`,i=!1);break;case"gender":Ae(re,s.gender)||(e="key:gender, invalid value:"+s.gender,i=!1);break;case"birthday":he(s.birthday)||(e="birthday must be a number",i=!1);break;case"location":pe(s.location)||(e="location must be a string",i=!1);break;case"selfSignature":pe(s.selfSignature)||(e="selfSignature must be a string",i=!1);break;case"allowType":Ae(oe,s.allowType)||(e="key:allowType, invalid value:"+s.allowType,i=!1);break;case"language":he(s.language)||(e="language must be a number",i=!1);break;case"avatar":pe(s.avatar)||(e="avatar must be a string",i=!1);break;case"messageSettings":0!==s.messageSettings&&1!==s.messageSettings&&(e="messageSettings must be 0 or 1",i=!1);break;case"adminForbidType":Ae(ne,s.adminForbidType)||(e="key:adminForbidType, invalid value:"+s.adminForbidType,i=!1);break;case"level":he(s.level)||(e="level must be a number",i=!1);break;case"role":he(s.role)||(e="role must be a number",i=!1);break;default:e="unknown key:"+t+" "+s[t],i=!1}}return{valid:i,tips:e}}update(s){let i="",r;const n=[];this.friendCustomField.forEach(e=>{n.push(e.key)});for(let e=0,t=s.length;e<t;e++)if(i=s[e].tag,r=s[e].value,-1<i.indexOf("Tag_SNS_Custom"))-1<n.indexOf(i)?this.friendCustomField.forEach(e=>{e.key===i&&(e.value=r)}):this.friendCustomField.push({key:i,value:r});else if(-1<i.indexOf("Tag_Profile_Custom")){let t=!1;this.profile.profileCustomField.forEach(e=>{e.key===i&&(e.value=r,t=!0)}),t||this.profile.profileCustomField.push({key:i,value:r})}else switch(i){case j:this.profile.nick=r;break;case V:this.profile.gender=r;break;case W:this.profile.birthday=r;break;case K:this.profile.location=r;break;case Y:this.profile.selfSignature=r;break;case J:this.profile.allowType=r;break;case z:this.profile.language=r;break;case Q:this.profile.avatar=r;break;case X:this.profile.messageSettings=r;break;case Z:this.profile.adminForbidType=r;break;case ee:this.profile.level=r;break;case te:this.profile.role=r;break;case se.REMARK:this.remark=r;break;case se.ADDTIME:this.addTime=r;break;case se.GROUP:this.groupList=JSON.parse(JSON.stringify(r));break;case se.ADDSOURCE:this.source=r;break;case se.ADDWORDING:break;default:Le.d("snsProfileItem unkown tag->",s[e].tag)}this.timestamp=Date.now(),n.length=0}updateProfile(e){this.profile=JSON.parse(JSON.stringify(e)),this.timestamp=Date.now()}addToGroupList(e){-1===this.groupList.indexOf(e)&&(this.groupList.push(e),this.count=this.groupList.length)}removeFromGroupList(e){e=this.groupList.indexOf(e);-1<e&&(this.groupList.splice(e,1),this.count=this.groupList.length)}}const pt=4,mt=11,_t=12,ft=20,gt=23,yt=27,wt=29;class At{constructor(e){this._snsM=e,this._n="FriendHandler",this._map=new Map,this._startIdx=0,this._standardSeq=0,this._customSeq=0,this._expirationTime=18e4}getLocalFriendList(){return[...this._map.values()]}getFriendRemark(e){return this._map.has(e)?this._map.get(e).remark:""}onFriendProfileModified(e){const t=e["dataList"];if(!de(t)){const i=this._snsM.get(mt);t.forEach(e=>{var{userID:t,profileList:s}=e;if(this.isMyFriend(t)){Le.l(this._n+`.onFriendProfileModified. friend account:${t}, profileList:`+JSON.stringify(s));const e=this._map.get(t);e.update(s),i.modifyMessageSentByPeer({conversationID:""+v+t,latestNick:e.profile.nick,latestAvatar:e.profile.avatar})}}),this._onFriendListUpdated()}}onFriendAdded(t){0!==t.length&&(Le.l(this._n+".onFriendAdded userIDList:"+t),t.forEach(e=>{this._map.set(e,new ht(e))}),this.getFriendProfile({userIDList:t}).then(e=>{t.forEach(e=>{var t=this._map.get(e);0<t.groupList.length&&this._snsM.updateWhenFriendAdded({nameList:t.groupList,userID:e})}),this._onFriendListUpdated()}))}onFriendDeleted(e){0!==e.length&&(Le.l(this._n+".onFriendDeleted userIDList:"+e),e.forEach(e=>{var t=this._map.get(e);0<t.groupList.length&&this._snsM.updateWhenFriendDeleted({nameList:t.groupList,userID:e}),this._map.delete(e)}),this._onFriendListUpdated())}_onFriendListUpdated(){this._snsM.emitOEvt($e),this._snsM.get(mt).checkAndPatchRemark()}getFriendProfile(e){const s=this._n+".getFriendProfile",t=e["userIDList"],r=[],n=[],i=[];if(t.forEach(e=>{var t;this._map.has(e)?(t=this._map.get(e),Date.now()-t.timestamp<this._expirationTime?n.push(t):i.push(e)):r.push({userID:e,code:ve,message:this._snsM.getErrMsg(ve)})}),0===i.length)return Le.i(s+" newUserIDList is empty"),Be({friendList:n,failureUserIDList:r});const o=new ut("getFriendProfile");return o.setMessage("userIDList:"+i),Le.i(s+" userIDList:"+i),this._snsM.req({P:We,data:{fromAccount:this._snsM.getMyUserID(),userIDList:i}}).then(e=>{o.end(),Le.i(s+" ok");const t=e.data["resultList"];return t.forEach(t=>{var{to:t,resultCode:e,resultInfo:s,tagValueList:i}=t;if(fe(e)||0===e){let e;this._map.has(t)?(e=this._map.get(t)).update(i):(e=new ht(t,i),this._map.set(t,e)),n.push(e)}else r.push({userID:t,code:e,message:s})}),Fe({friendList:n,failureUserIDList:r})}).catch(e=>(o.setError(e).end(),Le.w(s+" failed. error:",e),je(e)))}isMyFriend(e){return this._map.has(e)}pagingGetFriendList(){const a=this._n+".getFriendList",d=new ut("getFriendList"),u=Date.now();this._snsM.req({P:Ve,data:{fromAccount:this._snsM.getMyUserID(),startIndex:this._startIdx,standardSequence:this._standardSeq,customSequence:this._customSeq}}).then(e=>{const{friendCount:t,resultList:s,nextStartIndex:i,standardSequence:r,customSequence:n,completeFlag:o}=e.data;e=`friendCount:${t} nextStartIndex:${this._startIdx=i} standardSequence:${this._standardSeq=r} customSequence:${this._customSeq=n} completeFlag:${o} cost:`+(e=u,Date.now()-e+" ms");d.setMessage(e).end(),Le.i(a+" ok.",e),de(s)||s.forEach(e=>{var{to:e,tagValueList:t}=e;this._map.set(e,new ht(e,t))}),0===o?this.pagingGetFriendList():(this._snsM.emitOEvt($e),this._pagingGetFriendProfile())}).catch(e=>(d.setError(e).end(),Le.w(a+" failed. error:",e),je(e)))}_pagingGetFriendProfile(){const t=[...this._map.keys()],s=this._snsM.get(pt),e=t.length,i=e<=100?1:Math.ceil(e/100);Le.l(this._n+`._pagingGetFriendProfile friendCount:${e} pageCount:`+i);for(let e=0;e<i;e++)s.getUserProfile({userIDList:t.slice(100*e,100*(e+1))}).then(e=>{e.data.forEach(e=>{const t=this._map.get(e.userID);t&&t.updateProfile(e)}),this._onFriendListUpdated()})}addFriend(e){const i=this._n+".addFriend";if(this._map.has(e.to))return je({code:ke});if(e.wording&&!1===this._snsM.filterProfanity("wording",e))return je({code:Oe});var{to:e,source:t,type:s,wording:r,remark:n,groupName:o}=e;let a=s;a&&(a===b||a===U)||(a=U);const d=new ut("addFriend");return d.setMessage(`to:${e} source:${t} type:`+a),this._snsM.req({P:Je,data:{fromAccount:this._snsM.getMyUserID(),addFriendItem:[{to:e,source:t,wording:r,remark:n,groupName:o}],type:a}}).then(e=>{var e=e.data["resultList"],{to:e,resultCode:t,resultInfo:s}=(d.setMoreMessage("resultList:"+JSON.stringify(e)).end(),e[0]);return Le.i(i+` ok. to:${e} type:${a} code:`+t),fe(t)||0===t?Fe({userID:e,code:0}):30539===t?Fe({userID:e,code:t,message:this._snsM.getErrMsg(t)}):je({userID:e,code:t,message:this._snsM.getErrMsg(t)||s})}).catch(e=>(d.setError(e).end(),Le.w(i+" failed. error:",e),je(e)))}deleteFriend(e){const s=this._n+".deleteFriend",{userIDList:t,type:i}=e;1e3<t.length&&(Le.w(s+" "+"the length of userIDList cannot exceed 1000"),t.length=1e3);const r=[],n=[],o=[];if(t.forEach(e=>{this._map.has(e)?o.push(e):r.push({userID:e,code:ve,message:this._snsM.getErrMsg(ve)})}),0===o.length)return Be({successUserIDList:n,failureUserIDList:r});let a=i;a&&(a===N||a===C)||(a=C);const d=new ut("deleteFriend");return d.setMessage(`userIDList:${o} type:`+a),this._snsM.req({P:Ye,data:{fromAccount:this._snsM.getMyUserID(),userIDList:o,type:a}}).then(e=>{d.end(),Le.i(s+" ok");const t=e.data["resultList"];return de(t)||t.forEach(e=>{var{to:e,resultCode:t,resultInfo:s}=e;fe(t)||0===t?n.push({userID:e}):r.push({userID:e,code:t,message:s})}),Fe({successUserIDList:n,failureUserIDList:r})}).catch(e=>(d.setError(e).end(),Le.w(s+" error:",e),je(e)))}updateFriend(e){const{userID:t,remark:i,friendCustomField:n}=e;if(!this._map.has(t))return je({code:ve});const o=this._n+".updateFriend",a=new ut("updateFriend"),s=(a.setMessage(`userID:${t} remark:${i} friendCustomField:`+n),[]);return fe(i)||s.push({tag:se.REMARK,value:i}),_e(n)&&0<n.length&&n.forEach(e=>{s.push({tag:e.key,value:e.value})}),this._snsM.req({P:ze,data:{fromAccount:this._snsM.getMyUserID(),updateItem:[{to:t,snsItem:s}]}}).then(e=>{a.end(),Le.i(o+" ok");var e=e.data["resultList"],{to:t,resultCode:e,resultInfo:s}=e[0];if(fe(e)||0===e){const e=this._map.get(t);if(e){fe(i)||(e.remark=i);if(_e(n)&&0<n.length){var r=e.friendCustomField;t=n;if(_e(r)&&_e(t)){let i=!1;t.forEach(({key:t,value:e})=>{const s=r.find(e=>e.key===t);s?s.value!==e&&(s.value=e,i=!0):(r.push({key:t,value:e}),i=!0)})}}this._onFriendListUpdated()}return Fe(e)}return je({code:e,message:s})}).catch(e=>(a.setError(e).end(),Le.w(o+" failed. error:",e),je(e)))}checkFriend(e){const s=this._n+".checkFriend",{userIDList:i,type:t}=e;let o=t;o&&(o===H||o===x)||(o=x);const a=new ut("checkFriend");return a.setMessage(`userIDList:${i} type:`+o),this._snsM.req({P:Ke,data:{fromAccount:this._snsM.getMyUserID(),userIDList:i,type:o}}).then(e=>{a.end(),Le.i(s+` ok. userIDList:${i} type:`+o);const r=[],n=[],t=e.data["resultList"];return _e(t)&&t.forEach(e=>{var{to:e,relation:t,resultCode:s,resultInfo:i}=e;fe(s)||0===s?r.push({userID:e,code:0,relation:t}):n.push({userID:e,code:s,message:i})}),Fe({successUserIDList:r,failureUserIDList:n})}).catch(e=>(a.setError(e).end(),Le.w(s+" failed. error:",e),je(e)))}onAddedToFriendGroup(e){const{name:t,userIDList:s}=e;Le.l(`${this._n}.onAddedToFriendGroup groupName:${t} userIDList:`+s),t&&!de(s)&&s.forEach(e=>{this._map.has(e)&&this._map.get(e).addToGroupList(t)})}onRemovedFromFriendGroup(e){const{name:t,userIDList:s}=e;Le.l(`${this._n}.onRemovedFromFriendGroup groupName:${t} userIDList:`+s),t&&!de(s)&&s.forEach(e=>{this._map.has(e)&&this._map.get(e).removeFromGroupList(t)})}reset(){this._map.clear(),this._startIdx=0,this._standardSeq=0,this._customSeq=0}}class It{constructor(e){de(e)||(this.name=e.name||"",this.userIDList=e.userIDList||[],this.count=this.userIDList.length||0)}addToUserIDList(e){-1===this.userIDList.indexOf(e)&&(this.userIDList.push(e),this.count=this.userIDList.length)}removeFromUserIDList(e){e=this.userIDList.indexOf(e);-1<e&&(this.userIDList.splice(e,1),this.count=this.userIDList.length)}}class Dt{constructor(e){this._snsM=e,this._n="FriendGroupHandler",this._map=new Map}getLocalGroupList(){return[...this._map.values()]}_onGroupListUpdated(){var e=[...this._map.values()];this._snsM.emitOEvt(Re,e)}getGroupList(){const s=this._n+".getGroupList",i=new ut("getGroupList");return this._snsM.req({P:st,data:{fromAccount:this._snsM.getMyUserID()}}).then(e=>{i.end();const t=e.data["resultList"];de(t)?Le.i(s+" ok. count:0"):(Le.i(s+" ok. count:"+t.length),this._map.clear(),t.forEach(e=>{var t=new It(e);this._map.set(e.name,t)}),this._onGroupListUpdated())}).catch(e=>(i.setError(e).end(),Le.w(s+" error:",e),je(e)))}createGroup(e){const s=this._n+".createGroup",{name:i,userIDList:t}=e;if(this._map.has(i))return je({code:Pe});const o=`name:${i} userIDList:`+t,a=new ut("createGroup");return a.setMessage(o),this._snsM.req({P:it,data:{fromAccount:this._snsM.getMyUserID(),groupName:[i],userIDList:_e(t)?t:void 0}}).then(e=>{a.end(),Le.l(s+" ok. "+o);const t=e.data["resultList"],r=[],n=[];t&&t.forEach(e=>{const{to:t,resultCode:s,resultInfo:i}=e;if(fe(s)||0===s)r.push(t);else{const t={userID:e.to,code:s,message:i};n.push(t)}});e=new It({name:i,userIDList:r});return this._map.set(i,e),this._snsM.onAddedToFriendGroup({name:i,userIDList:r}),this._onGroupListUpdated(),Fe({friendGroup:e,failureUserIDList:n})}).catch(e=>(a.setError(e).end(),Le.w(s+" failed. error:",e),je(e)))}deleteGroup(e){const s=this._n+".deleteGroup",i=e["name"];if(!this._map.has(i))return this._onGroupNotExist();const r="name:"+i,n=new ut("deleteGroup");return n.setMessage(r),this._snsM.req({P:rt,data:{fromAccount:this._snsM.getMyUserID(),nameList:[i]}}).then(e=>{n.end(),Le.l(s+" ok. "+r);const t=this._map.get(i);return t&&(this._snsM.onRemovedFromFriendGroup({name:i,userIDList:t.userIDList}),this._map.delete(i),t.userIDList.length=0),this._onGroupListUpdated(),Fe(t)}).catch(e=>(n.setError(e).end(),Le.w(s+" failed. error:",e),je(e)))}renameGroup(e){const t=this._n+".renameGroup",{oldName:s,newName:i}=e;if(!this._map.has(s))return this._onGroupNotExist();const r=`oldName:${s} newName:`+i,n=new ut("renameGroup");return n.setMessage(r),this._snsM.req({P:nt,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,newName:i}}).then(()=>{if(n.end(),Le.l(t+" ok. "+r),this._map.has(s)){const e=this._map.get(s);return e.name=i,this._map.delete(s),this._map.set(i,e),this._snsM.onRemovedFromFriendGroup({name:s,userIDList:e.userIDList}),this._snsM.onAddedToFriendGroup({name:i,userIDList:e.userIDList}),this._onGroupListUpdated(),Fe(e)}return Fe()}).catch(e=>(n.setError(e).end(),Le.w(t+" failed. error:",e),je(e)))}addToGroup(e){const t=this._n+".addToGroup",{name:s,userIDList:i}=e;if(!this._map.has(s))return this._onGroupNotExist();const r=`name:${s} userIDList:`+i,n=new ut("addToGroup");return n.setMessage(r),this._snsM.req({P:nt,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,updateGroupItem:i.filter(e=>this._snsM.isMyFriend(e)).map(e=>({to:e,updateType:"Update_Type_Add"}))}}).then(e=>(n.end(),Le.l(t+" ok. "+r),this._onGroupUpdated(s,e))).catch(e=>(n.setError(e).end(),Le.w(t+" failed. error:",e),je(e)))}removeFromGroup(e){const t=this._n+".removeFromGroup",{name:s,userIDList:i}=e;if(!this._map.has(s))return this._onGroupNotExist();const r=`name:${s} userIDList:`+i,n=new ut("removeFromGroup");return n.setMessage(r),this._snsM.req({P:nt,data:{fromAccount:this._snsM.getMyUserID(),oldName:s,updateGroupItem:i.filter(e=>this._snsM.isMyFriend(e)).map(e=>({to:e,updateType:"Update_Type_Delete"}))}}).then(e=>(n.end(),Le.l(t+" ok. "+r),this._onGroupUpdated(s,e))).catch(e=>(n.setError(e).end(),Le.w(t+" failed. error:",e),je(e)))}_onGroupUpdated(e,t){const s=t.data["resultList"],n=this._map.get(e),o=[],a=[],d=[];return _e(s)&&s.forEach(e=>{var{to:t,resultCode:s,resultInfo:i,type:r}=e;0===s?"Update_Type_Add"===r?n&&(n.addToUserIDList(t),a.push(t)):"Update_Type_Delete"===r&&n&&(n.removeFromUserIDList(t),d.push(t)):o.push({to:e.to,code:s,message:i})}),Le.l(this._n+`._onGroupUpdated name:${e} userIDList:`+n.userIDList),0<a.length&&this._snsM.onAddedToFriendGroup({name:e,userIDList:a}),0<d.length&&this._snsM.onRemovedFromFriendGroup({name:e,userIDList:d}),Fe({friendGroup:n,failureUserIDList:o})}updateWhenFriendAdded(e){const{nameList:t,userID:s}=e;Le.l(`${this._n}.updateWhenFriendAdded userID:${s} nameList:`+t),de(t)||t.forEach(e=>{this._map.has(e)&&this._map.get(e).addToUserIDList(s)})}updateWhenFriendDeleted(e){const{nameList:t,userID:s}=e;Le.l(`${this._n}.updateWhenFriendDeleted userID:${s} nameList:`+t),de(t)||t.forEach(e=>{this._map.has(e)&&this._map.get(e).removeFromUserIDList(s)})}_onGroupNotExist(e){return je({code:be})}reset(){this._map.clear()}}class Tt extends class{constructor(e){this._m=e,this._n=""}isLoggedIn(){return this._m.get(_t).isLoggedIn()}isOversea(){return this._m.get(_t).isOversea()}isPrivateNetWork(){const e=this._m.get(_t);return e.isPrivateNetWork()&&!e.getFileDownloadProxy()}getFileDownloadProxy(){return this._m.get(_t).getFileDownloadProxy()}getDowloadFileAuthKey(){return this._m.get(_t).getDowloadFileAuthKey()}getMyUserID(){return this._m.get(_t).getUserID()}getMyTinyID(){return this._m.get(_t).getTinyID()}getSDKAppID(){return this._m.get(_t).getSDKAppID()}isIntl(){return this._m.get(_t).isIntl()}isUsingChatCore(){return this._m.get(_t).isUsingChatCore()}isDevMode(){return this._m.get(_t).isDevMode()}get(e){return this._m.get(e)}getPlatform(){return F}getCloudConfig(e){return this._m.get(gt).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(ft).req(e)}canIUse(e){return this._m.get(yt).canIUse(e)}getErrMsg(e,t,s){return this._m.getErrMsg(e,t,s)}warn(e,t,s){e=this.getErrMsg(e,t,s);e&&Le.w(e)}noUse(e){var t=Ge;return je({code:t,message:this.getErrMsg(t,e)})}}{constructor(t){super(t),this._n="SnsModule",this._friendHandler=new At(this),this._friendApplicationHandler=new ct(this),this._friendGroupHandler=new Dt(this),this.getIEmitInst().on(e.A2KEY_AND_TINYID_UPDATED,this.onContextUpdated,this)}onContextUpdated(e){this._friendHandler.pagingGetFriendList(),this._friendGroupHandler.getGroupList(),this._friendApplicationHandler.getApplicationList()}onRelationChainModified(e){const t=e["dataList"];if(!de(t)){const r=[],n=[],o=[],a=[];let s=!1,i="";t.forEach(e=>{if(3!==e.pushType&&4!==e.pushType||!e.from||(i=e.from),e.friendAddAccount&&(r.push(...e.friendAddAccount),a.push(...e.friendAddAccount)),e.friendDelAccount&&n.push(...e.friendDelAccount),e.friendApplicationAdded&&o.push(...e.friendApplicationAdded),e.friendApplicationDeletedUserIDList&&a.push(...e.friendApplicationDeletedUserIDList),e.reportTime&&7===e.pushType&&(s=!0),e.friendUpInfo){const t={dataList:[]};e.friendUpInfo.forEach(e=>{t.dataList.push({userID:e.friendAccount,profileList:[...e.sns]})}),this.onFriendProfileModified(t)}}),s&&this._friendApplicationHandler.onApplicationRead(),this._friendApplicationHandler.onApplicationAdded(o,i),this._friendApplicationHandler.onApplicationDeleted(a),this._friendHandler.onFriendAdded(r),this._friendHandler.onFriendDeleted(n)}}isMyFriend(e){return this._friendHandler.isMyFriend(e)}filterProfanity(e,t){const s=this.get(wt);if(!s)return!0;var{isAllowedToSend:i,modifiedText:r}=s.filterText(t[e],h);return!0===i&&(t[e]=r,!0)}onFriendProfileModified(e){this._friendHandler.onFriendProfileModified(e)}getLocalFriendList(e=!0){var t=this._friendHandler.getLocalFriendList();return e?Be(t):t}getFriendRemark(e){return this._friendHandler.getFriendRemark(e)}getFriendList(){return this._friendHandler.pagingGetFriendList()}addFriend(e){return this._friendHandler.addFriend(e)}deleteFriend(e){return this._friendHandler.deleteFriend(e)}checkFriend(e){return this._friendHandler.checkFriend(e)}getFriendProfile(e){return this._friendHandler.getFriendProfile(e)}updateFriend(e){return this._friendHandler.updateFriend(e)}onAddedToFriendGroup(e){this._friendHandler.onAddedToFriendGroup(e)}onRemovedFromFriendGroup(e){this._friendHandler.onRemovedFromFriendGroup(e)}getLocalFriendApplicationList(){var e=this._friendApplicationHandler.getLocalApplicationList();return Be(e)}deleteFriendApplication(e){return this._friendApplicationHandler.deleteApplication(e)}refuseFriendApplication(e){return this._friendApplicationHandler.refuseApplication(e)}acceptFriendApplication(e){return this._friendApplicationHandler.acceptApplication(e)}setFriendApplicationRead(e){return this._friendApplicationHandler.setApplicationRead(e)}getLocalFriendGroupList(){var e=this._friendGroupHandler.getLocalGroupList();return Be(e)}createFriendGroup(e){return this._friendGroupHandler.createGroup(e)}deleteFriendGroup(e){return this._friendGroupHandler.deleteGroup(e)}addToFriendGroup(e){return this._friendGroupHandler.addToGroup(e)}removeFromFriendGroup(e){return this._friendGroupHandler.removeFromGroup(e)}renameFriendGroup(e){return this._friendGroupHandler.renameGroup(e)}updateWhenFriendAdded(e){this._friendGroupHandler.updateWhenFriendAdded(e)}updateWhenFriendDeleted(e){this._friendGroupHandler.updateWhenFriendDeleted(e)}reset(){Le.l(this._n+".reset"),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}export{Tt as default};