import { __commonJS } from "./chunk-TDUMLE5V.js"; // ../../../../../桌面/jiuyiUniapp/jiuyi2/node_modules/@tencentcloud/chat/index.js var require_chat = __commonJS({ "../../../../../桌面/jiuyiUniapp/jiuyi2/node_modules/@tencentcloud/chat/index.js"(exports, module) { !function(e, t) { "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).TencentCloudChat = t(); }(exports, function() { function U(t2, e2) { var n2, o2 = Object.keys(t2); return Object.getOwnPropertySymbols && (n2 = Object.getOwnPropertySymbols(t2), e2 && (n2 = n2.filter(function(e3) { return Object.getOwnPropertyDescriptor(t2, e3).enumerable; })), o2.push.apply(o2, n2)), o2; } function y(t2) { for (var e2 = 1; e2 < arguments.length; e2++) { var n2 = null != arguments[e2] ? arguments[e2] : {}; e2 % 2 ? U(Object(n2), true).forEach(function(e3) { F(t2, e3, n2[e3]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t2, Object.getOwnPropertyDescriptors(n2)) : U(Object(n2)).forEach(function(e3) { Object.defineProperty(t2, e3, Object.getOwnPropertyDescriptor(n2, e3)); }); } return t2; } function b(e2) { return (b = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e3) { return typeof e3; } : function(e3) { return e3 && "function" == typeof Symbol && e3.constructor === Symbol && e3 !== Symbol.prototype ? "symbol" : typeof e3; })(e2); } function d(e2, t2) { if (!(e2 instanceof t2)) throw new TypeError("Cannot call a class as a function"); } function w(e2, t2) { for (var n2 = 0; n2 < t2.length; n2++) { var o2 = t2[n2]; o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, o2.key, o2); } } function e(e2, t2, n2) { return t2 && w(e2.prototype, t2), n2 && w(e2, n2), Object.defineProperty(e2, "prototype", { writable: false }), e2; } function F(e2, t2, n2) { return t2 in e2 ? Object.defineProperty(e2, t2, { value: n2, enumerable: true, configurable: true, writable: true }) : e2[t2] = n2, e2; } function t(e2, t2) { if ("function" != typeof t2 && null !== t2) throw new TypeError("Super expression must either be null or a function"); e2.prototype = Object.create(t2 && t2.prototype, { constructor: { value: e2, writable: true, configurable: true } }), Object.defineProperty(e2, "prototype", { writable: false }), t2 && x(e2, t2); } function q(e2) { return (q = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e3) { return e3.__proto__ || Object.getPrototypeOf(e3); })(e2); } function x(e2, t2) { return (x = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e3, t3) { return e3.__proto__ = t3, e3; })(e2, t2); } function V() { if ("undefined" == typeof Reflect || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if ("function" == typeof Proxy) return true; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { })), true; } catch (e2) { return false; } } function H(e2, t2, n2) { return (H = V() ? Reflect.construct.bind() : function(e3, t3, n3) { var o2 = [null], t3 = (o2.push.apply(o2, t3), new (Function.bind.apply(e3, o2))()); return n3 && x(t3, n3.prototype), t3; }).apply(null, arguments); } function B(e2) { var n2 = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0; return function(e3) { if (null === e3 || -1 === Function.toString.call(e3).indexOf("[native code]")) return e3; if ("function" != typeof e3) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== n2) { if (n2.has(e3)) return n2.get(e3); n2.set(e3, t2); } function t2() { return H(e3, arguments, q(this).constructor); } return t2.prototype = Object.create(e3.prototype, { constructor: { value: t2, enumerable: false, writable: true, configurable: true } }), x(t2, e3); }(e2); } function K(e2, t2) { if (null == e2) return {}; var n2, o2 = function(e3, t3) { if (null == e3) return {}; for (var n3, o3 = {}, i3 = Object.keys(e3), a3 = 0; a3 < i3.length; a3++) n3 = i3[a3], 0 <= t3.indexOf(n3) || (o3[n3] = e3[n3]); return o3; }(e2, t2); if (Object.getOwnPropertySymbols) for (var i2 = Object.getOwnPropertySymbols(e2), a2 = 0; a2 < i2.length; a2++) n2 = i2[a2], 0 <= t2.indexOf(n2) || Object.prototype.propertyIsEnumerable.call(e2, n2) && (o2[n2] = e2[n2]); return o2; } function i(e2) { if (void 0 === e2) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e2; } function n(n2) { var o2 = V(); return function() { var e2, t2 = q(n2), t2 = (e2 = o2 ? (e2 = q(this).constructor, Reflect.construct(t2, arguments, e2)) : t2.apply(this, arguments), this); if (e2 && ("object" == typeof e2 || "function" == typeof e2)) return e2; if (void 0 !== e2) throw new TypeError("Derived constructors may only return object or undefined"); return i(t2); }; } function Y(e2, t2) { return W(e2) || function(e3, t3) { var n2 = null == e3 ? null : "undefined" != typeof Symbol && e3[Symbol.iterator] || e3["@@iterator"]; if (null != n2) { var o2, i2, a2 = [], s2 = true, r2 = false; try { for (n2 = n2.call(e3); !(s2 = (o2 = n2.next()).done) && (a2.push(o2.value), !t3 || a2.length !== t3); s2 = true) ; } catch (e4) { r2 = true, i2 = e4; } finally { try { s2 || null == n2.return || n2.return(); } finally { if (r2) throw i2; } } return a2; } }(e2, t2) || J(e2, t2) || X(); } function p(e2) { return function(e3) { if (Array.isArray(e3)) return z(e3); }(e2) || j(e2) || J(e2) || function() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }(); } function W(e2) { if (Array.isArray(e2)) return e2; } function j(e2) { if ("undefined" != typeof Symbol && null != e2[Symbol.iterator] || null != e2["@@iterator"]) return Array.from(e2); } function J(e2, t2) { var n2; if (e2) return "string" == typeof e2 ? z(e2, t2) : "Map" === (n2 = "Object" === (n2 = Object.prototype.toString.call(e2).slice(8, -1)) && e2.constructor ? e2.constructor.name : n2) || "Set" === n2 ? Array.from(e2) : "Arguments" === n2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2) ? z(e2, t2) : void 0; } function z(e2, t2) { (null == t2 || t2 > e2.length) && (t2 = e2.length); for (var n2 = 0, o2 = new Array(t2); n2 < t2; n2++) o2[n2] = e2[n2]; return o2; } function X() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function Z(e2, t2) { var n2, o2, i2, a2, s2 = "undefined" != typeof Symbol && e2[Symbol.iterator] || e2["@@iterator"]; if (s2) return i2 = !(o2 = true), { s: function() { s2 = s2.call(e2); }, n: function() { var e3 = s2.next(); return o2 = e3.done, e3; }, e: function(e3) { i2 = true, n2 = e3; }, f: function() { try { o2 || null == s2.return || s2.return(); } finally { if (i2) throw n2; } } }; if (Array.isArray(e2) || (s2 = J(e2)) || t2 && e2 && "number" == typeof e2.length) return s2 && (e2 = s2), a2 = 0, { s: t2 = function() { }, n: function() { return a2 >= e2.length ? { done: true } : { done: false, value: e2[a2++] }; }, e: function(e3) { throw e3; }, f: t2 }; throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var h = { 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" }, A = { 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" }, Q = { 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 }, $ = (e(de, [{ key: "use", value: function(e2) { if ("function" != typeof e2) throw "middleware must be a function"; return this.cache.push(e2), this; } }, { key: "next", value: function(e2) { if (this.middlewares && 0 < this.middlewares.length) return this.middlewares.shift().call(this, this.options, this.next.bind(this)); } }, { key: "run", value: function(e2) { return this.middlewares = this.cache.map(function(e3) { return e3; }), this.options = e2, this.next(); } }]), de), ee = (e(le, [{ key: "equal", value: function(e2) { return null !== e2 && this.low === e2.low && this.high === e2.high; } }, { key: "toString", value: function() { var e2 = Number(this.high).toString(16), t2 = Number(this.low).toString(16); if (t2.length < 8) for (var n2 = 8 - t2.length; n2; ) t2 = "0" + t2, n2--; return e2 + t2; } }]), le), te = { TEST: { CHINA: { DEFAULT: "wss://wss-dev.tim.qq.com" }, OVERSEA: { DEFAULT: "wss://wss-dev.tim.qq.com" }, SINGAPORE: { DEFAULT: "wss://wsssgp-dev.im.qcloud.com" }, KOREA: { DEFAULT: "wss://wsskr-dev.im.qcloud.com" }, GERMANY: { DEFAULT: "wss://wssger-dev.im.qcloud.com" }, IND: { DEFAULT: "wss://wssind-dev.im.qcloud.com" }, JPN: { DEFAULT: "wss://wssjpn-dev.im.qcloud.com" }, USA: { DEFAULT: "wss://wssusa-dev.im.qcloud.com" }, INDONESIA: { DEFAULT: "wss://wssidn-dev.im.qcloud.com" } }, PRODUCTION: { CHINA: { DEFAULT0: "wss://*w4c.my-imcloud.com", DEFAULT: "wss://wss.im.qcloud.com", BACKUP: "wss://wss.tim.qq.com", STAT: "https://events.im.qcloud.com", ANYCAST: "wss://162.14.13.203" }, OVERSEA: { DEFAULT0: "wss://*w4c.my-imcloud.com", DEFAULT: "wss://wss.im.qcloud.com", BACKUP: "wss://wss.my-imcloud.com", STAT: "https://api.my-imcloud.com" }, SINGAPORE: { DEFAULT0: "wss://*w4s.my-imcloud.com", DEFAULT: "wss://wsssgp.im.qcloud.com", BACKUP: "wss://wsssgp.my-imcloud.com", STAT: "https://apisgp.my-imcloud.com", ANYCAST: "wss://162.14.19.159" }, KOREA: { DEFAULT0: "wss://*w4k.my-imcloud.com", DEFAULT: "wss://wsskr.im.qcloud.com", BACKUP: "wss://wsskr.my-imcloud.com", STAT: "https://apikr.my-imcloud.com", ANYCAST: "wss://162.14.13.104" }, GERMANY: { DEFAULT0: "wss://*w4g.my-imcloud.com", DEFAULT: "wss://wssger.im.qcloud.com", BACKUP: "wss://wssger.my-imcloud.com", STAT: "https://apiger.my-imcloud.com", ANYCAST: "wss://162.14.3.17" }, IND: { DEFAULT0: "wss://*w4i.my-imcloud.com", DEFAULT: "wss://wssind.my-imcloud.com", BACKUP: "wss://wssind.im.qcloud.com", STAT: "https://apiind.my-imcloud.com", ANYCAST: "wss://162.14.18.188" }, JPN: { DEFAULT0: "wss://*w4j.my-imcloud.com", DEFAULT: "wss://wssjpn.im.qcloud.com", BACKUP: "wss://wssjpn.my-imcloud.com", STAT: "https://apijpn.my-imcloud.com" }, USA: { DEFAULT0: "wss://*w4u.my-imcloud.com", DEFAULT: "wss://wssusa.im.qcloud.com", BACKUP: "wss://wssusa.my-imcloud.com", STAT: "https://apiusa.my-imcloud.com", ANYCAST: "wss://162.14.10.42" }, INDONESIA: { DEFAULT0: "wss://*w4y.my-imcloud.com", DEFAULT: "wss://wssidn.im.qcloud.com", BACKUP: "wss://wssidn.my-imcloud.com", STAT: "https://apiidn.my-imcloud.com", ANYCAST: "wss://43.129.34.169" } } }, ne = { ANDROID: 2, IOS: 3, MAC: 4, WEB: 7, WX_MP: 8, QQ_MP: 9, TT_MP: 10, BAIDU_MP: 11, ALI_MP: 12, IPAD: 13, UNI_NATIVE_APP: 15, DONUT_NATIVE_APP: 19, NS_NATIVE_APP: 20, RN_NATIVE_APP: 21 }, oe = "1.7.3", ae = 537048168, se = "CHINA", a = { HOST: { CURRENT: { DEFAULT: "wss://wss.im.qcloud.com", STAT: "https://events.im.qcloud.com" }, setCurrent: function() { this.CURRENT = te.PRODUCTION[0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : se]; } }, NAME: { OPEN_IM: "openim", OPEN_IM_MSG_EXT: "openim_msg_ext_http_svc", GRP: "group_open_http_svc", GRP_AV: "group_open_avchatroom_http_svc", GRP_COMMUNITY: "million_group_open_http_svc", GRP_ATTR: "group_open_attr_http_svc", FD: "sns", PROFILE: "profile", RECENT_CONTACT: "recentcontact", PIC: "openpic", BIG_GRP_NO_AUTH: "group_open_http_noauth_svc", BIG_GRP_POLLING: "group_open_long_polling_http_svc", BIG_GRP_POLLING_NO_AUTH: "group_open_long_polling_http_noauth_svc", IM_OPEN_STAT: "imopenstat", WEB_IM: "webim", IM_COS_SIGN: "im_cos_sign_svr", CUSTOM_UPLOAD: "im_cos_msg", HEARTBEAT: "heartbeat", IM_OPEN_PUSH: "im_open_push", IM_OPEN_STATUS: "im_open_status", IM_LONG_MSG: "im_long_msg", IM_CONFIG_MANAGER: "im_sdk_config_mgr", STAT_SERVICE: "StatSvc", OVERLOAD_PUSH: "OverLoadPush", IM_MSG_AUDIT_MGR: "im_msg_audit_mgr", TUIROOM_SVR: "tui_room_svr", IM_OPEN_TRANSLATE: "im_open_translate", IM_OPEN_SPEECH: "im_open_speech", MSG_SEARCH: "message_search", FOLLOW: "follow", OFFLINE_PUSH_REPORT: "offline_push_report", IM_MSG_LOGIC: "im_msg_db_logic" } }, _ = { SEARCH_GRP_SNS: new ee(0, Math.pow(2, 1)).toString(), AV_HISTORY_MSG: new ee(0, Math.pow(2, 2)).toString(), GRP_COMMUNITY: new ee(0, Math.pow(2, 3)).toString(), MSG_TO_SPECIFIED_GRP_MBR: new ee(0, Math.pow(2, 4)).toString(), AV_MBR_LIST: new ee(0, Math.pow(2, 6)).toString(), USER_STATUS: new ee(0, Math.pow(2, 7)).toString(), CONV_MARK: new ee(0, Math.pow(2, 9)).toString(), CONV_GROUP: new ee(0, Math.pow(2, 10)).toString(), AV_BAN_MBR: new ee(0, Math.pow(2, 11)).toString(), MSG_EXT: new ee(0, Math.pow(2, 13)).toString(), GRP_COUNTER: new ee(0, Math.pow(2, 15)).toString(), PLUGIN_TRANSLATE: new ee(Math.pow(2, 6)).toString(), PLUGIN_VOICE_TO_TEXT: new ee(Math.pow(2, 7)).toString(), PLUGIN_CS: new ee(Math.pow(2, 8)).toString(), PLUGIN_PUSH: new ee(Math.pow(2, 9)).toString(), PLUGIN_BOT: new ee(Math.pow(2, 10)).toString(), MSG_REACTION: new ee(Math.pow(2, 16)).toString(), FOLLOW: new ee(Math.pow(2, 20)).toString() }, re = "group_profile", ce = ["Type", "Name", "Introduction", "Notification", "FaceUrl", "Owner_Account", "CreateTime", "InfoSeq", "LastInfoTime", "LastMsgTime", "MemberNum", "MaxMemberNum", "ApplyJoinOption", "NextMsgSeq", "ShutUpAllMember", "InviteJoinOption"], ue = ["Role", "JoinTime", "MsgSeq", "MsgFlag"]; function le() { var e2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0, t2 = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; d(this, le), this.high = e2, this.low = t2; } function de() { d(this, de), this.cache = [], this.options = null; } a.HOST.setCurrent(se); for (var pe, _e = "undefined" != typeof wx && "function" == typeof wx.getSystemInfoSync && Boolean(wx.getSystemInfoSync().fontSizeSetting), he = _e && "function" == typeof wx.createGamePortal, ge = "undefined" != typeof qq && "function" == typeof qq.getSystemInfoSync && Boolean(qq.getSystemInfoSync().fontSizeSetting), fe = "undefined" != typeof tt && "function" == typeof tt.getSystemInfoSync && Boolean(tt.getSystemInfoSync().fontSizeSetting), me = "undefined" != typeof swan && "function" == typeof swan.getSystemInfoSync && Boolean(swan.getSystemInfoSync().fontSizeSetting), ve = "undefined" != typeof my && "function" == typeof my.getSystemInfoSync && Boolean(my.getSystemInfoSync().fontSizeSetting), o = "undefined" != typeof jd && "function" == typeof jd.getSystemInfoSync, Ie = "undefined" != typeof uni && "undefined" == typeof window && "function" == typeof uni.requireNativePlugin, s = _e && "object" === b(wx.miniapp), Me = "undefined" != typeof uni, v = _e || ge || fe || me || ve || Ie || o, r = "undefined" == typeof window && !v && "undefined" != typeof global && void 0 !== global.NativeScriptGlobals, ye = "undefined" != typeof global && (void 0 !== global.nativeModuleProxy || void 0 !== global.ReactNative), Ce = "undefined" != typeof uni ? !v : "undefined" != typeof window && !v && !ye, I = ge ? qq : fe ? tt : me ? swan : ve ? my : _e ? wx : Ie ? uni : o ? jd : {}, Te = Ce && window && window.navigator && window.navigator.userAgent || "", De = (o = "WEB", /(micromessenger|webbrowser)/i.test(Te) ? o = "WEB" : ge ? o = "QQ_MP" : fe ? o = "TT_MP" : me ? o = "BAIDU_MP" : ve ? o = "ALI_MP" : _e ? o = s ? "DONUT_NATIVE_APP" : "WX_MP" : Ie ? o = "UNI_NATIVE_APP" : r ? o = "NS_NATIVE_APP" : ye && (o = "RN_NATIVE_APP"), ne[o]), s = /iPad/i.test(Te), r = /iPhone/i.test(Te) && !s, o = /iPod/i.test(Te), Ee = r || s || o, Le = (r = Te.match(/OS (\d+)_/i)) && r[1] ? r[1] : null, Se = /Android/i.test(Te), ke = (s = Te.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i)) ? (o = s[1] && parseFloat(s[1]), r = s[2] && parseFloat(s[2]), o && r ? parseFloat(s[1] + "." + s[2]) : o || null) : null, r = /Edge/i.test(Te), s = !r && /Chrome/i.test(Te), Ae = /MSIE/.test(Te) || -1 < Te.indexOf("Trident") && -1 < Te.indexOf("rv:11.0"), Re = o = !(o = (o = /MSIE\s(\d+)\.\d/.exec(Te)) && parseFloat(o[1])) && /Trident\/7.0/i.test(Te) && /rv:11.0/.test(Te) ? 11 : o, o = /Safari/i.test(Te) && !s && !Se && !r, Oe = /Windows/i.test(Te), Ne = /MAC OS X/i.test(Te), Ge = Ce && "undefined" != typeof Worker && !Ae, Pe = Se || Ee, Ue = Ce && void 0 !== window.tencent_cloud_im_csig_flutter_for_web_25F_cy, be = "undefined" != typeof window && void 0 !== window.navigator && (s = window.navigator.standalone, !(!Ee || s || o)), we = "undefined" != typeof console ? console : "undefined" != typeof global && global.console ? global.console : "undefined" != typeof window && window.console ? window.console : {}, Fe = function() { }, qe = ["assert", "clear", "count", "debug", "dir", "dirxml", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "profile", "profileEnd", "table", "time", "timeEnd", "timeStamp", "trace", "warn"], xe = qe.length; xe--; ) pe = qe[xe], console[pe] || (we[pe] = Fe); function Ve() { var e2 = /* @__PURE__ */ new Date(); return e2.setTime(We()), e2; } function He() { Ye = 0; } function Be() { return Math.floor(We() / 1e3); } var Ke = we, Ye = 0, We = function() { return (/* @__PURE__ */ new Date()).getTime() + Ye; }, je = 0; function Je() { return Qt() ? "%c Chat %c" : "Chat"; } function ze() { var e2 = Ve(); return e2.toLocaleTimeString("en-US", { hour12: false }) + "." + function(e3) { var t2; switch (e3.toString().length) { case 1: t2 = "00" + e3; break; case 2: t2 = "0" + e3; break; default: t2 = e3; } return t2; }(e2.getMilliseconds()); } var M = { arguments2String: function(e2) { var t2 = ""; if (1 === e2.length) t2 = e2[0]; else for (var n2 = 0, o2 = e2.length; n2 < o2; n2++) { if (Ct(e2[n2])) try { t2 += Tt(e2[n2]) ? JSON.stringify(e2[n2], ["message", "code"]) : JSON.stringify(e2[n2]); } catch (e3) { t2 += e3 ? e3.message : ""; break; } else t2 += e2[n2]; t2 += " "; } return t2; }, _exec: function(e2, t2) { Qt() ? Ke[e2](Je(), "background:#0abf5b; padding:1px; border-radius:3px; color: #fff", "background:transparent", ze(), t2) : Ke[e2]("".concat(Je(), " ").concat(ze(), " ").concat(t2)); }, d: function() { var e2; je <= -1 && (e2 = this.arguments2String(arguments), this._exec("debug", e2)); }, l: function() { var e2; je <= 0 && (e2 = this.arguments2String(arguments), this._exec("log", e2)); }, log: function() { var e2; je <= 0 && (e2 = this.arguments2String(arguments), this._exec("log", e2)); }, i: function() { var e2; je <= 1 && (e2 = this.arguments2String(arguments), this._exec("info", e2)); }, w: function() { var e2; je <= 2 && (e2 = this.arguments2String(arguments), this._exec("warn", e2)); }, e: function() { var e2; je <= 3 && (e2 = this.arguments2String(arguments), this._exec("error", e2)); }, setLevel: function(e2) { e2 < 4 && this._exec("log", "set level from " + je + " to " + e2), je = e2; }, getLevel: function() { return je; } }, Xe = { JPG: 1, JPEG: 1, GIF: 2, PNG: 3, BMP: 4, UNKNOWN: 255 }, r = "Tag_Profile_IM_", g = { NICK: "".concat(r, "Nick"), GENDER: "".concat(r, "Gender"), BIRTHDAY: "".concat(r, "BirthDay"), LOCATION: "".concat(r, "Location"), SELFSIGNATURE: "".concat(r, "SelfSignature"), ALLOWTYPE: "".concat(r, "AllowType"), LANGUAGE: "".concat(r, "Language"), AVATAR: "".concat(r, "Image"), MESSAGESETTINGS: "".concat(r, "MsgSettings"), ADMINFORBIDTYPE: "".concat(r, "AdminForbidType"), LEVEL: "".concat(r, "Level"), ROLE: "".concat(r, "Role") }, Ze = { GROUP: "".concat("Tag_SNS_IM_", "Group"), REMARK: "".concat("Tag_SNS_IM_", "Remark"), ADDSOURCE: "".concat("Tag_SNS_IM_", "AddSource"), ADDWORDING: "".concat("Tag_SNS_IM_", "Wording"), ADDTIME: "".concat("Tag_SNS_IM_", "AddTime") }, s = "Gender_Type_", Qe = { UNKNOWN: "".concat(s, "Unknown"), FEMALE: "".concat(s, "Female"), MALE: "".concat(s, "Male") }, $e = { NONE: "".concat("AdminForbid_Type_", "None"), SEND_OUT: "".concat("AdminForbid_Type_", "SendOut") }, et = { NEED_CONFIRM: "".concat("AllowType_Type_", "NeedConfirm"), ALLOW_ANY: "".concat("AllowType_Type_", "AllowAny"), DENY_ANY: "".concat("AllowType_Type_", "DenyAny") }, nt = "JoinedSuccess", ot = "WaitAdminApproval", it = "@TOPIC#_", at = Object.prototype.hasOwnProperty; function S(e2) { if (null == e2) return true; if ("boolean" == typeof e2) return false; if ("number" == typeof e2) return 0 === e2; if ("string" == typeof e2) return 0 === e2.length; if ("function" == typeof e2) return 0 === e2.length; if (Array.isArray(e2)) return 0 === e2.length; if (e2 instanceof Error) return "" === e2.message; if (f(e2)) { for (var t2 in e2) if (at.call(e2, t2)) return false; return true; } return !!(st(e2) || rt(e2) || ct(e2)) && 0 === e2.size; } function st(e2) { return "map" === Dt(e2); } function rt(e2) { return "set" === Dt(e2); } function ct(e2) { return "file" === Dt(e2); } function R(e2) { return null !== e2 && ("number" == typeof e2 && !isNaN(+e2) || "object" === b(e2) && e2.constructor === Number); } function ut(e2) { return null !== e2 && "object" === b(e2); } function f(e2) { if ("object" === b(e2) && null !== e2) { if (null === (e2 = Object.getPrototypeOf(e2))) return 1; for (var t2 = e2; null !== Object.getPrototypeOf(t2); ) t2 = Object.getPrototypeOf(t2); return e2 === t2; } } function O(e2) { return "function" == typeof Array.isArray ? Array.isArray(e2) : "array" === Dt(e2); } function lt(e2) { return "function" == typeof e2; } function dt(e2) { return "filelist" === Dt(e2); } function pt(e2) { return "string" == typeof e2 && (e2 = e2[0], !/[^a-zA-Z0-9]/.test(e2)); } function _t(e2, t2, n2, o2) { if (!Ct(e2) || !Ct(t2)) return 0; for (var i2, a2 = 0, s2 = Object.keys(t2), r2 = 0, c2 = s2.length; r2 < c2; r2++) if (i2 = s2[r2], !(N(t2[i2]) || n2 && n2.includes(i2))) if (Ct(e2[i2]) && Ct(t2[i2])) a2 += _t(e2[i2], t2[i2], n2, o2); else { if (o2 && o2.includes(t2[i2])) continue; e2[i2] !== t2[i2] && (e2[i2] = t2[i2], a2 += 1); } return a2; } function ht(e2, t2) { var n2, o2 = /* @__PURE__ */ new Map(), i2 = Z(e2.entries()); try { for (i2.s(); !(n2 = i2.n()).done; ) { var a2 = Y(n2.value, 2), s2 = a2[0], r2 = a2[1]; r2 && o2.set(s2, t2 ? JSON.stringify(r2) : JSON.parse(JSON.stringify(r2))); } } catch (e3) { i2.e(e3); } finally { i2.f(); } return o2; } function gt(e2) { if (0 === e2.length) return 0; for (var t2 = 0, n2 = 0, o2 = "undefined" != typeof document && void 0 !== document.characterSet ? document.characterSet : "UTF-8"; void 0 !== e2[t2]; ) n2 += e2[t2++].charCodeAt[t2] <= 255 ? 1 : false === o2 ? 3 : 2; return n2; } function ft(e2) { return e2 = e2 || 99999999, Math.round(Math.random() * e2); } function mt() { for (var e2 = "", t2 = 32; 0 < t2; --t2) e2 += Et[Math.floor(Math.random() * Lt)]; return e2; } function vt(e2, t2) { for (var n2 in e2) if (e2[n2] === t2) return 1; } function It(e2) { return -1 === e2.indexOf("http://") || -1 === e2.indexOf("https://") ? "https://" + e2 : e2.replace(/https|http/, "https"); } function Mt(e2) { if (0 === Object.getOwnPropertyNames(e2).length) return /* @__PURE__ */ Object.create(null); var t2, n2, o2 = Array.isArray(e2) ? [] : /* @__PURE__ */ Object.create(null); for (n2 in e2) null !== e2[n2] ? void 0 !== e2[n2] ? (t2 = b(e2[n2]), 0 <= ["string", "number", "function", "boolean"].indexOf(t2) ? o2[n2] = e2[n2] : o2[n2] = Mt(e2[n2])) : o2[n2] = void 0 : o2[n2] = null; return o2; } var yt = ["url"], m = function(e2) { return "string" == typeof e2; }, N = function(e2) { return void 0 === e2; }, Ct = function(e2) { return O(e2) || ut(e2); }, Tt = function(e2) { return e2 instanceof Error; }, Dt = function(e2) { return Object.prototype.toString.call(e2).match(/^\[object (.*)\]$/)[1].toLowerCase(); }, Et = (Date.now || (Date.now = function() { return (/* @__PURE__ */ new Date()).getTime(); }), "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), Lt = Et.length, St = {}; function kt(o2, e2) { var i2; return !(!O(o2) || !O(e2)) && (i2 = false, e2.forEach(function(e3) { var t2 = e3.key, e3 = e3.value, n2 = o2.find(function(e4) { return e4.key === t2; }); n2 ? n2.value !== e3 && (n2.value = e3, i2 = true) : (o2.push({ key: t2, value: e3 }), i2 = true); }), i2); } function At(e2) { return S(e2) ? [] : e2.filter(function(e3) { return true === e3.isModified; }); } function Rt(e2) { return S(e2) ? [] : e2.filter(function(e3) { return false === e3.isModified; }); } function Ot(e2) { return e2 === A.GRP_AVCHATROOM; } function Nt(e2) { var t2 = e2.type, e2 = e2.groupID; return t2 === A.GRP_COMMUNITY || "".concat(e2).startsWith("@TGS#_") && !"".concat(e2).includes(it); } function Gt(e2) { return "".concat(e2).startsWith("@TGS#_") && "".concat(e2).includes(it); } function Pt(e2) { return m(e2) && e2.slice(0, 3) === A.CONV_C2C; } function Ut(e2) { return m(e2) && e2.slice(0, 5) === A.CONV_GROUP; } function bt(e2) { return m(e2) && e2 === A.CONV_SYSTEM; } function wt(t2, n2) { var o2 = {}; return Object.keys(t2).forEach(function(e2) { o2[e2] = n2(t2[e2], e2); }), o2; } function Ft(o2) { return ye ? Promise.resolve({ width: 0, height: 0 }) : v ? new Promise(function(t2, e2) { I.getImageInfo({ src: o2, success: function(e3) { t2({ width: e3.width, height: e3.height }); }, fail: function() { t2({ width: 0, height: 0 }); } }); }) : Ae && 9 === Re ? Promise.resolve({ width: 0, height: 0 }) : new Promise(function(e2, t2) { var n2 = new Image(); n2.onload = function() { e2({ width: this.width, height: this.height }), n2 = null; }, n2.onerror = function() { e2({ width: 0, height: 0 }), n2 = null; }, n2.src = o2; }); } function qt() { function e2() { return (65536 * (1 + Math.random()) | 0).toString(16).substring(1); } return "".concat(e2() + e2()).concat(e2()).concat(e2()).concat(e2()).concat(e2()).concat(e2()).concat(e2()); } function xt() { var e2 = Se ? "android" : Ee ? "ios" : Oe ? "windows" : Ne ? "mac" : "unknown"; if (v) try { var t2 = I.getSystemInfoSync().platform; void 0 !== t2 && (e2 = t2); } catch (e3) { } return e2; } function Vt(e2, t2) { e2 = e2.split("."), t2 = t2.split("."); for (var n2 = Math.max(e2.length, t2.length); e2.length < n2; ) e2.push("0"); for (; t2.length < n2; ) t2.push("0"); for (var o2 = 0; o2 < n2; o2++) { var i2 = parseInt(e2[o2]), a2 = parseInt(t2[o2]); if (a2 < i2) return 1; if (i2 < a2) return -1; } return 0; } function Ht(e2) { var t2 = e2.originUrl, t2 = void 0 === t2 ? void 0 : t2, n2 = e2.originWidth, o2 = e2.originHeight, e2 = e2.min, e2 = void 0 === e2 ? 198 : e2, n2 = parseInt(n2), o2 = parseInt(o2), i2 = { url: void 0, width: 0, height: 0 }; return (n2 <= o2 ? n2 : o2) <= e2 ? (i2.url = t2, i2.width = n2, i2.height = o2) : (o2 <= n2 ? (i2.width = Math.ceil(n2 * e2 / o2), i2.height = e2) : (i2.width = e2, i2.height = Math.ceil(o2 * e2 / n2)), o2 = t2 && -1 < t2.indexOf("?") ? "".concat(t2, "&") : "".concat(t2, "?"), i2.url = "".concat(o2, 198 === e2 ? "imageView2/3/w/198/h/198" : "imageView2/3/w/720/h/720")), N(t2) ? K(i2, yt) : i2; } function Bt(e2) { var t2 = e2[2]; e2[2] = e2[1], e2[1] = t2; for (var n2 = 0; n2 < e2.length; n2++) e2[n2].setType(n2); } function Kt(e2) { e2 = e2.servcmd; return e2.slice(e2.indexOf(".") + 1); } function Yt(e2, t2) { return Math.round(Number(e2) * Math.pow(10, t2)) / Math.pow(10, t2); } function Wt(e2, t2) { return e2.includes(t2); } function jt(e2, t2) { return e2.includes(t2); } function Jt(e2) { return e2.split(it)[0]; } var zt = function(e2, t2, n2) { if (N(t2)) return ""; switch (e2) { case A.MSG_TEXT: return t2.text; case A.MSG_IMAGE: return n2 ? "[Image]" : "[图片]"; case A.MSG_LOCATION: return n2 ? "[Location]" : "[位置]"; case A.MSG_AUDIO: return n2 ? "[Voice]" : "[语音]"; case A.MSG_VIDEO: return n2 ? "[Video]" : "[视频]"; case A.MSG_FILE: return n2 ? "[File]" : "[文件]"; case A.MSG_CUSTOM: return n2 ? "[Custom Messages]" : "[自定义消息]"; case A.MSG_GRP_TIP: return n2 ? "[Group Notification]" : "[群提示消息]"; case A.MSG_GRP_SYS_NOTICE: return n2 ? "[Group System Message]" : "[群系统通知]"; case A.MSG_FACE: return n2 ? "[Animated Sticker]" : "[动画表情]"; case A.MSG_MERGER: return n2 ? "[Chat Record]" : "[聊天记录]"; default: return ""; } }; function Xt(e2) { return e2 === A.MSG_TEXT || e2 === A.MSG_CUSTOM || e2 === A.MSG_LOCATION || e2 === A.MSG_FACE; } function Zt(e2) { var t2 = []; if (m(e2)) { var n2 = e2.length; if (0 !== n2) for (var o2 = n2 - 1; 0 <= o2; o2--) "1" === e2[o2] && t2.push(Math.pow(2, n2 - o2 - 1)); } return t2; } function Qt() { return !Ae && !v; } function $t(e2) { return "the length of userIDList cannot exceed ".concat(e2); } function en(e2) { var t2; if (O(e2) && 0 !== e2.length) return t2 = 0, e2.forEach(function(e3) { t2 += e3; }), t2.toFixed(0); } function tn(e2) { var t2; if (O(e2) && 0 !== e2.length) return t2 = 0, e2.forEach(function(e3) { t2 += e3; }), (t2 / e2.length).toFixed(0); } function nn(e2, t2, n2) { var t2 = !(1 < arguments.length && void 0 !== t2) || t2, n2 = !(2 < arguments.length && void 0 !== n2) || n2, o2 = Date.now(); return t2 ? n2 ? "".concat(o2 - e2, " ms") : "".concat(Math.round((o2 - e2) / 1e3), " s") : n2 ? o2 - e2 : Math.round((o2 - e2) / 1e3); } function on(e2) { return e2 && 1 < e2 ? true : false; } function an(e2, t2, n2, o2) { var i2, a2, s2; return void 0 === t2 || (i2 = true, t2.required && S(e2) && (M.e("[".concat(n2, '] Missing required params: "').concat(o2, '".')), i2 = false), S(e2) || (a2 = Dt(e2)) === (s2 = t2.type.toLowerCase()) || "asyncfunction" === a2 && "function" === s2 || (M.e("[".concat(n2, '] Invalid params: type check failed for "').concat(o2, '". Expected ').concat(t2.type, ".")), i2 = false), t2.validator && !t2.validator(e2, n2, o2) && (M.e("[".concat(n2, '] Invalid params: custom validator check failed for "').concat(o2, '".')), i2 = false), i2); } function sn(e2) { return !(!e2 || !(Pt(e2) || Ut(e2) || bt(e2)) && ((e2 = l("InvalidConversationID", e2)) && M.w(e2), 1)); } function c(e2) { "" !== e2.desc && "" !== l("API_REFER") && M.w("[".concat(e2.api, "] | ").concat(e2.paramName, " | ").concat(e2.desc, ", ").concat(l("API_REFER")).concat(e2.api)); } function rn() { return l("StringRequiredLog"); } function cn(e2) { return l("NonEmptyStringRequiredLog", e2); } function un() { return l("NumberRequiredLog"); } function ln() { return l("UndefinedNotAllowedLog"); } function dn() { return l("FileRequiredLog"); } function pn() { return l("FunctionRequiredLog"); } function _n() { return l("ArrayRequiredLog"); } function hn() { return l("NonEmptyArrayLog"); } function gn() { return l("CallbackMissingLog"); } function fn() { return l("PositiveIntegerRequiredLog"); } function mn(e2, t2) { return l("StringNotLongerThanLog", e2, t2); } function vn(e2, t2) { return l("NumberGreaterOrEqualLog", e2, t2); } function In(e2) { return l("KeyValueStringRequiredLog", e2); } function Mn() { return l("PlainObjectRequiredLog"); } function yn() { return l("NonEmptyContentRequiredLog"); } function Cn() { return l("FileNotSelectedLog"); } function Tn() { return l("MessageInstanceRequiredLog"); } function Dn() { return l("NonAnonymousFunctionLog"); } function En() { return l("MessageExtensionNotAvailableLog"); } function Ln() { return l("MessageReactionRequiredLog"); } function Sn(e2, t2) { return l("MaximumArrayLengthLog", e2, t2); } function C(e2) { return { code: 0, data: e2 || {} }; } function T(e2) { return Promise.resolve(C(e2)); } function D(e2) { var t2, n2 = 1 < arguments.length && void 0 !== arguments[1] && arguments[1]; return e2 instanceof E ? (n2 && null !== qn && qn.emit(h.ERROR, e2), Promise.reject(e2)) : e2 instanceof Error ? (t2 = new E({ code: L.UNCAUGHT_ERROR }), n2 && null !== qn && qn.emit(h.ERROR, t2), Promise.reject(t2)) : N(e2) || N(e2.code) ? Promise.reject(new E({ code: L.UNCAUGHT_ERROR })) : (t2 = new E(e2), n2 && null !== qn && qn.emit(h.ERROR, t2), Promise.reject(t2)); } var kn, An = "unSend", Rn = "success", On = "fail", Nn = "notStart", Gn = "pending", Pn = "resolved", Un = "rejected", o = { type: "String", required: true }, r = { type: "Array", required: true }, s = { type: "Object", required: true }, bn = { type: "Boolean", required: true }, u = { type: "number", required: true }, l = null, wn = { hookGetAPITips: function(e2) { l = e2; }, login: { userID: o, userSig: o }, addToBlacklist: { userIDList: r }, removeFromBlacklist: { userIDList: r }, on: [{ name: "eventName", type: "String", validator: function(e2, t2, n2) { return "string" == typeof e2 && 0 !== e2.length || (c({ api: t2, paramName: n2, desc: cn(n2) }), false); } }, { name: "handler", type: "Function", validator: function(e2, t2, n2) { return "function" != typeof e2 ? (c({ api: t2, paramName: n2, desc: pn() }), false) : ("" === e2.name && c({ api: t2, paramName: n2, desc: Dn() }), true); } }], once: [{ name: "eventName", type: "String", validator: function(e2, t2, n2) { return "string" == typeof e2 && 0 !== e2.length || (c({ api: t2, paramName: n2, desc: cn(n2) }), false); } }, { name: "handler", type: "Function", validator: function(e2, t2, n2) { return "function" != typeof e2 ? (c({ api: t2, paramName: n2, desc: pn() }), false) : ("" === e2.name && c({ api: t2, paramName: n2, desc: Dn() }), true); } }], off: [{ name: "eventName", type: "String", validator: function(e2, t2, n2) { return "string" == typeof e2 && 0 !== e2.length || (c({ api: t2, paramName: n2, desc: cn(n2) }), false); } }, { name: "handler", type: "Function", validator: function(e2, t2, n2) { return "function" != typeof e2 ? (c({ api: t2, paramName: n2, desc: pn() }), false) : ("" === e2.name && c({ api: t2, paramName: n2, desc: Dn() }), true); } }], sendMessage: [y({ name: "message" }, s)], setMessageExtensions: [y(y({ name: "message" }, s), {}, { validator: function(e2, t2, n2) { return e2.status === Rn && true === e2.isSupportExtension || (c({ api: t2, paramName: n2, desc: En() }), false); } }), y({ name: "extensions" }, r)], getMessageExtensions: [y(y({ name: "message" }, s), {}, { validator: function(e2, t2, n2) { return e2.status === Rn && true === e2.isSupportExtension || (c({ api: t2, paramName: n2, desc: En() }), false); } })], deleteMessageExtensions: [y(y({ name: "message" }, s), {}, { validator: function(e2, t2, n2) { return e2.status === Rn && true === e2.isSupportExtension || (c({ api: t2, paramName: n2, desc: En() }), false); } })], addMessageReaction: [y(y({ name: "message" }, s), {}, { validator: function(e2, t2, n2) { return e2.status === Rn || (c({ api: t2, paramName: n2, desc: Ln() }), false); } }), y({ name: "reactionID" }, o)], removeMessageReaction: [y(y({ name: "message" }, s), {}, { validator: function(e2, t2, n2) { return e2.status === Rn || (c({ api: t2, paramName: n2, desc: Ln() }), false); } }), y({ name: "reactionID" }, o)], getMessageReactions: { messageList: y({}, r) }, getAllUserListOfMessageReaction: { message: y(y({}, s), {}, { validator: function(e2, t2, n2) { return e2.status === Rn || (c({ api: t2, paramName: n2, desc: Ln() }), false); } }), reactionID: y({}, o), nextSeq: { type: "Number" }, count: { type: "Number" } }, getMessageList: { conversationID: y(y({}, o), {}, { validator: sn }), nextReqMessageID: { type: "String" }, count: { type: "Number", validator: function(e2, t2, n2) { return !(!N(e2) && !/^[1-9][0-9]*$/.test(e2) && (c({ api: t2, paramName: n2, desc: fn() }), 1)); } } }, getMessageListHopping: { conversationID: y(y({}, o), {}, { validator: sn }), sequence: { type: "Number" }, time: { type: "Number" }, direction: { type: "Number", validator: function(e2, t2, n2) { return !(!N(e2) && 0 !== e2 && 1 !== e2 && (c({ api: t2, paramName: n2, desc: l("0Or1RequiredLog") }), 1)); } }, count: { type: "Number", validator: function(e2, t2, n2) { return !(!N(e2) && !/^[1-9][0-9]*$/.test(e2) && (c({ api: t2, paramName: n2, desc: fn }), 1)); } } }, setMessageRead: { conversationID: y(y({}, o), {}, { validator: sn }) }, setAllMessageRead: { scope: { type: "String", required: false, validator: function(e2, t2, n2) { return !e2 || -1 !== [A.READ_ALL_C2C_MSG, A.READ_ALL_GROUP_MSG, A.READ_ALL_MSG].indexOf(e2) || (c({ api: t2, paramName: n2, desc: l("ValidScopeRequired") }), false); } } }, getConversationProfile: [y(y({ name: "conversationID" }, o), {}, { validator: sn })], clearHistoryMessage: [y(y({ name: "conversationID" }, o), {}, { validator: sn })], pinConversation: { conversationID: y(y({}, o), {}, { validator: sn }), isPinned: y({}, bn) }, setConversationDraft: { conversationID: y(y({}, o), {}, { validator: sn }), draftText: { type: "String", validator: function(e2, t2, n2) { return !!m(e2) || (c({ api: t2, paramName: n2, desc: rn() }), false); } } }, setConversationCustomData: { conversationIDList: y({}, r), customData: { type: "String", validator: function(e2, t2, n2) { return m(e2) ? !(256 < e2.length && (c({ api: t2, paramName: n2, desc: mn(n2, 256) }), 1)) : (c({ api: t2, paramName: n2, desc: rn() }), false); } } }, markConversation: { conversationIDList: y({}, r), markType: { type: "number", validator: function(e2, t2, n2) { return R(e2) ? e2 <= 0 ? (c({ api: t2, paramName: n2, desc: l("NumberGreaterThanLog", n2, 0) }), false) : !(e2 >= Math.pow(2, 64) && (c({ api: t2, paramName: n2, desc: l("NumberLessThanLog", n2, "Math.pow(2,64)") }), 1)) : (c({ api: t2, paramName: n2, desc: un() }), false); } }, enableMark: y({}, bn) }, createConversationGroup: { conversationIDList: y({}, r), groupName: y(y({}, o), {}, { validator: function(e2, t2, n2) { return !(!e2 || 32 < e2.length && (c({ api: t2, paramName: n2, desc: mn(n2, 32) }), 1)); } }) }, deleteConversationGroup: [y({ name: "groupName" }, o)], renameConversationGroup: { oldName: y({}, o), newName: y(y({}, o), {}, { validator: function(e2, t2, n2) { return !(!e2 || 32 < e2.length && (c({ api: t2, paramName: n2, desc: mn(n2, 32) }), 1)); } }) }, addConversationsToGroup: { conversationIDList: y({}, r), groupName: y({}, o) }, deleteConversationsFromGroup: { conversationIDList: y({}, r), groupName: y({}, o) }, getGroupList: { groupProfileFilter: { type: "Array" } }, getGroupProfile: { groupID: o, groupCustomFieldFilter: { type: "Array" }, memberCustomFieldFilter: { type: "Array" } }, getGroupProfileAdvance: { groupIDList: r }, createGroup: { name: o }, joinGroup: { groupID: o, type: { type: "String" }, applyMessage: { type: "String" } }, quitGroup: [y({ name: "groupID" }, o)], handleApplication: { message: s, handleAction: o, handleMessage: { type: "String" } }, changeGroupOwner: { groupID: o, newOwnerID: o }, updateGroupProfile: { groupID: o, muteAllMembers: { type: "Boolean" } }, dismissGroup: [y({ name: "groupID" }, o)], searchGroupByID: [y({ name: "groupID" }, o)], getGroupOnlineMemberCount: [y({ name: "groupID" }, o)], initGroupAttributes: { groupID: o, groupAttributes: y(y({}, s), {}, { validator: function(t2, n2, o2) { var i2 = true; return Object.keys(t2).forEach(function(e2) { if (!m(t2[e2])) return c({ api: n2, paramName: o2, desc: In("value") }), i2 = false; }), i2; } }) }, setGroupAttributes: { groupID: o, groupAttributes: y(y({}, s), {}, { validator: function(t2, n2, o2) { var i2 = true; return Object.keys(t2).forEach(function(e2) { if (!m(t2[e2])) return c({ api: n2, paramName: o2, desc: In("value") }), i2 = false; }), i2; } }) }, deleteGroupAttributes: { groupID: o, keyList: { type: "Array", validator: function(e2, t2, n2) { var o2; return N(e2) || !O(e2) ? (c({ api: t2, paramName: n2, desc: _n() }), false) : !!S(e2) || (o2 = true, e2.forEach(function(e3) { if (!m(e3)) return c({ api: t2, paramName: n2, desc: l("StringArrayRequiredLog") }), o2 = false; }), o2); } } }, getGroupAttributes: { groupID: o, keyList: { type: "Array", validator: function(e2, t2, n2) { var o2; return N(e2) || !O(e2) ? (c({ api: t2, paramName: n2, desc: _n() }), false) : !!S(e2) || (o2 = true, e2.forEach(function(e3) { if (!m(e3)) return c({ api: t2, paramName: n2, desc: In("key") }), o2 = false; }), o2); } } }, setGroupCounters: { groupID: o, counters: s }, increaseGroupCounter: { groupID: o, key: o, value: u }, decreaseGroupCounter: { groupID: o, key: o, value: u }, getGroupCounters: { groupID: o }, getGroupMemberList: { groupID: o, count: { type: "Number" } }, getGroupMemberProfile: { groupID: o, userIDList: r, memberCustomFieldFilter: { type: "Array" } }, addGroupMember: { groupID: o, userIDList: r }, setGroupMemberRole: { groupID: o, userID: o, role: o }, setGroupMemberMuteTime: { groupID: o, userID: o, muteTime: { type: "Number", validator: function(e2) { return 0 <= e2; } } }, setGroupMemberNameCard: { groupID: o, userID: { type: "String" }, nameCard: { type: "String", validator: function(e2, t2, n2) { return m(e2) ? (e2.length, true) : (c({ api: t2, paramName: n2, desc: rn() }), false); } } }, setGroupMemberCustomField: { groupID: o, userID: { type: "String" }, memberCustomField: r }, deleteGroupMember: { groupID: o }, markGroupMemberList: { groupID: o, markType: { type: "number", validator: function(e2, t2, n2) { return R(e2) ? !(e2 < 1e3 && (c({ api: t2, paramName: n2, desc: vn(n2, 1e3) }), 1)) : (c({ api: t2, paramName: n2, desc: un() }), false); } }, userIDList: y({}, r), enableMark: y({}, bn) }, createTextMessage: { to: o, conversationType: o, payload: y(y({}, s), {}, { validator: function(e2, t2, n2) { return f(e2) ? m(e2.text) ? 0 !== e2.text.length || (c({ api: t2, paramName: "payload.text", desc: yn() }), false) : (c({ api: t2, paramName: "payload.text", desc: rn() }), false) : (c({ api: t2, paramName: n2, desc: Mn() }), false); } }) }, createTextAtMessage: { to: o, conversationType: o, payload: y(y({}, s), {}, { validator: function(e2, t2, n2) { return f(e2) ? m(e2.text) ? 0 === e2.text.length ? (c({ api: t2, paramName: "payload.text", desc: yn() }), false) : !(e2.atUserList && !O(e2.atUserList) && (c({ api: t2, paramName: "payload.atUserList", desc: _n() }), 1)) : (c({ api: t2, paramName: "payload.text", desc: rn() }), false) : (c({ api: t2, paramName: n2, desc: Mn() }), false); } }) }, createCustomMessage: { to: o, conversationType: o, payload: y(y({}, s), {}, { validator: function(e2, t2, n2) { return f(e2) ? e2.data && !m(e2.data) ? (c({ api: t2, paramName: "payload.data", desc: rn() }), false) : e2.description && !m(e2.description) ? (c({ api: t2, paramName: "payload.description", desc: rn() }), false) : !(e2.extension && !m(e2.extension) && (c({ api: t2, paramName: "payload.extension", desc: rn() }), 1)) : (c({ api: t2, paramName: "payload", desc: Mn() }), false); } }) }, createImageMessage: { to: o, conversationType: o, payload: y(y({}, s), {}, { validator: function(e2, t2, n2) { if (!f(e2)) return c({ api: t2, paramName: n2, desc: Mn() }), false; if (N(e2.file)) return c({ api: t2, paramName: "payload.file", desc: ln() }), false; if (Ce) { if (!(e2.file instanceof HTMLInputElement || ct(e2.file))) return f(e2.file) && "undefined" != typeof uni ? 0 !== e2.file.tempFilePaths.length && 0 !== e2.file.tempFiles.length || (c({ api: t2, paramName: "payload.file", desc: Cn() }), false) : (c({ api: t2, paramName: "payload.file", desc: dn() }), false); if (e2.file instanceof HTMLInputElement && 0 === e2.file.files.length) return c({ api: t2, paramName: "payload.file", desc: Cn() }), false; } return true; }, onProgress: { type: "Function", required: false, validator: function(e2, t2, n2) { return N(e2) && c({ api: t2, paramName: n2, desc: gn() }), true; } } }) }, createAudioMessage: { to: o, conversationType: o, payload: y(y({}, s), {}, { validator: function(e2, t2, n2) { return !!f(e2) || (c({ api: t2, paramName: n2, desc: Mn() }), false); } }), onProgress: { type: "Function", required: false, validator: function(e2, t2, n2) { return N(e2) && c({ api: t2, paramName: n2, desc: gn() }), true; } } }, createVideoMessage: { to: o, conversationType: o, payload: y(y({}, s), {}, { validator: function(e2, t2, n2) { if (!f(e2)) return c({ api: t2, paramName: n2, desc: Mn() }), false; if (N(e2.file)) return c({ api: t2, paramName: "payload.file", desc: ln() }), false; if (Ce) { if (!(e2.file instanceof HTMLInputElement || ct(e2.file))) return f(e2.file) && "undefined" != typeof uni ? !!ct(e2.file.tempFile) || (c({ api: t2, paramName: "payload.file", desc: Cn() }), false) : (c({ api: t2, paramName: "payload.file", desc: dn() }), false); if (e2.file instanceof HTMLInputElement && 0 === e2.file.files.length) return c({ api: t2, paramName: "payload.file", desc: Cn() }), false; } return true; } }), onProgress: { type: "Function", required: false, validator: function(e2, t2, n2) { return N(e2) && c({ api: t2, paramName: n2, desc: gn() }), true; } } }, createFaceMessage: { to: o, conversationType: o, payload: y(y({}, s), {}, { validator: function(e2, t2, n2) { return f(e2) ? R(e2.index) ? !!m(e2.data) || (c({ api: t2, paramName: "payload.data", desc: rn() }), false) : (c({ api: t2, paramName: "payload.index", desc: un() }), false) : (c({ api: t2, paramName: n2, desc: Mn() }), false); } }) }, createFileMessage: { to: o, conversationType: o, payload: y(y({}, s), {}, { validator: function(e2, t2, n2) { if (!f(e2)) return c({ api: t2, paramName: n2, desc: Mn() }), false; if (N(e2.file)) return c({ api: t2, paramName: "payload.file", desc: ln() }), false; if (Ce) { if (!(e2.file instanceof HTMLInputElement || ct(e2.file))) return f(e2.file) && "undefined" != typeof uni ? 0 !== e2.file.tempFilePaths.length && 0 !== e2.file.tempFiles.length || (c({ api: t2, paramName: "payload.file", desc: Cn() }), false) : (c({ api: t2, paramName: "payload.file", desc: dn() }), false); if (e2.file instanceof HTMLInputElement && 0 === e2.file.files.length) return c({ api: t2, paramName: "payload.file", desc: Cn() }), false; } return true; } }), onProgress: { type: "Function", required: false, validator: function(e2, t2, n2) { return N(e2) && c({ api: t2, paramName: n2, desc: gn() }), true; } } }, createLocationMessage: { to: o, conversationType: o, payload: y(y({}, s), {}, { validator: function(e2, t2, n2) { return f(e2) ? m(e2.description) ? R(e2.longitude) ? !!R(e2.latitude) || (c({ api: t2, paramName: "payload.latitude", desc: un() }), false) : (c({ api: t2, paramName: "payload.longitude", desc: un() }), false) : (c({ api: t2, paramName: "payload.description", desc: rn() }), false) : (c({ api: t2, paramName: n2, desc: Mn() }), false); } }) }, createMergerMessage: { to: o, conversationType: o, payload: y(y({}, s), {}, { validator: function(e2, t2, n2) { var o2; return S(e2.messageList) ? (c({ api: t2, paramName: "payload.messageList", desc: hn() }), false) : S(e2.compatibleText) ? (c({ api: t2, paramName: "payload.compatibleText", desc: cn("compatibleText") }), false) : (o2 = false, e2.messageList.forEach(function(e3) { e3.status === On && (o2 = true); }), !o2 || (c({ api: t2, paramName: "payload.messageList", desc: l("MergeFailedMessageLog") }), false)); } }) }, revokeMessage: [y(y({ name: "message" }, s), {}, { validator: function(e2, t2, n2) { return S(e2) ? (c({ api: t2, paramName: n2, desc: Tn() }), false) : e2.conversationType === A.CONV_SYSTEM ? (c({ api: t2, paramName: n2, desc: l("MessageCanBeRevokedDesc") }), false) : true !== e2.isRevoked || (c({ api: t2, paramName: n2, desc: l("MessageRevokedLog") }), false); } })], deleteMessage: [y(y({ name: "messageList" }, r), {}, { validator: function(e2, t2, n2) { return !S(e2) || (c({ api: t2, paramName: n2, desc: hn() }), false); } })], translateText: { sourceTextList: r, sourceLanguage: o, targetLanguage: o }, convertVoiceToText: { message: y(y({}, s), {}, { validator: function(e2, t2, n2) { return S(e2) ? (c({ api: t2, paramName: n2, desc: Tn() }), false) : e2.type === A.MSG_AUDIO && e2.status === Rn || (c({ api: t2, paramName: n2, desc: l("AudioMessageRequiredLog") }), false); } }) }, modifyMessage: [y(y({ name: "message" }, s), {}, { validator: function(e2, t2, n2) { return S(e2) ? (c({ api: t2, paramName: n2, desc: Tn() }), false) : e2.conversationType === A.CONV_SYSTEM ? (c({ api: t2, paramName: n2, desc: l("MessageCanBeModifiedLog") }), false) : true !== e2._onlineOnlyFlag || (c({ api: t2, paramName: n2, desc: l("OnlineMessageNotSupportLog") }), false); } })], searchCloudMessages: { keywordList: { type: "Array", required: false, validator: function(e2, t2, n2) { return !(e2 && (O(e2) ? 0 === e2.length ? (c({ api: t2, paramName: n2, desc: hn() }), 1) : 5 < e2.length && (c({ api: t2, paramName: n2, desc: Sn(n2, 5) }), 1) : (c({ api: t2, paramName: n2, desc: _n() }), 1))); } }, keywordListMatchType: { type: "String", required: false, validator: function(e2, t2, n2) { return !e2 || "or" === e2 || "and" === e2 || c({ api: t2, paramName: n2, desc: "".concat(e2, " is invalid match type") }); } }, senderUserIDList: { type: "Array", required: false, validator: function(e2, t2, n2) { return !(e2 && (O(e2) ? (0 === e2.length && c({ api: t2, paramName: n2, desc: hn() }), 5 < e2.length && (c({ api: t2, paramName: n2, desc: Sn(n2, 5) }), 1)) : (c({ api: t2, paramName: n2, desc: _n() }), 1))); } }, messageTypeList: { type: "Array", required: false, validator: function(e2, t2, n2) { if (!e2) return true; if (!O(e2)) return c({ api: t2, paramName: n2, desc: _n() }), false; 0 === e2.length && c({ api: t2, paramName: n2, desc: hn() }); var o2 = [A.MSG_TEXT, A.MSG_IMAGE, A.MSG_AUDIO, A.MSG_FILE, A.MSG_VIDEO, A.MSG_LOCATION, A.MSG_CUSTOM, A.MSG_MERGER]; return !(0 < e2.filter(function(e3) { return -1 === o2.indexOf(e3); }).length && (c({ api: t2, paramName: n2, desc: l("ContainsUnsupportedMessageTypeLog", n2) }), 1)); } }, conversationID: { type: "String", required: false, validator: function(e2) { return !e2 || sn(e2); } }, timePosition: { type: "number", required: false, validator: function(e2, t2, n2) { return !(e2 && e2 < 0 && (c({ api: t2, paramName: n2, desc: vn(n2, 0) }), 1)); } }, timePeriod: { type: "number", required: false, validator: function(e2, t2, n2) { return !(e2 && e2 < 0 && (c({ api: t2, paramName: n2, desc: vn(n2, 0) }), 1)); } }, cursor: { type: "String", required: false } }, getUserProfile: { userIDList: { type: "Array", validator: function(e2, t2, n2) { return O(e2) ? (0 === e2.length && c({ api: t2, paramName: n2, desc: hn() }), true) : (c({ api: t2, paramName: n2, desc: _n() }), false); } } }, updateMyProfile: { profileCustomField: { type: "Array", validator: function(e2, t2, n2) { return !!N(e2) || !!O(e2) || (c({ api: t2, paramName: n2, desc: _n() }), false); } } }, setSelfStatus: { customStatus: { type: "String", validator: function(e2, t2, n2) { return !!m(e2) || (c({ api: t2, paramName: n2, desc: rn() }), false); } } }, getUserStatus: { userIDList: { type: "Array", validator: function(e2, t2, n2) { return O(e2) ? 0 !== e2.length || (c({ api: t2, paramName: n2, desc: hn() }), false) : (c({ api: t2, paramName: n2, desc: _n() }), false); } } }, subscribeUserStatus: { userIDList: { type: "Array", validator: function(e2, t2, n2) { return O(e2) ? 0 !== e2.length || (c({ api: t2, paramName: n2, desc: hn() }), false) : (c({ api: t2, paramName: n2, desc: _n() }), false); } } }, unsubscribeUserStatus: { userIDList: { type: "Array", validator: function(e2, t2, n2) { return !e2 || !!O(e2) || (c({ api: t2, paramName: n2, desc: _n() }), false); } } }, addFriend: { to: o, source: { type: "String", required: true, validator: function(e2, t2, n2) { return !(!e2 || (e2.startsWith("AddSource_Type_") ? 8 < e2.replace("AddSource_Type_", "").length && (c({ api: t2, paramName: n2, desc: mn("keyword", 8) }), 1) : (c({ api: t2, paramName: n2, desc: l("SourcePrefixLog") }), 1))); } }, remark: { type: "String", required: false, validator: function(e2, t2, n2) { return !(m(e2) && 96 < e2.length && (c({ api: t2, paramName: n2, desc: mn(n2, 96) }), 1)); } } }, deleteFriend: { userIDList: r }, checkFriend: { userIDList: r }, getFriendProfile: { userIDList: r }, updateFriend: { userID: o, remark: { type: "String", required: false, validator: function(e2, t2, n2) { return !(m(e2) && 96 < e2.length && (c({ api: t2, paramName: n2, desc: mn(n2, 96) }), 1)); } }, friendCustomField: { type: "Array", required: false, validator: function(e2, t2, n2) { var o2; return !e2 || (O(e2) ? (o2 = true, e2.forEach(function(e3) { return m(e3.key) && -1 !== e3.key.indexOf("Tag_SNS_Custom") ? m(e3.value) ? 8 < e3.key.replace("Tag_SNS_Custom_", "").length ? (c({ api: t2, paramName: n2, desc: mn("keyword", 8) }), o2 = false) : void 0 : (c({ api: t2, paramName: n2, desc: In("value") }), o2 = false) : (c({ api: t2, paramName: n2, desc: l("FriendCustomFieldPrefixLog") }), o2 = false); }), o2) : (c({ api: t2, paramName: n2, desc: _n() }), false)); } } }, acceptFriendApplication: { userID: o }, refuseFriendApplication: { userID: o }, deleteFriendApplication: { userID: o }, createFriendGroup: { name: o }, deleteFriendGroup: { name: o }, addToFriendGroup: { name: o, userIDList: r }, removeFromFriendGroup: { name: o, userIDList: r }, renameFriendGroup: { oldName: o, newName: o }, sendMessageReadReceipt: [{ name: "messageList", type: "Array", validator: function(e2, t2, n2) { return O(e2) ? 0 !== e2.length || (c({ api: t2, paramName: n2, desc: hn() }), false) : (c({ api: t2, paramName: n2, desc: _n() }), false); } }], getMessageReadReceiptList: [{ name: "messageList", type: "Array", validator: function(e2, t2, n2) { return O(e2) ? 0 !== e2.length || (c({ api: t2, paramName: n2, desc: hn() }), false) : (c({ api: t2, paramName: n2, desc: _n() }), false); } }], createTopicInCommunity: { groupID: o, topicName: o }, deleteTopicFromCommunity: { groupID: o, topicIDList: { type: "Array", validator: function(e2, t2, n2) { return !e2 || !!O(e2) || (c({ api: t2, paramName: n2, desc: _n() }), false); } } }, updateTopicProfile: { groupID: o, topicID: o }, getTopicList: { groupID: o, topicIDList: { type: "Array", validator: function(e2, t2, n2) { return !e2 || !!O(e2) || (c({ api: t2, paramName: n2, desc: _n() }), false); } } }, followUser: [y({ name: "userIDList" }, r)], unfollowUser: [y({ name: "userIDList" }, r)], getMyFollowingList: [y(y({ name: "startIndex" }, o), {}, { required: false })], getMyFollowersList: [y(y({ name: "startIndex" }, o), {}, { required: false })], getMutualFollowersList: [y(y({ name: "startIndex" }, o), {}, { required: false })], getUserFollowInfo: [y(y({ name: "userIDList" }, r), {}, { required: false })], checkFollowType: [y({ name: "userIDList" }, r)], addSignalingListener: [{ name: "eventName", type: "String", validator: function(e2, t2, n2) { return "string" == typeof e2 && 0 !== e2.length || (c({ api: t2, paramName: n2, desc: cn(n2) }), false); } }, { name: "handler", type: "Function", validator: function(e2, t2, n2) { return "function" != typeof e2 ? (c({ api: t2, paramName: n2, desc: pn() }), false) : ("" === e2.name && c({ api: t2, paramName: n2, desc: Dn() }), true); } }], removeSignalingListener: [{ name: "eventName", type: "String", validator: function(e2, t2, n2) { return "string" == typeof e2 && 0 !== e2.length || (c({ api: t2, paramName: n2, desc: cn(n2) }), false); } }, { name: "handler", type: "Function", validator: function(e2, t2, n2) { return "function" != typeof e2 ? (c({ api: t2, paramName: n2, desc: pn() }), false) : ("" === e2.name && c({ api: t2, paramName: n2, desc: Dn() }), true); } }], invite: { userID: o }, inviteSync: [y(y({}, s), {}, { validator: function(e2, t2, n2) { return f(e2) ? !!m(e2.userID) || (c({ api: t2, paramName: "options.userID", desc: rn() }), false) : (c({ api: t2, paramName: "options", desc: Mn() }), false); } }), { name: "successCb", type: "Function", required: false, validator: function(e2, t2, n2) { return N(e2) && c({ api: t2, paramName: n2, desc: pn() }), true; } }, { name: "errorCb", type: "Function", required: false, validator: function(e2, t2, n2) { return N(e2) && c({ api: t2, paramName: n2, desc: pn() }), true; } }], inviteInGroup: { groupID: o, inviteeList: r }, inviteInGroupSync: [y(y({}, s), {}, { validator: function(e2, t2, n2) { return f(e2) ? m(e2.groupID) ? !!O(e2.inviteeList) || (c({ api: t2, paramName: "options.inviteeList", desc: _n() }), false) : (c({ api: t2, paramName: "options.groupID", desc: rn() }), false) : (c({ api: t2, paramName: "options", desc: Mn() }), false); } }), { name: "successCb", type: "Function", required: false, validator: function(e2, t2, n2) { return N(e2) && c({ api: t2, paramName: n2, desc: pn() }), true; } }, { name: "errorCb", type: "Function", required: false, validator: function(e2, t2, n2) { return N(e2) && c({ api: t2, paramName: n2, desc: pn() }), true; } }], accept: { inviteID: o }, reject: { inviteID: o }, getSignalingInfo: [y(y({ name: "message" }, s), {}, { validator: function(e2, t2, n2) { return !S(e2) || (c({ api: t2, paramName: n2, desc: Tn() }), false); } })], modifyInvitation: { inviteID: o, data: o } }, Fn = { 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 }, E = (t(io, B(Error)), kn = n(io), e(io)), L = { 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 }, qn = null, u = (e(oo, [{ key: "isLoggedIn", value: function() { return this._m.get(12).isLoggedIn(); } }, { key: "isOversea", value: function() { return this._m.get(12).isOversea(); } }, { key: "isPrivateNetWork", value: function() { var e2 = this._m.get(12); return e2.isPrivateNetWork() && !e2.getFileDownloadProxy(); } }, { key: "getFileDownloadProxy", value: function() { return this._m.get(12).getFileDownloadProxy(); } }, { key: "getDowloadFileAuthKey", value: function() { return this._m.get(12).getDowloadFileAuthKey(); } }, { key: "getMyUserID", value: function() { return this._m.get(12).getUserID(); } }, { key: "getMyTinyID", value: function() { return this._m.get(12).getTinyID(); } }, { key: "getSDKAppID", value: function() { return this._m.get(12).getSDKAppID(); } }, { key: "isIntl", value: function() { return this._m.get(12).isIntl(); } }, { key: "isUsingChatCore", value: function() { return this._m.get(12).isUsingChatCore(); } }, { key: "isDevMode", value: function() { return this._m.get(12).isDevMode(); } }, { key: "get", value: function(e2) { return this._m.get(e2); } }, { key: "getPlatform", value: function() { return De; } }, { key: "getCloudConfig", value: function(e2) { return this._m.get(23).getCloudConfig(e2); } }, { key: "emitOEvt", value: function(e2, t2) { this._m.getOEmitInst().emit(e2, t2); } }, { key: "emitIEvt", value: function(e2, t2) { this._m.getIEmitInst().emit(e2, t2); } }, { key: "getIEmitInst", value: function() { return this._m.getIEmitInst(); } }, { key: "req", value: function(e2) { return this._m.get(20).req(e2); } }, { key: "canIUse", value: function(e2) { return this._m.get(27).canIUse(e2); } }, { key: "getErrMsg", value: function(e2, t2, n2) { return this._m.getErrMsg(e2, t2, n2); } }, { key: "warn", value: function(e2, t2, n2) { e2 = this.getErrMsg(e2, t2, n2); e2 && M.w(e2); } }, { key: "noUse", value: function(e2) { var t2 = L.NO_USE; return D({ code: t2, message: this.getErrMsg(t2, e2) }); } }]), oo), k = { 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" }, xn = "networkRTT", Vn = "messageE2EDelay", Hn = "sendMessageC2C", Bn = "sendMessageGroup", Kn = "sendMessageGroupAV", Yn = "sendMessageRichMedia", Wn = "cosUpload", jn = "messageReceivedGroup", Jn = "messageReceivedGroupAVPush", zn = "messageReceivedGroupAVPull", Xn = (F(bn = {}, xn, 2), F(bn, Vn, 3), F(bn, Hn, 4), F(bn, Bn, 5), F(bn, Kn, 6), F(bn, Yn, 7), F(bn, jn, 8), F(bn, Jn, 9), F(bn, zn, 10), F(bn, Wn, 11), bn), Zn = { info: 4, warning: 5, error: 6 }, Qn = { wifi: 1, "2g": 2, "3g": 3, "4g": 4, "5g": 5, unknown: 6, none: 7, online: 8 }, $n = { 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 }, G = (e(no, [{ key: "updateTimeStamp", value: function() { this.timestamp = We(); } }, { key: "start", value: function(e2) { return this._startts = e2, this; } }, { key: "end", value: function() { var e2, t2 = this, n2 = 0 < arguments.length && void 0 !== arguments[0] && arguments[0]; this._sentFlag || (this._netMonitorModule && (e2 = this._netMonitorModule.getNetworkType(), this.setNetworkType(e2)), e2 = We(), 0 === this.costTime && (this.costTime = e2 - this._startts), this.setMoreMessage("startts:".concat(this._startts, " endts:").concat(e2)), n2 ? (this._sentFlag = true, this._eventStatModule && this._eventStatModule.pushIn(this)) : setTimeout(function() { t2._sentFlag = true, t2._eventStatModule && t2._eventStatModule.pushIn(t2); }, 0)); } }, { key: "setError", value: function(e2) { var t2; return e2 instanceof Error ? this._sentFlag || (t2 = true, (t2 = this._netMonitorModule ? this._netMonitorModule.isOnline() : t2) ? (e2.code && this.setCode(e2.code), e2.message && this.setMoreMessage(e2.message)) : this.setCode(L.NO_NETWORK), this.setLevel("error")) : M.w("".concat(this._n, ".setError value not instanceof Error, please check!")), this; } }, { key: "setCode", value: function(e2) { return N(e2) || this._sentFlag || ("ECONNABORTED" === e2 && (this.code = 103), R(e2) ? this.code = e2 : M.w("".concat(this._n, ".setCode value not a number, please check!"), e2, b(e2))), this; } }, { key: "setMessage", value: function(e2) { return N(e2) || this._sentFlag || (R(e2) && (this.message = e2.toString()), m(e2) && (this.message = e2)), this; } }, { key: "setCostTime", value: function(e2) { return this.costTime = e2, this; } }, { key: "setLevel", value: function(e2) { return N(e2) || this._sentFlag || (this.level = Zn[e2]), this; } }, { key: "setMoreMessage", value: function(e2) { return S(this.moreMessage) ? this.moreMessage = "".concat(e2) : this.moreMessage += " ".concat(e2), this; } }, { key: "setNetworkType", value: function(e2) { return N(e2) ? M.w("".concat(this._n, ".setNetworkType value is undefined, please check!")) : (e2 = Qn[e2.toLowerCase()], N(e2) || (this.networkType = e2)), this; } }, { key: "getStartTs", value: function() { return this._startts; } }, { key: "setUIPlatform", value: function(e2) { return this.uiPlatform = e2, this; } }, { key: "setExtension", value: function(e2) { return this.extension = e2, this; } }, { key: "setEventType", value: function(e2) { return this.eventType = e2, this; } }], [{ key: "bindEventStatModule", value: function(e2) { no.prototype._eventStatModule = e2; } }, { key: "bindNetMonitorModule", value: function(e2) { no.prototype._netMonitorModule = e2; } }]), no), eo = (e(to, [{ key: "setText", value: function(e2) { this.content.text = e2; } }, { key: "sendable", value: function() { return 0 !== this.content.text.length; } }]), to); function to(e2) { d(this, to), this.type = A.MSG_TEXT, this.content = { text: e2.text || "" }; } function no(e2) { d(this, no), this._n = "SSOLogData", this.eventType = $n[e2] || 0, this.timestamp = 0, this.networkType = 8, this.code = 0, this.message = "", this.moreMessage = "", this.extension = e2, this.costTime = 0, this.duplicate = false, this.level = 4, this.uiPlatform = void 0, this._sentFlag = false, this._startts = We(); } function oo(e2) { d(this, oo), this._m = e2, this._n = ""; } function io(e2) { d(this, io), t2 = kn.call(this); var t2, n2 = e2.code, o2 = e2.message, e2 = e2.data; return t2.code = n2, o2 ? t2.message = o2 : t2._getErrMsg && (t2.message = t2._getErrMsg(t2.code)), t2.data = e2 || {}, t2; } function ao(e2, t2, n2, o2) { var i2, o2 = 3 < arguments.length && void 0 !== o2 ? o2 : []; if (e2) return i2 = e2, t2 && (e2.startsWith("http://") ? i2 = e2.replace(/^http:\/\/[^/]+/, t2) : e2.startsWith("https://") && (i2 = e2.replace(/^https:\/\/[^/]+/, t2))), n2 && -1 === i2.indexOf("authKey=") && co(i2, o2) ? (-1 < i2.indexOf("?") ? "".concat(i2, "&authKey=") : "".concat(i2, "?authKey=")).concat(n2) : i2; } function so(e2, t2, n2) { var n2 = 2 < arguments.length && void 0 !== n2 ? n2 : []; return e2 === A.MSG_VIDEO ? co((t2[0].content || t2[0].payload).snapshotUrl, n2) && (t2[0].content ? (t2[0].content.snapshotUrl = ro(t2[0].content.snapshotUrl), t2[0].content.thumbUrl = ro(t2[0].content.thumbUrl)) : (t2[0].payload.snapshotUrl = ro(t2[0].payload.snapshotUrl), t2[0].payload.thumbUrl = ro(t2[0].payload.thumbUrl))) : e2 === A.MSG_FILE ? co((t2[0].content || t2[0].payload).fileUrl, n2) && (t2[0].content ? t2[0].content.fileUrl = ro(t2[0].content.fileUrl) : t2[0].payload.fileUrl = ro(t2[0].payload.fileUrl)) : e2 === A.MSG_MERGER && (e2 = (n2 = t2[0].content || t2[0].payload).downloadKey, n2 = void 0 === (n2 = n2.messageList) ? [] : n2, S(void 0 === e2 ? "" : e2)) && n2.forEach(function(e3) { so(e3.messageBody[0].type, e3.messageBody); }), t2; } function ro(e2) { if (!e2) return e2; if (-1 === e2.indexOf("authKey=")) return e2; for (var e2 = e2.split("?"), t2 = e2[1].split("&"), n2 = 0, o2 = 0; o2 < t2.length; o2++) if (-1 < t2[o2].indexOf("authKey=")) { n2 = o2; break; } return t2.splice(n2, 1), 0 < t2.length ? "".concat(e2[0], "?").concat(t2.join("&")) : e2[0]; } function co(e2, t2) { var n2 = false; if (e2) { var e2 = e2.match(/:\/\/([0-9]?\.)?(.[^/:]+)/), o2 = e2 && e2[2] || ""; if (o2.includes("rich-dev")) return 1; for (var i2 = 0; i2 < t2.length; i2++) if (o2.endsWith(t2[i2])) { n2 = true; break; } } return n2; } e(bo, [{ key: "_initImageInfoModel", value: function() { var t2 = this; this._ImageInfoModel = function(e2) { this.instanceID = ft(9999999), this.sizeType = e2.type || 0, this.type = 0, this.size = e2.size || 0, this.width = e2.width || 0, this.height = e2.height || 0, this.imageUrl = e2.imageUrl || e2.url || "", this.url = ao(e2.url || t2._imageMemoryURL, t2._fileDownloadProxy, t2._authKey, t2._fileDNList); }, this._ImageInfoModel.prototype = { setSizeType: function(e2) { this.sizeType = e2; }, setType: function(e2) { this.type = e2; }, setImageUrl: function(e2) { e2 && (this.imageUrl = e2); }, getImageUrl: function() { return this.imageUrl; } }; } }, { key: "initImageInfoArray", value: function(e2) { for (var t2, n2 = 0, o2 = null; n2 <= 2; ) t2 = N(e2) || N(e2[n2]) ? { type: 0, size: 0, width: 0, height: 0, url: "" } : e2[n2], (o2 = new this._ImageInfoModel(t2)).setSizeType(n2 + 1), o2.setType(n2), this.addImageInfo(o2), n2++; this.updateAccessSideImageInfoArray(); } }, { key: "updateImageInfoArray", value: function(e2) { for (var t2, n2 = this.content.imageInfoArray.length, o2 = 0; o2 < n2; o2++) t2 = this.content.imageInfoArray[o2], e2[o2].size && (t2.size = e2[o2].size), e2[o2].url && t2.setImageUrl(e2[o2].url), e2[o2].width && (t2.width = e2[o2].width), e2[o2].height && (t2.height = e2[o2].height); } }, { key: "_autoFixUrl", value: function() { for (var e2 = this.content.imageInfoArray.length, t2 = "", n2 = "", o2 = ["http", "https"], i2 = null, a2 = 0; a2 < e2; a2++) this.content.imageInfoArray[a2].url && "" !== (i2 = this.content.imageInfoArray[a2]).imageUrl && (n2 = i2.imageUrl.slice(0, i2.imageUrl.indexOf("://") + 1), t2 = i2.imageUrl.slice(i2.imageUrl.indexOf("://") + 1), o2.indexOf(n2) < 0 && (n2 = "https:"), this.content.imageInfoArray[a2].setImageUrl([n2, t2].join(""))); } }, { key: "updatePercent", value: function(e2) { this._percent = e2, 1 < this._percent && (this._percent = 1); } }, { key: "updateImageFormat", value: function(e2) { this.content.imageFormat = Xe[e2.toUpperCase()] || Xe.UNKNOWN; } }, { key: "createImageDataASURLInWeb", value: function(e2) { void 0 !== e2 && 0 < e2.files.length && (this._imageMemoryURL = window.URL.createObjectURL(e2.files[0])); } }, { key: "createImageDataASURL", value: function(e2) { e2 && e2.url && (this._imageMemoryURL = e2.url); } }, { key: "replaceImageInfo", value: function(e2, t2) { this.content.imageInfoArray[t2] instanceof this._ImageInfoModel || (this.content.imageInfoArray[t2] = e2); } }, { key: "addImageInfo", value: function(e2) { 3 <= this.content.imageInfoArray.length || this.content.imageInfoArray.push(e2); } }, { key: "updateAccessSideImageInfoArray", value: function() { var e2 = this.content.imageInfoArray, t2 = e2[0], n2 = t2.width, n2 = void 0 === n2 ? 0 : n2, t2 = t2.height, t2 = void 0 === t2 ? 0 : t2; 0 !== n2 && 0 !== t2 && (Bt(e2), Object.assign(e2[2], Ht({ originWidth: n2, originHeight: t2, min: 720 }))); } }, { key: "sendable", value: function() { return 0 !== this.content.imageInfoArray.length && "" !== this.content.imageInfoArray[0].imageUrl && 0 !== this.content.imageInfoArray[0].size; } }]); var uo = bo, lo = (e(Uo, [{ key: "sendable", value: function() { return null !== this.content; } }]), Uo), po = (e(Po, [{ key: "updatePercent", value: function(e2) { this._percent = e2, 1 < this._percent && (this._percent = 1); } }, { key: "updateAudioUrl", value: function(e2) { this.content.remoteAudioUrl = e2; } }, { key: "sendable", value: function() { return "" !== this.content.remoteAudioUrl; } }]), Po), _o = { from: true, groupID: true, groupName: true, to: true }, ho = (e(Go, [{ key: "_initContent", value: function(t2) { var n2 = this; Object.keys(t2).forEach(function(e2) { switch (e2) { case "remarkInfo": break; case "groupProfile": n2.content.groupProfile = {}, n2._initGroupProfile(t2[e2]); break; case "operatorInfo": n2.content.operatorInfo = {}, n2._initOperatorInfo(t2[e2]); break; case "memberInfoList": case "msgMemberInfo": n2._updateMemberList(t2[e2]); break; case "memberExtraInfo": case "onlineMemberInfo": break; case "memberNum": n2.content[e2] = t2[e2], n2.content.memberCount = t2[e2]; break; case "newGroupProfile": n2.content.newGroupProfile = {}, n2._initNewGroupProfile(t2[e2]); break; default: n2.content[e2] = t2[e2]; } }), this.content.userIDList || (this.content.userIDList = [this.content.operatorID]); } }, { key: "_initGroupProfile", value: function(e2) { for (var t2 = Object.keys(e2), n2 = 0; n2 < t2.length; n2++) { var o2 = t2[n2]; _o[o2] && (this.content.groupProfile[o2] = e2[o2]); } } }, { key: "_initOperatorInfo", value: function(e2) { for (var t2 = Object.keys(e2), n2 = 0; n2 < t2.length; n2++) { var o2 = t2[n2]; this.content.operatorInfo[o2] = e2[o2]; } } }, { key: "_updateMemberList", value: function(e2) { S(this.content.memberList) ? this.content.memberList = e2 : this.content.memberList.forEach(function(t2) { e2.forEach(function(e3) { t2.userID === e3.userID && Object.assign(t2, e3); }); }); } }, { key: "_initNewGroupProfile", value: function(e2) { for (var t2 = Object.keys(e2), n2 = 0; n2 < t2.length; n2++) { var o2 = t2[n2]; this.content.newGroupProfile[o2] = "muteAllMembers" !== o2 ? e2[o2] : 1 === e2[o2]; } } }]), Go), go = { from: true, groupID: true, groupName: true, to: true, groupType: true }, fo = (e(No, [{ key: "_initContent", value: function(t2) { var n2 = this; Object.keys(t2).forEach(function(e2) { switch (e2) { case "memberInfoList": break; case "remarkInfo": n2.content.handleMessage = t2[e2]; break; case "groupProfile": n2.content.groupProfile = {}, n2._initGroupProfile(t2[e2]); break; default: n2.content[e2] = t2[e2]; } }); } }, { key: "_initGroupProfile", value: function(e2) { for (var t2 = Object.keys(e2), n2 = 0; n2 < t2.length; n2++) { var o2 = t2[n2]; go[o2] && ("groupName" === o2 ? this.content.groupProfile.name = e2[o2] : this.content.groupProfile[o2] = e2[o2]); } } }]), No), mo = (e(Oo, [{ key: "_getFileInfo", value: function(e2) { var t2, n2; return N(e2.fileName) || N(e2.fileSize) ? (t2 = e2.file.files[0], Ie && (t2.path && -1 !== t2.path.indexOf(".") && (n2 = t2.path.slice(t2.path.lastIndexOf(".") + 1).toLowerCase(), t2.type = n2, t2.name || (t2.name = "".concat(ft(999999), ".").concat(n2))), t2.name || (t2.type = "", t2.name = t2.path.slice(t2.path.lastIndexOf("/") + 1).toLowerCase()), t2.suffix && (t2.type = t2.suffix), t2.url || (t2.url = t2.path)), { size: t2.size, name: t2.name }) : { size: e2.fileSize, name: e2.fileName }; } }, { key: "updatePercent", value: function(e2) { this._percent = e2, 1 < this._percent && (this._percent = 1); } }, { key: "updateFileUrl", value: function(e2) { this.content.fileUrl = e2; } }, { key: "sendable", value: function() { return "" !== this.content.fileUrl && "" !== this.content.fileName && 0 !== this.content.fileSize; } }]), Oo), vo = (e(Ro, [{ key: "setData", value: function(e2) { return this.content.data = e2, this; } }, { key: "setDescription", value: function(e2) { return this.content.description = e2, this; } }, { key: "setExtension", value: function(e2) { return this.content.extension = e2, this; } }, { key: "sendable", value: function() { return 0 !== this.content.data.length || 0 !== this.content.description.length || 0 !== this.content.extension.length; } }]), Ro), Io = (e(Ao, [{ key: "updatePercent", value: function(e2) { this._percent = e2, 1 < this._percent && (this._percent = 1); } }, { key: "updateVideoUrl", value: function(e2) { e2 && (this.content.remoteVideoUrl = e2); } }, { key: "updateSnapshotInfo", value: function(e2) { var t2 = e2.snapshotUrl, n2 = e2.snapshotWidth, e2 = e2.snapshotHeight; S(t2) || (this.content.thumbUrl = this.content.snapshotUrl = t2), S(n2) || (this.content.thumbWidth = this.content.snapshotWidth = Number(n2)), S(e2) || (this.content.thumbHeight = this.content.snapshotHeight = Number(e2)); } }, { key: "sendable", value: function() { return "" !== this.content.remoteVideoUrl; } }]), Ao), Mo = (e(ko, [{ key: "sendable", value: function() { return true; } }]), ko), yo = (e(So, [{ key: "_patchRichMediaPayload", value: function(e2, t2) { e2 === A.MSG_IMAGE ? t2.imageInfoArray.forEach(function(e3) { !e3.imageUrl && e3.url && (e3.imageUrl = e3.url, e3.sizeType = e3.type, 1 === e3.type ? e3.type = 0 : 3 === e3.type && (e3.type = 1)); }) : e2 === A.MSG_VIDEO ? !t2.remoteVideoUrl && t2.videoUrl && (t2.remoteVideoUrl = t2.videoUrl) : e2 === A.MSG_AUDIO ? !t2.remoteAudioUrl && t2.url && (t2.remoteAudioUrl = t2.url) : e2 === A.MSG_FILE && !t2.fileUrl && t2.url && (t2.fileUrl = t2.url, t2.url = void 0); } }, { key: "_updateRichMediaDownloadUrl", value: function(e2, t2, n2, o2, i2) { (n2 || o2) && (e2 === A.MSG_IMAGE ? t2.imageInfoArray.forEach(function(e3) { e3.url = ao(e3.url, n2, o2, i2); }) : e2 === A.MSG_VIDEO ? (t2.videoUrl = ao(t2.videoUrl, n2, o2, i2), t2.snapshotUrl = ao(t2.thumbUrl, n2, o2, i2), t2.snapshotHeight = t2.thumbHeight, t2.snapshotWidth = t2.thumbWidth) : e2 === A.MSG_AUDIO ? t2.url = ao(t2.url, n2, o2, i2) : e2 === A.MSG_FILE && (t2.fileUrl = ao(t2.fileUrl, n2, o2, i2))); } }]), So), Co = (e(Lo, [{ key: "sendable", value: function() { return !S(this.content.messageList) || !S(this.content.downloadKey); } }]), Lo), To = { 1: A.MSG_PRIORITY_HIGH, 2: A.MSG_PRIORITY_NORMAL, 3: A.MSG_PRIORITY_LOW, 4: A.MSG_PRIORITY_LOWEST }, Do = (e(Eo, [{ key: "elements", get: function() { return this._elements; } }, { key: "getElements", value: function() { return this._elements; } }, { key: "extractGroupInfo", value: function(e2) { null !== e2 && (m(e2.nick) && (this.nick = e2.nick), m(e2.avatar) && (this.avatar = e2.avatar), e2 = e2.messageFromAccountExtraInformation, f(e2)) && m(e2.nameCard) && (this.nameCard = e2.nameCard); } }, { key: "handleGroupAtInfo", value: function(e2) { var t2 = this; e2.payload && e2.payload.atUserList && e2.payload.atUserList.forEach(function(e3) { e3 !== A.MSG_AT_ALL ? (t2._groupAtInfoList.push({ groupAtAllFlag: 0, groupAtUserID: e3 }), t2.atUserList.push(e3)) : (t2._groupAtInfoList.push({ groupAtAllFlag: 1 }), t2.atUserList.push(A.MSG_AT_ALL)); }), O(e2.groupAtInfo) && e2.groupAtInfo.forEach(function(e3) { 0 === e3.groupAtAllFlag ? t2.atUserList.push(e3.groupAtUserID) : 1 === e3.groupAtAllFlag && t2.atUserList.push(A.MSG_AT_ALL); }); } }, { key: "getGroupAtInfoList", value: function() { return this._groupAtInfoList; } }, { key: "_initProxy", value: function() { this._elements[0] && (this.payload = this._elements[0].content, this.type = this._elements[0].type); } }, { key: "reInitialize", value: function(e2) { e2 && (this.status = this.from ? Rn : An, !this.from) && (this.from = e2), this._initFlow(e2), this._initSequence(e2), this._concatConversationID(e2), this.generateMessageID(); } }, { key: "isSendable", value: function() { return 0 !== this._elements.length && (true === this._relayFlag || "function" == typeof this._elements[0].sendable && this._elements[0].sendable()); } }, { key: "_initTo", value: function(e2) { this.conversationType === A.CONV_GROUP && (this.to = e2.groupID); } }, { key: "_initSequence", value: function(e2) { var t2, n2, o2; 0 === this.clientSequence && e2 && (this.clientSequence = !!(e2 = e2) && (void 0 === St[e2] && (o2 = /* @__PURE__ */ new Date(), t2 = "3".concat(o2.getHours()).slice(-2), n2 = "0".concat(o2.getMinutes()).slice(-2), o2 = "0".concat(o2.getSeconds()).slice(-2), St[e2] = parseInt([t2, n2, o2, "0001"].join("")), o2 = n2 = t2 = null, M.l("autoIncrementIndex start index:".concat(St[e2]))), St[e2]++)), 0 === this.sequence && this.conversationType === A.CONV_C2C && (this.sequence = this.clientSequence); } }, { key: "generateMessageID", value: function() { this.from === A.CONV_SYSTEM && (this.senderTinyID = "144115198244471703"), this.ID = "".concat(this.senderTinyID, "-").concat(this.clientTime, "-").concat(this.random); } }, { key: "_initFlow", value: function(e2) { "" !== e2 && (e2 === this.from ? (this.flow = "out", this.isRead = true) : this.flow = "in"); } }, { key: "_concatConversationID", value: function(e2) { var t2 = this.to, n2 = this.conversationType; n2 !== A.CONV_SYSTEM ? (e2 = n2 === A.CONV_C2C ? e2 === this.from ? t2 : this.from : this.to, this.conversationID = e2 ? "".concat(n2).concat(e2) : null) : this.conversationID = A.CONV_SYSTEM; } }, { key: "isElement", value: function(e2) { return e2 instanceof eo || e2 instanceof uo || e2 instanceof lo || e2 instanceof po || e2 instanceof mo || e2 instanceof Io || e2 instanceof ho || e2 instanceof fo || e2 instanceof vo || e2 instanceof Mo || e2 instanceof Co; } }, { key: "setElement", value: function(e2, t2, n2, o2) { var i2 = this; if (this.isElement(e2)) this._elements = [e2]; else { var a2 = function(e3) { if (e3.type && e3.content) switch (e3.type) { case A.MSG_TEXT: i2.setTextElement(e3.content); break; case A.MSG_IMAGE: i2.setImageElement(e3.content, t2, n2, o2); break; case A.MSG_AUDIO: i2.setAudioElement(e3.content, t2, n2, o2); break; case A.MSG_FILE: i2.setFileElement(e3.content, t2, n2, o2); break; case A.MSG_VIDEO: i2.setVideoElement(e3.content, t2, n2, o2); break; case A.MSG_CUSTOM: i2.setCustomElement(e3.content); break; case A.MSG_LOCATION: i2.setLocationElement(e3.content); break; case A.MSG_GRP_TIP: i2.setGroupTipElement(e3.content); break; case A.MSG_GRP_SYS_NOTICE: i2.setGroupSystemNoticeElement(e3.content); break; case A.MSG_FACE: i2.setFaceElement(e3.content); break; case A.MSG_MERGER: i2.setMergerElement(e3.content, t2, n2, o2); } }; if (O(e2)) for (var s2 = 0; s2 < e2.length; s2++) a2(e2[s2]); else a2(e2); } this._initProxy(); } }, { key: "clearElement", value: function() { this._elements.length = 0; } }, { key: "setTextElement", value: function(e2) { e2 = "string" == typeof e2 ? e2 : e2.text, e2 = new eo({ text: e2 }); this._elements.push(e2); } }, { key: "setImageElement", value: function(e2, t2, n2, o2) { e2 = new uo(e2, t2, n2, o2); this._elements.push(e2); } }, { key: "setAudioElement", value: function(e2, t2, n2, o2) { e2 = new po(e2, t2, n2, o2); this._elements.push(e2); } }, { key: "setFileElement", value: function(e2, t2, n2, o2) { e2 = new mo(e2, t2, n2, o2); this._elements.push(e2); } }, { key: "setVideoElement", value: function(e2, t2, n2, o2) { e2 = new Io(e2, t2, n2, o2); this._elements.push(e2); } }, { key: "setLocationElement", value: function(e2) { e2 = new Mo(e2); this._elements.push(e2); } }, { key: "setCustomElement", value: function(e2) { e2 = new vo(e2); this._elements.push(e2); } }, { key: "setGroupTipElement", value: function(e2) { var t2, n2 = {}, o2 = e2.operationType; S(e2.memberInfoList) ? e2.operatorInfo && (n2 = e2.operatorInfo) : o2 !== A.GRP_TIP_MBR_JOIN && o2 !== A.GRP_TIP_MBR_KICKED_OUT && o2 !== A.GRP_TIP_MBR_SET_ADMIN && o2 !== A.GRP_TIP_MBR_CANCELED_ADMIN || (n2 = e2.memberInfoList[0]), S(e2.memberExtraInfo) || (t2 = e2.memberExtraInfo.reason, e2.msgMemberInfo.forEach(function(e3) { e3.reason = t2; })); o2 = n2.nick, n2 = n2.avatar, m(o2) && (this.nick = o2), m(n2) && (this.avatar = n2), o2 = new ho(e2); this._elements.push(o2); } }, { key: "setGroupSystemNoticeElement", value: function(e2) { e2 = new fo(e2); this._elements.push(e2); } }, { key: "setFaceElement", value: function(e2) { e2 = new lo(e2); this._elements.push(e2); } }, { key: "setMergerElement", value: function(e2, t2, n2, o2) { e2 = new Co(e2, t2, n2, o2); this._elements.push(e2); } }, { key: "setIsRead", value: function(e2) { this.isRead = e2; } }, { key: "setRelayFlag", value: function(e2) { this._relayFlag = e2; } }, { key: "_computePriority", value: function(e2) { if (!N(e2)) { if (m(e2) && -1 !== Object.values(To).indexOf(e2)) return e2; if (R(e2)) { e2 = "" + e2; if (-1 !== Object.keys(To).indexOf(e2)) return To[e2]; } } return A.MSG_PRIORITY_NORMAL; } }, { key: "setNickAndAvatar", value: function(e2) { var t2 = e2.nick, e2 = e2.avatar; m(t2) && (this.nick = t2), m(e2) && (this.avatar = e2); } }, { key: "setNameCard", value: function(e2) { m(e2) && (this.nameCard = e2); } }, { key: "initC2CReadReceiptInfo", value: function(e2) { var t2 = e2.readReceiptSentByPeer, e2 = e2.timestamp, e2 = void 0 === e2 ? 0 : e2; this.conversationType === A.CONV_C2C && true === this.needReadReceipt && (this.readReceiptInfo.isPeerRead = 1 === (void 0 === t2 ? void 0 : t2), this.readReceiptInfo.timestamp = e2); } }]), Eo); function Eo(e2) { d(this, Eo), this.ID = "", this.conversationID = e2.conversationID || null, this.conversationType = e2.conversationType || A.CONV_C2C, this.conversationSubType = e2.conversationSubType, this.time = e2.time || Math.ceil(Date.now() / 1e3), this.sequence = e2.sequence || 0, this.clientSequence = e2.clientSequence || e2.sequence || 0, this.random = e2.random || 0 === e2.random ? e2.random : ft(), this.priority = this._computePriority(e2.priority), this.nick = e2.nick || "", this.avatar = e2.avatar || "", this.isPeerRead = false, this.nameCard = "", this.hasRiskContent = on(e2.checkResult), this._elements = [], this.isPlaceMessage = e2.isPlaceMessage || 0, this.isRevoked = 2 === e2.isPlaceMessage || 8 === e2.msgFlagBits, this.from = e2.from || null, this.to = e2.to || null, this.flow = "", this.isSystemMessage = e2.isSystemMessage || false, this.protocol = e2.protocol || "JSON", this.isResend = false, this.isRead = false, this.status = e2.status || Rn, this._onlineOnlyFlag = false, this._groupAtInfoList = [], this._relayFlag = false, this.atUserList = [], this.cloudCustomData = e2.cloudCustomData || "", this.isDeleted = false, this.isModified = !!e2.messageVersion, this._isExcludedFromUnreadCount = !(!e2.messageControlInfo || 1 !== e2.messageControlInfo.excludedFromUnreadCount), this._isExcludedFromLastMessage = !(!e2.messageControlInfo || 1 !== e2.messageControlInfo.excludedFromLastMessage), this.clientTime = e2.clientTime || Be() || 0, this.senderTinyID = e2.senderTinyID || e2.tinyID || "", this.readReceiptInfo = e2.readReceiptInfo || { readCount: void 0, unreadCount: void 0, isPeerRead: void 0, timestamp: 0 }, this.needReadReceipt = true === e2.needReadReceipt || 1 === e2.needReadReceipt, this.version = e2.messageVersion || 0, this.isBroadcastMessage = e2.isBroadcastMessage || false, this._receiverList = e2.receiverList || void 0, this.isSupportExtension = true === e2.isSupportExtension || 1 === e2.isSupportExtension, this._cmConfigID = e2.customModerationConfigurationID, this.revoker = e2.revokerInfo && e2.revokerInfo.revoker || "", this.revokerInfo = e2.revokerInfo || { userID: "", nick: "", avatar: "" }, this.revokeReason = e2.revokeReason || "", this.reInitialize(e2.currentUser), this.extractGroupInfo(e2.groupProfile || null), this.handleGroupAtInfo(e2), this.initC2CReadReceiptInfo(e2); } function Lo(e2, t2, n2, o2) { var i2, a2, s2, r2, c2, u2, l2; d(this, Lo), this.type = A.MSG_MERGER, this.content = { downloadKey: "", pbDownloadKey: "", messageList: [], title: "", abstractList: [], compatibleText: "", version: 0, layersOverLimit: false }, e2.downloadKey ? (a2 = e2.downloadKey, s2 = e2.pbDownloadKey, r2 = e2.title, c2 = e2.abstractList, u2 = e2.compatibleText, i2 = e2.version, this.content.downloadKey = a2, this.content.pbDownloadKey = s2, this.content.title = r2, this.content.abstractList = c2, this.content.compatibleText = u2, this.content.version = i2 || 0) : S(e2.messageList) ? 1 === e2.layersOverLimit && (this.content.layersOverLimit = true) : (a2 = e2.messageList, s2 = e2.title, r2 = e2.abstractList, c2 = e2.compatibleText, u2 = e2.version, l2 = [], a2.forEach(function(e3) { S(e3) || (e3 = new yo(e3, t2, n2, o2), l2.push(e3)); }), this.content.messageList = l2, this.content.title = s2, this.content.abstractList = r2, this.content.compatibleText = c2, this.content.version = u2 || 0); } function So(e2, t2, n2, o2) { var i2, a2; d(this, So), this.from = e2.from, this.messageSender = e2.from, this.time = e2.time, this.messageSequence = e2.sequence, this.clientSequence = e2.clientSequence || e2.sequence, this.messageRandom = e2.random, this.cloudCustomData = e2.cloudCustomData || "", this.clientTime = e2.clientTime || void 0, e2.ID ? (this.ID = e2.ID || "", this.nick = e2.nick || "", this.avatar = e2.avatar || "", e2.messageBody ? this.messageBody = JSON.parse(JSON.stringify(e2.messageBody)) : this.messageBody = [{ type: e2.type, payload: e2.payload }], e2.conversationType ? e2.conversationType.startsWith(A.CONV_C2C) ? this.receiverUserID = e2.to : e2.conversationType.startsWith(A.CONV_GROUP) && (this.receiverGroupID = e2.to) : e2.receiverGroupID ? this.receiverGroupID = e2.receiverGroupID : e2.receiverUserID && (this.receiverUserID = e2.receiverUserID), this.messageReceiver = e2.to || e2.messageReceiver) : (this.nick = e2.nick || "", this.avatar = e2.avatar || "", this.messageBody = [], i2 = e2.elements[0].type, a2 = e2.elements[0].content, this._patchRichMediaPayload(i2, a2), this._updateRichMediaDownloadUrl(i2, a2, t2, n2, o2), i2 === A.MSG_MERGER ? this.messageBody.push({ type: i2, payload: new Co(a2, t2, n2, o2).content }) : this.messageBody.push({ type: i2, payload: a2 }), e2.groupID && (this.receiverGroupID = e2.groupID, this.messageReceiver = e2.groupID), e2.to && (this.receiverUserID = e2.to, this.messageReceiver = e2.to), this.ID = "".concat(e2.tinyID, "-").concat(e2.clientTime, "-").concat(e2.random)); } function ko(e2) { d(this, ko), this.type = A.MSG_LOCATION; var t2 = e2.description, n2 = e2.longitude, e2 = e2.latitude; this.content = { description: t2, longitude: n2, latitude: e2 }; } function Ao(e2, t2, n2, o2) { d(this, Ao), this.type = A.MSG_VIDEO, this._percent = 0, this.content = { remoteVideoUrl: e2.remoteVideoUrl || e2.videoUrl || "", videoFormat: e2.videoFormat, videoSecond: parseInt(e2.videoSecond, 10), videoSize: e2.videoSize, videoUrl: ao(e2.videoUrl, t2, n2, o2), videoDownloadFlag: 2, videoUUID: e2.videoUUID, thumbUUID: e2.thumbUUID, thumbFormat: e2.thumbFormat, thumbWidth: e2.thumbWidth, snapshotWidth: e2.thumbWidth, thumbHeight: e2.thumbHeight, snapshotHeight: e2.thumbHeight, thumbSize: e2.thumbSize, snapshotSize: e2.thumbSize, thumbDownloadFlag: 2, thumbUrl: ao(e2.thumbUrl, t2, n2, o2), snapshotUrl: ao(e2.thumbUrl, t2, n2, o2) }; } function Ro(e2) { d(this, Ro), this.type = A.MSG_CUSTOM, this.content = { data: e2.data || "", description: e2.description || "", extension: e2.extension || "" }; } function Oo(e2, t2, n2, o2) { d(this, Oo), this.type = A.MSG_FILE, this._percent = 0; var i2 = this._getFileInfo(e2); this.content = { downloadFlag: 2, fileUrl: ao(e2.url || e2.fileUrl, t2, n2, o2) || "", uuid: e2.uuid, fileName: i2.name || "", fileSize: i2.size || 0 }; } function No(e2) { d(this, No), this.type = A.MSG_GRP_SYS_NOTICE, this.content = {}, this._initContent(e2); } function Go(e2) { d(this, Go), this.type = A.MSG_GRP_TIP, this.content = {}, this._initContent(e2); } function Po(e2, t2, n2, o2) { d(this, Po), this.type = A.MSG_AUDIO, this._percent = 0, this.content = { downloadFlag: 2, second: e2.second, size: e2.size, url: ao(e2.url, t2, n2, o2), remoteAudioUrl: e2.url || "", uuid: e2.uuid }; } function Uo(e2) { d(this, Uo), this.type = A.MSG_FACE, this.content = e2 || null; } function bo(e2, t2, n2, o2) { d(this, bo), this._imageMemoryURL = "", this._fileDownloadProxy = t2, this._authKey = n2, this._fileDNList = o2, v || ye ? this.createImageDataASURL(e2.file) : this.createImageDataASURLInWeb(e2.file), this._initImageInfoModel(), this.type = A.MSG_IMAGE, this._percent = 0, this.content = { imageFormat: e2.imageFormat || Xe.UNKNOWN, uuid: e2.uuid, imageInfoArray: [] }, this.initImageInfoArray(e2.imageInfoArray), this._autoFixUrl(); } function wo(e2) { if (f(e2)) return { pushFlag: true === e2.disablePush ? 1 : 0, title: e2.title || "", desc: e2.description || "", ext: e2.extension || "", apnsInfo: (n2 = void 0 === (n2 = (t2 = e2).apnsInfo) ? {} : n2, o2 = t2.ignoreIOSBadge, t2 = t2.disableVoipPush, o2 = true === n2.ignoreIOSBadge || true === (void 0 !== o2 && o2) ? 1 : 0, i2 = void 0, N(t2) || (i2 = false === t2 ? 1 : 0), N(n2.disableVoipPush) || (i2 = false === n2.disableVoipPush ? 1 : 0), y(y({}, n2), {}, { badgeMode: o2, isVoipPush: i2 })), androidInfo: (n2 = void 0 === (n2 = (t2 = e2).androidInfo) ? {} : n2, t2 = t2.androidOPPOChannelID, t2 = n2.OPPOChannelID || (void 0 === t2 ? "" : t2), y(y({}, n2), {}, { Sound: -1 === (i2 = (o2 = n2.sound || "").lastIndexOf(".")) ? o2 : o2.slice(0, i2), OPPOChannelID: t2, GoogleChannelID: n2.FCMChannelID || "" })) }; var t2, n2, o2, i2; } t(Ho, u), Fo = n(Ho), e(Ho, [{ key: "onNewMessage", value: function(e2) { var t2 = e2.dataList, n2 = e2.isInstantMessage, o2 = e2.C2CRemainingUnreadList, i2 = e2.C2CPairUnreadList, e2 = e2.isSyncingEnded, t2 = (n2 || M.l("".concat(this._n, ".onNewMessage C2CPairUnreadList:"), i2, "C2CRemainingUnreadList:", o2), this._assembly({ dataList: t2, C2CRemainingUnreadList: o2, C2CPairUnreadList: i2, isInstantMessage: n2 })), o2 = t2.conversationOptionsList, i2 = t2.messageList, t2 = t2.isUnreadC2CMessage, a2 = At(i2), a2 = (0 < a2.length && this.emitOEvt(h.MESSAGE_MODIFIED, a2), this.get(11).onNewMessage({ conversationOptionsList: o2, isInstantMessage: n2, isUnreadC2CMessage: t2, isSyncingEnded: e2 }), Rt(i2)); n2 && 0 < a2.length && this.emitOEvt(h.MESSAGE_RECEIVED, a2), i2.length = 0; } }, { key: "_assembly", value: function(e2) { for (var t2 = e2.dataList, n2 = e2.C2CRemainingUnreadList, o2 = e2.C2CPairUnreadList, i2 = e2.isInstantMessage, a2 = null, s2 = [], r2 = [], c2 = {}, u2 = this.get(26), l2 = false, d2 = this.get(11), p2 = this.get(4), e2 = this.get(17), _2 = this.getFileDownloadProxy(), h2 = this.getDowloadFileAuthKey(), g2 = e2.getFileDNList(), f2 = 0, m2 = t2.length; f2 < m2; f2++) if (this._isC2CNotice(t2[f2])) this._noticeFromUnreadDBList.push(t2[f2].eventArray[0].c2CNotifyMsgArray[0]); else { var v2 = t2[f2], I2 = (v2.currentUser = this.getMyUserID(), v2.conversationType = A.CONV_C2C, v2.isSystemMessage = !!v2.isSystemMessage, (N(v2.nick) || N(v2.avatar)) && (l2 = true), (a2 = new Do(v2)).setElement(v2.elements, _2, h2, g2), a2.setNickAndAvatar({ nick: v2.nick, avatar: v2.avatar }), a2.conversationID); if (i2) { if (this._msgFromUnreadDBMap.get(a2.ID)) continue; var M2, y2, C2 = false, T2 = (a2.from !== this.getMyUserID() ? (y2 = d2.getLatestMessageSentByPeer(I2)) && (M2 = y2.nick, y2 = y2.avatar, l2 ? a2.setNickAndAvatar({ nick: M2, avatar: y2 }) : M2 === a2.nick && y2 === a2.avatar || (C2 = true)) : (M2 = d2.getLatestMessageSentByMe(I2)) && (y2 = M2.nick, T2 = M2.avatar, y2 === a2.nick && T2 === a2.avatar || (d2.modifyMessageSentByMe({ conversationID: I2, latestNick: a2.nick, latestAvatar: a2.avatar }), p2.mockOnNickAvatarModified(a2.nick, a2.avatar))), 1 === t2[f2].isModified); if (d2.isMessageSentByCurrentInstance(a2) ? a2.isModified = T2 : T2 = false, 0 === v2.msgLifeTime) a2._onlineOnlyFlag = true, d2.isMessageSentByCurrentInstance(a2) || r2.push(a2); else { if (!d2.pushIntoMessageList(r2, a2, T2)) continue; C2 && (d2.modifyMessageSentByPeer({ conversationID: I2, latestNick: a2.nick, latestAvatar: a2.avatar }), d2.updateUserProfileSpecifiedKey({ conversationID: I2, nick: a2.nick, avatar: a2.avatar })); } i2 && 0 < a2.clientTime && u2.addMessageDelay(a2.clientTime); } else this._msgFromUnreadDBMap.set(a2.ID, a2); if (0 !== v2.msgLifeTime) { if (false === a2._onlineOnlyFlag) { C2 = d2.getLastMessageTime(I2); if (R(C2) && a2.time < C2) continue; i2 && (N(c2[I2]) ? (v2 = 0, "in" !== a2.flow || a2._isExcludedFromUnreadCount || (v2 = 1), c2[I2] = s2.push({ conversationID: I2, unreadCount: v2, type: a2.conversationType, subType: a2.conversationSubType, lastMessage: a2._isExcludedFromLastMessage ? "" : a2 }) - 1) : (v2 = c2[I2], s2[v2].type = a2.conversationType, s2[v2].subType = a2.conversationSubType, s2[v2].lastMessage = a2._isExcludedFromLastMessage ? "" : a2, "in" !== a2.flow || a2._isExcludedFromUnreadCount || s2[v2].unreadCount++)); } } else a2._onlineOnlyFlag = true; } this._handleNoticeFromUnreadDB(); var D2 = false; if (O(o2) && 0 < o2.length) for (var E2 = 0, L2 = o2.length; E2 < L2; E2++) !function(t3) { if (o2[t3].from === A.CONV_SYSTEM) return; D2 = true; var e3 = s2.find(function(e4) { return e4.conversationID === "".concat(A.CONV_C2C).concat(o2[t3].from); }); e3 ? e3.unreadCount = o2[t3].unreadCount : s2.push({ conversationID: "".concat(A.CONV_C2C).concat(o2[t3].from), unreadCount: o2[t3].unreadCount, type: A.CONV_C2C }); }(E2); if (O(n2)) for (var S2 = 0, k2 = n2.length; S2 < k2; S2++) !function(t3) { s2.find(function(e3) { return e3.conversationID === "".concat(A.CONV_C2C).concat(n2[t3].from); }) || s2.push({ conversationID: "".concat(A.CONV_C2C).concat(n2[t3].from), type: A.CONV_C2C, lastMsgTime: n2[t3].lastMsgTime }); }(S2); return { conversationOptionsList: s2, messageList: r2, isUnreadC2CMessage: D2 }; } }, { key: "getMessageListFromUnreadDB", value: function() { return p(this._msgFromUnreadDBMap.values()); } }, { key: "_isC2CNotice", value: function(e2) { e2 = e2.eventArray; return !(!O(e2) || 10 !== e2[0].event); } }, { key: "_handleNoticeFromUnreadDB", value: function() { var t2, e2 = this._noticeFromUnreadDBList.length; 0 !== e2 && (M.l("".concat(this._n, "._handleNoticeFromUnreadDB count:").concat(e2)), t2 = [], this._noticeFromUnreadDBList.forEach(function(e3) { e3.hasOwnProperty("c2cMessageRevokedNotify") && t2.push(e3); }), this.onMsgRevoked({ dataList: t2 }), this._noticeFromUnreadDBList.length = 0, t2.length = 0); } }, { key: "onMsgRevoked", value: function(e2) { var a2, s2 = this, r2 = this.get(11), c2 = []; e2.dataList.forEach(function(e3) { e3.c2cMessageRevokedNotify && (e3 = e3.c2cMessageRevokedNotify.revokedInfos, N(e3) || e3.forEach(function(e4) { var t2 = s2.getMyUserID() === e4.from ? "".concat(A.CONV_C2C).concat(e4.to) : "".concat(A.CONV_C2C).concat(e4.from); a2 = r2.revoke(t2, e4.sequence, e4.random); var n2, o2 = e4.revokerInfo && e4.revokerInfo.revoker, i2 = e4.revokerInfo && e4.revokerInfo.reason || ""; a2 ? n2 = a2 : (n2 = { conversationID: t2, sequence: e4.sequence }, e4.tinyID && e4.clientTime && e4.random && (n2.ID = "".concat(e4.tinyID, "-").concat(e4.clientTime, "-").concat(e4.random)), e4.time && (n2.time = e4.time)), n2 && (n2.revoker = o2, n2.revokeReason = i2, n2.revokerInfo = { userID: o2, nick: "", avatar: "" }, c2.push(n2)); })); }), 0 !== c2.length && (r2.onMessageRevoked(c2), M.l("".concat(this._n, ".onMsgRevoked count:").concat(c2.length)), r2.updateRevokerInfo(c2).then(function(e3) { s2.emitOEvt(h.MESSAGE_REVOKED, e3); })); } }, { key: "onMsgReadReceipt", value: function(e2) { var i2 = this; e2.dataList.forEach(function(e3) { var o2; S(e3.c2cMessageReadReceipt) || (o2 = e3.c2cMessageReadReceipt.to, e3.c2cMessageReadReceipt.uinPairReadArray.forEach(function(e4) { var e4 = e4.peerReadTime, t2 = (M.l("".concat(i2._n, ".onMsgReadReceipt to:").concat(o2, " peerReadTime:").concat(e4)), "".concat(A.CONV_C2C).concat(o2)), n2 = i2.get(11); n2.recordPeerReadTime(t2, e4), n2.updateMsgIsPeerReadProp(t2, e4); })); }); } }, { key: "onMsgReadNotice", value: function(e2) { var o2 = this; e2.dataList.forEach(function(e3) { var n2; S(e3.c2cMessageReadNotice) || (n2 = o2.get(11), e3.c2cMessageReadNotice.uinPairReadArray.forEach(function(e4) { var t2 = e4.from, e4 = e4.peerReadTime, t2 = (M.l("".concat(o2._n, ".onMsgReadNotice from:").concat(t2, " lastReadTime:").concat(e4)), "".concat(A.CONV_C2C).concat(t2)); n2.updateIsReadAfterReadReport({ conversationID: t2, lastMessageTime: e4 }), n2.updateUnreadCount(t2); })); }); } }, { key: "onMsgModified", value: function(e2) { M.l("".concat(this._n, ".onMsgModified options:"), e2); var t2 = this.get(11); e2.dataList.forEach(function(e3) { t2.onMessageModified(y(y({}, e3), {}, { conversationType: A.CONV_C2C })); }); } }, { key: "onReadReceiptList", value: function(e2) { M.l("".concat(this._n, ".onReadReceiptList options:"), e2), this.get(11).updateReadReceiptInfo(e2.dataList); } }, { key: "sendMessage", value: function(e2, t2) { e2 = this._createC2CMessagePack(e2, t2); return this.req(e2); } }, { key: "_createC2CMessagePack", value: function(e2, t2) { var n2 = null, o2 = (t2 && (t2.offlinePushInfo && (n2 = t2.offlinePushInfo), true === t2.onlineUserOnly) && (n2 ? n2.disablePush = true : n2 = { disablePush: true }), ""), i2 = (m(e2.cloudCustomData) && 0 < e2.cloudCustomData.length && (o2 = e2.cloudCustomData), []), a2 = (f(t2) && f(t2.messageControlInfo) && (a2 = (r2 = t2.messageControlInfo).excludedFromUnreadCount, s2 = r2.excludedFromLastMessage, r2 = r2.excludedFromContentModeration, true === a2 && i2.push("NoUnread"), true === s2 && i2.push("NoLastMsg"), true === r2) && i2.push("NoMsgCheck"), this.isOnlineMessage(e2, t2) ? 0 : void 0), s2 = JSON.parse(JSON.stringify(e2.getElements())), r2 = this.get(17).getFileDNList(); return { P: k.SEND_C2C_MSG, data: { fromAccount: this.getMyUserID(), toAccount: e2.to, msgBody: so(e2.type, s2, r2), cloudCustomData: o2, msgSeq: e2.sequence, msgRandom: e2.random, msgLifeTime: a2, nick: e2.nick, avatar: e2.avatar, offlinePushInfo: wo(n2), messageControlInfo: 0 !== a2 ? i2 : void 0, clientTime: e2.clientTime, needReadReceipt: true === e2.needReadReceipt ? 1 : 0, isSupportExtension: true === e2.isSupportExtension ? 1 : 0, isRelayMessage: true === e2._relayFlag ? 1 : 0, cmConfigID: e2._cmConfigID } }; } }, { key: "isOnlineMessage", value: function(e2, t2) { return !(!t2 || true !== t2.onlineUserOnly); } }, { key: "revokeMessage", value: function(e2) { return this.req({ P: k.REVOKE_C2C_MSG, data: { msgInfo: { fromAccount: e2.from, toAccount: e2.to, msgSeq: e2.sequence, msgRandom: e2.random, msgTimeStamp: e2.time } } }); } }, { key: "deleteMessage", value: function(e2) { var t2 = e2.to, e2 = e2.keyList; return M.l("".concat(this._n, ".deleteMessage toAccount:").concat(t2, " count:").concat(e2.length)), this.req({ P: k.DEL_C2C_MSG, data: { fromAccount: this.getMyUserID(), to: t2, keyList: e2 } }); } }, { key: "modifyRemoteMessage", value: function(e2) { var t2 = e2.from, n2 = e2.to, o2 = e2.version, o2 = void 0 === o2 ? 0 : o2, i2 = e2.sequence, a2 = e2.random, s2 = e2.time, r2 = e2.payload, c2 = e2.type, u2 = e2.cloudCustomData, e2 = e2._elements, l2 = void 0; return Xt(c2) && (1 < e2.length && e2.splice(0, 1, { type: c2, content: r2 }), l2 = e2), this.req({ P: k.MODIFY_C2C_MSG, data: { from: t2, to: n2, version: o2, sequence: i2, random: a2, time: s2, elements: l2, cloudCustomData: u2 } }); } }, { key: "setMessageRead", value: function(e2) { var t2 = this, n2 = e2.conversationID, o2 = e2.lastMessageTime, i2 = "".concat(this._n, ".").concat("setMessageRead"), e2 = "convID:".concat(n2, " lastMessageTime:").concat(o2), a2 = (M.l("".concat(i2, " ").concat(e2)), R(o2) || this.warn("DoNotModifyLastTime"), new G("setMessageRead")); return a2.setMessage(e2), this.req({ P: k.SET_C2C_MSG_READ, data: { C2CMsgReaded: { cookie: "", C2CMsgReadedItem: [{ toAccount: n2.replace("C2C", ""), lastMessageTime: o2, receipt: 1 }] } } }).then(function() { a2.end(), M.l("".concat(i2, " ok")); var e3 = t2.get(11); return e3.updateIsReadAfterReadReport({ conversationID: n2, lastMessageTime: o2 }), e3.updateUnreadCount(n2), C(); }).catch(function(e3) { return a2.setError(e3).end(), M.l("".concat(i2, " failed. error:"), e3), D(e3); }); } }, { key: "getRoamingMessage", value: function(e2) { var s2 = this, r2 = "".concat(this._n, ".").concat("getRoamingMessage"), t2 = e2.peerAccount, c2 = e2.conversationID, n2 = e2.count, o2 = e2.lastMessageTime, e2 = e2.messageKey, u2 = "peerAccount:".concat(t2, " count:").concat(n2 || 15, " lastMessageTime:").concat(o2 || 0, " messageKey:").concat(e2), l2 = (M.l("".concat(r2, " ").concat(u2)), new G("getRoamingMessage")); return this.req({ P: k.GET_C2C_ROAMING_MSG, data: { peerAccount: t2, count: n2 || 15, lastMessageTime: o2 || 0, messageKey: e2 } }).then(function(e3) { var e3 = e3.data, t3 = e3.complete, n3 = e3.messageList, o3 = e3.messageKey, e3 = e3.lastMessageTime, i2 = (N(n3) ? M.l("".concat(r2, " ok. complete:").concat(t3, " but messageList is undefined!")) : M.l("".concat(r2, " ok. complete:").concat(t3, " count:").concat(n3.length)), l2.setMessage("".concat(u2, " complete:").concat(t3, " length:").concat(n3.length)).end(), s2.get(11)), t3 = 1 === t3, a2 = (t3 && i2.setCompleted(c2), []), n3 = i2.onRoamingMessage(n3, c2, true, a2), o3 = (i2.modifyMessageList(c2), i2.updateIsRead(c2), i2.updateRoamingMsgKeyAndTime(c2, o3, e3), i2.getPeerReadTime(c2)), o3 = (M.l("".concat(r2, " update isPeerRead property. convID:").concat(c2, " peerReadTime:").concat(o3)), o3 ? i2.updateMsgIsPeerReadProp(c2, o3) : (e3 = c2.replace(A.CONV_C2C, ""), s2.getRemotePeerReadTime([e3]).then(function() { i2.updateMsgIsPeerReadProp(c2, i2.getPeerReadTime(c2)); })), ""); return 0 < n3.length ? o3 = n3[0].ID : (e3 = i2.getLocalOldestMessage(c2)) && (o3 = e3.ID), M.l("".concat(r2, " nextReqID:").concat(o3, " storedMsgCount:").concat(n3.length)), { nextReqID: o3, storedMessageList: n3, assembledMessageList: a2, isPullingCompleted: t3 }; }).catch(function(e3) { return l2.setMessage(u2).setError(e3).end(), M.w("".concat(r2, " failed. error:"), e3), D(e3); }); } }, { key: "getRoamingMessagesHopping", value: function(e2) { var a2 = this, s2 = "".concat(this._n, ".").concat("getRoamingMessagesHopping"), t2 = e2.peerAccount, n2 = e2.time, n2 = void 0 === n2 ? 0 : n2, o2 = e2.count, r2 = e2.direction, c2 = "".concat(A.CONV_C2C).concat(t2), u2 = "peerAccount:".concat(t2, " count:").concat(o2, " time:").concat(n2, " direction:").concat(r2), l2 = (M.l("".concat(s2, " ").concat(u2)), new G("getRoamingMessagesHopping")); return this.req({ P: k.GET_C2C_ROAMING_MSG, data: { peerAccount: t2, count: o2 + 1, lastMessageTime: n2, direction: r2 } }).then(function(e3) { var e3 = e3.data, t3 = e3.complete, n3 = e3.messageList, n3 = void 0 === n3 ? [] : n3, e3 = e3.lastMessageTime, o3 = "complete:".concat(t3, " count:").concat(n3.length), i2 = (M.l("".concat(s2, " ok. ").concat(o3)), l2.setMessage("".concat(u2, " ").concat(o3)).end(), 1 !== t3 && (1 === r2 ? n3.pop() : n3.shift()), a2.get(11)), o3 = i2.onRoamingMessage(n3, c2, false), n3 = (a2._modifyMessageList(c2, o3), a2._computeResult({ complete: t3, lastMessageTime: e3, resultList: o3 })), t3 = (i2.storeHoppingMessageList(n3.messageList), i2.getPeerReadTime(c2)); return M.l("".concat(s2, " update isPeerRead property. convID:").concat(c2, " peerReadTime:").concat(t3)), t3 ? i2.updateMsgIsPeerReadProp(c2, t3) : (e3 = c2.replace(A.CONV_C2C, ""), a2.getRemotePeerReadTime([e3]).then(function() { i2.updateMsgIsPeerReadProp(c2, i2.getPeerReadTime(c2)); })), C(n3); }).catch(function(e3) { return l2.setMessage(u2).setError(e3).end(), M.w("".concat(s2, " failed. error:"), e3), D(e3); }); } }, { key: "_computeResult", value: function(e2) { var t2 = e2.complete, t2 = void 0 === t2 ? 0 : t2, n2 = e2.lastMessageTime, e2 = e2.resultList, e2 = { messageList: p(void 0 === e2 ? [] : e2), isCompleted: false, nextMessageTime: "" }; return 1 === t2 ? e2.isCompleted = true : e2.nextMessageTime = n2, e2; } }, { key: "_modifyMessageList", value: function(e2, t2) { e2 = this.get(11).getLocalConversation(e2); if (e2) for (var n2 = e2.userProfile.nick, o2 = e2.userProfile.avatar, e2 = this.get(4).getNickAndAvatarByUserID(this.getMyUserID()), i2 = e2.nick, a2 = e2.avatar, s2 = t2.length - 1; 0 <= s2; s2--) { var r2 = t2[s2]; "in" === r2.flow && (r2.nick !== n2 && r2.setNickAndAvatar({ nick: n2 }), r2.avatar !== o2) && r2.setNickAndAvatar({ avatar: o2 }), "out" === r2.flow && (r2.nick !== i2 && r2.setNickAndAvatar({ nick: i2 }), r2.avatar !== a2) && r2.setNickAndAvatar({ avatar: a2 }); } } }, { key: "getRemotePeerReadTime", value: function(a2) { var s2, r2 = this, c2 = "".concat(this._n, ".").concat("getRemotePeerReadTime"); return S(a2) ? Promise.resolve() : (s2 = new G("getRemotePeerReadTime"), M.l("".concat(c2, " userIDList:").concat(a2)), this.req({ P: k.GET_C2C_PEER_READ_TIME, data: { userIDList: a2 } }).then(function(e2) { var t2 = e2.data.peerReadTimeList; M.l("".concat(c2, " ok. peerReadTimeList:").concat(t2)); for (var n2 = "", o2 = r2.get(11), i2 = 0; i2 < a2.length; i2++) n2 += "".concat(a2[i2], "-").concat(t2[i2], " "), 0 < t2[i2] && o2.recordPeerReadTime("".concat(A.CONV_C2C).concat(a2[i2]), t2[i2]); s2.setMessage(n2).end(); }).catch(function(e2) { s2.setError(e2).end(), M.w("".concat(c2, " failed. error:"), e2); })); } }, { key: "sendReadReceipt", value: function(e2) { var t2, n2 = e2[0].conversationID.replace(A.CONV_C2C, ""), o2 = new G("sendReadReceipt"), i2 = (o2.setMessage("peerAccount:".concat(n2)), this.getMyUserID()), e2 = e2.filter(function(e3) { return e3.from !== i2 && true === e3.needReadReceipt; }).map(function(e3) { return { fromAccount: e3.from, toAccount: e3.to, sequence: e3.sequence, random: e3.random, time: e3.time, clientTime: e3.clientTime }; }); return 0 === e2.length ? D({ code: L.READ_RECEIPT_MSG_LIST_EMPTY }) : (t2 = "".concat(this._n, ".").concat("sendReadReceipt"), M.l("".concat(t2, ". peerAccount:").concat(n2, " length:").concat(e2.length)), this.req({ P: k.SEND_C2C_READ_RECEIPT, data: { peerAccount: n2, messageInfoList: e2 } }).then(function(e3) { return o2.end(), M.l("".concat(t2, " ok")), C(); }).catch(function(e3) { return o2.setError(e3).end(), M.w("".concat(t2, " failed. error:"), e3), D(e3); })); } }, { key: "getReadReceiptList", value: function(e2) { var t2 = e2[0].conversationID.replace(A.CONV_C2C, ""); return M.l("".concat(this._n, ".getReadReceiptList peerAccount:").concat(t2, " msgCount:").concat(e2.length)), T({ messageList: e2 }); } }, { key: "getMessageExtensions", value: function(e2, t2) { return M.l("".concat(this._n, ".getMessageExtensions startSequence:").concat(t2)), this.req({ P: k.GET_C2C_MSG_EXT, data: { from: e2.from, to: e2.to, messageKey: this.getMessageKey(e2), startSequence: t2 } }); } }, { key: "modifyMsgExts", value: function(e2, t2) { var n2 = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1; return M.l("".concat(this._n, ".modifyMsgExts operateType:").concat(n2)), this.req({ P: k.MODIFY_C2C_MSG_EXT, data: { from: e2.from, to: e2.to, messageKey: this.getMessageKey(e2), extensionList: t2, operateType: n2 } }); } }, { key: "getMessageKey", value: function(e2) { var t2 = e2.clientSequence, n2 = e2.random, e2 = e2.time; return "".concat(t2, "_").concat(n2, "_").concat(e2); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._msgFromUnreadDBMap.clear(), this._noticeFromUnreadDBList.length = 0; } }]); var Fo, qo = Ho, P = { A2KEY_AND_TINYID_UPDATED: "_inner".concat(1), CLOUD_CONFIG: "_inner".concat(2), PROFILE_UPDATED: "_inner".concat(3), CONV_SYNC_COMPLETED: "_inner".concat(4), C2C_UNREAD_HANDLE_COMPLETED: "_inner".concat(5) }, xo = (e(Vo, [{ key: "_onCloudConfig", value: function() { var e2 = this._convM.getCloudConfig("topic_msg_limit"); N(e2) || (this.TOPIC_MSG_LIMIT = Number(e2)), M.l("".concat(this._n, "._onCloudConfig topicMsgLimit:").concat(this.TOPIC_MSG_LIMIT)); } }, { key: "onCheckTimer", value: function(e2) { if (e2 % 20 == 0 && 0 < this._map.size) { var t2, n2 = Z(this._map); try { for (n2.s(); !(t2 = n2.n()).done; ) { var o2 = Y(t2.value, 2), i2 = o2[0], a2 = o2[1]; i2.includes(it) && a2.size >= this.TOPIC_MSG_LIMIT && this._convM.clearMemMsg(i2, true); } } catch (e3) { n2.e(e3); } finally { n2.f(); } } } }, { key: "pushIn", value: function(e2) { var t2 = 1 < arguments.length && void 0 !== arguments[1] && arguments[1], n2 = e2.conversationID, o2 = true, i2 = (this._map.has(n2) || this._map.set(n2, /* @__PURE__ */ new Map()), this._getUniqueIDOfMsg(e2)); if (this._map.get(n2).has(i2)) { var a2 = this._map.get(n2).get(i2); if (!t2 || true === a2.isModified) return false; } return this._map.get(n2).set(i2, e2), this._setLatestMsgSentByPeer(n2, e2), this._setLatestMsgSentByMe(n2, e2), o2; } }, { key: "unshift", value: function(e2, t2) { var n2; if (O(e2) ? 0 < e2.length && (n2 = e2[0].conversationID, this._unshiftMultipleMsgs(e2, t2)) : (n2 = e2.conversationID, this._unshiftSingleMsg(e2, t2)), n2) { var o2 = Array.from(this._map.get(n2).values()), e2 = o2.length; if (0 !== e2) { for (var i2 = e2 - 1; 0 <= i2; i2--) if ("out" === o2[i2].flow) { this._setLatestMsgSentByMe(n2, o2[i2]); break; } if (n2.startsWith(A.CONV_C2C)) { for (var a2 = e2 - 1; 0 <= a2; a2--) if ("in" === o2[a2].flow) { this._setLatestMsgSentByPeer(n2, o2[a2]); break; } } } } } }, { key: "_unshiftSingleMsg", value: function(e2, t2) { var n2, o2, i2 = e2.conversationID, a2 = this._getUniqueIDOfMsg(e2); this._map.has(i2) ? (n2 = this._map.get(i2), o2 = Array.from(n2), n2.has(a2) || (o2.unshift([a2, e2]), this._map.set(i2, new Map(o2)), t2.push(e2))) : (this._map.set(i2, /* @__PURE__ */ new Map()), this._map.get(i2).set(a2, e2), t2.push(e2)); } }, { key: "_unshiftMultipleMsgs", value: function(e2, t2) { for (var n2 = e2.length, o2 = [], i2 = e2[0].conversationID, a2 = this._map.get(i2), s2 = this._map.has(i2) ? Array.from(a2) : [], r2 = 0; r2 < n2; r2++) { var c2 = this._getUniqueIDOfMsg(e2[r2]); a2 && a2.has(c2) || (o2.push([c2, e2[r2]]), t2.push(e2[r2])); } this._map.set(i2, new Map(o2.concat(s2))); } }, { key: "remove", value: function(e2) { var t2 = e2.conversationID, e2 = this._getUniqueIDOfMsg(e2); this._map.has(t2) && this._map.get(t2).delete(e2); } }, { key: "revoke", value: function(e2, t2, n2) { var o2; return this._map.has(e2) ? (o2 = this._map.get(e2), this._updateMsgIsRevoked(o2, t2, n2)) : this._hoppingMsgMap.has(e2) ? (o2 = this._hoppingMsgMap.get(e2), this._updateMsgIsRevoked(o2, t2, n2)) : null; } }, { key: "_updateMsgIsRevoked", value: function(e2, t2, n2) { var o2, i2 = Z(e2); try { for (i2.s(); !(o2 = i2.n()).done; ) { var a2 = Y(o2.value, 2)[1]; if (a2.sequence === t2 && (N(n2) || a2.random === n2)) return a2.isRevoked || (a2.isRevoked = true), a2; } } catch (e3) { i2.e(e3); } finally { i2.f(); } } }, { key: "removeByConvID", value: function(e2) { var t2 = this._map.has(e2); M.l("".concat(this._n, ".removeByConvID convID:").concat(e2, " has:").concat(t2)), t2 && (this._map.delete(e2), this._latestMsgSentByPeerMap.delete(e2), this._latestMsgSentByMeMap.delete(e2)); } }, { key: "findMessage", value: function(e2) { return this._findMsg(e2, this._map) || this._findMsg(e2, this._hoppingMsgMap); } }, { key: "_findMsg", value: function(e2, t2) { var n2, o2 = null, i2 = Z(t2); try { for (i2.s(); !(n2 = i2.n()).done; ) for (var a2 = p(Y(n2.value, 2)[1].values()), s2 = a2.length, r2 = 0; r2 < s2; r2++) if (a2[r2].ID === e2) { o2 = a2[r2]; break; } } catch (e3) { i2.e(e3); } finally { i2.f(); } return o2; } }, { key: "updateMsgIsPeerReadProp", value: function(e2, t2) { var n2, o2 = []; return this._map.has(e2) ? (n2 = this._map.get(e2), o2 = this._updateMsgIsPeerReadProp(n2, t2)) : this._hoppingMsgMap.has(e2) && (n2 = this._hoppingMsgMap.get(e2), o2 = this._updateMsgIsPeerReadProp(n2, t2)), M.l("".concat(this._n, ".updateMsgIsPeerReadProp convID:").concat(e2, " peerReadTime:").concat(t2, " count:").concat(o2.length)), o2; } }, { key: "_updateMsgIsPeerReadProp", value: function(e2, t2) { var n2, o2 = [], i2 = Z(e2); try { for (i2.s(); !(n2 = i2.n()).done; ) { var a2 = Y(n2.value, 2)[1]; a2.time <= t2 && !a2.isPeerRead && "out" === a2.flow && (a2.isPeerRead = true, o2.push(a2)); } } catch (e3) { i2.e(e3); } finally { i2.f(); } return o2; } }, { key: "updateMsgIsModifiedProp", value: function(e2) { var t2 = e2.conversationID; this._map.has(t2) && (e2 = this._getUniqueIDOfMsg(e2), t2 = this._map.get(t2).get(e2)) && (t2.isModified = true); } }, { key: "hasLocalMsgList", value: function(e2) { return this._map.has(e2); } }, { key: "getLocalMsgList", value: function(e2) { return this.hasLocalMsgList(e2) ? p(this._map.get(e2).values()) : []; } }, { key: "getLocalMaxSeq", value: function(e2) { return this.hasLocalMsgList(e2) ? (e2 = p(this._map.get(e2).values()).map(function(e3) { return e3.sequence; }), Math.max.apply(Math, p(e2))) : 0; } }, { key: "getLocalMaxTime", value: function(e2) { return this.hasLocalMsgList(e2) ? (e2 = p(this._map.get(e2).values()).map(function(e3) { return e3.time; }), Math.max.apply(Math, p(e2))) : 0; } }, { key: "hasLocalMsg", value: function(e2, t2) { for (var n2 = false, o2 = this.getLocalMsgList(e2), i2 = o2.length, a2 = 0; a2 < i2; a2++) o2[a2].ID === t2 && (n2 = true); return n2; } }, { key: "getLocalMsg", value: function(e2, t2) { for (var n2 = null, o2 = this.getLocalMsgList(e2), i2 = o2.length, a2 = 0; a2 < i2; a2++) if (o2[a2].ID === t2) { n2 = o2[a2]; break; } return n2; } }, { key: "getLocalLastMsg", value: function(e2) { e2 = this.getLocalMsgList(e2); return e2[e2.length - 1]; } }, { key: "getLocalSecondLastMsg", value: function(e2) { e2 = this.getLocalMsgList(e2); return e2[e2.length - 2]; } }, { key: "getLocalOldestMsg", value: function(e2) { return this.getLocalMsgList(e2)[0]; } }, { key: "_setLatestMsgSentByPeer", value: function(e2, t2) { e2.startsWith(A.CONV_C2C) && "in" === t2.flow && this._latestMsgSentByPeerMap.set(e2, t2); } }, { key: "_setLatestMsgSentByMe", value: function(e2, t2) { "out" === t2.flow && this._latestMsgSentByMeMap.set(e2, t2); } }, { key: "getLatestMsgSentByPeer", value: function(e2) { return this._latestMsgSentByPeerMap.get(e2); } }, { key: "getLatestMsgSentByMe", value: function(e2) { return this._latestMsgSentByMeMap.get(e2); } }, { key: "modifyMsgSentByPeer", value: function(e2) { var t2 = e2.conversationID, n2 = e2.latestNick, o2 = e2.latestAvatar, e2 = this._map.get(t2); if (!S(e2)) { var i2 = Array.from(e2.values()), e2 = i2.length; if (0 !== e2) { for (var a2 = null, s2 = 0, r2 = false, c2 = e2 - 1; 0 <= c2; c2--) "in" === i2[c2].flow && ((a2 = i2[c2]).nick !== n2 && (a2.setNickAndAvatar({ nick: n2 }), r2 = true), a2.avatar !== o2 && (a2.setNickAndAvatar({ avatar: o2 }), r2 = true), r2) && (s2 += 1); M.l("".concat(this._n, ".modifyMsgSentByPeer convID:").concat(t2, " count:").concat(s2)); } } } }, { key: "modifyMsgSentByMe", value: function(e2) { var t2 = e2.conversationID, n2 = e2.latestNick, o2 = e2.latestAvatar, e2 = this._map.get(t2); if (!S(e2)) { var i2 = Array.from(e2.values()), e2 = i2.length; if (0 !== e2) { for (var a2 = null, s2 = 0, r2 = false, c2 = e2 - 1; 0 <= c2; c2--) "out" === i2[c2].flow && ((a2 = i2[c2]).nick !== n2 && (a2.setNickAndAvatar({ nick: n2 }), r2 = true), a2.avatar !== o2 && (a2.setNickAndAvatar({ avatar: o2 }), r2 = true), r2) && (s2 += 1); M.l("".concat(this._n, ".modifyMsgSentByMe convID:").concat(t2, " count:").concat(s2)); } } } }, { key: "getTopicConvIDList", value: function(t2) { return p(this._map.keys()).filter(function(e2) { return e2.startsWith("".concat(A.CONV_GROUP).concat(t2)); }); } }, { key: "onMsgModified", value: function(e2, t2) { var n2, o2, i2, a2; return (this._map.has(e2) || this._hoppingMsgMap.has(e2)) && (n2 = "".concat(this._n, ".onMsgModified"), i2 = this._getUniqueIDOfMsg(t2), a2 = !!(o2 = this._getTargetMsg(e2, i2)), M.l("".concat(n2, " convID:").concat(e2, " uniqueID:").concat(i2, " has:").concat(a2)), a2) ? (e2 = t2.messageVersion, i2 = t2.elements, a2 = t2.cloudCustomData, t2 = t2.checkResult, M.l("".concat(n2, " localVersion:").concat(o2.version, " remoteVersion:").concat(e2)), o2.version < e2 ? (o2.version = e2, o2._elements = JSON.parse(JSON.stringify(i2)), o2.payload = JSON.parse(JSON.stringify(i2[0].content)), o2.type = i2[0].type, o2.cloudCustomData = a2, o2.isModified = true, o2.hasRiskContent = on(t2), { isUpdated: true, message: o2 }) : { isUpdated: false, message: o2 }) : { isUpdated: false, message: null }; } }, { key: "_getUniqueIDOfMsg", value: function(e2) { var t2 = e2.from, n2 = e2.to, o2 = e2.random, i2 = e2.sequence, e2 = e2.time; return "".concat(t2, "-").concat(n2, "-").concat(o2, "-").concat(i2, "-").concat(e2); } }, { key: "_getTargetMsg", value: function(e2, t2) { if (this._map.has(e2)) return this._map.get(e2).get(t2); var n2 = void 0; if (this._hoppingMsgMap.has(e2)) { for (var o2 = p(this._hoppingMsgMap.get(e2).values()), i2 = 0; i2 < o2.length; i2++) if (this._getUniqueIDOfMsg(o2[i2]) === t2) { n2 = o2[i2]; break; } } return n2; } }, { key: "storeHoppingMsgList", value: function(e2) { if (0 !== e2.length) { var t2 = e2[0].conversationID, n2 = e2.length; this._hoppingMsgMap.has(t2) || this._hoppingMsgMap.set(t2, /* @__PURE__ */ new Map()); for (var o2 = this._hoppingMsgMap.get(t2), i2 = 0; i2 < n2; i2++) { var a2 = e2[i2]; o2.has(a2.ID) || o2.set(a2.ID, a2); } } } }, { key: "getHoppingMsg", value: function(e2, t2) { if (this._hoppingMsgMap.has(e2)) return this._hoppingMsgMap.get(e2).get(t2); } }, { key: "reset", value: function() { this._map.clear(), this._latestMsgSentByPeerMap.clear(), this._latestMsgSentByMeMap.clear(), this._hoppingMsgMap.clear(); } }]), Vo); function Vo(e2) { d(this, Vo), this._convM = e2, this._map = /* @__PURE__ */ new Map(), this._n = "MsgListHandler", this._latestMsgSentByPeerMap = /* @__PURE__ */ new Map(), this._latestMsgSentByMeMap = /* @__PURE__ */ new Map(), this._hoppingMsgMap = /* @__PURE__ */ new Map(), this.TOPIC_MSG_LIMIT = 1e3, this._convM.getIEmitInst().on(P.CLOUD_CONFIG, this._onCloudConfig, this); } function Ho(e2) { return d(this, Ho), (e2 = Fo.call(this, e2))._n = "C2CModule", e2._msgFromUnreadDBMap = /* @__PURE__ */ new Map(), e2._noticeFromUnreadDBList = [], e2; } function Bo(e2) { this.mixin(e2); } Bo.mixin = function(e2) { e2 = e2.prototype || e2; e2._isReady = false, e2.ready = function(e3) { if (e3) return this._isReady ? void (1 < arguments.length && void 0 !== arguments[1] && arguments[1] ? e3.call(this) : setTimeout(e3, 1)) : (this._readyQueue = this._readyQueue || [], void this._readyQueue.push(e3)); }, e2.triggerReady = function() { var t2 = this; this._isReady = true, setTimeout(function() { var e3 = t2._readyQueue; t2._readyQueue = [], e3 && 0 < e3.length && e3.forEach(function(e4) { e4.call(this); }, t2); }, 1); }, e2.resetReady = function() { this._isReady = false, this._readyQueue = []; }, e2.isReady = function() { return this._isReady; }; }; function Ko(e2, t2, n2) { return N(e2) ? { lastTime: 0, lastSequence: 0, fromAccount: "", messageForShow: "", payload: null, type: "", isRevoked: false, cloudCustomData: "", onlineOnlyFlag: false, nick: "", nameCard: "", version: 0, isPeerRead: false, revoker: null } : n2 && e2.ID || e2 instanceof Do ? { lastTime: e2.time || 0, lastSequence: e2.sequence || 0, fromAccount: e2.from || "", messageForShow: zt(e2.type, e2.payload, t2), payload: e2.payload || null, type: e2.type || null, isRevoked: e2.isRevoked || false, cloudCustomData: e2.cloudCustomData || "", onlineOnlyFlag: e2._onlineOnlyFlag || false, nick: e2.nick || "", nameCard: e2.nameCard || "", version: e2.version || 0, isPeerRead: e2.isPeerRead || false, revoker: e2.revoker || null } : y(y({}, e2), {}, { messageForShow: zt(e2.type, e2.payload, t2) }); } function Yo(e2, t2) { return S(e2) ? { lastTime: 0, lastSequence: 0, fromAccount: "", payload: null, type: "", messageForShow: "", nick: "", avatar: "", version: 0, cloudCustomData: "", isRevoked: false, revoker: null } : { lastTime: e2.time || 0, lastSequence: e2.sequence || 0, fromAccount: e2.from || "", payload: e2.payload || null, type: e2.type || "", messageForShow: zt(e2.type, e2.payload, t2), nick: e2.nick || "", avatar: e2.avatar || "", version: e2.version || 0, cloudCustomData: e2.cloudCustomData || "", isRevoked: e2.isRevoked || false, revoker: e2.revoker || null }; } function Wo(e2) { var t2 = String(e2).replace(/[=]+$/, ""), n2 = ""; if (t2.length % 4 == 1) return ""; for (var o2, i2, a2 = 0, s2 = 0; i2 = t2.charAt(s2++); ~i2 && (o2 = a2 % 4 ? 64 * o2 + i2 : i2, a2++ % 4) && (n2 += String.fromCharCode(255 & o2 >> (-2 * a2 & 6)))) i2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i2); try { return decodeURIComponent(escape(n2)); } catch (e3) { return ""; } } var jo, Jo, zo, Xo, Zo, Qo = ["jpg", "jpeg", "gif", "png", "bmp", "image", "webp"], $o = ["mp4", "quicktime", "mov"], ei = (e(oa, [{ key: "validate", value: function(e2) { var t2, n2 = true, o2 = ""; if (S(e2)) return { valid: false, tips: "empty options" }; if (e2.profileCustomField) for (var i2 = e2.profileCustomField.length, a2 = null, s2 = 0; s2 < i2; s2++) { if (a2 = e2.profileCustomField[s2], !m(a2.key) || -1 === a2.key.indexOf("Tag_Profile_Custom")) return { valid: false, tips: "The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom" }; if (!m(a2.value)) return { valid: false, tips: "The type of values of the custom profile key-value pairs (which is profileCustomField) must be String" }; } for (t2 in e2) if (Object.prototype.hasOwnProperty.call(e2, t2)) { if ("profileCustomField" === t2) continue; if (S(e2[t2]) && !m(e2[t2]) && !R(e2[t2])) { o2 = "key:" + t2 + ", invalid value:" + e2[t2], n2 = false; continue; } switch (t2) { case "nick": m(e2[t2]) || (n2 = !(o2 = "nick must be a string")), 500 < gt(e2[t2]) && (o2 = "nick name limited: must less than or equal to ".concat(500, " bytes, current size: ").concat(gt(e2[t2]), " bytes"), n2 = false); break; case "gender": vt(Qe, e2.gender) || (o2 = "key:gender, invalid value:" + e2.gender, n2 = false); break; case "birthday": R(e2.birthday) || (n2 = !(o2 = "birthday must be a number")); break; case "location": m(e2.location) || (n2 = !(o2 = "location must be a string")); break; case "selfSignature": m(e2.selfSignature) || (n2 = !(o2 = "selfSignature must be a string")); break; case "allowType": vt(et, e2.allowType) || (o2 = "key:allowType, invalid value:" + e2.allowType, n2 = false); break; case "language": R(e2.language) || (n2 = !(o2 = "language must be a number")); break; case "avatar": m(e2.avatar) || (n2 = !(o2 = "avatar must be a string")); break; case "messageSettings": 0 !== e2.messageSettings && 1 !== e2.messageSettings && (n2 = !(o2 = "messageSettings must be 0 or 1")); break; case "adminForbidType": vt($e, e2.adminForbidType) || (o2 = "key:adminForbidType, invalid value:" + e2.adminForbidType, n2 = false); break; case "level": R(e2.level) || (n2 = !(o2 = "level must be a number")); break; case "role": R(e2.role) || (n2 = !(o2 = "role must be a number")); break; default: o2 = "unknown key:" + t2 + " " + e2[t2], n2 = false; } } return { valid: n2, tips: o2 }; } }]), oa), ti = (e(na, [{ key: "set", value: function(e2) { var t2; this.map.size >= this.MAX_LENGTH && (t2 = this.map.entries().next().value[0], this.map.delete(t2)), this.map.set(e2, 1); } }, { key: "has", value: function(e2) { return this.map.has(e2); } }, { key: "delete", value: function(e2) { this.has(e2) && this.map.delete(e2); } }, { key: "reset", value: function() { this.map.clear(); } }]), na), ni = ["groupID", "name", "avatar", "type", "introduction", "notification", "ownerID", "selfInfo", "createTime", "infoSequence", "lastInfoTime", "lastMessage", "nextMessageSeq", "memberNum", "maxMemberNum", "memberList", "joinOption", "groupCustomField", "muteAllMembers", "isSupportTopic", "inviteOption", "_lastRevokedTime"], oi = (e(ta, [{ key: "memberNum", get: function() { return this.memberCount; }, set: function(e2) { } }, { key: "maxMemberNum", get: function() { return this.maxMemberCount; }, set: function(e2) { } }, { key: "_initGroup", value: function(e2) { for (var t2 in e2) ni.indexOf(t2) < 0 || ("selfInfo" !== t2 ? ("memberNum" === t2 && (this.memberCount = e2[t2]), "maxMemberNum" === t2 && (this.maxMemberCount = e2[t2]), "isSupportTopic" !== t2 ? this[t2] = e2[t2] : this.isSupportTopic = 1 === e2[t2]) : this.updateSelfInfo(e2[t2])); } }, { key: "updateGroup", value: function(e2) { var t2 = this, e2 = (e2.appid = void 0, e2.grossTopicNextMsgSeq = void 0, e2.selfInfo && (e2.selfInfo.grossTopicReadSeq = void 0), JSON.parse(JSON.stringify(e2))); e2.lastMsgTime && (this.lastMessage.lastTime = e2.lastMsgTime), N(e2.muteAllMembers) || ("On" === e2.muteAllMembers ? e2.muteAllMembers = true : e2.muteAllMembers = false), e2.groupCustomField && kt(this.groupCustomField, e2.groupCustomField), N(e2.memberNum) || (this.memberCount = e2.memberNum), N(e2.maxMemberNum) || (this.maxMemberCount = e2.maxMemberNum), N(e2.isSupportTopic) || (this.isSupportTopic = R(e2.isSupportTopic) ? 1 === e2.isSupportTopic : e2.isSupportTopic), _t(this, e2, ["members", "errorCode", "lastMsgTime", "groupCustomField", "memberNum", "maxMemberNum", "isSupportTopic"]), O(e2.members) && 0 < e2.members.length && e2.members.forEach(function(e3) { e3.userID === t2.selfInfo.userID && _t(t2.selfInfo, e3, ["sequence"]); }); } }, { key: "updateSelfInfo", value: function(e2) { e2 = { nameCard: e2.nameCard, joinTime: e2.joinTime, role: e2.role, messageRemindType: e2.messageRemindType, readedSequence: e2.readedSequence, excludedUnreadSequenceList: e2.excludedUnreadSequenceList }; _t(this.selfInfo, y({}, e2), [], ["", null, void 0, 0, NaN]); } }, { key: "setSelfNameCard", value: function(e2) { this.selfInfo.nameCard = e2; } }]), ta), ii = (e(ea, [{ key: "toAccount", get: function() { return this.conversationID.startsWith(A.CONV_C2C) ? this.conversationID.replace(A.CONV_C2C, "") : this.conversationID.startsWith(A.CONV_GROUP) ? this.conversationID.replace(A.CONV_GROUP, "") : ""; } }, { key: "_initProfile", value: function(t2) { var n2 = this; Object.keys(t2).forEach(function(e2) { switch (e2) { case "userProfile": n2.userProfile = t2.userProfile; break; case "groupProfile": n2.groupProfile = t2.groupProfile; } }), N(this.userProfile) && this.type === A.CONV_C2C ? this.userProfile = new ei({ userID: t2.conversationID.replace("C2C", "") }) : N(this.groupProfile) && this.type === A.CONV_GROUP && (this.groupProfile = new oi({ groupID: t2.conversationID.replace("GROUP", "") })); } }, { key: "updateUnreadCount", value: function(e2) { var t2 = e2.nextUnreadCount, n2 = e2.isFromGetConversations, e2 = e2.isUnreadC2CMessage; N(t2) || (Ot(this.subType) ? this.unreadCount = 0 : n2 && this.type === A.CONV_GROUP || n2 && this.type === A.CONV_TOPIC || e2 && this.type === A.CONV_C2C ? this.unreadCount = t2 : this.unreadCount = this.unreadCount + t2); } }, { key: "updateLastMessage", value: function(e2) { this.lastMessage = Ko(e2); } }, { key: "updateGroupAtInfoList", value: function(e2) { var t2; this._isNeedMergeGroupAtInfo(e2) || (-1 !== (t2 = (W(t2 = e2.groupAtType) || j(t2) || J(t2) || X()).slice(0)).indexOf(A.CONV_AT_ME) && -1 !== t2.indexOf(A.CONV_AT_ALL) && (t2 = [A.CONV_AT_ALL_AT_ME]), t2 = { from: e2.from, groupID: e2.groupID, topicID: e2.topicID, messageSequence: e2.sequence, atTypeArray: t2, __random: e2.__random, __sequence: e2.__sequence }, this.groupAtInfoList.push(t2)); } }, { key: "_isNeedMergeGroupAtInfo", value: function(t2) { var n2, e2 = t2.groupID, o2 = t2.sequence; return !!Nt({ groupID: e2 }) && (n2 = false, this.groupAtInfoList.forEach(function(e3) { e3.messageSequence === o2 && (-1 < e3.atTypeArray.indexOf(A.CONV_AT_ME) && -1 < t2.groupAtType.indexOf(A.CONV_AT_ALL) && (e3.atTypeArray = [A.CONV_AT_ALL_AT_ME]), -1 < e3.atTypeArray.indexOf(A.CONV_AT_ALL) && -1 < t2.groupAtType.indexOf(A.CONV_AT_ME) && (e3.atTypeArray = [A.CONV_AT_ALL_AT_ME], e3.__random = t2.__random, e3.__sequence = t2.__sequence), n2 = true); }), n2); } }, { key: "clearGroupAtInfoList", value: function() { this.groupAtInfoList.length = 0; } }, { key: "reduceUnreadCount", value: function() { return 1 <= this.unreadCount && (--this.unreadCount, true); } }, { key: "isLastMessageRevoked", value: function(e2) { var t2 = e2.sequence, e2 = e2.time; return this.type === A.CONV_C2C && t2 === this.lastMessage.lastSequence && e2 === this.lastMessage.lastTime || this.type === A.CONV_GROUP && t2 === this.lastMessage.lastSequence; } }, { key: "setLastMessageRevoked", value: function(e2) { this.lastMessage.isRevoked = e2; } }, { key: "setLastMessageRevoker", value: function(e2) { this.lastMessage.revoker = e2; } }, { key: "setDraftText", value: function(e2) { this.draftText = e2; } }]), ea), ai = (F(r = {}, A.MSG_REMIND_ACPT_AND_NOTE, 0), F(r, A.MSG_REMIND_DISCARD, 1), F(r, A.MSG_REMIND_ACPT_NOT_NOTE, 2), r), si = (e($i, [{ key: "onAllRcvMsgOptNotify", value: function(e2) { e2 = this._handleResult(e2); this._convM.emitOEvt(h.ALL_RECEIVE_MESSAGE_OPT_UPDATED, e2); } }, { key: "getC2CMsgRemindType", value: function(t2) { var n2 = this, o2 = "".concat(this._n, ".getC2CMsgRemindType"); return this._convM.req({ P: k.GET_C2C_PEER_MUTE_NOTIFICATIONS, data: { toAccount: this._convM.getMyUserID(), userIDList: t2 } }).then(function(e2) { M.l("".concat(o2, " ok. userIDList:").concat(t2)); e2 = e2.data.muteFlagList; n2._convM.onC2CMsgRemindTypeFetched(e2); }).catch(function(e2) { M.e("".concat(o2, " failed. error:"), e2); }); } }, { key: "set", value: function(e2) { return e2.groupID ? this._setGroupMsgRemindType(e2) : O(e2.userIDList) ? this._setC2CMsgRemindType(e2) : void 0; } }, { key: "_setGroupMsgRemindType", value: function(t2) { var n2 = this, o2 = "".concat(this._n, ".").concat("_setGroupMsgRemindType"), e2 = t2.groupID, i2 = t2.messageRemindType, a2 = "groupID:".concat(e2, " messageRemindType:").concat(i2), s2 = new G("_setGroupMsgRemindType"), r2 = (s2.setMessage(a2), this._get(7)); return r2 ? r2.modifyGroupMemberInfo({ groupID: e2, messageRemindType: i2, userID: this._convM.getMyUserID() }).then(function() { s2.end(), M.l("".concat(o2, " ok. ").concat(a2)); var e3 = n2.onGroupMsgRemindTypeUpdated(t2); return n2._convM.onTotalUnreadCountUpdate(), C(e3); }).catch(function(e3) { return s2.setError(e3).end(), M.e("".concat(o2, " failed. error:"), e3), D(e3); }) : D({ code: L.NO_MODULE }); } }, { key: "onGroupMsgRemindTypeUpdated", value: function(e2) { var t2, n2, o2 = e2.groupID, e2 = e2.messageRemindType, i2 = (M.l("".concat(this._n, ".onGroupMsgRemindTypeUpdated groupID:").concat(o2, " messageRemindType:").concat(e2)), this._get(7).getLocalGroupProfile(o2)); return i2 && (i2.selfInfo.messageRemindType = e2), Gt(o2) ? (t2 = Jt(n2 = o2), (n2 = this._get(10).getLocalTopic(t2, n2)) && n2.updateSelfInfo({ messageRemindType: e2 }) && this._convM.emitOEvt(h.TOPIC_UPDATED, { groupID: t2, topic: n2 }), { topic: n2 }) : (this._convM.patchMsgRemindType({ ID: o2, isC2CConversation: false, messageRemindType: e2 }) && this._emitConvUpdate(), { group: i2 }); } }, { key: "_setC2CMsgRemindType", value: function(e2) { var i2 = this, a2 = "".concat(this._n, ".").concat("_setC2CMsgRemindType"), t2 = e2.userIDList, s2 = e2.messageRemindType, r2 = t2.slice(0, 30), e2 = ai[s2] || 0, c2 = "userIDList:".concat(r2, " messageRemindType:").concat(s2), u2 = new G("_setC2CMsgRemindType"); return u2.setMessage(c2), this._convM.req({ P: k.SET_C2C_PEER_MUTE_NOTIFICATIONS, data: { userIDList: r2, muteFlag: e2 } }).then(function(e3) { u2.end(); var e3 = e3.data.errorList, t3 = [], n2 = [], e3 = (O(e3) && e3.forEach(function(e4) { t3.push(e4.userID), n2.push({ userID: e4.userID, code: e4.errorCode }); }), r2.filter(function(e4) { return -1 === t3.indexOf(e4); })), o2 = (M.l("".concat(a2, " ok. ").concat(c2, " successUserIDList:").concat(e3, " failureUserIDList:").concat(JSON.stringify(n2))), 0); return e3.forEach(function(e4) { i2._convM.patchMsgRemindType({ ID: e4, isC2CConversation: true, messageRemindType: s2 }) && (o2 += 1); }), 1 <= o2 && i2._emitConvUpdate(), r2.length = t3.length = 0, i2._convM.onTotalUnreadCountUpdate(), T({ successUserIDList: e3.map(function(e4) { return { userID: e4 }; }), failureUserIDList: n2 }); }).catch(function(e3) { return u2.setError(e3).end(), M.e("".concat(a2, " failed. error:"), e3), D(e3); }); } }, { key: "_get", value: function(e2) { return this._convM.get(e2); } }, { key: "_emitConvUpdate", value: function() { this._convM.emitConvUpdate(true, false); } }, { key: "setAllRcvMsgOpt", value: function(e2) { var t2 = "".concat(this._n, ".").concat("setAllRcvMsgOpt"), n2 = e2.messageRemindType, n2 = void 0 === n2 ? A.MSG_REMIND_ACPT_NOT_NOTE : n2, o2 = e2.isRepeated, o2 = void 0 === o2 || o2, i2 = this._calcStartAndEndTime(e2), a2 = i2.startTime, a2 = void 0 === a2 ? 0 : a2, i2 = i2.endTime, i2 = void 0 === i2 ? 0 : i2, e2 = JSON.stringify(e2), s2 = new G("setAllRcvMsgOpt"); return s2.setMessage(e2), M.l("".concat(t2, " options:").concat(e2)), this._convM.req({ P: k.SET_ALL_RECEIVE_MSG_OPT, data: { messageRemindType: ai[n2], startTime: a2, endTime: i2, isRepeated: o2 ? 1 : 0 } }).then(function(e3) { return s2.end(), M.l("".concat(t2, " ok.")), C(e3); }).catch(function(e3) { return s2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); }); } }, { key: "_calcStartAndEndTime", value: function(e2) { var t2 = e2.startHour, t2 = void 0 === t2 ? 0 : t2, n2 = e2.startMinute, n2 = void 0 === n2 ? 0 : n2, o2 = e2.startSecond, o2 = void 0 === o2 ? 0 : o2, i2 = e2.duration, i2 = void 0 === i2 ? 0 : i2, e2 = e2.isRepeated, e2 = void 0 === e2 || e2, a2 = /* @__PURE__ */ new Date(), s2 = a2.getFullYear(), r2 = a2.getMonth(), a2 = a2.getDate(), s2 = Math.round(new Date(s2, r2, a2, t2, n2, o2).getTime() / 1e3); return { startTime: s2, endTime: e2 && 86400 <= i2 ? s2 + 86400 : s2 + i2 }; } }, { key: "getAllRcvMsgOpt", value: function() { var t2 = this, n2 = "".concat(this._n, ".").concat("getAllRcvMsgOpt"), o2 = new G("getAllRcvMsgOpt"); return this._convM.req({ P: k.GET_ALL_RECEIVE_MSG_OPT, data: { toAccount: this._convM.getMyUserID() } }).then(function(e2) { e2 = e2.data, o2.setMessage(JSON.stringify(e2)).end(), M.l("".concat(n2, " ok. data:").concat(JSON.stringify(e2))), e2 = t2._handleResult(e2); return C(e2); }).catch(function(e2) { return o2.setError(e2).end(), M.e("".concat(n2, " failed. error:"), e2), D(e2); }); } }, { key: "_handleResult", value: function(e2) { var t2 = e2.messageRemindType, n2 = e2.startTime, o2 = e2.endTime, e2 = e2.isRepeated, i2 = A.MSG_REMIND_ACPT_AND_NOTE; return 1 === t2 && (i2 = A.MSG_REMIND_DISCARD), { messageRemindType: i2 = 2 === t2 ? A.MSG_REMIND_ACPT_NOT_NOTE : i2, startTime: n2, endTime: o2, isRepeated: 1 === e2 }; } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")); } }]), $i), ri = (e(Qi, [{ key: "setConvCustomData", value: function(e2) { var i2 = this, a2 = "".concat(this._n, ".").concat("setConvCustomData"), t2 = e2.conversationIDList, s2 = e2.customData, r2 = (M.l("".concat(a2, " options:"), e2), new G("setConvCustomData")), n2 = (r2.setMessage(JSON.stringify(e2)), { fromAccount: this._getMyUserID(), itemList: [] }), c2 = [], u2 = []; return t2.forEach(function(e3) { var t3; return i2._hasLocalConv(e3) ? Pt(e3) || Ut(e3) ? (t3 = { operationType: 2, contactItem: void 0, customMark: s2 }, Pt(e3) ? t3.contactItem = { type: 1, toAccount: e3.replace(A.CONV_C2C, "") } : Ut(e3) && (t3.contactItem = { type: 2, groupID: e3.replace(A.CONV_GROUP, "") }), void n2.itemList.push(t3)) : (i2._onConvIDInvalid(u2, e3), true) : (i2._onConvNotFound(u2, e3), true); }), u2.length === t2.length ? T({ successConversationIDList: c2, failureConversationIDList: u2 }) : this._convM.req({ P: k.SET_CONV_CUSTOM_DATA, data: n2 }).then(function(e3) { r2.end(), M.l("".concat(a2, " ok")); var t3, n3, o2, e3 = e3.data.resultItem; return O(e3) && (o2 = false, e3.forEach(function(e4) { t3 = i2._concatConvID(e4.contactItem), 0 === e4.resultCode ? (c2.push(t3), (n3 = i2._getLocalConv(t3)) && n3.customData !== s2 && (n3.customData = s2, o2 = true)) : u2.push({ conversationID: t3, code: e4.resultCode, message: e4.resultInfo }); }), true === o2) && i2._emitConvUpdate(), C({ successConversationIDList: c2, failureConversationIDList: u2 }); }).catch(function(e3) { return r2.setError(e3).end(), M.e("".concat(a2, " failed. error:"), e3), D(e3); }); } }, { key: "markConv", value: function(e2) { var t2, n2, a2, s2, r2, o2, i2, c2, u2, l2, d2 = this; return this._convM.canIUse(_.CONV_MARK) ? (t2 = "".concat(this._n, ".").concat("markConv"), n2 = e2.conversationIDList, a2 = e2.markType, s2 = e2.enableMark, M.l("".concat(t2, " options:"), e2), r2 = new G("markConv"), o2 = void r2.setMessage(JSON.stringify(e2)), i2 = void 0, e2 = this._getFlagBit(a2), true === s2 ? i2 = [e2] : o2 = [e2], c2 = { fromAccount: this._getMyUserID(), itemList: [] }, u2 = [], l2 = [], n2.forEach(function(e3) { var t3; return d2._hasLocalConv(e3) ? Pt(e3) || Ut(e3) ? (t3 = { operationType: 1, contactItem: void 0, clearMark: o2, setMark: i2 }, Pt(e3) ? t3.contactItem = { type: 1, toAccount: e3.replace(A.CONV_C2C, "") } : Ut(e3) && (t3.contactItem = { type: 2, groupID: e3.replace(A.CONV_GROUP, "") }), void c2.itemList.push(t3)) : (d2._onConvIDInvalid(l2, e3), true) : (d2._onConvNotFound(l2, e3), true); }), l2.length === n2.length ? T({ successConversationIDList: u2, failureConversationIDList: l2 }) : this._convM.req({ P: k.MARK_CONV, data: c2 }).then(function(e3) { r2.end(), M.l("".concat(t2, " ok")); var n3, o3, i3, e3 = e3.data.resultItem; return O(e3) && (i3 = false, e3.forEach(function(e4) { var t3; n3 = d2._concatConvID(e4.contactItem), 0 === e4.resultCode ? (u2.push(n3), (o3 = d2._getLocalConv(n3)) && (t3 = o3.markList.indexOf(a2), true === s2 ? -1 === t3 && (o3.markList.push(a2), i3 = true) : -1 !== t3 && (o3.markList.splice(t3, 1), i3 = true))) : l2.push({ conversationID: n3, code: e4.resultCode, message: e4.resultInfo }); }), true === i3) && d2._emitConvUpdate(), C({ successConversationIDList: u2, failureConversationIDList: l2 }); }).catch(function(e3) { return r2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this._convM.noUse("markConv"); } }, { key: "getLocalConvGroupList", value: function() { var e2 = this; return M.l("".concat(this._n, ".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)), this._pagingStatus === Un ? this.getRemoteConvGroupList().then(function() { return C(p(e2._convGroupMap.values())); }) : T(p(this._convGroupMap.values())); } }, { key: "searchConvGroupAndMark", value: function(e2, t2) { var n2 = this, o2 = "".concat(this._n, ".searchConvGroupAndMark"), i2 = []; return e2.forEach(function(e3) { 1 === t2 ? i2.push({ type: 1, toAccount: e3 }) : 2 === t2 && i2.push({ type: 2, groupID: e3 }); }), M.l("".concat(o2, " type:").concat(t2, " list:"), e2), this._convM.req({ P: k.SEARCH_CONV_GRP_MARK, data: { fromAccount: this._getMyUserID(), contactItem: i2 } }).then(function(e3) { var e3 = e3.data, t3 = e3.contactItem, e3 = e3.groupItem; M.l("".concat(o2, " ok. contactItem:"), t3, "groupItem:", e3), n2._fillConvGroupMap(e3), n2._handleContactItem(t3), n2._emitConvUpdate(); }).catch(function(e3) { M.w("".concat(o2, " failed. error:"), e3); }); } }, { key: "_fillConvGroupMap", value: function(e2) { var n2 = this; O(e2) && e2.forEach(function(e3) { var t2 = e3.convGroupID, e3 = e3.groupName; n2._convGroupMap.set(t2, e3); }); } }, { key: "_handleContactItem", value: function(e2) { var a2, s2 = this; O(e2) && e2.forEach(function(e3) { var t2 = [], n2 = e3.standardMark, o2 = e3.customData, i2 = e3.convGroupIDList; O(i2) && i2.forEach(function(e4) { s2._convGroupMap.has(e4) && t2.push(s2._convGroupMap.get(e4)); }), a2 = s2._concatConvID(e3), (a2 = s2._getLocalConv(a2)) && (a2.markList = Zt(n2), a2.customData = o2 || "", a2.conversationGroupList = [].concat(t2)); }); } }, { key: "getRemoteConvGroupList", value: function() { var i2 = this, a2 = "".concat(this._n, ".getRemoteConvGroupList"); return this._pagingStatus = Gn, this._convM.req({ P: k.GET_CONV_GRP_LIST, data: { fromAccount: this._getMyUserID(), startIndex: this._startIndex } }).then(function(e2) { var e2 = e2.data, t2 = e2.completeFlag, n2 = e2.contactItem, o2 = e2.nextStartIndex, o2 = void 0 === o2 ? 0 : o2, e2 = e2.groupItem; if (i2._startIndex = o2, M.l("".concat(a2, " completeFlag:").concat(t2, " nextStartIndex:").concat(o2, ", groupItem:"), e2, "contactItem:", n2), i2._fillConvGroupMap(e2), i2._handleContactItem(n2), 0 === t2) return i2.getRemoteConvGroupList(); 1 === t2 && (i2._pagingStatus = Pn, i2._emitConvUpdate(), i2._emitConvGroupListUpdate()); }).catch(function(e2) { i2._pagingStatus = Un, M.w("".concat(a2, " failed. error:"), e2); }); } }, { key: "createConvGroup", value: function(e2) { var a2, s2, r2, t2, c2, u2, l2 = this; return this._convM.canIUse(_.CONV_GROUP) ? (a2 = "".concat(this._n, ".").concat("createConvGroup"), M.l("".concat(a2, " options:"), e2), (s2 = new G("createConvGroup")).setMessage(JSON.stringify(e2)), r2 = e2.groupName, e2 = e2.conversationIDList, t2 = { fromAccount: this._getMyUserID(), itemList: [{ groupName: r2, contactItem: [] }] }, c2 = [], u2 = [], e2.forEach(function(e3) { return l2._hasLocalConv(e3) ? Pt(e3) || Ut(e3) ? void (Pt(e3) ? t2.itemList[0].contactItem.push({ type: 1, toAccount: e3.replace(A.CONV_C2C, "") }) : Ut(e3) && t2.itemList[0].contactItem.push({ type: 2, groupID: e3.replace(A.CONV_GROUP, "") })) : (l2._onConvIDInvalid(u2, e3), true) : (l2._onConvNotFound(u2, e3), true); }), u2.length === e2.length ? T({ successConversationIDList: c2, failureConversationIDList: u2 }) : this._convM.req({ P: k.CREATE_CONV_GRP, data: t2 }).then(function(e3) { s2.end(), M.l("".concat(a2, " ok")); var t3, n2, o2, e3 = e3.data.groupResultItem[0], i2 = e3.groupItem, e3 = e3.resultItem; return f(i2) && (l2._convGroupMap.set(i2.convGroupID, i2.groupName), l2._emitConvGroupListUpdate()), O(e3) && (o2 = false, e3.forEach(function(e4) { t3 = l2._concatConvID(e4.contactItem), 0 === e4.resultCode ? (c2.push(t3), (n2 = l2._getLocalConv(t3)) && -1 === n2.conversationGroupList.indexOf(r2) && (n2.conversationGroupList.push(r2), o2 = true)) : u2.push({ conversationID: t3, code: e4.resultCode, message: e4.resultInfo }); }), true === o2) && (l2._emitConvUpdate(), l2._emitConvGroupListUpdate()), C({ successConversationIDList: c2, failureConversationIDList: u2 }); }).catch(function(e3) { return s2.setError(e3).end(), M.e("".concat(a2, " failed. error:"), e3), D(e3); })) : this._convM.noUse("createConvGroup"); } }, { key: "deleteConvGroup", value: function(n2) { var o2, i2, a2 = this; return this._convM.canIUse(_.CONV_GROUP) ? (o2 = "".concat(this._n, ".").concat("deleteConvGroup"), M.l("".concat(o2, " groupName:").concat(n2)), (i2 = new G("deleteConvGroup")).setMessage(n2), this._convM.req({ P: k.DEL_CONV_GRP, data: { fromAccount: this._getMyUserID(), groupName: [n2] } }).then(function(e2) { i2.end(), M.l("".concat(o2, " ok")); var t2, e2 = e2.data.groupItem; O(e2) && (t2 = false, e2.forEach(function(e3) { a2._convGroupMap.has(e3.convGroupID) && (a2._convGroupMap.delete(e3.convGroupID), t2 = true); }), true === t2) && a2._emitConvGroupListUpdate(), a2._eraseFromConversationGroupList([n2]); }).catch(function(e2) { return i2.setError(e2).end(), M.e("".concat(o2, " failed. error:"), e2), D(e2); })) : this._convM.noUse("deleteConvGroup"); } }, { key: "renameConvGroup", value: function(e2) { var i2, a2, s2, r2, c2 = this; return this._convM.canIUse(_.CONV_GROUP) ? (i2 = "".concat(this._n, ".").concat("renameConvGroup"), M.l("".concat(i2, " options:"), e2), (a2 = new G("renameConvGroup")).setMessage(JSON.stringify(e2)), s2 = e2.oldName, r2 = e2.newName, this._convM.req({ P: k.RENAME_CONV_GRP, data: { fromAccount: this._getMyUserID(), updateType: 1, updateGroup: { updateGroupType: 1, oldName: s2, newName: r2 } } }).then(function(e3) { a2.end(), M.l("".concat(i2, " ok")); e3 = e3.data.updateGroupResult.convGroupID; c2._convGroupMap.set(e3, r2), c2._emitConvGroupListUpdate(); var t2, n2, e3 = c2._convM.getLocalConvList(), o2 = false; e3.forEach(function(e4) { t2 = e4.conversationGroupList, -1 !== (n2 = t2.indexOf(s2)) && (t2.splice(n2, 1, r2), o2 = true); }), true === o2 && c2._emitConvUpdate(); }).catch(function(e3) { return a2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); })) : this._convM.noUse("renameConvGroup"); } }, { key: "addConvsToGroup", value: function(e2) { var i2, a2, t2, s2, n2, r2, c2, u2 = this; return this._convM.canIUse(_.CONV_GROUP) ? (i2 = "".concat(this._n, ".").concat("addConvsToGroup"), M.l("".concat(i2, " options:"), e2), (a2 = new G("addConvsToGroup")).setMessage(JSON.stringify(e2)), t2 = e2.conversationIDList, s2 = e2.groupName, n2 = { fromAccount: this._getMyUserID(), updateType: 1, updateGroup: { updateGroupType: 2, groupName: s2, updateItem: [] } }, r2 = [], c2 = [], t2.forEach(function(e3) { return u2._hasLocalConv(e3) ? Pt(e3) || Ut(e3) ? void (Pt(e3) ? n2.updateGroup.updateItem.push({ operationType: 1, contactItem: { type: 1, toAccount: e3.replace(A.CONV_C2C, "") } }) : Ut(e3) && n2.updateGroup.updateItem.push({ operationType: 1, contactItem: { type: 2, groupID: e3.replace(A.CONV_GROUP, "") } })) : (u2._onConvIDInvalid(c2, e3), true) : (u2._onConvNotFound(c2, e3), true); }), c2.length === t2.length ? T({ successConversationIDList: r2, failureConversationIDList: c2 }) : this._convM.req({ P: k.ADD_CONV_TO_GRP, data: n2 }).then(function(e3) { a2.end(), M.l("".concat(i2, " ok")); var t3, n3, o2, e3 = e3.data.updateGroupResult.contactResultItem; return O(e3) && (o2 = false, e3.forEach(function(e4) { t3 = u2._concatConvID(e4.contactItem), 0 === e4.resultCode ? (n3 = u2._getLocalConv(t3)) && -1 === n3.conversationGroupList.indexOf(s2) && (n3.conversationGroupList.push(s2), r2.push(t3), o2 = true) : c2.push({ conversationID: t3, code: e4.resultCode, message: e4.resultInfo }); }), true === o2) && (u2._emitConvUpdate(), u2._emitConvInGroupUpdate(s2)), C({ successConversationIDList: r2, failureConversationIDList: c2 }); }).catch(function(e3) { return a2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); })) : this._convM.noUse("addConvsToGroup"); } }, { key: "deleteConvsFromGroup", value: function(e2) { var t2, a2, n2, s2, o2, r2, c2, u2 = this, i2 = "deleteConvsFromGroup"; return this._convM.canIUse(_.CONV_GROUP) ? (t2 = "".concat(this._n, ".").concat(i2), M.l("".concat(t2, " options:"), e2), (a2 = new G(i2)).setMessage(JSON.stringify(e2)), n2 = e2.conversationIDList, s2 = e2.groupName, o2 = { fromAccount: this._getMyUserID(), updateType: 1, updateGroup: { updateGroupType: 2, groupName: s2, updateItem: [] } }, r2 = [], c2 = [], n2.forEach(function(e3) { return u2._hasLocalConv(e3) ? Pt(e3) || Ut(e3) ? void (Pt(e3) ? o2.updateGroup.updateItem.push({ operationType: 2, contactItem: { type: 1, toAccount: e3.replace(A.CONV_C2C, "") } }) : Ut(e3) && o2.updateGroup.updateItem.push({ operationType: 2, contactItem: { type: 2, groupID: e3.replace(A.CONV_GROUP, "") } })) : (u2._onConvIDInvalid(c2, e3), true) : (u2._onConvNotFound(c2, e3), true); }), c2.length === n2.length ? T({ successConversationIDList: r2, failureConversationIDList: c2 }) : this._convM.req({ P: k.DEL_CONV_FROM_GRP, data: o2 }).then(function(e3) { a2.end(), M.l("".concat(t2, " ok")); var n3, o3, i3, e3 = e3.data.updateGroupResult.contactResultItem; return O(e3) && (i3 = false, e3.forEach(function(e4) { var t3; n3 = u2._concatConvID(e4.contactItem), 0 === e4.resultCode ? (o3 = u2._getLocalConv(n3)) && -1 !== (t3 = o3.conversationGroupList.indexOf(s2)) && (o3.conversationGroupList.splice(t3, 1), r2.push(n3), i3 = true) : c2.push({ conversationID: n3, code: e4.resultCode, message: e4.resultInfo }); }), true === i3) && (u2._emitConvUpdate(), u2._emitConvInGroupUpdate(s2)), C({ successConversationIDList: r2, failureConversationIDList: c2 }); }).catch(function(e3) { return a2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this._convM.noUse(i2); } }, { key: "onConvMarkUpdated", value: function(e2) { var i2, a2, s2 = this; S(e2) || (M.l("".concat(this._n, ".onConvMarkUpdated markItemList:"), e2), a2 = false, e2.forEach(function(e3) { var t2 = e3.recentContactItem, n2 = e3.optType, o2 = e3.standardMark, e3 = e3.customMark; i2 = s2._concatConvID(t2), (i2 = s2._getLocalConv(i2)) && (1 === n2 ? a2 = s2._diffStandardMark(i2, o2) : 2 === n2 ? a2 = s2._diffCustomMark(i2, e3) : 3 === n2 && (t2 = s2._diffStandardMark(i2, o2), n2 = s2._diffCustomMark(i2, e3), a2 = t2 || n2)); }), true === a2 && this._emitConvUpdate()); } }, { key: "_diffStandardMark", value: function(e2, t2) { var t2 = Zt(t2), n2 = false; return true !== function(e3, t3) { if (e3 !== t3) { if (!e3 || !t3) return false; if (e3.length !== t3.length) return false; for (var n3 = 0, o2 = e3.length; n3 < o2; n3++) if (e3[n3] !== t3[n3]) return false; } return true; }(e2.markList, t2) && (e2.markList = t2, n2 = true), n2; } }, { key: "_diffCustomMark", value: function(e2, t2) { var n2 = false; return e2.customData !== t2 && void 0 !== t2 && (e2.customData = t2, n2 = true), n2; } }, { key: "onConvGroupCreated", value: function(e2) { var a2 = this, s2 = (M.l("".concat(this._n, ".onConvGroupCreated resultList:"), e2), false), r2 = false; O(e2) && (e2.forEach(function(e3) { var t2 = e3.msgGroupItem, n2 = t2.groupID, o2 = t2.groupName; a2._convGroupMap.get(n2) !== o2 && (a2._convGroupMap.set(n2, o2), r2 = true); var i2, t2 = e3.msgRecentContactItem; O(t2) && t2.forEach(function(e4) { i2 = a2._concatConvID(e4), (i2 = a2._getLocalConv(i2)) && -1 === i2.conversationGroupList.indexOf(o2) && (i2.conversationGroupList.push(o2), s2 = true); }); }), true === s2 && this._emitConvUpdate(), true === r2) && this._emitConvGroupListUpdate(); } }, { key: "onConvGroupDeleted", value: function(e2) { var n2, o2 = this, i2 = (M.l("".concat(this._n, ".onConvGroupDeleted groupItemList:"), e2), []); O(e2) && (n2 = false, e2.forEach(function(e3) { var t2 = e3.groupID, e3 = e3.groupName; o2._convGroupMap.has(t2) && (o2._convGroupMap.delete(t2), n2 = true, i2.push(e3)); }), true === n2) && this._emitConvGroupListUpdate(), this._eraseFromConversationGroupList(i2); } }, { key: "_eraseFromConversationGroupList", value: function(t2) { S(t2) || (this._convM.getLocalConvList().forEach(function(e2) { e2.conversationGroupList = e2.conversationGroupList.filter(function(e3) { return !t2.includes(e3); }); }), this._emitConvUpdate()); } }, { key: "onConvGroupNameUpdated", value: function(e2) { M.l("".concat(this._n, ".onConvGroupNameUpdated options:"), e2); var t2, n2, o2, i2 = e2.groupID, a2 = e2.groupName, s2 = e2.oldGroupName; this._convGroupMap.get(i2) !== a2 && (this._convGroupMap.set(i2, a2), this._emitConvGroupListUpdate(), e2 = this._convM.getLocalConvList(), o2 = false, e2.forEach(function(e3) { t2 = e3.conversationGroupList, -1 !== (n2 = t2.indexOf(s2)) && (t2.splice(n2, 1, a2), o2 = true); }), true === o2) && this._emitConvUpdate(); } }, { key: "onConvInGroupUpdated", value: function(e2) { var n2, o2, i2, a2 = this, s2 = (M.l("".concat(this._n, ".onConvInGroupUpdated options:"), e2), e2.oldGroupName), e2 = e2.recentContactUpdateGroupItem; O(e2) && (i2 = false, e2.forEach(function(e3) { var t2 = e3.contactOptType, e3 = e3.recentContactItem; n2 = a2._concatConvID(e3), (n2 = a2._getLocalConv(n2)) && (o2 = n2.conversationGroupList.indexOf(s2), 1 === t2 ? -1 === o2 && (n2.conversationGroupList.push(s2), i2 = true) : 2 === t2 && -1 !== o2 && (n2.conversationGroupList.splice(o2, 1), i2 = true)); }), true === i2) && (this._emitConvUpdate(), this._emitConvInGroupUpdate(s2)); } }, { key: "onConvAddedToOrDeletedFromGroup", value: function(e2) { var n2, o2, i2 = this, t2 = (M.l("".concat(this._n, ".onConvAddedToOrDeletedFromGroup options:"), e2), e2.msgRecentContactItem), e2 = e2.msgRecentContactUpdateContactItem, t2 = this._concatConvID(t2), a2 = this._getLocalConv(t2); a2 && O(e2) && (o2 = false, e2.forEach(function(e3) { var t3 = e3.groupOptType, e3 = e3.recentContactGroupItem.groupName; n2 = a2.conversationGroupList.indexOf(e3), 1 === t3 ? -1 === n2 && (a2.conversationGroupList.push(e3), o2 = true) : 2 === t3 && -1 !== n2 && (a2.conversationGroupList.splice(n2, 1), o2 = true), true === o2 && i2._emitConvInGroupUpdate(e3); }), true === o2) && this._emitConvUpdate(); } }, { key: "onConvGroupListSynced", value: function(e2) { O(e2) && 0 !== e2.length && (M.l("".concat(this._n, ".onConvGroupListSynced groupItem:"), e2), this._fillConvGroupMap(e2)); } }, { key: "getConvGroupListByID", value: function(e2) { var t2, n2 = this; if (!S(e2)) return t2 = [], e2.forEach(function(e3) { n2._convGroupMap.has(e3) && t2.push(n2._convGroupMap.get(e3)); }), t2; } }, { key: "_onConvNotFound", value: function(e2, t2) { e2.push({ conversationID: t2, code: L.CONV_NOT_FOUND, message: this._convM.getErrMsg(L.CONV_NOT_FOUND) }); } }, { key: "_onConvIDInvalid", value: function(e2, t2) { e2.push({ conversationID: t2, code: L.INVALID_CONV_ID, message: this._convM.getErrMsg(L.INVALID_CONV_ID) }); } }, { key: "_getFlagBit", value: function(e2) { for (var t2 = e2.toString(2), n2 = t2.length, o2 = n2 - 1; 0 <= o2; o2--) if ("1" === t2[o2]) return n2 - o2 - 1; } }, { key: "_concatConvID", value: function(e2) { var t2, n2 = e2.type, o2 = e2.to, i2 = e2.groupID, e2 = e2.userID; return 1 === n2 ? N(e2) ? N(o2) || (t2 = "".concat(A.CONV_C2C).concat(o2)) : t2 = "".concat(A.CONV_C2C).concat(e2) : 2 === n2 && (t2 = "".concat(A.CONV_GROUP).concat(i2)), t2; } }, { key: "_getMyUserID", value: function() { return this._convM.getMyUserID(); } }, { key: "_getLocalConv", value: function(e2) { return this._convM.getLocalConversation(e2); } }, { key: "_hasLocalConv", value: function(e2) { return this._convM.hasLocalConversation(e2); } }, { key: "_emitConvUpdate", value: function() { this._convM.emitConvUpdate(true, false); } }, { key: "_emitConvGroupListUpdate", value: function() { this._convM.emitOEvt(h.CONVERSATION_GROUP_LIST_UPDATED, p(this._convGroupMap.values())); } }, { key: "_emitConvInGroupUpdate", value: function(t2) { var e2 = { groupName: t2, conversationList: [] }, n2 = this._convM.getLocalConvList(); e2.conversationList = n2.filter(function(e3) { return e3.conversationGroupList.includes(t2); }), this._convM.emitOEvt(h.CONVERSATION_IN_GROUP_UPDATED, e2); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._convGroupMap.clear(), this._startIndex = 0, this._pagingStatus = Nn; } }]), Qi), ci = (t(Zi, u), Zo = n(Zi), e(Zi, [{ key: "_initListeners", value: function() { var e2 = this.getIEmitInst(); e2.on(P.A2KEY_AND_TINYID_UPDATED, this._init, this), e2.on(P.PROFILE_UPDATED, this._onProfileUpdated, this), e2.on(P.CLOUD_CONFIG, this._onCloudConfig, this); } }, { key: "_init", value: function() { var e2 = this, t2 = (M.l("".concat(this._n, "._init")), this.get(13).getItem("conversationMap")), n2 = this.isIntl(), o2 = this.isUsingChatCore(); if (t2) { for (var i2 = t2.length, a2 = 0; a2 < i2; a2++) { var s2 = t2[a2]; if (s2) { if (this._isNonExistentAccount(s2.conversationID)) continue; if (s2.groupProfile && Ot(s2.groupProfile.type)) continue; } this._convMap.set(s2.conversationID, new ii(t2[a2], n2, o2)); } this.emitConvUpdate(true, false); } this.ready(function() { 0 < e2._tmpGroupList.length && (e2.updateConvGroupProfile(e2._tmpGroupList), e2._tmpGroupList.length = 0); }), this.syncConvList(); } }, { key: "_isNonExistentAccount", value: function(e2) { var t2; return "@TLS#ERROR" === (t2 = e2.startsWith(A.CONV_C2C) ? e2.replace(A.CONV_C2C, "") : t2) || "@TLS#NOT_FOUND" === t2; } }, { key: "onCheckTimer", value: function(e2) { this.isLoggedIn() && this._msgListHandler.onCheckTimer(e2); } }, { key: "onMessageSent", value: function(e2) { this._onSendOrRcvMsg({ conversationOptionsList: e2.conversationOptionsList, isInstantMessage: true }); } }, { key: "onNewMessage", value: function(e2) { this._onSendOrRcvMsg(e2); } }, { key: "_onSendOrRcvMsg", value: function(e2) { var t2 = this, n2 = e2.conversationOptionsList, o2 = e2.isInstantMessage, o2 = void 0 === o2 || o2, i2 = e2.isUnreadC2CMessage, i2 = void 0 !== i2 && i2, a2 = e2.updateUnreadCount, a2 = void 0 === a2 || a2, s2 = e2.isSyncingEnded, s2 = void 0 !== s2 && s2; this._isReady ? 0 !== n2.length ? (true === o2 && this._checkNewConv(n2), this._updateLocalConvList({ conversationOptionsList: n2, isInstantMessage: o2, isUnreadC2CMessage: i2, isFromGetConversations: false, updateUnreadCount: a2 }), o2 || (this._convIDFromUnreadDBMap = new Map([].concat(p(this._convIDFromUnreadDBMap), p(n2.map(function(e3) { return [e3.conversationID, 1]; })))), this._diffAndDeleteConv(), s2 && this.emitIEvt(P.C2C_UNREAD_HANDLE_COMPLETED)), 0 < n2.filter(function(e3) { return !t2._isConvNeedShow(e3.conversationID); }).length || this.emitConvUpdate()) : s2 && this.emitIEvt(P.C2C_UNREAD_HANDLE_COMPLETED) : this.ready(function() { t2._onSendOrRcvMsg(e2); }); } }, { key: "updateConvGroupProfile", value: function(e2) { var n2, o2 = this; O(e2) && 0 === e2.length || (0 !== this._convMap.size ? (n2 = false, e2.forEach(function(e3) { var t2 = "".concat(A.CONV_GROUP).concat(e3.groupID); o2._convMap.has(t2) && (n2 = true, (t2 = o2._convMap.get(t2)).groupProfile = JSON.parse(JSON.stringify(e3)), t2.lastMessage.lastSequence < e3.nextMessageSeq && (t2.lastMessage.lastSequence = e3.nextMessageSeq - 1), t2.subType || (t2.subType = e3.type)); }), n2 && this.emitConvUpdate(true, false)) : this._tmpGroupList = e2); } }, { key: "onMessageRevoked", value: function(e2, t2) { var n2, o2, i2, a2 = this; 0 !== e2.length && (n2 = null, o2 = false, i2 = [], e2.forEach(function(e3) { (n2 = a2._convMap.get(e3.conversationID)) && (t2 && n2.reduceUnreadCount() && (o2 = n2.type !== A.CONV_TOPIC), n2.type === A.CONV_TOPIC ? i2.push(e3) : n2.isLastMessageRevoked({ sequence: e3.sequence, time: e3.time }) && (n2.setLastMessageRevoked(true), n2.setLastMessageRevoker(e3.revoker), o2 = true)); }), this.get(10).onMessageRevoked(i2), o2) && this.emitConvUpdate(true, false); } }, { key: "updateRevokerInfo", value: function(u2) { for (var e2 = /* @__PURE__ */ new Set(), t2 = 0; t2 < u2.length; t2++) { var n2 = u2[t2].revoker; e2.add(n2); } var o2 = p(e2), i2 = this.get(4); return new Promise(function(c2) { i2.getUserProfile({ userIDList: o2 }).then(function(e3) { e3 = e3.data; if (!O(e3) || 0 === e3.length) return c2(u2); var t3, n3 = {}, o3 = Z(e3); try { for (o3.s(); !(t3 = o3.n()).done; ) { var i3 = t3.value, a2 = i3.userID, s2 = i3.nick, r2 = i3.avatar; n3[a2] = { nick: s2, avatar: r2 }; } } catch (e4) { o3.e(e4); } finally { o3.f(); } u2.forEach(function(e4) { var t4 = e4.revoker; n3[t4] && (e4.revokerInfo.nick = n3[t4].nick || "", e4.revokerInfo.avatar = n3[t4].avatar || ""); }), c2(u2); }).catch(function() { c2(u2); }); }); } }, { key: "isLastMessageRevoked", value: function(e2) { var t2 = false, n2 = e2.conversationID, o2 = e2.sequence, i2 = e2.time, a2 = this._convMap.get(n2); return a2 && (t2 = a2.type === A.CONV_TOPIC ? this.get(10).isLastMessageRevoked({ topicID: n2.replace(A.CONV_GROUP, ""), sequence: o2 }) : a2.isLastMessageRevoked({ sequence: o2, time: i2 })), M.l("".concat(this._n, ".isLastMessageRevoked options:"), e2, "ret:".concat(t2)), t2; } }, { key: "onMessageDeleted", value: function(e2) { var t2 = this; if (0 !== e2.length) { var n2 = null; e2.forEach(function(e3) { (n2 = t2._msgListHandler.getLocalMsg(e3.conversationID, e3.ID)) && (n2.isDeleted = true), e3 !== n2 && (e3.isDeleted = true); }); for (var e2 = e2[0].conversationID, o2 = this._msgListHandler.getLocalMsgList(e2), i2 = {}, a2 = o2.length - 1; 0 <= a2; a2--) if (!o2[a2].isDeleted) { i2 = o2[a2]; break; } var s2, r2 = this._convMap.get(e2); r2 && (s2 = false, r2.lastMessage.lastSequence === i2.sequence && r2.lastMessage.lastTime === i2.time || (S(i2) && (i2 = void 0), r2.updateLastMessage(i2), r2.type !== A.CONV_TOPIC && (s2 = true), M.l("".concat(this._n, ".onMessageDeleted. update convID:").concat(e2, " with lastMessage:"), r2.lastMessage)), e2.startsWith(A.CONV_C2C) && this.updateUnreadCount(e2), s2) && this.emitConvUpdate(true, false); } } }, { key: "onMessageModified", value: function(e2) { var t2 = "".concat(this._n, ".onMessageModified"), n2 = e2.conversationType, o2 = e2.from, i2 = e2.to, a2 = e2.time, s2 = e2.sequence, r2 = e2.elements, c2 = e2.cloudCustomData, u2 = e2.messageVersion, l2 = this.getMyUserID(), d2 = "".concat(n2).concat(i2), l2 = (i2 === l2 && n2 === A.CONV_C2C && (d2 = "".concat(n2).concat(o2)), this._msgListHandler.onMsgModified(d2, e2)), n2 = l2.isUpdated, l2 = l2.message, p2 = (true === n2 && this.emitOEvt(h.MESSAGE_MODIFIED, [l2]), this._isTopicConv(d2)); return null === l2 ? M.l("".concat(t2, " message is null! options:"), e2) : M.l("".concat(t2, " isUpdated:").concat(n2, " isTopicMessage:").concat(p2, " from:").concat(o2, " to:").concat(i2, " sequence:").concat(l2.sequence, " time:").concat(l2.time)), p2 ? this.get(10).onMessageModified(e2) : (n2 = this._convMap.get(d2)) && (o2 = n2.lastMessage) && o2.lastTime === a2 && o2.lastSequence === s2 && o2.version !== u2 && (M.l("".concat(t2, " convID:").concat(d2, " lastMessage updated")), o2.type = r2[0].type, o2.payload = r2[0].content, o2.messageForShow = zt(o2.type, o2.payload, this.isIntl()), o2.cloudCustomData = c2, o2.version = u2, this.emitConvUpdate(true, false)), l2; } }, { key: "onNewGroupAtTips", value: function(e2) { var t2 = this, e2 = e2.dataList, n2 = null; e2.forEach(function(e3) { e3.groupAtTips ? n2 = e3.groupAtTips : e3.elements ? n2 = y(y({}, e3.elements), {}, { sync: true }) : e3.groupAtType && (n2 = y(y({}, e3), {}, { sync: true })), n2.__random = e3.random, n2.__sequence = e3.clientSequence, t2._tmpGroupAtTipsList.push(n2); }), M.l("".concat(this._n, ".onNewGroupAtTips isReady:").concat(this._isReady), this._tmpGroupAtTipsList), this._isReady && this._handleGroupAtTipsList(); } }, { key: "_handleGroupAtTipsList", value: function() { var s2, r2 = this; 0 !== this._tmpGroupAtTipsList.length && (s2 = false, this._tmpGroupAtTipsList.forEach(function(e2) { var t2, n2 = e2.groupID, o2 = e2.from, i2 = e2.topicID, i2 = void 0 === i2 ? void 0 : i2, a2 = e2.sync, a2 = void 0 !== a2 && a2; o2 !== r2.getMyUserID() && (N(i2) ? (o2 = r2._convMap.get("".concat(A.CONV_GROUP).concat(n2))) && (o2.updateGroupAtInfoList(e2), s2 = true) : ((n2 = r2._convMap.get("".concat(A.CONV_GROUP).concat(i2))) && (n2.updateGroupAtInfoList(e2), o2 = r2.get(10), t2 = n2.groupAtInfoList, o2.onAtInfoUpdated({ topicID: i2, groupAtInfoList: t2 })), S(n2) && a2 && (r2.updateTopicConversation([{ conversationID: "".concat(A.CONV_GROUP).concat(i2), type: A.CONV_TOPIC }]), r2._convMap.get("".concat(A.CONV_GROUP).concat(i2)).updateGroupAtInfoList(e2)))); }), s2 && this.emitConvUpdate(true, false), this._tmpGroupAtTipsList.length = 0); } }, { key: "_checkNewConv", value: function(e2) { var t2 = this, n2 = [], o2 = []; e2.forEach(function(e3) { t2._convMap.has(e3.conversationID) || (e3.type === A.CONV_C2C ? n2.push(e3.conversationID.replace(A.CONV_C2C, "")) : e3.type === A.CONV_GROUP && o2.push(e3.conversationID.replace(A.CONV_GROUP, ""))); }), 0 < n2.length && (this._onNewC2CConv(n2), n2 = null), 0 < o2.length && (this._onNewGroupConv(o2), o2 = null); } }, { key: "_onNewC2CConv", value: function(e2) { var t2 = this.get(6); return Promise.all([t2.getRemotePeerReadTime(e2), this._msgRemindHandler.getC2CMsgRemindType(e2), this._convGroupHandler.searchConvGroupAndMark(e2, 1)]); } }, { key: "_onNewGroupConv", value: function(e2) { var t2 = this.get(7); return t2 ? Promise.all([t2.getMsgRemindType(e2), this._convGroupHandler.searchConvGroupAndMark(e2, 2)]) : Promise.resolve(); } }, { key: "_setStorageConvList", value: function() { var e2 = 0 < arguments.length && void 0 !== arguments[0] && arguments[0], t2 = this.getLocalConvList().filter(function(e3) { return e3.type === A.CONV_C2C || e3.type === A.CONV_GROUP && e3.lastMessage.type !== A.MSG_GRP_TIP; }).slice(0, 20).map(function(e3) { return { conversationID: e3.conversationID, type: e3.type, subType: e3.subType, lastMessage: e3.lastMessage, groupProfile: e3.groupProfile, userProfile: e3.userProfile }; }); this.get(13).setItem("conversationMap", t2, e2); } }, { key: "emitConvUpdate", value: function() { var e2 = !(0 < arguments.length && void 0 !== arguments[0]) || arguments[0], t2 = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1], n2 = this.getLocalConvList(); t2 && (t2 = this.get(7)) && t2.updateGroupLastMessage(n2), e2 && (this.get(12).isPartialUpdatedConvs() ? (this._diffConvMap(this._convMapForDiff, this._convMap), 0 < this._partialUpdatedConvMap.size && (this.emitOEvt(h.CONVERSATION_LIST_UPDATED), this.onTotalUnreadCountUpdate(), this._convMapForDiff.clear(), this._convMapForDiff = ht(this._convMap, true)), 0 === this._convMapForDiff.size && (this._convMapForDiff = ht(this._convMap, true))) : (this.emitOEvt(h.CONVERSATION_LIST_UPDATED), this.onTotalUnreadCountUpdate())); } }, { key: "_diffConvMap", value: function(e2, t2) { var n2, o2 = Z(t2); try { for (o2.s(); !(n2 = o2.n()).done; ) { var i2 = Y(n2.value, 2), a2 = i2[0], s2 = i2[1]; e2.has(a2) && JSON.stringify(s2) === e2.get(a2) || this._partialUpdatedConvMap.set(a2, s2); } } catch (e3) { o2.e(e3); } finally { o2.f(); } } }, { key: "getPartialUpdatedConvs", value: function() { var e2 = p(ht(this._partialUpdatedConvMap, false).values()); return this._partialUpdatedConvMap.clear(), e2; } }, { key: "getLocalConvList", value: function() { var t2 = this; return p(this._convMap.values()).filter(function(e2) { return t2._isConvNeedShow(e2.conversationID); }); } }, { key: "getLocalConversation", value: function(e2) { return this._convMap.get(e2); } }, { key: "hasLocalConversation", value: function(e2) { return this._convMap.has(e2); } }, { key: "getLocalOldestMessage", value: function(e2) { return this._msgListHandler.getLocalOldestMsg(e2); } }, { key: "syncConvList", value: function() { var o2 = this, e2 = !(0 < arguments.length && void 0 !== arguments[0]) || arguments[0], i2 = "syncConvList", a2 = new G(i2); return this._pagingStatus === Nn && this._convMap.clear(), this._pagingGetConvList(e2).then(function(e3) { var t2 = tn(o2._pagingGetCostList), n2 = en(o2._pagingGetCostList), n2 = (o2._pagingGetCostList.length = 0, o2._pagingStatus = Pn, o2._diffAndDeleteConv(), o2.emitConvUpdate(true, false), o2._setStorageConvList(), o2._handleC2CPeerReadTime(), o2.emitIEvt(P.CONV_SYNC_COMPLETED), "count:".concat(o2._convMap.size, " sum:").concat(n2, " avg:").concat(t2)); return M.l("".concat(o2._n, ".").concat(i2, ". ").concat(n2)), a2.setMessage(n2).end(), e3; }).catch(function(e3) { return o2._pagingStatus = Un, a2.setMessage(o2._pagingTs).setError(e3).end(), D(e3); }); } }, { key: "_diffAndDeleteConv", value: function() { var n2, o2 = this; this._isSyncCompleted() && (n2 = [], this._convMap.forEach(function(e2, t2) { !o2._pagingConvIDMap.has(t2) && o2._convIDFromUnreadDBMap.has(t2) && (o2._convMap.delete(t2), n2.push(t2)); }), M.l("".concat(this._n, "._diffAndDeleteConv list:").concat(n2)), n2 = null); } }, { key: "_pagingGetConvList", value: function() { var r2 = this, e2 = !(0 < arguments.length && void 0 !== arguments[0]) || arguments[0], c2 = "".concat(this._n, "._pagingGetConvList"), u2 = (M.l("".concat(c2, " incrementalPullFlag:").concat(e2, " ts:").concat(this._pagingTs, " startIdx:").concat(this._pagingStartIdx) + " pinnedTs:".concat(this._pagingPinnedTs, " pinnedStartIdx:").concat(this._pagingPinnedStartIdx)), Date.now()); return this._pagingStatus = Gn, this.req({ P: k.PAGING_GET_CONV_LIST, data: { fromAccount: this.getMyUserID(), timeStamp: e2 ? this._pagingTs : 0, startIndex: e2 ? this._pagingStartIdx : 0, pinnedTimeStamp: e2 ? this._pagingPinnedTs : 0, pinnedStartIndex: e2 ? this._pagingPinnedStartIdx : 0, orderType: 1 } }).then(function(e3) { var e3 = e3.data, t2 = e3.completeFlag, n2 = e3.conversations, n2 = void 0 === n2 ? [] : n2, o2 = e3.timeStamp, i2 = e3.startIndex, a2 = e3.pinnedTimeStamp, s2 = e3.pinnedStartIndex, e3 = e3.groupItem; if (r2._pagingGetCostList.push(nn(u2, false)), M.l("".concat(c2, " ok. completeFlag:").concat(t2, " count:").concat(n2.length, " cost:").concat(nn(u2))), r2._convGroupHandler.onConvGroupListSynced(e3), 0 < n2.length && (e3 = r2._getConvOptions(n2), r2._pagingConvIDMap = new Map([].concat(p(r2._pagingConvIDMap), p(e3.map(function(e4) { return [e4.conversationID, 1]; })))), r2._updateLocalConvList({ conversationOptionsList: e3, isFromGetConversations: true, updateUnreadCount: true }), r2.isLoggedIn()) && r2.emitConvUpdate(), !r2._isReady) { if (!r2.isLoggedIn()) return T(); r2.triggerReady(); } return r2._pagingTs = o2, r2._pagingStartIdx = i2, r2._pagingPinnedTs = a2, r2._pagingPinnedStartIdx = s2, 1 !== t2 ? r2._pagingGetConvList() : (r2._handleGroupAtTipsList(), r2._convGroupHandler.getRemoteConvGroupList(), T()); }).catch(function(e3) { throw !r2.isLoggedIn() || r2._isReady || (M.w("".concat(c2, " failed. error:"), e3), r2.triggerReady()), e3; }); } }, { key: "_updateLocalConvList", value: function(e2) { var t2 = e2.isFromGetConversations, n2 = Date.now(), e2 = this._getTmpConvListMapping(e2).newConvList; this._convMap = new Map(this._sortConvList(p(this._convMap))), t2 || this._updateUserOrGroupProfile(e2), M.l("".concat(this._n, "._updateLocalConvList cost:").concat(nn(n2))); } }, { key: "_getTmpConvListMapping", value: function(e2) { for (var t2 = e2.conversationOptionsList, n2 = e2.isFromGetConversations, o2 = e2.isInstantMessage, i2 = e2.isUnreadC2CMessage, a2 = void 0 !== i2 && i2, s2 = e2.updateUnreadCount, r2 = [], c2 = [], u2 = this.get(7), l2 = this.get(8), d2 = this.isIntl(), p2 = this.isUsingChatCore(), _2 = 0, h2 = t2.length; _2 < h2; _2++) { var g2 = new ii(t2[_2], d2, p2), f2 = g2.conversationID, m2 = g2.type; if (!this._isNonExistentAccount(f2)) { if (this._convMap.has(f2)) { var v2 = this._convMap.get(f2); if (n2) { this._convMap.set(f2, g2), m2 === A.CONV_C2C ? g2.unreadCount = v2.unreadCount : m2 === A.CONV_GROUP && (g2.groupProfile = JSON.parse(JSON.stringify(v2.groupProfile))); continue; } var I2 = ["unreadCount", "allowType", "adminForbidType", "payload"], M2 = (false === o2 && I2.push("lastMessage"), "boolean" == typeof o2 && I2.push("isPinned"), t2[_2].lastMessage), y2 = !N(M2); y2 || t2[_2].type === A.CONV_TOPIC || this._onLastMsgNotExist(t2[_2]), N(o2) && y2 && null === v2.lastMessage.payload && (v2.lastMessage.payload = M2.payload), S(v2.lastMessage.revoker) || (v2.lastMessage.revoker = null), _t(v2, g2, I2, [null, void 0, "", 0, NaN]), true === s2 && v2.updateUnreadCount({ nextUnreadCount: g2.unreadCount, isFromGetConversations: n2, isUnreadC2CMessage: a2 }), o2 && y2 && (M2.payload && (v2.lastMessage.payload = M2.payload), v2.type === A.CONV_GROUP) && (v2.lastMessage.nameCard = M2.nameCard, v2.lastMessage.nick = M2.nick), y2 && v2.lastMessage.cloudCustomData !== M2.cloudCustomData && (v2.lastMessage.cloudCustomData = M2.cloudCustomData || ""); } else m2 === A.CONV_GROUP && u2 ? (I2 = g2.groupProfile.groupID, (y2 = u2.getLocalGroupProfile(I2)) && (g2.groupProfile = y2, true === s2) && g2.updateUnreadCount({ nextUnreadCount: 0 })) : m2 === A.CONV_C2C && (v2 = f2.replace(A.CONV_C2C, ""), l2) && l2.isMyFriend(v2) && (g2.remark = l2.getFriendRemark(v2)), r2.push(g2), this._convMap.set(f2, g2); this._convMap.get(f2).type === A.CONV_TOPIC && c2.push(this._convMap.get(f2)); } } for (var C2 = this.get(10), T2 = 0, D2 = c2.length; T2 < D2; T2++) { var E2 = c2[T2], L2 = E2.conversationID, E2 = E2.groupAtInfoList; S(E2) || C2.onAtInfoUpdated({ topicID: L2.replace(A.CONV_GROUP, ""), groupAtInfoList: E2 }); } return { newConvList: r2 }; } }, { key: "_onLastMsgNotExist", value: function(e2) { new G("lastMsgNotExist").setMessage(JSON.stringify(e2)).end(); } }, { key: "_sortConvList", value: function(e2) { var t2 = [], n2 = [], o2 = [], i2 = []; return e2.forEach(function(e3) { (true === e3[1].isPinned ? S(e3[1].lastMessage.lastTime) ? n2 : t2 : S(e3[1].lastMessage.lastTime) ? i2 : o2).push(e3); }), t2.sort(function(e3, t3) { return t3[1].lastMessage.lastTime - e3[1].lastMessage.lastTime; }).concat(n2).concat(o2.sort(function(e3, t3) { return t3[1].lastMessage.lastTime - e3[1].lastMessage.lastTime; })).concat(i2); } }, { key: "_sortConvListAndEmitEvent", value: function() { this._convMap = new Map(this._sortConvList(p(this._convMap))), this.emitConvUpdate(true, false); } }, { key: "_updateUserOrGroupProfile", value: function(e2) { var n2, o2, t2, i2, a2 = this; 0 !== e2.length && (n2 = [], o2 = [], t2 = this.get(4), i2 = this.get(7), e2.forEach(function(e3) { var t3; e3.type === A.CONV_C2C ? n2.push(e3.toAccount) : e3.type === A.CONV_GROUP && (t3 = e3.toAccount, i2.hasLocalGroup(t3) ? e3.groupProfile = i2.getLocalGroupProfile(t3) : o2.push(t3)); }), M.l("".concat(this._n, "._updateUserOrGroupProfile userIDList:").concat(n2, " groupIDList:").concat(o2)), 0 < n2.length && t2.getUserProfile({ userIDList: n2 }).then(function(e3) { e3 = e3.data; O(e3) ? e3.forEach(function(e4) { a2._doUpdateUserProfile("".concat(A.CONV_C2C).concat(e4.userID), e4); }) : a2._doUpdateUserProfile("".concat(A.CONV_C2C).concat(e3.userID), e3); }), 0 < o2.length) && i2.getGroupProfileAdvance({ groupIDList: o2, responseFilter: { groupBaseInfoFilter: ["Type", "Name", "FaceUrl"] } }).then(function(e3) { var e3 = e3.data.successGroupList, n3 = false; e3.forEach(function(e4) { var t3 = "".concat(A.CONV_GROUP).concat(e4.groupID); a2._convMap.has(t3) && (t3 = a2._convMap.get(t3), _t(t3.groupProfile, e4, [], [null, void 0, "", 0, NaN]), !t3.subType && e4.type && (t3.subType = e4.type), n3 = true); }), n3 && a2.emitConvUpdate(); }); } }, { key: "_doUpdateUserProfile", value: function(e2, t2) { this.hasLocalConversation(e2) && (this.getLocalConversation(e2).userProfile = t2, this.emitConvUpdate()); } }, { key: "_getConvOptions", value: function(e2) { var n2 = this, o2 = [], e2 = e2.filter(function(e3) { var t2 = e3.type, e3 = e3.userID; return 1 === t2 && !n2._isNonExistentAccount(e3) || 2 === t2; }), i2 = this.getMyUserID(), e2 = e2.map(function(e3) { var t2; return N(e3.lastMsg) && (e3.lastMsg = { elements: [] }), 1 === e3.type ? (t2 = { userID: e3.userID, nick: e3.peerNick, avatar: e3.peerAvatar }, o2.push(t2), { conversationID: "".concat(A.CONV_C2C).concat(e3.userID), type: A.CONV_C2C, lastMessage: { lastTime: e3.time, lastSequence: e3.sequence, fromAccount: e3.lastC2CMsgFromAccount, type: e3.lastMsg.elements[0] ? e3.lastMsg.elements[0].type : null, payload: e3.lastMsg.elements[0] ? n2._amendLayersOverLimitProp(e3.lastMsg.elements[0].content) : null, cloudCustomData: e3.lastMsg.cloudCustomData || "", isRevoked: 8 === e3.lastMessageFlag, onlineOnlyFlag: false, nick: "", nameCard: "", version: 0, isPeerRead: e3.lastC2CMsgFromAccount === i2 && e3.time <= e3.c2cPeerReadTime, revoker: e3.lastMsg.revokerInfo ? e3.lastMsg.revokerInfo.revoker : null }, unreadCount: 0, userProfile: new ei(t2), peerReadTime: e3.c2cPeerReadTime, isPinned: 1 === e3.isPinned, customData: e3.customMark || "", markList: Zt(e3.standardMark), conversationGroupList: n2._convGroupHandler.getConvGroupListByID(e3.contactGroupId), remark: e3.friendRemark || "", messageRemindType: n2._transMsgRemindType(e3.messageRemindType) }) : { conversationID: "".concat(A.CONV_GROUP).concat(e3.groupID), type: A.CONV_GROUP, lastMessage: y(y({ lastTime: e3.time, lastSequence: e3.sequence, fromAccount: e3.msgGroupFromAccount }, n2._patchTypeAndPayload(e3)), {}, { cloudCustomData: e3.lastMsg.cloudCustomData || "", isRevoked: 2 === e3.lastMessageFlag, onlineOnlyFlag: false, nick: e3.senderNick || "", nameCard: e3.senderNameCard || "", revoker: e3.lastMsg.revokerInfo ? e3.lastMsg.revokerInfo.revoker : null }), groupProfile: new oi({ groupID: e3.groupID, name: e3.groupNick, avatar: e3.groupImage, type: e3.groupType, nextMessageSeq: e3.nextMessageSeq }), unreadCount: n2._computeGroupUnreadCount(e3), peerReadTime: 0, isPinned: 1 === e3.isPinned, version: 0, customData: e3.customMark || "", markList: Zt(e3.standardMark), conversationGroupList: n2._convGroupHandler.getConvGroupListByID(e3.contactGroupId), messageRemindType: n2._transMsgRemindType(e3.messageRemindType) }; }); return 0 < o2.length && this.get(4).onConvProfileUpdated(o2), e2; } }, { key: "_transMsgRemindType", value: function(e2) { var t2 = ""; return 0 === e2 ? t2 = A.MSG_REMIND_ACPT_AND_NOTE : 1 === e2 ? t2 = A.MSG_REMIND_DISCARD : 2 === e2 ? t2 = A.MSG_REMIND_ACPT_NOT_NOTE : 3 === e2 && (t2 = A.NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT), t2; } }, { key: "_computeGroupUnreadCount", value: function(e2) { var t2 = e2.unreadCount, e2 = e2.noUnreadCount, t2 = (void 0 === t2 ? 0 : t2) - (void 0 === e2 ? 0 : e2); return 0 < t2 ? t2 : 0; } }, { key: "_patchTypeAndPayload", value: function(e2) { var e2 = e2.lastMsg, t2 = e2.event, n2 = e2.elements, n2 = void 0 === n2 ? [] : n2, e2 = e2.groupTips, e2 = void 0 === e2 ? {} : e2; return N(void 0 === t2 ? void 0 : t2) || S(e2) ? { type: n2[0] ? n2[0].type : null, payload: n2[0] ? this._amendLayersOverLimitProp(n2[0].content) : null } : ((t2 = new Do(e2)).setElement({ type: A.MSG_GRP_TIP, content: y(y({}, e2.elements), {}, { groupProfile: e2.groupProfile }) }), n2 = JSON.parse(JSON.stringify(t2.payload)), t2 = null, { type: A.MSG_GRP_TIP, payload: n2 }); } }, { key: "_amendLayersOverLimitProp", value: function(e2) { var t2 = e2.layersOverLimit; return 0 === t2 ? e2.layersOverLimit = false : 1 === t2 && (e2.layersOverLimit = true), e2; } }, { key: "getLocalMessageList", value: function(e2) { return this._msgListHandler.getLocalMsgList(e2); } }, { key: "deleteLocalMessage", value: function(e2) { e2 instanceof Do && this._msgListHandler.remove(e2); } }, { key: "onConvDeleted", value: function(e2) { O(e2) && (e2 = e2.map(function(e3) { var t2 = e3.type, n2 = e3.userID, e3 = e3.groupID; return 1 === t2 ? "".concat(A.CONV_C2C).concat(n2) : 2 === t2 ? "".concat(A.CONV_GROUP).concat(e3) : void 0; }), M.l("".concat(this._n, ".onConvDeleted convIDList:").concat(e2)), this.deleteLocalConvList(e2)); } }, { key: "onConvPinnedStatus", value: function(e2, i2) { var a2, s2 = this; O(e2) && (a2 = false, e2.forEach(function(e3) { var t2, n2 = e3.type, o2 = e3.userID, e3 = e3.groupID; 1 === n2 ? t2 = s2.getLocalConversation("".concat(A.CONV_C2C).concat(o2)) : 2 === n2 && (t2 = s2.getLocalConversation("".concat(A.CONV_GROUP).concat(e3))), t2 && (M.l("".concat(s2._n, ".onConvPinnedStatus convID:").concat(t2.conversationID, " localPinned:").concat(t2.isPinned, " remotePinned:").concat(i2)), i2 ? t2.isPinned || (t2.isPinned = true, a2 = true) : t2.isPinned && (t2.isPinned = false, a2 = true)); }), a2) && this._sortConvListAndEmitEvent(); } }, { key: "getMessageList", value: function(e2) { var r2 = this, c2 = e2.conversationID, t2 = e2.nextReqMessageID, e2 = e2.count, u2 = "".concat(this._n, ".getMessageList"), n2 = this.getLocalConversation(c2), o2 = ""; if (n2 && n2.groupProfile && (o2 = n2.groupProfile.type), Ot(o2)) return M.l("".concat(u2, " not available in ").concat(o2, ". convID:").concat(c2)), T({ messageList: [], nextReqMessageID: "", isCompleted: true }); (N(e2) || 15 < e2) && (e2 = 15), t2 || this._isMeInCommunity(c2) || this.clearMemMsg(c2); var l2 = this._computeRemainingCount({ conversationID: c2, nextReqMessageID: t2 }), n2 = this._completedMap.has(c2); if (M.l("".concat(u2, " convID:").concat(c2, " isEverCleared:").concat(this._isEverCleared(c2), " nextReqMessageID:").concat(t2) + " remainingCount:".concat(l2, " count:").concat(e2, " isCompleted:").concat(n2)), this._needGetHistory({ conversationID: c2, remainingCount: l2, count: e2 })) return this.getHistoryMessages({ conversationID: c2, nextReqMessageID: t2, count: 20 }).then(function(e3) { var t3 = e3.nextReqID, n3 = e3.storedMessageList, o3 = e3.assembledMessageList, e3 = e3.isPullingCompleted, i2 = r2._completedMap.has(c2), a2 = n3, s2 = (0 < l2 && (a2 = r2._msgListHandler.getLocalMsgList(c2).slice(0, n3.length + l2)), { nextReqMessageID: void 0, messageList: void 0, isCompleted: void 0 }), n3 = (r2._isEverCleared(c2) ? (s2.nextReqMessageID = t3, s2.messageList = o3, s2.isCompleted = e3) : (s2.nextReqMessageID = i2 ? "" : t3, s2.messageList = a2, s2.isCompleted = i2), s2.messageList.filter(function(e4) { return e4.isRevoked; }) || []), o3 = s2.messageList.map(function(e4) { return e4.sequence; }); return M.l("".concat(u2, " ret.nextReqMessageID:").concat(s2.nextReqMessageID, " ret.isCompleted:").concat(s2.isCompleted, " sequenceList:"), o3), O(n3) && 0 !== n3.length ? r2.updateRevokerInfo(n3).then(function(e4) { return e4.forEach(function(t4) { var n4 = t4.revokerInfo; s2.messageList = s2.messageList.map(function(e5) { return e5.ID === t4.ID && n4 && (e5.revokeReason = n4.reason || "", e5.revokerInfo = { userID: n4.revoker || e5.revoker, nick: n4.nick, avatar: n4.avatar }), e5; }); }), C(s2); }) : C(s2); }); this.modifyMessageList(c2); o2 = this._getMsgListFromMem({ conversationID: c2, nextReqMessageID: t2, count: e2 }); return T(o2); } }, { key: "_isEverCleared", value: function(e2) { return this._everClearedMap.has(e2); } }, { key: "_getMsgListFromMem", value: function(e2) { var t2 = e2.conversationID, n2 = e2.nextReqMessageID, e2 = e2.count, o2 = "".concat(this._n, "._getMsgListFromMem"), i2 = this._msgListHandler.getLocalMsgList(t2), a2 = i2.length, s2 = Pt(t2), r2 = 0, c2 = { isCompleted: false, nextReqMessageID: "", messageList: [] }, e2 = (n2 ? (r2 = s2 ? i2.findIndex(function(e3) { return e3.ID === n2; }) : i2.findIndex(function(e3) { return e3.sequence + "" === n2; })) > e2 ? (c2.messageList = i2.slice(r2 - e2, r2), c2.nextReqMessageID = s2 ? i2[r2 - e2].ID : i2[r2 - e2].sequence + "") : (c2.messageList = i2.slice(0, r2), c2.isCompleted = true) : e2 < a2 ? (c2.messageList = i2.slice(r2 = a2 - e2, a2), c2.nextReqMessageID = s2 ? i2[r2].ID : i2[r2].sequence + "") : (c2.messageList = i2.slice(0, a2), c2.isCompleted = true), c2.messageList.map(function(e3) { return e3.sequence; })); return M.l("".concat(o2, " convID:").concat(t2) + " ret.nextReqMessageID:".concat(c2.nextReqMessageID, " ret.isCompleted:").concat(c2.isCompleted, " sequenceList:").concat(e2)), c2; } }, { key: "getMessageListHopping", value: function(e2) { var t2, n2, o2 = e2.conversationID, i2 = e2.sequence, a2 = e2.time, s2 = e2.count, e2 = e2.direction, e2 = void 0 === e2 ? 0 : e2; return (N(s2) || 15 < s2) && (s2 = 15), o2.startsWith(A.CONV_C2C) ? (t2 = this.get(6), n2 = o2.replace(A.CONV_C2C, ""), t2.getRoamingMessagesHopping({ peerAccount: n2, time: a2, count: s2, direction: e2 })) : o2.startsWith(A.CONV_GROUP) ? (t2 = this.get(7), n2 = o2.replace(A.CONV_GROUP, ""), t2.getRoamingMessagesHopping({ groupID: n2, sequence: i2, count: s2, direction: e2 })) : void 0; } }, { key: "_computeRemainingCount", value: function(e2) { var t2, n2 = e2.conversationID, o2 = e2.nextReqMessageID, e2 = this._msgListHandler.getLocalMsgList(n2), i2 = e2.length; return M.l("".concat(this._n, "._computeRemainingCount convID:").concat(n2, " nextReqMessageID:").concat(o2, " length:").concat(i2)), o2 ? (t2 = 0, Pt(n2) ? t2 = e2.findIndex(function(e3) { return e3.ID === o2; }) : Ut(n2) && (t2 = -1 !== o2.indexOf("-") ? e2.findIndex(function(e3) { return e3.ID === o2; }) : e2.findIndex(function(e3) { return e3.sequence + "" === o2; })), -1 === t2 ? 0 : t2) : i2; } }, { key: "_needGetHistory", value: function(e2) { var t2 = e2.conversationID, n2 = e2.remainingCount, e2 = e2.count, o2 = this.getLocalConversation(t2), i2 = ""; return o2 && o2.groupProfile && (i2 = o2.groupProfile.type), !(bt(t2) || Ot(i2) || !this._isEverCleared(t2) && (o2 = n2 <= e2 && !this._completedMap.has(t2), M.l("".concat(this._n, "._needGetHistory convID:").concat(t2, " ret:").concat(o2)), !o2)); } }, { key: "_isTopicConv", value: function(e2) { e2 = e2.replace(A.CONV_GROUP, ""); return Gt(e2); } }, { key: "getHistoryMessages", value: function(e2) { var t2, n2, o2, i2, a2, s2, r2 = e2.conversationID, c2 = e2.count, e2 = e2.nextReqMessageID; return r2 === A.CONV_SYSTEM ? T() : (c2 = 20 < c2 ? 20 : 15, t2 = null, Pt(r2) ? (s2 = 0, n2 = "", o2 = false, a2 = this._roamingMsgKeyAndTimeMap.has(r2), e2 && (o2 = true, a2 ? (s2 = this._roamingMsgKeyAndTimeMap.get(r2).lastMessageTime, n2 = this._roamingMsgKeyAndTimeMap.get(r2).messageKey) : (i2 = this._msgListHandler.findMessage(e2)) && (s2 = i2.time, M.l("".concat(this._n, ".getHistoryMessages convID:").concat(r2, " isRelayInfoExisted:").concat(a2, " lastMessageTime:").concat(s2)))), (t2 = this.get(6)).getRoamingMessage({ conversationID: r2, peerAccount: r2.replace(A.CONV_C2C, ""), count: c2, lastMessageTime: o2 ? s2 : 0, messageKey: o2 ? n2 : "" })) : Ut(r2) ? (t2 = this.get(7)) ? (i2 = r2.replace(A.CONV_GROUP, ""), a2 = null, this._convMap.has(r2) && !Gt(i2) && (a2 = this._convMap.get(r2).lastMessage), s2 = 0, e2 ? s2 = Number(e2) : a2 && (s2 = a2.lastSequence), t2.getRoamingMessage({ conversationID: r2, groupID: i2, count: c2, sequence: s2 })) : D({ code: L.NO_MODULE }) : T()); } }, { key: "patchConvLastMessage", value: function(e2) { var t2, n2, o2 = 1 < arguments.length && void 0 !== arguments[1] && arguments[1], i2 = this.getLocalConversation(e2); i2 && (t2 = (n2 = i2.lastMessage).messageForShow, n2 = n2.payload, S(t2) || S(n2) || o2) && 0 !== (t2 = this._msgListHandler.getLocalMsgList(e2)).length && (n2 = t2[t2.length - 1], M.l("".concat(this._n, ".patchConvLastMessage bForceUpdate:").concat(o2, " convID:").concat(e2, " payload:"), n2.payload), i2.updateLastMessage(n2)); } }, { key: "onRoamingMessage", value: function() { for (var e2, t2, n2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], o2 = 1 < arguments.length ? arguments[1] : void 0, i2 = !(2 < arguments.length && void 0 !== arguments[2]) || arguments[2], a2 = 3 < arguments.length ? arguments[3] : void 0, s2 = o2.startsWith(A.CONV_C2C) ? A.CONV_C2C : A.CONV_GROUP, r2 = null, c2 = [], o2 = [], u2 = 0, l2 = n2.length, d2 = s2 === A.CONV_GROUP, p2 = this.getFileDownloadProxy(), _2 = this.getDowloadFileAuthKey(), h2 = O(a2), g2 = this.get(17).getFileDNList(), f2 = function() { d2 ? --u2 : ++u2; }, m2 = function() { return d2 ? l2 <= u2 : u2 < l2; }, u2 = d2 ? n2.length - 1 : 0, l2 = d2 ? 0 : n2.length; m2(); f2()) 1 !== n2[u2].isPlaceMessage && ((r2 = new Do(n2[u2])).to = n2[u2].to, s2 !== A.CONV_GROUP || N(n2[u2].topicID) || (r2.to = n2[u2].topicID), r2.isSystemMessage = !!n2[u2].isSystemMessage, r2.conversationType = s2, e2 = 4 === n2[u2].event ? { type: A.MSG_GRP_TIP, content: y(y({}, n2[u2].elements), {}, { groupProfile: n2[u2].groupProfile }) } : n2[u2].elements, d2 || r2.setNickAndAvatar({ nick: n2[u2].nick, avatar: n2[u2].avatar }), S(e2) ? ((t2 = new G("emptyMessageBody")).setMessage("from:".concat(r2.from, " to:").concat(r2.to, " sequence:").concat(r2.sequence, " event:").concat(n2[u2].event)), t2.setLevel("warning").end()) : (r2.setElement(e2, p2, _2, g2), r2.reInitialize(this.getMyUserID()), c2.push(r2), h2 && a2.push(r2))); return f2 = m2 = null, i2 ? (this._msgListHandler.unshift(c2, o2), c2 = null, o2) : c2; } }, { key: "findMessage", value: function(e2) { return this._msgListHandler.findMessage(e2); } }, { key: "_isMeInCommunity", value: function(e2) { var t2 = true; return this._isTopicConv(e2) && (e2 = Jt(e2.replace(A.CONV_GROUP, "")), this.get(7).hasLocalGroup(e2) || (t2 = false, M.l("".concat(this._n, "._isMeInCommunity groupID:").concat(e2, " ret:").concat(t2)))), t2; } }, { key: "deleteTopicRoamingInfo", value: function(e2) { var t2 = this; Nt({ groupID: e2 }) && this._msgListHandler.getTopicConvIDList(e2).forEach(function(e3) { t2.clearMemMsg(e3); }); } }, { key: "deleteGroupRoamingInfo", value: function(e2) { e2 = "".concat(A.CONV_GROUP).concat(e2); 0 < this._msgListHandler.getLocalMsgList(e2).length && this.clearMemMsg(e2); } }, { key: "setMessageRead", value: function(e2) { var t2 = e2.conversationID, n2 = this.getLocalConversation(t2), e2 = "".concat(this._n, ".setMessageRead"); if (M.l("".concat(e2, " convID:").concat(t2, " unreadCount:").concat(n2 ? n2.unreadCount : 0)), !n2) return T(); if (n2.type !== A.CONV_GROUP && n2.type !== A.CONV_TOPIC || S(n2.groupAtInfoList) || this.deleteGroupAtTips(t2), 0 === n2.unreadCount) return T(); var o2 = this._msgListHandler.getLocalLastMsg(t2), i2 = n2.lastMessage.lastTime, a2 = this._msgListHandler.getLocalMaxTime(t2), a2 = (i2 < a2 && (M.l("".concat(e2, " update lastMessageTime from ").concat(i2, " to ").concat(a2)), i2 = a2), this._msgListHandler.getLocalMaxSeq(t2)), s2 = n2.lastMessage.lastSequence, r2 = (s2 < a2 && (M.l("".concat(e2, " update lastMessageSeq from ").concat(s2, " to ").concat(a2)), s2 = a2), n2.type === A.CONV_TOPIC && N(o2) && (e2 = this.get(10), o2 = Jt(a2 = t2.replace(A.CONV_GROUP, "")), e2 = e2.getLocalTopic(o2, a2)) && (s2 = e2.nextMessageSeq - 1), null); switch (n2.type) { case A.CONV_C2C: return (r2 = this.get(6)) ? r2.setMessageRead({ conversationID: t2, lastMessageTime: i2 }) : D({ code: L.NO_MODULE }); case A.CONV_GROUP: case A.CONV_TOPIC: return (r2 = this.get(7)) ? r2.setMessageRead({ conversationID: t2, lastMessageSeq: s2 }) : D({ code: L.NO_MODULE }); case A.CONV_SYSTEM: return n2.unreadCount = 0, this.emitConvUpdate(true, false), T(); default: return T(); } } }, { key: "setAllMessageRead", value: function() { var t2, n2 = this, o2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, e2 = "setAllMessageRead", i2 = "".concat(this._n, ".").concat(e2), a2 = (o2.scope || (o2.scope = A.READ_ALL_MSG), M.l("".concat(i2, " options:"), o2), this._createSetAllMessageReadPack(o2)); return 0 === a2.readAllC2CMessage && 0 === a2.groupMessageReadInfoList.length ? T() : (t2 = new G(e2), this.req({ P: k.SET_ALL_MSG_READ, data: a2 }).then(function(e3) { e3 = e3.data, e3 = n2._handleAllMsgRead(e3); return t2.setMessage("scope:".concat(o2.scope, " failureGroups:").concat(JSON.stringify(e3))).end(), T(); }).catch(function(e3) { return t2.setError(e3).end(), M.w("".concat(i2, " failed. error:"), e3), D({ code: e3 && e3.code ? e3.code : L.MSG_UNREAD_ALL_FAIL, message: e3 && e3.message ? e3.message : void 0 }); })); } }, { key: "setConvCustomData", value: function(e2) { return this._convGroupHandler.setConvCustomData(e2); } }, { key: "markConv", value: function(e2) { return this._convGroupHandler.markConv(e2); } }, { key: "getConvGroupList", value: function() { return this._convGroupHandler.getLocalConvGroupList(); } }, { key: "createConvGroup", value: function(e2) { return this._convGroupHandler.createConvGroup(e2); } }, { key: "deleteConvGroup", value: function(e2) { return this._convGroupHandler.deleteConvGroup(e2); } }, { key: "renameConvGroup", value: function(e2) { return this._convGroupHandler.renameConvGroup(e2); } }, { key: "addConvsToGroup", value: function(e2) { return this._convGroupHandler.addConvsToGroup(e2); } }, { key: "deleteConvsFromGroup", value: function(e2) { return this._convGroupHandler.deleteConvsFromGroup(e2); } }, { key: "onConvMarkUpdated", value: function(e2) { this._convGroupHandler.onConvMarkUpdated(e2); } }, { key: "onConvGroupCreated", value: function(e2) { this._convGroupHandler.onConvGroupCreated(e2); } }, { key: "onConvGroupDeleted", value: function(e2) { this._convGroupHandler.onConvGroupDeleted(e2); } }, { key: "onConvGroupNameUpdated", value: function(e2) { this._convGroupHandler.onConvGroupNameUpdated(e2); } }, { key: "onConvInGroupUpdated", value: function(e2) { this._convGroupHandler.onConvInGroupUpdated(e2); } }, { key: "onConvAddedToOrDeletedFromGroup", value: function(e2) { this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e2); } }, { key: "_getConvLastMessageSeq", value: function(e2) { var t2 = this._msgListHandler.getLocalLastMsg(e2.conversationID), e2 = e2.lastMessage.lastSequence; return e2 = t2 && e2 < t2.sequence ? t2.sequence : e2; } }, { key: "_getConvLastMessageTime", value: function(e2) { var t2 = this._msgListHandler.getLocalLastMsg(e2.conversationID), e2 = e2.lastMessage.lastTime; return e2 = t2 && e2 < t2.time ? t2.time : e2; } }, { key: "_createSetAllMessageReadPack", value: function(e2) { var t2, n2 = { readAllC2CMessage: 0, groupMessageReadInfoList: [] }, o2 = e2.scope, i2 = Z(this._convMap); try { for (i2.s(); !(t2 = i2.n()).done; ) { var a2, s2 = Y(t2.value, 2)[1]; if (0 < s2.unreadCount) if (s2.type === A.CONV_C2C && 0 === n2.readAllC2CMessage) { if (o2 === A.READ_ALL_MSG) n2.readAllC2CMessage = 1; else if (o2 === A.READ_ALL_C2C_MSG) { n2.readAllC2CMessage = 1; break; } } else s2.type !== A.CONV_GROUP || o2 !== A.READ_ALL_GROUP_MSG && o2 !== A.READ_ALL_MSG || (a2 = this._getConvLastMessageSeq(s2), n2.groupMessageReadInfoList.push({ groupID: s2.groupProfile.groupID, messageSequence: a2 })); } } catch (e3) { i2.e(e3); } finally { i2.f(); } return n2; } }, { key: "onPushedAllMessageRead", value: function(e2) { this._handleAllMsgRead(e2); } }, { key: "_handleAllMsgRead", value: function(e2) { var t2 = e2.groupMessageReadInfoList, e2 = e2.readAllC2CMessage, t2 = this._parseGroupReadInfo(t2); return 1 <= this._updateAllConvUnreadCount({ readAllC2CMessage: e2 }) && this.emitConvUpdate(true, false), t2; } }, { key: "_parseGroupReadInfo", value: function(e2) { var t2 = []; if (e2 && e2.length) for (var n2 = 0, o2 = e2.length; n2 < o2; n2++) { var i2 = e2[n2], a2 = i2.groupID, s2 = i2.sequence, r2 = i2.retCode, i2 = i2.lastMessageSeq; N(r2) ? this._remoteGroupReadSeqMap.set(a2, i2) : (this._remoteGroupReadSeqMap.set(a2, s2), 0 !== r2 && t2.push("".concat(a2, "-").concat(s2, "-").concat(r2))); } return t2; } }, { key: "_updateAllConvUnreadCount", value: function(e2) { var t2, n2 = e2.readAllC2CMessage, o2 = 0, i2 = Z(this._convMap); try { for (i2.s(); !(t2 = i2.n()).done; ) { var a2, s2, r2, c2, u2 = Y(t2.value, 2), l2 = u2[0], d2 = u2[1]; 1 <= d2.unreadCount && (1 === n2 && d2.type === A.CONV_C2C ? (a2 = this._getConvLastMessageTime(d2), this.updateIsReadAfterReadReport({ conversationID: l2, lastMessageTime: a2 })) : d2.type === A.CONV_GROUP && (s2 = l2.replace(A.CONV_GROUP, ""), this._remoteGroupReadSeqMap.has(s2)) && (r2 = this._remoteGroupReadSeqMap.get(s2), c2 = this._getConvLastMessageSeq(d2), this.updateIsReadAfterReadReport({ conversationID: l2, remoteReadSequence: r2 }), r2 <= c2) && this._remoteGroupReadSeqMap.delete(s2), this.updateUnreadCount(l2, false)) && (o2 += 1); } } catch (e3) { i2.e(e3); } finally { i2.f(); } return o2; } }, { key: "isRemoteRead", value: function(e2) { var t2, n2 = e2.conversationID, e2 = e2.sequence, o2 = n2.replace(A.CONV_GROUP, ""), i2 = false; return this._remoteGroupReadSeqMap.has(o2) && (e2 <= (t2 = this._remoteGroupReadSeqMap.get(o2)) && (i2 = true, M.l("".concat(this._n, ".isRemoteRead convID:").concat(n2, " msgSeq:").concat(e2, " remoteReadSeq:").concat(t2))), t2 + 10 <= e2) && this._remoteGroupReadSeqMap.delete(o2), i2; } }, { key: "updateIsReadAfterReadReport", value: function(e2) { var t2 = e2.conversationID, n2 = e2.lastMessageSeq, o2 = e2.lastMessageTime, i2 = this._msgListHandler.getLocalMsgList(t2); if (0 !== i2.length) { for (var a2, s2 = i2.length - 1; 0 <= s2; s2--) if (a2 = i2[s2], !(o2 && a2.time > o2 || n2 && a2.sequence > n2)) { if ("in" === a2.flow && a2.isRead) break; a2.setIsRead(true); } } } }, { key: "updateUnreadCount", value: function(e2) { var t2, n2 = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1], o2 = false, i2 = this.getLocalConversation(e2), a2 = this._msgListHandler.getLocalMsgList(e2); if (i2) return (t2 = i2.unreadCount) !== (a2 = a2.filter(function(e3) { return !e3.isRead && !e3._onlineOnlyFlag && !e3.isDeleted; }).length) && (i2.unreadCount = a2, o2 = true, M.l("".concat(this._n, ".updateUnreadCount from ").concat(t2, " to ").concat(a2, ", convID:").concat(e2)), true === n2) && this.emitConvUpdate(true, false), o2 && i2.type === A.CONV_TOPIC && (t2 = i2.unreadCount, a2 = this.get(10), n2 = e2.replace(A.CONV_GROUP, ""), a2.onUnreadCountUpdatedFromConv(n2, t2)), o2; } }, { key: "clearGroupAtInfoList", value: function(e2) { var t2, n2 = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1], o2 = this.getLocalConversation(e2); o2 && 0 < o2.groupAtInfoList.length && (o2.clearGroupAtInfoList(), M.l("".concat(this._n, ".clearGroupAtInfoList convID:").concat(e2)), o2.type === A.CONV_TOPIC && (o2 = o2.groupAtInfoList, t2 = this.get(10), e2 = e2.replace(A.CONV_GROUP, ""), t2.onAtInfoUpdated({ topicID: e2, groupAtInfoList: o2 })), true === n2) && this.emitConvUpdate(true, false); } }, { key: "updateReadReceiptInfo", value: function(e2) { var a2, s2, o2, r2 = this, t2 = e2.userID, i2 = void 0 === t2 ? void 0 : t2, t2 = e2.groupID, c2 = void 0 === t2 ? void 0 : t2, t2 = e2.readReceiptList, e2 = e2.timestamp, u2 = void 0 === e2 ? 0 : e2; S(t2) || (a2 = [], N(i2) ? N(c2) || (s2 = "".concat(A.CONV_GROUP).concat(c2), t2.forEach(function(e3) { var t3 = e3.tinyID, n2 = e3.clientTime, o3 = e3.random, i3 = e3.readCount, e3 = e3.unreadCount, t3 = "".concat(t3, "-").concat(n2, "-").concat(o3), n2 = r2._msgListHandler.getLocalMsg(s2, t3) || r2._msgListHandler.getHoppingMsg(s2, t3), o3 = { groupID: c2, messageID: t3, readCount: 0, unreadCount: 0 }; n2 && (R(i3) && (n2.readReceiptInfo.readCount = i3, o3.readCount = i3), R(e3) && (n2.readReceiptInfo.unreadCount = e3, o3.unreadCount = e3), a2.push(o3)); })) : (o2 = "".concat(A.CONV_C2C).concat(i2), t2.forEach(function(e3) { var t3 = e3.tinyID, n2 = e3.clientTime, e3 = e3.random, t3 = "".concat(t3, "-").concat(n2, "-").concat(e3), n2 = r2._msgListHandler.getLocalMsg(o2, t3) || r2._msgListHandler.getHoppingMsg(o2, t3); n2 && !n2.readReceiptInfo.isPeerRead && (n2.readReceiptInfo.isPeerRead = true, n2.readReceiptInfo.timestamp = u2, a2.push({ userID: i2, messageID: t3, isPeerRead: true, timestamp: u2 })); })), 0 < a2.length && this.emitOEvt(h.MESSAGE_READ_RECEIPT_RECEIVED, a2)); } }, { key: "updateIsRead", value: function(e2) { var t2 = this.getLocalConversation(e2), n2 = this.getLocalMessageList(e2); if (t2 && 0 !== n2.length && !bt(t2.type)) { for (var o2 = [], i2 = 0, a2 = n2.length; i2 < a2; i2++) "in" !== n2[i2].flow ? "out" !== n2[i2].flow || n2[i2].isRead || n2[i2].setIsRead(true) : o2.push(n2[i2]); var s2 = 0; s2 = t2.type === A.CONV_C2C ? (e2 = o2.slice(-t2.unreadCount).filter(function(e3) { return e3.isRevoked; }).length, o2.length - t2.unreadCount - e2) : o2.length - t2.unreadCount; for (var r2 = 0; r2 < s2 && !o2[r2].isRead; r2++) o2[r2].setIsRead(true); } } }, { key: "deleteGroupAtTips", value: function(e2) { var t2, n2, o2, i2 = this, a2 = "".concat(this._n, ".deleteGroupAtTips"), s2 = (M.l("".concat(a2)), this._convMap.get(e2)); return !s2 || 0 === (t2 = s2.groupAtInfoList).length ? Promise.resolve() : (s2 = void 0, e2.startsWith(A.CONV_GROUP) && (s2 = e2.replace(A.CONV_GROUP, "")), n2 = p(t2), (Nt({ groupID: s2 }) || Gt(s2)) && 0 === (n2 = t2.filter(function(e3) { return !e3.atTypeArray.includes(A.CONV_AT_ALL); })).length ? (this.clearGroupAtInfoList(e2, false), Promise.resolve()) : (o2 = this.getMyUserID(), this.req({ P: k.DEL_GROUP_AT_TIPS, data: { messageListToDelete: n2.map(function(e3) { return { from: e3.from, to: o2, messageSeq: e3.__sequence, messageRandom: e3.__random, groupID: N(e3.topicID) ? e3.groupID : e3.topicID }; }) } }).then(function() { return M.l("".concat(a2, " ok. count:").concat(t2.length)), i2.clearGroupAtInfoList(e2, false), Promise.resolve(); }).catch(function(e3) { return M.e("".concat(a2, " failed. error:"), e3), D(e3); }))); } }, { key: "appendToMessageList", value: function(e2) { return this._msgListHandler.pushIn(e2); } }, { key: "setMessageRandom", value: function(e2) { this._sll.set(e2.random); } }, { key: "deleteMessageRandom", value: function(e2) { this._sll.delete(e2.random); } }, { key: "pushIntoMessageList", value: function(e2, t2, n2) { return !(!this._msgListHandler.pushIn(t2, n2) || this._sll.has(t2.random) && !n2 || (e2.push(t2), 0)); } }, { key: "revoke", value: function(e2, t2, n2) { return this._msgListHandler.revoke(e2, t2, n2); } }, { key: "getPeerReadTime", value: function(e2) { return this._peerReadTimeMap.get(e2); } }, { key: "recordPeerReadTime", value: function(e2, t2) { (!this._peerReadTimeMap.has(e2) || this._peerReadTimeMap.get(e2) < t2) && this._peerReadTimeMap.set(e2, t2); } }, { key: "updateMsgIsPeerReadProp", value: function(e2, t2) { var n2; e2.startsWith(A.CONV_C2C) && 0 < t2 && (0 < (n2 = this._msgListHandler.updateMsgIsPeerReadProp(e2, t2)).length && this.emitOEvt(h.MESSAGE_READ_BY_PEER, n2), this._convMap.has(e2)) && !S(n2 = this._convMap.get(e2).lastMessage) && n2.fromAccount === this.getMyUserID() && n2.lastTime <= t2 && !n2.isPeerRead && (n2.isPeerRead = true, this.emitConvUpdate(true, false)); } }, { key: "updateMsgIsModifiedProp", value: function(e2) { this._msgListHandler.updateMsgIsModifiedProp(e2); } }, { key: "setCompleted", value: function(e2) { M.l("".concat(this._n, ".setCompleted convID:").concat(e2)), this._completedMap.set(e2, true); } }, { key: "updateRoamingMsgKeyAndTime", value: function(e2, t2, n2) { this._roamingMsgKeyAndTimeMap.set(e2, { messageKey: t2, lastMessageTime: n2 }); } }, { key: "getConvList", value: function(t2) { var n2, o2 = this, i2 = "".concat(this._n, ".").concat("getConvList"), e2 = "pagingStatus:".concat(this._pagingStatus, ", local conversation count:").concat(this._convMap.size, ", options:").concat(JSON.stringify(t2)); return M.l("".concat(i2, ". ").concat(e2)), this._pagingStatus === Un ? ((n2 = new G("getConvList")).setMessage(e2), this.syncConvList().then(function() { n2.end(); var e3 = o2._getConvList(t2); return C({ conversationList: e3, isSyncCompleted: o2._isSyncCompleted() }); }).catch(function(e3) { return n2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); })) : (e2 = this._getConvList(t2), M.l("".concat(i2, ". returned conversation count:").concat(e2.length)), T({ conversationList: e2, isSyncCompleted: this._isSyncCompleted() })); } }, { key: "_getConvList", value: function(t2) { var n2, o2, i2, a2, s2, r2 = this; return N(t2) ? this.getLocalConvList() : O(t2) ? 0 === t2.length ? [] : this.getLocalConvList().filter(function(e2) { return t2.includes(e2.conversationID); }) : f(t2) ? (n2 = t2.type, o2 = t2.markType, i2 = t2.groupName, a2 = t2.hasUnreadCount, s2 = t2.hasGroupAtInfo, this.getLocalConvList().filter(function(e2) { return r2._filterType(e2, n2) && r2._filterMarkType(e2, o2) && r2._filterGroupName(e2, i2) && r2._filterUnreadCount(e2, a2) && r2._filterGroupAtInfo(e2, s2); })) : []; } }, { key: "_filterType", value: function(e2, t2) { return t2 !== A.CONV_C2C && t2 !== A.CONV_GROUP || e2.type === t2; } }, { key: "_filterGroupName", value: function(e2, t2) { return !m(t2) || ("" === t2 ? 0 === e2.conversationGroupList.length : e2.conversationGroupList.includes(t2)); } }, { key: "_filterMarkType", value: function(e2, t2) { return !R(t2) || (0 === t2 ? 0 === e2.markList.length : e2.markList.includes(t2)); } }, { key: "_filterUnreadCount", value: function(e2, t2) { var n2 = true; return true === t2 ? n2 = 1 <= e2.unreadCount : false === t2 && (n2 = 0 === e2.unreadCount), n2; } }, { key: "_filterGroupAtInfo", value: function(e2, t2) { var n2 = true; return true === t2 ? n2 = 1 <= e2.groupAtInfoList.length : false === t2 && (n2 = 0 === e2.groupAtInfoList.length), n2; } }, { key: "_handleC2CPeerReadTime", value: function() { var e2, t2 = Z(this._convMap); try { for (t2.s(); !(e2 = t2.n()).done; ) { var n2 = Y(e2.value, 2), o2 = n2[0], i2 = n2[1]; i2.type === A.CONV_C2C && this.recordPeerReadTime(o2, i2.peerReadTime); } } catch (e3) { t2.e(e3); } finally { t2.f(); } } }, { key: "_isPagingGetGroupListCompleted", value: function() { var e2 = this.get(7); return !e2 || e2.isPagingGetCompleted(); } }, { key: "_getLocalGroupCount", value: function() { var e2 = this.get(7); return e2 ? e2.getLocalGroupList().length : 0; } }, { key: "_hasLocalGroup", value: function(e2) { var t2 = this.get(7); return !!t2 && t2.hasLocalGroup(e2.replace(A.CONV_GROUP, "")); } }, { key: "getConversationProfile", value: function(o2) { var i2, a2 = this, s2 = false; if (this._convMap.has(o2) ? i2 = this._convMap.get(o2) : (i2 = new ii({ conversationID: o2, type: Pt(o2) ? A.CONV_C2C : A.CONV_GROUP }, this.isIntl(), this.isUsingChatCore()), s2 = true), i2._isInfoCompleted || i2.type === A.CONV_SYSTEM) return T({ conversation: i2 }); if (Ut(o2)) { if (!this.get(7)) return D({ code: L.NO_MODULE }); if (!this._hasLocalGroup(o2)) return T({ conversation: i2 }); } var r2 = "".concat(this._n, ".").concat("getConversationProfile"), c2 = new G("getConversationProfile"); return M.l("".concat(r2, ". convID:").concat(o2, " remark:").concat(i2.remark, " lastMessage:"), i2.lastMessage), this._getUserOrGroupProfile(i2).then(function(e2) { c2.setMessage("convID:".concat(o2, " unreadCount:").concat(e2.data.conversation.unreadCount)).end(); var t2, n2 = a2.get(8); if (n2 && i2.type === A.CONV_C2C && (t2 = o2.replace(A.CONV_C2C, ""), n2.isMyFriend(t2)) && (n2 = n2.getFriendRemark(t2), i2.remark !== n2) && (i2.remark = n2, M.l("".concat(r2, ". convID:").concat(o2, " patch remark:").concat(i2.remark))), M.l("".concat(r2, " ok. isNewConv:").concat(s2, " convID:").concat(o2)), s2) { if (i2.type === A.CONV_C2C) return a2._onNewC2CConv([o2.replace(A.CONV_C2C, "")]).then(function() { return T({ conversation: i2 }); }); if (i2.type === A.CONV_GROUP) return a2._onNewGroupConv([o2.replace(A.CONV_GROUP, "")]).then(function() { return T({ conversation: i2 }); }); } return e2; }).catch(function(e2) { return c2.setError(e2).setMessage("convID:".concat(o2)).end(), M.e("".concat(r2, " failed. error:"), e2), D(e2); }); } }, { key: "_getUserOrGroupProfile", value: function(t2) { var n2 = this; return t2.type === A.CONV_C2C ? this.get(4).getUserProfile({ userIDList: [t2.toAccount] }).then(function(e2) { e2 = e2.data; return 0 === e2.length ? D({ code: L.USER_OR_GRP_NOT_FOUND }) : (t2.userProfile = e2[0], t2._isInfoCompleted = true, n2._insertConvAfterTopmost(t2), T({ conversation: t2 })); }) : this.get(7).getGroupProfile({ groupID: t2.toAccount }).then(function(e2) { return t2.groupProfile = e2.data.group, t2._isInfoCompleted = true, n2._insertConvAfterTopmost(t2), T({ conversation: t2 }); }); } }, { key: "_insertConvAfterTopmost", value: function(e2) { var t2, n2; e2 instanceof ii && !this._convMap.has(e2.conversationID) && (n2 = (t2 = p(this._convMap)).findIndex(function(e3) { return false === e3[1].isPinned; }), t2.splice(n2, 0, [e2.conversationID, e2]), this._convMap = new Map(t2), this._setStorageConvList(), this.emitConvUpdate(true, false)); } }, { key: "_onProfileUpdated", value: function(e2) { var n2 = this; e2.data.forEach(function(e3) { var t2 = e3.userID; t2 === n2.getMyUserID() ? n2._onMyProfileModified({ latestNick: e3.nick, latestAvatar: e3.avatar }) : (t2 = n2._convMap.get("".concat(A.CONV_C2C).concat(t2))) && (t2.userProfile = e3); }); } }, { key: "_onCloudConfig", value: function(e2) { "0" === this.getCloudConfig("pull_on_invite") && (this._bPullOnInvite = false), M.l("".concat(this._n, "._onCloudConfig bPullOnInvite:").concat(this._bPullOnInvite)); } }, { key: "disableMsgPullOnInvite", value: function() { this._bPullOnInvite = false; } }, { key: "_isSyncCompleted", value: function() { return this._pagingStatus === Pn; } }, { key: "_errorLog", value: function(e2, t2, n2, o2) { var i2 = new Error("Params validate failed."), a2 = "".concat(this.getErrMsg("API_REFER")).concat(e2); throw M.w("[".concat(e2, "] | ").concat(t2, " | ").concat(this.getErrMsg(n2, o2), ", ").concat(a2)), M.e("[".concat(e2, "] Invalid ").concat(t2, ": type check failed for ").concat(t2, ".")), i2; } }, { key: "_isValidConvID", value: function(e2) { return Pt(e2) || Ut(e2) || bt(e2); } }, { key: "deleteConversation", value: function(e2) { var t2 = this, n2 = "deleteConversation"; return m(e2) || ut(e2) || this._errorLog(n2, "options", "StringOrObjectRequiredLog"), m(e2) ? (this._isValidConvID(e2) || this._errorLog(n2, "options", "InvalidConversationID", e2), M.l("".concat(this._n, ".").concat(n2, " convID:").concat(e2)), this.deleteConvList({ conversationIDList: [e2], flag: 1 })) : (O(e2.conversationIDList) || this._errorLog(n2, "conversationIDList", "ArrayRequiredLog"), 0 === e2.conversationIDList.length && this._errorLog(n2, "conversationIDList", "NonEmptyArrayLog"), e2.conversationIDList.forEach(function(e3) { t2._isValidConvID(e3) || t2._errorLog(n2, "conversationIDList", "InvalidConversationID", e3); }), "clearHistoryMessage" in e2 && "boolean" != typeof e2.clearHistoryMessage && this._errorLog(n2, "clearHistoryMessage", "BooleanRequiredLog"), 100 < e2.conversationIDList.length && (e2.conversationIDList = e2.conversationIDList.slice(0, 100)), this.deleteConvList(e2)); } }, { key: "deleteConvList", value: function(e2) { var t2 = e2.conversationIDList, t2 = void 0 === t2 ? [] : t2, n2 = e2.clearHistoryMessage, n2 = void 0 === n2 || n2, e2 = e2.flag, o2 = void 0 === e2 ? 0 : e2, i2 = "".concat(this._n, ".").concat("deleteConvList"), e2 = "convIDList:".concat(t2, " clearHistoryMessage:").concat(n2), a2 = (M.l("".concat(i2, " ").concat(e2)), new G("deleteConvList")); return a2.setMessage(e2), Promise.all([this.rmLocalOnlyConvList(t2), this.rmLocalAndRemoteConvList(t2, n2)]).then(function(e3) { a2.end(); e3 = [].concat(p(e3[0]), p(e3[1])); return 0 === e3.length ? D(new E({ code: L.CONV_NOT_FOUND })) : (M.l("".concat(i2, " ok")), T(1 === o2 ? { conversationID: e3[0] } : { conversationIDList: e3 })); }).catch(function(e3) { return a2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); }); } }, { key: "rmLocalOnlyConvList", value: function(e2) { var n2 = this; return e2.filter(function(e3) { var t2; return !!n2._convMap.has(e3) && ((t2 = n2.getLocalConversation(e3).type) !== A.CONV_GROUP || n2._hasLocalGroup(e3) ? t2 === A.CONV_SYSTEM && (n2.get(7).deleteGroupSystemNotice({ messageList: n2._msgListHandler.getLocalMsgList(e3) }), n2.deleteLocalConv(e3), true) : (n2.deleteLocalConv(e3), true)); }); } }, { key: "rmLocalAndRemoteConvList", value: function(e2, t2) { var n2 = this, o2 = { fromAccount: this.getMyUserID(), conversationList: [], clearHistoryMessage: t2 ? 1 : 0 }; return e2.forEach(function(e3) { var t3; n2._convMap.has(e3) && ((t3 = n2.getLocalConversation(e3).type) === A.CONV_C2C ? o2.conversationList.push({ toAccount: e3.replace(t3, ""), type: 1 }) : t3 === A.CONV_GROUP && n2._hasLocalGroup(e3) && o2.conversationList.push({ toGroupID: e3.replace(t3, ""), type: 2 })); }), 0 === o2.conversationList.length ? [] : this.req({ P: k.DEL_CONV, data: o2 }).then(function(e3) { var t3 = []; return 0 < e3.data.resultList.length && e3.data.resultList.map(function(e4) { 0 === e4.code && (e4 = 1 === e4.type ? "".concat(A.CONV_C2C).concat(e4.to) : "".concat(A.CONV_GROUP).concat(e4.groupID), t3.push(e4)); }), n2.deleteLocalConvList(t3), t3; }); } }, { key: "setConvDraft", value: function(e2) { var t2 = e2.conversationID, e2 = e2.draftText, n2 = "".concat(this._n, ".").concat("setConvDraft"); return M.l("".concat(n2, " convID:").concat(t2, " draftText:").concat(e2)), this._convMap.has(t2) ? ((n2 = this._convMap.get(t2)).setDraftText(e2), this.emitConvUpdate(), T({ code: 0, conversation: n2 })) : D({ code: L.CONV_NOT_FOUND }); } }, { key: "clearHistoryMessage", value: function(t2) { var n2 = this, e2 = { fromAccount: this.getMyUserID(), toAccount: void 0, type: void 0, toGroupID: void 0 }; if (!this._convMap.has(t2)) return D({ code: L.CONV_NOT_FOUND }); var o2 = this._convMap.get(t2).type; if (o2 === A.CONV_C2C) e2.type = 1, e2.toAccount = t2.replace(A.CONV_C2C, ""); else { if (o2 !== A.CONV_GROUP) return o2 === A.CONV_SYSTEM ? (this.get(7).deleteGroupSystemNotice({ messageList: this._msgListHandler.getLocalMsgList(t2) }), T({ conversationID: t2 })) : D({ code: L.CONV_UN_RECORDED_TYPE }); e2.type = 2, e2.toGroupID = t2.replace(A.CONV_GROUP, ""); } var i2 = "".concat(this._n, ".").concat("clearHistoryMessage"), a2 = new G("clearHistoryMessage"); return a2.setMessage("convID:".concat(t2)), M.l("".concat(i2, ". convID:").concat(t2)), this.setMessageRead({ conversationID: t2 }).then(function() { return n2.req({ P: k.CLEAR_HISTORY_MSG, data: e2 }); }).then(function() { a2.end(), M.l("".concat(i2, " ok")), n2.clearMemMsg(t2); var e3 = n2.getLocalConversation(t2); return e3 && (e3.updateLastMessage(), n2._sortConvListAndEmitEvent()), T({ conversationID: t2 }); }).catch(function(e3) { return a2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); }); } }, { key: "pinConversation", value: function(e2) { var t2, n2, o2, i2 = this, a2 = e2.conversationID, s2 = e2.isPinned, r2 = this.getLocalConversation(a2); return r2 && r2.isPinned === s2 ? T({ conversationID: a2 }) : bt(a2) ? (r2 && (r2.isPinned = s2), this._sortConvListAndEmitEvent(), T({ conversationID: a2 })) : (e2 = null, Pt(a2) ? e2 = { type: 1, toAccount: a2.replace(A.CONV_C2C, "") } : Ut(a2) && (e2 = { type: 2, groupID: a2.replace(A.CONV_GROUP, "") }), null === e2 ? D({ code: L.INVALID_CONV_ID }) : (t2 = "".concat(this._n, ".").concat("pinConversation"), n2 = "convID:".concat(a2, " isPinned:").concat(s2), (o2 = new G("pinConversation")).setMessage(n2), M.l("".concat(t2, ". ").concat(n2)), this.req({ P: k.PIN_CONV, data: { fromAccount: this.getMyUserID(), operationType: true === s2 ? 1 : 2, itemList: [e2] } }).then(function() { return o2.end(), M.l("".concat(t2, " ok")), r2 ? r2.isPinned !== s2 && (r2.isPinned = s2) : i2._convMap.set(a2, new ii({ conversationID: a2, type: Pt(a2) ? A.CONV_C2C : A.CONV_GROUP, isPinned: s2 }, i2.isIntl(), i2.isUsingChatCore())), i2._sortConvListAndEmitEvent(), C({ conversationID: a2 }); }).catch(function(e3) { return o2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); }))); } }, { key: "setMessageRemindType", value: function(e2) { return this._msgRemindHandler.set(e2); } }, { key: "patchMsgRemindType", value: function(e2) { var t2 = e2.ID, n2 = e2.isC2CConversation, o2 = e2.messageRemindType, i2 = false, n2 = this.getLocalConversation("".concat(n2 ? A.CONV_C2C : A.CONV_GROUP).concat(t2)); return n2 && n2.messageRemindType !== o2 && (n2.messageRemindType = o2, i2 = true), M.l("".concat(this._n, ".patchMsgRemindType options:"), e2, "ret:".concat(i2)), i2; } }, { key: "onC2CMsgRemindTypeFetched", value: function(e2) { var n2, o2 = this; O(e2) && 0 < e2.length && (n2 = 0, e2.forEach(function(e3) { var t2 = e3.userID, e3 = e3.muteFlag, e3 = o2._transMsgRemindType(e3); true === o2.patchMsgRemindType({ ID: t2, isC2CConversation: true, messageRemindType: e3 }) && (n2 += 1); }), M.l("".concat(this._n, ".onC2CMsgRemindTypeFetched updateCount:").concat(n2)), 1 <= n2) && this.emitConvUpdate(true, false); } }, { key: "onC2CMsgRemindTypeSynced", value: function(e2) { var n2 = this, o2 = "".concat(this._n, ".onC2CMsgRemindTypeSynced"); e2.dataList.forEach(function(e3) { var t2; S(e3.muteNotificationsSync) || (t2 = (e3 = e3.muteNotificationsSync).to, e3 = e3.muteFlag, e3 = n2._transMsgRemindType(e3), n2.patchMsgRemindType({ ID: t2, isC2CConversation: !(t2 = 0), messageRemindType: e3 }) && (t2 += 1), M.l("".concat(o2, " updateCount:").concat(t2)), 1 <= t2 && n2.emitConvUpdate(true, false)); }); } }, { key: "onGroupMsgRemindTypeUpdated", value: function(e2) { this._msgRemindHandler.onGroupMsgRemindTypeUpdated(e2); } }, { key: "deleteLocalConv", value: function(e2) { var t2 = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1], n2 = this._convMap.has(e2); M.l("".concat(this._n, ".deleteLocalConv convID:").concat(e2, " has:").concat(n2)), n2 && (this._convMap.delete(e2), this._convMapForDiff.delete(e2), this.clearMemMsg(e2), this._setStorageConvList(true), t2) && (n2 = !this._isTopicConv(e2), this.emitConvUpdate(n2, false)); } }, { key: "pullMsgOnInvite", value: function(e2) { var t2, n2, o2, i2, a2, s2 = this.get(7); s2 && (t2 = "".concat(this._n, ".pullMsgOnInvite"), M.l("".concat(t2, " flag:").concat(this._bPullOnInvite)), this._bPullOnInvite) && (a2 = this.getLocalLastMessage(e2), n2 = this.getLocalSecondLastMessage(e2), i2 = o2 = 1, a2 && (o2 = a2.sequence), n2 && (i2 = n2.sequence), a2 = s2.getGroupRemoteLastSeq(e2.replace(A.CONV_GROUP, "")), M.l("".concat(t2, " convID:").concat(e2, " localLastSeq:").concat(o2, " localSecondLastSeq:").concat(i2, " remoteLastSeq:").concat(a2)), this.clearMemMsg(e2), 1 < o2 - i2 ? this._recursiveGetMsgList([], e2, false, o2, i2) : 1 < a2 - o2 && this._recursiveGetMsgList([], e2, true, a2, o2)); } }, { key: "_recursiveGetMsgList", value: function(i2, a2, s2, r2, c2, e2) { var u2 = this; this.getMessageList({ conversationID: a2, nextReqMessageID: e2 }).then(function(e3) { var e3 = e3.data, t2 = e3.messageList, n2 = e3.isCompleted, e3 = e3.nextReqMessageID, o2 = t2.filter(function(e4) { return s2 ? e4.sequence > c2 && e4.sequence <= r2 : e4.sequence > c2 && e4.sequence < r2; }); i2.unshift.apply(i2, p(o2)), !n2 && 0 < t2.length && t2[0].sequence > c2 && i2.length < 60 ? u2._recursiveGetMsgList(i2, a2, s2, r2, c2, e3) : u2._emitMsgReceived(a2, i2); }); } }, { key: "_emitMsgReceived", value: function(e2, t2) { var n2, o2, i2 = this; 0 < t2.length && (t2 = t2.filter(function(t3, e3, n3) { return e3 === n3.findIndex(function(e4) { return e4.sequence === t3.sequence; }); }), n2 = this.hasLocalConversation(e2), o2 = t2.map(function(e3) { return e3.sequence; }), M.l("".concat(this._n, "._emitMsgReceived convID:").concat(e2, " has:").concat(n2, " count:").concat(o2.length, " sequenceList:"), o2), this.emitOEvt(h.MESSAGE_RECEIVED, t2), n2 ? this.patchConvLastMessage(e2, true) : this.getConversationProfile(e2).then(function() { i2.patchConvLastMessage(e2, true); })); } }, { key: "deleteLocalConvList", value: function(e2) { var t2 = this, n2 = false; e2.forEach(function(e3) { t2._convMap.has(e3) && (t2.deleteLocalConv(e3, false), n2 = true); }), M.l("".concat(this._n, ".deleteLocalConvList convID:").concat(e2, " isConvIDExisted:").concat(n2)), n2 && this.emitConvUpdate(true, false); } }, { key: "isMessageSentByCurrentInstance", value: function(e2) { return !(!this._msgListHandler.hasLocalMsg(e2.conversationID, e2.ID) && !this._sll.has(e2.random)); } }, { key: "modifyMessageList", value: function(e2) { var t2, n2; e2.startsWith(A.CONV_C2C) && this._convMap.has(e2) && (n2 = this._convMap.get(e2), t2 = Date.now(), this._msgListHandler.modifyMsgSentByPeer({ conversationID: e2, latestNick: n2.userProfile.nick, latestAvatar: n2.userProfile.avatar }), n2 = this.get(4).getNickAndAvatarByUserID(this.getMyUserID()), this._msgListHandler.modifyMsgSentByMe({ conversationID: e2, latestNick: n2.nick, latestAvatar: n2.avatar }), M.l("".concat(this._n, ".modifyMessageList convID:").concat(e2, " cost:").concat(nn(t2)))); } }, { key: "updateUserProfileSpecifiedKey", value: function(e2) { M.l("".concat(this._n, ".updateUserProfileSpecifiedKey options:"), e2); var t2 = e2.conversationID, n2 = e2.nick, e2 = e2.avatar; this._convMap.has(t2) && (t2 = this._convMap.get(t2).userProfile, m(n2) && t2.nick !== n2 && (t2.nick = n2), m(e2) && t2.avatar !== e2 && (t2.avatar = e2), this.emitConvUpdate(true, false)); } }, { key: "_onMyProfileModified", value: function(t2) { var n2 = this, e2 = this.getLocalConvList(), o2 = Date.now(); e2.forEach(function(e3) { n2.modifyMessageSentByMe(y({ conversationID: e3.conversationID }, t2)); }), M.l("".concat(this._n, "._onMyProfileModified. modify all messages sent by me, cost:").concat(nn(o2))); } }, { key: "modifyMessageSentByMe", value: function(e2) { this._msgListHandler.modifyMsgSentByMe(e2); } }, { key: "getLatestMessageSentByMe", value: function(e2) { return this._msgListHandler.getLatestMsgSentByMe(e2); } }, { key: "modifyMessageSentByPeer", value: function(e2) { this._msgListHandler.modifyMsgSentByPeer(e2); } }, { key: "getLatestMessageSentByPeer", value: function(e2) { return this._msgListHandler.getLatestMsgSentByPeer(e2); } }, { key: "pushIntoNoticeResult", value: function(e2, t2) { return !(!this._msgListHandler.pushIn(t2) || this._sll.has(t2.random) || (e2.push(t2), 0)); } }, { key: "getLocalLastMessage", value: function(e2) { return this._msgListHandler.getLocalLastMsg(e2); } }, { key: "getLocalSecondLastMessage", value: function(e2) { return this._msgListHandler.getLocalSecondLastMsg(e2); } }, { key: "checkAndPatchRemark", value: function() { var e2, n2, o2 = this.get(8); 0 !== this._convMap.size && o2 && 0 !== (e2 = p(this._convMap.values()).filter(function(e3) { return e3.type === A.CONV_C2C; })).length && (n2 = 0, e2.forEach(function(e3) { var t2 = e3.conversationID.replace(A.CONV_C2C, ""); o2.isMyFriend(t2) && (t2 = o2.getFriendRemark(t2), e3.remark !== t2) && (e3.remark = t2, n2 += 1); }), M.l("".concat(this._n, ".checkAndPatchRemark. c2cConvCount:").concat(e2.length, " patchedCount:").concat(n2)), 0 < n2) && this.emitConvUpdate(true, false); } }, { key: "updateTopicConversation", value: function(e2) { this._updateLocalConvList({ conversationOptionsList: e2, isFromGetConversations: true, updateUnreadCount: true }); } }, { key: "sendReadReceipt", value: function(e2) { var t2 = e2[0], n2 = null; return t2.conversationType === A.CONV_C2C ? n2 = this._m.get(6) : t2.conversationType === A.CONV_GROUP && (n2 = this._m.get(7)), n2 ? n2.sendReadReceipt(e2) : D({ code: L.NO_MODULE }); } }, { key: "getReadReceiptList", value: function(e2) { var t2 = e2[0], n2 = null; return t2.conversationType === A.CONV_C2C ? n2 = this._m.get(6) : t2.conversationType === A.CONV_GROUP && (n2 = this._m.get(7)), n2 ? n2.getReadReceiptList(e2) : D({ code: L.NO_MODULE }); } }, { key: "getLastMessageTime", value: function(e2) { e2 = this.getLocalConversation(e2); return e2 ? e2.lastMessage.lastTime : 0; } }, { key: "getTotalUnreadCount", value: function() { var e2 = this.getLocalConvList(), t2 = 0; return e2.forEach(function(e3) { e3.type === A.CONV_SYSTEM || "" !== e3.messageRemindType && e3.messageRemindType !== A.MSG_REMIND_ACPT_AND_NOTE || (t2 += e3.unreadCount); }), t2; } }, { key: "onTotalUnreadCountUpdate", value: function() { var e2 = this.getTotalUnreadCount(); this._convTotalUnreadCount !== e2 && (M.l("".concat(this._n, ".onTotalUnreadCountUpdate from ").concat(this._convTotalUnreadCount, " to ").concat(e2)), this._convTotalUnreadCount = e2, this.emitOEvt(h.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)); } }, { key: "_isConvNeedShow", value: function(e2) { var t2, n2, e2 = this.getLocalConversation(e2); return !(!N(e2) && (t2 = e2.type === A.CONV_TOPIC, n2 = e2.type === A.CONV_GROUP && e2.groupProfile.type === A.GRP_ROOM, e2 = e2.type === A.CONV_GROUP && e2.groupProfile.type === A.GRP_LIVE, t2 || n2 || e2)); } }, { key: "setAllRcvMsgOpt", value: function(e2) { return this._msgRemindHandler.setAllRcvMsgOpt(e2); } }, { key: "getAllRcvMsgOpt", value: function() { return this._msgRemindHandler.getAllRcvMsgOpt(); } }, { key: "onAllRcvMsgOptNotify", value: function(e2) { this._msgRemindHandler.onAllRcvMsgOptNotify(e2); } }, { key: "clearUnreadCount", value: function(e2) { e2 = this.getLocalConversation(e2); e2 && 0 < e2.unreadCount && (e2.unreadCount = 0, this.emitConvUpdate(true, false)); } }, { key: "storeHoppingMessageList", value: function(e2) { this._msgListHandler.storeHoppingMsgList(e2); } }, { key: "clearMemMsg", value: function(e2) { var t2 = 1 < arguments.length && void 0 !== arguments[1] && arguments[1]; M.l("".concat(this._n, ".clearMemMsg convID:").concat(e2, " isOverLimit:").concat(t2)), this._msgListHandler.removeByConvID(e2), this._completedMap.delete(e2), this._roamingMsgKeyAndTimeMap.delete(e2), this._everClearedMap.set(e2, 1); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._setStorageConvList(true), this._pagingStatus = Nn, this._msgListHandler.reset(), this._msgRemindHandler.reset(), this._roamingMsgKeyAndTimeMap.clear(), this._sll.reset(), this._peerReadTimeMap.clear(), this._completedMap.clear(), this._convMap.clear(), this._pagingTs = 0, this._pagingStartIdx = 0, this._pagingPinnedTs = 0, this._pagingPinnedStartIdx = 0, this._remoteGroupReadSeqMap.clear(), this._convTotalUnreadCount = 0, this._pagingGetCostList.length = 0, this._pagingConvIDMap.clear(), this._convIDFromUnreadDBMap.clear(), this._pagingGetCostList.length = 0, this._convMapForDiff.clear(), this._partialUpdatedConvMap.clear(), this._everClearedMap.clear(), this._bPullOnInvite = true, this._convGroupHandler.reset(), this.resetReady(); } }]), Zi), ui = (e(Xi, [{ key: "onCheckTimer", value: function(e2) { e2 % 1 == 0 && 0 < this._cachedGroupTipsMap.size && this._check(); } }, { key: "_check", value: function() { var i2 = this; this._cachedGroupTipsMap.forEach(function(e2, t2) { var n2 = i2._checkCountMap.get(t2), o2 = i2._grpM.hasLocalGroup(t2); M.l("".concat(i2._n, "._check groupID:").concat(t2, " hasLocalGroup:").concat(o2, " checkCount:").concat(n2)), o2 ? (i2._notifyCachedGroupTips(t2), i2._checkCountMap.delete(t2), i2._grpM.deleteUnjoinedAVChatRoom(t2)) : n2 >= i2.MAX_CHECK_COUNT ? (i2._deleteCachedGroupTips(t2), i2._checkCountMap.delete(t2)) : i2._checkCountMap.set(t2, ++n2); }); } }, { key: "onNewGroupTips", value: function(e2) { M.l("".concat(this._n, ".onNewGroupTips options:").concat(JSON.stringify(e2.dataList))); var e2 = this._assembly(e2), t2 = e2.eventDataList, n2 = e2.result, e2 = e2.AVChatRoomMessageList; 0 < e2.length && this._grpM.onAVChatRoomMessage(e2), 0 < n2.length && (this._grpM.emitOEvt(h.MESSAGE_RECEIVED, n2), this._handleTips(n2)), 0 < t2.length && (this._grpM.updateNextMessageSeq(t2), this._grpM.get(11).onNewMessage({ conversationOptionsList: t2, isInstantMessage: true })); } }, { key: "_assembly", value: function(e2) { for (var t2 = e2.event, n2 = e2.dataList, o2 = null, i2 = [], a2 = [], s2 = {}, r2 = [], c2 = 0, u2 = n2.length; c2 < u2; c2++) { var l2 = Mt(n2[c2]); if (6 === t2) { if (this._grpM.isGroupAttributesUpdatedNotice(l2)) continue; if (this._grpM.isGroupCountersNotice(l2)) continue; } var d2 = l2.groupProfile, p2 = d2.groupID, _2 = d2.communityType, _2 = void 0 === _2 ? 0 : _2, h2 = d2.topicID, h2 = void 0 === h2 ? void 0 : h2, g2 = d2.invisible, d2 = d2.groupType, d2 = void 0 === d2 ? void 0 : d2, f2 = void 0, m2 = this._grpM.isMessageFromTopic(_2, h2), v2 = (m2 && (f2 = A.CONV_TOPIC, l2.to = h2), this._grpM.hasLocalGroup(p2)); if (v2 || !this._grpM.isUnjoinedAVChatRoom(p2)) if (v2 || m2) if (this._grpM.isMessageFromOrToAVChatroom(p2)) l2.event = t2, r2.push(l2); else if (l2.currentUser = this._grpM.getMyUserID(), l2.conversationType = A.CONV_GROUP, (o2 = new Do(l2)).setElement({ type: A.MSG_GRP_TIP, content: y(y({}, l2.elements), {}, { groupProfile: l2.groupProfile }) }), o2.isSystemMessage = false, 1 !== g2) { var v2 = this._grpM.get(11), m2 = o2, g2 = m2.conversationID, m2 = m2.sequence; if (6 === t2) o2._onlineOnlyFlag = true, a2.push(o2); else if (!v2.pushIntoNoticeResult(a2, o2)) continue; this._grpM.isMessageFromCommunityOfTopic(_2, h2) || 6 === t2 && v2.getLocalConversation(g2) || (6 !== t2 && this._qualityStat(o2), _2 = v2.isRemoteRead({ conversationID: g2, sequence: m2 }), N(s2[g2]) ? (h2 = 0, "in" !== o2.flow || o2._isExcludedFromUnreadCount || o2._onlineOnlyFlag || _2 || (h2 = 1), s2[g2] = i2.push({ conversationID: g2, unreadCount: h2, type: N(f2) ? o2.conversationType : f2, subType: o2.conversationSubType, lastMessage: o2._isExcludedFromLastMessage ? "" : o2 }) - 1) : (i2[v2 = s2[g2]].type = o2.conversationType, i2[v2].subType = o2.conversationSubType, i2[v2].lastMessage = o2._isExcludedFromLastMessage ? "" : o2, "in" !== o2.flow || o2._isExcludedFromUnreadCount || o2._onlineOnlyFlag || _2 || i2[v2].unreadCount++)); } else this._qualityStat(o2); else this._cacheAndCompare({ groupID: p2, event: t2, item: l2, groupType: d2 }); } return { eventDataList: i2, result: a2, AVChatRoomMessageList: r2 }; } }, { key: "_qualityStat", value: function(e2) { this._grpM.get(26).addMessageSequence({ key: jn, message: e2 }); } }, { key: "_handleTips", value: function(e2) { var t2 = this; e2.forEach(function(e3) { switch (e3.payload.operationType) { case 1: t2._onNewMemberComeIn(e3); break; case 2: t2._onMemberQuit(e3); break; case 3: t2._onMemberKickedOut(e3); break; case 4: t2._onMemberSetAdmin(e3); break; case 5: t2._onMemberCancelledAdmin(e3); break; case 6: t2._onGroupProfileModified(e3); break; case 7: t2._onMemberInfoModified(e3); break; case 8: t2._onTopicProfileUpdated(e3); break; default: M.w("".concat(t2._n, "._handleTips unknown operationType:").concat(e3.payload.operationType)); } }); } }, { key: "_onNewMemberComeIn", value: function(e2) { var e2 = e2.payload, t2 = e2.memberNum, e2 = e2.groupProfile.groupID, e2 = this._grpM.getLocalGroupProfile(e2); e2 && R(t2) && e2.memberCount !== t2 && (e2.memberCount = t2, this._updateConvGroupProfile(e2)); } }, { key: "_onMemberQuit", value: function(e2) { var t2 = e2.payload, n2 = t2.memberNum, t2 = t2.groupProfile.groupID, o2 = this._grpM.getLocalGroupProfile(t2); o2 && R(n2) && o2.memberCount !== n2 && (o2.memberCount = n2, this._updateConvGroupProfile(o2)), this._grpM.getGroupMemberHandler().deleteLocalGroupMembers(t2, e2.payload.userIDList); } }, { key: "_onMemberKickedOut", value: function(e2) { var t2 = e2.payload, n2 = t2.memberNum, t2 = t2.groupProfile.groupID, o2 = this._grpM.getLocalGroupProfile(t2); o2 && R(n2) && o2.memberCount !== n2 && (o2.memberCount = n2, this._updateConvGroupProfile(o2)), this._grpM.getGroupMemberHandler().deleteLocalGroupMembers(t2, e2.payload.userIDList); } }, { key: "_updateConvGroupProfile", value: function(e2) { this._grpM.get(11).updateConvGroupProfile([e2]); } }, { key: "_onMemberSetAdmin", value: function(e2) { var t2 = e2.payload.groupProfile.groupID, e2 = e2.payload.userIDList, n2 = this._grpM.getGroupMemberHandler(); e2.forEach(function(e3) { e3 = n2.getLocalGroupMemberInfo(t2, e3); e3 && e3.updateRole(A.GRP_MBR_ROLE_ADMIN); }); } }, { key: "_onMemberCancelledAdmin", value: function(e2) { var t2 = e2.payload.groupProfile.groupID, e2 = e2.payload.userIDList, n2 = this._grpM.getGroupMemberHandler(); e2.forEach(function(e3) { e3 = n2.getLocalGroupMemberInfo(t2, e3); e3 && e3.updateRole(A.GRP_MBR_ROLE_MEMBER); }); } }, { key: "_onGroupProfileModified", value: function(e2) { var t2 = this, e2 = e2.payload, n2 = e2.newGroupProfile, o2 = e2.groupProfile, i2 = e2.operatorInfo, e2 = o2.groupID, a2 = this._grpM.getLocalGroupProfile(e2), o2 = (Object.keys(n2).forEach(function(e3) { switch (e3) { case "ownerID": t2._ownerChanged(a2, n2); break; case "groupName": a2.name = n2[e3]; break; default: a2[e3] = n2[e3]; } }), N(i2) || Object.keys(i2).forEach(function(e3) { "nameCard" === e3 ? a2.updateSelfInfo({ nameCard: i2[e3] }) : "role" === e3 && a2.updateSelfInfo({ role: i2[e3] }); }), !a2.isSupportTopic); this._grpM.emitGroupListUpdate(true, o2); } }, { key: "_ownerChanged", value: function(e2, t2) { var e2 = e2.groupID, n2 = this._grpM.getLocalGroupProfile(e2), o2 = this._grpM.getMyUserID(); o2 === t2.ownerID && (n2.updateGroup({ selfInfo: { role: A.GRP_MBR_ROLE_OWNER } }), n2 = (t2 = this._grpM.getGroupMemberHandler()).getLocalGroupMemberInfo(e2, o2), o2 = this._grpM.getLocalGroupProfile(e2).ownerID, t2 = t2.getLocalGroupMemberInfo(e2, o2), n2 && n2.updateRole(A.GRP_MBR_ROLE_OWNER), t2) && t2.updateRole(A.GRP_MBR_ROLE_MEMBER); } }, { key: "_onMemberInfoModified", value: function(e2) { var t2 = e2.to, n2 = e2.payload, o2 = n2.groupProfile, n2 = n2.memberList, i2 = o2.groupID, a2 = (Gt(t2) && this._updateTopicMuteTime(e2), this._grpM.getGroupMemberHandler()); n2.forEach(function(e3) { var t3 = a2.getLocalGroupMemberInfo(i2, e3.userID); t3 && R(e3.muteTime) && t3.updateMuteUntil(e3.muteTime); }); } }, { key: "_updateTopicMuteTime", value: function(e2) { var t2 = e2.to, e2 = e2.payload, n2 = e2.groupProfile, e2 = e2.memberList, o2 = void 0 === e2 ? [] : e2, e2 = this._grpM.get(10), n2 = n2.groupID, i2 = e2.getLocalTopic(n2, t2); if (i2) { for (var a2 = false, s2 = 0; s2 < o2.length; s2++) { var r2 = o2[s2]; if (r2.userID === this._grpM.getMyUserID() && 0 <= r2.muteTime) { i2.updateSelfInfo({ muteTime: r2.muteTime }), a2 = true; break; } } a2 && this._grpM.emitOEvt(h.TOPIC_UPDATED, { groupID: n2, topic: i2 }); } } }, { key: "_onTopicProfileUpdated", value: function(e2) { var t2 = e2.payload, n2 = t2.groupProfile.groupID, t2 = t2.newTopicInfo; this._grpM.get(10).onTopicProfileUpdated(y({ groupID: n2, topicID: e2.to }, t2)); } }, { key: "_cacheGroupTips", value: function(e2, t2) { this._cachedGroupTipsMap.has(e2) || this._cachedGroupTipsMap.set(e2, []), this._cachedGroupTipsMap.get(e2).push(t2); } }, { key: "_deleteCachedGroupTips", value: function(e2) { this._cachedGroupTipsMap.has(e2) && this._cachedGroupTipsMap.delete(e2); } }, { key: "_notifyCachedGroupTips", value: function(e2, t2) { var n2 = this, o2 = this._cachedGroupTipsMap.get(e2) || []; M.l("".concat(this._n, "._notifyCachedGroupTips groupID:").concat(e2, " groupType:").concat(t2, " count:").concat(o2.length)), o2.forEach(function(e3) { n2.onNewGroupTips(e3); }), this._deleteCachedGroupTips(e2); } }, { key: "_cacheAndCompare", value: function(e2) { var t2 = e2.groupID, n2 = e2.event, o2 = e2.item, e2 = e2.groupType, n2 = (M.l("".concat(this._n, "._cacheAndCompare groupID:").concat(t2, " groupType:").concat(e2)), this._cacheGroupTips(t2, { event: n2, dataList: [o2] }), { groupID: t2, type: e2 }); e2 === A.GRP_AVCHATROOM ? this._grpM.hasLocalGroup(t2) ? this._notifyCachedGroupTips(t2, e2) : this._grpM.setUnjoinedAVChatRoom(t2) : (this._grpM.updateGroupMap([n2]), this._notifyCachedGroupTips(t2, e2)), this._checkCountMap.has(t2) || this._checkCountMap.set(t2, 0); } }, { key: "reset", value: function() { this._cachedGroupTipsMap.clear(), this._checkCountMap.clear(); } }]), Xi), li = (e(zi, [{ key: "onCheckTimer", value: function(e2) { e2 % 1 == 0 && 0 < this._cachedGroupMessageMap.size && this._check(); } }, { key: "_check", value: function() { var i2 = this; this._cachedGroupMessageMap.forEach(function(e2, t2) { var n2 = i2._checkCountMap.get(t2), o2 = i2._grpM.hasLocalGroup(t2); M.l("".concat(i2._n, "._check groupID:").concat(t2, " hasLocalGroup:").concat(o2, " checkCount:").concat(n2)), o2 ? (i2._notifyCachedGroupMessage(t2), i2._checkCountMap.delete(t2), i2._grpM.deleteUnjoinedAVChatRoom(t2)) : n2 >= i2.MAX_CHECK_COUNT ? (i2._deleteCachedGroupMessage(t2), i2._checkCountMap.delete(t2)) : i2._checkCountMap.set(t2, ++n2); }); } }, { key: "updateLastMsg", value: function(e2) { var t2 = "".concat(this._n, ".updateLastMsg"); if (0 !== this._grpM.getGroupMap().size) { for (var n2, o2, i2, a2, s2 = false, r2 = e2.length, c2 = 0; c2 < r2; c2++) (n2 = e2[c2]).type === A.CONV_GROUP && 0 !== n2.lastMessage.lastSequence && null !== n2.lastMessage.payload && (o2 = n2.conversationID.split(/^GROUP/)[1], o2 = this._grpM.getLocalGroupProfile(o2)) && (i2 = o2.lastMessage, a2 = n2.lastMessage, JSON.stringify(i2) !== JSON.stringify(a2)) && (o2.lastMessage = y({}, n2.lastMessage), s2 = true); M.l("".concat(t2, " convCount:").concat(r2, " groupCount:").concat(this._grpM.getLocalGroupList().length, " isUpdated:").concat(s2)), s2 && (this._grpM.sortLocalGroupList(), this._grpM.emitGroupListUpdate(true, false)); } else this.tempConversationList = e2; } }, { key: "onNewMessage", value: function(e2) { var t2 = this._assembly(e2), n2 = t2.conversationOptionsList, o2 = t2.messageList, t2 = t2.AVChatRoomMessageList, t2 = (0 < t2.length && this._grpM.onAVChatRoomMessage(t2), At(o2)), t2 = (0 < t2.length && this._grpM.emitOEvt(h.MESSAGE_MODIFIED, t2), 0 < n2.length && (this._grpM.get(11).onNewMessage({ conversationOptionsList: n2, isInstantMessage: false !== e2.isInstantMessage, updateUnreadCount: false !== e2.updateUnreadCount }), this._grpM.updateNextMessageSeq(n2)), Rt(o2)); 0 < t2.length && this._grpM.emitOEvt(h.MESSAGE_RECEIVED, t2), o2.length = 0; } }, { key: "_assembly", value: function(e2) { var t2 = e2.dataList, n2 = e2.event, o2 = e2.isInstantMessage, i2 = null, a2 = [], s2 = [], r2 = [], c2 = {}, u2 = this._grpM.getFileDownloadProxy(), l2 = this._grpM.getDowloadFileAuthKey(), d2 = this._grpM.get(17).getFileDNList(), p2 = t2.length; 1 < p2 && t2.sort(function(e3, t3) { return e3.sequence - t3.sequence; }); for (var _2 = this._grpM.get(11), h2 = this._grpM.get(4), g2 = 0; g2 < p2; g2++) { var f2, m2 = Mt(t2[g2]), v2 = m2.groupProfile, I2 = v2.groupID, M2 = v2.communityType, M2 = void 0 === M2 ? 0 : M2, y2 = v2.topicID, y2 = void 0 === y2 ? void 0 : y2, C2 = v2.invisible, v2 = v2.groupType, v2 = void 0 === v2 ? void 0 : v2, T2 = void 0, D2 = this._grpM.isMessageFromTopic(M2, y2), E2 = (D2 && (T2 = A.CONV_TOPIC, m2.to = y2), this._grpM.hasLocalGroup(I2)); !E2 && this._grpM.isUnjoinedAVChatRoom(I2) || (E2 || D2 ? this._grpM.isMessageFromOrToAVChatroom(I2) ? (m2.event = n2, r2.push(m2)) : (m2.currentUser = this._grpM.getMyUserID(), m2.conversationType = A.CONV_GROUP, m2.isSystemMessage = !!m2.isSystemMessage, (i2 = new Do(m2)).setElement(m2.elements, u2, l2, d2), 1 !== C2 ? (E2 = 1 === t2[g2].isModified, _2.isMessageSentByCurrentInstance(i2) ? i2.isModified = E2 : E2 = false, 1 === m2.onlineOnlyFlag ? (i2._onlineOnlyFlag = true, _2.isMessageSentByCurrentInstance(i2) || s2.push(i2)) : this._grpM.isMessageFromCommunityOfTopic(M2, y2) ? s2.push(i2) : (i2.from === this._grpM.getMyUserID() && (D2 = _2.getLatestMessageSentByMe(i2.conversationID)) && (C2 = D2.nick, M2 = D2.avatar, C2 === i2.nick && M2 === i2.avatar || (_2.modifyMessageSentByMe({ conversationID: f2, latestNick: i2.nick, latestAvatar: i2.avatar }), h2.mockOnNickAvatarModified(i2.nick, i2.avatar))), _2.pushIntoMessageList(s2, i2, E2) && (this._qualityStat(o2, i2), f2 = (y2 = i2).conversationID, D2 = y2.sequence, C2 = _2.isRemoteRead({ conversationID: f2, sequence: D2 }), N(c2[f2]) ? (M2 = 0, "in" !== i2.flow || i2._isExcludedFromUnreadCount || C2 || (M2 = 1), c2[f2] = a2.push({ conversationID: f2, unreadCount: M2, type: N(T2) ? i2.conversationType : T2, subType: i2.conversationSubType, lastMessage: i2._isExcludedFromLastMessage ? "" : i2 }) - 1) : (a2[E2 = c2[f2]].type = N(T2) ? i2.conversationType : T2, a2[E2].subType = i2.conversationSubType, a2[E2].lastMessage = i2._isExcludedFromLastMessage ? "" : i2, "in" !== i2.flow || i2._isExcludedFromUnreadCount || C2 || a2[E2].unreadCount++)))) : this._qualityStat(o2, i2)) : this._cacheAndCompare({ groupID: I2, event: n2, item: m2, groupType: v2 })); } return { conversationOptionsList: a2, messageList: s2, AVChatRoomMessageList: r2 }; } }, { key: "_qualityStat", value: function(e2, t2) { var n2 = this._grpM.get(26); n2.addMessageSequence({ key: jn, message: t2 }), e2 && 0 < t2.clientTime && n2.addMessageDelay(t2.clientTime); } }, { key: "onMsgRevoked", value: function(e2, t2) { var n2 = this, u2 = this._grpM.get(11), l2 = [], d2 = []; e2.dataList.forEach(function(e3) { var t3 = e3.elements.revokedInfos, s2 = e3.revokerInfo, r2 = e3.groupProfile, c2 = false; r2 && (c2 = Nt({ groupID: r2.groupID }) || !S(r2.topicID)), N(t3) || t3.forEach(function(e4) { var t4, n3 = S(e4.topicID) ? "GROUP".concat(e4.groupID) : "GROUP".concat(e4.topicID), o2 = u2.getLocalConversation(n3), i2 = e4.revokerInfo && e4.revokerInfo.revoker || s2 && s2.revoker, a2 = s2 && s2.reason || ""; o2 && Ot(o2.type) ? t4 = { conversationID: n3, sequence: e4.sequence, ID: "".concat(e4.tinyID, "-").concat(e4.clientTime, "-").concat(e4.random) } : (o2 = u2.revoke(n3, e4.sequence, e4.random)) ? t4 = o2 : (t4 = { conversationID: n3, sequence: e4.sequence }, e4.tinyID && e4.clientTime && e4.random && (t4.ID = "".concat(e4.tinyID, "-").concat(e4.clientTime, "-").concat(e4.random)), e4.time && (t4.time = e4.time)), t4 && (t4.revoker = i2, t4.revokeReason = a2, t4.revokerInfo = { userID: i2, nick: "", avatar: "" }, (c2 ? (t4.revokerInfo.nick = r2.nick, t4.revokerInfo.avatar = r2.avatar, l2) : d2).push(t4)); }); }), 0 === d2.length && 0 === l2.length || (u2.onMessageRevoked([].concat(l2, d2), t2), 0 < l2.length && this._grpM.emitOEvt(h.MESSAGE_REVOKED, l2), 0 < d2.length && u2.updateRevokerInfo(d2).then(function(e3) { n2._grpM.emitOEvt(h.MESSAGE_REVOKED, e3); })); } }, { key: "_groupListTreeShaking", value: function(e2) { for (var n2 = new Map(p(this._grpM.getGroupMap())), t2 = 0, o2 = e2.length; t2 < o2; t2++) n2.delete(e2[t2].groupID); this._grpM.hasJoinedAVChatRoom() && this._grpM.getJoinedAVChatRoom().forEach(function(e3) { n2.delete(e3); }), this._grpM.getGroupMap().forEach(function(e3, t3) { e3.isSupportTopic && n2.delete(t3); }); for (var i2 = p(n2.keys()), a2 = 0, s2 = i2.length; a2 < s2; a2++) this._grpM.deleteGroup(i2[a2]); } }, { key: "syncGroupList", value: function() { var o2, i2, a2 = this, e2 = 0 < arguments.length && void 0 !== arguments[0] && arguments[0], t2 = (this._pagingStatus === Nn && this._grpM.clearGroupMap(), p(ce)), n2 = this.PAGING_GRP_COUNT_LIMIT, s2 = []; return true === e2 ? this._pagingGetGroupListWithTopic({ limit: n2, offset: 0, groupBaseInfoFilter: t2, groupList: s2 }) : (e2 = "syncGroupList", o2 = "".concat(this._n, ".").concat(e2), i2 = new G(e2), this._pagingGetGroupList({ limit: n2, offset: 0, groupBaseInfoFilter: t2, groupList: s2 }).then(function() { var e3 = tn(a2._pagingGetCostList), t3 = en(a2._pagingGetCostList), n3 = (a2._pagingGetCostList.length = 0, a2._pagingStatus = Pn, a2._groupListTreeShaking(s2), a2._grpM.updateGroupMap(s2), a2._grpM.getLocalGroupList().length), n3 = "count:".concat(n3, " sum:").concat(t3, " avg:").concat(e3); return M.l("".concat(o2, " ok. ").concat(n3)), i2.setMessage(n3).end(), a2.tempConversationList && (a2.updateLastMsg(a2.tempConversationList), a2.tempConversationList = null), a2._grpM.emitGroupListUpdate(true, true), C({ groupList: a2._grpM.getLocalGroupList() }); }).catch(function(e3) { return a2._pagingStatus = Un, i2.setError(e3).end(), M.e("".concat(o2, " failed. error:"), e3), D(e3); })); } }, { key: "getGroupList", value: function() { var e2, t2 = this, n2 = "".concat(this._n, ".").concat("getGroupList"); return M.l("".concat(n2, " pagingStatus:").concat(this._pagingStatus)), this._pagingStatus === Un || this._pagingStatus === Nn ? this.syncGroupList().then(function() { var e3 = t2._grpM.getLocalGroupList(); return C({ groupList: e3, isSyncCompleted: t2.isPagingGetCompleted() }); }).catch(function(e3) { return M.e("".concat(n2, " failed. error:"), e3), D(e3); }) : (e2 = this._grpM.getLocalGroupList(), M.l("".concat(n2, ". returned group count:").concat(e2.length)), T({ groupList: e2, isSyncCompleted: this.isPagingGetCompleted() })); } }, { key: "isPagingGetCompleted", value: function() { return this._pagingStatus === Pn; } }, { key: "_pagingGetGroupList", value: function(e2) { var o2 = this, i2 = "".concat(this._n, ".").concat("_pagingGetGroupList"), t2 = e2.isCommunityRelay, a2 = void 0 !== t2 && t2, s2 = e2.limit, r2 = e2.offset, c2 = e2.groupBaseInfoFilter, u2 = e2.groupList, l2 = Date.now(); return this._grpM.req({ P: k.GET_GRP_LIST, data: { type: a2 ? A.GRP_COMMUNITY : void 0, memberAccount: this._grpM.getMyUserID(), limit: s2, offset: r2, responseFilter: { groupBaseInfoFilter: c2, selfInfoFilter: ["Role", "JoinTime", "MsgFlag", "MsgSeq"] } } }).then(function(e3) { var e3 = e3.data, t3 = e3.groups, t3 = void 0 === t3 ? [] : t3, e3 = e3.totalCount, t3 = (u2.push.apply(u2, p(t3)), o2._handleGroupAtInfoWithoutTopic(a2, t3), r2 + s2), n2 = !(t3 < e3), e3 = "offset:".concat(r2, " limit:").concat(s2, " total:").concat(e3, " isCompleted:").concat(n2, " ") + "current:".concat(u2.length, " isCommunityRelay:").concat(a2); return o2._pagingGetCostList.push(nn(l2, false)), M.l("".concat(i2, " ok. ").concat(e3, " cost:").concat(nn(l2))), a2 || n2 ? !a2 && n2 ? (M.l("".concat(i2, " start to get community list")), r2 = 0, o2._pagingGetGroupList({ limit: s2, offset: r2, groupBaseInfoFilter: c2, groupList: u2, isCommunityRelay: true })) : a2 && !n2 ? (r2 = t3, o2._pagingGetGroupList({ limit: s2, offset: r2, groupBaseInfoFilter: c2, groupList: u2, isCommunityRelay: true })) : C({ groupList: u2 }) : (r2 = t3, o2._pagingGetGroupList({ limit: s2, offset: r2, groupBaseInfoFilter: c2, groupList: u2 })); }).catch(function(e3) { return 10018 === e3.code ? (M.w("".concat(o2.logPrefix, " response size exceeds the limit, request count:").concat(s2)), s2 = 50, o2._pagingGetGroupList({ limit: s2, offset: r2, groupBaseInfoFilter: c2, groupList: u2, isCommunityRelay: a2 })) : a2 ? (11e3 === e3.code && M.l("".concat(i2, " ok. community unavailable")), T({ groupList: u2 })) : D(e3); }); } }, { key: "_pagingGetGroupListWithTopic", value: function(e2) { var o2 = this, i2 = "".concat(this._n, "._pagingGetGroupListWithTopic"), a2 = e2.limit, s2 = e2.offset, r2 = e2.groupBaseInfoFilter, c2 = e2.groupList, u2 = Date.now(); return this._grpM.req({ P: k.GET_GRP_LIST, data: { type: A.GRP_COMMUNITY, memberAccount: this._grpM.getMyUserID(), limit: a2, offset: s2, responseFilter: { groupBaseInfoFilter: r2, selfInfoFilter: p(ue) }, isSupportTopic: 1, needAppDefineData: 1 } }).then(function(e3) { var e3 = e3.data, t2 = e3.groups, e3 = e3.totalCount, t2 = (c2.push.apply(c2, p(void 0 === t2 ? [] : t2)), s2 + a2), n2 = !(t2 < e3); if (M.l("".concat(i2, " ok. offset:").concat(s2, " limit:").concat(a2, " totalCount:").concat(e3, " isCompleted:").concat(n2, " currentCount:").concat(c2.length, " cost:").concat(nn(u2))), !n2) return s2 = t2, o2._pagingGetGroupListWithTopic({ limit: a2, offset: s2, groupBaseInfoFilter: r2, groupList: c2 }); o2._grpM.updateGroupMap(c2), o2._grpM.emitGroupListUpdate(true, false); e3 = o2._grpM.getLocalGroupList().filter(function(e4) { return true === e4.isSupportTopic; }); return C({ groupList: e3 }); }).catch(function(e3) { return 10018 === e3.code ? (M.w("".concat(o2.logPrefix, " response size exceeds the limit, request count:").concat(a2)), a2 = 50, o2._pagingGetGroupListWithTopic({ limit: a2, offset: s2, groupBaseInfoFilter: r2, groupList: c2 })) : D(e3); }); } }, { key: "_cacheGroupMessage", value: function(e2, t2) { this._cachedGroupMessageMap.has(e2) || this._cachedGroupMessageMap.set(e2, []), this._cachedGroupMessageMap.get(e2).push(t2); } }, { key: "_deleteCachedGroupMessage", value: function(e2) { this._cachedGroupMessageMap.has(e2) && this._cachedGroupMessageMap.delete(e2); } }, { key: "_notifyCachedGroupMessage", value: function(e2, t2) { var n2 = this, o2 = this._cachedGroupMessageMap.get(e2) || []; M.l("".concat(this._n, "._notifyCachedGroupMessage groupID:").concat(e2, " groupType:").concat(t2, " count:").concat(o2.length)), o2.forEach(function(e3) { n2.onNewMessage(e3); }), this._deleteCachedGroupMessage(e2); } }, { key: "_cacheAndCompare", value: function(e2) { var t2 = e2.groupID, n2 = e2.event, o2 = e2.item, e2 = e2.groupType, n2 = (M.l("".concat(this._n, "._cacheAndCompare groupID:").concat(t2, " groupType:").concat(e2)), this._cacheGroupMessage(t2, { event: n2, dataList: [o2] }), { groupID: t2, type: e2 }); e2 === A.GRP_AVCHATROOM ? this._grpM.hasLocalGroup(t2) ? this._notifyCachedGroupMessage(t2, e2) : this._grpM.setUnjoinedAVChatRoom(t2) : (this._grpM.updateGroupMap([n2]), this._notifyCachedGroupMessage(t2, e2)), this._checkCountMap.has(t2) || this._checkCountMap.set(t2, 0); } }, { key: "_handleGroupAtInfoWithoutTopic", value: function(e2, t2) { var o2 = this; e2 && 0 !== t2.length && t2.forEach(function(e3) { var t3 = e3.groupID, e3 = e3.groupAtInfoList, n2 = []; N(e3) || (e3.forEach(function(e4) { n2.push(y(y({}, e4), {}, { groupID: t3 })); }), o2._grpM.get(11).onNewGroupAtTips({ dataList: n2 })); }); } }, { key: "setPagingGroupCount", value: function(e2) { N(e2) || (this.PAGING_GRP_COUNT_LIMIT = parseInt(e2, 10)); } }, { key: "reset", value: function() { this.PAGING_GRP_COUNT_LIMIT = 200, this._cachedGroupMessageMap.clear(), this._checkCountMap.clear(), this._pagingStatus = Nn, this._pagingGetCostList = []; } }]), zi), di = (e(Ji, [{ key: "_onCloudConfig", value: function() { var e2 = this._grpM.getCloudConfig("grp_attr_cache_time"); N(e2) || (this.CACHE_EXPIRE_TIME = Number(e2)); } }, { key: "updateLocalMainSequenceOnReconnected", value: function() { this._groupAttributesMap.forEach(function(e2) { e2.localMainSequence = 0; }); } }, { key: "isGroupAttributesUpdatedNotice", value: function(e2) { var t2 = e2.to, e2 = e2.elements.newGroupProfile, n2 = !N(e2) && !S(e2.groupAttributeOption); return n2 && this._onGroupAttributesUpdated({ groupID: t2, groupAttributeOption: e2.groupAttributeOption }), n2; } }, { key: "_onGroupAttributesUpdated", value: function(e2) { var t2, n2 = this, o2 = e2.groupID, e2 = e2.groupAttributeOption, i2 = e2.mainSequence, a2 = e2.isWithChangedAttributeInfo, s2 = e2.groupAttributeList, s2 = void 0 === s2 ? [] : s2, e2 = e2.operationType; M.l("".concat(this._n, ".onGroupAttributesUpdated. ") + "groupID:".concat(o2, " isWithChangedAttributeInfo:").concat(a2, " operationType:").concat(e2)), N(e2) || (this._groupAttributesCopy = this._getCachedAttributes({ groupID: o2 }), 0 != (t2 = i2 - this._getLocalGroupAttributes(o2).localMainSequence) && (1 === a2 && 1 == t2 ? (this._refreshCachedGroupAttributes({ groupID: o2, remoteMainSequence: i2, groupAttributeList: s2, operationType: e2 }), this._emitGroupAttributesUpdated(o2)) : this._hasLocalGroupAttributes(o2) && (a2 = this._getLocalGroupAttributes(o2).avChatRoomKey, this._getGroupAttributes({ groupID: o2, avChatRoomKey: a2 }).then(function() { n2._emitGroupAttributesUpdated(o2); })))); } }, { key: "initGroupAttributesCache", value: function(e2) { var t2 = e2.groupID, e2 = e2.avChatRoomKey, e2 = void 0 === e2 ? void 0 : e2; this._groupAttributesMap.set(t2, { lastUpdateTime: 0, localMainSequence: 0, remoteMainSequence: 0, attributes: /* @__PURE__ */ new Map(), avChatRoomKey: e2 }), M.l("".concat(this._n, ".initGroupAttributesCache groupID:").concat(t2, " avChatRoomKey:").concat(e2)); } }, { key: "initGroupAttributes", value: function(e2) { var n2 = this, o2 = e2.groupID, i2 = e2.groupAttributes, e2 = this._getLocalGroupAttributes(o2), t2 = e2.remoteMainSequence, e2 = e2.avChatRoomKey, a2 = new G("initGroupAttributes"); return a2.setMessage("groupID:".concat(o2, " avChatRoomKey:").concat(e2, " mainSequence:").concat(t2)), this._grpM.req({ P: k.SET_GRP_ATTR, data: { groupID: o2, avChatRoomKey: e2, mainSequence: t2, groupAttributeList: this._transformGroupAttributes(i2) } }).then(function(e3) { M.l("".concat(n2._n, ".").concat("initGroupAttributes", " ok. groupID:").concat(o2)); var e3 = e3.data, t3 = e3.mainSequence, e3 = p(e3.groupAttributeList); return e3.forEach(function(e4) { e4.value = i2[e4.key]; }), n2._groupAttributesCopy = n2._getCachedAttributes({ groupID: o2 }), n2._refreshCachedGroupAttributes({ groupID: o2, remoteMainSequence: t3, groupAttributeList: e3, operationType: 1 }), n2._emitGroupAttributesUpdated(o2), a2.end(), C({ groupAttributes: i2 }); }).catch(function(e3) { return a2.setError(e3).end(), D(e3); }); } }, { key: "setGroupAttributes", value: function(e2) { var n2 = this, o2 = "".concat(this._n, ".").concat("setGroupAttributes"), i2 = e2.groupID, a2 = e2.groupAttributes, e2 = this._getLocalGroupAttributes(i2), t2 = e2.remoteMainSequence, s2 = e2.avChatRoomKey, r2 = e2.attributes, e2 = this._transformGroupAttributes(a2), c2 = (e2.forEach(function(e3) { var t3 = e3.key; e3.sequence = 0, r2.has(t3) && (e3.sequence = r2.get(t3).sequence); }), new G("setGroupAttributes")); return c2.setMessage("groupID:".concat(i2, " groupAttributes:").concat(JSON.stringify(a2))), M.l("".concat(o2, ". groupID:").concat(i2, " mainSequence:").concat(t2)), this._grpM.req({ P: k.MODIFY_GRP_ATTR, data: { groupID: i2, avChatRoomKey: s2, mainSequence: t2, groupAttributeList: e2 } }).then(function(e3) { M.l("".concat(o2, " ok.")); var e3 = e3.data, t3 = e3.mainSequence, e3 = p(e3.groupAttributeList); return e3.forEach(function(e4) { e4.value = a2[e4.key]; }), n2._groupAttributesCopy = n2._getCachedAttributes({ groupID: i2 }), n2._refreshCachedGroupAttributes({ groupID: i2, remoteMainSequence: t3, groupAttributeList: e3, operationType: 2 }), n2._emitGroupAttributesUpdated(i2), c2.end(), C({ groupAttributes: a2 }); }).catch(function(e3) { return c2.setError(e3).end(), D(e3); }); } }, { key: "deleteGroupAttributes", value: function(e2) { var t2 = this, n2 = e2.groupID, e2 = e2.keyList, e2 = void 0 === e2 ? [] : e2, o2 = this._getLocalGroupAttributes(n2), i2 = o2.remoteMainSequence, a2 = o2.avChatRoomKey, s2 = o2.attributes, r2 = p(s2.keys()), o2 = k.CLEAR_GRP_ATTR, c2 = 3, a2 = { groupID: n2, avChatRoomKey: a2, mainSequence: i2 }, u2 = [], l2 = (0 < e2.length && (r2 = [], o2 = k.DEL_GRP_ATTR, c2 = 4, e2.forEach(function(e3) { var t3 = 0; s2.has(e3) && (t3 = s2.get(e3).sequence, r2.push(e3)), u2.push({ key: e3, sequence: t3 }); }), a2.groupAttributeList = u2), new G("deleteGroupAttributes")); return l2.setMessage("groupID:".concat(n2, " mainSequence:").concat(i2, " keyList:").concat(e2, " proto:").concat(o2)), this._grpM.req({ P: o2, data: a2 }).then(function(e3) { M.l("".concat(t2._n, ".").concat("deleteGroupAttributes", " ok. groupID:").concat(n2)); e3 = e3.data.mainSequence; return t2._groupAttributesCopy = t2._getCachedAttributes({ groupID: n2 }), t2._refreshCachedGroupAttributes({ groupID: n2, remoteMainSequence: e3, groupAttributeList: u2, operationType: c2 }), t2._emitGroupAttributesUpdated(n2), l2.end(), C({ keyList: r2 }); }).catch(function(e3) { return l2.setError(e3).end(), D(e3); }); } }, { key: "getGroupAttributes", value: function(t2) { var n2 = this, o2 = "".concat(this._n, ".").concat("getGroupAttributes"), i2 = t2.groupID, e2 = this._getLocalGroupAttributes(i2), a2 = e2.avChatRoomKey, s2 = e2.lastUpdateTime, r2 = e2.localMainSequence, e2 = e2.remoteMainSequence, c2 = new G("getGroupAttributes"); if (c2.setMessage("groupID:".concat(i2, " localMainSequence:").concat(r2, " remoteMainSequence:").concat(e2, " keyList:").concat(t2.keyList)), Date.now() - s2 >= this.CACHE_EXPIRE_TIME || r2 < e2) return this._getGroupAttributes({ groupID: i2, avChatRoomKey: a2 }).then(function(e3) { c2.setMoreMessage("get attributes from remote. count:".concat(e3.length)).end(), M.l("".concat(o2, " from remote. groupID:").concat(i2)); e3 = n2._getCachedAttributes(t2); return C({ groupAttributes: e3 }); }).catch(function(e3) { return c2.setError(e3).end(), D(e3); }); c2.setMoreMessage("get attributes from cache").end(), M.l("".concat(o2, " from cache. groupID:").concat(i2)); s2 = this._getCachedAttributes(t2); return T({ groupAttributes: s2 }); } }, { key: "_getGroupAttributes", value: function(o2) { var i2 = this, e2 = 0; return N(o2.avChatRoomKey) || (e2 = 1), this._grpM.req({ P: k.GET_GRP_ATTR, data: y(y({}, o2), {}, { groupType: e2 }) }).then(function(e3) { M.l("".concat(i2._n, "._getGroupAttributes ok. groupID:").concat(o2.groupID)); var e3 = e3.data, t2 = e3.mainSequence, e3 = e3.groupAttributeList, n2 = p(e3); return N(t2) || i2._refreshCachedGroupAttributes({ groupID: o2.groupID, remoteMainSequence: t2, groupAttributeList: n2, operationType: 5 }), e3; }).catch(function(e3) { return D(e3); }); } }, { key: "_refreshCachedGroupAttributes", value: function(e2) { var t2 = e2.groupID, n2 = e2.remoteMainSequence, o2 = e2.groupAttributeList, e2 = e2.operationType; if (this._hasLocalGroupAttributes(t2)) { var i2 = this._getLocalGroupAttributes(t2), a2 = i2.localMainSequence; if (5 === e2 || n2 - a2 == 1) i2.remoteMainSequence = n2, i2.localMainSequence = n2, i2.lastUpdateTime = Date.now(), this._updateCachedAttributes({ groupAttributes: i2, groupAttributeList: o2, operationType: e2 }); else { if (a2 === n2) return; i2.remoteMainSequence = n2; } this._groupAttributesMap.set(t2, i2); o2 = "operationType:".concat(e2, " localMainSequence:").concat(a2, " remoteMainSequence:").concat(n2); M.l("".concat(this._n, "._refreshCachedGroupAttributes. ").concat(o2)); } } }, { key: "_getCachedAttributes", value: function(e2) { var t2 = e2.groupID, e2 = e2.keyList, e2 = void 0 === e2 ? [] : e2, n2 = {}; if (this._hasLocalGroupAttributes(t2)) { var o2 = this._getLocalGroupAttributes(t2).attributes; if (0 < e2.length) e2.forEach(function(e3) { o2.has(e3) && (n2[e3] = o2.get(e3).value); }); else { var i2, a2 = Z(o2.keys()); try { for (a2.s(); !(i2 = a2.n()).done; ) { var s2 = i2.value; n2[s2] = o2.get(s2).value; } } catch (e3) { a2.e(e3); } finally { a2.f(); } } } return n2; } }, { key: "_updateCachedAttributes", value: function(e2) { var o2 = e2.groupAttributes, t2 = e2.groupAttributeList, e2 = e2.operationType; 3 !== e2 ? 4 !== e2 ? (1 === e2 && o2.attributes.clear(), t2.forEach(function(e3) { var t3 = e3.key, n2 = e3.value, e3 = e3.sequence; o2.attributes.set(t3, { value: n2, sequence: e3 }); })) : t2.forEach(function(e3) { o2.attributes.delete(e3.key); }) : o2.attributes.clear(); } }, { key: "_hasLocalGroupAttributes", value: function(e2) { return this._groupAttributesMap.has(e2); } }, { key: "_getLocalGroupAttributes", value: function(e2) { return this._hasLocalGroupAttributes(e2) || this.initGroupAttributesCache({ groupID: e2 }), this._groupAttributesMap.get(e2); } }, { key: "_transformGroupAttributes", value: function(t2) { var n2 = []; return Object.keys(t2).forEach(function(e2) { n2.push({ key: e2, value: t2[e2] }); }), n2; } }, { key: "_emitGroupAttributesUpdated", value: function(e2) { var t2 = this._getCachedAttributes({ groupID: e2 }), n2 = this._computeAttrChangedInfo(t2), o2 = n2.updatedKeyList, n2 = n2.deletedKeyList; M.l("".concat(this._n, "._emitGroupAttributesUpdated update:").concat(o2.length, ", delete:").concat(n2.length)), 0 === o2.length && 0 === n2.length || this._grpM.emitOEvt(h.GROUP_ATTRIBUTES_UPDATED, { groupID: e2, groupAttributes: t2, updatedKeyList: o2, deletedKeyList: n2 }); } }, { key: "_computeAttrChangedInfo", value: function(t2) { var n2 = this, o2 = [], i2 = []; return Object.keys(t2).forEach(function(e2) { t2[e2] !== n2._groupAttributesCopy[e2] && o2.push(e2); }), Object.keys(this._groupAttributesCopy).forEach(function(e2) { N(t2[e2]) && i2.push(e2); }), this._groupAttributesCopy = {}, { updatedKeyList: o2, deletedKeyList: i2 }; } }, { key: "deleteLocalGroupAttributes", value: function(e2) { this._hasLocalGroupAttributes(e2) && this._groupAttributesMap.delete(e2); } }, { key: "reset", value: function() { this._groupAttributesMap.clear(), this._groupAttributesCopy = {}, this.CACHE_EXPIRE_TIME = 3e4; } }]), Ji), pi = (e(ji, [{ key: "_onCloudConfig", value: function() { var e2 = this._grpM.getCloudConfig("grp_counter_expire_time"); N(e2) || (this.EXPIRE_TIME = Number(e2)); } }, { key: "isGroupCountersNotice", value: function(e2) { var t2 = e2.to, e2 = e2.elements.groupCounterInfo, n2 = false; return S(e2) || (this._onGroupCountersUpdated({ groupID: t2, groupCounterInfo: e2 }), n2 = true), n2; } }, { key: "_onGroupCountersUpdated", value: function(e2) { var o2 = this, i2 = e2.groupID; e2.groupCounterInfo.forEach(function(e3) { var t2 = e3.type, n2 = e3.groupCounterSeq, e3 = e3.counterList, e3 = void 0 === e3 ? [] : e3; 0 !== t2 && 2 !== t2 || (o2._updateLocalGroupCounters({ groupID: i2, groupCounterSeq: n2, counterList: e3 }), e3.forEach(function(e4) { o2._grpM.emitOEvt(h.GROUP_COUNTER_UPDATED, { groupID: i2, key: e4.key, value: e4.value }); })), 1 === t2 && o2._deleteLocalGroupCounters({ groupID: i2, groupCounterSeq: n2, counterList: e3 }); }), M.l("".concat(this._n, "._onGroupCountersUpdated groupID:").concat(i2)); } }, { key: "initGroupCountersCache", value: function(e2) { var t2 = e2.groupID, e2 = e2.avChatRoomKey; this._groupCountersMap.set(t2, { lastUpdateTime: 0, groupCounterSeq: 0, counters: /* @__PURE__ */ new Map(), avChatRoomKey: e2 }), M.l("".concat(this._n, ".initGroupCountersCache groupID:").concat(t2, " avChatRoomKey:").concat(e2)); } }, { key: "setGroupCounters", value: function(e2) { var t2, n2, o2, i2, a2; return this._grpM.canIUse(_.GRP_COUNTER) ? (t2 = "".concat(this._n, ".").concat("setGroupCounters"), n2 = e2.groupID, e2 = e2.counters, e2 = this._convertObjectToList(e2), o2 = this._getLocalGroupCounters(n2).avChatRoomKey, i2 = "groupID:".concat(n2, " count:").concat(e2.length), (a2 = new G("setGroupCounters")).setMessage("".concat(i2)), M.l("".concat(t2, ". ").concat(i2)), this._updateGroupCounters({ groupID: n2, counterList: e2, avChatRoomKey: o2, mode: "Set" }).then(function(e3) { return a2.end(), M.l("".concat(t2, " ok.")), C({ counters: e3 }); }).catch(function(e3) { return a2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this._grpM.noUse("setGroupCounters"); } }, { key: "increaseGroupCounter", value: function(e2) { var t2, n2, o2, i2, a2, s2, r2 = "increaseGroupCounter"; return this._grpM.canIUse(_.GRP_COUNTER) ? (t2 = "".concat(this._n, ".").concat(r2), n2 = e2.groupID, o2 = e2.key, e2 = e2.value, i2 = this._getLocalGroupCounters(n2).avChatRoomKey, a2 = "groupID:".concat(n2, " key:").concat(o2, " value:").concat(e2), (s2 = new G(r2)).setMessage("".concat(a2)), M.l("".concat(t2, ". ").concat(a2)), this._updateGroupCounters({ groupID: n2, counterList: [{ key: o2, value: e2 }], avChatRoomKey: i2, mode: "Increase" }).then(function(e3) { return s2.end(), M.l("".concat(t2, " ok.")), C({ counters: e3 }); }).catch(function(e3) { return s2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this._grpM.noUse(r2); } }, { key: "decreaseGroupCounter", value: function(e2) { var t2, n2, o2, i2, a2, s2, r2 = "decreaseGroupCounter"; return this._grpM.canIUse(_.GRP_COUNTER) ? (t2 = "".concat(this._n, ".").concat(r2), n2 = e2.groupID, o2 = e2.key, e2 = e2.value, i2 = this._getLocalGroupCounters(n2).avChatRoomKey, a2 = "groupID:".concat(n2, " key:").concat(o2, " value:").concat(e2), (s2 = new G(r2)).setMessage("".concat(a2)), M.l("".concat(t2, ". ").concat(a2)), this._updateGroupCounters({ groupID: n2, counterList: [{ key: o2, value: e2 }], avChatRoomKey: i2, mode: "Decrease" }).then(function(e3) { return s2.end(), M.l("".concat(t2, " ok.")), C({ counters: e3 }); }).catch(function(e3) { return s2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this._grpM.noUse(r2); } }, { key: "getGroupCounters", value: function(e2) { var t2 = this; if (!this._grpM.canIUse(_.GRP_COUNTER)) return this._grpM.noUse("getGroupCounters"); var n2 = "".concat(this._n, ".").concat("getGroupCounters"), o2 = e2.groupID, e2 = e2.keyList, i2 = void 0 === e2 ? [] : e2, e2 = this._getLocalGroupCounters(o2), a2 = e2.avChatRoomKey, e2 = e2.lastUpdateTime, s2 = new G("getGroupCounters"); if (s2.setMessage("groupID:".concat(o2)), Date.now() - e2 >= this.EXPIRE_TIME) return this._getRemoteGroupCounters({ groupID: o2, avChatRoomKey: a2 }).then(function(e3) { s2.setMoreMessage("from remote. count:".concat(e3.length)).end(), M.l("".concat(n2, " from remote. groupID:").concat(o2)); e3 = t2._getLocalCounters(o2, i2); return C({ counters: e3 }); }).catch(function(e3) { return s2.setError(e3).end(), D(e3); }); s2.setMoreMessage("from cache").end(), M.l("".concat(n2, " from cache. groupID:").concat(o2)); e2 = this._getLocalCounters(o2, i2); return T({ counters: e2 }); } }, { key: "_getRemoteGroupCounters", value: function(n2) { var o2 = this; return this._grpM.req({ P: k.GET_GRP_COUNTER, data: y({}, n2) }).then(function(e2) { var e2 = e2.data, t2 = e2.counterList, t2 = void 0 === t2 ? [] : t2, e2 = e2.groupCounterSeq; return o2._updateLocalGroupCounters({ groupID: n2.groupID, counterList: t2, groupCounterSeq: e2 }), M.l("".concat(o2._n, "._getRemoteGroupCounters ok. groupID:").concat(n2.groupID)), t2; }).catch(function(e2) { return D(e2); }); } }, { key: "_convertObjectToList", value: function(t2) { var n2 = []; return Object.keys(t2).forEach(function(e2) { n2.push({ key: e2, value: t2[e2] }); }), n2; } }, { key: "_updateGroupCounters", value: function(e2) { var t2 = "".concat(this._n, "._updateGroupCounters"), n2 = e2.groupID, o2 = e2.avChatRoomKey, i2 = e2.mode; return M.l("".concat(t2, ". groupID:").concat(n2, " avChatRoomKey:").concat(o2, " mode:").concat(i2)), this._grpM.req({ P: k.UPDATE_GRP_COUNTER, data: y({}, e2) }).then(function(e3) { M.l("".concat(t2, " ok.")); var e3 = e3.data.counterList, n3 = {}; return (void 0 === e3 ? [] : e3).forEach(function(e4) { var t3 = e4.key, e4 = e4.value; n3[t3] = e4; }), n3; }).catch(function(e3) { return D(e3); }); } }, { key: "_hasLocalGroupCounters", value: function(e2) { return this._groupCountersMap.has(e2); } }, { key: "_getLocalGroupCounters", value: function(e2) { return this._hasLocalGroupCounters(e2) || this.initGroupCountersCache({ groupID: e2 }), this._groupCountersMap.get(e2); } }, { key: "_updateLocalGroupCounters", value: function(e2) { var n2, t2, o2, i2 = e2.groupID, a2 = e2.counterList, a2 = void 0 === a2 ? [] : a2, e2 = e2.groupCounterSeq; this._hasLocalGroupCounters(i2) && (o2 = this._getLocalGroupCounters(i2), n2 = o2.counters, t2 = o2.avChatRoomKey, o2 = o2.groupCounterSeq, 0 < e2 && e2 < o2 || (a2.forEach(function(e3) { var t3 = e3.key, e3 = e3.value; n2.set(t3, e3); }), this._groupCountersMap.set(i2, { lastUpdateTime: Date.now(), groupCounterSeq: e2, counters: n2, avChatRoomKey: t2 }))); } }, { key: "_deleteLocalGroupCounters", value: function(e2) { var t2, n2, o2 = e2.groupID, i2 = e2.counterList, i2 = void 0 === i2 ? [] : i2, e2 = e2.groupCounterSeq; this._hasLocalGroupCounters(o2) && (n2 = this._getLocalGroupCounters(o2), t2 = n2.counters, n2 = n2.avChatRoomKey, i2.forEach(function(e3) { t2.delete(e3.key); }), this._groupCountersMap.set(o2, { lastUpdateTime: Date.now(), groupCounterSeq: e2, counters: t2, avChatRoomKey: n2 })); } }, { key: "_getLocalCounters", value: function(e2, t2) { var n2 = {}; if (this._hasLocalGroupCounters(e2)) { var o2 = this._getLocalGroupCounters(e2).counters; if (0 < t2.length) t2.forEach(function(e3) { o2.has(e3) && (n2[e3] = o2.get(e3)); }); else { var i2, a2 = Z(o2.keys()); try { for (a2.s(); !(i2 = a2.n()).done; ) { var s2 = i2.value; n2[s2] = o2.get(s2); } } catch (e3) { a2.e(e3); } finally { a2.f(); } } } return n2; } }, { key: "reset", value: function() { this._groupCountersMap.clear(), this.EXPIRE_TIME = 3e4; } }]), ji), _i = (e(Wi, [{ key: "start", value: function() { var e2 = this._grpM.isLoggedIn(); e2 || (this._proto = k.AV_NOAUTH_POLLING), M.l("".concat(this._n, ".start pollingInterval:").concat(this._manager.getPollingInterval(), " isLoggedIn:").concat(e2)), this._isRunning = true, this._request(); } }, { key: "isRunning", value: function() { return this._isRunning; } }, { key: "_request", value: function() { var t2 = this, e2 = this._onInit(this._groupID); this._grpM.req({ P: this._proto, data: e2 }).then(function(e3) { t2._onSuccess(t2._groupID, e3), t2.isRunning() && (clearTimeout(t2._timeoutID), t2._timeoutID = setTimeout(t2._request.bind(t2), t2._manager.getPollingInterval())); }).catch(function(e3) { t2._onFail(t2._groupID, e3), t2.isRunning() && (clearTimeout(t2._timeoutID), t2._timeoutID = setTimeout(t2._request.bind(t2), t2._manager.MAX_POLLING_INTERVAL)); }); } }, { key: "stop", value: function() { M.l("".concat(this._n, ".stop")), 0 < this._timeoutID && (clearTimeout(this._timeoutID), this._timeoutID = -1), this._isRunning = false; } }, { key: "getPollingTimerID", value: function() { return this._timeoutID; } }]), Wi), hi = { 3: true, 4: true, 5: true, 6: true, 17: true, 20: true, 21: true, 100: true }, gi = (e(Yi, [{ key: "hasJoinedAVChatRoom", value: function() { var e2 = []; return 0 < (e2 = 0 < this._joinedGroupMap.size ? p(this._joinedGroupMap.values()).filter(function(e3) { return e3.type === A.GRP_AVCHATROOM; }) : e2).length; } }, { key: "getJoinedLiveList", value: function() { var e2 = []; return e2 = 0 < this._joinedGroupMap.size ? p(this._joinedGroupMap.values()).filter(function(e3) { return e3.type === A.GRP_LIVE; }) : e2; } }, { key: "checkJoinedAVChatRoomByID", value: function(e2) { return this._joinedGroupMap.has(e2); } }, { key: "getJoinedAVChatRoom", value: function() { return 0 < this._joinedGroupMap.size ? p(this._joinedGroupMap.keys()) : []; } }, { key: "_updatedata", value: function(e2) { var t2 = this._pollingRequestInfoMap.get(e2); return e2 === p(this._pollingInstanceMap.keys())[0] ? y(y({}, t2), {}, { startBroadcastSeq: this._startBroadcastSeq, simplifiedMessage: this.DEFAULT_POLLING_SIMPLIFIED_MSG }) : y(y({}, t2), {}, { simplifiedMessage: this.DEFAULT_POLLING_SIMPLIFIED_MSG }); } }, { key: "_handleSuccess", value: function(e2, t2) { var n2, o2 = t2.data, i2 = o2.key, a2 = o2.nextSeq, s2 = o2.rspMsgList, r2 = o2.errorCode, c2 = o2.nextBroadcastSeq, o2 = o2.broadcastMessageList; 0 !== r2 ? (r2 = this._pollingRequestInfoMap.get(e2), n2 = new G("longPollingAVError"), r2 = r2 ? "".concat(r2.key, "-").concat(r2.startSeq) : "requestInfo is undefined", n2.setMessage("".concat(e2, "-").concat(r2, "-").concat(t2.errorInfo)).setCode(t2.errorCode).end(true)) : this.checkJoinedAVChatRoomByID(e2) && (m(i2) && R(a2) && this._pollingRequestInfoMap.set(e2, { key: i2, startSeq: a2 }), R(c2) && c2 > this._startBroadcastSeq && (this._startBroadcastSeq = c2), O(s2) && 0 < s2.length ? (s2.forEach(function(e3) { e3.to = e3.groupID; }), this.onMessage(s2, e2)) : (this._pollingNoMessageCount += 1, this._pollingNoMessageCount === this.DEFAULT_POLLING_NO_MESSAGE_COUNT && (this._pollingInterval = this.DEFAULT_POLLING_INTERVAL + this.DEFAULT_POLLING_INTERVAL_PLUS)), this._onBroadcastMessage(o2)); } }, { key: "_handleFailure", value: function(e2, t2) { } }, { key: "onMessage", value: function(e2, t2) { if (O(e2) && 0 !== e2.length) { var n2 = "".concat(this._n, ".onMessage"), o2 = (t2 && (n2 += " groupID:".concat(t2)), 0 !== this._pollingNoMessageCount && (this._pollingNoMessageCount = 0, this._pollingInterval = this.DEFAULT_POLLING_INTERVAL), null), i2 = [], a2 = this._get(11), s2 = this._get(26), r2 = e2.length, c2 = (1 < r2 && e2.sort(function(e3, t3) { return e3.sequence - t3.sequence; }), this._get(12).isUnlimitedAVChatRoom()), u2 = false; M.getLevel() <= 0 && (t2 = e2.map(function(e3) { return e3.sequence; }), M.l("".concat(n2, " count:").concat(t2.length, " sequenceList:").concat(t2)), t2.length = 0); for (var l2 = 0; l2 < r2; l2++) { var d2 = this.restoreMessageFromSimplified(e2[l2]); if (hi[d2.event]) { if (6 === d2.event) { if (this._grpM.isGroupAttributesUpdatedNotice(d2)) continue; if (this._grpM.isGroupCountersNotice(d2)) continue; } if (20 !== d2.event) if (21 !== d2.event) if (100 !== d2.event) { var o2 = this.packMessage(d2, d2.event), p2 = 1 === d2.isModified, u2 = 1 === d2.isHistoryMessage; if (!c2) { if (this._seqSll.has(o2.sequence)) continue; this._seqSll.set(o2.sequence); } var _2 = this._IDSll.has(o2.ID); _2 ? M.w("".concat(n2, " ID:").concat(o2.ID, " has:").concat(_2)) : (this._IDSll.set(o2.ID), _2 = false, !u2 && this._isMessageSentByCurrentInstance(o2) ? p2 && (_2 = true, o2.isModified = p2, a2.updateMsgIsModifiedProp(o2)) : _2 = true, _2 && (o2.conversationType === A.CONV_SYSTEM && 5 === o2.payload.operationType && this._onGroupDismissed(o2.payload.groupProfile.groupID), u2 || o2.conversationType === A.CONV_SYSTEM || (p2 = o2.conversationID.replace(A.CONV_GROUP, ""), this._pollingInstanceMap.has(p2) ? this._grpM.isLoggedIn() && s2.addMessageSequence({ key: zn, message: o2 }) : (o2.type !== A.MSG_GRP_TIP && 0 < o2.clientTime && s2.addMessageDelay(o2.clientTime), s2.addMessageSequence({ key: Jn, message: o2 }))), i2.push(o2))); } else this.onRoomCustomData(d2); else this._get(34).onMessageReactionNotify({ event: 21, dataList: d2.elements.messageReactionNotifyList }); else this.handleMessageRevokedNotice(d2); } else M.w("".concat(n2, ". unknown event:").concat(d2.event)); } 0 !== i2.length && (0 < (t2 = At(i2)).length && this._grpM.emitOEvt(h.MESSAGE_MODIFIED, t2), u2 || 0 < (t2 = this.packConversationOption(i2)).length && a2.onNewMessage({ conversationOptionsList: t2, isInstantMessage: true }), this._checkMessageStacked(i2), 0 < (t2 = Rt(i2)).length && this._grpM.emitOEvt(h.MESSAGE_RECEIVED, t2), i2.length = 0); } } }, { key: "handleMessageRevokedNotice", value: function(e2) { var t2 = this, i2 = e2.groupID, n2 = e2.elements.revokeMsgList, a2 = e2.revokerInfo, s2 = []; n2.forEach(function(e3) { var t3 = e3.tinyID, n3 = e3.clientTime, o2 = e3.random, e3 = e3.sequence, t3 = { conversationID: "".concat(A.CONV_GROUP).concat(i2), ID: "".concat(t3, "-").concat(n3, "-").concat(o2), revoker: a2.revoker, revokeReason: a2.reason || "", revokerInfo: { userID: a2.revoker, nick: "", avatar: "" }, sequence: e3 }; s2.push(t3); }), 0 !== s2.length && this._get(11).updateRevokerInfo(s2).then(function(e3) { t2._grpM.emitOEvt(h.MESSAGE_REVOKED, e3); }); } }, { key: "isBroadcastOrNormal", value: function(e2) { return 3 === e2 || 17 === e2; } }, { key: "isGroupTip", value: function(e2) { return 4 === e2 || 6 === e2; } }, { key: "isGroupSystemNotice", value: function(e2) { return 5 === e2; } }, { key: "restoreGroupTipElements", value: function() { var e2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, t2 = e2.operatorInfo, t2 = void 0 === t2 ? {} : t2, n2 = e2.operatorID, o2 = e2.userIDList, o2 = void 0 === o2 ? [] : o2, i2 = e2.operationType, i2 = (R(e2.groupJoinType) || 1 !== i2 && 2 !== i2 || (e2.groupJoinType = 2 === i2 ? 0 : 1), t2.userID), a2 = t2.avatar, t2 = t2.nick, n2 = (e2.operatorInfo = { userID: void 0 === i2 ? n2 : i2, avatar: void 0 === a2 ? "" : a2, nick: void 0 === t2 ? "" : t2 }, o2.map(function(e3) { return { userID: e3 }; })); return e2.memberInfoList = e2.memberInfoList || n2, e2; } }, { key: "restoreMessageFromSimplified", value: function(n2) { var e2, t2, o2, i2 = n2.event; return this.isBroadcastOrNormal(i2) && (n2.cloudCustomData = n2.cloudCustomData || "", n2.elements = n2.elements.map(function(e3) { var t3; return e3.type === A.MSG_CUSTOM && (t3 = e3.content, e3.content = y({ data: "", description: "", extension: "" }, void 0 === t3 ? {} : t3)), e3; })), (this.isGroupTip(i2) || this.isGroupSystemNotice(i2)) && (n2.from = n2.from || "@TIM#SYSTEM"), this.isGroupTip(i2) && (n2.elements = this.restoreGroupTipElements(n2.elements), t2 = (o2 = void 0 === (o2 = n2.elements) ? {} : o2).operationType, e2 = o2.operatorInfo, 1 === t2) && (t2 = [{ userID: (void 0 === e2 ? {} : e2).userID }], o2.memberInfoList = o2.memberInfoList || t2), this.isGroupSystemNotice(i2) && (o2 = (e2 = n2.elements).memberInfoList, t2 = e2.operatorInfo, n2.elements.memberInfoList = y({ userID: n2.elements.operatorID, avatar: "", nick: "" }, o2 = o2 || (void 0 === t2 ? {} : t2)), n2.elements = y({ authentication: "", remarkInfo: "", messageKey: 1e3 * n2.time }, n2.elements), i2 = Object.keys(n2.elements).filter(function(e3) { return "operatorInfo" !== e3; }).reduce(function(e3, t3) { return y(y({}, e3), {}, F({}, t3, n2.elements[t3])); }, {}), n2.elements = i2), n2; } }, { key: "_onGroupDismissed", value: function(e2) { M.l("".concat(this._n, "._onGroupDismissed groupID:").concat(e2)), this._grpM.deleteLocalGroupAndConversation(e2), this.reset(e2); } }, { key: "_checkMessageStacked", value: function(e2) { var t2 = "MessageStacked", e2 = e2.length; 100 <= e2 && (this._grpM.warn(t2, e2), this._reportMessageStackedCount < 5) && (new G(t2).setMessage("count:".concat(e2, " groupID:").concat(p(this._joinedGroupMap.keys()))).setLevel("warning").end(), this._reportMessageStackedCount += 1); } }, { key: "_isMessageSentByCurrentInstance", value: function(e2) { return !!this._get(11).isMessageSentByCurrentInstance(e2); } }, { key: "packMessage", value: function(e2, t2) { e2.currentUser = this._grpM.getMyUserID(), e2.conversationType = 5 === t2 ? A.CONV_SYSTEM : A.CONV_GROUP, e2.isSystemMessage = !!e2.isSystemMessage; var n2 = new Do(e2), e2 = this.packElements(e2, t2), t2 = this._grpM.getFileDownloadProxy(), o2 = this._grpM.getDowloadFileAuthKey(), i2 = this._get(17).getFileDNList(); return n2.setElement(e2, t2, o2, i2), n2; } }, { key: "packElements", value: function(e2, t2) { return 4 === t2 || 6 === t2 ? (this._updateMemberCountByGroupTips(e2), { type: A.MSG_GRP_TIP, content: y(y({}, e2.elements), {}, { groupProfile: e2.groupProfile }) }) : 5 === t2 ? { type: A.MSG_GRP_SYS_NOTICE, content: y(y({}, e2.elements), {}, { groupProfile: y(y({}, e2.groupProfile), {}, { groupID: e2.groupID }) }) } : e2.elements; } }, { key: "packConversationOption", value: function(e2) { for (var t2 = /* @__PURE__ */ new Map(), n2 = 0; n2 < e2.length; n2++) { var o2, i2 = e2[n2], a2 = i2.conversationID; t2.has(a2) ? "in" === ((o2 = t2.get(a2)).lastMessage = i2).flow && o2.unreadCount++ : t2.set(a2, { conversationID: i2.conversationID, unreadCount: "out" === i2.flow ? 0 : 1, type: i2.conversationType, subType: i2.conversationSubType, lastMessage: i2 }); } return p(t2.values()); } }, { key: "_updateMemberCountByGroupTips", value: function(e2) { var t2, n2, o2, i2 = e2.groupProfile.groupID, e2 = e2.elements.onlineMemberInfo, e2 = void 0 === e2 ? void 0 : e2; S(e2) || (t2 = void 0 === (t2 = e2.onlineMemberNum) ? 0 : t2, e2 = void 0 === (e2 = e2.expireTime) ? this.DEFAULT_EXPIRE_TIME : e2, n2 = this._onlineMemberCountMap.get(i2) || {}, o2 = Date.now(), S(n2) ? Object.assign(n2, { lastReqTime: 0, lastSyncTime: 0, latestUpdateTime: o2, memberCount: t2, expireTime: e2 }) : (n2.latestUpdateTime = o2, n2.memberCount = t2), this._onlineMemberCountMap.set(i2, n2)); } }, { key: "_onBroadcastMessage", value: function(e2) { if (!S(e2)) { for (var t2 = [], n2 = e2.length, o2 = null, i2 = 0; i2 < n2; i2++) { var a2 = this.restoreMessageFromSimplified(e2[i2]); hi[a2.event] ? ((o2 = this.packMessage(a2, a2.event)).isBroadcastMessage = true, this._broadcastMessageIDMap.has(o2.ID) || (t2.push(o2), this._broadcastMessageIDMap.set(o2.ID, 1))) : M.w("".concat(this._n, "._onBroadcastMessage unknown event:").concat(a2.event)); } 0 < t2.length && this._grpM.emitOEvt(h.MESSAGE_RECEIVED, t2); } } }, { key: "start", value: function(e2) { var t2; this._pollingInstanceMap.has(e2) ? (t2 = this._pollingInstanceMap.get(e2)).isRunning() || t2.start() : ((t2 = new _i({ manager: this, groupID: e2, onInit: this._updatedata.bind(this), onSuccess: this._handleSuccess.bind(this), onFail: this._handleFailure.bind(this) })).start(), this._pollingInstanceMap.set(e2, t2), M.l("".concat(this._n, ".start groupID:").concat(e2))); } }, { key: "handleJoinResult", value: function(o2) { var i2 = this; return this._preCheck(o2.group).then(function() { var e2 = o2.longPollingKey, t2 = o2.group, n2 = t2.groupID; return i2._joinedGroupMap.set(n2, t2), i2._grpM.updateGroupMap([t2]), i2._grpM.deleteUnjoinedAVChatRoom(n2), i2._grpM.emitGroupListUpdate(true, false), N(e2) ? T({ status: nt, group: t2 }) : Promise.resolve(); }); } }, { key: "startRunLoop", value: function(i2) { var a2 = this; return this.handleJoinResult(i2).then(function() { var e2 = i2.longPollingKey, t2 = i2.group, n2 = i2.startSeq, o2 = t2.groupID; return a2._pollingRequestInfoMap.set(o2, { key: e2, startSeq: void 0 === n2 ? 0 : n2 }), a2.start(o2), a2._grpM.isLoggedIn() ? T({ status: nt, group: t2 }) : T({ status: nt }); }); } }, { key: "_preCheck", value: function(e2) { if (!this._get(12).isUnlimitedAVChatRoom() && this.hasJoinedAVChatRoom() && e2.type !== A.GRP_LIVE) { var e2 = Y(this._joinedGroupMap.entries().next().value, 2), t2 = e2[0], e2 = e2[1]; if (this._grpM.isLoggedIn() && e2.selfInfo.role !== A.GRP_MBR_ROLE_OWNER && e2.ownerID !== this._grpM.getMyUserID()) return this._grpM.quitGroup(t2); this._grpM.deleteLocalGroupAndConversation(t2), this.reset(t2); } return Promise.resolve(); } }, { key: "joinWithoutAuth", value: function(e2) { var n2 = this, o2 = e2.groupID, i2 = "".concat(this._n, ".").concat("joinWithoutAuth"), a2 = new G("joinWithoutAuth"); return this._grpM.req({ P: k.APPLY_JOIN_GRP_NOAUTH, data: e2 }).then(function(e3) { e3 = e3.data.longPollingKey; if (a2.setMessage("groupID:".concat(o2, " longPollingKey:").concat(e3)).end(true), N(e3)) return D({ code: L.CANNOT_JOIN_NON_AV_WITHOUT_LOGIN }); M.l("".concat(i2, " ok. groupID:").concat(o2)), n2._get(11).setCompleted("".concat(A.CONV_GROUP).concat(o2)); var t2 = new oi({ groupID: o2 }); return n2.startRunLoop({ group: t2, longPollingKey: e3 }), C({ status: nt }); }).catch(function(e3) { return M.e("".concat(i2, " failed. groupID:").concat(o2, " error:"), e3), a2.setError(e3).setMessage("groupID:".concat(o2)).end(true), D(e3); }).finally(function() { n2._grpM.get(14).reportAtOnce(); }); } }, { key: "getGroupOnlineMemberCount", value: function(e2) { var t2 = this._onlineMemberCountMap.get(e2) || {}, n2 = Date.now(); return S(t2) || n2 - t2.lastSyncTime > 1e3 * t2.expireTime && 1e4 < n2 - t2.latestUpdateTime && 3e3 < n2 - t2.lastReqTime ? (t2.lastReqTime = n2, this._onlineMemberCountMap.set(e2, t2), this._getGroupOnlineMemberCount(e2).then(function(e3) { return C({ memberCount: e3.memberCount }); }).catch(function(e3) { return D(e3); })) : T({ memberCount: t2.memberCount }); } }, { key: "_getGroupOnlineMemberCount", value: function(i2) { var a2 = this, s2 = "".concat(this._n, ".").concat("_getGroupOnlineMemberCount"), t2 = new G("_getGroupOnlineMemberCount"); return this._grpM.requestOnlineCount(i2).then(function(e2) { var t3 = a2._onlineMemberCountMap.get(i2) || {}, e2 = e2.data, n2 = e2.memberCount, n2 = void 0 === n2 ? 0 : n2, e2 = e2.expireTime, e2 = void 0 === e2 ? a2.DEFAULT_EXPIRE_TIME : e2, o2 = (M.l("".concat(s2, " ok. groupID:").concat(i2, " memberCount:").concat(n2, " expireTime:").concat(e2)), Date.now()); return S(t3) && (t3.lastReqTime = o2), a2._onlineMemberCountMap.set(i2, Object.assign(t3, { lastSyncTime: o2, latestUpdateTime: o2, memberCount: n2, expireTime: e2 })), { memberCount: n2 }; }).catch(function(e2) { return M.w("".concat(s2, " failed. error:"), e2), t2.setCode(e2.code).setMessage("groupID:".concat(i2, " error:").concat(JSON.stringify(e2))).end(), Promise.reject(e2); }); } }, { key: "_get", value: function(e2) { return this._grpM.get(e2); } }, { key: "setPollingInterval", value: function(e2) { N(e2) || (R(e2) ? this._pollingInterval = this.DEFAULT_POLLING_INTERVAL = e2 : this._pollingInterval = this.DEFAULT_POLLING_INTERVAL = parseInt(e2, 10)); } }, { key: "setPollingIntervalPlus", value: function(e2) { N(e2) || (R(e2) ? this.DEFAULT_POLLING_INTERVAL_PLUS = e2 : this.DEFAULT_POLLING_INTERVAL_PLUS = parseInt(e2, 10)); } }, { key: "setPollingNoMessageCount", value: function(e2) { N(e2) || (R(e2) ? this.DEFAULT_POLLING_NO_MESSAGE_COUNT = e2 : this.DEFAULT_POLLING_NO_MESSAGE_COUNT = parseInt(e2, 10)); } }, { key: "setPollingSimplifiedMessage", value: function(e2) { N(e2) || "0" !== e2 && "1" !== e2 || (this.DEFAULT_POLLING_SIMPLIFIED_MSG = parseInt(e2, 10)); } }, { key: "getPollingInterval", value: function() { return this._pollingInterval; } }, { key: "onAVChatRoomMemberBanned", value: function(e2) { e2 = e2.payload.groupProfile.groupID; M.l("".concat(this._n, ".onAVChatRoomMemberBanned groupID:").concat(e2)), this._grpM.deleteLocalGroupAndConversation(e2), this.reset(e2); } }, { key: "restartPolling", value: function() { M.l("".concat(this._n, ".restartPolling count:").concat(this._pollingInstanceMap.size)); var e2, t2 = Z(this._pollingInstanceMap.values()); try { for (t2.s(); !(e2 = t2.n()).done; ) { var n2 = e2.value; n2.stop(), n2.start(); } } catch (e3) { t2.e(e3); } finally { t2.f(); } } }, { key: "getPollingTimerID", value: function(e2) { var t2; return this._pollingInstanceMap.has(e2) ? (t2 = this._pollingInstanceMap.get(e2).getPollingTimerID(), M.l("".concat(this._n, ".getPollingTimerID groupID:").concat(e2, " timerID:").concat(t2)), t2) : -1; } }, { key: "hasPollingInstance", value: function(e2) { return this._pollingInstanceMap.has(e2); } }, { key: "onRoomCustomData", value: function(e2) { var t2 = e2.groupID, n2 = e2.sequence, o2 = e2.time, e2 = e2.elements, e2 = e2 && e2.content; this._get(30).onRoomCustomDataReceived(e2), M.l("".concat(this._n, ".onRoomCustomData groupID:").concat(t2, " sequence:").concat(n2, " time:").concat(o2, " data:").concat(e2)); } }, { key: "reset", value: function(e2) { if (e2) { M.l("".concat(this._n, ".reset groupID:").concat(e2)); var t2 = this._pollingInstanceMap.get(e2); t2 && t2.stop(), this._pollingInstanceMap.delete(e2), this._joinedGroupMap.delete(e2), this._pollingRequestInfoMap.delete(e2), this._onlineMemberCountMap.delete(e2); } else { M.l("".concat(this._n, ".reset all")); var n2, o2 = Z(this._pollingInstanceMap.values()); try { for (o2.s(); !(n2 = o2.n()).done; ) n2.value.stop(); } catch (e3) { o2.e(e3); } finally { o2.f(); } this._pollingInstanceMap.clear(), this._joinedGroupMap.clear(), this._pollingRequestInfoMap.clear(), this._onlineMemberCountMap.clear(), this._broadcastMessageIDMap.clear(); } this._seqSll.reset(), this._IDSll.reset(), this._reportMessageStackedCount = 0, this._pollingInterval = this.DEFAULT_POLLING_INTERVAL = 300, this.DEFAULT_POLLING_NO_MESSAGE_COUNT = 20, this.DEFAULT_POLLING_INTERVAL_PLUS = 2e3, this._pollingNoMessageCount = 0; } }]), Yi), fi = (e(Ki, [{ key: "updateMember", value: function(e2) { N(e2.onlineStatus) || (this.isOnline = "Online" === e2.onlineStatus); var t2 = [null, void 0, "", 0, NaN]; e2.memberCustomField && kt(this.memberCustomField, e2.memberCustomField), _t(this, e2, ["memberCustomField", "marks", "onlineStatus"], t2); } }, { key: "updateRole", value: function(e2) { ["Owner", "Admin", "Member"].indexOf(e2) < 0 || (this.role = e2); } }, { key: "updateMuteUntil", value: function(e2) { N(e2) || (this.muteUntil = Math.floor((Date.now() + 1e3 * e2) / 1e3)); } }, { key: "updateNameCard", value: function(e2) { N(e2) || (this.nameCard = e2); } }, { key: "updateMemberCustomField", value: function(e2) { e2 && kt(this.memberCustomField, e2); } }]), Ki), mi = (e(Bi, [{ key: "_onProfileUpdated", value: function(e2) { for (var n2 = this, o2 = e2.data, t2 = 0; t2 < o2.length; t2++) !function(e3) { var t3 = o2[e3]; n2.groupMemberListMap.forEach(function(e4) { e4.has(t3.userID) && e4.get(t3.userID).updateMember({ nick: t3.nick, avatar: t3.avatar }); }); }(t2); } }, { key: "deleteGroupMemberList", value: function(e2) { this.groupMemberListMap.delete(e2); } }, { key: "getGroupMemberList", value: function(e2) { var t2, o2 = this, i2 = e2.groupID, n2 = e2.role, n2 = void 0 === n2 ? void 0 : n2, a2 = e2.offset, s2 = void 0 === a2 ? 0 : a2, a2 = e2.count, r2 = void 0 === a2 ? 15 : a2, a2 = e2.filter, e2 = void 0 === a2 ? void 0 : a2, c2 = "".concat(this._n, ".").concat("getGroupMemberList"), a2 = this._grpM.hasLocalGroup(i2); if (M.l("".concat(c2, " groupID:").concat(i2, " role:").concat(n2, " offset:").concat(s2, " count:").concat(r2, " hasLocalGroup:").concat(a2)), !a2) return T({ memberList: [], offset: 0 }); if (this._grpM.getLocalGroupProfile(i2).type === A.GRP_AVCHATROOM) { if (this._grpM.canIUse(_.AV_MBR_LIST)) return this._getAVChatRoomMemberList({ groupID: i2, offset: s2, filter: e2 }); this._grpM.warn("LiveOnlineMember"); } n2 !== A.GRP_MBR_ROLE_ADMIN && n2 !== A.GRP_MBR_ROLE_OWNER && n2 !== A.GRP_MBR_ROLE_MEMBER || (t2 = n2); var u2 = new G("getGroupMemberList"), l2 = 0, a2 = { groupID: i2, limit: 100 < r2 ? 100 : r2, memberRoleFilter: t2 ? [t2] : void 0, memberInfoFilter: this.DEFAULT_MEMBER_INFO_FILTER }, d2 = (Nt({ groupID: i2 }) ? a2.next = "".concat(s2) : l2 = (a2.offset = s2) + r2, []); return this._grpM.req({ P: k.GET_GRP_MBR_LIST, data: a2 }).then(function(e3) { var e3 = e3.data, t3 = e3.members, n3 = e3.memberNum, e3 = e3.next, e3 = void 0 === e3 ? void 0 : e3; return N(e3) || (l2 = S(e3) ? 0 : e3), O(t3) && 0 !== t3.length ? (o2._grpM.hasLocalGroup(i2) && (o2._grpM.getLocalGroupProfile(i2).memberNum = n3), d2 = o2._updateLocalGroupMemberMap(i2, t3), o2._grpM.get(4).getUserProfile({ userIDList: t3.map(function(e4) { return e4.userID; }), tagList: [g.NICK, g.AVATAR] })) : (l2 = 0, Promise.resolve([])); }).then(function(e3) { var e3 = e3.data; return O(e3) && 0 !== e3.length ? (e3 = e3.map(function(e4) { return { userID: e4.userID, nick: e4.nick, avatar: e4.avatar }; }), o2._updateLocalGroupMemberMap(i2, e3), d2.length < r2 && (l2 = 0), u2.setMessage("groupID:".concat(i2, " offset:").concat(s2, " count:").concat(r2)).end(), M.l("".concat(c2, " ok.")), C({ memberList: d2, offset: l2 })) : T({ memberList: [], offset: l2 }); }).catch(function(e3) { return u2.setError(e3).end(), M.e("".concat(c2, " failed. error:"), e3), D(e3); }); } }, { key: "_getAVChatRoomMemberList", value: function(e2) { var n2 = this, o2 = e2.groupID, t2 = e2.offset, e2 = e2.filter, i2 = "".concat(this._n, ".").concat("_getAVChatRoomMemberList"), a2 = new G("_getAVChatRoomMemberList"); return a2.setMessage("groupID:".concat(o2, " offset:").concat(t2, " filter:").concat(e2)), this._grpM.req({ P: k.GET_AV_MBR_LIST, data: { groupID: o2, offset: t2, filter: e2 } }).then(function(e3) { var e3 = e3.data, t3 = e3.memberList, t3 = void 0 === t3 ? [] : t3, e3 = e3.offset, e3 = void 0 === e3 ? 0 : e3, t3 = (a2.end(), M.l("".concat(i2, " ok. member count:").concat(t3.length, ", next request timestamp:").concat(e3)), t3.map(function(e4) { return y(y({}, e4), {}, { onlineStatus: "Online" }); })), t3 = n2._updateLocalGroupMemberMap(o2, t3); return C({ memberList: t3, offset: e3 }); }).catch(function(e3) { return a2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); }); } }, { key: "getGroupMemberProfile", value: function(e2) { var t2, n2 = this, o2 = "getGroupMemberProfile", i2 = "".concat(this._n, ".").concat(o2), a2 = "groupID:".concat(e2.groupID), s2 = (5 < e2.userIDList.length ? a2 += " userIDList.length:".concat(e2.userIDList.length) : a2 += " userIDList:".concat(e2.userIDList), M.l("".concat(i2, " ").concat(a2)), 50 < e2.userIDList.length && (e2.userIDList = e2.userIDList.slice(0, 50)), e2.groupID), r2 = e2.userIDList, i2 = this._grpM.getLocalGroupProfile(s2); return i2 && Ot(i2.type) ? D({ code: i2 = L.OPERATION_NOT_SUPPORTED_IN_AV, message: this._grpM.getErrMsg(i2, o2) }) : ((t2 = new G(o2)).setMessage(a2), this._getGroupMemberProfileAdvance(y(y({}, e2), {}, { userIDList: r2 })).then(function(e3) { e3 = e3.data.members; return O(e3) && 0 !== e3.length ? (n2._updateLocalGroupMemberMap(s2, e3), n2._grpM.get(4).getUserProfile({ userIDList: e3.map(function(e4) { return e4.userID; }), tagList: [g.NICK, g.AVATAR] })) : T([]); }).then(function(e3) { e3 = e3.data.map(function(e4) { return { userID: e4.userID, nick: e4.nick, avatar: e4.avatar }; }), n2._updateLocalGroupMemberMap(s2, e3), e3 = r2.filter(function(e4) { return n2.hasLocalGroupMember(s2, e4); }).map(function(e4) { return n2.getLocalGroupMemberInfo(s2, e4); }); return t2.end(), C({ memberList: e3 }); })); } }, { key: "addGroupMember", value: function(a2) { var s2 = this, r2 = "".concat(this._n, ".").concat("addGroupMember"), e2 = a2.groupID, c2 = this._grpM.getLocalGroupProfile(e2), t2 = c2.type, u2 = new G("addGroupMember"); return u2.setMessage("groupID:".concat(e2, " groupType:").concat(t2)), Ot(t2) ? (t2 = new E({ code: L.CANNOT_ADD_MEMBER_IN_AV }), u2.setError(t2).end(), D(t2)) : (a2.userIDList = a2.userIDList.map(function(e3) { return { userID: e3 }; }), M.l("".concat(r2, " groupID:").concat(e2)), this._grpM.req({ P: k.ADD_GRP_MBR, data: a2 }).then(function(e3) { var e3 = e3.data.members, t3 = (M.l("".concat(r2, " ok")), e3.filter(function(e4) { return 1 === e4.result; }).map(function(e4) { return e4.userID; })), n2 = e3.filter(function(e4) { return 0 === e4.result; }).map(function(e4) { return e4.userID; }), o2 = e3.filter(function(e4) { return 2 === e4.result; }).map(function(e4) { return e4.userID; }), e3 = e3.filter(function(e4) { return 4 === e4.result; }).map(function(e4) { return e4.userID; }), i2 = "groupID:".concat(a2.groupID, ", ") + "successUserIDList:".concat(t3, ", ") + "failureUserIDList:".concat(n2, ", ") + "existedUserIDList:".concat(o2, ", ") + "overLimitUserIDList:".concat(e3); return u2.setMoreMessage(i2).end(), 0 === t3.length ? C({ successUserIDList: t3, failureUserIDList: n2, existedUserIDList: o2, overLimitUserIDList: e3 }) : (s2._updateConvGroupProfile(c2), C({ successUserIDList: t3, failureUserIDList: n2, existedUserIDList: o2, overLimitUserIDList: e3, group: c2 })); }).catch(function(e3) { return u2.setError(e3).end(), M.e("".concat(r2, " failed. error:"), e3), D(e3); })); } }, { key: "deleteGroupMember", value: function(e2) { var t2, n2, o2 = this, i2 = "".concat(this._n, ".").concat("deleteGroupMember"), a2 = e2.groupID, s2 = e2.userIDList, r2 = this._grpM.getLocalGroupProfile(a2); return N(r2) ? D({ code: L.CANNOT_FIND_GRP }) : Ot(r2.type) ? this._grpM.canIUse(_.AV_BAN_MBR) ? this._banAVChatRoomMember(e2) : this._grpM.noUse("deleteGroupMember") : (t2 = "groupID:".concat(a2, " ").concat(5 < s2.length ? "userIDList.length:".concat(s2.length) : "userIDList:".concat(s2)), M.l("".concat(i2, " groupID:").concat(a2, " userIDList:"), s2), (n2 = new G("deleteGroupMember")).setMessage(t2), this._grpM.req({ P: k.DEL_GRP_MBR, data: e2 }).then(function() { return n2.end(), M.l("".concat(i2, " ok")), o2._updateConvGroupProfile(r2), o2.deleteLocalGroupMembers(a2, s2), C({ group: r2, userIDList: s2 }); }).catch(function(e3) { return n2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); })); } }, { key: "_updateConvGroupProfile", value: function(e2) { this._grpM.get(11).updateConvGroupProfile([e2]); } }, { key: "_banAVChatRoomMember", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("_banAVChatRoomMember"), o2 = e2.groupID, i2 = e2.userIDList, a2 = "groupID:".concat(o2, " ").concat(5 < i2.length ? "userIDList.length:".concat(i2.length) : "userIDList:".concat(i2)), s2 = new G("_banAVChatRoomMember"), r2 = (s2.setMessage(a2), M.l("".concat(n2, " groupID:").concat(o2, " userIDList:"), i2), this._grpM.getLocalGroupProfile(o2)); return N(e2.duration) || 0 === e2.duration ? D({ code: L.BAN_DURATION_INVALID }) : this._grpM.req({ P: k.BAN_AV_MBR, data: e2 }).then(function() { return s2.end(), M.l("".concat(n2, " ok")), t2.deleteLocalGroupMembers(o2, i2), C({ group: r2, userIDList: i2 }); }).catch(function(e3) { return s2.setError(e3).end(), M.e("".concat(n2, " failed. error:"), e3), D(e3); }); } }, { key: "setGroupMemberMuteTime", value: function(e2) { var t2, n2, o2 = this, i2 = e2.groupID, a2 = e2.userID, e2 = e2.muteTime, s2 = "".concat(this._n, ".").concat("setGroupMemberMuteTime"); return a2 === this._grpM.getMyUserID() ? D({ code: L.CANNOT_MUTE_SELF }) : (t2 = "groupID:".concat(i2, " userID:").concat(a2, " muteTime:").concat(e2), M.l("".concat(s2, " ").concat(t2)), (n2 = new G("setGroupMemberMuteTime")).setMessage(t2), this.modifyGroupMemberInfo({ groupID: i2, userID: a2, muteTime: e2 }).then(function(e3) { n2.end(), M.l("".concat(s2, " ok")); var t3 = o2._grpM.getLocalGroupProfile(i2); return C({ group: t3, member: e3 }); }).catch(function(e3) { return n2.setError(e3).end(), M.e("".concat(s2, " failed. error:"), e3), D(e3); })); } }, { key: "setGroupMemberRole", value: function(e2) { var t2, n2, o2 = "".concat(this._n, ".").concat("setGroupMemberRole"), i2 = e2.groupID, a2 = e2.userID, e2 = e2.role, s2 = "groupID:".concat(i2, " userID:").concat(a2, " role:").concat(e2), r2 = this._grpM.getLocalGroupProfile(i2); return r2 && r2.selfInfo.role !== A.GRP_MBR_ROLE_OWNER ? D({ code: L.NOT_OWNER }) : (t2 = [A.GRP_MBR_ROLE_ADMIN, A.GRP_MBR_ROLE_MEMBER], Nt({ groupID: i2 }) && t2.push(A.GRP_MBR_ROLE_CUSTOM), t2.indexOf(e2) < 0 ? D({ code: L.INVALID_MEMBER_ROLE }) : a2 === this._grpM.getMyUserID() ? D({ code: L.CANNOT_SET_SELF_MEMBER_ROLE }) : ((n2 = new G("setGroupMemberRole")).setMessage(s2), M.l("".concat(o2, " ").concat(s2)), this.modifyGroupMemberInfo({ groupID: i2, userID: a2, role: e2 }).then(function(e3) { return n2.end(), M.l("".concat(o2, " ok")), C({ group: r2, member: e3 }); }).catch(function(e3) { return n2.setError(e3).end(), M.e("".concat(o2, " failed. error:"), e3), D(e3); }))); } }, { key: "_filterProfanity", value: function(e2, t2) { var n2, o2 = this._grpM.get(29); return !o2 || (n2 = (o2 = o2.filterText(t2[e2], "group_member_profile")).isAllowedToSend, o2 = o2.modifiedText, true === n2 && (t2[e2] = o2, true)); } }, { key: "setGroupMemberNameCard", value: function(e2) { var n2, o2, i2, t2, a2, s2 = this, r2 = "setGroupMemberNameCard", c2 = "".concat(this._n, ".").concat(r2); return e2.nameCard && false === this._filterProfanity("nameCard", e2) ? D({ code: L.PROFANITY_FOUND }) : (n2 = e2.groupID, t2 = e2.userID, o2 = void 0 === t2 ? this._grpM.getMyUserID() : t2, i2 = e2.nameCard, t2 = "groupID:".concat(n2, " userID:").concat(o2, " nameCard:").concat(i2), M.l("".concat(c2, " ").concat(t2)), (e2 = this._grpM.getLocalGroupProfile(n2)) && Ot(e2.type) ? D({ code: e2 = L.OPERATION_NOT_SUPPORTED_IN_AV, message: this._grpM.getErrMsg(e2, r2) }) : ((a2 = new G(r2)).setMessage(t2), this.modifyGroupMemberInfo({ groupID: n2, userID: o2, nameCard: i2 }).then(function(e3) { M.l("".concat(c2, " ok")), a2.end(); var t3 = s2._grpM.getLocalGroupProfile(n2); return o2 === s2._grpM.getMyUserID() && t3 && t3.setSelfNameCard(i2), C({ group: t3, member: e3 }); }).catch(function(e3) { return a2.setError(e3).end(), M.e("".concat(c2, " failed. error:"), e3), D(e3); }))); } }, { key: "setGroupMemberCustomField", value: function(e2) { var n2, o2 = this, t2 = "setGroupMemberCustomField", i2 = "".concat(this._n, ".").concat(t2), a2 = e2.groupID, s2 = e2.userID, s2 = void 0 === s2 ? this._grpM.getMyUserID() : s2, e2 = e2.memberCustomField, r2 = "groupID:".concat(a2, " userID:").concat(s2, " memberCustomField:").concat(JSON.stringify(e2)), c2 = (M.l("".concat(i2, " ").concat(r2)), this._grpM.getLocalGroupProfile(a2)); return c2 && Ot(c2.type) ? D({ code: c2 = L.OPERATION_NOT_SUPPORTED_IN_AV, message: this._grpM.getErrMsg(c2, t2) }) : ((n2 = new G(t2)).setMessage(r2), this.modifyGroupMemberInfo({ groupID: a2, userID: s2, memberCustomField: e2 }).then(function(e3) { n2.end(), M.l("".concat(i2, " ok")); var t3 = o2._grpM.getLocalGroupProfile(a2); return C({ group: t3, member: e3 }); }).catch(function(e3) { return n2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); })); } }, { key: "modifyGroupMemberInfo", value: function(t2) { var n2 = this, o2 = t2.groupID, i2 = t2.userID, e2 = void 0; return Gt(o2) && (o2 = Jt(e2 = o2)), this._grpM.req({ P: k.MODIFY_GRP_MBR_INFO, data: y(y({}, t2), {}, { groupID: o2, topicID: e2 }) }).then(function() { var e3; return n2.hasLocalGroupMember(o2, i2) ? (e3 = n2.getLocalGroupMemberInfo(o2, i2), N(t2.muteTime) || e3.updateMuteUntil(t2.muteTime), N(t2.role) || e3.updateRole(t2.role), N(t2.nameCard) || e3.updateNameCard(t2.nameCard), N(t2.memberCustomField) || e3.updateMemberCustomField(t2.memberCustomField), e3) : (e3 = n2._grpM.getLocalGroupProfile(o2)) && !Ot(e3.type) ? n2.getGroupMemberProfile({ groupID: o2, userIDList: [i2] }).then(function(e4) { return Y(e4.data.memberList, 1)[0]; }) : void 0; }); } }, { key: "markGroupMemberList", value: function(e2) { var o2 = "".concat(this._n, ".").concat("markGroupMemberList"), t2 = e2.groupID, n2 = e2.markType, i2 = e2.enableMark, e2 = e2.userIDList, a2 = void 0 === e2 ? [] : e2, e2 = "groupID:".concat(t2, " markType:").concat(n2, " enableMark:").concat(i2, " userIDList count:").concat(a2.length), s2 = (M.l("".concat(o2, " ").concat(e2)), 2), r2 = [], i2 = (true === i2 && (s2 = 1), p(a2)), c2 = (500 < a2.length && (i2 = a2.slice(0, 500), M.w("".concat(o2, " ").concat($t(500)))), i2.forEach(function(e3) { r2.push({ userID: e3, markType: [n2] }); }), i2 = null, new G("markGroupMemberList")); return c2.setMessage(e2), this._grpM.req({ P: k.MARK_AV_MBR_INFO, data: { groupID: t2, operationType: s2, memberList: r2 } }).then(function(e3) { var e3 = e3.data.memberList, e3 = void 0 === e3 ? [] : e3, t3 = [], n3 = [], e3 = (e3.length === a2.length ? t3.push.apply(t3, p(a2)) : (e3.forEach(function(e4) { t3.push(e4.userID); }), a2.forEach(function(e4) { t3.includes(e4) || n3.push(e4); })), "success count:".concat(t3.length, " fail count:").concat(n3.length)); return c2.setMessage(e3).end(), M.l("".concat(o2, " ok. ").concat(e3)), C({ successUserIDList: t3, failureUserIDList: n3 }); }).catch(function(e3) { return c2.setError(e3).end(), M.e("".concat(o2, " failed. error:"), e3), D(e3); }); } }, { key: "_getGroupMemberProfileAdvance", value: function(e2) { return this._grpM.req({ P: k.GET_GRP_MBR_PROFILE, data: y(y({}, e2), {}, { memberInfoFilter: e2.memberInfoFilter || this.DEFAULT_MEMBER_INFO_FILTER }) }); } }, { key: "_updateLocalGroupMemberMap", value: function(t2, e2) { var n2 = this; return O(e2) && 0 !== e2.length ? e2.map(function(e3) { return n2.hasLocalGroupMember(t2, e3.userID) ? n2.getLocalGroupMemberInfo(t2, e3.userID).updateMember(e3) : n2.setLocalGroupMember(t2, new fi(e3)), n2.getLocalGroupMemberInfo(t2, e3.userID); }) : []; } }, { key: "deleteLocalGroupMembers", value: function(e2, t2) { var n2 = this.groupMemberListMap.get(e2); n2 && t2.forEach(function(e3) { n2.delete(e3); }); } }, { key: "getLocalGroupMemberInfo", value: function(e2, t2) { return this.groupMemberListMap.has(e2) ? this.groupMemberListMap.get(e2).get(t2) : null; } }, { key: "setLocalGroupMember", value: function(e2, t2) { this.groupMemberListMap.has(e2) ? this.groupMemberListMap.get(e2).set(t2.userID, t2) : (t2 = (/* @__PURE__ */ new Map()).set(t2.userID, t2), this.groupMemberListMap.set(e2, t2)); } }, { key: "getLocalGroupMemberList", value: function(e2) { return this.groupMemberListMap.get(e2); } }, { key: "hasLocalGroupMember", value: function(e2, t2) { return this.groupMemberListMap.has(e2) && this.groupMemberListMap.get(e2).has(t2); } }, { key: "hasLocalGroupMemberMap", value: function(e2) { return this.groupMemberListMap.has(e2); } }, { key: "reset", value: function() { this.groupMemberListMap.clear(); } }]), Bi), vi = [17, 18, 20], Ii = (e(Hi, [{ key: "onNewGroupSystemNotice", value: function(e2) { var t2 = e2.dataList, n2 = e2.isSyncingEnded, e2 = e2.isInstantMessage, t2 = (M.d("".concat(this._n, ".onReceiveSystemNotice count:").concat(t2.length)), this._assembly({ notifiesList: t2, isInstantMessage: e2 })), o2 = t2.eventDataList, t2 = t2.result; 0 < o2.length && (this._grpM.get(11).onNewMessage({ conversationOptionsList: o2, isInstantMessage: e2 }), this._onReceivedGroupSystemNotice({ result: t2, isInstantMessage: e2 })), e2 ? 0 < t2.length && this._grpM.emitOEvt(h.MESSAGE_RECEIVED, t2) : true === n2 && this._clearGroupSystemNotice(); } }, { key: "_assembly", value: function(e2) { for (var t2 = e2.notifiesList, n2 = e2.isInstantMessage, o2 = null, i2 = t2.length, a2 = 0, s2 = [], r2 = { conversationID: A.CONV_SYSTEM, unreadCount: 0, type: A.CONV_SYSTEM, subType: null, lastMessage: null }, a2 = 0; a2 < i2; a2++) { var c2 = t2[a2], u2 = c2.groupProfile, l2 = u2.communityType, u2 = u2.topicID, u2 = void 0 === u2 ? void 0 : u2, d2 = c2.elements, p2 = d2.topicIDList, p2 = void 0 === p2 ? void 0 : p2, d2 = d2.operationType; if (!(2 !== (void 0 === l2 ? 0 : l2) || S(u2) && S(p2))) { if (vi.includes(d2)) { this._handleTopicSystemNotice(c2); continue; } S(u2) || (c2.to = u2); } 15 !== c2.elements.operationType && (c2.currentUser = this._grpM.getMyUserID(), c2.conversationType = A.CONV_SYSTEM, c2.conversationID = A.CONV_SYSTEM, (o2 = new Do(c2)).setElement({ type: A.MSG_GRP_SYS_NOTICE, content: y(y({}, c2.elements), {}, { groupProfile: y({}, c2.groupProfile) }) }), o2.isSystemMessage = true, (1 === o2.sequence && 1 === o2.random || 2 === o2.sequence && 2 === o2.random) && (o2.sequence = ft(), o2.random = ft(), o2.generateMessageID(), M.l("".concat(this._n, "._assembly regenerate ID:").concat(o2.ID))), this._grpM.get(11).pushIntoNoticeResult(s2, o2)) && (n2 ? r2.unreadCount++ : o2.setIsRead(true), r2.subType = o2.conversationSubType); } return r2.lastMessage = s2[s2.length - 1], { eventDataList: 0 < s2.length ? [r2] : [], result: s2 }; } }, { key: "_clearGroupSystemNotice", value: function() { var a2 = this; this._getPendencyList().then(function(e2) { e2.forEach(function(e3) { a2.pendencyMap.set("".concat(e3.from, "_").concat(e3.groupID, "_").concat(e3.to), e3); }); var e2 = a2._grpM.get(11).getLocalMessageList(A.CONV_SYSTEM), i2 = []; e2.forEach(function(e3) { var t2 = e3.payload, n2 = t2.operatorID, o2 = t2.operationType, t2 = t2.groupProfile; 1 === o2 && (o2 = "".concat(n2, "_").concat(t2.groupID, "_").concat(t2.to), n2 = a2.pendencyMap.get(o2)) && R(n2.handled) && 0 !== n2.handled && i2.push(e3); }), a2.deleteGroupSystemNotice({ messageList: i2 }); }); } }, { key: "deleteGroupSystemNotice", value: function(e2) { var n2 = this, o2 = "".concat(this._n, ".deleteGroupSystemNotice"); return O(e2.messageList) && 0 !== e2.messageList.length ? (M.l("".concat(o2, " ") + e2.messageList.map(function(e3) { return e3.ID; })), this._grpM.req({ P: k.DEL_GRP_SYSTEM_NOTICE, data: { messageListToDelete: e2.messageList.map(function(e3) { return { from: A.CONV_SYSTEM, messageSeq: e3.clientSequence, messageRandom: e3.random }; }) } }).then(function() { M.l("".concat(o2, " ok")); var t2 = n2._grpM.get(11); return e2.messageList.forEach(function(e3) { t2.deleteLocalMessage(e3); }), C(); }).catch(function(e3) { return M.e("".concat(o2, " error:"), e3), D(e3); })) : T(); } }, { key: "_getPendencyList", value: function() { var n2 = this, e2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, t2 = e2.type, o2 = e2.startTime, e2 = e2.limit; return this._grpM.req({ P: k.GET_GRP_PENDENCY, data: { type: void 0 === t2 ? void 0 : t2, startTime: void 0 === o2 ? 0 : o2, limit: void 0 === e2 ? 20 : e2, handleAccount: this._grpM.getMyUserID() } }).then(function(e3) { var t3 = e3.data.pendencyList; return 0 !== e3.data.nextStartTime ? n2._getPendencyList({ startTime: e3.data.nextStartTime }).then(function(e4) { return [].concat(p(t3), p(e4)); }) : t3; }); } }, { key: "getGroupApplicationList", value: function() { var n2 = this; return this._getPendencyList().then(function(t2) { return n2._getPendencyList({ type: A.GRP_COMMUNITY }).then(function(e2) { return t2.push.apply(t2, p(e2)), n2._handlePendencyResult(t2); }).catch(function(e2) { return n2._handlePendencyResult(t2); }); }); } }, { key: "_handlePendencyResult", value: function(e2) { var t2 = this, n2 = []; return e2.forEach(function(e3) { t2.pendencyMap.set("".concat(e3.from, "_").concat(e3.groupID, "_").concat(e3.to), e3), 0 === e3.handled && n2.push({ applicant: e3.from, applicantNick: e3.fromUserNickName, groupName: e3.groupName, groupID: e3.groupID, authentication: e3.authentication, messageKey: e3.time, applicationType: e3.applicationType, userID: e3.userID, note: e3.note }); }), T({ applicationList: n2 }); } }, { key: "_onReceivedGroupSystemNotice", value: function(e2) { var t2 = this, n2 = e2.result; e2.isInstantMessage && n2.forEach(function(e3) { switch (e3.payload.operationType) { case 1: break; case 2: t2._onApplyJoinGroup(e3); break; case 3: break; case 4: t2._onMemberKicked(e3); break; case 5: t2._onGroupDismissed(e3); break; case 6: break; case 7: t2._onInviteGroup(e3); break; case 8: t2._onQuitGroup(e3); break; case 9: t2._onSetManager(e3); break; case 10: t2._onDeleteManager(e3); break; case 11: case 12: case 15: break; case 20: t2._onMessageRemindTypeSynced(e3); break; case 21: t2._grpM.onAVChatRoomMemberBanned(e3); } }); } }, { key: "_onApplyJoinGroup", value: function(e2) { var t2 = this, e2 = e2.payload.groupProfile, n2 = e2.groupID, e2 = e2.groupType, o2 = this._grpM.hasLocalGroup(n2); M.l("".concat(this._n, "._onApplyJoinGroup groupID:").concat(n2, " groupType:").concat(e2, " hasGroup:").concat(o2)), o2 || Ot(e2) || this._grpM.getGroupProfile({ groupID: n2 }).then(function(e3) { var e3 = e3.data.group; e3 && (t2._grpM.updateGroupMap([e3]), e3 = !e3.isSupportTopic, t2._grpM.emitGroupListUpdate(true, e3)); }); } }, { key: "_onMemberKicked", value: function(e2) { e2 = e2.payload.groupProfile.groupID; this._grpM.hasLocalGroup(e2) && this._grpM.deleteLocalGroupAndConversation(e2); } }, { key: "_onGroupDismissed", value: function(e2) { var e2 = e2.payload.groupProfile.groupID, t2 = (this._grpM.hasLocalGroup(e2) && this._grpM.deleteLocalGroupAndConversation(e2), this._grpM._AVChatRoomHandler); t2 && t2.checkJoinedAVChatRoomByID(e2) && t2.reset(e2); } }, { key: "_onInviteGroup", value: function(e2) { var t2 = this, n2 = e2.payload.groupProfile.groupID, e2 = this._grpM.hasLocalGroup(n2); M.l("".concat(this._n, "._onInviteGroup groupID:").concat(n2, " hasGroup:").concat(e2)), this._grpM.getGroupProfile({ groupID: n2 }).then(function() { t2._grpM.emitGroupListUpdate(), t2._grpM.get(11).pullMsgOnInvite("".concat(A.CONV_GROUP).concat(n2)); }); } }, { key: "_onQuitGroup", value: function(e2) { var e2 = e2.payload.groupProfile, t2 = e2.groupID, e2 = e2.groupType, n2 = this._grpM.hasLocalGroup(t2); M.l("".concat(this._n, "._onQuitGroup groupID:").concat(t2, " groupType:").concat(e2, " hasGroup:").concat(n2)), n2 && this._grpM.deleteLocalGroupAndConversation(t2); } }, { key: "_onSetManager", value: function(e2) { var e2 = e2.payload.groupProfile, t2 = e2.to, e2 = e2.groupID, e2 = this._grpM.getGroupMemberHandler().getLocalGroupMemberInfo(e2, t2); e2 && e2.updateRole(A.GRP_MBR_ROLE_ADMIN); } }, { key: "_onDeleteManager", value: function(e2) { var e2 = e2.payload.groupProfile, t2 = e2.to, e2 = e2.groupID, e2 = this._grpM.getGroupMemberHandler().getLocalGroupMemberInfo(e2, t2); e2 && e2.updateRole(A.GRP_MBR_ROLE_MEMBER); } }, { key: "_onMessageRemindTypeSynced", value: function(e2) { var t2 = e2.payload.groupProfile.groupID, e2 = e2.payload.messageRemindType; this._grpM.get(11).onGroupMsgRemindTypeUpdated({ groupID: t2, messageRemindType: e2 }); } }, { key: "_handleTopicSystemNotice", value: function(e2) { var t2 = e2.groupProfile, n2 = t2.groupID, t2 = t2.topicID, e2 = e2.elements, o2 = e2.operationType, i2 = e2.topicIDList, e2 = e2.messageRemindType, a2 = this._grpM.get(10); 17 === o2 ? a2.onTopicCreated({ groupID: n2, topicID: t2 }) : 18 === o2 ? a2.onTopicDeleted({ groupID: n2, topicIDList: i2 }) : 20 === o2 && a2.onMessageRemindTypeUpdated({ groupID: n2, topicID: t2, messageRemindType: e2 }); } }, { key: "reset", value: function() { this.pendencyMap.clear(); } }]), Hi), Mi = ["relayFlag"], yi = (t(Vi, u), Xo = n(Vi), e(Vi, [{ key: "_onCloudConfig", value: function() { var e2 = this.getCloudConfig("polling_interval"), t2 = this.getCloudConfig("polling_interval_plus"), n2 = this.getCloudConfig("polling_no_msg_count"), o2 = this.getCloudConfig("polling_simplified_msg"), i2 = this.getCloudConfig("paging_grp_count"); M.l("".concat(this._n, "._onCloudConfig pollingInterval:").concat(e2) + " pollingIntervalPlus:".concat(t2, " pollingNoMessageCount:").concat(n2) + " pollingSimplifiedMessage:".concat(o2, " pagingGroupCount:").concat(i2)), this._AVChatRoomHandler.setPollingInterval(e2), this._AVChatRoomHandler.setPollingIntervalPlus(t2), this._AVChatRoomHandler.setPollingNoMessageCount(n2), this._AVChatRoomHandler.setPollingSimplifiedMessage(o2), this._commonGroupHandler.setPagingGroupCount(i2); } }, { key: "onCheckTimer", value: function(e2) { this.isLoggedIn() && (this._commonGroupHandler.onCheckTimer(e2), this._groupTipsHandler.onCheckTimer(e2)); } }, { key: "guardForAVChatRoom", value: function(t2) { var n2, o2 = this; return t2.conversationType !== A.CONV_GROUP || (n2 = Gt(t2.to) ? Jt(t2.to) : t2.to, this.hasLocalGroup(n2)) ? T() : this.getGroupProfile({ groupID: n2 }).then(function(e2) { var e2 = e2.data.group.type; return M.l("".concat(o2._n, ".guardForAVChatRoom. groupID:").concat(n2, " type:").concat(e2)), e2 === A.GRP_AVCHATROOM ? D(new E({ code: e2 = L.MSG_SEND_FAIL_NOT_IN_AV, message: o2.getErrMsg(e2, t2.from, n2), data: { message: t2 } })) : T(); }); } }, { key: "checkJoinedAVChatRoomByID", value: function(e2) { return this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e2); } }, { key: "onNewMessage", value: function(e2) { this._commonGroupHandler.onNewMessage(e2); } }, { key: "updateNextMessageSeq", value: function(e2) { var n2, o2 = this; O(e2) && (n2 = this.get(10), e2.forEach(function(e3) { var t2 = e3.conversationID.replace(A.CONV_GROUP, ""); Gt(t2) && n2.updateUnreadCountAndLastMsg(t2, e3.lastMessage), o2.groupMap.has(t2) && (o2.groupMap.get(t2).nextMessageSeq = e3.lastMessage.sequence + 1); })); } }, { key: "onNewGroupTips", value: function(e2) { this._groupTipsHandler.onNewGroupTips(e2); } }, { key: "onMsgRevoked", value: function(e2) { this._commonGroupHandler.onMsgRevoked(e2, !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]); } }, { key: "onNewGroupSystemNotice", value: function(e2) { this._groupSystemNoticeHandler.onNewGroupSystemNotice(e2); } }, { key: "onMsgReadNotice", value: function(e2) { var a2 = this; e2.dataList.forEach(function(e3) { var i2, e3 = e3.elements.groupMessageReadNotice; N(e3) || (i2 = a2.get(11), e3.forEach(function(e4) { var t2 = e4.groupID, n2 = e4.topicID, n2 = void 0 === n2 ? void 0 : n2, e4 = e4.lastMessageSeq, t2 = (M.l("".concat(a2._n, ".onMsgReadNotice groupID:").concat(t2, " lastMessageSeq:").concat(e4)), "".concat(A.CONV_GROUP).concat(t2)), o2 = true; S(n2) || (t2 = "".concat(A.CONV_GROUP).concat(n2), o2 = false), i2.updateIsReadAfterReadReport({ conversationID: t2, lastMessageSeq: e4 }), i2.updateUnreadCount(t2, o2), i2.clearGroupAtInfoList(t2, o2); })); }); } }, { key: "onReadReceiptList", value: function(e2) { var o2 = this; M.l("".concat(this._n, ".onReadReceiptList options:"), e2), e2.dataList.forEach(function(e3) { var t2 = e3.groupProfile, e3 = e3.elements, t2 = t2.groupID, n2 = o2.get(11), e3 = e3.readReceiptList; n2.updateReadReceiptInfo({ groupID: t2, readReceiptList: e3 }); }); } }, { key: "onMsgModified", value: function(e2) { M.l("".concat(this._n, ".onMsgModified options:"), e2); var t2 = this.get(11); e2.dataList.forEach(function(e3) { t2.onMessageModified(y(y({}, e3), {}, { conversationType: A.CONV_GROUP, to: e3.topicID || e3.groupID })); }); } }, { key: "deleteGroupSystemNotice", value: function(e2) { this._groupSystemNoticeHandler.deleteGroupSystemNotice(e2); } }, { key: "initGroupMap", value: function(e2) { this.groupMap.set(e2.groupID, new oi(e2)); } }, { key: "clearGroupMap", value: function() { this.groupMap.clear(); } }, { key: "deleteGroup", value: function(e2) { this.groupMap.delete(e2); } }, { key: "updateGroupMap", value: function(e2) { var t2, n2 = this, o2 = this.get(11); e2.forEach(function(e3) { t2 = e3.groupID, n2.groupMap.has(t2) ? n2.groupMap.get(t2).updateGroup(e3) : (n2.groupMap.set(t2, new oi(e3)), o2.deleteGroupRoamingInfo(t2)); }); var i2, a2 = this.getMyUserID(), s2 = Z(this.groupMap); try { for (s2.s(); !(i2 = s2.n()).done; ) { var r2 = Y(i2.value, 2)[1]; r2.selfInfo.userID = a2, "Owner" === r2.selfInfo.role && (r2.ownerID = a2); } } catch (e3) { s2.e(e3); } finally { s2.f(); } } }, { key: "getGroupMap", value: function() { return this.groupMap; } }, { key: "getLocalGroupList", value: function() { return p(this.groupMap.values()).filter(function(e2) { return e2.type !== A.GRP_ROOM && e2.type !== A.GRP_LIVE; }); } }, { key: "getLocalGroupProfile", value: function(e2) { return this.groupMap.get(e2); } }, { key: "sortLocalGroupList", value: function() { var e2 = p(this.groupMap).filter(function(e3) { e3 = Y(e3, 2); return e3[0], !S(e3[1].lastMessage); }); e2.sort(function(e3, t2) { return t2[1].lastMessage.lastTime - e3[1].lastMessage.lastTime; }), this.groupMap = new Map(p(e2)); } }, { key: "updateGroupLastMessage", value: function(e2) { this._commonGroupHandler.updateLastMsg(e2); } }, { key: "emitGroupListUpdate", value: function() { var e2 = !(0 < arguments.length && void 0 !== arguments[0]) || arguments[0], t2 = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1], n2 = this.getLocalGroupList(); e2 && this.emitOEvt(h.GROUP_LIST_UPDATED), t2 && (e2 = JSON.parse(JSON.stringify(n2)), this.get(11).updateConvGroupProfile(e2)); } }, { key: "getMyNameCardByGroupID", value: function(e2) { e2 = this.getLocalGroupProfile(e2); return e2 ? e2.selfInfo.nameCard : ""; } }, { key: "isPagingGetCompleted", value: function() { return this._commonGroupHandler.isPagingGetCompleted(); } }, { key: "getMsgRemindType", value: function(e2) { var n2 = this; return !O(e2) || 0 === e2.length || 0 === (e2 = e2.filter(function(e3) { return !Ot(n2.getLocalGroupProfile(e3).type); })).length ? Promise.resolve() : (M.l("".concat(this._n, ".getMsgRemindType groupIDList:").concat(e2)), this.getGroupProfileAdvance({ groupIDList: e2, responseFilter: { memberInfoFilter: ["MsgFlag"] } }).then(function(e3) { var e3 = e3.data.successGroupList, t2 = n2.get(11); e3.forEach(function(e4) { t2.onGroupMsgRemindTypeUpdated({ groupID: e4.groupID, messageRemindType: O(e4.members) ? e4.members[0].messageRemindType : "" }); }); })); } }, { key: "getGroupList", value: function() { return this._commonGroupHandler.getGroupList(); } }, { key: "syncCommunityWithTopic", value: function() { return this._commonGroupHandler.syncGroupList(true); } }, { key: "getGroupProfile", value: function(t2) { var n2 = this, o2 = "".concat(this._n, ".").concat("getGroupProfile"), i2 = new G("getGroupProfile"), a2 = t2.groupID, e2 = t2.groupCustomFieldFilter, e2 = (M.l("".concat(o2, " groupID:").concat(a2)), { groupIDList: [a2], responseFilter: { groupBaseInfoFilter: p(ce), groupCustomFieldFilter: e2, memberInfoFilter: [].concat(p(ue), ["NameCard"]) } }); return this.getGroupProfileAdvance(e2).then(function(e3) { var e3 = e3.data, t3 = e3.successGroupList, e3 = e3.failureGroupList; return M.l("".concat(o2, " ok")), 0 < e3.length ? D(e3[0]) : ((e3 = Ot(t3[0].type) && !n2.hasLocalGroup(a2) ? new oi(t3[0]) : (n2.updateGroupMap(t3), n2.getLocalGroupProfile(a2))).isSupportTopic || n2.get(11).updateConvGroupProfile([e3]), i2.setMessage("groupID:".concat(a2, " type:").concat(e3.type, " muteAllMembers:").concat(e3.muteAllMembers, " ownerID:").concat(e3.ownerID)).end(), C({ group: e3 })); }).catch(function(e3) { return i2.setError(e3).setMessage("groupID:".concat(t2.groupID)).end(), M.e("".concat(o2, " failed. error:"), e3), D(e3); }); } }, { key: "getGroupProfileAdvance", value: function(e2) { var t2, n2 = "".concat(this._n, ".getGroupProfileAdvance"), o2 = e2.groupIDList, i2 = (O(o2) && 50 < o2.length && (this.warn("GetGroupProfileLimit"), o2.length = 50), []), a2 = [], o2 = (o2.forEach(function(e3) { (Nt({ groupID: e3 }) ? a2 : i2).push(e3); }), []); return 0 < i2.length && (t2 = this._getGroupProfileAdvance(y(y({}, e2), {}, { groupIDList: i2 })), o2.push(t2)), 0 < a2.length && (t2 = this._getGroupProfileAdvance(y(y({}, e2), {}, { groupIDList: a2, relayFlag: 0 < i2.length })), o2.push(t2)), Promise.all(o2).then(function(e3) { var t3 = [], n3 = []; return e3.forEach(function(e4) { t3.push.apply(t3, p(e4.successGroupList)), n3.push.apply(n3, p(e4.failureGroupList)); }), C({ successGroupList: t3, failureGroupList: n3 }); }).catch(function(e3) { return M.e("".concat(n2, " failed. error:"), e3), D(e3); }); } }, { key: "_getGroupProfileAdvance", value: function(t2) { var n2 = this, e2 = t2.relayFlag, o2 = void 0 !== e2 && e2, i2 = K(t2, Mi); return this.req({ P: k.GET_GRP_PROFILE, data: i2 }).then(function(e3) { M.l("".concat(n2._n, "._getGroupProfileAdvance ok. options:"), i2); e3 = e3.data.groups; return { successGroupList: e3.filter(function(e4) { return N(e4.errorCode) || 0 === e4.errorCode; }), failureGroupList: e3.filter(function(e4) { return e4.errorCode && 0 !== e4.errorCode; }).map(function(e4) { return new E({ code: e4.errorCode, message: e4.errorInfo, data: { groupID: e4.groupID } }); }) }; }).catch(function(e3) { return o2 && Nt({ groupID: t2.groupIDList[0] }) ? { successGroupList: [], failureGroupList: [] } : D(e3); }); } }, { key: "createGroup", value: function(s2) { var r2 = this, e2 = [A.GRP_PUBLIC, A.GRP_WORK, A.GRP_MEETING, A.GRP_AVCHATROOM, A.GRP_COMMUNITY], c2 = "".concat(this._n, ".").concat("createGroup"), t2 = s2.type, n2 = s2.groupID; if (s2.name && false === this._filterProfanity("name", s2)) return D({ code: L.PROFANITY_FOUND }); if (s2.introduction && false === this._filterProfanity("introduction", s2)) return D({ code: L.PROFANITY_FOUND }); if (s2.notification && false === this._filterProfanity("notification", s2)) return D({ code: L.PROFANITY_FOUND }); if (!e2.includes(t2)) return D({ code: L.ILLEGAL_GRP_TYPE }); if (!Nt({ type: t2 })) { if (!S(n2) && Nt({ groupID: n2 })) return D({ code: L.ILLEGAL_GRP_ID }); s2.isSupportTopic = void 0; } if (Ot(t2) && !N(s2.memberList) && 0 < s2.memberList.length && (s2.memberList = void 0), this._canIUseJoinOption(t2) || N(s2.joinOption) || (s2.joinOption = void 0), Nt({ type: t2 })) { if (!S(n2) && !Nt({ groupID: n2 })) return D({ code: L.ILLEGAL_GRP_ID }); s2.isSupportTopic = true === s2.isSupportTopic ? 1 : 0; } var u2 = new G("createGroup"), l2 = (M.l("".concat(c2, " options:"), s2), null), d2 = []; return this.req({ P: k.CREATE_GRP, data: y(y({}, s2), {}, { ownerID: this.getMyUserID(), webPushFlag: 1 }) }).then(function(e3) { var t3, n3, o2, e3 = e3.data, i2 = e3.groupID, e3 = e3.overLimitUserIDList, a2 = void 0 === e3 ? [] : e3, e3 = (l2 = i2, d2 = a2, "groupType:".concat(s2.type, " groupID:").concat(i2, " overLimitUserIDList:").concat(a2)); return u2.setMessage(e3).end(), M.l("".concat(c2, " ok. ").concat(e3)), s2.type === A.GRP_AVCHATROOM || s2.type === A.GRP_COMMUNITY && 1 === s2.isSupportTopic || (S(s2.memberList) || S(a2) || (s2.memberList = s2.memberList.filter(function(e4) { return -1 === a2.indexOf(e4.userID); })), r2.updateGroupMap([y(y({}, s2), {}, { groupID: i2 })]), e3 = r2.get(2), o2 = "", t3 = 0, s2.type === A.GRP_COMMUNITY ? (o2 = r2.isIntl() ? "Create Community" : "创建社群", t3 = 1) : o2 = r2.isIntl() ? "Create Group" : "创建群组", n3 = r2.get(4).getMyNick(), o2 = e3.createCustomMessage({ to: i2, conversationType: A.CONV_GROUP, payload: { data: JSON.stringify({ businessID: "group_create", content: o2, cmd: t3, opUser: n3 || r2.getMyUserID(), version: 4 }) } }), e3.sendMessageInstance(o2), r2.emitGroupListUpdate()), r2.getGroupProfile({ groupID: i2 }); }).then(function(e3) { var e3 = e3.data.group, t3 = e3.selfInfo, n3 = t3.nameCard, t3 = t3.joinTime; return e3.updateSelfInfo({ nameCard: n3, joinTime: t3, messageRemindType: A.MSG_REMIND_ACPT_AND_NOTE, role: A.GRP_MBR_ROLE_OWNER }), C({ group: e3, overLimitUserIDList: d2 }); }).catch(function(e3) { var t3; return u2.setMessage("groupType:".concat(s2.type)).setError(e3).end(), 10010 === e3.code || 10007 === e3.code ? (r2._silentlyGetGroupProfile(e3.code, l2), r2.updateGroupMap([y(y({}, s2), {}, { groupID: l2 })]), (t3 = r2.getLocalGroupProfile(l2)).selfInfo.role = A.GRP_MBR_ROLE_OWNER, C({ group: t3, overLimitUserIDList: d2 })) : (M.e("".concat(c2, " failed. error:"), e3), D(e3)); }); } }, { key: "dismissGroup", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("dismissGroup"), o2 = "groupID:".concat(e2), i2 = new G("dismissGroup"); return i2.setMessage(o2), M.l("".concat(n2, " ").concat(o2)), this.req({ P: k.DISMISS_GRP, data: { groupID: e2 } }).then(function() { return i2.end(), M.l("".concat(n2, " ok")), t2.deleteLocalGroupAndConversation(e2), t2.checkJoinedAVChatRoomByID(e2) && t2._AVChatRoomHandler.reset(e2), t2._groupAttributesHandler.deleteLocalGroupAttributes(e2), C({ groupID: e2 }); }).catch(function(e3) { return i2.setError(e3).end(), M.e("".concat(n2, " failed. error:"), e3), D(e3); }); } }, { key: "updateGroupProfile", value: function(e2) { var t2, n2, o2 = this, i2 = "".concat(this._n, ".").concat("updateGroupProfile"); return this.hasLocalGroup(e2.groupID) && (t2 = this.getLocalGroupProfile(e2.groupID).type, this._canIUseJoinOption(t2) || N(e2.joinOption) || (M.w("".concat(i2, " joinOption is unavailable for Work/Meeting/AVChatRoom")), e2.joinOption = void 0)), N(e2.muteAllMembers) || (e2.muteAllMembers ? e2.muteAllMembers = "On" : e2.muteAllMembers = "Off"), e2.name && false === this._filterProfanity("name", e2) || e2.introduction && false === this._filterProfanity("introduction", e2) || e2.notification && false === this._filterProfanity("notification", e2) ? D({ code: L.PROFANITY_FOUND }) : ((n2 = new G("updateGroupProfile")).setMessage(JSON.stringify(e2)), M.l("".concat(i2, " groupID:").concat(e2.groupID)), this.req({ P: k.UPDATE_GRP_PROFILE, data: e2 }).then(function() { return n2.end(), M.l("".concat(i2, " ok")), o2.hasLocalGroup(e2.groupID) && o2.groupMap.get(e2.groupID).updateGroup(e2), C({ group: o2.groupMap.get(e2.groupID) }); }).catch(function(e3) { return n2.setError(e3).end(), M.l("".concat(i2, " failed. error:"), e3), D(e3); })); } }, { key: "_filterProfanity", value: function(e2, t2) { var n2, o2 = this.get(29); return !o2 || (n2 = (o2 = o2.filterText(t2[e2], re)).isAllowedToSend, o2 = o2.modifiedText, true === n2 && (t2[e2] = o2, true)); } }, { key: "joinGroup", value: function(t2) { var n2, o2 = this, i2 = t2.groupID, a2 = "".concat(this._n, ".joinGroup"); return this.deleteUnjoinedAVChatRoom(i2), this.hasLocalGroup(i2) ? this.isLoggedIn() ? (n2 = new G("applyJoinGroup"), this.getGroupProfile({ groupID: i2 }).then(function() { return n2.setMessage("groupID:".concat(i2, " joinedStatus:").concat(A.JOIN_STATUS_ALREADY_IN_GROUP)).end(), T({ status: A.JOIN_STATUS_ALREADY_IN_GROUP }); }).catch(function(e2) { return n2.setMessage("groupID:".concat(i2, " unjoined")).end(), M.w("".concat(a2, " ").concat(i2, " was unjoined, now join!")), o2.groupMap.delete(i2), o2.applyJoinGroup(t2); })) : T({ status: A.JOIN_STATUS_ALREADY_IN_GROUP }) : (M.l("".concat(a2, " groupID:").concat(i2)), this.isLoggedIn() ? this.applyJoinGroup(t2) : this._AVChatRoomHandler.joinWithoutAuth(t2)); } }, { key: "applyJoinGroup", value: function(e2) { var c2, u2, l2 = this, d2 = "".concat(this._n, ".").concat("applyJoinGroup"), p2 = e2.groupID; return S(e2.applyMessage) || false !== this._filterProfanity("applyMessage", e2) ? (c2 = new G("applyJoinGroup"), e2 = y({}, e2), (u2 = this.canIUse(_.AV_HISTORY_MSG)) && (e2.historyMessageFlag = 1), this.get(11).deleteTopicRoamingInfo(p2), this.req({ P: k.APPLY_JOIN_GRP, data: e2 }).then(function(e3) { var e3 = e3.data, t2 = e3.joinedStatus, n2 = e3.longPollingKey, o2 = e3.startSeq, i2 = e3.avChatRoomFlag, a2 = e3.avChatRoomKey, s2 = e3.messageList, e3 = "groupID:".concat(p2, " joinedStatus:").concat(t2, " longPollingKey:").concat(n2, " startSeq:").concat(o2) + " avChatRoomFlag:".concat(i2, " canGetAVChatRoomHistoryMsg:").concat(u2, ",") + " historyMsgCount:".concat(S(s2) ? 0 : s2.length); switch (c2.setMessage(e3).end(), M.l("".concat(d2, " ok. ").concat(e3)), t2) { case ot: return C({ status: ot }); case nt: return l2.getGroupProfile({ groupID: p2 }).then(function(e4) { e4 = e4.data.group; return l2._handleJoinResult({ group: e4, avChatRoomFlag: i2, longPollingKey: n2, startSeq: o2, avChatRoomKey: a2, messageList: s2 }); }).catch(function(e4) { var t3; return 10010 === e4.code || 10007 === e4.code ? (l2._silentlyGetGroupProfile(e4.code, p2), t3 = new oi({ groupID: p2 }), l2.updateGroupMap([t3]), l2._handleJoinResult({ group: t3, avChatRoomFlag: i2, longPollingKey: n2, startSeq: o2, avChatRoomKey: a2, messageList: s2 })) : (M.e("".concat(d2, " failed. error:"), e4), D(e4)); }); default: var r2 = new E({ code: L.JOIN_GRP_FAIL }); return M.e("".concat(d2, " failed. error:"), r2), D(r2); } }).catch(function(e3) { return c2.setMessage("groupID:".concat(p2)).setError(e3).end(), M.e("".concat(d2, " failed. error:"), e3), D(e3); })) : D({ code: L.PROFANITY_FOUND }); } }, { key: "_handleJoinResult", value: function(e2) { var t2 = this, n2 = e2.group, o2 = e2.avChatRoomFlag, i2 = e2.longPollingKey, a2 = e2.startSeq, s2 = e2.avChatRoomKey, r2 = e2.messageList, c2 = n2.groupID; return 1 === o2 ? (this.get(11).setCompleted("".concat(A.CONV_GROUP).concat(c2)), this._groupAttributesHandler.initGroupAttributesCache({ groupID: c2, avChatRoomKey: s2 }), this._groupCountersHandler.initGroupCountersCache({ groupID: c2, avChatRoomKey: s2 }), (e2 = N(i2) ? this._AVChatRoomHandler.handleJoinResult({ group: n2 }) : this._AVChatRoomHandler.startRunLoop({ group: n2, longPollingKey: i2, startSeq: a2 })).then(function() { t2._onAVChatRoomHistoryMessage(r2, c2); }), e2) : (this.emitGroupListUpdate(true, false), C({ status: nt, group: n2 })); } }, { key: "quitGroup", value: function(e2) { var t2, n2 = this, o2 = "".concat(this._n, ".").concat("quitGroup"), i2 = "groupID:".concat(e2), a2 = (M.l("".concat(o2, " ").concat(i2)), this.checkJoinedAVChatRoomByID(e2)); return a2 || this.hasLocalGroup(e2) ? a2 && !this.isLoggedIn() ? (M.l("".concat(o2, " anonymously ok. ").concat(i2)), this.deleteLocalGroupAndConversation(e2), this._AVChatRoomHandler.reset(e2), T({ groupID: e2 })) : ((t2 = new G("quitGroup")).setMessage(i2), this.req({ P: k.QUIT_GRP, data: { groupID: e2 } }).then(function() { return t2.end(), M.l("".concat(o2, " ok")), n2.deleteLocalGroupAndConversation(e2), a2 && n2._AVChatRoomHandler.reset(e2), n2._groupAttributesHandler.deleteLocalGroupAttributes(e2), C({ groupID: e2 }); }).catch(function(e3) { return t2.setError(e3).end(), M.e("".concat(o2, " failed. error:"), e3), D(e3); })) : D({ code: L.MEMBER_NOT_IN_GRP }); } }, { key: "searchGroupByID", value: function(e2) { var t2 = "".concat(this._n, ".").concat("searchGroupByID"), n2 = { groupIDList: [e2] }, o2 = new G("searchGroupByID"); return o2.setMessage("groupID:".concat(e2)), M.l("".concat(t2, " groupID:").concat(e2)), this.req({ P: k.SEARCH_GRP, data: n2 }).then(function(e3) { e3 = e3.data.groupProfile; if (0 !== e3[0].errorCode) throw new E({ code: e3[0].errorCode, message: e3[0].errorInfo }); return o2.end(), M.l("".concat(t2, " ok")), C({ group: new oi(e3[0]) }); }).catch(function(e3) { return o2.setError(e3).end(), M.w("".concat(t2, " failed. error:"), e3), D(e3); }); } }, { key: "changeGroupOwner", value: function(i2) { var a2, s2 = this, r2 = "".concat(this._n, ".").concat("changeGroupOwner"); return this.hasLocalGroup(i2.groupID) && this.getLocalGroupProfile(i2.groupID).type === A.GRP_AVCHATROOM ? D({ code: L.CANNOT_CHANGE_OWNER_IN_AV }) : i2.newOwnerID === this.getMyUserID() ? D({ code: L.CANNOT_CHANGE_OWNER_TO_SELF }) : ((a2 = new G("changeGroupOwner")).setMessage("groupID:".concat(i2.groupID, " newOwnerID:").concat(i2.newOwnerID)), M.l("".concat(r2, " groupID:").concat(i2.groupID)), this.req({ P: k.CHANGE_GRP_OWNER, data: i2 }).then(function() { a2.end(), M.l("".concat(r2, " ok")); var e2, t2 = i2.groupID, n2 = i2.newOwnerID, o2 = (s2.groupMap.get(t2).ownerID = n2, s2._groupMemberHandler.getLocalGroupMemberList(t2)); return o2 instanceof Map && (e2 = o2.get(s2.getMyUserID()), N(e2) || (e2.updateRole("Member"), s2.groupMap.get(t2).selfInfo.role = "Member"), e2 = o2.get(n2), N(e2) || e2.updateRole("Owner")), s2.emitGroupListUpdate(true, false), C({ group: s2.groupMap.get(t2) }); }).catch(function(e2) { return a2.setError(e2).end(), M.e("".concat(r2, " failed. error:"), e2), D(e2); })); } }, { key: "getGroupApplicationList", value: function() { return this._groupSystemNoticeHandler.getGroupApplicationList(); } }, { key: "handleGroupApplication", value: function(e2) { var t2, n2, o2, i2, a2, s2 = this, r2 = "".concat(this._n, ".").concat("handleGroupApplication"), c2 = e2.handleAction, u2 = e2.handleMessage, l2 = e2.message, d2 = e2.application, p2 = (l2 ? (t2 = l2.payload.operatorID, n2 = l2.payload.groupProfile.groupID, o2 = l2.payload.authentication, i2 = l2.payload.messageKey) : d2 && (t2 = d2.applicant, n2 = d2.groupID, o2 = d2.authentication, i2 = d2.messageKey), k.HANDLE_GRP_APPLICATION), _2 = (d2 && 2 === d2.applicationType && (p2 = k.HANDLE_INVITE_JOIN_GRP, a2 = d2.userID), new G("handleGroupApplication")); return _2.setMessage("groupID:".concat(n2)), M.l("".concat(r2, " groupID:").concat(n2)), this.req({ P: p2, data: { handleAction: c2, handleMessage: u2, applicant: t2, invitee: a2, groupID: n2, authentication: o2, messageKey: i2 } }).then(function() { return _2.end(), M.l("".concat(r2, " ok")), l2 && s2._groupSystemNoticeHandler.deleteGroupSystemNotice({ messageList: [e2.message] }), C({ group: s2.getLocalGroupProfile(n2) }); }).catch(function(e3) { return _2.setError(e3).end(), M.e("".concat(r2, " failed. error"), e3), D(e3); }); } }, { key: "handleGroupInvitation", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("handleGroupInvitation"), o2 = e2.message.payload, i2 = o2.groupProfile.groupID, a2 = o2.authentication, s2 = o2.messageKey, o2 = o2.operatorID, r2 = e2.handleAction, c2 = new G("handleGroupInvitation"); return c2.setMessage("groupID:".concat(i2, " inviter:").concat(o2, " handleAction:").concat(r2)), M.l("".concat(n2, " groupID:").concat(i2, " inviter:").concat(o2, " handleAction:").concat(r2)), this.req({ P: k.HANDLE_GRP_INVITATION, data: y(y({}, e2), {}, { inviter: o2, groupID: i2, authentication: a2, messageKey: s2 }) }).then(function() { return c2.end(), M.l("".concat(n2, " ok")), t2._groupSystemNoticeHandler.deleteGroupSystemNotice({ messageList: [e2.message] }), C({ group: t2.getLocalGroupProfile(i2) }); }).catch(function(e3) { return c2.setError(e3).end(), M.e("".concat(n2, " failed. error"), e3), D(e3); }); } }, { key: "getGroupOnlineMemberCount", value: function(t2) { var n2 = this, o2 = "".concat(this._n, ".getGroupOnlineMemberCount"), e2 = this._AVChatRoomHandler.checkJoinedAVChatRoomByID(t2), i2 = this.hasLocalGroup(t2); if (M.l("".concat(o2, " groupID:").concat(t2, " isAVChatRoom:").concat(e2, " has:").concat(i2)), e2) return this._AVChatRoomHandler.getGroupOnlineMemberCount(t2); if (!i2) return T({ memberCount: 0 }); e2 = Date.now(); if (this._onlineMemberCountMap.has(t2)) { i2 = this._onlineMemberCountMap.get(t2); if (e2 - i2.lastReqTime <= 6e4) return T({ memberCount: i2.memberCount }); i2.lastReqTime = e2; } return this.requestOnlineCount(t2).then(function(e3) { e3 = e3.data.memberCount, e3 = void 0 === e3 ? 0 : e3; return n2._onlineMemberCountMap.set(t2, { lastReqTime: Date.now(), memberCount: e3 }), M.l("".concat(o2, " ok. groupID:").concat(t2, " memberCount:").concat(e3)), T({ memberCount: e3 }); }).catch(function(e3) { return M.w("".concat(o2, " failed. error:"), e3), Promise.reject(e3); }); } }, { key: "requestOnlineCount", value: function(e2) { return this.req({ P: k.GET_ONLINE_MBR_NUM, data: { groupID: e2 } }); } }, { key: "hasLocalGroup", value: function(e2) { return this.groupMap.has(e2); } }, { key: "deleteLocalGroupAndConversation", value: function(e2) { var t2 = this.checkJoinedAVChatRoomByID(e2), n2 = (M.l("".concat(this._n, ".deleteLocalGroupAndConversation groupID:").concat(e2, " isJoinedAVChatRoom:").concat(t2)), this.get(11)), o2 = "".concat(A.CONV_GROUP).concat(e2); t2 && (this.stopMessageLongPolling({ groupID: e2 }), n2.deleteLocalConv(o2)), Nt({ groupID: e2 }) && (t2 = this.getLocalGroupProfile(e2)) && true === t2.isSupportTopic && this.get(10).deleteTopicListInCommunity(e2), n2.clearUnreadCount(o2), n2.setCompleted(o2), this._deleteLocalGroup(e2), this._onlineMemberCountMap.delete(e2), this.emitGroupListUpdate(true, false); } }, { key: "_deleteLocalGroup", value: function(e2) { this.groupMap.delete(e2), this._groupMemberHandler.deleteGroupMemberList(e2); } }, { key: "sendMessage", value: function(e2, t2) { return O(e2._receiverList) && 0 < e2._receiverList.length && !this.canIUse(_.MSG_TO_SPECIFIED_GRP_MBR) ? this.noUse("Targeted Group Message") : (e2 = this.createGroupMessagePack(e2, t2), this.req(e2)); } }, { key: "createGroupMessagePack", value: function(e2, t2) { var n2 = null, o2 = (t2 && t2.offlinePushInfo && (n2 = t2.offlinePushInfo), ""), i2 = (m(e2.cloudCustomData) && 0 < e2.cloudCustomData.length && (o2 = e2.cloudCustomData), []), a2 = (f(t2) && f(t2.messageControlInfo) && (a2 = (r2 = t2.messageControlInfo).excludedFromUnreadCount, s2 = r2.excludedFromLastMessage, r2 = r2.excludedFromContentModeration, true === a2 && i2.push("NoUnread"), true === s2 && i2.push("NoLastMsg"), true === r2) && i2.push("NoMsgCheck"), void 0), s2 = (O(e2._receiverList) && 0 < e2._receiverList.length && (a2 = e2._receiverList, 50 < e2._receiverList.length) && (a2 = e2._receiverList.slice(0, 50), this.warn("ReceiverListLimit")), this.isOnlineMessage(e2, t2) ? 1 : 0), r2 = JSON.parse(JSON.stringify(e2.getElements())), t2 = this.get(17).getFileDNList(), c2 = e2.getGroupAtInfoList(), r2 = { fromAccount: this.getMyUserID(), groupID: e2.to, msgBody: so(e2.type, r2, t2), cloudCustomData: o2, random: e2.random, priority: e2.priority, clientSequence: e2.clientSequence, groupAtInfo: e2.type !== A.MSG_TEXT || S(c2) ? void 0 : c2, onlineOnlyFlag: s2, clientTime: e2.clientTime, offlinePushInfo: wo(n2), messageControlInfo: 0 == s2 ? i2 : void 0, needReadReceipt: true !== e2.needReadReceipt || this.isMessageFromOrToAVChatroom(e2.to) ? 0 : 1, receiverList: a2, isSupportExtension: true === e2.isSupportExtension ? 1 : 0, isRelayMessage: true === e2._relayFlag ? 1 : 0, cmConfigID: e2._cmConfigID }; return Gt(e2.to) && (r2.groupID = Jt(e2.to), r2.topicID = e2.to), { P: k.SEND_GRP_MSG, data: r2 }; } }, { key: "revokeMessage", value: function(e2) { var t2 = { groupID: e2.to, msgSeqList: [{ msgSeq: e2.sequence }] }; return Gt(e2.to) && (t2.groupID = Jt(e2.to), t2.topicID = e2.to), this.req({ P: k.REVOKE_GRP_MSG, data: t2 }); } }, { key: "deleteMessage", value: function(e2) { var t2 = e2.to, e2 = e2.keyList, e2 = (M.l("".concat(this._n, ".deleteMessage groupID:").concat(t2, " count:").concat(e2.length)), { groupID: t2, deleter: this.getMyUserID(), keyList: e2 }); return Gt(t2) && (e2.groupID = Jt(t2), e2.topicID = t2), this.req({ P: k.DEL_GRP_MSG, data: e2 }); } }, { key: "modifyRemoteMessage", value: function(e2) { var t2 = e2.to, n2 = e2.sequence, o2 = e2.payload, i2 = e2.type, a2 = e2.version, a2 = void 0 === a2 ? 0 : a2, s2 = e2.cloudCustomData, e2 = e2._elements, r2 = t2, c2 = void 0, t2 = (Gt(t2) && (r2 = Jt(t2), c2 = t2), void 0); return Xt(i2) && (1 < e2.length && e2.splice(0, 1, { type: i2, content: o2 }), t2 = e2), this.req({ P: k.MODIFY_GRP_MSG, data: { groupID: r2, topicID: c2, sequence: n2, version: a2, elements: t2, cloudCustomData: s2 } }); } }, { key: "getRoamingMessage", value: function(e2) { var r2 = this, c2 = "".concat(this._n, ".").concat("getRoamingMessage"), u2 = e2.conversationID, l2 = e2.groupID, e2 = e2.sequence, d2 = new G("getRoamingMessage"), p2 = 0, _2 = void 0; return Gt(l2) && (l2 = Jt(_2 = l2)), this._computeLastSequence({ groupID: l2, topicID: _2, sequence: e2 }).then(function(e3) { return p2 = e3, M.l("".concat(c2, " groupID:").concat(l2, " startSequence:").concat(p2)), r2.req({ P: k.GET_GRP_ROAMING_MSG, data: { groupID: l2, count: 21, sequence: p2, topicID: _2 } }); }).then(function(e3) { var t2 = e3.data, n2 = t2.messageList, o2 = t2.complete, t2 = t2.invisibleSequenceList, t2 = void 0 === t2 ? [] : t2, e3 = e3.data.nextSequence, e3 = void 0 === e3 ? 0 : e3, i2 = (N(n2) ? M.l("".concat(c2, " ok. complete:").concat(o2, " nextSequence:").concat(e3, " but messageList is undefined!")) : M.l("".concat(c2, " ok. complete:").concat(o2, " nextSequence:").concat(e3, " count:").concat(n2.length)), d2.setMessage("groupID:".concat(l2, " topicID:").concat(_2, " startSequence:").concat(p2, " complete:").concat(o2, " nextSequence:").concat(e3)).end(), r2.get(11)), a2 = [], s2 = [], n2 = (S(n2) || (a2 = i2.onRoamingMessage(n2, u2, true, s2), i2.updateIsRead(u2), i2.patchConvLastMessage(u2)), 2 === o2 || e3 < 1); return n2 && (i2.setCompleted(u2), e3 = ""), M.l("".concat(c2, " isPullingCompleted:").concat(n2, " nextReqID:").concat(e3, " storedMsgCount:").concat(a2.length) + " invisibleSeqCount:".concat(t2.length)), { nextReqID: e3 + "", storedMessageList: a2, assembledMessageList: s2, isPullingCompleted: n2 }; }).catch(function(e3) { return d2.setError(e3).setMessage("groupID:".concat(l2, " topicID:").concat(_2, " startSequence:").concat(p2)).end(), M.w("".concat(c2, " failed. error:"), e3), D(e3); }); } }, { key: "_getGroupIDOfMessage", value: function(e2) { return e2.conversationID.replace(A.CONV_GROUP, ""); } }, { key: "getReadReceiptList", value: function(n2) { var t2, o2 = "".concat(this._n, ".").concat("getReadReceiptList"), e2 = this._getGroupIDOfMessage(n2[0]), i2 = this.getMyUserID(), a2 = n2.filter(function(e3) { return e3.from === i2 && true === e3.needReadReceipt; }).map(function(e3) { return { sequence: e3.sequence }; }); return M.l("".concat(o2, " groupID:").concat(e2, " sequenceList:").concat(JSON.stringify(a2))), 0 === a2.length ? T({ messageList: n2 }) : ((t2 = new G("getReadReceiptList")).setMessage("groupID:".concat(e2)), this.req({ P: k.GET_READ_RECEIPT, data: { groupID: e2, sequenceList: a2 } }).then(function(e3) { t2.end(), M.l("".concat(o2, " ok")); e3 = e3.data.readReceiptList; return O(e3) && e3.forEach(function(t3) { n2.forEach(function(e4) { 0 === t3.code && t3.sequence === e4.sequence && (e4.readReceiptInfo.readCount = t3.readCount, e4.readReceiptInfo.unreadCount = t3.unreadCount); }); }), C({ messageList: n2 }); }).catch(function(e3) { return t2.setError(e3).end(), M.w("".concat(o2, " failed. error:"), e3), D(e3); })); } }, { key: "sendReadReceipt", value: function(e2) { var t2 = "".concat(this._n, ".").concat("sendReadReceipt"), n2 = this._getGroupIDOfMessage(e2[0]), o2 = new G("sendReadReceipt"), i2 = (o2.setMessage("groupID:".concat(n2)), this.getMyUserID()), e2 = e2.filter(function(e3) { return e3.from !== i2 && true === e3.needReadReceipt; }).map(function(e3) { return { sequence: e3.sequence }; }); return 0 === e2.length ? D({ code: L.READ_RECEIPT_MSG_LIST_EMPTY }) : (M.l("".concat(t2, ". sequenceList:").concat(JSON.stringify(e2))), this.req({ P: k.SEND_READ_RECEIPT, data: { groupID: n2, sequenceList: e2 } }).then(function(e3) { return o2.end(), M.l("".concat(t2, " ok")), C(); }).catch(function(e3) { return o2.setError(e3).end(), M.w("".concat(t2, " failed. error:"), e3), D(e3); })); } }, { key: "getReadReceiptDetail", value: function(e2) { var i2 = this, t2 = e2.message, n2 = e2.filter, o2 = e2.cursor, e2 = e2.count, a2 = this._getGroupIDOfMessage(t2), s2 = t2.ID, t2 = t2.sequence, r2 = "".concat(this._n, ".").concat("getReadReceiptDetail"), c2 = this._receiptDetailCompleteMap.get(s2) || false, u2 = 0 !== n2 && 1 !== n2 ? 0 : n2, n2 = m(o2) ? o2 : "", o2 = !R(e2) || e2 <= 0 || 100 <= e2 ? 100 : e2, e2 = "groupID:".concat(a2, " sequence:").concat(t2, " cursor:").concat(n2, " filter:").concat(u2, " completeFlag:").concat(c2), l2 = (M.l("".concat(r2, " ").concat(e2)), { cursor: "", isCompleted: false, messageID: s2, unreadUserIDList: [], readUserIDList: [] }), d2 = new G("getReadReceiptDetail"); return d2.setMessage(e2), this.req({ P: k.GET_READ_RECEIPT_DETAIL, data: { groupID: a2, sequence: t2, flag: u2, cursor: n2, count: o2 } }).then(function(e3) { d2.end(); var e3 = e3.data, t3 = e3.cursor, n3 = e3.isCompleted, o3 = e3.unreadUserIDList, e3 = e3.readUserIDList; return l2.cursor = t3, 1 === n3 && (l2.isCompleted = true, i2._receiptDetailCompleteMap.set(s2, true)), 0 === u2 ? l2.readUserIDList = e3.map(function(e4) { return e4.userID; }) : 1 === u2 && (l2.unreadUserIDList = o3.map(function(e4) { return e4.userID; })), M.l("".concat(r2, " ok")), C(l2); }).catch(function(e3) { return d2.setError(e3).end(), M.w("".concat(r2, " failed. error:"), e3), D(e3); }); } }, { key: "getRoamingMessagesHopping", value: function(c2) { var u2 = this, l2 = "".concat(this._n, ".").concat("getRoamingMessagesHopping"), t2 = c2.groupID, n2 = c2.count, d2 = c2.sequence, p2 = c2.direction, o2 = void 0; return N(d2) && 1 === p2 ? T({ messageList: [], isCompleted: true, nextMessageSeq: "" }) : (Gt(t2) && (t2 = Jt(o2 = t2)), this._computeReqSeqHopping({ groupID: t2, topicID: o2, sequence: d2 }).then(function(e2) { N(d2) || 1 !== p2 || (e2 = d2 + n2 - 1); var s2 = "".concat(o2 ? "topicID:".concat(o2) : "groupID:".concat(t2), " sequence:").concat(d2, " reqSeq:").concat(e2, " direction:").concat(p2), r2 = (M.l("".concat(l2, " ").concat(s2)), new G("getRoamingMessagesHopping")); return u2.req({ P: k.GET_GRP_ROAMING_MSG, data: { groupID: t2, topicID: o2, count: n2, sequence: e2 } }).then(function(e3) { var e3 = e3.data, t3 = e3.messageList, t3 = void 0 === t3 ? [] : t3, n3 = e3.complete, o3 = e3.nextSequence, o3 = void 0 === o3 ? 0 : o3, e3 = e3.invisibleSequenceList, e3 = void 0 === e3 ? [] : e3, i2 = "complete:".concat(n3, " nextSequence:").concat(o3, " remoteMsgCount:").concat(t3.length, " invisibleSequenceList:").concat(e3), i2 = (r2.setMessage("".concat(s2, " ").concat(i2)).end(), M.l("".concat(l2, " ok. ").concat(i2)), "".concat(A.CONV_GROUP).concat(c2.groupID)), a2 = u2.get(11), i2 = a2.onRoamingMessage(t3, i2, false), t3 = u2._computeResult({ groupID: c2.groupID, direction: p2, sequence: d2, remoteMessageList: t3, processedMessageList: i2, complete: n3, nextSequence: o3, invisibleSequenceList: e3 }); return a2.storeHoppingMessageList(t3.messageList), C(t3); }).catch(function(e3) { return r2.setError(e3).setMessage("groupID:".concat(t2, " sequence:").concat(d2, " count:").concat(n2)).end(), M.w("".concat(l2, " failed. error:"), e3), D(e3); }); })); } }, { key: "_computeReqSeqHopping", value: function(e2) { var n2 = this, o2 = e2.groupID, t2 = e2.topicID, t2 = void 0 === t2 ? void 0 : t2, e2 = e2.sequence, e2 = void 0 === e2 ? void 0 : e2; return 0 < e2 ? Promise.resolve(e2) : N(t2) ? this.getGroupProfileAdvance({ groupIDList: [o2], responseFilter: { groupBaseInfoFilter: ["NextMsgSeq"] } }).then(function(e3) { var e3 = e3.data.successGroupList, t3 = 0; return S(e3) || (t3 = e3[0].nextMessageSeq - 1), M.l("".concat(n2._n, "._computeReqSeqHopping groupID:").concat(o2, " lastSequence:").concat(t3, " from remote")), t3; }).catch(function(e3) { return D(e3); }) : Promise.resolve(0); } }, { key: "_computeResult", value: function(e2) { var t2 = { messageList: [], isCompleted: false, nextMessageSeq: "" }, n2 = e2.groupID, o2 = e2.direction, i2 = e2.sequence, a2 = e2.remoteMessageList, a2 = void 0 === a2 ? [] : a2, s2 = e2.processedMessageList, s2 = void 0 === s2 ? [] : s2, r2 = e2.complete, c2 = e2.nextSequence, e2 = e2.invisibleSequenceList; if (0 === o2) return t2.nextMessageSeq = c2, (2 === r2 || c2 < 1) && (t2.isCompleted = true, t2.nextMessageSeq = ""), t2.messageList = s2, t2; if (1 === o2) { if (S(a2)) { if (S(e2)) return t2.isCompleted = true, t2.nextMessageSeq = "", t2; t2.nextMessageSeq = e2[0] + 1; } else { r2 = a2[0].sequence, c2 = e2[0] || 0; t2.nextMessageSeq = c2 < r2 ? r2 + 1 : c2 + 1; } return s2.forEach(function(e3) { e3.sequence >= i2 && t2.messageList.push(e3); }), (Nt({ groupID: n2 }) || Gt(n2)) && 0 === t2.messageList.length && a2[0].sequence < i2 && (t2.isCompleted = true, t2.nextMessageSeq = ""), t2; } } }, { key: "setMessageRead", value: function(e2) { var o2 = this, i2 = e2.conversationID, a2 = e2.lastMessageSeq, s2 = "".concat(this._n, ".").concat("setMessageRead"), e2 = "convID:".concat(i2, " lastMessageSeq:").concat(a2), r2 = (M.l("".concat(s2, " ").concat(e2)), R(a2) || this.warn("DoNotModifyLastSeq"), new G("setMessageRead")), c2 = (r2.setMessage(e2), i2.replace(A.CONV_GROUP, "")), u2 = void 0; return Gt(c2) && (c2 = Jt(u2 = c2)), this.req({ P: k.SET_GRP_MSG_READ, data: { groupID: c2, topicID: u2, messageReadSeq: a2 } }).then(function() { r2.end(), M.l("".concat(s2, " ok")); var e3, t2 = o2.get(11), n2 = (t2.updateIsReadAfterReadReport({ conversationID: i2, lastMessageSeq: a2 }), true); return !N(u2) && (n2 = false, e3 = o2.get(10).getLocalTopic(c2, u2)) && e3.updateSelfInfo({ readedSequence: a2 }), t2.updateUnreadCount(i2, n2), C(); }).catch(function(e3) { return r2.setError(e3).end(), M.l("".concat(s2, " failed. error:"), e3), D(e3); }); } }, { key: "_computeLastSequence", value: function(e2) { var t2 = e2.groupID, n2 = e2.topicID, n2 = void 0 === n2 ? void 0 : n2, e2 = e2.sequence; return 0 < e2 ? Promise.resolve(e2) : N(n2) ? this.getGroupLastSequence(t2) : Promise.resolve(0); } }, { key: "getGroupLastSequence", value: function(e2) { var t2 = "".concat(this._n, ".").concat("getGroupLastSequence"), n2 = new G("getGroupLastSequence"), o2 = 0, i2 = "", a2 = "groupID:".concat(e2); if (this.hasLocalGroup(e2)) { var s2 = this.getLocalGroupProfile(e2), r2 = s2.lastMessage; if (0 < r2.lastSequence && false === r2.onlineOnlyFlag) return o2 = r2.lastSequence, i2 = "".concat(a2, ", ").concat(o2, " from group.lastMessage.lastSequence"), M.l("".concat(t2, " ").concat(i2)), n2.setMessage(i2).end(), Promise.resolve(o2); if (1 < s2.nextMessageSeq) return o2 = s2.nextMessageSeq - 1, i2 = "".concat(a2, ", ").concat(o2, " from group.nextMessageSeq"), M.l("".concat(t2, " ").concat(i2)), n2.setMessage(i2).end(), Promise.resolve(o2); } r2 = this.get(11).getLocalConversation("GROUP".concat(e2)); return r2 && r2.lastMessage.lastSequence && false === r2.lastMessage.onlineOnlyFlag ? (o2 = r2.lastMessage.lastSequence, i2 = "".concat(a2, ", ").concat(o2, " from conversation.lastMessage.lastSequence"), M.l("".concat(t2, " ").concat(i2)), n2.setMessage(i2).end(), Promise.resolve(o2)) : this.getGroupProfileAdvance({ groupIDList: [e2], responseFilter: { groupBaseInfoFilter: ["NextMsgSeq"] } }).then(function(e3) { e3 = e3.data.successGroupList; return S(e3) ? M.w("".concat(t2, " ").concat(a2, ", empty successGroupList")) : (o2 = e3[0].nextMessageSeq - 1, i2 = "".concat(a2, ", ").concat(o2, " from remote"), M.l("".concat(t2, " ").concat(i2))), n2.setMessage(i2).end(), o2; }).catch(function(e3) { return n2.setError(e3).setMessage(a2).end(), M.w("".concat(t2, " failed. error:"), e3), D(e3); }); } }, { key: "isMessageFromOrToAVChatroom", value: function(e2) { return this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e2); } }, { key: "hasJoinedAVChatRoom", value: function() { return this._AVChatRoomHandler.hasJoinedAVChatRoom(); } }, { key: "getJoinedAVChatRoom", value: function() { return this._AVChatRoomHandler.getJoinedAVChatRoom(); } }, { key: "getGroupRemoteLastSeq", value: function(e2) { e2 = this.getLocalGroupProfile(e2); return e2 ? e2.nextMessageSeq - 1 : 1; } }, { key: "isOnlineMessage", value: function(e2, t2) { return !(!this._canIUseOnlineOnlyFlag(e2) || !t2 || true !== t2.onlineUserOnly); } }, { key: "_canIUseOnlineOnlyFlag", value: function(e2) { var t2 = this.getJoinedAVChatRoom(); return !t2 || !t2.includes(e2.to) || e2.conversationType !== A.CONV_GROUP; } }, { key: "_onAVChatRoomHistoryMessage", value: function(e2, t2) { var n2; S(e2) || (M.l("".concat(this._n, "._onAVChatRoomHistoryMessage groupID:").concat(t2, " count:").concat(e2.length)), n2 = [], e2.forEach(function(e3) { n2.push(y(y({}, e3), {}, { isHistoryMessage: 1 })); }), this.onAVChatRoomMessage(n2, t2)); } }, { key: "onAVChatRoomMessage", value: function(e2) { this._AVChatRoomHandler.onMessage(e2, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : ""); } }, { key: "onAVChatRoomMemberBanned", value: function(e2) { this._AVChatRoomHandler.onAVChatRoomMemberBanned(e2); } }, { key: "setUnjoinedAVChatRoom", value: function(e2) { this._unjoinedAVChatRoomList.set(e2, 1); } }, { key: "deleteUnjoinedAVChatRoom", value: function(e2) { this._unjoinedAVChatRoomList.has(e2) && this._unjoinedAVChatRoomList.delete(e2); } }, { key: "isUnjoinedAVChatRoom", value: function(e2) { return this._unjoinedAVChatRoomList.has(e2); } }, { key: "isGroupAttributesUpdatedNotice", value: function(e2) { return this._groupAttributesHandler.isGroupAttributesUpdatedNotice(e2); } }, { key: "updateLocalMainSequenceOnReconnected", value: function() { this._groupAttributesHandler.updateLocalMainSequenceOnReconnected(); } }, { key: "initGroupAttributes", value: function(e2) { return this._groupAttributesHandler.initGroupAttributes(e2); } }, { key: "setGroupAttributes", value: function(e2) { return this._groupAttributesHandler.setGroupAttributes(e2); } }, { key: "deleteGroupAttributes", value: function(e2) { return this._groupAttributesHandler.deleteGroupAttributes(e2); } }, { key: "getGroupAttributes", value: function(e2) { return this._groupAttributesHandler.getGroupAttributes(e2); } }, { key: "isMessageFromTopic", value: function(e2, t2) { return 2 === e2 && !S(t2); } }, { key: "isMessageFromCommunityOfTopic", value: function(e2, t2) { return 2 === e2 && S(t2); } }, { key: "getMessageExtensions", value: function(e2, t2) { return M.l("".concat(this._n, ".getMessageExtensions startSequence:").concat(t2)), this.req({ P: k.GET_GRP_MSG_EXT, data: { groupID: e2.to, messageSequence: e2.sequence, startSequence: t2 } }); } }, { key: "modifyMsgExts", value: function(e2, t2) { var n2 = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1; return M.l("".concat(this._n, ".modifyMsgExts operateType:").concat(n2)), this.req({ P: k.MODIFY_GRP_MSG_EXT, data: { groupID: e2.to, messageSequence: e2.sequence, extensionList: t2, operateType: n2 } }); } }, { key: "_genNotifyReqList", value: function(e2) { for (var t2, n2, o2, i2, a2 = [], s2 = 0, r2 = e2.length; s2 < r2; s2++) t2 = e2[s2], i2 = this.getLocalGroupProfile(t2).type, n2 = this._getGroupLastRevokedTime(t2), o2 = 1e3 * We(), i2 = { notifyType: 1, limit: 20, type: Nt({ type: i2, groupID: t2 }) ? A.GRP_COMMUNITY : void 0, groupID: t2, beginTime: n2, endTime: o2 }, a2.push(i2); return a2; } }, { key: "getNotice", value: function(e2) { var r2 = this, t2 = "".concat(this._n, ".getNotice"), e2 = e2.filter(function(e3) { var t3; return !!r2.hasLocalGroup(e3) && (t3 = (e3 = r2.getLocalGroupProfile(e3)).type, e3 = e3.isSupportTopic, !Ot(t3)) && !e3; }); 0 !== e2.length && (M.l("".concat(t2, " list:").concat(e2)), this.req({ P: k.GET_GRP_NOTIFY, data: { notifyReqList: this._genNotifyReqList(e2) } }).then(function(e3) { var i2, a2, e3 = e3.data.notifyRspList, s2 = []; O(e3) && (i2 = { dataList: [] }, a2 = "".concat(t2, " ok."), e3.forEach(function(e4) { var t3 = e4.nextRevokedTime, n2 = e4.groupID, o2 = e4.notifyList; a2 += " groupID:".concat(n2, " nextRevokedTime:").concat(t3, " count:").concat(o2.length, "\n"), i2.dataList.push({ elements: { revokedInfos: r2._genRevokedInfos(e4) } }), 0 !== t3 ? (r2._setGroupLastRevokedTime(n2, t3), s2.push(n2)) : r2._setGroupLastRevokedTime(n2, 1e3 * We()); }), M.l(a2), r2.onMsgRevoked(i2, false)), 0 < s2.length && r2.getNotice(s2); }).catch(function(e3) { M.e("".concat(t2, " failed. error:"), e3); })); } }, { key: "_genRevokedInfos", value: function(e2) { var t2 = e2.notifyList, n2 = e2.groupID, o2 = []; return O(t2) && t2.forEach(function(e3) { o2.push({ groupID: n2, sequence: e3.sequence, random: e3.random, revokerInfo: y({}, e3.revokerInfo) }); }), o2; } }, { key: "_getGroupLastRevokedTime", value: function(e2) { return this.hasLocalGroup(e2) ? this.getLocalGroupProfile(e2)._lastRevokedTime : 0; } }, { key: "_setGroupLastRevokedTime", value: function(e2, t2) { this.hasLocalGroup(e2) && (this.getLocalGroupProfile(e2)._lastRevokedTime = t2); } }, { key: "isGroupCountersNotice", value: function(e2) { return this._groupCountersHandler.isGroupCountersNotice(e2); } }, { key: "setGroupCounters", value: function(e2) { return this._groupCountersHandler.setGroupCounters(e2); } }, { key: "increaseGroupCounter", value: function(e2) { return this._groupCountersHandler.increaseGroupCounter(e2); } }, { key: "decreaseGroupCounter", value: function(e2) { return this._groupCountersHandler.decreaseGroupCounter(e2); } }, { key: "getGroupCounters", value: function(e2) { return this._groupCountersHandler.getGroupCounters(e2); } }, { key: "getGroupMemberHandler", value: function() { return this._groupMemberHandler; } }, { key: "getGroupMemberList", value: function(e2) { return this._groupMemberHandler.getGroupMemberList(e2); } }, { key: "getGroupMemberProfile", value: function(e2) { return this._groupMemberHandler.getGroupMemberProfile(e2); } }, { key: "addGroupMember", value: function(e2) { return this._groupMemberHandler.addGroupMember(e2); } }, { key: "deleteGroupMember", value: function(e2) { return this._groupMemberHandler.deleteGroupMember(e2); } }, { key: "setGroupMemberMuteTime", value: function(e2) { return this._groupMemberHandler.setGroupMemberMuteTime(e2); } }, { key: "setGroupMemberRole", value: function(e2) { return this._groupMemberHandler.setGroupMemberRole(e2); } }, { key: "setGroupMemberNameCard", value: function(e2) { return this._groupMemberHandler.setGroupMemberNameCard(e2); } }, { key: "setGroupMemberCustomField", value: function(e2) { return this._groupMemberHandler.setGroupMemberCustomField(e2); } }, { key: "markGroupMemberList", value: function(e2) { return this._groupMemberHandler.markGroupMemberList(e2); } }, { key: "modifyGroupMemberInfo", value: function(e2) { return this._groupMemberHandler.modifyGroupMemberInfo(e2); } }, { key: "restartPolling", value: function() { this._AVChatRoomHandler.restartPolling(); } }, { key: "getPollingTimerID", value: function(e2) { var t2; return e2 && (t2 = this.getLocalGroupProfile(e2)) && Ot(t2.type) ? this._AVChatRoomHandler.getPollingTimerID(e2) : -1; } }, { key: "_canIUseJoinOption", value: function(e2) { return e2 === A.GRP_PUBLIC || Nt({ type: e2 }); } }, { key: "_silentlyGetGroupProfile", value: function(e2, t2) { var n2 = setTimeout(this.getGroupProfile.bind(this, { groupID: t2 }), 3e3); this._timeoutIDs.push(n2), M.l("".concat(this._n, "._silentlyGetGroupProfile errorCode:").concat(e2, " groupID:").concat(t2, " timeoutIDs:").concat(this._timeoutIDs)); } }, { key: "_clearTimeoutIDs", value: function() { this._timeoutIDs.forEach(function(e2) { clearTimeout(e2); }), this._timeoutIDs = []; } }, { key: "startMessageLongPolling", value: function(e2) { var t2 = e2.groupID, n2 = e2.longPollingKey, e2 = e2.longPollingSequence, e2 = void 0 === e2 ? 1 : e2, o2 = this.get(12).isUnlimitedAVChatRoom(), i2 = (this._AVChatRoomHandler.hasPollingInstance(t2) && this.stopMessageLongPolling({ groupID: t2 }), this._AVChatRoomHandler.getJoinedLiveList()), o2 = (!o2 && 0 < i2.length && this.stopMessageLongPolling({ groupID: i2[0] }), new oi({ groupID: t2, type: A.GRP_LIVE })); return M.l("".concat(this._n, ".startMessageLongPolling groupID:").concat(t2, " longPollingKey:").concat(n2, " longPollingSequence:").concat(e2)), this._AVChatRoomHandler.startRunLoop({ group: o2, longPollingKey: n2, startSeq: e2 }); } }, { key: "stopMessageLongPolling", value: function(e2) { var e2 = e2.groupID, t2 = this.get(11); return this._AVChatRoomHandler.reset(e2), this._deleteLocalGroup(e2), t2.deleteLocalConv("".concat(A.CONV_GROUP).concat(e2)), M.l("".concat(this._n, ".stopMessageLongPolling ok, groupID:").concat(e2)), T({ groupID: e2 }); } }, { key: "reset", value: function() { this.groupMap.clear(), this._unjoinedAVChatRoomList.clear(), this._receiptDetailCompleteMap.clear(), this._onlineMemberCountMap.clear(), this._commonGroupHandler.reset(), this._groupSystemNoticeHandler.reset(), this._groupTipsHandler.reset(), this._groupAttributesHandler.reset(), this._groupCountersHandler.reset(), this._AVChatRoomHandler.reset(), this._groupMemberHandler.reset(), this._clearTimeoutIDs(); } }]), Vi), Ci = ["topicID", "topicName", "avatar", "introduction", "notification", "unreadCount", "muteAllMembers", "customData", "groupAtInfoList", "nextMessageSeq", "selfInfo"], Ti = (e(xi, [{ key: "_initTopic", value: function(e2) { for (var t2 in e2) Ci.indexOf(t2) < 0 || ("selfInfo" === t2 ? this.updateSelfInfo(e2[t2]) : this[t2] = "muteAllMembers" === t2 ? 1 === e2[t2] : e2[t2]); } }, { key: "updateUnreadCount", value: function() { this.unreadCount = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0; } }, { key: "updateNextMessageSeq", value: function(e2) { this.nextMessageSeq = e2; } }, { key: "updateLastMessage", value: function(e2) { this.lastMessage = Yo(e2); } }, { key: "updateGroupAtInfoList", value: function(e2) { this.groupAtInfoList = JSON.parse(JSON.stringify(e2)); } }, { key: "updateTopic", value: function(e2) { N(e2.selfInfo) || this.updateSelfInfo(e2.selfInfo), N(e2.muteAllMembers) || (this.muteAllMembers = 1 === e2.muteAllMembers), _t(this, e2, ["groupID", "lastMessageTime", "selfInfo", "muteAllMembers", "lastMsg"]); } }, { key: "updateSelfInfo", value: function(e2) { return 0 === _t(this.selfInfo, e2, [], [""]); } }, { key: "reduceUnreadCount", value: function() { return 1 <= this.unreadCount && (--this.unreadCount, true); } }, { key: "isLastMessageRevoked", value: function(e2) { return e2.sequence === this.lastMessage.lastSequence; } }, { key: "setLastMessageRevoked", value: function(e2) { this.lastMessage.isRevoked = e2; } }, { key: "setLastMessageRevoker", value: function(e2) { this.lastMessage.revoker = e2; } }]), xi), Di = (t(qi, u), zo = n(qi), e(qi, [{ key: "_onCloudConfig", value: function() { var e2 = this.getCloudConfig("topic_cache_time"), t2 = this.getCloudConfig("topic_last_active_time"); N(e2) || (this.TOPIC_CACHE_TIME = Number(e2)), N(t2) || (this.TOPIC_LAST_ACTIVE_TIME = Number(t2)); } }, { key: "onTopicCreated", value: function(e2) { var t2 = e2.groupID; this.resetGetTopicTime(t2), this.emitOEvt(h.TOPIC_CREATED, e2); } }, { key: "onTopicDeleted", value: function(e2) { var t2 = this, n2 = e2.groupID, o2 = e2.topicIDList; (void 0 === o2 ? [] : o2).forEach(function(e3) { t2._deleteLocalTopic(n2, e3); }), this.emitOEvt(h.TOPIC_DELETED, e2); } }, { key: "onTopicProfileUpdated", value: function(e2) { var t2 = e2.groupID, n2 = e2.topicID, n2 = this.getLocalTopic(t2, n2); n2 && (n2.updateTopic(e2), this.emitOEvt(h.TOPIC_UPDATED, { groupID: t2, topic: n2 })); } }, { key: "onTopicLatestMsg", value: function(e2) { var t2, n2, e2 = e2 || {}, o2 = e2.topicLatestMessage, e2 = e2.excludedUnreadSequenceList; S(o2) || (t2 = o2.groupProfile.topicID, o2.conversationType = A.CONV_GROUP, o2.to = t2, (n2 = new Do(o2)).setElement(o2.elements), this.updateUnreadCountAndLastMsg(t2, n2, e2)); } }, { key: "onMessageRemindTypeUpdated", value: function(e2) { var t2, n2 = e2.groupID, o2 = e2.topicID, e2 = e2.messageRemindType, i2 = this.getLocalTopic(n2, o2); i2 && ((t2 = i2.updateSelfInfo({ messageRemindType: e2 })) && this.emitOEvt(h.TOPIC_UPDATED, { groupID: n2, topic: i2 }), M.l("".concat(this._n, ".onMessageRemindTypeUpdated topicID:").concat(o2, " messageRemindType:").concat(e2, " isUpdated:").concat(t2))); } }, { key: "onAtInfoUpdated", value: function(e2) { var t2 = e2.topicID, e2 = e2.groupAtInfoList, n2 = Jt(t2), t2 = this.getLocalTopic(n2, t2); t2 && !N(e2) && (t2.updateGroupAtInfoList(e2), this.emitOEvt(h.TOPIC_UPDATED, { groupID: n2, topic: t2 })); } }, { key: "onUnreadCountUpdatedFromConv", value: function(e2) { var t2 = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n2 = Jt(e2), e2 = this.getLocalTopic(n2, e2); e2 && e2.unreadCount !== t2 && (e2.updateUnreadCount(t2), 0 === t2 && e2.updateSelfInfo({ readedSequence: e2.lastMessage.lastSequence }), this.emitOEvt(h.TOPIC_UPDATED, { groupID: n2, topic: e2 })); } }, { key: "onMessageSent", value: function(e2) { var t2, n2, o2 = e2.groupID, i2 = e2.topicID, e2 = e2.lastMessage, i2 = this.getLocalTopic(o2, i2); i2 && (n2 = (t2 = void 0 === (t2 = e2.sequence) ? 0 : t2) + 1) > i2.nextMessageSeq && (i2.updateNextMessageSeq(n2), i2.updateLastMessage(e2), i2.updateSelfInfo({ readedSequence: t2 }), i2.updateUnreadCount(0), this.emitOEvt(h.TOPIC_UPDATED, { groupID: o2, topic: i2 })); } }, { key: "onMessageModified", value: function(e2) { var t2, n2 = e2.to, o2 = e2.time, i2 = e2.sequence, a2 = e2.elements, s2 = e2.cloudCustomData, r2 = e2.messageVersion, c2 = Jt(n2), u2 = this.getLocalTopic(c2, n2); u2 && (t2 = u2.lastMessage, M.d("".concat(this._n, ".onMessageModified topicID:").concat(n2, " lastMessage:"), JSON.stringify(t2), "options:", JSON.stringify(e2)), t2) && (null === t2.payload || t2.lastTime === o2 && t2.lastSequence === i2 && t2.version !== r2) && (t2.type = a2[0].type, t2.payload = a2[0].content, t2.messageForShow = zt(t2.type, t2.payload, this.isIntl()), t2.cloudCustomData = s2, t2.version = r2, t2.lastSequence = i2, t2.lastTime = o2, this.emitOEvt(h.TOPIC_UPDATED, { groupID: c2, topic: u2 })); } }, { key: "onMessageRevoked", value: function(e2) { var n2, o2, i2, a2 = this; 0 !== e2.length && (o2 = n2 = null, i2 = false, e2.forEach(function(e3) { var t2 = e3.to; o2 = Jt(t2), (n2 = a2.getLocalTopic(o2, t2)) && (n2.reduceUnreadCount() && (i2 = true), n2.isLastMessageRevoked(e3) && (n2.setLastMessageRevoked(true), n2.setLastMessageRevoker(e3.revoker), i2 = true), (t2 = n2.selfInfo.excludedUnreadSequenceList || []).push(e3.sequence), n2.updateSelfInfo({ excludedUnreadSequenceList: t2 })); }), i2) && this.emitOEvt(h.TOPIC_UPDATED, { groupID: o2, topic: n2 }); } }, { key: "isLastMessageRevoked", value: function(e2) { var t2 = e2.topicID, e2 = e2.sequence, n2 = Jt(t2), n2 = this.getLocalTopic(n2, t2), t2 = false; return t2 = n2 ? n2.isLastMessageRevoked({ sequence: e2 }) : t2; } }, { key: "updateUnreadCountAndLastMsg", value: function(e2, t2, n2) { var o2, i2 = Jt(e2), a2 = this.getLocalTopic(i2, e2); a2 && (o2 = a2.selfInfo.excludedUnreadSequenceList || [], N(n2) || (o2 = n2), t2._isExcludedFromUnreadCount && o2.push(t2.sequence), a2.updateSelfInfo({ excludedUnreadSequenceList: o2 }), M.l("".concat(this._n, ".updateUnreadCountAndLastMsg seq:").concat(t2.sequence, " lastSeq:").concat(a2.lastMessage.lastSequence)), t2.sequence > a2.lastMessage.lastSequence) && (a2.updateLastMessage(t2), n2 = t2.sequence + 1, a2.updateNextMessageSeq(n2), o2 = this._computeUnreadCount(a2), a2.updateUnreadCount(o2), (t2 = this.get(11).getLocalConversation("".concat(A.CONV_GROUP).concat(e2))) && t2.updateUnreadCount({ nextUnreadCount: o2, isFromGetConversations: true }), this.emitOEvt(h.TOPIC_UPDATED, { groupID: i2, topic: a2 })); } }, { key: "getJoinedCommunityList", value: function() { return this.get(7).syncCommunityWithTopic(); } }, { key: "createTopicInCommunity", value: function(t2) { var n2, o2 = this, i2 = "".concat(this._n, ".").concat("createTopicInCommunity"), e2 = t2.topicID; return N(e2) || Gt(e2) ? t2.topicName && false === this._filterProfanity("topicName", t2) || t2.introduction && false === this._filterProfanity("introduction", t2) || t2.notification && false === this._filterProfanity("notification", t2) ? D({ code: L.PROFANITY_FOUND }) : (n2 = new G("createTopicInCommunity"), this.req({ P: k.CREATE_TOPIC, data: y({}, t2) }).then(function(e3) { e3 = e3.data.topicID; return n2.setMessage("topicID:".concat(e3)).end(), M.l("".concat(i2, " ok. topicID:").concat(e3)), o2._updateTopicMap([y(y({}, t2), {}, { topicID: e3 })]), C({ topicID: e3 }); }).catch(function(e3) { return n2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); })) : D({ code: L.ILLEGAL_TOPIC_ID }); } }, { key: "deleteTopicFromCommunity", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("deleteTopicFromCommunity"), a2 = e2.groupID, e2 = e2.topicIDList, e2 = void 0 === e2 ? [] : e2, s2 = new G("deleteTopicFromCommunity"); return s2.setMessage("groupID:".concat(a2, " topicIDList:").concat(e2)), this.req({ P: k.DEL_TOPIC, data: { groupID: a2, topicIDList: e2 } }).then(function(e3) { var e3 = e3.data.resultList, o2 = [], i2 = [], e3 = ((void 0 === e3 ? [] : e3).forEach(function(e4) { var t3 = e4.topicID, n3 = e4.errorCode, e4 = e4.errorInfo; 0 === n3 ? o2.push({ topicID: t3 }) : i2.push({ topicID: t3, code: n3, message: e4 }); }), "success count:".concat(o2.length, ", fail count:").concat(i2.length)); return s2.setMoreMessage(e3).end(), M.l("".concat(n2, " ok. ").concat(e3)), o2.forEach(function(e4) { t2._deleteLocalTopic(a2, e4.topicID); }), C({ successTopicList: o2, failureTopicList: i2 }); }).catch(function(e3) { return s2.setError(e3).end(), M.e("".concat(n2, " failed. error:"), e3), D(e3); }); } }, { key: "updateTopicProfile", value: function(e2) { var t2, n2 = this, o2 = "".concat(this._n, ".").concat("updateTopicProfile"); return M.l("".concat(o2, " options:"), e2), e2.topicName && false === this._filterProfanity("topicName", e2) || e2.introduction && false === this._filterProfanity("introduction", e2) || e2.notification && false === this._filterProfanity("notification", e2) ? D({ code: L.PROFANITY_FOUND }) : ((t2 = new G("updateTopicProfile")).setMessage("groupID:".concat(e2.groupID, " topicID:").concat(e2.topicID)), N(e2.muteAllMembers) || (e2.muteAllMembers = true === e2.muteAllMembers ? "On" : "Off"), this.req({ P: k.UPDATE_TOPIC_PROFILE, data: y({}, e2) }).then(function() { return t2.end(), M.l("".concat(o2, " ok")), n2._updateTopicMap([e2]), C({ topic: n2.getLocalTopic(e2.groupID, e2.topicID) }); }).catch(function(e3) { return t2.setError(e3).end(), M.e("".concat(o2, " failed. error:"), e3), D(e3); })); } }, { key: "getTopicList", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("getTopicList"), o2 = e2.groupID, e2 = e2.topicIDList, e2 = void 0 === e2 ? [] : e2, i2 = 0 === e2.length, c2 = new G("getTopicList"); if (c2.setMessage("groupID:".concat(o2)), this._getTopicTimeMap.has(o2)) { var a2 = this._getTopicTimeMap.get(o2), s2 = a2.isGetAll, a2 = a2.time; if ((s2 || !s2 && !i2) && Date.now() - a2 < 1e3 * this.TOPIC_CACHE_TIME) { s2 = this._getLocalTopicList(o2, e2); if (i2 || s2.length === e2.length) return c2.setMoreMessage("from cache, topic count:".concat(s2.length)).end(), M.l("".concat(n2, " groupID:").concat(o2, " from cache, topic count:").concat(s2.length)), T({ successTopicList: s2, failureTopicList: [] }); } } return this.req({ P: k.GET_TOPIC_LIST, data: { groupID: o2, topicIDList: e2 } }).then(function(e3) { var e3 = e3.data.topicInfoList, a3 = [], s3 = [], r2 = [], e3 = ((void 0 === e3 ? [] : e3).forEach(function(e4) { var t3 = e4.topic, n3 = e4.selfInfo, o3 = e4.errorCode, e4 = e4.errorInfo, i3 = t3.topicID; 0 === o3 ? (a3.push(y(y({}, t3), {}, { selfInfo: n3 })), s3.push(i3)) : r2.push({ topicID: i3, code: o3, message: e4 }); }), t2._updateTopicMap(a3), t2._handleTopicAtInfo(a3), "success count:".concat(s3.length, ", fail count:").concat(r2.length)), e3 = (c2.setMoreMessage(e3).end(), M.l("".concat(n2, " groupID:").concat(o2, " from remote, ").concat(e3)), []); return S(s3) || (t2._getTopicTimeMap.set(o2, { time: Date.now(), isGetAll: i2 }), e3 = t2._getLocalTopicList(o2, s3)), C({ successTopicList: e3, failureTopicList: r2 }); }).catch(function(e3) { return c2.setError(e3).end(), M.e("".concat(n2, " failed. error:"), e3), D(e3); }); } }, { key: "hasLocalTopic", value: function(e2, t2) { return !!this._topicMap.has(e2) && this._topicMap.get(e2).has(t2); } }, { key: "getLocalTopic", value: function(e2, t2) { var n2 = null; return n2 = this._topicMap.has(e2) ? this._topicMap.get(e2).get(t2) : n2; } }, { key: "_getLocalTopicList", value: function(e2) { var t2 = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [], e2 = this._topicMap.get(e2), n2 = []; return e2 && (n2 = p(e2.values())), 0 === t2.length ? n2 : n2.filter(function(e3) { return t2.includes(e3.topicID); }); } }, { key: "_deleteLocalTopic", value: function(e2, t2) { this._topicMap.has(e2) && this._topicMap.get(e2).has(t2) && (this._topicMap.get(e2).delete(t2), M.l("".concat(this._n, "._deleteLocalTopic groupID:").concat(e2, " topicID:").concat(t2))); } }, { key: "_updateTopicMap", value: function(e2) { var i2 = this, a2 = []; e2.forEach(function(e3) { var t2 = e3.groupID, n2 = e3.topicID, o2 = null, e3 = (i2._topicMap.has(t2) || i2._topicMap.set(t2, /* @__PURE__ */ new Map()), i2._topicMap.get(t2).has(n2) ? (o2 = i2._topicMap.get(t2).get(n2)).updateTopic(e3) : (i2._getTopicLastMessage(e3), o2 = new Ti(e3, i2.isIntl()), i2._topicMap.get(t2).set(n2, o2)), i2._computeUnreadCount(o2)); o2.updateUnreadCount(e3), a2.push({ conversationID: "".concat(A.CONV_GROUP).concat(n2), type: A.CONV_TOPIC, unreadCount: e3 }); }), 0 < a2.length && this.get(11).updateTopicConversation(a2); } }, { key: "resetGetTopicTime", value: function(e2) { var t2 = this; N(e2) ? p(this._getTopicTimeMap.keys()).forEach(function(e3) { t2._getTopicTimeMap.set(e3, 0); }) : this._getTopicTimeMap.set(e2, 0); } }, { key: "getTopicListOnReconnected", value: function() { var o2 = this, e2 = p(this._topicMap.keys()), i2 = [], a2 = this.get(11); e2.forEach(function(e3) { var n2 = [], t2 = o2._getLocalTopicList(e3); a2.deleteTopicRoamingInfo(e3), t2.forEach(function(e4) { var t3 = e4.lastMessage.lastTime, t3 = void 0 === t3 ? 0 : t3; Date.now() - 1e3 * t3 < 1e3 * o2.TOPIC_LAST_ACTIVE_TIME && n2.push(e4.topicID); }), 0 < n2.length && i2.push({ groupID: e3, topicIDList: n2 }); }), M.l("".concat(this._n, ".getTopicListOnReconnected. active community count:").concat(i2.length)), this._relayGetTopicList(i2); } }, { key: "_relayGetTopicList", value: function(t2) { var e2, n2, o2, i2 = this; 0 !== t2.length && (n2 = 5 < (e2 = t2.shift()).topicIDList.length ? "topicIDList.length:".concat(e2.topicIDList.length) : "topicIDList:".concat(e2.topicIDList), (o2 = new G("relayGetTopicList")).setMessage(n2), M.l("".concat(this._n, "._relayGetTopicList. ").concat(n2)), this.getTopicList(e2).then(function() { o2.end(), i2._relayGetTopicList(t2); }).catch(function(e3) { o2.setError(e3).end(), i2._relayGetTopicList(t2); })); } }, { key: "_handleTopicAtInfo", value: function(e2) { var i2 = this; 0 !== e2.length && e2.forEach(function(e3) { var t2 = e3.groupID, n2 = e3.topicID, e3 = e3.groupAtInfoList, o2 = []; N(e3) || (e3.forEach(function(e4) { o2.push(y(y({}, e4), {}, { groupID: t2, topicID: n2 })); }), i2.get(11).onNewGroupAtTips({ dataList: o2 })); }); } }, { key: "_getTopicLastMessage", value: function(e2) { var t2; N(e2.lastMsg) || (t2 = { time: e2.lastMsg.time, sequence: e2.lastMsg.sequence, from: e2.lastMsg.from, payload: e2.lastMsg.elements[0] ? e2.lastMsg.elements[0].content : null, type: e2.lastMsg.elements[0] ? e2.lastMsg.elements[0].type : "", nick: e2.lastMsg.nick, avatar: e2.lastMsg.avatar, version: e2.lastMsg.messageVersion, cloudCustomData: e2.lastMsg.cloudCustomData, isRevoked: 2 === e2.lastMsg.isPlaceMessage, revoker: S(e2.lastMsg.revokerInfo) ? null : e2.lastMsg.revokerInfo.revoker }, e2.lastMessage = t2); } }, { key: "deleteTopicListInCommunity", value: function(t2) { var n2 = this, e2 = this._getLocalTopicList(t2), o2 = this.get(11); e2.forEach(function(e3) { e3 = e3.topicID; n2._deleteLocalTopic(t2, e3), n2._getTopicTimeMap.delete(t2), o2.deleteLocalConv("".concat(A.CONV_GROUP).concat(e3)); }); } }, { key: "_computeUnreadCount", value: function(t2) { var n2, e2 = t2.selfInfo, o2 = e2.excludedUnreadSequenceList, i2 = e2.readedSequence, e2 = t2.nextMessageSeq - t2.selfInfo.readedSequence - 1; return O(o2) && (n2 = 0, o2.forEach(function(e3) { i2 < e3 && e3 <= t2.nextMessageSeq - 1 && (n2 += 1); }), 1 <= n2) && (e2 -= n2), e2 < 0 ? 0 : e2; } }, { key: "_filterProfanity", value: function(e2, t2) { var n2, o2 = this.get(29); return !o2 || (n2 = (o2 = o2.filterText(t2[e2], re)).isAllowedToSend, o2 = o2.modifiedText, true === n2 && (t2[e2] = o2, true)); } }, { key: "getMessageExtensions", value: function(e2, t2) { M.l("".concat(this._n, ".getMessageExtensions startSequence:").concat(t2)); var n2 = Jt(e2.to); return this.req({ P: k.GET_GRP_MSG_EXT, data: { groupID: n2, topicID: e2.to, messageSequence: e2.sequence, startSequence: t2 } }); } }, { key: "modifyMsgExts", value: function(e2, t2) { var n2 = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, o2 = (M.l("".concat(this._n, ".modifyMsgExts operateType:").concat(n2)), Jt(e2.to)); return this.req({ P: k.MODIFY_GRP_MSG_EXT, data: { groupID: o2, topicID: e2.to, messageSequence: e2.sequence, extensionList: t2, operateType: n2 } }); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._topicMap.clear(), this._getTopicTimeMap.clear(), this.TOPIC_CACHE_TIME = 300, this.TOPIC_LAST_ACTIVE_TIME = 3600; } }]), qi), Ei = (e(Fi, [{ key: "setExpirationTime", value: function(e2) { this.expirationTime = e2; } }, { key: "getUserProfile", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("getUserProfile"), o2 = e2.userIDList; e2.fromAccount = this._userM.getMyAccount(), 100 < o2.length && (M.w("".concat(n2, " ").concat($t(100))), o2.length = 100); for (var i2, a2 = [], s2 = [], r2 = 0, c2 = o2.length; r2 < c2; r2++) i2 = o2[r2], this._userM.isMyFriend(i2) && this._contains(i2) ? s2.push(this._getProfileFromMap(i2)) : a2.push(i2); if (0 === a2.length) return T(s2); e2.toAccount = a2; var u2 = e2.bFromGetMyProfile || false, l2 = [], d2 = (e2.toAccount.forEach(function(e3) { l2.push({ toAccount: e3, standardSequence: 0, customSequence: 0 }); }), e2.userItem = l2, new G("getUserProfile")); return d2.setMessage(5 < o2.length ? "userIDList.length:".concat(o2.length) : "userIDList:".concat(o2)), this._userM.req({ P: k.GET_USER_PROFILE, data: e2 }).then(function(e3) { d2.end(), M.i("".concat(n2, " ok")); e3 = t2._handleResponse(e3).concat(s2); return C(u2 ? e3[0] : e3); }).catch(function(e3) { return d2.setError(e3).end(), M.e("".concat(n2, " failed. error:"), e3), D(e3); }); } }, { key: "getMyProfile", value: function() { var e2, t2 = this._userM.getMyAccount(), n2 = "".concat(this._n, ".getMyProfile"); return M.l("".concat(n2, " myAccount:").concat(t2)), this._fill(), this._contains(t2) ? (e2 = this._getProfileFromMap(t2), M.d("".concat(n2, " from cache, myProfile:").concat(JSON.stringify(e2))), T(e2)) : this.getUserProfile({ fromAccount: t2, userIDList: [t2], bFromGetMyProfile: true }); } }, { key: "_handleResponse", value: function(e2) { var t2 = e2.data.userProfileItem; if (!O(t2)) return []; for (var n2 = [], e2 = Date.now(), o2 = 0, i2 = t2.length; o2 < i2; o2++) { var a2 = t2[o2], s2 = a2.to, a2 = a2.profileItem; "@TLS#NOT_FOUND" !== s2 && "" !== s2 && (s2 = this._update(s2, this._getLatestProfileFromResponse(s2, a2)).latestProfile, n2.push(s2)); } return M.l("".concat(this._n, "._handleResponse cost:").concat(nn(e2))), n2; } }, { key: "_getLatestProfileFromResponse", value: function(e2, t2) { var n2 = { userID: e2, profileCustomField: [] }; if (!S(t2)) for (var o2 = 0, i2 = t2.length; o2 < i2; o2++) if (-1 < t2[o2].tag.indexOf("Tag_Profile_Custom")) n2.profileCustomField.push({ key: t2[o2].tag, value: t2[o2].value }); else switch (t2[o2].tag) { case g.NICK: n2.nick = t2[o2].value; break; case g.GENDER: n2.gender = t2[o2].value; break; case g.BIRTHDAY: n2.birthday = t2[o2].value; break; case g.LOCATION: n2.location = t2[o2].value; break; case g.SELFSIGNATURE: n2.selfSignature = t2[o2].value; break; case g.ALLOWTYPE: n2.allowType = t2[o2].value; break; case g.LANGUAGE: n2.language = t2[o2].value; break; case g.AVATAR: n2.avatar = t2[o2].value; break; case g.MESSAGESETTINGS: n2.messageSettings = t2[o2].value; break; case g.ADMINFORBIDTYPE: n2.adminForbidType = t2[o2].value; break; case g.LEVEL: n2.level = t2[o2].value; break; case g.ROLE: n2.role = t2[o2].value; break; default: M.w("".concat(this._n, "._getLatestProfileFromResponse unknown tag:"), t2[o2].tag, t2[o2].value); } return n2; } }, { key: "updateMyProfile", value: function(o2) { var i2 = this, a2 = "".concat(this._n, ".").concat("updateMyProfile"); if (o2.nick && false === this._userM.filterProfanity("nick", o2)) return D({ code: L.PROFANITY_FOUND }); if (o2.selfSignature && false === this._userM.filterProfanity("selfSignature", o2)) return D({ code: L.PROFANITY_FOUND }); var s2 = new G("updateMyProfile"), e2 = (s2.setMessage(JSON.stringify(o2)), new ei().validate(o2)); if (!e2.valid) return s2.setCode(L.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:".concat(e2.tips)).end(), M.e("".concat(a2, " info:").concat(e2.tips)), D({ code: L.UPDATE_PROFILE_INVALID_PARAM }); var t2, r2, n2 = []; for (t2 in o2) Object.prototype.hasOwnProperty.call(o2, t2) && ("profileCustomField" === t2 ? o2.profileCustomField.forEach(function(e3) { n2.push({ tag: e3.key, value: e3.value }); }) : n2.push({ tag: g[t2.toUpperCase()], value: o2[t2] })); return 0 === n2.length ? (e2 = new E({ code: L.UPDATE_PROFILE_NO_KEY }), s2.setError(e2).end(), M.e("".concat(a2, " failed. error:"), e2), D(e2)) : (r2 = this._userM.getMyAccount(), this._userM.req({ P: k.UPDATE_MY_PROFILE, data: { fromAccount: r2, profileItem: n2 } }).then(function(e3) { s2.end(), M.i("".concat(a2, " ok")); var t3 = i2._update(r2, o2), n3 = t3.isProfileUpdated, t3 = t3.latestProfile; return true === n3 && i2._userM.emitOEvt(h.PROFILE_UPDATED, [t3]), T(t3); }).catch(function(e3) { return s2.setError(e3).end(), M.e("".concat(a2, " failed. error:"), e3), D(e3); })); } }, { key: "onProfileModified", value: function(e2) { var t2 = e2.dataList; if (!S(t2)) { var n2 = t2.length; M.d("".concat(this._n, ".onProfileModified count:").concat(n2, " dataList:"), e2.dataList); for (var o2 = [], i2 = 0; i2 < n2; i2++) { var a2 = t2[i2].userID, a2 = this._update(a2, this._getLatestProfileFromResponse(a2, t2[i2].profileList)), s2 = a2.isProfileUpdated, a2 = a2.latestProfile; true === s2 && o2.push(a2); } 0 < o2.length && (this._userM.emitIEvt(P.PROFILE_UPDATED, o2), this._userM.emitOEvt(h.PROFILE_UPDATED, o2)); } } }, { key: "_fill", value: function() { if (0 === this.accountProfileMap.size) { for (var e2 = this._getCachedProfiles(), t2 = Date.now(), n2 = 0, o2 = e2.length; n2 < o2; n2++) t2 - e2[n2].lastUpdatedTime < this.expirationTime && this.accountProfileMap.set(e2[n2].userID, e2[n2]); M.l("".concat(this._n, "._fill from cache, size:").concat(this.accountProfileMap.size)); } } }, { key: "_update", value: function(e2, t2) { var n2, o2 = false, i2 = Date.now(); return this._contains(e2) ? (n2 = this._getProfileFromMap(e2), t2.profileCustomField && true === kt(n2.profileCustomField, t2.profileCustomField) && (n2.lastUpdatedTime = i2, o2 = true), 0 < _t(n2, t2, ["profileCustomField"]) && (n2.lastUpdatedTime = i2, o2 = true)) : (n2 = new ei(t2), !this._userM.isMyFriend(e2) && e2 !== this._userM.getMyAccount() || (n2.lastUpdatedTime = i2, o2 = true, this.accountProfileMap.set(e2, n2))), this._flush(e2 === this._userM.getMyAccount()), true === o2 && M.l("".concat(this._n, "._update account:").concat(e2, " isUpdated:").concat(o2)), { isProfileUpdated: o2, latestProfile: n2 }; } }, { key: "_flush", value: function(e2) { var t2 = p(this.accountProfileMap.values()), n2 = this._userM.getStorageModule(); M.d("".concat(this._n, "._flush length:").concat(t2.length, " flushAtOnce:").concat(e2)), n2.setItem(this.TAG, t2, e2); } }, { key: "_contains", value: function(e2) { return this.accountProfileMap.has(e2); } }, { key: "_getProfileFromMap", value: function(e2) { return this.accountProfileMap.get(e2); } }, { key: "_getCachedProfiles", value: function() { var e2 = this._userM.getStorageModule().getItem(this.TAG); return S(e2) ? [] : e2; } }, { key: "onConvProfileUpdated", value: function(e2) { for (var t2, n2, o2, i2 = [], a2 = 0, s2 = e2.length; a2 < s2; a2++) n2 = (t2 = e2[a2]).userID, this._userM.isMyFriend(n2) && (this._contains(n2) ? (o2 = this._getProfileFromMap(n2), 0 < _t(o2, t2) && i2.push(n2)) : i2.push(t2.userID)); 0 !== i2.length && (M.l("".concat(this._n, ".onConvProfileUpdated toAccountList:").concat(i2)), this.getUserProfile({ userIDList: i2 })); } }, { key: "getNickAndAvatarByUserID", value: function(e2) { return this._contains(e2) ? { nick: (e2 = this._getProfileFromMap(e2)).nick, avatar: e2.avatar } : { nick: "", avatar: "" }; } }, { key: "getUserNickAndAvatar", value: function(e2) { var t2, n2 = this, o2 = p(new Set(e2)), i2 = (M.l("".concat(this._n, ".getUserNickAndAvatar userIDList.length:").concat(e2.length, " uniqueUserIDList.length:").concat(o2.length)), []); return 0 === e2.length ? Promise.resolve(i2) : (e2 = this._createUserIDListGroup(o2), t2 = [], e2.forEach(function(e3) { t2.push(n2.getUserProfile({ userIDList: e3 })); }), Promise.all(t2).then(function(e3) { return e3.forEach(function(e4) { e4 = e4.data.map(function(e5) { return { userID: e5.userID, nick: e5.nick, avatar: e5.avatar }; }); i2.push.apply(i2, p(e4)); }), i2; })); } }, { key: "_createUserIDListGroup", value: function(e2) { for (var t2 = [], n2 = 0; n2 < e2.length; ) t2.push(e2.slice(n2, n2 += 100)); return t2; } }, { key: "reset", value: function() { this._flush(true), this.accountProfileMap.clear(); } }]), Fi), Li = e(function e2(t2) { d(this, e2); }), Si = (e(wi, [{ key: "getLocalBlacklist", value: function() { return p(this._blacklistMap.keys()); } }, { key: "getBlacklist", value: function() { var o2 = this, i2 = "".concat(this._n, ".getBlacklist"), e2 = { fromAccount: this._userM.getMyAccount(), maxLimited: this.maxLimited, startIndex: 0, lastSequence: this.currentSequence }, a2 = new G("getBlacklist"); return this._userM.req({ P: k.GET_BL, data: e2 }).then(function(e3) { var e3 = e3.data, t2 = e3.blackListItem, e3 = e3.currentSequence, n2 = S(t2) ? 0 : t2.length; a2.setMessage("count:".concat(n2)).end(), M.i("".concat(i2, " ok")), o2.currentSequence = e3, o2._handleResponse(t2, true), o2._userM.emitOEvt(h.BLACKLIST_UPDATED, p(o2._blacklistMap.keys())); }).catch(function(e3) { return a2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); }); } }, { key: "addBlacklist", value: function(t2) { var e2, n2, o2 = this, i2 = new G("addToBlacklist"), a2 = "".concat(this._n, ".addBlacklist"), s2 = this._userM.getMyAccount(); return 1 === t2.userIDList.length && t2.userIDList[0] === s2 ? (n2 = this._userM.getErrMsg(e2 = L.CANNOT_ADD_SELF_TO_BLACKLIST), i2.setCode(e2).setMessage(n2).end(), n2 = new E({ code: e2 }), M.e("".concat(a2, " failed. error:"), n2), D(n2)) : (t2.userIDList.includes(s2) && (t2.userIDList = t2.userIDList.filter(function(e3) { return e3 !== s2; })), t2.fromAccount = this._userM.getMyAccount(), t2.toAccount = t2.userIDList, this._userM.req({ P: k.ADD_TO_BL, data: t2 }).then(function(e3) { return i2.setMessage(5 < t2.userIDList.length ? "userIDList.length:".concat(t2.userIDList.length) : "userIDList:".concat(t2.userIDList)).end(), M.i("".concat(a2, " ok")), o2._handleResponse(e3.resultItem, true), C(p(o2._blacklistMap.keys())); }).catch(function(e3) { return i2.setError(e3).end(), M.e("".concat(a2, " failed. error:"), e3), D(e3); })); } }, { key: "_handleResponse", value: function(e2, t2) { if (!S(e2)) for (var n2, o2, i2, a2 = 0, s2 = e2.length; a2 < s2; a2++) o2 = e2[a2].to, i2 = e2[a2].resultCode, !N(i2) && 0 !== i2 || (t2 ? ((n2 = this._blacklistMap.has(o2) ? this._blacklistMap.get(o2) : new Li()).userID = o2, S(e2[a2].addBlackTimeStamp) || (n2.timeStamp = e2[a2].addBlackTimeStamp), this._blacklistMap.set(o2, n2)) : this._blacklistMap.has(o2) && (n2 = this._blacklistMap.get(o2), this._blacklistMap.delete(o2))); M.l("".concat(this._n, "._handleResponse total:").concat(this._blacklistMap.size, " bAdd:").concat(t2)); } }, { key: "deleteBlacklist", value: function(t2) { var n2 = this, o2 = "".concat(this._n, ".deleteBlacklist"), i2 = new G("removeFromBlacklist"); return t2.fromAccount = this._userM.getMyAccount(), t2.toAccount = t2.userIDList, this._userM.req({ P: k.RM_FROM_BL, data: t2 }).then(function(e2) { return i2.setMessage(5 < t2.userIDList.length ? "userIDList.length:".concat(t2.userIDList.length) : "userIDList:".concat(t2.userIDList)).end(), M.i("".concat(o2, " ok")), n2._handleResponse(e2.data.resultItem, false), C(p(n2._blacklistMap.keys())); }).catch(function(e2) { return i2.setError(e2).end(), M.e("".concat(o2, " failed. error:"), e2), D(e2); }); } }, { key: "onAccountDeleted", value: function(e2) { for (var t2 = 0, n2 = e2.length; t2 < n2; t2++) { var o2 = e2[t2]; this._blacklistMap.has(o2) && this._blacklistMap.delete(o2); } var i2 = e2.length; 0 < i2 && (M.l("".concat(this._n, ".onAccountDeleted count:").concat(i2, " ").concat(i2 < 30 ? "userIDList:".concat(e2) : "")), this._userM.emitOEvt(h.BLACKLIST_UPDATED, p(this._blacklistMap.keys()))); } }, { key: "onAccountAdded", value: function(e2) { for (var t2, n2 = [], o2 = 0, i2 = e2.length; o2 < i2; o2++) t2 = e2[o2], this._blacklistMap.has(t2) || (this._blacklistMap.set(t2, new Li({ userID: t2 })), n2.push(t2)); 0 < n2.length && (M.l("".concat(this._n, ".onAccountAdded count:").concat(n2.length, " userIDList:"), n2), this._userM.emitOEvt(h.BLACKLIST_UPDATED, p(this._blacklistMap.keys()))); } }, { key: "reset", value: function() { this._blacklistMap.clear(), this.startIndex = 0, this.maxLimited = 100, this.currentSequence = 0; } }]), wi), ki = (e(bi, [{ key: "_onCloudConfig", value: function() { var e2 = this._userM.getCloudConfig("status_query_count"), t2 = this._userM.getCloudConfig("status_sub_count"), n2 = this._userM.getCloudConfig("status_unsub_count"); M.l("".concat(this._n, "._onCloudConfig statusQueryCount:").concat(e2, " statusSubscribeCount:").concat(t2) + " statusUnsubscribeCount:".concat(n2)), N(e2) || (this.MAX_QUERY_USER_COUNT = parseInt(e2, 10)), N(e2) || (this.MAX_SUBSCRIBE_USER_COUNT = parseInt(t2, 10)), N(e2) || (this.MAX_UNSUBSCRIBE_USER_COUNT = parseInt(n2, 10)); } }, { key: "onUserStatusUpdated", value: function(e2) { var e2 = e2.dataList, o2 = this._userM.getMyUserID(), i2 = this._userM.get(12), e2 = e2.map(function(e3) { var t2 = e3.to, n2 = e3.statusType, e3 = e3.customStatus, e3 = Wo(e3); return t2 === o2 && i2.setCustomStatus(e3), { userID: t2, statusType: n2, customStatus: e3 }; }); M.l("".concat(this._n, ".onUserStatusUpdated list:").concat(JSON.stringify(e2))), this._userM.emitOEvt(h.USER_STATUS_UPDATED, e2); } }, { key: "setSelfStatus", value: function(e2) { var t2, n2, o2 = this, i2 = "".concat(this._n, ".setSelfStatus"); return false === this._userM.filterProfanity("customStatus", e2) ? D({ code: L.PROFANITY_FOUND }) : (t2 = new G("setSelfStatus"), n2 = e2.customStatus, this._userM.req({ P: k.SET_SELF_STATUS, data: { customStatus: n2 } }).then(function(e3) { return t2.setMessage("customStatus:".concat(n2)).end(), M.l("".concat(i2, " ok. customStatus:").concat(n2)), o2._userM.get(12).setCustomStatus(n2), C({ userID: o2._userM.getMyUserID(), statusType: 1, customStatus: n2 }); }).catch(function(e3) { return t2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); })); } }, { key: "getUserStatus", value: function(e2) { var o2 = "".concat(this._n, ".").concat("getUserStatus"), e2 = e2.userIDList, i2 = void 0 === e2 ? [] : e2, e2 = this._userM.getMyUserID(), t2 = p(i2), a2 = void 0, n2 = t2.indexOf(e2); if (-1 < n2 && (t2.splice(n2, 1), a2 = { userID: e2, statusType: 1, customStatus: this._userM.get(12).getCustomStatus() }), 0 === t2.length) return T({ successUserList: [a2], failureUserList: [] }); if (!this._userM.canIUse(_.USER_STATUS)) return this._userM.noUse("getUserStatus"); t2.length > this.MAX_QUERY_USER_COUNT && (M.w("".concat(o2, " ").concat($t(this.MAX_QUERY_USER_COUNT))), t2 = i2.slice(0, this.MAX_QUERY_USER_COUNT)); var s2 = new G("getUserStatus"); return this._userM.req({ P: k.GET_USER_STATUS, data: { userIDList: t2 } }).then(function(e3) { var e3 = e3.data, t3 = e3.successUserList, t3 = void 0 === t3 ? [] : t3, e3 = e3.failureUserList, e3 = void 0 === e3 ? [] : e3, t3 = t3.map(function(e4) { var t4 = e4.userID, n4 = e4.statusType, e4 = e4.customStatus; return { userID: t4, statusType: n4, customStatus: Wo(e4) }; }), e3 = e3.map(function(e4) { var t4 = e4.userID, n4 = e4.invalidUserID, o3 = e4.errorCode, e4 = e4.errorInfo; return { userID: S(n4) ? t4 : n4, code: o3, message: e4 }; }), n3 = (N(a2) || t3.unshift(a2), "userID count:".concat(i2.length, ", success count:").concat(t3.length, ", fail count:").concat(e3.length)); return s2.setMessage("".concat(n3)).end(), M.l("".concat(o2, " ok. ").concat(n3, ".")), C({ successUserList: t3, failureUserList: e3 }); }).catch(function(e3) { return s2.setMessage("userID count:".concat(i2.length)).setError(e3).end(), M.e("".concat(o2, " failed. error:"), e3), D(e3); }); } }, { key: "subscribeUserStatus", value: function(e2) { var t2, n2, o2, i2, a2 = "subscribeUserStatus"; return this._userM.canIUse(_.USER_STATUS) ? (t2 = "".concat(this._n, ".").concat(a2), (n2 = p(e2 = void 0 === (e2 = e2.userIDList) ? [] : e2)).length > this.MAX_SUBSCRIBE_USER_COUNT && (M.w("".concat(t2, " ").concat($t(this.MAX_SUBSCRIBE_USER_COUNT))), n2 = e2.slice(0, this.MAX_SUBSCRIBE_USER_COUNT)), o2 = new G(a2), i2 = "userID count:".concat(e2.length), M.l("".concat(t2, " ").concat(i2)), this._userM.req({ P: k.SUB_USER_STATUS, data: { userIDList: n2 } }).then(function(e3) { e3 = e3.data.failureUserList, e3 = (void 0 === e3 ? [] : e3).map(function(e4) { var t3 = e4.userID, n3 = e4.invalidUserID, o3 = e4.errorCode, e4 = e4.errorInfo; return { userID: S(n3) ? t3 : n3, code: o3, message: e4 }; }); return o2.setMessage("".concat(i2, " fail count:").concat(e3.length)).end(), M.l("".concat(t2, " ok. fail count:").concat(e3.length, ".")), C({ failureUserList: e3 }); }).catch(function(e3) { return o2.setMessage(i2).setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this._userM.noUse(a2); } }, { key: "unsubscribeUserStatus", value: function(e2) { var t2, n2, o2, i2, a2 = "unsubscribeUserStatus"; return this._userM.canIUse(_.USER_STATUS) ? (t2 = "".concat(this._n, ".").concat(a2), n2 = p(e2 = void 0 === (e2 = (e2 || {}).userIDList) ? [] : e2), e2.length > this.MAX_UNSUBSCRIBE_USER_COUNT && (M.w("".concat(t2, " ").concat($t(this.MAX_UNSUBSCRIBE_USER_COUNT))), n2 = e2.slice(0, this.MAX_UNSUBSCRIBE_USER_COUNT)), o2 = new G(a2), i2 = "userID count:".concat(e2.length), M.l("".concat(t2, " ").concat(i2)), e2 = { userIDList: n2 }, 0 === n2.length && (e2.userIDList = void 0, e2.unsubscribeAll = 1), this._userM.req({ P: k.UNSUB_USER_STATUS, data: e2 }).then(function(e3) { e3 = e3.data.failureUserList, e3 = (void 0 === e3 ? [] : e3).map(function(e4) { var t3 = e4.userID, n3 = e4.invalidUserID, o3 = e4.errorCode, e4 = e4.errorInfo; return { userID: S(n3) ? t3 : n3, code: o3, message: e4 }; }); return o2.setMessage("".concat(i2, " fail count:").concat(e3.length)).end(), M.l("".concat(t2, " ok. fail count:").concat(e3.length, ".")), C({ failureUserList: e3 }); }).catch(function(e3) { return o2.setMessage("".concat(i2)).setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this._userM.noUse(a2); } }, { key: "reset", value: function() { this.MAX_QUERY_USER_COUNT = 500, this.MAX_SUBSCRIBE_USER_COUNT = 100, this.MAX_UNSUBSCRIBE_USER_COUNT = 100; } }]), bi), Ai = (t(Ui, u), Jo = n(Ui), e(Ui, [{ key: "onContextUpdated", value: function(e2) { this._profileHandler.getMyProfile(), this._blacklistHandler.getBlacklist(); } }, { key: "mockOnNickAvatarModified", value: function(e2, t2) { M.l("".concat(this._n, "._mockOnNickAvatarModified nick:").concat(e2, " avatar:").concat(t2)), this.onProfileModified({ dataList: [{ pushType: 1, userID: this.getMyUserID(), profileList: [{ tag: g.NICK, value: e2 }, { tag: g.AVATAR, value: t2 }] }] }); } }, { key: "onProfileModified", value: function(e2) { this._profileHandler.onProfileModified(e2); } }, { key: "onRelationChainModified", value: function(e2) { var t2, n2, e2 = e2.dataList; S(e2) || (t2 = [], e2.forEach(function(e3) { e3.blackListDelAccount && t2.push.apply(t2, p(e3.blackListDelAccount)); }), 0 < t2.length && this._blacklistHandler.onAccountDeleted(t2), n2 = [], e2.forEach(function(e3) { e3.blackListAddAccount && n2.push.apply(n2, p(e3.blackListAddAccount)); }), 0 < n2.length && this._blacklistHandler.onAccountAdded(n2)); } }, { key: "onConvProfileUpdated", value: function(e2) { this._profileHandler.onConvProfileUpdated(e2); } }, { key: "getMyAccount", value: function() { return this.getMyUserID(); } }, { key: "getMyNick", value: function() { return this._profileHandler.getNickAndAvatarByUserID(this.getMyUserID()).nick; } }, { key: "getMyProfile", value: function() { return this._profileHandler.getMyProfile(); } }, { key: "getStorageModule", value: function() { return this.get(13); } }, { key: "filterProfanity", value: function(e2, t2) { var n2, o2 = this.get(29); return !o2 || (n2 = (o2 = o2.filterText(t2[e2], "user_profile")).isAllowedToSend, o2 = o2.modifiedText, true === n2 && (t2[e2] = o2, true)); } }, { key: "isMyFriend", value: function(e2) { var t2 = this.get(8); return !!t2 && t2.isMyFriend(e2); } }, { key: "getUserProfile", value: function(e2) { return this._profileHandler.getUserProfile(e2); } }, { key: "updateMyProfile", value: function(e2) { return this._profileHandler.updateMyProfile(e2); } }, { key: "getNickAndAvatarByUserID", value: function(e2) { return this._profileHandler.getNickAndAvatarByUserID(e2); } }, { key: "getUserNickAndAvatar", value: function(e2) { return this._profileHandler.getUserNickAndAvatar(e2); } }, { key: "getLocalBlacklist", value: function() { var e2 = this._blacklistHandler.getLocalBlacklist(); return T(e2); } }, { key: "addBlacklist", value: function(e2) { return this._blacklistHandler.addBlacklist(e2); } }, { key: "deleteBlacklist", value: function(e2) { return this._blacklistHandler.deleteBlacklist(e2); } }, { key: "onUserStatusUpdated", value: function(e2) { this._userStatusHandler.onUserStatusUpdated(e2); } }, { key: "setSelfStatus", value: function(e2) { return this._userStatusHandler.setSelfStatus(e2); } }, { key: "getUserStatus", value: function(e2) { return this._userStatusHandler.getUserStatus(e2); } }, { key: "subscribeUserStatus", value: function(e2) { return this._userStatusHandler.subscribeUserStatus(e2); } }, { key: "unsubscribeUserStatus", value: function(e2) { return this._userStatusHandler.unsubscribeUserStatus(e2); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._profileHandler.reset(), this._blacklistHandler.reset(), this._userStatusHandler.reset(); } }]), Ui), Ri = (e(Pi, [{ key: "isLoggedIn", value: function() { return this._isLoggedIn; } }, { key: "isOversea", value: function() { return this._oversea; } }, { key: "isPrivateNetWork", value: function() { return this._proxyServer; } }, { key: "isDevMode", value: function() { return this._isDevMode; } }, { key: "isTestEnv", value: function() { return this._isTestEnv; } }, { key: "isPartialUpdatedConvs", value: function() { return this._isPartialUpdatedConvs; } }, { key: "isSingaporeSite", value: function() { return 2e7 <= this._SDKAppID && this._SDKAppID < 3e7 || 172e7 <= this._SDKAppID && this._SDKAppID < 173e7; } }, { key: "isKoreaSite", value: function() { return 3e7 <= this._SDKAppID && this._SDKAppID < 4e7 || 173e7 <= this._SDKAppID && this._SDKAppID < 174e7; } }, { key: "isGermanySite", value: function() { return 4e7 <= this._SDKAppID && this._SDKAppID < 5e7 || 174e7 <= this._SDKAppID && this._SDKAppID < 175e7; } }, { key: "isIndiaSite", value: function() { return 5e7 <= this._SDKAppID && this._SDKAppID < 6e7 || 175e7 <= this._SDKAppID && this._SDKAppID < 176e7; } }, { key: "isJapanSite", value: function() { return 6e7 <= this._SDKAppID && this._SDKAppID < 7e7 || 176e7 <= this._SDKAppID && this._SDKAppID < 177e7; } }, { key: "isUSASite", value: function() { return 7e7 <= this._SDKAppID && this._SDKAppID < 8e7 || 177e7 <= this._SDKAppID && this._SDKAppID < 178e7; } }, { key: "isIndonesiaSite", value: function() { return 8e7 <= this._SDKAppID && this._SDKAppID < 9e7 || 178e7 <= this._SDKAppID && this._SDKAppID < 179e7; } }, { key: "isIntl", value: function() { return 0 === (e2 = this._SDKAppID) || 2e7 <= e2 && e2 < 9e7 || 172e7 <= e2 && e2 < 179e7; var e2; } }, { key: "isUnlimitedAVChatRoom", value: function() { return this._unlimitedAVChatRoom; } }, { key: "isUsingChatCore", value: function() { return this._isUsingChatCore; } }, { key: "setUsingChatCore", value: function(e2) { this._isUsingChatCore = e2; } }, { key: "getUIPlatform", value: function() { return this._uiPlatform; } }, { key: "setUIPlatform", value: function(e2) { this._uiPlatform = e2; } }, { key: "setUserID", value: function(e2) { this._userID = e2; } }, { key: "getUserID", value: function() { return this._userID; } }, { key: "setUserSig", value: function(e2) { this._userSig = e2; } }, { key: "getUserSig", value: function() { return this._userSig; } }, { key: "getSDKAppID", value: function() { return this._SDKAppID; } }, { key: "setTinyID", value: function(e2) { this._tinyID = e2, this._isLoggedIn = true; } }, { key: "getTinyID", value: function() { return this._tinyID; } }, { key: "setCustomStatus", value: function(e2) { this._customStatus = e2; } }, { key: "getCustomStatus", value: function() { return this._customStatus; } }, { key: "getScene", value: function() { return Ue ? window.tencent_cloud_im_csig_flutter_for_web_25F_cy : this._isTUIKit() ? "tuikit" : this._scene; } }, { key: "getInstanceID", value: function() { return this._instanceID; } }, { key: "getStatusInstanceID", value: function() { return this._statusInstanceID; } }, { key: "setStatusInstanceID", value: function(e2) { this._statusInstanceID = e2; } }, { key: "getVersion", value: function() { return this._version; } }, { key: "getA2Key", value: function() { return this._a2Key; } }, { key: "setA2Key", value: function(e2) { this._a2Key = e2; } }, { key: "getContentType", value: function() { return this._contentType; } }, { key: "getProxyServer", value: function() { return this._proxyServer; } }, { key: "getFileUploadProxy", value: function() { return this._fileUploadProxy; } }, { key: "getFileDownloadProxy", value: function() { return this._fileDownloadProxy; } }, { key: "setApplicationID", value: function(e2) { this._applicationID = e2; } }, { key: "getApplicationID", value: function() { return this._applicationID; } }, { key: "setDowloadFileAuthKey", value: function(e2) { this._authKey = e2; } }, { key: "getDowloadFileAuthKey", value: function() { return this._authKey; } }, { key: "setCustomLoginInfo", value: function(e2) { this._customLoginInfo = e2; } }, { key: "getCustomLoginInfo", value: function() { return this._customLoginInfo; } }, { key: "_isTUIKit", value: function() { var e2 = false, t2 = false, n2 = false, o2 = false, i2 = []; v && (i2 = Object.keys(I)); for (var a2 = 0, s2 = (i2 = Ce ? Me ? Object.keys(uni) : Object.keys(window) : i2).length; a2 < s2; a2++) if (i2[a2].toLowerCase().includes("uikit")) { e2 = true; break; } var r2, i2 = null, c2 = (v && !lt(I.createGamePortal) && lt(getApp) && !N(getApp()) && (r2 = getApp().globalData, f(r2)) && true === r2.isTUIKit && (t2 = true), true === this._m.get(13).getStorageSync("TIM_".concat(this._SDKAppID, "_isTUIKit")) && (n2 = true), null); if (_e && !fe && "undefined" == typeof uni && __wxConfig && (c2 = __wxConfig.pages), ge && "undefined" == typeof uni && __qqConfig && (c2 = __qqConfig.pages), O(c2) && 0 < c2.length) { for (var u2 = 0, l2 = c2.length; u2 < l2; u2++) if (c2[u2].toLowerCase().includes("tui")) { o2 = true; break; } c2 = null; } return e2 || t2 || n2 || o2; } }, { key: "reset", value: function() { this._isLoggedIn = false, this._userSig = "", this._a2Key = "", this._tinyID = "", this._customStatus = "", this._statusInstanceID = 0; } }]), Pi), Oi = { "k-vue2-pc": 1, "k-vue2-h5": 2, "k-vue2-h5-uni": 3, "k-vue2-app-uni": 4, "k-vue2-mp-uni": 5, "k-vue2-pc-uni": 6, "k-vue3-pc": 7, "k-vue3-h5": 8, "k-vue3-h5-uni": 9, "k-vue3-app-uni": 10, "k-vue3-mp-uni": 11, "k-vue3-pc-uni": 12, "k-rn": 13 }, Ni = (t(Gi, u), jo = n(Gi), e(Gi, [{ key: "onCheckTimer", value: function(e2) { this.isLoggedIn() && e2 % this._helloInterval == 0 && this._hello(); } }, { key: "getPushModule", value: function() { var e2 = void 0, t2 = this.get(36), n2 = this.get(28); return t2.canIUseTIMPush() ? e2 = t2 : n2.canIUseOfflinePush() && (e2 = n2), e2; } }, { key: "login", value: function(e2) { if (this.isLoggedIn()) return n2 = this.getMyUserID(), (n2 = this.getErrMsg("RepeatLogin", n2)) && M.w(n2), T({ actionStatus: "OK", errorCode: 0, errorInfo: n2, repeatLogin: true }); if (Date.now() - this._lastLoginTs <= 15e3) return this.warn("LoggingIn", e2.userID), D({ code: L.REPEAT_LOGIN }); M.l("".concat(this._n, ".login userID:").concat(e2.userID)); var t2, n2 = this._checkLoginInfo(e2); return 0 !== n2.code ? D(n2) : (n2 = this.get(12), t2 = e2.userID, e2 = e2.userSig, n2.setUserID(t2), n2.setUserSig(e2), this.get(20).updateProtocolConfig(), this._login()); } }, { key: "_login", value: function() { var _2 = this, h2 = this.get(12), g2 = h2.getScene(), e2 = 0, t2 = g2, f2 = (g2 && g2.startsWith("k-") && (t2 = Oi[g2], g2 = "tuikit"), new G("login")), n2 = (f2.setMessage("".concat(t2)).setMoreMessage("identifier:".concat(this.getMyUserID())), "tuikit" === g2), o2 = 0, n2 = (Me ? o2 = n2 ? 3 === t2 || 4 === t2 || 5 === t2 || 6 === t2 ? 31 : 9 === t2 || 10 === t2 || 11 === t2 || 12 === t2 ? 32 : 4 : 3 : v ? o2 = he ? 36 : "tuikit" === g2 ? 12 : 11 : Ce ? o2 = Ue ? "flutter_web_uikit" === g2 ? 21 : 20 : this._isReactUIKit() ? Pe ? 25 : 24 : n2 ? 1 === t2 || 2 === t2 ? 29 : 7 === t2 || 8 === t2 ? 30 : Pe ? 17 : 14 : Pe ? 16 : 13 : 13 === t2 && (o2 = 38), f2.setUIPlatform(o2), h2.setUIPlatform(o2), this.getPushModule()), m2 = (n2 && (this._isWebUniapp = n2.getUniAppPlatform(), t2 = this._getStatusInstanceID(), h2.setStatusInstanceID(t2), this.get(20).updateProtocolConfig(), e2 = n2.getDeviceBrand()), "".concat(this._n, "._login")); return this._lastLoginTs = Date.now(), this.req({ P: k.LOGIN, data: { deviceBrand: e2, isWebUniapp: this._isWebUniapp, customInfo: h2.getCustomLoginInfo() } }).then(function(e3) { _2._lastLoginTs = 0; var t3 = Date.now(), n3 = null, o3 = e3.data, i2 = o3.a2Key, a2 = o3.tinyID, s2 = o3.helloInterval, r2 = o3.instanceID, c2 = o3.timeStamp, u2 = o3.customStatus, u2 = void 0 === u2 ? "" : u2, l2 = o3.purchaseBits, o3 = o3.authKey, o3 = void 0 === o3 ? "" : o3, d2 = 1e3 * c2, p2 = t3 - f2.getStartTs(), p2 = d2 + parseInt(p2 / 2) - t3, t3 = f2.getStartTs() + p2; if (f2.start(t3), t3 = d2, Ye = p2, (d2 = /* @__PURE__ */ new Date()).setTime(t3), M.i("baseTime from server:".concat(d2, " offset:").concat(Ye)), a2) { if (i2) return t3 = _2.get(21).getSocketID(), d2 = Wo(u2), u2 = "socketID:".concat(t3, " scene:").concat(g2, " helloInterval:").concat(s2, " instanceID:").concat(r2, " timeStamp:").concat(c2) + " offset:".concat(p2, " customStatus:").concat(d2, " isWebUniapp:").concat(_2._isWebUniapp), M.l("".concat(m2, " ok. ").concat(u2)), c2 = t3 = "", _e && lt(I.getAccountInfoSync) && (p2 = I.getAccountInfoSync().miniProgram) && (t3 = p2.appId, c2 = p2.envVersion), f2.setMoreMessage("".concat(u2, " href:").concat(Ce ? window.location.href : "", " mpAppId:").concat(t3, " envVersion:").concat(c2, " authKey:").concat(o3)).end(), h2.setA2Key(i2), h2.setTinyID(a2), h2.setStatusInstanceID(r2), h2.setCustomStatus(d2), h2.setDowloadFileAuthKey(o3), l2 && _2.get(27).onPushedConfig({ errorCode: 0, expiredTime: 0, purchaseBits: l2 }), _2.get(20).updateProtocolConfig(), _2.emitIEvt(P.A2KEY_AND_TINYID_UPDATED), _2._helloInterval = s2, _2.triggerReady(), (p2 = _2.getPushModule()) && (uni.setStorageSync("timUniAppInstanceID", r2), p2.init()), _2._fetchCloudControlConfig(), _2.get(29).init(), e3; n3 = new E({ code: L.NO_A2KEY }); } else n3 = new E({ code: L.NO_TINYID }); throw f2.setError(n3).end(), n3; }).catch(function(e3) { return f2.setError(e3).end(true), _2._m.setNotReadyReason(L.LOGIN_FAILED), M.e("".concat(m2, " failed. error:"), e3), _2._lastLoginTs = 0, _2._m.onLoginFailed(), D(e3); }); } }, { key: "logout", value: function() { var t2 = this, e2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0, n2 = "".concat(this._n, ".logout"), o2 = this.isLoggedIn(); return M.i("".concat(n2, " type:").concat(e2, " isLoggedIn:").concat(o2, " isWebUniapp:").concat(this._isWebUniapp)), o2 ? (new G("logout").setMessage("identifier:".concat(this.getMyUserID())).end(true), 0 === e2 && this._m.setNotReadyReason(L.LOGGED_OUT), this.req({ P: k.LOGOUT, data: { type: e2, isWebUniapp: this._isWebUniapp } }).then(function() { return t2.resetReady(), T({}); }).catch(function(e3) { return M.e("".concat(n2, " error:"), e3), t2.resetReady(), T({}); })) : D({ code: L.USER_NOT_LOGGED_IN }); } }, { key: "getLoginUser", value: function() { return this.isLoggedIn() ? this.getMyUserID() : ""; } }, { key: "_fetchCloudControlConfig", value: function() { this.get(23).fetchConfig(); } }, { key: "_getStatusInstanceID", value: function() { return uni.getStorageSync("timUniAppInstanceID") || 0; } }, { key: "_hello", value: function() { var t2 = this; this._lastWsHelloTs = Date.now(), this.req({ P: k.HELLO, data: { isWebUniapp: this._isWebUniapp } }).catch(function(e2) { M.w("".concat(t2._n, "._hello error:"), e2); }); } }, { key: "getLastWsHelloTs", value: function() { return this._lastWsHelloTs; } }, { key: "_checkLoginInfo", value: function(e2) { var t2 = 0; return S(this.get(12).getSDKAppID()) ? t2 = L.NO_SDKAPPID : S(e2.userID) ? t2 = L.NO_IDENTIFIER : S(e2.userSig) && (t2 = L.NO_USERSIG), { code: t2 }; } }, { key: "_isReactUIKit", value: function() { return Ce && void 0 !== window.tencent_cloud_im_csig_react_uikit_23F_xa; } }, { key: "onMultipleAccountKickedOut", value: function(e2) { var t2 = this; new G("kickedOut").setMessage("type:".concat(A.KICKED_OUT_MULT_ACCOUNT, " newInstanceInfo:").concat(JSON.stringify(e2))).end(true), M.w("".concat(this._n, ".onMultipleAccountKickedOut userID:").concat(this.getMyUserID(), " newInstanceInfo:"), e2), this.logout(1).then(function() { t2.emitOEvt(h.KICKED_OUT, { type: A.KICKED_OUT_MULT_ACCOUNT }), t2._m.setNotReadyReason(L.KICKED_OUT_MULT_ACCOUNT), t2._m.reset(); }); } }, { key: "onMultipleDeviceKickedOut", value: function(e2) { var t2 = this; new G("kickedOut").setMessage("type:".concat(A.KICKED_OUT_MULT_DEVICE, " newInstanceInfo:").concat(JSON.stringify(e2))).end(true), M.w("".concat(this._n, ".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID(), " newInstanceInfo:"), e2), this.logout(1).then(function() { t2.emitOEvt(h.KICKED_OUT, { type: A.KICKED_OUT_MULT_DEVICE }), t2._m.setNotReadyReason(L.KICKED_OUT_MULT_DEVICE), t2._m.reset(); }); } }, { key: "onUserSigExpired", value: function() { new G("kickedOut").setMessage(A.KICKED_OUT_USERSIG_EXPIRED).end(true), M.w("".concat(this._n, ".onUserSigExpired userID:").concat(this.getMyUserID())), 0 !== this.get(12).getStatusInstanceID() && (this.emitOEvt(h.KICKED_OUT, { type: A.KICKED_OUT_USERSIG_EXPIRED }), this._m.setNotReadyReason(L.KICKED_OUT_USERSIG_EXPIRED), this._m.reset()); } }, { key: "onRestApiKickedOut", value: function(e2) { new G("kickedOut").setMessage("type:".concat(A.KICKED_OUT_REST_API, " newInstanceInfo:").concat(JSON.stringify(e2))).end(true), M.w("".concat(this._n, ".onRestApiKickedOut userID:").concat(this.getMyUserID(), " newInstanceInfo:"), e2), 0 !== this.get(12).getStatusInstanceID() && (this.emitOEvt(h.KICKED_OUT, { type: A.KICKED_OUT_REST_API }), this._m.setNotReadyReason(L.KICKED_OUT_REST_API), this._m.reset(), this.get(21).onRestApiKickedOut()); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this.resetReady(), this._helloInterval = 120, this._lastLoginTs = 0, this._lastWsHelloTs = 0, this._isWebUniapp = 0; } }]), Gi); function Gi(e2) { return d(this, Gi), (e2 = jo.call(this, e2))._n = "SignModule", e2._helloInterval = 120, e2._lastLoginTs = 0, e2._lastWsHelloTs = 0, e2._isWebUniapp = 0, Bo.mixin(i(e2)), e2; } function Pi(e2, t2) { d(this, Pi), this._m = e2, this._isLoggedIn = false, this._SDKAppID = t2.SDKAppID, this._userID = t2.userID || "", this._userSig = t2.userSig || "", this._version = "3.4.7", this._a2Key = "", this._tinyID = "", this._customStatus = "", this._contentType = "json", this._unlimitedAVChatRoom = t2.unlimitedAVChatRoom, this._scene = t2.scene || "", this._oversea = t2.oversea, this._instanceID = t2.instanceID, this._statusInstanceID = 0, this._isDevMode = t2.devMode, this._isTestEnv = t2.testEnv, this._proxyServer = t2.proxyServer, this._fileUploadProxy = t2.fileUploadProxy, this._fileDownloadProxy = t2.fileDownloadProxy, this._applicationID = 0, this._isPartialUpdatedConvs = t2.partialUpdatedConversations, this._isUsingChatCore = false, this._uiPlatform = 0, this._authKey = "", this._customLoginInfo = ""; } function Ui(e2) { return d(this, Ui), (e2 = Jo.call(this, e2))._n = "UserModule", e2._profileHandler = new Ei(i(e2)), e2._blacklistHandler = new Si(i(e2)), e2._userStatusHandler = new ki(i(e2)), e2.getIEmitInst().on(P.A2KEY_AND_TINYID_UPDATED, e2.onContextUpdated, i(e2)), e2; } function bi(e2) { d(this, bi), this._userM = e2, 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(P.CLOUD_CONFIG, this._onCloudConfig, this); } function wi(e2) { d(this, wi), this._userM = e2, this._n = "BlacklistHandler", this._blacklistMap = /* @__PURE__ */ new Map(), this.startIndex = 0, this.maxLimited = 100, this.currentSequence = 0; } function Fi(e2) { d(this, Fi), this._userM = e2, this._n = "ProfileHandler", this.TAG = "profile", this.accountProfileMap = /* @__PURE__ */ new Map(), this.expirationTime = 864e5; } function qi(e2) { return d(this, qi), (e2 = zo.call(this, e2))._n = "TopicModule", e2._topicMap = /* @__PURE__ */ new Map(), e2._getTopicTimeMap = /* @__PURE__ */ new Map(), e2.TOPIC_CACHE_TIME = 300, e2.TOPIC_LAST_ACTIVE_TIME = 3600, e2.getIEmitInst().on(P.CLOUD_CONFIG, e2._onCloudConfig, i(e2)), e2; } function xi(e2, t2) { d(this, xi), this.topicID = "", this.topicName = "", this.avatar = "", this.introduction = "", this.notification = "", this.unreadCount = 0, this.muteAllMembers = false, this.customData = "", this.groupAtInfoList = [], this.nextMessageSeq = 0, this.lastMessage = Yo(e2.lastMessage, t2), this.selfInfo = { muteTime: 0, readedSequence: 0, messageRemindType: "", excludedUnreadSequenceList: void 0 }, this._initTopic(e2); } function Vi(e2) { return d(this, Vi), (e2 = Xo.call(this, e2))._n = "GroupModule", e2._commonGroupHandler = new li(i(e2)), e2._groupAttributesHandler = new di(i(e2)), e2._groupCountersHandler = new pi(i(e2)), e2._AVChatRoomHandler = new gi(i(e2)), e2._groupTipsHandler = new ui(i(e2)), e2._groupSystemNoticeHandler = new Ii(i(e2)), e2._groupMemberHandler = new mi(i(e2)), e2.groupMap = /* @__PURE__ */ new Map(), e2._unjoinedAVChatRoomList = /* @__PURE__ */ new Map(), e2._receiptDetailCompleteMap = /* @__PURE__ */ new Map(), e2._onlineMemberCountMap = /* @__PURE__ */ new Map(), e2._timeoutIDs = [], e2.getIEmitInst().on(P.CLOUD_CONFIG, e2._onCloudConfig, i(e2)), e2; } function Hi(e2) { d(this, Hi), this._grpM = e2, this._n = "GroupSystemNoticeHandler", this.pendencyMap = /* @__PURE__ */ new Map(); } function Bi(e2) { d(this, Bi), this._grpM = e2, this._n = "GroupMemberHandler", this.groupMemberListMap = /* @__PURE__ */ new Map(), this.DEFAULT_MEMBER_INFO_FILTER = ["Role", "JoinTime", "NameCard", "ShutUpUntil", "OnlineStatus"], this._grpM.getIEmitInst().on(P.PROFILE_UPDATED, this._onProfileUpdated, this); } function Ki(e2) { d(this, Ki), this.userID = "", this.avatar = "", this.nick = "", this.role = "", this.joinTime = "", this.lastSendMsgTime = "", this.nameCard = "", this.muteUntil = 0, this.memberCustomField = [], this.isOnline = false, this.updateMember(e2); } function Yi(e2) { d(this, Yi), this._grpM = e2, this._n = "AVChatRoomHandler", this._joinedGroupMap = /* @__PURE__ */ new Map(), this._pollingRequestInfoMap = /* @__PURE__ */ new Map(), this._pollingInstanceMap = /* @__PURE__ */ new Map(), this._seqSll = new ti(200), this._IDSll = new ti(100), this._reportMessageStackedCount = 0, this._onlineMemberCountMap = /* @__PURE__ */ new Map(), this.DEFAULT_EXPIRE_TIME = 60, this.DEFAULT_POLLING_INTERVAL = 300, this.MAX_POLLING_INTERVAL = 2e3, this._pollingInterval = this.DEFAULT_POLLING_INTERVAL, this.DEFAULT_POLLING_NO_MESSAGE_COUNT = 20, this.DEFAULT_POLLING_INTERVAL_PLUS = 2e3, this._pollingNoMessageCount = 0, this._startBroadcastSeq = 1, this._broadcastMessageIDMap = /* @__PURE__ */ new Map(), this.DEFAULT_POLLING_SIMPLIFIED_MSG = 0; } function Wi(e2) { d(this, Wi); var t2 = e2.manager, n2 = e2.groupID, o2 = e2.onInit, i2 = e2.onSuccess, e2 = e2.onFail; this._n = "Polling", this._manager = t2, this._grpM = t2._grpM, this._onInit = o2, this._onSuccess = i2, this._onFail = e2, this._groupID = n2, this._timeoutID = -1, this._isRunning = false, this._proto = k.AV_POLLING; } function ji(e2) { d(this, ji), this._grpM = e2, this._n = "GroupCountersHandler", this._groupCountersMap = /* @__PURE__ */ new Map(), this.EXPIRE_TIME = 3e4, this._grpM.getIEmitInst().on(P.CLOUD_CONFIG, this._onCloudConfig, this); } function Ji(e2) { d(this, Ji), this._grpM = e2, this._n = "GroupAttributesHandler", this._groupAttributesMap = /* @__PURE__ */ new Map(), this._groupAttributesCopy = {}, this.CACHE_EXPIRE_TIME = 3e4, this._grpM.getIEmitInst().on(P.CLOUD_CONFIG, this._onCloudConfig, this); } function zi(e2) { d(this, zi), this._grpM = e2, this._n = "CommonGroupHandler", this.tempConversationList = null, this._cachedGroupMessageMap = /* @__PURE__ */ new Map(), this._checkCountMap = /* @__PURE__ */ new Map(), this.MAX_CHECK_COUNT = 4, this.PAGING_GRP_COUNT_LIMIT = 200, this._pagingStatus = Nn, this._pagingGetCostList = [], e2.getIEmitInst().on(P.A2KEY_AND_TINYID_UPDATED, this.syncGroupList, this); } function Xi(e2) { d(this, Xi), this._grpM = e2, this._n = "GroupTipsHandler", this._cachedGroupTipsMap = /* @__PURE__ */ new Map(), this._checkCountMap = /* @__PURE__ */ new Map(), this.MAX_CHECK_COUNT = 4; } function Zi(e2) { return d(this, Zi), (e2 = Zo.call(this, e2))._n = "ConvModule", Bo.mixin(i(e2)), e2._msgListHandler = new xo(i(e2)), e2._msgRemindHandler = new si(i(e2)), e2._convGroupHandler = new ri(i(e2)), e2._sll = new ti(100), e2._pagingStatus = Nn, e2._pagingTs = 0, e2._pagingStartIdx = 0, e2._pagingPinnedTs = 0, e2._pagingPinnedStartIdx = 0, e2._pagingConvIDMap = /* @__PURE__ */ new Map(), e2._convIDFromUnreadDBMap = /* @__PURE__ */ new Map(), e2._convMap = /* @__PURE__ */ new Map(), e2._tmpGroupList = [], e2._tmpGroupAtTipsList = [], e2._peerReadTimeMap = /* @__PURE__ */ new Map(), e2._completedMap = /* @__PURE__ */ new Map(), e2._roamingMsgKeyAndTimeMap = /* @__PURE__ */ new Map(), e2._remoteGroupReadSeqMap = /* @__PURE__ */ new Map(), e2._convTotalUnreadCount = 0, e2._pagingGetCostList = [], e2._convMapForDiff = /* @__PURE__ */ new Map(), e2._partialUpdatedConvMap = /* @__PURE__ */ new Map(), e2._everClearedMap = /* @__PURE__ */ new Map(), e2._bPullOnInvite = true, e2._initListeners(), e2; } function Qi(e2) { d(this, Qi), this._convM = e2, this._n = "ConvGroupHandler", this._convGroupMap = /* @__PURE__ */ new Map(), this._startIndex = 0, this._pagingStatus = Nn; } function $i(e2) { d(this, $i), this._convM = e2, this._n = "MsgRemindHandler"; } function ea(e2, t2) { var n2 = 2 < arguments.length && void 0 !== arguments[2] && arguments[2]; d(this, ea), this.conversationID = e2.conversationID || "", this.unreadCount = e2.unreadCount || 0, this.type = e2.type || "", this.lastMessage = Ko(e2.lastMessage, t2, n2), e2.lastMsgTime && (this.lastMessage.lastTime = e2.lastMsgTime), this._isInfoCompleted = false, this.peerReadTime = e2.peerReadTime || 0, this.groupAtInfoList = [], this.remark = "", this.isPinned = e2.isPinned || false, this.messageRemindType = e2.messageRemindType, this.markList = e2.markList || [], this.customData = e2.customData || "", this.conversationGroupList = e2.conversationGroupList || [], this.draftText = e2.draftText || "", this._initProfile(e2), this.subType = this.groupProfile ? this.groupProfile.type : ""; } function ta(e2) { d(this, ta), 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 = false, this.isSupportTopic = false, this._lastRevokedTime = 0, this._initGroup(e2); } function na(e2) { d(this, na), this.MAX_LENGTH = e2, this.map = /* @__PURE__ */ new Map(); } function oa(e2) { var t2 = this; d(this, oa), S(e2) || (this.userID = e2.userID || "", this.nick = e2.nick || "", this.gender = e2.gender || "", this.birthday = e2.birthday || 0, this.location = e2.location || "", this.selfSignature = e2.selfSignature || "", this.allowType = e2.allowType || A.ALLOW_TYPE_ALLOW_ANY, this.language = e2.language || 0, this.avatar = e2.avatar || "", this.messageSettings = e2.messageSettings || 0, this.adminForbidType = e2.adminForbidType || A.FORBID_TYPE_NONE, this.level = e2.level || 0, this.role = e2.role || 0, this.lastUpdatedTime = 0, this.profileCustomField = [], S(e2.profileCustomField)) || e2.profileCustomField.forEach(function(e3) { t2.profileCustomField.push({ key: e3.key, value: e3.value }); }); } function ia() { return null; } function aa(e2) { var t2 = e2.get(12); return { SDKType: 10, SDKAppID: t2.getSDKAppID(), SDKVersion: t2.getVersion(), tinyID: Number(t2.getTinyID()), userID: t2.getUserID(), platform: e2.getPlatform(), instanceID: t2.getInstanceID(), traceID: We() }; } e(fa, [{ key: "_errorTolerantHandle", value: function() { v || "undefined" != typeof window && this._canIUseCookies() || (this.getItem = ia, this.setItem = ia, this.removeItem = ia, this.clear = ia); } }, { key: "onCheckTimer", value: function(e2) { e2 % 20 == 0 && 0 !== this._storageQueue.size && this._doFlush(); } }, { key: "_doFlush", value: function() { try { var e2, t2 = Z(this._storageQueue); try { for (t2.s(); !(e2 = t2.n()).done; ) { var n2 = Y(e2.value, 2), o2 = n2[0], i2 = n2[1]; this._setStorageSync(this._getKey(o2), i2); } } catch (e3) { t2.e(e3); } finally { t2.f(); } this._storageQueue.clear(); } catch (e3) { M.w("".concat(this._n, "._doFlush error:"), e3); } } }, { key: "_getPrefix", value: function() { var e2 = this._m.get(12); return "TIM_".concat(e2.getSDKAppID(), "_").concat(e2.getUserID(), "_"); } }, { key: "_getKey", value: function(e2) { return "".concat(this._getPrefix()).concat(e2); } }, { key: "getItem", value: function(e2) { var t2 = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]; try { var n2 = t2 ? this._getKey(e2) : e2; return this.getStorageSync(n2); } catch (e3) { return M.w("".concat(this._n, ".getItem error:"), e3), {}; } } }, { key: "setItem", value: function(e2, t2) { var n2; 2 < arguments.length && void 0 !== arguments[2] && arguments[2] ? (n2 = !(3 < arguments.length && void 0 !== arguments[3]) || arguments[3] ? this._getKey(e2) : e2, this._setStorageSync(n2, t2)) : this._storageQueue.set(e2, t2); } }, { key: "clear", value: function() { try { v ? I.clearStorageSync() : this._canIUseCookies() && localStorage.clear(); } catch (e2) { M.w("".concat(this._n, ".clear error:"), e2); } } }, { key: "removeItem", value: function(e2) { var t2 = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]; try { var n2 = t2 ? this._getKey(e2) : e2; this._removeStorageSync(n2); } catch (e3) { M.w("".concat(this._n, ".removeItem error:"), e3); } } }, { key: "getSize", value: function(e2) { var t2 = this, n2 = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : "b"; try { var o2 = { size: 0, limitSize: 5242880, unit: n2 }; if (Object.defineProperty(o2, "leftSize", { enumerable: true, get: function() { return o2.limitSize - o2.size; } }), v && (o2.limitSize = 1024 * I.getStorageInfoSync().limitSize), e2) o2.size = JSON.stringify(this.getItem(e2)).length + this._getKey(e2).length; else if (v) I.getStorageInfoSync().keys.forEach(function(e3) { o2.size += JSON.stringify(t2.getStorageSync(e3)).length + t2._getKey(e3).length; }); else if (this._canIUseCookies()) for (var i2 in localStorage) localStorage.hasOwnProperty(i2) && (o2.size += localStorage.getItem(i2).length + i2.length); return this._convertUnit(o2); } catch (e3) { M.w("".concat(this._n, " error:"), e3); } } }, { key: "_convertUnit", value: function(e2) { var t2, n2 = {}, o2 = e2.unit; for (t2 in n2.unit = o2, e2) "number" == typeof e2[t2] && ("kb" === o2.toLowerCase() ? n2[t2] = Math.round(e2[t2] / 1024) : "mb" === o2.toLowerCase() ? n2[t2] = Math.round(e2[t2] / 1024 / 1024) : n2[t2] = e2[t2]); return n2; } }, { key: "_setStorageSync", value: function(e2, t2) { v ? ve ? my.setStorageSync({ key: e2, data: t2 }) : I.setStorageSync(e2, t2) : this._canIUseCookies() && localStorage.setItem(e2, JSON.stringify(t2)); } }, { key: "getStorageSync", value: function(e2) { return v ? ve ? my.getStorageSync({ key: e2 }).data : I.getStorageSync(e2) : this._canIUseCookies() ? JSON.parse(localStorage.getItem(e2)) : {}; } }, { key: "_removeStorageSync", value: function(e2) { v ? ve ? my.removeStorageSync({ key: e2 }) : I.removeStorageSync(e2) : this._canIUseCookies() && localStorage.removeItem(e2); } }, { key: "_canIUseCookies", value: function() { return "undefined" != typeof window && navigator && navigator.cookieEnabled && localStorage; } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._doFlush(); } }]); var sa, ra = fa, ca = (e(ga, [{ key: "pushIn", value: function(e2) { M.d("".concat(this._n, ".pushIn"), this._report.length, e2), this._report.push(e2); } }, { key: "backfill", value: function(e2) { var t2; O(e2) && 0 !== e2.length && (M.d("".concat(this._n, ".backfill"), this._report.length, e2.length), (t2 = this._report).unshift.apply(t2, p(e2))); } }, { key: "getLogsNumInMemory", value: function() { return this._report.length; } }, { key: "isEmpty", value: function() { return 0 === this._report.length; } }, { key: "_reset", value: function() { this._report.length = 0, this._report = []; } }, { key: "getLogsInMemory", value: function() { var e2 = this._report.slice(); return this._reset(), e2; } }]), ga), ua = (t(ha, u), sa = n(ha), e(ha, [{ key: "reportAtOnce", value: function() { this._report(); } }, { key: "_onLoginSuccess", value: function() { var t2 = this, e2 = this.get(13), n2 = e2.getItem(this.TAG, false); !S(n2) && lt(n2.forEach) && (M.l("".concat(this._n, "._onLoginSuccess. logs count:").concat(n2.length)), n2.forEach(function(e3) { t2._reportBody.pushIn(e3); }), e2.removeItem(this.TAG, false)); } }, { key: "_onCloudConfig", value: function() { var e2 = this.getCloudConfig("evt_rpt_threshold"), t2 = this.getCloudConfig("evt_rpt_waiting"), n2 = this.getCloudConfig("evt_rpt_level"), o2 = this.getCloudConfig("evt_rpt_sdkappid_bl"), i2 = this.getCloudConfig("evt_rpt_tinyid_wl"); N(e2) || (this.MIN_THRESHOLD = Number(e2)), N(t2) || (this.WAITING_TIME = Number(t2)), N(n2) || (this.REPORT_LEVEL = n2.split(",").map(function(e3) { return Number(e3); })), N(o2) || (this.REPORT_SDKAPPID_BLACKLIST = o2.split(",").map(function(e3) { return Number(e3); })), N(i2) || (this.REPORT_TINYID_WHITELIST = i2.split(",")); } }, { key: "pushIn", value: function(e2) { e2 instanceof G && (e2.updateTimeStamp(), this._reportBody.pushIn(e2), this._reportBody.getLogsNumInMemory() >= this.MIN_THRESHOLD) && this._report(); } }, { key: "onCheckTimer", value: function() { Date.now() < this._lastReportTime + this.WAITING_TIME || this._reportBody.isEmpty() || this._report(); } }, { key: "_filterLogs", value: function(e2) { var t2 = this, n2 = this.get(12), o2 = n2.getSDKAppID(), n2 = n2.getTinyID(); return Wt(this.REPORT_SDKAPPID_BLACKLIST, o2) && !jt(this.REPORT_TINYID_WHITELIST, n2) ? [] : e2.filter(function(e3) { return t2.REPORT_LEVEL.includes(e3.level); }); } }, { key: "_report", value: function() { var t2, e2, n2 = this; this._reportBody.isEmpty() || (t2 = this._reportBody.getLogsInMemory(), 0 !== (e2 = this._filterLogs(t2)).length ? (e2 = { header: aa(this), event: e2 }, this.req({ P: k.SSO_STAT, data: y({}, e2) }).then(function() { n2._lastReportTime = Date.now(); }).catch(function(e3) { M.w("".concat(n2._n, "._report failed. error:"), e3), n2._lastReportTime = Date.now(), n2._reportBody.backfill(t2), n2._reportBody.getLogsNumInMemory() > n2.MAX_THRESHOLD && n2._flushAtOnce(); })) : this._lastReportTime = Date.now()); } }, { key: "_flushAtOnce", value: function() { var e2 = this.get(13), t2 = e2.getItem(this.TAG, false), n2 = this._reportBody.getLogsInMemory(), o2 = "".concat(this._n, "._flushAtOnce"); S(t2) ? (M.l("".concat(o2, " count:").concat(n2.length)), e2.setItem(this.TAG, n2, true, false)) : ((n2 = n2.concat(t2)).length > this.MAX_THRESHOLD && (n2 = n2.slice(0, this.MAX_THRESHOLD)), M.l("".concat(o2, " count:").concat(n2.length)), e2.setItem(this.TAG, n2, true, false)); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._lastReportTime = 0, this._report(), this.REPORT_SDKAPPID_BLACKLIST = [], this.REPORT_TINYID_WHITELIST = []; } }]), ha), la = "none", da = "online", pa = (e(_a, [{ key: "_startRN", value: function() { var e2, n2 = this; ye && (e2 = this._m.get(18).getPlugin("chat-network-monitor")) && (this._removeListener = e2.addEventListener(function(e3) { var t2 = e3.isConnected, e3 = e3.type; n2._networkType !== e3 && n2._onNetworkStatusChange({ isConnected: void 0 !== t2 && t2, networkType: e3 }); })); } }, { key: "start", value: function() { var t2 = this, n2 = "".concat(this._n, ".start"); v ? (I.getNetworkType({ success: function(e2) { t2._networkType = e2.networkType || e2.subtype || "", e2.networkType === la ? M.w("".concat(n2, " no network, please check!")) : M.i("".concat(n2, " networkType:").concat(e2.networkType)); } }), this._mpNetworkStatusCallback = this._onNetworkStatusChange.bind(this), I.onNetworkStatusChange(this._mpNetworkStatusCallback)) : Ce && (this._networkType = da, this._webOnlineCallback = this._onWebOnline.bind(this), this._webOfflineCallback = this._onWebOffline.bind(this), window.addEventListener("online", this._webOnlineCallback), window.addEventListener("offline", this._webOfflineCallback)); } }, { key: "_onWebOnline", value: function() { this._onNetworkStatusChange({ isConnected: true, networkType: da }); } }, { key: "_onWebOffline", value: function() { this._onNetworkStatusChange({ isConnected: false, networkType: la }); } }, { key: "_onNetworkStatusChange", value: function(e2) { var t2 = e2.isConnected, e2 = e2.networkType, n2 = "".concat(this._n, "._onNetworkStatusChange"), o2 = false, i2 = "previous:".concat(this._networkType, " current:").concat(e2); t2 ? (M.i("".concat(n2, " ").concat(i2)), this._networkType !== e2 && (o2 = true, this._networkType = e2, this._m.get(21).reConnect(true))) : this._networkType !== e2 && (o2 = true, this._networkType = e2, M.w("".concat(n2, " no network, please check!")), this._m.get(21).offline()), o2 && new G("networkChange").setMessage("isConnected:".concat(t2, " ").concat(i2)).end(); } }, { key: "isOnline", value: function() { return this._networkType !== la; } }, { key: "getNetworkType", value: function() { return this._networkType; } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), v ? null !== this._mpNetworkStatusCallback && (I.offNetworkStatusChange && I.offNetworkStatusChange(this._mpNetworkStatusCallback), this._mpNetworkStatusCallback = null) : Ce ? (null !== this._webOnlineCallback && (window.removeEventListener("online", this._webOnlineCallback), this._webOnlineCallback = null), null !== this._onWebOffline && (window.removeEventListener("offline", this._webOfflineCallback), this._webOfflineCallback = null)) : ye && this._removeListener && (this._removeListener(), this._removeListener = null); } }]), _a); function _a(e2) { d(this, _a), this._m = e2, this._networkType = da, this._n = "NetMonitorModule", this._mpNetworkStatusCallback = null, this._webOnlineCallback = null, this._webOfflineCallback = null, this._removeListener = null, this._m.getIEmitInst().on(P.A2KEY_AND_TINYID_UPDATED, this._startRN, this); } function ha(e2) { d(this, ha), (e2 = sa.call(this, e2))._n = "EventStatModule", e2.TAG = "im-ssolog-event", e2._reportBody = new ca(), e2.MIN_THRESHOLD = 20, e2.MAX_THRESHOLD = 100, e2.WAITING_TIME = 6e4, e2.REPORT_LEVEL = [4, 5, 6], e2.REPORT_SDKAPPID_BLACKLIST = [], e2.REPORT_TINYID_WHITELIST = [], e2._lastReportTime = Date.now(); var t2 = e2.getIEmitInst(); return t2.on(P.A2KEY_AND_TINYID_UPDATED, e2._onLoginSuccess, i(e2)), t2.on(P.CLOUD_CONFIG, e2._onCloudConfig, i(e2)), e2; } function ga(e2) { d(this, ga), this._n = "SSOLogBody", this._report = []; } function fa(e2) { d(this, fa), this._m = e2, this._n = "StorageModule", this._storageQueue = /* @__PURE__ */ new Map(), this._errorTolerantHandle(); } function ma(e2, t2) { return e2(t2 = { exports: {} }, t2.exports), t2.exports; } var va, Ia = ma(function(e2) { var o2 = Object.prototype.hasOwnProperty, _2 = "~"; function n2() { } function a2(e3, t3, n3) { this.fn = e3, this.context = t3, this.once = n3 || false; } function i2(e3, t3, n3, o3, i3) { if ("function" != typeof n3) throw new TypeError("The listener must be a function"); n3 = new a2(n3, o3 || e3, i3), o3 = _2 ? _2 + t3 : t3; return e3._events[o3] ? e3._events[o3].fn ? e3._events[o3] = [e3._events[o3], n3] : e3._events[o3].push(n3) : (e3._events[o3] = n3, e3._eventsCount++), e3; } function c2(e3, t3) { 0 == --e3._eventsCount ? e3._events = new n2() : delete e3._events[t3]; } function t2() { this._events = new n2(), this._eventsCount = 0; } Object.create && (n2.prototype = /* @__PURE__ */ Object.create(null), new n2().__proto__ || (_2 = false)), t2.prototype.eventNames = function() { var e3, t3, n3 = []; if (0 === this._eventsCount) return n3; for (t3 in e3 = this._events) o2.call(e3, t3) && n3.push(_2 ? t3.slice(1) : t3); return Object.getOwnPropertySymbols ? n3.concat(Object.getOwnPropertySymbols(e3)) : n3; }, t2.prototype.listeners = function(e3) { var e3 = _2 ? _2 + e3 : e3, t3 = this._events[e3]; if (!t3) return []; if (t3.fn) return [t3.fn]; for (var n3 = 0, o3 = t3.length, i3 = new Array(o3); n3 < o3; n3++) i3[n3] = t3[n3].fn; return i3; }, t2.prototype.listenerCount = function(e3) { e3 = _2 ? _2 + e3 : e3, e3 = this._events[e3]; return e3 ? e3.fn ? 1 : e3.length : 0; }, t2.prototype.emit = function(e3, t3, n3, o3, i3, a3) { var s2 = _2 ? _2 + e3 : e3; if (!this._events[s2]) return false; var r2, c3 = this._events[s2], u2 = arguments.length; if (c3.fn) { switch (c3.once && this.removeListener(e3, c3.fn, void 0, true), u2) { case 1: return c3.fn.call(c3.context), true; case 2: return c3.fn.call(c3.context, t3), true; case 3: return c3.fn.call(c3.context, t3, n3), true; case 4: return c3.fn.call(c3.context, t3, n3, o3), true; case 5: return c3.fn.call(c3.context, t3, n3, o3, i3), true; case 6: return c3.fn.call(c3.context, t3, n3, o3, i3, a3), true; } for (p2 = 1, r2 = new Array(u2 - 1); p2 < u2; p2++) r2[p2 - 1] = arguments[p2]; c3.fn.apply(c3.context, r2); } else for (var l2, d2 = c3.length, p2 = 0; p2 < d2; p2++) switch (c3[p2].once && this.removeListener(e3, c3[p2].fn, void 0, true), u2) { case 1: c3[p2].fn.call(c3[p2].context); break; case 2: c3[p2].fn.call(c3[p2].context, t3); break; case 3: c3[p2].fn.call(c3[p2].context, t3, n3); break; case 4: c3[p2].fn.call(c3[p2].context, t3, n3, o3); break; default: if (!r2) for (l2 = 1, r2 = new Array(u2 - 1); l2 < u2; l2++) r2[l2 - 1] = arguments[l2]; c3[p2].fn.apply(c3[p2].context, r2); } return true; }, t2.prototype.on = function(e3, t3, n3) { return i2(this, e3, t3, n3, false); }, t2.prototype.once = function(e3, t3, n3) { return i2(this, e3, t3, n3, true); }, t2.prototype.removeListener = function(e3, t3, n3, o3) { e3 = _2 ? _2 + e3 : e3; if (this._events[e3]) if (t3) { var i3 = this._events[e3]; if (i3.fn) i3.fn !== t3 || o3 && !i3.once || n3 && i3.context !== n3 || c2(this, e3); else { for (var a3 = 0, s2 = [], r2 = i3.length; a3 < r2; a3++) (i3[a3].fn !== t3 || o3 && !i3[a3].once || n3 && i3[a3].context !== n3) && s2.push(i3[a3]); s2.length ? this._events[e3] = 1 === s2.length ? s2[0] : s2 : c2(this, e3); } } else c2(this, e3); return this; }, t2.prototype.removeAllListeners = function(e3) { return e3 ? (e3 = _2 ? _2 + e3 : e3, this._events[e3] && c2(this, e3)) : (this._events = new n2(), this._eventsCount = 0), this; }, t2.prototype.off = t2.prototype.removeListener, t2.prototype.addListener = t2.prototype.on, t2.prefixed = _2, e2.exports = t2.EventEmitter = t2; }), Ma = ["rich.my-imcloud.com", "imrich.qcloud.com"], ya = ["requestSnapshotUrl"], Ca = (t(ka, u), va = n(ka), e(ka, [{ key: "_init", value: function() { this._fileDownloadProxy = this.getFileDownloadProxy(), this._authKey = this.getDowloadFileAuthKey(); var e2 = this.get(18); this.TIMUploadPlugin = e2.getPlugin("tim-upload-plugin"), this.TIMUploadPlugin ? this._initUploaderMethod() : (this.COSSDK = e2.getPlugin(e2 = v ? "cos-wx-sdk" : "cos-js-sdk"), this.COSSDK ? (this._getAuthorizationKey(), this.warn("CosReplacement", e2)) : this.warn("PluginUndetected")); } }, { key: "_onCloudConfig", value: function() { var t2 = this, e2 = "".concat(this._n, "._onCloudConfig"), n2 = this.getCloudConfig("upload_size_limit"), o2 = this.getCloudConfig("simple_cos"), i2 = this.getCloudConfig("file_dn_list"); if (M.l("".concat(e2, " uploadSizeLimit:").concat(n2, " simpleCos:").concat(o2)), !N(n2)) try { var a2 = JSON.parse(n2); this.UPLOAD_SIZE_LIMIT = { A: a2.a ? 1048576 * parseInt(a2.a) : this.UPLOAD_SIZE_LIMIT.A, F: a2.f ? 1048576 * parseInt(a2.f) : this.UPLOAD_SIZE_LIMIT.F, I: a2.i ? 1048576 * parseInt(a2.i) : this.UPLOAD_SIZE_LIMIT.I, V: a2.v ? 1048576 * parseInt(a2.v) : this.UPLOAD_SIZE_LIMIT.V }; } catch (e3) { } if (N(o2) || (this.isSimpleCos = "1" === o2), !N(i2)) try { JSON.parse(i2).forEach(function(e3) { t2._fileDNList.includes(e3) || t2._fileDNList.push(e3); }); } catch (e3) { } } }, { key: "_getAuthorizationKey", value: function() { var n2 = this, o2 = "".concat(this._n, ".").concat("_getAuthorizationKey"), i2 = new G("_getAuthorizationKey"), a2 = Math.ceil(Date.now() / 1e3); this.req({ P: k.COS_SIGN, data: { duration: this.expiredTimeLimit } }).then(function(e2) { var e2 = e2.data, t2 = (M.l("".concat(o2, " ok. data:"), e2), e2.expiredTime - a2); i2.setMessage("requestId:".concat(e2.requestId, " requestTime:").concat(a2, " expiredTime:").concat(e2.expiredTime, " diff:").concat(t2, "s")).end(), !v && e2.region && (n2.region = e2.region), n2.appid = e2.appid, n2.bucketName = e2.bucketName, n2.ciUrl = e2.ciUrl, n2.directory = e2.directory, n2.downloadUrl = e2.downloadUrl, n2.uploadUrl = e2.uploadUrl, n2.cosOptions = { secretId: e2.secretId, secretKey: e2.secretKey, sessionToken: e2.sessionToken, expiredTime: e2.expiredTime }, M.l("".concat(o2, " ok. region:").concat(n2.region, " bucketName:").concat(n2.bucketName)), n2._initUploaderMethod(); }).catch(function(e2) { i2.setError(e2).end(), M.w("".concat(o2, " failed. error:"), e2); }); } }, { key: "_getCosPreSigUrl", value: function(t2) { var i2 = this, a2 = "".concat(this._n, ".").concat("_getCosPreSigUrl"), s2 = Math.ceil(Date.now() / 1e3), r2 = new G("_getCosPreSigUrl"), e2 = { uploadMethod: t2.uploadMethod, platform: this.getPlatform(), SDKAppID: this.getSDKAppID(), userID: t2.userID, conversationType: t2.conversationType, uploadConfig: [{ fileID: 1, fileType: t2.fileType, fileName: t2.fileName }] }, n2 = k.SIMPLE_COS_PRE_SIG; return this.isSimpleCos || (e2 = { fileType: t2.fileType, fileName: t2.fileName, uploadMethod: t2.uploadMethod, duration: t2.duration }, n2 = k.COS_PRE_SIG), this.req({ P: n2, data: e2 }).then(function(e3) { i2.tryCount = 0; var t3, n3, e3 = e3.data || {}, o2 = (M.l("".concat(a2, " ok. isSimpleCos:").concat(i2.isSimpleCos, " data:"), e3), ""); return o2 = i2.isSimpleCos ? (t3 = (n3 = e3.preSig[0]).uploadUrl, n3 = n3.fileKey, "uploadIP:".concat(e3.uploadIP, " uploadUrl:").concat(t3, " fileKey:").concat(n3, " cost:").concat(nn(s2))) : "requestId:".concat(e3.requestId, " expiredTime:").concat(e3.expiredTime, " diff:").concat(e3.expiredTime - s2, "s"), r2.setMessage(o2).end(), e3; }).catch(function(e3) { return -1 === e3.code && (e3.code = L.COS_GET_SIG_FAIL), r2.setError(e3).end(), M.w("".concat(a2, " failed. error:"), e3), i2.tryCount < 1 ? (i2.tryCount++, i2._getCosPreSigUrl(t2)) : (i2.tryCount = 0, D({ code: L.COS_GET_SIG_FAIL })); }); } }, { key: "_initUploaderMethod", value: function() { var n2 = this; this.TIMUploadPlugin ? (this.timUploadPlugin = new this.TIMUploadPlugin(), this._cosUploadMethod = function(e2, t2) { n2.timUploadPlugin.uploadFile(e2, t2); }) : this.appid && (this.cos = v ? new this.COSSDK({ ForcePathStyle: true, getAuthorization: this._getAuthorization.bind(this) }) : new this.COSSDK({ getAuthorization: this._getAuthorization.bind(this) }), this._cosUploadMethod = v ? function(e2, t2) { n2.cos.postObject(e2, t2); } : function(e2, t2) { n2.cos.uploadFiles(e2, t2); }); } }, { key: "onCheckTimer", value: function(e2) { !this.COSSDK || this.TIMUploadPlugin || this.isLoggedIn() && e2 % 60 == 0 && Math.ceil(Date.now() / 1e3) >= this.cosOptions.expiredTime - 120 && this._getAuthorizationKey(); } }, { key: "getFileDNList", value: function() { return this._fileDNList; } }, { key: "_getAuthorization", value: function(e2, t2) { t2({ TmpSecretId: this.cosOptions.secretId, TmpSecretKey: this.cosOptions.secretKey, XCosSecurityToken: this.cosOptions.sessionToken, ExpiredTime: this.cosOptions.expiredTime }); } }, { key: "upload", value: function(e2) { if (true === e2._relayFlag) return Promise.resolve(); var t2 = this.get(26); switch (e2.type) { case A.MSG_IMAGE: return t2.addTotalCount(Wn), this._uploadImage(e2); case A.MSG_FILE: return t2.addTotalCount(Wn), this._uploadFile(e2); case A.MSG_AUDIO: return t2.addTotalCount(Wn), this._uploadAudio(e2); case A.MSG_VIDEO: return t2.addTotalCount(Wn), this._uploadVideo(e2); default: return Promise.resolve(); } } }, { key: "_uploadImage", value: function(v2) { var I2 = this, e2 = this.get(2), M2 = v2.getElements()[0], t2 = e2.getMessageOption(v2.clientSequence); return this.doUploadImage({ file: t2.payload.file, to: t2.to, message: v2, onProgress: function(e3) { if (M2.updatePercent(e3), lt(t2.onProgress)) try { t2.onProgress(e3); } catch (e4) { return D({ code: L.MSG_ONPROGRESS_ERR }); } } }).then(function(e3) { var t3 = e3.location, n2 = e3.fileType, o2 = e3.fileSize, i2 = e3.width, a2 = e3.height, s2 = e3.smallImageUrl, r2 = e3.smallImageWidth, c2 = e3.smallImageHeight, u2 = e3.largeImageUrl, l2 = e3.largeImageWidth, d2 = e3.largeImageHeight, p2 = e3.imageInfoArray, e3 = I2.isPrivateNetWork() ? t3 : It(t3); M2.updateImageFormat(n2); var _2, h2, g2 = { size: o2, url: e3, width: i2, height: a2 }; if (p2 && 0 < p2.length) for (var f2 = 0; f2 < p2.length; f2++) { var m2 = p2[f2]; 1 === m2.type ? _2 = m2 : 2 === m2.type ? h2 = m2 : g2 = y(y({}, g2), m2); } else h2 = s2 && u2 ? (_2 = { url: s2, width: r2, height: c2 }, { url: u2, width: l2, height: d2 }) : (_2 = Ht({ originUrl: e3, originWidth: i2, originHeight: a2, min: 198 }), Ht({ originUrl: e3, originWidth: i2, originHeight: a2, min: 720 })); return M2.updateImageInfoArray([y({}, g2), y({}, h2), y({}, _2)]), v2; }); } }, { key: "_uploadFile", value: function(n2) { var o2 = this, e2 = this.get(2), i2 = n2.getElements()[0], t2 = e2.getMessageOption(n2.clientSequence); return this.doUploadFile({ file: t2.payload.file, to: t2.to, message: n2, onProgress: function(e3) { if (i2.updatePercent(e3), lt(t2.onProgress)) try { t2.onProgress(e3); } catch (e4) { return D({ code: L.MSG_ONPROGRESS_ERR }); } } }).then(function(e3) { var e3 = e3.location, t3 = e3; return o2.isPrivateNetWork() || (t3 = ao(t3 = It(e3), o2._fileDownloadProxy, o2._authKey, o2._fileDNList)), i2.updateFileUrl(t3), n2; }); } }, { key: "_uploadAudio", value: function(t2) { var n2 = this, e2 = this.get(2), o2 = t2.getElements()[0], i2 = e2.getMessageOption(t2.clientSequence); return this.doUploadAudio({ file: i2.payload.file, to: i2.to, message: t2, onProgress: function(e3) { if (o2.updatePercent(e3), lt(i2.onProgress)) try { i2.onProgress(e3); } catch (e4) { return D({ code: L.MSG_ONPROGRESS_ERR }); } } }).then(function(e3) { e3 = e3.location, e3 = n2.isPrivateNetWork() ? e3 : It(e3); return o2.updateAudioUrl(e3), t2; }); } }, { key: "_uploadVideo", value: function(n2) { var o2 = this, e2 = this.get(2), i2 = n2.getElements()[0], t2 = e2.getMessageOption(n2.clientSequence); return this.doUploadVideo({ file: t2.payload.file, to: t2.to, message: n2, onProgress: function(e3) { if (i2.updatePercent(e3), lt(t2.onProgress)) try { t2.onProgress(e3); } catch (e4) { return D({ code: L.MSG_ONPROGRESS_ERR }); } } }).then(function(e3) { var t3 = e3.location, e3 = e3.snapshotInfo, t3 = o2.isPrivateNetWork() ? t3 : It(t3); return i2.updateVideoUrl(t3), S(e3) || i2.updateSnapshotInfo(e3), n2; }); } }, { key: "_checkSizeError", value: function(e2) { var t2 = ""; return "A" === e2 ? t2 = "audio" : "I" === e2 ? t2 = "image" : "V" === e2 ? t2 = "video" : "F" === e2 && (t2 = "file"), D({ code: L["MSG_".concat(e2, "_SIZE_LIMIT")], message: this.getErrMsg("UploadSizeLimit", t2, "".concat(this.UPLOAD_SIZE_LIMIT[e2] / 1048576, "MB")) }); } }, { key: "doUploadImage", value: function(o2) { var e2, i2, a2 = this; return !o2.file || this._isEmptyFileList(o2.file.files) ? D({ code: L.MSG_I_SELECT_F_FIRST }) : true !== (e2 = this._checkImageType(o2.file)) ? e2 : true !== (e2 = this._checkImageSize(o2.file)) ? e2 : (i2 = null, this._setUploadFileType(1), this.uploadByCOS(o2).then(function(e3) { if (i2 = e3, a2.isPrivateNetWork()) return Ft(n2); if (O(i2.imageInfoArray)) { var t2 = i2.imageInfoArray.find(function(e4) { return 3 === e4.type; }); if (t2) return t2; } var n2; return ye ? { width: o2.file.width, height: o2.file.height } : (n2 = It(e3.location), a2.COSSDK ? Ft(n2) : Ft(n2 = ao(n2, a2._fileDownloadProxy, a2._authKey, a2._fileDNList))); }).then(function(e3) { return i2.width = e3.width, i2.height = e3.height, Promise.resolve(i2); })); } }, { key: "_checkImageType", value: function(e2) { var t2 = "", t2 = v ? e2.url.slice(e2.url.lastIndexOf(".") + 1) : ye ? e2.type.split("/")[1] : e2.files[0].name.slice(e2.files[0].name.lastIndexOf(".") + 1); return 0 <= Qo.indexOf(t2.toLowerCase()) || D({ code: L.MSG_I_TYPES_LIMIT }); } }, { key: "_checkImageSize", value: function(e2) { return 0 === (e2 = (v || ye ? e2 : e2.files[0]).size) ? D({ code: L.MSG_F_IS_EMPTY }) : e2 < this.UPLOAD_SIZE_LIMIT.I || this._checkSizeError("I"); } }, { key: "doUploadFile", value: function(e2) { return !e2.file || this._isEmptyFileList(e2.file.files) ? D({ code: L.MSG_F_SELECT_F_FIRST }) : e2.file.files[0].size > this.UPLOAD_SIZE_LIMIT.F ? this._checkSizeError("F") : 0 === e2.file.files[0].size ? D({ code: L.MSG_F_IS_EMPTY }) : (this._setUploadFileType(255), this.uploadByCOS(e2)); } }, { key: "doUploadVideo", value: function(e2) { return e2.file.videoFile.size > this.UPLOAD_SIZE_LIMIT.V ? this._checkSizeError("V") : 0 === e2.file.videoFile.size ? D({ code: L.MSG_F_IS_EMPTY }) : -1 === $o.indexOf(e2.file.videoFile.type) ? D({ code: L.MSG_V_TYPES_LIMIT }) : (this._setUploadFileType(2), v || ye ? this.handleVideoUpload(y(y({}, e2), {}, { file: e2.file.videoFile })) : Ce ? this.handleVideoUpload(e2) : void 0); } }, { key: "handleVideoUpload", value: function(n2) { var o2 = this; return new Promise(function(t2, e2) { o2.uploadByCOS(n2).then(function(e3) { t2(e3); }).catch(function() { o2.uploadByCOS(n2).then(function(e3) { t2(e3); }).catch(function() { e2(new E({ code: L.MSG_V_UPLOAD_FAIL })); }); }); }); } }, { key: "doUploadAudio", value: function(e2) { return e2.file ? e2.file.size > this.UPLOAD_SIZE_LIMIT.A ? this._checkSizeError("A") : 0 === e2.file.size ? D({ code: L.MSG_F_IS_EMPTY }) : (this._setUploadFileType(3), this.uploadByCOS(e2)) : D({ code: L.MSG_A_UPLOAD_FAIL }); } }, { key: "uploadByCOS", value: function(t2) { var c2, u2, l2, d2, p2 = this; return lt(this._cosUploadMethod) ? this.timUploadPlugin ? this._uploadWithPreSigUrl(t2) : (c2 = new G("upload"), u2 = "".concat(this._n, ".uploadByCOS"), l2 = Date.now(), d2 = this._getFile(t2), new Promise(function(a2, s2) { var e2 = v ? p2._createCosOptionsWXMiniApp(t2) : p2._createCosOptionsWeb(t2), r2 = p2; p2._cosUploadMethod(e2, function(e3, t3) { var n2, o2, i2 = /* @__PURE__ */ Object.create(null); t3 ? e3 || O(t3.files) && t3.files[0].error ? (n2 = new E({ code: L.MSG_F_UPLOAD_FAIL }), c2.setError(n2).end(), M.l("".concat(u2, " failed. error:"), t3.files[0].error), 403 === t3.files[0].error.statusCode && p2._getAuthorizationKey(), s2(n2)) : (i2.fileName = d2.name, i2.fileSize = d2.size, i2.fileType = d2.type.slice(d2.type.indexOf("/") + 1).toLowerCase(), i2.location = (v ? t3 : t3.files[0].data).Location, n2 = Date.now() - l2, t3 = r2._formatFileSize(d2.size), o2 = r2._formatSpeed(1e3 * d2.size / n2), t3 = "size:".concat(t3, " time:").concat(n2, "ms speed:").concat(o2), M.l("".concat(u2, " success. name:").concat(d2.name, " ").concat(t3)), a2(i2), (o2 = p2.get(26)).addCost(Wn, n2), o2.addFileSize(Wn, d2.size), c2.setMessage(t3).end()) : (i2 = new E({ code: L.MSG_F_UPLOAD_FAIL }), c2.setError(i2).end(), M.w("".concat(u2, " failed. error:"), e3), 403 === e3.statusCode && p2._getAuthorizationKey(), s2(i2)); }); })) : (this.warn("PluginUndetected"), D({ code: L.COS_UNDETECTED })); } }, { key: "_uploadWithPreSigUrl", value: function(e2) { var p2 = this, _2 = "".concat(this._n, "._uploadWithPreSigUrl"), h2 = this._getFile(e2); return this._createCosOptionsPreSigUrl(e2).then(function(d2) { return new Promise(function(a2, s2) { var r2 = new G("upload"), e3 = d2.requestSnapshotUrl, c2 = void 0 === e3 ? void 0 : e3, u2 = K(d2, ya), l2 = Date.now(); p2._cosUploadMethod(u2, function(e4, t2) { if (e4 || 403 === t2.statusCode) r2.setError(new E(e4)).end(), o2 = { HttpStatusCode: 9999, CostTime: nn(l2, false), error: e4, url: d2.url }, t2.data && t2.data.uploadIP && (o2.uploadIP = t2.data.uploadIP), p2._uploadSSOLog(o2), M.l("".concat(_2, " failed, error:"), e4), s2(new E({ code: L.MSG_F_UPLOAD_FAIL })); else { var n2 = /* @__PURE__ */ Object.create(null), o2 = t2.data.location || "", e4 = (p2.isPrivateNetWork() || 0 !== o2.indexOf("https://") && 0 !== o2.indexOf("http://") || (o2 = o2.split("//")[1]), n2.fileName = h2.name, n2.fileSize = h2.size, n2.fileType = h2.type.slice(h2.type.indexOf("/") + 1).toLowerCase(), n2.location = o2, nn(l2, false)), o2 = p2._formatFileSize(h2.size), i2 = p2._formatSpeed(1e3 * h2.size / e4), o2 = "size:".concat(o2, " time:").concat(e4, "ms speed:").concat(i2, " res:").concat(JSON.stringify(t2.data)), i2 = (M.l("".concat(_2, " ok. name:").concat(h2.name, " ").concat(o2)), r2.setMessage(o2).end(), { HttpStatusCode: t2.statusCode, FileSize: h2.size, CostTime: e4, url: d2.url }), o2 = (t2.data && t2.data.uploadIP && (i2.uploadIP = t2.data.uploadIP), p2._uploadSSOLog(i2), p2.get(26)), i2 = (o2.addCost(Wn, e4), o2.addFileSize(Wn, h2.size), []); if (u2.thumbUrl && u2.largeUrl && i2.push.apply(i2, [p2._getSmallImageInfoByUrl(u2.thumbUrl, n2), p2._getLargeImageInfoByUrl(u2.largeUrl, n2)]), 1 === p2.uploadFileType && p2.isSimpleCos && !p2.isPrivateNetWork() && (i2.push(p2._getImageInfoArray(u2.downloadUrl, n2)), t2.data.uploadIP) && i2.push(p2._getDownloadIP(u2.downloadUrl.split("//")[1].split("/")[0], n2)), c2 && i2.push(p2._getSnapshotInfoByUrl(c2, n2)), 0 < i2.length) return Promise.all(i2).then(function() { a2(n2); }); a2(n2); } }); }); }); } }, { key: "_getDownloadIP", value: function(e2, n2) { var o2 = "".concat(this._n, "._getDownloadIP"), i2 = Date.now(); return this.req({ P: k.GET_IP, data: { domainName: e2 } }).then(function(e3) { var t2; e3.data && e3.data.ip && (M.l("".concat(o2, " ok. downloadIP:").concat(e3.data.ip, " cost:").concat(nn(i2))), (t2 = n2.location.split("/"))[0] = e3.data.ip, n2.location = t2.join("/")); }).catch(function(e3) { }); } }, { key: "_getImageInfoArray", value: function(t2, n2) { var o2 = this, i2 = "".concat(this._n, "._getImageInfoArray"), a2 = Date.now(); return this.req({ P: k.GET_IMAGE_INFO, data: { imageUrl: t2 } }).then(function(e2) { e2 = e2.data || {}; return M.l("".concat(i2, " ok. data: ").concat(JSON.stringify(e2), " cost:").concat(nn(a2))), n2.imageInfoArray = e2.imageInfoArray, e2; }).catch(function(e2) { n2.imageInfoArray = void 0, o2._uploadSSOLog({ HttpStatusCode: 1e4, CostTime: nn(a2, false), url: t2 }); }); } }, { key: "_uploadSSOLog", value: function(e2) { var t2, n2; this.isSimpleCos && ((t2 = new G()).setEventType(18), e2.error && t2.setError(new E(e2.error)), n2 = "HttpStatusCode:".concat(e2.HttpStatusCode, "|CosRequestId:").concat(e2.CosRequestId || "", "|") + "FileAlreadyExist:".concat(e2.FileAlreadyExist || 0, "|FileSize:").concat(e2.FileSize || 0, "|CostTime:").concat(e2.CostTime), e2.uploadIP && (n2 += "|FinalIP:".concat(e2.uploadIP)), t2.setMessage("OK").setMoreMessage(e2.url).setExtension(n2).end()); } }, { key: "_getRawOrUploadProxyUrl", value: function(e2) { var t2 = this.get(12).getFileUploadProxy(), n2 = e2; return n2 = t2 ? e2.replace(/^https:\/\/[^/]+/, t2) : n2; } }, { key: "_getFile", value: function(e2) { return O(e2.file.files) || dt(e2.file.files) ? e2.file.files[0] : e2.file; } }, { key: "_formatFileSize", value: function(e2) { return e2 < 1024 ? e2 + "B" : e2 < 1048576 ? Math.floor(e2 / 1024) + "KB" : Math.floor(e2 / 1048576) + "MB"; } }, { key: "_formatSpeed", value: function(e2) { return e2 <= 1048576 ? Yt(e2 / 1024, 1) + "KB/s" : Yt(e2 / 1048576, 1) + "MB/s"; } }, { key: "_createCosOptionsWeb", value: function(t2) { var e2 = this._getFile(t2), n2 = e2.name, n2 = n2.slice(n2.lastIndexOf(".")), n2 = this._genFileName("".concat(ft(999999)).concat(n2)); return { files: [{ Bucket: "".concat(this.bucketName, "-").concat(this.appid), Region: this.region, Key: "".concat(this.directory, "/").concat(n2), Body: e2 }], SliceSize: 1048576, onProgress: function(e3) { if ("function" == typeof t2.onProgress) try { t2.onProgress(e3.percent); } catch (e4) { M.w("onProgress callback error:", e4); } }, onFileFinish: function(e3, t3, n3) { } }; } }, { key: "_createCosOptionsWXMiniApp", value: function(t2) { var e2 = this._getFile(t2), n2 = this._genFileName(e2.name), e2 = e2.url; return { Bucket: "".concat(this.bucketName, "-").concat(this.appid), Region: this.region, Key: "".concat(this.directory, "/").concat(n2), FilePath: e2, onProgress: function(e3) { if (M.l(JSON.stringify(e3)), "function" == typeof t2.onProgress) try { t2.onProgress(e3.percent); } catch (e4) { M.w("onProgress callback error:", e4); } } }; } }, { key: "_createCosOptionsPreSigUrl", value: function(r2) { var e2, c2 = this, u2 = "", l2 = "", t2 = 0, n2 = this._getFile(r2), t2 = v || ye ? (u2 = r2.message.type === A.MSG_FILE ? (e2 = (e2 = n2.name).slice(e2.lastIndexOf(".")), this._genFileName("".concat(ft(999999)).concat(e2))) : this._genFileName(n2.name), l2 = n2.url, 1) : (e2 = (e2 = n2.name).slice(e2.lastIndexOf(".")), u2 = this._genFileName("".concat(ft(999999)).concat(e2)), l2 = n2, 0); return this._getCosPreSigUrl({ fileType: this.uploadFileType, fileName: u2, uploadMethod: t2, duration: this.duration, userID: r2.message.from, conversationType: Pt(r2.message.conversationID) ? 1 : 2 }).then(function(e3) { var t3 = c2.isSimpleCos ? e3.preSig[0] : e3, n3 = t3.uploadUrl, o2 = t3.downloadUrl, i2 = t3.requestSnapshotUrl, i2 = void 0 === i2 ? void 0 : i2, a2 = t3.thumbUrl, s2 = t3.largeUrl, t3 = t3.fileKey, e3 = e3.uploadIP, e3 = void 0 === e3 ? "" : e3; return { url: c2._getRawOrUploadProxyUrl(n3), fileType: c2.uploadFileType, fileName: u2, resources: l2, downloadUrl: o2, requestSnapshotUrl: i2, thumbUrl: a2, largeUrl: s2, fileKey: t3, uploadIP: !c2.isPrivateNetWork() && e3, onProgress: function(e4) { if ("function" == typeof r2.onProgress) try { r2.onProgress(e4.percent); } catch (e5) { M.w("onProgress callback error:", e5), M.e(e5); } } }; }); } }, { key: "_genFileName", value: function(e2) { return "".concat(qt(), "-").concat(e2); } }, { key: "_setUploadFileType", value: function(e2) { this.uploadFileType = e2; } }, { key: "_getSnapshotInfoByUrl", value: function(e2, n2) { var o2 = this, i2 = "_getSnapshotInfoByUrl", a2 = new G(i2); return this.req({ P: k.VIDEO_COVER, data: { platform: this.getPlatform(), coverName: this._genFileName(ft(99999)), requestSnapshotUrl: e2 } }).then(function(e3) { var t2, e3 = (e3.data || {}).snapshotUrl; return M.l("".concat(o2._n, ".").concat(i2, " ok. snapshotUrl:").concat(e3)), a2.setMessage("snapshotUrl:".concat(e3)).end(), S(e3) ? {} : Ft(t2 = ao(e3, o2._fileDownloadProxy, o2._authKey, o2._fileDNList)).then(function(e4) { n2.snapshotInfo = { snapshotUrl: t2, snapshotWidth: e4.width, snapshotHeight: e4.height }; }); }).catch(function(e3) { return M.w("".concat(o2._n, ".").concat(i2, " failed. error:"), e3), a2.setCode(e3.errorCode).setMessage(e3.errorInfo).end(), {}; }); } }, { key: "_getSmallImageInfoByUrl", value: function(t2, n2) { return Ft(ao(t2, this._fileDownloadProxy, this._authKey, this._fileDNList)).then(function(e2) { n2.smallImageUrl = t2, n2.smallImageWidth = e2.width, n2.smallImageHeight = e2.height; }); } }, { key: "_getLargeImageInfoByUrl", value: function(t2, n2) { return Ft(ao(t2, this._fileDownloadProxy, this._authKey, this._fileDNList)).then(function(e2) { n2.largeImageUrl = t2, n2.largeImageWidth = e2.width, n2.largeImageHeight = e2.height; }); } }, { key: "_isEmptyFileList", value: function(e2) { return !(!dt(e2) || 0 !== e2.length); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")); } }]), ka), Ta = ["downloadKey", "pbDownloadKey", "messageList"], Da = (e(Sa, [{ key: "uploadMergerMessage", value: function(e2, n2) { var o2 = "".concat(this._n, ".").concat("uploadMergerMessage"), e2 = (M.d("".concat(o2, " message:"), e2, "messageBytes:".concat(n2)), JSON.parse(JSON.stringify(e2.payload)).messageList), i2 = e2.length, t2 = this._msgM.get(17).getFileDNList(), a2 = new G("uploadMergerMessage"); return e2.forEach(function(e3) { so(e3.messageBody[0].type, e3.messageBody, t2); }), this._msgM.req({ P: k.UPLOAD_MERGER_MSG, data: { messageList: e2 } }).then(function(e3) { M.d("".concat(o2, " ok. response:"), e3.data); var e3 = e3.data, t3 = e3.pbDownloadKey, e3 = e3.downloadKey, t3 = { pbDownloadKey: t3, downloadKey: e3, messageNumber: i2 }; return a2.setMessage("".concat(i2, "-").concat(n2, "-").concat(e3)).end(), t3; }).catch(function(e3) { throw M.w("".concat(o2, " failed. error:"), e3), a2.setError(e3).end(), e3; }); } }, { key: "downloadMergerMessage", value: function(i2) { var a2 = this, s2 = "".concat(this._n, ".").concat("downloadMergerMessage"), t2 = (M.d("".concat(s2, " message:"), i2), i2.payload.downloadKey), r2 = this._msgM.getFileDownloadProxy(), c2 = this._msgM.getDowloadFileAuthKey(), u2 = new G("downloadMergerMessage"); return u2.setMessage("downloadKey:".concat(t2)), this._msgM.req({ P: k.DOWNLOAD_MERGER_MSG, data: { downloadKey: t2 } }).then(function(e2) { M.d("".concat(s2, " ok. response:"), e2.data); var t3, n2, o2 = a2._msgM.get(17).getFileDNList(); return lt(i2.clearElement) ? ((t3 = i2.payload).downloadKey, t3.pbDownloadKey, t3.messageList, t3 = K(t3, Ta), i2.clearElement(), i2.setElement({ type: i2.type, content: y({ messageList: e2.data.messageList }, t3) }, r2, c2, o2)) : (n2 = [], e2.data.messageList.forEach(function(e3) { S(e3) || (e3 = new yo(e3, r2, c2, o2), n2.push(e3)); }), i2.payload.messageList = n2, i2.payload.downloadKey = "", i2.payload.pbDownloadKey = ""), u2.end(), i2; }).catch(function(e2) { throw M.w("".concat(s2, " failed. key:").concat(t2, " error:"), e2), u2.setError(e2).end(), e2; }); } }, { key: "createMergerMessagePack", value: function(e2, t2, n2) { return e2.conversationType === A.CONV_C2C ? this._createC2CMergerMessagePack(e2, t2, n2) : this._createGroupMergerMessagePack(e2, t2, n2); } }, { key: "_createC2CMergerMessagePack", value: function(e2, t2, n2) { var o2 = null, i2 = (t2 && (t2.offlinePushInfo && (o2 = t2.offlinePushInfo), true === t2.onlineUserOnly) && (o2 ? o2.disablePush = true : o2 = { disablePush: true }), []), a2 = (f(t2) && f(t2.messageControlInfo) && (a2 = (r2 = t2.messageControlInfo).excludedFromUnreadCount, s2 = r2.excludedFromLastMessage, r2 = r2.excludedFromContentModeration, true === a2 && i2.push("NoUnread"), true === s2 && i2.push("NoLastMsg"), true === r2) && i2.push("NoMsgCheck"), ""), s2 = (m(e2.cloudCustomData) && 0 < e2.cloudCustomData.length && (a2 = e2.cloudCustomData), n2.pbDownloadKey), r2 = n2.downloadKey, n2 = n2.messageNumber, c2 = e2.payload, u2 = c2.title, l2 = c2.abstractList, c2 = c2.compatibleText, d2 = this._msgM.get(6), d2 = d2 && d2.isOnlineMessage(e2, t2) ? 0 : void 0; return { P: k.SEND_C2C_MSG, data: { fromAccount: this._msgM.getMyUserID(), toAccount: e2.to, msgBody: [{ msgType: e2.type, msgContent: { pbDownloadKey: s2, downloadKey: r2, title: u2, abstractList: l2, compatibleText: c2, messageNumber: n2 } }], cloudCustomData: a2, clientTime: e2.clientTime, msgSeq: e2.sequence, msgRandom: e2.random, msgLifeTime: d2, offlinePushInfo: wo(o2), messageControlInfo: 0 !== d2 ? i2 : void 0, isSupportExtension: true === e2.isSupportExtension ? 1 : 0, isRelayMessage: true === e2._relayFlag ? 1 : 0 } }; } }, { key: "_createGroupMergerMessagePack", value: function(e2, t2, n2) { var o2 = null, i2 = (t2 && t2.offlinePushInfo && (o2 = t2.offlinePushInfo), []), a2 = (f(t2) && f(t2.messageControlInfo) && (a2 = (r2 = t2.messageControlInfo).excludedFromUnreadCount, s2 = r2.excludedFromLastMessage, r2 = r2.excludedFromContentModeration, true === a2 && i2.push("NoUnread"), true === s2 && i2.push("NoLastMsg"), true === r2) && i2.push("NoMsgCheck"), ""), s2 = (m(e2.cloudCustomData) && 0 < e2.cloudCustomData.length && (a2 = e2.cloudCustomData), n2.pbDownloadKey), r2 = n2.downloadKey, n2 = n2.messageNumber, c2 = e2.payload, u2 = c2.title, l2 = c2.abstractList, c2 = c2.compatibleText, d2 = this._msgM.get(7), t2 = d2 && d2.isOnlineMessage(e2, t2) ? 1 : 0; return { P: k.SEND_GRP_MSG, data: { fromAccount: this._msgM.getMyUserID(), groupID: e2.to, msgBody: [{ msgType: e2.type, msgContent: { pbDownloadKey: s2, downloadKey: r2, title: u2, abstractList: l2, compatibleText: c2, messageNumber: n2 } }], random: e2.random, priority: e2.priority, clientSequence: e2.clientSequence, groupAtInfo: void 0, cloudCustomData: a2, onlineOnlyFlag: t2, offlinePushInfo: wo(o2), clientTime: e2.clientTime, needReadReceipt: true !== e2.needReadReceipt || d2.isMessageFromOrToAVChatroom(e2.to) ? 0 : 1, messageControlInfo: 0 == t2 ? i2 : void 0, isSupportExtension: true === e2.isSupportExtension ? 1 : 0, isRelayMessage: true === e2._relayFlag ? 1 : 0 } }; } }]), Sa), Ea = { ERR_SVR_COMM_SENSITIVE_TEXT: 80001, ERR_SVR_COMM_BODY_SIZE_LIMIT: 80002, OPEN_SERVICE_OVERLOAD_ERROR: 60022, ERR_SVR_MSG_PKG_PARSE_FAILED: 20001, ERR_SVR_MSG_INTERNAL_AUTH_FAILED: 20002, ERR_SVR_MSG_INVALID_ID: 20003, ERR_SVR_MSG_PUSH_DENY: 20006, ERR_SVR_MSG_IN_PEER_BLACKLIST: 20007, ERR_SVR_MSG_BOTH_NOT_FRIEND: 20009, ERR_SVR_MSG_NOT_PEER_FRIEND: 20010, ERR_SVR_MSG_NOT_SELF_FRIEND: 20011, ERR_SVR_MSG_SHUTUP_DENY: 20012, ERR_SVR_GROUP_INVALID_PARAMETERS: 10004, ERR_SVR_GROUP_PERMISSION_DENY: 10007, ERR_SVR_GROUP_NOT_FOUND: 10010, ERR_SVR_GROUP_INVALID_GROUPID: 10015, ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY: 10016, ERR_SVR_GROUP_SHUTUP_DENY: 10017, MSG_SEND_FAIL: 2100, OVER_FREQUENCY_LIMIT: 2996 }, La = [L.MSG_ONPROGRESS_ERR, L.MSG_I_SELECT_F_FIRST, L.MSG_I_TYPES_LIMIT, L.MSG_F_IS_EMPTY, L.MSG_I_SIZE_LIMIT, L.MSG_F_SELECT_F_FIRST, L.MSG_F_SIZE_LIMIT, L.MSG_V_SIZE_LIMIT, L.MSG_V_TYPES_LIMIT, L.MSG_A_UPLOAD_FAIL, L.MSG_A_SIZE_LIMIT, L.COS_UNDETECTED]; function Sa(e2) { d(this, Sa), this._n = "MergerMessageHandler", this._msgM = e2; } function ka(e2) { d(this, ka), (e2 = va.call(this, e2))._n = "UploadModule", e2.TIMUploadPlugin = null, e2.timUploadPlugin = null, e2.COSSDK = null, e2._cosUploadMethod = null, e2.expiredTimeLimit = 600, e2.appid = 0, e2.bucketName = "", e2.ciUrl = "", e2.directory = "", e2.downloadUrl = "", e2.uploadUrl = "", e2.region = "ap-shanghai", e2.cos = null, e2.cosOptions = { secretId: "", secretKey: "", sessionToken: "", expiredTime: 0 }, e2.uploadFileType = "", e2.duration = 900, e2.tryCount = 0, e2.UPLOAD_SIZE_LIMIT = { A: 20971520, F: 104857600, I: 20971520, V: 104857600 }, e2.isSimpleCos = false, e2._fileDownloadProxy = "", e2._authKey = "", e2._fileDNList = Ma; var t2 = e2.getIEmitInst(); return t2.on(P.A2KEY_AND_TINYID_UPDATED, e2._init, i(e2)), t2.on(P.CLOUD_CONFIG, e2._onCloudConfig, i(e2)), e2; } function Aa(e2) { var t2 = false; return Object.values(Ea).includes(e2) && (t2 = true), t2 = 120001 <= e2 && e2 <= 13e4 || 10100 <= e2 && e2 <= 10200 ? true : t2; } var Ra, Oa, Na, Ga, Pa, Ua, ba = ["conversationID", "timePosition", "timePeriod"], wa = (t(za, u), Ua = n(za), e(za, [{ key: "createTextMessage", value: function(e2) { var t2 = this.getMyUserID(), n2 = (e2.currentUser = t2, e2.senderTinyID = this.getMyTinyID(), new Do(e2)), e2 = m(e2.payload) ? e2.payload : e2.payload.text, e2 = new eo({ text: e2 }), t2 = this._getNickAndAvatarByUserID(t2); return n2.setElement(e2), n2.setNickAndAvatar(t2), n2.setNameCard(this._getNameCardByGroupID(n2)), n2; } }, { key: "createImageMessage", value: function(e2) { var t2 = this.getMyUserID(), n2 = (e2.currentUser = t2, e2.senderTinyID = this.getMyTinyID(), new Do(e2)); if (v) { var o2 = e2.payload.file; if (ct(o2)) return void this.warn("FileUnsupportedInMP", "createImageMessage"); var i2 = o2.tempFiles[0].path || o2.tempFiles[0].tempFilePath, o2 = { url: i2, name: i2.slice(i2.lastIndexOf("/") + 1), size: o2.tempFiles && o2.tempFiles[0].size || 1, type: i2.slice(i2.lastIndexOf(".") + 1).toLowerCase() }; e2.payload.file = o2; } else ye ? (o2 = { url: (i2 = e2.payload.file).uri, name: i2.fileName, size: i2.fileSize || 1, type: i2.type, width: i2.width, height: i2.height }, e2.payload.file = o2) : Ce && (ct(e2.payload.file) ? (i2 = e2.payload.file, e2.payload.file = { files: [i2] }) : f(e2.payload.file) && "undefined" != typeof uni && (o2 = e2.payload.file.tempFiles[0], e2.payload.file = { files: [o2] })); i2 = new uo({ imageFormat: Xe.UNKNOWN, uuid: this._generateUUID(e2.payload.file), file: e2.payload.file }), o2 = this._getNickAndAvatarByUserID(t2); return n2.setElement(i2), n2.setNickAndAvatar(o2), n2.setNameCard(this._getNameCardByGroupID(n2)), this._messageOptionsMap.set(n2.clientSequence, e2), n2; } }, { key: "createAudioMessage", value: function(e2) { var t2 = e2.payload.file, n2 = (v && (n2 = { url: t2.tempFilePath, name: t2.tempFilePath.slice(t2.tempFilePath.lastIndexOf("/") + 1), size: t2.fileSize, second: parseInt(t2.duration) / 1e3, type: t2.tempFilePath.slice(t2.tempFilePath.lastIndexOf(".") + 1).toLowerCase() }, e2.payload.file = n2), ye && (n2 = { url: t2.uri, name: t2.uri.slice(t2.uri.lastIndexOf("/") + 1), size: t2.fileSize || 1, second: Math.floor(t2.duration / 1e3), type: t2.uri.slice(t2.uri.lastIndexOf(".") + 1).toLowerCase() }, e2.payload.file = n2), this.getMyUserID()), o2 = (e2.currentUser = n2, e2.senderTinyID = this.getMyTinyID(), new Do(e2)), t2 = new po({ second: Math.floor(t2.duration / 1e3), size: t2.fileSize || t2.size || 1, url: t2.tempFilePath, uuid: this._generateUUID(e2.payload.file) }), n2 = this._getNickAndAvatarByUserID(n2); return o2.setElement(t2), o2.setNickAndAvatar(n2), o2.setNameCard(this._getNameCardByGroupID(o2)), this._messageOptionsMap.set(o2.clientSequence, e2), o2; } }, { key: "createVideoMessage", value: function(e2) { var t2 = this.getMyUserID(), n2 = (e2.currentUser = t2, e2.senderTinyID = this.getMyTinyID(), e2.payload.file.thumbUrl = "", e2.payload.file.thumbSize = 0, {}); if (v) { if (ve) return void this.warn("VideoUnsupportedInAlipay"); if (ct(e2.payload.file)) return void this.warn("FileUnsupportedInMP", "createVideoMessage"); var o2 = e2.payload.file; O(o2.tempFiles) && (o2 = o2.tempFiles[0]), n2.url = o2.tempFilePath, n2.name = o2.tempFilePath.slice(o2.tempFilePath.lastIndexOf("/") + 1), n2.size = o2.size || 1, n2.second = o2.duration || 0, n2.type = o2.tempFilePath.slice(o2.tempFilePath.lastIndexOf(".") + 1).toLowerCase(); } else ye ? (o2 = e2.payload.file, n2.url = o2.uri, n2.name = o2.fileName, n2.size = o2.fileSize || 1, n2.second = o2.duration || 0, n2.type = o2.type.split("/")[1]) : Ce && (ct(e2.payload.file) ? (o2 = e2.payload.file, e2.payload.file.files = [o2]) : f(e2.payload.file) && "undefined" != typeof uni && (o2 = e2.payload.file.tempFile, e2.payload.file.files = [o2]), o2 = e2.payload.file, n2.url = window.URL.createObjectURL(o2.files[0]), n2.name = o2.files[0].name, n2.size = o2.files[0].size || 1, n2.second = o2.files[0].duration || 0, n2.type = o2.files[0].type.split("/")[1]); e2.payload.file.videoFile = n2; o2 = new Do(e2), n2 = new Io({ videoFormat: n2.type, videoSecond: Yt(n2.second, 0), videoSize: n2.size, remoteVideoUrl: "", videoUrl: n2.url, videoUUID: this._generateUUID(e2.payload.file.videoFile), thumbUUID: this._generateUUID(e2.payload.file.videoFile), thumbWidth: e2.payload.file.width || 200, thumbHeight: e2.payload.file.height || 200, thumbUrl: e2.payload.file.thumbUrl, thumbSize: e2.payload.file.thumbSize, thumbFormat: e2.payload.file.thumbUrl.slice(e2.payload.file.thumbUrl.lastIndexOf(".") + 1).toLowerCase() }), t2 = this._getNickAndAvatarByUserID(t2); return o2.setElement(n2), o2.setNickAndAvatar(t2), o2.setNameCard(this._getNameCardByGroupID(o2)), this._messageOptionsMap.set(o2.clientSequence, e2), o2; } }, { key: "createCustomMessage", value: function(e2) { var t2 = this.getMyUserID(), n2 = (e2.currentUser = t2, e2.senderTinyID = this.getMyTinyID(), new Do(e2)), e2 = new vo({ data: e2.payload.data, description: e2.payload.description, extension: e2.payload.extension }), t2 = this._getNickAndAvatarByUserID(t2); return n2.setElement(e2), n2.setNickAndAvatar(t2), n2.setNameCard(this._getNameCardByGroupID(n2)), n2; } }, { key: "createFaceMessage", value: function(e2) { var t2 = this.getMyUserID(), n2 = (e2.currentUser = t2, e2.senderTinyID = this.getMyTinyID(), new Do(e2)), e2 = new lo(e2.payload), t2 = this._getNickAndAvatarByUserID(t2); return n2.setElement(e2), n2.setNickAndAvatar(t2), n2.setNameCard(this._getNameCardByGroupID(n2)), n2; } }, { key: "createMergerMessage", value: function(e2) { var t2 = this.getMyUserID(), t2 = (e2.currentUser = t2, e2.senderTinyID = this.getMyTinyID(), this._getNickAndAvatarByUserID(t2)), n2 = new Do(e2), e2 = new Co(e2.payload); return n2.setElement(e2), n2.setNickAndAvatar(t2), n2.setNameCard(this._getNameCardByGroupID(n2)), n2.setRelayFlag(true), n2; } }, { key: "createForwardMessage", value: function(e2) { var t2, n2, o2 = e2.to, i2 = e2.conversationType, a2 = e2.priority, s2 = e2.payload, r2 = e2.needReadReceipt, c2 = e2.receiverList; return O(s2._elements) ? (t2 = this.getMyUserID(), n2 = this._getNickAndAvatarByUserID(t2), s2.type === A.MSG_GRP_TIP ? D({ code: L.MSG_FORWARD_TYPE_INVALID }) : (i2 = { to: o2, conversationType: i2, conversationID: "".concat(i2).concat(o2), priority: a2, isPlaceMessage: 0, status: An, currentUser: t2, senderTinyID: this.getMyTinyID(), cloudCustomData: e2.cloudCustomData || s2.cloudCustomData || "", needReadReceipt: r2, receiverList: c2, isSupportExtension: e2.isSupportExtension || false }, (o2 = new Do(i2)).setElement(s2._elements[0]), o2.setNickAndAvatar(n2), o2.setNameCard(this._getNameCardByGroupID(s2)), o2.setRelayFlag(true), o2)) : D({ code: L.MSG_FORWARD_INVALID_ELEMENTS }); } }, { key: "downloadMergerMessage", value: function(e2) { return this._mergerMessageHandler.downloadMergerMessage(e2); } }, { key: "createFileMessage", value: function(e2) { if (v) { if (!_e && !ge && !Ie) return; var t2 = I.getSystemInfoSync().SDKVersion; if (_e && Vt(t2, "2.5.0") < 0) return void this.warn("WXChooseMessageFile"); if (ge && Vt(t2, "1.18.0") < 0) return void this.warn("QQChooseMessageFile"); } Ce || Ie ? ct(e2.payload.file) ? (t2 = e2.payload.file, e2.payload.file = { files: [t2] }) : f(e2.payload.file) && "undefined" != typeof uni && (o2 = (t2 = e2.payload.file).tempFiles, t2 = t2.files, n2 = null, O(o2) ? n2 = o2[0] : O(t2) && (n2 = t2[0]), e2.payload.file = { files: [n2] }) : _e || ge ? (t2 = y(y({}, (o2 = e2.payload.file.tempFiles)[0]), {}, { url: o2[0].path }), e2.payload.file = { files: [t2] }) : ye && (o2 = y(y({}, n2 = e2.payload.file), {}, { url: n2.uri }), e2.payload.file = { files: [o2] }); var t2 = this.getMyUserID(), n2 = (e2.currentUser = t2, e2.senderTinyID = this.getMyTinyID(), new Do(e2)), o2 = new mo({ uuid: this._generateUUID(e2.payload.file), file: e2.payload.file }), t2 = this._getNickAndAvatarByUserID(t2); return n2.setElement(o2), n2.setNickAndAvatar(t2), n2.setNameCard(this._getNameCardByGroupID(n2)), this._messageOptionsMap.set(n2.clientSequence, e2), n2; } }, { key: "createLocationMessage", value: function(e2) { var t2 = this.getMyUserID(), n2 = (e2.currentUser = t2, e2.senderTinyID = this.getMyTinyID(), new Do(e2)), e2 = new Mo(e2.payload), t2 = this._getNickAndAvatarByUserID(t2); return n2.setElement(e2), n2.setNickAndAvatar(t2), n2.setNameCard(this._getNameCardByGroupID(n2)), n2; } }, { key: "_onNoModule", value: function() { return D({ code: L.NO_MODULE }); } }, { key: "sendMessageInstance", value: function(i2, a2) { var s2 = this; if (false === this.get(29).filterMessage(i2, a2)) return i2.hasRiskContent = true, this._onSendMessageFailed(i2, new E({ code: L.PROFANITY_FOUND })); var r2, c2, u2, l2, t2 = null; if (i2.conversationType === A.CONV_C2C) t2 = this.get(6); else { if (i2.conversationType !== A.CONV_GROUP) return D({ code: L.MSG_INVALID_CONV_TYPE }); t2 = this.get(7); } return t2 ? (c2 = "".concat(this._n, ".sendMessageInstance"), u2 = this.get(11), l2 = t2.isOnlineMessage(i2, a2), this.get(17).upload(i2).then(function() { return s2._getSendMessageSpecifiedKey(i2) === Yn && s2.get(26).addSuccessCount(Wn), s2._guardForGroup(i2).then(function() { if (!i2.isSendable()) return D({ code: L.MSG_F_URL_IS_EMPTY }); s2._addSendMessageTotalCount(i2), r2 = Date.now(); var e2 = function(e3) { var t3 = "utf-8"; Ce && document && (t3 = document.charset.toLowerCase()); var n2, o2 = 0, i3 = e3.length; if ("utf-8" === t3 || "utf8" === t3) for (var a3 = 0; a3 < i3; a3++) (n2 = e3.codePointAt(a3)) <= 127 ? o2 += 1 : n2 <= 2047 ? o2 += 2 : n2 <= 65535 ? o2 += 3 : (o2 += 4, a3++); else if ("utf-16" === t3 || "utf16" === t3) for (var s3 = 0; s3 < i3; s3++) (n2 = e3.codePointAt(s3)) <= 65535 ? o2 += 2 : (o2 += 4, s3++); else o2 = e3.replace(/[^\x00-\xff]/g, "aa").length; return o2; }(JSON.stringify(i2)); return i2.type === A.MSG_MERGER && 11264 < e2 ? s2._mergerMessageHandler.uploadMergerMessage(i2, e2).then(function(e3) { e3 = s2._mergerMessageHandler.createMergerMessagePack(i2, a2, e3); return s2.req(e3); }) : (u2.setMessageRandom(i2), t2.sendMessage(i2, a2)); }).then(function(e2) { var e2 = e2.data, t3 = e2.time, n2 = e2.sequence, o2 = e2.readReceiptCode, e2 = e2.messageDropReason, e2 = (R(o2) && 0 !== o2 && (new G("sendMessageWithReceipt").setMessage("from:".concat(i2.from, " to:").concat(i2.to, " sequence:").concat(n2, " readReceiptCode:").concat(o2)).end(), M.w("".concat(c2, " readReceiptCode:").concat(o2, " message:").concat(s2.getErrMsg(o2)))), e2 && (o2 = new G("messageDropReason"), e2 = "from:".concat(i2.from, " to:").concat(i2.to, " sequence:").concat(n2, " messageDropReason:").concat(e2), o2.setMessage(e2).end(), M.w("".concat(c2, " ").concat(e2))), s2._addSendMessageSuccessCount(i2, r2), s2._messageOptionsMap.delete(i2.clientSequence), true === i2.isResend && (o2 = u2.findMessage(i2.ID)) && (M.l("".concat(c2, " resend ok. ID:").concat(o2.ID)), u2.deleteLocalMessage(o2)), i2.status = Rn, i2.time = t3, false); return i2.conversationType === A.CONV_GROUP ? i2.sequence = n2 : i2.conversationType === A.CONV_C2C && (o2 = u2.getLatestMessageSentByMe(i2.conversationID)) && (t3 = o2.nick, n2 = o2.avatar, t3 === i2.nick && n2 === i2.avatar || (e2 = true)), e2 && u2.modifyMessageSentByMe({ conversationID: i2.conversationID, latestNick: i2.nick, latestAvatar: i2.avatar }), true === l2 ? i2._onlineOnlyFlag = true : (u2.appendToMessageList(i2), o2 = i2, f(a2) && f(a2.messageControlInfo) && (true === a2.messageControlInfo.excludedFromLastMessage && (i2._isExcludedFromLastMessage = true, o2 = ""), true === a2.messageControlInfo.excludedFromUnreadCount) && (i2._isExcludedFromUnreadCount = true), t3 = i2.conversationType, Gt(i2.to) && (t3 = A.CONV_TOPIC, s2.get(10).onMessageSent({ groupID: Jt(i2.to), topicID: i2.to, lastMessage: o2 })), u2.onMessageSent({ conversationOptionsList: [{ conversationID: i2.conversationID, unreadCount: 0, type: t3, subType: i2.conversationSubType, lastMessage: o2 }] })), i2._relayFlag || "TIMImageElem" !== i2.type || Bt(i2.payload.imageInfoArray), C({ message: i2 }); }); }).catch(function(e2) { return s2._onSendMessageFailed(i2, e2, l2); })) : this._onNoModule(); } }, { key: "_guardForGroup", value: function(e2) { if (e2.conversationType !== A.CONV_GROUP) return Promise.resolve(); var t2 = this.get(7); if (!t2) return this._onNoModule(); if (Nt({ groupID: e2.to })) { var n2 = t2.getLocalGroupProfile(e2.to); if (n2 && n2.isSupportTopic) return D({ code: L.MSG_SEND_GRP_WITH_TOPIC_FAIL }); } return t2.guardForAVChatRoom(e2); } }, { key: "_onSendMessageFailed", value: function(e2, t2) { var n2 = 2 < arguments.length && void 0 !== arguments[2] && arguments[2], o2 = "".concat(this._n, "._onSendMessageFailed"), i2 = (e2.status = On, 80001 !== t2.code && 80004 !== t2.code || (e2.hasRiskContent = true), this.get(11)), a2 = (i2.deleteMessageRandom(e2), 10100 <= t2.code && t2.code <= 10200 || 120001 <= t2.code && t2.code <= 13e4), n2 = (n2 || a2 || true === i2.appendToMessageList(e2) && M.l("".concat(o2, " message stored, ID:").concat(e2.ID)), this._addSendMessageFailCountOnUser(e2, t2), new G("sendMessage")), a2 = "head.seq:".concat(t2.data.headSeq, " type:").concat(e2.type, " from:").concat(e2.from, " to:").concat(e2.to); return Ce && ("connection" in navigator && (i2 = navigator.connection, a2 += " downlink:".concat(i2.downlink, " effectiveType:").concat(i2.effectiveType, " rtt:").concat(i2.rtt)), "memory" in window.performance) && (i2 = window.performance.memory, a2 += " usedJSHeapSize:".concat(i2.usedJSHeapSize, " totalJSHeapSize:").concat(i2.totalJSHeapSize, " jsHeapSizeLimit:").concat(i2.jsHeapSizeLimit)), n2.setMessage(a2).setError(t2).end(), M.e("".concat(o2, " ").concat(a2, " error:"), t2), D(new E({ code: t2 && t2.code ? t2.code : L.MSG_SEND_FAIL, message: t2 && t2.message ? t2.message : void 0, data: { message: e2 } })); } }, { key: "_getSendMessageSpecifiedKey", value: function(e2) { if ([A.MSG_IMAGE, A.MSG_AUDIO, A.MSG_VIDEO, A.MSG_FILE].includes(e2.type)) return Yn; if (e2.conversationType === A.CONV_C2C) return Hn; if (e2.conversationType === A.CONV_GROUP) { var t2 = this.get(7); if (t2) { t2 = t2.getLocalGroupProfile(e2.to); if (t2) return e2 = t2.type, Ot(e2) ? Kn : Bn; } } } }, { key: "_addSendMessageTotalCount", value: function(e2) { e2 = this._getSendMessageSpecifiedKey(e2); e2 && this.get(26).addTotalCount(e2); } }, { key: "_addSendMessageSuccessCount", value: function(e2, t2) { var n2, e2 = this._getSendMessageSpecifiedKey(e2); e2 && ((n2 = this.get(26)).addSuccessCount(e2), n2.addCost(e2, nn(t2, false))); } }, { key: "_addSendMessageFailCountOnUser", value: function(e2, t2) { var n2, t2 = t2.code, t2 = void 0 === t2 ? -1 : t2, o2 = this.get(26), e2 = this._getSendMessageSpecifiedKey(e2); e2 === Yn && (n2 = false, n2 = La.includes(t2) ? true : n2) ? o2.addFailedCountOfUserSide(Wn) : Aa(t2) && e2 && o2.addFailedCountOfUserSide(e2); } }, { key: "resendMessage", value: function(e2, t2) { return e2.isResend = true, e2.status = An, this.sendMessageInstance(e2, t2); } }, { key: "revokeMessage", value: function(n2) { var o2, i2, t2 = this, e2 = null; return n2.conversationType === A.CONV_C2C ? e2 = this.get(6) : n2.conversationType === A.CONV_GROUP && (e2 = this.get(7)), e2 ? ((o2 = new G("revokeMessage")).setMessage("type:".concat(n2.type, " from:").concat(n2.from, " to:").concat(n2.to)), i2 = "".concat(this._n, ".").concat("revokeMessage"), e2.revokeMessage(n2).then(function(e3) { var e3 = e3.data.recallRetList; return S(e3) || 0 === e3[0].retCode ? (M.i("".concat(i2, " ok. ID:").concat(n2.ID)), n2.isRevoked = true, o2.end(), t2.get(11).onMessageRevoked([n2]), C({ message: n2 })) : (e3 = new E({ code: e3[0].retCode, data: { message: n2 } }), o2.setCode(e3.code).setMoreMessage(e3.message).end(), D(e3)); }).catch(function(e3) { o2.setError(e3).end(); var t3 = new E({ code: e3 && e3.code ? e3.code : L.MSG_REVOKE_FAIL, message: e3 && e3.message ? e3.message : void 0, data: { message: n2 } }); return M.w("".concat(i2, " failed. error:"), e3), D(t3); })) : this._onNoModule(); } }, { key: "deleteMessage", value: function(e2) { var t2 = this, n2 = null, o2 = e2[0], i2 = o2.conversationID, a2 = "", s2 = [], r2 = []; if (o2.conversationType === A.CONV_C2C) n2 = this.get(6), a2 = i2.replace(A.CONV_C2C, ""), e2.forEach(function(e3) { e3 && e3.status === Rn && e3.conversationID === i2 && (e3._onlineOnlyFlag || s2.push("".concat(e3.sequence, "_").concat(e3.random, "_").concat(e3.time)), r2.push(e3)); }); else if (o2.conversationType === A.CONV_GROUP) n2 = this.get(7), a2 = i2.replace(A.CONV_GROUP, ""), e2.forEach(function(e3) { e3 && e3.status === Rn && e3.conversationID === i2 && (e3._onlineOnlyFlag || s2.push("".concat(e3.sequence)), r2.push(e3)); }); else if (o2.conversationType === A.CONV_SYSTEM) return D({ code: L.CANNOT_DELETE_GRP_SYSTEM_NOTICE }); if (!n2) return this._onNoModule(); if (0 === s2.length) return this._onMessageDeleted(r2); 30 < s2.length && (s2 = s2.slice(0, 30), r2 = r2.slice(0, 30)); var c2 = new G("deleteMessage"), u2 = (c2.setMessage("to:".concat(a2, " count:").concat(s2.length)), "".concat(this._n, ".").concat("deleteMessage")); return n2.deleteMessage({ to: a2, keyList: s2 }).then(function(e3) { return c2.end(), M.i("".concat(u2, " ok")), t2._onMessageDeleted(r2); }).catch(function(e3) { c2.setError(e3).end(), M.w("".concat(u2, " failed. error:"), e3); e3 = new E({ code: e3 && e3.code ? e3.code : L.MSG_DELETE_FAIL, message: e3 && e3.message ? e3.message : void 0 }); return D(e3); }); } }, { key: "_onMessageDeleted", value: function(e2) { return this.get(11).onMessageDeleted(e2), T({ messageList: e2 }); } }, { key: "translateText", value: function(e2) { var o2 = "".concat(this._n, ".").concat("translateText"), t2 = e2.sourceTextList, n2 = e2.sourceLanguage, e2 = e2.targetLanguage, i2 = new G("translateText"); return i2.setMessage("sourceLanguage:".concat(n2, " targetLanguage:").concat(e2)), this.req({ P: k.TRANSLATE_TEXT, data: { sourceTextList: t2, source: n2 || "auto", target: e2, from: this.getMyTinyID(), SDKAppID: this.getSDKAppID() } }).then(function(e3) { var e3 = e3.data, t3 = e3.error, n3 = e3.requestID, e3 = e3.translatedTextList; if (0 === t3.code) return i2.end(), M.i("".concat(o2, " ok. requestID:").concat(n3)), C({ translatedTextList: e3 }); throw y(y({}, t3), {}, { requestID: n3 }); }).catch(function(e3) { return i2.setCode(e3.code).setMoreMessage(e3.requestID).end(), M.w("".concat(o2, " failed. error:"), e3), D({ code: L.TRANSLATE_TEXT_FAIL }); }); } }, { key: "convertVoiceToText", value: function(e2) { var t2, o2, i2, n2 = e2.message, e2 = e2.language, a2 = n2.payload.url, n2 = (n2.from === this.getMyUserID() && "out" === n2.flow && (a2 = n2.payload.remoteAudioUrl), /\.(wav|pcm|ogg-opus|speex|silk|mp3|m4a|aac|amr)/); return n2.test(a2) ? (n2 = n2.exec(a2)[1] || "mp3", t2 = "16k_zh-PY", e2 ? "zh (cmn-Hans-CN)" === e2 ? t2 = "16k_zh" : "en-US" === e2 ? t2 = "16k_en" : "yue-Hant-HK" === e2 ? t2 = "16k_yue" : "ja-JP" === e2 && (t2 = "16k_ja") : t2 = "16k_zh-PY", e2 = "serviceType:".concat(t2, " url:").concat(a2), o2 = "".concat(this._n, ".").concat("convertVoiceToText"), M.i("".concat(o2, " ").concat(e2)), (i2 = new G("convertVoiceToText")).setMessage(e2), this.req({ P: k.VOICE_TO_TEXT, data: { url: a2, language: t2, SDKAppID: this.getSDKAppID(), format: n2 } }).then(function(e3) { var e3 = e3.data, t3 = e3.error, n3 = e3.requestID, e3 = e3.result; if (0 === t3.code) return i2.end(), M.i("".concat(o2, " ok. requestID:").concat(n3)), C({ result: e3 }); throw y(y({}, t3), {}, { requestID: n3 }); }).catch(function(e3) { return i2.setCode(e3.code).setMoreMessage(e3.requestID || "").end(), M.w("".concat(o2, " failed. error:"), e3), D({ code: L.VOICE_TO_TEXT_FAIL }); })) : D({ code: L.UNSUPPORTED_VOICE_FORMAT }); } }, { key: "modifyRemoteMessage", value: function(n2) { var o2 = this, e2 = null, t2 = n2.conversationType, i2 = n2.to, a2 = this.get(7); if (!a2) return this._onNoModule(); if (a2.isMessageFromOrToAVChatroom(i2)) return D({ code: L.MSG_MODIFY_DISABLED_IN_AV, data: { message: n2 } }); if (false === this.get(29).filterMessage(n2)) return n2.hasRiskContent = true, D({ code: L.PROFANITY_FOUND, data: { message: n2 } }); t2 === A.CONV_C2C ? e2 = this.get(6) : t2 === A.CONV_GROUP && (e2 = this.get(7)); var s2 = new G("modifyMessage"), r2 = (s2.setMessage("to:".concat(i2)), "".concat(this._n, ".modifyRemoteMessage")); return e2.modifyRemoteMessage(n2).then(function(e3) { s2.end(), M.i("".concat(r2, " ok")); e3 = o2._onModifyRemoteMessageResp(n2, e3.data); return C({ message: e3 }); }).catch(function(e3) { var t3; return s2.setCode(e3.code).setMoreMessage(e3.message).end(), M.w("".concat(r2, " failed. error:"), e3), 20027 === e3.code ? (t3 = o2._onModifyRemoteMessageResp(n2, e3.data), D({ code: L.MSG_MODIFY_CONFLICT, data: { message: t3 } })) : D({ code: e3.code, message: e3.message, data: { message: n2 } }); }); } }, { key: "_generateSearchdata", value: function(e2) { var t2 = e2.conversationID, n2 = e2.timePosition, o2 = e2.timePeriod, e2 = K(e2, ba); return N(t2) || (Pt(t2) && (e2.account = t2.replace(A.CONV_C2C, "")), Ut(t2) && (e2.groupID = t2.replace(A.CONV_GROUP, ""))), R(o2) && 0 < o2 && (R(n2) && 0 < n2 ? e2.startTime = n2 - o2 : e2.startTime = Be() - o2), e2.startTime && e2.startTime < 0 && (e2.startTime = void 0), R(n2) && 0 < n2 && (e2.endTime = n2), e2; } }, { key: "searchCloudMessages", value: function(i2) { var a2 = this, e2 = "searchCloudMessages", s2 = "".concat(this._n, ".").concat(e2); if (!i2) return D({ code: L.OPTIONS_IS_EMPTY, message: this.getErrMsg(L.OPTIONS_IS_EMPTY, e2) }); var r2, c2, u2, t2 = i2.keywordList, n2 = i2.keywordListMatchType, o2 = i2.conversationID, l2 = i2.cursor, d2 = O(i2.senderUserIDList) && 0 < i2.senderUserIDList.length, p2 = O(i2.messageTypeList) && 0 < i2.messageTypeList.length; if (t2 || d2 || p2) return r2 = Date.now(), c2 = new G(e2), u2 = "keywordList:".concat(t2, " keywordListMatchType:").concat(n2, " ") + "convID:".concat(o2, " cursor:").concat(l2), M.l("".concat(s2, " ").concat(u2)), this.req({ P: k.MSG_CLOUD_SEARCH, data: this._generateSearchdata(i2) }).then(function(e3) { var t3 = e3.data, n3 = t3.code, t3 = t3.message; if (0 !== n3) return t3 = a2.getErrMsg(60020 === n3 ? "SearchCloudMessagesUnavailable" : n3) || t3, n3 = new E({ code: n3, message: t3 }), c2.setMessage(u2).setError(n3).end(), D(n3); a2.get(27).isSearchCloudMessagesEnabled(); var t3 = e3.data, n3 = t3.cursor, e3 = t3.totalCount, t3 = t3.searchResult, o3 = "totalCount:".concat(e3, " cost:").concat(nn(r2)), o3 = (M.l("".concat(s2, " ok. cursor:").concat(n3, " ").concat(o3)), c2.setMessage("".concat(u2, " ").concat(o3)).end(), a2._handleSearchResults(t3, !i2.conversationID)); return C({ searchResultList: o3, cursor: n3, totalCount: e3 }); }).catch(function(e3) { return c2.setMessage(u2).setError(e3).end(), D(e3); }); throw M.e("[".concat(e2, '] Missing required params: "keywordList".')), new Error("Params validate failed."); } }, { key: "_handleSearchResults", value: function(e2, a2) { var s2 = this.get(11); return O(e2) && 0 !== e2.length ? e2.map(function(e3) { var t2 = e3.groupID, n2 = e3.userID, o2 = e3.messageCount, e3 = e3.messageList, e3 = void 0 === e3 ? [] : e3, n2 = t2 ? "".concat(A.CONV_GROUP).concat(t2) : "".concat(A.CONV_C2C).concat(n2), i2 = { conversationID: n2, messageCount: o2, messageList: [] }; return a2 && 1 < o2 || 0 < (o2 = e3.filter(function(e4) { return !!e4; })).length && (e3 = s2.onRoamingMessage(o2, n2, false), t2 && e3.reverse(), i2.messageList = e3, i2.messageCount = e3.length), i2; }) : []; } }, { key: "_onModifyRemoteMessageResp", value: function(e2, t2) { M.d("".concat(this._n, "._onModifyRemoteMessageResp options:"), t2); var n2 = e2.conversationType, o2 = e2.from, i2 = e2.to, a2 = e2.random, s2 = e2.sequence, e2 = e2.time, r2 = t2.elements, c2 = t2.messageVersion, t2 = t2.cloudCustomData, t2 = void 0 === t2 ? "" : t2; return this.get(11).onMessageModified({ conversationType: n2, from: o2, to: i2, time: e2, random: a2, sequence: s2, elements: r2, cloudCustomData: t2, messageVersion: c2 }); } }, { key: "_generateUUID", value: function(e2) { var t2 = this.get(12), t2 = "".concat(t2.getSDKAppID(), "-").concat(t2.getUserID(), "-").concat(mt()), e2 = e2.name || e2.value || e2.url || e2.tempFilePath, e2 = e2 && e2.slice(e2.lastIndexOf(".") + 1); return t2 = e2 ? "".concat(t2, ".").concat(e2) : t2; } }, { key: "getMessageOption", value: function(e2) { return this._messageOptionsMap.get(e2); } }, { key: "_getNickAndAvatarByUserID", value: function(e2) { return this.get(4).getNickAndAvatarByUserID(e2); } }, { key: "_getNameCardByGroupID", value: function(e2) { if (e2.conversationType === A.CONV_GROUP) { var t2 = this.get(7); if (t2) return t2.getMyNameCardByGroupID(e2.to); } return ""; } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._messageOptionsMap.clear(); } }]), za), Fa = (t(Ja, u), Pa = n(Ja), e(Ja, [{ key: "onMsgExtNotify", value: function(e2) { var o2 = this, e2 = e2.dataList, t2 = e2.messageInfo, i2 = e2.operateType, n2 = e2.operateResultList, a2 = e2.tinyID, e2 = e2.globalSequence, s2 = t2.clientTime, t2 = t2.random, r2 = "".concat(a2, "-").concat(s2, "-").concat(t2), c2 = [], u2 = [], l2 = (M.l("".concat(this._n, ".onMsgExtNotify messageID:").concat(r2, " operateType:").concat(i2, " globalSequence:").concat(e2)), this._updateGlobalSeq(r2, e2), false), d2 = false; n2.forEach(function(e3) { var t3 = e3.extensions, t3 = void 0 === t3 ? [] : t3, n3 = e3.clearSequence; 1 === i2 ? (l2 = true, t3.forEach(function(e4) { c2.push({ key: e4.key, value: e4.value }); }), o2._updateLocalExt(r2, t3)) : 2 === i2 ? (d2 = true, t3.forEach(function(e4) { u2.push(e4.key); }), o2._updateLocalExt(r2, t3)) : 3 === i2 && (d2 = true, o2._hasLocalExt(r2) && o2._getLocalExt(r2).forEach(function(e4, t4) { e4.seq <= n3 && !S(e4.value) && u2.push(t4); }), o2._clearLocalExt(r2, n3)); }), l2 && this.emitOEvt(h.MESSAGE_EXTENSIONS_UPDATED, { messageID: r2, extensions: c2 }), d2 && this.emitOEvt(h.MESSAGE_EXTENSIONS_DELETED, { messageID: r2, keyList: u2 }); } }, { key: "setMessageExtensions", value: function(e2, t2) { var o2, n2, i2, a2, s2, r2, c2, u2 = "setMessageExtensions"; return this.canIUse(_.MSG_EXT) ? (o2 = "".concat(this._n, ".").concat(u2), n2 = e2.ID, i2 = e2.conversationID, a2 = e2.sequence, s2 = e2.time, r2 = p(t2), 20 < t2.length && (r2 = t2.slice(0, 20), M.w("".concat(o2, ". the length of extensions cannot exceed 20."))), t2 = "convID:".concat(i2, " messageID:").concat(n2, " sequence:").concat(a2, " time:").concat(s2, " count:").concat(r2.length), (c2 = new G(u2)).setMessage(t2), M.l("".concat(o2, " ").concat(t2)), this._modifyMsgExts(e2, r2).then(function(e3) { var t3 = e3.resultList, n3 = e3.successCount, e3 = e3.failureCount, n3 = "successCount:".concat(n3, " failCount:").concat(e3); return c2.setMoreMessage(n3).end(), M.l("".concat(o2, " ok. ").concat(n3)), C({ extensions: t3 }); }).catch(function(e3) { return c2.setError(e3).end(), M.e("".concat(o2, " failed. error:"), e3), D(e3); })) : this.noUse(u2); } }, { key: "getMessageExtensions", value: function(e2) { var t2, n2, o2, i2, a2, s2, r2, c2 = this, u2 = "getMessageExtensions"; return this.canIUse(_.MSG_EXT) ? (t2 = "".concat(this._n, ".").concat(u2), n2 = e2.ID, a2 = e2.conversationID, o2 = e2.sequence, i2 = e2.time, a2 = "convID:".concat(a2, " messageID:").concat(n2, " sequence:").concat(o2, " time:").concat(i2), (s2 = new G(u2)).setMessage(a2), r2 = void M.l("".concat(t2, " ").concat(a2)), this.getMsgExtsMap.has(n2) && (r2 = this._getGlobalSeq(n2)), this._getMsgExts(e2, r2).then(function(e3) { return s2.end(), M.l("".concat(t2, " ok. extCount:").concat(e3.length)), N(r2) && 0 < e3.length && c2.getMsgExtsMap.set(n2, 1), C({ extensions: e3 }); }).catch(function(e3) { return s2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this.noUse(u2); } }, { key: "deleteMessageExtensions", value: function(e2, t2) { var i2, n2, a2, o2, s2, r2, c2, u2 = "deleteMessageExtensions"; return this.canIUse(_.MSG_EXT) ? (i2 = "".concat(this._n, ".").concat(u2), n2 = [], a2 = 3, S(t2) || (a2 = 2, t2.forEach(function(e3) { n2.push({ key: e3, value: "", seq: 0 }); })), t2 = e2.ID, r2 = e2.conversationID, o2 = e2.sequence, s2 = e2.time, r2 = "convID:".concat(r2, " messageID:").concat(t2, " sequence:").concat(o2, " time:").concat(s2, " operateType:").concat(a2), (c2 = new G(u2)).setMessage(r2), M.l("".concat(i2, " ").concat(r2)), this._modifyMsgExts(e2, n2, a2).then(function(e3) { var t3 = e3.resultList, n3 = e3.successCount, e3 = e3.failureCount, o3 = ""; return 2 === a2 && (o3 = "success count:".concat(n3, " fail count:").concat(e3)), c2.setMoreMessage("".concat(o3)).end(), M.l("".concat(i2, " ok. ").concat(o3)), C({ extensions: t3 }); }).catch(function(e3) { return c2.setError(e3).end(), M.e("".concat(i2, " failed. error:"), e3), D(e3); })) : this.noUse(u2); } }, { key: "_modifyMsgExts", value: function(n2, e2) { var o2 = this, t2 = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, i2 = Gt(n2.to) ? A.CONV_TOPIC : n2.conversationType, a2 = void 0, s2 = (3 !== t2 && (a2 = this._getReqExts(n2, e2)), null); switch (i2) { case A.CONV_C2C: s2 = this.get(6); break; case A.CONV_GROUP: s2 = this.get(7); break; case A.CONV_TOPIC: s2 = this.get(10); break; default: return D({ code: L.NO_MODULE }); } return s2.modifyMsgExts(n2, a2, t2).then(function(e3) { var e3 = e3.data, t3 = e3.extensions, e3 = e3.seq, i3 = [], a3 = 0, s3 = 0, r2 = []; return (t3 = S(t3) ? [] : t3).forEach(function(e4) { var t4 = e4.errorCode, e4 = e4.extension, n3 = e4.key, o3 = e4.value, e4 = e4.seq; i3.push({ code: t4, key: n3, value: o3 }), 0 === t4 ? a3++ : s3++, r2.push({ key: n3, value: o3, seq: e4 }); }), o2._updateGlobalSeq(n2.ID, e3), 0 < r2.length && (o2._updateLocalExt(n2.ID, r2), r2 = null), { resultList: i3, successCount: a3, failureCount: s3 }; }).catch(function(e3) { return D(e3); }); } }, { key: "_getReqExts", value: function(e2, t2) { var o2, i2 = []; return this._hasLocalExt(e2.ID) ? (o2 = this._getLocalExt(e2.ID), t2.forEach(function(e3) { var t3 = e3.key, e3 = e3.value, n2 = 0; o2.has(t3) && (n2 = o2.get(t3).seq), i2.push({ key: t3, value: e3, seq: n2 }); })) : t2.forEach(function(e3) { var t3 = e3.key, e3 = e3.value; i2.push({ key: t3, value: e3, seq: 0 }); }), i2; } }, { key: "_getMsgExts", value: function(i2, e2) { var a2 = this, s2 = "".concat(this._n, "._getMsgExts"), r2 = i2.ID, t2 = i2.to, n2 = null; switch (Gt(t2) ? A.CONV_TOPIC : i2.conversationType) { case A.CONV_C2C: n2 = this.get(6); break; case A.CONV_GROUP: n2 = this.get(7); break; case A.CONV_TOPIC: n2 = this.get(10); break; default: return D({ code: L.NO_MODULE }); } return n2.getMessageExtensions(i2, e2).then(function(e3) { var e3 = e3.data, t3 = e3.extensions, n3 = e3.completeFlag, o2 = e3.globalSequence, e3 = e3.clearSequence, t3 = S(t3) ? [] : t3; return M.l("".concat(s2, " ok. completeFlag:").concat(n3, " globalSequence:").concat(o2, " clearSequence:").concat(e3, " count:").concat(t3.length)), a2._updateLocalExt(r2, t3), a2._clearLocalExt(r2, e3), a2._updateGlobalSeq(r2, o2), 1 !== n3 ? (e3 = t3.slice(-1)[0].seq + 1, a2._getMsgExts(i2, e3)) : a2._getLocalExtList(r2); }).catch(function(e3) { return D(e3); }); } }, { key: "_hasLocalExt", value: function(e2) { return this.msgExtMap.has(e2); } }, { key: "_getLocalExt", value: function(e2) { return this.msgExtMap.get(e2); } }, { key: "_updateLocalExt", value: function(e2, t2) { this._hasLocalExt(e2) || this.msgExtMap.set(e2, /* @__PURE__ */ new Map()); var o2 = this._getLocalExt(e2); t2.forEach(function(e3) { var t3 = e3.key, n2 = e3.value, e3 = e3.seq; o2.set(t3, { value: void 0 === n2 ? "" : n2, seq: e3 }); }); } }, { key: "_clearLocalExt", value: function(e2, n2) { var o2; n2 <= 0 || !this._hasLocalExt(e2) || (o2 = this._getLocalExt(e2)).forEach(function(e3, t2) { e3.seq <= n2 && o2.delete(t2); }); } }, { key: "_getLocalExtList", value: function(e2) { var n2 = []; return this._hasLocalExt(e2) && this._getLocalExt(e2).forEach(function(e3, t2) { e3 = e3.value; S(e3) || n2.push({ key: t2, value: e3 }); }), n2; } }, { key: "_getGlobalSeq", value: function(e2) { return this.globalSeqMap.get(e2); } }, { key: "_updateGlobalSeq", value: function(e2, t2) { this.globalSeqMap.set(e2, t2); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this.msgExtMap.clear(), this.globalSeqMap.clear(), this.getMsgExtsMap.clear(); } }]), Ja), qa = (t(ja, u), Ga = n(ja), e(ja, [{ key: "onReactionNotifyList", value: function(e2) { var a2 = this, e2 = (e2 || {}).dataList; (void 0 === e2 ? [] : e2).forEach(function(e3) { var t2 = e3.C2CMessageInfo, n2 = e3.groupMessageInfo, n2 = void 0 === n2 ? {} : n2, e3 = e3.reactionList, e3 = void 0 === e3 ? [] : e3, t2 = y(y({}, void 0 === t2 ? {} : t2), n2), n2 = t2.tinyID, o2 = t2.clientTime, t2 = t2.random, n2 = "".concat(n2, "-").concat(o2, "-").concat(t2), i2 = []; e3.forEach(function(e4) { N(e4.userIDList) && (e4.userIDList = [], e4.count = 0), i2.push.apply(i2, p(e4.userIDList)); }), M.l("".concat(a2._n, ".onReactionNotifyList messageID:").concat(n2, " reactionList:").concat(e3.length)), a2._handleReactionSummary([{ messageID: n2, reactionList: e3 }], i2).then(function(e4) { a2.emitOEvt(h.MESSAGE_REACTIONS_UPDATED, y({}, e4[0])); }); }); } }, { key: "onReactionNotify", value: function(e2) { var e2 = e2.dataList || {}, t2 = e2.C2CMessageInfo, n2 = e2.groupMessageInfo, n2 = void 0 === n2 ? {} : n2, o2 = e2.reactionID, e2 = e2.operateType, t2 = y(y({}, void 0 === t2 ? {} : t2), n2), n2 = t2.tinyID, i2 = t2.clientTime, t2 = t2.random, n2 = "".concat(n2, "-").concat(i2, "-").concat(t2), i2 = (M.l("".concat(this._n, ".onReactionNotify messageID:").concat(n2, " reactionID:").concat(o2, " operateType:").concat(e2)), 1 === e2 ? this._addReactedByMyselfMap(n2, o2) : this._removeReactedByMyselfMap(n2, o2), "".concat(n2, "-").concat(o2)); this._reactionInfoMap.has(i2) && ((t2 = this._reactionInfoMap.get(i2)).reactedByMyself = 1 === e2, this.emitOEvt(h.MESSAGE_REACTIONS_UPDATED, { messageID: n2, reactionList: [t2] })); } }, { key: "addMessageReaction", value: function(t2, n2) { var o2, e2, i2, a2, s2 = this, r2 = "addMessageReaction"; return this.canIUse(_.MSG_REACTION) ? (o2 = "".concat(this._n, ".").concat(r2), a2 = t2.ID, e2 = t2.conversationID, e2 = "convID:".concat(e2, " messageID:").concat(a2, " reactionID:").concat(n2), (i2 = new G(r2)).setMessage(e2), M.l("".concat(o2, " ").concat(e2)), a2 = this._createReactionOperationPack(t2, n2, 1), this._addReactedByMyselfMap(t2.ID, n2), this.req(a2).then(function() { return i2.end(), M.l("".concat(o2, " ok.")), C(); }).catch(function(e3) { return s2._removeReactedByMyselfMap(t2.ID, n2), i2.setError(e3).end(), M.e("".concat(o2, " failed. error:"), e3), D(e3); })) : this.noUse(r2); } }, { key: "removeMessageReaction", value: function(e2, t2) { var n2, o2, i2, a2, s2 = "removeMessageReaction"; return this.canIUse(_.MSG_REACTION) ? (n2 = "".concat(this._n, ".").concat(s2), a2 = e2.ID, o2 = e2.conversationID, o2 = "convID:".concat(o2, " messageID:").concat(a2, " reactionID:").concat(t2), (i2 = new G(s2)).setMessage(o2), M.l("".concat(n2, " ").concat(o2)), a2 = this._createReactionOperationPack(e2, t2, 2), this._removeReactedByMyselfMap(e2.ID, t2), this.req(a2).then(function() { return i2.end(), M.l("".concat(n2, " ok.")), C(); }).catch(function(e3) { return i2.setError(e3).end(), M.e("".concat(n2, " failed. error:"), e3), D(e3); })) : this.noUse(s2); } }, { key: "getMessageReactions", value: function(e2) { var t2, n2, o2, i2, a2, s2, r2 = this, c2 = "getMessageReactions"; return this.canIUse(_.MSG_REACTION) ? (t2 = "".concat(this._n, ".").concat(c2), n2 = e2.messageList, s2 = e2.maxUserCountPerReaction, o2 = n2[0].conversationID, o2 = "convID:".concat(o2, " maxUserCountPerReaction:").concat(s2, " msgCount:").concat(n2.length), (i2 = new G(c2)).setMessage(o2), M.l("".concat(t2, " ").concat(o2)), a2 = /* @__PURE__ */ new Map(), s2 = this._createReactionSummaryPack(y(y({}, e2), {}, { messageIDMap: a2 })), this.req(s2).then(function(e3) { var e3 = e3.data.resultList, o3 = [], i3 = []; return (void 0 === e3 ? [] : e3).forEach(function(e4) { var t3 = e4.messageKey, t3 = void 0 === t3 ? void 0 : t3, n3 = e4.messageSequence, n3 = void 0 === n3 ? void 0 : n3, e4 = e4.reactionList, e4 = void 0 === e4 ? [] : e4, n3 = N(t3) ? a2.get(n3) : a2.get(t3); o3.push({ messageID: n3, reactionList: e4 }), e4.forEach(function(e5) { i3.push.apply(i3, p(e5.userIDList)); }); }), r2._handleReactionSummary(o3, i3); }).then(function(e3) { return i2.end(), M.l("".concat(t2, " ok.")), a2.clear(), C({ resultList: e3 }); }).catch(function(e3) { return i2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this.noUse(c2); } }, { key: "getAllUserListOfMessageReaction", value: function(e2) { var t2, n2, o2, i2, a2, s2, r2, c2, u2 = this, l2 = "getAllUserListOfMessageReaction"; return this.canIUse(_.MSG_REACTION) ? (t2 = "".concat(this._n, ".").concat(l2), a2 = e2.message, n2 = e2.reactionID, o2 = e2.nextSeq, i2 = e2.count, c2 = a2.ID, a2 = a2.conversationID, a2 = "convID:".concat(a2, " messageID:").concat(c2, " reactionID:").concat(n2, " nextSeq:").concat(o2, " count:").concat(i2), (s2 = new G(l2)).setMessage(a2), M.l("".concat(t2, " ").concat(a2)), r2 = { userList: [], nextSeq: 0, isCompleted: false }, c2 = this._createReactionUserListPack(e2), this.req(c2).then(function(e3) { var e3 = e3.data, t3 = e3.userIDList, t3 = void 0 === t3 ? [] : t3, e3 = e3.nextSeq, e3 = void 0 === e3 ? 0 : e3; return r2.nextSeq = e3, r2.isCompleted = 0 === e3, u2.get(4).getUserNickAndAvatar(t3); }).then(function(e3) { return r2.userList = e3, s2.end(), M.l("".concat(t2, " ok.")), C(r2); }).catch(function(e3) { return s2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this.noUse(l2); } }, { key: "_createReactionOperationPack", value: function(e2, t2, n2) { var o2, i2, a2 = void 0, t2 = { reactionID: t2, userIDList: [this.getMyUserID()] }; return e2.conversationType === A.CONV_C2C && (o2 = this.get(6), a2 = 1 === n2 ? k.ADD_C2C_MSG_REACTION : k.RM_C2C_MSG_REACTION, t2.from = e2.from, t2.to = e2.to, t2.messageKey = o2.getMessageKey(e2)), e2.conversationType === A.CONV_GROUP && (o2 = void 0, i2 = e2.to, Gt(e2.to) && (i2 = Jt(o2 = e2.to)), a2 = 1 === n2 ? k.ADD_GRP_MSG_REACTION : k.RM_GRP_MSG_REACTION, t2.groupID = i2, t2.topicID = o2, t2.messageSequence = e2.sequence), { P: a2, data: t2 }; } }, { key: "_createReactionSummaryPack", value: function(e2) { var n2, t2, o2, i2 = e2.messageList, a2 = e2.maxUserCountPerReaction, a2 = void 0 === a2 ? 10 : a2, s2 = e2.messageIDMap, e2 = i2[0], r2 = void 0, c2 = void 0; return e2.conversationType === A.CONV_C2C && (n2 = this.get(6), t2 = i2.map(function(e3) { var t3 = n2.getMessageKey(e3); return s2.set(t3, e3.ID), t3; }), r2 = k.GET_C2C_MSG_REACTIONS, c2 = { from: e2.from, to: e2.to, messageKeyList: t2, count: a2 }), e2.conversationType === A.CONV_GROUP && (t2 = void 0, o2 = e2.to, Gt(e2.to) && (o2 = Jt(t2 = e2.to)), e2 = i2.map(function(e3) { return s2.set(e3.sequence, e3.ID), e3.sequence; }), r2 = k.GET_GRP_MSG_REACTIONS, c2 = { groupID: o2, topicID: t2, messageSequenceList: e2, count: a2 }), { P: r2, data: c2 }; } }, { key: "_createReactionUserListPack", value: function(e2) { var t2 = e2.message, n2 = e2.reactionID, o2 = e2.nextSeq, e2 = e2.count, e2 = void 0 === e2 ? 100 : e2, i2 = void 0, n2 = { reactionID: n2, nextSeq: void 0 === o2 ? 0 : o2, count: 100 < e2 ? 100 : e2 }; return t2.conversationType === A.CONV_C2C && (o2 = this.get(6), i2 = k.GET_C2C_MSG_REACTION_USER_LIST, n2.from = t2.from, n2.to = t2.to, n2.messageKey = o2.getMessageKey(t2)), t2.conversationType === A.CONV_GROUP && (e2 = void 0, o2 = t2.to, Gt(t2.to) && (o2 = Jt(e2 = t2.to)), i2 = k.GET_GRP_MSG_REACTION_USER_LIST, n2.groupID = o2, n2.topicID = e2, n2.messageSequence = t2.sequence), { P: i2, data: n2 }; } }, { key: "_handleReactionSummary", value: function(t2, e2) { var c2 = this; return this.get(4).getUserNickAndAvatar(e2).then(function(r2) { var e3 = []; return t2.forEach(function(a2) { var s2 = []; a2.reactionList.forEach(function(e4) { var t3 = e4.reactionID, n2 = e4.count, o2 = e4.userIDList, e4 = e4.reactedByMyself, e4 = void 0 === e4 ? void 0 : e4, i2 = [], o2 = (o2.forEach(function(t4) { r2.forEach(function(e5) { t4 === e5.userID && i2.push(e5); }); }), { reactionID: t3, totalUserCount: n2, partialUserList: i2, reactedByMyself: c2._computeReactedByMyself({ reactedByMyself: e4, messageID: a2.messageID, reactionID: t3 }) }); s2.push(o2), N(e4) && !c2._reactedByMyselfMap.has(a2.messageID) && (n2 = "".concat(a2.messageID, "-").concat(t3), c2._reactionInfoMap.set(n2, o2)); }), e3.push({ messageID: a2.messageID, reactionList: s2 }); }), e3; }); } }, { key: "_addReactedByMyselfMap", value: function(e2, t2) { this._reactedByMyselfMap.has(e2) || this._reactedByMyselfMap.set(e2, []); e2 = this._reactedByMyselfMap.get(e2); -1 === e2.indexOf(t2) && e2.push(t2); } }, { key: "_removeReactedByMyselfMap", value: function(e2, t2) { this._reactedByMyselfMap.has(e2) && -1 < (t2 = (e2 = this._reactedByMyselfMap.get(e2)).indexOf(t2)) && e2.splice(t2, 1); } }, { key: "_computeReactedByMyself", value: function(e2) { var t2 = e2.reactedByMyself, n2 = e2.messageID, e2 = e2.reactionID; return N(t2) ? !!this._reactedByMyselfMap.has(n2) && this._reactedByMyselfMap.get(n2).includes(e2) : 1 === t2; } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._reactedByMyselfMap.clear(), this._reactionInfoMap.clear(); } }]), ja), xa = (t(Wa, u), Na = n(Wa), e(Wa, [{ key: "sendMessage", value: function(e2) { var o2 = this, i2 = this._createMsg(e2); if (null === i2) return D({ code: L.MSG_SEND_FAIL }); this._addSendMessageTotalCount(i2); var a2 = Date.now(); return this.get(11).setMessageRandom(i2), this._sendComboMessage(i2, e2).then(function(e3) { var e3 = e3.data, t2 = e3.time, n2 = e3.sequence, e3 = e3.readReceiptCode, e3 = (R(e3) && 0 !== e3 && (new G("sendMessageWithReceipt").setMessage("from:".concat(i2.from, " to:").concat(i2.to, " sequence:").concat(n2, " readReceiptCode:").concat(e3)).end(), M.w("".concat(o2._n, ".sendMessage readReceiptCode:").concat(e3, " message:").concat(o2.getErrMsg(e3)))), o2._addSendMessageSuccessCount(i2, a2), o2.get(11)), t2 = (i2.status = Rn, i2.time = t2, i2.conversationType === A.CONV_GROUP && (i2.sequence = n2), e3.appendToMessageList(i2), i2); return true === i2._isExcludedFromLastMessage && (t2 = ""), e3.onMessageSent({ conversationOptionsList: [{ conversationID: i2.conversationID, unreadCount: 0, type: i2.conversationType, subType: i2.conversationSubType, lastMessage: t2 }] }), C({ message: i2 }); }).catch(function(e3) { return o2._onSendMessageFailed(i2, e3); }); } }, { key: "_sendComboMessage", value: function(e2, t2) { var n2 = this._m.get(20), o2 = ""; return e2.conversationType === A.CONV_C2C && (o2 = "".concat(a.NAME.OPEN_IM, ".").concat(k.SEND_C2C_MSG)), e2.conversationType === A.CONV_GROUP && (o2 = "".concat(a.NAME.GRP, ".").concat(k.SEND_GRP_MSG)), n2.sendComboMessage({ servcmd: o2, data: t2 }); } }, { key: "_createMsg", value: function(e2) { var t2 = "".concat(this._n, "._createMsg"), n2 = null; try { var o2, i2 = this.getMyUserID(), a2 = {}; a2.senderTinyID = this.getMyTinyID(), a2.currentUser = i2, a2.from = e2.From_Account || i2, e2.GroupId ? (a2.conversationID = "".concat(A.CONV_GROUP).concat(e2.GroupId), a2.conversationType = A.CONV_GROUP, a2.to = e2.GroupId) : e2.To_Account && (a2.conversationID = "".concat(A.CONV_C2C).concat(e2.To_Account), a2.conversationType = A.CONV_C2C, a2.to = e2.To_Account), a2.time = e2.MsgTimeStamp || 0, a2.random = e2.Random || e2.MsgRandom || 0, a2.priority = e2.MsgPriority, m(e2.CloudCustomData) && 0 < e2.CloudCustomData.length && (a2.cloudCustomData = e2.CloudCustomData), O(e2.SendMsgControl) && (a2.messageControlInfo = {}, e2.SendMsgControl.includes("NoUnread") && (a2.messageControlInfo.excludedFromUnreadCount = 1), e2.SendMsgControl.includes("NoLastMsg")) && (a2.messageControlInfo.excludedFromLastMessage = 1), a2.conversationType === A.CONV_GROUP && O(e2.To_Account) && 0 < e2.To_Account.length && (o2 = e2.To_Account, 50 < e2.To_Account.length && (o2 = e2.To_Account.slice(0, 50), M.w("".concat(t2, " To_Account must be less than or equal to 50."))), a2.receiverList = p(o2), e2.To_Account = p(o2)), 1 !== e2.IsNeedReadReceipt && 1 !== e2.NeedReadReceipt || (a2.needReadReceipt = true), 1 === e2.SupportMessageExtension && (a2.isSupportExtension = true), (n2 = new Do(a2)).status = An, e2.MsgClientTime = n2.clientTime, n2.conversationType === A.CONV_C2C && (e2.MsgSeq = n2.sequence); for (var s2, r2 = e2.MsgBody.length, c2 = 0; c2 < r2; c2++) "TIMTextElem" === (s2 = e2.MsgBody[c2]).MsgType ? n2.setTextElement(s2.MsgContent.Text) : "TIMCustomElem" === s2.MsgType ? n2.setCustomElement({ data: s2.MsgContent.Data || "", description: s2.MsgContent.Desc || "", extension: s2.MsgContent.Ext || "" }) : "TIMFaceElem" === s2.MsgType && n2.setFaceElement({ index: s2.MsgContent.Index, data: s2.MsgContent.Data }); var u2 = n2.getElements(); n2.payload = u2[0].content, n2.type = u2[0].type; } catch (e3) { n2 = null, M.e("".concat(t2, " failed. error:"), e3); } return n2; } }, { key: "_onSendMessageFailed", value: function(e2, t2) { e2.status = On, this.get(11).deleteMessageRandom(e2), this._addSendMessageFailCountOnUser(e2, t2); var n2 = new G("sendMessage"), o2 = "head.seq:".concat(t2.data.headSeq, " type:").concat(e2.type, " from:").concat(e2.from, " to:").concat(e2.to); return n2.setMessage(o2).setError(t2).end(), M.e("".concat(this._n, "._onSendMessageFailed ").concat(o2, " error:"), t2), D(new E({ code: t2 && t2.code ? t2.code : L.MSG_SEND_FAIL, message: t2 && t2.message ? t2.message : void 0, data: { message: e2 } })); } }, { key: "_getSendMessageSpecifiedKey", value: function(e2) { if (e2.conversationType === A.CONV_C2C) return Hn; if (e2.conversationType === A.CONV_GROUP) { var e2 = this.get(7).getLocalGroupProfile(e2.to); if (e2) return e2 = e2.type, Ot(e2) ? Kn : Bn; } } }, { key: "_addSendMessageTotalCount", value: function(e2) { e2 = this._getSendMessageSpecifiedKey(e2); e2 && this.get(26).addTotalCount(e2); } }, { key: "_addSendMessageSuccessCount", value: function(e2, t2) { var n2, e2 = this._getSendMessageSpecifiedKey(e2); e2 && ((n2 = this.get(26)).addSuccessCount(e2), n2.addCost(e2, nn(t2, false))); } }, { key: "_addSendMessageFailCountOnUser", value: function(e2, t2) { var t2 = t2.code, t2 = void 0 === t2 ? -1 : t2, n2 = this.get(26), e2 = this._getSendMessageSpecifiedKey(e2); Aa(t2) && e2 && n2.addFailedCountOfUserSide(e2); } }]), Wa), Va = (t(Ya, u), Oa = n(Ya), e(Ya, [{ key: "registerPlugin", value: function(t2) { var n2 = this, o2 = "0"; Object.keys(t2).forEach(function(e2) { n2.plugins[e2] = t2[e2], "tim-upload-plugin" === e2 && "function" == typeof t2[e2].getVersion && (o2 = t2[e2].getVersion()); }), new G("registerPlugin").setMessage("".concat(Object.keys(t2))).setMoreMessage("version:".concat(o2)).end(); } }, { key: "getPlugin", value: function(e2) { return this.plugins[e2]; } }, { key: "reset", value: function() { } }]), Ya), Ha = (t(Ka, u), Ra = n(Ka), e(Ka, [{ key: "_init", value: function() { this._startSync({ cookie: this._cookie, syncFlag: 0, isOnlineSync: 0 }); } }, { key: "_startSync", value: function(e2) { var i2 = this, t2 = e2.cookie, n2 = e2.syncFlag, o2 = e2.isOnlineSync, a2 = "".concat(this._n, "._startSync"), s2 = (M.l("".concat(a2, " options:"), e2), new G("syncUnread")); s2.setMessage(JSON.stringify(e2)), this.req({ P: k.SYNC_UNREAD_MSG, data: { cookie: t2, syncFlag: n2, isOnlineSync: o2 } }).then(function(e3) { var t3 = e3.data, n3 = t3.cookie, t3 = t3.syncFlag, o3 = "$cookie:".concat(n3, " syncFlag:").concat(t3); M.l("".concat(a2, " ok. ").concat(o3)), i2._cookie = n3, s2.setMoreMessage(o3).end(), S(n3) || (0 === t3 || 1 === t3 ? (i2._dispatch(y(y({}, e3.data), {}, { isSyncingEnded: false })), i2._startSync({ cookie: n3, syncFlag: t3, isOnlineSync: 0 })) : 2 === t3 && i2._dispatch(y(y({}, e3.data), {}, { isSyncingEnded: true }))); }).catch(function(e3) { s2.setError(e3).end(), M.e("".concat(a2, " failed. error:"), e3); }); } }, { key: "_dispatch", value: function(e2) { e2.eventArray && this.get(20).onMessage({ head: {}, body: { eventArray: e2.eventArray, isInstantMessage: this._onlineSyncFlag, isSyncingEnded: e2.isSyncingEnded } }), this.get(6).onNewMessage({ dataList: e2.messageList, isInstantMessage: !!e2.isSyncingEnded && this._onlineSyncFlag, C2CRemainingUnreadList: e2.C2CRemainingUnreadList, C2CPairUnreadList: e2.C2CPairUnreadList, isSyncingEnded: e2.isSyncingEnded }); } }, { key: "syncOnNeed", value: function() { M.l("".concat(this._n, ".syncOnNeed cookie:").concat(this._cookie)), this._onlineSyncFlag = true, this._startSync({ cookie: this._cookie, syncFlag: 0, isOnlineSync: 1 }); } }, { key: "syncOnReconnected", value: function() { M.l("".concat(this._n, ".syncOnReconnected cookie:").concat(this._cookie)), this._onlineSyncFlag = true, this._startSync({ cookie: this._cookie, syncFlag: 0, isOnlineSync: 0 }); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._onlineSyncFlag = false, this._cookie = ""; } }]), Ka), Ba = { 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 Ka(e2) { return d(this, Ka), (e2 = Ra.call(this, e2))._n = "SyncUnreadMsgModule", e2._cookie = "", e2._onlineSyncFlag = false, e2.getIEmitInst().on(P.A2KEY_AND_TINYID_UPDATED, e2._init, i(e2)), e2; } function Ya(e2) { return d(this, Ya), (e2 = Oa.call(this, e2))._n = "PluginModule", e2.plugins = {}, e2; } function Wa(e2) { return d(this, Wa), (e2 = Na.call(this, e2))._n = "ComboMsgModule", e2; } function ja(e2) { return d(this, ja), (e2 = Ga.call(this, e2))._n = "MsgReactionModule", e2._reactedByMyselfMap = /* @__PURE__ */ new Map(), e2._reactionInfoMap = /* @__PURE__ */ new Map(), e2; } function Ja(e2) { return d(this, Ja), (e2 = Pa.call(this, e2))._n = "MsgExtModule", e2.msgExtMap = /* @__PURE__ */ new Map(), e2.globalSeqMap = /* @__PURE__ */ new Map(), e2.getMsgExtsMap = /* @__PURE__ */ new Map(), e2; } function za(e2) { return d(this, za), (e2 = Ua.call(this, e2))._n = "MessageModule", e2._messageOptionsMap = /* @__PURE__ */ new Map(), e2._mergerMessageHandler = new Da(i(e2)), e2; } function Xa(e2, t2) { if ("string" == typeof e2 || Array.isArray(e2)) return t2 = Object.assign({ pascalCase: false }, t2), 0 === (e2 = Array.isArray(e2) ? e2.map(function(e3) { return e3.trim(); }).filter(function(e3) { return e3.length; }).join("-") : e2.trim()).length ? "" : 1 === e2.length ? t2.pascalCase ? e2.toUpperCase() : e2.toLowerCase() : (e2 = e2 = (e2 = e2 !== e2.toLowerCase() ? Za(e2) : e2).replace(/^[_.\- ]+/, "").toLowerCase().replace(/[_.\- ]+(\w|$)/g, function(e3, t3) { return t3.toUpperCase(); }).replace(/\d+(\w|$)/g, function(e3) { return e3.toUpperCase(); }), t2.pascalCase ? e2.charAt(0).toUpperCase() + e2.slice(1) : e2); throw new TypeError("Expected the input to be `string | string[]`"); } var Za = function(e2) { for (var t2 = false, n2 = false, o2 = false, i2 = 0; i2 < e2.length; i2++) { var a2 = e2[i2]; t2 && /[a-zA-Z]/.test(a2) && a2.toUpperCase() === a2 ? (e2 = e2.slice(0, i2) + "-" + e2.slice(i2), o2 = n2, n2 = !(t2 = false), i2++) : n2 && o2 && /[a-zA-Z]/.test(a2) && a2.toLowerCase() === a2 ? (e2 = e2.slice(0, i2 - 1) + "-" + e2.slice(i2 - 1), o2 = n2, t2 = !(n2 = false)) : (t2 = a2.toLowerCase() === a2 && a2.toUpperCase() !== a2, o2 = n2, n2 = a2.toUpperCase() === a2 && a2.toLowerCase() !== a2); } return e2; }; function Qa(e2, t2) { var r2 = 0; return function n2(e3, i2) { var t3, o2, a2, s2; return 100 < ++r2 ? (r2--, e3) : O(e3) ? (t3 = e3.map(function(e4) { return ut(e4) ? n2(e4, i2) : e4; }), r2--, t3) : ut(e3) ? (o2 = e3, a2 = function(e4, t4) { if (!pt(t4)) return false; if (t4 !== Xa(t4)) for (var n3 = 0; n3 < Ba.ignoreKeyWord.length && !t4.includes(Ba.ignoreKeyWord[n3]); n3++) ; var o3; return N(i2[t4]) ? "OPPOChannelID" === (o3 = t4) ? o3 : o3[0].toUpperCase() + Xa(o3).slice(1) : i2[t4]; }, s2 = /* @__PURE__ */ Object.create(null), Object.keys(o2).forEach(function(e4) { var t4 = a2(o2[e4], e4); t4 && (s2[t4] = o2[e4]); }), t3 = wt(t3 = s2, function(e4, t4) { return O(e4) || ut(e4) ? n2(e4, i2) : e4; }), r2--, t3) : void 0; }(e2, t2); } for (var $a, es = String.fromCharCode, ts = function(e2) { var t2 = 0 | e2.charCodeAt(0); if (55296 <= t2) if (t2 < 56320) { e2 = 0 | e2.charCodeAt(1); if (56320 <= e2 && e2 <= 57343) { if (65535 < (t2 = (t2 << 10) + e2 - 56613888 | 0)) return es(240 | t2 >>> 18, 128 | t2 >>> 12 & 63, 128 | t2 >>> 6 & 63, 128 | 63 & t2); } else t2 = 65533; } else t2 <= 57343 && (t2 = 65533); return t2 <= 2047 ? es(192 | t2 >>> 6, 128 | 63 & t2) : es(224 | t2 >>> 12, 128 | t2 >>> 6 & 63, 128 | 63 & t2); }, ns = function(e2) { for (var t2 = void 0 === e2 ? "" : ("" + e2).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g, ts), n2 = 0 | t2.length, o2 = new Uint8Array(n2), i2 = 0; i2 < n2; i2 = i2 + 1 | 0) o2[i2] = 0 | t2.charCodeAt(i2); return o2; }, os = (e(Ls, [{ key: "getID", value: function() { return this._id; } }, { key: "_onOpen", value: function(e2) { this._handler.onOpen({ id: this._id, res: JSON.stringify(e2) }); } }, { key: "_onClose", value: function(e2) { this._handler.onClose({ id: this._id, e: e2 }); } }, { key: "_onMessage", value: function(e2) { e2 = this._canIUseBinaryFrame ? this._isAppCompressedData(e2.data) ? this._handler.inflate(e2.data) : function(e3) { for (var t2 = new Uint8Array(e3), n2 = "", o2 = 0, i2 = t2.length; o2 < i2; ) { var a2 = t2[o2], s2 = 0, r2 = 0; if (a2 <= 127 ? (s2 = 0, r2 = 255 & a2) : a2 <= 223 ? (s2 = 1, r2 = 31 & a2) : a2 <= 239 ? (s2 = 2, r2 = 15 & a2) : a2 <= 244 && (s2 = 3, r2 = 7 & a2), 0 < i2 - o2 - s2) for (var c2 = 0; c2 < s2; ) r2 = r2 << 6 | 63 & (a2 = t2[o2 + c2 + 1]), c2 += 1; else r2 = 65533, s2 = i2 - o2; n2 += String.fromCodePoint(r2), o2 += s2 + 1; } return n2; }(e2.data) : e2.data; this._handler.onMessage({ data: e2 }); } }, { key: "_isAppCompressedData", value: function(e2) { e2 = new Uint8Array(e2); return 67 === e2[0] && 79 === e2[1] && 77 === e2[2] && 80 === e2[3]; } }, { key: "_onError", value: function(e2) { this._handler.onError({ id: this._id, e: e2 }); } }, { key: "setIsWorkerEnabled", value: function(e2) { this._isWorkerEnabled = true; } }, { key: "close", value: function(e2) { this._workerSocket && (this._workerSocket.postMessage({ cmd: "stop", code: e2 }), this._workerSocket.terminate(), this._workerSocket = null), ve ? (I.offSocketClose(), I.offSocketMessage(), I.offSocketOpen(), I.offSocketError(), I.closeSocket()) : this._socket && (v ? (this._socket.onClose(function() { }), this._socket.onOpen(function() { }), this._socket.onMessage(function() { }), this._socket.onError(function() { })) : (this._socket.onopen = null, this._socket.onmessage = null, this._socket.onclose = null, this._socket.onerror = null), me ? this._socket.close({ code: e2 }) : this._socket.close(e2), this._socket = null); } }, { key: "send", value: function(e2) { this._workerSocket ? this._workerSocket.postMessage({ cmd: "sendMessage", data: this._canIUseBinaryFrame ? ns(e2.data).buffer : e2.data }) : ve ? I.sendSocketMessage({ data: e2.data, fail: function() { e2.fail && e2.requestID && e2.fail(e2.requestID); } }) : this._socket && (v ? this._socket.send({ data: this._canIUseBinaryFrame ? ns(e2.data).buffer : e2.data, fail: function() { e2.fail && e2.requestID && e2.fail(e2.requestID); } }) : this._socket.send(this._canIUseBinaryFrame ? ns(e2.data) : e2.data)); } }]), Ls), is = ["keyMap"], as = ["keyMap"], ss = "connected", rs = "connecting", cs = "disconnected", us = (e(Es, [{ key: "_setWebsocketHost", value: function() { var e2 = this._chM.get(12); this._currentSite = se, this._chM.isOversea() && (this._currentSite = "OVERSEA"), e2.isSingaporeSite() ? this._currentSite = "SINGAPORE" : e2.isKoreaSite() ? this._currentSite = "KOREA" : e2.isGermanySite() ? this._currentSite = "GERMANY" : e2.isIndiaSite() ? this._currentSite = "IND" : e2.isJapanSite() ? this._currentSite = "JPN" : e2.isUSASite() ? this._currentSite = "USA" : e2.isIndonesiaSite() && (this._currentSite = "INDONESIA"), a.HOST.setCurrent(this._currentSite); } }, { key: "_initConnection", value: function() { var e2 = this._chM.get(12).getSDKAppID() + "", e2 = (N(a.HOST.CURRENT.BACKUP) ? this._url = a.HOST.CURRENT.DEFAULT : "" === this._url ? this._url = a.HOST.CURRENT.DEFAULT0.replace("*", e2) : -1 < this._url.indexOf(e2) ? this._url = a.HOST.CURRENT.DEFAULT : this._url === a.HOST.CURRENT.DEFAULT ? this._url = a.HOST.CURRENT.BACKUP : this._url === a.HOST.CURRENT.BACKUP ? this._url = this._canIUseAnyCast() ? a.HOST.CURRENT.ANYCAST : a.HOST.CURRENT.DEFAULT : this._url === a.HOST.CURRENT.ANYCAST && (a.HOST.CURRENT.ANYCAST = "", this._url = a.HOST.CURRENT.DEFAULT), this._chM.get(12)), t2 = e2.getProxyServer(); S(t2) || (this._url = t2), e2.isTestEnv() && (this._url = te.TEST[this._currentSite].DEFAULT), this._connect(), this._nextPingTs = 0; } }, { key: "_canIUseAnyCast", value: function() { return Ce && a.HOST.CURRENT.ANYCAST; } }, { key: "onCheckTimer", value: function(e2) { e2 % 1 == 0 && (this._checkPromiseMap(), this._checkNativeAppWS()); } }, { key: "_checkPromiseMap", value: function() { var a2 = this; 0 !== this._promiseMap.size && this._promiseMap.forEach(function(e2, t2) { var n2 = e2.reject, o2 = e2.timestamp, e2 = e2.headSeq, i2 = 15e3; -1 !== t2.indexOf(k.LOGIN) ? i2 = 9e4 : -1 !== t2.indexOf(k.PING) && (i2 = 3e3), Date.now() - o2 >= i2 && (M.l("".concat(a2._n, "._checkPromiseMap request timeout, delete requestID:").concat(t2)), a2._promiseMap.delete(t2), n2(new E({ code: L.NETWORK_TIMEOUT, data: { headSeq: e2 } })), a2._chM.onRequestTimeout()); }); } }, { key: "_checkNativeAppWS", value: function() { Ie && !this.isConnected() && this._reConnect(); } }, { key: "onOpen", value: function(e2) { var t2, n2; this._readyState !== cs && (this._onOpenTs = Date.now(), n2 = e2.id, e2 = e2.res, this._socketID = n2, t2 = nn(this._startTs, false), n2 = "socketID:".concat(n2, " res:").concat(e2), M.l("".concat(this._n, "._onOpen cost:").concat(t2, " ms. ").concat(n2)), new G("wsOnOpen").setMessage(t2).setCostTime(t2).setMoreMessage(n2).end(), this._readyState = ss, this._reConnectCount = 0, this._resend(), true === this._reConnectFlag && (this._chM.onReconnected(), this._reConnectFlag = false), this._chM.onOpen()); } }, { key: "onClose", value: function(e2) { var t2 = new G("wsOnClose"), n2 = e2.id, e2 = e2.e, o2 = "sourceSocketID:".concat(n2, " currentSocketID:").concat(this._socketID, " code:").concat(e2.code, " reason:").concat(e2.reason), i2 = 0; 0 !== this._onOpenTs && (i2 = Date.now() - this._onOpenTs), t2.setMessage(i2).setCostTime(i2).setMoreMessage(o2).setCode(e2.code).end(true), M.l("".concat(this._n, "._onClose ").concat(o2, " onlineTime:").concat(i2)), n2 === this._socketID && (this._readyState = cs, i2 < 1e3 ? this._chM.onReconnectFailed() : this._chM.onClose()); } }, { key: "onError", value: function(e2) { var t2 = e2.id, e2 = e2.e, n2 = "sourceSocketID:".concat(t2, " currentSocketID:").concat(this._socketID); new G("wsOnError").setMessage(e2.errMsg || JSON.stringify(e2, ["message", "code"])).setMoreMessage(n2).setLevel("error").end(true), M.w("".concat(this._n, "._onError"), e2, n2), t2 === this._socketID && (this._readyState = cs, this._chM.onError()); } }, { key: "onMessage", value: function(t2) { var e2, n2, o2, i2, a2, s2; try { e2 = JSON.parse(t2.data); } catch (e3) { new G("jsonParseError").setMessage(t2.data).end(); } e2 && e2.head && (t2 = this._getRequestIDFromHead(e2.head), n2 = e2.body, this._chM.get(30).isTRTCCommand(t2) || (s2 = Kt(e2.head), n2 = function t3(e3, n3) { var o3, i3, a3; return O(e3) ? e3.map(function(e4) { return ut(e4) ? t3(e4, n3) : e4; }) : ut(e3) ? (o3 = e3, i3 = function(e4, t4) { return N(n3[t4]) ? Xa(t4) : n3[t4]; }, a3 = {}, Object.keys(o3).forEach(function(e4) { a3[i3(o3[e4], e4)] = o3[e4]; }), wt(a3, function(e4) { return O(e4) || ut(e4) ? t3(e4, n3) : e4; })) : void 0; }(e2.body, this._getResKeyMap(s2))), M.d("".concat(this._n, ".onMessage ret:").concat(JSON.stringify(n2), " requestID:").concat(t2, " has:").concat(this._promiseMap.has(t2))), this._setNextPingTs(), this._promiseMap.has(t2) ? (o2 = (s2 = this._promiseMap.get(t2)).resolve, i2 = s2.reject, a2 = s2.timestamp, s2 = s2.headSeq, this._promiseMap.delete(t2), this._calcRTT(a2), n2.errorCode && 0 !== n2.errorCode ? (this._chM.onErrorCodeNotZero(n2), i2(new E({ code: n2.errorCode, message: n2.errorInfo || "", data: t2.includes(k.MODIFY_C2C_MSG) || t2.includes(k.MODIFY_GRP_MSG) ? { elements: n2.elements, messageVersion: n2.messageVersion, cloudCustomData: n2.cloudCustomData, headSeq: s2 } : { headSeq: s2 } }))) : o2(C(n2))) : this._chM.onMessage({ head: e2.head, body: n2 })); } }, { key: "_calcRTT", value: function(e2) { e2 = Date.now() - e2; this._chM.get(26).addRTT(e2); } }, { key: "_connect", value: function() { this._readyState !== rs && this._readyState !== ss && (this._startTs = Date.now(), this._onOpenTs = 0, this._readyState = rs, this._socket = new os(this), this._socketID = this._socket.getID(), M.l("".concat(this._n, "._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled(), " socketID:").concat(this._socketID, " url:").concat(this.getURL())), new G("wsConnect").setMessage("socketID:".concat(this._socketID, " url:").concat(this.getURL())).end()); } }, { key: "getURL", value: function() { this._chM.isDevMode() && (this._canIUseBinaryFrame = false); var e2 = xt(), t2 = ((ve || _e && "windows" === e2 || Ie) && (this._canIUseBinaryFrame = false), -1), n2 = ("ios" === e2 ? t2 = Le || -1 : "android" === e2 && (t2 = ke || -1), this._chM.get(12)), o2 = this._chM.getPlatform(), i2 = n2.getSDKAppID(), n2 = n2.getInstanceID(), i2 = "sdkappid=".concat(i2, "&instanceid=").concat(n2, "&random=").concat(this._getRandom(), "&platform=").concat(o2, "&host=").concat(e2) + "&version=".concat(t2, "&sdkversion=").concat("3.4.7"); return he && (i2 += "&isminigame=1"), this._chM.canIUseInflate() && (i2 += "&compress=gzip"), (this._canIUseBinaryFrame ? "".concat(this._url, "/binfo?") : "".concat(this._url, "/info?")).concat(i2); } }, { key: "_closeConnection", value: function(e2) { M.l("".concat(this._n, "._closeConnection socketID:").concat(this._socketID)), this._socket && (this._socket.close(e2), this._socketID = -1, this._socket = null, this._readyState = cs); } }, { key: "_resend", value: function() { var i2 = this; if (M.l("".concat(this._n, "._resend reConnectFlag:").concat(this._reConnectFlag), "promiseMap.size:".concat(this._promiseMap.size, " simpleRequestMap.size:").concat(this._simpleRequestMap.size)), 0 < this._promiseMap.size && this._promiseMap.forEach(function(e3, t3) { var n3 = e3.uplinkData, o3 = e3.resolve, e3 = e3.reject; -1 !== t3.indexOf(k.AV_POLLING) ? i2._promiseMap.delete(t3) : (i2._promiseMap.set(t3, { resolve: o3, reject: e3, timestamp: Date.now(), uplinkData: n3 }), i2._execute(t3, n3)); }), 0 < this._simpleRequestMap.size) { var e2, t2 = Z(this._simpleRequestMap); try { for (t2.s(); !(e2 = t2.n()).done; ) { var n2 = Y(e2.value, 2), o2 = n2[0], a2 = n2[1]; this._execute(o2, a2); } } catch (e3) { t2.e(e3); } finally { t2.f(); } this._simpleRequestMap.clear(); } } }, { key: "send", value: function(n2) { var o2 = this, i2 = (n2.head.seq = this._getSequence(), n2.head.reqtime = Math.floor(Date.now() / 1e3), n2.keyMap, K(n2, is)), a2 = this._getRequestIDFromHead(n2.head), s2 = JSON.stringify(i2); return new Promise(function(e2, t2) { o2._promiseMap.set(a2, { resolve: e2, reject: t2, timestamp: Date.now(), uplinkData: s2, headSeq: n2.head.seq }), M.d("".concat(o2._n, ".send uplinkData:").concat(JSON.stringify(i2), " requestID:").concat(a2, " readyState:").concat(o2._readyState)), o2._readyState !== ss ? o2._reConnect() : (o2._execute(a2, s2), o2._chM.get(26).addRequestCount()); }); } }, { key: "simplySend", value: function(e2) { e2.head.seq = this._getSequence(), e2.head.reqtime = Math.floor(Date.now() / 1e3), e2.keyMap; var t2 = K(e2, as), e2 = this._getRequestIDFromHead(e2.head), t2 = JSON.stringify(t2); this._readyState !== ss ? (this._simpleRequestMap.size < this.MAX_SIZE ? this._simpleRequestMap.set(e2, t2) : M.l("".concat(this._n, ".simplySend. simpleRequestMap is full, drop request!")), this._reConnect()) : this._execute(e2, t2); } }, { key: "_execute", value: function(e2, t2) { this._socket.send({ data: t2, fail: v ? this._onSendFail.bind(this) : void 0, requestID: e2 }); } }, { key: "_onSendFail", value: function(e2) { M.l("".concat(this._n, "._onSendFail requestID:").concat(e2)), this._chM.onSendFail(); } }, { key: "_getSequence", value: function() { var e2; if (this._startSequence < 2415919103) return e2 = this._startSequence, this._startSequence += 1, 2415919103 === this._startSequence && (this._startSequence = ft()), e2; } }, { key: "_getRequestIDFromHead", value: function(e2) { return e2.servcmd + e2.seq; } }, { key: "_getResKeyMap", value: function(e2) { e2 = this._chM.getKeyMap(e2); return y(y({}, Ba.res), e2.res); } }, { key: "_reConnect", value: function() { this._readyState !== ss && this._readyState !== rs && this.forcedReconnect(); } }, { key: "forcedReconnect", value: function() { var e2 = "".concat(this._n, ".forcedReconnect"); M.l("".concat(e2, " count:").concat(this._reConnectCount, " readyState:").concat(this._readyState)), this._reConnectFlag = true, this._resetRandom(), this._reConnectCount < this.MAX_RECONNECT_COUNT ? (this._reConnectCount += 1, this._closeConnection(4001), this._initConnection()) : (this._reConnectCount = 0, this._chM.get(15).isOnline() ? (M.w("".concat(e2, " disconnected from wsserver but network is ok, continue...")), this._closeConnection(4001), this._initConnection()) : this._chM.onReconnectFailed()); } }, { key: "getReconnectFlag", value: function() { return this._reConnectFlag; } }, { key: "_setNextPingTs", value: function() { this._nextPingTs = Ie ? Date.now() + 5e3 : Date.now() + 1e4; } }, { key: "getNextPingTs", value: function() { return this._nextPingTs; } }, { key: "isConnected", value: function() { return this._readyState === ss; } }, { key: "canIUseBinaryFrame", value: function() { return this._canIUseBinaryFrame; } }, { key: "getSocketID", value: function() { return this._socketID; } }, { key: "inflate", value: function(e2) { if (this._chM.canIUseInflate()) return this._chM.get(37).inflate(e2); } }, { key: "setIsWorkerEnabled", value: function(e2) { M.l("".concat(this._n, ".setIsWorkerEnabled flag:").concat(e2)), this._isWorkerEnabled = e2; } }, { key: "getIsWorkerEnabled", value: function() { return this._isWorkerEnabled && Ge; } }, { key: "_getRandom", value: function() { return 0 === this._random && (this._random = Math.random()), this._random; } }, { key: "_resetRandom", value: function() { this._random = 0; } }, { key: "close", value: function() { M.l("".concat(this._n, ".close")), this._closeConnection(4e3), this._promiseMap.clear(), this._startSequence = ft(), this._readyState = cs, this._simpleRequestMap.clear(), this._reConnectFlag = false, this._reConnectCount = 0, this._onOpenTs = 0, this._url = "", this._random = 0, this._canIUseBinaryFrame = true, this._isWorkerEnabled = true; } }]), Es), ls = function(a2, s2, r2) { return new Promise(function(t2, e2) { var n2, o2, i2 = "application/x-www-form-urlencoded;charset=UTF-8"; v ? I.request({ url: s2, data: r2, method: a2, timeout: 3e3, header: { "content-type": i2 }, success: function(e3) { e3 && e3.data && e3.data.NetCheckInfo && M.l("".concat("getconninfo ok in", " miniapp. ret:"), e3.data), t2(); }, fail: function() { e2(new E({ code: L.NETWORK_ERROR })); } }) : (n2 = new XMLHttpRequest(), o2 = setTimeout(function() { n2.abort(), e2(new E({ code: L.NETWORK_TIMEOUT })); }, 3e3), n2.onreadystatechange = function() { 4 === n2.readyState && (clearTimeout(o2), 200 === n2.status || 304 === n2.status ? (n2.responseText && -1 < n2.responseText.indexOf("NetCheckInfo") && M.l("".concat("getconninfo ok in", " web. ret:"), JSON.parse(n2.responseText)), t2()) : e2(new E({ code: L.NETWORK_ERROR }))); }, n2.open(a2, s2, true), n2.setRequestHeader("Content-type", i2), r2 ? n2.send(r2) : n2.send()); }); }, ds = (t(Ds, u), $a = n(Ds), e(Ds, [{ key: "onCheckTimer", value: function(e2) { this._socketHandler && (this.isLoggedIn() ? (0 < this._timerForNotLoggedIn && (clearInterval(this._timerForNotLoggedIn), this._timerForNotLoggedIn = -1), this._socketHandler.onCheckTimer(e2)) : this._socketHandler.onCheckTimer(1), this._checkNextPing()); } }, { key: "onErrorCodeNotZero", value: function(e2) { this.get(20).onErrorCodeNotZero(e2); } }, { key: "onMessage", value: function(e2) { this.get(20).onMessage(e2); } }, { key: "send", value: function(e2) { return this._socketHandler ? this._previousState !== A.NET_STATE_CONNECTED && e2.head.servcmd.includes(k.SSO_STAT) ? (this.reConnect(), this.isPrivateNetWork() ? Promise.resolve() : this._sendLogViaHTTP(e2)) : this._socketHandler.send(e2) : Promise.reject(); } }, { key: "_sendLogViaHTTP", value: function(e2) { var t2 = a.HOST.CURRENT.STAT, t2 = "".concat(t2, "/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e2.head.sdkappid, "&reqtime=").concat(Date.now()), e2 = JSON.stringify(e2.body); return ls("POST", t2, e2); } }, { key: "simplySend", value: function(e2) { return this._socketHandler ? this._socketHandler.simplySend(e2) : Promise.reject(); } }, { key: "onOpen", value: function() { this._ping(); } }, { key: "onClose", value: function() { this._socketHandler && this._socketHandler.getReconnectFlag() && this._emitNetStateChangeEvent(A.NET_STATE_DISCONNECTED), this.reConnect(); } }, { key: "onError", value: function() { v && !Ie && this.warn("DomainNameInMP"), this._emitNetStateChangeEvent(A.NET_STATE_DISCONNECTED); } }, { key: "getKeyMap", value: function(e2) { return this.get(20).getKeyMap(e2); } }, { key: "onRequestTimeout", value: function() { 3e4 <= Date.now() - this._lastDiagnoseTS && this.diagnose(); } }, { key: "onSendFail", value: function() { this._emitNetStateChangeEvent(A.NET_STATE_DISCONNECTED); } }, { key: "onReconnected", value: function() { M.l("".concat(this._n, ".onReconnected cost:").concat(nn(this._disconnectedTS, true, true))), this._m.restartTimer(), this.get(20).onReconnected(nn(this._disconnectedTS, false, false)), this._disconnectedTS = 0, this._emitNetStateChangeEvent(A.NET_STATE_CONNECTED); } }, { key: "onReconnectFailed", value: function() { M.l("".concat(this._n, ".onReconnectFailed")), this._emitNetStateChangeEvent(A.NET_STATE_DISCONNECTED); } }, { key: "setIsWorkerEnabled", value: function(e2) { this._socketHandler && this._socketHandler.setIsWorkerEnabled(false); } }, { key: "offline", value: function() { this._emitNetStateChangeEvent(A.NET_STATE_DISCONNECTED); } }, { key: "reConnect", value: function() { var e2 = 0 < arguments.length && void 0 !== arguments[0] && arguments[0], t2 = false, n2 = (this._socketHandler && (t2 = this._socketHandler.getReconnectFlag()), "forcedFlag:".concat(e2, " fatalErrorFlag:").concat(this._fatalErrorFlag, " previousState:").concat(this._previousState, " reconnectFlag:").concat(t2)); M.l("".concat(this._n, ".reConnect ").concat(n2)), this._fatalErrorFlag || !this._socketHandler || true !== e2 && this._previousState === A.NET_STATE_CONNECTING && t2 || (this._socketHandler.forcedReconnect(), this._emitNetStateChangeEvent(A.NET_STATE_CONNECTING)); } }, { key: "_emitNetStateChangeEvent", value: function(e2) { this._previousState !== e2 && (M.l("".concat(this._n, "._emitNetStateChangeEvent from ").concat(this._previousState, " to ").concat(e2)), e2 === A.NET_STATE_DISCONNECTED && 0 === this._disconnectedTS && (this._disconnectedTS = Date.now(), this.diagnose()), this._previousState = e2, this.emitOEvt(h.NET_STATE_CHANGE, { state: e2 })); } }, { key: "_ping", value: function() { var e2, n2 = this; true !== this._probing && (this._probing = true, e2 = this.get(20).getProtocolData({ P: k.PING }), this.send(e2).then(function() { n2._probing = false; }).catch(function(e3) { n2._probing = false; var t2 = n2.get(15).isOnline(); M.w("".concat(n2._n, "._ping failed. bOnline:").concat(t2, " error:"), e3), e3 && 60002 === e3.code ? (new G("error").setMessage("code:".concat(e3.code, " message:").concat(e3.message)).end(), n2._fatalErrorFlag = true, n2._emitNetStateChangeEvent(A.NET_STATE_DISCONNECTED)) : t2 ? n2.reConnect() : n2._emitNetStateChangeEvent(A.NET_STATE_DISCONNECTED); })); } }, { key: "_checkNextPing", value: function() { this._socketHandler && this._socketHandler.isConnected() && Date.now() >= this._socketHandler.getNextPingTs() && this._ping(); } }, { key: "dealloc", value: function() { this._socketHandler && (this._socketHandler.close(), this._socketHandler = null), -1 < this._timerForNotLoggedIn && clearInterval(this._timerForNotLoggedIn); } }, { key: "onRestApiKickedOut", value: function() { this._socketHandler && (this._socketHandler.close(), this.reConnect(true)); } }, { key: "canIUseInflate", value: function() { return this._m.canIUseInflate(); } }, { key: "getSocketID", value: function() { if (this._socketHandler) return this._socketHandler.getSocketID(); } }, { key: "diagnose", value: function() { this.isPrivateNetWork() || (this._lastDiagnoseTS = Date.now(), this._diagnoseBySSO(), this._diagnoseByCDN()); } }, { key: "_diagnoseBySSO", value: function() { var t2 = this, e2 = this._socketHandler.getURL(), n2 = e2.split("/")[2]; n2.startsWith("ws") && (e2 = e2.slice(e2.indexOf("info?") + 5), n2 = "https://".concat(n2, "/v3/netcheck/getconninfo?").concat(e2, "&reqtime=").concat(Date.now()), ls("GET", n2).catch(function(e3) { M.w("".concat(t2._n, "._diagnoseBySSO failed. error:"), e3); })); } }, { key: "_diagnoseByCDN", value: function() { var t2 = this, e2 = this._socketHandler.getURL(), e2 = e2.slice(e2.indexOf("info?") + 5), e2 = "https://boce-cdn.my-imcloud.com/v3/netcheck/getconninfo?".concat(e2, "&reqtime=").concat(Date.now()); ls("GET", e2).catch(function(e3) { M.w("".concat(t2._n, "._diagnoseByCDN failed. error:"), e3); }); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._previousState = A.NET_STATE_CONNECTED, this._probing = false, this._fatalErrorFlag = false, this._timerForNotLoggedIn = setInterval(this.onCheckTimer.bind(this), 1e3), this._disconnectedTS = 0, this._lastDiagnoseTS = 0; } }]), Ds), ps = ["a2", "tinyid"], _s = ["a2", "tinyid"], hs = (e(Ts, [{ key: "_fillMap", value: function() { this._map.clear(); var e2 = this._sessionM.genCommonHead(), t2 = this._sessionM.genCosSpecifiedHead(), n2 = this._sessionM.genSSOReportHead(); this._map.set(k.LOGIN, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(k.LOGIN) }), body: { state: "Online", isWebUniapp: 0, deviceBrand: 0, customInfo: "" }, keyMap: { req: { deviceBrand: "InstType" }, res: { InstId: "instanceID", HelloInterval: "helloInterval", RichMsgAuthKey: "authKey" } } }), this._map.set(k.LOGOUT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(k.LOGOUT) }), body: { type: 0, isWebUniapp: 0 }, keyMap: { req: { type: "wslogout_type" } } }), this._map.set(k.HELLO, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(k.HELLO) }), body: { isWebUniapp: 0 }, keyMap: { res: { NewInstInfo: "newInstanceInfo" } } }), this._map.set(k.KICK_OTHER, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.STAT_SERVICE, ".").concat(k.KICK_OTHER) }), body: {} }), this._map.set(k.COS_SIGN, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.IM_COS_SIGN, ".").concat(k.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(k.COS_PRE_SIG, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.CUSTOM_UPLOAD, ".").concat(k.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(k.SIMPLE_COS_PRE_SIG, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.CUSTOM_UPLOAD, ".").concat(k.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(k.GET_IMAGE_INFO, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.CUSTOM_UPLOAD, ".").concat(k.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(k.GET_IP, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.CUSTOM_UPLOAD, ".").concat(k.GET_IP) }), body: { domainName: "" }, keyMap: { req: { domainName: "str_domain" }, res: { str_final_ip: "ip" } } }), this._map.set(k.VIDEO_COVER, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.CUSTOM_UPLOAD, ".").concat(k.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(k.FETCH_COMMERCIAL_CONFIG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_CONFIG_MANAGER, ".").concat(k.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(k.PUSHED_COMMERCIAL_CONFIG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_CONFIG_MANAGER, ".").concat(k.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(k.FETCH_CLOUD_CTRL_CONFIG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_CONFIG_MANAGER, ".").concat(k.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(k.PUSHED_CLOUD_CTRL_CONFIG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_CONFIG_MANAGER, ".").concat(k.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(k.OVERLOAD_NOTIFY, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OVERLOAD_PUSH, ".").concat(k.OVERLOAD_NOTIFY) }), body: {}, keyMap: { res: { OverLoadServCmd: "overloadCommand", DelaySecs: "waitingTime" } } }), this._map.set(k.SYNC_UNREAD_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.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(k.GET_PROFANITY_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_MSG_AUDIT_MGR, ".").concat(k.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(k.SEND_C2C_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.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(k.SEND_GRP_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.REVOKE_C2C_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.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(k.REVOKE_GRP_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.REVOKE_GRP_MSG) }), body: { groupID: "", msgSeqList: void 0, topicID: "" }, keyMap: { req: { msgSeqList: "MsgSeqList", msgSeq: "MsgSeq" } } }), this._map.set(k.GET_C2C_ROAMING_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.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(k.MODIFY_C2C_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.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(k.GET_GRP_ROAMING_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.SET_C2C_MSG_READ, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.SET_C2C_MSG_READ) }), body: { C2CMsgReaded: void 0 }, keyMap: { req: { lastMessageTime: "LastedMsgTime" } } }), this._map.set(k.SET_C2C_PEER_MUTE_NOTIFICATIONS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.SET_C2C_PEER_MUTE_NOTIFICATIONS) }), body: { userIDList: void 0, muteFlag: 0 }, keyMap: { req: { userIDList: "Peer_Account", muteFlag: "Mute_Notifications" } } }), this._map.set(k.GET_C2C_PEER_MUTE_NOTIFICATIONS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.GET_C2C_PEER_MUTE_NOTIFICATIONS) }), body: { toAccount: void 0, userIDList: void 0 }, keyMap: { req: { userIDList: "Peer_Account" }, res: { MuteNotificationsList: "muteFlagList" } } }), this._map.set(k.SET_GRP_MSG_READ, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.SET_GRP_MSG_READ) }), body: { groupID: void 0, messageReadSeq: void 0, topicID: void 0 }, keyMap: { req: { messageReadSeq: "MsgReadedSeq" } } }), this._map.set(k.SET_ALL_MSG_READ, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.SET_ALL_MSG_READ) }), body: { readAllC2CMessage: 0, groupMessageReadInfoList: [] }, keyMap: { req: { readAllC2CMessage: "C2CReadAllMsg", groupMessageReadInfoList: "GroupReadInfo", messageSequence: "MsgSeq" }, res: { C2CReadAllMsg: "readAllC2CMessage", GroupReadInfoArray: "groupMessageReadInfoList" } } }), this._map.set(k.DEL_C2C_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.DEL_C2C_MSG) }), body: { fromAccount: "", to: "", keyList: void 0 }, keyMap: { req: { keyList: "MsgKeyList" } } }), this._map.set(k.DEL_GRP_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.DEL_GRP_MSG) }), body: { groupID: "", deleter: "", keyList: void 0, topicID: void 0 }, keyMap: { req: { deleter: "Deleter_Account", keyList: "Seqs" } } }), this._map.set(k.TRANSLATE_TEXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_TRANSLATE, ".").concat(k.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(k.VOICE_TO_TEXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_SPEECH, ".").concat(k.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(k.MODIFY_GRP_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.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(k.GET_READ_RECEIPT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.GET_READ_RECEIPT) }), body: { groupID: "", sequenceList: void 0 }, keyMap: { req: { sequence: "MsgSeq" } } }), this._map.set(k.SEND_C2C_READ_RECEIPT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.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(k.SEND_READ_RECEIPT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.SEND_READ_RECEIPT) }), body: { groupID: "", sequenceList: void 0 }, keyMap: { req: { sequenceList: "MsgSeqList", sequence: "MsgSeq" } } }), this._map.set(k.GET_READ_RECEIPT_DETAIL, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.MODIFY_C2C_MSG_EXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.MODIFY_C2C_MSG_EXT) }), body: { from: void 0, to: void 0, messageKey: void 0, operateType: void 0, extensionList: void 0 } }), this._map.set(k.GET_C2C_MSG_EXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.GET_C2C_MSG_EXT) }), body: { from: void 0, to: void 0, messageKey: void 0, startSequence: void 0 } }), this._map.set(k.MODIFY_GRP_MSG_EXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.MODIFY_GRP_MSG_EXT) }), body: { groupID: void 0, topicID: void 0, messageSequence: void 0, operateType: void 0, extensionList: void 0 } }), this._map.set(k.GET_GRP_MSG_EXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.GET_GRP_MSG_EXT) }), body: { groupID: void 0, topicID: void 0, messageSequence: void 0, startSequence: void 0 } }), this._map.set(k.MSG_CLOUD_SEARCH, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.MSG_SEARCH, ".").concat(k.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(k.ADD_C2C_MSG_REACTION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.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(k.RM_C2C_MSG_REACTION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.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(k.GET_C2C_MSG_REACTIONS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.GET_C2C_MSG_REACTIONS) }), body: { from: void 0, to: void 0, messageKeyList: void 0, count: void 0 } }), this._map.set(k.GET_C2C_MSG_REACTION_USER_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.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(k.ADD_GRP_MSG_REACTION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.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(k.RM_GRP_MSG_REACTION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.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(k.GET_GRP_MSG_REACTIONS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.GET_GRP_MSG_REACTIONS) }), body: { groupID: void 0, topicID: void 0, messageSequenceList: void 0, count: void 0 }, keyMap: { res: { MsgSeq: "messageSequence" } } }), this._map.set(k.GET_GRP_MSG_REACTION_USER_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(k.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(k.GET_C2C_PEER_READ_TIME, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.GET_C2C_PEER_READ_TIME) }), body: { userIDList: void 0 }, keyMap: { req: { userIDList: "To_Account" }, res: { ReadTime: "peerReadTimeList" } } }), this._map.set(k.PAGING_GET_CONV_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.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(k.DEL_CONV, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.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(k.CLEAR_HISTORY_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.CLEAR_HISTORY_MSG) }), body: { fromAccount: "", toAccount: void 0, type: 1, toGroupID: void 0 }, keyMap: { req: { toGroupID: "ToGroupid" } } }), this._map.set(k.PIN_CONV, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.PIN_CONV) }), body: { fromAccount: "", operationType: 1, itemList: void 0 }, keyMap: { req: { itemList: "RecentContactItem" } } }), this._map.set(k.DEL_GROUP_AT_TIPS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.DEL_GROUP_AT_TIPS) }), body: { messageListToDelete: void 0 }, keyMap: { req: { messageListToDelete: "DelMsgList", messageSeq: "MsgSeq", messageRandom: "MsgRandom" } } }), this._map.set(k.SET_CONV_CUSTOM_DATA, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.MARK_CONV) }), body: { fromAccount: "", itemList: void 0 }, keyMap: { req: { itemList: "MarkItem", operationType: "OptType", groupID: "ToGroupId" }, res: { ToGroupId: "groupID", OptType: "operationType" } } }), this._map.set(k.MARK_CONV, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.MARK_CONV) }), body: { fromAccount: "", itemList: void 0 }, keyMap: { req: { itemList: "MarkItem", operationType: "OptType", groupID: "ToGroupId" }, res: { ToGroupId: "groupID", OptType: "operationType" } } }), this._map.set(k.CREATE_CONV_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.CREATE_CONV_GRP) }), body: { fromAccount: "", itemList: void 0 }, keyMap: { req: { itemList: "GroupContactItem", groupID: "ToGroupId" }, res: { GroupId: "convGroupID", ToGroupId: "groupID", OptType: "operationType" } } }), this._map.set(k.DEL_CONV_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.DEL_CONV_GRP) }), body: { fromAccount: "", groupName: void 0 }, keyMap: { res: { GroupId: "convGroupID" } } }), this._map.set(k.RENAME_CONV_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.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(k.ADD_CONV_TO_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.RENAME_CONV_GRP) }), body: { fromAccount: "", updateType: void 0, updateGroup: { groupName: void 0, updateGroupType: void 0, updateItem: void 0 } } }), this._map.set(k.DEL_CONV_FROM_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.RENAME_CONV_GRP) }), body: { fromAccount: "", updateType: void 0, updateGroup: void 0 } }), this._map.set(k.GET_CONV_GRP_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.GET_CONV_GRP_LIST) }), body: { fromAccount: "", startIndex: void 0 }, keyMap: { res: { GroupId: "convGroupID", ToGroupId: "groupID", OptType: "operationType", CustomMark: "customData", ContactGroupId: "convGroupIDList" } } }), this._map.set(k.SEARCH_CONV_GRP_MARK, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(k.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(k.GET_USER_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.PROFILE, ".").concat(k.GET_USER_PROFILE) }), body: { fromAccount: "", userItem: [] }, keyMap: { req: { toAccount: "To_Account", standardSequence: "StandardSequence", customSequence: "CustomSequence" } } }), this._map.set(k.UPDATE_MY_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.PROFILE, ".").concat(k.UPDATE_MY_PROFILE) }), body: { fromAccount: "", profileItem: [{ tag: g.NICK, value: "" }, { tag: g.GENDER, value: "" }, { tag: g.ALLOWTYPE, value: "" }, { tag: g.AVATAR, value: "" }] }, keyMap: { req: { toAccount: "To_Account", standardSequence: "StandardSequence", customSequence: "CustomSequence" } } }), this._map.set(k.GET_BL, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.GET_BL) }), body: { fromAccount: "", startIndex: 0, maxLimited: 30, lastSequence: 0 }, keyMap: { res: { CurruentSequence: "currentSequence" } } }), this._map.set(k.ADD_TO_BL, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.ADD_TO_BL) }), body: { fromAccount: "", toAccount: [] } }), this._map.set(k.RM_FROM_BL, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.RM_FROM_BL) }), body: { fromAccount: "", toAccount: [] } }), this._map.set(k.SET_SELF_STATUS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(k.SET_SELF_STATUS) }), body: { customStatus: "" } }), this._map.set(k.GET_USER_STATUS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(k.GET_USER_STATUS) }), body: { userIDList: void 0 }, keyMap: { res: { UserStatusList: "successUserList", ErrorList: "failureUserList", To_Account: "userID", Invalid_Account: "invalidUserID", Status: "statusType" } } }), this._map.set(k.SUB_USER_STATUS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(k.SUB_USER_STATUS) }), body: { userIDList: void 0 }, keyMap: { res: { ErrorList: "failureUserList", To_Account: "userID", Invalid_Account: "invalidUserID" } } }), this._map.set(k.UNSUB_USER_STATUS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(k.UNSUB_USER_STATUS) }), body: { userIDList: void 0, unsubscribeAll: void 0 }, keyMap: { res: { ErrorList: "failureUserList", To_Account: "userID", Invalid_Account: "invalidUserID" } } }), this._map.set(k.GET_FD_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.GET_FD_LIST) }), body: { fromAccount: "", startIndex: 0, standardSequence: 0, customSequence: 0 }, keyMap: { res: { FriendNum: "friendCount", UserDataItem: "resultList", ValueItem: "tagValueList" } } }), this._map.set(k.ADD_FD, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.ADD_FD) }), body: { fromAccount: "", addFriendItem: [], type: "" }, keyMap: { req: { source: "AddSource", wording: "AddWording", type: "AddType" }, res: { ResultItem: "resultList" } } }), this._map.set(k.UPDATE_FD, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.UPDATE_FD) }), body: { fromAccount: "", updateItem: void 0 }, keyMap: { req: { snsItem: "SnsItem" }, res: { ResultItem: "resultList" } } }), this._map.set(k.DEL_FD, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.DEL_FD) }), body: { fromAccount: "", userIDList: [], type: "" }, keyMap: { req: { type: "DeleteType" }, res: { ResultItem: "resultList" } } }), this._map.set(k.GET_FD_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.GET_FD_PROFILE) }), body: { fromAccount: "", userIDList: void 0 }, keyMap: { res: { InfoItem: "resultList", SnsProfileItem: "tagValueList" } } }), this._map.set(k.CHECK_FD, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.CHECK_FD) }), body: { fromAccount: "", userIDList: [], type: "" }, keyMap: { req: { type: "CheckType" }, res: { InfoItem: "resultList" } } }), this._map.set(k.GET_FD_APPLICATION_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.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(k.RESPOND_FD_APPLICATION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.RESPOND_FD_APPLICATION) }), body: { fromAccount: "", responseFriendItem: [] }, keyMap: { req: { tag: "TagName", action: "ResponseAction" }, res: { ResultItem: "resultList" } } }), this._map.set(k.DEL_FD_APPLICATION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.DEL_FD_APPLICATION) }), body: { fromAccount: "", type: "", userIDList: void 0 }, keyMap: { req: { type: "PendencyType", userIDList: "To_Account" }, res: { ResultItem: "resultList" } } }), this._map.set(k.REPORT_FD_APPLICATION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.REPORT_FD_APPLICATION) }), body: { fromAccount: "", latestTimeStamp: "" }, keyMap: { req: { latestTimeStamp: "LatestPendencyTimeStamp" } } }), this._map.set(k.CREATE_FD_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.CREATE_FD_GRP) }), body: { fromAccount: "", groupName: void 0, userIDList: void 0 }, keyMap: { req: { groupName: "GroupName", userIDList: "To_Account" }, res: { ResultItem: "resultList" } } }), this._map.set(k.DEL_FD_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.DEL_FD_GRP) }), body: { fromAccount: "", nameList: void 0 }, keyMap: { req: { nameList: "GroupName" } } }), this._map.set(k.GET_FD_GRP_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.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(k.UPDATE_FD_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(k.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(k.GET_GRP_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.GET_GRP_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.CREATE_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.DISMISS_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.DISMISS_GRP) }), body: { groupID: void 0 } }), this._map.set(k.UPDATE_GRP_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.APPLY_JOIN_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.APPLY_JOIN_GRP_NOAUTH, (e2.a2, e2.tinyid, { head: y(y({}, K(e2, ps)), {}, { servcmd: "".concat(a.NAME.BIG_GRP_NO_AUTH, ".").concat(k.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(k.QUIT_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.QUIT_GRP) }), body: { groupID: void 0 } }), this._map.set(k.SEARCH_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.CHANGE_GRP_OWNER, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.CHANGE_GRP_OWNER) }), body: { groupID: void 0, newOwnerID: void 0 }, keyMap: { req: { newOwnerID: "NewOwner_Account" } } }), this._map.set(k.HANDLE_GRP_APPLICATION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.HANDLE_INVITE_JOIN_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.HANDLE_GRP_INVITATION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.GET_GRP_PENDENCY, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.DEL_GRP_SYSTEM_NOTICE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.DEL_GRP_SYSTEM_NOTICE) }), body: { messageListToDelete: void 0 }, keyMap: { req: { messageListToDelete: "DelMsgList", messageSeq: "MsgSeq", messageRandom: "MsgRandom" } } }), this._map.set(k.AV_POLLING, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.BIG_GRP_POLLING, ".").concat(k.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(k.AV_NOAUTH_POLLING, (e2.a2, e2.tinyid, { head: y(y({}, K(e2, _s)), {}, { servcmd: "".concat(a.NAME.BIG_GRP_POLLING_NO_AUTH, ".").concat(k.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(k.GET_ONLINE_MBR_NUM, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.GET_ONLINE_MBR_NUM) }), body: { groupID: void 0 }, keyMap: { res: { OnlineMemberNum: "memberCount" } } }), this._map.set(k.SET_GRP_ATTR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.MODIFY_GRP_ATTR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.DEL_GRP_ATTR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.CLEAR_GRP_ATTR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.CLEAR_GRP_ATTR) }), body: { groupID: void 0, mainSequence: void 0, avChatRoomKey: void 0, attributeControl: ["RaceConflict"] } }), this._map.set(k.GET_GRP_ATTR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_ATTR, ".").concat(k.GET_GRP_ATTR) }), body: { groupID: void 0, avChatRoomKey: void 0, groupType: 1 }, keyMap: { req: { avChatRoomKey: "Key", groupType: "GroupType" } } }), this._map.set(k.GET_GRP_NOTIFY, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.GET_GRP_NOTIFY) }), body: { notifyReqList: [] }, keyMap: { req: { notifyReqList: "NotifyReqList" }, res: { NextMsgTime: "nextRevokedTime", NotifyMsgList: "notifyList", NotifyRspList: "notifyRspList" } } }), this._map.set(k.UPDATE_GRP_COUNTER, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.UPDATE_GRP_COUNTER) }), body: { groupID: void 0, counterList: void 0, avChatRoomKey: void 0, mode: void 0 }, keyMap: { req: { counterList: "GroupCounter" } } }), this._map.set(k.GET_GRP_COUNTER, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.GET_GRP_COUNTER) }), body: { groupID: void 0, keyList: [], avChatRoomKey: void 0 }, keyMap: { req: { keyList: "GroupCounterKeys" } } }), this._map.set(k.CREATE_TOPIC, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_COMMUNITY, ".").concat(k.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(k.DEL_TOPIC, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_COMMUNITY, ".").concat(k.DEL_TOPIC) }), body: { groupID: void 0, topicIDList: void 0 }, keyMap: { req: { topicIDList: "TopicIdList" }, res: { DestroyResultItem: "resultList" } } }), this._map.set(k.UPDATE_TOPIC_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_COMMUNITY, ".").concat(k.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(k.GET_TOPIC_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_COMMUNITY, ".").concat(k.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(k.GET_GRP_MBR_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.GET_AV_MBR_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_AV, ".").concat(k.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(k.GET_GRP_MBR_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.ADD_GRP_MBR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.DEL_GRP_MBR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.DEL_GRP_MBR) }), body: { groupID: void 0, userIDList: void 0, reason: void 0 }, keyMap: { req: { userIDList: "MemberToDel_Account" } } }), this._map.set(k.BAN_AV_MBR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.MODIFY_GRP_MBR_INFO, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(k.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(k.MARK_AV_MBR_INFO, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_AV, ".").concat(k.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(k.SSO_STAT, { head: y(y({}, n2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STAT, ".").concat(k.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(k.PING, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.HEARTBEAT, ".").concat(k.PING) }), body: {} }), this._map.set(k.MSG_PUSH, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_PUSH, ".").concat(k.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(k.MULTI_MSG_PUSH, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_PUSH, ".").concat(k.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(k.MSG_PUSH_ACK, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(k.MSG_PUSH_ACK) }), body: { sessionData: void 0 }, keyMap: { req: { sessionData: "SessionData" } } }), this._map.set(k.STATUS_FORCE_OFFLINE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(k.STATUS_FORCE_OFFLINE) }), body: {}, keyMap: { res: { C2cNotifyMsgArray: "C2CNotifyMessageArray", NoticeSeq: "noticeSequence", KickoutMsgNotify: "kickoutMsgNotify", NewInstInfo: "newInstanceInfo" } } }), this._map.set(k.DOWNLOAD_MERGER_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_LONG_MSG, ".").concat(k.DOWNLOAD_MERGER_MSG) }), body: { downloadKey: "" }, keyMap: { res: { Data: "data", Desc: "description", Ext: "extension", Download_Flag: "downloadFlag", ThumbUUID: "thumbUUID", VideoUUID: "videoUUID" } } }), this._map.set(k.UPLOAD_MERGER_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_LONG_MSG, ".").concat(k.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(k.FOLLOW, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FOLLOW, ".").concat(k.FOLLOW) }), body: { fromAccount: "", userIDList: [] }, keyMap: { req: { userIDList: "FollowItem" }, res: { ResultItem: "resultList", To_Account: "userID" } } }), this._map.set(k.UNFOLLOW, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FOLLOW, ".").concat(k.UNFOLLOW) }), body: { fromAccount: "", userIDList: [] }, keyMap: { req: { userIDList: "To_Account" }, res: { ResultItem: "resultList", To_Account: "userID" } } }), this._map.set(k.GET_FOLLOW_INFO, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FOLLOW, ".").concat(k.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(k.GET_FOLLOW, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FOLLOW, ".").concat(k.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(k.CHECK_FOLLOW_TYPE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FOLLOW, ".").concat(k.CHECK_FOLLOW_TYPE) }), body: { fromAccount: "", userIDList: [] }, keyMap: { req: { userIDList: "To_Account" }, res: { ResultItem: "resultList", To_Account: "userID" } } }), this._map.set(k.SET_TOKEN, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(k.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(k.STAT_FOREGROUND, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(k.STAT_FOREGROUND) }), body: { isWebUniapp: 0 } }), this._map.set(k.STAT_BACKGROUND, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(k.STAT_BACKGROUND) }), body: { C2CUnread: 0, GroupUnread: 0, isWebUniapp: 0 }, keyMap: { req: { c2cUnreadCount: "C2cUnread", groupUnreadCount: "GrpUnread" } } }), this._map.set(k.PUSH_REPORT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OFFLINE_PUSH_REPORT, ".").concat(k.PUSH_REPORT) }), body: { eventList: [] }, keyMap: { req: { eventList: "UinappPushEvents", type: "EventType", time: "EventTime", pushId: "ClickExt" } } }), this._map.set(k.SET_ALL_RECEIVE_MSG_OPT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_MSG_LOGIC, ".").concat(k.SET_ALL_RECEIVE_MSG_OPT) }), body: { startTime: 0, endTime: 0, isRepeated: 0, messageRemindType: 0 }, keyMap: { req: { messageRemindType: "Level" } } }), this._map.set(k.GET_ALL_RECEIVE_MSG_OPT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_MSG_LOGIC, ".").concat(k.GET_ALL_RECEIVE_MSG_OPT) }), body: { toAccount: void 0 } }); } }, { key: "has", value: function(e2) { return this._map.has(e2); } }, { key: "get", value: function(e2) { return this._map.get(e2); } }, { key: "update", value: function() { this._fillMap(); } }, { key: "getKeyMap", value: function(e2) { return this.has(e2) ? this.get(e2).keyMap || {} : (M.w("".concat(this._n, ".getKeyMap unknown P:").concat(e2)), {}); } }, { key: "getProtocolData", value: function(e2) { var t2 = e2.P, n2 = e2.data, e2 = this.get(t2), t2 = null; if (n2) { var o2, i2 = this._simpleDeepCopy(e2), i2 = this._updateService(n2, i2), a2 = i2.body, s2 = /* @__PURE__ */ Object.create(null); for (o2 in a2) if (Object.prototype.hasOwnProperty.call(a2, o2)) { if (s2[o2] = a2[o2], void 0 === n2[o2]) continue; s2[o2] = n2[o2]; } i2.body = s2, t2 = this._getUplinkData(i2); } else t2 = this._getUplinkData(e2); return t2; } }, { key: "_getUplinkData", value: function(e2) { var e2 = this._dataCleaner(e2), t2 = Kt(e2.head), t2 = Qa(e2.body, this._getReqKeyMap(t2)); return e2.body = t2, e2; } }, { key: "_updateService", value: function(e2, t2) { var n2, o2, i2 = Kt(t2.head); return this._isFromGroupRequest(t2) && (n2 = e2.type, o2 = e2.groupID, e2 = void 0 === (e2 = e2.groupIDList) ? [] : e2, N(o2 = void 0 === o2 ? void 0 : o2) && (o2 = e2[0] || ""), Nt({ type: n2, groupID: o2 })) && (t2.head.servcmd = "".concat(a.NAME.GRP_COMMUNITY, ".").concat(i2)), t2; } }, { key: "_isFromGroupRequest", value: function(e2) { return e2.head.servcmd.includes(a.NAME.GRP) || e2.head.servcmd.includes(a.NAME.GRP_ATTR); } }, { key: "_getReqKeyMap", value: function(e2) { e2 = this.getKeyMap(e2); return y(y({}, Ba.req), e2.req); } }, { key: "_dataCleaner", value: function(e2) { var t2, n2 = Array.isArray(e2) ? [] : /* @__PURE__ */ Object.create(null); for (t2 in e2) Object.prototype.hasOwnProperty.call(e2, t2) && pt(t2) && null !== e2[t2] && void 0 !== e2[t2] && ("object" !== b(e2[t2]) ? n2[t2] = e2[t2] : n2[t2] = this._dataCleaner.bind(this)(e2[t2])); return n2; } }, { key: "_simpleDeepCopy", value: function(e2) { for (var t2, n2 = Object.keys(e2), o2 = {}, i2 = 0, a2 = n2.length; i2 < a2; i2++) t2 = n2[i2], O(e2[t2]) ? o2[t2] = Array.from(e2[t2]) : ut(e2[t2]) ? o2[t2] = this._simpleDeepCopy(e2[t2]) : o2[t2] = e2[t2]; return o2; } }]), Ts), gs = [k.MSG_PUSH_ACK], fs = (e(Cs, [{ key: "_onC2CMsgArray", value: function(e2) { var t2 = this._sessionM.get(6); e2.dataList.forEach(function(e3) { var t3; 1 === e3.isSyncMessage && (t3 = e3.from, e3.from = e3.to, e3.to = t3); }), 1 === e2.needSync && this._sessionM.get(19).syncOnNeed(), t2.onNewMessage({ dataList: e2.dataList, isInstantMessage: true }); } }, { key: "_onC2CMsgModified", value: function(e2) { this._sessionM.get(6).onMsgModified(e2); } }, { key: "_onGroupMsgArray", value: function(e2) { var t2 = this._sessionM.get(7); t2 && t2.onNewMessage({ event: e2.event, dataList: e2.dataList, isInstantMessage: true }); } }, { key: "_onGroupMsgModified", value: function(e2) { var t2 = this._sessionM.get(7); t2 && t2.onMsgModified(e2); } }, { key: "_onGroupTips", value: function(e2) { var t2 = this._sessionM.get(7); if (t2) { var n2 = e2.event, o2 = e2.dataList, i2 = e2.isInstantMessage, a2 = void 0 === i2 || i2, s2 = e2.isSyncingEnded; switch (n2) { case 4: case 6: t2.onNewGroupTips({ event: n2, dataList: o2 }); break; case 5: for (var r2 = 0; r2 < o2.length; r2++) if (O(o2[r2].elements.revokedInfos)) t2.onMsgRevoked({ dataList: o2 }); else if (O(o2[r2].elements.groupMessageReadNotice)) t2.onMsgReadNotice({ dataList: o2 }); else { if (!O(o2[r2].elements.readReceiptList)) { t2.onNewGroupSystemNotice({ dataList: o2, isInstantMessage: a2, isSyncingEnded: s2 }); break; } t2.onReadReceiptList({ dataList: o2 }); } break; case 12: this._sessionM.get(11).onNewGroupAtTips({ dataList: o2 }); break; default: M.l("".concat(this._n, "._onGroupTips unknown event:").concat(n2, " dataList:"), o2); } } } }, { key: "_onC2CNotifyMsgArray", value: function(e2) { var o2, i2 = this, a2 = e2.dataList; O(a2) && (o2 = this._sessionM.get(6), a2.forEach(function(e3) { var t2, n2; f(e3) && (e3.hasOwnProperty("kickoutMsgNotify") ? (t2 = (n2 = e3.kickoutMsgNotify).kickType, n2 = void 0 === (n2 = n2.newInstanceInfo) ? {} : n2, 1 === t2 ? i2._sessionM.onMultipleAccountKickedOut(n2) : 2 === t2 ? i2._sessionM.onMultipleDeviceKickedOut(n2) : 3 === t2 && i2._sessionM.onRestApiKickedOut(n2)) : e3.hasOwnProperty("c2cMessageRevokedNotify") ? o2 && o2.onMsgRevoked({ dataList: a2 }) : e3.hasOwnProperty("c2cMessageReadReceipt") ? o2 && o2.onMsgReadReceipt({ dataList: a2 }) : e3.hasOwnProperty("c2cMessageReadNotice") ? o2 && o2.onMsgReadNotice({ dataList: a2 }) : e3.hasOwnProperty("muteNotificationsSync") && i2._sessionM.get(11).onC2CMsgRemindTypeSynced({ dataList: a2 })); })); } }, { key: "_onC2CReadReceiptArray", value: function(e2) { this._sessionM.get(6).onReadReceiptList(e2); } }, { key: "_onProfileModified", value: function(e2) { this._sessionM.get(4).onProfileModified({ dataList: e2.dataList }); var t2 = this._sessionM.get(8); t2 && t2.onFriendProfileModified({ dataList: e2.dataList }); } }, { key: "_onRelationChainModified", value: function(e2) { this._sessionM.get(4).onRelationChainModified({ dataList: e2.dataList }); var t2 = this._sessionM.get(8); t2 && t2.onRelationChainModified({ dataList: e2.dataList }); } }, { key: "_onRecentContact", value: function(e2) { var i2, e2 = e2.dataList; O(e2) && (i2 = this._sessionM.get(11)) && e2.forEach(function(e3) { var t2, n2, o2 = e3.pushType; 1 === o2 ? (t2 = e3.recentContactDeleteItem, i2.onConvDeleted(t2.recentContactList)) : 2 === o2 ? (t2 = e3.recentContactTopItem, i2.onConvPinnedStatus(t2.recentContactList, true)) : 3 === o2 ? (t2 = e3.recentContactTopItem, i2.onConvPinnedStatus(t2.recentContactList, false)) : 4 === o2 ? (t2 = e3.recentContactMarkContact, i2.onConvMarkUpdated(t2.recentContactMarkContactItem)) : 5 === o2 ? (t2 = e3.recentContactCreateContactGroup, i2.onConvGroupCreated(t2.msgContactGroupContactItem)) : 6 === o2 ? (t2 = e3.recentContactDelContactGroup, i2.onConvGroupDeleted(t2.msgGroupItem)) : 7 === o2 && (o2 = (t2 = e3.recentContactUpdateContactGroup).updateType, e3 = t2.msgUpdateGroup, t2 = t2.msgUpdateContact, 1 === o2 ? 1 === (n2 = e3.updateGroupType) ? i2.onConvGroupNameUpdated(e3) : 2 === n2 && i2.onConvInGroupUpdated(e3) : 2 === o2 && i2.onConvAddedToOrDeletedFromGroup(t2)); }); } }, { key: "_onAllMsgRead", value: function(e2) { var e2 = e2.dataList, t2 = this._sessionM.get(11); t2 && t2.onPushedAllMessageRead(e2); } }, { key: "_onUserStatusList", value: function(e2) { this._sessionM.get(4).onUserStatusUpdated(e2); } }, { key: "_onMsgExtNotify", value: function(e2) { this._sessionM.get(3).onMsgExtNotify(e2); } }, { key: "_onMsgReactionNotifyList", value: function(e2) { this._sessionM.get(34).onReactionNotifyList(e2); } }, { key: "_onMsgReactionNotify", value: function(e2) { this._sessionM.get(34).onReactionNotify(e2); } }, { key: "_onFollowNotify", value: function(e2) { this._sessionM.get(35).onFollowNotify(e2); } }, { key: "_onTopicLatestMsg", value: function(e2) { this._sessionM.get(10).onTopicLatestMsg(e2); } }, { key: "onMessage", value: function(e2) { var t2 = this, n2 = e2.body; if (this._filterMsgFromIMOpenPush(e2)) { var o2, i2 = n2.eventArray, a2 = n2.isInstantMessage, s2 = n2.isSyncingEnded, r2 = n2.needSync; if (O(i2)) for (var c2, u2, l2, d2 = 0, p2 = i2.length; d2 < p2; d2++) 100 !== (l2 = (c2 = i2[d2]).event) ? 24 !== l2 ? 26 !== l2 ? (o2 = Object.keys(c2).find(function(e3) { return -1 !== t2._keys.indexOf(e3); })) ? (u2 = 14 === l2 ? { readAllC2CMessage: c2[o2], groupMessageReadInfoList: c2.groupMessageReadNotice || [] } : 16 === l2 ? { userID: c2.userID, timestamp: c2.timestamp, readReceiptList: c2[o2] } : c2[o2], this._eventHandlerMap.get(o2)({ event: l2, dataList: u2, isInstantMessage: a2, isSyncingEnded: s2, needSync: r2 })) : M.l("".concat(this._n, ".onMessage unknown eventItem:"), c2) : this._onTopicLatestMsg(c2) : this._onAllRcvMsgOptNotify(c2) : this._onRoomCustomData(c2.content); } } }, { key: "_onRoomCustomData", value: function(e2) { this._sessionM.get(30).onRoomCustomDataReceived(e2), M.l("".concat(this._n, "._onRoomCustomData data:").concat(e2)); } }, { key: "_onAllRcvMsgOptNotify", value: function(e2) { this._sessionM.get(11).onAllRcvMsgOptNotify(e2); } }, { key: "_filterMsgFromIMOpenPush", value: function(e2) { var t2 = e2.head, e2 = e2.body, t2 = t2.servcmd, n2 = false; return !(n2 = N(t2) ? n2 : t2.includes(a.NAME.IM_CONFIG_MANAGER) || t2.includes(a.NAME.OVERLOAD_PUSH) || t2.includes(a.NAME.STAT_SERVICE)) || (t2.includes(k.PUSHED_CLOUD_CTRL_CONFIG) ? this._sessionM.get(23).onPushedConfig(e2) : t2.includes(k.PUSHED_COMMERCIAL_CONFIG) ? this._sessionM.get(27).onPushedConfig(e2) : t2.includes(k.OVERLOAD_NOTIFY) ? this._sessionM.onPushedServerOverload(e2) : t2.includes(k.KICK_OTHER) && (n2 = Date.now(), this._sessionM.reLoginOnKickOther(), e2 = new G("kickOther"), n2 = n2 - (t2 = this._sessionM.get(1).getLastWsHelloTs()), e2.setMessage("last wshello time:".concat(t2, " diff:").concat(n2, "ms")).end()), false); } }]), Cs), ms = [{ cmd: k.GET_GRP_PROFILE, interval: 1, count: 8 }, { cmd: k.UPDATE_GRP_PROFILE, interval: 1, count: 8 }, { cmd: k.GET_AV_MBR_LIST, interval: 3, count: 1 }, { cmd: k.GET_GRP_PENDENCY, interval: 1, count: 15 }, { cmd: k.GET_TOPIC_LIST, interval: 1, count: 10 }, { cmd: k.SET_GRP_ATTR, interval: 5, count: 10 }, { cmd: k.MODIFY_GRP_ATTR, interval: 5, count: 10 }, { cmd: k.DEL_GRP_ATTR, interval: 5, count: 10 }, { cmd: k.CLEAR_GRP_ATTR, interval: 5, count: 10 }, { cmd: k.GET_GRP_ATTR, interval: 5, count: 20 }, { cmd: k.UPDATE_GRP_COUNTER, interval: 5, count: 20 }, { cmd: k.GET_GRP_COUNTER, interval: 5, count: 20 }, { cmd: k.SET_ALL_MSG_READ, interval: 1, count: 1 }, { cmd: k.GET_USER_STATUS, interval: 5, count: 20 }, { cmd: k.SUB_USER_STATUS, interval: 5, count: 20 }, { cmd: k.UNSUB_USER_STATUS, interval: 5, count: 20 }, { cmd: k.MSG_CLOUD_SEARCH, interval: 1, count: 2 }, { cmd: k.CHECK_FOLLOW_TYPE, interval: 5, count: 20 }, { cmd: k.GET_GRP_ROAMING_MSG, interval: 1, count: 20 }, { cmd: k.GET_C2C_ROAMING_MSG, interval: 1, count: 20 }], vs = /* @__PURE__ */ new Map(), Is = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"], Ms = 0, ys = Is.length; Ms < ys; Ms++) vs.set(Ms, Is[Ms]); function Cs(e2) { d(this, Cs), this._sessionM = e2, this._n = "MsgDispatcher", this._eventHandlerMap = /* @__PURE__ */ new Map(), this._eventHandlerMap.set("C2CMessageArray", this._onC2CMsgArray.bind(this)), this._eventHandlerMap.set("groupMessageArray", this._onGroupMsgArray.bind(this)), this._eventHandlerMap.set("groupTips", this._onGroupTips.bind(this)), this._eventHandlerMap.set("C2CNotifyMessageArray", this._onC2CNotifyMsgArray.bind(this)), this._eventHandlerMap.set("C2CReadReceiptArray", this._onC2CReadReceiptArray.bind(this)), this._eventHandlerMap.set("profileModify", this._onProfileModified.bind(this)), this._eventHandlerMap.set("friendListMod", this._onRelationChainModified.bind(this)), this._eventHandlerMap.set("recentContactMod", this._onRecentContact.bind(this)), this._eventHandlerMap.set("readAllC2CMessage", this._onAllMsgRead.bind(this)), this._eventHandlerMap.set("c2cMessageModified", this._onC2CMsgModified.bind(this)), this._eventHandlerMap.set("groupMessageModified", this._onGroupMsgModified.bind(this)), this._eventHandlerMap.set("userStatusList", this._onUserStatusList.bind(this)), this._eventHandlerMap.set("messageExtensionNotify", this._onMsgExtNotify.bind(this)), this._eventHandlerMap.set("messageReactionNotifyList", this._onMsgReactionNotifyList.bind(this)), this._eventHandlerMap.set("messageReactionNotify", this._onMsgReactionNotify.bind(this)), this._eventHandlerMap.set("followChangeList", this._onFollowNotify.bind(this)), this._keys = p(this._eventHandlerMap.keys()); } function Ts(e2) { d(this, Ts), this._n = "PHandler", this._sessionM = e2, this._map = /* @__PURE__ */ new Map(), this._fillMap(); } function Ds(e2) { return d(this, Ds), (e2 = $a.call(this, e2))._n = "ChannelModule", e2._socketHandler = new us(i(e2)), e2._probing = false, e2._isAppShowing = true, e2._previousState = A.NET_STATE_CONNECTED, e2._timerForNotLoggedIn = -1, e2._timerForNotLoggedIn = setInterval(e2.onCheckTimer.bind(i(e2)), 1e3), e2._fatalErrorFlag = false, e2._disconnectedTS = 0, e2._lastDiagnoseTS = 0, e2; } function Es(e2) { d(this, Es), this._chM = e2, this._n = "SocketHandler", this._promiseMap = /* @__PURE__ */ new Map(), this._readyState = cs, this._simpleRequestMap = /* @__PURE__ */ new Map(), this.MAX_SIZE = 100, this._startSequence = ft(), this._startTs = 0, this._reConnectFlag = false, 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 = true, this._isWorkerEnabled = true, this._currentSite = se, this._setWebsocketHost(), this._initConnection(); } function Ls(e2) { d(this, Ls); var t2, i2, n2 = (this._handler = e2).getURL(); this._socket = null, this._workerSocket = null, this._id = ft(), this._handler.getIsWorkerEnabled() ? (t2 = URL.createObjectURL(new Blob([';let _socket = null;onmessage = function(event) { if (event.data.cmd === "start") { const url = event.data.url; _socket = new WebSocket(url); _socket.binaryType = "arraybuffer"; _socket.onopen = function() { postMessage({ callback: "onOpen", extensions: _socket.extensions }); }; _socket.onclose = function(e) { postMessage({ callback: "onOpen", e: { code: e.code, reason: e.reason } }); }; _socket.onmessage = function(e) { postMessage({ callback: "onMessage", data: e.data }); }; _socket.onerror = function(e) { postMessage({ callback: "onError", e: { isTrusted: "true" } }); }; } else if (event.data.cmd === "sendMessage") { if (_socket !== null) { _socket.send(event.data.data); } } else if (event.data.cmd === "stop") { if (_socket !== null) { _socket.close(event.data.code); _socket = null; } }};'], { type: "application/javascript; charset=utf-8" })), this._workerSocket = new Worker(t2), (i2 = this)._workerSocket.onmessage = function(e3) { var t3 = e3.data, n3 = t3.callback, o2 = t3.e, t3 = t3.extensions; "onOpen" === n3 ? i2._onOpen(t3) : "onClose" === n3 ? i2._onClose(o2) : "onError" === n3 ? i2._onError(o2) : "onMessage" === n3 && i2._onMessage(e3.data); }, this._workerSocket.postMessage({ cmd: "start", id: this._id, url: n2 })) : v ? ve ? (I.connectSocket({ url: n2, header: { "content-type": "application/json" } }), I.onSocketClose(this._onClose.bind(this)), I.onSocketOpen(this._onOpen.bind(this)), I.onSocketMessage(this._onMessage.bind(this)), I.onSocketError(this._onError.bind(this))) : (this._socket = I.connectSocket({ url: n2, header: { "content-type": "application/json" }, complete: function() { } }), this._socket.onClose(this._onClose.bind(this)), this._socket.onOpen(this._onOpen.bind(this)), this._socket.onMessage(this._onMessage.bind(this)), this._socket.onError(this._onError.bind(this))) : (this._socket = new WebSocket(n2), 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 = e2.canIUseBinaryFrame(); } function Ss(e2) { for (var t2, n2, o2 = e2, i2 = "", a2 = 0, s2 = (o2 = e2.length % 8 != 0 ? "0".repeat(8 - e2.length % 8) + e2 : o2).length; a2 < s2; a2 += 8) t2 = parseInt(o2.slice(a2, a2 + 4), 2), n2 = parseInt(o2.slice(a2 + 4, a2 + 8), 2), i2 += vs.get(t2) + vs.get(n2); return i2; } function ks(e2) { var t2; return e2 < 0 || 53 < e2 ? NaN : (t2 = 0 | 1073741824 * Math.random(), 30 < e2 ? t2 + 1073741824 * (0 | Math.random() * (1 << e2 - 30)) : t2 >>> 30 - e2); } function As(e2, t2) { for (var n2 = e2.toString(16), o2 = t2 - n2.length, i2 = "0"; 0 < o2; o2 >>>= 1, i2 += i2) 1 & o2 && (n2 = i2 + n2); return n2; } t(Wr, u), xs = n(Wr), e(Wr, [{ key: "_init", value: function() { this._updateCmdFreqLimitMap(ms); } }, { key: "_onCloudConfig", value: function() { var e2 = this.getCloudConfig("cmd_frequency_limit"); N(e2) || (e2 = JSON.parse(e2), this._updateCmdFreqLimitMap(e2)); } }, { key: "_updateCmdFreqLimitMap", value: function(e2) { var t2 = this; e2.forEach(function(e3) { t2._cmdFreqLimitMap.set(e3.cmd, { interval: e3.interval, count: e3.count }); }); } }, { key: "updateProtocolConfig", value: function() { this._pHandler.update(); } }, { key: "req", value: function(e2) { M.d("".concat(this._n, ".req options:"), e2); var t2, n2, o2 = e2.P; return this._pHandler.has(o2) ? (t2 = (e2 = this.getProtocolData(e2)).head.servcmd, this._isFreqOverLimit(t2) ? D({ code: n2 = L.OVER_FREQUENCY_LIMIT, message: this.getErrMsg(n2, this._getCmd(t2)) }) : this._isServerOverload(t2) ? D({ code: n2 = L.OPEN_SERVICE_OVERLOAD_ERROR, message: this.getErrMsg(n2, this._getCmd(t2)) }) : (n2 = this.get(21), gs.includes(o2) ? n2.simplySend(e2) : n2.send(e2))) : (M.w("".concat(this._n, ".req unknown P:").concat(o2)), D({ code: L.NO_PROTOCOL })); } }, { key: "getKeyMap", value: function(e2) { return this._pHandler.getKeyMap(e2); } }, { key: "genCommonHead", value: function() { var e2 = this.get(12); return { ver: "v4", platform: this._platform, websdkappid: ae, websdkversion: oe, a2: e2.getA2Key() || void 0, tinyid: e2.getTinyID() || void 0, status_instid: e2.getStatusInstanceID(), sdkappid: e2.getSDKAppID(), contenttype: e2.getContentType(), reqtime: 0, identifier: e2.getA2Key() ? void 0 : e2.getUserID(), usersig: e2.getA2Key() ? void 0 : e2.getUserSig(), sdkability: 12775283, sdkability_ext: Ss(""), cappid: e2.getApplicationID() }; } }, { key: "genCosSpecifiedHead", value: function() { var e2 = this.get(12); return { ver: "v4", platform: this._platform, websdkappid: ae, websdkversion: oe, sdkappid: e2.getSDKAppID(), contenttype: e2.getContentType(), reqtime: 0, identifier: e2.getUserID(), usersig: e2.getUserSig(), status_instid: e2.getStatusInstanceID(), sdkability: 12775283, sdkability_ext: Ss(""), cappid: e2.getApplicationID() }; } }, { key: "genSSOReportHead", value: function() { var e2 = this.get(12); return { ver: "v4", platform: this._platform, websdkappid: ae, websdkversion: oe, sdkappid: e2.getSDKAppID(), contenttype: "", reqtime: 0, identifier: "", usersig: "", status_instid: e2.getStatusInstanceID(), sdkability: 12775283, sdkability_ext: Ss(""), cappid: e2.getApplicationID() }; } }, { key: "getProtocolData", value: function(e2) { return this._pHandler.getProtocolData(e2); } }, { key: "trans", value: function(e2) { var t2 = e2.servcmd, e2 = e2.data, t2 = { head: y(y({}, this.genCommonHead()), {}, { servcmd: t2 }), body: e2 }; return this.get(21).send(t2); } }, { key: "sendComboMessage", value: function(e2) { var t2 = e2.servcmd, e2 = e2.data, t2 = { head: y(y({}, this.genCommonHead()), {}, { servcmd: t2 }), body: e2 }; return this.get(21).send(t2); } }, { key: "onErrorCodeNotZero", value: function(e2) { var t2, n2 = e2.errorCode; n2 === L.HELLO_ANSWER_KICKED_OUT && (t2 = e2.kickType, e2 = void 0 === (e2 = e2.newInstanceInfo) ? {} : e2, 1 === t2 ? this.onMultipleAccountKickedOut(e2) : 2 === t2 ? this.onMultipleDeviceKickedOut(e2) : 3 === t2 && this.onRestApiKickedOut(e2)), n2 !== L.MSG_A2KEY_EXPIRED && n2 !== L.ACCOUNT_A2KEY_EXPIRED || (this._onUserSigExpired(), this.get(21).reConnect()); } }, { key: "onMessage", value: function(e2) { var t2 = e2.body, n2 = t2.needAck, t2 = t2.sessionData; 1 === (void 0 === n2 ? 0 : n2) && this._sendACK(t2), this._msgDispatcher.onMessage(e2); } }, { key: "onReconnected", value: function(e2) { this._incrementalPullContactFlag = e2 <= 300, this._reLoginOnReconnected(); } }, { key: "reLoginOnKickOther", value: function() { M.l("".concat(this._n, ".reLoginOnKickOther")), this._reLogin(); } }, { key: "_reLoginOnReconnected", value: function() { M.l("".concat(this._n, "._reLoginOnReconnected")), this._reLogin(); } }, { key: "_reLogin", value: function() { var e2, t2, s2, r2 = this, c2 = "".concat(this._n, "._reLogin"); this.isLoggedIn() && (e2 = 0, (t2 = this.get(1).getPushModule()) && (e2 = t2.getUniAppPlatform()), s2 = new G("reLogin"), this.req({ P: k.LOGIN, data: { isWebUniapp: e2, customInfo: this.get(12).getCustomLoginInfo() } }).then(function(e3) { var e3 = e3.data, t3 = e3.instanceID, e3 = e3.customStatus, n2 = r2.get(12), o2 = Wo(e3), i2 = (n2.setStatusInstanceID(t3), r2.get(21)), a2 = i2.getSocketID(), a2 = "socketID:".concat(a2, " instanceID:").concat(t3, " customStatus:").concat(o2), t3 = (s2.setMessage(a2).end(true), M.l("".concat(c2, " ok. ").concat(a2)), n2.getCustomStatus() !== o2 && r2.get(4).onUserStatusUpdated({ dataList: [{ to: r2.getMyUserID(), statusType: A.USER_STATUS_ONLINE, customStatus: e3 }] }), i2.diagnose(), r2.get(11).syncConvList(r2._incrementalPullContactFlag).then(function() { M.l("".concat(c2, ", sync conv list ok.")), r2.get(25).start(); }), r2.get(7)), a2 = (t3 && t3.updateLocalMainSequenceOnReconnected(), r2.get(10)), n2 = (a2.resetGetTopicTime(), a2.getTopicListOnReconnected(), r2.get(35)); n2 && n2.clearCacheOnReconnected(); })); } }, { key: "onMultipleAccountKickedOut", value: function(e2) { this.get(1).onMultipleAccountKickedOut(e2); } }, { key: "onMultipleDeviceKickedOut", value: function(e2) { this.get(1).onMultipleDeviceKickedOut(e2); } }, { key: "_onUserSigExpired", value: function() { this.get(1).onUserSigExpired(); } }, { key: "onRestApiKickedOut", value: function(e2) { this.get(1).onRestApiKickedOut(e2); } }, { key: "_sendACK", value: function(e2) { this.req({ P: k.MSG_PUSH_ACK, data: { sessionData: e2 } }); } }, { key: "_isFreqOverLimit", value: function(e2) { var t2, n2, o2, i2, e2 = e2.split(".")[1]; return !!this._cmdFreqLimitMap.has(e2) && (!this._cmdReqInfoMap.has(e2) || (t2 = (n2 = this._cmdFreqLimitMap.get(e2)).count, n2 = n2.interval, o2 = (i2 = this._cmdReqInfoMap.get(e2)).startTime, i2 = i2.requestCount, Date.now() - o2 > 1e3 * n2) ? (this._cmdReqInfoMap.set(e2, { startTime: Date.now(), requestCount: 1 }), false) : (this._cmdReqInfoMap.set(e2, { startTime: o2, requestCount: i2 += 1 }), t2 < i2)); } }, { key: "_isServerOverload", value: function(e2) { var t2, n2; return !!this._serverOverloadInfoMap.has(e2) && (t2 = (n2 = this._serverOverloadInfoMap.get(e2)).overloadTime, n2 = n2.waitingTime, Date.now() - t2 <= 1e3 * n2 || (this._serverOverloadInfoMap.delete(e2), false)); } }, { key: "_getCmd", value: function(e2) { var t2 = ""; if (e2.includes(".")) { var n2, o2 = e2.split(".")[1]; for (n2 in k) if (k[n2] === o2) { t2 = n2; break; } } return t2; } }, { key: "onPushedServerOverload", value: function(e2) { var t2 = e2.overloadCommand, e2 = e2.waitingTime; this._serverOverloadInfoMap.set(t2, { overloadTime: Date.now(), waitingTime: e2 }), M.w("".concat(this._n, ".onPushedServerOverload waitingTime:").concat(e2, "s cmd:").concat(this._getCmd(t2))); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._updateCmdFreqLimitMap(ms), this._cmdReqInfoMap.clear(), this._serverOverloadInfoMap.clear(), this._incrementalPullContactFlag = true; } }]); var Rs, Os, Ns, Gs, Ps, Us, bs, ws, Fs, qs, xs, Vs = Wr, Hs = (t(Yr, u), qs = n(Yr), e(Yr, [{ key: "getCloudConfig", value: function(e2) { return N(e2) ? this._cloudConfig : this._cloudConfig.has(e2) ? this._cloudConfig.get(e2) : void 0; } }, { key: "getServerConfig", value: function(e2) { var t2 = { code: 0, data: "" }; return !N(e2) && this._cloudConfig.has(e2) && (t2.data = this._cloudConfig.get(e2)), Promise.resolve(t2); } }, { key: "_canFetch", value: function() { return this.isLoggedIn() && !this._isFetching && Date.now() >= this._expiredTime; } }, { key: "fetchConfig", value: function() { var o2, i2 = this, a2 = "".concat(this._n, ".fetchConfig"), e2 = this._canFetch(); M.l("".concat(a2, " canFetch:").concat(e2)), e2 && (o2 = new G("fetchCloudCtrlConfig"), e2 = this.get(12).getSDKAppID(), this._isFetching = true, this.req({ P: k.FETCH_CLOUD_CTRL_CONFIG, data: { SDKAppID: e2, version: this._version } }).then(function(e3) { i2._isFetching = false; var t2 = e3.data, n2 = t2.version, t2 = t2.cloudControlConfig; o2.setMessage("version:".concat(i2._version, " newVersion:").concat(n2, " config:").concat(t2)).end(), M.l("".concat(a2, " ok")), i2._parse(e3.data); }).catch(function(e3) { i2._isFetching = false, o2.setError(e3).end(), M.l("".concat(a2, " failed. error:"), e3), i2._setExpiredTime(12e4); })); } }, { key: "onPushedConfig", value: function(e2) { M.l("".concat(this._n, ".onPushedConfig config:"), e2), new G("pushedCloudCtrlConfig").setMessage("newVersion:".concat(e2.version, " config:").concat(e2.cloudControlConfig)).end(), this._parse(e2); } }, { key: "onCheckTimer", value: function(e2) { this._canFetch() && this.fetchConfig(); } }, { key: "_parse", value: function(e2) { var t2 = this, n2 = "".concat(this._n, "._parse"), o2 = e2.errorCode, i2 = e2.errorMessage, a2 = e2.cloudControlConfig, s2 = e2.version, r2 = e2.expiredTime; if (0 === o2) { if (this._version !== s2) { var c2 = null; try { c2 = JSON.parse(a2); } catch (e3) { this.isPrivateNetWork() || M.e("".concat(n2, " failed. config:"), a2); } c2 && (this._cloudConfig.clear(), Object.keys(c2).forEach(function(e3) { t2._cloudConfig.set(e3, c2[e3]); }), this._version = s2, this.emitIEvt(P.CLOUD_CONFIG)); } this._setExpiredTime(1e3 * r2); } else N(o2) ? (M.l("".concat(n2, " failed. Invalid message format:"), e2), this._setExpiredTime(36e5)) : (M.e("".concat(n2, " errorCode:").concat(o2, " errorMessage:").concat(i2)), this._setExpiredTime(12e4)); } }, { key: "_setExpiredTime", value: function(e2) { this._expiredTime = Date.now() + e2; } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._cloudConfig.clear(), this._expiredTime = 0, this._version = 0, this._isFetching = false; } }]), Yr), Bs = (t(Kr, u), Fs = n(Kr), e(Kr, [{ key: "start", value: function() { this._recoverGroupChat(), this._recoverC2CChat(); } }, { key: "_recoverGroupChat", value: function() { var n2, o2, i2, a2, s2 = this, e2 = this._getLocalConvList().filter(function(e3) { return e3.type === A.CONV_GROUP && e3.groupProfile.type !== A.GRP_AVCHATROOM; }), r2 = this.get(11), c2 = []; e2.forEach(function(e3) { var t2 = e3.conversationID, e3 = e3.lastMessage; n2 = t2.replace(A.CONV_GROUP, ""), o2 = r2.getLocalLastMessage(t2), e3 && 0 !== e3.lastSequence && o2 && (i2 = e3.lastSequence, o2 = o2.sequence, a2 = i2 - o2, 0 < o2) && 1 <= a2 && a2 < 300 ? s2._recoverGroupMsg({ groupID: n2, localLastMessageSequence: o2, remoteLastMessageSequence: i2 }) : c2.push(n2); }), this._getGroupNotice(c2); } }, { key: "_recoverC2CChat", value: function() { var n2, o2, i2, a2 = this, e2 = this._getLocalConvList().filter(function(e3) { return e3.type === A.CONV_C2C; }), s2 = this.get(11), r2 = [Promise.resolve()]; e2.forEach(function(e3) { var t2 = e3.conversationID, e3 = e3.lastMessage; n2 = s2.getLocalLastMessage(t2), e3 && 0 !== e3.lastTime && n2 && (o2 = e3.lastTime, n2 = n2.time, i2 = o2 - n2, 0 < n2) && 1 <= i2 && i2 <= 600 && r2.push(a2._recoverC2CMsg({ conversationID: t2, localLastMessageTime: n2, remoteLastMessageTime: o2 })); }), Promise.all(r2).then(function() { M.l("".concat(a2._n, "._recoverC2CChat all done")), a2.get(19).syncOnReconnected(); }); } }, { key: "_getLocalConvList", value: function() { return this.get(11).getLocalConvList(); } }, { key: "_recoverGroupMsg", value: function(e2) { var d2 = this, p2 = "".concat(this._n, ".").concat("_recoverGroupMsg"), _2 = (M.l("".concat(p2, " options:"), e2), e2.groupID), h2 = e2.localLastMessageSequence, g2 = e2.remoteLastMessageSequence, f2 = JSON.stringify(e2), m2 = new G("_recoverGroupMsg"); m2.setMessage(f2), this._getGroupRoamingMsg({ groupID: _2, sequence: h2 }).then(function(e3) { var e3 = e3.data, t2 = e3.complete, n2 = e3.messageList; if (!N(n2)) { var e3 = n2[0].sequence, o2 = n2.map(function(e4) { return e4.sequence; }), o2 = "".concat(f2, " complete:").concat(t2, " sequenceList:").concat(o2), i2 = (M.l("".concat(p2, " ").concat(o2)), e3 !== h2 && e3 < g2 && 2 !== t2 && d2._recoverGroupMsg({ groupID: _2, localLastMessageSequence: e3, remoteLastMessageSequence: g2 }), m2.setMessage(o2).end(), d2.get(7)); 1 < n2.length && n2.sort(function(e4, t3) { return e4.sequence - t3.sequence; }); for (var a2 = false, s2 = 0, r2 = n2.length; s2 < r2; s2++) if (n2[s2].from === A.CONV_SYSTEM) { a2 = true; break; } if (a2) for (var c2 = 0, u2 = n2.length; c2 < u2; c2++) { var l2 = n2[c2]; l2.from !== A.CONV_SYSTEM ? i2.onNewMessage({ dataList: [l2], isInstantMessage: false, updateUnreadCount: false }) : i2.onNewGroupTips({ event: l2.event, dataList: [l2] }); } else i2.onNewMessage({ dataList: n2, isInstantMessage: false, updateUnreadCount: false }); } }).catch(function(e3) { m2.setError(e3).end(), M.w("".concat(p2, " failed. error:"), e3); }); } }, { key: "_getGroupNotice", value: function(e2) { var t2 = e2.length; if (M.l("".concat(this._n, "._getGroupNotice length:").concat(t2)), 0 !== t2) { var n2 = this.get(7); if (t2 <= 10) n2.getNotice(e2); else { var o2 = Math.floor(t2 / 10); 5 <= o2 && (o2 = 5); for (var i2 = 0; i2 <= o2; i2++) n2.getNotice(e2.slice(10 * i2, 10 * (i2 + 1))); } } } }, { key: "_getGroupRoamingMsg", value: function(e2) { var t2 = e2.groupID, e2 = e2.sequence; return this.req({ P: k.GET_GRP_ROAMING_MSG, data: { groupID: t2, count: this.PULL_LIMIT_COUNT, sequence: e2 + this.PULL_LIMIT_COUNT - 1 } }); } }, { key: "_recoverC2CMsg", value: function(e2) { var o2 = this, i2 = "".concat(this._n, ".").concat("_recoverC2CMsg"), a2 = (M.l("".concat(i2, " options:"), e2), e2.conversationID), t2 = e2.localLastMessageTime, s2 = e2.remoteLastMessageTime, r2 = JSON.stringify(e2), c2 = new G("_recoverC2CMsg"); return c2.setMessage(r2), this._getC2CRoamingMsg({ conversationID: a2, time: t2 }).then(function(e3) { var e3 = e3.data, t3 = e3.complete, e3 = e3.messageList; if (!N(e3)) { var n2 = e3.length, n2 = (o2.get(6).onNewMessage({ dataList: e3, isInstantMessage: true }), e3[n2 - 1].time), e3 = e3.map(function(e4) { return e4.random; }), e3 = "".concat(r2, " complete:").concat(t3, " randomList:").concat(e3); if (M.l("".concat(i2, " ").concat(e3)), c2.setMessage(e3).end(), n2 < s2 && 1 !== t3) return o2._recoverC2CMsg({ conversationID: a2, localLastMessageTime: n2, remoteLastMessageTime: s2 }); } }).catch(function(e3) { c2.setError(e3).end(), M.w("".concat(i2, " failed. error:"), e3); }); } }, { key: "_getC2CRoamingMsg", value: function(e2) { var t2 = e2.conversationID, e2 = e2.time; return this.req({ P: k.GET_C2C_ROAMING_MSG, data: { peerAccount: t2.replace(A.CONV_C2C, ""), count: this.PULL_LIMIT_COUNT + 1, lastMessageTime: e2, direction: 1 } }); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")); } }]), Kr), Ks = (e(Br, [{ key: "addMessageDelay", value: function(e2) { e2 = Be() - e2; 0 <= e2 && this._e2eDelayArray.push(e2); } }, { key: "_calcAvg", value: function(e2, t2) { var n2; return 0 === t2 ? 0 : (n2 = 0, e2.forEach(function(e3) { n2 += e3; }), Yt(n2 / t2, 1)); } }, { key: "_calcCountWithLimit", value: function(e2) { var t2 = e2.e2eDelayArray, n2 = e2.min, o2 = e2.max; return t2.filter(function(e3) { return n2 <= e3 && e3 < o2; }).length; } }, { key: "_calcPercent", value: function(e2, t2) { e2 = Yt(e2 / t2 * 100, 2); return e2 = 100 < e2 ? 100 : e2; } }, { key: "_checkE2EDelayException", value: function(e2, t2) { var n2, o2, i2, a2 = e2.filter(function(e3) { return t2 < e3; }); 0 < a2.length && (n2 = a2.length, o2 = Math.min.apply(Math, p(a2)), i2 = Math.max.apply(Math, p(a2)), a2 = this._calcAvg(a2, n2), 50 < (e2 = Yt(n2 / e2.length * 100, 2))) && new G("messageE2EDelayException").setMessage("count:".concat(n2, " min:").concat(o2, " max:").concat(i2, " avg:").concat(a2, " percent:").concat(e2)).setLevel("warning").end(); } }, { key: "getStatResult", value: function() { var e2, t2, n2, o2, i2, a2, s2 = this._e2eDelayArray.length; return 0 === s2 ? null : (e2 = p(this._e2eDelayArray), t2 = this._calcCountWithLimit({ e2eDelayArray: e2, min: 0, max: 1 }), n2 = this._calcCountWithLimit({ e2eDelayArray: e2, min: 1, max: 3 }), o2 = this._calcPercent(t2, s2), i2 = this._calcPercent(n2, s2), a2 = this._calcAvg(e2, s2), this._checkE2EDelayException(e2, 3), e2.length = 0, this.reset(), { totalCount: s2, countLessThan1Second: t2, percentOfCountLessThan1Second: o2, countLessThan3Second: n2, percentOfCountLessThan3Second: i2, avgDelay: a2 }); } }, { key: "reset", value: function() { this._e2eDelayArray.length = 0; } }]), Br), Ys = (e(Hr, [{ key: "addRequestCount", value: function() { this._requestCount += 1; } }, { key: "addRTT", value: function(e2) { this._rttArray.push(e2); } }, { key: "_calcTotalCount", value: function() { return this._requestCount; } }, { key: "_calcRTTCount", value: function(e2) { return e2.length; } }, { key: "_calcSuccessRateOfRequest", value: function(e2, t2) { return 0 === t2 ? 0 : 100 < (e2 = Yt(e2 / t2 * 100, 2)) ? 100 : e2; } }, { key: "_calcAvg", value: function(e2, t2) { var n2; return 0 === t2 ? 0 : (n2 = 0, e2.forEach(function(e3) { n2 += e3; }), parseInt(n2 / t2)); } }, { key: "_calcMax", value: function() { return Math.max.apply(Math, p(this._rttArray)); } }, { key: "_calcMin", value: function() { return Math.min.apply(Math, p(this._rttArray)); } }, { key: "getStatResult", value: function() { var e2, t2, n2 = this._calcTotalCount(), o2 = p(this._rttArray); return 0 === n2 ? null : (e2 = this._calcRTTCount(o2), t2 = this._calcSuccessRateOfRequest(e2, n2), o2 = this._calcAvg(o2, e2), M.l("".concat(this._n, ".getStatResult max:").concat(this._calcMax(), " min:").concat(this._calcMin(), " avg:").concat(o2)), this.reset(), { totalCount: n2, rttCount: e2, successRateOfRequest: t2, avgRTT: o2 }); } }, { key: "reset", value: function() { this._requestCount = 0, this._rttArray.length = 0; } }]), Hr), Ws = (e(Vr, [{ key: "initMap", value: function(e2) { var t2 = this; e2.forEach(function(e3) { t2._map.set(e3, { totalCount: 0, successCount: 0, failedCountOfUserSide: 0, costArray: [], fileSizeArray: [] }); }); } }, { key: "addTotalCount", value: function(e2) { return !(N(e2) || !this._map.has(e2) || (this._map.get(e2).totalCount += 1, 0)); } }, { key: "addSuccessCount", value: function(e2) { return !(N(e2) || !this._map.has(e2) || (this._map.get(e2).successCount += 1, 0)); } }, { key: "addFailedCountOfUserSide", value: function(e2) { return !(N(e2) || !this._map.has(e2) || (this._map.get(e2).failedCountOfUserSide += 1, 0)); } }, { key: "addCost", value: function(e2, t2) { return !(N(e2) || !this._map.has(e2) || (this._map.get(e2).costArray.push(t2), 0)); } }, { key: "addFileSize", value: function(e2, t2) { return !(N(e2) || !this._map.has(e2) || (this._map.get(e2).fileSizeArray.push(t2), 0)); } }, { key: "_calcSuccessRateOfBusiness", value: function(e2) { return N(e2) || !this._map.has(e2) ? -1 : 100 < (e2 = Yt((e2 = this._map.get(e2)).successCount / e2.totalCount * 100, 2)) ? 100 : e2; } }, { key: "_calcSuccessRateOfPlatform", value: function(e2) { var t2; return N(e2) || !this._map.has(e2) ? -1 : (t2 = this._map.get(e2), 100 < (e2 = Yt(e2 = this._calcSuccessCountOfPlatform(e2) / t2.totalCount * 100, 2)) ? 100 : e2); } }, { key: "_calcTotalCount", value: function(e2) { return N(e2) || !this._map.has(e2) ? -1 : this._map.get(e2).totalCount; } }, { key: "_calcSuccessCountOfBusiness", value: function(e2) { return N(e2) || !this._map.has(e2) ? -1 : this._map.get(e2).successCount; } }, { key: "_calcSuccessCountOfPlatform", value: function(e2) { return N(e2) || !this._map.has(e2) ? -1 : (e2 = this._map.get(e2)).successCount + e2.failedCountOfUserSide; } }, { key: "_calcAvg", value: function(e2) { return N(e2) || !this._map.has(e2) ? -1 : e2 === Wn ? this._calcAvgSpeed(e2) : this._calcAvgCost(e2); } }, { key: "_calcAvgCost", value: function(e2) { var t2, n2 = this._map.get(e2).costArray.length; return 0 === n2 ? 0 : (t2 = 0, this._map.get(e2).costArray.forEach(function(e3) { t2 += e3; }), parseInt(t2 / n2)); } }, { key: "_calcAvgSpeed", value: function(e2) { var t2 = 0, n2 = 0; return this._map.get(e2).costArray.forEach(function(e3) { t2 += e3; }), this._map.get(e2).fileSizeArray.forEach(function(e3) { n2 += e3; }), parseInt(1e3 * n2 / t2); } }, { key: "getStatResult", value: function(e2) { var t2, n2, o2, i2, a2, s2 = this._calcTotalCount(e2); return 0 === s2 ? null : (t2 = this._calcSuccessCountOfBusiness(e2), n2 = this._calcSuccessRateOfBusiness(e2), o2 = this._calcSuccessCountOfPlatform(e2), i2 = this._calcSuccessRateOfPlatform(e2), a2 = this._calcAvg(e2), this.reset(e2), { totalCount: s2, successCountOfBusiness: t2, successRateOfBusiness: n2, successCountOfPlatform: o2, successRateOfPlatform: i2, avgValue: a2 }); } }, { key: "reset", value: function(e2) { N(e2) ? this._map.clear() : this._map.set(e2, { totalCount: 0, successCount: 0, failedCountOfUserSide: 0, costArray: [], fileSizeArray: [] }); } }]), Vr), js = (e(xr, [{ key: "initMap", value: function(e2) { var t2 = this; e2.forEach(function(e3) { t2._lastMap.set(e3, /* @__PURE__ */ new Map()), t2._currentMap.set(e3, /* @__PURE__ */ new Map()); }); } }, { key: "addMessageSequence", value: function(e2) { var t2, n2, o2, i2 = e2.key, a2 = e2.message; return !(N(i2) || !this._lastMap.has(i2) || !this._currentMap.has(i2) || (t2 = a2.conversationID, a2 = a2.sequence, t2 = t2.replace(A.CONV_GROUP, ""), 0 !== this._lastMap.get(i2).size && this._lastMap.get(i2).has(t2) && (o2 = (n2 = this._lastMap.get(i2).get(t2)).length - 1, a2 > n2[0]) && a2 < n2[o2] ? (n2.push(a2), n2.sort(), this._lastMap.get(i2).set(t2, n2)) : this._addCurrentMap(e2), 0)); } }, { key: "_addCurrentMap", value: function(e2) { var t2 = e2.key, e2 = e2.message, n2 = e2.conversationID, e2 = e2.sequence, n2 = n2.replace(A.CONV_GROUP, ""); this._currentMap.get(t2).has(n2) || this._currentMap.get(t2).set(n2, []), this._currentMap.get(t2).get(n2).push(e2); } }, { key: "_copyData", value: function(e2) { if (!N(e2)) { this._lastMap.set(e2, /* @__PURE__ */ new Map()); var t2, n2 = this._lastMap.get(e2), o2 = Z(this._currentMap.get(e2)); try { for (o2.s(); !(t2 = o2.n()).done; ) { var i2 = Y(t2.value, 2), a2 = i2[0], s2 = i2[1]; n2.set(a2, s2); } } catch (e3) { o2.e(e3); } finally { o2.f(); } n2 = null, this._currentMap.set(e2, /* @__PURE__ */ new Map()); } } }, { key: "getStatResult", value: function(e2) { var o2, i2, t2; return N(this._currentMap.get(e2)) || N(this._lastMap.get(e2)) ? null : 0 === this._lastMap.get(e2).size ? (this._copyData(e2), null) : (i2 = o2 = 0, this._lastMap.get(e2).forEach(function(e3, t3) { var e3 = p(e3.values()), n2 = e3.length, e3 = e3[n2 - 1] - e3[0] + 1; o2 += e3, i2 += n2; }), 0 === o2 ? null : (100 < (t2 = Yt(i2 / o2 * 100, 2)) && (t2 = 100), this._copyData(e2), { totalCount: o2, successCountOfMessageReceived: i2, successRateOfMessageReceived: t2 })); } }, { key: "reset", value: function() { this._currentMap.clear(), this._lastMap.clear(); } }]), xr), Js = (t(qr, u), ws = n(qr), e(qr, [{ key: "_onLoginSuccess", value: function() { var t2 = this, e2 = (this._rateMessageSent.initMap(this._messageSentItems), this._rateMessageReceived.initMap(this._messageReceivedItems), this.get(13)), n2 = e2.getItem(this.TAG, false); !S(n2) && lt(n2.forEach) && (M.l("".concat(this._n, "._onLoginSuccess. logs count:").concat(n2.length)), n2.forEach(function(e3) { t2._statInfoArr.push(e3); }), e2.removeItem(this.TAG, false)); } }, { key: "_onCloudConfig", value: function() { var e2 = this.getCloudConfig("q_rpt_interval"), t2 = this.getCloudConfig("q_rpt_sdkappid_bl"), n2 = this.getCloudConfig("q_rpt_tinyid_wl"); N(e2) || (this.REPORT_INTERVAL = Number(e2)), N(t2) || (this.REPORT_SDKAPPID_BLACKLIST = t2.split(",").map(function(e3) { return Number(e3); })), N(n2) || (this.REPORT_TINYID_WHITELIST = n2.split(",")); } }, { key: "onCheckTimer", value: function(e2) { this.isLoggedIn() && e2 % this.REPORT_INTERVAL == 0 && (this.wholePeriod = true, this._report()); } }, { key: "addRequestCount", value: function() { this._avgRTT.addRequestCount(); } }, { key: "addRTT", value: function(e2) { this._avgRTT.addRTT(e2); } }, { key: "addMessageDelay", value: function(e2) { this._avgE2EDelay.addMessageDelay(e2); } }, { key: "addTotalCount", value: function(e2) { this._rateMessageSent.addTotalCount(e2) || M.w("".concat(this._n, ".addTotalCount invalid key:"), e2); } }, { key: "addSuccessCount", value: function(e2) { this._rateMessageSent.addSuccessCount(e2) || M.w("".concat(this._n, ".addSuccessCount invalid key:"), e2); } }, { key: "addFailedCountOfUserSide", value: function(e2) { this._rateMessageSent.addFailedCountOfUserSide(e2) || M.w("".concat(this._n, ".addFailedCountOfUserSide invalid key:"), e2); } }, { key: "addCost", value: function(e2, t2) { this._rateMessageSent.addCost(e2, t2) || M.w("".concat(this._n, ".addCost invalid key or cost:"), e2, t2); } }, { key: "addFileSize", value: function(e2, t2) { this._rateMessageSent.addFileSize(e2, t2) || M.w("".concat(this._n, ".addFileSize invalid key or size:"), e2, t2); } }, { key: "addMessageSequence", value: function(e2) { this._rateMessageReceived.addMessageSequence(e2) || M.w("".concat(this._n, ".addMessageSequence invalid key:"), e2.key); } }, { key: "_getQualityItem", value: function(e2) { var t2 = {}, n2 = Qn[this.get(15).getNetworkType()], n2 = (N(n2) && (n2 = 8), { qualityType: Xn[e2], timestamp: We(), networkType: n2, extension: "" }); switch (e2) { case xn: t2 = this._avgRTT.getStatResult(); break; case Vn: t2 = this._avgE2EDelay.getStatResult(); break; case Hn: case Bn: case Kn: case Yn: case Wn: t2 = this._rateMessageSent.getStatResult(e2); break; case jn: case Jn: case zn: t2 = this._rateMessageReceived.getStatResult(e2); } return null === t2 ? null : y(y({}, n2), t2); } }, { key: "_report", value: function(e2) { var t2 = this, n2 = [], o2 = null, e2 = (N(e2) ? this._qualityItems.forEach(function(e3) { null !== (o2 = t2._getQualityItem(e3)) && (o2.reportIndex = t2.reportIndex, o2.wholePeriod = t2.wholePeriod, n2.push(o2)); }) : null !== (o2 = this._getQualityItem(e2)) && (o2.reportIndex = this.reportIndex, o2.wholePeriod = this.wholePeriod, n2.push(o2)), M.d("".concat(this._n, "._report"), n2), 0 < this._statInfoArr.length && (n2 = n2.concat(this._statInfoArr), this._statInfoArr = []), this.get(12)), i2 = e2.getSDKAppID(), e2 = e2.getTinyID(); 0 < (n2 = Wt(this.REPORT_SDKAPPID_BLACKLIST, i2) && !jt(this.REPORT_TINYID_WHITELIST, e2) ? [] : n2).length && this._doReport(n2); } }, { key: "_doReport", value: function(t2) { var n2 = this, e2 = { header: aa(this), quality: t2 }; this.req({ P: k.SSO_STAT, data: y({}, e2) }).then(function() { n2.reportIndex++, n2.wholePeriod = false; }).catch(function(e3) { M.w("".concat(n2._n, "._doReport failed. error:"), e3), n2._statInfoArr = n2._statInfoArr.concat(t2), n2._flushAtOnce(); }); } }, { key: "_flushAtOnce", value: function() { var e2 = this.get(13), t2 = e2.getItem(this.TAG, false), n2 = this._statInfoArr, o2 = "".concat(this._n, "._flushAtOnce"); S(t2) ? (M.l("".concat(o2, " count:").concat(n2.length)), e2.setItem(this.TAG, n2, true, false)) : (10 < (n2 = n2.concat(t2)).length && (n2 = n2.slice(0, 10)), M.l("".concat(o2, " count:").concat(n2.length)), e2.setItem(this.TAG, n2, true, false)), this._statInfoArr = []; } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._report(), this.reportIndex = 0, this.wholePeriod = false, this.REPORT_SDKAPPID_BLACKLIST = [], this.REPORT_TINYID_WHITELIST = [], this._avgRTT.reset(), this._avgE2EDelay.reset(), this._rateMessageSent.reset(), this._rateMessageReceived.reset(); } }]), qr), zs = e(function e2(t2) { d(this, e2), S(t2) || (this.userID = t2.userID || "", this.nick = t2.nick || "", this.avatar = t2.avatar || "", this.time = t2.time || 0, this.source = t2.source || "", this.wording = t2.wording || "", this.type = t2.type || ""); }), Xs = (e(Fr, [{ key: "getLocalApplicationList", value: function() { return { friendApplicationList: p(this._map.values()), unreadCount: this._unreadCount }; } }, { key: "_onApplicationListUpdated", value: function() { this._snsM.emitOEvt(h.FRIEND_APPLICATION_LIST_UPDATED, { friendApplicationList: p(this._map.values()), unreadCount: this._unreadCount }); } }, { key: "onApplicationRead", value: function() { this._unreadCount = 0, this._onApplicationListUpdated(); } }, { key: "onApplicationAdded", value: function(e2, t2) { var n2, o2, i2 = this; S(e2) || (n2 = "", n2 = t2 === this._snsM.getMyUserID() ? A.SNS_APPLICATION_SENT_BY_ME : A.SNS_APPLICATION_SENT_TO_ME, o2 = false, e2.forEach(function(e3) { var t3 = "".concat(e3.userID, "_").concat(n2); n2 !== A.SNS_APPLICATION_SENT_TO_ME || i2._map.has(t3) || (i2._unreadCount += 1), i2._map.set(t3, new zs(y(y({}, e3), {}, { type: n2 }))), o2 = true; }), o2 && this._onApplicationListUpdated()); } }, { key: "onApplicationDeleted", value: function(e2) { S(e2) || (this._startTime = 0, this._currentSeq = 0, this.getApplicationList()); } }, { key: "getApplicationList", value: function() { var a2 = this, s2 = "".concat(this._n, ".").concat("getApplicationList"), r2 = new G("getApplicationList"); return this._snsM.req({ P: k.GET_FD_APPLICATION_LIST, data: { applicationType: A.SNS_APPLICATION_TYPE_BOTH, fromAccount: this._snsM.getMyUserID(), maxLimited: this._maxLimited, startTime: this._startTime, lastSequence: this._currentSeq } }).then(function(e2) { var e2 = e2.data, t2 = e2.resultList, n2 = e2.unreadCount, o2 = e2.startTime, e2 = e2.currentSequence, i2 = (a2._startTime = o2, a2._currentSeq = e2, a2._unreadCount = n2, O(t2) ? t2.length : 0), i2 = "applicationCount:".concat(i2, " unreadCount:").concat(n2, " startTime:").concat(o2, " currentSequence:").concat(e2); r2.setMessage(i2).end(), M.i("".concat(s2, " ok. ").concat(i2)), a2._map.clear(), O(t2) && t2.forEach(function(e3) { var t3 = e3.userID, n3 = e3.type, e3 = new zs(e3); a2._map.set("".concat(t3, "_").concat(n3), e3); }), a2._onApplicationListUpdated(); }).catch(function(e2) { return r2.setError(e2).end(), M.w("".concat(s2, " failed. error:"), e2), D(e2); }); } }, { key: "deleteApplication", value: function(e2) { var i2, a2 = "".concat(this._n, ".").concat("deleteApplication"), s2 = e2.userID, r2 = e2.type; return r2 && (r2 === A.SNS_APPLICATION_SENT_BY_ME || r2 === A.SNS_APPLICATION_SENT_TO_ME) || (r2 = A.SNS_APPLICATION_SENT_TO_ME), this._map.has("".concat(s2, "_").concat(r2)) ? ((i2 = new G("deleteApplication")).setMessage("userID:".concat(s2, " type:").concat(r2)), this._snsM.req({ P: k.DEL_FD_APPLICATION, data: { fromAccount: this._snsM.getMyUserID(), userIDList: [s2], type: r2 } }).then(function(e3) { var e3 = e3.data.resultList, t2 = e3[0], n2 = t2.to, o2 = t2.resultCode, t2 = t2.resultInfo; return i2.setMoreMessage("resultList:".concat(JSON.stringify(e3))).end(), M.i("".concat(a2, " ok. userID:").concat(s2, " type:").concat(r2)), 0 === o2 ? C() : D({ userID: n2, code: o2, message: t2 }); }).catch(function(e3) { return i2.setError(e3).end(), M.w("".concat(a2, " failed. error:"), e3), D(e3); })) : D({ code: L.FRIEND_APPLICATION_NOT_EXIST }); } }, { key: "acceptApplication", value: function(e2) { var n2 = "".concat(this._n, ".").concat("acceptApplication"), o2 = e2.userID, t2 = e2.remark, i2 = e2.tag, a2 = e2.type, s2 = (a2 && (a2 === A.SNS_APPLICATION_AGREE || a2 === A.SNS_APPLICATION_AGREE_AND_ADD) || (a2 = A.SNS_APPLICATION_AGREE_AND_ADD), new G("acceptApplication")); return s2.setMessage("userID:".concat(o2, " type:").concat(a2)), this._snsM.req({ P: k.RESPOND_FD_APPLICATION, data: { fromAccount: this._snsM.getMyUserID(), responseFriendItem: [{ userID: o2, remark: t2, tag: i2, action: a2 }] } }).then(function(e3) { s2.end(); var e3 = e3.data.resultList[0], t3 = e3.resultCode, e3 = e3.resultInfo; if (0 !== t3) return D({ code: t3, message: e3 }); M.i("".concat(n2, " ok. userID:").concat(o2, " type:").concat(a2)); }).catch(function(e3) { return s2.setError(e3).end(), M.w("".concat(n2, " failed. error:"), e3), D(e3); }); } }, { key: "refuseApplication", value: function(e2) { var n2 = "".concat(this._n, ".").concat("refuseApplication"), o2 = e2.userID, i2 = new G("refuseApplication"); return i2.setMessage("userID:".concat(o2)), this._snsM.req({ P: k.RESPOND_FD_APPLICATION, data: { fromAccount: this._snsM.getMyUserID(), responseFriendItem: [{ userID: o2, action: "Response_Action_Reject" }] } }).then(function(e3) { i2.end(); var e3 = e3.data.resultList[0], t2 = e3.resultCode, e3 = e3.resultInfo; if (0 !== t2) return D({ code: t2, message: e3 }); M.i("".concat(n2, " ok. userID:").concat(o2)); }).catch(function(e3) { return i2.setError(e3).end(), M.w("".concat(n2, " failed. error:"), e3), D(e3); }); } }, { key: "setApplicationRead", value: function() { var t2 = this, n2 = "".concat(this._n, ".").concat("setApplicationRead"), o2 = new G("setApplicationRead"); return this._snsM.req({ P: k.REPORT_FD_APPLICATION, data: { fromAccount: this._snsM.getMyUserID(), latestTimeStamp: Yt(We() / 1e3, 0) } }).then(function(e2) { o2.end(), M.i("".concat(n2, " ok")), t2._unreadCount = 0; }).catch(function(e2) { return o2.setError(e2).end(), M.w("".concat(n2, " failed. error:"), e2), D(e2); }); } }, { key: "reset", value: function() { this._maxLimited = 100, this._currentSeq = 0, this._unreadCount = 0, this._map.clear(); } }]), Fr), Zs = (e(wr, [{ key: "validate", value: function(e2) { var t2, n2 = true, o2 = ""; if (S(e2)) return { valid: false, tips: "empty options" }; if (e2.profileCustomField) for (var i2 = e2.profileCustomField.length, a2 = null, s2 = 0; s2 < i2; s2++) { if (a2 = e2.profileCustomField[s2], !m(a2.key) || -1 === a2.key.indexOf("Tag_Profile_Custom")) return { valid: false, tips: "The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom" }; if (!m(a2.value)) return { valid: false, tips: "The type of values of the custom profile key-value pairs (which is profileCustomField) must be String" }; } for (t2 in e2) if (Object.prototype.hasOwnProperty.call(e2, t2)) { if ("profileCustomField" === t2) continue; if (S(e2[t2]) && !m(e2[t2]) && !R(e2[t2])) { o2 = "key:" + t2 + ", invalid value:" + e2[t2], n2 = false; continue; } switch (t2) { case "nick": m(e2[t2]) || (n2 = !(o2 = "nick must be a string")), 500 < gt(e2[t2]) && (o2 = "nick name limited: must less than or equal to ".concat(500, " bytes, current size: ").concat(gt(e2[t2]), " bytes"), n2 = false); break; case "gender": vt(Qe, e2.gender) || (o2 = "key:gender, invalid value:" + e2.gender, n2 = false); break; case "birthday": R(e2.birthday) || (n2 = !(o2 = "birthday must be a number")); break; case "location": m(e2.location) || (n2 = !(o2 = "location must be a string")); break; case "selfSignature": m(e2.selfSignature) || (n2 = !(o2 = "selfSignature must be a string")); break; case "allowType": vt(et, e2.allowType) || (o2 = "key:allowType, invalid value:" + e2.allowType, n2 = false); break; case "language": R(e2.language) || (n2 = !(o2 = "language must be a number")); break; case "avatar": m(e2.avatar) || (n2 = !(o2 = "avatar must be a string")); break; case "messageSettings": 0 !== e2.messageSettings && 1 !== e2.messageSettings && (n2 = !(o2 = "messageSettings must be 0 or 1")); break; case "adminForbidType": vt($e, e2.adminForbidType) || (o2 = "key:adminForbidType, invalid value:" + e2.adminForbidType, n2 = false); break; case "level": R(e2.level) || (n2 = !(o2 = "level must be a number")); break; case "role": R(e2.role) || (n2 = !(o2 = "role must be a number")); break; default: o2 = "unknown key:" + t2 + " " + e2[t2], n2 = false; } } return { valid: n2, tips: o2 }; } }, { key: "update", value: function(e2) { var t2, n2 = "", o2 = []; this.friendCustomField.forEach(function(e3) { o2.push(e3.key); }); for (var i2 = 0, a2 = e2.length; i2 < a2; i2++) if (n2 = e2[i2].tag, t2 = e2[i2].value, -1 < n2.indexOf("Tag_SNS_Custom")) -1 < o2.indexOf(n2) ? this.friendCustomField.forEach(function(e3) { e3.key === n2 && (e3.value = t2); }) : this.friendCustomField.push({ key: n2, value: t2 }); else if (-1 < n2.indexOf("Tag_Profile_Custom")) { var s2 = false; this.profile.profileCustomField.forEach(function(e3) { e3.key === n2 && (e3.value = t2, s2 = true); }), s2 || this.profile.profileCustomField.push({ key: n2, value: t2 }); } else switch (n2) { case g.NICK: this.profile.nick = t2; break; case g.GENDER: this.profile.gender = t2; break; case g.BIRTHDAY: this.profile.birthday = t2; break; case g.LOCATION: this.profile.location = t2; break; case g.SELFSIGNATURE: this.profile.selfSignature = t2; break; case g.ALLOWTYPE: this.profile.allowType = t2; break; case g.LANGUAGE: this.profile.language = t2; break; case g.AVATAR: this.profile.avatar = t2; break; case g.MESSAGESETTINGS: this.profile.messageSettings = t2; break; case g.ADMINFORBIDTYPE: this.profile.adminForbidType = t2; break; case g.LEVEL: this.profile.level = t2; break; case g.ROLE: this.profile.role = t2; break; case Ze.REMARK: this.remark = t2; break; case Ze.ADDTIME: this.addTime = t2; break; case Ze.GROUP: this.groupList = JSON.parse(JSON.stringify(t2)); break; case Ze.ADDSOURCE: this.source = t2; break; case Ze.ADDWORDING: break; default: M.d("snsProfileItem unkown tag->", e2[i2].tag); } this.timestamp = Date.now(), o2.length = 0; } }, { key: "updateProfile", value: function(e2) { this.profile = JSON.parse(JSON.stringify(e2)), this.timestamp = Date.now(); } }, { key: "addToGroupList", value: function(e2) { -1 === this.groupList.indexOf(e2) && (this.groupList.push(e2), this.count = this.groupList.length); } }, { key: "removeFromGroupList", value: function(e2) { e2 = this.groupList.indexOf(e2); -1 < e2 && (this.groupList.splice(e2, 1), this.count = this.groupList.length); } }]), wr), Qs = (e(br, [{ key: "getLocalFriendList", value: function() { return p(this._map.values()); } }, { key: "getFriendRemark", value: function(e2) { return this._map.has(e2) ? this._map.get(e2).remark : ""; } }, { key: "onFriendProfileModified", value: function(e2) { var o2, i2 = this, e2 = e2.dataList; S(e2) || (o2 = this._snsM.get(11), e2.forEach(function(e3) { var t2, n2 = e3.userID, e3 = e3.profileList; i2.isMyFriend(n2) && (M.l("".concat(i2._n, ".onFriendProfileModified. friend account:").concat(n2, ", profileList:").concat(JSON.stringify(e3))), (t2 = i2._map.get(n2)).update(e3), o2.modifyMessageSentByPeer({ conversationID: "".concat(A.CONV_C2C).concat(n2), latestNick: t2.profile.nick, latestAvatar: t2.profile.avatar })); }), this._onFriendListUpdated()); } }, { key: "onFriendAdded", value: function(t2) { var n2 = this; 0 !== t2.length && (M.l("".concat(this._n, ".onFriendAdded userIDList:").concat(t2)), t2.forEach(function(e2) { n2._map.set(e2, new Zs(e2)); }), this.getFriendProfile({ userIDList: t2 }).then(function(e2) { t2.forEach(function(e3) { var t3 = n2._map.get(e3); 0 < t3.groupList.length && n2._snsM.updateWhenFriendAdded({ nameList: t3.groupList, userID: e3 }); }), n2._onFriendListUpdated(); })); } }, { key: "onFriendDeleted", value: function(e2) { var n2 = this; 0 !== e2.length && (M.l("".concat(this._n, ".onFriendDeleted userIDList:").concat(e2)), e2.forEach(function(e3) { var t2 = n2._map.get(e3); 0 < t2.groupList.length && n2._snsM.updateWhenFriendDeleted({ nameList: t2.groupList, userID: e3 }), n2._map.delete(e3); }), this._onFriendListUpdated()); } }, { key: "_onFriendListUpdated", value: function() { this._snsM.emitOEvt(h.FRIEND_LIST_UPDATED), this._snsM.get(11).checkAndPatchRemark(); } }, { key: "getFriendProfile", value: function(e2) { var t2, a2 = this, n2 = "".concat(this._n, ".").concat("getFriendProfile"), e2 = e2.userIDList, s2 = [], r2 = [], o2 = []; return e2.forEach(function(e3) { var t3; a2._map.has(e3) ? (t3 = a2._map.get(e3), Date.now() - t3.timestamp < a2._expirationTime ? r2.push(t3) : o2.push(e3)) : s2.push({ userID: e3, code: L.NOT_MY_FRIEND, message: a2._snsM.getErrMsg(L.NOT_MY_FRIEND) }); }), 0 === o2.length ? (M.i("".concat(n2, " newUserIDList is empty")), T({ friendList: r2, failureUserIDList: s2 })) : ((t2 = new G("getFriendProfile")).setMessage("userIDList:".concat(o2)), M.i("".concat(n2, " userIDList:").concat(o2)), this._snsM.req({ P: k.GET_FD_PROFILE, data: { fromAccount: this._snsM.getMyUserID(), userIDList: o2 } }).then(function(e3) { return t2.end(), M.i("".concat(n2, " ok")), e3.data.resultList.forEach(function(e4) { var t3, n3 = e4.to, o3 = e4.resultCode, i2 = e4.resultInfo, e4 = e4.tagValueList; N(o3) || 0 === o3 ? (a2._map.has(n3) ? (t3 = a2._map.get(n3)).update(e4) : (t3 = new Zs(n3, e4), a2._map.set(n3, t3)), r2.push(t3)) : s2.push({ userID: n3, code: o3, message: i2 }); }), C({ friendList: r2, failureUserIDList: s2 }); }).catch(function(e3) { return t2.setError(e3).end(), M.w("".concat(n2, " failed. error:"), e3), D(e3); })); } }, { key: "isMyFriend", value: function(e2) { return this._map.has(e2); } }, { key: "pagingGetFriendList", value: function() { var s2 = this, r2 = "".concat(this._n, ".").concat("getFriendList"), c2 = new G("getFriendList"), u2 = Date.now(); this._snsM.req({ P: k.GET_FD_LIST, data: { fromAccount: this._snsM.getMyUserID(), startIndex: this._startIdx, standardSequence: this._standardSeq, customSequence: this._customSeq } }).then(function(e2) { var e2 = e2.data, t2 = e2.friendCount, n2 = e2.resultList, o2 = e2.nextStartIndex, i2 = e2.standardSequence, a2 = e2.customSequence, e2 = e2.completeFlag, t2 = (s2._startIdx = o2, s2._standardSeq = i2, s2._customSeq = a2, "friendCount:".concat(t2, " nextStartIndex:").concat(o2, " standardSequence:").concat(i2, " ") + "customSequence:".concat(a2, " completeFlag:").concat(e2, " cost:").concat(nn(u2))); c2.setMessage(t2).end(), M.i("".concat(r2, " ok."), t2), S(n2) || n2.forEach(function(e3) { var t3 = e3.to, e3 = e3.tagValueList; s2._map.set(t3, new Zs(t3, e3)); }), 0 === e2 ? s2.pagingGetFriendList() : (s2._snsM.emitOEvt(h.FRIEND_LIST_UPDATED), s2._pagingGetFriendProfile()); }).catch(function(e2) { return c2.setError(e2).end(), M.w("".concat(r2, " failed. error:"), e2), D(e2); }); } }, { key: "_pagingGetFriendProfile", value: function() { var n2 = this, e2 = p(this._map.keys()), t2 = this._snsM.get(4), o2 = e2.length, i2 = o2 <= 100 ? 1 : Math.ceil(o2 / 100); M.l("".concat(this._n, "._pagingGetFriendProfile friendCount:").concat(o2, " pageCount:").concat(i2)); for (var a2 = 0; a2 < i2; a2++) t2.getUserProfile({ userIDList: e2.slice(100 * a2, 100 * (a2 + 1)) }).then(function(e3) { e3.data.forEach(function(e4) { var t3 = n2._map.get(e4.userID); t3 && t3.updateProfile(e4); }), n2._onFriendListUpdated(); }); } }, { key: "addFriend", value: function(e2) { var t2, n2, o2, i2, a2, s2, r2, c2 = this, u2 = "".concat(this._n, ".").concat("addFriend"); return this._map.has(e2.to) ? D({ code: L.ALREADY_MY_FRIEND }) : e2.wording && false === this._snsM.filterProfanity("wording", e2) ? D({ code: L.PROFANITY_FOUND }) : (t2 = e2.to, n2 = e2.source, o2 = e2.type, i2 = e2.wording, a2 = e2.remark, e2 = e2.groupName, (s2 = o2) && (s2 === A.SNS_ADD_TYPE_SINGLE || s2 === A.SNS_ADD_TYPE_BOTH) || (s2 = A.SNS_ADD_TYPE_BOTH), (r2 = new G("addFriend")).setMessage("to:".concat(t2, " source:").concat(n2, " type:").concat(s2)), this._snsM.req({ P: k.ADD_FD, data: { fromAccount: this._snsM.getMyUserID(), addFriendItem: [{ to: t2, source: n2, wording: i2, remark: a2, groupName: e2 }], type: s2 } }).then(function(e3) { var e3 = e3.data.resultList, e3 = (r2.setMoreMessage("resultList:".concat(JSON.stringify(e3))).end(), e3[0]), t3 = e3.to, n3 = e3.resultCode, e3 = e3.resultInfo; return M.i("".concat(u2, " ok. to:").concat(t3, " type:").concat(s2, " code:").concat(n3)), N(n3) || 0 === n3 ? C({ userID: t3, code: 0 }) : 30539 === n3 ? C({ userID: t3, code: n3, message: c2._snsM.getErrMsg(n3) }) : D({ userID: t3, code: n3, message: c2._snsM.getErrMsg(n3) || e3 }); }).catch(function(e3) { return r2.setError(e3).end(), M.w("".concat(u2, " failed. error:"), e3), D(e3); })); } }, { key: "deleteFriend", value: function(e2) { var t2, n2 = this, o2 = "".concat(this._n, ".").concat("deleteFriend"), i2 = e2.userIDList, e2 = e2.type, a2 = (1e3 < i2.length && (M.w("".concat(o2, " ").concat($t(1e3))), i2.length = 1e3), []), s2 = [], r2 = []; return i2.forEach(function(e3) { n2._map.has(e3) ? r2.push(e3) : a2.push({ userID: e3, code: L.NOT_MY_FRIEND, message: n2._snsM.getErrMsg(L.NOT_MY_FRIEND) }); }), 0 === r2.length ? T({ successUserIDList: s2, failureUserIDList: a2 }) : ((i2 = e2) && (i2 === A.SNS_DELETE_TYPE_SINGLE || i2 === A.SNS_DELETE_TYPE_BOTH) || (i2 = A.SNS_DELETE_TYPE_BOTH), (t2 = new G("deleteFriend")).setMessage("userIDList:".concat(r2, " type:").concat(i2)), this._snsM.req({ P: k.DEL_FD, data: { fromAccount: this._snsM.getMyUserID(), userIDList: r2, type: i2 } }).then(function(e3) { t2.end(), M.i("".concat(o2, " ok")); e3 = e3.data.resultList; return S(e3) || e3.forEach(function(e4) { var t3 = e4.to, n3 = e4.resultCode, e4 = e4.resultInfo; N(n3) || 0 === n3 ? s2.push({ userID: t3 }) : a2.push({ userID: t3, code: n3, message: e4 }); }), C({ successUserIDList: s2, failureUserIDList: a2 }); }).catch(function(e3) { return t2.setError(e3).end(), M.w("".concat(o2, " error:"), e3), D(e3); })); } }, { key: "updateFriend", value: function(e2) { var o2, i2, t2, a2 = this, n2 = e2.userID, s2 = e2.remark, r2 = e2.friendCustomField; return this._map.has(n2) ? (o2 = "".concat(this._n, ".").concat("updateFriend"), (i2 = new G("updateFriend")).setMessage("userID:".concat(n2, " remark:").concat(s2, " friendCustomField:").concat(r2)), t2 = [], N(s2) || t2.push({ tag: Ze.REMARK, value: s2 }), O(r2) && 0 < r2.length && r2.forEach(function(e3) { t2.push({ tag: e3.key, value: e3.value }); }), this._snsM.req({ P: k.UPDATE_FD, data: { fromAccount: this._snsM.getMyUserID(), updateItem: [{ to: n2, snsItem: t2 }] } }).then(function(e3) { i2.end(), M.i("".concat(o2, " ok")); var e3 = e3.data.resultList[0], t3 = e3.to, n3 = e3.resultCode, e3 = e3.resultInfo; return N(n3) || 0 === n3 ? ((t3 = a2._map.get(t3)) && (N(s2) || (t3.remark = s2), O(r2) && 0 < r2.length && kt(t3.friendCustomField, r2), a2._onFriendListUpdated()), C(t3)) : D({ code: n3, message: e3 }); }).catch(function(e3) { return i2.setError(e3).end(), M.w("".concat(o2, " failed. error:"), e3), D(e3); })) : D({ code: L.NOT_MY_FRIEND }); } }, { key: "checkFriend", value: function(e2) { var t2 = "".concat(this._n, ".").concat("checkFriend"), n2 = e2.userIDList, o2 = e2.type, s2 = (o2 && (o2 === A.SNS_CHECK_TYPE_SINGLE || o2 === A.SNS_CHECK_TYPE_BOTH) || (o2 = A.SNS_CHECK_TYPE_BOTH), new G("checkFriend")); return s2.setMessage("userIDList:".concat(n2, " type:").concat(o2)), this._snsM.req({ P: k.CHECK_FD, data: { fromAccount: this._snsM.getMyUserID(), userIDList: n2, type: o2 } }).then(function(e3) { s2.end(), M.i("".concat(t2, " ok. userIDList:").concat(n2, " type:").concat(o2)); var i2 = [], a2 = [], e3 = e3.data.resultList; return O(e3) && e3.forEach(function(e4) { var t3 = e4.to, n3 = e4.relation, o3 = e4.resultCode, e4 = e4.resultInfo; N(o3) || 0 === o3 ? i2.push({ userID: t3, code: 0, relation: n3 }) : a2.push({ userID: t3, code: o3, message: e4 }); }), C({ successUserIDList: i2, failureUserIDList: a2 }); }).catch(function(e3) { return s2.setError(e3).end(), M.w("".concat(t2, " failed. error:"), e3), D(e3); }); } }, { key: "onAddedToFriendGroup", value: function(e2) { var t2 = this, n2 = e2.name, e2 = e2.userIDList; M.l("".concat(this._n, ".onAddedToFriendGroup groupName:").concat(n2, " userIDList:").concat(e2)), n2 && !S(e2) && e2.forEach(function(e3) { t2._map.has(e3) && t2._map.get(e3).addToGroupList(n2); }); } }, { key: "onRemovedFromFriendGroup", value: function(e2) { var t2 = this, n2 = e2.name, e2 = e2.userIDList; M.l("".concat(this._n, ".onRemovedFromFriendGroup groupName:").concat(n2, " userIDList:").concat(e2)), n2 && !S(e2) && e2.forEach(function(e3) { t2._map.has(e3) && t2._map.get(e3).removeFromGroupList(n2); }); } }, { key: "reset", value: function() { this._map.clear(), this._startIdx = 0, this._standardSeq = 0, this._customSeq = 0; } }]), br), $s = (e(Ur, [{ key: "addToUserIDList", value: function(e2) { -1 === this.userIDList.indexOf(e2) && (this.userIDList.push(e2), this.count = this.userIDList.length); } }, { key: "removeFromUserIDList", value: function(e2) { e2 = this.userIDList.indexOf(e2); -1 < e2 && (this.userIDList.splice(e2, 1), this.count = this.userIDList.length); } }]), Ur), er = (e(Pr, [{ key: "getLocalGroupList", value: function() { return p(this._map.values()); } }, { key: "_onGroupListUpdated", value: function() { var e2 = p(this._map.values()); this._snsM.emitOEvt(h.FRIEND_GROUP_LIST_UPDATED, e2); } }, { key: "getGroupList", value: function() { var n2 = this, t2 = "".concat(this._n, ".").concat("getGroupList"), o2 = new G("getGroupList"); return this._snsM.req({ P: k.GET_FD_GRP_LIST, data: { fromAccount: this._snsM.getMyUserID() } }).then(function(e2) { o2.end(); e2 = e2.data.resultList; S(e2) ? M.i("".concat(t2, " ok. count:0")) : (M.i("".concat(t2, " ok. count:").concat(e2.length)), n2._map.clear(), e2.forEach(function(e3) { var t3 = new $s(e3); n2._map.set(e3.name, t3); }), n2._onGroupListUpdated()); }).catch(function(e2) { return o2.setError(e2).end(), M.w("".concat(t2, " error:"), e2), D(e2); }); } }, { key: "createGroup", value: function(e2) { var t2, n2, o2 = this, s2 = "".concat(this._n, ".").concat("createGroup"), r2 = e2.name, e2 = e2.userIDList; return this._map.has(r2) ? D({ code: L.FRIEND_GRP_EXISTED }) : (t2 = "name:".concat(r2, " userIDList:").concat(e2), (n2 = new G("createGroup")).setMessage(t2), this._snsM.req({ P: k.CREATE_FD_GRP, data: { fromAccount: this._snsM.getMyUserID(), groupName: [r2], userIDList: O(e2) ? e2 : void 0 } }).then(function(e3) { n2.end(), M.l("".concat(s2, " ok. ").concat(t2)); var e3 = e3.data.resultList, i2 = [], a2 = [], e3 = (e3 && e3.forEach(function(e4) { var t3 = e4.to, n3 = e4.resultCode, o3 = e4.resultInfo; N(n3) || 0 === n3 ? i2.push(t3) : (t3 = { userID: e4.to, code: n3, message: o3 }, a2.push(t3)); }), new $s({ name: r2, userIDList: i2 })); return o2._map.set(r2, e3), o2._snsM.onAddedToFriendGroup({ name: r2, userIDList: i2 }), o2._onGroupListUpdated(), C({ friendGroup: e3, failureUserIDList: a2 }); }).catch(function(e3) { return n2.setError(e3).end(), M.w("".concat(s2, " failed. error:"), e3), D(e3); })); } }, { key: "deleteGroup", value: function(e2) { var n2, o2, i2 = this, a2 = "".concat(this._n, ".").concat("deleteGroup"), s2 = e2.name; return this._map.has(s2) ? (n2 = "name:".concat(s2), (o2 = new G("deleteGroup")).setMessage(n2), this._snsM.req({ P: k.DEL_FD_GRP, data: { fromAccount: this._snsM.getMyUserID(), nameList: [s2] } }).then(function(e3) { o2.end(), M.l("".concat(a2, " ok. ").concat(n2)); var t2 = i2._map.get(s2); return t2 && (i2._snsM.onRemovedFromFriendGroup({ name: s2, userIDList: t2.userIDList }), i2._map.delete(s2), t2.userIDList.length = 0), i2._onGroupListUpdated(), C(t2); }).catch(function(e3) { return o2.setError(e3).end(), M.w("".concat(a2, " failed. error:"), e3), D(e3); })) : this._onGroupNotExist(); } }, { key: "renameGroup", value: function(e2) { var t2, n2, o2 = this, i2 = "".concat(this._n, ".").concat("renameGroup"), a2 = e2.oldName, s2 = e2.newName; return this._map.has(a2) ? (t2 = "oldName:".concat(a2, " newName:").concat(s2), (n2 = new G("renameGroup")).setMessage(t2), this._snsM.req({ P: k.UPDATE_FD_GRP, data: { fromAccount: this._snsM.getMyUserID(), oldName: a2, newName: s2 } }).then(function() { var e3; return n2.end(), M.l("".concat(i2, " ok. ").concat(t2)), o2._map.has(a2) ? ((e3 = o2._map.get(a2)).name = s2, o2._map.delete(a2), o2._map.set(s2, e3), o2._snsM.onRemovedFromFriendGroup({ name: a2, userIDList: e3.userIDList }), o2._snsM.onAddedToFriendGroup({ name: s2, userIDList: e3.userIDList }), o2._onGroupListUpdated(), C(e3)) : C(); }).catch(function(e3) { return n2.setError(e3).end(), M.w("".concat(i2, " failed. error:"), e3), D(e3); })) : this._onGroupNotExist(); } }, { key: "addToGroup", value: function(e2) { var t2, n2, o2 = this, i2 = "".concat(this._n, ".").concat("addToGroup"), a2 = e2.name, e2 = e2.userIDList; return this._map.has(a2) ? (t2 = "name:".concat(a2, " userIDList:").concat(e2), (n2 = new G("addToGroup")).setMessage(t2), this._snsM.req({ P: k.UPDATE_FD_GRP, data: { fromAccount: this._snsM.getMyUserID(), oldName: a2, updateGroupItem: e2.filter(function(e3) { return o2._snsM.isMyFriend(e3); }).map(function(e3) { return { to: e3, updateType: "Update_Type_Add" }; }) } }).then(function(e3) { return n2.end(), M.l("".concat(i2, " ok. ").concat(t2)), o2._onGroupUpdated(a2, e3); }).catch(function(e3) { return n2.setError(e3).end(), M.w("".concat(i2, " failed. error:"), e3), D(e3); })) : this._onGroupNotExist(); } }, { key: "removeFromGroup", value: function(e2) { var t2, n2, o2 = this, i2 = "".concat(this._n, ".").concat("removeFromGroup"), a2 = e2.name, e2 = e2.userIDList; return this._map.has(a2) ? (t2 = "name:".concat(a2, " userIDList:").concat(e2), (n2 = new G("removeFromGroup")).setMessage(t2), this._snsM.req({ P: k.UPDATE_FD_GRP, data: { fromAccount: this._snsM.getMyUserID(), oldName: a2, updateGroupItem: e2.filter(function(e3) { return o2._snsM.isMyFriend(e3); }).map(function(e3) { return { to: e3, updateType: "Update_Type_Delete" }; }) } }).then(function(e3) { return n2.end(), M.l("".concat(i2, " ok. ").concat(t2)), o2._onGroupUpdated(a2, e3); }).catch(function(e3) { return n2.setError(e3).end(), M.w("".concat(i2, " failed. error:"), e3), D(e3); })) : this._onGroupNotExist(); } }, { key: "_onGroupUpdated", value: function(e2, t2) { var t2 = t2.data.resultList, a2 = this._map.get(e2), s2 = [], r2 = [], c2 = []; return O(t2) && t2.forEach(function(e3) { var t3 = e3.to, n2 = e3.resultCode, o2 = e3.resultInfo, i2 = e3.type; 0 === n2 ? "Update_Type_Add" === i2 ? a2 && (a2.addToUserIDList(t3), r2.push(t3)) : "Update_Type_Delete" === i2 && a2 && (a2.removeFromUserIDList(t3), c2.push(t3)) : s2.push({ to: e3.to, code: n2, message: o2 }); }), M.l("".concat(this._n, "._onGroupUpdated name:").concat(e2, " userIDList:").concat(a2.userIDList)), 0 < r2.length && this._snsM.onAddedToFriendGroup({ name: e2, userIDList: r2 }), 0 < c2.length && this._snsM.onRemovedFromFriendGroup({ name: e2, userIDList: c2 }), C({ friendGroup: a2, failureUserIDList: s2 }); } }, { key: "updateWhenFriendAdded", value: function(e2) { var t2 = this, n2 = e2.nameList, o2 = e2.userID; M.l("".concat(this._n, ".updateWhenFriendAdded userID:").concat(o2, " nameList:").concat(n2)), S(n2) || n2.forEach(function(e3) { t2._map.has(e3) && t2._map.get(e3).addToUserIDList(o2); }); } }, { key: "updateWhenFriendDeleted", value: function(e2) { var t2 = this, n2 = e2.nameList, o2 = e2.userID; M.l("".concat(this._n, ".updateWhenFriendDeleted userID:").concat(o2, " nameList:").concat(n2)), S(n2) || n2.forEach(function(e3) { t2._map.has(e3) && t2._map.get(e3).removeFromUserIDList(o2); }); } }, { key: "_onGroupNotExist", value: function(e2) { return D({ code: L.FRIEND_GRP_NOT_EXIST }); } }, { key: "reset", value: function() { this._map.clear(); } }]), Pr), tr = (t(Gr, u), bs = n(Gr), e(Gr, [{ key: "onContextUpdated", value: function(e2) { this._friendHandler.pagingGetFriendList(), this._friendGroupHandler.getGroupList(), this._friendApplicationHandler.getApplicationList(); } }, { key: "onRelationChainModified", value: function(e2) { var n2, o2, i2, a2, s2, r2, c2 = this, e2 = e2.dataList; S(e2) || (n2 = [], o2 = [], i2 = [], s2 = !(a2 = []), r2 = "", e2.forEach(function(e3) { var t2; 3 !== e3.pushType && 4 !== e3.pushType || !e3.from || (r2 = e3.from), e3.friendAddAccount && (n2.push.apply(n2, p(e3.friendAddAccount)), a2.push.apply(a2, p(e3.friendAddAccount))), e3.friendDelAccount && o2.push.apply(o2, p(e3.friendDelAccount)), e3.friendApplicationAdded && i2.push.apply(i2, p(e3.friendApplicationAdded)), e3.friendApplicationDeletedUserIDList && a2.push.apply(a2, p(e3.friendApplicationDeletedUserIDList)), e3.reportTime && 7 === e3.pushType && (s2 = true), e3.friendUpInfo && (t2 = { dataList: [] }, e3.friendUpInfo.forEach(function(e4) { t2.dataList.push({ userID: e4.friendAccount, profileList: p(e4.sns) }); }), c2.onFriendProfileModified(t2)); }), s2 && this._friendApplicationHandler.onApplicationRead(), this._friendApplicationHandler.onApplicationAdded(i2, r2), this._friendApplicationHandler.onApplicationDeleted(a2), this._friendHandler.onFriendAdded(n2), this._friendHandler.onFriendDeleted(o2)); } }, { key: "isMyFriend", value: function(e2) { return this._friendHandler.isMyFriend(e2); } }, { key: "filterProfanity", value: function(e2, t2) { var n2, o2 = this.get(29); return !o2 || (n2 = (o2 = o2.filterText(t2[e2], "sns")).isAllowedToSend, o2 = o2.modifiedText, true === n2 && (t2[e2] = o2, true)); } }, { key: "onFriendProfileModified", value: function(e2) { this._friendHandler.onFriendProfileModified(e2); } }, { key: "getLocalFriendList", value: function() { var e2 = !(0 < arguments.length && void 0 !== arguments[0]) || arguments[0], t2 = this._friendHandler.getLocalFriendList(); return e2 ? T(t2) : t2; } }, { key: "getFriendRemark", value: function(e2) { return this._friendHandler.getFriendRemark(e2); } }, { key: "getFriendList", value: function() { return this._friendHandler.pagingGetFriendList(); } }, { key: "addFriend", value: function(e2) { return this._friendHandler.addFriend(e2); } }, { key: "deleteFriend", value: function(e2) { return this._friendHandler.deleteFriend(e2); } }, { key: "checkFriend", value: function(e2) { return this._friendHandler.checkFriend(e2); } }, { key: "getFriendProfile", value: function(e2) { return this._friendHandler.getFriendProfile(e2); } }, { key: "updateFriend", value: function(e2) { return this._friendHandler.updateFriend(e2); } }, { key: "onAddedToFriendGroup", value: function(e2) { this._friendHandler.onAddedToFriendGroup(e2); } }, { key: "onRemovedFromFriendGroup", value: function(e2) { this._friendHandler.onRemovedFromFriendGroup(e2); } }, { key: "getLocalFriendApplicationList", value: function() { var e2 = this._friendApplicationHandler.getLocalApplicationList(); return T(e2); } }, { key: "deleteFriendApplication", value: function(e2) { return this._friendApplicationHandler.deleteApplication(e2); } }, { key: "refuseFriendApplication", value: function(e2) { return this._friendApplicationHandler.refuseApplication(e2); } }, { key: "acceptFriendApplication", value: function(e2) { return this._friendApplicationHandler.acceptApplication(e2); } }, { key: "setFriendApplicationRead", value: function(e2) { return this._friendApplicationHandler.setApplicationRead(e2); } }, { key: "getLocalFriendGroupList", value: function() { var e2 = this._friendGroupHandler.getLocalGroupList(); return T(e2); } }, { key: "createFriendGroup", value: function(e2) { return this._friendGroupHandler.createGroup(e2); } }, { key: "deleteFriendGroup", value: function(e2) { return this._friendGroupHandler.deleteGroup(e2); } }, { key: "addToFriendGroup", value: function(e2) { return this._friendGroupHandler.addToGroup(e2); } }, { key: "removeFromFriendGroup", value: function(e2) { return this._friendGroupHandler.removeFromGroup(e2); } }, { key: "renameFriendGroup", value: function(e2) { return this._friendGroupHandler.renameGroup(e2); } }, { key: "updateWhenFriendAdded", value: function(e2) { this._friendGroupHandler.updateWhenFriendAdded(e2); } }, { key: "updateWhenFriendDeleted", value: function(e2) { this._friendGroupHandler.updateWhenFriendDeleted(e2); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._friendHandler.reset(), this._friendGroupHandler.reset(), this._friendApplicationHandler.reset(); } }]), Gr), nr = (t(Nr, u), Us = n(Nr), e(Nr, [{ key: "isWorkerEnabled", value: function() { return this._isWorkerEnabled && Ge; } }, { key: "startWorkerTimer", value: function() { M.l("".concat(this._n, ".startWorkerTimer")), this._workerTimer && this._workerTimer.postMessage("start"); } }, { key: "stopWorkerTimer", value: function() { M.l("".concat(this._n, ".stopWorkerTimer")), this._workerTimer && this._workerTimer.postMessage("stop"); } }, { key: "_init", value: function() { var e2, t2; Ge && (e2 = URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(""); }, 1000); postMessage(interval); } else if (event.data === "stop") { clearInterval(interval); interval = -1; }};'], { type: "application/javascript; charset=utf-8" })), this._workerTimer = new Worker(e2), (t2 = this)._workerTimer.onmessage = function(e3) { e3.data ? (t2._timerID = e3.data, M.l("".concat(t2._n, "._init seed:").concat(t2._timerID))) : t2._m.onCheckTimer(); }); } }, { key: "_onCloudConfig", value: function() { var e2 = this.getCloudConfig("enable_worker"); M.l("".concat(this._n, "._onCloudConfig enableWorker:").concat(e2)), N(e2) || "1" === e2 ? !this._isWorkerEnabled && Ge && (this._isWorkerEnabled = true, this.startWorkerTimer(), this._m.onWorkerTimerEnabled()) : this._isWorkerEnabled && Ge && (this._isWorkerEnabled = false, this.stopWorkerTimer(), this._m.onWorkerTimerDisabled()); } }, { key: "terminate", value: function() { M.l("".concat(this._n, ".terminate")), this._workerTimer && (this._workerTimer.terminate(), this._workerTimer = null, this._timerID = -1); } }, { key: "getTimerID", value: function() { return this._timerID; } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")); } }]), Nr), or = (e(Or, [{ key: "isValidPurchaseBits", value: function(e2) { return e2 && "string" == typeof e2 && 1 <= e2.length && e2.length <= 64 && /[01]{1,64}/.test(e2); } }, { key: "parsePurchaseBits", value: function(e2) { if (this.isValidPurchaseBits(e2)) { this._featureMap.clear(); for (var t2, n2 = e2.length - 1, o2 = 0; 0 <= n2; n2--, o2++) t2 = (o2 < 32 ? new ee(0, Math.pow(2, o2)) : new ee(Math.pow(2, o2 - 32), 0)).toString(), "1" === e2[n2] ? this._featureMap.set(t2, true) : this._featureMap.set(t2, false); } else M.w("".concat(this._n, ".parsePurchaseBits invalid purchasebits:").concat(e2)); } }, { key: "hasPurchasedFeature", value: function(e2) { return !!this._featureMap.get(e2); } }, { key: "isFeatureEnabled", value: function(e2) { for (var t2 = parseInt(e2).toString(2), n2 = void 0, o2 = true, i2 = t2.length - 1, a2 = 0; 0 <= i2; i2--, a2++) if ("1" === t2.charAt(i2) && (n2 = (a2 < 32 ? new ee(0, Math.pow(2, a2)) : new ee(Math.pow(2, a2 - 32), 0)).toString(), !this._featureMap.get(n2))) { o2 = false; break; } return M.l("".concat(this._n, ".isFeatureEnabled decimalNumber:").concat(e2, " key:").concat(n2, " ret:").concat(o2)), T({ enabled: o2 }); } }, { key: "isFeatureEnabledForStat", value: function(e2) { for (var t2 = parseInt(e2).toString(2), n2 = t2.length - 1, o2 = 0; 0 <= n2; n2--, o2++) if ("1" === t2.charAt(n2)) { if (i2 = (o2 < 32 ? new ee(0, Math.pow(2, o2)) : new ee(Math.pow(2, o2 - 32), 0)).toString(), !this._featureMap.get(i2)) break; var i2, a2 = "", s2 = 0; i2 === _.PLUGIN_TRANSLATE ? (a2 = "plugin_translate", s2 = 16) : i2 === _.PLUGIN_VOICE_TO_TEXT ? (a2 = "plugin_voice_to_text", s2 = 17) : i2 === _.PLUGIN_CS ? (a2 = "plugin_cs", s2 = 14) : i2 === _.PLUGIN_PUSH ? (a2 = "plugin_push", s2 = 13) : i2 === _.PLUGIN_BOT ? (a2 = "plugin_bot", s2 = 15) : i2 === _.MSG_REACTION && (a2 = "plugin_emoji_reaction", s2 = 18), "" !== a2 && (i2 = this._commercialConfigM.get(12).getUIPlatform(), new G(a2).setCode(s2).setUIPlatform(i2).end(), M.l("".concat(this._n, ".isFeatureEnabledForStat ").concat(a2, " code:").concat(s2, " uiPlatform:").concat(i2))); } } }, { key: "isSearchCloudMessagesEnabled", value: function() { var e2; this._isSCMReported || (e2 = this._commercialConfigM.get(12).getUIPlatform(), new G("plugin_search").setCode(6).setUIPlatform(e2).end(), this._isSCMReported = true); } }, { key: "clear", value: function() { this._featureMap.clear(), this._isSCMReported = false; } }]), Or), ir = (e(Rr, [{ key: "_canFetch", value: function() { return this.get(12).isLoggedIn() ? !this._isFetching && Date.now() >= this._expiredTime : (this._expiredTime = Date.now() + 2e3, false); } }, { key: "onCheckTimer", value: function(e2) { this._canFetch() && this.fetchConfig(); } }, { key: "fetchConfig", value: function() { var t2, e2, n2 = this, o2 = this._canFetch(), i2 = "".concat(this._n, ".fetchConfig"); M.l("".concat(i2, " canFetch:").concat(o2)), o2 && (t2 = new G("fetchCommercialConfig"), o2 = this.get(12).getSDKAppID(), e2 = this.get(20), this._isFetching = true, e2.req({ P: k.FETCH_COMMERCIAL_CONFIG, data: { SDKAppID: o2 } }).then(function(e3) { t2.setMessage("purchaseBits:".concat(e3.data.purchaseBits)).end(), M.l("".concat(i2, " ok.")), n2._parseConfig(e3.data), n2._isFetching = false; }).catch(function(e3) { t2.setError(e3).end(), n2._isFetching = false; })); } }, { key: "onPushedConfig", value: function(e2) { var t2 = "".concat(this._n, ".onPushedConfig data:").concat(JSON.stringify(e2)); M.l("".concat(t2)), new G("pushedCommercialConfig").setMessage("purchaseBits:".concat(e2.purchaseBits)).end(), this._parseConfig(e2); } }, { key: "_parseConfig", value: function(e2) { var t2 = "".concat(this._n, "._parseConfig"), n2 = e2.errorCode, o2 = e2.errorMessage, i2 = e2.purchaseBits, a2 = e2.expiredTime; 0 === n2 ? (this._purchasedFeatureHandler.parsePurchaseBits(i2), this._expiredTime = Date.now() + 1e3 * a2) : N(n2) ? (M.l("".concat(t2, " failed. Invalid message format:"), e2), this._setExpiredTimeOnResponseError(36e5)) : (M.e("".concat(t2, " errorCode:").concat(n2, " errorMessage:").concat(o2)), this._setExpiredTimeOnResponseError(12e4)); } }, { key: "_setExpiredTimeOnResponseError", value: function(e2) { this._expiredTime = Date.now() + e2; } }, { key: "canIUse", value: function(e2) { return this._purchasedFeatureHandler.hasPurchasedFeature(e2); } }, { key: "isFeatureEnabled", value: function(e2) { return this._purchasedFeatureHandler.isFeatureEnabled(e2); } }, { key: "isFeatureEnabledForStat", value: function(e2) { this._purchasedFeatureHandler.isFeatureEnabledForStat(e2); } }, { key: "isSearchCloudMessagesEnabled", value: function() { this._purchasedFeatureHandler.isSearchCloudMessagesEnabled(); } }, { key: "get", value: function(e2) { return this._m.get(e2); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._expiredTime = 0, this._isFetching = false, this._purchasedFeatureHandler.clear(); } }]), Rr), ar = (t(Ar, u), Ps = n(Ar), e(Ar, [{ key: "registerPlugin", value: function(e2) { var t2, n2, o2, i2, a2, s2, r2, c2, u2, l2, d2, p2, _2; Ie ? (this._offlinePushPlugin = e2["tim-offline-push-plugin"], t2 = (_2 = e2.offlinePushConfig || {}).huaweiBusinessID, n2 = _2.xiaomiBusinessID, o2 = _2.xiaomiAppID, i2 = _2.xiaomiAppKey, a2 = _2.meizuBusinessID, s2 = _2.meizuAppID, r2 = _2.meizuAppKey, c2 = _2.vivoBusinessID, u2 = _2.oppoBusinessID, l2 = _2.oppoAppKey, d2 = _2.oppoAppSecret, p2 = _2.honorBusinessID, _2 = _2.iosBusinessID, this._androidPushConfig.huaweiPushBussinessId = t2, this._androidPushConfig.xiaomiPushBussinessId = n2, this._androidPushConfig.xiaomiPushAppId = o2, this._androidPushConfig.xiaomiPushAppKey = i2, this._androidPushConfig.meizuPushBussinessId = a2, this._androidPushConfig.meizuPushAppId = s2, this._androidPushConfig.meizuPushAppKey = r2, this._androidPushConfig.vivoPushBussinessId = c2, this._androidPushConfig.oppoPushBussinessId = u2, this._androidPushConfig.oppoPushAppKey = l2, this._androidPushConfig.oppoPushAppSecret = d2, this._androidPushConfig.honorPushBussinessId = p2, new G("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!N(this._offlinePushPlugin))).end(true), M.l("".concat(this._n, ".").concat("registerPlugin", " ok. offlinePushConfig:").concat(JSON.stringify(e2.offlinePushConfig))), this._iosBusinessID = _2, this._setAppShowListener()) : this.warn("OfflinePushInUniapp"); } }, { key: "init", value: function() { this._isWebUniapp = this.getUniAppPlatform(), this._getDeviceToken(); } }, { key: "_getDeviceToken", value: function() { var c2, u2 = this, l2 = "".concat(this._n, ".").concat("_getDeviceToken"); lt(this._offlinePushPlugin.getDeviceToken) ? (c2 = "androidPushConfig:".concat(JSON.stringify(this._androidPushConfig), ", iosBusinessID:").concat(this._iosBusinessID), M.l("".concat(l2, " start. ").concat(c2)), new G("_getDeviceToken").setMessage("".concat(c2)).end(true), this._offlinePushPlugin.getDeviceToken(this._androidPushConfig, function(e2) { var t2, n2, o2, i2, a2 = new G("getDeviceTokenRes"), s2 = e2.code, r2 = e2.msg; 0 === s2 ? (t2 = (i2 = e2.data).deviceToken, n2 = i2.deviceBrand, o2 = i2.deviceType, i2 = i2.bussinessId, u2._deviceToken = t2, u2._businessID = i2 || u2._iosBusinessID, c2 = "deviceToken:".concat(t2, ", deviceBrand:").concat(n2 || o2, ", businessID:").concat(u2._businessID), M.l("".concat(l2, " ok. ").concat(c2)), a2.setMessage(c2).end(true), u2._setToken()) : (a2.setMessage("code:".concat(s2, ", msg:").concat(r2)).end(true), M.e("".concat(l2, " failed. error:"), e2)); })) : M.e("".concat(l2, " getDeviceToken is not a function")); } }, { key: "canIUseOfflinePush", value: function() { return Ie && !N(this._offlinePushPlugin); } }, { key: "_setAppShowListener", value: function() { var t2 = this, n2 = "".concat(this._n, ".").concat("_setAppShowListener"); N(this._offlinePushPlugin) ? M.e("".concat(n2, " offlinePushPlugin is undefined")) : lt(this._offlinePushPlugin.setAppShowListener) ? (new G("_setAppShowListener").end(true), M.l("".concat(n2, " start")), this._offlinePushPlugin.setAppShowListener(function(e2) { e2 = (e2 || {}).appShow; new G("setAppShowListenerRes").setMessage("appShow:".concat(e2)).end(true), M.l("".concat(n2, " ok. appShow:").concat(e2)), t2._m.isReady() && (0 === e2 ? (t2._getConvUnreadCount(), t2._onBackground()) : 1 === e2 && t2._onForeground()); })) : M.e("".concat(n2, " setAppShowListener is not a function")); } }, { key: "getDeviceBrand", value: function() { var e2; if (!N(this._offlinePushPlugin) && lt(this._offlinePushPlugin.getDeviceType)) return e2 = (this._offlinePushPlugin.getDeviceType() || {}).deviceType, M.l("".concat(this._n, ".getDeviceBrand ok. deviceType:").concat(e2)), e2; } }, { key: "_setToken", value: function() { var t2 = "".concat(this._n, "._setToken"), e2 = this.get(12), n2 = 1, o2 = "", i2 = "", a2 = (S(this._deviceToken) && (n2 = 0), this.getUniAppPlatform()), s2 = this.getDeviceBrand(), r2 = (a2 === ne.IOS || a2 === ne.IPAD || a2 === ne.MAC ? i2 = this._deviceToken : a2 === ne.ANDROID && (o2 = this._deviceToken), new G("offlinePushSetToken")), a2 = "deviceToken:".concat(i2 || o2, ", businessID:").concat(this._businessID, ", ") + "deviceBrand:".concat(s2, ", isWebUniapp:").concat(this._isWebUniapp, ", pushMsg:").concat(n2, ", platform:").concat(a2); return r2.setMessage("".concat(a2)), M.l("".concat(t2, " ").concat(a2)), this.req({ P: k.SET_TOKEN, data: { tokenID: o2, pushMsg: n2, sdkAppID: e2.getSDKAppID(), businessID: parseInt(this._businessID), deviceBrand: s2, deviceToken: i2, isWebUniapp: this._isWebUniapp } }).then(function(e3) { return r2.end(), M.l("".concat(t2, " ok")), e3; }).catch(function(e3) { return r2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); }); } }, { key: "_getConvUnreadCount", value: function() { var t2 = this; this._c2cUnreadCount = 0, this._groupUnreadCount = 0, this.get(11).getLocalConvList().forEach(function(e2) { e2.type === A.CONV_C2C && (t2._c2cUnreadCount += e2.unreadCount), e2.type === A.CONV_GROUP && (t2._groupUnreadCount += e2.unreadCount); }); } }, { key: "_onBackground", value: function() { var t2 = this, n2 = "".concat(this._n, ".").concat("_onBackground"), o2 = new G("_onBackground"); this.req({ P: k.STAT_BACKGROUND, data: { c2cUnreadCount: this._c2cUnreadCount, groupUnreadCount: this._groupUnreadCount, isWebUniapp: this._isWebUniapp } }).then(function(e2) { return o2.setMessage("c2cUnreadCount: ".concat(t2._c2cUnreadCount, ", groupUnreadCount: ").concat(t2._groupUnreadCount)).end(), M.l("".concat(n2, " ok")), e2; }).catch(function(e2) { o2.setError(e2).end(), M.e("".concat(n2, " failed. error:"), e2); }); } }, { key: "_onForeground", value: function() { var t2 = "".concat(this._n, ".").concat("_onForeground"), n2 = new G("_onForeground"); this.req({ P: k.STAT_FOREGROUND, data: { isWebUniapp: this._isWebUniapp } }).then(function(e2) { return n2.end(), M.l("".concat(t2, " ok")), e2; }).catch(function(e2) { n2.setError(e2).end(), M.e("".concat(t2, " failed. error:"), e2); }); } }, { key: "getUniAppPlatform", value: function() { var e2 = uni.getSystemInfoSync().platform, t2 = this.getDeviceBrand(); return "ios" === e2 ? ne.IOS : "android" === e2 ? ne.ANDROID : 1002 === t2 ? ne.IPAD : 1001 === t2 ? ne.MAC : void 0; } }, { key: "reset", value: function() { this._deviceToken = "", this._businessID = 0, this._c2cUnreadCount = 0, this._groupUnreadCount = 0, this._isWebUniapp = 0, M.l("".concat(this._n, ".reset")); } }]), Ar), sr = (t(kr, u), Gs = n(kr), e(kr, [{ key: "registerPlugin", value: function(e2) { var t2, n2, o2; Ie ? (t2 = "".concat(this._n, ".").concat("registerPlugin"), this._pushPlugin = e2["tim-push"], this._getDeviceInfo(), n2 = (o2 = e2.pushConfig || {}).androidConfig, o2 = o2.iOSConfig, ut(n2) && (this._androidPushConfig = n2[this._deviceInfo.packageName]), n2 = (o2 || {}).iOSBusinessID, this._iOSBusinessID = n2, o2 = !N(this._pushPlugin), new G("registerPlugin").setMessage(this._pluginName).setMoreMessage("isExisted:".concat(o2)).end(true), M.l("".concat(t2, " ok. pushConfig:").concat(JSON.stringify(e2.pushConfig))), o2 ? (this._setAppShowListener(), this._setPushEventReportListener()) : M.e("".concat(t2, " ").concat(this._pluginName, " is undefined"))) : this.warn("TIMPushInUniapp"); } }, { key: "init", value: function() { this._isWebUniapp = this.getUniAppPlatform(), this._reportEventCacheList(), this._getDeviceToken(), this.get(27).isFeatureEnabledForStat(Math.pow(2, 41)); } }, { key: "_reportEventCacheList", value: function() { var a2 = this, s2 = "".concat(this._n, ".").concat("_reportEventCacheList"); lt(this._pushPlugin.getPushEventCacheList) ? (new G("_reportEventCacheList").end(true), this._pushPlugin.getPushEventCacheList(function(e2) { var t2 = e2.code, n2 = e2.data.eventList, o2 = new G("getPushEventCacheListRes"); if (o2.setCode(t2), 0 !== t2) o2.setMessage("res:".concat(JSON.stringify(e2))).end(true), M.e("".concat(s2, " failed. error:").concat(JSON.stringify(e2))); else { t2 = n2.length < 10 ? "eventList:".concat(JSON.stringify(n2)) : "eventList.length:".concat(n2.length); M.l("".concat(s2, " ok. ").concat(t2)), o2.setMessage(t2).end(true); for (var i2 = y(y({}, e2.data), {}, { eventList: [] }); 0 < n2.length; ) i2.eventList = n2.splice(0, 40), a2._pushReport(i2); } })) : M.e("".concat(this._pluginName, ".getPushEventCacheList is not a function")); } }, { key: "_getDeviceToken", value: function() { var r2, c2 = this, u2 = "".concat(this._n, ".").concat("_getDeviceToken"); lt(this._pushPlugin.getDeviceToken) ? (r2 = "androidPushConfig:".concat(JSON.stringify(this._androidPushConfig), " iOSBusinessID:").concat(this._iOSBusinessID), M.l("".concat(u2, " start. ").concat(r2)), new G("_getDeviceToken").setMessage("".concat(r2)).end(true), this._pushPlugin.getDeviceToken(this._androidPushConfig, function(e2) { var t2, n2, o2, i2 = e2.code, a2 = e2.msg, s2 = new G("getDeviceTokenRes"); s2.setCode(i2), 0 === i2 ? (t2 = (i2 = e2.data).deviceToken, n2 = i2.deviceBrand, o2 = i2.deviceType, i2 = i2.bussinessId, c2._deviceToken = t2, c2._businessID = i2 || c2._iOSBusinessID, r2 = "deviceToken:".concat(t2, " deviceBrand:").concat(n2 || o2, " businessID:").concat(c2._businessID), M.l("".concat(u2, " ok. ").concat(r2)), s2.setMessage(r2).end(true), c2._setToken()) : (s2.setMessage(a2).end(true), M.e("".concat(u2, " failed. error:").concat(JSON.stringify(e2)))); })) : M.e("".concat(this._pluginName, ".getDeviceToken is not a function")); } }, { key: "_getDeviceInfo", value: function() { var e2, t2, n2, o2, i2 = "".concat(this._n, ".").concat("_getDeviceInfo"); lt(this._pushPlugin.getDeviceInfo) ? (o2 = (e2 = this._pushPlugin.getDeviceInfo()).code, t2 = e2.data, (n2 = new G("_getDeviceInfo")).setCode(o2), 0 === o2 ? (this._deviceInfo = y(y({}, this._deviceInfo), t2), this._deviceInfo.pushVersion || (this._deviceInfo.pushVersion = "1.0.1"), o2 = "deviceInfo:".concat(JSON.stringify(this._deviceInfo)), M.l("".concat(i2, " ok. ").concat(o2)), n2.setMessage(o2).end(true)) : (n2.setMessage("deviceInfoRes:".concat(JSON.stringify(e2))).end(true), M.e("".concat(i2, " failed. error:").concat(JSON.stringify(e2))))) : M.e("".concat(this._pluginName, ".getDeviceInfo is not a function")); } }, { key: "canIUseTIMPush", value: function() { return Ie && !N(this._pushPlugin); } }, { key: "_setAppShowListener", value: function() { var t2 = this, n2 = "".concat(this._n, ".").concat("_setAppShowListener"); lt(this._pushPlugin.setAppShowListener) ? (new G("_setAppShowListener").end(true), M.l("".concat(n2, " start")), this._pushPlugin.setAppShowListener(function(e2) { e2 = (e2 || {}).appShow; new G("setAppShowListenerRes").setMessage("appShow:".concat(e2)).end(true), M.l("".concat(n2, " ok. appShow:").concat(e2)), t2._m.isReady() && (0 === e2 ? (t2._getConvUnreadCount(), t2._onBackground()) : 1 === e2 && t2._onForeground()); })) : M.e("".concat(this._pluginName, ".setAppShowListener is not a function")); } }, { key: "_setPushEventReportListener", value: function() { var a2 = this, s2 = "".concat(this._n, ".").concat("_setPushEventReportListener"); lt(this._pushPlugin.setPushEventReportListener) ? (new G("_setPushEventReportListener").end(true), this._pushPlugin.setPushEventReportListener(function(e2) { var t2 = e2.code, n2 = e2.data, o2 = n2.eventList, i2 = new G("setPushEventReportListenerRes"); i2.setCode(t2), 0 === t2 ? (t2 = "eventList:".concat(JSON.stringify(o2)), M.l("".concat(s2, " ok. ").concat(t2)), i2.setMessage(t2).end(true), a2._m.isReady() && O(o2) && 0 < o2.length && a2._pushReport(n2)) : (i2.setMessage("res:".concat(JSON.stringify(e2))).end(true), M.e("".concat(s2, " failed. error:").concat(JSON.stringify(e2)))); })) : M.e("".concat(this._pluginName, ".setPushEventReportListener is not a function")); } }, { key: "getDeviceBrand", value: function() { var e2; if (!N(this._pushPlugin) && lt(this._pushPlugin.getDeviceType)) return e2 = (this._pushPlugin.getDeviceType() || {}).deviceType, M.l("".concat(this._n, ".getDeviceBrand ok. deviceType:").concat(e2)), e2; } }, { key: "_setToken", value: function() { var t2 = "".concat(this._n, ".").concat("_setToken"), e2 = this.get(12), n2 = 1, o2 = "", i2 = "", a2 = (S(this._deviceToken) && (n2 = 0), this.getUniAppPlatform()), s2 = this.getDeviceBrand(), a2 = (a2 === ne.IOS || a2 === ne.IPAD || a2 === ne.MAC ? i2 = this._deviceToken : a2 === ne.ANDROID && (o2 = this._deviceToken), y({ tokenID: o2, pushMsg: n2, sdkAppID: e2.getSDKAppID(), businessID: parseInt(this._businessID), deviceBrand: s2, deviceToken: i2, isWebUniapp: this._isWebUniapp }, this._deviceInfo)), r2 = new G("_setToken"), o2 = "data:".concat(JSON.stringify(a2)); r2.setMessage("".concat(o2)), M.l("".concat(t2, " ").concat(o2)), this.req({ P: k.SET_TOKEN, data: a2 }).then(function() { r2.end(), M.w("".concat(t2, " ok")); }).catch(function(e3) { r2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); }); } }, { key: "_getConvUnreadCount", value: function() { var t2 = this; this._c2cUnreadCount = 0, this._groupUnreadCount = 0, this.get(11).getLocalConvList().forEach(function(e2) { e2.type === A.CONV_C2C && (t2._c2cUnreadCount += e2.unreadCount), e2.type === A.CONV_GROUP && (t2._groupUnreadCount += e2.unreadCount); }); } }, { key: "_onBackground", value: function() { var e2 = this, t2 = "".concat(this._n, ".").concat("_onBackground"), n2 = new G("_onBackground"); this.req({ P: k.STAT_BACKGROUND, data: { c2cUnreadCount: this._c2cUnreadCount, groupUnreadCount: this._groupUnreadCount, isWebUniapp: this._isWebUniapp } }).then(function() { n2.setMessage("c2cUnreadCount:".concat(e2._c2cUnreadCount, " groupUnreadCount:").concat(e2._groupUnreadCount)).end(), M.l("".concat(t2, " ok")); }).catch(function(e3) { n2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3); }); } }, { key: "_onForeground", value: function() { var t2 = "".concat(this._n, ".").concat("_onForeground"), n2 = new G("_onForeground"); this.req({ P: k.STAT_FOREGROUND, data: { isWebUniapp: this._isWebUniapp } }).then(function() { n2.end(), M.l("".concat(t2, " ok")); }).catch(function(e2) { n2.setError(e2).end(), M.e("".concat(t2, " failed. error:"), e2); }); } }, { key: "_pushReport", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("_pushReport"), o2 = new G("_pushReport"); this.req({ P: k.PUSH_REPORT, data: { eventList: e2.eventList } }).then(function() { o2.end(), t2._notifyReportSuccess(e2); }).catch(function(e3) { o2.setError(e3).end(), M.e("".concat(n2, " failed. error:"), e3); }); } }, { key: "_notifyReportSuccess", value: function(e2) { !N(this._pushPlugin) && lt(this._pushPlugin.notifyReportSuccess) && (this._pushPlugin.notifyReportSuccess(e2), M.l("".concat(this._n, "._notifyReportSuccess ok"))); } }, { key: "getUniAppPlatform", value: function() { var e2 = uni.getSystemInfoSync().platform, t2 = this.getDeviceBrand(); return "ios" === e2 ? ne.IOS : "android" === e2 ? ne.ANDROID : 1002 === t2 ? ne.IPAD : 1001 === t2 ? ne.MAC : void 0; } }, { key: "reset", value: function() { this._deviceToken = "", this._businessID = 0, this._c2cUnreadCount = 0, this._groupUnreadCount = 0, this._isWebUniapp = 0, M.l("".concat(this._n, ".reset")); } }]), kr), rr = (t(Sr, u), Ns = n(Sr), e(Sr, [{ key: "init", value: function() { var e2 = this.get(18).getPlugin("tim-profanity-filter-plugin"); e2 && (this._plugin = new e2({ logger: M, isArray: O, isMap: st, isDevMode: this.isDevMode() }), this._getLexicon()); } }, { key: "onCheckTimer", value: function() { this._plugin && this._canIUseLexicon && this.isLoggedIn() && !this._isFetching && Date.now() >= this._expiredTime && this._getLexicon(); } }, { key: "filterMessage", value: function(e2, t2) { var n2 = true; if (this._plugin && this._canIUseLexicon && (!t2 || !t2.messageControlInfo || true !== t2.messageControlInfo.excludedFromContentModeration)) { var t2 = e2.type, o2 = e2.conversationType; if (t2 === A.MSG_TEXT || t2 === A.MSG_CUSTOM) { var i2, a2 = "".concat(this._n, ".filterMessage"); if (M.l("".concat(a2)), t2 === A.MSG_TEXT) { if (o2 === A.CONV_C2C ? i2 = "c2c_text_message" : o2 === A.CONV_GROUP && (i2 = "group_text_message"), !this._isConfigOn(i2)) return n2; var s2 = this._plugin.filter(e2.payload.text), r2 = s2.type, s2 = s2.modifiedText; 1 === r2 ? n2 = false : 2 === r2 && (e2.payload.text = s2); } else if (t2 === A.MSG_CUSTOM) { if (o2 === A.CONV_C2C ? i2 = "c2c_custom_message" : o2 === A.CONV_GROUP && (i2 = "group_custom_message"), !this._isConfigOn(i2)) return n2; r2 = this._plugin.filter(e2.payload.data), s2 = this._plugin.filter(e2.payload.description), t2 = this._plugin.filter(e2.payload.extension); 1 === r2.type || 1 === s2.type || 1 === t2.type ? n2 = false : (2 === r2.type && (e2.payload.data = r2.modifiedText), 2 === s2.type && (e2.payload.description = s2.modifiedText), 2 === t2.type && (e2.payload.extension = t2.modifiedText)); } M.l("".concat(a2, " done. isAllowedToSend:").concat(n2)); } } return n2; } }, { key: "filterText", value: function(e2, t2) { var n2 = "".concat(this._n, ".filterText"), o2 = { isAllowedToSend: true, modifiedText: e2 }; return this._plugin && this._canIUseLexicon && this._isConfigOn(t2) && (M.l("".concat(n2)), e2 = (t2 = this._plugin.filter(e2)).type, t2 = t2.modifiedText, 1 === e2 ? o2.isAllowedToSend = false : 2 === e2 && (o2.modifiedText = t2), M.l("".concat(n2, " done. ret:"), o2)), o2; } }, { key: "_getLexicon", value: function() { var l2 = this, d2 = new G("profanityFilter"), p2 = "".concat(this._n, "._getLexicon"); this._isFetching = true, this.req({ P: k.GET_PROFANITY_LIST, data: { startIndex: this._startIndex, version: this._version } }).then(function(e2) { var e2 = e2.data, t2 = e2.errorInfo, n2 = e2.filterConfig, o2 = e2.lexicon, i2 = e2.strToken, a2 = e2.completeFlag, s2 = e2.nextStartIndex, r2 = e2.version, e2 = e2.expiredTime, c2 = t2.errorCode, u2 = t2.errorMessage; return 0 !== c2 ? (l2._isFetching = false, M.w("".concat(p2, " failed. error:"), t2), void d2.setCode(c2).setMessage(u2).end()) : (l2._onFilterConfig(n2), l2._getToken(i2), 1 === a2 ? (M.l("".concat(p2, " done. version:").concat(r2, " expiredTime:").concat(e2)), l2._version = r2, l2._canIUseLexicon = true, l2._isFetching = false, l2._expiredTime = Date.now() + 1e3 * e2, void l2._plugin.onLexiconCompleted(o2)) : (l2._startIndex = s2, l2._plugin.onLexiconSliced(o2), void l2._getLexicon())); }).catch(function(e2) { d2.setError(e2).end(), l2._isFetching = false, M.l("".concat(p2, " failed. error:"), e2); }); } }, { key: "_onFilterConfig", value: function(t2) { var n2 = this; S(t2) || (this._filterConfigMap.clear(), Object.keys(t2).forEach(function(e2) { n2._filterConfigMap.set(e2, t2[e2]); }), M.l("".concat(this._n, "._onFilterConfig. keys:").concat(Array.from(this._filterConfigMap.keys()), " values:").concat(Array.from(this._filterConfigMap.values())))); } }, { key: "_isConfigOn", value: function(e2) { return 1 === this._filterConfigMap.get(e2); } }, { key: "_getToken", value: function(e2) { if (m(e2)) { var t2 = e2.length, n2 = ""; if (t2 % 2 == 0) for (var o2 = 0; o2 <= t2 - 1; o2 += 2) n2 = (n2 += e2[o2 + 1]) + e2[o2]; else { for (var i2 = 0; i2 < t2 - 1; i2 += 2) n2 = (n2 += e2[i2 + 1]) + e2[i2]; n2 += e2[t2 - 1]; } this._plugin.onToken(n2); } } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._plugin && (this._plugin.reset(), this._plugin = null), this._filterConfigMap.clear(), this._startIndex = 0, this._version = 0, this._canIUseLexicon = false, this._isFetching = false, this._expiredTime = 0; } }]), Sr), cr = (e(Lr, [{ key: "_onCloudConfig", value: function() { var t2 = this, e2 = this._m.get(23).getCloudConfig("rtc_cmd"); N(e2) || ((e2 = JSON.parse(e2)).forEach(function(e3) { t2._TRTCCommandList.includes(e3) || t2._TRTCCommandList.push(e3); }), this._setTRTCCommandMap()); } }, { key: "_setTRTCCommandMap", value: function() { for (var e2, t2 = 0, n2 = this._TRTCCommandList.length; t2 < n2; t2++) e2 = this._TRTCCommandList[t2].split(".")[0], this._TRTCCommandMap.set(e2, 1); } }, { key: "onRoomCustomDataReceived", value: function(e2) { this._m.getOEmitInst().emit(h.ROOM_CUSTOM_DATA_RECEIVED, e2); } }, { key: "sendTRTCCustomData", value: function(e2) { var t2 = e2.serviceCommand, e2 = e2.data, n2 = "".concat(a.NAME.TUIROOM_SVR, ".*"); return N(t2) || (n2 = t2), this._isValidServiceCommand(n2) ? this._trans({ servcmd: n2, data: e2 }) : D({ code: L.INVALID_TRTC_CMD }); } }, { key: "_trans", value: function(e2) { M.d("".concat(this._n, "._trans. options:").concat(JSON.stringify(e2))); var t2 = e2.servcmd, e2 = e2.data; return this._m.get(20).trans({ servcmd: t2, data: m(e2) ? JSON.parse(e2) : e2 }); } }, { key: "_isValidServiceCommand", value: function(e2) { return e2.endsWith(".*") ? this._TRTCCommandList.includes(e2) : (e2 = e2.split(".")[0], this._TRTCCommandMap.has(e2)); } }, { key: "isTRTCCommand", value: function(e2) { e2 = e2.split(".")[0]; return this._TRTCCommandMap.has(e2); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")); } }]), Lr), ur = (e(Er, [{ key: "_init", value: function() { var e2, t2 = this._getStorageModule().getItem(this.TIM_ERROR_ASSISTANCE, false); if (t2) { try { e2 = JSON.parse(t2); } catch (e3) { this._getStorageModule().removeItem(this.TIM_ERROR_ASSISTANCE, false), M.w("".concat(this._n, "._init error:"), e3); } e2 && (this._needToUpdate(e2) ? this._fetch() : this._fillMap(e2.message)); } else this._fetch(); } }, { key: "_needToUpdate", value: function(e2) { var t2 = e2.localSavedTime, e2 = e2.localSavedVersion, t2 = t2 && (/* @__PURE__ */ new Date()).getTime() - t2 >= this.STORAGE_EXPIRES_TIME, e2 = !e2 || "3.4.7" !== e2; return M.l("".concat(this._n, "._needToUpdate isTimeout:").concat(t2, " isDifferentVersion:").concat(e2)), t2 || e2; } }, { key: "_fetch", value: function() { var e2, t2, n2, o2, i2, a2; this._m.get(12).isPrivateNetWork() || (e2 = "https://web.sdk.qcloud.com/im/download/error-message/v3/0.0.6/tim-error-message.txt", t2 = "application/x-www-form-urlencoded;charset=UTF-8", n2 = "".concat(this._n, "._fetch ok in"), o2 = this, v ? I.request({ url: e2, method: "GET", timeout: 3e3, header: { "content-type": t2 }, dataType: "text", success: function(e3) { o2._fillAndSave(e3.data), M.l("".concat(n2, " mini program")); }, fail: function() { } }) : (i2 = new XMLHttpRequest(), a2 = setTimeout(function() { i2.abort(); }, 3e3), i2.onreadystatechange = function() { 4 === i2.readyState && (clearTimeout(a2), 200 !== i2.status && 304 !== i2.status || (M.l("".concat(n2, " browser")), o2._fillAndSave(i2.responseText))); }, i2.open("GET", e2, true), i2.setRequestHeader("Content-type", t2), i2.send())); } }, { key: "_fillAndSave", value: function(e2) { this._fillMap(e2), this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE, JSON.stringify({ message: e2, localSavedTime: (/* @__PURE__ */ new Date()).getTime(), localSavedVersion: "3.4.7" }), true, false); } }, { key: "_getStorageModule", value: function() { return this._m.get(13); } }, { key: "_fillMap", value: function(e2) { this._map.clear(); for (var t2, n2, o2 = e2.split(";\n"), i2 = o2.length, a2 = new RegExp(/'/g), s2 = 0; s2 < i2; s2++) if (n2 = o2[s2].indexOf(":"), t2 = o2[s2].slice(0, n2), n2 = o2[s2].slice(n2 + 1, o2[s2].length), !t2.startsWith("//")) { if (N(n2)) continue; this._map.set(t2, n2.replace(a2, "")); } } }, { key: "get", value: function(e2) { var t2 = e2.isIntl, n2 = e2.key, o2 = e2.replacement1, e2 = e2.replacement2, t2 = "".concat(n2, t2 ? "_en" : "_cn"), n2 = (!this._map.has(t2) && this._map.has(n2) && (t2 = n2), ""); return this._map.has(t2) && (n2 = this._map.get(t2), N(o2) || (n2 = n2.replace("$replacement1", o2)), N(e2) || (n2 = n2.replace("$replacement2", e2))), n2; } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")); } }]), Er), lr = (e(Dr, [{ key: "onNewMessageList", value: function(e2) { var n2 = this; e2.forEach(function(e3) { var t2 = n2.getPayloadData(e3); t2 && n2._handleActionType(t2, e3); }); } }, { key: "onMessageModified", value: function(e2) { var n2 = this; e2.forEach(function(e3) { var t2 = n2.getPayloadData(e3); t2 && n2._onInvitationModified(t2, e3); }); } }, { key: "getPayloadData", value: function(t2) { var n2 = "".concat(this._n, ".getPayloadData"), t2 = t2.payload.data; try { return JSON.parse(t2); } catch (e2) { return M.e("".concat(n2, " JSON parse error. signalingData:").concat(t2)), null; } } }, { key: "_handleActionType", value: function(e2, t2) { switch (e2.actionType) { case Q.ACTION_TYPE_INVITE: this._onNewInvitationReceived(e2, t2); break; case Q.ACTION_TYPE_REJECT_INVITE: this._onInviteeRejected(e2); break; case Q.ACTION_TYPE_ACCEPT_INVITE: this._onInviteeAccepted(e2); break; case Q.ACTION_TYPE_CANCEL_INVITE: this._onInvitationCancelled(e2); break; case Q.ACTION_TYPE_INVITE_TIMEOUT: this._onInvitationTimeout(e2); } } }, { key: "_genBaseEmitData", value: function(e2) { return { inviteID: e2.inviteID, inviter: e2.inviter, groupID: e2.groupID, data: e2.data || "" }; } }, { key: "_onNewInvitationReceived", value: function(e2, t2) { var n2 = "".concat(this._n, "._onNewInvitationReceived"), o2 = e2.inviteID, i2 = e2.inviteeList, a2 = e2.groupID, s2 = e2.inviter, r2 = this._sigM.getMyUserID(), c2 = i2.includes(r2), u2 = e2.timeout, l2 = (Ve().getTime() - 1e3 * t2.time) / 1e3, n2 = (0 < u2 && 0 < l2 && l2 < u2 && (u2 -= l2), "".concat(n2, " myselfIncluded:").concat(c2, " groupID:").concat(a2, " signalObj:").concat(JSON.stringify(e2))); M.l("".concat(n2, " timeout:").concat(u2, "s delta:").concat(l2, "s")), !(a2 && c2 || !a2) || (n2 = this._sigM.getInviteInfo(o2)) && n2 === e2 || (n2 || this._sigM.setInviteInfo(o2, y(y({}, e2), {}, { message: t2 })), this._sigM.emitEvent(Q.NEW_INVITATION_RECEIVED, y(y({}, this._genBaseEmitData(e2)), {}, { inviteeList: i2 })), s2 !== r2 && this._sigM.startTimer(y(y({}, e2), {}, { timeout: u2 }))); } }, { key: "_onInviteeRejected", value: function(e2) { var t2 = "".concat(this._n, "._onInviteeRejected"), n2 = e2.inviteID, o2 = e2.inviter, i2 = e2.groupID, a2 = this._sigM.hasInviteInfo(n2); M.l("".concat(t2, " inviteID:").concat(n2, " hasInviteID:").concat(a2, " inviter:").concat(o2, " groupID:").concat(i2)), a2 && (this._sigM.updateInviteInfo(e2), this._sigM.emitEvent(Q.INVITEE_REJECTED, y(y({}, this._genBaseEmitData(e2)), {}, { invitee: e2.inviteeList[0] }))); } }, { key: "_onInviteeAccepted", value: function(e2) { var t2 = "".concat(this._n, "._onInviteeAccepted"), n2 = e2.inviteID, o2 = e2.inviter, i2 = e2.groupID, a2 = this._sigM.hasInviteInfo(n2); M.l("".concat(t2, " inviteID:").concat(n2, " hasInviteID:").concat(a2, " inviter:").concat(o2, " groupID:").concat(i2)), a2 && (this._sigM.updateInviteInfo(e2), this._sigM.emitEvent(Q.INVITEE_ACCEPTED, y(y({}, this._genBaseEmitData(e2)), {}, { invitee: e2.inviteeList[0] }))); } }, { key: "_onInvitationCancelled", value: function(e2) { var t2 = "".concat(this._n, "._onInvitationCancelled"), n2 = e2.inviteID, o2 = e2.inviter, i2 = e2.groupID, a2 = this._sigM.hasInviteInfo(n2); M.l("".concat(t2, " inviteID:").concat(n2, " hasInviteID:").concat(a2, " inviter:").concat(o2, " groupID:").concat(i2)), a2 && (this._sigM.deleteInviteInfo(n2), this._sigM.emitEvent(Q.INVITATION_CANCELLED, this._genBaseEmitData(e2))); } }, { key: "_onInvitationTimeout", value: function(e2) { var t2 = "".concat(this._n, "._onInvitationTimeout"), n2 = e2.inviteID, o2 = e2.inviter, i2 = e2.groupID, a2 = e2.inviteeList, s2 = this._sigM.hasInviteInfo(n2); M.l("".concat(t2, " inviteID:").concat(n2, " hasInviteID:").concat(s2, " inviter:").concat(o2, " groupID:").concat(i2, " data:").concat(e2.data)), s2 && (this._sigM.updateInviteInfo(e2), this._sigM.emitEvent(Q.INVITATION_TIMEOUT, y(y({}, this._genBaseEmitData(e2)), {}, { inviteeList: a2, isSelfTimeout: false }))); } }, { key: "_onInvitationModified", value: function(e2, t2) { var n2 = "".concat(this._n, "._onInvitationModified"), o2 = e2.inviteID, i2 = e2.data; M.l("".concat(n2, " inviteID:").concat(o2, " data:").concat(i2)), this._sigM.setInviteInfo(o2, y(y({}, e2), {}, { message: t2 })), this._sigM.emitEvent(Q.INVITATION_MODIFIED, { inviteID: o2, data: i2 }); } }]), Dr), dr = (e(Tr, [{ key: "generateInviteID", value: function() { var e2, t2 = (t2 = As)((e2 = ks)(32), 8) + "-" + t2(e2(16), 4) + "-" + t2(16384 | e2(12), 4) + "-" + t2(32768 | e2(14), 4) + "-" + t2(e2(48), 12); return M.l("".concat(this._n, ".generateInviteID inviteID:").concat(t2)), t2; } }, { key: "createInviteInfo", value: function(e2) { var t2 = this.generateInviteID(), e2 = this.createInviteCustomData(y(y({}, e2), {}, { inviteID: t2 })), n2 = e2.groupID, o2 = e2.inviteeList, n2 = n2 || o2[0]; return { customData: e2, message: this._sigM.createSignaling(e2, n2), inviteID: t2 }; } }, { key: "_genBaseCustomData", value: function(e2) { var t2 = e2.data, n2 = e2.inviteID, e2 = e2.groupID; return { businessID: 1, timeout: 0, data: void 0 === t2 ? "" : t2, inviteID: void 0 === n2 ? "" : n2, groupID: void 0 === e2 ? "" : e2 }; } }, { key: "createInviteCustomData", value: function(e2) { var t2 = e2.userID, n2 = e2.timeout, n2 = void 0 === n2 ? 0 : n2, o2 = e2.groupID, o2 = void 0 === o2 ? "" : o2, i2 = this._sigM.getMyUserID(), i2 = y(y({}, this._genBaseCustomData(e2)), {}, { actionType: Q.ACTION_TYPE_INVITE, inviter: i2, inviteeList: o2 ? e2.inviteeList : [t2], timeout: n2 }); return M.l("".concat(this._n, ".createInviteCustomData customData:"), i2), i2; } }, { key: "createCancelCustomData", value: function(e2) { var t2, n2 = "".concat(this._n, ".createCancelCustomData"), o2 = e2.inviteID, i2 = this._sigM.getMyUserID(), o2 = this._sigM.getInviteInfo(o2), a2 = o2.inviteeList, s2 = o2.groupID, o2 = o2.inviter; return o2 === i2 ? t2 = y(y({}, this._genBaseCustomData(e2)), {}, { actionType: Q.ACTION_TYPE_CANCEL_INVITE, groupID: s2, inviter: i2, inviteeList: a2 }) : M.e("".concat(n2, " unmatched inviter:").concat(o2, " and my userID:").concat(i2)), M.l("".concat(n2, " customData:"), t2), t2; } }, { key: "createAcceptCustomData", value: function(e2) { var t2, n2 = "".concat(this._n, ".createAcceptCustomData"), o2 = e2.inviteID, i2 = this._sigM.getMyUserID(), a2 = this._sigM.getInviteInfo(o2), s2 = a2.inviter, r2 = a2.groupID; return a2.inviteeList.includes(i2) ? t2 = y(y({}, this._genBaseCustomData(e2)), {}, { actionType: Q.ACTION_TYPE_ACCEPT_INVITE, groupID: r2, inviter: s2, inviteeList: [i2] }) : M.e("".concat(n2, " userID:").concat(i2, " not in inviteeList. inviteID:").concat(o2, " groupID:").concat(r2)), M.l("".concat(n2, " customData:"), t2), t2; } }, { key: "createRejectCustomData", value: function(e2) { var t2, n2 = "".concat(this._n, ".createRejectCustomData"), o2 = e2.inviteID, i2 = this._sigM.getMyUserID(), a2 = this._sigM.getInviteInfo(o2), s2 = a2.inviter, r2 = a2.groupID; return a2.inviteeList.includes(i2) ? t2 = y(y({}, this._genBaseCustomData(e2)), {}, { actionType: Q.ACTION_TYPE_REJECT_INVITE, groupID: r2, inviter: s2, inviteeList: [i2] }) : M.e("".concat(n2, " userID:").concat(i2, " not in inviteeList. inviteID:").concat(o2, " groupID:").concat(r2)), M.l("".concat(n2, " customData:"), t2), t2; } }, { key: "createTimeoutCustomData", value: function(e2) { var t2 = "".concat(this._n, ".createTimeoutCustomData"), n2 = e2.inviteeList, o2 = e2.inviter, i2 = e2.isInviter, i2 = void 0 !== i2 && i2, a2 = this._sigM.getMyUserID(), e2 = y(y({}, this._genBaseCustomData(e2)), {}, { actionType: Q.ACTION_TYPE_INVITE_TIMEOUT, inviter: o2, inviteeList: i2 ? n2 : [a2] }); return M.l("".concat(t2, " customData:"), e2), e2; } }]), Tr), pr = (e(Cr, [{ key: "setCloudConfig", value: function() { var e2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 20, t2 = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 300; this.COUNT = e2, this.EXPIRED_TIME = t2, M.l("".concat(this._n, ".setCloudConfig count:").concat(e2, ", time:").concat(t2)); } }, { key: "getHistorySignaling", value: function() { var t2 = this, e2 = this._sigM.get(11).getLocalConvList(); S(e2) || (this._getC2CSignalingList(), e2 = this._getValidGroupConvList(e2), this._getGroupSignalingList(e2).then(function(e3) { t2._handleSignalingList(e3); })); } }, { key: "_getC2CSignalingList", value: function() { var e2 = this._sigM.get(6).getMessageListFromUnreadDB(), e2 = this._sigM.filterMessageList(e2); this._getRelatedToMeMap(e2); } }, { key: "_getGroupSignalingList", value: function(e2) { var n2 = this, e2 = this._createPromiseList(e2); return 0 === e2.length ? Promise.resolve(this._sortSignaling(this._relatedToMeMap)) : this._concurrentGetMessageList(e2).then(function(e3) { var t2 = /* @__PURE__ */ new Map(); return e3.forEach(function(e4) { e4 = e4.list, e4 = n2._getRelatedToMeMap(e4); t2 = new Map([].concat(p(t2), p(e4))); }), n2._sortSignaling(t2); }); } }, { key: "_handleSignalingList", value: function(e2) { S(e2) || this._sigM.onNewMessageList(e2); } }, { key: "_getValidGroupConvList", value: function(e2) { for (var t2 = [], n2 = 0, o2 = e2.length; n2 < o2; n2++) { var i2 = e2[n2], a2 = i2.type, s2 = i2.unreadCount, i2 = i2.lastMessage, a2 = a2 === A.CONV_GROUP, i2 = this._isNotExpired(i2); a2 && s2 && i2 && t2.push(e2[n2]); } return t2; } }, { key: "_isNotExpired", value: function(e2) { return !(!e2 || !e2.lastTime) && e2.lastTime > Be() - this.EXPIRED_TIME; } }, { key: "_createPromiseList", value: function(e2) { for (var t2 = [], n2 = 0; n2 < e2.length; n2++) { var o2 = e2[n2], i2 = o2.conversationID, o2 = o2.unreadCount, o2 = o2 < this.COUNT ? o2 : this.COUNT, o2 = (this._map.set(i2, { msgCount: o2, list: [] }), this._sigM.get(11).getMessageList({ conversationID: i2 })); t2.push(o2); } return t2; } }, { key: "_concurrentGetMessageList", value: function(e2) { var i2 = this, a2 = []; return Promise.all(e2).then(function(e3) { for (var t2 = 0; t2 < e3.length; t2++) { var n2 = e3[t2], o2 = n2.code, n2 = n2.data; 0 === o2 && 0 !== n2.messageList.length && (i2._handleMessageList(n2.messageList), o2 = i2._relayGetMessageList(n2)) && a2.push(o2); } return 0 < a2.length ? i2._concurrentGetMessageList(a2) : i2._map; }); } }, { key: "_relayGetMessageList", value: function(e2) { var t2, n2 = e2.messageList, o2 = e2.nextReqMessageID, e2 = e2.isCompleted; return 0 === n2.length || (n2 = n2[0].conversationID, 0 === (t2 = this._map.get(n2).msgCount)) || e2 ? null : this._sigM.get(11).getMessageList({ conversationID: n2, nextReqMessageID: o2, count: t2 }); } }, { key: "_handleMessageList", value: function(e2) { var t2 = e2.length, n2 = e2[0].conversationID, o2 = this._map.get(n2), i2 = o2.msgCount, o2 = o2.list; this._map.set(n2, { msgCount: 0 < i2 - t2 ? i2 - t2 : 0, list: o2.concat(this._sigM.filterMessageList(e2)) }); } }, { key: "_getRelatedToMeMap", value: function(e2) { for (var t2 = 0; t2 < e2.length; t2++) { var n2 = e2[t2]; this._saveRelatedToMe(n2); } return this._relatedToMeMap; } }, { key: "_saveRelatedToMe", value: function(e2) { var t2 = this._sigM.getPayloadData(e2) || {}, n2 = t2.actionType, t2 = t2.inviteID, o2 = void 0 === t2 ? "" : t2; switch (void 0 === n2 ? "" : n2) { case Q.ACTION_TYPE_INVITE: this._setHistoryInvite(e2); break; case Q.ACTION_TYPE_REJECT_INVITE: case Q.ACTION_TYPE_ACCEPT_INVITE: this._updateHistoryInvite(e2); break; case Q.ACTION_TYPE_CANCEL_INVITE: this._delHistoryInvite(o2); break; case Q.ACTION_TYPE_INVITE_TIMEOUT: this._updateHistoryInvite(e2); } } }, { key: "_setHistoryInvite", value: function(e2) { var t2 = this._sigM.getPayloadData(e2) || {}, n2 = t2.inviteID, n2 = void 0 === n2 ? "" : n2, o2 = t2.inviteeList, o2 = void 0 === o2 ? [] : o2, i2 = t2.timeout, i2 = void 0 === i2 ? 0 : i2, a2 = this._sigM.getMyUserID(); o2.includes(a2) && (o2 = Be() - e2.time, 0 < i2 && i2 < o2 && 0 !== i2 || this._relatedToMeMap.set(n2, y(y({}, t2), {}, { messageList: [e2] }))); } }, { key: "_delHistoryInvite", value: function(e2) { this._relatedToMeMap.has(e2) && this._relatedToMeMap.delete(e2); } }, { key: "_updateHistoryInvite", value: function(e2) { var t2 = this._sigM.getPayloadData(e2) || {}, n2 = t2.inviteID, n2 = void 0 === n2 ? "" : n2, t2 = t2.inviteeList, o2 = void 0 === t2 ? [] : t2; if (this._relatedToMeMap.has(n2)) { for (var t2 = this._relatedToMeMap.get(n2), i2 = t2.inviteeList, t2 = t2.messageList, a2 = 0; a2 < o2.length; a2++) { var s2 = o2[a2]; i2.includes(s2) && i2.splice(i2.indexOf(s2), 1); } 0 === i2.length ? this._delHistoryInvite(n2) : t2.push(e2); } else this._delHistoryInvite(n2); } }, { key: "_sortSignaling", value: function(e2) { var t2 = []; return e2.forEach(function(e3) { t2 = [].concat(p(t2), p(e3.messageList)); }), t2.sort(function(e3, t3) { return e3.time - t3.time; }); } }, { key: "reset", value: function() { this._map.clear(), this._relatedToMeMap.clear(); } }]), Cr), _r = e(function e2(t2, n2) { d(this, e2), this.businessID = t2.businessID || 1, this.inviteID = t2.inviteID, this.groupID = t2.groupID || "", this.inviter = t2.inviter || "", this.inviteeList = t2.inviteeList || [], this.data = t2.data || "", this.actionType = t2.actionType || Q.ACTION_TYPE_INVITE, this.timeout = t2.timeout || 0; }), hr = ["message"], gr = ["message"], fr = (t(yr, u), Os = n(yr), e(yr, [{ key: "onC2CUnreadHandleCompleted", value: function() { this._isC2CUnreadHandleCompleted = true, this._isCloudConfigCompleted && this._isConvSyncCompleted && !this._isSyncCompleted && this.onReady(); } }, { key: "onConvSyncCompleted", value: function() { this._isConvSyncCompleted = true, this._isC2CUnreadHandleCompleted && this._isCloudConfigCompleted && !this._isSyncCompleted && this.onReady(); } }, { key: "onCloudConfig", value: function() { this._isCloudConfigCompleted = true; var e2 = this.getCloudConfig("history_s_count"), t2 = this.getCloudConfig("history_s_time"); N(e2) || (e2 = Number(e2)), N(t2) || (t2 = Number(t2)), this._historySignalingHandler.setCloudConfig(e2, t2), this._isC2CUnreadHandleCompleted && this._isConvSyncCompleted && !this._isSyncCompleted && this.onReady(); } }, { key: "_isListenerExisted", value: function() { return -1 < this._m.getOEmitInst().eventNames().indexOf(Q.NEW_INVITATION_RECEIVED); } }, { key: "onReady", value: function() { this._isSyncCompleted = true; var e2 = this._isListenerExisted(); M.l("".concat(this._n, ".onReady. isListenerExisted: ").concat(e2)), e2 && this._historySignalingHandler.getHistorySignaling(); } }, { key: "onNewMessageList", value: function(e2) { e2 = this.filterMessageList(e2); if (0 < e2.length) return this._remoteSignalingHandler.onNewMessageList(e2); } }, { key: "onMessageModified", value: function(e2) { e2 = this.filterMessageList(e2); if (0 < e2.length) return this._remoteSignalingHandler.onMessageModified(e2); } }, { key: "hasInviteInfo", value: function(e2) { return this._inviteInfoMap.has(e2); } }, { key: "getInviteInfo", value: function(e2) { return this._inviteInfoMap.get(e2); } }, { key: "setInviteInfo", value: function(e2, t2) { var n2 = t2.message, t2 = K(t2, hr); M.l("".concat(this._n, ".setInviteInfo inviteID:").concat(e2, " data:"), t2), this._inviteInfoMap.set(e2, y(y({}, t2), {}, { message: n2 })); } }, { key: "deleteInviteInfo", value: function(e2) { this.hasInviteInfo(e2) && (M.l("".concat(this._n, ".deleteInviteInfo inviteID:").concat(e2, ".")), this._inviteInfoMap.delete(e2)); } }, { key: "updateInviteInfo", value: function(e2) { var t2 = "".concat(this._n, ".updateInviteInfo"), n2 = e2.inviteID, o2 = e2.inviter, i2 = e2.inviteeList, e2 = e2.groupID; M.l("".concat(t2, " inviteID:").concat(n2, " inviter:").concat(o2, " groupID:").concat(e2)), e2 && this.hasInviteInfo(n2) && (o2 = i2[0], (e2 = this.getInviteInfo(n2).inviteeList).includes(o2) && (e2.splice(e2.indexOf(o2), 1), M.l("".concat(t2, " remove ").concat(o2, ". localInviteeList.length:").concat(e2.length))), 0 !== e2.length) || this.deleteInviteInfo(n2); } }, { key: "canIUseSignaling", value: function() { return this._canIUseSignaling; } }, { key: "emitEvent", value: function(e2, t2) { this.emitOEvt(e2, t2); } }, { key: "addSignalingListener", value: function(e2, t2, n2) { this._canIUseSignaling || (this._canIUseSignaling = true), this._m.getOEmitInst().on(e2, t2, n2); } }, { key: "removeSignalingListener", value: function(e2, t2, n2) { this._m.getOEmitInst().off(e2, t2, n2), this._isListenerExisted() || (this._canIUseSignaling = false); } }, { key: "invite", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("invite"), o2 = this._localSignalingHandler.createInviteInfo(e2), i2 = o2.message, a2 = o2.customData, s2 = o2.inviteID; return M.l("".concat(n2, " options:").concat(JSON.stringify(e2), " inviteID:").concat(s2)), this.sendSignaling(i2, e2).then(function(e3) { return e3 && 0 === e3.code ? (t2.setInviteInfo(s2, y(y({}, a2), {}, { message: i2 })), t2.startTimer(y(y({}, a2), {}, { inviteID: s2 })), y(y({}, e3), {}, { inviteID: s2 })) : e3; }).catch(function(e3) { return D(e3); }); } }, { key: "inviteSync", value: function(e2, t2, n2) { var o2 = this, i2 = "".concat(this._n, ".").concat("inviteSync"), a2 = this._localSignalingHandler.createInviteInfo(e2), s2 = a2.message, r2 = a2.customData, c2 = a2.inviteID; return M.l("".concat(i2, " options:").concat(JSON.stringify(e2), " inviteID:").concat(c2)), this.sendSignaling(s2, e2).then(function(e3) { if (e3 && 0 === e3.code) return o2.setInviteInfo(c2, y(y({}, r2), {}, { message: s2 })), o2.startTimer(y(y({}, r2), {}, { inviteID: c2 })), t2 && t2({ inviteID: c2 }), { inviteID: c2 }; n2 && n2(0 === e3.code, e3.message || ""); }).catch(function(e3) { return n2 && n2(e3.code, e3.message), D(e3); }), c2; } }, { key: "_handleImResponse", value: function(e2, t2, n2) { t2 && 0 === t2.code && (this._isHandling = false, n2 ? this.deleteInviteInfo(e2.inviteID) : this.updateInviteInfo(e2)); } }, { key: "cancel", value: function(t2) { var n2 = this, e2 = "".concat(this._n, ".").concat("cancel"); if (M.l("".concat(e2, " options:").concat(JSON.stringify(t2))), !this.hasInviteInfo(t2.inviteID) || this._isHandling) return D({ code: L.INVALID_CANCEL_MESSAGE }); this._isHandling = true; var o2, i2 = this._localSignalingHandler.createCancelCustomData(t2); return i2 ? (e2 = i2.groupID, o2 = i2.inviteeList, e2 = e2 || o2[0], o2 = this.createSignaling(i2, e2), this.sendSignaling(o2, t2).then(function(e3) { return n2._handleImResponse(i2, e3, true), 0 === e3.code ? y(y({}, e3), {}, { inviteID: t2.inviteID }) : e3; }).catch(function(e3) { return D(e3); })) : (this._isHandling = false, D({ code: L.SIGNALING_NO_PERMISSION })); } }, { key: "accept", value: function(t2) { var n2 = this, e2 = "".concat(this._n, ".").concat("accept"); if (M.l("".concat(e2, " options:").concat(JSON.stringify(t2))), !this.hasInviteInfo(t2.inviteID) || this._isHandling) return D({ code: L.SIGNALING_INVALID_INVITE_ID }); this._isHandling = true; var o2 = this._localSignalingHandler.createAcceptCustomData(t2); return o2 ? (e2 = this.createSignaling(o2), this.sendSignaling(e2, t2).then(function(e3) { return n2._handleImResponse(o2, e3), 0 === e3.code ? y(y({}, e3), {}, { inviteID: t2.inviteID }) : e3; }).catch(function(e3) { return D(e3); })) : (this._isHandling = false, D({ code: L.SIGNALING_NO_PERMISSION })); } }, { key: "reject", value: function(t2) { var n2 = this, e2 = "".concat(this._n, ".").concat("reject"); if (M.l("".concat(e2, " options:").concat(JSON.stringify(t2))), !this.hasInviteInfo(t2.inviteID) || this._isHandling) return D({ code: L.SIGNALING_INVALID_INVITE_ID }); this._isHandling = true; var o2 = this._localSignalingHandler.createRejectCustomData(t2); return o2 ? (e2 = this.createSignaling(o2), this.sendSignaling(e2, t2).then(function(e3) { return n2._handleImResponse(o2, e3, true), 0 === e3.code ? y(y({}, e3), {}, { inviteID: t2.inviteID }) : e3; }).catch(function(e3) { return D(e3); })) : (this._isHandling = false, D({ code: L.SIGNALING_NO_PERMISSION })); } }, { key: "getSignalingInfo", value: function(e2) { var t2 = "".concat(this._n, ".getSignalingInfo"), n2 = e2.ID, o2 = e2.from, i2 = e2.to, a2 = this._filterSignaling(e2), s2 = null, e2 = (a2 && (e2 = this.getPayloadData(e2), s2 = new _r(e2)), a2 ? "actionType:".concat(s2.actionType) : ""); return M.l("".concat(t2, " messageID:").concat(n2, " from:").concat(o2, " to:").concat(i2, " ") + "".concat(e2, " isSignaling:").concat(a2)), s2; } }, { key: "modifyInvitation", value: function(e2) { var t2 = this, n2 = e2.inviteID, o2 = e2.data; if (!this.hasInviteInfo(e2.inviteID) || this._isHandling) return D({ code: L.SIGNALING_INVALID_INVITE_ID }); this._isHandling = true; var e2 = this.getInviteInfo(n2), i2 = e2.message, a2 = K(e2, gr), s2 = i2.payload.data; return a2.data = o2, i2.payload.data = JSON.stringify(a2), this.get(2).modifyRemoteMessage(i2).then(function(e3) { return t2.setInviteInfo(n2, y(y({}, a2), {}, { message: i2 })), t2._isHandling = false, e3; }).catch(function(e3) { return t2._isHandling = false, i2.payload.data = s2, D(e3); }); } }, { key: "_genMsgCtrlInfo", value: function() { var e2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, t2 = e2.data, t2 = void 0 === t2 ? "" : t2, n2 = e2.onlineUserOnly, o2 = e2.inviteID, o2 = void 0 === o2 ? "" : o2, i2 = e2.offlinePushInfo, e2 = e2.actionType, a2 = { _onlineOnlyFlag: false }, o2 = { onlineUserOnly: (a2 = o2 && this.getInviteInfo(o2) ? this.getInviteInfo(o2).message : a2)._onlineOnlyFlag || n2 || false, offlinePushInfo: i2, messageControlInfo: { excludedFromContentModeration: true, excludedFromUnreadCount: false, excludedFromLastMessage: false } }; return e2 === Q.ACTION_TYPE_INVITE_TIMEOUT ? (a2 = !!t2.match(/excludeTimeoutSignalingFromHistoryMessage/), o2.messageControlInfo.excludedFromUnreadCount = a2, o2.messageControlInfo.excludedFromLastMessage = a2) : (n2 = !!t2.match(/excludeFromHistoryMessage/), i2 = !!t2.match(/excludeOriginalSignalingFromHistoryMessage/), o2.messageControlInfo.excludedFromUnreadCount = n2 || i2, o2.messageControlInfo.excludedFromLastMessage = n2 || i2), o2; } }, { key: "sendSignaling", value: function(e2, t2) { var n2 = this; return this.get(2).sendMessageInstance(e2, this._genMsgCtrlInfo(t2)).catch(function(e3) { return n2._isHandling = false, D(e3); }); } }, { key: "filterMessageList", value: function(e2) { var t2 = this; return e2.filter(function(e3) { return t2._filterSignaling(e3); }); } }, { key: "getPayloadData", value: function(e2) { return this._remoteSignalingHandler.getPayloadData(e2); } }, { key: "createSignaling", value: function(e2, t2) { var n2 = e2.groupID, o2 = e2.inviter, t2 = { to: t2 || n2 || o2, conversationType: n2 ? A.CONV_GROUP : A.CONV_C2C, priority: A.MSG_PRIORITY_HIGH, payload: { data: JSON.stringify(e2) } }, o2 = this.get(2).createCustomMessage(t2); return M.l("".concat(this._n, ".createSignaling. message:"), o2), o2; } }, { key: "_filterSignaling", value: function(e2) { var t2, n2, o2 = false; return e2.type && e2.type === A.MSG_CUSTOM && (t2 = e2.cloudCustomData, e2 = void 0 === (e2 = e2.payload.data) ? "" : e2, t2 = (void 0 === t2 ? "" : t2).match(/"type":"tsignaling"/), n2 = e2.match(/inviteID/), e2 = e2.match(/actionType/), o2 = t2 || n2 && e2), !!o2; } }, { key: "startTimer", value: function(t2) { var n2, o2, i2, a2 = this, s2 = "".concat(this._n, ".startTimer"), e2 = t2.timeout, r2 = t2.inviteID, c2 = t2.inviter, u2 = t2.groupID, l2 = c2 === this.getMyUserID(); M.l("".concat(s2, " timeout:").concat(e2, " isInviter:").concat(l2, " groupID:").concat(u2)), e2 <= 0 || (n2 = l2 ? e2 + 5 : e2, o2 = 1, i2 = setInterval(function() { var e3 = a2._hasLocalInviteInfo(t2, l2); o2 < n2 && e3 ? ++o2 : (e3 && a2._sendTimeoutNotice(r2, l2), M.l("".concat(s2, " end.")), clearInterval(i2)); }, 1e3)); } }, { key: "_hasLocalInviteInfo", value: function(e2, t2) { var n2, o2, i2 = e2.inviteID, e2 = e2.groupID; return !!this.hasInviteInfo(i2) && (n2 = "".concat(this._n, "._hasLocalInviteInfo"), o2 = this.getInviteInfo(i2).inviteeList, M.l("".concat(n2, " inviteID:").concat(i2, " inviteeList:").concat(o2, " groupID:").concat(e2)), !e2 || (t2 ? 0 < o2.length : 0 < o2.length && o2.includes(this.getMyUserID()))); } }, { key: "_getReceiver", value: function(e2, t2) { var n2 = t2.groupID, o2 = t2.inviteeList, t2 = t2.inviter; return e2 ? n2 || o2[0] : n2 || t2; } }, { key: "_sendTimeoutNotice", value: function(i2, a2) { var s2 = this, e2 = this.getInviteInfo(i2), t2 = this._getReceiver(a2, e2), r2 = (M.l("".concat(this._n, "._sendTimeoutNotice inviteID:").concat(i2, " to:").concat(t2, " isInviter:").concat(a2)), this._localSignalingHandler.createTimeoutCustomData(y(y({}, e2), {}, { isInviter: a2 }))), c2 = this.createSignaling(r2, t2); return this.sendSignaling(c2, r2).then(function(e3) { var t3, n2, o2; e3 && 0 === e3.code && (e3 = r2.data, t3 = r2.groupID, n2 = r2.inviteeList, o2 = r2.inviter, s2.emitEvent(Q.INVITATION_TIMEOUT, { data: e3, groupID: t3, inviteID: i2, inviteeList: n2, inviter: o2, isSelfTimeout: true, message: c2 }), a2 ? s2.deleteInviteInfo(i2) : s2.updateInviteInfo(r2)); }); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._inviteInfoMap.clear(), this._canIUseSignaling = false, this._isHandling = false, this._historySignalingHandler.reset(), this._isC2CUnreadHandleCompleted = false, this._isConvSyncCompleted = false, this._isSyncCompleted = false, this._isCloudConfigCompleted = false; } }]), yr), mr = ["followDiffList"], vr = { NONE: 0, FOLLOWERS: 1, FOLLOWING: 2, MUTUAL: 3 }, Ir = (t(Mr, u), Rs = n(Mr), e(Mr, [{ key: "_onCloudConfig", value: function() { var e2 = this.getCloudConfig("follow_req_count"); N(e2) || (e2 = Number(e2), this.DEFAULT_COUNT = e2 > this.MAX_COUNT ? this.MAX_COUNT : e2, this._clearFollowList()); } }, { key: "clearCacheOnReconnected", value: function() { this._clearFollowList(), this._followType.clear(); } }, { key: "onFollowNotify", value: function(e2) { var i2 = this, e2 = e2.dataList || []; M.l("".concat(this._n, ".onFollowNotify followChangeList:").concat(e2.length)), e2.forEach(function(e3) { var t2 = e3.followDiffList, t2 = void 0 === t2 ? [] : t2, o2 = K(e3, mr); t2.forEach(function(e4) { var t3 = e4.isAdd, e4 = e4.followType, e4 = void 0 === e4 ? [] : e4, n2 = i2._initFollowInfo(); n2[e4].userInfoList.push(o2), n2[e4].isAdd = 1 === t3, i2._emitEvent(n2); }); }); } }, { key: "_initFollowInfo", value: function() { var t2 = {}; return Object.values(vr).forEach(function(e2) { e2 !== vr.NONE && (t2[e2] = { userInfoList: [], isAdd: false }); }), t2; } }, { key: "_emitEvent", value: function(n2) { var o2 = this; Object.keys(n2).forEach(function(e2) { var e2 = Number(e2), t2 = n2[e2]; 0 < t2.userInfoList.length && (e2 === vr.FOLLOWERS && (o2._clearFollowList(vr.FOLLOWERS), o2.emitOEvt(h.MY_FOLLOWERS_LIST_UPDATED, t2)), e2 === vr.FOLLOWING && (o2._clearFollowList(vr.FOLLOWING), o2.emitOEvt(h.MY_FOLLOWING_LIST_UPDATED, t2)), e2 === vr.MUTUAL) && (o2._clearFollowList(vr.MUTUAL), o2.emitOEvt(h.MUTUAL_FOLLOWERS_LIST_UPDATED, t2)); }); } }, { key: "followUser", value: function(e2) { var t2, n2, o2; return this.canIUse(_.FOLLOW) ? (t2 = "".concat(this._n, ".").concat("followUser"), n2 = "userIDList:".concat(e2.length), (o2 = new G("followUser")).setMessage(n2), M.l("".concat(t2, " ").concat(n2)), this.req({ P: k.FOLLOW, data: { fromAccount: this.getMyUserID(), userIDList: e2.map(function(e3) { return { userID: e3 }; }) } }).then(function(e3) { return o2.end(), M.l("".concat(t2, " ok.")), C(e3.data.resultList); }).catch(function(e3) { return o2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this.noUse("followUser"); } }, { key: "unfollowUser", value: function(e2) { var t2, n2, o2; return this.canIUse(_.FOLLOW) ? (t2 = "".concat(this._n, ".").concat("unfollowUser"), n2 = "userIDList:".concat(e2.length), (o2 = new G("unfollowUser")).setMessage(n2), M.l("".concat(t2, " ").concat(n2)), this.req({ P: k.UNFOLLOW, data: { fromAccount: this.getMyUserID(), userIDList: e2 } }).then(function(e3) { return o2.end(), M.l("".concat(t2, " ok.")), C(e3.data.resultList); }).catch(function(e3) { return o2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this.noUse("unfollowUser"); } }, { key: "getMyFollowersList", value: function() { var t2 = this, n2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "", o2 = "getMyFollowersList"; if (!this.canIUse(_.FOLLOW)) return this.noUse(o2); var i2 = n2 || this.FIRST_PAGE_INDEX; if (this._myFollowersList.has(i2)) { var e2 = this._myFollowersList.get(i2), a2 = e2.resultList, s2 = e2.nextCursor, e2 = e2.lastUpdateTime; if (Date.now() - e2 < this.MAX_CATCH_TIME && 0 < a2.length) return M.l("".concat(this._n, ".").concat(o2, " nextCursor:").concat(n2, " from local.")), T({ resultList: a2, nextCursor: s2 }); } return this._getFollowList(n2, vr.FOLLOWERS).then(function(e3) { return t2._myFollowersList.set(i2, y(y({}, e3), {}, { lastUpdateTime: Date.now() })), M.l("".concat(t2._n, ".").concat(o2, " nextCursor:").concat(n2, " from remote.")), C(e3); }); } }, { key: "getMyFollowingList", value: function() { var t2 = this, n2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "", o2 = "getMyFollowingList"; if (!this.canIUse(_.FOLLOW)) return this.noUse(o2); var i2 = n2 || this.FIRST_PAGE_INDEX; if (this._myFollowingList.has(i2)) { var e2 = this._myFollowingList.get(i2), a2 = e2.resultList, s2 = e2.nextCursor, e2 = e2.lastUpdateTime; if (Date.now() - e2 < this.MAX_CATCH_TIME && 0 < a2.length) return M.l("".concat(this._n, ".").concat(o2, " nextCursor:").concat(n2, " from local.")), T({ resultList: a2, nextCursor: s2 }); } return this._getFollowList(n2, vr.FOLLOWING).then(function(e3) { return t2._myFollowingList.set(i2, y(y({}, e3), {}, { lastUpdateTime: Date.now() })), M.l("".concat(t2._n, ".").concat(o2, " nextCursor:").concat(n2, " from remote.")), C(e3); }); } }, { key: "getMutualFollowersList", value: function() { var t2 = this, n2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "", o2 = "getMutualFollowersList"; if (!this.canIUse(_.FOLLOW)) return this.noUse(o2); var i2 = n2 || this.FIRST_PAGE_INDEX; if (this._myMutualFollowersList.has(i2)) { var e2 = this._myMutualFollowersList.get(i2), a2 = e2.resultList, s2 = e2.nextCursor, e2 = e2.lastUpdateTime; if (Date.now() - e2 < this.MAX_CATCH_TIME && 0 < a2.length) return M.l("".concat(this._n, ".").concat(o2, " nextCursor:").concat(n2, " from local.")), T({ resultList: a2, nextCursor: s2 }); } return this._getFollowList(n2, vr.MUTUAL).then(function(e3) { return t2._myMutualFollowersList.set(i2, y(y({}, e3), {}, { lastUpdateTime: Date.now() })), M.l("".concat(t2._n, ".").concat(o2, " nextCursor:").concat(n2, " from remote.")), C(e3); }); } }, { key: "_getFollowList", value: function(e2, t2) { var i2 = this, n2 = new G("_getFollowList"); return n2.setMessage("nextCursor:".concat(e2, " type:").concat(t2)), this.req({ P: k.GET_FOLLOW, data: { fromAccount: this.getMyUserID(), count: this.DEFAULT_COUNT, nextCursor: e2, type: t2 } }).then(function(e3) { n2.end(); var e3 = e3.data, t3 = e3.resultList, t3 = void 0 === t3 ? [] : t3, e3 = e3.nextCursor, e3 = void 0 === e3 ? "" : e3, o2 = []; return t3.forEach(function(e4) { var t4 = e4.userID, n3 = e4.followTime, e4 = e4.profileList; o2.push(y({ userID: t4, followTime: n3 }, i2._handleProfileItem(void 0 === e4 ? [] : e4))); }), { resultList: o2, nextCursor: e3 }; }).catch(function(e3) { return n2.setError(e3).end(), M.e("".concat(i2._n, "._getFollowList failed. error:"), e3), D(e3); }); } }, { key: "_handleProfileItem", value: function(e2) { var t2 = {}; return e2.forEach(function(e3) { switch (e3.tag) { case g.NICK: t2.nick = e3.value; break; case g.GENDER: t2.gender = e3.value; break; case g.BIRTHDAY: t2.birthday = e3.value; break; case g.LOCATION: t2.location = e3.value; break; case g.SELFSIGNATURE: t2.selfSignature = e3.value; break; case g.ALLOWTYPE: t2.allowType = e3.value; break; case g.LANGUAGE: t2.language = e3.value; break; case g.AVATAR: t2.avatar = e3.value; break; case g.MESSAGESETTINGS: t2.messageSettings = e3.value; break; case g.ADMINFORBIDTYPE: t2.adminForbidType = e3.value; break; case g.LEVEL: t2.level = e3.value; break; case g.ROLE: t2.role = e3.value; break; default: t2[e3.tag] = e3.value; } }), t2; } }, { key: "getUserFollowInfo", value: function(e2) { var t2, n2, i2; return this.canIUse(_.FOLLOW) ? (n2 = false, N(e2 = e2) && (e2 = [this.getMyUserID()], n2 = true), t2 = "".concat(this._n, ".").concat("getUserFollowInfo"), n2 = "userIDList:".concat(e2.length, " isGetMyFollowInfo:").concat(n2), (i2 = new G("getUserFollowInfo")).setMessage(n2), M.l("".concat(t2, " ").concat(n2)), this.req({ P: k.GET_FOLLOW_INFO, data: { fromAccount: this.getMyUserID(), userIDList: e2 } }).then(function(e3) { i2.end(), M.l("".concat(t2, " ok.")); var e3 = e3.data.followInfoList, o2 = []; return (void 0 === e3 ? [] : e3).forEach(function(e4) { var t3 = e4.followersCount, n3 = e4.followingCount, e4 = e4.mutualFollowersCount; o2.push({ followersCount: t3, followingCount: n3, mutualFollowersCount: e4 }); }), C(o2); }).catch(function(e3) { return i2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); })) : this.noUse("getUserFollowInfo"); } }, { key: "checkFollowType", value: function(e2) { var n2 = this; if (!this.canIUse(_.FOLLOW)) return this.noUse("checkFollowType"); 100 < e2.length && (e2 = e2.slice(0, 100), M.w("".concat(t2, " ").concat($t(100)))); var t2 = "".concat(this._n, ".").concat("checkFollowType"), o2 = "userIDList length:".concat(e2.length, " "), i2 = new G("checkFollowType"), a2 = (i2.setMessage(o2), M.l("".concat(t2, " ").concat(o2)), []), s2 = []; return e2.forEach(function(e3) { var t3; n2._followType.has(e3) ? (t3 = n2._followType.get(e3), a2.push({ userID: e3, followType: t3 })) : s2.push(e3); }), M.l("".concat(t2, " from local count:").concat(a2.length, ", from remote count:").concat(s2.length, ".")), 0 === s2.length ? T(a2) : this.req({ P: k.CHECK_FOLLOW_TYPE, data: { fromAccount: this.getMyUserID(), userIDList: s2 } }).then(function(e3) { i2.end(), M.l("".concat(t2, " ok.")); e3 = e3.data.resultList; return (void 0 === e3 ? [] : e3).forEach(function(e4) { var t3 = e4.userID, e4 = e4.followType; n2._setFollowType(t3, e4), a2.push({ userID: t3, followType: e4 }); }), C(a2); }).catch(function(e3) { return i2.setError(e3).end(), M.e("".concat(t2, " failed. error:"), e3), D(e3); }); } }, { key: "_setFollowType", value: function(e2, t2) { this._followType.set(e2, t2); } }, { key: "_clearFollowList", value: function(e2) { N(e2) ? (this._myFollowersList.clear(), this._myFollowingList.clear(), this._myMutualFollowersList.clear()) : e2 !== vr.FOLLOWERS ? e2 !== vr.FOLLOWING ? e2 === vr.MUTUAL && this._myMutualFollowersList.clear() : this._myFollowingList.clear() : this._myFollowersList.clear(); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._clearFollowList(), this._followType.clear(); } }]), Mr), ie = ma(function(e2, t2) { var n2 = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array; t2.assign = function(e3) { for (var t3, n3, o3 = Array.prototype.slice.call(arguments, 1); o3.length; ) { var i3 = o3.shift(); if (i3) { if ("object" !== b(i3)) throw new TypeError(i3 + "must be non-object"); for (var a2 in i3) t3 = i3, n3 = a2, Object.prototype.hasOwnProperty.call(t3, n3) && (e3[a2] = i3[a2]); } } return e3; }, t2.shrinkBuf = function(e3, t3) { return e3.length === t3 ? e3 : e3.subarray ? e3.subarray(0, t3) : (e3.length = t3, e3); }; var o2 = { arraySet: function(e3, t3, n3, o3, i3) { if (t3.subarray && e3.subarray) e3.set(t3.subarray(n3, n3 + o3), i3); else for (var a2 = 0; a2 < o3; a2++) e3[i3 + a2] = t3[n3 + a2]; }, flattenChunks: function(e3) { for (var t3, n3, o3, i3 = 0, a2 = 0, s2 = e3.length; a2 < s2; a2++) i3 += e3[a2].length; for (o3 = new Uint8Array(i3), a2 = t3 = 0, s2 = e3.length; a2 < s2; a2++) n3 = e3[a2], o3.set(n3, t3), t3 += n3.length; return o3; } }, i2 = { arraySet: function(e3, t3, n3, o3, i3) { for (var a2 = 0; a2 < o3; a2++) e3[i3 + a2] = t3[n3 + a2]; }, flattenChunks: function(e3) { return [].concat.apply([], e3); } }; t2.setTyped = function(e3) { e3 ? (t2.Buf8 = Uint8Array, t2.Buf16 = Uint16Array, t2.Buf32 = Int32Array, t2.assign(t2, o2)) : (t2.Buf8 = Array, t2.Buf16 = Array, t2.Buf32 = Array, t2.assign(t2, i2)); }, t2.setTyped(n2); }); function Mr(e2) { return d(this, Mr), (e2 = Rs.call(this, e2))._n = "FollowModule", e2._myFollowersList = /* @__PURE__ */ new Map(), e2._myFollowingList = /* @__PURE__ */ new Map(), e2._myMutualFollowersList = /* @__PURE__ */ new Map(), e2._followType = /* @__PURE__ */ new Map(), e2.MAX_CATCH_TIME = 6e5, e2.FIRST_PAGE_INDEX = mt(), e2.DEFAULT_COUNT = 500, e2.MAX_COUNT = 1e3, e2.getIEmitInst().on(P.CLOUD_CONFIG, e2._onCloudConfig, i(e2)), e2; } function yr(e2) { d(this, yr), (e2 = Os.call(this, e2))._n = "SignalingModule", e2._inviteInfoMap = /* @__PURE__ */ new Map(), e2._canIUseSignaling = false, e2._isHandling = false, e2._remoteSignalingHandler = new lr(i(e2)), e2._localSignalingHandler = new dr(i(e2)), e2._historySignalingHandler = new pr(i(e2)), e2._isC2CUnreadHandleCompleted = false, e2._isConvSyncCompleted = false, e2._isSyncCompleted = false, e2._isCloudConfigCompleted = false; var t2 = e2.getIEmitInst(); return t2.on(P.C2C_UNREAD_HANDLE_COMPLETED, e2.onC2CUnreadHandleCompleted, i(e2)), t2.on(P.CONV_SYNC_COMPLETED, e2.onConvSyncCompleted, i(e2)), t2.on(P.CLOUD_CONFIG, e2.onCloudConfig, i(e2)), e2; } function Cr(e2) { d(this, Cr), this._n = "HistorySignalingHandler", this._sigM = e2, this.COUNT = 20, this.EXPIRED_TIME = 300, this._map = /* @__PURE__ */ new Map(), this._relatedToMeMap = /* @__PURE__ */ new Map(); } function Tr(e2) { d(this, Tr), this._n = "LocalSignalingHandler", this._sigM = e2; } function Dr(e2) { d(this, Dr), this._n = "RemoteSignalingHandler", this._sigM = e2; } function Er(e2) { d(this, Er), this._m = e2, this._n = "ErrMsgModule", this.TIM_ERROR_ASSISTANCE = "tim_error_assistance", this.STORAGE_EXPIRES_TIME = 6048e5, this._map = /* @__PURE__ */ new Map(), this._init(); } function Lr(e2) { d(this, Lr), this._m = e2, this._n = "TransCmdModule", this._TRTCCommandList = ["tui_room_svr.*", "callkit_records_svr.*", "room_engine_srv.*", "room_engine_http_srv.*", "room_engine_mic.*", "live_engine_srv.*", "live_engine_http_srv.*", "live_engine_pk.*", "trtc_ai_service.*"], this._TRTCCommandMap = /* @__PURE__ */ new Map(), this._setTRTCCommandMap(), this._m.getIEmitInst().on(P.CLOUD_CONFIG, this._onCloudConfig, this); } function Sr(e2) { return d(this, Sr), (e2 = Ns.call(this, e2))._n = "ProfanityFilterModule", e2._plugin = null, e2._filterConfigMap = /* @__PURE__ */ new Map(), e2._startIndex = 0, e2._version = 0, e2._canIUseLexicon = false, e2._isFetching = false, e2._expiredTime = 0, e2; } function kr(e2) { var t2; return d(this, kr), (t2 = Gs.call(this, e2))._m = e2, t2._n = "TIMPushModule", t2._pluginName = "TIMPush", t2._pushPlugin = void 0, t2._androidPushConfig = {}, t2._deviceToken = "", t2._businessID = 0, t2._iOSBusinessID = 0, t2._c2cUnreadCount = 0, t2._groupUnreadCount = 0, t2._isWebUniapp = 0, t2._deviceInfo = { notificationStatus: 0, deviceModel: "", systemVersion: "", pushVersion: "1.0.1", packageName: "" }, t2; } function Ar(e2) { var t2; return d(this, Ar), (t2 = Ps.call(this, e2))._m = e2, t2._n = "OfflinePushModule", t2._offlinePushPlugin = void 0, t2._androidPushConfig = { huaweiPushBussinessId: "", xiaomiPushBussinessId: "", xiaomiPushAppId: "", xiaomiPushAppKey: "", meizuPushBussinessId: "", meizuPushAppId: "", meizuPushAppKey: "", vivoPushBussinessId: "", fcmPushBussinessId: "", oppoPushBussinessId: "", oppoPushAppKey: "", oppoPushAppSecret: "", honorPushBussinessId: "" }, t2._deviceToken = "", t2._businessID = 0, t2._iosBusinessID = 0, t2._c2cUnreadCount = 0, t2._groupUnreadCount = 0, t2._isWebUniapp = 0, t2; } function Rr(e2) { d(this, Rr), this._m = e2, this._n = "CommercialConfigModule", this._expiredTime = 0, this._isFetching = false, this._purchasedFeatureHandler = new or(this); } function Or(e2) { d(this, Or), this._commercialConfigM = e2, this._n = "PurchasedFeatureHandler", this._isSCMReported = false, this._featureMap = /* @__PURE__ */ new Map(); } function Nr(e2) { return d(this, Nr), (e2 = Us.call(this, e2))._n = "WorkerTimerModule", e2._isWorkerEnabled = true, e2._workerTimer = null, e2._timerID = -1, e2._init(), e2.getIEmitInst().on(P.CLOUD_CONFIG, e2._onCloudConfig, i(e2)), e2; } function Gr(e2) { return d(this, Gr), (e2 = bs.call(this, e2))._n = "SnsModule", e2._friendHandler = new Qs(i(e2)), e2._friendApplicationHandler = new Xs(i(e2)), e2._friendGroupHandler = new er(i(e2)), e2.getIEmitInst().on(P.A2KEY_AND_TINYID_UPDATED, e2.onContextUpdated, i(e2)), e2; } function Pr(e2) { d(this, Pr), this._snsM = e2, this._n = "FriendGroupHandler", this._map = /* @__PURE__ */ new Map(); } function Ur(e2) { d(this, Ur), S(e2) || (this.name = e2.name || "", this.userIDList = e2.userIDList || [], this.count = this.userIDList.length || 0); } function br(e2) { d(this, br), this._snsM = e2, this._n = "FriendHandler", this._map = /* @__PURE__ */ new Map(), this._startIdx = 0, this._standardSeq = 0, this._customSeq = 0, this._expirationTime = 18e4; } function wr(e2, t2) { d(this, wr), this.userID = e2, this.remark = "", this.groupList = [], this.source = "", this.addTime = 0, this.friendCustomField = [], this.timestamp = 0; var n2 = {}, o2 = []; if (n2.userID = e2, !S(t2)) for (var i2, a2 = "", s2 = 0, r2 = t2.length; s2 < r2; s2++) if (a2 = t2[s2].tag, i2 = t2[s2].value, -1 < a2.indexOf("Tag_SNS_Custom")) this.friendCustomField.push({ key: a2, value: i2 }); else if (-1 < a2.indexOf("Tag_Profile_Custom")) o2.push({ key: a2, value: i2 }); else switch (a2) { case g.NICK: n2.nick = i2; break; case g.GENDER: n2.gender = i2; break; case g.BIRTHDAY: n2.birthday = i2; break; case g.LOCATION: n2.location = i2; break; case g.SELFSIGNATURE: n2.selfSignature = i2; break; case g.ALLOWTYPE: n2.allowType = i2; break; case g.LANGUAGE: n2.language = i2; break; case g.AVATAR: n2.avatar = i2; break; case g.MESSAGESETTINGS: n2.messageSettings = i2; break; case g.ADMINFORBIDTYPE: n2.adminForbidType = i2; break; case g.LEVEL: n2.level = i2; break; case g.ROLE: n2.role = i2; break; case Ze.REMARK: this.remark = i2; break; case Ze.ADDTIME: this.addTime = i2; break; case Ze.GROUP: this.groupList = JSON.parse(JSON.stringify(i2)); break; case Ze.ADDSOURCE: this.source = i2; break; case Ze.ADDWORDING: break; default: M.l("snsProfileItem unknown tag->", t2[s2].tag); } this.profile = new ei(y(y({}, n2), {}, { profileCustomField: o2 })); } function Fr(e2) { d(this, Fr), this._snsM = e2, this._n = "FriendApplicationHandler", this._startTime = 0, this._maxLimited = 100, this._currentSeq = 0, this._map = /* @__PURE__ */ new Map(), this._unreadCount = 0; } function qr(e2) { d(this, qr), (e2 = ws.call(this, e2))._n = "QualityStatModule", e2.TAG = "im-ssolog-quality-stat", e2.reportIndex = 0, e2.wholePeriod = false, e2._qualityItems = [xn, Vn, Hn, Bn, Kn, Yn, Wn, jn, Jn, zn], e2._messageSentItems = [Hn, Bn, Kn, Yn, Wn], e2._messageReceivedItems = [jn, Jn, zn], e2.REPORT_INTERVAL = 120, e2.REPORT_SDKAPPID_BLACKLIST = [], e2.REPORT_TINYID_WHITELIST = [], e2._statInfoArr = [], e2._avgRTT = new Ys(), e2._avgE2EDelay = new Ks(), e2._rateMessageSent = new Ws(), e2._rateMessageReceived = new js(); var t2 = e2.getIEmitInst(); return t2.on(P.A2KEY_AND_TINYID_UPDATED, e2._onLoginSuccess, i(e2)), t2.on(P.CLOUD_CONFIG, e2._onCloudConfig, i(e2)), e2; } function xr() { d(this, xr), this._lastMap = /* @__PURE__ */ new Map(), this._currentMap = /* @__PURE__ */ new Map(); } function Vr() { d(this, Vr), this._map = /* @__PURE__ */ new Map(); } function Hr() { d(this, Hr), this._n = "AvgRTT", this._requestCount = 0, this._rttArray = []; } function Br() { d(this, Br), this._n = "AvgE2EDelay", this._e2eDelayArray = []; } function Kr(e2) { return d(this, Kr), (e2 = Fs.call(this, e2))._n = "RecoverMsgModule", e2.PULL_LIMIT_COUNT = 15, e2; } function Yr(e2) { return d(this, Yr), (e2 = qs.call(this, e2))._n = "CloudControlModule", e2._cloudConfig = /* @__PURE__ */ new Map(), e2._expiredTime = 0, e2._version = 0, e2._isFetching = false, e2; } function Wr(e2) { return d(this, Wr), (e2 = xs.call(this, e2))._n = "SessionModule", e2._platform = e2.getPlatform(), e2._pHandler = new hs(i(e2)), e2._msgDispatcher = new fs(i(e2)), e2._cmdFreqLimitMap = /* @__PURE__ */ new Map(), e2._cmdReqInfoMap = /* @__PURE__ */ new Map(), e2._serverOverloadInfoMap = /* @__PURE__ */ new Map(), e2._incrementalPullContactFlag = true, e2._init(), e2.getIEmitInst().on(P.CLOUD_CONFIG, e2._onCloudConfig, i(e2)), e2; } ie.assign, ie.shrinkBuf, ie.setTyped, ie.Buf8, ie.Buf16, ie.Buf32; function jr(e2, t2, n2, o2) { for (var i2 = 65535 & e2 | 0, a2 = e2 >>> 16 & 65535 | 0, s2 = 0; 0 !== n2; ) { for (n2 -= s2 = 2e3 < n2 ? 2e3 : n2; a2 = a2 + (i2 = i2 + t2[o2++] | 0) | 0, --s2; ) ; i2 %= 65521, a2 %= 65521; } return i2 | a2 << 16 | 0; } function Jr(e2, t2, n2, o2) { var i2 = Xr, a2 = o2 + n2; e2 ^= -1; for (var s2 = o2; s2 < a2; s2++) e2 = e2 >>> 8 ^ i2[255 & (e2 ^ t2[s2])]; return -1 ^ e2; } function zr(e2, t2, n2, o2, i2, a2, s2, r2) { for (var c2, u2, l2, d2, p2, _2, h2, g2, f2, m2 = r2.bits, v2 = 0, I2 = 0, M2 = 0, y2 = 0, C2 = 0, T2 = 0, D2 = 0, E2 = 0, L2 = 0, S2 = 0, k2 = null, A2 = 0, R2 = new ie.Buf16(16), O2 = new ie.Buf16(16), N2 = null, G2 = 0, v2 = 0; v2 <= 15; v2++) R2[v2] = 0; for (I2 = 0; I2 < o2; I2++) R2[t2[n2 + I2]]++; for (C2 = m2, y2 = 15; 1 <= y2 && 0 === R2[y2]; y2--) ; if (y2 < C2 && (C2 = y2), 0 === y2) i2[a2++] = 20971520, i2[a2++] = 20971520, r2.bits = 1; else { for (M2 = 1; M2 < y2 && 0 === R2[M2]; M2++) ; for (C2 < M2 && (C2 = M2), v2 = E2 = 1; v2 <= 15; v2++) if ((E2 = (E2 << 1) - R2[v2]) < 0) return -1; if (0 < E2 && (0 === e2 || 1 !== y2)) return -1; for (O2[1] = 0, v2 = 1; v2 < 15; v2++) O2[v2 + 1] = O2[v2] + R2[v2]; for (I2 = 0; I2 < o2; I2++) 0 !== t2[n2 + I2] && (s2[O2[t2[n2 + I2]]++] = I2); if (_2 = 0 === e2 ? (k2 = N2 = s2, 19) : 1 === e2 ? (k2 = Zr, A2 -= 257, N2 = Qr, G2 -= 257, 256) : (k2 = $r, N2 = ec, -1), v2 = M2, p2 = a2, D2 = I2 = S2 = 0, l2 = -1, d2 = (L2 = 1 << (T2 = C2)) - 1, 1 === e2 && 852 < L2 || 2 === e2 && 592 < L2) return 1; for (; ; ) { for (f2 = s2[I2] < _2 ? (g2 = 0, s2[I2]) : s2[I2] > _2 ? (g2 = N2[G2 + s2[I2]], k2[A2 + s2[I2]]) : (g2 = 96, 0), c2 = 1 << (h2 = v2 - D2), M2 = u2 = 1 << T2; i2[p2 + (S2 >> D2) + (u2 -= c2)] = h2 << 24 | g2 << 16 | f2 | 0, 0 !== u2; ) ; for (c2 = 1 << v2 - 1; S2 & c2; ) c2 >>= 1; if (0 !== c2 ? S2 = (S2 & c2 - 1) + c2 : S2 = 0, I2++, 0 == --R2[v2]) { if (v2 === y2) break; v2 = t2[n2 + s2[I2]]; } if (C2 < v2 && (S2 & d2) !== l2) { for (p2 += M2, E2 = 1 << (T2 = v2 - (D2 = 0 === D2 ? C2 : D2)); T2 + D2 < y2 && !((E2 -= R2[T2 + D2]) <= 0); ) T2++, E2 <<= 1; if (L2 += 1 << T2, 1 === e2 && 852 < L2 || 2 === e2 && 592 < L2) return 1; i2[l2 = S2 & d2] = C2 << 24 | T2 << 16 | p2 - a2 | 0; } } 0 !== S2 && (i2[p2 + S2] = v2 - D2 << 24 | 64 << 16 | 0), r2.bits = C2; } return 0; } var Xr = function() { for (var e2 = [], t2 = 0; t2 < 256; t2++) { for (var n2 = t2, o2 = 0; o2 < 8; o2++) n2 = 1 & n2 ? 3988292384 ^ n2 >>> 1 : n2 >>> 1; e2[t2] = n2; } return e2; }(), Zr = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], Qr = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], $r = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], ec = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]; function tc(e2) { return (e2 >>> 24 & 255) + (e2 >>> 8 & 65280) + ((65280 & e2) << 8) + ((255 & e2) << 24); } function nc() { this.mode = 0, this.last = false, this.wrap = 0, this.havedict = false, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new ie.Buf16(320), this.work = new ie.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; } function oc(e2) { var t2; return e2 && e2.state ? (t2 = e2.state, e2.total_in = e2.total_out = t2.total = 0, e2.msg = "", t2.wrap && (e2.adler = 1 & t2.wrap), t2.mode = 1, t2.last = 0, t2.havedict = 0, t2.dmax = 32768, t2.head = null, t2.hold = 0, t2.bits = 0, t2.lencode = t2.lendyn = new ie.Buf32(852), t2.distcode = t2.distdyn = new ie.Buf32(592), t2.sane = 1, t2.back = -1, 0) : -2; } function ic(e2) { var t2; return e2 && e2.state ? ((t2 = e2.state).wsize = 0, t2.whave = 0, t2.wnext = 0, oc(e2)) : -2; } function ac(e2, t2) { var n2, o2; return !e2 || !e2.state || (o2 = e2.state, t2 < 0 ? (n2 = 0, t2 = -t2) : (n2 = 1 + (t2 >> 4), t2 < 48 && (t2 &= 15)), t2 && (t2 < 8 || 15 < t2)) ? -2 : (null !== o2.window && o2.wbits !== t2 && (o2.window = null), o2.wrap = n2, o2.wbits = t2, ic(e2)); } function sc(e2, t2) { var n2; return e2 ? (n2 = new nc(), (e2.state = n2).window = null, 0 !== (n2 = ac(e2, t2)) && (e2.state = null), n2) : -2; } var rc, cc, uc = true; function lc(e2, t2, n2, o2) { var i2, e2 = e2.state; return null === e2.window && (e2.wsize = 1 << e2.wbits, e2.wnext = 0, e2.whave = 0, e2.window = new ie.Buf8(e2.wsize)), o2 >= e2.wsize ? (ie.arraySet(e2.window, t2, n2 - e2.wsize, e2.wsize, 0), e2.wnext = 0, e2.whave = e2.wsize) : ((i2 = e2.wsize - e2.wnext) > o2 && (i2 = o2), ie.arraySet(e2.window, t2, n2 - o2, i2, e2.wnext), (o2 -= i2) ? (ie.arraySet(e2.window, t2, n2 - o2, o2, 0), e2.wnext = o2, e2.whave = e2.wsize) : (e2.wnext += i2, e2.wnext === e2.wsize && (e2.wnext = 0), e2.whave < e2.wsize && (e2.whave += i2))), 0; } var dc = { inflateReset: ic, inflateReset2: ac, inflateResetKeep: oc, inflateInit: function(e2) { return sc(e2, 15); }, inflateInit2: sc, inflate: function(e2, b2) { var t2, n2, w2, o2, i2, a2, s2, r2, c2, F2, u2, l2, q2, x2, d2, p2, _2, h2, V2, H2, g2, f2, m2, v2, I2 = 0, M2 = new ie.Buf8(4), B2 = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; if (!e2 || !e2.state || !e2.output || !e2.input && 0 !== e2.avail_in) return -2; 12 === (t2 = e2.state).mode && (t2.mode = 13), i2 = e2.next_out, w2 = e2.output, s2 = e2.avail_out, o2 = e2.next_in, n2 = e2.input, a2 = e2.avail_in, r2 = t2.hold, c2 = t2.bits, F2 = a2, u2 = s2, f2 = 0; e: for (; ; ) switch (t2.mode) { case 1: if (0 === t2.wrap) t2.mode = 13; else { for (; c2 < 16; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } if (2 & t2.wrap && 35615 === r2) M2[t2.check = 0] = 255 & r2, M2[1] = r2 >>> 8 & 255, t2.check = Jr(t2.check, M2, 2, 0), c2 = r2 = 0, t2.mode = 2; else if (t2.flags = 0, t2.head && (t2.head.done = false), !(1 & t2.wrap) || (((255 & r2) << 8) + (r2 >> 8)) % 31) e2.msg = "incorrect header check", t2.mode = 30; else if (8 != (15 & r2)) e2.msg = "unknown compression method", t2.mode = 30; else { if (c2 -= 4, g2 = 8 + (15 & (r2 >>>= 4)), 0 === t2.wbits) t2.wbits = g2; else if (g2 > t2.wbits) { e2.msg = "invalid window size", t2.mode = 30; break; } t2.dmax = 1 << g2, e2.adler = t2.check = 1, t2.mode = 512 & r2 ? 10 : 12, c2 = r2 = 0; } } break; case 2: for (; c2 < 16; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } if (t2.flags = r2, 8 != (255 & t2.flags)) { e2.msg = "unknown compression method", t2.mode = 30; break; } if (57344 & t2.flags) { e2.msg = "unknown header flags set", t2.mode = 30; break; } t2.head && (t2.head.text = r2 >> 8 & 1), 512 & t2.flags && (M2[0] = 255 & r2, M2[1] = r2 >>> 8 & 255, t2.check = Jr(t2.check, M2, 2, 0)), c2 = r2 = 0, t2.mode = 3; case 3: for (; c2 < 32; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } t2.head && (t2.head.time = r2), 512 & t2.flags && (M2[0] = 255 & r2, M2[1] = r2 >>> 8 & 255, M2[2] = r2 >>> 16 & 255, M2[3] = r2 >>> 24 & 255, t2.check = Jr(t2.check, M2, 4, 0)), c2 = r2 = 0, t2.mode = 4; case 4: for (; c2 < 16; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } t2.head && (t2.head.xflags = 255 & r2, t2.head.os = r2 >> 8), 512 & t2.flags && (M2[0] = 255 & r2, M2[1] = r2 >>> 8 & 255, t2.check = Jr(t2.check, M2, 2, 0)), c2 = r2 = 0, t2.mode = 5; case 5: if (1024 & t2.flags) { for (; c2 < 16; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } t2.length = r2, t2.head && (t2.head.extra_len = r2), 512 & t2.flags && (M2[0] = 255 & r2, M2[1] = r2 >>> 8 & 255, t2.check = Jr(t2.check, M2, 2, 0)), c2 = r2 = 0; } else t2.head && (t2.head.extra = null); t2.mode = 6; case 6: if (1024 & t2.flags && ((l2 = (l2 = t2.length) > a2 ? a2 : l2) && (t2.head && (g2 = t2.head.extra_len - t2.length, t2.head.extra || (t2.head.extra = new Array(t2.head.extra_len)), ie.arraySet(t2.head.extra, n2, o2, l2, g2)), 512 & t2.flags && (t2.check = Jr(t2.check, n2, l2, o2)), a2 -= l2, o2 += l2, t2.length -= l2), t2.length)) break e; t2.length = 0, t2.mode = 7; case 7: if (2048 & t2.flags) { if (0 === a2) break e; for (l2 = 0; g2 = n2[o2 + l2++], t2.head && g2 && t2.length < 65536 && (t2.head.name += String.fromCharCode(g2)), g2 && l2 < a2; ) ; if (512 & t2.flags && (t2.check = Jr(t2.check, n2, l2, o2)), a2 -= l2, o2 += l2, g2) break e; } else t2.head && (t2.head.name = null); t2.length = 0, t2.mode = 8; case 8: if (4096 & t2.flags) { if (0 === a2) break e; for (l2 = 0; g2 = n2[o2 + l2++], t2.head && g2 && t2.length < 65536 && (t2.head.comment += String.fromCharCode(g2)), g2 && l2 < a2; ) ; if (512 & t2.flags && (t2.check = Jr(t2.check, n2, l2, o2)), a2 -= l2, o2 += l2, g2) break e; } else t2.head && (t2.head.comment = null); t2.mode = 9; case 9: if (512 & t2.flags) { for (; c2 < 16; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } if (r2 !== (65535 & t2.check)) { e2.msg = "header crc mismatch", t2.mode = 30; break; } c2 = r2 = 0; } t2.head && (t2.head.hcrc = t2.flags >> 9 & 1, t2.head.done = true), e2.adler = t2.check = 0, t2.mode = 12; break; case 10: for (; c2 < 32; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } e2.adler = t2.check = tc(r2), c2 = r2 = 0, t2.mode = 11; case 11: if (0 === t2.havedict) return e2.next_out = i2, e2.avail_out = s2, e2.next_in = o2, e2.avail_in = a2, t2.hold = r2, t2.bits = c2, 2; e2.adler = t2.check = 1, t2.mode = 12; case 12: if (5 === b2 || 6 === b2) break e; case 13: if (t2.last) r2 >>>= 7 & c2, c2 -= 7 & c2, t2.mode = 27; else { for (; c2 < 3; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } switch (t2.last = 1 & r2, --c2, 3 & (r2 >>>= 1)) { case 0: t2.mode = 14; break; case 1: y2 = C2 = void 0; var y2, C2 = t2; if (uc) { for (rc = new ie.Buf32(512), cc = new ie.Buf32(32), y2 = 0; y2 < 144; ) C2.lens[y2++] = 8; for (; y2 < 256; ) C2.lens[y2++] = 9; for (; y2 < 280; ) C2.lens[y2++] = 7; for (; y2 < 288; ) C2.lens[y2++] = 8; for (zr(1, C2.lens, 0, 288, rc, 0, C2.work, { bits: 9 }), y2 = 0; y2 < 32; ) C2.lens[y2++] = 5; zr(2, C2.lens, 0, 32, cc, 0, C2.work, { bits: 5 }), uc = false; } if (C2.lencode = rc, C2.lenbits = 9, C2.distcode = cc, C2.distbits = 5, t2.mode = 20, 6 !== b2) break; r2 >>>= 2, c2 -= 2; break e; case 2: t2.mode = 17; break; case 3: e2.msg = "invalid block type", t2.mode = 30; } r2 >>>= 2, c2 -= 2; } break; case 14: for (r2 >>>= 7 & c2, c2 -= 7 & c2; c2 < 32; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } if ((65535 & r2) != (r2 >>> 16 ^ 65535)) { e2.msg = "invalid stored block lengths", t2.mode = 30; break; } if (t2.length = 65535 & r2, c2 = r2 = 0, t2.mode = 15, 6 === b2) break e; case 15: t2.mode = 16; case 16: if (l2 = t2.length) { if (0 === (l2 = s2 < (l2 = a2 < l2 ? a2 : l2) ? s2 : l2)) break e; ie.arraySet(w2, n2, o2, l2, i2), a2 -= l2, o2 += l2, s2 -= l2, i2 += l2, t2.length -= l2; } else t2.mode = 12; break; case 17: for (; c2 < 14; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } if (t2.nlen = 257 + (31 & r2), r2 >>>= 5, c2 -= 5, t2.ndist = 1 + (31 & r2), r2 >>>= 5, c2 -= 5, t2.ncode = 4 + (15 & r2), r2 >>>= 4, c2 -= 4, 286 < t2.nlen || 30 < t2.ndist) { e2.msg = "too many length or distance symbols", t2.mode = 30; break; } t2.have = 0, t2.mode = 18; case 18: for (; t2.have < t2.ncode; ) { for (; c2 < 3; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } t2.lens[B2[t2.have++]] = 7 & r2, r2 >>>= 3, c2 -= 3; } for (; t2.have < 19; ) t2.lens[B2[t2.have++]] = 0; if (t2.lencode = t2.lendyn, t2.lenbits = 7, m2 = { bits: t2.lenbits }, f2 = zr(0, t2.lens, 0, 19, t2.lencode, 0, t2.work, m2), t2.lenbits = m2.bits, f2) { e2.msg = "invalid code lengths set", t2.mode = 30; break; } t2.have = 0, t2.mode = 19; case 19: for (; t2.have < t2.nlen + t2.ndist; ) { for (; p2 = (I2 = t2.lencode[r2 & (1 << t2.lenbits) - 1]) >>> 16 & 255, _2 = 65535 & I2, !((d2 = I2 >>> 24) <= c2); ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } if (_2 < 16) r2 >>>= d2, c2 -= d2, t2.lens[t2.have++] = _2; else { if (16 === _2) { for (v2 = d2 + 2; c2 < v2; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } if (r2 >>>= d2, c2 -= d2, 0 === t2.have) { e2.msg = "invalid bit length repeat", t2.mode = 30; break; } g2 = t2.lens[t2.have - 1], l2 = 3 + (3 & r2), r2 >>>= 2, c2 -= 2; } else if (17 === _2) { for (v2 = d2 + 3; c2 < v2; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } g2 = 0, l2 = 3 + (7 & (r2 >>>= d2)), r2 >>>= 3, c2 = c2 - d2 - 3; } else { for (v2 = d2 + 7; c2 < v2; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } g2 = 0, l2 = 11 + (127 & (r2 >>>= d2)), r2 >>>= 7, c2 = c2 - d2 - 7; } if (t2.have + l2 > t2.nlen + t2.ndist) { e2.msg = "invalid bit length repeat", t2.mode = 30; break; } for (; l2--; ) t2.lens[t2.have++] = g2; } } if (30 === t2.mode) break; if (0 === t2.lens[256]) { e2.msg = "invalid code -- missing end-of-block", t2.mode = 30; break; } if (t2.lenbits = 9, m2 = { bits: t2.lenbits }, f2 = zr(1, t2.lens, 0, t2.nlen, t2.lencode, 0, t2.work, m2), t2.lenbits = m2.bits, f2) { e2.msg = "invalid literal/lengths set", t2.mode = 30; break; } if (t2.distbits = 6, t2.distcode = t2.distdyn, m2 = { bits: t2.distbits }, f2 = zr(2, t2.lens, t2.nlen, t2.ndist, t2.distcode, 0, t2.work, m2), t2.distbits = m2.bits, f2) { e2.msg = "invalid distances set", t2.mode = 30; break; } if (t2.mode = 20, 6 === b2) break e; case 20: t2.mode = 21; case 21: if (6 <= a2 && 258 <= s2) { e2.next_out = i2, e2.avail_out = s2, e2.next_in = o2, e2.avail_in = a2, t2.hold = r2, t2.bits = c2, G2 = Y2 = k2 = S2 = L2 = E2 = D2 = T2 = oe2 = ne2 = te2 = ee2 = U2 = P2 = $2 = Q2 = Z2 = X2 = z2 = J2 = j2 = N2 = W2 = O2 = R2 = void 0; var T2, D2, E2, L2, S2, k2, A2 = e2, K2 = u2, R2 = A2.state, O2 = A2.next_in, Y2 = A2.input, W2 = O2 + (A2.avail_in - 5), N2 = A2.next_out, G2 = A2.output, j2 = N2 - (K2 - A2.avail_out), J2 = N2 + (A2.avail_out - 257), z2 = R2.dmax, X2 = R2.wsize, Z2 = R2.whave, Q2 = R2.wnext, $2 = R2.window, P2 = R2.hold, U2 = R2.bits, ee2 = R2.lencode, te2 = R2.distcode, ne2 = (1 << R2.lenbits) - 1, oe2 = (1 << R2.distbits) - 1; t: do { for (U2 < 15 && (P2 += Y2[O2++] << U2, U2 += 8, P2 += Y2[O2++] << U2, U2 += 8), T2 = ee2[P2 & ne2]; ; ) { if (P2 >>>= D2 = T2 >>> 24, U2 -= D2, 0 == (D2 = T2 >>> 16 & 255)) G2[N2++] = 65535 & T2; else { if (!(16 & D2)) { if (0 == (64 & D2)) { T2 = ee2[(65535 & T2) + (P2 & (1 << D2) - 1)]; continue; } if (32 & D2) { R2.mode = 12; break t; } A2.msg = "invalid literal/length code", R2.mode = 30; break t; } for (E2 = 65535 & T2, (D2 &= 15) && (U2 < D2 && (P2 += Y2[O2++] << U2, U2 += 8), E2 += P2 & (1 << D2) - 1, P2 >>>= D2, U2 -= D2), U2 < 15 && (P2 += Y2[O2++] << U2, U2 += 8, P2 += Y2[O2++] << U2, U2 += 8), T2 = te2[P2 & oe2]; ; ) { if (P2 >>>= D2 = T2 >>> 24, U2 -= D2, !(16 & (D2 = T2 >>> 16 & 255))) { if (0 == (64 & D2)) { T2 = te2[(65535 & T2) + (P2 & (1 << D2) - 1)]; continue; } A2.msg = "invalid distance code", R2.mode = 30; break t; } if (L2 = 65535 & T2, U2 < (D2 &= 15) && (P2 += Y2[O2++] << U2, (U2 += 8) < D2) && (P2 += Y2[O2++] << U2, U2 += 8), (L2 += P2 & (1 << D2) - 1) > z2) { A2.msg = "invalid distance too far back", R2.mode = 30; break t; } if (P2 >>>= D2, U2 -= D2, L2 > (D2 = N2 - j2)) { if ((D2 = L2 - D2) > Z2 && R2.sane) { A2.msg = "invalid distance too far back", R2.mode = 30; break t; } if (k2 = $2, (S2 = 0) === Q2) { if (S2 += X2 - D2, D2 < E2) { for (E2 -= D2; G2[N2++] = $2[S2++], --D2; ) ; S2 = N2 - L2, k2 = G2; } } else if (Q2 < D2) { if (S2 += X2 + Q2 - D2, (D2 -= Q2) < E2) { for (E2 -= D2; G2[N2++] = $2[S2++], --D2; ) ; if (S2 = 0, Q2 < E2) { for (E2 -= D2 = Q2; G2[N2++] = $2[S2++], --D2; ) ; S2 = N2 - L2, k2 = G2; } } } else if (S2 += Q2 - D2, D2 < E2) { for (E2 -= D2; G2[N2++] = $2[S2++], --D2; ) ; S2 = N2 - L2, k2 = G2; } for (; 2 < E2; ) G2[N2++] = k2[S2++], G2[N2++] = k2[S2++], G2[N2++] = k2[S2++], E2 -= 3; E2 && (G2[N2++] = k2[S2++], 1 < E2) && (G2[N2++] = k2[S2++]); } else { for (S2 = N2 - L2; G2[N2++] = G2[S2++], G2[N2++] = G2[S2++], G2[N2++] = G2[S2++], 2 < (E2 -= 3); ) ; E2 && (G2[N2++] = G2[S2++], 1 < E2) && (G2[N2++] = G2[S2++]); } break; } } break; } } while (O2 < W2 && N2 < J2); O2 -= E2 = U2 >> 3, P2 &= (1 << (U2 -= E2 << 3)) - 1, A2.next_in = O2, A2.next_out = N2, A2.avail_in = O2 < W2 ? W2 - O2 + 5 : 5 - (O2 - W2), A2.avail_out = N2 < J2 ? J2 - N2 + 257 : 257 - (N2 - J2), R2.hold = P2, R2.bits = U2, i2 = e2.next_out, w2 = e2.output, s2 = e2.avail_out, o2 = e2.next_in, n2 = e2.input, a2 = e2.avail_in, r2 = t2.hold, c2 = t2.bits, 12 === t2.mode && (t2.back = -1); break; } for (t2.back = 0; p2 = (I2 = t2.lencode[r2 & (1 << t2.lenbits) - 1]) >>> 16 & 255, _2 = 65535 & I2, !((d2 = I2 >>> 24) <= c2); ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } if (p2 && 0 == (240 & p2)) { for (h2 = d2, V2 = p2, H2 = _2; p2 = (I2 = t2.lencode[H2 + ((r2 & (1 << h2 + V2) - 1) >> h2)]) >>> 16 & 255, _2 = 65535 & I2, !(h2 + (d2 = I2 >>> 24) <= c2); ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } r2 >>>= h2, c2 -= h2, t2.back += h2; } if (r2 >>>= d2, c2 -= d2, t2.back += d2, t2.length = _2, 0 === p2) { t2.mode = 26; break; } if (32 & p2) { t2.back = -1, t2.mode = 12; break; } if (64 & p2) { e2.msg = "invalid literal/length code", t2.mode = 30; break; } t2.extra = 15 & p2, t2.mode = 22; case 22: if (t2.extra) { for (v2 = t2.extra; c2 < v2; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } t2.length += r2 & (1 << t2.extra) - 1, r2 >>>= t2.extra, c2 -= t2.extra, t2.back += t2.extra; } t2.was = t2.length, t2.mode = 23; case 23: for (; p2 = (I2 = t2.distcode[r2 & (1 << t2.distbits) - 1]) >>> 16 & 255, _2 = 65535 & I2, !((d2 = I2 >>> 24) <= c2); ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } if (0 == (240 & p2)) { for (h2 = d2, V2 = p2, H2 = _2; p2 = (I2 = t2.distcode[H2 + ((r2 & (1 << h2 + V2) - 1) >> h2)]) >>> 16 & 255, _2 = 65535 & I2, !(h2 + (d2 = I2 >>> 24) <= c2); ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } r2 >>>= h2, c2 -= h2, t2.back += h2; } if (r2 >>>= d2, c2 -= d2, t2.back += d2, 64 & p2) { e2.msg = "invalid distance code", t2.mode = 30; break; } t2.offset = _2, t2.extra = 15 & p2, t2.mode = 24; case 24: if (t2.extra) { for (v2 = t2.extra; c2 < v2; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } t2.offset += r2 & (1 << t2.extra) - 1, r2 >>>= t2.extra, c2 -= t2.extra, t2.back += t2.extra; } if (t2.offset > t2.dmax) { e2.msg = "invalid distance too far back", t2.mode = 30; break; } t2.mode = 25; case 25: if (0 === s2) break e; if (t2.offset > (l2 = u2 - s2)) { if ((l2 = t2.offset - l2) > t2.whave && t2.sane) { e2.msg = "invalid distance too far back", t2.mode = 30; break; } q2 = l2 > t2.wnext ? (l2 -= t2.wnext, t2.wsize - l2) : t2.wnext - l2, l2 > t2.length && (l2 = t2.length), x2 = t2.window; } else x2 = w2, q2 = i2 - t2.offset, l2 = t2.length; for (s2 -= l2 = s2 < l2 ? s2 : l2, t2.length -= l2; w2[i2++] = x2[q2++], --l2; ) ; 0 === t2.length && (t2.mode = 21); break; case 26: if (0 === s2) break e; w2[i2++] = t2.length, s2--, t2.mode = 21; break; case 27: if (t2.wrap) { for (; c2 < 32; ) { if (0 === a2) break e; a2--, r2 |= n2[o2++] << c2, c2 += 8; } if (u2 -= s2, e2.total_out += u2, t2.total += u2, u2 && (e2.adler = t2.check = (t2.flags ? Jr : jr)(t2.check, w2, u2, i2 - u2)), u2 = s2, (t2.flags ? r2 : tc(r2)) !== t2.check) { e2.msg = "incorrect data check", t2.mode = 30; break; } c2 = r2 = 0; } t2.mode = 28; case 28: if (t2.wrap && t2.flags) { for (; c2 < 32; ) { if (0 === a2) break e; a2--, r2 += n2[o2++] << c2, c2 += 8; } if (r2 !== (4294967295 & t2.total)) { e2.msg = "incorrect length check", t2.mode = 30; break; } c2 = r2 = 0; } t2.mode = 29; case 29: f2 = 1; break e; case 30: f2 = -3; break e; case 31: return -4; default: return -2; } return e2.next_out = i2, e2.avail_out = s2, e2.next_in = o2, e2.avail_in = a2, t2.hold = r2, t2.bits = c2, (t2.wsize || u2 !== e2.avail_out && t2.mode < 30 && (t2.mode < 27 || 4 !== b2)) && lc(e2, e2.output, e2.next_out, u2 - e2.avail_out), F2 -= e2.avail_in, u2 -= e2.avail_out, e2.total_in += F2, e2.total_out += u2, t2.total += u2, t2.wrap && u2 && (e2.adler = t2.check = (t2.flags ? Jr : jr)(t2.check, w2, u2, e2.next_out - u2)), e2.data_type = t2.bits + (t2.last ? 64 : 0) + (12 === t2.mode ? 128 : 0) + (20 === t2.mode || 15 === t2.mode ? 256 : 0), f2 = (0 == F2 && 0 === u2 || 4 === b2) && 0 === f2 ? -5 : f2; }, inflateEnd: function(e2) { var t2; return e2 && e2.state ? ((t2 = e2.state).window && (t2.window = null), e2.state = null, 0) : -2; }, inflateGetHeader: function(e2, t2) { return !e2 || !e2.state || 0 == (2 & (e2 = e2.state).wrap) ? -2 : ((e2.head = t2).done = false, 0); }, inflateSetDictionary: function(e2, t2) { var n2, o2 = t2.length; return !e2 || !e2.state || 0 !== (n2 = e2.state).wrap && 11 !== n2.mode ? -2 : 11 === n2.mode && jr(1, t2, o2, 0) !== n2.check ? -3 : lc(e2, t2, o2, o2) ? (n2.mode = 31, -4) : (n2.havedict = 1, 0); }, inflateInfo: "pako inflate (from Nodeca project)" }, pc = true, _c = true; try { String.fromCharCode.apply(null, [0]); } catch (e2) { pc = false; } try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (e2) { _c = false; } for (var hc = new ie.Buf8(256), gc = 0; gc < 256; gc++) hc[gc] = 252 <= gc ? 6 : 248 <= gc ? 5 : 240 <= gc ? 4 : 224 <= gc ? 3 : 192 <= gc ? 2 : 1; hc[254] = hc[254] = 1; function fc(e2, t2) { for (var n2, o2, i2 = t2 || e2.length, a2 = new Array(2 * i2), s2 = 0, r2 = 0; r2 < i2; ) if ((n2 = e2[r2++]) < 128) a2[s2++] = n2; else if (4 < (o2 = hc[n2])) a2[s2++] = 65533, r2 += o2 - 1; else { for (n2 &= 2 === o2 ? 31 : 3 === o2 ? 15 : 7; 1 < o2 && r2 < i2; ) n2 = n2 << 6 | 63 & e2[r2++], o2--; 1 < o2 ? a2[s2++] = 65533 : n2 < 65536 ? a2[s2++] = n2 : (n2 -= 65536, a2[s2++] = 55296 | n2 >> 10 & 1023, a2[s2++] = 56320 | 1023 & n2); } var c2 = a2, u2 = s2; if (u2 < 65534 && (c2.subarray && _c || !c2.subarray && pc)) return String.fromCharCode.apply(null, ie.shrinkBuf(c2, u2)); for (var l2 = "", d2 = 0; d2 < u2; d2++) l2 += String.fromCharCode(c2[d2]); return l2; } function mc() { 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; } function vc() { 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 = false; } var Ic = { 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 }, Mc = { 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" }, yc = Object.prototype.toString; function Cc(e2) { if (!(this instanceof Cc)) return new Cc(e2); this.options = ie.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e2 || {}); var t2 = this.options, e2 = (t2.raw && 0 <= t2.windowBits && t2.windowBits < 16 && (t2.windowBits = -t2.windowBits, 0 === t2.windowBits) && (t2.windowBits = -15), !(0 <= t2.windowBits && t2.windowBits < 16) || e2 && e2.windowBits || (t2.windowBits += 32), 15 < t2.windowBits && t2.windowBits < 48 && 0 == (15 & t2.windowBits) && (t2.windowBits |= 15), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new mc(), this.strm.avail_out = 0, dc.inflateInit2(this.strm, t2.windowBits)); if (e2 !== Ic.Z_OK) throw new Error(Mc[e2]); if (this.header = new vc(), dc.inflateGetHeader(this.strm, this.header), t2.dictionary && ("string" == typeof t2.dictionary ? t2.dictionary = function(e3) { for (var t3, n2, o2, i2, a2 = e3.length, s2 = 0, r2 = 0; r2 < a2; r2++) 55296 == (64512 & (n2 = e3.charCodeAt(r2))) && r2 + 1 < a2 && 56320 == (64512 & (o2 = e3.charCodeAt(r2 + 1))) && (n2 = 65536 + (n2 - 55296 << 10) + (o2 - 56320), r2++), s2 += n2 < 128 ? 1 : n2 < 2048 ? 2 : n2 < 65536 ? 3 : 4; for (t3 = new ie.Buf8(s2), r2 = i2 = 0; i2 < s2; r2++) 55296 == (64512 & (n2 = e3.charCodeAt(r2))) && r2 + 1 < a2 && 56320 == (64512 & (o2 = e3.charCodeAt(r2 + 1))) && (n2 = 65536 + (n2 - 55296 << 10) + (o2 - 56320), r2++), n2 < 128 ? t3[i2++] = n2 : (n2 < 2048 ? t3[i2++] = 192 | n2 >>> 6 : (n2 < 65536 ? t3[i2++] = 224 | n2 >>> 12 : (t3[i2++] = 240 | n2 >>> 18, t3[i2++] = 128 | n2 >>> 12 & 63), t3[i2++] = 128 | n2 >>> 6 & 63), t3[i2++] = 128 | 63 & n2); return t3; }(t2.dictionary) : "[object ArrayBuffer]" === yc.call(t2.dictionary) && (t2.dictionary = new Uint8Array(t2.dictionary)), t2.raw) && (e2 = dc.inflateSetDictionary(this.strm, t2.dictionary)) !== Ic.Z_OK) throw new Error(Mc[e2]); } function Tc(e2, t2) { t2 = new Cc(t2); if (t2.push(e2, true), t2.err) throw t2.msg || Mc[t2.err]; return t2.result; } Cc.prototype.push = function(e2, t2) { var n2, o2, i2, a2, s2, r2 = this.strm, c2 = this.options.chunkSize, u2 = this.options.dictionary, l2 = false; if (this.ended) return false; o2 = t2 === ~~t2 ? t2 : true === t2 ? Ic.Z_FINISH : Ic.Z_NO_FLUSH, "string" == typeof e2 ? r2.input = function(e3) { for (var t3 = new ie.Buf8(e3.length), n3 = 0, o3 = t3.length; n3 < o3; n3++) t3[n3] = e3.charCodeAt(n3); return t3; }(e2) : "[object ArrayBuffer]" === yc.call(e2) ? r2.input = new Uint8Array(e2) : r2.input = e2, r2.next_in = 0, r2.avail_in = r2.input.length; do { if (0 === r2.avail_out && (r2.output = new ie.Buf8(c2), r2.next_out = 0, r2.avail_out = c2), (n2 = (n2 = dc.inflate(r2, Ic.Z_NO_FLUSH)) === Ic.Z_NEED_DICT && u2 ? dc.inflateSetDictionary(this.strm, u2) : n2) === Ic.Z_BUF_ERROR && true === l2 && (n2 = Ic.Z_OK, l2 = false), n2 !== Ic.Z_STREAM_END && n2 !== Ic.Z_OK) return this.onEnd(n2), !(this.ended = true); !r2.next_out || 0 !== r2.avail_out && n2 !== Ic.Z_STREAM_END && (0 !== r2.avail_in || o2 !== Ic.Z_FINISH && o2 !== Ic.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i2 = function(e3, t3) { for (var n3 = (t3 = (t3 = t3 || e3.length) > e3.length ? e3.length : t3) - 1; 0 <= n3 && 128 == (192 & e3[n3]); ) n3--; return !(n3 < 0 || 0 === n3) && n3 + hc[e3[n3]] > t3 ? n3 : t3; }(r2.output, r2.next_out), a2 = r2.next_out - i2, s2 = fc(r2.output, i2), r2.next_out = a2, r2.avail_out = c2 - a2, a2 && ie.arraySet(r2.output, r2.output, i2, a2, 0), this.onData(s2)) : this.onData(ie.shrinkBuf(r2.output, r2.next_out))), 0 === r2.avail_in && 0 === r2.avail_out && (l2 = true); } while ((0 < r2.avail_in || 0 === r2.avail_out) && n2 !== Ic.Z_STREAM_END); return (o2 = n2 === Ic.Z_STREAM_END ? Ic.Z_FINISH : o2) === Ic.Z_FINISH ? (n2 = dc.inflateEnd(this.strm), this.onEnd(n2), this.ended = true, n2 === Ic.Z_OK) : o2 !== Ic.Z_SYNC_FLUSH || (this.onEnd(Ic.Z_OK), !(r2.avail_out = 0)); }, Cc.prototype.onData = function(e2) { this.chunks.push(e2); }, Cc.prototype.onEnd = function(e2) { e2 === Ic.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = ie.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; }; var s = {}, Dc = ((0, ie.assign)(s, { Inflate: Cc, inflate: Tc, inflateRaw: function(e2, t2) { return (t2 = t2 || {}).raw = true, Tc(e2, t2); }, ungzip: Tc }, Ic), s), Ec = (e(Gc, [{ key: "inflate", value: function(e2) { var t2, e2 = new Uint8Array(e2).slice(4), n2 = Date.now(); try { t2 = Dc.inflate(e2, { to: "string" }), this._bLogForInflateOK || (this._bLogForInflateOK = true, new G("inflateOK").end()); } catch (e3) { return this._bLogForInflateError ? void 0 : (this._bLogForInflateError = true, void new G("inflateError").setMessage(e3).end()); } var e2 = e2.length + 4, o2 = t2.length; return M.d("inflate ok. zipped:".concat(e2, " unzipped:").concat(o2) + " compression ratio:".concat(Math.round(100 * (o2 - e2) / o2), "% cost:").concat(Date.now() - n2)), t2; } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._bLogForInflateOK = false, this._bLogForInflateError = false; } }]), Gc), Lc = (e(Nc, [{ key: "_startTimer", value: function() { var e2 = this._map.get(24), t2 = e2.isWorkerEnabled(); M.l("".concat(this._n, ".startTimer isWorkerEnabled:").concat(t2, " seed:").concat(this._checkTimer)), t2 ? e2.startWorkerTimer() : this._startMainThreadTimer(); } }, { key: "_startMainThreadTimer", value: function() { this._checkTimer < 0 && (this._checkTimer = setInterval(this.onCheckTimer.bind(this), 1e3)), M.l("".concat(this._n, "._startMainThreadTimer seed:").concat(this._checkTimer)); } }, { key: "stopTimer", value: function() { var e2 = this._map.get(24), t2 = e2.isWorkerEnabled(); M.l("".concat(this._n, ".stopTimer isWorkerEnabled:").concat(t2, " seed:").concat(this._checkTimer)), t2 ? e2.stopWorkerTimer() : this._stopMainThreadTimer(); } }, { key: "_stopMainThreadTimer", value: function() { M.l("".concat(this._n, "._stopMainThreadTimer")), 0 < this._checkTimer && (clearInterval(this._checkTimer), this._checkTimer = -1, this._checkCount = 0); } }, { key: "_stopMainThreadSocket", value: function() { M.l("".concat(this._n, "._stopMainThreadSocket")); var e2 = this._map.get(21); e2.setIsWorkerEnabled(true), e2.reConnect(); } }, { key: "_startMainThreadSocket", value: function() { M.l("".concat(this._n, "._startMainThreadSocket")); var e2 = this._map.get(21); e2.setIsWorkerEnabled(false), e2.reConnect(); } }, { key: "onWorkerTimerEnabled", value: function() { M.l("".concat(this._n, ".onWorkerTimerEnabled, disable main thread timer and socket")), this._stopMainThreadTimer(), this._stopMainThreadSocket(); } }, { key: "onWorkerTimerDisabled", value: function() { M.l("".concat(this._n, ".onWorkerTimerDisabled, enable main thread timer and socket")), this._startMainThreadTimer(), this._startMainThreadSocket(); } }, { key: "onCheckTimer", value: function() { this._checkCount += 1; var e2, t2 = Z(this._map); try { for (t2.s(); !(e2 = t2.n()).done; ) { var n2 = Y(e2.value, 2)[1]; n2.onCheckTimer && n2.onCheckTimer(this._checkCount); } } catch (e3) { t2.e(e3); } finally { t2.f(); } } }, { key: "_initReadyList", value: function() { var t2 = this; this._readyList = [this._map.get(1)], this._readyList.forEach(function(e2) { e2.ready(function() { return t2._onModuleReady(); }); }); } }, { key: "_onModuleReady", value: function() { var e2, t2, n2 = true; this._readyList.forEach(function(e3) { e3.isReady() || (n2 = false); }), n2 && !this._isReady && (this._isReady = true, this._oEmitter.emit(h.SDK_READY), e2 = Date.now() - this._startLoginTs, M.w("SDK is ready. cost ".concat(e2, " ms")), this._startLoginTs = Date.now(), t2 = this._ssoLogForReady.getStartTs() + Ye, this._ssoLogForReady.setMessage(e2).start(t2).end()); } }, { key: "login", value: function() { 0 === this._startLoginTs && (He(), this._startLoginTs = Date.now(), this._startTimer(), this._map.get(15).start(), this._ssoLogForReady = new G("sdkReady"), this._reason = L.LOGGING_IN); } }, { key: "onLoginFailed", value: function() { this._startLoginTs = 0; } }, { key: "getOEmitInst", value: function() { return null === this._oEmitter && (this._oEmitter = new Ia(), e2 = this._oEmitter, qn = e2, this._oEmitter._emit = this._oEmitter.emit, this._oEmitter.emit = (function(e3, t2) { var n2, o2, i2 = this; this._canIUseSignaling() && (e3 === h.MESSAGE_RECEIVED && this.get(33).onNewMessageList(t2), e3 === h.MESSAGE_MODIFIED) && this.get(33).onMessageModified(t2), e3 === h.CONVERSATION_LIST_UPDATED || e3 === h.FRIEND_LIST_UPDATED || e3 === h.GROUP_LIST_UPDATED || e3 === h.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED ? false !== this._eventThrottling ? this._eventThrottleMap.has(e3) ? (n2 = Date.now()) - (o2 = this._eventThrottleMap.get(e3)).last <= 1e3 ? (o2.timeoutID && clearTimeout(o2.timeoutID), o2.timeoutID = setTimeout(function() { o2.last = Date.now(), i2._oEmitter._emit.apply(i2._oEmitter, [e3, { name: e3, data: i2._getEventData(e3) }]); }, 1e3)) : (o2.last = n2, this._oEmitter._emit.apply(this._oEmitter, [e3, { name: e3, data: this._getEventData(e3) }])) : (this._eventThrottleMap.set(e3, { last: Date.now(), timeoutID: -1 }), this._oEmitter._emit.apply(this._oEmitter, [e3, { name: e3, data: this._getEventData(e3) }])) : this._oEmitter._emit.apply(this._oEmitter, [e3, { name: e3, data: this._getEventData(e3) }]) : this._oEmitter._emit.apply(this._oEmitter, [e3, { name: e3, data: t2 }]); }).bind(this)), this._oEmitter; var e2; } }, { key: "_canIUseSignaling", value: function() { var e2 = this.get(33); return !!e2 && e2.canIUseSignaling(); } }, { key: "_getEventData", value: function(e2) { return e2 === h.CONVERSATION_LIST_UPDATED ? this._map.get(12).isPartialUpdatedConvs() ? this._map.get(11).getPartialUpdatedConvs() : this._map.get(11).getLocalConvList() : e2 === h.FRIEND_LIST_UPDATED ? this._map.get(8).getLocalFriendList(false) : e2 === h.GROUP_LIST_UPDATED ? this._map.get(7).getLocalGroupList() : e2 === h.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED ? this._map.get(11).getTotalUnreadCount() : e2 === h.CONVERSATION_ID_LIST_UPDATED ? this._map.get(11).getUpdatedConvIDList() : void 0; } }, { key: "getIEmitInst", value: function() { return null === this._iEmitter && (this._iEmitter = new Ia(), this._iEmitter._emit = this._iEmitter.emit, this._iEmitter.emit = (function(e2, t2) { e2 = f(t2) && t2.data ? [e2, { name: e2, data: t2.data }] : [e2, { name: e2, data: t2 }]; this._iEmitter._emit.apply(this._iEmitter, e2); }).bind(this)), this._iEmitter; } }, { key: "hasModule", value: function(e2) { return this._map.has(e2); } }, { key: "get", value: function(e2) { return this._map.get(e2); } }, { key: "canIUseModule", value: function(e2) { return !this._map.get(12).isUsingChatCore() || this._optionalModuleMap.has(e2); } }, { key: "canIUseInflate", value: function() { return !!this._map.get(37); } }, { key: "isReady", value: function() { return this._isReady; } }, { key: "isIntl", value: function() { return this.get(12).isIntl(); } }, { key: "getNotReadyReason", value: function() { return this._reason; } }, { key: "setNotReadyReason", value: function(e2) { this._reason = e2; } }, { key: "getErrMsg", value: function(e2, t2, n2) { return this._map.get(32).get({ key: e2, replacement1: t2, replacement2: n2, isIntl: this.isIntl() }); } }, { key: "warn", value: function(e2, t2, n2) { e2 = this.getErrMsg(e2, t2, n2); e2 && M.w(e2); } }, { key: "onError", value: function(e2) { var t2 = "code:".concat(e2.code, " message:").concat(e2.message); M.w("Oops! ".concat(t2)), new G("error").setMessage(t2).setLevel("error").end(), this.getOEmitInst().emit(h.ERROR, e2); } }, { key: "restartTimer", value: function() { M.l("".concat(this._n, ".restartTimer")), this.stopTimer(), this._startTimer(); var e2 = this.get(7); e2 && e2.restartPolling(); } }, { key: "getTimerID", value: function() { var e2 = this._map.get(24); return e2.isWorkerEnabled() ? e2.getTimerID() : this._checkTimer; } }, { key: "getPollingTimerID", value: function(e2) { return this._map.get(7).getPollingTimerID(e2); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), He(); var e2, t2 = Z(this._map); try { for (t2.s(); !(e2 = t2.n()).done; ) { var n2 = Y(e2.value, 2)[1]; n2.reset && n2.reset(); } } catch (e3) { t2.e(e3); } finally { t2.f(); } this._startLoginTs = 0, this._initReadyList(), this._isReady = false, this.stopTimer(), this._oEmitter.emit(h.SDK_NOT_READY); var o2, i2 = Z(this._eventThrottleMap); try { for (i2.s(); !(o2 = i2.n()).done; ) { var a2 = Y(o2.value, 2)[1]; a2.timeoutID && clearTimeout(a2.timeoutID); } } catch (e3) { i2.e(e3); } finally { i2.f(); } this._eventThrottleMap.clear(); } }]), Nc), Sc = (e(Oc, [{ key: "defense", value: function(e2, t2) { var n2 = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : void 0; if ("string" != typeof e2) return null; if (0 === e2.length) return null; if ("function" != typeof t2) return null; if (this._funcMap.has(e2) && this._funcMap.get(e2).has(t2)) return this._funcMap.get(e2).get(t2); this._funcMap.has(e2) || this._funcMap.set(e2, /* @__PURE__ */ new Map()); var o2 = null; return this._funcMap.get(e2).has(t2) ? o2 = this._funcMap.get(e2).get(t2) : (o2 = this._pack(e2, t2, n2), this._funcMap.get(e2).set(t2, o2)), o2; } }, { key: "defenseOnce", value: function(e2, t2) { return "function" != typeof t2 ? null : this._pack(e2, t2, 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : void 0); } }, { key: "find", value: function(e2, t2) { return "string" != typeof e2 || 0 === e2.length || "function" != typeof t2 ? null : this._funcMap.has(e2) && this._funcMap.get(e2).has(t2) ? this._funcMap.get(e2).get(t2) : (this._m.warn("ListenerFnNotFound", e2), null); } }, { key: "delete", value: function(e2, t2) { return "function" == typeof t2 && !!this._funcMap.has(e2) && !!this._funcMap.get(e2).has(t2) && (this._funcMap.get(e2).delete(t2), 0 === this._funcMap.get(e2).size && this._funcMap.delete(e2), true); } }, { key: "_pack", value: function(o2, e2, i2) { var a2 = this; return function() { try { e2.apply(i2, Array.from(arguments)); } catch (e3) { var t2 = Object.values(h).indexOf(o2), n2 = "CallbackError"; -1 !== t2 && (t2 = Object.keys(h)[t2], a2._m.warn(n2, t2, e3)), a2._reportCount < 5 && (new G(n2).setMessage("eventName:".concat(o2)).setMoreMessage(e3.message).end(), a2._reportCount += 1); } }; } }, { key: "destroy", value: function() { this._funcMap.clear(); } }, { key: "reset", value: function() { M.l("".concat(this._n, ".reset")), this._reportCount = 0; } }]), Oc), kc = (e(Rc, [{ key: "onError", value: function(e2) { this._m.onError(e2); } }, { key: "login", value: function(e2) { return this._m.login(), this._get(1).login(e2); } }, { key: "logout", value: function() { var t2 = this; return this._get(1).logout().then(function(e2) { return t2._safetyCallbackFactory.reset(), t2._m.reset(), e2; }); } }, { key: "getLoginUser", value: function() { return this._get(1).getLoginUser(); } }, { key: "getServerTime", value: function() { return We(); } }, { key: "isReady", value: function() { return this._m.isReady(); } }, { key: "isIntl", value: function() { return this._m.isIntl(); } }, { key: "getNotReadyReason", value: function() { return this._m.getNotReadyReason(); } }, { key: "getErrMsg", value: function(e2, t2, n2) { return this._m.getErrMsg(e2, t2, n2); } }, { key: "_get", value: function(e2) { return this._m.get(e2); } }, { key: "destroy", value: function() { var e2 = this, t2 = this._get(12), n2 = t2.getSDKAppID(); return M.w("destroy ".concat(n2, " ").concat(t2.getInstanceID())), this.logout().finally(function() { e2._safetyCallbackFactory.destroy(), e2._m.stopTimer(), e2._get(24).terminate(), e2._get(21).dealloc(), e2._m.getOEmitInst().emit(h.SDK_DESTROY, { SDKAppID: n2 }); }); } }, { key: "on", value: function(e2, t2, n2) { M.d("on", "eventName:".concat(e2)), this._m.getOEmitInst().on(e2, this._safetyCallbackFactory.defense(e2, t2, n2), n2); } }, { key: "once", value: function(e2, t2, n2) { M.d("once", "eventName:".concat(e2)), this._m.getOEmitInst().once(e2, this._safetyCallbackFactory.defenseOnce(e2, t2, n2), n2 || this); } }, { key: "off", value: function(e2, t2, n2, o2) { M.d("off", "eventName:".concat(e2)); var i2 = this._safetyCallbackFactory.find(e2, t2); null !== i2 && (this._m.getOEmitInst().off(e2, i2, n2, o2), this._safetyCallbackFactory.delete(e2, t2)); } }, { key: "registerPlugin", value: function(e2) { (N(e2["tim-push"]) ? N(e2["tim-offline-push-plugin"]) ? this._get(18) : this._get(28) : this._get(36)).registerPlugin(e2); } }, { key: "setLogLevel", value: function(e2) { var t2; e2 <= 0 && ((t2 = this.getErrMsg("TIM_ASCII_ART")) && console.log(t2), (t2 = this.getErrMsg("API_REFER")) && (Qt() ? console.log("%c ".concat("IM SDK API ->", " %c"), "background:#ff9d00; padding:1px; border-radius:3px; color: #fff", "background:transparent", t2) : console.log("IM SDK API ->", t2)), (t2 = this.getErrMsg("DOCS_GUIDE")) && console.log(t2), t2 = this.getErrMsg("IOS_WEBVIEW_WARNING"), be) && t2 && console.warn(t2), M.setLevel(e2); } }, { key: "createTextMessage", value: function(e2) { return this._get(2).createTextMessage(e2); } }, { key: "createTextAtMessage", value: function(e2) { return this._get(2).createTextMessage(e2); } }, { key: "createImageMessage", value: function(e2) { return this._get(2).createImageMessage(e2); } }, { key: "createAudioMessage", value: function(e2) { return this._get(2).createAudioMessage(e2); } }, { key: "createVideoMessage", value: function(e2) { return this._get(2).createVideoMessage(e2); } }, { key: "createCustomMessage", value: function(e2) { return this._get(2).createCustomMessage(e2); } }, { key: "createFaceMessage", value: function(e2) { return this._get(2).createFaceMessage(e2); } }, { key: "createFileMessage", value: function(e2) { return this._get(2).createFileMessage(e2); } }, { key: "createLocationMessage", value: function(e2) { return this._get(2).createLocationMessage(e2); } }, { key: "createMergerMessage", value: function(e2) { return this._get(2).createMergerMessage(e2); } }, { key: "downloadMergerMessage", value: function(e2) { return e2.type !== A.MSG_MERGER ? D({ code: L.MSG_MERGER_TYPE_INVALID }) : S(e2.payload.downloadKey) ? D({ code: L.MSG_MERGER_KEY_INVALID }) : this._get(2).downloadMergerMessage(e2).catch(function(e3) { return D({ code: L.MSG_MERGER_DOWNLOAD_FAIL }); }); } }, { key: "createForwardMessage", value: function(e2) { return this._get(2).createForwardMessage(e2); } }, { key: "sendMessage", value: function(e2, t2) { return e2 instanceof Do ? this._get(2).sendMessageInstance(e2, t2) : D({ code: L.MSG_INSTANCE_REQUIRED }); } }, { key: "searchCloudMessages", value: function(e2) { return this._get(2).searchCloudMessages(e2); } }, { key: "callExperimentalAPI", value: function(e2, t2) { return "sendComboMessage" === e2 ? this._get(31).sendMessage(t2) : "handleGroupInvitation" === e2 ? this._get(7).handleGroupInvitation(t2) : "isCommercialAbilityEnabled" === e2 ? this._get(27).isFeatureEnabled(t2) : "isFeatureEnabledForStat" === e2 ? this._get(27).isFeatureEnabledForStat(t2) : "isIntl" === e2 ? this.isIntl() : "sendTRTCCustomData" === e2 || "sendRoomCustomData" === e2 ? this._get(30).sendTRTCCustomData(t2) : "getTimerID" === e2 ? this._m.getTimerID() : "getPollingTimerID" === e2 ? this._m.getPollingTimerID(t2) : "setApplicationID" === e2 ? (this._get(12).setApplicationID(t2), void this._get(20).updateProtocolConfig()) : "getServerConfig" === e2 ? this._get(23).getServerConfig(t2) : "canIUseModule" === e2 ? this._m.canIUseModule(t2) : "startMessageLongPolling" === e2 ? this._get(7).startMessageLongPolling(t2) : "stopMessageLongPolling" === e2 ? this._get(7).stopMessageLongPolling(t2) : "disableMessagePullOnInvite" === e2 ? this._get(11).disableMsgPullOnInvite(t2) : "clearLocalMessage" === e2 ? this._get(11).clearMemMsg(t2, false) : "setCustomLoginInfo" === e2 ? this._get(12).setCustomLoginInfo(t2) : D({ code: L.INVALID_OPERATION }); } }, { key: "revokeMessage", value: function(e2) { return this._get(2).revokeMessage(e2); } }, { key: "resendMessage", value: function(e2, t2) { return e2 instanceof Do ? this._get(2).resendMessage(e2, t2) : D({ code: L.MSG_INSTANCE_REQUIRED }); } }, { key: "deleteMessage", value: function(e2) { return this._get(2).deleteMessage(e2); } }, { key: "translateText", value: function(e2) { return this._get(2).translateText(e2); } }, { key: "convertVoiceToText", value: function(e2) { return this._get(2).convertVoiceToText(e2); } }, { key: "setMessageExtensions", value: function(e2, t2) { return this._get(3).setMessageExtensions(e2, t2); } }, { key: "getMessageExtensions", value: function(e2) { return this._get(3).getMessageExtensions(e2); } }, { key: "deleteMessageExtensions", value: function(e2, t2) { return this._get(3).deleteMessageExtensions(e2, t2); } }, { key: "addMessageReaction", value: function(e2, t2) { return this._get(34).addMessageReaction(e2, t2); } }, { key: "removeMessageReaction", value: function(e2, t2) { return this._get(34).removeMessageReaction(e2, t2); } }, { key: "getMessageReactions", value: function(e2) { return this._get(34).getMessageReactions(e2); } }, { key: "getAllUserListOfMessageReaction", value: function(e2) { return this._get(34).getAllUserListOfMessageReaction(e2); } }, { key: "modifyMessage", value: function(e2) { return this._get(2).modifyRemoteMessage(e2); } }, { key: "getMessageList", value: function(e2) { return this._get(11).getMessageList(e2); } }, { key: "getMessageListHopping", value: function(e2) { return this._get(11).getMessageListHopping(e2); } }, { key: "sendMessageReadReceipt", value: function(e2) { return this._get(11).sendReadReceipt(e2); } }, { key: "getMessageReadReceiptList", value: function(e2) { return this._get(11).getReadReceiptList(e2); } }, { key: "getGroupMessageReadMemberList", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getReadReceiptDetail(e2) : D({ code: L.NO_MODULE }); } }, { key: "findMessage", value: function(e2) { return this._get(11).findMessage(e2); } }, { key: "setMessageRead", value: function(e2) { return this._get(11).setMessageRead(e2); } }, { key: "getConversationList", value: function(e2) { return this._get(11).getConvList(e2); } }, { key: "getConversationProfile", value: function(e2) { return this._get(11).getConversationProfile(e2); } }, { key: "deleteConversation", value: function(e2) { return this._get(11).deleteConversation(e2); } }, { key: "setConversationDraft", value: function(e2) { return this._get(11).setConvDraft(e2); } }, { key: "clearHistoryMessage", value: function(e2) { return this._get(11).clearHistoryMessage(e2); } }, { key: "pinConversation", value: function(e2) { return this._get(11).pinConversation(e2); } }, { key: "setAllMessageRead", value: function(e2) { return this._get(11).setAllMessageRead(e2); } }, { key: "setMessageRemindType", value: function(e2) { return this._get(11).setMessageRemindType(e2); } }, { key: "setAllReceiveMessageOpt", value: function(e2) { return this._get(11).setAllRcvMsgOpt(e2); } }, { key: "getAllReceiveMessageOpt", value: function() { return this._get(11).getAllRcvMsgOpt(); } }, { key: "getTotalUnreadMessageCount", value: function() { return this._get(11).getTotalUnreadCount(); } }, { key: "setConversationCustomData", value: function(e2) { return this._get(11).setConvCustomData(e2); } }, { key: "markConversation", value: function(e2) { return this._get(11).markConv(e2); } }, { key: "getConversationGroupList", value: function() { return this._get(11).getConvGroupList(); } }, { key: "createConversationGroup", value: function(e2) { return this._get(11).createConvGroup(e2); } }, { key: "deleteConversationGroup", value: function(e2) { return this._get(11).deleteConvGroup(e2); } }, { key: "renameConversationGroup", value: function(e2) { return this._get(11).renameConvGroup(e2); } }, { key: "addConversationsToGroup", value: function(e2) { return this._get(11).addConvsToGroup(e2); } }, { key: "deleteConversationsFromGroup", value: function(e2) { return this._get(11).deleteConvsFromGroup(e2); } }, { key: "getMyProfile", value: function() { return this._get(4).getMyProfile(); } }, { key: "getUserProfile", value: function(e2) { return this._get(4).getUserProfile(e2); } }, { key: "updateMyProfile", value: function(e2) { return this._get(4).updateMyProfile(e2); } }, { key: "getBlacklist", value: function() { return this._get(4).getLocalBlacklist(); } }, { key: "addToBlacklist", value: function(e2) { return this._get(4).addBlacklist(e2); } }, { key: "removeFromBlacklist", value: function(e2) { return this._get(4).deleteBlacklist(e2); } }, { key: "setSelfStatus", value: function(e2) { return this._get(4).setSelfStatus(e2); } }, { key: "getUserStatus", value: function(e2) { return this._get(4).getUserStatus(e2); } }, { key: "subscribeUserStatus", value: function(e2) { return this._get(4).subscribeUserStatus(e2); } }, { key: "unsubscribeUserStatus", value: function(e2) { return this._get(4).unsubscribeUserStatus(e2); } }, { key: "getFriendList", value: function() { var e2 = this._get(8); return e2 ? e2.getLocalFriendList() : D({ code: L.NO_MODULE }); } }, { key: "addFriend", value: function(e2) { var t2 = this._get(8); return t2 ? t2.addFriend(e2) : D({ code: L.NO_MODULE }); } }, { key: "deleteFriend", value: function(e2) { var t2 = this._get(8); return t2 ? t2.deleteFriend(e2) : D({ code: L.NO_MODULE }); } }, { key: "checkFriend", value: function(e2) { var t2 = this._get(8); return t2 ? t2.checkFriend(e2) : D({ code: L.NO_MODULE }); } }, { key: "getFriendProfile", value: function(e2) { var t2 = this._get(8); return t2 ? t2.getFriendProfile(e2) : D({ code: L.NO_MODULE }); } }, { key: "updateFriend", value: function(e2) { var t2 = this._get(8); return t2 ? t2.updateFriend(e2) : D({ code: L.NO_MODULE }); } }, { key: "getFriendApplicationList", value: function() { var e2 = this._get(8); return e2 ? e2.getLocalFriendApplicationList() : D({ code: L.NO_MODULE }); } }, { key: "acceptFriendApplication", value: function(e2) { var t2 = this._get(8); return t2 ? t2.acceptFriendApplication(e2) : D({ code: L.NO_MODULE }); } }, { key: "refuseFriendApplication", value: function(e2) { var t2 = this._get(8); return t2 ? t2.refuseFriendApplication(e2) : D({ code: L.NO_MODULE }); } }, { key: "deleteFriendApplication", value: function(e2) { var t2 = this._get(8); return t2 ? t2.deleteFriendApplication(e2) : D({ code: L.NO_MODULE }); } }, { key: "setFriendApplicationRead", value: function() { var e2 = this._get(8); return e2 ? e2.setFriendApplicationRead() : D({ code: L.NO_MODULE }); } }, { key: "getFriendGroupList", value: function() { var e2 = this._get(8); return e2 ? e2.getLocalFriendGroupList() : D({ code: L.NO_MODULE }); } }, { key: "createFriendGroup", value: function(e2) { var t2 = this._get(8); return t2 ? t2.createFriendGroup(e2) : D({ code: L.NO_MODULE }); } }, { key: "deleteFriendGroup", value: function(e2) { var t2 = this._get(8); return t2 ? t2.deleteFriendGroup(e2) : D({ code: L.NO_MODULE }); } }, { key: "addToFriendGroup", value: function(e2) { var t2 = this._get(8); return t2 ? t2.addToFriendGroup(e2) : D({ code: L.NO_MODULE }); } }, { key: "removeFromFriendGroup", value: function(e2) { var t2 = this._get(8); return t2 ? t2.removeFromFriendGroup(e2) : D({ code: L.NO_MODULE }); } }, { key: "renameFriendGroup", value: function(e2) { var t2 = this._get(8); return t2 ? t2.renameFriendGroup(e2) : D({ code: L.NO_MODULE }); } }, { key: "followUser", value: function(e2) { var t2 = this._get(35); return t2 ? t2.followUser(e2) : D({ code: L.NO_MODULE }); } }, { key: "unfollowUser", value: function(e2) { var t2 = this._get(35); return t2 ? t2.unfollowUser(e2) : D({ code: L.NO_MODULE }); } }, { key: "getMyFollowersList", value: function(e2) { var t2 = this._get(35); return t2 ? t2.getMyFollowersList(e2) : D({ code: L.NO_MODULE }); } }, { key: "getMyFollowingList", value: function(e2) { var t2 = this._get(35); return t2 ? t2.getMyFollowingList(e2) : D({ code: L.NO_MODULE }); } }, { key: "getMutualFollowersList", value: function(e2) { var t2 = this._get(35); return t2 ? t2.getMutualFollowersList(e2) : D({ code: L.NO_MODULE }); } }, { key: "getUserFollowInfo", value: function(e2) { var t2 = this._get(35); return t2 ? t2.getUserFollowInfo(e2) : D({ code: L.NO_MODULE }); } }, { key: "checkFollowType", value: function(e2) { var t2 = this._get(35); return t2 ? t2.checkFollowType(e2) : D({ code: L.NO_MODULE }); } }, { key: "getGroupList", value: function() { var e2 = this._get(7); return e2 ? e2.getGroupList() : D({ code: L.NO_MODULE }); } }, { key: "getGroupProfile", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupProfile(e2) : D({ code: L.NO_MODULE }); } }, { key: "createGroup", value: function(e2) { var t2 = this._get(7); return t2 ? t2.createGroup(e2) : D({ code: L.NO_MODULE }); } }, { key: "dismissGroup", value: function(e2) { var t2 = this._get(7); return t2 ? t2.dismissGroup(e2) : D({ code: L.NO_MODULE }); } }, { key: "updateGroupProfile", value: function(e2) { var t2 = this._get(7); return t2 ? t2.updateGroupProfile(e2) : D({ code: L.NO_MODULE }); } }, { key: "joinGroup", value: function(e2) { var t2 = this._get(7); return t2 ? t2.joinGroup(e2) : D({ code: L.NO_MODULE }); } }, { key: "quitGroup", value: function(e2) { var t2 = this._get(7); return t2 ? t2.quitGroup(e2) : D({ code: L.NO_MODULE }); } }, { key: "searchGroupByID", value: function(e2) { var t2 = this._get(7); return t2 ? t2.searchGroupByID(e2) : D({ code: L.NO_MODULE }); } }, { key: "getGroupOnlineMemberCount", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupOnlineMemberCount(e2) : D({ code: L.NO_MODULE }); } }, { key: "changeGroupOwner", value: function(e2) { var t2 = this._get(7); return t2 ? t2.changeGroupOwner(e2) : D({ code: L.NO_MODULE }); } }, { key: "getGroupApplicationList", value: function() { var e2 = this._get(7); return e2 ? e2.getGroupApplicationList() : D({ code: L.NO_MODULE }); } }, { key: "handleGroupApplication", value: function(e2) { var t2 = this._get(7); return t2 ? t2.handleGroupApplication(e2) : D({ code: L.NO_MODULE }); } }, { key: "initGroupAttributes", value: function(e2) { var t2 = this._get(7); return t2 ? t2.initGroupAttributes(e2) : D({ code: L.NO_MODULE }); } }, { key: "setGroupAttributes", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupAttributes(e2) : D({ code: L.NO_MODULE }); } }, { key: "deleteGroupAttributes", value: function(e2) { var t2 = this._get(7); return t2 ? t2.deleteGroupAttributes(e2) : D({ code: L.NO_MODULE }); } }, { key: "getGroupAttributes", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupAttributes(e2) : D({ code: L.NO_MODULE }); } }, { key: "setGroupCounters", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupCounters(e2) : D({ code: L.NO_MODULE }); } }, { key: "increaseGroupCounter", value: function(e2) { var t2 = this._get(7); return t2 ? t2.increaseGroupCounter(e2) : D({ code: L.NO_MODULE }); } }, { key: "decreaseGroupCounter", value: function(e2) { var t2 = this._get(7); return t2 ? t2.decreaseGroupCounter(e2) : D({ code: L.NO_MODULE }); } }, { key: "getGroupCounters", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupCounters(e2) : D({ code: L.NO_MODULE }); } }, { key: "getGroupMemberList", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupMemberList(e2) : D({ code: L.NO_MODULE }); } }, { key: "getGroupMemberProfile", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupMemberProfile(e2) : D({ code: L.NO_MODULE }); } }, { key: "addGroupMember", value: function(e2) { var t2 = this._get(7); return t2 ? t2.addGroupMember(e2) : D({ code: L.NO_MODULE }); } }, { key: "deleteGroupMember", value: function(e2) { var t2 = this._get(7); return t2 ? t2.deleteGroupMember(e2) : D({ code: L.NO_MODULE }); } }, { key: "setGroupMemberMuteTime", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupMemberMuteTime(e2) : D({ code: L.NO_MODULE }); } }, { key: "setGroupMemberRole", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupMemberRole(e2) : D({ code: L.NO_MODULE }); } }, { key: "setGroupMemberNameCard", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupMemberNameCard(e2) : D({ code: L.NO_MODULE }); } }, { key: "setGroupMemberCustomField", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupMemberCustomField(e2) : D({ code: L.NO_MODULE }); } }, { key: "markGroupMemberList", value: function(e2) { var t2 = this._get(7); return t2 ? t2.markGroupMemberList(e2) : D({ code: L.NO_MODULE }); } }, { key: "getJoinedCommunityList", value: function() { return this._get(10).getJoinedCommunityList(); } }, { key: "createTopicInCommunity", value: function(e2) { return this._get(10).createTopicInCommunity(e2); } }, { key: "deleteTopicFromCommunity", value: function(e2) { return this._get(10).deleteTopicFromCommunity(e2); } }, { key: "updateTopicProfile", value: function(e2) { return this._get(10).updateTopicProfile(e2); } }, { key: "getTopicList", value: function(e2) { return this._get(10).getTopicList(e2); } }, { key: "addSignalingListener", value: function(e2, t2, n2) { var o2 = this._get(33); o2 && o2.addSignalingListener(e2, this._safetyCallbackFactory.defense(e2, t2, n2), n2); } }, { key: "removeSignalingListener", value: function(e2, t2, n2) { var o2, i2 = this._safetyCallbackFactory.find(e2, t2); null !== i2 && (o2 = this._get(33)) && (o2.removeSignalingListener(e2, i2, n2), this._safetyCallbackFactory.delete(e2, t2)); } }, { key: "invite", value: function(e2) { var t2 = this._get(33); return t2 ? t2.invite(e2) : D({ code: L.NO_MODULE }); } }, { key: "inviteSync", value: function(e2, t2, n2) { var o2 = this._get(33); return o2 ? o2.inviteSync(e2, t2, n2) : ""; } }, { key: "inviteInGroup", value: function(e2) { var t2 = this._get(33); return t2 ? t2.invite(e2) : D({ code: L.NO_MODULE }); } }, { key: "inviteInGroupSync", value: function(e2, t2, n2) { var o2 = this._get(33); return o2 ? o2.inviteSync(e2, t2, n2) : ""; } }, { key: "cancel", value: function(e2) { var t2 = this._get(33); return t2 ? t2.cancel(e2) : D({ code: L.NO_MODULE }); } }, { key: "accept", value: function(e2) { var t2 = this._get(33); return t2 ? t2.accept(e2) : D({ code: L.NO_MODULE }); } }, { key: "reject", value: function(e2) { var t2 = this._get(33); return t2 ? t2.reject(e2) : D({ code: L.NO_MODULE }); } }, { key: "getSignalingInfo", value: function(e2) { var t2 = this._get(33); return t2 ? t2.getSignalingInfo(e2) : null; } }, { key: "modifyInvitation", value: function(e2) { var t2 = this._get(33); return t2 ? t2.modifyInvitation(e2) : D({ code: L.NO_MODULE }); } }]), Rc), Ac = { 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 Rc(e2) { d(this, Rc); e2 = { SDKAppID: e2.SDKAppID, unlimitedAVChatRoom: e2.unlimitedAVChatRoom || false, scene: e2.scene || "", oversea: e2.oversea || false, instanceID: qt(), devMode: e2.devMode || false, testEnv: e2.testEnv || false, proxyServer: e2.proxyServer || void 0, fileUploadProxy: e2.fileUploadProxy || void 0, fileDownloadProxy: e2.fileDownloadProxy || e2.fileUploadProxy || void 0, eventThrottling: false !== e2.eventThrottling, partialUpdatedConversations: true === e2.partialUpdatedConversations, modules: e2.modules || void 0 }; this._m = new Lc(e2), this._safetyCallbackFactory = new Sc(this._m); } function Oc(e2) { d(this, Oc), this._funcMap = /* @__PURE__ */ new Map(), this._m = e2, this._n = "SafetyCallback", this._reportCount = 0; } function Nc(t2) { var n2 = this; d(this, Nc); var o2, e2 = new G("sdkConstruct"), i2 = (this._n = "ModuleManager", this._isReady = false, this._reason = L.USER_NOT_LOGGED_IN, this._startLoginTs = 0, this._map = /* @__PURE__ */ new Map(), this._optionalModuleMap = /* @__PURE__ */ new Map(), this._iEmitter = null, this._oEmitter = null, this._checkCount = 0, this._checkTimer = -1, this._map.set(12, new Ri(this, t2)), this._map.set(37, new Ec(this)), this._map.set(15, new pa(this)), this._map.set(27, new ir(this)), this._map.set(23, new Hs(this)), this._map.set(24, new nr(this)), this._map.set(26, new Js(this)), this._map.set(21, new ds(this)), this._map.set(20, new Vs(this)), this._map.set(1, new Ni(this)), this._map.set(2, new wa(this)), this._map.set(3, new Fa(this)), this._map.set(34, new qa(this)), this._map.set(31, new xa(this)), this._map.set(4, new Ai(this)), this._map.set(6, new qo(this)), this._map.set(11, new ci(this)), this._map.set(7, new yi(this)), this._map.set(10, new Di(this)), this._map.set(13, new ra(this)), this._map.set(32, new ur(this)), this._map.set(14, new ua(this)), this._map.set(17, new Ca(this)), this._map.set(18, new Va(this)), this._map.set(19, new Ha(this)), this._map.set(25, new Bs(this)), this._map.set(8, new tr(this)), this._map.set(28, new ar(this)), this._map.set(36, new sr(this)), this._map.set(29, new rr(this)), this._map.set(30, new cr(this)), this._map.set(33, new fr(this)), this._map.set(35, new Ir(this)), this._eventThrottleMap = /* @__PURE__ */ new Map(), this._eventThrottling = t2.eventThrottling, this._map.get(12).isPartialUpdatedConvs() && (this._eventThrottling = false), f(t2.modules) ? (Object.keys(t2.modules).forEach(function(e3) { o2 = t2.modules[e3], "group-module" === e3 ? n2._map.set(7, new o2(n2)) : "relationship-module" === e3 ? n2._map.set(8, new o2(n2)) : "signaling-module" === e3 ? n2._map.set(33, new o2(n2)) : "follow-module" === e3 && n2._map.set(35, new o2(n2)), n2._optionalModuleMap.set(e3, 1); }), this._map.get(12).setUsingChatCore(true)) : this._map.has(7) || this._map.get(12).setUsingChatCore(true), t2.instanceID), a2 = t2.SDKAppID, s2 = this._map.get(12).isIntl(), r2 = this._map.get(12).isUsingChatCore(), i2 = "instanceID:".concat(i2, " SDKAppID:").concat(a2, " isIntl:").concat(s2, " isUsingChatCore:").concat(r2, " host:").concat(xt()) + " isIOSWebView:".concat(be, " platform:").concat(De, " canIUseInflate:").concat(this.canIUseInflate()) + " workerAvailable:".concat(Ge, " eventThrottling:").concat(this._eventThrottling, " UserAgent:").concat(Te); G.bindEventStatModule(this._map.get(14)), G.bindNetMonitorModule(this._map.get(15)), e2.setMessage("".concat(i2, " ").concat(function() { var t3 = ""; if (v) try { var e3 = I.getSystemInfoSync(), n3 = e3.model, o3 = e3.version, i3 = e3.system, a3 = e3.platform, s3 = e3.SDKVersion, t3 = "model:".concat(n3, " version:").concat(o3, " system:").concat(i3, " platform:").concat(a3, " SDKVersion:").concat(s3); } catch (e4) { t3 = ""; } return t3; }())).end(), M.i("SDK ".concat(i2)), E.prototype._getErrMsg = this.getErrMsg.bind(this), this._readyList = void 0, this._ssoLogForReady = null, this._initReadyList(); } function Gc(e2) { d(this, Gc), this._m = e2, this._n = "InflateModule", this._bLogForInflateOK = false, this._bLogForInflateError = false; } var Pc = {}, o = {}; return o.create = function(e2) { var t2 = "TencentCloudChat.create", n2 = 0, o2 = e2.SDKAppID; if (R(o2)) n2 = o2; else if (n2 = parseInt(o2), isNaN(o2)) return M.e("".concat(t2, " failed. Failed to parse the SDKAppID, please check the arguments")), null; if (n2 && Pc[n2]) return Pc[n2]; M.l("".concat(t2)); var s2, i2, o2 = new kc(y(y({}, e2), {}, { SDKAppID: n2 })), e2 = (o2.on(h.SDK_DESTROY, function(e3) { Pc[e3.data.SDKAppID] = null, delete Pc[e3.data.SDKAppID]; }), s2 = o2, i2 = /* @__PURE__ */ Object.create(null), Object.keys(Fn).forEach(function(a2) { var t3; s2[a2] && (t3 = new $(), i2[a2] = function() { var e3 = Array.from(arguments); return t3.use(function(e4, t4) { i3 = a2; var n3, o3, i3 = !(!(n3 = s2).isReady() && 1 !== Ac[i3]) || (o3 = { code: o3 = n3.getNotReadyReason(), message: "".concat(n3.getErrMsg(o3), " | ").concat(i3, " | ").concat(n3.getErrMsg(L.SDK_IS_NOT_READY)) }, n3.onError(o3), o3); return true === i3 ? t4() : D(i3); }).use(function(e4, t4) { if (true === function(n3, o3, i3) { if (void 0 === o3) return true; var a3 = true; if (f(o3)) Object.keys(o3).forEach(function(e6) { var t5 = 1 === n3.length ? n3[0][e6] : void 0; a3 = !!an(t5, o3[e6], i3, e6) && a3; }); else if (O(o3)) for (var e5 = 0; e5 < o3.length; e5++) a3 = !!an(n3[e5], o3[e5], i3, o3[e5].name) && a3; if (a3) return a3; throw new Error("Params validate failed."); }(e4, wn[a2], a2)) return t4(); }).use(function(e4, t4) { return s2[a2].apply(s2, e4); }), t3.run(e3); }); }), i2); return Pc[n2] = e2, wn.hookGetAPITips(o2.getErrMsg.bind(o2)), M.l("".concat(t2, " ok")), e2; }, o.TYPES = A, o.EVENT = h, o.TSignaling = Q, o.VERSION = "3.4.7", M.l("TencentCloudChat.VERSION:".concat(o.VERSION)), o; }); } }); export default require_chat(); //# sourceMappingURL=@tencentcloud_chat.js.map