"use strict";const e={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",ROOM_CUSTOM_DATA_RECEIVED:"onRoomCustomDataReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",MESSAGE_EXTENSIONS_UPDATED:"onMessageExtensionsUpdated",MESSAGE_EXTENSIONS_DELETED:"onMessageExtensionsDeleted",MESSAGE_REACTIONS_UPDATED:"onMessageReactionsUpdated",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_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",MY_FOLLOWERS_LIST_UPDATED:"onMyFollowersListUpdated",MY_FOLLOWING_LIST_UPDATED:"onMyFollowingListUpdated",MUTUAL_FOLLOWERS_LIST_UPDATED:"onMutualFollowersListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",ALL_RECEIVE_MESSAGE_OPT_UPDATED:"onAllReceiveMessageOptUpdated"},t={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_ROOM:"Room",GRP_LIVE:"Live",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",RECEIVE_WITH_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_MSG_EXCEPT_AT:"NotReceiveMsgExceptAt",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,IOS_OFFLINE_PUSH_NO_SOUND:"push.no_sound",IOS_OFFLINE_PUSH_DEFAULT_SOUND:"default"};class s{constructor(){this.cache=[],this.options=null}use(e){if("function"!=typeof e)throw"middleware must be a function";return this.cache.push(e),this}next(e){if(this.middlewares&&0{var s=i.find(e=>e.key===t);s?s.value!==e&&(s.value=e,o=!0):(i.push({key:t,value:e}),o=!0)}),o}const it=e=>e===t.GRP_AVCHATROOM,nt=({type:e,groupID:s})=>e===t.GRP_COMMUNITY||(""+s).startsWith(Re)&&!(""+s).includes(Le),ot=e=>(""+e).startsWith(Re)&&(""+e).includes(Le),rt=e=>ke(e)&&e.slice(0,3)===t.CONV_C2C,at=e=>ke(e)&&e.slice(0,5)===t.CONV_GROUP,ct=e=>ke(e)&&e===t.CONV_SYSTEM;function lt(t,s){const i={};return Object.keys(t).forEach(e=>{i[e]=s(t[e],e)}),i}function ut(i){return F?Promise.resolve({width:0,height:0}):k?new Promise((t,e)=>{$.getImageInfo({src:i,success(e){t({width:e.width,height:e.height})},fail(){t({width:0,height:0})}})}):Z&&9===Q?Promise.resolve({width:0,height:0}):new Promise((e,t)=>{let s=new Image;s.onload=function(){e({width:this.width,height:this.height}),s=null},s.onerror=function(){e({width:0,height:0}),s=null},s.src=i})}function dt(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+(e()+e())+e()+e()+e()+e()+e()+e()}function _t(){let e="unknown";if(se&&(e="mac"),te&&(e="windows"),W&&(e="ios"),z&&(e="android"),k)try{var t=$.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(e){}return e}function ht(t,s){t=t.split("."),s=s.split(".");const i=Math.max(t.length,s.length);for(;t.lengtho)return 1;if(i{var t=1===s.length?s[0][e]:void 0;n=!!Lt(t,i[e],o,e)&&n});else if(be(i))for(let e=0;e"string"==typeof e&&0!==e.length||(Ft({api:t,paramName:s,desc:$t(s)}),!1)},{name:"handler",type:"Function",validator:(e,t,s)=>"function"!=typeof e?(Ft({api:t,paramName:s,desc:Bt()}),!1):(""===e.name&&Ft({api:t,paramName:s,desc:ss()}),!0)}],once:[{name:"eventName",type:"String",validator:(e,t,s)=>"string"==typeof e&&0!==e.length||(Ft({api:t,paramName:s,desc:$t(s)}),!1)},{name:"handler",type:"Function",validator:(e,t,s)=>"function"!=typeof e?(Ft({api:t,paramName:s,desc:Bt()}),!1):(""===e.name&&Ft({api:t,paramName:s,desc:ss()}),!0)}],off:[{name:"eventName",type:"String",validator:(e,t,s)=>"string"==typeof e&&0!==e.length||(Ft({api:t,paramName:s,desc:$t(s)}),!1)},{name:"handler",type:"Function",validator:(e,t,s)=>"function"!=typeof e?(Ft({api:t,paramName:s,desc:Bt()}),!1):(""===e.name&&Ft({api:t,paramName:s,desc:ss()}),!0)}],sendMessage:[{name:"message",...cs}],setMessageExtensions:[{name:"message",...cs,validator:(e,t,s)=>e.status===Ot&&!0===e.isSupportExtension||(Ft({api:t,paramName:s,desc:is()}),!1)},{name:"extensions",...as}],getMessageExtensions:[{name:"message",...cs,validator:(e,t,s)=>e.status===Ot&&!0===e.isSupportExtension||(Ft({api:t,paramName:s,desc:is()}),!1)}],deleteMessageExtensions:[{name:"message",...cs,validator:(e,t,s)=>e.status===Ot&&!0===e.isSupportExtension||(Ft({api:t,paramName:s,desc:is()}),!1)}],addMessageReaction:[{name:"message",...cs,validator:(e,t,s)=>e.status===Ot||(Ft({api:t,paramName:s,desc:ns()}),!1)},{name:"reactionID",...rs}],removeMessageReaction:[{name:"message",...cs,validator:(e,t,s)=>e.status===Ot||(Ft({api:t,paramName:s,desc:ns()}),!1)},{name:"reactionID",...rs}],getMessageReactions:{messageList:{...as}},getAllUserListOfMessageReaction:{message:{...cs,validator:(e,t,s)=>e.status===Ot||(Ft({api:t,paramName:s,desc:ns()}),!1)},reactionID:{...rs},nextSeq:{type:"Number"},count:{type:"Number"}},getMessageList:{conversationID:{...rs,validator:e=>wt(e)},nextReqMessageID:{type:"String"},count:{type:"Number",validator:(e,t,s)=>!(!$e(e)&&!/^[1-9][0-9]*$/.test(e)&&(Ft({api:t,paramName:s,desc:Yt()}),1))}},getMessageListHopping:{conversationID:{...rs,validator:e=>wt(e)},sequence:{type:"Number"},time:{type:"Number"},direction:{type:"Number",validator:(e,t,s)=>!(!$e(e)&&0!==e&&1!==e&&(Ft({api:t,paramName:s,desc:ds("0Or1RequiredLog")}),1))},count:{type:"Number",validator:(e,t,s)=>!(!$e(e)&&!/^[1-9][0-9]*$/.test(e)&&(Ft({api:t,paramName:s,desc:Yt}),1))}},setMessageRead:{conversationID:{...rs,validator:e=>wt(e)}},setAllMessageRead:{scope:{type:"String",required:!1,validator:(e,s,i)=>!e||-1!==[t.READ_ALL_C2C_MSG,t.READ_ALL_GROUP_MSG,t.READ_ALL_MSG].indexOf(e)||(Ft({api:s,paramName:i,desc:ds("ValidScopeRequired")}),!1)}},getConversationProfile:[{name:"conversationID",...rs,validator:e=>wt(e)}],clearHistoryMessage:[{name:"conversationID",...rs,validator:e=>wt(e)}],pinConversation:{conversationID:{...rs,validator:e=>wt(e)},isPinned:{...ls}},setConversationDraft:{conversationID:{...rs,validator:e=>wt(e)},draftText:{type:"String",validator:(e,t,s)=>!!ke(e)||(Ft({api:t,paramName:s,desc:bt()}),!1)}},setConversationCustomData:{conversationIDList:{...as},customData:{type:"String",validator:(e,t,s)=>ke(e)?!(256{return Ge(e)?e<=0?(Ft({api:t,paramName:s,desc:(i=s,ds("NumberGreaterThanLog",i,0))}),!1):!(e>=Math.pow(2,64)&&(Ft({api:t,paramName:s,desc:jt(s,"Math.pow(2,64)")}),1)):(Ft({api:t,paramName:s,desc:qt()}),!1);var i}},enableMark:{...ls}},createConversationGroup:{conversationIDList:{...as},groupName:{...rs,validator:(e,t,s)=>!(!e||32!(!e||32{let o=!0;return Object.keys(t).forEach(e=>{if(!ke(t[e]))return Ft({api:s,paramName:i,desc:Xt("value")}),o=!1}),o}}},setGroupAttributes:{groupID:rs,groupAttributes:{...cs,validator:(t,s,i)=>{let o=!0;return Object.keys(t).forEach(e=>{if(!ke(t[e]))return Ft({api:s,paramName:i,desc:Xt("value")}),o=!1}),o}}},deleteGroupAttributes:{groupID:rs,keyList:{type:"Array",validator:(e,s,i)=>{if($e(e)||!be(e))return Ft({api:s,paramName:i,desc:Kt()}),!1;if(Oe(e))return!0;{let t=!0;return e.forEach(e=>{if(!ke(e))return Ft({api:s,paramName:i,desc:ds("StringArrayRequiredLog")}),t=!1}),t}}}},getGroupAttributes:{groupID:rs,keyList:{type:"Array",validator:(e,s,i)=>{if($e(e)||!be(e))return Ft({api:s,paramName:i,desc:Kt()}),!1;if(Oe(e))return!0;{let t=!0;return e.forEach(e=>{if(!ke(e))return Ft({api:s,paramName:i,desc:Xt("key")}),t=!1}),t}}}},setGroupCounters:{groupID:rs,counters:cs},increaseGroupCounter:{groupID:rs,key:rs,value:us},decreaseGroupCounter:{groupID:rs,key:rs,value:us},getGroupCounters:{groupID:rs},getGroupMemberList:{groupID:rs,count:{type:"Number"}},getGroupMemberProfile:{groupID:rs,userIDList:as,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:rs,userIDList:as},setGroupMemberRole:{groupID:rs,userID:rs,role:rs},setGroupMemberMuteTime:{groupID:rs,userID:rs,muteTime:{type:"Number",validator:e=>0<=e}},setGroupMemberNameCard:{groupID:rs,userID:{type:"String"},nameCard:{type:"String",validator:(e,t,s)=>ke(e)?(e.length,!0):(Ft({api:t,paramName:s,desc:bt()}),!1)}},setGroupMemberCustomField:{groupID:rs,userID:{type:"String"},memberCustomField:as},deleteGroupMember:{groupID:rs},markGroupMemberList:{groupID:rs,markType:{type:"number",validator:(e,t,s)=>Ge(e)?!(e<1e3&&(Ft({api:t,paramName:s,desc:Jt(s,1e3)}),1)):(Ft({api:t,paramName:s,desc:qt()}),!1)},userIDList:{...as},enableMark:{...ls}},createTextMessage:{to:rs,conversationType:rs,payload:{...cs,validator:(e,t,s)=>Fe(e)?ke(e.text)?0!==e.text.length||(Ft({api:t,paramName:"payload.text",desc:Qt()}),!1):(Ft({api:t,paramName:"payload.text",desc:bt()}),!1):(Ft({api:t,paramName:s,desc:Zt()}),!1)}},createTextAtMessage:{to:rs,conversationType:rs,payload:{...cs,validator:(e,t,s)=>Fe(e)?ke(e.text)?0===e.text.length?(Ft({api:t,paramName:"payload.text",desc:Qt()}),!1):!(e.atUserList&&!be(e.atUserList)&&(Ft({api:t,paramName:"payload.atUserList",desc:Kt()}),1)):(Ft({api:t,paramName:"payload.text",desc:bt()}),!1):(Ft({api:t,paramName:s,desc:Zt()}),!1)}},createCustomMessage:{to:rs,conversationType:rs,payload:{...cs,validator:(e,t,s)=>Fe(e)?e.data&&!ke(e.data)?(Ft({api:t,paramName:"payload.data",desc:bt()}),!1):e.description&&!ke(e.description)?(Ft({api:t,paramName:"payload.description",desc:bt()}),!1):!(e.extension&&!ke(e.extension)&&(Ft({api:t,paramName:"payload.extension",desc:bt()}),1)):(Ft({api:t,paramName:"payload",desc:Zt()}),!1)}},createImageMessage:{to:rs,conversationType:rs,payload:{...cs,validator:(e,t,s)=>{if(!Fe(e))return Ft({api:t,paramName:s,desc:Zt()}),!1;if($e(e.file))return Ft({api:t,paramName:"payload.file",desc:xt()}),!1;if(b){if(!(e.file instanceof HTMLInputElement||Ue(e.file)))return Fe(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Ft({api:t,paramName:"payload.file",desc:es()}),!1):(Ft({api:t,paramName:"payload.file",desc:Vt()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ft({api:t,paramName:"payload.file",desc:es()}),!1}return!0},onProgress:{type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Wt()}),!0)}}},createAudioMessage:{to:rs,conversationType:rs,payload:{...cs,validator:(e,t,s)=>!!Fe(e)||(Ft({api:t,paramName:s,desc:Zt()}),!1)},onProgress:{type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Wt()}),!0)}},createVideoMessage:{to:rs,conversationType:rs,payload:{...cs,validator:(e,t,s)=>{if(!Fe(e))return Ft({api:t,paramName:s,desc:Zt()}),!1;if($e(e.file))return Ft({api:t,paramName:"payload.file",desc:xt()}),!1;if(b){if(!(e.file instanceof HTMLInputElement||Ue(e.file)))return Fe(e.file)&&"undefined"!=typeof uni?!!Ue(e.file.tempFile)||(Ft({api:t,paramName:"payload.file",desc:es()}),!1):(Ft({api:t,paramName:"payload.file",desc:Vt()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ft({api:t,paramName:"payload.file",desc:es()}),!1}return!0}},onProgress:{type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Wt()}),!0)}},createFaceMessage:{to:rs,conversationType:rs,payload:{...cs,validator:(e,t,s)=>Fe(e)?Ge(e.index)?!!ke(e.data)||(Ft({api:t,paramName:"payload.data",desc:bt()}),!1):(Ft({api:t,paramName:"payload.index",desc:qt()}),!1):(Ft({api:t,paramName:s,desc:Zt()}),!1)}},createFileMessage:{to:rs,conversationType:rs,payload:{...cs,validator:(e,t,s)=>{if(!Fe(e))return Ft({api:t,paramName:s,desc:Zt()}),!1;if($e(e.file))return Ft({api:t,paramName:"payload.file",desc:xt()}),!1;if(b){if(!(e.file instanceof HTMLInputElement||Ue(e.file)))return Fe(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Ft({api:t,paramName:"payload.file",desc:es()}),!1):(Ft({api:t,paramName:"payload.file",desc:Vt()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ft({api:t,paramName:"payload.file",desc:es()}),!1}return!0}},onProgress:{type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Wt()}),!0)}},createLocationMessage:{to:rs,conversationType:rs,payload:{...cs,validator:(e,t,s)=>Fe(e)?ke(e.description)?Ge(e.longitude)?!!Ge(e.latitude)||(Ft({api:t,paramName:"payload.latitude",desc:qt()}),!1):(Ft({api:t,paramName:"payload.longitude",desc:qt()}),!1):(Ft({api:t,paramName:"payload.description",desc:bt()}),!1):(Ft({api:t,paramName:s,desc:Zt()}),!1)}},createMergerMessage:{to:rs,conversationType:rs,payload:{...cs,validator:(e,t,s)=>{if(Oe(e.messageList))return Ft({api:t,paramName:"payload.messageList",desc:Ht()}),!1;if(Oe(e.compatibleText))return Ft({api:t,paramName:"payload.compatibleText",desc:$t("compatibleText")}),!1;let i=!1;return e.messageList.forEach(e=>{e.status===Nt&&(i=!0)}),!i||(Ft({api:t,paramName:"payload.messageList",desc:ds("MergeFailedMessageLog")}),!1)}}},revokeMessage:[{name:"message",...cs,validator:(e,s,i)=>Oe(e)?(Ft({api:s,paramName:i,desc:ts()}),!1):e.conversationType===t.CONV_SYSTEM?(Ft({api:s,paramName:i,desc:ds("MessageCanBeRevokedDesc")}),!1):!0!==e.isRevoked||(Ft({api:s,paramName:i,desc:ds("MessageRevokedLog")}),!1)}],deleteMessage:[{name:"messageList",...as,validator:(e,t,s)=>!Oe(e)||(Ft({api:t,paramName:s,desc:Ht()}),!1)}],translateText:{sourceTextList:as,sourceLanguage:rs,targetLanguage:rs},convertVoiceToText:{message:{...cs,validator:(e,s,i)=>Oe(e)?(Ft({api:s,paramName:i,desc:ts()}),!1):e.type===t.MSG_AUDIO&&e.status===Ot||(Ft({api:s,paramName:i,desc:ds("AudioMessageRequiredLog")}),!1)}},modifyMessage:[{name:"message",...cs,validator:(e,s,i)=>Oe(e)?(Ft({api:s,paramName:i,desc:ts()}),!1):e.conversationType===t.CONV_SYSTEM?(Ft({api:s,paramName:i,desc:ds("MessageCanBeModifiedLog")}),!1):!0!==e._onlineOnlyFlag||(Ft({api:s,paramName:i,desc:ds("OnlineMessageNotSupportLog")}),!1)}],searchCloudMessages:{keywordList:{type:"Array",required:!1,validator:(e,t,s)=>!(e&&(be(e)?0===e.length?(Ft({api:t,paramName:s,desc:Ht()}),1):5!e||"or"===e||"and"===e||Ft({api:t,paramName:s,desc:e+" is invalid match type"})},senderUserIDList:{type:"Array",required:!1,validator:(e,t,s)=>!(e&&(be(e)?(0===e.length&&Ft({api:t,paramName:s,desc:Ht()}),5{if(!e)return!0;if(!be(e))return Ft({api:s,paramName:i,desc:Kt()}),!1;0===e.length&&Ft({api:s,paramName:i,desc:Ht()});const o=[t.MSG_TEXT,t.MSG_IMAGE,t.MSG_AUDIO,t.MSG_FILE,t.MSG_VIDEO,t.MSG_LOCATION,t.MSG_CUSTOM,t.MSG_MERGER];return!(0-1===o.indexOf(e)).length&&(Ft({api:s,paramName:i,desc:(e=i,ds("ContainsUnsupportedMessageTypeLog",e))}),1))}},conversationID:{type:"String",required:!1,validator:e=>!e||wt(e)},timePosition:{type:"number",required:!1,validator:(e,t,s)=>!(e&&e<0&&(Ft({api:t,paramName:s,desc:Jt(s,0)}),1))},timePeriod:{type:"number",required:!1,validator:(e,t,s)=>!(e&&e<0&&(Ft({api:t,paramName:s,desc:Jt(s,0)}),1))},cursor:{type:"String",required:!1}},getUserProfile:{userIDList:{type:"Array",validator:(e,t,s)=>be(e)?(0===e.length&&Ft({api:t,paramName:s,desc:Ht()}),!0):(Ft({api:t,paramName:s,desc:Kt()}),!1)}},updateMyProfile:{profileCustomField:{type:"Array",validator:(e,t,s)=>!!$e(e)||!!be(e)||(Ft({api:t,paramName:s,desc:Kt()}),!1)}},setSelfStatus:{customStatus:{type:"String",validator:(e,t,s)=>!!ke(e)||(Ft({api:t,paramName:s,desc:bt()}),!1)}},getUserStatus:{userIDList:{type:"Array",validator:(e,t,s)=>be(e)?0!==e.length||(Ft({api:t,paramName:s,desc:Ht()}),!1):(Ft({api:t,paramName:s,desc:Kt()}),!1)}},subscribeUserStatus:{userIDList:{type:"Array",validator:(e,t,s)=>be(e)?0!==e.length||(Ft({api:t,paramName:s,desc:Ht()}),!1):(Ft({api:t,paramName:s,desc:Kt()}),!1)}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:(e,t,s)=>!e||!!be(e)||(Ft({api:t,paramName:s,desc:Kt()}),!1)}},addFriend:{to:rs,source:{type:"String",required:!0,validator:(e,t,s)=>!(!e||(e.startsWith("AddSource_Type_")?8!(ke(e)&&96!(ke(e)&&96{if(e){if(!be(e))return Ft({api:s,paramName:i,desc:Kt()}),!1;let t=!0;return e.forEach(e=>ke(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?ke(e.value)?8be(e)?0!==e.length||(Ft({api:t,paramName:s,desc:Ht()}),!1):(Ft({api:t,paramName:s,desc:Kt()}),!1)}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:(e,t,s)=>be(e)?0!==e.length||(Ft({api:t,paramName:s,desc:Ht()}),!1):(Ft({api:t,paramName:s,desc:Kt()}),!1)}],createTopicInCommunity:{groupID:rs,topicName:rs},deleteTopicFromCommunity:{groupID:rs,topicIDList:{type:"Array",validator:(e,t,s)=>!e||!!be(e)||(Ft({api:t,paramName:s,desc:Kt()}),!1)}},updateTopicProfile:{groupID:rs,topicID:rs},getTopicList:{groupID:rs,topicIDList:{type:"Array",validator:(e,t,s)=>!e||!!be(e)||(Ft({api:t,paramName:s,desc:Kt()}),!1)}},followUser:[{name:"userIDList",...as}],unfollowUser:[{name:"userIDList",...as}],getMyFollowingList:[{name:"startIndex",...rs,required:!1}],getMyFollowersList:[{name:"startIndex",...rs,required:!1}],getMutualFollowersList:[{name:"startIndex",...rs,required:!1}],getUserFollowInfo:[{name:"userIDList",...as,required:!1}],checkFollowType:[{name:"userIDList",...as}],addSignalingListener:[{name:"eventName",type:"String",validator:(e,t,s)=>"string"==typeof e&&0!==e.length||(Ft({api:t,paramName:s,desc:$t(s)}),!1)},{name:"handler",type:"Function",validator:(e,t,s)=>"function"!=typeof e?(Ft({api:t,paramName:s,desc:Bt()}),!1):(""===e.name&&Ft({api:t,paramName:s,desc:ss()}),!0)}],removeSignalingListener:[{name:"eventName",type:"String",validator:(e,t,s)=>"string"==typeof e&&0!==e.length||(Ft({api:t,paramName:s,desc:$t(s)}),!1)},{name:"handler",type:"Function",validator:(e,t,s)=>"function"!=typeof e?(Ft({api:t,paramName:s,desc:Bt()}),!1):(""===e.name&&Ft({api:t,paramName:s,desc:ss()}),!0)}],invite:{userID:rs},inviteSync:[{...cs,validator:(e,t,s)=>Fe(e)?!!ke(e.userID)||(Ft({api:t,paramName:"options.userID",desc:bt()}),!1):(Ft({api:t,paramName:"options",desc:Zt()}),!1)},{name:"successCb",type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Bt()}),!0)},{name:"errorCb",type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Bt()}),!0)}],inviteInGroup:{groupID:rs,inviteeList:as},inviteInGroupSync:[{...cs,validator:(e,t,s)=>Fe(e)?ke(e.groupID)?!!be(e.inviteeList)||(Ft({api:t,paramName:"options.inviteeList",desc:Kt()}),!1):(Ft({api:t,paramName:"options.groupID",desc:bt()}),!1):(Ft({api:t,paramName:"options",desc:Zt()}),!1)},{name:"successCb",type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Bt()}),!0)},{name:"errorCb",type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Bt()}),!0)}],accept:{inviteID:rs},reject:{inviteID:rs},getSignalingInfo:[{name:"message",...cs,validator:(e,t,s)=>!Oe(e)||(Ft({api:t,paramName:s,desc:ts()}),!1)}],modifyInvitation:{inviteID:rs,data:rs}},hs={login:1,logout:1,getLoginUser:1,getServerTime:1,on:1,once:1,off:1,setLogLevel:1,registerPlugin:1,destroy:1,isReady: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,convertVoiceToText:1,modifyMessage:1,searchCloudMessages:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageReadReceiptList:1,setMessageExtensions:1,getMessageExtensions:1,deleteMessageExtensions:1,addMessageReaction:1,removeMessageReaction:1,getMessageReactions:1,getAllUserListOfMessageReaction:1,getMessageList:1,findMessage:1,getMessageListHopping:1,setMessageRead:1,setAllMessageRead:1,getConversationList:1,getConversationProfile:1,deleteConversation:1,setConversationDraft:1,pinConversation:1,getTotalUnreadMessageCount:1,setConversationCustomData:1,markConversation:1,createConversationGroup:1,getConversationGroupList:1,deleteConversationGroup:1,renameConversationGroup:1,addConversationsToGroup:1,deleteConversationsFromGroup:1,clearHistoryMessage:1,setMessageRemindType:1,setAllReceiveMessageOpt:1,getAllReceiveMessageOpt:1,getGroupList:1,getGroupProfile:1,createGroup:1,joinGroup:1,updateGroupProfile:1,quitGroup:1,dismissGroup:1,changeGroupOwner:1,searchGroupByID: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,followUser:1,unfollowUser:1,getMyFollowingList:1,getMyFollowersList:1,getMutualFollowersList:1,getUserFollowInfo:1,checkFollowType:1,callExperimentalAPI:1,addSignalingListener:1,removeSignalingListener:1,invite:1,inviteSync:1,inviteInGroup:1,inviteInGroupSync:1,cancel:1,accept:1,reject:1,getSignalingInfo:1,modifyInvitation:1},ps=1,gs=2,ms=3,fs=4,Ms=6,Is=7,Cs=8,Ts=10,ys=11,vs=12,Ss=13,Es=14,Ds=15,Rs=17,Ls=18,As=19,Os=20,Ns=21,Ps=23,Us=24,Gs=25,ks=26,ws=27,Fs=28,bs=29,$s=30,qs=31,xs=32,Vs=33,Bs=34,Ks=35,Hs=36,Ws=37,Ys=function(e){return{code:0,data:e||{}}};class zs extends Error{constructor(e){super();var{code:e,message:t,data:s}=e;this.code=e,t?this.message=t:this._getErrMsg&&(this.message=this._getErrMsg(this.code)),this.data=s||{}}}const js={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,MSG_SEND_FAIL:2100,MSG_SEND_FAIL_NOT_IN_AV:2101,MSG_INSTANCE_REQUIRED:2105,MSG_INVALID_CONV_TYPE:2106,MSG_F_IS_EMPTY:2108,MSG_ONPROGRESS_ERR:2109,MSG_REVOKE_FAIL:2110,MSG_DELETE_FAIL:2111,MSG_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MSG_LIST_EMPTY:2114,MSG_SEND_GRP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GRP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,VOICE_TO_TEXT_FAIL:2118,UNSUPPORTED_VOICE_FORMAT:2119,MSG_I_SELECT_F_FIRST:2251,MSG_I_TYPES_LIMIT:2252,MSG_I_SIZE_LIMIT:2253,MSG_A_UPLOAD_FAIL:2300,MSG_A_SIZE_LIMIT:2301,MSG_V_UPLOAD_FAIL:2350,MSG_V_SIZE_LIMIT:2351,MSG_V_TYPES_LIMIT:2352,MSG_F_UPLOAD_FAIL:2400,MSG_F_SELECT_F_FIRST:2401,MSG_F_SIZE_LIMIT:2402,MSG_F_URL_IS_EMPTY:2403,MSG_MERGER_TYPE_INVALID:2450,MSG_MERGER_KEY_INVALID:2451,MSG_MERGER_DOWNLOAD_FAIL:2452,MSG_FORWARD_TYPE_INVALID:2453,MSG_FORWARD_INVALID_ELEMENTS:2454,MSG_MODIFY_CONFLICT:2480,MSG_MODIFY_DISABLED_IN_AV:2481,CONV_NOT_FOUND:2500,USER_OR_GRP_NOT_FOUND:2501,CONV_UN_RECORDED_TYPE:2502,INVALID_CONV_ID:2503,ILLEGAL_GRP_TYPE:2600,ILLEGAL_GRP_ID:2602,CANNOT_FIND_GRP:2603,CANNOT_CHANGE_OWNER_IN_AV:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,MEMBER_NOT_IN_GRP:2623,JOIN_GRP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AV:2661,CANNOT_JOIN_NON_AV_WITHOUT_LOGIN:2662,NOT_OWNER:2681,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,OPERATION_NOT_SUPPORTED_IN_AV:2687,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GRP_EXISTED:2710,FRIEND_GRP_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,NO_PROTOCOL:2997,NO_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,NO_USE:3122,PROFANITY_FOUND:3123,OPTIONS_IS_EMPTY:3153,MSG_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022,SIGNALING_INVALID_INVITE_ID:8010,SIGNALING_NO_PERMISSION:8011,SIGNALING_ALREADY_EXISTS:8012,INVALID_CANCEL_MESSAGE:8020,MSG_SEARCH_CURSOR_INVALID:27002,MSG_SEARCH_CURSOR_EXPIRED:27003};let Js=null;const Xs=function(e){Js=e},Zs=function(e){return Promise.resolve(Ys(e))},Qs=function(t,s=!1){if(t instanceof zs)return s&&null!==Js&&Js.emit(e.ERROR,t),Promise.reject(t);if(t instanceof Error){const t=new zs({code:js.UNCAUGHT_ERROR});return s&&null!==Js&&Js.emit(e.ERROR,t),Promise.reject(t)}return $e(t)||$e(t.code)?Promise.reject(new zs({code:js.UNCAUGHT_ERROR})):(t=new zs(t),s&&null!==Js&&Js.emit(e.ERROR,t),Promise.reject(t))};class ei{constructor(e){this._m=e,this._n=""}isLoggedIn(){return this._m.get(vs).isLoggedIn()}isOversea(){return this._m.get(vs).isOversea()}isPrivateNetWork(){var e=this._m.get(vs);return e.isPrivateNetWork()&&!e.getFileDownloadProxy()}getFileDownloadProxy(){return this._m.get(vs).getFileDownloadProxy()}getDowloadFileAuthKey(){return this._m.get(vs).getDowloadFileAuthKey()}getMyUserID(){return this._m.get(vs).getUserID()}getMyTinyID(){return this._m.get(vs).getTinyID()}getSDKAppID(){return this._m.get(vs).getSDKAppID()}isIntl(){return this._m.get(vs).isIntl()}isUsingChatCore(){return this._m.get(vs).isUsingChatCore()}isDevMode(){return this._m.get(vs).isDevMode()}get(e){return this._m.get(e)}getPlatform(){return V}getCloudConfig(e){return this._m.get(Ps).getCloudConfig(e)}emitOEvt(e,t){this._m.getOEmitInst().emit(e,t)}emitIEvt(e,t){this._m.getIEmitInst().emit(e,t)}getIEmitInst(){return this._m.getIEmitInst()}req(e){return this._m.get(Os).req(e)}canIUse(e){return this._m.get(ws).canIUse(e)}getErrMsg(e,t,s){return this._m.getErrMsg(e,t,s)}warn(e,t,s){e=this.getErrMsg(e,t,s);e&&Ce.w(e)}noUse(e){var t=js.NO_USE;return Qs({code:t,message:this.getErrMsg(t,e)})}}const ti={LOGIN:"wslogin",LOGOUT:"wslogout",HELLO:"wshello",KICK_OTHER:"KickOther",SYNC_UNREAD_MSG:"getmsg",SEND_C2C_MSG:"sendmsg",SEND_GRP_MSG:"send_group_msg",GET_USER_PROFILE:"portrait_get_all",UPDATE_MY_PROFILE:"portrait_set",GET_BL:"black_list_get",ADD_TO_BL:"black_list_add",RM_FROM_BL:"black_list_delete",GET_FD_LIST:"friend_get",GET_FD_PROFILE:"friend_get_specified",CHECK_FD:"friend_check",DEL_FD:"friend_delete",ADD_FD:"friend_add",UPDATE_FD:"friend_update",RESPOND_FD_APPLICATION:"friend_response",GET_FD_APPLICATION_LIST:"pendency_get",DEL_FD_APPLICATION:"pendency_delete",REFUSE_FD_APPLICATION:"pendency_refuse",REPORT_FD_APPLICATION:"pendency_report",GET_FD_GRP_LIST:"group_get",CREATE_FD_GRP:"group_add",DEL_FD_GRP:"group_delete",UPDATE_FD_GRP:"group_update",REVOKE_C2C_MSG:"msgwithdraw",SET_C2C_MSG_READ:"msgreaded",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_C2C_ROAMING_MSG:"getroammsg",GET_C2C_PEER_READ_TIME:"get_peer_read_time",DEL_C2C_MSG:"delete_c2c_msg_ramble",MODIFY_C2C_MSG:"modify_c2c_msg",MODIFY_C2C_MSG_EXT:"set_key_values",GET_C2C_MSG_EXT:"get_key_values",ADD_C2C_MSG_REACTION:"reaction_add",RM_C2C_MSG_REACTION:"reaction_del",GET_C2C_MSG_REACTIONS:"reaction_multi_stat",GET_C2C_MSG_REACTION_USER_LIST:"reaction_iterate",PAGING_GET_CONV_LIST:"page_get",DEL_CONV:"batch_delete",CLEAR_HISTORY_MSG:"clear_msg",PIN_CONV:"top",DEL_GROUP_AT_TIPS:"deletemsg",SET_CONV_CUSTOM_DATA:"set_conv_custom_data",MARK_CONV:"mark_contact",CREATE_CONV_GRP:"create_contact_group",DEL_CONV_GRP:"del_contact_group",RENAME_CONV_GRP:"update_contact_group",ADD_CONV_TO_GRP:"add_conv_to_group",DEL_CONV_FROM_GRP:"del_conv_from_group",GET_CONV_GRP_LIST:"get_contact_group",SEARCH_CONV_GRP_MARK:"search_contact_group",GET_GRP_LIST:"get_joined_group_list",GET_GRP_PROFILE:"get_group_self_member_info",CREATE_GRP:"create_group",DISMISS_GRP:"destroy_group",UPDATE_GRP_PROFILE:"modify_group_base_info",APPLY_JOIN_GRP:"apply_join_group",APPLY_JOIN_GRP_NOAUTH:"apply_join_group_noauth",QUIT_GRP:"quit_group",SEARCH_GRP:"get_group_public_info",CHANGE_GRP_OWNER:"change_group_owner",HANDLE_GRP_APPLICATION:"handle_apply_join_group",HANDLE_INVITE_JOIN_GRP:"handle_invite_join_permission_group",HANDLE_GRP_INVITATION:"handle_invite_join_group",REVOKE_GRP_MSG:"group_msg_recall",SET_GRP_MSG_READ:"msg_read_report",SET_ALL_MSG_READ:"read_all_unread_msg",GET_GRP_ROAMING_MSG:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",GET_GRP_PENDENCY:"get_pendency",DEL_GRP_SYSTEM_NOTICE:"deletemsg",AV_POLLING:"get_msg",AV_NOAUTH_POLLING:"get_msg_noauth",GET_ONLINE_MBR_NUM:"get_online_member_num",DEL_GRP_MSG:"delete_group_ramble_msg_by_seq",MODIFY_GRP_MSG:"modify_group_msg",SET_GRP_ATTR:"set_group_attr",MODIFY_GRP_ATTR:"modify_group_attr",DEL_GRP_ATTR:"delete_group_attr",CLEAR_GRP_ATTR:"clear_group_attr",GET_GRP_ATTR:"get_group_attr",MODIFY_GRP_MSG_EXT:"group_set_key_values",GET_GRP_MSG_EXT:"group_get_key_values",GET_GRP_NOTIFY:"batch_get_group_notify",UPDATE_GRP_COUNTER:"update_group_counter",GET_GRP_COUNTER:"get_group_counter",ADD_GRP_MSG_REACTION:"group_reaction_add",RM_GRP_MSG_REACTION:"group_reaction_del",GET_GRP_MSG_REACTIONS:"group_reaction_multi_stat",GET_GRP_MSG_REACTION_USER_LIST:"group_reaction_iterate",GET_GRP_MBR_LIST:"get_group_member_info",GET_AV_MBR_LIST:"get_members",GET_GRP_MBR_PROFILE:"get_specified_group_member_info",ADD_GRP_MBR:"add_group_member",DEL_GRP_MBR:"delete_group_member",BAN_AV_MBR:"ban_group_member",MODIFY_GRP_MBR_INFO:"modify_group_member_info",MARK_AV_MBR_INFO:"modify_user_info",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",SIMPLE_COS_PRE_SIG:"simple_sig",GET_IMAGE_INFO:"get_imageinfo",GET_IP:"get_final_ip",VIDEO_COVER:"video_cover",SSO_STAT:"tim_web_report_v2",PING:"alive",MSG_PUSH:"msg_push",MSG_CLOUD_SEARCH:"query",MULTI_MSG_PUSH:"multi_msg_push_ws",MSG_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",UPLOAD_MERGER_MSG:"save_relay_json_msg",DOWNLOAD_MERGER_MSG:"get_relay_json_msg",FETCH_CLOUD_CTRL_CONFIG:"fetch_config",PUSHED_CLOUD_CTRL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",OVERLOAD_NOTIFY:"notify2",CREATE_TOPIC:"create_topic",DEL_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",SUB_USER_STATUS:"ws_status_subscribe",UNSUB_USER_STATUS:"ws_status_unsubscribe",STAT_BACKGROUND:"ws_stat_background",STAT_FOREGROUND:"ws_stat_foreground",SET_TOKEN:"ws_stat_settoken",PUSH_REPORT:"uniapp_sdk_report",GET_PROFANITY_LIST:"get_local_words",TRANSLATE_TEXT:"ws_batch_trans_text",VOICE_TO_TEXT:"ws_sentence_recognition",FOLLOW:"follow_add",UNFOLLOW:"follow_delete",GET_FOLLOW:"follow_get",GET_FOLLOW_INFO:"follow_get_info",CHECK_FOLLOW_TYPE:"follow_check",SET_ALL_RECEIVE_MSG_OPT:"ws_set_do_not_disturb",GET_ALL_RECEIVE_MSG_OPT:"ws_get_do_not_disturb"},si="networkRTT",ii="messageE2EDelay",ni="sendMessageC2C",oi="sendMessageGroup",ri="sendMessageGroupAV",ai="sendMessageRichMedia",ci="cosUpload",li="messageReceivedGroup",ui="messageReceivedGroupAVPush",di="messageReceivedGroupAVPull",_i={[si]:2,[ii]:3,[ni]:4,[oi]:5,[ri]:6,[ai]:7,[li]:8,[ui]:9,[di]:10,[ci]:11},hi={info:4,warning:5,error:6},pi={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},gi={login:4,plugin_search:16,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16,plugin_emoji_reaction:16};class mi{constructor(e){this._n="SSOLogData",this.eventType=gi[e]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=e,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=pe()}static bindEventStatModule(e){mi.prototype._eventStatModule=e}static bindNetMonitorModule(e){mi.prototype._netMonitorModule=e}updateTimeStamp(){this.timestamp=pe()}start(e){return this._startts=e,this}end(e=!1){if(!this._sentFlag){if(this._netMonitorModule){const e=this._netMonitorModule.getNetworkType();this.setNetworkType(e)}var t=pe();0===this.costTime&&(this.costTime=t-this._startts),this.setMoreMessage(`startts:${this._startts} endts:`+t),e?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout(()=>{this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)},0)}}setError(t){if(t instanceof Error){if(!this._sentFlag){let e=!0;if(e=this._netMonitorModule?this._netMonitorModule.isOnline():e)t.code&&this.setCode(t.code),t.message&&this.setMoreMessage(t.message);else{const t=js.NO_NETWORK;this.setCode(t)}this.setLevel("error")}}else Ce.w(this._n+".setError value not instanceof Error, please check!");return this}setCode(e){return $e(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),Ge(e)?this.code=e:Ce.w(this._n+".setCode value not a number, please check!",e,typeof e)),this}setMessage(e){return $e(e)||this._sentFlag||(Ge(e)&&(this.message=e.toString()),ke(e)&&(this.message=e)),this}setCostTime(e){return this.costTime=e,this}setLevel(e){return $e(e)||this._sentFlag||(this.level=hi[e]),this}setMoreMessage(e){return Oe(this.moreMessage)?this.moreMessage=""+e:this.moreMessage+=" "+e,this}setNetworkType(e){return $e(e)?Ce.w(this._n+".setNetworkType value is undefined, please check!"):(e=pi[e.toLowerCase()],$e(e)||(this.networkType=e)),this}getStartTs(){return this._startts}setUIPlatform(e){return this.uiPlatform=e,this}setExtension(e){return this.extension=e,this}setEventType(e){return this.eventType=e,this}}class fi{constructor(e){this.type=t.MSG_TEXT,this.content={text:e.text||""}}setText(e){this.content.text=e}sendable(){return 0!==this.content.text.length}}function Mi(t,s,i,o=[]){if(t){let e=t;return s&&(t.startsWith("http://")?e=t.replace(/^http:\/\/[^/]+/,s):t.startsWith("https://")&&(e=t.replace(/^https:\/\/[^/]+/,s))),e=i&&-1===e.indexOf("authKey=")&&Ti(e,o)?-1{Ii(e.messageBody[0].type,e.messageBody)})}return s}function Ci(e){if(!e)return e;if(-1===e.indexOf("authKey="))return e;var e=e.split("?"),t=e[1].split("&");let s=0;for(let e=0;e{switch(e){case"remarkInfo":break;case"groupProfile":this.content.groupProfile={},this._initGroupProfile(t[e]);break;case"operatorInfo":this.content.operatorInfo={},this._initOperatorInfo(t[e]);break;case"memberInfoList":case"msgMemberInfo":this._updateMemberList(t[e]);break;case"memberExtraInfo":case"onlineMemberInfo":break;case"memberNum":this.content[e]=t[e],this.content.memberCount=t[e];break;case"newGroupProfile":this.content.newGroupProfile={},this._initNewGroupProfile(t[e]);break;default:this.content[e]=t[e]}}),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}_initGroupProfile(t){var s=Object.keys(t);for(let e=0;e{e.forEach(e=>{t.userID===e.userID&&Object.assign(t,e)})})}_initNewGroupProfile(t){var s=Object.keys(t);for(let e=0;e{switch(e){case"memberInfoList":break;case"remarkInfo":this.content.handleMessage=t[e];break;case"groupProfile":this.content.groupProfile={},this._initGroupProfile(t[e]);break;default:this.content[e]=t[e]}})}_initGroupProfile(t){var s=Object.keys(t);for(let e=0;e{!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,1===e.type?e.type=0:3===e.type&&(e.type=1))}):e===t.MSG_VIDEO?!s.remoteVideoUrl&&s.videoUrl&&(s.remoteVideoUrl=s.videoUrl):e===t.MSG_AUDIO?!s.remoteAudioUrl&&s.url&&(s.remoteAudioUrl=s.url):e===t.MSG_FILE&&!s.fileUrl&&s.url&&(s.fileUrl=s.url,s.url=void 0)}_updateRichMediaDownloadUrl(e,s,i,o,n){(i||o)&&(e===t.MSG_IMAGE?s.imageInfoArray.forEach(e=>{e.url=Mi(e.url,i,o,n)}):e===t.MSG_VIDEO?(s.videoUrl=Mi(s.videoUrl,i,o,n),s.snapshotUrl=Mi(s.thumbUrl,i,o,n),s.snapshotHeight=s.thumbHeight,s.snapshotWidth=s.thumbWidth):e===t.MSG_AUDIO?s.url=Mi(s.url,i,o,n):e===t.MSG_FILE&&(s.fileUrl=Mi(s.fileUrl,i,o,n)))}}var Gi=class{constructor(e,s,i,o){if(this.type=t.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},e.downloadKey){const{downloadKey:t,pbDownloadKey:s,title:i,abstractList:o,compatibleText:n,version:r}=e;this.content.downloadKey=t,this.content.pbDownloadKey=s,this.content.title=i,this.content.abstractList=o,this.content.compatibleText=n,this.content.version=r||0}else if(Oe(e.messageList))1===e.layersOverLimit&&(this.content.layersOverLimit=!0);else{const{messageList:t,title:a,abstractList:c,compatibleText:l,version:d}=e,_=[];t.forEach(e=>{Oe(e)||(e=new Ui(e,s,i,o),_.push(e))}),this.content.messageList=_,this.content.title=a,this.content.abstractList=c,this.content.compatibleText=l,this.content.version=d||0}}sendable(){return!Oe(this.content.messageList)||!Oe(this.content.downloadKey)}};const ki={1:t.MSG_PRIORITY_HIGH,2:t.MSG_PRIORITY_NORMAL,3:t.MSG_PRIORITY_LOW,4:t.MSG_PRIORITY_LOWEST};class wi{constructor(e){this.ID="",this.conversationID=e.conversationID||null,this.conversationType=e.conversationType||t.CONV_C2C,this.conversationSubType=e.conversationSubType,this.time=e.time||Math.ceil(Date.now()/1e3),this.sequence=e.sequence||0,this.clientSequence=e.clientSequence||e.sequence||0,this.random=e.random||0===e.random?e.random:je(),this.priority=this._computePriority(e.priority),this.nick=e.nick||"",this.avatar=e.avatar||"",this.isPeerRead=!1,this.nameCard="",this.hasRiskContent=Dt(e.checkResult),this._elements=[],this.isPlaceMessage=e.isPlaceMessage||0,this.isRevoked=2===e.isPlaceMessage||8===e.msgFlagBits,this.from=e.from||null,this.to=e.to||null,this.flow="",this.isSystemMessage=e.isSystemMessage||!1,this.protocol=e.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=e.status||Ot,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=e.cloudCustomData||"",this.isDeleted=!1,this.isModified=!!e.messageVersion,this._isExcludedFromUnreadCount=!(!e.messageControlInfo||1!==e.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!e.messageControlInfo||1!==e.messageControlInfo.excludedFromLastMessage),this.clientTime=e.clientTime||me()||0,this.senderTinyID=e.senderTinyID||e.tinyID||"",this.readReceiptInfo=e.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0,timestamp:0},this.needReadReceipt=!0===e.needReadReceipt||1===e.needReadReceipt,this.version=e.messageVersion||0,this.isBroadcastMessage=e.isBroadcastMessage||!1,this._receiverList=e.receiverList||void 0,this.isSupportExtension=!0===e.isSupportExtension||1===e.isSupportExtension,this._cmConfigID=e.customModerationConfigurationID,this.revoker=e.revokerInfo&&e.revokerInfo.revoker||"",this.revokerInfo=e.revokerInfo||{userID:"",nick:"",avatar:""},this.revokeReason=e.revokeReason||"",this.reInitialize(e.currentUser),this.extractGroupInfo(e.groupProfile||null),this.handleGroupAtInfo(e),this.initC2CReadReceiptInfo(e)}get elements(){return this._elements}getElements(){return this._elements}extractGroupInfo(e){null!==e&&(ke(e.nick)&&(this.nick=e.nick),ke(e.avatar)&&(this.avatar=e.avatar),e=e.messageFromAccountExtraInformation,Fe(e))&&ke(e.nameCard)&&(this.nameCard=e.nameCard)}handleGroupAtInfo(e){e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach(e=>{e!==t.MSG_AT_ALL?(this._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),this.atUserList.push(e)):(this._groupAtInfoList.push({groupAtAllFlag:1}),this.atUserList.push(t.MSG_AT_ALL))}),be(e.groupAtInfo)&&e.groupAtInfo.forEach(e=>{0===e.groupAtAllFlag?this.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&this.atUserList.push(t.MSG_AT_ALL)})}getGroupAtInfoList(){return this._groupAtInfoList}_initProxy(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}reInitialize(e){e&&(this.status=this.from?Ot:At,!this.from)&&(this.from=e),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}isSendable(){return 0!==this._elements.length&&(!0===this._relayFlag||"function"==typeof this._elements[0].sendable&&this._elements[0].sendable())}_initTo(e){this.conversationType===t.CONV_GROUP&&(this.to=e.groupID)}_initSequence(e){0===this.clientSequence&&e&&(this.clientSequence=function(i){if(!i)return!1;if(void 0===Qe[i]){var o=new Date;let e=("3"+o.getHours()).slice(-2),t=("0"+o.getMinutes()).slice(-2),s=("0"+o.getSeconds()).slice(-2);Qe[i]=parseInt([e,t,s,"0001"].join("")),e=null,t=null,s=null,Ce.l("autoIncrementIndex start index:"+Qe[i])}return Qe[i]++}(e)),0===this.sequence&&this.conversationType===t.CONV_C2C&&(this.sequence=this.clientSequence)}generateMessageID(){this.from===t.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID=`${this.senderTinyID}-${this.clientTime}-`+this.random}_initFlow(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}_concatConversationID(e){var s=this["to"],i=this.conversationType;i!==t.CONV_SYSTEM?(e=i===t.CONV_C2C?e===this.from?s:this.from:this.to,this.conversationID=e?""+i+e:null):this.conversationID=t.CONV_SYSTEM}isElement(e){return e instanceof fi||e instanceof yi||e instanceof vi||e instanceof Si||e instanceof Ai||e instanceof Ni||e instanceof Di||e instanceof Li||e instanceof Oi||e instanceof Pi||e instanceof Gi}setElement(s,i,o,n){if(this.isElement(s))this._elements=[s];else{var r=e=>{if(e.type&&e.content)switch(e.type){case t.MSG_TEXT:this.setTextElement(e.content);break;case t.MSG_IMAGE:this.setImageElement(e.content,i,o,n);break;case t.MSG_AUDIO:this.setAudioElement(e.content,i,o,n);break;case t.MSG_FILE:this.setFileElement(e.content,i,o,n);break;case t.MSG_VIDEO:this.setVideoElement(e.content,i,o,n);break;case t.MSG_CUSTOM:this.setCustomElement(e.content);break;case t.MSG_LOCATION:this.setLocationElement(e.content);break;case t.MSG_GRP_TIP:this.setGroupTipElement(e.content);break;case t.MSG_GRP_SYS_NOTICE:this.setGroupSystemNoticeElement(e.content);break;case t.MSG_FACE:this.setFaceElement(e.content);break;case t.MSG_MERGER:this.setMergerElement(e.content,i,o,n)}};if(be(s))for(let e=0;e{e.reason=t})}var{nick:i,avatar:o}=s,i=(ke(i)&&(this.nick=i),ke(o)&&(this.avatar=o),new Di(e));this._elements.push(i)}setGroupSystemNoticeElement(e){e=new Li(e);this._elements.push(e)}setFaceElement(e){e=new vi(e);this._elements.push(e)}setMergerElement(e,t,s,i){e=new Gi(e,t,s,i);this._elements.push(e)}setIsRead(e){this.isRead=e}setRelayFlag(e){this._relayFlag=e}_computePriority(e){if(!$e(e)){if(ke(e)&&-1!==Object.values(ki).indexOf(e))return e;if(Ge(e)){const t=""+e;if(-1!==Object.keys(ki).indexOf(t))return ki[t]}}return t.MSG_PRIORITY_NORMAL}setNickAndAvatar(e){var{nick:e,avatar:t}=e;ke(e)&&(this.nick=e),ke(t)&&(this.avatar=t)}setNameCard(e){ke(e)&&(this.nameCard=e)}initC2CReadReceiptInfo(e){var{readReceiptSentByPeer:e,timestamp:s=0}=e;this.conversationType===t.CONV_C2C&&!0===this.needReadReceipt&&(this.readReceiptInfo.isPeerRead=1===e,this.readReceiptInfo.timestamp=s)}}function Fi(e){var t=e.lastIndexOf(".");return-1===t?e:e.slice(0,t)}function bi(e){var{androidInfo:e={},androidOPPOChannelID:t=""}=e,t=e.OPPOChannelID||t;return{...e,Sound:Fi(e.sound||""),OPPOChannelID:t,GoogleChannelID:e.FCMChannelID||""}}function $i(e){var{apnsInfo:e={},ignoreIOSBadge:t=!1,disableVoipPush:s}=e,t=!0===e.ignoreIOSBadge||!0===t?1:0;let i=void 0;return $e(s)||(i=!1===s?1:0),$e(e.disableVoipPush)||(i=!1===e.disableVoipPush?1:0),{...e,badgeMode:t,isVoipPush:i}}function qi(e){if(Fe(e))return{pushFlag:!0===e.disablePush?1:0,title:e.title||"",desc:e.description||"",ext:e.extension||"",apnsInfo:$i(e),androidInfo:bi(e)}}class xi extends ei{constructor(e){super(e),this._n="C2CModule",this._msgFromUnreadDBMap=new Map,this._noticeFromUnreadDBList=[]}onNewMessage(t){var{dataList:t,isInstantMessage:s,C2CRemainingUnreadList:i,C2CPairUnreadList:o,isSyncingEnded:n}=t,{conversationOptionsList:t,messageList:i,isUnreadC2CMessage:o}=(s||Ce.l(this._n+".onNewMessage C2CPairUnreadList:",o,"C2CRemainingUnreadList:",i),this._assembly({dataList:t,C2CRemainingUnreadList:i,C2CPairUnreadList:o,isInstantMessage:s})),r=Oe(r=i)?[]:r.filter(e=>!0===e.isModified),t=(0!1===e.isModified));s&&0e===""+t.CONV_C2C+r[s].from);o?o.unreadCount=r[s].unreadCount:l.push({conversationID:""+t.CONV_C2C+r[s].from,unreadCount:r[s].unreadCount,type:t.CONV_C2C})}if(be(n))for(let s=0,e=n.length;se===""+t.CONV_C2C+n[s].from)||l.push({conversationID:""+t.CONV_C2C+n[s].from,type:t.CONV_C2C,lastMsgTime:n[s].lastMsgTime});return{conversationOptionsList:l,messageList:d,isUnreadC2CMessage:i}}getMessageListFromUnreadDB(){return[...this._msgFromUnreadDBMap.values()]}_isC2CNotice(e){e=e.eventArray;return!(!be(e)||10!==e[0].event)}_handleNoticeFromUnreadDB(){var e=this._noticeFromUnreadDBList.length;if(0!==e){Ce.l(this._n+"._handleNoticeFromUnreadDB count:"+e);const t=[];this._noticeFromUnreadDBList.forEach(e=>{e.hasOwnProperty("c2cMessageRevokedNotify")&&t.push(e)}),this.onMsgRevoked({dataList:t}),this._noticeFromUnreadDBList.length=0,t.length=0}}onMsgRevoked(s){const r=this.get(ys),a=[];let c;s.dataList.forEach(e=>{e.c2cMessageRevokedNotify&&(e=e.c2cMessageRevokedNotify["revokedInfos"],$e(e)||e.forEach(e=>{var s=this.getMyUserID()===e.from?""+t.CONV_C2C+e.to:""+t.CONV_C2C+e.from,i=(c=r.revoke(s,e.sequence,e.random),e.revokerInfo&&e.revokerInfo.revoker),o=e.revokerInfo&&e.revokerInfo.reason||"";let n;c?n=c:(n={conversationID:s,sequence:e.sequence},e.tinyID&&e.clientTime&&e.random&&(n.ID=`${e.tinyID}-${e.clientTime}-`+e.random),e.time&&(n.time=e.time)),n&&(n.revoker=i,n.revokeReason=o,n.revokerInfo={userID:i,nick:"",avatar:""},a.push(n))}))}),0!==a.length&&(r.onMessageRevoked(a),Ce.l(this._n+".onMsgRevoked count:"+a.length),r.updateRevokerInfo(a).then(t=>{this.emitOEvt(e.MESSAGE_REVOKED,t)}))}onMsgReadReceipt(e){e.dataList.forEach(e=>{if(!Oe(e.c2cMessageReadReceipt)){const o=e.c2cMessageReadReceipt["to"];e.c2cMessageReadReceipt.uinPairReadArray.forEach(e=>{var e=e["peerReadTime"],s=(Ce.l(`${this._n}.onMsgReadReceipt to:${o} peerReadTime:`+e),""+t.CONV_C2C+o),i=this.get(ys);i.recordPeerReadTime(s,e),i.updateMsgIsPeerReadProp(s,e)})}})}onMsgReadNotice(e){e.dataList.forEach(e=>{if(!Oe(e.c2cMessageReadNotice)){const i=this.get(ys);e.c2cMessageReadNotice.uinPairReadArray.forEach(e=>{var{from:e,peerReadTime:s}=e,e=(Ce.l(this._n+`.onMsgReadNotice from:${e} lastReadTime:`+s),""+t.CONV_C2C+e);i.updateIsReadAfterReadReport({conversationID:e,lastMessageTime:s}),i.updateUnreadCount(e)})}})}onMsgModified(e){Ce.l(this._n+".onMsgModified options:",e);const s=this.get(ys);e.dataList.forEach(e=>{s.onMessageModified({...e,conversationType:t.CONV_C2C})})}onReadReceiptList(e){Ce.l(this._n+".onReadReceiptList options:",e),this.get(ys).updateReadReceiptInfo(e.dataList)}sendMessage(e,t){e=this._createC2CMessagePack(e,t);return this.req(e)}_createC2CMessagePack(e,t){let s=null,i=(t&&(t.offlinePushInfo&&(s=t.offlinePushInfo),!0===t.onlineUserOnly)&&(s?s.disablePush=!0:s={disablePush:!0}),"");ke(e.cloudCustomData)&&0{o.end(),Ce.l(i+" ok");var e=this.get(ys);return e.updateIsReadAfterReadReport({conversationID:t,lastMessageTime:s}),e.updateUnreadCount(t),Ys()}).catch(e=>(o.setError(e).end(),Ce.l(i+" failed. error:",e),Qs(e)))}getRoamingMessage(e){const c=this._n+".getRoamingMessage",{peerAccount:s,conversationID:l,count:i,lastMessageTime:o,messageKey:n}=e,d=`peerAccount:${s} count:${i||15} lastMessageTime:${o||0} messageKey:`+n,_=(Ce.l(c+" "+d),new mi("getRoamingMessage"));return this.req({P:ti.GET_C2C_ROAMING_MSG,data:{peerAccount:s,count:i||15,lastMessageTime:o||0,messageKey:n}}).then(e=>{var{complete:e,messageList:s,messageKey:i,lastMessageTime:o}=e.data;$e(s)?Ce.l(c+` ok. complete:${e} but messageList is undefined!`):Ce.l(c+` ok. complete:${e} count:`+s.length),_.setMessage(d+` complete:${e} length:`+s.length).end();const n=this.get(ys),r=1===e;r&&n.setCompleted(l);e=[],s=n.onRoamingMessage(s,l,!0,e),n.modifyMessageList(l),n.updateIsRead(l),n.updateRoamingMsgKeyAndTime(l,i,o),i=n.getPeerReadTime(l);if(Ce.l(c+` update isPeerRead property. convID:${l} peerReadTime:`+i),i)n.updateMsgIsPeerReadProp(l,i);else{const e=l.replace(t.CONV_C2C,"");this.getRemotePeerReadTime([e]).then(()=>{n.updateMsgIsPeerReadProp(l,n.getPeerReadTime(l))})}let a="";if(0(_.setMessage(d).setError(e).end(),Ce.w(c+" failed. error:",e),Qs(e)))}getRoamingMessagesHopping(e){const a=this._n+".getRoamingMessagesHopping",{peerAccount:s,time:i=0,count:o,direction:c}=e,l=""+t.CONV_C2C+s,d=`peerAccount:${s} count:${o} time:${i} direction:`+c,_=(Ce.l(a+" "+d),new mi("getRoamingMessagesHopping"));return this.req({P:ti.GET_C2C_ROAMING_MSG,data:{peerAccount:s,count:o+1,lastMessageTime:i,direction:c}}).then(e=>{var{complete:e,messageList:s=[],lastMessageTime:i}=e.data,o=`complete:${e} count:`+s.length;Ce.l(a+" ok. "+o),_.setMessage(d+" "+o).end(),1!==e&&(1===c?s.pop():s.shift());const n=this.get(ys),r=n.onRoamingMessage(s,l,!1);this._modifyMessageList(l,r);o=this._computeResult({complete:e,lastMessageTime:i,resultList:r}),n.storeHoppingMessageList(o.messageList),s=n.getPeerReadTime(l);if(Ce.l(a+` update isPeerRead property. convID:${l} peerReadTime:`+s),s)n.updateMsgIsPeerReadProp(l,s);else{const e=l.replace(t.CONV_C2C,"");this.getRemotePeerReadTime([e]).then(()=>{n.updateMsgIsPeerReadProp(l,n.getPeerReadTime(l))})}return Ys(o)}).catch(e=>(_.setMessage(d).setError(e).end(),Ce.w(a+" failed. error:",e),Qs(e)))}_computeResult(e){var{complete:e=0,lastMessageTime:t,resultList:s=[]}=e,s={messageList:[...s],isCompleted:!1,nextMessageTime:""};return 1===e?s.isCompleted=!0:s.nextMessageTime=t,s}_modifyMessageList(t,s){t=this.get(ys).getLocalConversation(t);if(t){var i=t.userProfile.nick,o=t.userProfile.avatar,t=this.get(fs).getNickAndAvatarByUserID(this.getMyUserID()),n=t.nick,r=t.avatar;for(let e=s.length-1;0<=e;e--){const t=s[e];"in"===t.flow&&(t.nick!==i&&t.setNickAndAvatar({nick:i}),t.avatar!==o)&&t.setNickAndAvatar({avatar:o}),"out"===t.flow&&(t.nick!==n&&t.setNickAndAvatar({nick:n}),t.avatar!==r)&&t.setNickAndAvatar({avatar:r})}}}getRemotePeerReadTime(n){const r=this._n+".getRemotePeerReadTime";if(Oe(n))return Promise.resolve();const a=new mi("getRemotePeerReadTime");return Ce.l(r+" userIDList:"+n),this.req({P:ti.GET_C2C_PEER_READ_TIME,data:{userIDList:n}}).then(e=>{var s=e.data["peerReadTimeList"];Ce.l(r+" ok. peerReadTimeList:"+s);let i="";var o=this.get(ys);for(let e=0;e{a.setError(e).end(),Ce.w(r+" failed. error:",e)})}sendReadReceipt(e){const s=e[0].conversationID.replace(t.CONV_C2C,""),i=new mi("sendReadReceipt"),o=(i.setMessage("peerAccount:"+s),this.getMyUserID()),n=e.filter(e=>e.from!==o&&!0===e.needReadReceipt).map(e=>{var{from:e,to:t,sequence:s,random:i,time:o,clientTime:n}=e;return{fromAccount:e,toAccount:t,sequence:s,random:i,time:o,clientTime:n}});if(0===n.length)return Qs({code:js.READ_RECEIPT_MSG_LIST_EMPTY});const r=this._n+".sendReadReceipt";return Ce.l(r+`. peerAccount:${s} length:`+n.length),this.req({P:ti.SEND_C2C_READ_RECEIPT,data:{peerAccount:s,messageInfoList:n}}).then(e=>(i.end(),Ce.l(r+" ok"),Ys())).catch(e=>(i.setError(e).end(),Ce.w(r+" failed. error:",e),Qs(e)))}getReadReceiptList(e){var s=e[0].conversationID.replace(t.CONV_C2C,"");return Ce.l(this._n+`.getReadReceiptList peerAccount:${s} msgCount:`+e.length),Zs({messageList:e})}getMessageExtensions(e,t){return Ce.l(this._n+".getMessageExtensions startSequence:"+t),this.req({P:ti.GET_C2C_MSG_EXT,data:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),startSequence:t}})}modifyMsgExts(e,t,s=1){return Ce.l(this._n+".modifyMsgExts operateType:"+s),this.req({P:ti.MODIFY_C2C_MSG_EXT,data:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),extensionList:t,operateType:s}})}getMessageKey(e){var{clientSequence:e,random:t,time:s}=e;return e+`_${t}_`+s}reset(){Ce.l(this._n+".reset"),this._msgFromUnreadDBMap.clear(),this._noticeFromUnreadDBList.length=0}}const Vi={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"};class Bi{constructor(e){this._convM=e,this._map=new Map,this._n="MsgListHandler",this._latestMsgSentByPeerMap=new Map,this._latestMsgSentByMeMap=new Map,this._hoppingMsgMap=new Map,this.TOPIC_MSG_LIMIT=1e3,this._convM.getIEmitInst().on(Vi.CLOUD_CONFIG,this._onCloudConfig,this)}_onCloudConfig(){var e=this._convM.getCloudConfig("topic_msg_limit");$e(e)||(this.TOPIC_MSG_LIMIT=Number(e)),Ce.l(this._n+"._onCloudConfig topicMsgLimit:"+this.TOPIC_MSG_LIMIT)}onCheckTimer(e){if(e%20==0&&0=this.TOPIC_MSG_LIMIT&&this._convM.clearMemMsg(t,!0)}pushIn(e,t=!1){var s=e["conversationID"];let i=!0;this._map.has(s)||this._map.set(s,new Map);var o=this._getUniqueIDOfMsg(e);if(this._map.get(s).has(o)){const e=this._map.get(s).get(o);if(!t||!0===e.isModified)return i=!1}return this._map.get(s).set(o,e),this._setLatestMsgSentByPeer(s,e),this._setLatestMsgSentByMe(s,e),i}unshift(s,i){let o;if(be(s)?0e.sequence),Math.max(...e)):0}getLocalMaxTime(e){return this.hasLocalMsgList(e)?(e=[...this._map.get(e).values()].map(e=>e.time),Math.max(...e)):0}hasLocalMsg(e,t){let s=!1;var i=this.getLocalMsgList(e),o=i.length;for(let e=0;ee.startsWith(""+t.CONV_GROUP+s))}onMsgModified(e,t){if(this._map.has(e)||this._hoppingMsgMap.has(e)){const s=this._n+".onMsgModified",i=this._getUniqueIDOfMsg(t),o=this._getTargetMsg(e,i),n=!!o;if(Ce.l(s+` convID:${e} uniqueID:${i} has:`+n),n){const{messageVersion:e,elements:i,cloudCustomData:n,checkResult:r}=t;return Ce.l(s+` localVersion:${o.version} remoteVersion:`+e),o.version{var e=this._readyQueue;this._readyQueue=[],e&&0{this.profileCustomField.push({key:e.key,value:e.value})})}validate(t){let s=!0,e="";if(Oe(t))return{valid:!1,tips:"empty options"};if(t.profileCustomField){const s=t.profileCustomField.length;var i=null;for(let e=0;e=this.MAX_LENGTH){const e=this.map.entries().next().value[0];this.map.delete(e)}this.map.set(e,1)}has(e){return this.map.has(e)}delete(e){this.has(e)&&this.map.delete(e)}reset(){this.map.clear()}}const Qi=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"];class en{constructor(e){this.groupID="",this.name="",this.avatar="",this.type="",this.introduction="",this.notification="",this.ownerID="",this.createTime="",this.infoSequence="",this.lastInfoTime="",this.selfInfo={messageRemindType:"",joinTime:"",nameCard:"",role:"",userID:"",memberCustomField:void 0,readedSequence:0,excludedUnreadSequenceList:void 0},this.lastMessage={lastTime:"",lastSequence:"",fromAccount:"",messageForShow:""},this.nextMessageSeq="",this.memberNum="",this.memberCount="",this.maxMemberNum="",this.maxMemberCount="",this.joinOption="",this.inviteOption="",this.groupCustomField=[],this.muteAllMembers=!1,this.isSupportTopic=!1,this._lastRevokedTime=0,this._initGroup(e)}set memberNum(e){}set maxMemberNum(e){}get memberNum(){return this.memberCount}get maxMemberNum(){return this.maxMemberCount}_initGroup(e){for(const t in e)Qi.indexOf(t)<0||("selfInfo"!==t?("memberNum"===t&&(this.memberCount=e[t]),"maxMemberNum"===t&&(this.maxMemberCount=e[t]),"isSupportTopic"!==t?this[t]=e[t]:this.isSupportTopic=1===e[t]):this.updateSelfInfo(e[t]))}updateGroup(e){e.appid=void 0,e.grossTopicNextMsgSeq=void 0,e.selfInfo&&(e.selfInfo.grossTopicReadSeq=void 0);e=JSON.parse(JSON.stringify(e));e.lastMsgTime&&(this.lastMessage.lastTime=e.lastMsgTime),$e(e.muteAllMembers)||("On"===e.muteAllMembers?e.muteAllMembers=!0:e.muteAllMembers=!1),e.groupCustomField&&st(this.groupCustomField,e.groupCustomField),$e(e.memberNum)||(this.memberCount=e.memberNum),$e(e.maxMemberNum)||(this.maxMemberCount=e.maxMemberNum),$e(e.isSupportTopic)||(this.isSupportTopic=Ge(e.isSupportTopic)?1===e.isSupportTopic:e.isSupportTopic),We(this,e,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),be(e.members)&&0{e.userID===this.selfInfo.userID&&We(this.selfInfo,e,["sequence"])})}updateSelfInfo({nameCard:e,joinTime:t,role:s,messageRemindType:i,readedSequence:o,excludedUnreadSequenceList:n}){e={nameCard:e,joinTime:t,role:s,messageRemindType:i,readedSequence:o,excludedUnreadSequenceList:n};We(this.selfInfo,{...e},[],["",null,void 0,0,NaN])}setSelfNameCard(e){this.selfInfo.nameCard=e}}const tn=function(e,t,s){return $e(e)?{lastTime:0,lastSequence:0,fromAccount:"",messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}:s&&e.ID||e instanceof wi?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:Tt(e.type,e.payload,t),payload:e.payload||null,type:e.type||null,isRevoked:e.isRevoked||!1,cloudCustomData:e.cloudCustomData||"",onlineOnlyFlag:e._onlineOnlyFlag||!1,nick:e.nick||"",nameCard:e.nameCard||"",version:e.version||0,isPeerRead:e.isPeerRead||!1,revoker:e.revoker||null}:{...e,messageForShow:Tt(e.type,e.payload,t)}};class sn{constructor(e,t,s=!1){this.conversationID=e.conversationID||"",this.unreadCount=e.unreadCount||0,this.type=e.type||"",this.lastMessage=tn(e.lastMessage,t,s),e.lastMsgTime&&(this.lastMessage.lastTime=e.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=e.peerReadTime||0,this.groupAtInfoList=[],this.remark="",this.isPinned=e.isPinned||!1,this.messageRemindType=e.messageRemindType,this.markList=e.markList||[],this.customData=e.customData||"",this.conversationGroupList=e.conversationGroupList||[],this.draftText=e.draftText||"",this._initProfile(e),this.subType=this.groupProfile?this.groupProfile.type:""}get toAccount(){return this.conversationID.startsWith(t.CONV_C2C)?this.conversationID.replace(t.CONV_C2C,""):this.conversationID.startsWith(t.CONV_GROUP)?this.conversationID.replace(t.CONV_GROUP,""):""}_initProfile(s){Object.keys(s).forEach(e=>{switch(e){case"userProfile":this.userProfile=s.userProfile;break;case"groupProfile":this.groupProfile=s.groupProfile}}),$e(this.userProfile)&&this.type===t.CONV_C2C?this.userProfile=new Xi({userID:s.conversationID.replace("C2C","")}):$e(this.groupProfile)&&this.type===t.CONV_GROUP&&(this.groupProfile=new en({groupID:s.conversationID.replace("GROUP","")}))}updateUnreadCount(e){var{nextUnreadCount:e,isFromGetConversations:s,isUnreadC2CMessage:i}=e;$e(e)||(it(this.subType)?this.unreadCount=0:s&&this.type===t.CONV_GROUP||s&&this.type===t.CONV_TOPIC||i&&this.type===t.CONV_C2C?this.unreadCount=e:this.unreadCount=this.unreadCount+e)}updateLastMessage(e){this.lastMessage=tn(e)}updateGroupAtInfoList(s){if(!this._isNeedMergeGroupAtInfo(s)){let[...e]=s.groupAtType;-1!==e.indexOf(t.CONV_AT_ME)&&-1!==e.indexOf(t.CONV_AT_ALL)&&(e=[t.CONV_AT_ALL_AT_ME]);s={from:s.from,groupID:s.groupID,topicID:s.topicID,messageSequence:s.sequence,atTypeArray:e,__random:s.__random,__sequence:s.__sequence};this.groupAtInfoList.push(s)}}_isNeedMergeGroupAtInfo(s){const{groupID:e,sequence:i}=s;if(!nt({groupID:e}))return!1;let o=!1;return this.groupAtInfoList.forEach(e=>{e.messageSequence===i&&(-1{Ce.l(s+" ok. userIDList:"+t);e=e.data.muteFlagList;this._convM.onC2CMsgRemindTypeFetched(e)}).catch(e=>{Ce.e(s+" failed. error:",e)})}set(e){return e.groupID?this._setGroupMsgRemindType(e):be(e.userIDList)?this._setC2CMsgRemindType(e):void 0}_setGroupMsgRemindType(t){const s=this._n+"._setGroupMsgRemindType",{groupID:e,messageRemindType:i}=t,o=`groupID:${e} messageRemindType:`+i,n=new mi("_setGroupMsgRemindType");n.setMessage(o);var r=this._get(Is);return r?r.modifyGroupMemberInfo({groupID:e,messageRemindType:i,userID:this._convM.getMyUserID()}).then(()=>{n.end(),Ce.l(s+" ok. "+o);var e=this.onGroupMsgRemindTypeUpdated(t);return this._convM.onTotalUnreadCountUpdate(),Ys(e)}).catch(e=>(n.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e))):Qs({code:js.NO_MODULE})}onGroupMsgRemindTypeUpdated(t){var{groupID:s,messageRemindType:i}=t;Ce.l(this._n+`.onGroupMsgRemindTypeUpdated groupID:${s} messageRemindType:`+i);const o=this._get(Is).getLocalGroupProfile(s);if(o&&(o.selfInfo.messageRemindType=i),ot(s)){const t=s,o=Ct(t),n=this._get(Ts).getLocalTopic(o,t);return n&&n.updateSelfInfo({messageRemindType:i})&&this._convM.emitOEvt(e.TOPIC_UPDATED,{groupID:o,topic:n}),{topic:n}}return this._convM.patchMsgRemindType({ID:s,isC2CConversation:!1,messageRemindType:i})&&this._emitConvUpdate(),{group:o}}_setC2CMsgRemindType(e){const n=this._n+"._setC2CMsgRemindType",{userIDList:t,messageRemindType:r}=e,a=t.slice(0,30),s=nn[r]||0,c=`userIDList:${a} messageRemindType:`+r,l=new mi("_setC2CMsgRemindType");return l.setMessage(c),this._convM.req({P:ti.SET_C2C_PEER_MUTE_NOTIFICATIONS,data:{userIDList:a,muteFlag:s}}).then(e=>{l.end();const t=e.data["errorList"],s=[],i=[];be(t)&&t.forEach(e=>{s.push(e.userID),i.push({userID:e.userID,code:e.errorCode})});e=a.filter(e=>-1===s.indexOf(e));Ce.l(n+` ok. ${c} successUserIDList:${e} failureUserIDList:`+JSON.stringify(i));let o=0;return e.forEach(e=>{this._convM.patchMsgRemindType({ID:e,isC2CConversation:!0,messageRemindType:r})&&(o+=1)}),1<=o&&this._emitConvUpdate(),a.length=s.length=0,this._convM.onTotalUnreadCountUpdate(),Zs({successUserIDList:e.map(e=>({userID:e})),failureUserIDList:i})}).catch(e=>(l.setError(e).end(),Ce.e(n+" failed. error:",e),Qs(e)))}_get(e){return this._convM.get(e)}_emitConvUpdate(){this._convM.emitConvUpdate(!0,!1)}setAllRcvMsgOpt(e){const s=this._n+".setAllRcvMsgOpt",{messageRemindType:i=t.MSG_REMIND_ACPT_NOT_NOTE,isRepeated:o=!0}=e,{startTime:n=0,endTime:r=0}=this._calcStartAndEndTime(e),a=JSON.stringify(e),c=new mi("setAllRcvMsgOpt");return c.setMessage(a),Ce.l(s+" options:"+a),this._convM.req({P:ti.SET_ALL_RECEIVE_MSG_OPT,data:{messageRemindType:nn[i],startTime:n,endTime:r,isRepeated:o?1:0}}).then(e=>(c.end(),Ce.l(s+" ok."),Ys(e))).catch(e=>(c.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}_calcStartAndEndTime(e){var{startHour:e=0,startMinute:t=0,startSecond:s=0,duration:i=0,isRepeated:o=!0}=e,n=new Date,r=n.getFullYear(),a=n.getMonth(),n=n.getDate(),r=Math.round(new Date(r,a,n,e,t,s).getTime()/1e3);let c=o&&86400<=i?r+86400:r+i;return{startTime:r,endTime:c}}getAllRcvMsgOpt(){const t=this._n+".getAllRcvMsgOpt",s=new mi("getAllRcvMsgOpt");return this._convM.req({P:ti.GET_ALL_RECEIVE_MSG_OPT,data:{toAccount:this._convM.getMyUserID()}}).then(e=>{e=e.data,s.setMessage(JSON.stringify(e)).end(),Ce.l(t+" ok. data:"+JSON.stringify(e)),e=this._handleResult(e);return Ys(e)}).catch(e=>(s.setError(e).end(),Ce.e(t+" failed. error:",e),Qs(e)))}_handleResult(e){var{messageRemindType:e,startTime:s,endTime:i,isRepeated:o}=e;let n=t.MSG_REMIND_ACPT_AND_NOTE;return 1===e&&(n=t.MSG_REMIND_DISCARD),{messageRemindType:n=2===e?t.MSG_REMIND_ACPT_NOT_NOTE:n,startTime:s,endTime:i,isRepeated:1===o}}reset(){Ce.l(this._n+".reset")}}class rn{constructor(e){this._convM=e,this._n="ConvGroupHandler",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=Pt}setConvCustomData(e){const s=this._n+".setConvCustomData",{conversationIDList:i,customData:o}=e,n=(Ce.l(s+" options:",e),new mi("setConvCustomData")),r=(n.setMessage(JSON.stringify(e)),{fromAccount:this._getMyUserID(),itemList:[]}),a=[],c=[];return i.forEach(e=>{var s;return this._hasLocalConv(e)?rt(e)||at(e)?(s={operationType:2,contactItem:void 0,customMark:o},rt(e)?s.contactItem={type:1,toAccount:e.replace(t.CONV_C2C,"")}:at(e)&&(s.contactItem={type:2,groupID:e.replace(t.CONV_GROUP,"")}),void r.itemList.push(s)):(this._onConvIDInvalid(c,e),!0):(this._onConvNotFound(c,e),!0)}),c.length===i.length?Zs({successConversationIDList:a,failureConversationIDList:c}):this._convM.req({P:ti.SET_CONV_CUSTOM_DATA,data:r}).then(e=>{n.end(),Ce.l(s+" ok");e=e.data.resultItem;if(be(e)){let t,s,i=!1;e.forEach(e=>{t=this._concatConvID(e.contactItem),0===e.resultCode?(a.push(t),(s=this._getLocalConv(t))&&s.customData!==o&&(s.customData=o,i=!0)):c.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===i&&this._emitConvUpdate()}return Ys({successConversationIDList:a,failureConversationIDList:c})}).catch(e=>(n.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}markConv(e){if(!this._convM.canIUse(M.CONV_MARK))return this._convM.noUse("markConv");const s=this._n+".markConv",{conversationIDList:i,markType:o,enableMark:n}=e,r=(Ce.l(s+" options:",e),new mi("markConv"));r.setMessage(JSON.stringify(e));let a=void 0,c=void 0;e=this._getFlagBit(o);!0===n?c=[e]:a=[e];const l={fromAccount:this._getMyUserID(),itemList:[]},d=[],_=[];return i.forEach(e=>{var s;return this._hasLocalConv(e)?rt(e)||at(e)?(s={operationType:1,contactItem:void 0,clearMark:a,setMark:c},rt(e)?s.contactItem={type:1,toAccount:e.replace(t.CONV_C2C,"")}:at(e)&&(s.contactItem={type:2,groupID:e.replace(t.CONV_GROUP,"")}),void l.itemList.push(s)):(this._onConvIDInvalid(_,e),!0):(this._onConvNotFound(_,e),!0)}),_.length===i.length?Zs({successConversationIDList:d,failureConversationIDList:_}):this._convM.req({P:ti.MARK_CONV,data:l}).then(e=>{r.end(),Ce.l(s+" ok");e=e.data.resultItem;if(be(e)){let t,s,i=!1;e.forEach(e=>{if(t=this._concatConvID(e.contactItem),0===e.resultCode){if(d.push(t),s=this._getLocalConv(t)){const t=s.markList.indexOf(o);!0===n?-1===t&&(s.markList.push(o),i=!0):-1!==t&&(s.markList.splice(t,1),i=!0)}}else _.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===i&&this._emitConvUpdate()}return Ys({successConversationIDList:d,failureConversationIDList:_})}).catch(e=>(r.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}getLocalConvGroupList(){return Ce.l(this._n+".getLocalConvGroupList pagingStatus:"+this._pagingStatus),this._pagingStatus===kt?this.getRemoteConvGroupList().then(()=>Ys([...this._convGroupMap.values()])):Zs([...this._convGroupMap.values()])}searchConvGroupAndMark(e,t){const s=this._n+".searchConvGroupAndMark",i=[];return e.forEach(e=>{1===t?i.push({type:1,toAccount:e}):2===t&&i.push({type:2,groupID:e})}),Ce.l(s+` type:${t} list:`,e),this._convM.req({P:ti.SEARCH_CONV_GRP_MARK,data:{fromAccount:this._getMyUserID(),contactItem:i}}).then(e=>{var{contactItem:e,groupItem:t}=e.data;Ce.l(s+" ok. contactItem:",e,"groupItem:",t),this._fillConvGroupMap(t),this._handleContactItem(e),this._emitConvUpdate()}).catch(e=>{Ce.w(s+" failed. error:",e)})}_fillConvGroupMap(e){be(e)&&e.forEach(e=>{var{convGroupID:e,groupName:t}=e;this._convGroupMap.set(e,t)})}_handleContactItem(e){if(be(e)){let n,r;e.forEach(e=>{const t=[],{standardMark:s,customData:i,convGroupIDList:o}=e;be(o)&&o.forEach(e=>{this._convGroupMap.has(e)&&t.push(this._convGroupMap.get(e))}),r=this._concatConvID(e),(n=this._getLocalConv(r))&&(n.markList=yt(s),n.customData=i||"",n.conversationGroupList=[...t])})}}getRemoteConvGroupList(){const o=this._n+".getRemoteConvGroupList";return this._pagingStatus=Ut,this._convM.req({P:ti.GET_CONV_GRP_LIST,data:{fromAccount:this._getMyUserID(),startIndex:this._startIndex}}).then(e=>{var{completeFlag:e,contactItem:t,nextStartIndex:s=0,groupItem:i}=e.data;if(this._startIndex=s,Ce.l(o+` completeFlag:${e} nextStartIndex:${s}, groupItem:`,i,"contactItem:",t),this._fillConvGroupMap(i),this._handleContactItem(t),0===e)return this.getRemoteConvGroupList();1===e&&(this._pagingStatus=Gt,this._emitConvUpdate(),this._emitConvGroupListUpdate())}).catch(e=>{this._pagingStatus=kt,Ce.w(o+" failed. error:",e)})}createConvGroup(e){if(!this._convM.canIUse(M.CONV_GROUP))return this._convM.noUse("createConvGroup");const s=this._n+".createConvGroup",i=(Ce.l(s+" options:",e),new mi("createConvGroup")),{groupName:n,conversationIDList:o}=(i.setMessage(JSON.stringify(e)),e),r={fromAccount:this._getMyUserID(),itemList:[{groupName:n,contactItem:[]}]},a=[],c=[];return o.forEach(e=>this._hasLocalConv(e)?rt(e)||at(e)?void(rt(e)?r.itemList[0].contactItem.push({type:1,toAccount:e.replace(t.CONV_C2C,"")}):at(e)&&r.itemList[0].contactItem.push({type:2,groupID:e.replace(t.CONV_GROUP,"")})):(this._onConvIDInvalid(c,e),!0):(this._onConvNotFound(c,e),!0)),c.length===o.length?Zs({successConversationIDList:a,failureConversationIDList:c}):this._convM.req({P:ti.CREATE_CONV_GRP,data:r}).then(e=>{i.end(),Ce.l(s+" ok");var e=e.data["groupResultItem"],{groupItem:e,resultItem:o}=e[0];if(Fe(e)&&(this._convGroupMap.set(e.convGroupID,e.groupName),this._emitConvGroupListUpdate()),be(o)){let t,s,i=!1;o.forEach(e=>{t=this._concatConvID(e.contactItem),0===e.resultCode?(a.push(t),(s=this._getLocalConv(t))&&-1===s.conversationGroupList.indexOf(n)&&(s.conversationGroupList.push(n),i=!0)):c.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===i&&(this._emitConvUpdate(),this._emitConvGroupListUpdate())}return Ys({successConversationIDList:a,failureConversationIDList:c})}).catch(e=>(i.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}deleteConvGroup(t){if(!this._convM.canIUse(M.CONV_GROUP))return this._convM.noUse("deleteConvGroup");const s=this._n+".deleteConvGroup",i=(Ce.l(s+" groupName:"+t),new mi("deleteConvGroup"));return i.setMessage(t),this._convM.req({P:ti.DEL_CONV_GRP,data:{fromAccount:this._getMyUserID(),groupName:[t]}}).then(e=>{i.end(),Ce.l(s+" ok");e=e.data.groupItem;if(be(e)){let t=!1;e.forEach(e=>{this._convGroupMap.has(e.convGroupID)&&(this._convGroupMap.delete(e.convGroupID),t=!0)}),!0===t&&this._emitConvGroupListUpdate()}this._eraseFromConversationGroupList([t])}).catch(e=>(i.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}renameConvGroup(e){if(!this._convM.canIUse(M.CONV_GROUP))return this._convM.noUse("renameConvGroup");const o=this._n+".renameConvGroup",n=(Ce.l(o+" options:",e),new mi("renameConvGroup")),{oldName:r,newName:a}=(n.setMessage(JSON.stringify(e)),e);return this._convM.req({P:ti.RENAME_CONV_GRP,data:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:r,newName:a}}}).then(e=>{n.end(),Ce.l(o+" ok");e=e.data.updateGroupResult,e=e.convGroupID,this._convGroupMap.set(e,a),this._emitConvGroupListUpdate(),e=this._convM.getLocalConvList();let t,s,i=!1;e.forEach(e=>{t=e.conversationGroupList,-1!==(s=t.indexOf(r))&&(t.splice(s,1,a),i=!0)}),!0===i&&this._emitConvUpdate()}).catch(e=>(n.setError(e).end(),Ce.e(o+" failed. error:",e),Qs(e)))}addConvsToGroup(e){if(!this._convM.canIUse(M.CONV_GROUP))return this._convM.noUse("addConvsToGroup");const s=this._n+".addConvsToGroup",i=(Ce.l(s+" options:",e),new mi("addConvsToGroup")),{conversationIDList:o,groupName:n}=(i.setMessage(JSON.stringify(e)),e),r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:n,updateItem:[]}},a=[],c=[];return o.forEach(e=>this._hasLocalConv(e)?rt(e)||at(e)?void(rt(e)?r.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:e.replace(t.CONV_C2C,"")}}):at(e)&&r.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:e.replace(t.CONV_GROUP,"")}})):(this._onConvIDInvalid(c,e),!0):(this._onConvNotFound(c,e),!0)),c.length===o.length?Zs({successConversationIDList:a,failureConversationIDList:c}):this._convM.req({P:ti.ADD_CONV_TO_GRP,data:r}).then(e=>{i.end(),Ce.l(s+" ok");e=e.data.updateGroupResult.contactResultItem;if(be(e)){let t,s,i=!1;e.forEach(e=>{t=this._concatConvID(e.contactItem),0===e.resultCode?(s=this._getLocalConv(t))&&-1===s.conversationGroupList.indexOf(n)&&(s.conversationGroupList.push(n),a.push(t),i=!0):c.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===i&&(this._emitConvUpdate(),this._emitConvInGroupUpdate(n))}return Ys({successConversationIDList:a,failureConversationIDList:c})}).catch(e=>(i.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}deleteConvsFromGroup(e){var s="deleteConvsFromGroup";if(!this._convM.canIUse(M.CONV_GROUP))return this._convM.noUse(s);const i=this._n+"."+s,o=(Ce.l(i+" options:",e),new mi(s)),{conversationIDList:n,groupName:r}=(o.setMessage(JSON.stringify(e)),e),a={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:r,updateItem:[]}},c=[],l=[];return n.forEach(e=>this._hasLocalConv(e)?rt(e)||at(e)?void(rt(e)?a.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:e.replace(t.CONV_C2C,"")}}):at(e)&&a.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:e.replace(t.CONV_GROUP,"")}})):(this._onConvIDInvalid(l,e),!0):(this._onConvNotFound(l,e),!0)),l.length===n.length?Zs({successConversationIDList:c,failureConversationIDList:l}):this._convM.req({P:ti.DEL_CONV_FROM_GRP,data:a}).then(e=>{o.end(),Ce.l(i+" ok");e=e.data.updateGroupResult.contactResultItem;if(be(e)){let t,s,i=!1;e.forEach(e=>{if(t=this._concatConvID(e.contactItem),0===e.resultCode){if(s=this._getLocalConv(t)){const e=s.conversationGroupList.indexOf(r);-1!==e&&(s.conversationGroupList.splice(e,1),c.push(t),i=!0)}}else l.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===i&&(this._emitConvUpdate(),this._emitConvInGroupUpdate(r))}return Ys({successConversationIDList:c,failureConversationIDList:l})}).catch(e=>(o.setError(e).end(),Ce.e(i+" failed. error:",e),Qs(e)))}onConvMarkUpdated(e){if(!Oe(e)){let o,n,r=(Ce.l(this._n+".onConvMarkUpdated markItemList:",e),!1);e.forEach(e=>{var{recentContactItem:e,optType:t,standardMark:s,customMark:i}=e;if(o=this._concatConvID(e),n=this._getLocalConv(o))if(1===t)r=this._diffStandardMark(n,s);else if(2===t)r=this._diffCustomMark(n,i);else if(3===t){const e=this._diffStandardMark(n,s),o=this._diffCustomMark(n,i);r=e||o}}),!0===r&&this._emitConvUpdate()}}_diffStandardMark(e,t){t=yt(t);let s=!1;return!0!==function(s,i){if(s!==i){if(!s||!i)return!1;if(s.length!==i.length)return!1;for(let e=0,t=s.length;e{const{groupID:t,groupName:i}=e.msgGroupItem;this._convGroupMap.get(t)!==i&&(this._convGroupMap.set(t,i),s=!0);e=e.msgRecentContactItem;if(be(e)){let t,s;e.forEach(e=>{t=this._concatConvID(e),(s=this._getLocalConv(t))&&-1===s.conversationGroupList.indexOf(i)&&(s.conversationGroupList.push(i),o=!0)})}}),!0===o&&this._emitConvUpdate(),!0===s)&&this._emitConvGroupListUpdate()}onConvGroupDeleted(e){Ce.l(this._n+".onConvGroupDeleted groupItemList:",e);const i=[];if(be(e)){let s=!1;e.forEach(e=>{var{groupID:e,groupName:t}=e;this._convGroupMap.has(e)&&(this._convGroupMap.delete(e),s=!0,i.push(t))}),!0===s&&this._emitConvGroupListUpdate()}this._eraseFromConversationGroupList(i)}_eraseFromConversationGroupList(t){Oe(t)||(this._convM.getLocalConvList().forEach(e=>{e.conversationGroupList=e.conversationGroupList.filter(e=>!t.includes(e))}),this._emitConvUpdate())}onConvGroupNameUpdated(e){Ce.l(this._n+".onConvGroupNameUpdated options:",e);const{groupID:o,groupName:n,oldGroupName:r}=e;if(this._convGroupMap.get(o)!==n){this._convGroupMap.set(o,n),this._emitConvGroupListUpdate();e=this._convM.getLocalConvList();let t,s,i=!1;e.forEach(e=>{t=e.conversationGroupList,-1!==(s=t.indexOf(r))&&(t.splice(s,1,n),i=!0)}),!0===i&&this._emitConvUpdate()}}onConvInGroupUpdated(e){Ce.l(this._n+".onConvInGroupUpdated options:",e);const{oldGroupName:r,recentContactUpdateGroupItem:t}=e;if(be(t)){let s,i,o,n=!1;t.forEach(e=>{var{contactOptType:e,recentContactItem:t}=e;s=this._concatConvID(t),(i=this._getLocalConv(s))&&(o=i.conversationGroupList.indexOf(r),1===e?-1===o&&(i.conversationGroupList.push(r),n=!0):2===e&&-1!==o&&(i.conversationGroupList.splice(o,1),n=!0))}),!0===n&&(this._emitConvUpdate(),this._emitConvInGroupUpdate(r))}}onConvAddedToOrDeletedFromGroup(e){Ce.l(this._n+".onConvAddedToOrDeletedFromGroup options:",e);const{msgRecentContactItem:t,msgRecentContactUpdateContactItem:o}=e,s=this._concatConvID(t),n=this._getLocalConv(s);if(n&&be(o)){let s,i=!1;o.forEach(e=>{var{groupOptType:e,recentContactGroupItem:t}=e,t=t["groupName"];s=n.conversationGroupList.indexOf(t),1===e?-1===s&&(n.conversationGroupList.push(t),i=!0):2===e&&-1!==s&&(n.conversationGroupList.splice(s,1),i=!0),!0===i&&this._emitConvInGroupUpdate(t)}),!0===i&&this._emitConvUpdate()}}onConvGroupListSynced(e){be(e)&&0!==e.length&&(Ce.l(this._n+".onConvGroupListSynced groupItem:",e),this._fillConvGroupMap(e))}getConvGroupListByID(e){if(!Oe(e)){const t=[];return e.forEach(e=>{this._convGroupMap.has(e)&&t.push(this._convGroupMap.get(e))}),t}}_onConvNotFound(e,t){e.push({conversationID:t,code:js.CONV_NOT_FOUND,message:this._convM.getErrMsg(js.CONV_NOT_FOUND)})}_onConvIDInvalid(e,t){e.push({conversationID:t,code:js.INVALID_CONV_ID,message:this._convM.getErrMsg(js.INVALID_CONV_ID)})}_getFlagBit(e){var t=e.toString(2),s=t.length;for(let e=s-1;0<=e;e--)if("1"===t[e])return s-e-1}_concatConvID(e){var{type:e,to:s,groupID:i,userID:o}=e;let n;return 1===e?$e(o)?$e(s)||(n=""+t.CONV_C2C+s):n=""+t.CONV_C2C+o:2===e&&(n=""+t.CONV_GROUP+i),n}_getMyUserID(){return this._convM.getMyUserID()}_getLocalConv(e){return this._convM.getLocalConversation(e)}_hasLocalConv(e){return this._convM.hasLocalConversation(e)}_emitConvUpdate(){this._convM.emitConvUpdate(!0,!1)}_emitConvGroupListUpdate(){this._convM.emitOEvt(e.CONVERSATION_GROUP_LIST_UPDATED,[...this._convGroupMap.values()])}_emitConvInGroupUpdate(t){var s={groupName:t,conversationList:[]},i=this._convM.getLocalConvList();s.conversationList=i.filter(e=>e.conversationGroupList.includes(t)),this._convM.emitOEvt(e.CONVERSATION_IN_GROUP_UPDATED,s)}reset(){Ce.l(this._n+".reset"),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=Pt}}class an extends ei{constructor(e){super(e),this._n="ConvModule",Ki.mixin(this),this._msgListHandler=new Bi(this),this._msgRemindHandler=new on(this),this._convGroupHandler=new rn(this),this._sll=new Zi(100),this._pagingStatus=Pt,this._pagingTs=0,this._pagingStartIdx=0,this._pagingPinnedTs=0,this._pagingPinnedStartIdx=0,this._pagingConvIDMap=new Map,this._convIDFromUnreadDBMap=new Map,this._convMap=new Map,this._tmpGroupList=[],this._tmpGroupAtTipsList=[],this._peerReadTimeMap=new Map,this._completedMap=new Map,this._roamingMsgKeyAndTimeMap=new Map,this._remoteGroupReadSeqMap=new Map,this._convTotalUnreadCount=0,this._pagingGetCostList=[],this._convMapForDiff=new Map,this._partialUpdatedConvMap=new Map,this._everClearedMap=new Map,this._bPullOnInvite=!0,this._initListeners()}_initListeners(){var e=this.getIEmitInst();e.on(Vi.A2KEY_AND_TINYID_UPDATED,this._init,this),e.on(Vi.PROFILE_UPDATED,this._onProfileUpdated,this),e.on(Vi.CLOUD_CONFIG,this._onCloudConfig,this)}_init(){Ce.l(this._n+"._init");var t=this.get(Ss).getItem("conversationMap"),s=this.isIntl(),i=this.isUsingChatCore();if(t){var o=t.length;for(let e=0;e{0[e.conversationID,1])]),this._diffAndDeleteConv(),n&&this.emitIEvt(Vi.C2C_UNREAD_HANDLE_COMPLETED)),0!this._isConvNeedShow(e.conversationID)).length||this.emitConvUpdate()):this.ready(()=>{this._onSendOrRcvMsg(e)})}updateConvGroupProfile(e){if(!be(e)||0!==e.length)if(0===this._convMap.size)this._tmpGroupList=e;else{let i=!1;e.forEach(e=>{var s=""+t.CONV_GROUP+e.groupID;if(this._convMap.has(s)){i=!0;const t=this._convMap.get(s);t.groupProfile=JSON.parse(JSON.stringify(e)),t.lastMessage.lastSequence{(s=this._convMap.get(e.conversationID))&&(o&&s.reduceUnreadCount()&&(i=s.type!==t.CONV_TOPIC),s.type===t.CONV_TOPIC?n.push(e):s.isLastMessageRevoked({sequence:e.sequence,time:e.time})&&(s.setLastMessageRevoked(!0),s.setLastMessageRevoker(e.revoker),i=!0))}),this.get(Ts).onMessageRevoked(n),i&&this.emitConvUpdate(!0,!1)}}updateRevokerInfo(o){var t=new Set;for(let e=0;e{e.getUserProfile({userIDList:s}).then(e=>{e=e.data;if(!be(e)||0===e.length)return i(o);const s={};for(const{userID:o,nick:i,avatar:t}of e)s[o]={nick:i,avatar:t};o.forEach(e=>{var t=e["revoker"];s[t]&&(e.revokerInfo.nick=s[t].nick||"",e.revokerInfo.avatar=s[t].avatar||"")}),i(o)}).catch(()=>{i(o)})})}isLastMessageRevoked(e){let s=!1;var{conversationID:i,sequence:o,time:n}=e,r=this._convMap.get(i);return r&&(s=r.type===t.CONV_TOPIC?this.get(Ts).isLastMessageRevoked({topicID:i.replace(t.CONV_GROUP,""),sequence:o}):r.isLastMessageRevoked({sequence:o,time:n})),Ce.l(this._n+".isLastMessageRevoked options:",e,"ret:"+s),s}onMessageDeleted(o){if(0!==o.length){let s=null;o.forEach(e=>{(s=this._msgListHandler.getLocalMsg(e.conversationID,e.ID))&&(s.isDeleted=!0),e!==s&&(e.isDeleted=!0)});var o=o[0].conversationID,n=this._msgListHandler.getLocalMsgList(o);let i={};for(let e=n.length-1;0<=e;e--)if(!n[e].isDeleted){i=n[e];break}var r=this._convMap.get(o);if(r){let e=!1;r.lastMessage.lastSequence===i.sequence&&r.lastMessage.lastTime===i.time||(Oe(i)&&(i=void 0),r.updateLastMessage(i),r.type!==t.CONV_TOPIC&&(e=!0),Ce.l(this._n+`.onMessageDeleted. update convID:${o} with lastMessage:`,r.lastMessage)),o.startsWith(t.CONV_C2C)&&this.updateUnreadCount(o),e&&this.emitConvUpdate(!0,!1)}}}onMessageModified(s){var i=this._n+".onMessageModified",{conversationType:o,from:n,to:r,time:a,sequence:c,elements:l,cloudCustomData:d,messageVersion:_}=s;let u=""+o+r;r===this.getMyUserID()&&o===t.CONV_C2C&&(u=""+o+n);var{isUpdated:o,message:h}=this._msgListHandler.onMsgModified(u,s),p=(!0===o&&this.emitOEvt(e.MESSAGE_MODIFIED,[h]),this._isTopicConv(u));if(null===h?Ce.l(i+" message is null! options:",s):Ce.l(i+` isUpdated:${o} isTopicMessage:${p} from:${n} to:${r} sequence:${h.sequence} time:`+h.time),p)this.get(Ts).onMessageModified(s);else{const e=this._convMap.get(u);if(e){const t=e.lastMessage;t&&t.lastTime===a&&t.lastSequence===c&&t.version!==_&&(Ce.l(i+` convID:${u} lastMessage updated`),t.type=l[0].type,t.payload=l[0].content,t.messageForShow=Tt(t.type,t.payload,this.isIntl()),t.cloudCustomData=d,t.version=_,this.emitConvUpdate(!0,!1))}}return h}onNewGroupAtTips(e){e=e.dataList;let t=null;e.forEach(e=>{e.groupAtTips?t=e.groupAtTips:e.elements?t={...e.elements,sync:!0}:e.groupAtType&&(t={...e,sync:!0}),t.__random=e.random,t.__sequence=e.clientSequence,this._tmpGroupAtTipsList.push(t)}),Ce.l(this._n+".onNewGroupAtTips isReady:"+this._isReady,this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}_handleGroupAtTipsList(){if(0!==this._tmpGroupAtTipsList.length){let r=!1;this._tmpGroupAtTipsList.forEach(e=>{const{groupID:s,from:i,topicID:o,sync:n=!1}=e;if(i!==this.getMyUserID())if($e(o)){const i=this._convMap.get(""+t.CONV_GROUP+s);i&&(i.updateGroupAtInfoList(e),r=!0)}else{const r=this._convMap.get(""+t.CONV_GROUP+o);if(r){r.updateGroupAtInfoList(e);const t=this.get(Ts),s=r["groupAtInfoList"];t.onAtInfoUpdated({topicID:o,groupAtInfoList:s})}Oe(r)&&n&&(this.updateTopicConversation([{conversationID:""+t.CONV_GROUP+o,type:t.CONV_TOPIC}]),this._convMap.get(""+t.CONV_GROUP+o).updateGroupAtInfoList(e))}}),r&&this.emitConvUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}_checkNewConv(e){let s=[],i=[];e.forEach(e=>{this._convMap.has(e.conversationID)||(e.type===t.CONV_C2C?s.push(e.conversationID.replace(t.CONV_C2C,"")):e.type===t.CONV_GROUP&&i.push(e.conversationID.replace(t.CONV_GROUP,"")))}),0e.type===t.CONV_C2C||e.type===t.CONV_GROUP&&e.lastMessage.type!==t.MSG_GRP_TIP).slice(0,20).map(e=>({conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}));this.get(Ss).setItem("conversationMap",s,e)}emitConvUpdate(t=!0,s=!0){var i=this.getLocalConvList();if(s){const e=this.get(Is);e&&e.updateGroupLastMessage(i)}t&&(this.get(vs).isPartialUpdatedConvs()?(this._diffConvMap(this._convMapForDiff,this._convMap),0this._isConvNeedShow(e.conversationID))}getLocalConversation(e){return this._convMap.get(e)}hasLocalConversation(e){return this._convMap.has(e)}getLocalOldestMessage(e){return this._msgListHandler.getLocalOldestMsg(e)}syncConvList(e=!0){const i=new mi("syncConvList");return this._pagingStatus===Pt&&this._convMap.clear(),this._pagingGetConvList(e).then(e=>{var t=function(e){if(be(e)&&0!==e.length){let t=0;return e.forEach(e=>{t+=e}),(t/e.length).toFixed(0)}}(this._pagingGetCostList),s=function(e){if(be(e)&&0!==e.length){let t=0;return e.forEach(e=>{t+=e}),t.toFixed(0)}}(this._pagingGetCostList),s=(this._pagingGetCostList.length=0,this._pagingStatus=Gt,this._diffAndDeleteConv(),this.emitConvUpdate(!0,!1),this._setStorageConvList(),this._handleC2CPeerReadTime(),this.emitIEvt(Vi.CONV_SYNC_COMPLETED),`count:${this._convMap.size} sum:${s} avg:`+t);return Ce.l(this._n+".syncConvList. "+s),i.setMessage(s).end(),e}).catch(e=>(this._pagingStatus=kt,i.setMessage(this._pagingTs).setError(e).end(),Qs(e)))}_diffAndDeleteConv(){if(this._isSyncCompleted()){let s=[];this._convMap.forEach((e,t)=>{!this._pagingConvIDMap.has(t)&&this._convIDFromUnreadDBMap.has(t)&&(this._convMap.delete(t),s.push(t))}),Ce.l(this._n+"._diffAndDeleteConv list:"+s),s=null}}_pagingGetConvList(e=!0){const a=this._n+"._pagingGetConvList",c=(Ce.l(a+` incrementalPullFlag:${e} ts:${this._pagingTs} startIdx:${this._pagingStartIdx} pinnedTs:${this._pagingPinnedTs} pinnedStartIdx:`+this._pagingPinnedStartIdx),Date.now());return this._pagingStatus=Ut,this.req({P:ti.PAGING_GET_CONV_LIST,data:{fromAccount:this.getMyUserID(),timeStamp:e?this._pagingTs:0,startIndex:e?this._pagingStartIdx:0,pinnedTimeStamp:e?this._pagingPinnedTs:0,pinnedStartIndex:e?this._pagingPinnedStartIdx:0,orderType:1}}).then(e=>{var{completeFlag:e,conversations:t=[],timeStamp:s,startIndex:i,pinnedTimeStamp:o,pinnedStartIndex:n,groupItem:r}=e.data;if(this._pagingGetCostList.push(Et(c,!1)),Ce.l(a+` ok. completeFlag:${e} count:${t.length} cost:`+Et(c)),this._convGroupHandler.onConvGroupListSynced(r),0[e.conversationID,1])]),this._updateLocalConvList({conversationOptionsList:e,isFromGetConversations:!0,updateUnreadCount:!0}),this.isLoggedIn()&&this.emitConvUpdate()}if(!this._isReady){if(!this.isLoggedIn())return Zs();this.triggerReady()}return this._pagingTs=s,this._pagingStartIdx=i,this._pagingPinnedTs=o,this._pagingPinnedStartIdx=n,1!==e?this._pagingGetConvList():(this._handleGroupAtTipsList(),this._convGroupHandler.getRemoteConvGroupList(),Zs())}).catch(e=>{throw!this.isLoggedIn()||this._isReady||(Ce.w(a+" failed. error:",e),this.triggerReady()),e})}_updateLocalConvList(e){var t=e["isFromGetConversations"],s=Date.now(),e=this._getTmpConvListMapping(e)["newConvList"];this._convMap=new Map(this._sortConvList([...this._convMap])),t||this._updateUserOrGroupProfile(e),Ce.l(this._n+"._updateLocalConvList cost:"+Et(s))}_getTmpConvListMapping(i){const{conversationOptionsList:o,isFromGetConversations:n,isInstantMessage:r,isUnreadC2CMessage:a=!1,updateUnreadCount:c}=i,l=[],d=[],_=this.get(Is),u=this.get(Cs),h=this.isIntl(),p=this.isUsingChatCore();for(let e=0,s=o.length;e{(!0===e[1].isPinned?Oe(e[1].lastMessage.lastTime)?s:t:Oe(e[1].lastMessage.lastTime)?o:i).push(e)}),t.sort((e,t)=>t[1].lastMessage.lastTime-e[1].lastMessage.lastTime).concat(s).concat(i.sort((e,t)=>t[1].lastMessage.lastTime-e[1].lastMessage.lastTime)).concat(o)}_sortConvListAndEmitEvent(){this._convMap=new Map(this._sortConvList([...this._convMap])),this.emitConvUpdate(!0,!1)}_updateUserOrGroupProfile(e){if(0!==e.length){const s=[],i=[],o=this.get(fs),n=this.get(Is);e.forEach(e=>{if(e.type===t.CONV_C2C)s.push(e.toAccount);else if(e.type===t.CONV_GROUP){const t=e.toAccount;n.hasLocalGroup(t)?e.groupProfile=n.getLocalGroupProfile(t):i.push(t)}}),Ce.l(`${this._n}._updateUserOrGroupProfile userIDList:${s} groupIDList:`+i),0{be(e)?e.forEach(e=>{this._doUpdateUserProfile(""+t.CONV_C2C+e.userID,e)}):this._doUpdateUserProfile(""+t.CONV_C2C+e.userID,e)}),0{let i=!1;e.forEach(e=>{var s=""+t.CONV_GROUP+e.groupID;if(this._convMap.has(s)){const t=this._convMap.get(s);We(t.groupProfile,e,[],[null,void 0,"",0,NaN]),!t.subType&&e.type&&(t.subType=e.type),i=!0}}),i&&this.emitConvUpdate()})}}_doUpdateUserProfile(e,t){this.hasLocalConversation(e)&&(this.getLocalConversation(e).userProfile=t,this.emitConvUpdate())}_getConvOptions(e){const i=[],s=e.filter(({type:e,userID:t})=>1===e&&!this._isNonExistentAccount(t)||2===e),o=this.getMyUserID(),n=s.map(e=>{var s;return $e(e.lastMsg)&&(e.lastMsg={elements:[]}),1===e.type?(s={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar},i.push(s),{conversationID:""+t.CONV_C2C+e.userID,type:t.CONV_C2C,lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?this._amendLayersOverLimitProp(e.lastMsg.elements[0].content):null,cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:e.lastC2CMsgFromAccount===o&&e.time<=e.c2cPeerReadTime,revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},unreadCount:0,userProfile:new Xi(s),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,customData:e.customMark||"",markList:yt(e.standardMark),conversationGroupList:this._convGroupHandler.getConvGroupListByID(e.contactGroupId),remark:e.friendRemark||"",messageRemindType:this._transMsgRemindType(e.messageRemindType)}):{conversationID:""+t.CONV_GROUP+e.groupID,type:t.CONV_GROUP,lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.msgGroupFromAccount,...this._patchTypeAndPayload(e),cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||"",nameCard:e.senderNameCard||"",revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},groupProfile:new en({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage,type:e.groupType,nextMessageSeq:e.nextMessageSeq}),unreadCount:this._computeGroupUnreadCount(e),peerReadTime:0,isPinned:1===e.isPinned,version:0,customData:e.customMark||"",markList:yt(e.standardMark),conversationGroupList:this._convGroupHandler.getConvGroupListByID(e.contactGroupId),messageRemindType:this._transMsgRemindType(e.messageRemindType)}});return 0{var{type:e,userID:s,groupID:i}=e;return 1===e?""+t.CONV_C2C+s:2===e?""+t.CONV_GROUP+i:void 0}),Ce.l(this._n+".onConvDeleted convIDList:"+e),this.deleteLocalConvList(e))}onConvPinnedStatus(e,r){if(be(e)){let n=!1;e.forEach(e=>{var{type:e,userID:s,groupID:i}=e;let o;1===e?o=this.getLocalConversation(""+t.CONV_C2C+s):2===e&&(o=this.getLocalConversation(""+t.CONV_GROUP+i)),o&&(Ce.l(`${this._n}.onConvPinnedStatus convID:${o.conversationID} localPinned:${o.isPinned} remotePinned:`+r),r?o.isPinned||(o.isPinned=!0,n=!0):o.isPinned&&(o.isPinned=!1,n=!0))}),n&&this._sortConvListAndEmitEvent()}}getMessageList({conversationID:a,nextReqMessageID:e,count:t}){const c=this._n+".getMessageList",s=this.getLocalConversation(a);let i="";if(s&&s.groupProfile&&(i=s.groupProfile.type),it(i))return Ce.l(c+` not available in ${i}. convID:`+a),Zs({messageList:[],nextReqMessageID:"",isCompleted:!0});($e(t)||15{var{nextReqID:e,storedMessageList:t,assembledMessageList:s,isPullingCompleted:i}=e,o=this._completedMap.has(a);let n=t;0e.isRevoked)||[],s=r.messageList.map(e=>e.sequence);return Ce.l(c+` ret.nextReqMessageID:${r.nextReqMessageID} ret.isCompleted:${r.isCompleted} sequenceList:`,s),be(t)&&0!==t.length?this.updateRevokerInfo(t).then(e=>(e.forEach(t=>{const s=t["revokerInfo"];r.messageList=r.messageList.map(e=>(e.ID===t.ID&&s&&(e.revokeReason=s.reason||"",e.revokerInfo={userID:s.revoker||e.revoker,nick:s.nick,avatar:s.avatar}),e))}),Ys(r))):Ys(r)});this.modifyMessageList(a);e=this._getMsgListFromMem({conversationID:a,nextReqMessageID:e,count:t});return Zs(e)}_isEverCleared(e){return this._everClearedMap.has(e)}_getMsgListFromMem({conversationID:e,nextReqMessageID:t,count:s}){var i=this._n+"._getMsgListFromMem",o=this._msgListHandler.getLocalMsgList(e),n=o.length,r=rt(e);let a=0;var c={isCompleted:!1,nextReqMessageID:"",messageList:[]},s=(t?(a=r?o.findIndex(e=>e.ID===t):o.findIndex(e=>e.sequence+""===t))>s?(c.messageList=o.slice(a-s,a),c.nextReqMessageID=r?o[a-s].ID:o[a-s].sequence+""):(c.messageList=o.slice(0,a),c.isCompleted=!0):se.sequence));return Ce.l(i+` convID:${e} ret.nextReqMessageID:${c.nextReqMessageID} ret.isCompleted:${c.isCompleted} sequenceList:`+s),c}getMessageListHopping(e){let{conversationID:s,sequence:i,time:o,count:n,direction:r=0}=e;if(($e(n)||15e.ID===t):at(e)&&(o=-1!==t.indexOf("-")?s.findIndex(e=>e.ID===t):s.findIndex(e=>e.sequence+""===t)),o=-1===o?0:o}_needGetHistory({conversationID:e,remainingCount:t,count:s}){var i=this.getLocalConversation(e);let o="";return i&&i.groupProfile&&(o=i.groupProfile.type),!(ct(e)||it(o)||!this._isEverCleared(e)&&(i=t<=s&&!this._completedMap.has(e),Ce.l(this._n+`._needGetHistory convID:${e} ret:`+i),!i))}_isTopicConv(e){e=e.replace(t.CONV_GROUP,"");return ot(e)}getHistoryMessages(r){var{conversationID:a,count:r,nextReqMessageID:c}=r;if(a!==t.CONV_SYSTEM){let o=15,n=(20{u?--l:++l},M=()=>u?l>=d:l{this.clearMemMsg(e)})}deleteGroupRoamingInfo(e){e=""+t.CONV_GROUP+e;0{e=e.data,e=this._handleAllMsgRead(e);return o.setMessage(`scope:${s.scope} failureGroups:`+JSON.stringify(e)).end(),Zs()}).catch(e=>(o.setError(e).end(),Ce.w(i+" failed. error:",e),Qs({code:e&&e.code?e.code:js.MSG_UNREAD_ALL_FAIL,message:e&&e.message?e.message:void 0})))}setConvCustomData(e){return this._convGroupHandler.setConvCustomData(e)}markConv(e){return this._convGroupHandler.markConv(e)}getConvGroupList(){return this._convGroupHandler.getLocalConvGroupList()}createConvGroup(e){return this._convGroupHandler.createConvGroup(e)}deleteConvGroup(e){return this._convGroupHandler.deleteConvGroup(e)}renameConvGroup(e){return this._convGroupHandler.renameConvGroup(e)}addConvsToGroup(e){return this._convGroupHandler.addConvsToGroup(e)}deleteConvsFromGroup(e){return this._convGroupHandler.deleteConvsFromGroup(e)}onConvMarkUpdated(e){this._convGroupHandler.onConvMarkUpdated(e)}onConvGroupCreated(e){this._convGroupHandler.onConvGroupCreated(e)}onConvGroupDeleted(e){this._convGroupHandler.onConvGroupDeleted(e)}onConvGroupNameUpdated(e){this._convGroupHandler.onConvGroupNameUpdated(e)}onConvInGroupUpdated(e){this._convGroupHandler.onConvInGroupUpdated(e)}onConvAddedToOrDeletedFromGroup(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}_getConvLastMessageSeq(e){var t=this._msgListHandler.getLocalLastMsg(e.conversationID);let s=e.lastMessage.lastSequence;return s=t&&s=t&&this._remoteGroupReadSeqMap.delete(e)}}this.updateUnreadCount(o,!1)&&(i+=1)}return i}isRemoteRead(e){var{conversationID:s,sequence:i}=e,o=s.replace(t.CONV_GROUP,"");let n=!1;if(this._remoteGroupReadSeqMap.has(o)){const e=this._remoteGroupReadSeqMap.get(o);i<=e&&(n=!0,Ce.l(this._n+`.isRemoteRead convID:${s} msgSeq:${i} remoteReadSeq:`+e)),i>=e+10&&this._remoteGroupReadSeqMap.delete(o)}return n}updateIsReadAfterReadReport({conversationID:e,lastMessageSeq:t,lastMessageTime:s}){var i,o=this._msgListHandler.getLocalMsgList(e);if(0!==o.length)for(let e=o.length-1;0<=e;e--)if(i=o[e],!(s&&i.time>s||t&&i.sequence>t)){if("in"===i.flow&&i.isRead)break;i.setIsRead(!0)}}updateUnreadCount(e,s=!0){let i=!1;const o=this.getLocalConversation(e),n=this._msgListHandler.getLocalMsgList(e);if(o){var r=o.unreadCount,a=n.filter(e=>!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted).length;if(r!==a&&(o.unreadCount=a,i=!0,Ce.l(this._n+`.updateUnreadCount from ${r} to ${a}, convID:`+e),!0===s)&&this.emitConvUpdate(!0,!1),i&&o.type===t.CONV_TOPIC){const s=o["unreadCount"],i=this.get(Ts),n=e.replace(t.CONV_GROUP,"");i.onUnreadCountUpdatedFromConv(n,s)}return i}}clearGroupAtInfoList(e,s=!0){var i=this.getLocalConversation(e);if(i&&0{var{tinyID:t,clientTime:s,random:i,readCount:o,unreadCount:n}=t,t=t+`-${s}-`+i,s=this._msgListHandler.getLocalMsg(e,t)||this._msgListHandler.getHoppingMsg(e,t),i={groupID:r,messageID:t,readCount:0,unreadCount:0};s&&(Ge(o)&&(s.readReceiptInfo.readCount=o,i.readCount=o),Ge(n)&&(s.readReceiptInfo.unreadCount=n,i.unreadCount=n),a.push(i))})}}else{const e=""+t.CONV_C2C+o;i.forEach(t=>{var{tinyID:t,clientTime:s,random:i}=t,t=t+`-${s}-`+i,s=this._msgListHandler.getLocalMsg(e,t)||this._msgListHandler.getHoppingMsg(e,t);if(s&&!s.readReceiptInfo.isPeerRead){s.readReceiptInfo.isPeerRead=!0,s.readReceiptInfo.timestamp=n;const e={userID:o,messageID:t,isPeerRead:!0,timestamp:n};a.push(e)}})}0e.isRevoked).length;s=n.length-i.unreadCount-e}else s=n.length-i.unreadCount;for(let e=0;e!e.atTypeArray.includes(t.CONV_AT_ALL))).length)return this.clearGroupAtInfoList(e,!1),Promise.resolve();const a=this.getMyUserID();return this.req({P:ti.DEL_GROUP_AT_TIPS,data:{messageListToDelete:r.map(e=>({from:e.from,to:a,messageSeq:e.__sequence,messageRandom:e.__random,groupID:$e(e.topicID)?e.groupID:e.topicID}))}}).then(()=>(Ce.l(s+" ok. count:"+o.length),this.clearGroupAtInfoList(e,!1),Promise.resolve())).catch(e=>(Ce.e(s+" failed. error:",e),Qs(e)))}appendToMessageList(e){return this._msgListHandler.pushIn(e)}setMessageRandom(e){this._sll.set(e.random)}deleteMessageRandom(e){this._sll.delete(e.random)}pushIntoMessageList(e,t,s){return!(!this._msgListHandler.pushIn(t,s)||this._sll.has(t.random)&&!s||(e.push(t),0))}revoke(e,t,s){return this._msgListHandler.revoke(e,t,s)}getPeerReadTime(e){return this._peerReadTimeMap.get(e)}recordPeerReadTime(e,t){(!this._peerReadTimeMap.has(e)||this._peerReadTimeMap.get(e){i.end();var e=this._getConvList(t);return Ys({conversationList:e,isSyncCompleted:this._isSyncCompleted()})}).catch(e=>(i.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}const i=this._getConvList(t);return Ce.l(s+". returned conversation count:"+i.length),Zs({conversationList:i,isSyncCompleted:this._isSyncCompleted()})}_getConvList(t){if($e(t))return this.getLocalConvList();if(be(t))return 0===t.length?[]:this.getLocalConvList().filter(e=>t.includes(e.conversationID));if(Fe(t)){const{type:s,markType:i,groupName:o,hasUnreadCount:n,hasGroupAtInfo:r}=t;return this.getLocalConvList().filter(e=>this._filterType(e,s)&&this._filterMarkType(e,i)&&this._filterGroupName(e,o)&&this._filterUnreadCount(e,n)&&this._filterGroupAtInfo(e,r))}return[]}_filterType(e,s){return s!==t.CONV_C2C&&s!==t.CONV_GROUP||e.type===s}_filterGroupName(e,t){return!ke(t)||(""===t?0===e.conversationGroupList.length:e.conversationGroupList.includes(t))}_filterMarkType(e,t){return!Ge(t)||(0===t?0===e.markList.length:e.markList.includes(t))}_filterUnreadCount(e,t){let s=!0;return!0===t?s=1<=e.unreadCount:!1===t&&(s=0===e.unreadCount),s}_filterGroupAtInfo(e,t){let s=!0;return!0===t?s=1<=e.groupAtInfoList.length:!1===t&&(s=0===e.groupAtInfoList.length),s}_handleC2CPeerReadTime(){for(var[e,s]of this._convMap)s.type===t.CONV_C2C&&this.recordPeerReadTime(e,s.peerReadTime)}_isPagingGetGroupListCompleted(){var e=this.get(Is);return!e||e.isPagingGetCompleted()}_getLocalGroupCount(){var e=this.get(Is);return e?e.getLocalGroupList().length:0}_hasLocalGroup(e){var s=this.get(Is);return!!s&&s.hasLocalGroup(e.replace(t.CONV_GROUP,""))}getConversationProfile(i){let o,n=!1;if(this._convMap.has(i)?o=this._convMap.get(i):(o=new sn({conversationID:i,type:rt(i)?t.CONV_C2C:t.CONV_GROUP},this.isIntl(),this.isUsingChatCore()),n=!0),o._isInfoCompleted||o.type===t.CONV_SYSTEM)return Zs({conversation:o});if(at(i)){if(!this.get(Is))return Qs({code:js.NO_MODULE});if(!this._hasLocalGroup(i))return Zs({conversation:o})}const r=this._n+".getConversationProfile",a=new mi("getConversationProfile");return Ce.l(r+`. convID:${i} remark:${o.remark} lastMessage:`,o.lastMessage),this._getUserOrGroupProfile(o).then(e=>{a.setMessage(`convID:${i} unreadCount:`+e.data.conversation.unreadCount).end();var s=this.get(Cs);if(s&&o.type===t.CONV_C2C){const n=i.replace(t.CONV_C2C,"");if(s.isMyFriend(n)){const t=s.getFriendRemark(n);o.remark!==t&&(o.remark=t,Ce.l(r+`. convID:${i} patch remark:`+o.remark))}}if(Ce.l(r+` ok. isNewConv:${n} convID:`+i),n){if(o.type===t.CONV_C2C)return this._onNewC2CConv([i.replace(t.CONV_C2C,"")]).then(()=>Zs({conversation:o}));if(o.type===t.CONV_GROUP)return this._onNewGroupConv([i.replace(t.CONV_GROUP,"")]).then(()=>Zs({conversation:o}))}return e}).catch(e=>(a.setError(e).setMessage("convID:"+i).end(),Ce.e(r+" failed. error:",e),Qs(e)))}_getUserOrGroupProfile(s){return s.type===t.CONV_C2C?this.get(fs).getUserProfile({userIDList:[s.toAccount]}).then(e=>{e=e.data;return 0===e.length?Qs({code:js.USER_OR_GRP_NOT_FOUND}):(s.userProfile=e[0],s._isInfoCompleted=!0,this._insertConvAfterTopmost(s),Zs({conversation:s}))}):this.get(Is).getGroupProfile({groupID:s.toAccount}).then(e=>(s.groupProfile=e.data.group,s._isInfoCompleted=!0,this._insertConvAfterTopmost(s),Zs({conversation:s})))}_insertConvAfterTopmost(e){var t,s;e instanceof sn&&!this._convMap.has(e.conversationID)&&(s=(t=[...this._convMap]).findIndex(e=>!1===e[1].isPinned),t.splice(s,0,[e.conversationID,e]),this._convMap=new Map(t),this._setStorageConvList(),this.emitConvUpdate(!0,!1))}_onProfileUpdated(e){e.data.forEach(e=>{var s=e["userID"];s===this.getMyUserID()?this._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar}):(s=this._convMap.get(""+t.CONV_C2C+s))&&(s.userProfile=e)})}_onCloudConfig(e){"0"===this.getCloudConfig("pull_on_invite")&&(this._bPullOnInvite=!1),Ce.l(this._n+"._onCloudConfig bPullOnInvite:"+this._bPullOnInvite)}disableMsgPullOnInvite(){this._bPullOnInvite=!1}_isSyncCompleted(){return this._pagingStatus===Gt}_errorLog(e,t,s,i){var o=new Error("Params validate failed."),n=""+this.getErrMsg("API_REFER")+e;throw Ce.w(`[${e}] | ${t} | ${this.getErrMsg(s,i)}, `+n),Ce.e(`[${e}] Invalid ${t}: type check failed for ${t}.`),o}_isValidConvID(e){return rt(e)||at(e)||ct(e)}deleteConversation(e){const t="deleteConversation";return ke(e)||we(e)||this._errorLog(t,"options","StringOrObjectRequiredLog"),ke(e)?(this._isValidConvID(e)||this._errorLog(t,"options","InvalidConversationID",e),Ce.l(`${this._n}.${t} convID:`+e),this.deleteConvList({conversationIDList:[e],flag:1})):(be(e.conversationIDList)||this._errorLog(t,"conversationIDList","ArrayRequiredLog"),0===e.conversationIDList.length&&this._errorLog(t,"conversationIDList","NonEmptyArrayLog"),e.conversationIDList.forEach(e=>{this._isValidConvID(e)||this._errorLog(t,"conversationIDList","InvalidConversationID",e)}),"clearHistoryMessage"in e&&"boolean"!=typeof e.clearHistoryMessage&&this._errorLog(t,"clearHistoryMessage","BooleanRequiredLog"),100{r.end();e=[...e[0],...e[1]];return 0===e.length?Qs(new zs({code:js.CONV_NOT_FOUND})):(Ce.l(o+" ok"),Zs(1===i?{conversationID:e[0]}:{conversationIDList:e}))}).catch(e=>(r.setError(e).end(),Ce.e(o+" failed. error:",e),Qs(e)))}rmLocalOnlyConvList(e){return e.filter(e=>{var s;return!!this._convMap.has(e)&&((s=this.getLocalConversation(e).type)!==t.CONV_GROUP||this._hasLocalGroup(e)?s===t.CONV_SYSTEM&&(this.get(Is).deleteGroupSystemNotice({messageList:this._msgListHandler.getLocalMsgList(e)}),this.deleteLocalConv(e),!0):(this.deleteLocalConv(e),!0))})}rmLocalAndRemoteConvList(e,s){const i={fromAccount:this.getMyUserID(),conversationList:[],clearHistoryMessage:s?1:0};return e.forEach(e=>{var s;this._convMap.has(e)&&((s=this.getLocalConversation(e).type)===t.CONV_C2C?i.conversationList.push({toAccount:e.replace(s,""),type:1}):s===t.CONV_GROUP&&this._hasLocalGroup(e)&&i.conversationList.push({toGroupID:e.replace(s,""),type:2}))}),0===i.conversationList.length?[]:this.req({P:ti.DEL_CONV,data:i}).then(e=>{const s=[];return 0{0===e.code&&(e=1===e.type?""+t.CONV_C2C+e.to:""+t.CONV_GROUP+e.groupID,s.push(e))}),this.deleteLocalConvList(s),s})}setConvDraft(e){var{conversationID:e,draftText:t}=e,s=this._n+".setConvDraft";return Ce.l(s+` convID:${e} draftText:`+t),this._convMap.has(e)?((s=this._convMap.get(e)).setDraftText(t),this.emitConvUpdate(),Zs({code:0,conversation:s})):Qs({code:js.CONV_NOT_FOUND})}clearHistoryMessage(s){const e={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._convMap.has(s))return Qs({code:js.CONV_NOT_FOUND});var i=this._convMap.get(s).type;if(i===t.CONV_C2C)e.type=1,e.toAccount=s.replace(t.CONV_C2C,"");else{if(i!==t.CONV_GROUP)return i===t.CONV_SYSTEM?(this.get(Is).deleteGroupSystemNotice({messageList:this._msgListHandler.getLocalMsgList(s)}),Zs({conversationID:s})):Qs({code:js.CONV_UN_RECORDED_TYPE});e.type=2,e.toGroupID=s.replace(t.CONV_GROUP,"")}const o=this._n+".clearHistoryMessage",n=new mi("clearHistoryMessage");return n.setMessage("convID:"+s),Ce.l(o+". convID:"+s),this.setMessageRead({conversationID:s}).then(()=>this.req({P:ti.CLEAR_HISTORY_MSG,data:e})).then(()=>{n.end(),Ce.l(o+" ok"),this.clearMemMsg(s);var e=this.getLocalConversation(s);return e&&(e.updateLastMessage(),this._sortConvListAndEmitEvent()),Zs({conversationID:s})}).catch(e=>(n.setError(e).end(),Ce.e(o+" failed. error:",e),Qs(e)))}pinConversation(e){const{conversationID:s,isPinned:i}=e,o=this.getLocalConversation(s);if(o&&o.isPinned===i)return Zs({conversationID:s});if(ct(s))return o&&(o.isPinned=i),this._sortConvListAndEmitEvent(),Zs({conversationID:s});let n=null;if(rt(s)?n={type:1,toAccount:s.replace(t.CONV_C2C,"")}:at(s)&&(n={type:2,groupID:s.replace(t.CONV_GROUP,"")}),null===n)return Qs({code:js.INVALID_CONV_ID});const r=this._n+".pinConversation",a=`convID:${s} isPinned:`+i,c=new mi("pinConversation");return c.setMessage(a),Ce.l(r+". "+a),this.req({P:ti.PIN_CONV,data:{fromAccount:this.getMyUserID(),operationType:!0===i?1:2,itemList:[n]}}).then(()=>(c.end(),Ce.l(r+" ok"),o?o.isPinned!==i&&(o.isPinned=i):this._convMap.set(s,new sn({conversationID:s,type:rt(s)?t.CONV_C2C:t.CONV_GROUP,isPinned:i},this.isIntl(),this.isUsingChatCore())),this._sortConvListAndEmitEvent(),Ys({conversationID:s}))).catch(e=>(c.setError(e).end(),Ce.e(r+" failed. error:",e),Qs(e)))}setMessageRemindType(e){return this._msgRemindHandler.set(e)}patchMsgRemindType(e){var{ID:s,isC2CConversation:i,messageRemindType:o}=e;let n=!1;i=this.getLocalConversation(i?""+t.CONV_C2C+s:""+t.CONV_GROUP+s);return i&&i.messageRemindType!==o&&(i.messageRemindType=o,n=!0),Ce.l(this._n+".patchMsgRemindType options:",e,"ret:"+n),n}onC2CMsgRemindTypeFetched(e){if(be(e)&&0{var{userID:e,muteFlag:t}=e,t=this._transMsgRemindType(t);!0===this.patchMsgRemindType({ID:e,isC2CConversation:!0,messageRemindType:t})&&(s+=1)}),Ce.l(this._n+".onC2CMsgRemindTypeFetched updateCount:"+s),1<=s&&this.emitConvUpdate(!0,!1)}}onC2CMsgRemindTypeSynced(e){const i=this._n+".onC2CMsgRemindTypeSynced";e.dataList.forEach(t=>{if(!Oe(t.muteNotificationsSync)){var{to:t,muteFlag:s}=t.muteNotificationsSync,s=this._transMsgRemindType(s);let e=0;this.patchMsgRemindType({ID:t,isC2CConversation:!0,messageRemindType:s})&&(e+=1),Ce.l(i+" updateCount:"+e),1<=e&&this.emitConvUpdate(!0,!1)}})}onGroupMsgRemindTypeUpdated(e){this._msgRemindHandler.onGroupMsgRemindTypeUpdated(e)}deleteLocalConv(e,t=!0){var s=this._convMap.has(e);if(Ce.l(this._n+`.deleteLocalConv convID:${e} has:`+s),s&&(this._convMap.delete(e),this._convMapForDiff.delete(e),this.clearMemMsg(e),this._setStorageConvList(!0),t)){const t=!this._isTopicConv(e);this.emitConvUpdate(t,!1)}}pullMsgOnInvite(i){var o=this.get(Is);if(o){var n=this._n+".pullMsgOnInvite";if(Ce.l(n+" flag:"+this._bPullOnInvite),this._bPullOnInvite){var r=this.getLocalLastMessage(i),a=this.getLocalSecondLastMessage(i);let e=1,s=1;r&&(e=r.sequence),a&&(s=a.sequence);r=o.getGroupRemoteLastSeq(i.replace(t.CONV_GROUP,""));Ce.l(n+` convID:${i} localLastSeq:${e} localSecondLastSeq:${s} remoteLastSeq:`+r),this.clearMemMsg(i),1{var{messageList:e,isCompleted:t,nextReqMessageID:s}=e.data,i=e.filter(e=>r?e.sequence>c&&e.sequence<=a:e.sequence>c&&e.sequencec&&o.length<60?this._recursiveGetMsgList(o,n,r,a,c,s):this._emitMsgReceived(n,o)})}_emitMsgReceived(t,s){var i,o;0e===s.findIndex(e=>e.sequence===t.sequence)),i=this.hasLocalConversation(t),o=s.map(e=>e.sequence),Ce.l(`${this._n}._emitMsgReceived convID:${t} has:${i} count:${o.length} sequenceList:`,o),this.emitOEvt(e.MESSAGE_RECEIVED,s),i?this.patchConvLastMessage(t,!0):this.getConversationProfile(t).then(()=>{this.patchConvLastMessage(t,!0)}))}deleteLocalConvList(e){let t=!1;e.forEach(e=>{this._convMap.has(e)&&(this.deleteLocalConv(e,!1),t=!0)}),Ce.l(this._n+`.deleteLocalConvList convID:${e} isConvIDExisted:`+t),t&&this.emitConvUpdate(!0,!1)}isMessageSentByCurrentInstance(e){return!(!this._msgListHandler.hasLocalMsg(e.conversationID,e.ID)&&!this._sll.has(e.random))}modifyMessageList(e){var s,i;e.startsWith(t.CONV_C2C)&&this._convMap.has(e)&&(i=this._convMap.get(e),s=Date.now(),this._msgListHandler.modifyMsgSentByPeer({conversationID:e,latestNick:i.userProfile.nick,latestAvatar:i.userProfile.avatar}),i=this.get(fs).getNickAndAvatarByUserID(this.getMyUserID()),this._msgListHandler.modifyMsgSentByMe({conversationID:e,latestNick:i.nick,latestAvatar:i.avatar}),Ce.l(this._n+`.modifyMessageList convID:${e} cost:`+Et(s)))}updateUserProfileSpecifiedKey(e){Ce.l(this._n+".updateUserProfileSpecifiedKey options:",e);var{conversationID:t,nick:s,avatar:i}=e;if(this._convMap.has(t)){const e=this._convMap.get(t).userProfile;ke(s)&&e.nick!==s&&(e.nick=s),ke(i)&&e.avatar!==i&&(e.avatar=i),this.emitConvUpdate(!0,!1)}}_onMyProfileModified(t){var e=this.getLocalConvList(),s=Date.now();e.forEach(e=>{this.modifyMessageSentByMe({conversationID:e.conversationID,...t})}),Ce.l(this._n+"._onMyProfileModified. modify all messages sent by me, cost:"+Et(s))}modifyMessageSentByMe(e){this._msgListHandler.modifyMsgSentByMe(e)}getLatestMessageSentByMe(e){return this._msgListHandler.getLatestMsgSentByMe(e)}modifyMessageSentByPeer(e){this._msgListHandler.modifyMsgSentByPeer(e)}getLatestMessageSentByPeer(e){return this._msgListHandler.getLatestMsgSentByPeer(e)}pushIntoNoticeResult(e,t){return!(!this._msgListHandler.pushIn(t)||this._sll.has(t.random)||(e.push(t),0))}getLocalLastMessage(e){return this._msgListHandler.getLocalLastMsg(e)}getLocalSecondLastMessage(e){return this._msgListHandler.getLocalSecondLastMsg(e)}checkAndPatchRemark(){const o=this.get(Cs);if(0!==this._convMap.size&&o){var e=[...this._convMap.values()].filter(e=>e.type===t.CONV_C2C);if(0!==e.length){let i=0;e.forEach(e=>{var s=e.conversationID.replace(t.CONV_C2C,"");if(o.isMyFriend(s)){const t=o.getFriendRemark(s);e.remark!==t&&(e.remark=t,i+=1)}}),Ce.l(`${this._n}.checkAndPatchRemark. c2cConvCount:${e.length} patchedCount:`+i),0{e.type===t.CONV_SYSTEM||""!==e.messageRemindType&&e.messageRemindType!==t.MSG_REMIND_ACPT_AND_NOTE||(s+=e.unreadCount)}),s}onTotalUnreadCountUpdate(){var t=this.getTotalUnreadCount();this._convTotalUnreadCount!==t&&(Ce.l(`${this._n}.onTotalUnreadCountUpdate from ${this._convTotalUnreadCount} to `+t),this._convTotalUnreadCount=t,this.emitOEvt(e.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}_isConvNeedShow(e){var s,i,e=this.getLocalConversation(e);return!(!$e(e)&&(s=e.type===t.CONV_TOPIC,i=e.type===t.CONV_GROUP&&e.groupProfile.type===t.GRP_ROOM,e=e.type===t.CONV_GROUP&&e.groupProfile.type===t.GRP_LIVE,s||i||e))}setAllRcvMsgOpt(e){return this._msgRemindHandler.setAllRcvMsgOpt(e)}getAllRcvMsgOpt(){return this._msgRemindHandler.getAllRcvMsgOpt()}onAllRcvMsgOptNotify(e){this._msgRemindHandler.onAllRcvMsgOptNotify(e)}clearUnreadCount(e){e=this.getLocalConversation(e);e&&0{this._deleteLocalTopic(s,e)}),this.emitOEvt(e.TOPIC_DELETED,t)}onTopicProfileUpdated(t){var{groupID:s,topicID:i}=t,i=this.getLocalTopic(s,i);i&&(i.updateTopic(t),this.emitOEvt(e.TOPIC_UPDATED,{groupID:s,topic:i}))}onTopicLatestMsg(e){var{topicLatestMessage:s,excludedUnreadSequenceList:i}=e||{};if(!Oe(s)){const{topicID:e}=s["groupProfile"];s.conversationType=t.CONV_GROUP,s.to=e;var o=new wi(s);o.setElement(s.elements),this.updateUnreadCountAndLastMsg(e,o,i)}}onMessageRemindTypeUpdated(t){var{groupID:s,topicID:i,messageRemindType:o}=t,n=this.getLocalTopic(s,i);if(n){const t=n.updateSelfInfo({messageRemindType:o});t&&this.emitOEvt(e.TOPIC_UPDATED,{groupID:s,topic:n}),Ce.l(this._n+`.onMessageRemindTypeUpdated topicID:${i} messageRemindType:${o} isUpdated:`+t)}}onAtInfoUpdated(t){var{topicID:t,groupAtInfoList:s}=t,i=Ct(t),t=this.getLocalTopic(i,t);t&&!$e(s)&&(t.updateGroupAtInfoList(s),this.emitOEvt(e.TOPIC_UPDATED,{groupID:i,topic:t}))}onUnreadCountUpdatedFromConv(t,s=0){var i=Ct(t),t=this.getLocalTopic(i,t);t&&t.unreadCount!==s&&(t.updateUnreadCount(s),0===s&&t.updateSelfInfo({readedSequence:t.lastMessage.lastSequence}),this.emitOEvt(e.TOPIC_UPDATED,{groupID:i,topic:t}))}onMessageSent(t){const{groupID:s,topicID:i,lastMessage:o}=t,n=this.getLocalTopic(s,i);if(n){const{sequence:t=0}=o,i=t+1;i>n.nextMessageSeq&&(n.updateNextMessageSeq(i),n.updateLastMessage(o),n.updateSelfInfo({readedSequence:t}),n.updateUnreadCount(0),this.emitOEvt(e.TOPIC_UPDATED,{groupID:s,topic:n}))}}onMessageModified(t){var s,{to:i,time:o,sequence:n,elements:r,cloudCustomData:a,messageVersion:c}=t,l=Ct(i),d=this.getLocalTopic(l,i);d&&(s=d.lastMessage,Ce.d(this._n+`.onMessageModified topicID:${i} lastMessage:`,JSON.stringify(s),"options:",JSON.stringify(t)),s)&&(null===s.payload||s.lastTime===o&&s.lastSequence===n&&s.version!==c)&&(s.type=r[0].type,s.payload=r[0].content,s.messageForShow=Tt(s.type,s.payload,this.isIntl()),s.cloudCustomData=a,s.version=c,s.lastSequence=n,s.lastTime=o,this.emitOEvt(e.TOPIC_UPDATED,{groupID:l,topic:d}))}onMessageRevoked(t){if(0!==t.length){let s=null,i=null,o=!1;t.forEach(e=>{const t=e.to;if(i=Ct(t),s=this.getLocalTopic(i,t)){s.reduceUnreadCount()&&(o=!0),s.isLastMessageRevoked(e)&&(s.setLastMessageRevoked(!0),s.setLastMessageRevoker(e.revoker),o=!0);const t=s.selfInfo.excludedUnreadSequenceList||[];t.push(e.sequence),s.updateSelfInfo({excludedUnreadSequenceList:t})}}),o&&this.emitOEvt(e.TOPIC_UPDATED,{groupID:i,topic:s})}}isLastMessageRevoked(e){var{topicID:e,sequence:t}=e,s=Ct(e),s=this.getLocalTopic(s,e);let i=!1;return i=s?s.isLastMessageRevoked({sequence:t}):i}updateUnreadCountAndLastMsg(i,o,n){var r=Ct(i),a=this.getLocalTopic(r,i);if(a){let s=a.selfInfo.excludedUnreadSequenceList||[];if($e(n)||(s=n),o._isExcludedFromUnreadCount&&s.push(o.sequence),a.updateSelfInfo({excludedUnreadSequenceList:s}),Ce.l(`${this._n}.updateUnreadCountAndLastMsg seq:${o.sequence} lastSeq:`+a.lastMessage.lastSequence),o.sequence>a.lastMessage.lastSequence){a.updateLastMessage(o);const n=o.sequence+1;a.updateNextMessageSeq(n);o=this._computeUnreadCount(a),i=(a.updateUnreadCount(o),this.get(ys).getLocalConversation(""+t.CONV_GROUP+i));i&&i.updateUnreadCount({nextUnreadCount:o,isFromGetConversations:!0}),this.emitOEvt(e.TOPIC_UPDATED,{groupID:r,topic:a})}}}getJoinedCommunityList(){return this.get(Is).syncCommunityWithTopic()}createTopicInCommunity(t){const s=this._n+".createTopicInCommunity",e=t["topicID"];if(!$e(e)&&!ot(e))return Qs({code:js.ILLEGAL_TOPIC_ID});if(t.topicName&&!1===this._filterProfanity("topicName",t))return Qs({code:js.PROFANITY_FOUND});if(t.introduction&&!1===this._filterProfanity("introduction",t))return Qs({code:js.PROFANITY_FOUND});if(t.notification&&!1===this._filterProfanity("notification",t))return Qs({code:js.PROFANITY_FOUND});const i=new mi("createTopicInCommunity");return this.req({P:ti.CREATE_TOPIC,data:{...t}}).then(e=>{e=e.data.topicID;return i.setMessage("topicID:"+e).end(),Ce.l(s+" ok. topicID:"+e),this._updateTopicMap([{...t,topicID:e}]),Ys({topicID:e})}).catch(e=>(i.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}deleteTopicFromCommunity(e){const s=this._n+".deleteTopicFromCommunity",{groupID:n,topicIDList:t=[]}=e,r=new mi("deleteTopicFromCommunity");return r.setMessage(`groupID:${n} topicIDList:`+t),this.req({P:ti.DEL_TOPIC,data:{groupID:n,topicIDList:t}}).then(e=>{const{resultList:t=[]}=e.data,i=[],o=[];t.forEach(e=>{var{topicID:e,errorCode:t,errorInfo:s}=e;0===t?i.push({topicID:e}):o.push({topicID:e,code:t,message:s})});e=`success count:${i.length}, fail count:`+o.length;return r.setMoreMessage(e).end(),Ce.l(s+" ok. "+e),i.forEach(e=>{this._deleteLocalTopic(n,e.topicID)}),Ys({successTopicList:i,failureTopicList:o})}).catch(e=>(r.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}updateTopicProfile(e){const t=this._n+".updateTopicProfile";if(Ce.l(t+" options:",e),e.topicName&&!1===this._filterProfanity("topicName",e))return Qs({code:js.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Qs({code:js.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Qs({code:js.PROFANITY_FOUND});const s=new mi("updateTopicProfile");return s.setMessage(`groupID:${e.groupID} topicID:`+e.topicID),$e(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.req({P:ti.UPDATE_TOPIC_PROFILE,data:{...e}}).then(()=>(s.end(),Ce.l(t+" ok"),this._updateTopicMap([e]),Ys({topic:this.getLocalTopic(e.groupID,e.topicID)}))).catch(e=>(s.setError(e).end(),Ce.e(t+" failed. error:",e),Qs(e)))}getTopicList(e){const i=this._n+".getTopicList",{groupID:o,topicIDList:t=[]}=e,c=0===t.length,l=new mi("getTopicList");if(l.setMessage("groupID:"+o),this._getTopicTimeMap.has(o)){const{isGetAll:e,time:s}=this._getTopicTimeMap.get(o);if((e||!e&&!c)&&Date.now()-s<1e3*this.TOPIC_CACHE_TIME){const e=this._getLocalTopicList(o,t);if(c||e.length===t.length)return l.setMoreMessage("from cache, topic count:"+e.length).end(),Ce.l(i+` groupID:${o} from cache, topic count:`+e.length),Zs({successTopicList:e,failureTopicList:[]})}}return this.req({P:ti.GET_TOPIC_LIST,data:{groupID:o,topicIDList:t}}).then(e=>{const{topicInfoList:t=[]}=e.data,n=[],r=[],a=[];t.forEach(e=>{var{topic:e,selfInfo:t,errorCode:s,errorInfo:i}=e,o=e["topicID"];0===s?(n.push({...e,selfInfo:t}),r.push(o)):a.push({topicID:o,code:s,message:i})}),this._updateTopicMap(n),this._handleTopicAtInfo(n);e=`success count:${r.length}, fail count:`+a.length;l.setMoreMessage(e).end(),Ce.l(i+` groupID:${o} from remote, `+e);let s=[];return Oe(r)||(this._getTopicTimeMap.set(o,{time:Date.now(),isGetAll:c}),s=this._getLocalTopicList(o,r)),Ys({successTopicList:s,failureTopicList:a})}).catch(e=>(l.setError(e).end(),Ce.e(i+" failed. error:",e),Qs(e)))}hasLocalTopic(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}getLocalTopic(e,t){let s=null;return s=this._topicMap.has(e)?this._topicMap.get(e).get(t):s}_getLocalTopicList(e,t=[]){e=this._topicMap.get(e);let s=[];return e&&(s=[...e.values()]),0===t.length?s:s.filter(e=>t.includes(e.topicID))}_deleteLocalTopic(e,t){this._topicMap.has(e)&&this._topicMap.get(e).has(t)&&(this._topicMap.get(e).delete(t),Ce.l(this._n+`._deleteLocalTopic groupID:${e} topicID:`+t))}_updateTopicMap(e){const n=[];e.forEach(e=>{var{groupID:s,topicID:i}=e;let o=null;this._topicMap.has(s)||this._topicMap.set(s,new Map),this._topicMap.get(s).has(i)?(o=this._topicMap.get(s).get(i)).updateTopic(e):(this._getTopicLastMessage(e),o=new un(e,this.isIntl()),this._topicMap.get(s).set(i,o));e=this._computeUnreadCount(o);o.updateUnreadCount(e),n.push({conversationID:""+t.CONV_GROUP+i,type:t.CONV_TOPIC,unreadCount:e})}),0{this._getTopicTimeMap.set(e,0)}):this._getTopicTimeMap.set(e,0)}getTopicListOnReconnected(){const e=[...this._topicMap.keys()],i=[],o=this.get(ys);e.forEach(e=>{const s=[],t=this._getLocalTopicList(e);o.deleteTopicRoamingInfo(e),t.forEach(e=>{var{lastMessage:{lastTime:t=0}}=e;Date.now()-1e3*t<1e3*this.TOPIC_LAST_ACTIVE_TIME&&s.push(e.topicID)}),0{i.end(),this._relayGetTopicList(t)}).catch(e=>{i.setError(e).end(),this._relayGetTopicList(t)})}}_handleTopicAtInfo(e){0!==e.length&&e.forEach(e=>{const{groupID:t,topicID:s,groupAtInfoList:i}=e,o=[];$e(i)||(i.forEach(e=>{o.push({...e,groupID:t,topicID:s})}),this.get(ys).onNewGroupAtTips({dataList:o}))})}_getTopicLastMessage(e){var t;$e(e.lastMsg)||(t={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,avatar:e.lastMsg.avatar,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:2===e.lastMsg.isPlaceMessage,revoker:Oe(e.lastMsg.revokerInfo)?null:e.lastMsg.revokerInfo.revoker},e.lastMessage=t)}deleteTopicListInCommunity(s){const e=this._getLocalTopicList(s),i=this.get(ys);e.forEach(e=>{e=e.topicID;this._deleteLocalTopic(s,e),this._getTopicTimeMap.delete(s),i.deleteLocalConv(""+t.CONV_GROUP+e)})}_computeUnreadCount(s){const{excludedUnreadSequenceList:e,readedSequence:i}=s.selfInfo;let o=s.nextMessageSeq-s.selfInfo.readedSequence-1;if(be(e)){let t=0;e.forEach(e=>{e>i&&e<=s.nextMessageSeq-1&&(t+=1)}),1<=t&&(o-=t)}return o<0?0:o}_filterProfanity(e,t){var s,i=this.get(bs);return!i||({isAllowedToSend:i,modifiedText:s}=i.filterText(t[e],S),!0===i&&(t[e]=s,!0))}getMessageExtensions(e,t){Ce.l(this._n+".getMessageExtensions startSequence:"+t);var s=Ct(e.to);return this.req({P:ti.GET_GRP_MSG_EXT,data:{groupID:s,topicID:e.to,messageSequence:e.sequence,startSequence:t}})}modifyMsgExts(e,t,s=1){Ce.l(this._n+".modifyMsgExts operateType:"+s);var i=Ct(e.to);return this.req({P:ti.MODIFY_GRP_MSG_EXT,data:{groupID:i,topicID:e.to,messageSequence:e.sequence,extensionList:t,operateType:s}})}reset(){Ce.l(this._n+".reset"),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}class _n{constructor(e){this._userM=e,this._n="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}setExpirationTime(e){this.expirationTime=e}getUserProfile(e){const t=this._n+".getUserProfile",s=e.userIDList,i=(e.fromAccount=this._userM.getMyAccount(),100{a.push({toAccount:e,standardSequence:0,customSequence:0})}),e.userItem=a,new mi("getUserProfile"));return c.setMessage(5{c.end(),Ce.i(t+" ok");e=this._handleResponse(e).concat(o);return Ys(r?e[0]:e)}).catch(e=>(c.setError(e).end(),Ce.e(t+" failed. error:",e),Qs(e)))}getMyProfile(){var e,t=this._userM.getMyAccount(),s=this._n+".getMyProfile";return Ce.l(s+" myAccount:"+t),this._fill(),this._contains(t)?(e=this._getProfileFromMap(t),Ce.d(s+" from cache, myProfile:"+JSON.stringify(e)),Zs(e)):this.getUserProfile({fromAccount:t,userIDList:[t],bFromGetMyProfile:!0})}_handleResponse(s){var i,o=s.data["userProfileItem"];if(!be(o))return[];const n=[],r=Date.now();for(let e=0,t=o.length;e{s.push({tag:e.key,value:e.value})}):s.push({tag:ye[e.toUpperCase()],value:o[e]}));if(0===s.length){const e=new zs({code:js.UPDATE_PROFILE_NO_KEY});return r.setError(e).end(),Ce.e(n+" failed. error:",e),Qs(e)}const a=this._userM.getMyAccount();return this._userM.req({P:ti.UPDATE_MY_PROFILE,data:{fromAccount:a,profileItem:s}}).then(t=>{r.end(),Ce.i(n+" ok");var{isProfileUpdated:s,latestProfile:i}=this._update(a,o);return!0===s&&this._userM.emitOEvt(e.PROFILE_UPDATED,[i]),Zs(i)}).catch(e=>(r.setError(e).end(),Ce.e(n+" failed. error:",e),Qs(e)))}onProfileModified(t){var s=t.dataList;if(!Oe(s)){const n=s.length;Ce.d(`${this._n}.onProfileModified count:${n} dataList:`,t.dataList);var i,o=[];for(let e=0;e{o.push(this.getUserProfile({userIDList:e}))}),Promise.all(o).then(e=>(e.forEach(e=>{e=e.data.map(({userID:e,nick:t,avatar:s})=>({userID:e,nick:t,avatar:s}));s.push(...e)}),s))}_createUserIDListGroup(e){var t=[];let s=0;for(;s{var{blackListItem:t,currentSequence:s}=t.data,i=Oe(t)?0:t.length;n.setMessage("count:"+i).end(),Ce.i(o+" ok"),this.currentSequence=s,this._handleResponse(t,!0),this._userM.emitOEvt(e.BLACKLIST_UPDATED,[...this._blacklistMap.keys()])}).catch(e=>(n.setError(e).end(),Ce.e(o+" failed. error:",e),Qs(e)))}addBlacklist(t){const s=new mi("addToBlacklist"),i=this._n+".addBlacklist",o=this._userM.getMyAccount();if(1!==t.userIDList.length||t.userIDList[0]!==o)return t.userIDList.includes(o)&&(t.userIDList=t.userIDList.filter(e=>e!==o)),t.fromAccount=this._userM.getMyAccount(),t.toAccount=t.userIDList,this._userM.req({P:ti.ADD_TO_BL,data:t}).then(e=>(s.setMessage(5(s.setError(e).end(),Ce.e(i+" failed. error:",e),Qs(e)));{const t=js.CANNOT_ADD_SELF_TO_BLACKLIST,o=this._userM.getErrMsg(t);s.setCode(t).setMessage(o).end();var e=new zs({code:t});return Ce.e(i+" failed. error:",e),Qs(e)}}_handleResponse(n,r){if(!Oe(n)){let s,i,o;for(let e=0,t=n.length;e(i.setMessage(5(i.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}onAccountDeleted(s){for(let e=0,t=s.length;e>(-2*s&6))))t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(t);try{return decodeURIComponent(escape(n))}catch(e){return""}};class mn{constructor(e){this._userM=e,this._n="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userM.getIEmitInst().on(Vi.CLOUD_CONFIG,this._onCloudConfig,this)}_onCloudConfig(){var e=this._userM.getCloudConfig("status_query_count"),t=this._userM.getCloudConfig("status_sub_count"),s=this._userM.getCloudConfig("status_unsub_count");Ce.l(this._n+`._onCloudConfig statusQueryCount:${e} statusSubscribeCount:${t} statusUnsubscribeCount:`+s),$e(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),$e(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),$e(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(s,10))}onUserStatusUpdated(t){const s=t["dataList"],i=this._userM.getMyUserID(),o=this._userM.get(vs),n=s.map(e=>{var{to:e,statusType:t,customStatus:s}=e,s=gn(s);return e===i&&o.setCustomStatus(s),{userID:e,statusType:t,customStatus:s}});Ce.l(this._n+".onUserStatusUpdated list:"+JSON.stringify(n)),this._userM.emitOEvt(e.USER_STATUS_UPDATED,n)}setSelfStatus(e){const t=this._n+".setSelfStatus";if(!1===this._userM.filterProfanity("customStatus",e))return Qs({code:js.PROFANITY_FOUND});const s=new mi("setSelfStatus"),i=e["customStatus"];return this._userM.req({P:ti.SET_SELF_STATUS,data:{customStatus:i}}).then(e=>(s.setMessage("customStatus:"+i).end(),Ce.l(t+" ok. customStatus:"+i),this._userM.get(vs).setCustomStatus(i),Ys({userID:this._userM.getMyUserID(),statusType:1,customStatus:i}))).catch(e=>(s.setError(e).end(),Ce.e(t+" failed. error:",e),Qs(e)))}getUserStatus(e){const i=this._n+".getUserStatus",{userIDList:o=[]}=e,t=this._userM.getMyUserID();let s=[...o],n=void 0;var r=s.indexOf(t);if(-1this.MAX_QUERY_USER_COUNT&&(Ce.w(i+" "+St(this.MAX_QUERY_USER_COUNT)),s=o.slice(0,this.MAX_QUERY_USER_COUNT));const a=new mi("getUserStatus");return this._userM.req({P:ti.GET_USER_STATUS,data:{userIDList:s}}).then(e=>{var{successUserList:e=[],failureUserList:t=[]}=e.data,e=e.map(e=>{var{userID:e,statusType:t,customStatus:s}=e;return{userID:e,statusType:t,customStatus:gn(s)}}),t=t.map(e=>{var{userID:e,invalidUserID:t,errorCode:s,errorInfo:i}=e;return{userID:Oe(t)?e:t,code:s,message:i}}),s=($e(n)||e.unshift(n),`userID count:${o.length}, success count:${e.length}, fail count:`+t.length);return a.setMessage(s).end(),Ce.l(i+` ok. ${s}.`),Ys({successUserList:e,failureUserList:t})}).catch(e=>(a.setMessage("userID count:"+o.length).setError(e).end(),Ce.e(i+" failed. error:",e),Qs(e)))}subscribeUserStatus(e){var t="subscribeUserStatus";if(!this._userM.canIUse(M.USER_STATUS))return this._userM.noUse(t);const s=this._n+"."+t,{userIDList:i=[]}=e;let o=[...i];o.length>this.MAX_SUBSCRIBE_USER_COUNT&&(Ce.w(s+" "+St(this.MAX_SUBSCRIBE_USER_COUNT)),o=i.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));const n=new mi(t),r="userID count:"+i.length;return Ce.l(s+" "+r),this._userM.req({P:ti.SUB_USER_STATUS,data:{userIDList:o}}).then(e=>{var{failureUserList:e=[]}=e.data,e=e.map(e=>{var{userID:e,invalidUserID:t,errorCode:s,errorInfo:i}=e;return{userID:Oe(t)?e:t,code:s,message:i}});return n.setMessage(r+" fail count:"+e.length).end(),Ce.l(s+` ok. fail count:${e.length}.`),Ys({failureUserList:e})}).catch(e=>(n.setMessage(r).setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}unsubscribeUserStatus(e){var t="unsubscribeUserStatus";if(!this._userM.canIUse(M.USER_STATUS))return this._userM.noUse(t);const s=this._n+"."+t,{userIDList:i=[]}=e||{};let o=[...i];i.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(Ce.w(s+" "+St(this.MAX_UNSUBSCRIBE_USER_COUNT)),o=i.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));const n=new mi(t),r="userID count:"+i.length;Ce.l(s+" "+r);e={userIDList:o};return 0===o.length&&(e.userIDList=void 0,e.unsubscribeAll=1),this._userM.req({P:ti.UNSUB_USER_STATUS,data:e}).then(e=>{var{failureUserList:e=[]}=e.data,e=e.map(e=>{var{userID:e,invalidUserID:t,errorCode:s,errorInfo:i}=e;return{userID:Oe(t)?e:t,code:s,message:i}});return n.setMessage(r+" fail count:"+e.length).end(),Ce.l(s+` ok. fail count:${e.length}.`),Ys({failureUserList:e})}).catch(e=>(n.setMessage(r).setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}reset(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}class fn extends ei{constructor(e){super(e),this._n="UserModule",this._profileHandler=new _n(this),this._blacklistHandler=new pn(this),this._userStatusHandler=new mn(this),this.getIEmitInst().on(Vi.A2KEY_AND_TINYID_UPDATED,this.onContextUpdated,this)}onContextUpdated(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}mockOnNickAvatarModified(e,t){Ce.l(this._n+`._mockOnNickAvatarModified nick:${e} avatar:`+t),this.onProfileModified({dataList:[{pushType:1,userID:this.getMyUserID(),profileList:[{tag:ye.NICK,value:e},{tag:ye.AVATAR,value:t}]}]})}onProfileModified(e){this._profileHandler.onProfileModified(e)}onRelationChainModified(e){e=e.dataList;if(!Oe(e)){const t=[],s=(e.forEach(e=>{e.blackListDelAccount&&t.push(...e.blackListDelAccount)}),0{e.blackListAddAccount&&s.push(...e.blackListAddAccount)}),0{this._lastLoginTs=0;var t=Date.now();let s=null;var{a2Key:i,tinyID:o,helloInterval:n,instanceID:r,timeStamp:a,customStatus:c="",purchaseBits:l,authKey:d=""}=e.data,_=1e3*a,u=t-f.getStartTs(),u=_+parseInt(u/2)-t,t=f.getStartTs()+u,t=(f.start(t),_),_=u;if(he=_,(_=new Date).setTime(t),Ce.i(`baseTime from server:${_} offset:`+he),!o)throw s=new zs({code:js.NO_TINYID}),f.setError(s).end(),s;if(!i)throw s=new zs({code:js.NO_A2KEY}),f.setError(s).end(),s;t=this.get(Ns).getSocketID(),_=gn(c),c=`socketID:${t} scene:${m} helloInterval:${n} instanceID:${r} timeStamp:${a} offset:${u} customStatus:${_} isWebUniapp:`+this._isWebUniapp;Ce.l(M+" ok. "+c);let h="",p="";if(E&&xe($.getAccountInfoSync)){const g=$.getAccountInfoSync().miniProgram;g&&(h=g.appId,p=g.envVersion)}f.setMoreMessage(c+` href:${b?window.location.href:""} mpAppId:${h} envVersion:${p} authKey:`+d).end(),g.setA2Key(i),g.setTinyID(o),g.setStatusInstanceID(r),g.setCustomStatus(_),g.setDowloadFileAuthKey(d),l&&this.get(ws).onPushedConfig({errorCode:0,expiredTime:0,purchaseBits:l}),this.get(Os).updateProtocolConfig(),this.emitIEvt(Vi.A2KEY_AND_TINYID_UPDATED),this._helloInterval=n,this.triggerReady();t=this.getPushModule();return t&&(uni.setStorageSync("timUniAppInstanceID",r),t.init()),this._fetchCloudControlConfig(),this.get(bs).init(),e}).catch(e=>(f.setError(e).end(!0),this._m.setNotReadyReason(js.LOGIN_FAILED),Ce.e(M+" failed. error:",e),this._lastLoginTs=0,this._m.onLoginFailed(),Qs(e)))}logout(e=0){const t=this._n+".logout",s=this.isLoggedIn();return Ce.i(t+` type:${e} isLoggedIn:${s} isWebUniapp:`+this._isWebUniapp),s?(new mi("logout").setMessage("identifier:"+this.getMyUserID()).end(!0),0===e&&this._m.setNotReadyReason(js.LOGGED_OUT),this.req({P:ti.LOGOUT,data:{type:e,isWebUniapp:this._isWebUniapp}}).then(()=>(this.resetReady(),Zs({}))).catch(e=>(Ce.e(t+" error:",e),this.resetReady(),Zs({})))):Qs({code:js.USER_NOT_LOGGED_IN})}getLoginUser(){return this.isLoggedIn()?this.getMyUserID():""}_fetchCloudControlConfig(){this.get(Ps).fetchConfig()}_getStatusInstanceID(){return uni.getStorageSync("timUniAppInstanceID")||0}_hello(){this._lastWsHelloTs=Date.now(),this.req({P:ti.HELLO,data:{isWebUniapp:this._isWebUniapp}}).catch(e=>{Ce.w(this._n+"._hello error:",e)})}getLastWsHelloTs(){return this._lastWsHelloTs}_checkLoginInfo(e){let t=0;return Oe(this.get(vs).getSDKAppID())?t=js.NO_SDKAPPID:Oe(e.userID)?t=js.NO_IDENTIFIER:Oe(e.userSig)&&(t=js.NO_USERSIG),{code:t}}_isReactUIKit(){return b&&void 0!==window.tencent_cloud_im_csig_react_uikit_23F_xa}onMultipleAccountKickedOut(s){new mi("kickedOut").setMessage(`type:${t.KICKED_OUT_MULT_ACCOUNT} newInstanceInfo:`+JSON.stringify(s)).end(!0),Ce.w(`${this._n}.onMultipleAccountKickedOut userID:${this.getMyUserID()} newInstanceInfo:`,s),this.logout(1).then(()=>{this.emitOEvt(e.KICKED_OUT,{type:t.KICKED_OUT_MULT_ACCOUNT}),this._m.setNotReadyReason(js.KICKED_OUT_MULT_ACCOUNT),this._m.reset()})}onMultipleDeviceKickedOut(s){new mi("kickedOut").setMessage(`type:${t.KICKED_OUT_MULT_DEVICE} newInstanceInfo:`+JSON.stringify(s)).end(!0),Ce.w(`${this._n}.onMultipleDeviceKickedOut userID:${this.getMyUserID()} newInstanceInfo:`,s),this.logout(1).then(()=>{this.emitOEvt(e.KICKED_OUT,{type:t.KICKED_OUT_MULT_DEVICE}),this._m.setNotReadyReason(js.KICKED_OUT_MULT_DEVICE),this._m.reset()})}onUserSigExpired(){new mi("kickedOut").setMessage(t.KICKED_OUT_USERSIG_EXPIRED).end(!0),Ce.w(this._n+".onUserSigExpired userID:"+this.getMyUserID()),0!==this.get(vs).getStatusInstanceID()&&(this.emitOEvt(e.KICKED_OUT,{type:t.KICKED_OUT_USERSIG_EXPIRED}),this._m.setNotReadyReason(js.KICKED_OUT_USERSIG_EXPIRED),this._m.reset())}onRestApiKickedOut(s){new mi("kickedOut").setMessage(`type:${t.KICKED_OUT_REST_API} newInstanceInfo:`+JSON.stringify(s)).end(!0),Ce.w(`${this._n}.onRestApiKickedOut userID:${this.getMyUserID()} newInstanceInfo:`,s),0!==this.get(vs).getStatusInstanceID()&&(this.emitOEvt(e.KICKED_OUT,{type:t.KICKED_OUT_REST_API}),this._m.setNotReadyReason(js.KICKED_OUT_REST_API),this._m.reset(),this.get(Ns).onRestApiKickedOut())}reset(){Ce.l(this._n+".reset"),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}function Tn(){return null}class yn{constructor(e){this._m=e,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}_errorTolerantHandle(){k||"undefined"!=typeof window&&this._canIUseCookies()||(this.getItem=Tn,this.setItem=Tn,this.removeItem=Tn,this.clear=Tn)}onCheckTimer(e){e%20==0&&0!==this._storageQueue.size&&this._doFlush()}_doFlush(){try{for(var[e,t]of this._storageQueue)this._setStorageSync(this._getKey(e),t);this._storageQueue.clear()}catch(e){Ce.w(this._n+"._doFlush error:",e)}}_getPrefix(){var e=this._m.get(vs);return`TIM_${e.getSDKAppID()}_${e.getUserID()}_`}_getKey(e){return""+this._getPrefix()+e}getItem(e,t=!0){try{var s=t?this._getKey(e):e;return this.getStorageSync(s)}catch(e){return Ce.w(this._n+".getItem error:",e),{}}}setItem(e,t,s=!1,i=!0){if(s){const s=i?this._getKey(e):e;this._setStorageSync(s,t)}else this._storageQueue.set(e,t)}clear(){try{k?$.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){Ce.w(this._n+".clear error:",e)}}removeItem(e,t=!0){try{var s=t?this._getKey(e):e;this._removeStorageSync(s)}catch(e){Ce.w(this._n+".removeItem error:",e)}}getSize(e,t="b"){try{const s={size:0,limitSize:5242880,unit:t};if(Object.defineProperty(s,"leftSize",{enumerable:!0,get:()=>s.limitSize-s.size}),k&&(s.limitSize=1024*$.getStorageInfoSync().limitSize),e)s.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(k){const e=$.getStorageInfoSync()["keys"];e.forEach(e=>{s.size+=JSON.stringify(this.getStorageSync(e)).length+this._getKey(e).length})}else if(this._canIUseCookies())for(const e in localStorage)localStorage.hasOwnProperty(e)&&(s.size+=localStorage.getItem(e).length+e.length);return this._convertUnit(s)}catch(e){Ce.w(this._n+" error:",e)}}_convertUnit(e){var t={},s=e["unit"];t.unit=s;for(const i in e)"number"==typeof e[i]&&("kb"===s.toLowerCase()?t[i]=Math.round(e[i]/1024):"mb"===s.toLowerCase()?t[i]=Math.round(e[i]/1024/1024):t[i]=e[i]);return t}_setStorageSync(e,t){k?O?my.setStorageSync({key:e,data:t}):$.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}getStorageSync(e){return k?O?my.getStorageSync({key:e}).data:$.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}_removeStorageSync(e){k?O?my.removeStorageSync({key:e}):$.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}_canIUseCookies(){return"undefined"!=typeof window&&navigator&&navigator.cookieEnabled&&localStorage}reset(){Ce.l(this._n+".reset"),this._doFlush()}}class vn{constructor(e){this._n="SSOLogBody",this._report=[]}pushIn(e){Ce.d(this._n+".pushIn",this._report.length,e),this._report.push(e)}backfill(e){be(e)&&0!==e.length&&(Ce.d(this._n+".backfill",this._report.length,e.length),this._report.unshift(...e))}getLogsNumInMemory(){return this._report.length}isEmpty(){return 0===this._report.length}_reset(){this._report.length=0,this._report=[]}getLogsInMemory(){var e=this._report.slice();return this._reset(),e}}const Sn=function(e){var t=e.get(vs);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:pe()}};class En extends ei{constructor(e){super(e),this._n="EventStatModule",this.TAG="im-ssolog-event",this._reportBody=new vn,this.MIN_THRESHOLD=20,this.MAX_THRESHOLD=100,this.WAITING_TIME=6e4,this.REPORT_LEVEL=[4,5,6],this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._lastReportTime=Date.now();e=this.getIEmitInst();e.on(Vi.A2KEY_AND_TINYID_UPDATED,this._onLoginSuccess,this),e.on(Vi.CLOUD_CONFIG,this._onCloudConfig,this)}reportAtOnce(){this._report()}_onLoginSuccess(){var e=this.get(Ss),t=e.getItem(this.TAG,!1);!Oe(t)&&xe(t.forEach)&&(Ce.l(this._n+"._onLoginSuccess. logs count:"+t.length),t.forEach(e=>{this._reportBody.pushIn(e)}),e.removeItem(this.TAG,!1))}_onCloudConfig(){var e=this.getCloudConfig("evt_rpt_threshold"),t=this.getCloudConfig("evt_rpt_waiting"),s=this.getCloudConfig("evt_rpt_level"),i=this.getCloudConfig("evt_rpt_sdkappid_bl"),o=this.getCloudConfig("evt_rpt_tinyid_wl");$e(e)||(this.MIN_THRESHOLD=Number(e)),$e(t)||(this.WAITING_TIME=Number(t)),$e(s)||(this.REPORT_LEVEL=s.split(",").map(e=>Number(e))),$e(i)||(this.REPORT_SDKAPPID_BLACKLIST=i.split(",").map(e=>Number(e))),$e(o)||(this.REPORT_TINYID_WHITELIST=o.split(","))}pushIn(e){e instanceof mi&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD)&&this._report()}onCheckTimer(){Date.now()this.REPORT_LEVEL.includes(e.level))}_report(){if(!this._reportBody.isEmpty()){const t=this._reportBody.getLogsInMemory(),s=this._filterLogs(t);var e;0===s.length?this._lastReportTime=Date.now():(e={header:Sn(this),event:s},this.req({P:ti.SSO_STAT,data:{...e}}).then(()=>{this._lastReportTime=Date.now()}).catch(e=>{Ce.w(this._n+"._report failed. error:",e),this._lastReportTime=Date.now(),this._reportBody.backfill(t),this._reportBody.getLogsNumInMemory()>this.MAX_THRESHOLD&&this._flushAtOnce()}))}}_flushAtOnce(){var t=this.get(Ss),s=t.getItem(this.TAG,!1),i=this._reportBody.getLogsInMemory(),o=this._n+"._flushAtOnce";if(Oe(s))Ce.l(o+" count:"+i.length),t.setItem(this.TAG,i,!0,!1);else{let e=i.concat(s);e.length>this.MAX_THRESHOLD&&(e=e.slice(0,this.MAX_THRESHOLD)),Ce.l(o+" count:"+e.length),t.setItem(this.TAG,e,!0,!1)}}reset(){Ce.l(this._n+".reset"),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}const Dn="none",Rn="online";class Ln{constructor(e){this._m=e,this._networkType=Rn,this._n="NetMonitorModule",this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null,this._removeListener=null,this._m.getIEmitInst().on(Vi.A2KEY_AND_TINYID_UPDATED,this._startRN,this)}_startRN(){var e;F&&(e=this._m.get(Ls).getPlugin("chat-network-monitor"))&&(this._removeListener=e.addEventListener(e=>{var{isConnected:e=!1,type:t}=e;this._networkType!==t&&this._onNetworkStatusChange({isConnected:e,networkType:t})}))}start(){const t=this._n+".start";k?($.getNetworkType({success:e=>{this._networkType=e.networkType||e.subtype||"",e.networkType===Dn?Ce.w(t+" no network, please check!"):Ce.i(t+" networkType:"+e.networkType)}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),$.onNetworkStatusChange(this._mpNetworkStatusCallback)):b&&(this._networkType=Rn,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback))}_onWebOnline(){this._onNetworkStatusChange({isConnected:!0,networkType:Rn})}_onWebOffline(){this._onNetworkStatusChange({isConnected:!1,networkType:Dn})}_onNetworkStatusChange(e){var{isConnected:e,networkType:t}=e,s=this._n+"._onNetworkStatusChange";let i=!1;var o=`previous:${this._networkType} current:`+t;e?(Ce.i(s+" "+o),this._networkType!==t&&(i=!0,this._networkType=t,this._m.get(Ns).reConnect(!0))):this._networkType!==t&&(i=!0,this._networkType=t,Ce.w(s+" no network, please check!"),this._m.get(Ns).offline()),i&&new mi("networkChange").setMessage(`isConnected:${e} `+o).end()}isOnline(){return this._networkType!==Dn}getNetworkType(){return this._networkType}reset(){Ce.l(this._n+".reset"),k?null!==this._mpNetworkStatusCallback&&($.offNetworkStatusChange&&$.offNetworkStatusChange(this._mpNetworkStatusCallback),this._mpNetworkStatusCallback=null):b?(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null)):F&&this._removeListener&&(this._removeListener(),this._removeListener=null)}}function An(e,t){return e(t={exports:{}},t.exports),t.exports}var On=An(function(e){var i=Object.prototype.hasOwnProperty,h="~";function s(){}function n(e,t,s){this.fn=e,this.context=t,this.once=s||!1}function o(e,t,s,i,o){if("function"!=typeof s)throw new TypeError("The listener must be a function");s=new n(s,i||e,o),i=h?h+t:t;return e._events[i]?e._events[i].fn?e._events[i]=[e._events[i],s]:e._events[i].push(s):(e._events[i]=s,e._eventsCount++),e}function c(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function t(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(h=!1)),t.prototype.eventNames=function(){var e,t,s=[];if(0===this._eventsCount)return s;for(t in e=this._events)i.call(e,t)&&s.push(h?t.slice(1):t);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},t.prototype.listeners=function(e){var e=h?h+e:e,t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var s=0,i=t.length,o=new Array(i);s{this._fileDNList.includes(e)||this._fileDNList.push(e)})}catch(e){}}_getAuthorizationKey(){const s=this._n+"._getAuthorizationKey",i=new mi("_getAuthorizationKey"),o=Math.ceil(Date.now()/1e3);this.req({P:ti.COS_SIGN,data:{duration:this.expiredTimeLimit}}).then(e=>{var e=e["data"],t=(Ce.l(s+" ok. data:",e),e.expiredTime-o);i.setMessage(`requestId:${e.requestId} requestTime:${o} expiredTime:${e.expiredTime} diff:${t}s`).end(),!k&&e.region&&(this.region=e.region),this.appid=e.appid,this.bucketName=e.bucketName,this.ciUrl=e.ciUrl,this.directory=e.directory,this.downloadUrl=e.downloadUrl,this.uploadUrl=e.uploadUrl,this.cosOptions={secretId:e.secretId,secretKey:e.secretKey,sessionToken:e.sessionToken,expiredTime:e.expiredTime},Ce.l(s+` ok. region:${this.region} bucketName:`+this.bucketName),this._initUploaderMethod()}).catch(e=>{i.setError(e).end(),Ce.w(s+" failed. error:",e)})}_getCosPreSigUrl(t){const i=this._n+"._getCosPreSigUrl",o=Math.ceil(Date.now()/1e3),n=new mi("_getCosPreSigUrl");let e={uploadMethod:t.uploadMethod,platform:this.getPlatform(),SDKAppID:this.getSDKAppID(),userID:t.userID,conversationType:t.conversationType,uploadConfig:[{fileID:1,fileType:t.fileType,fileName:t.fileName}]},s=ti.SIMPLE_COS_PRE_SIG;return this.isSimpleCos||(e={fileType:t.fileType,fileName:t.fileName,uploadMethod:t.uploadMethod,duration:t.duration},s=ti.COS_PRE_SIG),this.req({P:s,data:e}).then(e=>{this.tryCount=0;var t=e.data||{};Ce.l(`${i} ok. isSimpleCos:${this.isSimpleCos} data:`,t);let s="";if(this.isSimpleCos){const{uploadUrl:e,fileKey:i}=t.preSig[0];s=`uploadIP:${t.uploadIP} uploadUrl:${e} fileKey:${i} cost:`+Et(o)}else s=`requestId:${t.requestId} expiredTime:${t.expiredTime} diff:${t.expiredTime-o}s`;return n.setMessage(s).end(),t}).catch(e=>(-1===e.code&&(e.code=js.COS_GET_SIG_FAIL),n.setError(e).end(),Ce.w(i+" failed. error:",e),this.tryCount<1?(this.tryCount++,this._getCosPreSigUrl(t)):(this.tryCount=0,Qs({code:js.COS_GET_SIG_FAIL}))))}_initUploaderMethod(){this.TIMUploadPlugin?(this.timUploadPlugin=new this.TIMUploadPlugin,this._cosUploadMethod=(e,t)=>{this.timUploadPlugin.uploadFile(e,t)}):this.appid&&(this.cos=k?new this.COSSDK({ForcePathStyle:!0,getAuthorization:this._getAuthorization.bind(this)}):new this.COSSDK({getAuthorization:this._getAuthorization.bind(this)}),this._cosUploadMethod=k?(e,t)=>{this.cos.postObject(e,t)}:(e,t)=>{this.cos.uploadFiles(e,t)})}onCheckTimer(e){!this.COSSDK||this.TIMUploadPlugin||this.isLoggedIn()&&e%60==0&&Math.ceil(Date.now()/1e3)>=this.cosOptions.expiredTime-120&&this._getAuthorizationKey()}getFileDNList(){return this._fileDNList}_getAuthorization(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}upload(e){if(!0===e._relayFlag)return Promise.resolve();var s=this.get(ks);switch(e.type){case t.MSG_IMAGE:return s.addTotalCount(ci),this._uploadImage(e);case t.MSG_FILE:return s.addTotalCount(ci),this._uploadFile(e);case t.MSG_AUDIO:return s.addTotalCount(ci),this._uploadAudio(e);case t.MSG_VIDEO:return s.addTotalCount(ci),this._uploadVideo(e);default:return Promise.resolve()}}_uploadImage(g){const e=this.get(gs),m=g.getElements()[0],t=e.getMessageOption(g.clientSequence);return this.doUploadImage({file:t.payload.file,to:t.to,message:g,onProgress:e=>{if(m.updatePercent(e),xe(t.onProgress))try{t.onProgress(e)}catch(e){return Qs({code:js.MSG_ONPROGRESS_ERR})}}}).then(t=>{var{location:t,fileType:e,fileSize:s,width:i,height:o,smallImageUrl:n,smallImageWidth:r,smallImageHeight:a,largeImageUrl:c,largeImageWidth:l,largeImageHeight:d,imageInfoArray:_}=t,t=this.isPrivateNetWork()?t:et(t);m.updateImageFormat(e);let u,h,p={size:s,url:t,width:i,height:o};if(_&&0<_.length)for(let e=0;e<_.length;e++){const t=_[e];1===t.type?u=t:2===t.type?h=t:p={...p,...t}}else h=n&&c?(u={url:n,width:r,height:a},{url:c,width:l,height:d}):(u=pt({originUrl:t,originWidth:i,originHeight:o,min:198}),pt({originUrl:t,originWidth:i,originHeight:o,min:720}));return m.updateImageInfoArray([{...p},{...h},{...u}]),g})}_uploadFile(s){const e=this.get(gs),i=s.getElements()[0],t=e.getMessageOption(s.clientSequence);return this.doUploadFile({file:t.payload.file,to:t.to,message:s,onProgress:e=>{if(i.updatePercent(e),xe(t.onProgress))try{t.onProgress(e)}catch(e){return Qs({code:js.MSG_ONPROGRESS_ERR})}}}).then(({location:e})=>{let t=e;return this.isPrivateNetWork()||(t=Mi(t=et(e),this._fileDownloadProxy,this._authKey,this._fileDNList)),i.updateFileUrl(t),s})}_uploadAudio(t){const e=this.get(gs),s=t.getElements()[0],i=e.getMessageOption(t.clientSequence);return this.doUploadAudio({file:i.payload.file,to:i.to,message:t,onProgress:e=>{if(s.updatePercent(e),xe(i.onProgress))try{i.onProgress(e)}catch(e){return Qs({code:js.MSG_ONPROGRESS_ERR})}}}).then(({location:e})=>{e=this.isPrivateNetWork()?e:et(e);return s.updateAudioUrl(e),t})}_uploadVideo(s){const e=this.get(gs),i=s.getElements()[0],t=e.getMessageOption(s.clientSequence);return this.doUploadVideo({file:t.payload.file,to:t.to,message:s,onProgress:e=>{if(i.updatePercent(e),xe(t.onProgress))try{t.onProgress(e)}catch(e){return Qs({code:js.MSG_ONPROGRESS_ERR})}}}).then(e=>{var{location:e,snapshotInfo:t}=e,e=this.isPrivateNetWork()?e:et(e);return i.updateVideoUrl(e),Oe(t)||i.updateSnapshotInfo(t),s})}_checkSizeError(e){let t="";return"A"===e?t="audio":"I"===e?t="image":"V"===e?t="video":"F"===e&&(t="file"),Qs({code:js[`MSG_${e}_SIZE_LIMIT`],message:this.getErrMsg("UploadSizeLimit",t,this.UPLOAD_SIZE_LIMIT[e]/1048576+"MB")})}doUploadImage(s){if(!s.file||this._isEmptyFileList(s.file.files))return Qs({code:js.MSG_I_SELECT_F_FIRST});var e=this._checkImageType(s.file);if(!0!==e)return e;e=this._checkImageSize(s.file);if(!0!==e)return e;let i=null;return this._setUploadFileType(Yi),this.uploadByCOS(s).then(e=>{if(i=e,this.isPrivateNetWork())return ut(t);if(be(i.imageInfoArray)){const s=i.imageInfoArray.find(e=>3===e.type);if(s)return s}if(F)return{width:s.file.width,height:s.file.height};let t=et(e.location);return ut(t=this.COSSDK?t:Mi(t,this._fileDownloadProxy,this._authKey,this._fileDNList))}).then(e=>(i.width=e.width,i.height=e.height,Promise.resolve(i)))}_checkImageType(e){var t="",t=k?e.url.slice(e.url.lastIndexOf(".")+1):F?e.type.split("/")[1]:e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1);return 0<=Hi.indexOf(t.toLowerCase())||Qs({code:js.MSG_I_TYPES_LIMIT})}_checkImageSize(e){return 0===(e=(k||F?e:e.files[0]).size)?Qs({code:js.MSG_F_IS_EMPTY}):ethis.UPLOAD_SIZE_LIMIT.F?this._checkSizeError("F"):0===e.file.files[0].size?(t={code:js.MSG_F_IS_EMPTY},Qs(t)):(this._setUploadFileType(Ji),this.uploadByCOS(e))}doUploadVideo(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.V?this._checkSizeError("V"):0===e.file.videoFile.size?Qs({code:js.MSG_F_IS_EMPTY}):-1===Wi.indexOf(e.file.videoFile.type)?Qs({code:js.MSG_V_TYPES_LIMIT}):(this._setUploadFileType(zi),k||F?this.handleVideoUpload({...e,file:e.file.videoFile}):b?this.handleVideoUpload(e):void 0)}handleVideoUpload(s){return new Promise((t,e)=>{this.uploadByCOS(s).then(e=>{t(e)}).catch(()=>{this.uploadByCOS(s).then(e=>{t(e)}).catch(()=>{e(new zs({code:js.MSG_V_UPLOAD_FAIL}))})})})}doUploadAudio(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.A?this._checkSizeError("A"):0===e.file.size?Qs({code:js.MSG_F_IS_EMPTY}):(this._setUploadFileType(ji),this.uploadByCOS(e)):Qs({code:js.MSG_A_UPLOAD_FAIL})}uploadByCOS(t){if(!xe(this._cosUploadMethod))return this.warn("PluginUndetected"),Qs({code:js.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(t);const c=new mi("upload"),l=this._n+".uploadByCOS",d=Date.now(),_=this._getFile(t);return new Promise((n,r)=>{const e=k?this._createCosOptionsWXMiniApp(t):this._createCosOptionsWeb(t),a=this;this._cosUploadMethod(e,(e,t)=>{var s=Object.create(null);if(t){if(e||be(t.files)&&t.files[0].error){const e=new zs({code:js.MSG_F_UPLOAD_FAIL});return c.setError(e).end(),Ce.l(l+" failed. error:",t.files[0].error),403===t.files[0].error.statusCode&&this._getAuthorizationKey(),void r(e)}s.fileName=_.name,s.fileSize=_.size,s.fileType=_.type.slice(_.type.indexOf("/")+1).toLowerCase(),s.location=(k?t:t.files[0].data).Location;const i=Date.now()-d,o=`size:${a._formatFileSize(_.size)} time:${i}ms speed:`+a._formatSpeed(1e3*_.size/i);Ce.l(l+` success. name:${_.name} `+o),n(s);t=this.get(ks);t.addCost(ci,i),t.addFileSize(ci,_.size),void c.setMessage(o).end()}else{const i=new zs({code:js.MSG_F_UPLOAD_FAIL});c.setError(i).end(),Ce.w(l+" failed. error:",e),403===e.statusCode&&this._getAuthorizationKey(),r(i)}})})}_uploadWithPreSigUrl(e){const _=this._n+"._uploadWithPreSigUrl",u=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then(d=>new Promise((n,e)=>{const r=new mi("upload"),{requestSnapshotUrl:a,...c}=d,l=Date.now();this._cosUploadMethod(c,(t,s)=>{if(t||403===s.statusCode){r.setError(new zs(t)).end();const u={HttpStatusCode:Pn,CostTime:Et(l,!1),error:t,url:d.url};s.data&&s.data.uploadIP&&(u.uploadIP=s.data.uploadIP),this._uploadSSOLog(u),Ce.l(_+" failed, error:",t),void e(new zs({code:js.MSG_F_UPLOAD_FAIL}))}else{const o=Object.create(null);let e=s.data.location||"";this.isPrivateNetWork()||0!==e.indexOf("https://")&&0!==e.indexOf("http://")||(e=e.split("//")[1]),o.fileName=u.name,o.fileSize=u.size,o.fileType=u.type.slice(u.type.indexOf("/")+1).toLowerCase(),o.location=e;var t=Et(l,!1),i=`size:${this._formatFileSize(u.size)} time:${t}ms speed:${this._formatSpeed(1e3*u.size/t)} res:`+JSON.stringify(s.data),i=(Ce.l(_+` ok. name:${u.name} `+i),r.setMessage(i).end(),{HttpStatusCode:s.statusCode,FileSize:u.size,CostTime:t,url:d.url}),i=(s.data&&s.data.uploadIP&&(i.uploadIP=s.data.uploadIP),this._uploadSSOLog(i),this.get(ks)),t=(i.addCost(ci,t),i.addFileSize(ci,u.size),[]);if(c.thumbUrl&&c.largeUrl&&t.push(this._getSmallImageInfoByUrl(c.thumbUrl,o),this._getLargeImageInfoByUrl(c.largeUrl,o)),this.uploadFileType===Yi&&this.isSimpleCos&&!this.isPrivateNetWork()&&(t.push(this._getImageInfoArray(c.downloadUrl,o)),s.data.uploadIP)&&t.push(this._getDownloadIP(c.downloadUrl.split("//")[1].split("/")[0],o)),a&&t.push(this._getSnapshotInfoByUrl(a,o)),0{n(o)});n(o)}})}))}_getDownloadIP(e,s){const i=this._n+"._getDownloadIP",o=Date.now();return this.req({P:ti.GET_IP,data:{domainName:e}}).then(e=>{var t;e.data&&e.data.ip&&(Ce.l(i+` ok. downloadIP:${e.data.ip} cost:`+Et(o)),(t=s.location.split("/"))[0]=e.data.ip,s.location=t.join("/"))}).catch(e=>{})}_getImageInfoArray(t,s){const i=this._n+"._getImageInfoArray",o=Date.now();return this.req({P:ti.GET_IMAGE_INFO,data:{imageUrl:t}}).then(e=>{e=e.data||{};return Ce.l(i+` ok. data: ${JSON.stringify(e)} cost:`+Et(o)),s.imageInfoArray=e.imageInfoArray,e}).catch(e=>{s.imageInfoArray=void 0,this._uploadSSOLog({HttpStatusCode:Un,CostTime:Et(o,!1),url:t})})}_uploadSSOLog(t){if(this.isSimpleCos){var s=new mi;s.setEventType(18),t.error&&s.setError(new zs(t.error));let e=`HttpStatusCode:${t.HttpStatusCode}|CosRequestId:${t.CosRequestId||""}|FileAlreadyExist:${t.FileAlreadyExist||0}|FileSize:${t.FileSize||0}|CostTime:`+t.CostTime;t.uploadIP&&(e+="|FinalIP:"+t.uploadIP),s.setMessage("OK").setMoreMessage(t.url).setExtension(e).end()}}_getRawOrUploadProxyUrl(e){var t=this.get(vs).getFileUploadProxy();let s=e;return s=t?e.replace(/^https:\/\/[^/]+/,t):s}_getFile(e){return be(e.file.files)||Be(e.file.files)?e.file.files[0]:e.file}_formatFileSize(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}_formatSpeed(e){return e<=1048576?ft(e/1024,1)+"KB/s":ft(e/1048576,1)+"MB/s"}_createCosOptionsWeb(t){var e=this._getFile(t),s=e.name,s=s.slice(s.lastIndexOf(".")),s=this._genFileName(""+je(999999)+s);return{files:[{Bucket:this.bucketName+"-"+this.appid,Region:this.region,Key:this.directory+"/"+s,Body:e}],SliceSize:1048576,onProgress:e=>{if("function"==typeof t.onProgress)try{t.onProgress(e.percent)}catch(e){Ce.w("onProgress callback error:",e)}},onFileFinish:(e,t,s)=>{}}}_createCosOptionsWXMiniApp(t){var e=this._getFile(t),s=this._genFileName(e.name),e=e.url;return{Bucket:this.bucketName+"-"+this.appid,Region:this.region,Key:this.directory+"/"+s,FilePath:e,onProgress:e=>{if(Ce.l(JSON.stringify(e)),"function"==typeof t.onProgress)try{t.onProgress(e.percent)}catch(e){Ce.w("onProgress callback error:",e)}}}}_createCosOptionsPreSigUrl(a){let c="",l="",e=0;var s=this._getFile(a);if(k||F){if(a.message.type===t.MSG_FILE){const a=s.name,t=a.slice(a.lastIndexOf("."));c=this._genFileName(""+je(999999)+t)}else c=this._genFileName(s.name);l=s.url,e=1}else{const a=s.name,t=a.slice(a.lastIndexOf("."));c=this._genFileName(""+je(999999)+t),l=s,e=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:c,uploadMethod:e,duration:this.duration,userID:a.message.from,conversationType:rt(a.message.conversationID)?1:2}).then(e=>{var{uploadUrl:t,downloadUrl:s,requestSnapshotUrl:i,thumbUrl:o,largeUrl:n,fileKey:r}=this.isSimpleCos?e.preSig[0]:e,{uploadIP:e=""}=e;return{url:this._getRawOrUploadProxyUrl(t),fileType:this.uploadFileType,fileName:c,resources:l,downloadUrl:s,requestSnapshotUrl:i,thumbUrl:o,largeUrl:n,fileKey:r,uploadIP:!this.isPrivateNetWork()&&e,onProgress:e=>{if("function"==typeof a.onProgress)try{a.onProgress(e.percent)}catch(e){Ce.w("onProgress callback error:",e),Ce.e(e)}}}})}_genFileName(e){return dt()+"-"+e}_setUploadFileType(e){this.uploadFileType=e}_getSnapshotInfoByUrl(e,s){const i="_getSnapshotInfoByUrl",o=new mi(i);return this.req({P:ti.VIDEO_COVER,data:{platform:this.getPlatform(),coverName:this._genFileName(je(99999)),requestSnapshotUrl:e}}).then(e=>{e=(e.data||{}).snapshotUrl;if(Ce.l(`${this._n}.${i} ok. snapshotUrl:`+e),o.setMessage("snapshotUrl:"+e).end(),Oe(e))return{};const t=Mi(e,this._fileDownloadProxy,this._authKey,this._fileDNList);return ut(t).then(e=>{s.snapshotInfo={snapshotUrl:t,snapshotWidth:e.width,snapshotHeight:e.height}})}).catch(e=>(Ce.w(`${this._n}.${i} failed. error:`,e),o.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}))}_getSmallImageInfoByUrl(t,s){return ut(Mi(t,this._fileDownloadProxy,this._authKey,this._fileDNList)).then(e=>{s.smallImageUrl=t,s.smallImageWidth=e.width,s.smallImageHeight=e.height})}_getLargeImageInfoByUrl(t,s){return ut(Mi(t,this._fileDownloadProxy,this._authKey,this._fileDNList)).then(e=>{s.largeImageUrl=t,s.largeImageWidth=e.width,s.largeImageHeight=e.height})}_isEmptyFileList(e){return!(!Be(e)||0!==e.length)}reset(){Ce.l(this._n+".reset")}}class kn{constructor(e){this._n="MergerMessageHandler",this._msgM=e}uploadMergerMessage(e,s){const i=this._n+".uploadMergerMessage",t=(Ce.d(i+" message:",e,"messageBytes:"+s),JSON.parse(JSON.stringify(e.payload)))["messageList"],o=t.length,n=this._msgM.get(Rs).getFileDNList(),r=new mi("uploadMergerMessage");return t.forEach(e=>{Ii(e.messageBody[0].type,e.messageBody,n)}),this._msgM.req({P:ti.UPLOAD_MERGER_MSG,data:{messageList:t}}).then(e=>{Ce.d(i+" ok. response:",e.data);var{pbDownloadKey:e,downloadKey:t}=e.data,e={pbDownloadKey:e,downloadKey:t,messageNumber:o};return r.setMessage(o+`-${s}-`+t).end(),e}).catch(e=>{throw Ce.w(i+" failed. error:",e),r.setError(e).end(),e})}downloadMergerMessage(o){const n=this._n+".downloadMergerMessage",t=(Ce.d(n+" message:",o),o.payload)["downloadKey"],r=this._msgM.getFileDownloadProxy(),a=this._msgM.getDowloadFileAuthKey(),c=new mi("downloadMergerMessage");return c.setMessage("downloadKey:"+t),this._msgM.req({P:ti.DOWNLOAD_MERGER_MSG,data:{downloadKey:t}}).then(e=>{Ce.d(n+" ok. response:",e.data);const t=this._msgM.get(Rs).getFileDNList();if(xe(o.clearElement)){const{downloadKey:n,pbDownloadKey:c,messageList:s,...i}=o.payload;o.clearElement(),o.setElement({type:o.type,content:{messageList:e.data.messageList,...i}},r,a,t)}else{const n=[];e.data.messageList.forEach(e=>{Oe(e)||(e=new Ui(e,r,a,t),n.push(e))}),o.payload.messageList=n,o.payload.downloadKey="",o.payload.pbDownloadKey=""}return c.end(),o}).catch(e=>{throw Ce.w(`${n} failed. key:${t} error:`,e),c.setError(e).end(),e})}createMergerMessagePack(e,s,i){return e.conversationType===t.CONV_C2C?this._createC2CMergerMessagePack(e,s,i):this._createGroupMergerMessagePack(e,s,i)}_createC2CMergerMessagePack(e,t,s){let i=null;t&&(t.offlinePushInfo&&(i=t.offlinePushInfo),!0===t.onlineUserOnly)&&(i?i.disablePush=!0:i={disablePush:!0});var o=[];if(Fe(t)&&Fe(t.messageControlInfo)){const{excludedFromUnreadCount:e,excludedFromLastMessage:s,excludedFromContentModeration:i}=t.messageControlInfo;!0===e&&o.push("NoUnread"),!0===s&&o.push("NoLastMsg"),!0===i&&o.push("NoMsgCheck")}let n="";ke(e.cloudCustomData)&&0(this._getSendMessageSpecifiedKey(r)===ai&&this.get(ks).addSuccessCount(ci),this._guardForGroup(r).then(()=>{if(!r.isSendable())return Qs({code:js.MSG_F_URL_IS_EMPTY});this._addSendMessageTotalCount(r),_=Date.now();var e=function(t){let e="utf-8";b&&document&&(e=document.charset.toLowerCase());let s,i=0,o;if(o=t.length,"utf-8"===e||"utf8"===e)for(let e=0;e{e=this._mergerMessageHandler.createMergerMessagePack(r,a,e);return this.req(e)}):(l.setMessageRandom(r),s.sendMessage(r,a))}).then(e=>{var{time:e,sequence:s,readReceiptCode:i,messageDropReason:o}=e.data;if(Ge(i)&&0!==i&&(new mi("sendMessageWithReceipt").setMessage(`from:${r.from} to:${r.to} sequence:${s} readReceiptCode:`+i).end(),Ce.w(c+` readReceiptCode:${i} message:`+this.getErrMsg(i))),o){const t=new mi("messageDropReason"),a=`from:${r.from} to:${r.to} sequence:${s} messageDropReason:`+o;t.setMessage(a).end(),Ce.w(c+" "+a)}if(this._addSendMessageSuccessCount(r,_),this._messageOptionsMap.delete(r.clientSequence),!0===r.isResend){const t=l.findMessage(r.ID);t&&(Ce.l(c+" resend ok. ID:"+t.ID),l.deleteLocalMessage(t))}r.status=Ot,r.time=e;let n=!1;if(r.conversationType===t.CONV_GROUP)r.sequence=s;else if(r.conversationType===t.CONV_C2C){const t=l.getLatestMessageSentByMe(r.conversationID);if(t){const{nick:a,avatar:e}=t;a===r.nick&&e===r.avatar||(n=!0)}}if(n&&l.modifyMessageSentByMe({conversationID:r.conversationID,latestNick:r.nick,latestAvatar:r.avatar}),!0===d)r._onlineOnlyFlag=!0;else{l.appendToMessageList(r);let e=r,s=(Fe(a)&&Fe(a.messageControlInfo)&&(!0===a.messageControlInfo.excludedFromLastMessage&&(r._isExcludedFromLastMessage=!0,e=""),!0===a.messageControlInfo.excludedFromUnreadCount)&&(r._isExcludedFromUnreadCount=!0),r.conversationType);ot(r.to)&&(s=t.CONV_TOPIC,this.get(Ts).onMessageSent({groupID:Ct(r.to),topicID:r.to,lastMessage:e})),l.onMessageSent({conversationOptionsList:[{conversationID:r.conversationID,unreadCount:0,type:s,subType:r.conversationSubType,lastMessage:e}]})}return r._relayFlag||"TIMImageElem"!==r.type||gt(r.payload.imageInfoArray),Ys({message:r})}))).catch(e=>this._onSendMessageFailed(r,e,d))}_guardForGroup(e){if(e.conversationType!==t.CONV_GROUP)return Promise.resolve();var s=this.get(Is);if(!s)return this._onNoModule();if(nt({groupID:e.to})){const t=s.getLocalGroupProfile(e.to);if(t&&t.isSupportTopic)return Qs({code:js.MSG_SEND_GRP_WITH_TOPIC_FAIL})}return s.guardForAVChatRoom(e)}_onSendMessageFailed(e,t,s=!1){var i=this._n+"._onSendMessageFailed",o=(e.status=Nt,80001!==t.code&&80004!==t.code||(e.hasRiskContent=!0),this.get(ys)),n=(o.deleteMessageRandom(e),10100<=t.code&&t.code<=10200||120001<=t.code&&t.code<=13e4),s=(s||n||!0===o.appendToMessageList(e)&&Ce.l(i+" message stored, ID:"+e.ID),this._addSendMessageFailCountOnUser(e,t),new mi("sendMessage"));let r=`head.seq:${t.data.headSeq} type:${e.type} from:${e.from} to:`+e.to;if(b){if("connection"in navigator){const e=navigator.connection;r+=` downlink:${e.downlink} effectiveType:${e.effectiveType} rtt:`+e.rtt}if("memory"in window.performance){const e=window.performance.memory;r+=` usedJSHeapSize:${e.usedJSHeapSize} totalJSHeapSize:${e.totalJSHeapSize} jsHeapSizeLimit:`+e.jsHeapSizeLimit}}return s.setMessage(r).setError(t).end(),Ce.e(i+` ${r} error:`,t),Qs(new zs({code:t&&t.code?t.code:js.MSG_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}_getSendMessageSpecifiedKey(e){if([t.MSG_IMAGE,t.MSG_AUDIO,t.MSG_VIDEO,t.MSG_FILE].includes(e.type))return ai;if(e.conversationType===t.CONV_C2C)return ni;if(e.conversationType===t.CONV_GROUP){const t=this.get(Is);if(t){var e=t.getLocalGroupProfile(e.to);if(e)return e=e.type,it(e)?ri:oi}}}_addSendMessageTotalCount(e){e=this._getSendMessageSpecifiedKey(e);e&&this.get(ks).addTotalCount(e)}_addSendMessageSuccessCount(e,t){var s=this._getSendMessageSpecifiedKey(e);if(s){const e=this.get(ks);e.addSuccessCount(s),e.addCost(s,Et(t,!1))}}_addSendMessageFailCountOnUser(e,t){var{code:t=-1}=t,s=this.get(ks),e=this._getSendMessageSpecifiedKey(e);e===ai&&function(e){let t=!1;return t=Fn.includes(e)?!0:t}(t)?s.addFailedCountOfUserSide(ci):bn(t)&&e&&s.addFailedCountOfUserSide(e)}resendMessage(e,t){return e.isResend=!0,e.status=At,this.sendMessageInstance(e,t)}revokeMessage(s){let e=null;if(s.conversationType===t.CONV_C2C?e=this.get(Ms):s.conversationType===t.CONV_GROUP&&(e=this.get(Is)),!e)return this._onNoModule();const i=new mi("revokeMessage"),o=(i.setMessage(`type:${s.type} from:${s.from} to:`+s.to),this._n+".revokeMessage");return e.revokeMessage(s).then(e=>{var t=e.data.recallRetList;if(Oe(t)||0===t[0].retCode)return Ce.i(o+" ok. ID:"+s.ID),s.isRevoked=!0,i.end(),this.get(ys).onMessageRevoked([s]),Ys({message:s});{const e=new zs({code:t[0].retCode,data:{message:s}});return i.setCode(e.code).setMoreMessage(e.message).end(),Qs(e)}}).catch(e=>{i.setError(e).end();var t=new zs({code:e&&e.code?e.code:js.MSG_REVOKE_FAIL,message:e&&e.message?e.message:void 0,data:{message:s}});return Ce.w(o+" failed. error:",e),Qs(t)})}deleteMessage(e){let s=null;const i=e[0],o=i.conversationID;let n="",r=[],a=[];if(i.conversationType===t.CONV_C2C)s=this.get(Ms),n=o.replace(t.CONV_C2C,""),e.forEach(e=>{e&&e.status===Ot&&e.conversationID===o&&(e._onlineOnlyFlag||r.push(`${e.sequence}_${e.random}_`+e.time),a.push(e))});else if(i.conversationType===t.CONV_GROUP)s=this.get(Is),n=o.replace(t.CONV_GROUP,""),e.forEach(e=>{e&&e.status===Ot&&e.conversationID===o&&(e._onlineOnlyFlag||r.push(""+e.sequence),a.push(e))});else if(i.conversationType===t.CONV_SYSTEM)return Qs({code:js.CANNOT_DELETE_GRP_SYSTEM_NOTICE});if(!s)return this._onNoModule();if(0===r.length)return this._onMessageDeleted(a);30(c.end(),Ce.i(l+" ok"),this._onMessageDeleted(a))).catch(e=>{c.setError(e).end(),Ce.w(l+" failed. error:",e);e=new zs({code:e&&e.code?e.code:js.MSG_DELETE_FAIL,message:e&&e.message?e.message:void 0});return Qs(e)})}_onMessageDeleted(e){return this.get(ys).onMessageDeleted(e),Zs({messageList:e})}translateText(e){const o=this._n+".translateText",{sourceTextList:t,sourceLanguage:s,targetLanguage:i}=e,n=new mi("translateText");return n.setMessage(`sourceLanguage:${s} targetLanguage:`+i),this.req({P:ti.TRANSLATE_TEXT,data:{sourceTextList:t,source:s||"auto",target:i,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then(e=>{var{error:e,requestID:t,translatedTextList:s}=e.data,i=e["code"];if(0===i)return n.end(),Ce.i(o+" ok. requestID:"+t),Ys({translatedTextList:s});throw{...e,requestID:t}}).catch(e=>(n.setCode(e.code).setMoreMessage(e.requestID).end(),Ce.w(o+" failed. error:",e),Qs({code:js.TRANSLATE_TEXT_FAIL})))}convertVoiceToText(e){var{message:e,language:t}=e;let s=e.payload.url;e.from===this.getMyUserID()&&"out"===e.flow&&(s=e.payload.remoteAudioUrl);e=/\.(wav|pcm|ogg-opus|speex|silk|mp3|m4a|aac|amr)/;if(!e.test(s))return Qs({code:js.UNSUPPORTED_VOICE_FORMAT});e=e.exec(s)[1]||"mp3";let i="16k_zh-PY";t?"zh (cmn-Hans-CN)"===t?i="16k_zh":"en-US"===t?i="16k_en":"yue-Hant-HK"===t?i="16k_yue":"ja-JP"===t&&(i="16k_ja"):i="16k_zh-PY";const o=`serviceType:${i} url:`+s,n=this._n+".convertVoiceToText",r=(Ce.i(n+" "+o),new mi("convertVoiceToText"));return r.setMessage(o),this.req({P:ti.VOICE_TO_TEXT,data:{url:s,language:i,SDKAppID:this.getSDKAppID(),format:e}}).then(e=>{var{error:e,requestID:t,result:s}=e.data,i=e["code"];if(0===i)return r.end(),Ce.i(n+" ok. requestID:"+t),Ys({result:s});throw{...e,requestID:t}}).catch(e=>(r.setCode(e.code).setMoreMessage(e.requestID||"").end(),Ce.w(n+" failed. error:",e),Qs({code:js.VOICE_TO_TEXT_FAIL})))}modifyRemoteMessage(s){let e=null;var{conversationType:i,to:o}=s,n=this.get(Is);if(!n)return this._onNoModule();if(n.isMessageFromOrToAVChatroom(o))return Qs({code:js.MSG_MODIFY_DISABLED_IN_AV,data:{message:s}});if(!1===this.get(bs).filterMessage(s))return s.hasRiskContent=!0,Qs({code:js.PROFANITY_FOUND,data:{message:s}});i===t.CONV_C2C?e=this.get(Ms):i===t.CONV_GROUP&&(e=this.get(Is));const r=new mi("modifyMessage"),a=(r.setMessage("to:"+o),this._n+".modifyRemoteMessage");return e.modifyRemoteMessage(s).then(e=>{r.end(),Ce.i(a+" ok");e=this._onModifyRemoteMessageResp(s,e.data);return Ys({message:e})}).catch(e=>{var t;return r.setCode(e.code).setMoreMessage(e.message).end(),Ce.w(a+" failed. error:",e),20027===e.code?(t=this._onModifyRemoteMessageResp(s,e.data),Qs({code:js.MSG_MODIFY_CONFLICT,data:{message:t}})):Qs({code:e.code,message:e.message,data:{message:s}})})}_generateSearchdata(e){const{conversationID:s,timePosition:i,timePeriod:o,...n}=e;return $e(s)||(rt(s)&&(n.account=s.replace(t.CONV_C2C,"")),at(s)&&(n.groupID=s.replace(t.CONV_GROUP,""))),Ge(o)&&0{var{code:s,message:i}=t.data;if(0!==s){let e=s;60020===s&&(e="SearchCloudMessagesUnavailable");const t=this.getErrMsg(e)||i,n=new zs({code:s,message:t});return d.setMessage(_).setError(n).end(),Qs(n)}this.get(ws).isSearchCloudMessagesEnabled();var{cursor:i,totalCount:s,searchResult:t}=t.data,e=`totalCount:${s} cost:`+Et(l),e=(Ce.l(n+` ok. cursor:${i} `+e),d.setMessage(_+" "+e).end(),this._handleSearchResults(t,!o.conversationID));return Ys({searchResultList:e,cursor:i,totalCount:s})}).catch(e=>(d.setMessage(_).setError(e).end(),Qs(e)))}_handleSearchResults(e,r){const a=this.get(ys);return be(e)&&0!==e.length?e.map(({groupID:e,userID:s,messageCount:i,messageList:o=[]})=>{var s=e?""+t.CONV_GROUP+e:""+t.CONV_C2C+s,n={conversationID:s,messageCount:i,messageList:[]};if(!(r&&1!!e);if(0{const{extensions:t=[],clearSequence:s}=e;1===i?(u=!0,t.forEach(e=>{d.push({key:e.key,value:e.value})}),this._updateLocalExt(l,t)):2===i?(h=!0,t.forEach(e=>{_.push(e.key)}),this._updateLocalExt(l,t)):3===i&&(h=!0,this._hasLocalExt(l)&&this._getLocalExt(l).forEach((e,t)=>{e.seq<=s&&!Oe(e.value)&&_.push(t)}),this._clearLocalExt(l,s))}),u&&this.emitOEvt(e.MESSAGE_EXTENSIONS_UPDATED,{messageID:l,extensions:d}),h&&this.emitOEvt(e.MESSAGE_EXTENSIONS_DELETED,{messageID:l,keyList:_})}setMessageExtensions(e,t){var s="setMessageExtensions";if(!this.canIUse(M.MSG_EXT))return this.noUse(s);const i=this._n+"."+s,{ID:o,conversationID:n,sequence:r,time:a}=e;let c=[...t];20{var{resultList:e,successCount:t,failureCount:s}=e,t=`successCount:${t} failCount:`+s;return d.setMoreMessage(t).end(),Ce.l(i+" ok. "+t),Ys({extensions:e})}).catch(e=>(d.setError(e).end(),Ce.e(i+" failed. error:",e),Qs(e)))}getMessageExtensions(e){var t="getMessageExtensions";if(!this.canIUse(M.MSG_EXT))return this.noUse(t);const s=this._n+"."+t,{ID:i,conversationID:o,sequence:n,time:r}=e,a=`convID:${o} messageID:${i} sequence:${n} time:`+r,c=new mi(t);c.setMessage(a),Ce.l(s+" "+a);let l=void 0;return this.getMsgExtsMap.has(i)&&(l=this._getGlobalSeq(i)),this._getMsgExts(e,l).then(e=>(c.end(),Ce.l(s+" ok. extCount:"+e.length),$e(l)&&0(c.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}deleteMessageExtensions(e,t){var s="deleteMessageExtensions";if(!this.canIUse(M.MSG_EXT))return this.noUse(s);const o=this._n+"."+s,i=[];let n=3;Oe(t)||(n=2,t.forEach(e=>{i.push({key:e,value:"",seq:0})}));const{ID:r,conversationID:a,sequence:c,time:l}=e,d=`convID:${a} messageID:${r} sequence:${c} time:${l} operateType:`+n,_=new mi(s);return _.setMessage(d),Ce.l(o+" "+d),this._modifyMsgExts(e,i,n).then(e=>{var{resultList:e,successCount:t,failureCount:s}=e;let i="";return 2===n&&(i=`success count:${t} fail count:`+s),_.setMoreMessage(""+i).end(),Ce.l(o+" ok. "+i),Ys({extensions:e})}).catch(e=>(_.setError(e).end(),Ce.e(o+" failed. error:",e),Qs(e)))}_modifyMsgExts(s,e,i=1){var o=ot(s.to)?t.CONV_TOPIC:s.conversationType;let n=void 0,r=(3!==i&&(n=this._getReqExts(s,e)),null);switch(o){case t.CONV_C2C:r=this.get(Ms);break;case t.CONV_GROUP:r=this.get(Is);break;case t.CONV_TOPIC:r=this.get(Ts);break;default:return Qs({code:js.NO_MODULE})}return r.modifyMsgExts(s,n,i).then(e=>{var{extensions:e,seq:t}=e.data;const o=[];let n=0,r=0,a=[];return(e=Oe(e)?[]:e).forEach(e=>{var{errorCode:e,extension:t}=e,{key:t,value:s,seq:i}=t;o.push({code:e,key:t,value:s}),0===e?n++:r++,a.push({key:t,value:s,seq:i})}),this._updateGlobalSeq(s.ID,t),0Qs(e))}_getReqExts(e,t){const i=[];if(this._hasLocalExt(e.ID)){const o=this._getLocalExt(e.ID);t.forEach(e=>{var{key:e,value:t}=e;let s=0;o.has(e)&&(s=o.get(e).seq),i.push({key:e,value:t,seq:s})})}else t.forEach(e=>{var{key:e,value:t}=e;i.push({key:e,value:t,seq:0})});return i}_getMsgExts(o,e){const n=this._n+"._getMsgExts",{ID:r,to:s}=o;let i=null;switch(ot(s)?t.CONV_TOPIC:o.conversationType){case t.CONV_C2C:i=this.get(Ms);break;case t.CONV_GROUP:i=this.get(Is);break;case t.CONV_TOPIC:i=this.get(Ts);break;default:return Qs({code:js.NO_MODULE})}return i.getMessageExtensions(o,e).then(e=>{var{extensions:t,completeFlag:e,globalSequence:s,clearSequence:i}=e.data,t=Oe(t)?[]:t;if(Ce.l(n+` ok. completeFlag:${e} globalSequence:${s} clearSequence:${i} count:`+t.length),this._updateLocalExt(r,t),this._clearLocalExt(r,i),this._updateGlobalSeq(r,s),1===e)return this._getLocalExtList(r);{const e=t.slice(-1)[0].seq+1;return this._getMsgExts(o,e)}}).catch(e=>Qs(e))}_hasLocalExt(e){return this.msgExtMap.has(e)}_getLocalExt(e){return this.msgExtMap.get(e)}_updateLocalExt(e,t){this._hasLocalExt(e)||this.msgExtMap.set(e,new Map);const i=this._getLocalExt(e);t.forEach(e=>{var{key:e,value:t="",seq:s}=e;i.set(e,{value:t,seq:s})})}_clearLocalExt(e,s){if(!(s<=0)&&this._hasLocalExt(e)){const i=this._getLocalExt(e);i.forEach((e,t)=>{e.seq<=s&&i.delete(t)})}}_getLocalExtList(e){const s=[];return this._hasLocalExt(e)&&this._getLocalExt(e).forEach((e,t)=>{e=e.value;Oe(e)||s.push({key:t,value:e})}),s}_getGlobalSeq(e){return this.globalSeqMap.get(e)}_updateGlobalSeq(e,t){this.globalSeqMap.set(e,t)}reset(){Ce.l(this._n+".reset"),this.msgExtMap.clear(),this.globalSeqMap.clear(),this.getMsgExtsMap.clear()}}class xn extends ei{constructor(e){super(e),this._n="MsgReactionModule",this._reactedByMyselfMap=new Map,this._reactionInfoMap=new Map}onReactionNotifyList(t){var{dataList:t=[]}=t||{};t.forEach(t=>{const{C2CMessageInfo:s={},groupMessageInfo:i={},reactionList:o=[]}=t,{tinyID:n,clientTime:r,random:a}={...s,...i},c=n+`-${r}-`+a,l=[];o.forEach(e=>{$e(e.userIDList)&&(e.userIDList=[],e.count=0),l.push(...e.userIDList)}),Ce.l(this._n+`.onReactionNotifyList messageID:${c} reactionList:`+o.length),this._handleReactionSummary([{messageID:c,reactionList:o}],l).then(t=>{this.emitOEvt(e.MESSAGE_REACTIONS_UPDATED,{...t[0]})})})}onReactionNotify(t){var{C2CMessageInfo:t={},groupMessageInfo:s={},reactionID:i,operateType:o}=t.dataList||{},{tinyID:t,clientTime:s,random:n}={...t,...s},s=t+`-${s}-`+n,n=(Ce.l(this._n+`.onReactionNotify messageID:${s} reactionID:${i} operateType:`+o),1===o?this._addReactedByMyselfMap(s,i):this._removeReactedByMyselfMap(s,i),s+"-"+i);if(this._reactionInfoMap.has(n)){const t=this._reactionInfoMap.get(n);t.reactedByMyself=1===o,this.emitOEvt(e.MESSAGE_REACTIONS_UPDATED,{messageID:s,reactionList:[t]})}}addMessageReaction(t,s){var e="addMessageReaction";if(!this.canIUse(M.MSG_REACTION))return this.noUse(e);const i=this._n+"."+e,{ID:o,conversationID:n}=t,r=`convID:${n} messageID:${o} reactionID:`+s,a=new mi(e);a.setMessage(r),Ce.l(i+" "+r);e=this._createReactionOperationPack(t,s,1);return this._addReactedByMyselfMap(t.ID,s),this.req(e).then(()=>(a.end(),Ce.l(i+" ok."),Ys())).catch(e=>(this._removeReactedByMyselfMap(t.ID,s),a.setError(e).end(),Ce.e(i+" failed. error:",e),Qs(e)))}removeMessageReaction(e,t){var s="removeMessageReaction";if(!this.canIUse(M.MSG_REACTION))return this.noUse(s);const i=this._n+"."+s,{ID:o,conversationID:n}=e,r=`convID:${n} messageID:${o} reactionID:`+t,a=new mi(s);a.setMessage(r),Ce.l(i+" "+r);s=this._createReactionOperationPack(e,t,2);return this._removeReactedByMyselfMap(e.ID,t),this.req(s).then(()=>(a.end(),Ce.l(i+" ok."),Ys())).catch(e=>(a.setError(e).end(),Ce.e(i+" failed. error:",e),Qs(e)))}getMessageReactions(e){var t="getMessageReactions";if(!this.canIUse(M.MSG_REACTION))return this.noUse(t);const s=this._n+"."+t,{messageList:i,maxUserCountPerReaction:o}=e,n=i[0]["conversationID"],r=`convID:${n} maxUserCountPerReaction:${o} msgCount:`+i.length,a=new mi(t),c=(a.setMessage(r),Ce.l(s+" "+r),new Map),l=this._createReactionSummaryPack({...e,messageIDMap:c});return this.req(l).then(e=>{const{resultList:t=[]}=e.data,i=[],o=[];return t.forEach(e=>{var{messageKey:e,messageSequence:t,reactionList:s=[]}=e,t=$e(e)?c.get(t):c.get(e);i.push({messageID:t,reactionList:s}),s.forEach(e=>{o.push(...e.userIDList)})}),this._handleReactionSummary(i,o)}).then(e=>(a.end(),Ce.l(s+" ok."),c.clear(),Ys({resultList:e}))).catch(e=>(a.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}getAllUserListOfMessageReaction(e){var t="getAllUserListOfMessageReaction";if(!this.canIUse(M.MSG_REACTION))return this.noUse(t);const s=this._n+"."+t,{message:i,reactionID:o,nextSeq:n,count:r}=e,{ID:a,conversationID:c}=i,l=`convID:${c} messageID:${a} reactionID:${o} nextSeq:${n} count:`+r,d=new mi(t),_=(d.setMessage(l),Ce.l(s+" "+l),{userList:[],nextSeq:0,isCompleted:!1}),u=this._createReactionUserListPack(e);return this.req(u).then(e=>{var{userIDList:e=[],nextSeq:t=0}=e.data;return _.nextSeq=t,_.isCompleted=0===t,this.get(fs).getUserNickAndAvatar(e)}).then(e=>(_.userList=e,d.end(),Ce.l(s+" ok."),Ys(_))).catch(e=>(d.setError(e).end(),Ce.e(s+" failed. error:",e),Qs(e)))}_createReactionOperationPack(s,i,o){let n=void 0;i={reactionID:i,userIDList:[this.getMyUserID()]};if(s.conversationType===t.CONV_C2C){const t=this.get(Ms);n=1===o?ti.ADD_C2C_MSG_REACTION:ti.RM_C2C_MSG_REACTION,i.from=s.from,i.to=s.to,i.messageKey=t.getMessageKey(s)}if(s.conversationType===t.CONV_GROUP){let e=void 0,t=s.to;ot(s.to)&&(e=s.to,t=Ct(e)),n=1===o?ti.ADD_GRP_MSG_REACTION:ti.RM_GRP_MSG_REACTION,i.groupID=t,i.topicID=e,i.messageSequence=s.sequence}return{P:n,data:i}}_createReactionSummaryPack(s){const{messageList:i,maxUserCountPerReaction:o=10,messageIDMap:n}=s,r=i[0];let a=void 0,c=void 0;if(r.conversationType===t.CONV_C2C){const s=this.get(Ms),t=i.map(e=>{var t=s.getMessageKey(e);return n.set(t,e.ID),t});a=ti.GET_C2C_MSG_REACTIONS,c={from:r.from,to:r.to,messageKeyList:t,count:o}}if(r.conversationType===t.CONV_GROUP){let e=void 0,t=r.to;ot(r.to)&&(e=r.to,t=Ct(e));s=i.map(e=>(n.set(e.sequence,e.ID),e.sequence));a=ti.GET_GRP_MSG_REACTIONS,c={groupID:t,topicID:e,messageSequenceList:s,count:o}}return{P:a,data:c}}_createReactionUserListPack(e){var{message:s,reactionID:e,nextSeq:i=0,count:o=100}=e;let n=void 0;i={reactionID:e,nextSeq:i,count:100{const e=[];return t.forEach(r=>{const a=[];r.reactionList.forEach(e=>{const{reactionID:t,count:s,userIDList:i,reactedByMyself:o}=e,n=[];i.forEach(t=>{c.forEach(e=>{t===e.userID&&n.push(e)})});e={reactionID:t,totalUserCount:s,partialUserList:n,reactedByMyself:this._computeReactedByMyself({reactedByMyself:o,messageID:r.messageID,reactionID:t})};if(a.push(e),$e(o)&&!this._reactedByMyselfMap.has(r.messageID)){const c=r.messageID+"-"+t;this._reactionInfoMap.set(c,e)}}),e.push({messageID:r.messageID,reactionList:a})}),e})}_addReactedByMyselfMap(e,t){this._reactedByMyselfMap.has(e)||this._reactedByMyselfMap.set(e,[]);e=this._reactedByMyselfMap.get(e);-1===e.indexOf(t)&&e.push(t)}_removeReactedByMyselfMap(e,t){this._reactedByMyselfMap.has(e)&&-1<(t=(e=this._reactedByMyselfMap.get(e)).indexOf(t))&&e.splice(t,1)}_computeReactedByMyself({reactedByMyself:e,messageID:t,reactionID:s}){return $e(e)?!!this._reactedByMyselfMap.has(t)&&this._reactedByMyselfMap.get(t).includes(s):1===e}reset(){Ce.l(this._n+".reset"),this._reactedByMyselfMap.clear(),this._reactionInfoMap.clear()}}class Vn extends ei{constructor(e){super(e),this._n="ComboMsgModule"}sendMessage(e){const n=this._createMsg(e);if(null===n)return Qs({code:js.MSG_SEND_FAIL});this._addSendMessageTotalCount(n);const r=Date.now();return this.get(ys).setMessageRandom(n),this._sendComboMessage(n,e).then(e=>{var{time:e,sequence:s,readReceiptCode:i}=e.data,i=(Ge(i)&&0!==i&&(new mi("sendMessageWithReceipt").setMessage(`from:${n.from} to:${n.to} sequence:${s} readReceiptCode:`+i).end(),Ce.w(this._n+`.sendMessage readReceiptCode:${i} message:`+this.getErrMsg(i))),this._addSendMessageSuccessCount(n,r),this.get(ys));n.status=Ot,n.time=e,n.conversationType===t.CONV_GROUP&&(n.sequence=s),i.appendToMessageList(n);let o=n;return!0===n._isExcludedFromLastMessage&&(o=""),i.onMessageSent({conversationOptionsList:[{conversationID:n.conversationID,unreadCount:0,type:n.conversationType,subType:n.conversationSubType,lastMessage:o}]}),Ys({message:n})}).catch(e=>this._onSendMessageFailed(n,e))}_sendComboMessage(e,s){var i=this._m.get(Os);let o="";return e.conversationType===t.CONV_C2C&&(o=f.NAME.OPEN_IM+"."+ti.SEND_C2C_MSG),e.conversationType===t.CONV_GROUP&&(o=f.NAME.GRP+"."+ti.SEND_GRP_MSG),i.sendComboMessage({servcmd:o,data:s})}_createMsg(s){var i=this._n+"._createMsg";let o=null;try{var e=this.getMyUserID(),n={};if(n.senderTinyID=this.getMyTinyID(),n.currentUser=e,n.from=s.From_Account||e,s.GroupId?(n.conversationID=""+t.CONV_GROUP+s.GroupId,n.conversationType=t.CONV_GROUP,n.to=s.GroupId):s.To_Account&&(n.conversationID=""+t.CONV_C2C+s.To_Account,n.conversationType=t.CONV_C2C,n.to=s.To_Account),n.time=s.MsgTimeStamp||0,n.random=s.Random||s.MsgRandom||0,n.priority=s.MsgPriority,ke(s.CloudCustomData)&&0{this.plugins[e]=t[e],"tim-upload-plugin"===e&&"function"==typeof t[e].getVersion&&(s=t[e].getVersion())}),new mi("registerPlugin").setMessage(""+Object.keys(t)).setMoreMessage("version:"+s).end()}getPlugin(e){return this.plugins[e]}reset(){}}class Kn extends ei{constructor(e){super(e),this._n="SyncUnreadMsgModule",this._cookie="",this._onlineSyncFlag=!1,this.getIEmitInst().on(Vi.A2KEY_AND_TINYID_UPDATED,this._init,this)}_init(){this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}_startSync(e){const{cookie:t,syncFlag:s,isOnlineSync:i}=e,o=this._n+"._startSync",n=(Ce.l(o+" options:",e),new mi("syncUnread"));n.setMessage(JSON.stringify(e)),this.req({P:ti.SYNC_UNREAD_MSG,data:{cookie:t,syncFlag:s,isOnlineSync:i}}).then(e=>{var{cookie:t,syncFlag:s}=e.data,i=`$cookie:${t} syncFlag:`+s;Ce.l(o+" ok. "+i),this._cookie=t,n.setMoreMessage(i).end(),Oe(t)||(0===s||1===s?(this._dispatch({...e.data,isSyncingEnded:!1}),this._startSync({cookie:t,syncFlag:s,isOnlineSync:0})):2===s&&this._dispatch({...e.data,isSyncingEnded:!0}))}).catch(e=>{n.setError(e).end(),Ce.e(o+" failed. error:",e)})}_dispatch(e){e.eventArray&&this.get(Os).onMessage({head:{},body:{eventArray:e.eventArray,isInstantMessage:this._onlineSyncFlag,isSyncingEnded:e.isSyncingEnded}}),this.get(Ms).onNewMessage({dataList:e.messageList,isInstantMessage:!!e.isSyncingEnded&&this._onlineSyncFlag,C2CRemainingUnreadList:e.C2CRemainingUnreadList,C2CPairUnreadList:e.C2CPairUnreadList,isSyncingEnded:e.isSyncingEnded})}syncOnNeed(){Ce.l(this._n+".syncOnNeed cookie:"+this._cookie),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:1})}syncOnReconnected(){Ce.l(this._n+".syncOnReconnected cookie:"+this._cookie),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}reset(){Ce.l(this._n+".reset"),this._onlineSyncFlag=!1,this._cookie=""}}const Hn={req:{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",isRelayMessage:"IsRelayMsg",reactionID:"Reaction",messageSequenceList:"MsgSeqList",messageKeyList:"MsgKeyList",cmConfigID:"CustomModerationConfigID"},res:{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",IsPlaceMsg:"isPlaceMessage",MsgCheckResult:"checkResult",Results:"resultList",Reaction:"reactionID",Reaction_Account:"userIDList",MsgReactionNotifyList:"messageReactionNotifyList",MsgReactionNotify:"messageReactionNotify",MsgReactionSummary:"reactionList",C2CMsgInfo:"C2CMessageInfo",GroupMsgInfo:"groupMessageInfo",int32_err_code:"errorCode",str_err_msg:"errorMsg",MsgDropReason:"messageDropReason",ReactedByMe:"reactedByMyself",Level:"messageRemindType",PeerReadTime:"timestamp",NoUnreadSeqList:"excludedUnreadSequenceList",NewMsg:"topicLatestMessage"},ignoreKeyWord:["C2C","ID","USP"]};function Wn(e,t){if("string"==typeof e||Array.isArray(e))return t=Object.assign({pascalCase:!1},t),0===(e=Array.isArray(e)?e.map(e=>e.trim()).filter(e=>e.length).join("-"):e.trim()).length?"":1===e.length?t.pascalCase?e.toUpperCase():e.toLowerCase():(e=e=(e=e!==e.toLowerCase()?Yn(e):e).replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(e,t)=>t.toUpperCase()).replace(/\d+(\w|$)/g,e=>e.toUpperCase()),t.pascalCase?e.charAt(0).toUpperCase()+e.slice(1):e);throw new TypeError("Expected the input to be `string | string[]`")}const Yn=t=>{let s=!1,i=!1,o=!1;for(let e=0;ewe(e)?s(e,o):e),i--,t):we(e)?(t=lt(t=function(s){const i=Object.create(null);return Object.keys(s).forEach(e=>{var t=(t=>{if(!He(t))return!1;if(t!==Wn(t))for(let e=0;ebe(e)||we(e)?s(e,o):e),i--,t):void 0}(e,t)}function jn(e,o){return be(e)?e.map(e=>we(e)?jn(e,o):e):we(e)?lt(function(s){const i={};return Object.keys(s).forEach(e=>{var t;i[s[e],t=e,$e(o[t])?Wn(t):o[t]]=s[e]}),i}(e),e=>be(e)||we(e)?jn(e,o):e):void 0}const Jn=String.fromCharCode,Xn=function(e){let t=0|e.charCodeAt(0);if(55296<=t)if(t<56320){e=0|e.charCodeAt(1);if(56320<=e&&e<=57343){if(65535<(t=(t<<10)+e-56613888|0))return Jn(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?Jn(192|t>>>6,128|63&t):Jn(224|t>>>12,128|t>>>6&63,128|63&t)},Zn=function(e){var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,Xn),s=0|t.length,i=new Uint8Array(s);let o=0;for(;o{}}),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))):(this._socket=new WebSocket(t),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=e.canIUseBinaryFrame()}getID(){return this._id}_onOpen(e){this._handler.onOpen({id:this._id,res:JSON.stringify(e)})}_onClose(e){this._handler.onClose({id:this._id,e:e})}_onMessage(e){e=this._canIUseBinaryFrame?this._isAppCompressedData(e.data)?this._handler.inflate(e.data):function(e){var o=new Uint8Array(e);let n="",r=0;for(var a=o.length;r{}),this._socket.onOpen(()=>{}),this._socket.onMessage(()=>{}),this._socket.onError(()=>{})):(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null),A?this._socket.close({code:e}):this._socket.close(e),this._socket=null)}send(e){this._workerSocket?this._workerSocket.postMessage({cmd:"sendMessage",data:this._canIUseBinaryFrame?Zn(e.data).buffer:e.data}):O?$.sendSocketMessage({data:e.data,fail:()=>{e.fail&&e.requestID&&e.fail(e.requestID)}}):this._socket&&(k?this._socket.send({data:this._canIUseBinaryFrame?Zn(e.data).buffer:e.data,fail:()=>{e.fail&&e.requestID&&e.fail(e.requestID)}}):this._socket.send(this._canIUseBinaryFrame?Zn(e.data):e.data))}}const eo=4e3,to=4001,so="connected",io="connecting",no="disconnected";class oo{constructor(e){this._chM=e,this._n="SocketHandler",this._promiseMap=new Map,this._readyState=no,this._simpleRequestMap=new Map,this.MAX_SIZE=100,this._startSequence=je(),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._currentSite=c,this._setWebsocketHost(),this._initConnection()}_setWebsocketHost(){var e=this._chM.get(vs);this._currentSite=c,this._chM.isOversea()&&(this._currentSite=l),e.isSingaporeSite()?this._currentSite=u:e.isKoreaSite()?this._currentSite=d:e.isGermanySite()?this._currentSite=_:e.isIndiaSite()?this._currentSite=h:e.isJapanSite()?this._currentSite=p:e.isUSASite()?this._currentSite=g:e.isIndonesiaSite()&&(this._currentSite=m),f.HOST.setCurrent(this._currentSite)}_initConnection(){var e=this._chM.get(vs).getSDKAppID()+"",e=($e(f.HOST.CURRENT.BACKUP)?this._url=f.HOST.CURRENT.DEFAULT:""===this._url?this._url=f.HOST.CURRENT.DEFAULT0.replace("*",e):-1{var{reject:e,timestamp:s,headSeq:i}=e;let o=15e3;-1!==t.indexOf(ti.LOGIN)?o=9e4:-1!==t.indexOf(ti.PING)&&(o=3e3),Date.now()-s>=o&&(Ce.l(this._n+"._checkPromiseMap request timeout, delete requestID:"+t),this._promiseMap.delete(t),e(new zs({code:js.NETWORK_TIMEOUT,data:{headSeq:i}})),this._chM.onRequestTimeout())})}_checkNativeAppWS(){P&&!this.isConnected()&&this._reConnect()}onOpen(e){var t,s;this._readyState!==no&&(this._onOpenTs=Date.now(),{id:e,res:t}=e,this._socketID=e,s=Et(this._startTs,!1),e=`socketID:${e} res:`+t,Ce.l(this._n+`._onOpen cost:${s} ms. `+e),new mi("wsOnOpen").setMessage(s).setCostTime(s).setMoreMessage(e).end(),this._readyState=so,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._chM.onReconnected(),this._reConnectFlag=!1),this._chM.onOpen())}onClose(e){var t=new mi("wsOnClose"),{id:e,e:s}=e,i=`sourceSocketID:${e} currentSocketID:${this._socketID} code:${s.code} reason:`+s.reason;let o=0;0!==this._onOpenTs&&(o=Date.now()-this._onOpenTs),t.setMessage(o).setCostTime(o).setMoreMessage(i).setCode(s.code).end(!0),Ce.l(this._n+`._onClose ${i} onlineTime:`+o),e===this._socketID&&(this._readyState=no,o<1e3?this._chM.onReconnectFailed():this._chM.onClose())}onError(e){var{id:e,e:t}=e,s=`sourceSocketID:${e} currentSocketID:`+this._socketID;new mi("wsOnError").setMessage(t.errMsg||JSON.stringify(t,["message","code"])).setMoreMessage(s).setLevel("error").end(!0),Ce.w(this._n+"._onError",t,s),e===this._socketID&&(this._readyState=no,this._chM.onError())}onMessage(t){let s;try{s=JSON.parse(t.data)}catch(e){new mi("jsonParseError").setMessage(t.data).end()}if(s&&s.head){var i=this._getRequestIDFromHead(s.head);let e=s.body;if(!this._chM.get($s).isTRTCCommand(i)){const t=mt(s.head);e=jn(s.body,this._getResKeyMap(t))}if(Ce.d(`${this._n}.onMessage ret:${JSON.stringify(e)} requestID:${i} has:`+this._promiseMap.has(i)),this._setNextPingTs(),this._promiseMap.has(i)){const{resolve:t,reject:s,timestamp:o,headSeq:n}=this._promiseMap.get(i);this._promiseMap.delete(i),this._calcRTT(o),void(e.errorCode&&0!==e.errorCode?(this._chM.onErrorCodeNotZero(e),s(new zs({code:e.errorCode,message:e.errorInfo||"",data:i.includes(ti.MODIFY_C2C_MSG)||i.includes(ti.MODIFY_GRP_MSG)?{elements:e.elements,messageVersion:e.messageVersion,cloudCustomData:e.cloudCustomData,headSeq:n}:{headSeq:n}}))):t(Ys(e)))}else this._chM.onMessage({head:s.head,body:e})}}_calcRTT(e){e=Date.now()-e;this._chM.get(ks).addRTT(e)}_connect(){this._readyState!==io&&this._readyState!==so&&(this._startTs=Date.now(),this._onOpenTs=0,this._readyState=io,this._socket=new Qn(this),this._socketID=this._socket.getID(),Ce.l(`${this._n}._connect isWorkerEnabled:${this.getIsWorkerEnabled()} socketID:${this._socketID} url:`+this.getURL()),new mi("wsConnect").setMessage(`socketID:${this._socketID} url:`+this.getURL()).end())}getURL(){this._chM.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=_t();(O||E&&"windows"===e||P)&&(this._canIUseBinaryFrame=!1);let t=-1;"ios"===e?t=Y||-1:"android"===e&&(t=j||-1);var s=this._chM.get(vs),i=this._chM.getPlatform();let o=`sdkappid=${s.getSDKAppID()}&instanceid=${s.getInstanceID()}&random=${this._getRandom()}&platform=${i}&host=${e}&version=${t}&sdkversion=3.4.7`;return D&&(o+="&isminigame=1"),this._chM.canIUseInflate()&&(o+="&compress=gzip"),this._canIUseBinaryFrame?this._url+"/binfo?"+o:this._url+"/info?"+o}_closeConnection(e){Ce.l(this._n+"._closeConnection socketID:"+this._socketID),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=no)}_resend(){if(Ce.l(this._n+"._resend reConnectFlag:"+this._reConnectFlag,`promiseMap.size:${this._promiseMap.size} simpleRequestMap.size:`+this._simpleRequestMap.size),0{var{uplinkData:e,resolve:s,reject:i}=e;-1!==t.indexOf(ti.AV_POLLING)?this._promiseMap.delete(t):(this._promiseMap.set(t,{resolve:s,reject:i,timestamp:Date.now(),uplinkData:e}),this._execute(t,e))}),0{this._promiseMap.set(o,{resolve:e,reject:t,timestamp:Date.now(),uplinkData:n,headSeq:s.head.seq}),Ce.d(`${this._n}.send uplinkData:${JSON.stringify(i)} requestID:${o} readyState:`+this._readyState),this._readyState!==so?this._reConnect():(this._execute(o,n),this._chM.get(ks).addRequestCount())})}simplySend(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3);const{keyMap:t,...s}=e,i=this._getRequestIDFromHead(e.head),o=JSON.stringify(s);this._readyState!==so?(this._simpleRequestMap.size{var s="application/x-www-form-urlencoded;charset=UTF-8";if(k)$.request({url:r,data:a,method:n,timeout:3e3,header:{"content-type":s},success:e=>{e&&e.data&&e.data.NetCheckInfo&&Ce.l("getconninfo ok in miniapp. ret:",e.data),t()},fail:()=>{e(new zs({code:js.NETWORK_ERROR}))}});else{const i=new XMLHttpRequest,o=setTimeout(()=>{i.abort(),e(new zs({code:js.NETWORK_TIMEOUT}))},3e3);i.onreadystatechange=function(){4===i.readyState&&(clearTimeout(o),200===i.status||304===i.status?(i.responseText&&-1{this._probing=!1}).catch(e=>{this._probing=!1;var s=this.get(Ds).isOnline();Ce.w(this._n+`._ping failed. bOnline:${s} error:`,e),e&&60002===e.code?(new mi("error").setMessage(`code:${e.code} message:`+e.message).end(),this._fatalErrorFlag=!0,this._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED)):s?this.reConnect():this._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED)}))}_checkNextPing(){this._socketHandler&&this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping()}dealloc(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),-1{Ce.w(this._n+"._diagnoseBySSO failed. error:",e)}))}_diagnoseByCDN(){var e=this._socketHandler.getURL(),e=`https://boce-cdn.my-imcloud.com/v3/netcheck/getconninfo?${e.slice(e.indexOf("info?")+5)}&reqtime=`+Date.now();ro("GET",e).catch(e=>{Ce.w(this._n+"._diagnoseByCDN failed. error:",e)})}reset(){Ce.l(this._n+".reset"),this._previousState=t.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3),this._disconnectedTS=0,this._lastDiagnoseTS=0}}class co{constructor(e){this._n="PHandler",this._sessionM=e,this._map=new Map,this._fillMap()}_fillMap(){this._map.clear();var i=this._sessionM.genCommonHead(),e=this._sessionM.genCosSpecifiedHead(),t=this._sessionM.genSSOReportHead();this._map.set(ti.LOGIN,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ti.LOGIN},body:{state:"Online",isWebUniapp:0,deviceBrand:0,customInfo:""},keyMap:{req:{deviceBrand:"InstType"},res:{InstId:"instanceID",HelloInterval:"helloInterval",RichMsgAuthKey:"authKey"}}}),this._map.set(ti.LOGOUT,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ti.LOGOUT},body:{type:0,isWebUniapp:0},keyMap:{req:{type:"wslogout_type"}}}),this._map.set(ti.HELLO,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ti.HELLO},body:{isWebUniapp:0},keyMap:{res:{NewInstInfo:"newInstanceInfo"}}}),this._map.set(ti.KICK_OTHER,{head:{...i,servcmd:f.NAME.STAT_SERVICE+"."+ti.KICK_OTHER},body:{}}),this._map.set(ti.COS_SIGN,{head:{...e,servcmd:f.NAME.IM_COS_SIGN+"."+ti.COS_SIGN},body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{req:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},res:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}),this._map.set(ti.COS_PRE_SIG,{head:{...e,servcmd:f.NAME.CUSTOM_UPLOAD+"."+ti.COS_PRE_SIG},body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{req:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},res:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}),this._map.set(ti.SIMPLE_COS_PRE_SIG,{head:{...e,servcmd:f.NAME.CUSTOM_UPLOAD+"."+ti.SIMPLE_COS_PRE_SIG},body:{uploadMethod:0,platform:2,SDKAppID:0,userID:"",conversationType:1,uploadConfig:[{fileID:1,fileType:1,fileName:""}]},keyMap:{req:{platform:"uint32_platform",SDKAppID:"uint32_sdkappid",userID:"str_user_id",uploadMethod:"uint32_upload_method",conversationType:"uint32_scene",uploadConfig:"rpt_upload_object",fileID:"uint32_file_id",fileType:"uint32_file_type",fileName:"str_file_name"},res:{str_final_ip:"uploadIP",rpt_pre_sig:"preSig",uint32_file_id:"fileID",uint32_exist_flag:"existFlag",str_download_url:"downloadUrl",str_upload_url:"uploadUrl",str_snapshot_url:"requestSnapshotUrl",str_file_key:"fileKey"}}}),this._map.set(ti.GET_IMAGE_INFO,{head:{...e,servcmd:f.NAME.CUSTOM_UPLOAD+"."+ti.GET_IMAGE_INFO},body:{imageUrl:""},keyMap:{req:{imageUrl:"str_image_url"},res:{rpt_msg_image_info:"imageInfoArray",uint32_image_type:"type",str_url:"url",uint32_width:"width",uint32_height:"height",str_image_format:"imageFormat"}}}),this._map.set(ti.GET_IP,{head:{...e,servcmd:f.NAME.CUSTOM_UPLOAD+"."+ti.GET_IP},body:{domainName:""},keyMap:{req:{domainName:"str_domain"},res:{str_final_ip:"ip"}}}),this._map.set(ti.VIDEO_COVER,{head:{...e,servcmd:f.NAME.CUSTOM_UPLOAD+"."+ti.VIDEO_COVER},body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{req:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},res:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}),this._map.set(ti.FETCH_COMMERCIAL_CONFIG,{head:{...i,servcmd:f.NAME.IM_CONFIG_MANAGER+"."+ti.FETCH_COMMERCIAL_CONFIG},body:{SDKAppID:0},keyMap:{req:{SDKAppID:"uint32_sdkappid"},res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}),this._map.set(ti.PUSHED_COMMERCIAL_CONFIG,{head:{...i,servcmd:f.NAME.IM_CONFIG_MANAGER+"."+ti.PUSHED_COMMERCIAL_CONFIG},body:{},keyMap:{res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}),this._map.set(ti.FETCH_CLOUD_CTRL_CONFIG,{head:{...i,servcmd:f.NAME.IM_CONFIG_MANAGER+"."+ti.FETCH_CLOUD_CTRL_CONFIG},body:{SDKAppID:0,version:0},keyMap:{req:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}),this._map.set(ti.PUSHED_CLOUD_CTRL_CONFIG,{head:{...i,servcmd:f.NAME.IM_CONFIG_MANAGER+"."+ti.PUSHED_CLOUD_CTRL_CONFIG},body:{},keyMap:{res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}),this._map.set(ti.OVERLOAD_NOTIFY,{head:{...i,servcmd:f.NAME.OVERLOAD_PUSH+"."+ti.OVERLOAD_NOTIFY},body:{},keyMap:{res:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}),this._map.set(ti.SYNC_UNREAD_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.SYNC_UNREAD_MSG},body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0,needSignaling:1,needCachedMsg:1},keyMap:{req:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},res:{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"}}}),this._map.set(ti.GET_PROFANITY_LIST,{head:{...i,servcmd:f.NAME.IM_MSG_AUDIT_MGR+"."+ti.GET_PROFANITY_LIST},body:{version:0,deviceID:"",startIndex:void 0},keyMap:{req:{version:"uint64_version",deviceID:"str_device_id",startIndex:"uint64_start_index"},res:{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"}}}),this._map.set(ti.SEND_C2C_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.SEND_C2C_MSG},body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{sound:"",badgeMode:0,isVoipPush:void 0,image:""},androidInfo:{sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:""}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0,isRelayMessage:0,cmConfigID:void 0},keyMap:{req:{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",GoogleChannelID:"GoogleChannelID",XiaoMiChannelID:"XiaoMiChannelID"}}}),this._map.set(ti.SEND_GRP_MSG,{head:{...i,servcmd:f.NAME.GRP+"."+ti.SEND_GRP_MSG},body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{sound:"",badgeMode:0,isVoipPush:void 0,image:""},androidInfo:{sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:""}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0,isRelayMessage:0,cmConfigID:void 0},keyMap:{req:{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",GoogleChannelID:"GoogleChannelID",XiaoMiChannelID:"XiaoMiChannelID"},res:{MsgTime:"time",MsgSeq:"sequence"}}}),this._map.set(ti.REVOKE_C2C_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.REVOKE_C2C_MSG},body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{req:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}),this._map.set(ti.REVOKE_GRP_MSG,{head:{...i,servcmd:f.NAME.GRP+"."+ti.REVOKE_GRP_MSG},body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{req:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}),this._map.set(ti.GET_C2C_ROAMING_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.GET_C2C_ROAMING_MSG},body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{req:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},res:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer"}}}),this._map.set(ti.MODIFY_C2C_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.MODIFY_C2C_MSG},body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{req:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}),this._map.set(ti.GET_GRP_ROAMING_MSG,{head:{...i,servcmd:f.NAME.GRP+"."+ti.GET_GRP_ROAMING_MSG},body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{req:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},res:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",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",NextReqMsgSeq:"nextSequence"}}}),this._map.set(ti.SET_C2C_MSG_READ,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.SET_C2C_MSG_READ},body:{C2CMsgReaded:void 0},keyMap:{req:{lastMessageTime:"LastedMsgTime"}}}),this._map.set(ti.SET_C2C_PEER_MUTE_NOTIFICATIONS,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.SET_C2C_PEER_MUTE_NOTIFICATIONS},body:{userIDList:void 0,muteFlag:0},keyMap:{req:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}),this._map.set(ti.GET_C2C_PEER_MUTE_NOTIFICATIONS,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.GET_C2C_PEER_MUTE_NOTIFICATIONS},body:{toAccount:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Peer_Account"},res:{MuteNotificationsList:"muteFlagList"}}}),this._map.set(ti.SET_GRP_MSG_READ,{head:{...i,servcmd:f.NAME.GRP+"."+ti.SET_GRP_MSG_READ},body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{req:{messageReadSeq:"MsgReadedSeq"}}}),this._map.set(ti.SET_ALL_MSG_READ,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.SET_ALL_MSG_READ},body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{req:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},res:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}),this._map.set(ti.DEL_C2C_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.DEL_C2C_MSG},body:{fromAccount:"",to:"",keyList:void 0},keyMap:{req:{keyList:"MsgKeyList"}}}),this._map.set(ti.DEL_GRP_MSG,{head:{...i,servcmd:f.NAME.GRP+"."+ti.DEL_GRP_MSG},body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{req:{deleter:"Deleter_Account",keyList:"Seqs"}}}),this._map.set(ti.TRANSLATE_TEXT,{head:{...i,servcmd:f.NAME.IM_OPEN_TRANSLATE+"."+ti.TRANSLATE_TEXT},body:{sourceTextList:void 0,SDKAppID:0,from:0,source:"",target:""},keyMap:{req:{sourceTextList:"SourceText",SDKAppID:"SdkAppId",from:"FromAccount"},res:{TargetText:"translatedTextList",RequestId:"requestID",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}),this._map.set(ti.VOICE_TO_TEXT,{head:{...i,servcmd:f.NAME.IM_OPEN_SPEECH+"."+ti.VOICE_TO_TEXT},body:{url:"",SDKAppID:0,format:"",sourceType:0,language:""},keyMap:{req:{url:"BytesUrl",SDKAppID:"Uint32Sdkappid",format:"BytesVoiceFormat",sourceType:"Uint64SourceType",language:"BytesEngServiceType"},res:{BytesRequestid:"requestID",BytesResult:"result",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}),this._map.set(ti.MODIFY_GRP_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.MODIFY_GRP_MSG},body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{req:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}),this._map.set(ti.GET_READ_RECEIPT,{head:{...i,servcmd:f.NAME.GRP+"."+ti.GET_READ_RECEIPT},body:{groupID:"",sequenceList:void 0},keyMap:{req:{sequence:"MsgSeq"}}}),this._map.set(ti.SEND_C2C_READ_RECEIPT,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.SEND_C2C_READ_RECEIPT},body:{peerAccount:"",messageInfoList:void 0},keyMap:{req:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}),this._map.set(ti.SEND_READ_RECEIPT,{head:{...i,servcmd:f.NAME.GRP+"."+ti.SEND_READ_RECEIPT},body:{groupID:"",sequenceList:void 0},keyMap:{req:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}),this._map.set(ti.GET_READ_RECEIPT_DETAIL,{head:{...i,servcmd:f.NAME.GRP+"."+ti.GET_READ_RECEIPT_DETAIL},body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{req:{sequence:"MsgSeq",count:"Num"},res:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}),this._map.set(ti.MODIFY_C2C_MSG_EXT,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.MODIFY_C2C_MSG_EXT},body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}),this._map.set(ti.GET_C2C_MSG_EXT,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.GET_C2C_MSG_EXT},body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}),this._map.set(ti.MODIFY_GRP_MSG_EXT,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.MODIFY_GRP_MSG_EXT},body:{groupID:void 0,topicID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}),this._map.set(ti.GET_GRP_MSG_EXT,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.GET_GRP_MSG_EXT},body:{groupID:void 0,topicID:void 0,messageSequence:void 0,startSequence:void 0}}),this._map.set(ti.MSG_CLOUD_SEARCH,{head:{...i,servcmd:f.NAME.MSG_SEARCH+"."+ti.MSG_CLOUD_SEARCH},body:{keywordList:void 0,keywordListMatchType:"or",account:void 0,groupID:void 0,count:100,cursor:void 0,messageTypeList:void 0,senderUserIDList:void 0,startTime:void 0,endTime:void 0},keyMap:{req:{keywordListMatchType:"MatchType",account:"PeerAccount",groupID:"GroupID",messageTypeList:"MsgTypeList",senderUserIDList:"SendUserIDList"},res:{GroupID:"groupID",UserID:"userID",Count:"messageCount",LastMsgTime:"lastMessageTime",ConversationMsgs:"searchResult",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer",MsgSeq:"sequence",ReqMsgSeq:"sequence",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgContent:"content",ClientSeq:"clientSequence",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList",ErrorCode:"code",ErrorInfo:"message"}}}),this._map.set(ti.ADD_C2C_MSG_REACTION,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.ADD_C2C_MSG_REACTION},body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Add_Account"}}}),this._map.set(ti.RM_C2C_MSG_REACTION,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.RM_C2C_MSG_REACTION},body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Del_Account"}}}),this._map.set(ti.GET_C2C_MSG_REACTIONS,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.GET_C2C_MSG_REACTIONS},body:{from:void 0,to:void 0,messageKeyList:void 0,count:void 0}}),this._map.set(ti.GET_C2C_MSG_REACTION_USER_LIST,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.GET_C2C_MSG_REACTION_USER_LIST},body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,count:void 0}}),this._map.set(ti.ADD_GRP_MSG_REACTION,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.ADD_GRP_MSG_REACTION},body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Add_Account"}}}),this._map.set(ti.RM_GRP_MSG_REACTION,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.RM_GRP_MSG_REACTION},body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Del_Account"}}}),this._map.set(ti.GET_GRP_MSG_REACTIONS,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.GET_GRP_MSG_REACTIONS},body:{groupID:void 0,topicID:void 0,messageSequenceList:void 0,count:void 0},keyMap:{res:{MsgSeq:"messageSequence"}}}),this._map.set(ti.GET_GRP_MSG_REACTION_USER_LIST,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ti.GET_GRP_MSG_REACTION_USER_LIST},body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,nextSeq:void 0,count:void 0}}),this._map.set(ti.GET_C2C_PEER_READ_TIME,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.GET_C2C_PEER_READ_TIME},body:{userIDList:void 0},keyMap:{req:{userIDList:"To_Account"},res:{ReadTime:"peerReadTimeList"}}}),this._map.set(ti.PAGING_GET_CONV_LIST,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.PAGING_GET_CONV_LIST},body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:15,assistFlag:31},keyMap:{req:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},res:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex",GroupId:"convGroupID",C2cRemark:"friendRemark",MsgRecvOption:"messageRemindType",GroupIgnoredUnreadSeqCount:"noUnreadCount",GroupNextMsgSeq:"nextMessageSeq"}}}),this._map.set(ti.DEL_CONV,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.DEL_CONV},body:{fromAccount:"",conversationList:void 0,clearHistoryMessage:void 0},keyMap:{req:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble",conversationList:"ContactItem"},res:{ResultItem:"resultList",ToGroupid:"groupID",ResultCode:"code",ResultInfo:"info"}}}),this._map.set(ti.CLEAR_HISTORY_MSG,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.CLEAR_HISTORY_MSG},body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{req:{toGroupID:"ToGroupid"}}}),this._map.set(ti.PIN_CONV,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.PIN_CONV},body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{req:{itemList:"RecentContactItem"}}}),this._map.set(ti.DEL_GROUP_AT_TIPS,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.DEL_GROUP_AT_TIPS},body:{messageListToDelete:void 0},keyMap:{req:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}),this._map.set(ti.SET_CONV_CUSTOM_DATA,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.MARK_CONV},body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},res:{ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(ti.MARK_CONV,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.MARK_CONV},body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},res:{ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(ti.CREATE_CONV_GRP,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.CREATE_CONV_GRP},body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"GroupContactItem",groupID:"ToGroupId"},res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(ti.DEL_CONV_GRP,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.DEL_CONV_GRP},body:{fromAccount:"",groupName:void 0},keyMap:{res:{GroupId:"convGroupID"}}}),this._map.set(ti.RENAME_CONV_GRP,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.RENAME_CONV_GRP},body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{req:{oldName:"OldGroupName",newName:"NewGroupName",groupID:"ToGroupId",operationType:"ContactOptType",groupName:"OldGroupName",updateItem:"ContactUpdateItem"},res:{ContactOptType:"operationType",ToGroupId:"groupID",GroupId:"convGroupID"}}}),this._map.set(ti.ADD_CONV_TO_GRP,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.RENAME_CONV_GRP},body:{fromAccount:"",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}}}),this._map.set(ti.DEL_CONV_FROM_GRP,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.RENAME_CONV_GRP},body:{fromAccount:"",updateType:void 0,updateGroup:void 0}}),this._map.set(ti.GET_CONV_GRP_LIST,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.GET_CONV_GRP_LIST},body:{fromAccount:"",startIndex:void 0},keyMap:{res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList"}}}),this._map.set(ti.SEARCH_CONV_GRP_MARK,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ti.SEARCH_CONV_GRP_MARK},body:{fromAccount:"",contactItem:void 0},keyMap:{req:{groupID:"ToGroupId"},res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList",ContactResultItem:"contactItem"}}}),this._map.set(ti.GET_USER_PROFILE,{head:{...i,servcmd:f.NAME.PROFILE+"."+ti.GET_USER_PROFILE},body:{fromAccount:"",userItem:[]},keyMap:{req:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}),this._map.set(ti.UPDATE_MY_PROFILE,{head:{...i,servcmd:f.NAME.PROFILE+"."+ti.UPDATE_MY_PROFILE},body:{fromAccount:"",profileItem:[{tag:ye.NICK,value:""},{tag:ye.GENDER,value:""},{tag:ye.ALLOWTYPE,value:""},{tag:ye.AVATAR,value:""}]},keyMap:{req:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}),this._map.set(ti.GET_BL,{head:{...i,servcmd:f.NAME.FD+"."+ti.GET_BL},body:{fromAccount:"",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{res:{CurruentSequence:"currentSequence"}}}),this._map.set(ti.ADD_TO_BL,{head:{...i,servcmd:f.NAME.FD+"."+ti.ADD_TO_BL},body:{fromAccount:"",toAccount:[]}}),this._map.set(ti.RM_FROM_BL,{head:{...i,servcmd:f.NAME.FD+"."+ti.RM_FROM_BL},body:{fromAccount:"",toAccount:[]}}),this._map.set(ti.SET_SELF_STATUS,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ti.SET_SELF_STATUS},body:{customStatus:""}}),this._map.set(ti.GET_USER_STATUS,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ti.GET_USER_STATUS},body:{userIDList:void 0},keyMap:{res:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}),this._map.set(ti.SUB_USER_STATUS,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ti.SUB_USER_STATUS},body:{userIDList:void 0},keyMap:{res:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}),this._map.set(ti.UNSUB_USER_STATUS,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ti.UNSUB_USER_STATUS},body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{res:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}),this._map.set(ti.GET_FD_LIST,{head:{...i,servcmd:f.NAME.FD+"."+ti.GET_FD_LIST},body:{fromAccount:"",startIndex:0,standardSequence:0,customSequence:0},keyMap:{res:{FriendNum:"friendCount",UserDataItem:"resultList",ValueItem:"tagValueList"}}}),this._map.set(ti.ADD_FD,{head:{...i,servcmd:f.NAME.FD+"."+ti.ADD_FD},body:{fromAccount:"",addFriendItem:[],type:""},keyMap:{req:{source:"AddSource",wording:"AddWording",type:"AddType"},res:{ResultItem:"resultList"}}}),this._map.set(ti.UPDATE_FD,{head:{...i,servcmd:f.NAME.FD+"."+ti.UPDATE_FD},body:{fromAccount:"",updateItem:void 0},keyMap:{req:{snsItem:"SnsItem"},res:{ResultItem:"resultList"}}}),this._map.set(ti.DEL_FD,{head:{...i,servcmd:f.NAME.FD+"."+ti.DEL_FD},body:{fromAccount:"",userIDList:[],type:""},keyMap:{req:{type:"DeleteType"},res:{ResultItem:"resultList"}}}),this._map.set(ti.GET_FD_PROFILE,{head:{...i,servcmd:f.NAME.FD+"."+ti.GET_FD_PROFILE},body:{fromAccount:"",userIDList:void 0},keyMap:{res:{InfoItem:"resultList",SnsProfileItem:"tagValueList"}}}),this._map.set(ti.CHECK_FD,{head:{...i,servcmd:f.NAME.FD+"."+ti.CHECK_FD},body:{fromAccount:"",userIDList:[],type:""},keyMap:{req:{type:"CheckType"},res:{InfoItem:"resultList"}}}),this._map.set(ti.GET_FD_APPLICATION_LIST,{head:{...i,servcmd:f.NAME.FD+"."+ti.GET_FD_APPLICATION_LIST},body:{fromAccount:"",applicationType:"",startTime:0,maxLimited:0,lastSequence:0},keyMap:{res:{PendencyItem:"resultList",AddSource:"source",AddTime:"time",AddWording:"wording",Image:"avatar",UnreadPendencyCount:"unreadCount",To_Account:"userID",PendencyType:"type"}}}),this._map.set(ti.RESPOND_FD_APPLICATION,{head:{...i,servcmd:f.NAME.FD+"."+ti.RESPOND_FD_APPLICATION},body:{fromAccount:"",responseFriendItem:[]},keyMap:{req:{tag:"TagName",action:"ResponseAction"},res:{ResultItem:"resultList"}}}),this._map.set(ti.DEL_FD_APPLICATION,{head:{...i,servcmd:f.NAME.FD+"."+ti.DEL_FD_APPLICATION},body:{fromAccount:"",type:"",userIDList:void 0},keyMap:{req:{type:"PendencyType",userIDList:"To_Account"},res:{ResultItem:"resultList"}}}),this._map.set(ti.REPORT_FD_APPLICATION,{head:{...i,servcmd:f.NAME.FD+"."+ti.REPORT_FD_APPLICATION},body:{fromAccount:"",latestTimeStamp:""},keyMap:{req:{latestTimeStamp:"LatestPendencyTimeStamp"}}}),this._map.set(ti.CREATE_FD_GRP,{head:{...i,servcmd:f.NAME.FD+"."+ti.CREATE_FD_GRP},body:{fromAccount:"",groupName:void 0,userIDList:void 0},keyMap:{req:{groupName:"GroupName",userIDList:"To_Account"},res:{ResultItem:"resultList"}}}),this._map.set(ti.DEL_FD_GRP,{head:{...i,servcmd:f.NAME.FD+"."+ti.DEL_FD_GRP},body:{fromAccount:"",nameList:void 0},keyMap:{req:{nameList:"GroupName"}}}),this._map.set(ti.GET_FD_GRP_LIST,{head:{...i,servcmd:f.NAME.FD+"."+ti.GET_FD_GRP_LIST},body:{fromAccount:"",lastSequence:0,needFriend:"Need_Friend_Type_Yes"},keyMap:{res:{ResultItem:"resultList",GroupName:"name",FriendNumber:"friendCount",To_Account:"userIDList"}}}),this._map.set(ti.UPDATE_FD_GRP,{head:{...i,servcmd:f.NAME.FD+"."+ti.UPDATE_FD_GRP},body:{fromAccount:"",oldName:"",newName:void 0,updateGroupItem:void 0},keyMap:{req:{oldName:"GroupOldName",newName:"GroupNewName"},res:{UpdateType:"type",ResultItem:"resultList"}}}),this._map.set(ti.GET_GRP_LIST,{head:{...i,servcmd:f.NAME.GRP+"."+ti.GET_GRP_LIST},body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0,needAppDefineData:1},keyMap:{req:{memberAccount:"Member_Account"},res:{GroupIdList:"groups",MsgSeq:"readedSequence",LastRecallTime:"_lastRevokedTime",AppDefinedData:"groupCustomField"}}}),this._map.set(ti.GET_GRP_PROFILE,{head:{...i,servcmd:f.NAME.GRP+"."+ti.GET_GRP_PROFILE},body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:void 0,groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{req:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}),this._map.set(ti.CREATE_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ti.CREATE_GRP},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:{req:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",inviteOption:"InviteJoinOption"},res:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}),this._map.set(ti.DISMISS_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ti.DISMISS_GRP},body:{groupID:void 0}}),this._map.set(ti.UPDATE_GRP_PROFILE,{head:{...i,servcmd:f.NAME.GRP+"."+ti.UPDATE_GRP_PROFILE},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:{req:{groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl",inviteOption:"InviteJoinOption"},res:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}),this._map.set(ti.APPLY_JOIN_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ti.APPLY_JOIN_GRP},body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{req:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},res:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}),this._map.set(ti.APPLY_JOIN_GRP_NOAUTH,function(){const{a2:e,tinyid:t,...s}=i;return{head:{...s,servcmd:f.NAME.BIG_GRP_NO_AUTH+"."+ti.APPLY_JOIN_GRP},body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{req:{applyMessage:"ApplyMsg"},res:{HugeGroupFlag:"avChatRoomFlag"}}}}()),this._map.set(ti.QUIT_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ti.QUIT_GRP},body:{groupID:void 0}}),this._map.set(ti.SEARCH_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ti.SEARCH_GRP},body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"]}}}),this._map.set(ti.CHANGE_GRP_OWNER,{head:{...i,servcmd:f.NAME.GRP+"."+ti.CHANGE_GRP_OWNER},body:{groupID:void 0,newOwnerID:void 0},keyMap:{req:{newOwnerID:"NewOwner_Account"}}}),this._map.set(ti.HANDLE_GRP_APPLICATION,{head:{...i,servcmd:f.NAME.GRP+"."+ti.HANDLE_GRP_APPLICATION},body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{req:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}),this._map.set(ti.HANDLE_INVITE_JOIN_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ti.HANDLE_INVITE_JOIN_GRP},body:{groupID:void 0,applicant:void 0,invitee:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,userDefinedField:void 0},keyMap:{req:{applicant:"Applicant_Account",invitee:"Invited_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg"}}}),this._map.set(ti.HANDLE_GRP_INVITATION,{head:{...i,servcmd:f.NAME.GRP+"."+ti.HANDLE_GRP_INVITATION},body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{req:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}),this._map.set(ti.GET_GRP_PENDENCY,{head:{...i,servcmd:f.NAME.GRP+"."+ti.GET_GRP_PENDENCY},body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{req:{handleAccount:"Handle_Account"},res:{To_Account:"userID",ApplyInviteMsg:"note"}}}),this._map.set(ti.DEL_GRP_SYSTEM_NOTICE,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.DEL_GRP_SYSTEM_NOTICE},body:{messageListToDelete:void 0},keyMap:{req:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}),this._map.set(ti.AV_POLLING,{head:{...i,servcmd:f.NAME.BIG_GRP_POLLING+"."+ti.AV_POLLING},body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{req:{USP:"USP"},res:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}),this._map.set(ti.AV_NOAUTH_POLLING,function(){const{a2:e,tinyid:t,...s}=i;return{head:{...s,servcmd:f.NAME.BIG_GRP_POLLING_NO_AUTH+"."+ti.AV_POLLING},body:{USP:1,startSeq:1,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{req:{USP:"USP"},res:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}()),this._map.set(ti.GET_ONLINE_MBR_NUM,{head:{...i,servcmd:f.NAME.GRP+"."+ti.GET_ONLINE_MBR_NUM},body:{groupID:void 0},keyMap:{res:{OnlineMemberNum:"memberCount"}}}),this._map.set(ti.SET_GRP_ATTR,{head:{...i,servcmd:f.NAME.GRP+"."+ti.SET_GRP_ATTR},body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key",value:"value"}}}),this._map.set(ti.MODIFY_GRP_ATTR,{head:{...i,servcmd:f.NAME.GRP+"."+ti.MODIFY_GRP_ATTR},body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key",value:"value"}}}),this._map.set(ti.DEL_GRP_ATTR,{head:{...i,servcmd:f.NAME.GRP+"."+ti.DEL_GRP_ATTR},body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key"}}}),this._map.set(ti.CLEAR_GRP_ATTR,{head:{...i,servcmd:f.NAME.GRP+"."+ti.CLEAR_GRP_ATTR},body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}),this._map.set(ti.GET_GRP_ATTR,{head:{...i,servcmd:f.NAME.GRP_ATTR+"."+ti.GET_GRP_ATTR},body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{req:{avChatRoomKey:"Key",groupType:"GroupType"}}}),this._map.set(ti.GET_GRP_NOTIFY,{head:{...i,servcmd:f.NAME.GRP+"."+ti.GET_GRP_NOTIFY},body:{notifyReqList:[]},keyMap:{req:{notifyReqList:"NotifyReqList"},res:{NextMsgTime:"nextRevokedTime",NotifyMsgList:"notifyList",NotifyRspList:"notifyRspList"}}}),this._map.set(ti.UPDATE_GRP_COUNTER,{head:{...i,servcmd:f.NAME.GRP+"."+ti.UPDATE_GRP_COUNTER},body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{req:{counterList:"GroupCounter"}}}),this._map.set(ti.GET_GRP_COUNTER,{head:{...i,servcmd:f.NAME.GRP+"."+ti.GET_GRP_COUNTER},body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{req:{keyList:"GroupCounterKeys"}}}),this._map.set(ti.CREATE_TOPIC,{head:{...i,servcmd:f.NAME.GRP_COMMUNITY+"."+ti.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:{req:{avatar:"FaceUrl"}}}),this._map.set(ti.DEL_TOPIC,{head:{...i,servcmd:f.NAME.GRP_COMMUNITY+"."+ti.DEL_TOPIC},body:{groupID:void 0,topicIDList:void 0},keyMap:{req:{topicIDList:"TopicIdList"},res:{DestroyResultItem:"resultList"}}}),this._map.set(ti.UPDATE_TOPIC_PROFILE,{head:{...i,servcmd:f.NAME.GRP_COMMUNITY+"."+ti.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:{req:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}),this._map.set(ti.GET_TOPIC_LIST,{head:{...i,servcmd:f.NAME.GRP_COMMUNITY+"."+ti.GET_TOPIC_LIST},body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:["NoUnreadSeqList"]},keyMap:{req:{topicIDList:"TopicIdList"},res:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence"}}}),this._map.set(ti.GET_GRP_MBR_LIST,{head:{...i,servcmd:f.NAME.GRP+"."+ti.GET_GRP_MBR_LIST},body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{req:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}),this._map.set(ti.GET_AV_MBR_LIST,{head:{...i,servcmd:f.NAME.GRP_AV+"."+ti.GET_AV_MBR_LIST},body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{req:{offset:"Timestamp",filter:"Mark"},res:{NextTimestamp:"offset"}}}),this._map.set(ti.GET_GRP_MBR_PROFILE,{head:{...i,servcmd:f.NAME.GRP+"."+ti.GET_GRP_MBR_PROFILE},body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{req:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}),this._map.set(ti.ADD_GRP_MBR,{head:{...i,servcmd:f.NAME.GRP+"."+ti.ADD_GRP_MBR},body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{req:{userID:"Member_Account",userIDList:"MemberList"},res:{MemberList:"members"}}}),this._map.set(ti.DEL_GRP_MBR,{head:{...i,servcmd:f.NAME.GRP+"."+ti.DEL_GRP_MBR},body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{req:{userIDList:"MemberToDel_Account"}}}),this._map.set(ti.BAN_AV_MBR,{head:{...i,servcmd:f.NAME.GRP+"."+ti.BAN_AV_MBR},body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:""},keyMap:{req:{userIDList:"Members_Account",duration:"Duration",reason:"Description"}}}),this._map.set(ti.MODIFY_GRP_MBR_INFO,{head:{...i,servcmd:f.NAME.GRP+"."+ti.MODIFY_GRP_MBR_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:{req:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}),this._map.set(ti.MARK_AV_MBR_INFO,{head:{...i,servcmd:f.NAME.GRP_AV+"."+ti.MARK_AV_MBR_INFO},body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{req:{operationType:"CommandType",memberList:"MemberList",markType:"Marks",userID:"Member_Account"},res:{CommandType:"operationType",Marks:"markType",Member_Account:"userID"}}}),this._map.set(ti.SSO_STAT,{head:{...t,servcmd:f.NAME.IM_OPEN_STAT+"."+ti.SSO_STAT},body:{header:{},event:[],quality:[]},keyMap:{req:{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"}}}),this._map.set(ti.PING,{head:{...i,servcmd:f.NAME.HEARTBEAT+"."+ti.PING},body:{}}),this._map.set(ti.MSG_PUSH,{head:{...i,servcmd:f.NAME.IM_OPEN_PUSH+"."+ti.MSG_PUSH},body:{},keyMap:{res:{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"}}}),this._map.set(ti.MULTI_MSG_PUSH,{head:{...i,servcmd:f.NAME.IM_OPEN_PUSH+"."+ti.MULTI_MSG_PUSH},body:{},keyMap:{res:{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"}}}),this._map.set(ti.MSG_PUSH_ACK,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ti.MSG_PUSH_ACK},body:{sessionData:void 0},keyMap:{req:{sessionData:"SessionData"}}}),this._map.set(ti.STATUS_FORCE_OFFLINE,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ti.STATUS_FORCE_OFFLINE},body:{},keyMap:{res:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}),this._map.set(ti.DOWNLOAD_MERGER_MSG,{head:{...i,servcmd:f.NAME.IM_LONG_MSG+"."+ti.DOWNLOAD_MERGER_MSG},body:{downloadKey:""},keyMap:{res:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}),this._map.set(ti.UPLOAD_MERGER_MSG,{head:{...i,servcmd:f.NAME.IM_LONG_MSG+"."+ti.UPLOAD_MERGER_MSG},body:{messageList:[]},keyMap:{req:{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"}}}),this._map.set(ti.FOLLOW,{head:{...i,servcmd:f.NAME.FOLLOW+"."+ti.FOLLOW},body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"FollowItem"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(ti.UNFOLLOW,{head:{...i,servcmd:f.NAME.FOLLOW+"."+ti.UNFOLLOW},body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(ti.GET_FOLLOW_INFO,{head:{...i,servcmd:f.NAME.FOLLOW+"."+ti.GET_FOLLOW_INFO},body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{FollowInfo:"followInfoList",To_Account:"userID",FollowerCount:"followersCount",FollowingCount:"followingCount",MutualFollowingCount:"mutualFollowersCount"}}}),this._map.set(ti.GET_FOLLOW,{head:{...i,servcmd:f.NAME.FOLLOW+"."+ti.GET_FOLLOW},body:{fromAccount:"",type:1,nextCursor:"",count:500},keyMap:{req:{type:"FollowType",nextCursor:"StartCursor",count:"WantNum"},res:{FollowItem:"resultList",To_Account:"userID",ProfileItem:"profileList"}}}),this._map.set(ti.CHECK_FOLLOW_TYPE,{head:{...i,servcmd:f.NAME.FOLLOW+"."+ti.CHECK_FOLLOW_TYPE},body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(ti.SET_TOKEN,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ti.SET_TOKEN},body:{tokenID:"",pushMsg:0,sdkAppID:0,businessID:"",deviceBrand:"",deviceToken:"",isTpns:0,isWebUniapp:0,notificationStatus:0,deviceModel:"",systemVersion:"",pushVersion:""},keyMap:{req:{tokenID:"TokenID",pushMsg:"PushMsg",sdkAppID:"EnterVersion",businessID:"BusiID",deviceBrand:"InstType",deviceToken:"VarToken",isTpns:"IsTpns",notificationStatus:"NotificationStatus",deviceModel:"DeviceModel",systemVersion:"SystemVersion",pushVersion:"PushPluginVersion"}}}),this._map.set(ti.STAT_FOREGROUND,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ti.STAT_FOREGROUND},body:{isWebUniapp:0}}),this._map.set(ti.STAT_BACKGROUND,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ti.STAT_BACKGROUND},body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{req:{c2cUnreadCount:"C2cUnread",groupUnreadCount:"GrpUnread"}}}),this._map.set(ti.PUSH_REPORT,{head:{...i,servcmd:f.NAME.OFFLINE_PUSH_REPORT+"."+ti.PUSH_REPORT},body:{eventList:[]},keyMap:{req:{eventList:"UinappPushEvents",type:"EventType",time:"EventTime",pushId:"ClickExt"}}}),this._map.set(ti.SET_ALL_RECEIVE_MSG_OPT,{head:{...i,servcmd:f.NAME.IM_MSG_LOGIC+"."+ti.SET_ALL_RECEIVE_MSG_OPT},body:{startTime:0,endTime:0,isRepeated:0,messageRemindType:0},keyMap:{req:{messageRemindType:"Level"}}}),this._map.set(ti.GET_ALL_RECEIVE_MSG_OPT,{head:{...i,servcmd:f.NAME.IM_MSG_LOGIC+"."+ti.GET_ALL_RECEIVE_MSG_OPT},body:{toAccount:void 0}})}has(e){return this._map.has(e)}get(e){return this._map.get(e)}update(){this._fillMap()}getKeyMap(e){return this.has(e)?this.get(e).keyMap||{}:(Ce.w(this._n+".getKeyMap unknown P:"+e),{})}getProtocolData(e){const{P:t,data:s}=e,i=this.get(t);let o=null;if(s){const e=this._simpleDeepCopy(i),t=this._updateService(s,e),n=t.body,r=Object.create(null);for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(r[i]=n[i],void 0===s[i])continue;r[i]=s[i]}t.body=r,o=this._getUplinkData(t)}else o=this._getUplinkData(i);return o}_getUplinkData(e){var e=this._dataCleaner(e),t=mt(e.head),t=zn(e.body,this._getReqKeyMap(t));return e.body=t,e}_updateService(i,o){var n=mt(o.head);if(this._isFromGroupRequest(o)){let{type:e,groupID:t,groupIDList:s=[]}=i;$e(t)&&(t=s[0]||""),nt({type:e,groupID:t})&&(o.head.servcmd=f.NAME.GRP_COMMUNITY+"."+n)}return o}_isFromGroupRequest(e){return e.head.servcmd.includes(f.NAME.GRP)||e.head.servcmd.includes(f.NAME.GRP_ATTR)}_getReqKeyMap(e){e=this.getKeyMap(e);return{...Hn.req,...e.req}}_dataCleaner(e){var t=Array.isArray(e)?[]:Object.create(null);for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&He(s)&&null!==e[s]&&void 0!==e[s]&&("object"!=typeof e[s]?t[s]=e[s]:t[s]=this._dataCleaner.bind(this)(e[s]));return t}_simpleDeepCopy(s){var i,o=Object.keys(s),n={};for(let e=0,t=o.length;e{var t;1===e.isSyncMessage&&(t=e.from,e.from=e.to,e.to=t)}),1===e.needSync&&this._sessionM.get(As).syncOnNeed(),t.onNewMessage({dataList:e.dataList,isInstantMessage:!0})}_onC2CMsgModified(e){this._sessionM.get(Ms).onMsgModified(e)}_onGroupMsgArray(e){var t=this._sessionM.get(Is);t&&t.onNewMessage({event:e.event,dataList:e.dataList,isInstantMessage:!0})}_onGroupMsgModified(e){var t=this._sessionM.get(Is);t&&t.onMsgModified(e)}_onGroupTips(e){var t=this._sessionM.get(Is);if(t){var{event:s,dataList:i,isInstantMessage:o=!0,isSyncingEnded:n}=e;switch(s){case 4:case 6:t.onNewGroupTips({event:s,dataList:i});break;case 5:for(let e=0;e{if(Fe(e))if(e.hasOwnProperty("kickoutMsgNotify")){const{kickoutMsgNotify:{kickType:t,newInstanceInfo:s={}}}=e;1===t?this._sessionM.onMultipleAccountKickedOut(s):2===t?this._sessionM.onMultipleDeviceKickedOut(s):3===t&&this._sessionM.onRestApiKickedOut(s)}else e.hasOwnProperty("c2cMessageRevokedNotify")?s&&s.onMsgRevoked({dataList:t}):e.hasOwnProperty("c2cMessageReadReceipt")?s&&s.onMsgReadReceipt({dataList:t}):e.hasOwnProperty("c2cMessageReadNotice")?s&&s.onMsgReadNotice({dataList:t}):e.hasOwnProperty("muteNotificationsSync")&&this._sessionM.get(ys).onC2CMsgRemindTypeSynced({dataList:t})})}}_onC2CReadReceiptArray(e){this._sessionM.get(Ms).onReadReceiptList(e)}_onProfileModified(e){this._sessionM.get(fs).onProfileModified({dataList:e.dataList});var t=this._sessionM.get(Cs);t&&t.onFriendProfileModified({dataList:e.dataList})}_onRelationChainModified(e){this._sessionM.get(fs).onRelationChainModified({dataList:e.dataList});var t=this._sessionM.get(Cs);t&&t.onRelationChainModified({dataList:e.dataList})}_onRecentContact(e){e=e.dataList;if(be(e)){const n=this._sessionM.get(ys);n&&e.forEach(e=>{const t=e["pushType"];if(1===t){const t=e["recentContactDeleteItem"];n.onConvDeleted(t.recentContactList)}else if(2===t){const t=e["recentContactTopItem"];n.onConvPinnedStatus(t.recentContactList,!0)}else if(3===t){const t=e["recentContactTopItem"];n.onConvPinnedStatus(t.recentContactList,!1)}else if(4===t){const t=e["recentContactMarkContact"];n.onConvMarkUpdated(t.recentContactMarkContactItem)}else if(5===t){const t=e["recentContactCreateContactGroup"];n.onConvGroupCreated(t.msgContactGroupContactItem)}else if(6===t){const t=e["recentContactDelContactGroup"];n.onConvGroupDeleted(t.msgGroupItem)}else if(7===t){const t=e["recentContactUpdateContactGroup"],{updateType:s,msgUpdateGroup:i,msgUpdateContact:o}=t;if(1===s){const e=i["updateGroupType"];1===e?n.onConvGroupNameUpdated(i):2===e&&n.onConvInGroupUpdated(i)}else 2===s&&n.onConvAddedToOrDeletedFromGroup(o)}})}}_onAllMsgRead(e){var e=e["dataList"],t=this._sessionM.get(ys);t&&t.onPushedAllMessageRead(e)}_onUserStatusList(e){this._sessionM.get(fs).onUserStatusUpdated(e)}_onMsgExtNotify(e){this._sessionM.get(ms).onMsgExtNotify(e)}_onMsgReactionNotifyList(e){this._sessionM.get(Bs).onReactionNotifyList(e)}_onMsgReactionNotify(e){this._sessionM.get(Bs).onReactionNotify(e)}_onFollowNotify(e){this._sessionM.get(Ks).onFollowNotify(e)}_onTopicLatestMsg(e){this._sessionM.get(Ts).onTopicLatestMsg(e)}onMessage(s){var e=s["body"];if(this._filterMsgFromIMOpenPush(s)){var{eventArray:i,isInstantMessage:o,isSyncingEnded:n,needSync:r}=e;if(be(i)){var a,c,l;for(let e=0,t=i.length;e-1!==this._keys.indexOf(e));s?(c=14===l?{readAllC2CMessage:a[s],groupMessageReadInfoList:a.groupMessageReadNotice||[]}:16===l?{userID:a.userID,timestamp:a.timestamp,readReceiptList:a[s]}:a[s],this._eventHandlerMap.get(s)({event:l,dataList:c,isInstantMessage:o,isSyncingEnded:n,needSync:r})):Ce.l(this._n+".onMessage unknown eventItem:",a)}}}}_onRoomCustomData(e){this._sessionM.get($s).onRoomCustomDataReceived(e),Ce.l(this._n+"._onRoomCustomData data:"+e)}_onAllRcvMsgOptNotify(e){this._sessionM.get(ys).onAllRcvMsgOptNotify(e)}_filterMsgFromIMOpenPush(e){const{head:t,body:s}=e,i=t["servcmd"];let o=!1;if(!(o=$e(i)?o:i.includes(f.NAME.IM_CONFIG_MANAGER)||i.includes(f.NAME.OVERLOAD_PUSH)||i.includes(f.NAME.STAT_SERVICE)))return!0;if(i.includes(ti.PUSHED_CLOUD_CTRL_CONFIG))this._sessionM.get(Ps).onPushedConfig(s);else if(i.includes(ti.PUSHED_COMMERCIAL_CONFIG))this._sessionM.get(ws).onPushedConfig(s);else if(i.includes(ti.OVERLOAD_NOTIFY))this._sessionM.onPushedServerOverload(s);else if(i.includes(ti.KICK_OTHER)){const e=Date.now(),t=(this._sessionM.reLoginOnKickOther(),new mi("kickOther")),s=this._sessionM.get(ps).getLastWsHelloTs(),i=e-s;t.setMessage(`last wshello time:${s} diff:${i}ms`).end()}return!1}}const _o=[{cmd:ti.GET_GRP_PROFILE,interval:1,count:8},{cmd:ti.UPDATE_GRP_PROFILE,interval:1,count:8},{cmd:ti.GET_AV_MBR_LIST,interval:3,count:1},{cmd:ti.GET_GRP_PENDENCY,interval:1,count:15},{cmd:ti.GET_TOPIC_LIST,interval:1,count:10},{cmd:ti.SET_GRP_ATTR,interval:5,count:10},{cmd:ti.MODIFY_GRP_ATTR,interval:5,count:10},{cmd:ti.DEL_GRP_ATTR,interval:5,count:10},{cmd:ti.CLEAR_GRP_ATTR,interval:5,count:10},{cmd:ti.GET_GRP_ATTR,interval:5,count:20},{cmd:ti.UPDATE_GRP_COUNTER,interval:5,count:20},{cmd:ti.GET_GRP_COUNTER,interval:5,count:20},{cmd:ti.SET_ALL_MSG_READ,interval:1,count:1},{cmd:ti.GET_USER_STATUS,interval:5,count:20},{cmd:ti.SUB_USER_STATUS,interval:5,count:20},{cmd:ti.UNSUB_USER_STATUS,interval:5,count:20},{cmd:ti.MSG_CLOUD_SEARCH,interval:1,count:2},{cmd:ti.CHECK_FOLLOW_TYPE,interval:5,count:20},{cmd:ti.GET_GRP_ROAMING_MSG,interval:1,count:20},{cmd:ti.GET_C2C_ROAMING_MSG,interval:1,count:20}],ho=new Map,po=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];for(let e=0,t=po.length;e{this._cmdFreqLimitMap.set(e.cmd,{interval:e.interval,count:e.count})})}updateProtocolConfig(){this._pHandler.update()}req(e){Ce.d(this._n+".req options:",e);var t=e["P"];if(!this._pHandler.has(t))return Ce.w(this._n+".req unknown P:"+t),Qs({code:js.NO_PROTOCOL});var e=this.getProtocolData(e),s=e.head["servcmd"];let i;return this._isFreqOverLimit(s)?(i=js.OVER_FREQUENCY_LIMIT,Qs({code:i,message:this.getErrMsg(i,this._getCmd(s))})):this._isServerOverload(s)?(i=js.OPEN_SERVICE_OVERLOAD_ERROR,Qs({code:i,message:this.getErrMsg(i,this._getCmd(s))})):(s=this.get(Ns),lo.includes(t)?s.simplySend(e):s.send(e))}getKeyMap(e){return this._pHandler.getKeyMap(e)}genCommonHead(){var e=this.get(vs);return{ver:"v4",platform:this._platform,websdkappid:a,websdkversion:r,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:12775283,sdkability_ext:go(""),cappid:e.getApplicationID()}}genCosSpecifiedHead(){var e=this.get(vs);return{ver:"v4",platform:this._platform,websdkappid:a,websdkversion:r,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:12775283,sdkability_ext:go(""),cappid:e.getApplicationID()}}genSSOReportHead(){var e=this.get(vs);return{ver:"v4",platform:this._platform,websdkappid:a,websdkversion:r,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:12775283,sdkability_ext:go(""),cappid:e.getApplicationID()}}getProtocolData(e){return this._pHandler.getProtocolData(e)}trans(e){var{servcmd:e,data:t}=e,e={head:{...this.genCommonHead(),servcmd:e},body:t};return this.get(Ns).send(e)}sendComboMessage(e){var{servcmd:e,data:t}=e,e={head:{...this.genCommonHead(),servcmd:e},body:t};return this.get(Ns).send(e)}onErrorCodeNotZero(e){const t=e["errorCode"];if(t===js.HELLO_ANSWER_KICKED_OUT){const{kickType:t,newInstanceInfo:s={}}=e;1===t?this.onMultipleAccountKickedOut(s):2===t?this.onMultipleDeviceKickedOut(s):3===t&&this.onRestApiKickedOut(s)}t!==js.MSG_A2KEY_EXPIRED&&t!==js.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.get(Ns).reConnect())}onMessage(e){var t=e["body"],{needAck:t=0,sessionData:s}=t;1===t&&this._sendACK(s),this._msgDispatcher.onMessage(e)}onReconnected(e){this._incrementalPullContactFlag=e<=300,this._reLoginOnReconnected()}reLoginOnKickOther(){Ce.l(this._n+".reLoginOnKickOther"),this._reLogin()}_reLoginOnReconnected(){Ce.l(this._n+"._reLoginOnReconnected"),this._reLogin()}_reLogin(){const r=this._n+"._reLogin";if(this.isLoggedIn()){let e=0;var s=this.get(ps).getPushModule();s&&(e=s.getUniAppPlatform());const a=new mi("reLogin");this.req({P:ti.LOGIN,data:{isWebUniapp:e,customInfo:this.get(vs).getCustomLoginInfo()}}).then(e=>{var{instanceID:e,customStatus:s}=e.data,i=this.get(vs),o=gn(s),n=(i.setStatusInstanceID(e),this.get(Ns)),e=`socketID:${n.getSocketID()} instanceID:${e} customStatus:`+o,e=(a.setMessage(e).end(!0),Ce.l(r+" ok. "+e),i.getCustomStatus()!==o&&this.get(fs).onUserStatusUpdated({dataList:[{to:this.getMyUserID(),statusType:t.USER_STATUS_ONLINE,customStatus:s}]}),n.diagnose(),this.get(ys).syncConvList(this._incrementalPullContactFlag).then(()=>{Ce.l(r+", sync conv list ok."),this.get(Gs).start()}),this.get(Is)),i=(e&&e.updateLocalMainSequenceOnReconnected(),this.get(Ts)),o=(i.resetGetTopicTime(),i.getTopicListOnReconnected(),this.get(Ks));o&&o.clearCacheOnReconnected()})}}onMultipleAccountKickedOut(e){this.get(ps).onMultipleAccountKickedOut(e)}onMultipleDeviceKickedOut(e){this.get(ps).onMultipleDeviceKickedOut(e)}_onUserSigExpired(){this.get(ps).onUserSigExpired()}onRestApiKickedOut(e){this.get(ps).onRestApiKickedOut(e)}_sendACK(e){this.req({P:ti.MSG_PUSH_ACK,data:{sessionData:e}})}_isFreqOverLimit(e){e=e.split(".")[1];if(!this._cmdFreqLimitMap.has(e))return!1;if(!this._cmdReqInfoMap.has(e))return this._cmdReqInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1;var{count:t,interval:s}=this._cmdFreqLimitMap.get(e),{startTime:i,requestCount:o}=this._cmdReqInfoMap.get(e);if(Date.now()-i>1e3*s)return this._cmdReqInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1;this._cmdReqInfoMap.set(e,{startTime:i,requestCount:o+=1});let n=t=this._expiredTime}fetchConfig(){const i=this._n+".fetchConfig",e=this._canFetch();if(Ce.l(i+" canFetch:"+e),e){const o=new mi("fetchCloudCtrlConfig"),t=this.get(vs).getSDKAppID();this._isFetching=!0,this.req({P:ti.FETCH_CLOUD_CTRL_CONFIG,data:{SDKAppID:t,version:this._version}}).then(e=>{this._isFetching=!1;var{version:t,cloudControlConfig:s}=e.data;o.setMessage(`version:${this._version} newVersion:${t} config:`+s).end(),Ce.l(i+" ok"),this._parse(e.data)}).catch(e=>{this._isFetching=!1,o.setError(e).end(),Ce.l(i+" failed. error:",e),this._setExpiredTime(12e4)})}}onPushedConfig(e){Ce.l(this._n+".onPushedConfig config:",e),new mi("pushedCloudCtrlConfig").setMessage(`newVersion:${e.version} config:`+e.cloudControlConfig).end(),this._parse(e)}onCheckTimer(e){this._canFetch()&&this.fetchConfig()}_parse(e){var s=this._n+"._parse",{errorCode:t,errorMessage:i,cloudControlConfig:o,version:n,expiredTime:r}=e;if(0===t){if(this._version!==n){let t=null;try{t=JSON.parse(o)}catch(e){this.isPrivateNetWork()||Ce.e(s+" failed. config:",o)}t&&(this._cloudConfig.clear(),Object.keys(t).forEach(e=>{this._cloudConfig.set(e,t[e])}),this._version=n,this.emitIEvt(Vi.CLOUD_CONFIG))}this._setExpiredTime(1e3*r)}else $e(t)?(Ce.l(s+" failed. Invalid message format:",e),this._setExpiredTime(36e5)):(Ce.e(s+` errorCode:${t} errorMessage:`+i),this._setExpiredTime(12e4))}_setExpiredTime(e){this._expiredTime=Date.now()+e}reset(){Ce.l(this._n+".reset"),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}class Mo extends ei{constructor(e){super(e),this._n="RecoverMsgModule",this.PULL_LIMIT_COUNT=15}start(){this._recoverGroupChat(),this._recoverC2CChat()}_recoverGroupChat(){const e=this._getLocalConvList().filter(e=>e.type===t.CONV_GROUP&&e.groupProfile.type!==t.GRP_AVCHATROOM),i=this.get(ys);let o,n,r,a,c;const l=[];e.forEach(e=>{var{conversationID:e,lastMessage:s}=e;n=e.replace(t.CONV_GROUP,""),o=i.getLocalLastMessage(e),s&&0!==s.lastSequence&&o&&(a=s.lastSequence,r=o.sequence,c=a-r,0e.type===t.CONV_C2C),s=this.get(ys);let i,o,n,r;const a=[Promise.resolve()];e.forEach(e=>{var{conversationID:e,lastMessage:t}=e;i=s.getLocalLastMessage(e),t&&0!==t.lastTime&&i&&(n=t.lastTime,o=i.time,r=n-o,0{Ce.l(this._n+"._recoverC2CChat all done"),this.get(As).syncOnReconnected()})}_getLocalConvList(){return this.get(ys).getLocalConvList()}_recoverGroupMsg(e){const c=this._n+"._recoverGroupMsg",{groupID:l,localLastMessageSequence:d,remoteLastMessageSequence:_}=(Ce.l(c+" options:",e),e),u=JSON.stringify(e),h=new mi("_recoverGroupMsg");h.setMessage(u),this._getGroupRoamingMsg({groupID:l,sequence:d}).then(o=>{var{complete:e,messageList:n}=o.data;if(!$e(n)){const o=n[0].sequence,s=n.map(e=>e.sequence),a=u+` complete:${e} sequenceList:`+s;Ce.l(c+" "+a),o!==d&&o<_&&2!==e&&this._recoverGroupMsg({groupID:l,localLastMessageSequence:o,remoteLastMessageSequence:_}),h.setMessage(a).end();var r=this.get(Is);1e.sequence-t.sequence);let i=!1;for(let e=0,s=n.length;e{h.setError(e).end(),Ce.w(c+" failed. error:",e)})}_getGroupNotice(s){var e=s.length;if(Ce.l(this._n+"._getGroupNotice length:"+e),0!==e){var i=this.get(Is);if(e<=10)i.getNotice(s);else{let t=Math.floor(e/10);5<=t&&(t=5);for(let e=0;e<=t;e++)i.getNotice(s.slice(10*e,10*(e+1)))}}}_getGroupRoamingMsg(e){var{groupID:e,sequence:t}=e;return this.req({P:ti.GET_GRP_ROAMING_MSG,data:{groupID:e,count:this.PULL_LIMIT_COUNT,sequence:t+this.PULL_LIMIT_COUNT-1}})}_recoverC2CMsg(e){const o=this._n+"._recoverC2CMsg",{conversationID:n,localLastMessageTime:t,remoteLastMessageTime:r}=(Ce.l(o+" options:",e),e),a=JSON.stringify(e),c=new mi("_recoverC2CMsg");return c.setMessage(a),this._getC2CRoamingMsg({conversationID:n,time:t}).then(e=>{var{complete:t,messageList:s}=e.data;if(!$e(s)){const e=s.length;this.get(Ms).onNewMessage({dataList:s,isInstantMessage:!0});var i=s[e-1].time,s=s.map(e=>e.random),s=a+` complete:${t} randomList:`+s;if(Ce.l(o+" "+s),c.setMessage(s).end(),i{c.setError(e).end(),Ce.w(o+" failed. error:",e)})}_getC2CRoamingMsg(e){var{conversationID:e,time:s}=e;return this.req({P:ti.GET_C2C_ROAMING_MSG,data:{peerAccount:e.replace(t.CONV_C2C,""),count:this.PULL_LIMIT_COUNT+1,lastMessageTime:s,direction:1}})}reset(){Ce.l(this._n+".reset")}}class Io{constructor(){this._n="AvgE2EDelay",this._e2eDelayArray=[]}addMessageDelay(e){e=me()-e;0<=e&&this._e2eDelayArray.push(e)}_calcAvg(e,t){if(0===t)return 0;let s=0;return e.forEach(e=>{s+=e}),ft(s/t,1)}_calcCountWithLimit(e){const{e2eDelayArray:t,min:s,max:i}=e;return t.filter(e=>s<=e&&et{s+=e}),parseInt(s/t)}_calcMax(){return Math.max(...this._rttArray)}_calcMin(){return Math.min(...this._rttArray)}getStatResult(){var e,t,s=this._calcTotalCount(),i=[...this._rttArray];return 0===s?null:(e=this._calcRTTCount(i),t=this._calcSuccessRateOfRequest(e,s),i=this._calcAvg(i,e),Ce.l(`${this._n}.getStatResult max:${this._calcMax()} min:${this._calcMin()} avg:`+i),this.reset(),{totalCount:s,rttCount:e,successRateOfRequest:t,avgRTT:i})}reset(){this._requestCount=0,this._rttArray.length=0}}class To{constructor(){this._map=new Map}initMap(e){e.forEach(e=>{this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})})}addTotalCount(e){return!($e(e)||!this._map.has(e)||(this._map.get(e).totalCount+=1,0))}addSuccessCount(e){return!($e(e)||!this._map.has(e)||(this._map.get(e).successCount+=1,0))}addFailedCountOfUserSide(e){return!($e(e)||!this._map.has(e)||(this._map.get(e).failedCountOfUserSide+=1,0))}addCost(e,t){return!($e(e)||!this._map.has(e)||(this._map.get(e).costArray.push(t),0))}addFileSize(e,t){return!($e(e)||!this._map.has(e)||(this._map.get(e).fileSizeArray.push(t),0))}_calcSuccessRateOfBusiness(e){if($e(e)||!this._map.has(e))return-1;e=this._map.get(e);let t=ft(e.successCount/e.totalCount*100,2);return t=100{s+=e}),parseInt(s/t)}_calcAvgSpeed(e){let t=0,s=0;return this._map.get(e).costArray.forEach(e=>{t+=e}),this._map.get(e).fileSizeArray.forEach(e=>{s+=e}),parseInt(1e3*s/t)}getStatResult(e){var t,s,i,o,n,r=this._calcTotalCount(e);return 0===r?null:(t=this._calcSuccessCountOfBusiness(e),s=this._calcSuccessRateOfBusiness(e),i=this._calcSuccessCountOfPlatform(e),o=this._calcSuccessRateOfPlatform(e),n=this._calcAvg(e),this.reset(e),{totalCount:r,successCountOfBusiness:t,successRateOfBusiness:s,successCountOfPlatform:i,successRateOfPlatform:o,avgValue:n})}reset(e){$e(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}class yo{constructor(){this._lastMap=new Map,this._currentMap=new Map}initMap(e){e.forEach(e=>{this._lastMap.set(e,new Map),this._currentMap.set(e,new Map)})}addMessageSequence(e){const{key:s,message:i}=e;if($e(s)||!this._lastMap.has(s)||!this._currentMap.has(s))return!1;var{conversationID:o,sequence:n}=i,o=o.replace(t.CONV_GROUP,"");if(0===this._lastMap.get(s).size)this._addCurrentMap(e);else if(this._lastMap.get(s).has(o)){const t=this._lastMap.get(s).get(o),i=t.length-1;n>t[0]&&n{var e=[...e.values()],s=e.length;i+=e[s-1]-e[0]+1,o+=s}),0===i)return null;let t=ft(o/i*100,2);return 100{this._statInfoArr.push(e)}),e.removeItem(this.TAG,!1))}_onCloudConfig(){var e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),s=this.getCloudConfig("q_rpt_tinyid_wl");$e(e)||(this.REPORT_INTERVAL=Number(e)),$e(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map(e=>Number(e))),$e(s)||(this.REPORT_TINYID_WHITELIST=s.split(","))}onCheckTimer(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}addRequestCount(){this._avgRTT.addRequestCount()}addRTT(e){this._avgRTT.addRTT(e)}addMessageDelay(e){this._avgE2EDelay.addMessageDelay(e)}addTotalCount(e){this._rateMessageSent.addTotalCount(e)||Ce.w(this._n+".addTotalCount invalid key:",e)}addSuccessCount(e){this._rateMessageSent.addSuccessCount(e)||Ce.w(this._n+".addSuccessCount invalid key:",e)}addFailedCountOfUserSide(e){this._rateMessageSent.addFailedCountOfUserSide(e)||Ce.w(this._n+".addFailedCountOfUserSide invalid key:",e)}addCost(e,t){this._rateMessageSent.addCost(e,t)||Ce.w(this._n+".addCost invalid key or cost:",e,t)}addFileSize(e,t){this._rateMessageSent.addFileSize(e,t)||Ce.w(this._n+".addFileSize invalid key or size:",e,t)}addMessageSequence(e){this._rateMessageReceived.addMessageSequence(e)||Ce.w(this._n+".addMessageSequence invalid key:",e.key)}_getQualityItem(e){let t={},s=pi[this.get(Ds).getNetworkType()];$e(s)&&(s=8);var i={qualityType:_i[e],timestamp:pe(),networkType:s,extension:""};switch(e){case si:t=this._avgRTT.getStatResult();break;case ii:t=this._avgE2EDelay.getStatResult();break;case ni:case oi:case ri:case ai:case ci:t=this._rateMessageSent.getStatResult(e);break;case li:case ui:case di:t=this._rateMessageReceived.getStatResult(e)}return null===t?null:{...i,...t}}_report(e){let t=[],s=null;$e(e)?this._qualityItems.forEach(e=>{null!==(s=this._getQualityItem(e))&&(s.reportIndex=this.reportIndex,s.wholePeriod=this.wholePeriod,t.push(s))}):null!==(s=this._getQualityItem(e))&&(s.reportIndex=this.reportIndex,s.wholePeriod=this.wholePeriod,t.push(s)),Ce.d(this._n+"._report",t),0{this.reportIndex++,this.wholePeriod=!1}).catch(e=>{Ce.w(this._n+"._doReport failed. error:",e),this._statInfoArr=this._statInfoArr.concat(t),this._flushAtOnce()})}_flushAtOnce(){var t=this.get(Ss),s=t.getItem(this.TAG,!1),i=this._statInfoArr,o=this._n+"._flushAtOnce";if(Oe(s))Ce.l(o+" count:"+i.length),t.setItem(this.TAG,i,!0,!1);else{let e=i.concat(s);10 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);const t=this;this._workerTimer.onmessage=function(e){e.data?(t._timerID=e.data,Ce.l(t._n+"._init seed:"+t._timerID)):t._m.onCheckTimer()}}}_onCloudConfig(){var e=this.getCloudConfig("enable_worker");Ce.l(this._n+"._onCloudConfig enableWorker:"+e),$e(e)||"1"===e?!this._isWorkerEnabled&&ie&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&ie&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}terminate(){Ce.l(this._n+".terminate"),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null,this._timerID=-1)}getTimerID(){return this._timerID}reset(){Ce.l(this._n+".reset")}}class Eo{constructor(e){this._commercialConfigM=e,this._n="PurchasedFeatureHandler",this._isSCMReported=!1,this._featureMap=new Map}isValidPurchaseBits(e){return e&&"string"==typeof e&&1<=e.length&&e.length<=64&&/[01]{1,64}/.test(e)}parsePurchaseBits(s){if(this.isValidPurchaseBits(s)){this._featureMap.clear();var o;for(let e=s.length-1,t=0;0<=e;e--,t++)o=(t<32?new i(0,Math.pow(2,t)):new i(Math.pow(2,t-32),0)).toString(),"1"===s[e]?this._featureMap.set(o,!0):this._featureMap.set(o,!1)}else Ce.w(this._n+".parsePurchaseBits invalid purchasebits:"+s)}hasPurchasedFeature(e){return!!this._featureMap.get(e)}isFeatureEnabled(e){var s=parseInt(e).toString(2);let o=void 0,n=!0;for(let e=s.length-1,t=0;0<=e;e--,t++)if("1"===s.charAt(e)&&(o=(t<32?new i(0,Math.pow(2,t)):new i(Math.pow(2,t-32),0)).toString(),!this._featureMap.get(o))){n=!1;break}return Ce.l(`${this._n}.isFeatureEnabled decimalNumber:${e} key:${o} ret:`+n),Zs({enabled:n})}isFeatureEnabledForStat(e){var s=parseInt(e).toString(2);let o=void 0;for(let e=s.length-1,t=0;0<=e;e--,t++)if("1"===s.charAt(e)){if(o=(t<32?new i(0,Math.pow(2,t)):new i(Math.pow(2,t-32),0)).toString(),!this._featureMap.get(o))break;{let e="",t=0;if(o===M.PLUGIN_TRANSLATE?(e="plugin_translate",t=16):o===M.PLUGIN_VOICE_TO_TEXT?(e="plugin_voice_to_text",t=17):o===M.PLUGIN_CS?(e="plugin_cs",t=14):o===M.PLUGIN_PUSH?(e="plugin_push",t=13):o===M.PLUGIN_BOT?(e="plugin_bot",t=15):o===M.MSG_REACTION&&(e="plugin_emoji_reaction",t=18),""!==e){const o=this._commercialConfigM.get(vs).getUIPlatform();new mi(e).setCode(t).setUIPlatform(o).end(),Ce.l(`${this._n}.isFeatureEnabledForStat ${e} code:${t} uiPlatform:`+o)}}}}isSearchCloudMessagesEnabled(){var e;this._isSCMReported||(e=this._commercialConfigM.get(vs).getUIPlatform(),new mi("plugin_search").setCode(6).setUIPlatform(e).end(),this._isSCMReported=!0)}clear(){this._featureMap.clear(),this._isSCMReported=!1}}class Do{constructor(e){this._m=e,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new Eo(this)}_canFetch(){return this.get(vs).isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}onCheckTimer(e){this._canFetch()&&this.fetchConfig()}fetchConfig(){const e=this._canFetch(),t=this._n+".fetchConfig";if(Ce.l(t+" canFetch:"+e),e){const s=new mi("fetchCommercialConfig"),i=this.get(vs).getSDKAppID(),o=this.get(Os);this._isFetching=!0,o.req({P:ti.FETCH_COMMERCIAL_CONFIG,data:{SDKAppID:i}}).then(e=>{s.setMessage("purchaseBits:"+e.data.purchaseBits).end(),Ce.l(t+" ok."),this._parseConfig(e.data),this._isFetching=!1}).catch(e=>{s.setError(e).end(),this._isFetching=!1})}}onPushedConfig(e){var t=this._n+".onPushedConfig data:"+JSON.stringify(e);Ce.l(t),new mi("pushedCommercialConfig").setMessage("purchaseBits:"+e.purchaseBits).end(),this._parseConfig(e)}_parseConfig(e){var t=this._n+"._parseConfig",{errorCode:s,errorMessage:i,purchaseBits:o,expiredTime:n}=e;0===s?(this._purchasedFeatureHandler.parsePurchaseBits(o),this._expiredTime=Date.now()+1e3*n):$e(s)?(Ce.l(t+" failed. Invalid message format:",e),this._setExpiredTimeOnResponseError(36e5)):(Ce.e(t+` errorCode:${s} errorMessage:`+i),this._setExpiredTimeOnResponseError(12e4))}_setExpiredTimeOnResponseError(e){this._expiredTime=Date.now()+e}canIUse(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}isFeatureEnabled(e){return this._purchasedFeatureHandler.isFeatureEnabled(e)}isFeatureEnabledForStat(e){this._purchasedFeatureHandler.isFeatureEnabledForStat(e)}isSearchCloudMessagesEnabled(){this._purchasedFeatureHandler.isSearchCloudMessagesEnabled()}get(e){return this._m.get(e)}reset(){Ce.l(this._n+".reset"),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}class Ro extends ei{constructor(e){super(e),this._m=e,this._n="OfflinePushModule",this._offlinePushPlugin=void 0,this._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:"",honorPushBussinessId:""},this._deviceToken="",this._businessID=0,this._iosBusinessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0}registerPlugin(e){var t,s,i,o,n,r,a,c,l,d,_,u,h;P?(this._offlinePushPlugin=e["tim-offline-push-plugin"],{huaweiBusinessID:t,xiaomiBusinessID:s,xiaomiAppID:i,xiaomiAppKey:o,meizuBusinessID:n,meizuAppID:r,meizuAppKey:a,vivoBusinessID:c,oppoBusinessID:l,oppoAppKey:d,oppoAppSecret:_,honorBusinessID:u,iosBusinessID:h}=e.offlinePushConfig||{},this._androidPushConfig.huaweiPushBussinessId=t,this._androidPushConfig.xiaomiPushBussinessId=s,this._androidPushConfig.xiaomiPushAppId=i,this._androidPushConfig.xiaomiPushAppKey=o,this._androidPushConfig.meizuPushBussinessId=n,this._androidPushConfig.meizuPushAppId=r,this._androidPushConfig.meizuPushAppKey=a,this._androidPushConfig.vivoPushBussinessId=c,this._androidPushConfig.oppoPushBussinessId=l,this._androidPushConfig.oppoPushAppKey=d,this._androidPushConfig.oppoPushAppSecret=_,this._androidPushConfig.honorPushBussinessId=u,new mi("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:"+!$e(this._offlinePushPlugin)).end(!0),Ce.l(this._n+".registerPlugin ok. offlinePushConfig:"+JSON.stringify(e.offlinePushConfig)),this._iosBusinessID=h,this._setAppShowListener()):this.warn("OfflinePushInUniapp")}init(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}_getDeviceToken(){const a=this._n+"._getDeviceToken";if(xe(this._offlinePushPlugin.getDeviceToken)){let r=`androidPushConfig:${JSON.stringify(this._androidPushConfig)}, iosBusinessID:`+this._iosBusinessID;Ce.l(a+" start. "+r),new mi("_getDeviceToken").setMessage(r).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,e=>{const t=new mi("getDeviceTokenRes"),{code:s,msg:i}=e;if(0===s){const{deviceToken:s,deviceBrand:i,deviceType:o,bussinessId:n}=e.data;this._deviceToken=s,this._businessID=n||this._iosBusinessID,r=`deviceToken:${s}, deviceBrand:${i||o}, businessID:`+this._businessID,Ce.l(a+" ok. "+r),t.setMessage(r).end(!0),this._setToken()}else t.setMessage(`code:${s}, msg:`+i).end(!0),Ce.e(a+" failed. error:",e)})}else Ce.e(a+" getDeviceToken is not a function")}canIUseOfflinePush(){return P&&!$e(this._offlinePushPlugin)}_setAppShowListener(){const t=this._n+"._setAppShowListener";$e(this._offlinePushPlugin)?Ce.e(t+" offlinePushPlugin is undefined"):xe(this._offlinePushPlugin.setAppShowListener)?(new mi("_setAppShowListener").end(!0),Ce.l(t+" start"),this._offlinePushPlugin.setAppShowListener(e=>{e=(e||{}).appShow;new mi("setAppShowListenerRes").setMessage("appShow:"+e).end(!0),Ce.l(t+" ok. appShow:"+e),this._m.isReady()&&(0===e?(this._getConvUnreadCount(),this._onBackground()):1===e&&this._onForeground())})):Ce.e(t+" setAppShowListener is not a function")}getDeviceBrand(){var e;if(!$e(this._offlinePushPlugin)&&xe(this._offlinePushPlugin.getDeviceType))return e=(this._offlinePushPlugin.getDeviceType()||{})["deviceType"],Ce.l(this._n+".getDeviceBrand ok. deviceType:"+e),e}_setToken(){const t=this._n+"._setToken",e=this.get(vs);let s,i=1,n="",r="";Oe(this._deviceToken)&&(i=0);var a=this.getUniAppPlatform(),c=this.getDeviceBrand();a===o.IOS||a===o.IPAD||a===o.MAC?r=this._deviceToken:a===o.ANDROID&&(n=this._deviceToken);const l=new mi("offlinePushSetToken");return s=`deviceToken:${r||n}, businessID:${this._businessID}, deviceBrand:${c}, isWebUniapp:${this._isWebUniapp}, pushMsg:${i}, platform:`+a,l.setMessage(s),Ce.l(t+" "+s),this.req({P:ti.SET_TOKEN,data:{tokenID:n,pushMsg:i,sdkAppID:e.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:c,deviceToken:r,isWebUniapp:this._isWebUniapp}}).then(e=>(l.end(),Ce.l(t+" ok"),e)).catch(e=>(l.setError(e).end(),Ce.e(t+" failed. error:",e),Qs(e)))}_getConvUnreadCount(){this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(ys).getLocalConvList().forEach(e=>{e.type===t.CONV_C2C&&(this._c2cUnreadCount+=e.unreadCount),e.type===t.CONV_GROUP&&(this._groupUnreadCount+=e.unreadCount)})}_onBackground(){const t=this._n+"._onBackground",s=new mi("_onBackground");this.req({P:ti.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then(e=>(s.setMessage(`c2cUnreadCount: ${this._c2cUnreadCount}, groupUnreadCount: `+this._groupUnreadCount).end(),Ce.l(t+" ok"),e)).catch(e=>{s.setError(e).end(),Ce.e(t+" failed. error:",e)})}_onForeground(){const t=this._n+"._onForeground",s=new mi("_onForeground");this.req({P:ti.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then(e=>(s.end(),Ce.l(t+" ok"),e)).catch(e=>{s.setError(e).end(),Ce.e(t+" failed. error:",e)})}getUniAppPlatform(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?o.IOS:"android"===e?o.ANDROID:1002===t?o.IPAD:1001===t?o.MAC:void 0}reset(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,Ce.l(this._n+".reset")}}class Lo extends ei{constructor(e){super(e),this._m=e,this._n="TIMPushModule",this._pluginName="TIMPush",this._pushPlugin=void 0,this._androidPushConfig={},this._deviceToken="",this._businessID=0,this._iOSBusinessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,this._deviceInfo={notificationStatus:0,deviceModel:"",systemVersion:"",pushVersion:"1.0.1",packageName:""}}registerPlugin(e){var t,s,i;P?(t=this._n+".registerPlugin",{androidConfig:s,iOSConfig:i}=(this._pushPlugin=e["tim-push"],this._getDeviceInfo(),e.pushConfig||{}),we(s)&&(this._androidPushConfig=s[this._deviceInfo.packageName]),s=(i||{}).iOSBusinessID,this._iOSBusinessID=s,i=!$e(this._pushPlugin),new mi("registerPlugin").setMessage(this._pluginName).setMoreMessage("isExisted:"+i).end(!0),Ce.l(t+" ok. pushConfig:"+JSON.stringify(e.pushConfig)),i?(this._setAppShowListener(),this._setPushEventReportListener()):Ce.e(t+` ${this._pluginName} is undefined`)):this.warn("TIMPushInUniapp")}init(){this._isWebUniapp=this.getUniAppPlatform(),this._reportEventCacheList(),this._getDeviceToken(),this.get(ws).isFeatureEnabledForStat(Math.pow(2,41))}_reportEventCacheList(){const n=this._n+"._reportEventCacheList";xe(this._pushPlugin.getPushEventCacheList)?(new mi("_reportEventCacheList").end(!0),this._pushPlugin.getPushEventCacheList(e=>{var{code:t,data:{eventList:s}}=e,i=new mi("getPushEventCacheListRes");if(i.setCode(t),0!==t)i.setMessage("res:"+JSON.stringify(e)).end(!0),Ce.e(n+" failed. error:"+JSON.stringify(e));else{t=s.length<10?"eventList:"+JSON.stringify(s):"eventList.length:"+s.length;Ce.l(n+" ok. "+t),i.setMessage(t).end(!0);for(var o={...e.data,eventList:[]};0{const{code:t,msg:s}=e,i=new mi("getDeviceTokenRes");if(i.setCode(t),0===t){const{deviceToken:t,deviceBrand:s,deviceType:o,bussinessId:n}=e.data;this._deviceToken=t,this._businessID=n||this._iOSBusinessID,r=`deviceToken:${t} deviceBrand:${s||o} businessID:`+this._businessID,Ce.l(a+" ok. "+r),i.setMessage(r).end(!0),void this._setToken()}else i.setMessage(s).end(!0),Ce.e(a+" failed. error:"+JSON.stringify(e))})}else Ce.e(this._pluginName+".getDeviceToken is not a function")}_getDeviceInfo(){var e=this._n+"._getDeviceInfo";if(xe(this._pushPlugin.getDeviceInfo)){const t=this._pushPlugin.getDeviceInfo(),{code:s,data:i}=t,o=new mi("_getDeviceInfo");if(o.setCode(s),0===s){this._deviceInfo={...this._deviceInfo,...i},this._deviceInfo.pushVersion||(this._deviceInfo.pushVersion="1.0.1");const t="deviceInfo:"+JSON.stringify(this._deviceInfo);Ce.l(e+" ok. "+t),void o.setMessage(t).end(!0)}else o.setMessage("deviceInfoRes:"+JSON.stringify(t)).end(!0),Ce.e(e+" failed. error:"+JSON.stringify(t))}else Ce.e(this._pluginName+".getDeviceInfo is not a function")}canIUseTIMPush(){return P&&!$e(this._pushPlugin)}_setAppShowListener(){const t=this._n+"._setAppShowListener";xe(this._pushPlugin.setAppShowListener)?(new mi("_setAppShowListener").end(!0),Ce.l(t+" start"),this._pushPlugin.setAppShowListener(e=>{e=(e||{}).appShow;new mi("setAppShowListenerRes").setMessage("appShow:"+e).end(!0),Ce.l(t+" ok. appShow:"+e),this._m.isReady()&&(0===e?(this._getConvUnreadCount(),this._onBackground()):1===e&&this._onForeground())})):Ce.e(this._pluginName+".setAppShowListener is not a function")}_setPushEventReportListener(){const n=this._n+"._setPushEventReportListener";xe(this._pushPlugin.setPushEventReportListener)?(new mi("_setPushEventReportListener").end(!0),this._pushPlugin.setPushEventReportListener(e=>{var{code:t,data:s}=e,i=s["eventList"],o=new mi("setPushEventReportListenerRes");if(o.setCode(t),0===t){const e="eventList:"+JSON.stringify(i);Ce.l(n+" ok. "+e),o.setMessage(e).end(!0),void(this._m.isReady()&&be(i)&&0{d.end(),Ce.w(t+" ok")}).catch(e=>{d.setError(e).end(),Ce.e(t+" failed. error:",e),Qs(e)})}_getConvUnreadCount(){this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(ys).getLocalConvList().forEach(e=>{e.type===t.CONV_C2C&&(this._c2cUnreadCount+=e.unreadCount),e.type===t.CONV_GROUP&&(this._groupUnreadCount+=e.unreadCount)})}_onBackground(){const t=this._n+"._onBackground",s=new mi("_onBackground");this.req({P:ti.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then(()=>{s.setMessage(`c2cUnreadCount:${this._c2cUnreadCount} groupUnreadCount:`+this._groupUnreadCount).end(),Ce.l(t+" ok")}).catch(e=>{s.setError(e).end(),Ce.e(t+" failed. error:",e)})}_onForeground(){const t=this._n+"._onForeground",s=new mi("_onForeground");this.req({P:ti.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then(()=>{s.end(),Ce.l(t+" ok")}).catch(e=>{s.setError(e).end(),Ce.e(t+" failed. error:",e)})}_pushReport(e){const t=this._n+"._pushReport",s=new mi("_pushReport");this.req({P:ti.PUSH_REPORT,data:{eventList:e.eventList}}).then(()=>{s.end(),this._notifyReportSuccess(e)}).catch(e=>{s.setError(e).end(),Ce.e(t+" failed. error:",e)})}_notifyReportSuccess(e){!$e(this._pushPlugin)&&xe(this._pushPlugin.notifyReportSuccess)&&(this._pushPlugin.notifyReportSuccess(e),Ce.l(this._n+"._notifyReportSuccess ok"))}getUniAppPlatform(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?o.IOS:"android"===e?o.ANDROID:1002===t?o.IPAD:1001===t?o.MAC:void 0}reset(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,Ce.l(this._n+".reset")}}class Ao extends ei{constructor(e){super(e),this._n="ProfanityFilterModule",this._plugin=null,this._filterConfigMap=new Map,this._startIndex=0,this._version=0,this._canIUseLexicon=!1,this._isFetching=!1,this._expiredTime=0}init(){var e=this.get(Ls).getPlugin("tim-profanity-filter-plugin");e&&(this._plugin=new e({logger:Ce,isArray:be,isMap:Ne,isDevMode:this.isDevMode()}),this._getLexicon())}onCheckTimer(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}filterMessage(s,i){let o=!0;if(this._plugin&&this._canIUseLexicon&&(!i||!i.messageControlInfo||!0!==i.messageControlInfo.excludedFromContentModeration)){const{type:n,conversationType:r}=s;if(n===t.MSG_TEXT||n===t.MSG_CUSTOM){const a=this._n+".filterMessage";let e;if(Ce.l(""+a),n===t.MSG_TEXT){if(r===t.CONV_C2C?e=I:r===t.CONV_GROUP&&(e=T),!this._isConfigOn(e))return o;const{type:i,modifiedText:n}=this._plugin.filter(s.payload.text);1===i?o=!1:2===i&&(s.payload.text=n)}else if(n===t.MSG_CUSTOM){if(r===t.CONV_C2C?e=C:r===t.CONV_GROUP&&(e=y),!this._isConfigOn(e))return o;const i=this._plugin.filter(s.payload.data),n=this._plugin.filter(s.payload.description),a=this._plugin.filter(s.payload.extension);1===i.type||1===n.type||1===a.type?o=!1:(2===i.type&&(s.payload.data=i.modifiedText),2===n.type&&(s.payload.description=n.modifiedText),2===a.type&&(s.payload.extension=a.modifiedText))}Ce.l(a+" done. isAllowedToSend:"+o)}}return o}filterText(e,t){var s=this._n+".filterText",i={isAllowedToSend:!0,modifiedText:e};return this._plugin&&this._canIUseLexicon&&this._isConfigOn(t)&&(Ce.l(s),{type:t,modifiedText:e}=this._plugin.filter(e),1===t?i.isAllowedToSend=!1:2===t&&(i.modifiedText=e),Ce.l(s+" done. ret:",i)),i}_getLexicon(){const d=new mi("profanityFilter"),_=this._n+"._getLexicon";this._isFetching=!0,this.req({P:ti.GET_PROFANITY_LIST,data:{startIndex:this._startIndex,version:this._version}}).then(e=>{var{errorInfo:e,filterConfig:t,lexicon:s,strToken:i,completeFlag:o,nextStartIndex:n,version:r,expiredTime:a}=e.data,{errorCode:c,errorMessage:l}=e;return 0!==c?(this._isFetching=!1,Ce.w(_+" failed. error:",e),void d.setCode(c).setMessage(l).end()):(this._onFilterConfig(t),this._getToken(i),1===o?(Ce.l(_+` done. version:${r} expiredTime:`+a),this._version=r,this._canIUseLexicon=!0,this._isFetching=!1,this._expiredTime=Date.now()+1e3*a,void this._plugin.onLexiconCompleted(s)):(this._startIndex=n,this._plugin.onLexiconSliced(s),void this._getLexicon()))}).catch(e=>{d.setError(e).end(),this._isFetching=!1,Ce.l(_+" failed. error:",e)})}_onFilterConfig(t){Oe(t)||(this._filterConfigMap.clear(),Object.keys(t).forEach(e=>{this._filterConfigMap.set(e,t[e])}),Ce.l(`${this._n}._onFilterConfig. keys:${Array.from(this._filterConfigMap.keys())} values:`+Array.from(this._filterConfigMap.values())))}_isConfigOn(e){return 1===this._filterConfigMap.get(e)}_getToken(s){if(ke(s)){var i=s.length;let t="";if(i%2==0)for(let e=0;e<=i-1;e+=2)t=(t+=s[e+1])+s[e];else{for(let e=0;e{this._TRTCCommandList.includes(e)||this._TRTCCommandList.push(e)}),this._setTRTCCommandMap())}_setTRTCCommandMap(){var s;for(let e=0,t=this._TRTCCommandList.length;e=this.STORAGE_EXPIRES_TIME,t=!t||"3.4.7"!==t;return Ce.l(this._n+`._needToUpdate isTimeout:${e} isDifferentVersion:`+t),e||t}_fetch(){if(!this._m.get(vs).isPrivateNetWork()){const e="https://web.sdk.qcloud.com/im/download/error-message/v3/0.0.6/tim-error-message.txt",t="application/x-www-form-urlencoded;charset=UTF-8",s=this._n+"._fetch ok in",i=this;if(k)$.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:e=>{i._fillAndSave(e.data),Ce.l(s+" mini program")},fail:()=>{}});else{const o=new XMLHttpRequest,n=setTimeout(()=>{o.abort()},3e3);o.onreadystatechange=function(){4===o.readyState&&(clearTimeout(n),200!==o.status&&304!==o.status||(Ce.l(s+" browser"),i._fillAndSave(o.responseText)))},o.open("GET",e,!0),o.setRequestHeader("Content-type",t),o.send()}}}_fillAndSave(e){this._fillMap(e),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:e,localSavedTime:(new Date).getTime(),localSavedVersion:"3.4.7"}),!0,!1)}_getStorageModule(){return this._m.get(Ss)}_fillMap(e){this._map.clear();var t,s,i=e.split(";\n"),o=i.length,n=new RegExp(/'/g);for(let e=0;e>>16&65535|0,r=0;0!==s;){for(s-=r=2e3>>1:s>>>1;e[t]=s}return e}(),ko=function(e,t,s,i){var o=Go,n=i+s;e^=-1;for(var r=i;r>>8^o[255&(e^t[r])];return-1^e},wo=function(e,t){var s,i,o,n,r,a,c=e.state,l=e.next_in,d=e.input,_=l+(e.avail_in-5),u=e.next_out,h=e.output,p=u-(t-e.avail_out),g=u+(e.avail_out-257),m=c.dmax,f=c.wsize,M=c.whave,I=c.wnext,C=c.window,v=c.hold,T=c.bits,y=c.lencode,E=c.distcode,S=(1<>>=i=s>>>24,T-=i,0==(i=s>>>16&255))h[u++]=65535&s;else{if(!(16&i)){if(0==(64&i)){s=y[(65535&s)+(v&(1<>>=i,T-=i),T<15&&(v+=d[l++]<>>=i=s>>>24,T-=i,!(16&(i=s>>>16&255))){if(0==(64&i)){s=E[(65535&s)+(v&(1<m){e.msg="invalid distance too far back",c.mode=30;break e}if(v>>>=i,T-=i,n>(i=u-p)){if((i=n-i)>M&&c.sane){e.msg="invalid distance too far back",c.mode=30;break e}if(a=C,(r=0)===I){if(r+=f-i,i>3,v&=(1<<(T-=o<<3))-1,e.next_in=l,e.next_out=u,e.avail_in=l<_?_-l+5:5-(l-_),e.avail_out=uh?(g=P[U+r[I]],R[L+r[I]]):(g=96,0),c=1<<(p=M-E),C=l=1<>E)+(l-=c)]=p<<24|g<<16|m|0,0!==l;);for(c=1<>=1;if(0!==c?O=(O&c-1)+c:O=0,I++,0==--A[M]){if(M===v)break;M=t[s+r[I]]}if(T>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function Bo(){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 Po.Buf16(320),this.work=new Po.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Ko(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Po.Buf32(852),t.distcode=t.distdyn=new Po.Buf32(592),t.sane=1,t.back=-1,0):-2}function Ho(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,Ko(e)):-2}function Wo(e,t){var s,i;return!e||!e.state||(i=e.state,t<0?(s=0,t=-t):(s=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(Po.arraySet(e.window,t,s-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):((o=e.wsize-e.wnext)>i&&(o=i),Po.arraySet(e.window,t,s-i,o,e.wnext),(i-=o)?(Po.arraySet(e.window,t,s-i,i,0),e.wnext=i,e.whave=e.wsize):(e.wnext+=o,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,s.check=ko(s.check,O,2,0),d=l=0,s.mode=2;else if(s.flags=0,s.head&&(s.head.done=!1),!(1&s.wrap)||(((255&l)<<8)+(l>>8))%31)e.msg="incorrect header check",s.mode=30;else if(8!=(15&l))e.msg="unknown compression method",s.mode=30;else{if(d-=4,T=8+(15&(l>>>=4)),0===s.wbits)s.wbits=T;else if(T>s.wbits){e.msg="invalid window size",s.mode=30;break}s.dmax=1<>8&1),512&s.flags&&(O[0]=255&l,O[1]=l>>>8&255,s.check=ko(s.check,O,2,0)),d=l=0,s.mode=3;case 3:for(;d<32;){if(0===a)break e;a--,l+=i[n++]<>>8&255,O[2]=l>>>16&255,O[3]=l>>>24&255,s.check=ko(s.check,O,4,0)),d=l=0,s.mode=4;case 4:for(;d<16;){if(0===a)break e;a--,l+=i[n++]<>8),512&s.flags&&(O[0]=255&l,O[1]=l>>>8&255,s.check=ko(s.check,O,2,0)),d=l=0,s.mode=5;case 5:if(1024&s.flags){for(;d<16;){if(0===a)break e;a--,l+=i[n++]<>>8&255,s.check=ko(s.check,O,2,0)),d=l=0}else s.head&&(s.head.extra=null);s.mode=6;case 6:if(1024&s.flags&&((h=(h=s.length)>a?a:h)&&(s.head&&(T=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Array(s.head.extra_len)),Po.arraySet(s.head.extra,i,n,h,T)),512&s.flags&&(s.check=ko(s.check,i,h,n)),a-=h,n+=h,s.length-=h),s.length))break e;s.length=0,s.mode=7;case 7:if(2048&s.flags){if(0===a)break e;for(h=0;T=i[n+h++],s.head&&T&&s.length<65536&&(s.head.name+=String.fromCharCode(T)),T&&h>9&1,s.head.done=!0),e.adler=s.check=0,s.mode=12;break;case 10:for(;d<32;){if(0===a)break e;a--,l+=i[n++]<>>=7&d,d-=7&d,s.mode=27;else{for(;d<3;){if(0===a)break e;a--,l+=i[n++]<>>=1)){case 0:s.mode=14;break;case 1:if(Xo(s),s.mode=20,6!==t)break;l>>>=2,d-=2;break e;case 2:s.mode=17;break;case 3:e.msg="invalid block type",s.mode=30}l>>>=2,d-=2}break;case 14:for(l>>>=7&d,d-=7&d;d<32;){if(0===a)break e;a--,l+=i[n++]<>>16^65535)){e.msg="invalid stored block lengths",s.mode=30;break}if(s.length=65535&l,d=l=0,s.mode=15,6===t)break e;case 15:s.mode=16;case 16:if(h=s.length){if(0===(h=c<(h=a>>=5,d-=5,s.ndist=1+(31&l),l>>>=5,d-=5,s.ncode=4+(15&l),l>>>=4,d-=4,286>>=3,d-=3}for(;s.have<19;)s.lens[R[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,E={bits:s.lenbits},y=xo(0,s.lens,0,19,s.lencode,0,s.work,E),s.lenbits=E.bits,y){e.msg="invalid code lengths set",s.mode=30;break}s.have=0,s.mode=19;case 19:for(;s.have>>16&255,M=65535&D,!((m=D>>>24)<=d);){if(0===a)break e;a--,l+=i[n++]<>>=m,d-=m,s.lens[s.have++]=M;else{if(16===M){for(S=m+2;d>>=m,d-=m,0===s.have){e.msg="invalid bit length repeat",s.mode=30;break}T=s.lens[s.have-1],h=3+(3&l),l>>>=2,d-=2}else if(17===M){for(S=m+3;d>>=m)),l>>>=3,d=d-m-3}else{for(S=m+7;d>>=m)),l>>>=7,d=d-m-7}if(s.have+h>s.nlen+s.ndist){e.msg="invalid bit length repeat",s.mode=30;break}for(;h--;)s.lens[s.have++]=T}}if(30===s.mode)break;if(0===s.lens[256]){e.msg="invalid code -- missing end-of-block",s.mode=30;break}if(s.lenbits=9,E={bits:s.lenbits},y=xo(1,s.lens,0,s.nlen,s.lencode,0,s.work,E),s.lenbits=E.bits,y){e.msg="invalid literal/lengths set",s.mode=30;break}if(s.distbits=6,s.distcode=s.distdyn,E={bits:s.distbits},y=xo(2,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,E),s.distbits=E.bits,y){e.msg="invalid distances set",s.mode=30;break}if(s.mode=20,6===t)break e;case 20:s.mode=21;case 21:if(6<=a&&258<=c){e.next_out=r,e.avail_out=c,e.next_in=n,e.avail_in=a,s.hold=l,s.bits=d,wo(e,u),r=e.next_out,o=e.output,c=e.avail_out,n=e.next_in,i=e.input,a=e.avail_in,l=s.hold,d=s.bits,12===s.mode&&(s.back=-1);break}for(s.back=0;f=(D=s.lencode[l&(1<>>16&255,M=65535&D,!((m=D>>>24)<=d);){if(0===a)break e;a--,l+=i[n++]<>I)])>>>16&255,M=65535&D,!(I+(m=D>>>24)<=d);){if(0===a)break e;a--,l+=i[n++]<>>=I,d-=I,s.back+=I}if(l>>>=m,d-=m,s.back+=m,s.length=M,0===f){s.mode=26;break}if(32&f){s.back=-1,s.mode=12;break}if(64&f){e.msg="invalid literal/length code",s.mode=30;break}s.extra=15&f,s.mode=22;case 22:if(s.extra){for(S=s.extra;d>>=s.extra,d-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=23;case 23:for(;f=(D=s.distcode[l&(1<>>16&255,M=65535&D,!((m=D>>>24)<=d);){if(0===a)break e;a--,l+=i[n++]<>I)])>>>16&255,M=65535&D,!(I+(m=D>>>24)<=d);){if(0===a)break e;a--,l+=i[n++]<>>=I,d-=I,s.back+=I}if(l>>>=m,d-=m,s.back+=m,64&f){e.msg="invalid distance code",s.mode=30;break}s.offset=M,s.extra=15&f,s.mode=24;case 24:if(s.extra){for(S=s.extra;d>>=s.extra,d-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){e.msg="invalid distance too far back",s.mode=30;break}s.mode=25;case 25:if(0===c)break e;if(s.offset>(h=u-c)){if((h=s.offset-h)>s.whave&&s.sane){e.msg="invalid distance too far back",s.mode=30;break}p=h>s.wnext?(h-=s.wnext,s.wsize-h):s.wnext-h,h>s.length&&(h=s.length),g=s.window}else g=o,p=r-s.offset,h=s.length;for(c-=h=c>>6:(s<65536?t[o++]=224|s>>>12:(t[o++]=240|s>>>18,t[o++]=128|s>>>12&63),t[o++]=128|s>>>6&63),t[o++]=128|63&s);return t},rr=function(e){for(var t=new Po.Buf8(e.length),s=0,i=t.length;s>10&1023,n[r++]=56320|1023&s)}return nr(n,r)},cr=function(e,t){for(var s=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=s&&128==(192&e[s]);)s--;return!(s<0||0===s)&&s+sr[e[s]]>t?s:t},lr={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},ur={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"},dr=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},_r=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},hr=Object.prototype.toString;function pr(e){if(!(this instanceof pr))return new pr(e);this.options=Po.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options,e=(t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits)&&(t.windowBits=-15),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15{t=s.modules[e],"group-module"===e?this._map.set(Is,new t(this)):"relationship-module"===e?this._map.set(Cs,new t(this)):"signaling-module"===e?this._map.set(Vs,new t(this)):"follow-module"===e&&this._map.set(Ks,new t(this)),this._optionalModuleMap.set(e,1)}),this._map.get(vs).setUsingChatCore(!0)}else this._map.has(Is)||this._map.get(vs).setUsingChatCore(!0);var{instanceID:t,SDKAppID:i}=s,t=`instanceID:${t} SDKAppID:${i} isIntl:${this._map.get(vs).isIntl()} isUsingChatCore:${this._map.get(vs).isUsingChatCore()} host:${_t()} isIOSWebView:${re} platform:${V} canIUseInflate:${this.canIUseInflate()} workerAvailable:${ie} eventThrottling:${this._eventThrottling} UserAgent:`+q;mi.bindEventStatModule(this._map.get(Es)),mi.bindNetMonitorModule(this._map.get(Ds)),e.setMessage(t+" "+function(){let t="";if(k)try{var{model:e,version:s,system:i,platform:o,SDKVersion:n}=$.getSystemInfoSync();t=`model:${e} version:${s} system:${i} platform:${o} SDKVersion:`+n}catch(e){t=""}return t}()).end(),Ce.i("SDK "+t),zs.prototype._getErrMsg=this.getErrMsg.bind(this),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}_startTimer(){var e=this._map.get(Us),t=e.isWorkerEnabled();Ce.l(this._n+`.startTimer isWorkerEnabled:${t} seed:`+this._checkTimer),t?e.startWorkerTimer():this._startMainThreadTimer()}_startMainThreadTimer(){this._checkTimer<0&&(this._checkTimer=setInterval(this.onCheckTimer.bind(this),1e3)),Ce.l(this._n+"._startMainThreadTimer seed:"+this._checkTimer)}stopTimer(){var e=this._map.get(Us),t=e.isWorkerEnabled();Ce.l(this._n+`.stopTimer isWorkerEnabled:${t} seed:`+this._checkTimer),t?e.stopWorkerTimer():this._stopMainThreadTimer()}_stopMainThreadTimer(){Ce.l(this._n+"._stopMainThreadTimer"),0{e.ready(()=>this._onModuleReady())})}_onModuleReady(){let t=!0;if(this._readyList.forEach(e=>{e.isReady()||(t=!1)}),t&&!this._isReady){this._isReady=!0,this._oEmitter.emit(e.SDK_READY);const t=Date.now()-this._startLoginTs;Ce.w(`SDK is ready. cost ${t} ms`),this._startLoginTs=Date.now();var s=this._ssoLogForReady.getStartTs()+he;this._ssoLogForReady.setMessage(t).start(s).end()}}login(){0===this._startLoginTs&&(ge(),this._startLoginTs=Date.now(),this._startTimer(),this._map.get(Ds).start(),this._ssoLogForReady=new mi("sdkReady"),this._reason=js.LOGGING_IN)}onLoginFailed(){this._startLoginTs=0}getOEmitInst(){return null===this._oEmitter&&(this._oEmitter=new On,Xs(this._oEmitter),this._oEmitter._emit=this._oEmitter.emit,this._oEmitter.emit=function(t,s){if(this._canIUseSignaling()&&(t===e.MESSAGE_RECEIVED&&this.get(Vs).onNewMessageList(s),t===e.MESSAGE_MODIFIED)&&this.get(Vs).onMessageModified(s),t===e.CONVERSATION_LIST_UPDATED||t===e.FRIEND_LIST_UPDATED||t===e.GROUP_LIST_UPDATED||t===e.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)if(!1!==this._eventThrottling)if(this._eventThrottleMap.has(t)){const e=Date.now(),s=this._eventThrottleMap.get(t);e-s.last<=1e3?(s.timeoutID&&clearTimeout(s.timeoutID),s.timeoutID=setTimeout(()=>{s.last=Date.now(),this._oEmitter._emit.apply(this._oEmitter,[t,{name:t,data:this._getEventData(t)}])},1e3)):(s.last=e,this._oEmitter._emit.apply(this._oEmitter,[t,{name:t,data:this._getEventData(t)}]))}else this._eventThrottleMap.set(t,{last:Date.now(),timeoutID:-1}),this._oEmitter._emit.apply(this._oEmitter,[t,{name:t,data:this._getEventData(t)}]);else this._oEmitter._emit.apply(this._oEmitter,[t,{name:t,data:this._getEventData(t)}]);else this._oEmitter._emit.apply(this._oEmitter,[t,{name:t,data:s}])}.bind(this)),this._oEmitter}_canIUseSignaling(){var e=this.get(Vs);return!!e&&e.canIUseSignaling()}_getEventData(t){return t===e.CONVERSATION_LIST_UPDATED?this._map.get(vs).isPartialUpdatedConvs()?this._map.get(ys).getPartialUpdatedConvs():this._map.get(ys).getLocalConvList():t===e.FRIEND_LIST_UPDATED?this._map.get(Cs).getLocalFriendList(!1):t===e.GROUP_LIST_UPDATED?this._map.get(Is).getLocalGroupList():t===e.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._map.get(ys).getTotalUnreadCount():t===e.CONVERSATION_ID_LIST_UPDATED?this._map.get(ys).getUpdatedConvIDList():void 0}getIEmitInst(){return null===this._iEmitter&&(this._iEmitter=new On,this._iEmitter._emit=this._iEmitter.emit,this._iEmitter.emit=function(e,t){e=Fe(t)&&t.data?[e,{name:e,data:t.data}]:[e,{name:e,data:t}];this._iEmitter._emit.apply(this._iEmitter,e)}.bind(this)),this._iEmitter}hasModule(e){return this._map.has(e)}get(e){return this._map.get(e)}canIUseModule(e){return!this._map.get(vs).isUsingChatCore()||this._optionalModuleMap.has(e)}canIUseInflate(){return!!this._map.get(Ws)}isReady(){return this._isReady}isIntl(){return this.get(vs).isIntl()}getNotReadyReason(){return this._reason}setNotReadyReason(e){this._reason=e}getErrMsg(e,t,s){return this._map.get(xs).get({key:e,replacement1:t,replacement2:s,isIntl:this.isIntl()})}warn(e,t,s){e=this.getErrMsg(e,t,s);e&&Ce.w(e)}onError(t){var s=`code:${t.code} message:`+t.message;Ce.w("Oops! "+s),new mi("error").setMessage(s).setLevel("error").end(),this.getOEmitInst().emit(e.ERROR,t)}restartTimer(){Ce.l(this._n+".restartTimer"),this.stopTimer(),this._startTimer();var e=this.get(Is);e&&e.restartPolling()}getTimerID(){var e=this._map.get(Us);return e.isWorkerEnabled()?e.getTimerID():this._checkTimer}getPollingTimerID(e){return this._map.get(Is).getPollingTimerID(e)}reset(){Ce.l(this._n+".reset"),ge();for(const[,e]of this._map)e.reset&&e.reset();this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._oEmitter.emit(e.SDK_NOT_READY);for(const[,e]of this._eventThrottleMap)e.timeoutID&&clearTimeout(e.timeoutID);this._eventThrottleMap.clear()}}class Tr{constructor(e){this._funcMap=new Map,this._m=e,this._n="SafetyCallback",this._reportCount=0}defense(e,t,s){if("string"!=typeof e)return null;if(0===e.length)return null;if("function"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);let i=null;return this._funcMap.get(e).has(t)?i=this._funcMap.get(e).get(t):(i=this._pack(e,t,s),this._funcMap.get(e).set(t,i)),i}defenseOnce(e,t,s){return"function"!=typeof t?null:this._pack(e,t,s)}find(e,t){return"string"!=typeof e||0===e.length||"function"!=typeof t?null:this._funcMap.has(e)&&this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(this._m.warn("ListenerFnNotFound",e),null)}delete(e,t){return"function"==typeof t&&!!this._funcMap.has(e)&&!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),0===this._funcMap.get(e).size&&this._funcMap.delete(e),!0)}_pack(s,i,o){const n=this;return function(){try{i.apply(o,Array.from(arguments))}catch(t){const i=Object.values(e).indexOf(s),o="CallbackError";if(-1!==i){const s=Object.keys(e)[i];n._m.warn(o,s,t)}n._reportCount<5&&(new mi(o).setMessage("eventName:"+s).setMoreMessage(t.message).end(),n._reportCount+=1)}}}destroy(){this._funcMap.clear()}reset(){Ce.l(this._n+".reset"),this._reportCount=0}}class yr{constructor(e){e={SDKAppID:e.SDKAppID,unlimitedAVChatRoom:e.unlimitedAVChatRoom||!1,scene:e.scene||"",oversea:e.oversea||!1,instanceID:dt(),devMode:e.devMode||!1,testEnv:e.testEnv||!1,proxyServer:e.proxyServer||void 0,fileUploadProxy:e.fileUploadProxy||void 0,fileDownloadProxy:e.fileDownloadProxy||e.fileUploadProxy||void 0,eventThrottling:!1!==e.eventThrottling,partialUpdatedConversations:!0===e.partialUpdatedConversations,modules:e.modules||void 0};this._m=new Cr(e),this._safetyCallbackFactory=new Tr(this._m)}onError(e){this._m.onError(e)}login(e){return this._m.login(),this._get(ps).login(e)}logout(){return this._get(ps).logout().then(e=>(this._safetyCallbackFactory.reset(),this._m.reset(),e))}getLoginUser(){return this._get(ps).getLoginUser()}getServerTime(){return pe()}isReady(){return this._m.isReady()}isIntl(){return this._m.isIntl()}getNotReadyReason(){return this._m.getNotReadyReason()}getErrMsg(e,t,s){return this._m.getErrMsg(e,t,s)}_get(e){return this._m.get(e)}destroy(){const t=this._get(vs),s=t.getSDKAppID();return Ce.w(`destroy ${s} `+t.getInstanceID()),this.logout().finally(()=>{this._safetyCallbackFactory.destroy(),this._m.stopTimer(),this._get(Us).terminate(),this._get(Ns).dealloc(),this._m.getOEmitInst().emit(e.SDK_DESTROY,{SDKAppID:s})})}on(e,t,s){Ce.d("on","eventName:"+e),this._m.getOEmitInst().on(e,this._safetyCallbackFactory.defense(e,t,s),s)}once(e,t,s){Ce.d("once","eventName:"+e),this._m.getOEmitInst().once(e,this._safetyCallbackFactory.defenseOnce(e,t,s),s||this)}off(e,t,s,i){Ce.d("off","eventName:"+e);var o=this._safetyCallbackFactory.find(e,t);null!==o&&(this._m.getOEmitInst().off(e,o,s,i),this._safetyCallbackFactory.delete(e,t))}registerPlugin(e){($e(e["tim-push"])?$e(e["tim-offline-push-plugin"])?this._get(Ls):this._get(Fs):this._get(Hs)).registerPlugin(e)}setLogLevel(e){if(e<=0){const e=this.getErrMsg("TIM_ASCII_ART");e&&console.log(e);var t=this.getErrMsg("API_REFER");if(t){const e="IM SDK API ->";vt()?console.log(`%c ${e} %c`,"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",t):console.log(e,t)}t=this.getErrMsg("DOCS_GUIDE"),t=(t&&console.log(t),this.getErrMsg("IOS_WEBVIEW_WARNING"));re&&t&&console.warn(t)}Ce.setLevel(e)}createTextMessage(e){return this._get(gs).createTextMessage(e)}createTextAtMessage(e){return this._get(gs).createTextMessage(e)}createImageMessage(e){return this._get(gs).createImageMessage(e)}createAudioMessage(e){return this._get(gs).createAudioMessage(e)}createVideoMessage(e){return this._get(gs).createVideoMessage(e)}createCustomMessage(e){return this._get(gs).createCustomMessage(e)}createFaceMessage(e){return this._get(gs).createFaceMessage(e)}createFileMessage(e){return this._get(gs).createFileMessage(e)}createLocationMessage(e){return this._get(gs).createLocationMessage(e)}createMergerMessage(e){return this._get(gs).createMergerMessage(e)}downloadMergerMessage(e){return e.type!==t.MSG_MERGER?Qs({code:js.MSG_MERGER_TYPE_INVALID}):Oe(e.payload.downloadKey)?Qs({code:js.MSG_MERGER_KEY_INVALID}):this._get(gs).downloadMergerMessage(e).catch(e=>Qs({code:js.MSG_MERGER_DOWNLOAD_FAIL}))}createForwardMessage(e){return this._get(gs).createForwardMessage(e)}sendMessage(e,t){return e instanceof wi?this._get(gs).sendMessageInstance(e,t):Qs({code:js.MSG_INSTANCE_REQUIRED})}searchCloudMessages(e){return this._get(gs).searchCloudMessages(e)}callExperimentalAPI(e,t){return"sendComboMessage"===e?this._get(qs).sendMessage(t):"handleGroupInvitation"===e?this._get(Is).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._get(ws).isFeatureEnabled(t):"isFeatureEnabledForStat"===e?this._get(ws).isFeatureEnabledForStat(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e||"sendRoomCustomData"===e?this._get($s).sendTRTCCustomData(t):"getTimerID"===e?this._m.getTimerID():"getPollingTimerID"===e?this._m.getPollingTimerID(t):"setApplicationID"!==e?"getServerConfig"===e?this._get(Ps).getServerConfig(t):"canIUseModule"===e?this._m.canIUseModule(t):"startMessageLongPolling"===e?this._get(Is).startMessageLongPolling(t):"stopMessageLongPolling"===e?this._get(Is).stopMessageLongPolling(t):"disableMessagePullOnInvite"===e?this._get(ys).disableMsgPullOnInvite(t):"clearLocalMessage"===e?this._get(ys).clearMemMsg(t,!1):"setCustomLoginInfo"===e?this._get(vs).setCustomLoginInfo(t):Qs({code:js.INVALID_OPERATION}):(this._get(vs).setApplicationID(t),void this._get(Os).updateProtocolConfig())}revokeMessage(e){return this._get(gs).revokeMessage(e)}resendMessage(e,t){return e instanceof wi?this._get(gs).resendMessage(e,t):Qs({code:js.MSG_INSTANCE_REQUIRED})}deleteMessage(e){return this._get(gs).deleteMessage(e)}translateText(e){return this._get(gs).translateText(e)}convertVoiceToText(e){return this._get(gs).convertVoiceToText(e)}setMessageExtensions(e,t){return this._get(ms).setMessageExtensions(e,t)}getMessageExtensions(e){return this._get(ms).getMessageExtensions(e)}deleteMessageExtensions(e,t){return this._get(ms).deleteMessageExtensions(e,t)}addMessageReaction(e,t){return this._get(Bs).addMessageReaction(e,t)}removeMessageReaction(e,t){return this._get(Bs).removeMessageReaction(e,t)}getMessageReactions(e){return this._get(Bs).getMessageReactions(e)}getAllUserListOfMessageReaction(e){return this._get(Bs).getAllUserListOfMessageReaction(e)}modifyMessage(e){return this._get(gs).modifyRemoteMessage(e)}getMessageList(e){return this._get(ys).getMessageList(e)}getMessageListHopping(e){return this._get(ys).getMessageListHopping(e)}sendMessageReadReceipt(e){return this._get(ys).sendReadReceipt(e)}getMessageReadReceiptList(e){return this._get(ys).getReadReceiptList(e)}getGroupMessageReadMemberList(e){var t=this._get(Is);return t?t.getReadReceiptDetail(e):Qs({code:js.NO_MODULE})}findMessage(e){return this._get(ys).findMessage(e)}setMessageRead(e){return this._get(ys).setMessageRead(e)}getConversationList(e){return this._get(ys).getConvList(e)}getConversationProfile(e){return this._get(ys).getConversationProfile(e)}deleteConversation(e){return this._get(ys).deleteConversation(e)}setConversationDraft(e){return this._get(ys).setConvDraft(e)}clearHistoryMessage(e){return this._get(ys).clearHistoryMessage(e)}pinConversation(e){return this._get(ys).pinConversation(e)}setAllMessageRead(e){return this._get(ys).setAllMessageRead(e)}setMessageRemindType(e){return this._get(ys).setMessageRemindType(e)}setAllReceiveMessageOpt(e){return this._get(ys).setAllRcvMsgOpt(e)}getAllReceiveMessageOpt(){return this._get(ys).getAllRcvMsgOpt()}getTotalUnreadMessageCount(){return this._get(ys).getTotalUnreadCount()}setConversationCustomData(e){return this._get(ys).setConvCustomData(e)}markConversation(e){return this._get(ys).markConv(e)}getConversationGroupList(){return this._get(ys).getConvGroupList()}createConversationGroup(e){return this._get(ys).createConvGroup(e)}deleteConversationGroup(e){return this._get(ys).deleteConvGroup(e)}renameConversationGroup(e){return this._get(ys).renameConvGroup(e)}addConversationsToGroup(e){return this._get(ys).addConvsToGroup(e)}deleteConversationsFromGroup(e){return this._get(ys).deleteConvsFromGroup(e)}getMyProfile(){return this._get(fs).getMyProfile()}getUserProfile(e){return this._get(fs).getUserProfile(e)}updateMyProfile(e){return this._get(fs).updateMyProfile(e)}getBlacklist(){return this._get(fs).getLocalBlacklist()}addToBlacklist(e){return this._get(fs).addBlacklist(e)}removeFromBlacklist(e){return this._get(fs).deleteBlacklist(e)}setSelfStatus(e){return this._get(fs).setSelfStatus(e)}getUserStatus(e){return this._get(fs).getUserStatus(e)}subscribeUserStatus(e){return this._get(fs).subscribeUserStatus(e)}unsubscribeUserStatus(e){return this._get(fs).unsubscribeUserStatus(e)}getFriendList(){var e=this._get(Cs);return e?e.getLocalFriendList():Qs({code:js.NO_MODULE})}addFriend(e){var t=this._get(Cs);return t?t.addFriend(e):Qs({code:js.NO_MODULE})}deleteFriend(e){var t=this._get(Cs);return t?t.deleteFriend(e):Qs({code:js.NO_MODULE})}checkFriend(e){var t=this._get(Cs);return t?t.checkFriend(e):Qs({code:js.NO_MODULE})}getFriendProfile(e){var t=this._get(Cs);return t?t.getFriendProfile(e):Qs({code:js.NO_MODULE})}updateFriend(e){var t=this._get(Cs);return t?t.updateFriend(e):Qs({code:js.NO_MODULE})}getFriendApplicationList(){var e=this._get(Cs);return e?e.getLocalFriendApplicationList():Qs({code:js.NO_MODULE})}acceptFriendApplication(e){var t=this._get(Cs);return t?t.acceptFriendApplication(e):Qs({code:js.NO_MODULE})}refuseFriendApplication(e){var t=this._get(Cs);return t?t.refuseFriendApplication(e):Qs({code:js.NO_MODULE})}deleteFriendApplication(e){var t=this._get(Cs);return t?t.deleteFriendApplication(e):Qs({code:js.NO_MODULE})}setFriendApplicationRead(){var e=this._get(Cs);return e?e.setFriendApplicationRead():Qs({code:js.NO_MODULE})}getFriendGroupList(){var e=this._get(Cs);return e?e.getLocalFriendGroupList():Qs({code:js.NO_MODULE})}createFriendGroup(e){var t=this._get(Cs);return t?t.createFriendGroup(e):Qs({code:js.NO_MODULE})}deleteFriendGroup(e){var t=this._get(Cs);return t?t.deleteFriendGroup(e):Qs({code:js.NO_MODULE})}addToFriendGroup(e){var t=this._get(Cs);return t?t.addToFriendGroup(e):Qs({code:js.NO_MODULE})}removeFromFriendGroup(e){var t=this._get(Cs);return t?t.removeFromFriendGroup(e):Qs({code:js.NO_MODULE})}renameFriendGroup(e){var t=this._get(Cs);return t?t.renameFriendGroup(e):Qs({code:js.NO_MODULE})}followUser(e){var t=this._get(Ks);return t?t.followUser(e):Qs({code:js.NO_MODULE})}unfollowUser(e){var t=this._get(Ks);return t?t.unfollowUser(e):Qs({code:js.NO_MODULE})}getMyFollowersList(e){var t=this._get(Ks);return t?t.getMyFollowersList(e):Qs({code:js.NO_MODULE})}getMyFollowingList(e){var t=this._get(Ks);return t?t.getMyFollowingList(e):Qs({code:js.NO_MODULE})}getMutualFollowersList(e){var t=this._get(Ks);return t?t.getMutualFollowersList(e):Qs({code:js.NO_MODULE})}getUserFollowInfo(e){var t=this._get(Ks);return t?t.getUserFollowInfo(e):Qs({code:js.NO_MODULE})}checkFollowType(e){var t=this._get(Ks);return t?t.checkFollowType(e):Qs({code:js.NO_MODULE})}getGroupList(){var e=this._get(Is);return e?e.getGroupList():Qs({code:js.NO_MODULE})}getGroupProfile(e){var t=this._get(Is);return t?t.getGroupProfile(e):Qs({code:js.NO_MODULE})}createGroup(e){var t=this._get(Is);return t?t.createGroup(e):Qs({code:js.NO_MODULE})}dismissGroup(e){var t=this._get(Is);return t?t.dismissGroup(e):Qs({code:js.NO_MODULE})}updateGroupProfile(e){var t=this._get(Is);return t?t.updateGroupProfile(e):Qs({code:js.NO_MODULE})}joinGroup(e){var t=this._get(Is);return t?t.joinGroup(e):Qs({code:js.NO_MODULE})}quitGroup(e){var t=this._get(Is);return t?t.quitGroup(e):Qs({code:js.NO_MODULE})}searchGroupByID(e){var t=this._get(Is);return t?t.searchGroupByID(e):Qs({code:js.NO_MODULE})}getGroupOnlineMemberCount(e){var t=this._get(Is);return t?t.getGroupOnlineMemberCount(e):Qs({code:js.NO_MODULE})}changeGroupOwner(e){var t=this._get(Is);return t?t.changeGroupOwner(e):Qs({code:js.NO_MODULE})}getGroupApplicationList(){var e=this._get(Is);return e?e.getGroupApplicationList():Qs({code:js.NO_MODULE})}handleGroupApplication(e){var t=this._get(Is);return t?t.handleGroupApplication(e):Qs({code:js.NO_MODULE})}initGroupAttributes(e){var t=this._get(Is);return t?t.initGroupAttributes(e):Qs({code:js.NO_MODULE})}setGroupAttributes(e){var t=this._get(Is);return t?t.setGroupAttributes(e):Qs({code:js.NO_MODULE})}deleteGroupAttributes(e){var t=this._get(Is);return t?t.deleteGroupAttributes(e):Qs({code:js.NO_MODULE})}getGroupAttributes(e){var t=this._get(Is);return t?t.getGroupAttributes(e):Qs({code:js.NO_MODULE})}setGroupCounters(e){var t=this._get(Is);return t?t.setGroupCounters(e):Qs({code:js.NO_MODULE})}increaseGroupCounter(e){var t=this._get(Is);return t?t.increaseGroupCounter(e):Qs({code:js.NO_MODULE})}decreaseGroupCounter(e){var t=this._get(Is);return t?t.decreaseGroupCounter(e):Qs({code:js.NO_MODULE})}getGroupCounters(e){var t=this._get(Is);return t?t.getGroupCounters(e):Qs({code:js.NO_MODULE})}getGroupMemberList(e){var t=this._get(Is);return t?t.getGroupMemberList(e):Qs({code:js.NO_MODULE})}getGroupMemberProfile(e){var t=this._get(Is);return t?t.getGroupMemberProfile(e):Qs({code:js.NO_MODULE})}addGroupMember(e){var t=this._get(Is);return t?t.addGroupMember(e):Qs({code:js.NO_MODULE})}deleteGroupMember(e){var t=this._get(Is);return t?t.deleteGroupMember(e):Qs({code:js.NO_MODULE})}setGroupMemberMuteTime(e){var t=this._get(Is);return t?t.setGroupMemberMuteTime(e):Qs({code:js.NO_MODULE})}setGroupMemberRole(e){var t=this._get(Is);return t?t.setGroupMemberRole(e):Qs({code:js.NO_MODULE})}setGroupMemberNameCard(e){var t=this._get(Is);return t?t.setGroupMemberNameCard(e):Qs({code:js.NO_MODULE})}setGroupMemberCustomField(e){var t=this._get(Is);return t?t.setGroupMemberCustomField(e):Qs({code:js.NO_MODULE})}markGroupMemberList(e){var t=this._get(Is);return t?t.markGroupMemberList(e):Qs({code:js.NO_MODULE})}getJoinedCommunityList(){return this._get(Ts).getJoinedCommunityList()}createTopicInCommunity(e){return this._get(Ts).createTopicInCommunity(e)}deleteTopicFromCommunity(e){return this._get(Ts).deleteTopicFromCommunity(e)}updateTopicProfile(e){return this._get(Ts).updateTopicProfile(e)}getTopicList(e){return this._get(Ts).getTopicList(e)}addSignalingListener(e,t,s){var i=this._get(Vs);i&&i.addSignalingListener(e,this._safetyCallbackFactory.defense(e,t,s),s)}removeSignalingListener(e,t,s){var i,o=this._safetyCallbackFactory.find(e,t);null!==o&&(i=this._get(Vs))&&(i.removeSignalingListener(e,o,s),this._safetyCallbackFactory.delete(e,t))}invite(e){var t=this._get(Vs);return t?t.invite(e):Qs({code:js.NO_MODULE})}inviteSync(e,t,s){var i=this._get(Vs);return i?i.inviteSync(e,t,s):""}inviteInGroup(e){var t=this._get(Vs);return t?t.invite(e):Qs({code:js.NO_MODULE})}inviteInGroupSync(e,t,s){var i=this._get(Vs);return i?i.inviteSync(e,t,s):""}cancel(e){var t=this._get(Vs);return t?t.cancel(e):Qs({code:js.NO_MODULE})}accept(e){var t=this._get(Vs);return t?t.accept(e):Qs({code:js.NO_MODULE})}reject(e){var t=this._get(Vs);return t?t.reject(e):Qs({code:js.NO_MODULE})}getSignalingInfo(e){var t=this._get(Vs);return t?t.getSignalingInfo(e):null}modifyInvitation(e){var t=this._get(Vs);return t?t.modifyInvitation(e):Qs({code:js.NO_MODULE})}}const vr={login:1,logout:1,getLoginUser:1,destroy:1,on:1,off:1,ready:1,setLogLevel:1,joinGroup:1,quitGroup:1,registerPlugin:1,getGroupOnlineMemberCount:1,isReady:1,addSignalingListener:1,removeSignalingListener:1,callExperimentalAPI:1};function Sr(e,t){var s;return!(!e.isReady()&&1!==vr[t])||(s={code:s=e.getNotReadyReason(),message:e.getErrMsg(s)+` | ${t} | `+e.getErrMsg(js.SDK_IS_NOT_READY)},e.onError(s),s)}const Er={},Dr={create:function(t){var i="TencentCloudChat.create";let o=0;var n=t["SDKAppID"];if(Ge(n))o=n;else if(o=parseInt(n),isNaN(n))return Ce.e(i+" failed. Failed to parse the SDKAppID, please check the arguments"),null;if(o&&Er[o])return Er[o];Ce.l(i);n=new yr({...t,SDKAppID:o}),n.on(e.SDK_DESTROY,e=>{Er[e.data.SDKAppID]=null,delete Er[e.data.SDKAppID]}),t=function(o){const e=Object.create(null);return Object.keys(hs).forEach(i=>{if(o[i]){const t=new s;e[i]=function(){var e=Array.from(arguments);return t.use(function(e,t){var s=Sr(o,i);return!0===s?t():Qs(s)}).use(function(e,t){if(!0===Rt(e,_s[i],i))return t()}).use(function(e,t){return o[i].apply(o,e)}),t.run(e)}}}),e}(n);return Er[o]=t,_s.hookGetAPITips(n.getErrMsg.bind(n)),Ce.l(i+" ok"),t}};Dr.TYPES=t,Dr.EVENT=e,Dr.TSignaling={NEW_INVITATION_RECEIVED:"newInvitationReceived",INVITEE_ACCEPTED:"ts_invitee_accepted",INVITEE_REJECTED:"ts_invitee_rejected",INVITATION_CANCELLED:"ts_invitation_cancelled",INVITATION_TIMEOUT:"ts_invitation_timeout",INVITATION_MODIFIED:"ts_invitation_modified",ACTION_TYPE_UNKNOWN:0,ACTION_TYPE_INVITE:1,ACTION_TYPE_CANCEL_INVITE:2,ACTION_TYPE_ACCEPT_INVITE:3,ACTION_TYPE_REJECT_INVITE:4,ACTION_TYPE_INVITE_TIMEOUT:5},Dr.VERSION="3.4.7",Ce.l("TencentCloudChat.VERSION:"+Dr.VERSION);export{Dr as default};