Files
zyt/server/public/admin/assets/tim-js-sdk-D6E6n_Uo.js
T
2026-03-04 15:32:30 +08:00

6 lines
587 KiB
JavaScript

import{aA as Vo}from"./@vue-DqCYILjk.js";var Gn={exports:{}},Qc=Gn.exports,Jr;function tl(){return Jr||(Jr=1,function(Xr,$c){(function(Un,m){Xr.exports=m()})(Qc,function(){function Un(c,t){var s=Object.keys(c);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(c);t&&(e=e.filter(function(n){return Object.getOwnPropertyDescriptor(c,n).enumerable})),s.push.apply(s,e)}return s}function m(c){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?Un(Object(s),!0).forEach(function(e){Be(c,e,s[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(s)):Un(Object(s)).forEach(function(e){Object.defineProperty(c,e,Object.getOwnPropertyDescriptor(s,e))})}return c}function _t(c){return(_t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(c)}function F(c,t){if(!(c instanceof t))throw new TypeError("Cannot call a class as a function")}function Bo(c,t){for(var s=0;s<t.length;s++){var e=t[s];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(c,e.key,e)}}function q(c,t,s){return t&&Bo(c.prototype,t),s&&Bo(c,s),Object.defineProperty(c,"prototype",{writable:!1}),c}function Be(c,t,s){return t in c?Object.defineProperty(c,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):c[t]=s,c}function re(c,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(t&&t.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),t&&un(c,t)}function rn(c){return(rn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(c)}function un(c,t){return(un=Object.setPrototypeOf||function(s,e){return s.__proto__=e,s})(c,t)}function Ho(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ko(c,t,s){return(Ko=Ho()?Reflect.construct:function(e,n,o){var a=[null];a.push.apply(a,n);var r=new(Function.bind.apply(e,a));return o&&un(r,o.prototype),r}).apply(null,arguments)}function Wo(c){var t=typeof Map=="function"?new Map:void 0;return(Wo=function(s){if(s===null||(e=s,Function.toString.call(e).indexOf("[native code]")===-1))return s;var e;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(s))return t.get(s);t.set(s,n)}function n(){return Ko(s,arguments,rn(this).constructor)}return n.prototype=Object.create(s.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),un(n,s)})(c)}function ft(c,t){if(c==null)return{};var s,e,n=function(a,r){if(a==null)return{};var i,u,l={},d=Object.keys(a);for(u=0;u<d.length;u++)i=d[u],r.indexOf(i)>=0||(l[i]=a[i]);return l}(c,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(c);for(e=0;e<o.length;e++)s=o[e],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(c,s)&&(n[s]=c[s])}return n}function $(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function Zr(c,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $(c)}function ie(c){var t=Ho();return function(){var s,e=rn(c);if(t){var n=rn(this).constructor;s=Reflect.construct(e,arguments,n)}else s=e.apply(this,arguments);return Zr(this,s)}}function N(c,t){return Yo(c)||function(s,e){var n=s==null?null:typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(n!=null){var o,a,r=[],i=!0,u=!1;try{for(n=n.call(s);!(i=(o=n.next()).done)&&(r.push(o.value),!e||r.length!==e);i=!0);}catch(l){u=!0,a=l}finally{try{i||n.return==null||n.return()}finally{if(u)throw a}}return r}}(c,t)||cn(c,t)||zo()}function B(c){return function(t){if(Array.isArray(t))return Pn(t)}(c)||jo(c)||cn(c)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Yo(c){if(Array.isArray(c))return c}function jo(c){if(typeof Symbol<"u"&&c[Symbol.iterator]!=null||c["@@iterator"]!=null)return Array.from(c)}function cn(c,t){if(c){if(typeof c=="string")return Pn(c,t);var s=Object.prototype.toString.call(c).slice(8,-1);return s==="Object"&&c.constructor&&(s=c.constructor.name),s==="Map"||s==="Set"?Array.from(c):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?Pn(c,t):void 0}}function Pn(c,t){(t==null||t>c.length)&&(t=c.length);for(var s=0,e=new Array(t);s<t;s++)e[s]=c[s];return e}function zo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ee(c,t){var s=typeof Symbol<"u"&&c[Symbol.iterator]||c["@@iterator"];if(!s){if(Array.isArray(c)||(s=cn(c))||t){s&&(c=s);var e=0,n=function(){};return{s:n,n:function(){return e>=c.length?{done:!0}:{done:!1,value:c[e++]}},e:function(i){throw i},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,a=!0,r=!1;return{s:function(){s=s.call(c)},n:function(){var i=s.next();return a=i.done,i},e:function(i){r=!0,o=i},f:function(){try{a||s.return==null||s.return()}finally{if(r)throw o}}}}var W={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",MESSAGE_EXTENSIONS_UPDATED:"onMessageExtensionsUpdated",MESSAGE_EXTENSIONS_DELETED:"onMessageExtensionsDeleted",CONVERSATION_LIST_UPDATED:"onConversationListUpdated",TOTAL_UNREAD_MESSAGE_COUNT_UPDATED:"onTotalUnreadMessageCountUpdated",CONVERSATION_GROUP_LIST_UPDATED:"onConversationGroupListUpdated",CONVERSATION_IN_GROUP_UPDATED:"onConversationInGroupUpdated",GROUP_LIST_UPDATED:"onGroupListUpdated",GROUP_SYSTEM_NOTICE_RECEIVED:"receiveGroupSystemNotice",GROUP_ATTRIBUTES_UPDATED:"groupAttributesUpdated",GROUP_COUNTER_UPDATED:"onGroupCounterUpdated",TOPIC_CREATED:"onTopicCreated",TOPIC_DELETED:"onTopicDeleted",TOPIC_UPDATED:"onTopicUpdated",PROFILE_UPDATED:"onProfileUpdated",USER_STATUS_UPDATED:"onUserStatusUpdated",BLACKLIST_UPDATED:"blacklistUpdated",FRIEND_LIST_UPDATED:"onFriendListUpdated",FRIEND_GROUP_LIST_UPDATED:"onFriendGroupListUpdated",FRIEND_APPLICATION_LIST_UPDATED:"onFriendApplicationListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",SDK_RELOAD:"sdkReload"},f={MSG_TEXT:"TIMTextElem",MSG_IMAGE:"TIMImageElem",MSG_SOUND:"TIMSoundElem",MSG_AUDIO:"TIMSoundElem",MSG_FILE:"TIMFileElem",MSG_FACE:"TIMFaceElem",MSG_VIDEO:"TIMVideoFileElem",MSG_GEO:"TIMLocationElem",MSG_LOCATION:"TIMLocationElem",MSG_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_MERGER:"TIMRelayElem",MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest",CONV_C2C:"C2C",CONV_GROUP:"GROUP",CONV_TOPIC:"TOPIC",CONV_SYSTEM:"@TIM#SYSTEM",CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3,CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8,GRP_PRIVATE:"Private",GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_CHATROOM:"ChatRoom",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",GRP_MBR_ROLE_CUSTOM:"Custom",GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11,MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard",GENDER_UNKNOWN:"Gender_Type_Unknown",GENDER_FEMALE:"Gender_Type_Female",GENDER_MALE:"Gender_Type_Male",KICKED_OUT_MULT_ACCOUNT:"multipleAccount",KICKED_OUT_MULT_DEVICE:"multipleDevice",KICKED_OUT_USERSIG_EXPIRED:"userSigExpired",KICKED_OUT_REST_API:"REST_API_Kick",ALLOW_TYPE_ALLOW_ANY:"AllowType_Type_AllowAny",ALLOW_TYPE_NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_TYPE_DENY_ANY:"AllowType_Type_DenyAny",FORBID_TYPE_NONE:"AdminForbid_Type_None",FORBID_TYPE_SEND_OUT:"AdminForbid_Type_SendOut",JOIN_OPTIONS_FREE_ACCESS:"FreeAccess",JOIN_OPTIONS_NEED_PERMISSION:"NeedPermission",JOIN_OPTIONS_DISABLE_APPLY:"DisableApply",JOIN_STATUS_SUCCESS:"JoinedSuccess",JOIN_STATUS_ALREADY_IN_GROUP:"AlreadyInGroup",JOIN_STATUS_WAIT_APPROVAL:"WaitAdminApproval",INVITE_OPTIONS_DISABLE_INVITE:"DisableInvite",INVITE_OPTIONS_NEED_PERMISSION:"NeedPermission",INVITE_OPTIONS_FREE_ACCESS:"FreeAccess",GRP_PROFILE_OWNER_ID:"ownerID",GRP_PROFILE_CREATE_TIME:"createTime",GRP_PROFILE_LAST_INFO_TIME:"lastInfoTime",GRP_PROFILE_MEMBER_NUM:"memberNum",GRP_PROFILE_MAX_MEMBER_NUM:"maxMemberNum",GRP_PROFILE_JOIN_OPTION:"joinOption",GRP_PROFILE_INVITE_OPTION:"inviteOption",GRP_PROFILE_INTRODUCTION:"introduction",GRP_PROFILE_NOTIFICATION:"notification",GRP_PROFILE_MUTE_ALL_MBRS:"muteAllMembers",SNS_ADD_TYPE_SINGLE:"Add_Type_Single",SNS_ADD_TYPE_BOTH:"Add_Type_Both",SNS_DELETE_TYPE_SINGLE:"Delete_Type_Single",SNS_DELETE_TYPE_BOTH:"Delete_Type_Both",SNS_APPLICATION_TYPE_BOTH:"Pendency_Type_Both",SNS_APPLICATION_SENT_TO_ME:"Pendency_Type_ComeIn",SNS_APPLICATION_SENT_BY_ME:"Pendency_Type_SendOut",SNS_APPLICATION_AGREE:"Response_Action_Agree",SNS_APPLICATION_AGREE_AND_ADD:"Response_Action_AgreeAndAdd",SNS_CHECK_TYPE_BOTH:"CheckResult_Type_Both",SNS_CHECK_TYPE_SINGLE:"CheckResult_Type_Single",SNS_TYPE_NO_RELATION:"CheckResult_Type_NoRelation",SNS_TYPE_A_WITH_B:"CheckResult_Type_AWithB",SNS_TYPE_B_WITH_A:"CheckResult_Type_BWithA",SNS_TYPE_BOTH_WAY:"CheckResult_Type_BothWay",NET_STATE_CONNECTED:"connected",NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected",MSG_AT_ALL:"__kImSDK_MesssageAtALL__",READ_ALL_C2C_MSG:"readAllC2CMessage",READ_ALL_GROUP_MSG:"readAllGroupMessage",READ_ALL_MSG:"readAllMessage",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3},Qr=function(){function c(){F(this,c),this.cache=[],this.options=null}return q(c,[{key:"use",value:function(t){if(typeof t!="function")throw"middleware must be a function";return this.cache.push(t),this}},{key:"next",value:function(t){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:"run",value:function(t){return this.middlewares=this.cache.map(function(s){return s}),this.options=t,this.next()}}]),c}(),Ne=function(){function c(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;F(this,c),this.high=t,this.low=s}return q(c,[{key:"equal",value:function(t){return t!==null&&this.low===t.low&&this.high===t.high}},{key:"toString",value:function(){var t=Number(this.high).toString(16),s=Number(this.low).toString(16);if(s.length<8)for(var e=8-s.length;e;)s="0"+s,e--;return t+s}}]),c}(),$r={PRODUCTION:{CHINA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com"},IND:{DEFAULT:"wss://wssind.my-imcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com"},JPN:{DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT:"wss://wssusa.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com"}}},at={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},bn="1.7.3",wn=537048168,Fn="CHINA",ei="OVERSEA",ti="SINGAPORE",ni="KOREA",oi="GERMANY",si="IND",ai="JPN",ri="USA",I={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent:function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fn;this.CURRENT=$r.PRODUCTION[c]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GROUP:"group_open_http_svc",GROUP_AVCHATROOM:"group_open_avchatroom_http_svc",GROUP_COMMUNITY:"million_group_open_http_svc",GROUP_ATTR:"group_open_attr_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",BIG_GROUP_NO_AUTH:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_svc",BIG_GROUP_LONG_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",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_MESSAGE:"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"},CMD:{LOGIN:"wslogin",LOGOUT:"wslogout",HELLO:"wshello",STAT_BACKGROUND:"ws_stat_background",STAT_FOREGROUND:"ws_stat_foreground",SET_TOKEN:"ws_stat_settoken",PORTRAIT_GET:"portrait_get_all",PORTRAIT_SET:"portrait_set",AVCHATROOM_LONG_POLL:"get_msg",GET_GROUP_APPLICATION:"get_pendency",GET_BLACKLIST:"black_list_get",ADD_BLACKLIST:"black_list_add",DELETE_BLACKLIST:"black_list_delete",CREATE_GROUP:"create_group",GET_JOINED_GROUPS:"get_joined_group_list",SET_GROUP_ATTRIBUTES:"set_group_attr",MODIFY_GROUP_ATTRIBUTES:"modify_group_attr",DELETE_GROUP_ATTRIBUTES:"delete_group_attr",CLEAR_GROUP_ATTRIBUTES:"clear_group_attr",GET_GROUP_ATTRIBUTES:"get_group_attr",SEND_MESSAGE:"sendmsg",REVOKE_C2C_MESSAGE:"msgwithdraw",DELETE_C2C_MESSAGE:"delete_c2c_msg_ramble",MODIFY_C2C_MESSAGE:"modify_c2c_msg",MODIFY_C2C_MESSAGE_EXTENSIONS:"set_key_values",GET_C2C_MESSAGE_EXTENSIONS:"get_key_values",SEND_GROUP_MESSAGE:"send_group_msg",REVOKE_GROUP_MESSAGE:"group_msg_recall",DELETE_GROUP_MESSAGE:"delete_group_ramble_msg_by_seq",MODIFY_GROUP_MESSAGE:"modify_group_msg",MODIFY_GROUP_MESSAGE_EXTENSIONS:"group_set_key_values",GET_GROUP_MESSAGE_EXTENSIONS:"group_get_key_values",GET_GROUP_INFO:"get_group_self_member_info",GET_GROUP_MEMBER_INFO:"get_specified_group_member_info",GET_GROUP_MEMBER_LIST:"get_group_member_info",GET_AVCHATROOM_MEMBER_LIST:"get_members",MARK_AVCHATROOM_MEMBER_INFO:"modify_user_info",QUIT_GROUP:"quit_group",CHANGE_GROUP_OWNER:"change_group_owner",DESTROY_GROUP:"destroy_group",ADD_GROUP_MEMBER:"add_group_member",DELETE_GROUP_MEMBER:"delete_group_member",BAN_AVCHATROOM_MEMBER:"ban_group_member",SEARCH_GROUP_BY_ID:"get_group_public_info",APPLY_JOIN_GROUP:"apply_join_group",HANDLE_APPLY_JOIN_GROUP:"handle_apply_join_group",HANDLE_INVITE_JOIN_GROUP:"handle_invite_join_permission_group",HANDLE_GROUP_INVITATION:"handle_invite_join_group",MODIFY_GROUP_INFO:"modify_group_base_info",MODIFY_GROUP_MEMBER_INFO:"modify_group_member_info",DELETE_GROUP_SYSTEM_MESSAGE:"deletemsg",DELETE_GROUP_AT_TIPS:"deletemsg",GET_GROUP_NOTIFY:"get_group_notify",GET_CONVERSATION_LIST:"get",PAGING_GET_CONVERSATION_LIST:"page_get",DELETE_CONVERSATION:"batch_delete",CLEAR_HISTORY_MESSAGE:"clear_msg",PIN_CONVERSATION:"top",MARK_CONVERSATION:"mark_contact",CREATE_CONVERSATION_GROUP:"create_contact_group",DELETE_CONVERSATION_GROUP:"del_contact_group",UPDATE_CONVERSATION_GROUP:"update_contact_group",GET_CONVERSATION_GROUP_LIST:"get_contact_group",GET_MESSAGES:"getmsg",GET_C2C_ROAM_MESSAGES:"getroammsg",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_GROUP_ROAM_MESSAGES:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",SET_C2C_MESSAGE_READ:"msgreaded",GET_PEER_READ_TIME:"get_peer_read_time",SET_GROUP_MESSAGE_READ:"msg_read_report",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",VIDEO_COVER:"video_cover",TIM_WEB_REPORT_V2:"tim_web_report_v2",BIG_DATA_HALLWAY_AUTH_KEY:"authkey",GET_ONLINE_MEMBER_NUM:"get_online_member_num",ALIVE:"alive",MESSAGE_PUSH:"msg_push",MULTI_MESSAGE_PUSH:"multi_msg_push_ws",MESSAGE_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",DOWNLOAD_MERGER_MESSAGE:"get_relay_json_msg",UPLOAD_MERGER_MESSAGE:"save_relay_json_msg",FETCH_CLOUD_CONTROL_CONFIG:"fetch_config",PUSHED_CLOUD_CONTROL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",KICK_OTHER:"KickOther",OVERLOAD_NOTIFY:"notify2",SET_ALL_MESSAGE_READ:"read_all_unread_msg",CREATE_TOPIC:"create_topic",DELETE_TOPIC:"destroy_topic",UPDATE_TOPIC_PROFILE:"modify_topic",GET_TOPIC_LIST:"get_topic",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUBSCRIBE_USER_STATUS:"ws_status_subscribe",UNSUBSCRIBE_USER_STATUS:"ws_status_unsubscribe",GET_RPOFANITY_LIST:"get_local_words",TRANSLATE_TEXT:"ws_batch_trans_text",UPDATE_GROUP_COUNTER:"update_group_counter",GET_GROUP_COUNTER:"get_group_counter"}},ye={SEARCH_MSG:new Ne(0,Math.pow(2,0)).toString(),SEARCH_GRP_SNS:new Ne(0,Math.pow(2,1)).toString(),AVCHATROOM_HISTORY_MSG:new Ne(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new Ne(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new Ne(0,Math.pow(2,4)).toString(),AVCHATROOM_MBR_LIST:new Ne(0,Math.pow(2,6)).toString(),USER_STATUS:new Ne(0,Math.pow(2,7)).toString(),CONV_MARK:new Ne(0,Math.pow(2,9)).toString(),CONV_GROUP:new Ne(0,Math.pow(2,10)).toString(),AVCHATROOM_BAN_MBR:new Ne(0,Math.pow(2,11)).toString(),MSG_EXT:new Ne(0,Math.pow(2,13)).toString(),GRP_COUNTER:new Ne(0,Math.pow(2,15)).toString()},ii="c2c_text_message",ui="c2c_custom_message",ci="group_text_message",li="group_custom_message",di="user_profile",Jo="group_profile",pi="group_member_profile";I.HOST.setCurrent(Fn);var rt=typeof wx<"u"&&typeof wx.getSystemInfoSync=="function"&&!!wx.getSystemInfoSync().fontSizeSetting,gi=rt&&typeof wx.createGamePortal=="function",yt=typeof qq<"u"&&typeof qq.getSystemInfoSync=="function"&&!!qq.getSystemInfoSync().fontSizeSetting,qt=typeof tt<"u"&&typeof tt.getSystemInfoSync=="function"&&!!tt.getSystemInfoSync().fontSizeSetting,ln=typeof swan<"u"&&typeof swan.getSystemInfoSync=="function"&&!!swan.getSystemInfoSync().fontSizeSetting,Ye=typeof my<"u"&&typeof my.getSystemInfoSync=="function"&&!!my.getSystemInfoSync().fontSizeSetting,Xo=typeof jd<"u"&&typeof jd.getSystemInfoSync=="function",je=typeof uni<"u"&&typeof window>"u"&&typeof uni.requireNativePlugin=="function",Zo=typeof uni<"u",Z=rt||yt||qt||ln||Ye||je||Xo,ke=(typeof uni<"u"||typeof window<"u")&&!Z,Q=yt?qq:qt?tt:ln?swan:Ye?my:rt?wx:je?uni:Xo?jd:{},Se=ke&&window&&window.navigator&&window.navigator.userAgent||"",hi=/(micromessenger|webbrowser)/i.test(Se),Qo=/AppleWebKit\/([\d.]+)/i.exec(Se);Qo&&parseFloat(Qo.pop());var it,qn,_i=(it="WEB",hi?it="WEB":yt?it="QQ_MP":qt?it="TT_MP":ln?it="BAIDU_MP":Ye?it="ALI_MP":rt?it="WX_MP":je&&(it="UNI_NATIVE_APP"),at[it]),$o=/iPad/i.test(Se),fi=/iPhone/i.test(Se)&&!$o,mi=/iPod/i.test(Se),es=fi||$o||mi,vi=(qn=Se.match(/OS (\d+)_/i))&&qn[1]?qn[1]:null,ts=/Android/i.test(Se),Mi=function(){var c=Se.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!c)return null;var t=c[1]&&parseFloat(c[1]),s=c[2]&&parseFloat(c[2]);return t&&s?parseFloat(c[1]+"."+c[2]):t||null}();(function(){var c=Se.match(/Chrome\/(\d+)/);c&&c[1]&&parseFloat(c[1])})();var xn=/MSIE/.test(Se)||Se.indexOf("Trident")>-1&&Se.indexOf("rv:11.0")>-1,yi=function(){var c=/MSIE\s(\d+)\.\d/.exec(Se),t=c&&parseFloat(c[1]);return!t&&/Trident\/7.0/i.test(Se)&&/rv:11.0/.test(Se)&&(t=11),t}();(function(){var c=Se.match(/TBS\/(\d+)/i);c&&c[1]&&c[1]})();var Vn,Bn,Ii=/Windows/i.test(Se),Ci=/MAC OS X/i.test(Se),St=ke&&typeof Worker<"u"&&!xn,ns=ts||es,os=ke&&window.tencent_cloud_im_csig_flutter_for_web_25F_cy!==void 0;Vn=typeof console<"u"?console:typeof Vo<"u"&&Vo.console?Vo.console:typeof window<"u"&&window.console?window.console:{};for(var Ti=function(){},ss=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],as=ss.length;as--;)Bn=ss[as],console[Bn]||(Vn[Bn]=Ti);var rs=Vn,xt=0,ut=function(){return new Date().getTime()+xt},is=function(){xt=0},Hn=function(){return Math.floor(ut()/1e3)},ct=0;function us(){return zn()?"%c TIM %c":"TIM"}function cs(){var c,t=((c=new Date).setTime(ut()),c);return t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(s){var e;switch(s.toString().length){case 1:e="00"+s;break;case 2:e="0"+s;break;default:e=s}return e}(t.getMilliseconds())}var h={arguments2String:function(c){var t="";if(c.length===1)t=c[0];else for(var s=0,e=c.length;s<e;s++)Vt(c[s])?Li(c[s])?t+=hs(c[s]):t+=JSON.stringify(c[s]):t+=c[s],t+=" ";return t},_exec:function(c,t){zn()?rs[c](us(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",cs(),t):rs[c]("".concat(us()," ").concat(cs()," ").concat(t))},d:function(){if(ct<=-1){var c=this.arguments2String(arguments);this._exec("debug",c)}},l:function(){if(ct<=0){var c=this.arguments2String(arguments);this._exec("log",c)}},log:function(){if(ct<=0){var c=this.arguments2String(arguments);this._exec("log",c)}},i:function(){if(ct<=1){var c=this.arguments2String(arguments);this._exec("info",c)}},w:function(){if(ct<=2){var c=this.arguments2String(arguments);this._exec("warn",c)}},e:function(){if(ct<=3){var c=this.arguments2String(arguments);this._exec("error",c)}},setLevel:function(c){c<4&&this._exec("log","set level from "+ct+" to "+c),ct=c},getLevel:function(){return ct}},dn={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},_e={NICK:"Tag_Profile_IM_Nick",GENDER:"Tag_Profile_IM_Gender",BIRTHDAY:"Tag_Profile_IM_BirthDay",LOCATION:"Tag_Profile_IM_Location",SELFSIGNATURE:"Tag_Profile_IM_SelfSignature",ALLOWTYPE:"Tag_Profile_IM_AllowType",LANGUAGE:"Tag_Profile_IM_Language",AVATAR:"Tag_Profile_IM_Image",MESSAGESETTINGS:"Tag_Profile_IM_MsgSettings",ADMINFORBIDTYPE:"Tag_Profile_IM_AdminForbidType",LEVEL:"Tag_Profile_IM_Level",ROLE:"Tag_Profile_IM_Role"},Di={UNKNOWN:"Gender_Type_Unknown",FEMALE:"Gender_Type_Female",MALE:"Gender_Type_Male"},ki={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},Si={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},Et="JoinedSuccess",ls="WaitAdminApproval",ds="@TGS#_",Kn="@TOPIC#_",Ei=["url"],ps=function(c){return Lt(c)==="map"},Qe=function(c){return Lt(c)==="file"},ee=function(c){return c!==null&&(typeof c=="number"&&!isNaN(c-0)||_t(c)==="object"&&c.constructor===Number)},z=function(c){return typeof c=="string"},lt=function(c){return c!==null&&_t(c)==="object"},ne=function(c){if(_t(c)!=="object"||c===null)return!1;var t=Object.getPrototypeOf(c);if(t===null)return!0;for(var s=t;Object.getPrototypeOf(s)!==null;)s=Object.getPrototypeOf(s);return t===s},b=function(c){return typeof Array.isArray=="function"?Array.isArray(c):Lt(c)==="array"},S=function(c){return c===void 0},Vt=function(c){return b(c)||lt(c)},qe=function(c){return typeof c=="function"},Li=function(c){return c instanceof Error},Lt=function(c){return Object.prototype.toString.call(c).match(/^\[object (.*)\]$/)[1].toLowerCase()},gs=function(c){if(typeof c!="string")return!1;var t=c[0];return!/[^a-zA-Z0-9]/.test(t)};Date.now||(Date.now=function(){return new Date().getTime()});var $e=function c(t,s,e,n){if(!Vt(t)||!Vt(s))return 0;for(var o,a=0,r=Object.keys(s),i=0,u=r.length;i<u;i++)if(o=r[i],!(S(s[o])||e&&e.includes(o)))if(Vt(t[o])&&Vt(s[o]))a+=c(t[o],s[o],e,n);else{if(n&&n.includes(s[o]))continue;t[o]!==s[o]&&(t[o]=s[o],a+=1)}return a},hs=function(c){return JSON.stringify(c,["message","code"])},_s=function(c){if(c.length===0)return 0;for(var t=0,s=0,e=typeof document<"u"&&document.characterSet!==void 0?document.characterSet:"UTF-8";c[t]!==void 0;)s+=c[t++].charCodeAt[t]<=255?1:e===!1?3:2;return s},He=function(c){var t=c||99999999;return Math.round(Math.random()*t)},fs="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",Ai=fs.length,Wn=function(c,t){for(var s in c)if(c[s]===t)return!0;return!1},pn={},gn=function(c){return c.indexOf("http://")===-1||c.indexOf("https://")===-1?"https://"+c:c.replace(/https|http/,"https")},ms=function c(t){if(Object.getOwnPropertyNames(t).length===0)return Object.create(null);var s=Array.isArray(t)?[]:Object.create(null),e="";for(var n in t)t[n]!==null?t[n]!==void 0?(e=_t(t[n]),["string","number","function","boolean"].indexOf(e)>=0?s[n]=t[n]:s[n]=c(t[n])):s[n]=void 0:s[n]=null;return s};function hn(c,t){if(!b(c)||!b(t))return!1;var s=!1;return t.forEach(function(e){var n=e.key,o=e.value,a=c.find(function(r){return r.key===n});a?a.value!==o&&(a.value=o,s=!0):(c.push({key:n,value:o}),s=!0)}),s}var xe=function(c){return c===f.GRP_AVCHATROOM},Oe=function(c){var t=c.type,s=c.groupID;return t===f.GRP_COMMUNITY||"".concat(s).startsWith(ds)&&!"".concat(s).includes(Kn)},Le=function(c){return"".concat(c).startsWith(ds)&&"".concat(c).includes(Kn)},Pe=function(c){return z(c)&&c.slice(0,3)===f.CONV_C2C},Ae=function(c){return z(c)&&c.slice(0,5)===f.CONV_GROUP},_n=function(c){return z(c)&&c===f.CONV_SYSTEM};function vs(c,t){var s={};return Object.keys(c).forEach(function(e){s[e]=t(c[e],e)}),s}function Bt(c){return Z?new Promise(function(t,s){Q.getImageInfo({src:c,success:function(e){t({width:e.width,height:e.height})},fail:function(){t({width:0,height:0})}})}):xn&&yi===9?Promise.resolve({width:0,height:0}):new Promise(function(t,s){var e=new Image;e.onload=function(){t({width:this.width,height:this.height}),e=null},e.onerror=function(){t({width:0,height:0}),e=null},e.src=c})}function Ms(){function c(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return"".concat(c()+c()).concat(c()).concat(c()).concat(c()).concat(c()).concat(c()).concat(c())}function ys(){var c="unknown";if(Ci&&(c="mac"),Ii&&(c="windows"),es&&(c="ios"),ts&&(c="android"),Z)try{var t=Q.getSystemInfoSync().platform;t!==void 0&&(c=t)}catch{}return c}function Is(c,t){c=c.split("."),t=t.split(".");for(var s=Math.max(c.length,t.length);c.length<s;)c.push("0");for(;t.length<s;)t.push("0");for(var e=0;e<s;e++){var n=parseInt(c[e]),o=parseInt(t[e]);if(n>o)return 1;if(n<o)return-1}return 0}function Yn(c){var t=c.originUrl,s=t===void 0?void 0:t,e=c.originWidth,n=c.originHeight,o=c.min,a=o===void 0?198:o,r=parseInt(e),i=parseInt(n),u={url:void 0,width:0,height:0};if((r<=i?r:i)<=a)u.url=s,u.width=r,u.height=i;else{i<=r?(u.width=Math.ceil(r*a/i),u.height=a):(u.width=a,u.height=Math.ceil(i*a/r));var l=s&&s.indexOf("?")>-1?"".concat(s,"&"):"".concat(s,"?");u.url="".concat(l,a===198?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")}return S(s)?(u.url,ft(u,Ei)):u}function Cs(c){var t=c[2];c[2]=c[1],c[1]=t;for(var s=0;s<c.length;s++)c[s].setType(s)}function jn(c){var t=c.servcmd;return t.slice(t.indexOf(".")+1)}function et(c,t){return Math.round(Number(c)*Math.pow(10,t))/Math.pow(10,t)}function Ts(c,t){return c.includes(t)}function Ds(c,t){return c.includes(t)}function Ie(c){return c.split(Kn)[0]}var Ht=function(c,t,s){if(S(t))return"";switch(c){case f.MSG_TEXT:return t.text;case f.MSG_IMAGE:return s?"[Image]":"[图片]";case f.MSG_LOCATION:return s?"[Location]":"[位置]";case f.MSG_AUDIO:return s?"[Voice]":"[语音]";case f.MSG_VIDEO:return s?"[Video]":"[视频]";case f.MSG_FILE:return s?"[File]":"[文件]";case f.MSG_CUSTOM:return s?"[Custom Messages]":"[自定义消息]";case f.MSG_GRP_TIP:return s?"[Group Notification]":"[群提示消息]";case f.MSG_GRP_SYS_NOTICE:return s?"[Group System Message]":"[群系统通知]";case f.MSG_FACE:return s?"[Animated Sticker]":"[动画表情]";case f.MSG_MERGER:return s?"[Chat Record]":"[聊天记录]";default:return""}};function ks(c){return c===f.MSG_TEXT||c===f.MSG_CUSTOM||c===f.MSG_LOCATION||c===f.MSG_FACE}function fn(c){var t=[];if(!z(c))return t;var s=c.length;if(s===0)return t;for(var e=s-1;e>=0;e--)c[e]==="1"&&t.push(Math.pow(2,s-e-1));return t}function zn(){return!xn&&!Z}function Kt(c){return"the length of userIDList cannot exceed ".concat(c)}function ze(c,t){if(c){var s=c;return t&&(c.startsWith("http://")?s=c.replace(/^http:\/\/[^/]+/,t):c.startsWith("https://")&&(s=c.replace(/^https:\/\/[^/]+/,t))),s}}var Ri=Object.prototype.hasOwnProperty;function R(c){if(c==null)return!0;if(typeof c=="boolean")return!1;if(typeof c=="number")return c===0;if(typeof c=="string"||typeof c=="function"||Array.isArray(c))return c.length===0;if(c instanceof Error)return c.message==="";if(ne(c)){for(var t in c)if(Ri.call(c,t))return!1;return!0}return!(!ps(c)&&(s=c,Lt(s)!=="set")&&!Qe(c))&&c.size===0;var s}function Ni(c,t,s){if(t===void 0)return!0;var e=!0;if(ne(t))Object.keys(t).forEach(function(o){var a=c.length===1?c[0][o]:void 0;e=!!Ss(a,t[o],s,o)&&e});else if(b(t))for(var n=0;n<t.length;n++)e=!!Ss(c[n],t[n],s,t[n].name)&&e;if(e)return e;throw new Error("Params validate failed.")}function Ss(c,t,s,e){if(t===void 0)return!0;var n=!0;if(t.required&&R(c)&&(h.e("[".concat(s,'] Missing required params: "').concat(e,'".')),n=!1),!R(c)){var o=Lt(c),a=t.type.toLowerCase();o!==a&&(o==="asyncfunction"&&a==="function"||(h.e("[".concat(s,'] Invalid params: type check failed for "').concat(e,'".Expected ').concat(t.type,".")),n=!1))}return t.validator&&!t.validator(c)&&(h.e("[".concat(s,"] Invalid params: custom validator check failed for params.")),n=!1),n}var Je,Ge={UNSEND:"unSend",SUCCESS:"success",FAIL:"fail"},we={NOT_START:"notStart",PENDING:"pending",RESOLVED:"resolved",REJECTED:"rejected"},At=function(c){if(!c)return!1;if(Pe(c)||Ae(c)||_n(c))return!0;var t=te("InvalidConversationID",c);return t&&h.w(t),!1},G=function(c){c.desc!==""&&te("API_REFER")!==""&&h.w("[".concat(c.api,"] | ").concat(c.param," | ").concat(c.desc,", ").concat(te("API_REFER")).concat(c.api))},nt=function(){return te("StringRequiredLog")},mn=function(c){return te("NonEmptyStringRequiredLog",c)},Wt=function(){return te("NumberRequiredLog")},Jn=function(){return te("UndefinedNotAllowedLog")},Xn=function(){return te("FileRequiredLog")},Zn=function(){return te("FunctionRequiredLog")},Ve=function(){return te("ArrayRequiredLog")},It=function(){return te("NonEmptyArrayLog")},vn=function(){return te("CallbackMissingLog")},Es=function(){return te("PositiveIntegerRequiredLog")},Ct=function(c,t){return te("StringNotLongerThanLog",c,t)},Oi=function(c,t){return te("NumberLessThanLog",c,t)},Mn=function(c){return te("KeyValueStringRequiredLog",c)},dt=function(){return te("PlainObjectRequiredLog")},Ls=function(){return te("NonEmptyContentRequiredLog")},Rt=function(){return te("FileNotSelectedLog")},As=function(){return te("MessageInstanceRequiredLog")},Qn=function(){return te("NonAnonymousFunctionLog")},$n=function(){return te("MessageExtensionNotAvailableLog")},w={type:"String",required:!0},Ce={type:"Array",required:!0},Te={type:"Object",required:!0},eo={type:"Boolean",required:!0},Rs={type:"number",required:!0},te=null,Ns={hookGetAPITips:function(c){te=c},login:{userID:w,userSig:w},addToBlacklist:{userIDList:Ce},removeFromBlacklist:{userIDList:Ce},on:[{name:"eventName",type:"String",validator:function(c){return typeof c=="string"&&c.length!==0||(G({api:"on",param:"eventName",desc:mn("eventName")}),!1)}},{name:"handler",type:"Function",validator:function(c){return typeof c!="function"?(G({api:"on",param:"handler",desc:Zn()}),!1):(c.name===""&&G({api:"on",param:"handler",desc:Qn()}),!0)}}],once:[{name:"eventName",type:"String",validator:function(c){return typeof c=="string"&&c.length!==0||(G({api:"once",param:"eventName",desc:mn("eventName")}),!1)}},{name:"handler",type:"Function",validator:function(c){return typeof c!="function"?(G({api:"once",param:"handler",desc:Zn()}),!1):(c.name===""&&G({api:"once",param:"handler",desc:Qn()}),!0)}}],off:[{name:"eventName",type:"String",validator:function(c){return typeof c=="string"&&c.length!==0||(G({api:"off",param:"eventName",desc:mn("eventName")}),!1)}},{name:"handler",type:"Function",validator:function(c){return typeof c!="function"?(G({api:"off",param:"handler",desc:Zn()}),!1):(c.name===""&&G({api:"off",param:"handler",desc:Qn()}),!0)}}],sendMessage:[m({name:"message"},Te)],setMessageExtensions:[m(m({name:"message"},Te),{},{validator:function(c){return c.status===Ge.SUCCESS&&c.isSupportExtension===!0||(G({api:"setMessageExtensions",param:"message",desc:$n()}),!1)}}),m({name:"extensions"},Ce)],getMessageExtensions:[m(m({name:"message"},Te),{},{validator:function(c){return c.status===Ge.SUCCESS&&c.isSupportExtension===!0||(G({api:"getMessageExtensions",param:"message",desc:$n()}),!1)}})],deleteMessageExtensions:[m(m({name:"message"},Te),{},{validator:function(c){return c.status===Ge.SUCCESS&&c.isSupportExtension===!0||(G({api:"deleteMessageExtensions",param:"message",desc:$n()}),!1)}})],getMessageList:{conversationID:m(m({},w),{},{validator:function(c){return At(c)}}),nextReqMessageID:{type:"String"},count:{type:"Number",validator:function(c){return!(!S(c)&&!/^[1-9][0-9]*$/.test(c))||(G({api:"getMessageList",param:"count",desc:Es()}),!1)}}},getMessageListHopping:{conversationID:m(m({},w),{},{validator:function(c){return At(c)}}),sequence:{type:"Number"},time:{type:"Number"},direction:{type:"Number",validator:function(c){return!(!S(c)&&c!==0&&c!==1)||(G({api:"getMessageListHopping",param:"direction",desc:te("0Or1RequiredLog")}),!1)}},count:{type:"Number",validator:function(c){return!(!S(c)&&!/^[1-9][0-9]*$/.test(c))||(G({api:"getMessageListHopping",param:"count",desc:Es}),!1)}}},setMessageRead:{conversationID:m(m({},w),{},{validator:function(c){return At(c)}})},setAllMessageRead:{scope:{type:"String",required:!1,validator:function(c){return!c||[f.READ_ALL_C2C_MSG,f.READ_ALL_GROUP_MSG,f.READ_ALL_MSG].indexOf(c)!==-1||(G({api:"setAllMessageRead",param:"scope",desc:"TIM.TYPES.READ_ALL_C2C_MSG or TIM.TYPES.READ_ALL_GROUP_MSG or TIM.TYPES.READ_ALL_MSG required"}),!1)}}},getConversationProfile:[m(m({name:"conversationID"},w),{},{validator:function(c){return At(c)}})],clearHistoryMessage:[m(m({name:"conversationID"},w),{},{validator:function(c){return At(c)}})],pinConversation:{conversationID:m(m({},w),{},{validator:function(c){return At(c)}}),isPinned:m({},eo)},setConversationCustomData:{conversationIDList:m({},Ce),customData:{type:"String",validator:function(c){return z(c)?!(c.length>256)||(G({api:"setConversationCustomData",param:"customData",desc:Ct("customData",256)}),!1):(G({api:"setConversationCustomData",param:"customData",desc:nt()}),!1)}}},markConversation:{conversationIDList:m({},Ce),markType:{type:"number",validator:function(c){return ee(c)?c<=0?(G({api:"markConversation",param:"markType",desc:(t="markType",s=0,te("NumberGreaterThanLog",t,s))}),!1):!(c>=Math.pow(2,64))||(G({api:"markConversation",param:"markType",desc:Oi("markType","Math.pow(2,64)")}),!1):(G({api:"markConversation",param:"markType",desc:Wt()}),!1);var t,s}},enableMark:m({},eo)},createConversationGroup:{conversationIDList:m({},Ce),groupName:m(m({},w),{},{validator:function(c){return!!c&&(!(c.length>32)||(G({api:"createConversationGroup",param:"groupName",desc:Ct("groupName",32)}),!1))}})},deleteConversationGroup:[m({name:"groupName"},w)],renameConversationGroup:{oldName:m({},w),newName:m(m({},w),{},{validator:function(c){return!!c&&(!(c.length>32)||(G({api:"renameConversationGroup",param:"newName",desc:Ct("newName",32)}),!1))}})},addConversationsToGroup:{conversationIDList:m({},Ce),groupName:m({},w)},deleteConversationsFromGroup:{conversationIDList:m({},Ce),groupName:m({},w)},getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:w,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:Ce},createGroup:{name:w},joinGroup:{groupID:w,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[m({name:"groupID"},w)],handleApplication:{message:Te,handleAction:w,handleMessage:{type:"String"}},changeGroupOwner:{groupID:w,newOwnerID:w},updateGroupProfile:{groupID:w,muteAllMembers:{type:"Boolean"}},dismissGroup:[m({name:"groupID"},w)],searchGroupByID:[m({name:"groupID"},w)],initGroupAttributes:{groupID:w,groupAttributes:m(m({},Te),{},{validator:function(c){var t=!0;return Object.keys(c).forEach(function(s){if(!z(c[s]))return G({api:"initGroupAttributes",param:"groupAttributes",desc:Mn("value")}),t=!1}),t}})},setGroupAttributes:{groupID:w,groupAttributes:m(m({},Te),{},{validator:function(c){var t=!0;return Object.keys(c).forEach(function(s){if(!z(c[s]))return G({api:"setGroupAttributes",param:"groupAttributes",desc:Mn("value")}),t=!1}),t}})},deleteGroupAttributes:{groupID:w,keyList:{type:"Array",validator:function(c){if(S(c)||!b(c))return G({api:"deleteGroupAttributes",param:"keyList",desc:Ve()}),!1;if(!R(c)){var t=!0;return c.forEach(function(s){if(!z(s))return G({api:"deleteGroupAttributes",param:"keyList",desc:te("StringArrayRequiredLog")}),t=!1}),t}return!0}}},getGroupAttributes:{groupID:w,keyList:{type:"Array",validator:function(c){if(S(c)||!b(c))return G({api:"getGroupAttributes",param:"keyList",desc:Ve()}),!1;if(!R(c)){var t=!0;return c.forEach(function(s){if(!z(s))return G({api:"getGroupAttributes",param:"keyList",desc:Mn("key")}),t=!1}),t}return!0}}},setGroupCounters:{groupID:w,counters:Te},increaseGroupCounter:{groupID:w,key:w,value:Rs},decreaseGroupCounter:{groupID:w,key:w,value:Rs},getGroupCounters:{groupID:w},getGroupMemberList:{groupID:w,count:{type:"Number"}},getGroupMemberProfile:{groupID:w,userIDList:Ce,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:w,userIDList:Ce},setGroupMemberRole:{groupID:w,userID:w,role:w},setGroupMemberMuteTime:{groupID:w,userID:w,muteTime:{type:"Number",validator:function(c){return c>=0}}},setGroupMemberNameCard:{groupID:w,userID:{type:"String"},nameCard:{type:"String",validator:function(c){return z(c)?(c.length,!0):(G({api:"setGroupMemberNameCard",param:"nameCard",desc:nt()}),!1)}}},setGroupMemberCustomField:{groupID:w,userID:{type:"String"},memberCustomField:Ce},deleteGroupMember:{groupID:w},markGroupMemberList:{groupID:w,markType:{type:"number",validator:function(c){return ee(c)?!(c<1e3)||(G({api:"markGroupMemberList",param:"markType",desc:(t="markType",s=1e3,te("NumberGreaterOrEqualLog",t,s))}),!1):(G({api:"markGroupMemberList",param:"markType",desc:Wt()}),!1);var t,s}},userIDList:m({},Ce),enableMark:m({},eo)},createTextMessage:{to:w,conversationType:w,payload:m(m({},Te),{},{validator:function(c){return ne(c)?z(c.text)?c.text.length!==0||(G({api:"createTextMessage",param:"payload.text",desc:Ls()}),!1):(G({api:"createTextMessage",param:"payload.text",desc:nt()}),!1):(G({api:"createTextMessage",param:"payload",desc:dt()}),!1)}})},createTextAtMessage:{to:w,conversationType:w,payload:m(m({},Te),{},{validator:function(c){return ne(c)?z(c.text)?c.text.length===0?(G({api:"createTextAtMessage",param:"payload.text",desc:Ls()}),!1):!(c.atUserList&&!b(c.atUserList))||(G({api:"createTextAtMessage",param:"payload.atUserList",desc:Ve()}),!1):(G({api:"createTextAtMessage",param:"payload.text",desc:nt()}),!1):(G({api:"createTextAtMessage",param:"payload",desc:dt()}),!1)}})},createCustomMessage:{to:w,conversationType:w,payload:m(m({},Te),{},{validator:function(c){return ne(c)?c.data&&!z(c.data)?(G({api:"createCustomMessage",param:"payload.data",desc:nt()}),!1):c.description&&!z(c.description)?(G({api:"createCustomMessage",param:"payload.description",desc:nt()}),!1):!(c.extension&&!z(c.extension))||(G({api:"createCustomMessage",param:"payload.extension",desc:nt()}),!1):(G({api:"createCustomMessage",param:"payload",desc:dt()}),!1)}})},createImageMessage:{to:w,conversationType:w,payload:m(m({},Te),{},{validator:function(c){if(!ne(c))return G({api:"createImageMessage",param:"payload",desc:dt()}),!1;if(S(c.file))return G({api:"createImageMessage",param:"payload.file",desc:Jn()}),!1;if(ke){if(!(c.file instanceof HTMLInputElement||Qe(c.file)))return ne(c.file)&&typeof uni<"u"?c.file.tempFilePaths.length!==0&&c.file.tempFiles.length!==0||(G({api:"createImageMessage",param:"payload.file",desc:Rt()}),!1):(G({api:"createImageMessage",param:"payload.file",desc:Xn()}),!1);if(c.file instanceof HTMLInputElement&&c.file.files.length===0)return G({api:"createImageMessage",param:"payload.file",desc:Rt()}),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(c){return S(c)&&G({api:"createImageMessage",param:"onProgress",desc:vn()}),!0}}})},createAudioMessage:{to:w,conversationType:w,payload:m(m({},Te),{},{validator:function(c){return!!ne(c)||(G({api:"createAudioMessage",param:"payload",desc:dt()}),!1)}}),onProgress:{type:"Function",required:!1,validator:function(c){return S(c)&&G({api:"createAudioMessage",param:"onProgress",desc:vn()}),!0}}},createVideoMessage:{to:w,conversationType:w,payload:m(m({},Te),{},{validator:function(c){if(!ne(c))return G({api:"createVideoMessage",param:"payload",desc:dt()}),!1;if(S(c.file))return G({api:"createVideoMessage",param:"payload.file",desc:Jn()}),!1;if(ke){if(!(c.file instanceof HTMLInputElement||Qe(c.file)))return ne(c.file)&&typeof uni<"u"?!!Qe(c.file.tempFile)||(G({api:"createVideoMessage",param:"payload.file",desc:Rt()}),!1):(G({api:"createVideoMessage",param:"payload.file",desc:Xn()}),!1);if(c.file instanceof HTMLInputElement&&c.file.files.length===0)return G({api:"createVideoMessage",param:"payload.file",desc:Rt()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(c){return S(c)&&G({api:"createVideoMessage",param:"onProgress",desc:vn()}),!0}}},createFaceMessage:{to:w,conversationType:w,payload:m(m({},Te),{},{validator:function(c){return ne(c)?ee(c.index)?!!z(c.data)||(G({api:"createFaceMessage",param:"payload.data",desc:nt()}),!1):(G({api:"createFaceMessage",param:"payload.index",desc:Wt()}),!1):(G({api:"createFaceMessage",param:"payload",desc:dt()}),!1)}})},createFileMessage:{to:w,conversationType:w,payload:m(m({},Te),{},{validator:function(c){if(!ne(c))return G({api:"createFileMessage",param:"payload",desc:dt()}),!1;if(S(c.file))return G({api:"createFileMessage",param:"payload.file",desc:Jn()}),!1;if(ke){if(!(c.file instanceof HTMLInputElement||Qe(c.file)))return ne(c.file)&&typeof uni<"u"?c.file.tempFilePaths.length!==0&&c.file.tempFiles.length!==0||(G({api:"createFileMessage",param:"payload.file",desc:Rt()}),!1):(G({api:"createFileMessage",param:"payload.file",desc:Xn()}),!1);if(c.file instanceof HTMLInputElement&&c.file.files.length===0)return G({api:"createFileMessage",param:"payload.file",desc:Rt()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(c){return S(c)&&G({api:"createFileMessage",param:"onProgress",desc:vn()}),!0}}},createLocationMessage:{to:w,conversationType:w,payload:m(m({},Te),{},{validator:function(c){return ne(c)?z(c.description)?ee(c.longitude)?!!ee(c.latitude)||(G({api:"createLocationMessage",param:"payload.latitude",desc:Wt()}),!1):(G({api:"createLocationMessage",param:"payload.longitude",desc:Wt()}),!1):(G({api:"createLocationMessage",param:"payload.description",desc:nt()}),!1):(G({api:"createLocationMessage",param:"payload",desc:dt()}),!1)}})},createMergerMessage:{to:w,conversationType:w,payload:m(m({},Te),{},{validator:function(c){if(R(c.messageList))return G({api:"createMergerMessage",param:"payload.messageList",desc:It()}),!1;if(R(c.compatibleText))return G({api:"createMergerMessage",param:"payload.compatibleText",desc:mn("compatibleText")}),!1;var t=!1;return c.messageList.forEach(function(s){s.status===Ge.FAIL&&(t=!0)}),!t||(G({api:"createMergerMessage",param:"payload.messageList",desc:te("MergeFailedMessageLog")}),!1)}})},revokeMessage:[m(m({name:"message"},Te),{},{validator:function(c){return R(c)?(G({api:"revokeMessage",param:"message",desc:As()}),!1):c.conversationType===f.CONV_SYSTEM?(G({api:"revokeMessage",param:"message",desc:te("MessageCanBeRevokedDesc")}),!1):c.isRevoked!==!0||(G({api:"revokeMessage",param:"message",desc:te("MessageRevokedLog")}),!1)}})],deleteMessage:[m(m({name:"messageList"},Ce),{},{validator:function(c){return!R(c)||(G({api:"deleteMessage",param:"messageList",desc:It()}),!1)}})],translateText:{sourceTextList:Ce,sourceLanguage:w,targetLanguage:w},modifyMessage:[m(m({name:"message"},Te),{},{validator:function(c){return R(c)?(G({api:"modifyMessage",param:"message",desc:As()}),!1):c.conversationType===f.CONV_SYSTEM?(G({api:"modifyMessage",param:"message",desc:te("MessageCanBeModifiedLog")}),!1):c._onlineOnlyFlag!==!0||(G({api:"modifyMessage",param:"message",desc:te("OnlineMessageNotSupportLog")}),!1)}})],getUserProfile:{userIDList:{type:"Array",validator:function(c){return b(c)?(c.length===0&&G({api:"getUserProfile",param:"userIDList",desc:It()}),!0):(G({api:"getUserProfile",param:"userIDList",desc:Ve()}),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(c){return!!S(c)||!!b(c)||(G({api:"updateMyProfile",param:"profileCustomField",desc:Ve()}),!1)}}},setSelfStatus:{customStatus:{type:"String",validator:function(c){return!!z(c)||(G({api:"setSelfStatus",param:"customStatus",desc:nt()}),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(c){return b(c)?c.length!==0||(G({api:"getUserStatus",param:"userIDList",desc:It()}),!1):(G({api:"getUserStatus",param:"userIDList",desc:Ve()}),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(c){return b(c)?c.length!==0||(G({api:"subscribeUserStatus",param:"userIDList",desc:It()}),!1):(G({api:"subscribeUserStatus",param:"userIDList",desc:Ve()}),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(c){return!c||!!b(c)||(G({api:"subscribeUserStatus",param:"userIDList",desc:Ve()}),!1)}}},addFriend:{to:w,source:{type:"String",required:!0,validator:function(c){return!!c&&(c.startsWith("AddSource_Type_")?!(c.replace("AddSource_Type_","").length>8)||(G({api:"addFriend",param:"source",desc:Ct("keyword",8)}),!1):(G({api:"addFriend",param:"source",desc:te("SourcePrefixLog")}),!1))}},remark:{type:"String",required:!1,validator:function(c){return!(z(c)&&c.length>96)||(G({api:"addFriend",param:"remark",desc:Ct("remark",96)}),!1)}}},deleteFriend:{userIDList:Ce},checkFriend:{userIDList:Ce},getFriendProfile:{userIDList:Ce},updateFriend:{userID:w,remark:{type:"String",required:!1,validator:function(c){return!(z(c)&&c.length>96)||(G({api:"updateFriend",param:"remark",desc:Ct("remark",96)}),!1)}},friendCustomField:{type:"Array",required:!1,validator:function(c){if(c){if(!b(c))return G({api:"updateFriend",param:"friendCustomField",desc:Ve()}),!1;var t=!0;return c.forEach(function(s){return z(s.key)&&s.key.indexOf("Tag_SNS_Custom")!==-1?z(s.value)?s.key.replace("Tag_SNS_Custom_","").length>8?(G({api:"updateFriend",param:"friendCustomField",desc:Ct("keyword",8)}),t=!1):void 0:(G({api:"updateFriend",param:"friendCustomField",desc:Mn("value")}),t=!1):(G({api:"updateFriend",param:"friendCustomField",desc:te("FriendCustomFieldPrefixLog")}),t=!1)}),t}return!0}}},acceptFriendApplication:{userID:w},refuseFriendApplication:{userID:w},deleteFriendApplication:{userID:w},createFriendGroup:{name:w},deleteFriendGroup:{name:w},addToFriendGroup:{name:w,userIDList:Ce},removeFromFriendGroup:{name:w,userIDList:Ce},renameFriendGroup:{oldName:w,newName:w},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(c){return b(c)?c.length!==0||(G({api:"sendMessageReadReceipt",param:"messageList",desc:It()}),!1):(G({api:"sendMessageReadReceipt",param:"messageList",desc:Ve()}),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(c){return b(c)?c.length!==0||(G({api:"getMessageReadReceiptList",param:"messageList",desc:It()}),!1):(G({api:"getMessageReadReceiptList",param:"messageList",desc:Ve()}),!1)}}],createTopicInCommunity:{groupID:w,topicName:w},deleteTopicFromCommunity:{groupID:w,topicIDList:{type:"Array",validator:function(c){return!c||!!b(c)||(G({api:"deleteTopicFromCommunity",param:"topicIDList",desc:Ve()}),!1)}}},updateTopicProfile:{groupID:w,topicID:w},getTopicList:{groupID:w,topicIDList:{type:"Array",validator:function(c){return!c||!!b(c)||(G({api:"getTopicList",param:"topicIDList",desc:Ve()}),!1)}}}},Gi={login:1,logout:1,on:1,once:1,off:1,setLogLevel:1,registerPlugin:1,destroy:1,createTextMessage:1,createTextAtMessage:1,createImageMessage:1,createAudioMessage:1,createVideoMessage:1,createCustomMessage:1,createFaceMessage:1,createFileMessage:1,createLocationMessage:1,createMergerMessage:1,downloadMergerMessage:1,createForwardMessage:1,sendMessage:1,resendMessage:1,revokeMessage:1,deleteMessage:1,translateText:1,modifyMessage:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageReadReceiptList:1,setMessageExtensions:1,getMessageExtensions:1,deleteMessageExtensions:1,getMessageList:1,findMessage:1,getMessageListHopping:1,setMessageRead:1,setAllMessageRead:1,getConversationList:1,getConversationProfile:1,deleteConversation:1,pinConversation:1,getTotalUnreadMessageCount:1,setConversationCustomData:1,markConversation:1,createConversationGroup:1,getConversationGroupList:1,deleteConversationGroup:1,renameConversationGroup:1,addConversationsToGroup:1,deleteConversationsFromGroup:1,clearHistoryMessage:1,getGroupList:1,getGroupProfile:1,createGroup:1,joinGroup:1,updateGroupProfile:1,quitGroup:1,dismissGroup:1,changeGroupOwner:1,searchGroupByID:1,setMessageRemindType:1,getGroupApplicationList:1,handleGroupApplication:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getJoinedCommunityList:1,createTopicInCommunity:1,deleteTopicFromCommunity:1,updateTopicProfile:1,getTopicList:1,getGroupMemberProfile:1,getGroupMemberList:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberNameCard:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberCustomField:1,getGroupOnlineMemberCount:1,markGroupMemberList:1,getMyProfile:1,getUserProfile:1,updateMyProfile:1,setSelfStatus:1,getUserStatus:1,subscribeUserStatus:1,unsubscribeUserStatus:1,getBlacklist:1,addToBlacklist:1,removeFromBlacklist:1,getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,updateFriend:1,getFriendProfile:1,getFriendApplicationList:1,refuseFriendApplication:1,deleteFriendApplication:1,acceptFriendApplication:1,setFriendApplicationRead:1,getFriendGroupList:1,createFriendGroup:1,renameFriendGroup:1,deleteFriendGroup:1,addToFriendGroup:1,removeFromFriendGroup:1,callExperimentalAPI:1},pt=1,ue=2,Yt=3,pe=4,fe=6,V=7,ce=8,me=9,ae=10,P=11,X=12,Ke=13,to=14,gt=15,jt=16,Os=17,yn=18,no=19,Fe=20,Xe=21,zt=22,Jt=23,Xt=24,Gs=25,Re=26,Zt=27,Qt=28,mt=29,oo=30,Us=31,Ps=32,so=37,le=function(){function c(t){F(this,c),this._m=t,this._n=""}return q(c,[{key:"isLoggedIn",value:function(){return this._m.getModule(X).isLoggedIn()}},{key:"isOversea",value:function(){return this._m.getModule(X).isOversea()}},{key:"isPrivateNetWork",value:function(){return this._m.getModule(X).isPrivateNetWork()}},{key:"getFileDownloadProxy",value:function(){return this._m.getModule(X).getFileDownloadProxy()}},{key:"getMyUserID",value:function(){return this._m.getModule(X).getUserID()}},{key:"getMyTinyID",value:function(){return this._m.getModule(X).getTinyID()}},{key:"getSDKAppID",value:function(){return this._m.getModule(X).getSDKAppID()}},{key:"isIntl",value:function(){return this._m.getModule(X).isIntl()}},{key:"isDevMode",value:function(){return this._m.getModule(X).isDevMode()}},{key:"getModule",value:function(t){return this._m.getModule(t)}},{key:"getPlatform",value:function(){return _i}},{key:"getNetworkType",value:function(){return this._m.getModule(gt).getNetworkType()}},{key:"probeNetwork",value:function(t){return this._m.getModule(gt).probe(t)}},{key:"getCloudConfig",value:function(t){return this._m.getModule(Jt).getCloudConfig(t)}},{key:"emitOuterEvent",value:function(t,s){this._m.getOuterEmitterInstance().emit(t,s)}},{key:"emitInnerEvent",value:function(t,s){this._m.getInnerEmitterInstance().emit(t,s)}},{key:"getInnerEmitterInstance",value:function(){return this._m.getInnerEmitterInstance()}},{key:"generateTjgID",value:function(t){return this._m.getModule(X).getTinyID()+"-"+t.random}},{key:"filterModifiedMessage",value:function(t){if(!R(t)){var s=t.filter(function(e){return e.isModified===!0});s.length>0&&this.emitOuterEvent(W.MESSAGE_MODIFIED,s)}}},{key:"filterUnmodifiedMessage",value:function(t){return R(t)?[]:t.filter(function(s){return s.isModified===!1})}},{key:"request",value:function(t){return this._m.getModule(Fe).request(t)}},{key:"canIUse",value:function(t){return this._m.getModule(Zt).canIUse(t)}},{key:"getErrorMessage",value:function(t,s,e){return this._m.getErrorMessage(t,s,e)}},{key:"outputWarning",value:function(t,s,e){var n=this.getErrorMessage(t,s,e);n&&h.w(n)}}]),c}(),In="wslogin",bs="wslogout",ws="wshello",Ui="KickOther",Fs="getmsg",qs="authkey",ao="sendmsg",ro="send_group_msg",xs="portrait_get_all",Vs="portrait_set",Bs="black_list_get",Hs="black_list_add",Ks="black_list_delete",Ws="msgwithdraw",Ys="msgreaded",js="set_c2c_peer_mute_notifications",zs="get_c2c_peer_mute_notifications",Cn="getroammsg",Js="get_peer_read_time",Xs="delete_c2c_msg_ramble",io="modify_c2c_msg",Zs="set_key_values",Qs="get_key_values",$s="page_get",Pi="get",ea="batch_delete",ta="clear_msg",na="top",oa="deletemsg",sa="set_conv_custom_data",aa="mark_contact",ra="create_contact_group",ia="del_contact_group",ua="update_contact_group",ca="add_conv_to_group",la="del_conv_from_group",da="get_contact_group",uo="get_joined_group_list",pa="get_group_self_member_info",ga="create_group",ha="destroy_group",_a="modify_group_base_info",fa="apply_join_group",ma="apply_join_group_noauth",va="quit_group",Ma="get_group_public_info",ya="change_group_owner",Ia="handle_apply_join_group",Ca="handle_invite_join_permission_group",Ta="handle_invite_join_group",Da="group_msg_recall",ka="msg_read_report",Sa="read_all_unread_msg",Tn="group_msg_get",Ea="get_group_msg_receipt",La="group_msg_receipt",Aa="c2c_msg_read_receipt",Ra="get_group_msg_receipt_detail",Na="get_pendency",Oa="deletemsg",Ga="get_msg",Ua="get_msg_noauth",Pa="get_online_member_num",ba="delete_group_ramble_msg_by_seq",co="modify_group_msg",wa="set_group_attr",Fa="modify_group_attr",qa="delete_group_attr",xa="clear_group_attr",Va="get_group_attr",lo="group_set_key_values",po="group_get_key_values",Ba="get_group_notify",Ha="update_group_counter",Ka="get_group_counter",Wa="get_group_member_info",Ya="get_members",ja="get_specified_group_member_info",za="add_group_member",Ja="delete_group_member",Xa="ban_group_member",Za="modify_group_member_info",Qa="modify_user_info",$a="cos",er="pre_sig",tr="video_cover",Dn="tim_web_report_v2",go="alive",bi="msg_push",wi="multi_msg_push_ws",ho="ws_msg_push_ack",Fi="stat_forceoffline",nr="save_relay_json_msg",or="get_relay_json_msg",sr="fetch_config",qi="push_configv2",ar="fetch_imsdk_purchase_bitsv2",xi="push_imsdk_purchase_bitsv2",Vi="notify2",rr="create_topic",ir="destroy_topic",ur="modify_topic",cr="get_topic",lr="ws_set_custom_status",dr="ws_get_user_status",pr="ws_status_subscribe",gr="ws_status_unsubscribe",hr="ws_stat_background",_r="ws_stat_foreground",fr="ws_stat_settoken",mr="get_local_words",vr="ws_batch_trans_text",k={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,COS_UNDETECTED:2040,COS_GET_SIG_FAIL:2041,MESSAGE_SEND_FAIL:2100,MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM:2101,MESSAGE_SEND_NEED_MESSAGE_INSTANCE:2105,MESSAGE_SEND_INVALID_CONVERSATION_TYPE:2106,MESSAGE_FILE_IS_EMPTY:2108,MESSAGE_ONPROGRESS_FUNCTION_ERROR:2109,MESSAGE_REVOKE_FAIL:2110,MESSAGE_DELETE_FAIL:2111,MESSAGE_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MESSAGE_LIST_EMPTY:2114,MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GROUP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,MESSAGE_IMAGE_SELECT_FILE_FIRST:2251,MESSAGE_IMAGE_TYPES_LIMIT:2252,MESSAGE_IMAGE_SIZE_LIMIT:2253,MESSAGE_AUDIO_UPLOAD_FAIL:2300,MESSAGE_AUDIO_SIZE_LIMIT:2301,MESSAGE_VIDEO_UPLOAD_FAIL:2350,MESSAGE_VIDEO_SIZE_LIMIT:2351,MESSAGE_VIDEO_TYPES_LIMIT:2352,MESSAGE_FILE_UPLOAD_FAIL:2400,MESSAGE_FILE_SELECT_FILE_FIRST:2401,MESSAGE_FILE_SIZE_LIMIT:2402,MESSAGE_FILE_URL_IS_EMPTY:2403,MESSAGE_MERGER_TYPE_INVALID:2450,MESSAGE_MERGER_KEY_INVALID:2451,MESSAGE_MERGER_DOWNLOAD_FAIL:2452,MESSAGE_FORWARD_TYPE_INVALID:2453,MESSAGE_MODIFY_CONFLICT:2480,MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM:2481,CONVERSATION_NOT_FOUND:2500,USER_OR_GROUP_NOT_FOUND:2501,CONVERSATION_UN_RECORDED_TYPE:2502,INVALID_CONVERSATION_ID:2503,ILLEGAL_GROUP_TYPE:2600,CANNOT_JOIN_WORK:2601,ILLEGAL_GROUP_ID:2602,CANNOT_FIND_GROUP:2603,CANNOT_CHANGE_OWNER_IN_AVCHATROOM:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,CANNOT_DISMISS_WORK:2622,MEMBER_NOT_IN_GROUP:2623,JOIN_GROUP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AVCHATROOM:2661,CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:2662,NOT_OWNER:2681,CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:2682,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GROUP_EXISTED:2710,FRIEND_GROUP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,CANNOT_ADD_SELF_TO_BLACKLIST:2742,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,INVALID_TRTC_CMD:2995,OVER_FREQUENCY_LIMIT:2996,CANNOT_FIND_PROTOCOL:2997,CANNOT_FIND_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,CANNOT_USE_COMMERCIAL_ABILITY:3122,PROFANITY_FOUND:3123,MESSAGE_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022},_o="networkRTT",fo="messageE2EDelay",Nt="sendMessageC2C",Ot="sendMessageGroup",Gt="sendMessageGroupAV",Tt="sendMessageRichMedia",be="cosUpload",Ut="messageReceivedGroup",$t="messageReceivedGroupAVPush",en="messageReceivedGroupAVPull",Bi=(Be(Je={},_o,2),Be(Je,fo,3),Be(Je,Nt,4),Be(Je,Ot,5),Be(Je,Gt,6),Be(Je,Tt,7),Be(Je,Ut,8),Be(Je,$t,9),Be(Je,en,10),Be(Je,be,11),Je),Hi={info:4,warning:5,error:6},Mr={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},Ki={login:4},L=function(){function c(t){F(this,c),this._n="SSOLogData",this.eventType=Ki[t]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=t,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=ut()}return q(c,[{key:"updateTimeStamp",value:function(){this.timestamp=ut()}},{key:"start",value:function(t){return this._startts=t,this}},{key:"end",value:function(){var t=this,s=arguments.length>0&&arguments[0]!==void 0&&arguments[0];if(!this._sentFlag){var e=ut();this.costTime===0&&(this.costTime=e-this._startts),this.setMoreMessage("startts:".concat(this._startts," endts:").concat(e)),s?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout(function(){t._sentFlag=!0,t._eventStatModule&&t._eventStatModule.pushIn(t)},0)}}},{key:"setError",value:function(t,s,e){if(!(t instanceof Error))return h.w("".concat(this._n,".setError value not instanceof Error, please check!")),this;if(this._sentFlag)return this;if(this.setNetworkType(e),s)t.code&&this.setCode(t.code),t.message&&this.setMoreMessage(t.message);else{var n=k.NO_NETWORK;this.setCode(n)}return this.setLevel("error"),this}},{key:"setCode",value:function(t){return S(t)||this._sentFlag||(t==="ECONNABORTED"&&(this.code=103),ee(t)?this.code=t:h.w("".concat(this._n,".setCode value not a number, please check!"),t,_t(t))),this}},{key:"setMessage",value:function(t){return S(t)||this._sentFlag||(ee(t)&&(this.message=t.toString()),z(t)&&(this.message=t)),this}},{key:"setCostTime",value:function(t){return this.costTime=t,this}},{key:"setLevel",value:function(t){return S(t)||this._sentFlag||(this.level=Hi[t]),this}},{key:"setMoreMessage",value:function(t){return R(this.moreMessage)?this.moreMessage="".concat(t):this.moreMessage+=" ".concat(t),this}},{key:"setNetworkType",value:function(t){if(S(t))h.w("".concat(this._n,".setNetworkType value is undefined, please check!"));else{var s=Mr[t.toLowerCase()];S(s)||(this.networkType=s)}return this}},{key:"getStartTs",value:function(){return this._startts}},{key:"setUIPlatform",value:function(t){this.uiPlatform=t}}],[{key:"bindEventStatModule",value:function(t){c.prototype._eventStatModule=t}}]),c}(),mo=function(){function c(t){F(this,c),this.type=f.MSG_TEXT,this.content={text:t.text||""}}return q(c,[{key:"setText",value:function(t){this.content.text=t}},{key:"sendable",value:function(){return this.content.text.length!==0}}]),c}(),vo=function(){function c(t,s){F(this,c),this._imageMemoryURL="",this._fileDownloadProxy=s,Z?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=f.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||dn.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._autoFixUrl()}return q(c,[{key:"_initImageInfoModel",value:function(){var t=this;this._ImageInfoModel=function(s){this.instanceID=He(9999999),this.sizeType=s.type||0,this.type=0,this.size=s.size||0,this.width=s.width||0,this.height=s.height||0,this.imageUrl=s.url||"",this.url=ze(s.url||t._imageMemoryURL,t._fileDownloadProxy)},this._ImageInfoModel.prototype={setSizeType:function(s){this.sizeType=s},setType:function(s){this.type=s},setImageUrl:function(s){s&&(this.imageUrl=s)},getImageUrl:function(){return this.imageUrl}}}},{key:"initImageInfoArray",value:function(t){for(var s=0,e=null,n=null;s<=2;)n=S(t)||S(t[s])?{type:0,size:0,width:0,height:0,url:""}:t[s],(e=new this._ImageInfoModel(n)).setSizeType(s+1),e.setType(s),this.addImageInfo(e),s++;this.updateAccessSideImageInfoArray()}},{key:"updateImageInfoArray",value:function(t){for(var s,e=this.content.imageInfoArray.length,n=0;n<e;n++)s=this.content.imageInfoArray[n],t[n].size&&(s.size=t[n].size),t[n].url&&s.setImageUrl(t[n].url),t[n].width&&(s.width=t[n].width),t[n].height&&(s.height=t[n].height)}},{key:"_autoFixUrl",value:function(){for(var t=this.content.imageInfoArray.length,s="",e="",n=["http","https"],o=null,a=0;a<t;a++)this.content.imageInfoArray[a].url&&(o=this.content.imageInfoArray[a]).imageUrl!==""&&(e=o.imageUrl.slice(0,o.imageUrl.indexOf("://")+1),s=o.imageUrl.slice(o.imageUrl.indexOf("://")+1),n.indexOf(e)<0&&(e="https:"),this.content.imageInfoArray[a].setImageUrl([e,s].join("")))}},{key:"updatePercent",value:function(t){this._percent=t,this._percent>1&&(this._percent=1)}},{key:"updateImageFormat",value:function(t){this.content.imageFormat=dn[t.toUpperCase()]||dn.UNKNOWN}},{key:"createImageDataASURLInWeb",value:function(t){t!==void 0&&t.files.length>0&&(this._imageMemoryURL=window.URL.createObjectURL(t.files[0]))}},{key:"createImageDataASURLInWXMiniApp",value:function(t){t&&t.url&&(this._imageMemoryURL=t.url)}},{key:"replaceImageInfo",value:function(t,s){this.content.imageInfoArray[s]instanceof this._ImageInfoModel||(this.content.imageInfoArray[s]=t)}},{key:"addImageInfo",value:function(t){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(t)}},{key:"updateAccessSideImageInfoArray",value:function(){var t=this.content.imageInfoArray,s=t[0],e=s.width,n=e===void 0?0:e,o=s.height,a=o===void 0?0:o;n!==0&&a!==0&&(Cs(t),Object.assign(t[2],Yn({originWidth:n,originHeight:a,min:720})))}},{key:"sendable",value:function(){return this.content.imageInfoArray.length!==0&&this.content.imageInfoArray[0].imageUrl!==""&&this.content.imageInfoArray[0].size!==0}}]),c}(),Mo=function(){function c(t){F(this,c),this.type=f.MSG_FACE,this.content=t||null}return q(c,[{key:"sendable",value:function(){return this.content!==null}}]),c}(),yo=function(){function c(t,s){F(this,c),this.type=f.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:t.second,size:t.size,url:ze(t.url,s),remoteAudioUrl:t.url||"",uuid:t.uuid}}return q(c,[{key:"updatePercent",value:function(t){this._percent=t,this._percent>1&&(this._percent=1)}},{key:"updateAudioUrl",value:function(t){this.content.remoteAudioUrl=t}},{key:"sendable",value:function(){return this.content.remoteAudioUrl!==""}}]),c}(),Wi={from:!0,groupID:!0,groupName:!0,to:!0},yr=function(){function c(t){F(this,c),this.type=f.MSG_GRP_TIP,this.content={},this._initContent(t)}return q(c,[{key:"_initContent",value:function(t){var s=this;Object.keys(t).forEach(function(e){switch(e){case"remarkInfo":break;case"groupProfile":s.content.groupProfile={},s._initGroupProfile(t[e]);break;case"operatorInfo":break;case"memberInfoList":case"msgMemberInfo":s._updateMemberList(t[e]);break;case"memberExtraInfo":case"onlineMemberInfo":break;case"memberNum":s.content[e]=t[e],s.content.memberCount=t[e];break;case"newGroupProfile":s.content.newGroupProfile={},s._initNewGroupProfile(t[e]);break;default:s.content[e]=t[e]}}),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:"_initGroupProfile",value:function(t){for(var s=Object.keys(t),e=0;e<s.length;e++){var n=s[e];Wi[n]&&(this.content.groupProfile[n]=t[n])}}},{key:"_updateMemberList",value:function(t){R(this.content.memberList)?this.content.memberList=t:this.content.memberList.forEach(function(s){t.forEach(function(e){s.userID===e.userID&&Object.assign(s,e)})})}},{key:"_initNewGroupProfile",value:function(t){for(var s=Object.keys(t),e=0;e<s.length;e++){var n=s[e];n!=="muteAllMembers"?this.content.newGroupProfile[n]=t[n]:this.content.newGroupProfile[n]=t[n]===1}}}]),c}(),Yi={from:!0,groupID:!0,groupName:!0,to:!0},Ir=function(){function c(t){F(this,c),this.type=f.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(t)}return q(c,[{key:"_initContent",value:function(t){var s=this;Object.keys(t).forEach(function(e){switch(e){case"memberInfoList":break;case"remarkInfo":s.content.handleMessage=t[e];break;case"groupProfile":s.content.groupProfile={},s._initGroupProfile(t[e]);break;default:s.content[e]=t[e]}})}},{key:"_initGroupProfile",value:function(t){for(var s=Object.keys(t),e=0;e<s.length;e++){var n=s[e];Yi[n]&&(n==="groupName"?this.content.groupProfile.name=t[n]:this.content.groupProfile[n]=t[n])}}}]),c}(),Io=function(){function c(t,s){F(this,c),this.type=f.MSG_FILE,this._percent=0;var e=this._getFileInfo(t);this.content={downloadFlag:2,fileUrl:ze(t.url,s)||"",uuid:t.uuid,fileName:e.name||"",fileSize:e.size||0}}return q(c,[{key:"_getFileInfo",value:function(t){if(!S(t.fileName)&&!S(t.fileSize))return{size:t.fileSize,name:t.fileName};var s=t.file.files[0];if(je){if(s.path&&s.path.indexOf(".")!==-1){var e=s.path.slice(s.path.lastIndexOf(".")+1).toLowerCase();s.type=e,s.name||(s.name="".concat(He(999999),".").concat(e))}s.name||(s.type="",s.name=s.path.slice(s.path.lastIndexOf("/")+1).toLowerCase()),s.suffix&&(s.type=s.suffix),s.url||(s.url=s.path)}return{size:s.size,name:s.name}}},{key:"updatePercent",value:function(t){this._percent=t,this._percent>1&&(this._percent=1)}},{key:"updateFileUrl",value:function(t){this.content.fileUrl=t}},{key:"sendable",value:function(){return this.content.fileUrl!==""&&this.content.fileName!==""&&this.content.fileSize!==0}}]),c}(),Co=function(){function c(t){F(this,c),this.type=f.MSG_CUSTOM,this.content={data:t.data||"",description:t.description||"",extension:t.extension||""}}return q(c,[{key:"setData",value:function(t){return this.content.data=t,this}},{key:"setDescription",value:function(t){return this.content.description=t,this}},{key:"setExtension",value:function(t){return this.content.extension=t,this}},{key:"sendable",value:function(){return this.content.data.length!==0||this.content.description.length!==0||this.content.extension.length!==0}}]),c}(),To=function(){function c(t,s){F(this,c),this.type=f.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:t.remoteVideoUrl||t.videoUrl||"",videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:ze(t.videoUrl,s),videoDownloadFlag:2,videoUUID:t.videoUUID,thumbUUID:t.thumbUUID,thumbFormat:t.thumbFormat,thumbWidth:t.thumbWidth,snapshotWidth:t.thumbWidth,thumbHeight:t.thumbHeight,snapshotHeight:t.thumbHeight,thumbSize:t.thumbSize,snapshotSize:t.thumbSize,thumbDownloadFlag:2,thumbUrl:ze(t.thumbUrl,s),snapshotUrl:ze(t.thumbUrl,s)}}return q(c,[{key:"updatePercent",value:function(t){this._percent=t,this._percent>1&&(this._percent=1)}},{key:"updateVideoUrl",value:function(t){t&&(this.content.remoteVideoUrl=t)}},{key:"updateSnapshotInfo",value:function(t){var s=t.snapshotUrl,e=t.snapshotWidth,n=t.snapshotHeight;R(s)||(this.content.thumbUrl=this.content.snapshotUrl=s),R(e)||(this.content.thumbWidth=this.content.snapshotWidth=Number(e)),R(n)||(this.content.thumbHeight=this.content.snapshotHeight=Number(n))}},{key:"sendable",value:function(){return this.content.remoteVideoUrl!==""}}]),c}(),Do=function(){function c(t){F(this,c),this.type=f.MSG_LOCATION;var s=t.description,e=t.longitude,n=t.latitude;this.content={description:s,longitude:e,latitude:n}}return q(c,[{key:"sendable",value:function(){return!0}}]),c}(),Cr=function(){function c(t,s){if(F(this,c),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||"",this.clientTime=t.clientTime||void 0,t.ID)this.ID=t.ID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType.startsWith(f.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(f.CONV_GROUP)&&(this.receiverGroupID=t.to),this.messageReceiver=t.to;else{this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[];var e=t.elements[0].type,n=t.elements[0].content;this._patchRichMediaPayload(e,n),this._updateRichMediaDownloadUrl(e,n,s),e===f.MSG_MERGER?this.messageBody.push({type:e,payload:new kn(n).content}):this.messageBody.push({type:e,payload:n}),t.groupID&&(this.receiverGroupID=t.groupID,this.messageReceiver=t.groupID),t.to&&(this.receiverUserID=t.to,this.messageReceiver=t.to),this.ID="".concat(t.tinyID,"-").concat(t.clientTime,"-").concat(t.random)}}return q(c,[{key:"_patchRichMediaPayload",value:function(t,s){t===f.MSG_IMAGE?s.imageInfoArray.forEach(function(e){!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,e.type===1?e.type=0:e.type===3&&(e.type=1))}):t===f.MSG_VIDEO?!s.remoteVideoUrl&&s.videoUrl&&(s.remoteVideoUrl=s.videoUrl):t===f.MSG_AUDIO?!s.remoteAudioUrl&&s.url&&(s.remoteAudioUrl=s.url):t===f.MSG_FILE&&!s.fileUrl&&s.url&&(s.fileUrl=s.url,s.url=void 0)}},{key:"_updateRichMediaDownloadUrl",value:function(t,s,e){e&&(t===f.MSG_IMAGE?s.imageInfoArray.forEach(function(n){n.url=ze(n.url,e)}):t===f.MSG_VIDEO?(s.videoUrl=ze(s.videoUrl,e),s.snapshotUrl=ze(s.thumbUrl,e),s.snapshotHeight=s.thumbHeight,s.snapshotWidth=s.thumbWidth):t===f.MSG_AUDIO?s.url=ze(s.url,e):t===f.MSG_FILE&&(s.fileUrl=ze(s.fileUrl,e)))}}]),c}(),kn=function(){function c(t,s){if(F(this,c),this.type=f.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},t.downloadKey){var e=t.downloadKey,n=t.pbDownloadKey,o=t.title,a=t.abstractList,r=t.compatibleText,i=t.version;this.content.downloadKey=e,this.content.pbDownloadKey=n,this.content.title=o,this.content.abstractList=a,this.content.compatibleText=r,this.content.version=i||0}else if(R(t.messageList))t.layersOverLimit===1&&(this.content.layersOverLimit=!0);else{var u=t.messageList,l=t.title,d=t.abstractList,p=t.compatibleText,g=t.version,_=[];u.forEach(function(v){if(!R(v)){var M=new Cr(v,s);_.push(M)}}),this.content.messageList=_,this.content.title=l,this.content.abstractList=d,this.content.compatibleText=p,this.content.version=g||0}}return q(c,[{key:"sendable",value:function(){return!R(this.content.messageList)||!R(this.content.downloadKey)}}]),c}(),ko={1:f.MSG_PRIORITY_HIGH,2:f.MSG_PRIORITY_NORMAL,3:f.MSG_PRIORITY_LOW,4:f.MSG_PRIORITY_LOWEST},ve=function(){function c(t){F(this,c),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||f.CONV_C2C,this.conversationSubType=t.conversationSubType,this.time=t.time||Math.ceil(Date.now()/1e3),this.sequence=t.sequence||0,this.clientSequence=t.clientSequence||t.sequence||0,this.random=t.random||t.random===0?t.random:He(),this.priority=this._computePriority(t.priority),this.nick=t.nick||"",this.avatar=t.avatar||"",this.isPeerRead=!1,this.nameCard="",this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=t.isPlaceMessage===2||t.msgFlagBits===8,this.from=t.from||null,this.to=t.to||null,this.flow="",this.isSystemMessage=t.isSystemMessage||!1,this.protocol=t.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=t.status||Ge.SUCCESS,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=t.cloudCustomData||"",this.isDeleted=!1,this.isModified=!1,this._isExcludedFromUnreadCount=!(!t.messageControlInfo||t.messageControlInfo.excludedFromUnreadCount!==1),this._isExcludedFromLastMessage=!(!t.messageControlInfo||t.messageControlInfo.excludedFromLastMessage!==1),this.clientTime=t.clientTime||Hn()||0,this.senderTinyID=t.senderTinyID||t.tinyID||"",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0},this.needReadReceipt=t.needReadReceipt===!0||t.needReadReceipt===1,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this._receiverList=t.receiverList||void 0,this.isSupportExtension=t.isSupportExtension===!0||t.isSupportExtension===1,this.revoker=t.revokerInfo&&t.revokerInfo.revoker||null,this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t),this.initC2CReadReceiptInfo(t.readReceiptSentByPeer)}return q(c,[{key:"elements",get:function(){return this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(t){if(t!==null){z(t.nick)&&(this.nick=t.nick),z(t.avatar)&&(this.avatar=t.avatar);var s=t.messageFromAccountExtraInformation;ne(s)&&z(s.nameCard)&&(this.nameCard=s.nameCard)}}},{key:"handleGroupAtInfo",value:function(t){var s=this;t.payload&&t.payload.atUserList&&t.payload.atUserList.forEach(function(e){e!==f.MSG_AT_ALL?(s._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),s.atUserList.push(e)):(s._groupAtInfoList.push({groupAtAllFlag:1}),s.atUserList.push(f.MSG_AT_ALL))}),b(t.groupAtInfo)&&t.groupAtInfo.forEach(function(e){e.groupAtAllFlag===0?s.atUserList.push(e.groupAtUserID):e.groupAtAllFlag===1&&s.atUserList.push(f.MSG_AT_ALL)})}},{key:"getGroupAtInfoList",value:function(){return this._groupAtInfoList}},{key:"_initProxy",value:function(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}},{key:"reInitialize",value:function(t){t&&(this.status=this.from?Ge.SUCCESS:Ge.UNSEND,!this.from&&(this.from=t)),this._initFlow(t),this._initSequence(t),this._concatConversationID(t),this.generateMessageID()}},{key:"isSendable",value:function(){return this._elements.length!==0&&typeof this._elements[0].sendable=="function"&&this._elements[0].sendable()}},{key:"_initTo",value:function(t){this.conversationType===f.CONV_GROUP&&(this.to=t.groupID)}},{key:"_initSequence",value:function(t){this.clientSequence===0&&t&&(this.clientSequence=function(s){if(!s)return!1;if(pn[s]===void 0){var e=new Date,n="3".concat(e.getHours()).slice(-2),o="0".concat(e.getMinutes()).slice(-2),a="0".concat(e.getSeconds()).slice(-2);pn[s]=parseInt([n,o,a,"0001"].join("")),n=null,o=null,a=null,h.l("autoIncrementIndex start index:".concat(pn[s]))}return pn[s]++}(t)),this.sequence===0&&this.conversationType===f.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===f.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID="".concat(this.senderTinyID,"-").concat(this.clientTime,"-").concat(this.random)}},{key:"_initFlow",value:function(t){t!==""&&(t===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}},{key:"_concatConversationID",value:function(t){var s=this.to,e="",n=this.conversationType;n!==f.CONV_SYSTEM?(e=n===f.CONV_C2C?t===this.from?s:this.from:this.to,this.conversationID=e?"".concat(n).concat(e):null):this.conversationID=f.CONV_SYSTEM}},{key:"isElement",value:function(t){return t instanceof mo||t instanceof vo||t instanceof Mo||t instanceof yo||t instanceof Io||t instanceof To||t instanceof yr||t instanceof Ir||t instanceof Co||t instanceof Do||t instanceof kn}},{key:"setElement",value:function(t,s){var e=this;if(this.isElement(t))return this._elements=[t],void this._initProxy();var n=function(a){if(a.type&&a.content)switch(a.type){case f.MSG_TEXT:e.setTextElement(a.content);break;case f.MSG_IMAGE:e.setImageElement(a.content,s);break;case f.MSG_AUDIO:e.setAudioElement(a.content,s);break;case f.MSG_FILE:e.setFileElement(a.content,s);break;case f.MSG_VIDEO:e.setVideoElement(a.content,s);break;case f.MSG_CUSTOM:e.setCustomElement(a.content);break;case f.MSG_LOCATION:e.setLocationElement(a.content);break;case f.MSG_GRP_TIP:e.setGroupTipElement(a.content);break;case f.MSG_GRP_SYS_NOTICE:e.setGroupSystemNoticeElement(a.content);break;case f.MSG_FACE:e.setFaceElement(a.content);break;case f.MSG_MERGER:e.setMergerElement(a.content,s)}};if(b(t))for(var o=0;o<t.length;o++)n(t[o]);else n(t);this._initProxy()}},{key:"clearElement",value:function(){this._elements.length=0}},{key:"setTextElement",value:function(t){var s=typeof t=="string"?t:t.text,e=new mo({text:s});this._elements.push(e)}},{key:"setImageElement",value:function(t,s){var e=new vo(t,s);this._elements.push(e)}},{key:"setAudioElement",value:function(t,s){var e=new yo(t,s);this._elements.push(e)}},{key:"setFileElement",value:function(t,s){var e=new Io(t,s);this._elements.push(e)}},{key:"setVideoElement",value:function(t,s){var e=new To(t,s);this._elements.push(e)}},{key:"setLocationElement",value:function(t){var s=new Do(t);this._elements.push(s)}},{key:"setCustomElement",value:function(t){var s=new Co(t);this._elements.push(s)}},{key:"setGroupTipElement",value:function(t){var s={},e=t.operationType;if(R(t.memberInfoList)?t.operatorInfo&&(s=t.operatorInfo):e!==f.GRP_TIP_MBR_JOIN&&e!==f.GRP_TIP_MBR_KICKED_OUT&&e!==f.GRP_TIP_MBR_SET_ADMIN&&e!==f.GRP_TIP_MBR_CANCELED_ADMIN||(s=t.memberInfoList[0]),!R(t.memberExtraInfo)){var n=t.memberExtraInfo.reason;t.msgMemberInfo.forEach(function(u){u.reason=n})}var o=s,a=o.nick,r=o.avatar;z(a)&&(this.nick=a),z(r)&&(this.avatar=r);var i=new yr(t);this._elements.push(i)}},{key:"setGroupSystemNoticeElement",value:function(t){var s=new Ir(t);this._elements.push(s)}},{key:"setFaceElement",value:function(t){var s=new Mo(t);this._elements.push(s)}},{key:"setMergerElement",value:function(t,s){var e=new kn(t,s);this._elements.push(e)}},{key:"setIsRead",value:function(t){this.isRead=t}},{key:"setRelayFlag",value:function(t){this._relayFlag=t}},{key:"getRelayFlag",value:function(){return this._relayFlag}},{key:"_computePriority",value:function(t){if(S(t))return f.MSG_PRIORITY_NORMAL;if(z(t)&&Object.values(ko).indexOf(t)!==-1)return t;if(ee(t)){var s=""+t;if(Object.keys(ko).indexOf(s)!==-1)return ko[s]}return f.MSG_PRIORITY_NORMAL}},{key:"setNickAndAvatar",value:function(t){var s=t.nick,e=t.avatar;z(s)&&(this.nick=s),z(e)&&(this.avatar=e)}},{key:"setNameCard",value:function(t){z(t)&&(this.nameCard=t)}},{key:"initC2CReadReceiptInfo",value:function(t){this.conversationType===f.CONV_C2C&&this.needReadReceipt===!0&&(this.readReceiptInfo.isPeerRead=t===1)}}]),c}(),x=function(c){return{code:0,data:c||{}}},oe=function(c){re(s,c);var t=ie(s);function s(e){var n;F(this,s),n=t.call(this);var o=e.code,a=e.message,r=e.data;return n.code=o,n.message=a||n._getErrorMessage(n.code),n.data=r||{},n}return q(s)}(Wo(Error)),Dt=null,ji=function(c){Dt=c},Y=function(c){return Promise.resolve(x(c))},T=function(c){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(c instanceof oe)return t&&Dt!==null&&Dt.emit(W.ERROR,c),Promise.reject(c);if(c instanceof Error){var s=new oe({code:k.UNCAUGHT_ERROR});return t&&Dt!==null&&Dt.emit(W.ERROR,s),Promise.reject(s)}if(!S(c)&&!S(c.code)){var e=new oe(c);return t&&Dt!==null&&Dt.emit(W.ERROR,e),Promise.reject(e)}},zi=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="C2CModule",n._messageFromUnreadDBMap=new Map,n._signalingFromUnreadDBList=[],n}return q(s,[{key:"onNewC2CMessage",value:function(e){var n=e.dataList,o=e.isInstantMessage,a=e.C2CRemainingUnreadList,r=e.C2CPairUnreadList;h.d("".concat(this._n,".onNewC2CMessage count:").concat(n.length," isInstantMessage:").concat(o));var i=this._newC2CMessageStoredAndSummary({dataList:n,C2CRemainingUnreadList:a,C2CPairUnreadList:r,isInstantMessage:o}),u=i.conversationOptionsList,l=i.messageList,d=i.isUnreadC2CMessage;this.filterModifiedMessage(l),u.length>0&&this.getModule(P).onNewMessage({conversationOptionsList:u,isInstantMessage:o,isUnreadC2CMessage:d});var p=this.filterUnmodifiedMessage(l);o&&p.length>0&&this.emitOuterEvent(W.MESSAGE_RECEIVED,p),l.length=0}},{key:"_newC2CMessageStoredAndSummary",value:function(e){for(var n=e.dataList,o=e.C2CRemainingUnreadList,a=e.C2CPairUnreadList,r=e.isInstantMessage,i=null,u=[],l=[],d={},p=this.getModule(jt),g=this.getModule(Re),_=!1,v=this.getModule(P),M=this.getFileDownloadProxy(),y=0,C=n.length;y<C;y++)if(this._isSignaling(n[y]))this._signalingFromUnreadDBList.push(n[y].eventArray[0].c2CNotifyMsgArray[0]);else{var D=n[y];D.currentUser=this.getMyUserID(),D.conversationType=f.CONV_C2C,D.isSystemMessage=!!D.isSystemMessage,(S(D.nick)||S(D.avatar))&&(_=!0,h.d("".concat(this._n,"._newC2CMessageStoredAndSummary nick or avatar missing!"))),i=new ve(D),D.elements=p.parseElements(D.elements,D.from),i.setElement(D.elements,M),i.setNickAndAvatar({nick:D.nick,avatar:D.avatar});var E=i.conversationID;if(r){if(this._messageFromUnreadDBMap.get(i.ID)===1)continue;var A=!1;if(i.from!==this.getMyUserID()){var O=v.getLatestMessageSentByPeer(E);if(O){var U=O.nick,K=O.avatar;_?i.setNickAndAvatar({nick:U,avatar:K}):U===i.nick&&K===i.avatar||(A=!0)}}else{var j=v.getLatestMessageSentByMe(E);if(j){var H=j.nick,J=j.avatar;H===i.nick&&J===i.avatar||v.modifyMessageSentByMe({conversationID:E,latestNick:i.nick,latestAvatar:i.avatar})}}var de=n[y].isModified===1;if(v.isMessageSentByCurrentInstance(i)?i.isModified=de:de=!1,D.msgLifeTime===0)i._onlineOnlyFlag=!0,v.isMessageSentByCurrentInstance(i)||l.push(i);else{if(!v.pushIntoMessageList(l,i,de))continue;A&&(v.modifyMessageSentByPeer({conversationID:E,latestNick:i.nick,latestAvatar:i.avatar}),v.updateUserProfileSpecifiedKey({conversationID:E,nick:i.nick,avatar:i.avatar}))}r&&i.clientTime>0&&g.addMessageDelay(i.clientTime)}else this._messageFromUnreadDBMap.set(i.ID,1);if(D.msgLifeTime!==0){if(i._onlineOnlyFlag===!1){var De=v.getLastMessageTime(E);if(ee(De)&&i.time<De)continue;if(S(d[E])){var he=0;i.flow==="in"&&(i._isExcludedFromUnreadCount||(he=1)),d[E]=u.push({conversationID:E,unreadCount:he,type:i.conversationType,subType:i.conversationSubType,lastMessage:i._isExcludedFromLastMessage?"":i})-1}else{var Me=d[E];u[Me].type=i.conversationType,u[Me].subType=i.conversationSubType,u[Me].lastMessage=i._isExcludedFromLastMessage?"":i,i.flow==="in"&&(i._isExcludedFromUnreadCount||u[Me].unreadCount++)}}}else i._onlineOnlyFlag=!0}this._handleSignalingFromUnreadDB();var Ue=!1;if(b(a))for(var Ze=function(ht,Xc){if(a[ht].unreadCount>0){Ue=!0;var On=u.find(function(Zc){return Zc.conversationID==="C2C".concat(a[ht].from)});On?On.unreadCount=a[ht].unreadCount:u.push({conversationID:"C2C".concat(a[ht].from),unreadCount:a[ht].unreadCount,type:f.CONV_C2C})}},wt=0,Nn=a.length;wt<Nn;wt++)Ze(wt);if(b(o))for(var Ft=function(ht,Xc){u.find(function(On){return On.conversationID==="C2C".concat(o[ht].from)})||u.push({conversationID:"C2C".concat(o[ht].from),type:f.CONV_C2C,lastMsgTime:o[ht].lastMsgTime})},xo=0,Jc=o.length;xo<Jc;xo++)Ft(xo);return{conversationOptionsList:u,messageList:l,isUnreadC2CMessage:Ue}}},{key:"_isSignaling",value:function(e){var n=e.eventArray;return!(!b(n)||n[0].event!==10)}},{key:"_handleSignalingFromUnreadDB",value:function(){var e=this._signalingFromUnreadDBList.length;if(h.l("".concat(this._n,"._handleSignalingFromUnreadDB signalingCount:").concat(e)),e!==0){var n=[];this._signalingFromUnreadDBList.forEach(function(o){o.hasOwnProperty("c2cMessageRevokedNotify")&&n.push(o)}),this.onC2CMessageRevoked({dataList:n}),this._signalingFromUnreadDBList.length=0,n.length=0}}},{key:"onC2CMessageRevoked",value:function(e){var n=this,o=this.getModule(P),a=[],r=null,i=!0;e.dataList.forEach(function(u){if(u.c2cMessageRevokedNotify){var l=u.c2cMessageRevokedNotify.revokedInfos;S(l)||l.forEach(function(d){var p=n.getMyUserID()===d.from?"".concat(f.CONV_C2C).concat(d.to):"".concat(f.CONV_C2C).concat(d.from);r=o.revoke(p,d.sequence,d.random);var g=d.revokerInfo&&d.revokerInfo.revoker;if(r)r.revoker||(r.revoker=g,a.push(r));else{var _={conversationID:p,sequence:d.sequence,time:d.time,revoker:g};o.isLastMessageRevoked(_)&&(a.push(_),i=!1)}})}}),a.length!==0&&(o.onMessageRevoked(a),i===!0&&(h.l("".concat(this._n,".onC2CMessageRevoked count:").concat(a.length)),this.emitOuterEvent(W.MESSAGE_REVOKED,a)))}},{key:"onC2CMessageReadReceipt",value:function(e){var n=this;e.dataList.forEach(function(o){if(!R(o.c2cMessageReadReceipt)){var a=o.c2cMessageReadReceipt.to;o.c2cMessageReadReceipt.uinPairReadArray.forEach(function(r){var i=r.peerReadTime;h.d("".concat(n._n,"._onC2CMessageReadReceipt to:").concat(a," peerReadTime:").concat(i));var u="".concat(f.CONV_C2C).concat(a),l=n.getModule(P);l.recordPeerReadTime(u,i),l.updateMessageIsPeerReadProperty(u,i)})}})}},{key:"onC2CMessageReadNotice",value:function(e){var n=this;e.dataList.forEach(function(o){if(!R(o.c2cMessageReadNotice)){var a=n.getModule(P);o.c2cMessageReadNotice.uinPairReadArray.forEach(function(r){var i=r.from,u=r.peerReadTime;h.d("".concat(n._n,".onC2CMessageReadNotice from:").concat(i," lastReadTime:").concat(u));var l="".concat(f.CONV_C2C).concat(i);a.updateIsReadAfterReadReport({conversationID:l,lastMessageTime:u}),a.updateUnreadCount(l)})}})}},{key:"onC2CMessageModified",value:function(e){h.d("".concat(this._n,".onC2CMessageModified options:"),JSON.stringify(e));var n=this.getModule(P);e.dataList.forEach(function(o){n.onMessageModified(m(m({},o),{},{conversationType:f.CONV_C2C}))})}},{key:"onReadReceiptList",value:function(e){h.d("".concat(this._n,".onReadReceiptList options:"),JSON.stringify(e));var n=e.dataList,o=n.userID,a=n.readReceiptList;this.getModule(P).updateReadReceiptInfo({userID:o,readReceiptList:a})}},{key:"sendMessage",value:function(e,n){var o=this._createC2CMessagePack(e,n);return this.request(o)}},{key:"_createC2CMessagePack",value:function(e,n){var o=null;n&&(n.offlinePushInfo&&(o=n.offlinePushInfo),n.onlineUserOnly===!0&&(o?o.disablePush=!0:o={disablePush:!0}));var a="";z(e.cloudCustomData)&&e.cloudCustomData.length>0&&(a=e.cloudCustomData);var r=[];if(ne(n)&&ne(n.messageControlInfo)){var i=n.messageControlInfo,u=i.excludedFromUnreadCount,l=i.excludedFromLastMessage,d=i.excludedFromContentModeration;u===!0&&r.push("NoUnread"),l===!0&&r.push("NoLastMsg"),d===!0&&r.push("NoMsgCheck")}var p=this.isOnlineMessage(e,n)?0:void 0;return{protocolName:ao,tjgID:this.generateTjgID(e),requestData:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:e.getElements(),cloudCustomData:a,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:p,nick:e.nick,avatar:e.avatar,offlinePushInfo:o?{pushFlag:o.disablePush===!0?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:o.ignoreIOSBadge===!0?1:0,isVoipPush:this._isVoipPush(o)},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,messageControlInfo:p!==0?r:void 0,clientTime:e.clientTime,needReadReceipt:e.needReadReceipt===!0?1:0,isSupportExtension:e.isSupportExtension===!0?1:0}}}},{key:"_isVoipPush",value:function(e){var n=void 0;return S(e.disableVoipPush)||(n=e.disableVoipPush===!1?1:0),n}},{key:"isOnlineMessage",value:function(e,n){return!(!n||n.onlineUserOnly!==!0)}},{key:"revokeMessage",value:function(e){return this.request({protocolName:Ws,requestData:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}},{key:"deleteMessage",value:function(e){var n=e.to,o=e.keyList;return h.l("".concat(this._n,".deleteMessage toAccount:").concat(n," count:").concat(o.length)),this.request({protocolName:Xs,requestData:{fromAccount:this.getMyUserID(),to:n,keyList:o}})}},{key:"modifyRemoteMessage",value:function(e){var n=e.from,o=e.to,a=e.version,r=a===void 0?0:a,i=e.sequence,u=e.random,l=e.time,d=e.payload,p=e.type,g=e.cloudCustomData,_=void 0;return ks(p)&&(_=[]).push({type:p,content:d}),this.request({protocolName:io,requestData:{from:n,to:o,version:r,sequence:i,random:u,time:l,elements:_,cloudCustomData:g}})}},{key:"setMessageRead",value:function(e){var n=this,o=e.conversationID,a=e.lastMessageTime,r="".concat(this._n,".setMessageRead");h.l("".concat(r," conversationID:").concat(o," lastMessageTime:").concat(a)),ee(a)||this.outputWarning("DoNotModifyLastTime");var i=new L("setC2CMessageRead");return i.setMessage("conversationID:".concat(o," lastMessageTime:").concat(a)),this.request({protocolName:Ys,requestData:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:o.replace("C2C",""),lastMessageTime:a,receipt:1}]}}}).then(function(){i.setNetworkType(n.getNetworkType()).end(),h.l("".concat(r," ok"));var u=n.getModule(P);return u.updateIsReadAfterReadReport({conversationID:o,lastMessageTime:a}),u.updateUnreadCount(o),x()}).catch(function(u){return n.probeNetwork().then(function(l){var d=N(l,2),p=d[0],g=d[1];i.setError(u,p,g).end()}),h.l("".concat(r," failed. error:"),u),T(u)})}},{key:"getRoamingMessage",value:function(e){var n=this,o="".concat(this._n,".getRoamingMessage"),a=e.peerAccount,r=e.conversationID,i=e.count,u=e.lastMessageTime,l=e.messageKey,d="peerAccount:".concat(a," count:").concat(i||15," lastMessageTime:").concat(u||0," messageKey:").concat(l);h.l("".concat(o," ").concat(d));var p=new L("getC2CRoamingMessages");return this.request({protocolName:Cn,requestData:{peerAccount:a,count:i||15,lastMessageTime:u||0,messageKey:l}}).then(function(g){var _=g.data,v=_.complete,M=_.messageList,y=_.messageKey,C=_.lastMessageTime;S(M)?h.l("".concat(o," ok. complete:").concat(v," but messageList is undefined!")):h.l("".concat(o," ok. complete:").concat(v," count:").concat(M.length)),p.setNetworkType(n.getNetworkType()).setMessage("".concat(d," complete:").concat(v," length:").concat(M.length)).end();var D=n.getModule(P);v===1&&D.setCompleted(r);var E=D.onRoamingMessage(M,r);D.modifyMessageList(r),D.updateIsRead(r),D.updateRoamingMessageKeyAndTime(r,y,C);var A=D.getPeerReadTime(r);if(h.l("".concat(o," update isPeerRead property. conversationID:").concat(r," peerReadTime:").concat(A)),A)D.updateMessageIsPeerReadProperty(r,A);else{var O=r.replace(f.CONV_C2C,"");n.getRemotePeerReadTime([O]).then(function(){D.updateMessageIsPeerReadProperty(r,D.getPeerReadTime(r))})}var U="";if(E.length>0)U=E[0].ID;else{var K=D.getLocalOldestMessage(r);K&&(U=K.ID)}return h.l("".concat(o," nextReqID:").concat(U," stored message count:").concat(E.length)),{nextReqID:U,storedMessageList:E}}).catch(function(g){return n.probeNetwork().then(function(_){var v=N(_,2),M=v[0],y=v[1];p.setMessage(d).setError(g,M,y).end()}),h.w("".concat(o," failed. error:"),g),T(g)})}},{key:"getRoamingMessagesHopping",value:function(e){var n=this,o="".concat(this._n,".getRoamingMessagesHopping"),a=e.peerAccount,r=e.time,i=r===void 0?0:r,u=e.count,l=e.direction,d="".concat(f.CONV_C2C).concat(a),p="peerAccount:".concat(a," count:").concat(u," time:").concat(i," direction:").concat(l);h.l("".concat(o," ").concat(p));var g=new L("getC2CRoamingMessagesHopping");return this.request({protocolName:Cn,requestData:{peerAccount:a,count:u+1,lastMessageTime:i,direction:l}}).then(function(_){var v=_.data,M=v.complete,y=v.messageList,C=y===void 0?[]:y,D=v.lastMessageTime;h.l("".concat(o," ok. complete:").concat(M," count:").concat(C.length)),g.setNetworkType(n.getNetworkType()).setMessage("".concat(p," complete:").concat(M," length:").concat(C.length)).end(),M!==1&&(l===1?C.pop():C.shift());var E=n.getModule(P).onRoamingMessage(C,d,!1);n._modifyMessageList(d,E);var A=n._computeResult({complete:M,lastMessageTime:D,resultList:E});return x(A)}).catch(function(_){return n.probeNetwork().then(function(v){var M=N(v,2),y=M[0],C=M[1];g.setMessage(p).setError(_,y,C).end()}),h.w("".concat(o," failed. error:"),_),T(_)})}},{key:"_computeResult",value:function(e){var n=e.complete,o=n===void 0?0:n,a=e.lastMessageTime,r=e.resultList,i={messageList:B(r===void 0?[]:r),isCompleted:!1,nextMessageTime:""};return o===1?(i.isCompleted=!0,i):(i.nextMessageTime=a,i)}},{key:"_modifyMessageList",value:function(e,n){var o=this.getModule(P).getLocalConversation(e);if(o)for(var a=o.userProfile.nick,r=o.userProfile.avatar,i=this.getModule(pe).getNickAndAvatarByUserID(this.getMyUserID()),u=i.nick,l=i.avatar,d=n.length-1;d>=0;d--){var p=n[d];p.flow==="in"&&(p.nick!==a&&p.setNickAndAvatar({nick:a}),p.avatar!==r&&p.setNickAndAvatar({avatar:r})),p.flow==="out"&&(p.nick!==u&&p.setNickAndAvatar({nick:u}),p.avatar!==l&&p.setNickAndAvatar({avatar:l}))}}},{key:"getRemotePeerReadTime",value:function(e){var n=this,o="".concat(this._n,".getRemotePeerReadTime");if(R(e))return h.w("".concat(o," userIDList is empty!")),Promise.resolve();var a=new L("getPeerReadTime");return h.l("".concat(o," userIDList:").concat(e)),this.request({protocolName:Js,requestData:{userIDList:e}}).then(function(r){var i=r.data.peerReadTimeList;h.l("".concat(o," ok. peerReadTimeList:").concat(i));for(var u="",l=n.getModule(P),d=0;d<e.length;d++)u+="".concat(e[d],"-").concat(i[d]," "),i[d]>0&&l.recordPeerReadTime("C2C".concat(e[d]),i[d]);a.setNetworkType(n.getNetworkType()).setMessage(u).end()}).catch(function(r){n.probeNetwork().then(function(i){var u=N(i,2),l=u[0],d=u[1];a.setError(r,l,d).end()}),h.w("".concat(o," failed. error:"),r)})}},{key:"sendReadReceipt",value:function(e){var n=this,o=e[0].conversationID.replace(f.CONV_C2C,""),a=new L("sendC2CReadReceipt");a.setMessage("peerAccount:".concat(o));var r=this.getMyUserID(),i=e.filter(function(l){return l.from!==r&&l.needReadReceipt===!0}).map(function(l){return{fromAccount:l.from,toAccount:l.to,sequence:l.sequence,random:l.random,time:l.time,clientTime:l.clientTime}});if(i.length===0)return T({code:k.READ_RECEIPT_MESSAGE_LIST_EMPTY});var u="".concat(this._n,".sendReadReceipt");return h.l("".concat(u,". peerAccount:").concat(o," messageInfoList length:").concat(i.length)),this.request({protocolName:Aa,requestData:{peerAccount:o,messageInfoList:i}}).then(function(l){return a.end(),h.l("".concat(u," ok")),x()}).catch(function(l){return n.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];a.setError(l,g,_).end()}),h.w("".concat(u," failed. error:"),l),T(l)})}},{key:"getReadReceiptList",value:function(e){var n="".concat(this._n,".getReadReceiptList"),o=this.getMyUserID(),a=e.filter(function(r){return r.from===o&&r.needReadReceipt===!0});return h.l("".concat(n," userID:").concat(o," messageList length:").concat(a.length)),Y({messageList:a})}},{key:"getMessageExtensions",value:function(e,n){return h.l("".concat(this._n,".getMessageExtensions startSequence:").concat(n)),this.request({protocolName:Qs,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),startSequence:n}})}},{key:"modifyMessageExtensions",value:function(e,n){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;return h.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(o)),this.request({protocolName:Zs,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),extensionList:n,operateType:o}})}},{key:"_getMessageKey",value:function(e){var n=e.clientSequence,o=e.random,a=e.time;return"".concat(n,"_").concat(o,"_").concat(a)}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._messageFromUnreadDBMap.clear(),this._signalingFromUnreadDBList.length=0}}]),s}(le),Ji=function(){function c(){F(this,c),this.list=new Map,this._n="MessageListHandler",this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map}return q(c,[{key:"getLocalOldestMessageByConversationID",value:function(t){if(!t||!this.list.has(t))return null;var s=this.list.get(t).values();return s?s.next().value:null}},{key:"pushIn",value:function(t){var s=arguments.length>1&&arguments[1]!==void 0&&arguments[1],e=t.conversationID,n=!0;this.list.has(e)||this.list.set(e,new Map);var o=this._getUniqueIDOfMessage(t),a=this.list.get(e).has(o);if(a){var r=this.list.get(e).get(o);if(!s||r.isModified===!0)return n=!1}return this.list.get(e).set(o,t),this._setLatestMessageSentByPeer(e,t),this._setLatestMessageSentByMe(e,t),n}},{key:"unshift",value:function(t,s){var e;if(b(t)?t.length>0&&(e=t[0].conversationID,this._unshiftMultipleMessages(t,s)):(e=t.conversationID,this._unshiftSingleMessage(t,s)),e&&e.startsWith(f.CONV_C2C)){var n=Array.from(this.list.get(e).values()),o=n.length;if(o===0)return;for(var a=o-1;a>=0;a--)if(n[a].flow==="out"){this._setLatestMessageSentByMe(e,n[a]);break}for(var r=o-1;r>=0;r--)if(n[r].flow==="in"){this._setLatestMessageSentByPeer(e,n[r]);break}}}},{key:"_unshiftSingleMessage",value:function(t,s){var e=t.conversationID,n=this._getUniqueIDOfMessage(t);if(!this.list.has(e))return this.list.set(e,new Map),this.list.get(e).set(n,t),void s.push(t);var o=this.list.get(e),a=Array.from(o);o.has(n)||(a.unshift([n,t]),this.list.set(e,new Map(a)),s.push(t))}},{key:"_unshiftMultipleMessages",value:function(t,s){for(var e=t.length,n=[],o=t[0].conversationID,a=this.list.get(o),r=this.list.has(o)?Array.from(a):[],i=0;i<e;i++){var u=this._getUniqueIDOfMessage(t[i]);a&&a.has(u)||(n.push([u,t[i]]),s.push(t[i]))}this.list.set(o,new Map(n.concat(r)))}},{key:"remove",value:function(t){var s=t.conversationID,e=this._getUniqueIDOfMessage(t);this.list.has(s)&&this.list.get(s).delete(e)}},{key:"revoke",value:function(t,s,e){if(h.d("revoke message",t,s,e),this.list.has(t)){var n,o=Ee(this.list.get(t));try{for(o.s();!(n=o.n()).done;){var a=N(n.value,2)[1];if(a.sequence===s&&(S(e)||a.random===e))return a.isRevoked||(a.isRevoked=!0),a}}catch(r){o.e(r)}finally{o.f()}}return null}},{key:"removeByConversationID",value:function(t){this.list.has(t)&&(this.list.delete(t),this._latestMessageSentByPeerMap.delete(t),this._latestMessageSentByMeMap.delete(t))}},{key:"findMessage",value:function(t){var s,e=null,n=Ee(this.list);try{for(n.s();!(s=n.n()).done;)for(var o=B(N(s.value,2)[1].values()),a=o.length,r=0;r<a;r++)if(o[r].ID===t){e=o[r];break}}catch(i){n.e(i)}finally{n.f()}return e}},{key:"updateMessageIsPeerReadProperty",value:function(t,s){var e=[];if(this.list.has(t)){var n,o=Ee(this.list.get(t));try{for(o.s();!(n=o.n()).done;){var a=N(n.value,2)[1];a.time<=s&&!a.isPeerRead&&a.flow==="out"&&(a.isPeerRead=!0,e.push(a))}}catch(r){o.e(r)}finally{o.f()}h.l("".concat(this._n,".updateMessageIsPeerReadProperty conversationID:").concat(t," peerReadTime:").concat(s," count:").concat(e.length))}return e}},{key:"updateMessageIsModifiedProperty",value:function(t){var s=t.conversationID;if(this.list.has(s)){var e=this._getUniqueIDOfMessage(t),n=this.list.get(s).get(e);n&&(n.isModified=!0)}}},{key:"hasLocalMessageList",value:function(t){return this.list.has(t)}},{key:"getLocalMessageList",value:function(t){return this.hasLocalMessageList(t)?B(this.list.get(t).values()):[]}},{key:"hasLocalMessage",value:function(t,s){for(var e=!1,n=this.getLocalMessageList(t),o=n.length,a=0;a<o;a++)n[a].ID===s&&(e=!0);return e}},{key:"getLocalMessage",value:function(t,s){for(var e=null,n=this.getLocalMessageList(t),o=n.length,a=0;a<o;a++)if(n[a].ID===s){e=n[a];break}return e}},{key:"getLocalLastMessage",value:function(t){var s=this.getLocalMessageList(t);return s[s.length-1]}},{key:"getLocalOldestMessage",value:function(t){return this.getLocalMessageList(t)[0]}},{key:"_setLatestMessageSentByPeer",value:function(t,s){t.startsWith(f.CONV_C2C)&&s.flow==="in"&&this._latestMessageSentByPeerMap.set(t,s)}},{key:"_setLatestMessageSentByMe",value:function(t,s){t.startsWith(f.CONV_C2C)&&s.flow==="out"&&this._latestMessageSentByMeMap.set(t,s)}},{key:"getLatestMessageSentByPeer",value:function(t){return this._latestMessageSentByPeerMap.get(t)}},{key:"getLatestMessageSentByMe",value:function(t){return this._latestMessageSentByMeMap.get(t)}},{key:"modifyMessageSentByPeer",value:function(t){var s=t.conversationID,e=t.latestNick,n=t.latestAvatar,o=this.list.get(s);if(!R(o)){var a=Array.from(o.values()),r=a.length;if(r!==0){for(var i=null,u=0,l=!1,d=r-1;d>=0;d--)a[d].flow==="in"&&((i=a[d]).nick!==e&&(i.setNickAndAvatar({nick:e}),l=!0),i.avatar!==n&&(i.setNickAndAvatar({avatar:n}),l=!0),l&&(u+=1));h.l("".concat(this._n,".modifyMessageSentByPeer conversationID:").concat(s," count:").concat(u))}}}},{key:"modifyMessageSentByMe",value:function(t){var s=t.conversationID,e=t.latestNick,n=t.latestAvatar,o=this.list.get(s);if(!R(o)){var a=Array.from(o.values()),r=a.length;if(r!==0){for(var i=null,u=0,l=!1,d=r-1;d>=0;d--)a[d].flow==="out"&&((i=a[d]).nick!==e&&(i.setNickAndAvatar({nick:e}),l=!0),i.avatar!==n&&(i.setNickAndAvatar({avatar:n}),l=!0),l&&(u+=1));h.l("".concat(this._n,".modifyMessageSentByMe conversationID:").concat(s," count:").concat(u))}}}},{key:"getTopicConversationIDList",value:function(t){return B(this.list.keys()).filter(function(s){return s.startsWith("".concat(f.CONV_GROUP).concat(t))})}},{key:"traversal",value:function(){if(this.list.size!==0&&h.getLevel()===-1){console.group("conversationID-messageCount");var t,s=Ee(this.list);try{for(s.s();!(t=s.n()).done;){var e=N(t.value,2),n=e[0],o=e[1];console.log("".concat(n,"-").concat(o.size))}}catch(a){s.e(a)}finally{s.f()}console.groupEnd()}}},{key:"onMessageModified",value:function(t,s){if(!this.list.has(t))return{isUpdated:!1,message:null};var e=this._getUniqueIDOfMessage(s),n=this.list.get(t).has(e);if(h.d("".concat(this._n,".onMessageModified conversationID:").concat(t," uniqueID:").concat(e," has:").concat(n)),n){var o=this.list.get(t).get(e),a=s.messageVersion,r=s.elements,i=s.cloudCustomData;return o.version<a?(o.version=a,o._elements=JSON.parse(JSON.stringify(r)),o.payload=JSON.parse(JSON.stringify(r[0].content)),o.type=r[0].type,o.cloudCustomData=i,o.isModified=!0,{isUpdated:!0,message:o}):{isUpdated:!1,message:o}}return{isUpdated:!1,message:null}}},{key:"_getUniqueIDOfMessage",value:function(t){var s=t.from,e=t.to,n=t.random,o=t.sequence,a=t.time;return"".concat(s,"-").concat(e,"-").concat(n,"-").concat(o,"-").concat(a)}},{key:"reset",value:function(){this.list.clear(),this._latestMessageSentByPeerMap.clear(),this._latestMessageSentByMeMap.clear()}}]),c}(),ot="_a2KeyAndTinyIDUpdated",We="_cloudConfigUpdated",So="_profileUpdated";function Eo(c){this.mixin(c)}Eo.mixin=function(c){var t=c.prototype||c;t._isReady=!1,t.ready=function(s){var e=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(s)return this._isReady?void(e?s.call(this):setTimeout(s,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(s))},t.triggerReady=function(){var s=this;this._isReady=!0,setTimeout(function(){var e=s._readyQueue;s._readyQueue=[],e&&e.length>0&&e.forEach(function(n){n.call(this)},s)},1)},t.resetReady=function(){this._isReady=!1,this._readyQueue=[]},t.isReady=function(){return this._isReady}};var Xi=["jpg","jpeg","gif","png","bmp","image","webp"],Zi=["mp4","quicktime","mov"],Qi=1,$i=2,eu=3,tu=255,Sn=function(){function c(t){var s=this;F(this,c),R(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||f.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||f.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],R(t.profileCustomField)||t.profileCustomField.forEach(function(e){s.profileCustomField.push({key:e.key,value:e.value})}))}return q(c,[{key:"validate",value:function(t){var s=!0,e="";if(R(t))return{valid:!1,tips:"empty options"};if(t.profileCustomField)for(var n=t.profileCustomField.length,o=null,a=0;a<n;a++){if(o=t.profileCustomField[a],!z(o.key)||o.key.indexOf("Tag_Profile_Custom")===-1)return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!z(o.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(r==="profileCustomField")continue;if(R(t[r])&&!z(t[r])&&!ee(t[r])){e="key:"+r+", invalid value:"+t[r],s=!1;continue}switch(r){case"nick":z(t[r])||(e="nick must be a string",s=!1),_s(t[r])>500&&(e="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(_s(t[r])," bytes"),s=!1);break;case"gender":Wn(Di,t.gender)||(e="key:gender, invalid value:"+t.gender,s=!1);break;case"birthday":ee(t.birthday)||(e="birthday must be a number",s=!1);break;case"location":z(t.location)||(e="location must be a string",s=!1);break;case"selfSignature":z(t.selfSignature)||(e="selfSignature must be a string",s=!1);break;case"allowType":Wn(Si,t.allowType)||(e="key:allowType, invalid value:"+t.allowType,s=!1);break;case"language":ee(t.language)||(e="language must be a number",s=!1);break;case"avatar":z(t.avatar)||(e="avatar must be a string",s=!1);break;case"messageSettings":t.messageSettings!==0&&t.messageSettings!==1&&(e="messageSettings must be 0 or 1",s=!1);break;case"adminForbidType":Wn(ki,t.adminForbidType)||(e="key:adminForbidType, invalid value:"+t.adminForbidType,s=!1);break;case"level":ee(t.level)||(e="level must be a number",s=!1);break;case"role":ee(t.role)||(e="role must be a number",s=!1);break;default:e="unknown key:"+r+" "+t[r],s=!1}}return{valid:s,tips:e}}}]),c}(),nu=q(function c(t){F(this,c),this.value=t,this.next=null}),Lo=function(){function c(t){F(this,c),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map}return q(c,[{key:"set",value:function(t){var s=new nu(t);if(this.map.size<this.MAX_LENGTH)this.pTail===null?(this.pTail=s,this.pNodeToDel=s):(this.pTail.next=s,this.pTail=s),this.map.set(t,1);else{var e=this.pNodeToDel;this.pNodeToDel=this.pNodeToDel.next,this.map.delete(e.value),e.next=null,e=null,this.pTail.next=s,this.pTail=s,this.map.set(t,1)}}},{key:"has",value:function(t){return this.map.has(t)}},{key:"delete",value:function(t){this.has(t)&&this.map.delete(t)}},{key:"tail",value:function(){return this.pTail}},{key:"size",value:function(){return this.map.size}},{key:"data",value:function(){return Array.from(this.map.keys())}},{key:"reset",value:function(){for(var t;this.pNodeToDel!==null;)t=this.pNodeToDel,this.pNodeToDel=this.pNodeToDel.next,t.next=null,t=null;this.pTail=null,this.map.clear()}}]),c}(),ou=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"],vt=function(){function c(t){F(this,c),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)}return q(c,[{key:"memberNum",get:function(){return this.memberCount},set:function(t){}},{key:"maxMemberNum",get:function(){return this.maxMemberCount},set:function(t){}},{key:"_initGroup",value:function(t){for(var s in t)ou.indexOf(s)<0||(s!=="selfInfo"?(s==="memberNum"&&(this.memberCount=t[s]),s==="maxMemberNum"&&(this.maxMemberCount=t[s]),s!=="isSupportTopic"?this[s]=t[s]:this.isSupportTopic=t[s]===1):this.updateSelfInfo(t[s]))}},{key:"updateGroup",value:function(t){var s=this;t.appid=void 0,t.grossTopicNextMsgSeq=void 0,t.selfInfo&&(t.selfInfo.grossTopicReadSeq=void 0);var e=JSON.parse(JSON.stringify(t));e.lastMsgTime&&(this.lastMessage.lastTime=e.lastMsgTime),S(e.muteAllMembers)||(e.muteAllMembers==="On"?e.muteAllMembers=!0:e.muteAllMembers=!1),e.groupCustomField&&hn(this.groupCustomField,e.groupCustomField),S(e.memberNum)||(this.memberCount=e.memberNum),S(e.maxMemberNum)||(this.maxMemberCount=e.maxMemberNum),S(e.isSupportTopic)||(this.isSupportTopic=ee(e.isSupportTopic)?e.isSupportTopic===1:e.isSupportTopic),$e(this,e,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),b(e.members)&&e.members.length>0&&e.members.forEach(function(n){n.userID===s.selfInfo.userID&&$e(s.selfInfo,n,["sequence"])})}},{key:"updateSelfInfo",value:function(t){var s={nameCard:t.nameCard,joinTime:t.joinTime,role:t.role,messageRemindType:t.messageRemindType,readedSequence:t.readedSequence,excludedUnreadSequenceList:t.excludedUnreadSequenceList};$e(this.selfInfo,m({},s),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(t){this.selfInfo.nameCard=t}}]),c}(),Tr=function(c,t){return S(c)?{lastTime:0,lastSequence:0,fromAccount:0,messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}:c instanceof ve?{lastTime:c.time||0,lastSequence:c.sequence||0,fromAccount:c.from||"",messageForShow:Ht(c.type,c.payload,t),payload:c.payload||null,type:c.type||null,isRevoked:c.isRevoked||!1,cloudCustomData:c.cloudCustomData||"",onlineOnlyFlag:c._onlineOnlyFlag||!1,nick:c.nick||"",nameCard:c.nameCard||"",version:c.version||0,isPeerRead:c.isPeerRead||!1,revoker:c.revoker||null}:m(m({},c),{},{messageForShow:Ht(c.type,c.payload,t)})},En=function(){function c(t,s){F(this,c),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=Tr(t.lastMessage,s),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark="",this.isPinned=t.isPinned||!1,this.messageRemindType="",this.markList=t.markList||[],this.customData=t.customData||"",this.conversationGroupList=t.conversationGroupList||[],this._initProfile(t)}return q(c,[{key:"toAccount",get:function(){return this.conversationID.startsWith(f.CONV_C2C)?this.conversationID.replace(f.CONV_C2C,""):this.conversationID.startsWith(f.CONV_GROUP)?this.conversationID.replace(f.CONV_GROUP,""):""}},{key:"subType",get:function(){return this.groupProfile?this.groupProfile.type:""}},{key:"_initProfile",value:function(t){var s=this;Object.keys(t).forEach(function(e){switch(e){case"userProfile":s.userProfile=t.userProfile;break;case"groupProfile":s.groupProfile=t.groupProfile}}),S(this.userProfile)&&this.type===f.CONV_C2C?this.userProfile=new Sn({userID:t.conversationID.replace("C2C","")}):S(this.groupProfile)&&this.type===f.CONV_GROUP&&(this.groupProfile=new vt({groupID:t.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(t){var s=t.nextUnreadCount,e=t.isFromGetConversations,n=t.isUnreadC2CMessage;S(s)||(xe(this.subType)?this.unreadCount=0:e&&this.type===f.CONV_GROUP||e&&this.type===f.CONV_TOPIC||n&&this.type===f.CONV_C2C?this.unreadCount=s:this.unreadCount=this.unreadCount+s)}},{key:"updateLastMessage",value:function(t){this.lastMessage=Tr(t)}},{key:"updateGroupAtInfoList",value:function(t){if(!this._isNeedMergeGroupAtInfo(t)){var s,e=(Yo(s=t.groupAtType)||jo(s)||cn(s)||zo()).slice(0);e.indexOf(f.CONV_AT_ME)!==-1&&e.indexOf(f.CONV_AT_ALL)!==-1&&(e=[f.CONV_AT_ALL_AT_ME]);var n={from:t.from,groupID:t.groupID,topicID:t.topicID,messageSequence:t.sequence,atTypeArray:e,__random:t.__random,__sequence:t.__sequence};this.groupAtInfoList.push(n)}}},{key:"_isNeedMergeGroupAtInfo",value:function(t){var s=t.groupID,e=t.sequence;if(!Oe({groupID:s}))return!1;var n=!1;return this.groupAtInfoList.forEach(function(o){o.messageSequence===e&&(o.atTypeArray.indexOf(f.CONV_AT_ME)>-1&&t.groupAtType.indexOf(f.CONV_AT_ALL)>-1&&(o.atTypeArray=[f.CONV_AT_ALL_AT_ME]),o.atTypeArray.indexOf(f.CONV_AT_ALL)>-1&&t.groupAtType.indexOf(f.CONV_AT_ME)>-1&&(o.atTypeArray=[f.CONV_AT_ALL_AT_ME],o.__random=t.__random,o.__sequence=t.__sequence),n=!0)}),n}},{key:"clearGroupAtInfoList",value:function(){this.groupAtInfoList.length=0}},{key:"reduceUnreadCount",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:"isLastMessageRevoked",value:function(t){var s=t.sequence,e=t.time;return this.type===f.CONV_C2C&&s===this.lastMessage.lastSequence&&e===this.lastMessage.lastTime||this.type===f.CONV_GROUP&&s===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(t){this.lastMessage.isRevoked=t}},{key:"setLastMessageRevoker",value:function(t){this.lastMessage.revoker=t}}]),c}(),su=function(){function c(t){F(this,c),this._conversationModule=t,this._n="MessageRemindHandler",this._updateSequence=0}return q(c,[{key:"getC2CMessageRemindType",value:function(){var t=this,s="".concat(this._n,".getC2CMessageRemindType");return this._conversationModule.request({protocolName:zs,updateSequence:this._updateSequence}).then(function(e){h.l("".concat(s," ok"));var n=e.data,o=n.updateSequence,a=n.muteFlagList;t._updateSequence=o,t._patchC2CMessageRemindType(a)}).catch(function(e){h.e("".concat(s," failed. error:"),e)})}},{key:"_patchC2CMessageRemindType",value:function(t){var s=this,e=0,n="";b(t)&&t.length>0&&t.forEach(function(o){var a=o.userID,r=o.muteFlag;r===0?n=f.MSG_REMIND_ACPT_AND_NOTE:r===1?n=f.MSG_REMIND_DISCARD:r===2&&(n=f.MSG_REMIND_ACPT_NOT_NOTE),s._conversationModule.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:n})===!0&&(e+=1)}),h.l("".concat(this._n,"._patchC2CMessageRemindType count:").concat(e))}},{key:"set",value:function(t){return t.groupID?this._setGroupMessageRemindType(t):b(t.userIDList)?this._setC2CMessageRemindType(t):void 0}},{key:"_setGroupMessageRemindType",value:function(t){var s=this,e="".concat(this._n,"._setGroupMessageRemindType"),n=t.groupID,o=t.messageRemindType,a="groupID:".concat(n," messageRemindType:").concat(o),r=new L("setMessageRemindType");return r.setMessage(a),this._getModule(me).modifyGroupMemberInfo({groupID:n,messageRemindType:o,userID:this._conversationModule.getMyUserID()}).then(function(){r.setNetworkType(s._conversationModule.getNetworkType()).end(),h.l("".concat(e," ok. ").concat(a));var i=s.onGroupMessageRemindTypeUpdated(t);return s._conversationModule.emitTotalUnreadMessageCountUpdate(),x(i)}).catch(function(i){return s._conversationModule.probeNetwork().then(function(u){var l=N(u,2),d=l[0],p=l[1];r.setError(i,d,p).end()}),h.e("".concat(e," failed. error:"),i),T(i)})}},{key:"onGroupMessageRemindTypeUpdated",value:function(t){var s=t.groupID,e=t.messageRemindType,n=this._getModule(V).getLocalGroupProfile(s);if(n&&(n.selfInfo.messageRemindType=e),Le(s)){var o=s,a=Ie(o),r=this._getModule(ae).getLocalTopic(a,o);return r&&(r.updateSelfInfo({messageRemindType:e}),this._conversationModule.emitOuterEvent(W.TOPIC_UPDATED,{groupID:a,topic:r})),{topic:r}}return this._conversationModule.patchMessageRemindType({ID:s,isC2CConversation:!1,messageRemindType:e})&&this._emitConversationUpdate(),{group:n}}},{key:"_setC2CMessageRemindType",value:function(t){var s=this,e="".concat(this._n,"._setC2CMessageRemindType"),n=t.userIDList,o=t.messageRemindType,a=n.slice(0,30),r=0;o===f.MSG_REMIND_DISCARD?r=1:o===f.MSG_REMIND_ACPT_NOT_NOTE&&(r=2);var i="userIDList:".concat(a," messageRemindType:").concat(o),u=new L("setMessageRemindType");return u.setMessage(i),this._conversationModule.request({protocolName:js,requestData:{userIDList:a,muteFlag:r}}).then(function(l){u.setNetworkType(s._conversationModule.getNetworkType()).end();var d=l.data,p=d.updateSequence,g=d.errorList;s._updateSequence=p;var _=[],v=[];b(g)&&g.forEach(function(C){_.push(C.userID),v.push({userID:C.userID,code:C.errorCode})});var M=a.filter(function(C){return _.indexOf(C)===-1});h.l("".concat(e," ok. successUserIDList:").concat(M," failureUserIDList:").concat(JSON.stringify(v)));var y=0;return M.forEach(function(C){s._conversationModule.patchMessageRemindType({ID:C,isC2CConversation:!0,messageRemindType:o})&&(y+=1)}),y>=1&&s._emitConversationUpdate(),a.length=_.length=0,s._conversationModule.emitTotalUnreadMessageCountUpdate(),Y({successUserIDList:M.map(function(C){return{userID:C}}),failureUserIDList:v})}).catch(function(l){return s._conversationModule.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];u.setError(l,g,_).end()}),h.e("".concat(e," failed. error:"),l),T(l)})}},{key:"_getModule",value:function(t){return this._conversationModule.getModule(t)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"setUpdateSequence",value:function(t){this._updateSequence=t}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._updateSequence=0}}]),c}(),au=function(){function c(t){F(this,c),this._conversationModule=t,this._n="ConvGroupHandler",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=we.NOT_START}return q(c,[{key:"setConvCustomData",value:function(t){var s=this,e="".concat(this._n,".").concat("setConvCustomData"),n=t.conversationIDList,o=t.customData;h.l("".concat(e," options:"),t);var a=new L("setConvCustomData");a.setMessage(JSON.stringify(t));var r={fromAccount:this._getMyUserID(),itemList:[]},i=[],u=[];return n.forEach(function(l){if(!s._hasLocalConversation(l))return s._onConversationNotFound(u,l),!0;if(!Pe(l)&&!Ae(l))return s._onConversationIDInvalid(u,l),!0;var d={operationType:2,contactItem:void 0,customMark:o};Pe(l)?d.contactItem={type:1,toAccount:l.replace(f.CONV_C2C,"")}:Ae(l)&&(d.contactItem={type:2,groupID:l.replace(f.CONV_GROUP,"")}),r.itemList.push(d)}),u.length===n.length?Y({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:sa,requestData:r}).then(function(l){a.setNetworkType(s._conversationModule.getNetworkType()).end(),h.l("".concat(e," ok"));var d=l.data.resultItem;if(b(d)){var p,g,_=!1;d.forEach(function(v){p=s._concatConversationID(v.contactItem),v.resultCode===0?(i.push(p),(g=s._getLocalConversation(p))&&g.customData!==o&&(g.customData=o,_=!0)):u.push({conversationID:p,code:v.resultCode,message:v.resultInfo})}),_===!0&&s._emitConversationUpdate()}return x({successConversationIDList:i,failureConversationIDList:u})}).catch(function(l){return s._conversationModule.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];a.setError(l,g,_).end()}),h.e("".concat(e," failed. error:"),l),T(l)})}},{key:"markConversation",value:function(t){var s=this;if(!this._conversationModule.canIUse(ye.CONV_MARK))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".").concat("markConversation"),n=t.conversationIDList,o=t.markType,a=t.enableMark;h.l("".concat(e," options:"),t);var r=new L("markConversation");r.setMessage(JSON.stringify(t));var i=void 0,u=void 0,l=this._getFlagBit(o);a===!0?u=[l]:i=[l];var d={fromAccount:this._getMyUserID(),itemList:[]},p=[],g=[];return n.forEach(function(_){if(!s._hasLocalConversation(_))return s._onConversationNotFound(g,_),!0;if(!Pe(_)&&!Ae(_))return s._onConversationIDInvalid(g,_),!0;var v={operationType:1,contactItem:void 0,clearMark:i,setMark:u};Pe(_)?v.contactItem={type:1,toAccount:_.replace(f.CONV_C2C,"")}:Ae(_)&&(v.contactItem={type:2,groupID:_.replace(f.CONV_GROUP,"")}),d.itemList.push(v)}),g.length===n.length?Y({successConversationIDList:p,failureConversationIDList:g}):this._conversationModule.request({protocolName:aa,requestData:d}).then(function(_){r.setNetworkType(s._conversationModule.getNetworkType()).end(),h.l("".concat(e," ok"));var v=_.data.resultItem;if(b(v)){var M,y,C=!1;v.forEach(function(D){if(M=s._concatConversationID(D.contactItem),D.resultCode===0){if(p.push(M),y=s._getLocalConversation(M)){var E=y.markList.indexOf(o);a===!0?E===-1&&(y.markList.push(o),C=!0):E!==-1&&(y.markList.splice(E,1),C=!0)}}else g.push({conversationID:M,code:D.resultCode,message:D.resultInfo})}),C===!0&&s._emitConversationUpdate()}return x({successConversationIDList:p,failureConversationIDList:g})}).catch(function(_){return s._conversationModule.probeNetwork().then(function(v){var M=N(v,2),y=M[0],C=M[1];r.setError(_,y,C).end()}),h.e("".concat(e," failed. error:"),_),T(_)})}},{key:"getLocalConvGroupList",value:function(){var t=this;return h.l("".concat(this._n,".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===we.REJECTED?this.getRemoteConvGroupList().then(function(){return x(B(t._convGroupMap.values()))}):Y(B(this._convGroupMap.values()))}},{key:"getRemoteConvGroupList",value:function(){var t=this,s="".concat(this._n,".getRemoteConvGroupList");return this._pagingStatus=we.PENDING,this._conversationModule.request({protocolName:da,requestData:{fromAccount:this._getMyUserID(),startIndex:this._startIndex,startTime:Hn()}}).then(function(e){var n,o,a=e.data,r=a.completeFlag,i=a.contactItem,u=a.nextStartIndex,l=u===void 0?0:u,d=a.groupItem;if(t._startIndex=l,h.l("".concat(s," completeFlag:").concat(r," nextStartIndex:").concat(l)),b(d)&&d.forEach(function(p){var g=p.convGroupID,_=p.groupName;t._convGroupMap.set(g,_)}),b(i)&&i.forEach(function(p){var g=p.standardMark,_=p.customData,v=p.convGroupIDList;if(n=t._concatConversationID(p),(o=t._getLocalConversation(n))&&(o.markList=fn(g),o.customData=_||"",b(v))){var M=[];v.forEach(function(y){t._convGroupMap.has(y)&&M.push(t._convGroupMap.get(y))}),o.conversationGroupList=[].concat(M),M.length=0}}),r===0)return t.getRemoteConvGroupList();r===1&&(t._pagingStatus=we.RESOLVED,t._emitConversationUpdate(),t._emitConvGroupListUpdate())}).catch(function(e){t._pagingStatus=we.REJECTED,h.w("".concat(s," failed. error:"),e)})}},{key:"createConvGroup",value:function(t){var s=this;if(!this._conversationModule.canIUse(ye.CONV_GROUP))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".").concat("createConvGroup");h.l("".concat(e," options:"),t);var n=new L("createConvGroup");n.setMessage(JSON.stringify(t));var o=t.groupName,a=t.conversationIDList,r={fromAccount:this._getMyUserID(),itemList:[{groupName:o,contactItem:[]}]},i=[],u=[];return a.forEach(function(l){return s._hasLocalConversation(l)?Pe(l)||Ae(l)?void(Pe(l)?r.itemList[0].contactItem.push({type:1,toAccount:l.replace(f.CONV_C2C,"")}):Ae(l)&&r.itemList[0].contactItem.push({type:2,groupID:l.replace(f.CONV_GROUP,"")})):(s._onConversationIDInvalid(u,l),!0):(s._onConversationNotFound(u,l),!0)}),u.length===a.length?Y({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:ra,requestData:r}).then(function(l){n.setNetworkType(s._conversationModule.getNetworkType()).end(),h.l("".concat(e," ok"));var d=l.data.groupResultItem[0],p=d.groupItem,g=d.resultItem;if(ne(p)&&(s._convGroupMap.set(p.convGroupID,p.groupName),s._emitConvGroupListUpdate()),b(g)){var _,v,M=!1;g.forEach(function(y){_=s._concatConversationID(y.contactItem),y.resultCode===0?(i.push(_),(v=s._getLocalConversation(_))&&v.conversationGroupList.indexOf(o)===-1&&(v.conversationGroupList.push(o),M=!0)):u.push({conversationID:_,code:y.resultCode,message:y.resultInfo})}),M===!0&&(s._emitConversationUpdate(),s._emitConvGroupListUpdate())}return x({successConversationIDList:i,failureConversationIDList:u})}).catch(function(l){return s._conversationModule.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];n.setError(l,g,_).end()}),h.e("".concat(e," failed. error:"),l),T(l)})}},{key:"deleteConvGroup",value:function(t){var s=this;if(!this._conversationModule.canIUse(ye.CONV_GROUP))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".").concat("deleteConvGroup");h.l("".concat(e," groupName:").concat(t));var n=new L("deleteConvGroup");return n.setMessage(t),this._conversationModule.request({protocolName:ia,requestData:{fromAccount:this._getMyUserID(),groupName:[t]}}).then(function(o){n.setNetworkType(s._conversationModule.getNetworkType()).end(),h.l("".concat(e," ok"));var a=o.data.groupItem;if(b(a)){var r=!1;a.forEach(function(i){s._convGroupMap.has(i.convGroupID)&&(s._convGroupMap.delete(i.convGroupID),r=!0)}),r===!0&&s._emitConvGroupListUpdate()}s._eraseFromConversationGroupList([t])}).catch(function(o){return s._conversationModule.probeNetwork().then(function(a){var r=N(a,2),i=r[0],u=r[1];n.setError(o,i,u).end()}),h.e("".concat(e," failed. error:"),o),T(o)})}},{key:"renameConvGroup",value:function(t){var s=this;if(!this._conversationModule.canIUse(ye.CONV_GROUP))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".").concat("renameConvGroup");h.l("".concat(e," options:"),t);var n=new L("renameConvGroup");n.setMessage(JSON.stringify(t));var o=t.oldName,a=t.newName;return this._conversationModule.request({protocolName:ua,requestData:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:o,newName:a}}}).then(function(r){n.setNetworkType(s._conversationModule.getNetworkType()).end(),h.l("".concat(e," ok"));var i=r.data.updateGroupResult.convGroupID;s._convGroupMap.set(i,a),s._emitConvGroupListUpdate();var u,l,d=s._conversationModule.getLocalConversationList(),p=!1;d.forEach(function(g){u=g.conversationGroupList,(l=u.indexOf(o))!==-1&&(u.splice(l,1,a),p=!0)}),p===!0&&s._emitConversationUpdate()}).catch(function(r){return s._conversationModule.probeNetwork().then(function(i){var u=N(i,2),l=u[0],d=u[1];n.setError(r,l,d).end()}),h.e("".concat(e," failed. error:"),r),T(r)})}},{key:"addConvsToGroup",value:function(t){var s=this;if(!this._conversationModule.canIUse(ye.CONV_GROUP))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".").concat("addConvsToGroup");h.l("".concat(e," options:"),t);var n=new L("addConvsToGroup");n.setMessage(JSON.stringify(t));var o=t.conversationIDList,a=t.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:a,updateItem:[]}},i=[],u=[];return o.forEach(function(l){return s._hasLocalConversation(l)?Pe(l)||Ae(l)?void(Pe(l)?r.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:l.replace(f.CONV_C2C,"")}}):Ae(l)&&r.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:l.replace(f.CONV_GROUP,"")}})):(s._onConversationIDInvalid(u,l),!0):(s._onConversationNotFound(u,l),!0)}),u.length===o.length?Y({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:ca,requestData:r}).then(function(l){n.setNetworkType(s._conversationModule.getNetworkType()).end(),h.l("".concat(e," ok"));var d=l.data.updateGroupResult.contactResultItem;if(b(d)){var p,g,_=!1;d.forEach(function(v){p=s._concatConversationID(v.contactItem),v.resultCode===0?(g=s._getLocalConversation(p))&&g.conversationGroupList.indexOf(a)===-1&&(g.conversationGroupList.push(a),i.push(p),_=!0):u.push({conversationID:p,code:v.resultCode,message:v.resultInfo})}),_===!0&&(s._emitConversationUpdate(),s._emitConvInGroupUpdate(a))}return x({successConversationIDList:i,failureConversationIDList:u})}).catch(function(l){return s._conversationModule.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];n.setError(l,g,_).end()}),h.e("".concat(e," failed. error:"),l),T(l)})}},{key:"deleteConvsFromGroup",value:function(t){var s=this;if(!this._conversationModule.canIUse(ye.CONV_GROUP))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".").concat("deleteConvsFromGroup");h.l("".concat(e," options:"),t);var n=new L("deleteConvsFromGroup");n.setMessage(JSON.stringify(t));var o=t.conversationIDList,a=t.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:a,updateItem:[]}},i=[],u=[];return o.forEach(function(l){return s._hasLocalConversation(l)?Pe(l)||Ae(l)?void(Pe(l)?r.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:l.replace(f.CONV_C2C,"")}}):Ae(l)&&r.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:l.replace(f.CONV_GROUP,"")}})):(s._onConversationIDInvalid(u,l),!0):(s._onConversationNotFound(u,l),!0)}),u.length===o.length?Y({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:la,requestData:r}).then(function(l){n.setNetworkType(s._conversationModule.getNetworkType()).end(),h.l("".concat(e," ok"));var d=l.data.updateGroupResult.contactResultItem;if(b(d)){var p,g,_=!1;d.forEach(function(v){if(p=s._concatConversationID(v.contactItem),v.resultCode===0){if(g=s._getLocalConversation(p)){var M=g.conversationGroupList.indexOf(a);M!==-1&&(g.conversationGroupList.splice(M,1),i.push(p),_=!0)}}else u.push({conversationID:p,code:v.resultCode,message:v.resultInfo})}),_===!0&&(s._emitConversationUpdate(),s._emitConvInGroupUpdate(a))}return x({successConversationIDList:i,failureConversationIDList:u})}).catch(function(l){return s._conversationModule.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];n.setError(l,g,_).end()}),h.e("".concat(e," failed. error:"),l),T(l)})}},{key:"onConvMarkUpdated",value:function(t){var s=this;if(!R(t)){var e,n;h.d("".concat(this._n,".onConvMarkUpdated markItemList:"),t);var o=!1;t.forEach(function(a){var r=a.recentContactItem,i=a.optType,u=a.standardMark,l=a.customMark;if(e=s._concatConversationID(r),n=s._getLocalConversation(e))if(i===1){var d=fn(u);(function(p,g){if(p===g)return!0;if(!p||!g||p.length!==g.length)return!1;for(var _=0,v=p.length;_<v;_++)if(p[_]!==g[_])return!1;return!0})(n.markList,d)!==!0&&(n.markList=d,o=!0)}else i===2&&n.customData!==l&&l!==void 0&&(n.customData=l,o=!0)}),o===!0&&this._emitConversationUpdate()}}},{key:"onConvGroupCreated",value:function(t){var s=this;h.d("".concat(this._n,".onConvGroupCreated resultList:"),t);var e=!1,n=!1;b(t)&&(t.forEach(function(o){var a=o.msgGroupItem,r=a.groupID,i=a.groupName;s._convGroupMap.get(r)!==i&&(s._convGroupMap.set(r,i),n=!0);var u,l,d=o.msgRecentContactItem;b(d)&&d.forEach(function(p){u=s._concatConversationID(p),(l=s._getLocalConversation(u))&&l.conversationGroupList.indexOf(i)===-1&&(l.conversationGroupList.push(i),e=!0)})}),e===!0&&this._emitConversationUpdate(),n===!0&&this._emitConvGroupListUpdate())}},{key:"onConvGroupDeleted",value:function(t){var s=this;h.d("".concat(this._n,".onConvGroupDeleted groupItemList:"),t);var e=[];if(b(t)){var n=!1;t.forEach(function(o){var a=o.groupID,r=o.groupName;s._convGroupMap.has(a)&&(s._convGroupMap.delete(a),n=!0,e.push(r))}),n===!0&&this._emitConvGroupListUpdate()}this._eraseFromConversationGroupList(e)}},{key:"_eraseFromConversationGroupList",value:function(t){R(t)||(this._conversationModule.getLocalConversationList().forEach(function(s){s.conversationGroupList=s.conversationGroupList.filter(function(e){return!t.includes(e)})}),this._emitConversationUpdate())}},{key:"onConvGroupNameUpdated",value:function(t){h.d("".concat(this._n,".onConvGroupNameUpdated options:"),t);var s=t.groupID,e=t.groupName,n=t.oldGroupName;if(this._convGroupMap.get(s)!==e){this._convGroupMap.set(s,e),this._emitConvGroupListUpdate();var o,a,r=this._conversationModule.getLocalConversationList(),i=!1;r.forEach(function(u){o=u.conversationGroupList,(a=o.indexOf(n))!==-1&&(o.splice(a,1,e),i=!0)}),i===!0&&this._emitConversationUpdate()}}},{key:"onConvInGroupUpdated",value:function(t){var s=this;h.d("".concat(this._n,".onConvInGroupUpdated options:"),t);var e=t.oldGroupName,n=t.recentContactUpdateGroupItem;if(b(n)){var o,a,r,i=!1;n.forEach(function(u){var l=u.contactOptType,d=u.recentContactItem;o=s._concatConversationID(d),(a=s._getLocalConversation(o))&&(r=a.conversationGroupList.indexOf(e),l===1?r===-1&&(a.conversationGroupList.push(e),i=!0):l===2&&r!==-1&&(a.conversationGroupList.splice(r,1),i=!0))}),i===!0&&(this._emitConversationUpdate(),this._emitConvInGroupUpdate(e))}}},{key:"onConvAddedToOrDeletedFromGroup",value:function(t){var s=this;h.d("".concat(this._n,".onConvAddedToOrDeletedFromGroup options:"),t);var e=t.msgRecentContactItem,n=t.msgRecentContactUpdateContactItem,o=this._concatConversationID(e),a=this._getLocalConversation(o);if(a&&b(n)){var r,i=!1;n.forEach(function(u){var l=u.groupOptType,d=u.recentContactGroupItem.groupName;r=a.conversationGroupList.indexOf(d),l===1?r===-1&&(a.conversationGroupList.push(d),i=!0):l===2&&r!==-1&&(a.conversationGroupList.splice(r,1),i=!0),i===!0&&s._emitConvInGroupUpdate(d)}),i===!0&&this._emitConversationUpdate()}}},{key:"onConvGroupListSynced",value:function(t){var s=this;b(t)&&t.length!==0&&(h.l("".concat(this._n,".onConvGroupListSynced groupItemList:"),t),t.forEach(function(e){s._convGroupMap.set(e.convGroupID,e.groupName)}))}},{key:"getConvGroupListByID",value:function(t){var s=this;if(!R(t)){var e=[];return t.forEach(function(n){s._convGroupMap.has(n)&&e.push(s._convGroupMap.get(n))}),e}}},{key:"_onConversationNotFound",value:function(t,s){t.push({conversationID:s,code:k.CONVERSATION_NOT_FOUND,message:this._conversationModule.getErrorMessage(k.CONVERSATION_NOT_FOUND)})}},{key:"_onConversationIDInvalid",value:function(t,s){t.push({conversationID:s,code:k.INVALID_CONVERSATION_ID,message:this._conversationModule.getErrorMessage(k.INVALID_CONVERSATION_ID)})}},{key:"_getFlagBit",value:function(t){for(var s=t.toString(2),e=s.length,n=e-1;n>=0;n--)if(s[n]==="1")return e-n-1}},{key:"_concatConversationID",value:function(t){var s,e=t.type,n=t.to,o=t.groupID,a=t.userID;return e===1?S(a)?S(n)||(s="".concat(f.CONV_C2C).concat(n)):s="".concat(f.CONV_C2C).concat(a):e===2&&(s="".concat(f.CONV_GROUP).concat(o)),s}},{key:"_getMyUserID",value:function(){return this._conversationModule.getMyUserID()}},{key:"_insertConversationGroup",value:function(t,s){var e=this._getLocalConversation(t);if(e){var n=e.conversationGroupList;n.indexOf(s)===-1&&n.push(s)}}},{key:"_getLocalConversation",value:function(t){return this._conversationModule.getLocalConversation(t)}},{key:"_hasLocalConversation",value:function(t){return this._conversationModule.hasLocalConversation(t)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"_emitConvGroupListUpdate",value:function(){this._conversationModule.emitOuterEvent(W.CONVERSATION_GROUP_LIST_UPDATED,B(this._convGroupMap.values()))}},{key:"_emitConvInGroupUpdate",value:function(t){var s={groupName:t,conversationList:[]},e=this._conversationModule.getLocalConversationList();s.conversationList=e.filter(function(n){return n.conversationGroupList.includes(t)}),this._conversationModule.emitOuterEvent(W.CONVERSATION_IN_GROUP_UPDATED,s)}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=we.NOT_START}}]),c}(),ru=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="ConversationModule",Eo.mixin($(n)),n._messageListHandler=new Ji,n._messageRemindHandler=new su($(n)),n._convGroupHandler=new au($(n)),n.singlyLinkedList=new Lo(100),n._pagingStatus=we.NOT_START,n._pagingTimeStamp=0,n._pagingStartIndex=0,n._pagingPinnedTimeStamp=0,n._pagingPinnedStartIndex=0,n._pagingConvIDMap=new Map,n._convIDFromUnreadDBMap=new Map,n._conversationMap=new Map,n._tmpGroupList=[],n._tmpGroupAtTipsList=[],n._peerReadTimeMap=new Map,n._completedMap=new Map,n._roamingMessageKeyAndTimeMap=new Map,n._roamingMessageSequenceMap=new Map,n._remoteGroupReadSequenceMap=new Map,n._convTotalUnreadCount=0,n._pagingGetCostList=[],n._initListeners(),n}return q(s,[{key:"_initListeners",value:function(){var e=this.getInnerEmitterInstance();e.on(ot,this._initLocalConversationList,this),e.on(So,this._onProfileUpdated,this)}},{key:"onCheckTimer",value:function(e){e%60==0&&this._messageListHandler.traversal()}},{key:"_initLocalConversationList",value:function(){var e=this,n=new L("_initLocalConversationList");h.l("".concat(this._n,".").concat("_initLocalConversationList"));var o="",a=this._getStorageConversationList(),r=this.isIntl();if(a){for(var i=a.length,u=0;u<i;u++){var l=a[u];if(l){if(l.conversationID==="".concat(f.CONV_C2C,"@TLS#ERROR")||l.conversationID==="".concat(f.CONV_C2C,"@TLS#NOT_FOUND"))continue;if(l.groupProfile){var d=l.groupProfile.type;if(xe(d))continue}}this._conversationMap.set(a[u].conversationID,new En(a[u],r))}this.emitConversationUpdate(!0,!1),o="count:".concat(i)}else o="count:0";n.setNetworkType(this.getNetworkType()).setMessage(o).end(),this.getModule(fe)||this.triggerReady(),this.ready(function(){e._tmpGroupList.length>0&&(e.updateConversationGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)}),this.syncConversationList()}},{key:"onMessageSent",value:function(e){this._onSendOrReceiveMessage({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:"onNewMessage",value:function(e){this._onSendOrReceiveMessage(e)}},{key:"_onSendOrReceiveMessage",value:function(e){var n=this,o=e.conversationOptionsList,a=e.isInstantMessage,r=a===void 0||a,i=e.isUnreadC2CMessage,u=i!==void 0&&i,l=e.updateUnreadCount,d=l===void 0||l;this._isReady?o.length!==0&&(this._getC2CPeerReadTime(o),this._updateLocalConversationList({conversationOptionsList:o,isInstantMessage:r,isUnreadC2CMessage:u,isFromGetConversations:!1,updateUnreadCount:d}),r||(this._convIDFromUnreadDBMap=new Map([].concat(B(this._convIDFromUnreadDBMap),B(o.map(function(p){return[p.conversationID,1]})))),this._diffAndDeleteConversation()),this._setStorageConversationList(),o.filter(function(p){return p.type===f.CONV_TOPIC}).length>0||this.emitConversationUpdate()):this.ready(function(){n._onSendOrReceiveMessage(e)})}},{key:"updateConversationGroupProfile",value:function(e){var n=this;if(!b(e)||e.length!==0)if(this._conversationMap.size!==0){var o=!1;e.forEach(function(a){var r="GROUP".concat(a.groupID);if(n._conversationMap.has(r)){o=!0;var i=n._conversationMap.get(r);i.groupProfile=JSON.parse(JSON.stringify(a)),i.lastMessage.lastSequence<a.nextMessageSeq&&(i.lastMessage.lastSequence=a.nextMessageSeq-1),i.subType||(i.subType=a.type)}}),o&&this.emitConversationUpdate(!0,!1)}else this._tmpGroupList=e}},{key:"_updateConversationUserProfile",value:function(e){var n=this;e.data.forEach(function(o){var a="C2C".concat(o.userID);n._conversationMap.has(a)&&(n._conversationMap.get(a).userProfile=o)}),this.emitConversationUpdate(!0,!1)}},{key:"onMessageRevoked",value:function(e){var n=this;if(e.length!==0){var o=null,a=!1,r=[];e.forEach(function(i){(o=n._conversationMap.get(i.conversationID))&&(o.type===f.CONV_TOPIC?r.push(i):(o.reduceUnreadCount()&&(a=!0),o.isLastMessageRevoked({sequence:i.sequence,time:i.time})&&(o.setLastMessageRevoked(!0),o.setLastMessageRevoker(i.revoker),a=!0)))}),this.getModule(ae).onMessageRevoked(r),a&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate())}}},{key:"isLastMessageRevoked",value:function(e){var n=!1,o=e.conversationID,a=e.sequence,r=e.time,i=this._conversationMap.get(o);return i&&(n=i.type===f.CONV_TOPIC?this.getModule(ae).isLastMessageRevoked({topicID:o.replace(f.CONV_GROUP,""),sequence:a}):i.isLastMessageRevoked({sequence:a,time:r})),h.l("".concat(this._n,".isLastMessageRevoked options:").concat(JSON.stringify(e)," ret:").concat(n)),n}},{key:"onMessageDeleted",value:function(e){var n=this;if(e.length!==0){var o=null;e.forEach(function(p){(o=n._messageListHandler.getLocalMessage(p.conversationID,p.ID))&&(o.isDeleted=!0),p!==o&&(p.isDeleted=!0)});for(var a=e[0].conversationID,r=this._messageListHandler.getLocalMessageList(a),i={},u=r.length-1;u>=0;u--)if(!r[u].isDeleted){i=r[u];break}var l=this._conversationMap.get(a);if(l){var d=!1;l.lastMessage.lastSequence===i.sequence&&l.lastMessage.lastTime===i.time||(R(i)&&(i=void 0),l.updateLastMessage(i),l.type!==f.CONV_TOPIC&&(d=!0),h.l("".concat(this._n,".onMessageDeleted. update conversationID:").concat(a," with lastMessage:"),l.lastMessage)),a.startsWith(f.CONV_C2C)&&this.updateUnreadCount(a),d&&this.emitConversationUpdate(!0,!1)}}}},{key:"onMessageModified",value:function(e){var n=e.conversationType,o=e.from,a=e.to,r=e.time,i=e.sequence,u=e.elements,l=e.cloudCustomData,d=e.messageVersion,p=this.getMyUserID(),g="".concat(n).concat(a);a===p&&n===f.CONV_C2C&&(g="".concat(n).concat(o));var _=this._messageListHandler.onMessageModified(g,e),v=_.isUpdated,M=_.message;v===!0&&this.emitOuterEvent(W.MESSAGE_MODIFIED,[M]);var y=this._isTopicConversation(g);if(h.l("".concat(this._n,".onMessageModified isUpdated:").concat(v," isTopicMessage:").concat(y," from:").concat(o," to:").concat(a)),y)this.getModule(ae).onMessageModified(e);else{var C=this._conversationMap.get(g);if(C){var D=C.lastMessage;h.d("".concat(this._n.onMessageModified," lastMessage:"),JSON.stringify(D),"options:",JSON.stringify(e)),D&&D.lastTime===r&&D.lastSequence===i&&D.version!==d&&(D.type=u[0].type,D.payload=u[0].content,D.messageForShow=Ht(D.type,D.payload,this.isIntl()),D.cloudCustomData=l,D.version=d,this.emitConversationUpdate(!0,!1))}}return M}},{key:"onNewGroupAtTips",value:function(e){var n=this,o=e.dataList,a=null;o.forEach(function(r){r.groupAtTips?a=r.groupAtTips:r.elements?a=m(m({},r.elements),{},{sync:!0}):r.groupAtType&&(a=m(m({},r),{},{sync:!0})),a.__random=r.random,a.__sequence=r.clientSequence,n._tmpGroupAtTipsList.push(a)}),h.d("".concat(this._n,".onNewGroupAtTips isReady:").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var e=this;if(this._tmpGroupAtTipsList.length!==0){var n=!1;this._tmpGroupAtTipsList.forEach(function(o){var a=o.groupID,r=o.from,i=o.topicID,u=i===void 0?void 0:i,l=o.sync,d=l!==void 0&&l;if(r!==e.getMyUserID())if(S(u)){var p=e._conversationMap.get("".concat(f.CONV_GROUP).concat(a));p&&(p.updateGroupAtInfoList(o),n=!0)}else{var g=e._conversationMap.get("".concat(f.CONV_GROUP).concat(u));if(g){g.updateGroupAtInfoList(o);var _=e.getModule(ae),v=g.groupAtInfoList;_.onConversationProxy({topicID:u,groupAtInfoList:v})}R(g)&&d&&(e.updateTopicConversation([{conversationID:"".concat(f.CONV_GROUP).concat(u),type:f.CONV_TOPIC}]),e._conversationMap.get("".concat(f.CONV_GROUP).concat(u)).updateGroupAtInfoList(o))}}),n&&this.emitConversationUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}},{key:"_getC2CPeerReadTime",value:function(e){var n=this,o=[];if(e.forEach(function(r){n._conversationMap.has(r.conversationID)||r.type!==f.CONV_C2C||o.push(r.conversationID.replace(f.CONV_C2C,""))}),o.length>0){h.d("".concat(this._n,"._getC2CPeerReadTime userIDList:").concat(o));var a=this.getModule(fe);a&&a.getRemotePeerReadTime(o)}}},{key:"_getStorageConversationList",value:function(){return this.getModule(Ke).getItem("conversationMap")}},{key:"_setStorageConversationList",value:function(){var e=this.getLocalConversationList().filter(function(n){return n.type===f.CONV_C2C||n.type===f.CONV_GROUP&&n.lastMessage.type!==f.MSG_GRP_TIP}).slice(0,20).map(function(n){return{conversationID:n.conversationID,type:n.type,subType:n.subType,lastMessage:n.lastMessage,groupProfile:n.groupProfile,userProfile:n.userProfile}});this.getModule(Ke).setItem("conversationMap",e)}},{key:"emitConversationUpdate",value:function(){var e=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],o=this.getLocalConversationList();if(n){var a=this.getModule(V);a&&a.updateGroupLastMessage(o)}e&&this.emitOuterEvent(W.CONVERSATION_LIST_UPDATED)}},{key:"getLocalConversationList",value:function(){return B(this._conversationMap.values()).filter(function(e){return e.type!==f.CONV_TOPIC})}},{key:"getLocalConversation",value:function(e){return this._conversationMap.get(e)}},{key:"hasLocalConversation",value:function(e){return this._conversationMap.has(e)}},{key:"getLocalOldestMessage",value:function(e){return this._messageListHandler.getLocalOldestMessage(e)}},{key:"syncConversationList",value:function(){var e=this,n=new L("syncConversationList");return this._pagingStatus===we.NOT_START&&this._conversationMap.clear(),this._pagingGetConversationList().then(function(o){var a=function(r){if(b(r)&&r.length!==0){var i=0;return r.forEach(function(u){i+=u}),(i/r.length).toFixed(0)}}(e._pagingGetCostList);return h.l("".concat(e._n,".").concat("syncConversationList",". sum ").concat(function(r){if(b(r)&&r.length!==0){var i=0;return r.forEach(function(u){i+=u}),i.toFixed(0)}}(e._pagingGetCostList)," ms, average ").concat(a," ms")),e._pagingGetCostList.length=0,e._pagingStatus=we.RESOLVED,e._diffAndDeleteConversation(),e.emitConversationUpdate(!0,!1),e._setStorageConversationList(),e._handleC2CPeerReadTime(),e._patchConversationProperties(),n.setMessage(e._conversationMap.size).setMoreMessage(a).setNetworkType(e.getNetworkType()).end(),o}).catch(function(o){return e._pagingStatus=we.REJECTED,n.setMessage(e._pagingTimeStamp),e.probeNetwork().then(function(a){var r=N(a,2),i=r[0],u=r[1];n.setError(o,i,u).end()}),T(o)})}},{key:"_diffAndDeleteConversation",value:function(){var e=this;if(this._isSyncCompleted()){var n=[];this._conversationMap.forEach(function(o,a){!e._pagingConvIDMap.has(a)&&e._convIDFromUnreadDBMap.has(a)&&(e._conversationMap.delete(a),n.push(a))}),h.l("".concat(this._n,"._diffAndDeleteConversation list:").concat(n))}}},{key:"_patchConversationProperties",value:function(){var e=this,n=Date.now(),o=this.checkAndPatchRemark(),a=this._messageRemindHandler.getC2CMessageRemindType(),r=this.getModule(V).getGroupList();Promise.all([o,a,r]).then(function(){var i=Date.now()-n;h.l("".concat(e._n,"._patchConversationProperties ok. cost ").concat(i," ms")),e.emitConversationUpdate(!0,!1),e.emitTotalUnreadMessageCountUpdate()})}},{key:"_pagingGetConversationList",value:function(){var e=this,n="".concat(this._n,"._pagingGetConversationList");h.l("".concat(n," timeStamp:").concat(this._pagingTimeStamp," startIndex:").concat(this._pagingStartIndex)+" pinnedTimeStamp:".concat(this._pagingPinnedTimeStamp," pinnedStartIndex:").concat(this._pagingPinnedStartIndex));var o=Date.now();return this._pagingStatus=we.PENDING,this.request({protocolName:$s,requestData:{fromAccount:this.getMyUserID(),timeStamp:this._pagingTimeStamp,startIndex:this._pagingStartIndex,pinnedTimeStamp:this._pagingPinnedTimeStamp,pinnedStartIndex:this._pagingPinnedStartIndex,orderType:1}}).then(function(a){var r=a.data,i=r.completeFlag,u=r.conversations,l=u===void 0?[]:u,d=r.timeStamp,p=r.startIndex,g=r.pinnedTimeStamp,_=r.pinnedStartIndex,v=r.groupItem,M=Date.now()-o;if(e._pagingGetCostList.push(M),h.l("".concat(n," ok. completeFlag:").concat(i," count:").concat(l.length," cost ").concat(M," ms")),e._convGroupHandler.onConvGroupListSynced(v),l.length>0){var y=e._getConversationOptions(l);e._pagingConvIDMap=new Map([].concat(B(e._pagingConvIDMap),B(y.map(function(C){return[C.conversationID,1]})))),e._updateLocalConversationList({conversationOptionsList:y,isFromGetConversations:!0}),e.isLoggedIn()&&e.emitConversationUpdate()}if(!e._isReady){if(!e.isLoggedIn())return Y();e.triggerReady()}return e._pagingTimeStamp=d,e._pagingStartIndex=p,e._pagingPinnedTimeStamp=g,e._pagingPinnedStartIndex=_,i!==1?e._pagingGetConversationList():(e._handleGroupAtTipsList(),e._convGroupHandler.getRemoteConvGroupList(),Y())}).catch(function(a){throw e.isLoggedIn()&&(e._isReady||(h.w("".concat(n," failed. error:"),a),e.triggerReady())),a})}},{key:"_updateLocalConversationList",value:function(e){var n,o=e.isFromGetConversations,a=e.isInstantMessage,r=Date.now();n=this._getTmpConversationListMapping(e),this._conversationMap=new Map(this._sortConversationList([].concat(B(n.toBeUpdatedConversationList),B(this._conversationMap)))),o||(this._updateUserOrGroupProfile(n.newConversationList),a&&this.emitTotalUnreadMessageCountUpdate()),h.d("".concat(this._n,"._updateLocalConversationList cost ").concat(Date.now()-r," ms"))}},{key:"_getTmpConversationListMapping",value:function(e){for(var n=e.conversationOptionsList,o=e.isFromGetConversations,a=e.isInstantMessage,r=e.isUnreadC2CMessage,i=r!==void 0&&r,u=e.updateUnreadCount,l=[],d=[],p=this.getModule(V),g=this.getModule(ce),_=this.isIntl(),v=0,M=n.length;v<M;v++){var y=new En(n[v],_),C=y.conversationID;if(C!=="".concat(f.CONV_C2C,"@TLS#ERROR")&&C!=="".concat(f.CONV_C2C,"@TLS#NOT_FOUND"))if(this._conversationMap.has(C)){var D=this._conversationMap.get(C),E=["unreadCount","allowType","adminForbidType","payload","isPinned"];a===!1&&E.push("lastMessage");var A=n[v].lastMessage,O=!S(A);O||n[v].type===f.CONV_TOPIC||this._onLastMessageNotExist(n[v]),S(a)&&O&&D.lastMessage.payload===null&&(D.lastMessage.payload=A.payload),R(D.lastMessage.revoker)||(D.lastMessage.revoker=null),$e(D,y,E,[null,void 0,"",0,NaN]),u===!0&&D.updateUnreadCount({nextUnreadCount:y.unreadCount,isFromGetConversations:o,isUnreadC2CMessage:i}),a&&O&&(A.payload&&(D.lastMessage.payload=A.payload),D.type===f.CONV_GROUP&&(D.lastMessage.nameCard=A.nameCard,D.lastMessage.nick=A.nick)),O&&D.lastMessage.cloudCustomData!==A.cloudCustomData&&(D.lastMessage.cloudCustomData=A.cloudCustomData||""),this._conversationMap.delete(C),l.push([C,D])}else{if(y.type===f.CONV_GROUP&&p){var U=y.groupProfile.groupID,K=p.getLocalGroupProfile(U);K&&(y.groupProfile=K,u===!0&&y.updateUnreadCount({nextUnreadCount:0}))}else if(y.type===f.CONV_C2C){var j=C.replace(f.CONV_C2C,"");g&&g.isMyFriend(j)&&(y.remark=g.getFriendRemark(j))}d.push(y),l.push([C,y])}}var H=this.getModule(ae);return l.forEach(function(J){if(J[1].type===f.CONV_TOPIC){var de=J[1],De=de.conversationID,he=de.unreadCount,Me=de.groupAtInfoList;H.onConversationProxy({topicID:De.replace(f.CONV_GROUP,""),unreadCount:he,groupAtInfoList:R(Me)?void 0:Me})}}),{toBeUpdatedConversationList:l,newConversationList:d}}},{key:"_onLastMessageNotExist",value:function(e){new L("lastMessageNotExist").setMessage("".concat(JSON.stringify(e))).setNetworkType(this.getNetworkType()).end()}},{key:"_sortConversationList",value:function(e){var n=[],o=[],a=[],r=[];return e.forEach(function(i){i[1].isPinned===!0?R(i[1].lastMessage.lastTime)?o.push(i):n.push(i):R(i[1].lastMessage.lastTime)?r.push(i):a.push(i)}),n.sort(function(i,u){return u[1].lastMessage.lastTime-i[1].lastMessage.lastTime}).concat(o).concat(a.sort(function(i,u){return u[1].lastMessage.lastTime-i[1].lastMessage.lastTime})).concat(r)}},{key:"_sortConversationListAndEmitEvent",value:function(){this._conversationMap=new Map(this._sortConversationList(B(this._conversationMap))),this.emitConversationUpdate(!0,!1)}},{key:"_updateUserOrGroupProfile",value:function(e){var n=this;if(e.length!==0){var o=[],a=[],r=this.getModule(pe),i=this.getModule(V);e.forEach(function(u){if(u.type===f.CONV_C2C)o.push(u.toAccount);else if(u.type===f.CONV_GROUP){var l=u.toAccount;i.hasLocalGroup(l)?u.groupProfile=i.getLocalGroupProfile(l):a.push(l)}}),h.l("".concat(this._n,"._updateUserOrGroupProfile c2cUserIDList:").concat(o," groupIDList:").concat(a)),o.length>0&&r.getUserProfile({userIDList:o}).then(function(u){var l=u.data;b(l)?l.forEach(function(d){n._doUpdateUserProfile("C2C".concat(d.userID),d)}):n._doUpdateUserProfile("C2C".concat(l.userID),l)}),a.length>0&&i.getGroupProfileAdvance({groupIDList:a,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then(function(u){u.data.successGroupList.forEach(function(l){var d="GROUP".concat(l.groupID);if(n._conversationMap.has(d)){var p=n._conversationMap.get(d);$e(p.groupProfile,l,[],[null,void 0,"",0,NaN]),!p.subType&&l.type&&(p.subType=l.type)}})})}}},{key:"_doUpdateUserProfile",value:function(e,n){this.hasLocalConversation(e)&&(this.getLocalConversation(e).userProfile=n)}},{key:"_getConversationOptions",value:function(e){var n=this,o=[],a=e.filter(function(u){var l=u.type,d=u.userID;return l===1&&d!=="@TLS#NOT_FOUND"&&d!=="@TLS#ERROR"||l===2}),r=this.getMyUserID(),i=a.map(function(u){if(S(u.lastMsg)&&(u.lastMsg={elements:[]}),u.type===1){var l={userID:u.userID,nick:u.peerNick,avatar:u.peerAvatar};return o.push(l),{conversationID:"C2C".concat(u.userID),type:"C2C",lastMessage:{lastTime:u.time,lastSequence:u.sequence,fromAccount:u.lastC2CMsgFromAccount,messageForShow:u.messageShow,type:u.lastMsg.elements[0]?u.lastMsg.elements[0].type:null,payload:u.lastMsg.elements[0]?n._amendLayersOverLimitProperty(u.lastMsg.elements[0].content):null,cloudCustomData:u.lastMsg.cloudCustomData||"",isRevoked:u.lastMessageFlag===8,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:u.lastC2CMsgFromAccount===r&&u.time<=u.c2cPeerReadTime,revoker:u.lastMsg.revokerInfo?u.lastMsg.revokerInfo.revoker:null},userProfile:new Sn(l),peerReadTime:u.c2cPeerReadTime,isPinned:u.isPinned===1,messageRemindType:"",customData:u.customMark||"",markList:fn(u.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(u.contactGroupId)}}return{conversationID:"GROUP".concat(u.groupID),type:"GROUP",lastMessage:m(m({lastTime:u.time,lastSequence:u.sequence,fromAccount:u.msgGroupFromAccount,messageForShow:u.messageShow},n._patchTypeAndPayload(u)),{},{cloudCustomData:u.lastMsg.cloudCustomData||"",isRevoked:u.lastMessageFlag===2,onlineOnlyFlag:!1,nick:u.senderNick||"",nameCard:u.senderNameCard||"",revoker:u.lastMsg.revokerInfo?u.lastMsg.revokerInfo.revoker:null}),groupProfile:new vt({groupID:u.groupID,name:u.groupNick,avatar:u.groupImage}),unreadCount:u.unreadCount,peerReadTime:0,isPinned:u.isPinned===1,messageRemindType:"",version:0,customData:u.customMark||"",markList:fn(u.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(u.contactGroupId)}});return o.length>0&&this.getModule(pe).onConversationsProfileUpdated(o),i}},{key:"_patchTypeAndPayload",value:function(e){var n=e.lastMsg,o=n.event,a=o===void 0?void 0:o,r=n.elements,i=r===void 0?[]:r,u=n.groupTips,l=u===void 0?{}:u;if(!S(a)&&!R(l)){var d=new ve(l);d.setElement({type:f.MSG_GRP_TIP,content:m(m({},l.elements),{},{groupProfile:l.groupProfile})});var p=JSON.parse(JSON.stringify(d.payload));return d=null,{type:f.MSG_GRP_TIP,payload:p}}return{type:i[0]?i[0].type:null,payload:i[0]?this._amendLayersOverLimitProperty(i[0].content):null}}},{key:"_amendLayersOverLimitProperty",value:function(e){var n=e.layersOverLimit;return n===0?e.layersOverLimit=!1:n===1&&(e.layersOverLimit=!0),e}},{key:"getLocalMessageList",value:function(e){return this._messageListHandler.getLocalMessageList(e)}},{key:"deleteLocalMessage",value:function(e){e instanceof ve&&this._messageListHandler.remove(e)}},{key:"onConversationDeleted",value:function(e){if(b(e)){var n=e.map(function(o){var a=o.type,r=o.userID,i=o.groupID;return a===1?"".concat(f.CONV_C2C).concat(r):a===2?"".concat(f.CONV_GROUP).concat(i):void 0});h.l("".concat(this._n,".onConversationDeleted conversationIDList:").concat(n)),this.deleteLocalConversationList(n)}}},{key:"onConversationPinned",value:function(e){var n=this;if(b(e)){var o=!1;e.forEach(function(a){var r,i=a.type,u=a.userID,l=a.groupID;i===1?r=n.getLocalConversation("".concat(f.CONV_C2C).concat(u)):i===2&&(r=n.getLocalConversation("".concat(f.CONV_GROUP).concat(l))),r&&(h.l("".concat(n._n,".onConversationPinned conversationID:").concat(r.conversationID," isPinned:").concat(r.isPinned)),r.isPinned||(r.isPinned=!0,o=!0))}),o&&this._sortConversationListAndEmitEvent()}}},{key:"onConversationUnpinned",value:function(e){var n=this;if(b(e)){var o=!1;e.forEach(function(a){var r,i=a.type,u=a.userID,l=a.groupID;i===1?r=n.getLocalConversation("".concat(f.CONV_C2C).concat(u)):i===2&&(r=n.getLocalConversation("".concat(f.CONV_GROUP).concat(l))),r&&(h.l("".concat(n._n,".onConversationUnpinned conversationID:").concat(r.conversationID," isPinned:").concat(r.isPinned)),r.isPinned&&(r.isPinned=!1,o=!0))}),o&&this._sortConversationListAndEmitEvent()}}},{key:"getMessageList",value:function(e){var n=this,o=e.conversationID,a=e.nextReqMessageID,r=e.count,i="".concat(this._n,".getMessageList"),u=this.getLocalConversation(o),l="";if(u&&u.groupProfile&&(l=u.groupProfile.type),xe(l))return h.l("".concat(i," not available in avchatroom. conversationID:").concat(o)),Y({messageList:[],nextReqMessageID:"",isCompleted:!0});(S(r)||r>15)&&(r=15),!a&&this._isNotInCommunity(o)&&(this._messageListHandler.removeByConversationID(o),this._completedMap.delete(o),this._roamingMessageSequenceMap.delete(o));var d=this._computeRemainingCount({conversationID:o,nextReqMessageID:a}),p=this._completedMap.has(o);if(h.l("".concat(i," conversationID:").concat(o," nextReqMessageID:").concat(a)+" remainingCount:".concat(d," count:").concat(r," isCompleted:").concat(p)),this._needGetHistory({conversationID:o,remainingCount:d,count:r}))return this.getHistoryMessages({conversationID:o,nextReqMessageID:a,count:20}).then(function(_){var v=_.nextReqID,M=_.storedMessageList,y=n._completedMap.has(o),C=M;d>0&&(C=n._messageListHandler.getLocalMessageList(o).slice(0,M.length+d));var D={nextReqMessageID:y?"":v,messageList:C,isCompleted:y};return h.l("".concat(i," ret.nextReqMessageID:").concat(D.nextReqMessageID," ret.isCompleted:").concat(D.isCompleted," ret.length:").concat(C.length)),x(D)});this.modifyMessageList(o);var g=this._getMessageListFromMemory({conversationID:o,nextReqMessageID:a,count:r});return Y(g)}},{key:"_getMessageListFromMemory",value:function(e){var n=e.conversationID,o=e.nextReqMessageID,a=e.count,r="".concat(this._n,"._getMessageListFromMemory"),i=this._messageListHandler.getLocalMessageList(n),u=i.length,l=0,d={isCompleted:!1,nextReqMessageID:"",messageList:[]};return o?(l=i.findIndex(function(p){return p.ID===o}))>a?(d.messageList=i.slice(l-a,l),d.nextReqMessageID=i[l-a].ID):(d.messageList=i.slice(0,l),d.isCompleted=!0):u>a?(l=u-a,d.messageList=i.slice(l,u),d.nextReqMessageID=i[l].ID):(d.messageList=i.slice(0,u),d.isCompleted=!0),h.l("".concat(r," conversationID:").concat(n)+" ret.nextReqMessageID:".concat(d.nextReqMessageID," ret.isCompleted:").concat(d.isCompleted," ret.length:").concat(d.messageList.length)),d}},{key:"getMessageListHopping",value:function(e){var n=e.conversationID,o=e.sequence,a=e.time,r=e.count,i=e.direction,u=i===void 0?0:i;if((S(r)||r>15)&&(r=15),n.startsWith(f.CONV_C2C)){var l=this.getModule(fe),d=n.replace(f.CONV_C2C,"");return l.getRoamingMessagesHopping({peerAccount:d,time:a,count:r,direction:u})}if(n.startsWith(f.CONV_GROUP)){var p=this.getModule(V),g=n.replace(f.CONV_GROUP,"");return p.getRoamingMessagesHopping({groupID:g,sequence:o,count:r,direction:u})}}},{key:"_computeRemainingCount",value:function(e){var n=e.conversationID,o=e.nextReqMessageID,a=this._messageListHandler.getLocalMessageList(n),r=a.length;if(!o)return r;var i=0;return Pe(n)?i=a.findIndex(function(u){return u.ID===o}):Ae(n)&&(i=o.indexOf("-")!==-1?a.findIndex(function(u){return u.ID===o}):a.findIndex(function(u){return u.sequence===o})),i===-1&&(i=0),i}},{key:"_getMessageListSize",value:function(e){return this._messageListHandler.getLocalMessageList(e).length}},{key:"_needGetHistory",value:function(e){var n=e.conversationID,o=e.remainingCount,a=e.count,r=this.getLocalConversation(n),i="";return r&&r.groupProfile&&(i=r.groupProfile.type),!_n(n)&&!xe(i)&&!(Ae(n)&&this._isPagingGetGroupListCompleted()&&this._getLocalGroupCount()<=4e3&&!this._hasLocalGroup(n)&&!this._isTopicConversation(n))&&o<=a&&!this._completedMap.has(n)}},{key:"_isTopicConversation",value:function(e){var n=e.replace(f.CONV_GROUP,"");return Le(n)}},{key:"getHistoryMessages",value:function(e){var n=e.conversationID,o=e.count;if(n===f.CONV_SYSTEM)return Y();var a=15;o>20&&(a=20);var r=null;if(Pe(n)){var i=this._roamingMessageKeyAndTimeMap.has(n);return(r=this.getModule(fe))?r.getRoamingMessage({conversationID:n,peerAccount:n.replace(f.CONV_C2C,""),count:a,lastMessageTime:i?this._roamingMessageKeyAndTimeMap.get(n).lastMessageTime:0,messageKey:i?this._roamingMessageKeyAndTimeMap.get(n).messageKey:""}):T({code:k.CANNOT_FIND_MODULE})}if(Ae(n)){if(!(r=this.getModule(V)))return T({code:k.CANNOT_FIND_MODULE});var u=null;this._conversationMap.has(n)&&(u=this._conversationMap.get(n).lastMessage);var l=0;u&&(l=u.lastSequence);var d=this._roamingMessageSequenceMap.get(n);return r.getRoamingMessage({conversationID:n,groupID:n.replace(f.CONV_GROUP,""),count:a,sequence:d||l})}return Y()}},{key:"patchConversationLastMessage",value:function(e){var n=this.getLocalConversation(e);if(n){var o=n.lastMessage,a=o.messageForShow,r=o.payload;if(R(a)||R(r)){var i=this._messageListHandler.getLocalMessageList(e);if(i.length===0)return;var u=i[i.length-1];h.l("".concat(this._n,".patchConversationLastMessage conversationID:").concat(e," payload:"),u.payload),n.updateLastMessage(u)}}}},{key:"onRoamingMessage",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,o=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],a=n.startsWith(f.CONV_C2C)?f.CONV_C2C:f.CONV_GROUP,r=null,i=[],u=[],l=0,d=e.length,p=null,g=a===f.CONV_GROUP,_=this.getModule(jt),v=this.getFileDownloadProxy(),M=function(){l=g?e.length-1:0,d=g?0:e.length},y=function(){g?--l:++l},C=function(){return g?l>=d:l<d};for(M();C();y())if(g&&e[l].sequence===1&&o&&this.setCompleted(n),e[l].isPlaceMessage!==1)if((r=new ve(e[l])).to=e[l].to,a!==f.CONV_GROUP||S(e[l].topicID)||(r.to=e[l].topicID),r.isSystemMessage=!!e[l].isSystemMessage,r.conversationType=a,e[l].event===4?p={type:f.MSG_GRP_TIP,content:m(m({},e[l].elements),{},{groupProfile:e[l].groupProfile})}:(e[l].elements=_.parseElements(e[l].elements,e[l].from),p=e[l].elements),g||r.setNickAndAvatar({nick:e[l].nick,avatar:e[l].avatar}),R(p)){var D=new L("emptyMessageBody");D.setMessage("from:".concat(r.from," to:").concat(r.to," sequence:").concat(r.sequence," event:").concat(e[l].event)),D.setNetworkType(this.getNetworkType()).setLevel("warning").end()}else r.setElement(p,v),r.reInitialize(this.getMyUserID()),i.push(r);return M=y=C=null,o?(this._messageListHandler.unshift(i,u),i=null,u):(u=null,i)}},{key:"findMessage",value:function(e){return this._messageListHandler.findMessage(e)}},{key:"_isNotInCommunity",value:function(e){var n=!1;if(e.startsWith(f.CONV_GROUP)&&this._isTopicConversation(e)){var o=Ie(e.replace(f.CONV_GROUP,""));this.getModule(V).hasLocalGroup(o)||(n=!0)}return n}},{key:"deleteTopicRoamingMessageInfo",value:function(e){var n=this;Oe({groupID:e})&&this._messageListHandler.getTopicConversationIDList(e).forEach(function(o){n._messageListHandler.removeByConversationID(o),n._completedMap.delete(o),n._roamingMessageSequenceMap.delete(o)})}},{key:"deleteGroupRomaingMessageInfo",value:function(e){var n="".concat(f.CONV_GROUP).concat(e);this._messageListHandler.removeByConversationID(n),this._completedMap.delete(n),this._roamingMessageSequenceMap.delete(n)}},{key:"setMessageRead",value:function(e){var n=e.conversationID,o=this.getLocalConversation(n);if(h.l("".concat(this._n,".setMessageRead conversationID:").concat(n," unreadCount:").concat(o?o.unreadCount:0)),!o||(o.type!==f.CONV_GROUP&&o.type!==f.CONV_TOPIC||R(o.groupAtInfoList)||this.deleteGroupAtTips(n),o.unreadCount===0))return Y();if(o.type===f.CONV_GROUP&&!this._hasLocalGroup(n))return o.unreadCount!==0&&(o.unreadCount=0,this.emitConversationUpdate(!0,!1)),Y();var a=this._messageListHandler.getLocalLastMessage(n),r=o.lastMessage.lastTime;a&&r<a.time&&(r=a.time);var i=o.lastMessage.lastSequence;if(a&&i<a.sequence&&(i=a.sequence),o.type===f.CONV_TOPIC&&S(a)){var u=this.getModule(ae),l=n.replace(f.CONV_GROUP,""),d=Ie(l),p=u.getLocalTopic(d,l);p&&(i=p.nextMessageSeq-1)}var g=null;switch(o.type){case f.CONV_C2C:return(g=this.getModule(fe))?g.setMessageRead({conversationID:n,lastMessageTime:r}):T({code:k.CANNOT_FIND_MODULE});case f.CONV_GROUP:case f.CONV_TOPIC:return(g=this.getModule(V))?g.setMessageRead({conversationID:n,lastMessageSeq:i}):T({code:k.CANNOT_FIND_MODULE});case f.CONV_SYSTEM:return o.unreadCount=0,this.emitConversationUpdate(!0,!1),Y();default:return Y()}}},{key:"setAllMessageRead",value:function(){var e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o="setAllMessageRead",a="".concat(this._n,".").concat(o);n.scope||(n.scope=f.READ_ALL_MSG),h.l("".concat(a," options:"),n);var r=this._createSetAllMessageReadPack(n);if(r.readAllC2CMessage===0&&r.groupMessageReadInfoList.length===0)return Y();var i=new L(o);return this.request({protocolName:Sa,requestData:r}).then(function(u){var l=u.data,d=e._handleAllMessageRead(l);return i.setMessage("scope:".concat(n.scope," failureGroups:").concat(JSON.stringify(d))).setNetworkType(e.getNetworkType()).end(),Y()}).catch(function(u){return e.probeNetwork().then(function(l){var d=N(l,2),p=d[0],g=d[1];i.setError(u,p,g).end()}),h.w("".concat(a," failed. error:"),u),T({code:u&&u.code?u.code:k.MESSAGE_UNREAD_ALL_FAIL,message:u&&u.message?u.message:void 0})})}},{key:"setConversationCustomData",value:function(e){return this._convGroupHandler.setConvCustomData(e)}},{key:"markConversation",value:function(e){return this._convGroupHandler.markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._convGroupHandler.getLocalConvGroupList()}},{key:"createConversationGroup",value:function(e){return this._convGroupHandler.createConvGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._convGroupHandler.deleteConvGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._convGroupHandler.renameConvGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._convGroupHandler.addConvsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._convGroupHandler.deleteConvsFromGroup(e)}},{key:"onConversationMarkUpdated",value:function(e){this._convGroupHandler.onConvMarkUpdated(e)}},{key:"onConversationGroupCreated",value:function(e){this._convGroupHandler.onConvGroupCreated(e)}},{key:"onConversationGroupDeleted",value:function(e){this._convGroupHandler.onConvGroupDeleted(e)}},{key:"onConversationGroupNameUpdated",value:function(e){this._convGroupHandler.onConvGroupNameUpdated(e)}},{key:"onConversationInGroupUpdated",value:function(e){this._convGroupHandler.onConvInGroupUpdated(e)}},{key:"onConversationAddedToOrDeletedFromGroup",value:function(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}},{key:"_getConversationLastMessageSequence",value:function(e){var n=this._messageListHandler.getLocalLastMessage(e.conversationID),o=e.lastMessage.lastSequence;return n&&o<n.sequence&&(o=n.sequence),o}},{key:"_getConversationLastMessageTime",value:function(e){var n=this._messageListHandler.getLocalLastMessage(e.conversationID),o=e.lastMessage.lastTime;return n&&o<n.time&&(o=n.time),o}},{key:"_createSetAllMessageReadPack",value:function(e){var n,o={readAllC2CMessage:0,groupMessageReadInfoList:[]},a=e.scope,r=Ee(this._conversationMap);try{for(r.s();!(n=r.n()).done;){var i=N(n.value,2)[1];if(i.unreadCount>0){if(i.type===f.CONV_C2C&&o.readAllC2CMessage===0){if(a===f.READ_ALL_MSG)o.readAllC2CMessage=1;else if(a===f.READ_ALL_C2C_MSG){o.readAllC2CMessage=1;break}}else if(i.type===f.CONV_GROUP&&(a===f.READ_ALL_GROUP_MSG||a===f.READ_ALL_MSG)){var u=this._getConversationLastMessageSequence(i);o.groupMessageReadInfoList.push({groupID:i.groupProfile.groupID,messageSequence:u})}}}}catch(l){r.e(l)}finally{r.f()}return o}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMessageRead(e)}},{key:"_handleAllMessageRead",value:function(e){var n=e.groupMessageReadInfoList,o=e.readAllC2CMessage,a=this._parseGroupReadInfo(n);return this._updateAllConversationUnreadCount({readAllC2CMessage:o})>=1&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate()),a}},{key:"_parseGroupReadInfo",value:function(e){var n=[];if(e&&e.length)for(var o=0,a=e.length;o<a;o++){var r=e[o],i=r.groupID,u=r.sequence,l=r.retCode,d=r.lastMessageSeq;S(l)?this._remoteGroupReadSequenceMap.set(i,d):(this._remoteGroupReadSequenceMap.set(i,u),l!==0&&n.push("".concat(i,"-").concat(u,"-").concat(l)))}return n}},{key:"_updateAllConversationUnreadCount",value:function(e){var n,o=e.readAllC2CMessage,a=0,r=Ee(this._conversationMap);try{for(r.s();!(n=r.n()).done;){var i=N(n.value,2),u=i[0],l=i[1];if(l.unreadCount>=1){if(o===1&&l.type===f.CONV_C2C){var d=this._getConversationLastMessageTime(l);this.updateIsReadAfterReadReport({conversationID:u,lastMessageTime:d})}else if(l.type===f.CONV_GROUP){var p=u.replace(f.CONV_GROUP,"");if(this._remoteGroupReadSequenceMap.has(p)){var g=this._remoteGroupReadSequenceMap.get(p),_=this._getConversationLastMessageSequence(l);this.updateIsReadAfterReadReport({conversationID:u,remoteReadSequence:g}),_>=g&&this._remoteGroupReadSequenceMap.delete(p)}}this.updateUnreadCount(u,!1)&&(a+=1)}}}catch(v){r.e(v)}finally{r.f()}return a}},{key:"isRemoteRead",value:function(e){var n=e.conversationID,o=e.sequence,a=n.replace(f.CONV_GROUP,""),r=!1;if(this._remoteGroupReadSequenceMap.has(a)){var i=this._remoteGroupReadSequenceMap.get(a);o<=i&&(r=!0,h.l("".concat(this._n,".isRemoteRead conversationID:").concat(n," messageSequence:").concat(o," remoteReadSequence:").concat(i))),o>=i+10&&this._remoteGroupReadSequenceMap.delete(a)}return r}},{key:"updateIsReadAfterReadReport",value:function(e){var n=e.conversationID,o=e.lastMessageSeq,a=e.lastMessageTime,r=this._messageListHandler.getLocalMessageList(n);if(r.length!==0){for(var i,u=r.length-1;u>=0;u--)if(i=r[u],!(a&&i.time>a||o&&i.sequence>o)){if(i.flow==="in"&&i.isRead)break;i.setIsRead(!0)}}}},{key:"updateUnreadCount",value:function(e){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],o=!1,a=this.getLocalConversation(e),r=this._messageListHandler.getLocalMessageList(e);if(a){var i=a.unreadCount,u=r.filter(function(g){return!g.isRead&&!g._onlineOnlyFlag&&!g.isDeleted}).length;if(i!==u&&(a.unreadCount=u,o=!0,h.l("".concat(this._n,".updateUnreadCount from ").concat(i," to ").concat(u,", conversationID:").concat(e)),n===!0&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate())),o&&a.type===f.CONV_TOPIC){var l=a.unreadCount,d=this.getModule(ae),p=e.replace(f.CONV_GROUP,"");d.onConversationProxy({topicID:p,unreadCount:l})}return o}}},{key:"clearGroupAtInfoList",value:function(e){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],o=this.getLocalConversation(e);if(o&&o.groupAtInfoList.length>0){if(o.clearGroupAtInfoList(),h.l("".concat(this._n,".clearGroupAtInfoList conversationID:").concat(e)),o.type===f.CONV_TOPIC){var a=o.groupAtInfoList,r=this.getModule(ae),i=e.replace(f.CONV_GROUP,"");r.onConversationProxy({topicID:i,groupAtInfoList:a})}n===!0&&this.emitConversationUpdate(!0,!1)}}},{key:"updateReadReceiptInfo",value:function(e){var n=this,o=e.userID,a=o===void 0?void 0:o,r=e.groupID,i=r===void 0?void 0:r,u=e.readReceiptList;if(!R(u)){var l=[];if(S(a)){if(!S(i)){var d="".concat(f.CONV_GROUP).concat(i);u.forEach(function(g){var _=g.tinyID,v=g.clientTime,M=g.random,y=g.readCount,C=g.unreadCount,D="".concat(_,"-").concat(v,"-").concat(M),E=n._messageListHandler.getLocalMessage(d,D),A={groupID:i,messageID:D,readCount:0,unreadCount:0};E&&(ee(y)&&(E.readReceiptInfo.readCount=y,A.readCount=y),ee(C)&&(E.readReceiptInfo.unreadCount=C,A.unreadCount=C),l.push(A))})}}else{var p="".concat(f.CONV_C2C).concat(a);u.forEach(function(g){var _=g.tinyID,v=g.clientTime,M=g.random,y="".concat(_,"-").concat(v,"-").concat(M),C=n._messageListHandler.getLocalMessage(p,y);if(C){C.readReceiptInfo.isPeerRead=!0;var D={userID:a,messageID:y,isPeerRead:!0};l.push(D)}})}l.length>0&&this.emitOuterEvent(W.MESSAGE_READ_RECEIPT_RECEIVED,l)}}},{key:"recomputeGroupUnreadCount",value:function(e){var n=e.conversationID,o=e.count,a=this.getLocalConversation(n);if(a){var r=a.unreadCount,i=r-o;i<0&&(i=0),a.unreadCount=i,h.l("".concat(this._n,".recomputeGroupUnreadCount from ").concat(r," to ").concat(i,", conversationID:").concat(n))}}},{key:"updateIsRead",value:function(e){var n=this.getLocalConversation(e),o=this.getLocalMessageList(e);if(n&&o.length!==0&&!_n(n.type)){for(var a=[],r=0,i=o.length;r<i;r++)o[r].flow!=="in"?o[r].flow!=="out"||o[r].isRead||o[r].setIsRead(!0):a.push(o[r]);var u=0;if(n.type===f.CONV_C2C){var l=a.slice(-n.unreadCount).filter(function(p){return p.isRevoked}).length;u=a.length-n.unreadCount-l}else u=a.length-n.unreadCount;for(var d=0;d<u&&!a[d].isRead;d++)a[d].setIsRead(!0)}}},{key:"deleteGroupAtTips",value:function(e){var n=this,o="".concat(this._n,".deleteGroupAtTips");h.l("".concat(o));var a=this._conversationMap.get(e);if(!a)return Promise.resolve();var r=a.groupAtInfoList;if(r.length===0)return Promise.resolve();var i=void 0;e.startsWith(f.CONV_GROUP)&&(i=e.replace(f.CONV_GROUP,""));var u=B(r);if((Oe({groupID:i})||Le(i))&&(u=r.filter(function(d){return!d.atTypeArray.includes(f.CONV_AT_ALL)})).length===0)return this.clearGroupAtInfoList(e,!1),Promise.resolve();var l=this.getMyUserID();return this.request({protocolName:oa,requestData:{messageListToDelete:u.map(function(d){return{from:d.from,to:l,messageSeq:d.__sequence,messageRandom:d.__random,groupID:S(d.topicID)?d.groupID:d.topicID}})}}).then(function(){return h.l("".concat(o," ok. count:").concat(r.length)),n.clearGroupAtInfoList(e,!1),Promise.resolve()}).catch(function(d){return h.e("".concat(o," failed. error:"),d),T(d)})}},{key:"appendToMessageList",value:function(e){this._messageListHandler.pushIn(e)}},{key:"setMessageRandom",value:function(e){this.singlyLinkedList.set(e.random)}},{key:"deleteMessageRandom",value:function(e){this.singlyLinkedList.delete(e.random)}},{key:"pushIntoMessageList",value:function(e,n,o){return!(!this._messageListHandler.pushIn(n,o)||this._isMessageFromCurrentInstance(n)&&!o)&&(e.push(n),!0)}},{key:"_isMessageFromCurrentInstance",value:function(e){return this.singlyLinkedList.has(e.random)}},{key:"revoke",value:function(e,n,o){return this._messageListHandler.revoke(e,n,o)}},{key:"getPeerReadTime",value:function(e){return this._peerReadTimeMap.get(e)}},{key:"recordPeerReadTime",value:function(e,n){this._peerReadTimeMap.has(e)?this._peerReadTimeMap.get(e)<n&&this._peerReadTimeMap.set(e,n):this._peerReadTimeMap.set(e,n)}},{key:"updateMessageIsPeerReadProperty",value:function(e,n){if(e.startsWith(f.CONV_C2C)&&n>0){var o=this._messageListHandler.updateMessageIsPeerReadProperty(e,n);if(o.length>0&&this.emitOuterEvent(W.MESSAGE_READ_BY_PEER,o),this._conversationMap.has(e)){var a=this._conversationMap.get(e).lastMessage;R(a)||a.fromAccount===this.getMyUserID()&&a.lastTime<=n&&!a.isPeerRead&&(a.isPeerRead=!0,this.emitConversationUpdate(!0,!1))}}}},{key:"updateMessageIsModifiedProperty",value:function(e){this._messageListHandler.updateMessageIsModifiedProperty(e)}},{key:"setCompleted",value:function(e){h.l("".concat(this._n,".setCompleted. conversationID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMessageKeyAndTime",value:function(e,n,o){this._roamingMessageKeyAndTimeMap.set(e,{messageKey:n,lastMessageTime:o})}},{key:"updateRoamingMessageSequence",value:function(e,n){this._roamingMessageSequenceMap.set(e,n)}},{key:"getConversationList",value:function(e){var n=this,o="getConversationList",a="".concat(this._n,".").concat(o),r="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._conversationMap.size,", options:").concat(e);if(h.l("".concat(a,". ").concat(r)),this._pagingStatus===we.REJECTED){var i=new L(o);return i.setMessage(r),this.syncConversationList().then(function(){i.setNetworkType(n.getNetworkType()).end();var d=n._getConversationList(e);return x({conversationList:d,isSyncCompleted:n._isSyncCompleted()})}).catch(function(d){return n.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];i.setError(d,_,v).end()}),h.e("".concat(a," failed. error:"),d),T(d)})}if(this._conversationMap.size===0){var u=new L(o);return u.setMessage(r),this.syncConversationList().then(function(){u.setNetworkType(n.getNetworkType()).end();var d=n._getConversationList(e);return x({conversationList:d,isSyncCompleted:n._isSyncCompleted()})}).catch(function(d){return n.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];u.setError(d,_,v).end()}),h.e("".concat(a," failed. error:"),d),T(d)})}var l=this._getConversationList(e);return h.l("".concat(a,". returned conversation count:").concat(l.length)),Y({conversationList:l,isSyncCompleted:this._isSyncCompleted()})}},{key:"_getConversationList",value:function(e){if(S(e))return this.getLocalConversationList();if(b(e))return e.length===0?[]:this.getLocalConversationList().filter(function(r){return e.includes(r.conversationID)});if(ne(e)){var n=e.type,o=e.markType,a=e.groupName;return this.getLocalConversationList().filter(function(r){return(n!==f.CONV_C2C&&n!==f.CONV_GROUP||r.type===n)&&(!z(a)||r.conversationGroupList.includes(a))&&(!ee(o)||r.markList.includes(o))})}return[]}},{key:"_handleC2CPeerReadTime",value:function(){var e,n=Ee(this._conversationMap);try{for(n.s();!(e=n.n()).done;){var o=N(e.value,2),a=o[0],r=o[1];r.type===f.CONV_C2C&&(h.d("".concat(this._n,"._handleC2CPeerReadTime conversationID:").concat(a," peerReadTime:").concat(r.peerReadTime)),this.recordPeerReadTime(a,r.peerReadTime))}}catch(i){n.e(i)}finally{n.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){return this.getModule(V).isPagingGetCompleted()}},{key:"_getLocalGroupCount",value:function(){return this.getModule(V).getLocalGroupList().length}},{key:"_hasLocalGroup",value:function(e){return this.getModule(V).hasLocalGroup(e.replace(f.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(e){var n,o=this;if((n=this._conversationMap.has(e)?this._conversationMap.get(e):new En({conversationID:e,type:e.slice(0,3)===f.CONV_C2C?f.CONV_C2C:f.CONV_GROUP},this.isIntl()))._isInfoCompleted||n.type===f.CONV_SYSTEM)return Y({conversation:n});if(Ae(e)&&!this._hasLocalGroup(e))return Y({conversation:n});var a="".concat(this._n,".").concat("getConversationProfile"),r=new L("getConversationProfile");return h.l("".concat(a,". conversationID:").concat(e," remark:").concat(n.remark," lastMessage:"),n.lastMessage),this._updateUserOrGroupProfileCompletely(n).then(function(i){r.setNetworkType(o.getNetworkType()).setMessage("conversationID:".concat(e," unreadCount:").concat(i.data.conversation.unreadCount)).end();var u=o.getModule(ce);if(u&&n.type===f.CONV_C2C){var l=e.replace(f.CONV_C2C,"");if(u.isMyFriend(l)){var d=u.getFriendRemark(l);n.remark!==d&&(n.remark=d,h.l("".concat(a,". conversationID:").concat(e," patch remark:").concat(n.remark)))}}return h.l("".concat(a," ok. conversationID:").concat(e)),i}).catch(function(i){return o.probeNetwork().then(function(u){var l=N(u,2),d=l[0],p=l[1];r.setError(i,d,p).setMessage("conversationID:".concat(e)).end()}),h.e("".concat(a," failed. error:"),i),T(i)})}},{key:"_updateUserOrGroupProfileCompletely",value:function(e){var n=this;return e.type===f.CONV_C2C?this.getModule(pe).getUserProfile({userIDList:[e.toAccount]}).then(function(o){var a=o.data;return a.length===0?T(new oe({code:k.USER_OR_GROUP_NOT_FOUND})):(e.userProfile=a[0],e._isInfoCompleted=!0,n._unshiftConversation(e),Y({conversation:e}))}):this.getModule(V).getGroupProfile({groupID:e.toAccount}).then(function(o){return e.groupProfile=o.data.group,e._isInfoCompleted=!0,n._unshiftConversation(e),Y({conversation:e})})}},{key:"_unshiftConversation",value:function(e){e instanceof En&&!this._conversationMap.has(e.conversationID)&&(this._conversationMap=new Map([[e.conversationID,e]].concat(B(this._conversationMap))),this._setStorageConversationList(),this.emitConversationUpdate(!0,!1))}},{key:"_onProfileUpdated",value:function(e){var n=this;e.data.forEach(function(o){var a=o.userID;if(a===n.getMyUserID())n._onMyProfileModified({latestNick:o.nick,latestAvatar:o.avatar});else{var r=n._conversationMap.get("".concat(f.CONV_C2C).concat(a));r&&(r.userProfile=o)}})}},{key:"_isSyncCompleted",value:function(){return this._pagingStatus===we.RESOLVED}},{key:"_errorLog",value:function(e,n,o,a){var r=new Error("Params validate failed."),i="".concat(this.getErrorMessage("API_REFER")).concat(e);throw h.w("[".concat(e,"] | ").concat(n," | ").concat(this.getErrorMessage(o,a),", ").concat(i)),h.e("[".concat(e,"] Invalid ").concat(n,": type check failed for ").concat(n,".")),r}},{key:"_isValidConversationID",value:function(e){return Pe(e)||Ae(e)||_n(e)}},{key:"deleteConversation",value:function(e){var n=this,o="deleteConversation";return z(e)||lt(e)||this._errorLog(o,"options","StringOrObjectRequiredLog"),z(e)?(this._isValidConversationID(e)||this._errorLog(o,"options","InvalidConversationID",e),h.l("".concat(this._n,".").concat(o," conversationID:").concat(e)),this.deleteConversationList({conversationIDList:[e],flag:1})):(b(e.conversationIDList)||this._errorLog(o,"conversationIDList","ArrayRequiredLog"),e.conversationIDList.length===0&&this._errorLog(o,"conversationIDList","NonEmptyArrayLog"),e.conversationIDList.forEach(function(a){n._isValidConversationID(a)||n._errorLog(o,"conversationIDList","InvalidConversationID",a)}),"clearHistoryMessage"in e&&typeof e.clearHistoryMessage!="boolean"&&this._errorLog(o,"clearHistoryMessage","BooleanRequiredLog"),e.conversationIDList.length>100&&(e.conversationIDList=e.conversationIDList.slice(0,100)),this.deleteConversationList(e))}},{key:"deleteConversationList",value:function(e){var n=this,o=e.conversationIDList,a=o===void 0?[]:o,r=e.clearHistoryMessage,i=r===void 0||r,u=e.flag,l=u===void 0?0:u,d="".concat(this._n,".").concat("deleteConversationList");h.l("".concat(d," conversationIDList.length:").concat(a.length," clearHistoryMessage:").concat(i));var p=new L("deleteConversationList");return p.setMessage("conversationIDList:".concat(a)),Promise.all([this.rmLocalOnlyConversationList(a),this.rmLocalAndRemoteConversationList(a,i)]).then(function(g){p.setNetworkType(n.getNetworkType()).end();var _=[].concat(B(g[0]),B(g[1]));return _.length===0?T(new oe({code:k.CONVERSATION_NOT_FOUND})):(h.l("".concat(d," ok")),Y(l===1?{conversationID:_[0]}:{conversationIDList:_}))}).catch(function(g){return n.probeNetwork().then(function(_){var v=N(_,2),M=v[0],y=v[1];p.setError(g,M,y).end()}),h.e("".concat(d," failed. error:"),g),T(g)})}},{key:"rmLocalOnlyConversationList",value:function(e){var n=this;return e.filter(function(o){if(!n._conversationMap.has(o))return!1;var a=n.getLocalConversation(o).type;return a!==f.CONV_GROUP||n._hasLocalGroup(o)?a===f.CONV_SYSTEM&&(n.getModule(V).deleteGroupSystemNotice({messageList:n._messageListHandler.getLocalMessageList(o)}),n.deleteLocalConversation(o),!0):(n.deleteLocalConversation(o),!0)})}},{key:"rmLocalAndRemoteConversationList",value:function(e,n){var o=this,a={fromAccount:this.getMyUserID(),conversationList:[],clearHistoryMessage:n?1:0};return e.forEach(function(r){if(o._conversationMap.has(r)){var i=o.getLocalConversation(r).type;i===f.CONV_C2C?a.conversationList.push({toAccount:r.replace(i,""),type:1}):i===f.CONV_GROUP&&o._hasLocalGroup(r)&&a.conversationList.push({toGroupID:r.replace(i,""),type:2})}}),a.conversationList.length===0?[]:this.request({protocolName:ea,requestData:a}).then(function(r){var i=[];return r.data.resultList.length>0&&r.data.resultList.map(function(u){if(u.code===0){var l=u.type===1?"".concat(f.CONV_C2C).concat(u.to):"".concat(f.CONV_GROUP).concat(u.groupID);i.push(l)}}),o.deleteLocalConversationList(i),i})}},{key:"clearHistoryMessage",value:function(e){var n=this,o={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e))return T({code:k.CONVERSATION_NOT_FOUND});var a=this._conversationMap.get(e).type;if(a===f.CONV_C2C)o.type=1,o.toAccount=e.replace(f.CONV_C2C,"");else{if(a!==f.CONV_GROUP)return a===f.CONV_SYSTEM?(this.getModule(V).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),Y({conversationID:e})):T({code:k.CONVERSATION_UN_RECORDED_TYPE});o.type=2,o.toGroupID=e.replace(f.CONV_GROUP,"")}var r="".concat(this._n,".").concat("clearHistoryMessage"),i=new L("clearHistoryMessage");return i.setMessage("conversationID:".concat(e)),h.l("".concat(r,". conversationID:").concat(e)),this.setMessageRead({conversationID:e}).then(function(){return n.request({protocolName:ta,requestData:o})}).then(function(){i.setNetworkType(n.getNetworkType()).end(),h.l("".concat(r," ok")),n._messageListHandler.removeByConversationID(e),n.setCompleted(e);var u=n.getLocalConversation(e);return u&&(u.updateLastMessage(),n._sortConversationListAndEmitEvent()),Y({conversationID:e})}).catch(function(u){return n.probeNetwork().then(function(l){var d=N(l,2),p=d[0],g=d[1];i.setError(u,p,g).end()}),h.e("".concat(r," failed. error:"),u),T(u)})}},{key:"pinConversation",value:function(e){var n=this,o=e.conversationID,a=e.isPinned;if(!this._conversationMap.has(o))return T({code:k.CONVERSATION_NOT_FOUND});var r=this.getLocalConversation(o);if(r.isPinned===a)return Y({conversationID:o});var i="".concat(this._n,".").concat("pinConversation"),u=new L("pinConversation");u.setMessage("conversationID:".concat(o," isPinned:").concat(a)),h.l("".concat(i,". conversationID:").concat(o," isPinned:").concat(a));var l=null;return Pe(o)?l={type:1,toAccount:o.replace(f.CONV_C2C,"")}:Ae(o)&&(l={type:2,groupID:o.replace(f.CONV_GROUP,"")}),this.request({protocolName:na,requestData:{fromAccount:this.getMyUserID(),operationType:a===!0?1:2,itemList:[l]}}).then(function(){return u.setNetworkType(n.getNetworkType()).end(),h.l("".concat(i," ok")),r.isPinned!==a&&(r.isPinned=a,n._sortConversationListAndEmitEvent()),x({conversationID:o})}).catch(function(d){return n.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];u.setError(d,_,v).end()}),h.e("".concat(i," failed. error:"),d),T(d)})}},{key:"setMessageRemindType",value:function(e){return this._messageRemindHandler.set(e)}},{key:"patchMessageRemindType",value:function(e){var n=e.ID,o=e.isC2CConversation,a=e.messageRemindType,r=!1,i=this.getLocalConversation(o?"".concat(f.CONV_C2C).concat(n):"".concat(f.CONV_GROUP).concat(n));return i&&i.messageRemindType!==a&&(i.messageRemindType=a,r=!0),h.d("".concat(this._n,".patchMessageRemindType options:"),e,"ret:".concat(r)),r}},{key:"onC2CMessageRemindTypeSynced",value:function(e){var n=this,o="".concat(this._n,".onC2CMessageRemindTypeSynced");h.d(o,e),e.dataList.forEach(function(a){if(!R(a.muteNotificationsSync)){var r,i=a.muteNotificationsSync,u=i.to,l=i.updateSequence,d=i.muteFlag;n._messageRemindHandler.setUpdateSequence(l),d===0?r=f.MSG_REMIND_ACPT_AND_NOTE:d===1?r=f.MSG_REMIND_DISCARD:d===2&&(r=f.MSG_REMIND_ACPT_NOT_NOTE);var p=0;n.patchMessageRemindType({ID:u,isC2CConversation:!0,messageRemindType:r})&&(p+=1),h.l("".concat(o," updateCount:").concat(p)),p>=1&&n.emitConversationUpdate(!0,!1)}})}},{key:"onGroupMessageRemindTypeSynced",value:function(e){h.d("".concat(this._n,".onGroupMessageRemindTypeSynced options:"),e),this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e)}},{key:"deleteLocalConversation",value:function(e){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],o=this._conversationMap.has(e);if(h.d("".concat(this._n,".deleteLocalConversation conversationID:").concat(e," has:").concat(o)),o&&(this._conversationMap.delete(e),this._roamingMessageKeyAndTimeMap.has(e)&&this._roamingMessageKeyAndTimeMap.delete(e),this._roamingMessageSequenceMap.has(e)&&this._roamingMessageSequenceMap.delete(e),this._setStorageConversationList(),this._messageListHandler.removeByConversationID(e),this._completedMap.delete(e),n)){var a=!this._isTopicConversation(e);this.emitConversationUpdate(a,!1)}}},{key:"deleteLocalConversationList",value:function(e){var n=this,o=0,a=!1;e.forEach(function(r){n._conversationMap.has(r)&&(o+=n._conversationMap.get(r).unreadCount||0,n.deleteLocalConversation(r,!1),a=!0)}),h.l("".concat(this._n,".deleteLocalConversationList conversationIDList.length:").concat(e.length," isConvIDExisted:").concat(a)),a&&(this.emitConversationUpdate(!0,!1),o>0&&this.emitTotalUnreadMessageCountUpdate())}},{key:"isMessageSentByCurrentInstance",value:function(e){return!(!this._messageListHandler.hasLocalMessage(e.conversationID,e.ID)&&!this.singlyLinkedList.has(e.random))}},{key:"modifyMessageList",value:function(e){if(e.startsWith(f.CONV_C2C)&&this._conversationMap.has(e)){var n=this._conversationMap.get(e),o=Date.now();this._messageListHandler.modifyMessageSentByPeer({conversationID:e,latestNick:n.userProfile.nick,latestAvatar:n.userProfile.avatar});var a=this.getModule(pe).getNickAndAvatarByUserID(this.getMyUserID());this._messageListHandler.modifyMessageSentByMe({conversationID:e,latestNick:a.nick,latestAvatar:a.avatar}),h.l("".concat(this._n,".modifyMessageList conversationID:").concat(e," cost ").concat(Date.now()-o," ms"))}}},{key:"updateUserProfileSpecifiedKey",value:function(e){h.l("".concat(this._n,".updateUserProfileSpecifiedKey options:"),e);var n=e.conversationID,o=e.nick,a=e.avatar;if(this._conversationMap.has(n)){var r=this._conversationMap.get(n).userProfile;z(o)&&r.nick!==o&&(r.nick=o),z(a)&&r.avatar!==a&&(r.avatar=a),this.emitConversationUpdate(!0,!1)}}},{key:"_onMyProfileModified",value:function(e){var n=this,o=this.getLocalConversationList(),a=Date.now();o.forEach(function(r){n.modifyMessageSentByMe(m({conversationID:r.conversationID},e))}),h.l("".concat(this._n,"._onMyProfileModified. modify all messages sent by me, cost ").concat(Date.now()-a," ms"))}},{key:"modifyMessageSentByMe",value:function(e){this._messageListHandler.modifyMessageSentByMe(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._messageListHandler.getLatestMessageSentByMe(e)}},{key:"modifyMessageSentByPeer",value:function(e){this._messageListHandler.modifyMessageSentByPeer(e)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._messageListHandler.getLatestMessageSentByPeer(e)}},{key:"pushIntoNoticeResult",value:function(e,n){return!(!this._messageListHandler.pushIn(n)||this.singlyLinkedList.has(n.random))&&(e.push(n),!0)}},{key:"getLocalLastMessage",value:function(e){return this._messageListHandler.getLocalLastMessage(e)}},{key:"checkAndPatchRemark",value:function(){var e=Promise.resolve();if(this._conversationMap.size===0)return e;var n=this.getModule(ce);if(!n)return e;var o=B(this._conversationMap.values()).filter(function(r){return r.type===f.CONV_C2C});if(o.length===0)return e;var a=0;return o.forEach(function(r){var i=r.conversationID.replace(f.CONV_C2C,"");if(n.isMyFriend(i)){var u=n.getFriendRemark(i);r.remark!==u&&(r.remark=u,a+=1)}}),h.l("".concat(this._n,".checkAndPatchRemark. c2c conversation count:").concat(o.length,", patched count:").concat(a)),e}},{key:"updateTopicConversation",value:function(e){this._updateLocalConversationList({conversationOptionsList:e,isFromGetConversations:!0})}},{key:"sendReadReceipt",value:function(e){var n=e[0],o=null;return n.conversationType===f.CONV_C2C?o=this._m.getModule(fe):n.conversationType===f.CONV_GROUP&&(o=this._m.getModule(V)),o?o.sendReadReceipt(e):T({code:k.CANNOT_FIND_MODULE})}},{key:"getReadReceiptList",value:function(e){var n=e[0],o=null;return n.conversationType===f.CONV_C2C?o=this._m.getModule(fe):n.conversationType===f.CONV_GROUP&&(o=this._m.getModule(V)),o?o.getReadReceiptList(e):T({code:k.CANNOT_FIND_MODULE})}},{key:"getLastMessageTime",value:function(e){var n=this.getLocalConversation(e);return n?n.lastMessage.lastTime:0}},{key:"getTotalUnreadMessageCount",value:function(){var e=this.getLocalConversationList(),n=0;return e.forEach(function(o){o.type!==f.CONV_SYSTEM&&(o.messageRemindType!==""&&o.messageRemindType!==f.MSG_REMIND_ACPT_AND_NOTE||(n+=o.unreadCount))}),n}},{key:"emitTotalUnreadMessageCountUpdate",value:function(){var e=this.getTotalUnreadMessageCount();this._convTotalUnreadCount!==e&&(h.l("".concat(this._n,".emitTotalUnreadMessageCountUpdate from ").concat(this._convTotalUnreadCount," to ").concat(e)),this._convTotalUnreadCount=e,this.emitOuterEvent(W.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._pagingStatus=we.NOT_START,this._messageListHandler.reset(),this._messageRemindHandler.reset(),this._roamingMessageKeyAndTimeMap.clear(),this._roamingMessageSequenceMap.clear(),this.singlyLinkedList.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._conversationMap.clear(),this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._remoteGroupReadSequenceMap.clear(),this._convTotalUnreadCount=0,this._pagingGetCostList.length=0,this.resetReady()}}]),s}(le),iu=function(){function c(t){F(this,c),this._groupModule=t,this._n="GroupTipsHandler",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map}return q(c,[{key:"onCheckTimer",value:function(t){t%1==0&&this._cachedGroupTipsMap.size>0&&this._checkCachedGroupTips()}},{key:"_checkCachedGroupTips",value:function(){var t=this;this._cachedGroupTipsMap.forEach(function(s,e){var n=t._checkCountMap.get(e),o=t._groupModule.hasLocalGroup(e);h.l("".concat(t._n,"._checkCachedGroupTips groupID:").concat(e," hasLocalGroup:").concat(o," checkCount:").concat(n)),o?(t._notifyCachedGroupTips(e),t._checkCountMap.delete(e),t._groupModule.deleteUnjoinedAVChatRoom(e)):n>=t.MAX_CHECK_COUNT?(t._deleteCachedGroupTips(e),t._checkCountMap.delete(e)):(n++,t._checkCountMap.set(e,n))})}},{key:"onNewGroupTips",value:function(t){h.d("".concat(this._n,".onReceiveGroupTips count:").concat(t.dataList.length));var s=this.newGroupTipsStoredAndSummary(t),e=s.eventDataList,n=s.result,o=s.AVChatRoomMessageList;o.length>0&&this._groupModule.onAVChatRoomMessage(o),e.length>0&&(this._groupModule.updateNextMessageSeq(e),this._groupModule.getModule(P).onNewMessage({conversationOptionsList:e,isInstantMessage:!0})),n.length>0&&(this._groupModule.emitOuterEvent(W.MESSAGE_RECEIVED,n),this.handleMessageList(n))}},{key:"newGroupTipsStoredAndSummary",value:function(t){for(var s=this,e=t.event,n=t.dataList,o=null,a=[],r=[],i={},u=[],l=function(g,_){var v=ms(n[g]);if(e===6&&(s._groupModule.isGroupAttributesUpdatedNotice(v)||s._groupModule.isGroupCountersNotice(v)))return"continue";var M=v.groupProfile,y=M.groupID,C=M.communityType,D=C===void 0?0:C,E=M.topicID,A=E===void 0?void 0:E,O=M.invisible,U=void 0,K=s._groupModule.isMessageFromTopic(D,A);if(K){U=f.CONV_TOPIC,v.to=A;var j=s._groupModule.getModule(ae);j.hasLocalTopic(y,A)||s._getTopicPendingMap.has(A)||(s._getTopicPendingMap.set(A,1),j.getTopicList({groupID:y,topicIDList:[A]}).finally(function(){s._getTopicPendingMap.delete(A)}))}var H=s._groupModule.hasLocalGroup(y);if(!H&&s._groupModule.isUnjoinedAVChatRoom(y))return"continue";if(!H&&!K)return s._cacheGroupTipsAndProbe({groupID:y,event:e,item:v}),"continue";if(s._groupModule.isMessageFromOrToAVChatroom(y))return v.event=e,u.push(v),"continue";if(v.currentUser=s._groupModule.getMyUserID(),v.conversationType=f.CONV_GROUP,(o=new ve(v)).setElement({type:f.MSG_GRP_TIP,content:m(m({},v.elements),{},{groupProfile:v.groupProfile})}),o.isSystemMessage=!1,O===1)return s._qualityStat(o),"continue";var J=s._groupModule.getModule(P),de=o,De=de.conversationID,he=de.sequence;if(e===6)o._onlineOnlyFlag=!0,r.push(o);else if(!J.pushIntoNoticeResult(r,o))return"continue";if(s._groupModule.isMessageFromCommunityOfTopic(D,A)||e===6&&J.getLocalConversation(De))return"continue";e!==6&&s._qualityStat(o);var Me=J.isRemoteRead({conversationID:De,sequence:he});if(S(i[De])){var Ue=0;o.flow==="in"&&(o._isExcludedFromUnreadCount||o._onlineOnlyFlag||Me||(Ue=1)),i[De]=a.push({conversationID:De,unreadCount:Ue,type:S(U)?o.conversationType:U,subType:o.conversationSubType,lastMessage:o._isExcludedFromLastMessage?"":o})-1}else{var Ze=i[De];a[Ze].type=o.conversationType,a[Ze].subType=o.conversationSubType,a[Ze].lastMessage=o._isExcludedFromLastMessage?"":o,o.flow==="in"&&(o._isExcludedFromUnreadCount||o._onlineOnlyFlag||Me||a[Ze].unreadCount++)}},d=0,p=n.length;d<p;d++)l(d);return{eventDataList:a,result:r,AVChatRoomMessageList:u}}},{key:"_qualityStat",value:function(t){this._groupModule.getModule(Re).addMessageSequence({key:Ut,message:t})}},{key:"handleMessageList",value:function(t){var s=this;t.forEach(function(e){switch(e.payload.operationType){case 1:s._onNewMemberComeIn(e);break;case 2:s._onMemberQuit(e);break;case 3:s._onMemberKickedOut(e);break;case 4:s._onMemberSetAdmin(e);break;case 5:s._onMemberCancelledAdmin(e);break;case 6:s._onGroupProfileModified(e);break;case 7:s._onMemberInfoModified(e);break;case 8:s._onTopicProfileUpdated(e);break;default:h.w("".concat(s._n,".handleMessageList unknown operationType:").concat(e.payload.operationType))}})}},{key:"_onNewMemberComeIn",value:function(t){var s=t.payload,e=s.memberNum,n=s.groupProfile.groupID,o=this._groupModule.getLocalGroupProfile(n);o&&ee(e)&&o.memberCount!==e&&(o.memberCount=e,this._updateConversationGroupProfile(o))}},{key:"_onMemberQuit",value:function(t){var s=t.payload,e=s.memberNum,n=s.groupProfile.groupID,o=this._groupModule.getLocalGroupProfile(n);o&&ee(e)&&o.memberCount!==e&&(o.memberCount=e,this._updateConversationGroupProfile(o)),this._groupModule.getModule(me).deleteLocalGroupMembers(n,t.payload.userIDList)}},{key:"_onMemberKickedOut",value:function(t){var s=t.payload,e=s.memberNum,n=s.groupProfile.groupID,o=this._groupModule.getLocalGroupProfile(n);o&&ee(e)&&o.memberCount!==e&&(o.memberCount=e,this._updateConversationGroupProfile(o)),this._groupModule.getModule(me).deleteLocalGroupMembers(n,t.payload.userIDList)}},{key:"_updateConversationGroupProfile",value:function(t){this._groupModule.getModule(P).updateConversationGroupProfile([t])}},{key:"_onMemberSetAdmin",value:function(t){var s=t.payload.groupProfile.groupID,e=t.payload.userIDList,n=this._groupModule.getModule(me);e.forEach(function(o){var a=n.getLocalGroupMemberInfo(s,o);a&&a.updateRole(f.GRP_MBR_ROLE_ADMIN)})}},{key:"_onMemberCancelledAdmin",value:function(t){var s=t.payload.groupProfile.groupID,e=t.payload.userIDList,n=this._groupModule.getModule(me);e.forEach(function(o){var a=n.getLocalGroupMemberInfo(s,o);a&&a.updateRole(f.GRP_MBR_ROLE_MEMBER)})}},{key:"_onGroupProfileModified",value:function(t){var s=this,e=t.payload,n=e.newGroupProfile,o=e.groupProfile.groupID,a=this._groupModule.getLocalGroupProfile(o);Object.keys(n).forEach(function(i){switch(i){case"ownerID":s._ownerChanged(a,n);break;case"groupName":a.name=n[i];break;default:a[i]=n[i]}});var r=!a.isSupportTopic;this._groupModule.emitGroupListUpdate(!0,r)}},{key:"_ownerChanged",value:function(t,s){var e=t.groupID,n=this._groupModule.getLocalGroupProfile(e),o=this._groupModule.getMyUserID();if(o===s.ownerID){n.updateGroup({selfInfo:{role:f.GRP_MBR_ROLE_OWNER}});var a=this._groupModule.getModule(me),r=a.getLocalGroupMemberInfo(e,o),i=this._groupModule.getLocalGroupProfile(e).ownerID,u=a.getLocalGroupMemberInfo(e,i);r&&r.updateRole(f.GRP_MBR_ROLE_OWNER),u&&u.updateRole(f.GRP_MBR_ROLE_MEMBER)}}},{key:"_onMemberInfoModified",value:function(t){var s=t.to,e=t.payload,n=e.groupProfile,o=e.memberList,a=n.groupID;Le(s)&&this._updateTopicMuteTime(t);var r=this._groupModule.getModule(me);o.forEach(function(i){var u=r.getLocalGroupMemberInfo(a,i.userID);u&&ee(i.muteTime)&&u.updateMuteUntil(i.muteTime)})}},{key:"_updateTopicMuteTime",value:function(t){var s=t.to,e=t.payload,n=e.groupProfile,o=e.memberList,a=o===void 0?[]:o,r=this._groupModule.getModule(ae),i=n.groupID,u=r.getLocalTopic(i,s);if(u){for(var l=!1,d=0;d<a.length;d++){var p=a[d];if(p.userID===this._groupModule.getMyUserID()&&p.muteTime>=0){u.updateSelfInfo({muteTime:p.muteTime}),l=!0;break}}l&&this._groupModule.emitOuterEvent(W.TOPIC_UPDATED,{groupID:i,topic:u})}}},{key:"_onTopicProfileUpdated",value:function(t){var s=t.payload,e=s.groupProfile.groupID,n=s.newTopicInfo;this._groupModule.getModule(ae).onTopicProfileUpdated(m({groupID:e,topicID:t.to},n))}},{key:"_cacheGroupTips",value:function(t,s){this._cachedGroupTipsMap.has(t)||this._cachedGroupTipsMap.set(t,[]),this._cachedGroupTipsMap.get(t).push(s)}},{key:"_deleteCachedGroupTips",value:function(t){this._cachedGroupTipsMap.has(t)&&this._cachedGroupTipsMap.delete(t)}},{key:"_notifyCachedGroupTips",value:function(t){var s=this,e=this._cachedGroupTipsMap.get(t)||[];e.forEach(function(n){s.onNewGroupTips(n)}),this._deleteCachedGroupTips(t),h.l("".concat(this._n,"._notifyCachedGroupTips groupID:").concat(t," count:").concat(e.length))}},{key:"_cacheGroupTipsAndProbe",value:function(t){var s=this,e=t.groupID,n=t.event,o=t.item;this._cacheGroupTips(e,{event:n,dataList:[o]}),this._groupModule.getGroupSimplifiedInfo(e).then(function(a){a.type===f.GRP_AVCHATROOM?s._groupModule.hasLocalGroup(e)?s._notifyCachedGroupTips(e):s._groupModule.setUnjoinedAVChatRoom(e):(s._groupModule.updateGroupMap([a]),s._notifyCachedGroupTips(e))}),this._checkCountMap.has(e)||this._checkCountMap.set(e,0),h.l("".concat(this._n,"._cacheGroupTipsAndProbe groupID:").concat(e))}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear()}}]),c}(),uu=function(){function c(t){F(this,c),this._groupModule=t,this._n="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map,this._isPagingGetCompleted=!1,t.getInnerEmitterInstance().once(ot,this._initGroupList,this)}return q(c,[{key:"onCheckTimer",value:function(t){t%1==0&&this._cachedGroupMessageMap.size>0&&this._checkCachedGroupMessage()}},{key:"_checkCachedGroupMessage",value:function(){var t=this;this._cachedGroupMessageMap.forEach(function(s,e){var n=t._checkCountMap.get(e),o=t._groupModule.hasLocalGroup(e);h.l("".concat(t._n,"._checkCachedGroupMessage groupID:").concat(e," hasLocalGroup:").concat(o," checkCount:").concat(n)),o?(t._notifyCachedGroupMessage(e),t._checkCountMap.delete(e),t._groupModule.deleteUnjoinedAVChatRoom(e)):n>=t.MAX_CHECK_COUNT?(t._deleteCachedGroupMessage(e),t._checkCountMap.delete(e)):(n++,t._checkCountMap.set(e,n))})}},{key:"_initGroupList",value:function(){var t=this;h.l("".concat(this._n,"._initGroupList"));var s=new L("getGroupListInStorage"),e=this._groupModule.getStorageGroupList();if(b(e)&&e.length>0){e.forEach(function(o){t._groupModule.initGroupMap(o)}),this._groupModule.emitGroupListUpdate(!0,!1);var n=this._groupModule.getLocalGroupList().length;s.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:".concat(n)).end()}else s.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:0").end();h.l("".concat(this._n,"._initGroupList ok"))}},{key:"handleUpdateGroupLastMessage",value:function(t){var s="".concat(this._n,".handleUpdateGroupLastMessage");if(h.l("".concat(s," conversation count:").concat(t.length,", local group count:").concat(this._groupModule.getLocalGroupList().length)),this._groupModule.getGroupMap().size!==0){for(var e,n,o,a=!1,r=0,i=t.length;r<i;r++)(e=t[r]).type===f.CONV_GROUP&&(n=e.conversationID.split(/^GROUP/)[1],(o=this._groupModule.getLocalGroupProfile(n))&&(o.lastMessage=m({},e.lastMessage),a=!0));a&&(this._groupModule.sortLocalGroupList(),this._groupModule.emitGroupListUpdate(!0,!1))}else this.tempConversationList=t}},{key:"onNewGroupMessage",value:function(t){h.d("".concat(this._n,".onNewGroupMessage count:").concat(t.dataList.length));var s=this._newGroupMessageStoredAndSummary(t),e=s.conversationOptionsList,n=s.messageList,o=s.AVChatRoomMessageList;o.length>0&&this._groupModule.onAVChatRoomMessage(o),this._groupModule.filterModifiedMessage(n),e.length>0&&(this._groupModule.updateNextMessageSeq(e),this._groupModule.getModule(P).onNewMessage({conversationOptionsList:e,isInstantMessage:t.isInstantMessage||!0,updateUnreadCount:t.updateUnreadCount||!0}));var a=this._groupModule.filterUnmodifiedMessage(n);a.length>0&&this._groupModule.emitOuterEvent(W.MESSAGE_RECEIVED,a),n.length=0}},{key:"_newGroupMessageStoredAndSummary",value:function(t){var s=this,e=t.dataList,n=t.event,o=t.isInstantMessage,a=null,r=[],i=[],u=[],l={},d=this._groupModule.getModule(jt),p=this._groupModule.getFileDownloadProxy(),g=e.length;g>1&&e.sort(function(M,y){return M.sequence-y.sequence});for(var _=function(M){var y=ms(e[M]),C=y.groupProfile,D=C.groupID,E=C.communityType,A=E===void 0?0:E,O=C.topicID,U=O===void 0?void 0:O,K=C.invisible,j=void 0,H=s._groupModule.isMessageFromTopic(A,U);if(H){j=f.CONV_TOPIC,y.to=U;var J=s._groupModule.getModule(ae);J.hasLocalTopic(D,U)||s._getTopicPendingMap.has(U)||(s._getTopicPendingMap.set(U,1),J.getTopicList({groupID:D,topicIDList:[U]}).finally(function(){s._getTopicPendingMap.delete(U)}))}var de=s._groupModule.hasLocalGroup(D);if(!de&&s._groupModule.isUnjoinedAVChatRoom(D))return"continue";if(!de&&!H)return s._cacheGroupMessageAndProbe({groupID:D,event:n,item:y}),"continue";if(s._groupModule.isMessageFromOrToAVChatroom(D))return y.event=n,u.push(y),"continue";if(y.currentUser=s._groupModule.getMyUserID(),y.conversationType=f.CONV_GROUP,y.isSystemMessage=!!y.isSystemMessage,a=new ve(y),y.elements=d.parseElements(y.elements,y.from),a.setElement(y.elements,p),K===1)return s._qualityStat(o,a),"continue";var De=e[M].isModified===1,he=s._groupModule.getModule(P);if(he.isMessageSentByCurrentInstance(a)?a.isModified=De:De=!1,y.onlineOnlyFlag===1)a._onlineOnlyFlag=!0,he.isMessageSentByCurrentInstance(a)||i.push(a);else{if(s._groupModule.isMessageFromCommunityOfTopic(A,U))return i.push(a),"continue";if(!he.pushIntoMessageList(i,a,De))return"continue";s._qualityStat(o,a);var Me=a,Ue=Me.conversationID,Ze=Me.sequence,wt=he.isRemoteRead({conversationID:Ue,sequence:Ze});if(S(l[Ue])){var Nn=0;a.flow==="in"&&(a._isExcludedFromUnreadCount||wt||(Nn=1)),l[Ue]=r.push({conversationID:Ue,unreadCount:Nn,type:S(j)?a.conversationType:j,subType:a.conversationSubType,lastMessage:a._isExcludedFromLastMessage?"":a})-1}else{var Ft=l[Ue];r[Ft].type=S(j)?a.conversationType:j,r[Ft].subType=a.conversationSubType,r[Ft].lastMessage=a._isExcludedFromLastMessage?"":a,a.flow==="in"&&(a._isExcludedFromUnreadCount||wt||r[Ft].unreadCount++)}}},v=0;v<g;v++)_(v);return{conversationOptionsList:r,messageList:i,AVChatRoomMessageList:u}}},{key:"_qualityStat",value:function(t,s){var e=this._groupModule.getModule(Re);e.addMessageSequence({key:Ut,message:s}),t&&s.clientTime>0&&e.addMessageDelay(s.clientTime)}},{key:"onGroupMessageRevoked",value:function(t){var s=this._groupModule.getModule(P),e=[],n=null,o=!0;t.dataList.forEach(function(a){var r=a.elements.revokedInfos;S(r)||r.forEach(function(i){var u=R(i.topicID)?"GROUP".concat(i.groupID):"GROUP".concat(i.topicID);n=s.revoke(u,i.sequence,i.random);var l=i.revokerInfo&&i.revokerInfo.revoker;if(n)n.revoker=l,e.push(n);else{var d={conversationID:u,to:i.topicID||"",sequence:i.sequence,time:i.time,revoker:l};s.isLastMessageRevoked(d)&&(e.push(d),o=!1)}})}),e.length!==0&&(s.onMessageRevoked(e),o===!0&&(h.l("".concat(this._n,".onGroupMessageRevoked count:").concat(e.length)),this._groupModule.emitOuterEvent(W.MESSAGE_REVOKED,e)))}},{key:"_groupListTreeShaking",value:function(t){for(var s=new Map(B(this._groupModule.getGroupMap())),e=0,n=t.length;e<n;e++)s.delete(t[e].groupID);this._groupModule.hasJoinedAVChatRoom()&&this._groupModule.getJoinedAVChatRoom().forEach(function(i){s.delete(i)}),this._groupModule.getGroupMap().forEach(function(i,u){i.isSupportTopic&&s.delete(u)});for(var o=B(s.keys()),a=0,r=o.length;a<r;a++)this._groupModule.deleteGroup(o[a])}},{key:"getGroupList",value:function(t){var s=this,e="".concat(this._n,".").concat("getGroupList"),n=new L("getGroupList");h.l("".concat(e));var o={introduction:"Introduction",notification:"Notification",createTime:"CreateTime",ownerID:"Owner_Account",lastInfoTime:"LastInfoTime",memberNum:"MemberNum",maxMemberNum:"MaxMemberNum",joinOption:"ApplyJoinOption",inviteOption:"InviteJoinOption",muteAllMembers:"ShutUpAllMember"},a=["Type","Name","FaceUrl","NextMsgSeq","LastMsgTime","AtInfoList","LastRecallTime"],r=[];t&&t.groupProfileFilter&&t.groupProfileFilter.forEach(function(l){o[l]&&a.push(o[l])});var i=(t||{}).isGroupWithTopicOnly,u=i!==void 0&&i;return this._pagingGetGroupList({limit:50,offset:0,groupBaseInfoFilter:a,groupList:r,isGroupWithTopicOnly:u}).then(function(){h.l("".concat(e," ok. count:").concat(r.length," isGroupWithTopicOnly:").concat(u)),u||s._groupListTreeShaking(r),s._groupModule.updateGroupMap(r);var l=s._groupModule.getLocalGroupList().length;n.setNetworkType(s._groupModule.getNetworkType()).setMessage("remote count:".concat(r.length,", after tree shaking, local count:").concat(l,", isGroupWithTopicOnly:").concat(u)).end(),s.tempConversationList&&(s.handleUpdateGroupLastMessage(s.tempConversationList),s.tempConversationList=null),s._groupModule.patchGroupMessageRemindType(),s._groupModule.recomputeUnreadCount(),s._groupModule.emitGroupListUpdate(!0,!u);var d=s._groupModule.getLocalGroupList();if(u){var p=d.filter(function(g){return g.isSupportTopic===!0});return x({groupList:p})}return s._isPagingGetCompleted=!0,x({groupList:d})}).catch(function(l){return s._groupModule.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];n.setError(l,g,_).end()}),h.e("".concat(e," failed. error:"),l),T(l)})}},{key:"isPagingGetCompleted",value:function(){return this._isPagingGetCompleted}},{key:"_pagingGetGroupList",value:function(t){var s=this,e="".concat(this._n,".").concat("_pagingGetGroupList"),n=t.isCommunityRelay,o=n!==void 0&&n,a=t.isGroupWithTopicOnly,r=a!==void 0&&a,i=t.limit,u=t.offset,l=t.groupBaseInfoFilter,d=t.groupList;if(r)return this._pagingGetGroupListWithTopic({limit:i,offset:u,groupBaseInfoFilter:l,groupList:d});var p=new L("_pagingGetGroupList");return this._groupModule.request({protocolName:uo,requestData:{type:o?f.GRP_COMMUNITY:void 0,memberAccount:this._groupModule.getMyUserID(),limit:i,offset:u,responseFilter:{groupBaseInfoFilter:l,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]}}}).then(function(g){var _=g.data,v=_.groups,M=v===void 0?[]:v,y=_.totalCount;d.push.apply(d,B(M)),s._handleGroupAtInfoWithoutTopic(o,M);var C=u+i,D=!(y>C),E="offset:".concat(u," totalCount:").concat(y," isCompleted:").concat(D," ")+"currentCount:".concat(d.length," isCommunityRelay:").concat(o);return p.setNetworkType(s._groupModule.getNetworkType()).setMessage("".concat(E)).end(),o||D?!o&&D?(h.l("".concat(e," start to get community list")),u=0,s._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:l,groupList:d,isCommunityRelay:!0})):o&&!D?(u=C,s._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:l,groupList:d,isCommunityRelay:!0})):(h.l("".concat(e," ok. totalCount:").concat(d.length)),x({groupList:d})):(u=C,s._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:l,groupList:d}))}).catch(function(g){return g.code!==11e3&&s._groupModule.probeNetwork().then(function(_){var v=N(_,2),M=v[0],y=v[1];p.setMessage("isCommunityRelay:".concat(o)).setError(g,M,y).end()}),o?(g.code===11e3&&(p=null,h.l("".concat(e," ok. community unavailable"))),Y({groupList:d})):T(g)})}},{key:"_pagingGetGroupListWithTopic",value:function(t){var s=this,e="".concat(this._n,"._pagingGetGroupListWithTopic"),n=t.limit,o=t.offset,a=t.groupBaseInfoFilter,r=t.groupList,i=new L("pagingGetGroupListWithTopic");return this._groupModule.request({protocolName:uo,requestData:{type:f.GRP_COMMUNITY,memberAccount:this._groupModule.getMyUserID(),limit:n,offset:o,responseFilter:{groupBaseInfoFilter:a,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]},isSupportTopic:1}}).then(function(u){var l=u.data,d=l.groups,p=d===void 0?[]:d,g=l.totalCount;r.push.apply(r,B(p));var _=o+n,v=!(g>_),M="offset:".concat(o," totalCount:").concat(g," isCompleted:").concat(v," ")+"currentCount:".concat(r.length);return i.setNetworkType(s._groupModule.getNetworkType()).setMessage("".concat(M)).end(),v?(h.l("".concat(e," ok. totalCount:").concat(r.length)),x({groupList:r})):(o=_,s._pagingGetGroupListWithTopic({limit:n,offset:o,groupBaseInfoFilter:a,groupList:r}))}).catch(function(u){return s._groupModule.probeNetwork().then(function(l){var d=N(l,2),p=d[0],g=d[1];i.setError(u,p,g).end()}),T(u)})}},{key:"_cacheGroupMessage",value:function(t,s){this._cachedGroupMessageMap.has(t)||this._cachedGroupMessageMap.set(t,[]),this._cachedGroupMessageMap.get(t).push(s)}},{key:"_deleteCachedGroupMessage",value:function(t){this._cachedGroupMessageMap.has(t)&&this._cachedGroupMessageMap.delete(t)}},{key:"_notifyCachedGroupMessage",value:function(t){var s=this,e=this._cachedGroupMessageMap.get(t)||[];e.forEach(function(n){s.onNewGroupMessage(n)}),this._deleteCachedGroupMessage(t),h.l("".concat(this._n,"._notifyCachedGroupMessage groupID:").concat(t," count:").concat(e.length))}},{key:"_cacheGroupMessageAndProbe",value:function(t){var s=this,e=t.groupID,n=t.event,o=t.item;this._cacheGroupMessage(e,{event:n,dataList:[o]}),this._groupModule.getGroupSimplifiedInfo(e).then(function(a){a.type===f.GRP_AVCHATROOM?s._groupModule.hasLocalGroup(e)?s._notifyCachedGroupMessage(e):s._groupModule.setUnjoinedAVChatRoom(e):(s._groupModule.updateGroupMap([a]),s._notifyCachedGroupMessage(e))}),this._checkCountMap.has(e)||this._checkCountMap.set(e,0),h.l("".concat(this._n,"._cacheGroupMessageAndProbe groupID:").concat(e))}},{key:"_handleGroupAtInfoWithoutTopic",value:function(t,s){var e=this;t&&s.length!==0&&s.forEach(function(n){var o=n.groupID,a=n.groupAtInfoList,r=[];S(a)||(a.forEach(function(i){r.push(m(m({},i),{},{groupID:o}))}),e._groupModule.getModule(P).onNewGroupAtTips({dataList:r}))})}},{key:"reset",value:function(){this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear(),this._isPagingGetCompleted=!1,this._groupModule.getInnerEmitterInstance().once(ot,this._initGroupList,this)}}]),c}(),Dr=1,cu=2,kr=3,Sr=4,Er=5,lu=function(){function c(t){F(this,c),this._groupModule=t,this._n="GroupAttributesHandler",this._groupAttributesMap=new Map,this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(We,this._onCloudConfigUpdated,this)}return q(c,[{key:"_onCloudConfigUpdated",value:function(){var t=this._groupModule.getCloudConfig("grp_attr_cache_time");S(t)||(this.CACHE_EXPIRE_TIME=Number(t))}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesMap.forEach(function(t){t.localMainSequence=0})}},{key:"isGroupAttributesUpdatedNotice",value:function(t){var s=t.to,e=t.elements.newGroupProfile,n=!S(e)&&!R(e.groupAttributeOption);return n&&this._onGroupAttributesUpdated({groupID:s,groupAttributeOption:e.groupAttributeOption}),n}},{key:"_onGroupAttributesUpdated",value:function(t){var s=this,e=t.groupID,n=t.groupAttributeOption,o=n.mainSequence,a=n.isWithChangedAttributeInfo,r=n.groupAttributeList,i=r===void 0?[]:r,u=n.operationType;if(h.l("".concat(this._n,".onGroupAttributesUpdated. ")+"groupID:".concat(e," isWithChangedAttributeInfo:").concat(a," operationType:").concat(u)),!S(u)){this._groupAttributesCopy=this._getCachedAttributes({groupID:e});var l=o-this._getLocalGroupAttributes(e).localMainSequence;if(l!==0){if(a===1&&l===1)return this._refreshCachedGroupAttributes({groupID:e,remoteMainSequence:o,groupAttributeList:i,operationType:u}),void this._emitGroupAttributesUpdated(e);if(this._hasLocalGroupAttributes(e)){var d=this._getLocalGroupAttributes(e).avChatRoomKey;this._getGroupAttributes({groupID:e,avChatRoomKey:d}).then(function(){s._emitGroupAttributesUpdated(e)})}}}}},{key:"initGroupAttributesCache",value:function(t){var s=t.groupID,e=t.avChatRoomKey,n=e===void 0?void 0:e;this._groupAttributesMap.set(s,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:n}),h.l("".concat(this._n,".initGroupAttributesCache groupID:").concat(s," avChatRoomKey:").concat(n))}},{key:"initGroupAttributes",value:function(t){var s=this,e=t.groupID,n=t.groupAttributes,o=this._getLocalGroupAttributes(e),a=o.remoteMainSequence,r=o.avChatRoomKey,i=new L("initGroupAttributes");return i.setMessage("groupID:".concat(e," avChatRoomKey:").concat(r," mainSequence:").concat(a)),this._groupModule.request({protocolName:wa,requestData:{groupID:e,avChatRoomKey:r,mainSequence:a,groupAttributeList:this._transformGroupAttributes(n)}}).then(function(u){h.l("".concat(s._n,".").concat("initGroupAttributes"," ok. groupID:").concat(e));var l=u.data,d=l.mainSequence,p=B(l.groupAttributeList);return p.forEach(function(g){g.value=n[g.key]}),s._groupAttributesCopy=s._getCachedAttributes({groupID:e}),s._refreshCachedGroupAttributes({groupID:e,remoteMainSequence:d,groupAttributeList:p,operationType:Dr}),s._emitGroupAttributesUpdated(e),i.setNetworkType(s._groupModule.getNetworkType()).end(),x({groupAttributes:n})}).catch(function(u){return s._groupModule.probeNetwork().then(function(l){var d=N(l,2),p=d[0],g=d[1];i.setError(u,p,g).end()}),T(u)})}},{key:"setGroupAttributes",value:function(t){var s=this,e="".concat(this._n,".").concat("setGroupAttributes"),n=t.groupID,o=t.groupAttributes,a=this._getLocalGroupAttributes(n),r=a.remoteMainSequence,i=a.avChatRoomKey,u=a.attributes,l=this._transformGroupAttributes(o);l.forEach(function(p){var g=p.key;p.sequence=0,u.has(g)&&(p.sequence=u.get(g).sequence)});var d=new L("setGroupAttributes");return d.setMessage("groupID:".concat(n," groupAttributes:").concat(JSON.stringify(o))),h.l("".concat(e,". groupID:").concat(n," mainSequence:").concat(r)),this._groupModule.request({protocolName:Fa,requestData:{groupID:n,avChatRoomKey:i,mainSequence:r,groupAttributeList:l}}).then(function(p){h.l("".concat(e," ok."));var g=p.data,_=g.mainSequence,v=B(g.groupAttributeList);return v.forEach(function(M){M.value=o[M.key]}),s._groupAttributesCopy=s._getCachedAttributes({groupID:n}),s._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:_,groupAttributeList:v,operationType:cu}),s._emitGroupAttributesUpdated(n),d.setNetworkType(s._groupModule.getNetworkType()).end(),x({groupAttributes:o})}).catch(function(p){return s._groupModule.probeNetwork().then(function(g){var _=N(g,2),v=_[0],M=_[1];d.setError(p,v,M).end()}),T(p)})}},{key:"deleteGroupAttributes",value:function(t){var s=this,e=t.groupID,n=t.keyList,o=n===void 0?[]:n,a=this._getLocalGroupAttributes(e),r=a.remoteMainSequence,i=a.avChatRoomKey,u=a.attributes,l=B(u.keys()),d=xa,p=kr,g={groupID:e,avChatRoomKey:i,mainSequence:r},_=[];o.length>0&&(l=[],d=qa,p=Sr,o.forEach(function(M){var y=0;u.has(M)&&(y=u.get(M).sequence,l.push(M)),_.push({key:M,sequence:y})}),g.groupAttributeList=_);var v=new L("deleteGroupAttributes");return v.setMessage("groupID:".concat(e," mainSequence:").concat(r," keyList:").concat(o," protocolName:").concat(d)),this._groupModule.request({protocolName:d,requestData:g}).then(function(M){h.l("".concat(s._n,".").concat("deleteGroupAttributes"," ok. groupID:").concat(e));var y=M.data.mainSequence;return s._groupAttributesCopy=s._getCachedAttributes({groupID:e}),s._refreshCachedGroupAttributes({groupID:e,remoteMainSequence:y,groupAttributeList:_,operationType:p}),s._emitGroupAttributesUpdated(e),v.setNetworkType(s._groupModule.getNetworkType()).end(),x({keyList:l})}).catch(function(M){return s._groupModule.probeNetwork().then(function(y){var C=N(y,2),D=C[0],E=C[1];v.setError(M,D,E).end()}),T(M)})}},{key:"getGroupAttributes",value:function(t){var s=this,e="".concat(this._n,".").concat("getGroupAttributes"),n=t.groupID,o=this._getLocalGroupAttributes(n),a=o.avChatRoomKey,r=o.lastUpdateTime,i=o.localMainSequence,u=o.remoteMainSequence,l=new L("getGroupAttributes");if(l.setMessage("groupID:".concat(n," localMainSequence:").concat(i," remoteMainSequence:").concat(u," keyList:").concat(t.keyList)),Date.now()-r>=this.CACHE_EXPIRE_TIME||i<u)return this._getGroupAttributes({groupID:n,avChatRoomKey:a}).then(function(p){l.setMoreMessage("get attributes from remote. count:".concat(p.length)).setNetworkType(s._groupModule.getNetworkType()).end(),h.l("".concat(e," from remote. groupID:").concat(n));var g=s._getCachedAttributes(t);return x({groupAttributes:g})}).catch(function(p){return s._groupModule.probeNetwork().then(function(g){var _=N(g,2),v=_[0],M=_[1];l.setError(p,v,M).end()}),T(p)});l.setMoreMessage("get attributes from cache").setNetworkType(this._groupModule.getNetworkType()).end(),h.l("".concat(e," from cache. groupID:").concat(n));var d=this._getCachedAttributes(t);return Y({groupAttributes:d})}},{key:"_getGroupAttributes",value:function(t){var s=this,e=0;return S(t.avChatRoomKey)||(e=1),this._groupModule.request({protocolName:Va,requestData:m(m({},t),{},{groupType:e})}).then(function(n){h.l("".concat(s._n,"._getGroupAttributes ok. groupID:").concat(t.groupID));var o=n.data,a=o.mainSequence,r=o.groupAttributeList,i=B(r);return S(a)||s._refreshCachedGroupAttributes({groupID:t.groupID,remoteMainSequence:a,groupAttributeList:i,operationType:Er}),r}).catch(function(n){return T(n)})}},{key:"_refreshCachedGroupAttributes",value:function(t){var s=t.groupID,e=t.remoteMainSequence,n=t.groupAttributeList,o=t.operationType;if(this._hasLocalGroupAttributes(s)){var a=this._getLocalGroupAttributes(s),r=a.localMainSequence;if(o===Er||e-r==1)a.remoteMainSequence=e,a.localMainSequence=e,a.lastUpdateTime=Date.now(),this._updateCachedAttributes({groupAttributes:a,groupAttributeList:n,operationType:o});else{if(r===e)return;a.remoteMainSequence=e}this._groupAttributesMap.set(s,a);var i="operationType:".concat(o," localMainSequence:").concat(r," remoteMainSequence:").concat(e);h.l("".concat(this._n,"._refreshCachedGroupAttributes. ").concat(i))}}},{key:"_getCachedAttributes",value:function(t){var s=t.groupID,e=t.keyList,n=e===void 0?[]:e,o={};if(this._hasLocalGroupAttributes(s)){var a=this._getLocalGroupAttributes(s).attributes;if(n.length>0)n.forEach(function(l){a.has(l)&&(o[l]=a.get(l).value)});else{var r,i=Ee(a.keys());try{for(i.s();!(r=i.n()).done;){var u=r.value;o[u]=a.get(u).value}}catch(l){i.e(l)}finally{i.f()}}}return o}},{key:"_updateCachedAttributes",value:function(t){var s=t.groupAttributes,e=t.groupAttributeList,n=t.operationType;n!==kr?n!==Sr?(n===Dr&&s.attributes.clear(),e.forEach(function(o){var a=o.key,r=o.value,i=o.sequence;s.attributes.set(a,{value:r,sequence:i})})):e.forEach(function(o){s.attributes.delete(o.key)}):s.attributes.clear()}},{key:"_hasLocalGroupAttributes",value:function(t){return this._groupAttributesMap.has(t)}},{key:"_getLocalGroupAttributes",value:function(t){return this._hasLocalGroupAttributes(t)||this.initGroupAttributesCache({groupID:t}),this._groupAttributesMap.get(t)}},{key:"_transformGroupAttributes",value:function(t){var s=[];return Object.keys(t).forEach(function(e){s.push({key:e,value:t[e]})}),s}},{key:"_emitGroupAttributesUpdated",value:function(t){var s=this._getCachedAttributes({groupID:t}),e=this._computeAttrChangedInfo(s),n=e.updatedKeyList,o=e.deletedKeyList;h.l("".concat(this._n,"._emitGroupAttributesUpdated update:").concat(n.length,", delete:").concat(o.length)),n.length===0&&o.length===0||this._groupModule.emitOuterEvent(W.GROUP_ATTRIBUTES_UPDATED,{groupID:t,groupAttributes:s,updatedKeyList:n,deletedKeyList:o})}},{key:"_computeAttrChangedInfo",value:function(t){var s=this,e=[],n=[];return Object.keys(t).forEach(function(o){t[o]!==s._groupAttributesCopy[o]&&e.push(o)}),Object.keys(this._groupAttributesCopy).forEach(function(o){S(t[o])&&n.push(o)}),this._groupAttributesCopy={},{updatedKeyList:e,deletedKeyList:n}}},{key:"deleteLocalGroupAttributes",value:function(t){this._hasLocalGroupAttributes(t)&&this._groupAttributesMap.delete(t)}},{key:"reset",value:function(){this._groupAttributesMap.clear(),this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4}}]),c}(),du="Set",pu="Increase",gu="Decrease",hu=function(){function c(t){F(this,c),this._groupModule=t,this._n="GroupCountersHandler",this._groupCountersMap=new Map,this.EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(We,this._onCloudConfigUpdated,this)}return q(c,[{key:"_onCloudConfigUpdated",value:function(){var t=this._groupModule.getCloudConfig("grp_counter_expire_time");S(t)||(this.EXPIRE_TIME=Number(t))}},{key:"isGroupCountersNotice",value:function(t){var s=t.to,e=t.elements.groupCounterInfo,n=!1;return R(e)||(this._onGroupCountersUpdated({groupID:s,groupCounterInfo:e}),n=!0),n}},{key:"_onGroupCountersUpdated",value:function(t){var s=this,e=t.groupID;t.groupCounterInfo.forEach(function(n){var o=n.type,a=n.groupCounterSeq,r=n.counterList,i=r===void 0?[]:r;o!==0&&o!==2||(s._updateLocalGroupCounters({groupID:e,groupCounterSeq:a,counterList:i}),i.forEach(function(u){s._groupModule.emitOuterEvent(W.GROUP_COUNTER_UPDATED,{groupID:e,key:u.key,value:u.value})})),o===1&&s._deleteLocalGroupCounters({groupID:e,groupCounterSeq:a,counterList:i})}),h.l("".concat(this._n,"._onGroupCountersUpdated groupID:").concat(e))}},{key:"initGroupCountersCache",value:function(t){var s=t.groupID,e=t.avChatRoomKey;this._groupCountersMap.set(s,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:e}),h.l("".concat(this._n,".initGroupCountersCache groupID:").concat(s," avChatRoomKey:").concat(e))}},{key:"setGroupCounters",value:function(t){var s=this;if(!this._groupModule.canIUse(ye.GRP_COUNTER))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".setGroupCounters"),n=t.groupID,o=t.counters,a=this._convertObjectToList(o),r=this._getLocalGroupCounters(n).avChatRoomKey,i="groupID:".concat(n," count:").concat(a.length),u=new L("setGroupCounters");return u.setMessage("".concat(i)),h.l("".concat(e,". ").concat(i)),this._updateGroupCounters({groupID:n,counterList:a,avChatRoomKey:r,mode:du}).then(function(l){return u.end(),h.l("".concat(e," ok.")),x({counters:l})}).catch(function(l){return s._groupModule.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];u.setError(l,g,_).end()}),h.e("".concat(e," failed. error:"),l),T(l)})}},{key:"increaseGroupCounter",value:function(t){var s=this;if(!this._groupModule.canIUse(ye.GRP_COUNTER))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".increaseGroupCounters"),n=t.groupID,o=t.key,a=t.value,r=this._getLocalGroupCounters(n).avChatRoomKey,i="groupID:".concat(n," key:").concat(o," value:").concat(a),u=new L("increaseGroupCounter");u.setMessage("".concat(i)),h.l("".concat(e,". ").concat(i));var l=[{key:o,value:a}];return this._updateGroupCounters({groupID:n,counterList:l,avChatRoomKey:r,mode:pu}).then(function(d){return u.end(),h.l("".concat(e," ok.")),x({counters:d})}).catch(function(d){return s._groupModule.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];u.setError(d,_,v).end()}),h.e("".concat(e," failed. error:"),d),T(d)})}},{key:"decreaseGroupCounter",value:function(t){var s=this;if(!this._groupModule.canIUse(ye.GRP_COUNTER))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".decreaseGroupCounter"),n=t.groupID,o=t.key,a=t.value,r=this._getLocalGroupCounters(n).avChatRoomKey,i="groupID:".concat(n," key:").concat(o," value:").concat(a),u=new L("decreaseGroupCounter");u.setMessage("".concat(i)),h.l("".concat(e,". ").concat(i));var l=[{key:o,value:a}];return this._updateGroupCounters({groupID:n,counterList:l,avChatRoomKey:r,mode:gu}).then(function(d){return u.end(),h.l("".concat(e," ok.")),x({counters:d})}).catch(function(d){return s._groupModule.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];u.setError(d,_,v).end()}),h.e("".concat(e," failed. error:"),d),T(d)})}},{key:"getGroupCounters",value:function(t){var s=this;if(!this._groupModule.canIUse(ye.GRP_COUNTER))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".getGroupCounters"),n=t.groupID,o=t.keyList,a=o===void 0?[]:o,r=this._getLocalGroupCounters(n),i=r.avChatRoomKey,u=r.lastUpdateTime,l=new L("getGroupCounters");if(l.setMessage("groupID:".concat(n)),Date.now()-u>=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:n,avChatRoomKey:i}).then(function(p){l.setMoreMessage("from remote. count:".concat(p.length)).end(),h.l("".concat(e," from remote. groupID:").concat(n));var g=s._getLocalCounters(n,a);return x({counters:g})}).catch(function(p){return s._groupModule.probeNetwork().then(function(g){var _=N(g,2),v=_[0],M=_[1];l.setError(p,v,M).end()}),T(p)});l.setMoreMessage("from cache").end(),h.l("".concat(e," from cache. groupID:").concat(n));var d=this._getLocalCounters(n,a);return Y({counters:d})}},{key:"_getRemoteGroupCounters",value:function(t){var s=this;return this._groupModule.request({protocolName:Ka,requestData:m({},t)}).then(function(e){var n=e.data,o=n.counterList,a=o===void 0?[]:o,r=n.groupCounterSeq;return s._updateLocalGroupCounters({groupID:t.groupID,counterList:a,groupCounterSeq:r}),h.l("".concat(s._n,"._getRemoteGroupCounters ok. groupID:").concat(t.groupID)),a}).catch(function(e){return T(e)})}},{key:"_convertObjectToList",value:function(t){var s=[];return Object.keys(t).forEach(function(e){s.push({key:e,value:t[e]})}),s}},{key:"_updateGroupCounters",value:function(t){var s="".concat(this._n,"._updateGroupCounters"),e=t.groupID,n=t.avChatRoomKey,o=t.mode;return h.l("".concat(s,". groupID:").concat(e," avChatRoomKey:").concat(n," mode:").concat(o)),this._groupModule.request({protocolName:Ha,requestData:m({},t)}).then(function(a){h.l("".concat(s," ok."));var r=a.data.counterList,i={};return(r===void 0?[]:r).forEach(function(u){var l=u.key,d=u.value;i[l]=d}),i}).catch(function(a){return T(a)})}},{key:"_hasLocalGroupCounters",value:function(t){return this._groupCountersMap.has(t)}},{key:"_getLocalGroupCounters",value:function(t){return this._hasLocalGroupCounters(t)||this.initGroupCountersCache({groupID:t}),this._groupCountersMap.get(t)}},{key:"_updateLocalGroupCounters",value:function(t){var s=t.groupID,e=t.counterList,n=e===void 0?[]:e,o=t.groupCounterSeq;if(this._hasLocalGroupCounters(s)){var a=this._getLocalGroupCounters(s),r=a.counters,i=a.avChatRoomKey,u=a.groupCounterSeq;if(o>0&&o<u)return;n.forEach(function(l){var d=l.key,p=l.value;r.set(d,p)}),this._groupCountersMap.set(s,{lastUpdateTime:Date.now(),groupCounterSeq:o,counters:r,avChatRoomKey:i})}}},{key:"_deleteLocalGroupCounters",value:function(t){var s=t.groupID,e=t.counterList,n=e===void 0?[]:e,o=t.groupCounterSeq;if(this._hasLocalGroupCounters(s)){var a=this._getLocalGroupCounters(s),r=a.counters,i=a.avChatRoomKey;n.forEach(function(u){r.delete(u.key)}),this._groupCountersMap.set(s,{lastUpdateTime:Date.now(),groupCounterSeq:o,counters:r,avChatRoomKey:i})}}},{key:"_getLocalCounters",value:function(t,s){var e={};if(!this._hasLocalGroupCounters(t))return e;var n=this._getLocalGroupCounters(t).counters;if(s.length>0)s.forEach(function(i){n.has(i)&&(e[i]=n.get(i))});else{var o,a=Ee(n.keys());try{for(a.s();!(o=a.n()).done;){var r=o.value;e[r]=n.get(r)}}catch(i){a.e(i)}finally{a.f()}}return e}},{key:"reset",value:function(){this._groupCountersMap.clear(),this.EXPIRE_TIME=3e4}}]),c}(),_u=function(){function c(t){F(this,c);var s=t.manager,e=t.groupID,n=t.onInit,o=t.onSuccess,a=t.onFail;this._n="Polling",this._manager=s,this._groupModule=s._groupModule,this._onInit=n,this._onSuccess=o,this._onFail=a,this._groupID=e,this._timeoutID=-1,this._isRunning=!1,this._protocolName=Ga}return q(c,[{key:"start",value:function(){var t=this._groupModule.isLoggedIn();t||(this._protocolName=Ua),h.l("".concat(this._n,".start pollingInterval:").concat(this._manager.getPollingInterval()," isLoggedIn:").concat(t)),this._isRunning=!0,this._request()}},{key:"isRunning",value:function(){return this._isRunning}},{key:"_request",value:function(){var t=this,s=this._onInit(this._groupID);this._groupModule.request({protocolName:this._protocolName,requestData:s}).then(function(e){t._onSuccess(t._groupID,e),t.isRunning()&&(clearTimeout(t._timeoutID),t._timeoutID=setTimeout(t._request.bind(t),t._manager.getPollingInterval()))}).catch(function(e){t._onFail(t._groupID,e),t.isRunning()&&(clearTimeout(t._timeoutID),t._timeoutID=setTimeout(t._request.bind(t),t._manager.MAX_POLLING_INTERVAL))})}},{key:"stop",value:function(){h.l("".concat(this._n,".stop")),this._timeoutID>0&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}},{key:"getPollingTimerID",value:function(){return this._timeoutID}}]),c}(),Lr={3:!0,4:!0,5:!0,6:!0,17:!0},fu=function(){function c(t){F(this,c),this._groupModule=t,this._n="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this.sequencesLinkedList=new Lo(200),this.messageIDLinkedList=new Lo(100),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map,this.DEFAULT_POLLING_SIMPLIFIED_MSG=0}return q(c,[{key:"hasJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0}},{key:"checkJoinedAVChatRoomByID",value:function(t){return this._joinedGroupMap.has(t)}},{key:"getJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0?B(this._joinedGroupMap.keys()):null}},{key:"_updateRequestData",value:function(t){var s=this._pollingRequestInfoMap.get(t);return t===B(this._pollingInstanceMap.keys())[0]?m(m({},s),{},{startBroadcastSeq:this._startBroadcastSeq,simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG}):m(m({},s),{},{simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG})}},{key:"_handleSuccess",value:function(t,s){var e=s.data,n=e.key,o=e.nextSeq,a=e.rspMsgList,r=e.errorCode,i=e.nextBroadcastSeq,u=e.broadcastMessageList;if(r!==0){var l=this._pollingRequestInfoMap.get(t),d=new L("longPollingAVError"),p=l?"".concat(l.key,"-").concat(l.startSeq):"requestInfo is undefined";d.setMessage("".concat(t,"-").concat(p,"-").concat(s.errorInfo)).setCode(s.errorCode).setNetworkType(this._groupModule.getNetworkType()).end(!0)}else{if(!this.checkJoinedAVChatRoomByID(t))return;z(n)&&ee(o)&&this._pollingRequestInfoMap.set(t,{key:n,startSeq:o}),ee(i)&&i>this._startBroadcastSeq&&(this._startBroadcastSeq=i),b(a)&&a.length>0?(a.forEach(function(g){g.to=g.groupID}),this.onMessage(a)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(u)}}},{key:"_handleFailure",value:function(t,s){}},{key:"onMessage",value:function(t){if(b(t)&&t.length!==0){this._pollingNoMessageCount!==0&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL);var s=null,e=[],n=this._getModule(P),o=this._getModule(Re),a=t.length;a>1&&t.sort(function(D,E){return D.sequence-E.sequence});for(var r=this._getModule(X),i=0;i<a;i++){var u=this.restoreMessageFromSimplified(t[i]);if(Lr[u.event]){if(u.event===6&&(this._groupModule.isGroupAttributesUpdatedNotice(u)||this._groupModule.isGroupCountersNotice(u)))continue;this.receivedMessageCount+=1,s=this.packMessage(u,u.event);var l=u.isModified===1,d=u.isHistoryMessage===1;if((r.isUnlimitedAVChatRoom()||!this.sequencesLinkedList.has(s.sequence))&&!this.messageIDLinkedList.has(s.ID)){var p=s.conversationID;if(this.receivedMessageCount%50==0?this._getModule(zt).detectFirstRound(p,this.sequencesLinkedList.data()):this.receivedMessageCount%80==0&&this._getModule(zt).detectSecondRound(p,this.sequencesLinkedList.data()),this.sequencesLinkedList.tail()!==null){var g=this.sequencesLinkedList.tail().value,_=s.sequence-g;_>1&&_<=20?this._getModule(zt).onMessageMaybeLost(p,g+1,_-1):_<-1&&_>=-20&&this._getModule(zt).onMessageMaybeLost(p,s.sequence+1,Math.abs(_)-1)}this.sequencesLinkedList.set(s.sequence),this.messageIDLinkedList.set(s.ID);var v=!1;if(this._isMessageSentByCurrentInstance(s)?l&&(v=!0,s.isModified=l,n.updateMessageIsModifiedProperty(s)):v=!0,v){if(s.conversationType===f.CONV_SYSTEM&&s.payload.operationType===5&&this._onGroupDismissed(s.payload.groupProfile.groupID),!d&&s.conversationType!==f.CONV_SYSTEM){var M=s.conversationID.replace(f.CONV_GROUP,"");this._pollingInstanceMap.has(M)?this._groupModule.isLoggedIn()&&o.addMessageSequence({key:en,message:s}):(s.type!==f.MSG_GRP_TIP&&s.clientTime>0&&o.addMessageDelay(s.clientTime),o.addMessageSequence({key:$t,message:s}))}e.push(s)}}}else h.w("".concat(this._n,".onMessage unknown event:").concat(u.event))}if(e.length!==0){this._groupModule.filterModifiedMessage(e);var y=this.packConversationOption(e);y.length>0&&this._getModule(P).onNewMessage({conversationOptionsList:y,isInstantMessage:!0}),h.d("".concat(this._n,".onMessage count:").concat(e.length)),this._checkMessageStacked(e);var C=this._groupModule.filterUnmodifiedMessage(e);C.length>0&&this._groupModule.emitOuterEvent(W.MESSAGE_RECEIVED,C),e.length=0}}}},{key:"isBroadcastOrNormal",value:function(t){return t===3||t===17}},{key:"isGroupTip",value:function(t){return t===4||t===6}},{key:"isGroupSystemNotice",value:function(t){return t===5}},{key:"restoreGroupTipElements",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.groupJoinType||(t.groupJoinType=1);var s=t.operatorInfo,e=s===void 0?{}:s,n=t.operatorID,o=t.userIDList,a=o===void 0?[]:o,r=e.userID,i=r===void 0?n:r,u=e.avatar,l=u===void 0?"":u,d=e.nick,p=d===void 0?"":d;t.operatorInfo={userID:i,avatar:l,nick:p};var g=a.map(function(_){return{userID:_}});return t.memberInfoList=t.memberInfoList||g,t}},{key:"restoreMessageFromSimplified",value:function(t){var s=t.event;if(this.isBroadcastOrNormal(s)&&(t.cloudCustomData=t.cloudCustomData||"",t.elements=t.elements.map(function(p){if(p.type===f.MSG_CUSTOM){var g=p.content,_=g===void 0?{}:g;p.content=m({data:"",description:"",extension:""},_)}return p})),(this.isGroupTip(s)||this.isGroupSystemNotice(s))&&(t.from=t.from||"@TIM#SYSTEM"),this.isGroupTip(s)){t.elements=this.restoreGroupTipElements(t.elements);var e=t.elements,n=e===void 0?{}:e,o=n.operationType,a=n.operatorInfo;if(o===1){var r=[{userID:(a===void 0?{}:a).userID}];n.memberInfoList=n.memberInfoList||r}}if(this.isGroupSystemNotice(s)){var i=t.elements,u=i.memberInfoList,l=i.operatorInfo;u||(u=l===void 0?{}:l),t.elements.memberInfoList=m({userID:t.elements.operatorID,avatar:"",nick:""},u),t.elements=m({authentication:"",remarkInfo:"",messageKey:1e3*t.time},t.elements);var d=Object.keys(t.elements).filter(function(p){return p!=="operatorInfo"}).reduce(function(p,g){return m(m({},p),{},Be({},g,t.elements[g]))},{});t.elements=d}return t}},{key:"_onGroupDismissed",value:function(t){h.l("".concat(this._n,"._onGroupDismissed groupID:").concat(t)),this._groupModule.deleteLocalGroupAndConversation(t),this.reset(t)}},{key:"_checkMessageStacked",value:function(t){var s="MessageStacked",e=t.length;e>=100&&(this._groupModule.outputWarning(s,e),this._reportMessageStackedCount<5&&(new L(s).setNetworkType(this._groupModule.getNetworkType()).setMessage("count:".concat(e," groupID:").concat(B(this._joinedGroupMap.keys()))).setLevel("warning").end(),this._reportMessageStackedCount+=1))}},{key:"_isMessageSentByCurrentInstance",value:function(t){return!!this._getModule(P).isMessageSentByCurrentInstance(t)}},{key:"packMessage",value:function(t,s){t.currentUser=this._groupModule.getMyUserID(),t.conversationType=s===5?f.CONV_SYSTEM:f.CONV_GROUP,t.isSystemMessage=!!t.isSystemMessage;var e=new ve(t),n=this.packElements(t,s);return e.setElement(n,this._groupModule.getFileDownloadProxy()),e}},{key:"packElements",value:function(t,s){return s===4||s===6?(this._updateMemberCountByGroupTips(t),{type:f.MSG_GRP_TIP,content:m(m({},t.elements),{},{groupProfile:t.groupProfile})}):s===5?{type:f.MSG_GRP_SYS_NOTICE,content:m(m({},t.elements),{},{groupProfile:m(m({},t.groupProfile),{},{groupID:t.groupID})})}:this._getModule(jt).parseElements(t.elements,t.from)}},{key:"packConversationOption",value:function(t){for(var s=new Map,e=0;e<t.length;e++){var n=t[e],o=n.conversationID;if(s.has(o)){var a=s.get(o);a.lastMessage=n,n.flow==="in"&&a.unreadCount++}else s.set(o,{conversationID:n.conversationID,unreadCount:n.flow==="out"?0:1,type:n.conversationType,subType:n.conversationSubType,lastMessage:n})}return B(s.values())}},{key:"_updateMemberCountByGroupTips",value:function(t){var s=t.groupProfile.groupID,e=t.elements.onlineMemberInfo,n=e===void 0?void 0:e;if(!R(n)){var o=n.onlineMemberNum,a=o===void 0?0:o,r=n.expireTime,i=r===void 0?this.DEFAULT_EXPIRE_TIME:r,u=this._onlineMemberCountMap.get(s)||{},l=Date.now();R(u)?Object.assign(u,{lastReqTime:0,lastSyncTime:0,latestUpdateTime:l,memberCount:a,expireTime:i}):(u.latestUpdateTime=l,u.memberCount=a),h.d("".concat(this._n,"._updateMemberCountByGroupTips info:"),u),this._onlineMemberCountMap.set(s,u)}}},{key:"_onBroadcastMessage",value:function(t){if(!R(t)){for(var s=[],e=t.length,n=null,o=0;o<e;o++){var a=this.restoreMessageFromSimplified(t[o]);Lr[a.event]?((n=this.packMessage(a,a.event)).isBroadcastMessage=!0,this._broadcastMessageIDMap.has(n.ID)||(s.push(n),this._broadcastMessageIDMap.set(n.ID,1))):h.w("".concat(this._n,"._onBroadcastMessage unknown event:").concat(a.event))}s.length>0&&this._groupModule.emitOuterEvent(W.MESSAGE_RECEIVED,s)}}},{key:"start",value:function(t){if(this._pollingInstanceMap.has(t)){var s=this._pollingInstanceMap.get(t);s.isRunning()||s.start()}else{var e=new _u({manager:this,groupID:t,onInit:this._updateRequestData.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});e.start(),this._pollingInstanceMap.set(t,e),h.l("".concat(this._n,".start groupID:").concat(t))}}},{key:"handleJoinResult",value:function(t){var s=this;return this._preCheck().then(function(){var e=t.longPollingKey,n=t.group,o=n.groupID;return s._joinedGroupMap.set(o,n),s._groupModule.updateGroupMap([n]),s._groupModule.deleteUnjoinedAVChatRoom(o),s._groupModule.emitGroupListUpdate(!0,!1),S(e)?Y({status:Et,group:n}):Promise.resolve()})}},{key:"startRunLoop",value:function(t){var s=this;return this.handleJoinResult(t).then(function(){var e=t.longPollingKey,n=t.group,o=t.startSeq,a=o===void 0?0:o,r=n.groupID;return s._pollingRequestInfoMap.set(r,{key:e,startSeq:a}),s.start(r),s._groupModule.isLoggedIn()?Y({status:Et,group:n}):Y({status:Et})})}},{key:"_preCheck",value:function(){if(this._getModule(X).isUnlimitedAVChatRoom()||!this.hasJoinedAVChatRoom())return Promise.resolve();var t=N(this._joinedGroupMap.entries().next().value,2),s=t[0],e=t[1];if(this._groupModule.isLoggedIn()){if(!(e.selfInfo.role===f.GRP_MBR_ROLE_OWNER||e.ownerID===this._groupModule.getMyUserID()))return this._groupModule.quitGroup(s);this._groupModule.deleteLocalGroupAndConversation(s)}else this._groupModule.deleteLocalGroupAndConversation(s);return this.reset(s),Promise.resolve()}},{key:"joinWithoutAuth",value:function(t){var s=this,e=t.groupID,n="".concat(this._n,".").concat("joinWithoutAuth"),o=new L("joinWithoutAuth");return this._groupModule.request({protocolName:ma,requestData:t}).then(function(a){var r=a.data.longPollingKey;if(s._groupModule.probeNetwork().then(function(u){var l=N(u,2);l[0];var d=l[1];o.setNetworkType(d).setMessage("groupID:".concat(e," longPollingKey:").concat(r)).end(!0)}),S(r))return T({code:k.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN});h.l("".concat(n," ok. groupID:").concat(e)),s._getModule(P).setCompleted("".concat(f.CONV_GROUP).concat(e));var i=new vt({groupID:e});return s.startRunLoop({group:i,longPollingKey:r}),x({status:Et})}).catch(function(a){return h.e("".concat(n," failed. groupID:").concat(e," error:"),a),s._groupModule.probeNetwork().then(function(r){var i=N(r,2),u=i[0],l=i[1];o.setError(a,u,l).setMessage("groupID:".concat(e)).end(!0)}),T(a)}).finally(function(){s._groupModule.getModule(to).reportAtOnce()})}},{key:"getGroupOnlineMemberCount",value:function(t){var s=this._onlineMemberCountMap.get(t)||{},e=Date.now();return R(s)||e-s.lastSyncTime>1e3*s.expireTime&&e-s.latestUpdateTime>1e4&&e-s.lastReqTime>3e3?(s.lastReqTime=e,this._onlineMemberCountMap.set(t,s),this._getGroupOnlineMemberCount(t).then(function(n){return x({memberCount:n.memberCount})}).catch(function(n){return T(n)})):Y({memberCount:s.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(t){var s=this,e="".concat(this._n,".").concat("_getGroupOnlineMemberCount");return this._groupModule.request({protocolName:Pa,requestData:{groupID:t}}).then(function(n){var o=s._onlineMemberCountMap.get(t)||{},a=n.data,r=a.onlineMemberNum,i=r===void 0?0:r,u=a.expireTime,l=u===void 0?s.DEFAULT_EXPIRE_TIME:u;h.l("".concat(e," ok. groupID:").concat(t," memberCount:").concat(i," expireTime:").concat(l));var d=Date.now();return R(o)&&(o.lastReqTime=d),s._onlineMemberCountMap.set(t,Object.assign(o,{lastSyncTime:d,latestUpdateTime:d,memberCount:i,expireTime:l})),{memberCount:i}}).catch(function(n){return h.w("".concat(e," failed. error:"),n),new L("_getGroupOnlineMemberCount").setCode(n.code).setMessage("groupID:".concat(t," error:").concat(JSON.stringify(n))).setNetworkType(s._groupModule.getNetworkType()).end(),Promise.reject(n)})}},{key:"_getModule",value:function(t){return this._groupModule.getModule(t)}},{key:"setPollingInterval",value:function(t){S(t)||(ee(t)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=t:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(t,10))}},{key:"setPollingIntervalPlus",value:function(t){S(t)||(ee(t)?this.DEFAULT_POLLING_INTERVAL_PLUS=t:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(t,10))}},{key:"setPollingNoMessageCount",value:function(t){S(t)||(ee(t)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=t:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(t,10))}},{key:"setPollingSimplifiedMessage",value:function(t){S(t)||t!=="0"&&t!=="1"||(this.DEFAULT_POLLING_SIMPLIFIED_MSG=parseInt(t,10))}},{key:"getPollingInterval",value:function(){return this._pollingInterval}},{key:"onAVChatRoomMemberBanned",value:function(t){var s=t.payload.groupProfile.groupID;h.l("".concat(this._n,".onAVChatRoomMemberBanned groupID:").concat(s)),this._groupModule.deleteLocalGroupAndConversation(s),this.reset(s)}},{key:"restartPolling",value:function(){h.l("".concat(this._n,".restartPolling count:").concat(this._pollingInstanceMap.size));var t,s=Ee(this._pollingInstanceMap.values());try{for(s.s();!(t=s.n()).done;){var e=t.value;e.stop(),e.start()}}catch(n){s.e(n)}finally{s.f()}}},{key:"getPollingTimerID",value:function(t){if(!this._pollingInstanceMap.has(t))return-1;var s=this._pollingInstanceMap.get(t).getPollingTimerID();return h.l("".concat(this._n,".getPollingTimerID groupID:").concat(t," timerID:").concat(s)),s}},{key:"reset",value:function(t){if(t){h.l("".concat(this._n,".reset groupID:").concat(t));var s=this._pollingInstanceMap.get(t);s&&s.stop(),this._pollingInstanceMap.delete(t),this._joinedGroupMap.delete(t),this._pollingRequestInfoMap.delete(t),this._onlineMemberCountMap.delete(t)}else{h.l("".concat(this._n,".reset all"));var e,n=Ee(this._pollingInstanceMap.values());try{for(n.s();!(e=n.n()).done;)e.value.stop()}catch(o){n.e(o)}finally{n.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this.sequencesLinkedList.reset(),this.messageIDLinkedList.reset(),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0}}]),c}(),mu=1,vu=15,Mu=function(){function c(t){F(this,c),this._groupModule=t,this._n="GroupSystemNoticeHandler",this.pendencyMap=new Map}return q(c,[{key:"onNewGroupSystemNotice",value:function(t){var s=t.dataList,e=t.isSyncingEnded,n=t.isInstantMessage;h.d("".concat(this._n,".onReceiveSystemNotice count:").concat(s.length));var o=this.newSystemNoticeStoredAndSummary({notifiesList:s,isInstantMessage:n}),a=o.eventDataList,r=o.result;a.length>0&&(this._groupModule.getModule(P).onNewMessage({conversationOptionsList:a,isInstantMessage:n}),this._onReceivedGroupSystemNotice({result:r,isInstantMessage:n})),n?r.length>0&&this._groupModule.emitOuterEvent(W.MESSAGE_RECEIVED,r):e===!0&&this._clearGroupSystemNotice()}},{key:"newSystemNoticeStoredAndSummary",value:function(t){var s=t.notifiesList,e=t.isInstantMessage,n=null,o=s.length,a=0,r=[],i={conversationID:f.CONV_SYSTEM,unreadCount:0,type:f.CONV_SYSTEM,subType:null,lastMessage:null};for(a=0;a<o;a++){var u=s[a],l=u.groupProfile,d=l.communityType,p=d===void 0?0:d,g=l.topicID,_=g===void 0?void 0:g,v=u.elements,M=v.topicIDList,y=M===void 0?void 0:M,C=v.operationType;if(!(p!==2||R(_)&&R(y))){if([17,18,20].includes(C)){this._handleTopicSystemNotice(u);continue}R(_)||(u.to=_)}u.elements.operationType!==vu&&(u.currentUser=this._groupModule.getMyUserID(),u.conversationType=f.CONV_SYSTEM,u.conversationID=f.CONV_SYSTEM,(n=new ve(u)).setElement({type:f.MSG_GRP_SYS_NOTICE,content:m(m({},u.elements),{},{groupProfile:m({},u.groupProfile)})}),n.isSystemMessage=!0,(n.sequence===1&&n.random===1||n.sequence===2&&n.random===2)&&(n.sequence=He(),n.random=He(),n.generateMessageID(),h.l("".concat(this._n,".newSystemNoticeStoredAndSummary sequence and random maybe duplicated, regenerate. ID:").concat(n.ID))),this._groupModule.getModule(P).pushIntoNoticeResult(r,n)&&(e?i.unreadCount++:n.setIsRead(!0),i.subType=n.conversationSubType))}return i.lastMessage=r[r.length-1],{eventDataList:r.length>0?[i]:[],result:r}}},{key:"_clearGroupSystemNotice",value:function(){var t=this;this._getPendencyList().then(function(s){s.forEach(function(o){t.pendencyMap.set("".concat(o.from,"_").concat(o.groupID,"_").concat(o.to),o)});var e=t._groupModule.getModule(P).getLocalMessageList(f.CONV_SYSTEM),n=[];e.forEach(function(o){var a=o.payload,r=a.operatorID,i=a.operationType,u=a.groupProfile;if(i===mu){var l="".concat(r,"_").concat(u.groupID,"_").concat(u.to),d=t.pendencyMap.get(l);d&&ee(d.handled)&&d.handled!==0&&n.push(o)}}),t.deleteGroupSystemNotice({messageList:n})})}},{key:"deleteGroupSystemNotice",value:function(t){var s=this,e="".concat(this._n,".deleteGroupSystemNotice");return b(t.messageList)&&t.messageList.length!==0?(h.l("".concat(e," ")+t.messageList.map(function(n){return n.ID})),this._groupModule.request({protocolName:Oa,requestData:{messageListToDelete:t.messageList.map(function(n){return{from:f.CONV_SYSTEM,messageSeq:n.clientSequence,messageRandom:n.random}})}}).then(function(){h.l("".concat(e," ok"));var n=s._groupModule.getModule(P);return t.messageList.forEach(function(o){n.deleteLocalMessage(o)}),x()}).catch(function(n){return h.e("".concat(e," error:"),n),T(n)})):Y()}},{key:"_getPendencyList",value:function(){var t=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=s.type,n=e===void 0?void 0:e,o=s.startTime,a=o===void 0?0:o,r=s.limit,i=r===void 0?20:r;return this._groupModule.request({protocolName:Na,requestData:{type:n,startTime:a,limit:i,handleAccount:this._groupModule.getMyUserID()}}).then(function(u){var l=u.data.pendencyList;return u.data.nextStartTime!==0?t._getPendencyList({startTime:u.data.nextStartTime}).then(function(d){return[].concat(B(l),B(d))}):l})}},{key:"getGroupApplicationList",value:function(){var t=this;return this._getPendencyList().then(function(s){return t._getPendencyList({type:f.GRP_COMMUNITY}).then(function(e){return s.push.apply(s,B(e)),t._handlePendencyResult(s)}).catch(function(e){return t._handlePendencyResult(s)})})}},{key:"_handlePendencyResult",value:function(t){var s=this,e=[];return t.forEach(function(n){s.pendencyMap.set("".concat(n.from,"_").concat(n.groupID,"_").concat(n.to),n),n.handled===0&&e.push({applicant:n.from,applicantNick:n.fromUserNickName,groupName:n.groupName,groupID:n.groupID,authentication:n.authentication,messageKey:n.time,applicationType:n.applicationType,userID:n.userID})}),Y({applicationList:e})}},{key:"_onReceivedGroupSystemNotice",value:function(t){var s=this,e=t.result;t.isInstantMessage&&e.forEach(function(n){switch(n.payload.operationType){case 1:break;case 2:s._onApplyGroupRequestAgreed(n);break;case 3:break;case 4:s._onMemberKicked(n);break;case 5:s._onGroupDismissed(n);break;case 6:break;case 7:s._onInviteGroup(n);break;case 8:s._onQuitGroup(n);break;case 9:s._onSetManager(n);break;case 10:s._onDeleteManager(n);break;case 11:case 12:case 15:break;case 20:s._onMessageRemindTypeSynced(n);break;case 21:s._groupModule.onAVChatRoomMemberBanned(n)}})}},{key:"_onApplyGroupRequestAgreed",value:function(t){var s=this,e=t.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(e)||this._groupModule.getGroupProfile({groupID:e}).then(function(n){var o=n.data.group;if(o){s._groupModule.updateGroupMap([o]);var a=!o.isSupportTopic;s._groupModule.emitGroupListUpdate(!0,a)}})}},{key:"_onMemberKicked",value:function(t){var s=t.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(s)&&this._groupModule.deleteLocalGroupAndConversation(s)}},{key:"_onGroupDismissed",value:function(t){var s=t.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(s)&&this._groupModule.deleteLocalGroupAndConversation(s);var e=this._groupModule._AVChatRoomHandler;e&&e.checkJoinedAVChatRoomByID(s)&&e.reset(s)}},{key:"_onInviteGroup",value:function(t){var s=this,e=t.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(e)||this._groupModule.getGroupProfile({groupID:e}).then(function(n){var o=n.data.group;o&&(s._groupModule.updateGroupMap([o]),s._groupModule.emitGroupListUpdate())})}},{key:"_onQuitGroup",value:function(t){var s=t.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(s)&&this._groupModule.deleteLocalGroupAndConversation(s)}},{key:"_onSetManager",value:function(t){var s=t.payload.groupProfile,e=s.to,n=s.groupID,o=this._groupModule.getModule(me).getLocalGroupMemberInfo(n,e);o&&o.updateRole(f.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(t){var s=t.payload.groupProfile,e=s.to,n=s.groupID,o=this._groupModule.getModule(me).getLocalGroupMemberInfo(n,e);o&&o.updateRole(f.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(t){var s=t.payload.groupProfile.groupID,e=t.payload.messageRemindType;this._groupModule.getModule(P).onGroupMessageRemindTypeSynced({groupID:s,messageRemindType:e})}},{key:"_handleTopicSystemNotice",value:function(t){var s=t.groupProfile,e=s.groupID,n=s.topicID,o=t.elements,a=o.operationType,r=o.topicIDList,i=o.messageRemindType,u=this._groupModule.getModule(ae);a===17?u.onTopicCreated({groupID:e,topicID:n}):a===18?u.onTopicDeleted({groupID:e,topicIDList:r}):a===20&&u.onTopicMessageRemindTypeUpdated({groupID:e,topicID:n,messageRemindType:i})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),c}(),yu=["relayFlag"],Iu=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="GroupModule",n._commonGroupHandler=null,n._AVChatRoomHandler=null,n._groupSystemNoticeHandler=null,n._commonGroupHandler=new uu($(n)),n._groupAttributesHandler=new lu($(n)),n._groupCountersHandler=new hu($(n)),n._AVChatRoomHandler=new fu($(n)),n._groupTipsHandler=new iu($(n)),n._groupSystemNoticeHandler=new Mu($(n)),n.groupMap=new Map,n._unjoinedAVChatRoomList=new Map,n._receiptDetailCompleteMap=new Map,n.getInnerEmitterInstance().on(We,n._onCloudConfigUpdated,$(n)),n}return q(s,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("polling_interval"),n=this.getCloudConfig("polling_interval_plus"),o=this.getCloudConfig("polling_no_msg_count"),a=this.getCloudConfig("polling_simplified_msg");this._AVChatRoomHandler&&(h.l("".concat(this._n,"._onCloudConfigUpdated pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(n," pollingNoMessageCount:").concat(o)+" pollingSimplifiedMessage:".concat(a)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(n),this._AVChatRoomHandler.setPollingNoMessageCount(o),this._AVChatRoomHandler.setPollingSimplifiedMessage(a))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:"guardForAVChatRoom",value:function(e){var n=this;if(e.conversationType===f.CONV_GROUP){var o=Le(e.to)?Ie(e.to):e.to;return this.hasLocalGroup(o)?Y():this.getGroupProfile({groupID:o}).then(function(a){var r=a.data.group.type;if(h.l("".concat(n._n,".guardForAVChatRoom. groupID:").concat(o," type:").concat(r)),r===f.GRP_AVCHATROOM){var i=k.MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM;return T(new oe({code:i,message:n.getErrorMessage(i,e.from,o),data:{message:e}}))}return Y()})}return Y()}},{key:"checkJoinedAVChatRoomByID",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"onNewGroupMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onNewGroupMessage(e)}},{key:"updateNextMessageSeq",value:function(e){var n=this;if(b(e)){var o=this.getModule(ae);e.forEach(function(a){var r=a.conversationID.replace(f.CONV_GROUP,"");Le(r)&&o.updateLastMessage(r,a.lastMessage),n.groupMap.has(r)&&(n.groupMap.get(r).nextMessageSeq=a.lastMessage.sequence+1)})}}},{key:"onNewGroupTips",value:function(e){this._groupTipsHandler&&this._groupTipsHandler.onNewGroupTips(e)}},{key:"onGroupMessageRevoked",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onGroupMessageRevoked(e)}},{key:"onNewGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:"onGroupMessageReadNotice",value:function(e){var n=this;e.dataList.forEach(function(o){var a=o.elements.groupMessageReadNotice;if(!S(a)){var r=n.getModule(P);a.forEach(function(i){var u=i.groupID,l=i.topicID,d=l===void 0?void 0:l,p=i.lastMessageSeq;h.d("".concat(n._n,".onGroupMessageReadNotice groupID:").concat(u," lastMessageSeq:").concat(p));var g="".concat(f.CONV_GROUP).concat(u),_=!0;R(d)||(g="".concat(f.CONV_GROUP).concat(d),_=!1),r.updateIsReadAfterReadReport({conversationID:g,lastMessageSeq:p}),r.updateUnreadCount(g,_),r.clearGroupAtInfoList(g,_)})}})}},{key:"onReadReceiptList",value:function(e){var n=this;h.d("".concat(this._n,".onReadReceiptList options:"),JSON.stringify(e)),e.dataList.forEach(function(o){var a=o.groupProfile,r=o.elements,i=a.groupID,u=n.getModule(P),l=r.readReceiptList;u.updateReadReceiptInfo({groupID:i,readReceiptList:l})})}},{key:"onGroupMessageModified",value:function(e){h.d("".concat(this._n,".onGroupMessageModified options:"),JSON.stringify(e));var n=this.getModule(P);e.dataList.forEach(function(o){n.onMessageModified(m(m({},o),{},{conversationType:f.CONV_GROUP,to:o.topicID?o.topicID:o.groupID}))})}},{key:"deleteGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:"initGroupMap",value:function(e){this.groupMap.set(e.groupID,new vt(e))}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var n,o=this,a=this.getModule(P);e.forEach(function(d){n=d.groupID,o.groupMap.has(n)?o.groupMap.get(n).updateGroup(d):(o.groupMap.set(n,new vt(d)),a.deleteGroupRomaingMessageInfo(n))});var r,i=this.getMyUserID(),u=Ee(this.groupMap);try{for(u.s();!(r=u.n()).done;){var l=N(r.value,2)[1];l.selfInfo.userID=i,l.selfInfo.role==="Owner"&&(l.ownerID=i)}}catch(d){u.e(d)}finally{u.f()}this._setStorageGroupList()}},{key:"getStorageGroupList",value:function(){return this.getModule(Ke).getItem("groupMap")}},{key:"_setStorageGroupList",value:function(){var e=this.getLocalGroupList().filter(function(n){var o=n.type;return!xe(o)}).filter(function(n){return!n.isSupportTopic}).slice(0,20).map(function(n){return{groupID:n.groupID,name:n.name,avatar:n.avatar,type:n.type}});this.getModule(Ke).setItem("groupMap",e)}},{key:"getGroupMap",value:function(){return this.groupMap}},{key:"getLocalGroupList",value:function(){return B(this.groupMap.values())}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"sortLocalGroupList",value:function(){var e=B(this.groupMap).filter(function(n){var o=N(n,2);return o[0],!R(o[1].lastMessage)});e.sort(function(n,o){return o[1].lastMessage.lastTime-n[1].lastMessage.lastTime}),this.groupMap=new Map(B(e))}},{key:"updateGroupLastMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.handleUpdateGroupLastMessage(e)}},{key:"emitGroupListUpdate",value:function(){var e=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],o=this.getLocalGroupList();if(e&&this.emitOuterEvent(W.GROUP_LIST_UPDATED),n){var a=JSON.parse(JSON.stringify(o)),r=this.getModule(P);r.updateConversationGroupProfile(a)}}},{key:"patchGroupMessageRemindType",value:function(){var e=this.getLocalGroupList(),n=this.getModule(P),o=0;e.forEach(function(a){n.patchMessageRemindType({ID:a.groupID,isC2CConversation:!1,messageRemindType:a.selfInfo.messageRemindType})===!0&&(o+=1)}),h.l("".concat(this._n,".patchGroupMessageRemindType count:").concat(o))}},{key:"recomputeUnreadCount",value:function(){var e=this.getLocalGroupList(),n=this.getModule(P);e.forEach(function(o){var a=o.groupID,r=o.selfInfo,i=r.excludedUnreadSequenceList,u=r.readedSequence;if(b(i)){var l=0;i.forEach(function(d){d>=u&&d<=o.nextMessageSeq-1&&(l+=1)}),l>=1&&n.recomputeGroupUnreadCount({conversationID:"".concat(f.CONV_GROUP).concat(a),count:l})}})}},{key:"getMyNameCardByGroupID",value:function(e){var n=this.getLocalGroupProfile(e);return n?n.selfInfo.nameCard:""}},{key:"isPagingGetCompleted",value:function(){return!!this._commonGroupHandler&&this._commonGroupHandler.isPagingGetCompleted()}},{key:"getGroupList",value:function(e){return this._commonGroupHandler?this._commonGroupHandler.getGroupList(e):Y()}},{key:"getGroupProfile",value:function(e){var n=this,o="".concat(this._n,".").concat("getGroupProfile"),a=new L("getGroupProfile"),r=e.groupID,i=e.groupCustomFieldFilter;h.l("".concat(o," groupID:").concat(r));var u={groupIDList:[r],responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember","InviteJoinOption"],groupCustomFieldFilter:i,memberInfoFilter:["Role","JoinTime","MsgSeq","MsgFlag","NameCard"]}};return this.getGroupProfileAdvance(u).then(function(l){var d,p=l.data,g=p.successGroupList,_=p.failureGroupList;return h.l("".concat(o," ok")),_.length>0?T(_[0]):(xe(g[0].type)&&!n.hasLocalGroup(r)?d=new vt(g[0]):(n.updateGroupMap(g),d=n.getLocalGroupProfile(r)),d.isSupportTopic||n.getModule(P).updateConversationGroupProfile([d]),a.setNetworkType(n.getNetworkType()).setMessage("groupID:".concat(r," type:").concat(d.type," muteAllMembers:").concat(d.muteAllMembers," ownerID:").concat(d.ownerID)).end(),x({group:d}))}).catch(function(l){return n.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];a.setError(l,g,_).setMessage("groupID:".concat(e.groupID)).end()}),h.e("".concat(o," failed. error:"),l),T(l)})}},{key:"getGroupProfileAdvance",value:function(e){var n="".concat(this._n,".getGroupProfileAdvance"),o=e.groupIDList;b(o)&&o.length>50&&(this.outputWarning("GetGroupProfileLimit"),o.length=50);var a=[],r=[];o.forEach(function(d){Oe({groupID:d})?r.push(d):a.push(d)});var i=[];if(a.length>0){var u=this._getGroupProfileAdvance(m(m({},e),{},{groupIDList:a}));i.push(u)}if(r.length>0){var l=this._getGroupProfileAdvance(m(m({},e),{},{groupIDList:r,relayFlag:a.length>0}));i.push(l)}return Promise.all(i).then(function(d){var p=[],g=[];return d.forEach(function(_){p.push.apply(p,B(_.successGroupList)),g.push.apply(g,B(_.failureGroupList))}),x({successGroupList:p,failureGroupList:g})}).catch(function(d){return h.e("".concat(n," failed. error:"),d),T(d)})}},{key:"_getGroupProfileAdvance",value:function(e){var n=this,o=e.relayFlag,a=o!==void 0&&o,r=ft(e,yu);return this.request({protocolName:pa,requestData:r}).then(function(i){h.l("".concat(n._n,"._getGroupProfileAdvance ok."));var u=i.data.groups;return{successGroupList:u.filter(function(l){return S(l.errorCode)||l.errorCode===0}),failureGroupList:u.filter(function(l){return l.errorCode&&l.errorCode!==0}).map(function(l){return new oe({code:l.errorCode,message:l.errorInfo,data:{groupID:l.groupID}})})}}).catch(function(i){return a&&Oe({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:T(i)})}},{key:"createGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("createGroup"),a=e.type,r=e.groupID;if(e.name&&this._filterProfanity("name",e)===!1)return T({code:k.PROFANITY_FOUND});if(e.introduction&&this._filterProfanity("introduction",e)===!1)return T({code:k.PROFANITY_FOUND});if(e.notification&&this._filterProfanity("notification",e)===!1)return T({code:k.PROFANITY_FOUND});if(!["Public","Private","ChatRoom","AVChatRoom","Community"].includes(a))return T({code:k.ILLEGAL_GROUP_TYPE});if(!Oe({type:a})){if(!R(r)&&Oe({groupID:r}))return T({code:k.ILLEGAL_GROUP_ID});e.isSupportTopic=void 0}if(xe(a)&&!S(e.memberList)&&e.memberList.length>0&&(e.memberList=void 0),this._canIUseJoinOption(a)||S(e.joinOption)||(e.joinOption=void 0),Oe({type:a})){if(!R(r)&&!Oe({groupID:r}))return T({code:k.ILLEGAL_GROUP_ID});e.isSupportTopic=e.isSupportTopic===!0?1:0}var i=new L("createGroup");h.l("".concat(o," options:"),e);var u=null,l=[];return this.request({protocolName:ga,requestData:m(m({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then(function(d){var p=d.data,g=p.groupID,_=p.overLimitUserIDList,v=_===void 0?[]:_;if(u=g,l=v,i.setNetworkType(n.getNetworkType()).setMessage("groupType:".concat(e.type," groupID:").concat(g," overLimitUserIDList=").concat(v)).end(),h.l("".concat(o," ok groupID:").concat(g," overLimitUserIDList:"),v),e.type===f.GRP_AVCHATROOM)return n.getGroupProfile({groupID:g});if(e.type===f.GRP_COMMUNITY&&e.isSupportTopic===1)return n.getGroupProfile({groupID:g});R(e.memberList)||R(v)||(e.memberList=e.memberList.filter(function(C){return v.indexOf(C.userID)===-1})),n.updateGroupMap([m(m({},e),{},{groupID:g})]);var M=n.getModule(ue),y=M.createCustomMessage({to:g,conversationType:f.CONV_GROUP,payload:{data:"group_create",extension:n.isIntl()?"".concat(n.getMyUserID()," created a group"):"".concat(n.getMyUserID(),"创建群组")}});return M.sendMessageInstance(y),n.emitGroupListUpdate(),n.getGroupProfile({groupID:g})}).then(function(d){var p=d.data.group,g=p.selfInfo,_=g.nameCard,v=g.joinTime;return p.updateSelfInfo({nameCard:_,joinTime:v,messageRemindType:f.MSG_REMIND_ACPT_AND_NOTE,role:f.GRP_MBR_ROLE_OWNER}),x({group:p,overLimitUserIDList:l})}).catch(function(d){if(i.setMessage("groupType:".concat(e.type)),n.probeNetwork().then(function(g){var _=N(g,2),v=_[0],M=_[1];i.setError(d,v,M).end()}),d.code===10010||d.code===10007){n.updateGroupMap([m(m({},e),{},{groupID:u})]);var p=n.getLocalGroupProfile(u);return h.l("".concat(o," success, but failed to get group profile.")),x({group:p,overLimitUserIDList:l})}return h.e("".concat(o," failed. error:"),d),T(d)})}},{key:"dismissGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("dismissGroup");if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===f.GRP_WORK)return T(new oe({code:k.CANNOT_DISMISS_WORK}));var a=new L("dismissGroup");return a.setMessage("groupID:".concat(e)),h.l("".concat(o," groupID:").concat(e)),this.request({protocolName:ha,requestData:{groupID:e}}).then(function(){return a.setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok")),n.deleteLocalGroupAndConversation(e),n.checkJoinedAVChatRoomByID(e)&&n._AVChatRoomHandler.reset(e),n._groupAttributesHandler.deleteLocalGroupAttributes(e),x({groupID:e})}).catch(function(r){return n.probeNetwork().then(function(i){var u=N(i,2),l=u[0],d=u[1];a.setError(r,l,d).end()}),h.e("".concat(o," failed. error:"),r),T(r)})}},{key:"updateGroupProfile",value:function(e){var n=this,o="".concat(this._n,".").concat("updateGroupProfile");if(this.hasLocalGroup(e.groupID)){var a=this.getLocalGroupProfile(e.groupID).type;this._canIUseJoinOption(a)||S(e.joinOption)||(h.w("".concat(o," joinOption is unavailable for Work/Meeting/AVChatRoom")),e.joinOption=void 0)}if(S(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off"),e.name&&this._filterProfanity("name",e)===!1)return T({code:k.PROFANITY_FOUND});if(e.introduction&&this._filterProfanity("introduction",e)===!1)return T({code:k.PROFANITY_FOUND});if(e.notification&&this._filterProfanity("notification",e)===!1)return T({code:k.PROFANITY_FOUND});var r=new L("updateGroupProfile");return r.setMessage(JSON.stringify(e)),h.l("".concat(o," groupID:").concat(e.groupID)),this.request({protocolName:_a,requestData:e}).then(function(){return r.setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok")),n.hasLocalGroup(e.groupID)&&(n.groupMap.get(e.groupID).updateGroup(e),n._setStorageGroupList()),x({group:n.groupMap.get(e.groupID)})}).catch(function(i){return n.probeNetwork().then(function(u){var l=N(u,2),d=l[0],p=l[1];r.setError(i,d,p).end()}),h.l("".concat(o," failed. error:"),i),T(i)})}},{key:"_filterProfanity",value:function(e,n){var o=this.getModule(mt);if(!o)return!0;var a=o.filterText(n[e],Jo),r=a.isAllowedToSend,i=a.modifiedText;return r===!0&&(n[e]=i,!0)}},{key:"joinGroup",value:function(e){var n=this,o=e.groupID,a=e.type,r="".concat(this._n,".joinGroup");if(a===f.GRP_WORK)return T({code:k.CANNOT_JOIN_WORK});if(this.deleteUnjoinedAVChatRoom(o),this.hasLocalGroup(o)){if(!this.isLoggedIn())return Y({status:f.JOIN_STATUS_ALREADY_IN_GROUP});var i=new L("applyJoinGroup");return this.getGroupProfile({groupID:o}).then(function(){return i.setNetworkType(n.getNetworkType()).setMessage("groupID:".concat(o," joinedStatus:").concat(f.JOIN_STATUS_ALREADY_IN_GROUP)).end(),Y({status:f.JOIN_STATUS_ALREADY_IN_GROUP})}).catch(function(u){return i.setNetworkType(n.getNetworkType()).setMessage("groupID:".concat(o," unjoined")).end(),h.w("".concat(r," ").concat(o," was unjoined, now join!")),n.groupMap.delete(o),n.applyJoinGroup(e)})}return h.l("".concat(r," groupID:").concat(o)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e)}},{key:"applyJoinGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("applyJoinGroup"),a=e.groupID;if(!R(e.applyMessage)&&this._filterProfanity("applyMessage",e)===!1)return T({code:k.PROFANITY_FOUND});var r=new L("applyJoinGroup"),i=m({},e),u=this.canIUse(ye.AVCHATROOM_HISTORY_MSG);return u&&(i.historyMessageFlag=1),this.getModule(P).deleteTopicRoamingMessageInfo(a),this.request({protocolName:fa,requestData:i}).then(function(l){var d=l.data,p=d.joinedStatus,g=d.longPollingKey,_=d.startSeq,v=d.avChatRoomFlag,M=d.avChatRoomKey,y=d.messageList,C="groupID:".concat(a," joinedStatus:").concat(p," longPollingKey:").concat(g," startSeq:").concat(_)+" avChatRoomFlag:".concat(v," canGetAVChatRoomHistoryMessage:").concat(u,",")+" history message count:".concat(R(y)?0:y.length);switch(r.setNetworkType(n.getNetworkType()).setMessage("".concat(C)).end(),h.l("".concat(o," ok. ").concat(C)),p){case ls:return x({status:ls});case Et:return n.getGroupProfile({groupID:a}).then(function(E){var A=E.data.group;return n._handleJoinResult({group:A,avChatRoomFlag:v,longPollingKey:g,startSeq:_,avChatRoomKey:M,messageList:y})}).catch(function(){var E=new vt({groupID:a});return n._handleJoinResult({group:E,avChatRoomFlag:v,longPollingKey:g,startSeq:_,avChatRoomKey:M,messageList:y})});default:var D=new oe({code:k.JOIN_GROUP_FAIL});return h.e("".concat(o," failed. error:"),D),T(D)}}).catch(function(l){return r.setMessage("groupID:".concat(a)),n.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];r.setError(l,g,_).end()}),h.e("".concat(o," failed. error:"),l),T(l)})}},{key:"_handleJoinResult",value:function(e){var n,o=this,a=e.group,r=e.avChatRoomFlag,i=e.longPollingKey,u=e.startSeq,l=e.avChatRoomKey,d=e.messageList,p=a.groupID;return r===1?(this.getModule(P).setCompleted("".concat(f.CONV_GROUP).concat(p)),this._groupAttributesHandler.initGroupAttributesCache({groupID:p,avChatRoomKey:l}),this._groupCountersHandler.initGroupCountersCache({groupID:p,avChatRoomKey:l}),(n=S(i)?this._AVChatRoomHandler.handleJoinResult({group:a}):this._AVChatRoomHandler.startRunLoop({group:a,longPollingKey:i,startSeq:u})).then(function(){o._onAVChatRoomHistoryMessage(d)}),n):(this.emitGroupListUpdate(!0,!1),x({status:Et,group:a}))}},{key:"quitGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("quitGroup");h.l("".concat(o," groupID:").concat(e));var a=this.checkJoinedAVChatRoomByID(e);if(!a&&!this.hasLocalGroup(e))return T({code:k.MEMBER_NOT_IN_GROUP});if(a&&!this.isLoggedIn())return h.l("".concat(o," anonymously ok. groupID:").concat(e)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),Y({groupID:e});var r=new L("quitGroup");return r.setMessage("groupID:".concat(e)),this.request({protocolName:va,requestData:{groupID:e}}).then(function(){return r.setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok")),n.deleteLocalGroupAndConversation(e),a&&n._AVChatRoomHandler.reset(e),n._groupAttributesHandler.deleteLocalGroupAttributes(e),x({groupID:e})}).catch(function(i){return n.probeNetwork().then(function(u){var l=N(u,2),d=l[0],p=l[1];r.setError(i,d,p).end()}),h.e("".concat(o," failed. error:"),i),T(i)})}},{key:"searchGroupByID",value:function(e){var n=this,o="".concat(this._n,".").concat("searchGroupByID"),a={groupIDList:[e]},r=new L("searchGroupByID");return r.setMessage("groupID:".concat(e)),h.l("".concat(o," groupID:").concat(e)),this.request({protocolName:Ma,requestData:a}).then(function(i){var u=i.data.groupProfile;if(u[0].errorCode!==0)throw new oe({code:u[0].errorCode,message:u[0].errorInfo});return r.setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok")),x({group:new vt(u[0])})}).catch(function(i){return n.probeNetwork().then(function(u){var l=N(u,2),d=l[0],p=l[1];r.setError(i,d,p).end()}),h.w("".concat(o," failed. error:"),i),T(i)})}},{key:"changeGroupOwner",value:function(e){var n=this,o="".concat(this._n,".").concat("changeGroupOwner");if(this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===f.GRP_AVCHATROOM)return T({code:k.CANNOT_CHANGE_OWNER_IN_AVCHATROOM});if(e.newOwnerID===this.getMyUserID())return T({code:k.CANNOT_CHANGE_OWNER_TO_SELF});var a=new L("changeGroupOwner");return a.setMessage("groupID:".concat(e.groupID," newOwnerID:").concat(e.newOwnerID)),h.l("".concat(o," groupID:").concat(e.groupID)),this.request({protocolName:ya,requestData:e}).then(function(){a.setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok"));var r=e.groupID,i=e.newOwnerID;n.groupMap.get(r).ownerID=i;var u=n.getModule(me).getLocalGroupMemberList(r);if(u instanceof Map){var l=u.get(n.getMyUserID());S(l)||(l.updateRole("Member"),n.groupMap.get(r).selfInfo.role="Member");var d=u.get(i);S(d)||d.updateRole("Owner")}return n.emitGroupListUpdate(!0,!1),x({group:n.groupMap.get(r)})}).catch(function(r){return n.probeNetwork().then(function(i){var u=N(i,2),l=u[0],d=u[1];a.setError(r,l,d).end()}),h.e("".concat(o," failed. error:"),r),T(r)})}},{key:"getGroupApplicationList",value:function(){return this._groupSystemNoticeHandler.getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){var n,o,a,r,i,u=this,l="".concat(this._n,".").concat("handleGroupApplication"),d=e.handleAction,p=e.handleMessage,g=e.message,_=e.application;g?(n=g.payload.operatorID,o=g.payload.groupProfile.groupID,a=g.payload.authentication,r=g.payload.messageKey):_&&(n=_.applicant,o=_.groupID,a=_.authentication,r=_.messageKey);var v=Ia;_&&_.applicationType===2&&(v=Ca,i=_.userID);var M=new L("handleGroupApplication");return M.setMessage("groupID:".concat(o)),h.l("".concat(l," groupID:").concat(o)),this.request({protocolName:v,requestData:{handleAction:d,handleMessage:p,applicant:n,invitee:i,groupID:o,authentication:a,messageKey:r}}).then(function(){return M.setNetworkType(u.getNetworkType()).end(),h.l("".concat(l," ok")),g&&u._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),x({group:u.getLocalGroupProfile(o)})}).catch(function(y){return u.probeNetwork().then(function(C){var D=N(C,2),E=D[0],A=D[1];M.setError(y,E,A).end()}),h.e("".concat(l," failed. error"),y),T(y)})}},{key:"handleGroupInvitation",value:function(e){var n=this,o="".concat(this._n,".").concat("handleGroupInvitation"),a=e.message.payload,r=a.groupProfile.groupID,i=a.authentication,u=a.messageKey,l=a.operatorID,d=e.handleAction,p=new L("handleGroupInvitation");return p.setMessage("groupID:".concat(r," inviter:").concat(l," handleAction:").concat(d)),h.l("".concat(o," groupID:").concat(r," inviter:").concat(l," handleAction:").concat(d)),this.request({protocolName:Ta,requestData:m(m({},e),{},{inviter:l,groupID:r,authentication:i,messageKey:u})}).then(function(){return p.setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok")),n._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),x({group:n.getLocalGroupProfile(r)})}).catch(function(g){return n.probeNetwork().then(function(_){var v=N(_,2),M=v[0],y=v[1];p.setError(g,M,y).end()}),h.e("".concat(o," failed. error"),g),T(g)})}},{key:"getGroupOnlineMemberCount",value:function(e){return this._AVChatRoomHandler?this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)?this._AVChatRoomHandler.getGroupOnlineMemberCount(e):Y({memberCount:0}):T({code:k.CANNOT_FIND_MODULE})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var n=this.checkJoinedAVChatRoomByID(e);if(h.l("".concat(this._n,".deleteLocalGroupAndConversation isJoinedAVChatRoom:").concat(n)),n&&this.getModule(P).deleteLocalConversation("".concat(f.CONV_GROUP).concat(e)),Oe({groupID:e})){var o=this.getLocalGroupProfile(e);o&&o.isSupportTopic===!0&&this.getModule(ae).deleteTopicListInCommunity(e)}this._deleteLocalGroup(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this.getModule(me).deleteGroupMemberList(e),this._setStorageGroupList()}},{key:"sendMessage",value:function(e,n){if(b(e._receiverList)&&e._receiverList.length>0&&!this.canIUse(ye.MSG_TO_SPECIFIED_GRP_MBR))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var o=this.createGroupMessagePack(e,n);return this.request(o)}},{key:"createGroupMessagePack",value:function(e,n){var o=null;n&&n.offlinePushInfo&&(o=n.offlinePushInfo);var a="";z(e.cloudCustomData)&&e.cloudCustomData.length>0&&(a=e.cloudCustomData);var r=[];if(ne(n)&&ne(n.messageControlInfo)){var i=n.messageControlInfo,u=i.excludedFromUnreadCount,l=i.excludedFromLastMessage,d=i.excludedFromContentModeration;u===!0&&r.push("NoUnread"),l===!0&&r.push("NoLastMsg"),d===!0&&r.push("NoMsgCheck")}var p=void 0;b(e._receiverList)&&e._receiverList.length>0&&(p=e._receiverList,e._receiverList.length>50&&(p=e._receiverList.slice(0,50),this.outputWarning("ReceiverListLimit")));var g=this.isOnlineMessage(e,n)?1:0,_=e.getGroupAtInfoList(),v={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:e.getElements(),cloudCustomData:a,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==f.MSG_TEXT||R(_)?void 0:_,onlineOnlyFlag:g,clientTime:e.clientTime,offlinePushInfo:o?{pushFlag:o.disablePush===!0?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:o.ignoreIOSBadge===!0?1:0,isVoipPush:this._isVoipPush(o)},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,messageControlInfo:g===0?r:void 0,needReadReceipt:e.needReadReceipt!==!0||this.isMessageFromOrToAVChatroom(e.to)?0:1,receiverList:p,isSupportExtension:e.isSupportExtension===!0?1:0};return Le(e.to)&&(v.groupID=Ie(e.to),v.topicID=e.to),{protocolName:ro,tjgID:this.generateTjgID(e),requestData:v}}},{key:"_isVoipPush",value:function(e){var n=void 0;return S(e.disableVoipPush)||(n=e.disableVoipPush===!1?1:0),n}},{key:"revokeMessage",value:function(e){var n={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return Le(e.to)&&(n.groupID=Ie(e.to),n.topicID=e.to),this.request({protocolName:Da,requestData:n})}},{key:"deleteMessage",value:function(e){var n=e.to,o=e.keyList;h.l("".concat(this._n,".deleteMessage groupID:").concat(n," count:").concat(o.length));var a={groupID:n,deleter:this.getMyUserID(),keyList:o};return Le(n)&&(a.groupID=Ie(n),a.topicID=n),this.request({protocolName:ba,requestData:a})}},{key:"modifyRemoteMessage",value:function(e){var n=e.to,o=e.sequence,a=e.payload,r=e.type,i=e.version,u=i===void 0?0:i,l=e.cloudCustomData,d=n,p=void 0;Le(n)&&(d=Ie(n),p=n);var g=void 0;return ks(r)&&(g=[]).push({type:r,content:a}),this.request({protocolName:co,requestData:{groupID:d,topicID:p,sequence:o,version:u,elements:g,cloudCustomData:l}})}},{key:"getRoamingMessage",value:function(e){var n=this,o="".concat(this._n,".getRoamingMessage"),a=e.conversationID,r=e.groupID,i=e.sequence,u=new L("getGroupRoamingMessages"),l=0,d=void 0;return Le(r)&&(r=Ie(d=r)),this._computeLastSequence({groupID:r,topicID:d,sequence:i}).then(function(p){return l=p,h.l("".concat(o," groupID:").concat(r," startSequence:").concat(l)),n.request({protocolName:Tn,requestData:{groupID:r,count:21,sequence:l,topicID:d}})}).then(function(p){var g=p.data,_=g.messageList,v=g.complete,M=g.invisibleSequenceList,y=M===void 0?[]:M;S(_)?h.l("".concat(o," ok. complete:").concat(v," but messageList is undefined!")):h.l("".concat(o," ok. complete:").concat(v," count:").concat(_.length));var C=n._getMinSequence(y,_)-1;u.setNetworkType(n.getNetworkType()).setMessage("groupID:".concat(r," topicID:").concat(d," startSequence:").concat(l," complete:").concat(v," nextSequence:").concat(C)).end();var D=n.getModule(P),E=[];return R(_)||(D.updateRoamingMessageSequence(a,C),E=D.onRoamingMessage(_,a),D.updateIsRead(a),D.patchConversationLastMessage(a)),(v===2||C<=1)&&(D.setCompleted(a),C=""),h.l("".concat(o," nextReqID:").concat(C,", stored message count:").concat(E.length,", invisible sequence count:").concat(y.length)),{nextReqID:C+"",storedMessageList:E}}).catch(function(p){return n.probeNetwork().then(function(g){var _=N(g,2),v=_[0],M=_[1];u.setError(p,v,M).setMessage("groupID:".concat(r," topicID:").concat(d," startSequence:").concat(l)).end()}),h.w("".concat(o," failed. error:"),p),T(p)})}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(f.CONV_GROUP,"")}},{key:"_getMinSequence",value:function(e,n){var o=0;R(n)||(o=n[n.length-1].sequence);var a=0;return R(e)||(a=e[e.length-1]),h.l("".concat(this._n,"._getMinSequence minVisibleSequence:").concat(o," minInvisibleSequence:").concat(a)),a>0&&a<o?a:o}},{key:"getReadReceiptList",value:function(e){var n=this,o="".concat(this._n,".").concat("getReadReceiptList"),a=this._getGroupIDOfMessage(e[0]),r=this.getMyUserID(),i=e.filter(function(l){return l.from===r&&l.needReadReceipt===!0}).map(function(l){return{sequence:l.sequence}});if(h.l("".concat(o," groupID:").concat(a," sequenceList:").concat(JSON.stringify(i))),i.length===0)return Y({messageList:e});var u=new L("getReadReceiptList");return u.setMessage("groupID:".concat(a)),this.request({protocolName:Ea,requestData:{groupID:a,sequenceList:i}}).then(function(l){u.end(),h.l("".concat(o," ok"));var d=l.data.readReceiptList;return b(d)&&d.forEach(function(p){e.forEach(function(g){p.code===0&&p.sequence===g.sequence&&(g.readReceiptInfo.readCount=p.readCount,g.readReceiptInfo.unreadCount=p.unreadCount)})}),x({messageList:e})}).catch(function(l){return n.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];u.setError(l,g,_).end()}),h.w("".concat(o," failed. error:"),l),T(l)})}},{key:"sendReadReceipt",value:function(e){var n=this,o="".concat(this._n,".").concat("sendReadReceipt"),a=this._getGroupIDOfMessage(e[0]),r=new L("sendReadReceipt");r.setMessage("groupID:".concat(a));var i=this.getMyUserID(),u=e.filter(function(l){return l.from!==i&&l.needReadReceipt===!0}).map(function(l){return{sequence:l.sequence}});return u.length===0?T({code:k.READ_RECEIPT_MESSAGE_LIST_EMPTY}):(h.l("".concat(o,". sequenceList:").concat(JSON.stringify(u))),this.request({protocolName:La,requestData:{groupID:a,sequenceList:u}}).then(function(l){return r.end(),h.l("".concat(o," ok")),x()}).catch(function(l){return n.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];r.setError(l,g,_).end()}),h.w("".concat(o," failed. error:"),l),T(l)}))}},{key:"getReadReceiptDetail",value:function(e){var n=this,o=e.message,a=e.filter,r=e.cursor,i=e.count,u=this._getGroupIDOfMessage(o),l=o.ID,d=o.sequence,p="".concat(this._n,".").concat("getReadReceiptDetail"),g=this._receiptDetailCompleteMap.get(l)||!1,_=a!==0&&a!==1?0:a,v=z(r)?r:"",M=!ee(i)||i<=0||i>=100?100:i,y="groupID:".concat(u," sequence:").concat(d," cursor:").concat(v," filter:").concat(_," completeFlag:").concat(g);h.l("".concat(p," ").concat(y));var C={cursor:"",isCompleted:!1,messageID:l,unreadUserIDList:[],readUserIDList:[]},D=new L("getReadReceiptDetail");return D.setMessage(y),this.request({protocolName:Ra,requestData:{groupID:u,sequence:d,flag:_,cursor:v,count:M}}).then(function(E){D.end();var A=E.data,O=A.cursor,U=A.isCompleted,K=A.unreadUserIDList,j=A.readUserIDList;return C.cursor=O,U===1&&(C.isCompleted=!0,n._receiptDetailCompleteMap.set(l,!0)),_===0?C.readUserIDList=j.map(function(H){return H.userID}):_===1&&(C.unreadUserIDList=K.map(function(H){return H.userID})),h.l("".concat(p," ok")),x(C)}).catch(function(E){return n.probeNetwork().then(function(A){var O=N(A,2),U=O[0],K=O[1];D.setError(E,U,K).end()}),h.w("".concat(p," failed. error:"),E),T(E)})}},{key:"getRoamingMessagesHopping",value:function(e){var n=this,o="".concat(this._n,".getRoamingMessagesHopping"),a=new L("getGroupRoamingMessagesHopping"),r=e.groupID,i=e.count,u=e.sequence,l=e.direction,d=u;l===1&&(d=u+i-1);var p=void 0;Le(r)&&(r=Ie(p=r));var g="".concat(p?"topicID:".concat(p):"groupID:".concat(r)," sequence:").concat(u," direction:").concat(l);return h.l("".concat(o," ").concat(g)),this.request({protocolName:Tn,requestData:{groupID:r,topicID:p,count:i,sequence:d}}).then(function(_){var v=_.data,M=v.messageList,y=v.complete,C="complete:".concat(y," count:").concat(M?M.length:0);if(h.l("".concat(o," ok. ").concat(C)),a.setNetworkType(n.getNetworkType()).setMessage("".concat(g," ").concat(C)).end(),y===2||R(M)){var D=n._computeResult();return x(D)}var E="".concat(f.CONV_GROUP).concat(e.groupID),A=n.getModule(P).onRoamingMessage(M,E,!1),O=n._computeResult({direction:l,sequence:u,remoteMessageList:M,processedMessageList:A});return x(O)}).catch(function(_){return n.probeNetwork().then(function(v){var M=N(v,2),y=M[0],C=M[1];a.setError(_,y,C).setMessage("groupID:".concat(r," sequence:").concat(u," count:").concat(i)).end()}),h.w("".concat(o," failed. error:"),_),T(_)})}},{key:"_computeResult",value:function(e){var n={messageList:[],isCompleted:!1,nextMessageSeq:""};if(S(e))return n.isCompleted=!0,n;var o=e.direction,a=e.sequence,r=e.remoteMessageList,i=r===void 0?[]:r,u=e.processedMessageList,l=u===void 0?[]:u,d=i.length;return o===1?(n.nextMessageSeq=i[0].sequence+1,l.forEach(function(p){p.sequence>=a&&n.messageList.push(p)}),n.messageList.length===0&&i[0].sequence<a&&(n.isCompleted=!0,n.nextMessageSeq=""),n):(n.nextMessageSeq=i[d-1].sequence-1,n.messageList=B(l),n.nextMessageSeq===0&&(n.isCompleted=!0,n.nextMessageSeq=""),n)}},{key:"setMessageRead",value:function(e){var n=this,o=e.conversationID,a=e.lastMessageSeq,r="".concat(this._n,".setMessageRead");h.l("".concat(r," conversationID:").concat(o," lastMessageSeq:").concat(a)),ee(a)||this.outputWarning("DoNotModifyLastSeq");var i=new L("setGroupMessageRead");i.setMessage("".concat(o,"-").concat(a));var u=o.replace(f.CONV_GROUP,""),l=void 0;return Le(u)&&(u=Ie(l=u)),this.request({protocolName:ka,requestData:{groupID:u,topicID:l,messageReadSeq:a}}).then(function(){i.setNetworkType(n.getNetworkType()).end(),h.l("".concat(r," ok."));var d=n.getModule(P);d.updateIsReadAfterReadReport({conversationID:o,lastMessageSeq:a});var p=!0;if(!S(l)){p=!1;var g=n.getModule(ae).getLocalTopic(u,l);g&&g.updateSelfInfo({readedSequence:a})}return d.updateUnreadCount(o,p),x()}).catch(function(d){return n.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];i.setError(d,_,v).end()}),h.l("".concat(r," failed. error:"),d),T(d)})}},{key:"_computeLastSequence",value:function(e){var n=e.groupID,o=e.topicID,a=o===void 0?void 0:o,r=e.sequence;return r>0?Promise.resolve(r):S(a)||this.hasLocalGroup(n)?S(a)?this.getGroupLastSequence(n):this.getTopicLastSequence({groupID:n,topicID:a}):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var n=this,o="".concat(this._n,".").concat("getGroupLastSequence"),a=new L("getGroupLastSequence"),r=0,i="";if(this.hasLocalGroup(e)){var u=this.getLocalGroupProfile(e),l=u.lastMessage;if(l.lastSequence>0&&l.onlineOnlyFlag===!1)return r=l.lastSequence,i="got lastSequence:".concat(r," from local group profile[lastMessage.lastSequence]. groupID:").concat(e),h.l("".concat(o," ").concat(i)),a.setNetworkType(this.getNetworkType()).setMessage("".concat(i)).end(),Promise.resolve(r);if(u.nextMessageSeq>1)return r=u.nextMessageSeq-1,i="got lastSequence:".concat(r," from local group profile[nextMessageSeq]. groupID:").concat(e),h.l("".concat(o," ").concat(i)),a.setNetworkType(this.getNetworkType()).setMessage("".concat(i)).end(),Promise.resolve(r)}var d="GROUP".concat(e),p=this.getModule(P).getLocalConversation(d);if(p&&p.lastMessage.lastSequence&&p.lastMessage.onlineOnlyFlag===!1)return r=p.lastMessage.lastSequence,i="got lastSequence:".concat(r," from local conversation profile[lastMessage.lastSequence]. groupID:").concat(e),h.l("".concat(o," ").concat(i)),a.setNetworkType(this.getNetworkType()).setMessage("".concat(i)).end(),Promise.resolve(r);var g={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}};return this.getGroupProfileAdvance(g).then(function(_){var v=_.data.successGroupList;return R(v)?h.l("".concat(o," successGroupList is empty. groupID:").concat(e)):(r=v[0].nextMessageSeq-1,i="got lastSequence:".concat(r," from getGroupProfileAdvance. groupID:").concat(e),h.l("".concat(o," ").concat(i))),a.setNetworkType(n.getNetworkType()).setMessage("".concat(i)).end(),r}).catch(function(_){return n.probeNetwork().then(function(v){var M=N(v,2),y=M[0],C=M[1];a.setError(_,y,C).setMessage("get lastSequence failed from getGroupProfileAdvance. groupID:".concat(e)).end()}),h.w("".concat(o," failed. error:"),_),T(_)})}},{key:"getTopicLastSequence",value:function(e){var n=this,o=e.groupID,a=e.topicID,r="".concat(this._n,".").concat("getTopicLastSequence"),i=new L("getTopicLastSequence"),u=0,l="",d=this.getModule(ae);return d.hasLocalTopic(o,a)?(u=d.getLocalTopic(o,a).nextMessageSeq-1,l="get lastSequence:".concat(u," from local topic info[nextMessageSeq]. topicID:").concat(a),h.l("".concat(r," ").concat(l)),i.setNetworkType(this.getNetworkType()).setMessage("".concat(l)).end(),Promise.resolve(u)):d.getTopicList({groupID:o,topicIDList:[a]}).then(function(p){var g=p.data.successTopicList;return R(g)?h.l("".concat(r," successTopicList is empty. topicID:").concat(a)):(u=g[0].nextMessageSeq-1,l="get lastSequence:".concat(u," from getTopicList. topicID:").concat(a),h.l("".concat(r," ").concat(l))),i.setNetworkType(n.getNetworkType()).setMessage("".concat(l)).end(),u}).catch(function(p){return n.probeNetwork().then(function(g){var _=N(g,2),v=_[0],M=_[1];i.setError(p,v,M).setMessage("get lastSequence failed from getTopicList. topicID:".concat(a)).end()}),h.w("".concat(r," failed. error:"),p),T(p)})}},{key:"isMessageFromOrToAVChatroom",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"hasJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.hasJoinedAVChatRoom():0}},{key:"getJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.getJoinedAVChatRoom():[]}},{key:"isOnlineMessage",value:function(e,n){return!(!this._canIUseOnlineOnlyFlag(e)||!n||n.onlineUserOnly!==!0)}},{key:"_canIUseOnlineOnlyFlag",value:function(e){var n=this.getJoinedAVChatRoom();return!n||!n.includes(e.to)||e.conversationType!==f.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e){if(!R(e)){h.l("".concat(this._n,"._onAVChatRoomHistoryMessage count:").concat(e.length));var n=[];e.forEach(function(o){n.push(m(m({},o),{},{isHistoryMessage:1}))}),this.onAVChatRoomMessage(n)}}},{key:"onAVChatRoomMessage",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onMessage(e)}},{key:"onAVChatRoomMemberBanned",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onAVChatRoomMemberBanned(e)}},{key:"getGroupSimplifiedInfo",value:function(e){var n=this,o=new L("getGroupSimplifiedInfo"),a={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["Type","Name"]}};return this.getGroupProfileAdvance(a).then(function(r){var i=r.data.successGroupList;return o.setNetworkType(n.getNetworkType()).setMessage("groupID:".concat(e," type:").concat(i[0].type)).end(),i[0]}).catch(function(r){n.probeNetwork().then(function(i){var u=N(i,2),l=u[0],d=u[1];o.setError(r,l,d).setMessage("groupID:".concat(e)).end()})})}},{key:"setUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.set(e,1)}},{key:"deleteUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.has(e)&&this._unjoinedAVChatRoomList.delete(e)}},{key:"isUnjoinedAVChatRoom",value:function(e){return this._unjoinedAVChatRoomList.has(e)}},{key:"isGroupAttributesUpdatedNotice",value:function(e){return this._groupAttributesHandler.isGroupAttributesUpdatedNotice(e)}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesHandler.updateLocalMainSequenceOnReconnected()}},{key:"initGroupAttributes",value:function(e){return this._groupAttributesHandler.initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._groupAttributesHandler.setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._groupAttributesHandler.deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._groupAttributesHandler.getGroupAttributes(e)}},{key:"isMessageFromTopic",value:function(e,n){return e===2&&!R(n)}},{key:"isMessageFromCommunityOfTopic",value:function(e,n){return e===2&&R(n)}},{key:"getMessageExtensions",value:function(e,n){return h.l("".concat(this._n,".getMessageExtensions startSequence:").concat(n)),this.request({protocolName:po,requestData:{groupID:e.to,messageSequence:e.sequence,startSequence:n}})}},{key:"modifyMessageExtensions",value:function(e,n){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;return h.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(o)),this.request({protocolName:lo,requestData:{groupID:e.to,messageSequence:e.sequence,extensionList:n,operateType:o}})}},{key:"getGroupNotify",value:function(e){var n=this;if(this.hasLocalGroup(e)){var o=this.getLocalGroupProfile(e),a=o.type,r=o.isSupportTopic;if(!xe(a)&&!r){var i="".concat(this._n,".getGroupNotify"),u=this._getGroupLastRevokedTime(e),l=1e3*ut();h.l("".concat(i," groupID:").concat(e," type:").concat(a," beginTime:").concat(u," endTime:").concat(l)),this.request({protocolName:Ba,requestData:{type:Oe({type:a,groupID:e})?f.GRP_COMMUNITY:void 0,groupID:e,beginTime:u,endTime:l}}).then(function(d){var p=d.data,g=p.nextRevokedTime,_=p.notifyList;h.l("".concat(i," ok. groupID:").concat(e," nextRevokedTime:").concat(g));var v={dataList:[{elements:{revokedInfos:[]}}]};b(_)&&_.forEach(function(M){v.dataList[0].elements.revokedInfos.push({groupID:e,sequence:M.sequence,random:M.random,revokerInfo:m({},M.revokerInfo)})}),n.onGroupMessageRevoked(v),g!==0?(n._setGroupLastRevokedTime(e,g),n.getGroupNotify(e)):n._setGroupLastRevokedTime(e,1e3*ut())}).catch(function(d){h.e("".concat(i," failed. error:"),d)})}}}},{key:"_getGroupLastRevokedTime",value:function(e){return this.hasLocalGroup(e)?this.getLocalGroupProfile(e)._lastRevokedTime:0}},{key:"_setGroupLastRevokedTime",value:function(e,n){this.hasLocalGroup(e)&&(this.getLocalGroupProfile(e)._lastRevokedTime=n)}},{key:"isGroupCountersNotice",value:function(e){return this._groupCountersHandler.isGroupCountersNotice(e)}},{key:"setGroupCounters",value:function(e){return this._groupCountersHandler.setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._groupCountersHandler.increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._groupCountersHandler.decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._groupCountersHandler.getGroupCounters(e)}},{key:"restartPolling",value:function(){this._AVChatRoomHandler&&this._AVChatRoomHandler.restartPolling()}},{key:"getPollingTimerID",value:function(e){if(!e)return-1;var n=this.getLocalGroupProfile(e);return n&&xe(n.type)?this._AVChatRoomHandler.getPollingTimerID(e):-1}},{key:"_canIUseJoinOption",value:function(e){return function(n){return n===f.GRP_PUBLIC}(e)||Oe({type:e})}},{key:"reset",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._groupAttributesHandler.reset(),this._groupCountersHandler.reset(),this._AVChatRoomHandler&&this._AVChatRoomHandler.reset()}}]),s}(le),Cu=function(){function c(t){F(this,c),this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.lastSendMsgTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this._initMember(t)}return q(c,[{key:"_initMember",value:function(t){this.updateMember(t)}},{key:"updateMember",value:function(t){var s=[null,void 0,"",0,NaN];t.memberCustomField&&hn(this.memberCustomField,t.memberCustomField),$e(this,t,["memberCustomField","marks"],s)}},{key:"updateRole",value:function(t){["Owner","Admin","Member"].indexOf(t)<0||(this.role=t)}},{key:"updateMuteUntil",value:function(t){S(t)||(this.muteUntil=Math.floor((Date.now()+1e3*t)/1e3))}},{key:"updateNameCard",value:function(t){S(t)||(this.nameCard=t)}},{key:"updateMemberCustomField",value:function(t){t&&hn(this.memberCustomField,t)}}]),c}(),Tu=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="GroupMemberModule",n.groupMemberListMap=new Map,n.getInnerEmitterInstance().on(So,n._onProfileUpdated,$(n)),n}return q(s,[{key:"_onProfileUpdated",value:function(e){for(var n=this,o=e.data,a=function(i){var u=o[i];n.groupMemberListMap.forEach(function(l){l.has(u.userID)&&l.get(u.userID).updateMember({nick:u.nick,avatar:u.avatar})})},r=0;r<o.length;r++)a(r)}},{key:"deleteGroupMemberList",value:function(e){this.groupMemberListMap.delete(e)}},{key:"getGroupMemberList",value:function(e){var n=this,o=e.groupID,a=e.offset,r=a===void 0?0:a,i=e.count,u=i===void 0?15:i,l=e.filter,d=l===void 0?void 0:l,p="".concat(this._n,".").concat("getGroupMemberList"),g=this.getModule(V),_=g.hasLocalGroup(o);if(h.l("".concat(p," groupID:").concat(o," offset:").concat(r," count:").concat(u," hasLocalGroup:").concat(_)),!_)return Y({memberList:[],offset:0});if(g.getLocalGroupProfile(o).type===f.GRP_AVCHATROOM){if(this.canIUse(ye.AVCHATROOM_MBR_LIST))return this._getAVChatRoomMemberList({groupID:o,offset:r,filter:d});this.outputWarning("LiveOnlineMember")}var v=new L("getGroupMemberList"),M=0,y={groupID:o,limit:u>100?100:u};Oe({groupID:o})?y.next="".concat(r):(y.offset=r,M=r+u);var C=[];return this.request({protocolName:Wa,requestData:y}).then(function(D){var E=D.data,A=E.members,O=E.memberNum,U=E.next,K=U===void 0?void 0:U;if(S(K)||(M=R(K)?0:K),!b(A)||A.length===0)return M=0,Promise.resolve([]);var j=n.getModule(V);return j.hasLocalGroup(o)&&(j.getLocalGroupProfile(o).memberNum=O),C=n._updateLocalGroupMemberMap(o,A),n.getModule(pe).getUserProfile({userIDList:A.map(function(H){return H.userID}),tagList:[_e.NICK,_e.AVATAR]})}).then(function(D){var E=D.data;if(!b(E)||E.length===0)return Y({memberList:[],offset:M});var A=E.map(function(O){return{userID:O.userID,nick:O.nick,avatar:O.avatar}});return n._updateLocalGroupMemberMap(o,A),C.length<u&&(M=0),v.setNetworkType(n.getNetworkType()).setMessage("groupID:".concat(o," offset:").concat(r," count:").concat(u)).end(),h.l("".concat(p," ok.")),x({memberList:C,offset:M})}).catch(function(D){return n.probeNetwork().then(function(E){var A=N(E,2),O=A[0],U=A[1];v.setError(D,O,U).end()}),h.e("".concat(p," failed. error:"),D),T(D)})}},{key:"_getAVChatRoomMemberList",value:function(e){var n=this,o=e.groupID,a=e.offset,r=e.filter,i="".concat(this._n,".").concat("_getAVChatRoomMemberList"),u=new L("_getAVChatRoomMemberList");return u.setMessage("groupID:".concat(o," offset:").concat(a," filter:").concat(r)),this.request({protocolName:Ya,requestData:{groupID:o,offset:a,filter:r}}).then(function(l){var d=l.data,p=d.memberList,g=p===void 0?[]:p,_=d.offset,v=_===void 0?0:_;u.setNetworkType(n.getNetworkType()).end(),h.l("".concat(i," ok. member count:").concat(g.length,", next request timestamp:").concat(v));var M=n._updateLocalGroupMemberMap(o,g);return x({memberList:M,offset:v})}).catch(function(l){return n.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];u.setError(l,g,_).end()}),h.e("".concat(i," failed. error:"),l),T(l)})}},{key:"getGroupMemberProfile",value:function(e){var n=this,o="".concat(this._n,".").concat("getGroupMemberProfile"),a=new L("getGroupMemberProfile");a.setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)),h.l("".concat(o," groupID:").concat(e.groupID," userIDList:").concat(e.userIDList.join(","))),e.userIDList.length>50&&(e.userIDList=e.userIDList.slice(0,50));var r=e.groupID,i=e.userIDList;return this._getGroupMemberProfileAdvance(m(m({},e),{},{userIDList:i})).then(function(u){var l=u.data.members;return b(l)&&l.length!==0?(n._updateLocalGroupMemberMap(r,l),n.getModule(pe).getUserProfile({userIDList:l.map(function(d){return d.userID}),tagList:[_e.NICK,_e.AVATAR]})):Y([])}).then(function(u){var l=u.data.map(function(p){return{userID:p.userID,nick:p.nick,avatar:p.avatar}});n._updateLocalGroupMemberMap(r,l);var d=i.filter(function(p){return n.hasLocalGroupMember(r,p)}).map(function(p){return n.getLocalGroupMemberInfo(r,p)});return a.setNetworkType(n.getNetworkType()).end(),x({memberList:d})})}},{key:"addGroupMember",value:function(e){var n=this,o="".concat(this._n,".").concat("addGroupMember"),a=e.groupID,r=this.getModule(V).getLocalGroupProfile(a),i=r.type,u=new L("addGroupMember");if(u.setMessage("groupID:".concat(a," groupType:").concat(i)),xe(i)){var l=new oe({code:k.CANNOT_ADD_MEMBER_IN_AVCHATROOM});return u.setError(l,!0,this.getNetworkType()).end(),T(l)}return e.userIDList=e.userIDList.map(function(d){return{userID:d}}),h.l("".concat(o," groupID:").concat(a)),this.request({protocolName:za,requestData:e}).then(function(d){var p=d.data.members;h.l("".concat(o," ok"));var g=p.filter(function(C){return C.result===1}).map(function(C){return C.userID}),_=p.filter(function(C){return C.result===0}).map(function(C){return C.userID}),v=p.filter(function(C){return C.result===2}).map(function(C){return C.userID}),M=p.filter(function(C){return C.result===4}).map(function(C){return C.userID}),y="groupID:".concat(e.groupID,", ")+"successUserIDList:".concat(g,", ")+"failureUserIDList:".concat(_,", ")+"existedUserIDList:".concat(v,", ")+"overLimitUserIDList:".concat(M);return u.setNetworkType(n.getNetworkType()).setMoreMessage(y).end(),g.length===0?x({successUserIDList:g,failureUserIDList:_,existedUserIDList:v,overLimitUserIDList:M}):(r.memberCount+=g.length,n._updateConversationGroupProfile(r),x({successUserIDList:g,failureUserIDList:_,existedUserIDList:v,overLimitUserIDList:M,group:r}))}).catch(function(d){return n.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];u.setError(d,_,v).end()}),h.e("".concat(o," failed. error:"),d),T(d)})}},{key:"deleteGroupMember",value:function(e){var n=this,o="".concat(this._n,".").concat("deleteGroupMember"),a=e.groupID,r=e.userIDList,i=this.getModule(V).getLocalGroupProfile(a);if(S(i))return T({code:k.CANNOT_FIND_GROUP});if(xe(i.type))return this.canIUse(ye.AVCHATROOM_BAN_MBR)?this._banAVChatRoomMember(e):T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var u=new L("deleteGroupMember"),l="groupID:".concat(a," ").concat(r.length>5?"userIDList.length:".concat(r.length):"userIDList:".concat(r));return u.setMessage(l),h.l("".concat(o," groupID:").concat(a," userIDList:"),r),this.request({protocolName:Ja,requestData:e}).then(function(){return u.setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok")),i.memberCount-=1,n._updateConversationGroupProfile(i),n.deleteLocalGroupMembers(a,r),x({group:i,userIDList:r})}).catch(function(d){return n.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];u.setError(d,_,v).end()}),h.e("".concat(o," failed. error:"),d),T(d)})}},{key:"_updateConversationGroupProfile",value:function(e){this.getModule(P).updateConversationGroupProfile([e])}},{key:"_banAVChatRoomMember",value:function(e){var n=this,o="".concat(this._n,".").concat("deleteGroupMember"),a=e.groupID,r=e.userIDList,i="groupID:".concat(a," ").concat(r.length>5?"userIDList.length:".concat(r.length):"userIDList:".concat(r)),u=new L("deleteGroupMember");u.setMessage(i),h.l("".concat(o," groupID:").concat(a," userIDList:"),r);var l=this.getModule(V).getLocalGroupProfile(a);return S(e.duration)||e.duration===0?T({code:k.BAN_DURATION_INVALID}):this.request({protocolName:Xa,requestData:e}).then(function(){return u.setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok")),n.deleteLocalGroupMembers(a,r),x({group:l,userIDList:r})}).catch(function(d){return n.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];u.setError(d,_,v).end()}),h.e("".concat(o," failed. error:"),d),T(d)})}},{key:"setGroupMemberMuteTime",value:function(e){var n=this,o=e.groupID,a=e.userID,r=e.muteTime,i="".concat(this._n,".").concat("setGroupMemberMuteTime");if(a===this.getMyUserID())return T(new oe({code:k.CANNOT_MUTE_SELF}));h.l("".concat(i," groupID:").concat(o," userID:").concat(a));var u=new L("setGroupMemberMuteTime");return u.setMessage("groupID:".concat(o," userID:").concat(a," muteTime:").concat(r)),this.modifyGroupMemberInfo({groupID:o,userID:a,muteTime:r}).then(function(l){u.setNetworkType(n.getNetworkType()).end(),h.l("".concat(i," ok"));var d=n.getModule(V);return x({group:d.getLocalGroupProfile(o),member:l})}).catch(function(l){return n.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];u.setError(l,g,_).end()}),h.e("".concat(i," failed. error:"),l),T(l)})}},{key:"setGroupMemberRole",value:function(e){var n=this,o="".concat(this._n,".").concat("setGroupMemberRole"),a=e.groupID,r=e.userID,i=e.role,u=this.getModule(V).getLocalGroupProfile(a);if(u.selfInfo.role!==f.GRP_MBR_ROLE_OWNER)return T({code:k.NOT_OWNER});if([f.GRP_WORK,f.GRP_AVCHATROOM].includes(u.type))return T({code:k.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM});var l=[f.GRP_MBR_ROLE_ADMIN,f.GRP_MBR_ROLE_MEMBER];if(Oe({groupID:a})&&l.push(f.GRP_MBR_ROLE_CUSTOM),l.indexOf(i)<0)return T({code:k.INVALID_MEMBER_ROLE});if(r===this.getMyUserID())return T({code:k.CANNOT_SET_SELF_MEMBER_ROLE});var d=new L("setGroupMemberRole");return d.setMessage("groupID:".concat(a," userID:").concat(r," role:").concat(i)),h.l("".concat(o," groupID:").concat(a," userID:").concat(r)),this.modifyGroupMemberInfo({groupID:a,userID:r,role:i}).then(function(p){return d.setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok")),x({group:u,member:p})}).catch(function(p){return n.probeNetwork().then(function(g){var _=N(g,2),v=_[0],M=_[1];d.setError(p,v,M).end()}),h.e("".concat(o," failed. error:"),p),T(p)})}},{key:"_filterProfanity",value:function(e,n){var o=this.getModule(mt);if(!o)return!0;var a=o.filterText(n[e],pi),r=a.isAllowedToSend,i=a.modifiedText;return r===!0&&(n[e]=i,!0)}},{key:"setGroupMemberNameCard",value:function(e){var n=this,o="".concat(this._n,".").concat("setGroupMemberNameCard");if(e.nameCard&&this._filterProfanity("nameCard",e)===!1)return T({code:k.PROFANITY_FOUND});var a=e.groupID,r=e.userID,i=r===void 0?this.getMyUserID():r,u=e.nameCard;h.l("".concat(o," groupID:").concat(a," userID:").concat(i));var l=new L("setGroupMemberNameCard");return l.setMessage("groupID:".concat(a," userID:").concat(i," nameCard:").concat(u)),this.modifyGroupMemberInfo({groupID:a,userID:i,nameCard:u}).then(function(d){h.l("".concat(o," ok")),l.setNetworkType(n.getNetworkType()).end();var p=n.getModule(V).getLocalGroupProfile(a);return i===n.getMyUserID()&&p&&p.setSelfNameCard(u),x({group:p,member:d})}).catch(function(d){return n.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];l.setError(d,_,v).end()}),h.e("".concat(o," failed. error:"),d),T(d)})}},{key:"setGroupMemberCustomField",value:function(e){var n=this,o="".concat(this._n,".").concat("setGroupMemberCustomField"),a=e.groupID,r=e.userID,i=r===void 0?this.getMyUserID():r,u=e.memberCustomField;h.l("".concat(o," groupID:").concat(a," userID:").concat(i));var l=new L("setGroupMemberCustomField");return l.setMessage("groupID:".concat(a," userID:").concat(i," memberCustomField:").concat(JSON.stringify(u))),this.modifyGroupMemberInfo({groupID:a,userID:i,memberCustomField:u}).then(function(d){l.setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok"));var p=n.getModule(V).getLocalGroupProfile(a);return x({group:p,member:d})}).catch(function(d){return n.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];l.setError(d,_,v).end()}),h.e("".concat(o," failed. error:"),d),T(d)})}},{key:"modifyGroupMemberInfo",value:function(e){var n=this,o=e.groupID,a=e.userID,r=void 0;return Le(o)&&(o=Ie(r=o)),this.request({protocolName:Za,requestData:m(m({},e),{},{groupID:o,topicID:r})}).then(function(){if(n.hasLocalGroupMember(o,a)){var i=n.getLocalGroupMemberInfo(o,a);return S(e.muteTime)||i.updateMuteUntil(e.muteTime),S(e.role)||i.updateRole(e.role),S(e.nameCard)||i.updateNameCard(e.nameCard),S(e.memberCustomField)||i.updateMemberCustomField(e.memberCustomField),i}return n.getGroupMemberProfile({groupID:o,userIDList:[a]}).then(function(u){return N(u.data.memberList,1)[0]})})}},{key:"markGroupMemberList",value:function(e){var n=this,o="".concat(this._n,".").concat("markGroupMemberList"),a=e.groupID,r=e.markType,i=e.enableMark,u=e.userIDList,l=u===void 0?[]:u,d="groupID:".concat(a," markType:").concat(r," enableMark:").concat(i," userIDList count: ").concat(l.length);h.l("".concat(o," ").concat(d));var p=2,g=[];i===!0&&(p=1);var _=B(l);l.length>500&&(_=l.slice(0,500),h.w("".concat(o," ").concat(Kt(500)))),_.forEach(function(M){g.push({userID:M,markType:[r]})}),_=null;var v=new L("markGroupMemberList");return v.setMessage("".concat(d)),this.request({protocolName:Qa,requestData:{groupID:a,operationType:p,memberList:g}}).then(function(M){var y=M.data.memberList,C=y===void 0?[]:y,D=[],E=[];C.length===l.length?D.push.apply(D,B(l)):(C.forEach(function(O){D.push(O.userID)}),l.forEach(function(O){D.includes(O)||E.push(O)}));var A="success count:".concat(D.length," fail count:").concat(E.length);return v.setNetworkType(n.getNetworkType()).setMessage(A).end(),h.l("".concat(o," ok. ").concat(A)),x({successUserIDList:D,failureUserIDList:E})}).catch(function(M){return n.probeNetwork().then(function(y){var C=N(y,2),D=C[0],E=C[1];v.setError(M,D,E).end()}),h.e("".concat(o," failed. error:"),M),T(M)})}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this.request({protocolName:ja,requestData:m(m({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:["Role","JoinTime","NameCard","ShutUpUntil"]})})}},{key:"_updateLocalGroupMemberMap",value:function(e,n){var o=this;return b(n)&&n.length!==0?n.map(function(a){return o.hasLocalGroupMember(e,a.userID)?o.getLocalGroupMemberInfo(e,a.userID).updateMember(a):o.setLocalGroupMember(e,new Cu(a)),o.getLocalGroupMemberInfo(e,a.userID)}):[]}},{key:"deleteLocalGroupMembers",value:function(e,n){var o=this.groupMemberListMap.get(e);o&&n.forEach(function(a){o.delete(a)})}},{key:"getLocalGroupMemberInfo",value:function(e,n){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(n):null}},{key:"setLocalGroupMember",value:function(e,n){if(this.groupMemberListMap.has(e))this.groupMemberListMap.get(e).set(n.userID,n);else{var o=new Map().set(n.userID,n);this.groupMemberListMap.set(e,o)}}},{key:"getLocalGroupMemberList",value:function(e){return this.groupMemberListMap.get(e)}},{key:"hasLocalGroupMember",value:function(e,n){return this.groupMemberListMap.has(e)&&this.groupMemberListMap.get(e).has(n)}},{key:"hasLocalGroupMemberMap",value:function(e){return this.groupMemberListMap.has(e)}},{key:"reset",value:function(){this.groupMemberListMap.clear()}}]),s}(le),Du=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],Ar=function(c,t){return R(c)?{lastTime:0,lastSequence:0,fromAccount:"",payload:null,type:"",messageForShow:"",nick:"",version:0,cloudCustomData:"",isRevoked:!1,revoker:null}:{lastTime:c.time||0,lastSequence:c.sequence||0,fromAccount:c.from||"",payload:c.payload||null,type:c.type||"",messageForShow:Ht(c.type,c.payload,t),nick:c.nick||"",version:c.version||0,cloudCustomData:c.cloudCustomData||"",isRevoked:c.isRevoked||!1,revoker:c.revoker||null}},ku=function(){function c(t,s){F(this,c),this.topicID="",this.topicName="",this.avatar="",this.introduction="",this.notification="",this.unreadCount=0,this.muteAllMembers=!1,this.customData="",this.groupAtInfoList=[],this.nextMessageSeq=0,this.lastMessage=Ar(t.lastMessage,s),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:"",excludedUnreadSequenceList:void 0},this._initTopic(t)}return q(c,[{key:"_initTopic",value:function(t){for(var s in t)Du.indexOf(s)<0||(s==="selfInfo"?this.updateSelfInfo(t[s]):this[s]=s==="muteAllMembers"?t[s]===1:t[s])}},{key:"updateUnreadCount",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this.unreadCount=t}},{key:"updateNextMessageSeq",value:function(t){this.nextMessageSeq=t}},{key:"updateLastMessage",value:function(t){this.lastMessage=Ar(t)}},{key:"updateGroupAtInfoList",value:function(t){this.groupAtInfoList=JSON.parse(JSON.stringify(t))}},{key:"updateTopic",value:function(t){S(t.selfInfo)||this.updateSelfInfo(t.selfInfo),S(t.muteAllMembers)||(this.muteAllMembers=t.muteAllMembers===1),$e(this,t,["groupID","lastMessageTime","selfInfo","muteAllMembers","lastMsg"])}},{key:"updateSelfInfo",value:function(t){return $e(this.selfInfo,t,[],[""])!==0}},{key:"reduceUnreadCount",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:"isLastMessageRevoked",value:function(t){return t.sequence===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(t){this.lastMessage.isRevoked=t}},{key:"setLastMessageRevoker",value:function(t){this.lastMessage.revoker=t}}]),c}(),Su=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="TopicModule",n._topicMap=new Map,n._getTopicTimeMap=new Map,n.TOPIC_CACHE_TIME=300,n.TOPIC_LAST_ACTIVE_TIME=3600,n.getInnerEmitterInstance().on(We,n._onCloudConfigUpdated,$(n)),n}return q(s,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("topic_cache_time"),n=this.getCloudConfig("topic_last_active_time");S(e)||(this.TOPIC_CACHE_TIME=Number(e)),S(n)||(this.TOPIC_LAST_ACTIVE_TIME=Number(n))}},{key:"onTopicCreated",value:function(e){var n=e.groupID;this.resetGetTopicTime(n),this.emitOuterEvent(W.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var n=this,o=e.groupID,a=e.topicIDList;(a===void 0?[]:a).forEach(function(r){n._deleteLocalTopic(o,r)}),this.emitOuterEvent(W.TOPIC_DELETED,e)}},{key:"onTopicMessageRemindTypeUpdated",value:function(e){var n=e.groupID,o=e.topicID,a=e.messageRemindType,r=this.getLocalTopic(n,o);if(r){var i=r.updateSelfInfo({messageRemindType:a});i&&this.emitOuterEvent(W.TOPIC_UPDATED,{groupID:n,topic:r}),h.d("".concat(this._n,".onTopicMessageRemindTypeUpdated topicID:").concat(o)+" messageRemindType:".concat(a," isTopicUpdated:").concat(i))}}},{key:"onTopicProfileUpdated",value:function(e){var n=e.groupID,o=e.topicID,a=this.getLocalTopic(n,o);a&&(a.updateTopic(e),this.emitOuterEvent(W.TOPIC_UPDATED,{groupID:n,topic:a}))}},{key:"onConversationProxy",value:function(e){var n=e.topicID,o=e.unreadCount,a=e.groupAtInfoList,r=Ie(n),i=this.getLocalTopic(r,n),u=!1;i&&(S(o)||i.unreadCount===o||(i.updateUnreadCount(o),u=!0),S(a)||(i.updateGroupAtInfoList(a),u=!0)),u&&this.emitOuterEvent(W.TOPIC_UPDATED,{groupID:r,topic:i})}},{key:"onMessageSent",value:function(e){var n=e.groupID,o=e.topicID,a=e.lastMessage,r=this.getLocalTopic(n,o);r&&(r.nextMessageSeq+=1,r.updateLastMessage(a),this.emitOuterEvent(W.TOPIC_UPDATED,{groupID:n,topic:r}))}},{key:"onMessageModified",value:function(e){var n=e.to,o=e.time,a=e.sequence,r=e.elements,i=e.cloudCustomData,u=e.messageVersion,l=Ie(n),d=this.getLocalTopic(l,n);if(d){var p=d.lastMessage;h.d("".concat(this._n,".onMessageModified topicID:").concat(n," lastMessage:"),JSON.stringify(p),"options:",JSON.stringify(e)),p&&(p.payload===null||p.lastTime===o&&p.lastSequence===a&&p.version!==u)&&(p.type=r[0].type,p.payload=r[0].content,p.messageForShow=Ht(p.type,p.payload,this.isIntl()),p.cloudCustomData=i,p.version=u,p.lastSequence=a,p.lastTime=o,this.emitOuterEvent(W.TOPIC_UPDATED,{groupID:l,topic:d}))}}},{key:"onMessageRevoked",value:function(e){var n=this;if(e.length!==0){var o=null,a=null,r=!1;e.forEach(function(i){var u=i.to;a=Ie(u),(o=n.getLocalTopic(a,u))&&(o.reduceUnreadCount()&&(r=!0),o.isLastMessageRevoked(i)&&(o.setLastMessageRevoked(!0),o.setLastMessageRevoker(i.revoker),r=!0))}),r&&this.emitOuterEvent(W.TOPIC_UPDATED,{groupID:a,topic:o})}}},{key:"isLastMessageRevoked",value:function(e){var n=e.topicID,o=e.sequence,a=Ie(n),r=this.getLocalTopic(a,n),i=!1;return r&&(i=r.isLastMessageRevoked({sequence:o})),i}},{key:"getJoinedCommunityList",value:function(){return this.getModule(V).getGroupList({isGroupWithTopicOnly:!0}).then(function(e){var n=e.data.groupList;return x({groupList:n===void 0?[]:n})}).catch(function(e){return T(e)})}},{key:"createTopicInCommunity",value:function(e){var n=this,o="".concat(this._n,".").concat("createTopicInCommunity"),a=e.topicID;if(!S(a)&&!Le(a))return T({code:k.ILLEGAL_TOPIC_ID});if(e.topicName&&this._filterProfanity("topicName",e)===!1)return T({code:k.PROFANITY_FOUND});if(e.introduction&&this._filterProfanity("introduction",e)===!1)return T({code:k.PROFANITY_FOUND});if(e.notification&&this._filterProfanity("notification",e)===!1)return T({code:k.PROFANITY_FOUND});var r=new L("createTopicInCommunity");return this.request({protocolName:rr,requestData:m({},e)}).then(function(i){var u=i.data.topicID;return r.setMessage("topicID:".concat(u)).setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok")),n._updateTopicMap([m(m({},e),{},{topicID:u})]),x({topicID:u})}).catch(function(i){return n.probeNetwork().then(function(u){var l=N(u,2),d=l[0],p=l[1];r.setError(i,d,p).end()}),h.e("".concat(o," failed. error:"),i),T(i)})}},{key:"deleteTopicFromCommunity",value:function(e){var n=this,o="".concat(this._n,".").concat("deleteTopicFromCommunity"),a=e.groupID,r=e.topicIDList,i=r===void 0?[]:r,u=new L("deleteTopicFromCommunity");return u.setMessage("groupID:".concat(a," topicIDList:").concat(i)),this.request({protocolName:ir,requestData:{groupID:a,topicIDList:i}}).then(function(l){var d=l.data.resultList,p=[],g=[];(d===void 0?[]:d).forEach(function(v){var M=v.topicID,y=v.errorCode,C=v.errorInfo;y===0?p.push({topicID:M}):g.push({topicID:M,code:y,message:C})});var _="success count:".concat(p.length,", fail count:").concat(g.length);return u.setMoreMessage("".concat(_)).setNetworkType(n.getNetworkType()).end(),h.l("".concat(_)),p.forEach(function(v){n._deleteLocalTopic(a,v.topicID)}),x({successTopicList:p,failureTopicList:g})}).catch(function(l){return n.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];u.setError(l,g,_).end()}),h.e("".concat(o," failed. error:"),l),T(l)})}},{key:"updateTopicProfile",value:function(e){var n=this,o="".concat(this._n,".").concat("updateTopicProfile");if(h.l("".concat(o," options:"),e),e.topicName&&this._filterProfanity("topicName",e)===!1)return T({code:k.PROFANITY_FOUND});if(e.introduction&&this._filterProfanity("introduction",e)===!1)return T({code:k.PROFANITY_FOUND});if(e.notification&&this._filterProfanity("notification",e)===!1)return T({code:k.PROFANITY_FOUND});var a=new L("updateTopicProfile");return a.setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),S(e.muteAllMembers)||(e.muteAllMembers=e.muteAllMembers===!0?"On":"Off"),this.request({protocolName:ur,requestData:m({},e)}).then(function(){return a.setNetworkType(n.getNetworkType()).end(),h.l("".concat(o," ok")),n._updateTopicMap([e]),x({topic:n.getLocalTopic(e.groupID,e.topicID)})}).catch(function(r){return n.probeNetwork().then(function(i){var u=N(i,2),l=u[0],d=u[1];a.setError(r,l,d).end()}),h.e("".concat(o," failed. error:"),r),T(r)})}},{key:"getTopicList",value:function(e){var n=this,o="".concat(this._n,".").concat("getTopicList"),a=e.groupID,r=e.topicIDList,i=r===void 0?[]:r,u=i.length===0,l=new L("getTopicList");if(l.setMessage("groupID:".concat(a)),this._getTopicTimeMap.has(a)){var d=this._getTopicTimeMap.get(a),p=d.isGetAll,g=d.time;if((p||!p&&!u)&&Date.now()-g<1e3*this.TOPIC_CACHE_TIME){var _=this._getLocalTopicList(a,i);if(u||_.length===i.length)return l.setNetworkType(this.getNetworkType()).setMoreMessage("from cache, topic count:".concat(_.length)).end(),h.l("".concat(o," groupID:").concat(a," from cache, topic count:").concat(_.length)),Y({successTopicList:_,failureTopicList:[]})}}return this.request({protocolName:cr,requestData:{groupID:a,topicIDList:i}}).then(function(v){var M=v.data.topicInfoList,y=[],C=[],D=[];(M===void 0?[]:M).forEach(function(O){var U=O.topic,K=O.selfInfo,j=O.errorCode,H=O.errorInfo,J=U.topicID;j===0?(y.push(m(m({},U),{},{selfInfo:K})),C.push(J)):D.push({topicID:J,code:j,message:H})}),n._updateTopicMap(y),n._handleTopicAtInfo(y);var E="success count:".concat(C.length,", fail count:").concat(D.length);l.setNetworkType(n.getNetworkType()).setMoreMessage("".concat(E)).end(),h.l("".concat(o," groupID:").concat(a," from remote, ").concat(E));var A=[];return R(C)||(n._getTopicTimeMap.set(a,{time:Date.now(),isGetAll:u}),A=n._getLocalTopicList(a,C)),x({successTopicList:A,failureTopicList:D})}).catch(function(v){return n.probeNetwork(v).then(function(M){var y=N(M,2),C=y[0],D=y[1];l.setError(v,C,D).end()}),h.e("".concat(o," failed. error:"),v),T(v)})}},{key:"hasLocalTopic",value:function(e,n){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(n)}},{key:"getLocalTopic",value:function(e,n){var o=null;return this._topicMap.has(e)&&(o=this._topicMap.get(e).get(n)),o}},{key:"_getLocalTopicList",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=this._topicMap.get(e),a=[];return o&&(a=B(o.values())),n.length===0?a:a.filter(function(r){return n.includes(r.topicID)})}},{key:"_deleteLocalTopic",value:function(e,n){this._topicMap.has(e)&&(this._topicMap.get(e).delete(n),h.l("".concat(this._n,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(n)))}},{key:"_updateTopicMap",value:function(e){var n=this,o=[];e.forEach(function(a){var r=a.groupID,i=a.topicID,u=null;n._topicMap.has(r)||n._topicMap.set(r,new Map),n._topicMap.get(r).has(i)?(u=n._topicMap.get(r).get(i)).updateTopic(a):(n._getTopicLastMessage(a),u=new ku(a,n.isIntl()),n._topicMap.get(r).set(i,u));var l=n._computeUnreadCount(u);u.updateUnreadCount(l),o.push({conversationID:"".concat(f.CONV_GROUP).concat(i),type:f.CONV_TOPIC,unreadCount:l})}),o.length>0&&this.getModule(P).updateTopicConversation(o)}},{key:"resetGetTopicTime",value:function(e){var n=this;S(e)?B(this._getTopicTimeMap.keys()).forEach(function(o){n._getTopicTimeMap.set(o,0)}):this._getTopicTimeMap.set(e,0)}},{key:"getTopicListOnReconnected",value:function(){var e=this,n=B(this._topicMap.keys()),o=[];n.forEach(function(a){var r=[];e._getLocalTopicList(a).forEach(function(i){var u=i.lastMessage.lastTime,l=u===void 0?0:u;Date.now()-1e3*l<1e3*e.TOPIC_LAST_ACTIVE_TIME&&r.push(i.topicID)}),r.length>0&&o.push({groupID:a,topicIDList:r})}),h.l("".concat(this._n,".getTopicListOnReconnected. active community count:").concat(o.length)),this._relayGetTopicList(o)}},{key:"_relayGetTopicList",value:function(e){var n=this;if(e.length!==0){var o=e.shift(),a=o.topicIDList.length>5?"topicIDList.length:".concat(o.topicIDList.length):"topicIDList:".concat(o.topicIDList),r=new L("relayGetTopicList");r.setMessage(a),h.l("".concat(this._n,"._relayGetTopicList. ").concat(a)),this.getTopicList(o).then(function(){r.setNetworkType(n.getNetworkType()).end(),n._relayGetTopicList(e)}).catch(function(i){n.probeNetwork().then(function(u){var l=N(u,2),d=l[0],p=l[1];r.setError(i,d,p).end()}),n._relayGetTopicList(e)})}}},{key:"_handleTopicAtInfo",value:function(e){var n=this;e.length!==0&&e.forEach(function(o){var a=o.groupID,r=o.topicID,i=o.groupAtInfoList,u=[];S(i)||(i.forEach(function(l){u.push(m(m({},l),{},{groupID:a,topicID:r}))}),n.getModule(P).onNewGroupAtTips({dataList:u}))})}},{key:"_getTopicLastMessage",value:function(e){if(!S(e.lastMsg)){var n={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:"",nick:e.lastMsg.nick,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:e.lastMsg.isPlaceMessage===2,revoker:R(e.lastMsg.revokerInfo)?null:e.lastMsg.revokerInfo.revoker};e.lastMessage=n}}},{key:"deleteTopicListInCommunity",value:function(e){var n=this,o=this._getLocalTopicList(e),a=this.getModule(P);o.forEach(function(r){var i=r.topicID;n._deleteLocalTopic(e,i),n._getTopicTimeMap.delete(e),a.deleteLocalConversation("".concat(f.CONV_GROUP).concat(i))})}},{key:"_computeUnreadCount",value:function(e){var n=e.selfInfo,o=n.excludedUnreadSequenceList,a=n.readedSequence,r=e.nextMessageSeq-e.selfInfo.readedSequence-1;if(b(o)){var i=0;o.forEach(function(u){u>=a&&u<=e.nextMessageSeq-1&&(i+=1)}),i>=1&&(r-=i)}return r<0?0:r}},{key:"_filterProfanity",value:function(e,n){var o=this.getModule(mt);if(!o)return!0;var a=o.filterText(n[e],Jo),r=a.isAllowedToSend,i=a.modifiedText;return r===!0&&(n[e]=i,!0)}},{key:"updateLastMessage",value:function(e,n){var o=Ie(e),a=this.getLocalTopic(o,e);if(a){var r=n.sequence+1;a.updateNextMessageSeq(r),a.updateLastMessage(n),this.emitOuterEvent(W.TOPIC_UPDATED,{groupID:o,topic:a})}}},{key:"getMessageExtensions",value:function(e,n){h.l("".concat(this._n,".getMessageExtensions startSequence:").concat(n));var o=Ie(e.to);return this.request({protocolName:po,requestData:{groupID:o,topicID:e.to,messageSequence:e.sequence,startSequence:n}})}},{key:"modifyMessageExtensions",value:function(e,n){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;h.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(o));var a=Ie(e.to);return this.request({protocolName:lo,requestData:{groupID:a,topicID:e.to,messageSequence:e.sequence,extensionList:n,operateType:o}})}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),s}(le),Eu=function(){function c(t){F(this,c),this._userModule=t,this._n="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}return q(c,[{key:"setExpirationTime",value:function(t){this.expirationTime=t}},{key:"getUserProfile",value:function(t){var s=this,e="".concat(this._n,".").concat("getUserProfile"),n=t.userIDList;t.fromAccount=this._userModule.getMyAccount(),n.length>100&&(h.w("".concat(e," ").concat(Kt(100))),n.length=100);for(var o,a=[],r=[],i=0,u=n.length;i<u;i++)o=n[i],this._userModule.isMyFriend(o)&&this._contains(o)?r.push(this._getProfileFromMap(o)):a.push(o);if(a.length===0)return Y(r);t.toAccount=a;var l=t.bFromGetMyProfile||!1,d=[];t.toAccount.forEach(function(g){d.push({toAccount:g,standardSequence:0,customSequence:0})}),t.userItem=d;var p=new L("getUserProfile");return p.setMessage(n.length>5?"userIDList.length:".concat(n.length):"userIDList:".concat(n)),this._userModule.request({protocolName:xs,requestData:t}).then(function(g){p.setNetworkType(s._userModule.getNetworkType()).end(),h.i("".concat(e," ok"));var _=s._handleResponse(g).concat(r);return x(l?_[0]:_)}).catch(function(g){return s._userModule.probeNetwork().then(function(_){var v=N(_,2),M=v[0],y=v[1];p.setError(g,M,y).end()}),h.e("".concat(e," failed. error:"),g),T(g)})}},{key:"getMyProfile",value:function(){var t=this._userModule.getMyAccount(),s="".concat(this._n,".getMyProfile");if(h.l("".concat(s," myAccount:").concat(t)),this._fill(),this._contains(t)){var e=this._getProfileFromMap(t);return h.d("".concat(s," from cache, myProfile:").concat(JSON.stringify(e))),Y(e)}return this.getUserProfile({fromAccount:t,userIDList:[t],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(t){var s=t.data.userProfileItem;if(!b(s))return[];for(var e=[],n=Date.now(),o=0,a=s.length;o<a;o++){var r=s[o],i=r.to,u=r.profileItem;if(i!=="@TLS#NOT_FOUND"&&i!==""){var l=this._update(i,this._getLatestProfileFromResponse(i,u)).latestProfile;e.push(l)}}return h.l("".concat(this._n,"._handleResponse cost ").concat(Date.now()-n," ms")),e}},{key:"_getLatestProfileFromResponse",value:function(t,s){var e={userID:t,profileCustomField:[]};if(!R(s))for(var n=0,o=s.length;n<o;n++)if(s[n].tag.indexOf("Tag_Profile_Custom")>-1)e.profileCustomField.push({key:s[n].tag,value:s[n].value});else switch(s[n].tag){case _e.NICK:e.nick=s[n].value;break;case _e.GENDER:e.gender=s[n].value;break;case _e.BIRTHDAY:e.birthday=s[n].value;break;case _e.LOCATION:e.location=s[n].value;break;case _e.SELFSIGNATURE:e.selfSignature=s[n].value;break;case _e.ALLOWTYPE:e.allowType=s[n].value;break;case _e.LANGUAGE:e.language=s[n].value;break;case _e.AVATAR:e.avatar=s[n].value;break;case _e.MESSAGESETTINGS:e.messageSettings=s[n].value;break;case _e.ADMINFORBIDTYPE:e.adminForbidType=s[n].value;break;case _e.LEVEL:e.level=s[n].value;break;case _e.ROLE:e.role=s[n].value;break;default:h.w("".concat(this._n,"._getLatestProfileFromResponse unknown tag:"),s[n].tag,s[n].value)}return e}},{key:"updateMyProfile",value:function(t){var s=this,e="".concat(this._n,".").concat("updateMyProfile");if(t.nick&&this._userModule.filterProfanity("nick",t)===!1)return T({code:k.PROFANITY_FOUND});if(t.selfSignature&&this._userModule.filterProfanity("selfSignature",t)===!1)return T({code:k.PROFANITY_FOUND});var n=new L("updateMyProfile");n.setMessage(JSON.stringify(t));var o=new Sn().validate(t);if(!o.valid)return n.setCode(k.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:".concat(o.tips)).setNetworkType(this._userModule.getNetworkType()).end(),h.e("".concat(e," info:").concat(o.tips)),T({code:k.UPDATE_PROFILE_INVALID_PARAM});var a=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(r==="profileCustomField"?t.profileCustomField.forEach(function(l){a.push({tag:l.key,value:l.value})}):a.push({tag:_e[r.toUpperCase()],value:t[r]}));if(a.length===0){var i=new oe({code:k.UPDATE_PROFILE_NO_KEY});return n.setError(i,!0,this._userModule.getNetworkType()).end(),h.e("".concat(e," failed. error:"),i),T(i)}var u=this._userModule.getMyAccount();return this._userModule.request({protocolName:Vs,requestData:{fromAccount:u,profileItem:a}}).then(function(l){n.setNetworkType(s._userModule.getNetworkType()).end(),h.i("".concat(e," ok"));var d=s._update(u,t),p=d.isProfileUpdated,g=d.latestProfile;return p===!0&&s._userModule.emitOuterEvent(W.PROFILE_UPDATED,[g]),Y(g)}).catch(function(l){return s._userModule.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];n.setError(l,g,_).end()}),h.e("".concat(e," failed. error:"),l),T(l)})}},{key:"onProfileModified",value:function(t){var s=t.dataList;if(!R(s)){var e,n=s.length;h.d("".concat(this._n,".onProfileModified count:").concat(n," dataList:"),t.dataList);for(var o=[],a=0;a<n;a++){e=s[a].userID;var r=this._update(e,this._getLatestProfileFromResponse(e,s[a].profileList)),i=r.isProfileUpdated,u=r.latestProfile;i===!0&&o.push(u)}o.length>0&&(this._userModule.emitInnerEvent(So,o),this._userModule.emitOuterEvent(W.PROFILE_UPDATED,o))}}},{key:"_fill",value:function(){if(this.accountProfileMap.size===0){for(var t=this._getCachedProfiles(),s=Date.now(),e=0,n=t.length;e<n;e++)s-t[e].lastUpdatedTime<this.expirationTime&&this.accountProfileMap.set(t[e].userID,t[e]);h.l("".concat(this._n,"._fill from cache, size:").concat(this.accountProfileMap.size))}}},{key:"_update",value:function(t,s){var e,n=!1,o=Date.now();return this._contains(t)?(e=this._getProfileFromMap(t),s.profileCustomField&&hn(e.profileCustomField,s.profileCustomField)===!0&&(e.lastUpdatedTime=o,n=!0),$e(e,s,["profileCustomField"])>0&&(e.lastUpdatedTime=o,n=!0)):(e=new Sn(s),(this._userModule.isMyFriend(t)||t===this._userModule.getMyAccount())&&(e.lastUpdatedTime=o,n=!0,this.accountProfileMap.set(t,e))),this._flush(t===this._userModule.getMyAccount()),h.l("".concat(this._n,"._update account:").concat(t," isProfileUpdated:").concat(n)),{isProfileUpdated:n,latestProfile:e}}},{key:"_flush",value:function(t){var s=B(this.accountProfileMap.values()),e=this._userModule.getStorageModule();h.d("".concat(this._n,"._flush length:").concat(s.length," flushAtOnce:").concat(t)),e.setItem(this.TAG,s,t)}},{key:"_contains",value:function(t){return this.accountProfileMap.has(t)}},{key:"_getProfileFromMap",value:function(t){return this.accountProfileMap.get(t)}},{key:"_getCachedProfiles",value:function(){var t=this._userModule.getStorageModule().getItem(this.TAG);return R(t)?[]:t}},{key:"onConversationsProfileUpdated",value:function(t){for(var s,e,n,o=[],a=0,r=t.length;a<r;a++)e=(s=t[a]).userID,this._userModule.isMyFriend(e)&&(this._contains(e)?(n=this._getProfileFromMap(e),$e(n,s)>0&&o.push(e)):o.push(s.userID));o.length!==0&&(h.i("".concat(this._n,".onConversationsProfileUpdated toAccountList:").concat(o)),this.getUserProfile({userIDList:o}))}},{key:"getNickAndAvatarByUserID",value:function(t){if(this._contains(t)){var s=this._getProfileFromMap(t);return{nick:s.nick,avatar:s.avatar}}return{nick:"",avatar:""}}},{key:"reset",value:function(){this._flush(!0),this.accountProfileMap.clear()}}]),c}(),Rr=q(function c(t){F(this,c),R||(this.userID=t.userID||"",this.timeStamp=t.timeStamp||0)}),Lu=function(){function c(t){F(this,c),this._userModule=t,this._n="BlacklistHandler",this._blacklistMap=new Map,this.startIndex=0,this.maxLimited=100,this.currentSequence=0}return q(c,[{key:"getLocalBlacklist",value:function(){return B(this._blacklistMap.keys())}},{key:"getBlacklist",value:function(){var t=this,s="".concat(this._n,".getBlacklist"),e={fromAccount:this._userModule.getMyAccount(),maxLimited:this.maxLimited,startIndex:0,lastSequence:this.currentSequence},n=new L("getBlacklist");return this._userModule.request({protocolName:Bs,requestData:e}).then(function(o){var a=o.data,r=a.blackListItem,i=a.currentSequence,u=R(r)?0:r.length;n.setNetworkType(t._userModule.getNetworkType()).setMessage("count:".concat(u)).end(),h.i("".concat(s," ok")),t.currentSequence=i,t._handleResponse(r,!0),t._userModule.emitOuterEvent(W.BLACKLIST_UPDATED,B(t._blacklistMap.keys()))}).catch(function(o){return t._userModule.probeNetwork().then(function(a){var r=N(a,2),i=r[0],u=r[1];n.setError(o,i,u).end()}),h.e("".concat(s," failed. error:"),o),T(o)})}},{key:"addBlacklist",value:function(t){var s=this,e=new L("addToBlacklist"),n="".concat(this._n,".addBlacklist"),o=this._userModule.getMyAccount();if(t.userIDList.length===1&&t.userIDList[0]===o){var a=k.CANNOT_ADD_SELF_TO_BLACKLIST,r=this._userModule.getErrorMessage(a);e.setCode(a).setMessage(r).setNetworkType(this._userModule.getNetworkType()).end();var i=new oe({code:a});return h.e("".concat(n," failed. error:"),i),T(i)}return t.userIDList.includes(o)&&(t.userIDList=t.userIDList.filter(function(u){return u!==o})),t.fromAccount=this._userModule.getMyAccount(),t.toAccount=t.userIDList,this._userModule.request({protocolName:Hs,requestData:t}).then(function(u){return e.setNetworkType(s._userModule.getNetworkType()).setMessage(t.userIDList.length>5?"userIDList.length:".concat(t.userIDList.length):"userIDList:".concat(t.userIDList)).end(),h.i("".concat(n," ok")),s._handleResponse(u.resultItem,!0),x(B(s._blacklistMap.keys()))}).catch(function(u){return s._userModule.probeNetwork().then(function(l){var d=N(l,2),p=d[0],g=d[1];e.setError(u,p,g).end()}),h.e("".concat(n," failed. error:"),u),T(u)})}},{key:"_handleResponse",value:function(t,s){if(!R(t))for(var e,n,o,a=0,r=t.length;a<r;a++)n=t[a].to,o=t[a].resultCode,(S(o)||o===0)&&(s?((e=this._blacklistMap.has(n)?this._blacklistMap.get(n):new Rr).userID=n,!R(t[a].addBlackTimeStamp)&&(e.timeStamp=t[a].addBlackTimeStamp),this._blacklistMap.set(n,e)):this._blacklistMap.has(n)&&(e=this._blacklistMap.get(n),this._blacklistMap.delete(n)));h.l("".concat(this._n,"._handleResponse total:").concat(this._blacklistMap.size," bAdd:").concat(s))}},{key:"deleteBlacklist",value:function(t){var s=this,e="".concat(this._n,".deleteBlacklist"),n=new L("removeFromBlacklist");return t.fromAccount=this._userModule.getMyAccount(),t.toAccount=t.userIDList,this._userModule.request({protocolName:Ks,requestData:t}).then(function(o){return n.setNetworkType(s._userModule.getNetworkType()).setMessage(t.userIDList.length>5?"userIDList.length:".concat(t.userIDList.length):"userIDList:".concat(t.userIDList)).end(),h.i("".concat(e," ok")),s._handleResponse(o.data.resultItem,!1),x(B(s._blacklistMap.keys()))}).catch(function(o){return s._userModule.probeNetwork().then(function(a){var r=N(a,2),i=r[0],u=r[1];n.setError(o,i,u).end()}),h.e("".concat(e," failed. error:"),o),T(o)})}},{key:"onAccountDeleted",value:function(t){for(var s,e=[],n=0,o=t.length;n<o;n++)s=t[n],this._blacklistMap.has(s)&&(this._blacklistMap.delete(s),e.push(s));e.length>0&&(h.l("".concat(this._n,".onAccountDeleted count:").concat(e.length," userIDList:"),e),this._userModule.emitOuterEvent(W.BLACKLIST_UPDATED,B(this._blacklistMap.keys())))}},{key:"onAccountAdded",value:function(t){for(var s,e=[],n=0,o=t.length;n<o;n++)s=t[n],this._blacklistMap.has(s)||(this._blacklistMap.set(s,new Rr({userID:s})),e.push(s));e.length>0&&(h.l("".concat(this._n,".onAccountAdded count:").concat(e.length," userIDList:"),e),this._userModule.emitOuterEvent(W.BLACKLIST_UPDATED,B(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.currentSequence=0}}]),c}(),Ao=function(c){var t=String(c).replace(/[=]+$/,""),s="";if(t.length%4==1)return"";for(var e,n,o=0,a=0;n=t.charAt(a++);~n&&(e=o%4?64*e+n:n,o++%4)?s+=String.fromCharCode(255&e>>(-2*o&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);try{return decodeURIComponent(escape(s))}catch{return""}},Au=function(){function c(t){F(this,c),this._userModule=t,this._n="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userModule.getInnerEmitterInstance().on(We,this._onCloudConfigUpdated,this)}return q(c,[{key:"_onCloudConfigUpdated",value:function(){var t=this._userModule.getCloudConfig("status_query_count"),s=this._userModule.getCloudConfig("status_sub_count"),e=this._userModule.getCloudConfig("status_unsub_count");h.l("".concat(this._n,"._onCloudConfigUpdated statusQueryCount:").concat(t," statusSubscribeCount:").concat(s)+" statusUnsubscribeCount:".concat(e)),S(t)||(this.MAX_QUERY_USER_COUNT=parseInt(t,10)),S(t)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(s,10)),S(t)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(e,10))}},{key:"onUserStatusUpdated",value:function(t){var s=t.dataList,e=this._userModule.getMyUserID(),n=this._userModule.getModule(X),o=s.map(function(a){var r=a.to,i=a.statusType,u=a.customStatus,l=Ao(u);return r===e&&n.setCustomStatus(l),{userID:r,statusType:i,customStatus:l}});this._userModule.emitOuterEvent(W.USER_STATUS_UPDATED,o)}},{key:"setSelfStatus",value:function(t){var s=this,e="".concat(this._n,".setSelfStatus");if(this._userModule.filterProfanity("customStatus",t)===!1)return T({code:k.PROFANITY_FOUND});var n=new L("setSelfStatus"),o=t.customStatus;return this._userModule.request({protocolName:lr,requestData:{customStatus:o}}).then(function(a){return n.setNetworkType(s._userModule.getNetworkType()).setMessage("customStatus:".concat(o)).end(),h.l("".concat(e," ok. customStatus:").concat(o)),s._userModule.getModule(X).setCustomStatus(o),x({userID:s._userModule.getMyUserID(),statusType:1,customStatus:o})}).catch(function(a){return s._userModule.probeNetwork().then(function(r){var i=N(r,2),u=i[0],l=i[1];n.setError(a,u,l).end()}),h.e("".concat(e," failed. error:"),a),T(a)})}},{key:"getUserStatus",value:function(t){var s=this,e="".concat(this._n,".getUserStatus"),n=t.userIDList,o=n===void 0?[]:n,a=this._userModule.getMyUserID(),r=B(o),i=void 0,u=r.indexOf(a);if(u>-1){r.splice(u,1);var l=this._userModule.getModule(X).getCustomStatus();i={userID:a,statusType:1,customStatus:l}}if(r.length===0)return Y({successUserList:[i],failureUserList:[]});if(!this._userModule.canIUse(ye.USER_STATUS))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});r.length>this.MAX_QUERY_USER_COUNT&&(h.w("".concat(e," ").concat(Kt(this.MAX_QUERY_USER_COUNT))),r=o.slice(0,this.MAX_QUERY_USER_COUNT));var d=new L("getUserStatus");return this._userModule.request({protocolName:dr,requestData:{userIDList:r}}).then(function(p){var g=p.data,_=g.successUserList,v=_===void 0?[]:_,M=g.failureUserList,y=M===void 0?[]:M,C=v.map(function(A){var O=A.userID,U=A.statusType,K=A.customStatus;return{userID:O,statusType:U,customStatus:Ao(K)}}),D=y.map(function(A){var O=A.userID,U=A.invalidUserID,K=A.errorCode,j=A.errorInfo;return{userID:R(U)?O:U,code:K,message:j}});S(i)||C.unshift(i);var E="userID count:".concat(o.length,", success count:").concat(C.length,", fail count:").concat(D.length);return d.setNetworkType(s._userModule.getNetworkType()).setMessage("".concat(E)).end(),h.l("".concat(e," ok. ").concat(E,".")),x({successUserList:C,failureUserList:D})}).catch(function(p){return s._userModule.probeNetwork().then(function(g){var _=N(g,2),v=_[0],M=_[1];d.setMessage("userID count:".concat(o.length)).setError(p,v,M).end()}),h.e("".concat(e," failed. error:"),p),T(p)})}},{key:"subscribeUserStatus",value:function(t){var s=this;if(!this._userModule.canIUse(ye.USER_STATUS))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".subscribeUserStatus"),n=t.userIDList,o=n===void 0?[]:n,a=B(o);a.length>this.MAX_SUBSCRIBE_USER_COUNT&&(h.w("".concat(e," ").concat(Kt(this.MAX_SUBSCRIBE_USER_COUNT))),a=o.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));var r=new L("subscribeUserStatus"),i="userID count:".concat(o.length);return h.l("".concat(e," ").concat(i)),this._userModule.request({protocolName:pr,requestData:{userIDList:a}}).then(function(u){var l=u.data.failureUserList,d=(l===void 0?[]:l).map(function(p){var g=p.userID,_=p.invalidUserID,v=p.errorCode,M=p.errorInfo;return{userID:R(_)?g:_,code:v,message:M}});return r.setNetworkType(s._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(d.length)).end(),h.l("".concat(e," ok. fail count:").concat(d.length,".")),x({failureUserList:d})}).catch(function(u){return s._userModule.probeNetwork().then(function(l){var d=N(l,2),p=d[0],g=d[1];r.setMessage("".concat(i)).setError(u,p,g).end()}),h.e("".concat(e," failed. error:"),u),T(u)})}},{key:"unsubscribeUserStatus",value:function(t){var s=this;if(!this._userModule.canIUse(ye.USER_STATUS))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var e="".concat(this._n,".unsubscribeUserStatus"),n=(t||{}).userIDList,o=n===void 0?[]:n,a=B(o);o.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(h.w("".concat(e," ").concat(Kt(this.MAX_UNSUBSCRIBE_USER_COUNT))),a=o.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));var r=new L("unsubscribeUserStatus"),i="userID count:".concat(o.length);h.l("".concat(e," ").concat(i));var u={userIDList:a};return a.length===0&&(u.userIDList=void 0,u.unsubscribeAll=1),this._userModule.request({protocolName:gr,requestData:u}).then(function(l){var d=l.data.failureUserList,p=(d===void 0?[]:d).map(function(g){var _=g.userID,v=g.invalidUserID,M=g.errorCode,y=g.errorInfo;return{userID:R(v)?_:v,code:M,message:y}});return r.setNetworkType(s._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(p.length)).end(),h.l("".concat(e," ok. fail count:").concat(p.length,".")),x({failureUserList:p})}).catch(function(l){return s._userModule.probeNetwork().then(function(d){var p=N(d,2),g=p[0],_=p[1];r.setMessage("".concat(i)).setError(l,g,_).end()}),h.e("".concat(e," failed. error:"),l),T(l)})}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),c}(),Ru=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="UserModule",n._profileHandler=new Eu($(n)),n._blacklistHandler=new Lu($(n)),n._userStatusHandler=new Au($(n)),n.getInnerEmitterInstance().on(ot,n.onContextUpdated,$(n)),n}return q(s,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var n=e.dataList;if(!R(n)){var o=[];n.forEach(function(r){r.blackListDelAccount&&o.push.apply(o,B(r.blackListDelAccount))}),o.length>0&&this._blacklistHandler.onAccountDeleted(o);var a=[];n.forEach(function(r){r.blackListAddAccount&&a.push.apply(a,B(r.blackListAddAccount))}),a.length>0&&this._blacklistHandler.onAccountAdded(a)}}},{key:"onConversationsProfileUpdated",value:function(e){this._profileHandler.onConversationsProfileUpdated(e)}},{key:"getMyAccount",value:function(){return this.getMyUserID()}},{key:"getMyProfile",value:function(){return this._profileHandler.getMyProfile()}},{key:"getStorageModule",value:function(){return this.getModule(Ke)}},{key:"filterProfanity",value:function(e,n){var o=this.getModule(mt);if(!o)return!0;var a=o.filterText(n[e],di),r=a.isAllowedToSend,i=a.modifiedText;return r===!0&&(n[e]=i,!0)}},{key:"isMyFriend",value:function(e){var n=this.getModule(ce);return!!n&&n.isMyFriend(e)}},{key:"getUserProfile",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:"getNickAndAvatarByUserID",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:"getLocalBlacklist",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return Y(e)}},{key:"addBlacklist",value:function(e){return this._blacklistHandler.addBlacklist(e)}},{key:"deleteBlacklist",value:function(e){return this._blacklistHandler.deleteBlacklist(e)}},{key:"onUserStatusUpdated",value:function(e){this._userStatusHandler.onUserStatusUpdated(e)}},{key:"setSelfStatus",value:function(e){return this._userStatusHandler.setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._userStatusHandler.getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._userStatusHandler.subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._userStatusHandler.unsubscribeUserStatus(e)}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),s}(le),Nu=function(){function c(t,s){F(this,c),this._m=t,this._isLoggedIn=!1,this._SDKAppID=s.SDKAppID,this._userID=s.userID||"",this._userSig=s.userSig||"",this._version="2.27.6",this._a2Key="",this._tinyID="",this._customStatus="",this._contentType="json",this._unlimitedAVChatRoom=s.unlimitedAVChatRoom,this._scene=s.scene||"",this._oversea=s.oversea,this._instanceID=s.instanceID,this._statusInstanceID=0,this._isDevMode=s.devMode,this._proxyServer=s.proxyServer,this._fileUploadProxy=s.fileUploadProxy,this._fileDownloadProxy=s.fileDownloadProxy}return q(c,[{key:"isLoggedIn",value:function(){return this._isLoggedIn}},{key:"isOversea",value:function(){return this._oversea}},{key:"isPrivateNetWork",value:function(){return this._proxyServer}},{key:"isDevMode",value:function(){return this._isDevMode}},{key:"isSingaporeSite",value:function(){return this._SDKAppID>=2e7&&this._SDKAppID<3e7||this._SDKAppID>=172e7&&this._SDKAppID<173e7}},{key:"isKoreaSite",value:function(){return this._SDKAppID>=3e7&&this._SDKAppID<4e7||this._SDKAppID>=173e7&&this._SDKAppID<174e7}},{key:"isGermanySite",value:function(){return this._SDKAppID>=4e7&&this._SDKAppID<5e7||this._SDKAppID>=174e7&&this._SDKAppID<175e7}},{key:"isIndiaSite",value:function(){return this._SDKAppID>=5e7&&this._SDKAppID<6e7||this._SDKAppID>=175e7&&this._SDKAppID<176e7}},{key:"isJapanSite",value:function(){return this._SDKAppID>=6e7&&this._SDKAppID<7e7||this._SDKAppID>=176e7&&this._SDKAppID<177e7}},{key:"isUSASite",value:function(){return this._SDKAppID>=7e7&&this._SDKAppID<8e7||this._SDKAppID>=177e7&&this._SDKAppID<178e7}},{key:"isIntl",value:function(){return(t=this._SDKAppID)===0||t>=2e7&&t<8e7||t>=172e7&&t<178e7;var t}},{key:"isUnlimitedAVChatRoom",value:function(){return this._unlimitedAVChatRoom}},{key:"setUserID",value:function(t){this._userID=t}},{key:"getUserID",value:function(){return this._userID}},{key:"setUserSig",value:function(t){this._userSig=t}},{key:"getUserSig",value:function(){return this._userSig}},{key:"getSDKAppID",value:function(){return this._SDKAppID}},{key:"setTinyID",value:function(t){this._tinyID=t,this._isLoggedIn=!0}},{key:"getTinyID",value:function(){return this._tinyID}},{key:"setCustomStatus",value:function(t){this._customStatus=t}},{key:"getCustomStatus",value:function(){return this._customStatus}},{key:"getScene",value:function(){return os?window.tencent_cloud_im_csig_flutter_for_web_25F_cy:this._isTUIKit()?"tuikit":this._scene}},{key:"getInstanceID",value:function(){return this._instanceID}},{key:"getStatusInstanceID",value:function(){return this._statusInstanceID}},{key:"setStatusInstanceID",value:function(t){this._statusInstanceID=t}},{key:"getVersion",value:function(){return this._version}},{key:"getA2Key",value:function(){return this._a2Key}},{key:"setA2Key",value:function(t){this._a2Key=t}},{key:"getContentType",value:function(){return this._contentType}},{key:"getProxyServer",value:function(){return this._proxyServer}},{key:"getFileUploadProxy",value:function(){return this._fileUploadProxy}},{key:"getFileDownloadProxy",value:function(){return this._fileDownloadProxy}},{key:"_isTUIKit",value:function(){var t=!1,s=!1,e=!1,n=!1,o=[];Z&&(o=Object.keys(Q)),ke&&(o=Object.keys(Zo?uni:window));for(var a=0,r=o.length;a<r;a++)if(o[a].toLowerCase().includes("uikit")){t=!0;break}if(o=null,Z&&!qe(Q.createGamePortal)&&qe(getApp)&&!S(getApp())){var i=getApp().globalData;ne(i)&&i.isTUIKit===!0&&(s=!0)}this._m.getModule(Ke).getStorageSync("TIM_".concat(this._SDKAppID,"_isTUIKit"))===!0&&(e=!0);var u=null;if(rt&&!qt&&typeof uni>"u"&&__wxConfig&&(u=__wxConfig.pages),yt&&typeof uni>"u"&&__qqConfig&&(u=__qqConfig.pages),b(u)&&u.length>0){for(var l=0,d=u.length;l<d;l++)if(u[l].toLowerCase().includes("tui")){n=!0;break}u=null}return t||s||e||n}},{key:"reset",value:function(){this._isLoggedIn=!1,this._userSig="",this._a2Key="",this._tinyID="",this._customStatus="",this._statusInstanceID=0}}]),c}(),Ou=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="SignModule",n._helloInterval=120,n._lastLoginTs=0,n._lastWsHelloTs=0,n._isWebUniapp=0,Eo.mixin($(n)),n}return q(s,[{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this._helloInterval==0&&this._hello()}},{key:"login",value:function(e){var n="";if(this.isLoggedIn()){var o=this.getMyUserID();return(n=this.getErrorMessage("RepeatLogin",o))&&h.w(n),Y({actionStatus:"OK",errorCode:0,errorInfo:n,repeatLogin:!0})}if(Date.now()-this._lastLoginTs<=15e3)return this.outputWarning("LoggingIn",e.userID),T({code:k.REPEAT_LOGIN});h.l("".concat(this._n,".login userID:").concat(e.userID));var a=this._checkLoginInfo(e);if(a.code!==0)return T(a);var r=this.getModule(X),i=e.userID,u=e.userSig;return r.setUserID(i),r.setUserSig(u),this.getModule(Fe).updateProtocolConfig(),this._login()}},{key:"_login",value:function(){var e=this,n=this.getModule(X),o=n.getScene(),a=0,r=new L("login");r.setMessage("".concat(o)).setMoreMessage("identifier:".concat(this.getMyUserID())),Zo?o==="tuikit"?r.setUIPlatform(4):r.setUIPlatform(3):Z?o==="tuikit"?r.setUIPlatform(12):r.setUIPlatform(11):ke&&(os?o==="flutter_web_uikit"?r.setUIPlatform(21):r.setUIPlatform(20):this._isReactUIKit()?ns?r.setUIPlatform(25):r.setUIPlatform(24):ns?o==="tuikit"?r.setUIPlatform(17):r.setUIPlatform(16):o==="tuikit"?r.setUIPlatform(14):r.setUIPlatform(13));var i=this.getModule(Qt);if(i.canIUseOfflinePush()){this._isWebUniapp=i.getUniAppPlatform();var u=this._getStatusInstanceID();n.setStatusInstanceID(u),this.getModule(Fe).updateProtocolConfig(),a=i.getDeviceBrand()}var l="".concat(this._n,"._login");return this._lastLoginTs=Date.now(),this.request({protocolName:In,requestData:{deviceBrand:a,isWebUniapp:this._isWebUniapp}}).then(function(d){e._lastLoginTs=0;var p=Date.now(),g=null,_=d.data,v=_.a2Key,M=_.tinyID,y=_.helloInterval,C=_.instanceID,D=_.timeStamp,E=_.customStatus,A=E===void 0?"":E,O=_.purchaseBits;h.l("".concat(l," ok. scene:").concat(o," helloInterval:").concat(y," instanceID:").concat(C," timeStamp:").concat(D));var U=1e3*D,K=p-r.getStartTs(),j=U+parseInt(K/2)-p,H=r.getStartTs()+j;if(r.start(H),function(De,he){xt=he;var Me=new Date;Me.setTime(De),h.i("baseTime from server:".concat(Me," offset:").concat(xt))}(U,j),!M)throw g=new oe({code:k.NO_TINYID}),r.setError(g,!0,e.getNetworkType()).end(),g;if(!v)throw g=new oe({code:k.NO_A2KEY}),r.setError(g,!0,e.getNetworkType()).end(),g;var J=Ao(A);r.setNetworkType(e.getNetworkType()).setMoreMessage("helloInterval:".concat(y," instanceID:").concat(C," offset:").concat(j," customStatus:").concat(J)).end(),n.setA2Key(v),n.setTinyID(M),n.setStatusInstanceID(C),n.setCustomStatus(J),O&&e.getModule(Zt).onPushedConfig({errorCode:0,expiredTime:0,purchaseBits:O}),e.getModule(Fe).updateProtocolConfig(),e.emitInnerEvent(ot),e._helloInterval=y,e.triggerReady();var de=e.getModule(Qt);return de.canIUseOfflinePush()&&(uni.setStorageSync("timUniAppInstanceID",C),de.init()),e._fetchCloudControlConfig(),e.getModule(mt).init(),d}).catch(function(d){return e.probeNetwork().then(function(p){var g=N(p,2),_=g[0],v=g[1];r.setError(d,_,v).end(!0)}),e._m.setNotReadyReason(k.LOGIN_FAILED),h.e("".concat(l," failed. error:"),d),e._lastLoginTs=0,e._m.onLoginFailed(),T(d)})}},{key:"logout",value:function(){var e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;if(!this.isLoggedIn())return T({code:k.USER_NOT_LOGGED_IN});var o=new L("logout");o.setNetworkType(this.getNetworkType()).setMessage("identifier:".concat(this.getMyUserID())).end(!0);var a="".concat(this._n,".logout");return h.i("".concat(a," type:").concat(n)),n===0&&this._m.setNotReadyReason(k.LOGGED_OUT),this.request({protocolName:bs,requestData:{type:n}}).then(function(){return e.resetReady(),Y({})}).catch(function(r){return h.e("".concat(a," error:"),r),e.resetReady(),Y({})})}},{key:"_fetchCloudControlConfig",value:function(){this.getModule(Jt).fetchConfig()}},{key:"_getStatusInstanceID",value:function(){return uni.getStorageSync("timUniAppInstanceID")}},{key:"_hello",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.request({protocolName:ws,requestData:{isWebUniapp:this._isWebUniapp}}).catch(function(n){h.w("".concat(e._n,"._hello error:"),n)})}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var n=0;return R(this.getModule(X).getSDKAppID())?n=k.NO_SDKAPPID:R(e.userID)?n=k.NO_IDENTIFIER:R(e.userSig)&&(n=k.NO_USERSIG),{code:n}}},{key:"_isReactUIKit",value:function(){return ke&&window.tencent_cloud_im_csig_react_uikit_23F_xa!==void 0}},{key:"onMultipleAccountKickedOut",value:function(e){var n=this;new L("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(f.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),h.w("".concat(this._n,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then(function(){n.emitOuterEvent(W.KICKED_OUT,{type:f.KICKED_OUT_MULT_ACCOUNT}),n._m.setNotReadyReason(k.KICKED_OUT_MULT_ACCOUNT),n._m.reset()})}},{key:"onMultipleDeviceKickedOut",value:function(e){var n=this;new L("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(f.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),h.w("".concat(this._n,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then(function(){n.emitOuterEvent(W.KICKED_OUT,{type:f.KICKED_OUT_MULT_DEVICE}),n._m.setNotReadyReason(k.KICKED_OUT_MULT_DEVICE),n._m.reset()})}},{key:"onUserSigExpired",value:function(){new L("kickedOut").setNetworkType(this.getNetworkType()).setMessage(f.KICKED_OUT_USERSIG_EXPIRED).end(!0),h.w("".concat(this._n,".onUserSigExpired: userSig expired")),this.getModule(X).getStatusInstanceID()!==0&&(this.emitOuterEvent(W.KICKED_OUT,{type:f.KICKED_OUT_USERSIG_EXPIRED}),this._m.setNotReadyReason(k.KICKED_OUT_USERSIG_EXPIRED),this._m.reset())}},{key:"onRestApiKickedOut",value:function(e){new L("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(f.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),h.w("".concat(this._n,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.getModule(X).getStatusInstanceID()!==0&&(this.emitOuterEvent(W.KICKED_OUT,{type:f.KICKED_OUT_REST_API}),this._m.setNotReadyReason(k.KICKED_OUT_REST_API),this._m.reset(),this.getModule(Xe).onRestApiKickedOut())}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}]),s}(le);function Ln(){return null}var Gu=function(){function c(t){F(this,c),this._m=t,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}return q(c,[{key:"_errorTolerantHandle",value:function(){Z||!S(window)&&this._canIUseCookies()||(this.getItem=Ln,this.setItem=Ln,this.removeItem=Ln,this.clear=Ln)}},{key:"onCheckTimer",value:function(t){if(t%20==0){if(this._storageQueue.size===0)return;this._doFlush()}}},{key:"_doFlush",value:function(){try{var t,s=Ee(this._storageQueue);try{for(s.s();!(t=s.n()).done;){var e=N(t.value,2),n=e[0],o=e[1];this._setStorageSync(this._getKey(n),o)}}catch(a){s.e(a)}finally{s.f()}this._storageQueue.clear()}catch(a){h.w("".concat(this._n,"._doFlush error:"),a)}}},{key:"_getPrefix",value:function(){var t=this._m.getModule(X);return"TIM_".concat(t.getSDKAppID(),"_").concat(t.getUserID(),"_")}},{key:"_getKey",value:function(t){return"".concat(this._getPrefix()).concat(t)}},{key:"getItem",value:function(t){var s=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];try{var e=s?this._getKey(t):t;return this.getStorageSync(e)}catch(n){return h.w("".concat(this._n,".getItem error:"),n),{}}}},{key:"setItem",value:function(t,s){var e=arguments.length>2&&arguments[2]!==void 0&&arguments[2],n=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3];if(e){var o=n?this._getKey(t):t;this._setStorageSync(o,s)}else this._storageQueue.set(t,s)}},{key:"clear",value:function(){try{Z?Q.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(t){h.w("".concat(this._n,".clear error:"),t)}}},{key:"removeItem",value:function(t){var s=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];try{var e=s?this._getKey(t):t;this._removeStorageSync(e)}catch(n){h.w("".concat(this._n,".removeItem error:"),n)}}},{key:"getSize",value:function(t){var s=this,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"b";try{var n={size:0,limitSize:5242880,unit:e};if(Object.defineProperty(n,"leftSize",{enumerable:!0,get:function(){return n.limitSize-n.size}}),Z&&(n.limitSize=1024*Q.getStorageInfoSync().limitSize),t)n.size=JSON.stringify(this.getItem(t)).length+this._getKey(t).length;else if(Z){var o=Q.getStorageInfoSync(),a=o.keys;a.forEach(function(i){n.size+=JSON.stringify(s.getStorageSync(i)).length+s._getKey(i).length})}else if(this._canIUseCookies())for(var r in localStorage)localStorage.hasOwnProperty(r)&&(n.size+=localStorage.getItem(r).length+r.length);return this._convertUnit(n)}catch(i){h.w("".concat(this._n," error:"),i)}}},{key:"_convertUnit",value:function(t){var s={},e=t.unit;for(var n in s.unit=e,t)typeof t[n]=="number"&&(e.toLowerCase()==="kb"?s[n]=Math.round(t[n]/1024):e.toLowerCase()==="mb"?s[n]=Math.round(t[n]/1024/1024):s[n]=t[n]);return s}},{key:"_setStorageSync",value:function(t,s){Z?Ye?my.setStorageSync({key:t,data:s}):Q.setStorageSync(t,s):this._canIUseCookies()&&localStorage.setItem(t,JSON.stringify(s))}},{key:"getStorageSync",value:function(t){return Z?Ye?my.getStorageSync({key:t}).data:Q.getStorageSync(t):this._canIUseCookies()?JSON.parse(localStorage.getItem(t)):{}}},{key:"_removeStorageSync",value:function(t){Z?Ye?my.removeStorageSync({key:t}):Q.removeStorageSync(t):this._canIUseCookies()&&localStorage.removeItem(t)}},{key:"_canIUseCookies",value:function(){return navigator&&navigator.cookieEnabled&&localStorage}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._doFlush()}}]),c}(),Uu=function(){function c(t){F(this,c),this._n="SSOLogBody",this._report=[]}return q(c,[{key:"pushIn",value:function(t){h.d("".concat(this._n,".pushIn"),this._report.length,t),this._report.push(t)}},{key:"backfill",value:function(t){var s;b(t)&&t.length!==0&&(h.d("".concat(this._n,".backfill"),this._report.length,t.length),(s=this._report).unshift.apply(s,B(t)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return this._report.length===0}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getLogsInMemory",value:function(){var t=this._report.slice();return this._reset(),t}}]),c}(),Nr=function(c){var t=c.getModule(X);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:c.getPlatform(),instanceID:t.getInstanceID(),traceID:ut()}},Pu=function(c){re(s,c);var t=ie(s);function s(e){var n;F(this,s),(n=t.call(this,e))._n="EventStatModule",n.TAG="im-ssolog-event",n._reportBody=new Uu,n.MIN_THRESHOLD=20,n.MAX_THRESHOLD=100,n.WAITING_TIME=6e4,n.REPORT_LEVEL=[4,5,6],n.REPORT_SDKAPPID_BLACKLIST=[],n.REPORT_TINYID_WHITELIST=[],n._lastReportTime=Date.now();var o=n.getInnerEmitterInstance();return o.on(ot,n._onLoginSuccess,$(n)),o.on(We,n._onCloudConfigUpdated,$(n)),n}return q(s,[{key:"reportAtOnce",value:function(){h.d("".concat(this._n,".reportAtOnce")),this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,n=this.getModule(Ke),o=n.getItem(this.TAG,!1);!R(o)&&qe(o.forEach)&&(h.l("".concat(this._n,"._onLoginSuccess get ssolog in storage, count:").concat(o.length)),o.forEach(function(a){e._reportBody.pushIn(a)}),n.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("evt_rpt_threshold"),n=this.getCloudConfig("evt_rpt_waiting"),o=this.getCloudConfig("evt_rpt_level"),a=this.getCloudConfig("evt_rpt_sdkappid_bl"),r=this.getCloudConfig("evt_rpt_tinyid_wl");S(e)||(this.MIN_THRESHOLD=Number(e)),S(n)||(this.WAITING_TIME=Number(n)),S(o)||(this.REPORT_LEVEL=o.split(",").map(function(i){return Number(i)})),S(a)||(this.REPORT_SDKAPPID_BLACKLIST=a.split(",").map(function(i){return Number(i)})),S(r)||(this.REPORT_TINYID_WHITELIST=r.split(","))}},{key:"pushIn",value:function(e){e instanceof L&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}},{key:"onCheckTimer",value:function(){Date.now()<this._lastReportTime+this.WAITING_TIME||this._reportBody.isEmpty()||this._report()}},{key:"_filterLogs",value:function(e){var n=this,o=this.getModule(X),a=o.getSDKAppID(),r=o.getTinyID();return Ts(this.REPORT_SDKAPPID_BLACKLIST,a)&&!Ds(this.REPORT_TINYID_WHITELIST,r)?[]:e.filter(function(i){return n.REPORT_LEVEL.includes(i.level)})}},{key:"_report",value:function(){var e=this;if(!this._reportBody.isEmpty()){var n=this._reportBody.getLogsInMemory(),o=this._filterLogs(n);if(o.length!==0){var a={header:Nr(this),event:o};this.request({protocolName:Dn,requestData:m({},a)}).then(function(){e._lastReportTime=Date.now()}).catch(function(r){h.w("".concat(e._n,".report failed. networkType:").concat(e.getNetworkType()," error:"),r),e._reportBody.backfill(n),e._reportBody.getLogsNumInMemory()>e.MAX_THRESHOLD&&e._flushAtOnce()})}else this._lastReportTime=Date.now()}}},{key:"_flushAtOnce",value:function(){var e=this.getModule(Ke),n=e.getItem(this.TAG,!1),o=this._reportBody.getLogsInMemory(),a="".concat(this._n,"._flushAtOnce");if(R(n))h.l("".concat(a," count:").concat(o.length)),e.setItem(this.TAG,o,!0,!1);else{var r=o.concat(n);r.length>this.MAX_THRESHOLD&&(r=r.slice(0,this.MAX_THRESHOLD)),h.l("".concat(a," count:").concat(r.length)),e.setItem(this.TAG,r,!0,!1)}}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),s}(le),tn="none",Ro="online",bu=[k.OVER_FREQUENCY_LIMIT,k.OPEN_SERVICE_OVERLOAD_ERROR],wu=function(){function c(t){F(this,c),this._m=t,this._networkType="",this._n="NetMonitorModule",this.MAX_WAIT_TIME=3e3,this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null}return q(c,[{key:"start",value:function(){var t=this;Z?(Q.getNetworkType({success:function(s){t._networkType=s.networkType||s.subtype||"",s.networkType===tn?h.w("".concat(t._n,".start no network, please check!")):h.i("".concat(t._n,".start networkType:").concat(s.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),Q.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=Ro,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window&&(window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback)))}},{key:"_onWebOnline",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:Ro})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:tn})}},{key:"_onNetworkStatusChange",value:function(t){var s=t.isConnected,e=t.networkType,n="".concat(this._n,"._onNetworkStatusChange"),o=!1;s?(h.i("".concat(n," previous:").concat(this._networkType," current:").concat(e)),this._networkType!==e&&(o=!0,this._m.getModule(Xe).reConnect(!0))):this._networkType!==e&&(o=!0,h.w("".concat(n," no network, please check!")),this._m.getModule(Xe).offline()),o&&(new L("networkChange").setMessage("isConnected:".concat(s," previousNetworkType:").concat(this._networkType," networkType:").concat(e)).end(),this._networkType=e)}},{key:"probe",value:function(t){var s=this;if(!S(t)&&bu.includes(t.code))return Promise.resolve([!0,this._networkType]);var e="".concat(this._n,".probe");return new Promise(function(n,o){Z?Q.getNetworkType({success:function(a){s._networkType=a.networkType,a.networkType===tn?(h.w("".concat(e," no network, please check!")),n([!1,a.networkType])):(h.i("".concat(e," networkType:").concat(a.networkType)),n([!0,a.networkType]))}}):s._networkType===tn?n([!1,tn]):n([!0,Ro])})}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),Z?this._mpNetworkStatusCallback!==null&&(Q.offNetworkStatusChange&&(je||qt?Q.offNetworkStatusChange(this._mpNetworkStatusCallback):Q.offNetworkStatusChange()),this._mpNetworkStatusCallback=null):window&&(this._webOnlineCallback!==null&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),this._onWebOffline!==null&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null))}}]),c}();function Or(c,t){return c(t={exports:{}},t.exports),t.exports}var Gr=Or(function(c){var t=Object.prototype.hasOwnProperty,s="~";function e(){}function n(i,u,l){this.fn=i,this.context=u,this.once=l||!1}function o(i,u,l,d,p){if(typeof l!="function")throw new TypeError("The listener must be a function");var g=new n(l,d||i,p),_=s?s+u:u;return i._events[_]?i._events[_].fn?i._events[_]=[i._events[_],g]:i._events[_].push(g):(i._events[_]=g,i._eventsCount++),i}function a(i,u){--i._eventsCount==0?i._events=new e:delete i._events[u]}function r(){this._events=new e,this._eventsCount=0}Object.create&&(e.prototype=Object.create(null),new e().__proto__||(s=!1)),r.prototype.eventNames=function(){var i,u,l=[];if(this._eventsCount===0)return l;for(u in i=this._events)t.call(i,u)&&l.push(s?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(i)):l},r.prototype.listeners=function(i){var u=s?s+i:i,l=this._events[u];if(!l)return[];if(l.fn)return[l.fn];for(var d=0,p=l.length,g=new Array(p);d<p;d++)g[d]=l[d].fn;return g},r.prototype.listenerCount=function(i){var u=s?s+i:i,l=this._events[u];return l?l.fn?1:l.length:0},r.prototype.emit=function(i,u,l,d,p,g){var _=s?s+i:i;if(!this._events[_])return!1;var v,M,y=this._events[_],C=arguments.length;if(y.fn){switch(y.once&&this.removeListener(i,y.fn,void 0,!0),C){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,u),!0;case 3:return y.fn.call(y.context,u,l),!0;case 4:return y.fn.call(y.context,u,l,d),!0;case 5:return y.fn.call(y.context,u,l,d,p),!0;case 6:return y.fn.call(y.context,u,l,d,p,g),!0}for(M=1,v=new Array(C-1);M<C;M++)v[M-1]=arguments[M];y.fn.apply(y.context,v)}else{var D,E=y.length;for(M=0;M<E;M++)switch(y[M].once&&this.removeListener(i,y[M].fn,void 0,!0),C){case 1:y[M].fn.call(y[M].context);break;case 2:y[M].fn.call(y[M].context,u);break;case 3:y[M].fn.call(y[M].context,u,l);break;case 4:y[M].fn.call(y[M].context,u,l,d);break;default:if(!v)for(D=1,v=new Array(C-1);D<C;D++)v[D-1]=arguments[D];y[M].fn.apply(y[M].context,v)}}return!0},r.prototype.on=function(i,u,l){return o(this,i,u,l,!1)},r.prototype.once=function(i,u,l){return o(this,i,u,l,!0)},r.prototype.removeListener=function(i,u,l,d){var p=s?s+i:i;if(!this._events[p])return this;if(!u)return a(this,p),this;var g=this._events[p];if(g.fn)g.fn!==u||d&&!g.once||l&&g.context!==l||a(this,p);else{for(var _=0,v=[],M=g.length;_<M;_++)(g[_].fn!==u||d&&!g[_].once||l&&g[_].context!==l)&&v.push(g[_]);v.length?this._events[p]=v.length===1?v[0]:v:a(this,p)}return this},r.prototype.removeAllListeners=function(i){var u;return i?(u=s?s+i:i,this._events[u]&&a(this,u)):(this._events=new e,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prefixed=s,r.EventEmitter=r,c.exports=r}),Fu=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="BigDataChannelModule",n.FILETYPE={SOUND:2106,FILE:2107,VIDEO:2113},n._bdh_download_server="grouptalk.c2c.qq.com",n._BDHBizID=10001,n._authKey="",n._expireTime=0,n.getInnerEmitterInstance().on(ot,n._getAuthKey,$(n)),n}return q(s,[{key:"_getAuthKey",value:function(){var e=this;this.isIntl()||this.request({protocolName:qs}).then(function(n){n.data.authKey&&(e._authKey=n.data.authKey,e._expireTime=parseInt(n.data.expireTime))})}},{key:"_isFromOlderVersion",value:function(e){return!(!e.content||e.content.downloadFlag===2)}},{key:"parseElements",value:function(e,n){if(!b(e)||!n)return[];for(var o=[],a=null,r=0;r<e.length;r++)a=e[r],this._needParse(a)?o.push(this._parseElement(a,n)):o.push(e[r]);return o}},{key:"_needParse",value:function(e){return!e.cloudCustomData&&!(!this._isFromOlderVersion(e)||e.type!==f.MSG_AUDIO&&e.type!==f.MSG_FILE&&e.type!==f.MSG_VIDEO)}},{key:"_parseElement",value:function(e,n){switch(e.type){case f.MSG_AUDIO:return this._parseAudioElement(e,n);case f.MSG_FILE:return this._parseFileElement(e,n);case f.MSG_VIDEO:return this._parseVideoElement(e,n)}}},{key:"_parseAudioElement",value:function(e,n){return e.content.url=this._genAudioUrl(e.content.uuid,n),e}},{key:"_parseFileElement",value:function(e,n){return e.content.url=this._genFileUrl(e.content.uuid,n,e.content.fileName),e}},{key:"_parseVideoElement",value:function(e,n){return e.content.url=this._genVideoUrl(e.content.uuid,n),e}},{key:"_genAudioUrl",value:function(e,n){if(this._authKey==="")return"";var o=this.getModule(X).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(o,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.SOUND,"&openid=").concat(n,"&ver=0")}},{key:"_genFileUrl",value:function(e,n,o){if(this._authKey==="")return"";o||(o="".concat(Math.floor(1e5*Math.random()),"-").concat(Date.now()));var a=this.getModule(X).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(a,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.FILE,"&openid=").concat(n,"&ver=0&filename=").concat(encodeURIComponent(o))}},{key:"_genVideoUrl",value:function(e,n){if(this._authKey==="")return"";var o=this.getModule(X).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(o,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.VIDEO,"&openid=").concat(n,"&ver=0")}},{key:"reset",value:function(){this._authKey="",this.expireTime=0}}]),s}(le),qu=["requestSnapshotUrl"],xu=function(c){re(s,c);var t=ie(s);function s(e){var n;F(this,s),(n=t.call(this,e))._n="UploadModule",n.TIMUploadPlugin=null,n.timUploadPlugin=null,n.COSSDK=null,n._cosUploadMethod=null,n.expiredTimeLimit=600,n.appid=0,n.bucketName="",n.ciUrl="",n.directory="",n.downloadUrl="",n.uploadUrl="",n.region="ap-shanghai",n.cos=null,n.cosOptions={secretId:"",secretKey:"",sessionToken:"",expiredTime:0},n.uploadFileType="",n.duration=900,n.tryCount=0,n.UPLOAD_SIZE_LIMIT={AUDIO:20971520,FILE:104857600,IMAGE:20971520,VIDEO:104857600};var o=n.getInnerEmitterInstance();return o.on(ot,n._init,$(n)),o.on(We,n._onCloudConfigUpdated,$(n)),n}return q(s,[{key:"_init",value:function(){var e=this.getModule(yn);if(this.TIMUploadPlugin=e.getPlugin("tim-upload-plugin"),this.TIMUploadPlugin)this._initUploaderMethod();else{var n=Z?"cos-wx-sdk":"cos-js-sdk";this.COSSDK=e.getPlugin(n),this.COSSDK?(this._getAuthorizationKey(),this.outputWarning("CosReplacement",n)):this.outputWarning("PluginUndetected")}}},{key:"_onCloudConfigUpdated",value:function(){var e="".concat(this._n,"._onCloudConfigUpdated"),n=this.getCloudConfig("upload_size_limit");if(h.l("".concat(e," uploadSizeLimit:").concat(n)),!S(n))try{var o=JSON.parse(n);this.UPLOAD_SIZE_LIMIT={AUDIO:o.a?1048576*parseInt(o.a):this.UPLOAD_SIZE_LIMIT.AUDIO,FILE:o.f?1048576*parseInt(o.f):this.UPLOAD_SIZE_LIMIT.FILE,IMAGE:o.i?1048576*parseInt(o.i):this.UPLOAD_SIZE_LIMIT.IMAGE,VIDEO:o.v?1048576*parseInt(o.v):this.UPLOAD_SIZE_LIMIT.VIDEO}}catch{h.e("".concat(e," JSON parse error. uploadSizeLimit:"),n)}}},{key:"_getAuthorizationKey",value:function(){var e=this,n="".concat(this._n,".").concat("_getAuthorizationKey"),o=new L("_getAuthorizationKey"),a=Math.ceil(Date.now()/1e3);this.request({protocolName:$a,requestData:{duration:this.expiredTimeLimit}}).then(function(r){var i=r.data;h.l("".concat(n," ok. data:"),i);var u=i.expiredTime-a;o.setMessage("requestId:".concat(i.requestId," requestTime:").concat(a," expiredTime:").concat(i.expiredTime," diff:").concat(u,"s")).setNetworkType(e.getNetworkType()).end(),!Z&&i.region&&(e.region=i.region),e.appid=i.appid,e.bucketName=i.bucketName,e.ciUrl=i.ciUrl,e.directory=i.directory,e.downloadUrl=i.downloadUrl,e.uploadUrl=i.uploadUrl,e.cosOptions={secretId:i.secretId,secretKey:i.secretKey,sessionToken:i.sessionToken,expiredTime:i.expiredTime},h.l("".concat(n," ok. region:").concat(e.region," bucketName:").concat(e.bucketName)),e._initUploaderMethod()}).catch(function(r){e.probeNetwork().then(function(i){var u=N(i,2),l=u[0],d=u[1];o.setError(r,l,d).end()}),h.w("".concat(n," failed. error:"),r)})}},{key:"_getCosPreSigUrl",value:function(e){var n=this,o="".concat(this._n,".").concat("_getCosPreSigUrl"),a=Math.ceil(Date.now()/1e3),r=new L("_getCosPreSigUrl");return this.request({protocolName:er,requestData:{fileType:e.fileType,fileName:e.fileName,uploadMethod:e.uploadMethod,duration:e.duration}}).then(function(i){n.tryCount=0;var u=i.data||{},l=u.expiredTime-a;return h.l("".concat(o," ok. data:"),u),r.setMessage("requestId:".concat(u.requestId," expiredTime:").concat(u.expiredTime," diff:").concat(l,"s")).setNetworkType(n.getNetworkType()).end(),u}).catch(function(i){return i.code===-1&&(i.code=k.COS_GET_SIG_FAIL),n.probeNetwork().then(function(u){var l=N(u,2),d=l[0],p=l[1];r.setError(i,d,p).end()}),h.w("".concat(o," failed. error:"),i),n.tryCount<1?(n.tryCount++,n._getCosPreSigUrl(e)):(n.tryCount=0,T({code:k.COS_GET_SIG_FAIL}))})}},{key:"_initUploaderMethod",value:function(){var e=this;if(this.TIMUploadPlugin)return this.timUploadPlugin=new this.TIMUploadPlugin,void(this._cosUploadMethod=function(n,o){e.timUploadPlugin.uploadFile(n,o)});this.appid&&(this.cos=Z?new this.COSSDK({ForcePathStyle:!0,getAuthorization:this._getAuthorization.bind(this)}):new this.COSSDK({getAuthorization:this._getAuthorization.bind(this)}),this._cosUploadMethod=Z?function(n,o){e.cos.postObject(n,o)}:function(n,o){e.cos.uploadFiles(n,o)})}},{key:"onCheckTimer",value:function(e){this.COSSDK&&(this.TIMUploadPlugin||this.isLoggedIn()&&e%60==0&&Math.ceil(Date.now()/1e3)>=this.cosOptions.expiredTime-120&&this._getAuthorizationKey())}},{key:"_getAuthorization",value:function(e,n){n({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}},{key:"upload",value:function(e){if(e.getRelayFlag()===!0)return Promise.resolve();var n=this.getModule(Re);switch(e.type){case f.MSG_IMAGE:return n.addTotalCount(be),this._uploadImage(e);case f.MSG_FILE:return n.addTotalCount(be),this._uploadFile(e);case f.MSG_AUDIO:return n.addTotalCount(be),this._uploadAudio(e);case f.MSG_VIDEO:return n.addTotalCount(be),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var n=this,o=this.getModule(ue),a=e.getElements()[0],r=o.getMessageOption(e.clientSequence);return this.doUploadImage({file:r.payload.file,to:r.to,onProgress:function(i){if(a.updatePercent(i),qe(r.onProgress))try{r.onProgress(i)}catch{return T({code:k.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then(function(i){var u,l,d=i.location,p=i.fileType,g=i.fileSize,_=i.width,v=i.height,M=i.smallImageUrl,y=i.smallImageWidth,C=i.smallImageHeight,D=i.largeImageUrl,E=i.largeImageWidth,A=i.largeImageHeight,O=n.isPrivateNetWork()?d:gn(d);return a.updateImageFormat(p),M&&D?(u={url:M,width:y,height:C},l={url:D,width:E,height:A}):(u=Yn({originUrl:O,originWidth:_,originHeight:v,min:198}),l=Yn({originUrl:O,originWidth:_,originHeight:v,min:720})),a.updateImageInfoArray([{size:g,url:O,width:_,height:v},m({},l),m({},u)]),e})}},{key:"_uploadFile",value:function(e){var n=this,o=this.getModule(ue),a=e.getElements()[0],r=o.getMessageOption(e.clientSequence);return this.doUploadFile({file:r.payload.file,to:r.to,onProgress:function(i){if(a.updatePercent(i),qe(r.onProgress))try{r.onProgress(i)}catch{return T({code:k.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then(function(i){var u=i.location,l=n.isPrivateNetWork()?u:gn(u);return a.updateFileUrl(l),e})}},{key:"_uploadAudio",value:function(e){var n=this,o=this.getModule(ue),a=e.getElements()[0],r=o.getMessageOption(e.clientSequence);return this.doUploadAudio({file:r.payload.file,to:r.to,onProgress:function(i){if(a.updatePercent(i),qe(r.onProgress))try{r.onProgress(i)}catch{return T({code:k.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then(function(i){var u=i.location,l=n.isPrivateNetWork()?u:gn(u);return a.updateAudioUrl(l),e})}},{key:"_uploadVideo",value:function(e){var n=this,o=this.getModule(ue),a=e.getElements()[0],r=o.getMessageOption(e.clientSequence);return this.doUploadVideo({file:r.payload.file,to:r.to,onProgress:function(i){if(a.updatePercent(i),qe(r.onProgress))try{r.onProgress(i)}catch{return T({code:k.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then(function(i){var u=i.location,l=i.snapshotInfo,d=n.isPrivateNetWork()?u:gn(u);return a.updateVideoUrl(d),R(l)||a.updateSnapshotInfo(l),e})}},{key:"_checkSizeError",value:function(e){return T({code:k["MESSAGE_".concat(e,"_SIZE_LIMIT")],message:this.getErrorMessage("UploadSizeLimit",e.toLowerCase(),"".concat(this.UPLOAD_SIZE_LIMIT[e]/1048576," MB"))})}},{key:"doUploadImage",value:function(e){var n=this;if(!e.file)return T({code:k.MESSAGE_IMAGE_SELECT_FILE_FIRST});var o=this._checkImageType(e.file);if(o!==!0)return o;var a=this._checkImageSize(e.file);if(a!==!0)return a;var r=null;return this._setUploadFileType(Qi),this.uploadByCOS(e).then(function(i){return r=i,n.isPrivateNetWork()?Bt(i.location):Bt("https://".concat(i.location))}).then(function(i){return r.width=i.width,r.height=i.height,Promise.resolve(r)})}},{key:"_checkImageType",value:function(e){var n="";return n=Z?e.url.slice(e.url.lastIndexOf(".")+1):e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1),Xi.indexOf(n.toLowerCase())>=0||T({code:k.MESSAGE_IMAGE_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){var n=0;return(n=Z?e.size:e.files[0].size)===0?T({code:k.MESSAGE_FILE_IS_EMPTY}):n<this.UPLOAD_SIZE_LIMIT.IMAGE||this._checkSizeError("IMAGE")}},{key:"doUploadFile",value:function(e){return e.file?e.file.files[0].size>this.UPLOAD_SIZE_LIMIT.FILE?this._checkSizeError("FILE"):e.file.files[0].size===0?T({code:k.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(tu),this.uploadByCOS(e)):T({code:k.MESSAGE_FILE_SELECT_FILE_FIRST})}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.VIDEO?this._checkSizeError("VIDEO"):e.file.videoFile.size===0?T({code:k.MESSAGE_FILE_IS_EMPTY}):Zi.indexOf(e.file.videoFile.type)===-1?T({code:k.MESSAGE_VIDEO_TYPES_LIMIT}):(this._setUploadFileType($i),Z?this.handleVideoUpload({file:e.file.videoFile,onProgress:e.onProgress}):ke?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var n=this;return new Promise(function(o,a){n.uploadByCOS(e).then(function(r){o(r)}).catch(function(){n.uploadByCOS(e).then(function(r){o(r)}).catch(function(){a(new oe({code:k.MESSAGE_VIDEO_UPLOAD_FAIL}))})})})}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.AUDIO?this._checkSizeError("AUDIO"):e.file.size===0?T({code:k.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(eu),this.uploadByCOS(e)):T({code:k.MESSAGE_AUDIO_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(e){var n=this;if(!qe(this._cosUploadMethod))return this.outputWarning("PluginUndetected"),T({code:k.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var o=new L("upload"),a="".concat(this._n,".uploadByCOS"),r=Date.now(),i=this._getFile(e);return new Promise(function(u,l){var d=Z?n._createCosOptionsWXMiniApp(e):n._createCosOptionsWeb(e),p=n;n._cosUploadMethod(d,function(g,_){var v=Object.create(null);if(_){if(g||b(_.files)&&_.files[0].error){var M=new oe({code:k.MESSAGE_FILE_UPLOAD_FAIL});return o.setError(M,!0,n.getNetworkType()).end(),h.l("".concat(a," failed. error:"),_.files[0].error),_.files[0].error.statusCode===403&&(h.w("".concat(a," failed. cos AccessKeyId was invalid, regain auth key!")),n._getAuthorizationKey()),void l(M)}v.fileName=i.name,v.fileSize=i.size,v.fileType=i.type.slice(i.type.indexOf("/")+1).toLowerCase(),v.location=Z?_.Location:_.files[0].data.Location;var y=Date.now()-r,C=p._formatFileSize(i.size),D=p._formatSpeed(1e3*i.size/y),E="size:".concat(C," time:").concat(y,"ms speed:").concat(D);h.l("".concat(a," success. name:").concat(i.name," ").concat(E)),u(v);var A=n.getModule(Re);return A.addCost(be,y),A.addFileSize(be,i.size),void o.setNetworkType(n.getNetworkType()).setMessage(E).end()}var O=new oe({code:k.MESSAGE_FILE_UPLOAD_FAIL});o.setError(O,!0,p.getNetworkType()).end(),h.w("".concat(a," failed. error:"),g),g.statusCode===403&&(h.w("".concat(a," failed. cos AccessKeyId was invalid, regain auth key!")),n._getAuthorizationKey()),l(O)})})}},{key:"_uploadWithPreSigUrl",value:function(e){var n=this,o="".concat(this._n,"._uploadWithPreSigUrl"),a=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then(function(r){return new Promise(function(i,u){var l=new L("upload"),d=r.requestSnapshotUrl,p=d===void 0?void 0:d,g=ft(r,qu),_=Date.now();n._cosUploadMethod(g,function(v,M){if(v||M.statusCode===403)return l.setError(new oe(v),!0,n.getNetworkType()).end(),h.l("".concat(o," failed, error:"),v),void u(new oe({code:k.MESSAGE_FILE_UPLOAD_FAIL}));var y=Object.create(null),C=M.data.location||"";n.isPrivateNetWork()||C.indexOf("https://")!==0&&C.indexOf("http://")!==0||(C=C.split("//")[1]),y.fileName=a.name,y.fileSize=a.size,y.fileType=a.type.slice(a.type.indexOf("/")+1).toLowerCase(),y.location=C;var D=Date.now()-_,E=n._formatFileSize(a.size),A=n._formatSpeed(1e3*a.size/D),O="size:".concat(E,",time:").concat(D,"ms,speed:").concat(A," res:").concat(JSON.stringify(M.data));h.l("".concat(o," success name:").concat(a.name,",").concat(O)),l.setNetworkType(n.getNetworkType()).setMessage(O).end();var U=n.getModule(Re);U.addCost(be,D),U.addFileSize(be,a.size);var K=[];if(g.thumbUrl&&g.largeUrl&&(K=[n._getSmallImageInfoByUrl(g.thumbUrl,y),n._getLargeImageInfoByUrl(g.largeUrl,y)]),p&&K.push(n._getSnapshotInfoByUrl(p,y)),K.length>0)return Promise.all(K).then(function(){i(y)});i(y)})})})}},{key:"_getRawOrUploadProxyUrl",value:function(e){var n=this.getModule(X).getFileUploadProxy(),o=e;return n&&(o=e.replace(/^https:\/\/[^/]+/,n)),o}},{key:"_getFile",value:function(e){var n;return b(e.file.files)||(n=e.file.files,Lt(n)==="filelist")?e.file.files[0]:e.file}},{key:"_formatFileSize",value:function(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}},{key:"_formatSpeed",value:function(e){return e<=1048576?et(e/1024,1)+"KB/s":et(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var n=this._getFile(e),o=n.name,a=o.slice(o.lastIndexOf(".")),r=this._genFileName("".concat(He(999999)).concat(a));return{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(r),Body:n}],SliceSize:1048576,onProgress:function(i){if(typeof e.onProgress=="function")try{e.onProgress(i.percent)}catch(u){h.w("onProgress callback error:",u)}},onFileFinish:function(i,u,l){}}}},{key:"_createCosOptionsWXMiniApp",value:function(e){var n=this._getFile(e),o=this._genFileName(n.name),a=n.url;return{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(o),FilePath:a,onProgress:function(r){if(h.l(JSON.stringify(r)),typeof e.onProgress=="function")try{e.onProgress(r.percent)}catch(i){h.w("onProgress callback error:",i)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var n=this,o="",a="",r=0,i=this._getFile(e);if(Z)o=this._genFileName(i.name),a=i.url,r=1;else{var u=i.name,l=u.slice(u.lastIndexOf("."));o=this._genFileName("".concat(He(999999)).concat(l)),a=i,r=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:o,uploadMethod:r,duration:this.duration}).then(function(d){var p=d.uploadUrl,g=d.downloadUrl,_=d.requestSnapshotUrl,v=_===void 0?void 0:_,M=d.thumbUrl,y=d.largeUrl;return{url:n._getRawOrUploadProxyUrl(p),fileType:n.uploadFileType,fileName:o,resources:a,downloadUrl:g,requestSnapshotUrl:v,thumbUrl:M,largeUrl:y,onProgress:function(C){if(typeof e.onProgress=="function")try{e.onProgress(C.percent)}catch(D){h.w("onProgress callback error:",D),h.e(D)}}}})}},{key:"_genFileName",value:function(e){return"".concat(Ms(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e,n){var o=this,a=new L("getSnapshotInfo");return this.request({protocolName:tr,requestData:{platform:this.getPlatform(),coverName:this._genFileName(He(99999)),requestSnapshotUrl:e}}).then(function(r){var i=(r.data||{}).snapshotUrl;return a.setMessage("snapshotUrl:".concat(i)).end(),R(i)?{}:Bt(i).then(function(u){n.snapshotInfo={snapshotUrl:i,snapshotWidth:u.width,snapshotHeight:u.height}})}).catch(function(r){return h.w("".concat(o._n,"._getSnapshotInfoByUrl failed. error:"),r),a.setCode(r.errorCode).setMessage(r.errorInfo).end(),{}})}},{key:"_getSmallImageInfoByUrl",value:function(e,n){return Bt(e).then(function(o){n.smallImageUrl=e,n.smallImageWidth=o.width,n.smallImageHeight=o.height})}},{key:"_getLargeImageInfoByUrl",value:function(e,n){return Bt(e).then(function(o){n.largeImageUrl=e,n.largeImageWidth=o.width,n.largeImageHeight=o.height})}},{key:"reset",value:function(){h.l("".concat(this._n,".reset"))}}]),s}(le),Vu=["downloadKey","pbDownloadKey","messageList"],Bu=function(){function c(t){F(this,c),this._n="MergerMessageHandler",this._messageModule=t}return q(c,[{key:"uploadMergerMessage",value:function(t,s){var e=this,n="".concat(this._n,".").concat("uploadMergerMessage");h.d("".concat(n," message:"),t,"messageBytes:".concat(s));var o=t.payload.messageList,a=o.length,r=new L("uploadMergerMessage");return this._messageModule.request({protocolName:nr,requestData:{messageList:o}}).then(function(i){h.d("".concat(n," ok. response:"),i.data);var u=i.data,l=u.pbDownloadKey,d=u.downloadKey,p={pbDownloadKey:l,downloadKey:d,messageNumber:a};return r.setNetworkType(e._messageModule.getNetworkType()).setMessage("".concat(a,"-").concat(s,"-").concat(d)).end(),p}).catch(function(i){throw h.w("".concat(n," failed. error:"),i),e._messageModule.probeNetwork().then(function(u){var l=N(u,2),d=l[0],p=l[1];r.setError(i,d,p).end()}),i})}},{key:"downloadMergerMessage",value:function(t){var s=this,e="".concat(this._n,".").concat("downloadMergerMessage");h.d("".concat(e," message:"),t);var n=t.payload.downloadKey,o=this._messageModule.getFileDownloadProxy(),a=new L("downloadMergerMessage");return a.setMessage("downloadKey:".concat(n)),this._messageModule.request({protocolName:or,requestData:{downloadKey:n}}).then(function(r){if(h.d("".concat(e," ok. response:"),r.data),qe(t.clearElement)){var i=t.payload;i.downloadKey,i.pbDownloadKey,i.messageList;var u=ft(i,Vu);t.clearElement(),t.setElement({type:t.type,content:m({messageList:r.data.messageList},u)},o)}else{var l=[];r.data.messageList.forEach(function(d){if(!R(d)){var p=new Cr(d,o);l.push(p)}}),t.payload.messageList=l,t.payload.downloadKey="",t.payload.pbDownloadKey=""}return a.setNetworkType(s._messageModule.getNetworkType()).end(),t}).catch(function(r){throw h.w("".concat(e," failed. key:").concat(n," error:"),r),s._messageModule.probeNetwork().then(function(i){var u=N(i,2),l=u[0],d=u[1];a.setError(r,l,d).end()}),r})}},{key:"createMergerMessagePack",value:function(t,s,e){return t.conversationType===f.CONV_C2C?this._createC2CMergerMessagePack(t,s,e):this._createGroupMergerMessagePack(t,s,e)}},{key:"_createC2CMergerMessagePack",value:function(t,s,e){var n=null;s&&(s.offlinePushInfo&&(n=s.offlinePushInfo),s.onlineUserOnly===!0&&(n?n.disablePush=!0:n={disablePush:!0}));var o=[];if(ne(s)&&ne(s.messageControlInfo)){var a=s.messageControlInfo,r=a.excludedFromUnreadCount,i=a.excludedFromLastMessage,u=a.excludedFromContentModeration;r===!0&&o.push("NoUnread"),i===!0&&o.push("NoLastMsg"),u===!0&&o.push("NoMsgCheck")}var l="";z(t.cloudCustomData)&&t.cloudCustomData.length>0&&(l=t.cloudCustomData);var d=e.pbDownloadKey,p=e.downloadKey,g=e.messageNumber,_=t.payload,v=_.title,M=_.abstractList,y=_.compatibleText,C=this._messageModule.getModule(fe),D=C&&C.isOnlineMessage(t,s)?0:void 0;return{protocolName:ao,tjgID:this._messageModule.generateTjgID(t),requestData:{fromAccount:this._messageModule.getMyUserID(),toAccount:t.to,msgBody:[{msgType:t.type,msgContent:{pbDownloadKey:d,downloadKey:p,title:v,abstractList:M,compatibleText:y,messageNumber:g}}],cloudCustomData:l,clientTime:t.clientTime,msgSeq:t.sequence,msgRandom:t.random,msgLifeTime:D,offlinePushInfo:n?{pushFlag:n.disablePush===!0?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:n.ignoreIOSBadge===!0?1:0},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:D!==0?o:void 0,isSupportExtension:t.isSupportExtension===!0?1:0}}}},{key:"_createGroupMergerMessagePack",value:function(t,s,e){var n=null;s&&s.offlinePushInfo&&(n=s.offlinePushInfo);var o=[];if(ne(s)&&ne(s.messageControlInfo)){var a=s.messageControlInfo,r=a.excludedFromUnreadCount,i=a.excludedFromLastMessage,u=a.excludedFromContentModeration;r===!0&&o.push("NoUnread"),i===!0&&o.push("NoLastMsg"),u===!0&&o.push("NoMsgCheck")}var l="";z(t.cloudCustomData)&&t.cloudCustomData.length>0&&(l=t.cloudCustomData);var d=e.pbDownloadKey,p=e.downloadKey,g=e.messageNumber,_=t.payload,v=_.title,M=_.abstractList,y=_.compatibleText,C=this._messageModule.getModule(V),D=C&&C.isOnlineMessage(t,s)?1:0;return{protocolName:ro,tjgID:this._messageModule.generateTjgID(t),requestData:{fromAccount:this._messageModule.getMyUserID(),groupID:t.to,msgBody:[{msgType:t.type,msgContent:{pbDownloadKey:d,downloadKey:p,title:v,abstractList:M,compatibleText:y,messageNumber:g}}],random:t.random,priority:t.priority,clientSequence:t.clientSequence,groupAtInfo:void 0,cloudCustomData:l,onlineOnlyFlag:D,offlinePushInfo:n?{pushFlag:n.disablePush===!0?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:n.ignoreIOSBadge===!0?1:0},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,clientTime:t.clientTime,needReadReceipt:t.needReadReceipt!==!0||C.isMessageFromOrToAVChatroom(t.to)?0:1,messageControlInfo:D===0?o:void 0,isSupportExtension:t.isSupportExtension===!0?1:0}}}}]),c}(),Hu={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MESSAGE_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},Ku=[k.MESSAGE_ONPROGRESS_FUNCTION_ERROR,k.MESSAGE_IMAGE_SELECT_FILE_FIRST,k.MESSAGE_IMAGE_TYPES_LIMIT,k.MESSAGE_FILE_IS_EMPTY,k.MESSAGE_IMAGE_SIZE_LIMIT,k.MESSAGE_FILE_SELECT_FILE_FIRST,k.MESSAGE_FILE_SIZE_LIMIT,k.MESSAGE_VIDEO_SIZE_LIMIT,k.MESSAGE_VIDEO_TYPES_LIMIT,k.MESSAGE_AUDIO_UPLOAD_FAIL,k.MESSAGE_AUDIO_SIZE_LIMIT,k.COS_UNDETECTED];function Ur(c){var t=!1;return Object.values(Hu).includes(c)&&(t=!0),(c>=120001&&c<=13e4||c>=10100&&c<=10200)&&(t=!0),t}var Wu=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="MessageModule",n._messageOptionsMap=new Map,n._mergerMessageHandler=new Bu($(n)),n}return q(s,[{key:"createTextMessage",value:function(e){var n=this.getMyUserID();e.currentUser=n,e.senderTinyID=this.getMyTinyID();var o=new ve(e),a=typeof e.payload=="string"?e.payload:e.payload.text,r=new mo({text:a}),i=this._getNickAndAvatarByUserID(n);return o.setElement(r),o.setNickAndAvatar(i),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"createImageMessage",value:function(e){var n=this.getMyUserID();e.currentUser=n,e.senderTinyID=this.getMyTinyID();var o=new ve(e);if(Z){var a=e.payload.file;if(Qe(a))return void this.outputWarning("FileUnsupportedInMP","createImageMessage");var r=a.tempFiles[0].path||a.tempFiles[0].tempFilePath,i={url:r,name:r.slice(r.lastIndexOf("/")+1),size:a.tempFiles&&a.tempFiles[0].size||1,type:r.slice(r.lastIndexOf(".")+1).toLowerCase()};e.payload.file=i}else if(ke){if(Qe(e.payload.file)){var u=e.payload.file;e.payload.file={files:[u]}}else if(ne(e.payload.file)&&typeof uni<"u"){var l=e.payload.file.tempFiles[0];e.payload.file={files:[l]}}}var d=new vo({imageFormat:dn.UNKNOWN,uuid:this._generateUUID(e.payload.file),file:e.payload.file}),p=this._getNickAndAvatarByUserID(n);return o.setElement(d),o.setNickAndAvatar(p),o.setNameCard(this._getNameCardByGroupID(o)),this._messageOptionsMap.set(o.clientSequence,e),o}},{key:"createAudioMessage",value:function(e){var n=e.payload.file;if(Z){var o={url:n.tempFilePath,name:n.tempFilePath.slice(n.tempFilePath.lastIndexOf("/")+1),size:n.fileSize,second:parseInt(n.duration)/1e3,type:n.tempFilePath.slice(n.tempFilePath.lastIndexOf(".")+1).toLowerCase()};e.payload.file=o}var a=this.getMyUserID();e.currentUser=a,e.senderTinyID=this.getMyTinyID();var r=new ve(e),i=new yo({second:Math.floor(n.duration/1e3),size:n.fileSize||n.size,url:n.tempFilePath,uuid:this._generateUUID(e.payload.file)}),u=this._getNickAndAvatarByUserID(a);return r.setElement(i),r.setNickAndAvatar(u),r.setNameCard(this._getNameCardByGroupID(r)),this._messageOptionsMap.set(r.clientSequence,e),r}},{key:"createVideoMessage",value:function(e){var n=this.getMyUserID();e.currentUser=n,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl="",e.payload.file.thumbSize=0;var o={};if(Z){if(Ye)return void this.outputWarning("VideoUnsupportedInAlipay");if(Qe(e.payload.file))return void this.outputWarning("FileUnsupportedInMP","createVideoMessage");var a=e.payload.file;b(a.tempFiles)&&(a=a.tempFiles[0]),o.url=a.tempFilePath,o.name=a.tempFilePath.slice(a.tempFilePath.lastIndexOf("/")+1),o.size=a.size||1,o.second=a.duration||0,o.type=a.tempFilePath.slice(a.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else if(ke){if(Qe(e.payload.file)){var r=e.payload.file;e.payload.file.files=[r]}else if(ne(e.payload.file)&&typeof uni<"u"){var i=e.payload.file.tempFile;e.payload.file.files=[i]}var u=e.payload.file;o.url=window.URL.createObjectURL(u.files[0]),o.name=u.files[0].name,o.size=u.files[0].size||1,o.second=u.files[0].duration||0,o.type=u.files[0].type.split("/")[1]}e.payload.file.videoFile=o;var l=new ve(e),d=new To({videoFormat:o.type,videoSecond:et(o.second,0),videoSize:o.size,remoteVideoUrl:"",videoUrl:o.url,videoUUID:this._generateUUID(e.payload.file.videoFile),thumbUUID:this._generateUUID(e.payload.file.videoFile),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:e.payload.file.thumbUrl.slice(e.payload.file.thumbUrl.lastIndexOf(".")+1).toLowerCase()}),p=this._getNickAndAvatarByUserID(n);return l.setElement(d),l.setNickAndAvatar(p),l.setNameCard(this._getNameCardByGroupID(l)),this._messageOptionsMap.set(l.clientSequence,e),l}},{key:"createCustomMessage",value:function(e){var n=this.getMyUserID();e.currentUser=n,e.senderTinyID=this.getMyTinyID();var o=new ve(e),a=new Co({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),r=this._getNickAndAvatarByUserID(n);return o.setElement(a),o.setNickAndAvatar(r),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"createFaceMessage",value:function(e){var n=this.getMyUserID();e.currentUser=n,e.senderTinyID=this.getMyTinyID();var o=new ve(e),a=new Mo(e.payload),r=this._getNickAndAvatarByUserID(n);return o.setElement(a),o.setNickAndAvatar(r),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"createMergerMessage",value:function(e){var n=this.getMyUserID();e.currentUser=n,e.senderTinyID=this.getMyTinyID();var o=this._getNickAndAvatarByUserID(n),a=new ve(e),r=new kn(e.payload);return a.setElement(r),a.setNickAndAvatar(o),a.setNameCard(this._getNameCardByGroupID(a)),a.setRelayFlag(!0),a}},{key:"createForwardMessage",value:function(e){var n=e.to,o=e.conversationType,a=e.priority,r=e.payload,i=e.needReadReceipt,u=e.receiverList,l=this.getMyUserID(),d=this._getNickAndAvatarByUserID(l);if(r.type===f.MSG_GRP_TIP)return T({code:k.MESSAGE_FORWARD_TYPE_INVALID});var p={to:n,conversationType:o,conversationID:"".concat(o).concat(n),priority:a,isPlaceMessage:0,status:Ge.UNSEND,currentUser:l,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||r.cloudCustomData||"",needReadReceipt:i,receiverList:u,isSupportExtension:e.isSupportExtension||!1},g=new ve(p);return g.setElement(r.getElements()[0]),g.setNickAndAvatar(d),g.setNameCard(this._getNameCardByGroupID(r)),g.setRelayFlag(!0),g}},{key:"downloadMergerMessage",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:"createFileMessage",value:function(e){if(Z){if(!rt&&!yt&&!je)return;var n=Q.getSystemInfoSync().SDKVersion;if(rt&&Is(n,"2.5.0")<0)return void this.outputWarning("WXChooseMessageFile");if(yt&&Is(n,"1.18.0")<0)return void this.outputWarning("QQChooseMessageFile")}if(ke||je){if(Qe(e.payload.file)){var o=e.payload.file;e.payload.file={files:[o]}}else if(ne(e.payload.file)&&typeof uni<"u"){var a=e.payload.file,r=a.tempFiles,i=a.files,u=null;b(r)?u=r[0]:b(i)&&(u=i[0]),e.payload.file={files:[u]}}}else if(rt||yt){var l=e.payload.file.tempFiles,d=m(m({},l[0]),{},{url:l[0].path});e.payload.file={files:[d]}}var p=this.getMyUserID();e.currentUser=p,e.senderTinyID=this.getMyTinyID();var g=new ve(e),_=new Io({uuid:this._generateUUID(e.payload.file),file:e.payload.file}),v=this._getNickAndAvatarByUserID(p);return g.setElement(_),g.setNickAndAvatar(v),g.setNameCard(this._getNameCardByGroupID(g)),this._messageOptionsMap.set(g.clientSequence,e),g}},{key:"createLocationMessage",value:function(e){var n=this.getMyUserID();e.currentUser=n,e.senderTinyID=this.getMyTinyID();var o=new ve(e),a=new Do(e.payload),r=this._getNickAndAvatarByUserID(n);return o.setElement(a),o.setNickAndAvatar(r),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"_onCannotFindModule",value:function(){return T({code:k.CANNOT_FIND_MODULE})}},{key:"sendMessageInstance",value:function(e,n){var o=this;if(this.getModule(mt).filterMessage(e,n)===!1)return this._onSendMessageFailed(e,new oe({code:k.PROFANITY_FOUND}));var a,r=null;switch(e.conversationType){case f.CONV_C2C:if(!(r=this.getModule(fe)))return this._onCannotFindModule();break;case f.CONV_GROUP:if(!(r=this.getModule(V)))return this._onCannotFindModule();if(Oe({groupID:e.to})){var i=r.getLocalGroupProfile(e.to);if(i&&i.isSupportTopic)return T({code:k.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL})}break;default:return T({code:k.MESSAGE_SEND_INVALID_CONVERSATION_TYPE})}var u=this.getModule(Os),l=this.getModule(V);return u.upload(e).then(function(){return o._getSendMessageSpecifiedKey(e)===Tt&&o.getModule(Re).addSuccessCount(be),l.guardForAVChatRoom(e).then(function(){if(!e.isSendable())return T({code:k.MESSAGE_FILE_URL_IS_EMPTY});o._addSendMessageTotalCount(e),a=Date.now();var d=function(p){var g="utf-8";ke&&document&&(g=document.charset.toLowerCase());var _,v,M=0;if(v=p.length,g==="utf-8"||g==="utf8")for(var y=0;y<v;y++)(_=p.codePointAt(y))<=127?M+=1:_<=2047?M+=2:_<=65535?M+=3:(M+=4,y++);else if(g==="utf-16"||g==="utf16")for(var C=0;C<v;C++)(_=p.codePointAt(C))<=65535?M+=2:(M+=4,C++);else M=p.replace(/[^\x00-\xff]/g,"aa").length;return M}(JSON.stringify(e));return e.type===f.MSG_MERGER&&d>11264?o._mergerMessageHandler.uploadMergerMessage(e,d).then(function(p){var g=o._mergerMessageHandler.createMergerMessagePack(e,n,p);return o.request(g)}):(o.getModule(P).setMessageRandom(e),e.conversationType===f.CONV_C2C||e.conversationType===f.CONV_GROUP?r.sendMessage(e,n):void 0)}).then(function(d){var p=d.data,g=p.time,_=p.sequence,v=p.readReceiptCode;ee(v)&&v!==0&&(new L("sendMessageWithReceipt").setMessage("from:".concat(e.from," to:").concat(e.to," sequence:").concat(_," readReceiptCode:").concat(v)).end(),h.w("".concat(o._n,".sendMessageInstance readReceiptCode:").concat(v," message:").concat(o.getErrorMessage(v)))),o._addSendMessageSuccessCount(e,a),o._messageOptionsMap.delete(e.clientSequence);var M=o.getModule(P);e.status=Ge.SUCCESS,e.time=g;var y=!1;if(e.conversationType===f.CONV_GROUP)e.sequence=_;else if(e.conversationType===f.CONV_C2C){var C=M.getLatestMessageSentByMe(e.conversationID);if(C){var D=C.nick,E=C.avatar;D===e.nick&&E===e.avatar||(y=!0)}}if(y&&M.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),r.isOnlineMessage(e,n))e._onlineOnlyFlag=!0;else{M.appendToMessageList(e);var A=e;ne(n)&&ne(n.messageControlInfo)&&(n.messageControlInfo.excludedFromLastMessage===!0&&(e._isExcludedFromLastMessage=!0,A=""),n.messageControlInfo.excludedFromUnreadCount===!0&&(e._isExcludedFromUnreadCount=!0));var O=e.conversationType;Le(e.to)&&(O=f.CONV_TOPIC,o.getModule(ae).onMessageSent({groupID:Ie(e.to),topicID:e.to,lastMessage:A})),M.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:O,subType:e.conversationSubType,lastMessage:A}]})}return e.getRelayFlag()||e.type!=="TIMImageElem"||Cs(e.payload.imageInfoArray),x({message:e})})}).catch(function(d){return o._onSendMessageFailed(e,d)})}},{key:"_onSendMessageFailed",value:function(e,n){e.status=Ge.FAIL,this.getModule(P).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,n);var o=new L("sendMessage");return o.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),this.probeNetwork().then(function(a){var r=N(a,2),i=r[0],u=r[1];o.setError(n,i,u).end()}),h.e("".concat(this._n,"._onSendMessageFailed error:"),n),T(new oe({code:n&&n.code?n.code:k.MESSAGE_SEND_FAIL,message:n&&n.message?n.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([f.MSG_IMAGE,f.MSG_AUDIO,f.MSG_VIDEO,f.MSG_FILE].includes(e.type))return Tt;if(e.conversationType===f.CONV_C2C)return Nt;if(e.conversationType===f.CONV_GROUP){var n=this.getModule(V).getLocalGroupProfile(e.to);if(!n)return;var o=n.type;return xe(o)?Gt:Ot}}},{key:"_addSendMessageTotalCount",value:function(e){var n=this._getSendMessageSpecifiedKey(e);n&&this.getModule(Re).addTotalCount(n)}},{key:"_addSendMessageSuccessCount",value:function(e,n){var o=Math.abs(Date.now()-n),a=this._getSendMessageSpecifiedKey(e);if(a){var r=this.getModule(Re);r.addSuccessCount(a),r.addCost(a,o)}}},{key:"_addSendMessageFailCountOnUser",value:function(e,n){var o,a,r=n.code,i=r===void 0?-1:r,u=this.getModule(Re),l=this._getSendMessageSpecifiedKey(e);l===Tt&&(o=i,a=!1,Ku.includes(o)&&(a=!0),a)?u.addFailedCountOfUserSide(be):Ur(i)&&l&&u.addFailedCountOfUserSide(l)}},{key:"resendMessage",value:function(e){return e.isResend=!0,e.status=Ge.UNSEND,this.sendMessageInstance(e)}},{key:"revokeMessage",value:function(e){var n=this,o=null;if(e.conversationType===f.CONV_C2C?o=this.getModule(fe):e.conversationType===f.CONV_GROUP&&(o=this.getModule(V)),!o)return this._onCannotFindModule();var a=new L("revokeMessage");a.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to));var r="".concat(this._n,".").concat("revokeMessage");return o.revokeMessage(e).then(function(i){var u=i.data.recallRetList;if(!R(u)&&u[0].retCode!==0){var l=new oe({code:u[0].retCode,data:{message:e}});return a.setCode(l.code).setMoreMessage(l.message).end(),T(l)}return h.i("".concat(r," ok. ID:").concat(e.ID)),e.isRevoked=!0,a.end(),n.getModule(P).onMessageRevoked([e]),x({message:e})}).catch(function(i){n.probeNetwork().then(function(l){var d=N(l,2),p=d[0],g=d[1];a.setError(i,p,g).end()});var u=new oe({code:i&&i.code?i.code:k.MESSAGE_REVOKE_FAIL,message:i&&i.message?i.message:void 0,data:{message:e}});return h.w("".concat(r," failed. error:"),i),T(u)})}},{key:"deleteMessage",value:function(e){var n=this,o=null,a=e[0],r=a.conversationID,i="",u=[],l=[];if(a.conversationType===f.CONV_C2C)o=this.getModule(fe),i=r.replace(f.CONV_C2C,""),e.forEach(function(g){g&&g.status===Ge.SUCCESS&&g.conversationID===r&&(g._onlineOnlyFlag||u.push("".concat(g.sequence,"_").concat(g.random,"_").concat(g.time)),l.push(g))});else if(a.conversationType===f.CONV_GROUP)o=this.getModule(V),i=r.replace(f.CONV_GROUP,""),e.forEach(function(g){g&&g.status===Ge.SUCCESS&&g.conversationID===r&&(g._onlineOnlyFlag||u.push("".concat(g.sequence)),l.push(g))});else if(a.conversationType===f.CONV_SYSTEM)return T({code:k.CANNOT_DELETE_GROUP_SYSTEM_NOTICE});if(!o)return this._onCannotFindModule();if(u.length===0)return this._onMessageDeleted(l);u.length>30&&(u=u.slice(0,30),l=l.slice(0,30));var d=new L("deleteMessage");d.setMessage("to:".concat(i," count:").concat(u.length));var p="".concat(this._n,".").concat("deleteMessage");return o.deleteMessage({to:i,keyList:u}).then(function(g){return d.end(),h.i("".concat(p," ok")),n._onMessageDeleted(l)}).catch(function(g){n.probeNetwork().then(function(v){var M=N(v,2),y=M[0],C=M[1];d.setError(g,y,C).end()}),h.w("".concat(p," failed. error:"),g);var _=new oe({code:g&&g.code?g.code:k.MESSAGE_DELETE_FAIL,message:g&&g.message?g.message:void 0});return T(_)})}},{key:"_onMessageDeleted",value:function(e){return this.getModule(P).onMessageDeleted(e),Y({messageList:e})}},{key:"translateText",value:function(e){var n="".concat(this._n,".").concat("translateText"),o=e.sourceTextList,a=e.sourceLanguage,r=e.targetLanguage,i=new L("translateText");return i.setMessage("sourceLanguage:".concat(a," targetLanguage:").concat(r)),this.request({protocolName:vr,requestData:{sourceTextList:o,source:a||"auto",target:r,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then(function(u){var l=u.data,d=l.error,p=l.requestID,g=l.translatedTextList;if(d.code===0)return i.end(),h.i("".concat(n," ok. requestID:").concat(p)),x({translatedTextList:g});throw m(m({},d),{},{requestID:p})}).catch(function(u){return i.setCode(u.code).setMoreMessage(u.requestID).end(),h.w("".concat(n," failed. error:"),u),T({code:k.TRANSLATE_TEXT_FAIL})})}},{key:"modifyRemoteMessage",value:function(e){var n=this,o=null,a=e.conversationType,r=e.to;if(this.getModule(V).isMessageFromOrToAVChatroom(r))return T({code:k.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,data:{message:e}});if(this.getModule(mt).filterMessage(e)===!1)return T({code:k.PROFANITY_FOUND,data:{message:e}});a===f.CONV_C2C?o=this.getModule(fe):a===f.CONV_GROUP&&(o=this.getModule(V));var i=new L("modifyMessage");i.setMessage("to:".concat(r));var u="".concat(this._n,".modifyRemoteMessage");return o.modifyRemoteMessage(e).then(function(l){i.end(),h.i("".concat(u," ok"));var d=n._onModifyRemoteMessageResp(e,l.data);return x({message:d})}).catch(function(l){if(i.setCode(l.code).setMoreMessage(l.message).end(),h.w("".concat(u," failed. error:"),l),l.code===20027){var d=n._onModifyRemoteMessageResp(e,l.data);return T({code:k.MESSAGE_MODIFY_CONFLICT,data:{message:d}})}return T({code:l.code,message:l.message,data:{message:e}})})}},{key:"_onModifyRemoteMessageResp",value:function(e,n){h.d("".concat(this._n,"._onModifyRemoteMessageResp options:"),n);var o=e.conversationType,a=e.from,r=e.to,i=e.random,u=e.sequence,l=e.time,d=n.elements,p=n.messageVersion,g=n.cloudCustomData,_=g===void 0?"":g;return this.getModule(P).onMessageModified({conversationType:o,from:a,to:r,time:l,random:i,sequence:u,elements:d,cloudCustomData:_,messageVersion:p})}},{key:"_generateUUID",value:function(e){var n=this.getModule(X),o="".concat(n.getSDKAppID(),"-").concat(n.getUserID(),"-").concat(function(){for(var i="",u=32;u>0;--u)i+=fs[Math.floor(Math.random()*Ai)];return i}()),a=e.name||e.value||e.url||e.tempFilePath,r=a&&a.slice(a.lastIndexOf(".")+1);return r&&(o="".concat(o,".").concat(r)),o}},{key:"getMessageOption",value:function(e){return this._messageOptionsMap.get(e)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.getModule(pe).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===f.CONV_GROUP){var n=this.getModule(V);if(n)return n.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._messageOptionsMap.clear()}}]),s}(le),Yu=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="MessageExtensionModule",n.messageExtensionMap=new Map,n.globalSeqMap=new Map,n.getMessageExtensionsMap=new Map,n}return q(s,[{key:"onMessageExtensionNotify",value:function(e){var n=this,o=e.dataList,a=o.messageInfo,r=o.operateType,i=o.operateResultList,u=o.tinyID,l=o.globalSequence,d=a.clientTime,p=a.random,g="".concat(u,"-").concat(d,"-").concat(p),_=[],v=[];h.l("".concat(this._n,".onMessageExtensionNotify messageID:").concat(g," operateType:").concat(r," globalSequence:").concat(l)),this._updateGlobalSequence(g,l);var M=!1,y=!1;i.forEach(function(C){var D=C.extensions,E=D===void 0?[]:D,A=C.clearSequence;r===1?(M=!0,E.forEach(function(O){_.push({key:O.key,value:O.value})}),n._updateLocalExtension(g,E)):r===2?(y=!0,E.forEach(function(O){v.push(O.key)}),n._updateLocalExtension(g,E)):r===3&&(y=!0,n._hasLocalExtension(g)&&n._getLocalExtension(g).forEach(function(O,U){O.seq<=A&&!R(O.value)&&v.push(U)}),n._clearLocalExtension(g,A))}),M&&this.emitOuterEvent(W.MESSAGE_EXTENSIONS_UPDATED,{messageID:g,extensions:_}),y&&this.emitOuterEvent(W.MESSAGE_EXTENSIONS_DELETED,{messageID:g,keyList:v})}},{key:"setMessageExtensions",value:function(e,n){var o=this;if(!this.canIUse(ye.MSG_EXT))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var a="".concat(this._n,".").concat("setMessageExtensions"),r=e.ID,i=e.conversationID,u=e.sequence,l=e.time,d=B(n);n.length>20&&(d=n.slice(0,20),h.w("".concat(a,". the length of extensions cannot exceed 20.")));var p="conversationID:".concat(i," messageID:").concat(r," sequence:").concat(u," time:").concat(l," count:").concat(d.length),g=new L("setMessageExtensions");return g.setMessage(p),h.l("".concat(a," ").concat(p)),this._modifyMessageExtensions(e,d).then(function(_){var v=_.resultList,M=_.successCount,y=_.failureCount,C="success count:".concat(M," fail count:").concat(y);return g.setMoreMessage(C).end(),h.l("".concat(a," ok. ").concat(C)),x({extensions:v})}).catch(function(_){return o.probeNetwork().then(function(v){var M=N(v,2),y=M[0],C=M[1];g.setError(_,y,C).end()}),h.e("".concat(a," failed. error:"),_),T(_)})}},{key:"getMessageExtensions",value:function(e){var n=this;if(!this.canIUse(ye.MSG_EXT))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._n,".").concat("getMessageExtensions"),a=e.ID,r=e.conversationID,i=e.sequence,u=e.time,l="conversationID:".concat(r," messageID:").concat(a," sequence:").concat(i," time:").concat(u),d=new L("getMessageExtensions");d.setMessage(l),h.l("".concat(o," ").concat(l));var p=void 0;return this.getMessageExtensionsMap.has(a)&&(p=this._getGlobalSequence(a)),this._getMessageExtensions(e,p).then(function(g){return d.end(),h.l("".concat(o," ok. total count:").concat(g.length)),S(p)&&g.length>0&&n.getMessageExtensionsMap.set(a,1),x({extensions:g})}).catch(function(g){return n.probeNetwork().then(function(_){var v=N(_,2),M=v[0],y=v[1];d.setError(g,M,y).end()}),h.e("".concat(o," failed. error:"),g),T(g)})}},{key:"deleteMessageExtensions",value:function(e,n){var o=this;if(!this.canIUse(ye.MSG_EXT))return T({code:k.CANNOT_USE_COMMERCIAL_ABILITY});var a="".concat(this._n,".").concat("deleteMessageExtensions"),r=[],i=3;R(n)||(i=2,n.forEach(function(v){r.push({key:v,value:"",seq:0})}));var u=e.ID,l=e.conversationID,d=e.sequence,p=e.time,g="conversationID:".concat(l," messageID:").concat(u," sequence:").concat(d," time:").concat(p," operateType:").concat(i),_=new L("deleteMessageExtensions");return _.setMessage(g),h.l("".concat(a," ").concat(g)),this._modifyMessageExtensions(e,r,i).then(function(v){var M=v.resultList,y=v.successCount,C=v.failureCount,D="";return i===2&&(D="success count:".concat(y," fail count:").concat(C)),_.setMoreMessage("".concat(D)).end(),h.l("".concat(a," ok. ").concat(D)),x({extensions:M})}).catch(function(v){return o.probeNetwork().then(function(M){var y=N(M,2),C=y[0],D=y[1];_.setError(v,C,D).end()}),h.e("".concat(a," failed. error:"),v),T(v)})}},{key:"_modifyMessageExtensions",value:function(e,n){var o=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=Le(e.to)?f.CONV_TOPIC:e.conversationType,i=void 0;a!==3&&(i=this._getRequestExtensions(e,n));var u=null;switch(r){case f.CONV_C2C:u=this.getModule(fe);break;case f.CONV_GROUP:u=this.getModule(V);break;case f.CONV_TOPIC:u=this.getModule(ae);break;default:return T({code:k.CANNOT_FIND_MODULE})}return u.modifyMessageExtensions(e,i,a).then(function(l){var d=l.data,p=d.extensions,g=d.seq,_=[],v=0,M=0,y=[];return(p=R(p)?[]:p).forEach(function(C){var D=C.errorCode,E=C.extension,A=E.key,O=E.value,U=E.seq;_.push({code:D,key:A,value:O}),D===0?v++:M++,y.push({key:A,value:O,seq:U})}),o._updateGlobalSequence(e.ID,g),y.length>0&&(o._updateLocalExtension(e.ID,y),y=null),{resultList:_,successCount:v,failureCount:M}}).catch(function(l){return T(l)})}},{key:"_getRequestExtensions",value:function(e,n){var o=[];if(this._hasLocalExtension(e.ID)){var a=this._getLocalExtension(e.ID);return n.forEach(function(r){var i=r.key,u=r.value,l=0;a.has(i)&&(l=a.get(i).seq),o.push({key:i,value:u,seq:l})}),o}return n.forEach(function(r){var i=r.key,u=r.value;o.push({key:i,value:u,seq:0})}),o}},{key:"_getMessageExtensions",value:function(e,n){var o=this,a="".concat(this._n,"._getMessageExtensions"),r=e.ID,i=e.to,u=null;switch(Le(i)?f.CONV_TOPIC:e.conversationType){case f.CONV_C2C:u=this.getModule(fe);break;case f.CONV_GROUP:u=this.getModule(V);break;case f.CONV_TOPIC:u=this.getModule(ae);break;default:return T({code:k.CANNOT_FIND_MODULE})}return u.getMessageExtensions(e,n).then(function(l){var d=l.data,p=d.extensions,g=d.completeFlag,_=d.globalSequence,v=d.clearSequence;if(p=R(p)?[]:p,h.l("".concat(a," ok. completeFlag:").concat(g," globalSequence:").concat(_," clearSequence:").concat(v," count:").concat(p.length)),o._updateLocalExtension(r,p),o._clearLocalExtension(r,v),o._updateGlobalSequence(r,_),g!==1){var M=p.slice(-1)[0].seq+1;return o._getMessageExtensions(e,M)}return o._getLocalExtensions(r)}).catch(function(l){return T(l)})}},{key:"_hasLocalExtension",value:function(e){return this.messageExtensionMap.has(e)}},{key:"_getLocalExtension",value:function(e){return this.messageExtensionMap.get(e)}},{key:"_updateLocalExtension",value:function(e,n){this._hasLocalExtension(e)||this.messageExtensionMap.set(e,new Map);var o=this._getLocalExtension(e);n.forEach(function(a){var r=a.key,i=a.value,u=i===void 0?"":i,l=a.seq;o.set(r,{value:u,seq:l})})}},{key:"_clearLocalExtension",value:function(e,n){if(!(n<=0)&&this._hasLocalExtension(e)){var o=this._getLocalExtension(e);o.forEach(function(a,r){a.seq<=n&&o.delete(r)})}}},{key:"_getLocalExtensions",value:function(e){var n=[];return this._hasLocalExtension(e)&&this._getLocalExtension(e).forEach(function(o,a){var r=o.value;R(r)||n.push({key:a,value:r})}),n}},{key:"_getGlobalSequence",value:function(e){return this.globalSeqMap.get(e)}},{key:"_updateGlobalSequence",value:function(e,n){this.globalSeqMap.set(e,n)}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this.messageExtensionMap.clear(),this.globalSeqMap.clear(),this.getMessageExtensionsMap.clear()}}]),s}(le),ju=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="ComboMessageModule",n}return q(s,[{key:"sendMessage",value:function(e){var n=this,o=this._constructMessageInstance(e);if(o===null)return T({code:k.MESSAGE_SEND_FAIL});this._addSendMessageTotalCount(o);var a=Date.now();return this.getModule(P).setMessageRandom(o),this._sendComboMessage(o,e).then(function(r){var i=r.data,u=i.time,l=i.sequence,d=i.readReceiptCode;ee(d)&&d!==0&&(new L("sendMessageWithReceipt").setMessage("from:".concat(o.from," to:").concat(o.to," sequence:").concat(l," readReceiptCode:").concat(d)).end(),h.w("".concat(n._n,".sendMessage readReceiptCode:").concat(d," message:").concat(n.getErrorMessage(d)))),n._addSendMessageSuccessCount(o,a);var p=n.getModule(P);o.status=Ge.SUCCESS,o.time=u,o.conversationType===f.CONV_GROUP&&(o.sequence=l),p.appendToMessageList(o);var g=o;return o._isExcludedFromLastMessage===!0&&(g=""),p.onMessageSent({conversationOptionsList:[{conversationID:o.conversationID,unreadCount:0,type:o.conversationType,subType:o.conversationSubType,lastMessage:g}]}),x({message:o})}).catch(function(r){return n._onSendMessageFailed(o,r)})}},{key:"_sendComboMessage",value:function(e,n){var o=this._m.getModule(Fe),a="";return e.conversationType===f.CONV_C2C&&(a="".concat(I.NAME.OPEN_IM,".").concat(I.CMD.SEND_MESSAGE)),e.conversationType===f.CONV_GROUP&&(a="".concat(I.NAME.GROUP,".").concat(I.CMD.SEND_GROUP_MESSAGE)),o.sendComboMessage({servcmd:a,data:n})}},{key:"_constructMessageInstance",value:function(e){var n="".concat(this._n,"._constructMessageInstance"),o=null;try{var a=this.getMyUserID(),r={};if(r.senderTinyID=this.getMyTinyID(),r.currentUser=a,r.from=e.From_Account||a,e.GroupId?(r.conversationID="".concat(f.CONV_GROUP).concat(e.GroupId),r.conversationType=f.CONV_GROUP,r.to=e.GroupId):e.To_Account&&(r.conversationID="".concat(f.CONV_C2C).concat(e.To_Account),r.conversationType=f.CONV_C2C,r.to=e.To_Account),r.time=e.MsgTimeStamp||0,r.random=e.Random||e.MsgRandom||0,r.priority=e.MsgPriority,z(e.CloudCustomData)&&e.CloudCustomData.length>0&&(r.cloudCustomData=e.CloudCustomData),b(e.SendMsgControl)&&(r.messageControlInfo={},e.SendMsgControl.includes("NoUnread")&&(r.messageControlInfo.excludedFromUnreadCount=1),e.SendMsgControl.includes("NoLastMsg")&&(r.messageControlInfo.excludedFromLastMessage=1)),r.conversationType===f.CONV_GROUP&&b(e.To_Account)&&e.To_Account.length>0){var i=e.To_Account;e.To_Account.length>50&&(i=e.To_Account.slice(0,50),h.w("".concat(n," To_Account must be less than or equal to 50."))),r.receiverList=B(i),e.To_Account=B(i)}e.IsNeedReadReceipt!==1&&e.NeedReadReceipt!==1||(r.needReadReceipt=!0),e.SupportMessageExtension===1&&(r.isSupportExtension=!0),(o=new ve(r)).status=Ge.UNSEND,e.MsgClientTime=o.clientTime,o.conversationType===f.CONV_C2C&&(e.MsgSeq=o.sequence);for(var u,l=e.MsgBody.length,d=0;d<l;d++)(u=e.MsgBody[d]).MsgType==="TIMTextElem"?o.setTextElement(u.MsgContent.Text):u.MsgType==="TIMCustomElem"?o.setCustomElement({data:u.MsgContent.Data||"",description:u.MsgContent.Desc||"",extension:u.MsgContent.Ext||""}):u.MsgType==="TIMFaceElem"&&o.setFaceElement({index:u.MsgContent.Index,data:u.MsgContent.Data});var p=o.getElements();o.payload=p[0].content,o.type=p[0].type}catch(g){o=null,h.e("".concat(n," failed. error:"),g)}return o}},{key:"_onSendMessageFailed",value:function(e,n){e.status=Ge.FAIL,this.getModule(P).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,n);var o=new L("sendMessage");return o.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),this.probeNetwork().then(function(a){var r=N(a,2),i=r[0],u=r[1];o.setError(n,i,u).end()}),h.e("".concat(this._n,"._onSendMessageFailed error:"),n),T(new oe({code:n&&n.code?n.code:k.MESSAGE_SEND_FAIL,message:n&&n.message?n.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if(e.conversationType===f.CONV_C2C)return Nt;if(e.conversationType===f.CONV_GROUP){var n=this.getModule(V).getLocalGroupProfile(e.to);if(!n)return;var o=n.type;return xe(o)?Gt:Ot}}},{key:"_addSendMessageTotalCount",value:function(e){var n=this._getSendMessageSpecifiedKey(e);n&&this.getModule(Re).addTotalCount(n)}},{key:"_addSendMessageSuccessCount",value:function(e,n){var o=Math.abs(Date.now()-n),a=this._getSendMessageSpecifiedKey(e);if(a){var r=this.getModule(Re);r.addSuccessCount(a),r.addCost(a,o)}}},{key:"_addSendMessageFailCountOnUser",value:function(e,n){var o=n.code,a=o===void 0?-1:o,r=this.getModule(Re),i=this._getSendMessageSpecifiedKey(e);Ur(a)&&i&&r.addFailedCountOfUserSide(i)}}]),s}(le),zu=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="PluginModule",n.plugins={},n}return q(s,[{key:"registerPlugin",value:function(e){var n=this;Object.keys(e).forEach(function(o){n.plugins[o]=e[o]}),new L("registerPlugin").setMessage("".concat(Object.keys(e))).end()}},{key:"getPlugin",value:function(e){return this.plugins[e]}},{key:"reset",value:function(){}}]),s}(le),Ju=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="SyncUnreadMessageModule",n._cookie="",n._onlineSyncFlag=!1,n.getInnerEmitterInstance().on(ot,n._onLoginSuccess,$(n)),n}return q(s,[{key:"_onLoginSuccess",value:function(e){this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"_startSync",value:function(e){var n=this,o=e.cookie,a=e.syncFlag,r=e.isOnlineSync,i="".concat(this._n,"._startSync");h.l("".concat(i," cookie:").concat(o," syncFlag:").concat(a," isOnlineSync:").concat(r)),this.request({protocolName:Fs,requestData:{cookie:o,syncFlag:a,isOnlineSync:r}}).then(function(u){var l=u.data,d=l.cookie,p=l.syncFlag;n._cookie=d,R(d)||(p===0||p===1?(n._dispatchUnreadMessage(m(m({},u.data),{},{isSyncingEnded:!1})),n._startSync({cookie:d,syncFlag:p,isOnlineSync:0})):p===2&&n._dispatchUnreadMessage(m(m({},u.data),{},{isSyncingEnded:!0})))}).catch(function(u){h.e("".concat(i," failed. error:"),u)})}},{key:"_dispatchUnreadMessage",value:function(e){e.eventArray&&this.getModule(Fe).onMessage({head:{},body:{eventArray:e.eventArray,isInstantMessage:this._onlineSyncFlag,isSyncingEnded:e.isSyncingEnded}}),this.getModule(fe).onNewC2CMessage({dataList:e.messageList,isInstantMessage:!!e.isSyncingEnded&&this._onlineSyncFlag,C2CRemainingUnreadList:e.C2CRemainingUnreadList,C2CPairUnreadList:e.C2CPairUnreadList})}},{key:"startOnlineSync",value:function(){h.l("".concat(this._n,".startOnlineSync")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:1})}},{key:"startSyncOnReconnected",value:function(){h.l("".concat(this._n,".startSyncOnReconnected.")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._onlineSyncFlag=!1,this._cookie=""}}]),s}(le),An={request:{toAccount:"To_Account",fromAccount:"From_Account",to:"To_Account",from:"From_Account",groupID:"GroupId",groupAtUserID:"GroupAt_Account",extension:"Ext",data:"Data",description:"Desc",elements:"MsgBody",sizeType:"Type",downloadFlag:"Download_Flag",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",videoUrl:"",imageUrl:"URL",fileUrl:"Url",uuid:"UUID",priority:"MsgPriority",receiverUserID:"To_Account",receiverGroupID:"GroupId",messageSender:"SenderId",messageReceiver:"ReceiverId",nick:"From_AccountNick",avatar:"From_AccountHeadurl",messageNumber:"MsgNum",pbDownloadKey:"PbMsgKey",downloadKey:"JsonMsgKey",applicationType:"PendencyType",userIDList:"To_Account",groupNameList:"GroupName",userID:"To_Account",groupAttributeList:"GroupAttr",mainSequence:"AttrMainSeq",avChatRoomKey:"BytesKey",attributeControl:"AttrControl",sequence:"seq",messageControlInfo:"SendMsgControl",updateSequence:"UpdateSeq",clientTime:"MsgClientTime",sequenceList:"MsgSeqList",topicID:"TopicId",customData:"CustomString",isSupportTopic:"SupportTopic",isWebUniapp:"is_web_uniapp",isSupportExtension:"SupportMessageExtension",messageSequence:"MsgSeq",messageKey:"MsgKey",startSequence:"startSeq",simplifiedMessage:"DownsizeFlag"},response:{MsgPriority:"priority",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",Download_Flag:"downloadFlag",GroupId:"groupID",Member_Account:"userID",MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",MsgSeq:"sequence",MsgRandom:"random",MsgTime:"time",MsgTimeStamp:"time",MsgContent:"content",MsgBody:"elements",From_AccountNick:"nick",From_AccountHeadurl:"avatar",GroupWithdrawInfoArray:"revokedInfos",GroupReadInfoArray:"groupMessageReadNotice",LastReadMsgSeq:"lastMessageSeq",WithdrawC2cMsgNotify:"c2cMessageRevokedNotify",C2cWithdrawInfoArray:"revokedInfos",C2cReadedReceipt:"c2cMessageReadReceipt",ReadC2cMsgNotify:"c2cMessageReadNotice",LastReadTime:"peerReadTime",MsgRand:"random",MsgType:"type",MsgShow:"messageShow",NextMsgSeq:"nextMessageSeq",FaceUrl:"avatar",ProfileDataMod:"profileModify",Profile_Account:"userID",ValueBytes:"value",ValueNum:"value",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgFrom_AccountExtraInfo:"messageFromAccountExtraInformation",Operator_Account:"operatorID",OpType:"operationType",ReportType:"operationType",UserId:"userID",User_Account:"userID",List_Account:"userIDList",MsgOperatorMemberExtraInfo:"operatorInfo",MsgMemberExtraInfo:"memberInfoList",ImageUrl:"avatar",NickName:"nick",MsgGroupNewInfo:"newGroupProfile",MsgAppDefinedData:"groupCustomField",Owner_Account:"ownerID",GroupFaceUrl:"avatar",GroupIntroduction:"introduction",GroupNotification:"notification",GroupApplyJoinOption:"joinOption",MsgKey:"messageKey",GroupInfo:"groupProfile",ShutupTime:"muteTime",Desc:"description",Ext:"extension",GroupAt_Account:"groupAtUserID",MsgNum:"messageNumber",PbMsgKey:"pbDownloadKey",JsonMsgKey:"downloadKey",MsgModifiedFlag:"isModified",PendencyItem:"applicationItem",PendencyType:"applicationType",AddTime:"time",AddSource:"source",AddWording:"wording",ProfileImImage:"avatar",PendencyAdd:"friendApplicationAdded",FrienPencydDel_Account:"friendApplicationDeletedUserIDList",Peer_Account:"userID",GroupAttr:"groupAttributeList",GroupAttrAry:"groupAttributeList",AttrMainSeq:"mainSequence",seq:"sequence",GroupAttrOption:"groupAttributeOption",BytesChangedKeys:"changedKeyList",GroupAttrInfo:"groupAttributeList",GroupAttrSeq:"mainSequence",PushChangedAttrValFlag:"isWithChangedAttributeInfo",SubKeySeq:"sequence",Val:"value",MsgGroupFromCardName:"senderNameCard",MsgGroupFromNickName:"senderNick",C2cNick:"peerNick",C2cImage:"peerAvatar",SendMsgControl:"messageControlInfo",NoLastMsg:"excludedFromLastMessage",NoUnread:"excludedFromUnreadCount",UpdateSeq:"updateSequence",MuteNotifications:"muteFlag",MsgClientTime:"clientTime",TinyId:"tinyID",GroupMsgReceiptList:"readReceiptList",ReadNum:"readCount",UnreadNum:"unreadCount",TopicId:"topicID",MillionGroupFlag:"communityType",SupportTopic:"isSupportTopic",MsgTopicNewInfo:"newTopicInfo",ShutupAll:"muteAllMembers",CustomString:"customData",TopicFaceUrl:"avatar",TopicIntroduction:"introduction",TopicNotification:"notification",TopicIdArray:"topicIDList",MsgVersion:"messageVersion",C2cMsgModNotifys:"c2cMessageModified",GroupMsgModNotifys:"groupMessageModified",ApplyJoinOption:"joinOption",MsgFlag:"messageRemindType",AtInfoList:"groupAtInfoList",AtFlagList:"groupAtType",AtMsgSeq:"sequence",BanDuration:"duration",BanDescription:"reason",NotVisible:"invisible",BytesTag:"tag",BytesValue:"value",RptBytesValue:"value",LatestSeq:"globalSequence",ClearSeq:"clearSequence",SupportMessageExtension:"isSupportExtension",ExtensionList:"extensions",GroupCounter:"counterList",Revoker_Account:"revoker",MsgExtensionNotify:"messageExtensionNotify",ExtensionC2cMsgInfo:"messageInfo",ExtensionGroupMsgInfo:"messageInfo",MsgOptType:"operateType",SetKVInfo:"operateResultList",DeleteKVInfo:"operateResultList",ClearKVInfo:"operateResultList",MsgKeyValue:"extensions",ClearMsgSeq:"clearSequence",MsgLastSeq:"globalSequence",InviteJoinOption:"inviteOption",MemberList_Account:"inviteeList",MsgMemberExtraInfoList:"inviteeInfoList",E:"event",GInf:"groupProfile",MCT:"clientTime",MR:"random",MP:"priority",MTS:"time",GId:"groupID",MS:"sequence",CCD:"cloudCustomData",F_Account:"from",F_Hd:"avatar",F_NN:"nick",GN:"groupName",GT:"groupType",IsSys:"isSystemMessage",OpInf:"operatorInfo",Img:"avatar",NN:"nick",OnlineInf:"onlineMemberInfo",ET:"expireTime",Num:"onlineMemberNum",Opt:"operationType",O_Account:"operatorID",RT:"operationType",UDF:"userDefinedField",L_Account:"userIDList"},ignoreKeyWord:["C2C","ID","USP"]};function No(c,t){if(typeof c!="string"&&!Array.isArray(c))throw new TypeError("Expected the input to be `string | string[]`");t=Object.assign({pascalCase:!1},t);var s;return(c=Array.isArray(c)?c.map(function(e){return e.trim()}).filter(function(e){return e.length}).join("-"):c.trim()).length===0?"":c.length===1?t.pascalCase?c.toUpperCase():c.toLowerCase():(c!==c.toLowerCase()&&(c=Xu(c)),c=c.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,function(e,n){return n.toUpperCase()}).replace(/\d+(\w|$)/g,function(e){return e.toUpperCase()}),s=c,t.pascalCase?s.charAt(0).toUpperCase()+s.slice(1):s)}var Xu=function(c){for(var t=!1,s=!1,e=!1,n=0;n<c.length;n++){var o=c[n];t&&/[a-zA-Z]/.test(o)&&o.toUpperCase()===o?(c=c.slice(0,n)+"-"+c.slice(n),t=!1,e=s,s=!0,n++):s&&e&&/[a-zA-Z]/.test(o)&&o.toLowerCase()===o?(c=c.slice(0,n-1)+"-"+c.slice(n-1),e=s,s=!1,t=!0):(t=o.toLowerCase()===o&&o.toUpperCase()!==o,e=s,s=o.toUpperCase()===o&&o.toLowerCase()!==o)}return c};function Zu(c,t){var s=0;return function e(n,o){if(++s>100)return s--,n;if(b(n)){var a=n.map(function(d){return lt(d)?e(d,o):d});return s--,a}if(lt(n)){var r=(i=n,u=function(d,p){if(!gs(p))return!1;if((_=p)!==No(_))for(var g=0;g<An.ignoreKeyWord.length&&!p.includes(An.ignoreKeyWord[g]);g++);var _;return S(o[p])?function(v){return v==="OPPOChannelID"?v:v[0].toUpperCase()+No(v).slice(1)}(p):o[p]},l=Object.create(null),Object.keys(i).forEach(function(d){var p=u(i[d],d);p&&(l[p]=i[d])}),l);return r=vs(r,function(d,p){return b(d)||lt(d)?e(d,o):d}),s--,r}var i,u,l}(c,t)}function Oo(c,t){if(b(c))return c.map(function(a){return lt(a)?Oo(a,t):a});if(lt(c)){var s=(e=c,n=function(a,r){return S(t[r])?No(r):t[r]},o={},Object.keys(e).forEach(function(a){o[n(e[a],a)]=e[a]}),o);return s=vs(s,function(a){return b(a)||lt(a)?Oo(a,t):a})}var e,n,o}var Go=String.fromCharCode,Qu=function(c){var t=0|c.charCodeAt(0);if(55296<=t)if(t<56320){var s=0|c.charCodeAt(1);if(56320<=s&&s<=57343){if((t=(t<<10)+s-56613888|0)>65535)return Go(240|t>>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533}else t<=57343&&(t=65533);return t<=2047?Go(192|t>>>6,128|63&t):Go(224|t>>>12,128|t>>>6&63,128|63&t)},Uo=function(c){for(var t=c===void 0?"":(""+c).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,Qu),s=0|t.length,e=new Uint8Array(s),n=0;n<s;n=n+1|0)e[n]=0|t.charCodeAt(n);return e},$u=function(){function c(t){F(this,c),this._handler=t;var s=t.getURL();if(this._socket=null,this._workerSocket=null,this._id=He(),this._handler.getIsWorkerEnabled()){var e=URL.createObjectURL(new Blob([';let _socket = null;onmessage = function(event) { if (event.data.cmd === "start") { const url = event.data.url; _socket = new WebSocket(url); _socket.binaryType = "arraybuffer"; _socket.onopen = function() { postMessage({ callback: "onOpen", extensions: _socket.extensions }); }; _socket.onclose = function(e) { postMessage({ callback: "onOpen", e: { code: e.code, reason: e.reason } }); }; _socket.onmessage = function(e) { postMessage({ callback: "onMessage", data: e.data }); }; _socket.onerror = function(e) { postMessage({ callback: "onError", e: { isTrusted: "true" } }); }; } else if (event.data.cmd === "sendMessage") { if (_socket !== null) { _socket.send(event.data.data); } } else if (event.data.cmd === "stop") { if (_socket !== null) { _socket.close(event.data.code); _socket = null; } }};'],{type:"application/javascript; charset=utf-8"}));this._workerSocket=new Worker(e);var n=this;this._workerSocket.onmessage=function(o){var a=o.data,r=a.callback,i=a.e,u=a.extensions;r==="onOpen"?n._onOpen(u):r==="onClose"?n._onClose(i):r==="onError"?n._onError(i):r==="onMessage"&&n._onMessage(o.data)},this._workerSocket.postMessage({cmd:"start",id:this._id,url:s})}else Z?Ye?(Q.connectSocket({url:s,header:{"content-type":"application/json"}}),Q.onSocketClose(this._onClose.bind(this)),Q.onSocketOpen(this._onOpen.bind(this)),Q.onSocketMessage(this._onMessage.bind(this)),Q.onSocketError(this._onError.bind(this))):(this._socket=Q.connectSocket({url:s,header:{"content-type":"application/json"},complete:function(){}}),this._socket.onClose(this._onClose.bind(this)),this._socket.onOpen(this._onOpen.bind(this)),this._socket.onMessage(this._onMessage.bind(this)),this._socket.onError(this._onError.bind(this))):ke&&(this._socket=new WebSocket(s),this._socket.binaryType="arraybuffer",this._socket.onopen=this._onOpen.bind(this,this._socket.extensions),this._socket.onmessage=this._onMessage.bind(this),this._socket.onclose=this._onClose.bind(this),this._socket.onerror=this._onError.bind(this));this._canIUseBinaryFrame=t.canIUseBinaryFrame()}return q(c,[{key:"getID",value:function(){return this._id}},{key:"_onOpen",value:function(t){this._handler.onOpen({id:this._id,res:JSON.stringify(t)})}},{key:"_onClose",value:function(t){this._handler.onClose({id:this._id,e:t})}},{key:"_onMessage",value:function(t){var s;s=this._canIUseBinaryFrame?this._isAppCompressedData(t.data)?this._handler.inflate(t.data):function(e){for(var n=new Uint8Array(e),o="",a=0,r=n.length;a<r;){var i=n[a],u=0,l=0;if(i<=127?(u=0,l=255&i):i<=223?(u=1,l=31&i):i<=239?(u=2,l=15&i):i<=244&&(u=3,l=7&i),r-a-u>0)for(var d=0;d<u;)l=l<<6|63&(i=n[a+d+1]),d+=1;else l=65533,u=r-a;o+=String.fromCodePoint(l),a+=u+1}return o}(t.data):t.data,this._handler.onMessage({data:s})}},{key:"_isAppCompressedData",value:function(t){var s=new Uint8Array(t);return s[0]===67&&s[1]===79&&s[2]===77&&s[3]===80}},{key:"_onError",value:function(t){this._handler.onError({id:this._id,e:t})}},{key:"setIsWorkerEnabled",value:function(t){this._isWorkerEnabled=!0}},{key:"close",value:function(t){if(this._workerSocket&&(this._workerSocket.postMessage({cmd:"stop",code:t}),this._workerSocket.terminate(),this._workerSocket=null),Ye)return Q.offSocketClose(),Q.offSocketMessage(),Q.offSocketOpen(),Q.offSocketError(),void Q.closeSocket();this._socket&&(Z?(this._socket.onClose(function(){}),this._socket.onOpen(function(){}),this._socket.onMessage(function(){}),this._socket.onError(function(){})):ke&&(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null),ln?this._socket.close({code:t}):this._socket.close(t),this._socket=null)}},{key:"send",value:function(t){if(this._workerSocket)this._workerSocket.postMessage({cmd:"sendMessage",data:this._canIUseBinaryFrame?Uo(t.data).buffer:t.data});else{if(Ye)return void Q.sendSocketMessage({data:t.data,fail:function(){t.fail&&t.requestID&&t.fail(t.requestID)}});this._socket&&(Z?this._socket.send({data:this._canIUseBinaryFrame?Uo(t.data).buffer:t.data,fail:function(){t.fail&&t.requestID&&t.fail(t.requestID)}}):ke&&this._socket.send(this._canIUseBinaryFrame?Uo(t.data):t.data))}}}]),c}(),ec=4e3,Pr=4001,tc=["keyMap"],nc=["keyMap"],nn="connected",br="connecting",Rn="disconnected",oc=function(){function c(t){F(this,c),this._channelModule=t,this._n="SocketHandler",this._promiseMap=new Map,this._readyState=Rn,this._simpleRequestMap=new Map,this.MAX_SIZE=100,this._startSequence=He(),this._startTs=0,this._reConnectFlag=!1,this._nextPingTs=0,this._reConnectCount=0,this.MAX_RECONNECT_COUNT=3,this._socketID=-1,this._random=0,this._socket=null,this._url="",this._onOpenTs=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0,this._setWebsocketHost(),this._initConnection()}return q(c,[{key:"_setWebsocketHost",value:function(){var t=this._channelModule.getModule(X),s=Fn;this._channelModule.isOversea()&&(s=ei),t.isSingaporeSite()?s=ti:t.isKoreaSite()?s=ni:t.isGermanySite()?s=oi:t.isIndiaSite()?s=si:t.isJapanSite()?s=ai:t.isUSASite()&&(s=ri),I.HOST.setCurrent(s)}},{key:"_initConnection",value:function(){S(I.HOST.CURRENT.BACKUP)||this._url===""?this._url=I.HOST.CURRENT.DEFAULT:this._url===I.HOST.CURRENT.DEFAULT?this._url=I.HOST.CURRENT.BACKUP:this._url===I.HOST.CURRENT.BACKUP?this._url=this._canIUseAnyCast()?I.HOST.CURRENT.ANYCAST:I.HOST.CURRENT.DEFAULT:this._url===I.HOST.CURRENT.ANYCAST&&(I.HOST.CURRENT.ANYCAST="",this._url=I.HOST.CURRENT.DEFAULT);var t=this._channelModule.getModule(X).getProxyServer();R(t)||(this._url=t),this._connect(),this._nextPingTs=0}},{key:"_canIUseAnyCast",value:function(){return ke&&I.HOST.CURRENT.ANYCAST}},{key:"onCheckTimer",value:function(t){t%1==0&&this._checkPromiseMap()}},{key:"_checkPromiseMap",value:function(){var t=this;this._promiseMap.size!==0&&this._promiseMap.forEach(function(s,e){var n=s.reject,o=s.timestamp,a=15e3;e.indexOf(In)!==-1?a=9e4:e.indexOf(go)!==-1&&(a=3e3),Date.now()-o>=a&&(h.l("".concat(t._n,"._checkPromiseMap request timeout, delete requestID:").concat(e)),t._promiseMap.delete(e),n(new oe({code:k.NETWORK_TIMEOUT})),t._channelModule.onRequestTimeout(e))})}},{key:"onOpen",value:function(t){if(this._readyState!==""){this._onOpenTs=Date.now();var s=t.id,e=t.res;this._socketID=s;var n=Date.now()-this._startTs,o="socketID:".concat(s," res:").concat(e);h.l("".concat(this._n,"._onOpen cost:").concat(n," ms. ").concat(o)),new L("wsOnOpen").setMessage(n).setCostTime(n).setMoreMessage(o).end(),t.id===this._socketID&&(this._readyState=nn,this._reConnectCount=0,this._resend(),this._reConnectFlag===!0&&(this._channelModule.onReconnected(),this._reConnectFlag=!1),this._channelModule.onOpen())}}},{key:"onClose",value:function(t){var s=new L("wsOnClose"),e=t.id,n=t.e,o="sourceSocketID:".concat(e," currentSocketID:").concat(this._socketID," code:").concat(n.code," reason:").concat(n.reason),a=0;this._onOpenTs!==0&&(a=Date.now()-this._onOpenTs),s.setMessage(a).setCostTime(a).setMoreMessage(o).setCode(n.code).end(),h.l("".concat(this._n,"._onClose ").concat(o," onlineTime:").concat(a)),e===this._socketID&&(this._readyState=Rn,a<1e3?this._channelModule.onReconnectFailed():this._channelModule.onClose())}},{key:"onError",value:function(t){var s=t.id,e=t.e,n="sourceSocketID:".concat(s," currentSocketID:").concat(this._socketID);new L("wsOnError").setMessage(e.errMsg||hs(e)).setMoreMessage(n).setLevel("error").end(),h.w("".concat(this._n,"._onError"),e,n),s===this._socketID&&(this._readyState="",this._channelModule.onError())}},{key:"onMessage",value:function(t){var s;try{s=JSON.parse(t.data)}catch{new L("jsonParseError").setMessage(t.data).end()}if(s&&s.head){var e=this._getRequestIDFromHead(s.head),n=s.body;if(!this._isTRTCCommand(e)){var o=jn(s.head);n=Oo(s.body,this._getResponseKeyMap(o))}if(h.d("".concat(this._n,".onMessage ret:").concat(JSON.stringify(n)," requestID:").concat(e," has:").concat(this._promiseMap.has(e))),this._setNextPingTs(),this._promiseMap.has(e)){var a=this._promiseMap.get(e),r=a.resolve,i=a.reject,u=a.timestamp;return this._promiseMap.delete(e),this._calcRTT(u),void(n.errorCode&&n.errorCode!==0?(this._channelModule.onErrorCodeNotZero(n),i(new oe({code:n.errorCode,message:n.errorInfo||"",data:e.includes(io)||e.includes(co)?{elements:n.elements,messageVersion:n.messageVersion,cloudCustomData:n.cloudCustomData}:void 0}))):r(x(n)))}this._channelModule.onMessage({head:s.head,body:n})}}},{key:"_isTRTCCommand",value:function(t){for(var s=this._channelModule.getModule(oo).getCommandList(),e=!1,n=0;n<s.length;n++)if(t.startsWith(s[n])){e=!0;break}return e}},{key:"_calcRTT",value:function(t){var s=Date.now()-t;this._channelModule.getModule(Re).addRTT(s)}},{key:"_connect",value:function(){this._startTs=Date.now(),this._onOpenTs=0,this._socket=new $u(this),this._socketID=this._socket.getID(),this._readyState=br,h.l("".concat(this._n,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new L("wsConnect").setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end()}},{key:"getURL",value:function(){this._channelModule.isDevMode()&&(this._canIUseBinaryFrame=!1);var t=ys();(Ye||rt&&t==="windows"||je)&&(this._canIUseBinaryFrame=!1);var s=-1;t==="ios"?s=vi||-1:t==="android"&&(s=Mi||-1);var e=this._channelModule.getModule(X),n=this._channelModule.getPlatform(),o=e.getSDKAppID(),a=e.getInstanceID(),r="sdkappid=".concat(o,"&instanceid=").concat(a,"&random=").concat(this._getRandom(),"&platform=").concat(n,"&host=").concat(t)+"&version=".concat(s,"&sdkversion=").concat("2.27.6");return gi&&(r+="&isminigame=1"),this._channelModule.canIUseInflate()&&(r+="&compress=gzip"),this._canIUseBinaryFrame?"".concat(this._url,"/binfo?").concat(r):"".concat(this._url,"/info?").concat(r)}},{key:"_closeConnection",value:function(t){h.l("".concat(this._n,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(t),this._socketID=-1,this._socket=null,this._readyState=Rn)}},{key:"_resend",value:function(){var t=this;if(h.l("".concat(this._n,"._resend reConnectFlag:").concat(this._reConnectFlag),"promiseMap.size:".concat(this._promiseMap.size," simpleRequestMap.size:").concat(this._simpleRequestMap.size)),this._promiseMap.size>0&&this._promiseMap.forEach(function(r,i){var u=r.uplinkData,l=r.resolve,d=r.reject;t._promiseMap.set(i,{resolve:l,reject:d,timestamp:Date.now(),uplinkData:u}),t._execute(i,u)}),this._simpleRequestMap.size>0){var s,e=Ee(this._simpleRequestMap);try{for(e.s();!(s=e.n()).done;){var n=N(s.value,2),o=n[0],a=n[1];this._execute(o,a)}}catch(r){e.e(r)}finally{e.f()}this._simpleRequestMap.clear()}}},{key:"send",value:function(t){var s=this;t.head.seq=this._getSequence(),t.head.reqtime=Math.floor(Date.now()/1e3),t.keyMap;var e=ft(t,tc),n=this._getRequestIDFromHead(t.head),o=JSON.stringify(e);return new Promise(function(a,r){s._promiseMap.set(n,{resolve:a,reject:r,timestamp:Date.now(),uplinkData:o}),h.d("".concat(s._n,".send uplinkData:").concat(JSON.stringify(e)," requestID:").concat(n," readyState:").concat(s._readyState)),s._readyState!==nn?s._reConnect():(s._execute(n,o),s._channelModule.getModule(Re).addRequestCount())})}},{key:"simplySend",value:function(t){t.head.seq=this._getSequence(),t.head.reqtime=Math.floor(Date.now()/1e3),t.keyMap;var s=ft(t,nc),e=this._getRequestIDFromHead(t.head),n=JSON.stringify(s);this._readyState!==nn?(this._simpleRequestMap.size<this.MAX_SIZE?this._simpleRequestMap.set(e,n):h.l("".concat(this._n,".simplySend. simpleRequestMap is full, drop request!")),this._reConnect()):this._execute(e,n)}},{key:"_execute",value:function(t,s){this._socket.send({data:s,fail:Z?this._onSendFail.bind(this):void 0,requestID:t})}},{key:"_onSendFail",value:function(t){h.l("".concat(this._n,"._onSendFail requestID:").concat(t))}},{key:"_getSequence",value:function(){var t;if(this._startSequence<2415919103)return t=this._startSequence,this._startSequence+=1,this._startSequence===2415919103&&(this._startSequence=He()),t}},{key:"_getRequestIDFromHead",value:function(t){return t.servcmd+t.seq}},{key:"_getResponseKeyMap",value:function(t){var s=this._channelModule.getKeyMap(t);return m(m({},An.response),s.response)}},{key:"_reConnect",value:function(){this._readyState!==nn&&this._readyState!==br&&this.forcedReconnect()}},{key:"forcedReconnect",value:function(){var t=this,s="".concat(this._n,".forcedReconnect");h.l("".concat(s," count:").concat(this._reConnectCount," readyState:").concat(this._readyState)),this._reConnectFlag=!0,this._resetRandom(),this._reConnectCount<this.MAX_RECONNECT_COUNT?(this._reConnectCount+=1,this._closeConnection(Pr),this._initConnection()):(this._reConnectCount=0,this._channelModule.probeNetwork().then(function(e){var n=N(e,2),o=n[0];n[1],o?(h.w("".concat(s," disconnected from wsserver but network is ok, continue...")),t._closeConnection(Pr),t._initConnection()):t._channelModule.onReconnectFailed()}))}},{key:"getReconnectFlag",value:function(){return this._reConnectFlag}},{key:"_setNextPingTs",value:function(){this._nextPingTs=Date.now()+1e4}},{key:"getNextPingTs",value:function(){return this._nextPingTs}},{key:"isConnected",value:function(){return this._readyState===nn}},{key:"canIUseBinaryFrame",value:function(){return this._canIUseBinaryFrame}},{key:"inflate",value:function(t){if(this._channelModule.canIUseInflate())return this._channelModule.getModule(so).inflate(t)}},{key:"setIsWorkerEnabled",value:function(t){h.l("".concat(this._n,".setIsWorkerEnabled flag:").concat(t)),this._isWorkerEnabled=t}},{key:"getIsWorkerEnabled",value:function(){return this._isWorkerEnabled&&St}},{key:"_getRandom",value:function(){return this._random===0&&(this._random=Math.random()),this._random}},{key:"_resetRandom",value:function(){this._random=0}},{key:"close",value:function(){h.l("".concat(this._n,".close")),this._closeConnection(ec),this._promiseMap.clear(),this._startSequence=He(),this._readyState=Rn,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}]),c}(),sc=function(c){re(s,c);var t=ie(s);function s(e){var n;if(F(this,s),(n=t.call(this,e))._n="ChannelModule",n._socketHandler=new oc($(n)),n._probing=!1,n._isAppShowing=!0,n._previousState=f.NET_STATE_CONNECTED,Z&&typeof Q.onAppShow=="function"&&typeof Q.onAppHide=="function"){var o=n._onAppHide.bind($(n)),a=n._onAppShow.bind($(n));typeof Q.offAppHide=="function"&&Q.offAppHide(o),typeof Q.offAppShow=="function"&&Q.offAppShow(a),Q.onAppHide(o),Q.onAppShow(a)}return n._timerForNotLoggedIn=-1,n._timerForNotLoggedIn=setInterval(n.onCheckTimer.bind($(n)),1e3),n._fatalErrorFlag=!1,n}return q(s,[{key:"onCheckTimer",value:function(e){this._socketHandler&&(this.isLoggedIn()?(this._timerForNotLoggedIn>0&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:"onErrorCodeNotZero",value:function(e){this.getModule(Fe).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.getModule(Fe).onMessage(e)}},{key:"send",value:function(e){return this._socketHandler?this._previousState!==f.NET_STATE_CONNECTED&&e.head.servcmd.includes(Dn)?(this.reConnect(),this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:"_sendLogViaHTTP",value:function(e){var n=I.HOST.CURRENT.STAT;return new Promise(function(o,a){var r="".concat(n,"/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e.head.sdkappid,"&reqtime=").concat(Date.now()),i=JSON.stringify(e.body),u="application/x-www-form-urlencoded;charset=UTF-8";if(Z)Q.request({url:r,data:i,method:"POST",timeout:3e3,header:{"content-type":u},success:function(){o()},fail:function(){a(new oe({code:k.NETWORK_ERROR}))}});else{var l=new XMLHttpRequest,d=setTimeout(function(){l.abort(),a(new oe({code:k.NETWORK_TIMEOUT}))},3e3);l.onreadystatechange=function(){l.readyState===4&&(clearTimeout(d),l.status===200||l.status===304?o():a(new oe({code:k.NETWORK_ERROR})))},l.open("POST",r,!0),l.setRequestHeader("Content-type",u),l.send(i)}})}},{key:"simplySend",value:function(e){return this._socketHandler?this._socketHandler.simplySend(e):Promise.reject()}},{key:"onOpen",value:function(){this._ping()}},{key:"onClose",value:function(){this._socketHandler&&this._socketHandler.getReconnectFlag()&&this._emitNetStateChangeEvent(f.NET_STATE_DISCONNECTED),this.reConnect()}},{key:"onError",value:function(){Z&&!je&&this.outputWarning("DomainNameInMP"),this._emitNetStateChangeEvent(f.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.getModule(Fe).getKeyMap(e)}},{key:"_onAppHide",value:function(){this._isAppShowing=!1}},{key:"_onAppShow",value:function(){this._isAppShowing=!0}},{key:"onRequestTimeout",value:function(e){}},{key:"onReconnected",value:function(){h.l("".concat(this._n,".onReconnected")),this._m.restartTimer(),this.getModule(Fe).onReconnected(),this._emitNetStateChangeEvent(f.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){h.l("".concat(this._n,".onReconnectFailed")),this._emitNetStateChangeEvent(f.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(f.NET_STATE_DISCONNECTED)}},{key:"reConnect",value:function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],n=!1;this._socketHandler&&(n=this._socketHandler.getReconnectFlag());var o="forcedFlag:".concat(e," fatalErrorFlag:").concat(this._fatalErrorFlag," previousState:").concat(this._previousState," reconnectFlag:").concat(n);if(h.l("".concat(this._n,".reConnect ").concat(o)),!this._fatalErrorFlag&&this._socketHandler){if(e===!0)this._socketHandler.forcedReconnect();else{if(this._previousState===f.NET_STATE_CONNECTING&&n)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(f.NET_STATE_CONNECTING)}}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(h.l("".concat(this._n,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),this._previousState=e,this.emitOuterEvent(W.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e=this;if(this._probing!==!0){this._probing=!0;var n=this.getModule(Fe).getProtocolData({protocolName:go});this.send(n).then(function(){e._probing=!1}).catch(function(o){if(h.w("".concat(e._n,"._ping failed. error:"),o),e._probing=!1,o&&o.code===60002)return new L("error").setMessage("code:".concat(o.code," message:").concat(o.message)).setNetworkType(e.getModule(gt).getNetworkType()).end(),e._fatalErrorFlag=!0,void e._emitNetStateChangeEvent(f.NET_STATE_DISCONNECTED);e.probeNetwork().then(function(a){var r=N(a,2),i=r[0],u=r[1];h.l("".concat(e._n,"._ping failed. probe network, isAppShowing:").concat(e._isAppShowing," online:").concat(i," networkType:").concat(u)),i?e.reConnect():e._emitNetStateChangeEvent(f.NET_STATE_DISCONNECTED)})})}}},{key:"_checkNextPing",value:function(){this._socketHandler&&this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping()}},{key:"canIUseInflate",value:function(){return this._m.canIUseInflate()}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),this._timerForNotLoggedIn>-1&&clearInterval(this._timerForNotLoggedIn)}},{key:"onRestApiKickedOut",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._previousState=f.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3)}}]),s}(le),ac=["a2","tinyid"],rc=["a2","tinyid"],ic=function(){function c(t){F(this,c),this._n="ProtocolHandler",this._sessionModule=t,this._configMap=new Map,this._fillConfigMap()}return q(c,[{key:"_fillConfigMap",value:function(){this._configMap.clear();var t=this._sessionModule.genCommonHead(),s=this._sessionModule.genCosSpecifiedHead(),e=this._sessionModule.genSSOReportHead(),n=this._sessionModule.isIntl();this._configMap.set(In,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STATUS,".").concat(I.CMD.LOGIN)}),body:{state:"Online",isWebUniapp:0,deviceBrand:0},keyMap:{request:{deviceBrand:"InstType"},response:{InstId:"instanceID",HelloInterval:"helloInterval"}}}}(t)),this._configMap.set(bs,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STATUS,".").concat(I.CMD.LOGOUT)}),body:{type:0},keyMap:{request:{type:"wslogout_type"}}}}(t)),this._configMap.set(ws,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STATUS,".").concat(I.CMD.HELLO)}),body:{isWebUniapp:0},keyMap:{response:{NewInstInfo:"newInstanceInfo"}}}}(t)),this._configMap.set(Ui,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.STAT_SERVICE,".").concat(I.CMD.KICK_OTHER)}),body:{}}}(t)),this._configMap.set($a,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_COS_SIGN,".").concat(I.CMD.COS_SIGN)}),body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{request:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},response:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}}(s)),this._configMap.set(er,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.CUSTOM_UPLOAD,".").concat(I.CMD.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{request:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},response:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}}(s)),this._configMap.set(tr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.CUSTOM_UPLOAD,".").concat(I.CMD.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{request:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},response:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}}(s)),this._configMap.set(ar,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_CONFIG_MANAGER,".").concat(I.CMD.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{request:{SDKAppID:"uint32_sdkappid"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(t)),this._configMap.set(xi,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_CONFIG_MANAGER,".").concat(I.CMD.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(t)),this._configMap.set(sr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_CONFIG_MANAGER,".").concat(I.CMD.FETCH_CLOUD_CONTROL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{request:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(t)),this._configMap.set(qi,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_CONFIG_MANAGER,".").concat(I.CMD.PUSHED_CLOUD_CONTROL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(t)),this._configMap.set(Vi,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OVERLOAD_PUSH,".").concat(I.CMD.OVERLOAD_NOTIFY)}),body:{},keyMap:{response:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}}(t)),this._configMap.set(Fs,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.GET_MESSAGES)}),body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0,needSignaling:1},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},response:{MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",ClientSeq:"clientSequence",MsgSeq:"sequence",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgRandom:"random",MsgTimeStamp:"time",MsgContent:"content",ToGroupId:"to",MsgKey:"messageKey",GroupTips:"groupTips",MsgBody:"elements",MsgType:"type",C2CRemainingUnreadCount:"C2CRemainingUnreadList",C2CPairUnreadCount:"C2CPairUnreadList"}}}}(t)),n||(this._configMap.set(qs,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.BIG_DATA_HALLWAY_AUTH_KEY)}),body:{}}}(t)),this._configMap.set(mr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_MSG_AUDIT_MGR,".").concat(I.CMD.GET_RPOFANITY_LIST)}),body:{version:0,deviceID:"",startIndex:void 0},keyMap:{request:{version:"uint64_version",deviceID:"str_device_id",startIndex:"uint64_start_index"},response:{msg_cmd_error_code:"errorInfo",str_err_msg:"errorMessage",uint32_code:"errorCode",msg_scene_ctl_config:"filterConfig",uint64_c2c_custom_msg_flag:"c2c_custom_message",uint64_c2c_text_msg_flag:"c2c_text_message",uint64_group_custom_msg_flag:"group_custom_message",uint64_group_text_msg_flag:"group_text_message",uint64_group_info_flag:"group_profile",uint64_group_member_info_flag:"group_member_profile",uint64_relation_chain_flag:"sns",uint64_user_info_flag:"user_profile",rpt_msg_dirty_word:"lexicon",str_dirty_word:"profanity",str_replaced_content:"replacement",uint64_filter_type:"filterType",uint64_id:"id",uint64_word_type:"profanityType",uint64_complete_flag:"completeFlag",uint64_next_start_index:"nextStartIndex",uint64_version:"version",uint64_expired_time:"expiredTime"}}}}(t))),this._configMap.set(ao,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.SEND_MESSAGE)}),body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",count:"MaxCnt",lastMessageTime:"LastMsgTime",messageKey:"MsgKey",peerAccount:"Peer_Account",data:"Data",description:"Desc",extension:"Ext",type:"MsgType",content:"MsgContent",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",nick:"From_AccountNick",avatar:"From_AccountHeadurl",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"IsNeedReadReceipt"}}}}(t)),this._configMap.set(ro,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.SEND_GROUP_MESSAGE)}),body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0},keyMap:{request:{to:"GroupId",extension:"Ext",data:"Data",description:"Desc",random:"Random",sequence:"ReqMsgSeq",count:"ReqMsgNumber",type:"MsgType",priority:"MsgPriority",content:"MsgContent",elements:"MsgBody",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",clientSequence:"ClientSeq",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"NeedReadReceipt",receiverList:"To_Account"},response:{MsgTime:"time",MsgSeq:"sequence"}}}}(t)),this._configMap.set(Ws,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.REVOKE_C2C_MESSAGE)}),body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{request:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}}(t)),this._configMap.set(Da,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.REVOKE_GROUP_MESSAGE)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{request:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}}(t)),this._configMap.set(Cn,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.GET_C2C_ROAM_MESSAGES)}),body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{request:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},response:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer"}}}}(t)),this._configMap.set(io,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.MODIFY_C2C_MESSAGE)}),body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(t)),this._configMap.set(Tn,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.GET_GROUP_ROAM_MESSAGES)}),body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{request:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},response:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",IsPlaceMsg:"isPlaceMessage",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgPriority:"priority",MsgBody:"elements",MsgType:"type",MsgContent:"content",IsFinished:"complete",Download_Flag:"downloadFlag",ClientSeq:"clientSequence",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList"}}}}(t)),this._configMap.set(Ys,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.SET_C2C_MESSAGE_READ)}),body:{C2CMsgReaded:void 0},keyMap:{request:{lastMessageTime:"LastedMsgTime"}}}}(t)),this._configMap.set(js,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{request:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}}(t)),this._configMap.set(zs,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{updateSequence:0},keyMap:{response:{MuteNotificationsList:"muteFlagList"}}}}(t)),this._configMap.set(ka,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.SET_GROUP_MESSAGE_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{request:{messageReadSeq:"MsgReadedSeq"}}}}(t)),this._configMap.set(Sa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.SET_ALL_MESSAGE_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{request:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},response:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}}(t)),this._configMap.set(Xs,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.DELETE_C2C_MESSAGE)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{request:{keyList:"MsgKeyList"}}}}(t)),this._configMap.set(ba,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.DELETE_GROUP_MESSAGE)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{request:{deleter:"Deleter_Account",keyList:"Seqs"}}}}(t)),this._configMap.set(vr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_TRANSLATE,".").concat(I.CMD.TRANSLATE_TEXT)}),body:{sourceTextList:void 0,SDKAppID:0,from:0,source:"",target:""},keyMap:{request:{sourceTextList:"SourceText",SDKAppID:"SdkAppId",from:"FromAccount"},response:{TargetText:"translatedTextList",RequestId:"requestID",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}}(t)),this._configMap.set(co,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.MODIFY_GROUP_MESSAGE)}),body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(t)),this._configMap.set(Ea,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequence:"MsgSeq"}}}}(t)),this._configMap.set(Aa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:"",messageInfoList:void 0},keyMap:{request:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}}(t)),this._configMap.set(La,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}}(t)),this._configMap.set(Ra,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.GET_READ_RECEIPT_DETAIL)}),body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{request:{sequence:"MsgSeq",count:"Num"},response:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}}(t)),this._configMap.set(Zs,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM_MSG_EXT,".").concat(I.CMD.MODIFY_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}}(t)),this._configMap.set(Qs,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM_MSG_EXT,".").concat(I.CMD.GET_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}}(t)),this._configMap.set(lo,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM_MSG_EXT,".").concat(I.CMD.MODIFY_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}}(t)),this._configMap.set(po,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM_MSG_EXT,".").concat(I.CMD.GET_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,startSequence:void 0}}}(t)),this._configMap.set(Js,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.GET_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{request:{userIDList:"To_Account"},response:{ReadTime:"peerReadTimeList"}}}}(t)),this._configMap.set(Pi,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,count:0},keyMap:{request:{},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime"}}}}(t)),this._configMap.set($s,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.PAGING_GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:4,assistFlag:15},keyMap:{request:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex",GroupId:"convGroupID"}}}}(t)),this._configMap.set(ea,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.DELETE_CONVERSATION)}),body:{fromAccount:"",conversationList:void 0,clearHistoryMessage:void 0},keyMap:{request:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble",conversationList:"ContactItem"},response:{ResultItem:"resultList",ToGroupid:"groupID",ResultCode:"code",ResultInfo:"info"}}}}(t)),this._configMap.set(ta,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.CLEAR_HISTORY_MESSAGE)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{request:{toGroupID:"ToGroupid"}}}}(t)),this._configMap.set(na,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.PIN_CONVERSATION)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{request:{itemList:"RecentContactItem"}}}}(t)),this._configMap.set(oa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.DELETE_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(t)),this._configMap.set(sa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(t)),this._configMap.set(aa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(t)),this._configMap.set(ra,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.CREATE_CONVERSATION_GROUP)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"GroupContactItem",groupID:"ToGroupId"},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType"}}}}(t)),this._configMap.set(ia,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.DELETE_CONVERSATION_GROUP)}),body:{fromAccount:"",groupName:void 0},keyMap:{request:{},response:{GroupId:"convGroupID"}}}}(t)),this._configMap.set(ua,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{oldName:"OldGroupName",newName:"NewGroupName",groupID:"ToGroupId",operationType:"ContactOptType",groupName:"OldGroupName",updateItem:"ContactUpdateItem"},response:{ContactOptType:"operationType",ToGroupId:"groupID",GroupId:"convGroupID"}}}}(t)),this._configMap.set(ca,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}},keyMap:{request:{},response:{}}}}(t)),this._configMap.set(la,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{},response:{}}}}(t)),this._configMap.set(da,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.RECENT_CONTACT,".").concat(I.CMD.GET_CONVERSATION_GROUP_LIST)}),body:{fromAccount:"",startTime:void 0,startIndex:void 0},keyMap:{request:{},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList"}}}}(t)),this._configMap.set(xs,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.PROFILE,".").concat(I.CMD.PORTRAIT_GET)}),body:{fromAccount:"",userItem:[]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(t)),this._configMap.set(Vs,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.PROFILE,".").concat(I.CMD.PORTRAIT_SET)}),body:{fromAccount:"",profileItem:[{tag:_e.NICK,value:""},{tag:_e.GENDER,value:""},{tag:_e.ALLOWTYPE,value:""},{tag:_e.AVATAR,value:""}]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(t)),this._configMap.set(Bs,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.FRIEND,".").concat(I.CMD.GET_BLACKLIST)}),body:{fromAccount:"",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{response:{CurruentSequence:"currentSequence"}}}}(t)),this._configMap.set(Hs,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.FRIEND,".").concat(I.CMD.ADD_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(t)),this._configMap.set(Ks,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.FRIEND,".").concat(I.CMD.DELETE_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(t)),this._configMap.set(lr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STATUS,".").concat(I.CMD.SET_SELF_STATUS)}),body:{customStatus:""},keyMap:{}}}(t)),this._configMap.set(dr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STATUS,".").concat(I.CMD.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}}(t)),this._configMap.set(pr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STATUS,".").concat(I.CMD.SUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(t)),this._configMap.set(gr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STATUS,".").concat(I.CMD.UNSUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(t)),this._configMap.set(uo,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.GET_JOINED_GROUPS)}),body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0},keyMap:{request:{memberAccount:"Member_Account"},response:{GroupIdList:"groups",NoUnreadSeqList:"excludedUnreadSequenceList",MsgSeq:"readedSequence",LastRecallTime:"_lastRevokedTime"}}}}(t)),this._configMap.set(pa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.GET_GROUP_INFO)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember"],groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{request:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}}(t)),this._configMap.set(ga,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.CREATE_GROUP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:"",isSupportTopic:void 0,inviteOption:void 0},keyMap:{request:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",inviteOption:"InviteJoinOption"},response:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}}(t)),this._configMap.set(ha,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.DESTROY_GROUP)}),body:{groupID:void 0}}}(t)),this._configMap.set(_a,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.MODIFY_GROUP_INFO)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0,inviteOption:void 0},keyMap:{request:{groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl",inviteOption:"InviteJoinOption"},response:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}}(t)),this._configMap.set(fa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{request:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},response:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}}(t)),this._configMap.set(ma,function(o){return o.a2,o.tinyid,{head:m(m({},ft(o,ac)),{},{servcmd:"".concat(I.NAME.BIG_GROUP_NO_AUTH,".").concat(I.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{request:{applyMessage:"ApplyMsg"},response:{HugeGroupFlag:"avChatRoomFlag"}}}}(t)),this._configMap.set(va,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.QUIT_GROUP)}),body:{groupID:void 0}}}(t)),this._configMap.set(Ma,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.SEARCH_GROUP_BY_ID)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"]}},keyMap:{response:{}}}}(t)),this._configMap.set(ya,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.CHANGE_GROUP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{request:{newOwnerID:"NewOwner_Account"}}}}(t)),this._configMap.set(Ia,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.HANDLE_APPLY_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(t)),this._configMap.set(Ca,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.HANDLE_INVITE_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,invitee:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",invitee:"Invited_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg"}}}}(t)),this._configMap.set(Ta,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.HANDLE_GROUP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(t)),this._configMap.set(Na,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.GET_GROUP_APPLICATION)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{request:{handleAccount:"Handle_Account"},response:{To_Account:"userID"}}}}(t)),this._configMap.set(Oa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.DELETE_GROUP_SYSTEM_MESSAGE)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(t)),this._configMap.set(Ga,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.BIG_GROUP_LONG_POLLING,".").concat(I.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(t)),this._configMap.set(Ua,function(o){return o.a2,o.tinyid,{head:m(m({},ft(o,rc)),{},{servcmd:"".concat(I.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,".").concat(I.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(t)),this._configMap.set(Pa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.GET_ONLINE_MEMBER_NUM)}),body:{groupID:void 0}}}(t)),this._configMap.set(wa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.SET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(t)),this._configMap.set(Fa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.MODIFY_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(t)),this._configMap.set(qa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.DELETE_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key"}}}}(t)),this._configMap.set(xa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.CLEAR_GROUP_ATTRIBUTES)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}}(t)),this._configMap.set(Va,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP_ATTR,".").concat(I.CMD.GET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{request:{avChatRoomKey:"Key",groupType:"GroupType"}}}}(t)),this._configMap.set(Ba,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.GET_GROUP_NOTIFY)}),body:{notifyType:1,groupID:"",beginTime:0,endTime:0,limit:20},keyMap:{request:{},response:{NextMsgTime:"nextRevokedTime",NotifyMsgList:"notifyList"}}}}(t)),this._configMap.set(Ha,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.UPDATE_GROUP_COUNTER)}),body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{request:{counterList:"GroupCounter"}}}}(t)),this._configMap.set(Ka,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.GET_GROUP_COUNTER)}),body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{request:{keyList:"GroupCounterKeys"}}}}(t)),this._configMap.set(rr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP_COMMUNITY,".").concat(I.CMD.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{request:{avatar:"FaceUrl"}}}}(t)),this._configMap.set(ir,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP_COMMUNITY,".").concat(I.CMD.DELETE_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:"TopicIdList"},response:{DestroyResultItem:"resultList"}}}}(t)),this._configMap.set(ur,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP_COMMUNITY,".").concat(I.CMD.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{request:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}}(t)),this._configMap.set(cr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP_COMMUNITY,".").concat(I.CMD.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:["NoUnreadSeqList"]},keyMap:{request:{topicIDList:"TopicIdList"},response:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence",NoUnreadSeqList:"excludedUnreadSequenceList"}}}}(t)),this._configMap.set(Wa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.GET_GROUP_MEMBER_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:["Role","NameCard","ShutUpUntil","JoinTime"],memberCustomFieldFilter:void 0},keyMap:{request:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}}(t)),this._configMap.set(Ya,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP_AVCHATROOM,".").concat(I.CMD.GET_AVCHATROOM_MEMBER_LIST)}),body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{request:{offset:"Timestamp",filter:"Mark"},response:{NextTimestamp:"offset"}}}}(t)),this._configMap.set(ja,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.GET_GROUP_MEMBER_INFO)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{request:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}}(t)),this._configMap.set(za,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.ADD_GROUP_MEMBER)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{request:{userID:"Member_Account",userIDList:"MemberList"},response:{MemberList:"members"}}}}(t)),this._configMap.set(Ja,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.DELETE_GROUP_MEMBER)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{request:{userIDList:"MemberToDel_Account"}}}}(t)),this._configMap.set(Xa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.BAN_AVCHATROOM_MEMBER)}),body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:""},keyMap:{request:{userIDList:"Members_Account",duration:"Duration",reason:"Description"}}}}(t)),this._configMap.set(Za,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP,".").concat(I.CMD.MODIFY_GROUP_MEMBER_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{request:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}}(t)),this._configMap.set(Qa,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.GROUP_AVCHATROOM,".").concat(I.CMD.MARK_AVCHATROOM_MEMBER_INFO)}),body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{request:{operationType:"CommandType",memberList:"MemberList",markType:"Marks",userID:"Member_Account"},response:{CommandType:"operationType",Marks:"markType",Member_Account:"userID"}}}}(t)),this._configMap.set(Dn,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STAT,".").concat(I.CMD.TIM_WEB_REPORT_V2)}),body:{header:{},event:[],quality:[]},keyMap:{request:{SDKType:"sdk_type",SDKVersion:"sdk_version",deviceType:"device_type",platform:"platform",instanceID:"instance_id",traceID:"trace_id",SDKAppID:"sdk_app_id",userID:"user_id",tinyID:"tiny_id",extension:"extension",timestamp:"timestamp",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",qualityType:"quality_type",reportIndex:"report_index",wholePeriod:"whole_period",totalCount:"total_count",rttCount:"success_count_business",successRateOfRequest:"percent_business",countLessThan1Second:"success_count_business",percentOfCountLessThan1Second:"percent_business",countLessThan3Second:"success_count_platform",percentOfCountLessThan3Second:"percent_platform",successCountOfBusiness:"success_count_business",successRateOfBusiness:"percent_business",successCountOfPlatform:"success_count_platform",successRateOfPlatform:"percent_platform",successCountOfMessageReceived:"success_count_business",successRateOfMessageReceived:"percent_business",avgRTT:"average_value",avgDelay:"average_value",avgValue:"average_value",uiPlatform:"ui_platform"}}}}(e)),this._configMap.set(go,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.HEARTBEAT,".").concat(I.CMD.ALIVE)}),body:{}}}(t)),this._configMap.set(bi,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_PUSH,".").concat(I.CMD.MESSAGE_PUSH)}),body:{},keyMap:{response:{C2cMsgArray:"C2CMessageArray",GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",C2cNotifyMsgArray:"C2CNotifyMessageArray",C2cMsgInfo:"C2CReadReceiptArray",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyAdd_Account:"userID",ProfileImNick:"nick",PendencyType:"applicationType",C2CReadAllMsg:"readAllC2CMessage",IsNeedReadReceipt:"needReadReceipt",Status:"statusType"}}}}(t)),this._configMap.set(wi,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_PUSH,".").concat(I.CMD.MULTI_MESSAGE_PUSH)}),body:{},keyMap:{response:{GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyType:"applicationType"}}}}(t)),this._configMap.set(ho,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.OPEN_IM,".").concat(I.CMD.MESSAGE_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{request:{sessionData:"SessionData"}}}}(t)),this._configMap.set(Fi,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STATUS,".").concat(I.CMD.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{response:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}}(t)),this._configMap.set(or,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_LONG_MESSAGE,".").concat(I.CMD.DOWNLOAD_MERGER_MESSAGE)}),body:{downloadKey:""},keyMap:{response:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}}(t)),this._configMap.set(nr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_LONG_MESSAGE,".").concat(I.CMD.UPLOAD_MERGER_MESSAGE)}),body:{messageList:[]},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",type:"MsgType",content:"MsgContent",data:"Data",description:"Desc",extension:"Ext",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody"}}}}(t)),this._configMap.set(fr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STATUS,".").concat(I.CMD.SET_TOKEN)}),body:{tokenID:"",pushMsg:0,sdkAppID:0,businessID:"",deviceBrand:"",deviceToken:"",isTpns:0,isWebUniapp:0},keyMap:{request:{tokenID:"TokenID",pushMsg:"PushMsg",sdkAppID:"EnterVersion",businessID:"BusiID",deviceBrand:"InstType",deviceToken:"VarToken",isTpns:"IsTpns"}}}}(t)),this._configMap.set(_r,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STATUS,".").concat(I.CMD.STAT_FOREGROUND)}),body:{isWebUniapp:0}}}(t)),this._configMap.set(hr,function(o){return{head:m(m({},o),{},{servcmd:"".concat(I.NAME.IM_OPEN_STATUS,".").concat(I.CMD.STAT_BACKGROUND)}),body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{request:{c2cUnreadCount:"C2cUnread",groupUnreadCount:"GrpUnread"}}}}(t))}},{key:"has",value:function(t){return this._configMap.has(t)}},{key:"get",value:function(t){return this._configMap.get(t)}},{key:"update",value:function(){this._fillConfigMap()}},{key:"getKeyMap",value:function(t){return this.has(t)?this.get(t).keyMap||{}:(h.w("".concat(this._n,".getKeyMap unknown protocolName:").concat(t)),{})}},{key:"getProtocolData",value:function(t){var s=t.protocolName,e=t.requestData,n=this.get(s),o=null;if(e){var a=this._simpleDeepCopy(n),r=this._updateService(e,a),i=r.body,u=Object.create(null);for(var l in i)if(Object.prototype.hasOwnProperty.call(i,l)){if(u[l]=i[l],e[l]===void 0)continue;u[l]=e[l]}r.body=u,o=this._getUplinkData(r)}else o=this._getUplinkData(n);return o}},{key:"_getUplinkData",value:function(t){var s=this._requestDataCleaner(t),e=jn(s.head),n=Zu(s.body,this._getRequestKeyMap(e));return s.body=n,s}},{key:"_updateService",value:function(t,s){var e=jn(s.head);if(this._isFromGroupRequest(s)){var n=t.type,o=t.groupID,a=o===void 0?void 0:o,r=t.groupIDList,i=r===void 0?[]:r;S(a)&&(a=i[0]||""),Oe({type:n,groupID:a})&&(s.head.servcmd="".concat(I.NAME.GROUP_COMMUNITY,".").concat(e))}return s}},{key:"_isFromGroupRequest",value:function(t){return t.head.servcmd.includes(I.NAME.GROUP)||t.head.servcmd.includes(I.NAME.GROUP_ATTR)}},{key:"_getRequestKeyMap",value:function(t){var s=this.getKeyMap(t);return m(m({},An.request),s.request)}},{key:"_requestDataCleaner",value:function(t){var s=Array.isArray(t)?[]:Object.create(null);for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&gs(e)&&t[e]!==null&&t[e]!==void 0&&(_t(t[e])!=="object"?s[e]=t[e]:s[e]=this._requestDataCleaner.bind(this)(t[e]));return s}},{key:"_simpleDeepCopy",value:function(t){for(var s,e=Object.keys(t),n={},o=0,a=e.length;o<a;o++)s=e[o],b(t[s])?n[s]=Array.from(t[s]):lt(t[s])?n[s]=this._simpleDeepCopy(t[s]):n[s]=t[s];return n}}]),c}(),uc=[ho],cc=function(){function c(t){F(this,c),this._sessionModule=t,this._n="DownlinkHandler",this._eventHandlerMap=new Map,this._eventHandlerMap.set("C2CMessageArray",this._c2cMessageArrayHandler.bind(this)),this._eventHandlerMap.set("groupMessageArray",this._groupMessageArrayHandler.bind(this)),this._eventHandlerMap.set("groupTips",this._groupTipsHandler.bind(this)),this._eventHandlerMap.set("C2CNotifyMessageArray",this._C2CNotifyMessageArrayHandler.bind(this)),this._eventHandlerMap.set("C2CReadReceiptArray",this._C2CReadReceiptArrayHandler.bind(this)),this._eventHandlerMap.set("profileModify",this._profileHandler.bind(this)),this._eventHandlerMap.set("friendListMod",this._relationChainHandler.bind(this)),this._eventHandlerMap.set("recentContactMod",this._recentContactHandler.bind(this)),this._eventHandlerMap.set("readAllC2CMessage",this._allMessageReadHandler.bind(this)),this._eventHandlerMap.set("c2cMessageModified",this._c2cMessageModifiedHandler.bind(this)),this._eventHandlerMap.set("groupMessageModified",this._groupMessageModifiedHandler.bind(this)),this._eventHandlerMap.set("userStatusList",this._userStatusListHandler.bind(this)),this._eventHandlerMap.set("messageExtensionNotify",this._messageExtensionNotifyHandler.bind(this)),this._keys=B(this._eventHandlerMap.keys())}return q(c,[{key:"_c2cMessageArrayHandler",value:function(t){var s=this._sessionModule.getModule(fe);s&&(t.dataList.forEach(function(e){if(e.isSyncMessage===1){var n=e.from;e.from=e.to,e.to=n}}),t.needSync===1&&this._sessionModule.getModule(no).startOnlineSync(),s.onNewC2CMessage({dataList:t.dataList,isInstantMessage:!0}))}},{key:"_c2cMessageModifiedHandler",value:function(t){var s=this._sessionModule.getModule(fe);s&&s.onC2CMessageModified(t)}},{key:"_groupMessageArrayHandler",value:function(t){var s=this._sessionModule.getModule(V);s&&s.onNewGroupMessage({event:t.event,dataList:t.dataList,isInstantMessage:!0})}},{key:"_groupMessageModifiedHandler",value:function(t){var s=this._sessionModule.getModule(V);s&&s.onGroupMessageModified(t)}},{key:"_groupTipsHandler",value:function(t){var s=this._sessionModule.getModule(V);if(s){var e=t.event,n=t.dataList,o=t.isInstantMessage,a=o===void 0||o,r=t.isSyncingEnded;switch(e){case 4:case 6:s.onNewGroupTips({event:e,dataList:n});break;case 5:for(var i=0;i<n.length;i++)if(b(n[i].elements.revokedInfos))s.onGroupMessageRevoked({dataList:n});else if(b(n[i].elements.groupMessageReadNotice))s.onGroupMessageReadNotice({dataList:n});else{if(!b(n[i].elements.readReceiptList)){s.onNewGroupSystemNotice({dataList:n,isInstantMessage:a,isSyncingEnded:r});break}s.onReadReceiptList({dataList:n})}break;case 12:this._sessionModule.getModule(P).onNewGroupAtTips({dataList:n});break;default:h.l("".concat(this._n,"._groupTipsHandler unknown event:").concat(e," dataList:"),n)}}}},{key:"_C2CNotifyMessageArrayHandler",value:function(t){var s=this,e=t.dataList;if(b(e)){var n=this._sessionModule.getModule(fe);e.forEach(function(o){if(ne(o))if(o.hasOwnProperty("kickoutMsgNotify")){var a=o.kickoutMsgNotify,r=a.kickType,i=a.newInstanceInfo,u=i===void 0?{}:i;r===1?s._sessionModule.onMultipleAccountKickedOut(u):r===2?s._sessionModule.onMultipleDeviceKickedOut(u):r===3&&s._sessionModule.onRestApiKickedOut(u)}else o.hasOwnProperty("c2cMessageRevokedNotify")?n&&n.onC2CMessageRevoked({dataList:e}):o.hasOwnProperty("c2cMessageReadReceipt")?n&&n.onC2CMessageReadReceipt({dataList:e}):o.hasOwnProperty("c2cMessageReadNotice")?n&&n.onC2CMessageReadNotice({dataList:e}):o.hasOwnProperty("muteNotificationsSync")&&s._sessionModule.getModule(P).onC2CMessageRemindTypeSynced({dataList:e})})}}},{key:"_C2CReadReceiptArrayHandler",value:function(t){this._sessionModule.getModule(fe).onReadReceiptList(t)}},{key:"_profileHandler",value:function(t){this._sessionModule.getModule(pe).onProfileModified({dataList:t.dataList});var s=this._sessionModule.getModule(ce);s&&s.onFriendProfileModified({dataList:t.dataList})}},{key:"_relationChainHandler",value:function(t){this._sessionModule.getModule(pe).onRelationChainModified({dataList:t.dataList});var s=this._sessionModule.getModule(ce);s&&s.onRelationChainModified({dataList:t.dataList})}},{key:"_recentContactHandler",value:function(t){var s=t.dataList;if(b(s)){var e=this._sessionModule.getModule(P);e&&s.forEach(function(n){var o=n.pushType;if(o===1){var a=n.recentContactDeleteItem;e.onConversationDeleted(a.recentContactList)}else if(o===2){var r=n.recentContactTopItem;e.onConversationPinned(r.recentContactList)}else if(o===3){var i=n.recentContactTopItem;e.onConversationUnpinned(i.recentContactList)}else if(o===4){var u=n.recentContactMarkContact;e.onConversationMarkUpdated(u.recentContactMarkContactItem)}else if(o===5){var l=n.recentContactCreateContactGroup;e.onConversationGroupCreated(l.msgContactGroupContactItem)}else if(o===6){var d=n.recentContactDelContactGroup;e.onConversationGroupDeleted(d.msgGroupItem)}else if(o===7){var p=n.recentContactUpdateContactGroup,g=p.updateType,_=p.msgUpdateGroup,v=p.msgUpdateContact;if(g===1){var M=_.updateGroupType;M===1?e.onConversationGroupNameUpdated(_):M===2&&e.onConversationInGroupUpdated(_)}else g===2&&e.onConversationAddedToOrDeletedFromGroup(v)}})}}},{key:"_allMessageReadHandler",value:function(t){var s=t.dataList,e=this._sessionModule.getModule(P);e&&e.onPushedAllMessageRead(s)}},{key:"_userStatusListHandler",value:function(t){this._sessionModule.getModule(pe).onUserStatusUpdated(t)}},{key:"_messageExtensionNotifyHandler",value:function(t){this._sessionModule.getModule(Yt).onMessageExtensionNotify(t)}},{key:"onMessage",value:function(t){var s=this,e=t.body;if(this._filterMessageFromIMOpenPush(t)){var n=e.eventArray,o=e.isInstantMessage,a=e.isSyncingEnded,r=e.needSync;if(b(n))for(var i=null,u=null,l=0,d=0,p=n.length;d<p;d++){l=(i=n[d]).event;var g=Object.keys(i).find(function(_){return s._keys.indexOf(_)!==-1});g?(u=l===14?{readAllC2CMessage:i[g],groupMessageReadInfoList:i.groupMessageReadNotice||[]}:l===16?{userID:i.userID,readReceiptList:i[g]}:i[g],this._eventHandlerMap.get(g)({event:l,dataList:u,isInstantMessage:o,isSyncingEnded:a,needSync:r})):h.l("".concat(this._n,".onMessage unknown eventItem:").concat(i))}}}},{key:"_filterMessageFromIMOpenPush",value:function(t){var s=t.head,e=t.body,n=s.servcmd,o=!1;if(S(n)||(o=n.includes(I.NAME.IM_CONFIG_MANAGER)||n.includes(I.NAME.OVERLOAD_PUSH)||n.includes(I.NAME.STAT_SERVICE)),!o)return!0;if(n.includes(I.CMD.PUSHED_CLOUD_CONTROL_CONFIG))this._sessionModule.getModule(Jt).onPushedCloudControlConfig(e);else if(n.includes(I.CMD.PUSHED_COMMERCIAL_CONFIG))this._sessionModule.getModule(Zt).onPushedConfig(e);else if(n.includes(I.CMD.OVERLOAD_NOTIFY))this._sessionModule.onPushedServerOverload(e);else if(n.includes(I.CMD.KICK_OTHER)){var a=Date.now();this._sessionModule.reLoginOnKickOther();var r=new L("kickOther"),i=this._sessionModule.getModule(pt).getLastWsHelloTs(),u=a-i;r.setMessage("last wshello time:".concat(i," diff:").concat(u,"ms")).setNetworkType(this._sessionModule.getNetworkType()).end()}return!1}}]),c}(),wr=[{cmd:I.CMD.GET_GROUP_INFO,interval:1,count:20},{cmd:I.CMD.GET_AVCHATROOM_MEMBER_LIST,interval:3,count:1},{cmd:I.CMD.GET_GROUP_APPLICATION,interval:1,count:15},{cmd:I.CMD.GET_TOPIC_LIST,interval:1,count:10},{cmd:I.CMD.SET_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:I.CMD.MODIFY_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:I.CMD.DELETE_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:I.CMD.CLEAR_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:I.CMD.GET_GROUP_ATTRIBUTES,interval:5,count:20},{cmd:I.CMD.UPDATE_GROUP_COUNTER,interval:5,count:20},{cmd:I.CMD.GET_GROUP_COUNTER,interval:5,count:20},{cmd:I.CMD.SET_ALL_MESSAGE_READ,interval:1,count:1},{cmd:I.CMD.GET_USER_STATUS,interval:5,count:20},{cmd:I.CMD.SUBSCRIBE_USER_STATUS,interval:5,count:20},{cmd:I.CMD.UNSUBSCRIBE_USER_STATUS,interval:5,count:20}],lc=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="SessionModule",n._platform=n.getPlatform(),n._protocolHandler=new ic($(n)),n._messageDispatcher=new cc($(n)),n._commandFrequencyLimitMap=new Map,n._commandRequestInfoMap=new Map,n._serverOverloadInfoMap=new Map,n._init(),n.getInnerEmitterInstance().on(We,n._onCloudConfigUpdated,$(n)),n}return q(s,[{key:"_init",value:function(){this._updateCommandFrequencyLimitMap(wr)}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");S(e)||(e=JSON.parse(e),this._updateCommandFrequencyLimitMap(e))}},{key:"_updateCommandFrequencyLimitMap",value:function(e){var n=this;e.forEach(function(o){n._commandFrequencyLimitMap.set(o.cmd,{interval:o.interval,count:o.count})})}},{key:"updateProtocolConfig",value:function(){this._protocolHandler.update()}},{key:"request",value:function(e){h.d("".concat(this._n,".request options:"),e);var n=e.protocolName,o=e.tjgID;if(!this._protocolHandler.has(n))return h.w("".concat(this._n,".request unknown protocol:").concat(n)),T({code:k.CANNOT_FIND_PROTOCOL});var a=this.getProtocolData(e),r=a.head.servcmd;if(this._isFrequencyOverLimit(r))return T({code:k.OVER_FREQUENCY_LIMIT});if(this._isServerOverload(r))return T({code:k.OPEN_SERVICE_OVERLOAD_ERROR});R(o)||(a.head.tjgID=o);var i=this.getModule(Xe);return uc.includes(n)?i.simplySend(a):i.send(a)}},{key:"getKeyMap",value:function(e){return this._protocolHandler.getKeyMap(e)}},{key:"genCommonHead",value:function(){var e=this.getModule(X);return{ver:"v4",platform:this._platform,websdkappid:wn,websdkversion:bn,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:192371,tjgID:""}}},{key:"genCosSpecifiedHead",value:function(){var e=this.getModule(X);return{ver:"v4",platform:this._platform,websdkappid:wn,websdkversion:bn,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:192371}}},{key:"genSSOReportHead",value:function(){var e=this.getModule(X);return{ver:"v4",platform:this._platform,websdkappid:wn,websdkversion:bn,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:192371}}},{key:"getProtocolData",value:function(e){return this._protocolHandler.getProtocolData(e)}},{key:"trans",value:function(e){var n=e.servcmd,o=e.data,a={head:m(m({},this.genCommonHead()),{},{servcmd:n}),body:o};return this.getModule(Xe).send(a)}},{key:"sendComboMessage",value:function(e){var n=e.servcmd,o=e.data,a={head:m(m({},this.genCommonHead()),{},{servcmd:n}),body:o};return this.getModule(Xe).send(a)}},{key:"onErrorCodeNotZero",value:function(e){var n=e.errorCode;if(n===k.HELLO_ANSWER_KICKED_OUT){var o=e.kickType,a=e.newInstanceInfo,r=a===void 0?{}:a;o===1?this.onMultipleAccountKickedOut(r):o===2?this.onMultipleDeviceKickedOut(r):o===3&&this.onRestApiKickedOut(r)}n!==k.MESSAGE_A2KEY_EXPIRED&&n!==k.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.getModule(Xe).reConnect())}},{key:"onMessage",value:function(e){var n=e.body,o=n.needAck,a=o===void 0?0:o,r=n.sessionData;a===1&&this._sendACK(r),this._messageDispatcher.onMessage(e)}},{key:"onReconnected",value:function(){this._reLoginOnReconnected()}},{key:"reLoginOnKickOther",value:function(){h.l("".concat(this._n,".reLoginOnKickOther")),this._reLogin()}},{key:"_reLoginOnReconnected",value:function(){h.l("".concat(this._n,"._reLoginOnReconnected")),this._reLogin()}},{key:"_reLogin",value:function(){var e=this;if(this.isLoggedIn()){var n=0,o=this.getModule(Qt);o.canIUseOfflinePush()&&(n=o.getUniAppPlatform()),this.request({protocolName:In,requestData:{isWebUniapp:n}}).then(function(a){var r=a.data.instanceID;e.getModule(X).setStatusInstanceID(r),h.l("".concat(e._n,"._reLogin ok.")),e.getModule(P).syncConversationList().then(function(){h.l("".concat(e._n,"._reLogin, sync conversation list ok.")),e.getModule(Gs).start()}),e.getModule(V).updateLocalMainSequenceOnReconnected();var i=e.getModule(ae);i.resetGetTopicTime(),i.getTopicListOnReconnected()})}}},{key:"onMultipleAccountKickedOut",value:function(e){this.getModule(pt).onMultipleAccountKickedOut(e)}},{key:"onMultipleDeviceKickedOut",value:function(e){this.getModule(pt).onMultipleDeviceKickedOut(e)}},{key:"_onUserSigExpired",value:function(){this.getModule(pt).onUserSigExpired()}},{key:"onRestApiKickedOut",value:function(e){this.getModule(pt).onRestApiKickedOut(e)}},{key:"_sendACK",value:function(e){this.request({protocolName:ho,requestData:{sessionData:e}})}},{key:"_isFrequencyOverLimit",value:function(e){var n=e.split(".")[1];if(!this._commandFrequencyLimitMap.has(n))return!1;if(!this._commandRequestInfoMap.has(n))return this._commandRequestInfoMap.set(n,{startTime:Date.now(),requestCount:1}),!1;var o=this._commandFrequencyLimitMap.get(n),a=o.count,r=o.interval,i=this._commandRequestInfoMap.get(n),u=i.startTime,l=i.requestCount;if(Date.now()-u>1e3*r)return this._commandRequestInfoMap.set(n,{startTime:Date.now(),requestCount:1}),!1;l+=1,this._commandRequestInfoMap.set(n,{startTime:u,requestCount:l});var d=!1;return l>a&&(d=!0),d}},{key:"_isServerOverload",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var n=this._serverOverloadInfoMap.get(e),o=n.overloadTime,a=n.waitingTime,r=!1;return Date.now()-o<=1e3*a?r=!0:(this._serverOverloadInfoMap.delete(e),r=!1),r}},{key:"onPushedServerOverload",value:function(e){var n=e.overloadCommand,o=e.waitingTime;this._serverOverloadInfoMap.set(n,{overloadTime:Date.now(),waitingTime:o}),h.w("".concat(this._n,".onPushedServerOverload waitingTime:").concat(o,"s"))}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._updateCommandFrequencyLimitMap(wr),this._commandRequestInfoMap.clear(),this._serverOverloadInfoMap.clear()}}]),s}(le),dc=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="MessageLossDetectionModule",n._maybeLostSequencesMap=new Map,n._firstRoundRet=[],n}return q(s,[{key:"onMessageMaybeLost",value:function(e,n,o){this._maybeLostSequencesMap.has(e)||this._maybeLostSequencesMap.set(e,[]);for(var a=this._maybeLostSequencesMap.get(e),r=0;r<o;r++)a.indexOf(n+r)===-1&&a.push(n+r)}},{key:"detectFirstRound",value:function(e,n){var o=this._maybeLostSequencesMap.get(e);if(!R(o)&&!R(n)){var a=o.filter(function(r){return n.indexOf(r)===-1});a.length===0?h.i("".concat(this._n,".detectFirstRound no message loss. conversationID:").concat(e)):this._firstRoundRet=this._firstRoundRet.concat(a),o.length=0}}},{key:"detectSecondRound",value:function(e,n){if(!R(this._firstRoundRet)&&!R(n)){var o=this._firstRoundRet.filter(function(i){return n.indexOf(i)===-1});this._firstRoundRet.length=0;var a,r=o.length;r!==0&&(r<=5?a=e+"-"+o.join("-"):(o.sort(function(i,u){return i-u}),a=e+" start:"+o[0]+" end:"+o[r-1]+" count:"+r),new L("messageLoss").setMessage(a).setNetworkType(this.getNetworkType()).setLevel("warning").end(),h.i("".concat(this._n,".detectSecondRound message loss detected. conversationID:").concat(e," lostSequences:").concat(o)))}}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._maybeLostSequencesMap.clear(),this._firstRoundRet.length=0}}]),s}(le),pc=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="CloudControlModule",n._cloudConfig=new Map,n._expiredTime=0,n._version=0,n._isFetching=!1,n}return q(s,[{key:"getCloudConfig",value:function(e){return S(e)?this._cloudConfig:this._cloudConfig.has(e)?this._cloudConfig.get(e):void 0}},{key:"_canFetchConfig",value:function(){return this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime}},{key:"fetchConfig",value:function(){var e=this,n=this._canFetchConfig();if(h.l("".concat(this._n,".fetchConfig canFetchConfig:").concat(n)),n){var o=new L("fetchCloudControlConfig"),a=this.getModule(X).getSDKAppID();this._isFetching=!0,this.request({protocolName:sr,requestData:{SDKAppID:a,version:this._version}}).then(function(r){e._isFetching=!1,o.setMessage("version:".concat(e._version," newVersion:").concat(r.data.version," config:").concat(r.data.cloudControlConfig)).setNetworkType(e.getNetworkType()).end(),h.l("".concat(e._n,".fetchConfig ok")),e._parseCloudControlConfig(r.data)}).catch(function(r){e._isFetching=!1,e.probeNetwork().then(function(i){var u=N(i,2),l=u[0],d=u[1];o.setError(r,l,d).end()}),h.l("".concat(e._n,".fetchConfig failed. error:"),r),e._setExpiredTimeOnResponseError(12e4)})}}},{key:"onPushedCloudControlConfig",value:function(e){h.l("".concat(this._n,".onPushedCloudControlConfig")),new L("pushedCloudControlConfig").setNetworkType(this.getNetworkType()).setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parseCloudControlConfig(e)}},{key:"onCheckTimer",value:function(e){this._canFetchConfig()&&this.fetchConfig()}},{key:"_parseCloudControlConfig",value:function(e){var n=this,o="".concat(this._n,"._parseCloudControlConfig"),a=e.errorCode,r=e.errorMessage,i=e.cloudControlConfig,u=e.version,l=e.expiredTime;if(a===0){if(this._version!==u){var d=null;try{d=JSON.parse(i)}catch{this.isPrivateNetWork()||h.e("".concat(o," JSON parse error. cloudControlConfig:"),i)}d&&(this._cloudConfig.clear(),Object.keys(d).forEach(function(p){n._cloudConfig.set(p,d[p])}),this._version=u,this.emitInnerEvent(We))}this._expiredTime=Date.now()+1e3*l}else S(a)?(h.l("".concat(o," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(h.e("".concat(o," errorCode:").concat(a," errorMessage:").concat(r)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),s}(le),gc=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="RecoverMessageModule",n.PULL_LIMIT_COUNT=15,n}return q(s,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var e,n,o=this,a=this._getLocalConversationList().filter(function(d){return d.type===f.CONV_GROUP&&d.groupProfile.type!==f.GRP_AVCHATROOM}),r=this.getModule(P),i=0,u=0,l=0;a.forEach(function(d){var p=d.conversationID,g=d.lastMessage;n=p.replace(f.CONV_GROUP,""),e=r.getLocalLastMessage(p),g&&g.lastSequence!==0&&e?(u=g.lastSequence,i=e.sequence,l=u-i,i>0&&l>=1&&l<300?o._recoverGroupMessage({groupID:n,localLastMessageSequence:i,remoteLastMessageSequence:u}):o._getGroupNotify(n)):o._getGroupNotify(n)})}},{key:"_recoverC2CChat",value:function(){var e,n=this,o=this._getLocalConversationList().filter(function(d){return d.type===f.CONV_C2C}),a=this.getModule(P),r=0,i=0,u=0,l=[Promise.resolve()];o.forEach(function(d){var p=d.conversationID,g=d.lastMessage;e=a.getLocalLastMessage(p),g&&g.lastTime!==0&&e&&(i=g.lastTime,r=e.time,u=i-r,r>0&&u>=1&&u<=600&&l.push(n._recoverC2CMessage({conversationID:p,localLastMessageTime:r,remoteLastMessageTime:i})))}),Promise.all(l).then(function(){h.l("".concat(n._n,"._recoverC2CChat all promise fulfilled, start to sync unread messages")),n.getModule(no).startSyncOnReconnected()})}},{key:"_getLocalConversationList",value:function(){return this.getModule(P).getLocalConversationList()}},{key:"_recoverGroupMessage",value:function(e){var n=this,o="".concat(this._n,"._recoverGroupMessage");h.l("".concat(o," options:"),e);var a=e.groupID,r=e.localLastMessageSequence,i=e.remoteLastMessageSequence;this._getGroupRomaingMessage({groupID:a,sequence:r}).then(function(u){var l=u.data,d=l.complete,p=l.messageList;if(!S(p)){var g=p[0].sequence;h.l("".concat(o," pkgLastMessageSequence:").concat(g," complete:").concat(d)),g<i&&d!==2&&n._recoverGroupMessage({groupID:a,localLastMessageSequence:g,remoteLastMessageSequence:i}),new L("recoverMessage").setNetworkType(n.getNetworkType()).setMessage("groupID:".concat(a," complete:").concat(d," messageList length:").concat(p.length)).end();var _=n.getModule(V);p.length>1&&p.sort(function(y,C){return y.sequence-C.sequence});for(var v=0;v<p.length;v++){var M=p[v];M.from!==f.CONV_SYSTEM?_.onNewGroupMessage({dataList:[M],isInstantMessage:!1,updateUnreadCount:!1}):_.onNewGroupTips({event:M.event,dataList:[M]})}n._getGroupNotify(a)}})}},{key:"_getGroupNotify",value:function(e){this.getModule(V).getGroupNotify(e)}},{key:"_getGroupRomaingMessage",value:function(e){var n=e.groupID,o=e.sequence;return this.request({protocolName:Tn,requestData:{groupID:n,count:this.PULL_LIMIT_COUNT,sequence:o+this.PULL_LIMIT_COUNT-1}})}},{key:"_recoverC2CMessage",value:function(e){var n=this,o="".concat(this._n,"._recoverC2CMessage");h.l("".concat(this._n,"._recoverC2CMessage options:"),e);var a=e.conversationID,r=e.localLastMessageTime,i=e.remoteLastMessageTime;return this._getC2CRoamingMessage({conversationID:a,time:r}).then(function(u){var l=u.data,d=l.complete,p=l.messageList;if(!S(p)){var g=p.length;new L("recoverMessage").setNetworkType(n.getNetworkType()).setMessage("".concat(a," complete:").concat(d," messageList length:").concat(g)).end(),n.getModule(fe).onNewC2CMessage({dataList:p,isInstantMessage:!0});var _=p[g-1].time;if(h.l("".concat(o," pkgLastMessageTime:").concat(_," complete:").concat(d)),_<i&&d!==1)return n._recoverC2CMessage({conversationID:a,localLastMessageTime:_,remoteLastMessageTime:i})}})}},{key:"_getC2CRoamingMessage",value:function(e){var n=e.conversationID,o=e.time;return this.request({protocolName:Cn,requestData:{peerAccount:n.replace(f.CONV_C2C,""),count:this.PULL_LIMIT_COUNT+1,lastMessageTime:o,direction:1}})}},{key:"reset",value:function(){h.l("".concat(this._n,".reset"))}}]),s}(le),hc=function(){function c(){F(this,c),this._n="AvgE2EDelay",this._e2eDelayArray=[]}return q(c,[{key:"addMessageDelay",value:function(t){var s=Hn()-t;s>=0&&this._e2eDelayArray.push(s)}},{key:"_calcAvg",value:function(t,s){if(s===0)return 0;var e=0;return t.forEach(function(n){e+=n}),et(e/s,1)}},{key:"_calcCountWithLimit",value:function(t){var s=t.e2eDelayArray,e=t.min,n=t.max;return s.filter(function(o){return e<=o&&o<n}).length}},{key:"_calcPercent",value:function(t,s){var e=et(t/s*100,2);return e>100&&(e=100),e}},{key:"_checkE2EDelayException",value:function(t,s){var e=t.filter(function(u){return u>s});if(e.length>0){var n=e.length,o=Math.min.apply(Math,B(e)),a=Math.max.apply(Math,B(e)),r=this._calcAvg(e,n),i=et(n/t.length*100,2);i>50&&new L("messageE2EDelayException").setMessage("count:".concat(n," min:").concat(o," max:").concat(a," avg:").concat(r," percent:").concat(i)).setLevel("warning").end()}}},{key:"getStatResult",value:function(){var t=this._e2eDelayArray.length;if(t===0)return null;var s=B(this._e2eDelayArray),e=this._calcCountWithLimit({e2eDelayArray:s,min:0,max:1}),n=this._calcCountWithLimit({e2eDelayArray:s,min:1,max:3}),o=this._calcPercent(e,t),a=this._calcPercent(n,t),r=this._calcAvg(s,t);return this._checkE2EDelayException(s,3),s.length=0,this.reset(),{totalCount:t,countLessThan1Second:e,percentOfCountLessThan1Second:o,countLessThan3Second:n,percentOfCountLessThan3Second:a,avgDelay:r}}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),c}(),_c=function(){function c(){F(this,c),this._n="AvgRTT",this._requestCount=0,this._rttArray=[]}return q(c,[{key:"addRequestCount",value:function(){this._requestCount+=1}},{key:"addRTT",value:function(t){this._rttArray.push(t)}},{key:"_calcTotalCount",value:function(){return this._requestCount}},{key:"_calcRTTCount",value:function(t){return t.length}},{key:"_calcSuccessRateOfRequest",value:function(t,s){if(s===0)return 0;var e=et(t/s*100,2);return e>100&&(e=100),e}},{key:"_calcAvg",value:function(t,s){if(s===0)return 0;var e=0;return t.forEach(function(n){e+=n}),parseInt(e/s)}},{key:"_calcMax",value:function(){return Math.max.apply(Math,B(this._rttArray))}},{key:"_calcMin",value:function(){return Math.min.apply(Math,B(this._rttArray))}},{key:"getStatResult",value:function(){var t=this._calcTotalCount(),s=B(this._rttArray);if(t===0)return null;var e=this._calcRTTCount(s),n=this._calcSuccessRateOfRequest(e,t),o=this._calcAvg(s,e);return h.l("".concat(this._n,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(o)),this.reset(),{totalCount:t,rttCount:e,successRateOfRequest:n,avgRTT:o}}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),c}(),fc=function(){function c(){F(this,c),this._map=new Map}return q(c,[{key:"initMap",value:function(t){var s=this;t.forEach(function(e){s._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})})}},{key:"addTotalCount",value:function(t){return!(S(t)||!this._map.has(t))&&(this._map.get(t).totalCount+=1,!0)}},{key:"addSuccessCount",value:function(t){return!(S(t)||!this._map.has(t))&&(this._map.get(t).successCount+=1,!0)}},{key:"addFailedCountOfUserSide",value:function(t){return!(S(t)||!this._map.has(t))&&(this._map.get(t).failedCountOfUserSide+=1,!0)}},{key:"addCost",value:function(t,s){return!(S(t)||!this._map.has(t))&&(this._map.get(t).costArray.push(s),!0)}},{key:"addFileSize",value:function(t,s){return!(S(t)||!this._map.has(t))&&(this._map.get(t).fileSizeArray.push(s),!0)}},{key:"_calcSuccessRateOfBusiness",value:function(t){if(S(t)||!this._map.has(t))return-1;var s=this._map.get(t),e=et(s.successCount/s.totalCount*100,2);return e>100&&(e=100),e}},{key:"_calcSuccessRateOfPlatform",value:function(t){if(S(t)||!this._map.has(t))return-1;var s=this._map.get(t),e=this._calcSuccessCountOfPlatform(t)/s.totalCount*100;return(e=et(e,2))>100&&(e=100),e}},{key:"_calcTotalCount",value:function(t){return S(t)||!this._map.has(t)?-1:this._map.get(t).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(t){return S(t)||!this._map.has(t)?-1:this._map.get(t).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(t){if(S(t)||!this._map.has(t))return-1;var s=this._map.get(t);return s.successCount+s.failedCountOfUserSide}},{key:"_calcAvg",value:function(t){return S(t)||!this._map.has(t)?-1:t===be?this._calcAvgSpeed(t):this._calcAvgCost(t)}},{key:"_calcAvgCost",value:function(t){var s=this._map.get(t).costArray.length;if(s===0)return 0;var e=0;return this._map.get(t).costArray.forEach(function(n){e+=n}),parseInt(e/s)}},{key:"_calcAvgSpeed",value:function(t){var s=0,e=0;return this._map.get(t).costArray.forEach(function(n){s+=n}),this._map.get(t).fileSizeArray.forEach(function(n){e+=n}),parseInt(1e3*e/s)}},{key:"getStatResult",value:function(t){var s=this._calcTotalCount(t);if(s===0)return null;var e=this._calcSuccessCountOfBusiness(t),n=this._calcSuccessRateOfBusiness(t),o=this._calcSuccessCountOfPlatform(t),a=this._calcSuccessRateOfPlatform(t),r=this._calcAvg(t);return this.reset(t),{totalCount:s,successCountOfBusiness:e,successRateOfBusiness:n,successCountOfPlatform:o,successRateOfPlatform:a,avgValue:r}}},{key:"reset",value:function(t){S(t)?this._map.clear():this._map.set(t,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),c}(),mc=function(){function c(){F(this,c),this._lastMap=new Map,this._currentMap=new Map}return q(c,[{key:"initMap",value:function(t){var s=this;t.forEach(function(e){s._lastMap.set(e,new Map),s._currentMap.set(e,new Map)})}},{key:"addMessageSequence",value:function(t){var s=t.key,e=t.message;if(S(s)||!this._lastMap.has(s)||!this._currentMap.has(s))return!1;var n=e.conversationID,o=e.sequence,a=n.replace(f.CONV_GROUP,"");if(this._lastMap.get(s).size===0)this._addCurrentMap(t);else if(this._lastMap.get(s).has(a)){var r=this._lastMap.get(s).get(a),i=r.length-1;o>r[0]&&o<r[i]?(r.push(o),r.sort(),this._lastMap.get(s).set(a,r)):this._addCurrentMap(t)}else this._addCurrentMap(t);return!0}},{key:"_addCurrentMap",value:function(t){var s=t.key,e=t.message,n=e.conversationID,o=e.sequence,a=n.replace(f.CONV_GROUP,"");this._currentMap.get(s).has(a)||this._currentMap.get(s).set(a,[]),this._currentMap.get(s).get(a).push(o)}},{key:"_copyData",value:function(t){if(!S(t)){this._lastMap.set(t,new Map);var s,e=this._lastMap.get(t),n=Ee(this._currentMap.get(t));try{for(n.s();!(s=n.n()).done;){var o=N(s.value,2),a=o[0],r=o[1];e.set(a,r)}}catch(i){n.e(i)}finally{n.f()}e=null,this._currentMap.set(t,new Map)}}},{key:"getStatResult",value:function(t){if(S(this._currentMap.get(t))||S(this._lastMap.get(t)))return null;if(this._lastMap.get(t).size===0)return this._copyData(t),null;var s=0,e=0;if(this._lastMap.get(t).forEach(function(o,a){var r=B(o.values()),i=r.length,u=r[i-1]-r[0]+1;s+=u,e+=i}),s===0)return null;var n=et(e/s*100,2);return n>100&&(n=100),this._copyData(t),{totalCount:s,successCountOfMessageReceived:e,successRateOfMessageReceived:n}}},{key:"reset",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),c}(),vc=function(c){re(s,c);var t=ie(s);function s(e){var n;F(this,s),(n=t.call(this,e))._n="QualityStatModule",n.TAG="im-ssolog-quality-stat",n.reportIndex=0,n.wholePeriod=!1,n._qualityItems=[_o,fo,Nt,Ot,Gt,Tt,be,Ut,$t,en],n._messageSentItems=[Nt,Ot,Gt,Tt,be],n._messageReceivedItems=[Ut,$t,en],n.REPORT_INTERVAL=120,n.REPORT_SDKAPPID_BLACKLIST=[],n.REPORT_TINYID_WHITELIST=[],n._statInfoArr=[],n._avgRTT=new _c,n._avgE2EDelay=new hc,n._rateMessageSent=new fc,n._rateMessageReceived=new mc;var o=n.getInnerEmitterInstance();return o.on(ot,n._onLoginSuccess,$(n)),o.on(We,n._onCloudConfigUpdated,$(n)),n}return q(s,[{key:"_onLoginSuccess",value:function(){var e=this;this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems);var n=this.getModule(Ke),o=n.getItem(this.TAG,!1);!R(o)&&qe(o.forEach)&&(h.l("".concat(this._n,"._onLoginSuccess get quality stat logs from local storage, count:").concat(o.length)),o.forEach(function(a){e._statInfoArr.push(a)}),n.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("q_rpt_interval"),n=this.getCloudConfig("q_rpt_sdkappid_bl"),o=this.getCloudConfig("q_rpt_tinyid_wl");S(e)||(this.REPORT_INTERVAL=Number(e)),S(n)||(this.REPORT_SDKAPPID_BLACKLIST=n.split(",").map(function(a){return Number(a)})),S(o)||(this.REPORT_TINYID_WHITELIST=o.split(","))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}},{key:"addRequestCount",value:function(){this._avgRTT.addRequestCount()}},{key:"addRTT",value:function(e){this._avgRTT.addRTT(e)}},{key:"addMessageDelay",value:function(e){this._avgE2EDelay.addMessageDelay(e)}},{key:"addTotalCount",value:function(e){this._rateMessageSent.addTotalCount(e)||h.w("".concat(this._n,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||h.w("".concat(this._n,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||h.w("".concat(this._n,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,n){this._rateMessageSent.addCost(e,n)||h.w("".concat(this._n,".addCost invalid key or cost:"),e,n)}},{key:"addFileSize",value:function(e,n){this._rateMessageSent.addFileSize(e,n)||h.w("".concat(this._n,".addFileSize invalid key or size:"),e,n)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||h.w("".concat(this._n,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var n={},o=Mr[this.getNetworkType()];S(o)&&(o=8);var a={qualityType:Bi[e],timestamp:ut(),networkType:o,extension:""};switch(e){case _o:n=this._avgRTT.getStatResult();break;case fo:n=this._avgE2EDelay.getStatResult();break;case Nt:case Ot:case Gt:case Tt:case be:n=this._rateMessageSent.getStatResult(e);break;case Ut:case $t:case en:n=this._rateMessageReceived.getStatResult(e)}return n===null?null:m(m({},a),n)}},{key:"_report",value:function(e){var n=this,o=[],a=null;S(e)?this._qualityItems.forEach(function(l){(a=n._getQualityItem(l))!==null&&(a.reportIndex=n.reportIndex,a.wholePeriod=n.wholePeriod,o.push(a))}):(a=this._getQualityItem(e))!==null&&(a.reportIndex=this.reportIndex,a.wholePeriod=this.wholePeriod,o.push(a)),h.d("".concat(this._n,"._report"),o),this._statInfoArr.length>0&&(o=o.concat(this._statInfoArr),this._statInfoArr=[]);var r=this.getModule(X),i=r.getSDKAppID(),u=r.getTinyID();Ts(this.REPORT_SDKAPPID_BLACKLIST,i)&&!Ds(this.REPORT_TINYID_WHITELIST,u)&&(o=[]),o.length>0&&this._doReport(o)}},{key:"_doReport",value:function(e){var n=this,o={header:Nr(this),quality:e};this.request({protocolName:Dn,requestData:m({},o)}).then(function(){n.reportIndex++,n.wholePeriod=!1}).catch(function(a){h.w("".concat(n._n,"._doReport, online:").concat(n.getNetworkType()," error:"),a),n._statInfoArr=n._statInfoArr.concat(e),n._flushAtOnce()})}},{key:"_flushAtOnce",value:function(){var e=this.getModule(Ke),n=e.getItem(this.TAG,!1),o=this._statInfoArr,a="".concat(this._n,"._flushAtOnce");if(R(n))h.l("".concat(a," count:").concat(o.length)),e.setItem(this.TAG,o,!0,!1);else{var r=o.concat(n);r.length>10&&(r=r.slice(0,10)),h.l("".concat(a," count:").concat(r.length)),e.setItem(this.TAG,r,!0,!1)}this._statInfoArr=[]}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._report(),this.reportIndex=0,this.wholePeriod=!1,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._avgRTT.reset(),this._avgE2EDelay.reset(),this._rateMessageSent.reset(),this._rateMessageReceived.reset()}}]),s}(le),Mc=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="WorkerTimerModule",n._isWorkerEnabled=!0,n._workerTimer=null,n._timerID=-1,n._init(),n.getInnerEmitterInstance().on(We,n._onCloudConfigUpdated,$(n)),n}return q(s,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&St}},{key:"startWorkerTimer",value:function(){h.l("".concat(this._n,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){h.l("".concat(this._n,".stopWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("stop")}},{key:"_init",value:function(){if(St){var e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 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);var n=this;this._workerTimer.onmessage=function(o){o.data?(n._timerID=o.data,h.l("".concat(n._n,"._init seed:").concat(n._timerID))):n._m.onCheckTimer()}}}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("enable_worker");h.l("".concat(this._n,"._onCloudConfigUpdated enableWorker:").concat(e)),S(e)||e==="1"?!this._isWorkerEnabled&&St&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&St&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:"terminate",value:function(){h.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(){h.l("".concat(this._n,".reset"))}}]),s}(le),yc=function(){function c(){F(this,c),this._n="PurchasedFeatureHandler",this._purchasedFeatureMap=new Map}return q(c,[{key:"isValidPurchaseBits",value:function(t){return t&&typeof t=="string"&&t.length>=1&&t.length<=64&&/[01]{1,64}/.test(t)}},{key:"parsePurchaseBits",value:function(t){if(this.isValidPurchaseBits(t)){this._purchasedFeatureMap.clear();for(var s=null,e=t.length-1,n=0;e>=0;e--,n++)s=n<32?new Ne(0,Math.pow(2,n)).toString():new Ne(Math.pow(2,n-32),0).toString(),t[e]==="1"?this._purchasedFeatureMap.set(s,!0):this._purchasedFeatureMap.set(s,!1)}else h.w("".concat(this._n,".parsePurchaseBits invalid purchasebits:").concat(t))}},{key:"hasPurchasedFeature",value:function(t){return!!this._purchasedFeatureMap.get(t)}},{key:"isFeatureEnabled",value:function(t){for(var s=parseInt(t).toString(2),e=void 0,n=!0,o=s.length-1,a=0;o>=0;o--,a++)if(s.charAt(o)==="1"&&(e=a<32?new Ne(0,Math.pow(2,a)).toString():new Ne(Math.pow(2,a-32),0).toString(),!this._purchasedFeatureMap.get(e))){n=!1;break}return h.l("".concat(this._n,".isFeatureEnabled decimalNumber:").concat(t," binaryString:").concat(s," ret:").concat(n)),Y({enabled:n})}},{key:"clear",value:function(){this._purchasedFeatureMap.clear()}}]),c}(),Ic=function(){function c(t){F(this,c),this._m=t,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new yc}return q(c,[{key:"_canFetch",value:function(){return this._getModule(X).isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}},{key:"onCheckTimer",value:function(t){this._canFetch()&&this.fetchConfig()}},{key:"fetchConfig",value:function(){var t=this,s=this._canFetch(),e="".concat(this._n,".fetchConfig");if(h.l("".concat(e," canFetch:").concat(s)),s){var n=this._getModule(gt),o=new L("fetchCommercialConfig");o.setNetworkType(n.getNetworkType());var a=this._getModule(X).getSDKAppID(),r=this._getModule(Fe);this._isFetching=!0,r.request({protocolName:ar,requestData:{SDKAppID:a}}).then(function(i){o.setMessage("purchaseBits:".concat(i.data.purchaseBits)).end(),h.l("".concat(e," ok.")),t._parseConfig(i.data),t._isFetching=!1}).catch(function(i){n.probe().then(function(u){var l=N(u,2),d=l[0],p=l[1];o.setError(i,d,p).end()}),t._isFetching=!1})}}},{key:"onPushedConfig",value:function(t){var s="".concat(this._n,".onPushedConfig data:").concat(JSON.stringify(t));h.l("".concat(s)),new L("pushedCommercialConfig").setNetworkType(this._getModule(gt).getNetworkType()).setMessage("purchaseBits:".concat(t.purchaseBits)).end(),this._parseConfig(t)}},{key:"_parseConfig",value:function(t){var s="".concat(this._n,"._parseConfig"),e=t.errorCode,n=t.errorMessage,o=t.purchaseBits,a=t.expiredTime;e===0?(this._purchasedFeatureHandler.parsePurchaseBits(o),this._expiredTime=Date.now()+1e3*a):S(e)?(h.l("".concat(s," failed. Invalid message format:"),t),this._setExpiredTimeOnResponseError(36e5)):(h.e("".concat(s," errorCode:").concat(e," errorMessage:").concat(n)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(t){this._expiredTime=Date.now()+t}},{key:"canIUse",value:function(t){return this._purchasedFeatureHandler.hasPurchasedFeature(t)}},{key:"isFeatureEnabled",value:function(t){return this._purchasedFeatureHandler.isFeatureEnabled(t)}},{key:"_getModule",value:function(t){return this._m.getModule(t)}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),c}(),Cc=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._m=e,n._n="OfflinePushModule",n._offlinePushPlugin=void 0,n._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:"",honorPushBussinessId:""},n._deviceToken="",n._businessID=0,n._iosBusinessID=0,n._c2cUnreadCount=0,n._groupUnreadCount=0,n._isWebUniapp=0,n}return q(s,[{key:"registerPlugin",value:function(e){if(je){this._offlinePushPlugin=e["tim-offline-push-plugin"];var n=e.offlinePushConfig||{},o=n.huaweiBusinessID,a=n.xiaomiBusinessID,r=n.xiaomiAppID,i=n.xiaomiAppKey,u=n.meizuBusinessID,l=n.meizuAppID,d=n.meizuAppKey,p=n.vivoBusinessID,g=n.oppoBusinessID,_=n.oppoAppKey,v=n.oppoAppSecret,M=n.honorBusinessID,y=n.iosBusinessID;this._androidPushConfig.huaweiPushBussinessId=o,this._androidPushConfig.xiaomiPushBussinessId=a,this._androidPushConfig.xiaomiPushAppId=r,this._androidPushConfig.xiaomiPushAppKey=i,this._androidPushConfig.meizuPushBussinessId=u,this._androidPushConfig.meizuPushAppId=l,this._androidPushConfig.meizuPushAppKey=d,this._androidPushConfig.vivoPushBussinessId=p,this._androidPushConfig.oppoPushBussinessId=g,this._androidPushConfig.oppoPushAppKey=_,this._androidPushConfig.oppoPushAppSecret=v,this._androidPushConfig.honorPushBussinessId=M,new L("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!S(this._offlinePushPlugin))).end(!0),h.l("".concat(this._n,".").concat("registerPlugin"," ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=y,this._setAppShowListener()}else this.outputWarning("OfflinePushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:"_getDeviceToken",value:function(){var e=this,n="".concat(this._n,".").concat("_getDeviceToken");if(qe(this._offlinePushPlugin.getDeviceToken)){var o="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID);h.l("".concat(n," start. ").concat(o)),new L("_getDeviceToken").setMessage("".concat(o)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,function(a){var r=new L("getDeviceTokenRes"),i=a.code,u=a.msg;if(i===0){var l=a.data,d=l.deviceToken,p=l.deviceBrand,g=l.deviceType,_=l.bussinessId;e._deviceToken=d,e._businessID=_||e._iosBusinessID,o="deviceToken:".concat(d,", deviceBrand:").concat(p||g,", businessID:").concat(e._businessID),h.l("".concat(n," ok. ").concat(o)),r.setMessage(o).end(!0),e._setToken()}else r.setMessage("code:".concat(i,", msg:").concat(u)).end(!0),h.e("".concat(n," failed. error:"),a)})}else h.e("".concat(n," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return je&&!S(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var e=this,n="".concat(this._n,".").concat("_setAppShowListener");S(this._offlinePushPlugin)?h.e("".concat(n," offlinePushPlugin is undefined")):qe(this._offlinePushPlugin.setAppShowListener)?(new L("_setAppShowListener").end(!0),h.l("".concat(n," start")),this._offlinePushPlugin.setAppShowListener(function(o){var a=(o||{}).appShow;new L("setAppShowListenerRes").setMessage("appShow:".concat(a)).end(!0),h.l("".concat(n," ok. appShow:").concat(a)),e._m.isReady()&&(a===0?(e._getConvUnreadCount(),e._onBackground()):a===1&&e._onForeground())})):h.e("".concat(n," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){if(!S(this._offlinePushPlugin)&&qe(this._offlinePushPlugin.getDeviceType)){var e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType;return h.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}}},{key:"_setToken",value:function(){var e,n=this,o="".concat(this._n,"._setToken"),a=this.getModule(X),r=1,i="",u="";R(this._deviceToken)&&(r=0);var l=this.getUniAppPlatform(),d=this.getDeviceBrand();l===at.IOS||l===at.IPAD||l===at.MAC?u=this._deviceToken:l===at.ANDROID&&(i=this._deviceToken);var p=new L("offlinePushSetToken");return e="deviceToken:".concat(u||i,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(d,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(r,", platform:").concat(l),p.setMessage("".concat(e)),h.l("".concat(o," ").concat(e)),this.request({protocolName:fr,requestData:{tokenID:i,pushMsg:r,sdkAppID:a.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:d,deviceToken:u,isWebUniapp:this._isWebUniapp}}).then(function(g){return p.end(),h.l("".concat(o," ok")),g}).catch(function(g){return n.probeNetwork().then(function(_){var v=N(_,2),M=v[0],y=v[1];p.setError(g,M,y).end()}),h.e("".concat(o," failed. error:"),g),T(g)})}},{key:"_getConvUnreadCount",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.getModule(P).getLocalConversationList().forEach(function(n){n.type===f.CONV_C2C&&(e._c2cUnreadCount+=n.unreadCount),n.type===f.CONV_GROUP&&(e._groupUnreadCount+=n.unreadCount)})}},{key:"_onBackground",value:function(){var e=this,n="".concat(this._n,".").concat("_onBackground"),o=new L("_onBackground");this.request({protocolName:hr,requestData:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then(function(a){return o.setMessage("c2cUnreadCount: ".concat(e._c2cUnreadCount,", groupUnreadCount: ").concat(e._groupUnreadCount)).end(),h.l("".concat(n," ok")),a}).catch(function(a){e.probeNetwork().then(function(r){var i=N(r,2),u=i[0],l=i[1];o.setError(a,u,l).end()}),h.e("".concat(n," failed. error:"),a)})}},{key:"_onForeground",value:function(){var e=this,n="".concat(this._n,".").concat("_onForeground"),o=new L("_onForeground");this.request({protocolName:_r,requestData:{isWebUniapp:this._isWebUniapp}}).then(function(a){return o.end(),h.l("".concat(n," ok")),a}).catch(function(a){e.probeNetwork().then(function(r){var i=N(r,2),u=i[0],l=i[1];o.setError(a,u,l).end()}),h.e("".concat(n," failed. error:"),a)})}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,n=this.getDeviceBrand();return e==="ios"?at.IOS:e==="android"?at.ANDROID:n===1002?at.IPAD:n===1001?at.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,h.l("".concat(this._n,".reset"))}}]),s}(le),Tc=function(c){re(s,c);var t=ie(s);function s(e){var n;return F(this,s),(n=t.call(this,e))._n="ProfanityFilterModule",n._plugin=null,n._filterConfigMap=new Map,n._startIndex=0,n._version=0,n._canIUseLexicon=!1,n._isFetching=!1,n._expiredTime=0,n}return q(s,[{key:"init",value:function(){var e=this.getModule(yn).getPlugin("tim-profanity-filter-plugin");e?(this._plugin=new e({logger:h,isArray:b,isMap:ps,isDevMode:this.isDevMode()}),this._getLexicon()):this.outputWarning("ProfanityPluginNotFound")}},{key:"onCheckTimer",value:function(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}},{key:"filterMessage",value:function(e,n){var o=!0;if(!this._plugin||!this._canIUseLexicon||n&&n.messageControlInfo&&n.messageControlInfo.excludedFromContentModeration===!0)return o;var a=e.type,r=e.conversationType;if(a!==f.MSG_TEXT&&a!==f.MSG_CUSTOM)return o;var i,u="".concat(this._n,".filterMessage");if(h.l("".concat(u)),a===f.MSG_TEXT){if(r===f.CONV_C2C?i=ii:r===f.CONV_GROUP&&(i=ci),!this._isConfigOn(i))return o;var l=this._plugin.filter(e.payload.text),d=l.type,p=l.modifiedText;d===1?o=!1:d===2&&(e.payload.text=p)}else if(a===f.MSG_CUSTOM){if(r===f.CONV_C2C?i=ui:r===f.CONV_GROUP&&(i=li),!this._isConfigOn(i))return o;var g=this._plugin.filter(e.payload.data),_=this._plugin.filter(e.payload.description),v=this._plugin.filter(e.payload.extension);g.type===1||_.type===1||v.type===1?o=!1:(g.type===2&&(e.payload.data=g.modifiedText),_.type===2&&(e.payload.description=_.modifiedText),v.type===2&&(e.payload.extension=v.modifiedText))}return h.l("".concat(u," done. isAllowedToSend:").concat(o)),o}},{key:"filterText",value:function(e,n){var o="".concat(this._n,".filterText"),a={isAllowedToSend:!0,modifiedText:e};if(!this._plugin||!this._canIUseLexicon||!this._isConfigOn(n))return a;h.l("".concat(o));var r=this._plugin.filter(e),i=r.type,u=r.modifiedText;return i===1?a.isAllowedToSend=!1:i===2&&(a.modifiedText=u),h.l("".concat(o," done. ret:"),a),a}},{key:"_getLexicon",value:function(){var e=this,n=new L("profanityFilter"),o="".concat(this._n,"._getLexicon");this._isFetching=!0,this.request({protocolName:mr,requestData:{startIndex:this._startIndex,version:this._version}}).then(function(a){var r=a.data,i=r.errorInfo,u=r.filterConfig,l=r.lexicon,d=r.strToken,p=r.completeFlag,g=r.nextStartIndex,_=r.version,v=r.expiredTime,M=i.errorCode,y=i.errorMessage;return M!==0?(e._isFetching=!1,h.w("".concat(o," failed. error:"),i),void n.setCode(M).setMessage(y).end()):(e._onFilterConfig(u),e._getToken(d),p===1?(h.l("".concat(o," done. version:").concat(_," expiredTime:").concat(v)),e._version=_,e._canIUseLexicon=!0,e._isFetching=!1,e._expiredTime=Date.now()+1e3*v,void e._plugin.onLexiconCompleted(l)):(e._startIndex=g,e._plugin.onLexiconSliced(l),void e._getLexicon()))}).catch(function(a){e.probeNetwork().then(function(r){var i=N(r,2),u=i[0],l=i[1];n.setError(a,u,l).end()}),e._isFetching=!1,h.l("".concat(o," failed. error:"),a)})}},{key:"_onFilterConfig",value:function(e){var n=this;R(e)||(this._filterConfigMap.clear(),Object.keys(e).forEach(function(o){n._filterConfigMap.set(o,e[o])}),h.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 this._filterConfigMap.get(e)===1}},{key:"_getToken",value:function(e){if(z(e)){var n=e.length,o="";if(n%2==0)for(var a=0;a<=n-1;a+=2)o+=e[a+1],o+=e[a];else{for(var r=0;r<n-1;r+=2)o+=e[r+1],o+=e[r];o+=e[n-1]}this._plugin.onToken(o)}}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._plugin&&(this._plugin.reset(),this._plugin=null),this._filterConfigMap.clear(),this._startIndex=0,this._version=0,this._canIUseLexicon=!1,this._isFetching=!1,this._expiredTime=0}}]),s}(le),Dc=function(){function c(t){F(this,c),this._m=t,this._n="TransCmdModule",this._TRTCCommandList=["tui_room_svr.*"],this._m.getInnerEmitterInstance().on(We,this._onCloudConfigUpdated,this)}return q(c,[{key:"_onCloudConfigUpdated",value:function(){var t=this,s=this._m.getModule(Jt).getCloudConfig("rtc_cmd");S(s)||(s=JSON.parse(s)).forEach(function(e){t._TRTCCommandList.includes(e)||t._TRTCCommandList.push(e)})}},{key:"sendTRTCCustomData",value:function(t){var s=t.serviceCommand,e=t.data,n="".concat(I.NAME.TUIROOM_SVR,".*");return S(s)||(n=s),this._TRTCCommandList.includes(n)?this._trans({servcmd:n,data:e}):T({code:k.INVALID_TRTC_CMD})}},{key:"_trans",value:function(t){h.d("".concat(this._n,"._trans. options:").concat(JSON.stringify(t)));var s=t.servcmd,e=t.data;return this._m.getModule(Fe).trans({servcmd:s,data:z(e)?JSON.parse(e):e})}},{key:"getCommandList",value:function(){return this._TRTCCommandList}},{key:"reset",value:function(){h.l("".concat(this._n,".reset"))}}]),c}(),kc=function(){function c(t){F(this,c),this._m=t,this._n="ErrorMessageModule",this.TIM_ERROR_ASSISTANCE="tim_error_assistance",this.STORAGE_EXPIRES_TIME=6048e5,this._map=new Map,this._init()}return q(c,[{key:"_init",value:function(){var t=this._getStorageModule().getItem(this.TIM_ERROR_ASSISTANCE,!1);if(t){var s;try{s=JSON.parse(t)}catch(e){this._getStorageModule().removeItem(this.TIM_ERROR_ASSISTANCE,!1),h.w("".concat(this._n,"._init error:"),e)}s&&(this._needToUpdate(s)?this._fetch():this._fillMap(s.message))}else this._fetch()}},{key:"_needToUpdate",value:function(t){var s=t.localSavedTime,e=t.localSavedVersion,n=s&&new Date().getTime()-s>=this.STORAGE_EXPIRES_TIME,o=!e||e!=="2.27.6";return h.l("".concat(this._n,"._needToUpdate isTimeout:").concat(n," isDifferentVersion:").concat(o)),n||o}},{key:"_fetch",value:function(){if(!this._m.getModule(X).isPrivateNetWork()){var t="https://web.sdk.qcloud.com/im/download/error-message/0.0.1/tim-error-message.txt",s="application/x-www-form-urlencoded;charset=UTF-8",e="".concat(this._n,"._fetch ok in"),n=this;if(Z)Q.request({url:t,method:"GET",timeout:3e3,header:{"content-type":s},dataType:"text",success:function(r){n._fillAndSave(r.data),h.l("".concat(e," mini program"))},fail:function(){}});else{var o=new XMLHttpRequest,a=setTimeout(function(){o.abort()},3e3);o.onreadystatechange=function(){o.readyState===4&&(clearTimeout(a),o.status!==200&&o.status!==304||(h.l("".concat(e," browser")),n._fillAndSave(o.responseText)))},o.open("GET",t,!0),o.setRequestHeader("Content-type",s),o.send()}}}},{key:"_fillAndSave",value:function(t){this._fillMap(t),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:t,localSavedTime:new Date().getTime(),localSavedVersion:"2.27.6"}),!0,!1)}},{key:"_getStorageModule",value:function(){return this._m.getModule(Ke)}},{key:"_fillMap",value:function(t){this._map.clear();for(var s,e,n,o=t.split(`;
`),a=o.length,r=new RegExp(/'/g),i=0;i<a;i++)if(s=o[i].indexOf(":"),e=o[i].slice(0,s),n=o[i].slice(s+1,o[i].length),!e.startsWith("//")){if(S(n))continue;this._map.set(e,n.replace(r,""))}}},{key:"get",value:function(t){var s=t.isIntl,e=t.key,n=t.replacement1,o=t.replacement2,a="".concat(e,s?"_en":"_cn");!this._map.has(a)&&this._map.has(e)&&(a=e);var r="";return this._map.has(a)&&(r=this._map.get(a),S(n)||(r=r.replace("$replacement1",n)),S(o)||(r=r.replace("$replacement2",o))),r}},{key:"reset",value:function(){h.l("".concat(this._n,".reset"))}}]),c}(),se=Or(function(c,t){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function e(a,r){return Object.prototype.hasOwnProperty.call(a,r)}t.assign=function(a){for(var r=Array.prototype.slice.call(arguments,1);r.length;){var i=r.shift();if(i){if(_t(i)!=="object")throw new TypeError(i+"must be non-object");for(var u in i)e(i,u)&&(a[u]=i[u])}}return a},t.shrinkBuf=function(a,r){return a.length===r?a:a.subarray?a.subarray(0,r):(a.length=r,a)};var n={arraySet:function(a,r,i,u,l){if(r.subarray&&a.subarray)a.set(r.subarray(i,i+u),l);else for(var d=0;d<u;d++)a[l+d]=r[i+d]},flattenChunks:function(a){var r,i,u,l,d,p;for(u=0,r=0,i=a.length;r<i;r++)u+=a[r].length;for(p=new Uint8Array(u),l=0,r=0,i=a.length;r<i;r++)d=a[r],p.set(d,l),l+=d.length;return p}},o={arraySet:function(a,r,i,u,l){for(var d=0;d<u;d++)a[l+d]=r[i+d]},flattenChunks:function(a){return[].concat.apply([],a)}};t.setTyped=function(a){a?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,n)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,o))},t.setTyped(s)});se.assign,se.shrinkBuf,se.setTyped,se.Buf8,se.Buf16,se.Buf32;var Po=function(c,t,s,e){for(var n=65535&c|0,o=c>>>16&65535|0,a=0;s!==0;){s-=a=s>2e3?2e3:s;do o=o+(n=n+t[e++]|0)|0;while(--a);n%=65521,o%=65521}return n|o<<16|0},Sc=function(){for(var c,t=[],s=0;s<256;s++){c=s;for(var e=0;e<8;e++)c=1&c?3988292384^c>>>1:c>>>1;t[s]=c}return t}(),st=function(c,t,s,e){var n=Sc,o=e+s;c^=-1;for(var a=e;a<o;a++)c=c>>>8^n[255&(c^t[a])];return-1^c},Ec=function(c,t){var s,e,n,o,a,r,i,u,l,d,p,g,_,v,M,y,C,D,E,A,O,U,K,j,H;s=c.state,e=c.next_in,j=c.input,n=e+(c.avail_in-5),o=c.next_out,H=c.output,a=o-(t-c.avail_out),r=o+(c.avail_out-257),i=s.dmax,u=s.wsize,l=s.whave,d=s.wnext,p=s.window,g=s.hold,_=s.bits,v=s.lencode,M=s.distcode,y=(1<<s.lenbits)-1,C=(1<<s.distbits)-1;e:do{_<15&&(g+=j[e++]<<_,_+=8,g+=j[e++]<<_,_+=8),D=v[g&y];t:for(;;){if(g>>>=E=D>>>24,_-=E,(E=D>>>16&255)===0)H[o++]=65535&D;else{if(!(16&E)){if(!(64&E)){D=v[(65535&D)+(g&(1<<E)-1)];continue t}if(32&E){s.mode=12;break e}c.msg="invalid literal/length code",s.mode=30;break e}A=65535&D,(E&=15)&&(_<E&&(g+=j[e++]<<_,_+=8),A+=g&(1<<E)-1,g>>>=E,_-=E),_<15&&(g+=j[e++]<<_,_+=8,g+=j[e++]<<_,_+=8),D=M[g&C];n:for(;;){if(g>>>=E=D>>>24,_-=E,!(16&(E=D>>>16&255))){if(!(64&E)){D=M[(65535&D)+(g&(1<<E)-1)];continue n}c.msg="invalid distance code",s.mode=30;break e}if(O=65535&D,_<(E&=15)&&(g+=j[e++]<<_,(_+=8)<E&&(g+=j[e++]<<_,_+=8)),(O+=g&(1<<E)-1)>i){c.msg="invalid distance too far back",s.mode=30;break e}if(g>>>=E,_-=E,O>(E=o-a)){if((E=O-E)>l&&s.sane){c.msg="invalid distance too far back",s.mode=30;break e}if(U=0,K=p,d===0){if(U+=u-E,E<A){A-=E;do H[o++]=p[U++];while(--E);U=o-O,K=H}}else if(d<E){if(U+=u+d-E,(E-=d)<A){A-=E;do H[o++]=p[U++];while(--E);if(U=0,d<A){A-=E=d;do H[o++]=p[U++];while(--E);U=o-O,K=H}}}else if(U+=d-E,E<A){A-=E;do H[o++]=p[U++];while(--E);U=o-O,K=H}for(;A>2;)H[o++]=K[U++],H[o++]=K[U++],H[o++]=K[U++],A-=3;A&&(H[o++]=K[U++],A>1&&(H[o++]=K[U++]))}else{U=o-O;do H[o++]=H[U++],H[o++]=H[U++],H[o++]=H[U++],A-=3;while(A>2);A&&(H[o++]=H[U++],A>1&&(H[o++]=H[U++]))}break}}break}}while(e<n&&o<r);e-=A=_>>3,g&=(1<<(_-=A<<3))-1,c.next_in=e,c.next_out=o,c.avail_in=e<n?n-e+5:5-(e-n),c.avail_out=o<r?r-o+257:257-(o-r),s.hold=g,s.bits=_},Lc=[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],Ac=[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],Rc=[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],Nc=[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],on=function(c,t,s,e,n,o,a,r){var i,u,l,d,p,g,_,v,M,y=r.bits,C=0,D=0,E=0,A=0,O=0,U=0,K=0,j=0,H=0,J=0,de=null,De=0,he=new se.Buf16(16),Me=new se.Buf16(16),Ue=null,Ze=0;for(C=0;C<=15;C++)he[C]=0;for(D=0;D<e;D++)he[t[s+D]]++;for(O=y,A=15;A>=1&&he[A]===0;A--);if(O>A&&(O=A),A===0)return n[o++]=20971520,n[o++]=20971520,r.bits=1,0;for(E=1;E<A&&he[E]===0;E++);for(O<E&&(O=E),j=1,C=1;C<=15;C++)if(j<<=1,(j-=he[C])<0)return-1;if(j>0&&(c===0||A!==1))return-1;for(Me[1]=0,C=1;C<15;C++)Me[C+1]=Me[C]+he[C];for(D=0;D<e;D++)t[s+D]!==0&&(a[Me[t[s+D]]++]=D);if(c===0?(de=Ue=a,g=19):c===1?(de=Lc,De-=257,Ue=Ac,Ze-=257,g=256):(de=Rc,Ue=Nc,g=-1),J=0,D=0,C=E,p=o,U=O,K=0,l=-1,d=(H=1<<O)-1,c===1&&H>852||c===2&&H>592)return 1;for(;;){_=C-K,a[D]<g?(v=0,M=a[D]):a[D]>g?(v=Ue[Ze+a[D]],M=de[De+a[D]]):(v=96,M=0),i=1<<C-K,E=u=1<<U;do n[p+(J>>K)+(u-=i)]=_<<24|v<<16|M|0;while(u!==0);for(i=1<<C-1;J&i;)i>>=1;if(i!==0?(J&=i-1,J+=i):J=0,D++,--he[C]==0){if(C===A)break;C=t[s+a[D]]}if(C>O&&(J&d)!==l){for(K===0&&(K=O),p+=E,j=1<<(U=C-K);U+K<A&&!((j-=he[U+K])<=0);)U++,j<<=1;if(H+=1<<U,c===1&&H>852||c===2&&H>592)return 1;n[l=J&d]=O<<24|U<<16|p-o|0}}return J!==0&&(n[p+J]=C-K<<24|64<<16|0),r.bits=O,0};function Fr(c){return(c>>>24&255)+(c>>>8&65280)+((65280&c)<<8)+((255&c)<<24)}function Oc(){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 se.Buf16(320),this.work=new se.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function qr(c){var t;return c&&c.state?(t=c.state,c.total_in=c.total_out=t.total=0,c.msg="",t.wrap&&(c.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 se.Buf32(852),t.distcode=t.distdyn=new se.Buf32(592),t.sane=1,t.back=-1,0):-2}function xr(c){var t;return c&&c.state?((t=c.state).wsize=0,t.whave=0,t.wnext=0,qr(c)):-2}function Vr(c,t){var s,e;return c&&c.state?(e=c.state,t<0?(s=0,t=-t):(s=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(e.window!==null&&e.wbits!==t&&(e.window=null),e.wrap=s,e.wbits=t,xr(c))):-2}function Br(c,t){var s,e;return c?(e=new Oc,c.state=e,e.window=null,(s=Vr(c,t))!==0&&(c.state=null),s):-2}var bo,wo,Hr=!0;function Gc(c){if(Hr){var t;for(bo=new se.Buf32(512),wo=new se.Buf32(32),t=0;t<144;)c.lens[t++]=8;for(;t<256;)c.lens[t++]=9;for(;t<280;)c.lens[t++]=7;for(;t<288;)c.lens[t++]=8;for(on(1,c.lens,0,288,bo,0,c.work,{bits:9}),t=0;t<32;)c.lens[t++]=5;on(2,c.lens,0,32,wo,0,c.work,{bits:5}),Hr=!1}c.lencode=bo,c.lenbits=9,c.distcode=wo,c.distbits=5}function Kr(c,t,s,e){var n,o=c.state;return o.window===null&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new se.Buf8(o.wsize)),e>=o.wsize?(se.arraySet(o.window,t,s-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>e&&(n=e),se.arraySet(o.window,t,s-e,n,o.wnext),(e-=n)?(se.arraySet(o.window,t,s-e,e,0),o.wnext=e,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}var Pt={inflateReset:xr,inflateReset2:Vr,inflateResetKeep:qr,inflateInit:function(c){return Br(c,15)},inflateInit2:Br,inflate:function(c,t){var s,e,n,o,a,r,i,u,l,d,p,g,_,v,M,y,C,D,E,A,O,U,K,j,H=0,J=new se.Buf8(4),de=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!c||!c.state||!c.output||!c.input&&c.avail_in!==0)return-2;(s=c.state).mode===12&&(s.mode=13),a=c.next_out,n=c.output,i=c.avail_out,o=c.next_in,e=c.input,r=c.avail_in,u=s.hold,l=s.bits,d=r,p=i,U=0;e:for(;;)switch(s.mode){case 1:if(s.wrap===0){s.mode=13;break}for(;l<16;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}if(2&s.wrap&&u===35615){s.check=0,J[0]=255&u,J[1]=u>>>8&255,s.check=st(s.check,J,2,0),u=0,l=0,s.mode=2;break}if(s.flags=0,s.head&&(s.head.done=!1),!(1&s.wrap)||(((255&u)<<8)+(u>>8))%31){c.msg="incorrect header check",s.mode=30;break}if((15&u)!=8){c.msg="unknown compression method",s.mode=30;break}if(l-=4,O=8+(15&(u>>>=4)),s.wbits===0)s.wbits=O;else if(O>s.wbits){c.msg="invalid window size",s.mode=30;break}s.dmax=1<<O,c.adler=s.check=1,s.mode=512&u?10:12,u=0,l=0;break;case 2:for(;l<16;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}if(s.flags=u,(255&s.flags)!=8){c.msg="unknown compression method",s.mode=30;break}if(57344&s.flags){c.msg="unknown header flags set",s.mode=30;break}s.head&&(s.head.text=u>>8&1),512&s.flags&&(J[0]=255&u,J[1]=u>>>8&255,s.check=st(s.check,J,2,0)),u=0,l=0,s.mode=3;case 3:for(;l<32;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}s.head&&(s.head.time=u),512&s.flags&&(J[0]=255&u,J[1]=u>>>8&255,J[2]=u>>>16&255,J[3]=u>>>24&255,s.check=st(s.check,J,4,0)),u=0,l=0,s.mode=4;case 4:for(;l<16;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}s.head&&(s.head.xflags=255&u,s.head.os=u>>8),512&s.flags&&(J[0]=255&u,J[1]=u>>>8&255,s.check=st(s.check,J,2,0)),u=0,l=0,s.mode=5;case 5:if(1024&s.flags){for(;l<16;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}s.length=u,s.head&&(s.head.extra_len=u),512&s.flags&&(J[0]=255&u,J[1]=u>>>8&255,s.check=st(s.check,J,2,0)),u=0,l=0}else s.head&&(s.head.extra=null);s.mode=6;case 6:if(1024&s.flags&&((g=s.length)>r&&(g=r),g&&(s.head&&(O=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Array(s.head.extra_len)),se.arraySet(s.head.extra,e,o,g,O)),512&s.flags&&(s.check=st(s.check,e,g,o)),r-=g,o+=g,s.length-=g),s.length))break e;s.length=0,s.mode=7;case 7:if(2048&s.flags){if(r===0)break e;g=0;do O=e[o+g++],s.head&&O&&s.length<65536&&(s.head.name+=String.fromCharCode(O));while(O&&g<r);if(512&s.flags&&(s.check=st(s.check,e,g,o)),r-=g,o+=g,O)break e}else s.head&&(s.head.name=null);s.length=0,s.mode=8;case 8:if(4096&s.flags){if(r===0)break e;g=0;do O=e[o+g++],s.head&&O&&s.length<65536&&(s.head.comment+=String.fromCharCode(O));while(O&&g<r);if(512&s.flags&&(s.check=st(s.check,e,g,o)),r-=g,o+=g,O)break e}else s.head&&(s.head.comment=null);s.mode=9;case 9:if(512&s.flags){for(;l<16;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}if(u!==(65535&s.check)){c.msg="header crc mismatch",s.mode=30;break}u=0,l=0}s.head&&(s.head.hcrc=s.flags>>9&1,s.head.done=!0),c.adler=s.check=0,s.mode=12;break;case 10:for(;l<32;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}c.adler=s.check=Fr(u),u=0,l=0,s.mode=11;case 11:if(s.havedict===0)return c.next_out=a,c.avail_out=i,c.next_in=o,c.avail_in=r,s.hold=u,s.bits=l,2;c.adler=s.check=1,s.mode=12;case 12:if(t===5||t===6)break e;case 13:if(s.last){u>>>=7&l,l-=7&l,s.mode=27;break}for(;l<3;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}switch(s.last=1&u,l-=1,3&(u>>>=1)){case 0:s.mode=14;break;case 1:if(Gc(s),s.mode=20,t===6){u>>>=2,l-=2;break e}break;case 2:s.mode=17;break;case 3:c.msg="invalid block type",s.mode=30}u>>>=2,l-=2;break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){c.msg="invalid stored block lengths",s.mode=30;break}if(s.length=65535&u,u=0,l=0,s.mode=15,t===6)break e;case 15:s.mode=16;case 16:if(g=s.length){if(g>r&&(g=r),g>i&&(g=i),g===0)break e;se.arraySet(n,e,o,g,a),r-=g,o+=g,i-=g,a+=g,s.length-=g;break}s.mode=12;break;case 17:for(;l<14;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}if(s.nlen=257+(31&u),u>>>=5,l-=5,s.ndist=1+(31&u),u>>>=5,l-=5,s.ncode=4+(15&u),u>>>=4,l-=4,s.nlen>286||s.ndist>30){c.msg="too many length or distance symbols",s.mode=30;break}s.have=0,s.mode=18;case 18:for(;s.have<s.ncode;){for(;l<3;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}s.lens[de[s.have++]]=7&u,u>>>=3,l-=3}for(;s.have<19;)s.lens[de[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,K={bits:s.lenbits},U=on(0,s.lens,0,19,s.lencode,0,s.work,K),s.lenbits=K.bits,U){c.msg="invalid code lengths set",s.mode=30;break}s.have=0,s.mode=19;case 19:for(;s.have<s.nlen+s.ndist;){for(;y=(H=s.lencode[u&(1<<s.lenbits)-1])>>>16&255,C=65535&H,!((M=H>>>24)<=l);){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}if(C<16)u>>>=M,l-=M,s.lens[s.have++]=C;else{if(C===16){for(j=M+2;l<j;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}if(u>>>=M,l-=M,s.have===0){c.msg="invalid bit length repeat",s.mode=30;break}O=s.lens[s.have-1],g=3+(3&u),u>>>=2,l-=2}else if(C===17){for(j=M+3;l<j;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}l-=M,O=0,g=3+(7&(u>>>=M)),u>>>=3,l-=3}else{for(j=M+7;l<j;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}l-=M,O=0,g=11+(127&(u>>>=M)),u>>>=7,l-=7}if(s.have+g>s.nlen+s.ndist){c.msg="invalid bit length repeat",s.mode=30;break}for(;g--;)s.lens[s.have++]=O}}if(s.mode===30)break;if(s.lens[256]===0){c.msg="invalid code -- missing end-of-block",s.mode=30;break}if(s.lenbits=9,K={bits:s.lenbits},U=on(1,s.lens,0,s.nlen,s.lencode,0,s.work,K),s.lenbits=K.bits,U){c.msg="invalid literal/lengths set",s.mode=30;break}if(s.distbits=6,s.distcode=s.distdyn,K={bits:s.distbits},U=on(2,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,K),s.distbits=K.bits,U){c.msg="invalid distances set",s.mode=30;break}if(s.mode=20,t===6)break e;case 20:s.mode=21;case 21:if(r>=6&&i>=258){c.next_out=a,c.avail_out=i,c.next_in=o,c.avail_in=r,s.hold=u,s.bits=l,Ec(c,p),a=c.next_out,n=c.output,i=c.avail_out,o=c.next_in,e=c.input,r=c.avail_in,u=s.hold,l=s.bits,s.mode===12&&(s.back=-1);break}for(s.back=0;y=(H=s.lencode[u&(1<<s.lenbits)-1])>>>16&255,C=65535&H,!((M=H>>>24)<=l);){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}if(y&&!(240&y)){for(D=M,E=y,A=C;y=(H=s.lencode[A+((u&(1<<D+E)-1)>>D)])>>>16&255,C=65535&H,!(D+(M=H>>>24)<=l);){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}u>>>=D,l-=D,s.back+=D}if(u>>>=M,l-=M,s.back+=M,s.length=C,y===0){s.mode=26;break}if(32&y){s.back=-1,s.mode=12;break}if(64&y){c.msg="invalid literal/length code",s.mode=30;break}s.extra=15&y,s.mode=22;case 22:if(s.extra){for(j=s.extra;l<j;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}s.length+=u&(1<<s.extra)-1,u>>>=s.extra,l-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=23;case 23:for(;y=(H=s.distcode[u&(1<<s.distbits)-1])>>>16&255,C=65535&H,!((M=H>>>24)<=l);){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}if(!(240&y)){for(D=M,E=y,A=C;y=(H=s.distcode[A+((u&(1<<D+E)-1)>>D)])>>>16&255,C=65535&H,!(D+(M=H>>>24)<=l);){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}u>>>=D,l-=D,s.back+=D}if(u>>>=M,l-=M,s.back+=M,64&y){c.msg="invalid distance code",s.mode=30;break}s.offset=C,s.extra=15&y,s.mode=24;case 24:if(s.extra){for(j=s.extra;l<j;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}s.offset+=u&(1<<s.extra)-1,u>>>=s.extra,l-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){c.msg="invalid distance too far back",s.mode=30;break}s.mode=25;case 25:if(i===0)break e;if(g=p-i,s.offset>g){if((g=s.offset-g)>s.whave&&s.sane){c.msg="invalid distance too far back",s.mode=30;break}g>s.wnext?(g-=s.wnext,_=s.wsize-g):_=s.wnext-g,g>s.length&&(g=s.length),v=s.window}else v=n,_=a-s.offset,g=s.length;g>i&&(g=i),i-=g,s.length-=g;do n[a++]=v[_++];while(--g);s.length===0&&(s.mode=21);break;case 26:if(i===0)break e;n[a++]=s.length,i--,s.mode=21;break;case 27:if(s.wrap){for(;l<32;){if(r===0)break e;r--,u|=e[o++]<<l,l+=8}if(p-=i,c.total_out+=p,s.total+=p,p&&(c.adler=s.check=s.flags?st(s.check,n,p,a-p):Po(s.check,n,p,a-p)),p=i,(s.flags?u:Fr(u))!==s.check){c.msg="incorrect data check",s.mode=30;break}u=0,l=0}s.mode=28;case 28:if(s.wrap&&s.flags){for(;l<32;){if(r===0)break e;r--,u+=e[o++]<<l,l+=8}if(u!==(4294967295&s.total)){c.msg="incorrect length check",s.mode=30;break}u=0,l=0}s.mode=29;case 29:U=1;break e;case 30:U=-3;break e;case 31:return-4;case 32:default:return-2}return c.next_out=a,c.avail_out=i,c.next_in=o,c.avail_in=r,s.hold=u,s.bits=l,(s.wsize||p!==c.avail_out&&s.mode<30&&(s.mode<27||t!==4))&&Kr(c,c.output,c.next_out,p-c.avail_out),d-=c.avail_in,p-=c.avail_out,c.total_in+=d,c.total_out+=p,s.total+=p,s.wrap&&p&&(c.adler=s.check=s.flags?st(s.check,n,p,c.next_out-p):Po(s.check,n,p,c.next_out-p)),c.data_type=s.bits+(s.last?64:0)+(s.mode===12?128:0)+(s.mode===20||s.mode===15?256:0),(d===0&&p===0||t===4)&&U===0&&(U=-5),U},inflateEnd:function(c){if(!c||!c.state)return-2;var t=c.state;return t.window&&(t.window=null),c.state=null,0},inflateGetHeader:function(c,t){var s;return c&&c.state&&2&(s=c.state).wrap?(s.head=t,t.done=!1,0):-2},inflateSetDictionary:function(c,t){var s,e=t.length;return c&&c.state?(s=c.state).wrap!==0&&s.mode!==11?-2:s.mode===11&&Po(1,t,e,0)!==s.check?-3:Kr(c,t,e,e)?(s.mode=31,-4):(s.havedict=1,0):-2},inflateInfo:"pako inflate (from Nodeca project)"},Wr=!0,Yr=!0;try{String.fromCharCode.apply(null,[0])}catch{Wr=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Yr=!1}for(var sn=new se.Buf8(256),Mt=0;Mt<256;Mt++)sn[Mt]=Mt>=252?6:Mt>=248?5:Mt>=240?4:Mt>=224?3:Mt>=192?2:1;sn[254]=sn[254]=1;function Uc(c,t){if(t<65534&&(c.subarray&&Yr||!c.subarray&&Wr))return String.fromCharCode.apply(null,se.shrinkBuf(c,t));for(var s="",e=0;e<t;e++)s+=String.fromCharCode(c[e]);return s}var Pc=function(c){var t,s,e,n,o,a=c.length,r=0;for(n=0;n<a;n++)(64512&(s=c.charCodeAt(n)))==55296&&n+1<a&&(64512&(e=c.charCodeAt(n+1)))==56320&&(s=65536+(s-55296<<10)+(e-56320),n++),r+=s<128?1:s<2048?2:s<65536?3:4;for(t=new se.Buf8(r),o=0,n=0;o<r;n++)(64512&(s=c.charCodeAt(n)))==55296&&n+1<a&&(64512&(e=c.charCodeAt(n+1)))==56320&&(s=65536+(s-55296<<10)+(e-56320),n++),s<128?t[o++]=s:s<2048?(t[o++]=192|s>>>6,t[o++]=128|63&s):s<65536?(t[o++]=224|s>>>12,t[o++]=128|s>>>6&63,t[o++]=128|63&s):(t[o++]=240|s>>>18,t[o++]=128|s>>>12&63,t[o++]=128|s>>>6&63,t[o++]=128|63&s);return t},bc=function(c){for(var t=new se.Buf8(c.length),s=0,e=t.length;s<e;s++)t[s]=c.charCodeAt(s);return t},wc=function(c,t){var s,e,n,o,a=t||c.length,r=new Array(2*a);for(e=0,s=0;s<a;)if((n=c[s++])<128)r[e++]=n;else if((o=sn[n])>4)r[e++]=65533,s+=o-1;else{for(n&=o===2?31:o===3?15:7;o>1&&s<a;)n=n<<6|63&c[s++],o--;o>1?r[e++]=65533:n<65536?r[e++]=n:(n-=65536,r[e++]=55296|n>>10&1023,r[e++]=56320|1023&n)}return Uc(r,e)},Fc=function(c,t){var s;for((t=t||c.length)>c.length&&(t=c.length),s=t-1;s>=0&&(192&c[s])==128;)s--;return s<0||s===0?t:s+sn[c[s]]>t?s:t},ge={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},Fo={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},qc=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},xc=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},jr=Object.prototype.toString;function kt(c){if(!(this instanceof kt))return new kt(c);this.options=se.assign({chunkSize:16384,windowBits:0,to:""},c||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||c&&c.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qc,this.strm.avail_out=0;var s=Pt.inflateInit2(this.strm,t.windowBits);if(s!==ge.Z_OK)throw new Error(Fo[s]);if(this.header=new xc,Pt.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Pc(t.dictionary):jr.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(s=Pt.inflateSetDictionary(this.strm,t.dictionary))!==ge.Z_OK))throw new Error(Fo[s])}function qo(c,t){var s=new kt(t);if(s.push(c,!0),s.err)throw s.msg||Fo[s.err];return s.result}kt.prototype.push=function(c,t){var s,e,n,o,a,r=this.strm,i=this.options.chunkSize,u=this.options.dictionary,l=!1;if(this.ended)return!1;e=t===~~t?t:t===!0?ge.Z_FINISH:ge.Z_NO_FLUSH,typeof c=="string"?r.input=bc(c):jr.call(c)==="[object ArrayBuffer]"?r.input=new Uint8Array(c):r.input=c,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new se.Buf8(i),r.next_out=0,r.avail_out=i),(s=Pt.inflate(r,ge.Z_NO_FLUSH))===ge.Z_NEED_DICT&&u&&(s=Pt.inflateSetDictionary(this.strm,u)),s===ge.Z_BUF_ERROR&&l===!0&&(s=ge.Z_OK,l=!1),s!==ge.Z_STREAM_END&&s!==ge.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out!==0&&s!==ge.Z_STREAM_END&&(r.avail_in!==0||e!==ge.Z_FINISH&&e!==ge.Z_SYNC_FLUSH)||(this.options.to==="string"?(n=Fc(r.output,r.next_out),o=r.next_out-n,a=wc(r.output,n),r.next_out=o,r.avail_out=i-o,o&&se.arraySet(r.output,r.output,n,o,0),this.onData(a)):this.onData(se.shrinkBuf(r.output,r.next_out)))),r.avail_in===0&&r.avail_out===0&&(l=!0)}while((r.avail_in>0||r.avail_out===0)&&s!==ge.Z_STREAM_END);return s===ge.Z_STREAM_END&&(e=ge.Z_FINISH),e===ge.Z_FINISH?(s=Pt.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===ge.Z_OK):e!==ge.Z_SYNC_FLUSH||(this.onEnd(ge.Z_OK),r.avail_out=0,!0)},kt.prototype.onData=function(c){this.chunks.push(c)},kt.prototype.onEnd=function(c){c===ge.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=se.flattenChunks(this.chunks)),this.chunks=[],this.err=c,this.msg=this.strm.msg};var Vc={Inflate:kt,inflate:qo,inflateRaw:function(c,t){return(t=t||{}).raw=!0,qo(c,t)},ungzip:qo},zr={};(0,se.assign)(zr,Vc,ge);var Bc=zr,Hc=function(){function c(t){F(this,c),this._m=t,this._n="InflateModule",this._bLogForInflateOK=!1,this._bLogForInflateError=!1}return q(c,[{key:"inflate",value:function(t){var s,e=new Uint8Array(t).slice(4),n=Date.now();try{s=Bc.inflate(e,{to:"string"}),this._bLogForInflateOK||(this._bLogForInflateOK=!0,new L("inflateOK").end())}catch(r){return this._bLogForInflateError?void 0:(this._bLogForInflateError=!0,void new L("inflateError").setMessage(r).end())}var o=e.length+4,a=s.length;return h.d("inflate ok. zipped:".concat(o," unzipped:").concat(a)+" compression ratio:".concat(Math.round(100*(a-o)/a),"% cost:").concat(Date.now()-n)),s}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),this._bLogForInflateOK=!1,this._bLogForInflateError=!1}}]),c}(),Kc=function(){function c(t){F(this,c);var s=new L("sdkConstruct");this._n="ModuleManager",this._isReady=!1,this._reason=k.USER_NOT_LOGGED_IN,this._startLoginTs=0,this._moduleMap=new Map,this._innerEmitter=null,this._outerEmitter=null,this._checkCount=0,this._checkTimer=-1,this._moduleMap.set(X,new Nu(this,t)),this._moduleMap.set(so,new Hc(this)),this._moduleMap.set(Zt,new Ic(this)),this._moduleMap.set(Jt,new pc(this)),this._moduleMap.set(Xt,new Mc(this)),this._moduleMap.set(Re,new vc(this)),this._moduleMap.set(Xe,new sc(this)),this._moduleMap.set(Fe,new lc(this)),this._moduleMap.set(pt,new Ou(this)),this._moduleMap.set(ue,new Wu(this)),this._moduleMap.set(Yt,new Yu(this)),this._moduleMap.set(Us,new ju(this)),this._moduleMap.set(pe,new Ru(this)),this._moduleMap.set(fe,new zi(this)),this._moduleMap.set(P,new ru(this)),this._moduleMap.set(V,new Iu(this)),this._moduleMap.set(me,new Tu(this)),this._moduleMap.set(ae,new Su(this)),this._moduleMap.set(Ke,new Gu(this)),this._moduleMap.set(Ps,new kc(this)),this._moduleMap.set(to,new Pu(this)),this._moduleMap.set(gt,new wu(this)),this._moduleMap.set(jt,new Fu(this)),this._moduleMap.set(Os,new xu(this)),this._moduleMap.set(yn,new zu(this)),this._moduleMap.set(no,new Ju(this)),this._moduleMap.set(zt,new dc(this)),this._moduleMap.set(Gs,new gc(this)),this._moduleMap.set(Qt,new Cc(this)),this._moduleMap.set(mt,new Tc(this)),this._moduleMap.set(oo,new Dc(this)),this._eventThrottleMap=new Map;var e=t.instanceID,n=t.oversea,o=t.SDKAppID,a="instanceID:".concat(e," SDKAppID:").concat(o," host:").concat(ys()," oversea:").concat(n," inBrowser:").concat(ke," inMiniApp:").concat(Z)+" canIUseInflate:".concat(this.canIUseInflate())+" workerAvailable:".concat(St," UserAgent:").concat(Se);L.bindEventStatModule(this._moduleMap.get(to)),s.setMessage("".concat(a," ").concat(function(){var r="";if(Z)try{var i=Q.getSystemInfoSync(),u=i.model,l=i.version,d=i.system,p=i.platform,g=i.SDKVersion;r="model:".concat(u," version:").concat(l," system:").concat(d," platform:").concat(p," SDKVersion:").concat(g)}catch{r=""}return r}())).end(),h.i("SDK ".concat(a)),oe.prototype._getErrorMessage=this.getErrorMessage.bind(this),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}return q(c,[{key:"_startTimer",value:function(){var t=this._moduleMap.get(Xt),s=t.isWorkerEnabled();h.l("".concat(this._n,".startTimer isWorkerEnabled:").concat(s," seed:").concat(this._checkTimer)),s?t.startWorkerTimer():this._startMainThreadTimer()}},{key:"_startMainThreadTimer",value:function(){this._checkTimer<0&&(this._checkTimer=setInterval(this.onCheckTimer.bind(this),1e3)),h.l("".concat(this._n,"._startMainThreadTimer seed:").concat(this._checkTimer))}},{key:"stopTimer",value:function(){var t=this._moduleMap.get(Xt),s=t.isWorkerEnabled();h.l("".concat(this._n,".stopTimer isWorkerEnabled:").concat(s," seed:").concat(this._checkTimer)),s?t.stopWorkerTimer():this._stopMainThreadTimer()}},{key:"_stopMainThreadTimer",value:function(){h.l("".concat(this._n,"._stopMainThreadTimer")),this._checkTimer>0&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){h.l("".concat(this._n,"._stopMainThreadSocket"));var t=this._moduleMap.get(Xe);t.setIsWorkerEnabled(!0),t.reConnect()}},{key:"_startMainThreadSocket",value:function(){h.l("".concat(this._n,"._startMainThreadSocket"));var t=this._moduleMap.get(Xe);t.setIsWorkerEnabled(!1),t.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){h.l("".concat(this._n,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){h.l("".concat(this._n,".onWorkerTimerDisabled, enable main thread timer and socket")),this._startMainThreadTimer(),this._startMainThreadSocket()}},{key:"onCheckTimer",value:function(){this._checkCount+=1;var t,s=Ee(this._moduleMap);try{for(s.s();!(t=s.n()).done;){var e=N(t.value,2)[1];e.onCheckTimer&&e.onCheckTimer(this._checkCount)}}catch(n){s.e(n)}finally{s.f()}}},{key:"_initReadyList",value:function(){var t=this;this._readyList=[this._moduleMap.get(pt),this._moduleMap.get(P)],this._readyList.forEach(function(s){s.ready(function(){return t._onModuleReady()})})}},{key:"_onModuleReady",value:function(){var t=!0;if(this._readyList.forEach(function(o){o.isReady()||(t=!1)}),t&&!this._isReady){this._isReady=!0,this._outerEmitter.emit(W.SDK_READY);var s=Date.now()-this._startLoginTs;h.w("SDK is ready. cost ".concat(s," ms")),this._startLoginTs=Date.now();var e=this._moduleMap.get(gt).getNetworkType(),n=this._ssoLogForReady.getStartTs()+xt;this._ssoLogForReady.setNetworkType(e).setMessage(s).start(n).end()}}},{key:"login",value:function(){this._startLoginTs===0&&(is(),this._startLoginTs=Date.now(),this._startTimer(),this._moduleMap.get(gt).start(),this._ssoLogForReady=new L("sdkReady"),this._reason=k.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOuterEmitterInstance",value:function(){return this._outerEmitter===null&&(this._outerEmitter=new Gr,ji(this._outerEmitter),this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=(function(t,s){var e=this;if(t===W.CONVERSATION_LIST_UPDATED||t===W.FRIEND_LIST_UPDATED||t===W.GROUP_LIST_UPDATED||t===W.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)if(this._eventThrottleMap.has(t)){var n=Date.now(),o=this._eventThrottleMap.get(t);n-o.last<=1e3?(o.timeoutID&&clearTimeout(o.timeoutID),o.timeoutID=setTimeout(function(){o.last=Date.now(),e._outerEmitter._emit.apply(e._outerEmitter,[t,{name:t,data:e._getEventData(t)}])},1e3)):(o.last=n,this._outerEmitter._emit.apply(this._outerEmitter,[t,{name:t,data:this._getEventData(t)}]))}else this._eventThrottleMap.set(t,{last:Date.now(),timeoutID:-1}),this._outerEmitter._emit.apply(this._outerEmitter,[t,{name:t,data:this._getEventData(t)}]);else this._outerEmitter._emit.apply(this._outerEmitter,[t,{name:t,data:arguments[1]}])}).bind(this)),this._outerEmitter}},{key:"_getEventData",value:function(t){return t===W.CONVERSATION_LIST_UPDATED?this._moduleMap.get(P).getLocalConversationList():t===W.FRIEND_LIST_UPDATED?this._moduleMap.get(ce).getLocalFriendList(!1):t===W.GROUP_LIST_UPDATED?this._moduleMap.get(V).getLocalGroupList():t===W.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._moduleMap.get(P).getTotalUnreadMessageCount():void 0}},{key:"getInnerEmitterInstance",value:function(){return this._innerEmitter===null&&(this._innerEmitter=new Gr,this._innerEmitter._emit=this._innerEmitter.emit,this._innerEmitter.emit=(function(t,s){var e;e=ne(arguments[1])&&arguments[1].data?[t,{name:arguments[0],data:arguments[1].data}]:[t,{name:arguments[0],data:arguments[1]}],this._innerEmitter._emit.apply(this._innerEmitter,e)}).bind(this)),this._innerEmitter}},{key:"hasModule",value:function(t){return this._moduleMap.has(t)}},{key:"getModule",value:function(t){return this._moduleMap.get(t)}},{key:"canIUseInflate",value:function(){return!!this._moduleMap.get(so)}},{key:"isReady",value:function(){return this._isReady}},{key:"isIntl",value:function(){return this.getModule(X).isIntl()}},{key:"getNotReadyReason",value:function(){return this._reason}},{key:"setNotReadyReason",value:function(t){this._reason=t}},{key:"getErrorMessage",value:function(t,s,e){return this._moduleMap.get(Ps).get({key:t,replacement1:s,replacement2:e,isIntl:this.isIntl()})}},{key:"outputWarning",value:function(t,s,e){var n=this.getErrorMessage(t,s,e);n&&h.w(n)}},{key:"onError",value:function(t){var s="code:".concat(t.code," message:").concat(t.message);h.w("Oops! ".concat(s)),new L("error").setMessage(s).setNetworkType(this.getModule(gt).getNetworkType()).setLevel("error").end(),this.getOuterEmitterInstance().emit(W.ERROR,t)}},{key:"restartTimer",value:function(){h.l("".concat(this._n,".restartTimer")),this.stopTimer(),this._startTimer(),this.getModule(V).restartPolling()}},{key:"getTimerID",value:function(){var t=this._moduleMap.get(Xt);return t.isWorkerEnabled()?t.getTimerID():this._checkTimer}},{key:"getPollingTimerID",value:function(t){return this._moduleMap.get(V).getPollingTimerID(t)}},{key:"reset",value:function(){h.l("".concat(this._n,".reset")),is();var t,s=Ee(this._moduleMap);try{for(s.s();!(t=s.n()).done;){var e=N(t.value,2)[1];e.reset&&e.reset()}}catch(r){s.e(r)}finally{s.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._outerEmitter.emit(W.SDK_NOT_READY);var n,o=Ee(this._eventThrottleMap);try{for(o.s();!(n=o.n()).done;){var a=N(n.value,2)[1];a.timeoutID&&clearTimeout(a.timeoutID)}}catch(r){o.e(r)}finally{o.f()}this._eventThrottleMap.clear()}}]),c}(),Wc=function(){function c(t){F(this,c),this._funcMap=new Map,this._m=t}return q(c,[{key:"defense",value:function(t,s){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(typeof t!="string"||t.length===0||typeof s!="function")return null;if(this._funcMap.has(t)&&this._funcMap.get(t).has(s))return this._funcMap.get(t).get(s);this._funcMap.has(t)||this._funcMap.set(t,new Map);var n=null;return this._funcMap.get(t).has(s)?n=this._funcMap.get(t).get(s):(n=this._pack(t,s,e),this._funcMap.get(t).set(s,n)),n}},{key:"defenseOnce",value:function(t,s){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return typeof s!="function"?null:this._pack(t,s,e)}},{key:"find",value:function(t,s){return typeof t!="string"||t.length===0||typeof s!="function"?null:this._funcMap.has(t)&&this._funcMap.get(t).has(s)?this._funcMap.get(t).get(s):(this._m.outputWarning("ListenerFnNotFound",t),null)}},{key:"delete",value:function(t,s){return typeof s=="function"&&!!this._funcMap.has(t)&&!!this._funcMap.get(t).has(s)&&(this._funcMap.get(t).delete(s),this._funcMap.get(t).size===0&&this._funcMap.delete(t),!0)}},{key:"_pack",value:function(t,s,e){var n=this;return function(){try{s.apply(e,Array.from(arguments))}catch(u){var o=Object.values(W).indexOf(t),a="CallbackError";if(o!==-1){var r=Object.keys(W)[o];n._m.outputWarning(a,r,u)}var i=new L(a);i.setMessage("eventName:".concat(t)).setMoreMessage(u.message).end()}}}}]),c}(),Yc=function(){function c(t){F(this,c);var s={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||"",oversea:t.oversea||!1,instanceID:Ms(),devMode:t.devMode||!1,proxyServer:t.proxyServer||void 0,fileUploadProxy:t.fileUploadProxy||void 0,fileDownloadProxy:t.fileDownloadProxy||t.fileUploadProxy||void 0};this._m=new Kc(s),this._safetyCallbackFactory=new Wc(this._m)}return q(c,[{key:"onError",value:function(t){this._m.onError(t)}},{key:"login",value:function(t){return this._m.login(),this._getModule(pt).login(t)}},{key:"logout",value:function(){var t=this;return this._getModule(pt).logout().then(function(s){return t._m.reset(),s})}},{key:"isReady",value:function(){return this._m.isReady()}},{key:"isIntl",value:function(){return this._m.isIntl()}},{key:"getNotReadyReason",value:function(){return this._m.getNotReadyReason()}},{key:"getErrorMessage",value:function(t,s,e){return this._m.getErrorMessage(t,s,e)}},{key:"_getModule",value:function(t){return this._m.getModule(t)}},{key:"destroy",value:function(){var t=this;return this.logout().finally(function(){t._m.stopTimer(),t._getModule(Xt).terminate(),t._getModule(Xe).dealloc();var s=t._m.getOuterEmitterInstance(),e=t._getModule(X);s.emit(W.SDK_DESTROY,{SDKAppID:e.getSDKAppID()})})}},{key:"on",value:function(t,s,e){h.d("on","eventName:".concat(t)),this._m.getOuterEmitterInstance().on(t,this._safetyCallbackFactory.defense(t,s,e),e)}},{key:"once",value:function(t,s,e){h.d("once","eventName:".concat(t)),this._m.getOuterEmitterInstance().once(t,this._safetyCallbackFactory.defenseOnce(t,s,e),e||this)}},{key:"off",value:function(t,s,e,n){h.d("off","eventName:".concat(t));var o=this._safetyCallbackFactory.find(t,s);o!==null&&(this._m.getOuterEmitterInstance().off(t,o,e,n),this._safetyCallbackFactory.delete(t,s))}},{key:"registerPlugin",value:function(t){S(t["tim-offline-push-plugin"])?this._getModule(yn).registerPlugin(t):this._getModule(Qt).registerPlugin(t)}},{key:"setLogLevel",value:function(t){if(t<=0){var s=this.getErrorMessage("TIM_ASCII_ART");s&&console.log(s);var e=this.getErrorMessage("API_REFER");e&&(zn()?console.log("%c ".concat("IM SDK API ->"," %c"),"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",e):console.log("IM SDK API ->",e));var n=this.getErrorMessage("DOCS_GUIDE");n&&console.log(n)}h.setLevel(t)}},{key:"createTextMessage",value:function(t){return this._getModule(ue).createTextMessage(t)}},{key:"createTextAtMessage",value:function(t){return this._getModule(ue).createTextMessage(t)}},{key:"createImageMessage",value:function(t){return this._getModule(ue).createImageMessage(t)}},{key:"createAudioMessage",value:function(t){return this._getModule(ue).createAudioMessage(t)}},{key:"createVideoMessage",value:function(t){return this._getModule(ue).createVideoMessage(t)}},{key:"createCustomMessage",value:function(t){return this._getModule(ue).createCustomMessage(t)}},{key:"createFaceMessage",value:function(t){return this._getModule(ue).createFaceMessage(t)}},{key:"createFileMessage",value:function(t){return this._getModule(ue).createFileMessage(t)}},{key:"createLocationMessage",value:function(t){return this._getModule(ue).createLocationMessage(t)}},{key:"createMergerMessage",value:function(t){return this._getModule(ue).createMergerMessage(t)}},{key:"downloadMergerMessage",value:function(t){return t.type!==f.MSG_MERGER?T({code:k.MESSAGE_MERGER_TYPE_INVALID}):R(t.payload.downloadKey)?T({code:k.MESSAGE_MERGER_KEY_INVALID}):this._getModule(ue).downloadMergerMessage(t).catch(function(s){return T({code:k.MESSAGE_MERGER_DOWNLOAD_FAIL})})}},{key:"createForwardMessage",value:function(t){return this._getModule(ue).createForwardMessage(t)}},{key:"sendMessage",value:function(t,s){return t instanceof ve?this._getModule(ue).sendMessageInstance(t,s):T({code:k.MESSAGE_SEND_NEED_MESSAGE_INSTANCE})}},{key:"callExperimentalAPI",value:function(t,s){return t==="sendComboMessage"?this._getModule(Us).sendMessage(s):t==="handleGroupInvitation"?this._getModule(V).handleGroupInvitation(s):t==="isCommercialAbilityEnabled"?this._getModule(Zt).isFeatureEnabled(s):t==="isIntl"?this.isIntl():t==="sendTRTCCustomData"?this._getModule(oo).sendTRTCCustomData(s):t==="getTimerID"?this._m.getTimerID():t==="getPollingTimerID"?this._m.getPollingTimerID(s):T({code:k.INVALID_OPERATION})}},{key:"revokeMessage",value:function(t){return this._getModule(ue).revokeMessage(t)}},{key:"resendMessage",value:function(t){return this._getModule(ue).resendMessage(t)}},{key:"deleteMessage",value:function(t){return this._getModule(ue).deleteMessage(t)}},{key:"translateText",value:function(t){return this._getModule(ue).translateText(t)}},{key:"setMessageExtensions",value:function(t,s){return this._getModule(Yt).setMessageExtensions(t,s)}},{key:"getMessageExtensions",value:function(t){return this._getModule(Yt).getMessageExtensions(t)}},{key:"deleteMessageExtensions",value:function(t,s){return this._getModule(Yt).deleteMessageExtensions(t,s)}},{key:"modifyMessage",value:function(t){return this._getModule(ue).modifyRemoteMessage(t)}},{key:"getMessageList",value:function(t){return this._getModule(P).getMessageList(t)}},{key:"getMessageListHopping",value:function(t){return this._getModule(P).getMessageListHopping(t)}},{key:"sendMessageReadReceipt",value:function(t){return this._getModule(P).sendReadReceipt(t)}},{key:"getMessageReadReceiptList",value:function(t){return this._getModule(P).getReadReceiptList(t)}},{key:"getGroupMessageReadMemberList",value:function(t){return this._getModule(V).getReadReceiptDetail(t)}},{key:"findMessage",value:function(t){return this._getModule(P).findMessage(t)}},{key:"setMessageRead",value:function(t){return this._getModule(P).setMessageRead(t)}},{key:"getConversationList",value:function(t){return this._getModule(P).getConversationList(t)}},{key:"getConversationProfile",value:function(t){return this._getModule(P).getConversationProfile(t)}},{key:"deleteConversation",value:function(t){return this._getModule(P).deleteConversation(t)}},{key:"clearHistoryMessage",value:function(t){return this._getModule(P).clearHistoryMessage(t)}},{key:"pinConversation",value:function(t){return this._getModule(P).pinConversation(t)}},{key:"setAllMessageRead",value:function(t){return this._getModule(P).setAllMessageRead(t)}},{key:"setMessageRemindType",value:function(t){return this._getModule(P).setMessageRemindType(t)}},{key:"getTotalUnreadMessageCount",value:function(){return this._getModule(P).getTotalUnreadMessageCount()}},{key:"setConversationCustomData",value:function(t){return this._getModule(P).setConversationCustomData(t)}},{key:"markConversation",value:function(t){return this._getModule(P).markConversation(t)}},{key:"getConversationGroupList",value:function(){return this._getModule(P).getConversationGroupList()}},{key:"createConversationGroup",value:function(t){return this._getModule(P).createConversationGroup(t)}},{key:"deleteConversationGroup",value:function(t){return this._getModule(P).deleteConversationGroup(t)}},{key:"renameConversationGroup",value:function(t){return this._getModule(P).renameConversationGroup(t)}},{key:"addConversationsToGroup",value:function(t){return this._getModule(P).addConversationsToGroup(t)}},{key:"deleteConversationsFromGroup",value:function(t){return this._getModule(P).deleteConversationsFromGroup(t)}},{key:"getMyProfile",value:function(){return this._getModule(pe).getMyProfile()}},{key:"getUserProfile",value:function(t){return this._getModule(pe).getUserProfile(t)}},{key:"updateMyProfile",value:function(t){return this._getModule(pe).updateMyProfile(t)}},{key:"getBlacklist",value:function(){return this._getModule(pe).getLocalBlacklist()}},{key:"addToBlacklist",value:function(t){return this._getModule(pe).addBlacklist(t)}},{key:"removeFromBlacklist",value:function(t){return this._getModule(pe).deleteBlacklist(t)}},{key:"setSelfStatus",value:function(t){return this._getModule(pe).setSelfStatus(t)}},{key:"getUserStatus",value:function(t){return this._getModule(pe).getUserStatus(t)}},{key:"subscribeUserStatus",value:function(t){return this._getModule(pe).subscribeUserStatus(t)}},{key:"unsubscribeUserStatus",value:function(t){return this._getModule(pe).unsubscribeUserStatus(t)}},{key:"getFriendList",value:function(){var t=this._getModule(ce);return t?t.getLocalFriendList():T({code:k.CANNOT_FIND_MODULE})}},{key:"addFriend",value:function(t){var s=this._getModule(ce);return s?s.addFriend(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"deleteFriend",value:function(t){var s=this._getModule(ce);return s?s.deleteFriend(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"checkFriend",value:function(t){var s=this._getModule(ce);return s?s.checkFriend(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"getFriendProfile",value:function(t){var s=this._getModule(ce);return s?s.getFriendProfile(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"updateFriend",value:function(t){var s=this._getModule(ce);return s?s.updateFriend(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"getFriendApplicationList",value:function(){var t=this._getModule(ce);return t?t.getLocalFriendApplicationList():T({code:k.CANNOT_FIND_MODULE})}},{key:"acceptFriendApplication",value:function(t){var s=this._getModule(ce);return s?s.acceptFriendApplication(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"refuseFriendApplication",value:function(t){var s=this._getModule(ce);return s?s.refuseFriendApplication(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"deleteFriendApplication",value:function(t){var s=this._getModule(ce);return s?s.deleteFriendApplication(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"setFriendApplicationRead",value:function(){var t=this._getModule(ce);return t?t.setFriendApplicationRead():T({code:k.CANNOT_FIND_MODULE})}},{key:"getFriendGroupList",value:function(){var t=this._getModule(ce);return t?t.getLocalFriendGroupList():T({code:k.CANNOT_FIND_MODULE})}},{key:"createFriendGroup",value:function(t){var s=this._getModule(ce);return s?s.createFriendGroup(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"deleteFriendGroup",value:function(t){var s=this._getModule(ce);return s?s.deleteFriendGroup(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"addToFriendGroup",value:function(t){var s=this._getModule(ce);return s?s.addToFriendGroup(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"removeFromFriendGroup",value:function(t){var s=this._getModule(ce);return s?s.removeFromFriendGroup(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"renameFriendGroup",value:function(t){var s=this._getModule(ce);return s?s.renameFriendGroup(t):T({code:k.CANNOT_FIND_MODULE})}},{key:"getGroupList",value:function(t){return this._getModule(V).getGroupList(t)}},{key:"getGroupProfile",value:function(t){return this._getModule(V).getGroupProfile(t)}},{key:"createGroup",value:function(t){return this._getModule(V).createGroup(t)}},{key:"dismissGroup",value:function(t){return this._getModule(V).dismissGroup(t)}},{key:"updateGroupProfile",value:function(t){return this._getModule(V).updateGroupProfile(t)}},{key:"joinGroup",value:function(t){return this._getModule(V).joinGroup(t)}},{key:"quitGroup",value:function(t){return this._getModule(V).quitGroup(t)}},{key:"searchGroupByID",value:function(t){return this._getModule(V).searchGroupByID(t)}},{key:"getGroupOnlineMemberCount",value:function(t){return this._getModule(V).getGroupOnlineMemberCount(t)}},{key:"changeGroupOwner",value:function(t){return this._getModule(V).changeGroupOwner(t)}},{key:"getGroupApplicationList",value:function(){return this._getModule(V).getGroupApplicationList()}},{key:"handleGroupApplication",value:function(t){return this._getModule(V).handleGroupApplication(t)}},{key:"initGroupAttributes",value:function(t){return this._getModule(V).initGroupAttributes(t)}},{key:"setGroupAttributes",value:function(t){return this._getModule(V).setGroupAttributes(t)}},{key:"deleteGroupAttributes",value:function(t){return this._getModule(V).deleteGroupAttributes(t)}},{key:"getGroupAttributes",value:function(t){return this._getModule(V).getGroupAttributes(t)}},{key:"setGroupCounters",value:function(t){return this._getModule(V).setGroupCounters(t)}},{key:"increaseGroupCounter",value:function(t){return this._getModule(V).increaseGroupCounter(t)}},{key:"decreaseGroupCounter",value:function(t){return this._getModule(V).decreaseGroupCounter(t)}},{key:"getGroupCounters",value:function(t){return this._getModule(V).getGroupCounters(t)}},{key:"getGroupMemberList",value:function(t){return this._getModule(me).getGroupMemberList(t)}},{key:"getGroupMemberProfile",value:function(t){return this._getModule(me).getGroupMemberProfile(t)}},{key:"addGroupMember",value:function(t){return this._getModule(me).addGroupMember(t)}},{key:"deleteGroupMember",value:function(t){return this._getModule(me).deleteGroupMember(t)}},{key:"setGroupMemberMuteTime",value:function(t){return this._getModule(me).setGroupMemberMuteTime(t)}},{key:"setGroupMemberRole",value:function(t){return this._getModule(me).setGroupMemberRole(t)}},{key:"setGroupMemberNameCard",value:function(t){return this._getModule(me).setGroupMemberNameCard(t)}},{key:"setGroupMemberCustomField",value:function(t){return this._getModule(me).setGroupMemberCustomField(t)}},{key:"markGroupMemberList",value:function(t){return this._getModule(me).markGroupMemberList(t)}},{key:"getJoinedCommunityList",value:function(){return this._getModule(ae).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(t){return this._getModule(ae).createTopicInCommunity(t)}},{key:"deleteTopicFromCommunity",value:function(t){return this._getModule(ae).deleteTopicFromCommunity(t)}},{key:"updateTopicProfile",value:function(t){return this._getModule(ae).updateTopicProfile(t)}},{key:"getTopicList",value:function(t){return this._getModule(ae).getTopicList(t)}}]),c}(),jc={login:1,logout:1,destroy:1,on:1,off:1,ready:1,setLogLevel:1,joinGroup:1,quitGroup:1,registerPlugin:1,getGroupOnlineMemberCount:1};function zc(c,t){if(c.isReady()||jc[t]===1)return!0;var s=c.getNotReadyReason(),e={code:s,message:"".concat(c.getErrorMessage(s)," | ").concat(t," | ").concat(c.getErrorMessage(k.SDK_IS_NOT_READY))};return c.onError(e),e}var an={},bt={};return bt.create=function(c){var t=0,s=c.SDKAppID;if(ee(s))t=s;else if(t=parseInt(s),isNaN(s))return h.e("".concat("TIM.create"," failed. Failed to parse the SDKAppID, please check the arguments")),null;if(t&&an[t])return an[t];h.l("".concat("TIM.create"));var e=new Yc(m(m({},c),{},{SDKAppID:t}));e.on(W.SDK_DESTROY,function(o){an[o.data.SDKAppID]=null,delete an[o.data.SDKAppID]});var n=function(o){var a=Object.create(null);return Object.keys(Gi).forEach(function(r){if(o[r]){var i=new Qr;a[r]=function(){var u=Array.from(arguments);return i.use(function(l,d){var p=zc(o,r);return p===!0?d():T(p)}).use(function(l,d){if(Ni(l,Ns[r],r)===!0)return d()}).use(function(l,d){return o[r].apply(o,l)}),i.run(u)}}}),a}(e);return an[t]=n,Ns.hookGetAPITips(e.getErrorMessage.bind(e)),h.l("".concat("TIM.create"," ok")),n},bt.TYPES=f,bt.EVENT=W,bt.VERSION="2.27.6",h.l("TIM.VERSION:".concat(bt.VERSION)),bt})}(Gn)),Gn.exports}export{tl as r};