'use strict';!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).TIM=t()}(this,(function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(t){for(var n=1;n=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function f(e){var t=l();return function(){var n,o=u(e);if(t){var s=u(this).constructor;n=Reflect.construct(o,arguments,s)}else n=o.apply(this,arguments);return _(this,n)}}function v(e,t){return M(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var o,s,a=[],i=!0,r=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(u){r=!0,s=u}finally{try{i||null==n.return||n.return()}finally{if(r)throw s}}return a}(e,t)||I(e,t)||T()}function m(e){return function(e){if(Array.isArray(e))return C(e)}(e)||y(e)||I(e)||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 M(e){if(Array.isArray(e))return e}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:s}}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 a,i=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){r=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(r)throw a}}}}var k={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",MESSAGE_EXTENSIONS_UPDATED:"onMessageExtensionsUpdated",MESSAGE_EXTENSIONS_DELETED:"onMessageExtensionsDeleted",CONVERSATION_LIST_UPDATED:"onConversationListUpdated",TOTAL_UNREAD_MESSAGE_COUNT_UPDATED:"onTotalUnreadMessageCountUpdated",CONVERSATION_GROUP_LIST_UPDATED:"onConversationGroupListUpdated",CONVERSATION_IN_GROUP_UPDATED:"onConversationInGroupUpdated",GROUP_LIST_UPDATED:"onGroupListUpdated",GROUP_SYSTEM_NOTICE_RECEIVED:"receiveGroupSystemNotice",GROUP_ATTRIBUTES_UPDATED:"groupAttributesUpdated",GROUP_COUNTER_UPDATED:"onGroupCounterUpdated",TOPIC_CREATED:"onTopicCreated",TOPIC_DELETED:"onTopicDeleted",TOPIC_UPDATED:"onTopicUpdated",PROFILE_UPDATED:"onProfileUpdated",USER_STATUS_UPDATED:"onUserStatusUpdated",BLACKLIST_UPDATED:"blacklistUpdated",FRIEND_LIST_UPDATED:"onFriendListUpdated",FRIEND_GROUP_LIST_UPDATED:"onFriendGroupListUpdated",FRIEND_APPLICATION_LIST_UPDATED:"onFriendApplicationListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",SDK_RELOAD:"sdkReload"},E={MSG_TEXT:"TIMTextElem",MSG_IMAGE:"TIMImageElem",MSG_SOUND:"TIMSoundElem",MSG_AUDIO:"TIMSoundElem",MSG_FILE:"TIMFileElem",MSG_FACE:"TIMFaceElem",MSG_VIDEO:"TIMVideoFileElem",MSG_GEO:"TIMLocationElem",MSG_LOCATION:"TIMLocationElem",MSG_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_MERGER:"TIMRelayElem",MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest",CONV_C2C:"C2C",CONV_GROUP:"GROUP",CONV_TOPIC:"TOPIC",CONV_SYSTEM:"@TIM#SYSTEM",CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3,CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8,GRP_PRIVATE:"Private",GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_CHATROOM:"ChatRoom",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",GRP_MBR_ROLE_CUSTOM:"Custom",GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11,MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard",GENDER_UNKNOWN:"Gender_Type_Unknown",GENDER_FEMALE:"Gender_Type_Female",GENDER_MALE:"Gender_Type_Male",KICKED_OUT_MULT_ACCOUNT:"multipleAccount",KICKED_OUT_MULT_DEVICE:"multipleDevice",KICKED_OUT_USERSIG_EXPIRED:"userSigExpired",KICKED_OUT_REST_API:"REST_API_Kick",ALLOW_TYPE_ALLOW_ANY:"AllowType_Type_AllowAny",ALLOW_TYPE_NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_TYPE_DENY_ANY:"AllowType_Type_DenyAny",FORBID_TYPE_NONE:"AdminForbid_Type_None",FORBID_TYPE_SEND_OUT:"AdminForbid_Type_SendOut",JOIN_OPTIONS_FREE_ACCESS:"FreeAccess",JOIN_OPTIONS_NEED_PERMISSION:"NeedPermission",JOIN_OPTIONS_DISABLE_APPLY:"DisableApply",JOIN_STATUS_SUCCESS:"JoinedSuccess",JOIN_STATUS_ALREADY_IN_GROUP:"AlreadyInGroup",JOIN_STATUS_WAIT_APPROVAL:"WaitAdminApproval",INVITE_OPTIONS_DISABLE_INVITE:"DisableInvite",INVITE_OPTIONS_NEED_PERMISSION:"NeedPermission",INVITE_OPTIONS_FREE_ACCESS:"FreeAccess",GRP_PROFILE_OWNER_ID:"ownerID",GRP_PROFILE_CREATE_TIME:"createTime",GRP_PROFILE_LAST_INFO_TIME:"lastInfoTime",GRP_PROFILE_MEMBER_NUM:"memberNum",GRP_PROFILE_MAX_MEMBER_NUM:"maxMemberNum",GRP_PROFILE_JOIN_OPTION:"joinOption",GRP_PROFILE_INVITE_OPTION:"inviteOption",GRP_PROFILE_INTRODUCTION:"introduction",GRP_PROFILE_NOTIFICATION:"notification",GRP_PROFILE_MUTE_ALL_MBRS:"muteAllMembers",SNS_ADD_TYPE_SINGLE:"Add_Type_Single",SNS_ADD_TYPE_BOTH:"Add_Type_Both",SNS_DELETE_TYPE_SINGLE:"Delete_Type_Single",SNS_DELETE_TYPE_BOTH:"Delete_Type_Both",SNS_APPLICATION_TYPE_BOTH:"Pendency_Type_Both",SNS_APPLICATION_SENT_TO_ME:"Pendency_Type_ComeIn",SNS_APPLICATION_SENT_BY_ME:"Pendency_Type_SendOut",SNS_APPLICATION_AGREE:"Response_Action_Agree",SNS_APPLICATION_AGREE_AND_ADD:"Response_Action_AgreeAndAdd",SNS_CHECK_TYPE_BOTH:"CheckResult_Type_Both",SNS_CHECK_TYPE_SINGLE:"CheckResult_Type_Single",SNS_TYPE_NO_RELATION:"CheckResult_Type_NoRelation",SNS_TYPE_A_WITH_B:"CheckResult_Type_AWithB",SNS_TYPE_B_WITH_A:"CheckResult_Type_BWithA",SNS_TYPE_BOTH_WAY:"CheckResult_Type_BothWay",NET_STATE_CONNECTED:"connected",NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected",MSG_AT_ALL:"__kImSDK_MesssageAtALL__",READ_ALL_C2C_MSG:"readAllC2CMessage",READ_ALL_GROUP_MSG:"readAllGroupMessage",READ_ALL_MSG:"readAllMessage",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3},S=function(){function e(){o(this,e),this.cache=[],this.options=null}return a(e,[{key:"use",value:function(e){if("function"!=typeof e)throw"middleware must be a function";return this.cache.push(e),this}},{key:"next",value:function(e){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:"run",value:function(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}]),e}(),L=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;o(this,e),this.high=t,this.low=n}return a(e,[{key:"equal",value:function(e){return null!==e&&(this.low===e.low&&this.high===e.high)}},{key:"toString",value:function(){var e=Number(this.high).toString(16),t=Number(this.low).toString(16);if(t.length<8)for(var n=8-t.length;n;)t="0"+t,n--;return e+t}}]),e}(),A={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"}},PRODUCTION:{CHINA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com"},IND:{DEFAULT:"wss://wssind.my-imcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com"},JPN:{DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT:"wss://wssusa.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com"}}},R={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},N="1.7.3",O=537048168,G="CHINA",U="OVERSEA",P="SINGAPORE",b="KOREA",w="GERMANY",F="IND",q="JPN",x="USA",V={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G;this.CURRENT=A.PRODUCTION[e]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GROUP:"group_open_http_svc",GROUP_AVCHATROOM:"group_open_avchatroom_http_svc",GROUP_COMMUNITY:"million_group_open_http_svc",GROUP_ATTR:"group_open_attr_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GROUP_NO_AUTH:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_svc",BIG_GROUP_LONG_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",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_MESSAGE:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush",IM_MSG_AUDIT_MGR:"im_msg_audit_mgr",TUIROOM_SVR:"tui_room_svr",IM_OPEN_TRANSLATE:"im_open_translate"},CMD:{LOGIN:"wslogin",LOGOUT_LONG_POLL:"longpollinglogout",LOGOUT:"wslogout",HELLO:"wshello",STAT_BACKGROUND:"ws_stat_background",STAT_FOREGROUND:"ws_stat_foreground",SET_TOKEN:"ws_stat_settoken",PORTRAIT_GET:"portrait_get_all",PORTRAIT_SET:"portrait_set",GET_LONG_POLL_ID:"getlongpollingid",LONG_POLL:"longpolling",AVCHATROOM_LONG_POLL:"get_msg",ADD_FRIEND:"friend_add",UPDATE_FRIEND:"friend_update",GET_FRIEND_LIST:"friend_get",GET_FRIEND_PROFILE:"friend_get_specified",DELETE_FRIEND:"friend_delete",CHECK_FRIEND:"friend_check",GET_FRIEND_GROUP_LIST:"group_get",RESPOND_FRIEND_APPLICATION:"friend_response",GET_FRIEND_APPLICATION_LIST:"pendency_get",DELETE_FRIEND_APPLICATION:"pendency_delete",REPORT_FRIEND_APPLICATION:"pendency_report",GET_GROUP_APPLICATION:"get_pendency",CREATE_FRIEND_GROUP:"group_add",DELETE_FRIEND_GROUP:"group_delete",UPDATE_FRIEND_GROUP:"group_update",GET_BLACKLIST:"black_list_get",ADD_BLACKLIST:"black_list_add",DELETE_BLACKLIST:"black_list_delete",CREATE_GROUP:"create_group",GET_JOINED_GROUPS:"get_joined_group_list",SET_GROUP_ATTRIBUTES:"set_group_attr",MODIFY_GROUP_ATTRIBUTES:"modify_group_attr",DELETE_GROUP_ATTRIBUTES:"delete_group_attr",CLEAR_GROUP_ATTRIBUTES:"clear_group_attr",GET_GROUP_ATTRIBUTES:"get_group_attr",SEND_MESSAGE:"sendmsg",REVOKE_C2C_MESSAGE:"msgwithdraw",DELETE_C2C_MESSAGE:"delete_c2c_msg_ramble",MODIFY_C2C_MESSAGE:"modify_c2c_msg",MODIFY_C2C_MESSAGE_EXTENSIONS:"set_key_values",GET_C2C_MESSAGE_EXTENSIONS:"get_key_values",SEND_GROUP_MESSAGE:"send_group_msg",REVOKE_GROUP_MESSAGE:"group_msg_recall",DELETE_GROUP_MESSAGE:"delete_group_ramble_msg_by_seq",MODIFY_GROUP_MESSAGE:"modify_group_msg",MODIFY_GROUP_MESSAGE_EXTENSIONS:"group_set_key_values",GET_GROUP_MESSAGE_EXTENSIONS:"group_get_key_values",GET_GROUP_INFO:"get_group_self_member_info",GET_GROUP_MEMBER_INFO:"get_specified_group_member_info",GET_GROUP_MEMBER_LIST:"get_group_member_info",GET_AVCHATROOM_MEMBER_LIST:"get_members",MARK_AVCHATROOM_MEMBER_INFO:"modify_user_info",QUIT_GROUP:"quit_group",CHANGE_GROUP_OWNER:"change_group_owner",DESTROY_GROUP:"destroy_group",ADD_GROUP_MEMBER:"add_group_member",DELETE_GROUP_MEMBER:"delete_group_member",BAN_AVCHATROOM_MEMBER:"ban_group_member",SEARCH_GROUP_BY_ID:"get_group_public_info",APPLY_JOIN_GROUP:"apply_join_group",HANDLE_APPLY_JOIN_GROUP:"handle_apply_join_group",HANDLE_INVITE_JOIN_GROUP:"handle_invite_join_permission_group",HANDLE_GROUP_INVITATION:"handle_invite_join_group",MODIFY_GROUP_INFO:"modify_group_base_info",MODIFY_GROUP_MEMBER_INFO:"modify_group_member_info",DELETE_GROUP_SYSTEM_MESSAGE:"deletemsg",DELETE_GROUP_AT_TIPS:"deletemsg",GET_GROUP_NOTIFY:"get_group_notify",GET_CONVERSATION_LIST:"get",PAGING_GET_CONVERSATION_LIST:"page_get",DELETE_CONVERSATION:"batch_delete",CLEAR_HISTORY_MESSAGE:"clear_msg",PIN_CONVERSATION:"top",SET_CONVERSATION_CUSTOM_DATA:"mark_contact",MARK_CONVERSATION:"mark_contact",CREATE_CONVERSATION_GROUP:"create_contact_group",DELETE_CONVERSATION_GROUP:"del_contact_group",UPDATE_CONVERSATION_GROUP:"update_contact_group",GET_CONVERSATION_GROUP_LIST:"get_contact_group",GET_MESSAGES:"getmsg",GET_C2C_ROAM_MESSAGES:"getroammsg",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_GROUP_ROAM_MESSAGES:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",SET_C2C_MESSAGE_READ:"msgreaded",GET_PEER_READ_TIME:"get_peer_read_time",SET_GROUP_MESSAGE_READ:"msg_read_report",FILE_READ_AND_WRITE_AUTHKEY:"authkey",FILE_UPLOAD:"pic_up",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",VIDEO_COVER:"video_cover",TIM_WEB_REPORT_V2:"tim_web_report_v2",BIG_DATA_HALLWAY_AUTH_KEY:"authkey",GET_ONLINE_MEMBER_NUM:"get_online_member_num",ALIVE:"alive",MESSAGE_PUSH:"msg_push",MULTI_MESSAGE_PUSH:"multi_msg_push_ws",MESSAGE_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",DOWNLOAD_MERGER_MESSAGE:"get_relay_json_msg",UPLOAD_MERGER_MESSAGE:"save_relay_json_msg",FETCH_CLOUD_CONTROL_CONFIG:"fetch_config",PUSHED_CLOUD_CONTROL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",KICK_OTHER:"KickOther",OVERLOAD_NOTIFY:"notify2",SET_ALL_MESSAGE_READ:"read_all_unread_msg",CREATE_TOPIC:"create_topic",DELETE_TOPIC:"destroy_topic",UPDATE_TOPIC_PROFILE:"modify_topic",GET_TOPIC_LIST:"get_topic",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUBSCRIBE_USER_STATUS:"ws_status_subscribe",UNSUBSCRIBE_USER_STATUS:"ws_status_unsubscribe",GET_RPOFANITY_LIST:"get_local_words",TRANSLATE_TEXT:"ws_batch_trans_text",UPDATE_GROUP_COUNTER:"update_group_counter",GET_GROUP_COUNTER:"get_group_counter"},CHANNEL:{SOCKET:1,XHR:2,AUTO:0},NAME_VERSION:{openim:"v4",group_open_http_svc:"v4",sns:"v4",profile:"v4",recentcontact:"v4",openpic:"v4",group_open_http_noauth_svc:"v4",group_open_long_polling_http_svc:"v4",group_open_long_polling_http_noauth_svc:"v4",imopenstat:"v4",im_cos_sign_svr:"v4",im_cos_msg:"v4",webim:"v4",im_open_push:"v4",im_open_status:"v4"}},B={SEARCH_MSG:new L(0,Math.pow(2,0)).toString(),SEARCH_GRP_SNS:new L(0,Math.pow(2,1)).toString(),AVCHATROOM_HISTORY_MSG:new L(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new L(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new L(0,Math.pow(2,4)).toString(),AVCHATROOM_MBR_LIST:new L(0,Math.pow(2,6)).toString(),USER_STATUS:new L(0,Math.pow(2,7)).toString(),CONV_MARK:new L(0,Math.pow(2,9)).toString(),CONV_GROUP:new L(0,Math.pow(2,10)).toString(),AVCHATROOM_BAN_MBR:new L(0,Math.pow(2,11)).toString(),MSG_EXT:new L(0,Math.pow(2,13)).toString(),GRP_COUNTER:new L(0,Math.pow(2,15)).toString()},H="c2c_text_message",K="c2c_custom_message",W="group_text_message",Y="group_custom_message",j="user_profile",z="group_profile",J="group_member_profile";V.HOST.setCurrent(G);var X="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),Z=X&&"function"==typeof wx.createGamePortal,Q="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),$="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),ee="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),te="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),ne="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,oe="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,se="undefined"!=typeof uni,ae=X||Q||$||ee||te||oe||ne,ie=("undefined"!=typeof uni||"undefined"!=typeof window)&&!ae,re=Q?qq:$?tt:ee?swan:te?my:X?wx:oe?uni:ne?jd:{},ue=ie&&window&&window.navigator&&window.navigator.userAgent||"",ce=/(micromessenger|webbrowser)/i.test(ue),le=/AppleWebKit\/([\d.]+)/i.exec(ue);le&&parseFloat(le.pop());var de,pe,ge=(de="WEB",ce?de="WEB":Q?de="QQ_MP":$?de="TT_MP":ee?de="BAIDU_MP":te?de="ALI_MP":X?de="WX_MP":oe&&(de="UNI_NATIVE_APP"),R[de]),he=/iPad/i.test(ue),_e=/iPhone/i.test(ue)&&!he,fe=/iPod/i.test(ue),ve=_e||he||fe,me=(pe=ue.match(/OS (\d+)_/i))&&pe[1]?pe[1]:null,Me=/Android/i.test(ue),ye=function(){var e=ue.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}();!function(){var e=ue.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Ie=/MSIE/.test(ue)||ue.indexOf("Trident")>-1&&ue.indexOf("rv:11.0")>-1,Ce=function(){var e=/MSIE\s(\d+)\.\d/.exec(ue),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(ue)&&/rv:11.0/.test(ue)&&(t=11),t}();!function(){var e=ue.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Te,De,ke=/Windows/i.test(ue),Ee=/MAC OS X/i.test(ue),Se=ie&&"undefined"!=typeof Worker&&!Ie,Le=Me||ve,Ae=ie&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy;Te="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};for(var Re=function(){},Ne=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],Oe=Ne.length;Oe--;)De=Ne[Oe],console[De]||(Te[De]=Re);var Ge=Te,Ue=0,Pe=function(){return(new Date).getTime()+Ue},be=function(){Ue=0},we=function(){return Math.floor(Pe()/1e3)},Fe=0;function qe(){return Kt()?"%c TIM %c":"TIM"}function xe(){var e,t=((e=new Date).setTime(Pe()),e);return t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(e){var t;switch(e.toString().length){case 1:t="00"+e;break;case 2:t="0"+e;break;default:t=e}return t}(t.getMilliseconds())}var Ve={arguments2String:function(e){var t="";if(1===e.length)t=e[0];else for(var n=0,o=e.length;n=0?o[a]=t[a]:o[a]=e(t[a])):o[a]=void 0:o[a]=null;return o};function Ct(e,t){if(!at(e)||!at(t))return!1;var n=!1;return t.forEach((function(t){var o=t.key,s=t.value,a=e.find((function(e){return e.key===o}));a?a.value!==s&&(a.value=s,n=!0):(e.push({key:o,value:s}),n=!0)})),n}var Tt=function(e){return e===E.GRP_AVCHATROOM},Dt=function(e){var t=e.type,n=e.groupID;return t===E.GRP_COMMUNITY||"".concat(n).startsWith(Je)&&!"".concat(n).includes(Xe)},kt=function(e){return"".concat(e).startsWith(Je)&&"".concat(e).includes(Xe)},Et=function(e){return nt(e)&&e.slice(0,3)===E.CONV_C2C},St=function(e){return nt(e)&&e.slice(0,5)===E.CONV_GROUP},Lt=function(e){return nt(e)&&e===E.CONV_SYSTEM};function At(e,t){var n={};return Object.keys(e).forEach((function(o){n[o]=t(e[o],o)})),n}function Rt(e){return ae?new Promise((function(t,n){re.getImageInfo({src:e,success:function(e){t({width:e.width,height:e.height})},fail:function(){t({width:0,height:0})}})})):Ie&&9===Ce?Promise.resolve({width:0,height:0}):new Promise((function(t,n){var o=new Image;o.onload=function(){t({width:this.width,height:this.height}),o=null},o.onerror=function(){t({width:0,height:0}),o=null},o.src=e}))}function Nt(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return"".concat(e()+e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e())}function Ot(){var e="unknown";if(Ee&&(e="mac"),ke&&(e="windows"),ve&&(e="ios"),Me&&(e="android"),ae)try{var t=re.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(n){}return e}function Gt(e,t){e=e.split("."),t=t.split(".");for(var n=Math.max(e.length,t.length);e.lengtha)return 1;if(s-1?"".concat(n,"&"):"".concat(n,"?");c.url="".concat(l,198===i?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")}return it(n)?(c.url,g(c,Ze)):c}function Pt(e){var t=e[2];e[2]=e[1],e[1]=t;for(var n=0;n=0;o--)"1"===e[o]&&t.push(Math.pow(2,n-o-1));return t}function Kt(){return!Ie&&!ae}function Wt(e){return"the length of userIDList cannot exceed ".concat(e)}function Yt(e,t){if(e){var n=e;return t&&(e.startsWith("http://")?n=e.replace(/^http:\/\/[^/]+/,t):e.startsWith("https://")&&(n=e.replace(/^https:\/\/[^/]+/,t))),n}}var jt=Object.prototype.hasOwnProperty;function zt(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(st(e)){for(var t in e)if(jt.call(e,t))return!1;return!0}return!(!Qe(e)&&(n=e,"set"!==lt(n))&&!$e(e))&&0===e.size;var n}function Jt(e,t,n){if(void 0===t)return!0;var o=!0;if(st(t))Object.keys(t).forEach((function(s){var a=1===e.length?e[0][s]:void 0;o=!!Xt(a,t[s],n,s)&&o}));else if(at(t))for(var s=0;s256)||(tn({api:"setConversationCustomData",param:"customData",desc:gn("customData",256)}),!1):(tn({api:"setConversationCustomData",param:"customData",desc:nn()}),!1)}}},markConversation:{conversationIDList:t({},Tn),markType:{type:"number",validator:function(e){return et(e)?e<=0?(tn({api:"markConversation",param:"markType",desc:(t="markType",n=0,Sn("NumberGreaterThanLog",t,n))}),!1):!(e>=Math.pow(2,64))||(tn({api:"markConversation",param:"markType",desc:hn("markType","Math.pow(2,64)")}),!1):(tn({api:"markConversation",param:"markType",desc:sn()}),!1);var t,n}},enableMark:t({},kn)},createConversationGroup:{conversationIDList:t({},Tn),groupName:t(t({},Cn),{},{validator:function(e){return!!e&&(!(e.length>32)||(tn({api:"createConversationGroup",param:"groupName",desc:gn("groupName",32)}),!1))}})},deleteConversationGroup:[t({name:"groupName"},Cn)],renameConversationGroup:{oldName:t({},Cn),newName:t(t({},Cn),{},{validator:function(e){return!!e&&(!(e.length>32)||(tn({api:"renameConversationGroup",param:"newName",desc:gn("newName",32)}),!1))}})},addConversationsToGroup:{conversationIDList:t({},Tn),groupName:t({},Cn)},deleteConversationsFromGroup:{conversationIDList:t({},Tn),groupName:t({},Cn)},getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:Cn,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:Tn},createGroup:{name:Cn},joinGroup:{groupID:Cn,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[t({name:"groupID"},Cn)],handleApplication:{message:Dn,handleAction:Cn,handleMessage:{type:"String"}},changeGroupOwner:{groupID:Cn,newOwnerID:Cn},updateGroupProfile:{groupID:Cn,muteAllMembers:{type:"Boolean"}},dismissGroup:[t({name:"groupID"},Cn)],searchGroupByID:[t({name:"groupID"},Cn)],initGroupAttributes:{groupID:Cn,groupAttributes:t(t({},Dn),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(n){if(!nt(e[n]))return tn({api:"initGroupAttributes",param:"groupAttributes",desc:_n("value")}),t=!1})),t}})},setGroupAttributes:{groupID:Cn,groupAttributes:t(t({},Dn),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(n){if(!nt(e[n]))return tn({api:"setGroupAttributes",param:"groupAttributes",desc:_n("value")}),t=!1})),t}})},deleteGroupAttributes:{groupID:Cn,keyList:{type:"Array",validator:function(e){if(it(e)||!at(e))return tn({api:"deleteGroupAttributes",param:"keyList",desc:cn()}),!1;if(!zt(e)){var t=!0;return e.forEach((function(e){if(!nt(e))return tn({api:"deleteGroupAttributes",param:"keyList",desc:Sn("StringArrayRequiredLog")}),t=!1})),t}return!0}}},getGroupAttributes:{groupID:Cn,keyList:{type:"Array",validator:function(e){if(it(e)||!at(e))return tn({api:"getGroupAttributes",param:"keyList",desc:cn()}),!1;if(!zt(e)){var t=!0;return e.forEach((function(e){if(!nt(e))return tn({api:"getGroupAttributes",param:"keyList",desc:_n("key")}),t=!1})),t}return!0}}},setGroupCounters:{groupID:Cn,counters:Dn},increaseGroupCounter:{groupID:Cn,key:Cn,value:En},decreaseGroupCounter:{groupID:Cn,key:Cn,value:En},getGroupCounters:{groupID:Cn},getGroupMemberList:{groupID:Cn,count:{type:"Number"}},getGroupMemberProfile:{groupID:Cn,userIDList:Tn,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:Cn,userIDList:Tn},setGroupMemberRole:{groupID:Cn,userID:Cn,role:Cn},setGroupMemberMuteTime:{groupID:Cn,userID:Cn,muteTime:{type:"Number",validator:function(e){return e>=0}}},setGroupMemberNameCard:{groupID:Cn,userID:{type:"String"},nameCard:{type:"String",validator:function(e){return nt(e)?(e.length,!0):(tn({api:"setGroupMemberNameCard",param:"nameCard",desc:nn()}),!1)}}},setGroupMemberCustomField:{groupID:Cn,userID:{type:"String"},memberCustomField:Tn},deleteGroupMember:{groupID:Cn},markGroupMemberList:{groupID:Cn,markType:{type:"number",validator:function(e){return et(e)?!(e<1e3)||(tn({api:"markGroupMemberList",param:"markType",desc:(t="markType",n=1e3,Sn("NumberGreaterOrEqualLog",t,n))}),!1):(tn({api:"markGroupMemberList",param:"markType",desc:sn()}),!1);var t,n}},userIDList:t({},Tn),enableMark:t({},kn)},createTextMessage:{to:Cn,conversationType:Cn,payload:t(t({},Dn),{},{validator:function(e){return st(e)?nt(e.text)?0!==e.text.length||(tn({api:"createTextMessage",param:"payload.text",desc:vn()}),!1):(tn({api:"createTextMessage",param:"payload.text",desc:nn()}),!1):(tn({api:"createTextMessage",param:"payload",desc:fn()}),!1)}})},createTextAtMessage:{to:Cn,conversationType:Cn,payload:t(t({},Dn),{},{validator:function(e){return st(e)?nt(e.text)?0===e.text.length?(tn({api:"createTextAtMessage",param:"payload.text",desc:vn()}),!1):!(e.atUserList&&!at(e.atUserList))||(tn({api:"createTextAtMessage",param:"payload.atUserList",desc:cn()}),!1):(tn({api:"createTextAtMessage",param:"payload.text",desc:nn()}),!1):(tn({api:"createTextAtMessage",param:"payload",desc:fn()}),!1)}})},createCustomMessage:{to:Cn,conversationType:Cn,payload:t(t({},Dn),{},{validator:function(e){return st(e)?e.data&&!nt(e.data)?(tn({api:"createCustomMessage",param:"payload.data",desc:nn()}),!1):e.description&&!nt(e.description)?(tn({api:"createCustomMessage",param:"payload.description",desc:nn()}),!1):!(e.extension&&!nt(e.extension))||(tn({api:"createCustomMessage",param:"payload.extension",desc:nn()}),!1):(tn({api:"createCustomMessage",param:"payload",desc:fn()}),!1)}})},createImageMessage:{to:Cn,conversationType:Cn,payload:t(t({},Dn),{},{validator:function(e){if(!st(e))return tn({api:"createImageMessage",param:"payload",desc:fn()}),!1;if(it(e.file))return tn({api:"createImageMessage",param:"payload.file",desc:an()}),!1;if(ie){if(!(e.file instanceof HTMLInputElement||$e(e.file)))return st(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(tn({api:"createImageMessage",param:"payload.file",desc:mn()}),!1):(tn({api:"createImageMessage",param:"payload.file",desc:rn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return tn({api:"createImageMessage",param:"payload.file",desc:mn()}),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e){return it(e)&&tn({api:"createImageMessage",param:"onProgress",desc:dn()}),!0}}})},createAudioMessage:{to:Cn,conversationType:Cn,payload:t(t({},Dn),{},{validator:function(e){return!!st(e)||(tn({api:"createAudioMessage",param:"payload",desc:fn()}),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e){return it(e)&&tn({api:"createAudioMessage",param:"onProgress",desc:dn()}),!0}}},createVideoMessage:{to:Cn,conversationType:Cn,payload:t(t({},Dn),{},{validator:function(e){if(!st(e))return tn({api:"createVideoMessage",param:"payload",desc:fn()}),!1;if(it(e.file))return tn({api:"createVideoMessage",param:"payload.file",desc:an()}),!1;if(ie){if(!(e.file instanceof HTMLInputElement||$e(e.file)))return st(e.file)&&"undefined"!=typeof uni?!!$e(e.file.tempFile)||(tn({api:"createVideoMessage",param:"payload.file",desc:mn()}),!1):(tn({api:"createVideoMessage",param:"payload.file",desc:rn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return tn({api:"createVideoMessage",param:"payload.file",desc:mn()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return it(e)&&tn({api:"createVideoMessage",param:"onProgress",desc:dn()}),!0}}},createFaceMessage:{to:Cn,conversationType:Cn,payload:t(t({},Dn),{},{validator:function(e){return st(e)?et(e.index)?!!nt(e.data)||(tn({api:"createFaceMessage",param:"payload.data",desc:nn()}),!1):(tn({api:"createFaceMessage",param:"payload.index",desc:sn()}),!1):(tn({api:"createFaceMessage",param:"payload",desc:fn()}),!1)}})},createFileMessage:{to:Cn,conversationType:Cn,payload:t(t({},Dn),{},{validator:function(e){if(!st(e))return tn({api:"createFileMessage",param:"payload",desc:fn()}),!1;if(it(e.file))return tn({api:"createFileMessage",param:"payload.file",desc:an()}),!1;if(ie){if(!(e.file instanceof HTMLInputElement||$e(e.file)))return st(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(tn({api:"createFileMessage",param:"payload.file",desc:mn()}),!1):(tn({api:"createFileMessage",param:"payload.file",desc:rn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return tn({api:"createFileMessage",param:"payload.file",desc:mn()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return it(e)&&tn({api:"createFileMessage",param:"onProgress",desc:dn()}),!0}}},createLocationMessage:{to:Cn,conversationType:Cn,payload:t(t({},Dn),{},{validator:function(e){return st(e)?nt(e.description)?et(e.longitude)?!!et(e.latitude)||(tn({api:"createLocationMessage",param:"payload.latitude",desc:sn()}),!1):(tn({api:"createLocationMessage",param:"payload.longitude",desc:sn()}),!1):(tn({api:"createLocationMessage",param:"payload.description",desc:nn()}),!1):(tn({api:"createLocationMessage",param:"payload",desc:fn()}),!1)}})},createMergerMessage:{to:Cn,conversationType:Cn,payload:t(t({},Dn),{},{validator:function(e){if(zt(e.messageList))return tn({api:"createMergerMessage",param:"payload.messageList",desc:ln()}),!1;if(zt(e.compatibleText))return tn({api:"createMergerMessage",param:"payload.compatibleText",desc:on("compatibleText")}),!1;var t=!1;return e.messageList.forEach((function(e){e.status===Qt.FAIL&&(t=!0)})),!t||(tn({api:"createMergerMessage",param:"payload.messageList",desc:Sn("MergeFailedMessageLog")}),!1)}})},revokeMessage:[t(t({name:"message"},Dn),{},{validator:function(e){return zt(e)?(tn({api:"revokeMessage",param:"message",desc:Mn()}),!1):e.conversationType===E.CONV_SYSTEM?(tn({api:"revokeMessage",param:"message",desc:Sn("MessageCanBeRevokedDesc")}),!1):!0!==e.isRevoked||(tn({api:"revokeMessage",param:"message",desc:Sn("MessageRevokedLog")}),!1)}})],deleteMessage:[t(t({name:"messageList"},Tn),{},{validator:function(e){return!zt(e)||(tn({api:"deleteMessage",param:"messageList",desc:ln()}),!1)}})],translateText:{sourceTextList:Tn,sourceLanguage:Cn,targetLanguage:Cn},modifyMessage:[t(t({name:"message"},Dn),{},{validator:function(e){return zt(e)?(tn({api:"modifyMessage",param:"message",desc:Mn()}),!1):e.conversationType===E.CONV_SYSTEM?(tn({api:"modifyMessage",param:"message",desc:Sn("MessageCanBeModifiedLog")}),!1):!0!==e._onlineOnlyFlag||(tn({api:"modifyMessage",param:"message",desc:Sn("OnlineMessageNotSupportLog")}),!1)}})],getUserProfile:{userIDList:{type:"Array",validator:function(e){return at(e)?(0===e.length&&tn({api:"getUserProfile",param:"userIDList",desc:ln()}),!0):(tn({api:"getUserProfile",param:"userIDList",desc:cn()}),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e){return!!it(e)||(!!at(e)||(tn({api:"updateMyProfile",param:"profileCustomField",desc:cn()}),!1))}}},setSelfStatus:{customStatus:{type:"String",validator:function(e){return!!nt(e)||(tn({api:"setSelfStatus",param:"customStatus",desc:nn()}),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(e){return at(e)?0!==e.length||(tn({api:"getUserStatus",param:"userIDList",desc:ln()}),!1):(tn({api:"getUserStatus",param:"userIDList",desc:cn()}),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return at(e)?0!==e.length||(tn({api:"subscribeUserStatus",param:"userIDList",desc:ln()}),!1):(tn({api:"subscribeUserStatus",param:"userIDList",desc:cn()}),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return!e||(!!at(e)||(tn({api:"subscribeUserStatus",param:"userIDList",desc:cn()}),!1))}}},addFriend:{to:Cn,source:{type:"String",required:!0,validator:function(e){return!!e&&(e.startsWith("AddSource_Type_")?!(e.replace("AddSource_Type_","").length>8)||(tn({api:"addFriend",param:"source",desc:gn("keyword",8)}),!1):(tn({api:"addFriend",param:"source",desc:Sn("SourcePrefixLog")}),!1))}},remark:{type:"String",required:!1,validator:function(e){return!(nt(e)&&e.length>96)||(tn({api:"addFriend",param:"remark",desc:gn("remark",96)}),!1)}}},deleteFriend:{userIDList:Tn},checkFriend:{userIDList:Tn},getFriendProfile:{userIDList:Tn},updateFriend:{userID:Cn,remark:{type:"String",required:!1,validator:function(e){return!(nt(e)&&e.length>96)||(tn({api:"updateFriend",param:"remark",desc:gn("remark",96)}),!1)}},friendCustomField:{type:"Array",required:!1,validator:function(e){if(e){if(!at(e))return tn({api:"updateFriend",param:"friendCustomField",desc:cn()}),!1;var t=!0;return e.forEach((function(e){return nt(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?nt(e.value)?e.key.replace("Tag_SNS_Custom_","").length>8?(tn({api:"updateFriend",param:"friendCustomField",desc:gn("keyword",8)}),t=!1):void 0:(tn({api:"updateFriend",param:"friendCustomField",desc:_n("value")}),t=!1):(tn({api:"updateFriend",param:"friendCustomField",desc:Sn("FriendCustomFieldPrefixLog")}),t=!1)})),t}return!0}}},acceptFriendApplication:{userID:Cn},refuseFriendApplication:{userID:Cn},deleteFriendApplication:{userID:Cn},createFriendGroup:{name:Cn},deleteFriendGroup:{name:Cn},addToFriendGroup:{name:Cn,userIDList:Tn},removeFromFriendGroup:{name:Cn,userIDList:Tn},renameFriendGroup:{oldName:Cn,newName:Cn},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(e){return at(e)?0!==e.length||(tn({api:"sendMessageReadReceipt",param:"messageList",desc:ln()}),!1):(tn({api:"sendMessageReadReceipt",param:"messageList",desc:cn()}),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(e){return at(e)?0!==e.length||(tn({api:"getMessageReadReceiptList",param:"messageList",desc:ln()}),!1):(tn({api:"getMessageReadReceiptList",param:"messageList",desc:cn()}),!1)}}],createTopicInCommunity:{groupID:Cn,topicName:Cn},deleteTopicFromCommunity:{groupID:Cn,topicIDList:{type:"Array",validator:function(e){return!e||(!!at(e)||(tn({api:"deleteTopicFromCommunity",param:"topicIDList",desc:cn()}),!1))}}},updateTopicProfile:{groupID:Cn,topicID:Cn},getTopicList:{groupID:Cn,topicIDList:{type:"Array",validator:function(e){return!e||(!!at(e)||(tn({api:"getTopicList",param:"topicIDList",desc:cn()}),!1))}}}},An={login:1,logout:1,on:1,once:1,off:1,setLogLevel:1,registerPlugin:1,destroy:1,createTextMessage:1,createTextAtMessage:1,createImageMessage:1,createAudioMessage:1,createVideoMessage:1,createCustomMessage:1,createFaceMessage:1,createFileMessage:1,createLocationMessage:1,createMergerMessage:1,downloadMergerMessage:1,createForwardMessage:1,sendMessage:1,resendMessage:1,revokeMessage:1,deleteMessage:1,translateText:1,modifyMessage:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageReadReceiptList:1,setMessageExtensions:1,getMessageExtensions:1,deleteMessageExtensions:1,getMessageList:1,findMessage:1,getMessageListHopping:1,setMessageRead:1,setAllMessageRead:1,getConversationList:1,getConversationProfile:1,deleteConversation:1,pinConversation:1,getTotalUnreadMessageCount:1,setConversationCustomData:1,markConversation:1,createConversationGroup:1,getConversationGroupList:1,deleteConversationGroup:1,renameConversationGroup:1,addConversationsToGroup:1,deleteConversationsFromGroup:1,clearHistoryMessage:1,getGroupList:1,getGroupProfile:1,createGroup:1,joinGroup:1,updateGroupProfile:1,quitGroup:1,dismissGroup:1,changeGroupOwner:1,searchGroupByID:1,setMessageRemindType:1,getGroupApplicationList:1,handleGroupApplication:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getJoinedCommunityList:1,createTopicInCommunity:1,deleteTopicFromCommunity:1,updateTopicProfile:1,getTopicList:1,getGroupMemberProfile:1,getGroupMemberList:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberNameCard:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberCustomField:1,getGroupOnlineMemberCount:1,markGroupMemberList:1,getMyProfile:1,getUserProfile:1,updateMyProfile:1,setSelfStatus:1,getUserStatus:1,subscribeUserStatus:1,unsubscribeUserStatus:1,getBlacklist:1,addToBlacklist:1,removeFromBlacklist:1,getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,updateFriend:1,getFriendProfile:1,getFriendApplicationList:1,refuseFriendApplication:1,deleteFriendApplication:1,acceptFriendApplication:1,setFriendApplicationRead:1,getFriendGroupList:1,createFriendGroup:1,renameFriendGroup:1,deleteFriendGroup:1,addToFriendGroup:1,removeFromFriendGroup:1,callExperimentalAPI:1},Rn=1,Nn=2,On=3,Gn=4,Un=6,Pn=7,bn=8,wn=9,Fn=10,qn=11,xn=12,Vn=13,Bn=14,Hn=15,Kn=16,Wn=17,Yn=18,jn=19,zn=20,Jn=21,Xn=22,Zn=23,Qn=24,$n=25,eo=26,to=27,no=28,oo=29,so=30,ao=31,io=32,ro=37,uo=function(){function e(t){o(this,e),this._m=t,this._n=""}return a(e,[{key:"isLoggedIn",value:function(){return this._m.getModule(xn).isLoggedIn()}},{key:"isOversea",value:function(){return this._m.getModule(xn).isOversea()}},{key:"isPrivateNetWork",value:function(){return this._m.getModule(xn).isPrivateNetWork()}},{key:"getFileDownloadProxy",value:function(){return this._m.getModule(xn).getFileDownloadProxy()}},{key:"getMyUserID",value:function(){return this._m.getModule(xn).getUserID()}},{key:"getMyTinyID",value:function(){return this._m.getModule(xn).getTinyID()}},{key:"getSDKAppID",value:function(){return this._m.getModule(xn).getSDKAppID()}},{key:"isIntl",value:function(){return this._m.getModule(xn).isIntl()}},{key:"isDevMode",value:function(){return this._m.getModule(xn).isDevMode()}},{key:"getModule",value:function(e){return this._m.getModule(e)}},{key:"getPlatform",value:function(){return ge}},{key:"getNetworkType",value:function(){return this._m.getModule(Hn).getNetworkType()}},{key:"probeNetwork",value:function(e){return this._m.getModule(Hn).probe(e)}},{key:"getCloudConfig",value:function(e){return this._m.getModule(Zn).getCloudConfig(e)}},{key:"emitOuterEvent",value:function(e,t){this._m.getOuterEmitterInstance().emit(e,t)}},{key:"emitInnerEvent",value:function(e,t){this._m.getInnerEmitterInstance().emit(e,t)}},{key:"getInnerEmitterInstance",value:function(){return this._m.getInnerEmitterInstance()}},{key:"generateTjgID",value:function(e){return this._m.getModule(xn).getTinyID()+"-"+e.random}},{key:"filterModifiedMessage",value:function(e){if(!zt(e)){var t=e.filter((function(e){return!0===e.isModified}));t.length>0&&this.emitOuterEvent(k.MESSAGE_MODIFIED,t)}}},{key:"filterUnmodifiedMessage",value:function(e){return zt(e)?[]:e.filter((function(e){return!1===e.isModified}))}},{key:"request",value:function(e){return this._m.getModule(zn).request(e)}},{key:"canIUse",value:function(e){return this._m.getModule(to).canIUse(e)}},{key:"getErrorMessage",value:function(e,t,n){return this._m.getErrorMessage(e,t,n)}},{key:"outputWarning",value:function(e,t,n){var o=this.getErrorMessage(e,t,n);o&&Ve.w(o)}}]),e}(),co="wslogin",lo="wslogout",po="wshello",go="KickOther",ho="getmsg",_o="authkey",fo="sendmsg",vo="send_group_msg",mo="portrait_get_all",Mo="portrait_set",yo="black_list_get",Io="black_list_add",Co="black_list_delete",To="msgwithdraw",Do="msgreaded",ko="set_c2c_peer_mute_notifications",Eo="get_c2c_peer_mute_notifications",So="getroammsg",Lo="get_peer_read_time",Ao="delete_c2c_msg_ramble",Ro="modify_c2c_msg",No="set_key_values",Oo="get_key_values",Go="page_get",Uo="get",Po="batch_delete",bo="clear_msg",wo="top",Fo="deletemsg",qo="set_conv_custom_data",xo="mark_contact",Vo="create_contact_group",Bo="del_contact_group",Ho="update_contact_group",Ko="add_conv_to_group",Wo="del_conv_from_group",Yo="get_contact_group",jo="get_joined_group_list",zo="get_group_self_member_info",Jo="create_group",Xo="destroy_group",Zo="modify_group_base_info",Qo="apply_join_group",$o="apply_join_group_noauth",es="quit_group",ts="get_group_public_info",ns="change_group_owner",os="handle_apply_join_group",ss="handle_invite_join_permission_group",as="handle_invite_join_group",is="group_msg_recall",rs="msg_read_report",us="read_all_unread_msg",cs="group_msg_get",ls="get_group_msg_receipt",ds="group_msg_receipt",ps="c2c_msg_read_receipt",gs="get_group_msg_receipt_detail",hs="get_pendency",_s="deletemsg",fs="get_msg",vs="get_msg_noauth",ms="get_online_member_num",Ms="delete_group_ramble_msg_by_seq",ys="modify_group_msg",Is="set_group_attr",Cs="modify_group_attr",Ts="delete_group_attr",Ds="clear_group_attr",ks="get_group_attr",Es="group_set_key_values",Ss="group_get_key_values",Ls="get_group_notify",As="update_group_counter",Rs="get_group_counter",Ns="get_group_member_info",Os="get_members",Gs="get_specified_group_member_info",Us="add_group_member",Ps="delete_group_member",bs="ban_group_member",ws="modify_group_member_info",Fs="modify_user_info",qs="cos",xs="pre_sig",Vs="video_cover",Bs="tim_web_report_v2",Hs="alive",Ks="msg_push",Ws="multi_msg_push_ws",Ys="ws_msg_push_ack",js="stat_forceoffline",zs="save_relay_json_msg",Js="get_relay_json_msg",Xs="fetch_config",Zs="push_configv2",Qs="fetch_imsdk_purchase_bitsv2",$s="push_imsdk_purchase_bitsv2",ea="notify2",ta="create_topic",na="destroy_topic",oa="modify_topic",sa="get_topic",aa="ws_set_custom_status",ia="ws_get_user_status",ra="ws_status_subscribe",ua="ws_status_unsubscribe",ca="ws_stat_background",la="ws_stat_foreground",da="ws_stat_settoken",pa="get_local_words",ga="ws_batch_trans_text",ha={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,COS_UNDETECTED:2040,COS_GET_SIG_FAIL:2041,MESSAGE_SEND_FAIL:2100,MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM:2101,MESSAGE_SEND_NEED_MESSAGE_INSTANCE:2105,MESSAGE_SEND_INVALID_CONVERSATION_TYPE:2106,MESSAGE_FILE_IS_EMPTY:2108,MESSAGE_ONPROGRESS_FUNCTION_ERROR:2109,MESSAGE_REVOKE_FAIL:2110,MESSAGE_DELETE_FAIL:2111,MESSAGE_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MESSAGE_LIST_EMPTY:2114,MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GROUP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,MESSAGE_IMAGE_SELECT_FILE_FIRST:2251,MESSAGE_IMAGE_TYPES_LIMIT:2252,MESSAGE_IMAGE_SIZE_LIMIT:2253,MESSAGE_AUDIO_UPLOAD_FAIL:2300,MESSAGE_AUDIO_SIZE_LIMIT:2301,MESSAGE_VIDEO_UPLOAD_FAIL:2350,MESSAGE_VIDEO_SIZE_LIMIT:2351,MESSAGE_VIDEO_TYPES_LIMIT:2352,MESSAGE_FILE_UPLOAD_FAIL:2400,MESSAGE_FILE_SELECT_FILE_FIRST:2401,MESSAGE_FILE_SIZE_LIMIT:2402,MESSAGE_FILE_URL_IS_EMPTY:2403,MESSAGE_MERGER_TYPE_INVALID:2450,MESSAGE_MERGER_KEY_INVALID:2451,MESSAGE_MERGER_DOWNLOAD_FAIL:2452,MESSAGE_FORWARD_TYPE_INVALID:2453,MESSAGE_MODIFY_CONFLICT:2480,MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM:2481,CONVERSATION_NOT_FOUND:2500,USER_OR_GROUP_NOT_FOUND:2501,CONVERSATION_UN_RECORDED_TYPE:2502,INVALID_CONVERSATION_ID:2503,ILLEGAL_GROUP_TYPE:2600,CANNOT_JOIN_WORK:2601,ILLEGAL_GROUP_ID:2602,CANNOT_FIND_GROUP:2603,CANNOT_CHANGE_OWNER_IN_AVCHATROOM:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,CANNOT_DISMISS_WORK:2622,MEMBER_NOT_IN_GROUP:2623,JOIN_GROUP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AVCHATROOM:2661,CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:2662,NOT_OWNER:2681,CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:2682,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GROUP_EXISTED:2710,FRIEND_GROUP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,CANNOT_ADD_SELF_TO_BLACKLIST:2742,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,INVALID_TRTC_CMD:2995,OVER_FREQUENCY_LIMIT:2996,CANNOT_FIND_PROTOCOL:2997,CANNOT_FIND_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,CANNOT_USE_COMMERCIAL_ABILITY:3122,PROFANITY_FOUND:3123,MESSAGE_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022},_a="networkRTT",fa="messageE2EDelay",va="sendMessageC2C",ma="sendMessageGroup",Ma="sendMessageGroupAV",ya="sendMessageRichMedia",Ia="cosUpload",Ca="messageReceivedGroup",Ta="messageReceivedGroupAVPush",Da="messageReceivedGroupAVPull",ka=(i(Zt={},_a,2),i(Zt,fa,3),i(Zt,va,4),i(Zt,ma,5),i(Zt,Ma,6),i(Zt,ya,7),i(Zt,Ca,8),i(Zt,Ta,9),i(Zt,Da,10),i(Zt,Ia,11),Zt),Ea={info:4,warning:5,error:6},Sa={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},La={login:4},Aa=function(){function e(t){o(this,e),this._n="SSOLogData",this.eventType=La[t]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=t,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=Pe()}return a(e,[{key:"updateTimeStamp",value:function(){this.timestamp=Pe()}},{key:"start",value:function(e){return this._startts=e,this}},{key:"end",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._sentFlag){var n=Pe();0===this.costTime&&(this.costTime=n-this._startts),this.setMoreMessage("startts:".concat(this._startts," endts:").concat(n)),t?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout((function(){e._sentFlag=!0,e._eventStatModule&&e._eventStatModule.pushIn(e)}),0)}}},{key:"setError",value:function(e,t,n){if(!(e instanceof Error))return Ve.w("".concat(this._n,".setError value not instanceof Error, please check!")),this;if(this._sentFlag)return this;if(this.setNetworkType(n),t)e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message);else{var o=ha.NO_NETWORK;this.setCode(o)}return this.setLevel("error"),this}},{key:"setCode",value:function(e){return it(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),et(e)?this.code=e:Ve.w("".concat(this._n,".setCode value not a number, please check!"),e,n(e))),this}},{key:"setMessage",value:function(e){return it(e)||this._sentFlag||(et(e)&&(this.message=e.toString()),nt(e)&&(this.message=e)),this}},{key:"setCostTime",value:function(e){return this.costTime=e,this}},{key:"setLevel",value:function(e){return it(e)||this._sentFlag||(this.level=Ea[e]),this}},{key:"setMoreMessage",value:function(e){return zt(this.moreMessage)?this.moreMessage="".concat(e):this.moreMessage+=" ".concat(e),this}},{key:"setNetworkType",value:function(e){if(it(e))Ve.w("".concat(this._n,".setNetworkType value is undefined, please check!"));else{var t=Sa[e.toLowerCase()];it(t)||(this.networkType=t)}return this}},{key:"getStartTs",value:function(){return this._startts}},{key:"setUIPlatform",value:function(e){this.uiPlatform=e}}],[{key:"bindEventStatModule",value:function(t){e.prototype._eventStatModule=t}}]),e}(),Ra=function(){function e(t){o(this,e),this.type=E.MSG_TEXT,this.content={text:t.text||""}}return a(e,[{key:"setText",value:function(e){this.content.text=e}},{key:"sendable",value:function(){return 0!==this.content.text.length}}]),e}(),Na=function(){function e(t,n){o(this,e),this._imageMemoryURL="",this._fileDownloadProxy=n,ae?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=E.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||Be.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._autoFixUrl()}return a(e,[{key:"_initImageInfoModel",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=_t(9999999),this.sizeType=t.type||0,this.type=0,this.size=t.size||0,this.width=t.width||0,this.height=t.height||0,this.imageUrl=t.url||"",this.url=Yt(t.url||e._imageMemoryURL,e._fileDownloadProxy)},this._ImageInfoModel.prototype={setSizeType:function(e){this.sizeType=e},setType:function(e){this.type=e},setImageUrl:function(e){e&&(this.imageUrl=e)},getImageUrl:function(){return this.imageUrl}}}},{key:"initImageInfoArray",value:function(e){for(var t=0,n=null,o=null;t<=2;)o=it(e)||it(e[t])?{type:0,size:0,width:0,height:0,url:""}:e[t],(n=new this._ImageInfoModel(o)).setSizeType(t+1),n.setType(t),this.addImageInfo(n),t++;this.updateAccessSideImageInfoArray()}},{key:"updateImageInfoArray",value:function(e){for(var t,n=this.content.imageInfoArray.length,o=0;o1&&(this._percent=1)}},{key:"updateImageFormat",value:function(e){this.content.imageFormat=Be[e.toUpperCase()]||Be.UNKNOWN}},{key:"createImageDataASURLInWeb",value:function(e){void 0!==e&&e.files.length>0&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:"createImageDataASURLInWXMiniApp",value:function(e){e&&e.url&&(this._imageMemoryURL=e.url)}},{key:"replaceImageInfo",value:function(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}},{key:"addImageInfo",value:function(e){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(e)}},{key:"updateAccessSideImageInfoArray",value:function(){var e=this.content.imageInfoArray,t=e[0],n=t.width,o=void 0===n?0:n,s=t.height,a=void 0===s?0:s;0!==o&&0!==a&&(Pt(e),Object.assign(e[2],Ut({originWidth:o,originHeight:a,min:720})))}},{key:"sendable",value:function(){return 0!==this.content.imageInfoArray.length&&(""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size)}}]),e}(),Oa=function(){function e(t){o(this,e),this.type=E.MSG_FACE,this.content=t||null}return a(e,[{key:"sendable",value:function(){return null!==this.content}}]),e}(),Ga=function(){function e(t,n){o(this,e),this.type=E.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:t.second,size:t.size,url:Yt(t.url,n),remoteAudioUrl:t.url||"",uuid:t.uuid}}return a(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateAudioUrl",value:function(e){this.content.remoteAudioUrl=e}},{key:"sendable",value:function(){return""!==this.content.remoteAudioUrl}}]),e}(),Ua={from:!0,groupID:!0,groupName:!0,to:!0},Pa=function(){function e(t){o(this,e),this.type=E.MSG_GRP_TIP,this.content={},this._initContent(t)}return a(e,[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"remarkInfo":break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[n]);break;case"operatorInfo":break;case"memberInfoList":case"msgMemberInfo":t._updateMemberList(e[n]);break;case"memberExtraInfo":case"onlineMemberInfo":break;case"memberNum":t.content[n]=e[n],t.content.memberCount=e[n];break;case"newGroupProfile":t.content.newGroupProfile={},t._initNewGroupProfile(e[n]);break;default:t.content[n]=e[n]}})),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n1&&(this._percent=1)}},{key:"updateFileUrl",value:function(e){this.content.fileUrl=e}},{key:"sendable",value:function(){return""!==this.content.fileUrl&&(""!==this.content.fileName&&0!==this.content.fileSize)}}]),e}(),qa=function(){function e(t){o(this,e),this.type=E.MSG_CUSTOM,this.content={data:t.data||"",description:t.description||"",extension:t.extension||""}}return a(e,[{key:"setData",value:function(e){return this.content.data=e,this}},{key:"setDescription",value:function(e){return this.content.description=e,this}},{key:"setExtension",value:function(e){return this.content.extension=e,this}},{key:"sendable",value:function(){return 0!==this.content.data.length||0!==this.content.description.length||0!==this.content.extension.length}}]),e}(),xa=function(){function e(t,n){o(this,e),this.type=E.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:t.remoteVideoUrl||t.videoUrl||"",videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:Yt(t.videoUrl,n),videoDownloadFlag:2,videoUUID:t.videoUUID,thumbUUID:t.thumbUUID,thumbFormat:t.thumbFormat,thumbWidth:t.thumbWidth,snapshotWidth:t.thumbWidth,thumbHeight:t.thumbHeight,snapshotHeight:t.thumbHeight,thumbSize:t.thumbSize,snapshotSize:t.thumbSize,thumbDownloadFlag:2,thumbUrl:Yt(t.thumbUrl,n),snapshotUrl:Yt(t.thumbUrl,n)}}return a(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateVideoUrl",value:function(e){e&&(this.content.remoteVideoUrl=e)}},{key:"updateSnapshotInfo",value:function(e){var t=e.snapshotUrl,n=e.snapshotWidth,o=e.snapshotHeight;zt(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),zt(n)||(this.content.thumbWidth=this.content.snapshotWidth=Number(n)),zt(o)||(this.content.thumbHeight=this.content.snapshotHeight=Number(o))}},{key:"sendable",value:function(){return""!==this.content.remoteVideoUrl}}]),e}(),Va=function(){function e(t){o(this,e),this.type=E.MSG_LOCATION;var n=t.description,s=t.longitude,a=t.latitude;this.content={description:n,longitude:s,latitude:a}}return a(e,[{key:"sendable",value:function(){return!0}}]),e}(),Ba=function(){function e(t,n){if(o(this,e),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||"",this.clientTime=t.clientTime||void 0,t.ID)this.ID=t.ID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType.startsWith(E.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(E.CONV_GROUP)&&(this.receiverGroupID=t.to),this.messageReceiver=t.to;else{this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[];var s=t.elements[0].type,a=t.elements[0].content;this._patchRichMediaPayload(s,a),this._updateRichMediaDownloadUrl(s,a,n),s===E.MSG_MERGER?this.messageBody.push({type:s,payload:new Ha(a).content}):this.messageBody.push({type:s,payload:a}),t.groupID&&(this.receiverGroupID=t.groupID,this.messageReceiver=t.groupID),t.to&&(this.receiverUserID=t.to,this.messageReceiver=t.to),this.ID="".concat(t.tinyID,"-").concat(t.clientTime,"-").concat(t.random)}}return a(e,[{key:"_patchRichMediaPayload",value:function(e,t){e===E.MSG_IMAGE?t.imageInfoArray.forEach((function(e){!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,1===e.type?e.type=0:3===e.type&&(e.type=1))})):e===E.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===E.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===E.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}},{key:"_updateRichMediaDownloadUrl",value:function(e,t,n){n&&(e===E.MSG_IMAGE?t.imageInfoArray.forEach((function(e){e.url=Yt(e.url,n)})):e===E.MSG_VIDEO?(t.videoUrl=Yt(t.videoUrl,n),t.snapshotUrl=Yt(t.thumbUrl,n),t.snapshotHeight=t.thumbHeight,t.snapshotWidth=t.thumbWidth):e===E.MSG_AUDIO?t.url=Yt(t.url,n):e===E.MSG_FILE&&(t.fileUrl=Yt(t.fileUrl,n)))}}]),e}(),Ha=function(){function e(t,n){if(o(this,e),this.type=E.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},t.downloadKey){var s=t.downloadKey,a=t.pbDownloadKey,i=t.title,r=t.abstractList,u=t.compatibleText,c=t.version;this.content.downloadKey=s,this.content.pbDownloadKey=a,this.content.title=i,this.content.abstractList=r,this.content.compatibleText=u,this.content.version=c||0}else if(zt(t.messageList))1===t.layersOverLimit&&(this.content.layersOverLimit=!0);else{var l=t.messageList,d=t.title,p=t.abstractList,g=t.compatibleText,h=t.version,_=[];l.forEach((function(e){if(!zt(e)){var t=new Ba(e,n);_.push(t)}})),this.content.messageList=_,this.content.title=d,this.content.abstractList=p,this.content.compatibleText=g,this.content.version=h||0}}return a(e,[{key:"sendable",value:function(){return!zt(this.content.messageList)||!zt(this.content.downloadKey)}}]),e}(),Ka={1:E.MSG_PRIORITY_HIGH,2:E.MSG_PRIORITY_NORMAL,3:E.MSG_PRIORITY_LOW,4:E.MSG_PRIORITY_LOWEST},Wa=function(){function e(t){o(this,e),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||E.CONV_C2C,this.conversationSubType=t.conversationSubType,this.time=t.time||Math.ceil(Date.now()/1e3),this.sequence=t.sequence||0,this.clientSequence=t.clientSequence||t.sequence||0,this.random=t.random||0===t.random?t.random:_t(),this.priority=this._computePriority(t.priority),this.nick=t.nick||"",this.avatar=t.avatar||"",this.isPeerRead=!1,this.nameCard="",this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=2===t.isPlaceMessage||8===t.msgFlagBits,this.from=t.from||null,this.to=t.to||null,this.flow="",this.isSystemMessage=t.isSystemMessage||!1,this.protocol=t.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=t.status||Qt.SUCCESS,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=t.cloudCustomData||"",this.isDeleted=!1,this.isModified=!1,this._isExcludedFromUnreadCount=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromLastMessage),this.clientTime=t.clientTime||we()||0,this.senderTinyID=t.senderTinyID||t.tinyID||"",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0},this.needReadReceipt=!0===t.needReadReceipt||1===t.needReadReceipt,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this._receiverList=t.receiverList||void 0,this.isSupportExtension=!0===t.isSupportExtension||1===t.isSupportExtension,this.revoker=t.revokerInfo&&t.revokerInfo.revoker||null,this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t),this.initC2CReadReceiptInfo(t.readReceiptSentByPeer)}return a(e,[{key:"elements",get:function(){return this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){if(null!==e){nt(e.nick)&&(this.nick=e.nick),nt(e.avatar)&&(this.avatar=e.avatar);var t=e.messageFromAccountExtraInformation;st(t)&&nt(t.nameCard)&&(this.nameCard=t.nameCard)}}},{key:"handleGroupAtInfo",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach((function(e){e!==E.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(E.MSG_AT_ALL))})),at(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(E.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(e){e&&(this.status=this.from?Qt.SUCCESS:Qt.UNSEND,!this.from&&(this.from=e)),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}},{key:"isSendable",value:function(){return 0!==this._elements.length&&("function"==typeof this._elements[0].sendable&&this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===E.CONV_GROUP&&(this.to=e.groupID)}},{key:"_initSequence",value:function(e){0===this.clientSequence&&e&&(this.clientSequence=function(e){if(!e)return!1;if(void 0===Mt[e]){var t=new Date,n="3".concat(t.getHours()).slice(-2),o="0".concat(t.getMinutes()).slice(-2),s="0".concat(t.getSeconds()).slice(-2);Mt[e]=parseInt([n,o,s,"0001"].join("")),n=null,o=null,s=null,Ve.l("autoIncrementIndex start index:".concat(Mt[e]))}return Mt[e]++}(e)),0===this.sequence&&this.conversationType===E.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===E.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID="".concat(this.senderTinyID,"-").concat(this.clientTime,"-").concat(this.random)}},{key:"_initFlow",value:function(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}},{key:"_concatConversationID",value:function(e){var t=this.to,n="",o=this.conversationType;o!==E.CONV_SYSTEM?(n=o===E.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID=n?"".concat(o).concat(n):null):this.conversationID=E.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof Ra||e instanceof Na||e instanceof Oa||e instanceof Ga||e instanceof Fa||e instanceof xa||e instanceof Pa||e instanceof wa||e instanceof qa||e instanceof Va||e instanceof Ha}},{key:"setElement",value:function(e,t){var n=this;if(this.isElement(e))return this._elements=[e],void this._initProxy();var o=function(e){if(e.type&&e.content)switch(e.type){case E.MSG_TEXT:n.setTextElement(e.content);break;case E.MSG_IMAGE:n.setImageElement(e.content,t);break;case E.MSG_AUDIO:n.setAudioElement(e.content,t);break;case E.MSG_FILE:n.setFileElement(e.content,t);break;case E.MSG_VIDEO:n.setVideoElement(e.content,t);break;case E.MSG_CUSTOM:n.setCustomElement(e.content);break;case E.MSG_LOCATION:n.setLocationElement(e.content);break;case E.MSG_GRP_TIP:n.setGroupTipElement(e.content);break;case E.MSG_GRP_SYS_NOTICE:n.setGroupSystemNoticeElement(e.content);break;case E.MSG_FACE:n.setFaceElement(e.content);break;case E.MSG_MERGER:n.setMergerElement(e.content,t)}};if(at(e))for(var s=0;s1&&void 0!==arguments[1]&&arguments[1];if(e instanceof ja)return t&&null!==za&&za.emit(k.ERROR,e),Promise.reject(e);if(e instanceof Error){var n=new ja({code:ha.UNCAUGHT_ERROR});return t&&null!==za&&za.emit(k.ERROR,n),Promise.reject(n)}if(!it(e)&&!it(e.code)){var o=new ja(e);return t&&null!==za&&za.emit(k.ERROR,o),Promise.reject(o)}},Qa=function(e){r(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="C2CModule",t._messageFromUnreadDBMap=new Map,t._signalingFromUnreadDBList=[],t}return a(s,[{key:"onNewC2CMessage",value:function(e){var t=e.dataList,n=e.isInstantMessage,o=e.C2CRemainingUnreadList,s=e.C2CPairUnreadList;Ve.d("".concat(this._n,".onNewC2CMessage count:").concat(t.length," isInstantMessage:").concat(n));var a=this._newC2CMessageStoredAndSummary({dataList:t,C2CRemainingUnreadList:o,C2CPairUnreadList:s,isInstantMessage:n}),i=a.conversationOptionsList,r=a.messageList,u=a.isUnreadC2CMessage;(this.filterModifiedMessage(r),i.length>0)&&this.getModule(qn).onNewMessage({conversationOptionsList:i,isInstantMessage:n,isUnreadC2CMessage:u});var c=this.filterUnmodifiedMessage(r);n&&c.length>0&&this.emitOuterEvent(k.MESSAGE_RECEIVED,c),r.length=0}},{key:"_newC2CMessageStoredAndSummary",value:function(e){for(var t=e.dataList,n=e.C2CRemainingUnreadList,o=e.C2CPairUnreadList,s=e.isInstantMessage,a=null,i=[],r=[],u={},c=this.getModule(Kn),l=this.getModule(eo),d=!1,p=this.getModule(qn),g=this.getFileDownloadProxy(),h=0,_=t.length;h<_;h++)if(this._isSignaling(t[h]))this._signalingFromUnreadDBList.push(t[h].eventArray[0].c2CNotifyMsgArray[0]);else{var f=t[h];f.currentUser=this.getMyUserID(),f.conversationType=E.CONV_C2C,f.isSystemMessage=!!f.isSystemMessage,(it(f.nick)||it(f.avatar))&&(d=!0,Ve.d("".concat(this._n,"._newC2CMessageStoredAndSummary nick or avatar missing!"))),a=new Wa(f),f.elements=c.parseElements(f.elements,f.from),a.setElement(f.elements,g),a.setNickAndAvatar({nick:f.nick,avatar:f.avatar});var v=a.conversationID;if(s){if(1===this._messageFromUnreadDBMap.get(a.ID))continue;var m=!1;if(a.from!==this.getMyUserID()){var M=p.getLatestMessageSentByPeer(v);if(M){var y=M.nick,I=M.avatar;d?a.setNickAndAvatar({nick:y,avatar:I}):y===a.nick&&I===a.avatar||(m=!0)}}else{var C=p.getLatestMessageSentByMe(v);if(C){var T=C.nick,D=C.avatar;T===a.nick&&D===a.avatar||p.modifyMessageSentByMe({conversationID:v,latestNick:a.nick,latestAvatar:a.avatar})}}var k=1===t[h].isModified;if(p.isMessageSentByCurrentInstance(a)?a.isModified=k:k=!1,0===f.msgLifeTime)a._onlineOnlyFlag=!0,p.isMessageSentByCurrentInstance(a)||r.push(a);else{if(!p.pushIntoMessageList(r,a,k))continue;m&&(p.modifyMessageSentByPeer({conversationID:v,latestNick:a.nick,latestAvatar:a.avatar}),p.updateUserProfileSpecifiedKey({conversationID:v,nick:a.nick,avatar:a.avatar}))}s&&a.clientTime>0&&l.addMessageDelay(a.clientTime)}else this._messageFromUnreadDBMap.set(a.ID,1);if(0!==f.msgLifeTime){if(!1===a._onlineOnlyFlag){var S=p.getLastMessageTime(v);if(et(S)&&a.time0){R=!0;var n=i.find((function(t){return t.conversationID==="C2C".concat(o[e].from)}));n?n.unreadCount=o[e].unreadCount:i.push({conversationID:"C2C".concat(o[e].from),unreadCount:o[e].unreadCount,type:E.CONV_C2C})}},O=0,G=o.length;O0&&(o=e.cloudCustomData);var s=[];if(st(t)&&st(t.messageControlInfo)){var a=t.messageControlInfo,i=a.excludedFromUnreadCount,r=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===i&&s.push("NoUnread"),!0===r&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c=this.isOnlineMessage(e,t)?0:void 0;return{protocolName:fo,tjgID:this.generateTjgID(e),requestData:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:e.getElements(),cloudCustomData:o,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:c,nick:e.nick,avatar:e.avatar,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(n)},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:0!==c?s:void 0,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0,isSupportExtension:!0===e.isSupportExtension?1:0}}}},{key:"_isVoipPush",value:function(e){var t=void 0;return it(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:"isOnlineMessage",value:function(e,t){return!(!t||!0!==t.onlineUserOnly)}},{key:"revokeMessage",value:function(e){return this.request({protocolName:To,requestData:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}},{key:"deleteMessage",value:function(e){var t=e.to,n=e.keyList;return Ve.l("".concat(this._n,".deleteMessage toAccount:").concat(t," count:").concat(n.length)),this.request({protocolName:Ao,requestData:{fromAccount:this.getMyUserID(),to:t,keyList:n}})}},{key:"modifyRemoteMessage",value:function(e){var t=e.from,n=e.to,o=e.version,s=void 0===o?0:o,a=e.sequence,i=e.random,r=e.time,u=e.payload,c=e.type,l=e.cloudCustomData,d=void 0;return Bt(c)&&(d=[]).push({type:c,content:u}),this.request({protocolName:Ro,requestData:{from:t,to:n,version:s,sequence:a,random:i,time:r,elements:d,cloudCustomData:l}})}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,o=e.lastMessageTime,s="".concat(this._n,".setMessageRead");Ve.l("".concat(s," conversationID:").concat(n," lastMessageTime:").concat(o)),et(o)||this.outputWarning("DoNotModifyLastTime");var a=new Aa("setC2CMessageRead");return a.setMessage("conversationID:".concat(n," lastMessageTime:").concat(o)),this.request({protocolName:Do,requestData:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:n.replace("C2C",""),lastMessageTime:o,receipt:1}]}}}).then((function(){a.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(s," ok"));var e=t.getModule(qn);return e.updateIsReadAfterReadReport({conversationID:n,lastMessageTime:o}),e.updateUnreadCount(n),Ya()})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.l("".concat(s," failed. error:"),e),Za(e)}))}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessage"),o=e.peerAccount,s=e.conversationID,a=e.count,i=e.lastMessageTime,r=e.messageKey,u="peerAccount:".concat(o," count:").concat(a||15," lastMessageTime:").concat(i||0," messageKey:").concat(r);Ve.l("".concat(n," ").concat(u));var c=new Aa("getC2CRoamingMessages");return this.request({protocolName:So,requestData:{peerAccount:o,count:a||15,lastMessageTime:i||0,messageKey:r}}).then((function(e){var o=e.data,a=o.complete,i=o.messageList,r=o.messageKey,l=o.lastMessageTime;it(i)?Ve.l("".concat(n," ok. complete:").concat(a," but messageList is undefined!")):Ve.l("".concat(n," ok. complete:").concat(a," count:").concat(i.length)),c.setNetworkType(t.getNetworkType()).setMessage("".concat(u," complete:").concat(a," length:").concat(i.length)).end();var d=t.getModule(qn);1===a&&d.setCompleted(s);var p=d.onRoamingMessage(i,s);d.modifyMessageList(s),d.updateIsRead(s),d.updateRoamingMessageKeyAndTime(s,r,l);var g=d.getPeerReadTime(s);if(Ve.l("".concat(n," update isPeerRead property. conversationID:").concat(s," peerReadTime:").concat(g)),g)d.updateMessageIsPeerReadProperty(s,g);else{var h=s.replace(E.CONV_C2C,"");t.getRemotePeerReadTime([h]).then((function(){d.updateMessageIsPeerReadProperty(s,d.getPeerReadTime(s))}))}var _="";if(p.length>0)_=p[0].ID;else{var f=d.getLocalOldestMessage(s);f&&(_=f.ID)}return Ve.l("".concat(n," nextReqID:").concat(_," stored message count:").concat(p.length)),{nextReqID:_,storedMessageList:p}})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setMessage(u).setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),Za(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessagesHopping"),o=e.peerAccount,s=e.time,a=void 0===s?0:s,i=e.count,r=e.direction,u="".concat(E.CONV_C2C).concat(o),c="peerAccount:".concat(o," count:").concat(i," time:").concat(a," direction:").concat(r);Ve.l("".concat(n," ").concat(c));var l=new Aa("getC2CRoamingMessagesHopping");return this.request({protocolName:So,requestData:{peerAccount:o,count:i+1,lastMessageTime:a,direction:r}}).then((function(e){var o=e.data,s=o.complete,a=o.messageList,i=void 0===a?[]:a,d=o.lastMessageTime;Ve.l("".concat(n," ok. complete:").concat(s," count:").concat(i.length)),l.setNetworkType(t.getNetworkType()).setMessage("".concat(c," complete:").concat(s," length:").concat(i.length)).end(),1!==s&&(1===r?i.pop():i.shift());var p=t.getModule(qn).onRoamingMessage(i,u,!1);t._modifyMessageList(u,p);var g=t._computeResult({complete:s,lastMessageTime:d,resultList:p});return Ya(g)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setMessage(c).setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),Za(e)}))}},{key:"_computeResult",value:function(e){var t=e.complete,n=void 0===t?0:t,o=e.lastMessageTime,s=e.resultList,a={messageList:m(void 0===s?[]:s),isCompleted:!1,nextMessageTime:""};return 1===n?(a.isCompleted=!0,a):(a.nextMessageTime=o,a)}},{key:"_modifyMessageList",value:function(e,t){var n=this.getModule(qn).getLocalConversation(e);if(n)for(var o=n.userProfile.nick,s=n.userProfile.avatar,a=this.getModule(Gn).getNickAndAvatarByUserID(this.getMyUserID()),i=a.nick,r=a.avatar,u=t.length-1;u>=0;u--){var c=t[u];"in"===c.flow&&(c.nick!==o&&c.setNickAndAvatar({nick:o}),c.avatar!==s&&c.setNickAndAvatar({avatar:s})),"out"===c.flow&&(c.nick!==i&&c.setNickAndAvatar({nick:i}),c.avatar!==r&&c.setNickAndAvatar({avatar:r}))}}},{key:"getRemotePeerReadTime",value:function(e){var t=this,n="".concat(this._n,".getRemotePeerReadTime");if(zt(e))return Ve.w("".concat(n," userIDList is empty!")),Promise.resolve();var o=new Aa("getPeerReadTime");return Ve.l("".concat(n," userIDList:").concat(e)),this.request({protocolName:Lo,requestData:{userIDList:e}}).then((function(s){var a=s.data.peerReadTimeList;Ve.l("".concat(n," ok. peerReadTimeList:").concat(a));for(var i="",r=t.getModule(qn),u=0;u0&&r.recordPeerReadTime("C2C".concat(e[u]),a[u]);o.setNetworkType(t.getNetworkType()).setMessage(i).end()})).catch((function(e){t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.w("".concat(n," failed. error:"),e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,n=e[0].conversationID.replace(E.CONV_C2C,""),o=new Aa("sendC2CReadReceipt");o.setMessage("peerAccount:".concat(n));var s=this.getMyUserID(),a=e.filter((function(e){return e.from!==s&&!0===e.needReadReceipt})).map((function(e){return{fromAccount:e.from,toAccount:e.to,sequence:e.sequence,random:e.random,time:e.time,clientTime:e.clientTime}}));if(0===a.length)return Za({code:ha.READ_RECEIPT_MESSAGE_LIST_EMPTY});var i="".concat(this._n,".sendReadReceipt");return Ve.l("".concat(i,". peerAccount:").concat(n," messageInfoList length:").concat(a.length)),this.request({protocolName:ps,requestData:{peerAccount:n,messageInfoList:a}}).then((function(e){return o.end(),Ve.l("".concat(i," ok")),Ya()})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.w("".concat(i," failed. error:"),e),Za(e)}))}},{key:"getReadReceiptList",value:function(e){var t="".concat(this._n,".getReadReceiptList"),n=this.getMyUserID(),o=e.filter((function(e){return e.from===n&&!0===e.needReadReceipt}));return Ve.l("".concat(t," userID:").concat(n," messageList length:").concat(o.length)),Xa({messageList:o})}},{key:"getMessageExtensions",value:function(e,t){return Ve.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.request({protocolName:Oo,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),startSequence:t}})}},{key:"modifyMessageExtensions",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Ve.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n)),this.request({protocolName:No,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),extensionList:t,operateType:n}})}},{key:"_getMessageKey",value:function(e){var t=e.clientSequence,n=e.random,o=e.time;return"".concat(t,"_").concat(n,"_").concat(o)}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._messageFromUnreadDBMap.clear(),this._signalingFromUnreadDBList.length=0}}]),s}(uo),$a=function(){function e(){o(this,e),this.list=new Map,this._n="MessageListHandler",this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map}return a(e,[{key:"getLocalOldestMessageByConversationID",value:function(e){if(!e)return null;if(!this.list.has(e))return null;var t=this.list.get(e).values();return t?t.next().value:null}},{key:"pushIn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.conversationID,o=!0;this.list.has(n)||this.list.set(n,new Map);var s=this._getUniqueIDOfMessage(e),a=this.list.get(n).has(s);if(a){var i=this.list.get(n).get(s);if(!t||!0===i.isModified)return o=!1}return this.list.get(n).set(s,e),this._setLatestMessageSentByPeer(n,e),this._setLatestMessageSentByMe(n,e),o}},{key:"unshift",value:function(e,t){var n;if(at(e)?e.length>0&&(n=e[0].conversationID,this._unshiftMultipleMessages(e,t)):(n=e.conversationID,this._unshiftSingleMessage(e,t)),n&&n.startsWith(E.CONV_C2C)){var o=Array.from(this.list.get(n).values()),s=o.length;if(0===s)return;for(var a=s-1;a>=0;a--)if("out"===o[a].flow){this._setLatestMessageSentByMe(n,o[a]);break}for(var i=s-1;i>=0;i--)if("in"===o[i].flow){this._setLatestMessageSentByPeer(n,o[i]);break}}}},{key:"_unshiftSingleMessage",value:function(e,t){var n=e.conversationID,o=this._getUniqueIDOfMessage(e);if(!this.list.has(n))return this.list.set(n,new Map),this.list.get(n).set(o,e),void t.push(e);var s=this.list.get(n),a=Array.from(s);s.has(o)||(a.unshift([o,e]),this.list.set(n,new Map(a)),t.push(e))}},{key:"_unshiftMultipleMessages",value:function(e,t){for(var n=e.length,o=[],s=e[0].conversationID,a=this.list.get(s),i=this.list.has(s)?Array.from(a):[],r=0;r=0;l--)"in"===a[l].flow&&((r=a[l]).nick!==n&&(r.setNickAndAvatar({nick:n}),c=!0),r.avatar!==o&&(r.setNickAndAvatar({avatar:o}),c=!0),c&&(u+=1));Ve.l("".concat(this._n,".modifyMessageSentByPeer conversationID:").concat(t," count:").concat(u))}}}},{key:"modifyMessageSentByMe",value:function(e){var t=e.conversationID,n=e.latestNick,o=e.latestAvatar,s=this.list.get(t);if(!zt(s)){var a=Array.from(s.values()),i=a.length;if(0!==i){for(var r=null,u=0,c=!1,l=i-1;l>=0;l--)"out"===a[l].flow&&((r=a[l]).nick!==n&&(r.setNickAndAvatar({nick:n}),c=!0),r.avatar!==o&&(r.setNickAndAvatar({avatar:o}),c=!0),c&&(u+=1));Ve.l("".concat(this._n,".modifyMessageSentByMe conversationID:").concat(t," count:").concat(u))}}}},{key:"getTopicConversationIDList",value:function(e){return m(this.list.keys()).filter((function(t){return t.startsWith("".concat(E.CONV_GROUP).concat(e))}))}},{key:"traversal",value:function(){if(0!==this.list.size&&-1===Ve.getLevel()){console.group("conversationID-messageCount");var e,t=D(this.list);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],s=n[1];console.log("".concat(o,"-").concat(s.size))}}catch(a){t.e(a)}finally{t.f()}console.groupEnd()}}},{key:"onMessageModified",value:function(e,t){if(!this.list.has(e))return{isUpdated:!1,message:null};var n=this._getUniqueIDOfMessage(t),o=this.list.get(e).has(n);if(Ve.d("".concat(this._n,".onMessageModified conversationID:").concat(e," uniqueID:").concat(n," has:").concat(o)),o){var s=this.list.get(e).get(n),a=t.messageVersion,i=t.elements,r=t.cloudCustomData;return s.version1&&void 0!==arguments[1]&&arguments[1];if(e)return this._isReady?void(t?e.call(this):setTimeout(e,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(e))},t.triggerReady=function(){var e=this;this._isReady=!0,setTimeout((function(){var t=e._readyQueue;e._readyQueue=[],t&&t.length>0&&t.forEach((function(e){e.call(this)}),e)}),1)},t.resetReady=function(){this._isReady=!1,this._readyQueue=[]},t.isReady=function(){return this._isReady}};var si=["jpg","jpeg","gif","png","bmp","image","webp"],ai=["mp4","quicktime","mov"],ii=1,ri=2,ui=3,ci=255,li=function(){function e(t){var n=this;o(this,e),zt(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.gender=t.gender||"",this.birthday=t.birthday||0,this.location=t.location||"",this.selfSignature=t.selfSignature||"",this.allowType=t.allowType||E.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||E.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],zt(t.profileCustomField)||t.profileCustomField.forEach((function(e){n.profileCustomField.push({key:e.key,value:e.value})})))}return a(e,[{key:"validate",value:function(e){var t=!0,n="";if(zt(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,s=null,a=0;a500&&(n="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(ht(e[i])," bytes"),t=!1);break;case"gender":mt(Ke,e.gender)||(n="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":et(e.birthday)||(n="birthday must be a number",t=!1);break;case"location":nt(e.location)||(n="location must be a string",t=!1);break;case"selfSignature":nt(e.selfSignature)||(n="selfSignature must be a string",t=!1);break;case"allowType":mt(Ye,e.allowType)||(n="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":et(e.language)||(n="language must be a number",t=!1);break;case"avatar":nt(e.avatar)||(n="avatar must be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n="messageSettings must be 0 or 1",t=!1);break;case"adminForbidType":mt(We,e.adminForbidType)||(n="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":et(e.level)||(n="level must be a number",t=!1);break;case"role":et(e.role)||(n="role must be a number",t=!1);break;default:n="unknown key:"+i+" "+e[i],t=!1}}return{valid:t,tips:n}}}]),e}(),di=a((function e(t){o(this,e),this.value=t,this.next=null})),pi=function(){function e(t){o(this,e),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map}return a(e,[{key:"set",value:function(e){var t=new di(e);if(this.map.size0&&n.members.forEach((function(e){e.userID===t.selfInfo.userID&&pt(t.selfInfo,e,["sequence"])}))}},{key:"updateSelfInfo",value:function(e){var n={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList};pt(this.selfInfo,t({},n),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}}]),e}(),_i=function(e,n){return it(e)?{lastTime:0,lastSequence:0,fromAccount:0,messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}:e instanceof Wa?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:Vt(e.type,e.payload,n),payload:e.payload||null,type:e.type||null,isRevoked:e.isRevoked||!1,cloudCustomData:e.cloudCustomData||"",onlineOnlyFlag:e._onlineOnlyFlag||!1,nick:e.nick||"",nameCard:e.nameCard||"",version:e.version||0,isPeerRead:e.isPeerRead||!1,revoker:e.revoker||null}:t(t({},e),{},{messageForShow:Vt(e.type,e.payload,n)})},fi=function(){function e(t,n){o(this,e),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=_i(t.lastMessage,n),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark="",this.isPinned=t.isPinned||!1,this.messageRemindType="",this.markList=t.markList||[],this.customData=t.customData||"",this.conversationGroupList=t.conversationGroupList||[],this._initProfile(t)}return a(e,[{key:"toAccount",get:function(){return this.conversationID.startsWith(E.CONV_C2C)?this.conversationID.replace(E.CONV_C2C,""):this.conversationID.startsWith(E.CONV_GROUP)?this.conversationID.replace(E.CONV_GROUP,""):""}},{key:"subType",get:function(){return this.groupProfile?this.groupProfile.type:""}},{key:"_initProfile",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"userProfile":t.userProfile=e.userProfile;break;case"groupProfile":t.groupProfile=e.groupProfile}})),it(this.userProfile)&&this.type===E.CONV_C2C?this.userProfile=new li({userID:e.conversationID.replace("C2C","")}):it(this.groupProfile)&&this.type===E.CONV_GROUP&&(this.groupProfile=new hi({groupID:e.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(e){var t=e.nextUnreadCount,n=e.isFromGetConversations,o=e.isUnreadC2CMessage;it(t)||(Tt(this.subType)?this.unreadCount=0:n&&this.type===E.CONV_GROUP||n&&this.type===E.CONV_TOPIC||o&&this.type===E.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:"updateLastMessage",value:function(e){this.lastMessage=_i(e)}},{key:"updateGroupAtInfoList",value:function(e){if(!this._isNeedMergeGroupAtInfo(e)){var t,n=(M(t=e.groupAtType)||y(t)||I(t)||T()).slice(0);-1!==n.indexOf(E.CONV_AT_ME)&&-1!==n.indexOf(E.CONV_AT_ALL)&&(n=[E.CONV_AT_ALL_AT_ME]);var o={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:n,__random:e.__random,__sequence:e.__sequence};this.groupAtInfoList.push(o)}}},{key:"_isNeedMergeGroupAtInfo",value:function(e){var t=e.groupID,n=e.sequence;if(!Dt({groupID:t}))return!1;var o=!1;return this.groupAtInfoList.forEach((function(t){t.messageSequence===n&&(t.atTypeArray.indexOf(E.CONV_AT_ME)>-1&&e.groupAtType.indexOf(E.CONV_AT_ALL)>-1&&(t.atTypeArray=[E.CONV_AT_ALL_AT_ME]),t.atTypeArray.indexOf(E.CONV_AT_ALL)>-1&&e.groupAtType.indexOf(E.CONV_AT_ME)>-1&&(t.atTypeArray=[E.CONV_AT_ALL_AT_ME],t.__random=e.__random,t.__sequence=e.__sequence),o=!0)})),o}},{key:"clearGroupAtInfoList",value:function(){this.groupAtInfoList.length=0}},{key:"reduceUnreadCount",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:"isLastMessageRevoked",value:function(e){var t=e.sequence,n=e.time;return this.type===E.CONV_C2C&&t===this.lastMessage.lastSequence&&n===this.lastMessage.lastTime||this.type===E.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}}]),e}(),vi=function(){function e(t){o(this,e),this._conversationModule=t,this._n="MessageRemindHandler",this._updateSequence=0}return a(e,[{key:"getC2CMessageRemindType",value:function(){var e=this,t="".concat(this._n,".getC2CMessageRemindType");return this._conversationModule.request({protocolName:Eo,updateSequence:this._updateSequence}).then((function(n){Ve.l("".concat(t," ok"));var o=n.data,s=o.updateSequence,a=o.muteFlagList;e._updateSequence=s,e._patchC2CMessageRemindType(a)})).catch((function(e){Ve.e("".concat(t," failed. error:"),e)}))}},{key:"_patchC2CMessageRemindType",value:function(e){var t=this,n=0,o="";at(e)&&e.length>0&&e.forEach((function(e){var s=e.userID,a=e.muteFlag;0===a?o=E.MSG_REMIND_ACPT_AND_NOTE:1===a?o=E.MSG_REMIND_DISCARD:2===a&&(o=E.MSG_REMIND_ACPT_NOT_NOTE),!0===t._conversationModule.patchMessageRemindType({ID:s,isC2CConversation:!0,messageRemindType:o})&&(n+=1)})),Ve.l("".concat(this._n,"._patchC2CMessageRemindType count:").concat(n))}},{key:"set",value:function(e){return e.groupID?this._setGroupMessageRemindType(e):at(e.userIDList)?this._setC2CMessageRemindType(e):void 0}},{key:"_setGroupMessageRemindType",value:function(e){var t=this,n="".concat(this._n,"._setGroupMessageRemindType"),o=e.groupID,s=e.messageRemindType,a="groupID:".concat(o," messageRemindType:").concat(s),i=new Aa("setMessageRemindType");return i.setMessage(a),this._getModule(wn).modifyGroupMemberInfo({groupID:o,messageRemindType:s,userID:this._conversationModule.getMyUserID()}).then((function(){i.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok. ").concat(a));var o=t.onGroupMessageRemindTypeUpdated(e);return t._conversationModule.emitTotalUnreadMessageCountUpdate(),Ya(o)})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"onGroupMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.messageRemindType,o=this._getModule(Pn).getLocalGroupProfile(t);if(o&&(o.selfInfo.messageRemindType=n),kt(t)){var s=t,a=xt(s),i=this._getModule(Fn).getLocalTopic(a,s);return i&&(i.updateSelfInfo({messageRemindType:n}),this._conversationModule.emitOuterEvent(k.TOPIC_UPDATED,{groupID:a,topic:i})),{topic:i}}return this._conversationModule.patchMessageRemindType({ID:t,isC2CConversation:!1,messageRemindType:n})&&this._emitConversationUpdate(),{group:o}}},{key:"_setC2CMessageRemindType",value:function(e){var t=this,n="".concat(this._n,"._setC2CMessageRemindType"),o=e.userIDList,s=e.messageRemindType,a=o.slice(0,30),i=0;s===E.MSG_REMIND_DISCARD?i=1:s===E.MSG_REMIND_ACPT_NOT_NOTE&&(i=2);var r="userIDList:".concat(a," messageRemindType:").concat(s),u=new Aa("setMessageRemindType");return u.setMessage(r),this._conversationModule.request({protocolName:ko,requestData:{userIDList:a,muteFlag:i}}).then((function(e){u.setNetworkType(t._conversationModule.getNetworkType()).end();var o=e.data,i=o.updateSequence,r=o.errorList;t._updateSequence=i;var c=[],l=[];at(r)&&r.forEach((function(e){c.push(e.userID),l.push({userID:e.userID,code:e.errorCode})}));var d=a.filter((function(e){return-1===c.indexOf(e)}));Ve.l("".concat(n," ok. successUserIDList:").concat(d," failureUserIDList:").concat(JSON.stringify(l)));var p=0;return d.forEach((function(e){t._conversationModule.patchMessageRemindType({ID:e,isC2CConversation:!0,messageRemindType:s})&&(p+=1)})),p>=1&&t._emitConversationUpdate(),a.length=c.length=0,t._conversationModule.emitTotalUnreadMessageCountUpdate(),Xa({successUserIDList:d.map((function(e){return{userID:e}})),failureUserIDList:l})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"_getModule",value:function(e){return this._conversationModule.getModule(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"setUpdateSequence",value:function(e){this._updateSequence=e}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._updateSequence=0}}]),e}(),mi=function(){function e(t){o(this,e),this._conversationModule=t,this._n="ConvGroupHandler",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=$t.NOT_START}return a(e,[{key:"setConvCustomData",value:function(e){var t=this,n="".concat(this._n,".").concat("setConvCustomData"),o=e.conversationIDList,s=e.customData;Ve.l("".concat(n," options:"),e);var a=new Aa("setConvCustomData");a.setMessage(JSON.stringify(e));var i={fromAccount:this._getMyUserID(),itemList:[]},r=[],u=[];return o.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(u,e),!0;if(!Et(e)&&!St(e))return t._onConversationIDInvalid(u,e),!0;var n={operationType:2,contactItem:void 0,customMark:s};Et(e)?n.contactItem={type:1,toAccount:e.replace(E.CONV_C2C,"")}:St(e)&&(n.contactItem={type:2,groupID:e.replace(E.CONV_GROUP,"")}),i.itemList.push(n)})),u.length===o.length?Xa({successConversationIDList:r,failureConversationIDList:u}):this._conversationModule.request({protocolName:qo,requestData:i}).then((function(e){a.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var o=e.data.resultItem;if(at(o)){var i,c,l=!1;o.forEach((function(e){i=t._concatConversationID(e.contactItem),0===e.resultCode?(r.push(i),(c=t._getLocalConversation(i))&&c.customData!==s&&(c.customData=s,l=!0)):u.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===l&&t._emitConversationUpdate()}return Ya({successConversationIDList:r,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"markConversation",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_MARK))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("markConversation"),o=e.conversationIDList,s=e.markType,a=e.enableMark;Ve.l("".concat(n," options:"),e);var i=new Aa("markConversation");i.setMessage(JSON.stringify(e));var r=void 0,u=void 0,c=this._getFlagBit(s);!0===a?u=[c]:r=[c];var l={fromAccount:this._getMyUserID(),itemList:[]},d=[],p=[];return o.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(p,e),!0;if(!Et(e)&&!St(e))return t._onConversationIDInvalid(p,e),!0;var n={operationType:1,contactItem:void 0,clearMark:r,setMark:u};Et(e)?n.contactItem={type:1,toAccount:e.replace(E.CONV_C2C,"")}:St(e)&&(n.contactItem={type:2,groupID:e.replace(E.CONV_GROUP,"")}),l.itemList.push(n)})),p.length===o.length?Xa({successConversationIDList:d,failureConversationIDList:p}):this._conversationModule.request({protocolName:xo,requestData:l}).then((function(e){i.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var o=e.data.resultItem;if(at(o)){var r,u,c=!1;o.forEach((function(e){if(r=t._concatConversationID(e.contactItem),0===e.resultCode){if(d.push(r),u=t._getLocalConversation(r)){var n=u.markList.indexOf(s);!0===a?-1===n&&(u.markList.push(s),c=!0):-1!==n&&(u.markList.splice(n,1),c=!0)}}else p.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===c&&t._emitConversationUpdate()}return Ya({successConversationIDList:d,failureConversationIDList:p})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"getLocalConvGroupList",value:function(){var e=this;return Ve.l("".concat(this._n,".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===$t.REJECTED?this.getRemoteConvGroupList().then((function(){return Ya(m(e._convGroupMap.values()))})):Xa(m(this._convGroupMap.values()))}},{key:"getRemoteConvGroupList",value:function(){var e=this,t="".concat(this._n,".getRemoteConvGroupList");return this._pagingStatus=$t.PENDING,this._conversationModule.request({protocolName:Yo,requestData:{fromAccount:this._getMyUserID(),startIndex:this._startIndex,startTime:we()}}).then((function(n){var o,s,a=n.data,i=a.completeFlag,r=a.contactItem,u=a.nextStartIndex,c=void 0===u?0:u,l=a.groupItem;(e._startIndex=c,Ve.l("".concat(t," completeFlag:").concat(i," nextStartIndex:").concat(c)),at(l)&&l.forEach((function(t){var n=t.convGroupID,o=t.groupName;e._convGroupMap.set(n,o)})),at(r))&&r.forEach((function(t){var n=t.standardMark,a=t.customData,i=t.convGroupIDList;if(o=e._concatConversationID(t),(s=e._getLocalConversation(o))&&(s.markList=Ht(n),s.customData=a||"",at(i))){var r=[];i.forEach((function(t){e._convGroupMap.has(t)&&r.push(e._convGroupMap.get(t))})),s.conversationGroupList=[].concat(r),r.length=0}}));if(0===i)return e.getRemoteConvGroupList();1===i&&(e._pagingStatus=$t.RESOLVED,e._emitConversationUpdate(),e._emitConvGroupListUpdate())})).catch((function(n){e._pagingStatus=$t.REJECTED,Ve.w("".concat(t," failed. error:"),n)}))}},{key:"createConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("createConvGroup");Ve.l("".concat(n," options:"),e);var o=new Aa("createConvGroup");o.setMessage(JSON.stringify(e));var s=e.groupName,a=e.conversationIDList,i={fromAccount:this._getMyUserID(),itemList:[{groupName:s,contactItem:[]}]},r=[],u=[];return a.forEach((function(e){return t._hasLocalConversation(e)?Et(e)||St(e)?void(Et(e)?i.itemList[0].contactItem.push({type:1,toAccount:e.replace(E.CONV_C2C,"")}):St(e)&&i.itemList[0].contactItem.push({type:2,groupID:e.replace(E.CONV_GROUP,"")})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===a.length?Xa({successConversationIDList:r,failureConversationIDList:u}):this._conversationModule.request({protocolName:Vo,requestData:i}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var a=e.data.groupResultItem[0],i=a.groupItem,c=a.resultItem;if(st(i)&&(t._convGroupMap.set(i.convGroupID,i.groupName),t._emitConvGroupListUpdate()),at(c)){var l,d,p=!1;c.forEach((function(e){l=t._concatConversationID(e.contactItem),0===e.resultCode?(r.push(l),(d=t._getLocalConversation(l))&&-1===d.conversationGroupList.indexOf(s)&&(d.conversationGroupList.push(s),p=!0)):u.push({conversationID:l,code:e.resultCode,message:e.resultInfo})})),!0===p&&(t._emitConversationUpdate(),t._emitConvGroupListUpdate())}return Ya({successConversationIDList:r,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"deleteConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("deleteConvGroup");Ve.l("".concat(n," groupName:").concat(e));var o=new Aa("deleteConvGroup");return o.setMessage(e),this._conversationModule.request({protocolName:Bo,requestData:{fromAccount:this._getMyUserID(),groupName:[e]}}).then((function(s){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var a=s.data.groupItem;if(at(a)){var i=!1;a.forEach((function(e){t._convGroupMap.has(e.convGroupID)&&(t._convGroupMap.delete(e.convGroupID),i=!0)})),!0===i&&t._emitConvGroupListUpdate()}t._eraseFromConversationGroupList([e])})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"renameConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("renameConvGroup");Ve.l("".concat(n," options:"),e);var o=new Aa("renameConvGroup");o.setMessage(JSON.stringify(e));var s=e.oldName,a=e.newName;return this._conversationModule.request({protocolName:Ho,requestData:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:s,newName:a}}}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var i=e.data.updateGroupResult.convGroupID;t._convGroupMap.set(i,a),t._emitConvGroupListUpdate();var r,u,c=t._conversationModule.getLocalConversationList(),l=!1;c.forEach((function(e){r=e.conversationGroupList,-1!==(u=r.indexOf(s))&&(r.splice(u,1,a),l=!0)})),!0===l&&t._emitConversationUpdate()})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"addConvsToGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("addConvsToGroup");Ve.l("".concat(n," options:"),e);var o=new Aa("addConvsToGroup");o.setMessage(JSON.stringify(e));var s=e.conversationIDList,a=e.groupName,i={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:a,updateItem:[]}},r=[],u=[];return s.forEach((function(e){return t._hasLocalConversation(e)?Et(e)||St(e)?void(Et(e)?i.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:e.replace(E.CONV_C2C,"")}}):St(e)&&i.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:e.replace(E.CONV_GROUP,"")}})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===s.length?Xa({successConversationIDList:r,failureConversationIDList:u}):this._conversationModule.request({protocolName:Ko,requestData:i}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var s=e.data.updateGroupResult.contactResultItem;if(at(s)){var i,c,l=!1;s.forEach((function(e){i=t._concatConversationID(e.contactItem),0===e.resultCode?(c=t._getLocalConversation(i))&&-1===c.conversationGroupList.indexOf(a)&&(c.conversationGroupList.push(a),r.push(i),l=!0):u.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(a))}return Ya({successConversationIDList:r,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"deleteConvsFromGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("deleteConvsFromGroup");Ve.l("".concat(n," options:"),e);var o=new Aa("deleteConvsFromGroup");o.setMessage(JSON.stringify(e));var s=e.conversationIDList,a=e.groupName,i={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:a,updateItem:[]}},r=[],u=[];return s.forEach((function(e){return t._hasLocalConversation(e)?Et(e)||St(e)?void(Et(e)?i.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:e.replace(E.CONV_C2C,"")}}):St(e)&&i.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:e.replace(E.CONV_GROUP,"")}})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===s.length?Xa({successConversationIDList:r,failureConversationIDList:u}):this._conversationModule.request({protocolName:Wo,requestData:i}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var s=e.data.updateGroupResult.contactResultItem;if(at(s)){var i,c,l=!1;s.forEach((function(e){if(i=t._concatConversationID(e.contactItem),0===e.resultCode){if(c=t._getLocalConversation(i)){var n=c.conversationGroupList.indexOf(a);-1!==n&&(c.conversationGroupList.splice(n,1),r.push(i),l=!0)}}else u.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(a))}return Ya({successConversationIDList:r,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"onConvMarkUpdated",value:function(e){var t=this;if(!zt(e)){var n,o;Ve.d("".concat(this._n,".onConvMarkUpdated markItemList:"),e);var s=!1;e.forEach((function(e){var a=e.recentContactItem,i=e.optType,r=e.standardMark,u=e.customMark;if(n=t._concatConversationID(a),o=t._getLocalConversation(n))if(1===i){var c=Ht(r);!0!==function(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,o=e.length;n=0;o--)if("1"===t[o])return n-o-1}},{key:"_concatConversationID",value:function(e){var t,n=e.type,o=e.to,s=e.groupID,a=e.userID;return 1===n?it(a)?it(o)||(t="".concat(E.CONV_C2C).concat(o)):t="".concat(E.CONV_C2C).concat(a):2===n&&(t="".concat(E.CONV_GROUP).concat(s)),t}},{key:"_getMyUserID",value:function(){return this._conversationModule.getMyUserID()}},{key:"_insertConversationGroup",value:function(e,t){var n=this._getLocalConversation(e);if(n){var o=n.conversationGroupList;-1===o.indexOf(t)&&o.push(t)}}},{key:"_getLocalConversation",value:function(e){return this._conversationModule.getLocalConversation(e)}},{key:"_hasLocalConversation",value:function(e){return this._conversationModule.hasLocalConversation(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"_emitConvGroupListUpdate",value:function(){this._conversationModule.emitOuterEvent(k.CONVERSATION_GROUP_LIST_UPDATED,m(this._convGroupMap.values()))}},{key:"_emitConvInGroupUpdate",value:function(e){var t={groupName:e,conversationList:[]},n=this._conversationModule.getLocalConversationList();t.conversationList=n.filter((function(t){return t.conversationGroupList.includes(e)})),this._conversationModule.emitOuterEvent(k.CONVERSATION_IN_GROUP_UPDATED,t)}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=$t.NOT_START}}]),e}(),Mi=function(e){r(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="ConversationModule",oi.mixin(h(t)),t._messageListHandler=new $a,t._messageRemindHandler=new vi(h(t)),t._convGroupHandler=new mi(h(t)),t.singlyLinkedList=new pi(100),t._pagingStatus=$t.NOT_START,t._pagingTimeStamp=0,t._pagingStartIndex=0,t._pagingPinnedTimeStamp=0,t._pagingPinnedStartIndex=0,t._pagingConvIDMap=new Map,t._convIDFromUnreadDBMap=new Map,t._conversationMap=new Map,t._tmpGroupList=[],t._tmpGroupAtTipsList=[],t._peerReadTimeMap=new Map,t._completedMap=new Map,t._roamingMessageKeyAndTimeMap=new Map,t._roamingMessageSequenceMap=new Map,t._remoteGroupReadSequenceMap=new Map,t._convTotalUnreadCount=0,t._pagingGetCostList=[],t._initListeners(),t}return a(s,[{key:"_initListeners",value:function(){var e=this.getInnerEmitterInstance();e.on(ei,this._initLocalConversationList,this),e.on(ni,this._onProfileUpdated,this)}},{key:"onCheckTimer",value:function(e){e%60==0&&this._messageListHandler.traversal()}},{key:"_initLocalConversationList",value:function(){var e=this,t=new Aa("_initLocalConversationList");Ve.l("".concat(this._n,".").concat("_initLocalConversationList"));var n="",o=this._getStorageConversationList(),s=this.isIntl();if(o){for(var a=o.length,i=0;i0&&(e.updateConversationGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)})),this.syncConversationList()}},{key:"onMessageSent",value:function(e){this._onSendOrReceiveMessage({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:"onNewMessage",value:function(e){this._onSendOrReceiveMessage(e)}},{key:"_onSendOrReceiveMessage",value:function(e){var t=this,n=e.conversationOptionsList,o=e.isInstantMessage,s=void 0===o||o,a=e.isUnreadC2CMessage,i=void 0!==a&&a,r=e.updateUnreadCount,u=void 0===r||r;this._isReady?0!==n.length&&(this._getC2CPeerReadTime(n),this._updateLocalConversationList({conversationOptionsList:n,isInstantMessage:s,isUnreadC2CMessage:i,isFromGetConversations:!1,updateUnreadCount:u}),s||(this._convIDFromUnreadDBMap=new Map([].concat(m(this._convIDFromUnreadDBMap),m(n.map((function(e){return[e.conversationID,1]}))))),this._diffAndDeleteConversation()),this._setStorageConversationList(),n.filter((function(e){return e.type===E.CONV_TOPIC})).length>0||this.emitConversationUpdate()):this.ready((function(){t._onSendOrReceiveMessage(e)}))}},{key:"updateConversationGroupProfile",value:function(e){var t=this;if(!at(e)||0!==e.length)if(0!==this._conversationMap.size){var n=!1;e.forEach((function(e){var o="GROUP".concat(e.groupID);if(t._conversationMap.has(o)){n=!0;var s=t._conversationMap.get(o);s.groupProfile=JSON.parse(JSON.stringify(e)),s.lastMessage.lastSequence=0;i--)if(!s[i].isDeleted){a=s[i];break}var r=this._conversationMap.get(o);if(r){var u=!1;r.lastMessage.lastSequence===a.sequence&&r.lastMessage.lastTime===a.time||(zt(a)&&(a=void 0),r.updateLastMessage(a),r.type!==E.CONV_TOPIC&&(u=!0),Ve.l("".concat(this._n,".onMessageDeleted. update conversationID:").concat(o," with lastMessage:"),r.lastMessage)),o.startsWith(E.CONV_C2C)&&this.updateUnreadCount(o),u&&this.emitConversationUpdate(!0,!1)}}}},{key:"onMessageModified",value:function(e){var t=e.conversationType,n=e.from,o=e.to,s=e.time,a=e.sequence,i=e.elements,r=e.cloudCustomData,u=e.messageVersion,c=this.getMyUserID(),l="".concat(t).concat(o);o===c&&t===E.CONV_C2C&&(l="".concat(t).concat(n));var d=this._messageListHandler.onMessageModified(l,e),p=d.isUpdated,g=d.message;!0===p&&this.emitOuterEvent(k.MESSAGE_MODIFIED,[g]);var h=this._isTopicConversation(l);if(Ve.l("".concat(this._n,".onMessageModified isUpdated:").concat(p," isTopicMessage:").concat(h," from:").concat(n," to:").concat(o)),h){this.getModule(Fn).onMessageModified(e)}else{var _=this._conversationMap.get(l);if(_){var f=_.lastMessage;Ve.d("".concat(this._n.onMessageModified," lastMessage:"),JSON.stringify(f),"options:",JSON.stringify(e)),f&&f.lastTime===s&&f.lastSequence===a&&f.version!==u&&(f.type=i[0].type,f.payload=i[0].content,f.messageForShow=Vt(f.type,f.payload,this.isIntl()),f.cloudCustomData=r,f.version=u,this.emitConversationUpdate(!0,!1))}}return g}},{key:"onNewGroupAtTips",value:function(e){var n=this,o=e.dataList,s=null;o.forEach((function(e){e.groupAtTips?s=e.groupAtTips:e.elements?s=t(t({},e.elements),{},{sync:!0}):e.groupAtType&&(s=t(t({},e),{},{sync:!0})),s.__random=e.random,s.__sequence=e.clientSequence,n._tmpGroupAtTipsList.push(s)})),Ve.d("".concat(this._n,".onNewGroupAtTips isReady:").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var e=this;if(0!==this._tmpGroupAtTipsList.length){var t=!1;this._tmpGroupAtTipsList.forEach((function(n){var o=n.groupID,s=n.from,a=n.topicID,i=void 0===a?void 0:a,r=n.sync,u=void 0!==r&&r;if(s!==e.getMyUserID())if(it(i)){var c=e._conversationMap.get("".concat(E.CONV_GROUP).concat(o));c&&(c.updateGroupAtInfoList(n),t=!0)}else{var l=e._conversationMap.get("".concat(E.CONV_GROUP).concat(i));if(l){l.updateGroupAtInfoList(n);var d=e.getModule(Fn),p=l.groupAtInfoList;d.onConversationProxy({topicID:i,groupAtInfoList:p})}if(zt(l)&&u)e.updateTopicConversation([{conversationID:"".concat(E.CONV_GROUP).concat(i),type:E.CONV_TOPIC}]),e._conversationMap.get("".concat(E.CONV_GROUP).concat(i)).updateGroupAtInfoList(n)}})),t&&this.emitConversationUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}},{key:"_getC2CPeerReadTime",value:function(e){var t=this,n=[];if(e.forEach((function(e){t._conversationMap.has(e.conversationID)||e.type!==E.CONV_C2C||n.push(e.conversationID.replace(E.CONV_C2C,""))})),n.length>0){Ve.d("".concat(this._n,"._getC2CPeerReadTime userIDList:").concat(n));var o=this.getModule(Un);o&&o.getRemotePeerReadTime(n)}}},{key:"_getStorageConversationList",value:function(){return this.getModule(Vn).getItem("conversationMap")}},{key:"_setStorageConversationList",value:function(){var e=this.getLocalConversationList().filter((function(e){return e.type===E.CONV_C2C||e.type===E.CONV_GROUP&&e.lastMessage.type!==E.MSG_GRP_TIP})).slice(0,20).map((function(e){return{conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}}));this.getModule(Vn).setItem("conversationMap",e)}},{key:"emitConversationUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversationList();if(t){var o=this.getModule(Pn);o&&o.updateGroupLastMessage(n)}e&&this.emitOuterEvent(k.CONVERSATION_LIST_UPDATED)}},{key:"getLocalConversationList",value:function(){return m(this._conversationMap.values()).filter((function(e){return e.type!==E.CONV_TOPIC}))}},{key:"getLocalConversation",value:function(e){return this._conversationMap.get(e)}},{key:"hasLocalConversation",value:function(e){return this._conversationMap.has(e)}},{key:"getLocalOldestMessage",value:function(e){return this._messageListHandler.getLocalOldestMessage(e)}},{key:"syncConversationList",value:function(){var e=this,t=new Aa("syncConversationList");return this._pagingStatus===$t.NOT_START&&this._conversationMap.clear(),this._pagingGetConversationList().then((function(n){var o=function(e){if(at(e)&&0!==e.length){var t=0;return e.forEach((function(e){t+=e})),(t/e.length).toFixed(0)}}(e._pagingGetCostList);return Ve.l("".concat(e._n,".").concat("syncConversationList",". sum ").concat(function(e){if(at(e)&&0!==e.length){var t=0;return e.forEach((function(e){t+=e})),t.toFixed(0)}}(e._pagingGetCostList)," ms, average ").concat(o," ms")),e._pagingGetCostList.length=0,e._pagingStatus=$t.RESOLVED,e._diffAndDeleteConversation(),e.emitConversationUpdate(!0,!1),e._setStorageConversationList(),e._handleC2CPeerReadTime(),e._patchConversationProperties(),t.setMessage(e._conversationMap.size).setMoreMessage(o).setNetworkType(e.getNetworkType()).end(),n})).catch((function(n){return e._pagingStatus=$t.REJECTED,t.setMessage(e._pagingTimeStamp),e.probeNetwork().then((function(e){var o=v(e,2),s=o[0],a=o[1];t.setError(n,s,a).end()})),Za(n)}))}},{key:"_diffAndDeleteConversation",value:function(){var e=this;if(this._isSyncCompleted()){var t=[];this._conversationMap.forEach((function(n,o){!e._pagingConvIDMap.has(o)&&e._convIDFromUnreadDBMap.has(o)&&(e._conversationMap.delete(o),t.push(o))})),Ve.l("".concat(this._n,"._diffAndDeleteConversation list:").concat(t))}}},{key:"_patchConversationProperties",value:function(){var e=this,t=Date.now(),n=this.checkAndPatchRemark(),o=this._messageRemindHandler.getC2CMessageRemindType(),s=this.getModule(Pn).getGroupList();Promise.all([n,o,s]).then((function(){var n=Date.now()-t;Ve.l("".concat(e._n,"._patchConversationProperties ok. cost ").concat(n," ms")),e.emitConversationUpdate(!0,!1),e.emitTotalUnreadMessageCountUpdate()}))}},{key:"_pagingGetConversationList",value:function(){var e=this,t="".concat(this._n,"._pagingGetConversationList");Ve.l("".concat(t," timeStamp:").concat(this._pagingTimeStamp," startIndex:").concat(this._pagingStartIndex)+" pinnedTimeStamp:".concat(this._pagingPinnedTimeStamp," pinnedStartIndex:").concat(this._pagingPinnedStartIndex));var n=Date.now();return this._pagingStatus=$t.PENDING,this.request({protocolName:Go,requestData:{fromAccount:this.getMyUserID(),timeStamp:this._pagingTimeStamp,startIndex:this._pagingStartIndex,pinnedTimeStamp:this._pagingPinnedTimeStamp,pinnedStartIndex:this._pagingPinnedStartIndex,orderType:1}}).then((function(o){var s=o.data,a=s.completeFlag,i=s.conversations,r=void 0===i?[]:i,u=s.timeStamp,c=s.startIndex,l=s.pinnedTimeStamp,d=s.pinnedStartIndex,p=s.groupItem,g=Date.now()-n;if(e._pagingGetCostList.push(g),Ve.l("".concat(t," ok. completeFlag:").concat(a," count:").concat(r.length," cost ").concat(g," ms")),e._convGroupHandler.onConvGroupListSynced(p),r.length>0){var h=e._getConversationOptions(r);e._pagingConvIDMap=new Map([].concat(m(e._pagingConvIDMap),m(h.map((function(e){return[e.conversationID,1]}))))),e._updateLocalConversationList({conversationOptionsList:h,isFromGetConversations:!0}),e.isLoggedIn()&&e.emitConversationUpdate()}if(!e._isReady){if(!e.isLoggedIn())return Xa();e.triggerReady()}return e._pagingTimeStamp=u,e._pagingStartIndex=c,e._pagingPinnedTimeStamp=l,e._pagingPinnedStartIndex=d,1!==a?e._pagingGetConversationList():(e._handleGroupAtTipsList(),e._convGroupHandler.getRemoteConvGroupList(),Xa())})).catch((function(n){throw e.isLoggedIn()&&(e._isReady||(Ve.w("".concat(t," failed. error:"),n),e.triggerReady())),n}))}},{key:"_updateLocalConversationList",value:function(e){var t,n=e.isFromGetConversations,o=e.isInstantMessage,s=Date.now();t=this._getTmpConversationListMapping(e),this._conversationMap=new Map(this._sortConversationList([].concat(m(t.toBeUpdatedConversationList),m(this._conversationMap)))),n||(this._updateUserOrGroupProfile(t.newConversationList),o&&this.emitTotalUnreadMessageCountUpdate()),Ve.d("".concat(this._n,"._updateLocalConversationList cost ").concat(Date.now()-s," ms"))}},{key:"_getTmpConversationListMapping",value:function(e){for(var t=e.conversationOptionsList,n=e.isFromGetConversations,o=e.isInstantMessage,s=e.isUnreadC2CMessage,a=void 0!==s&&s,i=e.updateUnreadCount,r=[],u=[],c=this.getModule(Pn),l=this.getModule(bn),d=this.isIntl(),p=0,g=t.length;p0&&s.getUserProfile({userIDList:n}).then((function(e){var n=e.data;at(n)?n.forEach((function(e){t._doUpdateUserProfile("C2C".concat(e.userID),e)})):t._doUpdateUserProfile("C2C".concat(n.userID),n)})),o.length>0&&a.getGroupProfileAdvance({groupIDList:o,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then((function(e){e.data.successGroupList.forEach((function(e){var n="GROUP".concat(e.groupID);if(t._conversationMap.has(n)){var o=t._conversationMap.get(n);pt(o.groupProfile,e,[],[null,void 0,"",0,NaN]),!o.subType&&e.type&&(o.subType=e.type)}}))}))}}},{key:"_doUpdateUserProfile",value:function(e,t){this.hasLocalConversation(e)&&(this.getLocalConversation(e).userProfile=t)}},{key:"_getConversationOptions",value:function(e){var n=this,o=[],s=e.filter((function(e){var t=e.type,n=e.userID;return 1===t&&"@TLS#NOT_FOUND"!==n&&"@TLS#ERROR"!==n||2===t})),a=this.getMyUserID(),i=s.map((function(e){if(it(e.lastMsg)&&(e.lastMsg={elements:[]}),1===e.type){var s={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar};return o.push(s),{conversationID:"C2C".concat(e.userID),type:"C2C",lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,messageForShow:e.messageShow,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?n._amendLayersOverLimitProperty(e.lastMsg.elements[0].content):null,cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:e.lastC2CMsgFromAccount===a&&e.time<=e.c2cPeerReadTime,revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},userProfile:new li(s),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,messageRemindType:"",customData:e.customMark||"",markList:Ht(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}return{conversationID:"GROUP".concat(e.groupID),type:"GROUP",lastMessage:t(t({lastTime:e.time,lastSequence:e.sequence,fromAccount:e.msgGroupFromAccount,messageForShow:e.messageShow},n._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||"",nameCard:e.senderNameCard||"",revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null}),groupProfile:new hi({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage}),unreadCount:e.unreadCount,peerReadTime:0,isPinned:1===e.isPinned,messageRemindType:"",version:0,customData:e.customMark||"",markList:Ht(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}));o.length>0&&this.getModule(Gn).onConversationsProfileUpdated(o);return i}},{key:"_patchTypeAndPayload",value:function(e){var n=e.lastMsg,o=n.event,s=void 0===o?void 0:o,a=n.elements,i=void 0===a?[]:a,r=n.groupTips,u=void 0===r?{}:r;if(!it(s)&&!zt(u)){var c=new Wa(u);c.setElement({type:E.MSG_GRP_TIP,content:t(t({},u.elements),{},{groupProfile:u.groupProfile})});var l=JSON.parse(JSON.stringify(c.payload));return c=null,{type:E.MSG_GRP_TIP,payload:l}}return{type:i[0]?i[0].type:null,payload:i[0]?this._amendLayersOverLimitProperty(i[0].content):null}}},{key:"_amendLayersOverLimitProperty",value:function(e){var t=e.layersOverLimit;return 0===t?e.layersOverLimit=!1:1===t&&(e.layersOverLimit=!0),e}},{key:"getLocalMessageList",value:function(e){return this._messageListHandler.getLocalMessageList(e)}},{key:"deleteLocalMessage",value:function(e){e instanceof Wa&&this._messageListHandler.remove(e)}},{key:"onConversationDeleted",value:function(e){if(at(e)){var t=e.map((function(e){var t=e.type,n=e.userID,o=e.groupID;return 1===t?"".concat(E.CONV_C2C).concat(n):2===t?"".concat(E.CONV_GROUP).concat(o):void 0}));Ve.l("".concat(this._n,".onConversationDeleted conversationIDList:").concat(t)),this.deleteLocalConversationList(t)}}},{key:"onConversationPinned",value:function(e){var t=this;if(at(e)){var n=!1;e.forEach((function(e){var o,s=e.type,a=e.userID,i=e.groupID;1===s?o=t.getLocalConversation("".concat(E.CONV_C2C).concat(a)):2===s&&(o=t.getLocalConversation("".concat(E.CONV_GROUP).concat(i))),o&&(Ve.l("".concat(t._n,".onConversationPinned conversationID:").concat(o.conversationID," isPinned:").concat(o.isPinned)),o.isPinned||(o.isPinned=!0,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:"onConversationUnpinned",value:function(e){var t=this;if(at(e)){var n=!1;e.forEach((function(e){var o,s=e.type,a=e.userID,i=e.groupID;1===s?o=t.getLocalConversation("".concat(E.CONV_C2C).concat(a)):2===s&&(o=t.getLocalConversation("".concat(E.CONV_GROUP).concat(i))),o&&(Ve.l("".concat(t._n,".onConversationUnpinned conversationID:").concat(o.conversationID," isPinned:").concat(o.isPinned)),o.isPinned&&(o.isPinned=!1,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:"getMessageList",value:function(e){var t=this,n=e.conversationID,o=e.nextReqMessageID,s=e.count,a="".concat(this._n,".getMessageList"),i=this.getLocalConversation(n),r="";if(i&&i.groupProfile&&(r=i.groupProfile.type),Tt(r))return Ve.l("".concat(a," not available in avchatroom. conversationID:").concat(n)),Xa({messageList:[],nextReqMessageID:"",isCompleted:!0});(it(s)||s>15)&&(s=15),!o&&this._isNotInCommunity(n)&&(this._messageListHandler.removeByConversationID(n),this._completedMap.delete(n),this._roamingMessageSequenceMap.delete(n));var u=this._computeRemainingCount({conversationID:n,nextReqMessageID:o}),c=this._completedMap.has(n);if(Ve.l("".concat(a," conversationID:").concat(n," nextReqMessageID:").concat(o)+" remainingCount:".concat(u," count:").concat(s," isCompleted:").concat(c)),this._needGetHistory({conversationID:n,remainingCount:u,count:s}))return this.getHistoryMessages({conversationID:n,nextReqMessageID:o,count:20}).then((function(e){var o=e.nextReqID,s=e.storedMessageList,i=t._completedMap.has(n),r=s;u>0&&(r=t._messageListHandler.getLocalMessageList(n).slice(0,s.length+u));var c={nextReqMessageID:i?"":o,messageList:r,isCompleted:i};return Ve.l("".concat(a," ret.nextReqMessageID:").concat(c.nextReqMessageID," ret.isCompleted:").concat(c.isCompleted," ret.length:").concat(r.length)),Ya(c)}));this.modifyMessageList(n);var l=this._getMessageListFromMemory({conversationID:n,nextReqMessageID:o,count:s});return Xa(l)}},{key:"_getMessageListFromMemory",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=e.count,s="".concat(this._n,"._getMessageListFromMemory"),a=this._messageListHandler.getLocalMessageList(t),i=a.length,r=0,u={isCompleted:!1,nextReqMessageID:"",messageList:[]};return n?(r=a.findIndex((function(e){return e.ID===n})))>o?(u.messageList=a.slice(r-o,r),u.nextReqMessageID=a[r-o].ID):(u.messageList=a.slice(0,r),u.isCompleted=!0):i>o?(r=i-o,u.messageList=a.slice(r,i),u.nextReqMessageID=a[r].ID):(u.messageList=a.slice(0,i),u.isCompleted=!0),Ve.l("".concat(s," conversationID:").concat(t)+" ret.nextReqMessageID:".concat(u.nextReqMessageID," ret.isCompleted:").concat(u.isCompleted," ret.length:").concat(u.messageList.length)),u}},{key:"getMessageListHopping",value:function(e){var t=e.conversationID,n=e.sequence,o=e.time,s=e.count,a=e.direction,i=void 0===a?0:a;if((it(s)||s>15)&&(s=15),t.startsWith(E.CONV_C2C)){var r=this.getModule(Un),u=t.replace(E.CONV_C2C,"");return r.getRoamingMessagesHopping({peerAccount:u,time:o,count:s,direction:i})}if(t.startsWith(E.CONV_GROUP)){var c=this.getModule(Pn),l=t.replace(E.CONV_GROUP,"");return c.getRoamingMessagesHopping({groupID:l,sequence:n,count:s,direction:i})}}},{key:"_computeRemainingCount",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=this._messageListHandler.getLocalMessageList(t),s=o.length;if(!n)return s;var a=0;return Et(t)?a=o.findIndex((function(e){return e.ID===n})):St(t)&&(a=-1!==n.indexOf("-")?o.findIndex((function(e){return e.ID===n})):o.findIndex((function(e){return e.sequence===n}))),-1===a&&(a=0),a}},{key:"_getMessageListSize",value:function(e){return this._messageListHandler.getLocalMessageList(e).length}},{key:"_needGetHistory",value:function(e){var t=e.conversationID,n=e.remainingCount,o=e.count,s=this.getLocalConversation(t),a="";return s&&s.groupProfile&&(a=s.groupProfile.type),!Lt(t)&&!Tt(a)&&(!(St(t)&&this._isPagingGetGroupListCompleted()&&this._getLocalGroupCount()<=4e3&&!this._hasLocalGroup(t)&&!this._isTopicConversation(t))&&(n<=o&&!this._completedMap.has(t)))}},{key:"_isTopicConversation",value:function(e){var t=e.replace(E.CONV_GROUP,"");return kt(t)}},{key:"getHistoryMessages",value:function(e){var t=e.conversationID,n=e.count;if(t===E.CONV_SYSTEM)return Xa();var o=15;n>20&&(o=20);var s=null;if(Et(t)){var a=this._roamingMessageKeyAndTimeMap.has(t);return(s=this.getModule(Un))?s.getRoamingMessage({conversationID:t,peerAccount:t.replace(E.CONV_C2C,""),count:o,lastMessageTime:a?this._roamingMessageKeyAndTimeMap.get(t).lastMessageTime:0,messageKey:a?this._roamingMessageKeyAndTimeMap.get(t).messageKey:""}):Za({code:ha.CANNOT_FIND_MODULE})}if(St(t)){if(!(s=this.getModule(Pn)))return Za({code:ha.CANNOT_FIND_MODULE});var i=null;this._conversationMap.has(t)&&(i=this._conversationMap.get(t).lastMessage);var r=0;i&&(r=i.lastSequence);var u=this._roamingMessageSequenceMap.get(t);return s.getRoamingMessage({conversationID:t,groupID:t.replace(E.CONV_GROUP,""),count:o,sequence:u||r})}return Xa()}},{key:"patchConversationLastMessage",value:function(e){var t=this.getLocalConversation(e);if(t){var n=t.lastMessage,o=n.messageForShow,s=n.payload;if(zt(o)||zt(s)){var a=this._messageListHandler.getLocalMessageList(e);if(0===a.length)return;var i=a[a.length-1];Ve.l("".concat(this._n,".patchConversationLastMessage conversationID:").concat(e," payload:"),i.payload),t.updateLastMessage(i)}}}},{key:"onRoamingMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=n.startsWith(E.CONV_C2C)?E.CONV_C2C:E.CONV_GROUP,a=null,i=[],r=[],u=0,c=e.length,l=null,d=s===E.CONV_GROUP,p=this.getModule(Kn),g=this.getFileDownloadProxy(),h=function(){u=d?e.length-1:0,c=d?0:e.length},_=function(){d?--u:++u},f=function(){return d?u>=c:u0&&void 0!==arguments[0]?arguments[0]:{},n="setAllMessageRead",o="".concat(this._n,".").concat(n);t.scope||(t.scope=E.READ_ALL_MSG),Ve.l("".concat(o," options:"),t);var s=this._createSetAllMessageReadPack(t);if(0===s.readAllC2CMessage&&0===s.groupMessageReadInfoList.length)return Xa();var a=new Aa(n);return this.request({protocolName:us,requestData:s}).then((function(n){var o=n.data,s=e._handleAllMessageRead(o);return a.setMessage("scope:".concat(t.scope," failureGroups:").concat(JSON.stringify(s))).setNetworkType(e.getNetworkType()).end(),Xa()})).catch((function(t){return e.probeNetwork().then((function(e){var n=v(e,2),o=n[0],s=n[1];a.setError(t,o,s).end()})),Ve.w("".concat(o," failed. error:"),t),Za({code:t&&t.code?t.code:ha.MESSAGE_UNREAD_ALL_FAIL,message:t&&t.message?t.message:void 0})}))}},{key:"setConversationCustomData",value:function(e){return this._convGroupHandler.setConvCustomData(e)}},{key:"markConversation",value:function(e){return this._convGroupHandler.markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._convGroupHandler.getLocalConvGroupList()}},{key:"createConversationGroup",value:function(e){return this._convGroupHandler.createConvGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._convGroupHandler.deleteConvGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._convGroupHandler.renameConvGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._convGroupHandler.addConvsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._convGroupHandler.deleteConvsFromGroup(e)}},{key:"onConversationMarkUpdated",value:function(e){this._convGroupHandler.onConvMarkUpdated(e)}},{key:"onConversationGroupCreated",value:function(e){this._convGroupHandler.onConvGroupCreated(e)}},{key:"onConversationGroupDeleted",value:function(e){this._convGroupHandler.onConvGroupDeleted(e)}},{key:"onConversationGroupNameUpdated",value:function(e){this._convGroupHandler.onConvGroupNameUpdated(e)}},{key:"onConversationInGroupUpdated",value:function(e){this._convGroupHandler.onConvInGroupUpdated(e)}},{key:"onConversationAddedToOrDeletedFromGroup",value:function(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}},{key:"_getConversationLastMessageSequence",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),n=e.lastMessage.lastSequence;return t&&n0)if(a.type===E.CONV_C2C&&0===n.readAllC2CMessage){if(o===E.READ_ALL_MSG)n.readAllC2CMessage=1;else if(o===E.READ_ALL_C2C_MSG){n.readAllC2CMessage=1;break}}else if(a.type===E.CONV_GROUP&&(o===E.READ_ALL_GROUP_MSG||o===E.READ_ALL_MSG)){var i=this._getConversationLastMessageSequence(a);n.groupMessageReadInfoList.push({groupID:a.groupProfile.groupID,messageSequence:i})}}}catch(r){s.e(r)}finally{s.f()}return n}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMessageRead(e)}},{key:"_handleAllMessageRead",value:function(e){var t=e.groupMessageReadInfoList,n=e.readAllC2CMessage,o=this._parseGroupReadInfo(t);return this._updateAllConversationUnreadCount({readAllC2CMessage:n})>=1&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate()),o}},{key:"_parseGroupReadInfo",value:function(e){var t=[];if(e&&e.length)for(var n=0,o=e.length;n=1){if(1===n&&r.type===E.CONV_C2C){var u=this._getConversationLastMessageTime(r);this.updateIsReadAfterReadReport({conversationID:i,lastMessageTime:u})}else if(r.type===E.CONV_GROUP){var c=i.replace(E.CONV_GROUP,"");if(this._remoteGroupReadSequenceMap.has(c)){var l=this._remoteGroupReadSequenceMap.get(c),d=this._getConversationLastMessageSequence(r);this.updateIsReadAfterReadReport({conversationID:i,remoteReadSequence:l}),d>=l&&this._remoteGroupReadSequenceMap.delete(c)}}this.updateUnreadCount(i,!1)&&(o+=1)}}}catch(p){s.e(p)}finally{s.f()}return o}},{key:"isRemoteRead",value:function(e){var t=e.conversationID,n=e.sequence,o=t.replace(E.CONV_GROUP,""),s=!1;if(this._remoteGroupReadSequenceMap.has(o)){var a=this._remoteGroupReadSequenceMap.get(o);n<=a&&(s=!0,Ve.l("".concat(this._n,".isRemoteRead conversationID:").concat(t," messageSequence:").concat(n," remoteReadSequence:").concat(a))),n>=a+10&&this._remoteGroupReadSequenceMap.delete(o)}return s}},{key:"updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,n=e.lastMessageSeq,o=e.lastMessageTime,s=this._messageListHandler.getLocalMessageList(t);if(0!==s.length)for(var a,i=s.length-1;i>=0;i--)if(a=s[i],!(o&&a.time>o||n&&a.sequence>n)){if("in"===a.flow&&a.isRead)break;a.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!1,o=this.getLocalConversation(e),s=this._messageListHandler.getLocalMessageList(e);if(o){var a=o.unreadCount,i=s.filter((function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted})).length;if(a!==i&&(o.unreadCount=i,n=!0,Ve.l("".concat(this._n,".updateUnreadCount from ").concat(a," to ").concat(i,", conversationID:").concat(e)),!0===t&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate())),n&&o.type===E.CONV_TOPIC){var r=o.unreadCount,u=this.getModule(Fn),c=e.replace(E.CONV_GROUP,"");u.onConversationProxy({topicID:c,unreadCount:r})}return n}}},{key:"clearGroupAtInfoList",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversation(e);if(n&&n.groupAtInfoList.length>0){if(n.clearGroupAtInfoList(),Ve.l("".concat(this._n,".clearGroupAtInfoList conversationID:").concat(e)),n.type===E.CONV_TOPIC){var o=n.groupAtInfoList,s=this.getModule(Fn),a=e.replace(E.CONV_GROUP,"");s.onConversationProxy({topicID:a,groupAtInfoList:o})}!0===t&&this.emitConversationUpdate(!0,!1)}}},{key:"updateReadReceiptInfo",value:function(e){var t=this,n=e.userID,o=void 0===n?void 0:n,s=e.groupID,a=void 0===s?void 0:s,i=e.readReceiptList;if(!zt(i)){var r=[];if(it(o)){if(!it(a)){var u="".concat(E.CONV_GROUP).concat(a);i.forEach((function(e){var n=e.tinyID,o=e.clientTime,s=e.random,i=e.readCount,c=e.unreadCount,l="".concat(n,"-").concat(o,"-").concat(s),d=t._messageListHandler.getLocalMessage(u,l),p={groupID:a,messageID:l,readCount:0,unreadCount:0};d&&(et(i)&&(d.readReceiptInfo.readCount=i,p.readCount=i),et(c)&&(d.readReceiptInfo.unreadCount=c,p.unreadCount=c),r.push(p))}))}}else{var c="".concat(E.CONV_C2C).concat(o);i.forEach((function(e){var n=e.tinyID,s=e.clientTime,a=e.random,i="".concat(n,"-").concat(s,"-").concat(a),u=t._messageListHandler.getLocalMessage(c,i);if(u){u.readReceiptInfo.isPeerRead=!0;var l={userID:o,messageID:i,isPeerRead:!0};r.push(l)}}))}r.length>0&&this.emitOuterEvent(k.MESSAGE_READ_RECEIPT_RECEIVED,r)}}},{key:"recomputeGroupUnreadCount",value:function(e){var t=e.conversationID,n=e.count,o=this.getLocalConversation(t);if(o){var s=o.unreadCount,a=s-n;a<0&&(a=0),o.unreadCount=a,Ve.l("".concat(this._n,".recomputeGroupUnreadCount from ").concat(s," to ").concat(a,", conversationID:").concat(t))}}},{key:"updateIsRead",value:function(e){var t=this.getLocalConversation(e),n=this.getLocalMessageList(e);if(t&&0!==n.length&&!Lt(t.type)){for(var o=[],s=0,a=n.length;s0){var n=this._messageListHandler.updateMessageIsPeerReadProperty(e,t);if(n.length>0&&this.emitOuterEvent(k.MESSAGE_READ_BY_PEER,n),this._conversationMap.has(e)){var o=this._conversationMap.get(e).lastMessage;zt(o)||o.fromAccount===this.getMyUserID()&&o.lastTime<=t&&!o.isPeerRead&&(o.isPeerRead=!0,this.emitConversationUpdate(!0,!1))}}}},{key:"updateMessageIsModifiedProperty",value:function(e){this._messageListHandler.updateMessageIsModifiedProperty(e)}},{key:"setCompleted",value:function(e){Ve.l("".concat(this._n,".setCompleted. conversationID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMessageKeyAndTime",value:function(e,t,n){this._roamingMessageKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:n})}},{key:"updateRoamingMessageSequence",value:function(e,t){this._roamingMessageSequenceMap.set(e,t)}},{key:"getConversationList",value:function(e){var t=this,n="getConversationList",o="".concat(this._n,".").concat(n),s="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._conversationMap.size,", options:").concat(e);if(Ve.l("".concat(o,". ").concat(s)),this._pagingStatus===$t.REJECTED){var a=new Aa(n);return a.setMessage(s),this.syncConversationList().then((function(){a.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return Ya({conversationList:n,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),Za(e)}))}if(0===this._conversationMap.size){var i=new Aa(n);return i.setMessage(s),this.syncConversationList().then((function(){i.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return Ya({conversationList:n,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),Za(e)}))}var r=this._getConversationList(e);return Ve.l("".concat(o,". returned conversation count:").concat(r.length)),Xa({conversationList:r,isSyncCompleted:this._isSyncCompleted()})}},{key:"_getConversationList",value:function(e){if(it(e))return this.getLocalConversationList();if(at(e))return 0===e.length?[]:this.getLocalConversationList().filter((function(t){return e.includes(t.conversationID)}));if(st(e)){var t=e.type,n=e.markType,o=e.groupName;return this.getLocalConversationList().filter((function(e){return(t!==E.CONV_C2C&&t!==E.CONV_GROUP||e.type===t)&&(!nt(o)||e.conversationGroupList.includes(o))&&(!et(n)||e.markList.includes(n))}))}return[]}},{key:"_handleC2CPeerReadTime",value:function(){var e,t=D(this._conversationMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],s=n[1];s.type===E.CONV_C2C&&(Ve.d("".concat(this._n,"._handleC2CPeerReadTime conversationID:").concat(o," peerReadTime:").concat(s.peerReadTime)),this.recordPeerReadTime(o,s.peerReadTime))}}catch(a){t.e(a)}finally{t.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){return this.getModule(Pn).isPagingGetCompleted()}},{key:"_getLocalGroupCount",value:function(){return this.getModule(Pn).getLocalGroupList().length}},{key:"_hasLocalGroup",value:function(e){return this.getModule(Pn).hasLocalGroup(e.replace(E.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(e){var t,n=this;if((t=this._conversationMap.has(e)?this._conversationMap.get(e):new fi({conversationID:e,type:e.slice(0,3)===E.CONV_C2C?E.CONV_C2C:E.CONV_GROUP},this.isIntl()))._isInfoCompleted||t.type===E.CONV_SYSTEM)return Xa({conversation:t});if(St(e)&&!this._hasLocalGroup(e))return Xa({conversation:t});var o="".concat(this._n,".").concat("getConversationProfile"),s=new Aa("getConversationProfile");return Ve.l("".concat(o,". conversationID:").concat(e," remark:").concat(t.remark," lastMessage:"),t.lastMessage),this._updateUserOrGroupProfileCompletely(t).then((function(a){s.setNetworkType(n.getNetworkType()).setMessage("conversationID:".concat(e," unreadCount:").concat(a.data.conversation.unreadCount)).end();var i=n.getModule(bn);if(i&&t.type===E.CONV_C2C){var r=e.replace(E.CONV_C2C,"");if(i.isMyFriend(r)){var u=i.getFriendRemark(r);t.remark!==u&&(t.remark=u,Ve.l("".concat(o,". conversationID:").concat(e," patch remark:").concat(t.remark)))}}return Ve.l("".concat(o," ok. conversationID:").concat(e)),a})).catch((function(t){return n.probeNetwork().then((function(n){var o=v(n,2),a=o[0],i=o[1];s.setError(t,a,i).setMessage("conversationID:".concat(e)).end()})),Ve.e("".concat(o," failed. error:"),t),Za(t)}))}},{key:"_updateUserOrGroupProfileCompletely",value:function(e){var t=this;return e.type===E.CONV_C2C?this.getModule(Gn).getUserProfile({userIDList:[e.toAccount]}).then((function(n){var o=n.data;return 0===o.length?Za(new ja({code:ha.USER_OR_GROUP_NOT_FOUND})):(e.userProfile=o[0],e._isInfoCompleted=!0,t._unshiftConversation(e),Xa({conversation:e}))})):this.getModule(Pn).getGroupProfile({groupID:e.toAccount}).then((function(n){return e.groupProfile=n.data.group,e._isInfoCompleted=!0,t._unshiftConversation(e),Xa({conversation:e})}))}},{key:"_unshiftConversation",value:function(e){e instanceof fi&&!this._conversationMap.has(e.conversationID)&&(this._conversationMap=new Map([[e.conversationID,e]].concat(m(this._conversationMap))),this._setStorageConversationList(),this.emitConversationUpdate(!0,!1))}},{key:"_onProfileUpdated",value:function(e){var t=this;e.data.forEach((function(e){var n=e.userID;if(n===t.getMyUserID())t._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar});else{var o=t._conversationMap.get("".concat(E.CONV_C2C).concat(n));o&&(o.userProfile=e)}}))}},{key:"_isSyncCompleted",value:function(){return this._pagingStatus===$t.RESOLVED}},{key:"_errorLog",value:function(e,t,n,o){var s=new Error("Params validate failed."),a="".concat(this.getErrorMessage("API_REFER")).concat(e);throw Ve.w("[".concat(e,"] | ").concat(t," | ").concat(this.getErrorMessage(n,o),", ").concat(a)),Ve.e("[".concat(e,"] Invalid ").concat(t,": type check failed for ").concat(t,".")),s}},{key:"_isValidConversationID",value:function(e){return Et(e)||St(e)||Lt(e)}},{key:"deleteConversation",value:function(e){var t=this,n="deleteConversation";return nt(e)||ot(e)||this._errorLog(n,"options","StringOrObjectRequiredLog"),nt(e)?(this._isValidConversationID(e)||this._errorLog(n,"options","InvalidConversationID",e),Ve.l("".concat(this._n,".").concat(n," conversationID:").concat(e)),this.deleteConversationList({conversationIDList:[e],flag:1})):(at(e.conversationIDList)||this._errorLog(n,"conversationIDList","ArrayRequiredLog"),0===e.conversationIDList.length&&this._errorLog(n,"conversationIDList","NonEmptyArrayLog"),e.conversationIDList.forEach((function(e){t._isValidConversationID(e)||t._errorLog(n,"conversationIDList","InvalidConversationID",e)})),"clearHistoryMessage"in e&&"boolean"!=typeof e.clearHistoryMessage&&this._errorLog(n,"clearHistoryMessage","BooleanRequiredLog"),e.conversationIDList.length>100&&(e.conversationIDList=e.conversationIDList.slice(0,100)),this.deleteConversationList(e))}},{key:"deleteConversationList",value:function(e){var t=this,n=e.conversationIDList,o=void 0===n?[]:n,s=e.clearHistoryMessage,a=void 0===s||s,i=e.flag,r=void 0===i?0:i,u="".concat(this._n,".").concat("deleteConversationList");Ve.l("".concat(u," conversationIDList.length:").concat(o.length," clearHistoryMessage:").concat(a));var c=new Aa("deleteConversationList");return c.setMessage("conversationIDList:".concat(o)),Promise.all([this.rmLocalOnlyConversationList(o),this.rmLocalAndRemoteConversationList(o,a)]).then((function(e){c.setNetworkType(t.getNetworkType()).end();var n=[].concat(m(e[0]),m(e[1]));return 0===n.length?Za(new ja({code:ha.CONVERSATION_NOT_FOUND})):(Ve.l("".concat(u," ok")),Xa(1===r?{conversationID:n[0]}:{conversationIDList:n}))})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),Ve.e("".concat(u," failed. error:"),e),Za(e)}))}},{key:"rmLocalOnlyConversationList",value:function(e){var t=this;return e.filter((function(e){if(!t._conversationMap.has(e))return!1;var n=t.getLocalConversation(e).type;return n!==E.CONV_GROUP||t._hasLocalGroup(e)?n===E.CONV_SYSTEM&&(t.getModule(Pn).deleteGroupSystemNotice({messageList:t._messageListHandler.getLocalMessageList(e)}),t.deleteLocalConversation(e),!0):(t.deleteLocalConversation(e),!0)}))}},{key:"rmLocalAndRemoteConversationList",value:function(e,t){var n=this,o={fromAccount:this.getMyUserID(),conversationList:[],clearHistoryMessage:t?1:0};return e.forEach((function(e){if(n._conversationMap.has(e)){var t=n.getLocalConversation(e).type;t===E.CONV_C2C?o.conversationList.push({toAccount:e.replace(t,""),type:1}):t===E.CONV_GROUP&&n._hasLocalGroup(e)&&o.conversationList.push({toGroupID:e.replace(t,""),type:2})}})),0===o.conversationList.length?[]:this.request({protocolName:Po,requestData:o}).then((function(e){var t=[];return e.data.resultList.length>0&&e.data.resultList.map((function(e){if(0===e.code){var n=1===e.type?"".concat(E.CONV_C2C).concat(e.to):"".concat(E.CONV_GROUP).concat(e.groupID);t.push(n)}})),n.deleteLocalConversationList(t),t}))}},{key:"clearHistoryMessage",value:function(e){var t=this,n={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e))return Za({code:ha.CONVERSATION_NOT_FOUND});var o=this._conversationMap.get(e).type;if(o===E.CONV_C2C)n.type=1,n.toAccount=e.replace(E.CONV_C2C,"");else{if(o!==E.CONV_GROUP)return o===E.CONV_SYSTEM?(this.getModule(Pn).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),Xa({conversationID:e})):Za({code:ha.CONVERSATION_UN_RECORDED_TYPE});n.type=2,n.toGroupID=e.replace(E.CONV_GROUP,"")}var s="".concat(this._n,".").concat("clearHistoryMessage"),a=new Aa("clearHistoryMessage");return a.setMessage("conversationID:".concat(e)),Ve.l("".concat(s,". conversationID:").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:bo,requestData:n})})).then((function(){a.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(s," ok")),t._messageListHandler.removeByConversationID(e),t.setCompleted(e);var n=t.getLocalConversation(e);return n&&(n.updateLastMessage(),t._sortConversationListAndEmitEvent()),Xa({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(s," failed. error:"),e),Za(e)}))}},{key:"pinConversation",value:function(e){var t=this,n=e.conversationID,o=e.isPinned;if(!this._conversationMap.has(n))return Za({code:ha.CONVERSATION_NOT_FOUND});var s=this.getLocalConversation(n);if(s.isPinned===o)return Xa({conversationID:n});var a="".concat(this._n,".").concat("pinConversation"),i=new Aa("pinConversation");i.setMessage("conversationID:".concat(n," isPinned:").concat(o)),Ve.l("".concat(a,". conversationID:").concat(n," isPinned:").concat(o));var r=null;return Et(n)?r={type:1,toAccount:n.replace(E.CONV_C2C,"")}:St(n)&&(r={type:2,groupID:n.replace(E.CONV_GROUP,"")}),this.request({protocolName:wo,requestData:{fromAccount:this.getMyUserID(),operationType:!0===o?1:2,itemList:[r]}}).then((function(){return i.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(a," ok")),s.isPinned!==o&&(s.isPinned=o,t._sortConversationListAndEmitEvent()),Ya({conversationID:n})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.e("".concat(a," failed. error:"),e),Za(e)}))}},{key:"setMessageRemindType",value:function(e){return this._messageRemindHandler.set(e)}},{key:"patchMessageRemindType",value:function(e){var t=e.ID,n=e.isC2CConversation,o=e.messageRemindType,s=!1,a=this.getLocalConversation(n?"".concat(E.CONV_C2C).concat(t):"".concat(E.CONV_GROUP).concat(t));return a&&a.messageRemindType!==o&&(a.messageRemindType=o,s=!0),Ve.d("".concat(this._n,".patchMessageRemindType options:"),e,"ret:".concat(s)),s}},{key:"onC2CMessageRemindTypeSynced",value:function(e){var t=this,n="".concat(this._n,".onC2CMessageRemindTypeSynced");Ve.d(n,e),e.dataList.forEach((function(e){if(!zt(e.muteNotificationsSync)){var o,s=e.muteNotificationsSync,a=s.to,i=s.updateSequence,r=s.muteFlag;t._messageRemindHandler.setUpdateSequence(i),0===r?o=E.MSG_REMIND_ACPT_AND_NOTE:1===r?o=E.MSG_REMIND_DISCARD:2===r&&(o=E.MSG_REMIND_ACPT_NOT_NOTE);var u=0;t.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:o})&&(u+=1),Ve.l("".concat(n," updateCount:").concat(u)),u>=1&&t.emitConversationUpdate(!0,!1)}}))}},{key:"onGroupMessageRemindTypeSynced",value:function(e){Ve.d("".concat(this._n,".onGroupMessageRemindTypeSynced options:"),e),this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e)}},{key:"deleteLocalConversation",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._conversationMap.has(e);if(Ve.d("".concat(this._n,".deleteLocalConversation conversationID:").concat(e," has:").concat(n)),n&&(this._conversationMap.delete(e),this._roamingMessageKeyAndTimeMap.has(e)&&this._roamingMessageKeyAndTimeMap.delete(e),this._roamingMessageSequenceMap.has(e)&&this._roamingMessageSequenceMap.delete(e),this._setStorageConversationList(),this._messageListHandler.removeByConversationID(e),this._completedMap.delete(e),t)){var o=!this._isTopicConversation(e);this.emitConversationUpdate(o,!1)}}},{key:"deleteLocalConversationList",value:function(e){var t=this,n=0,o=!1;e.forEach((function(e){t._conversationMap.has(e)&&(n+=t._conversationMap.get(e).unreadCount||0,t.deleteLocalConversation(e,!1),o=!0)})),Ve.l("".concat(this._n,".deleteLocalConversationList conversationIDList.length:").concat(e.length," isConvIDExisted:").concat(o)),o&&(this.emitConversationUpdate(!0,!1),n>0&&this.emitTotalUnreadMessageCountUpdate())}},{key:"isMessageSentByCurrentInstance",value:function(e){return!(!this._messageListHandler.hasLocalMessage(e.conversationID,e.ID)&&!this.singlyLinkedList.has(e.random))}},{key:"modifyMessageList",value:function(e){if(e.startsWith(E.CONV_C2C)&&this._conversationMap.has(e)){var t=this._conversationMap.get(e),n=Date.now();this._messageListHandler.modifyMessageSentByPeer({conversationID:e,latestNick:t.userProfile.nick,latestAvatar:t.userProfile.avatar});var o=this.getModule(Gn).getNickAndAvatarByUserID(this.getMyUserID());this._messageListHandler.modifyMessageSentByMe({conversationID:e,latestNick:o.nick,latestAvatar:o.avatar}),Ve.l("".concat(this._n,".modifyMessageList conversationID:").concat(e," cost ").concat(Date.now()-n," ms"))}}},{key:"updateUserProfileSpecifiedKey",value:function(e){Ve.l("".concat(this._n,".updateUserProfileSpecifiedKey options:"),e);var t=e.conversationID,n=e.nick,o=e.avatar;if(this._conversationMap.has(t)){var s=this._conversationMap.get(t).userProfile;nt(n)&&s.nick!==n&&(s.nick=n),nt(o)&&s.avatar!==o&&(s.avatar=o),this.emitConversationUpdate(!0,!1)}}},{key:"_onMyProfileModified",value:function(e){var n=this,o=this.getLocalConversationList(),s=Date.now();o.forEach((function(o){n.modifyMessageSentByMe(t({conversationID:o.conversationID},e))})),Ve.l("".concat(this._n,"._onMyProfileModified. modify all messages sent by me, cost ").concat(Date.now()-s," ms"))}},{key:"modifyMessageSentByMe",value:function(e){this._messageListHandler.modifyMessageSentByMe(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._messageListHandler.getLatestMessageSentByMe(e)}},{key:"modifyMessageSentByPeer",value:function(e){this._messageListHandler.modifyMessageSentByPeer(e)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._messageListHandler.getLatestMessageSentByPeer(e)}},{key:"pushIntoNoticeResult",value:function(e,t){return!(!this._messageListHandler.pushIn(t)||this.singlyLinkedList.has(t.random))&&(e.push(t),!0)}},{key:"getLocalLastMessage",value:function(e){return this._messageListHandler.getLocalLastMessage(e)}},{key:"checkAndPatchRemark",value:function(){var e=Promise.resolve();if(0===this._conversationMap.size)return e;var t=this.getModule(bn);if(!t)return e;var n=m(this._conversationMap.values()).filter((function(e){return e.type===E.CONV_C2C}));if(0===n.length)return e;var o=0;return n.forEach((function(e){var n=e.conversationID.replace(E.CONV_C2C,"");if(t.isMyFriend(n)){var s=t.getFriendRemark(n);e.remark!==s&&(e.remark=s,o+=1)}})),Ve.l("".concat(this._n,".checkAndPatchRemark. c2c conversation count:").concat(n.length,", patched count:").concat(o)),e}},{key:"updateTopicConversation",value:function(e){this._updateLocalConversationList({conversationOptionsList:e,isFromGetConversations:!0})}},{key:"sendReadReceipt",value:function(e){var t=e[0],n=null;return t.conversationType===E.CONV_C2C?n=this._m.getModule(Un):t.conversationType===E.CONV_GROUP&&(n=this._m.getModule(Pn)),n?n.sendReadReceipt(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"getReadReceiptList",value:function(e){var t=e[0],n=null;return t.conversationType===E.CONV_C2C?n=this._m.getModule(Un):t.conversationType===E.CONV_GROUP&&(n=this._m.getModule(Pn)),n?n.getReadReceiptList(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"getLastMessageTime",value:function(e){var t=this.getLocalConversation(e);return t?t.lastMessage.lastTime:0}},{key:"getTotalUnreadMessageCount",value:function(){var e=this.getLocalConversationList(),t=0;return e.forEach((function(e){e.type!==E.CONV_SYSTEM&&(""!==e.messageRemindType&&e.messageRemindType!==E.MSG_REMIND_ACPT_AND_NOTE||(t+=e.unreadCount))})),t}},{key:"emitTotalUnreadMessageCountUpdate",value:function(){var e=this.getTotalUnreadMessageCount();this._convTotalUnreadCount!==e&&(Ve.l("".concat(this._n,".emitTotalUnreadMessageCountUpdate from ").concat(this._convTotalUnreadCount," to ").concat(e)),this._convTotalUnreadCount=e,this.emitOuterEvent(k.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._pagingStatus=$t.NOT_START,this._messageListHandler.reset(),this._messageRemindHandler.reset(),this._roamingMessageKeyAndTimeMap.clear(),this._roamingMessageSequenceMap.clear(),this.singlyLinkedList.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._conversationMap.clear(),this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._remoteGroupReadSequenceMap.clear(),this._convTotalUnreadCount=0,this._pagingGetCostList.length=0,this.resetReady()}}]),s}(uo),yi=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupTipsHandler",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map}return a(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupTipsMap.size>0&&this._checkCachedGroupTips()}},{key:"_checkCachedGroupTips",value:function(){var e=this;this._cachedGroupTipsMap.forEach((function(t,n){var o=e._checkCountMap.get(n),s=e._groupModule.hasLocalGroup(n);Ve.l("".concat(e._n,"._checkCachedGroupTips groupID:").concat(n," hasLocalGroup:").concat(s," checkCount:").concat(o)),s?(e._notifyCachedGroupTips(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"onNewGroupTips",value:function(e){Ve.d("".concat(this._n,".onReceiveGroupTips count:").concat(e.dataList.length));var t=this.newGroupTipsStoredAndSummary(e),n=t.eventDataList,o=t.result,s=t.AVChatRoomMessageList;(s.length>0&&this._groupModule.onAVChatRoomMessage(s),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(qn).onNewMessage({conversationOptionsList:n,isInstantMessage:!0}));o.length>0&&(this._groupModule.emitOuterEvent(k.MESSAGE_RECEIVED,o),this.handleMessageList(o))}},{key:"newGroupTipsStoredAndSummary",value:function(e){for(var n=this,o=e.event,s=e.dataList,a=null,i=[],r=[],u={},c=[],l=function(e,l){var d=It(s[e]);if(6===o){if(n._groupModule.isGroupAttributesUpdatedNotice(d))return"continue";if(n._groupModule.isGroupCountersNotice(d))return"continue"}var p=d.groupProfile,g=p.groupID,h=p.communityType,_=void 0===h?0:h,f=p.topicID,v=void 0===f?void 0:f,m=p.invisible,M=void 0,y=n._groupModule.isMessageFromTopic(_,v);if(y){M=E.CONV_TOPIC,d.to=v;var I=n._groupModule.getModule(Fn);I.hasLocalTopic(g,v)||n._getTopicPendingMap.has(v)||(n._getTopicPendingMap.set(v,1),I.getTopicList({groupID:g,topicIDList:[v]}).finally((function(){n._getTopicPendingMap.delete(v)})))}var C=n._groupModule.hasLocalGroup(g);if(!C&&n._groupModule.isUnjoinedAVChatRoom(g))return"continue";if(!C&&!y)return n._cacheGroupTipsAndProbe({groupID:g,event:o,item:d}),"continue";if(n._groupModule.isMessageFromOrToAVChatroom(g))return d.event=o,c.push(d),"continue";if(d.currentUser=n._groupModule.getMyUserID(),d.conversationType=E.CONV_GROUP,(a=new Wa(d)).setElement({type:E.MSG_GRP_TIP,content:t(t({},d.elements),{},{groupProfile:d.groupProfile})}),a.isSystemMessage=!1,1===m)return n._qualityStat(a),"continue";var T=n._groupModule.getModule(qn),D=a,k=D.conversationID,S=D.sequence;if(6===o)a._onlineOnlyFlag=!0,r.push(a);else if(!T.pushIntoNoticeResult(r,a))return"continue";if(n._groupModule.isMessageFromCommunityOfTopic(_,v))return"continue";if(6===o&&T.getLocalConversation(k))return"continue";6!==o&&n._qualityStat(a);var L=T.isRemoteRead({conversationID:k,sequence:S});if(it(u[k])){var A=0;"in"===a.flow&&(a._isExcludedFromUnreadCount||a._onlineOnlyFlag||L||(A=1)),u[k]=i.push({conversationID:k,unreadCount:A,type:it(M)?a.conversationType:M,subType:a.conversationSubType,lastMessage:a._isExcludedFromLastMessage?"":a})-1}else{var R=u[k];i[R].type=a.conversationType,i[R].subType=a.conversationSubType,i[R].lastMessage=a._isExcludedFromLastMessage?"":a,"in"===a.flow&&(a._isExcludedFromUnreadCount||a._onlineOnlyFlag||L||i[R].unreadCount++)}},d=0,p=s.length;d=0){u.updateSelfInfo({muteTime:d.muteTime}),c=!0;break}}c&&this._groupModule.emitOuterEvent(k.TOPIC_UPDATED,{groupID:r,topic:u})}}},{key:"_onTopicProfileUpdated",value:function(e){var n=e.payload,o=n.groupProfile.groupID,s=n.newTopicInfo;this._groupModule.getModule(Fn).onTopicProfileUpdated(t({groupID:o,topicID:e.to},s))}},{key:"_cacheGroupTips",value:function(e,t){this._cachedGroupTipsMap.has(e)||this._cachedGroupTipsMap.set(e,[]),this._cachedGroupTipsMap.get(e).push(t)}},{key:"_deleteCachedGroupTips",value:function(e){this._cachedGroupTipsMap.has(e)&&this._cachedGroupTipsMap.delete(e)}},{key:"_notifyCachedGroupTips",value:function(e){var t=this,n=this._cachedGroupTipsMap.get(e)||[];n.forEach((function(e){t.onNewGroupTips(e)})),this._deleteCachedGroupTips(e),Ve.l("".concat(this._n,"._notifyCachedGroupTips groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupTipsAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,s=e.item;this._cacheGroupTips(n,{event:o,dataList:[s]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===E.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupTips(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupTips(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),Ve.l("".concat(this._n,"._cacheGroupTipsAndProbe groupID:").concat(n))}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear()}}]),e}(),Ii=function(){function e(t){o(this,e),this._groupModule=t,this._n="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map,this._isPagingGetCompleted=!1,t.getInnerEmitterInstance().once(ei,this._initGroupList,this)}return a(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupMessageMap.size>0&&this._checkCachedGroupMessage()}},{key:"_checkCachedGroupMessage",value:function(){var e=this;this._cachedGroupMessageMap.forEach((function(t,n){var o=e._checkCountMap.get(n),s=e._groupModule.hasLocalGroup(n);Ve.l("".concat(e._n,"._checkCachedGroupMessage groupID:").concat(n," hasLocalGroup:").concat(s," checkCount:").concat(o)),s?(e._notifyCachedGroupMessage(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"_initGroupList",value:function(){var e=this;Ve.l("".concat(this._n,"._initGroupList"));var t=new Aa("getGroupListInStorage"),n=this._groupModule.getStorageGroupList();if(at(n)&&n.length>0){n.forEach((function(t){e._groupModule.initGroupMap(t)})),this._groupModule.emitGroupListUpdate(!0,!1);var o=this._groupModule.getLocalGroupList().length;t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:".concat(o)).end()}else t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:0").end();Ve.l("".concat(this._n,"._initGroupList ok"))}},{key:"handleUpdateGroupLastMessage",value:function(e){var n="".concat(this._n,".handleUpdateGroupLastMessage");if(Ve.l("".concat(n," conversation count:").concat(e.length,", local group count:").concat(this._groupModule.getLocalGroupList().length)),0!==this._groupModule.getGroupMap().size){for(var o,s,a,i=!1,r=0,u=e.length;r0&&this._groupModule.onAVChatRoomMessage(s),this._groupModule.filterModifiedMessage(o),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(qn).onNewMessage({conversationOptionsList:n,isInstantMessage:e.isInstantMessage||!0,updateUnreadCount:e.updateUnreadCount||!0}));var a=this._groupModule.filterUnmodifiedMessage(o);a.length>0&&this._groupModule.emitOuterEvent(k.MESSAGE_RECEIVED,a),o.length=0}},{key:"_newGroupMessageStoredAndSummary",value:function(e){var t=this,n=e.dataList,o=e.event,s=e.isInstantMessage,a=null,i=[],r=[],u=[],c={},l=this._groupModule.getModule(Kn),d=this._groupModule.getFileDownloadProxy(),p=n.length;p>1&&n.sort((function(e,t){return e.sequence-t.sequence}));for(var g=function(e){var p=It(n[e]),g=p.groupProfile,h=g.groupID,_=g.communityType,f=void 0===_?0:_,v=g.topicID,m=void 0===v?void 0:v,M=g.invisible,y=void 0,I=t._groupModule.isMessageFromTopic(f,m);if(I){y=E.CONV_TOPIC,p.to=m;var C=t._groupModule.getModule(Fn);C.hasLocalTopic(h,m)||t._getTopicPendingMap.has(m)||(t._getTopicPendingMap.set(m,1),C.getTopicList({groupID:h,topicIDList:[m]}).finally((function(){t._getTopicPendingMap.delete(m)})))}var T=t._groupModule.hasLocalGroup(h);if(!T&&t._groupModule.isUnjoinedAVChatRoom(h))return"continue";if(!T&&!I)return t._cacheGroupMessageAndProbe({groupID:h,event:o,item:p}),"continue";if(t._groupModule.isMessageFromOrToAVChatroom(h))return p.event=o,u.push(p),"continue";if(p.currentUser=t._groupModule.getMyUserID(),p.conversationType=E.CONV_GROUP,p.isSystemMessage=!!p.isSystemMessage,a=new Wa(p),p.elements=l.parseElements(p.elements,p.from),a.setElement(p.elements,d),1===M)return t._qualityStat(s,a),"continue";var D=1===n[e].isModified,k=t._groupModule.getModule(qn);if(k.isMessageSentByCurrentInstance(a)?a.isModified=D:D=!1,1===p.onlineOnlyFlag)a._onlineOnlyFlag=!0,k.isMessageSentByCurrentInstance(a)||r.push(a);else{if(t._groupModule.isMessageFromCommunityOfTopic(f,m))return r.push(a),"continue";if(!k.pushIntoMessageList(r,a,D))return"continue";t._qualityStat(s,a);var S=a,L=S.conversationID,A=S.sequence,R=k.isRemoteRead({conversationID:L,sequence:A});if(it(c[L])){var N=0;"in"===a.flow&&(a._isExcludedFromUnreadCount||R||(N=1)),c[L]=i.push({conversationID:L,unreadCount:N,type:it(y)?a.conversationType:y,subType:a.conversationSubType,lastMessage:a._isExcludedFromLastMessage?"":a})-1}else{var O=c[L];i[O].type=it(y)?a.conversationType:y,i[O].subType=a.conversationSubType,i[O].lastMessage=a._isExcludedFromLastMessage?"":a,"in"===a.flow&&(a._isExcludedFromUnreadCount||R||i[O].unreadCount++)}}},h=0;h0&&n.addMessageDelay(t.clientTime)}},{key:"onGroupMessageRevoked",value:function(e){var t=this._groupModule.getModule(qn),n=[],o=null,s=!0;e.dataList.forEach((function(e){var a=e.elements.revokedInfos;it(a)||a.forEach((function(e){var a=zt(e.topicID)?"GROUP".concat(e.groupID):"GROUP".concat(e.topicID);o=t.revoke(a,e.sequence,e.random);var i=e.revokerInfo&&e.revokerInfo.revoker;if(o)o.revoker=i,n.push(o);else{var r={conversationID:a,to:e.topicID||"",sequence:e.sequence,time:e.time,revoker:i};t.isLastMessageRevoked(r)&&(n.push(r),s=!1)}}))})),0!==n.length&&(t.onMessageRevoked(n),!0===s&&(Ve.l("".concat(this._n,".onGroupMessageRevoked count:").concat(n.length)),this._groupModule.emitOuterEvent(k.MESSAGE_REVOKED,n)))}},{key:"_groupListTreeShaking",value:function(e){for(var t=new Map(m(this._groupModule.getGroupMap())),n=0,o=e.length;ng),_="offset:".concat(u," totalCount:").concat(p," isCompleted:").concat(h," ")+"currentCount:".concat(l.length," isCommunityRelay:").concat(s);return d.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(_)).end(),s||h?!s&&h?(Ve.l("".concat(n," start to get community list")),u=0,t._pagingGetGroupList({limit:r,offset:u,groupBaseInfoFilter:c,groupList:l,isCommunityRelay:!0})):s&&!h?(u=g,t._pagingGetGroupList({limit:r,offset:u,groupBaseInfoFilter:c,groupList:l,isCommunityRelay:!0})):(Ve.l("".concat(n," ok. totalCount:").concat(l.length)),Ya({groupList:l})):(u=g,t._pagingGetGroupList({limit:r,offset:u,groupBaseInfoFilter:c,groupList:l}))})).catch((function(e){return 11e3!==e.code&&t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];d.setMessage("isCommunityRelay:".concat(s)).setError(e,o,a).end()})),s?(11e3===e.code&&(d=null,Ve.l("".concat(n," ok. community unavailable"))),Xa({groupList:l})):Za(e)}))}},{key:"_pagingGetGroupListWithTopic",value:function(e){var t=this,n="".concat(this._n,"._pagingGetGroupListWithTopic"),o=e.limit,s=e.offset,a=e.groupBaseInfoFilter,i=e.groupList,r=new Aa("pagingGetGroupListWithTopic");return this._groupModule.request({protocolName:jo,requestData:{type:E.GRP_COMMUNITY,memberAccount:this._groupModule.getMyUserID(),limit:o,offset:s,responseFilter:{groupBaseInfoFilter:a,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]},isSupportTopic:1}}).then((function(e){var u=e.data,c=u.groups,l=void 0===c?[]:c,d=u.totalCount;i.push.apply(i,m(l));var p=s+o,g=!(d>p),h="offset:".concat(s," totalCount:").concat(d," isCompleted:").concat(g," ")+"currentCount:".concat(i.length);return r.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(h)).end(),g?(Ve.l("".concat(n," ok. totalCount:").concat(i.length)),Ya({groupList:i})):(s=p,t._pagingGetGroupListWithTopic({limit:o,offset:s,groupBaseInfoFilter:a,groupList:i}))})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Za(e)}))}},{key:"_cacheGroupMessage",value:function(e,t){this._cachedGroupMessageMap.has(e)||this._cachedGroupMessageMap.set(e,[]),this._cachedGroupMessageMap.get(e).push(t)}},{key:"_deleteCachedGroupMessage",value:function(e){this._cachedGroupMessageMap.has(e)&&this._cachedGroupMessageMap.delete(e)}},{key:"_notifyCachedGroupMessage",value:function(e){var t=this,n=this._cachedGroupMessageMap.get(e)||[];n.forEach((function(e){t.onNewGroupMessage(e)})),this._deleteCachedGroupMessage(e),Ve.l("".concat(this._n,"._notifyCachedGroupMessage groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupMessageAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,s=e.item;this._cacheGroupMessage(n,{event:o,dataList:[s]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===E.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupMessage(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupMessage(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),Ve.l("".concat(this._n,"._cacheGroupMessageAndProbe groupID:").concat(n))}},{key:"_handleGroupAtInfoWithoutTopic",value:function(e,n){var o=this;e&&0!==n.length&&n.forEach((function(e){var n=e.groupID,s=e.groupAtInfoList,a=[];it(s)||(s.forEach((function(e){a.push(t(t({},e),{},{groupID:n}))})),o._groupModule.getModule(qn).onNewGroupAtTips({dataList:a}))}))}},{key:"reset",value:function(){this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear(),this._isPagingGetCompleted=!1,this._groupModule.getInnerEmitterInstance().once(ei,this._initGroupList,this)}}]),e}(),Ci=1,Ti=2,Di=3,ki=4,Ei=5,Si=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupAttributesHandler",this._groupAttributesMap=new Map,this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(ti,this._onCloudConfigUpdated,this)}return a(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_attr_cache_time");it(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesMap.forEach((function(e){e.localMainSequence=0}))}},{key:"isGroupAttributesUpdatedNotice",value:function(e){var t=e.to,n=e.elements.newGroupProfile,o=!it(n)&&!zt(n.groupAttributeOption);return o&&this._onGroupAttributesUpdated({groupID:t,groupAttributeOption:n.groupAttributeOption}),o}},{key:"_onGroupAttributesUpdated",value:function(e){var t=this,n=e.groupID,o=e.groupAttributeOption,s=o.mainSequence,a=o.isWithChangedAttributeInfo,i=o.groupAttributeList,r=void 0===i?[]:i,u=o.operationType;if(Ve.l("".concat(this._n,".onGroupAttributesUpdated. ")+"groupID:".concat(n," isWithChangedAttributeInfo:").concat(a," operationType:").concat(u)),!it(u)){this._groupAttributesCopy=this._getCachedAttributes({groupID:n});var c=s-this._getLocalGroupAttributes(n).localMainSequence;if(0!==c){if(1===a&&1===c)return this._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:s,groupAttributeList:r,operationType:u}),void this._emitGroupAttributesUpdated(n);if(this._hasLocalGroupAttributes(n)){var l=this._getLocalGroupAttributes(n).avChatRoomKey;this._getGroupAttributes({groupID:n,avChatRoomKey:l}).then((function(){t._emitGroupAttributesUpdated(n)}))}}}}},{key:"initGroupAttributesCache",value:function(e){var t=e.groupID,n=e.avChatRoomKey,o=void 0===n?void 0:n;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:o}),Ve.l("".concat(this._n,".initGroupAttributesCache groupID:").concat(t," avChatRoomKey:").concat(o))}},{key:"initGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.groupAttributes,s=this._getLocalGroupAttributes(n),a=s.remoteMainSequence,i=s.avChatRoomKey,r=new Aa("initGroupAttributes");return r.setMessage("groupID:".concat(n," avChatRoomKey:").concat(i," mainSequence:").concat(a)),this._groupModule.request({protocolName:Is,requestData:{groupID:n,avChatRoomKey:i,mainSequence:a,groupAttributeList:this._transformGroupAttributes(o)}}).then((function(e){Ve.l("".concat(t._n,".").concat("initGroupAttributes"," ok. groupID:").concat(n));var s=e.data,a=s.mainSequence,i=m(s.groupAttributeList);return i.forEach((function(e){e.value=o[e.key]})),t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:a,groupAttributeList:i,operationType:Ci}),t._emitGroupAttributesUpdated(n),r.setNetworkType(t._groupModule.getNetworkType()).end(),Ya({groupAttributes:o})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Za(e)}))}},{key:"setGroupAttributes",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupAttributes"),o=e.groupID,s=e.groupAttributes,a=this._getLocalGroupAttributes(o),i=a.remoteMainSequence,r=a.avChatRoomKey,u=a.attributes,c=this._transformGroupAttributes(s);c.forEach((function(e){var t=e.key;e.sequence=0,u.has(t)&&(e.sequence=u.get(t).sequence)}));var l=new Aa("setGroupAttributes");return l.setMessage("groupID:".concat(o," groupAttributes:").concat(JSON.stringify(s))),Ve.l("".concat(n,". groupID:").concat(o," mainSequence:").concat(i)),this._groupModule.request({protocolName:Cs,requestData:{groupID:o,avChatRoomKey:r,mainSequence:i,groupAttributeList:c}}).then((function(e){Ve.l("".concat(n," ok."));var a=e.data,i=a.mainSequence,r=m(a.groupAttributeList);return r.forEach((function(e){e.value=s[e.key]})),t._groupAttributesCopy=t._getCachedAttributes({groupID:o}),t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:i,groupAttributeList:r,operationType:Ti}),t._emitGroupAttributesUpdated(o),l.setNetworkType(t._groupModule.getNetworkType()).end(),Ya({groupAttributes:s})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),Za(e)}))}},{key:"deleteGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.keyList,s=void 0===o?[]:o,a=this._getLocalGroupAttributes(n),i=a.remoteMainSequence,r=a.avChatRoomKey,u=a.attributes,c=m(u.keys()),l=Ds,d=Di,p={groupID:n,avChatRoomKey:r,mainSequence:i},g=[];s.length>0&&(c=[],l=Ts,d=ki,s.forEach((function(e){var t=0;u.has(e)&&(t=u.get(e).sequence,c.push(e)),g.push({key:e,sequence:t})})),p.groupAttributeList=g);var h=new Aa("deleteGroupAttributes");return h.setMessage("groupID:".concat(n," mainSequence:").concat(i," keyList:").concat(s," protocolName:").concat(l)),this._groupModule.request({protocolName:l,requestData:p}).then((function(e){Ve.l("".concat(t._n,".").concat("deleteGroupAttributes"," ok. groupID:").concat(n));var o=e.data.mainSequence;return t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:o,groupAttributeList:g,operationType:d}),t._emitGroupAttributesUpdated(n),h.setNetworkType(t._groupModule.getNetworkType()).end(),Ya({keyList:c})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];h.setError(e,o,s).end()})),Za(e)}))}},{key:"getGroupAttributes",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupAttributes"),o=e.groupID,s=this._getLocalGroupAttributes(o),a=s.avChatRoomKey,i=s.lastUpdateTime,r=s.localMainSequence,u=s.remoteMainSequence,c=new Aa("getGroupAttributes");if(c.setMessage("groupID:".concat(o," localMainSequence:").concat(r," remoteMainSequence:").concat(u," keyList:").concat(e.keyList)),Date.now()-i>=this.CACHE_EXPIRE_TIME||r0)o.forEach((function(e){a.has(e)&&(s[e]=a.get(e).value)}));else{var i,r=D(a.keys());try{for(r.s();!(i=r.n()).done;){var u=i.value;s[u]=a.get(u).value}}catch(c){r.e(c)}finally{r.f()}}}return s}},{key:"_updateCachedAttributes",value:function(e){var t=e.groupAttributes,n=e.groupAttributeList,o=e.operationType;o!==Di?o!==ki?(o===Ci&&t.attributes.clear(),n.forEach((function(e){var n=e.key,o=e.value,s=e.sequence;t.attributes.set(n,{value:o,sequence:s})}))):n.forEach((function(e){t.attributes.delete(e.key)})):t.attributes.clear()}},{key:"_hasLocalGroupAttributes",value:function(e){return this._groupAttributesMap.has(e)}},{key:"_getLocalGroupAttributes",value:function(e){return this._hasLocalGroupAttributes(e)||this.initGroupAttributesCache({groupID:e}),this._groupAttributesMap.get(e)}},{key:"_transformGroupAttributes",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_emitGroupAttributesUpdated",value:function(e){var t=this._getCachedAttributes({groupID:e}),n=this._computeAttrChangedInfo(t),o=n.updatedKeyList,s=n.deletedKeyList;Ve.l("".concat(this._n,"._emitGroupAttributesUpdated update:").concat(o.length,", delete:").concat(s.length)),0===o.length&&0===s.length||this._groupModule.emitOuterEvent(k.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t,updatedKeyList:o,deletedKeyList:s})}},{key:"_computeAttrChangedInfo",value:function(e){var t=this,n=[],o=[];return Object.keys(e).forEach((function(o){e[o]!==t._groupAttributesCopy[o]&&n.push(o)})),Object.keys(this._groupAttributesCopy).forEach((function(t){it(e[t])&&o.push(t)})),this._groupAttributesCopy={},{updatedKeyList:n,deletedKeyList:o}}},{key:"deleteLocalGroupAttributes",value:function(e){this._hasLocalGroupAttributes(e)&&this._groupAttributesMap.delete(e)}},{key:"reset",value:function(){this._groupAttributesMap.clear(),this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4}}]),e}(),Li="Set",Ai="Increase",Ri="Decrease",Ni=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupCountersHandler",this._groupCountersMap=new Map,this.EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(ti,this._onCloudConfigUpdated,this)}return a(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_counter_expire_time");it(e)||(this.EXPIRE_TIME=Number(e))}},{key:"isGroupCountersNotice",value:function(e){var t=e.to,n=e.elements.groupCounterInfo,o=!1;return zt(n)||(this._onGroupCountersUpdated({groupID:t,groupCounterInfo:n}),o=!0),o}},{key:"_onGroupCountersUpdated",value:function(e){var t=this,n=e.groupID;e.groupCounterInfo.forEach((function(e){var o=e.type,s=e.groupCounterSeq,a=e.counterList,i=void 0===a?[]:a;0!==o&&2!==o||(t._updateLocalGroupCounters({groupID:n,groupCounterSeq:s,counterList:i}),i.forEach((function(e){t._groupModule.emitOuterEvent(k.GROUP_COUNTER_UPDATED,{groupID:n,key:e.key,value:e.value})}))),1===o&&t._deleteLocalGroupCounters({groupID:n,groupCounterSeq:s,counterList:i})})),Ve.l("".concat(this._n,"._onGroupCountersUpdated groupID:").concat(n))}},{key:"initGroupCountersCache",value:function(e){var t=e.groupID,n=e.avChatRoomKey;this._groupCountersMap.set(t,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:n}),Ve.l("".concat(this._n,".initGroupCountersCache groupID:").concat(t," avChatRoomKey:").concat(n))}},{key:"setGroupCounters",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".setGroupCounters"),o=e.groupID,s=e.counters,a=this._convertObjectToList(s),i=this._getLocalGroupCounters(o).avChatRoomKey,r="groupID:".concat(o," count:").concat(a.length),u=new Aa("setGroupCounters");return u.setMessage("".concat(r)),Ve.l("".concat(n,". ").concat(r)),this._updateGroupCounters({groupID:o,counterList:a,avChatRoomKey:i,mode:Li}).then((function(e){return u.end(),Ve.l("".concat(n," ok.")),Ya({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"increaseGroupCounter",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".increaseGroupCounters"),o=e.groupID,s=e.key,a=e.value,i=this._getLocalGroupCounters(o).avChatRoomKey,r="groupID:".concat(o," key:").concat(s," value:").concat(a),u=new Aa("increaseGroupCounter");u.setMessage("".concat(r)),Ve.l("".concat(n,". ").concat(r));var c=[{key:s,value:a}];return this._updateGroupCounters({groupID:o,counterList:c,avChatRoomKey:i,mode:Ai}).then((function(e){return u.end(),Ve.l("".concat(n," ok.")),Ya({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"decreaseGroupCounter",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".decreaseGroupCounter"),o=e.groupID,s=e.key,a=e.value,i=this._getLocalGroupCounters(o).avChatRoomKey,r="groupID:".concat(o," key:").concat(s," value:").concat(a),u=new Aa("decreaseGroupCounter");u.setMessage("".concat(r)),Ve.l("".concat(n,". ").concat(r));var c=[{key:s,value:a}];return this._updateGroupCounters({groupID:o,counterList:c,avChatRoomKey:i,mode:Ri}).then((function(e){return u.end(),Ve.l("".concat(n," ok.")),Ya({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"getGroupCounters",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".getGroupCounters"),o=e.groupID,s=e.keyList,a=void 0===s?[]:s,i=this._getLocalGroupCounters(o),r=i.avChatRoomKey,u=i.lastUpdateTime,c=new Aa("getGroupCounters");if(c.setMessage("groupID:".concat(o)),Date.now()-u>=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:o,avChatRoomKey:r}).then((function(e){c.setMoreMessage("from remote. count:".concat(e.length)).end(),Ve.l("".concat(n," from remote. groupID:").concat(o));var s=t._getLocalCounters(o,a);return Ya({counters:s})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),Za(e)}));c.setMoreMessage("from cache").end(),Ve.l("".concat(n," from cache. groupID:").concat(o));var l=this._getLocalCounters(o,a);return Xa({counters:l})}},{key:"_getRemoteGroupCounters",value:function(e){var n=this;return this._groupModule.request({protocolName:Rs,requestData:t({},e)}).then((function(t){var o=t.data,s=o.counterList,a=void 0===s?[]:s,i=o.groupCounterSeq;return n._updateLocalGroupCounters({groupID:e.groupID,counterList:a,groupCounterSeq:i}),Ve.l("".concat(n._n,"._getRemoteGroupCounters ok. groupID:").concat(e.groupID)),a})).catch((function(e){return Za(e)}))}},{key:"_convertObjectToList",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_updateGroupCounters",value:function(e){var n="".concat(this._n,"._updateGroupCounters"),o=e.groupID,s=e.avChatRoomKey,a=e.mode;return Ve.l("".concat(n,". groupID:").concat(o," avChatRoomKey:").concat(s," mode:").concat(a)),this._groupModule.request({protocolName:As,requestData:t({},e)}).then((function(e){Ve.l("".concat(n," ok."));var t=e.data.counterList,o={};return(void 0===t?[]:t).forEach((function(e){var t=e.key,n=e.value;o[t]=n})),o})).catch((function(e){return Za(e)}))}},{key:"_hasLocalGroupCounters",value:function(e){return this._groupCountersMap.has(e)}},{key:"_getLocalGroupCounters",value:function(e){return this._hasLocalGroupCounters(e)||this.initGroupCountersCache({groupID:e}),this._groupCountersMap.get(e)}},{key:"_updateLocalGroupCounters",value:function(e){var t=e.groupID,n=e.counterList,o=void 0===n?[]:n,s=e.groupCounterSeq;if(this._hasLocalGroupCounters(t)){var a=this._getLocalGroupCounters(t),i=a.counters,r=a.avChatRoomKey,u=a.groupCounterSeq;if(s>0&&s0)t.forEach((function(e){o.has(e)&&(n[e]=o.get(e))}));else{var s,a=D(o.keys());try{for(a.s();!(s=a.n()).done;){var i=s.value;n[i]=o.get(i)}}catch(r){a.e(r)}finally{a.f()}}return n}},{key:"reset",value:function(){this._groupCountersMap.clear(),this.EXPIRE_TIME=3e4}}]),e}(),Oi=function(){function e(t){o(this,e);var n=t.manager,s=t.groupID,a=t.onInit,i=t.onSuccess,r=t.onFail;this._n="Polling",this._manager=n,this._groupModule=n._groupModule,this._onInit=a,this._onSuccess=i,this._onFail=r,this._groupID=s,this._timeoutID=-1,this._isRunning=!1,this._protocolName=fs}return a(e,[{key:"start",value:function(){var e=this._groupModule.isLoggedIn();e||(this._protocolName=vs),Ve.l("".concat(this._n,".start pollingInterval:").concat(this._manager.getPollingInterval()," isLoggedIn:").concat(e)),this._isRunning=!0,this._request()}},{key:"isRunning",value:function(){return this._isRunning}},{key:"_request",value:function(){var e=this,t=this._onInit(this._groupID);this._groupModule.request({protocolName:this._protocolName,requestData:t}).then((function(t){e._onSuccess(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.getPollingInterval()))})).catch((function(t){e._onFail(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.MAX_POLLING_INTERVAL))}))}},{key:"stop",value:function(){Ve.l("".concat(this._n,".stop")),this._timeoutID>0&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}},{key:"getPollingTimerID",value:function(){return this._timeoutID}}]),e}(),Gi={3:!0,4:!0,5:!0,6:!0,17:!0},Ui=function(){function e(t){o(this,e),this._groupModule=t,this._n="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this.sequencesLinkedList=new pi(200),this.messageIDLinkedList=new pi(100),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map,this.DEFAULT_POLLING_SIMPLIFIED_MSG=0}return a(e,[{key:"hasJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._joinedGroupMap.has(e)}},{key:"getJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0?m(this._joinedGroupMap.keys()):null}},{key:"_updateRequestData",value:function(e){var n=this._pollingRequestInfoMap.get(e);return e===m(this._pollingInstanceMap.keys())[0]?t(t({},n),{},{startBroadcastSeq:this._startBroadcastSeq,simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG}):t(t({},n),{},{simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG})}},{key:"_handleSuccess",value:function(e,t){var n=t.data,o=n.key,s=n.nextSeq,a=n.rspMsgList,i=n.errorCode,r=n.nextBroadcastSeq,u=n.broadcastMessageList;if(0!==i){var c=this._pollingRequestInfoMap.get(e),l=new Aa("longPollingAVError"),d=c?"".concat(c.key,"-").concat(c.startSeq):"requestInfo is undefined";l.setMessage("".concat(e,"-").concat(d,"-").concat(t.errorInfo)).setCode(t.errorCode).setNetworkType(this._groupModule.getNetworkType()).end(!0)}else{if(!this.checkJoinedAVChatRoomByID(e))return;nt(o)&&et(s)&&this._pollingRequestInfoMap.set(e,{key:o,startSeq:s}),et(r)&&r>this._startBroadcastSeq&&(this._startBroadcastSeq=r),at(a)&&a.length>0?(a.forEach((function(e){e.to=e.groupID})),this.onMessage(a)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(u)}}},{key:"_handleFailure",value:function(e,t){}},{key:"onMessage",value:function(e){if(at(e)&&0!==e.length){0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL);var t=null,n=[],o=this._getModule(qn),s=this._getModule(eo),a=e.length;a>1&&e.sort((function(e,t){return e.sequence-t.sequence}));for(var i=this._getModule(xn),r=0;r1&&g<=20?this._getModule(Xn).onMessageMaybeLost(d,p+1,g-1):g<-1&&g>=-20&&this._getModule(Xn).onMessageMaybeLost(d,t.sequence+1,Math.abs(g)-1)}this.sequencesLinkedList.set(t.sequence),this.messageIDLinkedList.set(t.ID);var h=!1;if(this._isMessageSentByCurrentInstance(t)?c&&(h=!0,t.isModified=c,o.updateMessageIsModifiedProperty(t)):h=!0,h){if(t.conversationType===E.CONV_SYSTEM&&5===t.payload.operationType&&this._onGroupDismissed(t.payload.groupProfile.groupID),!l&&t.conversationType!==E.CONV_SYSTEM){var _=t.conversationID.replace(E.CONV_GROUP,"");this._pollingInstanceMap.has(_)?this._groupModule.isLoggedIn()&&s.addMessageSequence({key:Da,message:t}):(t.type!==E.MSG_GRP_TIP&&t.clientTime>0&&s.addMessageDelay(t.clientTime),s.addMessageSequence({key:Ta,message:t}))}n.push(t)}}}else Ve.w("".concat(this._n,".onMessage unknown event:").concat(u.event))}if(0!==n.length){this._groupModule.filterModifiedMessage(n);var f=this.packConversationOption(n);if(f.length>0)this._getModule(qn).onNewMessage({conversationOptionsList:f,isInstantMessage:!0});Ve.d("".concat(this._n,".onMessage count:").concat(n.length)),this._checkMessageStacked(n);var v=this._groupModule.filterUnmodifiedMessage(n);v.length>0&&this._groupModule.emitOuterEvent(k.MESSAGE_RECEIVED,v),n.length=0}}}},{key:"isBroadcastOrNormal",value:function(e){return 3===e||17===e}},{key:"isGroupTip",value:function(e){return 4===e||6===e}},{key:"isGroupSystemNotice",value:function(e){return 5===e}},{key:"restoreGroupTipElements",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.groupJoinType||(e.groupJoinType=1);var t=e.operatorInfo,n=void 0===t?{}:t,o=e.operatorID,s=e.userIDList,a=void 0===s?[]:s,i=n.userID,r=void 0===i?o:i,u=n.avatar,c=void 0===u?"":u,l=n.nick,d=void 0===l?"":l;e.operatorInfo={userID:r,avatar:c,nick:d};var p=a.map((function(e){return{userID:e}}));return e.memberInfoList=e.memberInfoList||p,e}},{key:"restoreMessageFromSimplified",value:function(e){var n=e.event;if(this.isBroadcastOrNormal(n)&&(e.cloudCustomData=e.cloudCustomData||"",e.elements=e.elements.map((function(e){if(e.type===E.MSG_CUSTOM){var n=e.content,o=void 0===n?{}:n;e.content=t({data:"",description:"",extension:""},o)}return e}))),(this.isGroupTip(n)||this.isGroupSystemNotice(n))&&(e.from=e.from||"@TIM#SYSTEM"),this.isGroupTip(n)){e.elements=this.restoreGroupTipElements(e.elements);var o=e.elements,s=void 0===o?{}:o,a=s.operationType,r=s.operatorInfo;if(1===a){var u=[{userID:(void 0===r?{}:r).userID}];s.memberInfoList=s.memberInfoList||u}}if(this.isGroupSystemNotice(n)){var c=e.elements,l=c.memberInfoList,d=c.operatorInfo;l||(l=void 0===d?{}:d),e.elements.memberInfoList=t({userID:e.elements.operatorID,avatar:"",nick:""},l),e.elements=t({authentication:"",remarkInfo:"",messageKey:1e3*e.time},e.elements);var p=Object.keys(e.elements).filter((function(e){return"operatorInfo"!==e})).reduce((function(n,o){return t(t({},n),{},i({},o,e.elements[o]))}),{});e.elements=p}return e}},{key:"_onGroupDismissed",value:function(e){Ve.l("".concat(this._n,"._onGroupDismissed groupID:").concat(e)),this._groupModule.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"_checkMessageStacked",value:function(e){var t="MessageStacked",n=e.length;n>=100&&(this._groupModule.outputWarning(t,n),this._reportMessageStackedCount<5&&(new Aa(t).setNetworkType(this._groupModule.getNetworkType()).setMessage("count:".concat(n," groupID:").concat(m(this._joinedGroupMap.keys()))).setLevel("warning").end(),this._reportMessageStackedCount+=1))}},{key:"_isMessageSentByCurrentInstance",value:function(e){return!!this._getModule(qn).isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(e,t){e.currentUser=this._groupModule.getMyUserID(),e.conversationType=5===t?E.CONV_SYSTEM:E.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var n=new Wa(e),o=this.packElements(e,t);return n.setElement(o,this._groupModule.getFileDownloadProxy()),n}},{key:"packElements",value:function(e,n){return 4===n||6===n?(this._updateMemberCountByGroupTips(e),{type:E.MSG_GRP_TIP,content:t(t({},e.elements),{},{groupProfile:e.groupProfile})}):5===n?{type:E.MSG_GRP_SYS_NOTICE,content:t(t({},e.elements),{},{groupProfile:t(t({},e.groupProfile),{},{groupID:e.groupID})})}:this._getModule(Kn).parseElements(e.elements,e.from)}},{key:"packConversationOption",value:function(e){for(var t=new Map,n=0;n0&&this._groupModule.emitOuterEvent(k.MESSAGE_RECEIVED,t)}}},{key:"start",value:function(e){if(this._pollingInstanceMap.has(e)){var t=this._pollingInstanceMap.get(e);t.isRunning()||t.start()}else{var n=new Oi({manager:this,groupID:e,onInit:this._updateRequestData.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});n.start(),this._pollingInstanceMap.set(e,n),Ve.l("".concat(this._n,".start groupID:").concat(e))}}},{key:"handleJoinResult",value:function(e){var t=this;return this._preCheck().then((function(){var n=e.longPollingKey,o=e.group,s=o.groupID;return t._joinedGroupMap.set(s,o),t._groupModule.updateGroupMap([o]),t._groupModule.deleteUnjoinedAVChatRoom(s),t._groupModule.emitGroupListUpdate(!0,!1),it(n)?Xa({status:je,group:o}):Promise.resolve()}))}},{key:"startRunLoop",value:function(e){var t=this;return this.handleJoinResult(e).then((function(){var n=e.longPollingKey,o=e.group,s=e.startSeq,a=void 0===s?0:s,i=o.groupID;return t._pollingRequestInfoMap.set(i,{key:n,startSeq:a}),t.start(i),t._groupModule.isLoggedIn()?Xa({status:je,group:o}):Xa({status:je})}))}},{key:"_preCheck",value:function(){if(this._getModule(xn).isUnlimitedAVChatRoom())return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();var e=v(this._joinedGroupMap.entries().next().value,2),t=e[0],n=e[1];if(this._groupModule.isLoggedIn()){if(!(n.selfInfo.role===E.GRP_MBR_ROLE_OWNER||n.ownerID===this._groupModule.getMyUserID()))return this._groupModule.quitGroup(t);this._groupModule.deleteLocalGroupAndConversation(t)}else this._groupModule.deleteLocalGroupAndConversation(t);return this.reset(t),Promise.resolve()}},{key:"joinWithoutAuth",value:function(e){var t=this,n=e.groupID,o="".concat(this._n,".").concat("joinWithoutAuth"),s=new Aa("joinWithoutAuth");return this._groupModule.request({protocolName:$o,requestData:e}).then((function(e){var a=e.data.longPollingKey;if(t._groupModule.probeNetwork().then((function(e){var t=v(e,2);t[0];var o=t[1];s.setNetworkType(o).setMessage("groupID:".concat(n," longPollingKey:").concat(a)).end(!0)})),it(a))return Za({code:ha.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN});Ve.l("".concat(o," ok. groupID:").concat(n)),t._getModule(qn).setCompleted("".concat(E.CONV_GROUP).concat(n));var i=new hi({groupID:n});return t.startRunLoop({group:i,longPollingKey:a}),Ya({status:je})})).catch((function(e){return Ve.e("".concat(o," failed. groupID:").concat(n," error:"),e),t._groupModule.probeNetwork().then((function(t){var o=v(t,2),a=o[0],i=o[1];s.setError(e,a,i).setMessage("groupID:".concat(n)).end(!0)})),Za(e)})).finally((function(){t._groupModule.getModule(Bn).reportAtOnce()}))}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},n=Date.now();return zt(t)||n-t.lastSyncTime>1e3*t.expireTime&&n-t.latestUpdateTime>1e4&&n-t.lastReqTime>3e3?(t.lastReqTime=n,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then((function(e){return Ya({memberCount:e.memberCount})})).catch((function(e){return Za(e)}))):Xa({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(e){var t=this,n="".concat(this._n,".").concat("_getGroupOnlineMemberCount");return this._groupModule.request({protocolName:ms,requestData:{groupID:e}}).then((function(o){var s=t._onlineMemberCountMap.get(e)||{},a=o.data,i=a.onlineMemberNum,r=void 0===i?0:i,u=a.expireTime,c=void 0===u?t.DEFAULT_EXPIRE_TIME:u;Ve.l("".concat(n," ok. groupID:").concat(e," memberCount:").concat(r," expireTime:").concat(c));var l=Date.now();return zt(s)&&(s.lastReqTime=l),t._onlineMemberCountMap.set(e,Object.assign(s,{lastSyncTime:l,latestUpdateTime:l,memberCount:r,expireTime:c})),{memberCount:r}})).catch((function(o){return Ve.w("".concat(n," failed. error:"),o),new Aa("_getGroupOnlineMemberCount").setCode(o.code).setMessage("groupID:".concat(e," error:").concat(JSON.stringify(o))).setNetworkType(t._groupModule.getNetworkType()).end(),Promise.reject(o)}))}},{key:"_getModule",value:function(e){return this._groupModule.getModule(e)}},{key:"setPollingInterval",value:function(e){it(e)||(et(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:"setPollingIntervalPlus",value:function(e){it(e)||(et(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:"setPollingNoMessageCount",value:function(e){it(e)||(et(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:"setPollingSimplifiedMessage",value:function(e){it(e)||"0"!==e&&"1"!==e||(this.DEFAULT_POLLING_SIMPLIFIED_MSG=parseInt(e,10))}},{key:"getPollingInterval",value:function(){return this._pollingInterval}},{key:"onAVChatRoomMemberBanned",value:function(e){var t=e.payload.groupProfile.groupID;Ve.l("".concat(this._n,".onAVChatRoomMemberBanned groupID:").concat(t)),this._groupModule.deleteLocalGroupAndConversation(t),this.reset(t)}},{key:"restartPolling",value:function(){Ve.l("".concat(this._n,".restartPolling count:").concat(this._pollingInstanceMap.size));var e,t=D(this._pollingInstanceMap.values());try{for(t.s();!(e=t.n()).done;){var n=e.value;n.stop(),n.start()}}catch(o){t.e(o)}finally{t.f()}}},{key:"getPollingTimerID",value:function(e){if(!this._pollingInstanceMap.has(e))return-1;var t=this._pollingInstanceMap.get(e).getPollingTimerID();return Ve.l("".concat(this._n,".getPollingTimerID groupID:").concat(e," timerID:").concat(t)),t}},{key:"reset",value:function(e){if(e){Ve.l("".concat(this._n,".reset groupID:").concat(e));var t=this._pollingInstanceMap.get(e);t&&t.stop(),this._pollingInstanceMap.delete(e),this._joinedGroupMap.delete(e),this._pollingRequestInfoMap.delete(e),this._onlineMemberCountMap.delete(e)}else{Ve.l("".concat(this._n,".reset all"));var n,o=D(this._pollingInstanceMap.values());try{for(o.s();!(n=o.n()).done;){n.value.stop()}}catch(s){o.e(s)}finally{o.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this.sequencesLinkedList.reset(),this.messageIDLinkedList.reset(),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0}}]),e}(),Pi=1,bi=15,wi=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupSystemNoticeHandler",this.pendencyMap=new Map}return a(e,[{key:"onNewGroupSystemNotice",value:function(e){var t=e.dataList,n=e.isSyncingEnded,o=e.isInstantMessage;Ve.d("".concat(this._n,".onReceiveSystemNotice count:").concat(t.length));var s=this.newSystemNoticeStoredAndSummary({notifiesList:t,isInstantMessage:o}),a=s.eventDataList,i=s.result;a.length>0&&(this._groupModule.getModule(qn).onNewMessage({conversationOptionsList:a,isInstantMessage:o}),this._onReceivedGroupSystemNotice({result:i,isInstantMessage:o}));o?i.length>0&&this._groupModule.emitOuterEvent(k.MESSAGE_RECEIVED,i):!0===n&&this._clearGroupSystemNotice()}},{key:"newSystemNoticeStoredAndSummary",value:function(e){var n=e.notifiesList,o=e.isInstantMessage,s=null,a=n.length,i=0,r=[],u={conversationID:E.CONV_SYSTEM,unreadCount:0,type:E.CONV_SYSTEM,subType:null,lastMessage:null};for(i=0;i0?[u]:[],result:r}}},{key:"_clearGroupSystemNotice",value:function(){var e=this;this._getPendencyList().then((function(t){t.forEach((function(t){e.pendencyMap.set("".concat(t.from,"_").concat(t.groupID,"_").concat(t.to),t)}));var n=e._groupModule.getModule(qn).getLocalMessageList(E.CONV_SYSTEM),o=[];n.forEach((function(t){var n=t.payload,s=n.operatorID,a=n.operationType,i=n.groupProfile;if(a===Pi){var r="".concat(s,"_").concat(i.groupID,"_").concat(i.to),u=e.pendencyMap.get(r);u&&et(u.handled)&&0!==u.handled&&o.push(t)}})),e.deleteGroupSystemNotice({messageList:o})}))}},{key:"deleteGroupSystemNotice",value:function(e){var t=this,n="".concat(this._n,".deleteGroupSystemNotice");return at(e.messageList)&&0!==e.messageList.length?(Ve.l("".concat(n," ")+e.messageList.map((function(e){return e.ID}))),this._groupModule.request({protocolName:_s,requestData:{messageListToDelete:e.messageList.map((function(e){return{from:E.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){Ve.l("".concat(n," ok"));var o=t._groupModule.getModule(qn);return e.messageList.forEach((function(e){o.deleteLocalMessage(e)})),Ya()})).catch((function(e){return Ve.e("".concat(n," error:"),e),Za(e)}))):Xa()}},{key:"_getPendencyList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.type,o=void 0===n?void 0:n,s=t.startTime,a=void 0===s?0:s,i=t.limit,r=void 0===i?20:i;return this._groupModule.request({protocolName:hs,requestData:{type:o,startTime:a,limit:r,handleAccount:this._groupModule.getMyUserID()}}).then((function(t){var n=t.data.pendencyList;return 0!==t.data.nextStartTime?e._getPendencyList({startTime:t.data.nextStartTime}).then((function(e){return[].concat(m(n),m(e))})):n}))}},{key:"getGroupApplicationList",value:function(){var e=this;return this._getPendencyList().then((function(t){return e._getPendencyList({type:E.GRP_COMMUNITY}).then((function(n){return t.push.apply(t,m(n)),e._handlePendencyResult(t)})).catch((function(n){return e._handlePendencyResult(t)}))}))}},{key:"_handlePendencyResult",value:function(e){var t=this,n=[];return e.forEach((function(e){t.pendencyMap.set("".concat(e.from,"_").concat(e.groupID,"_").concat(e.to),e),0===e.handled&&n.push({applicant:e.from,applicantNick:e.fromUserNickName,groupName:e.groupName,groupID:e.groupID,authentication:e.authentication,messageKey:e.time,applicationType:e.applicationType,userID:e.userID})})),Xa({applicationList:n})}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,n=e.result;e.isInstantMessage&&n.forEach((function(e){switch(e.payload.operationType){case 1:break;case 2:t._onApplyGroupRequestAgreed(e);break;case 3:break;case 4:t._onMemberKicked(e);break;case 5:t._onGroupDismissed(e);break;case 6:break;case 7:t._onInviteGroup(e);break;case 8:t._onQuitGroup(e);break;case 9:t._onSetManager(e);break;case 10:t._onDeleteManager(e);break;case 11:case 12:case 15:break;case 20:t._onMessageRemindTypeSynced(e);break;case 21:t._groupModule.onAVChatRoomMemberBanned(e)}}))}},{key:"_onApplyGroupRequestAgreed",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;if(n){t._groupModule.updateGroupMap([n]);var o=!n.isSupportTopic;t._groupModule.emitGroupListUpdate(!0,o)}}))}},{key:"_onMemberKicked",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onGroupDismissed",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t);var n=this._groupModule._AVChatRoomHandler;n&&n.checkJoinedAVChatRoomByID(t)&&n.reset(t)}},{key:"_onInviteGroup",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;n&&(t._groupModule.updateGroupMap([n]),t._groupModule.emitGroupListUpdate())}))}},{key:"_onQuitGroup",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onSetManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,s=this._groupModule.getModule(wn).getLocalGroupMemberInfo(o,n);s&&s.updateRole(E.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,s=this._groupModule.getModule(wn).getLocalGroupMemberInfo(o,n);s&&s.updateRole(E.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.messageRemindType;this._groupModule.getModule(qn).onGroupMessageRemindTypeSynced({groupID:t,messageRemindType:n})}},{key:"_handleTopicSystemNotice",value:function(e){var t=e.groupProfile,n=t.groupID,o=t.topicID,s=e.elements,a=s.operationType,i=s.topicIDList,r=s.messageRemindType,u=this._groupModule.getModule(Fn);17===a?u.onTopicCreated({groupID:n,topicID:o}):18===a?u.onTopicDeleted({groupID:n,topicIDList:i}):20===a&&u.onTopicMessageRemindTypeUpdated({groupID:n,topicID:o,messageRemindType:r})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),e}(),Fi=["relayFlag"],qi=function(e){r(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="GroupModule",t._commonGroupHandler=null,t._AVChatRoomHandler=null,t._groupSystemNoticeHandler=null,t._commonGroupHandler=new Ii(h(t)),t._groupAttributesHandler=new Si(h(t)),t._groupCountersHandler=new Ni(h(t)),t._AVChatRoomHandler=new Ui(h(t)),t._groupTipsHandler=new yi(h(t)),t._groupSystemNoticeHandler=new wi(h(t)),t.groupMap=new Map,t._unjoinedAVChatRoomList=new Map,t._receiptDetailCompleteMap=new Map,t.getInnerEmitterInstance().on(ti,t._onCloudConfigUpdated,h(t)),t}return a(s,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("polling_interval"),t=this.getCloudConfig("polling_interval_plus"),n=this.getCloudConfig("polling_no_msg_count"),o=this.getCloudConfig("polling_simplified_msg");this._AVChatRoomHandler&&(Ve.l("".concat(this._n,"._onCloudConfigUpdated pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(t," pollingNoMessageCount:").concat(n)+" pollingSimplifiedMessage:".concat(o)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(n),this._AVChatRoomHandler.setPollingSimplifiedMessage(o))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:"guardForAVChatRoom",value:function(e){var t=this;if(e.conversationType===E.CONV_GROUP){var n=kt(e.to)?xt(e.to):e.to;return this.hasLocalGroup(n)?Xa():this.getGroupProfile({groupID:n}).then((function(o){var s=o.data.group.type;if(Ve.l("".concat(t._n,".guardForAVChatRoom. groupID:").concat(n," type:").concat(s)),s===E.GRP_AVCHATROOM){var a=ha.MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM;return Za(new ja({code:a,message:t.getErrorMessage(a,e.from,n),data:{message:e}}))}return Xa()}))}return Xa()}},{key:"checkJoinedAVChatRoomByID",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"onNewGroupMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onNewGroupMessage(e)}},{key:"updateNextMessageSeq",value:function(e){var t=this;if(at(e)){var n=this.getModule(Fn);e.forEach((function(e){var o=e.conversationID.replace(E.CONV_GROUP,"");kt(o)&&n.updateLastMessage(o,e.lastMessage),t.groupMap.has(o)&&(t.groupMap.get(o).nextMessageSeq=e.lastMessage.sequence+1)}))}}},{key:"onNewGroupTips",value:function(e){this._groupTipsHandler&&this._groupTipsHandler.onNewGroupTips(e)}},{key:"onGroupMessageRevoked",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onGroupMessageRevoked(e)}},{key:"onNewGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:"onGroupMessageReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){var n=e.elements.groupMessageReadNotice;if(!it(n)){var o=t.getModule(qn);n.forEach((function(e){var n=e.groupID,s=e.topicID,a=void 0===s?void 0:s,i=e.lastMessageSeq;Ve.d("".concat(t._n,".onGroupMessageReadNotice groupID:").concat(n," lastMessageSeq:").concat(i));var r="".concat(E.CONV_GROUP).concat(n),u=!0;zt(a)||(r="".concat(E.CONV_GROUP).concat(a),u=!1),o.updateIsReadAfterReadReport({conversationID:r,lastMessageSeq:i}),o.updateUnreadCount(r,u),o.clearGroupAtInfoList(r,u)}))}}))}},{key:"onReadReceiptList",value:function(e){var t=this;Ve.d("".concat(this._n,".onReadReceiptList options:"),JSON.stringify(e)),e.dataList.forEach((function(e){var n=e.groupProfile,o=e.elements,s=n.groupID,a=t.getModule(qn),i=o.readReceiptList;a.updateReadReceiptInfo({groupID:s,readReceiptList:i})}))}},{key:"onGroupMessageModified",value:function(e){Ve.d("".concat(this._n,".onGroupMessageModified options:"),JSON.stringify(e));var n=this.getModule(qn);e.dataList.forEach((function(e){n.onMessageModified(t(t({},e),{},{conversationType:E.CONV_GROUP,to:e.topicID?e.topicID:e.groupID}))}))}},{key:"deleteGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:"initGroupMap",value:function(e){this.groupMap.set(e.groupID,new hi(e))}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var t,n=this,o=this.getModule(qn);e.forEach((function(e){t=e.groupID,n.groupMap.has(t)?n.groupMap.get(t).updateGroup(e):(n.groupMap.set(t,new hi(e)),o.deleteGroupRomaingMessageInfo(t))}));var s,a=this.getMyUserID(),i=D(this.groupMap);try{for(i.s();!(s=i.n()).done;){var r=v(s.value,2)[1];r.selfInfo.userID=a,"Owner"===r.selfInfo.role&&(r.ownerID=a)}}catch(u){i.e(u)}finally{i.f()}this._setStorageGroupList()}},{key:"getStorageGroupList",value:function(){return this.getModule(Vn).getItem("groupMap")}},{key:"_setStorageGroupList",value:function(){var e=this.getLocalGroupList().filter((function(e){var t=e.type;return!Tt(t)})).filter((function(e){return!e.isSupportTopic})).slice(0,20).map((function(e){return{groupID:e.groupID,name:e.name,avatar:e.avatar,type:e.type}}));this.getModule(Vn).setItem("groupMap",e)}},{key:"getGroupMap",value:function(){return this.groupMap}},{key:"getLocalGroupList",value:function(){return m(this.groupMap.values())}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"sortLocalGroupList",value:function(){var e=m(this.groupMap).filter((function(e){var t=v(e,2);return t[0],!zt(t[1].lastMessage)}));e.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})),this.groupMap=new Map(m(e))}},{key:"updateGroupLastMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.handleUpdateGroupLastMessage(e)}},{key:"emitGroupListUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalGroupList();if(e&&this.emitOuterEvent(k.GROUP_LIST_UPDATED),t){var o=JSON.parse(JSON.stringify(n)),s=this.getModule(qn);s.updateConversationGroupProfile(o)}}},{key:"patchGroupMessageRemindType",value:function(){var e=this.getLocalGroupList(),t=this.getModule(qn),n=0;e.forEach((function(e){!0===t.patchMessageRemindType({ID:e.groupID,isC2CConversation:!1,messageRemindType:e.selfInfo.messageRemindType})&&(n+=1)})),Ve.l("".concat(this._n,".patchGroupMessageRemindType count:").concat(n))}},{key:"recomputeUnreadCount",value:function(){var e=this.getLocalGroupList(),t=this.getModule(qn);e.forEach((function(e){var n=e.groupID,o=e.selfInfo,s=o.excludedUnreadSequenceList,a=o.readedSequence;if(at(s)){var i=0;s.forEach((function(t){t>=a&&t<=e.nextMessageSeq-1&&(i+=1)})),i>=1&&t.recomputeGroupUnreadCount({conversationID:"".concat(E.CONV_GROUP).concat(n),count:i})}}))}},{key:"getMyNameCardByGroupID",value:function(e){var t=this.getLocalGroupProfile(e);return t?t.selfInfo.nameCard:""}},{key:"isPagingGetCompleted",value:function(){return!!this._commonGroupHandler&&this._commonGroupHandler.isPagingGetCompleted()}},{key:"getGroupList",value:function(e){return this._commonGroupHandler?this._commonGroupHandler.getGroupList(e):Xa()}},{key:"getGroupProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupProfile"),o=new Aa("getGroupProfile"),s=e.groupID,a=e.groupCustomFieldFilter;Ve.l("".concat(n," groupID:").concat(s));var i={groupIDList:[s],responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember","InviteJoinOption"],groupCustomFieldFilter:a,memberInfoFilter:["Role","JoinTime","MsgSeq","MsgFlag","NameCard"]}};return this.getGroupProfileAdvance(i).then((function(e){var a,i=e.data,r=i.successGroupList,u=i.failureGroupList;if(Ve.l("".concat(n," ok")),u.length>0)return Za(u[0]);(Tt(r[0].type)&&!t.hasLocalGroup(s)?a=new hi(r[0]):(t.updateGroupMap(r),a=t.getLocalGroupProfile(s)),a.isSupportTopic)||t.getModule(qn).updateConversationGroupProfile([a]);return o.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(s," type:").concat(a.type," muteAllMembers:").concat(a.muteAllMembers," ownerID:").concat(a.ownerID)).end(),Ya({group:a})})).catch((function(s){return t.probeNetwork().then((function(t){var n=v(t,2),a=n[0],i=n[1];o.setError(s,a,i).setMessage("groupID:".concat(e.groupID)).end()})),Ve.e("".concat(n," failed. error:"),s),Za(s)}))}},{key:"getGroupProfileAdvance",value:function(e){var n="".concat(this._n,".getGroupProfileAdvance"),o=e.groupIDList;at(o)&&o.length>50&&(this.outputWarning("GetGroupProfileLimit"),o.length=50);var s=[],a=[];o.forEach((function(e){Dt({groupID:e})?a.push(e):s.push(e)}));var i=[];if(s.length>0){var r=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:s}));i.push(r)}if(a.length>0){var u=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:a,relayFlag:s.length>0}));i.push(u)}return Promise.all(i).then((function(e){var t=[],n=[];return e.forEach((function(e){t.push.apply(t,m(e.successGroupList)),n.push.apply(n,m(e.failureGroupList))})),Ya({successGroupList:t,failureGroupList:n})})).catch((function(e){return Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"_getGroupProfileAdvance",value:function(e){var t=this,n=e.relayFlag,o=void 0!==n&&n,s=g(e,Fi);return this.request({protocolName:zo,requestData:s}).then((function(e){Ve.l("".concat(t._n,"._getGroupProfileAdvance ok."));var n=e.data.groups;return{successGroupList:n.filter((function(e){return it(e.errorCode)||0===e.errorCode})),failureGroupList:n.filter((function(e){return e.errorCode&&0!==e.errorCode})).map((function(e){return new ja({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}))}})).catch((function(t){return o&&Dt({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:Za(t)}))}},{key:"createGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("createGroup"),s=e.type,a=e.groupID;if(e.name&&!1===this._filterProfanity("name",e))return Za({code:ha.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Za({code:ha.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Za({code:ha.PROFANITY_FOUND});if(!["Public","Private","ChatRoom","AVChatRoom","Community"].includes(s))return Za({code:ha.ILLEGAL_GROUP_TYPE});if(!Dt({type:s})){if(!zt(a)&&Dt({groupID:a}))return Za({code:ha.ILLEGAL_GROUP_ID});e.isSupportTopic=void 0}if(Tt(s)&&!it(e.memberList)&&e.memberList.length>0&&(e.memberList=void 0),this._canIUseJoinOption(s)||it(e.joinOption)||(e.joinOption=void 0),Dt({type:s})){if(!zt(a)&&!Dt({groupID:a}))return Za({code:ha.ILLEGAL_GROUP_ID});e.isSupportTopic=!0===e.isSupportTopic?1:0}var i=new Aa("createGroup");Ve.l("".concat(o," options:"),e);var r=null,u=[];return this.request({protocolName:Jo,requestData:t(t({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then((function(s){var a=s.data,c=a.groupID,l=a.overLimitUserIDList,d=void 0===l?[]:l;if(r=c,u=d,i.setNetworkType(n.getNetworkType()).setMessage("groupType:".concat(e.type," groupID:").concat(c," overLimitUserIDList=").concat(d)).end(),Ve.l("".concat(o," ok groupID:").concat(c," overLimitUserIDList:"),d),e.type===E.GRP_AVCHATROOM)return n.getGroupProfile({groupID:c});if(e.type===E.GRP_COMMUNITY&&1===e.isSupportTopic)return n.getGroupProfile({groupID:c});zt(e.memberList)||zt(d)||(e.memberList=e.memberList.filter((function(e){return-1===d.indexOf(e.userID)}))),n.updateGroupMap([t(t({},e),{},{groupID:c})]);var p=n.getModule(Nn),g=p.createCustomMessage({to:c,conversationType:E.CONV_GROUP,payload:{data:"group_create",extension:n.isIntl()?"".concat(n.getMyUserID()," created a group"):"".concat(n.getMyUserID(),"创建群组")}});return p.sendMessageInstance(g),n.emitGroupListUpdate(),n.getGroupProfile({groupID:c})})).then((function(e){var t=e.data.group,n=t.selfInfo,o=n.nameCard,s=n.joinTime;return t.updateSelfInfo({nameCard:o,joinTime:s,messageRemindType:E.MSG_REMIND_ACPT_AND_NOTE,role:E.GRP_MBR_ROLE_OWNER}),Ya({group:t,overLimitUserIDList:u})})).catch((function(s){if(i.setMessage("groupType:".concat(e.type)),n.probeNetwork().then((function(e){var t=v(e,2),n=t[0],o=t[1];i.setError(s,n,o).end()})),10010===s.code||10007===s.code){n.updateGroupMap([t(t({},e),{},{groupID:r})]);var a=n.getLocalGroupProfile(r);return Ve.l("".concat(o," success, but failed to get group profile.")),Ya({group:a,overLimitUserIDList:u})}return Ve.e("".concat(o," failed. error:"),s),Za(s)}))}},{key:"dismissGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("dismissGroup");if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===E.GRP_WORK)return Za(new ja({code:ha.CANNOT_DISMISS_WORK}));var o=new Aa("dismissGroup");return o.setMessage("groupID:".concat(e)),Ve.l("".concat(n," groupID:").concat(e)),this.request({protocolName:Xo,requestData:{groupID:e}}).then((function(){return o.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),Ya({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"updateGroupProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("updateGroupProfile");if(this.hasLocalGroup(e.groupID)){var o=this.getLocalGroupProfile(e.groupID).type;this._canIUseJoinOption(o)||it(e.joinOption)||(Ve.w("".concat(n," joinOption is unavailable for Work/Meeting/AVChatRoom")),e.joinOption=void 0)}if(it(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off"),e.name&&!1===this._filterProfanity("name",e))return Za({code:ha.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Za({code:ha.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Za({code:ha.PROFANITY_FOUND});var s=new Aa("updateGroupProfile");return s.setMessage(JSON.stringify(e)),Ve.l("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:Zo,requestData:e}).then((function(){(s.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),t.hasLocalGroup(e.groupID))&&(t.groupMap.get(e.groupID).updateGroup(e),t._setStorageGroupList());return Ya({group:t.groupMap.get(e.groupID)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Ve.l("".concat(n," failed. error:"),e),Za(e)}))}},{key:"_filterProfanity",value:function(e,t){var n=this.getModule(oo);if(!n)return!0;var o=n.filterText(t[e],z),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:"joinGroup",value:function(e){var t=this,n=e.groupID,o=e.type,s="".concat(this._n,".joinGroup");if(o===E.GRP_WORK)return Za({code:ha.CANNOT_JOIN_WORK});if(this.deleteUnjoinedAVChatRoom(n),this.hasLocalGroup(n)){if(!this.isLoggedIn())return Xa({status:E.JOIN_STATUS_ALREADY_IN_GROUP});var a=new Aa("applyJoinGroup");return this.getGroupProfile({groupID:n}).then((function(){return a.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," joinedStatus:").concat(E.JOIN_STATUS_ALREADY_IN_GROUP)).end(),Xa({status:E.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(o){return a.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," unjoined")).end(),Ve.w("".concat(s," ").concat(n," was unjoined, now join!")),t.groupMap.delete(n),t.applyJoinGroup(e)}))}return Ve.l("".concat(s," groupID:").concat(n)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e)}},{key:"applyJoinGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("applyJoinGroup"),s=e.groupID;if(!zt(e.applyMessage)&&!1===this._filterProfanity("applyMessage",e))return Za({code:ha.PROFANITY_FOUND});var a=new Aa("applyJoinGroup"),i=t({},e),r=this.canIUse(B.AVCHATROOM_HISTORY_MSG);return r&&(i.historyMessageFlag=1),this.getModule(qn).deleteTopicRoamingMessageInfo(s),this.request({protocolName:Qo,requestData:i}).then((function(e){var t=e.data,i=t.joinedStatus,u=t.longPollingKey,c=t.startSeq,l=t.avChatRoomFlag,d=t.avChatRoomKey,p=t.messageList,g="groupID:".concat(s," joinedStatus:").concat(i," longPollingKey:").concat(u," startSeq:").concat(c)+" avChatRoomFlag:".concat(l," canGetAVChatRoomHistoryMessage:").concat(r,",")+" history message count:".concat(zt(p)?0:p.length);switch(a.setNetworkType(n.getNetworkType()).setMessage("".concat(g)).end(),Ve.l("".concat(o," ok. ").concat(g)),i){case ze:return Ya({status:ze});case je:return n.getGroupProfile({groupID:s}).then((function(e){var t=e.data.group;return n._handleJoinResult({group:t,avChatRoomFlag:l,longPollingKey:u,startSeq:c,avChatRoomKey:d,messageList:p})})).catch((function(){var e=new hi({groupID:s});return n._handleJoinResult({group:e,avChatRoomFlag:l,longPollingKey:u,startSeq:c,avChatRoomKey:d,messageList:p})}));default:var h=new ja({code:ha.JOIN_GROUP_FAIL});return Ve.e("".concat(o," failed. error:"),h),Za(h)}})).catch((function(e){return a.setMessage("groupID:".concat(s)),n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),Za(e)}))}},{key:"_handleJoinResult",value:function(e){var t,n=this,o=e.group,s=e.avChatRoomFlag,a=e.longPollingKey,i=e.startSeq,r=e.avChatRoomKey,u=e.messageList,c=o.groupID;return 1===s?(this.getModule(qn).setCompleted("".concat(E.CONV_GROUP).concat(c)),this._groupAttributesHandler.initGroupAttributesCache({groupID:c,avChatRoomKey:r}),this._groupCountersHandler.initGroupCountersCache({groupID:c,avChatRoomKey:r}),(t=it(a)?this._AVChatRoomHandler.handleJoinResult({group:o}):this._AVChatRoomHandler.startRunLoop({group:o,longPollingKey:a,startSeq:i})).then((function(){n._onAVChatRoomHistoryMessage(u)})),t):(this.emitGroupListUpdate(!0,!1),Ya({status:je,group:o}))}},{key:"quitGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("quitGroup");Ve.l("".concat(n," groupID:").concat(e));var o=this.checkJoinedAVChatRoomByID(e);if(!o&&!this.hasLocalGroup(e))return Za({code:ha.MEMBER_NOT_IN_GROUP});if(o&&!this.isLoggedIn())return Ve.l("".concat(n," anonymously ok. groupID:").concat(e)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),Xa({groupID:e});var s=new Aa("quitGroup");return s.setMessage("groupID:".concat(e)),this.request({protocolName:es,requestData:{groupID:e}}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),o&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),Ya({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"searchGroupByID",value:function(e){var t=this,n="".concat(this._n,".").concat("searchGroupByID"),o={groupIDList:[e]},s=new Aa("searchGroupByID");return s.setMessage("groupID:".concat(e)),Ve.l("".concat(n," groupID:").concat(e)),this.request({protocolName:ts,requestData:o}).then((function(e){var o=e.data.groupProfile;if(0!==o[0].errorCode)throw new ja({code:o[0].errorCode,message:o[0].errorInfo});return s.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),Ya({group:new hi(o[0])})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Ve.w("".concat(n," failed. error:"),e),Za(e)}))}},{key:"changeGroupOwner",value:function(e){var t=this,n="".concat(this._n,".").concat("changeGroupOwner");if(this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===E.GRP_AVCHATROOM)return Za({code:ha.CANNOT_CHANGE_OWNER_IN_AVCHATROOM});if(e.newOwnerID===this.getMyUserID())return Za({code:ha.CANNOT_CHANGE_OWNER_TO_SELF});var o=new Aa("changeGroupOwner");return o.setMessage("groupID:".concat(e.groupID," newOwnerID:").concat(e.newOwnerID)),Ve.l("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:ns,requestData:e}).then((function(){o.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok"));var s=e.groupID,a=e.newOwnerID;t.groupMap.get(s).ownerID=a;var i=t.getModule(wn).getLocalGroupMemberList(s);if(i instanceof Map){var r=i.get(t.getMyUserID());it(r)||(r.updateRole("Member"),t.groupMap.get(s).selfInfo.role="Member");var u=i.get(a);it(u)||u.updateRole("Owner")}return t.emitGroupListUpdate(!0,!1),Ya({group:t.groupMap.get(s)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"getGroupApplicationList",value:function(){return this._groupSystemNoticeHandler.getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){var t,n,o,s,a,i=this,r="".concat(this._n,".").concat("handleGroupApplication"),u=e.handleAction,c=e.handleMessage,l=e.message,d=e.application;l?(t=l.payload.operatorID,n=l.payload.groupProfile.groupID,o=l.payload.authentication,s=l.payload.messageKey):d&&(t=d.applicant,n=d.groupID,o=d.authentication,s=d.messageKey);var p=os;d&&2===d.applicationType&&(p=ss,a=d.userID);var g=new Aa("handleGroupApplication");return g.setMessage("groupID:".concat(n)),Ve.l("".concat(r," groupID:").concat(n)),this.request({protocolName:p,requestData:{handleAction:u,handleMessage:c,applicant:t,invitee:a,groupID:n,authentication:o,messageKey:s}}).then((function(){return g.setNetworkType(i.getNetworkType()).end(),Ve.l("".concat(r," ok")),l&&i._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Ya({group:i.getLocalGroupProfile(n)})})).catch((function(e){return i.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];g.setError(e,o,s).end()})),Ve.e("".concat(r," failed. error"),e),Za(e)}))}},{key:"handleGroupInvitation",value:function(e){var n=this,o="".concat(this._n,".").concat("handleGroupInvitation"),s=e.message.payload,a=s.groupProfile.groupID,i=s.authentication,r=s.messageKey,u=s.operatorID,c=e.handleAction,l=new Aa("handleGroupInvitation");return l.setMessage("groupID:".concat(a," inviter:").concat(u," handleAction:").concat(c)),Ve.l("".concat(o," groupID:").concat(a," inviter:").concat(u," handleAction:").concat(c)),this.request({protocolName:as,requestData:t(t({},e),{},{inviter:u,groupID:a,authentication:i,messageKey:r})}).then((function(){return l.setNetworkType(n.getNetworkType()).end(),Ve.l("".concat(o," ok")),n._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Ya({group:n.getLocalGroupProfile(a)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error"),e),Za(e)}))}},{key:"getGroupOnlineMemberCount",value:function(e){return this._AVChatRoomHandler?this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)?this._AVChatRoomHandler.getGroupOnlineMemberCount(e):Xa({memberCount:0}):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var t=this.checkJoinedAVChatRoomByID(e);(Ve.l("".concat(this._n,".deleteLocalGroupAndConversation isJoinedAVChatRoom:").concat(t)),t)&&this.getModule(qn).deleteLocalConversation("".concat(E.CONV_GROUP).concat(e));if(Dt({groupID:e})){var n=this.getLocalGroupProfile(e);if(n&&!0===n.isSupportTopic)this.getModule(Fn).deleteTopicListInCommunity(e)}this._deleteLocalGroup(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this.getModule(wn).deleteGroupMemberList(e),this._setStorageGroupList()}},{key:"sendMessage",value:function(e,t){if(at(e._receiverList)&&e._receiverList.length>0&&!this.canIUse(B.MSG_TO_SPECIFIED_GRP_MBR))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n=this.createGroupMessagePack(e,t);return this.request(n)}},{key:"createGroupMessagePack",value:function(e,t){var n=null;t&&t.offlinePushInfo&&(n=t.offlinePushInfo);var o="";nt(e.cloudCustomData)&&e.cloudCustomData.length>0&&(o=e.cloudCustomData);var s=[];if(st(t)&&st(t.messageControlInfo)){var a=t.messageControlInfo,i=a.excludedFromUnreadCount,r=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===i&&s.push("NoUnread"),!0===r&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c=void 0;at(e._receiverList)&&e._receiverList.length>0&&(c=e._receiverList,e._receiverList.length>50&&(c=e._receiverList.slice(0,50),this.outputWarning("ReceiverListLimit")));var l=this.isOnlineMessage(e,t)?1:0,d=e.getGroupAtInfoList(),p={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:e.getElements(),cloudCustomData:o,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==E.MSG_TEXT||zt(d)?void 0:d,onlineOnlyFlag:l,clientTime:e.clientTime,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(n)},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:0===l?s:void 0,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1,receiverList:c,isSupportExtension:!0===e.isSupportExtension?1:0};return kt(e.to)&&(p.groupID=xt(e.to),p.topicID=e.to),{protocolName:vo,tjgID:this.generateTjgID(e),requestData:p}}},{key:"_isVoipPush",value:function(e){var t=void 0;return it(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:"revokeMessage",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return kt(e.to)&&(t.groupID=xt(e.to),t.topicID=e.to),this.request({protocolName:is,requestData:t})}},{key:"deleteMessage",value:function(e){var t=e.to,n=e.keyList;Ve.l("".concat(this._n,".deleteMessage groupID:").concat(t," count:").concat(n.length));var o={groupID:t,deleter:this.getMyUserID(),keyList:n};return kt(t)&&(o.groupID=xt(t),o.topicID=t),this.request({protocolName:Ms,requestData:o})}},{key:"modifyRemoteMessage",value:function(e){var t=e.to,n=e.sequence,o=e.payload,s=e.type,a=e.version,i=void 0===a?0:a,r=e.cloudCustomData,u=t,c=void 0;kt(t)&&(u=xt(t),c=t);var l=void 0;return Bt(s)&&(l=[]).push({type:s,content:o}),this.request({protocolName:ys,requestData:{groupID:u,topicID:c,sequence:n,version:i,elements:l,cloudCustomData:r}})}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessage"),o=e.conversationID,s=e.groupID,a=e.sequence,i=new Aa("getGroupRoamingMessages"),r=0,u=void 0;return kt(s)&&(s=xt(u=s)),this._computeLastSequence({groupID:s,topicID:u,sequence:a}).then((function(e){return r=e,Ve.l("".concat(n," groupID:").concat(s," startSequence:").concat(r)),t.request({protocolName:cs,requestData:{groupID:s,count:21,sequence:r,topicID:u}})})).then((function(e){var a=e.data,c=a.messageList,l=a.complete,d=a.invisibleSequenceList,p=void 0===d?[]:d;it(c)?Ve.l("".concat(n," ok. complete:").concat(l," but messageList is undefined!")):Ve.l("".concat(n," ok. complete:").concat(l," count:").concat(c.length));var g=t._getMinSequence(p,c)-1;i.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(s," topicID:").concat(u," startSequence:").concat(r," complete:").concat(l," nextSequence:").concat(g)).end();var h=t.getModule(qn),_=[];return zt(c)||(h.updateRoamingMessageSequence(o,g),_=h.onRoamingMessage(c,o),h.updateIsRead(o),h.patchConversationLastMessage(o)),(2===l||g<=1)&&(h.setCompleted(o),g=""),Ve.l("".concat(n," nextReqID:").concat(g,", stored message count:").concat(_.length,", invisible sequence count:").concat(p.length)),{nextReqID:g+"",storedMessageList:_}})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).setMessage("groupID:".concat(s," topicID:").concat(u," startSequence:").concat(r)).end()})),Ve.w("".concat(n," failed. error:"),e),Za(e)}))}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(E.CONV_GROUP,"")}},{key:"_getMinSequence",value:function(e,t){var n=0;zt(t)||(n=t[t.length-1].sequence);var o=0;zt(e)||(o=e[e.length-1]);return Ve.l("".concat(this._n,"._getMinSequence minVisibleSequence:").concat(n," minInvisibleSequence:").concat(o)),o>0&&o=100?100:a,h="groupID:".concat(i," sequence:").concat(u," cursor:").concat(p," filter:").concat(d," completeFlag:").concat(l);Ve.l("".concat(c," ").concat(h));var _={cursor:"",isCompleted:!1,messageID:r,unreadUserIDList:[],readUserIDList:[]},f=new Aa("getReadReceiptDetail");return f.setMessage(h),this.request({protocolName:gs,requestData:{groupID:i,sequence:u,flag:d,cursor:p,count:g}}).then((function(e){f.end();var n=e.data,o=n.cursor,s=n.isCompleted,a=n.unreadUserIDList,i=n.readUserIDList;return _.cursor=o,1===s&&(_.isCompleted=!0,t._receiptDetailCompleteMap.set(r,!0)),0===d?_.readUserIDList=i.map((function(e){return e.userID})):1===d&&(_.unreadUserIDList=a.map((function(e){return e.userID}))),Ve.l("".concat(c," ok")),Ya(_)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];f.setError(e,o,s).end()})),Ve.w("".concat(c," failed. error:"),e),Za(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessagesHopping"),o=new Aa("getGroupRoamingMessagesHopping"),s=e.groupID,a=e.count,i=e.sequence,r=e.direction,u=i;1===r&&(u=i+a-1);var c=void 0;kt(s)&&(s=xt(c=s));var l="".concat(c?"topicID:".concat(c):"groupID:".concat(s)," sequence:").concat(i," direction:").concat(r);return Ve.l("".concat(n," ").concat(l)),this.request({protocolName:cs,requestData:{groupID:s,topicID:c,count:a,sequence:u}}).then((function(s){var a=s.data,u=a.messageList,c=a.complete,d="complete:".concat(c," count:").concat(u?u.length:0);if(Ve.l("".concat(n," ok. ").concat(d)),o.setNetworkType(t.getNetworkType()).setMessage("".concat(l," ").concat(d)).end(),2===c||zt(u)){var p=t._computeResult();return Ya(p)}var g="".concat(E.CONV_GROUP).concat(e.groupID),h=t.getModule(qn).onRoamingMessage(u,g,!1),_=t._computeResult({direction:r,sequence:i,remoteMessageList:u,processedMessageList:h});return Ya(_)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),r=n[0],u=n[1];o.setError(e,r,u).setMessage("groupID:".concat(s," sequence:").concat(i," count:").concat(a)).end()})),Ve.w("".concat(n," failed. error:"),e),Za(e)}))}},{key:"_computeResult",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:""};if(it(e))return t.isCompleted=!0,t;var n=e.direction,o=e.sequence,s=e.remoteMessageList,a=void 0===s?[]:s,i=e.processedMessageList,r=void 0===i?[]:i,u=a.length;return 1===n?(t.nextMessageSeq=a[0].sequence+1,r.forEach((function(e){e.sequence>=o&&t.messageList.push(e)})),0===t.messageList.length&&a[0].sequence0?Promise.resolve(s):it(o)||this.hasLocalGroup(t)?it(o)?this.getGroupLastSequence(t):this.getTopicLastSequence({groupID:t,topicID:o}):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupLastSequence"),o=new Aa("getGroupLastSequence"),s=0,a="";if(this.hasLocalGroup(e)){var i=this.getLocalGroupProfile(e),r=i.lastMessage;if(r.lastSequence>0&&!1===r.onlineOnlyFlag)return s=r.lastSequence,a="got lastSequence:".concat(s," from local group profile[lastMessage.lastSequence]. groupID:").concat(e),Ve.l("".concat(n," ").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(a)).end(),Promise.resolve(s);if(i.nextMessageSeq>1)return s=i.nextMessageSeq-1,a="got lastSequence:".concat(s," from local group profile[nextMessageSeq]. groupID:").concat(e),Ve.l("".concat(n," ").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(a)).end(),Promise.resolve(s)}var u="GROUP".concat(e),c=this.getModule(qn).getLocalConversation(u);if(c&&c.lastMessage.lastSequence&&!1===c.lastMessage.onlineOnlyFlag)return s=c.lastMessage.lastSequence,a="got lastSequence:".concat(s," from local conversation profile[lastMessage.lastSequence]. groupID:").concat(e),Ve.l("".concat(n," ").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(a)).end(),Promise.resolve(s);var l={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}};return this.getGroupProfileAdvance(l).then((function(i){var r=i.data.successGroupList;return zt(r)?Ve.l("".concat(n," successGroupList is empty. groupID:").concat(e)):(s=r[0].nextMessageSeq-1,a="got lastSequence:".concat(s," from getGroupProfileAdvance. groupID:").concat(e),Ve.l("".concat(n," ").concat(a))),o.setNetworkType(t.getNetworkType()).setMessage("".concat(a)).end(),s})).catch((function(s){return t.probeNetwork().then((function(t){var n=v(t,2),a=n[0],i=n[1];o.setError(s,a,i).setMessage("get lastSequence failed from getGroupProfileAdvance. groupID:".concat(e)).end()})),Ve.w("".concat(n," failed. error:"),s),Za(s)}))}},{key:"getTopicLastSequence",value:function(e){var t=this,n=e.groupID,o=e.topicID,s="".concat(this._n,".").concat("getTopicLastSequence"),a=new Aa("getTopicLastSequence"),i=0,r="",u=this.getModule(Fn);return u.hasLocalTopic(n,o)?(i=u.getLocalTopic(n,o).nextMessageSeq-1,r="get lastSequence:".concat(i," from local topic info[nextMessageSeq]. topicID:").concat(o),Ve.l("".concat(s," ").concat(r)),a.setNetworkType(this.getNetworkType()).setMessage("".concat(r)).end(),Promise.resolve(i)):u.getTopicList({groupID:n,topicIDList:[o]}).then((function(e){var n=e.data.successTopicList;return zt(n)?Ve.l("".concat(s," successTopicList is empty. topicID:").concat(o)):(i=n[0].nextMessageSeq-1,r="get lastSequence:".concat(i," from getTopicList. topicID:").concat(o),Ve.l("".concat(s," ").concat(r))),a.setNetworkType(t.getNetworkType()).setMessage("".concat(r)).end(),i})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],i=n[1];a.setError(e,s,i).setMessage("get lastSequence failed from getTopicList. topicID:".concat(o)).end()})),Ve.w("".concat(s," failed. error:"),e),Za(e)}))}},{key:"isMessageFromOrToAVChatroom",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"hasJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.hasJoinedAVChatRoom():0}},{key:"getJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.getJoinedAVChatRoom():[]}},{key:"isOnlineMessage",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||!0!==t.onlineUserOnly)}},{key:"_canIUseOnlineOnlyFlag",value:function(e){var t=this.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==E.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e){if(!zt(e)){Ve.l("".concat(this._n,"._onAVChatRoomHistoryMessage count:").concat(e.length));var n=[];e.forEach((function(e){n.push(t(t({},e),{},{isHistoryMessage:1}))})),this.onAVChatRoomMessage(n)}}},{key:"onAVChatRoomMessage",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onMessage(e)}},{key:"onAVChatRoomMemberBanned",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onAVChatRoomMemberBanned(e)}},{key:"getGroupSimplifiedInfo",value:function(e){var t=this,n=new Aa("getGroupSimplifiedInfo"),o={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["Type","Name"]}};return this.getGroupProfileAdvance(o).then((function(o){var s=o.data.successGroupList;return n.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(e," type:").concat(s[0].type)).end(),s[0]})).catch((function(o){t.probeNetwork().then((function(t){var s=v(t,2),a=s[0],i=s[1];n.setError(o,a,i).setMessage("groupID:".concat(e)).end()}))}))}},{key:"setUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.set(e,1)}},{key:"deleteUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.has(e)&&this._unjoinedAVChatRoomList.delete(e)}},{key:"isUnjoinedAVChatRoom",value:function(e){return this._unjoinedAVChatRoomList.has(e)}},{key:"isGroupAttributesUpdatedNotice",value:function(e){return this._groupAttributesHandler.isGroupAttributesUpdatedNotice(e)}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesHandler.updateLocalMainSequenceOnReconnected()}},{key:"initGroupAttributes",value:function(e){return this._groupAttributesHandler.initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._groupAttributesHandler.setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._groupAttributesHandler.deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._groupAttributesHandler.getGroupAttributes(e)}},{key:"isMessageFromTopic",value:function(e,t){return 2===e&&!zt(t)}},{key:"isMessageFromCommunityOfTopic",value:function(e,t){return 2===e&&zt(t)}},{key:"getMessageExtensions",value:function(e,t){return Ve.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.request({protocolName:Ss,requestData:{groupID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMessageExtensions",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Ve.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n)),this.request({protocolName:Es,requestData:{groupID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"getGroupNotify",value:function(e){var n=this;if(this.hasLocalGroup(e)){var o=this.getLocalGroupProfile(e),s=o.type,a=o.isSupportTopic;if(!Tt(s)&&!a){var i="".concat(this._n,".getGroupNotify"),r=this._getGroupLastRevokedTime(e),u=1e3*Pe();Ve.l("".concat(i," groupID:").concat(e," type:").concat(s," beginTime:").concat(r," endTime:").concat(u)),this.request({protocolName:Ls,requestData:{type:Dt({type:s,groupID:e})?E.GRP_COMMUNITY:void 0,groupID:e,beginTime:r,endTime:u}}).then((function(o){var s=o.data,a=s.nextRevokedTime,r=s.notifyList;Ve.l("".concat(i," ok. groupID:").concat(e," nextRevokedTime:").concat(a));var u={dataList:[{elements:{revokedInfos:[]}}]};at(r)&&r.forEach((function(n){u.dataList[0].elements.revokedInfos.push({groupID:e,sequence:n.sequence,random:n.random,revokerInfo:t({},n.revokerInfo)})})),n.onGroupMessageRevoked(u),0!==a?(n._setGroupLastRevokedTime(e,a),n.getGroupNotify(e)):n._setGroupLastRevokedTime(e,1e3*Pe())})).catch((function(e){Ve.e("".concat(i," failed. error:"),e)}))}}}},{key:"_getGroupLastRevokedTime",value:function(e){return this.hasLocalGroup(e)?this.getLocalGroupProfile(e)._lastRevokedTime:0}},{key:"_setGroupLastRevokedTime",value:function(e,t){this.hasLocalGroup(e)&&(this.getLocalGroupProfile(e)._lastRevokedTime=t)}},{key:"isGroupCountersNotice",value:function(e){return this._groupCountersHandler.isGroupCountersNotice(e)}},{key:"setGroupCounters",value:function(e){return this._groupCountersHandler.setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._groupCountersHandler.increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._groupCountersHandler.decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._groupCountersHandler.getGroupCounters(e)}},{key:"restartPolling",value:function(){this._AVChatRoomHandler&&this._AVChatRoomHandler.restartPolling()}},{key:"getPollingTimerID",value:function(e){if(!e)return-1;var t=this.getLocalGroupProfile(e);return t&&Tt(t.type)?this._AVChatRoomHandler.getPollingTimerID(e):-1}},{key:"_canIUseJoinOption",value:function(e){return function(e){return e===E.GRP_PUBLIC}(e)||Dt({type:e})}},{key:"reset",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._groupAttributesHandler.reset(),this._groupCountersHandler.reset(),this._AVChatRoomHandler&&this._AVChatRoomHandler.reset()}}]),s}(uo),xi=function(){function e(t){o(this,e),this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.lastSendMsgTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this._initMember(t)}return a(e,[{key:"_initMember",value:function(e){this.updateMember(e)}},{key:"updateMember",value:function(e){var t=[null,void 0,"",0,NaN];e.memberCustomField&&Ct(this.memberCustomField,e.memberCustomField),pt(this,e,["memberCustomField","marks"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){it(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){it(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&Ct(this.memberCustomField,e)}}]),e}(),Vi=function(e){r(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="GroupMemberModule",t.groupMemberListMap=new Map,t.getInnerEmitterInstance().on(ni,t._onProfileUpdated,h(t)),t}return a(s,[{key:"_onProfileUpdated",value:function(e){for(var t=this,n=e.data,o=function(e){var o=n[e];t.groupMemberListMap.forEach((function(e){e.has(o.userID)&&e.get(o.userID).updateMember({nick:o.nick,avatar:o.avatar})}))},s=0;s100?100:i};Dt({groupID:n})?h.next="".concat(s):(h.offset=s,g=s+i);var _=[];return this.request({protocolName:Ns,requestData:h}).then((function(e){var o=e.data,s=o.members,a=o.memberNum,i=o.next,r=void 0===i?void 0:i;if(it(r)||(g=zt(r)?0:r),!at(s)||0===s.length)return g=0,Promise.resolve([]);var u=t.getModule(Pn);return u.hasLocalGroup(n)&&(u.getLocalGroupProfile(n).memberNum=a),_=t._updateLocalGroupMemberMap(n,s),t.getModule(Gn).getUserProfile({userIDList:s.map((function(e){return e.userID})),tagList:[He.NICK,He.AVATAR]})})).then((function(e){var o=e.data;if(!at(o)||0===o.length)return Xa({memberList:[],offset:g});var a=o.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));return t._updateLocalGroupMemberMap(n,a),_.length5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)),Ve.l("".concat(o," groupID:").concat(e.groupID," userIDList:").concat(e.userIDList.join(","))),e.userIDList.length>50&&(e.userIDList=e.userIDList.slice(0,50));var a=e.groupID,i=e.userIDList;return this._getGroupMemberProfileAdvance(t(t({},e),{},{userIDList:i})).then((function(e){var t=e.data.members;return at(t)&&0!==t.length?(n._updateLocalGroupMemberMap(a,t),n.getModule(Gn).getUserProfile({userIDList:t.map((function(e){return e.userID})),tagList:[He.NICK,He.AVATAR]})):Xa([])})).then((function(e){var t=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));n._updateLocalGroupMemberMap(a,t);var o=i.filter((function(e){return n.hasLocalGroupMember(a,e)})).map((function(e){return n.getLocalGroupMemberInfo(a,e)}));return s.setNetworkType(n.getNetworkType()).end(),Ya({memberList:o})}))}},{key:"addGroupMember",value:function(e){var t=this,n="".concat(this._n,".").concat("addGroupMember"),o=e.groupID,s=this.getModule(Pn).getLocalGroupProfile(o),a=s.type,i=new Aa("addGroupMember");if(i.setMessage("groupID:".concat(o," groupType:").concat(a)),Tt(a)){var r=new ja({code:ha.CANNOT_ADD_MEMBER_IN_AVCHATROOM});return i.setError(r,!0,this.getNetworkType()).end(),Za(r)}return e.userIDList=e.userIDList.map((function(e){return{userID:e}})),Ve.l("".concat(n," groupID:").concat(o)),this.request({protocolName:Us,requestData:e}).then((function(o){var a=o.data.members;Ve.l("".concat(n," ok"));var r=a.filter((function(e){return 1===e.result})).map((function(e){return e.userID})),u=a.filter((function(e){return 0===e.result})).map((function(e){return e.userID})),c=a.filter((function(e){return 2===e.result})).map((function(e){return e.userID})),l=a.filter((function(e){return 4===e.result})).map((function(e){return e.userID})),d="groupID:".concat(e.groupID,", ")+"successUserIDList:".concat(r,", ")+"failureUserIDList:".concat(u,", ")+"existedUserIDList:".concat(c,", ")+"overLimitUserIDList:".concat(l);return i.setNetworkType(t.getNetworkType()).setMoreMessage(d).end(),0===r.length?Ya({successUserIDList:r,failureUserIDList:u,existedUserIDList:c,overLimitUserIDList:l}):(s.memberCount+=r.length,t._updateConversationGroupProfile(s),Ya({successUserIDList:r,failureUserIDList:u,existedUserIDList:c,overLimitUserIDList:l,group:s}))})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"deleteGroupMember",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteGroupMember"),o=e.groupID,s=e.userIDList,a=this.getModule(Pn).getLocalGroupProfile(o);if(it(a))return Za({code:ha.CANNOT_FIND_GROUP});if(Tt(a.type))return this.canIUse(B.AVCHATROOM_BAN_MBR)?this._banAVChatRoomMember(e):Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var i=new Aa("deleteGroupMember"),r="groupID:".concat(o," ").concat(s.length>5?"userIDList.length:".concat(s.length):"userIDList:".concat(s));return i.setMessage(r),Ve.l("".concat(n," groupID:").concat(o," userIDList:"),s),this.request({protocolName:Ps,requestData:e}).then((function(){return i.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),a.memberCount-=1,t._updateConversationGroupProfile(a),t.deleteLocalGroupMembers(o,s),Ya({group:a,userIDList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"_updateConversationGroupProfile",value:function(e){this.getModule(qn).updateConversationGroupProfile([e])}},{key:"_banAVChatRoomMember",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteGroupMember"),o=e.groupID,s=e.userIDList,a="groupID:".concat(o," ").concat(s.length>5?"userIDList.length:".concat(s.length):"userIDList:".concat(s)),i=new Aa("deleteGroupMember");i.setMessage(a),Ve.l("".concat(n," groupID:").concat(o," userIDList:"),s);var r=this.getModule(Pn).getLocalGroupProfile(o);return it(e.duration)||0===e.duration?Za({code:ha.BAN_DURATION_INVALID}):this.request({protocolName:bs,requestData:e}).then((function(){return i.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),t.deleteLocalGroupMembers(o,s),Ya({group:r,userIDList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"setGroupMemberMuteTime",value:function(e){var t=this,n=e.groupID,o=e.userID,s=e.muteTime,a="".concat(this._n,".").concat("setGroupMemberMuteTime");if(o===this.getMyUserID())return Za(new ja({code:ha.CANNOT_MUTE_SELF}));Ve.l("".concat(a," groupID:").concat(n," userID:").concat(o));var i=new Aa("setGroupMemberMuteTime");return i.setMessage("groupID:".concat(n," userID:").concat(o," muteTime:").concat(s)),this.modifyGroupMemberInfo({groupID:n,userID:o,muteTime:s}).then((function(e){i.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(a," ok"));var o=t.getModule(Pn);return Ya({group:o.getLocalGroupProfile(n),member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.e("".concat(a," failed. error:"),e),Za(e)}))}},{key:"setGroupMemberRole",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupMemberRole"),o=e.groupID,s=e.userID,a=e.role,i=this.getModule(Pn).getLocalGroupProfile(o);if(i.selfInfo.role!==E.GRP_MBR_ROLE_OWNER)return Za({code:ha.NOT_OWNER});if([E.GRP_WORK,E.GRP_AVCHATROOM].includes(i.type))return Za({code:ha.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM});var r=[E.GRP_MBR_ROLE_ADMIN,E.GRP_MBR_ROLE_MEMBER];if(Dt({groupID:o})&&r.push(E.GRP_MBR_ROLE_CUSTOM),r.indexOf(a)<0)return Za({code:ha.INVALID_MEMBER_ROLE});if(s===this.getMyUserID())return Za({code:ha.CANNOT_SET_SELF_MEMBER_ROLE});var u=new Aa("setGroupMemberRole");return u.setMessage("groupID:".concat(o," userID:").concat(s," role:").concat(a)),Ve.l("".concat(n," groupID:").concat(o," userID:").concat(s)),this.modifyGroupMemberInfo({groupID:o,userID:s,role:a}).then((function(e){return u.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),Ya({group:i,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"_filterProfanity",value:function(e,t){var n=this.getModule(oo);if(!n)return!0;var o=n.filterText(t[e],J),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:"setGroupMemberNameCard",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupMemberNameCard");if(e.nameCard&&!1===this._filterProfanity("nameCard",e))return Za({code:ha.PROFANITY_FOUND});var o=e.groupID,s=e.userID,a=void 0===s?this.getMyUserID():s,i=e.nameCard;Ve.l("".concat(n," groupID:").concat(o," userID:").concat(a));var r=new Aa("setGroupMemberNameCard");return r.setMessage("groupID:".concat(o," userID:").concat(a," nameCard:").concat(i)),this.modifyGroupMemberInfo({groupID:o,userID:a,nameCard:i}).then((function(e){Ve.l("".concat(n," ok")),r.setNetworkType(t.getNetworkType()).end();var s=t.getModule(Pn).getLocalGroupProfile(o);return a===t.getMyUserID()&&s&&s.setSelfNameCard(i),Ya({group:s,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"setGroupMemberCustomField",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupMemberCustomField"),o=e.groupID,s=e.userID,a=void 0===s?this.getMyUserID():s,i=e.memberCustomField;Ve.l("".concat(n," groupID:").concat(o," userID:").concat(a));var r=new Aa("setGroupMemberCustomField");return r.setMessage("groupID:".concat(o," userID:").concat(a," memberCustomField:").concat(JSON.stringify(i))),this.modifyGroupMemberInfo({groupID:o,userID:a,memberCustomField:i}).then((function(e){r.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok"));var s=t.getModule(Pn).getLocalGroupProfile(o);return Ya({group:s,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"modifyGroupMemberInfo",value:function(e){var n=this,o=e.groupID,s=e.userID,a=void 0;return kt(o)&&(o=xt(a=o)),this.request({protocolName:ws,requestData:t(t({},e),{},{groupID:o,topicID:a})}).then((function(){if(n.hasLocalGroupMember(o,s)){var t=n.getLocalGroupMemberInfo(o,s);return it(e.muteTime)||t.updateMuteUntil(e.muteTime),it(e.role)||t.updateRole(e.role),it(e.nameCard)||t.updateNameCard(e.nameCard),it(e.memberCustomField)||t.updateMemberCustomField(e.memberCustomField),t}return n.getGroupMemberProfile({groupID:o,userIDList:[s]}).then((function(e){return v(e.data.memberList,1)[0]}))}))}},{key:"markGroupMemberList",value:function(e){var t=this,n="".concat(this._n,".").concat("markGroupMemberList"),o=e.groupID,s=e.markType,a=e.enableMark,i=e.userIDList,r=void 0===i?[]:i,u="groupID:".concat(o," markType:").concat(s," enableMark:").concat(a," userIDList count: ").concat(r.length);Ve.l("".concat(n," ").concat(u));var c=2,l=[];!0===a&&(c=1);var d=m(r);r.length>500&&(d=r.slice(0,500),Ve.w("".concat(n," ").concat(Wt(500)))),d.forEach((function(e){l.push({userID:e,markType:[s]})})),d=null;var p=new Aa("markGroupMemberList");return p.setMessage("".concat(u)),this.request({protocolName:Fs,requestData:{groupID:o,operationType:c,memberList:l}}).then((function(e){var o=e.data.memberList,s=void 0===o?[]:o,a=[],i=[];s.length===r.length?a.push.apply(a,m(r)):(s.forEach((function(e){a.push(e.userID)})),r.forEach((function(e){a.includes(e)||i.push(e)})));var u="success count:".concat(a.length," fail count:").concat(i.length);return p.setNetworkType(t.getNetworkType()).setMessage(u).end(),Ve.l("".concat(n," ok. ").concat(u)),Ya({successUserIDList:a,failureUserIDList:i})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];p.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this.request({protocolName:Gs,requestData:t(t({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:["Role","JoinTime","NameCard","ShutUpUntil"]})})}},{key:"_updateLocalGroupMemberMap",value:function(e,t){var n=this;return at(t)&&0!==t.length?t.map((function(t){return n.hasLocalGroupMember(e,t.userID)?n.getLocalGroupMemberInfo(e,t.userID).updateMember(t):n.setLocalGroupMember(e,new xi(t)),n.getLocalGroupMemberInfo(e,t.userID)})):[]}},{key:"deleteLocalGroupMembers",value:function(e,t){var n=this.groupMemberListMap.get(e);n&&t.forEach((function(e){n.delete(e)}))}},{key:"getLocalGroupMemberInfo",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:"setLocalGroupMember",value:function(e,t){if(this.groupMemberListMap.has(e))this.groupMemberListMap.get(e).set(t.userID,t);else{var n=(new Map).set(t.userID,t);this.groupMemberListMap.set(e,n)}}},{key:"getLocalGroupMemberList",value:function(e){return this.groupMemberListMap.get(e)}},{key:"hasLocalGroupMember",value:function(e,t){return this.groupMemberListMap.has(e)&&this.groupMemberListMap.get(e).has(t)}},{key:"hasLocalGroupMemberMap",value:function(e){return this.groupMemberListMap.has(e)}},{key:"reset",value:function(){this.groupMemberListMap.clear()}}]),s}(uo),Bi=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],Hi=function(e,t){return zt(e)?{lastTime:0,lastSequence:0,fromAccount:"",payload:null,type:"",messageForShow:"",nick:"",version:0,cloudCustomData:"",isRevoked:!1,revoker:null}:{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",payload:e.payload||null,type:e.type||"",messageForShow:Vt(e.type,e.payload,t),nick:e.nick||"",version:e.version||0,cloudCustomData:e.cloudCustomData||"",isRevoked:e.isRevoked||!1,revoker:e.revoker||null}},Ki=function(){function e(t,n){o(this,e),this.topicID="",this.topicName="",this.avatar="",this.introduction="",this.notification="",this.unreadCount=0,this.muteAllMembers=!1,this.customData="",this.groupAtInfoList=[],this.nextMessageSeq=0,this.lastMessage=Hi(t.lastMessage,n),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:"",excludedUnreadSequenceList:void 0},this._initTopic(t)}return a(e,[{key:"_initTopic",value:function(e){for(var t in e)Bi.indexOf(t)<0||("selfInfo"===t?this.updateSelfInfo(e[t]):this[t]="muteAllMembers"===t?1===e[t]:e[t])}},{key:"updateUnreadCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.unreadCount=e}},{key:"updateNextMessageSeq",value:function(e){this.nextMessageSeq=e}},{key:"updateLastMessage",value:function(e){this.lastMessage=Hi(e)}},{key:"updateGroupAtInfoList",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:"updateTopic",value:function(e){it(e.selfInfo)||this.updateSelfInfo(e.selfInfo),it(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),pt(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers","lastMsg"])}},{key:"updateSelfInfo",value:function(e){return 0!==pt(this.selfInfo,e,[],[""])}},{key:"reduceUnreadCount",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:"isLastMessageRevoked",value:function(e){return e.sequence===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}}]),e}(),Wi=function(e){r(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="TopicModule",t._topicMap=new Map,t._getTopicTimeMap=new Map,t.TOPIC_CACHE_TIME=300,t.TOPIC_LAST_ACTIVE_TIME=3600,t.getInnerEmitterInstance().on(ti,t._onCloudConfigUpdated,h(t)),t}return a(s,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");it(e)||(this.TOPIC_CACHE_TIME=Number(e)),it(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:"onTopicCreated",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOuterEvent(k.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var t=this,n=e.groupID,o=e.topicIDList;(void 0===o?[]:o).forEach((function(e){t._deleteLocalTopic(n,e)})),this.emitOuterEvent(k.TOPIC_DELETED,e)}},{key:"onTopicMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=e.messageRemindType,s=this.getLocalTopic(t,n);if(s){var a=s.updateSelfInfo({messageRemindType:o});a&&this.emitOuterEvent(k.TOPIC_UPDATED,{groupID:t,topic:s}),Ve.d("".concat(this._n,".onTopicMessageRemindTypeUpdated topicID:").concat(n)+" messageRemindType:".concat(o," isTopicUpdated:").concat(a))}}},{key:"onTopicProfileUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=this.getLocalTopic(t,n);o&&(o.updateTopic(e),this.emitOuterEvent(k.TOPIC_UPDATED,{groupID:t,topic:o}))}},{key:"onConversationProxy",value:function(e){var t=e.topicID,n=e.unreadCount,o=e.groupAtInfoList,s=xt(t),a=this.getLocalTopic(s,t),i=!1;a&&(it(n)||a.unreadCount===n||(a.updateUnreadCount(n),i=!0),it(o)||(a.updateGroupAtInfoList(o),i=!0)),i&&this.emitOuterEvent(k.TOPIC_UPDATED,{groupID:s,topic:a})}},{key:"onMessageSent",value:function(e){var t=e.groupID,n=e.topicID,o=e.lastMessage,s=this.getLocalTopic(t,n);s&&(s.nextMessageSeq+=1,s.updateLastMessage(o),this.emitOuterEvent(k.TOPIC_UPDATED,{groupID:t,topic:s}))}},{key:"onMessageModified",value:function(e){var t=e.to,n=e.time,o=e.sequence,s=e.elements,a=e.cloudCustomData,i=e.messageVersion,r=xt(t),u=this.getLocalTopic(r,t);if(u){var c=u.lastMessage;Ve.d("".concat(this._n,".onMessageModified topicID:").concat(t," lastMessage:"),JSON.stringify(c),"options:",JSON.stringify(e)),c&&(null===c.payload||c.lastTime===n&&c.lastSequence===o&&c.version!==i)&&(c.type=s[0].type,c.payload=s[0].content,c.messageForShow=Vt(c.type,c.payload,this.isIntl()),c.cloudCustomData=a,c.version=i,c.lastSequence=o,c.lastTime=n,this.emitOuterEvent(k.TOPIC_UPDATED,{groupID:r,topic:u}))}}},{key:"onMessageRevoked",value:function(e){var t=this;if(0!==e.length){var n=null,o=null,s=!1;e.forEach((function(e){var a=e.to;o=xt(a),(n=t.getLocalTopic(o,a))&&(n.reduceUnreadCount()&&(s=!0),n.isLastMessageRevoked(e)&&(n.setLastMessageRevoked(!0),n.setLastMessageRevoker(e.revoker),s=!0))})),s&&this.emitOuterEvent(k.TOPIC_UPDATED,{groupID:o,topic:n})}}},{key:"isLastMessageRevoked",value:function(e){var t=e.topicID,n=e.sequence,o=xt(t),s=this.getLocalTopic(o,t),a=!1;return s&&(a=s.isLastMessageRevoked({sequence:n})),a}},{key:"getJoinedCommunityList",value:function(){return this.getModule(Pn).getGroupList({isGroupWithTopicOnly:!0}).then((function(e){var t=e.data.groupList;return Ya({groupList:void 0===t?[]:t})})).catch((function(e){return Za(e)}))}},{key:"createTopicInCommunity",value:function(e){var n=this,o="".concat(this._n,".").concat("createTopicInCommunity"),s=e.topicID;if(!it(s)&&!kt(s))return Za({code:ha.ILLEGAL_TOPIC_ID});if(e.topicName&&!1===this._filterProfanity("topicName",e))return Za({code:ha.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Za({code:ha.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Za({code:ha.PROFANITY_FOUND});var a=new Aa("createTopicInCommunity");return this.request({protocolName:ta,requestData:t({},e)}).then((function(s){var i=s.data.topicID;return a.setMessage("topicID:".concat(i)).setNetworkType(n.getNetworkType()).end(),Ve.l("".concat(o," ok")),n._updateTopicMap([t(t({},e),{},{topicID:i})]),Ya({topicID:i})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),Za(e)}))}},{key:"deleteTopicFromCommunity",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteTopicFromCommunity"),o=e.groupID,s=e.topicIDList,a=void 0===s?[]:s,i=new Aa("deleteTopicFromCommunity");return i.setMessage("groupID:".concat(o," topicIDList:").concat(a)),this.request({protocolName:na,requestData:{groupID:o,topicIDList:a}}).then((function(e){var n=e.data.resultList,s=[],a=[];(void 0===n?[]:n).forEach((function(e){var t=e.topicID,n=e.errorCode,o=e.errorInfo;0===n?s.push({topicID:t}):a.push({topicID:t,code:n,message:o})}));var r="success count:".concat(s.length,", fail count:").concat(a.length);return i.setMoreMessage("".concat(r)).setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(r)),s.forEach((function(e){t._deleteLocalTopic(o,e.topicID)})),Ya({successTopicList:s,failureTopicList:a})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"updateTopicProfile",value:function(e){var n=this,o="".concat(this._n,".").concat("updateTopicProfile");if(Ve.l("".concat(o," options:"),e),e.topicName&&!1===this._filterProfanity("topicName",e))return Za({code:ha.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Za({code:ha.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Za({code:ha.PROFANITY_FOUND});var s=new Aa("updateTopicProfile");return s.setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),it(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.request({protocolName:oa,requestData:t({},e)}).then((function(){return s.setNetworkType(n.getNetworkType()).end(),Ve.l("".concat(o," ok")),n._updateTopicMap([e]),Ya({topic:n.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Ve.e("".concat(o," failed. error:"),e),Za(e)}))}},{key:"getTopicList",value:function(e){var n=this,o="".concat(this._n,".").concat("getTopicList"),s=e.groupID,a=e.topicIDList,i=void 0===a?[]:a,r=0===i.length,u=new Aa("getTopicList");if(u.setMessage("groupID:".concat(s)),this._getTopicTimeMap.has(s)){var c=this._getTopicTimeMap.get(s),l=c.isGetAll,d=c.time;if((l||!l&&!r)&&Date.now()-d<1e3*this.TOPIC_CACHE_TIME){var p=this._getLocalTopicList(s,i);if(r||p.length===i.length)return u.setNetworkType(this.getNetworkType()).setMoreMessage("from cache, topic count:".concat(p.length)).end(),Ve.l("".concat(o," groupID:").concat(s," from cache, topic count:").concat(p.length)),Xa({successTopicList:p,failureTopicList:[]})}}return this.request({protocolName:sa,requestData:{groupID:s,topicIDList:i}}).then((function(e){var a=e.data.topicInfoList,i=[],c=[],l=[];(void 0===a?[]:a).forEach((function(e){var n=e.topic,o=e.selfInfo,s=e.errorCode,a=e.errorInfo,r=n.topicID;0===s?(i.push(t(t({},n),{},{selfInfo:o})),c.push(r)):l.push({topicID:r,code:s,message:a})})),n._updateTopicMap(i),n._handleTopicAtInfo(i);var d="success count:".concat(c.length,", fail count:").concat(l.length);u.setNetworkType(n.getNetworkType()).setMoreMessage("".concat(d)).end(),Ve.l("".concat(o," groupID:").concat(s," from remote, ").concat(d));var p=[];return zt(c)||(n._getTopicTimeMap.set(s,{time:Date.now(),isGetAll:r}),p=n._getLocalTopicList(s,c)),Ya({successTopicList:p,failureTopicList:l})})).catch((function(e){return n.probeNetwork(e).then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),Za(e)}))}},{key:"hasLocalTopic",value:function(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}},{key:"getLocalTopic",value:function(e,t){var n=null;return this._topicMap.has(e)&&(n=this._topicMap.get(e).get(t)),n}},{key:"_getLocalTopicList",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this._topicMap.get(e),o=[];return n&&(o=m(n.values())),0===t.length?o:o.filter((function(e){return t.includes(e.topicID)}))}},{key:"_deleteLocalTopic",value:function(e,t){this._topicMap.has(e)&&(this._topicMap.get(e).delete(t),Ve.l("".concat(this._n,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(t)))}},{key:"_updateTopicMap",value:function(e){var t=this,n=[];(e.forEach((function(e){var o=e.groupID,s=e.topicID,a=null;t._topicMap.has(o)||t._topicMap.set(o,new Map),t._topicMap.get(o).has(s)?(a=t._topicMap.get(o).get(s)).updateTopic(e):(t._getTopicLastMessage(e),a=new Ki(e,t.isIntl()),t._topicMap.get(o).set(s,a));var i=t._computeUnreadCount(a);a.updateUnreadCount(i),n.push({conversationID:"".concat(E.CONV_GROUP).concat(s),type:E.CONV_TOPIC,unreadCount:i})})),n.length>0)&&this.getModule(qn).updateTopicConversation(n)}},{key:"resetGetTopicTime",value:function(e){var t=this;it(e)?m(this._getTopicTimeMap.keys()).forEach((function(e){t._getTopicTimeMap.set(e,0)})):this._getTopicTimeMap.set(e,0)}},{key:"getTopicListOnReconnected",value:function(){var e=this,t=m(this._topicMap.keys()),n=[];t.forEach((function(t){var o=[];e._getLocalTopicList(t).forEach((function(t){var n=t.lastMessage.lastTime,s=void 0===n?0:n;Date.now()-1e3*s<1e3*e.TOPIC_LAST_ACTIVE_TIME&&o.push(t.topicID)})),o.length>0&&n.push({groupID:t,topicIDList:o})})),Ve.l("".concat(this._n,".getTopicListOnReconnected. active community count:").concat(n.length)),this._relayGetTopicList(n)}},{key:"_relayGetTopicList",value:function(e){var t=this;if(0!==e.length){var n=e.shift(),o=n.topicIDList.length>5?"topicIDList.length:".concat(n.topicIDList.length):"topicIDList:".concat(n.topicIDList),s=new Aa("relayGetTopicList");s.setMessage(o),Ve.l("".concat(this._n,"._relayGetTopicList. ").concat(o)),this.getTopicList(n).then((function(){s.setNetworkType(t.getNetworkType()).end(),t._relayGetTopicList(e)})).catch((function(n){t.probeNetwork().then((function(e){var t=v(e,2),o=t[0],a=t[1];s.setError(n,o,a).end()})),t._relayGetTopicList(e)}))}}},{key:"_handleTopicAtInfo",value:function(e){var n=this;0!==e.length&&e.forEach((function(e){var o=e.groupID,s=e.topicID,a=e.groupAtInfoList,i=[];it(a)||(a.forEach((function(e){i.push(t(t({},e),{},{groupID:o,topicID:s}))})),n.getModule(qn).onNewGroupAtTips({dataList:i}))}))}},{key:"_getTopicLastMessage",value:function(e){if(!it(e.lastMsg)){var t={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:"",nick:e.lastMsg.nick,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:2===e.lastMsg.isPlaceMessage,revoker:zt(e.lastMsg.revokerInfo)?null:e.lastMsg.revokerInfo.revoker};e.lastMessage=t}}},{key:"deleteTopicListInCommunity",value:function(e){var t=this,n=this._getLocalTopicList(e),o=this.getModule(qn);n.forEach((function(n){var s=n.topicID;t._deleteLocalTopic(e,s),t._getTopicTimeMap.delete(e),o.deleteLocalConversation("".concat(E.CONV_GROUP).concat(s))}))}},{key:"_computeUnreadCount",value:function(e){var t=e.selfInfo,n=t.excludedUnreadSequenceList,o=t.readedSequence,s=e.nextMessageSeq-e.selfInfo.readedSequence-1;if(at(n)){var a=0;n.forEach((function(t){t>=o&&t<=e.nextMessageSeq-1&&(a+=1)})),a>=1&&(s-=a)}return s<0?0:s}},{key:"_filterProfanity",value:function(e,t){var n=this.getModule(oo);if(!n)return!0;var o=n.filterText(t[e],z),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:"updateLastMessage",value:function(e,t){var n=xt(e),o=this.getLocalTopic(n,e);if(o){var s=t.sequence+1;o.updateNextMessageSeq(s),o.updateLastMessage(t),this.emitOuterEvent(k.TOPIC_UPDATED,{groupID:n,topic:o})}}},{key:"getMessageExtensions",value:function(e,t){Ve.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t));var n=xt(e.to);return this.request({protocolName:Ss,requestData:{groupID:n,topicID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMessageExtensions",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;Ve.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n));var o=xt(e.to);return this.request({protocolName:Es,requestData:{groupID:o,topicID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),s}(uo),Yi=function(){function e(t){o(this,e),this._userModule=t,this._n="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}return a(e,[{key:"setExpirationTime",value:function(e){this.expirationTime=e}},{key:"getUserProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getUserProfile"),o=e.userIDList;e.fromAccount=this._userModule.getMyAccount(),o.length>100&&(Ve.w("".concat(n," ").concat(Wt(100))),o.length=100);for(var s,a=[],i=[],r=0,u=o.length;r5?"userIDList.length:".concat(o.length):"userIDList:".concat(o)),this._userModule.request({protocolName:mo,requestData:e}).then((function(e){d.setNetworkType(t._userModule.getNetworkType()).end(),Ve.i("".concat(n," ok"));var o=t._handleResponse(e).concat(i);return Ya(c?o[0]:o)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];d.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"getMyProfile",value:function(){var e=this._userModule.getMyAccount(),t="".concat(this._n,".getMyProfile");if(Ve.l("".concat(t," myAccount:").concat(e)),this._fill(),this._contains(e)){var n=this._getProfileFromMap(e);return Ve.d("".concat(t," from cache, myProfile:").concat(JSON.stringify(n))),Xa(n)}return this.getUserProfile({fromAccount:e,userIDList:[e],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){var t=e.data.userProfileItem;if(!at(t))return[];for(var n=[],o=Date.now(),s=0,a=t.length;s-1)n.profileCustomField.push({key:t[o].tag,value:t[o].value});else switch(t[o].tag){case He.NICK:n.nick=t[o].value;break;case He.GENDER:n.gender=t[o].value;break;case He.BIRTHDAY:n.birthday=t[o].value;break;case He.LOCATION:n.location=t[o].value;break;case He.SELFSIGNATURE:n.selfSignature=t[o].value;break;case He.ALLOWTYPE:n.allowType=t[o].value;break;case He.LANGUAGE:n.language=t[o].value;break;case He.AVATAR:n.avatar=t[o].value;break;case He.MESSAGESETTINGS:n.messageSettings=t[o].value;break;case He.ADMINFORBIDTYPE:n.adminForbidType=t[o].value;break;case He.LEVEL:n.level=t[o].value;break;case He.ROLE:n.role=t[o].value;break;default:Ve.w("".concat(this._n,"._getLatestProfileFromResponse unknown tag:"),t[o].tag,t[o].value)}return n}},{key:"updateMyProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("updateMyProfile");if(e.nick&&!1===this._userModule.filterProfanity("nick",e))return Za({code:ha.PROFANITY_FOUND});if(e.selfSignature&&!1===this._userModule.filterProfanity("selfSignature",e))return Za({code:ha.PROFANITY_FOUND});var o=new Aa("updateMyProfile");o.setMessage(JSON.stringify(e));var s=(new li).validate(e);if(!s.valid)return o.setCode(ha.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:".concat(s.tips)).setNetworkType(this._userModule.getNetworkType()).end(),Ve.e("".concat(n," info:").concat(s.tips)),Za({code:ha.UPDATE_PROFILE_INVALID_PARAM});var a=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&("profileCustomField"===i?e.profileCustomField.forEach((function(e){a.push({tag:e.key,value:e.value})})):a.push({tag:He[i.toUpperCase()],value:e[i]}));if(0===a.length){var r=new ja({code:ha.UPDATE_PROFILE_NO_KEY});return o.setError(r,!0,this._userModule.getNetworkType()).end(),Ve.e("".concat(n," failed. error:"),r),Za(r)}var u=this._userModule.getMyAccount();return this._userModule.request({protocolName:Mo,requestData:{fromAccount:u,profileItem:a}}).then((function(s){o.setNetworkType(t._userModule.getNetworkType()).end(),Ve.i("".concat(n," ok"));var a=t._update(u,e),i=a.isProfileUpdated,r=a.latestProfile;return!0===i&&t._userModule.emitOuterEvent(k.PROFILE_UPDATED,[r]),Xa(r)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"onProfileModified",value:function(e){var t=e.dataList;if(!zt(t)){var n,o=t.length;Ve.d("".concat(this._n,".onProfileModified count:").concat(o," dataList:"),e.dataList);for(var s=[],a=0;a0&&(this._userModule.emitInnerEvent(ni,s),this._userModule.emitOuterEvent(k.PROFILE_UPDATED,s))}}},{key:"_fill",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),n=0,o=e.length;n0&&(n.lastUpdatedTime=s,o=!0)):(n=new li(t),(this._userModule.isMyFriend(e)||e===this._userModule.getMyAccount())&&(n.lastUpdatedTime=s,o=!0,this.accountProfileMap.set(e,n)));return this._flush(e===this._userModule.getMyAccount()),Ve.l("".concat(this._n,"._update account:").concat(e," isProfileUpdated:").concat(o)),{isProfileUpdated:o,latestProfile:n}}},{key:"_flush",value:function(e){var t=m(this.accountProfileMap.values()),n=this._userModule.getStorageModule();Ve.d("".concat(this._n,"._flush length:").concat(t.length," flushAtOnce:").concat(e)),n.setItem(this.TAG,t,e)}},{key:"_contains",value:function(e){return this.accountProfileMap.has(e)}},{key:"_getProfileFromMap",value:function(e){return this.accountProfileMap.get(e)}},{key:"_getCachedProfiles",value:function(){var e=this._userModule.getStorageModule().getItem(this.TAG);return zt(e)?[]:e}},{key:"onConversationsProfileUpdated",value:function(e){for(var t,n,o,s=[],a=0,i=e.length;a0&&s.push(n)):s.push(t.userID));0!==s.length&&(Ve.i("".concat(this._n,".onConversationsProfileUpdated toAccountList:").concat(s)),this.getUserProfile({userIDList:s}))}},{key:"getNickAndAvatarByUserID",value:function(e){if(this._contains(e)){var t=this._getProfileFromMap(e);return{nick:t.nick,avatar:t.avatar}}return{nick:"",avatar:""}}},{key:"reset",value:function(){this._flush(!0),this.accountProfileMap.clear()}}]),e}(),ji=a((function e(t){o(this,e),zt||(this.userID=t.userID||"",this.timeStamp=t.timeStamp||0)})),zi=function(){function e(t){o(this,e),this._userModule=t,this._n="BlacklistHandler",this._blacklistMap=new Map,this.startIndex=0,this.maxLimited=100,this.currentSequence=0}return a(e,[{key:"getLocalBlacklist",value:function(){return m(this._blacklistMap.keys())}},{key:"getBlacklist",value:function(){var e=this,t="".concat(this._n,".getBlacklist"),n={fromAccount:this._userModule.getMyAccount(),maxLimited:this.maxLimited,startIndex:0,lastSequence:this.currentSequence},o=new Aa("getBlacklist");return this._userModule.request({protocolName:yo,requestData:n}).then((function(n){var s=n.data,a=s.blackListItem,i=s.currentSequence,r=zt(a)?0:a.length;o.setNetworkType(e._userModule.getNetworkType()).setMessage("count:".concat(r)).end(),Ve.i("".concat(t," ok")),e.currentSequence=i,e._handleResponse(a,!0),e._userModule.emitOuterEvent(k.BLACKLIST_UPDATED,m(e._blacklistMap.keys()))})).catch((function(n){return e._userModule.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];o.setError(n,s,a).end()})),Ve.e("".concat(t," failed. error:"),n),Za(n)}))}},{key:"addBlacklist",value:function(e){var t=this,n=new Aa("addToBlacklist"),o="".concat(this._n,".addBlacklist"),s=this._userModule.getMyAccount();if(1===e.userIDList.length&&e.userIDList[0]===s){var a=ha.CANNOT_ADD_SELF_TO_BLACKLIST,i=this._userModule.getErrorMessage(a);n.setCode(a).setMessage(i).setNetworkType(this._userModule.getNetworkType()).end();var r=new ja({code:a});return Ve.e("".concat(o," failed. error:"),r),Za(r)}return e.userIDList.includes(s)&&(e.userIDList=e.userIDList.filter((function(e){return e!==s}))),e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Io,requestData:e}).then((function(s){return n.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),Ve.i("".concat(o," ok")),t._handleResponse(s.resultItem,!0),Ya(m(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=v(t,2),s=o[0],a=o[1];n.setError(e,s,a).end()})),Ve.e("".concat(o," failed. error:"),e),Za(e)}))}},{key:"_handleResponse",value:function(e,t){if(!zt(e))for(var n,o,s,a=0,i=e.length;a5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),Ve.i("".concat(n," ok")),t._handleResponse(s.data.resultItem,!1),Ya(m(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"onAccountDeleted",value:function(e){for(var t,n=[],o=0,s=e.length;o0&&(Ve.l("".concat(this._n,".onAccountDeleted count:").concat(n.length," userIDList:"),n),this._userModule.emitOuterEvent(k.BLACKLIST_UPDATED,m(this._blacklistMap.keys())))}},{key:"onAccountAdded",value:function(e){for(var t,n=[],o=0,s=e.length;o0&&(Ve.l("".concat(this._n,".onAccountAdded count:").concat(n.length," userIDList:"),n),this._userModule.emitOuterEvent(k.BLACKLIST_UPDATED,m(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.currentSequence=0}}]),e}(),Ji=function(e){var t=String(e).replace(/[=]+$/,""),n="";if(t.length%4==1)return"";for(var o,s,a=0,i=0;s=t.charAt(i++);~s&&(o=a%4?64*o+s:s,a++%4)?n+=String.fromCharCode(255&o>>(-2*a&6)):0)s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);try{return decodeURIComponent(escape(n))}catch(r){return""}},Xi=function(){function e(t){o(this,e),this._userModule=t,this._n="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userModule.getInnerEmitterInstance().on(ti,this._onCloudConfigUpdated,this)}return a(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._userModule.getCloudConfig("status_query_count"),t=this._userModule.getCloudConfig("status_sub_count"),n=this._userModule.getCloudConfig("status_unsub_count");Ve.l("".concat(this._n,"._onCloudConfigUpdated statusQueryCount:").concat(e," statusSubscribeCount:").concat(t)+" statusUnsubscribeCount:".concat(n)),it(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),it(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),it(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(n,10))}},{key:"onUserStatusUpdated",value:function(e){var t=e.dataList,n=this._userModule.getMyUserID(),o=this._userModule.getModule(xn),s=t.map((function(e){var t=e.to,s=e.statusType,a=e.customStatus,i=Ji(a);return t===n&&o.setCustomStatus(i),{userID:t,statusType:s,customStatus:i}}));this._userModule.emitOuterEvent(k.USER_STATUS_UPDATED,s)}},{key:"setSelfStatus",value:function(e){var t=this,n="".concat(this._n,".setSelfStatus");if(!1===this._userModule.filterProfanity("customStatus",e))return Za({code:ha.PROFANITY_FOUND});var o=new Aa("setSelfStatus"),s=e.customStatus;return this._userModule.request({protocolName:aa,requestData:{customStatus:s}}).then((function(e){return o.setNetworkType(t._userModule.getNetworkType()).setMessage("customStatus:".concat(s)).end(),Ve.l("".concat(n," ok. customStatus:").concat(s)),t._userModule.getModule(xn).setCustomStatus(s),Ya({userID:t._userModule.getMyUserID(),statusType:1,customStatus:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"getUserStatus",value:function(e){var t=this,n="".concat(this._n,".getUserStatus"),o=e.userIDList,s=void 0===o?[]:o,a=this._userModule.getMyUserID(),i=m(s),r=void 0,u=i.indexOf(a);if(u>-1){i.splice(u,1);var c=this._userModule.getModule(xn).getCustomStatus();r={userID:a,statusType:1,customStatus:c}}if(0===i.length)return Xa({successUserList:[r],failureUserList:[]});if(!this._userModule.canIUse(B.USER_STATUS))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});i.length>this.MAX_QUERY_USER_COUNT&&(Ve.w("".concat(n," ").concat(Wt(this.MAX_QUERY_USER_COUNT))),i=s.slice(0,this.MAX_QUERY_USER_COUNT));var l=new Aa("getUserStatus");return this._userModule.request({protocolName:ia,requestData:{userIDList:i}}).then((function(e){var o=e.data,a=o.successUserList,i=void 0===a?[]:a,u=o.failureUserList,c=void 0===u?[]:u,d=i.map((function(e){var t=e.userID,n=e.statusType,o=e.customStatus;return{userID:t,statusType:n,customStatus:Ji(o)}})),p=c.map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:zt(n)?t:n,code:o,message:s}}));it(r)||d.unshift(r);var g="userID count:".concat(s.length,", success count:").concat(d.length,", fail count:").concat(p.length);return l.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(g)).end(),Ve.l("".concat(n," ok. ").concat(g,".")),Ya({successUserList:d,failureUserList:p})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];l.setMessage("userID count:".concat(s.length)).setError(e,o,a).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"subscribeUserStatus",value:function(e){var t=this;if(!this._userModule.canIUse(B.USER_STATUS))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".subscribeUserStatus"),o=e.userIDList,s=void 0===o?[]:o,a=m(s);a.length>this.MAX_SUBSCRIBE_USER_COUNT&&(Ve.w("".concat(n," ").concat(Wt(this.MAX_SUBSCRIBE_USER_COUNT))),a=s.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));var i=new Aa("subscribeUserStatus"),r="userID count:".concat(s.length);return Ve.l("".concat(n," ").concat(r)),this._userModule.request({protocolName:ra,requestData:{userIDList:a}}).then((function(e){var o=e.data.failureUserList,s=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:zt(n)?t:n,code:o,message:s}}));return i.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(r," fail count:").concat(s.length)).end(),Ve.l("".concat(n," ok. fail count:").concat(s.length,".")),Ya({failureUserList:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setMessage("".concat(r)).setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"unsubscribeUserStatus",value:function(e){var t=this;if(!this._userModule.canIUse(B.USER_STATUS))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".unsubscribeUserStatus"),o=(e||{}).userIDList,s=void 0===o?[]:o,a=m(s);s.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(Ve.w("".concat(n," ").concat(Wt(this.MAX_UNSUBSCRIBE_USER_COUNT))),a=s.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));var i=new Aa("unsubscribeUserStatus"),r="userID count:".concat(s.length);Ve.l("".concat(n," ").concat(r));var u={userIDList:a};return 0===a.length&&(u.userIDList=void 0,u.unsubscribeAll=1),this._userModule.request({protocolName:ua,requestData:u}).then((function(e){var o=e.data.failureUserList,s=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:zt(n)?t:n,code:o,message:s}}));return i.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(r," fail count:").concat(s.length)).end(),Ve.l("".concat(n," ok. fail count:").concat(s.length,".")),Ya({failureUserList:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setMessage("".concat(r)).setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),e}(),Zi=function(e){r(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="UserModule",s._profileHandler=new Yi(h(s)),s._blacklistHandler=new zi(h(s)),s._userStatusHandler=new Xi(h(s)),s.getInnerEmitterInstance().on(ei,s.onContextUpdated,h(s)),s}return a(n,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t=e.dataList;if(!zt(t)){var n=[];t.forEach((function(e){e.blackListDelAccount&&n.push.apply(n,m(e.blackListDelAccount))})),n.length>0&&this._blacklistHandler.onAccountDeleted(n);var o=[];t.forEach((function(e){e.blackListAddAccount&&o.push.apply(o,m(e.blackListAddAccount))})),o.length>0&&this._blacklistHandler.onAccountAdded(o)}}},{key:"onConversationsProfileUpdated",value:function(e){this._profileHandler.onConversationsProfileUpdated(e)}},{key:"getMyAccount",value:function(){return this.getMyUserID()}},{key:"getMyProfile",value:function(){return this._profileHandler.getMyProfile()}},{key:"getStorageModule",value:function(){return this.getModule(Vn)}},{key:"filterProfanity",value:function(e,t){var n=this.getModule(oo);if(!n)return!0;var o=n.filterText(t[e],j),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:"isMyFriend",value:function(e){var t=this.getModule(bn);return!!t&&t.isMyFriend(e)}},{key:"getUserProfile",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:"getNickAndAvatarByUserID",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:"getLocalBlacklist",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return Xa(e)}},{key:"addBlacklist",value:function(e){return this._blacklistHandler.addBlacklist(e)}},{key:"deleteBlacklist",value:function(e){return this._blacklistHandler.deleteBlacklist(e)}},{key:"onUserStatusUpdated",value:function(e){this._userStatusHandler.onUserStatusUpdated(e)}},{key:"setSelfStatus",value:function(e){return this._userStatusHandler.setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._userStatusHandler.getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._userStatusHandler.subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._userStatusHandler.unsubscribeUserStatus(e)}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),n}(uo),Qi=function(){function e(t,n){o(this,e),this._m=t,this._isLoggedIn=!1,this._SDKAppID=n.SDKAppID,this._userID=n.userID||"",this._userSig=n.userSig||"",this._version="2.27.6",this._a2Key="",this._tinyID="",this._customStatus="",this._contentType="json",this._unlimitedAVChatRoom=n.unlimitedAVChatRoom,this._scene=n.scene||"",this._oversea=n.oversea,this._instanceID=n.instanceID,this._statusInstanceID=0,this._isDevMode=n.devMode,this._proxyServer=n.proxyServer,this._fileUploadProxy=n.fileUploadProxy,this._fileDownloadProxy=n.fileDownloadProxy}return a(e,[{key:"isLoggedIn",value:function(){return this._isLoggedIn}},{key:"isOversea",value:function(){return this._oversea}},{key:"isPrivateNetWork",value:function(){return this._proxyServer}},{key:"isDevMode",value:function(){return this._isDevMode}},{key:"isSingaporeSite",value:function(){return this._SDKAppID>=2e7&&this._SDKAppID<3e7||this._SDKAppID>=172e7&&this._SDKAppID<173e7}},{key:"isKoreaSite",value:function(){return this._SDKAppID>=3e7&&this._SDKAppID<4e7||this._SDKAppID>=173e7&&this._SDKAppID<174e7}},{key:"isGermanySite",value:function(){return this._SDKAppID>=4e7&&this._SDKAppID<5e7||this._SDKAppID>=174e7&&this._SDKAppID<175e7}},{key:"isIndiaSite",value:function(){return this._SDKAppID>=5e7&&this._SDKAppID<6e7||this._SDKAppID>=175e7&&this._SDKAppID<176e7}},{key:"isJapanSite",value:function(){return this._SDKAppID>=6e7&&this._SDKAppID<7e7||this._SDKAppID>=176e7&&this._SDKAppID<177e7}},{key:"isUSASite",value:function(){return this._SDKAppID>=7e7&&this._SDKAppID<8e7||this._SDKAppID>=177e7&&this._SDKAppID<178e7}},{key:"isIntl",value:function(){return 0===(e=this._SDKAppID)||e>=2e7&&e<8e7||e>=172e7&&e<178e7;var e}},{key:"isUnlimitedAVChatRoom",value:function(){return this._unlimitedAVChatRoom}},{key:"setUserID",value:function(e){this._userID=e}},{key:"getUserID",value:function(){return this._userID}},{key:"setUserSig",value:function(e){this._userSig=e}},{key:"getUserSig",value:function(){return this._userSig}},{key:"getSDKAppID",value:function(){return this._SDKAppID}},{key:"setTinyID",value:function(e){this._tinyID=e,this._isLoggedIn=!0}},{key:"getTinyID",value:function(){return this._tinyID}},{key:"setCustomStatus",value:function(e){this._customStatus=e}},{key:"getCustomStatus",value:function(){return this._customStatus}},{key:"getScene",value:function(){return Ae?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(e){this._statusInstanceID=e}},{key:"getVersion",value:function(){return this._version}},{key:"getA2Key",value:function(){return this._a2Key}},{key:"setA2Key",value:function(e){this._a2Key=e}},{key:"getContentType",value:function(){return this._contentType}},{key:"getProxyServer",value:function(){return this._proxyServer}},{key:"getFileUploadProxy",value:function(){return this._fileUploadProxy}},{key:"getFileDownloadProxy",value:function(){return this._fileDownloadProxy}},{key:"_isTUIKit",value:function(){var e=!1,t=!1,n=!1,o=!1,s=[];ae&&(s=Object.keys(re)),ie&&(s=se?Object.keys(uni):Object.keys(window));for(var a=0,i=s.length;a0){for(var c=0,l=u.length;c0&&void 0!==arguments[0]?arguments[0]:0;if(!this.isLoggedIn())return Za({code:ha.USER_NOT_LOGGED_IN});var n=new Aa("logout");n.setNetworkType(this.getNetworkType()).setMessage("identifier:".concat(this.getMyUserID())).end(!0);var o="".concat(this._n,".logout");return Ve.i("".concat(o," type:").concat(t)),0===t&&this._m.setNotReadyReason(ha.LOGGED_OUT),this.request({protocolName:lo,requestData:{type:t}}).then((function(){return e.resetReady(),Xa({})})).catch((function(t){return Ve.e("".concat(o," error:"),t),e.resetReady(),Xa({})}))}},{key:"_fetchCloudControlConfig",value:function(){this.getModule(Zn).fetchConfig()}},{key:"_getStatusInstanceID",value:function(){return uni.getStorageSync("timUniAppInstanceID")}},{key:"_hello",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.request({protocolName:po,requestData:{isWebUniapp:this._isWebUniapp}}).catch((function(t){Ve.w("".concat(e._n,"._hello error:"),t)}))}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var t=0;return zt(this.getModule(xn).getSDKAppID())?t=ha.NO_SDKAPPID:zt(e.userID)?t=ha.NO_IDENTIFIER:zt(e.userSig)&&(t=ha.NO_USERSIG),{code:t}}},{key:"_isReactUIKit",value:function(){return ie&&void 0!==window.tencent_cloud_im_csig_react_uikit_23F_xa}},{key:"onMultipleAccountKickedOut",value:function(e){var t=this;new Aa("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(E.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ve.w("".concat(this._n,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(k.KICKED_OUT,{type:E.KICKED_OUT_MULT_ACCOUNT}),t._m.setNotReadyReason(ha.KICKED_OUT_MULT_ACCOUNT),t._m.reset()}))}},{key:"onMultipleDeviceKickedOut",value:function(e){var t=this;new Aa("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(E.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ve.w("".concat(this._n,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(k.KICKED_OUT,{type:E.KICKED_OUT_MULT_DEVICE}),t._m.setNotReadyReason(ha.KICKED_OUT_MULT_DEVICE),t._m.reset()}))}},{key:"onUserSigExpired",value:function(){new Aa("kickedOut").setNetworkType(this.getNetworkType()).setMessage(E.KICKED_OUT_USERSIG_EXPIRED).end(!0),Ve.w("".concat(this._n,".onUserSigExpired: userSig expired")),0!==this.getModule(xn).getStatusInstanceID()&&(this.emitOuterEvent(k.KICKED_OUT,{type:E.KICKED_OUT_USERSIG_EXPIRED}),this._m.setNotReadyReason(ha.KICKED_OUT_USERSIG_EXPIRED),this._m.reset())}},{key:"onRestApiKickedOut",value:function(e){(new Aa("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(E.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ve.w("".concat(this._n,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),0!==this.getModule(xn).getStatusInstanceID())&&(this.emitOuterEvent(k.KICKED_OUT,{type:E.KICKED_OUT_REST_API}),this._m.setNotReadyReason(ha.KICKED_OUT_REST_API),this._m.reset(),this.getModule(Jn).onRestApiKickedOut())}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}]),n}(uo);function er(){return null}var tr=function(){function e(t){o(this,e),this._m=t,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}return a(e,[{key:"_errorTolerantHandle",value:function(){ae||!it(window)&&this._canIUseCookies()||(this.getItem=er,this.setItem=er,this.removeItem=er,this.clear=er)}},{key:"onCheckTimer",value:function(e){if(e%20==0){if(0===this._storageQueue.size)return;this._doFlush()}}},{key:"_doFlush",value:function(){try{var e,t=D(this._storageQueue);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],s=n[1];this._setStorageSync(this._getKey(o),s)}}catch(a){t.e(a)}finally{t.f()}this._storageQueue.clear()}catch(i){Ve.w("".concat(this._n,"._doFlush error:"),i)}}},{key:"_getPrefix",value:function(){var e=this._m.getModule(xn);return"TIM_".concat(e.getSDKAppID(),"_").concat(e.getUserID(),"_")}},{key:"_getKey",value:function(e){return"".concat(this._getPrefix()).concat(e)}},{key:"getItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;return this.getStorageSync(n)}catch(o){return Ve.w("".concat(this._n,".getItem error:"),o),{}}}},{key:"setItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(n){var s=o?this._getKey(e):e;this._setStorageSync(s,t)}else this._storageQueue.set(e,t)}},{key:"clear",value:function(){try{ae?re.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){Ve.w("".concat(this._n,".clear error:"),e)}}},{key:"removeItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;this._removeStorageSync(n)}catch(o){Ve.w("".concat(this._n,".removeItem error:"),o)}}},{key:"getSize",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"b";try{var o={size:0,limitSize:5242880,unit:n};if(Object.defineProperty(o,"leftSize",{enumerable:!0,get:function(){return o.limitSize-o.size}}),ae&&(o.limitSize=1024*re.getStorageInfoSync().limitSize),e)o.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(ae){var s=re.getStorageInfoSync(),a=s.keys;a.forEach((function(e){o.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length}))}else if(this._canIUseCookies())for(var i in localStorage)localStorage.hasOwnProperty(i)&&(o.size+=localStorage.getItem(i).length+i.length);return this._convertUnit(o)}catch(r){Ve.w("".concat(this._n," error:"),r)}}},{key:"_convertUnit",value:function(e){var t={},n=e.unit;for(var o in t.unit=n,e)"number"==typeof e[o]&&("kb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024):"mb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024/1024):t[o]=e[o]);return t}},{key:"_setStorageSync",value:function(e,t){ae?te?my.setStorageSync({key:e,data:t}):re.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}},{key:"getStorageSync",value:function(e){return ae?te?my.getStorageSync({key:e}).data:re.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}},{key:"_removeStorageSync",value:function(e){ae?te?my.removeStorageSync({key:e}):re.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}},{key:"_canIUseCookies",value:function(){return navigator&&navigator.cookieEnabled&&localStorage}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._doFlush()}}]),e}(),nr=function(){function e(t){o(this,e),this._n="SSOLogBody",this._report=[]}return a(e,[{key:"pushIn",value:function(e){Ve.d("".concat(this._n,".pushIn"),this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;at(e)&&0!==e.length&&(Ve.d("".concat(this._n,".backfill"),this._report.length,e.length),(t=this._report).unshift.apply(t,m(e)))}},{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 e=this._report.slice();return this._reset(),e}}]),e}(),or=function(e){var t=e.getModule(xn);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:Pe()}},sr=function(e){r(s,e);var n=f(s);function s(e){var t;o(this,s),(t=n.call(this,e))._n="EventStatModule",t.TAG="im-ssolog-event",t._reportBody=new nr,t.MIN_THRESHOLD=20,t.MAX_THRESHOLD=100,t.WAITING_TIME=6e4,t.REPORT_LEVEL=[4,5,6],t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._lastReportTime=Date.now();var a=t.getInnerEmitterInstance();return a.on(ei,t._onLoginSuccess,h(t)),a.on(ti,t._onCloudConfigUpdated,h(t)),t}return a(s,[{key:"reportAtOnce",value:function(){Ve.d("".concat(this._n,".reportAtOnce")),this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,t=this.getModule(Vn),n=t.getItem(this.TAG,!1);!zt(n)&&ut(n.forEach)&&(Ve.l("".concat(this._n,"._onLoginSuccess get ssolog in storage, count:").concat(n.length)),n.forEach((function(t){e._reportBody.pushIn(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("evt_rpt_threshold"),t=this.getCloudConfig("evt_rpt_waiting"),n=this.getCloudConfig("evt_rpt_level"),o=this.getCloudConfig("evt_rpt_sdkappid_bl"),s=this.getCloudConfig("evt_rpt_tinyid_wl");it(e)||(this.MIN_THRESHOLD=Number(e)),it(t)||(this.WAITING_TIME=Number(t)),it(n)||(this.REPORT_LEVEL=n.split(",").map((function(e){return Number(e)}))),it(o)||(this.REPORT_SDKAPPID_BLACKLIST=o.split(",").map((function(e){return Number(e)}))),it(s)||(this.REPORT_TINYID_WHITELIST=s.split(","))}},{key:"pushIn",value:function(e){e instanceof Aa&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}},{key:"onCheckTimer",value:function(){Date.now()e.MAX_THRESHOLD&&e._flushAtOnce()}))}else this._lastReportTime=Date.now()}}},{key:"_flushAtOnce",value:function(){var e=this.getModule(Vn),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory(),o="".concat(this._n,"._flushAtOnce");if(zt(t))Ve.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var s=n.concat(t);s.length>this.MAX_THRESHOLD&&(s=s.slice(0,this.MAX_THRESHOLD)),Ve.l("".concat(o," count:").concat(s.length)),e.setItem(this.TAG,s,!0,!1)}}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),s}(uo),ar="none",ir="online",rr=[ha.OVER_FREQUENCY_LIMIT,ha.OPEN_SERVICE_OVERLOAD_ERROR],ur=function(){function e(t){o(this,e),this._m=t,this._networkType="",this._n="NetMonitorModule",this.MAX_WAIT_TIME=3e3,this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null}return a(e,[{key:"start",value:function(){var e=this;ae?(re.getNetworkType({success:function(t){e._networkType=t.networkType||t.subtype||"",t.networkType===ar?Ve.w("".concat(e._n,".start no network, please check!")):Ve.i("".concat(e._n,".start networkType:").concat(t.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),re.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=ir,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window&&(window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback)))}},{key:"_onWebOnline",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:ir})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:ar})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,n=e.networkType,o="".concat(this._n,"._onNetworkStatusChange"),s=!1;t?(Ve.i("".concat(o," previous:").concat(this._networkType," current:").concat(n)),this._networkType!==n&&(s=!0,this._m.getModule(Jn).reConnect(!0))):this._networkType!==n&&(s=!0,Ve.w("".concat(o," no network, please check!")),this._m.getModule(Jn).offline());s&&(new Aa("networkChange").setMessage("isConnected:".concat(t," previousNetworkType:").concat(this._networkType," networkType:").concat(n)).end(),this._networkType=n)}},{key:"probe",value:function(e){var t=this;if(!it(e)&&rr.includes(e.code))return Promise.resolve([!0,this._networkType]);var n="".concat(this._n,".probe");return new Promise((function(e,o){ae?re.getNetworkType({success:function(o){t._networkType=o.networkType,o.networkType===ar?(Ve.w("".concat(n," no network, please check!")),e([!1,o.networkType])):(Ve.i("".concat(n," networkType:").concat(o.networkType)),e([!0,o.networkType]))}}):t._networkType===ar?e([!1,ar]):e([!0,ir])}))}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),ae?null!==this._mpNetworkStatusCallback&&(re.offNetworkStatusChange&&(oe||$?re.offNetworkStatusChange(this._mpNetworkStatusCallback):re.offNetworkStatusChange()),this._mpNetworkStatusCallback=null):window&&(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null))}}]),e}();function cr(e,t){return e(t={exports:{}},t.exports),t.exports}var lr=cr((function(e){var t=Object.prototype.hasOwnProperty,n="~";function o(){}function s(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,o,a,i){if("function"!=typeof o)throw new TypeError("The listener must be a function");var r=new s(o,a||e,i),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],r]:e._events[u].push(r):(e._events[u]=r,e._eventsCount++),e}function i(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function r(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),r.prototype.eventNames=function(){var e,o,s=[];if(0===this._eventsCount)return s;for(o in e=this._events)t.call(e,o)&&s.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},r.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var s=0,a=o.length,i=new Array(a);s=this.cosOptions.expiredTime-120&&this._getAuthorizationKey())}},{key:"_getAuthorization",value:function(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}},{key:"upload",value:function(e){if(!0===e.getRelayFlag())return Promise.resolve();var t=this.getModule(eo);switch(e.type){case E.MSG_IMAGE:return t.addTotalCount(Ia),this._uploadImage(e);case E.MSG_FILE:return t.addTotalCount(Ia),this._uploadFile(e);case E.MSG_AUDIO:return t.addTotalCount(Ia),this._uploadAudio(e);case E.MSG_VIDEO:return t.addTotalCount(Ia),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var n=this,o=this.getModule(Nn),s=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadImage({file:a.payload.file,to:a.to,onProgress:function(e){if(s.updatePercent(e),ut(a.onProgress))try{a.onProgress(e)}catch(t){return Za({code:ha.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a,i,r=o.location,u=o.fileType,c=o.fileSize,l=o.width,d=o.height,p=o.smallImageUrl,g=o.smallImageWidth,h=o.smallImageHeight,_=o.largeImageUrl,f=o.largeImageWidth,v=o.largeImageHeight,m=n.isPrivateNetWork()?r:yt(r);return s.updateImageFormat(u),p&&_?(a={url:p,width:g,height:h},i={url:_,width:f,height:v}):(a=Ut({originUrl:m,originWidth:l,originHeight:d,min:198}),i=Ut({originUrl:m,originWidth:l,originHeight:d,min:720})),s.updateImageInfoArray([{size:c,url:m,width:l,height:d},t({},i),t({},a)]),e}))}},{key:"_uploadFile",value:function(e){var t=this,n=this.getModule(Nn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadFile({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),ut(s.onProgress))try{s.onProgress(e)}catch(t){return Za({code:ha.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,a=t.isPrivateNetWork()?s:yt(s);return o.updateFileUrl(a),e}))}},{key:"_uploadAudio",value:function(e){var t=this,n=this.getModule(Nn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadAudio({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),ut(s.onProgress))try{s.onProgress(e)}catch(t){return Za({code:ha.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,a=t.isPrivateNetWork()?s:yt(s);return o.updateAudioUrl(a),e}))}},{key:"_uploadVideo",value:function(e){var t=this,n=this.getModule(Nn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadVideo({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),ut(s.onProgress))try{s.onProgress(e)}catch(t){return Za({code:ha.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,a=n.snapshotInfo,i=t.isPrivateNetWork()?s:yt(s);return o.updateVideoUrl(i),zt(a)||o.updateSnapshotInfo(a),e}))}},{key:"_checkSizeError",value:function(e){return Za({code:ha["MESSAGE_".concat(e,"_SIZE_LIMIT")],message:this.getErrorMessage("UploadSizeLimit",e.toLowerCase(),"".concat(this.UPLOAD_SIZE_LIMIT[e]/1048576," MB"))})}},{key:"doUploadImage",value:function(e){var t=this;if(!e.file)return Za({code:ha.MESSAGE_IMAGE_SELECT_FILE_FIRST});var n=this._checkImageType(e.file);if(!0!==n)return n;var o=this._checkImageSize(e.file);if(!0!==o)return o;var s=null;return this._setUploadFileType(ii),this.uploadByCOS(e).then((function(e){return s=e,t.isPrivateNetWork()?Rt(e.location):Rt("https://".concat(e.location))})).then((function(e){return s.width=e.width,s.height=e.height,Promise.resolve(s)}))}},{key:"_checkImageType",value:function(e){var t="";return t=ae?e.url.slice(e.url.lastIndexOf(".")+1):e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1),si.indexOf(t.toLowerCase())>=0||Za({code:ha.MESSAGE_IMAGE_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){var t=0;return 0===(t=ae?e.size:e.files[0].size)?Za({code:ha.MESSAGE_FILE_IS_EMPTY}):tthis.UPLOAD_SIZE_LIMIT.FILE?this._checkSizeError("FILE"):0===e.file.files[0].size?Za({code:ha.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(ci),this.uploadByCOS(e)):Za({code:ha.MESSAGE_FILE_SELECT_FILE_FIRST})}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.VIDEO?this._checkSizeError("VIDEO"):0===e.file.videoFile.size?Za({code:ha.MESSAGE_FILE_IS_EMPTY}):-1===ai.indexOf(e.file.videoFile.type)?Za({code:ha.MESSAGE_VIDEO_TYPES_LIMIT}):(this._setUploadFileType(ri),ae?this.handleVideoUpload({file:e.file.videoFile,onProgress:e.onProgress}):ie?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var t=this;return new Promise((function(n,o){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){o(new ja({code:ha.MESSAGE_VIDEO_UPLOAD_FAIL}))}))}))}))}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.AUDIO?this._checkSizeError("AUDIO"):0===e.file.size?Za({code:ha.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(ui),this.uploadByCOS(e)):Za({code:ha.MESSAGE_AUDIO_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(e){var t=this;if(!ut(this._cosUploadMethod))return this.outputWarning("PluginUndetected"),Za({code:ha.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var n=new Aa("upload"),o="".concat(this._n,".uploadByCOS"),s=Date.now(),a=this._getFile(e);return new Promise((function(i,r){var u=ae?t._createCosOptionsWXMiniApp(e):t._createCosOptionsWeb(e),c=t;t._cosUploadMethod(u,(function(e,u){var l=Object.create(null);if(u){if(e||at(u.files)&&u.files[0].error){var d=new ja({code:ha.MESSAGE_FILE_UPLOAD_FAIL});return n.setError(d,!0,t.getNetworkType()).end(),Ve.l("".concat(o," failed. error:"),u.files[0].error),403===u.files[0].error.statusCode&&(Ve.w("".concat(o," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),void r(d)}l.fileName=a.name,l.fileSize=a.size,l.fileType=a.type.slice(a.type.indexOf("/")+1).toLowerCase(),l.location=ae?u.Location:u.files[0].data.Location;var p=Date.now()-s,g=c._formatFileSize(a.size),h=c._formatSpeed(1e3*a.size/p),_="size:".concat(g," time:").concat(p,"ms speed:").concat(h);Ve.l("".concat(o," success. name:").concat(a.name," ").concat(_)),i(l);var f=t.getModule(eo);return f.addCost(Ia,p),f.addFileSize(Ia,a.size),void n.setNetworkType(t.getNetworkType()).setMessage(_).end()}var v=new ja({code:ha.MESSAGE_FILE_UPLOAD_FAIL});n.setError(v,!0,c.getNetworkType()).end(),Ve.w("".concat(o," failed. error:"),e),403===e.statusCode&&(Ve.w("".concat(o," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),r(v)}))}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,n="".concat(this._n,"._uploadWithPreSigUrl"),o=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(s,a){var i=new Aa("upload"),r=e.requestSnapshotUrl,u=void 0===r?void 0:r,c=g(e,pr),l=Date.now();t._cosUploadMethod(c,(function(e,r){if(e||403===r.statusCode)return i.setError(new ja(e),!0,t.getNetworkType()).end(),Ve.l("".concat(n," failed, error:"),e),void a(new ja({code:ha.MESSAGE_FILE_UPLOAD_FAIL}));var d=Object.create(null),p=r.data.location||"";t.isPrivateNetWork()||0!==p.indexOf("https://")&&0!==p.indexOf("http://")||(p=p.split("//")[1]),d.fileName=o.name,d.fileSize=o.size,d.fileType=o.type.slice(o.type.indexOf("/")+1).toLowerCase(),d.location=p;var g=Date.now()-l,h=t._formatFileSize(o.size),_=t._formatSpeed(1e3*o.size/g),f="size:".concat(h,",time:").concat(g,"ms,speed:").concat(_," res:").concat(JSON.stringify(r.data));Ve.l("".concat(n," success name:").concat(o.name,",").concat(f)),i.setNetworkType(t.getNetworkType()).setMessage(f).end();var v=t.getModule(eo);v.addCost(Ia,g),v.addFileSize(Ia,o.size);var m=[];if(c.thumbUrl&&c.largeUrl&&(m=[t._getSmallImageInfoByUrl(c.thumbUrl,d),t._getLargeImageInfoByUrl(c.largeUrl,d)]),u&&m.push(t._getSnapshotInfoByUrl(u,d)),m.length>0)return Promise.all(m).then((function(){s(d)}));s(d)}))}))}))}},{key:"_getRawOrUploadProxyUrl",value:function(e){var t=this.getModule(xn).getFileUploadProxy(),n=e;return t&&(n=e.replace(/^https:\/\/[^/]+/,t)),n}},{key:"_getFile",value:function(e){var t;return at(e.file.files)||(t=e.file.files,"filelist"===lt(t))?e.file.files[0]:e.file}},{key:"_formatFileSize",value:function(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}},{key:"_formatSpeed",value:function(e){return e<=1048576?wt(e/1024,1)+"KB/s":wt(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var t=this._getFile(e),n=t.name,o=n.slice(n.lastIndexOf(".")),s=this._genFileName("".concat(_t(999999)).concat(o));return{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(s),Body:t}],SliceSize:1048576,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Ve.w("onProgress callback error:",n)}},onFileFinish:function(e,t,n){}}}},{key:"_createCosOptionsWXMiniApp",value:function(e){var t=this._getFile(e),n=this._genFileName(t.name),o=t.url;return{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(n),FilePath:o,onProgress:function(t){if(Ve.l(JSON.stringify(t)),"function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Ve.w("onProgress callback error:",n)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var t=this,n="",o="",s=0,a=this._getFile(e);if(ae)n=this._genFileName(a.name),o=a.url,s=1;else{var i=a.name,r=i.slice(i.lastIndexOf("."));n=this._genFileName("".concat(_t(999999)).concat(r)),o=a,s=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:n,uploadMethod:s,duration:this.duration}).then((function(s){var a=s.uploadUrl,i=s.downloadUrl,r=s.requestSnapshotUrl,u=void 0===r?void 0:r,c=s.thumbUrl,l=s.largeUrl;return{url:t._getRawOrUploadProxyUrl(a),fileType:t.uploadFileType,fileName:n,resources:o,downloadUrl:i,requestSnapshotUrl:u,thumbUrl:c,largeUrl:l,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Ve.w("onProgress callback error:",n),Ve.e(n)}}}}))}},{key:"_genFileName",value:function(e){return"".concat(Nt(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e,t){var n=this,o=new Aa("getSnapshotInfo");return this.request({protocolName:Vs,requestData:{platform:this.getPlatform(),coverName:this._genFileName(_t(99999)),requestSnapshotUrl:e}}).then((function(e){var n=(e.data||{}).snapshotUrl;return o.setMessage("snapshotUrl:".concat(n)).end(),zt(n)?{}:Rt(n).then((function(e){t.snapshotInfo={snapshotUrl:n,snapshotWidth:e.width,snapshotHeight:e.height}}))})).catch((function(e){return Ve.w("".concat(n._n,"._getSnapshotInfoByUrl failed. error:"),e),o.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}}))}},{key:"_getSmallImageInfoByUrl",value:function(e,t){return Rt(e).then((function(n){t.smallImageUrl=e,t.smallImageWidth=n.width,t.smallImageHeight=n.height}))}},{key:"_getLargeImageInfoByUrl",value:function(e,t){return Rt(e).then((function(n){t.largeImageUrl=e,t.largeImageWidth=n.width,t.largeImageHeight=n.height}))}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset"))}}]),s}(uo),hr=["downloadKey","pbDownloadKey","messageList"],_r=function(){function e(t){o(this,e),this._n="MergerMessageHandler",this._messageModule=t}return a(e,[{key:"uploadMergerMessage",value:function(e,t){var n=this,o="".concat(this._n,".").concat("uploadMergerMessage");Ve.d("".concat(o," message:"),e,"messageBytes:".concat(t));var s=e.payload.messageList,a=s.length,i=new Aa("uploadMergerMessage");return this._messageModule.request({protocolName:zs,requestData:{messageList:s}}).then((function(e){Ve.d("".concat(o," ok. response:"),e.data);var s=e.data,r=s.pbDownloadKey,u=s.downloadKey,c={pbDownloadKey:r,downloadKey:u,messageNumber:a};return i.setNetworkType(n._messageModule.getNetworkType()).setMessage("".concat(a,"-").concat(t,"-").concat(u)).end(),c})).catch((function(e){throw Ve.w("".concat(o," failed. error:"),e),n._messageModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),e}))}},{key:"downloadMergerMessage",value:function(e){var n=this,o="".concat(this._n,".").concat("downloadMergerMessage");Ve.d("".concat(o," message:"),e);var s=e.payload.downloadKey,a=this._messageModule.getFileDownloadProxy(),i=new Aa("downloadMergerMessage");return i.setMessage("downloadKey:".concat(s)),this._messageModule.request({protocolName:Js,requestData:{downloadKey:s}}).then((function(s){if(Ve.d("".concat(o," ok. response:"),s.data),ut(e.clearElement)){var r=e.payload;r.downloadKey,r.pbDownloadKey,r.messageList;var u=g(r,hr);e.clearElement(),e.setElement({type:e.type,content:t({messageList:s.data.messageList},u)},a)}else{var c=[];s.data.messageList.forEach((function(e){if(!zt(e)){var t=new Ba(e,a);c.push(t)}})),e.payload.messageList=c,e.payload.downloadKey="",e.payload.pbDownloadKey=""}return i.setNetworkType(n._messageModule.getNetworkType()).end(),e})).catch((function(e){throw Ve.w("".concat(o," failed. key:").concat(s," error:"),e),n._messageModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),e}))}},{key:"createMergerMessagePack",value:function(e,t,n){return e.conversationType===E.CONV_C2C?this._createC2CMergerMessagePack(e,t,n):this._createGroupMergerMessagePack(e,t,n)}},{key:"_createC2CMergerMessagePack",value:function(e,t,n){var o=null;t&&(t.offlinePushInfo&&(o=t.offlinePushInfo),!0===t.onlineUserOnly&&(o?o.disablePush=!0:o={disablePush:!0}));var s=[];if(st(t)&&st(t.messageControlInfo)){var a=t.messageControlInfo,i=a.excludedFromUnreadCount,r=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===i&&s.push("NoUnread"),!0===r&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c="";nt(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var l=n.pbDownloadKey,d=n.downloadKey,p=n.messageNumber,g=e.payload,h=g.title,_=g.abstractList,f=g.compatibleText,v=this._messageModule.getModule(Un),m=v&&v.isOnlineMessage(e,t)?0:void 0;return{protocolName:fo,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:l,downloadKey:d,title:h,abstractList:_,compatibleText:f,messageNumber:p}}],cloudCustomData:c,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:m,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,messageControlInfo:0!==m?s:void 0,isSupportExtension:!0===e.isSupportExtension?1:0}}}},{key:"_createGroupMergerMessagePack",value:function(e,t,n){var o=null;t&&t.offlinePushInfo&&(o=t.offlinePushInfo);var s=[];if(st(t)&&st(t.messageControlInfo)){var a=t.messageControlInfo,i=a.excludedFromUnreadCount,r=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===i&&s.push("NoUnread"),!0===r&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c="";nt(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var l=n.pbDownloadKey,d=n.downloadKey,p=n.messageNumber,g=e.payload,h=g.title,_=g.abstractList,f=g.compatibleText,v=this._messageModule.getModule(Pn),m=v&&v.isOnlineMessage(e,t)?1:0;return{protocolName:vo,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:l,downloadKey:d,title:h,abstractList:_,compatibleText:f,messageNumber:p}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:c,onlineOnlyFlag:m,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||v.isMessageFromOrToAVChatroom(e.to)?0:1,messageControlInfo:0===m?s:void 0,isSupportExtension:!0===e.isSupportExtension?1:0}}}}]),e}(),fr={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MESSAGE_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},vr=[ha.MESSAGE_ONPROGRESS_FUNCTION_ERROR,ha.MESSAGE_IMAGE_SELECT_FILE_FIRST,ha.MESSAGE_IMAGE_TYPES_LIMIT,ha.MESSAGE_FILE_IS_EMPTY,ha.MESSAGE_IMAGE_SIZE_LIMIT,ha.MESSAGE_FILE_SELECT_FILE_FIRST,ha.MESSAGE_FILE_SIZE_LIMIT,ha.MESSAGE_VIDEO_SIZE_LIMIT,ha.MESSAGE_VIDEO_TYPES_LIMIT,ha.MESSAGE_AUDIO_UPLOAD_FAIL,ha.MESSAGE_AUDIO_SIZE_LIMIT,ha.COS_UNDETECTED];function mr(e){var t=!1;return Object.values(fr).includes(e)&&(t=!0),(e>=120001&&e<=13e4||e>=10100&&e<=10200)&&(t=!0),t}var Mr=function(e){r(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="MessageModule",t._messageOptionsMap=new Map,t._mergerMessageHandler=new _r(h(t)),t}return a(s,[{key:"createTextMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Wa(e),o="string"==typeof e.payload?e.payload:e.payload.text,s=new Ra({text:o}),a=this._getNickAndAvatarByUserID(t);return n.setElement(s),n.setNickAndAvatar(a),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createImageMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Wa(e);if(ae){var o=e.payload.file;if($e(o))return void this.outputWarning("FileUnsupportedInMP","createImageMessage");var s=o.tempFiles[0].path||o.tempFiles[0].tempFilePath,a={url:s,name:s.slice(s.lastIndexOf("/")+1),size:o.tempFiles&&o.tempFiles[0].size||1,type:s.slice(s.lastIndexOf(".")+1).toLowerCase()};e.payload.file=a}else if(ie)if($e(e.payload.file)){var i=e.payload.file;e.payload.file={files:[i]}}else if(st(e.payload.file)&&"undefined"!=typeof uni){var r=e.payload.file.tempFiles[0];e.payload.file={files:[r]}}var u=new Na({imageFormat:Be.UNKNOWN,uuid:this._generateUUID(e.payload.file),file:e.payload.file}),c=this._getNickAndAvatarByUserID(t);return n.setElement(u),n.setNickAndAvatar(c),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createAudioMessage",value:function(e){var t=e.payload.file;if(ae){var n={url:t.tempFilePath,name:t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/")+1),size:t.fileSize,second:parseInt(t.duration)/1e3,type:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".")+1).toLowerCase()};e.payload.file=n}var o=this.getMyUserID();e.currentUser=o,e.senderTinyID=this.getMyTinyID();var s=new Wa(e),a=new Ga({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size,url:t.tempFilePath,uuid:this._generateUUID(e.payload.file)}),i=this._getNickAndAvatarByUserID(o);return s.setElement(a),s.setNickAndAvatar(i),s.setNameCard(this._getNameCardByGroupID(s)),this._messageOptionsMap.set(s.clientSequence,e),s}},{key:"createVideoMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl="",e.payload.file.thumbSize=0;var n={};if(ae){if(te)return void this.outputWarning("VideoUnsupportedInAlipay");if($e(e.payload.file))return void this.outputWarning("FileUnsupportedInMP","createVideoMessage");var o=e.payload.file;at(o.tempFiles)&&(o=o.tempFiles[0]),n.url=o.tempFilePath,n.name=o.tempFilePath.slice(o.tempFilePath.lastIndexOf("/")+1),n.size=o.size||1,n.second=o.duration||0,n.type=o.tempFilePath.slice(o.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else if(ie){if($e(e.payload.file)){var s=e.payload.file;e.payload.file.files=[s]}else if(st(e.payload.file)&&"undefined"!=typeof uni){var a=e.payload.file.tempFile;e.payload.file.files=[a]}var i=e.payload.file;n.url=window.URL.createObjectURL(i.files[0]),n.name=i.files[0].name,n.size=i.files[0].size||1,n.second=i.files[0].duration||0,n.type=i.files[0].type.split("/")[1]}e.payload.file.videoFile=n;var r=new Wa(e),u=new xa({videoFormat:n.type,videoSecond:wt(n.second,0),videoSize:n.size,remoteVideoUrl:"",videoUrl:n.url,videoUUID:this._generateUUID(e.payload.file.videoFile),thumbUUID:this._generateUUID(e.payload.file.videoFile),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:e.payload.file.thumbUrl.slice(e.payload.file.thumbUrl.lastIndexOf(".")+1).toLowerCase()}),c=this._getNickAndAvatarByUserID(t);return r.setElement(u),r.setNickAndAvatar(c),r.setNameCard(this._getNameCardByGroupID(r)),this._messageOptionsMap.set(r.clientSequence,e),r}},{key:"createCustomMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Wa(e),o=new qa({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createFaceMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Wa(e),o=new Oa(e.payload),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createMergerMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=this._getNickAndAvatarByUserID(t),o=new Wa(e),s=new Ha(e.payload);return o.setElement(s),o.setNickAndAvatar(n),o.setNameCard(this._getNameCardByGroupID(o)),o.setRelayFlag(!0),o}},{key:"createForwardMessage",value:function(e){var t=e.to,n=e.conversationType,o=e.priority,s=e.payload,a=e.needReadReceipt,i=e.receiverList,r=this.getMyUserID(),u=this._getNickAndAvatarByUserID(r);if(s.type===E.MSG_GRP_TIP)return Za({code:ha.MESSAGE_FORWARD_TYPE_INVALID});var c={to:t,conversationType:n,conversationID:"".concat(n).concat(t),priority:o,isPlaceMessage:0,status:Qt.UNSEND,currentUser:r,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||s.cloudCustomData||"",needReadReceipt:a,receiverList:i,isSupportExtension:e.isSupportExtension||!1},l=new Wa(c);return l.setElement(s.getElements()[0]),l.setNickAndAvatar(u),l.setNameCard(this._getNameCardByGroupID(s)),l.setRelayFlag(!0),l}},{key:"downloadMergerMessage",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:"createFileMessage",value:function(e){if(ae){if(!X&&!Q&&!oe)return;var n=re.getSystemInfoSync().SDKVersion;if(X&&Gt(n,"2.5.0")<0)return void this.outputWarning("WXChooseMessageFile");if(Q&&Gt(n,"1.18.0")<0)return void this.outputWarning("QQChooseMessageFile")}if(ie||oe){if($e(e.payload.file)){var o=e.payload.file;e.payload.file={files:[o]}}else if(st(e.payload.file)&&"undefined"!=typeof uni){var s=e.payload.file,a=s.tempFiles,i=s.files,r=null;at(a)?r=a[0]:at(i)&&(r=i[0]),e.payload.file={files:[r]}}}else if(X||Q){var u=e.payload.file.tempFiles,c=t(t({},u[0]),{},{url:u[0].path});e.payload.file={files:[c]}}var l=this.getMyUserID();e.currentUser=l,e.senderTinyID=this.getMyTinyID();var d=new Wa(e),p=new Fa({uuid:this._generateUUID(e.payload.file),file:e.payload.file}),g=this._getNickAndAvatarByUserID(l);return d.setElement(p),d.setNickAndAvatar(g),d.setNameCard(this._getNameCardByGroupID(d)),this._messageOptionsMap.set(d.clientSequence,e),d}},{key:"createLocationMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Wa(e),o=new Va(e.payload),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"_onCannotFindModule",value:function(){return Za({code:ha.CANNOT_FIND_MODULE})}},{key:"sendMessageInstance",value:function(e,t){var n=this;if(!1===this.getModule(oo).filterMessage(e,t))return this._onSendMessageFailed(e,new ja({code:ha.PROFANITY_FOUND}));var o,s=null;switch(e.conversationType){case E.CONV_C2C:if(!(s=this.getModule(Un)))return this._onCannotFindModule();break;case E.CONV_GROUP:if(!(s=this.getModule(Pn)))return this._onCannotFindModule();if(Dt({groupID:e.to})){var a=s.getLocalGroupProfile(e.to);if(a&&a.isSupportTopic)return Za({code:ha.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL})}break;default:return Za({code:ha.MESSAGE_SEND_INVALID_CONVERSATION_TYPE})}var i=this.getModule(Wn),r=this.getModule(Pn);return i.upload(e).then((function(){n._getSendMessageSpecifiedKey(e)===ya&&n.getModule(eo).addSuccessCount(Ia);return r.guardForAVChatRoom(e).then((function(){if(!e.isSendable())return Za({code:ha.MESSAGE_FILE_URL_IS_EMPTY});n._addSendMessageTotalCount(e),o=Date.now();var a=function(e){var t="utf-8";ie&&document&&(t=document.charset.toLowerCase());var n,o,s=0;if(o=e.length,"utf-8"===t||"utf8"===t)for(var a=0;a11264?n._mergerMessageHandler.uploadMergerMessage(e,a).then((function(o){var s=n._mergerMessageHandler.createMergerMessagePack(e,t,o);return n.request(s)})):(n.getModule(qn).setMessageRandom(e),e.conversationType===E.CONV_C2C||e.conversationType===E.CONV_GROUP?s.sendMessage(e,t):void 0)})).then((function(a){var i=a.data,r=i.time,u=i.sequence,c=i.readReceiptCode;et(c)&&0!==c&&(new Aa("sendMessageWithReceipt").setMessage("from:".concat(e.from," to:").concat(e.to," sequence:").concat(u," readReceiptCode:").concat(c)).end(),Ve.w("".concat(n._n,".sendMessageInstance readReceiptCode:").concat(c," message:").concat(n.getErrorMessage(c))));n._addSendMessageSuccessCount(e,o),n._messageOptionsMap.delete(e.clientSequence);var l=n.getModule(qn);e.status=Qt.SUCCESS,e.time=r;var d=!1;if(e.conversationType===E.CONV_GROUP)e.sequence=u;else if(e.conversationType===E.CONV_C2C){var p=l.getLatestMessageSentByMe(e.conversationID);if(p){var g=p.nick,h=p.avatar;g===e.nick&&h===e.avatar||(d=!0)}}if(d&&l.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),s.isOnlineMessage(e,t))e._onlineOnlyFlag=!0;else{l.appendToMessageList(e);var _=e;st(t)&&st(t.messageControlInfo)&&(!0===t.messageControlInfo.excludedFromLastMessage&&(e._isExcludedFromLastMessage=!0,_=""),!0===t.messageControlInfo.excludedFromUnreadCount&&(e._isExcludedFromUnreadCount=!0));var f=e.conversationType;if(kt(e.to))f=E.CONV_TOPIC,n.getModule(Fn).onMessageSent({groupID:xt(e.to),topicID:e.to,lastMessage:_});l.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:f,subType:e.conversationSubType,lastMessage:_}]})}return e.getRelayFlag()||"TIMImageElem"!==e.type||Pt(e.payload.imageInfoArray),Ya({message:e})}))})).catch((function(t){return n._onSendMessageFailed(e,t)}))}},{key:"_onSendMessageFailed",value:function(e,t){e.status=Qt.FAIL,this.getModule(qn).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var n=new Aa("sendMessage");return n.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),this.probeNetwork().then((function(e){var o=v(e,2),s=o[0],a=o[1];n.setError(t,s,a).end()})),Ve.e("".concat(this._n,"._onSendMessageFailed error:"),t),Za(new ja({code:t&&t.code?t.code:ha.MESSAGE_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([E.MSG_IMAGE,E.MSG_AUDIO,E.MSG_VIDEO,E.MSG_FILE].includes(e.type))return ya;if(e.conversationType===E.CONV_C2C)return va;if(e.conversationType===E.CONV_GROUP){var t=this.getModule(Pn).getLocalGroupProfile(e.to);if(!t)return;var n=t.type;return Tt(n)?Ma:ma}}},{key:"_addSendMessageTotalCount",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule(eo).addTotalCount(t)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n=Math.abs(Date.now()-t),o=this._getSendMessageSpecifiedKey(e);if(o){var s=this.getModule(eo);s.addSuccessCount(o),s.addCost(o,n)}}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var n,o,s=t.code,a=void 0===s?-1:s,i=this.getModule(eo),r=this._getSendMessageSpecifiedKey(e);r===ya&&(n=a,o=!1,vr.includes(n)&&(o=!0),o)?i.addFailedCountOfUserSide(Ia):mr(a)&&r&&i.addFailedCountOfUserSide(r)}},{key:"resendMessage",value:function(e){return e.isResend=!0,e.status=Qt.UNSEND,this.sendMessageInstance(e)}},{key:"revokeMessage",value:function(e){var t=this,n=null;if(e.conversationType===E.CONV_C2C?n=this.getModule(Un):e.conversationType===E.CONV_GROUP&&(n=this.getModule(Pn)),!n)return this._onCannotFindModule();var o=new Aa("revokeMessage");o.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to));var s="".concat(this._n,".").concat("revokeMessage");return n.revokeMessage(e).then((function(n){var a=n.data.recallRetList;if(!zt(a)&&0!==a[0].retCode){var i=new ja({code:a[0].retCode,data:{message:e}});return o.setCode(i.code).setMoreMessage(i.message).end(),Za(i)}return Ve.i("".concat(s," ok. ID:").concat(e.ID)),e.isRevoked=!0,o.end(),t.getModule(qn).onMessageRevoked([e]),Ya({message:e})})).catch((function(n){t.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];o.setError(n,s,a).end()}));var a=new ja({code:n&&n.code?n.code:ha.MESSAGE_REVOKE_FAIL,message:n&&n.message?n.message:void 0,data:{message:e}});return Ve.w("".concat(s," failed. error:"),n),Za(a)}))}},{key:"deleteMessage",value:function(e){var t=this,n=null,o=e[0],s=o.conversationID,a="",i=[],r=[];if(o.conversationType===E.CONV_C2C)n=this.getModule(Un),a=s.replace(E.CONV_C2C,""),e.forEach((function(e){e&&e.status===Qt.SUCCESS&&e.conversationID===s&&(e._onlineOnlyFlag||i.push("".concat(e.sequence,"_").concat(e.random,"_").concat(e.time)),r.push(e))}));else if(o.conversationType===E.CONV_GROUP)n=this.getModule(Pn),a=s.replace(E.CONV_GROUP,""),e.forEach((function(e){e&&e.status===Qt.SUCCESS&&e.conversationID===s&&(e._onlineOnlyFlag||i.push("".concat(e.sequence)),r.push(e))}));else if(o.conversationType===E.CONV_SYSTEM)return Za({code:ha.CANNOT_DELETE_GROUP_SYSTEM_NOTICE});if(!n)return this._onCannotFindModule();if(0===i.length)return this._onMessageDeleted(r);i.length>30&&(i=i.slice(0,30),r=r.slice(0,30));var u=new Aa("deleteMessage");u.setMessage("to:".concat(a," count:").concat(i.length));var c="".concat(this._n,".").concat("deleteMessage");return n.deleteMessage({to:a,keyList:i}).then((function(e){return u.end(),Ve.i("".concat(c," ok")),t._onMessageDeleted(r)})).catch((function(e){t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.w("".concat(c," failed. error:"),e);var n=new ja({code:e&&e.code?e.code:ha.MESSAGE_DELETE_FAIL,message:e&&e.message?e.message:void 0});return Za(n)}))}},{key:"_onMessageDeleted",value:function(e){return this.getModule(qn).onMessageDeleted(e),Xa({messageList:e})}},{key:"translateText",value:function(e){var n="".concat(this._n,".").concat("translateText"),o=e.sourceTextList,s=e.sourceLanguage,a=e.targetLanguage,i=new Aa("translateText");return i.setMessage("sourceLanguage:".concat(s," targetLanguage:").concat(a)),this.request({protocolName:ga,requestData:{sourceTextList:o,source:s||"auto",target:a,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then((function(e){var o=e.data,s=o.error,a=o.requestID,r=o.translatedTextList;if(0===s.code)return i.end(),Ve.i("".concat(n," ok. requestID:").concat(a)),Ya({translatedTextList:r});throw t(t({},s),{},{requestID:a})})).catch((function(e){return i.setCode(e.code).setMoreMessage(e.requestID).end(),Ve.w("".concat(n," failed. error:"),e),Za({code:ha.TRANSLATE_TEXT_FAIL})}))}},{key:"modifyRemoteMessage",value:function(e){var t=this,n=null,o=e.conversationType,s=e.to;if(this.getModule(Pn).isMessageFromOrToAVChatroom(s))return Za({code:ha.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,data:{message:e}});if(!1===this.getModule(oo).filterMessage(e))return Za({code:ha.PROFANITY_FOUND,data:{message:e}});o===E.CONV_C2C?n=this.getModule(Un):o===E.CONV_GROUP&&(n=this.getModule(Pn));var a=new Aa("modifyMessage");a.setMessage("to:".concat(s));var i="".concat(this._n,".modifyRemoteMessage");return n.modifyRemoteMessage(e).then((function(n){a.end(),Ve.i("".concat(i," ok"));var o=t._onModifyRemoteMessageResp(e,n.data);return Ya({message:o})})).catch((function(n){if(a.setCode(n.code).setMoreMessage(n.message).end(),Ve.w("".concat(i," failed. error:"),n),20027===n.code){var o=t._onModifyRemoteMessageResp(e,n.data);return Za({code:ha.MESSAGE_MODIFY_CONFLICT,data:{message:o}})}return Za({code:n.code,message:n.message,data:{message:e}})}))}},{key:"_onModifyRemoteMessageResp",value:function(e,t){Ve.d("".concat(this._n,"._onModifyRemoteMessageResp options:"),t);var n=e.conversationType,o=e.from,s=e.to,a=e.random,i=e.sequence,r=e.time,u=t.elements,c=t.messageVersion,l=t.cloudCustomData,d=void 0===l?"":l;return this.getModule(qn).onMessageModified({conversationType:n,from:o,to:s,time:r,random:a,sequence:i,elements:u,cloudCustomData:d,messageVersion:c})}},{key:"_generateUUID",value:function(e){var t=this.getModule(xn),n="".concat(t.getSDKAppID(),"-").concat(t.getUserID(),"-").concat(function(){for(var e="",t=32;t>0;--t)e+=ft[Math.floor(Math.random()*vt)];return e}()),o=e.name||e.value||e.url||e.tempFilePath,s=o&&o.slice(o.lastIndexOf(".")+1);return s&&(n="".concat(n,".").concat(s)),n}},{key:"getMessageOption",value:function(e){return this._messageOptionsMap.get(e)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.getModule(Gn).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===E.CONV_GROUP){var t=this.getModule(Pn);if(t)return t.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._messageOptionsMap.clear()}}]),s}(uo),yr=function(e){r(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="MessageExtensionModule",s.messageExtensionMap=new Map,s.globalSeqMap=new Map,s.getMessageExtensionsMap=new Map,s}return a(n,[{key:"onMessageExtensionNotify",value:function(e){var t=this,n=e.dataList,o=n.messageInfo,s=n.operateType,a=n.operateResultList,i=n.tinyID,r=n.globalSequence,u=o.clientTime,c=o.random,l="".concat(i,"-").concat(u,"-").concat(c),d=[],p=[];Ve.l("".concat(this._n,".onMessageExtensionNotify messageID:").concat(l," operateType:").concat(s," globalSequence:").concat(r)),this._updateGlobalSequence(l,r);var g=!1,h=!1;a.forEach((function(e){var n=e.extensions,o=void 0===n?[]:n,a=e.clearSequence;if(1===s)g=!0,o.forEach((function(e){d.push({key:e.key,value:e.value})})),t._updateLocalExtension(l,o);else if(2===s)h=!0,o.forEach((function(e){p.push(e.key)})),t._updateLocalExtension(l,o);else if(3===s){if(h=!0,t._hasLocalExtension(l))t._getLocalExtension(l).forEach((function(e,t){e.seq<=a&&!zt(e.value)&&p.push(t)}));t._clearLocalExtension(l,a)}})),g&&this.emitOuterEvent(k.MESSAGE_EXTENSIONS_UPDATED,{messageID:l,extensions:d}),h&&this.emitOuterEvent(k.MESSAGE_EXTENSIONS_DELETED,{messageID:l,keyList:p})}},{key:"setMessageExtensions",value:function(e,t){var n=this;if(!this.canIUse(B.MSG_EXT))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._n,".").concat("setMessageExtensions"),s=e.ID,a=e.conversationID,i=e.sequence,r=e.time,u=m(t);t.length>20&&(u=t.slice(0,20),Ve.w("".concat(o,". the length of extensions cannot exceed 20.")));var c="conversationID:".concat(a," messageID:").concat(s," sequence:").concat(i," time:").concat(r," count:").concat(u.length),l=new Aa("setMessageExtensions");return l.setMessage(c),Ve.l("".concat(o," ").concat(c)),this._modifyMessageExtensions(e,u).then((function(e){var t=e.resultList,n=e.successCount,s=e.failureCount,a="success count:".concat(n," fail count:").concat(s);return l.setMoreMessage(a).end(),Ve.l("".concat(o," ok. ").concat(a)),Ya({extensions:t})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),Za(e)}))}},{key:"getMessageExtensions",value:function(e){var t=this;if(!this.canIUse(B.MSG_EXT))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("getMessageExtensions"),o=e.ID,s=e.conversationID,a=e.sequence,i=e.time,r="conversationID:".concat(s," messageID:").concat(o," sequence:").concat(a," time:").concat(i),u=new Aa("getMessageExtensions");u.setMessage(r),Ve.l("".concat(n," ").concat(r));var c=void 0;return this.getMessageExtensionsMap.has(o)&&(c=this._getGlobalSequence(o)),this._getMessageExtensions(e,c).then((function(e){return u.end(),Ve.l("".concat(n," ok. total count:").concat(e.length)),it(c)&&e.length>0&&t.getMessageExtensionsMap.set(o,1),Ya({extensions:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"deleteMessageExtensions",value:function(e,t){var n=this;if(!this.canIUse(B.MSG_EXT))return Za({code:ha.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._n,".").concat("deleteMessageExtensions"),s=[],a=3;zt(t)||(a=2,t.forEach((function(e){s.push({key:e,value:"",seq:0})})));var i=e.ID,r=e.conversationID,u=e.sequence,c=e.time,l="conversationID:".concat(r," messageID:").concat(i," sequence:").concat(u," time:").concat(c," operateType:").concat(a),d=new Aa("deleteMessageExtensions");return d.setMessage(l),Ve.l("".concat(o," ").concat(l)),this._modifyMessageExtensions(e,s,a).then((function(e){var t=e.resultList,n=e.successCount,s=e.failureCount,i="";return 2===a&&(i="success count:".concat(n," fail count:").concat(s)),d.setMoreMessage("".concat(i)).end(),Ve.l("".concat(o," ok. ").concat(i)),Ya({extensions:t})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];d.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),Za(e)}))}},{key:"_modifyMessageExtensions",value:function(e,t){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=kt(e.to)?E.CONV_TOPIC:e.conversationType,a=void 0;3!==o&&(a=this._getRequestExtensions(e,t));var i=null;switch(s){case E.CONV_C2C:i=this.getModule(Un);break;case E.CONV_GROUP:i=this.getModule(Pn);break;case E.CONV_TOPIC:i=this.getModule(Fn);break;default:return Za({code:ha.CANNOT_FIND_MODULE})}return i.modifyMessageExtensions(e,a,o).then((function(t){var o=t.data,s=o.extensions,a=o.seq,i=[],r=0,u=0,c=[];return(s=zt(s)?[]:s).forEach((function(e){var t=e.errorCode,n=e.extension,o=n.key,s=n.value,a=n.seq;i.push({code:t,key:o,value:s}),0===t?r++:u++,c.push({key:o,value:s,seq:a})})),n._updateGlobalSequence(e.ID,a),c.length>0&&(n._updateLocalExtension(e.ID,c),c=null),{resultList:i,successCount:r,failureCount:u}})).catch((function(e){return Za(e)}))}},{key:"_getRequestExtensions",value:function(e,t){var n=[];if(this._hasLocalExtension(e.ID)){var o=this._getLocalExtension(e.ID);return t.forEach((function(e){var t=e.key,s=e.value,a=0;o.has(t)&&(a=o.get(t).seq),n.push({key:t,value:s,seq:a})})),n}return t.forEach((function(e){var t=e.key,o=e.value;n.push({key:t,value:o,seq:0})})),n}},{key:"_getMessageExtensions",value:function(e,t){var n=this,o="".concat(this._n,"._getMessageExtensions"),s=e.ID,a=e.to,i=null;switch(kt(a)?E.CONV_TOPIC:e.conversationType){case E.CONV_C2C:i=this.getModule(Un);break;case E.CONV_GROUP:i=this.getModule(Pn);break;case E.CONV_TOPIC:i=this.getModule(Fn);break;default:return Za({code:ha.CANNOT_FIND_MODULE})}return i.getMessageExtensions(e,t).then((function(t){var a=t.data,i=a.extensions,r=a.completeFlag,u=a.globalSequence,c=a.clearSequence;if(i=zt(i)?[]:i,Ve.l("".concat(o," ok. completeFlag:").concat(r," globalSequence:").concat(u," clearSequence:").concat(c," count:").concat(i.length)),n._updateLocalExtension(s,i),n._clearLocalExtension(s,c),n._updateGlobalSequence(s,u),1!==r){var l=i.slice(-1)[0].seq+1;return n._getMessageExtensions(e,l)}return n._getLocalExtensions(s)})).catch((function(e){return Za(e)}))}},{key:"_hasLocalExtension",value:function(e){return this.messageExtensionMap.has(e)}},{key:"_getLocalExtension",value:function(e){return this.messageExtensionMap.get(e)}},{key:"_updateLocalExtension",value:function(e,t){this._hasLocalExtension(e)||this.messageExtensionMap.set(e,new Map);var n=this._getLocalExtension(e);t.forEach((function(e){var t=e.key,o=e.value,s=void 0===o?"":o,a=e.seq;n.set(t,{value:s,seq:a})}))}},{key:"_clearLocalExtension",value:function(e,t){if(!(t<=0)&&this._hasLocalExtension(e)){var n=this._getLocalExtension(e);n.forEach((function(e,o){e.seq<=t&&n.delete(o)}))}}},{key:"_getLocalExtensions",value:function(e){var t=[];this._hasLocalExtension(e)&&this._getLocalExtension(e).forEach((function(e,n){var o=e.value;zt(o)||t.push({key:n,value:o})}));return t}},{key:"_getGlobalSequence",value:function(e){return this.globalSeqMap.get(e)}},{key:"_updateGlobalSequence",value:function(e,t){this.globalSeqMap.set(e,t)}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this.messageExtensionMap.clear(),this.globalSeqMap.clear(),this.getMessageExtensionsMap.clear()}}]),n}(uo),Ir=function(e){r(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="ComboMessageModule",s}return a(n,[{key:"sendMessage",value:function(e){var t=this,n=this._constructMessageInstance(e);if(null===n)return Za({code:ha.MESSAGE_SEND_FAIL});this._addSendMessageTotalCount(n);var o=Date.now();return this.getModule(qn).setMessageRandom(n),this._sendComboMessage(n,e).then((function(e){var s=e.data,a=s.time,i=s.sequence,r=s.readReceiptCode;et(r)&&0!==r&&(new Aa("sendMessageWithReceipt").setMessage("from:".concat(n.from," to:").concat(n.to," sequence:").concat(i," readReceiptCode:").concat(r)).end(),Ve.w("".concat(t._n,".sendMessage readReceiptCode:").concat(r," message:").concat(t.getErrorMessage(r))));t._addSendMessageSuccessCount(n,o);var u=t.getModule(qn);n.status=Qt.SUCCESS,n.time=a,n.conversationType===E.CONV_GROUP&&(n.sequence=i),u.appendToMessageList(n);var c=n;return!0===n._isExcludedFromLastMessage&&(c=""),u.onMessageSent({conversationOptionsList:[{conversationID:n.conversationID,unreadCount:0,type:n.conversationType,subType:n.conversationSubType,lastMessage:c}]}),Ya({message:n})})).catch((function(e){return t._onSendMessageFailed(n,e)}))}},{key:"_sendComboMessage",value:function(e,t){var n=this._m.getModule(zn),o="";return e.conversationType===E.CONV_C2C&&(o="".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SEND_MESSAGE)),e.conversationType===E.CONV_GROUP&&(o="".concat(V.NAME.GROUP,".").concat(V.CMD.SEND_GROUP_MESSAGE)),n.sendComboMessage({servcmd:o,data:t})}},{key:"_constructMessageInstance",value:function(e){var t="".concat(this._n,"._constructMessageInstance"),n=null;try{var o=this.getMyUserID(),s={};if(s.senderTinyID=this.getMyTinyID(),s.currentUser=o,s.from=e.From_Account||o,e.GroupId?(s.conversationID="".concat(E.CONV_GROUP).concat(e.GroupId),s.conversationType=E.CONV_GROUP,s.to=e.GroupId):e.To_Account&&(s.conversationID="".concat(E.CONV_C2C).concat(e.To_Account),s.conversationType=E.CONV_C2C,s.to=e.To_Account),s.time=e.MsgTimeStamp||0,s.random=e.Random||e.MsgRandom||0,s.priority=e.MsgPriority,nt(e.CloudCustomData)&&e.CloudCustomData.length>0&&(s.cloudCustomData=e.CloudCustomData),at(e.SendMsgControl)&&(s.messageControlInfo={},e.SendMsgControl.includes("NoUnread")&&(s.messageControlInfo.excludedFromUnreadCount=1),e.SendMsgControl.includes("NoLastMsg")&&(s.messageControlInfo.excludedFromLastMessage=1)),s.conversationType===E.CONV_GROUP&&at(e.To_Account)&&e.To_Account.length>0){var a=e.To_Account;e.To_Account.length>50&&(a=e.To_Account.slice(0,50),Ve.w("".concat(t," To_Account must be less than or equal to 50."))),s.receiverList=m(a),e.To_Account=m(a)}1!==e.IsNeedReadReceipt&&1!==e.NeedReadReceipt||(s.needReadReceipt=!0),1===e.SupportMessageExtension&&(s.isSupportExtension=!0),(n=new Wa(s)).status=Qt.UNSEND,e.MsgClientTime=n.clientTime,n.conversationType===E.CONV_C2C&&(e.MsgSeq=n.sequence);for(var i,r=e.MsgBody.length,u=0;u100)return n--,t;if(at(t)){var s=t.map((function(t){return ot(t)?e(t,o):t}));return n--,s}if(ot(t)){var a=(i=t,r=function(e,t){if(!dt(t))return!1;if((s=t)!==kr(s))for(var n=0;n65535)return Ar(240|t>>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533}else t<=57343&&(t=65533);return t<=2047?Ar(192|t>>>6,128|63&t):Ar(224|t>>>12,128|t>>>6&63,128|63&t)},Nr=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,Rr),n=0|t.length,o=new Uint8Array(n),s=0;s0)for(var u=0;u=a&&(Ve.l("".concat(e._n,"._checkPromiseMap request timeout, delete requestID:").concat(n)),e._promiseMap.delete(n),o(new ja({code:ha.NETWORK_TIMEOUT})),e._channelModule.onRequestTimeout(n))}))}},{key:"onOpen",value:function(e){if(""!==this._readyState){this._onOpenTs=Date.now();var t=e.id,n=e.res;this._socketID=t;var o=Date.now()-this._startTs,s="socketID:".concat(t," res:").concat(n);Ve.l("".concat(this._n,"._onOpen cost:").concat(o," ms. ").concat(s)),new Aa("wsOnOpen").setMessage(o).setCostTime(o).setMoreMessage(s).end(),e.id===this._socketID&&(this._readyState=wr,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._channelModule.onReconnected(),this._reConnectFlag=!1),this._channelModule.onOpen())}}},{key:"onClose",value:function(e){var t=new Aa("wsOnClose"),n=e.id,o=e.e,s="sourceSocketID:".concat(n," currentSocketID:").concat(this._socketID," code:").concat(o.code," reason:").concat(o.reason),a=0;0!==this._onOpenTs&&(a=Date.now()-this._onOpenTs),t.setMessage(a).setCostTime(a).setMoreMessage(s).setCode(o.code).end(),Ve.l("".concat(this._n,"._onClose ").concat(s," onlineTime:").concat(a)),n===this._socketID&&(this._readyState=qr,a<1e3?this._channelModule.onReconnectFailed():this._channelModule.onClose())}},{key:"onError",value:function(e){var t=e.id,n=e.e,o="sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID);new Aa("wsOnError").setMessage(n.errMsg||gt(n)).setMoreMessage(o).setLevel("error").end(),Ve.w("".concat(this._n,"._onError"),n,o),t===this._socketID&&(this._readyState="",this._channelModule.onError())}},{key:"onMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(c){new Aa("jsonParseError").setMessage(e.data).end()}if(t&&t.head){var n=this._getRequestIDFromHead(t.head),o=t.body;if(!this._isTRTCCommand(n)){var s=bt(t.head);o=Lr(t.body,this._getResponseKeyMap(s))}if(Ve.d("".concat(this._n,".onMessage ret:").concat(JSON.stringify(o)," requestID:").concat(n," has:").concat(this._promiseMap.has(n))),this._setNextPingTs(),this._promiseMap.has(n)){var a=this._promiseMap.get(n),i=a.resolve,r=a.reject,u=a.timestamp;return this._promiseMap.delete(n),this._calcRTT(u),void(o.errorCode&&0!==o.errorCode?(this._channelModule.onErrorCodeNotZero(o),r(new ja({code:o.errorCode,message:o.errorInfo||"",data:n.includes(Ro)||n.includes(ys)?{elements:o.elements,messageVersion:o.messageVersion,cloudCustomData:o.cloudCustomData}:void 0}))):i(Ya(o)))}this._channelModule.onMessage({head:t.head,body:o})}}},{key:"_isTRTCCommand",value:function(e){for(var t=this._channelModule.getModule(so).getCommandList(),n=!1,o=0;o0&&this._promiseMap.forEach((function(t,n){var o=t.uplinkData,s=t.resolve,a=t.reject;e._promiseMap.set(n,{resolve:s,reject:a,timestamp:Date.now(),uplinkData:o}),e._execute(n,o)})),this._simpleRequestMap.size>0){var t,n=D(this._simpleRequestMap);try{for(n.s();!(t=n.n()).done;){var o=v(t.value,2),s=o[0],a=o[1];this._execute(s,a)}}catch(i){n.e(i)}finally{n.f()}this._simpleRequestMap.clear()}}},{key:"send",value:function(e){var t=this;e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.keyMap;var n=g(e,Pr),o=this._getRequestIDFromHead(e.head),s=JSON.stringify(n);return new Promise((function(e,a){(t._promiseMap.set(o,{resolve:e,reject:a,timestamp:Date.now(),uplinkData:s}),Ve.d("".concat(t._n,".send uplinkData:").concat(JSON.stringify(n)," requestID:").concat(o," readyState:").concat(t._readyState)),t._readyState!==wr)?t._reConnect():(t._execute(o,s),t._channelModule.getModule(eo).addRequestCount())}))}},{key:"simplySend",value:function(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.keyMap;var t=g(e,br),n=this._getRequestIDFromHead(e.head),o=JSON.stringify(t);this._readyState!==wr?(this._simpleRequestMap.size0&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:"onErrorCodeNotZero",value:function(e){this.getModule(zn).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.getModule(zn).onMessage(e)}},{key:"send",value:function(e){return this._socketHandler?this._previousState!==E.NET_STATE_CONNECTED&&e.head.servcmd.includes(Bs)?(this.reConnect(),this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:"_sendLogViaHTTP",value:function(e){var t=V.HOST.CURRENT.STAT;return new Promise((function(n,o){var s="".concat(t,"/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e.head.sdkappid,"&reqtime=").concat(Date.now()),a=JSON.stringify(e.body),i="application/x-www-form-urlencoded;charset=UTF-8";if(ae)re.request({url:s,data:a,method:"POST",timeout:3e3,header:{"content-type":i},success:function(){n()},fail:function(){o(new ja({code:ha.NETWORK_ERROR}))}});else{var r=new XMLHttpRequest,u=setTimeout((function(){r.abort(),o(new ja({code:ha.NETWORK_TIMEOUT}))}),3e3);r.onreadystatechange=function(){4===r.readyState&&(clearTimeout(u),200===r.status||304===r.status?n():o(new ja({code:ha.NETWORK_ERROR})))},r.open("POST",s,!0),r.setRequestHeader("Content-type",i),r.send(a)}}))}},{key:"simplySend",value:function(e){return this._socketHandler?this._socketHandler.simplySend(e):Promise.reject()}},{key:"onOpen",value:function(){this._ping()}},{key:"onClose",value:function(){this._socketHandler&&(this._socketHandler.getReconnectFlag()&&this._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED));this.reConnect()}},{key:"onError",value:function(){ae&&!oe&&this.outputWarning("DomainNameInMP"),this._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.getModule(zn).getKeyMap(e)}},{key:"_onAppHide",value:function(){this._isAppShowing=!1}},{key:"_onAppShow",value:function(){this._isAppShowing=!0}},{key:"onRequestTimeout",value:function(e){}},{key:"onReconnected",value:function(){Ve.l("".concat(this._n,".onReconnected")),this._m.restartTimer(),this.getModule(zn).onReconnected(),this._emitNetStateChangeEvent(E.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){Ve.l("".concat(this._n,".onReconnectFailed")),this._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED)}},{key:"reConnect",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!1;this._socketHandler&&(t=this._socketHandler.getReconnectFlag());var n="forcedFlag:".concat(e," fatalErrorFlag:").concat(this._fatalErrorFlag," previousState:").concat(this._previousState," reconnectFlag:").concat(t);if(Ve.l("".concat(this._n,".reConnect ").concat(n)),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===E.NET_STATE_CONNECTING&&t)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(E.NET_STATE_CONNECTING)}}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(Ve.l("".concat(this._n,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),this._previousState=e,this.emitOuterEvent(k.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e=this;if(!0!==this._probing){this._probing=!0;var t=this.getModule(zn).getProtocolData({protocolName:Hs});this.send(t).then((function(){e._probing=!1})).catch((function(t){if(Ve.w("".concat(e._n,"._ping failed. error:"),t),e._probing=!1,t&&60002===t.code)return new Aa("error").setMessage("code:".concat(t.code," message:").concat(t.message)).setNetworkType(e.getModule(Hn).getNetworkType()).end(),e._fatalErrorFlag=!0,void e._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED);e.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];Ve.l("".concat(e._n,"._ping failed. probe network, isAppShowing:").concat(e._isAppShowing," online:").concat(o," networkType:").concat(s)),o?e.reConnect():e._emitNetStateChangeEvent(E.NET_STATE_DISCONNECTED)}))}))}}},{key:"_checkNextPing",value:function(){this._socketHandler&&(this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping())}},{key:"canIUseInflate",value:function(){return this._m.canIUseInflate()}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),this._timerForNotLoggedIn>-1&&clearInterval(this._timerForNotLoggedIn)}},{key:"onRestApiKickedOut",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._previousState=E.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3)}}]),n}(uo),Br=["a2","tinyid"],Hr=["a2","tinyid"],Kr=function(){function e(t){o(this,e),this._n="ProtocolHandler",this._sessionModule=t,this._configMap=new Map,this._fillConfigMap()}return a(e,[{key:"_fillConfigMap",value:function(){this._configMap.clear();var e=this._sessionModule.genCommonHead(),n=this._sessionModule.genCosSpecifiedHead(),o=this._sessionModule.genSSOReportHead(),s=this._sessionModule.isIntl();this._configMap.set(co,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.LOGIN)}),body:{state:"Online",isWebUniapp:0,deviceBrand:0},keyMap:{request:{deviceBrand:"InstType"},response:{InstId:"instanceID",HelloInterval:"helloInterval"}}}}(e)),this._configMap.set(lo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.LOGOUT)}),body:{type:0},keyMap:{request:{type:"wslogout_type"}}}}(e)),this._configMap.set(po,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.HELLO)}),body:{isWebUniapp:0},keyMap:{response:{NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(go,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.STAT_SERVICE,".").concat(V.CMD.KICK_OTHER)}),body:{}}}(e)),this._configMap.set(qs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_COS_SIGN,".").concat(V.CMD.COS_SIGN)}),body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{request:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},response:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}}(n)),this._configMap.set(xs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.CUSTOM_UPLOAD,".").concat(V.CMD.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{request:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},response:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}}(n)),this._configMap.set(Vs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.CUSTOM_UPLOAD,".").concat(V.CMD.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{request:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},response:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}}(n)),this._configMap.set(Qs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{request:{SDKAppID:"uint32_sdkappid"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set($s,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(Xs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.FETCH_CLOUD_CONTROL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{request:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(Zs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.PUSHED_CLOUD_CONTROL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(ea,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OVERLOAD_PUSH,".").concat(V.CMD.OVERLOAD_NOTIFY)}),body:{},keyMap:{response:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}}(e)),this._configMap.set(ho,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_MESSAGES)}),body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0,needSignaling:1},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},response:{MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",ClientSeq:"clientSequence",MsgSeq:"sequence",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgRandom:"random",MsgTimeStamp:"time",MsgContent:"content",ToGroupId:"to",MsgKey:"messageKey",GroupTips:"groupTips",MsgBody:"elements",MsgType:"type",C2CRemainingUnreadCount:"C2CRemainingUnreadList",C2CPairUnreadCount:"C2CPairUnreadList"}}}}(e)),s||(this._configMap.set(_o,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.BIG_DATA_HALLWAY_AUTH_KEY)}),body:{}}}(e)),this._configMap.set(pa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_MSG_AUDIT_MGR,".").concat(V.CMD.GET_RPOFANITY_LIST)}),body:{version:0,deviceID:"",startIndex:void 0},keyMap:{request:{version:"uint64_version",deviceID:"str_device_id",startIndex:"uint64_start_index"},response:{msg_cmd_error_code:"errorInfo",str_err_msg:"errorMessage",uint32_code:"errorCode",msg_scene_ctl_config:"filterConfig",uint64_c2c_custom_msg_flag:"c2c_custom_message",uint64_c2c_text_msg_flag:"c2c_text_message",uint64_group_custom_msg_flag:"group_custom_message",uint64_group_text_msg_flag:"group_text_message",uint64_group_info_flag:"group_profile",uint64_group_member_info_flag:"group_member_profile",uint64_relation_chain_flag:"sns",uint64_user_info_flag:"user_profile",rpt_msg_dirty_word:"lexicon",str_dirty_word:"profanity",str_replaced_content:"replacement",uint64_filter_type:"filterType",uint64_id:"id",uint64_word_type:"profanityType",uint64_complete_flag:"completeFlag",uint64_next_start_index:"nextStartIndex",uint64_version:"version",uint64_expired_time:"expiredTime"}}}}(e))),this._configMap.set(fo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SEND_MESSAGE)}),body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",count:"MaxCnt",lastMessageTime:"LastMsgTime",messageKey:"MsgKey",peerAccount:"Peer_Account",data:"Data",description:"Desc",extension:"Ext",type:"MsgType",content:"MsgContent",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",nick:"From_AccountNick",avatar:"From_AccountHeadurl",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"IsNeedReadReceipt"}}}}(e)),this._configMap.set(vo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SEND_GROUP_MESSAGE)}),body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0},keyMap:{request:{to:"GroupId",extension:"Ext",data:"Data",description:"Desc",random:"Random",sequence:"ReqMsgSeq",count:"ReqMsgNumber",type:"MsgType",priority:"MsgPriority",content:"MsgContent",elements:"MsgBody",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",clientSequence:"ClientSeq",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"NeedReadReceipt",receiverList:"To_Account"},response:{MsgTime:"time",MsgSeq:"sequence"}}}}(e)),this._configMap.set(To,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.REVOKE_C2C_MESSAGE)}),body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{request:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}}(e)),this._configMap.set(is,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.REVOKE_GROUP_MESSAGE)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{request:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}}(e)),this._configMap.set(So,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_C2C_ROAM_MESSAGES)}),body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{request:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},response:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer"}}}}(e)),this._configMap.set(Ro,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.MODIFY_C2C_MESSAGE)}),body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(cs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_ROAM_MESSAGES)}),body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{request:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},response:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",IsPlaceMsg:"isPlaceMessage",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgPriority:"priority",MsgBody:"elements",MsgType:"type",MsgContent:"content",IsFinished:"complete",Download_Flag:"downloadFlag",ClientSeq:"clientSequence",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList"}}}}(e)),this._configMap.set(Do,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SET_C2C_MESSAGE_READ)}),body:{C2CMsgReaded:void 0},keyMap:{request:{lastMessageTime:"LastedMsgTime"}}}}(e)),this._configMap.set(ko,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{request:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}}(e)),this._configMap.set(Eo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{updateSequence:0},keyMap:{response:{MuteNotificationsList:"muteFlagList"}}}}(e)),this._configMap.set(rs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SET_GROUP_MESSAGE_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{request:{messageReadSeq:"MsgReadedSeq"}}}}(e)),this._configMap.set(us,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SET_ALL_MESSAGE_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{request:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},response:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}}(e)),this._configMap.set(Ao,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.DELETE_C2C_MESSAGE)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{request:{keyList:"MsgKeyList"}}}}(e)),this._configMap.set(Ms,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DELETE_GROUP_MESSAGE)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{request:{deleter:"Deleter_Account",keyList:"Seqs"}}}}(e)),this._configMap.set(ga,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_TRANSLATE,".").concat(V.CMD.TRANSLATE_TEXT)}),body:{sourceTextList:void 0,SDKAppID:0,from:0,source:"",target:""},keyMap:{request:{sourceTextList:"SourceText",SDKAppID:"SdkAppId",from:"FromAccount"},response:{TargetText:"translatedTextList",RequestId:"requestID",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}}(e)),this._configMap.set(ys,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.MODIFY_GROUP_MESSAGE)}),body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(ls,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequence:"MsgSeq"}}}}(e)),this._configMap.set(ps,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:"",messageInfoList:void 0},keyMap:{request:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}}(e)),this._configMap.set(ds,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}}(e)),this._configMap.set(gs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_READ_RECEIPT_DETAIL)}),body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{request:{sequence:"MsgSeq",count:"Num"},response:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}}(e)),this._configMap.set(No,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.MODIFY_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Oo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.GET_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}}(e)),this._configMap.set(Es,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.MODIFY_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Ss,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.GET_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,startSequence:void 0}}}(e)),this._configMap.set(Lo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{request:{userIDList:"To_Account"},response:{ReadTime:"peerReadTimeList"}}}}(e)),this._configMap.set(Uo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,count:0},keyMap:{request:{},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime"}}}}(e)),this._configMap.set(Go,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.PAGING_GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:4,assistFlag:15},keyMap:{request:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex",GroupId:"convGroupID"}}}}(e)),this._configMap.set(Po,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.DELETE_CONVERSATION)}),body:{fromAccount:"",conversationList:void 0,clearHistoryMessage:void 0},keyMap:{request:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble",conversationList:"ContactItem"},response:{ResultItem:"resultList",ToGroupid:"groupID",ResultCode:"code",ResultInfo:"info"}}}}(e)),this._configMap.set(bo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.CLEAR_HISTORY_MESSAGE)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{request:{toGroupID:"ToGroupid"}}}}(e)),this._configMap.set(wo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.PIN_CONVERSATION)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{request:{itemList:"RecentContactItem"}}}}(e)),this._configMap.set(Fo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.DELETE_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(qo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(xo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(Vo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.CREATE_CONVERSATION_GROUP)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"GroupContactItem",groupID:"ToGroupId"},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(Bo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.DELETE_CONVERSATION_GROUP)}),body:{fromAccount:"",groupName:void 0},keyMap:{request:{},response:{GroupId:"convGroupID"}}}}(e)),this._configMap.set(Ho,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{oldName:"OldGroupName",newName:"NewGroupName",groupID:"ToGroupId",operationType:"ContactOptType",groupName:"OldGroupName",updateItem:"ContactUpdateItem"},response:{ContactOptType:"operationType",ToGroupId:"groupID",GroupId:"convGroupID"}}}}(e)),this._configMap.set(Ko,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(Wo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(Yo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.GET_CONVERSATION_GROUP_LIST)}),body:{fromAccount:"",startTime:void 0,startIndex:void 0},keyMap:{request:{},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList"}}}}(e)),this._configMap.set(mo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.PROFILE,".").concat(V.CMD.PORTRAIT_GET)}),body:{fromAccount:"",userItem:[]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(Mo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.PROFILE,".").concat(V.CMD.PORTRAIT_SET)}),body:{fromAccount:"",profileItem:[{tag:He.NICK,value:""},{tag:He.GENDER,value:""},{tag:He.ALLOWTYPE,value:""},{tag:He.AVATAR,value:""}]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(yo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.GET_BLACKLIST)}),body:{fromAccount:"",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{response:{CurruentSequence:"currentSequence"}}}}(e)),this._configMap.set(Io,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.ADD_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(Co,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.DELETE_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(aa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.SET_SELF_STATUS)}),body:{customStatus:""},keyMap:{}}}(e)),this._configMap.set(ia,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}}(e)),this._configMap.set(ra,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.SUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(ua,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.UNSUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(jo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_JOINED_GROUPS)}),body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0},keyMap:{request:{memberAccount:"Member_Account"},response:{GroupIdList:"groups",NoUnreadSeqList:"excludedUnreadSequenceList",MsgSeq:"readedSequence",LastRecallTime:"_lastRevokedTime"}}}}(e)),this._configMap.set(zo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_INFO)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember"],groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{request:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(Jo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.CREATE_GROUP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:"",isSupportTopic:void 0,inviteOption:void 0},keyMap:{request:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",inviteOption:"InviteJoinOption"},response:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}}(e)),this._configMap.set(Xo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DESTROY_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(Zo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.MODIFY_GROUP_INFO)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0,inviteOption:void 0},keyMap:{request:{groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl",inviteOption:"InviteJoinOption"},response:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(Qo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{request:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},response:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}}(e)),this._configMap.set($o,function(e){return e.a2,e.tinyid,{head:t(t({},g(e,Br)),{},{servcmd:"".concat(V.NAME.BIG_GROUP_NO_AUTH,".").concat(V.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{request:{applyMessage:"ApplyMsg"},response:{HugeGroupFlag:"avChatRoomFlag"}}}}(e)),this._configMap.set(es,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.QUIT_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(ts,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SEARCH_GROUP_BY_ID)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"]}},keyMap:{response:{}}}}(e)),this._configMap.set(ns,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.CHANGE_GROUP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{request:{newOwnerID:"NewOwner_Account"}}}}(e)),this._configMap.set(os,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.HANDLE_APPLY_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(ss,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.HANDLE_INVITE_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,invitee:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",invitee:"Invited_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg"}}}}(e)),this._configMap.set(as,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.HANDLE_GROUP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(hs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_APPLICATION)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{request:{handleAccount:"Handle_Account"},response:{To_Account:"userID"}}}}(e)),this._configMap.set(_s,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.DELETE_GROUP_SYSTEM_MESSAGE)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(fs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.BIG_GROUP_LONG_POLLING,".").concat(V.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(e)),this._configMap.set(vs,function(e){return e.a2,e.tinyid,{head:t(t({},g(e,Hr)),{},{servcmd:"".concat(V.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,".").concat(V.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(e)),this._configMap.set(ms,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_ONLINE_MEMBER_NUM)}),body:{groupID:void 0}}}(e)),this._configMap.set(Is,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(Cs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.MODIFY_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(Ts,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DELETE_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key"}}}}(e)),this._configMap.set(Ds,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.CLEAR_GROUP_ATTRIBUTES)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}}(e)),this._configMap.set(ks,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_ATTR,".").concat(V.CMD.GET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{request:{avChatRoomKey:"Key",groupType:"GroupType"}}}}(e)),this._configMap.set(Ls,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_NOTIFY)}),body:{notifyType:1,groupID:"",beginTime:0,endTime:0,limit:20},keyMap:{request:{},response:{NextMsgTime:"nextRevokedTime",NotifyMsgList:"notifyList"}}}}(e)),this._configMap.set(As,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.UPDATE_GROUP_COUNTER)}),body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{request:{counterList:"GroupCounter"}}}}(e)),this._configMap.set(Rs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_COUNTER)}),body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{request:{keyList:"GroupCounterKeys"}}}}(e)),this._configMap.set(ta,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{request:{avatar:"FaceUrl"}}}}(e)),this._configMap.set(na,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.DELETE_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:"TopicIdList"},response:{DestroyResultItem:"resultList"}}}}(e)),this._configMap.set(oa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{request:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}}(e)),this._configMap.set(sa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:["NoUnreadSeqList"]},keyMap:{request:{topicIDList:"TopicIdList"},response:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence",NoUnreadSeqList:"excludedUnreadSequenceList"}}}}(e)),this._configMap.set(Ns,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_MEMBER_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:["Role","NameCard","ShutUpUntil","JoinTime"],memberCustomFieldFilter:void 0},keyMap:{request:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}}(e)),this._configMap.set(Os,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_AVCHATROOM,".").concat(V.CMD.GET_AVCHATROOM_MEMBER_LIST)}),body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{request:{offset:"Timestamp",filter:"Mark"},response:{NextTimestamp:"offset"}}}}(e)),this._configMap.set(Gs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_MEMBER_INFO)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{request:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}}(e)),this._configMap.set(Us,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.ADD_GROUP_MEMBER)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{request:{userID:"Member_Account",userIDList:"MemberList"},response:{MemberList:"members"}}}}(e)),this._configMap.set(Ps,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DELETE_GROUP_MEMBER)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{request:{userIDList:"MemberToDel_Account"}}}}(e)),this._configMap.set(bs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.BAN_AVCHATROOM_MEMBER)}),body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:""},keyMap:{request:{userIDList:"Members_Account",duration:"Duration",reason:"Description"}}}}(e)),this._configMap.set(ws,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.MODIFY_GROUP_MEMBER_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{request:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}}(e)),this._configMap.set(Fs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_AVCHATROOM,".").concat(V.CMD.MARK_AVCHATROOM_MEMBER_INFO)}),body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{request:{operationType:"CommandType",memberList:"MemberList",markType:"Marks",userID:"Member_Account"},response:{CommandType:"operationType",Marks:"markType",Member_Account:"userID"}}}}(e)),this._configMap.set(Bs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STAT,".").concat(V.CMD.TIM_WEB_REPORT_V2)}),body:{header:{},event:[],quality:[]},keyMap:{request:{SDKType:"sdk_type",SDKVersion:"sdk_version",deviceType:"device_type",platform:"platform",instanceID:"instance_id",traceID:"trace_id",SDKAppID:"sdk_app_id",userID:"user_id",tinyID:"tiny_id",extension:"extension",timestamp:"timestamp",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",qualityType:"quality_type",reportIndex:"report_index",wholePeriod:"whole_period",totalCount:"total_count",rttCount:"success_count_business",successRateOfRequest:"percent_business",countLessThan1Second:"success_count_business",percentOfCountLessThan1Second:"percent_business",countLessThan3Second:"success_count_platform",percentOfCountLessThan3Second:"percent_platform",successCountOfBusiness:"success_count_business",successRateOfBusiness:"percent_business",successCountOfPlatform:"success_count_platform",successRateOfPlatform:"percent_platform",successCountOfMessageReceived:"success_count_business",successRateOfMessageReceived:"percent_business",avgRTT:"average_value",avgDelay:"average_value",avgValue:"average_value",uiPlatform:"ui_platform"}}}}(o)),this._configMap.set(Hs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.HEARTBEAT,".").concat(V.CMD.ALIVE)}),body:{}}}(e)),this._configMap.set(Ks,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_PUSH,".").concat(V.CMD.MESSAGE_PUSH)}),body:{},keyMap:{response:{C2cMsgArray:"C2CMessageArray",GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",C2cNotifyMsgArray:"C2CNotifyMessageArray",C2cMsgInfo:"C2CReadReceiptArray",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyAdd_Account:"userID",ProfileImNick:"nick",PendencyType:"applicationType",C2CReadAllMsg:"readAllC2CMessage",IsNeedReadReceipt:"needReadReceipt",Status:"statusType"}}}}(e)),this._configMap.set(Ws,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_PUSH,".").concat(V.CMD.MULTI_MESSAGE_PUSH)}),body:{},keyMap:{response:{GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyType:"applicationType"}}}}(e)),this._configMap.set(Ys,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.MESSAGE_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{request:{sessionData:"SessionData"}}}}(e)),this._configMap.set(js,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{response:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(Js,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_LONG_MESSAGE,".").concat(V.CMD.DOWNLOAD_MERGER_MESSAGE)}),body:{downloadKey:""},keyMap:{response:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}}(e)),this._configMap.set(zs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_LONG_MESSAGE,".").concat(V.CMD.UPLOAD_MERGER_MESSAGE)}),body:{messageList:[]},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",type:"MsgType",content:"MsgContent",data:"Data",description:"Desc",extension:"Ext",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody"}}}}(e)),this._configMap.set(da,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.SET_TOKEN)}),body:{tokenID:"",pushMsg:0,sdkAppID:0,businessID:"",deviceBrand:"",deviceToken:"",isTpns:0,isWebUniapp:0},keyMap:{request:{tokenID:"TokenID",pushMsg:"PushMsg",sdkAppID:"EnterVersion",businessID:"BusiID",deviceBrand:"InstType",deviceToken:"VarToken",isTpns:"IsTpns"}}}}(e)),this._configMap.set(la,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.STAT_FOREGROUND)}),body:{isWebUniapp:0}}}(e)),this._configMap.set(ca,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.STAT_BACKGROUND)}),body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{request:{c2cUnreadCount:"C2cUnread",groupUnreadCount:"GrpUnread"}}}}(e))}},{key:"has",value:function(e){return this._configMap.has(e)}},{key:"get",value:function(e){return this._configMap.get(e)}},{key:"update",value:function(){this._fillConfigMap()}},{key:"getKeyMap",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(Ve.w("".concat(this._n,".getKeyMap unknown protocolName:").concat(e)),{})}},{key:"getProtocolData",value:function(e){var t=e.protocolName,n=e.requestData,o=this.get(t),s=null;if(n){var a=this._simpleDeepCopy(o),i=this._updateService(n,a),r=i.body,u=Object.create(null);for(var c in r)if(Object.prototype.hasOwnProperty.call(r,c)){if(u[c]=r[c],void 0===n[c])continue;u[c]=n[c]}i.body=u,s=this._getUplinkData(i)}else s=this._getUplinkData(o);return s}},{key:"_getUplinkData",value:function(e){var t=this._requestDataCleaner(e),n=bt(t.head),o=Sr(t.body,this._getRequestKeyMap(n));return t.body=o,t}},{key:"_updateService",value:function(e,t){var n=bt(t.head);if(this._isFromGroupRequest(t)){var o=e.type,s=e.groupID,a=void 0===s?void 0:s,i=e.groupIDList,r=void 0===i?[]:i;it(a)&&(a=r[0]||""),Dt({type:o,groupID:a})&&(t.head.servcmd="".concat(V.NAME.GROUP_COMMUNITY,".").concat(n))}return t}},{key:"_isFromGroupRequest",value:function(e){return e.head.servcmd.includes(V.NAME.GROUP)||e.head.servcmd.includes(V.NAME.GROUP_ATTR)}},{key:"_getRequestKeyMap",value:function(e){var n=this.getKeyMap(e);return t(t({},Dr.request),n.request)}},{key:"_requestDataCleaner",value:function(e){var t=Array.isArray(e)?[]:Object.create(null);for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&dt(o)&&null!==e[o]&&void 0!==e[o]&&("object"!==n(e[o])?t[o]=e[o]:t[o]=this._requestDataCleaner.bind(this)(e[o]));return t}},{key:"_simpleDeepCopy",value:function(e){for(var t,n=Object.keys(e),o={},s=0,a=n.length;s1e3*s)return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;r+=1,this._commandRequestInfoMap.set(t,{startTime:i,requestCount:r});var u=!1;return r>o&&(u=!0),u}},{key:"_isServerOverload",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var t=this._serverOverloadInfoMap.get(e),n=t.overloadTime,o=t.waitingTime,s=!1;return Date.now()-n<=1e3*o?s=!0:(this._serverOverloadInfoMap.delete(e),s=!1),s}},{key:"onPushedServerOverload",value:function(e){var t=e.overloadCommand,n=e.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:n}),Ve.w("".concat(this._n,".onPushedServerOverload waitingTime:").concat(n,"s"))}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._updateCommandFrequencyLimitMap(jr),this._commandRequestInfoMap.clear(),this._serverOverloadInfoMap.clear()}}]),s}(uo),Jr=function(e){r(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="MessageLossDetectionModule",s._maybeLostSequencesMap=new Map,s._firstRoundRet=[],s}return a(n,[{key:"onMessageMaybeLost",value:function(e,t,n){this._maybeLostSequencesMap.has(e)||this._maybeLostSequencesMap.set(e,[]);for(var o=this._maybeLostSequencesMap.get(e),s=0;s=this._expiredTime}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetchConfig();if(Ve.l("".concat(this._n,".fetchConfig canFetchConfig:").concat(t)),t){var n=new Aa("fetchCloudControlConfig"),o=this.getModule(xn).getSDKAppID();this._isFetching=!0,this.request({protocolName:Xs,requestData:{SDKAppID:o,version:this._version}}).then((function(t){e._isFetching=!1,n.setMessage("version:".concat(e._version," newVersion:").concat(t.data.version," config:").concat(t.data.cloudControlConfig)).setNetworkType(e.getNetworkType()).end(),Ve.l("".concat(e._n,".fetchConfig ok")),e._parseCloudControlConfig(t.data)})).catch((function(t){e._isFetching=!1,e.probeNetwork().then((function(e){var o=v(e,2),s=o[0],a=o[1];n.setError(t,s,a).end()})),Ve.l("".concat(e._n,".fetchConfig failed. error:"),t),e._setExpiredTimeOnResponseError(12e4)}))}}},{key:"onPushedCloudControlConfig",value:function(e){Ve.l("".concat(this._n,".onPushedCloudControlConfig")),new Aa("pushedCloudControlConfig").setNetworkType(this.getNetworkType()).setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parseCloudControlConfig(e)}},{key:"onCheckTimer",value:function(e){this._canFetchConfig()&&this.fetchConfig()}},{key:"_parseCloudControlConfig",value:function(e){var t=this,n="".concat(this._n,"._parseCloudControlConfig"),o=e.errorCode,s=e.errorMessage,a=e.cloudControlConfig,i=e.version,r=e.expiredTime;if(0===o){if(this._version!==i){var u=null;try{u=JSON.parse(a)}catch(c){this.isPrivateNetWork()||Ve.e("".concat(n," JSON parse error. cloudControlConfig:"),a)}u&&(this._cloudConfig.clear(),Object.keys(u).forEach((function(e){t._cloudConfig.set(e,u[e])})),this._version=i,this.emitInnerEvent(ti))}this._expiredTime=Date.now()+1e3*r}else it(o)?(Ve.l("".concat(n," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(Ve.e("".concat(n," errorCode:").concat(o," errorMessage:").concat(s)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),n}(uo),Zr=function(e){r(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="RecoverMessageModule",s.PULL_LIMIT_COUNT=15,s}return a(n,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var e,t,n=this,o=this._getLocalConversationList().filter((function(e){return e.type===E.CONV_GROUP&&e.groupProfile.type!==E.GRP_AVCHATROOM})),s=this.getModule(qn),a=0,i=0,r=0;o.forEach((function(o){var u=o.conversationID,c=o.lastMessage;t=u.replace(E.CONV_GROUP,""),e=s.getLocalLastMessage(u),c&&0!==c.lastSequence&&e?(i=c.lastSequence,a=e.sequence,r=i-a,a>0&&r>=1&&r<300?n._recoverGroupMessage({groupID:t,localLastMessageSequence:a,remoteLastMessageSequence:i}):n._getGroupNotify(t)):n._getGroupNotify(t)}))}},{key:"_recoverC2CChat",value:function(){var e,t=this,n=this._getLocalConversationList().filter((function(e){return e.type===E.CONV_C2C})),o=this.getModule(qn),s=0,a=0,i=0,r=[Promise.resolve()];n.forEach((function(n){var u=n.conversationID,c=n.lastMessage;e=o.getLocalLastMessage(u),c&&0!==c.lastTime&&e&&(a=c.lastTime,s=e.time,i=a-s,s>0&&i>=1&&i<=600&&r.push(t._recoverC2CMessage({conversationID:u,localLastMessageTime:s,remoteLastMessageTime:a})))})),Promise.all(r).then((function(){Ve.l("".concat(t._n,"._recoverC2CChat all promise fulfilled, start to sync unread messages")),t.getModule(jn).startSyncOnReconnected()}))}},{key:"_getLocalConversationList",value:function(){return this.getModule(qn).getLocalConversationList()}},{key:"_recoverGroupMessage",value:function(e){var t=this,n="".concat(this._n,"._recoverGroupMessage");Ve.l("".concat(n," options:"),e);var o=e.groupID,s=e.localLastMessageSequence,a=e.remoteLastMessageSequence;this._getGroupRomaingMessage({groupID:o,sequence:s}).then((function(e){var s=e.data,i=s.complete,r=s.messageList;if(!it(r)){var u=r[0].sequence;Ve.l("".concat(n," pkgLastMessageSequence:").concat(u," complete:").concat(i)),u1&&r.sort((function(e,t){return e.sequence-t.sequence}));for(var l=0;l=0&&this._e2eDelayArray.push(t)}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),wt(n/t,1)}},{key:"_calcCountWithLimit",value:function(e){var t=e.e2eDelayArray,n=e.min,o=e.max;return t.filter((function(e){return n<=e&&e100&&(n=100),n}},{key:"_checkE2EDelayException",value:function(e,t){var n=e.filter((function(e){return e>t}));if(n.length>0){var o=n.length,s=Math.min.apply(Math,m(n)),a=Math.max.apply(Math,m(n)),i=this._calcAvg(n,o),r=wt(o/e.length*100,2);if(r>50)new Aa("messageE2EDelayException").setMessage("count:".concat(o," min:").concat(s," max:").concat(a," avg:").concat(i," percent:").concat(r)).setLevel("warning").end()}}},{key:"getStatResult",value:function(){var e=this._e2eDelayArray.length;if(0===e)return null;var t=m(this._e2eDelayArray),n=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),o=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),s=this._calcPercent(n,e),a=this._calcPercent(o,e),i=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:n,percentOfCountLessThan1Second:s,countLessThan3Second:o,percentOfCountLessThan3Second:a,avgDelay:i}}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),e}(),$r=function(){function e(){o(this,e),this._n="AvgRTT",this._requestCount=0,this._rttArray=[]}return a(e,[{key:"addRequestCount",value:function(){this._requestCount+=1}},{key:"addRTT",value:function(e){this._rttArray.push(e)}},{key:"_calcTotalCount",value:function(){return this._requestCount}},{key:"_calcRTTCount",value:function(e){return e.length}},{key:"_calcSuccessRateOfRequest",value:function(e,t){if(0===t)return 0;var n=wt(e/t*100,2);return n>100&&(n=100),n}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),parseInt(n/t)}},{key:"_calcMax",value:function(){return Math.max.apply(Math,m(this._rttArray))}},{key:"_calcMin",value:function(){return Math.min.apply(Math,m(this._rttArray))}},{key:"getStatResult",value:function(){var e=this._calcTotalCount(),t=m(this._rttArray);if(0===e)return null;var n=this._calcRTTCount(t),o=this._calcSuccessRateOfRequest(n,e),s=this._calcAvg(t,n);return Ve.l("".concat(this._n,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(s)),this.reset(),{totalCount:e,rttCount:n,successRateOfRequest:o,avgRTT:s}}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),e}(),eu=function(){function e(){o(this,e),this._map=new Map}return a(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}))}},{key:"addTotalCount",value:function(e){return!(it(e)||!this._map.has(e))&&(this._map.get(e).totalCount+=1,!0)}},{key:"addSuccessCount",value:function(e){return!(it(e)||!this._map.has(e))&&(this._map.get(e).successCount+=1,!0)}},{key:"addFailedCountOfUserSide",value:function(e){return!(it(e)||!this._map.has(e))&&(this._map.get(e).failedCountOfUserSide+=1,!0)}},{key:"addCost",value:function(e,t){return!(it(e)||!this._map.has(e))&&(this._map.get(e).costArray.push(t),!0)}},{key:"addFileSize",value:function(e,t){return!(it(e)||!this._map.has(e))&&(this._map.get(e).fileSizeArray.push(t),!0)}},{key:"_calcSuccessRateOfBusiness",value:function(e){if(it(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=wt(t.successCount/t.totalCount*100,2);return n>100&&(n=100),n}},{key:"_calcSuccessRateOfPlatform",value:function(e){if(it(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return(n=wt(n,2))>100&&(n=100),n}},{key:"_calcTotalCount",value:function(e){return it(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(e){return it(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(e){if(it(e)||!this._map.has(e))return-1;var t=this._map.get(e);return t.successCount+t.failedCountOfUserSide}},{key:"_calcAvg",value:function(e){return it(e)||!this._map.has(e)?-1:e===Ia?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:"_calcAvgCost",value:function(e){var t=this._map.get(e).costArray.length;if(0===t)return 0;var n=0;return this._map.get(e).costArray.forEach((function(e){n+=e})),parseInt(n/t)}},{key:"_calcAvgSpeed",value:function(e){var t=0,n=0;return this._map.get(e).costArray.forEach((function(e){t+=e})),this._map.get(e).fileSizeArray.forEach((function(e){n+=e})),parseInt(1e3*n/t)}},{key:"getStatResult",value:function(e){var t=this._calcTotalCount(e);if(0===t)return null;var n=this._calcSuccessCountOfBusiness(e),o=this._calcSuccessRateOfBusiness(e),s=this._calcSuccessCountOfPlatform(e),a=this._calcSuccessRateOfPlatform(e),i=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:n,successRateOfBusiness:o,successCountOfPlatform:s,successRateOfPlatform:a,avgValue:i}}},{key:"reset",value:function(e){it(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),e}(),tu=function(){function e(){o(this,e),this._lastMap=new Map,this._currentMap=new Map}return a(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._lastMap.set(e,new Map),t._currentMap.set(e,new Map)}))}},{key:"addMessageSequence",value:function(e){var t=e.key,n=e.message;if(it(t)||!this._lastMap.has(t)||!this._currentMap.has(t))return!1;var o=n.conversationID,s=n.sequence,a=o.replace(E.CONV_GROUP,"");if(0===this._lastMap.get(t).size)this._addCurrentMap(e);else if(this._lastMap.get(t).has(a)){var i=this._lastMap.get(t).get(a),r=i.length-1;s>i[0]&&s100&&(o=100),this._copyData(e),{totalCount:t,successCountOfMessageReceived:n,successRateOfMessageReceived:o}}},{key:"reset",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),e}(),nu=function(e){r(s,e);var n=f(s);function s(e){var t;o(this,s),(t=n.call(this,e))._n="QualityStatModule",t.TAG="im-ssolog-quality-stat",t.reportIndex=0,t.wholePeriod=!1,t._qualityItems=[_a,fa,va,ma,Ma,ya,Ia,Ca,Ta,Da],t._messageSentItems=[va,ma,Ma,ya,Ia],t._messageReceivedItems=[Ca,Ta,Da],t.REPORT_INTERVAL=120,t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._statInfoArr=[],t._avgRTT=new $r,t._avgE2EDelay=new Qr,t._rateMessageSent=new eu,t._rateMessageReceived=new tu;var a=t.getInnerEmitterInstance();return a.on(ei,t._onLoginSuccess,h(t)),a.on(ti,t._onCloudConfigUpdated,h(t)),t}return a(s,[{key:"_onLoginSuccess",value:function(){var e=this;this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems);var t=this.getModule(Vn),n=t.getItem(this.TAG,!1);!zt(n)&&ut(n.forEach)&&(Ve.l("".concat(this._n,"._onLoginSuccess get quality stat logs from local storage, count:").concat(n.length)),n.forEach((function(t){e._statInfoArr.push(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),n=this.getCloudConfig("q_rpt_tinyid_wl");it(e)||(this.REPORT_INTERVAL=Number(e)),it(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map((function(e){return Number(e)}))),it(n)||(this.REPORT_TINYID_WHITELIST=n.split(","))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}},{key:"addRequestCount",value:function(){this._avgRTT.addRequestCount()}},{key:"addRTT",value:function(e){this._avgRTT.addRTT(e)}},{key:"addMessageDelay",value:function(e){this._avgE2EDelay.addMessageDelay(e)}},{key:"addTotalCount",value:function(e){this._rateMessageSent.addTotalCount(e)||Ve.w("".concat(this._n,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||Ve.w("".concat(this._n,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||Ve.w("".concat(this._n,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,t){this._rateMessageSent.addCost(e,t)||Ve.w("".concat(this._n,".addCost invalid key or cost:"),e,t)}},{key:"addFileSize",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||Ve.w("".concat(this._n,".addFileSize invalid key or size:"),e,t)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||Ve.w("".concat(this._n,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var n={},o=Sa[this.getNetworkType()];it(o)&&(o=8);var s={qualityType:ka[e],timestamp:Pe(),networkType:o,extension:""};switch(e){case _a:n=this._avgRTT.getStatResult();break;case fa:n=this._avgE2EDelay.getStatResult();break;case va:case ma:case Ma:case ya:case Ia:n=this._rateMessageSent.getStatResult(e);break;case Ca:case Ta:case Da:n=this._rateMessageReceived.getStatResult(e)}return null===n?null:t(t({},s),n)}},{key:"_report",value:function(e){var t=this,n=[],o=null;it(e)?this._qualityItems.forEach((function(e){null!==(o=t._getQualityItem(e))&&(o.reportIndex=t.reportIndex,o.wholePeriod=t.wholePeriod,n.push(o))})):null!==(o=this._getQualityItem(e))&&(o.reportIndex=this.reportIndex,o.wholePeriod=this.wholePeriod,n.push(o)),Ve.d("".concat(this._n,"._report"),n),this._statInfoArr.length>0&&(n=n.concat(this._statInfoArr),this._statInfoArr=[]);var s=this.getModule(xn),a=s.getSDKAppID(),i=s.getTinyID();Ft(this.REPORT_SDKAPPID_BLACKLIST,a)&&!qt(this.REPORT_TINYID_WHITELIST,i)&&(n=[]),n.length>0&&this._doReport(n)}},{key:"_doReport",value:function(e){var n=this,o={header:or(this),quality:e};this.request({protocolName:Bs,requestData:t({},o)}).then((function(){n.reportIndex++,n.wholePeriod=!1})).catch((function(t){Ve.w("".concat(n._n,"._doReport, online:").concat(n.getNetworkType()," error:"),t),n._statInfoArr=n._statInfoArr.concat(e),n._flushAtOnce()}))}},{key:"_flushAtOnce",value:function(){var e=this.getModule(Vn),t=e.getItem(this.TAG,!1),n=this._statInfoArr,o="".concat(this._n,"._flushAtOnce");if(zt(t))Ve.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var s=n.concat(t);s.length>10&&(s=s.slice(0,10)),Ve.l("".concat(o," count:").concat(s.length)),e.setItem(this.TAG,s,!0,!1)}this._statInfoArr=[]}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._report(),this.reportIndex=0,this.wholePeriod=!1,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._avgRTT.reset(),this._avgE2EDelay.reset(),this._rateMessageSent.reset(),this._rateMessageReceived.reset()}}]),s}(uo),ou=function(e){r(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="WorkerTimerModule",s._isWorkerEnabled=!0,s._workerTimer=null,s._timerID=-1,s._init(),s.getInnerEmitterInstance().on(ti,s._onCloudConfigUpdated,h(s)),s}return a(n,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&Se}},{key:"startWorkerTimer",value:function(){Ve.l("".concat(this._n,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){Ve.l("".concat(this._n,".stopWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("stop")}},{key:"_init",value:function(){if(Se){var e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(""); }, 1000); postMessage(interval); } else if (event.data === "stop") { clearInterval(interval); interval = -1; }};'],{type:"application/javascript; charset=utf-8"}));this._workerTimer=new Worker(e);var t=this;this._workerTimer.onmessage=function(e){e.data?(t._timerID=e.data,Ve.l("".concat(t._n,"._init seed:").concat(t._timerID))):t._m.onCheckTimer()}}}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("enable_worker");Ve.l("".concat(this._n,"._onCloudConfigUpdated enableWorker:").concat(e)),it(e)||"1"===e?!this._isWorkerEnabled&&Se&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&Se&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:"terminate",value:function(){Ve.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(){Ve.l("".concat(this._n,".reset"))}}]),n}(uo),su=function(){function e(){o(this,e),this._n="PurchasedFeatureHandler",this._purchasedFeatureMap=new Map}return a(e,[{key:"isValidPurchaseBits",value:function(e){return e&&"string"==typeof e&&e.length>=1&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){if(this.isValidPurchaseBits(e)){this._purchasedFeatureMap.clear();for(var t=null,n=e.length-1,o=0;n>=0;n--,o++)t=o<32?new L(0,Math.pow(2,o)).toString():new L(Math.pow(2,o-32),0).toString(),"1"===e[n]?this._purchasedFeatureMap.set(t,!0):this._purchasedFeatureMap.set(t,!1)}else Ve.w("".concat(this._n,".parsePurchaseBits invalid purchasebits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._purchasedFeatureMap.get(e)}},{key:"isFeatureEnabled",value:function(e){for(var t=parseInt(e).toString(2),n=void 0,o=!0,s=t.length-1,a=0;s>=0;s--,a++)if("1"===t.charAt(s)&&(n=a<32?new L(0,Math.pow(2,a)).toString():new L(Math.pow(2,a-32),0).toString(),!this._purchasedFeatureMap.get(n))){o=!1;break}return Ve.l("".concat(this._n,".isFeatureEnabled decimalNumber:").concat(e," binaryString:").concat(t," ret:").concat(o)),Xa({enabled:o})}},{key:"clear",value:function(){this._purchasedFeatureMap.clear()}}]),e}(),au=function(){function e(t){o(this,e),this._m=t,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new su}return a(e,[{key:"_canFetch",value:function(){return this._getModule(xn).isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetch(),n="".concat(this._n,".fetchConfig");if(Ve.l("".concat(n," canFetch:").concat(t)),t){var o=this._getModule(Hn),s=new Aa("fetchCommercialConfig");s.setNetworkType(o.getNetworkType());var a=this._getModule(xn).getSDKAppID(),i=this._getModule(zn);this._isFetching=!0,i.request({protocolName:Qs,requestData:{SDKAppID:a}}).then((function(t){s.setMessage("purchaseBits:".concat(t.data.purchaseBits)).end(),Ve.l("".concat(n," ok.")),e._parseConfig(t.data),e._isFetching=!1})).catch((function(t){o.probe().then((function(e){var n=v(e,2),o=n[0],a=n[1];s.setError(t,o,a).end()})),e._isFetching=!1}))}}},{key:"onPushedConfig",value:function(e){var t="".concat(this._n,".onPushedConfig data:").concat(JSON.stringify(e));Ve.l("".concat(t)),new Aa("pushedCommercialConfig").setNetworkType(this._getModule(Hn).getNetworkType()).setMessage("purchaseBits:".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:"_parseConfig",value:function(e){var t="".concat(this._n,"._parseConfig"),n=e.errorCode,o=e.errorMessage,s=e.purchaseBits,a=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(s),this._expiredTime=Date.now()+1e3*a):it(n)?(Ve.l("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(Ve.e("".concat(t," errorCode:").concat(n," errorMessage:").concat(o)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"canIUse",value:function(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}},{key:"isFeatureEnabled",value:function(e){return this._purchasedFeatureHandler.isFeatureEnabled(e)}},{key:"_getModule",value:function(e){return this._m.getModule(e)}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),e}(),iu=function(e){r(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._m=e,s._n="OfflinePushModule",s._offlinePushPlugin=void 0,s._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:"",honorPushBussinessId:""},s._deviceToken="",s._businessID=0,s._iosBusinessID=0,s._c2cUnreadCount=0,s._groupUnreadCount=0,s._isWebUniapp=0,s}return a(n,[{key:"registerPlugin",value:function(e){if(oe){this._offlinePushPlugin=e["tim-offline-push-plugin"];var t=e.offlinePushConfig||{},n=t.huaweiBusinessID,o=t.xiaomiBusinessID,s=t.xiaomiAppID,a=t.xiaomiAppKey,i=t.meizuBusinessID,r=t.meizuAppID,u=t.meizuAppKey,c=t.vivoBusinessID,l=t.oppoBusinessID,d=t.oppoAppKey,p=t.oppoAppSecret,g=t.honorBusinessID,h=t.iosBusinessID;this._androidPushConfig.huaweiPushBussinessId=n,this._androidPushConfig.xiaomiPushBussinessId=o,this._androidPushConfig.xiaomiPushAppId=s,this._androidPushConfig.xiaomiPushAppKey=a,this._androidPushConfig.meizuPushBussinessId=i,this._androidPushConfig.meizuPushAppId=r,this._androidPushConfig.meizuPushAppKey=u,this._androidPushConfig.vivoPushBussinessId=c,this._androidPushConfig.oppoPushBussinessId=l,this._androidPushConfig.oppoPushAppKey=d,this._androidPushConfig.oppoPushAppSecret=p,this._androidPushConfig.honorPushBussinessId=g,new Aa("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!it(this._offlinePushPlugin))).end(!0),Ve.l("".concat(this._n,".").concat("registerPlugin"," ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=h,this._setAppShowListener()}else this.outputWarning("OfflinePushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:"_getDeviceToken",value:function(){var e=this,t="".concat(this._n,".").concat("_getDeviceToken");if(ut(this._offlinePushPlugin.getDeviceToken)){var n="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID);Ve.l("".concat(t," start. ").concat(n)),new Aa("_getDeviceToken").setMessage("".concat(n)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,(function(o){var s=new Aa("getDeviceTokenRes"),a=o.code,i=o.msg;if(0===a){var r=o.data,u=r.deviceToken,c=r.deviceBrand,l=r.deviceType,d=r.bussinessId;e._deviceToken=u,e._businessID=d||e._iosBusinessID,n="deviceToken:".concat(u,", deviceBrand:").concat(c||l,", businessID:").concat(e._businessID),Ve.l("".concat(t," ok. ").concat(n)),s.setMessage(n).end(!0),e._setToken()}else s.setMessage("code:".concat(a,", msg:").concat(i)).end(!0),Ve.e("".concat(t," failed. error:"),o)}))}else Ve.e("".concat(t," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return oe&&!it(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var e=this,t="".concat(this._n,".").concat("_setAppShowListener");it(this._offlinePushPlugin)?Ve.e("".concat(t," offlinePushPlugin is undefined")):ut(this._offlinePushPlugin.setAppShowListener)?(new Aa("_setAppShowListener").end(!0),Ve.l("".concat(t," start")),this._offlinePushPlugin.setAppShowListener((function(n){var o=(n||{}).appShow;new Aa("setAppShowListenerRes").setMessage("appShow:".concat(o)).end(!0),Ve.l("".concat(t," ok. appShow:").concat(o)),e._m.isReady()&&(0===o?(e._getConvUnreadCount(),e._onBackground()):1===o&&e._onForeground())}))):Ve.e("".concat(t," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){if(!it(this._offlinePushPlugin)&&ut(this._offlinePushPlugin.getDeviceType)){var e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType;return Ve.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}}},{key:"_setToken",value:function(){var e,t=this,n="".concat(this._n,"._setToken"),o=this.getModule(xn),s=1,a="",i="";zt(this._deviceToken)&&(s=0);var r=this.getUniAppPlatform(),u=this.getDeviceBrand();r===R.IOS||r===R.IPAD||r===R.MAC?i=this._deviceToken:r===R.ANDROID&&(a=this._deviceToken);var c=new Aa("offlinePushSetToken");return e="deviceToken:".concat(i||a,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(u,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(s,", platform:").concat(r),c.setMessage("".concat(e)),Ve.l("".concat(n," ").concat(e)),this.request({protocolName:da,requestData:{tokenID:a,pushMsg:s,sdkAppID:o.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:u,deviceToken:i,isWebUniapp:this._isWebUniapp}}).then((function(e){return c.end(),Ve.l("".concat(n," ok")),e})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),Za(e)}))}},{key:"_getConvUnreadCount",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.getModule(qn).getLocalConversationList().forEach((function(t){t.type===E.CONV_C2C&&(e._c2cUnreadCount+=t.unreadCount),t.type===E.CONV_GROUP&&(e._groupUnreadCount+=t.unreadCount)}))}},{key:"_onBackground",value:function(){var e=this,t="".concat(this._n,".").concat("_onBackground"),n=new Aa("_onBackground");this.request({protocolName:ca,requestData:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then((function(o){return n.setMessage("c2cUnreadCount: ".concat(e._c2cUnreadCount,", groupUnreadCount: ").concat(e._groupUnreadCount)).end(),Ve.l("".concat(t," ok")),o})).catch((function(o){e.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];n.setError(o,s,a).end()})),Ve.e("".concat(t," failed. error:"),o)}))}},{key:"_onForeground",value:function(){var e=this,t="".concat(this._n,".").concat("_onForeground"),n=new Aa("_onForeground");this.request({protocolName:la,requestData:{isWebUniapp:this._isWebUniapp}}).then((function(e){return n.end(),Ve.l("".concat(t," ok")),e})).catch((function(o){e.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];n.setError(o,s,a).end()})),Ve.e("".concat(t," failed. error:"),o)}))}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?R.IOS:"android"===e?R.ANDROID:1002===t?R.IPAD:1001===t?R.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,Ve.l("".concat(this._n,".reset"))}}]),n}(uo),ru=function(e){r(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="ProfanityFilterModule",s._plugin=null,s._filterConfigMap=new Map,s._startIndex=0,s._version=0,s._canIUseLexicon=!1,s._isFetching=!1,s._expiredTime=0,s}return a(n,[{key:"init",value:function(){var e=this.getModule(Yn).getPlugin("tim-profanity-filter-plugin");e?(this._plugin=new e({logger:Ve,isArray:at,isMap:Qe,isDevMode:this.isDevMode()}),this._getLexicon()):this.outputWarning("ProfanityPluginNotFound")}},{key:"onCheckTimer",value:function(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}},{key:"filterMessage",value:function(e,t){var n=!0;if(!this._plugin||!this._canIUseLexicon)return n;if(t&&t.messageControlInfo&&!0===t.messageControlInfo.excludedFromContentModeration)return n;var o=e.type,s=e.conversationType;if(o!==E.MSG_TEXT&&o!==E.MSG_CUSTOM)return n;var a,i="".concat(this._n,".filterMessage");if(Ve.l("".concat(i)),o===E.MSG_TEXT){if(s===E.CONV_C2C?a=H:s===E.CONV_GROUP&&(a=W),!this._isConfigOn(a))return n;var r=this._plugin.filter(e.payload.text),u=r.type,c=r.modifiedText;1===u?n=!1:2===u&&(e.payload.text=c)}else if(o===E.MSG_CUSTOM){if(s===E.CONV_C2C?a=K:s===E.CONV_GROUP&&(a=Y),!this._isConfigOn(a))return n;var l=this._plugin.filter(e.payload.data),d=this._plugin.filter(e.payload.description),p=this._plugin.filter(e.payload.extension);1===l.type||1===d.type||1===p.type?n=!1:(2===l.type&&(e.payload.data=l.modifiedText),2===d.type&&(e.payload.description=d.modifiedText),2===p.type&&(e.payload.extension=p.modifiedText))}return Ve.l("".concat(i," done. isAllowedToSend:").concat(n)),n}},{key:"filterText",value:function(e,t){var n="".concat(this._n,".filterText"),o={isAllowedToSend:!0,modifiedText:e};if(!this._plugin||!this._canIUseLexicon)return o;if(!this._isConfigOn(t))return o;Ve.l("".concat(n));var s=this._plugin.filter(e),a=s.type,i=s.modifiedText;return 1===a?o.isAllowedToSend=!1:2===a&&(o.modifiedText=i),Ve.l("".concat(n," done. ret:"),o),o}},{key:"_getLexicon",value:function(){var e=this,t=new Aa("profanityFilter"),n="".concat(this._n,"._getLexicon");this._isFetching=!0,this.request({protocolName:pa,requestData:{startIndex:this._startIndex,version:this._version}}).then((function(o){var s=o.data,a=s.errorInfo,i=s.filterConfig,r=s.lexicon,u=s.strToken,c=s.completeFlag,l=s.nextStartIndex,d=s.version,p=s.expiredTime,g=a.errorCode,h=a.errorMessage;return 0!==g?(e._isFetching=!1,Ve.w("".concat(n," failed. error:"),a),void t.setCode(g).setMessage(h).end()):(e._onFilterConfig(i),e._getToken(u),1===c?(Ve.l("".concat(n," done. version:").concat(d," expiredTime:").concat(p)),e._version=d,e._canIUseLexicon=!0,e._isFetching=!1,e._expiredTime=Date.now()+1e3*p,void e._plugin.onLexiconCompleted(r)):(e._startIndex=l,e._plugin.onLexiconSliced(r),void e._getLexicon()))})).catch((function(o){e.probeNetwork().then((function(e){var n=v(e,2),s=n[0],a=n[1];t.setError(o,s,a).end()})),e._isFetching=!1,Ve.l("".concat(n," failed. error:"),o)}))}},{key:"_onFilterConfig",value:function(e){var t=this;zt(e)||(this._filterConfigMap.clear(),Object.keys(e).forEach((function(n){t._filterConfigMap.set(n,e[n])})),Ve.l("".concat(this._n,"._onFilterConfig. keys:").concat(Array.from(this._filterConfigMap.keys())," values:").concat(Array.from(this._filterConfigMap.values()))))}},{key:"_isConfigOn",value:function(e){return 1===this._filterConfigMap.get(e)}},{key:"_getToken",value:function(e){if(nt(e)){var t=e.length,n="";if(t%2==0)for(var o=0;o<=t-1;o+=2)n+=e[o+1],n+=e[o];else{for(var s=0;s=this.STORAGE_EXPIRES_TIME,s=!n||"2.27.6"!==n;return Ve.l("".concat(this._n,"._needToUpdate isTimeout:").concat(o," isDifferentVersion:").concat(s)),o||s}},{key:"_fetch",value:function(){if(!this._m.getModule(xn).isPrivateNetWork()){var e="https://web.sdk.qcloud.com/im/download/error-message/0.0.1/tim-error-message.txt",t="application/x-www-form-urlencoded;charset=UTF-8",n="".concat(this._n,"._fetch ok in"),o=this;if(ae)re.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:function(e){o._fillAndSave(e.data),Ve.l("".concat(n," mini program"))},fail:function(){}});else{var s=new XMLHttpRequest,a=setTimeout((function(){s.abort()}),3e3);s.onreadystatechange=function(){4===s.readyState&&(clearTimeout(a),200!==s.status&&304!==s.status||(Ve.l("".concat(n," browser")),o._fillAndSave(s.responseText)))},s.open("GET",e,!0),s.setRequestHeader("Content-type",t),s.send()}}}},{key:"_fillAndSave",value:function(e){this._fillMap(e),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:e,localSavedTime:(new Date).getTime(),localSavedVersion:"2.27.6"}),!0,!1)}},{key:"_getStorageModule",value:function(){return this._m.getModule(Vn)}},{key:"_fillMap",value:function(e){this._map.clear();for(var t,n,o,s=e.split(";\n"),a=s.length,i=new RegExp(/'/g),r=0;r>>16&65535|0,i=0;0!==n;){n-=i=n>2e3?2e3:n;do{a=a+(s=s+t[o++]|0)|0}while(--i);s%=65521,a%=65521}return s|a<<16|0};var pu=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var o=0;o<8;o++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();var gu=function(e,t,n,o){var s=pu,a=o+n;e^=-1;for(var i=o;i>>8^s[255&(e^t[i])];return-1^e},hu=function(e,t){var n,o,s,a,i,r,u,c,l,d,p,g,h,_,f,v,m,M,y,I,C,T,D,k,E;n=e.state,o=e.next_in,k=e.input,s=o+(e.avail_in-5),a=e.next_out,E=e.output,i=a-(t-e.avail_out),r=a+(e.avail_out-257),u=n.dmax,c=n.wsize,l=n.whave,d=n.wnext,p=n.window,g=n.hold,h=n.bits,_=n.lencode,f=n.distcode,v=(1<>>=y=M>>>24,h-=y,0===(y=M>>>16&255))E[a++]=65535&M;else{if(!(16&y)){if(0==(64&y)){M=_[(65535&M)+(g&(1<>>=y,h-=y),h<15&&(g+=k[o++]<>>=y=M>>>24,h-=y,!(16&(y=M>>>16&255))){if(0==(64&y)){M=f[(65535&M)+(g&(1<u){e.msg="invalid distance too far back",n.mode=30;break e}if(g>>>=y,h-=y,C>(y=a-i)){if((y=C-y)>l&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(T=0,D=p,0===d){if(T+=c-y,y2;)E[a++]=D[T++],E[a++]=D[T++],E[a++]=D[T++],I-=3;I&&(E[a++]=D[T++],I>1&&(E[a++]=D[T++]))}else{T=a-C;do{E[a++]=E[T++],E[a++]=E[T++],E[a++]=E[T++],I-=3}while(I>2);I&&(E[a++]=E[T++],I>1&&(E[a++]=E[T++]))}break}}break}}while(o>3,g&=(1<<(h-=I<<3))-1,e.next_in=o,e.next_out=a,e.avail_in=o=1&&0===R[I];I--);if(C>I&&(C=I),0===I)return s[a++]=20971520,s[a++]=20971520,r.bits=1,0;for(y=1;y0&&(0===e||1!==I))return-1;for(N[1]=0,m=1;m<15;m++)N[m+1]=N[m]+R[m];for(M=0;M852||2===e&&E>592)return 1;for(;;){h=m-D,i[M]g?(_=O[G+i[M]],f=L[A+i[M]]):(_=96,f=0),u=1<>D)+(c-=u)]=h<<24|_<<16|f|0}while(0!==c);for(u=1<>=1;if(0!==u?(S&=u-1,S+=u):S=0,M++,0==--R[m]){if(m===I)break;m=t[n+i[M]]}if(m>C&&(S&d)!==l){for(0===D&&(D=C),p+=y,k=1<<(T=m-D);T+D852||2===e&&E>592)return 1;s[l=S&d]=C<<24|T<<16|p-a|0}}return 0!==S&&(s[p+S]=m-D<<24|64<<16|0),r.bits=C,0};function yu(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function Iu(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new lu.Buf16(320),this.work=new lu.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Cu(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new lu.Buf32(852),t.distcode=t.distdyn=new lu.Buf32(592),t.sane=1,t.back=-1,0):-2}function Tu(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,Cu(e)):-2}function Du(e,t){var n,o;return e&&e.state?(o=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==o.window&&o.wbits!==t&&(o.window=null),o.wrap=n,o.wbits=t,Tu(e))):-2}function ku(e,t){var n,o;return e?(o=new Iu,e.state=o,o.window=null,0!==(n=Du(e,t))&&(e.state=null),n):-2}var Eu,Su,Lu=!0;function Au(e){if(Lu){var t;for(Eu=new lu.Buf32(512),Su=new lu.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Mu(1,e.lens,0,288,Eu,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Mu(2,e.lens,0,32,Su,0,e.work,{bits:5}),Lu=!1}e.lencode=Eu,e.lenbits=9,e.distcode=Su,e.distbits=5}function Ru(e,t,n,o){var s,a=e.state;return null===a.window&&(a.wsize=1<=a.wsize?(lu.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((s=a.wsize-a.wnext)>o&&(s=o),lu.arraySet(a.window,t,n-o,s,a.wnext),(o-=s)?(lu.arraySet(a.window,t,n-o,o,0),a.wnext=o,a.whave=a.wsize):(a.wnext+=s,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,n.check=gu(n.check,S,2,0),c=0,l=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&c)){e.msg="unknown compression method",n.mode=30;break}if(l-=4,C=8+(15&(c>>>=4)),0===n.wbits)n.wbits=C;else if(C>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(S[0]=255&c,S[1]=c>>>8&255,n.check=gu(n.check,S,2,0)),c=0,l=0,n.mode=3;case 3:for(;l<32;){if(0===r)break e;r--,c+=o[a++]<>>8&255,S[2]=c>>>16&255,S[3]=c>>>24&255,n.check=gu(n.check,S,4,0)),c=0,l=0,n.mode=4;case 4:for(;l<16;){if(0===r)break e;r--,c+=o[a++]<>8),512&n.flags&&(S[0]=255&c,S[1]=c>>>8&255,n.check=gu(n.check,S,2,0)),c=0,l=0,n.mode=5;case 5:if(1024&n.flags){for(;l<16;){if(0===r)break e;r--,c+=o[a++]<>>8&255,n.check=gu(n.check,S,2,0)),c=0,l=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((g=n.length)>r&&(g=r),g&&(n.head&&(C=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),lu.arraySet(n.head.extra,o,a,g,C)),512&n.flags&&(n.check=gu(n.check,o,g,a)),r-=g,a+=g,n.length-=g),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===r)break e;g=0;do{C=o[a+g++],n.head&&C&&n.length<65536&&(n.head.name+=String.fromCharCode(C))}while(C&&g>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;l<32;){if(0===r)break e;r--,c+=o[a++]<>>=7&l,l-=7&l,n.mode=27;break}for(;l<3;){if(0===r)break e;r--,c+=o[a++]<>>=1)){case 0:n.mode=14;break;case 1:if(Au(n),n.mode=20,6===t){c>>>=2,l-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}c>>>=2,l-=2;break;case 14:for(c>>>=7&l,l-=7&l;l<32;){if(0===r)break e;r--,c+=o[a++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&c,c=0,l=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(g=n.length){if(g>r&&(g=r),g>u&&(g=u),0===g)break e;lu.arraySet(s,o,a,g,i),r-=g,a+=g,u-=g,i+=g,n.length-=g;break}n.mode=12;break;case 17:for(;l<14;){if(0===r)break e;r--,c+=o[a++]<>>=5,l-=5,n.ndist=1+(31&c),c>>>=5,l-=5,n.ncode=4+(15&c),c>>>=4,l-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have>>=3,l-=3}for(;n.have<19;)n.lens[L[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,D={bits:n.lenbits},T=Mu(0,n.lens,0,19,n.lencode,0,n.work,D),n.lenbits=D.bits,T){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,m=65535&E,!((f=E>>>24)<=l);){if(0===r)break e;r--,c+=o[a++]<>>=f,l-=f,n.lens[n.have++]=m;else{if(16===m){for(k=f+2;l>>=f,l-=f,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}C=n.lens[n.have-1],g=3+(3&c),c>>>=2,l-=2}else if(17===m){for(k=f+3;l>>=f)),c>>>=3,l-=3}else{for(k=f+7;l>>=f)),c>>>=7,l-=7}if(n.have+g>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;g--;)n.lens[n.have++]=C}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,D={bits:n.lenbits},T=Mu(1,n.lens,0,n.nlen,n.lencode,0,n.work,D),n.lenbits=D.bits,T){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,D={bits:n.distbits},T=Mu(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,D),n.distbits=D.bits,T){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(r>=6&&u>=258){e.next_out=i,e.avail_out=u,e.next_in=a,e.avail_in=r,n.hold=c,n.bits=l,hu(e,p),i=e.next_out,s=e.output,u=e.avail_out,a=e.next_in,o=e.input,r=e.avail_in,c=n.hold,l=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;v=(E=n.lencode[c&(1<>>16&255,m=65535&E,!((f=E>>>24)<=l);){if(0===r)break e;r--,c+=o[a++]<>M)])>>>16&255,m=65535&E,!(M+(f=E>>>24)<=l);){if(0===r)break e;r--,c+=o[a++]<>>=M,l-=M,n.back+=M}if(c>>>=f,l-=f,n.back+=f,n.length=m,0===v){n.mode=26;break}if(32&v){n.back=-1,n.mode=12;break}if(64&v){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&v,n.mode=22;case 22:if(n.extra){for(k=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;v=(E=n.distcode[c&(1<>>16&255,m=65535&E,!((f=E>>>24)<=l);){if(0===r)break e;r--,c+=o[a++]<>M)])>>>16&255,m=65535&E,!(M+(f=E>>>24)<=l);){if(0===r)break e;r--,c+=o[a++]<>>=M,l-=M,n.back+=M}if(c>>>=f,l-=f,n.back+=f,64&v){e.msg="invalid distance code",n.mode=30;break}n.offset=m,n.extra=15&v,n.mode=24;case 24:if(n.extra){for(k=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===u)break e;if(g=p-u,n.offset>g){if((g=n.offset-g)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}g>n.wnext?(g-=n.wnext,h=n.wsize-g):h=n.wnext-g,g>n.length&&(g=n.length),_=n.window}else _=s,h=i-n.offset,g=n.length;g>u&&(g=u),u-=g,n.length-=g;do{s[i++]=_[h++]}while(--g);0===n.length&&(n.mode=21);break;case 26:if(0===u)break e;s[i++]=n.length,u--,n.mode=21;break;case 27:if(n.wrap){for(;l<32;){if(0===r)break e;r--,c|=o[a++]<=252?6:Pu>=248?5:Pu>=240?4:Pu>=224?3:Pu>=192?2:1;Uu[254]=Uu[254]=1;function bu(e,t){if(t<65534&&(e.subarray&&Gu||!e.subarray&&Ou))return String.fromCharCode.apply(null,lu.shrinkBuf(e,t));for(var n="",o=0;o>>6,t[a++]=128|63&n):n<65536?(t[a++]=224|n>>>12,t[a++]=128|n>>>6&63,t[a++]=128|63&n):(t[a++]=240|n>>>18,t[a++]=128|n>>>12&63,t[a++]=128|n>>>6&63,t[a++]=128|63&n);return t},Fu=function(e){for(var t=new lu.Buf8(e.length),n=0,o=t.length;n4)r[o++]=65533,n+=a-1;else{for(s&=2===a?31:3===a?15:7;a>1&&n1?r[o++]=65533:s<65536?r[o++]=s:(s-=65536,r[o++]=55296|s>>10&1023,r[o++]=56320|1023&s)}return bu(r,o)},xu=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+Uu[e[n]]>t?n:t},Vu={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},Bu={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"};var Hu=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};var Ku=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},Wu=Object.prototype.toString;function Yu(e){if(!(this instanceof Yu))return new Yu(e);this.options=lu.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Hu,this.strm.avail_out=0;var n=Nu.inflateInit2(this.strm,t.windowBits);if(n!==Vu.Z_OK)throw new Error(Bu[n]);if(this.header=new Ku,Nu.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=wu(t.dictionary):"[object ArrayBuffer]"===Wu.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Nu.inflateSetDictionary(this.strm,t.dictionary))!==Vu.Z_OK))throw new Error(Bu[n])}function ju(e,t){var n=new Yu(t);if(n.push(e,!0),n.err)throw n.msg||Bu[n.err];return n.result}Yu.prototype.push=function(e,t){var n,o,s,a,i,r=this.strm,u=this.options.chunkSize,c=this.options.dictionary,l=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?Vu.Z_FINISH:Vu.Z_NO_FLUSH,"string"==typeof e?r.input=Fu(e):"[object ArrayBuffer]"===Wu.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(0===r.avail_out&&(r.output=new lu.Buf8(u),r.next_out=0,r.avail_out=u),(n=Nu.inflate(r,Vu.Z_NO_FLUSH))===Vu.Z_NEED_DICT&&c&&(n=Nu.inflateSetDictionary(this.strm,c)),n===Vu.Z_BUF_ERROR&&!0===l&&(n=Vu.Z_OK,l=!1),n!==Vu.Z_STREAM_END&&n!==Vu.Z_OK)return this.onEnd(n),this.ended=!0,!1;r.next_out&&(0!==r.avail_out&&n!==Vu.Z_STREAM_END&&(0!==r.avail_in||o!==Vu.Z_FINISH&&o!==Vu.Z_SYNC_FLUSH)||("string"===this.options.to?(s=xu(r.output,r.next_out),a=r.next_out-s,i=qu(r.output,s),r.next_out=a,r.avail_out=u-a,a&&lu.arraySet(r.output,r.output,s,a,0),this.onData(i)):this.onData(lu.shrinkBuf(r.output,r.next_out)))),0===r.avail_in&&0===r.avail_out&&(l=!0)}while((r.avail_in>0||0===r.avail_out)&&n!==Vu.Z_STREAM_END);return n===Vu.Z_STREAM_END&&(o=Vu.Z_FINISH),o===Vu.Z_FINISH?(n=Nu.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Vu.Z_OK):o!==Vu.Z_SYNC_FLUSH||(this.onEnd(Vu.Z_OK),r.avail_out=0,!0)},Yu.prototype.onData=function(e){this.chunks.push(e)},Yu.prototype.onEnd=function(e){e===Vu.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=lu.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var zu={Inflate:Yu,inflate:ju,inflateRaw:function(e,t){return(t=t||{}).raw=!0,ju(e,t)},ungzip:ju},Ju={};(0,lu.assign)(Ju,zu,Vu);var Xu=Ju,Zu=function(){function e(t){o(this,e),this._m=t,this._n="InflateModule",this._bLogForInflateOK=!1,this._bLogForInflateError=!1}return a(e,[{key:"inflate",value:function(e){var t,n=new Uint8Array(e).slice(4),o=Date.now();try{t=Xu.inflate(n,{to:"string"}),this._bLogForInflateOK||(this._bLogForInflateOK=!0,new Aa("inflateOK").end())}catch(i){if(this._bLogForInflateError)return;return this._bLogForInflateError=!0,void new Aa("inflateError").setMessage(i).end()}var s=n.length+4,a=t.length;return Ve.d("inflate ok. zipped:".concat(s," unzipped:").concat(a)+" compression ratio:".concat(Math.round(100*(a-s)/a),"% cost:").concat(Date.now()-o)),t}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._bLogForInflateOK=!1,this._bLogForInflateError=!1}}]),e}(),Qu=function(){function e(t){o(this,e);var n=new Aa("sdkConstruct");this._n="ModuleManager",this._isReady=!1,this._reason=ha.USER_NOT_LOGGED_IN,this._startLoginTs=0,this._moduleMap=new Map,this._innerEmitter=null,this._outerEmitter=null,this._checkCount=0,this._checkTimer=-1,this._moduleMap.set(xn,new Qi(this,t)),this._moduleMap.set(ro,new Zu(this)),this._moduleMap.set(to,new au(this)),this._moduleMap.set(Zn,new Xr(this)),this._moduleMap.set(Qn,new ou(this)),this._moduleMap.set(eo,new nu(this)),this._moduleMap.set(Jn,new Vr(this)),this._moduleMap.set(zn,new zr(this)),this._moduleMap.set(Rn,new $i(this)),this._moduleMap.set(Nn,new Mr(this)),this._moduleMap.set(On,new yr(this)),this._moduleMap.set(ao,new Ir(this)),this._moduleMap.set(Gn,new Zi(this)),this._moduleMap.set(Un,new Qa(this)),this._moduleMap.set(qn,new Mi(this)),this._moduleMap.set(Pn,new qi(this)),this._moduleMap.set(wn,new Vi(this)),this._moduleMap.set(Fn,new Wi(this)),this._moduleMap.set(Vn,new tr(this)),this._moduleMap.set(io,new cu(this)),this._moduleMap.set(Bn,new sr(this)),this._moduleMap.set(Hn,new ur(this)),this._moduleMap.set(Kn,new dr(this)),this._moduleMap.set(Wn,new gr(this)),this._moduleMap.set(Yn,new Cr(this)),this._moduleMap.set(jn,new Tr(this)),this._moduleMap.set(Xn,new Jr(this)),this._moduleMap.set($n,new Zr(this)),this._moduleMap.set(no,new iu(this)),this._moduleMap.set(oo,new ru(this)),this._moduleMap.set(so,new uu(this)),this._eventThrottleMap=new Map;var s=t.instanceID,a=t.oversea,i=t.SDKAppID,r="instanceID:".concat(s," SDKAppID:").concat(i," host:").concat(Ot()," oversea:").concat(a," inBrowser:").concat(ie," inMiniApp:").concat(ae)+" canIUseInflate:".concat(this.canIUseInflate())+" workerAvailable:".concat(Se," UserAgent:").concat(ue);Aa.bindEventStatModule(this._moduleMap.get(Bn)),n.setMessage("".concat(r," ").concat(function(){var e="";if(ae)try{var t=re.getSystemInfoSync(),n=t.model,o=t.version,s=t.system,a=t.platform,i=t.SDKVersion;e="model:".concat(n," version:").concat(o," system:").concat(s," platform:").concat(a," SDKVersion:").concat(i)}catch(r){e=""}return e}())).end(),Ve.i("SDK ".concat(r)),ja.prototype._getErrorMessage=this.getErrorMessage.bind(this),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}return a(e,[{key:"_startTimer",value:function(){var e=this._moduleMap.get(Qn),t=e.isWorkerEnabled();Ve.l("".concat(this._n,".startTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.startWorkerTimer():this._startMainThreadTimer()}},{key:"_startMainThreadTimer",value:function(){this._checkTimer<0&&(this._checkTimer=setInterval(this.onCheckTimer.bind(this),1e3)),Ve.l("".concat(this._n,"._startMainThreadTimer seed:").concat(this._checkTimer))}},{key:"stopTimer",value:function(){var e=this._moduleMap.get(Qn),t=e.isWorkerEnabled();Ve.l("".concat(this._n,".stopTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.stopWorkerTimer():this._stopMainThreadTimer()}},{key:"_stopMainThreadTimer",value:function(){Ve.l("".concat(this._n,"._stopMainThreadTimer")),this._checkTimer>0&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){Ve.l("".concat(this._n,"._stopMainThreadSocket"));var e=this._moduleMap.get(Jn);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:"_startMainThreadSocket",value:function(){Ve.l("".concat(this._n,"._startMainThreadSocket"));var e=this._moduleMap.get(Jn);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){Ve.l("".concat(this._n,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){Ve.l("".concat(this._n,".onWorkerTimerDisabled, enable main thread timer and socket")),this._startMainThreadTimer(),this._startMainThreadSocket()}},{key:"onCheckTimer",value:function(){this._checkCount+=1;var e,t=D(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2)[1];n.onCheckTimer&&n.onCheckTimer(this._checkCount)}}catch(o){t.e(o)}finally{t.f()}}},{key:"_initReadyList",value:function(){var e=this;this._readyList=[this._moduleMap.get(Rn),this._moduleMap.get(qn)],this._readyList.forEach((function(t){t.ready((function(){return e._onModuleReady()}))}))}},{key:"_onModuleReady",value:function(){var e=!0;if(this._readyList.forEach((function(t){t.isReady()||(e=!1)})),e&&!this._isReady){this._isReady=!0,this._outerEmitter.emit(k.SDK_READY);var t=Date.now()-this._startLoginTs;Ve.w("SDK is ready. cost ".concat(t," ms")),this._startLoginTs=Date.now();var n=this._moduleMap.get(Hn).getNetworkType(),o=this._ssoLogForReady.getStartTs()+Ue;this._ssoLogForReady.setNetworkType(n).setMessage(t).start(o).end()}}},{key:"login",value:function(){0===this._startLoginTs&&(be(),this._startLoginTs=Date.now(),this._startTimer(),this._moduleMap.get(Hn).start(),this._ssoLogForReady=new Aa("sdkReady"),this._reason=ha.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOuterEmitterInstance",value:function(){return null===this._outerEmitter&&(this._outerEmitter=new lr,Ja(this._outerEmitter),this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(e,t){var n=this;if(e===k.CONVERSATION_LIST_UPDATED||e===k.FRIEND_LIST_UPDATED||e===k.GROUP_LIST_UPDATED||e===k.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)if(this._eventThrottleMap.has(e)){var o=Date.now(),s=this._eventThrottleMap.get(e);o-s.last<=1e3?(s.timeoutID&&clearTimeout(s.timeoutID),s.timeoutID=setTimeout((function(){s.last=Date.now(),n._outerEmitter._emit.apply(n._outerEmitter,[e,{name:e,data:n._getEventData(e)}])}),1e3)):(s.last=o,this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]))}else this._eventThrottleMap.set(e,{last:Date.now(),timeoutID:-1}),this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]);else this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:arguments[1]}])}.bind(this)),this._outerEmitter}},{key:"_getEventData",value:function(e){return e===k.CONVERSATION_LIST_UPDATED?this._moduleMap.get(qn).getLocalConversationList():e===k.FRIEND_LIST_UPDATED?this._moduleMap.get(bn).getLocalFriendList(!1):e===k.GROUP_LIST_UPDATED?this._moduleMap.get(Pn).getLocalGroupList():e===k.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._moduleMap.get(qn).getTotalUnreadMessageCount():void 0}},{key:"getInnerEmitterInstance",value:function(){return null===this._innerEmitter&&(this._innerEmitter=new lr,this._innerEmitter._emit=this._innerEmitter.emit,this._innerEmitter.emit=function(e,t){var n;n=st(arguments[1])&&arguments[1].data?[e,{name:arguments[0],data:arguments[1].data}]:[e,{name:arguments[0],data:arguments[1]}],this._innerEmitter._emit.apply(this._innerEmitter,n)}.bind(this)),this._innerEmitter}},{key:"hasModule",value:function(e){return this._moduleMap.has(e)}},{key:"getModule",value:function(e){return this._moduleMap.get(e)}},{key:"canIUseInflate",value:function(){return!!this._moduleMap.get(ro)}},{key:"isReady",value:function(){return this._isReady}},{key:"isIntl",value:function(){return this.getModule(xn).isIntl()}},{key:"getNotReadyReason",value:function(){return this._reason}},{key:"setNotReadyReason",value:function(e){this._reason=e}},{key:"getErrorMessage",value:function(e,t,n){return this._moduleMap.get(io).get({key:e,replacement1:t,replacement2:n,isIntl:this.isIntl()})}},{key:"outputWarning",value:function(e,t,n){var o=this.getErrorMessage(e,t,n);o&&Ve.w(o)}},{key:"onError",value:function(e){var t="code:".concat(e.code," message:").concat(e.message);Ve.w("Oops! ".concat(t)),new Aa("error").setMessage(t).setNetworkType(this.getModule(Hn).getNetworkType()).setLevel("error").end(),this.getOuterEmitterInstance().emit(k.ERROR,e)}},{key:"restartTimer",value:function(){Ve.l("".concat(this._n,".restartTimer")),this.stopTimer(),this._startTimer(),this.getModule(Pn).restartPolling()}},{key:"getTimerID",value:function(){var e=this._moduleMap.get(Qn);return e.isWorkerEnabled()?e.getTimerID():this._checkTimer}},{key:"getPollingTimerID",value:function(e){return this._moduleMap.get(Pn).getPollingTimerID(e)}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),be();var e,t=D(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2)[1];n.reset&&n.reset()}}catch(i){t.e(i)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._outerEmitter.emit(k.SDK_NOT_READY);var o,s=D(this._eventThrottleMap);try{for(s.s();!(o=s.n()).done;){var a=v(o.value,2)[1];a.timeoutID&&clearTimeout(a.timeoutID)}}catch(i){s.e(i)}finally{s.f()}this._eventThrottleMap.clear()}}]),e}(),$u=function(){function e(t){o(this,e),this._funcMap=new Map,this._m=t}return a(e,[{key:"defense",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if("string"!=typeof e)return null;if(0===e.length)return null;if("function"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);var o=null;return this._funcMap.get(e).has(t)?o=this._funcMap.get(e).get(t):(o=this._pack(e,t,n),this._funcMap.get(e).set(t,o)),o}},{key:"defenseOnce",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return"function"!=typeof t?null:this._pack(e,t,n)}},{key:"find",value:function(e,t){return"string"!=typeof e||0===e.length||"function"!=typeof t?null:this._funcMap.has(e)&&this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(this._m.outputWarning("ListenerFnNotFound",e),null)}},{key:"delete",value:function(e,t){return"function"==typeof t&&(!!this._funcMap.has(e)&&(!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),0===this._funcMap.get(e).size&&this._funcMap.delete(e),!0)))}},{key:"_pack",value:function(e,t,n){var o=this;return function(){try{t.apply(n,Array.from(arguments))}catch(u){var s=Object.values(k).indexOf(e),a="CallbackError";if(-1!==s){var i=Object.keys(k)[s];o._m.outputWarning(a,i,u)}var r=new Aa(a);r.setMessage("eventName:".concat(e)).setMoreMessage(u.message).end()}}}}]),e}(),ec=function(){function e(t){o(this,e);var n={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||"",oversea:t.oversea||!1,instanceID:Nt(),devMode:t.devMode||!1,proxyServer:t.proxyServer||void 0,fileUploadProxy:t.fileUploadProxy||void 0,fileDownloadProxy:t.fileDownloadProxy||t.fileUploadProxy||void 0};this._m=new Qu(n),this._safetyCallbackFactory=new $u(this._m)}return a(e,[{key:"onError",value:function(e){this._m.onError(e)}},{key:"login",value:function(e){return this._m.login(),this._getModule(Rn).login(e)}},{key:"logout",value:function(){var e=this;return this._getModule(Rn).logout().then((function(t){return e._m.reset(),t}))}},{key:"isReady",value:function(){return this._m.isReady()}},{key:"isIntl",value:function(){return this._m.isIntl()}},{key:"getNotReadyReason",value:function(){return this._m.getNotReadyReason()}},{key:"getErrorMessage",value:function(e,t,n){return this._m.getErrorMessage(e,t,n)}},{key:"_getModule",value:function(e){return this._m.getModule(e)}},{key:"destroy",value:function(){var e=this;return this.logout().finally((function(){e._m.stopTimer(),e._getModule(Qn).terminate(),e._getModule(Jn).dealloc();var t=e._m.getOuterEmitterInstance(),n=e._getModule(xn);t.emit(k.SDK_DESTROY,{SDKAppID:n.getSDKAppID()})}))}},{key:"on",value:function(e,t,n){Ve.d("on","eventName:".concat(e)),this._m.getOuterEmitterInstance().on(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"once",value:function(e,t,n){Ve.d("once","eventName:".concat(e)),this._m.getOuterEmitterInstance().once(e,this._safetyCallbackFactory.defenseOnce(e,t,n),n||this)}},{key:"off",value:function(e,t,n,o){Ve.d("off","eventName:".concat(e));var s=this._safetyCallbackFactory.find(e,t);null!==s&&(this._m.getOuterEmitterInstance().off(e,s,n,o),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){it(e["tim-offline-push-plugin"])?this._getModule(Yn).registerPlugin(e):this._getModule(no).registerPlugin(e)}},{key:"setLogLevel",value:function(e){if(e<=0){var t=this.getErrorMessage("TIM_ASCII_ART");t&&console.log(t);var n=this.getErrorMessage("API_REFER");if(n){Kt()?console.log("%c ".concat("IM SDK API ->"," %c"),"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",n):console.log("IM SDK API ->",n)}var o=this.getErrorMessage("DOCS_GUIDE");o&&console.log(o)}Ve.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._getModule(Nn).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._getModule(Nn).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._getModule(Nn).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._getModule(Nn).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._getModule(Nn).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._getModule(Nn).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._getModule(Nn).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._getModule(Nn).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._getModule(Nn).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._getModule(Nn).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==E.MSG_MERGER?Za({code:ha.MESSAGE_MERGER_TYPE_INVALID}):zt(e.payload.downloadKey)?Za({code:ha.MESSAGE_MERGER_KEY_INVALID}):this._getModule(Nn).downloadMergerMessage(e).catch((function(e){return Za({code:ha.MESSAGE_MERGER_DOWNLOAD_FAIL})}))}},{key:"createForwardMessage",value:function(e){return this._getModule(Nn).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof Wa?this._getModule(Nn).sendMessageInstance(e,t):Za({code:ha.MESSAGE_SEND_NEED_MESSAGE_INSTANCE})}},{key:"callExperimentalAPI",value:function(e,t){return"sendComboMessage"===e?this._getModule(ao).sendMessage(t):"handleGroupInvitation"===e?this._getModule(Pn).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._getModule(to).isFeatureEnabled(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e?this._getModule(so).sendTRTCCustomData(t):"getTimerID"===e?this._m.getTimerID():"getPollingTimerID"===e?this._m.getPollingTimerID(t):Za({code:ha.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._getModule(Nn).revokeMessage(e)}},{key:"resendMessage",value:function(e){return this._getModule(Nn).resendMessage(e)}},{key:"deleteMessage",value:function(e){return this._getModule(Nn).deleteMessage(e)}},{key:"translateText",value:function(e){return this._getModule(Nn).translateText(e)}},{key:"setMessageExtensions",value:function(e,t){return this._getModule(On).setMessageExtensions(e,t)}},{key:"getMessageExtensions",value:function(e){return this._getModule(On).getMessageExtensions(e)}},{key:"deleteMessageExtensions",value:function(e,t){return this._getModule(On).deleteMessageExtensions(e,t)}},{key:"modifyMessage",value:function(e){return this._getModule(Nn).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._getModule(qn).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._getModule(qn).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._getModule(qn).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._getModule(qn).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){return this._getModule(Pn).getReadReceiptDetail(e)}},{key:"findMessage",value:function(e){return this._getModule(qn).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._getModule(qn).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._getModule(qn).getConversationList(e)}},{key:"getConversationProfile",value:function(e){return this._getModule(qn).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._getModule(qn).deleteConversation(e)}},{key:"clearHistoryMessage",value:function(e){return this._getModule(qn).clearHistoryMessage(e)}},{key:"pinConversation",value:function(e){return this._getModule(qn).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._getModule(qn).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._getModule(qn).setMessageRemindType(e)}},{key:"getTotalUnreadMessageCount",value:function(){return this._getModule(qn).getTotalUnreadMessageCount()}},{key:"setConversationCustomData",value:function(e){return this._getModule(qn).setConversationCustomData(e)}},{key:"markConversation",value:function(e){return this._getModule(qn).markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._getModule(qn).getConversationGroupList()}},{key:"createConversationGroup",value:function(e){return this._getModule(qn).createConversationGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._getModule(qn).deleteConversationGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._getModule(qn).renameConversationGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._getModule(qn).addConversationsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._getModule(qn).deleteConversationsFromGroup(e)}},{key:"getMyProfile",value:function(){return this._getModule(Gn).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._getModule(Gn).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._getModule(Gn).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._getModule(Gn).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._getModule(Gn).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._getModule(Gn).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._getModule(Gn).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._getModule(Gn).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._getModule(Gn).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._getModule(Gn).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._getModule(bn);return e?e.getLocalFriendList():Za({code:ha.CANNOT_FIND_MODULE})}},{key:"addFriend",value:function(e){var t=this._getModule(bn);return t?t.addFriend(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._getModule(bn);return t?t.deleteFriend(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"checkFriend",value:function(e){var t=this._getModule(bn);return t?t.checkFriend(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._getModule(bn);return t?t.getFriendProfile(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"updateFriend",value:function(e){var t=this._getModule(bn);return t?t.updateFriend(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._getModule(bn);return e?e.getLocalFriendApplicationList():Za({code:ha.CANNOT_FIND_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._getModule(bn);return t?t.acceptFriendApplication(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._getModule(bn);return t?t.refuseFriendApplication(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._getModule(bn);return t?t.deleteFriendApplication(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._getModule(bn);return e?e.setFriendApplicationRead():Za({code:ha.CANNOT_FIND_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._getModule(bn);return e?e.getLocalFriendGroupList():Za({code:ha.CANNOT_FIND_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._getModule(bn);return t?t.createFriendGroup(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._getModule(bn);return t?t.deleteFriendGroup(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._getModule(bn);return t?t.addToFriendGroup(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._getModule(bn);return t?t.removeFromFriendGroup(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._getModule(bn);return t?t.renameFriendGroup(e):Za({code:ha.CANNOT_FIND_MODULE})}},{key:"getGroupList",value:function(e){return this._getModule(Pn).getGroupList(e)}},{key:"getGroupProfile",value:function(e){return this._getModule(Pn).getGroupProfile(e)}},{key:"createGroup",value:function(e){return this._getModule(Pn).createGroup(e)}},{key:"dismissGroup",value:function(e){return this._getModule(Pn).dismissGroup(e)}},{key:"updateGroupProfile",value:function(e){return this._getModule(Pn).updateGroupProfile(e)}},{key:"joinGroup",value:function(e){return this._getModule(Pn).joinGroup(e)}},{key:"quitGroup",value:function(e){return this._getModule(Pn).quitGroup(e)}},{key:"searchGroupByID",value:function(e){return this._getModule(Pn).searchGroupByID(e)}},{key:"getGroupOnlineMemberCount",value:function(e){return this._getModule(Pn).getGroupOnlineMemberCount(e)}},{key:"changeGroupOwner",value:function(e){return this._getModule(Pn).changeGroupOwner(e)}},{key:"getGroupApplicationList",value:function(){return this._getModule(Pn).getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){return this._getModule(Pn).handleGroupApplication(e)}},{key:"initGroupAttributes",value:function(e){return this._getModule(Pn).initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._getModule(Pn).setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._getModule(Pn).deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._getModule(Pn).getGroupAttributes(e)}},{key:"setGroupCounters",value:function(e){return this._getModule(Pn).setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._getModule(Pn).increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._getModule(Pn).decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._getModule(Pn).getGroupCounters(e)}},{key:"getGroupMemberList",value:function(e){return this._getModule(wn).getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this._getModule(wn).getGroupMemberProfile(e)}},{key:"addGroupMember",value:function(e){return this._getModule(wn).addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this._getModule(wn).deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this._getModule(wn).setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this._getModule(wn).setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this._getModule(wn).setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this._getModule(wn).setGroupMemberCustomField(e)}},{key:"markGroupMemberList",value:function(e){return this._getModule(wn).markGroupMemberList(e)}},{key:"getJoinedCommunityList",value:function(){return this._getModule(Fn).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._getModule(Fn).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._getModule(Fn).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._getModule(Fn).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._getModule(Fn).getTopicList(e)}}]),e}(),tc={login:1,logout:1,destroy:1,on:1,off:1,ready:1,setLogLevel:1,joinGroup:1,quitGroup:1,registerPlugin:1,getGroupOnlineMemberCount:1};function nc(e,t){if(e.isReady()||1===tc[t])return!0;var n=e.getNotReadyReason(),o={code:n,message:"".concat(e.getErrorMessage(n)," | ").concat(t," | ").concat(e.getErrorMessage(ha.SDK_IS_NOT_READY))};return e.onError(o),o}var oc={},sc={};return sc.create=function(e){var n=0,o=e.SDKAppID;if(et(o))n=o;else if(n=parseInt(o),isNaN(o))return Ve.e("".concat("TIM.create"," failed. Failed to parse the SDKAppID, please check the arguments")),null;if(n&&oc[n])return oc[n];Ve.l("".concat("TIM.create"));var s=new ec(t(t({},e),{},{SDKAppID:n}));s.on(k.SDK_DESTROY,(function(e){oc[e.data.SDKAppID]=null,delete oc[e.data.SDKAppID]}));var a=function(e){var t=Object.create(null);return Object.keys(An).forEach((function(n){if(e[n]){var o=new S;t[n]=function(){var t=Array.from(arguments);return o.use((function(t,o){var s=nc(e,n);return!0===s?o():Za(s)})).use((function(e,t){if(!0===Jt(e,Ln[n],n))return t()})).use((function(t,o){return e[n].apply(e,t)})),o.run(t)}}})),t}(s);return oc[n]=a,Ln.hookGetAPITips(s.getErrorMessage.bind(s)),Ve.l("".concat("TIM.create"," ok")),a},sc.TYPES=E,sc.EVENT=k,sc.VERSION="2.27.6",Ve.l("TIM.VERSION:".concat(sc.VERSION)),sc}));