import { __commonJS } from "./chunk-TDUMLE5V.js"; // ../../../../../桌面/jiuyiUniapp/service/node_modules/@tencentcloud/chat/index.js var require_chat = __commonJS({ "../../../../../桌面/jiuyiUniapp/service/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 o(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 ? o(Object(n2), true).forEach(function(e3) { c(t2, e3, n2[e3]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t2, Object.getOwnPropertyDescriptors(n2)) : o(Object(n2)).forEach(function(e3) { Object.defineProperty(t2, e3, Object.getOwnPropertyDescriptor(n2, e3)); }); } return t2; } function r(e2) { return (r = "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 i(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 && i(e2.prototype, t2), n2 && i(e2, n2), Object.defineProperty(e2, "prototype", { writable: false }), e2; } function c(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 && l(e2, t2); } function u(e2) { return (u = Object.setPrototypeOf ? Object.getPrototypeOf : function(e3) { return e3.__proto__ || Object.getPrototypeOf(e3); })(e2); } function l(e2, t2) { return (l = Object.setPrototypeOf || function(e3, t3) { return e3.__proto__ = t3, e3; })(e2, t2); } function p() { 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 _(e2, t2, n2) { return (_ = p() ? Reflect.construct : function(e3, t3, n3) { var o2 = [null], t3 = (o2.push.apply(o2, t3), new (Function.bind.apply(e3, o2))()); return n3 && l(t3, n3.prototype), t3; }).apply(null, arguments); } function n(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 _(e3, arguments, u(this).constructor); } return t2.prototype = Object.create(e3.prototype, { constructor: { value: t2, enumerable: false, writable: true, configurable: true } }), l(t2, e3); }(e2); } function g(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 h(e2) { if (void 0 === e2) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e2; } function f(n2) { var o2 = p(); return function() { var e2, t2 = u(n2), t2 = (e2 = o2 ? (e2 = u(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 h(t2); }; } function m(e2, t2) { return E(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) || S(e2, t2) || O(); } function D(e2) { return function(e3) { if (Array.isArray(e3)) return k(e3); }(e2) || L(e2) || S(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 E(e2) { if (Array.isArray(e2)) return e2; } function L(e2) { if ("undefined" != typeof Symbol && null != e2[Symbol.iterator] || null != e2["@@iterator"]) return Array.from(e2); } function S(e2, t2) { if (e2) { if ("string" == typeof e2) return k(e2, t2); var n2 = Object.prototype.toString.call(e2).slice(8, -1); return "Map" === (n2 = "Object" === n2 && e2.constructor ? e2.constructor.name : n2) || "Set" === n2 ? Array.from(e2) : "Arguments" === n2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2) ? k(e2, t2) : void 0; } } function k(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 O() { 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 N(e2, t2) { var n2, o2 = "undefined" != typeof Symbol && e2[Symbol.iterator] || e2["@@iterator"]; if (!o2) { if (Array.isArray(e2) || (o2 = S(e2)) || t2 && e2 && "number" == typeof e2.length) return o2 && (e2 = o2), n2 = 0, { s: t2 = function() { }, n: function() { return n2 >= e2.length ? { done: true } : { done: false, value: e2[n2++] }; }, 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 i2, a2 = true, s2 = false; return { s: function() { o2 = o2.call(e2); }, n: function() { var e3 = o2.next(); return a2 = e3.done, e3; }, e: function(e3) { s2 = true, i2 = e3; }, f: function() { try { a2 || null == o2.return || o2.return(); } finally { if (s2) throw i2; } } }; } var G = { 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" }, R = { 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" }, P = { 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 }, U = (e(j, [{ 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(); } }]), j), b = (e(W, [{ 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; } }]), W), w = { TEST: { CHINA: { DEFAULT: "wss://wss-dev.tim.qq.com" }, OVERSEA: { DEFAULT: "wss://wss-dev.tim.qq.com" }, SINGAPORE: { DEFAULT: "wss://wsssgp-dev.im.qcloud.com" }, KOREA: { DEFAULT: "wss://wsskr-dev.im.qcloud.com" }, GERMANY: { DEFAULT: "wss://wssger-dev.im.qcloud.com" }, IND: { DEFAULT: "wss://wssind-dev.im.qcloud.com" }, JPN: { DEFAULT: "wss://wssjpn-dev.im.qcloud.com" }, USA: { DEFAULT: "wss://wssusa-dev.im.qcloud.com" }, INDONESIA: { DEFAULT: "wss://wssidn-dev.im.qcloud.com" } }, PRODUCTION: { CHINA: { DEFAULT0: "wss://*w4c.my-imcloud.com", DEFAULT: "wss://wss.im.qcloud.com", IPV6: "wss://wssv6.im.qcloud.com", BACKUP: "wss://wss.tim.qq.com", STAT: "https://events.im.qcloud.com", ANYCAST: "wss://162.14.13.203" }, OVERSEA: { DEFAULT0: "wss://*w4c.my-imcloud.com", DEFAULT: "wss://wss.im.qcloud.com", BACKUP: "wss://wss.my-imcloud.com", STAT: "https://api.my-imcloud.com" }, SINGAPORE: { DEFAULT0: "wss://*w4s.my-imcloud.com", DEFAULT: "wss://wsssgp.im.qcloud.com", IPV6: "wss://wsssgpv6.im.qcloud.com", BACKUP: "wss://wsssgp.my-imcloud.com", STAT: "https://apisgp.my-imcloud.com", ANYCAST: "wss://162.14.19.159" }, KOREA: { DEFAULT0: "wss://*w4k.my-imcloud.com", DEFAULT: "wss://wsskr.im.qcloud.com", IPV6: "wss://wsskrv6.im.qcloud.com", BACKUP: "wss://wsskr.my-imcloud.com", STAT: "https://apikr.my-imcloud.com", ANYCAST: "wss://162.14.13.104" }, GERMANY: { DEFAULT0: "wss://*w4g.my-imcloud.com", DEFAULT: "wss://wssger.im.qcloud.com", IPV6: "wss://wssgerv6.im.qcloud.com", BACKUP: "wss://wssger.my-imcloud.com", STAT: "https://apiger.my-imcloud.com", ANYCAST: "wss://162.14.3.17" }, IND: { DEFAULT0: "wss://*w4i.my-imcloud.com", DEFAULT: "wss://wssind.my-imcloud.com", IPV6: "wss://wssindv6.im.qcloud.com", BACKUP: "wss://wssind.im.qcloud.com", STAT: "https://apiind.my-imcloud.com", ANYCAST: "wss://162.14.19.46" }, JPN: { DEFAULT0: "wss://*w4j.my-imcloud.com", DEFAULT: "wss://wssjpn.im.qcloud.com", IPV6: "wss://wssjpnv6.im.qcloud.com", BACKUP: "wss://wssjpn.my-imcloud.com", STAT: "https://apijpn.my-imcloud.com" }, USA: { DEFAULT0: "wss://*w4u.my-imcloud.com", DEFAULT: "wss://wssusa.im.qcloud.com", IPV6: "wss://wssusav6.im.qcloud.com", BACKUP: "wss://wssusa.my-imcloud.com", STAT: "https://apiusa.my-imcloud.com", ANYCAST: "wss://162.14.10.42" }, INDONESIA: { DEFAULT0: "wss://*w4y.my-imcloud.com", DEFAULT: "wss://wssidn.im.qcloud.com", IPV6: "wss://wssidnv6.im.qcloud.com", BACKUP: "wss://wssidn.my-imcloud.com", STAT: "https://apiidn.my-imcloud.com", ANYCAST: "wss://43.129.34.169" } } }, F = { 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 }, q = "1.7.3", x = 537048168, V = "CHINA", a = { HOST: { CURRENT: { DEFAULT: "wss://wss.im.qcloud.com", STAT: "https://events.im.qcloud.com" }, setCurrent: function() { this.CURRENT = w.PRODUCTION[0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : V]; } }, NAME: { OPEN_IM: "openim", OPEN_IM_MSG_EXT: "openim_msg_ext_http_svc", GRP: "group_open_http_svc", GRP_AV: "group_open_avchatroom_http_svc", GRP_COMMUNITY: "million_group_open_http_svc", GRP_ATTR: "group_open_attr_http_svc", FD: "sns", PROFILE: "profile", RECENT_CONTACT: "recentcontact", PIC: "openpic", BIG_GRP_NO_AUTH: "group_open_http_noauth_svc", BIG_GRP_POLLING: "group_open_long_polling_http_svc", BIG_GRP_POLLING_NO_AUTH: "group_open_long_polling_http_noauth_svc", IM_OPEN_STAT: "imopenstat", WEB_IM: "webim", IM_COS_SIGN: "im_cos_sign_svr", CUSTOM_UPLOAD: "im_cos_msg", HEARTBEAT: "heartbeat", IM_OPEN_PUSH: "im_open_push", IM_OPEN_STATUS: "im_open_status", IM_LONG_MSG: "im_long_msg", IM_CONFIG_MANAGER: "im_sdk_config_mgr", STAT_SERVICE: "StatSvc", OVERLOAD_PUSH: "OverLoadPush", IM_MSG_AUDIT_MGR: "im_msg_audit_mgr", TUIROOM_SVR: "tui_room_svr", IM_OPEN_TRANSLATE: "im_open_translate", IM_OPEN_SPEECH: "im_open_speech", MSG_SEARCH: "message_search", GRP_SEARCH: "group_search", GRP_MEMBER_SEARCH: "group_member_search", USER_SEARCH: "user_search", FOLLOW: "follow", OFFLINE_PUSH_REPORT: "offline_push_report", IM_MSG_LOGIC: "im_msg_db_logic" } }, H = { SEARCH_GRP_SNS: new b(0, Math.pow(2, 1)).toString(), AV_HISTORY_MSG: new b(0, Math.pow(2, 2)).toString(), GRP_COMMUNITY: new b(0, Math.pow(2, 3)).toString(), MSG_TO_SPECIFIED_GRP_MBR: new b(0, Math.pow(2, 4)).toString(), AV_MBR_LIST: new b(0, Math.pow(2, 6)).toString(), USER_STATUS: new b(0, Math.pow(2, 7)).toString(), CONV_MARK: new b(0, Math.pow(2, 9)).toString(), CONV_GROUP: new b(0, Math.pow(2, 10)).toString(), AV_BAN_MBR: new b(0, Math.pow(2, 11)).toString(), MSG_EXT: new b(0, Math.pow(2, 13)).toString(), GRP_COUNTER: new b(0, Math.pow(2, 15)).toString(), PLUGIN_TRANSLATE: new b(Math.pow(2, 6)).toString(), PLUGIN_VOICE_TO_TEXT: new b(Math.pow(2, 7)).toString(), PLUGIN_CS: new b(Math.pow(2, 8)).toString(), PLUGIN_PUSH: new b(Math.pow(2, 9)).toString(), PLUGIN_BOT: new b(Math.pow(2, 10)).toString(), MSG_REACTION: new b(Math.pow(2, 16)).toString(), FOLLOW: new b(Math.pow(2, 20)).toString() }, B = "group_profile", K = ["Type", "Name", "Introduction", "Notification", "FaceUrl", "Owner_Account", "CreateTime", "InfoSeq", "LastInfoTime", "LastMsgTime", "MemberNum", "MaxMemberNum", "ApplyJoinOption", "NextMsgSeq", "ShutUpAllMember", "InviteJoinOption"], Y = ["Role", "JoinTime", "MsgSeq", "MsgFlag"]; function W() { 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, W), this.high = e2, this.low = t2; } function j() { d(this, j), this.cache = [], this.options = null; } a.HOST.setCurrent(V); for (var J, z = "undefined" != typeof wx && "function" == typeof wx.getSystemInfoSync && Boolean(wx.getSystemInfoSync().fontSizeSetting), X = z && "function" == typeof wx.createGamePortal, Z = "undefined" != typeof qq && "function" == typeof qq.getSystemInfoSync && Boolean(qq.getSystemInfoSync().fontSizeSetting), Q = "undefined" != typeof tt && "function" == typeof tt.getSystemInfoSync && Boolean(tt.getSystemInfoSync().fontSizeSetting), $ = "undefined" != typeof swan && "function" == typeof swan.getSystemInfoSync && Boolean(swan.getSystemInfoSync().fontSizeSetting), ee = "undefined" != typeof my && "function" == typeof my.getSystemInfoSync && Boolean(my.getSystemInfoSync().fontSizeSetting), te = "undefined" != typeof jd && "function" == typeof jd.getSystemInfoSync, ne = "undefined" != typeof uni && "undefined" == typeof window && "function" == typeof uni.requireNativePlugin, oe = z && "object" === r(wx.miniapp), ie = "undefined" != typeof uni, ae = z || Z || Q || $ || ee || ne || te, se = "undefined" == typeof window && !ae && "undefined" != typeof global && void 0 !== global.NativeScriptGlobals, re = "undefined" != typeof global && (void 0 !== global.nativeModuleProxy || void 0 !== global.ReactNative), ce = "undefined" != typeof uni ? !ae : "undefined" != typeof window && !ae && !re, ue = Z ? qq : Q ? tt : $ ? swan : ee ? my : z ? wx : ne ? uni : te ? jd : {}, le = ce && window && window.navigator && window.navigator.userAgent || "", de = (te = "WEB", /(micromessenger|webbrowser)/i.test(le) ? te = "WEB" : Z ? te = "QQ_MP" : Q ? te = "TT_MP" : $ ? te = "BAIDU_MP" : ee ? te = "ALI_MP" : z ? te = oe ? "DONUT_NATIVE_APP" : "WX_MP" : ne ? te = "UNI_NATIVE_APP" : se ? te = "NS_NATIVE_APP" : re && (te = "RN_NATIVE_APP"), F[te]), oe = /iPad/i.test(le), se = /iPhone/i.test(le) && !oe, te = /iPod/i.test(le), pe = se || oe || te, _e = (se = le.match(/OS (\d+)_/i)) && se[1] ? se[1] : null, he = /Android/i.test(le), ge = function() { var e2 = le.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i); if (!e2) return null; var t2 = e2[1] && parseFloat(e2[1]), n2 = e2[2] && parseFloat(e2[2]); return t2 && n2 ? parseFloat(e2[1] + "." + e2[2]) : t2 || null; }(), oe = /Edge/i.test(le), te = !oe && /Chrome/i.test(le), fe = /MSIE/.test(le) || -1 < le.indexOf("Trident") && -1 < le.indexOf("rv:11.0"), me = se = !(se = (se = /MSIE\s(\d+)\.\d/.exec(le)) && parseFloat(se[1])) && /Trident\/7.0/i.test(le) && /rv:11.0/.test(le) ? 11 : se, ve = /Safari/i.test(le) && !te && !he && !oe, Ie = /Windows/i.test(le), Me = /MAC OS X/i.test(le), ye = ce && "undefined" != typeof Worker && !fe, Ce = he || pe, Te = ce && void 0 !== window.tencent_cloud_im_csig_flutter_for_web_25F_cy, De = function() { if ("undefined" == typeof window || void 0 === window.navigator) return false; var e2 = window.navigator.standalone; return !(!pe || e2 || ve); }(), Ee = "undefined" != typeof console ? console : "undefined" != typeof global && global.console ? global.console : "undefined" != typeof window && window.console ? window.console : {}, Le = function() { }, Se = ["assert", "clear", "count", "debug", "dir", "dirxml", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "profile", "profileEnd", "table", "time", "timeEnd", "timeStamp", "trace", "warn"], ke = Se.length; ke--; ) J = Se[ke], console[J] || (Ee[J] = Le); function Re() { var e2 = /* @__PURE__ */ new Date(); return e2.setTime(Pe()), e2; } function Ae() { Ge = 0; } function Oe() { return Math.floor(Pe() / 1e3); } var Ne = Ee, Ge = 0, Pe = function() { return (/* @__PURE__ */ new Date()).getTime() + Ge; }, Ue = 0; function be() { return Jt() ? "%c Chat %c" : "Chat"; } function we() { var e2 = Re(); 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 v = { arguments2String: function(e2) { var t2 = ""; if (1 === e2.length) t2 = e2[0]; else for (var n2 = 0, o2 = e2.length; n2 < o2; n2++) { if (mt(e2[n2])) try { t2 += vt(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) { Jt() ? Ne[e2](be(), "background:#0abf5b; padding:1px; border-radius:3px; color: #fff", "background:transparent", we(), t2) : Ne[e2]("".concat(be(), " ").concat(we(), " ").concat(t2)); }, d: function() { var e2; Ue <= -1 && (e2 = this.arguments2String(arguments), this._exec("debug", e2)); }, l: function() { var e2; Ue <= 0 && (e2 = this.arguments2String(arguments), this._exec("log", e2)); }, log: function() { var e2; Ue <= 0 && (e2 = this.arguments2String(arguments), this._exec("log", e2)); }, i: function() { var e2; Ue <= 1 && (e2 = this.arguments2String(arguments), this._exec("info", e2)); }, w: function() { var e2; Ue <= 2 && (e2 = this.arguments2String(arguments), this._exec("warn", e2)); }, e: function() { var e2; Ue <= 3 && (e2 = this.arguments2String(arguments), this._exec("error", e2)); }, setLevel: function(e2) { e2 < 4 && this._exec("log", "set level from " + Ue + " to " + e2), Ue = e2; }, getLevel: function() { return Ue; } }, Fe = { JPG: 1, JPEG: 1, GIF: 2, PNG: 3, BMP: 4, UNKNOWN: 255 }, se = "Tag_Profile_IM_", qe = { NICK: "".concat(se, "Nick"), GENDER: "".concat(se, "Gender"), BIRTHDAY: "".concat(se, "BirthDay"), LOCATION: "".concat(se, "Location"), SELFSIGNATURE: "".concat(se, "SelfSignature"), ALLOWTYPE: "".concat(se, "AllowType"), LANGUAGE: "".concat(se, "Language"), AVATAR: "".concat(se, "Image"), MESSAGESETTINGS: "".concat(se, "MsgSettings"), ADMINFORBIDTYPE: "".concat(se, "AdminForbidType"), LEVEL: "".concat(se, "Level"), ROLE: "".concat(se, "Role") }, xe = { 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") }, te = "Gender_Type_", Ve = { UNKNOWN: "".concat(te, "Unknown"), FEMALE: "".concat(te, "Female"), MALE: "".concat(te, "Male") }, He = { NONE: "".concat("AdminForbid_Type_", "None"), SEND_OUT: "".concat("AdminForbid_Type_", "SendOut") }, Be = { NEED_CONFIRM: "".concat("AllowType_Type_", "NeedConfirm"), ALLOW_ANY: "".concat("AllowType_Type_", "AllowAny"), DENY_ANY: "".concat("AllowType_Type_", "DenyAny") }, Ke = "JoinedSuccess", Ye = "WaitAdminApproval", We = "@TOPIC#_", je = Object.prototype.hasOwnProperty; function Je(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 (et(e2)) { for (var t2 in e2) if (je.call(e2, t2)) return false; return true; } return !!(ze(e2) || Xe(e2) || Ze(e2)) && 0 === e2.size; } function ze(e2) { return "map" === It(e2); } function Xe(e2) { return "set" === It(e2); } function Ze(e2) { return "file" === It(e2); } function Qe(e2) { return null !== e2 && ("number" == typeof e2 && !isNaN(+e2) || "object" === r(e2) && e2.constructor === Number); } function $e(e2) { return null !== e2 && "object" === r(e2); } function et(e2) { if ("object" === r(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 nt(e2) { return "function" == typeof Array.isArray ? Array.isArray(e2) : "array" === It(e2); } function ot(e2) { return nt(e2) && 0 < e2.length; } function it(e2) { return "function" == typeof e2; } function at(e2) { return "filelist" === It(e2); } function st(e2) { return "string" == typeof e2 && (e2 = e2[0], !/[^a-zA-Z0-9]/.test(e2)); } function rt(e2, t2, n2, o2) { if (!mt(e2) || !mt(t2)) return 0; for (var i2, a2 = 0, s2 = Object.keys(t2), r2 = 0, c2 = s2.length; r2 < c2; r2++) if (i2 = s2[r2], !(A(t2[i2]) || n2 && n2.includes(i2))) if (mt(e2[i2]) && mt(t2[i2])) a2 += rt(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 ct(e2, t2) { var n2, o2 = /* @__PURE__ */ new Map(), i2 = N(e2.entries()); try { for (i2.s(); !(n2 = i2.n()).done; ) { var a2 = m(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 ut(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 lt(e2) { return e2 = e2 || 99999999, Math.round(Math.random() * e2); } function dt() { for (var e2 = "", t2 = 32; 0 < t2; --t2) e2 += Mt[Math.floor(Math.random() * yt)]; return e2; } function pt(e2, t2) { for (var n2 in e2) if (e2[n2] === t2) return 1; } function _t(e2) { return -1 === e2.indexOf("http://") || -1 === e2.indexOf("https://") ? "https://" + e2 : e2.replace(/https|http/, "https"); } function ht(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 = r(e2[n2]), 0 <= ["string", "number", "function", "boolean"].indexOf(t2) ? o2[n2] = e2[n2] : o2[n2] = ht(e2[n2])) : o2[n2] = void 0 : o2[n2] = null; return o2; } var gt = ["url"], ft = function(e2) { return "string" == typeof e2; }, A = function(e2) { return void 0 === e2; }, mt = function(e2) { return nt(e2) || $e(e2); }, vt = function(e2) { return e2 instanceof Error; }, It = function(e2) { return Object.prototype.toString.call(e2).match(/^\[object (.*)\]$/)[1].toLowerCase(); }, Mt = (Date.now || (Date.now = function() { return (/* @__PURE__ */ new Date()).getTime(); }), "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), yt = Mt.length, Ct = {}; function Tt(o2, e2) { if (!nt(o2) || !nt(e2)) return false; var i2 = false; return 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 Dt(e2) { return Je(e2) ? [] : e2.filter(function(e3) { return true === e3.isModified; }); } function Et(e2) { if (et(e2) && et(e2.webhookInfo)) { var t2 = []; if (e2.webhookInfo.disableCloudMessagePreHook && t2.push("ForbidBeforeSendMsgCallback"), e2.webhookInfo.disableCloudMessagePostHook && t2.push("ForbidAfterSendMsgCallback"), 0 !== t2.length) return t2; } } function Lt(e2) { return Je(e2) ? [] : e2.filter(function(e3) { return false === e3.isModified; }); } function St(e2) { return e2 === R.GRP_AVCHATROOM; } function kt(e2) { var t2 = e2.type, e2 = e2.groupID; return t2 === R.GRP_COMMUNITY || "".concat(e2).startsWith("@TGS#_") && !"".concat(e2).includes(We); } function Rt(e2) { return "".concat(e2).startsWith("@TGS#_") && "".concat(e2).includes(We); } function At(e2) { return ft(e2) && e2.slice(0, 3) === R.CONV_C2C; } function Ot(e2) { return ft(e2) && e2.slice(0, 5) === R.CONV_GROUP; } function Nt(e2) { return ft(e2) && e2 === R.CONV_SYSTEM; } function Gt(t2, n2) { var o2 = {}; return Object.keys(t2).forEach(function(e2) { o2[e2] = n2(t2[e2], e2); }), o2; } function Pt(o2) { return re ? Promise.resolve({ width: 0, height: 0 }) : ae ? new Promise(function(t2, e2) { ue.getImageInfo({ src: o2, success: function(e3) { t2({ width: e3.width, height: e3.height }); }, fail: function() { t2({ width: 0, height: 0 }); } }); }) : fe && 9 === me ? 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 Ut() { 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 bt() { var e2 = he ? "android" : pe ? "ios" : Ie ? "windows" : Me ? "mac" : "unknown"; if (ae) try { var t2 = ue.getSystemInfoSync().platform; void 0 !== t2 && (e2 = t2); } catch (e3) { } return e2; } function wt(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 Ft(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")), A(t2) ? (i2.url, g(i2, gt)) : i2; } function qt(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 xt(e2) { e2 = e2.servcmd; return e2.slice(e2.indexOf(".") + 1); } function Vt(e2, t2) { return Math.round(Number(e2) * Math.pow(10, t2)) / Math.pow(10, t2); } function Ht(e2, t2) { return e2.includes(t2); } function Bt(e2, t2) { return e2.includes(t2); } function Kt(e2) { return e2.split(We)[0]; } var Yt = function(e2, t2, n2) { if (A(t2)) return ""; switch (e2) { case R.MSG_TEXT: return t2.text; case R.MSG_IMAGE: return n2 ? "[Image]" : "[图片]"; case R.MSG_LOCATION: return n2 ? "[Location]" : "[位置]"; case R.MSG_AUDIO: return n2 ? "[Voice]" : "[语音]"; case R.MSG_VIDEO: return n2 ? "[Video]" : "[视频]"; case R.MSG_FILE: return n2 ? "[File]" : "[文件]"; case R.MSG_CUSTOM: return n2 ? "[Custom Messages]" : "[自定义消息]"; case R.MSG_GRP_TIP: return n2 ? "[Group Notification]" : "[群提示消息]"; case R.MSG_GRP_SYS_NOTICE: return n2 ? "[Group System Message]" : "[群系统通知]"; case R.MSG_FACE: return n2 ? "[Animated Sticker]" : "[动画表情]"; case R.MSG_MERGER: return n2 ? "[Chat Record]" : "[聊天记录]"; default: return ""; } }; function Wt(e2) { return e2 === R.MSG_TEXT || e2 === R.MSG_CUSTOM || e2 === R.MSG_LOCATION || e2 === R.MSG_FACE; } function jt(e2) { var t2 = []; if (!ft(e2)) return t2; var n2 = e2.length; if (0 === n2) return t2; for (var o2 = n2 - 1; 0 <= o2; o2--) "1" === e2[o2] && t2.push(Math.pow(2, n2 - o2 - 1)); return t2; } function Jt() { return !fe && !ae; } function zt(e2) { return "the length of userIDList cannot exceed ".concat(e2); } function Xt(e2) { var t2; if (nt(e2) && 0 !== e2.length) return t2 = 0, e2.forEach(function(e3) { t2 += e3; }), t2.toFixed(0); } function Zt(e2) { var t2; if (nt(e2) && 0 !== e2.length) return t2 = 0, e2.forEach(function(e3) { t2 += e3; }), (t2 / e2.length).toFixed(0); } function Qt(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 $t(e2) { return e2 && 1 < e2 ? true : false; } function en(e2, t2, n2, o2) { if (void 0 === t2) return 1; var i2, a2, s2 = true; return t2.required && Je(e2) && (v.e("[".concat(n2, '] Missing required params: "').concat(o2, '".')), s2 = false), Je(e2) || (i2 = It(e2)) !== (a2 = t2.type.toLowerCase()) && ("asyncfunction" === i2 && "function" === a2 || (v.e("[".concat(n2, '] Invalid params: type check failed for "').concat(o2, '". Expected ').concat(t2.type, ".")), s2 = false)), t2.validator && !t2.validator(e2, n2, o2) && (v.e("[".concat(n2, '] Invalid params: custom validator check failed for "').concat(o2, '".')), s2 = false), s2; } function tn(e2) { return !!e2 && (!!(At(e2) || Ot(e2) || Nt(e2)) || ((e2 = xn("InvalidConversationID", e2)) && v.w(e2), false)); } function s(e2) { "" !== e2.desc && "" !== xn("API_REFER") && v.w("[".concat(e2.api, "] | ").concat(e2.paramName, " | ").concat(e2.desc, ", ").concat(xn("API_REFER")).concat(e2.api)); } function nn() { return xn("StringRequiredLog"); } function on(e2) { return xn("NonEmptyStringRequiredLog", e2); } function an() { return xn("NumberRequiredLog"); } function sn() { return xn("UndefinedNotAllowedLog"); } function rn() { return xn("FileRequiredLog"); } function cn() { return xn("FunctionRequiredLog"); } function un() { return xn("ArrayRequiredLog"); } function ln() { return xn("NonEmptyArrayLog"); } function dn() { return xn("CallbackMissingLog"); } function pn() { return xn("PositiveIntegerRequiredLog"); } function _n(e2, t2) { return xn("StringNotLongerThanLog", e2, t2); } function hn(e2, t2) { return xn("NumberGreaterThanLog", e2, t2); } function gn(e2, t2) { return xn("NumberGreaterOrEqualLog", e2, t2); } function fn(e2) { return xn("KeyValueStringRequiredLog", e2); } function mn() { return xn("PlainObjectRequiredLog"); } function vn() { return xn("NonEmptyContentRequiredLog"); } function In() { return xn("FileNotSelectedLog"); } function Mn() { return xn("MessageInstanceRequiredLog"); } function yn() { return xn("NonAnonymousFunctionLog"); } function Cn() { return xn("MessageExtensionNotAvailableLog"); } function Tn() { return xn("MessageReactionRequiredLog"); } function Dn(e2, t2) { return xn("ContainsUnsupportedTypeLog", e2, t2); } function En(e2, t2, n2, o2) { var i2 = o2.allowUndefined, a2 = o2.allowEmpty, o2 = o2.maxLength; return A(e2) ? !!i2 || (s({ api: t2, paramName: n2, desc: sn() }), false) : nt(e2) ? !(0 === e2.length && (s({ api: t2, paramName: n2, desc: ln() }), !a2) || o2 && e2.length > o2 && (s({ api: t2, paramName: n2, desc: xn("MaximumArrayLengthLog", n2, o2) }), 1)) : (s({ api: t2, paramName: n2, desc: un() }), false); } function Ln(e2, t2, n2, o2) { var i2 = o2.allowUndefined, a2 = o2.min, o2 = o2.max; return A(e2) ? !!i2 || (s({ api: t2, paramName: n2, desc: sn() }), false) : Qe(e2) ? Qe(a2) && e2 < a2 ? (s({ api: t2, paramName: n2, desc: 0 === a2 ? gn(n2, a2) : hn(n2, a2 - 1) }), false) : !(Qe(o2) && o2 < e2 && (s({ api: t2, paramName: n2, desc: xn("MaximumNumberLog", n2, o2) }), 1)) : (s({ api: t2, paramName: n2, desc: an() }), false); } function Sn(e2) { return { code: 0, data: e2 || {} }; } function kn(e2) { return Promise.resolve(Sn(e2)); } function C(e2) { var t2 = 1 < arguments.length && void 0 !== arguments[1] && arguments[1]; if (e2 instanceof Bn) return t2 && null !== Kn && Kn.emit(G.ERROR, e2), Promise.reject(e2); if (e2 instanceof Error) return n2 = new Bn({ code: T.UNCAUGHT_ERROR }), t2 && null !== Kn && Kn.emit(G.ERROR, n2), Promise.reject(n2); if (A(e2) || A(e2.code)) return Promise.reject(new Bn({ code: T.UNCAUGHT_ERROR })); var n2 = new Bn(e2); return t2 && null !== Kn && Kn.emit(G.ERROR, n2), Promise.reject(n2); } var Rn, An = "unSend", On = "success", Nn = "fail", Gn = "notStart", Pn = "pending", Un = "resolved", bn = "rejected", oe = { type: "String", required: true }, se = { type: "Array", required: true }, te = { type: "Object", required: true }, wn = { type: "Boolean", required: true }, Fn = { type: "number", required: true }, qn = { keywordListForMsg: { type: "Array", required: false, validator: function(e2, t2, n2) { return En(e2, t2, n2, { allowUndefined: true, allowEmpty: true, maxLength: 5 }); } }, keywordListExceptMsg: { type: "Array", required: true, validator: function(e2, t2, n2) { return En(e2, t2, n2, { allowUndefined: false, allowEmpty: false, maxLength: 5 }); } }, keywordListMatchType: { type: "String", required: false, validator: function(e2, t2, n2) { return !e2 || "or" === e2 || "and" === e2 || s({ api: t2, paramName: n2, desc: "".concat(e2, " is invalid match type") }); } }, cursor: { type: "String", required: false }, count: { type: "Number", required: false, validator: function(e2, t2, n2) { return Ln(e2, t2, n2, { allowUndefined: true, min: 1, max: 100 }); } }, groupTypeList: { type: "Array", required: false, validator: function(e2, t2, n2) { if (!e2) return true; if (!En(e2, t2, n2, { allowUndefined: true, allowEmpty: true })) return false; var o2 = [R.GRP_PUBLIC, R.GRP_COMMUNITY, R.GRP_WORK, R.GRP_MEETING]; return !(0 < e2.filter(function(e3) { return -1 === o2.indexOf(e3); }).length && (s({ api: t2, paramName: n2, desc: Dn(n2, "group") }), 1)); } } }, xn = null, Vn = { hookGetAPITips: function(e2) { xn = e2; }, login: { userID: oe, userSig: oe }, addToBlacklist: { userIDList: se }, removeFromBlacklist: { userIDList: se }, on: [{ name: "eventName", type: "String", validator: function(e2, t2, n2) { return "string" == typeof e2 && 0 !== e2.length || (s({ api: t2, paramName: n2, desc: on(n2) }), false); } }, { name: "handler", type: "Function", validator: function(e2, t2, n2) { return "function" != typeof e2 ? (s({ api: t2, paramName: n2, desc: cn() }), false) : ("" === e2.name && s({ api: t2, paramName: n2, desc: yn() }), true); } }], once: [{ name: "eventName", type: "String", validator: function(e2, t2, n2) { return "string" == typeof e2 && 0 !== e2.length || (s({ api: t2, paramName: n2, desc: on(n2) }), false); } }, { name: "handler", type: "Function", validator: function(e2, t2, n2) { return "function" != typeof e2 ? (s({ api: t2, paramName: n2, desc: cn() }), false) : ("" === e2.name && s({ api: t2, paramName: n2, desc: yn() }), true); } }], off: [{ name: "eventName", type: "String", validator: function(e2, t2, n2) { return "string" == typeof e2 && 0 !== e2.length || (s({ api: t2, paramName: n2, desc: on(n2) }), false); } }, { name: "handler", type: "Function", validator: function(e2, t2, n2) { return "function" != typeof e2 ? (s({ api: t2, paramName: n2, desc: cn() }), false) : ("" === e2.name && s({ api: t2, paramName: n2, desc: yn() }), true); } }], sendMessage: [y({ name: "message" }, te)], setMessageExtensions: [y(y({ name: "message" }, te), {}, { validator: function(e2, t2, n2) { return e2.status === On && true === e2.isSupportExtension || (s({ api: t2, paramName: n2, desc: Cn() }), false); } }), y({ name: "extensions" }, se)], getMessageExtensions: [y(y({ name: "message" }, te), {}, { validator: function(e2, t2, n2) { return e2.status === On && true === e2.isSupportExtension || (s({ api: t2, paramName: n2, desc: Cn() }), false); } })], deleteMessageExtensions: [y(y({ name: "message" }, te), {}, { validator: function(e2, t2, n2) { return e2.status === On && true === e2.isSupportExtension || (s({ api: t2, paramName: n2, desc: Cn() }), false); } })], addMessageReaction: [y(y({ name: "message" }, te), {}, { validator: function(e2, t2, n2) { return e2.status === On || (s({ api: t2, paramName: n2, desc: Tn() }), false); } }), y({ name: "reactionID" }, oe)], removeMessageReaction: [y(y({ name: "message" }, te), {}, { validator: function(e2, t2, n2) { return e2.status === On || (s({ api: t2, paramName: n2, desc: Tn() }), false); } }), y({ name: "reactionID" }, oe)], getMessageReactions: { messageList: y({}, se) }, getAllUserListOfMessageReaction: { message: y(y({}, te), {}, { validator: function(e2, t2, n2) { return e2.status === On || (s({ api: t2, paramName: n2, desc: Tn() }), false); } }), reactionID: y({}, oe), nextSeq: { type: "Number" }, count: { type: "Number" } }, getMessageList: { conversationID: y(y({}, oe), {}, { validator: tn }), nextReqMessageID: { type: "String" }, count: { type: "Number", validator: function(e2, t2, n2) { return !(!A(e2) && !/^[1-9][0-9]*$/.test(e2) && (s({ api: t2, paramName: n2, desc: pn() }), 1)); } } }, getMessageListHopping: { conversationID: y(y({}, oe), {}, { validator: tn }), sequence: { type: "Number" }, time: { type: "Number" }, direction: { type: "Number", validator: function(e2, t2, n2) { return !(!A(e2) && 0 !== e2 && 1 !== e2 && (s({ api: t2, paramName: n2, desc: xn("0Or1RequiredLog") }), 1)); } }, count: { type: "Number", validator: function(e2, t2, n2) { return !(!A(e2) && !/^[1-9][0-9]*$/.test(e2) && (s({ api: t2, paramName: n2, desc: pn }), 1)); } } }, setMessageRead: { conversationID: y(y({}, oe), {}, { validator: tn }) }, setAllMessageRead: { scope: { type: "String", required: false, validator: function(e2, t2, n2) { return !e2 || -1 !== [R.READ_ALL_C2C_MSG, R.READ_ALL_GROUP_MSG, R.READ_ALL_MSG].indexOf(e2) || (s({ api: t2, paramName: n2, desc: xn("ValidScopeRequired") }), false); } } }, getConversationProfile: [y(y({ name: "conversationID" }, oe), {}, { validator: tn })], clearHistoryMessage: [y(y({ name: "conversationID" }, oe), {}, { validator: tn })], pinConversation: { conversationID: y(y({}, oe), {}, { validator: tn }), isPinned: y({}, wn) }, setConversationDraft: { conversationID: y(y({}, oe), {}, { validator: tn }), draftText: { type: "String", validator: function(e2, t2, n2) { return !!ft(e2) || (s({ api: t2, paramName: n2, desc: nn() }), false); } } }, setConversationCustomData: { conversationIDList: y({}, se), customData: { type: "String", validator: function(e2, t2, n2) { return ft(e2) ? !(256 < e2.length && (s({ api: t2, paramName: n2, desc: _n(n2, 256) }), 1)) : (s({ api: t2, paramName: n2, desc: nn() }), false); } } }, markConversation: { conversationIDList: y({}, se), markType: { type: "number", validator: function(e2, t2, n2) { return Qe(e2) ? e2 <= 0 ? (s({ api: t2, paramName: n2, desc: hn(n2, 0) }), false) : !(e2 >= Math.pow(2, 64) && (s({ api: t2, paramName: n2, desc: xn("NumberLessThanLog", n2, "Math.pow(2,64)") }), 1)) : (s({ api: t2, paramName: n2, desc: an() }), false); } }, enableMark: y({}, wn) }, createConversationGroup: { conversationIDList: y({}, se), groupName: y(y({}, oe), {}, { validator: function(e2, t2, n2) { return !(!e2 || 32 < e2.length && (s({ api: t2, paramName: n2, desc: _n(n2, 32) }), 1)); } }) }, deleteConversationGroup: [y({ name: "groupName" }, oe)], renameConversationGroup: { oldName: y({}, oe), newName: y(y({}, oe), {}, { validator: function(e2, t2, n2) { return !(!e2 || 32 < e2.length && (s({ api: t2, paramName: n2, desc: _n(n2, 32) }), 1)); } }) }, addConversationsToGroup: { conversationIDList: y({}, se), groupName: y({}, oe) }, deleteConversationsFromGroup: { conversationIDList: y({}, se), groupName: y({}, oe) }, getGroupList: { groupProfileFilter: { type: "Array" } }, getGroupProfile: { groupID: oe, groupCustomFieldFilter: { type: "Array" }, memberCustomFieldFilter: { type: "Array" } }, getGroupProfileAdvance: { groupIDList: se }, createGroup: { name: oe }, joinGroup: { groupID: oe, type: { type: "String" }, applyMessage: { type: "String" } }, quitGroup: [y({ name: "groupID" }, oe)], handleApplication: { message: te, handleAction: oe, handleMessage: { type: "String" } }, changeGroupOwner: { groupID: oe, newOwnerID: oe }, updateGroupProfile: { groupID: oe, muteAllMembers: { type: "Boolean" } }, dismissGroup: [y({ name: "groupID" }, oe)], searchGroupByID: [y({ name: "groupID" }, oe)], getGroupOnlineMemberCount: [y({ name: "groupID" }, oe)], initGroupAttributes: { groupID: oe, groupAttributes: y(y({}, te), {}, { validator: function(t2, n2, o2) { var i2 = true; return Object.keys(t2).forEach(function(e2) { if (!ft(t2[e2])) return s({ api: n2, paramName: o2, desc: fn("value") }), i2 = false; }), i2; } }) }, setGroupAttributes: { groupID: oe, groupAttributes: y(y({}, te), {}, { validator: function(t2, n2, o2) { var i2 = true; return Object.keys(t2).forEach(function(e2) { if (!ft(t2[e2])) return s({ api: n2, paramName: o2, desc: fn("value") }), i2 = false; }), i2; } }) }, deleteGroupAttributes: { groupID: oe, keyList: { type: "Array", validator: function(e2, t2, n2) { return A(e2) || !nt(e2) ? (s({ api: t2, paramName: n2, desc: un() }), false) : !!Je(e2) || (o2 = true, e2.forEach(function(e3) { if (!ft(e3)) return s({ api: t2, paramName: n2, desc: xn("StringArrayRequiredLog") }), o2 = false; }), o2); var o2; } } }, getGroupAttributes: { groupID: oe, keyList: { type: "Array", validator: function(e2, t2, n2) { return A(e2) || !nt(e2) ? (s({ api: t2, paramName: n2, desc: un() }), false) : !!Je(e2) || (o2 = true, e2.forEach(function(e3) { if (!ft(e3)) return s({ api: t2, paramName: n2, desc: fn("key") }), o2 = false; }), o2); var o2; } } }, setGroupCounters: { groupID: oe, counters: te }, increaseGroupCounter: { groupID: oe, key: oe, value: Fn }, decreaseGroupCounter: { groupID: oe, key: oe, value: Fn }, getGroupCounters: { groupID: oe }, getGroupMemberList: { groupID: oe, count: { type: "Number" } }, getGroupMemberProfile: { groupID: oe, userIDList: se, memberCustomFieldFilter: { type: "Array" } }, addGroupMember: { groupID: oe, userIDList: se }, setGroupMemberRole: { groupID: oe, userID: oe, role: oe }, setGroupMemberMuteTime: { groupID: oe, userID: oe, muteTime: { type: "Number", validator: function(e2) { return 0 <= e2; } } }, setGroupMemberNameCard: { groupID: oe, userID: { type: "String" }, nameCard: { type: "String", validator: function(e2, t2, n2) { return ft(e2) ? (e2.length, true) : (s({ api: t2, paramName: n2, desc: nn() }), false); } } }, setGroupMemberCustomField: { groupID: oe, userID: { type: "String" }, memberCustomField: se }, deleteGroupMember: { groupID: oe }, markGroupMemberList: { groupID: oe, markType: { type: "number", validator: function(e2, t2, n2) { return Qe(e2) ? !(e2 < 1e3 && (s({ api: t2, paramName: n2, desc: gn(n2, 1e3) }), 1)) : (s({ api: t2, paramName: n2, desc: an() }), false); } }, userIDList: y({}, se), enableMark: y({}, wn) }, createTextMessage: { to: oe, conversationType: oe, payload: y(y({}, te), {}, { validator: function(e2, t2, n2) { return et(e2) ? ft(e2.text) ? 0 !== e2.text.length || (s({ api: t2, paramName: "payload.text", desc: vn() }), false) : (s({ api: t2, paramName: "payload.text", desc: nn() }), false) : (s({ api: t2, paramName: n2, desc: mn() }), false); } }) }, createTextAtMessage: { to: oe, conversationType: oe, payload: y(y({}, te), {}, { validator: function(e2, t2, n2) { return et(e2) ? ft(e2.text) ? 0 === e2.text.length ? (s({ api: t2, paramName: "payload.text", desc: vn() }), false) : !(e2.atUserList && !nt(e2.atUserList) && (s({ api: t2, paramName: "payload.atUserList", desc: un() }), 1)) : (s({ api: t2, paramName: "payload.text", desc: nn() }), false) : (s({ api: t2, paramName: n2, desc: mn() }), false); } }) }, createCustomMessage: { to: oe, conversationType: oe, payload: y(y({}, te), {}, { validator: function(e2, t2, n2) { return et(e2) ? e2.data && !ft(e2.data) ? (s({ api: t2, paramName: "payload.data", desc: nn() }), false) : e2.description && !ft(e2.description) ? (s({ api: t2, paramName: "payload.description", desc: nn() }), false) : !(e2.extension && !ft(e2.extension) && (s({ api: t2, paramName: "payload.extension", desc: nn() }), 1)) : (s({ api: t2, paramName: "payload", desc: mn() }), false); } }) }, createImageMessage: { to: oe, conversationType: oe, payload: y(y({}, te), {}, { validator: function(e2, t2, n2) { if (!et(e2)) return s({ api: t2, paramName: n2, desc: mn() }), false; if (A(e2.file)) return s({ api: t2, paramName: "payload.file", desc: sn() }), false; if (ce) { if (!(e2.file instanceof HTMLInputElement || Ze(e2.file))) return et(e2.file) && "undefined" != typeof uni ? 0 !== e2.file.tempFilePaths.length && 0 !== e2.file.tempFiles.length || (s({ api: t2, paramName: "payload.file", desc: In() }), false) : (s({ api: t2, paramName: "payload.file", desc: rn() }), false); if (e2.file instanceof HTMLInputElement && 0 === e2.file.files.length) return s({ api: t2, paramName: "payload.file", desc: In() }), false; } return true; }, onProgress: { type: "Function", required: false, validator: function(e2, t2, n2) { return A(e2) && s({ api: t2, paramName: n2, desc: dn() }), true; } } }) }, createAudioMessage: { to: oe, conversationType: oe, payload: y(y({}, te), {}, { validator: function(e2, t2, n2) { return !!et(e2) || (s({ api: t2, paramName: n2, desc: mn() }), false); } }), onProgress: { type: "Function", required: false, validator: function(e2, t2, n2) { return A(e2) && s({ api: t2, paramName: n2, desc: dn() }), true; } } }, createVideoMessage: { to: oe, conversationType: oe, payload: y(y({}, te), {}, { validator: function(e2, t2, n2) { if (!et(e2)) return s({ api: t2, paramName: n2, desc: mn() }), false; if (A(e2.file)) return s({ api: t2, paramName: "payload.file", desc: sn() }), false; if (ce) { if (!(e2.file instanceof HTMLInputElement || Ze(e2.file))) return et(e2.file) && "undefined" != typeof uni ? !!Ze(e2.file.tempFile) || (s({ api: t2, paramName: "payload.file", desc: In() }), false) : (s({ api: t2, paramName: "payload.file", desc: rn() }), false); if (e2.file instanceof HTMLInputElement && 0 === e2.file.files.length) return s({ api: t2, paramName: "payload.file", desc: In() }), false; } return true; } }), onProgress: { type: "Function", required: false, validator: function(e2, t2, n2) { return A(e2) && s({ api: t2, paramName: n2, desc: dn() }), true; } } }, createFaceMessage: { to: oe, conversationType: oe, payload: y(y({}, te), {}, { validator: function(e2, t2, n2) { return et(e2) ? Qe(e2.index) ? !!ft(e2.data) || (s({ api: t2, paramName: "payload.data", desc: nn() }), false) : (s({ api: t2, paramName: "payload.index", desc: an() }), false) : (s({ api: t2, paramName: n2, desc: mn() }), false); } }) }, createFileMessage: { to: oe, conversationType: oe, payload: y(y({}, te), {}, { validator: function(e2, t2, n2) { if (!et(e2)) return s({ api: t2, paramName: n2, desc: mn() }), false; if (A(e2.file)) return s({ api: t2, paramName: "payload.file", desc: sn() }), false; if (ce) { if (!(e2.file instanceof HTMLInputElement || Ze(e2.file))) return et(e2.file) && "undefined" != typeof uni ? 0 !== e2.file.tempFilePaths.length && 0 !== e2.file.tempFiles.length || (s({ api: t2, paramName: "payload.file", desc: In() }), false) : (s({ api: t2, paramName: "payload.file", desc: rn() }), false); if (e2.file instanceof HTMLInputElement && 0 === e2.file.files.length) return s({ api: t2, paramName: "payload.file", desc: In() }), false; } return true; } }), onProgress: { type: "Function", required: false, validator: function(e2, t2, n2) { return A(e2) && s({ api: t2, paramName: n2, desc: dn() }), true; } } }, createLocationMessage: { to: oe, conversationType: oe, payload: y(y({}, te), {}, { validator: function(e2, t2, n2) { return et(e2) ? ft(e2.description) ? Qe(e2.longitude) ? !!Qe(e2.latitude) || (s({ api: t2, paramName: "payload.latitude", desc: an() }), false) : (s({ api: t2, paramName: "payload.longitude", desc: an() }), false) : (s({ api: t2, paramName: "payload.description", desc: nn() }), false) : (s({ api: t2, paramName: n2, desc: mn() }), false); } }) }, createMergerMessage: { to: oe, conversationType: oe, payload: y(y({}, te), {}, { validator: function(e2, t2, n2) { if (Je(e2.messageList)) return s({ api: t2, paramName: "payload.messageList", desc: ln() }), false; if (Je(e2.compatibleText)) return s({ api: t2, paramName: "payload.compatibleText", desc: on("compatibleText") }), false; var o2 = false; return e2.messageList.forEach(function(e3) { e3.status === Nn && (o2 = true); }), !o2 || (s({ api: t2, paramName: "payload.messageList", desc: xn("MergeFailedMessageLog") }), false); } }) }, revokeMessage: [y(y({ name: "message" }, te), {}, { validator: function(e2, t2, n2) { return Je(e2) ? (s({ api: t2, paramName: n2, desc: Mn() }), false) : e2.conversationType === R.CONV_SYSTEM ? (s({ api: t2, paramName: n2, desc: xn("MessageCanBeRevokedDesc") }), false) : true !== e2.isRevoked || (s({ api: t2, paramName: n2, desc: xn("MessageRevokedLog") }), false); } })], deleteMessage: [y(y({ name: "messageList" }, se), {}, { validator: function(e2, t2, n2) { return !Je(e2) || (s({ api: t2, paramName: n2, desc: ln() }), false); } })], translateText: { sourceTextList: se, sourceLanguage: oe, targetLanguage: oe }, convertVoiceToText: { message: y(y({}, te), {}, { validator: function(e2, t2, n2) { return Je(e2) ? (s({ api: t2, paramName: n2, desc: Mn() }), false) : e2.type === R.MSG_AUDIO && e2.status === On || (s({ api: t2, paramName: n2, desc: xn("AudioMessageRequiredLog") }), false); } }) }, modifyMessage: [y(y({ name: "message" }, te), {}, { validator: function(e2, t2, n2) { return Je(e2) ? (s({ api: t2, paramName: n2, desc: Mn() }), false) : e2.conversationType === R.CONV_SYSTEM ? (s({ api: t2, paramName: n2, desc: xn("MessageCanBeModifiedLog") }), false) : true !== e2._onlineOnlyFlag || (s({ api: t2, paramName: n2, desc: xn("OnlineMessageNotSupportLog") }), false); } })], searchCloudMessages: { keywordList: qn.keywordListForMsg, keywordListMatchType: qn.keywordListMatchType, cursor: qn.cursor, senderUserIDList: { type: "Array", required: false, validator: function(e2, t2, n2) { return En(e2, t2, n2, { allowUndefined: true, allowEmpty: true, maxLength: 5 }); } }, messageTypeList: { type: "Array", required: false, validator: function(e2, t2, n2) { if (!e2) return true; if (!En(e2, t2, n2, { allowUndefined: true, allowEmpty: true })) return false; var o2 = [R.MSG_TEXT, R.MSG_IMAGE, R.MSG_AUDIO, R.MSG_FILE, R.MSG_VIDEO, R.MSG_LOCATION, R.MSG_CUSTOM, R.MSG_MERGER]; return !(0 < e2.filter(function(e3) { return -1 === o2.indexOf(e3); }).length && (s({ api: t2, paramName: n2, desc: Dn(n2, "message") }), 1)); } }, conversationID: { type: "String", required: false, validator: function(e2) { return !e2 || tn(e2); } }, timePosition: { type: "number", required: false, validator: function(e2, t2, n2) { return Ln(e2, t2, n2, { allowUndefined: true, min: 0 }); } }, timePeriod: { type: "number", required: false, validator: function(e2, t2, n2) { return Ln(e2, t2, n2, { allowUndefined: true, min: 0 }); } } }, searchCloudUsers: { keywordList: qn.keywordListExceptMsg, keywordListMatchType: qn.keywordListMatchType, cursor: qn.cursor, count: qn.count, miniBirthday: { type: "Number", required: false, validator: function(e2, t2, n2) { return Ln(e2, t2, n2, { allowUndefined: true, min: 0 }); } }, maxBirthday: { type: "Number", required: false, validator: function(e2, t2, n2) { return Ln(e2, t2, n2, { allowUndefined: true, min: 0 }); } }, gender: { type: "String", required: false, validator: function(e2, t2, n2) { return !e2 || e2 === R.GENDER_FEMALE || e2 === R.GENDER_MALE || s({ api: t2, paramName: n2, desc: "".concat(e2, " is invalid match type") }); } } }, searchCloudGroups: { keywordList: qn.keywordListExceptMsg, keywordListMatchType: qn.keywordListMatchType, cursor: qn.cursor, count: qn.count, groupTypeList: qn.groupTypeList }, searchCloudGroupMembers: { keywordList: qn.keywordListExceptMsg, keywordListMatchType: qn.keywordListMatchType, cursor: qn.cursor, count: qn.count, groupTypeList: qn.groupTypeList, groupIDList: { type: "Array", required: false, validator: function(e2, t2, n2) { return En(e2, t2, n2, { allowUndefined: true, allowEmpty: true }); } } }, getUserProfile: { userIDList: { type: "Array", validator: function(e2, t2, n2) { return nt(e2) ? (0 === e2.length && s({ api: t2, paramName: n2, desc: ln() }), true) : (s({ api: t2, paramName: n2, desc: un() }), false); } } }, updateMyProfile: { profileCustomField: { type: "Array", validator: function(e2, t2, n2) { return !!A(e2) || !!nt(e2) || (s({ api: t2, paramName: n2, desc: un() }), false); } } }, setSelfStatus: { customStatus: { type: "String", validator: function(e2, t2, n2) { return !!ft(e2) || (s({ api: t2, paramName: n2, desc: nn() }), false); } } }, getUserStatus: { userIDList: { type: "Array", validator: function(e2, t2, n2) { return nt(e2) ? 0 !== e2.length || (s({ api: t2, paramName: n2, desc: ln() }), false) : (s({ api: t2, paramName: n2, desc: un() }), false); } } }, subscribeUserStatus: { userIDList: { type: "Array", validator: function(e2, t2, n2) { return nt(e2) ? 0 !== e2.length || (s({ api: t2, paramName: n2, desc: ln() }), false) : (s({ api: t2, paramName: n2, desc: un() }), false); } } }, unsubscribeUserStatus: { userIDList: { type: "Array", validator: function(e2, t2, n2) { return !e2 || !!nt(e2) || (s({ api: t2, paramName: n2, desc: un() }), false); } } }, addFriend: { to: oe, source: { type: "String", required: true, validator: function(e2, t2, n2) { return !(!e2 || (e2.startsWith("AddSource_Type_") ? 8 < e2.replace("AddSource_Type_", "").length && (s({ api: t2, paramName: n2, desc: _n("keyword", 8) }), 1) : (s({ api: t2, paramName: n2, desc: xn("SourcePrefixLog") }), 1))); } }, remark: { type: "String", required: false, validator: function(e2, t2, n2) { return !(ft(e2) && 96 < e2.length && (s({ api: t2, paramName: n2, desc: _n(n2, 96) }), 1)); } } }, deleteFriend: { userIDList: se }, checkFriend: { userIDList: se }, getFriendProfile: { userIDList: se }, updateFriend: { userID: oe, remark: { type: "String", required: false, validator: function(e2, t2, n2) { return !(ft(e2) && 96 < e2.length && (s({ api: t2, paramName: n2, desc: _n(n2, 96) }), 1)); } }, friendCustomField: { type: "Array", required: false, validator: function(e2, t2, n2) { if (e2) { if (!nt(e2)) return s({ api: t2, paramName: n2, desc: un() }), false; var o2 = true; return e2.forEach(function(e3) { return ft(e3.key) && -1 !== e3.key.indexOf("Tag_SNS_Custom") ? ft(e3.value) ? 8 < e3.key.replace("Tag_SNS_Custom_", "").length ? (s({ api: t2, paramName: n2, desc: _n("keyword", 8) }), o2 = false) : void 0 : (s({ api: t2, paramName: n2, desc: fn("value") }), o2 = false) : (s({ api: t2, paramName: n2, desc: xn("FriendCustomFieldPrefixLog") }), o2 = false); }), o2; } return true; } } }, acceptFriendApplication: { userID: oe }, refuseFriendApplication: { userID: oe }, deleteFriendApplication: { userID: oe }, createFriendGroup: { name: oe }, deleteFriendGroup: { name: oe }, addToFriendGroup: { name: oe, userIDList: se }, removeFromFriendGroup: { name: oe, userIDList: se }, renameFriendGroup: { oldName: oe, newName: oe }, sendMessageReadReceipt: [{ name: "messageList", type: "Array", validator: function(e2, t2, n2) { return nt(e2) ? 0 !== e2.length || (s({ api: t2, paramName: n2, desc: ln() }), false) : (s({ api: t2, paramName: n2, desc: un() }), false); } }], getMessageReadReceiptList: [{ name: "messageList", type: "Array", validator: function(e2, t2, n2) { return nt(e2) ? 0 !== e2.length || (s({ api: t2, paramName: n2, desc: ln() }), false) : (s({ api: t2, paramName: n2, desc: un() }), false); } }], createTopicInCommunity: { groupID: oe, topicName: oe }, deleteTopicFromCommunity: { groupID: oe, topicIDList: { type: "Array", validator: function(e2, t2, n2) { return !e2 || !!nt(e2) || (s({ api: t2, paramName: n2, desc: un() }), false); } } }, updateTopicProfile: { groupID: oe, topicID: oe }, getTopicList: { groupID: oe, topicIDList: { type: "Array", validator: function(e2, t2, n2) { return !e2 || !!nt(e2) || (s({ api: t2, paramName: n2, desc: un() }), false); } } }, followUser: [y({ name: "userIDList" }, se)], unfollowUser: [y({ name: "userIDList" }, se)], getMyFollowingList: [y(y({ name: "startIndex" }, oe), {}, { required: false })], getMyFollowersList: [y(y({ name: "startIndex" }, oe), {}, { required: false })], getMutualFollowersList: [y(y({ name: "startIndex" }, oe), {}, { required: false })], getUserFollowInfo: [y(y({ name: "userIDList" }, se), {}, { required: false })], checkFollowType: [y({ name: "userIDList" }, se)], addSignalingListener: [{ name: "eventName", type: "String", validator: function(e2, t2, n2) { return "string" == typeof e2 && 0 !== e2.length || (s({ api: t2, paramName: n2, desc: on(n2) }), false); } }, { name: "handler", type: "Function", validator: function(e2, t2, n2) { return "function" != typeof e2 ? (s({ api: t2, paramName: n2, desc: cn() }), false) : ("" === e2.name && s({ api: t2, paramName: n2, desc: yn() }), true); } }], removeSignalingListener: [{ name: "eventName", type: "String", validator: function(e2, t2, n2) { return "string" == typeof e2 && 0 !== e2.length || (s({ api: t2, paramName: n2, desc: on(n2) }), false); } }, { name: "handler", type: "Function", validator: function(e2, t2, n2) { return "function" != typeof e2 ? (s({ api: t2, paramName: n2, desc: cn() }), false) : ("" === e2.name && s({ api: t2, paramName: n2, desc: yn() }), true); } }], invite: { userID: oe }, inviteSync: [y(y({}, te), {}, { validator: function(e2, t2, n2) { return et(e2) ? !!ft(e2.userID) || (s({ api: t2, paramName: "options.userID", desc: nn() }), false) : (s({ api: t2, paramName: "options", desc: mn() }), false); } }), { name: "successCb", type: "Function", required: false, validator: function(e2, t2, n2) { return A(e2) && s({ api: t2, paramName: n2, desc: cn() }), true; } }, { name: "errorCb", type: "Function", required: false, validator: function(e2, t2, n2) { return A(e2) && s({ api: t2, paramName: n2, desc: cn() }), true; } }], inviteInGroup: { groupID: oe, inviteeList: se }, inviteInGroupSync: [y(y({}, te), {}, { validator: function(e2, t2, n2) { return et(e2) ? ft(e2.groupID) ? !!nt(e2.inviteeList) || (s({ api: t2, paramName: "options.inviteeList", desc: un() }), false) : (s({ api: t2, paramName: "options.groupID", desc: nn() }), false) : (s({ api: t2, paramName: "options", desc: mn() }), false); } }), { name: "successCb", type: "Function", required: false, validator: function(e2, t2, n2) { return A(e2) && s({ api: t2, paramName: n2, desc: cn() }), true; } }, { name: "errorCb", type: "Function", required: false, validator: function(e2, t2, n2) { return A(e2) && s({ api: t2, paramName: n2, desc: cn() }), true; } }], accept: { inviteID: oe }, reject: { inviteID: oe }, getSignalingInfo: [y(y({ name: "message" }, te), {}, { validator: function(e2, t2, n2) { return !Je(e2) || (s({ api: t2, paramName: n2, desc: Mn() }), false); } })], modifyInvitation: { inviteID: oe, data: oe } }, Hn = { 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, 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, searchCloudMessages: 1, searchCloudUsers: 1, searchCloudGroups: 1, searchCloudGroupMembers: 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 }, Bn = (t(uo, n(Error)), Rn = f(uo), e(uo)), T = { 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 }, Kn = null, Fn = (e(co, [{ 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 && v.w(e2); } }, { key: "noUse", value: function(e2) { var t2 = T.NO_USE; return C({ code: t2, message: this.getErrMsg(t2, e2) }); } }]), co), I = { 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", CS: "query", GRP_CS: "query_grp", MBR_CS: "query_grp_member", USER_CS: "query_user", 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" }, Yn = "networkRTT", Wn = "messageE2EDelay", jn = "sendMessageC2C", Jn = "sendMessageGroup", zn = "sendMessageGroupAV", Xn = "sendMessageRichMedia", Zn = "cosUpload", Qn = "messageReceivedGroup", $n = "messageReceivedGroupAVPush", eo = "messageReceivedGroupAVPull", to = (c(wn = {}, Yn, 2), c(wn, Wn, 3), c(wn, jn, 4), c(wn, Jn, 5), c(wn, zn, 6), c(wn, Xn, 7), c(wn, Qn, 8), c(wn, $n, 9), c(wn, eo, 10), c(wn, Zn, 11), wn), no = { info: 4, warning: 5, error: 6 }, oo = { wifi: 1, "2g": 2, "3g": 3, "4g": 4, "5g": 5, unknown: 6, none: 7, online: 8 }, io = { login: 4, plugin_search: 16, plugin_translate: 16, plugin_voice_to_text: 16, plugin_cs: 16, plugin_push: 16, plugin_bot: 16, plugin_emoji_reaction: 16, tui_key_features: 16 }, M = (e(ro, [{ key: "updateTimeStamp", value: function() { this.timestamp = Pe(); } }, { 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 = Pe(), 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) { if (!(e2 instanceof Error)) return v.w("".concat(this._n, ".setError value not instanceof Error, please check!")), this; if (this._sentFlag) return this; var t2 = true; return (t2 = this._netMonitorModule ? this._netMonitorModule.isOnline() : t2) ? (e2.code && this.setCode(e2.code), e2.message && this.setMoreMessage(e2.message)) : this.setCode(T.NO_NETWORK), this.setLevel("error"), this; } }, { key: "setCode", value: function(e2) { return A(e2) || this._sentFlag || ("ECONNABORTED" === e2 && (this.code = 103), Qe(e2) ? this.code = e2 : v.w("".concat(this._n, ".setCode value not a number, please check!"), e2, r(e2))), this; } }, { key: "setMessage", value: function(e2) { return A(e2) || this._sentFlag || (Qe(e2) && (this.message = e2.toString()), ft(e2) && (this.message = e2)), this; } }, { key: "setCostTime", value: function(e2) { return this.costTime = e2, this; } }, { key: "setLevel", value: function(e2) { return A(e2) || this._sentFlag || (this.level = no[e2]), this; } }, { key: "setMoreMessage", value: function(e2) { return Je(this.moreMessage) ? this.moreMessage = "".concat(e2) : this.moreMessage += " ".concat(e2), this; } }, { key: "setNetworkType", value: function(e2) { return A(e2) ? v.w("".concat(this._n, ".setNetworkType value is undefined, please check!")) : (e2 = oo[e2.toLowerCase()], A(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) { ro.prototype._eventStatModule = e2; } }, { key: "bindNetMonitorModule", value: function(e2) { ro.prototype._netMonitorModule = e2; } }]), ro), ao = (e(so, [{ key: "setText", value: function(e2) { this.content.text = e2; } }, { key: "sendable", value: function() { return 0 !== this.content.text.length; } }]), so); function so(e2) { d(this, so), this.type = R.MSG_TEXT, this.content = { text: e2.text || "" }; } function ro(e2) { d(this, ro), this._n = "SSOLogData", this.eventType = io[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 = Pe(); } function co(e2) { d(this, co), this._m = e2, this._n = ""; } function uo(e2) { d(this, uo), t2 = Rn.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 lo(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=") && ho(i2, o2) ? (-1 < i2.indexOf("?") ? "".concat(i2, "&authKey=") : "".concat(i2, "?authKey=")).concat(n2) : i2; } function po(e2, t2, n2) { var n2 = 2 < arguments.length && void 0 !== n2 ? n2 : []; return e2 === R.MSG_VIDEO ? ho((t2[0].content || t2[0].payload).snapshotUrl, n2) && (t2[0].content ? (t2[0].content.snapshotUrl = _o(t2[0].content.snapshotUrl), t2[0].content.thumbUrl = _o(t2[0].content.thumbUrl)) : (t2[0].payload.snapshotUrl = _o(t2[0].payload.snapshotUrl), t2[0].payload.thumbUrl = _o(t2[0].payload.thumbUrl))) : e2 === R.MSG_FILE ? ho((t2[0].content || t2[0].payload).fileUrl, n2) && (t2[0].content ? t2[0].content.fileUrl = _o(t2[0].content.fileUrl) : t2[0].payload.fileUrl = _o(t2[0].payload.fileUrl)) : e2 === R.MSG_MERGER && (e2 = (n2 = t2[0].content || t2[0].payload).downloadKey, n2 = void 0 === (n2 = n2.messageList) ? [] : n2, Je(void 0 === e2 ? "" : e2) && n2.forEach(function(e3) { po(e3.messageBody[0].type, e3.messageBody); })), t2; } function _o(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 ho(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(Ho, [{ key: "_initImageInfoModel", value: function() { var t2 = this; this._ImageInfoModel = function(e2) { this.instanceID = lt(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 = lo(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 = A(e2) || A(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 = Fe[e2.toUpperCase()] || Fe.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 && (qt(e2), Object.assign(e2[2], Ft({ 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 go = Ho, fo = (e(Vo, [{ key: "sendable", value: function() { return null !== this.content; } }]), Vo), mo = (e(xo, [{ 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; } }]), xo), vo = { from: true, groupID: true, groupName: true, to: true }, Io = (e(qo, [{ 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]; vo[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) { Je(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]; } } }]), qo), Mo = { from: true, groupID: true, groupName: true, to: true, groupType: true }, yo = (e(Fo, [{ 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]; Mo[o2] && ("groupName" === o2 ? this.content.groupProfile.name = e2[o2] : this.content.groupProfile[o2] = e2[o2]); } } }]), Fo), Co = (e(wo, [{ key: "_getFileInfo", value: function(e2) { if (!A(e2.fileName) && !A(e2.fileSize)) return { size: e2.fileSize, name: e2.fileName }; var t2, e2 = e2.file.files[0]; return ne && (e2.path && -1 !== e2.path.indexOf(".") && (t2 = e2.path.slice(e2.path.lastIndexOf(".") + 1).toLowerCase(), e2.type = t2, e2.name || (e2.name = "".concat(lt(999999), ".").concat(t2))), e2.name || (e2.type = "", e2.name = e2.path.slice(e2.path.lastIndexOf("/") + 1).toLowerCase()), e2.suffix && (e2.type = e2.suffix), e2.url || (e2.url = e2.path)), { size: e2.size, name: e2.name }; } }, { 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; } }]), wo), To = (e(bo, [{ 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; } }]), bo), Do = (e(Uo, [{ 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; Je(t2) || (this.content.thumbUrl = this.content.snapshotUrl = t2), Je(n2) || (this.content.thumbWidth = this.content.snapshotWidth = Number(n2)), Je(e2) || (this.content.thumbHeight = this.content.snapshotHeight = Number(e2)); } }, { key: "sendable", value: function() { return "" !== this.content.remoteVideoUrl; } }]), Uo), Eo = (e(Po, [{ key: "sendable", value: function() { return true; } }]), Po), Lo = (e(Go, [{ key: "_patchRichMediaPayload", value: function(e2, t2) { e2 === R.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 === R.MSG_VIDEO ? !t2.remoteVideoUrl && t2.videoUrl && (t2.remoteVideoUrl = t2.videoUrl) : e2 === R.MSG_AUDIO ? !t2.remoteAudioUrl && t2.url && (t2.remoteAudioUrl = t2.url) : e2 === R.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 === R.MSG_IMAGE ? t2.imageInfoArray.forEach(function(e3) { e3.url = lo(e3.url, n2, o2, i2); }) : e2 === R.MSG_VIDEO ? (t2.videoUrl = lo(t2.videoUrl, n2, o2, i2), t2.snapshotUrl = lo(t2.thumbUrl, n2, o2, i2), t2.snapshotHeight = t2.thumbHeight, t2.snapshotWidth = t2.thumbWidth) : e2 === R.MSG_AUDIO ? t2.url = lo(t2.url, n2, o2, i2) : e2 === R.MSG_FILE && (t2.fileUrl = lo(t2.fileUrl, n2, o2, i2))); } }]), Go), So = (e(No, [{ key: "sendable", value: function() { return !Je(this.content.messageList) || !Je(this.content.downloadKey); } }]), No), ko = { 1: R.MSG_PRIORITY_HIGH, 2: R.MSG_PRIORITY_NORMAL, 3: R.MSG_PRIORITY_LOW, 4: R.MSG_PRIORITY_LOWEST }, Ro = (e(Oo, [{ key: "elements", get: function() { return this._elements; } }, { key: "getElements", value: function() { return this._elements; } }, { key: "extractGroupInfo", value: function(e2) { null !== e2 && (ft(e2.nick) && (this.nick = e2.nick), ft(e2.avatar) && (this.avatar = e2.avatar), e2 = e2.messageFromAccountExtraInformation, et(e2) && ft(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 !== R.MSG_AT_ALL ? (t2._groupAtInfoList.push({ groupAtAllFlag: 0, groupAtUserID: e3 }), t2.atUserList.push(e3)) : (t2._groupAtInfoList.push({ groupAtAllFlag: 1 }), t2.atUserList.push(R.MSG_AT_ALL)); }), nt(e2.groupAtInfo) && e2.groupAtInfo.forEach(function(e3) { 0 === e3.groupAtAllFlag ? t2.atUserList.push(e3.groupAtUserID) : 1 === e3.groupAtAllFlag && t2.atUserList.push(R.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 ? On : 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 === R.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 === Ct[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), Ct[e2] = parseInt([t2, n2, o2, "0001"].join("")), o2 = n2 = t2 = null, v.l("autoIncrementIndex start index:".concat(Ct[e2]))), Ct[e2]++)), 0 === this.sequence && this.conversationType === R.CONV_C2C && (this.sequence = this.clientSequence); } }, { key: "generateMessageID", value: function() { this.from === R.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 !== R.CONV_SYSTEM ? (e2 = n2 === R.CONV_C2C ? e2 === this.from ? t2 : this.from : this.to, this.conversationID = e2 ? "".concat(n2).concat(e2) : null) : this.conversationID = R.CONV_SYSTEM; } }, { key: "isElement", value: function(e2) { return e2 instanceof ao || e2 instanceof go || e2 instanceof fo || e2 instanceof mo || e2 instanceof Co || e2 instanceof Do || e2 instanceof Io || e2 instanceof yo || e2 instanceof To || e2 instanceof Eo || e2 instanceof So; } }, { key: "setElement", value: function(e2, t2, n2, o2) { var i2 = this; if (this.isElement(e2)) return this._elements = [e2], void this._initProxy(); function a2(e3) { if (e3.type && e3.content) switch (e3.type) { case R.MSG_TEXT: i2.setTextElement(e3.content); break; case R.MSG_IMAGE: i2.setImageElement(e3.content, t2, n2, o2); break; case R.MSG_AUDIO: i2.setAudioElement(e3.content, t2, n2, o2); break; case R.MSG_FILE: i2.setFileElement(e3.content, t2, n2, o2); break; case R.MSG_VIDEO: i2.setVideoElement(e3.content, t2, n2, o2); break; case R.MSG_CUSTOM: i2.setCustomElement(e3.content); break; case R.MSG_LOCATION: i2.setLocationElement(e3.content); break; case R.MSG_GRP_TIP: i2.setGroupTipElement(e3.content); break; case R.MSG_GRP_SYS_NOTICE: i2.setGroupSystemNoticeElement(e3.content); break; case R.MSG_FACE: i2.setFaceElement(e3.content); break; case R.MSG_MERGER: i2.setMergerElement(e3.content, t2, n2, o2); } } if (nt(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 ao({ text: e2 }); this._elements.push(e2); } }, { key: "setImageElement", value: function(e2, t2, n2, o2) { e2 = new go(e2, t2, n2, o2); this._elements.push(e2); } }, { key: "setAudioElement", value: function(e2, t2, n2, o2) { e2 = new mo(e2, t2, n2, o2); this._elements.push(e2); } }, { key: "setFileElement", value: function(e2, t2, n2, o2) { e2 = new Co(e2, t2, n2, o2); this._elements.push(e2); } }, { key: "setVideoElement", value: function(e2, t2, n2, o2) { e2 = new Do(e2, t2, n2, o2); this._elements.push(e2); } }, { key: "setLocationElement", value: function(e2) { e2 = new Eo(e2); this._elements.push(e2); } }, { key: "setCustomElement", value: function(e2) { e2 = new To(e2); this._elements.push(e2); } }, { key: "setGroupTipElement", value: function(e2) { var t2, n2 = {}, o2 = e2.operationType; Je(e2.memberInfoList) ? e2.operatorInfo && (n2 = e2.operatorInfo) : o2 !== R.GRP_TIP_MBR_JOIN && o2 !== R.GRP_TIP_MBR_KICKED_OUT && o2 !== R.GRP_TIP_MBR_SET_ADMIN && o2 !== R.GRP_TIP_MBR_CANCELED_ADMIN || (n2 = e2.memberInfoList[0]), Je(e2.memberExtraInfo) || (t2 = e2.memberExtraInfo.reason, e2.msgMemberInfo.forEach(function(e3) { e3.reason = t2; })); o2 = n2.nick, n2 = n2.avatar, ft(o2) && (this.nick = o2), ft(n2) && (this.avatar = n2), o2 = new Io(e2); this._elements.push(o2); } }, { key: "setGroupSystemNoticeElement", value: function(e2) { e2 = new yo(e2); this._elements.push(e2); } }, { key: "setFaceElement", value: function(e2) { e2 = new fo(e2); this._elements.push(e2); } }, { key: "setMergerElement", value: function(e2, t2, n2, o2) { e2 = new So(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 (A(e2)) return R.MSG_PRIORITY_NORMAL; if (ft(e2) && -1 !== Object.values(ko).indexOf(e2)) return e2; if (Qe(e2)) { e2 = "" + e2; if (-1 !== Object.keys(ko).indexOf(e2)) return ko[e2]; } return R.MSG_PRIORITY_NORMAL; } }, { key: "setNickAndAvatar", value: function(e2) { var t2 = e2.nick, e2 = e2.avatar; ft(t2) && (this.nick = t2), ft(e2) && (this.avatar = e2); } }, { key: "setNameCard", value: function(e2) { ft(e2) && (this.nameCard = e2); } }, { key: "initC2CReadReceiptInfo", value: function(e2) { var t2 = e2.readReceiptSentByPeer, e2 = e2.timestamp, e2 = void 0 === e2 ? 0 : e2; this.conversationType === R.CONV_C2C && true === this.needReadReceipt && (this.readReceiptInfo.isPeerRead = 1 === (void 0 === t2 ? void 0 : t2), this.readReceiptInfo.timestamp = e2); } }]), Oo), Ao = ["sound", "FCMChannelID"]; function Oo(e2) { d(this, Oo), this.ID = "", this.conversationID = e2.conversationID || null, this.conversationType = e2.conversationType || R.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 : lt(), this.priority = this._computePriority(e2.priority), this.nick = e2.nick || "", this.avatar = e2.avatar || "", this.isPeerRead = false, this.nameCard = "", this.hasRiskContent = $t(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 || On, 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 || Oe() || 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 No(e2, t2, n2, l2) { var o2, i2, a2, s2, r2, c2, u2; d(this, No), this.type = R.MSG_MERGER, this.content = { downloadKey: "", pbDownloadKey: "", messageList: [], title: "", abstractList: [], compatibleText: "", version: 0, layersOverLimit: false }, e2.downloadKey ? (i2 = e2.downloadKey, a2 = e2.pbDownloadKey, s2 = e2.title, r2 = e2.abstractList, c2 = e2.compatibleText, o2 = e2.version, this.content.downloadKey = i2, this.content.pbDownloadKey = a2, this.content.title = s2, this.content.abstractList = r2, this.content.compatibleText = c2, this.content.version = o2 || 0) : Je(e2.messageList) ? 1 === e2.layersOverLimit && (this.content.layersOverLimit = true) : (i2 = e2.messageList, a2 = e2.title, s2 = e2.abstractList, r2 = e2.compatibleText, c2 = e2.version, u2 = [], i2.forEach(function(e3) { Je(e3) || (e3 = new Lo(e3, t2, n2, l2), u2.push(e3)); }), this.content.messageList = u2, this.content.title = a2, this.content.abstractList = s2, this.content.compatibleText = r2, this.content.version = c2 || 0); } function Go(e2, t2, n2, o2) { var i2, a2; d(this, Go), 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(R.CONV_C2C) ? this.receiverUserID = e2.to : e2.conversationType.startsWith(R.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 === R.MSG_MERGER ? this.messageBody.push({ type: i2, payload: new So(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 Po(e2) { d(this, Po), this.type = R.MSG_LOCATION; var t2 = e2.description, n2 = e2.longitude, e2 = e2.latitude; this.content = { description: t2, longitude: n2, latitude: e2 }; } function Uo(e2, t2, n2, o2) { d(this, Uo), this.type = R.MSG_VIDEO, this._percent = 0, this.content = { remoteVideoUrl: e2.remoteVideoUrl || e2.videoUrl || "", videoFormat: e2.videoFormat, videoSecond: parseInt(e2.videoSecond, 10), videoSize: e2.videoSize, videoUrl: lo(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: lo(e2.thumbUrl, t2, n2, o2), snapshotUrl: lo(e2.thumbUrl, t2, n2, o2) }; } function bo(e2) { d(this, bo), this.type = R.MSG_CUSTOM, this.content = { data: e2.data || "", description: e2.description || "", extension: e2.extension || "" }; } function wo(e2, t2, n2, o2) { d(this, wo), this.type = R.MSG_FILE, this._percent = 0; var i2 = this._getFileInfo(e2); this.content = { downloadFlag: 2, fileUrl: lo(e2.url || e2.fileUrl, t2, n2, o2) || "", uuid: e2.uuid, fileName: i2.name || "", fileSize: i2.size || 0 }; } function Fo(e2) { d(this, Fo), this.type = R.MSG_GRP_SYS_NOTICE, this.content = {}, this._initContent(e2); } function qo(e2) { d(this, qo), this.type = R.MSG_GRP_TIP, this.content = {}, this._initContent(e2); } function xo(e2, t2, n2, o2) { d(this, xo), this.type = R.MSG_AUDIO, this._percent = 0, this.content = { downloadFlag: 2, second: e2.second, size: e2.size, url: lo(e2.url, t2, n2, o2), remoteAudioUrl: e2.url || "", uuid: e2.uuid }; } function Vo(e2) { d(this, Vo), this.type = R.MSG_FACE, this.content = e2 || null; } function Ho(e2, t2, n2, o2) { d(this, Ho), this._imageMemoryURL = "", this._fileDownloadProxy = t2, this._authKey = n2, this._fileDNList = o2, ae || re ? this.createImageDataASURL(e2.file) : this.createImageDataASURLInWeb(e2.file), this._initImageInfoModel(), this.type = R.MSG_IMAGE, this._percent = 0, this.content = { imageFormat: e2.imageFormat || Fe.UNKNOWN, uuid: e2.uuid, imageInfoArray: [] }, this.initImageInfoArray(e2.imageInfoArray), this._autoFixUrl(); } function Bo(e2) { if (et(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, A(t2) || (i2 = false === t2 ? 1 : 0), A(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), o2 = void 0 === (o2 = n2.sound) ? "" : o2, i2 = void 0 === (i2 = n2.FCMChannelID) ? "" : i2, y(y({}, g(n2, Ao)), {}, { Sound: -1 === (o2 = (n2 = o2).lastIndexOf(".")) ? n2 : n2.slice(0, o2), OPPOChannelID: t2, GoogleChannelID: i2 })) }; var t2, n2, o2, i2; } t(zo, Fn), Ko = f(zo), e(zo, [{ key: "onNewMessage", value: function(e2) { var t2 = e2.dataList, n2 = e2.isInstantMessage, o2 = e2.C2CRemainingUnreadList, i2 = e2.C2CPairUnreadList, e2 = e2.isSyncingEnded, t2 = (n2 || v.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 = Dt(i2), a2 = (0 < a2.length && this.emitOEvt(G.MESSAGE_MODIFIED, a2), this.get(11).onNewMessage({ conversationOptionsList: o2, isInstantMessage: n2, isUnreadC2CMessage: t2, isSyncingEnded: e2 }), Lt(i2)); n2 && 0 < a2.length && this.emitOEvt(G.MESSAGE_RECEIVED, a2), i2.length = 0; } }, { key: "_assembly", value: function(e2) { for (var l2 = e2.dataList, d2 = e2.C2CRemainingUnreadList, n2 = e2.C2CPairUnreadList, p2 = e2.isInstantMessage, t2 = null, o2 = [], _2 = [], h2 = {}, g2 = this.get(26), f2 = false, i2 = this.get(11), m2 = this.get(4), e2 = this.get(17), v2 = this.getFileDownloadProxy(), I2 = this.getDowloadFileAuthKey(), M2 = e2.getFileDNList(), a2 = 0, y2 = l2.length; a2 < y2; a2++) if (this._isC2CNotice(l2[a2])) this._noticeFromUnreadDBList.push(l2[a2].eventArray[0].c2CNotifyMsgArray[0]); else { var s2 = l2[a2], r2 = (s2.currentUser = this.getMyUserID(), s2.conversationType = R.CONV_C2C, s2.isSystemMessage = !!s2.isSystemMessage, (A(s2.nick) || A(s2.avatar)) && (f2 = true), (t2 = new Ro(s2)).setElement(s2.elements, v2, I2, M2), t2.setNickAndAvatar({ nick: s2.nick, avatar: s2.avatar }), t2.conversationID); if (p2) { if (this._msgFromUnreadDBMap.get(t2.ID)) continue; var c2, u2, C2 = false, T2 = (t2.from !== this.getMyUserID() ? (u2 = i2.getLatestMessageSentByPeer(r2)) && (c2 = u2.nick, u2 = u2.avatar, f2 ? t2.setNickAndAvatar({ nick: c2, avatar: u2 }) : c2 === t2.nick && u2 === t2.avatar || (C2 = true)) : (c2 = i2.getLatestMessageSentByMe(r2)) && (u2 = c2.nick, T2 = c2.avatar, u2 === t2.nick && T2 === t2.avatar || (i2.modifyMessageSentByMe({ conversationID: r2, latestNick: t2.nick, latestAvatar: t2.avatar }), m2.mockOnNickAvatarModified(t2.nick, t2.avatar))), 1 === l2[a2].isModified); if (i2.isMessageSentByCurrentInstance(t2) ? t2.isModified = T2 : T2 = false, 0 === s2.msgLifeTime) t2._onlineOnlyFlag = true, i2.isMessageSentByCurrentInstance(t2) || _2.push(t2); else { if (!i2.pushIntoMessageList(_2, t2, T2)) continue; C2 && (i2.modifyMessageSentByPeer({ conversationID: r2, latestNick: t2.nick, latestAvatar: t2.avatar }), i2.updateUserProfileSpecifiedKey({ conversationID: r2, nick: t2.nick, avatar: t2.avatar })); } p2 && 0 < t2.clientTime && g2.addMessageDelay(t2.clientTime); } else this._msgFromUnreadDBMap.set(t2.ID, t2); if (0 !== s2.msgLifeTime) { if (false === t2._onlineOnlyFlag) { C2 = i2.getLastMessageTime(r2); if (Qe(C2) && t2.time < C2) continue; p2 && (A(h2[r2]) ? (s2 = 0, "in" === t2.flow && (t2._isExcludedFromUnreadCount || (s2 = 1)), h2[r2] = o2.push({ conversationID: r2, unreadCount: s2, type: t2.conversationType, subType: t2.conversationSubType, lastMessage: t2._isExcludedFromLastMessage ? "" : t2 }) - 1) : (s2 = h2[r2], o2[s2].type = t2.conversationType, o2[s2].subType = t2.conversationSubType, o2[s2].lastMessage = t2._isExcludedFromLastMessage ? "" : t2, "in" === t2.flow && (t2._isExcludedFromUnreadCount || o2[s2].unreadCount++))); } } else t2._onlineOnlyFlag = true; } this._handleNoticeFromUnreadDB(); var D2 = false; if (nt(n2) && 0 < n2.length) for (var E2 = 0, L2 = n2.length; E2 < L2; E2++) !function(t3) { if (n2[t3].from === R.CONV_SYSTEM) return; D2 = true; var e3 = o2.find(function(e4) { return e4.conversationID === "".concat(R.CONV_C2C).concat(n2[t3].from); }); e3 ? e3.unreadCount = n2[t3].unreadCount : o2.push({ conversationID: "".concat(R.CONV_C2C).concat(n2[t3].from), unreadCount: n2[t3].unreadCount, type: R.CONV_C2C }); }(E2); if (nt(d2)) for (var S2 = 0, k2 = d2.length; S2 < k2; S2++) !function(t3) { o2.find(function(e3) { return e3.conversationID === "".concat(R.CONV_C2C).concat(d2[t3].from); }) || o2.push({ conversationID: "".concat(R.CONV_C2C).concat(d2[t3].from), type: R.CONV_C2C, lastMsgTime: d2[t3].lastMsgTime }); }(S2); return { conversationOptionsList: o2, messageList: _2, isUnreadC2CMessage: D2 }; } }, { key: "getMessageListFromUnreadDB", value: function() { return D(this._msgFromUnreadDBMap.values()); } }, { key: "_isC2CNotice", value: function(e2) { e2 = e2.eventArray; return !(!nt(e2) || 10 !== e2[0].event); } }, { key: "_handleNoticeFromUnreadDB", value: function() { var t2, e2 = this._noticeFromUnreadDBList.length; 0 !== e2 && (v.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, t2) { var a2, s2 = this, r2 = this.get(11), c2 = []; e2.dataList.forEach(function(e3) { e3.c2cMessageRevokedNotify && (e3 = e3.c2cMessageRevokedNotify.revokedInfos, A(e3) || e3.forEach(function(e4) { var t3 = s2.getMyUserID() === e4.from ? "".concat(R.CONV_C2C).concat(e4.to) : "".concat(R.CONV_C2C).concat(e4.from); a2 = r2.revoke(t3, e4.sequence, e4.random); var n2, o2 = e4.revokerInfo && e4.revokerInfo.revoker, i2 = e4.revokerInfo && e4.revokerInfo.reason || ""; a2 ? n2 = a2 : (n2 = { conversationID: t3, 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 && (v.l("".concat(this._n, ".onMsgRevoked count:").concat(c2.length, " updateUnreadCount:").concat(t2)), r2.onMessageRevoked(c2, t2), r2.updateRevokerInfo(c2).then(function(e3) { s2.emitOEvt(G.MESSAGE_REVOKED, e3); })); } }, { key: "onMsgReadReceipt", value: function(e2) { var i2 = this; e2.dataList.forEach(function(e3) { var o2; Je(e3.c2cMessageReadReceipt) || (o2 = e3.c2cMessageReadReceipt.to, e3.c2cMessageReadReceipt.uinPairReadArray.forEach(function(e4) { var e4 = e4.peerReadTime, t2 = (v.l("".concat(i2._n, ".onMsgReadReceipt to:").concat(o2, " peerReadTime:").concat(e4)), "".concat(R.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; Je(e3.c2cMessageReadNotice) || (n2 = o2.get(11), e3.c2cMessageReadNotice.uinPairReadArray.forEach(function(e4) { var t2 = e4.from, e4 = e4.peerReadTime, t2 = (v.l("".concat(o2._n, ".onMsgReadNotice from:").concat(t2, " lastReadTime:").concat(e4)), "".concat(R.CONV_C2C).concat(t2)); n2.updateIsReadAfterReadReport({ conversationID: t2, lastMessageTime: e4 }), n2.updateUnreadCount(t2); })); }); } }, { key: "onMsgModified", value: function(e2) { v.l("".concat(this._n, ".onMsgModified options:"), e2); var t2 = this.get(11); e2.dataList.forEach(function(e3) { t2.onMessageModified(y(y({}, e3), {}, { conversationType: R.CONV_C2C })); }); } }, { key: "onReadReceiptList", value: function(e2) { v.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 = (ft(e2.cloudCustomData) && 0 < e2.cloudCustomData.length && (o2 = e2.cloudCustomData), []), a2 = (et(t2) && et(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: I.SEND_C2C_MSG, data: { fromAccount: this.getMyUserID(), toAccount: e2.to, msgBody: po(e2.type, s2, r2), cloudCustomData: o2, msgSeq: e2.sequence, msgRandom: e2.random, msgLifeTime: a2, nick: e2.nick, avatar: e2.avatar, offlinePushInfo: Bo(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, forbidCallbackControl: Et(t2) } }; } }, { key: "isOnlineMessage", value: function(e2, t2) { return !(!t2 || true !== t2.onlineUserOnly); } }, { key: "revokeMessage", value: function(e2) { return this.req({ P: I.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 v.l("".concat(this._n, ".deleteMessage toAccount:").concat(t2, " count:").concat(e2.length)), this.req({ P: I.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, l2 = e2.cloudCustomData, e2 = e2._elements, u2 = void 0; return Wt(c2) && (1 < e2.length && e2.splice(0, 1, { type: c2, content: r2 }), u2 = e2), this.req({ P: I.MODIFY_C2C_MSG, data: { from: t2, to: n2, version: o2, sequence: i2, random: a2, time: s2, elements: u2, cloudCustomData: l2 } }); } }, { 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 = (v.l("".concat(i2, " ").concat(e2)), Qe(o2) || this.warn("DoNotModifyLastTime"), new M("setMessageRead")); return a2.setMessage(e2), this.req({ P: I.SET_C2C_MSG_READ, data: { C2CMsgReaded: { cookie: "", C2CMsgReadedItem: [{ toAccount: n2.replace("C2C", ""), lastMessageTime: o2, receipt: 1 }] } } }).then(function() { a2.end(), v.l("".concat(i2, " ok")); var e3 = t2.get(11); return e3.updateIsReadAfterReadReport({ conversationID: n2, lastMessageTime: o2 }), e3.updateUnreadCount(n2), Sn(); }).catch(function(e3) { return a2.setError(e3).end(), v.l("".concat(i2, " failed. error:"), e3), C(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 = (v.l("".concat(r2, " ").concat(u2)), new M("getRoamingMessage")); return this.req({ P: I.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 = (A(n3) ? v.l("".concat(r2, " ok. complete:").concat(t3, " but messageList is undefined!")) : v.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 = (v.l("".concat(r2, " update isPeerRead property. convID:").concat(c2, " peerReadTime:").concat(o3)), o3 ? i2.updateMsgIsPeerReadProp(c2, o3) : (e3 = c2.replace(R.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), v.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(), v.w("".concat(r2, " failed. error:"), e3), C(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(R.CONV_C2C).concat(t2), u2 = "peerAccount:".concat(t2, " count:").concat(o2, " time:").concat(n2, " direction:").concat(r2), l2 = (v.l("".concat(s2, " ").concat(u2)), new M("getRoamingMessagesHopping")); return this.req({ P: I.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 = (v.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 v.l("".concat(s2, " update isPeerRead property. convID:").concat(c2, " peerReadTime:").concat(t3)), t3 ? i2.updateMsgIsPeerReadProp(c2, t3) : (e3 = c2.replace(R.CONV_C2C, ""), a2.getRemotePeerReadTime([e3]).then(function() { i2.updateMsgIsPeerReadProp(c2, i2.getPeerReadTime(c2)); })), Sn(n3); }).catch(function(e3) { return l2.setMessage(u2).setError(e3).end(), v.w("".concat(s2, " failed. error:"), e3), C(e3); }); } }, { key: "_computeResult", value: function(e2) { var t2 = e2.complete, t2 = void 0 === t2 ? 0 : t2, n2 = e2.lastMessageTime, e2 = e2.resultList, e2 = { messageList: D(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 = this, r2 = "".concat(this._n, ".").concat("getRemotePeerReadTime"); if (Je(a2)) return Promise.resolve(); var c2 = new M("getRemotePeerReadTime"); return v.l("".concat(r2, " userIDList:").concat(a2)), this.req({ P: I.GET_C2C_PEER_READ_TIME, data: { userIDList: a2 } }).then(function(e2) { var t2 = e2.data.peerReadTimeList; v.l("".concat(r2, " ok. peerReadTimeList:").concat(t2)); for (var n2 = "", o2 = s2.get(11), i2 = 0; i2 < a2.length; i2++) n2 += "".concat(a2[i2], "-").concat(t2[i2], " "), 0 < t2[i2] && o2.recordPeerReadTime("".concat(R.CONV_C2C).concat(a2[i2]), t2[i2]); c2.setMessage(n2).end(); }).catch(function(e2) { c2.setError(e2).end(), v.w("".concat(r2, " failed. error:"), e2); }); } }, { key: "sendReadReceipt", value: function(e2) { var t2 = e2[0].conversationID.replace(R.CONV_C2C, ""), n2 = new M("sendReadReceipt"), o2 = (n2.setMessage("peerAccount:".concat(t2)), this.getMyUserID()), e2 = e2.filter(function(e3) { return e3.from !== o2 && 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 }; }); if (0 === e2.length) return C({ code: T.READ_RECEIPT_MSG_LIST_EMPTY }); var i2 = "".concat(this._n, ".").concat("sendReadReceipt"); return v.l("".concat(i2, ". peerAccount:").concat(t2, " length:").concat(e2.length)), this.req({ P: I.SEND_C2C_READ_RECEIPT, data: { peerAccount: t2, messageInfoList: e2 } }).then(function(e3) { return n2.end(), v.l("".concat(i2, " ok")), Sn(); }).catch(function(e3) { return n2.setError(e3).end(), v.w("".concat(i2, " failed. error:"), e3), C(e3); }); } }, { key: "getReadReceiptList", value: function(e2) { var t2 = e2[0].conversationID.replace(R.CONV_C2C, ""); return v.l("".concat(this._n, ".getReadReceiptList peerAccount:").concat(t2, " msgCount:").concat(e2.length)), kn({ messageList: e2 }); } }, { key: "getMessageExtensions", value: function(e2, t2) { return v.l("".concat(this._n, ".getMessageExtensions startSequence:").concat(t2)), this.req({ P: I.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 v.l("".concat(this._n, ".modifyMsgExts operateType:").concat(n2)), this.req({ P: I.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() { v.l("".concat(this._n, ".reset")), this._msgFromUnreadDBMap.clear(), this._noticeFromUnreadDBList.length = 0; } }]); var Ko, Yo = zo, Wo = { 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) }, jo = (e(Jo, [{ key: "_onCloudConfig", value: function() { var e2 = this._convM.getCloudConfig("topic_msg_limit"); A(e2) || (this.TOPIC_MSG_LIMIT = Number(e2)), v.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 = N(this._map); try { for (n2.s(); !(t2 = n2.n()).done; ) { var o2 = m(t2.value, 2), i2 = o2[0], a2 = o2[1]; i2.includes(We) && 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 (nt(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(R.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 = e2.conversationID, o2 = this._getUniqueIDOfMsg(e2); if (!this._map.has(n2)) return this._map.set(n2, /* @__PURE__ */ new Map()), this._map.get(n2).set(o2, e2), void t2.push(e2); var i2 = this._map.get(n2), a2 = Array.from(i2); i2.has(o2) || (a2.unshift([o2, e2]), this._map.set(n2, new Map(a2)), 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 = N(e2); try { for (i2.s(); !(o2 = i2.n()).done; ) { var a2 = m(o2.value, 2)[1]; if (a2.sequence === t2 && (A(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); v.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) { var t2 = null; return t2 = (t2 = this._findMsg(e2, this._map)) ? t2 : this._findMsg(e2, this._hoppingMsgMap); } }, { key: "_findMsg", value: function(e2, t2) { var n2, o2 = null, i2 = N(t2); try { for (i2.s(); !(n2 = i2.n()).done; ) for (var a2 = D(m(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)), v.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 = N(e2); try { for (i2.s(); !(n2 = i2.n()).done; ) { var a2 = m(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) ? D(this._map.get(e2).values()) : []; } }, { key: "getLocalMaxSeq", value: function(e2) { if (!this.hasLocalMsgList(e2)) return 0; e2 = D(this._map.get(e2).values()).map(function(e3) { return e3.sequence; }); return Math.max.apply(Math, D(e2)); } }, { key: "getLocalMaxTime", value: function(e2) { if (!this.hasLocalMsgList(e2)) return 0; e2 = D(this._map.get(e2).values()).map(function(e3) { return e3.time; }); return Math.max.apply(Math, D(e2)); } }, { 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(R.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 (!Je(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)); v.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 (!Je(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)); v.l("".concat(this._n, ".modifyMsgSentByMe convID:").concat(t2, " count:").concat(s2)); } } } }, { key: "getTopicConvIDList", value: function(t2) { return D(this._map.keys()).filter(function(e2) { return e2.startsWith("".concat(R.CONV_GROUP).concat(t2)); }); } }, { key: "onMsgModified", value: function(e2, t2) { if (!this._map.has(e2) && !this._hoppingMsgMap.has(e2)) return { isUpdated: false, message: null }; var n2 = "".concat(this._n, ".onMsgModified"), o2 = this._getUniqueIDOfMsg(t2), i2 = this._getTargetMsg(e2, o2), a2 = !!i2; return v.l("".concat(n2, " convID:").concat(e2, " uniqueID:").concat(o2, " has:").concat(a2)), a2 ? (e2 = t2.messageVersion, o2 = t2.elements, a2 = t2.cloudCustomData, t2 = t2.checkResult, v.l("".concat(n2, " localVersion:").concat(i2.version, " remoteVersion:").concat(e2)), i2.version < e2 ? (i2.version = e2, i2._elements = JSON.parse(JSON.stringify(o2)), i2.payload = i2._elements[0].content, i2.type = i2._elements[0].type, i2.cloudCustomData = a2, i2.isModified = true, i2.hasRiskContent = $t(t2), { isUpdated: true, message: i2 }) : { isUpdated: false, message: i2 }) : { 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 = D(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(); } }]), Jo); function Jo(e2) { d(this, Jo), 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(Wo.CLOUD_CONFIG, this._onCloudConfig, this); } function zo(e2) { return d(this, zo), (e2 = Ko.call(this, e2))._n = "C2CModule", e2._msgFromUnreadDBMap = /* @__PURE__ */ new Map(), e2._noticeFromUnreadDBList = [], e2; } function Xo(e2) { this.mixin(e2); } Xo.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 Zo(e2, t2, n2) { return A(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 Ro ? { lastTime: e2.time || 0, lastSequence: e2.sequence || 0, fromAccount: e2.from || "", messageForShow: Yt(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: Yt(e2.type, e2.payload, t2) }); } function Qo(e2, t2) { return Je(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: Yt(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 $o(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 ei, ti, ni, oi, ii, ai = ["jpg", "jpeg", "gif", "png", "bmp", "image", "webp"], si = ["mp4", "quicktime", "mov"], ri = (e(la, [{ key: "validate", value: function(e2) { var t2, n2 = true, o2 = ""; if (Je(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], !ft(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 (!ft(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 (Je(e2[t2]) && !ft(e2[t2]) && !Qe(e2[t2])) { o2 = "key:" + t2 + ", invalid value:" + e2[t2], n2 = false; continue; } switch (t2) { case "nick": ft(e2[t2]) || (n2 = !(o2 = "nick must be a string")), 500 < ut(e2[t2]) && (o2 = "nick name limited: must less than or equal to ".concat(500, " bytes, current size: ").concat(ut(e2[t2]), " bytes"), n2 = false); break; case "gender": pt(Ve, e2.gender) || (o2 = "key:gender, invalid value:" + e2.gender, n2 = false); break; case "birthday": Qe(e2.birthday) || (n2 = !(o2 = "birthday must be a number")); break; case "location": ft(e2.location) || (n2 = !(o2 = "location must be a string")); break; case "selfSignature": ft(e2.selfSignature) || (n2 = !(o2 = "selfSignature must be a string")); break; case "allowType": pt(Be, e2.allowType) || (o2 = "key:allowType, invalid value:" + e2.allowType, n2 = false); break; case "language": Qe(e2.language) || (n2 = !(o2 = "language must be a number")); break; case "avatar": ft(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": pt(He, e2.adminForbidType) || (o2 = "key:adminForbidType, invalid value:" + e2.adminForbidType, n2 = false); break; case "level": Qe(e2.level) || (n2 = !(o2 = "level must be a number")); break; case "role": Qe(e2.role) || (n2 = !(o2 = "role must be a number")); break; default: o2 = "unknown key:" + t2 + " " + e2[t2], n2 = false; } } return { valid: n2, tips: o2 }; } }]), la), ci = (e(ua, [{ 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(); } }]), ua), ui = ["groupID", "name", "avatar", "type", "introduction", "notification", "ownerID", "selfInfo", "createTime", "infoSequence", "lastInfoTime", "lastMessage", "nextMessageSeq", "memberNum", "maxMemberNum", "memberList", "joinOption", "groupCustomField", "muteAllMembers", "isSupportTopic", "inviteOption", "_lastRevokedTime"], li = (e(ca, [{ 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) ui.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), A(e2.muteAllMembers) || ("On" === e2.muteAllMembers ? e2.muteAllMembers = true : e2.muteAllMembers = false), e2.groupCustomField && Tt(this.groupCustomField, e2.groupCustomField), A(e2.memberNum) || (this.memberCount = e2.memberNum), A(e2.maxMemberNum) || (this.maxMemberCount = e2.maxMemberNum), A(e2.isSupportTopic) || (this.isSupportTopic = Qe(e2.isSupportTopic) ? 1 === e2.isSupportTopic : e2.isSupportTopic), rt(this, e2, ["members", "errorCode", "lastMsgTime", "groupCustomField", "memberNum", "maxMemberNum", "isSupportTopic"]), nt(e2.members) && 0 < e2.members.length && e2.members.forEach(function(e3) { e3.userID === t2.selfInfo.userID && rt(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 }; rt(this.selfInfo, y({}, e2), [], ["", null, void 0, 0, NaN]); } }, { key: "setSelfNameCard", value: function(e2) { this.selfInfo.nameCard = e2; } }]), ca), di = (e(ra, [{ key: "toAccount", get: function() { return this.conversationID.startsWith(R.CONV_C2C) ? this.conversationID.replace(R.CONV_C2C, "") : this.conversationID.startsWith(R.CONV_GROUP) ? this.conversationID.replace(R.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; } }), A(this.userProfile) && this.type === R.CONV_C2C ? this.userProfile = new ri({ userID: t2.conversationID.replace("C2C", "") }) : A(this.groupProfile) && this.type === R.CONV_GROUP && (this.groupProfile = new li({ groupID: t2.conversationID.replace("GROUP", "") })); } }, { key: "updateUnreadCount", value: function(e2) { var t2 = e2.nextUnreadCount, n2 = e2.isFromGetConversations, e2 = e2.isUnreadC2CMessage; A(t2) || (St(this.subType) ? this.unreadCount = 0 : n2 && this.type === R.CONV_GROUP || n2 && this.type === R.CONV_TOPIC || e2 && this.type === R.CONV_C2C ? this.unreadCount = t2 : this.unreadCount = this.unreadCount + t2); } }, { key: "updateLastMessage", value: function(e2) { this.lastMessage = Zo(e2); } }, { key: "updateGroupAtInfoList", value: function(e2) { var t2; this._isNeedMergeGroupAtInfo(e2) || (-1 !== (t2 = (E(t2 = e2.groupAtType) || L(t2) || S(t2) || O()).slice(0)).indexOf(R.CONV_AT_ME) && -1 !== t2.indexOf(R.CONV_AT_ALL) && (t2 = [R.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 e2 = t2.groupID, n2 = t2.sequence; if (!kt({ groupID: e2 })) return false; var o2 = false; return this.groupAtInfoList.forEach(function(e3) { e3.messageSequence === n2 && (-1 < e3.atTypeArray.indexOf(R.CONV_AT_ME) && -1 < t2.groupAtType.indexOf(R.CONV_AT_ALL) && (e3.atTypeArray = [R.CONV_AT_ALL_AT_ME]), -1 < e3.atTypeArray.indexOf(R.CONV_AT_ALL) && -1 < t2.groupAtType.indexOf(R.CONV_AT_ME) && (e3.atTypeArray = [R.CONV_AT_ALL_AT_ME], e3.__random = t2.__random, e3.__sequence = t2.__sequence), o2 = true); }), o2; } }, { 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 === R.CONV_C2C && t2 === this.lastMessage.lastSequence && e2 === this.lastMessage.lastTime || this.type === R.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; } }]), ra), pi = (c(qn = {}, R.MSG_REMIND_ACPT_AND_NOTE, 0), c(qn, R.MSG_REMIND_DISCARD, 1), c(qn, R.MSG_REMIND_ACPT_NOT_NOTE, 2), qn), _i = (e(sa, [{ key: "onAllRcvMsgOptNotify", value: function(e2) { e2 = this._handleResult(e2); this._convM.emitOEvt(G.ALL_RECEIVE_MESSAGE_OPT_UPDATED, e2); } }, { key: "getC2CMsgRemindType", value: function(t2) { var n2 = this, o2 = "".concat(this._n, ".getC2CMsgRemindType"); return this._convM.req({ P: I.GET_C2C_PEER_MUTE_NOTIFICATIONS, data: { toAccount: this._convM.getMyUserID(), userIDList: t2 } }).then(function(e2) { v.l("".concat(o2, " ok. userIDList:").concat(t2)); e2 = e2.data.muteFlagList; n2._convM.onC2CMsgRemindTypeFetched(e2); }).catch(function(e2) { v.e("".concat(o2, " failed. error:"), e2); }); } }, { key: "set", value: function(e2) { return e2.groupID ? this._setGroupMsgRemindType(e2) : nt(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 M("_setGroupMsgRemindType"), r2 = (s2.setMessage(a2), this._get(7)); return r2 ? r2.modifyGroupMemberInfo({ groupID: e2, messageRemindType: i2, userID: this._convM.getMyUserID() }).then(function() { s2.end(), v.l("".concat(o2, " ok. ").concat(a2)); var e3 = n2.onGroupMsgRemindTypeUpdated(t2); return n2._convM.onTotalUnreadCountUpdate(), Sn(e3); }).catch(function(e3) { return s2.setError(e3).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }) : C({ code: T.NO_MODULE }); } }, { key: "onGroupMsgRemindTypeUpdated", value: function(e2) { var t2, n2, o2 = e2.groupID, e2 = e2.messageRemindType, i2 = (v.l("".concat(this._n, ".onGroupMsgRemindTypeUpdated groupID:").concat(o2, " messageRemindType:").concat(e2)), this._get(7).getLocalGroupProfile(o2)); return i2 && (i2.selfInfo.messageRemindType = e2), Rt(o2) ? (t2 = Kt(n2 = o2), (n2 = this._get(10).getLocalTopic(t2, n2)) && n2.updateSelfInfo({ messageRemindType: e2 }) && this._convM.emitOEvt(G.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 = pi[s2] || 0, c2 = "userIDList:".concat(r2, " messageRemindType:").concat(s2), u2 = new M("_setC2CMsgRemindType"); return u2.setMessage(c2), this._convM.req({ P: I.SET_C2C_PEER_MUTE_NOTIFICATIONS, data: { userIDList: r2, muteFlag: e2 } }).then(function(e3) { u2.end(); var e3 = e3.data.errorList, t3 = [], n2 = [], e3 = (nt(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 = (v.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(), kn({ successUserIDList: e3.map(function(e4) { return { userID: e4 }; }), failureUserIDList: n2 }); }).catch(function(e3) { return u2.setError(e3).end(), v.e("".concat(a2, " failed. error:"), e3), C(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 ? R.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 M("setAllRcvMsgOpt"); return s2.setMessage(e2), v.l("".concat(t2, " options:").concat(e2)), this._convM.req({ P: I.SET_ALL_RECEIVE_MSG_OPT, data: { messageRemindType: pi[n2], startTime: a2, endTime: i2, isRepeated: o2 ? 1 : 0 } }).then(function(e3) { return s2.end(), v.l("".concat(t2, " ok.")), Sn(e3); }).catch(function(e3) { return s2.setError(e3).end(), v.e("".concat(t2, " failed. error:"), e3), C(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 M("getAllRcvMsgOpt"); return this._convM.req({ P: I.GET_ALL_RECEIVE_MSG_OPT, data: { toAccount: this._convM.getMyUserID() } }).then(function(e2) { e2 = e2.data, o2.setMessage(JSON.stringify(e2)).end(), v.l("".concat(n2, " ok. data:").concat(JSON.stringify(e2))), e2 = t2._handleResult(e2); return Sn(e2); }).catch(function(e2) { return o2.setError(e2).end(), v.e("".concat(n2, " failed. error:"), e2), C(e2); }); } }, { key: "_handleResult", value: function(e2) { var t2 = e2.messageRemindType, n2 = e2.startTime, o2 = e2.endTime, e2 = e2.isRepeated, i2 = R.MSG_REMIND_ACPT_AND_NOTE; return 1 === t2 && (i2 = R.MSG_REMIND_DISCARD), { messageRemindType: i2 = 2 === t2 ? R.MSG_REMIND_ACPT_NOT_NOTE : i2, startTime: n2, endTime: o2, isRepeated: 1 === e2 }; } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")); } }]), sa), hi = (e(aa, [{ key: "setConvCustomData", value: function(e2) { var i2 = this, a2 = "".concat(this._n, ".").concat("setConvCustomData"), t2 = e2.conversationIDList, s2 = e2.customData, r2 = (v.l("".concat(a2, " options:"), e2), new M("setConvCustomData")), n2 = (r2.setMessage(JSON.stringify(e2)), { fromAccount: this._getMyUserID(), itemList: [] }), c2 = [], u2 = []; return t2.forEach(function(e3) { if (!i2._hasLocalConv(e3)) return i2._onConvNotFound(u2, e3), true; if (!At(e3) && !Ot(e3)) return i2._onConvIDInvalid(u2, e3), true; var t3 = { operationType: 2, contactItem: void 0, customMark: s2 }; At(e3) ? t3.contactItem = { type: 1, toAccount: e3.replace(R.CONV_C2C, "") } : Ot(e3) && (t3.contactItem = { type: 2, groupID: e3.replace(R.CONV_GROUP, "") }), n2.itemList.push(t3); }), u2.length === t2.length ? kn({ successConversationIDList: c2, failureConversationIDList: u2 }) : this._convM.req({ P: I.SET_CONV_CUSTOM_DATA, data: n2 }).then(function(e3) { r2.end(), v.l("".concat(a2, " ok")); var t3, n3, o2, e3 = e3.data.resultItem; return nt(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()), Sn({ successConversationIDList: c2, failureConversationIDList: u2 }); }).catch(function(e3) { return r2.setError(e3).end(), v.e("".concat(a2, " failed. error:"), e3), C(e3); }); } }, { key: "markConv", value: function(e2) { var a2 = this; if (!this._convM.canIUse(H.CONV_MARK)) return this._convM.noUse("markConv"); var t2 = "".concat(this._n, ".").concat("markConv"), n2 = e2.conversationIDList, s2 = e2.markType, r2 = e2.enableMark, c2 = (v.l("".concat(t2, " options:"), e2), new M("markConv")), o2 = (c2.setMessage(JSON.stringify(e2)), void 0), i2 = void 0, e2 = this._getFlagBit(s2), d2 = (true === r2 ? i2 = [e2] : o2 = [e2], { fromAccount: this._getMyUserID(), itemList: [] }), u2 = [], l2 = []; return n2.forEach(function(e3) { if (!a2._hasLocalConv(e3)) return a2._onConvNotFound(l2, e3), true; if (!At(e3) && !Ot(e3)) return a2._onConvIDInvalid(l2, e3), true; var t3 = { operationType: 1, contactItem: void 0, clearMark: o2, setMark: i2 }; At(e3) ? t3.contactItem = { type: 1, toAccount: e3.replace(R.CONV_C2C, "") } : Ot(e3) && (t3.contactItem = { type: 2, groupID: e3.replace(R.CONV_GROUP, "") }), d2.itemList.push(t3); }), l2.length === n2.length ? kn({ successConversationIDList: u2, failureConversationIDList: l2 }) : this._convM.req({ P: I.MARK_CONV, data: d2 }).then(function(e3) { c2.end(), v.l("".concat(t2, " ok")); var n3, o3, i3, e3 = e3.data.resultItem; return nt(e3) && (i3 = false, e3.forEach(function(e4) { var t3; n3 = a2._concatConvID(e4.contactItem), 0 === e4.resultCode ? (u2.push(n3), (o3 = a2._getLocalConv(n3)) && (t3 = o3.markList.indexOf(s2), true === r2 ? -1 === t3 && (o3.markList.push(s2), i3 = true) : -1 !== t3 && (o3.markList.splice(t3, 1), i3 = true))) : l2.push({ conversationID: n3, code: e4.resultCode, message: e4.resultInfo }); }), true === i3 && a2._emitConvUpdate()), Sn({ successConversationIDList: u2, failureConversationIDList: l2 }); }).catch(function(e3) { return c2.setError(e3).end(), v.e("".concat(t2, " failed. error:"), e3), C(e3); }); } }, { key: "getLocalConvGroupList", value: function() { var e2 = this; return v.l("".concat(this._n, ".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)), this._pagingStatus === bn ? this.getRemoteConvGroupList().then(function() { return Sn(D(e2._convGroupMap.values())); }) : kn(D(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 }); }), v.l("".concat(o2, " type:").concat(t2, " list:"), e2), this._convM.req({ P: I.SEARCH_CONV_GRP_MARK, data: { fromAccount: this._getMyUserID(), contactItem: i2 } }).then(function(e3) { var e3 = e3.data, t3 = e3.contactItem, e3 = e3.groupItem; v.l("".concat(o2, " ok. contactItem:"), t3, "groupItem:", e3), n2._fillConvGroupMap(e3), n2._handleContactItem(t3), n2._emitConvUpdate(); }).catch(function(e3) { v.w("".concat(o2, " failed. error:"), e3); }); } }, { key: "_fillConvGroupMap", value: function(e2) { var n2 = this; nt(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; nt(e2) && e2.forEach(function(e3) { var t2 = [], n2 = e3.standardMark, o2 = e3.customData, i2 = e3.convGroupIDList; nt(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 = jt(n2), a2.customData = o2 || "", a2.conversationGroupList = [].concat(t2)); }); } }, { key: "getRemoteConvGroupList", value: function() { var i2 = this, a2 = "".concat(this._n, ".getRemoteConvGroupList"); return this._pagingStatus = Pn, this._convM.req({ P: I.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, v.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 = Un, i2._emitConvUpdate(), i2._emitConvGroupListUpdate()); }).catch(function(e2) { i2._pagingStatus = bn, v.w("".concat(a2, " failed. error:"), e2); }); } }, { key: "createConvGroup", value: function(e2) { var a2 = this; if (!this._convM.canIUse(H.CONV_GROUP)) return this._convM.noUse("createConvGroup"); var s2 = "".concat(this._n, ".").concat("createConvGroup"), r2 = (v.l("".concat(s2, " options:"), e2), new M("createConvGroup")), c2 = (r2.setMessage(JSON.stringify(e2)), e2.groupName), e2 = e2.conversationIDList, t2 = { fromAccount: this._getMyUserID(), itemList: [{ groupName: c2, contactItem: [] }] }, u2 = [], l2 = []; return e2.forEach(function(e3) { return a2._hasLocalConv(e3) ? At(e3) || Ot(e3) ? void (At(e3) ? t2.itemList[0].contactItem.push({ type: 1, toAccount: e3.replace(R.CONV_C2C, "") }) : Ot(e3) && t2.itemList[0].contactItem.push({ type: 2, groupID: e3.replace(R.CONV_GROUP, "") })) : (a2._onConvIDInvalid(l2, e3), true) : (a2._onConvNotFound(l2, e3), true); }), l2.length === e2.length ? kn({ successConversationIDList: u2, failureConversationIDList: l2 }) : this._convM.req({ P: I.CREATE_CONV_GRP, data: t2 }).then(function(e3) { r2.end(), v.l("".concat(s2, " ok")); var t3, n2, o2, e3 = e3.data.groupResultItem[0], i2 = e3.groupItem, e3 = e3.resultItem; return et(i2) && (a2._convGroupMap.set(i2.convGroupID, i2.groupName), a2._emitConvGroupListUpdate()), nt(e3) && (o2 = false, e3.forEach(function(e4) { t3 = a2._concatConvID(e4.contactItem), 0 === e4.resultCode ? (u2.push(t3), (n2 = a2._getLocalConv(t3)) && -1 === n2.conversationGroupList.indexOf(c2) && (n2.conversationGroupList.push(c2), o2 = true)) : l2.push({ conversationID: t3, code: e4.resultCode, message: e4.resultInfo }); }), true === o2 && (a2._emitConvUpdate(), a2._emitConvGroupListUpdate())), Sn({ successConversationIDList: u2, failureConversationIDList: l2 }); }).catch(function(e3) { return r2.setError(e3).end(), v.e("".concat(s2, " failed. error:"), e3), C(e3); }); } }, { key: "deleteConvGroup", value: function(n2) { var o2 = this; if (!this._convM.canIUse(H.CONV_GROUP)) return this._convM.noUse("deleteConvGroup"); var i2 = "".concat(this._n, ".").concat("deleteConvGroup"), a2 = (v.l("".concat(i2, " groupName:").concat(n2)), new M("deleteConvGroup")); return a2.setMessage(n2), this._convM.req({ P: I.DEL_CONV_GRP, data: { fromAccount: this._getMyUserID(), groupName: [n2] } }).then(function(e2) { a2.end(), v.l("".concat(i2, " ok")); var t2, e2 = e2.data.groupItem; nt(e2) && (t2 = false, e2.forEach(function(e3) { o2._convGroupMap.has(e3.convGroupID) && (o2._convGroupMap.delete(e3.convGroupID), t2 = true); }), true === t2 && o2._emitConvGroupListUpdate()), o2._eraseFromConversationGroupList([n2]); }).catch(function(e2) { return a2.setError(e2).end(), v.e("".concat(i2, " failed. error:"), e2), C(e2); }); } }, { key: "renameConvGroup", value: function(e2) { var i2 = this; if (!this._convM.canIUse(H.CONV_GROUP)) return this._convM.noUse("renameConvGroup"); var a2 = "".concat(this._n, ".").concat("renameConvGroup"), s2 = (v.l("".concat(a2, " options:"), e2), new M("renameConvGroup")), r2 = (s2.setMessage(JSON.stringify(e2)), e2.oldName), c2 = e2.newName; return this._convM.req({ P: I.RENAME_CONV_GRP, data: { fromAccount: this._getMyUserID(), updateType: 1, updateGroup: { updateGroupType: 1, oldName: r2, newName: c2 } } }).then(function(e3) { s2.end(), v.l("".concat(a2, " ok")); e3 = e3.data.updateGroupResult.convGroupID; i2._convGroupMap.set(e3, c2), i2._emitConvGroupListUpdate(); var t2, n2, e3 = i2._convM.getLocalConvList(), o2 = false; e3.forEach(function(e4) { t2 = e4.conversationGroupList, -1 !== (n2 = t2.indexOf(r2)) && (t2.splice(n2, 1, c2), o2 = true); }), true === o2 && i2._emitConvUpdate(); }).catch(function(e3) { return s2.setError(e3).end(), v.e("".concat(a2, " failed. error:"), e3), C(e3); }); } }, { key: "addConvsToGroup", value: function(e2) { var i2 = this; if (!this._convM.canIUse(H.CONV_GROUP)) return this._convM.noUse("addConvsToGroup"); var a2 = "".concat(this._n, ".").concat("addConvsToGroup"), s2 = (v.l("".concat(a2, " options:"), e2), new M("addConvsToGroup")), t2 = (s2.setMessage(JSON.stringify(e2)), e2.conversationIDList), r2 = e2.groupName, n2 = { fromAccount: this._getMyUserID(), updateType: 1, updateGroup: { updateGroupType: 2, groupName: r2, updateItem: [] } }, c2 = [], u2 = []; return t2.forEach(function(e3) { return i2._hasLocalConv(e3) ? At(e3) || Ot(e3) ? void (At(e3) ? n2.updateGroup.updateItem.push({ operationType: 1, contactItem: { type: 1, toAccount: e3.replace(R.CONV_C2C, "") } }) : Ot(e3) && n2.updateGroup.updateItem.push({ operationType: 1, contactItem: { type: 2, groupID: e3.replace(R.CONV_GROUP, "") } })) : (i2._onConvIDInvalid(u2, e3), true) : (i2._onConvNotFound(u2, e3), true); }), u2.length === t2.length ? kn({ successConversationIDList: c2, failureConversationIDList: u2 }) : this._convM.req({ P: I.ADD_CONV_TO_GRP, data: n2 }).then(function(e3) { s2.end(), v.l("".concat(a2, " ok")); var t3, n3, o2, e3 = e3.data.updateGroupResult.contactResultItem; return nt(e3) && (o2 = false, e3.forEach(function(e4) { t3 = i2._concatConvID(e4.contactItem), 0 === e4.resultCode ? (n3 = i2._getLocalConv(t3)) && -1 === n3.conversationGroupList.indexOf(r2) && (n3.conversationGroupList.push(r2), c2.push(t3), o2 = true) : u2.push({ conversationID: t3, code: e4.resultCode, message: e4.resultInfo }); }), true === o2 && (i2._emitConvUpdate(), i2._emitConvInGroupUpdate(r2))), Sn({ successConversationIDList: c2, failureConversationIDList: u2 }); }).catch(function(e3) { return s2.setError(e3).end(), v.e("".concat(a2, " failed. error:"), e3), C(e3); }); } }, { key: "deleteConvsFromGroup", value: function(e2) { var a2 = this, t2 = "deleteConvsFromGroup"; if (!this._convM.canIUse(H.CONV_GROUP)) return this._convM.noUse(t2); var s2 = "".concat(this._n, ".").concat(t2), r2 = (v.l("".concat(s2, " options:"), e2), new M(t2)), t2 = (r2.setMessage(JSON.stringify(e2)), e2.conversationIDList), c2 = e2.groupName, n2 = { fromAccount: this._getMyUserID(), updateType: 1, updateGroup: { updateGroupType: 2, groupName: c2, updateItem: [] } }, u2 = [], l2 = []; return t2.forEach(function(e3) { return a2._hasLocalConv(e3) ? At(e3) || Ot(e3) ? void (At(e3) ? n2.updateGroup.updateItem.push({ operationType: 2, contactItem: { type: 1, toAccount: e3.replace(R.CONV_C2C, "") } }) : Ot(e3) && n2.updateGroup.updateItem.push({ operationType: 2, contactItem: { type: 2, groupID: e3.replace(R.CONV_GROUP, "") } })) : (a2._onConvIDInvalid(l2, e3), true) : (a2._onConvNotFound(l2, e3), true); }), l2.length === t2.length ? kn({ successConversationIDList: u2, failureConversationIDList: l2 }) : this._convM.req({ P: I.DEL_CONV_FROM_GRP, data: n2 }).then(function(e3) { r2.end(), v.l("".concat(s2, " ok")); var n3, o2, i2, e3 = e3.data.updateGroupResult.contactResultItem; return nt(e3) && (i2 = false, e3.forEach(function(e4) { var t3; n3 = a2._concatConvID(e4.contactItem), 0 === e4.resultCode ? !(o2 = a2._getLocalConv(n3)) || -1 !== (t3 = o2.conversationGroupList.indexOf(c2)) && (o2.conversationGroupList.splice(t3, 1), u2.push(n3), i2 = true) : l2.push({ conversationID: n3, code: e4.resultCode, message: e4.resultInfo }); }), true === i2 && (a2._emitConvUpdate(), a2._emitConvInGroupUpdate(c2))), Sn({ successConversationIDList: u2, failureConversationIDList: l2 }); }).catch(function(e3) { return r2.setError(e3).end(), v.e("".concat(s2, " failed. error:"), e3), C(e3); }); } }, { key: "onConvMarkUpdated", value: function(e2) { var i2, a2, s2 = this; Je(e2) || (v.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 = jt(t2), n2 = false; return true !== function(e3, t3) { if (e3 === t3) return true; 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 = (v.l("".concat(this._n, ".onConvGroupCreated resultList:"), e2), false), r2 = false; nt(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; nt(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 = (v.l("".concat(this._n, ".onConvGroupDeleted groupItemList:"), e2), []); nt(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) { Je(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) { v.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 = (v.l("".concat(this._n, ".onConvInGroupUpdated options:"), e2), e2.oldGroupName), e2 = e2.recentContactUpdateGroupItem; nt(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 = (v.l("".concat(this._n, ".onConvAddedToOrDeletedFromGroup options:"), e2), e2.msgRecentContactItem), e2 = e2.msgRecentContactUpdateContactItem, t2 = this._concatConvID(t2), a2 = this._getLocalConv(t2); a2 && nt(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) { nt(e2) && 0 !== e2.length && (v.l("".concat(this._n, ".onConvGroupListSynced groupItem:"), e2), this._fillConvGroupMap(e2)); } }, { key: "getConvGroupListByID", value: function(e2) { var t2, n2 = this; if (!Je(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: T.CONV_NOT_FOUND, message: this._convM.getErrMsg(T.CONV_NOT_FOUND) }); } }, { key: "_onConvIDInvalid", value: function(e2, t2) { e2.push({ conversationID: t2, code: T.INVALID_CONV_ID, message: this._convM.getErrMsg(T.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 ? A(e2) ? A(o2) || (t2 = "".concat(R.CONV_C2C).concat(o2)) : t2 = "".concat(R.CONV_C2C).concat(e2) : 2 === n2 && (t2 = "".concat(R.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(G.CONVERSATION_GROUP_LIST_UPDATED, D(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(G.CONVERSATION_IN_GROUP_UPDATED, e2); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this._convGroupMap.clear(), this._startIndex = 0, this._pagingStatus = Gn; } }]), aa), gi = (t(ia, Fn), ii = f(ia), e(ia, [{ key: "_initListeners", value: function() { var e2 = this.getIEmitInst(); e2.on(Wo.A2KEY_AND_TINYID_UPDATED, this._init, this), e2.on(Wo.PROFILE_UPDATED, this._onProfileUpdated, this), e2.on(Wo.CLOUD_CONFIG, this._onCloudConfig, this); } }, { key: "_init", value: function() { var e2 = this, t2 = (v.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 && St(s2.groupProfile.type)) continue; } this._convMap.set(s2.conversationID, new di(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(R.CONV_C2C) ? e2.replace(R.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(D(this._convIDFromUnreadDBMap), D(n2.map(function(e3) { return [e3.conversationID, 1]; })))), this._diffAndDeleteConv(), s2 && this.emitIEvt(Wo.C2C_UNREAD_HANDLE_COMPLETED)), 0 < n2.filter(function(e3) { return !t2._isConvNeedShow(e3.conversationID); }).length || this.emitConvUpdate()) : s2 && this.emitIEvt(Wo.C2C_UNREAD_HANDLE_COMPLETED) : this.ready(function() { t2._onSendOrRcvMsg(e2); }); } }, { key: "updateConvGroupProfile", value: function(e2) { var n2, o2 = this; nt(e2) && 0 === e2.length || (0 !== this._convMap.size ? (n2 = false, e2.forEach(function(e3) { var t2 = "".concat(R.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 !== R.CONV_TOPIC), n2.type === R.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 = D(e2), i2 = this.get(4); return new Promise(function(c2) { i2.getUserProfile({ userIDList: o2 }).then(function(e3) { e3 = e3.data; if (!nt(e3) || 0 === e3.length) return c2(u2); var t3, n3 = {}, o3 = N(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 === R.CONV_TOPIC ? this.get(10).isLastMessageRevoked({ topicID: n2.replace(R.CONV_GROUP, ""), sequence: o2 }) : a2.isLastMessageRevoked({ sequence: o2, time: i2 })), v.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 || (Je(i2) && (i2 = void 0), r2.updateLastMessage(i2), r2.type !== R.CONV_TOPIC && (s2 = true), v.l("".concat(this._n, ".onMessageDeleted. update convID:").concat(e2, " with lastMessage:"), r2.lastMessage)), e2.startsWith(R.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, l2 = e2.time, d2 = e2.sequence, a2 = e2.elements, p2 = e2.cloudCustomData, s2 = e2.messageVersion, r2 = this.getMyUserID(), c2 = "".concat(n2).concat(i2), r2 = (i2 === r2 && n2 === R.CONV_C2C && (c2 = "".concat(n2).concat(o2)), this._msgListHandler.onMsgModified(c2, e2)), n2 = r2.isUpdated, r2 = r2.message, u2 = (true === n2 && this.emitOEvt(G.MESSAGE_MODIFIED, [r2]), this._isTopicConv(c2)); return null === r2 ? v.l("".concat(t2, " message is null! options:"), e2) : v.l("".concat(t2, " isUpdated:").concat(n2, " isTopicMessage:").concat(u2, " from:").concat(o2, " to:").concat(i2, " sequence:").concat(r2.sequence, " time:").concat(r2.time)), u2 ? this.get(10).onMessageModified(e2) : !(n2 = this._convMap.get(c2)) || (o2 = n2.lastMessage) && o2.lastTime === l2 && o2.lastSequence === d2 && o2.version !== s2 && (v.l("".concat(t2, " convID:").concat(c2, " lastMessage updated")), o2.type = a2[0].type, o2.payload = a2[0].content, o2.messageForShow = Yt(o2.type, o2.payload, this.isIntl()), o2.cloudCustomData = p2, o2.version = s2, this.emitConvUpdate(true, false)), r2; } }, { 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); }), v.l("".concat(this._n, ".onNewGroupAtTips isReady:").concat(this._isReady), this._tmpGroupAtTipsList), this._isReady && this._handleGroupAtTipsList(); } }, { key: "_handleGroupAtTipsList", value: function() { var a2, s2 = this; 0 !== this._tmpGroupAtTipsList.length && (a2 = false, this._tmpGroupAtTipsList.forEach(function(e2) { var t2 = e2.groupID, n2 = e2.from, o2 = e2.topicID, o2 = void 0 === o2 ? void 0 : o2, i2 = e2.sync, i2 = void 0 !== i2 && i2; n2 !== s2.getMyUserID() && (A(o2) ? (n2 = s2._convMap.get("".concat(R.CONV_GROUP).concat(t2))) && (n2.updateGroupAtInfoList(e2), a2 = true) : ((t2 = s2._convMap.get("".concat(R.CONV_GROUP).concat(o2))) && (t2.updateGroupAtInfoList(e2), s2.get(10).onAtInfoUpdated({ topicID: o2, groupAtInfoList: t2.groupAtInfoList })), Je(t2) && i2 && (s2.updateTopicConversation([{ conversationID: "".concat(R.CONV_GROUP).concat(o2), type: R.CONV_TOPIC }]), s2._convMap.get("".concat(R.CONV_GROUP).concat(o2)).updateGroupAtInfoList(e2)))); }), a2 && 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 === R.CONV_C2C ? n2.push(e3.conversationID.replace(R.CONV_C2C, "")) : e3.type === R.CONV_GROUP && o2.push(e3.conversationID.replace(R.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 === R.CONV_C2C || e3.type === R.CONV_GROUP && e3.lastMessage.type !== R.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(G.CONVERSATION_LIST_UPDATED), this.onTotalUnreadCountUpdate(), this._convMapForDiff.clear(), this._convMapForDiff = ct(this._convMap, true)), 0 === this._convMapForDiff.size && (this._convMapForDiff = ct(this._convMap, true))) : (this.emitOEvt(G.CONVERSATION_LIST_UPDATED), this.onTotalUnreadCountUpdate())); } }, { key: "_diffConvMap", value: function(e2, t2) { var n2, o2 = N(t2); try { for (o2.s(); !(n2 = o2.n()).done; ) { var i2 = m(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 = D(ct(this._partialUpdatedConvMap, false).values()); return this._partialUpdatedConvMap.clear(), e2; } }, { key: "getLocalConvList", value: function() { var t2 = this; return D(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 M(i2); return this._pagingStatus === Gn && this._convMap.clear(), this._pagingGetConvList(e2).then(function(e3) { var t2 = Zt(o2._pagingGetCostList), n2 = Xt(o2._pagingGetCostList), n2 = (o2._pagingGetCostList.length = 0, o2._pagingStatus = Un, o2._diffAndDeleteConv(), o2.emitConvUpdate(true, false), o2._setStorageConvList(), o2._handleC2CPeerReadTime(), o2.emitIEvt(Wo.CONV_SYNC_COMPLETED), "count:".concat(o2._convMap.size, " sum:").concat(n2, " avg:").concat(t2)); return v.l("".concat(o2._n, ".").concat(i2, ". ").concat(n2)), a2.setMessage(n2).end(), e3; }).catch(function(e3) { return o2._pagingStatus = bn, a2.setMessage(o2._pagingTs).setError(e3).end(), C(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)); }), v.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 = (v.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 = Pn, this.req({ P: I.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(Qt(u2, false)), v.l("".concat(c2, " ok. completeFlag:").concat(t2, " count:").concat(n2.length, " cost:").concat(Qt(u2))), r2._convGroupHandler.onConvGroupListSynced(e3), 0 < n2.length && (e3 = r2._getConvOptions(n2), r2._pagingConvIDMap = new Map([].concat(D(r2._pagingConvIDMap), D(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 kn(); r2.triggerReady(); } return r2._pagingTs = o2, r2._pagingStartIdx = i2, r2._pagingPinnedTs = a2, r2._pagingPinnedStartIdx = s2, 1 !== t2 ? r2._pagingGetConvList() : (r2._handleGroupAtTipsList(), r2._convGroupHandler.getRemoteConvGroupList(), kn()); }).catch(function(e3) { throw r2.isLoggedIn() && (r2._isReady || (v.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(D(this._convMap))), t2 || this._updateUserOrGroupProfile(e2), v.l("".concat(this._n, "._updateLocalConvList cost:").concat(Qt(n2))); } }, { key: "_getTmpConvListMapping", value: function(e2) { for (var t2 = e2.conversationOptionsList, l2 = e2.isFromGetConversations, d2 = e2.isInstantMessage, p2 = e2.isUnreadC2CMessage, _2 = void 0 !== p2 && p2, h2 = e2.updateUnreadCount, g2 = [], f2 = [], m2 = this.get(7), v2 = this.get(8), I2 = this.isIntl(), M2 = this.isUsingChatCore(), n2 = 0, y2 = t2.length; n2 < y2; n2++) { var o2 = new di(t2[n2], I2, M2), i2 = o2.conversationID, a2 = o2.type; if (!this._isNonExistentAccount(i2)) { if (this._convMap.has(i2)) { var s2 = this._convMap.get(i2); if (l2 && a2 !== R.CONV_TOPIC) { this._convMap.set(i2, o2), a2 === R.CONV_C2C ? o2.unreadCount = s2.unreadCount : a2 === R.CONV_GROUP && (o2.groupProfile = JSON.parse(JSON.stringify(s2.groupProfile))); continue; } var r2 = ["unreadCount", "allowType", "adminForbidType", "payload"], c2 = (false === d2 && r2.push("lastMessage"), "boolean" == typeof d2 && r2.push("isPinned"), t2[n2].lastMessage), u2 = !A(c2); u2 || t2[n2].type === R.CONV_TOPIC || this._onLastMsgNotExist(t2[n2]), A(d2) && u2 && null === s2.lastMessage.payload && (s2.lastMessage.payload = c2.payload), Je(s2.lastMessage.revoker) || (s2.lastMessage.revoker = null), rt(s2, o2, r2, [null, void 0, "", 0, NaN]), true === h2 && s2.updateUnreadCount({ nextUnreadCount: o2.unreadCount, isFromGetConversations: l2, isUnreadC2CMessage: _2 }), d2 && u2 && (c2.payload && (s2.lastMessage.payload = c2.payload), s2.type === R.CONV_GROUP && (s2.lastMessage.nameCard = c2.nameCard, s2.lastMessage.nick = c2.nick)), u2 && s2.lastMessage.cloudCustomData !== c2.cloudCustomData && (s2.lastMessage.cloudCustomData = c2.cloudCustomData || ""); } else a2 === R.CONV_GROUP && m2 ? (r2 = o2.groupProfile.groupID, (u2 = m2.getLocalGroupProfile(r2)) && (o2.groupProfile = u2, true === h2 && o2.updateUnreadCount({ nextUnreadCount: 0 }))) : a2 === R.CONV_C2C && (s2 = i2.replace(R.CONV_C2C, ""), v2 && v2.isMyFriend(s2) && (o2.remark = v2.getFriendRemark(s2))), g2.push(o2), this._convMap.set(i2, o2); this._convMap.get(i2).type === R.CONV_TOPIC && f2.push(this._convMap.get(i2)); } } for (var C2 = this.get(10), T2 = 0, D2 = f2.length; T2 < D2; T2++) { var E2 = f2[T2], L2 = E2.conversationID, E2 = E2.groupAtInfoList; Je(E2) || C2.onAtInfoUpdated({ topicID: L2.replace(R.CONV_GROUP, ""), groupAtInfoList: E2 }); } return { newConvList: g2 }; } }, { key: "_onLastMsgNotExist", value: function(e2) { new M("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 ? Je(e3[1].lastMessage.lastTime) ? n2 : t2 : Je(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(D(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 === R.CONV_C2C ? n2.push(e3.toAccount) : e3.type === R.CONV_GROUP && (t3 = e3.toAccount, i2.hasLocalGroup(t3) ? e3.groupProfile = i2.getLocalGroupProfile(t3) : o2.push(t3)); }), v.l("".concat(this._n, "._updateUserOrGroupProfile userIDList:").concat(n2, " groupIDList:").concat(o2)), 0 < n2.length && t2.getUserProfile({ userIDList: n2 }).then(function(e3) { e3 = e3.data; nt(e3) ? e3.forEach(function(e4) { a2._doUpdateUserProfile("".concat(R.CONV_C2C).concat(e4.userID), e4); }) : a2._doUpdateUserProfile("".concat(R.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(R.CONV_GROUP).concat(e4.groupID); a2._convMap.has(t3) && (t3 = a2._convMap.get(t3), rt(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 A(e3.lastMsg) && (e3.lastMsg = { elements: [] }), 1 === e3.type ? (t2 = { userID: e3.userID, nick: e3.peerNick, avatar: e3.peerAvatar }, o2.push(t2), { conversationID: "".concat(R.CONV_C2C).concat(e3.userID), type: R.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 ri(t2), peerReadTime: e3.c2cPeerReadTime, isPinned: 1 === e3.isPinned, customData: e3.customMark || "", markList: jt(e3.standardMark), conversationGroupList: n2._convGroupHandler.getConvGroupListByID(e3.contactGroupId), remark: e3.friendRemark || "", messageRemindType: n2._transMsgRemindType(e3.messageRemindType) }) : { conversationID: "".concat(R.CONV_GROUP).concat(e3.groupID), type: R.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 li({ 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: jt(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 = R.MSG_REMIND_ACPT_AND_NOTE : 1 === e2 ? t2 = R.MSG_REMIND_DISCARD : 2 === e2 ? t2 = R.MSG_REMIND_ACPT_NOT_NOTE : 3 === e2 && (t2 = R.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 A(void 0 === t2 ? void 0 : t2) || Je(e2) ? { type: n2[0] ? n2[0].type : null, payload: n2[0] ? this._amendLayersOverLimitProp(n2[0].content) : null } : ((t2 = new Ro(e2)).setElement({ type: R.MSG_GRP_TIP, content: y(y({}, e2.elements), {}, { groupProfile: e2.groupProfile }) }), n2 = JSON.parse(JSON.stringify(t2.payload)), t2 = null, { type: R.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 Ro && this._msgListHandler.remove(e2); } }, { key: "onConvDeleted", value: function(e2) { nt(e2) && (e2 = e2.map(function(e3) { var t2 = e3.type, n2 = e3.userID, e3 = e3.groupID; return 1 === t2 ? "".concat(R.CONV_C2C).concat(n2) : 2 === t2 ? "".concat(R.CONV_GROUP).concat(e3) : void 0; }), v.l("".concat(this._n, ".onConvDeleted convIDList:").concat(e2)), this.deleteLocalConvList(e2)); } }, { key: "onConvPinnedStatus", value: function(e2, i2) { var a2, s2 = this; nt(e2) && (a2 = false, e2.forEach(function(e3) { var t2, n2 = e3.type, o2 = e3.userID, e3 = e3.groupID; 1 === n2 ? t2 = s2.getLocalConversation("".concat(R.CONV_C2C).concat(o2)) : 2 === n2 && (t2 = s2.getLocalConversation("".concat(R.CONV_GROUP).concat(e3))), t2 && (v.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), St(o2)) return v.l("".concat(u2, " not available in ").concat(o2, ". convID:").concat(c2)), kn({ messageList: [], nextReqMessageID: "", isCompleted: true }); (A(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 (v.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 v.l("".concat(u2, " ret.nextReqMessageID:").concat(s2.nextReqMessageID, " ret.isCompleted:").concat(s2.isCompleted, " sequenceList:"), o3), nt(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; }); }), Sn(s2); }) : Sn(s2); }); this.modifyMessageList(c2); o2 = this._getMsgListFromMem({ conversationID: c2, nextReqMessageID: t2, count: e2 }); return kn(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 = At(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 v.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 (A(s2) || 15 < s2) && (s2 = 15), o2.startsWith(R.CONV_C2C) ? (t2 = this.get(6), n2 = o2.replace(R.CONV_C2C, ""), t2.getRoamingMessagesHopping({ peerAccount: n2, time: a2, count: s2, direction: e2 })) : o2.startsWith(R.CONV_GROUP) ? (t2 = this.get(7), n2 = o2.replace(R.CONV_GROUP, ""), t2.getRoamingMessagesHopping({ groupID: n2, sequence: i2, count: s2, direction: e2 })) : void 0; } }, { key: "_computeRemainingCount", value: function(e2) { var t2 = e2.conversationID, n2 = e2.nextReqMessageID, e2 = this._msgListHandler.getLocalMsgList(t2), o2 = e2.length; if (v.l("".concat(this._n, "._computeRemainingCount convID:").concat(t2, " nextReqMessageID:").concat(n2, " length:").concat(o2)), !n2) return o2; o2 = 0; return At(t2) ? o2 = e2.findIndex(function(e3) { return e3.ID === n2; }) : Ot(t2) && (o2 = -1 !== n2.indexOf("-") ? e2.findIndex(function(e3) { return e3.ID === n2; }) : e2.findIndex(function(e3) { return e3.sequence + "" === n2; })), o2 = -1 === o2 ? 0 : o2; } }, { key: "_needGetHistory", value: function(e2) { var t2 = e2.conversationID, n2 = e2.remainingCount, e2 = e2.count, o2 = this.getLocalConversation(t2), i2 = ""; if (o2 && o2.groupProfile && (i2 = o2.groupProfile.type), Nt(t2) || St(i2)) return false; if (this._isEverCleared(t2)) return true; o2 = n2 <= e2 && !this._completedMap.has(t2); return v.l("".concat(this._n, "._needGetHistory convID:").concat(t2, " ret:").concat(o2)), o2; } }, { key: "_isTopicConv", value: function(e2) { e2 = e2.replace(R.CONV_GROUP, ""); return Rt(e2); } }, { key: "getHistoryMessages", value: function(e2) { var t2 = e2.conversationID, n2 = e2.count, e2 = e2.nextReqMessageID; if (t2 === R.CONV_SYSTEM) return kn(); var o2, i2, a2 = 15, n2 = (20 < n2 && (a2 = 20), null); if (At(t2)) return c2 = 0, o2 = "", i2 = false, r2 = this._roamingMsgKeyAndTimeMap.has(t2), e2 && (i2 = true, r2 ? (c2 = this._roamingMsgKeyAndTimeMap.get(t2).lastMessageTime, o2 = this._roamingMsgKeyAndTimeMap.get(t2).messageKey) : (s2 = this._msgListHandler.findMessage(e2)) && (c2 = s2.time, v.l("".concat(this._n, ".getHistoryMessages convID:").concat(t2, " isRelayInfoExisted:").concat(r2, " lastMessageTime:").concat(c2)))), (n2 = this.get(6)).getRoamingMessage({ conversationID: t2, peerAccount: t2.replace(R.CONV_C2C, ""), count: a2, lastMessageTime: i2 ? c2 : 0, messageKey: i2 ? o2 : "" }); if (Ot(t2)) { if (!(n2 = this.get(7))) return C({ code: T.NO_MODULE }); var s2 = t2.replace(R.CONV_GROUP, ""), r2 = null, c2 = (this._convMap.has(t2) && !Rt(s2) && (r2 = this._convMap.get(t2).lastMessage), 0); return e2 ? c2 = Number(e2) : r2 && (c2 = r2.lastSequence), n2.getRoamingMessage({ conversationID: t2, groupID: s2, count: a2, sequence: c2 }); } return kn(); } }, { 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, !(Je(t2) || Je(n2) || o2) || 0 !== (t2 = this._msgListHandler.getLocalMsgList(e2)).length && (n2 = t2[t2.length - 1], v.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, u2 = !(2 < arguments.length && void 0 !== arguments[2]) || arguments[2], l2 = 3 < arguments.length ? arguments[3] : void 0, i2 = o2.startsWith(R.CONV_C2C) ? R.CONV_C2C : R.CONV_GROUP, a2 = null, s2 = [], o2 = [], r2 = 0, d2 = n2.length, c2 = i2 === R.CONV_GROUP, p2 = this.getFileDownloadProxy(), _2 = this.getDowloadFileAuthKey(), h2 = nt(l2), g2 = this.get(17).getFileDNList(), f2 = function() { c2 ? --r2 : ++r2; }, m2 = function() { return c2 ? d2 <= r2 : r2 < d2; }, r2 = c2 ? n2.length - 1 : 0, d2 = c2 ? 0 : n2.length; m2(); f2()) 1 !== n2[r2].isPlaceMessage && ((a2 = new Ro(n2[r2])).to = n2[r2].to, i2 !== R.CONV_GROUP || A(n2[r2].topicID) || (a2.to = n2[r2].topicID), a2.isSystemMessage = !!n2[r2].isSystemMessage, a2.conversationType = i2, e2 = 4 === n2[r2].event ? { type: R.MSG_GRP_TIP, content: y(y({}, n2[r2].elements), {}, { groupProfile: n2[r2].groupProfile }) } : n2[r2].elements, c2 || a2.setNickAndAvatar({ nick: n2[r2].nick, avatar: n2[r2].avatar }), Je(e2) ? ((t2 = new M("emptyMessageBody")).setMessage("from:".concat(a2.from, " to:").concat(a2.to, " sequence:").concat(a2.sequence, " event:").concat(n2[r2].event)), t2.setLevel("warning").end()) : (a2.setElement(e2, p2, _2, g2), a2.reInitialize(this.getMyUserID()), s2.push(a2), h2 && l2.push(a2))); return f2 = m2 = null, u2 ? (this._msgListHandler.unshift(s2, o2), s2 = null, o2) : (o2 = null, s2); } }, { key: "findMessage", value: function(e2) { return this._msgListHandler.findMessage(e2); } }, { key: "_isMeInCommunity", value: function(e2) { var t2 = true; return this._isTopicConv(e2) && (e2 = Kt(e2.replace(R.CONV_GROUP, "")), this.get(7).hasLocalGroup(e2) || (t2 = false, v.l("".concat(this._n, "._isMeInCommunity groupID:").concat(e2, " ret:").concat(t2)))), t2; } }, { key: "deleteTopicRoamingInfo", value: function(e2) { var t2 = this; kt({ groupID: e2 }) && this._msgListHandler.getTopicConvIDList(e2).forEach(function(e3) { t2.clearMemMsg(e3); }); } }, { key: "deleteGroupRoamingInfo", value: function(e2) { e2 = "".concat(R.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 (v.l("".concat(e2, " convID:").concat(t2, " unreadCount:").concat(n2 ? n2.unreadCount : 0)), !n2) return kn(); if (n2.type !== R.CONV_GROUP && n2.type !== R.CONV_TOPIC || Je(n2.groupAtInfoList) || this.deleteGroupAtTips(t2), 0 === n2.unreadCount) return kn(); var o2 = this._msgListHandler.getLocalLastMsg(t2), i2 = n2.lastMessage.lastTime, a2 = this._msgListHandler.getLocalMaxTime(t2), a2 = (i2 < a2 && (v.l("".concat(e2, " update lastMessageTime from ").concat(i2, " to ").concat(a2)), i2 = a2), this._msgListHandler.getLocalMaxSeq(t2)), s2 = n2.lastMessage.lastSequence, r2 = (s2 < a2 && (v.l("".concat(e2, " update lastMessageSeq from ").concat(s2, " to ").concat(a2)), s2 = a2), n2.type === R.CONV_TOPIC && A(o2) && (e2 = this.get(10), o2 = Kt(a2 = t2.replace(R.CONV_GROUP, "")), (e2 = e2.getLocalTopic(o2, a2)) && (s2 = e2.nextMessageSeq - 1)), null); switch (n2.type) { case R.CONV_C2C: return (r2 = this.get(6)) ? r2.setMessageRead({ conversationID: t2, lastMessageTime: i2 }) : C({ code: T.NO_MODULE }); case R.CONV_GROUP: case R.CONV_TOPIC: return (r2 = this.get(7)) ? r2.setMessageRead({ conversationID: t2, lastMessageSeq: s2 }) : C({ code: T.NO_MODULE }); case R.CONV_SYSTEM: return n2.unreadCount = 0, this.emitConvUpdate(true, false), kn(); default: return kn(); } } }, { key: "setAllMessageRead", value: function() { var t2 = this, n2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, e2 = "setAllMessageRead", o2 = "".concat(this._n, ".").concat(e2), i2 = (n2.scope || (n2.scope = R.READ_ALL_MSG), v.l("".concat(o2, " options:"), n2), this._createSetAllMessageReadPack(n2)); if (0 === i2.readAllC2CMessage && 0 === i2.groupMessageReadInfoList.length) return kn(); var a2 = new M(e2); return this.req({ P: I.SET_ALL_MSG_READ, data: i2 }).then(function(e3) { e3 = e3.data, e3 = t2._handleAllMsgRead(e3); return a2.setMessage("scope:".concat(n2.scope, " failureGroups:").concat(JSON.stringify(e3))).end(), kn(); }).catch(function(e3) { return a2.setError(e3).end(), v.w("".concat(o2, " failed. error:"), e3), C({ code: e3 && e3.code ? e3.code : T.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 = N(this._convMap); try { for (i2.s(); !(t2 = i2.n()).done; ) { var a2, s2 = m(t2.value, 2)[1]; if (0 < s2.unreadCount) if (s2.type === R.CONV_C2C && 0 === n2.readAllC2CMessage) { if (o2 === R.READ_ALL_MSG) n2.readAllC2CMessage = 1; else if (o2 === R.READ_ALL_C2C_MSG) { n2.readAllC2CMessage = 1; break; } } else s2.type !== R.CONV_GROUP || o2 !== R.READ_ALL_GROUP_MSG && o2 !== R.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; A(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(l2) { var e2, d2 = l2.readAllC2CMessage, t2 = 0, n2 = N(this._convMap); try { for (n2.s(); !(e2 = n2.n()).done; ) { var o2, i2, a2, s2, r2 = m(e2.value, 2), c2 = r2[0], u2 = r2[1]; 1 <= u2.unreadCount && (1 === d2 && u2.type === R.CONV_C2C ? (o2 = this._getConvLastMessageTime(u2), this.updateIsReadAfterReadReport({ conversationID: c2, lastMessageTime: o2 })) : u2.type === R.CONV_GROUP && (i2 = c2.replace(R.CONV_GROUP, ""), this._remoteGroupReadSeqMap.has(i2) && (a2 = this._remoteGroupReadSeqMap.get(i2), s2 = this._getConvLastMessageSeq(u2), this.updateIsReadAfterReadReport({ conversationID: c2, remoteReadSequence: a2 }), a2 <= s2 && this._remoteGroupReadSeqMap.delete(i2))), this.updateUnreadCount(c2, false) && (t2 += 1)); } } catch (e3) { n2.e(e3); } finally { n2.f(); } return t2; } }, { key: "isRemoteRead", value: function(e2) { var t2, n2 = e2.conversationID, e2 = e2.sequence, o2 = n2.replace(R.CONV_GROUP, ""), i2 = false; return this._remoteGroupReadSeqMap.has(o2) && (e2 <= (t2 = this._remoteGroupReadSeqMap.get(o2)) && (i2 = true, v.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, v.l("".concat(this._n, ".updateUnreadCount from ").concat(t2, " to ").concat(a2, ", convID:").concat(e2)), true === n2 && this.emitConvUpdate(true, false)), o2 && i2.type === R.CONV_TOPIC && (t2 = i2.unreadCount, a2 = this.get(10), n2 = e2.replace(R.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(), v.l("".concat(this._n, ".clearGroupAtInfoList convID:").concat(e2)), o2.type === R.CONV_TOPIC && (o2 = o2.groupAtInfoList, t2 = this.get(10), e2 = e2.replace(R.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; Je(t2) || (a2 = [], A(i2) ? A(c2) || (s2 = "".concat(R.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 && (Qe(i3) && (n2.readReceiptInfo.readCount = i3, o3.readCount = i3), Qe(e3) && (n2.readReceiptInfo.unreadCount = e3, o3.unreadCount = e3), a2.push(o3)); })) : (o2 = "".concat(R.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(G.MESSAGE_READ_RECEIPT_RECEIVED, a2)); } }, { key: "updateIsRead", value: function(e2) { var t2 = this.getLocalConversation(e2), n2 = this.getLocalMessageList(e2); if (t2 && 0 !== n2.length && !Nt(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 === R.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 = this, n2 = "".concat(this._n, ".deleteGroupAtTips"), o2 = (v.l("".concat(n2)), this._convMap.get(e2)); if (!o2) return Promise.resolve(); var i2 = o2.groupAtInfoList; if (0 === i2.length) return Promise.resolve(); var o2 = void 0, a2 = (e2.startsWith(R.CONV_GROUP) && (o2 = e2.replace(R.CONV_GROUP, "")), D(i2)); if ((kt({ groupID: o2 }) || Rt(o2)) && 0 === (a2 = i2.filter(function(e3) { return !e3.atTypeArray.includes(R.CONV_AT_ALL); })).length) return this.clearGroupAtInfoList(e2, false), Promise.resolve(); var s2 = this.getMyUserID(); return this.req({ P: I.DEL_GROUP_AT_TIPS, data: { messageListToDelete: a2.map(function(e3) { return { from: e3.from, to: s2, messageSeq: e3.__sequence, messageRandom: e3.__random, groupID: A(e3.topicID) ? e3.groupID : e3.topicID }; }) } }).then(function() { return v.l("".concat(n2, " ok. count:").concat(i2.length)), t2.clearGroupAtInfoList(e2, false), Promise.resolve(); }).catch(function(e3) { return v.e("".concat(n2, " failed. error:"), e3), C(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(R.CONV_C2C) && 0 < t2 && (0 < (n2 = this._msgListHandler.updateMsgIsPeerReadProp(e2, t2)).length && this.emitOEvt(G.MESSAGE_READ_BY_PEER, n2), this._convMap.has(e2) && (Je(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) { v.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)); if (v.l("".concat(i2, ". ").concat(e2)), this._pagingStatus === bn) return (n2 = new M("getConvList")).setMessage(e2), this.syncConvList().then(function() { n2.end(); var e3 = o2._getConvList(t2); return Sn({ conversationList: e3, isSyncCompleted: o2._isSyncCompleted() }); }).catch(function(e3) { return n2.setError(e3).end(), v.e("".concat(i2, " failed. error:"), e3), C(e3); }); e2 = this._getConvList(t2); return v.l("".concat(i2, ". returned conversation count:").concat(e2.length)), kn({ conversationList: e2, isSyncCompleted: this._isSyncCompleted() }); } }, { key: "_getConvList", value: function(t2) { var n2, o2, i2, a2, s2, r2 = this; return A(t2) ? this.getLocalConvList() : nt(t2) ? 0 === t2.length ? [] : this.getLocalConvList().filter(function(e2) { return t2.includes(e2.conversationID); }) : et(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 !== R.CONV_C2C && t2 !== R.CONV_GROUP || e2.type === t2; } }, { key: "_filterGroupName", value: function(e2, t2) { return !ft(t2) || ("" === t2 ? 0 === e2.conversationGroupList.length : e2.conversationGroupList.includes(t2)); } }, { key: "_filterMarkType", value: function(e2, t2) { return !Qe(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 = N(this._convMap); try { for (t2.s(); !(e2 = t2.n()).done; ) { var n2 = m(e2.value, 2), o2 = n2[0], i2 = n2[1]; i2.type === R.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(R.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 di({ conversationID: o2, type: At(o2) ? R.CONV_C2C : R.CONV_GROUP }, this.isIntl(), this.isUsingChatCore()), s2 = true), i2._isInfoCompleted || i2.type === R.CONV_SYSTEM) return kn({ conversation: i2 }); if (Ot(o2)) { if (!this.get(7)) return C({ code: T.NO_MODULE }); if (!this._hasLocalGroup(o2)) return kn({ conversation: i2 }); } var r2 = "".concat(this._n, ".").concat("getConversationProfile"), c2 = new M("getConversationProfile"); return v.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 === R.CONV_C2C && (t2 = o2.replace(R.CONV_C2C, ""), n2.isMyFriend(t2) && (n2 = n2.getFriendRemark(t2), i2.remark !== n2 && (i2.remark = n2, v.l("".concat(r2, ". convID:").concat(o2, " patch remark:").concat(i2.remark))))), v.l("".concat(r2, " ok. isNewConv:").concat(s2, " convID:").concat(o2)), s2) { if (i2.type === R.CONV_C2C) return a2._onNewC2CConv([o2.replace(R.CONV_C2C, "")]).then(function() { return kn({ conversation: i2 }); }); if (i2.type === R.CONV_GROUP) return a2._onNewGroupConv([o2.replace(R.CONV_GROUP, "")]).then(function() { return kn({ conversation: i2 }); }); } return e2; }).catch(function(e2) { return c2.setError(e2).setMessage("convID:".concat(o2)).end(), v.e("".concat(r2, " failed. error:"), e2), C(e2); }); } }, { key: "_getUserOrGroupProfile", value: function(t2) { var n2 = this; return t2.type === R.CONV_C2C ? this.get(4).getUserProfile({ userIDList: [t2.toAccount] }).then(function(e2) { e2 = e2.data; return 0 === e2.length ? C({ code: T.USER_OR_GRP_NOT_FOUND }) : (t2.userProfile = e2[0], t2._isInfoCompleted = true, n2._insertConvAfterTopmost(t2), kn({ conversation: t2 })); }) : this.get(7).getGroupProfile({ groupID: t2.toAccount }).then(function(e2) { return t2.groupProfile = e2.data.group, t2._isInfoCompleted = true, n2._insertConvAfterTopmost(t2), kn({ conversation: t2 }); }); } }, { key: "_insertConvAfterTopmost", value: function(e2) { var t2, n2; e2 instanceof di && !this._convMap.has(e2.conversationID) && (n2 = (t2 = D(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(R.CONV_C2C).concat(t2))) && (t2.userProfile = e3); }); } }, { key: "_onCloudConfig", value: function(e2) { "0" === this.getCloudConfig("pull_on_invite") && (this._bPullOnInvite = false), v.l("".concat(this._n, "._onCloudConfig bPullOnInvite:").concat(this._bPullOnInvite)); } }, { key: "disableMsgPullOnInvite", value: function() { this._bPullOnInvite = false; } }, { key: "_isSyncCompleted", value: function() { return this._pagingStatus === Un; } }, { key: "_errorLog", value: function(e2, t2, n2, o2) { var i2 = new Error("Params validate failed."), a2 = "".concat(this.getErrMsg("API_REFER")).concat(e2); throw v.w("[".concat(e2, "] | ").concat(t2, " | ").concat(this.getErrMsg(n2, o2), ", ").concat(a2)), v.e("[".concat(e2, "] Invalid ").concat(t2, ": type check failed for ").concat(t2, ".")), i2; } }, { key: "_isValidConvID", value: function(e2) { return At(e2) || Ot(e2) || Nt(e2); } }, { key: "deleteConversation", value: function(e2) { var t2 = this, n2 = "deleteConversation"; return ft(e2) || $e(e2) || this._errorLog(n2, "options", "StringOrObjectRequiredLog"), ft(e2) ? (this._isValidConvID(e2) || this._errorLog(n2, "options", "InvalidConversationID", e2), v.l("".concat(this._n, ".").concat(n2, " convID:").concat(e2)), this.deleteConvList({ conversationIDList: [e2], flag: 1 })) : (nt(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 = (v.l("".concat(i2, " ").concat(e2)), new M("deleteConvList")); return a2.setMessage(e2), Promise.all([this.rmLocalOnlyConvList(t2), this.rmLocalAndRemoteConvList(t2, n2)]).then(function(e3) { a2.end(); e3 = [].concat(D(e3[0]), D(e3[1])); return 0 === e3.length ? C(new Bn({ code: T.CONV_NOT_FOUND })) : (v.l("".concat(i2, " ok")), kn(1 === o2 ? { conversationID: e3[0] } : { conversationIDList: e3 })); }).catch(function(e3) { return a2.setError(e3).end(), v.e("".concat(i2, " failed. error:"), e3), C(e3); }); } }, { key: "rmLocalOnlyConvList", value: function(e2) { var n2 = this; return e2.filter(function(e3) { if (!n2._convMap.has(e3)) return false; var t2 = n2.getLocalConversation(e3).type; return t2 !== R.CONV_GROUP || n2._hasLocalGroup(e3) ? t2 === R.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) === R.CONV_C2C ? o2.conversationList.push({ toAccount: e3.replace(t3, ""), type: 1 }) : t3 === R.CONV_GROUP && n2._hasLocalGroup(e3) && o2.conversationList.push({ toGroupID: e3.replace(t3, ""), type: 2 })); }), 0 === o2.conversationList.length ? [] : this.req({ P: I.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(R.CONV_C2C).concat(e4.to) : "".concat(R.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"); if (v.l("".concat(n2, " convID:").concat(t2, " draftText:").concat(e2)), !this._convMap.has(t2)) return C({ code: T.CONV_NOT_FOUND }); n2 = this._convMap.get(t2); return n2.setDraftText(e2), this.emitConvUpdate(), kn({ code: 0, conversation: n2 }); } }, { 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 C({ code: T.CONV_NOT_FOUND }); var o2 = this._convMap.get(t2).type; if (o2 === R.CONV_C2C) e2.type = 1, e2.toAccount = t2.replace(R.CONV_C2C, ""); else { if (o2 !== R.CONV_GROUP) return o2 === R.CONV_SYSTEM ? (this.get(7).deleteGroupSystemNotice({ messageList: this._msgListHandler.getLocalMsgList(t2) }), kn({ conversationID: t2 })) : C({ code: T.CONV_UN_RECORDED_TYPE }); e2.type = 2, e2.toGroupID = t2.replace(R.CONV_GROUP, ""); } var i2 = "".concat(this._n, ".").concat("clearHistoryMessage"), a2 = new M("clearHistoryMessage"); return a2.setMessage("convID:".concat(t2)), v.l("".concat(i2, ". convID:").concat(t2)), this.setMessageRead({ conversationID: t2 }).then(function() { return n2.req({ P: I.CLEAR_HISTORY_MSG, data: e2 }); }).then(function() { a2.end(), v.l("".concat(i2, " ok")), n2.clearMemMsg(t2); var e3 = n2.getLocalConversation(t2); return e3 && (e3.updateLastMessage(), n2._sortConvListAndEmitEvent()), kn({ conversationID: t2 }); }).catch(function(e3) { return a2.setError(e3).end(), v.e("".concat(i2, " failed. error:"), e3), C(e3); }); } }, { key: "pinConversation", value: function(e2) { var t2 = this, n2 = e2.conversationID, o2 = e2.isPinned, i2 = this.getLocalConversation(n2); if (i2 && i2.isPinned === o2) return kn({ conversationID: n2 }); if (Nt(n2)) return i2 && (i2.isPinned = o2), this._sortConvListAndEmitEvent(), kn({ conversationID: n2 }); e2 = null; if (At(n2) ? e2 = { type: 1, toAccount: n2.replace(R.CONV_C2C, "") } : Ot(n2) && (e2 = { type: 2, groupID: n2.replace(R.CONV_GROUP, "") }), null === e2) return C({ code: T.INVALID_CONV_ID }); var a2 = "".concat(this._n, ".").concat("pinConversation"), s2 = "convID:".concat(n2, " isPinned:").concat(o2), r2 = new M("pinConversation"); return r2.setMessage(s2), v.l("".concat(a2, ". ").concat(s2)), this.req({ P: I.PIN_CONV, data: { fromAccount: this.getMyUserID(), operationType: true === o2 ? 1 : 2, itemList: [e2] } }).then(function() { return r2.end(), v.l("".concat(a2, " ok")), i2 ? i2.isPinned !== o2 && (i2.isPinned = o2) : t2._convMap.set(n2, new di({ conversationID: n2, type: At(n2) ? R.CONV_C2C : R.CONV_GROUP, isPinned: o2 }, t2.isIntl(), t2.isUsingChatCore())), t2._sortConvListAndEmitEvent(), Sn({ conversationID: n2 }); }).catch(function(e3) { return r2.setError(e3).end(), v.e("".concat(a2, " failed. error:"), e3), C(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 ? R.CONV_C2C : R.CONV_GROUP).concat(t2)); return n2 && n2.messageRemindType !== o2 && (n2.messageRemindType = o2, i2 = true), v.l("".concat(this._n, ".patchMsgRemindType options:"), e2, "ret:".concat(i2)), i2; } }, { key: "onC2CMsgRemindTypeFetched", value: function(e2) { var n2, o2 = this; nt(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); }), v.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; Je(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), v.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); v.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"), v.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(R.CONV_GROUP, "")), v.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, D(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; }), v.l("".concat(this._n, "._emitMsgReceived convID:").concat(e2, " has:").concat(n2, " count:").concat(o2.length, " sequenceList:"), o2), this.emitOEvt(G.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); }), v.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(R.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 }), v.l("".concat(this._n, ".modifyMessageList convID:").concat(e2, " cost:").concat(Qt(t2)))); } }, { key: "updateUserProfileSpecifiedKey", value: function(e2) { v.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, ft(n2) && t2.nick !== n2 && (t2.nick = n2), ft(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)); }), v.l("".concat(this._n, "._onMyProfileModified. modify all messages sent by me, cost:").concat(Qt(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 = D(this._convMap.values()).filter(function(e3) { return e3.type === R.CONV_C2C; })).length && (n2 = 0, e2.forEach(function(e3) { var t2 = e3.conversationID.replace(R.CONV_C2C, ""); o2.isMyFriend(t2) && (t2 = o2.getFriendRemark(t2), e3.remark !== t2 && (e3.remark = t2, n2 += 1)); }), v.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 === R.CONV_C2C ? n2 = this._m.get(6) : t2.conversationType === R.CONV_GROUP && (n2 = this._m.get(7)), n2 ? n2.sendReadReceipt(e2) : C({ code: T.NO_MODULE }); } }, { key: "getReadReceiptList", value: function(e2) { var t2 = e2[0], n2 = null; return t2.conversationType === R.CONV_C2C ? n2 = this._m.get(6) : t2.conversationType === R.CONV_GROUP && (n2 = this._m.get(7)), n2 ? n2.getReadReceiptList(e2) : C({ code: T.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 !== R.CONV_SYSTEM && ("" !== e3.messageRemindType && e3.messageRemindType !== R.MSG_REMIND_ACPT_AND_NOTE || (t2 += e3.unreadCount)); }), t2; } }, { key: "onTotalUnreadCountUpdate", value: function() { var e2 = this.getTotalUnreadCount(); this._convTotalUnreadCount !== e2 && (v.l("".concat(this._n, ".onTotalUnreadCountUpdate from ").concat(this._convTotalUnreadCount, " to ").concat(e2)), this._convTotalUnreadCount = e2, this.emitOEvt(G.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)); } }, { key: "_isConvNeedShow", value: function(e2) { e2 = this.getLocalConversation(e2); if (A(e2)) return true; var t2 = e2.type === R.CONV_TOPIC, n2 = e2.type === R.CONV_GROUP && e2.groupProfile.type === R.GRP_ROOM, e2 = e2.type === R.CONV_GROUP && e2.groupProfile.type === R.GRP_LIVE; return !(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]; v.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() { v.l("".concat(this._n, ".reset")), this._setStorageConvList(true), this._pagingStatus = Gn, 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(); } }]), ia), fi = (e(oa, [{ 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); v.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) { v.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(G.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(l2) { for (var e2 = l2.event, d2 = l2.dataList, t2 = null, n2 = [], p2 = [], _2 = {}, h2 = [], g2 = 0, f2 = d2.length; g2 < f2; g2++) { var o2 = ht(d2[g2]); if (6 === e2) { if (this._grpM.isGroupAttributesUpdatedNotice(o2)) continue; if (this._grpM.isGroupCountersNotice(o2)) continue; } var i2 = o2.groupProfile, m2 = i2.groupID, a2 = i2.communityType, a2 = void 0 === a2 ? 0 : a2, s2 = i2.topicID, s2 = void 0 === s2 ? void 0 : s2, r2 = i2.invisible, i2 = i2.groupType, i2 = void 0 === i2 ? void 0 : i2, v2 = void 0, c2 = this._grpM.isMessageFromTopic(a2, s2), u2 = (c2 && (v2 = R.CONV_TOPIC, o2.to = s2), this._grpM.hasLocalGroup(m2)); if (u2 || !this._grpM.isUnjoinedAVChatRoom(m2)) if (u2 || c2) if (this._grpM.isMessageFromOrToAVChatroom(m2)) o2.event = e2, h2.push(o2); else if (o2.currentUser = this._grpM.getMyUserID(), o2.conversationType = R.CONV_GROUP, (t2 = new Ro(o2)).setElement({ type: R.MSG_GRP_TIP, content: y(y({}, o2.elements), {}, { groupProfile: o2.groupProfile }) }), t2.isSystemMessage = false, 1 !== r2) { var u2 = this._grpM.get(11), c2 = t2, r2 = c2.conversationID, c2 = c2.sequence; if (6 === e2) t2._onlineOnlyFlag = true, p2.push(t2); else if (!u2.pushIntoNoticeResult(p2, t2)) continue; this._grpM.isMessageFromCommunityOfTopic(a2, s2) || 6 === e2 && u2.getLocalConversation(r2) || (6 !== e2 && this._qualityStat(t2), a2 = u2.isRemoteRead({ conversationID: r2, sequence: c2 }), A(_2[r2]) ? (s2 = 0, "in" === t2.flow && (t2._isExcludedFromUnreadCount || t2._onlineOnlyFlag || a2 || (s2 = 1)), _2[r2] = n2.push({ conversationID: r2, unreadCount: s2, type: A(v2) ? t2.conversationType : v2, subType: t2.conversationSubType, lastMessage: t2._isExcludedFromLastMessage ? "" : t2 }) - 1) : (n2[u2 = _2[r2]].type = t2.conversationType, n2[u2].subType = t2.conversationSubType, n2[u2].lastMessage = t2._isExcludedFromLastMessage ? "" : t2, "in" === t2.flow && (t2._isExcludedFromUnreadCount || t2._onlineOnlyFlag || a2 || n2[u2].unreadCount++))); } else this._qualityStat(t2); else this._cacheAndCompare({ groupID: m2, event: e2, item: o2, groupType: i2 }); } return { eventDataList: n2, result: p2, AVChatRoomMessageList: h2 }; } }, { key: "_qualityStat", value: function(e2) { this._grpM.get(26).addMessageSequence({ key: Qn, 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: v.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 && Qe(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 && Qe(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 && Qe(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(R.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(R.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]; } }), A(i2) || Object.keys(i2).forEach(function(e3) { var t3; "nameCard" === e3 ? a2.updateSelfInfo({ nameCard: i2[e3] }) : "role" === e3 && (t3 = "", 400 === i2[e3] ? t3 = R.GRP_MBR_ROLE_OWNER : 300 === i2[e3] ? t3 = R.GRP_MBR_ROLE_ADMIN : 200 === i2[e3] && (t3 = R.GRP_MBR_ROLE_MEMBER), a2.updateSelfInfo({ role: t3 })); }), !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: R.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(R.GRP_MBR_ROLE_OWNER), t2 && t2.updateRole(R.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 = (Rt(t2) && this._updateTopicMuteTime(e2), this._grpM.getGroupMemberHandler()); n2.forEach(function(e3) { var t3 = a2.getLocalGroupMemberInfo(i2, e3.userID); t3 && Qe(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(G.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) || []; v.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 = (v.l("".concat(this._n, "._cacheAndCompare groupID:").concat(t2, " groupType:").concat(e2)), this._cacheGroupTips(t2, { event: n2, dataList: [o2] }), { groupID: t2, type: e2 }); e2 === R.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(); } }]), oa), mi = (e(na, [{ 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); v.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 === R.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))); v.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), Dt(o2)), t2 = (0 < t2.length && this._grpM.emitOEvt(G.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)), Lt(o2)); 0 < t2.length && this._grpM.emitOEvt(G.MESSAGE_RECEIVED, t2), o2.length = 0; } }, { key: "_assembly", value: function(l2) { var d2 = l2.dataList, p2 = l2.event, _2 = l2.isInstantMessage, e2 = null, t2 = [], h2 = [], g2 = [], f2 = {}, m2 = this._grpM.getFileDownloadProxy(), v2 = this._grpM.getDowloadFileAuthKey(), I2 = this._grpM.get(17).getFileDNList(), M2 = d2.length; 1 < M2 && d2.sort(function(e3, t3) { return e3.sequence - t3.sequence; }); for (var n2 = this._grpM.get(11), y2 = this._grpM.get(4), C2 = 0; C2 < M2; C2++) { var o2, i2 = ht(d2[C2]), a2 = i2.groupProfile, T2 = a2.groupID, s2 = a2.communityType, s2 = void 0 === s2 ? 0 : s2, r2 = a2.topicID, r2 = void 0 === r2 ? void 0 : r2, D2 = a2.invisible, a2 = a2.groupType, a2 = void 0 === a2 ? void 0 : a2, E2 = void 0, c2 = this._grpM.isMessageFromTopic(s2, r2), u2 = (c2 && (E2 = R.CONV_TOPIC, i2.to = r2), this._grpM.hasLocalGroup(T2)); !u2 && this._grpM.isUnjoinedAVChatRoom(T2) || (u2 || c2 ? this._grpM.isMessageFromOrToAVChatroom(T2) ? (i2.event = p2, g2.push(i2)) : (i2.currentUser = this._grpM.getMyUserID(), i2.conversationType = R.CONV_GROUP, i2.isSystemMessage = !!i2.isSystemMessage, (e2 = new Ro(i2)).setElement(i2.elements, m2, v2, I2), 1 !== D2 ? (u2 = 1 === d2[C2].isModified, n2.isMessageSentByCurrentInstance(e2) ? e2.isModified = u2 : u2 = false, 1 === i2.onlineOnlyFlag ? (e2._onlineOnlyFlag = true, n2.isMessageSentByCurrentInstance(e2) || h2.push(e2)) : this._grpM.isMessageFromCommunityOfTopic(s2, r2) ? h2.push(e2) : (e2.from !== this._grpM.getMyUserID() || (c2 = n2.getLatestMessageSentByMe(e2.conversationID)) && (D2 = c2.nick, s2 = c2.avatar, D2 === e2.nick && s2 === e2.avatar || (n2.modifyMessageSentByMe({ conversationID: o2, latestNick: e2.nick, latestAvatar: e2.avatar }), y2.mockOnNickAvatarModified(e2.nick, e2.avatar))), n2.pushIntoMessageList(h2, e2, u2) && (this._qualityStat(_2, e2), o2 = (r2 = e2).conversationID, c2 = r2.sequence, D2 = n2.isRemoteRead({ conversationID: o2, sequence: c2 }), A(f2[o2]) ? (s2 = 0, "in" === e2.flow && (e2._isExcludedFromUnreadCount || D2 || (s2 = 1)), f2[o2] = t2.push({ conversationID: o2, unreadCount: s2, type: A(E2) ? e2.conversationType : E2, subType: e2.conversationSubType, lastMessage: e2._isExcludedFromLastMessage ? "" : e2 }) - 1) : (t2[u2 = f2[o2]].type = A(E2) ? e2.conversationType : E2, t2[u2].subType = e2.conversationSubType, t2[u2].lastMessage = e2._isExcludedFromLastMessage ? "" : e2, "in" === e2.flow && (e2._isExcludedFromUnreadCount || D2 || t2[u2].unreadCount++))))) : this._qualityStat(_2, e2)) : this._cacheAndCompare({ groupID: T2, event: p2, item: i2, groupType: a2 })); } return { conversationOptionsList: t2, messageList: h2, AVChatRoomMessageList: g2 }; } }, { key: "_qualityStat", value: function(e2, t2) { var n2 = this._grpM.get(26); n2.addMessageSequence({ key: Qn, 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 = kt({ groupID: r2.groupID }) || !Je(r2.topicID)), A(t3) || t3.forEach(function(e4) { var t4, n3 = Je(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 && St(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.push(t4)) : d2.push(t4)); }); }), 0 === d2.length && 0 === l2.length || (u2.onMessageRevoked([].concat(l2, d2), t2), 0 < l2.length && this._grpM.emitOEvt(G.MESSAGE_REVOKED, l2), 0 < d2.length && u2.updateRevokerInfo(d2).then(function(e3) { n2._grpM.emitOEvt(G.MESSAGE_REVOKED, e3); })); } }, { key: "_groupListTreeShaking", value: function(e2) { for (var n2 = new Map(D(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 = D(n2.keys()), a2 = 0, s2 = i2.length; a2 < s2; a2++) this._grpM.deleteGroup(i2[a2]); } }, { key: "syncGroupList", value: function() { var o2 = this, e2 = 0 < arguments.length && void 0 !== arguments[0] && arguments[0], t2 = (this._pagingStatus === Gn && this._grpM.clearGroupMap(), D(K)), n2 = this.PAGING_GRP_COUNT_LIMIT, i2 = []; if (true === e2) return this._pagingGetGroupListWithTopic({ limit: n2, offset: 0, groupBaseInfoFilter: t2, groupList: i2 }); var e2 = "syncGroupList", a2 = "".concat(this._n, ".").concat(e2), s2 = new M(e2); return this._pagingGetGroupList({ limit: n2, offset: 0, groupBaseInfoFilter: t2, groupList: i2 }).then(function() { var e3 = Zt(o2._pagingGetCostList), t3 = Xt(o2._pagingGetCostList), n3 = (o2._pagingGetCostList.length = 0, o2._pagingStatus = Un, o2._groupListTreeShaking(i2), o2._grpM.updateGroupMap(i2), o2._grpM.getLocalGroupList().length), n3 = "count:".concat(n3, " sum:").concat(t3, " avg:").concat(e3); return v.l("".concat(a2, " ok. ").concat(n3)), s2.setMessage(n3).end(), o2.tempConversationList && (o2.updateLastMsg(o2.tempConversationList), o2.tempConversationList = null), o2._grpM.emitGroupListUpdate(true, true), Sn({ groupList: o2._grpM.getLocalGroupList() }); }).catch(function(e3) { return o2._pagingStatus = bn, s2.setError(e3).end(), v.e("".concat(a2, " failed. error:"), e3), C(e3); }); } }, { key: "getGroupList", value: function() { var t2 = this, n2 = "".concat(this._n, ".").concat("getGroupList"); if (v.l("".concat(n2, " pagingStatus:").concat(this._pagingStatus)), this._pagingStatus === bn || this._pagingStatus === Gn) return this.syncGroupList().then(function() { var e3 = t2._grpM.getLocalGroupList(); return Sn({ groupList: e3, isSyncCompleted: t2.isPagingGetCompleted() }); }).catch(function(e3) { return v.e("".concat(n2, " failed. error:"), e3), C(e3); }); var e2 = this._grpM.getLocalGroupList(); return v.l("".concat(n2, ". returned group count:").concat(e2.length)), kn({ groupList: e2, isSyncCompleted: this.isPagingGetCompleted() }); } }, { key: "isPagingGetCompleted", value: function() { return this._pagingStatus === Un; } }, { 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: I.GET_GRP_LIST, data: { type: a2 ? R.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, D(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(Qt(l2, false)), v.l("".concat(i2, " ok. ").concat(e3, " cost:").concat(Qt(l2))), a2 || n2 ? !a2 && n2 ? (v.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 })) : Sn({ groupList: u2 }) : (r2 = t3, o2._pagingGetGroupList({ limit: s2, offset: r2, groupBaseInfoFilter: c2, groupList: u2 })); }).catch(function(e3) { return 10018 === e3.code ? (v.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 && v.l("".concat(i2, " ok. community unavailable")), kn({ groupList: u2 })) : C(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: I.GET_GRP_LIST, data: { type: R.GRP_COMMUNITY, memberAccount: this._grpM.getMyUserID(), limit: a2, offset: s2, responseFilter: { groupBaseInfoFilter: r2, selfInfoFilter: D(Y) }, isSupportTopic: 1, needAppDefineData: 1 } }).then(function(e3) { var e3 = e3.data, t2 = e3.groups, e3 = e3.totalCount, t2 = (c2.push.apply(c2, D(void 0 === t2 ? [] : t2)), s2 + a2), n2 = !(t2 < e3); if (v.l("".concat(i2, " ok. offset:").concat(s2, " limit:").concat(a2, " totalCount:").concat(e3, " isCompleted:").concat(n2, " currentCount:").concat(c2.length, " cost:").concat(Qt(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 Sn({ groupList: e3 }); }).catch(function(e3) { return 10018 === e3.code ? (v.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 })) : C(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) || []; v.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 = (v.l("".concat(this._n, "._cacheAndCompare groupID:").concat(t2, " groupType:").concat(e2)), this._cacheGroupMessage(t2, { event: n2, dataList: [o2] }), { groupID: t2, type: e2 }); e2 === R.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 = []; A(e3) || (e3.forEach(function(e4) { n2.push(y(y({}, e4), {}, { groupID: t3 })); }), o2._grpM.get(11).onNewGroupAtTips({ dataList: n2 })); }); } }, { key: "setPagingGroupCount", value: function(e2) { A(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 = Gn, this._pagingGetCostList = []; } }]), na), vi = (e(ta, [{ key: "_onCloudConfig", value: function() { var e2 = this._grpM.getCloudConfig("grp_attr_cache_time"); A(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 = !A(e2) && !Je(e2.groupAttributeOption); return n2 && this._onGroupAttributesUpdated({ groupID: t2, groupAttributeOption: e2.groupAttributeOption }), n2; } }, { key: "_onGroupAttributesUpdated", value: function(e2) { var t2 = this, n2 = e2.groupID, e2 = e2.groupAttributeOption, o2 = e2.mainSequence, i2 = e2.isWithChangedAttributeInfo, a2 = e2.groupAttributeList, a2 = void 0 === a2 ? [] : a2, e2 = e2.operationType; if (v.l("".concat(this._n, ".onGroupAttributesUpdated. ") + "groupID:".concat(n2, " isWithChangedAttributeInfo:").concat(i2, " operationType:").concat(e2)), !A(e2)) { this._groupAttributesCopy = this._getCachedAttributes({ groupID: n2 }); var s2 = o2 - this._getLocalGroupAttributes(n2).localMainSequence; if (0 != s2) { if (1 === i2 && 1 == s2) return this._refreshCachedGroupAttributes({ groupID: n2, remoteMainSequence: o2, groupAttributeList: a2, operationType: e2 }), void this._emitGroupAttributesUpdated(n2); this._hasLocalGroupAttributes(n2) && (i2 = this._getLocalGroupAttributes(n2).avChatRoomKey, this._getGroupAttributes({ groupID: n2, avChatRoomKey: i2 }).then(function() { t2._emitGroupAttributesUpdated(n2); })); } } } }, { 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 }), v.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 M("initGroupAttributes"); return a2.setMessage("groupID:".concat(o2, " avChatRoomKey:").concat(e2, " mainSequence:").concat(t2)), this._grpM.req({ P: I.SET_GRP_ATTR, data: { groupID: o2, avChatRoomKey: e2, mainSequence: t2, groupAttributeList: this._transformGroupAttributes(i2) } }).then(function(e3) { v.l("".concat(n2._n, ".").concat("initGroupAttributes", " ok. groupID:").concat(o2)); var e3 = e3.data, t3 = e3.mainSequence, e3 = D(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(), Sn({ groupAttributes: i2 }); }).catch(function(e3) { return a2.setError(e3).end(), C(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 M("setGroupAttributes")); return c2.setMessage("groupID:".concat(i2, " groupAttributes:").concat(JSON.stringify(a2))), v.l("".concat(o2, ". groupID:").concat(i2, " mainSequence:").concat(t2)), this._grpM.req({ P: I.MODIFY_GRP_ATTR, data: { groupID: i2, avChatRoomKey: s2, mainSequence: t2, groupAttributeList: e2 } }).then(function(e3) { v.l("".concat(o2, " ok.")); var e3 = e3.data, t3 = e3.mainSequence, e3 = D(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(), Sn({ groupAttributes: a2 }); }).catch(function(e3) { return c2.setError(e3).end(), C(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 = D(s2.keys()), o2 = I.CLEAR_GRP_ATTR, l2 = 3, a2 = { groupID: n2, avChatRoomKey: a2, mainSequence: i2 }, c2 = [], u2 = (0 < e2.length && (r2 = [], o2 = I.DEL_GRP_ATTR, l2 = 4, e2.forEach(function(e3) { var t3 = 0; s2.has(e3) && (t3 = s2.get(e3).sequence, r2.push(e3)), c2.push({ key: e3, sequence: t3 }); }), a2.groupAttributeList = c2), new M("deleteGroupAttributes")); return u2.setMessage("groupID:".concat(n2, " mainSequence:").concat(i2, " keyList:").concat(e2, " proto:").concat(o2)), this._grpM.req({ P: o2, data: a2 }).then(function(e3) { v.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: c2, operationType: l2 }), t2._emitGroupAttributesUpdated(n2), u2.end(), Sn({ keyList: r2 }); }).catch(function(e3) { return u2.setError(e3).end(), C(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 M("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(), v.l("".concat(o2, " from remote. groupID:").concat(i2)); e3 = n2._getCachedAttributes(t2); return Sn({ groupAttributes: e3 }); }).catch(function(e3) { return c2.setError(e3).end(), C(e3); }); c2.setMoreMessage("get attributes from cache").end(), v.l("".concat(o2, " from cache. groupID:").concat(i2)); s2 = this._getCachedAttributes(t2); return kn({ groupAttributes: s2 }); } }, { key: "_getGroupAttributes", value: function(o2) { var i2 = this, e2 = 0; return A(o2.avChatRoomKey) || (e2 = 1), this._grpM.req({ P: I.GET_GRP_ATTR, data: y(y({}, o2), {}, { groupType: e2 }) }).then(function(e3) { v.l("".concat(i2._n, "._getGroupAttributes ok. groupID:").concat(o2.groupID)); var e3 = e3.data, t2 = e3.mainSequence, e3 = e3.groupAttributeList, n2 = D(e3); return A(t2) || i2._refreshCachedGroupAttributes({ groupID: o2.groupID, remoteMainSequence: t2, groupAttributeList: n2, operationType: 5 }), e3; }).catch(function(e3) { return C(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); v.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 = N(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; v.l("".concat(this._n, "._emitGroupAttributesUpdated update:").concat(o2.length, ", delete:").concat(n2.length)), 0 === o2.length && 0 === n2.length || this._grpM.emitOEvt(G.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) { A(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; } }]), ta), Ii = (e(ea, [{ key: "_onCloudConfig", value: function() { var e2 = this._grpM.getCloudConfig("grp_counter_expire_time"); A(e2) || (this.EXPIRE_TIME = Number(e2)); } }, { key: "isGroupCountersNotice", value: function(e2) { var t2 = e2.to, e2 = e2.elements.groupCounterInfo, n2 = false; return Je(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(G.GROUP_COUNTER_UPDATED, { groupID: i2, key: e4.key, value: e4.value }); })), 1 === t2 && o2._deleteLocalGroupCounters({ groupID: i2, groupCounterSeq: n2, counterList: e3 }); }), v.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 }), v.l("".concat(this._n, ".initGroupCountersCache groupID:").concat(t2, " avChatRoomKey:").concat(e2)); } }, { key: "setGroupCounters", value: function(e2) { if (!this._grpM.canIUse(H.GRP_COUNTER)) return this._grpM.noUse("setGroupCounters"); var 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 M("setGroupCounters"); return a2.setMessage("".concat(i2)), v.l("".concat(t2, ". ").concat(i2)), this._updateGroupCounters({ groupID: n2, counterList: e2, avChatRoomKey: o2, mode: "Set" }).then(function(e3) { return a2.end(), v.l("".concat(t2, " ok.")), Sn({ counters: e3 }); }).catch(function(e3) { return a2.setError(e3).end(), v.e("".concat(t2, " failed. error:"), e3), C(e3); }); } }, { key: "increaseGroupCounter", value: function(e2) { var t2 = "increaseGroupCounter"; if (!this._grpM.canIUse(H.GRP_COUNTER)) return this._grpM.noUse(t2); var n2 = "".concat(this._n, ".").concat(t2), o2 = e2.groupID, i2 = e2.key, e2 = e2.value, a2 = this._getLocalGroupCounters(o2).avChatRoomKey, s2 = "groupID:".concat(o2, " key:").concat(i2, " value:").concat(e2), r2 = new M(t2); return r2.setMessage("".concat(s2)), v.l("".concat(n2, ". ").concat(s2)), this._updateGroupCounters({ groupID: o2, counterList: [{ key: i2, value: e2 }], avChatRoomKey: a2, mode: "Increase" }).then(function(e3) { return r2.end(), v.l("".concat(n2, " ok.")), Sn({ counters: e3 }); }).catch(function(e3) { return r2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "decreaseGroupCounter", value: function(e2) { var t2 = "decreaseGroupCounter"; if (!this._grpM.canIUse(H.GRP_COUNTER)) return this._grpM.noUse(t2); var n2 = "".concat(this._n, ".").concat(t2), o2 = e2.groupID, i2 = e2.key, e2 = e2.value, a2 = this._getLocalGroupCounters(o2).avChatRoomKey, s2 = "groupID:".concat(o2, " key:").concat(i2, " value:").concat(e2), r2 = new M(t2); return r2.setMessage("".concat(s2)), v.l("".concat(n2, ". ").concat(s2)), this._updateGroupCounters({ groupID: o2, counterList: [{ key: i2, value: e2 }], avChatRoomKey: a2, mode: "Decrease" }).then(function(e3) { return r2.end(), v.l("".concat(n2, " ok.")), Sn({ counters: e3 }); }).catch(function(e3) { return r2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "getGroupCounters", value: function(e2) { var t2 = this; if (!this._grpM.canIUse(H.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 M("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(), v.l("".concat(n2, " from remote. groupID:").concat(o2)); e3 = t2._getLocalCounters(o2, i2); return Sn({ counters: e3 }); }).catch(function(e3) { return s2.setError(e3).end(), C(e3); }); s2.setMoreMessage("from cache").end(), v.l("".concat(n2, " from cache. groupID:").concat(o2)); e2 = this._getLocalCounters(o2, i2); return kn({ counters: e2 }); } }, { key: "_getRemoteGroupCounters", value: function(n2) { var o2 = this; return this._grpM.req({ P: I.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 }), v.l("".concat(o2._n, "._getRemoteGroupCounters ok. groupID:").concat(n2.groupID)), t2; }).catch(function(e2) { return C(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 v.l("".concat(t2, ". groupID:").concat(n2, " avChatRoomKey:").concat(o2, " mode:").concat(i2)), this._grpM.req({ P: I.UPDATE_GRP_COUNTER, data: y({}, e2) }).then(function(e3) { v.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 C(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)) return n2; 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 = N(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; } }]), ea), Mi = (e($i, [{ key: "start", value: function() { var e2 = this._grpM.isLoggedIn(); e2 || (this._proto = I.AV_NOAUTH_POLLING), v.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() && (-1 < t2._timeoutID && clearTimeout(t2._timeoutID), t2._timeoutID = setTimeout(t2._request.bind(t2), t2._manager.getPollingInterval())); }).catch(function(e3) { t2._onFail(t2._groupID, e3), t2.isRunning() && (-1 < t2._timeoutID && clearTimeout(t2._timeoutID), t2._timeoutID = setTimeout(t2._request.bind(t2), t2._manager.MAX_POLLING_INTERVAL)); }); } }, { key: "stop", value: function() { v.l("".concat(this._n, ".stop")), -1 < this._timeoutID && (clearTimeout(this._timeoutID), this._timeoutID = -1), this._isRunning = false; } }, { key: "getPollingTimerID", value: function() { return this._timeoutID; } }]), $i), yi = { 3: true, 4: true, 5: true, 6: true, 17: true, 20: true, 21: true, 100: true }, Ci = (e(Qi, [{ key: "hasJoinedAVChatRoom", value: function() { var e2 = []; return 0 < (e2 = 0 < this._joinedGroupMap.size ? D(this._joinedGroupMap.values()).filter(function(e3) { return e3.type === R.GRP_AVCHATROOM; }) : e2).length; } }, { key: "getJoinedLiveList", value: function() { var e2 = []; return e2 = 0 < this._joinedGroupMap.size ? D(this._joinedGroupMap.values()).filter(function(e3) { return e3.type === R.GRP_LIVE; }) : e2; } }, { key: "checkJoinedAVChatRoomByID", value: function(e2) { return this._joinedGroupMap.has(e2); } }, { key: "getJoinedAVChatRoom", value: function() { return 0 < this._joinedGroupMap.size ? D(this._joinedGroupMap.keys()) : []; } }, { key: "_updatedata", value: function(e2) { var t2 = this._pollingRequestInfoMap.get(e2); return e2 === D(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 M("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) && (ft(i2) && Qe(a2) && this._pollingRequestInfoMap.set(e2, { key: i2, startSeq: a2 }), Qe(c2) && c2 > this._startBroadcastSeq && (this._startBroadcastSeq = c2), nt(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 (nt(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 = [], l2 = this._get(11), a2 = this._get(26), d2 = e2.length, p2 = (1 < d2 && e2.sort(function(e3, t3) { return e3.sequence - t3.sequence; }), this._get(12).isUnlimitedAVChatRoom()), s2 = false; v.getLevel() <= 0 && (t2 = e2.map(function(e3) { return e3.sequence; }), v.l("".concat(n2, " count:").concat(t2.length, " sequenceList:").concat(t2)), t2.length = 0); for (var _2 = 0; _2 < d2; _2++) { var r2 = this.restoreMessageFromSimplified(e2[_2]); if (yi[r2.event]) { if (6 === r2.event) { if (this._grpM.isGroupAttributesUpdatedNotice(r2)) continue; if (this._grpM.isGroupCountersNotice(r2)) continue; } if (20 !== r2.event) if (21 !== r2.event) if (100 !== r2.event) { var o2 = this.packMessage(r2, r2.event), c2 = 1 === r2.isModified, s2 = 1 === r2.isHistoryMessage; if (!p2) { if (this._seqSll.has(o2.sequence)) continue; this._seqSll.set(o2.sequence); } var u2 = this._IDSll.has(o2.ID); u2 ? v.w("".concat(n2, " ID:").concat(o2.ID, " has:").concat(u2)) : (this._IDSll.set(o2.ID), u2 = false, !s2 && this._isMessageSentByCurrentInstance(o2) ? c2 && (u2 = true, o2.isModified = c2, l2.updateMsgIsModifiedProp(o2)) : u2 = true, u2 && (o2.conversationType === R.CONV_SYSTEM && 5 === o2.payload.operationType && this._onGroupDismissed(o2.payload.groupProfile.groupID), s2 || o2.conversationType === R.CONV_SYSTEM || (c2 = o2.conversationID.replace(R.CONV_GROUP, ""), this._pollingInstanceMap.has(c2) ? this._grpM.isLoggedIn() && a2.addMessageSequence({ key: eo, message: o2 }) : (o2.type !== R.MSG_GRP_TIP && 0 < o2.clientTime && a2.addMessageDelay(o2.clientTime), a2.addMessageSequence({ key: $n, message: o2 }))), i2.push(o2))); } else this.onRoomCustomData(r2); else this._get(34).onMessageReactionNotify({ event: 21, dataList: r2.elements.messageReactionNotifyList }); else this.handleMessageRevokedNotice(r2); } else v.w("".concat(n2, ". unknown event:").concat(r2.event)); } 0 !== i2.length && (0 < (t2 = Dt(i2)).length && this._grpM.emitOEvt(G.MESSAGE_MODIFIED, t2), s2 || 0 < (t2 = this.packConversationOption(i2)).length && l2.onNewMessage({ conversationOptionsList: t2, isInstantMessage: true }), this._checkMessageStacked(i2), 0 < (t2 = Lt(i2)).length && this._grpM.emitOEvt(G.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(R.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(G.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 = (Qe(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 === R.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), {}, c({}, t3, n2.elements[t3])); }, {}), n2.elements = i2), n2; } }, { key: "_onGroupDismissed", value: function(e2) { v.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 M(t2).setMessage("count:".concat(e2, " groupID:").concat(D(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 ? R.CONV_SYSTEM : R.CONV_GROUP, e2.isSystemMessage = !!e2.isSystemMessage; var n2 = new Ro(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: R.MSG_GRP_TIP, content: y(y({}, e2.elements), {}, { groupProfile: e2.groupProfile }) }) : 5 === t2 ? { type: R.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 D(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; Je(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(), Je(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 (!Je(e2)) { for (var t2 = [], n2 = e2.length, o2 = null, i2 = 0; i2 < n2; i2++) { var a2 = this.restoreMessageFromSimplified(e2[i2]); yi[a2.event] ? ((o2 = this.packMessage(a2, a2.event)).isBroadcastMessage = true, this._broadcastMessageIDMap.has(o2.ID) || (t2.push(o2), this._broadcastMessageIDMap.set(o2.ID, 1))) : v.w("".concat(this._n, "._onBroadcastMessage unknown event:").concat(a2.event)); } 0 < t2.length && this._grpM.emitOEvt(G.MESSAGE_RECEIVED, t2); } } }, { key: "start", value: function(e2) { var t2; this._pollingInstanceMap.has(e2) ? (t2 = this._pollingInstanceMap.get(e2)).isRunning() || t2.start() : ((t2 = new Mi({ 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), v.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), A(e2) ? kn({ status: Ke, 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() ? kn({ status: Ke, group: t2 }) : kn({ status: Ke }); }); } }, { key: "_preCheck", value: function(e2) { if (this._get(12).isUnlimitedAVChatRoom()) return Promise.resolve(); if (!this.hasJoinedAVChatRoom()) return Promise.resolve(); if (e2.type === R.GRP_LIVE) return Promise.resolve(); var e2 = m(this._joinedGroupMap.entries().next().value, 2), t2 = e2[0], e2 = e2[1]; if (this._grpM.isLoggedIn()) { if (e2.selfInfo.role !== R.GRP_MBR_ROLE_OWNER && e2.ownerID !== this._grpM.getMyUserID()) return this._grpM.quitGroup(t2); this._grpM.deleteLocalGroupAndConversation(t2); } else this._grpM.deleteLocalGroupAndConversation(t2); return this.reset(t2), Promise.resolve(); } }, { key: "joinWithoutAuth", value: function(e2) { var n2 = this, o2 = e2.groupID, i2 = "".concat(this._n, ".").concat("joinWithoutAuth"), a2 = new M("joinWithoutAuth"); return this._grpM.req({ P: I.APPLY_JOIN_GRP_NOAUTH, data: e2 }).then(function(e3) { e3 = e3.data.longPollingKey; if (a2.setMessage("groupID:".concat(o2, " longPollingKey:").concat(e3)).end(true), A(e3)) return C({ code: T.CANNOT_JOIN_NON_AV_WITHOUT_LOGIN }); v.l("".concat(i2, " ok. groupID:").concat(o2)), n2._get(11).setCompleted("".concat(R.CONV_GROUP).concat(o2)); var t2 = new li({ groupID: o2 }); return n2.startRunLoop({ group: t2, longPollingKey: e3 }), Sn({ status: Ke }); }).catch(function(e3) { return v.e("".concat(i2, " failed. groupID:").concat(o2, " error:"), e3), a2.setError(e3).setMessage("groupID:".concat(o2)).end(true), C(e3); }).finally(function() { n2._grpM.get(14).reportAtOnce(); }); } }, { key: "getGroupOnlineMemberCount", value: function(e2) { var t2 = this._onlineMemberCountMap.get(e2) || {}, n2 = Date.now(); return Je(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 Sn({ memberCount: e3.memberCount }); }).catch(function(e3) { return C(e3); })) : kn({ memberCount: t2.memberCount }); } }, { key: "_getGroupOnlineMemberCount", value: function(i2) { var a2 = this, s2 = "".concat(this._n, ".").concat("_getGroupOnlineMemberCount"), t2 = new M("_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 = (v.l("".concat(s2, " ok. groupID:").concat(i2, " memberCount:").concat(n2, " expireTime:").concat(e2)), Date.now()); return Je(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 v.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) { A(e2) || (Qe(e2) ? this._pollingInterval = this.DEFAULT_POLLING_INTERVAL = e2 : this._pollingInterval = this.DEFAULT_POLLING_INTERVAL = parseInt(e2, 10)); } }, { key: "setPollingIntervalPlus", value: function(e2) { A(e2) || (Qe(e2) ? this.DEFAULT_POLLING_INTERVAL_PLUS = e2 : this.DEFAULT_POLLING_INTERVAL_PLUS = parseInt(e2, 10)); } }, { key: "setPollingNoMessageCount", value: function(e2) { A(e2) || (Qe(e2) ? this.DEFAULT_POLLING_NO_MESSAGE_COUNT = e2 : this.DEFAULT_POLLING_NO_MESSAGE_COUNT = parseInt(e2, 10)); } }, { key: "setPollingSimplifiedMessage", value: function(e2) { A(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; v.l("".concat(this._n, ".onAVChatRoomMemberBanned groupID:").concat(e2)), this._grpM.deleteLocalGroupAndConversation(e2), this.reset(e2); } }, { key: "restartPolling", value: function() { v.l("".concat(this._n, ".restartPolling count:").concat(this._pollingInstanceMap.size)); var e2, t2 = N(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) { if (!this._pollingInstanceMap.has(e2)) return -1; var t2 = this._pollingInstanceMap.get(e2).getPollingTimerID(); return v.l("".concat(this._n, ".getPollingTimerID groupID:").concat(e2, " timerID:").concat(t2)), t2; } }, { 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), v.l("".concat(this._n, ".onRoomCustomData groupID:").concat(t2, " sequence:").concat(n2, " time:").concat(o2, " data:").concat(e2)); } }, { key: "reset", value: function(e2) { if (e2) { v.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 { v.l("".concat(this._n, ".reset all")); var n2, o2 = N(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; } }]), Qi), Ti = (e(Zi, [{ key: "updateMember", value: function(e2) { A(e2.onlineStatus) || (this.isOnline = "Online" === e2.onlineStatus); var t2 = [null, void 0, "", 0, NaN]; e2.memberCustomField && Tt(this.memberCustomField, e2.memberCustomField), rt(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) { A(e2) || (this.muteUntil = Math.floor((Date.now() + 1e3 * e2) / 1e3)); } }, { key: "updateNameCard", value: function(e2) { A(e2) || (this.nameCard = e2); } }, { key: "updateMemberCustomField", value: function(e2) { e2 && Tt(this.memberCustomField, e2); } }]), Zi), Di = (e(Xi, [{ 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 (v.l("".concat(c2, " groupID:").concat(i2, " role:").concat(n2, " offset:").concat(s2, " count:").concat(r2, " hasLocalGroup:").concat(a2)), !a2) return kn({ memberList: [], offset: 0 }); if (this._grpM.getLocalGroupProfile(i2).type === R.GRP_AVCHATROOM) { if (this._grpM.canIUse(H.AV_MBR_LIST)) return this._getAVChatRoomMemberList({ groupID: i2, offset: s2, filter: e2 }); this._grpM.warn("LiveOnlineMember"); } n2 !== R.GRP_MBR_ROLE_ADMIN && n2 !== R.GRP_MBR_ROLE_OWNER && n2 !== R.GRP_MBR_ROLE_MEMBER || (t2 = n2); var l2 = new M("getGroupMemberList"), u2 = 0, a2 = { groupID: i2, limit: 100 < r2 ? 100 : r2, memberRoleFilter: t2 ? [t2] : void 0, memberInfoFilter: this.DEFAULT_MEMBER_INFO_FILTER }, d2 = (kt({ groupID: i2 }) ? a2.next = "".concat(s2) : (a2.offset = s2, u2 = s2 + r2), []); return this._grpM.req({ P: I.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 A(e3) || (u2 = Je(e3) ? 0 : e3), nt(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: [qe.NICK, qe.AVATAR] })) : (u2 = 0, Promise.resolve([])); }).then(function(e3) { e3 = e3.data; if (!nt(e3) || 0 === e3.length) return kn({ memberList: [], offset: u2 }); e3 = e3.map(function(e4) { return { userID: e4.userID, nick: e4.nick, avatar: e4.avatar }; }); return o2._updateLocalGroupMemberMap(i2, e3), d2.length < r2 && (u2 = 0), l2.setMessage("groupID:".concat(i2, " offset:").concat(s2, " count:").concat(r2)).end(), v.l("".concat(c2, " ok.")), Sn({ memberList: d2, offset: u2 }); }).catch(function(e3) { return l2.setError(e3).end(), v.e("".concat(c2, " failed. error:"), e3), C(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 M("_getAVChatRoomMemberList"); return a2.setMessage("groupID:".concat(o2, " offset:").concat(t2, " filter:").concat(e2)), this._grpM.req({ P: I.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(), v.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 Sn({ memberList: t3, offset: e3 }); }).catch(function(e3) { return a2.setError(e3).end(), v.e("".concat(i2, " failed. error:"), e3), C(e3); }); } }, { key: "getGroupMemberProfile", value: function(e2) { var t2 = this, n2 = "getGroupMemberProfile", o2 = "".concat(this._n, ".").concat(n2), i2 = "groupID:".concat(e2.groupID), a2 = (5 < e2.userIDList.length ? i2 += " userIDList.length:".concat(e2.userIDList.length) : i2 += " userIDList:".concat(e2.userIDList), v.l("".concat(o2, " ").concat(i2)), 50 < e2.userIDList.length && (e2.userIDList = e2.userIDList.slice(0, 50)), e2.groupID), s2 = e2.userIDList, o2 = this._grpM.getLocalGroupProfile(a2); if (o2 && St(o2.type)) return C({ code: o2 = T.OPERATION_NOT_SUPPORTED_IN_AV, message: this._grpM.getErrMsg(o2, n2) }); var r2 = new M(n2); return r2.setMessage(i2), this._getGroupMemberProfileAdvance(y(y({}, e2), {}, { userIDList: s2 })).then(function(e3) { e3 = e3.data.members; return nt(e3) && 0 !== e3.length ? (t2._updateLocalGroupMemberMap(a2, e3), t2._grpM.get(4).getUserProfile({ userIDList: e3.map(function(e4) { return e4.userID; }), tagList: [qe.NICK, qe.AVATAR] })) : kn([]); }).then(function(e3) { e3 = e3.data.map(function(e4) { return { userID: e4.userID, nick: e4.nick, avatar: e4.avatar }; }), t2._updateLocalGroupMemberMap(a2, e3), e3 = s2.filter(function(e4) { return t2.hasLocalGroupMember(a2, e4); }).map(function(e4) { return t2.getLocalGroupMemberInfo(a2, e4); }); return r2.end(), Sn({ 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 M("addGroupMember"); return u2.setMessage("groupID:".concat(e2, " groupType:").concat(t2)), St(t2) ? (t2 = new Bn({ code: T.CANNOT_ADD_MEMBER_IN_AV }), u2.setError(t2).end(), C(t2)) : (a2.userIDList = a2.userIDList.map(function(e3) { return { userID: e3 }; }), v.l("".concat(r2, " groupID:").concat(e2)), this._grpM.req({ P: I.ADD_GRP_MBR, data: a2 }).then(function(e3) { var e3 = e3.data.members, t3 = (v.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 ? Sn({ successUserIDList: t3, failureUserIDList: n2, existedUserIDList: o2, overLimitUserIDList: e3 }) : (s2._updateConvGroupProfile(c2), Sn({ successUserIDList: t3, failureUserIDList: n2, existedUserIDList: o2, overLimitUserIDList: e3, group: c2 })); }).catch(function(e3) { return u2.setError(e3).end(), v.e("".concat(r2, " failed. error:"), e3), C(e3); })); } }, { key: "deleteGroupMember", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("deleteGroupMember"), o2 = e2.groupID, i2 = e2.userIDList, a2 = this._grpM.getLocalGroupProfile(o2); if (A(a2)) return C({ code: T.CANNOT_FIND_GRP }); if (St(a2.type)) return this._grpM.canIUse(H.AV_BAN_MBR) ? this._banAVChatRoomMember(e2) : this._grpM.noUse("deleteGroupMember"); var s2 = "groupID:".concat(o2, " ").concat(5 < i2.length ? "userIDList.length:".concat(i2.length) : "userIDList:".concat(i2)), r2 = (v.l("".concat(n2, " groupID:").concat(o2, " userIDList:"), i2), new M("deleteGroupMember")); return r2.setMessage(s2), this._grpM.req({ P: I.DEL_GRP_MBR, data: e2 }).then(function() { return r2.end(), v.l("".concat(n2, " ok")), t2._updateConvGroupProfile(a2), t2.deleteLocalGroupMembers(o2, i2), Sn({ group: a2, userIDList: i2 }); }).catch(function(e3) { return r2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(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 M("_banAVChatRoomMember"), r2 = (s2.setMessage(a2), v.l("".concat(n2, " groupID:").concat(o2, " userIDList:"), i2), this._grpM.getLocalGroupProfile(o2)); return A(e2.duration) || 0 === e2.duration ? C({ code: T.BAN_DURATION_INVALID }) : this._grpM.req({ P: I.BAN_AV_MBR, data: e2 }).then(function() { return s2.end(), v.l("".concat(n2, " ok")), t2.deleteLocalGroupMembers(o2, i2), Sn({ group: r2, userIDList: i2 }); }).catch(function(e3) { return s2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "setGroupMemberMuteTime", value: function(e2) { var n2 = this, o2 = e2.groupID, t2 = e2.userID, e2 = e2.muteTime, i2 = "".concat(this._n, ".").concat("setGroupMemberMuteTime"); if (t2 === this._grpM.getMyUserID()) return C({ code: T.CANNOT_MUTE_SELF }); var a2 = "groupID:".concat(o2, " userID:").concat(t2, " muteTime:").concat(e2), s2 = (v.l("".concat(i2, " ").concat(a2)), new M("setGroupMemberMuteTime")); return s2.setMessage(a2), this.modifyGroupMemberInfo({ groupID: o2, userID: t2, muteTime: e2 }).then(function(e3) { s2.end(), v.l("".concat(i2, " ok")); var t3 = n2._grpM.getLocalGroupProfile(o2); return Sn({ group: t3, member: e3 }); }).catch(function(e3) { return s2.setError(e3).end(), v.e("".concat(i2, " failed. error:"), e3), C(e3); }); } }, { key: "setGroupMemberRole", value: function(e2) { var t2 = "".concat(this._n, ".").concat("setGroupMemberRole"), n2 = e2.groupID, o2 = e2.userID, e2 = e2.role, i2 = "groupID:".concat(n2, " userID:").concat(o2, " role:").concat(e2), a2 = this._grpM.getLocalGroupProfile(n2); if (a2 && a2.selfInfo.role !== R.GRP_MBR_ROLE_OWNER) return C({ code: T.NOT_OWNER }); var s2 = [R.GRP_MBR_ROLE_ADMIN, R.GRP_MBR_ROLE_MEMBER]; if (kt({ groupID: n2 }) && s2.push(R.GRP_MBR_ROLE_CUSTOM), s2.indexOf(e2) < 0) return C({ code: T.INVALID_MEMBER_ROLE }); if (o2 === this._grpM.getMyUserID()) return C({ code: T.CANNOT_SET_SELF_MEMBER_ROLE }); var r2 = new M("setGroupMemberRole"); return r2.setMessage(i2), v.l("".concat(t2, " ").concat(i2)), this.modifyGroupMemberInfo({ groupID: n2, userID: o2, role: e2 }).then(function(e3) { return r2.end(), v.l("".concat(t2, " ok")), Sn({ group: a2, member: e3 }); }).catch(function(e3) { return r2.setError(e3).end(), v.e("".concat(t2, " failed. error:"), e3), C(e3); }); } }, { key: "_filterProfanity", value: function(e2, t2) { var n2 = this._grpM.get(29); if (!n2) return true; var n2 = n2.filterText(t2[e2], "group_member_profile"), o2 = n2.isAllowedToSend, n2 = n2.modifiedText; return true === o2 && (t2[e2] = n2, true); } }, { key: "setGroupMemberNameCard", value: function(e2) { var n2 = this, t2 = "setGroupMemberNameCard", o2 = "".concat(this._n, ".").concat(t2); if (e2.nameCard && false === this._filterProfanity("nameCard", e2)) return C({ code: T.PROFANITY_FOUND }); var i2 = e2.groupID, a2 = e2.userID, s2 = void 0 === a2 ? this._grpM.getMyUserID() : a2, r2 = e2.nameCard, a2 = "groupID:".concat(i2, " userID:").concat(s2, " nameCard:").concat(r2), e2 = (v.l("".concat(o2, " ").concat(a2)), this._grpM.getLocalGroupProfile(i2)); if (e2 && St(e2.type)) return C({ code: e2 = T.OPERATION_NOT_SUPPORTED_IN_AV, message: this._grpM.getErrMsg(e2, t2) }); var c2 = new M(t2); return c2.setMessage(a2), this.modifyGroupMemberInfo({ groupID: i2, userID: s2, nameCard: r2 }).then(function(e3) { v.l("".concat(o2, " ok")), c2.end(); var t3 = n2._grpM.getLocalGroupProfile(i2); return s2 === n2._grpM.getMyUserID() && t3 && t3.setSelfNameCard(r2), Sn({ group: t3, member: e3 }); }).catch(function(e3) { return c2.setError(e3).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "setGroupMemberCustomField", value: function(e2) { var n2 = this, t2 = "setGroupMemberCustomField", o2 = "".concat(this._n, ".").concat(t2), i2 = e2.groupID, a2 = e2.userID, a2 = void 0 === a2 ? this._grpM.getMyUserID() : a2, e2 = e2.memberCustomField, s2 = "groupID:".concat(i2, " userID:").concat(a2, " memberCustomField:").concat(JSON.stringify(e2)), r2 = (v.l("".concat(o2, " ").concat(s2)), this._grpM.getLocalGroupProfile(i2)); if (r2 && St(r2.type)) return C({ code: r2 = T.OPERATION_NOT_SUPPORTED_IN_AV, message: this._grpM.getErrMsg(r2, t2) }); var c2 = new M(t2); return c2.setMessage(s2), this.modifyGroupMemberInfo({ groupID: i2, userID: a2, memberCustomField: e2 }).then(function(e3) { c2.end(), v.l("".concat(o2, " ok")); var t3 = n2._grpM.getLocalGroupProfile(i2); return Sn({ group: t3, member: e3 }); }).catch(function(e3) { return c2.setError(e3).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "modifyGroupMemberInfo", value: function(t2) { var n2 = this, o2 = t2.groupID, i2 = t2.userID, e2 = void 0; return Rt(o2) && (o2 = Kt(e2 = o2)), this._grpM.req({ P: I.MODIFY_GRP_MBR_INFO, data: y(y({}, t2), {}, { groupID: o2, topicID: e2 }) }).then(function() { if (n2.hasLocalGroupMember(o2, i2)) return e3 = n2.getLocalGroupMemberInfo(o2, i2), A(t2.muteTime) || e3.updateMuteUntil(t2.muteTime), A(t2.role) || e3.updateRole(t2.role), A(t2.nameCard) || e3.updateNameCard(t2.nameCard), A(t2.memberCustomField) || e3.updateMemberCustomField(t2.memberCustomField), e3; var e3 = n2._grpM.getLocalGroupProfile(o2); return e3 && !St(e3.type) ? n2.getGroupMemberProfile({ groupID: o2, userIDList: [i2] }).then(function(e4) { return m(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 = (v.l("".concat(o2, " ").concat(e2)), 2), r2 = [], i2 = (true === i2 && (s2 = 1), D(a2)), c2 = (500 < a2.length && (i2 = a2.slice(0, 500), v.w("".concat(o2, " ").concat(zt(500)))), i2.forEach(function(e3) { r2.push({ userID: e3, markType: [n2] }); }), i2 = null, new M("markGroupMemberList")); return c2.setMessage(e2), this._grpM.req({ P: I.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, D(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(), v.l("".concat(o2, " ok. ").concat(e3)), Sn({ successUserIDList: t3, failureUserIDList: n3 }); }).catch(function(e3) { return c2.setError(e3).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "_getGroupMemberProfileAdvance", value: function(e2) { return this._grpM.req({ P: I.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 nt(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 Ti(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(); } }]), Xi), Ei = [17, 18, 20], Li = (e(zi, [{ key: "onNewGroupSystemNotice", value: function(e2) { var t2 = e2.dataList, n2 = e2.isSyncingEnded, e2 = e2.isInstantMessage, t2 = (v.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(G.MESSAGE_RECEIVED, t2) : true === n2 && this._clearGroupSystemNotice(); } }, { key: "_assembly", value: function(e2) { for (var t2 = e2.notifiesList, l2 = e2.isInstantMessage, n2 = null, d2 = t2.length, o2 = 0, i2 = [], a2 = { conversationID: R.CONV_SYSTEM, unreadCount: 0, type: R.CONV_SYSTEM, subType: null, lastMessage: null }, o2 = 0; o2 < d2; o2++) { var s2 = t2[o2], r2 = s2.groupProfile, p2 = r2.communityType, r2 = r2.topicID, r2 = void 0 === r2 ? void 0 : r2, c2 = s2.elements, u2 = c2.topicIDList, u2 = void 0 === u2 ? void 0 : u2, c2 = c2.operationType; if (!(2 !== (void 0 === p2 ? 0 : p2) || Je(r2) && Je(u2))) { if (Ei.includes(c2)) { this._handleTopicSystemNotice(s2); continue; } Je(r2) || (s2.to = r2); } 15 !== s2.elements.operationType && (s2.currentUser = this._grpM.getMyUserID(), s2.conversationType = R.CONV_SYSTEM, s2.conversationID = R.CONV_SYSTEM, (n2 = new Ro(s2)).setElement({ type: R.MSG_GRP_SYS_NOTICE, content: y(y({}, s2.elements), {}, { groupProfile: y({}, s2.groupProfile) }) }), n2.isSystemMessage = true, (1 === n2.sequence && 1 === n2.random || 2 === n2.sequence && 2 === n2.random) && (n2.sequence = lt(), n2.random = lt(), n2.generateMessageID(), v.l("".concat(this._n, "._assembly regenerate ID:").concat(n2.ID))), this._grpM.get(11).pushIntoNoticeResult(i2, n2) && (l2 ? a2.unreadCount++ : n2.setIsRead(true), a2.subType = n2.conversationSubType)); } return a2.lastMessage = i2[i2.length - 1], { eventDataList: 0 < i2.length ? [a2] : [], result: i2 }; } }, { 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(R.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)) && Qe(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 nt(e2.messageList) && 0 !== e2.messageList.length ? (v.l("".concat(o2, " ") + e2.messageList.map(function(e3) { return e3.ID; })), this._grpM.req({ P: I.DEL_GRP_SYSTEM_NOTICE, data: { messageListToDelete: e2.messageList.map(function(e3) { return { from: R.CONV_SYSTEM, messageSeq: e3.clientSequence, messageRandom: e3.random }; }) } }).then(function() { v.l("".concat(o2, " ok")); var t2 = n2._grpM.get(11); return e2.messageList.forEach(function(e3) { t2.deleteLocalMessage(e3); }), Sn(); }).catch(function(e3) { return v.e("".concat(o2, " error:"), e3), C(e3); })) : kn(); } }, { 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: I.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(D(t3), D(e4)); }) : t3; }); } }, { key: "getGroupApplicationList", value: function() { var n2 = this; return this._getPendencyList().then(function(t2) { return n2._getPendencyList({ type: R.GRP_COMMUNITY }).then(function(e2) { return t2.push.apply(t2, D(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 }); }), kn({ 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); v.l("".concat(this._n, "._onApplyJoinGroup groupID:").concat(n2, " groupType:").concat(e2, " hasGroup:").concat(o2)), o2 || St(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); v.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(R.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); v.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(R.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(R.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(); } }]), zi), Si = ["relayFlag"], ki = (t(Ji, Fn), oi = f(Ji), e(Ji, [{ 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"); v.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 === R.CONV_GROUP ? (n2 = Rt(t2.to) ? Kt(t2.to) : t2.to, this.hasLocalGroup(n2) ? kn() : this.getGroupProfile({ groupID: n2 }).then(function(e2) { var e2 = e2.data.group.type; return v.l("".concat(o2._n, ".guardForAVChatRoom. groupID:").concat(n2, " type:").concat(e2)), e2 === R.GRP_AVCHATROOM ? C(new Bn({ code: e2 = T.MSG_SEND_FAIL_NOT_IN_AV, message: o2.getErrMsg(e2, t2.from, n2), data: { message: t2 } })) : kn(); })) : kn(); } }, { 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; nt(e2) && (n2 = this.get(10), e2.forEach(function(e3) { var t2 = e3.conversationID.replace(R.CONV_GROUP, ""); Rt(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; A(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 = (v.l("".concat(a2._n, ".onMsgReadNotice groupID:").concat(t2, " lastMessageSeq:").concat(e4)), "".concat(R.CONV_GROUP).concat(t2)), o2 = true; Je(n2) || (t2 = "".concat(R.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; v.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) { v.l("".concat(this._n, ".onMsgModified options:"), e2); var t2 = this.get(11); e2.dataList.forEach(function(e3) { t2.onMessageModified(y(y({}, e3), {}, { conversationType: R.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 li(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 li(e3)), o2.deleteGroupRoamingInfo(t2)); }); var i2, a2 = this.getMyUserID(), s2 = N(this.groupMap); try { for (s2.s(); !(i2 = s2.n()).done; ) { var r2 = m(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 D(this.groupMap.values()).filter(function(e2) { return e2.type !== R.GRP_ROOM && e2.type !== R.GRP_LIVE; }); } }, { key: "getLocalGroupProfile", value: function(e2) { return this.groupMap.get(e2); } }, { key: "sortLocalGroupList", value: function() { var e2 = D(this.groupMap).filter(function(e3) { e3 = m(e3, 2); return e3[0], !Je(e3[1].lastMessage); }); e2.sort(function(e3, t2) { return t2[1].lastMessage.lastTime - e3[1].lastMessage.lastTime; }), this.groupMap = new Map(D(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(G.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; if (!nt(e2) || 0 === e2.length) return Promise.resolve(); e2 = e2.filter(function(e3) { return !St(n2.getLocalGroupProfile(e3).type); }); return 0 === e2.length ? Promise.resolve() : (v.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: nt(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 M("getGroupProfile"), a2 = t2.groupID, e2 = t2.groupCustomFieldFilter, e2 = (v.l("".concat(o2, " groupID:").concat(a2)), { groupIDList: [a2], responseFilter: { groupBaseInfoFilter: D(K), groupCustomFieldFilter: e2, memberInfoFilter: [].concat(D(Y), ["NameCard"]) } }); return this.getGroupProfileAdvance(e2).then(function(e3) { var e3 = e3.data, t3 = e3.successGroupList, e3 = e3.failureGroupList; return v.l("".concat(o2, " ok")), 0 < e3.length ? C(e3[0]) : ((e3 = St(t3[0].type) && !n2.hasLocalGroup(a2) ? new li(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(), Sn({ group: e3 })); }).catch(function(e3) { return i2.setError(e3).setMessage("groupID:".concat(t2.groupID)).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "getGroupProfileAdvance", value: function(e2) { var t2, n2 = "".concat(this._n, ".getGroupProfileAdvance"), o2 = e2.groupIDList, i2 = (nt(o2) && 50 < o2.length && (this.warn("GetGroupProfileLimit"), o2.length = 50), []), a2 = [], o2 = (o2.forEach(function(e3) { (kt({ 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, D(e4.successGroupList)), n3.push.apply(n3, D(e4.failureGroupList)); }), Sn({ successGroupList: t3, failureGroupList: n3 }); }).catch(function(e3) { return v.e("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "_getGroupProfileAdvance", value: function(t2) { var n2 = this, e2 = t2.relayFlag, o2 = void 0 !== e2 && e2, i2 = g(t2, Si); return this.req({ P: I.GET_GRP_PROFILE, data: i2 }).then(function(e3) { v.l("".concat(n2._n, "._getGroupProfileAdvance ok. options:"), i2); e3 = e3.data.groups; return { successGroupList: e3.filter(function(e4) { return A(e4.errorCode) || 0 === e4.errorCode; }), failureGroupList: e3.filter(function(e4) { return e4.errorCode && 0 !== e4.errorCode; }).map(function(e4) { return new Bn({ code: e4.errorCode, message: e4.errorInfo, data: { groupID: e4.groupID } }); }) }; }).catch(function(e3) { return o2 && kt({ groupID: t2.groupIDList[0] }) ? { successGroupList: [], failureGroupList: [] } : C(e3); }); } }, { key: "createGroup", value: function(s2) { var r2 = this, e2 = [R.GRP_PUBLIC, R.GRP_WORK, R.GRP_MEETING, R.GRP_AVCHATROOM, R.GRP_COMMUNITY], c2 = "".concat(this._n, ".").concat("createGroup"), t2 = s2.type, n2 = s2.groupID; if (s2.name && false === this._filterProfanity("name", s2)) return C({ code: T.PROFANITY_FOUND }); if (s2.introduction && false === this._filterProfanity("introduction", s2)) return C({ code: T.PROFANITY_FOUND }); if (s2.notification && false === this._filterProfanity("notification", s2)) return C({ code: T.PROFANITY_FOUND }); if (!e2.includes(t2)) return C({ code: T.ILLEGAL_GRP_TYPE }); if (!kt({ type: t2 })) { if (!Je(n2) && kt({ groupID: n2 })) return C({ code: T.ILLEGAL_GRP_ID }); s2.isSupportTopic = void 0; } if (St(t2) && !A(s2.memberList) && 0 < s2.memberList.length && (s2.memberList = void 0), this._canIUseJoinOption(t2) || A(s2.joinOption) || (s2.joinOption = void 0), kt({ type: t2 })) { if (!Je(n2) && !kt({ groupID: n2 })) return C({ code: T.ILLEGAL_GRP_ID }); s2.isSupportTopic = true === s2.isSupportTopic ? 1 : 0; } var u2 = new M("createGroup"), l2 = (v.l("".concat(c2, " options:"), s2), null), d2 = []; return this.req({ P: I.CREATE_GRP, data: y(y({}, s2), {}, { ownerID: this.getMyUserID(), webPushFlag: 1 }) }).then(function(e3) { var e3 = e3.data, t3 = e3.groupID, e3 = e3.overLimitUserIDList, n3 = void 0 === e3 ? [] : e3, e3 = (l2 = t3, d2 = n3, "groupType:".concat(s2.type, " groupID:").concat(t3, " overLimitUserIDList:").concat(n3)); if (u2.setMessage(e3).end(), v.l("".concat(c2, " ok. ").concat(e3)), s2.type === R.GRP_AVCHATROOM) return r2.getGroupProfile({ groupID: t3 }); if (s2.type === R.GRP_COMMUNITY && 1 === s2.isSupportTopic) return r2.getGroupProfile({ groupID: t3 }); Je(s2.memberList) || Je(n3) || (s2.memberList = s2.memberList.filter(function(e4) { return -1 === n3.indexOf(e4.userID); })), r2.updateGroupMap([y(y({}, s2), {}, { groupID: t3 })]); var e3 = r2.get(2), o2 = "", i2 = 0, a2 = (s2.type === R.GRP_COMMUNITY ? (o2 = r2.isIntl() ? "Create Community" : "创建社群", i2 = 1) : o2 = r2.isIntl() ? "Create Group" : "创建群组", r2.get(4).getMyNick()), o2 = e3.createCustomMessage({ to: t3, conversationType: R.CONV_GROUP, payload: { data: JSON.stringify({ businessID: "group_create", content: o2, cmd: i2, opUser: a2 || r2.getMyUserID(), version: 4 }) } }); return e3.sendMessageInstance(o2), r2.emitGroupListUpdate(), r2.getGroupProfile({ groupID: t3 }); }).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: R.MSG_REMIND_ACPT_AND_NOTE, role: R.GRP_MBR_ROLE_OWNER }), Sn({ 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 = R.GRP_MBR_ROLE_OWNER, Sn({ group: t3, overLimitUserIDList: d2 })) : (v.e("".concat(c2, " failed. error:"), e3), C(e3)); }); } }, { key: "dismissGroup", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("dismissGroup"), o2 = "groupID:".concat(e2), i2 = new M("dismissGroup"); return i2.setMessage(o2), v.l("".concat(n2, " ").concat(o2)), this.req({ P: I.DISMISS_GRP, data: { groupID: e2 } }).then(function() { return i2.end(), v.l("".concat(n2, " ok")), t2.deleteLocalGroupAndConversation(e2), t2.checkJoinedAVChatRoomByID(e2) && t2._AVChatRoomHandler.reset(e2), t2._groupAttributesHandler.deleteLocalGroupAttributes(e2), Sn({ groupID: e2 }); }).catch(function(e3) { return i2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "updateGroupProfile", value: function(e2) { var t2, n2 = this, o2 = "".concat(this._n, ".").concat("updateGroupProfile"); if (this.hasLocalGroup(e2.groupID) && (t2 = this.getLocalGroupProfile(e2.groupID).type, this._canIUseJoinOption(t2) || A(e2.joinOption) || (v.w("".concat(o2, " joinOption is unavailable for Work/Meeting/AVChatRoom")), e2.joinOption = void 0)), A(e2.muteAllMembers) || (e2.muteAllMembers ? e2.muteAllMembers = "On" : e2.muteAllMembers = "Off"), e2.name && false === this._filterProfanity("name", e2)) return C({ code: T.PROFANITY_FOUND }); if (e2.introduction && false === this._filterProfanity("introduction", e2)) return C({ code: T.PROFANITY_FOUND }); if (e2.notification && false === this._filterProfanity("notification", e2)) return C({ code: T.PROFANITY_FOUND }); var i2 = new M("updateGroupProfile"); return i2.setMessage(JSON.stringify(e2)), v.l("".concat(o2, " groupID:").concat(e2.groupID)), this.req({ P: I.UPDATE_GRP_PROFILE, data: e2 }).then(function() { return i2.end(), v.l("".concat(o2, " ok")), n2.hasLocalGroup(e2.groupID) && n2.groupMap.get(e2.groupID).updateGroup(e2), Sn({ group: n2.groupMap.get(e2.groupID) }); }).catch(function(e3) { return i2.setError(e3).end(), v.l("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "_filterProfanity", value: function(e2, t2) { var n2 = this.get(29); if (!n2) return true; var n2 = n2.filterText(t2[e2], B), o2 = n2.isAllowedToSend, n2 = n2.modifiedText; return true === o2 && (t2[e2] = n2, true); } }, { key: "joinGroup", value: function(t2) { var n2 = this, o2 = t2.groupID, i2 = "".concat(this._n, ".joinGroup"); if (this.deleteUnjoinedAVChatRoom(o2), this.hasLocalGroup(o2)) { if (!this.isLoggedIn()) return kn({ status: R.JOIN_STATUS_ALREADY_IN_GROUP }); var a2 = new M("applyJoinGroup"); return this.getGroupProfile({ groupID: o2 }).then(function() { return a2.setMessage("groupID:".concat(o2, " joinedStatus:").concat(R.JOIN_STATUS_ALREADY_IN_GROUP)).end(), kn({ status: R.JOIN_STATUS_ALREADY_IN_GROUP }); }).catch(function(e2) { return a2.setMessage("groupID:".concat(o2, " unjoined")).end(), v.w("".concat(i2, " ").concat(o2, " was unjoined, now join!")), n2.groupMap.delete(o2), n2.applyJoinGroup(t2); }); } return v.l("".concat(i2, " groupID:").concat(o2)), this.isLoggedIn() ? this.applyJoinGroup(t2) : this._AVChatRoomHandler.joinWithoutAuth(t2); } }, { key: "applyJoinGroup", value: function(e2) { var c2 = this, u2 = "".concat(this._n, ".").concat("applyJoinGroup"), l2 = e2.groupID; if (!Je(e2.applyMessage) && false === this._filterProfanity("applyMessage", e2)) return C({ code: T.PROFANITY_FOUND }); var d2 = new M("applyJoinGroup"), e2 = y({}, e2), p2 = this.canIUse(H.AV_HISTORY_MSG); return p2 && (e2.historyMessageFlag = 1), this.get(11).deleteTopicRoamingInfo(l2), this.req({ P: I.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(l2, " joinedStatus:").concat(t2, " longPollingKey:").concat(n2, " startSeq:").concat(o2) + " avChatRoomFlag:".concat(i2, " canGetAVChatRoomHistoryMsg:").concat(p2, ",") + " historyMsgCount:".concat(Je(s2) ? 0 : s2.length); switch (d2.setMessage(e3).end(), v.l("".concat(u2, " ok. ").concat(e3)), t2) { case Ye: return Sn({ status: Ye }); case Ke: return c2.getGroupProfile({ groupID: l2 }).then(function(e4) { e4 = e4.data.group; return c2._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 ? (c2._silentlyGetGroupProfile(e4.code, l2), t3 = new li({ groupID: l2 }), c2.updateGroupMap([t3]), c2._handleJoinResult({ group: t3, avChatRoomFlag: i2, longPollingKey: n2, startSeq: o2, avChatRoomKey: a2, messageList: s2 })) : (v.e("".concat(u2, " failed. error:"), e4), C(e4)); }); default: var r2 = new Bn({ code: T.JOIN_GRP_FAIL }); return v.e("".concat(u2, " failed. error:"), r2), C(r2); } }).catch(function(e3) { return d2.setMessage("groupID:".concat(l2)).setError(e3).end(), v.e("".concat(u2, " failed. error:"), e3), C(e3); }); } }, { 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(R.CONV_GROUP).concat(c2)), this._groupAttributesHandler.initGroupAttributesCache({ groupID: c2, avChatRoomKey: s2 }), this._groupCountersHandler.initGroupCountersCache({ groupID: c2, avChatRoomKey: s2 }), (e2 = A(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), Sn({ status: Ke, group: n2 })); } }, { key: "quitGroup", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("quitGroup"), o2 = "groupID:".concat(e2), i2 = (v.l("".concat(n2, " ").concat(o2)), this.checkJoinedAVChatRoomByID(e2)); if (!i2 && !this.hasLocalGroup(e2)) return C({ code: T.MEMBER_NOT_IN_GRP }); if (i2 && !this.isLoggedIn()) return v.l("".concat(n2, " anonymously ok. ").concat(o2)), this.deleteLocalGroupAndConversation(e2), this._AVChatRoomHandler.reset(e2), kn({ groupID: e2 }); var a2 = new M("quitGroup"); return a2.setMessage(o2), this.req({ P: I.QUIT_GRP, data: { groupID: e2 } }).then(function() { return a2.end(), v.l("".concat(n2, " ok")), t2.deleteLocalGroupAndConversation(e2), i2 && t2._AVChatRoomHandler.reset(e2), t2._groupAttributesHandler.deleteLocalGroupAttributes(e2), Sn({ groupID: e2 }); }).catch(function(e3) { return a2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "searchGroupByID", value: function(e2) { var t2 = "".concat(this._n, ".").concat("searchGroupByID"), n2 = { groupIDList: [e2] }, o2 = new M("searchGroupByID"); return o2.setMessage("groupID:".concat(e2)), v.l("".concat(t2, " groupID:").concat(e2)), this.req({ P: I.SEARCH_GRP, data: n2 }).then(function(e3) { e3 = e3.data.groupProfile; if (0 !== e3[0].errorCode) throw new Bn({ code: e3[0].errorCode, message: e3[0].errorInfo }); return o2.end(), v.l("".concat(t2, " ok")), Sn({ group: new li(e3[0]) }); }).catch(function(e3) { return o2.setError(e3).end(), v.w("".concat(t2, " failed. error:"), e3), C(e3); }); } }, { key: "changeGroupOwner", value: function(i2) { var a2 = this, s2 = "".concat(this._n, ".").concat("changeGroupOwner"); if (this.hasLocalGroup(i2.groupID) && this.getLocalGroupProfile(i2.groupID).type === R.GRP_AVCHATROOM) return C({ code: T.CANNOT_CHANGE_OWNER_IN_AV }); if (i2.newOwnerID === this.getMyUserID()) return C({ code: T.CANNOT_CHANGE_OWNER_TO_SELF }); var r2 = new M("changeGroupOwner"); return r2.setMessage("groupID:".concat(i2.groupID, " newOwnerID:").concat(i2.newOwnerID)), v.l("".concat(s2, " groupID:").concat(i2.groupID)), this.req({ P: I.CHANGE_GRP_OWNER, data: i2 }).then(function() { r2.end(), v.l("".concat(s2, " ok")); var e2, t2 = i2.groupID, n2 = i2.newOwnerID, o2 = (a2.groupMap.get(t2).ownerID = n2, a2._groupMemberHandler.getLocalGroupMemberList(t2)); return o2 instanceof Map && (e2 = o2.get(a2.getMyUserID()), A(e2) || (e2.updateRole("Member"), a2.groupMap.get(t2).selfInfo.role = "Member"), e2 = o2.get(n2), A(e2) || e2.updateRole("Owner")), a2.emitGroupListUpdate(true, false), Sn({ group: a2.groupMap.get(t2) }); }).catch(function(e2) { return r2.setError(e2).end(), v.e("".concat(s2, " failed. error:"), e2), C(e2); }); } }, { key: "getGroupApplicationList", value: function() { return this._groupSystemNoticeHandler.getGroupApplicationList(); } }, { key: "handleGroupApplication", value: function(e2) { var t2, n2, o2, i2, a2, l2 = this, s2 = "".concat(this._n, ".").concat("handleGroupApplication"), d2 = e2.handleAction, p2 = e2.handleMessage, r2 = e2.message, c2 = e2.application, _2 = (r2 ? (t2 = r2.payload.operatorID, n2 = r2.payload.groupProfile.groupID, o2 = r2.payload.authentication, i2 = r2.payload.messageKey) : c2 && (t2 = c2.applicant, n2 = c2.groupID, o2 = c2.authentication, i2 = c2.messageKey), I.HANDLE_GRP_APPLICATION), u2 = (c2 && 2 === c2.applicationType && (_2 = I.HANDLE_INVITE_JOIN_GRP, a2 = c2.userID), new M("handleGroupApplication")); return u2.setMessage("groupID:".concat(n2)), v.l("".concat(s2, " groupID:").concat(n2)), this.req({ P: _2, data: { handleAction: d2, handleMessage: p2, applicant: t2, invitee: a2, groupID: n2, authentication: o2, messageKey: i2 } }).then(function() { return u2.end(), v.l("".concat(s2, " ok")), r2 && l2._groupSystemNoticeHandler.deleteGroupSystemNotice({ messageList: [e2.message] }), Sn({ group: l2.getLocalGroupProfile(n2) }); }).catch(function(e3) { return u2.setError(e3).end(), v.e("".concat(s2, " failed. error"), e3), C(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 M("handleGroupInvitation"); return c2.setMessage("groupID:".concat(i2, " inviter:").concat(o2, " handleAction:").concat(r2)), v.l("".concat(n2, " groupID:").concat(i2, " inviter:").concat(o2, " handleAction:").concat(r2)), this.req({ P: I.HANDLE_GRP_INVITATION, data: y(y({}, e2), {}, { inviter: o2, groupID: i2, authentication: a2, messageKey: s2 }) }).then(function() { return c2.end(), v.l("".concat(n2, " ok")), t2._groupSystemNoticeHandler.deleteGroupSystemNotice({ messageList: [e2.message] }), Sn({ group: t2.getLocalGroupProfile(i2) }); }).catch(function(e3) { return c2.setError(e3).end(), v.e("".concat(n2, " failed. error"), e3), C(e3); }); } }, { key: "getGroupOnlineMemberCount", value: function(t2) { var n2 = this, o2 = "".concat(this._n, ".getGroupOnlineMemberCount"), e2 = this._AVChatRoomHandler.checkJoinedAVChatRoomByID(t2), i2 = this.hasLocalGroup(t2); if (v.l("".concat(o2, " groupID:").concat(t2, " isAVChatRoom:").concat(e2, " has:").concat(i2)), e2) return this._AVChatRoomHandler.getGroupOnlineMemberCount(t2); if (!i2) return kn({ memberCount: 0 }); e2 = Date.now(); if (this._onlineMemberCountMap.has(t2)) { i2 = this._onlineMemberCountMap.get(t2); if (e2 - i2.lastReqTime <= 6e4) return kn({ 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 }), v.l("".concat(o2, " ok. groupID:").concat(t2, " memberCount:").concat(e3)), kn({ memberCount: e3 }); }).catch(function(e3) { return v.w("".concat(o2, " failed. error:"), e3), Promise.reject(e3); }); } }, { key: "requestOnlineCount", value: function(e2) { return this.req({ P: I.GET_ONLINE_MBR_NUM, data: { groupID: e2 } }); } }, { key: "hasLocalGroup", value: function(e2) { return this.groupMap.has(e2); } }, { key: "deleteLocalGroupAndConversation", value: function(e2) { var t2, n2 = this.checkJoinedAVChatRoomByID(e2), o2 = (v.l("".concat(this._n, ".deleteLocalGroupAndConversation groupID:").concat(e2, " isJoinedAVChatRoom:").concat(n2)), this.get(11)), i2 = "".concat(R.CONV_GROUP).concat(e2); n2 && (this.stopMessageLongPolling({ groupID: e2 }), o2.deleteLocalConv(i2)), kt({ groupID: e2 }) && (t2 = this.getLocalGroupProfile(e2)) && true === t2.isSupportTopic && this.get(10).deleteTopicListInCommunity(e2), o2.clearUnreadCount(i2), o2.setCompleted(i2), 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) { if (nt(e2._receiverList) && 0 < e2._receiverList.length && !this.canIUse(H.MSG_TO_SPECIFIED_GRP_MBR)) return this.noUse("Targeted Group Message"); e2 = this.createGroupMessagePack(e2, t2); return this.req(e2); } }, { key: "createGroupMessagePack", value: function(e2, t2) { var n2 = null, o2 = (t2 && t2.offlinePushInfo && (n2 = t2.offlinePushInfo), ""), i2 = (ft(e2.cloudCustomData) && 0 < e2.cloudCustomData.length && (o2 = e2.cloudCustomData), []), a2 = (et(t2) && et(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 = (nt(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())), c2 = this.get(17).getFileDNList(), u2 = e2.getGroupAtInfoList(), r2 = { fromAccount: this.getMyUserID(), groupID: e2.to, msgBody: po(e2.type, r2, c2), cloudCustomData: o2, random: e2.random, priority: e2.priority, clientSequence: e2.clientSequence, groupAtInfo: e2.type !== R.MSG_TEXT || Je(u2) ? void 0 : u2, onlineOnlyFlag: s2, clientTime: e2.clientTime, offlinePushInfo: Bo(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, forbidCallbackControl: Et(t2) }; return Rt(e2.to) && (r2.groupID = Kt(e2.to), r2.topicID = e2.to), { P: I.SEND_GRP_MSG, data: r2 }; } }, { key: "revokeMessage", value: function(e2) { var t2 = { groupID: e2.to, msgSeqList: [{ msgSeq: e2.sequence }] }; return Rt(e2.to) && (t2.groupID = Kt(e2.to), t2.topicID = e2.to), this.req({ P: I.REVOKE_GRP_MSG, data: t2 }); } }, { key: "deleteMessage", value: function(e2) { var t2 = e2.to, e2 = e2.keyList, e2 = (v.l("".concat(this._n, ".deleteMessage groupID:").concat(t2, " count:").concat(e2.length)), { groupID: t2, deleter: this.getMyUserID(), keyList: e2 }); return Rt(t2) && (e2.groupID = Kt(t2), e2.topicID = t2), this.req({ P: I.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 = (Rt(t2) && (r2 = Kt(t2), c2 = t2), void 0); return Wt(i2) && (1 < e2.length && e2.splice(0, 1, { type: i2, content: o2 }), t2 = e2), this.req({ P: I.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 M("getRoamingMessage"), p2 = 0, _2 = void 0; return Rt(l2) && (l2 = Kt(_2 = l2)), this._computeLastSequence({ groupID: l2, topicID: _2, sequence: e2 }).then(function(e3) { return p2 = e3, v.l("".concat(c2, " groupID:").concat(l2, " startSequence:").concat(p2)), r2.req({ P: I.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 = (A(n2) ? v.l("".concat(c2, " ok. complete:").concat(o2, " nextSequence:").concat(e3, " but messageList is undefined!")) : v.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 = (Je(n2) || (a2 = i2.onRoamingMessage(n2, u2, true, s2), i2.updateIsRead(u2), i2.patchConvLastMessage(u2)), 2 === o2 || e3 < 1); return n2 && (i2.setCompleted(u2), e3 = ""), v.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(), v.w("".concat(c2, " failed. error:"), e3), C(e3); }); } }, { key: "_getGroupIDOfMessage", value: function(e2) { return e2.conversationID.replace(R.CONV_GROUP, ""); } }, { key: "getReadReceiptList", value: function(n2) { var t2 = "".concat(this._n, ".").concat("getReadReceiptList"), e2 = this._getGroupIDOfMessage(n2[0]), o2 = this.getMyUserID(), i2 = n2.filter(function(e3) { return e3.from === o2 && true === e3.needReadReceipt; }).map(function(e3) { return { sequence: e3.sequence }; }); if (v.l("".concat(t2, " groupID:").concat(e2, " sequenceList:").concat(JSON.stringify(i2))), 0 === i2.length) return kn({ messageList: n2 }); var a2 = new M("getReadReceiptList"); return a2.setMessage("groupID:".concat(e2)), this.req({ P: I.GET_READ_RECEIPT, data: { groupID: e2, sequenceList: i2 } }).then(function(e3) { a2.end(), v.l("".concat(t2, " ok")); e3 = e3.data.readReceiptList; return nt(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); }); }), Sn({ messageList: n2 }); }).catch(function(e3) { return a2.setError(e3).end(), v.w("".concat(t2, " failed. error:"), e3), C(e3); }); } }, { key: "sendReadReceipt", value: function(e2) { var t2 = "".concat(this._n, ".").concat("sendReadReceipt"), n2 = this._getGroupIDOfMessage(e2[0]), o2 = new M("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 ? C({ code: T.READ_RECEIPT_MSG_LIST_EMPTY }) : (v.l("".concat(t2, ". sequenceList:").concat(JSON.stringify(e2))), this.req({ P: I.SEND_READ_RECEIPT, data: { groupID: n2, sequenceList: e2 } }).then(function(e3) { return o2.end(), v.l("".concat(t2, " ok")), Sn(); }).catch(function(e3) { return o2.setError(e3).end(), v.w("".concat(t2, " failed. error:"), e3), C(e3); })); } }, { key: "getReadReceiptDetail", value: function(e2) { var l2 = this, t2 = e2.message, n2 = e2.filter, o2 = e2.cursor, e2 = e2.count, i2 = this._getGroupIDOfMessage(t2), a2 = t2.ID, t2 = t2.sequence, s2 = "".concat(this._n, ".").concat("getReadReceiptDetail"), d2 = this._receiptDetailCompleteMap.get(a2) || false, r2 = 0 !== n2 && 1 !== n2 ? 0 : n2, n2 = ft(o2) ? o2 : "", o2 = !Qe(e2) || e2 <= 0 || 100 <= e2 ? 100 : e2, e2 = "groupID:".concat(i2, " sequence:").concat(t2, " cursor:").concat(n2, " filter:").concat(r2, " completeFlag:").concat(d2), c2 = (v.l("".concat(s2, " ").concat(e2)), { cursor: "", isCompleted: false, messageID: a2, unreadUserIDList: [], readUserIDList: [] }), u2 = new M("getReadReceiptDetail"); return u2.setMessage(e2), this.req({ P: I.GET_READ_RECEIPT_DETAIL, data: { groupID: i2, sequence: t2, flag: r2, cursor: n2, count: o2 } }).then(function(e3) { u2.end(); var e3 = e3.data, t3 = e3.cursor, n3 = e3.isCompleted, o3 = e3.unreadUserIDList, e3 = e3.readUserIDList; return c2.cursor = t3, 1 === n3 && (c2.isCompleted = true, l2._receiptDetailCompleteMap.set(a2, true)), 0 === r2 ? c2.readUserIDList = e3.map(function(e4) { return e4.userID; }) : 1 === r2 && (c2.unreadUserIDList = o3.map(function(e4) { return e4.userID; })), v.l("".concat(s2, " ok")), Sn(c2); }).catch(function(e3) { return u2.setError(e3).end(), v.w("".concat(s2, " failed. error:"), e3), C(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 A(d2) && 1 === p2 ? kn({ messageList: [], isCompleted: true, nextMessageSeq: "" }) : (Rt(t2) && (t2 = Kt(o2 = t2)), this._computeReqSeqHopping({ groupID: t2, topicID: o2, sequence: d2 }).then(function(e2) { A(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 = (v.l("".concat(l2, " ").concat(s2)), new M("getRoamingMessagesHopping")); return u2.req({ P: I.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(), v.l("".concat(l2, " ok. ").concat(i2)), "".concat(R.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), Sn(t3); }).catch(function(e3) { return r2.setError(e3).setMessage("groupID:".concat(t2, " sequence:").concat(d2, " count:").concat(n2)).end(), v.w("".concat(l2, " failed. error:"), e3), C(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) : A(t2) ? this.getGroupProfileAdvance({ groupIDList: [o2], responseFilter: { groupBaseInfoFilter: ["NextMsgSeq"] } }).then(function(e3) { var e3 = e3.data.successGroupList, t3 = 0; return Je(e3) || (t3 = e3[0].nextMessageSeq - 1), v.l("".concat(n2._n, "._computeReqSeqHopping groupID:").concat(o2, " lastSequence:").concat(t3, " from remote")), t3; }).catch(function(e3) { return C(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 (Je(a2)) { if (Je(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); }), (kt({ groupID: n2 }) || Rt(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 = (v.l("".concat(s2, " ").concat(e2)), Qe(a2) || this.warn("DoNotModifyLastSeq"), new M("setMessageRead")), c2 = (r2.setMessage(e2), i2.replace(R.CONV_GROUP, "")), u2 = void 0; return Rt(c2) && (c2 = Kt(u2 = c2)), this.req({ P: I.SET_GRP_MSG_READ, data: { groupID: c2, topicID: u2, messageReadSeq: a2 } }).then(function() { r2.end(), v.l("".concat(s2, " ok")); var e3, t2 = o2.get(11), n2 = (t2.updateIsReadAfterReadReport({ conversationID: i2, lastMessageSeq: a2 }), true); return A(u2) || (n2 = false, (e3 = o2.get(10).getLocalTopic(c2, u2)) && e3.updateSelfInfo({ readedSequence: a2 })), t2.updateUnreadCount(i2, n2), Sn(); }).catch(function(e3) { return r2.setError(e3).end(), v.l("".concat(s2, " failed. error:"), e3), C(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) : A(n2) ? this.getGroupLastSequence(t2) : Promise.resolve(0); } }, { key: "getGroupLastSequence", value: function(e2) { var t2 = "".concat(this._n, ".").concat("getGroupLastSequence"), n2 = new M("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"), v.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"), v.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"), v.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 Je(e3) ? v.w("".concat(t2, " ").concat(a2, ", empty successGroupList")) : (o2 = e3[0].nextMessageSeq - 1, i2 = "".concat(a2, ", ").concat(o2, " from remote"), v.l("".concat(t2, " ").concat(i2))), n2.setMessage(i2).end(), o2; }).catch(function(e3) { return n2.setError(e3).setMessage(a2).end(), v.w("".concat(t2, " failed. error:"), e3), C(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 !== R.CONV_GROUP; } }, { key: "_onAVChatRoomHistoryMessage", value: function(e2, t2) { var n2; Je(e2) || (v.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 && !Je(t2); } }, { key: "isMessageFromCommunityOfTopic", value: function(e2, t2) { return 2 === e2 && Je(t2); } }, { key: "getMessageExtensions", value: function(e2, t2) { return v.l("".concat(this._n, ".getMessageExtensions startSequence:").concat(t2)), this.req({ P: I.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 v.l("".concat(this._n, ".modifyMsgExts operateType:").concat(n2)), this.req({ P: I.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 * Pe(), i2 = { notifyType: 1, limit: 20, type: kt({ type: i2, groupID: t2 }) ? R.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) { if (!r2.hasLocalGroup(e3)) return false; var e3 = r2.getLocalGroupProfile(e3), t3 = e3.type, e3 = e3.isSupportTopic; return !St(t3) && !e3; }); 0 !== e2.length && (v.l("".concat(t2, " list:").concat(e2)), this.req({ P: I.GET_GRP_NOTIFY, data: { notifyReqList: this._genNotifyReqList(e2) } }).then(function(e3) { var i2, a2, e3 = e3.data.notifyRspList, s2 = []; nt(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 * Pe()); }), v.l(a2), r2.onMsgRevoked(i2, false)), 0 < s2.length && r2.getNotice(s2); }).catch(function(e3) { v.e("".concat(t2, " failed. error:"), e3); })); } }, { key: "_genRevokedInfos", value: function(e2) { var t2 = e2.notifyList, n2 = e2.groupID, o2 = []; return nt(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) { if (!e2) return -1; var t2 = this.getLocalGroupProfile(e2); return t2 && St(t2.type) ? this._AVChatRoomHandler.getPollingTimerID(e2) : -1; } }, { key: "_canIUseJoinOption", value: function(e2) { return e2 === R.GRP_PUBLIC || kt({ type: e2 }); } }, { key: "_silentlyGetGroupProfile", value: function(e2, t2) { var n2 = setTimeout(this.getGroupProfile.bind(this, { groupID: t2 }), 3e3); this._timeoutIDs.push(n2), v.l("".concat(this._n, "._silentlyGetGroupProfile errorCode:").concat(e2, " groupID:").concat(t2, " timeoutIDs:").concat(this._timeoutIDs)); } }, { key: "_clearTimeoutIDs", value: function() { this._timeoutIDs.forEach(function(e2) { 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 li({ groupID: t2, type: R.GRP_LIVE })); return v.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(R.CONV_GROUP).concat(e2)), v.l("".concat(this._n, ".stopMessageLongPolling ok, groupID:").concat(e2)), kn({ 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(); } }]), Ji), Ri = ["topicID", "topicName", "avatar", "introduction", "notification", "unreadCount", "muteAllMembers", "customData", "groupAtInfoList", "nextMessageSeq", "selfInfo"], Ai = (e(ji, [{ key: "_initTopic", value: function(e2) { for (var t2 in e2) Ri.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 = Qo(e2); } }, { key: "updateGroupAtInfoList", value: function(e2) { this.groupAtInfoList = JSON.parse(JSON.stringify(e2)); } }, { key: "updateTopic", value: function(e2) { A(e2.selfInfo) || this.updateSelfInfo(e2.selfInfo), A(e2.muteAllMembers) || (this.muteAllMembers = 1 === e2.muteAllMembers), rt(this, e2, ["groupID", "lastMessageTime", "selfInfo", "muteAllMembers", "lastMsg"]); } }, { key: "updateSelfInfo", value: function(e2) { return 0 === rt(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; } }]), ji), Oi = (t(Wi, Fn), ni = f(Wi), e(Wi, [{ key: "_onCloudConfig", value: function() { var e2 = this.getCloudConfig("topic_cache_time"), t2 = this.getCloudConfig("topic_last_active_time"); A(e2) || (this.TOPIC_CACHE_TIME = Number(e2)), A(t2) || (this.TOPIC_LAST_ACTIVE_TIME = Number(t2)); } }, { key: "onTopicCreated", value: function(e2) { var t2 = e2.groupID; this.resetGetTopicTime(t2), this.emitOEvt(G.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(G.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(G.TOPIC_UPDATED, { groupID: t2, topic: n2 })); } }, { key: "onTopicLatestMsg", value: function(e2) { var t2, n2, e2 = e2 || {}, o2 = e2.topicLatestMessage, e2 = e2.excludedUnreadSequenceList; Je(o2) || (t2 = o2.groupProfile.topicID, o2.conversationType = R.CONV_GROUP, o2.to = t2, (n2 = new Ro(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(G.TOPIC_UPDATED, { groupID: n2, topic: i2 }), v.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 = Kt(t2), t2 = this.getLocalTopic(n2, t2); t2 && !A(e2) && (t2.updateGroupAtInfoList(e2), this.emitOEvt(G.TOPIC_UPDATED, { groupID: n2, topic: t2 })); } }, { key: "onUnreadCountUpdatedFromConv", value: function(e2) { var t2 = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n2 = Kt(e2), e2 = this.getLocalTopic(n2, e2); e2 && e2.unreadCount !== t2 && (e2.updateUnreadCount(t2), 0 === t2 && e2.updateSelfInfo({ readedSequence: e2.lastMessage.lastSequence }), this.emitOEvt(G.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(G.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 = Kt(n2), u2 = this.getLocalTopic(c2, n2); u2 && (t2 = u2.lastMessage, v.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 = Yt(t2.type, t2.payload, this.isIntl()), t2.cloudCustomData = s2, t2.version = r2, t2.lastSequence = i2, t2.lastTime = o2, this.emitOEvt(G.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 = Kt(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(G.TOPIC_UPDATED, { groupID: o2, topic: n2 })); } }, { key: "isLastMessageRevoked", value: function(e2) { var t2 = e2.topicID, e2 = e2.sequence, n2 = Kt(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 = Kt(e2), a2 = this.getLocalTopic(i2, e2); a2 && (o2 = a2.selfInfo.excludedUnreadSequenceList || [], A(n2) || (o2 = n2), t2._isExcludedFromUnreadCount && o2.push(t2.sequence), a2.updateSelfInfo({ excludedUnreadSequenceList: o2 }), v.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(R.CONV_GROUP).concat(e2))) && t2.updateUnreadCount({ nextUnreadCount: o2, isFromGetConversations: true }), this.emitOEvt(G.TOPIC_UPDATED, { groupID: i2, topic: a2 }))); } }, { key: "getJoinedCommunityList", value: function() { return this.get(7).syncCommunityWithTopic(); } }, { key: "createTopicInCommunity", value: function(t2) { var n2 = this, o2 = "".concat(this._n, ".").concat("createTopicInCommunity"), e2 = t2.topicID; if (!A(e2) && !Rt(e2)) return C({ code: T.ILLEGAL_TOPIC_ID }); if (t2.topicName && false === this._filterProfanity("topicName", t2)) return C({ code: T.PROFANITY_FOUND }); if (t2.introduction && false === this._filterProfanity("introduction", t2)) return C({ code: T.PROFANITY_FOUND }); if (t2.notification && false === this._filterProfanity("notification", t2)) return C({ code: T.PROFANITY_FOUND }); var i2 = new M("createTopicInCommunity"); return this.req({ P: I.CREATE_TOPIC, data: y({}, t2) }).then(function(e3) { e3 = e3.data.topicID; return i2.setMessage("topicID:".concat(e3)).end(), v.l("".concat(o2, " ok. topicID:").concat(e3)), n2._updateTopicMap([y(y({}, t2), {}, { topicID: e3 })]), Sn({ topicID: e3 }); }).catch(function(e3) { return i2.setError(e3).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { 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 M("deleteTopicFromCommunity"); return s2.setMessage("groupID:".concat(a2, " topicIDList:").concat(e2)), this.req({ P: I.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(), v.l("".concat(n2, " ok. ").concat(e3)), o2.forEach(function(e4) { t2._deleteLocalTopic(a2, e4.topicID); }), Sn({ successTopicList: o2, failureTopicList: i2 }); }).catch(function(e3) { return s2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "updateTopicProfile", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("updateTopicProfile"); if (v.l("".concat(n2, " options:"), e2), e2.topicName && false === this._filterProfanity("topicName", e2)) return C({ code: T.PROFANITY_FOUND }); if (e2.introduction && false === this._filterProfanity("introduction", e2)) return C({ code: T.PROFANITY_FOUND }); if (e2.notification && false === this._filterProfanity("notification", e2)) return C({ code: T.PROFANITY_FOUND }); var o2 = new M("updateTopicProfile"); return o2.setMessage("groupID:".concat(e2.groupID, " topicID:").concat(e2.topicID)), A(e2.muteAllMembers) || (e2.muteAllMembers = true === e2.muteAllMembers ? "On" : "Off"), this.req({ P: I.UPDATE_TOPIC_PROFILE, data: y({}, e2) }).then(function() { return o2.end(), v.l("".concat(n2, " ok")), t2._updateTopicMap([e2]), Sn({ topic: t2.getLocalTopic(e2.groupID, e2.topicID) }); }).catch(function(e3) { return o2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(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 M("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(), v.l("".concat(n2, " groupID:").concat(o2, " from cache, topic count:").concat(s2.length)), kn({ successTopicList: s2, failureTopicList: [] }); } } return this.req({ P: I.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(), v.l("".concat(n2, " groupID:").concat(o2, " from remote, ").concat(e3)), []); return Je(s3) || (t2._getTopicTimeMap.set(o2, { time: Date.now(), isGetAll: i2 }), e3 = t2._getLocalTopicList(o2, s3)), Sn({ successTopicList: e3, failureTopicList: r2 }); }).catch(function(e3) { return c2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(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 = D(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), v.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 Ai(e3, i2.isIntl()), i2._topicMap.get(t2).set(n2, o2)), i2._computeUnreadCount(o2)); o2.updateUnreadCount(e3), a2.push({ conversationID: "".concat(R.CONV_GROUP).concat(n2), type: R.CONV_TOPIC, unreadCount: e3 }); }), 0 < a2.length && this.get(11).updateTopicConversation(a2); } }, { key: "resetGetTopicTime", value: function(e2) { var t2 = this; A(e2) ? D(this._getTopicTimeMap.keys()).forEach(function(e3) { t2._getTopicTimeMap.set(e3, 0); }) : this._getTopicTimeMap.set(e2, 0); } }, { key: "getTopicListOnReconnected", value: function() { var o2 = this, e2 = D(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 }); }), v.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 M("relayGetTopicList")).setMessage(n2), v.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 = []; A(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; A(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: Je(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(R.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 nt(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 = this.get(29); if (!n2) return true; var n2 = n2.filterText(t2[e2], B), o2 = n2.isAllowedToSend, n2 = n2.modifiedText; return true === o2 && (t2[e2] = n2, true); } }, { key: "getMessageExtensions", value: function(e2, t2) { v.l("".concat(this._n, ".getMessageExtensions startSequence:").concat(t2)); var n2 = Kt(e2.to); return this.req({ P: I.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 = (v.l("".concat(this._n, ".modifyMsgExts operateType:").concat(n2)), Kt(e2.to)); return this.req({ P: I.MODIFY_GRP_MSG_EXT, data: { groupID: o2, topicID: e2.to, messageSequence: e2.sequence, extensionList: t2, operateType: n2 } }); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this._topicMap.clear(), this._getTopicTimeMap.clear(), this.TOPIC_CACHE_TIME = 300, this.TOPIC_LAST_ACTIVE_TIME = 3600; } }]), Wi), Ni = (e(Yi, [{ 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 && (v.w("".concat(n2, " ").concat(zt(100))), o2.length = 100); for (var i2, a2 = [], s2 = [], r2 = 0, l2 = o2.length; r2 < l2; r2++) i2 = o2[r2], this._userM.isMyFriend(i2) && this._contains(i2) ? s2.push(this._getProfileFromMap(i2)) : a2.push(i2); if (0 === a2.length) return kn(s2); e2.toAccount = a2; var d2 = e2.bFromGetMyProfile || false, c2 = [], u2 = (e2.toAccount.forEach(function(e3) { c2.push({ toAccount: e3, standardSequence: 0, customSequence: 0 }); }), e2.userItem = c2, new M("getUserProfile")); return u2.setMessage(5 < o2.length ? "userIDList.length:".concat(o2.length) : "userIDList:".concat(o2)), this._userM.req({ P: I.GET_USER_PROFILE, data: e2 }).then(function(e3) { u2.end(), v.i("".concat(n2, " ok")); e3 = t2._handleResponse(e3).concat(s2); return Sn(d2 ? e3[0] : e3); }).catch(function(e3) { return u2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "getMyProfile", value: function() { var e2, t2 = this._userM.getMyAccount(), n2 = "".concat(this._n, ".getMyProfile"); return v.l("".concat(n2, " myAccount:").concat(t2)), this._fill(), this._contains(t2) ? (e2 = this._getProfileFromMap(t2), v.d("".concat(n2, " from cache, myProfile:").concat(JSON.stringify(e2))), kn(e2)) : this.getUserProfile({ fromAccount: t2, userIDList: [t2], bFromGetMyProfile: true }); } }, { key: "_handleResponse", value: function(e2) { var t2 = e2.data.userProfileItem; if (!nt(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 v.l("".concat(this._n, "._handleResponse cost:").concat(Qt(e2))), n2; } }, { key: "_getLatestProfileFromResponse", value: function(e2, t2) { var n2 = { userID: e2, profileCustomField: [] }; if (!Je(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 qe.NICK: n2.nick = t2[o2].value; break; case qe.GENDER: n2.gender = t2[o2].value; break; case qe.BIRTHDAY: n2.birthday = t2[o2].value; break; case qe.LOCATION: n2.location = t2[o2].value; break; case qe.SELFSIGNATURE: n2.selfSignature = t2[o2].value; break; case qe.ALLOWTYPE: n2.allowType = t2[o2].value; break; case qe.LANGUAGE: n2.language = t2[o2].value; break; case qe.AVATAR: n2.avatar = t2[o2].value; break; case qe.MESSAGESETTINGS: n2.messageSettings = t2[o2].value; break; case qe.ADMINFORBIDTYPE: n2.adminForbidType = t2[o2].value; break; case qe.LEVEL: n2.level = t2[o2].value; break; case qe.ROLE: n2.role = t2[o2].value; break; default: v.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 C({ code: T.PROFANITY_FOUND }); if (o2.selfSignature && false === this._userM.filterProfanity("selfSignature", o2)) return C({ code: T.PROFANITY_FOUND }); var s2 = new M("updateMyProfile"), e2 = (s2.setMessage(JSON.stringify(o2)), new ri().validate(o2)); if (!e2.valid) return s2.setCode(T.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:".concat(e2.tips)).end(), v.e("".concat(a2, " info:").concat(e2.tips)), C({ code: T.UPDATE_PROFILE_INVALID_PARAM }); var t2, 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: qe[t2.toUpperCase()], value: o2[t2] })); if (0 === n2.length) return e2 = new Bn({ code: T.UPDATE_PROFILE_NO_KEY }), s2.setError(e2).end(), v.e("".concat(a2, " failed. error:"), e2), C(e2); var r2 = this._userM.getMyAccount(); return this._userM.req({ P: I.UPDATE_MY_PROFILE, data: { fromAccount: r2, profileItem: n2 } }).then(function(e3) { s2.end(), v.i("".concat(a2, " ok")); var t3 = i2._update(r2, o2), n3 = t3.isProfileUpdated, t3 = t3.latestProfile; return true === n3 && i2._userM.emitOEvt(G.PROFILE_UPDATED, [t3]), kn(t3); }).catch(function(e3) { return s2.setError(e3).end(), v.e("".concat(a2, " failed. error:"), e3), C(e3); }); } }, { key: "onProfileModified", value: function(e2) { var t2 = e2.dataList; if (!Je(t2)) { var n2 = t2.length; v.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(Wo.PROFILE_UPDATED, o2), this._userM.emitOEvt(G.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]); v.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 === Tt(n2.profileCustomField, t2.profileCustomField) && (n2.lastUpdatedTime = i2, o2 = true), 0 < rt(n2, t2, ["profileCustomField"]) && (n2.lastUpdatedTime = i2, o2 = true)) : (n2 = new ri(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 && v.l("".concat(this._n, "._update account:").concat(e2, " isUpdated:").concat(o2)), { isProfileUpdated: o2, latestProfile: n2 }; } }, { key: "_flush", value: function(e2) { var t2 = D(this.accountProfileMap.values()), n2 = this._userM.getStorageModule(); v.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 Je(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 < rt(o2, t2) && i2.push(n2)) : i2.push(t2.userID)); 0 !== i2.length && (v.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 = this, n2 = D(new Set(e2)), o2 = (v.l("".concat(this._n, ".getUserNickAndAvatar userIDList.length:").concat(e2.length, " uniqueUserIDList.length:").concat(n2.length)), []); if (0 === e2.length) return Promise.resolve(o2); var e2 = this._createUserIDListGroup(n2), i2 = []; return e2.forEach(function(e3) { i2.push(t2.getUserProfile({ userIDList: e3 })); }), Promise.all(i2).then(function(e3) { return e3.forEach(function(e4) { e4 = e4.data.map(function(e5) { return { userID: e5.userID, nick: e5.nick, avatar: e5.avatar }; }); o2.push.apply(o2, D(e4)); }), o2; }); } }, { 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(); } }]), Yi), Gi = e(function e2(t2) { d(this, e2); }), Pi = (e(Ki, [{ key: "getLocalBlacklist", value: function() { return D(this._blacklistMap.keys()); } }, { key: "getBlacklist", value: function() { var o2 = this, i2 = "".concat(this._n, ".getBlacklist"), e2 = { fromAccount: this._userM.getMyAccount(), maxLimited: 100, startIndex: this._startIndex }, a2 = new M("getBlacklist"); return this._userM.req({ P: I.GET_BL, data: e2 }).then(function(e3) { var e3 = e3.data, t2 = e3.blackListItem, e3 = e3.startIndex, n2 = Je(t2) ? 0 : t2.length; a2.setMessage("count:".concat(n2)).end(), v.i("".concat(i2, " ok")), o2._startIndex = e3, o2._handleResponse(t2, true), o2._userM.emitOEvt(G.BLACKLIST_UPDATED, D(o2._blacklistMap.keys())), 0 !== o2._startIndex && o2.getBlacklist(); }).catch(function(e3) { return a2.setError(e3).end(), v.e("".concat(i2, " failed. error:"), e3), C(e3); }); } }, { key: "addBlacklist", value: function(t2) { var e2, n2, o2 = this, i2 = new M("addToBlacklist"), a2 = "".concat(this._n, ".addBlacklist"), s2 = this._userM.getMyAccount(); return 1 === t2.userIDList.length && t2.userIDList[0] === s2 ? (n2 = this._userM.getErrMsg(e2 = T.CANNOT_ADD_SELF_TO_BLACKLIST), i2.setCode(e2).setMessage(n2).end(), n2 = new Bn({ code: e2 }), v.e("".concat(a2, " failed. error:"), n2), C(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: I.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(), v.i("".concat(a2, " ok")), o2._handleResponse(e3.resultItem, true), Sn(D(o2._blacklistMap.keys())); }).catch(function(e3) { return i2.setError(e3).end(), v.e("".concat(a2, " failed. error:"), e3), C(e3); })); } }, { key: "_handleResponse", value: function(e2, t2) { if (!Je(e2)) for (var n2, o2, i2, a2 = 0, s2 = e2.length; a2 < s2; a2++) o2 = e2[a2].to, i2 = e2[a2].resultCode, !A(i2) && 0 !== i2 || (t2 ? ((n2 = this._blacklistMap.has(o2) ? this._blacklistMap.get(o2) : new Gi()).userID = o2, Je(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))); v.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 M("removeFromBlacklist"); return t2.fromAccount = this._userM.getMyAccount(), t2.toAccount = t2.userIDList, this._userM.req({ P: I.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(), v.i("".concat(o2, " ok")), n2._handleResponse(e2.data.resultItem, false), Sn(D(n2._blacklistMap.keys())); }).catch(function(e2) { return i2.setError(e2).end(), v.e("".concat(o2, " failed. error:"), e2), C(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 && (v.l("".concat(this._n, ".onAccountDeleted count:").concat(i2, " ").concat(i2 < 30 ? "userIDList:".concat(e2) : "")), this._userM.emitOEvt(G.BLACKLIST_UPDATED, D(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 Gi({ userID: t2 })), n2.push(t2)); 0 < n2.length && (v.l("".concat(this._n, ".onAccountAdded count:").concat(n2.length, " userIDList:"), n2), this._userM.emitOEvt(G.BLACKLIST_UPDATED, D(this._blacklistMap.keys()))); } }, { key: "reset", value: function() { this._blacklistMap.clear(), this._startIndex = 0; } }]), Ki), Ui = (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"); v.l("".concat(this._n, "._onCloudConfig statusQueryCount:").concat(e2, " statusSubscribeCount:").concat(t2) + " statusUnsubscribeCount:".concat(n2)), A(e2) || (this.MAX_QUERY_USER_COUNT = parseInt(e2, 10)), A(e2) || (this.MAX_SUBSCRIBE_USER_COUNT = parseInt(t2, 10)), A(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 = $o(e3); return t2 === o2 && i2.setCustomStatus(e3), { userID: t2, statusType: n2, customStatus: e3 }; }); v.l("".concat(this._n, ".onUserStatusUpdated list:").concat(JSON.stringify(e2))), this._userM.emitOEvt(G.USER_STATUS_UPDATED, e2); } }, { key: "setSelfStatus", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".setSelfStatus"); if (false === this._userM.filterProfanity("customStatus", e2)) return C({ code: T.PROFANITY_FOUND }); var o2 = new M("setSelfStatus"), i2 = e2.customStatus; return this._userM.req({ P: I.SET_SELF_STATUS, data: { customStatus: i2 } }).then(function(e3) { return o2.setMessage("customStatus:".concat(i2)).end(), v.l("".concat(n2, " ok. customStatus:").concat(i2)), t2._userM.get(12).setCustomStatus(i2), Sn({ userID: t2._userM.getMyUserID(), statusType: 1, customStatus: i2 }); }).catch(function(e3) { return o2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(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 = D(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 kn({ successUserList: [a2], failureUserList: [] }); if (!this._userM.canIUse(H.USER_STATUS)) return this._userM.noUse("getUserStatus"); t2.length > this.MAX_QUERY_USER_COUNT && (v.w("".concat(o2, " ").concat(zt(this.MAX_QUERY_USER_COUNT))), t2 = i2.slice(0, this.MAX_QUERY_USER_COUNT)); var s2 = new M("getUserStatus"); return this._userM.req({ P: I.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: $o(e4) }; }), e3 = e3.map(function(e4) { var t4 = e4.userID, n4 = e4.invalidUserID, o3 = e4.errorCode, e4 = e4.errorInfo; return { userID: Je(n4) ? t4 : n4, code: o3, message: e4 }; }), n3 = (A(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(), v.l("".concat(o2, " ok. ").concat(n3, ".")), Sn({ successUserList: t3, failureUserList: e3 }); }).catch(function(e3) { return s2.setMessage("userID count:".concat(i2.length)).setError(e3).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "subscribeUserStatus", value: function(e2) { var t2 = "subscribeUserStatus"; if (!this._userM.canIUse(H.USER_STATUS)) return this._userM.noUse(t2); var n2 = "".concat(this._n, ".").concat(t2), e2 = e2.userIDList, e2 = void 0 === e2 ? [] : e2, o2 = D(e2), i2 = (o2.length > this.MAX_SUBSCRIBE_USER_COUNT && (v.w("".concat(n2, " ").concat(zt(this.MAX_SUBSCRIBE_USER_COUNT))), o2 = e2.slice(0, this.MAX_SUBSCRIBE_USER_COUNT)), new M(t2)), a2 = "userID count:".concat(e2.length); return v.l("".concat(n2, " ").concat(a2)), this._userM.req({ P: I.SUB_USER_STATUS, data: { userIDList: o2 } }).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: Je(n3) ? t3 : n3, code: o3, message: e4 }; }); return i2.setMessage("".concat(a2, " fail count:").concat(e3.length)).end(), v.l("".concat(n2, " ok. fail count:").concat(e3.length, ".")), Sn({ failureUserList: e3 }); }).catch(function(e3) { return i2.setMessage(a2).setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "unsubscribeUserStatus", value: function(e2) { var t2 = "unsubscribeUserStatus"; if (!this._userM.canIUse(H.USER_STATUS)) return this._userM.noUse(t2); var n2 = "".concat(this._n, ".").concat(t2), e2 = (e2 || {}).userIDList, e2 = void 0 === e2 ? [] : e2, o2 = D(e2), i2 = (e2.length > this.MAX_UNSUBSCRIBE_USER_COUNT && (v.w("".concat(n2, " ").concat(zt(this.MAX_UNSUBSCRIBE_USER_COUNT))), o2 = e2.slice(0, this.MAX_UNSUBSCRIBE_USER_COUNT)), new M(t2)), a2 = "userID count:".concat(e2.length), t2 = (v.l("".concat(n2, " ").concat(a2)), { userIDList: o2 }); return 0 === o2.length && (t2.userIDList = void 0, t2.unsubscribeAll = 1), this._userM.req({ P: I.UNSUB_USER_STATUS, data: t2 }).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: Je(n3) ? t3 : n3, code: o3, message: e4 }; }); return i2.setMessage("".concat(a2, " fail count:").concat(e3.length)).end(), v.l("".concat(n2, " ok. fail count:").concat(e3.length, ".")), Sn({ failureUserList: e3 }); }).catch(function(e3) { return i2.setMessage("".concat(a2)).setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "reset", value: function() { this.MAX_QUERY_USER_COUNT = 500, this.MAX_SUBSCRIBE_USER_COUNT = 100, this.MAX_UNSUBSCRIBE_USER_COUNT = 100; } }]), Bi), bi = (t(Hi, Fn), ti = f(Hi), e(Hi, [{ key: "onContextUpdated", value: function(e2) { this._profileHandler.getMyProfile(), this._blacklistHandler.getBlacklist(); } }, { key: "mockOnNickAvatarModified", value: function(e2, t2) { v.l("".concat(this._n, "._mockOnNickAvatarModified nick:").concat(e2, " avatar:").concat(t2)), this.onProfileModified({ dataList: [{ pushType: 1, userID: this.getMyUserID(), profileList: [{ tag: qe.NICK, value: e2 }, { tag: qe.AVATAR, value: t2 }] }] }); } }, { key: "onProfileModified", value: function(e2) { this._profileHandler.onProfileModified(e2); } }, { key: "onRelationChainModified", value: function(e2) { var t2, n2, e2 = e2.dataList; Je(e2) || (t2 = [], e2.forEach(function(e3) { e3.blackListDelAccount && t2.push.apply(t2, D(e3.blackListDelAccount)); }), 0 < t2.length && this._blacklistHandler.onAccountDeleted(t2), n2 = [], e2.forEach(function(e3) { e3.blackListAddAccount && n2.push.apply(n2, D(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 = this.get(29); if (!n2) return true; var n2 = n2.filterText(t2[e2], "user_profile"), o2 = n2.isAllowedToSend, n2 = n2.modifiedText; return true === o2 && (t2[e2] = n2, 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 kn(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() { v.l("".concat(this._n, ".reset")), this._profileHandler.reset(), this._blacklistHandler.reset(), this._userStatusHandler.reset(); } }]), Hi), wi = (e(Vi, [{ 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: "isIndependentDomainDisabled", value: function() { return this._isIndependentDomainDisabled; } }, { 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 Te ? 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 = []; ae && (i2 = Object.keys(ue)); for (var a2 = 0, s2 = (i2 = ce ? ie ? 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 = (ae && !it(ue.createGamePortal) && it(getApp) && !A(getApp()) && (r2 = getApp().globalData, et(r2) && true === r2.isTUIKit && (t2 = true)), true === this._m.get(13).getStorageSync("TIM_".concat(this._SDKAppID, "_isTUIKit")) && (n2 = true), null); if (z && !Q && "undefined" == typeof uni && __wxConfig && (c2 = __wxConfig.pages), Z && "undefined" == typeof uni && __qqConfig && (c2 = __qqConfig.pages), nt(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; } }]), Vi), Fi = { "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 }, qi = (t(xi, Fn), ei = f(xi), e(xi, [{ 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 t2 = this.getMyUserID(), (t2 = this.getErrMsg("RepeatLogin", t2)) && v.w(t2), kn({ actionStatus: "OK", errorCode: 0, errorInfo: t2, repeatLogin: true }); if (Date.now() - this._lastLoginTs <= 15e3) return this.warn("LoggingIn", e2.userID), C({ code: T.REPEAT_LOGIN }); v.l("".concat(this._n, ".login userID:").concat(e2.userID)); var t2 = this._checkLoginInfo(e2); if (0 !== t2.code) return C(t2); var t2 = this.get(12), n2 = e2.userID, e2 = e2.userSig; return t2.setUserID(n2), t2.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 = Fi[g2], g2 = "tuikit"), new M("login")), n2 = (f2.setMessage("".concat(t2)).setMoreMessage("identifier:".concat(this.getMyUserID())), "tuikit" === g2), o2 = 0, n2 = (ie ? o2 = n2 ? 3 === t2 || 4 === t2 || 5 === t2 || 6 === t2 ? 31 : 9 === t2 || 10 === t2 || 11 === t2 || 12 === t2 ? 32 : 4 : 3 : ae ? o2 = X ? 36 : "tuikit" === g2 ? 12 : 11 : ce ? o2 = Te ? "flutter_web_uikit" === g2 ? 21 : 20 : this._isReactUIKit() ? Ce ? 25 : 24 : n2 ? 1 === t2 || 2 === t2 ? 29 : 7 === t2 || 8 === t2 ? 30 : Ce ? 17 : 14 : Ce ? 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: I.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, l2 = o3.tinyID, d2 = o3.helloInterval, a2 = o3.instanceID, s2 = o3.timeStamp, r2 = o3.customStatus, r2 = void 0 === r2 ? "" : r2, p2 = o3.purchaseBits, o3 = o3.authKey, o3 = void 0 === o3 ? "" : o3, c2 = 1e3 * s2, u2 = t3 - f2.getStartTs(), u2 = c2 + parseInt(u2 / 2) - t3, t3 = f2.getStartTs() + u2; if (f2.start(t3), t3 = c2, Ge = u2, (c2 = /* @__PURE__ */ new Date()).setTime(t3), v.i("baseTime from server:".concat(c2, " offset:").concat(Ge)), !l2) throw n3 = new Bn({ code: T.NO_TINYID }), f2.setError(n3).end(), n3; if (!i2) throw n3 = new Bn({ code: T.NO_A2KEY }), f2.setError(n3).end(), n3; t3 = _2.get(21).getSocketID(), c2 = $o(r2), n3 = "socketID:".concat(t3, " scene:").concat(g2, " helloInterval:").concat(d2, " instanceID:").concat(a2, " timeStamp:").concat(s2) + " offset:".concat(u2, " customStatus:").concat(c2, " isWebUniapp:").concat(_2._isWebUniapp), v.l("".concat(m2, " ok. ").concat(n3)), r2 = "", t3 = "", z && it(ue.getAccountInfoSync) && ((s2 = ue.getAccountInfoSync().miniProgram) && (r2 = s2.appId, t3 = s2.envVersion)), f2.setMoreMessage("".concat(n3, " href:").concat(ce ? window.location.href : "", " mpAppId:").concat(r2, " envVersion:").concat(t3, " authKey:").concat(o3)).end(), h2.setA2Key(i2), h2.setTinyID(l2), h2.setStatusInstanceID(a2), h2.setCustomStatus(c2), h2.setDowloadFileAuthKey(o3), p2 && _2.get(27).onPushedConfig({ errorCode: 0, expiredTime: 0, purchaseBits: p2 }), _2.get(20).updateProtocolConfig(), _2.emitIEvt(Wo.A2KEY_AND_TINYID_UPDATED), _2._helloInterval = d2, _2.triggerReady(), u2 = _2.getPushModule(); return u2 && (uni.setStorageSync("timUniAppInstanceID", a2), u2.init()), _2._fetchCloudControlConfig(), _2.get(29).init(), e3; }).catch(function(e3) { return f2.setError(e3).end(true), _2._m.setNotReadyReason(T.LOGIN_FAILED), v.e("".concat(m2, " failed. error:"), e3), _2._lastLoginTs = 0, _2._m.onLoginFailed(), C(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 v.i("".concat(n2, " type:").concat(e2, " isLoggedIn:").concat(o2, " isWebUniapp:").concat(this._isWebUniapp)), o2 ? (new M("logout").setMessage("identifier:".concat(this.getMyUserID())).end(true), 0 === e2 && this._m.setNotReadyReason(T.LOGGED_OUT), this.req({ P: I.LOGOUT, data: { type: e2, isWebUniapp: this._isWebUniapp } }).then(function() { return t2.resetReady(), kn({}); }).catch(function(e3) { return v.e("".concat(n2, " error:"), e3), t2.resetReady(), kn({}); })) : C({ code: T.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: I.HELLO, data: { isWebUniapp: this._isWebUniapp } }).catch(function(e2) { v.w("".concat(t2._n, "._hello error:"), e2); }); } }, { key: "getLastWsHelloTs", value: function() { return this._lastWsHelloTs; } }, { key: "_checkLoginInfo", value: function(e2) { var t2 = 0; return Je(this.get(12).getSDKAppID()) ? t2 = T.NO_SDKAPPID : Je(e2.userID) ? t2 = T.NO_IDENTIFIER : Je(e2.userSig) && (t2 = T.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 M("kickedOut").setMessage("type:".concat(R.KICKED_OUT_MULT_ACCOUNT, " newInstanceInfo:").concat(JSON.stringify(e2))).end(true), v.w("".concat(this._n, ".onMultipleAccountKickedOut userID:").concat(this.getMyUserID(), " newInstanceInfo:"), e2), this.logout(1).then(function() { t2.emitOEvt(G.KICKED_OUT, { type: R.KICKED_OUT_MULT_ACCOUNT }), t2._m.setNotReadyReason(T.KICKED_OUT_MULT_ACCOUNT), t2._m.reset(); }); } }, { key: "onMultipleDeviceKickedOut", value: function(e2) { var t2 = this; new M("kickedOut").setMessage("type:".concat(R.KICKED_OUT_MULT_DEVICE, " newInstanceInfo:").concat(JSON.stringify(e2))).end(true), v.w("".concat(this._n, ".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID(), " newInstanceInfo:"), e2), this.logout(1).then(function() { t2.emitOEvt(G.KICKED_OUT, { type: R.KICKED_OUT_MULT_DEVICE }), t2._m.setNotReadyReason(T.KICKED_OUT_MULT_DEVICE), t2._m.reset(); }); } }, { key: "onUserSigExpired", value: function() { new M("kickedOut").setMessage(R.KICKED_OUT_USERSIG_EXPIRED).end(true), v.w("".concat(this._n, ".onUserSigExpired userID:").concat(this.getMyUserID())), 0 !== this.get(12).getStatusInstanceID() && (this.emitOEvt(G.KICKED_OUT, { type: R.KICKED_OUT_USERSIG_EXPIRED }), this._m.setNotReadyReason(T.KICKED_OUT_USERSIG_EXPIRED), this._m.reset()); } }, { key: "onRestApiKickedOut", value: function(e2) { new M("kickedOut").setMessage("type:".concat(R.KICKED_OUT_REST_API, " newInstanceInfo:").concat(JSON.stringify(e2))).end(true), v.w("".concat(this._n, ".onRestApiKickedOut userID:").concat(this.getMyUserID(), " newInstanceInfo:"), e2), 0 !== this.get(12).getStatusInstanceID() && (this.emitOEvt(G.KICKED_OUT, { type: R.KICKED_OUT_REST_API }), this._m.setNotReadyReason(T.KICKED_OUT_REST_API), this._m.reset(), this.get(21).onRestApiKickedOut()); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this.resetReady(), this._helloInterval = 120, this._lastLoginTs = 0, this._lastWsHelloTs = 0, this._isWebUniapp = 0; } }]), xi); function xi(e2) { return d(this, xi), (e2 = ei.call(this, e2))._n = "SignModule", e2._helloInterval = 120, e2._lastLoginTs = 0, e2._lastWsHelloTs = 0, e2._isWebUniapp = 0, Xo.mixin(h(e2)), e2; } function Vi(e2, t2) { d(this, Vi), this._m = e2, this._isLoggedIn = false, this._SDKAppID = t2.SDKAppID, this._userID = t2.userID || "", this._userSig = t2.userSig || "", this._version = "3.5.2", 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._isIndependentDomainDisabled = t2.disableIndependentDomain, this._isUsingChatCore = false, this._uiPlatform = 0, this._authKey = "", this._customLoginInfo = ""; } function Hi(e2) { return d(this, Hi), (e2 = ti.call(this, e2))._n = "UserModule", e2._profileHandler = new Ni(h(e2)), e2._blacklistHandler = new Pi(h(e2)), e2._userStatusHandler = new Ui(h(e2)), e2.getIEmitInst().on(Wo.A2KEY_AND_TINYID_UPDATED, e2.onContextUpdated, h(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(Wo.CLOUD_CONFIG, this._onCloudConfig, this); } function Ki(e2) { d(this, Ki), this._userM = e2, this._n = "BlacklistHandler", this._blacklistMap = /* @__PURE__ */ new Map(), this._startIndex = 0; } function Yi(e2) { d(this, Yi), this._userM = e2, this._n = "ProfileHandler", this.TAG = "profile", this.accountProfileMap = /* @__PURE__ */ new Map(), this.expirationTime = 864e5; } function Wi(e2) { return d(this, Wi), (e2 = ni.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(Wo.CLOUD_CONFIG, e2._onCloudConfig, h(e2)), e2; } function ji(e2, t2) { d(this, ji), 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 = Qo(e2.lastMessage, t2), this.selfInfo = { muteTime: 0, readedSequence: 0, messageRemindType: "", excludedUnreadSequenceList: void 0 }, this._initTopic(e2); } function Ji(e2) { return d(this, Ji), (e2 = oi.call(this, e2))._n = "GroupModule", e2._commonGroupHandler = new mi(h(e2)), e2._groupAttributesHandler = new vi(h(e2)), e2._groupCountersHandler = new Ii(h(e2)), e2._AVChatRoomHandler = new Ci(h(e2)), e2._groupTipsHandler = new fi(h(e2)), e2._groupSystemNoticeHandler = new Li(h(e2)), e2._groupMemberHandler = new Di(h(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(Wo.CLOUD_CONFIG, e2._onCloudConfig, h(e2)), e2; } function zi(e2) { d(this, zi), this._grpM = e2, this._n = "GroupSystemNoticeHandler", this.pendencyMap = /* @__PURE__ */ new Map(); } function Xi(e2) { d(this, Xi), 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(Wo.PROFILE_UPDATED, this._onProfileUpdated, this); } function Zi(e2) { d(this, Zi), 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 Qi(e2) { d(this, Qi), this._grpM = e2, this._n = "AVChatRoomHandler", this._joinedGroupMap = /* @__PURE__ */ new Map(), this._pollingRequestInfoMap = /* @__PURE__ */ new Map(), this._pollingInstanceMap = /* @__PURE__ */ new Map(), this._seqSll = new ci(200), this._IDSll = new ci(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 $i(e2) { d(this, $i); 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 = I.AV_POLLING; } function ea(e2) { d(this, ea), this._grpM = e2, this._n = "GroupCountersHandler", this._groupCountersMap = /* @__PURE__ */ new Map(), this.EXPIRE_TIME = 3e4, this._grpM.getIEmitInst().on(Wo.CLOUD_CONFIG, this._onCloudConfig, this); } function ta(e2) { d(this, ta), this._grpM = e2, this._n = "GroupAttributesHandler", this._groupAttributesMap = /* @__PURE__ */ new Map(), this._groupAttributesCopy = {}, this.CACHE_EXPIRE_TIME = 3e4, this._grpM.getIEmitInst().on(Wo.CLOUD_CONFIG, this._onCloudConfig, this); } function na(e2) { d(this, na), 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 = Gn, this._pagingGetCostList = [], e2.getIEmitInst().on(Wo.A2KEY_AND_TINYID_UPDATED, this.syncGroupList, this); } function oa(e2) { d(this, oa), this._grpM = e2, this._n = "GroupTipsHandler", this._cachedGroupTipsMap = /* @__PURE__ */ new Map(), this._checkCountMap = /* @__PURE__ */ new Map(), this.MAX_CHECK_COUNT = 4; } function ia(e2) { return d(this, ia), (e2 = ii.call(this, e2))._n = "ConvModule", Xo.mixin(h(e2)), e2._msgListHandler = new jo(h(e2)), e2._msgRemindHandler = new _i(h(e2)), e2._convGroupHandler = new hi(h(e2)), e2._sll = new ci(100), e2._pagingStatus = Gn, 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 aa(e2) { d(this, aa), this._convM = e2, this._n = "ConvGroupHandler", this._convGroupMap = /* @__PURE__ */ new Map(), this._startIndex = 0, this._pagingStatus = Gn; } function sa(e2) { d(this, sa), this._convM = e2, this._n = "MsgRemindHandler"; } function ra(e2, t2) { var n2 = 2 < arguments.length && void 0 !== arguments[2] && arguments[2]; d(this, ra), this.conversationID = e2.conversationID || "", this.unreadCount = e2.unreadCount || 0, this.type = e2.type || "", this.lastMessage = Zo(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 ca(e2) { d(this, ca), 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 ua(e2) { d(this, ua), this.MAX_LENGTH = e2, this.map = /* @__PURE__ */ new Map(); } function la(e2) { var t2 = this; d(this, la), Je(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 || R.ALLOW_TYPE_ALLOW_ANY, this.language = e2.language || 0, this.avatar = e2.avatar || "", this.messageSettings = e2.messageSettings || 0, this.adminForbidType = e2.adminForbidType || R.FORBID_TYPE_NONE, this.level = e2.level || 0, this.role = e2.role || 0, this.lastUpdatedTime = 0, this.profileCustomField = [], Je(e2.profileCustomField) || e2.profileCustomField.forEach(function(e3) { t2.profileCustomField.push({ key: e3.key, value: e3.value }); })); } function da() { return null; } function pa(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: Pe() }; } e(Ta, [{ key: "_errorTolerantHandle", value: function() { ae || "undefined" != typeof window && this._canIUseCookies() || (this.getItem = da, this.setItem = da, this.removeItem = da, this.clear = da); } }, { key: "onCheckTimer", value: function(e2) { e2 % 20 == 0 && 0 !== this._storageQueue.size && this._doFlush(); } }, { key: "_doFlush", value: function() { try { var e2, t2 = N(this._storageQueue); try { for (t2.s(); !(e2 = t2.n()).done; ) { var n2 = m(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) { v.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 v.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 { ae ? ue.clearStorageSync() : this._canIUseCookies() && localStorage.clear(); } catch (e2) { v.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) { v.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; } }), ae && (o2.limitSize = 1024 * ue.getStorageInfoSync().limitSize), e2) o2.size = JSON.stringify(this.getItem(e2)).length + this._getKey(e2).length; else if (ae) ue.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) { v.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) { ae ? ee ? my.setStorageSync({ key: e2, data: t2 }) : ue.setStorageSync(e2, t2) : this._canIUseCookies() && localStorage.setItem(e2, JSON.stringify(t2)); } }, { key: "getStorageSync", value: function(e2) { return ae ? ee ? my.getStorageSync({ key: e2 }).data : ue.getStorageSync(e2) : this._canIUseCookies() ? JSON.parse(localStorage.getItem(e2)) : {}; } }, { key: "_removeStorageSync", value: function(e2) { ae ? ee ? my.removeStorageSync({ key: e2 }) : ue.removeStorageSync(e2) : this._canIUseCookies() && localStorage.removeItem(e2); } }, { key: "_canIUseCookies", value: function() { return "undefined" != typeof window && navigator && navigator.cookieEnabled && localStorage; } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this._doFlush(); } }]); var _a, ha = Ta, ga = (e(Ca, [{ key: "pushIn", value: function(e2) { v.d("".concat(this._n, ".pushIn"), this._report.length, e2), this._report.push(e2); } }, { key: "backfill", value: function(e2) { var t2; nt(e2) && 0 !== e2.length && (v.d("".concat(this._n, ".backfill"), this._report.length, e2.length), (t2 = this._report).unshift.apply(t2, D(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; } }]), Ca), fa = (t(ya, Fn), _a = f(ya), e(ya, [{ key: "reportAtOnce", value: function() { this._report(); } }, { key: "_onLoginSuccess", value: function() { var t2 = this, e2 = this.get(13), n2 = e2.getItem(this.TAG, false); !Je(n2) && it(n2.forEach) && (v.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"); A(e2) || (this.MIN_THRESHOLD = Number(e2)), A(t2) || (this.WAITING_TIME = Number(t2)), A(n2) || (this.REPORT_LEVEL = n2.split(",").map(function(e3) { return Number(e3); })), A(o2) || (this.REPORT_SDKAPPID_BLACKLIST = o2.split(",").map(function(e3) { return Number(e3); })), A(i2) || (this.REPORT_TINYID_WHITELIST = i2.split(",")); } }, { key: "pushIn", value: function(e2) { e2 instanceof M && (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 Ht(this.REPORT_SDKAPPID_BLACKLIST, o2) && !Bt(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: pa(this), event: e2 }, this.req({ P: I.SSO_STAT, data: y({}, e2) }).then(function() { n2._lastReportTime = Date.now(); }).catch(function(e3) { v.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"); Je(t2) ? (v.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)), v.l("".concat(o2, " count:").concat(n2.length)), e2.setItem(this.TAG, n2, true, false)); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this._lastReportTime = 0, this._report(), this.REPORT_SDKAPPID_BLACKLIST = [], this.REPORT_TINYID_WHITELIST = []; } }]), ya), ma = "none", va = "online", Ia = (e(Ma, [{ key: "_startRN", value: function() { var e2, n2 = this; !re || (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"); ae ? (ue.getNetworkType({ success: function(e2) { t2._networkType = e2.networkType || e2.subtype || "", e2.networkType === ma ? v.w("".concat(n2, " no network, please check!")) : v.i("".concat(n2, " networkType:").concat(e2.networkType)); } }), this._mpNetworkStatusCallback = this._onNetworkStatusChange.bind(this), ue.onNetworkStatusChange(this._mpNetworkStatusCallback)) : ce && (this._networkType = va, 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: va }); } }, { key: "_onWebOffline", value: function() { this._onNetworkStatusChange({ isConnected: false, networkType: ma }); } }, { 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 ? (v.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, v.w("".concat(n2, " no network, please check!")), this._m.get(21).offline()), o2 && new M("networkChange").setMessage("isConnected:".concat(t2, " ").concat(i2)).end(); } }, { key: "isOnline", value: function() { return this._networkType !== ma; } }, { key: "getNetworkType", value: function() { return this._networkType; } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), ae ? null !== this._mpNetworkStatusCallback && (ue.offNetworkStatusChange && ue.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)) : re && this._removeListener && (this._removeListener(), this._removeListener = null); } }]), Ma); function Ma(e2) { d(this, Ma), this._m = e2, this._networkType = va, this._n = "NetMonitorModule", this._mpNetworkStatusCallback = null, this._webOnlineCallback = null, this._webOfflineCallback = null, this._removeListener = null, this._m.getIEmitInst().on(Wo.A2KEY_AND_TINYID_UPDATED, this._startRN, this); } function ya(e2) { d(this, ya), (e2 = _a.call(this, e2))._n = "EventStatModule", e2.TAG = "im-ssolog-event", e2._reportBody = new ga(), 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(Wo.A2KEY_AND_TINYID_UPDATED, e2._onLoginSuccess, h(e2)), t2.on(Wo.CLOUD_CONFIG, e2._onCloudConfig, h(e2)), e2; } function Ca(e2) { d(this, Ca), this._n = "SSOLogBody", this._report = []; } function Ta(e2) { d(this, Ta), this._m = e2, this._n = "StorageModule", this._storageQueue = /* @__PURE__ */ new Map(), this._errorTolerantHandle(); } function Da(e2, t2) { return e2(t2 = { exports: {} }, t2.exports), t2.exports; } var Ea, La = Da(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, u2, l2) { var d2 = _2 ? _2 + e3 : e3; if (!this._events[d2]) return false; var i3, a3 = this._events[d2], s2 = arguments.length; if (a3.fn) { switch (a3.once && this.removeListener(e3, a3.fn, void 0, true), s2) { case 1: return a3.fn.call(a3.context), true; case 2: return a3.fn.call(a3.context, t3), true; case 3: return a3.fn.call(a3.context, t3, n3), true; case 4: return a3.fn.call(a3.context, t3, n3, o3), true; case 5: return a3.fn.call(a3.context, t3, n3, o3, u2), true; case 6: return a3.fn.call(a3.context, t3, n3, o3, u2, l2), true; } for (c3 = 1, i3 = new Array(s2 - 1); c3 < s2; c3++) i3[c3 - 1] = arguments[c3]; a3.fn.apply(a3.context, i3); } else for (var r2, p2 = a3.length, c3 = 0; c3 < p2; c3++) switch (a3[c3].once && this.removeListener(e3, a3[c3].fn, void 0, true), s2) { case 1: a3[c3].fn.call(a3[c3].context); break; case 2: a3[c3].fn.call(a3[c3].context, t3); break; case 3: a3[c3].fn.call(a3[c3].context, t3, n3); break; case 4: a3[c3].fn.call(a3[c3].context, t3, n3, o3); break; default: if (!i3) for (r2 = 1, i3 = new Array(s2 - 1); r2 < s2; r2++) i3[r2 - 1] = arguments[r2]; a3[c3].fn.apply(a3[c3].context, i3); } 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]) return this; if (!t3) return c2(this, e3), this; 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); } 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; }), Sa = ["rich.my-imcloud.com", "imrich.qcloud.com"], ka = ["requestSnapshotUrl"], Ra = (t(Ua, Fn), Ea = f(Ua), e(Ua, [{ 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 = ae ? "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 (v.l("".concat(e2, " uploadSizeLimit:").concat(n2, " simpleCos:").concat(o2)), !A(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 (A(o2) || (this.isSimpleCos = "1" === o2), !A(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 M("_getAuthorizationKey"), a2 = Math.ceil(Date.now() / 1e3); this.req({ P: I.COS_SIGN, data: { duration: this.expiredTimeLimit } }).then(function(e2) { var e2 = e2.data, t2 = (v.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(), !ae && 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 }, v.l("".concat(o2, " ok. region:").concat(n2.region, " bucketName:").concat(n2.bucketName)), n2._initUploaderMethod(); }).catch(function(e2) { i2.setError(e2).end(), v.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 M("_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 = I.SIMPLE_COS_PRE_SIG; return this.isSimpleCos || (e2 = { fileType: t2.fileType, fileName: t2.fileName, uploadMethod: t2.uploadMethod, duration: t2.duration }, n2 = I.COS_PRE_SIG), this.req({ P: n2, data: e2 }).then(function(e3) { i2.tryCount = 0; var t3, n3, e3 = e3.data || {}, o2 = (v.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(Qt(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 = T.COS_GET_SIG_FAIL), r2.setError(e3).end(), v.w("".concat(a2, " failed. error:"), e3), i2.tryCount < 1 ? (i2.tryCount++, i2._getCosPreSigUrl(t2)) : (i2.tryCount = 0, C({ code: T.COS_GET_SIG_FAIL })); }); } }, { key: "_initUploaderMethod", value: function() { var n2 = this; if (this.TIMUploadPlugin) return this.timUploadPlugin = new this.TIMUploadPlugin(), void (this._cosUploadMethod = function(e2, t2) { n2.timUploadPlugin.uploadFile(e2, t2); }); this.appid && (this.cos = ae ? new this.COSSDK({ ForcePathStyle: true, getAuthorization: this._getAuthorization.bind(this) }) : new this.COSSDK({ getAuthorization: this._getAuthorization.bind(this) }), this._cosUploadMethod = ae ? 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 R.MSG_IMAGE: return t2.addTotalCount(Zn), this._uploadImage(e2); case R.MSG_FILE: return t2.addTotalCount(Zn), this._uploadFile(e2); case R.MSG_AUDIO: return t2.addTotalCount(Zn), this._uploadAudio(e2); case R.MSG_VIDEO: return t2.addTotalCount(Zn), 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), it(t2.onProgress)) try { t2.onProgress(e3); } catch (e4) { return C({ code: T.MSG_ONPROGRESS_ERR }); } } }).then(function(e3) { var t3 = e3.location, l2 = e3.fileType, d2 = e3.fileSize, n2 = e3.width, o2 = e3.height, p2 = e3.smallImageUrl, _2 = e3.smallImageWidth, h2 = e3.smallImageHeight, g2 = e3.largeImageUrl, f2 = e3.largeImageWidth, m2 = e3.largeImageHeight, i2 = e3.imageInfoArray, e3 = I2.isPrivateNetWork() ? t3 : _t(t3); M2.updateImageFormat(l2); var a2, s2, r2 = { size: d2, url: e3, width: n2, height: o2 }; if (i2 && 0 < i2.length) for (var c2 = 0; c2 < i2.length; c2++) { var u2 = i2[c2]; 1 === u2.type ? a2 = u2 : 2 === u2.type ? s2 = u2 : r2 = y(y({}, r2), u2); } else s2 = p2 && g2 ? (a2 = { url: p2, width: _2, height: h2 }, { url: g2, width: f2, height: m2 }) : (a2 = Ft({ originUrl: e3, originWidth: n2, originHeight: o2, min: 198 }), Ft({ originUrl: e3, originWidth: n2, originHeight: o2, min: 720 })); return M2.updateImageInfoArray([y({}, r2), y({}, s2), y({}, a2)]), 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), it(t2.onProgress)) try { t2.onProgress(e3); } catch (e4) { return C({ code: T.MSG_ONPROGRESS_ERR }); } } }).then(function(e3) { var e3 = e3.location, t3 = e3; return o2.isPrivateNetWork() || (t3 = lo(t3 = _t(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), it(i2.onProgress)) try { i2.onProgress(e3); } catch (e4) { return C({ code: T.MSG_ONPROGRESS_ERR }); } } }).then(function(e3) { e3 = e3.location, e3 = n2.isPrivateNetWork() ? e3 : _t(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), it(t2.onProgress)) try { t2.onProgress(e3); } catch (e4) { return C({ code: T.MSG_ONPROGRESS_ERR }); } } }).then(function(e3) { var t3 = e3.location, e3 = e3.snapshotInfo, t3 = o2.isPrivateNetWork() ? t3 : _t(t3); return i2.updateVideoUrl(t3), Je(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"), C({ code: T["MSG_".concat(e2, "_SIZE_LIMIT")], message: this.getErrMsg("UploadSizeLimit", t2, "".concat(this.UPLOAD_SIZE_LIMIT[e2] / 1048576, "MB")) }); } }, { key: "doUploadImage", value: function(o2) { var i2 = this; if (!o2.file || this._isEmptyFileList(o2.file.files)) return C({ code: T.MSG_I_SELECT_F_FIRST }); var e2 = this._checkImageType(o2.file); if (true !== e2) return e2; e2 = this._checkImageSize(o2.file); if (true !== e2) return e2; var a2 = null; return this._setUploadFileType(1), this.uploadByCOS(o2).then(function(e3) { if (a2 = e3, i2.isPrivateNetWork()) return Pt(n2); if (nt(a2.imageInfoArray)) { var t2 = a2.imageInfoArray.find(function(e4) { return 3 === e4.type; }); if (t2) return t2; } if (re) return { width: o2.file.width, height: o2.file.height }; var n2 = _t(e3.location); return i2.COSSDK ? Pt(n2) : Pt(n2 = lo(n2, i2._fileDownloadProxy, i2._authKey, i2._fileDNList)); }).then(function(e3) { return a2.width = e3.width, a2.height = e3.height, Promise.resolve(a2); }); } }, { key: "_checkImageType", value: function(e2) { var t2 = "", t2 = ae ? e2.url.slice(e2.url.lastIndexOf(".") + 1) : re ? e2.type.split("/")[1] : e2.files[0].name.slice(e2.files[0].name.lastIndexOf(".") + 1); return 0 <= ai.indexOf(t2.toLowerCase()) || C({ code: T.MSG_I_TYPES_LIMIT }); } }, { key: "_checkImageSize", value: function(e2) { return 0 === (e2 = (ae || re ? e2 : e2.files[0]).size) ? C({ code: T.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) ? C({ code: T.MSG_F_SELECT_F_FIRST }) : e2.file.files[0].size > this.UPLOAD_SIZE_LIMIT.F ? this._checkSizeError("F") : 0 === e2.file.files[0].size ? C({ code: T.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 ? C({ code: T.MSG_F_IS_EMPTY }) : -1 === si.indexOf(e2.file.videoFile.type) ? C({ code: T.MSG_V_TYPES_LIMIT }) : (this._setUploadFileType(2), ae || re ? 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 Bn({ code: T.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 ? C({ code: T.MSG_F_IS_EMPTY }) : (this._setUploadFileType(3), this.uploadByCOS(e2)) : C({ code: T.MSG_A_UPLOAD_FAIL }); } }, { key: "uploadByCOS", value: function(t2) { var c2 = this; if (!it(this._cosUploadMethod)) return this.warn("PluginUndetected"), C({ code: T.COS_UNDETECTED }); if (this.timUploadPlugin) return this._uploadWithPreSigUrl(t2); var u2 = new M("upload"), l2 = "".concat(this._n, ".uploadByCOS"), d2 = Date.now(), p2 = this._getFile(t2); return new Promise(function(a2, s2) { var e2 = ae ? c2._createCosOptionsWXMiniApp(t2) : c2._createCosOptionsWeb(t2), r2 = c2; c2._cosUploadMethod(e2, function(e3, t3) { var n2 = /* @__PURE__ */ Object.create(null); if (t3) { if (e3 || nt(t3.files) && t3.files[0].error) return o2 = new Bn({ code: T.MSG_F_UPLOAD_FAIL }), u2.setError(o2).end(), v.l("".concat(l2, " failed. error:"), t3.files[0].error), 403 === t3.files[0].error.statusCode && c2._getAuthorizationKey(), void s2(o2); n2.fileName = p2.name, n2.fileSize = p2.size, n2.fileType = p2.type.slice(p2.type.indexOf("/") + 1).toLowerCase(), n2.location = (ae ? t3 : t3.files[0].data).Location; var o2 = Date.now() - d2, t3 = r2._formatFileSize(p2.size), i2 = r2._formatSpeed(1e3 * p2.size / o2), t3 = "size:".concat(t3, " time:").concat(o2, "ms speed:").concat(i2), i2 = (v.l("".concat(l2, " success. name:").concat(p2.name, " ").concat(t3)), a2(n2), c2.get(26)); return i2.addCost(Zn, o2), i2.addFileSize(Zn, p2.size), void u2.setMessage(t3).end(); } n2 = new Bn({ code: T.MSG_F_UPLOAD_FAIL }); u2.setError(n2).end(), v.w("".concat(l2, " failed. error:"), e3), 403 === e3.statusCode && c2._getAuthorizationKey(), s2(n2); }); }); } }, { 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 M("upload"), e3 = d2.requestSnapshotUrl, c2 = void 0 === e3 ? void 0 : e3, u2 = g(d2, ka), l2 = Date.now(); p2._cosUploadMethod(u2, function(e4, t2) { var n2, o2, i2; return e4 || 403 === t2.statusCode ? (r2.setError(new Bn(e4)).end(), o2 = { HttpStatusCode: 9999, CostTime: Qt(l2, false), error: e4, url: d2.url }, t2.data && t2.data.uploadIP && (o2.uploadIP = t2.data.uploadIP), p2._uploadSSOLog(o2), v.l("".concat(_2, " failed, error:"), e4), void s2(new Bn({ code: T.MSG_F_UPLOAD_FAIL }))) : (n2 = /* @__PURE__ */ Object.create(null), o2 = t2.data.location || "", 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, e4 = Qt(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)), v.l("".concat(_2, " ok. name:").concat(h2.name, " ").concat(o2)), r2.setMessage(o2).end(), i2 = { HttpStatusCode: t2.statusCode, FileSize: h2.size, CostTime: e4, url: d2.url }, t2.data && t2.data.uploadIP && (i2.uploadIP = t2.data.uploadIP), p2._uploadSSOLog(i2), (o2 = p2.get(26)).addCost(Zn, e4), o2.addFileSize(Zn, h2.size), i2 = [], 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 ? Promise.all(i2).then(function() { a2(n2); }) : void a2(n2)); }); }); }); } }, { key: "_getDownloadIP", value: function(e2, n2) { var o2 = "".concat(this._n, "._getDownloadIP"), i2 = Date.now(); return this.req({ P: I.GET_IP, data: { domainName: e2 } }).then(function(e3) { var t2; e3.data && e3.data.ip && (v.l("".concat(o2, " ok. downloadIP:").concat(e3.data.ip, " cost:").concat(Qt(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: I.GET_IMAGE_INFO, data: { imageUrl: t2 } }).then(function(e2) { e2 = e2.data || {}; return v.l("".concat(i2, " ok. data: ").concat(JSON.stringify(e2), " cost:").concat(Qt(a2))), n2.imageInfoArray = e2.imageInfoArray, e2; }).catch(function(e2) { n2.imageInfoArray = void 0, o2._uploadSSOLog({ HttpStatusCode: 1e4, CostTime: Qt(a2, false), url: t2 }); }); } }, { key: "_uploadSSOLog", value: function(e2) { var t2, n2; this.isSimpleCos && ((t2 = new M()).setEventType(18), e2.error && t2.setError(new Bn(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 nt(e2.file.files) || at(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 ? Vt(e2 / 1024, 1) + "KB/s" : Vt(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(lt(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) { v.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 (v.l(JSON.stringify(e3)), "function" == typeof t2.onProgress) try { t2.onProgress(e3.percent); } catch (e4) { v.w("onProgress callback error:", e4); } } }; } }, { key: "_createCosOptionsPreSigUrl", value: function(r2) { var e2, c2 = this, u2 = "", l2 = "", t2 = 0, n2 = this._getFile(r2), t2 = ae || re ? (u2 = r2.message.type === R.MSG_FILE ? (e2 = (e2 = n2.name).slice(e2.lastIndexOf(".")), this._genFileName("".concat(lt(999999)).concat(e2))) : this._genFileName(n2.name), l2 = n2.url, 1) : (e2 = (e2 = n2.name).slice(e2.lastIndexOf(".")), u2 = this._genFileName("".concat(lt(999999)).concat(e2)), l2 = n2, 0); return this._getCosPreSigUrl({ fileType: this.uploadFileType, fileName: u2, uploadMethod: t2, duration: this.duration, userID: r2.message.from, conversationType: At(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) { v.w("onProgress callback error:", e5), v.e(e5); } } }; }); } }, { key: "_genFileName", value: function(e2) { return "".concat(Ut(), "-").concat(e2); } }, { key: "_setUploadFileType", value: function(e2) { this.uploadFileType = e2; } }, { key: "_getSnapshotInfoByUrl", value: function(e2, n2) { var o2 = this, i2 = "_getSnapshotInfoByUrl", a2 = new M(i2); return this.req({ P: I.VIDEO_COVER, data: { platform: this.getPlatform(), coverName: this._genFileName(lt(99999)), requestSnapshotUrl: e2 } }).then(function(e3) { e3 = (e3.data || {}).snapshotUrl; if (v.l("".concat(o2._n, ".").concat(i2, " ok. snapshotUrl:").concat(e3)), a2.setMessage("snapshotUrl:".concat(e3)).end(), Je(e3)) return {}; var t2 = lo(e3, o2._fileDownloadProxy, o2._authKey, o2._fileDNList); return Pt(t2).then(function(e4) { n2.snapshotInfo = { snapshotUrl: t2, snapshotWidth: e4.width, snapshotHeight: e4.height }; }); }).catch(function(e3) { return v.w("".concat(o2._n, ".").concat(i2, " failed. error:"), e3), a2.setCode(e3.errorCode).setMessage(e3.errorInfo).end(), {}; }); } }, { key: "_getSmallImageInfoByUrl", value: function(t2, n2) { return Pt(lo(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 Pt(lo(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 !(!at(e2) || 0 !== e2.length); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")); } }]), Ua), Aa = ["downloadKey", "pbDownloadKey", "messageList"], Oa = (e(Pa, [{ key: "uploadMergerMessage", value: function(e2, n2) { var o2 = "".concat(this._n, ".").concat("uploadMergerMessage"), e2 = (v.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 M("uploadMergerMessage"); return e2.forEach(function(e3) { po(e3.messageBody[0].type, e3.messageBody, t2); }), this._msgM.req({ P: I.UPLOAD_MERGER_MSG, data: { messageList: e2 } }).then(function(e3) { v.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 v.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 = (v.d("".concat(s2, " message:"), i2), i2.payload.downloadKey), r2 = this._msgM.getFileDownloadProxy(), c2 = this._msgM.getDowloadFileAuthKey(), u2 = new M("downloadMergerMessage"); return u2.setMessage("downloadKey:".concat(t2)), this._msgM.req({ P: I.DOWNLOAD_MERGER_MSG, data: { downloadKey: t2 } }).then(function(e2) { v.d("".concat(s2, " ok. response:"), e2.data); var t3, n2, o2 = a2._msgM.get(17).getFileDNList(); return it(i2.clearElement) ? ((t3 = i2.payload).downloadKey, t3.pbDownloadKey, t3.messageList, t3 = g(t3, Aa), i2.clearElement(), i2.setElement({ type: i2.type, content: y({ messageList: e2.data.messageList }, t3) }, r2, c2, o2)) : (n2 = [], e2.data.messageList.forEach(function(e3) { Je(e3) || (e3 = new Lo(e3, r2, c2, o2), n2.push(e3)); }), i2.payload.messageList = n2, i2.payload.downloadKey = "", i2.payload.pbDownloadKey = ""), u2.end(), i2; }).catch(function(e2) { throw v.w("".concat(s2, " failed. key:").concat(t2, " error:"), e2), u2.setError(e2).end(), e2; }); } }, { key: "createMergerMessagePack", value: function(e2, t2, n2) { return e2.conversationType === R.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 = (et(t2) && et(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 = (ft(e2.cloudCustomData) && 0 < e2.cloudCustomData.length && (a2 = e2.cloudCustomData), n2.pbDownloadKey), r2 = n2.downloadKey, n2 = n2.messageNumber, c2 = e2.payload, l2 = c2.title, d2 = c2.abstractList, c2 = c2.compatibleText, u2 = this._msgM.get(6), u2 = u2 && u2.isOnlineMessage(e2, t2) ? 0 : void 0; return { P: I.SEND_C2C_MSG, data: { fromAccount: this._msgM.getMyUserID(), toAccount: e2.to, msgBody: [{ msgType: e2.type, msgContent: { pbDownloadKey: s2, downloadKey: r2, title: l2, abstractList: d2, compatibleText: c2, messageNumber: n2 } }], cloudCustomData: a2, clientTime: e2.clientTime, msgSeq: e2.sequence, msgRandom: e2.random, msgLifeTime: u2, offlinePushInfo: Bo(o2), messageControlInfo: 0 !== u2 ? 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 = (et(t2) && et(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 = (ft(e2.cloudCustomData) && 0 < e2.cloudCustomData.length && (a2 = e2.cloudCustomData), n2.pbDownloadKey), r2 = n2.downloadKey, n2 = n2.messageNumber, c2 = e2.payload, l2 = c2.title, d2 = c2.abstractList, c2 = c2.compatibleText, u2 = this._msgM.get(7), t2 = u2 && u2.isOnlineMessage(e2, t2) ? 1 : 0; return { P: I.SEND_GRP_MSG, data: { fromAccount: this._msgM.getMyUserID(), groupID: e2.to, msgBody: [{ msgType: e2.type, msgContent: { pbDownloadKey: s2, downloadKey: r2, title: l2, abstractList: d2, compatibleText: c2, messageNumber: n2 } }], random: e2.random, priority: e2.priority, clientSequence: e2.clientSequence, groupAtInfo: void 0, cloudCustomData: a2, onlineOnlyFlag: t2, offlinePushInfo: Bo(o2), clientTime: e2.clientTime, needReadReceipt: true !== e2.needReadReceipt || u2.isMessageFromOrToAVChatroom(e2.to) ? 0 : 1, messageControlInfo: 0 == t2 ? i2 : void 0, isSupportExtension: true === e2.isSupportExtension ? 1 : 0, isRelayMessage: true === e2._relayFlag ? 1 : 0 } }; } }]), Pa), Na = { 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 }, Ga = [T.MSG_ONPROGRESS_ERR, T.MSG_I_SELECT_F_FIRST, T.MSG_I_TYPES_LIMIT, T.MSG_F_IS_EMPTY, T.MSG_I_SIZE_LIMIT, T.MSG_F_SELECT_F_FIRST, T.MSG_F_SIZE_LIMIT, T.MSG_V_SIZE_LIMIT, T.MSG_V_TYPES_LIMIT, T.MSG_A_UPLOAD_FAIL, T.MSG_A_SIZE_LIMIT, T.COS_UNDETECTED]; function Pa(e2) { d(this, Pa), this._n = "MergerMessageHandler", this._msgM = e2; } function Ua(e2) { d(this, Ua), (e2 = Ea.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 = Sa; var t2 = e2.getIEmitInst(); return t2.on(Wo.A2KEY_AND_TINYID_UPDATED, e2._init, h(e2)), t2.on(Wo.CLOUD_CONFIG, e2._onCloudConfig, h(e2)), e2; } function ba(e2) { var t2 = false; return Object.values(Na).includes(e2) && (t2 = true), t2 = 120001 <= e2 && e2 <= 13e4 || 10100 <= e2 && e2 <= 10200 ? true : t2; } t(ts, Fn), Ha = f(ts), e(ts, [{ key: "createTextMessage", value: function(e2) { var t2 = this.getMyUserID(), n2 = (e2.currentUser = t2, e2.senderTinyID = this.getMyTinyID(), new Ro(e2)), e2 = ft(e2.payload) ? e2.payload : e2.payload.text, e2 = new ao({ 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 Ro(e2)); if (ae) { var o2 = e2.payload.file; if (Ze(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 re ? (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 && (Ze(e2.payload.file) ? (i2 = e2.payload.file, e2.payload.file = { files: [i2] }) : et(e2.payload.file) && "undefined" != typeof uni && (o2 = e2.payload.file.tempFiles[0], e2.payload.file = { files: [o2] })); i2 = new go({ imageFormat: Fe.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 = (ae && (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), re && (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, Je(t2.uri) && this.warn("VoiceFileInRN")), this.getMyUserID()), o2 = (e2.currentUser = n2, e2.senderTinyID = this.getMyTinyID(), new Ro(e2)), t2 = new mo({ second: Math.floor(t2.duration / 1e3), size: t2.fileSize || t2.size || 1, url: t2.tempFilePath || t2.uri, 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 (ae) { if (ee) return void this.warn("VideoUnsupportedInAlipay"); if (Ze(e2.payload.file)) return void this.warn("FileUnsupportedInMP", "createVideoMessage"); var o2 = e2.payload.file; nt(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 re ? (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 && (Ze(e2.payload.file) ? (o2 = e2.payload.file, e2.payload.file.files = [o2]) : et(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 Ro(e2), n2 = new Do({ videoFormat: n2.type, videoSecond: Vt(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 Ro(e2)), e2 = new To({ 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 Ro(e2)), e2 = new fo(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 Ro(e2), e2 = new So(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 = e2.to, n2 = e2.conversationType, o2 = e2.priority, i2 = e2.payload, a2 = e2.needReadReceipt, s2 = e2.receiverList; if (!nt(i2._elements)) return C({ code: T.MSG_FORWARD_INVALID_ELEMENTS }); var r2 = this.getMyUserID(), c2 = this._getNickAndAvatarByUserID(r2); if (i2.type === R.MSG_GRP_TIP) return C({ code: T.MSG_FORWARD_TYPE_INVALID }); n2 = { to: t2, conversationType: n2, conversationID: "".concat(n2).concat(t2), priority: o2, isPlaceMessage: 0, status: An, currentUser: r2, senderTinyID: this.getMyTinyID(), cloudCustomData: e2.cloudCustomData || i2.cloudCustomData || "", needReadReceipt: a2, receiverList: s2, isSupportExtension: e2.isSupportExtension || false }, t2 = new Ro(n2); return t2.setElement(i2._elements[0]), t2.setNickAndAvatar(c2), t2.setNameCard(this._getNameCardByGroupID(i2)), t2.setRelayFlag(true), t2; } }, { key: "downloadMergerMessage", value: function(e2) { return this._mergerMessageHandler.downloadMergerMessage(e2); } }, { key: "createFileMessage", value: function(e2) { if (ae) { if (!z && !Z && !ne) return; var t2 = ue.getSystemInfoSync().SDKVersion; if (z && wt(t2, "2.5.0") < 0) return void this.warn("WXChooseMessageFile"); if (Z && wt(t2, "1.18.0") < 0) return void this.warn("QQChooseMessageFile"); } ce || ne ? Ze(e2.payload.file) ? (t2 = e2.payload.file, e2.payload.file = { files: [t2] }) : et(e2.payload.file) && "undefined" != typeof uni && (o2 = (t2 = e2.payload.file).tempFiles, t2 = t2.files, n2 = null, nt(o2) ? n2 = o2[0] : nt(t2) && (n2 = t2[0]), e2.payload.file = { files: [n2] }) : z || Z ? (t2 = y(y({}, (o2 = e2.payload.file.tempFiles)[0]), {}, { url: o2[0].path }), e2.payload.file = { files: [t2] }) : re && (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 Ro(e2)), o2 = new Co({ 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 Ro(e2)), e2 = new Eo(e2.payload), t2 = this._getNickAndAvatarByUserID(t2); return n2.setElement(e2), n2.setNickAndAvatar(t2), n2.setNameCard(this._getNameCardByGroupID(n2)), n2; } }, { key: "_onNoModule", value: function() { return C({ code: T.NO_MODULE }); } }, { key: "sendMessageInstance", value: function(a2, s2) { var r2 = this; if (false === this.get(29).filterMessage(a2, s2)) return a2.hasRiskContent = true, this._onSendMessageFailed(a2, new Bn({ code: T.PROFANITY_FOUND })); var t2 = null; if (a2.conversationType === R.CONV_C2C) t2 = this.get(6); else { if (a2.conversationType !== R.CONV_GROUP) return C({ code: T.MSG_INVALID_CONV_TYPE }); t2 = this.get(7); } if (!t2) return this._onNoModule(); var c2, u2 = "".concat(this._n, ".sendMessageInstance"), l2 = this.get(11), d2 = t2.isOnlineMessage(a2, s2); return this.get(17).upload(a2).then(function() { return r2._getSendMessageSpecifiedKey(a2) === Xn && r2.get(26).addSuccessCount(Zn), r2._guardForGroup(a2).then(function() { if (!a2.isSendable()) return C({ code: T.MSG_F_URL_IS_EMPTY }); r2._addSendMessageTotalCount(a2), c2 = Date.now(); var e2 = function(e3) { var t3 = "utf-8"; ce && document && (t3 = document.charset.toLowerCase()); var n2, o2 = 0, i2 = e3.length; if ("utf-8" === t3 || "utf8" === t3) for (var a3 = 0; a3 < i2; 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 < i2; s3++) (n2 = e3.codePointAt(s3)) <= 65535 ? o2 += 2 : (o2 += 4, s3++); else o2 = e3.replace(/[^\x00-\xff]/g, "aa").length; return o2; }(JSON.stringify(a2)); return a2.type === R.MSG_MERGER && 11264 < e2 ? r2._mergerMessageHandler.uploadMergerMessage(a2, e2).then(function(e3) { e3 = r2._mergerMessageHandler.createMergerMessagePack(a2, s2, e3); return r2.req(e3); }) : (l2.setMessageRandom(a2), t2.sendMessage(a2, s2)); }).then(function(e2) { var t3, e2 = e2.data, n2 = e2.time, o2 = e2.sequence, i2 = e2.readReceiptCode, e2 = e2.messageDropReason, i2 = (Qe(i2) && 0 !== i2 && (new M("sendMessageWithReceipt").setMessage("from:".concat(a2.from, " to:").concat(a2.to, " sequence:").concat(o2, " readReceiptCode:").concat(i2)).end(), v.w("".concat(u2, " readReceiptCode:").concat(i2, " message:").concat(r2.getErrMsg(i2)))), e2 && (i2 = new M("messageDropReason"), e2 = "from:".concat(a2.from, " to:").concat(a2.to, " sequence:").concat(o2, " messageDropReason:").concat(e2), i2.setMessage(e2).end(), v.w("".concat(u2, " ").concat(e2))), r2._addSendMessageSuccessCount(a2, c2), r2._messageOptionsMap.delete(a2.clientSequence), true === a2.isResend && (t3 = l2.findMessage(a2.ID)) && (v.l("".concat(u2, " resend ok. ID:").concat(t3.ID)), l2.deleteLocalMessage(t3)), a2.status = On, a2.time = n2, false); return a2.conversationType === R.CONV_GROUP ? a2.sequence = o2 : a2.conversationType !== R.CONV_C2C || (e2 = l2.getLatestMessageSentByMe(a2.conversationID)) && (t3 = e2.nick, n2 = e2.avatar, t3 === a2.nick && n2 === a2.avatar || (i2 = true)), i2 && l2.modifyMessageSentByMe({ conversationID: a2.conversationID, latestNick: a2.nick, latestAvatar: a2.avatar }), true === d2 ? a2._onlineOnlyFlag = true : (l2.appendToMessageList(a2), o2 = a2, et(s2) && et(s2.messageControlInfo) && (true === s2.messageControlInfo.excludedFromLastMessage && (a2._isExcludedFromLastMessage = true, o2 = ""), true === s2.messageControlInfo.excludedFromUnreadCount && (a2._isExcludedFromUnreadCount = true)), e2 = a2.conversationType, Rt(a2.to) && (e2 = R.CONV_TOPIC, r2.get(10).onMessageSent({ groupID: Kt(a2.to), topicID: a2.to, lastMessage: o2 })), l2.onMessageSent({ conversationOptionsList: [{ conversationID: a2.conversationID, unreadCount: 0, type: e2, subType: a2.conversationSubType, lastMessage: o2 }] })), a2._relayFlag || "TIMImageElem" !== a2.type || qt(a2.payload.imageInfoArray), Sn({ message: a2 }); }); }).catch(function(e2) { return r2._onSendMessageFailed(a2, e2, d2); }); } }, { key: "_guardForGroup", value: function(e2) { if (e2.conversationType !== R.CONV_GROUP) return Promise.resolve(); var t2 = this.get(7); if (!t2) return this._onNoModule(); if (kt({ groupID: e2.to })) { var n2 = t2.getLocalGroupProfile(e2.to); if (n2 && n2.isSupportTopic) return C({ code: T.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 = Nn, 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) && v.l("".concat(o2, " message stored, ID:").concat(e2.ID)), this._addSendMessageFailCountOnUser(e2, t2), new M("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(), v.e("".concat(o2, " ").concat(a2, " error:"), t2), C(new Bn({ code: t2 && t2.code ? t2.code : T.MSG_SEND_FAIL, message: t2 && t2.message ? t2.message : void 0, data: { message: e2 } })); } }, { key: "_getSendMessageSpecifiedKey", value: function(e2) { if ([R.MSG_IMAGE, R.MSG_AUDIO, R.MSG_VIDEO, R.MSG_FILE].includes(e2.type)) return Xn; if (e2.conversationType === R.CONV_C2C) return jn; if (e2.conversationType === R.CONV_GROUP) { var t2 = this.get(7); if (t2) { t2 = t2.getLocalGroupProfile(e2.to); if (t2) return e2 = t2.type, St(e2) ? zn : Jn; } } } }, { 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, Qt(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 === Xn && (n2 = false, n2 = Ga.includes(t2) ? true : n2) ? o2.addFailedCountOfUserSide(Zn) : ba(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 t2 = this, e2 = null; if (n2.conversationType === R.CONV_C2C ? e2 = this.get(6) : n2.conversationType === R.CONV_GROUP && (e2 = this.get(7)), !e2) return this._onNoModule(); var o2 = new M("revokeMessage"), i2 = (o2.setMessage("type:".concat(n2.type, " from:").concat(n2.from, " to:").concat(n2.to)), "".concat(this._n, ".").concat("revokeMessage")); return e2.revokeMessage(n2).then(function(e3) { var e3 = e3.data.recallRetList; return Je(e3) || 0 === e3[0].retCode ? (v.i("".concat(i2, " ok. ID:").concat(n2.ID)), n2.isRevoked = true, o2.end(), t2.get(11).onMessageRevoked([n2]), Sn({ message: n2 })) : (e3 = new Bn({ code: e3[0].retCode, data: { message: n2 } }), o2.setCode(e3.code).setMoreMessage(e3.message).end(), C(e3)); }).catch(function(e3) { o2.setError(e3).end(); var t3 = new Bn({ code: e3 && e3.code ? e3.code : T.MSG_REVOKE_FAIL, message: e3 && e3.message ? e3.message : void 0, data: { message: n2 } }); return v.w("".concat(i2, " failed. error:"), e3), C(t3); }); } }, { key: "deleteMessage", value: function(e2) { var t2 = this, n2 = null, o2 = e2[0], i2 = o2.conversationID, a2 = "", s2 = [], r2 = []; if (o2.conversationType === R.CONV_C2C) n2 = this.get(6), a2 = i2.replace(R.CONV_C2C, ""), e2.forEach(function(e3) { e3 && e3.status === On && e3.conversationID === i2 && (e3._onlineOnlyFlag || s2.push("".concat(e3.sequence, "_").concat(e3.random, "_").concat(e3.time)), r2.push(e3)); }); else if (o2.conversationType === R.CONV_GROUP) n2 = this.get(7), a2 = i2.replace(R.CONV_GROUP, ""), e2.forEach(function(e3) { e3 && e3.status === On && e3.conversationID === i2 && (e3._onlineOnlyFlag || s2.push("".concat(e3.sequence)), r2.push(e3)); }); else if (o2.conversationType === R.CONV_SYSTEM) return C({ code: T.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 M("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(), v.i("".concat(u2, " ok")), t2._onMessageDeleted(r2); }).catch(function(e3) { c2.setError(e3).end(), v.w("".concat(u2, " failed. error:"), e3); e3 = new Bn({ code: e3 && e3.code ? e3.code : T.MSG_DELETE_FAIL, message: e3 && e3.message ? e3.message : void 0 }); return C(e3); }); } }, { key: "_onMessageDeleted", value: function(e2) { return this.get(11).onMessageDeleted(e2), kn({ 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 M("translateText"); return i2.setMessage("sourceLanguage:".concat(n2, " targetLanguage:").concat(e2)), this.req({ P: I.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(), v.i("".concat(o2, " ok. requestID:").concat(n3)), Sn({ translatedTextList: e3 }); throw y(y({}, t3), {}, { requestID: n3 }); }).catch(function(e3) { return i2.setCode(e3.code).setMoreMessage(e3.requestID).end(), v.w("".concat(o2, " failed. error:"), e3), C({ code: T.TRANSLATE_TEXT_FAIL }); }); } }, { key: "convertVoiceToText", value: function(e2) { var t2 = e2.message, e2 = e2.language, n2 = t2.payload.url, t2 = (t2.from === this.getMyUserID() && "out" === t2.flow && (n2 = t2.payload.remoteAudioUrl), /\.(wav|pcm|ogg-opus|speex|silk|mp3|m4a|aac|amr)/); if (!t2.test(n2)) return C({ code: T.UNSUPPORTED_VOICE_FORMAT }); var t2 = t2.exec(n2)[1] || "mp3", o2 = "16k_zh-PY", e2 = (e2 ? "zh (cmn-Hans-CN)" === e2 ? o2 = "16k_zh" : "en-US" === e2 ? o2 = "16k_en" : "yue-Hant-HK" === e2 ? o2 = "16k_yue" : "ja-JP" === e2 && (o2 = "16k_ja") : o2 = "16k_zh-PY", "serviceType:".concat(o2, " url:").concat(n2)), i2 = "".concat(this._n, ".").concat("convertVoiceToText"), a2 = (v.i("".concat(i2, " ").concat(e2)), new M("convertVoiceToText")); return a2.setMessage(e2), this.req({ P: I.VOICE_TO_TEXT, data: { url: n2, language: o2, SDKAppID: this.getSDKAppID(), format: t2 } }).then(function(e3) { var e3 = e3.data, t3 = e3.error, n3 = e3.requestID, e3 = e3.result; if (0 === t3.code) return a2.end(), v.i("".concat(i2, " ok. requestID:").concat(n3)), Sn({ result: e3 }); throw y(y({}, t3), {}, { requestID: n3 }); }).catch(function(e3) { return a2.setCode(e3.code).setMoreMessage(e3.requestID || "").end(), v.w("".concat(i2, " failed. error:"), e3), C({ code: T.VOICE_TO_TEXT_FAIL }); }); } }, { key: "modifyRemoteMessage", value: function(n2) { var o2 = this; if (false === this.get(29).filterMessage(n2)) return n2.hasRiskContent = true, C({ code: T.PROFANITY_FOUND, data: { message: n2 } }); var e2 = null, t2 = n2.conversationType, i2 = n2.to; if (t2 === R.CONV_C2C) e2 = this.get(6); else if (t2 === R.CONV_GROUP) { if (!(e2 = this.get(7))) return this._onNoModule(); if (e2.isMessageFromOrToAVChatroom(i2)) return C({ code: T.MSG_MODIFY_DISABLED_IN_AV, data: { message: n2 } }); } var a2 = new M("modifyMessage"), s2 = (a2.setMessage("to:".concat(i2)), "".concat(this._n, ".modifyRemoteMessage")); return e2.modifyRemoteMessage(n2).then(function(e3) { a2.end(), v.i("".concat(s2, " ok")); e3 = o2._onModifyRemoteMessageResp(n2, e3.data); return Sn({ message: e3 }); }).catch(function(e3) { var t3; return a2.setCode(e3.code).setMoreMessage(e3.message).end(), v.w("".concat(s2, " failed. error:"), e3), 20027 === e3.code ? (t3 = o2._onModifyRemoteMessageResp(n2, e3.data), C({ code: T.MSG_MODIFY_CONFLICT, data: { message: t3 } })) : C({ code: e3.code, message: e3.message, data: { message: n2 } }); }); } }, { key: "_onModifyRemoteMessageResp", value: function(e2, t2) { v.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(dt()), 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 === R.CONV_GROUP) { var t2 = this.get(7); if (t2) return t2.getMyNameCardByGroupID(e2.to); } return ""; } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this._messageOptionsMap.clear(); } }]); var wa, Fa, qa, xa, Va, Ha, Ba = ts, Ka = (t(es, Fn), Va = f(es), e(es, [{ key: "onMsgExtNotify", value: function(e2) { var o2 = this, e2 = e2.dataList, t2 = e2.messageInfo, i2 = e2.operateType, n2 = e2.operateResultList, l2 = e2.tinyID, e2 = e2.globalSequence, d2 = t2.clientTime, t2 = t2.random, a2 = "".concat(l2, "-").concat(d2, "-").concat(t2), s2 = [], r2 = [], c2 = (v.l("".concat(this._n, ".onMsgExtNotify messageID:").concat(a2, " operateType:").concat(i2, " globalSequence:").concat(e2)), this._updateGlobalSeq(a2, e2), false), u2 = false; n2.forEach(function(e3) { var t3 = e3.extensions, t3 = void 0 === t3 ? [] : t3, n3 = e3.clearSequence; 1 === i2 ? (c2 = true, t3.forEach(function(e4) { s2.push({ key: e4.key, value: e4.value }); }), o2._updateLocalExt(a2, t3)) : 2 === i2 ? (u2 = true, t3.forEach(function(e4) { r2.push(e4.key); }), o2._updateLocalExt(a2, t3)) : 3 === i2 && (u2 = true, o2._hasLocalExt(a2) && o2._getLocalExt(a2).forEach(function(e4, t4) { e4.seq <= n3 && !Je(e4.value) && r2.push(t4); }), o2._clearLocalExt(a2, n3)); }), c2 && this.emitOEvt(G.MESSAGE_EXTENSIONS_UPDATED, { messageID: a2, extensions: s2 }), u2 && this.emitOEvt(G.MESSAGE_EXTENSIONS_DELETED, { messageID: a2, keyList: r2 }); } }, { key: "setMessageExtensions", value: function(e2, t2) { var n2 = "setMessageExtensions"; if (!this.canIUse(H.MSG_EXT)) return this.noUse(n2); var o2 = "".concat(this._n, ".").concat(n2), i2 = e2.ID, a2 = e2.conversationID, s2 = e2.sequence, r2 = e2.time, c2 = D(t2), t2 = (20 < t2.length && (c2 = t2.slice(0, 20), v.w("".concat(o2, ". the length of extensions cannot exceed 20."))), "convID:".concat(a2, " messageID:").concat(i2, " sequence:").concat(s2, " time:").concat(r2, " count:").concat(c2.length)), u2 = new M(n2); return u2.setMessage(t2), v.l("".concat(o2, " ").concat(t2)), this._modifyMsgExts(e2, c2).then(function(e3) { var t3 = e3.resultList, n3 = e3.successCount, e3 = e3.failureCount, n3 = "successCount:".concat(n3, " failCount:").concat(e3); return u2.setMoreMessage(n3).end(), v.l("".concat(o2, " ok. ").concat(n3)), Sn({ extensions: t3 }); }).catch(function(e3) { return u2.setError(e3).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "getMessageExtensions", value: function(e2) { var t2 = this, n2 = "getMessageExtensions"; if (!this.canIUse(H.MSG_EXT)) return this.noUse(n2); var o2 = "".concat(this._n, ".").concat(n2), i2 = e2.ID, a2 = e2.conversationID, s2 = e2.sequence, r2 = e2.time, a2 = "convID:".concat(a2, " messageID:").concat(i2, " sequence:").concat(s2, " time:").concat(r2), c2 = new M(n2), u2 = (c2.setMessage(a2), v.l("".concat(o2, " ").concat(a2)), void 0); return this.getMsgExtsMap.has(i2) && (u2 = this._getGlobalSeq(i2)), this._getMsgExts(e2, u2).then(function(e3) { return c2.end(), v.l("".concat(o2, " ok. extCount:").concat(e3.length)), A(u2) && 0 < e3.length && t2.getMsgExtsMap.set(i2, 1), Sn({ extensions: e3 }); }).catch(function(e3) { return c2.setError(e3).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "deleteMessageExtensions", value: function(e2, t2) { var n2 = "deleteMessageExtensions"; if (!this.canIUse(H.MSG_EXT)) return this.noUse(n2); var i2 = "".concat(this._n, ".").concat(n2), o2 = [], a2 = 3, t2 = (Je(t2) || (a2 = 2, t2.forEach(function(e3) { o2.push({ key: e3, value: "", seq: 0 }); })), e2.ID), s2 = e2.conversationID, r2 = e2.sequence, c2 = e2.time, s2 = "convID:".concat(s2, " messageID:").concat(t2, " sequence:").concat(r2, " time:").concat(c2, " operateType:").concat(a2), u2 = new M(n2); return u2.setMessage(s2), v.l("".concat(i2, " ").concat(s2)), this._modifyMsgExts(e2, o2, 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)), u2.setMoreMessage("".concat(o3)).end(), v.l("".concat(i2, " ok. ").concat(o3)), Sn({ extensions: t3 }); }).catch(function(e3) { return u2.setError(e3).end(), v.e("".concat(i2, " failed. error:"), e3), C(e3); }); } }, { key: "_modifyMsgExts", value: function(n2, e2) { var o2 = this, t2 = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, i2 = Rt(n2.to) ? R.CONV_TOPIC : n2.conversationType, a2 = void 0, s2 = (3 !== t2 && (a2 = this._getReqExts(n2, e2)), null); switch (i2) { case R.CONV_C2C: s2 = this.get(6); break; case R.CONV_GROUP: s2 = this.get(7); break; case R.CONV_TOPIC: s2 = this.get(10); break; default: return C({ code: T.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 = Je(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 C(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 (Rt(t2) ? R.CONV_TOPIC : i2.conversationType) { case R.CONV_C2C: n2 = this.get(6); break; case R.CONV_GROUP: n2 = this.get(7); break; case R.CONV_TOPIC: n2 = this.get(10); break; default: return C({ code: T.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 = Je(t3) ? [] : t3; return v.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 C(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; Je(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() { v.l("".concat(this._n, ".reset")), this.msgExtMap.clear(), this.globalSeqMap.clear(), this.getMsgExtsMap.clear(); } }]), es), Ya = (t($a, Fn), xa = f($a), e($a, [{ 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) { A(e4.userIDList) && (e4.userIDList = [], e4.count = 0), i2.push.apply(i2, D(e4.userIDList)); }), v.l("".concat(a2._n, ".onReactionNotifyList messageID:").concat(n2, " reactionList:").concat(e3.length)), a2._handleReactionSummary([{ messageID: n2, reactionList: e3 }], i2).then(function(e4) { a2.emitOEvt(G.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 = (v.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(G.MESSAGE_REACTIONS_UPDATED, { messageID: n2, reactionList: [t2] })); } }, { key: "addMessageReaction", value: function(t2, n2) { var o2 = this, e2 = "addMessageReaction"; if (!this.canIUse(H.MSG_REACTION)) return this.noUse(e2); var i2 = "".concat(this._n, ".").concat(e2), a2 = t2.ID, s2 = t2.conversationID, s2 = "convID:".concat(s2, " messageID:").concat(a2, " reactionID:").concat(n2), r2 = new M(e2), a2 = (r2.setMessage(s2), v.l("".concat(i2, " ").concat(s2)), this._createReactionOperationPack(t2, n2, 1)); return this._addReactedByMyselfMap(t2.ID, n2), this.req(a2).then(function() { return r2.end(), v.l("".concat(i2, " ok.")), Sn(); }).catch(function(e3) { return o2._removeReactedByMyselfMap(t2.ID, n2), r2.setError(e3).end(), v.e("".concat(i2, " failed. error:"), e3), C(e3); }); } }, { key: "removeMessageReaction", value: function(e2, t2) { var n2 = "removeMessageReaction"; if (!this.canIUse(H.MSG_REACTION)) return this.noUse(n2); var o2 = "".concat(this._n, ".").concat(n2), i2 = e2.ID, a2 = e2.conversationID, a2 = "convID:".concat(a2, " messageID:").concat(i2, " reactionID:").concat(t2), s2 = new M(n2), i2 = (s2.setMessage(a2), v.l("".concat(o2, " ").concat(a2)), this._createReactionOperationPack(e2, t2, 2)); return this._removeReactedByMyselfMap(e2.ID, t2), this.req(i2).then(function() { return s2.end(), v.l("".concat(o2, " ok.")), Sn(); }).catch(function(e3) { return s2.setError(e3).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "getMessageReactions", value: function(e2) { var t2 = this, n2 = "getMessageReactions"; if (!this.canIUse(H.MSG_REACTION)) return this.noUse(n2); var o2 = "".concat(this._n, ".").concat(n2), i2 = e2.messageList, a2 = e2.maxUserCountPerReaction, s2 = i2[0].conversationID, s2 = "convID:".concat(s2, " maxUserCountPerReaction:").concat(a2, " msgCount:").concat(i2.length), r2 = new M(n2), c2 = (r2.setMessage(s2), v.l("".concat(o2, " ").concat(s2)), /* @__PURE__ */ new Map()), a2 = this._createReactionSummaryPack(y(y({}, e2), {}, { messageIDMap: c2 })); return this.req(a2).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 = A(t3) ? c2.get(n3) : c2.get(t3); o3.push({ messageID: n3, reactionList: e4 }), e4.forEach(function(e5) { i3.push.apply(i3, D(e5.userIDList)); }); }), t2._handleReactionSummary(o3, i3); }).then(function(e3) { return r2.end(), v.l("".concat(o2, " ok.")), c2.clear(), Sn({ resultList: e3 }); }).catch(function(e3) { return r2.setError(e3).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "getAllUserListOfMessageReaction", value: function(e2) { var n2 = this, t2 = "getAllUserListOfMessageReaction"; if (!this.canIUse(H.MSG_REACTION)) return this.noUse(t2); var o2 = "".concat(this._n, ".").concat(t2), i2 = e2.message, a2 = e2.reactionID, s2 = e2.nextSeq, l2 = e2.count, r2 = i2.ID, i2 = i2.conversationID, i2 = "convID:".concat(i2, " messageID:").concat(r2, " reactionID:").concat(a2, " nextSeq:").concat(s2, " count:").concat(l2), c2 = new M(t2), u2 = (c2.setMessage(i2), v.l("".concat(o2, " ").concat(i2)), { userList: [], nextSeq: 0, isCompleted: false }), r2 = this._createReactionUserListPack(e2); return this.req(r2).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 u2.nextSeq = e3, u2.isCompleted = 0 === e3, n2.get(4).getUserNickAndAvatar(t3); }).then(function(e3) { return u2.userList = e3, c2.end(), v.l("".concat(o2, " ok.")), Sn(u2); }).catch(function(e3) { return c2.setError(e3).end(), v.e("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "_createReactionOperationPack", value: function(e2, t2, n2) { var o2, i2, a2 = void 0, t2 = { reactionID: t2, userIDList: [this.getMyUserID()] }; return e2.conversationType === R.CONV_C2C && (o2 = this.get(6), a2 = 1 === n2 ? I.ADD_C2C_MSG_REACTION : I.RM_C2C_MSG_REACTION, t2.from = e2.from, t2.to = e2.to, t2.messageKey = o2.getMessageKey(e2)), e2.conversationType === R.CONV_GROUP && (o2 = void 0, i2 = e2.to, Rt(e2.to) && (i2 = Kt(o2 = e2.to)), a2 = 1 === n2 ? I.ADD_GRP_MSG_REACTION : I.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 === R.CONV_C2C && (n2 = this.get(6), t2 = i2.map(function(e3) { var t3 = n2.getMessageKey(e3); return s2.set(t3, e3.ID), t3; }), r2 = I.GET_C2C_MSG_REACTIONS, c2 = { from: e2.from, to: e2.to, messageKeyList: t2, count: a2 }), e2.conversationType === R.CONV_GROUP && (t2 = void 0, o2 = e2.to, Rt(e2.to) && (o2 = Kt(t2 = e2.to)), e2 = i2.map(function(e3) { return s2.set(e3.sequence, e3.ID), e3.sequence; }), r2 = I.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 === R.CONV_C2C && (o2 = this.get(6), i2 = I.GET_C2C_MSG_REACTION_USER_LIST, n2.from = t2.from, n2.to = t2.to, n2.messageKey = o2.getMessageKey(t2)), t2.conversationType === R.CONV_GROUP && (e2 = void 0, o2 = t2.to, Rt(t2.to) && (o2 = Kt(e2 = t2.to)), i2 = I.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), A(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 A(t2) ? !!this._reactedByMyselfMap.has(n2) && this._reactedByMyselfMap.get(n2).includes(e2) : 1 === t2; } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this._reactedByMyselfMap.clear(), this._reactionInfoMap.clear(); } }]), $a), Wa = (t(Qa, Fn), qa = f(Qa), e(Qa, [{ key: "sendMessage", value: function(e2) { var o2 = this, i2 = this._createMsg(e2); if (null === i2) return C({ code: T.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 = (Qe(e3) && 0 !== e3 && (new M("sendMessageWithReceipt").setMessage("from:".concat(i2.from, " to:").concat(i2.to, " sequence:").concat(n2, " readReceiptCode:").concat(e3)).end(), v.w("".concat(o2._n, ".sendMessage readReceiptCode:").concat(e3, " message:").concat(o2.getErrMsg(e3)))), o2._addSendMessageSuccessCount(i2, a2), o2.get(11)), t2 = (i2.status = On, i2.time = t2, i2.conversationType === R.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 }] }), Sn({ 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 === R.CONV_C2C && (o2 = "".concat(a.NAME.OPEN_IM, ".").concat(I.SEND_C2C_MSG)), e2.conversationType === R.CONV_GROUP && (o2 = "".concat(a.NAME.GRP, ".").concat(I.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(R.CONV_GROUP).concat(e2.GroupId), a2.conversationType = R.CONV_GROUP, a2.to = e2.GroupId) : e2.To_Account && (a2.conversationID = "".concat(R.CONV_C2C).concat(e2.To_Account), a2.conversationType = R.CONV_C2C, a2.to = e2.To_Account), a2.time = e2.MsgTimeStamp || 0, a2.random = e2.Random || e2.MsgRandom || 0, a2.priority = e2.MsgPriority, ft(e2.CloudCustomData) && 0 < e2.CloudCustomData.length && (a2.cloudCustomData = e2.CloudCustomData), nt(e2.SendMsgControl) && (a2.messageControlInfo = {}, e2.SendMsgControl.includes("NoUnread") && (a2.messageControlInfo.excludedFromUnreadCount = 1), e2.SendMsgControl.includes("NoLastMsg") && (a2.messageControlInfo.excludedFromLastMessage = 1)), a2.conversationType === R.CONV_GROUP && nt(e2.To_Account) && 0 < e2.To_Account.length && (o2 = e2.To_Account, 50 < e2.To_Account.length && (o2 = e2.To_Account.slice(0, 50), v.w("".concat(t2, " To_Account must be less than or equal to 50."))), a2.receiverList = D(o2), e2.To_Account = D(o2)), 1 !== e2.IsNeedReadReceipt && 1 !== e2.NeedReadReceipt || (a2.needReadReceipt = true), 1 === e2.SupportMessageExtension && (a2.isSupportExtension = true), (n2 = new Ro(a2)).status = An, e2.MsgClientTime = n2.clientTime, n2.conversationType === R.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, v.e("".concat(t2, " failed. error:"), e3); } return n2; } }, { key: "_onSendMessageFailed", value: function(e2, t2) { e2.status = Nn, this.get(11).deleteMessageRandom(e2), this._addSendMessageFailCountOnUser(e2, t2); var n2 = new M("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(), v.e("".concat(this._n, "._onSendMessageFailed ").concat(o2, " error:"), t2), C(new Bn({ code: t2 && t2.code ? t2.code : T.MSG_SEND_FAIL, message: t2 && t2.message ? t2.message : void 0, data: { message: e2 } })); } }, { key: "_getSendMessageSpecifiedKey", value: function(e2) { if (e2.conversationType === R.CONV_C2C) return jn; if (e2.conversationType === R.CONV_GROUP) { var e2 = this.get(7).getLocalGroupProfile(e2.to); if (e2) return e2 = e2.type, St(e2) ? zn : Jn; } } }, { 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, Qt(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); ba(t2) && e2 && n2.addFailedCountOfUserSide(e2); } }]), Qa), ja = (t(Za, Fn), Fa = f(Za), e(Za, [{ 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 M("registerPlugin").setMessage("".concat(Object.keys(t2))).setMoreMessage("version:".concat(o2)).end(); } }, { key: "getPlugin", value: function(e2) { return this.plugins[e2]; } }, { key: "reset", value: function() { } }]), Za), Ja = (t(Xa, Fn), wa = f(Xa), e(Xa, [{ 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 = (v.l("".concat(a2, " options:"), e2), new M("syncUnread")); s2.setMessage(JSON.stringify(e2)), this.req({ P: I.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); v.l("".concat(a2, " ok. ").concat(o3)), i2._cookie = n3, s2.setMoreMessage(o3).end(), Je(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(), v.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() { v.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() { v.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() { v.l("".concat(this._n, ".reset")), this._onlineSyncFlag = false, this._cookie = ""; } }]), Xa), za = { 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 Xa(e2) { return d(this, Xa), (e2 = wa.call(this, e2))._n = "SyncUnreadMsgModule", e2._cookie = "", e2._onlineSyncFlag = false, e2.getIEmitInst().on(Wo.A2KEY_AND_TINYID_UPDATED, e2._init, h(e2)), e2; } function Za(e2) { return d(this, Za), (e2 = Fa.call(this, e2))._n = "PluginModule", e2.plugins = {}, e2; } function Qa(e2) { return d(this, Qa), (e2 = qa.call(this, e2))._n = "ComboMsgModule", e2; } function $a(e2) { return d(this, $a), (e2 = xa.call(this, e2))._n = "MsgReactionModule", e2._reactedByMyselfMap = /* @__PURE__ */ new Map(), e2._reactionInfoMap = /* @__PURE__ */ new Map(), e2; } function es(e2) { return d(this, es), (e2 = Va.call(this, e2))._n = "MsgExtModule", e2.msgExtMap = /* @__PURE__ */ new Map(), e2.globalSeqMap = /* @__PURE__ */ new Map(), e2.getMsgExtsMap = /* @__PURE__ */ new Map(), e2; } function ts(e2) { return d(this, ts), (e2 = Ha.call(this, e2))._n = "MessageModule", e2._messageOptionsMap = /* @__PURE__ */ new Map(), e2._mergerMessageHandler = new Oa(h(e2)), e2; } function ns(e2, t2) { if ("string" != typeof e2 && !Array.isArray(e2)) throw new TypeError("Expected the input to be `string | string[]`"); 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() ? os(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); } var os = 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 is(e2, t2) { var r2 = 0; return function n2(e3, i2) { return 100 < ++r2 ? (r2--, e3) : nt(e3) ? (t3 = e3.map(function(e4) { return $e(e4) ? n2(e4, i2) : e4; }), r2--, t3) : $e(e3) ? (o2 = e3, a2 = function(e4, t4) { if (!st(t4)) return false; if (t4 !== ns(t4)) for (var n3 = 0; n3 < za.ignoreKeyWord.length && !t4.includes(za.ignoreKeyWord[n3]); n3++) ; var o3; return A(i2[t4]) ? (o3 = t4)[0].toUpperCase() + ns(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 = Gt(t3 = s2, function(e4, t4) { return nt(e4) || $e(e4) ? n2(e4, i2) : e4; }), r2--, t3) : void 0; var t3, o2, a2, s2; }(e2, t2); } for (var as, ss = String.fromCharCode, rs = 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 ss(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 ? ss(192 | t2 >>> 6, 128 | 63 & t2) : ss(224 | t2 >>> 12, 128 | t2 >>> 6 & 63, 128 | 63 & t2); }, cs = function(e2) { for (var t2 = void 0 === e2 ? "" : ("" + e2).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g, rs), n2 = 0 | t2.length, o2 = new Uint8Array(n2), i2 = 0; i2 < n2; i2 = i2 + 1 | 0) o2[i2] = 0 | t2.charCodeAt(i2); return o2; }, us = (e(Ns, [{ 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) { if (this._workerSocket && (this._workerSocket.postMessage({ cmd: "stop", code: e2 }), this._workerSocket.terminate(), this._workerSocket = null), ee) return ue.offSocketClose(), ue.offSocketMessage(), ue.offSocketOpen(), ue.offSocketError(), void ue.closeSocket(); this._socket && (ae ? (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), $ ? 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 ? cs(e2.data).buffer : e2.data }) : ee ? ue.sendSocketMessage({ data: e2.data, fail: function() { e2.fail && e2.requestID && e2.fail(e2.requestID); } }) : this._socket && (ae ? this._socket.send({ data: this._canIUseBinaryFrame ? cs(e2.data).buffer : e2.data, fail: function() { e2.fail && e2.requestID && e2.fail(e2.requestID); } }) : this._socket.send(this._canIUseBinaryFrame ? cs(e2.data) : e2.data)); } }]), Ns), ls = ["keyMap"], ds = ["keyMap"], ps = "connected", _s = "connecting", hs = "disconnected", gs = (e(Os, [{ key: "_setWebsocketHost", value: function() { var e2 = this._chM.get(12); this._currentSite = V, 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() + "", t2 = this._chM.get(12).isIndependentDomainDisabled(), t2 = (A(a.HOST.CURRENT.BACKUP) ? this._url = a.HOST.CURRENT.DEFAULT : "" === this._url ? this._url = t2 ? a.HOST.CURRENT.DEFAULT : 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.IPV6 || a.HOST.CURRENT.BACKUP : this._url === a.HOST.CURRENT.IPV6 ? 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)), e2 = t2.getProxyServer(); Je(e2) || (this._url = e2), t2.isTestEnv() && (this._url = w.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(I.LOGIN) ? i2 = 9e4 : -1 !== t2.indexOf(I.PING) && (i2 = 3e3), Date.now() - o2 >= i2 && (v.l("".concat(a2._n, "._checkPromiseMap request timeout, delete requestID:").concat(t2)), a2._promiseMap.delete(t2), n2(new Bn({ code: T.NETWORK_TIMEOUT, data: { headSeq: e2 } })), a2._chM.onRequestTimeout()); }); } }, { key: "_checkNativeAppWS", value: function() { ne && !this.isConnected() && this._reConnect(); } }, { key: "onOpen", value: function(e2) { var t2, n2; this._readyState !== hs && (this._onOpenTs = Date.now(), n2 = e2.id, e2 = e2.res, this._socketID = n2, t2 = Qt(this._startTs, false), n2 = "socketID:".concat(n2, " res:").concat(e2), v.l("".concat(this._n, "._onOpen cost:").concat(t2, " ms. ").concat(n2)), new M("wsOnOpen").setMessage(t2).setCostTime(t2).setMoreMessage(n2).end(), this._readyState = ps, 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 M("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), v.l("".concat(this._n, "._onClose ").concat(o2, " onlineTime:").concat(i2)), n2 === this._socketID && (this._readyState = hs, 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 M("wsOnError").setMessage(e2.errMsg || JSON.stringify(e2, ["message", "code"])).setMoreMessage(n2).setLevel("error").end(true), v.w("".concat(this._n, "._onError"), e2, n2), t2 === this._socketID && (this._readyState = hs, this._chM.onError()); } }, { key: "onMessage", value: function(t2) { var e2; try { e2 = JSON.parse(t2.data); } catch (e3) { new M("jsonParseError").setMessage(t2.data).end(); } if (e2 && e2.head) { var n2, o2, i2, a2, t2 = this._getRequestIDFromHead(e2.head), s2 = e2.body; if (this._chM.get(30).isTRTCCommand(t2) || (a2 = xt(e2.head), s2 = function t3(e3, n3) { return nt(e3) ? e3.map(function(e4) { return $e(e4) ? t3(e4, n3) : e4; }) : $e(e3) ? (o3 = e3, i3 = function(e4, t4) { return A(n3[t4]) ? ns(t4) : n3[t4]; }, a3 = {}, Object.keys(o3).forEach(function(e4) { a3[i3(o3[e4], e4)] = o3[e4]; }), Gt(a3, function(e4) { return nt(e4) || $e(e4) ? t3(e4, n3) : e4; })) : void 0; var o3, i3, a3; }(e2.body, this._getResKeyMap(a2))), v.d("".concat(this._n, ".onMessage ret:").concat(JSON.stringify(s2), " requestID:").concat(t2, " has:").concat(this._promiseMap.has(t2))), this._setNextPingTs(), this._promiseMap.has(t2)) return n2 = (a2 = this._promiseMap.get(t2)).resolve, o2 = a2.reject, i2 = a2.timestamp, a2 = a2.headSeq, this._promiseMap.delete(t2), this._calcRTT(i2), void (s2.errorCode && 0 !== s2.errorCode ? (this._chM.onErrorCodeNotZero(s2), o2(new Bn({ code: s2.errorCode, message: s2.errorInfo || "", data: t2.includes(I.MODIFY_C2C_MSG) || t2.includes(I.MODIFY_GRP_MSG) ? { elements: s2.elements, messageVersion: s2.messageVersion, cloudCustomData: s2.cloudCustomData, headSeq: a2 } : { headSeq: a2 } }))) : n2(Sn(s2))); this._chM.onMessage({ head: e2.head, body: s2 }); } } }, { key: "_calcRTT", value: function(e2) { e2 = Date.now() - e2; this._chM.get(26).addRTT(e2); } }, { key: "_connect", value: function() { this._readyState !== _s && this._readyState !== ps && (this._startTs = Date.now(), this._onOpenTs = 0, this._readyState = _s, this._socket = new us(this), this._socketID = this._socket.getID(), v.l("".concat(this._n, "._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled(), " socketID:").concat(this._socketID, " url:").concat(this.getURL())), new M("wsConnect").setMessage("socketID:".concat(this._socketID, " url:").concat(this.getURL())).end()); } }, { key: "getURL", value: function() { this._chM.isDevMode() && (this._canIUseBinaryFrame = false); var e2 = bt(), t2 = ((ee || z && "windows" === e2 || ne) && (this._canIUseBinaryFrame = false), -1), n2 = ("ios" === e2 ? t2 = _e || -1 : "android" === e2 && (t2 = ge || -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.5.2"); return X && (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) { v.l("".concat(this._n, "._closeConnection socketID:").concat(this._socketID)), this._socket && (this._socket.close(e2), this._socketID = -1, this._socket = null, this._readyState = hs); } }, { key: "_resend", value: function() { var i2 = this; if (v.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(I.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 = N(this._simpleRequestMap); try { for (t2.s(); !(e2 = t2.n()).done; ) { var n2 = m(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.head.cs = this._calcCheckSum(n2.head.servcmd, n2.body), n2.keyMap, g(n2, ls)), 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 }), v.d("".concat(o2._n, ".send uplinkData:").concat(JSON.stringify(i2), " requestID:").concat(a2, " readyState:").concat(o2._readyState)), o2._readyState !== ps ? 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 = g(e2, ds), e2 = this._getRequestIDFromHead(e2.head), t2 = JSON.stringify(t2); this._readyState !== ps ? (this._simpleRequestMap.size < this.MAX_SIZE ? this._simpleRequestMap.set(e2, t2) : v.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: ae ? this._onSendFail.bind(this) : void 0, requestID: e2 }); } }, { key: "_onSendFail", value: function(e2) { v.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 = lt()), e2; } }, { key: "_getRequestIDFromHead", value: function(e2) { return e2.servcmd + e2.seq; } }, { key: "_getResKeyMap", value: function(e2) { e2 = this._chM.getKeyMap(e2); return y(y({}, za.res), e2.res); } }, { key: "_reConnect", value: function() { this._readyState !== ps && this._readyState !== _s && this.forcedReconnect(); } }, { key: "forcedReconnect", value: function() { var e2 = "".concat(this._n, ".forcedReconnect"); v.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() ? (v.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 = ne ? Date.now() + 5e3 : Date.now() + 1e4; } }, { key: "getNextPingTs", value: function() { return this._nextPingTs; } }, { key: "isConnected", value: function() { return this._readyState === ps; } }, { 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) { v.l("".concat(this._n, ".setIsWorkerEnabled flag:").concat(e2)), this._isWorkerEnabled = e2; } }, { key: "getIsWorkerEnabled", value: function() { return this._isWorkerEnabled && ye; } }, { key: "_getRandom", value: function() { return 0 === this._random && (this._random = Math.random()), this._random; } }, { key: "_resetRandom", value: function() { this._random = 0; } }, { key: "_calcCheckSum", value: function(e2, t2) { if (-1 !== e2.indexOf(I.PING) || -1 !== e2.indexOf(I.LOGIN) || -1 !== e2.indexOf(I.LOGOUT) || -1 !== e2.indexOf(I.AV_POLLING) || -1 !== e2.indexOf(I.AV_NOAUTH_POLLING)) return 0; for (var n2 = cs(JSON.stringify(t2)), o2 = 4294967295, i2 = 0, a2 = n2.length; i2 < a2; i2++) { o2 ^= n2[i2]; for (var s2 = 0; s2 < 8; s2++) 1 == (1 & o2) ? o2 = o2 >>> 1 ^ 3988292384 : o2 >>>= 1; } return (4294967295 ^ o2) >>> 0; } }, { key: "close", value: function() { v.l("".concat(this._n, ".close")), this._closeConnection(4e3), this._promiseMap.clear(), this._startSequence = lt(), this._readyState = hs, this._simpleRequestMap.clear(), this._reConnectFlag = false, this._reConnectCount = 0, this._onOpenTs = 0, this._url = "", this._random = 0, this._canIUseBinaryFrame = true, this._isWorkerEnabled = true; } }]), Os), fs = function(a2, s2, r2) { return new Promise(function(t2, e2) { var n2, o2, i2 = "application/x-www-form-urlencoded;charset=UTF-8"; ae ? ue.request({ url: s2, data: r2, method: a2, timeout: 3e3, header: { "content-type": i2 }, success: function(e3) { e3 && e3.data && e3.data.NetCheckInfo && v.l("".concat("getconninfo ok in", " miniapp. ret:"), e3.data), t2(); }, fail: function() { e2(new Bn({ code: T.NETWORK_ERROR })); } }) : (n2 = new XMLHttpRequest(), o2 = setTimeout(function() { n2.abort(), e2(new Bn({ code: T.NETWORK_TIMEOUT })); }, 3e3), n2.onreadystatechange = function() { 4 === n2.readyState && (o2 && clearTimeout(o2), 200 === n2.status || 304 === n2.status ? (n2.responseText && -1 < n2.responseText.indexOf("NetCheckInfo") && v.l("".concat("getconninfo ok in", " web. ret:"), JSON.parse(n2.responseText)), t2()) : e2(new Bn({ code: T.NETWORK_ERROR }))); }, n2.open(a2, s2, true), n2.setRequestHeader("Content-type", i2), r2 ? n2.send(r2) : n2.send()); }); }, ms = (t(As, Fn), as = f(As), e(As, [{ 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 !== R.NET_STATE_CONNECTED && e2.head.servcmd.includes(I.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 fs("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(R.NET_STATE_DISCONNECTED), this.reConnect(); } }, { key: "onError", value: function() { ae && !ne && this.warn("DomainNameInMP"), this._emitNetStateChangeEvent(R.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(R.NET_STATE_DISCONNECTED); } }, { key: "onReconnected", value: function() { v.l("".concat(this._n, ".onReconnected cost:").concat(Qt(this._disconnectedTS, true, true))), this._m.restartTimer(), this.get(20).onReconnected(Qt(this._disconnectedTS, false, false)), this._disconnectedTS = 0, this._emitNetStateChangeEvent(R.NET_STATE_CONNECTED); } }, { key: "onReconnectFailed", value: function() { v.l("".concat(this._n, ".onReconnectFailed")), this._emitNetStateChangeEvent(R.NET_STATE_DISCONNECTED); } }, { key: "setIsWorkerEnabled", value: function(e2) { this._socketHandler && this._socketHandler.setIsWorkerEnabled(false); } }, { key: "offline", value: function() { this._emitNetStateChangeEvent(R.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)); if (v.l("".concat(this._n, ".reConnect ").concat(n2)), !this._fatalErrorFlag && this._socketHandler) { if (true === e2) this._socketHandler.forcedReconnect(); else { if (this._previousState === R.NET_STATE_CONNECTING && t2) return; this._socketHandler.forcedReconnect(); } this._emitNetStateChangeEvent(R.NET_STATE_CONNECTING); } } }, { key: "_emitNetStateChangeEvent", value: function(e2) { this._previousState !== e2 && (v.l("".concat(this._n, "._emitNetStateChangeEvent from ").concat(this._previousState, " to ").concat(e2)), e2 === R.NET_STATE_DISCONNECTED && 0 === this._disconnectedTS && (this._disconnectedTS = Date.now(), this.diagnose()), this._previousState = e2, this.emitOEvt(G.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: I.PING }), this.send(e2).then(function() { n2._probing = false; }).catch(function(e3) { n2._probing = false; var t2 = n2.get(15).isOnline(); if (v.w("".concat(n2._n, "._ping failed. bOnline:").concat(t2, " error:"), e3), e3 && 60002 === e3.code) return new M("error").setMessage("code:".concat(e3.code, " message:").concat(e3.message)).end(), n2._fatalErrorFlag = true, void n2._emitNetStateChangeEvent(R.NET_STATE_DISCONNECTED); t2 ? n2.reConnect() : n2._emitNetStateChangeEvent(R.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()), fs("GET", n2).catch(function(e3) { v.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()); fs("GET", e2).catch(function(e3) { v.w("".concat(t2._n, "._diagnoseByCDN failed. error:"), e3); }); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this._previousState = R.NET_STATE_CONNECTED, this._probing = false, this._fatalErrorFlag = false, this._timerForNotLoggedIn = setInterval(this.onCheckTimer.bind(this), 1e3), this._disconnectedTS = 0, this._lastDiagnoseTS = 0; } }]), As), vs = ["a2", "tinyid"], Is = ["a2", "tinyid"], Ms = (e(Rs, [{ key: "_fillMap", value: function() { this._map.clear(); var e2 = this._sessionM.genCommonHead(), t2 = this._sessionM.genCosSpecifiedHead(), n2 = this._sessionM.genSSOReportHead(); this._map.set(I.LOGIN, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(I.LOGIN) }), body: { state: "Online", isWebUniapp: 0, deviceBrand: 0, customInfo: "" }, keyMap: { req: { deviceBrand: "InstType" }, res: { InstId: "instanceID", HelloInterval: "helloInterval", RichMsgAuthKey: "authKey" } } }), this._map.set(I.LOGOUT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(I.LOGOUT) }), body: { type: 0, isWebUniapp: 0 }, keyMap: { req: { type: "wslogout_type" } } }), this._map.set(I.HELLO, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(I.HELLO) }), body: { isWebUniapp: 0 }, keyMap: { res: { NewInstInfo: "newInstanceInfo" } } }), this._map.set(I.KICK_OTHER, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.STAT_SERVICE, ".").concat(I.KICK_OTHER) }), body: {} }), this._map.set(I.COS_SIGN, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.IM_COS_SIGN, ".").concat(I.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(I.COS_PRE_SIG, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.CUSTOM_UPLOAD, ".").concat(I.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(I.SIMPLE_COS_PRE_SIG, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.CUSTOM_UPLOAD, ".").concat(I.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(I.GET_IMAGE_INFO, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.CUSTOM_UPLOAD, ".").concat(I.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(I.GET_IP, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.CUSTOM_UPLOAD, ".").concat(I.GET_IP) }), body: { domainName: "" }, keyMap: { req: { domainName: "str_domain" }, res: { str_final_ip: "ip" } } }), this._map.set(I.VIDEO_COVER, { head: y(y({}, t2), {}, { servcmd: "".concat(a.NAME.CUSTOM_UPLOAD, ".").concat(I.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(I.FETCH_COMMERCIAL_CONFIG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_CONFIG_MANAGER, ".").concat(I.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(I.PUSHED_COMMERCIAL_CONFIG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_CONFIG_MANAGER, ".").concat(I.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(I.FETCH_CLOUD_CTRL_CONFIG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_CONFIG_MANAGER, ".").concat(I.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(I.PUSHED_CLOUD_CTRL_CONFIG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_CONFIG_MANAGER, ".").concat(I.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(I.OVERLOAD_NOTIFY, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OVERLOAD_PUSH, ".").concat(I.OVERLOAD_NOTIFY) }), body: {}, keyMap: { res: { OverLoadServCmd: "overloadCommand", DelaySecs: "waitingTime" } } }), this._map.set(I.SYNC_UNREAD_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.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(I.GET_PROFANITY_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_MSG_AUDIT_MGR, ".").concat(I.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(I.SEND_C2C_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.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: "", OPPOCategory: "", HuaWeiImage: "", HonorImage: "", GoogleImage: "", HonorImportance: "" } }, messageControlInfo: void 0, clientTime: void 0, needReadReceipt: 0, isSupportExtension: 0, isRelayMessage: 0, cmConfigID: void 0, forbidCallbackControl: 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", OPPOChannelID: "OPPOChannelID", OPPOCategory: "OPPOCategory", VIVOClassification: "VIVOClassification", VIVOCategory: "VIVOCategory", HonorImportance: "HonorImportance" } } }), this._map.set(I.SEND_GRP_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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: "", OPPOCategory: "", HuaWeiImage: "", HonorImage: "", GoogleImage: "", HonorImportance: "" } }, groupAtInfo: [], messageControlInfo: void 0, clientTime: void 0, needReadReceipt: 0, topicID: void 0, receiverList: void 0, isSupportExtension: 0, isRelayMessage: 0, cmConfigID: void 0, forbidCallbackControl: 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", OPPOChannelID: "OPPOChannelID", OPPOCategory: "OPPOCategory", VIVOClassification: "VIVOClassification", VIVOCategory: "VIVOCategory", HonorImportance: "HonorImportance" }, res: { MsgTime: "time", MsgSeq: "sequence" } } }), this._map.set(I.REVOKE_C2C_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.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(I.REVOKE_GRP_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.REVOKE_GRP_MSG) }), body: { groupID: "", msgSeqList: void 0, topicID: "" }, keyMap: { req: { msgSeqList: "MsgSeqList", msgSeq: "MsgSeq" } } }), this._map.set(I.GET_C2C_ROAMING_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.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(I.MODIFY_C2C_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.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(I.GET_GRP_ROAMING_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.SET_C2C_MSG_READ, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.SET_C2C_MSG_READ) }), body: { C2CMsgReaded: void 0 }, keyMap: { req: { lastMessageTime: "LastedMsgTime" } } }), this._map.set(I.SET_C2C_PEER_MUTE_NOTIFICATIONS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.SET_C2C_PEER_MUTE_NOTIFICATIONS) }), body: { userIDList: void 0, muteFlag: 0 }, keyMap: { req: { userIDList: "Peer_Account", muteFlag: "Mute_Notifications" } } }), this._map.set(I.GET_C2C_PEER_MUTE_NOTIFICATIONS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.GET_C2C_PEER_MUTE_NOTIFICATIONS) }), body: { toAccount: void 0, userIDList: void 0 }, keyMap: { req: { userIDList: "Peer_Account" }, res: { MuteNotificationsList: "muteFlagList" } } }), this._map.set(I.SET_GRP_MSG_READ, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.SET_GRP_MSG_READ) }), body: { groupID: void 0, messageReadSeq: void 0, topicID: void 0 }, keyMap: { req: { messageReadSeq: "MsgReadedSeq" } } }), this._map.set(I.SET_ALL_MSG_READ, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.SET_ALL_MSG_READ) }), body: { readAllC2CMessage: 0, groupMessageReadInfoList: [] }, keyMap: { req: { readAllC2CMessage: "C2CReadAllMsg", groupMessageReadInfoList: "GroupReadInfo", messageSequence: "MsgSeq" }, res: { C2CReadAllMsg: "readAllC2CMessage", GroupReadInfoArray: "groupMessageReadInfoList" } } }), this._map.set(I.DEL_C2C_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.DEL_C2C_MSG) }), body: { fromAccount: "", to: "", keyList: void 0 }, keyMap: { req: { keyList: "MsgKeyList" } } }), this._map.set(I.DEL_GRP_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.DEL_GRP_MSG) }), body: { groupID: "", deleter: "", keyList: void 0, topicID: void 0 }, keyMap: { req: { deleter: "Deleter_Account", keyList: "Seqs" } } }), this._map.set(I.TRANSLATE_TEXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_TRANSLATE, ".").concat(I.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(I.VOICE_TO_TEXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_SPEECH, ".").concat(I.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(I.MODIFY_GRP_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.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(I.GET_READ_RECEIPT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.GET_READ_RECEIPT) }), body: { groupID: "", sequenceList: void 0 }, keyMap: { req: { sequence: "MsgSeq" } } }), this._map.set(I.SEND_C2C_READ_RECEIPT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.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(I.SEND_READ_RECEIPT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.SEND_READ_RECEIPT) }), body: { groupID: "", sequenceList: void 0 }, keyMap: { req: { sequenceList: "MsgSeqList", sequence: "MsgSeq" } } }), this._map.set(I.GET_READ_RECEIPT_DETAIL, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.MODIFY_C2C_MSG_EXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.MODIFY_C2C_MSG_EXT) }), body: { from: void 0, to: void 0, messageKey: void 0, operateType: void 0, extensionList: void 0 } }), this._map.set(I.GET_C2C_MSG_EXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.GET_C2C_MSG_EXT) }), body: { from: void 0, to: void 0, messageKey: void 0, startSequence: void 0 } }), this._map.set(I.MODIFY_GRP_MSG_EXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.MODIFY_GRP_MSG_EXT) }), body: { groupID: void 0, topicID: void 0, messageSequence: void 0, operateType: void 0, extensionList: void 0 } }), this._map.set(I.GET_GRP_MSG_EXT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.GET_GRP_MSG_EXT) }), body: { groupID: void 0, topicID: void 0, messageSequence: void 0, startSequence: void 0 } }), this._map.set(I.ADD_C2C_MSG_REACTION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.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(I.RM_C2C_MSG_REACTION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.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(I.GET_C2C_MSG_REACTIONS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.GET_C2C_MSG_REACTIONS) }), body: { from: void 0, to: void 0, messageKeyList: void 0, count: void 0 } }), this._map.set(I.GET_C2C_MSG_REACTION_USER_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.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(I.ADD_GRP_MSG_REACTION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.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(I.RM_GRP_MSG_REACTION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.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(I.GET_GRP_MSG_REACTIONS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.GET_GRP_MSG_REACTIONS) }), body: { groupID: void 0, topicID: void 0, messageSequenceList: void 0, count: void 0 }, keyMap: { res: { MsgSeq: "messageSequence" } } }), this._map.set(I.GET_GRP_MSG_REACTION_USER_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM_MSG_EXT, ".").concat(I.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(I.GET_C2C_PEER_READ_TIME, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.GET_C2C_PEER_READ_TIME) }), body: { userIDList: void 0 }, keyMap: { req: { userIDList: "To_Account" }, res: { ReadTime: "peerReadTimeList" } } }), this._map.set(I.PAGING_GET_CONV_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.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(I.DEL_CONV, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.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(I.CLEAR_HISTORY_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.CLEAR_HISTORY_MSG) }), body: { fromAccount: "", toAccount: void 0, type: 1, toGroupID: void 0 }, keyMap: { req: { toGroupID: "ToGroupid" } } }), this._map.set(I.PIN_CONV, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.PIN_CONV) }), body: { fromAccount: "", operationType: 1, itemList: void 0 }, keyMap: { req: { itemList: "RecentContactItem" } } }), this._map.set(I.DEL_GROUP_AT_TIPS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.DEL_GROUP_AT_TIPS) }), body: { messageListToDelete: void 0 }, keyMap: { req: { messageListToDelete: "DelMsgList", messageSeq: "MsgSeq", messageRandom: "MsgRandom" } } }), this._map.set(I.SET_CONV_CUSTOM_DATA, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.MARK_CONV) }), body: { fromAccount: "", itemList: void 0 }, keyMap: { req: { itemList: "MarkItem", operationType: "OptType", groupID: "ToGroupId" }, res: { ToGroupId: "groupID", OptType: "operationType" } } }), this._map.set(I.MARK_CONV, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.MARK_CONV) }), body: { fromAccount: "", itemList: void 0 }, keyMap: { req: { itemList: "MarkItem", operationType: "OptType", groupID: "ToGroupId" }, res: { ToGroupId: "groupID", OptType: "operationType" } } }), this._map.set(I.CREATE_CONV_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.CREATE_CONV_GRP) }), body: { fromAccount: "", itemList: void 0 }, keyMap: { req: { itemList: "GroupContactItem", groupID: "ToGroupId" }, res: { GroupId: "convGroupID", ToGroupId: "groupID", OptType: "operationType" } } }), this._map.set(I.DEL_CONV_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.DEL_CONV_GRP) }), body: { fromAccount: "", groupName: void 0 }, keyMap: { res: { GroupId: "convGroupID" } } }), this._map.set(I.RENAME_CONV_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.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(I.ADD_CONV_TO_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.RENAME_CONV_GRP) }), body: { fromAccount: "", updateType: void 0, updateGroup: { groupName: void 0, updateGroupType: void 0, updateItem: void 0 } } }), this._map.set(I.DEL_CONV_FROM_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.RENAME_CONV_GRP) }), body: { fromAccount: "", updateType: void 0, updateGroup: void 0 } }), this._map.set(I.GET_CONV_GRP_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.GET_CONV_GRP_LIST) }), body: { fromAccount: "", startIndex: void 0 }, keyMap: { res: { GroupId: "convGroupID", ToGroupId: "groupID", OptType: "operationType", CustomMark: "customData", ContactGroupId: "convGroupIDList" } } }), this._map.set(I.SEARCH_CONV_GRP_MARK, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.RECENT_CONTACT, ".").concat(I.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(I.GET_USER_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.PROFILE, ".").concat(I.GET_USER_PROFILE) }), body: { fromAccount: "", userItem: [] }, keyMap: { req: { toAccount: "To_Account", standardSequence: "StandardSequence", customSequence: "CustomSequence" } } }), this._map.set(I.UPDATE_MY_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.PROFILE, ".").concat(I.UPDATE_MY_PROFILE) }), body: { fromAccount: "", profileItem: [{ tag: qe.NICK, value: "" }, { tag: qe.GENDER, value: "" }, { tag: qe.ALLOWTYPE, value: "" }, { tag: qe.AVATAR, value: "" }] }, keyMap: { req: { toAccount: "To_Account", standardSequence: "StandardSequence", customSequence: "CustomSequence" } } }), this._map.set(I.GET_BL, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.GET_BL) }), body: { fromAccount: "", startIndex: 0, maxLimited: 30 } }), this._map.set(I.ADD_TO_BL, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.ADD_TO_BL) }), body: { fromAccount: "", toAccount: [] } }), this._map.set(I.RM_FROM_BL, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.RM_FROM_BL) }), body: { fromAccount: "", toAccount: [] } }), this._map.set(I.SET_SELF_STATUS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(I.SET_SELF_STATUS) }), body: { customStatus: "" } }), this._map.set(I.GET_USER_STATUS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(I.GET_USER_STATUS) }), body: { userIDList: void 0 }, keyMap: { res: { UserStatusList: "successUserList", ErrorList: "failureUserList", To_Account: "userID", Invalid_Account: "invalidUserID", Status: "statusType" } } }), this._map.set(I.SUB_USER_STATUS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(I.SUB_USER_STATUS) }), body: { userIDList: void 0 }, keyMap: { res: { ErrorList: "failureUserList", To_Account: "userID", Invalid_Account: "invalidUserID" } } }), this._map.set(I.UNSUB_USER_STATUS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(I.UNSUB_USER_STATUS) }), body: { userIDList: void 0, unsubscribeAll: void 0 }, keyMap: { res: { ErrorList: "failureUserList", To_Account: "userID", Invalid_Account: "invalidUserID" } } }), this._map.set(I.GET_FD_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.GET_FD_LIST) }), body: { fromAccount: "", startIndex: 0, standardSequence: 0, customSequence: 0 }, keyMap: { res: { FriendNum: "friendCount", UserDataItem: "resultList", ValueItem: "tagValueList" } } }), this._map.set(I.ADD_FD, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.ADD_FD) }), body: { fromAccount: "", addFriendItem: [], type: "" }, keyMap: { req: { source: "AddSource", wording: "AddWording", type: "AddType" }, res: { ResultItem: "resultList" } } }), this._map.set(I.UPDATE_FD, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.UPDATE_FD) }), body: { fromAccount: "", updateItem: void 0 }, keyMap: { req: { snsItem: "SnsItem" }, res: { ResultItem: "resultList" } } }), this._map.set(I.DEL_FD, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.DEL_FD) }), body: { fromAccount: "", userIDList: [], type: "" }, keyMap: { req: { type: "DeleteType" }, res: { ResultItem: "resultList" } } }), this._map.set(I.GET_FD_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.GET_FD_PROFILE) }), body: { fromAccount: "", userIDList: void 0 }, keyMap: { res: { InfoItem: "resultList", SnsProfileItem: "tagValueList" } } }), this._map.set(I.CHECK_FD, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.CHECK_FD) }), body: { fromAccount: "", userIDList: [], type: "" }, keyMap: { req: { type: "CheckType" }, res: { InfoItem: "resultList" } } }), this._map.set(I.GET_FD_APPLICATION_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.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(I.RESPOND_FD_APPLICATION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.RESPOND_FD_APPLICATION) }), body: { fromAccount: "", responseFriendItem: [] }, keyMap: { req: { tag: "TagName", action: "ResponseAction" }, res: { ResultItem: "resultList" } } }), this._map.set(I.DEL_FD_APPLICATION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.DEL_FD_APPLICATION) }), body: { fromAccount: "", type: "", userIDList: void 0 }, keyMap: { req: { type: "PendencyType", userIDList: "To_Account" }, res: { ResultItem: "resultList" } } }), this._map.set(I.REPORT_FD_APPLICATION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.REPORT_FD_APPLICATION) }), body: { fromAccount: "", latestTimeStamp: "" }, keyMap: { req: { latestTimeStamp: "LatestPendencyTimeStamp" } } }), this._map.set(I.CREATE_FD_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.CREATE_FD_GRP) }), body: { fromAccount: "", groupName: void 0, userIDList: void 0 }, keyMap: { req: { groupName: "GroupName", userIDList: "To_Account" }, res: { ResultItem: "resultList" } } }), this._map.set(I.DEL_FD_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.DEL_FD_GRP) }), body: { fromAccount: "", nameList: void 0 }, keyMap: { req: { nameList: "GroupName" } } }), this._map.set(I.GET_FD_GRP_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.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(I.UPDATE_FD_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FD, ".").concat(I.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(I.GET_GRP_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.GET_GRP_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.CREATE_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.DISMISS_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.DISMISS_GRP) }), body: { groupID: void 0 } }), this._map.set(I.UPDATE_GRP_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.APPLY_JOIN_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.APPLY_JOIN_GRP_NOAUTH, (e2.a2, e2.tinyid, { head: y(y({}, g(e2, vs)), {}, { servcmd: "".concat(a.NAME.BIG_GRP_NO_AUTH, ".").concat(I.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(I.QUIT_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.QUIT_GRP) }), body: { groupID: void 0 } }), this._map.set(I.SEARCH_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.CHANGE_GRP_OWNER, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.CHANGE_GRP_OWNER) }), body: { groupID: void 0, newOwnerID: void 0 }, keyMap: { req: { newOwnerID: "NewOwner_Account" } } }), this._map.set(I.HANDLE_GRP_APPLICATION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.HANDLE_INVITE_JOIN_GRP, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.HANDLE_GRP_INVITATION, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.GET_GRP_PENDENCY, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.DEL_GRP_SYSTEM_NOTICE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.DEL_GRP_SYSTEM_NOTICE) }), body: { messageListToDelete: void 0 }, keyMap: { req: { messageListToDelete: "DelMsgList", messageSeq: "MsgSeq", messageRandom: "MsgRandom" } } }), this._map.set(I.AV_POLLING, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.BIG_GRP_POLLING, ".").concat(I.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(I.AV_NOAUTH_POLLING, (e2.a2, e2.tinyid, { head: y(y({}, g(e2, Is)), {}, { servcmd: "".concat(a.NAME.BIG_GRP_POLLING_NO_AUTH, ".").concat(I.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(I.GET_ONLINE_MBR_NUM, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.GET_ONLINE_MBR_NUM) }), body: { groupID: void 0 }, keyMap: { res: { OnlineMemberNum: "memberCount" } } }), this._map.set(I.SET_GRP_ATTR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.MODIFY_GRP_ATTR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.DEL_GRP_ATTR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.CLEAR_GRP_ATTR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.CLEAR_GRP_ATTR) }), body: { groupID: void 0, mainSequence: void 0, avChatRoomKey: void 0, attributeControl: ["RaceConflict"] } }), this._map.set(I.GET_GRP_ATTR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_ATTR, ".").concat(I.GET_GRP_ATTR) }), body: { groupID: void 0, avChatRoomKey: void 0, groupType: 1 }, keyMap: { req: { avChatRoomKey: "Key", groupType: "GroupType" } } }), this._map.set(I.GET_GRP_NOTIFY, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.GET_GRP_NOTIFY) }), body: { notifyReqList: [] }, keyMap: { req: { notifyReqList: "NotifyReqList" }, res: { NextMsgTime: "nextRevokedTime", NotifyMsgList: "notifyList", NotifyRspList: "notifyRspList" } } }), this._map.set(I.UPDATE_GRP_COUNTER, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.UPDATE_GRP_COUNTER) }), body: { groupID: void 0, counterList: void 0, avChatRoomKey: void 0, mode: void 0 }, keyMap: { req: { counterList: "GroupCounter" } } }), this._map.set(I.GET_GRP_COUNTER, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.GET_GRP_COUNTER) }), body: { groupID: void 0, keyList: [], avChatRoomKey: void 0 }, keyMap: { req: { keyList: "GroupCounterKeys" } } }), this._map.set(I.CREATE_TOPIC, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_COMMUNITY, ".").concat(I.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(I.DEL_TOPIC, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_COMMUNITY, ".").concat(I.DEL_TOPIC) }), body: { groupID: void 0, topicIDList: void 0 }, keyMap: { req: { topicIDList: "TopicIdList" }, res: { DestroyResultItem: "resultList" } } }), this._map.set(I.UPDATE_TOPIC_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_COMMUNITY, ".").concat(I.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(I.GET_TOPIC_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_COMMUNITY, ".").concat(I.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(I.GET_GRP_MBR_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.GET_AV_MBR_LIST, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_AV, ".").concat(I.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(I.GET_GRP_MBR_PROFILE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.ADD_GRP_MBR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.DEL_GRP_MBR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.DEL_GRP_MBR) }), body: { groupID: void 0, userIDList: void 0, reason: void 0 }, keyMap: { req: { userIDList: "MemberToDel_Account" } } }), this._map.set(I.BAN_AV_MBR, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.MODIFY_GRP_MBR_INFO, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP, ".").concat(I.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(I.MARK_AV_MBR_INFO, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_AV, ".").concat(I.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(I.CS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.MSG_SEARCH, ".").concat(I.CS) }), 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", keywords: "Keywords", keywordMatchType: "KeywordMatchType", count: "Count", miniBirthday: "UserBirthStart", maxBirthday: "UserBirthEnd", gender: "UserGenderType", groupTypeList: "GroupType", groupIDList: "GroupIdList" }, res: { GroupID: "groupID", UserID: "userID", ErrorCode: "code", ErrorInfo: "message", TotalCount: "totalCount", 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", Users: "userList", ProfileItems: "profileItems", StrValue: "value", IntValue: "value", Groups: "groupList", GroupFaceUrl: "avatar", GroupIntroduction: "introduction", GroupOwnerUserID: "ownerID", GroupOwnerUserName: "ownerNick", GroupOwnerTinyID: "ownerTinyID", GroupMemberNum: "memberNum", GroupName: "name", GroupType: "type", GroupMembers: "groupMemberList", GroupMemberUserID: "userID", GroupMemberTinyID: "userTinyID", GroupMemberUserName: "nick", GroupMemberNameCard: "nameCard" } } }), this._map.set(I.USER_CS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.USER_SEARCH, ".").concat(I.CS) }), body: { keywords: void 0, keywordMatchType: 0, miniBirthday: void 0, maxBirthday: void 0, gender: void 0, count: 20, cursor: void 0 } }), this._map.set(I.GRP_CS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_SEARCH, ".").concat(I.CS) }), body: { keywords: void 0, keywordMatchType: 0, groupType: void 0, count: 20, cursor: void 0 } }), this._map.set(I.MBR_CS, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.GRP_MEMBER_SEARCH, ".").concat(I.CS) }), body: { keywords: void 0, keywordMatchType: 0, groupType: void 0, groupIDList: void 0, count: 20, cursor: void 0 } }), this._map.set(I.SSO_STAT, { head: y(y({}, n2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STAT, ".").concat(I.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(I.PING, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.HEARTBEAT, ".").concat(I.PING) }), body: {} }), this._map.set(I.MSG_PUSH, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_PUSH, ".").concat(I.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(I.MULTI_MSG_PUSH, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_PUSH, ".").concat(I.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(I.MSG_PUSH_ACK, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OPEN_IM, ".").concat(I.MSG_PUSH_ACK) }), body: { sessionData: void 0 }, keyMap: { req: { sessionData: "SessionData" } } }), this._map.set(I.STATUS_FORCE_OFFLINE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(I.STATUS_FORCE_OFFLINE) }), body: {}, keyMap: { res: { C2cNotifyMsgArray: "C2CNotifyMessageArray", NoticeSeq: "noticeSequence", KickoutMsgNotify: "kickoutMsgNotify", NewInstInfo: "newInstanceInfo" } } }), this._map.set(I.DOWNLOAD_MERGER_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_LONG_MSG, ".").concat(I.DOWNLOAD_MERGER_MSG) }), body: { downloadKey: "" }, keyMap: { res: { Data: "data", Desc: "description", Ext: "extension", Download_Flag: "downloadFlag", ThumbUUID: "thumbUUID", VideoUUID: "videoUUID" } } }), this._map.set(I.UPLOAD_MERGER_MSG, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_LONG_MSG, ".").concat(I.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(I.FOLLOW, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FOLLOW, ".").concat(I.FOLLOW) }), body: { fromAccount: "", userIDList: [] }, keyMap: { req: { userIDList: "FollowItem" }, res: { ResultItem: "resultList", To_Account: "userID" } } }), this._map.set(I.UNFOLLOW, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FOLLOW, ".").concat(I.UNFOLLOW) }), body: { fromAccount: "", userIDList: [] }, keyMap: { req: { userIDList: "To_Account" }, res: { ResultItem: "resultList", To_Account: "userID" } } }), this._map.set(I.GET_FOLLOW_INFO, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FOLLOW, ".").concat(I.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(I.GET_FOLLOW, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FOLLOW, ".").concat(I.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(I.CHECK_FOLLOW_TYPE, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.FOLLOW, ".").concat(I.CHECK_FOLLOW_TYPE) }), body: { fromAccount: "", userIDList: [] }, keyMap: { req: { userIDList: "To_Account" }, res: { ResultItem: "resultList", To_Account: "userID" } } }), this._map.set(I.SET_TOKEN, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(I.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(I.STAT_FOREGROUND, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(I.STAT_FOREGROUND) }), body: { isWebUniapp: 0 } }), this._map.set(I.STAT_BACKGROUND, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_OPEN_STATUS, ".").concat(I.STAT_BACKGROUND) }), body: { C2CUnread: 0, GroupUnread: 0, isWebUniapp: 0 }, keyMap: { req: { c2cUnreadCount: "C2cUnread", groupUnreadCount: "GrpUnread" } } }), this._map.set(I.PUSH_REPORT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.OFFLINE_PUSH_REPORT, ".").concat(I.PUSH_REPORT) }), body: { eventList: [] }, keyMap: { req: { eventList: "UinappPushEvents", type: "EventType", time: "EventTime", pushId: "ClickExt" } } }), this._map.set(I.SET_ALL_RECEIVE_MSG_OPT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_MSG_LOGIC, ".").concat(I.SET_ALL_RECEIVE_MSG_OPT) }), body: { startTime: 0, endTime: 0, isRepeated: 0, messageRemindType: 0 }, keyMap: { req: { messageRemindType: "Level" } } }), this._map.set(I.GET_ALL_RECEIVE_MSG_OPT, { head: y(y({}, e2), {}, { servcmd: "".concat(a.NAME.IM_MSG_LOGIC, ".").concat(I.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 || {} : (v.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 = xt(e2.head), t2 = is(e2.body, this._getReqKeyMap(t2)); return e2.body = t2, e2; } }, { key: "_updateService", value: function(e2, t2) { var n2, o2, i2 = xt(t2.head); return this._isFromGroupRequest(t2) && (n2 = e2.type, o2 = e2.groupID, e2 = void 0 === (e2 = e2.groupIDList) ? [] : e2, A(o2 = void 0 === o2 ? void 0 : o2) && (o2 = e2[0] || ""), kt({ 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({}, za.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) && st(t2) && null !== e2[t2] && void 0 !== e2[t2] && ("object" !== r(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], nt(e2[t2]) ? o2[t2] = Array.from(e2[t2]) : $e(e2[t2]) ? o2[t2] = this._simpleDeepCopy(e2[t2]) : o2[t2] = e2[t2]; return o2; } }]), Rs), ys = [I.MSG_PUSH_ACK], Cs = (e(ks, [{ 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 (nt(o2[r2].elements.revokedInfos)) t2.onMsgRevoked({ dataList: o2 }); else if (nt(o2[r2].elements.groupMessageReadNotice)) t2.onMsgReadNotice({ dataList: o2 }); else { if (!nt(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: v.l("".concat(this._n, "._onGroupTips unknown event:").concat(n2, " dataList:"), o2); } } } }, { key: "_onC2CNotifyMsgArray", value: function(e2) { var o2, i2 = this, a2 = e2.dataList; nt(a2) && (o2 = this._sessionM.get(6), a2.forEach(function(e3) { var t2, n2; et(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 }, true) : 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; !nt(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, l2 = n2.isSyncingEnded, d2 = n2.needSync; if (nt(i2)) for (var s2, r2, c2, u2 = 0, p2 = i2.length; u2 < p2; u2++) 100 !== (c2 = (s2 = i2[u2]).event) ? 24 !== c2 ? 26 !== c2 ? (o2 = Object.keys(s2).find(function(e3) { return -1 !== t2._keys.indexOf(e3); })) ? (r2 = 14 === c2 ? { readAllC2CMessage: s2[o2], groupMessageReadInfoList: s2.groupMessageReadNotice || [] } : 16 === c2 ? { userID: s2.userID, timestamp: s2.timestamp, readReceiptList: s2[o2] } : s2[o2], this._eventHandlerMap.get(o2)({ event: c2, dataList: r2, isInstantMessage: a2, isSyncingEnded: l2, needSync: d2 })) : v.l("".concat(this._n, ".onMessage unknown eventItem:"), s2) : this._onTopicLatestMsg(s2) : this._onAllRcvMsgOptNotify(s2) : this._onRoomCustomData(s2.content); } } }, { key: "_onRoomCustomData", value: function(e2) { this._sessionM.get(30).onRoomCustomDataReceived(e2), v.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 = A(t2) ? n2 : t2.includes(a.NAME.IM_CONFIG_MANAGER) || t2.includes(a.NAME.OVERLOAD_PUSH) || t2.includes(a.NAME.STAT_SERVICE)) || (t2.includes(I.PUSHED_CLOUD_CTRL_CONFIG) ? this._sessionM.get(23).onPushedConfig(e2) : t2.includes(I.PUSHED_COMMERCIAL_CONFIG) ? this._sessionM.get(27).onPushedConfig(e2) : t2.includes(I.OVERLOAD_NOTIFY) ? this._sessionM.onPushedServerOverload(e2) : t2.includes(I.KICK_OTHER) && (n2 = Date.now(), this._sessionM.reLoginOnKickOther(), e2 = new M("kickOther"), n2 = n2 - (t2 = this._sessionM.get(1).getLastWsHelloTs()), e2.setMessage("last wshello time:".concat(t2, " diff:").concat(n2, "ms")).end()), false); } }]), ks), Ts = [{ cmd: I.GET_GRP_PROFILE, interval: 1, count: 8 }, { cmd: I.UPDATE_GRP_PROFILE, interval: 1, count: 8 }, { cmd: I.GET_AV_MBR_LIST, interval: 3, count: 1 }, { cmd: I.GET_GRP_PENDENCY, interval: 1, count: 15 }, { cmd: I.GET_TOPIC_LIST, interval: 1, count: 10 }, { cmd: I.SET_GRP_ATTR, interval: 5, count: 10 }, { cmd: I.MODIFY_GRP_ATTR, interval: 5, count: 10 }, { cmd: I.DEL_GRP_ATTR, interval: 5, count: 10 }, { cmd: I.CLEAR_GRP_ATTR, interval: 5, count: 10 }, { cmd: I.GET_GRP_ATTR, interval: 5, count: 20 }, { cmd: I.UPDATE_GRP_COUNTER, interval: 5, count: 20 }, { cmd: I.GET_GRP_COUNTER, interval: 5, count: 20 }, { cmd: I.SET_ALL_MSG_READ, interval: 1, count: 1 }, { cmd: I.GET_USER_STATUS, interval: 5, count: 20 }, { cmd: I.SUB_USER_STATUS, interval: 5, count: 20 }, { cmd: I.UNSUB_USER_STATUS, interval: 5, count: 20 }, { cmd: I.CS, interval: 5, count: 20 }, { cmd: I.GRP_CS, interval: 5, count: 20 }, { cmd: I.MBR_CS, interval: 5, count: 20 }, { cmd: I.USER_CS, interval: 5, count: 20 }, { cmd: I.CHECK_FOLLOW_TYPE, interval: 5, count: 20 }, { cmd: I.GET_GRP_ROAMING_MSG, interval: 1, count: 20 }, { cmd: I.GET_C2C_ROAMING_MSG, interval: 1, count: 20 }], Ds = /* @__PURE__ */ new Map(), Es = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"], Ls = 0, Ss = Es.length; Ls < Ss; Ls++) Ds.set(Ls, Es[Ls]); function ks(e2) { d(this, ks), 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 = D(this._eventHandlerMap.keys()); } function Rs(e2) { d(this, Rs), this._n = "PHandler", this._sessionM = e2, this._map = /* @__PURE__ */ new Map(), this._fillMap(); } function As(e2) { return d(this, As), (e2 = as.call(this, e2))._n = "ChannelModule", e2._socketHandler = new gs(h(e2)), e2._probing = false, e2._isAppShowing = true, e2._previousState = R.NET_STATE_CONNECTED, e2._timerForNotLoggedIn = -1, e2._timerForNotLoggedIn = setInterval(e2.onCheckTimer.bind(h(e2)), 1e3), e2._fatalErrorFlag = false, e2._disconnectedTS = 0, e2._lastDiagnoseTS = 0, e2; } function Os(e2) { d(this, Os), this._chM = e2, this._n = "SocketHandler", this._promiseMap = /* @__PURE__ */ new Map(), this._readyState = hs, this._simpleRequestMap = /* @__PURE__ */ new Map(), this.MAX_SIZE = 100, this._startSequence = lt(), 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 = V, this._setWebsocketHost(), this._initConnection(); } function Ns(e2) { d(this, Ns); var t2, i2, n2 = (this._handler = e2).getURL(); this._socket = null, this._workerSocket = null, this._id = lt(), 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 })) : ae ? ee ? (ue.connectSocket({ url: n2, header: { "content-type": "application/json" } }), ue.onSocketClose(this._onClose.bind(this)), ue.onSocketOpen(this._onOpen.bind(this)), ue.onSocketMessage(this._onMessage.bind(this)), ue.onSocketError(this._onError.bind(this))) : (this._socket = ue.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 Gs(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 += Ds.get(t2) + Ds.get(n2); return i2; } function Ps(e2) { if (e2 < 0 || 53 < e2) return NaN; var t2 = 0 | 1073741824 * Math.random(); return 30 < e2 ? t2 + 1073741824 * (0 | Math.random() * (1 << e2 - 30)) : t2 >>> 30 - e2; } function Us(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(ec, Fn), Ws = f(ec), e(ec, [{ key: "_init", value: function() { this._updateCmdFreqLimitMap(Ts); } }, { key: "_onCloudConfig", value: function() { var e2 = this.getCloudConfig("cmd_frequency_limit"); A(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) { v.d("".concat(this._n, ".req options:"), e2); var t2 = e2.P; if (!this._pHandler.has(t2)) return v.w("".concat(this._n, ".req unknown P:").concat(t2)), C({ code: T.NO_PROTOCOL }); var e2 = this.getProtocolData(e2), n2 = e2.head.servcmd; if (this._isFreqOverLimit(n2)) return C({ code: o2 = T.OVER_FREQUENCY_LIMIT, message: this.getErrMsg(o2, this._getCmd(n2)) }); if (this._isServerOverload(n2)) return C({ code: o2 = T.OPEN_SERVICE_OVERLOAD_ERROR, message: this.getErrMsg(o2, this._getCmd(n2)) }); var o2 = this.get(21); return ys.includes(t2) ? o2.simplySend(e2) : o2.send(e2); } }, { 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: x, websdkversion: q, 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: Gs(""), cappid: e2.getApplicationID(), cs: 0 }; } }, { key: "genCosSpecifiedHead", value: function() { var e2 = this.get(12); return { ver: "v4", platform: this._platform, websdkappid: x, websdkversion: q, sdkappid: e2.getSDKAppID(), contenttype: e2.getContentType(), reqtime: 0, identifier: e2.getUserID(), usersig: e2.getUserSig(), status_instid: e2.getStatusInstanceID(), sdkability: 12775283, sdkability_ext: Gs(""), cappid: e2.getApplicationID(), cs: 0 }; } }, { key: "genSSOReportHead", value: function() { var e2 = this.get(12); return { ver: "v4", platform: this._platform, websdkappid: x, websdkversion: q, sdkappid: e2.getSDKAppID(), contenttype: "", reqtime: 0, identifier: "", usersig: "", status_instid: e2.getStatusInstanceID(), sdkability: 12775283, sdkability_ext: Gs(""), cappid: e2.getApplicationID(), cs: 0 }; } }, { 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 === T.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 !== T.MSG_A2KEY_EXPIRED && n2 !== T.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() { v.l("".concat(this._n, ".reLoginOnKickOther")), this._reLogin(); } }, { key: "_reLoginOnReconnected", value: function() { v.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 M("reLogin"), this.req({ P: I.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 = $o(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), v.l("".concat(c2, " ok. ").concat(a2)), n2.getCustomStatus() !== o2 && r2.get(4).onUserStatusUpdated({ dataList: [{ to: r2.getMyUserID(), statusType: R.USER_STATUS_ONLINE, customStatus: e3 }] }), i2.diagnose(), r2.get(11).syncConvList(r2._incrementalPullContactFlag).then(function() { v.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: I.MSG_PUSH_ACK, data: { sessionData: e2 } }); } }, { key: "_isFreqOverLimit", value: function(e2) { e2 = e2.split(".")[1]; if (!this._cmdFreqLimitMap.has(e2)) return false; if (!this._cmdReqInfoMap.has(e2)) return this._cmdReqInfoMap.set(e2, { startTime: Date.now(), requestCount: 1 }), false; var t2 = this._cmdFreqLimitMap.get(e2), n2 = t2.count, t2 = t2.interval, o2 = this._cmdReqInfoMap.get(e2), i2 = o2.startTime, o2 = o2.requestCount; return Date.now() - i2 > 1e3 * t2 ? (this._cmdReqInfoMap.set(e2, { startTime: Date.now(), requestCount: 1 }), false) : (this._cmdReqInfoMap.set(e2, { startTime: i2, requestCount: o2 += 1 }), n2 < o2); } }, { key: "_isServerOverload", value: function(e2) { if (!this._serverOverloadInfoMap.has(e2)) return false; var t2 = this._serverOverloadInfoMap.get(e2), n2 = t2.overloadTime, t2 = t2.waitingTime; return Date.now() - n2 <= 1e3 * t2 || (this._serverOverloadInfoMap.delete(e2), false); } }, { key: "_getCmd", value: function(e2) { var t2 = ""; if (!e2.includes(".")) return t2; var n2, o2 = e2.split(".")[1]; for (n2 in I) if (I[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 }), v.w("".concat(this._n, ".onPushedServerOverload waitingTime:").concat(e2, "s cmd:").concat(this._getCmd(t2))); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this._updateCmdFreqLimitMap(Ts), this._cmdReqInfoMap.clear(), this._serverOverloadInfoMap.clear(), this._incrementalPullContactFlag = true; } }]); var bs, ws, Fs, qs, xs, Vs, Hs, Bs, Ks, Ys, Ws, js = ec, Js = (t($r, Fn), Ys = f($r), e($r, [{ key: "getCloudConfig", value: function(e2) { return A(e2) ? this._cloudConfig : this._cloudConfig.has(e2) ? this._cloudConfig.get(e2) : void 0; } }, { key: "getServerConfig", value: function(e2) { var t2 = { code: 0, data: "" }; return !A(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(); v.l("".concat(a2, " canFetch:").concat(e2)), e2 && (o2 = new M("fetchCloudCtrlConfig"), e2 = this.get(12).getSDKAppID(), this._isFetching = true, this.req({ P: I.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(), v.l("".concat(a2, " ok")), i2._parse(e3.data); }).catch(function(e3) { i2._isFetching = false, o2.setError(e3).end(), v.l("".concat(a2, " failed. error:"), e3), i2._setExpiredTime(12e4); })); } }, { key: "onPushedConfig", value: function(e2) { v.l("".concat(this._n, ".onPushedConfig config:"), e2), new M("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() || v.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(Wo.CLOUD_CONFIG)); } this._setExpiredTime(1e3 * r2); } else A(o2) ? (v.l("".concat(n2, " failed. Invalid message format:"), e2), this._setExpiredTime(36e5)) : (v.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() { v.l("".concat(this._n, ".reset")), this._cloudConfig.clear(), this._expiredTime = 0, this._version = 0, this._isFetching = false; } }]), $r), zs = (t(Qr, Fn), Ks = f(Qr), e(Qr, [{ 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 === R.CONV_GROUP && e3.groupProfile.type !== R.GRP_AVCHATROOM; }), r2 = this.get(11), c2 = []; e2.forEach(function(e3) { var t2 = e3.conversationID, e3 = e3.lastMessage; n2 = t2.replace(R.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)) : 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 === R.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() { v.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 = (v.l("".concat(p2, " options:"), e2), e2.groupID), h2 = e2.localLastMessageSequence, g2 = e2.remoteLastMessageSequence, f2 = JSON.stringify(e2), m2 = new M("_recoverGroupMsg"); m2.setMessage(f2), this._getGroupRoamingMsg({ groupID: _2, sequence: h2 }).then(function(e3) { var e3 = e3.data, t2 = e3.complete, n2 = e3.messageList; if (!A(n2)) { var e3 = n2[0].sequence, o2 = n2.map(function(e4) { return e4.sequence; }), o2 = "".concat(f2, " complete:").concat(t2, " sequenceList:").concat(o2), i2 = (v.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 === R.CONV_SYSTEM) { a2 = true; break; } if (a2) for (var c2 = 0, l2 = n2.length; c2 < l2; c2++) { var u2 = n2[c2]; u2.from !== R.CONV_SYSTEM ? i2.onNewMessage({ dataList: [u2], isInstantMessage: false, updateUnreadCount: false }) : i2.onNewGroupTips({ event: u2.event, dataList: [u2] }); } else i2.onNewMessage({ dataList: n2, isInstantMessage: false, updateUnreadCount: false }); } }).catch(function(e3) { m2.setError(e3).end(), v.w("".concat(p2, " failed. error:"), e3); }); } }, { key: "_getGroupNotice", value: function(e2) { var t2 = e2.length; if (v.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: I.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 = (v.l("".concat(i2, " options:"), e2), e2.conversationID), t2 = e2.localLastMessageTime, s2 = e2.remoteLastMessageTime, r2 = JSON.stringify(e2), c2 = new M("_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 (!A(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 (v.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(), v.w("".concat(i2, " failed. error:"), e3); }); } }, { key: "_getC2CRoamingMsg", value: function(e2) { var t2 = e2.conversationID, e2 = e2.time; return this.req({ P: I.GET_C2C_ROAMING_MSG, data: { peerAccount: t2.replace(R.CONV_C2C, ""), count: this.PULL_LIMIT_COUNT + 1, lastMessageTime: e2, direction: 1 } }); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")); } }]), Qr), Xs = (e(Zr, [{ key: "addMessageDelay", value: function(e2) { e2 = Oe() - e2; 0 <= e2 && this._e2eDelayArray.push(e2); } }, { key: "_calcAvg", value: function(e2, t2) { if (0 === t2) return 0; var n2 = 0; return e2.forEach(function(e3) { n2 += e3; }), Vt(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 = Vt(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, D(a2)), i2 = Math.max.apply(Math, D(a2)), a2 = this._calcAvg(a2, n2), 50 < (e2 = Vt(n2 / e2.length * 100, 2)) && new M("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 = this._e2eDelayArray.length; if (0 === e2) return null; var t2 = D(this._e2eDelayArray), n2 = this._calcCountWithLimit({ e2eDelayArray: t2, min: 0, max: 1 }), o2 = this._calcCountWithLimit({ e2eDelayArray: t2, min: 1, max: 3 }), i2 = this._calcPercent(n2, e2), a2 = this._calcPercent(o2, e2), s2 = this._calcAvg(t2, e2); return this._checkE2EDelayException(t2, 3), t2.length = 0, this.reset(), { totalCount: e2, countLessThan1Second: n2, percentOfCountLessThan1Second: i2, countLessThan3Second: o2, percentOfCountLessThan3Second: a2, avgDelay: s2 }; } }, { key: "reset", value: function() { this._e2eDelayArray.length = 0; } }]), Zr), Zs = (e(Xr, [{ 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) { if (0 === t2) return 0; e2 = Vt(e2 / t2 * 100, 2); return e2 = 100 < e2 ? 100 : e2; } }, { key: "_calcAvg", value: function(e2, t2) { if (0 === t2) return 0; var n2 = 0; return e2.forEach(function(e3) { n2 += e3; }), parseInt(n2 / t2); } }, { key: "_calcMax", value: function() { return Math.max.apply(Math, D(this._rttArray)); } }, { key: "_calcMin", value: function() { return Math.min.apply(Math, D(this._rttArray)); } }, { key: "getStatResult", value: function() { var e2 = this._calcTotalCount(), t2 = D(this._rttArray); if (0 === e2) return null; var n2 = this._calcRTTCount(t2), o2 = this._calcSuccessRateOfRequest(n2, e2), t2 = this._calcAvg(t2, n2); return v.l("".concat(this._n, ".getStatResult max:").concat(this._calcMax(), " min:").concat(this._calcMin(), " avg:").concat(t2)), this.reset(), { totalCount: e2, rttCount: n2, successRateOfRequest: o2, avgRTT: t2 }; } }, { key: "reset", value: function() { this._requestCount = 0, this._rttArray.length = 0; } }]), Xr), Qs = (e(zr, [{ 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 !(A(e2) || !this._map.has(e2) || (this._map.get(e2).totalCount += 1, 0)); } }, { key: "addSuccessCount", value: function(e2) { return !(A(e2) || !this._map.has(e2) || (this._map.get(e2).successCount += 1, 0)); } }, { key: "addFailedCountOfUserSide", value: function(e2) { return !(A(e2) || !this._map.has(e2) || (this._map.get(e2).failedCountOfUserSide += 1, 0)); } }, { key: "addCost", value: function(e2, t2) { return !(A(e2) || !this._map.has(e2) || (this._map.get(e2).costArray.push(t2), 0)); } }, { key: "addFileSize", value: function(e2, t2) { return !(A(e2) || !this._map.has(e2) || (this._map.get(e2).fileSizeArray.push(t2), 0)); } }, { key: "_calcSuccessRateOfBusiness", value: function(e2) { if (A(e2) || !this._map.has(e2)) return -1; e2 = this._map.get(e2), e2 = Vt(e2.successCount / e2.totalCount * 100, 2); return e2 = 100 < e2 ? 100 : e2; } }, { key: "_calcSuccessRateOfPlatform", value: function(e2) { if (A(e2) || !this._map.has(e2)) return -1; var t2 = this._map.get(e2), e2 = this._calcSuccessCountOfPlatform(e2) / t2.totalCount * 100; return e2 = 100 < (e2 = Vt(e2, 2)) ? 100 : e2; } }, { key: "_calcTotalCount", value: function(e2) { return A(e2) || !this._map.has(e2) ? -1 : this._map.get(e2).totalCount; } }, { key: "_calcSuccessCountOfBusiness", value: function(e2) { return A(e2) || !this._map.has(e2) ? -1 : this._map.get(e2).successCount; } }, { key: "_calcSuccessCountOfPlatform", value: function(e2) { if (A(e2) || !this._map.has(e2)) return -1; e2 = this._map.get(e2); return e2.successCount + e2.failedCountOfUserSide; } }, { key: "_calcAvg", value: function(e2) { return A(e2) || !this._map.has(e2) ? -1 : e2 === Zn ? this._calcAvgSpeed(e2) : this._calcAvgCost(e2); } }, { key: "_calcAvgCost", value: function(e2) { var t2 = this._map.get(e2).costArray.length; if (0 === t2) return 0; var n2 = 0; return this._map.get(e2).costArray.forEach(function(e3) { n2 += e3; }), parseInt(n2 / t2); } }, { 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 = this._calcTotalCount(e2); if (0 === t2) return null; var n2 = this._calcSuccessCountOfBusiness(e2), o2 = this._calcSuccessRateOfBusiness(e2), i2 = this._calcSuccessCountOfPlatform(e2), a2 = this._calcSuccessRateOfPlatform(e2), s2 = this._calcAvg(e2); return this.reset(e2), { totalCount: t2, successCountOfBusiness: n2, successRateOfBusiness: o2, successCountOfPlatform: i2, successRateOfPlatform: a2, avgValue: s2 }; } }, { key: "reset", value: function(e2) { A(e2) ? this._map.clear() : this._map.set(e2, { totalCount: 0, successCount: 0, failedCountOfUserSide: 0, costArray: [], fileSizeArray: [] }); } }]), zr), $s = (e(Jr, [{ 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 = e2.key, n2 = e2.message; if (A(t2) || !this._lastMap.has(t2) || !this._currentMap.has(t2)) return false; var o2, i2, a2 = n2.conversationID, n2 = n2.sequence, a2 = a2.replace(R.CONV_GROUP, ""); return 0 !== this._lastMap.get(t2).size && this._lastMap.get(t2).has(a2) ? (i2 = (o2 = this._lastMap.get(t2).get(a2)).length - 1, n2 > o2[0] && n2 < o2[i2] ? (o2.push(n2), o2.sort(), this._lastMap.get(t2).set(a2, o2)) : this._addCurrentMap(e2)) : this._addCurrentMap(e2), true; } }, { key: "_addCurrentMap", value: function(e2) { var t2 = e2.key, e2 = e2.message, n2 = e2.conversationID, e2 = e2.sequence, n2 = n2.replace(R.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 (!A(e2)) { this._lastMap.set(e2, /* @__PURE__ */ new Map()); var t2, n2 = this._lastMap.get(e2), o2 = N(this._currentMap.get(e2)); try { for (o2.s(); !(t2 = o2.n()).done; ) { var i2 = m(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) { if (A(this._currentMap.get(e2)) || A(this._lastMap.get(e2))) return null; if (0 === this._lastMap.get(e2).size) return this._copyData(e2), null; var o2 = 0, i2 = 0; if (this._lastMap.get(e2).forEach(function(e3, t3) { var e3 = D(e3.values()), n2 = e3.length, e3 = e3[n2 - 1] - e3[0] + 1; o2 += e3, i2 += n2; }), 0 === o2) return null; var t2 = Vt(i2 / o2 * 100, 2); return 100 < t2 && (t2 = 100), this._copyData(e2), { totalCount: o2, successCountOfMessageReceived: i2, successRateOfMessageReceived: t2 }; } }, { key: "reset", value: function() { this._currentMap.clear(), this._lastMap.clear(); } }]), Jr), er = (t(jr, Fn), Bs = f(jr), e(jr, [{ 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); !Je(n2) && it(n2.forEach) && (v.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"); A(e2) || (this.REPORT_INTERVAL = Number(e2)), A(t2) || (this.REPORT_SDKAPPID_BLACKLIST = t2.split(",").map(function(e3) { return Number(e3); })), A(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) || v.w("".concat(this._n, ".addTotalCount invalid key:"), e2); } }, { key: "addSuccessCount", value: function(e2) { this._rateMessageSent.addSuccessCount(e2) || v.w("".concat(this._n, ".addSuccessCount invalid key:"), e2); } }, { key: "addFailedCountOfUserSide", value: function(e2) { this._rateMessageSent.addFailedCountOfUserSide(e2) || v.w("".concat(this._n, ".addFailedCountOfUserSide invalid key:"), e2); } }, { key: "addCost", value: function(e2, t2) { this._rateMessageSent.addCost(e2, t2) || v.w("".concat(this._n, ".addCost invalid key or cost:"), e2, t2); } }, { key: "addFileSize", value: function(e2, t2) { this._rateMessageSent.addFileSize(e2, t2) || v.w("".concat(this._n, ".addFileSize invalid key or size:"), e2, t2); } }, { key: "addMessageSequence", value: function(e2) { this._rateMessageReceived.addMessageSequence(e2) || v.w("".concat(this._n, ".addMessageSequence invalid key:"), e2.key); } }, { key: "_getQualityItem", value: function(e2) { var t2 = {}, n2 = oo[this.get(15).getNetworkType()], n2 = (A(n2) && (n2 = 8), { qualityType: to[e2], timestamp: Pe(), networkType: n2, extension: "" }); switch (e2) { case Yn: t2 = this._avgRTT.getStatResult(); break; case Wn: t2 = this._avgE2EDelay.getStatResult(); break; case jn: case Jn: case zn: case Xn: case Zn: t2 = this._rateMessageSent.getStatResult(e2); break; case Qn: case $n: case eo: 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 = (A(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)), v.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 = Ht(this.REPORT_SDKAPPID_BLACKLIST, i2) && !Bt(this.REPORT_TINYID_WHITELIST, e2) ? [] : n2).length && this._doReport(n2); } }, { key: "_doReport", value: function(t2) { var n2 = this, e2 = { header: pa(this), quality: t2 }; this.req({ P: I.SSO_STAT, data: y({}, e2) }).then(function() { n2.reportIndex++, n2.wholePeriod = false; }).catch(function(e3) { v.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"); Je(t2) ? (v.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)), v.l("".concat(o2, " count:").concat(n2.length)), e2.setItem(this.TAG, n2, true, false)), this._statInfoArr = []; } }, { key: "reset", value: function() { v.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(); } }]), jr), tr = e(function e2(t2) { d(this, e2), Je(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 || ""); }), nr = (e(Wr, [{ key: "getLocalApplicationList", value: function() { return { friendApplicationList: D(this._map.values()), unreadCount: this._unreadCount }; } }, { key: "_onApplicationListUpdated", value: function() { this._snsM.emitOEvt(G.FRIEND_APPLICATION_LIST_UPDATED, { friendApplicationList: D(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; Je(e2) || (n2 = "", n2 = t2 === this._snsM.getMyUserID() ? R.SNS_APPLICATION_SENT_BY_ME : R.SNS_APPLICATION_SENT_TO_ME, o2 = false, e2.forEach(function(e3) { var t3 = "".concat(e3.userID, "_").concat(n2); n2 !== R.SNS_APPLICATION_SENT_TO_ME || i2._map.has(t3) || (i2._unreadCount += 1), i2._map.set(t3, new tr(y(y({}, e3), {}, { type: n2 }))), o2 = true; }), o2 && this._onApplicationListUpdated()); } }, { key: "onApplicationDeleted", value: function(e2) { Je(e2) || (this._startTime = 0, this._currentSeq = 0, this.getApplicationList()); } }, { key: "getApplicationList", value: function() { var a2 = this, s2 = "".concat(this._n, ".").concat("getApplicationList"), r2 = new M("getApplicationList"); return this._snsM.req({ P: I.GET_FD_APPLICATION_LIST, data: { applicationType: R.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, nt(t2) ? t2.length : 0), i2 = "applicationCount:".concat(i2, " unreadCount:").concat(n2, " startTime:").concat(o2, " currentSequence:").concat(e2); r2.setMessage(i2).end(), v.i("".concat(s2, " ok. ").concat(i2)), a2._map.clear(), nt(t2) && t2.forEach(function(e3) { var t3 = e3.userID, n3 = e3.type, e3 = new tr(e3); a2._map.set("".concat(t3, "_").concat(n3), e3); }), a2._onApplicationListUpdated(); }).catch(function(e2) { return r2.setError(e2).end(), v.w("".concat(s2, " failed. error:"), e2), C(e2); }); } }, { key: "deleteApplication", value: function(e2) { var i2 = "".concat(this._n, ".").concat("deleteApplication"), a2 = e2.userID, s2 = e2.type; if (s2 && (s2 === R.SNS_APPLICATION_SENT_BY_ME || s2 === R.SNS_APPLICATION_SENT_TO_ME) || (s2 = R.SNS_APPLICATION_SENT_TO_ME), !this._map.has("".concat(a2, "_").concat(s2))) return C({ code: T.FRIEND_APPLICATION_NOT_EXIST }); var r2 = new M("deleteApplication"); return r2.setMessage("userID:".concat(a2, " type:").concat(s2)), this._snsM.req({ P: I.DEL_FD_APPLICATION, data: { fromAccount: this._snsM.getMyUserID(), userIDList: [a2], type: s2 } }).then(function(e3) { var e3 = e3.data.resultList, t2 = e3[0], n2 = t2.to, o2 = t2.resultCode, t2 = t2.resultInfo; return r2.setMoreMessage("resultList:".concat(JSON.stringify(e3))).end(), v.i("".concat(i2, " ok. userID:").concat(a2, " type:").concat(s2)), 0 === o2 ? Sn() : C({ userID: n2, code: o2, message: t2 }); }).catch(function(e3) { return r2.setError(e3).end(), v.w("".concat(i2, " failed. error:"), e3), C(e3); }); } }, { 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 === R.SNS_APPLICATION_AGREE || a2 === R.SNS_APPLICATION_AGREE_AND_ADD) || (a2 = R.SNS_APPLICATION_AGREE_AND_ADD), new M("acceptApplication")); return s2.setMessage("userID:".concat(o2, " type:").concat(a2)), this._snsM.req({ P: I.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 C({ code: t3, message: e3 }); v.i("".concat(n2, " ok. userID:").concat(o2, " type:").concat(a2)); }).catch(function(e3) { return s2.setError(e3).end(), v.w("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "refuseApplication", value: function(e2) { var n2 = "".concat(this._n, ".").concat("refuseApplication"), o2 = e2.userID, i2 = new M("refuseApplication"); return i2.setMessage("userID:".concat(o2)), this._snsM.req({ P: I.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 C({ code: t2, message: e3 }); v.i("".concat(n2, " ok. userID:").concat(o2)); }).catch(function(e3) { return i2.setError(e3).end(), v.w("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "setApplicationRead", value: function() { var t2 = this, n2 = "".concat(this._n, ".").concat("setApplicationRead"), o2 = new M("setApplicationRead"); return this._snsM.req({ P: I.REPORT_FD_APPLICATION, data: { fromAccount: this._snsM.getMyUserID(), latestTimeStamp: Vt(Pe() / 1e3, 0) } }).then(function(e2) { o2.end(), v.i("".concat(n2, " ok")), t2._unreadCount = 0; }).catch(function(e2) { return o2.setError(e2).end(), v.w("".concat(n2, " failed. error:"), e2), C(e2); }); } }, { key: "reset", value: function() { this._maxLimited = 100, this._currentSeq = 0, this._unreadCount = 0, this._map.clear(); } }]), Wr), or = (e(Yr, [{ key: "validate", value: function(e2) { var t2, n2 = true, o2 = ""; if (Je(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], !ft(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 (!ft(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 (Je(e2[t2]) && !ft(e2[t2]) && !Qe(e2[t2])) { o2 = "key:" + t2 + ", invalid value:" + e2[t2], n2 = false; continue; } switch (t2) { case "nick": ft(e2[t2]) || (n2 = !(o2 = "nick must be a string")), 500 < ut(e2[t2]) && (o2 = "nick name limited: must less than or equal to ".concat(500, " bytes, current size: ").concat(ut(e2[t2]), " bytes"), n2 = false); break; case "gender": pt(Ve, e2.gender) || (o2 = "key:gender, invalid value:" + e2.gender, n2 = false); break; case "birthday": Qe(e2.birthday) || (n2 = !(o2 = "birthday must be a number")); break; case "location": ft(e2.location) || (n2 = !(o2 = "location must be a string")); break; case "selfSignature": ft(e2.selfSignature) || (n2 = !(o2 = "selfSignature must be a string")); break; case "allowType": pt(Be, e2.allowType) || (o2 = "key:allowType, invalid value:" + e2.allowType, n2 = false); break; case "language": Qe(e2.language) || (n2 = !(o2 = "language must be a number")); break; case "avatar": ft(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": pt(He, e2.adminForbidType) || (o2 = "key:adminForbidType, invalid value:" + e2.adminForbidType, n2 = false); break; case "level": Qe(e2.level) || (n2 = !(o2 = "level must be a number")); break; case "role": Qe(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 qe.NICK: this.profile.nick = t2; break; case qe.GENDER: this.profile.gender = t2; break; case qe.BIRTHDAY: this.profile.birthday = t2; break; case qe.LOCATION: this.profile.location = t2; break; case qe.SELFSIGNATURE: this.profile.selfSignature = t2; break; case qe.ALLOWTYPE: this.profile.allowType = t2; break; case qe.LANGUAGE: this.profile.language = t2; break; case qe.AVATAR: this.profile.avatar = t2; break; case qe.MESSAGESETTINGS: this.profile.messageSettings = t2; break; case qe.ADMINFORBIDTYPE: this.profile.adminForbidType = t2; break; case qe.LEVEL: this.profile.level = t2; break; case qe.ROLE: this.profile.role = t2; break; case xe.REMARK: this.remark = t2; break; case xe.ADDTIME: this.addTime = t2; break; case xe.GROUP: this.groupList = JSON.parse(JSON.stringify(t2)); break; case xe.ADDSOURCE: this.source = t2; break; case xe.ADDWORDING: break; default: v.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); } }]), Yr), ir = (e(Kr, [{ key: "getLocalFriendList", value: function() { return D(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; Je(e2) || (o2 = this._snsM.get(11), e2.forEach(function(e3) { var t2, n2 = e3.userID, e3 = e3.profileList; i2.isMyFriend(n2) && (v.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(R.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 && (v.l("".concat(this._n, ".onFriendAdded userIDList:").concat(t2)), t2.forEach(function(e2) { n2._map.set(e2, new or(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 && (v.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(G.FRIEND_LIST_UPDATED), this._snsM.get(11).checkAndPatchRemark(); } }, { key: "getFriendProfile", value: function(e2) { var a2 = this, t2 = "".concat(this._n, ".").concat("getFriendProfile"), e2 = e2.userIDList, s2 = [], r2 = [], n2 = []; if (e2.forEach(function(e3) { var t3; a2._map.has(e3) ? (t3 = a2._map.get(e3), Date.now() - t3.timestamp < a2._expirationTime ? r2.push(t3) : n2.push(e3)) : s2.push({ userID: e3, code: T.NOT_MY_FRIEND, message: a2._snsM.getErrMsg(T.NOT_MY_FRIEND) }); }), 0 === n2.length) return v.i("".concat(t2, " newUserIDList is empty")), kn({ friendList: r2, failureUserIDList: s2 }); var o2 = new M("getFriendProfile"); return o2.setMessage("userIDList:".concat(n2)), v.i("".concat(t2, " userIDList:").concat(n2)), this._snsM.req({ P: I.GET_FD_PROFILE, data: { fromAccount: this._snsM.getMyUserID(), userIDList: n2 } }).then(function(e3) { return o2.end(), v.i("".concat(t2, " ok")), e3.data.resultList.forEach(function(e4) { var t3, n3 = e4.to, o3 = e4.resultCode, i2 = e4.resultInfo, e4 = e4.tagValueList; A(o3) || 0 === o3 ? (a2._map.has(n3) ? (t3 = a2._map.get(n3)).update(e4) : (t3 = new or(n3, e4), a2._map.set(n3, t3)), r2.push(t3)) : s2.push({ userID: n3, code: o3, message: i2 }); }), Sn({ friendList: r2, failureUserIDList: s2 }); }).catch(function(e3) { return o2.setError(e3).end(), v.w("".concat(t2, " failed. error:"), e3), C(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 M("getFriendList"), u2 = Date.now(); this._snsM.req({ P: I.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(Qt(u2))); c2.setMessage(t2).end(), v.i("".concat(r2, " ok."), t2), Je(n2) || n2.forEach(function(e3) { var t3 = e3.to, e3 = e3.tagValueList; s2._map.set(t3, new or(t3, e3)); }), 0 === e2 ? s2.pagingGetFriendList() : (s2._snsM.emitOEvt(G.FRIEND_LIST_UPDATED), s2._pagingGetFriendProfile()); }).catch(function(e2) { return c2.setError(e2).end(), v.w("".concat(r2, " failed. error:"), e2), C(e2); }); } }, { key: "_pagingGetFriendProfile", value: function() { var n2 = this, e2 = D(this._map.keys()), t2 = this._snsM.get(4), o2 = e2.length, i2 = o2 <= 100 ? 1 : Math.ceil(o2 / 100); v.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 o2 = this, i2 = "".concat(this._n, ".").concat("addFriend"); if (this._map.has(e2.to)) return C({ code: T.ALREADY_MY_FRIEND }); if (e2.wording && false === this._snsM.filterProfanity("wording", e2)) return C({ code: T.PROFANITY_FOUND }); var t2 = e2.to, n2 = e2.source, a2 = e2.type, s2 = e2.wording, r2 = e2.remark, e2 = e2.groupName, c2 = a2, u2 = (c2 && (c2 === R.SNS_ADD_TYPE_SINGLE || c2 === R.SNS_ADD_TYPE_BOTH) || (c2 = R.SNS_ADD_TYPE_BOTH), new M("addFriend")); return u2.setMessage("to:".concat(t2, " source:").concat(n2, " type:").concat(c2)), this._snsM.req({ P: I.ADD_FD, data: { fromAccount: this._snsM.getMyUserID(), addFriendItem: [{ to: t2, source: n2, wording: s2, remark: r2, groupName: e2 }], type: c2 } }).then(function(e3) { var e3 = e3.data.resultList, e3 = (u2.setMoreMessage("resultList:".concat(JSON.stringify(e3))).end(), e3[0]), t3 = e3.to, n3 = e3.resultCode, e3 = e3.resultInfo; return v.i("".concat(i2, " ok. to:").concat(t3, " type:").concat(c2, " code:").concat(n3)), A(n3) || 0 === n3 ? Sn({ userID: t3, code: 0 }) : 30539 === n3 ? Sn({ userID: t3, code: n3, message: o2._snsM.getErrMsg(n3) }) : C({ userID: t3, code: n3, message: o2._snsM.getErrMsg(n3) || e3 }); }).catch(function(e3) { return u2.setError(e3).end(), v.w("".concat(i2, " failed. error:"), e3), C(e3); }); } }, { key: "deleteFriend", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("deleteFriend"), o2 = e2.userIDList, e2 = e2.type, i2 = (1e3 < o2.length && (v.w("".concat(n2, " ").concat(zt(1e3))), o2.length = 1e3), []), a2 = [], s2 = []; if (o2.forEach(function(e3) { t2._map.has(e3) ? s2.push(e3) : i2.push({ userID: e3, code: T.NOT_MY_FRIEND, message: t2._snsM.getErrMsg(T.NOT_MY_FRIEND) }); }), 0 === s2.length) return kn({ successUserIDList: a2, failureUserIDList: i2 }); var o2 = e2, r2 = (o2 && (o2 === R.SNS_DELETE_TYPE_SINGLE || o2 === R.SNS_DELETE_TYPE_BOTH) || (o2 = R.SNS_DELETE_TYPE_BOTH), new M("deleteFriend")); return r2.setMessage("userIDList:".concat(s2, " type:").concat(o2)), this._snsM.req({ P: I.DEL_FD, data: { fromAccount: this._snsM.getMyUserID(), userIDList: s2, type: o2 } }).then(function(e3) { r2.end(), v.i("".concat(n2, " ok")); e3 = e3.data.resultList; return Je(e3) || e3.forEach(function(e4) { var t3 = e4.to, n3 = e4.resultCode, e4 = e4.resultInfo; A(n3) || 0 === n3 ? a2.push({ userID: t3 }) : i2.push({ userID: t3, code: n3, message: e4 }); }), Sn({ successUserIDList: a2, failureUserIDList: i2 }); }).catch(function(e3) { return r2.setError(e3).end(), v.w("".concat(n2, " error:"), e3), C(e3); }); } }, { key: "updateFriend", value: function(e2) { var o2 = this, t2 = e2.userID, i2 = e2.remark, a2 = e2.friendCustomField; if (!this._map.has(t2)) return C({ code: T.NOT_MY_FRIEND }); var s2 = "".concat(this._n, ".").concat("updateFriend"), r2 = new M("updateFriend"), n2 = (r2.setMessage("userID:".concat(t2, " remark:").concat(i2, " friendCustomField:").concat(a2)), []); return A(i2) || n2.push({ tag: xe.REMARK, value: i2 }), nt(a2) && 0 < a2.length && a2.forEach(function(e3) { n2.push({ tag: e3.key, value: e3.value }); }), this._snsM.req({ P: I.UPDATE_FD, data: { fromAccount: this._snsM.getMyUserID(), updateItem: [{ to: t2, snsItem: n2 }] } }).then(function(e3) { r2.end(), v.i("".concat(s2, " ok")); var e3 = e3.data.resultList[0], t3 = e3.to, n3 = e3.resultCode, e3 = e3.resultInfo; return A(n3) || 0 === n3 ? ((t3 = o2._map.get(t3)) && (A(i2) || (t3.remark = i2), nt(a2) && 0 < a2.length && Tt(t3.friendCustomField, a2), o2._onFriendListUpdated()), Sn(t3)) : C({ code: n3, message: e3 }); }).catch(function(e3) { return r2.setError(e3).end(), v.w("".concat(s2, " failed. error:"), e3), C(e3); }); } }, { key: "checkFriend", value: function(e2) { var t2 = "".concat(this._n, ".").concat("checkFriend"), n2 = e2.userIDList, o2 = e2.type, s2 = (o2 && (o2 === R.SNS_CHECK_TYPE_SINGLE || o2 === R.SNS_CHECK_TYPE_BOTH) || (o2 = R.SNS_CHECK_TYPE_BOTH), new M("checkFriend")); return s2.setMessage("userIDList:".concat(n2, " type:").concat(o2)), this._snsM.req({ P: I.CHECK_FD, data: { fromAccount: this._snsM.getMyUserID(), userIDList: n2, type: o2 } }).then(function(e3) { s2.end(), v.i("".concat(t2, " ok. userIDList:").concat(n2, " type:").concat(o2)); var i2 = [], a2 = [], e3 = e3.data.resultList; return nt(e3) && e3.forEach(function(e4) { var t3 = e4.to, n3 = e4.relation, o3 = e4.resultCode, e4 = e4.resultInfo; A(o3) || 0 === o3 ? i2.push({ userID: t3, code: 0, relation: n3 }) : a2.push({ userID: t3, code: o3, message: e4 }); }), Sn({ successUserIDList: i2, failureUserIDList: a2 }); }).catch(function(e3) { return s2.setError(e3).end(), v.w("".concat(t2, " failed. error:"), e3), C(e3); }); } }, { key: "onAddedToFriendGroup", value: function(e2) { var t2 = this, n2 = e2.name, e2 = e2.userIDList; v.l("".concat(this._n, ".onAddedToFriendGroup groupName:").concat(n2, " userIDList:").concat(e2)), n2 && !Je(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; v.l("".concat(this._n, ".onRemovedFromFriendGroup groupName:").concat(n2, " userIDList:").concat(e2)), n2 && !Je(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; } }]), Kr), ar = (e(Br, [{ 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); } }]), Br), sr = (e(Hr, [{ key: "getLocalGroupList", value: function() { return D(this._map.values()); } }, { key: "_onGroupListUpdated", value: function() { var e2 = D(this._map.values()); this._snsM.emitOEvt(G.FRIEND_GROUP_LIST_UPDATED, e2); } }, { key: "getGroupList", value: function() { var n2 = this, t2 = "".concat(this._n, ".").concat("getGroupList"), o2 = new M("getGroupList"); return this._snsM.req({ P: I.GET_FD_GRP_LIST, data: { fromAccount: this._snsM.getMyUserID() } }).then(function(e2) { o2.end(); e2 = e2.data.resultList; Je(e2) ? v.i("".concat(t2, " ok. count:0")) : (v.i("".concat(t2, " ok. count:").concat(e2.length)), n2._map.clear(), e2.forEach(function(e3) { var t3 = new ar(e3); n2._map.set(e3.name, t3); }), n2._onGroupListUpdated()); }).catch(function(e2) { return o2.setError(e2).end(), v.w("".concat(t2, " error:"), e2), C(e2); }); } }, { key: "createGroup", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("createGroup"), o2 = e2.name, e2 = e2.userIDList; if (this._map.has(o2)) return C({ code: T.FRIEND_GRP_EXISTED }); var s2 = "name:".concat(o2, " userIDList:").concat(e2), r2 = new M("createGroup"); return r2.setMessage(s2), this._snsM.req({ P: I.CREATE_FD_GRP, data: { fromAccount: this._snsM.getMyUserID(), groupName: [o2], userIDList: nt(e2) ? e2 : void 0 } }).then(function(e3) { r2.end(), v.l("".concat(n2, " ok. ").concat(s2)); var e3 = e3.data.resultList, i2 = [], a2 = [], e3 = (e3 && e3.forEach(function(e4) { var t3 = e4.to, n3 = e4.resultCode, o3 = e4.resultInfo; A(n3) || 0 === n3 ? i2.push(t3) : (t3 = { userID: e4.to, code: n3, message: o3 }, a2.push(t3)); }), new ar({ name: o2, userIDList: i2 })); return t2._map.set(o2, e3), t2._snsM.onAddedToFriendGroup({ name: o2, userIDList: i2 }), t2._onGroupListUpdated(), Sn({ friendGroup: e3, failureUserIDList: a2 }); }).catch(function(e3) { return r2.setError(e3).end(), v.w("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "deleteGroup", value: function(e2) { var n2 = this, o2 = "".concat(this._n, ".").concat("deleteGroup"), i2 = e2.name; if (!this._map.has(i2)) return this._onGroupNotExist(); var a2 = "name:".concat(i2), s2 = new M("deleteGroup"); return s2.setMessage(a2), this._snsM.req({ P: I.DEL_FD_GRP, data: { fromAccount: this._snsM.getMyUserID(), nameList: [i2] } }).then(function(e3) { s2.end(), v.l("".concat(o2, " ok. ").concat(a2)); var t2 = n2._map.get(i2); return t2 && (n2._snsM.onRemovedFromFriendGroup({ name: i2, userIDList: t2.userIDList }), n2._map.delete(i2), t2.userIDList.length = 0), n2._onGroupListUpdated(), Sn(t2); }).catch(function(e3) { return s2.setError(e3).end(), v.w("".concat(o2, " failed. error:"), e3), C(e3); }); } }, { key: "renameGroup", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("renameGroup"), o2 = e2.oldName, i2 = e2.newName; if (!this._map.has(o2)) return this._onGroupNotExist(); var a2 = "oldName:".concat(o2, " newName:").concat(i2), s2 = new M("renameGroup"); return s2.setMessage(a2), this._snsM.req({ P: I.UPDATE_FD_GRP, data: { fromAccount: this._snsM.getMyUserID(), oldName: o2, newName: i2 } }).then(function() { var e3; return s2.end(), v.l("".concat(n2, " ok. ").concat(a2)), t2._map.has(o2) ? ((e3 = t2._map.get(o2)).name = i2, t2._map.delete(o2), t2._map.set(i2, e3), t2._snsM.onRemovedFromFriendGroup({ name: o2, userIDList: e3.userIDList }), t2._snsM.onAddedToFriendGroup({ name: i2, userIDList: e3.userIDList }), t2._onGroupListUpdated(), Sn(e3)) : Sn(); }).catch(function(e3) { return s2.setError(e3).end(), v.w("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "addToGroup", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("addToGroup"), o2 = e2.name, e2 = e2.userIDList; if (!this._map.has(o2)) return this._onGroupNotExist(); var i2 = "name:".concat(o2, " userIDList:").concat(e2), a2 = new M("addToGroup"); return a2.setMessage(i2), this._snsM.req({ P: I.UPDATE_FD_GRP, data: { fromAccount: this._snsM.getMyUserID(), oldName: o2, updateGroupItem: e2.filter(function(e3) { return t2._snsM.isMyFriend(e3); }).map(function(e3) { return { to: e3, updateType: "Update_Type_Add" }; }) } }).then(function(e3) { return a2.end(), v.l("".concat(n2, " ok. ").concat(i2)), t2._onGroupUpdated(o2, e3); }).catch(function(e3) { return a2.setError(e3).end(), v.w("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "removeFromGroup", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("removeFromGroup"), o2 = e2.name, e2 = e2.userIDList; if (!this._map.has(o2)) return this._onGroupNotExist(); var i2 = "name:".concat(o2, " userIDList:").concat(e2), a2 = new M("removeFromGroup"); return a2.setMessage(i2), this._snsM.req({ P: I.UPDATE_FD_GRP, data: { fromAccount: this._snsM.getMyUserID(), oldName: o2, updateGroupItem: e2.filter(function(e3) { return t2._snsM.isMyFriend(e3); }).map(function(e3) { return { to: e3, updateType: "Update_Type_Delete" }; }) } }).then(function(e3) { return a2.end(), v.l("".concat(n2, " ok. ").concat(i2)), t2._onGroupUpdated(o2, e3); }).catch(function(e3) { return a2.setError(e3).end(), v.w("".concat(n2, " failed. error:"), e3), C(e3); }); } }, { key: "_onGroupUpdated", value: function(e2, t2) { var t2 = t2.data.resultList, a2 = this._map.get(e2), s2 = [], r2 = [], c2 = []; return nt(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 }); }), v.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 }), Sn({ friendGroup: a2, failureUserIDList: s2 }); } }, { key: "updateWhenFriendAdded", value: function(e2) { var t2 = this, n2 = e2.nameList, o2 = e2.userID; v.l("".concat(this._n, ".updateWhenFriendAdded userID:").concat(o2, " nameList:").concat(n2)), Je(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; v.l("".concat(this._n, ".updateWhenFriendDeleted userID:").concat(o2, " nameList:").concat(n2)), Je(n2) || n2.forEach(function(e3) { t2._map.has(e3) && t2._map.get(e3).removeFromUserIDList(o2); }); } }, { key: "_onGroupNotExist", value: function(e2) { return C({ code: T.FRIEND_GRP_NOT_EXIST }); } }, { key: "reset", value: function() { this._map.clear(); } }]), Hr), rr = (t(Vr, Fn), Hs = f(Vr), e(Vr, [{ 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; Je(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, D(e3.friendAddAccount)), a2.push.apply(a2, D(e3.friendAddAccount))), e3.friendDelAccount && o2.push.apply(o2, D(e3.friendDelAccount)), e3.friendApplicationAdded && i2.push.apply(i2, D(e3.friendApplicationAdded)), e3.friendApplicationDeletedUserIDList && a2.push.apply(a2, D(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: D(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 = this.get(29); if (!n2) return true; var n2 = n2.filterText(t2[e2], "sns"), o2 = n2.isAllowedToSend, n2 = n2.modifiedText; return true === o2 && (t2[e2] = n2, 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 ? kn(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 kn(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 kn(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() { v.l("".concat(this._n, ".reset")), this._friendHandler.reset(), this._friendGroupHandler.reset(), this._friendApplicationHandler.reset(); } }]), Vr), cr = (t(xr, Fn), Vs = f(xr), e(xr, [{ key: "isWorkerEnabled", value: function() { return this._isWorkerEnabled && ye; } }, { key: "startWorkerTimer", value: function() { v.l("".concat(this._n, ".startWorkerTimer")), this._workerTimer && this._workerTimer.postMessage("start"); } }, { key: "stopWorkerTimer", value: function() { v.l("".concat(this._n, ".stopWorkerTimer")), this._workerTimer && this._workerTimer.postMessage("stop"); } }, { key: "_init", value: function() { var e2, t2; ye && (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, v.l("".concat(t2._n, "._init seed:").concat(t2._timerID))) : t2._m.onCheckTimer(); }); } }, { key: "_onCloudConfig", value: function() { var e2 = this.getCloudConfig("enable_worker"); v.l("".concat(this._n, "._onCloudConfig enableWorker:").concat(e2)), A(e2) || "1" === e2 ? !this._isWorkerEnabled && ye && (this._isWorkerEnabled = true, this.startWorkerTimer(), this._m.onWorkerTimerEnabled()) : this._isWorkerEnabled && ye && (this._isWorkerEnabled = false, this.stopWorkerTimer(), this._m.onWorkerTimerDisabled()); } }, { key: "terminate", value: function() { v.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() { v.l("".concat(this._n, ".reset")); } }]), xr), ur = (e(qr, [{ 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 b(0, Math.pow(2, o2)) : new b(Math.pow(2, o2 - 32), 0)).toString(), "1" === e2[n2] ? this._featureMap.set(t2, true) : this._featureMap.set(t2, false); } else v.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 b(0, Math.pow(2, a2)) : new b(Math.pow(2, a2 - 32), 0)).toString(), !this._featureMap.get(n2))) { o2 = false; break; } return v.l("".concat(this._n, ".isFeatureEnabled decimalNumber:").concat(e2, " key:").concat(n2, " ret:").concat(o2)), kn({ 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 b(0, Math.pow(2, o2)) : new b(Math.pow(2, o2 - 32), 0)).toString(), !this._featureMap.get(i2)) break; var i2, a2 = "", s2 = 0; i2 === H.PLUGIN_TRANSLATE ? (a2 = "plugin_translate", s2 = 16) : i2 === H.PLUGIN_VOICE_TO_TEXT ? (a2 = "plugin_voice_to_text", s2 = 17) : i2 === H.PLUGIN_CS ? (a2 = "plugin_cs", s2 = 14) : i2 === H.PLUGIN_PUSH ? (a2 = "plugin_push", s2 = 13) : i2 === H.PLUGIN_BOT ? (a2 = "plugin_bot", s2 = 15) : i2 === H.MSG_REACTION && (a2 = "plugin_emoji_reaction", s2 = 18), "" !== a2 && (i2 = this._commercialConfigM.get(12).getUIPlatform(), new M(a2).setCode(s2).setUIPlatform(i2).end(), v.l("".concat(this._n, ".isFeatureEnabledForStat ").concat(a2, " code:").concat(s2, " uiPlatform:").concat(i2))); } } }, { key: "isCSPluginEnabled", value: function() { var e2; this._isCSPluginReported || (e2 = this._commercialConfigM.get(12).getUIPlatform(), new M("plugin_search").setCode(6).setUIPlatform(e2).end(), this._isCSPluginReported = true); } }, { key: "clear", value: function() { this._featureMap.clear(), this._isCSPluginReported = false; } }]), qr), lr = (e(Fr, [{ 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"); v.l("".concat(i2, " canFetch:").concat(o2)), o2 && (t2 = new M("fetchCommercialConfig"), o2 = this.get(12).getSDKAppID(), e2 = this.get(20), this._isFetching = true, e2.req({ P: I.FETCH_COMMERCIAL_CONFIG, data: { SDKAppID: o2 } }).then(function(e3) { t2.setMessage("purchaseBits:".concat(e3.data.purchaseBits)).end(), v.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)); v.l("".concat(t2)), new M("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) : A(n2) ? (v.l("".concat(t2, " failed. Invalid message format:"), e2), this._setExpiredTimeOnResponseError(36e5)) : (v.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: "isCSPluginEnabled", value: function() { this._purchasedFeatureHandler.isCSPluginEnabled(); } }, { key: "get", value: function(e2) { return this._m.get(e2); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this._expiredTime = 0, this._isFetching = false, this._purchasedFeatureHandler.clear(); } }]), Fr), dr = (t(wr, Fn), xs = f(wr), e(wr, [{ key: "registerPlugin", value: function(e2) { var t2, n2, o2, i2, a2, s2, r2, c2, l2, d2, p2, _2, u2; ne ? (this._offlinePushPlugin = e2["tim-offline-push-plugin"], t2 = (u2 = e2.offlinePushConfig || {}).huaweiBusinessID, n2 = u2.xiaomiBusinessID, o2 = u2.xiaomiAppID, i2 = u2.xiaomiAppKey, a2 = u2.meizuBusinessID, s2 = u2.meizuAppID, r2 = u2.meizuAppKey, c2 = u2.vivoBusinessID, l2 = u2.oppoBusinessID, d2 = u2.oppoAppKey, p2 = u2.oppoAppSecret, _2 = u2.honorBusinessID, u2 = u2.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 = l2, this._androidPushConfig.oppoPushAppKey = d2, this._androidPushConfig.oppoPushAppSecret = p2, this._androidPushConfig.honorPushBussinessId = _2, new M("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!A(this._offlinePushPlugin))).end(true), v.l("".concat(this._n, ".").concat("registerPlugin", " ok. offlinePushConfig:").concat(JSON.stringify(e2.offlinePushConfig))), this._iosBusinessID = u2, 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"); it(this._offlinePushPlugin.getDeviceToken) ? (c2 = "androidPushConfig:".concat(JSON.stringify(this._androidPushConfig), ", iosBusinessID:").concat(this._iosBusinessID), v.l("".concat(l2, " start. ").concat(c2)), new M("_getDeviceToken").setMessage("".concat(c2)).end(true), this._offlinePushPlugin.getDeviceToken(this._androidPushConfig, function(e2) { var t2, n2, o2, i2, a2 = new M("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), v.l("".concat(l2, " ok. ").concat(c2)), a2.setMessage(c2).end(true), u2._setToken()) : (a2.setMessage("code:".concat(s2, ", msg:").concat(r2)).end(true), v.e("".concat(l2, " failed. error:"), e2)); })) : v.e("".concat(l2, " getDeviceToken is not a function")); } }, { key: "canIUseOfflinePush", value: function() { return ne && !A(this._offlinePushPlugin); } }, { key: "_setAppShowListener", value: function() { var t2 = this, n2 = "".concat(this._n, ".").concat("_setAppShowListener"); A(this._offlinePushPlugin) ? v.e("".concat(n2, " offlinePushPlugin is undefined")) : it(this._offlinePushPlugin.setAppShowListener) ? (new M("_setAppShowListener").end(true), v.l("".concat(n2, " start")), this._offlinePushPlugin.setAppShowListener(function(e2) { e2 = (e2 || {}).appShow; new M("setAppShowListenerRes").setMessage("appShow:".concat(e2)).end(true), v.l("".concat(n2, " ok. appShow:").concat(e2)), t2._m.isReady() && (0 === e2 ? (t2._getConvUnreadCount(), t2._onBackground()) : 1 === e2 && t2._onForeground()); })) : v.e("".concat(n2, " setAppShowListener is not a function")); } }, { key: "getDeviceBrand", value: function() { var e2; if (!A(this._offlinePushPlugin) && it(this._offlinePushPlugin.getDeviceType)) return e2 = (this._offlinePushPlugin.getDeviceType() || {}).deviceType, v.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 = (Je(this._deviceToken) && (n2 = 0), this.getUniAppPlatform()), s2 = this.getDeviceBrand(), r2 = (a2 === F.IOS || a2 === F.IPAD || a2 === F.MAC ? i2 = this._deviceToken : a2 === F.ANDROID && (o2 = this._deviceToken), new M("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)), v.l("".concat(t2, " ").concat(a2)), this.req({ P: I.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(), v.l("".concat(t2, " ok")), e3; }).catch(function(e3) { return r2.setError(e3).end(), v.e("".concat(t2, " failed. error:"), e3), C(e3); }); } }, { key: "_getConvUnreadCount", value: function() { var t2 = this; this._c2cUnreadCount = 0, this._groupUnreadCount = 0, this.get(11).getLocalConvList().forEach(function(e2) { e2.type === R.CONV_C2C && (t2._c2cUnreadCount += e2.unreadCount), e2.type === R.CONV_GROUP && (t2._groupUnreadCount += e2.unreadCount); }); } }, { key: "_onBackground", value: function() { var t2 = this, n2 = "".concat(this._n, ".").concat("_onBackground"), o2 = new M("_onBackground"); this.req({ P: I.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(), v.l("".concat(n2, " ok")), e2; }).catch(function(e2) { o2.setError(e2).end(), v.e("".concat(n2, " failed. error:"), e2); }); } }, { key: "_onForeground", value: function() { var t2 = "".concat(this._n, ".").concat("_onForeground"), n2 = new M("_onForeground"); this.req({ P: I.STAT_FOREGROUND, data: { isWebUniapp: this._isWebUniapp } }).then(function(e2) { return n2.end(), v.l("".concat(t2, " ok")), e2; }).catch(function(e2) { n2.setError(e2).end(), v.e("".concat(t2, " failed. error:"), e2); }); } }, { key: "getUniAppPlatform", value: function() { var e2 = uni.getSystemInfoSync().platform, t2 = this.getDeviceBrand(); return "ios" === e2 ? F.IOS : "android" === e2 ? F.ANDROID : 1002 === t2 ? F.IPAD : 1001 === t2 ? F.MAC : void 0; } }, { key: "reset", value: function() { this._deviceToken = "", this._businessID = 0, this._c2cUnreadCount = 0, this._groupUnreadCount = 0, this._isWebUniapp = 0, v.l("".concat(this._n, ".reset")); } }]), wr), pr = (t(br, Fn), qs = f(br), e(br, [{ key: "registerPlugin", value: function(e2) { var t2, n2, o2; ne ? (t2 = "".concat(this._n, ".").concat("registerPlugin"), this._pushPlugin = e2["tim-push"], this._getDeviceInfo(), n2 = (o2 = e2.pushConfig || {}).androidConfig, o2 = o2.iOSConfig, $e(n2) && (this._androidPushConfig = n2[this._deviceInfo.packageName]), n2 = (o2 || {}).iOSBusinessID, this._iOSBusinessID = n2, o2 = !A(this._pushPlugin), new M("registerPlugin").setMessage(this._pluginName).setMoreMessage("isExisted:".concat(o2)).end(true), v.l("".concat(t2, " ok. pushConfig:").concat(JSON.stringify(e2.pushConfig))), o2 ? (this._setAppShowListener(), this._setPushEventReportListener()) : v.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"); it(this._pushPlugin.getPushEventCacheList) ? (new M("_reportEventCacheList").end(true), this._pushPlugin.getPushEventCacheList(function(e2) { var t2 = e2.code, n2 = e2.data.eventList, o2 = new M("getPushEventCacheListRes"); if (o2.setCode(t2), 0 !== t2) o2.setMessage("res:".concat(JSON.stringify(e2))).end(true), v.e("".concat(s2, " failed. error:").concat(JSON.stringify(e2))); else { t2 = n2.length < 10 ? "eventList:".concat(JSON.stringify(n2)) : "eventList.length:".concat(n2.length); v.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); } })) : v.e("".concat(this._pluginName, ".getPushEventCacheList is not a function")); } }, { key: "_getDeviceToken", value: function() { var r2, c2 = this, u2 = "".concat(this._n, ".").concat("_getDeviceToken"); it(this._pushPlugin.getDeviceToken) ? (r2 = "androidPushConfig:".concat(JSON.stringify(this._androidPushConfig), " iOSBusinessID:").concat(this._iOSBusinessID), v.l("".concat(u2, " start. ").concat(r2)), new M("_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 M("getDeviceTokenRes"); if (s2.setCode(i2), 0 === i2) return 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), v.l("".concat(u2, " ok. ").concat(r2)), s2.setMessage(r2).end(true), void c2._setToken(); s2.setMessage(a2).end(true), v.e("".concat(u2, " failed. error:").concat(JSON.stringify(e2))); })) : v.e("".concat(this._pluginName, ".getDeviceToken is not a function")); } }, { key: "_getDeviceInfo", value: function() { var e2 = "".concat(this._n, ".").concat("_getDeviceInfo"); if (it(this._pushPlugin.getDeviceInfo)) { var t2 = this._pushPlugin.getDeviceInfo(), n2 = t2.code, o2 = t2.data, i2 = new M("_getDeviceInfo"); if (i2.setCode(n2), 0 === n2) return this._deviceInfo = y(y({}, this._deviceInfo), o2), this._deviceInfo.pushVersion || (this._deviceInfo.pushVersion = "1.0.1"), n2 = "deviceInfo:".concat(JSON.stringify(this._deviceInfo)), v.l("".concat(e2, " ok. ").concat(n2)), void i2.setMessage(n2).end(true); i2.setMessage("deviceInfoRes:".concat(JSON.stringify(t2))).end(true), v.e("".concat(e2, " failed. error:").concat(JSON.stringify(t2))); } else v.e("".concat(this._pluginName, ".getDeviceInfo is not a function")); } }, { key: "canIUseTIMPush", value: function() { return ne && !A(this._pushPlugin); } }, { key: "_setAppShowListener", value: function() { var t2 = this, n2 = "".concat(this._n, ".").concat("_setAppShowListener"); it(this._pushPlugin.setAppShowListener) ? (new M("_setAppShowListener").end(true), v.l("".concat(n2, " start")), this._pushPlugin.setAppShowListener(function(e2) { e2 = (e2 || {}).appShow; new M("setAppShowListenerRes").setMessage("appShow:".concat(e2)).end(true), v.l("".concat(n2, " ok. appShow:").concat(e2)), t2._m.isReady() && (0 === e2 ? (t2._getConvUnreadCount(), t2._onBackground()) : 1 === e2 && t2._onForeground()); })) : v.e("".concat(this._pluginName, ".setAppShowListener is not a function")); } }, { key: "_setPushEventReportListener", value: function() { var a2 = this, s2 = "".concat(this._n, ".").concat("_setPushEventReportListener"); it(this._pushPlugin.setPushEventReportListener) ? (new M("_setPushEventReportListener").end(true), this._pushPlugin.setPushEventReportListener(function(e2) { var t2 = e2.code, n2 = e2.data, o2 = n2.eventList, i2 = new M("setPushEventReportListenerRes"); if (i2.setCode(t2), 0 === t2) return t2 = "eventList:".concat(JSON.stringify(o2)), v.l("".concat(s2, " ok. ").concat(t2)), i2.setMessage(t2).end(true), void (a2._m.isReady() && nt(o2) && 0 < o2.length && a2._pushReport(n2)); i2.setMessage("res:".concat(JSON.stringify(e2))).end(true), v.e("".concat(s2, " failed. error:").concat(JSON.stringify(e2))); })) : v.e("".concat(this._pluginName, ".setPushEventReportListener is not a function")); } }, { key: "getDeviceBrand", value: function() { var e2; if (!A(this._pushPlugin) && it(this._pushPlugin.getDeviceType)) return e2 = (this._pushPlugin.getDeviceType() || {}).deviceType, v.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 = (Je(this._deviceToken) && (n2 = 0), this.getUniAppPlatform()), s2 = this.getDeviceBrand(), a2 = (a2 === F.IOS || a2 === F.IPAD || a2 === F.MAC ? i2 = this._deviceToken : a2 === F.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 M("_setToken"), o2 = "data:".concat(JSON.stringify(a2)); r2.setMessage("".concat(o2)), v.l("".concat(t2, " ").concat(o2)), this.req({ P: I.SET_TOKEN, data: a2 }).then(function() { r2.end(), v.w("".concat(t2, " ok")); }).catch(function(e3) { r2.setError(e3).end(), v.e("".concat(t2, " failed. error:"), e3), C(e3); }); } }, { key: "_getConvUnreadCount", value: function() { var t2 = this; this._c2cUnreadCount = 0, this._groupUnreadCount = 0, this.get(11).getLocalConvList().forEach(function(e2) { e2.type === R.CONV_C2C && (t2._c2cUnreadCount += e2.unreadCount), e2.type === R.CONV_GROUP && (t2._groupUnreadCount += e2.unreadCount); }); } }, { key: "_onBackground", value: function() { var e2 = this, t2 = "".concat(this._n, ".").concat("_onBackground"), n2 = new M("_onBackground"); this.req({ P: I.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(), v.l("".concat(t2, " ok")); }).catch(function(e3) { n2.setError(e3).end(), v.e("".concat(t2, " failed. error:"), e3); }); } }, { key: "_onForeground", value: function() { var t2 = "".concat(this._n, ".").concat("_onForeground"), n2 = new M("_onForeground"); this.req({ P: I.STAT_FOREGROUND, data: { isWebUniapp: this._isWebUniapp } }).then(function() { n2.end(), v.l("".concat(t2, " ok")); }).catch(function(e2) { n2.setError(e2).end(), v.e("".concat(t2, " failed. error:"), e2); }); } }, { key: "_pushReport", value: function(e2) { var t2 = this, n2 = "".concat(this._n, ".").concat("_pushReport"), o2 = new M("_pushReport"); this.req({ P: I.PUSH_REPORT, data: { eventList: e2.eventList } }).then(function() { o2.end(), t2._notifyReportSuccess(e2); }).catch(function(e3) { o2.setError(e3).end(), v.e("".concat(n2, " failed. error:"), e3); }); } }, { key: "_notifyReportSuccess", value: function(e2) { !A(this._pushPlugin) && it(this._pushPlugin.notifyReportSuccess) && (this._pushPlugin.notifyReportSuccess(e2), v.l("".concat(this._n, "._notifyReportSuccess ok"))); } }, { key: "getUniAppPlatform", value: function() { var e2 = uni.getSystemInfoSync().platform, t2 = this.getDeviceBrand(); return "ios" === e2 ? F.IOS : "android" === e2 ? F.ANDROID : 1002 === t2 ? F.IPAD : 1001 === t2 ? F.MAC : void 0; } }, { key: "reset", value: function() { this._deviceToken = "", this._businessID = 0, this._c2cUnreadCount = 0, this._groupUnreadCount = 0, this._isWebUniapp = 0, v.l("".concat(this._n, ".reset")); } }]), br), _r = (t(Ur, Fn), Fs = f(Ur), e(Ur, [{ key: "init", value: function() { var e2 = this.get(18).getPlugin("tim-profanity-filter-plugin"); e2 && (this._plugin = new e2({ logger: v, isArray: nt, isMap: ze, 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) return n2; if (t2 && t2.messageControlInfo && true === t2.messageControlInfo.excludedFromContentModeration) return n2; var t2 = e2.type, o2 = e2.conversationType; if (t2 !== R.MSG_TEXT && t2 !== R.MSG_CUSTOM) return n2; var i2, a2 = "".concat(this._n, ".filterMessage"); if (v.l("".concat(a2)), t2 === R.MSG_TEXT) { if (o2 === R.CONV_C2C ? i2 = "c2c_text_message" : o2 === R.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 === R.MSG_CUSTOM) { if (o2 === R.CONV_C2C ? i2 = "c2c_custom_message" : o2 === R.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)); } return v.l("".concat(a2, " done. isAllowedToSend:").concat(n2)), n2; } }, { key: "filterText", value: function(e2, t2) { var n2 = "".concat(this._n, ".filterText"), o2 = { isAllowedToSend: true, modifiedText: e2 }; if (!this._plugin || !this._canIUseLexicon) return o2; if (!this._isConfigOn(t2)) return o2; v.l("".concat(n2)); t2 = this._plugin.filter(e2), e2 = t2.type, t2 = t2.modifiedText; return 1 === e2 ? o2.isAllowedToSend = false : 2 === e2 && (o2.modifiedText = t2), v.l("".concat(n2, " done. ret:"), o2), o2; } }, { key: "_getLexicon", value: function() { var l2 = this, d2 = new M("profanityFilter"), p2 = "".concat(this._n, "._getLexicon"); this._isFetching = true, this.req({ P: I.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, v.w("".concat(p2, " failed. error:"), t2), void d2.setCode(c2).setMessage(u2).end()) : (l2._onFilterConfig(n2), l2._getToken(i2), 1 === a2 ? (v.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, v.l("".concat(p2, " failed. error:"), e2); }); } }, { key: "_onFilterConfig", value: function(t2) { var n2 = this; Je(t2) || (this._filterConfigMap.clear(), Object.keys(t2).forEach(function(e2) { n2._filterConfigMap.set(e2, t2[e2]); }), v.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 (ft(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() { v.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; } }]), Ur), hr = (e(Pr, [{ key: "_onCloudConfig", value: function() { var t2 = this, e2 = this._m.get(23).getCloudConfig("rtc_cmd"); A(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(G.ROOM_CUSTOM_DATA_RECEIVED, e2); } }, { key: "sendTRTCCustomData", value: function(e2) { var t2 = e2.serviceCommand, e2 = e2.data, n2 = "".concat(a.NAME.TUIROOM_SVR, ".*"); return A(t2) || (n2 = t2), this._isValidServiceCommand(n2) ? this._trans({ servcmd: n2, data: e2 }) : C({ code: T.INVALID_TRTC_CMD }); } }, { key: "_trans", value: function(e2) { v.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: ft(e2) ? JSON.parse(e2) : e2 }); } }, { key: "_isValidServiceCommand", value: function(e2) { if (e2.endsWith(".*")) return this._TRTCCommandList.includes(e2); e2 = e2.split(".")[0]; return this._TRTCCommandMap.has(e2); } }, { key: "isTRTCCommand", value: function(e2) { e2 = e2.split(".")[0]; return this._TRTCCommandMap.has(e2); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")); } }]), Pr), gr = (e(Gr, [{ 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), v.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.5.2" !== e2; return v.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.7/tim-error-message.txt", t2 = "application/x-www-form-urlencoded;charset=UTF-8", n2 = "".concat(this._n, "._fetch ok in"), o2 = this, ae ? ue.request({ url: e2, method: "GET", timeout: 3e3, header: { "content-type": t2 }, dataType: "text", success: function(e3) { o2._fillAndSave(e3.data), v.l("".concat(n2, " mini program")); }, fail: function() { } }) : (i2 = new XMLHttpRequest(), a2 = setTimeout(function() { i2.abort(); }, 3e3), i2.onreadystatechange = function() { 4 === i2.readyState && (a2 && clearTimeout(a2), 200 !== i2.status && 304 !== i2.status || (v.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.5.2" }), 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 (A(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), A(o2) || (n2 = n2.replace("$replacement1", o2)), A(e2) || (n2 = n2.replace("$replacement2", e2))), n2; } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")); } }]), Gr), fr = (e(Nr, [{ 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 v.e("".concat(n2, " JSON parse error. signalingData:").concat(t2)), null; } } }, { key: "_handleActionType", value: function(e2, t2) { switch (e2.actionType) { case P.ACTION_TYPE_INVITE: this._onNewInvitationReceived(e2, t2); break; case P.ACTION_TYPE_REJECT_INVITE: this._onInviteeRejected(e2); break; case P.ACTION_TYPE_ACCEPT_INVITE: this._onInviteeAccepted(e2); break; case P.ACTION_TYPE_CANCEL_INVITE: this._onInvitationCancelled(e2); break; case P.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, l2 = e2.inviter, s2 = this._sigM.getMyUserID(), r2 = i2.includes(s2), c2 = e2.timeout, u2 = (Re().getTime() - 1e3 * t2.time) / 1e3, n2 = (0 < c2 && 0 < u2 && u2 < c2 && (c2 -= u2), "".concat(n2, " myselfIncluded:").concat(r2, " groupID:").concat(a2, " signalObj:").concat(JSON.stringify(e2))); v.l("".concat(n2, " timeout:").concat(c2, "s delta:").concat(u2, "s")), (a2 && r2 || !a2) && ((n2 = this._sigM.getInviteInfo(o2)) && n2 === e2 || (n2 || this._sigM.setInviteInfo(o2, y(y({}, e2), {}, { message: t2 })), this._sigM.emitEvent(P.NEW_INVITATION_RECEIVED, y(y({}, this._genBaseEmitData(e2)), {}, { inviteeList: i2 })), l2 !== s2 && this._sigM.startTimer(y(y({}, e2), {}, { timeout: c2 })))); } }, { 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); v.l("".concat(t2, " inviteID:").concat(n2, " hasInviteID:").concat(a2, " inviter:").concat(o2, " groupID:").concat(i2)), a2 && (this._sigM.updateInviteInfo(e2), this._sigM.emitEvent(P.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); v.l("".concat(t2, " inviteID:").concat(n2, " hasInviteID:").concat(a2, " inviter:").concat(o2, " groupID:").concat(i2)), a2 && (this._sigM.updateInviteInfo(e2), this._sigM.emitEvent(P.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); v.l("".concat(t2, " inviteID:").concat(n2, " hasInviteID:").concat(a2, " inviter:").concat(o2, " groupID:").concat(i2)), a2 && (this._sigM.deleteInviteInfo(n2), this._sigM.emitEvent(P.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); v.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(P.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, a2 = this._sigM.hasInviteInfo(o2); v.l("".concat(n2, " inviteID:").concat(o2, " hasInviteID:").concat(a2, " data:").concat(i2)), a2 && (this._sigM.setInviteInfo(o2, y(y({}, e2), {}, { message: t2 })), this._sigM.emitEvent(P.INVITATION_MODIFIED, { inviteID: o2, data: i2 })); } }]), Nr), mr = (e(Or, [{ key: "generateInviteID", value: function() { var e2, t2 = (t2 = Us)((e2 = Ps)(32), 8) + "-" + t2(e2(16), 4) + "-" + t2(16384 | e2(12), 4) + "-" + t2(32768 | e2(14), 4) + "-" + t2(e2(48), 12); return v.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: P.ACTION_TYPE_INVITE, inviter: i2, inviteeList: o2 ? e2.inviteeList : [t2], timeout: n2 }); return v.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: P.ACTION_TYPE_CANCEL_INVITE, groupID: s2, inviter: i2, inviteeList: a2 }) : v.e("".concat(n2, " unmatched inviter:").concat(o2, " and my userID:").concat(i2)), v.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: P.ACTION_TYPE_ACCEPT_INVITE, groupID: r2, inviter: s2, inviteeList: [i2] }) : v.e("".concat(n2, " userID:").concat(i2, " not in inviteeList. inviteID:").concat(o2, " groupID:").concat(r2)), v.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: P.ACTION_TYPE_REJECT_INVITE, groupID: r2, inviter: s2, inviteeList: [i2] }) : v.e("".concat(n2, " userID:").concat(i2, " not in inviteeList. inviteID:").concat(o2, " groupID:").concat(r2)), v.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: P.ACTION_TYPE_INVITE_TIMEOUT, inviter: o2, inviteeList: i2 ? n2 : [a2] }); return v.l("".concat(t2, " customData:"), e2), e2; } }]), Or), vr = (e(Ar, [{ 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, v.l("".concat(this._n, ".setCloudConfig count:").concat(e2, ", time:").concat(t2)); } }, { key: "getHistorySignaling", value: function() { var t2 = this, e2 = this._sigM.get(11).getLocalConvList(); Je(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(D(t2), D(e4))); }), n2._sortSignaling(t2); }); } }, { key: "_handleSignalingList", value: function(e2) { Je(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 === R.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 > Oe() - 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 = e2.messageList, n2 = e2.nextReqMessageID, e2 = e2.isCompleted; if (0 === t2.length) return null; var t2 = t2[0].conversationID, o2 = this._map.get(t2).msgCount; return 0 === o2 || e2 ? null : this._sigM.get(11).getMessageList({ conversationID: t2, nextReqMessageID: n2, count: o2 }); } }, { 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 P.ACTION_TYPE_INVITE: this._setHistoryInvite(e2); break; case P.ACTION_TYPE_REJECT_INVITE: case P.ACTION_TYPE_ACCEPT_INVITE: this._updateHistoryInvite(e2); break; case P.ACTION_TYPE_CANCEL_INVITE: this._delHistoryInvite(o2); break; case P.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 = Oe() - 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(D(t2), D(e3.messageList)); }), t2.sort(function(e3, t3) { return e3.time - t3.time; }); } }, { key: "reset", value: function() { this._map.clear(), this._relatedToMeMap.clear(); } }]), Ar), Ir = 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 || P.ACTION_TYPE_INVITE, this.timeout = t2.timeout || 0; }), Mr = ["message"], yr = ["message"], Cr = (t(Rr, Fn), ws = f(Rr), e(Rr, [{ 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"); A(e2) || (e2 = Number(e2)), A(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(P.NEW_INVITATION_RECEIVED); } }, { key: "onReady", value: function() { this._isSyncCompleted = true; var e2 = this._isListenerExisted(); v.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 = g(t2, Mr); v.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) && (v.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; v.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), v.l("".concat(t2, " remove ").concat(o2, ". localInviteeList.length:").concat(e2.length))), 0 === e2.length && this.deleteInviteInfo(n2)) : 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 v.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 C(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 v.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), C(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 (v.l("".concat(e2, " options:").concat(JSON.stringify(t2))), !this.hasInviteInfo(t2.inviteID) || this._isHandling) return C({ code: T.INVALID_CANCEL_MESSAGE }); this._isHandling = true; var o2 = this._localSignalingHandler.createCancelCustomData(t2); if (!o2) return this._isHandling = false, C({ code: T.SIGNALING_NO_PERMISSION }); var e2 = o2.groupID, i2 = o2.inviteeList, e2 = e2 || i2[0], i2 = this.createSignaling(o2, e2); return this.sendSignaling(i2, t2).then(function(e3) { return n2._handleImResponse(o2, e3, true), 0 === e3.code ? y(y({}, e3), {}, { inviteID: t2.inviteID }) : e3; }).catch(function(e3) { return C(e3); }); } }, { key: "accept", value: function(t2) { var n2 = this, e2 = "".concat(this._n, ".").concat("accept"); if (v.l("".concat(e2, " options:").concat(JSON.stringify(t2))), !this.hasInviteInfo(t2.inviteID) || this._isHandling) return C({ code: T.SIGNALING_INVALID_INVITE_ID }); this._isHandling = true; var o2 = this._localSignalingHandler.createAcceptCustomData(t2); if (!o2) return this._isHandling = false, C({ code: T.SIGNALING_NO_PERMISSION }); e2 = this.createSignaling(o2); return 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 C(e3); }); } }, { key: "reject", value: function(t2) { var n2 = this, e2 = "".concat(this._n, ".").concat("reject"); if (v.l("".concat(e2, " options:").concat(JSON.stringify(t2))), !this.hasInviteInfo(t2.inviteID) || this._isHandling) return C({ code: T.SIGNALING_INVALID_INVITE_ID }); this._isHandling = true; var o2 = this._localSignalingHandler.createRejectCustomData(t2); if (!o2) return this._isHandling = false, C({ code: T.SIGNALING_NO_PERMISSION }); e2 = this.createSignaling(o2); return 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 C(e3); }); } }, { 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 Ir(e2)), a2 ? "actionType:".concat(s2.actionType) : ""); return v.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, e2 = e2.data; if (!this.hasInviteInfo(n2)) return C({ code: T.SIGNALING_INVALID_INVITE_ID }); var o2 = this.getInviteInfo(n2), i2 = o2.message, a2 = g(o2, yr), s2 = i2.payload.data; return a2.data = e2, i2.payload.data = JSON.stringify(a2), this.get(2).modifyRemoteMessage(i2).then(function(e3) { return t2.hasInviteInfo(n2) && t2.setInviteInfo(n2, y(y({}, a2), {}, { message: i2 })), e3; }).catch(function(e3) { return i2.payload.data = s2, C(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 } }; if (e2 === P.ACTION_TYPE_INVITE_TIMEOUT) return a2 = !!t2.match(/excludeTimeoutSignalingFromHistoryMessage/), o2.messageControlInfo.excludedFromUnreadCount = a2, o2.messageControlInfo.excludedFromLastMessage = a2, o2; n2 = !!t2.match(/excludeFromHistoryMessage/), i2 = !!t2.match(/excludeOriginalSignalingFromHistoryMessage/); return 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, C(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 ? R.CONV_GROUP : R.CONV_C2C, priority: R.MSG_PRIORITY_HIGH, payload: { data: JSON.stringify(e2) } }, o2 = this.get(2).createCustomMessage(t2); return v.l("".concat(this._n, ".createSignaling. message:"), o2), o2; } }, { key: "_filterSignaling", value: function(e2) { var t2, n2, o2 = false; return e2.type && e2.type === R.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, l2 = t2.groupID, u2 = c2 === this.getMyUserID(); v.l("".concat(s2, " timeout:").concat(e2, " isInviter:").concat(u2, " groupID:").concat(l2)), e2 <= 0 || (n2 = u2 ? e2 + 5 : e2, o2 = 1, i2 = setInterval(function() { var e3 = a2._hasLocalInviteInfo(t2, u2); o2 < n2 && e3 ? ++o2 : (e3 && a2._sendTimeoutNotice(r2, u2), v.l("".concat(s2, " end.")), clearInterval(i2)); }, 1e3)); } }, { key: "_hasLocalInviteInfo", value: function(e2, t2) { var n2 = e2.inviteID, e2 = e2.groupID; if (!this.hasInviteInfo(n2)) return false; var o2 = "".concat(this._n, "._hasLocalInviteInfo"), i2 = this.getInviteInfo(n2).inviteeList; return v.l("".concat(o2, " inviteID:").concat(n2, " inviteeList:").concat(i2, " groupID:").concat(e2)), !e2 || (t2 ? 0 < i2.length : 0 < i2.length && i2.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 = (v.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(P.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() { v.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; } }]), Rr), Tr = ["followDiffList"], Dr = ["from"], Er = { NONE: 0, FOLLOWERS: 1, FOLLOWING: 2, MUTUAL: 3 }, Lr = (t(kr, Fn), bs = f(kr), e(kr, [{ key: "_onCloudConfig", value: function() { var e2 = this.getCloudConfig("follow_req_count"); A(e2) || (e2 = Number(e2), this.DEFAULT_COUNT = e2 > this.MAX_COUNT ? this.MAX_COUNT : e2, this._clearFollowList()); } }, { key: "clearCacheOnReconnected", value: function() { this._clearFollowList(); } }, { key: "onFollowNotify", value: function(e2) { var a2 = this, e2 = e2.dataList || []; v.l("".concat(this._n, ".onFollowNotify followChangeList:").concat(e2.length)), e2.forEach(function(e3) { var t2 = e3.followDiffList, t2 = void 0 === t2 ? [] : t2, e3 = g(e3, Tr), o2 = e3.from, i2 = g(e3, Dr); t2.forEach(function(e4) { var t3 = e4.isAdd, e4 = e4.followType, e4 = void 0 === e4 ? 0 : e4, n2 = a2._initFollowInfo(); 1 === t3 ? (i2.userID = o2, n2[e4].userInfoList.push(i2), n2[e4].isAdd = true) : (n2[e4].userInfoList.push(o2), n2[e4].isAdd = false), a2._emitEvent(n2); }); }); } }, { key: "_initFollowInfo", value: function() { var t2 = {}; return Object.values(Er).forEach(function(e2) { e2 !== Er.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 === Er.FOLLOWERS && (o2._clearFollowList(Er.FOLLOWERS), o2.emitOEvt(G.MY_FOLLOWERS_LIST_UPDATED, t2)), e2 === Er.FOLLOWING && (o2._clearFollowList(Er.FOLLOWING), o2.emitOEvt(G.MY_FOLLOWING_LIST_UPDATED, t2)), e2 === Er.MUTUAL && (o2._clearFollowList(Er.MUTUAL), o2.emitOEvt(G.MUTUAL_FOLLOWERS_LIST_UPDATED, t2))); }); } }, { key: "followUser", value: function(e2) { if (!this.canIUse(H.FOLLOW)) return this.noUse("followUser"); var t2 = "".concat(this._n, ".").concat("followUser"), n2 = "userIDList:".concat(e2.length), o2 = new M("followUser"); return o2.setMessage(n2), v.l("".concat(t2, " ").concat(n2)), this.req({ P: I.FOLLOW, data: { fromAccount: this.getMyUserID(), userIDList: e2.map(function(e3) { return { userID: e3 }; }) } }).then(function(e3) { return o2.end(), v.l("".concat(t2, " ok.")), Sn(e3.data.resultList); }).catch(function(e3) { return o2.setError(e3).end(), v.e("".concat(t2, " failed. error:"), e3), C(e3); }); } }, { key: "unfollowUser", value: function(e2) { if (!this.canIUse(H.FOLLOW)) return this.noUse("unfollowUser"); var t2 = "".concat(this._n, ".").concat("unfollowUser"), n2 = "userIDList:".concat(e2.length), o2 = new M("unfollowUser"); return o2.setMessage(n2), v.l("".concat(t2, " ").concat(n2)), this.req({ P: I.UNFOLLOW, data: { fromAccount: this.getMyUserID(), userIDList: e2 } }).then(function(e3) { return o2.end(), v.l("".concat(t2, " ok.")), Sn(e3.data.resultList); }).catch(function(e3) { return o2.setError(e3).end(), v.e("".concat(t2, " failed. error:"), e3), C(e3); }); } }, { key: "getMyFollowersList", value: function() { var t2 = this, n2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "", o2 = "getMyFollowersList"; if (!this.canIUse(H.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 v.l("".concat(this._n, ".").concat(o2, " nextCursor:").concat(n2, " from local.")), kn({ resultList: a2, nextCursor: s2 }); } return this._getFollowList(n2, Er.FOLLOWERS).then(function(e3) { return t2._myFollowersList.set(i2, y(y({}, e3), {}, { lastUpdateTime: Date.now() })), v.l("".concat(t2._n, ".").concat(o2, " nextCursor:").concat(n2, " from remote.")), Sn(e3); }); } }, { key: "getMyFollowingList", value: function() { var t2 = this, n2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "", o2 = "getMyFollowingList"; if (!this.canIUse(H.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 v.l("".concat(this._n, ".").concat(o2, " nextCursor:").concat(n2, " from local.")), kn({ resultList: a2, nextCursor: s2 }); } return this._getFollowList(n2, Er.FOLLOWING).then(function(e3) { return t2._myFollowingList.set(i2, y(y({}, e3), {}, { lastUpdateTime: Date.now() })), v.l("".concat(t2._n, ".").concat(o2, " nextCursor:").concat(n2, " from remote.")), Sn(e3); }); } }, { key: "getMutualFollowersList", value: function() { var t2 = this, n2 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "", o2 = "getMutualFollowersList"; if (!this.canIUse(H.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 v.l("".concat(this._n, ".").concat(o2, " nextCursor:").concat(n2, " from local.")), kn({ resultList: a2, nextCursor: s2 }); } return this._getFollowList(n2, Er.MUTUAL).then(function(e3) { return t2._myMutualFollowersList.set(i2, y(y({}, e3), {}, { lastUpdateTime: Date.now() })), v.l("".concat(t2._n, ".").concat(o2, " nextCursor:").concat(n2, " from remote.")), Sn(e3); }); } }, { key: "_getFollowList", value: function(e2, t2) { var i2 = this, n2 = new M("_getFollowList"); return n2.setMessage("nextCursor:".concat(e2, " type:").concat(t2)), this.req({ P: I.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(), v.e("".concat(i2._n, "._getFollowList failed. error:"), e3), C(e3); }); } }, { key: "_handleProfileItem", value: function(e2) { var t2 = {}; return e2.forEach(function(e3) { switch (e3.tag) { case qe.NICK: t2.nick = e3.value; break; case qe.GENDER: t2.gender = e3.value; break; case qe.BIRTHDAY: t2.birthday = e3.value; break; case qe.LOCATION: t2.location = e3.value; break; case qe.SELFSIGNATURE: t2.selfSignature = e3.value; break; case qe.ALLOWTYPE: t2.allowType = e3.value; break; case qe.LANGUAGE: t2.language = e3.value; break; case qe.AVATAR: t2.avatar = e3.value; break; case qe.MESSAGESETTINGS: t2.messageSettings = e3.value; break; case qe.ADMINFORBIDTYPE: t2.adminForbidType = e3.value; break; case qe.LEVEL: t2.level = e3.value; break; case qe.ROLE: t2.role = e3.value; break; default: t2[e3.tag] = e3.value; } }), t2; } }, { key: "getUserFollowInfo", value: function(e2) { if (!this.canIUse(H.FOLLOW)) return this.noUse("getUserFollowInfo"); var t2 = e2, n2 = false, i2 = (A(e2) && (t2 = [this.getMyUserID()], n2 = true), "".concat(this._n, ".").concat("getUserFollowInfo")), e2 = "userIDList:".concat(t2.length, " isGetMyFollowInfo:").concat(n2), a2 = new M("getUserFollowInfo"); return a2.setMessage(e2), v.l("".concat(i2, " ").concat(e2)), this.req({ P: I.GET_FOLLOW_INFO, data: { fromAccount: this.getMyUserID(), userIDList: t2 } }).then(function(e3) { a2.end(), v.l("".concat(i2, " 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 }); }), Sn(o2); }).catch(function(e3) { return a2.setError(e3).end(), v.e("".concat(i2, " failed. error:"), e3), C(e3); }); } }, { key: "checkFollowType", value: function(e2) { if (!this.canIUse(H.FOLLOW)) return this.noUse("checkFollowType"); 100 < e2.length && (e2 = e2.slice(0, 100), v.w("".concat(t2, " ").concat(zt(100)))); var t2 = "".concat(this._n, ".").concat("checkFollowType"), n2 = "userIDList length:".concat(e2.length, " "), o2 = new M("checkFollowType"); return o2.setMessage(n2), v.l("".concat(t2, " ").concat(n2)), this.req({ P: I.CHECK_FOLLOW_TYPE, data: { fromAccount: this.getMyUserID(), userIDList: e2 } }).then(function(e3) { o2.end(), v.l("".concat(t2, " ok.")); var e3 = e3.data.resultList, n3 = []; return (void 0 === e3 ? [] : e3).forEach(function(e4) { var t3 = e4.userID, e4 = e4.followType; n3.push({ userID: t3, followType: e4 }); }), Sn(n3); }).catch(function(e3) { return o2.setError(e3).end(), v.e("".concat(t2, " failed. error:"), e3), C(e3); }); } }, { key: "_clearFollowList", value: function(e2) { if (A(e2)) return this._myFollowersList.clear(), this._myFollowingList.clear(), void this._myMutualFollowersList.clear(); e2 !== Er.FOLLOWERS ? e2 !== Er.FOLLOWING ? e2 !== Er.MUTUAL || this._myMutualFollowersList.clear() : this._myFollowingList.clear() : this._myFollowersList.clear(); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this._clearFollowList(); } }]), kr), Sr = Da(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" !== r(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 kr(e2) { return d(this, kr), (e2 = bs.call(this, e2))._n = "FollowModule", e2._myFollowersList = /* @__PURE__ */ new Map(), e2._myFollowingList = /* @__PURE__ */ new Map(), e2._myMutualFollowersList = /* @__PURE__ */ new Map(), e2.MAX_CATCH_TIME = 6e5, e2.FIRST_PAGE_INDEX = dt(), e2.DEFAULT_COUNT = 500, e2.MAX_COUNT = 1e3, e2.getIEmitInst().on(Wo.CLOUD_CONFIG, e2._onCloudConfig, h(e2)), e2; } function Rr(e2) { d(this, Rr), (e2 = ws.call(this, e2))._n = "SignalingModule", e2._inviteInfoMap = /* @__PURE__ */ new Map(), e2._canIUseSignaling = false, e2._isHandling = false, e2._remoteSignalingHandler = new fr(h(e2)), e2._localSignalingHandler = new mr(h(e2)), e2._historySignalingHandler = new vr(h(e2)), e2._isC2CUnreadHandleCompleted = false, e2._isConvSyncCompleted = false, e2._isSyncCompleted = false, e2._isCloudConfigCompleted = false; var t2 = e2.getIEmitInst(); return t2.on(Wo.C2C_UNREAD_HANDLE_COMPLETED, e2.onC2CUnreadHandleCompleted, h(e2)), t2.on(Wo.CONV_SYNC_COMPLETED, e2.onConvSyncCompleted, h(e2)), t2.on(Wo.CLOUD_CONFIG, e2.onCloudConfig, h(e2)), e2; } function Ar(e2) { d(this, Ar), this._n = "HistorySignalingHandler", this._sigM = e2, this.COUNT = 20, this.EXPIRED_TIME = 300, this._map = /* @__PURE__ */ new Map(), this._relatedToMeMap = /* @__PURE__ */ new Map(); } function Or(e2) { d(this, Or), this._n = "LocalSignalingHandler", this._sigM = e2; } function Nr(e2) { d(this, Nr), this._n = "RemoteSignalingHandler", this._sigM = e2; } function Gr(e2) { d(this, Gr), 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 Pr(e2) { d(this, Pr), 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.*", "call_engine_srv.*"], this._TRTCCommandMap = /* @__PURE__ */ new Map(), this._setTRTCCommandMap(), this._m.getIEmitInst().on(Wo.CLOUD_CONFIG, this._onCloudConfig, this); } function Ur(e2) { return d(this, Ur), (e2 = Fs.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 br(e2) { var t2; return d(this, br), (t2 = qs.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 wr(e2) { var t2; return d(this, wr), (t2 = xs.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 Fr(e2) { d(this, Fr), this._m = e2, this._n = "CommercialConfigModule", this._expiredTime = 0, this._isFetching = false, this._purchasedFeatureHandler = new ur(this); } function qr(e2) { d(this, qr), this._commercialConfigM = e2, this._n = "PurchasedFeatureHandler", this._isCSPluginReported = false, this._featureMap = /* @__PURE__ */ new Map(); } function xr(e2) { return d(this, xr), (e2 = Vs.call(this, e2))._n = "WorkerTimerModule", e2._isWorkerEnabled = true, e2._workerTimer = null, e2._timerID = -1, e2._init(), e2.getIEmitInst().on(Wo.CLOUD_CONFIG, e2._onCloudConfig, h(e2)), e2; } function Vr(e2) { return d(this, Vr), (e2 = Hs.call(this, e2))._n = "SnsModule", e2._friendHandler = new ir(h(e2)), e2._friendApplicationHandler = new nr(h(e2)), e2._friendGroupHandler = new sr(h(e2)), e2.getIEmitInst().on(Wo.A2KEY_AND_TINYID_UPDATED, e2.onContextUpdated, h(e2)), e2; } function Hr(e2) { d(this, Hr), this._snsM = e2, this._n = "FriendGroupHandler", this._map = /* @__PURE__ */ new Map(); } function Br(e2) { d(this, Br), Je(e2) || (this.name = e2.name || "", this.userIDList = e2.userIDList || [], this.count = this.userIDList.length || 0); } function Kr(e2) { d(this, Kr), this._snsM = e2, this._n = "FriendHandler", this._map = /* @__PURE__ */ new Map(), this._startIdx = 0, this._standardSeq = 0, this._customSeq = 0, this._expirationTime = 18e4; } function Yr(e2, t2) { d(this, Yr), this.userID = e2, this.remark = "", this.groupList = [], this.source = "", this.addTime = 0, this.friendCustomField = [], this.timestamp = 0; var n2 = {}, o2 = []; if (n2.userID = e2, !Je(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 qe.NICK: n2.nick = i2; break; case qe.GENDER: n2.gender = i2; break; case qe.BIRTHDAY: n2.birthday = i2; break; case qe.LOCATION: n2.location = i2; break; case qe.SELFSIGNATURE: n2.selfSignature = i2; break; case qe.ALLOWTYPE: n2.allowType = i2; break; case qe.LANGUAGE: n2.language = i2; break; case qe.AVATAR: n2.avatar = i2; break; case qe.MESSAGESETTINGS: n2.messageSettings = i2; break; case qe.ADMINFORBIDTYPE: n2.adminForbidType = i2; break; case qe.LEVEL: n2.level = i2; break; case qe.ROLE: n2.role = i2; break; case xe.REMARK: this.remark = i2; break; case xe.ADDTIME: this.addTime = i2; break; case xe.GROUP: this.groupList = JSON.parse(JSON.stringify(i2)); break; case xe.ADDSOURCE: this.source = i2; break; case xe.ADDWORDING: break; default: v.l("snsProfileItem unknown tag->", t2[s2].tag); } this.profile = new ri(y(y({}, n2), {}, { profileCustomField: o2 })); } function Wr(e2) { d(this, Wr), this._snsM = e2, this._n = "FriendApplicationHandler", this._startTime = 0, this._maxLimited = 100, this._currentSeq = 0, this._map = /* @__PURE__ */ new Map(), this._unreadCount = 0; } function jr(e2) { d(this, jr), (e2 = Bs.call(this, e2))._n = "QualityStatModule", e2.TAG = "im-ssolog-quality-stat", e2.reportIndex = 0, e2.wholePeriod = false, e2._qualityItems = [Yn, Wn, jn, Jn, zn, Xn, Zn, Qn, $n, eo], e2._messageSentItems = [jn, Jn, zn, Xn, Zn], e2._messageReceivedItems = [Qn, $n, eo], e2.REPORT_INTERVAL = 120, e2.REPORT_SDKAPPID_BLACKLIST = [], e2.REPORT_TINYID_WHITELIST = [], e2._statInfoArr = [], e2._avgRTT = new Zs(), e2._avgE2EDelay = new Xs(), e2._rateMessageSent = new Qs(), e2._rateMessageReceived = new $s(); var t2 = e2.getIEmitInst(); return t2.on(Wo.A2KEY_AND_TINYID_UPDATED, e2._onLoginSuccess, h(e2)), t2.on(Wo.CLOUD_CONFIG, e2._onCloudConfig, h(e2)), e2; } function Jr() { d(this, Jr), this._lastMap = /* @__PURE__ */ new Map(), this._currentMap = /* @__PURE__ */ new Map(); } function zr() { d(this, zr), this._map = /* @__PURE__ */ new Map(); } function Xr() { d(this, Xr), this._n = "AvgRTT", this._requestCount = 0, this._rttArray = []; } function Zr() { d(this, Zr), this._n = "AvgE2EDelay", this._e2eDelayArray = []; } function Qr(e2) { return d(this, Qr), (e2 = Ks.call(this, e2))._n = "RecoverMsgModule", e2.PULL_LIMIT_COUNT = 15, e2; } function $r(e2) { return d(this, $r), (e2 = Ys.call(this, e2))._n = "CloudControlModule", e2._cloudConfig = /* @__PURE__ */ new Map(), e2._expiredTime = 0, e2._version = 0, e2._isFetching = false, e2; } function ec(e2) { return d(this, ec), (e2 = Ws.call(this, e2))._n = "SessionModule", e2._platform = e2.getPlatform(), e2._pHandler = new Ms(h(e2)), e2._msgDispatcher = new Cs(h(e2)), e2._cmdFreqLimitMap = /* @__PURE__ */ new Map(), e2._cmdReqInfoMap = /* @__PURE__ */ new Map(), e2._serverOverloadInfoMap = /* @__PURE__ */ new Map(), e2._incrementalPullContactFlag = true, e2._init(), e2.getIEmitInst().on(Wo.CLOUD_CONFIG, e2._onCloudConfig, h(e2)), e2; } Sr.assign, Sr.shrinkBuf, Sr.setTyped, Sr.Buf8, Sr.Buf16, Sr.Buf32; function tc(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 nc(e2, t2, n2, o2) { var i2 = ic, a2 = o2 + n2; e2 ^= -1; for (var s2 = o2; s2 < a2; s2++) e2 = e2 >>> 8 ^ i2[255 & (e2 ^ t2[s2])]; return -1 ^ e2; } function oc(l2, d2, p2, _2, h2, g2, e2, f2) { for (var t2, m2, v2, I2, M2, y2, C2, T2, D2, E2 = f2.bits, n2 = 0, o2 = 0, i2 = 0, a2 = 0, s2 = 0, r2 = 0, c2 = 0, L2 = 0, S2 = 0, u2 = 0, k2 = null, R2 = 0, A2 = new Sr.Buf16(16), O2 = new Sr.Buf16(16), N2 = null, G2 = 0, n2 = 0; n2 <= 15; n2++) A2[n2] = 0; for (o2 = 0; o2 < _2; o2++) A2[d2[p2 + o2]]++; for (s2 = E2, a2 = 15; 1 <= a2 && 0 === A2[a2]; a2--) ; if (a2 < s2 && (s2 = a2), 0 === a2) return h2[g2++] = 20971520, h2[g2++] = 20971520, f2.bits = 1, 0; for (i2 = 1; i2 < a2 && 0 === A2[i2]; i2++) ; for (s2 < i2 && (s2 = i2), n2 = L2 = 1; n2 <= 15; n2++) if ((L2 = (L2 << 1) - A2[n2]) < 0) return -1; if (0 < L2 && (0 === l2 || 1 !== a2)) return -1; for (O2[1] = 0, n2 = 1; n2 < 15; n2++) O2[n2 + 1] = O2[n2] + A2[n2]; for (o2 = 0; o2 < _2; o2++) 0 !== d2[p2 + o2] && (e2[O2[d2[p2 + o2]]++] = o2); if (y2 = 0 === l2 ? (k2 = N2 = e2, 19) : 1 === l2 ? (k2 = ac, R2 -= 257, N2 = sc, G2 -= 257, 256) : (k2 = rc, N2 = cc, -1), n2 = i2, M2 = g2, c2 = o2 = u2 = 0, v2 = -1, I2 = (S2 = 1 << (r2 = s2)) - 1, 1 === l2 && 852 < S2 || 2 === l2 && 592 < S2) return 1; for (; ; ) { for (D2 = e2[o2] < y2 ? (T2 = 0, e2[o2]) : e2[o2] > y2 ? (T2 = N2[G2 + e2[o2]], k2[R2 + e2[o2]]) : (T2 = 96, 0), t2 = 1 << (C2 = n2 - c2), i2 = m2 = 1 << r2; h2[M2 + (u2 >> c2) + (m2 -= t2)] = C2 << 24 | T2 << 16 | D2 | 0, 0 !== m2; ) ; for (t2 = 1 << n2 - 1; u2 & t2; ) t2 >>= 1; if (0 !== t2 ? u2 = (u2 & t2 - 1) + t2 : u2 = 0, o2++, 0 == --A2[n2]) { if (n2 === a2) break; n2 = d2[p2 + e2[o2]]; } if (s2 < n2 && (u2 & I2) !== v2) { for (M2 += i2, L2 = 1 << (r2 = n2 - (c2 = 0 === c2 ? s2 : c2)); r2 + c2 < a2 && !((L2 -= A2[r2 + c2]) <= 0); ) r2++, L2 <<= 1; if (S2 += 1 << r2, 1 === l2 && 852 < S2 || 2 === l2 && 592 < S2) return 1; h2[v2 = u2 & I2] = s2 << 24 | r2 << 16 | M2 - g2 | 0; } } return 0 !== u2 && (h2[M2 + u2] = n2 - c2 << 24 | 64 << 16 | 0), f2.bits = s2, 0; } var ic = 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; }(), ac = [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], sc = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], rc = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], cc = [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 uc(e2) { return (e2 >>> 24 & 255) + (e2 >>> 8 & 65280) + ((65280 & e2) << 8) + ((255 & e2) << 24); } function lc() { 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 Sr.Buf16(320), this.work = new Sr.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; } function dc(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 Sr.Buf32(852), t2.distcode = t2.distdyn = new Sr.Buf32(592), t2.sane = 1, t2.back = -1, 0) : -2; } function pc(e2) { var t2; return e2 && e2.state ? ((t2 = e2.state).wsize = 0, t2.whave = 0, t2.wnext = 0, dc(e2)) : -2; } function _c(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, pc(e2))) : -2; } function hc(e2, t2) { var n2; return e2 ? (n2 = new lc(), (e2.state = n2).window = null, 0 !== (n2 = _c(e2, t2)) && (e2.state = null), n2) : -2; } var gc, fc, mc = true; function vc(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 Sr.Buf8(e2.wsize)), o2 >= e2.wsize ? (Sr.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), Sr.arraySet(e2.window, t2, n2 - o2, i2, e2.wnext), (o2 -= i2) ? (Sr.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 Ic = { inflateReset: pc, inflateReset2: _c, inflateResetKeep: dc, inflateInit: function(e2) { return hc(e2, 15); }, inflateInit2: hc, inflate: function(e2, l2) { var t2, n2, d2, o2, p2, i2, _2, a2, s2, h2, g2, r2, f2, m2, v2, I2, M2, y2, C2, T2, D2, E2, L2, S2, k2 = 0, R2 = new Sr.Buf8(4), A2 = [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), p2 = e2.next_out, d2 = e2.output, _2 = e2.avail_out, o2 = e2.next_in, n2 = e2.input, i2 = e2.avail_in, a2 = t2.hold, s2 = t2.bits, h2 = i2, g2 = _2, E2 = 0; e: for (; ; ) switch (t2.mode) { case 1: if (0 === t2.wrap) { t2.mode = 13; break; } for (; s2 < 16; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } if (2 & t2.wrap && 35615 === a2) { R2[t2.check = 0] = 255 & a2, R2[1] = a2 >>> 8 & 255, t2.check = nc(t2.check, R2, 2, 0), s2 = a2 = 0, t2.mode = 2; break; } if (t2.flags = 0, t2.head && (t2.head.done = false), !(1 & t2.wrap) || (((255 & a2) << 8) + (a2 >> 8)) % 31) { e2.msg = "incorrect header check", t2.mode = 30; break; } if (8 != (15 & a2)) { e2.msg = "unknown compression method", t2.mode = 30; break; } if (s2 -= 4, D2 = 8 + (15 & (a2 >>>= 4)), 0 === t2.wbits) t2.wbits = D2; else if (D2 > t2.wbits) { e2.msg = "invalid window size", t2.mode = 30; break; } t2.dmax = 1 << D2, e2.adler = t2.check = 1, t2.mode = 512 & a2 ? 10 : 12, s2 = a2 = 0; break; case 2: for (; s2 < 16; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } if (t2.flags = a2, 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 = a2 >> 8 & 1), 512 & t2.flags && (R2[0] = 255 & a2, R2[1] = a2 >>> 8 & 255, t2.check = nc(t2.check, R2, 2, 0)), s2 = a2 = 0, t2.mode = 3; case 3: for (; s2 < 32; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } t2.head && (t2.head.time = a2), 512 & t2.flags && (R2[0] = 255 & a2, R2[1] = a2 >>> 8 & 255, R2[2] = a2 >>> 16 & 255, R2[3] = a2 >>> 24 & 255, t2.check = nc(t2.check, R2, 4, 0)), s2 = a2 = 0, t2.mode = 4; case 4: for (; s2 < 16; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } t2.head && (t2.head.xflags = 255 & a2, t2.head.os = a2 >> 8), 512 & t2.flags && (R2[0] = 255 & a2, R2[1] = a2 >>> 8 & 255, t2.check = nc(t2.check, R2, 2, 0)), s2 = a2 = 0, t2.mode = 5; case 5: if (1024 & t2.flags) { for (; s2 < 16; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } t2.length = a2, t2.head && (t2.head.extra_len = a2), 512 & t2.flags && (R2[0] = 255 & a2, R2[1] = a2 >>> 8 & 255, t2.check = nc(t2.check, R2, 2, 0)), s2 = a2 = 0; } else t2.head && (t2.head.extra = null); t2.mode = 6; case 6: if (1024 & t2.flags && ((r2 = (r2 = t2.length) > i2 ? i2 : r2) && (t2.head && (D2 = t2.head.extra_len - t2.length, t2.head.extra || (t2.head.extra = new Array(t2.head.extra_len)), Sr.arraySet(t2.head.extra, n2, o2, r2, D2)), 512 & t2.flags && (t2.check = nc(t2.check, n2, r2, o2)), i2 -= r2, o2 += r2, t2.length -= r2), t2.length)) break e; t2.length = 0, t2.mode = 7; case 7: if (2048 & t2.flags) { if (0 === i2) break e; for (r2 = 0; D2 = n2[o2 + r2++], t2.head && D2 && t2.length < 65536 && (t2.head.name += String.fromCharCode(D2)), D2 && r2 < i2; ) ; if (512 & t2.flags && (t2.check = nc(t2.check, n2, r2, o2)), i2 -= r2, o2 += r2, D2) break e; } else t2.head && (t2.head.name = null); t2.length = 0, t2.mode = 8; case 8: if (4096 & t2.flags) { if (0 === i2) break e; for (r2 = 0; D2 = n2[o2 + r2++], t2.head && D2 && t2.length < 65536 && (t2.head.comment += String.fromCharCode(D2)), D2 && r2 < i2; ) ; if (512 & t2.flags && (t2.check = nc(t2.check, n2, r2, o2)), i2 -= r2, o2 += r2, D2) break e; } else t2.head && (t2.head.comment = null); t2.mode = 9; case 9: if (512 & t2.flags) { for (; s2 < 16; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } if (a2 !== (65535 & t2.check)) { e2.msg = "header crc mismatch", t2.mode = 30; break; } s2 = a2 = 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 (; s2 < 32; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } e2.adler = t2.check = uc(a2), s2 = a2 = 0, t2.mode = 11; case 11: if (0 === t2.havedict) return e2.next_out = p2, e2.avail_out = _2, e2.next_in = o2, e2.avail_in = i2, t2.hold = a2, t2.bits = s2, 2; e2.adler = t2.check = 1, t2.mode = 12; case 12: if (5 === l2 || 6 === l2) break e; case 13: if (t2.last) { a2 >>>= 7 & s2, s2 -= 7 & s2, t2.mode = 27; break; } for (; s2 < 3; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } switch (t2.last = 1 & a2, --s2, 3 & (a2 >>>= 1)) { case 0: t2.mode = 14; break; case 1: O2 = N2 = void 0; var O2, N2 = t2; if (mc) { for (gc = new Sr.Buf32(512), fc = new Sr.Buf32(32), O2 = 0; O2 < 144; ) N2.lens[O2++] = 8; for (; O2 < 256; ) N2.lens[O2++] = 9; for (; O2 < 280; ) N2.lens[O2++] = 7; for (; O2 < 288; ) N2.lens[O2++] = 8; for (oc(1, N2.lens, 0, 288, gc, 0, N2.work, { bits: 9 }), O2 = 0; O2 < 32; ) N2.lens[O2++] = 5; oc(2, N2.lens, 0, 32, fc, 0, N2.work, { bits: 5 }), mc = false; } if (N2.lencode = gc, N2.lenbits = 9, N2.distcode = fc, N2.distbits = 5, t2.mode = 20, 6 !== l2) break; a2 >>>= 2, s2 -= 2; break e; case 2: t2.mode = 17; break; case 3: e2.msg = "invalid block type", t2.mode = 30; } a2 >>>= 2, s2 -= 2; break; case 14: for (a2 >>>= 7 & s2, s2 -= 7 & s2; s2 < 32; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } if ((65535 & a2) != (a2 >>> 16 ^ 65535)) { e2.msg = "invalid stored block lengths", t2.mode = 30; break; } if (t2.length = 65535 & a2, s2 = a2 = 0, t2.mode = 15, 6 === l2) break e; case 15: t2.mode = 16; case 16: if (r2 = t2.length) { if (0 === (r2 = _2 < (r2 = i2 < r2 ? i2 : r2) ? _2 : r2)) break e; Sr.arraySet(d2, n2, o2, r2, p2), i2 -= r2, o2 += r2, _2 -= r2, p2 += r2, t2.length -= r2; break; } t2.mode = 12; break; case 17: for (; s2 < 14; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } if (t2.nlen = 257 + (31 & a2), a2 >>>= 5, s2 -= 5, t2.ndist = 1 + (31 & a2), a2 >>>= 5, s2 -= 5, t2.ncode = 4 + (15 & a2), a2 >>>= 4, s2 -= 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 (; s2 < 3; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } t2.lens[A2[t2.have++]] = 7 & a2, a2 >>>= 3, s2 -= 3; } for (; t2.have < 19; ) t2.lens[A2[t2.have++]] = 0; if (t2.lencode = t2.lendyn, t2.lenbits = 7, L2 = { bits: t2.lenbits }, E2 = oc(0, t2.lens, 0, 19, t2.lencode, 0, t2.work, L2), t2.lenbits = L2.bits, E2) { 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 (; I2 = (k2 = t2.lencode[a2 & (1 << t2.lenbits) - 1]) >>> 16 & 255, M2 = 65535 & k2, !((v2 = k2 >>> 24) <= s2); ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } if (M2 < 16) a2 >>>= v2, s2 -= v2, t2.lens[t2.have++] = M2; else { if (16 === M2) { for (S2 = v2 + 2; s2 < S2; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } if (a2 >>>= v2, s2 -= v2, 0 === t2.have) { e2.msg = "invalid bit length repeat", t2.mode = 30; break; } D2 = t2.lens[t2.have - 1], r2 = 3 + (3 & a2), a2 >>>= 2, s2 -= 2; } else if (17 === M2) { for (S2 = v2 + 3; s2 < S2; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } D2 = 0, r2 = 3 + (7 & (a2 >>>= v2)), a2 >>>= 3, s2 = s2 - v2 - 3; } else { for (S2 = v2 + 7; s2 < S2; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } D2 = 0, r2 = 11 + (127 & (a2 >>>= v2)), a2 >>>= 7, s2 = s2 - v2 - 7; } if (t2.have + r2 > t2.nlen + t2.ndist) { e2.msg = "invalid bit length repeat", t2.mode = 30; break; } for (; r2--; ) t2.lens[t2.have++] = D2; } } 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, L2 = { bits: t2.lenbits }, E2 = oc(1, t2.lens, 0, t2.nlen, t2.lencode, 0, t2.work, L2), t2.lenbits = L2.bits, E2) { e2.msg = "invalid literal/lengths set", t2.mode = 30; break; } if (t2.distbits = 6, t2.distcode = t2.distdyn, L2 = { bits: t2.distbits }, E2 = oc(2, t2.lens, t2.nlen, t2.ndist, t2.distcode, 0, t2.work, L2), t2.distbits = L2.bits, E2) { e2.msg = "invalid distances set", t2.mode = 30; break; } if (t2.mode = 20, 6 === l2) break e; case 20: t2.mode = 21; case 21: if (6 <= i2 && 258 <= _2) { e2.next_out = p2, e2.avail_out = _2, e2.next_in = o2, e2.avail_in = i2, t2.hold = a2, t2.bits = s2, K2 = H2 = w2 = b2 = U2 = P2 = c2 = G2 = oe2 = ne2 = te2 = ee2 = $2 = Q2 = Z2 = X2 = z2 = J2 = j2 = W2 = Y2 = u2 = B2 = V2 = x2 = void 0; var G2, c2, P2, U2, b2, w2, F2 = e2, q2 = g2, x2 = F2.state, V2 = F2.next_in, H2 = F2.input, B2 = V2 + (F2.avail_in - 5), u2 = F2.next_out, K2 = F2.output, Y2 = u2 - (q2 - F2.avail_out), W2 = u2 + (F2.avail_out - 257), j2 = x2.dmax, J2 = x2.wsize, z2 = x2.whave, X2 = x2.wnext, Z2 = x2.window, Q2 = x2.hold, $2 = x2.bits, ee2 = x2.lencode, te2 = x2.distcode, ne2 = (1 << x2.lenbits) - 1, oe2 = (1 << x2.distbits) - 1; t: do { for ($2 < 15 && (Q2 += H2[V2++] << $2, $2 += 8, Q2 += H2[V2++] << $2, $2 += 8), G2 = ee2[Q2 & ne2]; ; ) { if (Q2 >>>= c2 = G2 >>> 24, $2 -= c2, 0 == (c2 = G2 >>> 16 & 255)) K2[u2++] = 65535 & G2; else { if (!(16 & c2)) { if (0 == (64 & c2)) { G2 = ee2[(65535 & G2) + (Q2 & (1 << c2) - 1)]; continue; } if (32 & c2) { x2.mode = 12; break t; } F2.msg = "invalid literal/length code", x2.mode = 30; break t; } for (P2 = 65535 & G2, (c2 &= 15) && ($2 < c2 && (Q2 += H2[V2++] << $2, $2 += 8), P2 += Q2 & (1 << c2) - 1, Q2 >>>= c2, $2 -= c2), $2 < 15 && (Q2 += H2[V2++] << $2, $2 += 8, Q2 += H2[V2++] << $2, $2 += 8), G2 = te2[Q2 & oe2]; ; ) { if (Q2 >>>= c2 = G2 >>> 24, $2 -= c2, !(16 & (c2 = G2 >>> 16 & 255))) { if (0 == (64 & c2)) { G2 = te2[(65535 & G2) + (Q2 & (1 << c2) - 1)]; continue; } F2.msg = "invalid distance code", x2.mode = 30; break t; } if (U2 = 65535 & G2, $2 < (c2 &= 15) && (Q2 += H2[V2++] << $2, ($2 += 8) < c2 && (Q2 += H2[V2++] << $2, $2 += 8)), (U2 += Q2 & (1 << c2) - 1) > j2) { F2.msg = "invalid distance too far back", x2.mode = 30; break t; } if (Q2 >>>= c2, $2 -= c2, U2 > (c2 = u2 - Y2)) { if ((c2 = U2 - c2) > z2 && x2.sane) { F2.msg = "invalid distance too far back", x2.mode = 30; break t; } if (w2 = Z2, (b2 = 0) === X2) { if (b2 += J2 - c2, c2 < P2) { for (P2 -= c2; K2[u2++] = Z2[b2++], --c2; ) ; b2 = u2 - U2, w2 = K2; } } else if (X2 < c2) { if (b2 += J2 + X2 - c2, (c2 -= X2) < P2) { for (P2 -= c2; K2[u2++] = Z2[b2++], --c2; ) ; if (b2 = 0, X2 < P2) { for (P2 -= c2 = X2; K2[u2++] = Z2[b2++], --c2; ) ; b2 = u2 - U2, w2 = K2; } } } else if (b2 += X2 - c2, c2 < P2) { for (P2 -= c2; K2[u2++] = Z2[b2++], --c2; ) ; b2 = u2 - U2, w2 = K2; } for (; 2 < P2; ) K2[u2++] = w2[b2++], K2[u2++] = w2[b2++], K2[u2++] = w2[b2++], P2 -= 3; P2 && (K2[u2++] = w2[b2++], 1 < P2 && (K2[u2++] = w2[b2++])); } else { for (b2 = u2 - U2; K2[u2++] = K2[b2++], K2[u2++] = K2[b2++], K2[u2++] = K2[b2++], 2 < (P2 -= 3); ) ; P2 && (K2[u2++] = K2[b2++], 1 < P2 && (K2[u2++] = K2[b2++])); } break; } } break; } } while (V2 < B2 && u2 < W2); V2 -= P2 = $2 >> 3, Q2 &= (1 << ($2 -= P2 << 3)) - 1, F2.next_in = V2, F2.next_out = u2, F2.avail_in = V2 < B2 ? B2 - V2 + 5 : 5 - (V2 - B2), F2.avail_out = u2 < W2 ? W2 - u2 + 257 : 257 - (u2 - W2), x2.hold = Q2, x2.bits = $2, p2 = e2.next_out, d2 = e2.output, _2 = e2.avail_out, o2 = e2.next_in, n2 = e2.input, i2 = e2.avail_in, a2 = t2.hold, s2 = t2.bits, 12 === t2.mode && (t2.back = -1); break; } for (t2.back = 0; I2 = (k2 = t2.lencode[a2 & (1 << t2.lenbits) - 1]) >>> 16 & 255, M2 = 65535 & k2, !((v2 = k2 >>> 24) <= s2); ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } if (I2 && 0 == (240 & I2)) { for (y2 = v2, C2 = I2, T2 = M2; I2 = (k2 = t2.lencode[T2 + ((a2 & (1 << y2 + C2) - 1) >> y2)]) >>> 16 & 255, M2 = 65535 & k2, !(y2 + (v2 = k2 >>> 24) <= s2); ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } a2 >>>= y2, s2 -= y2, t2.back += y2; } if (a2 >>>= v2, s2 -= v2, t2.back += v2, t2.length = M2, 0 === I2) { t2.mode = 26; break; } if (32 & I2) { t2.back = -1, t2.mode = 12; break; } if (64 & I2) { e2.msg = "invalid literal/length code", t2.mode = 30; break; } t2.extra = 15 & I2, t2.mode = 22; case 22: if (t2.extra) { for (S2 = t2.extra; s2 < S2; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } t2.length += a2 & (1 << t2.extra) - 1, a2 >>>= t2.extra, s2 -= t2.extra, t2.back += t2.extra; } t2.was = t2.length, t2.mode = 23; case 23: for (; I2 = (k2 = t2.distcode[a2 & (1 << t2.distbits) - 1]) >>> 16 & 255, M2 = 65535 & k2, !((v2 = k2 >>> 24) <= s2); ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } if (0 == (240 & I2)) { for (y2 = v2, C2 = I2, T2 = M2; I2 = (k2 = t2.distcode[T2 + ((a2 & (1 << y2 + C2) - 1) >> y2)]) >>> 16 & 255, M2 = 65535 & k2, !(y2 + (v2 = k2 >>> 24) <= s2); ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } a2 >>>= y2, s2 -= y2, t2.back += y2; } if (a2 >>>= v2, s2 -= v2, t2.back += v2, 64 & I2) { e2.msg = "invalid distance code", t2.mode = 30; break; } t2.offset = M2, t2.extra = 15 & I2, t2.mode = 24; case 24: if (t2.extra) { for (S2 = t2.extra; s2 < S2; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } t2.offset += a2 & (1 << t2.extra) - 1, a2 >>>= t2.extra, s2 -= 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 === _2) break e; if (t2.offset > (r2 = g2 - _2)) { if ((r2 = t2.offset - r2) > t2.whave && t2.sane) { e2.msg = "invalid distance too far back", t2.mode = 30; break; } f2 = r2 > t2.wnext ? (r2 -= t2.wnext, t2.wsize - r2) : t2.wnext - r2, r2 > t2.length && (r2 = t2.length), m2 = t2.window; } else m2 = d2, f2 = p2 - t2.offset, r2 = t2.length; for (_2 -= r2 = _2 < r2 ? _2 : r2, t2.length -= r2; d2[p2++] = m2[f2++], --r2; ) ; 0 === t2.length && (t2.mode = 21); break; case 26: if (0 === _2) break e; d2[p2++] = t2.length, _2--, t2.mode = 21; break; case 27: if (t2.wrap) { for (; s2 < 32; ) { if (0 === i2) break e; i2--, a2 |= n2[o2++] << s2, s2 += 8; } if (g2 -= _2, e2.total_out += g2, t2.total += g2, g2 && (e2.adler = t2.check = (t2.flags ? nc : tc)(t2.check, d2, g2, p2 - g2)), g2 = _2, (t2.flags ? a2 : uc(a2)) !== t2.check) { e2.msg = "incorrect data check", t2.mode = 30; break; } s2 = a2 = 0; } t2.mode = 28; case 28: if (t2.wrap && t2.flags) { for (; s2 < 32; ) { if (0 === i2) break e; i2--, a2 += n2[o2++] << s2, s2 += 8; } if (a2 !== (4294967295 & t2.total)) { e2.msg = "incorrect length check", t2.mode = 30; break; } s2 = a2 = 0; } t2.mode = 29; case 29: E2 = 1; break e; case 30: E2 = -3; break e; case 31: return -4; default: return -2; } return e2.next_out = p2, e2.avail_out = _2, e2.next_in = o2, e2.avail_in = i2, t2.hold = a2, t2.bits = s2, (t2.wsize || g2 !== e2.avail_out && t2.mode < 30 && (t2.mode < 27 || 4 !== l2)) && vc(e2, e2.output, e2.next_out, g2 - e2.avail_out), h2 -= e2.avail_in, g2 -= e2.avail_out, e2.total_in += h2, e2.total_out += g2, t2.total += g2, t2.wrap && g2 && (e2.adler = t2.check = (t2.flags ? nc : tc)(t2.check, d2, g2, e2.next_out - g2)), e2.data_type = t2.bits + (t2.last ? 64 : 0) + (12 === t2.mode ? 128 : 0) + (20 === t2.mode || 15 === t2.mode ? 256 : 0), E2 = (0 == h2 && 0 === g2 || 4 === l2) && 0 === E2 ? -5 : E2; }, inflateEnd: function(e2) { if (!e2 || !e2.state) return -2; var t2 = e2.state; return t2.window && (t2.window = null), e2.state = null, 0; }, inflateGetHeader: function(e2, t2) { var n2; return !e2 || !e2.state || 0 == (2 & (n2 = e2.state).wrap) ? -2 : ((n2.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 && tc(1, t2, o2, 0) !== n2.check ? -3 : vc(e2, t2, o2, o2) ? (n2.mode = 31, -4) : (n2.havedict = 1, 0); }, inflateInfo: "pako inflate (from Nodeca project)" }, Mc = true, yc = true; try { String.fromCharCode.apply(null, [0]); } catch (e2) { Mc = false; } try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (e2) { yc = false; } for (var Cc = new Sr.Buf8(256), Tc = 0; Tc < 256; Tc++) Cc[Tc] = 252 <= Tc ? 6 : 248 <= Tc ? 5 : 240 <= Tc ? 4 : 224 <= Tc ? 3 : 192 <= Tc ? 2 : 1; Cc[254] = Cc[254] = 1; function Dc(e2, l2) { for (var t2, n2, o2 = l2 || e2.length, i2 = new Array(2 * o2), a2 = 0, s2 = 0; s2 < o2; ) if ((t2 = e2[s2++]) < 128) i2[a2++] = t2; else if (4 < (n2 = Cc[t2])) i2[a2++] = 65533, s2 += n2 - 1; else { for (t2 &= 2 === n2 ? 31 : 3 === n2 ? 15 : 7; 1 < n2 && s2 < o2; ) t2 = t2 << 6 | 63 & e2[s2++], n2--; 1 < n2 ? i2[a2++] = 65533 : t2 < 65536 ? i2[a2++] = t2 : (t2 -= 65536, i2[a2++] = 55296 | t2 >> 10 & 1023, i2[a2++] = 56320 | 1023 & t2); } var r2 = i2, c2 = a2; if (c2 < 65534 && (r2.subarray && yc || !r2.subarray && Mc)) return String.fromCharCode.apply(null, Sr.shrinkBuf(r2, c2)); for (var d2 = "", u2 = 0; u2 < c2; u2++) d2 += String.fromCharCode(r2[u2]); return d2; } function Ec() { 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 Lc() { 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 Sc = { 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 }, kc = { 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" }, Rc = Object.prototype.toString; function Ac(e2) { if (!(this instanceof Ac)) return new Ac(e2); this.options = Sr.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 Ec(), this.strm.avail_out = 0, Ic.inflateInit2(this.strm, t2.windowBits)); if (e2 !== Sc.Z_OK) throw new Error(kc[e2]); if (this.header = new Lc(), Ic.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 Sr.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]" === Rc.call(t2.dictionary) && (t2.dictionary = new Uint8Array(t2.dictionary)), t2.raw && (e2 = Ic.inflateSetDictionary(this.strm, t2.dictionary)) !== Sc.Z_OK)) throw new Error(kc[e2]); } function Oc(e2, t2) { t2 = new Ac(t2); if (t2.push(e2, true), t2.err) throw t2.msg || kc[t2.err]; return t2.result; } Ac.prototype.push = function(e2, t2) { var n2, o2, i2, a2, s2, r2 = this.strm, c2 = this.options.chunkSize, l2 = this.options.dictionary, u2 = false; if (this.ended) return false; o2 = t2 === ~~t2 ? t2 : true === t2 ? Sc.Z_FINISH : Sc.Z_NO_FLUSH, "string" == typeof e2 ? r2.input = function(e3) { for (var t3 = new Sr.Buf8(e3.length), n3 = 0, o3 = t3.length; n3 < o3; n3++) t3[n3] = e3.charCodeAt(n3); return t3; }(e2) : "[object ArrayBuffer]" === Rc.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 Sr.Buf8(c2), r2.next_out = 0, r2.avail_out = c2), (n2 = (n2 = Ic.inflate(r2, Sc.Z_NO_FLUSH)) === Sc.Z_NEED_DICT && l2 ? Ic.inflateSetDictionary(this.strm, l2) : n2) === Sc.Z_BUF_ERROR && true === u2 && (n2 = Sc.Z_OK, u2 = false), n2 !== Sc.Z_STREAM_END && n2 !== Sc.Z_OK) return this.onEnd(n2), !(this.ended = true); r2.next_out && (0 !== r2.avail_out && n2 !== Sc.Z_STREAM_END && (0 !== r2.avail_in || o2 !== Sc.Z_FINISH && o2 !== Sc.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 + Cc[e3[n3]] > t3 ? n3 : t3; }(r2.output, r2.next_out), a2 = r2.next_out - i2, s2 = Dc(r2.output, i2), r2.next_out = a2, r2.avail_out = c2 - a2, a2 && Sr.arraySet(r2.output, r2.output, i2, a2, 0), this.onData(s2)) : this.onData(Sr.shrinkBuf(r2.output, r2.next_out)))), 0 === r2.avail_in && 0 === r2.avail_out && (u2 = true); } while ((0 < r2.avail_in || 0 === r2.avail_out) && n2 !== Sc.Z_STREAM_END); return (o2 = n2 === Sc.Z_STREAM_END ? Sc.Z_FINISH : o2) === Sc.Z_FINISH ? (n2 = Ic.inflateEnd(this.strm), this.onEnd(n2), this.ended = true, n2 === Sc.Z_OK) : o2 !== Sc.Z_SYNC_FLUSH || (this.onEnd(Sc.Z_OK), !(r2.avail_out = 0)); }, Ac.prototype.onData = function(e2) { this.chunks.push(e2); }, Ac.prototype.onEnd = function(e2) { e2 === Sc.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = Sr.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg; }; se = {}; (0, Sr.assign)(se, { Inflate: Ac, inflate: Oc, inflateRaw: function(e2, t2) { return (t2 = t2 || {}).raw = true, Oc(e2, t2); }, ungzip: Oc }, Sc); var Nc, Gc = se, Pc = (e(Qc, [{ key: "inflate", value: function(e2) { var t2, e2 = new Uint8Array(e2).slice(4), n2 = Date.now(); try { t2 = Gc.inflate(e2, { to: "string" }), this._bLogForInflateOK || (this._bLogForInflateOK = true, new M("inflateOK").end()); } catch (e3) { return this._bLogForInflateError ? void 0 : (this._bLogForInflateError = true, void new M("inflateError").setMessage(e3).end()); } var e2 = e2.length + 4, o2 = t2.length; return v.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() { v.l("".concat(this._n, ".reset")), this._bLogForInflateOK = false, this._bLogForInflateError = false; } }]), Qc), Uc = "Message", bc = "User", wc = "Group", Fc = "GroupMember", qc = ["count"], xc = ["conversationID", "timePosition", "timePeriod"], Vc = ["miniBirthday", "maxBirthday"], Hc = (c(te = {}, Uc, I.CS), c(te, bc, I.USER_CS), c(te, wc, I.GRP_CS), c(te, Fc, I.MBR_CS), te), Bc = (t(Zc, Fn), Nc = f(Zc), e(Zc, [{ key: "searchCloudMessages", value: function(e2) { return this.search(Uc, e2); } }, { key: "searchCloudUsers", value: function(e2) { return this.search(bc, e2); } }, { key: "searchCloudGroups", value: function(e2) { return this.search(wc, e2); } }, { key: "searchCloudGroupMembers", value: function(e2) { return this.search(Fc, e2); } }, { key: "search", value: function(i2, a2) { var s2 = this, e2 = "searchCloud".concat(i2, "s"), r2 = "".concat(this._n, ".").concat(e2); if (!a2) return C({ code: T.OPTIONS_IS_EMPTY, message: this.getErrMsg(T.OPTIONS_IS_EMPTY, e2) }); var t2 = a2.keywordList, n2 = ot(t2), o2 = a2.count; if (a2.count && (o2 = parseInt(o2)), i2 === Uc && !n2 && !ot(a2.senderUserIDList) && !ot(a2.messageTypeList) || i2 !== Uc && !n2) throw v.e("[".concat(e2, '] Missing required params: "keywordList".')), new Error("Params validate failed."); var l2 = Date.now(), c2 = new M(e2), u2 = "keywordList:".concat(t2, " keywordListMatchType:").concat(a2.keywordListMatchType, " cursor:").concat(a2.cursor, " count:").concat(o2); return v.l("".concat(r2, " ").concat(u2)), this.req({ P: Hc[i2], data: this._genParams(i2, a2) }).then(function(e3) { var t3 = e3.data, n3 = t3.code, t3 = t3.message; if (0 !== n3) return 60020 === (o3 = n3) ? o3 = "SearchUnable" : i2 !== Uc && 27003 === n3 ? o3 = "SearchParamsError" : i2 !== Uc && 60018 === n3 && (o3 = "SearchOverLimit"), o3 = s2.getErrMsg(o3) || t3, t3 = new Bn({ code: n3, message: o3 }), c2.setMessage(u2).setError(t3).end(), C(t3); s2.get(27).isCSPluginEnabled(); var n3 = e3.data, o3 = n3.cursor, t3 = void 0 === o3 ? "" : o3, o3 = n3.totalCount, n3 = "totalCount:".concat(o3, " cost:").concat(Qt(l2)), n3 = (v.l("".concat(r2, " ok. cursor:").concat(t3, " ").concat(n3)), c2.setMessage("".concat(u2, " ").concat(n3)).end(), s2._genRes(i2, a2, e3.data)); return Sn({ searchResultList: n3, cursor: t3, totalCount: o3 }); }).catch(function(e3) { return c2.setMessage(u2).setError(e3).end(), C(e3); }); } }, { key: "_genParams", value: function(e2, t2) { var n2 = t2.count, o2 = g(t2, qc); if (n2 && (o2.count = parseInt(n2)), e2 === Uc) return this._genMsgParams(o2); n2 = t2.keywordList, t2 = t2.keywordListMatchType; return o2.keywords = n2, o2.keywordMatchType = "and" === t2 ? 1 : 0, e2 === bc ? this._genUserParams(o2) : o2; } }, { key: "_genMsgParams", value: function(e2) { var t2 = e2.conversationID, n2 = e2.timePosition, o2 = e2.timePeriod, e2 = g(e2, xc); return A(t2) || (At(t2) && (e2.account = t2.replace(R.CONV_C2C, "")), Ot(t2) && (e2.groupID = t2.replace(R.CONV_GROUP, ""))), Qe(o2) && 0 < o2 && (Qe(n2) && 0 < n2 ? e2.startTime = n2 - o2 : e2.startTime = Oe() - o2), e2.startTime && e2.startTime < 0 && (e2.startTime = void 0), Qe(n2) && 0 < n2 && (e2.endTime = n2), e2; } }, { key: "_genUserParams", value: function(e2) { var t2 = e2.miniBirthday, n2 = e2.maxBirthday, e2 = g(e2, Vc); return Qe(t2) && (e2.miniBirthday = parseInt(t2), Qe(n2) || (e2.maxBirthday = 4294967295)), Qe(n2) && (e2.maxBirthday = parseInt(n2)), e2; } }, { key: "_genRes", value: function(e2, t2, n2) { switch (e2) { case Uc: return this._genMsgRes(n2.searchResult, !t2.conversationID); case bc: return this._genUserRes(n2.userList); case wc: return this._genGrpRes(n2.groupList); case Fc: return this._genMemberRes(n2.groupMemberList); default: return []; } } }, { key: "_genMsgRes", value: function(e2, a2) { var s2 = this.get(11); return nt(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(R.CONV_GROUP).concat(t2) : "".concat(R.CONV_C2C).concat(n2), i2 = { conversationID: n2, messageCount: o2, messageList: [] }; if (a2 && 1 < o2) return i2; o2 = e3.filter(function(e4) { return !!e4; }); return 0 < o2.length && (e3 = s2.onRoamingMessage(o2, n2, false), t2 && e3.reverse(), i2.messageList = e3, i2.messageCount = e3.length), i2; }) : []; } }, { key: "_genUserRes", value: function(e2) { var t2 = this.get(4)._profileHandler; if (!nt(e2)) return []; for (var n2 = [], o2 = 0, i2 = e2.length; o2 < i2; o2++) { var a2 = e2[o2], s2 = a2.userID, a2 = a2.profileItems; "@TLS#NOT_FOUND" !== s2 && "" !== s2 && (s2 = t2._update(s2, t2._getLatestProfileFromResponse(s2, a2)).latestProfile, n2.push(s2)); } return n2; } }, { key: "_genGrpRes", value: function(e2) { if (!nt(e2)) return []; for (var t2 = [], n2 = 0, o2 = e2.length; n2 < o2; n2++) e2[n2] && e2[n2].groupID && t2.push(new li(e2[n2])); return t2; } }, { key: "_genMemberRes", value: function(e2) { if (!nt(e2)) return []; for (var t2, n2, o2, i2, a2, s2, r2 = /* @__PURE__ */ new Map(), c2 = 0, u2 = e2.length; c2 < u2; c2++) e2[c2] && e2[c2].userID && e2[c2].groupID && (n2 = (t2 = e2[c2]).groupID, i2 = t2.name, a2 = t2.type, s2 = t2.avatar, o2 = t2.nick, i2 = { groupID: n2, name: i2, type: a2, avatar: s2 }, a2 = { userID: t2.userID, nick: o2, nameCard: t2.nameCard }, r2.has(n2) ? ((s2 = r2.get(n2)).memberList.push(a2), r2.set(n2, s2)) : r2.set(n2, { groupInfo: i2, memberList: [a2] })); return D(r2.values()); } }]), Zc), Kc = (e(Xc, [{ key: "_startTimer", value: function() { var e2 = this._map.get(24), t2 = e2.isWorkerEnabled(); v.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)), v.l("".concat(this._n, "._startMainThreadTimer seed:").concat(this._checkTimer)); } }, { key: "stopTimer", value: function() { var e2 = this._map.get(24), t2 = e2.isWorkerEnabled(); v.l("".concat(this._n, ".stopTimer isWorkerEnabled:").concat(t2, " seed:").concat(this._checkTimer)), t2 ? e2.stopWorkerTimer() : this._stopMainThreadTimer(); } }, { key: "_stopMainThreadTimer", value: function() { v.l("".concat(this._n, "._stopMainThreadTimer")), 0 < this._checkTimer && (clearInterval(this._checkTimer), this._checkTimer = -1, this._checkCount = 0); } }, { key: "_stopMainThreadSocket", value: function() { v.l("".concat(this._n, "._stopMainThreadSocket")); var e2 = this._map.get(21); e2.setIsWorkerEnabled(true), e2.reConnect(); } }, { key: "_startMainThreadSocket", value: function() { v.l("".concat(this._n, "._startMainThreadSocket")); var e2 = this._map.get(21); e2.setIsWorkerEnabled(false), e2.reConnect(); } }, { key: "onWorkerTimerEnabled", value: function() { v.l("".concat(this._n, ".onWorkerTimerEnabled, disable main thread timer and socket")), this._stopMainThreadTimer(), this._stopMainThreadSocket(); } }, { key: "onWorkerTimerDisabled", value: function() { v.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 = N(this._map); try { for (t2.s(); !(e2 = t2.n()).done; ) { var n2 = m(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(G.SDK_READY), e2 = Date.now() - this._startLoginTs, v.w("SDK is ready. cost ".concat(e2, " ms")), this._startLoginTs = Date.now(), t2 = this._ssoLogForReady.getStartTs() + Ge, this._ssoLogForReady.setMessage(e2).start(t2).end()); } }, { key: "login", value: function() { 0 === this._startLoginTs && (Ae(), this._startLoginTs = Date.now(), this._startTimer(), this._map.get(15).start(), this._ssoLogForReady = new M("sdkReady"), this._reason = T.LOGGING_IN); } }, { key: "onLoginFailed", value: function() { this._startLoginTs = 0; } }, { key: "getOEmitInst", value: function() { return null === this._oEmitter && (this._oEmitter = new La(), e2 = this._oEmitter, Kn = e2, this._oEmitter._emit = this._oEmitter.emit, this._oEmitter.emit = (function(e3, t2) { var n2, o2, i2 = this; this._canIUseSignaling() && (e3 === G.MESSAGE_RECEIVED && this.get(33).onNewMessageList(t2), e3 === G.MESSAGE_MODIFIED && this.get(33).onMessageModified(t2)), e3 === G.CONVERSATION_LIST_UPDATED || e3 === G.FRIEND_LIST_UPDATED || e3 === G.GROUP_LIST_UPDATED || e3 === G.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED ? false !== this._eventThrottling ? this._eventThrottleMap.has(e3) ? (n2 = Date.now()) - (o2 = this._eventThrottleMap.get(e3)).last <= 1e3 ? (-1 < 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 === G.CONVERSATION_LIST_UPDATED ? this._map.get(12).isPartialUpdatedConvs() ? this._map.get(11).getPartialUpdatedConvs() : this._map.get(11).getLocalConvList() : e2 === G.FRIEND_LIST_UPDATED ? this._map.get(8).getLocalFriendList(false) : e2 === G.GROUP_LIST_UPDATED ? this._map.get(7).getLocalGroupList() : e2 === G.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED ? this._map.get(11).getTotalUnreadCount() : e2 === G.CONVERSATION_ID_LIST_UPDATED ? this._map.get(11).getUpdatedConvIDList() : void 0; } }, { key: "getIEmitInst", value: function() { return null === this._iEmitter && (this._iEmitter = new La(), this._iEmitter._emit = this._iEmitter.emit, this._iEmitter.emit = (function(e2, t2) { e2 = et(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 && v.w(e2); } }, { key: "onError", value: function(e2) { var t2 = "code:".concat(e2.code, " message:").concat(e2.message); v.w("Oops! ".concat(t2)), new M("error").setMessage(t2).setLevel("error").end(), this.getOEmitInst().emit(G.ERROR, e2); } }, { key: "restartTimer", value: function() { v.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: "statTUIKeyFeatures", value: function(e2) { var t2 = e2.code, e2 = e2.msg, e2 = void 0 === e2 ? "" : e2, n2 = t2 + e2; this._codeMsgForTUIMap.has(n2) || (this._codeMsgForTUIMap.set(n2, 1), n2 = this.get(12).getUIPlatform(), new M("tui_key_features").setCode(t2).setMessage(e2).setUIPlatform(n2).end()); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), Ae(); var e2, t2 = N(this._map); try { for (t2.s(); !(e2 = t2.n()).done; ) { var n2 = m(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(G.SDK_NOT_READY); var o2, i2 = N(this._eventThrottleMap); try { for (i2.s(); !(o2 = i2.n()).done; ) { var a2 = m(o2.value, 2)[1]; -1 < a2.timeoutID && clearTimeout(a2.timeoutID); } } catch (e3) { i2.e(e3); } finally { i2.f(); } this._eventThrottleMap.clear(), this._codeMsgForTUIMap.clear(); } }]), Xc), Yc = (e(zc, [{ 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(G).indexOf(o2), n2 = "CallbackError"; -1 !== t2 && (t2 = Object.keys(G)[t2], a2._m.warn(n2, t2, e3)), a2._reportCount < 5 && (new M(n2).setMessage("eventName:".concat(o2)).setMoreMessage(e3.message).end(), a2._reportCount += 1); } }; } }, { key: "destroy", value: function() { this._funcMap.clear(); } }, { key: "reset", value: function() { v.l("".concat(this._n, ".reset")), this._reportCount = 0; } }]), zc), Wc = (e(Jc, [{ 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 Pe(); } }, { 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 v.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(G.SDK_DESTROY, { SDKAppID: n2 }); }); } }, { key: "on", value: function(e2, t2, n2) { v.d("on", "eventName:".concat(e2)), this._m.getOEmitInst().on(e2, this._safetyCallbackFactory.defense(e2, t2, n2), n2); } }, { key: "once", value: function(e2, t2, n2) { v.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) { v.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) { (A(e2["tim-push"]) ? A(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")) && (Jt() ? 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"), De && t2 && console.warn(t2)), v.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 !== R.MSG_MERGER ? C({ code: T.MSG_MERGER_TYPE_INVALID }) : Je(e2.payload.downloadKey) ? C({ code: T.MSG_MERGER_KEY_INVALID }) : this._get(2).downloadMergerMessage(e2).catch(function(e3) { return C({ code: T.MSG_MERGER_DOWNLOAD_FAIL }); }); } }, { key: "createForwardMessage", value: function(e2) { return this._get(2).createForwardMessage(e2); } }, { key: "sendMessage", value: function(e2, t2) { return e2 instanceof Ro ? this._get(2).sendMessageInstance(e2, t2) : C({ code: T.MSG_INSTANCE_REQUIRED }); } }, { 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) : "statTUIKeyFeatures" === e2 ? this._m.statTUIKeyFeatures(t2) : C({ code: T.INVALID_OPERATION }); } }, { key: "revokeMessage", value: function(e2) { return this._get(2).revokeMessage(e2); } }, { key: "resendMessage", value: function(e2, t2) { return e2 instanceof Ro ? this._get(2).resendMessage(e2, t2) : C({ code: T.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) : C({ code: T.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: "searchCloudMessages", value: function(e2) { var t2 = this._get(38); return t2 ? t2.searchCloudMessages(e2) : C({ code: T.NO_MODULE }); } }, { key: "searchCloudUsers", value: function(e2) { var t2 = this._get(38); return t2 ? t2.searchCloudUsers(e2) : C({ code: T.NO_MODULE }); } }, { key: "searchCloudGroups", value: function(e2) { var t2 = this._get(38); return t2 ? t2.searchCloudGroups(e2) : C({ code: T.NO_MODULE }); } }, { key: "searchCloudGroupMembers", value: function(e2) { var t2 = this._get(38); return t2 ? t2.searchCloudGroupMembers(e2) : C({ code: T.NO_MODULE }); } }, { 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() : C({ code: T.NO_MODULE }); } }, { key: "addFriend", value: function(e2) { var t2 = this._get(8); return t2 ? t2.addFriend(e2) : C({ code: T.NO_MODULE }); } }, { key: "deleteFriend", value: function(e2) { var t2 = this._get(8); return t2 ? t2.deleteFriend(e2) : C({ code: T.NO_MODULE }); } }, { key: "checkFriend", value: function(e2) { var t2 = this._get(8); return t2 ? t2.checkFriend(e2) : C({ code: T.NO_MODULE }); } }, { key: "getFriendProfile", value: function(e2) { var t2 = this._get(8); return t2 ? t2.getFriendProfile(e2) : C({ code: T.NO_MODULE }); } }, { key: "updateFriend", value: function(e2) { var t2 = this._get(8); return t2 ? t2.updateFriend(e2) : C({ code: T.NO_MODULE }); } }, { key: "getFriendApplicationList", value: function() { var e2 = this._get(8); return e2 ? e2.getLocalFriendApplicationList() : C({ code: T.NO_MODULE }); } }, { key: "acceptFriendApplication", value: function(e2) { var t2 = this._get(8); return t2 ? t2.acceptFriendApplication(e2) : C({ code: T.NO_MODULE }); } }, { key: "refuseFriendApplication", value: function(e2) { var t2 = this._get(8); return t2 ? t2.refuseFriendApplication(e2) : C({ code: T.NO_MODULE }); } }, { key: "deleteFriendApplication", value: function(e2) { var t2 = this._get(8); return t2 ? t2.deleteFriendApplication(e2) : C({ code: T.NO_MODULE }); } }, { key: "setFriendApplicationRead", value: function() { var e2 = this._get(8); return e2 ? e2.setFriendApplicationRead() : C({ code: T.NO_MODULE }); } }, { key: "getFriendGroupList", value: function() { var e2 = this._get(8); return e2 ? e2.getLocalFriendGroupList() : C({ code: T.NO_MODULE }); } }, { key: "createFriendGroup", value: function(e2) { var t2 = this._get(8); return t2 ? t2.createFriendGroup(e2) : C({ code: T.NO_MODULE }); } }, { key: "deleteFriendGroup", value: function(e2) { var t2 = this._get(8); return t2 ? t2.deleteFriendGroup(e2) : C({ code: T.NO_MODULE }); } }, { key: "addToFriendGroup", value: function(e2) { var t2 = this._get(8); return t2 ? t2.addToFriendGroup(e2) : C({ code: T.NO_MODULE }); } }, { key: "removeFromFriendGroup", value: function(e2) { var t2 = this._get(8); return t2 ? t2.removeFromFriendGroup(e2) : C({ code: T.NO_MODULE }); } }, { key: "renameFriendGroup", value: function(e2) { var t2 = this._get(8); return t2 ? t2.renameFriendGroup(e2) : C({ code: T.NO_MODULE }); } }, { key: "followUser", value: function(e2) { var t2 = this._get(35); return t2 ? t2.followUser(e2) : C({ code: T.NO_MODULE }); } }, { key: "unfollowUser", value: function(e2) { var t2 = this._get(35); return t2 ? t2.unfollowUser(e2) : C({ code: T.NO_MODULE }); } }, { key: "getMyFollowersList", value: function(e2) { var t2 = this._get(35); return t2 ? t2.getMyFollowersList(e2) : C({ code: T.NO_MODULE }); } }, { key: "getMyFollowingList", value: function(e2) { var t2 = this._get(35); return t2 ? t2.getMyFollowingList(e2) : C({ code: T.NO_MODULE }); } }, { key: "getMutualFollowersList", value: function(e2) { var t2 = this._get(35); return t2 ? t2.getMutualFollowersList(e2) : C({ code: T.NO_MODULE }); } }, { key: "getUserFollowInfo", value: function(e2) { var t2 = this._get(35); return t2 ? t2.getUserFollowInfo(e2) : C({ code: T.NO_MODULE }); } }, { key: "checkFollowType", value: function(e2) { var t2 = this._get(35); return t2 ? t2.checkFollowType(e2) : C({ code: T.NO_MODULE }); } }, { key: "getGroupList", value: function() { var e2 = this._get(7); return e2 ? e2.getGroupList() : C({ code: T.NO_MODULE }); } }, { key: "getGroupProfile", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupProfile(e2) : C({ code: T.NO_MODULE }); } }, { key: "createGroup", value: function(e2) { var t2 = this._get(7); return t2 ? t2.createGroup(e2) : C({ code: T.NO_MODULE }); } }, { key: "dismissGroup", value: function(e2) { var t2 = this._get(7); return t2 ? t2.dismissGroup(e2) : C({ code: T.NO_MODULE }); } }, { key: "updateGroupProfile", value: function(e2) { var t2 = this._get(7); return t2 ? t2.updateGroupProfile(e2) : C({ code: T.NO_MODULE }); } }, { key: "joinGroup", value: function(e2) { var t2 = this._get(7); return t2 ? t2.joinGroup(e2) : C({ code: T.NO_MODULE }); } }, { key: "quitGroup", value: function(e2) { var t2 = this._get(7); return t2 ? t2.quitGroup(e2) : C({ code: T.NO_MODULE }); } }, { key: "searchGroupByID", value: function(e2) { var t2 = this._get(7); return t2 ? t2.searchGroupByID(e2) : C({ code: T.NO_MODULE }); } }, { key: "getGroupOnlineMemberCount", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupOnlineMemberCount(e2) : C({ code: T.NO_MODULE }); } }, { key: "changeGroupOwner", value: function(e2) { var t2 = this._get(7); return t2 ? t2.changeGroupOwner(e2) : C({ code: T.NO_MODULE }); } }, { key: "getGroupApplicationList", value: function() { var e2 = this._get(7); return e2 ? e2.getGroupApplicationList() : C({ code: T.NO_MODULE }); } }, { key: "handleGroupApplication", value: function(e2) { var t2 = this._get(7); return t2 ? t2.handleGroupApplication(e2) : C({ code: T.NO_MODULE }); } }, { key: "initGroupAttributes", value: function(e2) { var t2 = this._get(7); return t2 ? t2.initGroupAttributes(e2) : C({ code: T.NO_MODULE }); } }, { key: "setGroupAttributes", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupAttributes(e2) : C({ code: T.NO_MODULE }); } }, { key: "deleteGroupAttributes", value: function(e2) { var t2 = this._get(7); return t2 ? t2.deleteGroupAttributes(e2) : C({ code: T.NO_MODULE }); } }, { key: "getGroupAttributes", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupAttributes(e2) : C({ code: T.NO_MODULE }); } }, { key: "setGroupCounters", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupCounters(e2) : C({ code: T.NO_MODULE }); } }, { key: "increaseGroupCounter", value: function(e2) { var t2 = this._get(7); return t2 ? t2.increaseGroupCounter(e2) : C({ code: T.NO_MODULE }); } }, { key: "decreaseGroupCounter", value: function(e2) { var t2 = this._get(7); return t2 ? t2.decreaseGroupCounter(e2) : C({ code: T.NO_MODULE }); } }, { key: "getGroupCounters", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupCounters(e2) : C({ code: T.NO_MODULE }); } }, { key: "getGroupMemberList", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupMemberList(e2) : C({ code: T.NO_MODULE }); } }, { key: "getGroupMemberProfile", value: function(e2) { var t2 = this._get(7); return t2 ? t2.getGroupMemberProfile(e2) : C({ code: T.NO_MODULE }); } }, { key: "addGroupMember", value: function(e2) { var t2 = this._get(7); return t2 ? t2.addGroupMember(e2) : C({ code: T.NO_MODULE }); } }, { key: "deleteGroupMember", value: function(e2) { var t2 = this._get(7); return t2 ? t2.deleteGroupMember(e2) : C({ code: T.NO_MODULE }); } }, { key: "setGroupMemberMuteTime", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupMemberMuteTime(e2) : C({ code: T.NO_MODULE }); } }, { key: "setGroupMemberRole", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupMemberRole(e2) : C({ code: T.NO_MODULE }); } }, { key: "setGroupMemberNameCard", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupMemberNameCard(e2) : C({ code: T.NO_MODULE }); } }, { key: "setGroupMemberCustomField", value: function(e2) { var t2 = this._get(7); return t2 ? t2.setGroupMemberCustomField(e2) : C({ code: T.NO_MODULE }); } }, { key: "markGroupMemberList", value: function(e2) { var t2 = this._get(7); return t2 ? t2.markGroupMemberList(e2) : C({ code: T.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) : C({ code: T.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) : C({ code: T.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) : C({ code: T.NO_MODULE }); } }, { key: "accept", value: function(e2) { var t2 = this._get(33); return t2 ? t2.accept(e2) : C({ code: T.NO_MODULE }); } }, { key: "reject", value: function(e2) { var t2 = this._get(33); return t2 ? t2.reject(e2) : C({ code: T.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) : C({ code: T.NO_MODULE }); } }]), Jc), jc = { 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 Jc(e2) { d(this, Jc); e2 = { SDKAppID: e2.SDKAppID, unlimitedAVChatRoom: e2.unlimitedAVChatRoom || false, scene: e2.scene || "", oversea: e2.oversea || false, instanceID: Ut(), 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, disableIndependentDomain: true === e2.disableIndependentDomain, modules: e2.modules || void 0 }; this._m = new Kc(e2), this._safetyCallbackFactory = new Yc(this._m); } function zc(e2) { d(this, zc), this._funcMap = /* @__PURE__ */ new Map(), this._m = e2, this._n = "SafetyCallback", this._reportCount = 0; } function Xc(t2) { var n2 = this; d(this, Xc); var o2, e2 = new M("sdkConstruct"), i2 = (this._n = "ModuleManager", this._isReady = false, this._reason = T.USER_NOT_LOGGED_IN, this._startLoginTs = 0, this._map = /* @__PURE__ */ new Map(), this._optionalModuleMap = /* @__PURE__ */ new Map(), this._codeMsgForTUIMap = /* @__PURE__ */ new Map(), this._iEmitter = null, this._oEmitter = null, this._checkCount = 0, this._checkTimer = -1, this._map.set(12, new wi(this, t2)), this._map.set(37, new Pc(this)), this._map.set(15, new Ia(this)), this._map.set(27, new lr(this)), this._map.set(23, new Js(this)), this._map.set(24, new cr(this)), this._map.set(26, new er(this)), this._map.set(21, new ms(this)), this._map.set(20, new js(this)), this._map.set(1, new qi(this)), this._map.set(2, new Ba(this)), this._map.set(3, new Ka(this)), this._map.set(34, new Ya(this)), this._map.set(31, new Wa(this)), this._map.set(4, new bi(this)), this._map.set(6, new Yo(this)), this._map.set(11, new gi(this)), this._map.set(7, new ki(this)), this._map.set(10, new Oi(this)), this._map.set(13, new ha(this)), this._map.set(32, new gr(this)), this._map.set(14, new fa(this)), this._map.set(17, new Ra(this)), this._map.set(18, new ja(this)), this._map.set(19, new Ja(this)), this._map.set(25, new zs(this)), this._map.set(8, new rr(this)), this._map.set(28, new dr(this)), this._map.set(36, new pr(this)), this._map.set(29, new _r(this)), this._map.set(30, new hr(this)), this._map.set(33, new Cr(this)), this._map.set(35, new Lr(this)), this._map.set(38, new Bc(this)), this._eventThrottleMap = /* @__PURE__ */ new Map(), this._eventThrottling = t2.eventThrottling, this._map.get(12).isPartialUpdatedConvs() && (this._eventThrottling = false), et(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)) : "cloud-search-module" === e3 && n2._map.set(38, 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(bt()) + " isIOSWebView:".concat(De, " platform:").concat(de, " canIUseInflate:").concat(this.canIUseInflate()) + " workerAvailable:".concat(ye, " eventThrottling:").concat(this._eventThrottling, " UserAgent:").concat(le); M.bindEventStatModule(this._map.get(14)), M.bindNetMonitorModule(this._map.get(15)), e2.setMessage("".concat(i2, " ").concat(function() { var t3 = ""; if (ae) try { var e3 = ue.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(), v.i("SDK ".concat(i2)), Bn.prototype._getErrMsg = this.getErrMsg.bind(this), this._readyList = void 0, this._ssoLogForReady = null, this._initReadyList(); } function Zc(e2) { return d(this, Zc), (e2 = Nc.call(this, e2))._n = "CSModule", e2; } function Qc(e2) { d(this, Qc), this._m = e2, this._n = "InflateModule", this._bLogForInflateOK = false, this._bLogForInflateError = false; } var $c = {}, oe = {}; return oe.create = function(e2) { var t2 = "TencentCloudChat.create", n2 = 0, o2 = e2.SDKAppID; if (Qe(o2)) n2 = o2; else if (n2 = parseInt(o2), isNaN(o2)) return v.e("".concat(t2, " failed. Failed to parse the SDKAppID, please check the arguments")), null; if (n2 && $c[n2]) return $c[n2]; v.l("".concat(t2)); var i2, a2, o2 = new Wc(y(y({}, e2), {}, { SDKAppID: n2 })), e2 = (o2.on(G.SDK_DESTROY, function(e3) { $c[e3.data.SDKAppID] = null, delete $c[e3.data.SDKAppID]; }), i2 = o2, a2 = /* @__PURE__ */ Object.create(null), Object.keys(Hn).forEach(function(o3) { var t3; i2[o3] && (t3 = new U(), a2[o3] = function() { var e3 = Array.from(arguments); return t3.use(function(e4, t4) { var n3 = function(e5, t5) { if (e5.isReady() || 1 === jc[t5]) return true; var n4 = { code: n4 = e5.getNotReadyReason(), message: "".concat(e5.getErrMsg(n4), " | ").concat(t5, " | ").concat(e5.getErrMsg(T.SDK_IS_NOT_READY)) }; return e5.onError(n4), n4; }(i2, o3); return true === n3 ? t4() : C(n3); }).use(function(e4, t4) { if (true === function(n3, o4, i3) { if (void 0 === o4) return true; var a3 = true; if (et(o4)) Object.keys(o4).forEach(function(e6) { var t5 = 1 === n3.length ? n3[0][e6] : void 0; a3 = !!en(t5, o4[e6], i3, e6) && a3; }); else if (nt(o4)) for (var e5 = 0; e5 < o4.length; e5++) a3 = !!en(n3[e5], o4[e5], i3, o4[e5].name) && a3; if (a3) return a3; throw new Error("Params validate failed."); }(e4, Vn[o3], o3)) return t4(); }).use(function(e4, t4) { return i2[o3].apply(i2, e4); }), t3.run(e3); }); }), a2); return $c[n2] = e2, Vn.hookGetAPITips(o2.getErrMsg.bind(o2)), v.l("".concat(t2, " ok")), e2; }, oe.TYPES = R, oe.EVENT = G, oe.TSignaling = P, oe.VERSION = "3.5.2", v.l("TencentCloudChat.VERSION:".concat(oe.VERSION)), oe; }); } }); export default require_chat(); //# sourceMappingURL=@tencentcloud_chat.js.map