UNPKG

@tencentcloud/lite-chat

Version:

Tencent Cloud Chat SDK for Web/Mini Program/uni-app/React Native/Donut

1 lines 211 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).TencentCloudChat=t()}(this,function(){class b{constructor(){this.listeners={}}on(e,t,s){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push({fn:t,context:s})}off(e,s,n){s&&(this.listeners[e]=null==(e=this.listeners[e])?void 0:e.filter(e=>{var t=e.fn===s,e=!n||e.context===n;return!(t&&e)}))}emit(e,...s){e=this.listeners[e];e&&e.forEach(e=>{var{fn:e,context:t}=e;e.apply(t,s)})}once(t,s,n){let i=(...e)=>{s.apply(n,e),this.off(t,i)};this.on(t,i)}}let k={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19,NS_NATIVE_APP:20,RN_NATIVE_APP:21},U=["heartbeat.alive","im_open_status.wslogin","im_open_status.wslogout","group_open_long_polling_http_svc.get_msg","group_open_long_polling_http_noauth_svc.get_msg"];var B;(e=B=B||{})[e.CONV_DELETED=1]="CONV_DELETED",e[e.CONV_PINED=2]="CONV_PINED",e[e.CONV_UNPINED=3]="CONV_UNPINED",e[e.CONV_MARK_UPDATED=4]="CONV_MARK_UPDATED",e[e.CONV_GROUP_ADDED=5]="CONV_GROUP_ADDED",e[e.CONV_GROUP_DELETED=6]="CONV_GROUP_DELETED",e[e.CONV_GROUP_UPDATED=7]="CONV_GROUP_UPDATED";var n,x,V,e=Object.freeze({__proto__:null,get ConvModifyPushType(){return B},ENUM_PLATFORM:k,IS_TOPIC_MESSAGE:2,NOT_NEED_CRC_SERVCMD:U});function q(e){let t,s=[];return null!=(t=null==e?void 0:e.GroupTips)&&t.forEach(e=>{2===e.GroupInfo.MillionGroupFlag?s.push(n.TOPIC_TIPS_NOTIFICATION):s.push(n.GROUP_TIPS_NOTIFICATION)}),s}(t=n=n||{}).BUSINESS_COMMAND="business_command",t.C2C_REALTIME_MESSAGE="c2c_realtime_message",t.C2C_MESSAGE_MODIFIED="c2c_message_modified",t.C2C_REVOKED_MESSAGE="c2c_message_revoked",t.GROUP_REALTIME_MESSAGE="group_realtime_message",t.GROUP_MESSAGE_MODIFIED="group_message_modified",t.GROUP_MESSAGE_REVOKED="group_message_revoked",t.C2C_MESSAGE_READ_RECEIPT="c2c_message_read_receipt",t.MESSAGE_REACTION_UPDATED="message_reaction_updated",t.MESSAGE_REACTION_UPDATED_SYNC="message_reaction_updated_sync",t.GROUP_AT_TIPS="group_at_tips",t.USER_STATUS_UPDATE="user_status_update",t.FRIEND_LIST_MODIFIED="friend_list_modified",t.PROFILE_MODIFIED="profile_modified",t.CONV_MODIFIED="conversation_modified",t.GROUP_TIPS_NOTIFICATION="group_tips_notification",t.GROUP_MESSAGE_READ_RECEIPT="group_message_read_receipt",t.GROUP_MESSAGE_READ_SYNC="group_message_read_sync",t.GROUP_SYSTEM_NOTIFICATION="group_system_notification",t.C2C_MESSAGE_PEER_READ="c2c_message_peer_read",t.C2C_MESSAGE_READ_SYNC="c2c_message_read_sync",t.C2C_REMIND_TYPE_SYNC="c2c_remind_type_sync",t.FOLLOW_LIST_UPDATED="follow_list_updated",t.MESSAGE_EXTENSIONS_UPDATED="message_extensions_updated",t.ALL_MESSAGE_READ="all_message_read",t.CONVERSATION_MARK_UPDATED="conversation_mark_updated",t.CONVERSATION_GROUP_ADD="conversation_group_add",t.CONVERSATION_GROUP_DELETED="conversation_group_deleted",t.CONVERSATION_GROUP_UPDATED="conversation_group_updated",t.ALL_RECEIVE_MESSAGE_OPTION="all_receive_message_option",t.TOPIC_AT_TIPS="topic_at_tips",t.TOPIC_TIPS_NOTIFICATION="topic_tips_notification",t.TOPIC_SYSTEM_NOTIFICATION="topic_system_notification",t.TOPIC_MESSAGE_READ_SYNC="topic_message_read_sync",t.TOPIC_LATEST_MESSAGE="topic_latest_message";let Y=[{conditions:[{type:"event",value:100}],subType:n.BUSINESS_COMMAND},{conditions:[{type:"event",value:24}],subType:n.ALL_RECEIVE_MESSAGE_OPTION},{conditions:[{type:"event",value:26}],subType:n.TOPIC_LATEST_MESSAGE},{conditions:[{type:"hasKey",value:"C2cMsgArray"}],subType:n.C2C_REALTIME_MESSAGE},{conditions:[{type:"hasKey",value:"C2cMsgModNotifys"}],subType:n.C2C_MESSAGE_MODIFIED},{conditions:[{type:"hasKey",value:"ProfileDataMod"}],subType:n.PROFILE_MODIFIED},{conditions:[{type:"hasKey",value:"UserStatusList"}],subType:n.USER_STATUS_UPDATE},{conditions:[{type:"hasKey",value:"FriendListMod"}],subType:n.FRIEND_LIST_MODIFIED},{conditions:[{type:"hasKey",value:"GroupMsgArray"}],subType:n.GROUP_REALTIME_MESSAGE},{conditions:[{type:"hasKey",value:"GroupMsgModNotifys"}],subType:n.GROUP_MESSAGE_MODIFIED},{conditions:[{type:"hasKey",value:"C2cNotifyMsgArray"}],subTypeParser:function(e){let t,s=[];return null!=(t=null==e?void 0:e.C2cNotifyMsgArray)&&t.forEach(e=>{e.WithdrawC2cMsgNotify&&s.push(n.C2C_REVOKED_MESSAGE),e.C2cReadedReceipt&&s.push(n.C2C_MESSAGE_PEER_READ),e.ReadC2cMsgNotify&&s.push(n.C2C_MESSAGE_READ_SYNC),e.MuteNotificationsSync&&s.push(n.C2C_REMIND_TYPE_SYNC)}),s}},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:4}],subTypeParser:q},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:5}],subTypeParser:function(e){let t,s=[];return null!=(t=null==e?void 0:e.GroupTips)&&t.forEach(e=>{Array.isArray(e.MsgBody.GroupWithdrawInfoArray)?s.push(n.GROUP_MESSAGE_REVOKED):Array.isArray(e.MsgBody.GroupMsgReceiptList)?s.push(n.GROUP_MESSAGE_READ_RECEIPT):Array.isArray(e.MsgBody.GroupReadInfoArray)?e.MsgBody.GroupReadInfoArray[0].TopicId?s.push(n.TOPIC_MESSAGE_READ_SYNC):s.push(n.GROUP_MESSAGE_READ_SYNC):2===e.GroupInfo.MillionGroupFlag?s.push(n.TOPIC_SYSTEM_NOTIFICATION):s.push(n.GROUP_SYSTEM_NOTIFICATION)}),s}},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:6}],subTypeParser:q},{conditions:[{type:"hasKey",value:"GroupTips"},{type:"event",value:12}],subTypeParser:function(e){let t,s=[];return null!=(t=null==e?void 0:e.GroupTips)&&t.forEach(e=>{var e=e["GroupAtTips"]["TopicId"];e?s.push(n.TOPIC_AT_TIPS):s.push(n.GROUP_AT_TIPS)}),s}},{conditions:[{type:"hasKey",value:"RecentContactMod"}],subTypeParser:function(e){let t,s=[];return null!=(t=null==e?void 0:e.RecentContactMod)&&t.forEach(e=>{switch(e.PushType){case B.CONV_MARK_UPDATED:s.push(n.CONVERSATION_MARK_UPDATED);break;case B.CONV_GROUP_ADDED:s.push(n.CONVERSATION_GROUP_ADD);break;case B.CONV_GROUP_DELETED:s.push(n.CONVERSATION_GROUP_DELETED);break;case B.CONV_GROUP_UPDATED:s.push(n.CONVERSATION_GROUP_UPDATED);break;default:s.push(n.CONV_MODIFIED)}}),s}},{conditions:[{type:"hasKey",value:"MsgReactionNotifyList"}],subType:n.MESSAGE_REACTION_UPDATED},{conditions:[{type:"hasKey",value:"MsgReactionNotify"}],subType:n.MESSAGE_REACTION_UPDATED_SYNC},{conditions:[{type:"hasKey",value:"C2cMsgInfo"}],subType:n.C2C_MESSAGE_READ_RECEIPT},{conditions:[{type:"hasKey",value:"FollowChangeList"}],subType:n.FOLLOW_LIST_UPDATED},{conditions:[{type:"hasKey",value:"MsgExtensionNotify"}],subType:n.MESSAGE_EXTENSIONS_UPDATED},{conditions:[{type:"hasKey",value:"C2CReadAllMsg"}],subType:n.ALL_MESSAGE_READ}];function W(n){let e,t=Array.isArray(null==(e=null==n?void 0:n.body)?void 0:e.EventArray)?n.body.EventArray:[],i=[];return t.forEach(t=>{t.Flag=n.body.Flag;var e=Y.find(e=>e.conditions.every(e=>{switch(e.type){case"event":return t.Event===e.value;case"hasKey":return Object.prototype.hasOwnProperty.call(t,e.value);default:return!1}}));if(!e)return null;let s=[];"function"==typeof e.subTypeParser?s=e.subTypeParser(t):e.subType&&(s=e.subType),Array.isArray(s)?s.forEach(e=>{i.push({type:x.SERVER_PUSH_MESSAGE+":"+e,data:t})}):i.push({type:x.SERVER_PUSH_MESSAGE+":"+s,data:t})}),i}(t=x=x||{}).SERVER_PUSH_MESSAGE="im_open_push.msg_push",t.SERVER_PUSH_MESSAGE_MULTIPLE="im_open_push.multi_msg_push_ws",t.ERROR="error";let K={[x.SERVER_PUSH_MESSAGE]:W,[x.SERVER_PUSH_MESSAGE_MULTIPLE]:W,[x.ERROR]:function(e){var t=e["errorCode"];return[{type:"error:"+t,data:e}]}},o=new class{constructor(){this._outerEventEmitter=null,this._innerEventEmitter=null,this._outerEventEmitter=new b,this._innerEventEmitter=new b,this.InnerEventSubType=n}subscribeInnerEvent(s,n,i,r){var o,t;if(["string","number"].includes(typeof n)){let e=n,t=i;null!=(o=this._innerEventEmitter)&&o.on(s+":"+e,t,r)}else{let e=n;null!=(t=this._innerEventEmitter)&&t.on(s,e,i)}}emitInnerEvent(t,s){var e;if(null!=(e=this._innerEventEmitter)&&e.emit(t,s),Object.keys(K).includes(t)){let e=null==(t=K[t])?void 0:t.call(K,s);null!=e&&e.forEach(e=>{var t;e&&null!=(t=this._innerEventEmitter)&&t.emit(e.type,e.data)})}}unSubscribeInnerEvent(s,n,i,r){var o,t;if(["string","number"].includes(typeof n)){let e=n,t=i;null!=(o=this._innerEventEmitter)&&o.off(s+":"+e,t,r)}else{let e=n;null!=(t=this._innerEventEmitter)&&t.off(s,e,i)}}subscribeOuterEvent(e,t,s){var n;null!=(n=this._outerEventEmitter)&&n.on(e,t,s)}unSubscribeOuterEvent(e,t,s){var n;null!=(n=this._outerEventEmitter)&&n.off(e,t,s)}emitOuterEvent(e,t){var s;null!=(s=this._outerEventEmitter)&&s.emit(e,t)}getOuterEventEmitter(){return this._outerEventEmitter}rest(){this._outerEventEmitter=null,this._innerEventEmitter=null}};function H(e,t){var s={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(s[i[n]]=e[i[n]]);return s}function p(e,o,a,l){return new(a=a||Promise)(function(s,t){function n(e){try{r(l.next(e))}catch(e){t(e)}}function i(e){try{r(l.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?s(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(n,i)}r((l=l.apply(e,o||[])).next())})}let c=e=>void 0===e,j=e=>"string"==typeof e,$=e=>{return null==(e=Object.prototype.toString.call(e).match(/^\[object (.*)\]$/))?void 0:e[1].toLowerCase()},z=e=>"function"==typeof Array.isArray?Array.isArray(e):"array"===$(e),Z=e=>null!==e&&"object"==typeof e,J=e=>z(e)||Z(e),X=e=>{return"string"==typeof e&&(e=e[0],!/[^a-zA-Z0-9]/.test(e))},Q=e=>{if("object"!=typeof e||null===e)return!1;e=Object.getPrototypeOf(e);if(null===e)return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return e===t};function ee(e=99999999){return Math.round(Math.random()*e)}let te=(s,n,i,r)=>{if(!J(s)||!J(n))return 0;let o=0;var a,l=Object.keys(n);for(let e=0,t=l.length;e<t;e++)if(a=l[e],!(c(n[a])||i&&i.includes(a)))if(J(s[a])&&J(n[a]))o+=te(s[a],n[a],i,r);else{if(r&&r.includes(n[a]))continue;s[a]!==n[a]&&(s[a]=n[a],o+=1)}return o};function se(s){let n,i,r=s,o="";for(let e=0,t=(r=s.length%8!=0?"0".repeat(8-s.length%8)+s:r)["length"];e<t;e+=8)n=parseInt(r.slice(e,e+4),2),i=parseInt(r.slice(e+4,e+8),2),o+=base16Map.get(n)+base16Map.get(i);return o}let ne="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&("mac"===wx.getSystemInfoSync().platform||"windows"===wx.getSystemInfoSync().platform),ie="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)||ne,re=ie&&"function"==typeof wx.createGamePortal,oe="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),ae="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),le="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),ce="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),ue="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,de="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,_e=ie&&"object"==typeof wx.miniapp,he="undefined"!=typeof uni,ge=ie||oe||ae||le||ce||de||ue,pe="undefined"==typeof window&&!ge&&"undefined"!=typeof global&&void 0!==global.NativeScriptGlobals,Ee="undefined"!=typeof global&&(void 0!==global.nativeModuleProxy||void 0!==global.ReactNative),me="undefined"!=typeof wx&&"function"==typeof wx.getAccountInfoSync&&Boolean(wx.getAccountInfoSync().plugin),Se="undefined"!=typeof uni?!ge:"undefined"!=typeof window&&!ge&&!Ee,fe=oe?qq:ae?tt:le?swan:ce?my:ie?wx:de?uni:ue?jd:{},s=Se&&window&&window.navigator&&window.navigator.userAgent||"",ve=/(micromessenger|webbrowser)/i.test(s),Ie=function(){let e="WEB";return ve?e="WEB":oe?e="QQ_MP":ae?e="TT_MP":le?e="BAIDU_MP":ce?e="ALI_MP":ie?e=_e?"DONUT_NATIVE_APP":"WX_MP":de?e="UNI_NATIVE_APP":pe?e="NS_NATIVE_APP":Ee&&(e="RN_NATIVE_APP"),k[e]}(),Ce=/iPad/i.test(s),Me=/iPhone/i.test(s)&&!Ce,Oe=/iPod/i.test(s),ye=Me||Ce||Oe,Te=(t=s.match(/OS (\d+)_/i))&&t[1]?t[1]:null,Ae=/Android/i.test(s),Ne=(t=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(Ze=t[1]&&parseFloat(t[1]),V=t[2]&&parseFloat(t[2]),Ze&&V?parseFloat(t[1]+"."+t[2]):Ze||null):null,Re=/Firefox/i.test(s),De=/Edge/i.test(s),Pe=!De&&/Chrome/i.test(s),we=/MSIE/.test(s)||-1<s.indexOf("Trident")&&-1<s.indexOf("rv:11.0"),Le=function(){var e=/MSIE\s(\d+)\.\d/.exec(s);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(s)&&/rv:11.0/.test(s)?11:t}(),be=/Safari/i.test(s)&&!Pe&&!Ae&&!De,ke=/Windows/i.test(s),Ue=/MAC OS X/i.test(s),Ge=Se&&"undefined"!=typeof Worker&&!we,Fe=Ae||ye,Be=Se&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy,xe="undefined"!=typeof window&&void 0!==window.navigator&&(V=window.navigator["standalone"],!(!ye||V||be));function Ve(){let e="unknown";if(Ue&&(e="mac"),ke&&(e="windows"),ye&&(e="ios"),Ae&&(e="android"),ge)try{var t=wx.getSystemInfoSync()["platform"];void 0!==t&&(e=t)}catch(e){console.error(e)}return e}let qe="application/x-www-form-urlencoded;charset=UTF-8";function Ye(e){return p(this,arguments,void 0,function*({method:i,url:r,data:o,timeout:a=3e3}){return new Promise(ge?(t,e)=>{fe.request({url:r,data:o,method:i,timeout:a,header:{"content-type":qe},success:e=>t(e.data),fail:()=>e(new Error('{"message":"Network error","code":2800}'))})}:(t,e)=>{let s=new XMLHttpRequest,n=setTimeout(()=>{s.abort(),e(new Error('{"message":"Request timeout","code":2801}'))},a);s.onreadystatechange=function(){if(4===s.readyState)if(clearTimeout(n),200===s.status||304===s.status)try{t(s.responseText?JSON.parse(s.responseText):null)}catch(e){t(s.responseText)}else e(new Error('{"message":"Network error","code":2800}'))},s.open(i,r,!0),s.setRequestHeader("Content-type",qe),s.send(o||null)})})}function We(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(Q(e)){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return("[object Map]"===Object.prototype.toString.call(e)||"[object Set]"===Object.prototype.toString.call(e)||"[object File]"===Object.prototype.toString.call(e))&&0===e.size}function Ke(n){if(null===n||"object"!=typeof n)return n;if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp)return new RegExp(n.source,n.flags);if(n instanceof Map){let s=new Map;return n.forEach((e,t)=>{s.set(Ke(t),Ke(e))}),s}if(n instanceof Set){let t=new Set;return n.forEach(e=>{t.add(Ke(e))}),t}if(Array.isArray(n))return n.map(e=>Ke(e));let e=Object.getPrototypeOf(n),s=Object.create(e);return[...Object.getOwnPropertyNames(n),...Object.getOwnPropertySymbols(n)].forEach(e=>{var t=Object.getOwnPropertyDescriptor(n,e);t&&(t.get||t.set?Object.defineProperty(s,e,t):s[e]=Ke(n[e]))}),s}function He(){let s,n;return{promise:new Promise((e,t)=>{s=e,n=t}),resolve:s,reject:n}}var t=Object.freeze({__proto__:null,ANDROID_VERSION:Ne,IE_VERSION:Le,IN_ALIPAY_MINI_APP:ce,IN_BAIDU_MINI_APP:le,IN_BROWSER:Se,IN_DONUT_NATIVE_APP:_e,IN_JD_MINI_APP:ue,IN_MINI_APP:ge,IN_NS_NATIVE_APP:pe,IN_QQ_MINI_APP:oe,IN_RN_APP:Ee,IN_TT_MINI_APP:ae,IN_UNI_APP:he,IN_UNI_NATIVE_APP:de,IN_WX_MINI_APP:ie,IN_WX_MINI_APP_DESK:ne,IN_WX_MINI_GAME:re,IN_WX_MINI_PLUGIN:me,IOS_VERSION:Te,IS_ANDROID:Ae,IS_CHROME:Pe,IS_EDGE:De,IS_FIREFOX:Re,IS_IE:we,IS_IOS:ye,IS_IPAD:Ce,IS_IPHONE:Me,IS_IPOD:Oe,IS_MAC:Ue,IS_SAFARI:be,IS_WECHAT:ve,IS_WIN:ke,IS_WORKER_AVAILABLE:Ge,MINI_APP_NAMESPACE:fe,USER_AGENT:s,base16EncodeBinaryString:se,deepCopyWithMethods:Ke,deepMerge:te,generatePromise:He,getPlatformType:Ve,getType:$,httpRequest:Ye,isArray:z,isArrayOrObject:J,isEmpty:We,isFlutterWeb:Be,isH5:Fe,isIOSWebView:xe,isNumber:e=>null!==e&&("number"==typeof e&&!Number.isNaN(+e)||"object"==typeof e&&e.constructor===Number),isObject:Z,isPlainObject:Q,isString:j,isUndefined:c,isValidRequestKey:X,platform:Ie,randomInt:ee,randomString:function(){let t="";for(let e=32;0<e;--e)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return t}});class je{constructor(){this._socket=null}connectSocket(e){return this._socket=new WebSocket(e),this._socket}send(e){var t;try{null!=(t=this._socket)&&t.send(e)}catch(e){null!=(t=this._onSendFail)&&t.call(this,e)}}bindSocketHandlers(e){var{onOpen:e,onMessage:t,onClose:s,onError:n,onSendFail:i}=e;this._socket&&(this._socket.binaryType="arraybuffer",this._socket.onopen=e,this._socket.onmessage=t,this._socket.onclose=s,this._socket.onerror=n,this._onSendFail=i)}unbindSocketHandlers(){this._socket&&(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null)}disconnect(){this._socket&&(this._socket.close(),this._socket=null)}}class $e{connectSocket(e){return this._socket=wx.connectSocket({url:e,header:{"content-type":"application/json"},complete:()=>{}}),this._socket}send(e){var t;null!=(t=this._socket)&&t.send({data:e,fail:this._onSendFail})}bindSocketHandlers(e){var{onOpen:e,onMessage:t,onClose:s,onError:n,onSendFail:i}=e;this._socket.onClose(s),this._socket.onOpen(e),this._socket.onMessage(t),this._socket.onError(n),this._onSendFail=i}unbindSocketHandlers(){this._socket&&(this._socket.onClose(()=>{}),this._socket.onOpen(()=>{}),this._socket.onMessage(()=>{}),this._socket.onError(()=>{}))}disconnect(){this._socket&&(this._socket.close(),this._socket=null)}}class ze{constructor(){this._worker=null,this._blobUrl=null}connectSocket(e){var t=new Blob(["\n let _socket = null;\n\n self.onmessage = (event) => {\n const { type, url, data } = event.data;\n\n switch (type) {\n case 'CONNECT':\n connectSocket(url);\n break;\n case 'SEND':\n send(data);\n break;\n case 'DISCONNECT':\n disconnect();\n break;\n }\n };\n\n function connectSocket(url) {\n _socket = new WebSocket(url);\n _socket.binaryType = 'arraybuffer';\n bindSocketHandlers();\n return _socket;\n }\n\n function send(packet) {\n try {\n _socket?.send(packet);\n } catch (error) {\n self.postMessage({\n type: 'SEND_FAIL', \n error: {\n message: error.message,\n name: error.name,\n },\n });\n }\n }\n\n function bindSocketHandlers() {\n if (_socket) {\n _socket.onopen = (event) => {\n self.postMessage({\n type: 'OPEN',\n data: {\n type: event.type,\n timeStamp: event.timeStamp,\n },\n });\n };\n\n _socket.onmessage = (event) => {\n self.postMessage({ \n type: 'MESSAGE',\n data: event.data,\n });\n };\n\n _socket.onclose = (event) => {\n self.postMessage({ \n type: 'CLOSE', \n data: { \n code: event.code,\n reason: event.reason,\n timeStamp: event.timeStamp,\n },\n });\n };\n\n _socket.onerror = (error) => {\n self.postMessage({\n type: 'ERROR',\n data: {\n message: error.message,\n name: error.name\n },\n });\n };\n }\n }\n\n function unbindSocketHandlers() {\n if (_socket) {\n _socket.onopen = null;\n _socket.onmessage = null;\n _socket.onclose = null;\n _socket.onerror = null;\n }\n }\n\n function disconnect() {\n if (_socket) {\n _socket.close();\n _socket = null;\n }\n }\n"],{type:"application/javascript"});this._worker=new Worker(URL.createObjectURL(t)),this._worker.postMessage({type:"CONNECT",url:e})}send(e){var t;try{null!=(t=this._worker)&&t.postMessage({type:"SEND",data:e})}catch(e){null!=(t=this._onSendFail)&&t.call(this,e)}}bindSocketHandlers(e){var{onOpen:t,onMessage:n,onClose:i,onError:r,onSendFail:o}=e;if(this._worker){let s={OPEN:t,MESSAGE:n,CLOSE:i,ERROR:r,SEND_FAIL:o};this._onSendFail=o,this._worker.onmessage=e=>{var t=((null==e?void 0:e.data)||{})["type"];"function"==typeof s[t]&&null!=(t=s[t])&&t.call(s,null==e?void 0:e.data)}}}unbindSocketHandlers(){this._worker&&(this._worker.onmessage=null)}disconnect(){this._worker&&(this._worker.postMessage({type:"DISCONNECT"}),this._worker.terminate(),this._worker=null),this._blobUrl&&(URL.revokeObjectURL(this._blobUrl),this._blobUrl=null)}}var i,Ze,u=new class{constructor(){this._store=new Map}get(e){return this._store.get(e)}getStorage(e){return ge?ce?my.getStorageSync({key:e}).data:fe.getStorageSync(e):this._canUseLocalStorage()?localStorage.getItem(e):{}}set(e,t){var s=this._store.get(e)||{};t instanceof Map?this._store.set(e,t):this._store.set(e,Object.assign(Object.assign({},s),t))}setStorage(e,t){ge?ce?my.setStorageSync({key:e,data:JSON.stringify(t)}):fe.setStorageSync(e,JSON.stringify(t)):this._canUseLocalStorage()&&localStorage.setItem(e,JSON.stringify(t))}clear(e){"string"==typeof e?this._store.set(e,{}):this._store.clear()}clearLocalStorage(e){this._canUseLocalStorage()&&("string"==typeof e?localStorage.setItem(e,""):localStorage.clear())}reset(){this.clear()}_canUseLocalStorage(){return"undefined"!=typeof window&&navigator&&navigator.cookieEnabled&&localStorage}};(Ze=i=i||{})[Ze.CONNECTED=0]="CONNECTED",Ze[Ze.CONNECTING=1]="CONNECTING",Ze[Ze.DISCONNECTED=2]="DISCONNECTED";class Je{constructor(e){this._url="",this._readyState=i.DISCONNECTED,this._url=e,this._id=ee(),this._emitter=new b,ie?this._socket=new $e:this._canUseWebWorker()?this._socket=new ze:this._socket=new je,this.connect()}connect(){this.doOpen(),this._bindSocketHandlers()}doOpen(){[i.CONNECTED,i.CONNECTING].includes(this._readyState)||(this._readyState=i.CONNECTING,this._ws=this._socket.connectSocket(this._url))}send(e){this._readyState!==i.CONNECTED?this.reconnect():this._socket.send(e)}reconnect(){[i.CONNECTED,i.CONNECTING].includes(this._readyState)||(this.disconnect(),this.doOpen())}getId(){return this._id}on(e,t,s){this._emitter.on(e,t,s)}off(e,t,s){this._emitter.off(e,t,s)}isConnected(){return this._readyState===i.CONNECTED}disconnect(){this._readyState=i.DISCONNECTED,this._unbindSocketHandlers(),this._socket.disconnect()}_onOpen(e){this._readyState===i.CONNECTING&&(this._readyState=i.CONNECTED,this._emitter.emit("connect",{socketId:this._id,event:e}))}_onMessage(e){this._emitter.emit("message",e)}_onClose(e){this._readyState=i.DISCONNECTED,this._emitter.emit("close",{socketId:this._id,event:e})}_onError(e){this._readyState=i.DISCONNECTED,this._emitter.emit("error",{socketId:this._id,error:e})}_onSendFail(e){this._readyState=i.DISCONNECTED,this._emitter.emit("sendFail",{socketId:this._id,error:e})}_bindSocketHandlers(){this._socket.bindSocketHandlers({onOpen:this._onOpen.bind(this),onMessage:this._onMessage.bind(this),onClose:this._onClose.bind(this),onError:this._onError.bind(this),onSendFail:this._onSendFail.bind(this)})}_unbindSocketHandlers(){this._socket.unbindSocketHandlers()}_canUseWebWorker(){var e=u.get("cloudConfig")||{};return(c(e.isWorkerEnabled)||"1"===e.isWorkerEnabled)&&Ge}}let Xe={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"},INDONESIA:{DEFAULT:"wss://wssidn-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{INITIAL:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",BACKUP_WEB_ONLY:"wss://*w4c.my-cpaas.com",BACKUP_CN:"wss://wss.im.tencent.cn",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{INITIAL:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4c.my-cpaas.com",BACKUP_CN:"wss://wss.im.tencent.cn",STAT:"https://api.my-imcloud.com"},SINGAPORE:{INITIAL:"wss://*w4s.my-imcloud.com",DEFAULT:"wss://wsssgp.im.qcloud.com",IPV6:"wss://wsssgpv6.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4s.my-cpaas.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{INITIAL:"wss://*w4k.my-imcloud.com",DEFAULT:"wss://wsskr.im.qcloud.com",IPV6:"wss://wsskrv6.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4k.my-cpaas.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{INITIAL:"wss://*w4g.my-imcloud.com",DEFAULT:"wss://wssger.im.qcloud.com",IPV6:"wss://wssgerv6.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4g.my-cpaas.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{INITIAL:"wss://*w4i.my-imcloud.com",DEFAULT:"wss://wssind.my-imcloud.com",IPV6:"wss://wssindv6.im.qcloud.com",BACKUP:"wss://wssind.im.qcloud.com",BACKUP_WEB_ONLY:"wss://*w4i.my-cpaas.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.19.46"},JPN:{INITIAL:"wss://*w4j.my-imcloud.com",DEFAULT:"wss://wssjpn.im.qcloud.com",IPV6:"wss://wssjpnv6.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4j.my-cpaas.com",STAT:"https://apijpn.my-imcloud.com",ANYCAST:"wss://162.14.13.254"},USA:{INITIAL:"wss://*w4u.my-imcloud.com",DEFAULT:"wss://wssusa.im.qcloud.com",IPV6:"wss://wssusav6.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4u.my-cpaas.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{INITIAL:"wss://*w4y.my-imcloud.com",DEFAULT:"wss://wssidn.im.qcloud.com",IPV6:"wss://wssidnv6.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",BACKUP_WEB_ONLY:"wss://*w4y.my-cpaas.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},Qe={SINGAPORE:[[2e7,3e7],[172e7,173e7]],KOREA:[[3e7,4e7],[173e7,174e7]],GERMANY:[[4e7,5e7],[174e7,175e7]],IND:[[5e7,6e7],[175e7,176e7]],JPN:[[6e7,7e7],[176e7,177e7]],USA:[[7e7,8e7],[177e7,178e7]],INDONESIA:[[8e7,9e7],[178e7,179e7]]};function et(t){var e;if(null!=(e=u.get("instance"))&&e.oversea)return"OVERSEA";for(let e of Object.keys(Qe))for(var[s,n]of Qe[e])if(t>=s&&t<n)return e;return"CHINA"}var a,st="1.5.0";(d=a=a||{}).INITIAL="INITIAL",d.DEFAULT="DEFAULT",d.BACKUP="BACKUP",d.BACKUP_WEB_ONLY="BACKUP_WEB_ONLY",d.BACKUP_CN="BACKUP_CN",d.ANYCAST="ANYCAST",d.IPV6="IPV6";let l=a.INITIAL;function nt(e,t){var s,{isBinary:t=!1}=t||{},{sdkAppId:n,instanceId:i}=u.get("instance"),r=function e(){var t=Math.random();return 0===t?e():t}(),o=Ve(),a=function(){var e=Ve();let t=-1;return"ios"===e?t=Te||-1:"android"===e&&(t=Ne||-1),t}(),n=(s={sdkappid:n,instanceid:i,random:r,platform:Ie,host:o,version:a,sdkversion:st},Object.keys(s).map(e=>e+"="+s[e]).join("&"));return t?e+`/binfo?${n}&compress=gzip`:e+"/info?"+n}function it(e){var{sdkAppId:t,testEnv:s}=u.get("instance"),t=et(t);if(s)return nt(Xe.TEST[t].DEFAULT,{isBinary:e});let n=Xe.PRODUCTION[t],i=Se&&n.ANYCAST,r=Se,o=!!n.BACKUP_CN;return nt({[a.INITIAL]:()=>(l=a.DEFAULT,n.DEFAULT),[a.DEFAULT]:()=>(l=a.IPV6,n.IPV6),[a.IPV6]:()=>(l=a.BACKUP,n.BACKUP),[a.BACKUP]:()=>{return r?(l=a.BACKUP_WEB_ONLY,e=n.BACKUP_WEB_ONLY,t=Math.floor(10001*Math.random())+1e4,e.replace("*",String(t))):o?(l=a.BACKUP_CN,n.BACKUP_CN):i?(l=a.ANYCAST,n.ANYCAST):n.DEFAULT;var e,t},[a.BACKUP_WEB_ONLY]:()=>o?(l=a.BACKUP_CN,n.BACKUP_CN):i?(l=a.ANYCAST,n.ANYCAST):n.DEFAULT,[a.BACKUP_CN]:()=>(l=i?a.ANYCAST:a.DEFAULT,n[l]),[a.ANYCAST]:()=>(l=a.DEFAULT,n.ANYCAST="",n.DEFAULT)}[l](),{isBinary:e})}var rt=new class{constructor(){this._timeOffsetWithServer=0}getServerTimeMs(){return Date.now()+this._timeOffsetWithServer}getServerTimeSeconds(){return Math.floor(this.getServerTimeMs()/1e3)}getTimeOffsetWithServer(){return this._timeOffsetWithServer}calculateTimeOffsetWithServer(e,t){var s=Date.now();this._timeOffsetWithServer=t+(s-e)-s}};var r=new class{constructor(){this._tasks=[],this._timer=null,this._taskMap=new Map}_addTaskToScheduler(e){var t=e["id"];this.removeTask(t),this._tasks.push(e),this._taskMap.set(t,e),this._sort(),this._scheduleNextTask()}_createTask(e){var{id:e,callback:t,context:s,isOnce:n=!1,intervalMs:i=16}=e,r=Math.max(i,16);return{id:e,nextExecuteTime:Date.now()+r,intervalMs:i,callback:t,context:s,isOnce:n}}addTask(e){e=this._createTask(e);this._addTaskToScheduler(e)}addOnceTask(e){e=this._createTask(Object.assign(Object.assign({},e),{isOnce:!0}));this._addTaskToScheduler(e)}removeTask(t){var e=this._tasks.findIndex(e=>e.id===t);-1<e&&(this._tasks.splice(e,1),this._taskMap.delete(t),this._scheduleNextTask())}updateTaskInterval(e,t){e=this._taskMap.get(e);e&&(e.intervalMs=t,e.nextExecuteTime=Date.now()+t,this._sort(),this._scheduleNextTask())}clearAllTasks(){this._tasks=[],this._taskMap.clear(),this._timer&&(clearTimeout(this._timer),this._timer=null)}dispose(){this.clearAllTasks()}_sort(){this._tasks.sort((e,t)=>e.nextExecuteTime-t.nextExecuteTime)}_scheduleNextTask(){this._timer&&(clearTimeout(this._timer),this._timer=null);var e=this._tasks[0];e&&(e=Math.max(0,e.nextExecuteTime-Date.now()),this._timer=setTimeout(()=>this._execute(),e))}_execute(){for(var e=Date.now();this._tasks.length&&this._tasks[0].nextExecuteTime<=e;){var t=this._tasks[0];try{t.context?t.callback.call(t.context):t.callback(),t.isOnce?this.removeTask(t.id):(t.nextExecuteTime=e+t.intervalMs,this._sort())}catch(e){console.warn(`Task ${t.id} execution failed:`,e),t.isOnce&&this.removeTask(t.id)}}this._scheduleNextTask()}};function ot(t){var s=[];for(let e=0;e<t.length;e+=1){var n,i=t.charCodeAt(e);55296<=i&&i<=56319?(n=t.charCodeAt(++e)-56320+(i-55296<<10)+65536,s.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n)):i<=127?s.push(i):i<=2047?s.push(192|i>>6,128|63&i):s.push(224|i>>12,128|i>>6&63,128|63&i)}return new Uint8Array(s)}function at(e){var t,s=Array.isArray(e)?[]:Object.create(null);for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&X(t)&&null!=e[t]&&(null===e[t]||"object"!=typeof e[t]?s[t]=e[t]:s[t]=at(e[t]));return s}function lt(e,t){if(U.includes(e))return 0;var s=ot(JSON.stringify(t));let n=4294967295;var i=s["length"];for(let e=0;e<i;e++){n^=s[e];for(let e=0;e<8;e++)1&~n?n>>>=1:n=n>>>1^3988292384}return(4294967295^n)>>>0}function ct(e){var t,{servcmd:e,data:s}=e,n=(n=e,t=u.get("login")||{},i=u.get("instance")||{},{servcmd:n,ver:"v4",platform:Ie,websdkappid:537048168,websdkversion:"1.7.3",a2:t.a2Key||void 0,tinyid:t.tinyID||void 0,status_instid:t.statusInstanceId||0,sdkappid:i.sdkAppId,contenttype:"json",reqtime:Math.floor(Date.now()/1e3),identifier:t.a2Key?void 0:t.userId,usersig:t.a2Key?void 0:t.userSig,sdkability:75689843,sdkability_ext:se(""),cappid:t.cappid||0,tjgID:"",seq:_t(),cs:0}),i=at(s);return n.cs=lt(e,i),{head:n,body:i}}function ut(e){var t,{servcmd:e,data:s}=e,n=(n=e,t=u.get("login")||{},i=u.get("instance")||{},{servcmd:n,ver:"v4",platform:Ie,websdkappid:537048168,websdkversion:"1.7.3",sdkappid:i.sdkAppId,contenttype:"",reqtime:Math.floor(Date.now()/1e3),identifier:"",usersig:"",status_instid:t.statusInstanceId||0,sdkability:75689843,sdkability_ext:se(""),cappid:t.cappid||0,seq:_t(),cs:0}),i=at(s);return n.cs=lt(e,i),{head:n,body:i}}let dt=ee();function _t(){return dt=dt<2415919103?dt+1:ee()}function ht(){var e=u.get("login")||{},t=u.get("instance")||{};return{sdk_type:30,sdk_app_id:t.sdkAppId,sdk_version:"1.5.0",tiny_id:Number(e.tinyID),user_id:e.userId,platform:Ie,instance_id:t.instanceId,trace_id:(new Date).getTime()}}var gt,d=Object.freeze({__proto__:null,generateCosSpecifiedData:function(e){var t,{servcmd:e,data:s}=e,n=(n=e,t=u.get("login")||{},i=u.get("instance")||{},{servcmd:n,ver:"v4",platform:Ie,websdkappid:537048168,websdkversion:"1.7.3",sdkappid:i.sdkAppId,contenttype:"json",reqtime:Math.floor(Date.now()/1e3),identifier:t.userId,usersig:t.userSig,status_instid:t.statusInstanceId||0,sdkability:75689843,sdkability_ext:se(""),cappid:t.cappid||0,seq:_t(),cs:0}),i=at(s);return n.cs=lt(e,i),{head:n,body:i}},generateProtocolData:ct,generateSSOLogProtocolData:ut,generateSequence:_t,getCommonHead:ht,taskScheduler:r,timeManager:rt});(y=gt=gt||{})[y.info=4]="info",y[y.warning=5]="warning",y[y.error=6]="error";let pt={method:"extension",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",uiPlatform:"ui_platform",timestamp:"timestamp"};class Et{constructor(e){this.level=gt.info,this._canSendLog=!0,this._logCreatedAt=rt.getServerTimeMs(),this.timestamp=0,this.networkType=8,this.code=0,this.moreMessage="",this.method="",this.message="",this.costTime=0,this.duplicate=!1,this.eventType=0,this.uiPlatform=void 0;var{method:e,eventType:t=0,uiPlatform:s,message:n}=e||{};this.eventType=t,this.method=e,this.uiPlatform=s,this.message=n||""}setMoreMessage(e){this.moreMessage=this.moreMessage+" "+e}updateLogCreatedAtByTimeOffset(){this._logCreatedAt+=rt.getTimeOffsetWithServer()}end(e=!1){var t;this._canSendLog&&(t=rt.getServerTimeMs(),0===this.costTime&&(this.costTime=t-this._logCreatedAt),this.setMoreMessage(`startts:${this._logCreatedAt} endts:`+t),e?(this._canSendLog=!1,this.timestamp=rt.getServerTimeMs(),this._ssoLogModule.pushToLogQueue(this._convertSSOLogDataKeyToServe())):setTimeout(()=>{this._canSendLog=!1,this.timestamp=rt.getServerTimeMs(),this._ssoLogModule.pushToLogQueue(this._convertSSOLogDataKeyToServe())},0))}setError(e){var t;return e instanceof Error?this._canSendLog&&(null!=(t=u.get("netWorkMonitor"))&&t.isNetworkOnline&&(e.errorCode&&(this.code=e.errorCode),e.errorMessage)&&this.setMoreMessage(e.errorMessage),this.level=gt.error):console.warn("SSOLogData.setError value not instanceof Error, please check!"),this}setLogInfo(t){return Object.keys(t).forEach(e=>{Object.keys(pt).includes(e)&&(this[e]=t[e])}),this}setSSOLogModule(e){this._ssoLogModule=e}_convertSSOLogDataKeyToServe(){let t={};return Object.keys(this).forEach(e=>{pt[e]&&(t[pt[e]]=this[e])}),t}}(y=A=A||{}).RECONNECTED="reconnected",y.CLOUD_CONFIG_UPDATE="cloud_config_update",y.SOCKET_DISCONNECTED="socket_disconnected";var mt=A;let St=[4,5,6],ft=[],vt=[],It="report-logger";var Ct=new class{constructor(){this._sdkAppIdBlackList=[],this._tinyIdWhiteList=[],this._reportLevel=[4,5,6],this._minThreshold=20,this._maxThreshold=100,this._waitingTime=6e4,this._lastReportAt=Date.now(),this._ssoLogMap=new Map,o.subscribeInnerEvent(mt.CLOUD_CONFIG_UPDATE,this._handleCloudConfigUpdate,this),r.addTask({id:It,intervalMs:1e3,callback:this._checkAndReportIfDue,context:this}),this._logQueue=[],this._savePlatFormInfo()}_handleCloudConfigUpdate(e){var{evt_rpt_threshold:e=20,evt_rpt_waiting:t=6e4,evt_rpt_level:s=St,evt_rpt_sdkappid_bl:n=ft,evt_rpt_tinyid_wl:i=vt}=e||{};this._sdkAppIdBlackList=n,this._waitingTime=t,this._minThreshold=e,this._reportLevel=s,this._tinyIdWhiteList=i}createSSOLogData(e){var t=new Et(e);return t.setSSOLogModule(this),this._ssoLogMap.set(e.method,t),t}getSSOLogData(e){return this._ssoLogMap.get(e)||{}}pushToLogQueue(e){e&&(this._logQueue.push(e),this._shouldUploadImmediately())&&this.uploadSSOLogData()}_shouldUploadImmediately(){return this._logQueue.length>=this._minThreshold}_isReportDue(){return Date.now()>=this._lastReportAt+this._waitingTime}_checkAndReportIfDue(){this._isReportDue()&&0<this._logQueue.length&&this.uploadSSOLogData()}uploadSSOLogData(){return p(this,void 0,void 0,function*(){var e,t;0!==this._logQueue.length&&(t=this._logQueue.slice(),t=this._filterLogs(t),this._logQueue=[],0===t.length||We((t={Header:ht(),Event:t}).Header.user_id)||(e=(t=ut({servcmd:e="imopenstat.tim_web_report_v2",data:t})).head.seq+e,yield void Pt.sendPacket(t,{requestId:e})),this._lastReportAt=Date.now())})}_savePlatFormInfo(){var e,t;if(ie){var s=null==(t=null==(e=wx.getAccountInfoSync)?void 0:e.call(wx))?void 0:t.miniProgram;if(s){let{appId:e,envVersion:t}=s;u.set("instance",{appId:e,envVersion:t})}}else Se&&u.set("instance",{href:window.location.href})}_filterLogs(e){var t=(u.get("login")||{})["tinyID"],s=(u.get("instance")||{})["sdkAppId"];return this._sdkAppIdBlackList.includes(s)&&!this._tinyIdWhiteList.includes(t)?[]:e.filter(e=>this._reportLevel.includes(e.level))}reset(){console.log("SSO_LOG_MODULE.reset"),r.removeTask(It),o.unSubscribeInnerEvent(mt.CLOUD_CONFIG_UPDATE,this._handleCloudConfigUpdate,this),this._lastReportAt=0,this.uploadSSOLogData(),this._sdkAppIdBlackList=[],this._tinyIdWhiteList=[],this._minThreshold=20,this._maxThreshold=100,this._waitingTime=6e4,this._logQueue=[]}};let _="Channel",Mt="channel_schedule_task",Ot="channel_reconnect_task",yt="connected",Tt="disconnected",At="network_status_change";function Nt(e){return(Nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Rt(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Dt=function s(n,i,r){function o(t,e){if(!i[t]){if(!n[t]){if(!e&&Rt)return Rt(t);if(a)return a(t,!0);e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}e=i[t]={exports:{}};n[t][0].call(e.exports,function(e){return o(n[t][1][e]||e)},e,e.exports,s,n,i,r)}return i[t].exports}for(var a=Rt,e=0;e<r.length;e++)o(r[e]);return o}({1:[function(e,t,s){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array,i=(s.assign=function(e){for(var t,s,n=Array.prototype.slice.call(arguments,1);n.length;){var i=n.shift();if(i){if("object"!=Nt(i))throw new TypeError(i+"must be non-object");for(var r in i)t=i,s=r,Object.prototype.hasOwnProperty.call(t,s)&&(e[r]=i[r])}}return e},s.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)},{arraySet:function(e,t,s,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(s,s+n),i);else for(var r=0;r<n;r++)e[i+r]=t[s+r]},flattenChunks:function(e){for(var t,s,n,i,r=t=0,o=e.length;r<o;r++)t+=e[r].length;for(i=new Uint8Array(t),r=s=0,o=e.length;r<o;r++)n=e[r],i.set(n,s),s+=n.length;return i}}),r={arraySet:function(e,t,s,n,i){for(var r=0;r<n;r++)e[i+r]=t[s+r]},flattenChunks:function(e){return[].concat.apply([],e)}};s.setTyped=function(e){e?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,i)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,r))},s.setTyped(n)},{}],2:[function(e,t,s){var l=e("./common"),i=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){r=!1}for(var c=new l.Buf8(256),n=0;n<256;n++)c[n]=252<=n?6:248<=n?5:240<=n?4:224<=n?3:192<=n?2:1;function u(e,t){if(t<65534&&(e.subarray&&r||!e.subarray&&i))return String.fromCharCode.apply(null,l.shrinkBuf(e,t));for(var s="",n=0;n<t;n++)s+=String.fromCharCode(e[n]);return s}c[254]=c[254]=1,s.string2buf=function(e){for(var t,s,n,i,r=e.length,o=0,a=0;a<r;a++)55296==(64512&(s=e.charCodeAt(a)))&&a+1<r&&56320==(64512&(n=e.charCodeAt(a+1)))&&(s=65536+(s-55296<<10)+(n-56320),a++),o+=s<128?1:s<2048?2:s<65536?3:4;for(t=new l.Buf8(o),a=i=0;i<o;a++)55296==(64512&(s=e.charCodeAt(a)))&&a+1<r&&56320==(64512&(n=e.charCodeAt(a+1)))&&(s=65536+(s-55296<<10)+(n-56320),a++),s<128?t[i++]=s:(s<2048?t[i++]=192|s>>>6:(s<65536?t[i++]=224|s>>>12:(t[i++]=240|s>>>18,t[i++]=128|s>>>12&63),t[i++]=128|s>>>6&63),t[i++]=128|63&s);return t},s.buf2binstring=function(e){return u(e,e.length)},s.binstring2buf=function(e){for(var t=new l.Buf8(e.length),s=0,n=t.length;s<n;s++)t[s]=e.charCodeAt(s);return t},s.buf2string=function(e,t){for(var s,n,i,r=t||e.length,o=new Array(2*r),a=s=0;a<r;)if((n=e[a++])<128)o[s++]=n;else if(4<(i=c[n]))o[s++]=65533,a+=i-1;else{for(n&=2===i?31:3===i?15:7;1<i&&a<r;)n=n<<6|63&e[a++],i--;1<i?o[s++]=65533:n<65536?o[s++]=n:(n-=65536,o[s++]=55296|n>>10&1023,o[s++]=56320|1023&n)}return u(o,s)},s.utf8border=function(e,t){for(var s=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=s&&128==(192&e[s]);)s--;return!(s<0||0===s)&&s+c[e[s]]>t?s:t}},{"./common":1}],3:[function(e,t,s){t.exports=function(e,t,s,n){for(var i=65535&e,r=e>>>16&65535,o=0;0!==s;){for(s-=o=2e3<s?2e3:s;r=r+(i=i+t[n++]|0)|0,--o;);i%=65521,r%=65521}return i|r<<16}},{}],4:[function(e,t,s){t.exports={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}},{}],5:[function(e,t,s){var a=function(){for(var e=[],t=0;t<256;t++){for(var s=t,n=0;n<8;n++)s=1&s?3988292384^s>>>1:s>>>1;e[t]=s}return e}();t.exports=function(e,t,s,n){var i=a,r=n+s;e^=-1;for(var o=n;o<r;o++)e=e>>>8^i[255&(e^t[o])];return~e}},{}],6:[function(e,t,s){t.exports=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}},{}],7:[function(e,t,s){t.exports=function(e,t){var s,n,i,r,o,a,l=e.state,c=e.next_in,u=e.input,d=c+(e.avail_in-5),_=e.next_out,h=e.output,g=_-(t-e.avail_out),p=_+(e.avail_out-257),E=l.dmax,m=l.wsize,S=l.whave,f=l.wnext,v=l.window,I=l.hold,C=l.bits,M=l.lencode,O=l.distcode,y=(1<<l.lenbits)-1,T=(1<<l.distbits)-1;e:do{for(C<15&&(I+=u[c++]<<C,C+=8,I+=u[c++]<<C,C+=8),s=M[I&y];;){if(I>>>=n=s>>>24,C-=n,0==(n=s>>>16&255))h[_++]=65535&s;else{if(!(16&n)){if(!(64&n)){s=M[(65535&s)+(I&(1<<n)-1)];continue}if(32&n){l.mode=12;break e}e.msg="invalid literal/length code",l.mode=30;break e}for(i=65535&s,(n&=15)&&(C<n&&(I+=u[c++]<<C,C+=8),i+=I&(1<<n)-1,I>>>=n,C-=n),C<15&&(I+=u[c++]<<C,C+=8,I+=u[c++]<<C,C+=8),s=O[I&T];;){if(I>>>=n=s>>>24,C-=n,!(16&(n=s>>>16&255))){if(!(64&n)){s=O[(65535&s)+(I&(1<<n)-1)];continue}e.msg="invalid distance code",l.mode=30;break e}if(r=65535&s,C<(n&=15)&&(I+=u[c++]<<C,(C+=8)<n)&&(I+=u[c++]<<C,C+=8),E<(r+=I&(1<<n)-1)){e.msg="invalid distance too far back",l.mode=30;break e}if(I>>>=n,C-=n,(n=_-g)<r){if(S<(n=r-n)&&l.sane){e.msg="invalid distance too far back",l.mode=30;break e}if(a=v,(o=0)===f){if(o+=m-n,n<i){for(i-=n;h[_++]=v[o++],--n;);o=_-r,a=h}}else if(f<n){if(o+=m+f-n,(n-=f)<i){for(i-=n;h[_++]=v[o++],--n;);if(o=0,f<i){for(i-=n=f;h[_++]=v[o++],--n;);o=_-r,a=h}}}else if(o+=f-n,n<i){for(i-=n;h[_++]=v[o++],--n;);o=_-r,a=h}for(;2<i;)h[_++]=a[o++],h[_++]=a[o++],h[_++]=a[o++],i-=3;i&&(h[_++]=a[o++],1<i)&&(h[_++]=a[o++])}else{for(o=_-r;h[_++]=h[o++],h[_++]=h[o++],h[_++]=h[o++],2<(i-=3););i&&(h[_++]=h[o++],1<i)&&(h[_++]=h[o++])}break}}break}}while(c<d&&_<p);c-=i=C>>3,I&=(1<<(C-=i<<3))-1,e.next_in=c,e.next_out=_,e.avail_in=c<d?d-c+5:5-(c-d),e.avail_out=_<p?p-_+257:257-(_-p),l.hold=I,l.bits=C}},{}],8:[function(e,t,s){var P=e("../utils/common"),w=e("./adler32"),L=e("./crc32"),b=e("./inffast"),k=e("./inftrees"),U=0,G=-2,F=1,n=852,i=592;function B(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function r(){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 P.Buf16(320),this.work=new P.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function o(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=F,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new P.Buf32(n),t.distcode=t.distdyn=new P.Buf32(i),t.sane=1,t.back=-1,U):G}function a(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,o(e)):G}function l(e,t){var s,n;return!e||!e.state||(n=e.state,t<0?(s=0,t=-t):(s=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t))?G:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=s,n.wbits=t,a(e))}function c(e,t){var s;return e?(s=new r,(e.state=s).window=null,(s=l(e,t))!==U&&(e.state=null),s):G}var x,V,q=!0;function Y(e,t,s,n){var i,e=e.state;return null===e.window&&(e.wsize=1<<e.wbits,e.wnext=0,e.whave=0,e.window=new P.Buf8(e.wsize)),n>=e.wsize?(P.arraySet(e.window,t,s-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(n<(i=e.wsize-e.wnext)&&(i=n),P.arraySet(e.window,t,s-n,i,e.wnext),(n-=i)?(P.arraySet(e.window,t,s-n,n,0),e.wnext=n,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave<e.wsize&&(e.whave+=i))),0}s.inflateReset=a,s.inflateReset2=l,s.inflateResetKeep=o,s.inflateInit=function(e){return c(e,15)},s.inflateInit2=c,s.inflate=function(e,t){var s,n,i,r,o,a,l,c,u,d,_,h,g,p,E,m,S,f,v,I,C,M,O,y,T=0,A=new P.Buf8(4),N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return G;12===(s=e.state).mode&&(s.mode=13),o=e.next_out,i=e.output,l=e.avail_out,r=e.next_in,n=e.input,a=e.avail_in,c=s.hold,u=s.bits,d=a,_=l,M=U;e:for(;;)switch(s.mode){case F:if(0===s.wrap)s.mode=13;else{for(;u<16;){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}if(2&s.wrap&&35615===c)A[s.check=0]=255&c,A[1]=c>>>8&255,s.check=L(s.check,A,2,0),u=c=0,s.mode=2;else if(s.flags=0,s.head&&(s.head.done=!1),!(1&s.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",s.mode=30;else if(8!=(15&c))e.msg="unknown compression method",s.mode=30;else{if(u-=4,C=8+(15&(c>>>=4)),0===s.wbits)s.wbits=C;else if(C>s.wbits){e.msg="invalid window size",s.mode=30;break}s.dmax=1<<C,e.adler=s.check=1,s.mode=512&c?10:12,u=c=0}}break;case 2:for(;u<16;){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}if(s.flags=c,8!=(255&s.flags)){e.msg="unknown compression method",s.mode=30;break}if(57344&s.flags){e.msg="unknown header flags set",s.mode=30;break}s.head&&(s.head.text=c>>8&1),512&s.flags&&(A[0]=255&c,A[1]=c>>>8&255,s.check=L(s.check,A,2,0)),u=c=0,s.mode=3;case 3:for(;u<32;){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}s.head&&(s.head.time=c),512&s.flags&&(A[0]=255&c,A[1]=c>>>8&255,A[2]=c>>>16&255,A[3]=c>>>24&255,s.check=L(s.check,A,4,0)),u=c=0,s.mode=4;case 4:for(;u<16;){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}s.head&&(s.head.xflags=255&c,s.head.os=c>>8),512&s.flags&&(A[0]=255&c,A[1]=c>>>8&255,s.check=L(s.check,A,2,0)),u=c=0,s.mode=5;case 5:if(1024&s.flags){for(;u<16;){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}s.length=c,s.head&&(s.head.extra_len=c),512&s.flags&&(A[0]=255&c,A[1]=c>>>8&255,s.check=L(s.check,A,2,0)),u=c=0}else s.head&&(s.head.extra=null);s.mode=6;case 6:if(1024&s.flags&&((h=a<(h=s.length)?a:h)&&(s.head&&(C=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Array(s.head.extra_len)),P.arraySet(s.head.extra,n,r,h,C)),512&s.flags&&(s.check=L(s.check,n,h,r)),a-=h,r+=h,s.length-=h),s.length))break e;s.length=0,s.mode=7;case 7:if(2048&s.flags){if(0===a)break e;for(h=0;C=n[r+h++],s.head&&C&&s.length<65536&&(s.head.name+=String.fromCharCode(C)),C&&h<a;);if(512&s.flags&&(s.check=L(s.check,n,h,r)),a-=h,r+=h,C)break e}else s.head&&(s.head.name=null);s.length=0,s.mode=8;case 8:if(4096&s.flags){if(0===a)break e;for(h=0;C=n[r+h++],s.head&&C&&s.length<65536&&(s.head.comment+=String.fromCharCode(C)),C&&h<a;);if(512&s.flags&&(s.check=L(s.check,n,h,r)),a-=h,r+=h,C)break e}else s.head&&(s.head.comment=null);s.mode=9;case 9:if(512&s.flags){for(;u<16;){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}if(c!==(65535&s.check)){e.msg="header crc mismatch",s.mode=30;break}u=c=0}s.head&&(s.head.hcrc=s.flags>>9&1,s.head.done=!0),e.adler=s.check=0,s.mode=12;break;case 10:for(;u<32;){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}e.adler=s.check=B(c),u=c=0,s.mode=11;case 11:if(0===s.havedict)return e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=a,s.hold=c,s.bits=u,2;e.adler=s.check=1,s.mode=12;case 12:if(5===t||6===t)break e;case 13:if(s.last)c>>>=7&u,u-=7&u,s.mode=27;else{for(;u<3;){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}switch(s.last=1&c,--u,3&(c>>>=1)){case 0:s.mode=14;break;case 1:R=D=void 0;var R,D=s;if(q){for(x=new P.Buf32(512),V=new P.Buf32(32),R=0;R<144;)D.lens[R++]=8;for(;R<256;)D.lens[R++]=9;for(;R<280;)D.lens[R++]=7;for(;R<288;)D.lens[R++]=8;for(k(1,D.lens,0,288,x,0,D.work,{bits:9}),R=0;R<32;)D.lens[R++]=5;k(2,D.lens,0,32,V,0,D.work,{bits:5}),q=!1}if(D.lencode=x,D.lenbits=9,D.distcode=V,D.distbits=5,s.mode=20,6!==t)break;c>>>=2,u-=2;break e;case 2:s.mode=17;break;case 3:e.msg="invalid block type",s.mode=30}c>>>=2,u-=2}break;case 14:for(c>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",s.mode=30;break}if(s.length=65535&c,u=c=0,s.mode=15,6===t)break e;case 15:s.mode=16;case 16:if(h=s.length){if(0===(h=l<(h=a<h?a:h)?l:h))break e;P.arraySet(i,n,r,h,o),a-=h,r+=h,l-=h,o+=h,s.length-=h}else s.mode=12;break;case 17:for(;u<14;){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}if(s.nlen=257+(31&c),c>>>=5,u-=5,s.ndist=1+(31&c),c>>>=5,u-=5,s.ncode=4+(15&c),c>>>=4,u-=4,286<s.nlen||30<s.ndist){e.msg="too many length or distance symbols",s.mode=30;break}s.have=0,s.mode=18;case 18:for(;s.have<s.ncode;){for(;u<3;){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}s.lens[N[s.have++]]=7&c,c>>>=3,u-=3}for(;s.have<19;)s.lens[N[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,O={bits:s.lenbits},M=k(0,s.lens,0,19,s.lencode,0,s.work,O),s.lenbits=O.bits,M){e.msg="invalid code lengths set",s.mode=30;break}s.have=0,s.mode=19;case 19:for(;s.have<s.nlen+s.ndist;){for(;m=(T=s.lencode[c&(1<<s.lenbits)-1])>>>16&255,S=65535&T,!((E=T>>>24)<=u);){if(0===a)break e;a--,c+=n[r++]<<u,u+=8}if(S<16)c>>>=E,u-=E,s.lens[s.have++]=S;else{if(16===S){for(y=E+2