"use strict"; /** * @vue/shared v3.4.21 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/ function e(e,t){const n=new Set(e.split(","));return t?e=>n.has(e.toLowerCase()):e=>n.has(e)}const t={},n=[],i=()=>{},o=()=>!1,s=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),a=e=>e.startsWith("onUpdate:"),r=Object.assign,c=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},u=Object.prototype.hasOwnProperty,l=(e,t)=>u.call(e,t),d=Array.isArray,p=e=>"[object Map]"===I(e),h=e=>"[object Set]"===I(e),g=e=>"function"==typeof e,f=e=>"string"==typeof e,m=e=>"symbol"==typeof e,_=e=>null!==e&&"object"==typeof e,v=e=>(_(e)||g(e))&&g(e.then)&&g(e.catch),y=Object.prototype.toString,I=e=>y.call(e),M=e=>"[object Object]"===I(e),C=e=>f(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,S=e(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),E=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},T=/-(\w)/g,k=E((e=>e.replace(T,((e,t)=>t?t.toUpperCase():"")))),D=/\B([A-Z])/g,R=E((e=>e.replace(D,"-$1").toLowerCase())),O=E((e=>e.charAt(0).toUpperCase()+e.slice(1))),b=E((e=>e?`on${O(e)}`:"")),A=(e,t)=>!Object.is(e,t),L=(e,t)=>{for(let n=0;n{const t=parseFloat(e);return isNaN(t)?e:t};function N(e){if(d(e)){const t={};for(let n=0;n{if(e){const n=e.split(U);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function F(e){let t="";if(f(e))t=e;else if(d(e))for(let n=0;nt&&t.__v_isRef?B(e,t.value):p(t)?{[`Map(${t.size})`]:[...t.entries()].reduce(((e,[t,n],i)=>(e[q(t,i)+" =>"]=n,e)),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map((e=>q(e)))}:m(t)?q(t):!_(t)||d(t)||M(t)?t:String(t),q=(e,t="")=>{var n;return m(e)?`Symbol(${null!=(n=e.description)?n:t})`:e},V="onShow",j="onHide",H="onLaunch",K="onError",z="onThemeChange",W="onPageNotFound",Y="onUnhandledRejection",$="onLoad",J="onReady",X="onUnload",Q="onInit",Z="onSaveExitState",ee="onResize",te="onBackPress",ne="onPageScroll",ie="onTabItemTap",oe="onReachBottom",se="onPullDownRefresh",ae="onShareTimeline",re="onShareChat",ce="onAddToFavorites",ue="onShareAppMessage",le="onNavigationBarButtonTap",de="onNavigationBarSearchInputClicked",pe="onNavigationBarSearchInputChanged",he="onNavigationBarSearchInputConfirmed",ge="onNavigationBarSearchInputFocusChanged",fe="virtualHostId";function me(e,t=null){let n;return(...i)=>(e&&(n=e.apply(t,i),e=null),n)}function _e(e,t){if(!f(t))return;const n=(t=t.replace(/\[(\d+)\]/g,".$1")).split(".");let i=n[0];return e||(e={}),1===n.length?e[i]:_e(e[i],n.slice(1).join("."))}function ve(e){let t={};return M(e)&&Object.keys(e).sort().forEach((n=>{const i=n;t[i]=e[i]})),Object.keys(t)?t:e}const ye=/:/g;const Ie=encodeURIComponent;function Me(e,t=Ie){const n=e?Object.keys(e).map((n=>{let i=e[n];return void 0===typeof i||null===i?i="":M(i)&&(i=JSON.stringify(i)),t(n)+"="+t(i)})).filter((e=>e.length>0)).join("&"):null;return n?`?${n}`:""}const Ce=[Q,$,V,j,X,te,ne,ie,oe,se,ae,ue,re,ce,Z,le,de,pe,he,ge];const Se=[V,j,H,K,z,W,Y,"onExit",Q,$,J,X,ee,te,ne,ie,oe,se,ae,ce,ue,re,Z,le,de,pe,he,ge],Ee=(()=>({onPageScroll:1,onShareAppMessage:2,onShareTimeline:4}))();function Te(e,t,n=!0){return!(n&&!g(t))&&(Se.indexOf(e)>-1||0===e.indexOf("on"))}let ke;const De=[];const Re=me(((e,t)=>t(e))),Oe=function(){};Oe.prototype={_id:1,on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n,_id:this._id}),this._id++},once:function(e,t,n){var i=this;function o(){i.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,o=n.length;i=0;s--)if(i[s].fn===t||i[s].fn._===t||i[s]._id===t){i.splice(s,1);break}o=i}return o.length?n[e]=o:delete n[e],this}};var be=Oe;const Ae=["{","}"];const Le=/^(?:\d)+/,Pe=/^(?:\w)+/;const Ne="zh-Hans",we="zh-Hant",Ue="en",Ge=Object.prototype.hasOwnProperty,xe=(e,t)=>Ge.call(e,t),Fe=new class{constructor(){this._caches=Object.create(null)}interpolate(e,t,n=Ae){if(!t)return[e];let i=this._caches[e];return i||(i=function(e,[t,n]){const i=[];let o=0,s="";for(;o-1?Ne:e.indexOf("-hant")>-1?we:(n=e,["-tw","-hk","-mo","-cht"].find((e=>-1!==n.indexOf(e)))?we:Ne);var n;let i=[Ue,"fr","es"];t&&Object.keys(t).length>0&&(i=Object.keys(t));const o=function(e,t){return t.find((t=>0===e.indexOf(t)))}(e,i);return o||void 0}class qe{constructor({locale:e,fallbackLocale:t,messages:n,watcher:i,formater:o}){this.locale=Ue,this.fallbackLocale=Ue,this.message={},this.messages={},this.watchers=[],t&&(this.fallbackLocale=t),this.formater=o||Fe,this.messages=n||{},this.setLocale(e||Ue),i&&this.watchLocale(i)}setLocale(e){const t=this.locale;this.locale=Be(e,this.messages)||this.fallbackLocale,this.messages[this.locale]||(this.messages[this.locale]={}),this.message=this.messages[this.locale],t!==this.locale&&this.watchers.forEach((e=>{e(this.locale,t)}))}getLocale(){return this.locale}watchLocale(e){const t=this.watchers.push(e)-1;return()=>{this.watchers.splice(t,1)}}add(e,t,n=!0){const i=this.messages[e];i?n?Object.assign(i,t):Object.keys(t).forEach((e=>{xe(i,e)||(i[e]=t[e])})):this.messages[e]=t}f(e,t,n){return this.formater.interpolate(e,t,n).join("")}t(e,t,n){let i=this.message;return"string"==typeof t?(t=Be(t,this.messages))&&(i=this.messages[t]):n=t,xe(i,e)?this.formater.interpolate(i[e],n).join(""):(console.warn(`Cannot translate the value of keypath ${e}. Use the value of keypath as default.`),e)}}function Ve(e){return function(){try{return e.apply(e,arguments)}catch(Yr){console.error(Yr)}}}let je=1;const He={};function Ke(e,t,n){if("number"==typeof e){const i=He[e];if(i)return i.keepAlive||delete He[e],i.callback(t,n)}return t}const ze="success",We="fail",Ye="complete";function $e(e,t={},{beforeAll:n,beforeSuccess:i}={}){M(t)||(t={});const{success:o,fail:s,complete:a}=function(e){const t={};for(const n in e){const i=e[n];g(i)&&(t[n]=Ve(i),delete e[n])}return t}(t),r=g(o),c=g(s),u=g(a),l=je++;return function(e,t,n,i=!1){He[e]={name:t,keepAlive:i,callback:n}}(l,e,(l=>{(l=l||{}).errMsg=function(e,t){return e&&-1!==e.indexOf(":fail")?t+e.substring(e.indexOf(":fail")):t+":ok"}(l.errMsg,e),g(n)&&n(l),l.errMsg===e+":ok"?(g(i)&&i(l,t),r&&o(l)):c&&s(l),u&&a(l)})),l}const Je="success",Xe="fail",Qe="complete",Ze={},et={};function nt(e,t){return function(n){return e(n,t)||n}}function it(e,t,n){let i=!1;for(let o=0;oe(t),catch(){}}}function ot(e,t={}){return[Je,Xe,Qe].forEach((n=>{const i=e[n];if(!d(i))return;const o=t[n];t[n]=function(e){it(i,e,t).then((e=>g(o)&&o(e)||e))}})),t}function st(e,t){const n=[];d(Ze.returnValue)&&n.push(...Ze.returnValue);const i=et[e];return i&&d(i.returnValue)&&n.push(...i.returnValue),n.forEach((e=>{t=e(t)||t})),t}function at(e){const t=Object.create(null);Object.keys(Ze).forEach((e=>{"returnValue"!==e&&(t[e]=Ze[e].slice())}));const n=et[e];return n&&Object.keys(n).forEach((e=>{"returnValue"!==e&&(t[e]=(t[e]||[]).concat(n[e]))})),t}function rt(e,t,n,i){const o=at(e);if(o&&Object.keys(o).length){if(d(o.invoke)){return it(o.invoke,n).then((n=>t(ot(at(e),n),...i)))}return t(ot(o,n),...i)}return t(n,...i)}function ct(e,t){return(n={},...i)=>function(e){return!(!M(e)||![ze,We,Ye].find((t=>g(e[t]))))}(n)?st(e,rt(e,t,r({},n),i)):st(e,new Promise(((o,s)=>{rt(e,t,r({},n,{success:o,fail:s}),i)})))}function ut(e,t,n,i={}){const o=t+":fail";let s="";return s=n?0===n.indexOf(o)?n:o+" "+n:o,delete i.errCode,Ke(e,r({errMsg:s},i))}function lt(e,t,n,i){const o=function(e){e[0]}(t);if(o)return o}function dt(e,t,n,i){return n=>{const o=$e(e,n,i),s=lt(0,[n]);return s?ut(o,e,s):t(n,{resolve:t=>function(e,t,n){return Ke(e,r(n||{},{errMsg:t+":ok"}))}(o,e,t),reject:(t,n)=>ut(o,e,function(e){return!e||f(e)?e:e.stack?("undefined"!=typeof globalThis&&globalThis.harmonyChannel||console.error(e.message+"\n"+e.stack),e.message):e}(t),n)})}}function pt(e,t,n,i){return function(e,t){return(...e)=>{const n=lt(0,e);if(n)throw new Error(n);return t.apply(null,e)}}(0,t)}let ht=!1,gt=0,ft=0;const mt=pt(0,((e,t)=>{if(0===gt&&function(){var e,t;let n,i,o;{const s=(null===(e=wx.getWindowInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync(),a=(null===(t=wx.getDeviceInfo)||void 0===t?void 0:t.call(wx))||wx.getSystemInfoSync();n=s.windowWidth,i=s.pixelRatio,o=a.platform}gt=n,ft=i,ht="ios"===o}(),0===(e=Number(e)))return 0;let n=e/750*(t||gt);return n<0&&(n=-n),n=Math.floor(n+1e-4),0===n&&(n=1!==ft&&ht?.5:1),e<0?-n:n}));function _t(e,t){Object.keys(t).forEach((n=>{g(t[n])&&(e[n]=function(e,t){const n=t?e?e.concat(t):d(t)?t:[t]:e;return n?function(e){const t=[];for(let n=0;n{const i=e[n],o=t[n];d(i)&&g(o)&&c(i,o)}))}const yt=pt(0,((e,t)=>{f(e)&&M(t)?_t(et[e]||(et[e]={}),t):M(e)&&_t(Ze,e)})),It=pt(0,((e,t)=>{f(e)?M(t)?vt(et[e],t):delete et[e]:M(e)&&vt(Ze,e)}));const Mt=new class{constructor(){this.$emitter=new be}on(e,t){return this.$emitter.on(e,t)}once(e,t){return this.$emitter.once(e,t)}off(e,t){e?this.$emitter.off(e,t):this.$emitter.e={}}emit(e,...t){this.$emitter.emit(e,...t)}},Ct=pt(0,((e,t)=>(Mt.on(e,t),()=>Mt.off(e,t)))),St=pt(0,((e,t)=>(Mt.once(e,t),()=>Mt.off(e,t)))),Et=pt(0,((e,t)=>{d(e)||(e=e?[e]:[]),e.forEach((e=>{Mt.off(e,t)}))})),Tt=pt(0,((e,...t)=>{Mt.emit(e,...t)}));let kt,Dt,Rt;function Ot(e){try{return JSON.parse(e)}catch(Yr){}return e}const bt=[];function At(e,t){bt.forEach((n=>{n(e,t)})),bt.length=0}const Lt=ct(Pt="getPushClientId",function(e,t,n,i){return dt(e,t,0,i)}(Pt,((e,{resolve:t,reject:n})=>{Promise.resolve().then((()=>{void 0===Rt&&(Rt=!1,kt="",Dt="uniPush is not enabled"),bt.push(((e,i)=>{e?t({cid:e}):n(i)})),void 0!==kt&&At(kt,Dt)}))}),0,Nt));var Pt,Nt;const wt=[],Ut=/^\$|__f__|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|rpx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo|getSystemSetting|getAppAuthorizeSetting/,Gt=/^create|Manager$/,xt=["createBLEConnection"],Ft=["request","downloadFile","uploadFile","connectSocket"],Bt=["createBLEConnection"],qt=/^on|^off/;function Vt(e){return Gt.test(e)&&-1===xt.indexOf(e)}function jt(e){return Ut.test(e)&&-1===Bt.indexOf(e)}function Ht(e){return-1!==Ft.indexOf(e)}function Kt(e){return!(Vt(e)||jt(e)||function(e){return qt.test(e)&&"onPush"!==e}(e))}function zt(e,t){return Kt(e)&&g(t)?function(n={},...i){return g(n.success)||g(n.fail)||g(n.complete)?st(e,rt(e,t,r({},n),i)):st(e,new Promise(((o,s)=>{rt(e,t,r({},n,{success:o,fail:s}),i)})))}:t}Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((n=>t.resolve(e&&e()).then((()=>n))),(n=>t.resolve(e&&e()).then((()=>{throw n}))))});const Wt=["success","fail","cancel","complete"];const Yt=()=>{const e=g(getApp)&&getApp({allowDefault:!0});return e&&e.$vm?e.$vm.$locale:function(){var e;let t="";{const n=(null===(e=wx.getAppBaseInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync();t=Be(n&&n.language?n.language:Ue)||Ue}return t}()},$t=[];"undefined"!=typeof global&&(global.getLocale=Yt);const Jt="__DC_STAT_UUID";let Xt;function Qt(e=wx){return function(t,n){Xt=Xt||e.getStorageSync(Jt),Xt||(Xt=Date.now()+""+Math.floor(1e7*Math.random()),wx.setStorage({key:Jt,data:Xt})),n.deviceId=Xt}}function Zt(e,t){if(e.safeArea){const n=e.safeArea;t.safeAreaInsets={top:n.top,left:n.left,right:e.windowWidth-n.right,bottom:e.screenHeight-n.bottom}}}function en(e,t){let n="",i="";switch(n=e.split(" ")[0]||t,i=e.split(" ")[1]||"",n=n.toLowerCase(),n){case"harmony":case"ohos":case"openharmony":n="harmonyos";break;case"iphone os":n="ios";break;case"mac":case"darwin":n="macos";break;case"windows_nt":n="windows"}return{osName:n,osVersion:i}}function tn(e,t){let n=e.deviceType||"phone";{const e={ipad:"pad",windows:"pc",mac:"pc"},i=Object.keys(e),o=t.toLowerCase();for(let t=0;t{Zt(e,t),Qt()(e,t),function(e,t){const{brand:n="",model:i="",system:o="",language:s="",theme:a,version:c,platform:u,fontSizeSetting:l,SDKVersion:d,pixelRatio:p,deviceOrientation:h}=e,{osName:g,osVersion:f}=en(o,u);let m=c,_=tn(e,i),v=nn(n),y=sn(e),I=h,M=p,C=d;const S=(s||"").replace(/_/g,"-"),E={appId:"__UNI__A6CDB98",appName:"tk-mini-program",appVersion:"1.0.0",appVersionCode:"100",appLanguage:on(S),uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75",uniPlatform:"mp-weixin",deviceBrand:v,deviceModel:i,deviceType:_,devicePixelRatio:M,deviceOrientation:I,osName:g,osVersion:f,hostTheme:a,hostVersion:m,hostLanguage:S,hostName:y,hostSDKVersion:C,hostFontSizeSetting:l,windowTop:0,windowBottom:0,osLanguage:void 0,osTheme:void 0,ua:void 0,hostPackageName:void 0,browserName:void 0,browserVersion:void 0,isUniAppX:!1};r(t,E)}(e,t)}},rn=an,cn={args(e,t){let n=parseInt(e.current);if(isNaN(n))return;const i=e.urls;if(!d(i))return;const o=i.length;return o?(n<0?n=0:n>=o&&(n=o-1),n>0?(t.current=i[n],t.urls=i.filter(((e,t)=>!(t{const{brand:n,model:i,system:o="",platform:s=""}=e;let a=tn(e,i),c=nn(n);Qt()(e,t);const{osName:u,osVersion:l}=en(o,s);t=ve(r(t,{deviceType:a,deviceBrand:c,deviceModel:i,osName:u,osVersion:l}))}},dn={returnValue:(e,t)=>{const{version:n,language:i,SDKVersion:o,theme:s}=e;let a=sn(e),c=(i||"").replace(/_/g,"-");const u={hostVersion:n,hostLanguage:c,hostName:a,hostSDKVersion:o,hostTheme:s,appId:"__UNI__A6CDB98",appName:"tk-mini-program",appVersion:"1.0.0",appVersionCode:"100",appLanguage:on(c),isUniAppX:!1,uniPlatform:"mp-weixin",uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75"};r(t,u)}},pn={returnValue:(e,t)=>{Zt(e,t),t=ve(r(t,{windowTop:0,windowBottom:0}))}},hn={args(e){const t=getApp({allowDefault:!0})||{};t.$vm?Zo(K,e,t.$vm.$):(wx.$onErrorHandlers||(wx.$onErrorHandlers=[]),wx.$onErrorHandlers.push(e))}},gn={args(e){const t=getApp({allowDefault:!0})||{};if(t.$vm){if(e.__weh){const n=t.$vm.$[K];if(n){const t=n.indexOf(e.__weh);t>-1&&n.splice(t,1)}}}else{if(!wx.$onErrorHandlers)return;const t=wx.$onErrorHandlers.findIndex((t=>t===e));-1!==t&&wx.$onErrorHandlers.splice(t,1)}}},fn={args(){if(wx.__uni_console__){if(wx.__uni_console_warned__)return;wx.__uni_console_warned__=!0,console.warn("开发模式下小程序日志回显会使用 socket 连接,为了避免冲突,建议使用 SocketTask 的方式去管理 WebSocket 或手动关闭日志回显功能。[详情](https://uniapp.dcloud.net.cn/tutorial/run/mp-log.html)")}}},mn=fn,_n={$on:Ct,$off:Et,$once:St,$emit:Tt,upx2px:mt,rpx2px:mt,interceptors:{},addInterceptor:yt,removeInterceptor:It,onCreateVueApp:function(e){if(ke)return e(ke);De.push(e)},invokeCreateVueAppHook:function(e){ke=e,De.forEach((t=>t(e)))},getLocale:Yt,setLocale:e=>{const t=g(getApp)&&getApp();if(!t)return!1;return t.$vm.$locale!==e&&(t.$vm.$locale=e,$t.forEach((t=>t({locale:e}))),!0)},onLocaleChange:e=>{-1===$t.indexOf(e)&&$t.push(e)},getPushClientId:Lt,onPushMessage:e=>{-1===wt.indexOf(e)&&wt.push(e)},offPushMessage:e=>{if(e){const t=wt.indexOf(e);t>-1&&wt.splice(t,1)}else wt.length=0},invokePushCallback:function(e){if("enabled"===e.type)Rt=!0;else if("clientId"===e.type)kt=e.cid,Dt=e.errMsg,At(kt,e.errMsg);else if("pushMsg"===e.type){const t={type:"receive",data:Ot(e.message)};for(let e=0;e{t({type:"click",data:Ot(e.message)})}))},__f__:function(e,t,...n){t&&n.push(t),console[e].apply(console,n)}};const vn=["qy","env","error","version","lanDebug","cloud","serviceMarket","router","worklet","__webpack_require_UNI_MP_PLUGIN__"],yn=["lanDebug","router","worklet"],In=wx.getLaunchOptionsSync?wx.getLaunchOptionsSync():null;function Mn(e){return(!In||1154!==In.scene||!yn.includes(e))&&(vn.indexOf(e)>-1||"function"==typeof wx[e])}function Cn(){const e={};for(const t in wx)Mn(t)&&(e[t]=wx[t]);return"undefined"!=typeof globalThis&&"undefined"==typeof requireMiniProgram&&(globalThis.wx=e),e}const Sn=["__route__","__wxExparserNodeId__","__wxWebviewId__"],En=(Tn={oauth:["weixin"],share:["weixin"],payment:["wxpay"],push:["weixin"]},function({service:e,success:t,fail:n,complete:i}){let o;Tn[e]?(o={errMsg:"getProvider:ok",service:e,provider:Tn[e]},g(t)&&t(o)):(o={errMsg:"getProvider:fail:服务["+e+"]不存在"},g(n)&&n(o)),g(i)&&i(o)});var Tn;const kn=Cn();kn.canIUse("getAppBaseInfo")||(kn.getAppBaseInfo=kn.getSystemInfoSync),kn.canIUse("getWindowInfo")||(kn.getWindowInfo=kn.getSystemInfoSync),kn.canIUse("getDeviceInfo")||(kn.getDeviceInfo=kn.getSystemInfoSync);let Dn=kn.getAppBaseInfo&&kn.getAppBaseInfo();Dn||(Dn=kn.getSystemInfoSync());const Rn=Dn?Dn.host:null,On=Rn&&"SAAASDK"===Rn.env?kn.miniapp.shareVideoMessage:kn.shareVideoMessage;var bn=Object.freeze({__proto__:null,createSelectorQuery:function(){const e=kn.createSelectorQuery(),t=e.in;return e.in=function(e){return e.$scope?t.call(this,e.$scope):t.call(this,function(e){const t=Object.create(null);return Sn.forEach((n=>{t[n]=e[n]})),t}(e))},e},getProvider:En,shareVideoMessage:On});const An={args(e,t){e.compressedHeight&&!t.compressHeight&&(t.compressHeight=e.compressedHeight),e.compressedWidth&&!t.compressWidth&&(t.compressWidth=e.compressedWidth)}};var Ln=Object.freeze({__proto__:null,compressImage:An,getAppAuthorizeSetting:{returnValue:function(e,t){const{locationReducedAccuracy:n}=e;t.locationAccuracy="unsupported",!0===n?t.locationAccuracy="reduced":!1===n&&(t.locationAccuracy="full")}},getAppBaseInfo:dn,getDeviceInfo:ln,getSystemInfo:an,getSystemInfoSync:rn,getWindowInfo:pn,offError:gn,onError:hn,onSocketMessage:mn,onSocketOpen:fn,previewImage:cn,redirectTo:{},showActionSheet:un});const Pn=Cn();var Nn=function(e,t,n=wx){const i=function(e){function t(e,t,n){return function(o){return t(i(e,o,n))}}function n(e,n,i={},o={},s=!1){if(M(n)){const a=!0===s?n:{};g(i)&&(i=i(n,a)||{});for(const r in n)if(l(i,r)){let t=i[r];g(t)&&(t=t(n[r],n,a)),t?f(t)?a[t]=n[r]:M(t)&&(a[t.name?t.name:r]=t.value):console.warn(`微信小程序 ${e} 暂不支持 ${r}`)}else if(-1!==Wt.indexOf(r)){const i=n[r];g(i)&&(a[r]=t(e,i,o))}else s||l(a,r)||(a[r]=n[r]);return a}return g(n)&&(g(i)&&i(n,{}),n=t(e,n,o)),n}function i(t,i,o,s=!1){return g(e.returnValue)&&(i=e.returnValue(t,i)),n(t,i,o,{},s||!1)}return function(t,o){const s=l(e,t);if(!s&&"function"!=typeof wx[t])return o;const a=s||g(e.returnValue)||Vt(t)||Ht(t),r=s||g(o);if(!s&&!o)return function(){console.error(`微信小程序 暂不支持${t}`)};if(!a||!r)return o;const c=e[t];return function(e,o){let s=c||{};g(c)&&(s=c(e));const a=[e=n(t,e,s.args,s.returnValue)];void 0!==o&&a.push(o);const r=wx[s.name||t].apply(wx,a);return(Vt(t)||Ht(t))&&r&&!r.__v_skip&&(r.__v_skip=!0),jt(t)?i(t,r,s.returnValue,Vt(t)):r}}}(t);return new Proxy({},{get:(t,o)=>l(t,o)?t[o]:l(e,o)?zt(o,e[o]):l(_n,o)?zt(o,_n[o]):zt(o,i(o,n[o]))})}(bn,Ln,Pn);let wn,Un;class Gn{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=wn,!e&&wn&&(this.index=(wn.scopes||(wn.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const t=wn;try{return wn=this,e()}finally{wn=t}}}on(){wn=this}off(){wn=this.parent}stop(e){if(this._active){let t,n;for(t=0,n=this.effects.length;t=4))break}1===this._dirtyLevel&&(this._dirtyLevel=0),Yn()}return this._dirtyLevel>=4}set dirty(e){this._dirtyLevel=e?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let e=Hn,t=Un;try{return Hn=!0,Un=this,this._runnings++,qn(this),this.fn()}finally{Vn(this),this._runnings--,Un=t,Hn=e}}stop(){var e;this.active&&(qn(this),Vn(this),null==(e=this.onStop)||e.call(this),this.active=!1)}}function qn(e){e._trackId++,e._depsLength=0}function Vn(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t{const n=new Map;return n.cleanup=e,n.computed=t,n},ti=new WeakMap,ni=Symbol(""),ii=Symbol("");function oi(e,t,n){if(Hn&&Un){let t=ti.get(e);t||ti.set(e,t=new Map);let i=t.get(n);i||t.set(n,i=ei((()=>t.delete(n)))),Xn(Un,i)}}function si(e,t,n,i,o,s){const a=ti.get(e);if(!a)return;let r=[];if("clear"===t)r=[...a.values()];else if("length"===n&&d(e)){const e=Number(i);a.forEach(((t,n)=>{("length"===n||!m(n)&&n>=e)&&r.push(t)}))}else switch(void 0!==n&&r.push(a.get(n)),t){case"add":d(e)?C(n)&&r.push(a.get("length")):(r.push(a.get(ni)),p(e)&&r.push(a.get(ii)));break;case"delete":d(e)||(r.push(a.get(ni)),p(e)&&r.push(a.get(ii)));break;case"set":p(e)&&r.push(a.get(ni))}$n();for(const c of r)c&&Zn(c,4);Jn()}const ai=e("__proto__,__v_isRef,__isVue"),ri=new Set(Object.getOwnPropertyNames(Symbol).filter((e=>"arguments"!==e&&"caller"!==e)).map((e=>Symbol[e])).filter(m)),ci=ui();function ui(){const e={};return["includes","indexOf","lastIndexOf"].forEach((t=>{e[t]=function(...e){const n=$i(this);for(let t=0,o=this.length;t{e[t]=function(...e){Wn(),$n();const n=$i(this)[t].apply(this,e);return Jn(),Yn(),n}})),e}function li(e){const t=$i(this);return oi(t,0,e),t.hasOwnProperty(e)}class di{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){const i=this._isReadonly,o=this._isShallow;if("__v_isReactive"===t)return!i;if("__v_isReadonly"===t)return i;if("__v_isShallow"===t)return o;if("__v_raw"===t)return n===(i?o?qi:Bi:o?Fi:xi).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const s=d(e);if(!i){if(s&&l(ci,t))return Reflect.get(ci,t,n);if("hasOwnProperty"===t)return li}const a=Reflect.get(e,t,n);return(m(t)?ri.has(t):ai(t))?a:(i||oi(e,0,t),o?a:no(a)?s&&C(t)?a:a.value:_(a)?i?Hi(a):ji(a):a)}}class pi extends di{constructor(e=!1){super(!1,e)}set(e,t,n,i){let o=e[t];if(!this._isShallow){const t=Wi(o);if(Yi(n)||Wi(n)||(o=$i(o),n=$i(n)),!d(e)&&no(o)&&!no(n))return!t&&(o.value=n,!0)}const s=d(e)&&C(t)?Number(t)e,vi=e=>Reflect.getPrototypeOf(e);function yi(e,t,n=!1,i=!1){const o=$i(e=e.__v_raw),s=$i(t);n||(A(t,s)&&oi(o,0,t),oi(o,0,s));const{has:a}=vi(o),r=i?_i:n?Qi:Xi;return a.call(o,t)?r(e.get(t)):a.call(o,s)?r(e.get(s)):void(e!==o&&e.get(t))}function Ii(e,t=!1){const n=this.__v_raw,i=$i(n),o=$i(e);return t||(A(e,o)&&oi(i,0,e),oi(i,0,o)),e===o?n.has(e):n.has(e)||n.has(o)}function Mi(e,t=!1){return e=e.__v_raw,!t&&oi($i(e),0,ni),Reflect.get(e,"size",e)}function Ci(e){e=$i(e);const t=$i(this);return vi(t).has.call(t,e)||(t.add(e),si(t,"add",e,e)),this}function Si(e,t){t=$i(t);const n=$i(this),{has:i,get:o}=vi(n);let s=i.call(n,e);s||(e=$i(e),s=i.call(n,e));const a=o.call(n,e);return n.set(e,t),s?A(t,a)&&si(n,"set",e,t):si(n,"add",e,t),this}function Ei(e){const t=$i(this),{has:n,get:i}=vi(t);let o=n.call(t,e);o||(e=$i(e),o=n.call(t,e)),i&&i.call(t,e);const s=t.delete(e);return o&&si(t,"delete",e,void 0),s}function Ti(){const e=$i(this),t=0!==e.size,n=e.clear();return t&&si(e,"clear",void 0,void 0),n}function ki(e,t){return function(n,i){const o=this,s=o.__v_raw,a=$i(s),r=t?_i:e?Qi:Xi;return!e&&oi(a,0,ni),s.forEach(((e,t)=>n.call(i,r(e),r(t),o)))}}function Di(e,t,n){return function(...i){const o=this.__v_raw,s=$i(o),a=p(s),r="entries"===e||e===Symbol.iterator&&a,c="keys"===e&&a,u=o[e](...i),l=n?_i:t?Qi:Xi;return!t&&oi(s,0,c?ii:ni),{next(){const{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:r?[l(e[0]),l(e[1])]:l(e),done:t}},[Symbol.iterator](){return this}}}}function Ri(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}function Oi(){const e={get(e){return yi(this,e)},get size(){return Mi(this)},has:Ii,add:Ci,set:Si,delete:Ei,clear:Ti,forEach:ki(!1,!1)},t={get(e){return yi(this,e,!1,!0)},get size(){return Mi(this)},has:Ii,add:Ci,set:Si,delete:Ei,clear:Ti,forEach:ki(!1,!0)},n={get(e){return yi(this,e,!0)},get size(){return Mi(this,!0)},has(e){return Ii.call(this,e,!0)},add:Ri("add"),set:Ri("set"),delete:Ri("delete"),clear:Ri("clear"),forEach:ki(!0,!1)},i={get(e){return yi(this,e,!0,!0)},get size(){return Mi(this,!0)},has(e){return Ii.call(this,e,!0)},add:Ri("add"),set:Ri("set"),delete:Ri("delete"),clear:Ri("clear"),forEach:ki(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((o=>{e[o]=Di(o,!1,!1),n[o]=Di(o,!0,!1),t[o]=Di(o,!1,!0),i[o]=Di(o,!0,!0)})),[e,n,t,i]}const[bi,Ai,Li,Pi]=Oi();function Ni(e,t){const n=t?e?Pi:Li:e?Ai:bi;return(t,i,o)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(l(n,i)&&i in t?n:t,i,o)}const wi={get:Ni(!1,!1)},Ui={get:Ni(!1,!0)},Gi={get:Ni(!0,!1)},xi=new WeakMap,Fi=new WeakMap,Bi=new WeakMap,qi=new WeakMap;function Vi(e){return e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((e=>I(e).slice(8,-1))(e))}function ji(e){return Wi(e)?e:Ki(e,!1,gi,wi,xi)}function Hi(e){return Ki(e,!0,fi,Gi,Bi)}function Ki(e,t,n,i,o){if(!_(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const s=o.get(e);if(s)return s;const a=Vi(e);if(0===a)return e;const r=new Proxy(e,2===a?i:n);return o.set(e,r),r}function zi(e){return Wi(e)?zi(e.__v_raw):!(!e||!e.__v_isReactive)}function Wi(e){return!(!e||!e.__v_isReadonly)}function Yi(e){return!(!e||!e.__v_isShallow)}function $i(e){const t=e&&e.__v_raw;return t?$i(t):e}function Ji(e){return Object.isExtensible(e)&&((e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})})(e,"__v_skip",!0),e}const Xi=e=>_(e)?ji(e):e,Qi=e=>_(e)?Hi(e):e;class Zi{constructor(e,t,n,i){this.getter=e,this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new Bn((()=>e(this._value)),(()=>to(this,2===this.effect._dirtyLevel?2:3))),this.effect.computed=this,this.effect.active=this._cacheable=!i,this.__v_isReadonly=n}get value(){const e=$i(this);return e._cacheable&&!e.effect.dirty||!A(e._value,e._value=e.effect.run())||to(e,4),eo(e),e.effect._dirtyLevel>=2&&to(e,2),e._value}set value(e){this._setter(e)}get _dirty(){return this.effect.dirty}set _dirty(e){this.effect.dirty=e}}function eo(e){var t;Hn&&Un&&(e=$i(e),Xn(Un,null!=(t=e.dep)?t:e.dep=ei((()=>e.dep=void 0),e instanceof Zi?e:void 0)))}function to(e,t=4,n){const i=(e=$i(e)).dep;i&&Zn(i,t)}function no(e){return!(!e||!0!==e.__v_isRef)}function io(e){return function(e,t){if(no(e))return e;return new oo(e,t)}(e,!1)}class oo{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:$i(e),this._value=t?e:Xi(e)}get value(){return eo(this),this._value}set value(e){const t=this.__v_isShallow||Yi(e)||Wi(e);e=t?e:$i(e),A(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:Xi(e),to(this,4))}}function so(e){return no(e)?e.value:e}const ao={get:(e,t,n)=>so(Reflect.get(e,t,n)),set:(e,t,n,i)=>{const o=e[t];return no(o)&&!no(n)?(o.value=n,!0):Reflect.set(e,t,n,i)}};function ro(e){return zi(e)?e:new Proxy(e,ao)}class co{constructor(e,t,n){this._object=e,this._key=t,this._defaultValue=n,this.__v_isRef=!0}get value(){const e=this._object[this._key];return void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return e=$i(this._object),t=this._key,null==(n=ti.get(e))?void 0:n.get(t);var e,t,n}}function uo(e,t,n){const i=e[t];return no(i)?i:new co(e,t,n)}function lo(e,t,n,i){try{return i?e(...i):e()}catch(o){ho(o,t,n)}}function po(e,t,n,i){if(g(e)){const o=lo(e,t,n,i);return o&&v(o)&&o.catch((e=>{ho(e,t,n)})),o}const o=[];for(let s=0;s>>1,o=_o[i],s=Oo(o);snull==e.id?1/0:e.id,bo=(e,t)=>{const n=Oo(e)-Oo(t);if(0===n){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function Ao(e){mo=!1,fo=!0,_o.sort(bo);try{for(vo=0;vo<_o.length;vo++){const e=_o[vo];e&&!1!==e.active&&lo(e,null,14)}}finally{vo=0,_o.length=0,function(){if(yo.length){const e=[...new Set(yo)].sort(((e,t)=>Oo(e)-Oo(t)));if(yo.length=0,Io)return void Io.push(...e);for(Io=e,Mo=0;Mof(e)?e.trim():e))),n&&(s=i.map(P))}let c,u=o[c=b(n)]||o[c=b(k(n))];!u&&a&&(u=o[c=b(R(n))]),u&&po(u,e,6,s);const l=o[c+"Once"];if(l){if(e.emitted){if(e.emitted[c])return}else e.emitted={};e.emitted[c]=!0,po(l,e,6,s)}}function Po(e,t,n=!1){const i=t.emitsCache,o=i.get(e);if(void 0!==o)return o;const s=e.emits;let a={},c=!1;if(!g(e)){const i=e=>{const n=Po(e,t,!0);n&&(c=!0,r(a,n))};!n&&t.mixins.length&&t.mixins.forEach(i),e.extends&&i(e.extends),e.mixins&&e.mixins.forEach(i)}return s||c?(d(s)?s.forEach((e=>a[e]=null)):r(a,s),_(e)&&i.set(e,a),a):(_(e)&&i.set(e,null),null)}function No(e,t){return!(!e||!s(t))&&(t=t.slice(2).replace(/Once$/,""),l(e,t[0].toLowerCase()+t.slice(1))||l(e,R(t))||l(e,t))}let wo=null;function Uo(e){const t=wo;return wo=e,e&&e.type.__scopeId,t}const Go="components";function xo(e,t){return e&&(e[t]||e[k(t)]||e[O(k(t))])}const Fo={};function Bo(e,t,n){return qo(e,t,n)}function qo(e,n,{immediate:o,deep:s,flush:a,once:r,onTrack:u,onTrigger:l}=t){if(n&&r){const e=n;n=(...t)=>{e(...t),T()}}const p=qs,h=e=>!0===s?e:Ho(e,!1===s?1:void 0);let f,m,_=!1,v=!1;if(no(e)?(f=()=>e.value,_=Yi(e)):zi(e)?(f=()=>h(e),_=!0):d(e)?(v=!0,_=e.some((e=>zi(e)||Yi(e))),f=()=>e.map((e=>no(e)?e.value:zi(e)?h(e):g(e)?lo(e,p,2):void 0))):f=g(e)?n?()=>lo(e,p,2):()=>(m&&m(),po(e,p,3,[y])):i,n&&s){const e=f;f=()=>Ho(e())}let y=e=>{m=S.onStop=()=>{lo(e,p,4),m=S.onStop=void 0}},I=v?new Array(e.length).fill(Fo):Fo;const M=()=>{if(S.active&&S.dirty)if(n){const e=S.run();(s||_||(v?e.some(((e,t)=>A(e,I[t]))):A(e,I)))&&(m&&m(),po(n,p,3,[e,I===Fo?void 0:v&&I[0]===Fo?[]:I,y]),I=e)}else S.run()};let C;M.allowRecurse=!!n,"sync"===a?C=M:"post"===a?C=()=>Us(M,p&&p.suspense):(M.pre=!0,p&&(M.id=p.uid),C=()=>To(M));const S=new Bn(f,i,C),E=Fn(),T=()=>{S.stop(),E&&c(E.effects,S)};return n?o?M():I=S.run():"post"===a?Us(S.run.bind(S),p&&p.suspense):S.run(),T}function Vo(e,t,n){const i=this.proxy,o=f(e)?e.includes(".")?jo(i,e):()=>i[e]:e.bind(i,i);let s;g(t)?s=t:(s=t.handler,n=t);const a=Ks(this),r=qo(o,s.bind(i),n);return a(),r}function jo(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e0){if(n>=t)return e;n++}if((i=i||new Set).has(e))return e;if(i.add(e),no(e))Ho(e.value,t,n,i);else if(d(e))for(let o=0;o{Ho(e,t,n,i)}));else if(M(e))for(const o in e)Ho(e[o],t,n,i);return e}function Ko(){return{app:null,config:{isNativeTag:o,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let zo=0;let Wo=null;function Yo(e,t,n=!1){const i=qs||wo;if(i||Wo){const o=i?null==i.parent?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:Wo._context.provides;if(o&&e in o)return o[e];if(arguments.length>1)return n&&g(t)?t.call(i&&i.proxy):t}}function $o(e,t){Xo(e,"a",t)}function Jo(e,t){Xo(e,"da",t)}function Xo(e,t,n=qs){const i=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(Zo(t,i,n),n){let e=n.parent;for(;e&&e.parent;)e.parent.vnode.type.__isKeepAlive&&Qo(i,t,n,e),e=e.parent}}function Qo(e,t,n,i){const o=Zo(t,e,i,!0);as((()=>{c(i[t],o)}),n)}function Zo(e,t,n=qs,i=!1){if(n){(function(e){return Ce.indexOf(e)>-1})(e)&&(n=n.root);const o=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;Wn();const o=Ks(n),s=po(t,n,e,i);return o(),Yn(),s});return i?o.unshift(s):o.push(s),s}}const es=e=>(t,n=qs)=>(!Ys||"sp"===e)&&Zo(e,((...e)=>t(...e)),n),ts=es("bm"),ns=es("m"),is=es("bu"),os=es("u"),ss=es("bum"),as=es("um"),rs=es("sp"),cs=es("rtg"),us=es("rtc");function ls(e,t=qs){Zo("ec",e,t)}const ds=e=>e?Ws(e)?Xs(e)||e.proxy:ds(e.parent):null;const ps=r(Object.create(null),{$:function(e){return e},$el:e=>e.__$el||(e.__$el={}),$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>ds(e.parent),$root:e=>ds(e.root),$emit:e=>e.emit,$options:e=>Is(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,To(e.update)}),$watch:e=>Vo.bind(e)}),hs=(e,n)=>e!==t&&!e.__isScriptSetup&&l(e,n),gs={get({_:e},n){const{ctx:i,setupState:o,data:s,props:a,accessCache:r,type:c,appContext:u}=e;let d;if("$"!==n[0]){const c=r[n];if(void 0!==c)switch(c){case 1:return o[n];case 2:return s[n];case 4:return i[n];case 3:return a[n]}else{if(hs(o,n))return r[n]=1,o[n];if(s!==t&&l(s,n))return r[n]=2,s[n];if((d=e.propsOptions[0])&&l(d,n))return r[n]=3,a[n];if(i!==t&&l(i,n))return r[n]=4,i[n];ms&&(r[n]=0)}}const p=ps[n];let h,g;return p?("$attrs"===n&&oi(e,0,n),p(e)):(h=c.__cssModules)&&(h=h[n])?h:i!==t&&l(i,n)?(r[n]=4,i[n]):(g=u.config.globalProperties,l(g,n)?g[n]:void 0)},set({_:e},n,i){const{data:o,setupState:s,ctx:a}=e;return hs(s,n)?(s[n]=i,!0):o!==t&&l(o,n)?(o[n]=i,!0):!l(e.props,n)&&(("$"!==n[0]||!(n.slice(1)in e))&&(a[n]=i,!0))},has({_:{data:e,setupState:n,accessCache:i,ctx:o,appContext:s,propsOptions:a}},r){let c;return!!i[r]||e!==t&&l(e,r)||hs(n,r)||(c=a[0])&&l(c,r)||l(o,r)||l(ps,r)||l(s.config.globalProperties,r)},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:l(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function fs(e){return d(e)?e.reduce(((e,t)=>(e[t]=null,e)),{}):e}let ms=!0;function _s(e){const t=Is(e),n=e.proxy,o=e.ctx;ms=!1,t.beforeCreate&&vs(t.beforeCreate,e,"bc");const{data:s,computed:a,methods:r,watch:c,provide:u,inject:l,created:p,beforeMount:h,mounted:f,beforeUpdate:m,updated:v,activated:y,deactivated:I,beforeDestroy:M,beforeUnmount:C,destroyed:S,unmounted:E,render:T,renderTracked:k,renderTriggered:D,errorCaptured:R,serverPrefetch:O,expose:b,inheritAttrs:A,components:L,directives:P,filters:N}=t;if(l&&function(e,t){d(e)&&(e=Es(e));for(const n in e){const i=e[n];let o;o=_(i)?"default"in i?Yo(i.from||n,i.default,!0):Yo(i.from||n):Yo(i),no(o)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>o.value,set:e=>o.value=e}):t[n]=o}}(l,o),r)for(const i in r){const e=r[i];g(e)&&(o[i]=e.bind(n))}if(s){const t=s.call(n,n);_(t)&&(e.data=ji(t))}if(ms=!0,a)for(const d in a){const e=a[d],t=g(e)?e.bind(n,n):g(e.get)?e.get.bind(n,n):i,s=!g(e)&&g(e.set)?e.set.bind(n):i,r=Qs({get:t,set:s});Object.defineProperty(o,d,{enumerable:!0,configurable:!0,get:()=>r.value,set:e=>r.value=e})}if(c)for(const i in c)ys(c[i],o,n,i);function w(e,t){d(t)?t.forEach((t=>e(t.bind(n)))):t&&e(t.bind(n))}if(function(){if(u){const e=g(u)?u.call(n):u;Reflect.ownKeys(e).forEach((t=>{!function(e,t){if(qs){let n=qs.provides;const i=qs.parent&&qs.parent.provides;i===n&&(n=qs.provides=Object.create(i)),n[e]=t,"app"===qs.type.mpType&&qs.appContext.app.provide(e,t)}}(t,e[t])}))}}(),p&&vs(p,e,"c"),w(ts,h),w(ns,f),w(is,m),w(os,v),w($o,y),w(Jo,I),w(ls,R),w(us,k),w(cs,D),w(ss,C),w(as,E),w(rs,O),d(b))if(b.length){const t=e.exposed||(e.exposed={});b.forEach((e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t})}))}else e.exposed||(e.exposed={});T&&e.render===i&&(e.render=T),null!=A&&(e.inheritAttrs=A),L&&(e.components=L),P&&(e.directives=P),e.ctx.$onApplyOptions&&e.ctx.$onApplyOptions(t,e,n)}function vs(e,t,n){po(d(e)?e.map((e=>e.bind(t.proxy))):e.bind(t.proxy),t,n)}function ys(e,t,n,i){const o=i.includes(".")?jo(n,i):()=>n[i];if(f(e)){const n=t[e];g(n)&&Bo(o,n)}else if(g(e))Bo(o,e.bind(n));else if(_(e))if(d(e))e.forEach((e=>ys(e,t,n,i)));else{const i=g(e.handler)?e.handler.bind(n):t[e.handler];g(i)&&Bo(o,i,e)}}function Is(e){const t=e.type,{mixins:n,extends:i}=t,{mixins:o,optionsCache:s,config:{optionMergeStrategies:a}}=e.appContext,r=s.get(t);let c;return r?c=r:o.length||n||i?(c={},o.length&&o.forEach((e=>Ms(c,e,a,!0))),Ms(c,t,a)):c=t,_(t)&&s.set(t,c),c}function Ms(e,t,n,i=!1){const{mixins:o,extends:s}=t;s&&Ms(e,s,n,!0),o&&o.forEach((t=>Ms(e,t,n,!0)));for(const a in t)if(i&&"expose"===a);else{const i=Cs[a]||n&&n[a];e[a]=i?i(e[a],t[a]):t[a]}return e}const Cs={data:Ss,props:Ds,emits:Ds,methods:ks,computed:ks,beforeCreate:Ts,created:Ts,beforeMount:Ts,mounted:Ts,beforeUpdate:Ts,updated:Ts,beforeDestroy:Ts,beforeUnmount:Ts,destroyed:Ts,unmounted:Ts,activated:Ts,deactivated:Ts,errorCaptured:Ts,serverPrefetch:Ts,components:ks,directives:ks,watch:function(e,t){if(!e)return t;if(!t)return e;const n=r(Object.create(null),e);for(const i in t)n[i]=Ts(e[i],t[i]);return n},provide:Ss,inject:function(e,t){return ks(Es(e),Es(t))}};function Ss(e,t){return t?e?function(){return r(g(e)?e.call(this,this):e,g(t)?t.call(this,this):t)}:t:e}function Es(e){if(d(e)){const t={};for(let n=0;n{h=!0;const[t,n]=As(e,i,!0);r(u,t),n&&p.push(...n)};!o&&i.mixins.length&&i.mixins.forEach(t),e.extends&&t(e.extends),e.mixins&&e.mixins.forEach(t)}if(!c&&!h)return _(e)&&s.set(e,n),n;if(d(c))for(let n=0;n-1,i[1]=n<0||t-1||l(i,"default"))&&p.push(e)}}}const f=[u,p];return _(e)&&s.set(e,f),f}function Ls(e){return"$"!==e[0]&&!S(e)}function Ps(e){if(null===e)return"null";if("function"==typeof e)return e.name||"";if("object"==typeof e){return e.constructor&&e.constructor.name||""}return""}function Ns(e,t){return Ps(e)===Ps(t)}function ws(e,t){return d(t)?t.findIndex((t=>Ns(t,e))):g(t)&&Ns(t,e)?0:-1}const Us=Do;function Gs(e){return e?zi(t=e)||Wi(t)||"__vInternal"in e?r({},e):e:null;var t}const xs=Ko();let Fs=0;function Bs(e,n,i){const o=e.type,s=(n?n.appContext:e.appContext)||xs,a={uid:Fs++,vnode:e,type:o,parent:n,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,scope:new Gn(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:n?n.provides:Object.create(s.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:As(o,s),emitsOptions:Po(o,s),emit:null,emitted:null,propsDefaults:t,inheritAttrs:o.inheritAttrs,ctx:t,data:t,props:t,attrs:t,slots:t,refs:t,setupState:t,setupContext:null,attrsProxy:null,slotsProxy:null,suspense:i,suspenseId:i?i.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null,$uniElements:new Map,$templateUniElementRefs:[],$templateUniElementStyles:{},$eS:{},$eA:{}};return a.ctx={_:a},a.root=n?n.root:a,a.emit=Lo.bind(null,a),e.ce&&e.ce(a),a}let qs=null;const Vs=()=>qs||wo;let js,Hs;js=e=>{qs=e},Hs=e=>{Ys=e};const Ks=e=>{const t=qs;return js(e),e.scope.on(),()=>{e.scope.off(),js(t)}},zs=()=>{qs&&qs.scope.off(),js(null)};function Ws(e){return 4&e.vnode.shapeFlag}let Ys=!1;function $s(e,t=!1){t&&Hs(t);const{props:n}=e.vnode,i=Ws(e);Rs(e,n,i,t);const o=i?function(e){const t=e.type;e.accessCache=Object.create(null),e.proxy=Ji(new Proxy(e.ctx,gs));const{setup:n}=t;if(n){const t=e.setupContext=n.length>1?function(e){const t=t=>{e.exposed=t||{}};return{get attrs(){return function(e){return e.attrsProxy||(e.attrsProxy=new Proxy(e.attrs,{get:(t,n)=>(oi(e,0,"$attrs"),t[n])}))}(e)},slots:e.slots,emit:e.emit,expose:t}}(e):null,i=Ks(e);Wn();const o=lo(n,e,0,[e.props,t]);Yn(),i(),v(o)?o.then(zs,zs):function(e,t){g(t)?e.render=t:_(t)&&(e.setupState=ro(t));Js(e)}(e,o)}else Js(e)}(e):void 0;return t&&Hs(!1),o}function Js(e,t,n){const o=e.type;e.render||(e.render=o.render||i);{const t=Ks(e);Wn();try{_s(e)}finally{Yn(),t()}}}function Xs(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(ro(Ji(e.exposed)),{get:(t,n)=>n in t?t[n]:e.proxy[n],has:(e,t)=>t in e||t in ps}))}const Qs=(e,t)=>{const n=function(e,t,n=!1){let o,s;const a=g(e);return a?(o=e,s=i):(o=e.get,s=e.set),new Zi(o,s,a||!s,n)}(e,0,Ys);return n},Zs="3.4.21";function ea(e){return so(e)}const ta="[object Array]",na="[object Object]";function ia(e,t){const n={};return oa(e,t),sa(e,t,"",n),n}function oa(e,t){if((e=ea(e))===t)return;const n=I(e),i=I(t);if(n==na&&i==na)for(let o in t){const n=e[o];void 0===n?e[o]=null:oa(n,t[o])}else n==ta&&i==ta&&e.length>=t.length&&t.forEach(((t,n)=>{oa(e[n],t)}))}function sa(e,t,n,i){if((e=ea(e))===t)return;const o=I(e),s=I(t);if(o==na)if(s!=na||Object.keys(e).length{sa(e,s[t],(""==n?"":n+".")+a+"["+t+"]",i)}));else if(r==na)if(c!=na||Object.keys(o).length{sa(e,t[o],n+"["+o+"]",i)})):aa(i,n,e)}function aa(e,t,n){e[t]=n}function ra(e){const t=e.ctx.__next_tick_callbacks;if(t&&t.length){const e=t.slice(0);t.length=0;for(let t=0;t{t?lo(t.bind(e.proxy),e,14):i&&i(e.proxy)})),new Promise((e=>{i=e}))}function ua(e,t){const n=typeof(e=ea(e));if("object"===n&&null!==e){let n=t.get(e);if(void 0!==n)return n;if(d(e)){const i=e.length;n=new Array(i),t.set(e,n);for(let o=0;o{i[e]=n[e]})),i}(o,s));Object.keys(a).length?(i.__next_tick_pending=!0,o.setData(a,(()=>{i.__next_tick_pending=!1,ra(e)})),Ro()):ra(e)}}function pa(e,t,n){t.appContext.config.globalProperties.$applyOptions(e,t,n);const i=e.computed;if(i){const e=Object.keys(i);if(e.length){const n=t.ctx;n.$computedKeys||(n.$computedKeys=[]),n.$computedKeys.push(...e)}}delete t.ctx.$onApplyOptions}function ha(e,t=!1){const{setupState:n,$templateRefs:i,$templateUniElementRefs:o,ctx:{$scope:s,$mpPlatform:a}}=e;if("mp-alipay"===a)return;if(!s||!i&&!o)return;if(t)return i&&i.forEach((e=>ga(e,null,n))),void(o&&o.forEach((e=>ga(e,null,n))));const r="mp-baidu"===a||"mp-toutiao"===a,c=e=>{if(0===e.length)return[];const t=(s.selectAllComponents(".r")||[]).concat(s.selectAllComponents(".r-i-f")||[]);return e.filter((e=>{const i=function(e,t){const n=e.find((e=>e&&(e.properties||e.props).uI===t));if(n){const e=n.$vm;return e?Xs(e.$)||e:function(e){_(e)&&Ji(e);return e}(n)}return null}(t,e.i);return!(!r||null!==i)||(ga(e,i,n),!1)}))},u=()=>{if(i){const t=c(i);t.length&&e.proxy&&e.proxy.$scope&&e.proxy.$scope.setData({r1:1},(()=>{c(t)}))}};o&&o.length&&ca(e,(()=>{o.forEach((e=>{d(e.v)?e.v.forEach((t=>{ga(e,t,n)})):ga(e,e.v,n)}))})),s._$setRef?s._$setRef(u):ca(e,u)}function ga({r:e,f:t},n,i){if(g(e))e(n,{});else{const o=f(e),s=no(e);if(o||s)if(t){if(!s)return;d(e.value)||(e.value=[]);const t=e.value;if(-1===t.indexOf(n)){if(t.push(n),!n)return;n.$&&ss((()=>c(t,n)),n.$)}}else o?l(i,e)&&(i[e]=n):no(e)&&(e.value=n)}}const fa=Do;function ma(e,t){const n=e.component=Bs(e,t.parentComponent,null);return n.renderer=t.mpType?t.mpType:"component",n.ctx.$onApplyOptions=pa,n.ctx.$children=[],"app"===t.mpType&&(n.render=i),t.onBeforeSetup&&t.onBeforeSetup(n,t),$s(n),t.parentComponent&&n.proxy&&t.parentComponent.ctx.$children.push(Xs(n)||n.proxy),function(e){const t=Ma.bind(e);e.$updateScopedSlots=()=>Eo((()=>To(t)));const n=()=>{if(e.isMounted){const{next:t,bu:n,u:i}=e;Ca(e,!1),Ia(),n&&L(n),Ca(e,!0),da(e,va(e)),i&&fa(i)}else ss((()=>{ha(e,!0)}),e),da(e,va(e))},o=e.effect=new Bn(n,i,(()=>To(s)),e.scope),s=e.update=()=>{o.dirty&&o.run()};s.id=e.uid,Ca(e,!0),s()}(n),n.proxy}const _a=e=>{let t;for(const n in e)("class"===n||"style"===n||s(n))&&((t||(t={}))[n]=e[n]);return t};function va(e){const{type:t,vnode:n,proxy:i,withProxy:o,props:s,propsOptions:[a],slots:r,attrs:c,emit:u,render:l,renderCache:d,data:p,setupState:h,ctx:g,uid:f,appContext:{app:{config:{globalProperties:{pruneComponentPropsCache:m}}}},inheritAttrs:_}=e;let v;e.$uniElementIds=new Map,e.$templateRefs=[],e.$templateUniElementRefs=[],e.$templateUniElementStyles={},e.$ei=0,m(f),e.__counter=0===e.__counter?1:0;const y=Uo(e);try{if(4&n.shapeFlag){ya(_,s,a,c);const e=o||i;v=l.call(e,e,d,s,h,p,g)}else{ya(_,s,a,t.props?c:_a(c));const e=t;v=e.length>1?e(s,{attrs:c,slots:r,emit:u}):e(s,null)}}catch(I){ho(I,e,1),v=!1}return ha(e),Uo(y),v}function ya(e,t,n,i){if(t&&i&&!1!==e){const e=Object.keys(i).filter((e=>"class"!==e&&"style"!==e));if(!e.length)return;n&&e.some(a)?e.forEach((e=>{a(e)&&e.slice(9)in n||(t[e]=i[e])})):e.forEach((e=>t[e]=i[e]))}}const Ia=e=>{Wn(),Ro(),Yn()};function Ma(){const e=this.$scopedSlotsData;if(!e||0===e.length)return;const t=this.ctx.$scope,n=t.data,i=Object.create(null);e.forEach((({path:e,index:t,data:o})=>{const s=_e(n,e),a=f(t)?`${e}.${t}`:`${e}[${t}]`;if(void 0===s||void 0===s[t])i[a]=o;else{const e=ia(o,s[t]);Object.keys(e).forEach((t=>{i[a+"."+t]=e[t]}))}})),e.length=0,Object.keys(i).length&&t.setData(i)}function Ca({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}const Sa=function(e,t=null){g(e)||(e=r({},e)),null==t||_(t)||(t=null);const n=Ko(),i=new WeakSet,o=n.app={_uid:zo++,_component:e,_props:t,_container:null,_context:n,_instance:null,version:Zs,get config(){return n.config},set config(e){},use:(e,...t)=>(i.has(e)||(e&&g(e.install)?(i.add(e),e.install(o,...t)):g(e)&&(i.add(e),e(o,...t))),o),mixin:e=>(n.mixins.includes(e)||n.mixins.push(e),o),component:(e,t)=>t?(n.components[e]=t,o):n.components[e],directive:(e,t)=>t?(n.directives[e]=t,o):n.directives[e],mount(){},unmount(){},provide:(e,t)=>(n.provides[e]=t,o),runWithContext(e){const t=Wo;Wo=o;try{return e()}finally{Wo=t}}};return o};function Ea(e,t=null){("undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof my?my:void 0).__VUE__=!0;const n=Sa(e,t),o=n._context;o.config.globalProperties.$nextTick=function(e){return ca(this.$,e)};const s=e=>(e.appContext=o,e.shapeFlag=6,e),a=function(e,t){return ma(s(e),t)},r=function(e){return e&&function(e){const{bum:t,scope:n,update:i,um:o}=e;t&&L(t);{const t=e.parent;if(t){const n=t.ctx.$children,i=Xs(e)||e.proxy,o=n.indexOf(i);o>-1&&n.splice(o,1)}}n.stop(),i&&(i.active=!1),o&&fa(o),fa((()=>{e.isUnmounted=!0}))}(e.$)};return n.mount=function(){e.render=i;const t=ma(s({type:e}),{mpType:"app",mpInstance:null,parentComponent:null,slots:[],props:null});return n._instance=t.$,t.$app=n,t.$createComponent=a,t.$destroyComponent=r,o.$appInstance=t,t},n.unmount=function(){},n}function Ta(e,t,n,i){g(t)&&Zo(e,t.bind(n),i)}function ka(e,t,n){!function(e,t,n){const i=e.mpType||n.$mpType;!i||"component"===i||"page"===i&&"component"===t.renderer||Object.keys(e).forEach((i=>{if(Te(i,e[i],!1)){const o=e[i];d(o)?o.forEach((e=>Ta(i,e,n,t))):Ta(i,o,n,t)}}))}(e,t,n)}function Da(e,t,n){return e[t]=n}function Ra(e,...t){const n=this[e];return n?n(...t):(console.error(`method ${e} not found`),null)}function Oa(e){const t=e.config.errorHandler;return function(n,i,o){t&&t(n,i,o);const s=e._instance;if(!s||!s.proxy)throw n;s[K]?s.proxy.$callHook(K,n):go(n,0,i&&i.$.vnode,!1)}}function ba(e,t){return e?[...new Set([].concat(e,t))]:t}let Aa;const La="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Pa=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function Na(){const e=Nn.getStorageSync("uni_id_token")||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let n;try{n=JSON.parse((i=t[1],decodeURIComponent(Aa(i).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(o){throw new Error("获取当前用户信息出错,详细错误信息为:"+o.message)}var i;return n.tokenExpired=1e3*n.exp,delete n.exp,delete n.iat,n}function wa(e){const t=e.config;var n;t.errorHandler=Re(e,Oa),n=t.optionMergeStrategies,Se.forEach((e=>{n[e]=ba}));const i=t.globalProperties;!function(e){e.uniIDHasRole=function(e){const{role:t}=Na();return t.indexOf(e)>-1},e.uniIDHasPermission=function(e){const{permission:t}=Na();return this.uniIDHasRole("admin")||t.indexOf(e)>-1},e.uniIDTokenValid=function(){const{tokenExpired:e}=Na();return e>Date.now()}}(i),i.$set=Da,i.$applyOptions=ka,i.$callMethod=Ra,Nn.invokeCreateVueAppHook(e)}Aa="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Pa.test(e))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var n,i,o="",s=0;s>16&255):64===i?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return o}:atob;const Ua=Object.create(null);function Ga(e){delete Ua[e]}function xa(e){if(!e)return;const[t,n]=e.split(",");return Ua[t]?Ua[t][parseInt(n)]:void 0}var Fa={install(e){wa(e),e.config.globalProperties.pruneComponentPropsCache=Ga;const t=e.mount;e.mount=function(n){const i=t.call(e,n),o=function(){const e="createApp";if("undefined"!=typeof global&&void 0!==global[e])return global[e];if("undefined"!=typeof my)return my[e]}();return o?o(i):"undefined"!=typeof createMiniProgramApp&&createMiniProgramApp(i),i}}};function Ba(e){return f(e)?e:function(e){let t="";if(!e||f(e))return t;for(const n in e)t+=`${n.startsWith("--")?n:R(n)}:${e[n]};`;return t}(N(e))}function qa(e,t){const n=Vs(),o=n.ctx,s=void 0===t||"mp-weixin"!==o.$mpPlatform&&"mp-qq"!==o.$mpPlatform&&"mp-xhs"!==o.$mpPlatform||!f(t)&&"number"!=typeof t?"":"_"+t,a="e"+n.$ei+++s,c=o.$scope;if(!e)return delete c[a],a;const u=c[a];return u?u.value=e:c[a]=function(e,t){const n=e=>{var o;(o=e).type&&o.target&&(o.preventDefault=i,o.stopPropagation=i,o.stopImmediatePropagation=i,l(o,"detail")||(o.detail={}),l(o,"markerId")&&(o.detail="object"==typeof o.detail?o.detail:{},o.detail.markerId=o.markerId),M(o.detail)&&l(o.detail,"checked")&&!l(o.detail,"value")&&(o.detail.value=o.detail.checked),M(o.detail)&&(o.target=r({},o.target,o.detail)));let s=[e];t&&t.ctx.$getTriggerEventDetail&&"number"==typeof e.detail&&(e.detail=t.ctx.$getTriggerEventDetail(e.detail)),e.detail&&e.detail.__args__&&(s=e.detail.__args__);const a=n.value,c=()=>po(function(e,t){if(d(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n&&n.call(e),e._stopped=!0},t.map((e=>t=>!t._stopped&&e(t)))}return t}(e,a),t,5,s),u=e.target,p=!!u&&(!!u.dataset&&"true"===String(u.dataset.eventsync));if(!Va.includes(e.type)||p){const t=c();if("input"===e.type&&(d(t)||v(t)))return;return t}setTimeout(c)};return n.value=e,n}(e,n),a}const Va=["tap","longpress","longtap","transitionend","animationstart","animationiteration","animationend","touchforcechange"];const ja=function(e,t=null){return e&&(e.mpType="app"),Ea(e,t).use(Fa)};const Ha=["externalClasses"];const Ka=/_(.*)_worklet_factory_/;function za(e,t){const n=e.$children;for(let o=n.length-1;o>=0;o--){const e=n[o];if(e.$scope._$vueId===t)return e}let i;for(let o=n.length-1;o>=0;o--)if(i=za(n[o],t),i)return i}const Wa=["createSelectorQuery","createIntersectionObserver","selectAllComponents","selectComponent"];function Ya(e,t){const n=e.ctx;n.mpType=t.mpType,n.$mpType=t.mpType,n.$mpPlatform="mp-weixin",n.$scope=t.mpInstance,Object.defineProperties(n,{[fe]:{get(){const e=this.$scope.data[fe];return void 0===e?"":e}}}),n.$mp={},n._self={},e.slots={},d(t.slots)&&t.slots.length&&(t.slots.forEach((t=>{e.slots[t]=!0})),e.slots.d&&(e.slots.default=!0)),n.getOpenerEventChannel=function(){return t.mpInstance.getOpenerEventChannel()},n.$hasHook=$a,n.$callHook=Ja,e.emit=function(e,t){return function(n,...i){const o=t.$scope;if(o&&n){const e={__args__:i};o.triggerEvent(n,e)}return e.apply(this,[n,...i])}}(e.emit,n)}function $a(e){const t=this.$[e];return!(!t||!t.length)}function Ja(e,t){"mounted"===e&&(Ja.call(this,"bm"),this.$.isMounted=!0,e="m");const n=this.$[e];return n&&((e,t)=>{let n;for(let i=0;i{Te(n,e[n])&&t.add(n)}));{const{extends:n,mixins:i}=e;i&&i.forEach((e=>Qa(e,t))),n&&Qa(n,t)}}return t}function Za(e,t,n){-1!==n.indexOf(t)||l(e,t)||(e[t]=function(e){return this.$vm&&this.$vm.$callHook(t,e)})}const er=[J];function tr(e,t,n=er){t.forEach((t=>Za(e,t,n)))}function nr(e,t,n=er){Qa(t).forEach((t=>Za(e,t,n)))}const ir=me((()=>{const e=[],t=g(getApp)&&getApp({allowDefault:!0});if(t&&t.$vm&&t.$vm.$){const n=t.$vm.$.appContext.mixins;if(d(n)){const t=Object.keys(Ee);n.forEach((n=>{t.forEach((t=>{l(n,t)&&!e.includes(t)&&e.push(t)}))}))}}return e}));const or=[V,j,K,z,W,Y];function sr(e,t){const n=e.$,i={globalData:e.$options&&e.$options.globalData||{},$vm:e,onLaunch(t){this.$vm=e;const i=n.ctx;this.$vm&&i.$scope&&i.$callHook||(Ya(n,{mpType:"app",mpInstance:this,slots:[]}),i.globalData=this.globalData,e.$callHook(H,t))}},o=wx.$onErrorHandlers;o&&(o.forEach((e=>{Zo(K,e,n)})),o.length=0),function(e){const t=io(function(){var e;let t="";{const n=(null===(e=wx.getAppBaseInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync();t=Be(n&&n.language?n.language:Ue)||Ue}return t}());Object.defineProperty(e,"$locale",{get:()=>t.value,set(e){t.value=e}})}(e);const s=e.$.type;tr(i,or),nr(i,s);{const e=s.methods;e&&r(i,e)}return i}function ar(e,t){if(g(e.onLaunch)){const t=wx.getLaunchOptionsSync&&wx.getLaunchOptionsSync();e.onLaunch(t)}g(e.onShow)&&wx.onAppShow&&wx.onAppShow((e=>{t.$callHook("onShow",e)})),g(e.onHide)&&wx.onAppHide&&wx.onAppHide((e=>{t.$callHook("onHide",e)}))}const rr=["eO","uR","uRIF","uI","uT","uP","uS"];function cr(e){e.properties||(e.properties={}),r(e.properties,function(e,t=!1){const n={};if(!t){let e=function(e){const t=Object.create(null);e&&e.forEach((e=>{t[e]=!0})),this.setData({$slots:t})};rr.forEach((e=>{n[e]={type:null,value:""}})),n.uS={type:null,value:[]},n.uS.observer=e}return e.behaviors&&e.behaviors.includes("wx://form-field")&&(e.properties&&e.properties.name||(n.name={type:null,value:""}),e.properties&&e.properties.value||(n.value={type:null,value:""})),n}(e),function(e){const t={};return e&&e.virtualHost&&(t.virtualHostStyle={type:null,value:""},t.virtualHostClass={type:null,value:""},t.virtualHostHidden={type:null,value:""},t[fe]={type:null,value:""}),t}(e.options))}const ur=[String,Number,Boolean,Object,Array,null];function lr(e,t){const n=function(e){return d(e)&&1===e.length?e[0]:e}(e);return-1!==ur.indexOf(n)?n:null}function dr(e,t){return(t?function(e){const t={};M(e)&&Object.keys(e).forEach((n=>{-1===rr.indexOf(n)&&(t[n]=e[n])}));return t}(e):xa(e.uP))||{}}function pr(e){const t=function(){const e=this.properties.uP;e&&(this.$vm?function(e,t){const n=$i(t.props),i=xa(e)||{};hr(n,i)&&(!function(e,t,n,i){const{props:o,attrs:s,vnode:{patchFlag:a}}=e,r=$i(o),[c]=e.propsOptions;let u=!1;if(!(i||a>0)||16&a){let i;Os(e,t,o,s)&&(u=!0);for(const s in r)t&&(l(t,s)||(i=R(s))!==s&&l(t,i))||(c?!n||void 0===n[s]&&void 0===n[i]||(o[s]=bs(c,r,s,void 0,e,!0)):delete o[s]);if(s!==r)for(const e in s)t&&l(t,e)||(delete s[e],u=!0)}else if(8&a){const n=e.vnode.dynamicProps;for(let i=0;i-1&&function(e){const t=_o.indexOf(e);t>vo&&_o.splice(t,1)}(t.update),t.update());var o}(e,this.$vm.$):"m"===this.properties.uT&&function(e,t){const n=t.properties,i=xa(e)||{};hr(n,i,!1)&&t.setData(i)}(e,this))};e.observers||(e.observers={}),e.observers.uP=t}function hr(e,t,n=!0){const i=Object.keys(t);if(n&&i.length!==Object.keys(e).length)return!0;for(let o=0;o{i.push(e.replace("uni://","wx://")),"uni://form-field"===e&&(d(n)?(n.push("name"),n.push("modelValue")):(n.name={type:String,default:""},n.modelValue={type:[String,Number,Boolean,Array,Object,Date],default:""}))})),i}(t)}function fr(e,{parse:t,mocks:n,isPage:i,isPageInProject:o,initRelation:s,handleLink:a,initLifetimes:c}){e=e.default||e;const u={multipleSlots:!0,addGlobalClass:!0,pureDataPattern:/^uP$/};d(e.mixins)&&e.mixins.forEach((e=>{_(e.options)&&r(u,e.options)})),e.options&&r(u,e.options);const p={options:u,lifetimes:c({mocks:n,isPage:i,initRelation:s,vueOptions:e}),pageLifetimes:{show(){this.$vm&&this.$vm.$callHook("onPageShow")},hide(){this.$vm&&this.$vm.$callHook("onPageHide")},resize(e){this.$vm&&this.$vm.$callHook("onPageResize",e)}},methods:{__l:a}};var h,g,f,m;return gr(p,e),cr(p),pr(p),function(e,t){Ha.forEach((n=>{l(t,n)&&(e[n]=t[n])}))}(p,e),h=p.methods,g=e.wxsCallMethods,d(g)&&g.forEach((e=>{h[e]=function(t){return this.$vm[e](t)}})),f=p.methods,(m=e.methods)&&Object.keys(m).forEach((e=>{const t=e.match(Ka);if(t){const n=t[1];f[e]=m[e],f[n]=m[n]}})),t&&t(p,{handleLink:a}),p}let mr,_r;function vr(){return getApp().$vm}function yr(e,t){const{parse:n,mocks:i,isPage:o,initRelation:s,handleLink:a,initLifetimes:r}=t,c=fr(e,{mocks:i,isPage:o,isPageInProject:!0,initRelation:s,handleLink:a,initLifetimes:r});!function({properties:e},t){d(t)?t.forEach((t=>{e[t]={type:String,value:""}})):M(t)&&Object.keys(t).forEach((n=>{const i=t[n];if(M(i)){let t=i.default;g(t)&&(t=t());const o=i.type;i.type=lr(o),e[n]={type:i.type,value:t}}else e[n]={type:lr(i)}}))}(c,(e.default||e).props);const u=c.methods;return u.onLoad=function(e){var t;return this.options=e,this.$page={fullPath:(t=this.route+Me(e),function(e){return 0===e.indexOf("/")}(t)?t:"/"+t)},this.$vm&&this.$vm.$callHook($,e)},tr(u,Xa),nr(u,e),function(e,t){if(!t)return;Object.keys(Ee).forEach((n=>{t&Ee[n]&&Za(e,n,[])}))}(u,e.__runtimeHooks),tr(u,ir()),n&&n(c,{handleLink:a}),c}const Ir=Page,Mr=Component;function Cr(e){const t=e.triggerEvent,n=function(n,...i){return t.apply(e,[(o=n,k(o.replace(ye,"-"))),...i]);var o};try{e.triggerEvent=n}catch(i){e._triggerEvent=n}}function Sr(e,t,n){const i=t[e];t[e]=i?function(...e){return Cr(this),i.apply(this,e)}:function(){Cr(this)}}Page=function(e){return Sr($,e),Ir(e)},Component=function(e){Sr("created",e);return e.properties&&e.properties.uP||(cr(e),pr(e)),Mr(e)};var Er=Object.freeze({__proto__:null,handleLink:function(e){const t=e.detail||e.value,n=t.vuePid;let i;n&&(i=za(this.$vm,n)),i||(i=this.$vm),t.parent=i},initLifetimes:function({mocks:e,isPage:t,initRelation:n,vueOptions:i}){return{attached(){let o=this.properties;!function(e,t){if(!e)return;const n=e.split(","),i=n.length;1===i?t._$vueId=n[0]:2===i&&(t._$vueId=n[0],t._$vuePid=n[1])}(o.uI,this);const s={vuePid:this._$vuePid};n(this,s);const a=this,r=t(a);let c=o;this.$vm=function(e,t){mr||(mr=vr().$createComponent);const n=mr(e,t);return Xs(n.$)||n}({type:i,props:dr(c,r)},{mpType:r?"page":"component",mpInstance:a,slots:o.uS||{},parentComponent:s.parent&&s.parent.$,onBeforeSetup(t,n){!function(e,t){Object.defineProperty(e,"refs",{get(){const e={};return function(e,t,n){e.selectAllComponents(t).forEach((e=>{const t=e.properties.uR;n[t]=e.$vm||e}))}(t,".r",e),t.selectAllComponents(".r-i-f").forEach((t=>{const n=t.properties.uR;n&&(e[n]||(e[n]=[]),e[n].push(t.$vm||t))})),e}})}(t,a),function(e,t,n){const i=e.ctx;n.forEach((n=>{l(t,n)&&(e[n]=i[n]=t[n])}))}(t,a,e),function(e,t){Ya(e,t);const n=e.ctx;Wa.forEach((e=>{n[e]=function(...t){const i=n.$scope;if(i&&i[e])return i[e].apply(i,t)}}))}(t,n)}}),r||function(e){const t=e.$options;d(t.behaviors)&&t.behaviors.includes("uni://form-field")&&e.$watch("modelValue",(()=>{e.$scope&&e.$scope.setData({name:e.name,value:e.modelValue})}),{immediate:!0})}(this.$vm)},ready(){this.$vm&&(this.$vm.$callHook("mounted"),this.$vm.$callHook(J))},detached(){var e;this.$vm&&(Ga(this.$vm.$.uid),e=this.$vm,_r||(_r=vr().$destroyComponent),_r(e))}}},initRelation:function(e,t){e.triggerEvent("__l",t)},isPage:function(e){return!!e.route},mocks:["__route__","__wxExparserNodeId__","__wxWebviewId__"]});const Tr=function(e){return App(sr(e))},kr=(Dr=Er,function(e){return Component(yr(e,Dr))});var Dr;const Rr=function(e){return function(t){return Component(fr(t,e))}}(Er),Or=function(e){ar(sr(e),e)},br=function(e){const t=sr(e),n=g(getApp)&&getApp({allowDefault:!0});if(!n)return;e.$.ctx.$scope=n;const i=n.globalData;i&&Object.keys(t.globalData).forEach((e=>{l(i,e)||(i[e]=t.globalData[e])})),Object.keys(t).forEach((e=>{l(n,e)||(n[e]=t[e])})),ar(t,e)};wx.createApp=global.createApp=Tr,wx.createPage=kr,wx.createComponent=Rr,wx.createPluginApp=global.createPluginApp=Or,wx.createSubpackageApp=global.createSubpackageApp=br; /*! * pinia v2.1.7 * (c) 2023 Eduardo San Martin Morote * @license MIT */ let Ar;const Lr=e=>Ar=e,Pr=Symbol();function Nr(e){return e&&"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)&&"function"!=typeof e.toJSON}var wr,Ur;(Ur=wr||(wr={})).direct="direct",Ur.patchObject="patch object",Ur.patchFunction="patch function";const Gr=()=>{};function xr(e,t,n,i=Gr){e.push(t);const o=()=>{const n=e.indexOf(t);n>-1&&(e.splice(n,1),i())};return!n&&Fn()&&function(e){wn&&wn.cleanups.push(e)}(o),o}function Fr(e,...t){e.slice().forEach((e=>{e(...t)}))}const Br=e=>e();function qr(e,t){e instanceof Map&&t instanceof Map&&t.forEach(((t,n)=>e.set(n,t))),e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const i=t[n],o=e[n];Nr(o)&&Nr(i)&&e.hasOwnProperty(n)&&!no(i)&&!zi(i)?e[n]=qr(o,i):e[n]=i}return e}const Vr=Symbol();const{assign:jr}=Object;function Hr(e,t,n,i){const{state:o,actions:s,getters:a}=t,r=n.state.value[e];let c;return c=Kr(e,(function(){r||(n.state.value[e]=o?o():{});const t=function(e){const t=d(e)?new Array(e.length):{};for(const n in e)t[n]=uo(e,n);return t}(n.state.value[e]);return jr(t,s,Object.keys(a||{}).reduce(((t,i)=>(t[i]=Ji(Qs((()=>{Lr(n);const t=n._s.get(e);return a[i].call(t,t)}))),t)),{}))}),t,n,i,!0),c}function Kr(e,t,n={},i,o,s){let a;const r=jr({actions:{}},n),c={deep:!0};let u,l,d,p=[],h=[];const g=i.state.value[e];let f;function m(t){let n;u=l=!1,"function"==typeof t?(t(i.state.value[e]),n={type:wr.patchFunction,storeId:e,events:d}):(qr(i.state.value[e],t),n={type:wr.patchObject,payload:t,storeId:e,events:d});const o=f=Symbol();Eo().then((()=>{f===o&&(u=!0)})),l=!0,Fr(p,n,i.state.value[e])}s||g||(i.state.value[e]={}),io({});const _=s?function(){const{state:e}=n,t=e?e():{};this.$patch((e=>{jr(e,t)}))}:Gr;function v(t,n){return function(){Lr(i);const o=Array.from(arguments),s=[],a=[];let r;Fr(h,{args:o,name:t,store:y,after:function(e){s.push(e)},onError:function(e){a.push(e)}});try{r=n.apply(this&&this.$id===e?this:y,o)}catch(c){throw Fr(a,c),c}return r instanceof Promise?r.then((e=>(Fr(s,e),e))).catch((e=>(Fr(a,e),Promise.reject(e)))):(Fr(s,r),r)}}const y=ji({_p:i,$id:e,$onAction:xr.bind(null,h),$patch:m,$reset:_,$subscribe(t,n={}){const o=xr(p,t,n.detached,(()=>s())),s=a.run((()=>Bo((()=>i.state.value[e]),(i=>{("sync"===n.flush?l:u)&&t({storeId:e,type:wr.direct,events:d},i)}),jr({},c,n))));return o},$dispose:function(){a.stop(),p=[],h=[],i._s.delete(e)}});i._s.set(e,y);const I=(i._a&&i._a.runWithContext||Br)((()=>i._e.run((()=>(a=xn()).run(t)))));for(const S in I){const t=I[S];if(no(t)&&(!no(C=t)||!C.effect)||zi(t))s||(!g||Nr(M=t)&&M.hasOwnProperty(Vr)||(no(t)?t.value=g[S]:qr(t,g[S])),i.state.value[e][S]=t);else if("function"==typeof t){const e=v(S,t);I[S]=e,r.actions[S]=t}}var M,C;return jr(y,I),jr($i(y),I),Object.defineProperty(y,"$state",{get:()=>i.state.value[e],set:e=>{m((t=>{jr(t,e)}))}}),i._p.forEach((e=>{jr(y,a.run((()=>e({store:y,app:i._a,pinia:i,options:r}))))})),g&&s&&n.hydrate&&n.hydrate(y.$state,g),u=!0,l=!0,y}var zr,Wr,Yr;(Yr=zr||(zr={})).UNIAPP="uniapp",Yr.REACT_NATIVE="rn",Yr.COCOS="cocos",Yr.UNKNOWN="unknown";let $r=class e{constructor(){this.framework=null,this.methods={[zr.UNIAPP]:this.isUniApp,[zr.REACT_NATIVE]:this.isReactNative,[zr.COCOS]:this.isCocos};const e=this.methods,t=Object.keys(e);for(const n of t)if((0,e[n])()){this.framework=n;break}this.framework=this.framework||zr.UNKNOWN,this.framework}static currentFramework(){return this.instance||(this.instance=new e),this.instance.framework}isUniApp(){try{return"function"==typeof Nn.getSystemInfoSync}catch(Yr){return!1}}isReactNative(){try{return"object"==typeof navigator&&"ReactNative"===navigator.product}catch(Yr){return!1}}isTaro(){try{return void 0!==process.env.TARO_ENV}catch(Yr){return!1}}isCocos(){try{return void 0!==cc.sys.localStorage}catch(Yr){return!1}}},Jr=class{static init(e){$r.currentFramework()===zr.REACT_NATIVE&&(this.validate(e),this.platform=e.platform,this.asyncStorage=e.asyncStorage)}static validate(e){if(!e)throw new Error("'reactNativeOptions' is missing when calling GoEasy.getInstance()");if(!e.platform)throw new Error("'platform' is missing in GoEasy 'reactNativeOptions'");if(!e.asyncStorage)throw new Error("'asyncStorage' is missing in GoEasy 'reactNativeOptions'")}};!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTING="connecting",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.RECONNECTED="reconnected",e.EXPIRED_RECONNECTED="reconnected",e.CONNECT_FAILED="connect_failed"}(Wr||(Wr={}));const Xr="2.13.17";var Qr,Zr;!function(e){e.PRIVATE="private",e.GROUP="group",e.SYSTEM="system",e.CS="cs"}(Qr||(Qr={})),function(e){e.NEW="new",e.SENDING="sending",e.SUCCESS="success",e.FAIL="fail"}(Zr||(Zr={}));let ec=class{},tc=class{constructor(e,t){this.id=e,this.data=t}},nc=new class{isDef(e){return!this.isUndef(e)}isUndef(e){return null==e}isPrimitive(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}isObject(e){return null!==e&&"object"==typeof e}isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}isValidArrayIndex(e){let t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}isString(e){return"string"==typeof e}isNumber(e){return"number"==typeof e}isStringOrNumber(e){return this.isString(e)||this.isNumber(e)}isArray(e){return"[object Array]"===Object.prototype.toString.call(e)}isEmpty(e){return this.isArray(e)?0===e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""===e.trim():!this.isDef(e))}isNative(e){return"function"==typeof e&&/native code/.test(e.toString())}isFunction(e){return"function"==typeof e}isBoolean(e){return"boolean"==typeof e}isTrue(e){return!0===e}isFalse(e){return!1===e}isNull(e){return null===e}};var ic;!function(e){e.MP_WX="mp-wx",e.MP_WGAME="mp-wgame",e.MP_BYTE="mp-byte",e.MP_BAIDU="mp-baidu",e.MP_ALI="mp-ali",e.BROWSER="browser",e.NODE="node",e.UNI_IOS="uni-ios",e.UNI_ANDROID="uni-android",e.COCOS_IOS="cocos-ios",e.COCOS_ANDROID="cocos-android",e.RN_IOS="rn-ios",e.RN_ANDROID="rn-android",e.UNKNOWN="unknown"}(ic||(ic={}));let oc=class e{constructor(){this.platform=null,this.methods={[ic.BROWSER]:this.isBrowser,[ic.MP_WX]:this.isMPWX,[ic.MP_WGAME]:this.isMPWeGame,[ic.MP_BYTE]:this.isMPByte,[ic.MP_BAIDU]:this.isMPBaidu,[ic.MP_ALI]:this.isMPAli,[ic.NODE]:this.isNode,[ic.UNI_IOS]:this.isUniAppIOS,[ic.UNI_ANDROID]:this.isUniAppAndroid,[ic.COCOS_IOS]:this.isCocosIOS,[ic.COCOS_ANDROID]:this.isCocosAndroid,[ic.RN_IOS]:this.isRNiOS,[ic.RN_ANDROID]:this.isRNAndroid};const e=this.methods,t=Object.keys(e);for(const n of t)if((0,e[n])()){this.platform=n;break}this.platform=this.platform||ic.UNKNOWN,this.platform}static currentPlatform(){return this.instance||(this.instance=new e),e.instance.platform}isBrowser(){return"undefined"!=typeof navigator&&"Taro"!==navigator.product&&"ReactNative"!==navigator.product&&"undefined"==typeof GameGlobal&&("undefined"==typeof cc||null!==cc.sys.browserType)&&"undefined"==typeof my&&"undefined"==typeof tt&&"undefined"==typeof swan}isMPWX(){return"object"==typeof Pn&&"function"==typeof Pn.getSystemInfoSync&&"undefined"==typeof WebSocket&&"undefined"==typeof XMLHttpRequest&&"undefined"==typeof plus&&"undefined"==typeof tt}isMPWeGame(){return"object"==typeof GameGlobal}isMPByte(){return"object"==typeof tt&&"function"==typeof tt.getSystemInfoSync}isMPBaidu(){return"object"==typeof swan&&"function"==typeof swan.getSystemInfoSync}isMPAli(){return"object"==typeof my&&"function"==typeof my.getSystemInfoSync}isNode(){try{return"node"===process.release.name}catch(Yr){return!1}}isUniAppIOS(){try{return"ios"===Nn.getSystemInfoSync().platform&&"app"===Nn.getSystemInfoSync().uniPlatform}catch(Yr){return!1}}isUniAppAndroid(){try{return"android"===Nn.getSystemInfoSync().platform&&"app"===Nn.getSystemInfoSync().uniPlatform}catch(Yr){return!1}}isCocosIOS(){try{return"iOS"===cc.sys.os}catch(Yr){return!1}}isCocosAndroid(){try{return"Android"===cc.sys.os}catch(Yr){return!1}}isRNiOS(){try{return"ios"===Jr.platform.OS}catch(Yr){return!1}}isRNAndroid(){try{return"android"===Jr.platform.OS}catch(Yr){return!1}}},sc=class{};sc.type=ic,sc.current=oc.currentPlatform();let ac=class{onFrontend(e){this.onFrontendCallback=e}},rc=class extends ac{constructor(){super(...arguments),this.runningBackend=!1}startCheck(){"object"==typeof plus&&(plus.globalEvent.addEventListener("resume",(()=>{this.runningBackend=!1,this.runningBackend,this.onFrontendCallback&&this.onFrontendCallback()}),!1),plus.globalEvent.addEventListener("pause",(()=>{this.runningBackend=!0,this.runningBackend}),!1))}isBackend(){return this.runningBackend}support(){const e=oc.currentPlatform();return[ic.UNI_IOS,ic.UNI_ANDROID].includes(e)}},uc=class extends ac{constructor(){super(...arguments),this.runningBackend=!1}startCheck(){Pn.onAppShow((()=>{this.runningBackend=!1})),Pn.onAppHide((()=>{this.runningBackend=!0}))}isBackend(){return this.runningBackend}support(){return oc.currentPlatform()===ic.MP_WX}};const lc=new class{constructor(){[new rc,new uc].forEach((e=>{if(e.support())return this.checker=e,void this.checker.startCheck()}))}isBackend(){return this.checker&&this.checker.isBackend()}onFrontend(e){this.checker.onFrontend(e)}};var dc,pc,hc=Object.freeze({__proto__:null,runStatus:lc});!function(e){e.authorize="authorize",e.manualDisconnect="manualDisconnect",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.publish="publish",e.ack="ack",e.historyMessages="historyMessages",e.hereNow="hereNow",e.hereNowByUserIds="hereNowByUserIds",e.PUBSUB_PRESENCE_SUBSCRIBE="PUBSUB_PRESENCE_SUBSCRIBE",e.PUBSUB_PRESENCE_UNSUBSCRIBE="PUBSUB_PRESENCE_UNSUBSCRIBE",e.PUBSUB_PRESENCE_HERENOW="PUBSUB_PRESENCE_HERENOW",e.imLastConversations="imLastConversations",e.markPrivateMessageAsRead="markPrivateMessageAsRead",e.markGroupMessageAsRead="markGroupMessageAsRead",e.imGroupOnlineCount="imGroupOnlineCount",e.imHereNow="imHereNow",e.imGroupHereNow="imGroupHereNow",e.publishIM="publishIM",e.subscribeUserPresence="subscribeUserPresence",e.unsubscribeUserPresence="unsubscribeUserPresence",e.subscribeGroupPresence="subscribeGroupPresence",e.unsubscribeGroupPresence="unsubscribeGroupPresence",e.removeConversation="removeConversation",e.topConversation="topConversation",e.imData="imData",e.subscribeGroups="subscribeGroups",e.unsubscribeGroup="unsubscribeGroup",e.IM_DELETE_MESSAGE="IM_DELETE_MESSAGE",e.IM_HISTORY="IM_HISTORY",e.IM_HISTORY_CHANGE="IM_HISTORY_CHANGE",e.IM_RECALL_MESSAGE="IM_RECALL_MESSAGE",e.IM_MARK_AS_READ="IM_MARK_AS_READ",e.CS_PENDING_CONVERSATION="CS_PENDING_CONVERSATION",e.CS_ACCEPT="CS_ACCEPT",e.CS_END="CS_END",e.CS_TRANSFER="CS_TRANSFER",e.CS_AGENTS="CS_AGENTS",e.CS_CUSTOMER_STATUS="CS_CUSTOMER_STATUS",e.CS_MY_TEAMS="CS_MY_TEAMS",e.CS_ONLINE="CS_ONLINE",e.CS_OFFLINE="CS_OFFLINE",e.CS_LIVE_SESSION="CS_LIVE_SESSION",e.CS_QUIT_LIVE="CS_QUIT_LIVE",e.SET_IOS_BADGE="SET_IOS_BADGE",e.MD_CMD="MD_CMD"}(dc||(dc={})),function(e){e[e.connect=3e3]="connect",e[e.reconnectionDelayMax=3e3]="reconnectionDelayMax",e[e.commonQuerySingle=2500]="commonQuerySingle",e[e.commonQueryTotal=12e3]="commonQueryTotal",e[e.commonRequestSingle=1700]="commonRequestSingle",e[e.commonRequestTotal=12e3]="commonRequestTotal",e[e.commonInfiniteSingle=1700]="commonInfiniteSingle",e[e.commonInfiniteTotal=864e5]="commonInfiniteTotal"}(pc||(pc={}));let gc=class{static onSuccess(e,t){nc.isFunction(e.onSuccess)&&e.onSuccess(t)}static onFailed(e,t){if(!nc.isObject(e)||!nc.isFunction(e.onFailed))throw t;e.onFailed(t)}};function fc(e,t,n,i){return new(n||(n=Promise))((function(o,s){function a(e){try{c(i.next(e))}catch(t){s(t)}}function r(e){try{c(i.throw(e))}catch(t){s(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}c((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var mc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _c(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})})),t}var vc={exports:{}};!function(){function e(t){if(t)return function(t){for(var n in e.prototype)t[n]=e.prototype[n];return t}(t)}vc.exports=e,e.prototype.on=e.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},e.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o>>((3&t)<<3)&255;return Sc}}for(var Ec=[],Tc=0;Tc<256;++Tc)Ec[Tc]=(Tc+256).toString(16).substr(1);var kc,Dc,Rc=function(e,t){var n=t||0,i=Ec;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")},Oc=Ic.exports,bc=Rc,Ac=0,Lc=0,Pc=Ic.exports,Nc=Rc,wc=function(e,t,n){var i=t&&n||0,o=t||[],s=(e=e||{}).node||kc,a=void 0!==e.clockseq?e.clockseq:Dc;if(null==s||null==a){var r=Oc();null==s&&(s=kc=[1|r[0],r[1],r[2],r[3],r[4],r[5]]),null==a&&(a=Dc=16383&(r[6]<<8|r[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),u=void 0!==e.nsecs?e.nsecs:Lc+1,l=c-Ac+(u-Lc)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||c>Ac)&&void 0===e.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Ac=c,Lc=u,Dc=a;var d=(1e4*(268435455&(c+=122192928e5))+u)%4294967296;o[i++]=d>>>24&255,o[i++]=d>>>16&255,o[i++]=d>>>8&255,o[i++]=255&d;var p=c/4294967296*1e4&268435455;o[i++]=p>>>8&255,o[i++]=255&p,o[i++]=p>>>24&15|16,o[i++]=p>>>16&255,o[i++]=a>>>8|128,o[i++]=255&a;for(var h=0;h<6;++h)o[i+h]=s[h];return t||bc(o)},Uc=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||Pc)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var s=0;s<16;++s)t[i+s]=o[s];return t||Nc(o)},Gc=Uc;Gc.v1=wc,Gc.v4=Uc;var xc=Gc;let Fc=class{support(){return!0}getParams(){return this.params}setData(e){this.active=e.a,this.data=e.d}preConnect(e){}postConnect(){}},Bc=class{static initModule(e){e.support()&&this.modules.set(e.name,e)}static getParams(){return fc(this,void 0,void 0,(function*(){let e={};for(const[t,n]of this.modules)e[t]=(yield n.getParams())||null;return e}))}static setDatas(e){Object.keys(e).forEach((t=>{this.modules.get(t).setData(e[t])}))}static preConnect(e){this.modules.forEach(((t,n)=>{t.preConnect(e)}))}static postConnect(){this.modules.forEach(((e,t)=>{e.postConnect()}))}};Bc.Module=Fc,Bc.modules=new Map;const qc=yc;let Vc=class{constructor(){this.emitter=new qc}on(e,t){return this.emitter.on(e,t),this}once(e,t){return this.emitter.once(e,t),this}off(e,t){return this.emitter.off(e,t),this}fire(e,t){return this.emitter.emit(e,t),this}},jc=class{constructor(){this.eventDriver=new Vc}on(e,t){this.eventDriver.on(e,t)}off(e,t){this.eventDriver.off(e,t)}fire(e,t){this.eventDriver.fire(e,t)}},Hc=new class{isDef(e){return!this.isUndef(e)}isUndef(e){return null==e}isPrimitive(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}isObject(e){return null!==e&&"object"==typeof e}isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}isValidArrayIndex(e){let t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}isString(e){return"string"==typeof e}isNumber(e){return"number"==typeof e}isStringOrNumber(e){return this.isString(e)||this.isNumber(e)}isArray(e){return"[object Array]"===Object.prototype.toString.call(e)}isEmpty(e){return this.isArray(e)?0===e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""===e.trim():!this.isDef(e))}isNative(e){return"function"==typeof e&&/native code/.test(e.toString())}isFunction(e){return"function"==typeof e}isBoolean(e){return"boolean"==typeof e}isTrue(e){return!0===e}isFalse(e){return!1===e}isNull(e){return null===e}};const Kc=yc;let zc=class{constructor(){this.emitter=new Kc}on(e,t){if(!Hc.isString(e))throw Error("event require a string.");if(!Hc.isFunction(t))throw Error("callback must be a function");this.emitter.on(e,t)}fire(e,t){this.emitter.emit(e,t)}off(e,t){this.emitter.off(e,t)}},Wc=class{static init(e,t,n,i,o,s){this.Socket=e,this.N=t,this.Member=n,this.v=i,this.Platform=o,this.GModules=s}};const Yc=xc;let $c=class{static get(){return Yc.v1().replace(/-/g,"")}};var Jc,Xc;(Xc=Jc||(Jc={})).WRITE="WRITE",Xc.READ="READ",Xc.NONE="NONE";let Qc=class{constructor(e){this.permission=Jc.NONE,this.singleTimeout=0,this.totalTimeout=0,this.startTime=0,this.complete=!1,this.retried=0,this.unique=!1,this.uuid=$c.get(),this.name=e.name,this.params=e.params,this.permission=e.permission,this.totalTimeout=e.totalTimeout,this.singleTimeout=e.singleTimeout,e.unique&&(this.unique=e.unique),this.success=t=>{this.complete||(this.end(),e.success(t))},this.fail=t=>{this.complete||(this.end(),e.fail(t))}}start(){this.startTime=Date.now(),this.initAutoTimeout()}end(){this.complete=!0,clearTimeout(this.timeoutHandler)}initAutoTimeout(){this.timeoutHandler=setTimeout((()=>{this.complete||this.fail({resultCode:408,content:"Host unreachable or timeout"})}),this.totalTimeout)}},Zc=class e extends Fc{static init(){return this.module=new e,this.module.name=this.GN_MODULE_NAME,this.module}static setRegId(e,t){if(e){this.module.regIdPromise=e;let n=t;this.module.params={v:{npv:n}}}}preConnect(e){this.wxmpId=e.wxmpId}getParams(){return fc(this,void 0,void 0,(function*(){if(this.params=this.params||{},this.regIdPromise)try{const e=new Promise(((e,t)=>{setTimeout((()=>t("timeout")),1e3)}));this.params.regId=yield Promise.race([this.regIdPromise,e])}catch(Yr){console.warn("Failed to register the Manufacturers Push service:"+JSON.stringify(Yr))}return this.params.wxmpId=this.wxmpId,this.params}))}};Zc.GN_MODULE_NAME="GN";let eu=class e{static init(e){this.allowNotification=!0===e;let t=Zc.init();Bc.initModule(t),this.supportAppNotification()&&(this.uniappPlugin=Nn.requireNativePlugin("GoEasy-Uniapp"),this.uniappPlugin?(this.regIdPromise=this.askRegId(),this.v=this.uniappPlugin.v(),Zc.setRegId(this.regIdPromise,this.v)):console.warn("No GoEasy-Uniapp Native Plugin."),this.setClientBadge(0))}static addAssembler(e){this.payloadAssemblers.push(e)}static assemblePayload(e){let t=this.payloadAssemblers.find((t=>t.support(e)));return t?t.assemble(e):e}static createLocalNotification(t,n,i,o,s){lc.isBackend()&&(i.g=1,"undefined"!=typeof plus&&(o?(this.uniappPlugin&&this.uniappPlugin.playSound(o),plus.push.createMessage(n,JSON.stringify(i),{title:t,sound:"none"})):plus.push.createMessage(n,JSON.stringify(i),{title:t}),"+1"===s&&this.setClientBadge(e.badge+1)))}static setBadge(t){if(!Number.isInteger(t.badge)||t.badge<0)gc.onFailed(t,"badge must be an integer greater than or equal to 0.");else if(e.supportAppNotification())if(this.uniappPlugin&&oc.currentPlatform()===ic.UNI_IOS){let e=new Qc({name:dc.SET_IOS_BADGE,params:{badge:t.badge},unique:!0,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,permission:Jc.WRITE,success:()=>{gc.onSuccess(t),this.setClientBadge(t.badge)},fail:e=>{gc.onFailed(t,e.content)}});Wc.Socket.e(e)}else gc.onSuccess(t),this.setClientBadge(t.badge)}static setClientBadge(t){"vivo"!==plus.device.vendor&&(e.badge=t,plus.runtime.setBadgeNumber(t))}static askRegId(){let e=null,t=0;const n=()=>new Promise(((i,o)=>{this.uniappPlugin.regId((e=>{i(e)}),(i=>{if(!(1e6===i.data.code&&t<=10))return clearTimeout(e),o(i);e=setTimeout((()=>{t++,this.regIdPromise=n()}),3500)}))}));return n()}static getRegIdPromise(){return this.regIdPromise}static supportAppNotification(){const e=oc.currentPlatform();return this.allowNotification&&(e===ic.UNI_ANDROID||e===ic.UNI_IOS)}static listenPlusClickNotification(){plus.push.addEventListener("click",(e=>{try{if(e){const t="string"==typeof e.payload?JSON.parse(e.payload):e.payload;if(this.availableIntent(t)){let e=this.assemblePayload(t);plus.push.clear(),this.onClickNotificationCallback(e)}}}catch(t){}}))}static availableIntent(e){return e&&Object.keys(e).length&&e.g&&1===parseInt(e.g)}static getIntentData(){this.uniappPlugin.getIntentData((e=>{if(!this.availableIntent(e))return;let t=this.assemblePayload(e);const n=oc.currentPlatform();plus.push.clear(),n===ic.UNI_ANDROID&&this.uniappPlugin.clearAll(),this.onClickNotificationCallback(t)}))}static listenClick(){this.listenPlusClickNotification();const e=oc.currentPlatform();this.uniappPlugin&&e===ic.UNI_ANDROID&&(this.getIntentData(),lc.onFrontend((()=>{this.getIntentData()})))}static onClickNotification(t){if(e.supportAppNotification()){if(!nc.isFunction(t))throw new Error("The arguments must be a function.");null===this.onClickNotificationCallback?(this.onClickNotificationCallback=t,this.listenClick()):console.warn("The onClickNotification event has been listened on. Please do not listen to it more than once.")}else console.warn("The current environment doesn't support or allowNotification is false.")}};function tu(...e){}eu.uniappPlugin=null,eu.v=null,eu.regIdPromise=null,eu.onClickNotificationCallback=null,eu.payloadAssemblers=new Array;const nu=new class{validateId(e,t){if(nc.isEmpty(e))throw{code:400,content:` ${t} is required.`};if(!nc.isString(e))throw{code:400,content:`TypeError: ${t} require string.`}}validateIdArray(e,t){if(!Array.isArray(e)||0===e.length)throw{code:400,content:`TypeError: ${t} require array.`};if(e.length>100)throw{code:400,content:`${t} is over max length 100.`};for(let n=0;n1e4)throw{code:400,content:"Message over max length 10000."};if(e.qos&&!(e.qos in[0,1]))throw{code:400,content:"Qos must be 0 or 1."};e.wxmpTemplateMsg&&nu.validateWXMPTemplateMsg(e.wxmpTemplateMsg),nc.isDef(e.notification)&&nu.validateNotification(e.notification)}},su=class{constructor(e){if(this.options=e,this.channels=e.channels||[e.channel],!nc.isEmpty(e.channel)){let t=e.channel.toString();this.channels=[t]}nc.isEmpty(e.channels)||(this.channels=e.channels.toString().split(","))}};var au,ru,cu;!function(e){e.message="message",e.imMessage="imMessage",e.userPresence="userPresence",e.groupPresence="groupPresence",e.PS_PRESENCE_EVENT="PS_PRESENCE_EVENT",e.IM_MSG_READ="IM_MSG_READ",e.IM_MSG_DELETED="IM_MSG_DELETED",e.IM_MSG_RECALLED="IM_MSG_RECALLED",e.CS_ONLINE_CHANGED="CS_ONLINE_CHANGED"}(au||(au={})),function(e){e.CONNECTED="CONNECTED",e.RECONNECTED="RECONNECTED",e.DISCONNECTED="DISCONNECTED",e.LOST="LOST",e.EXPIRED_RECONNECTED="EXPIRED_RECONNECTED",e.NEW_MESSAGE="NEW_MESSAGE",e.CONNECTING="CONNECTING"}(ru||(ru={}));let uu=class{constructor(){this.subscriptions=[],Wc.Socket.onMessage(au.message,this.onNewMessage.bind(this)),Wc.Socket.on(ru.EXPIRED_RECONNECTED,this.expiredResubscribe.bind(this)),Wc.Socket.on(ru.RECONNECTED,this.resubscribePresenceChannel.bind(this))}expiredResubscribe(){this.subscriptions.forEach((e=>{this.doSubscribe(e,!1)}))}resubscribePresenceChannel(){this.subscriptions.forEach((e=>{let t=e.options;t.presence&&t.presence.enable&&this.doSubscribe(e,!0)}))}onNewMessage(e){if(e.n.indexOf("_presence")>-1)return;e.a&&Wc.Socket.sendAck("ack",{i:e.i,c:e.n});let t={time:e.t,channel:e.n,content:e.c};this.createNotification(e),this.findSubscriptionByChannel(t.channel).options.onMessage(t)}createNotification(e){const t=Wc.N.supportAppNotification();if(!nc.isObject(e.nt)||!t)return;const n={ch:e.n,ctt:e.c};Wc.N.createLocalNotification(e.nt.t,e.nt.c,n,e.nt.sound,e.nt.badge)}subscribe(e){if(nu.validateChannelAndChannels(e.channel,e.channels),nc.isDef(e.presence)){let t=e.presence.enable;if(!nc.isBoolean(t))throw{code:400,content:"Subscription failed. presence.enable must be a boolean"};if(t&&!Wc.Socket.user().id)throw{code:400,content:"Subscription failed. If presence is enable, the id must be specified when calling the connect method"}}let t=new su(e);this.doSubscribe(t,!1).then((()=>{this.subscriptions.push(t),gc.onSuccess(e,{code:200,content:"ok"})})).catch((t=>{gc.onFailed(e,{code:t.resultCode,content:t.content})}))}doSubscribe(e,t){let n=e.options;return new Promise(((i,o)=>{let s=new Qc({name:dc.subscribe,permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,params:{channels:e.channels,accessToken:n.accessToken,presence:n.presence,resubscribe:t},success:()=>{i()},fail:e=>{o(e)}});Wc.Socket.e(s)}))}unsubscribe(e){nu.validateChannel(e.channel,"channel"),e.channel=e.channel.toString();const t=this.findSubscriptionByChannel(e.channel);if(!t)return void e.onFailed({code:400,content:"channel["+e.channel+"] is not subscribed"});let n=new Qc({name:dc.unsubscribe,params:{channel:e.channel,presence:t.options.presence},permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:()=>{e.onSuccess({code:200,content:"ok"}),this.removeChannel(e.channel)},fail:function(t){e.onFailed({code:t.resultCode,content:t.content})}});Wc.Socket.e(n)}removeChannel(e){for(let t=this.subscriptions.length-1;t>=0;t--){const n=this.subscriptions[t].channels,i=n.indexOf(e);if(i>-1){n.splice(i,1),0===n.length&&this.subscriptions.splice(t,1);break}}}findSubscriptionByChannel(e){let t=!1,n=null;for(let i=this.subscriptions.length-1;i>=0;i--){let o=this.subscriptions[i].channels;for(let s=0;s{e.onSuccess({code:t.resultCode||t.code||200,content:t.content})},fail:t=>{e.onFailed({code:t.resultCode||t.code,content:t.content})}});Wc.Socket.e(t)}},du=class{constructor(){this.channelPresenceMap=new Map,this.onPresenceEvent=e=>{let t=this.channelPresenceMap.get(e.channel);null==t||t.onPresence(e)},this.expireAllChannelPresences=()=>{this.channelPresenceMap.forEach(((e,t)=>{e.expire()}))},this.resubscribe=()=>{this.channelPresenceMap.forEach(((e,t)=>{e.subscribed()&&e.doSubscribe()}))},Wc.Socket.on(ru.LOST,this.expireAllChannelPresences),Wc.Socket.on(ru.RECONNECTED,this.resubscribe),Wc.Socket.onMessage(au.PS_PRESENCE_EVENT,this.onPresenceEvent)}hereNow(e){nu.validateChannel(e.channel,"channel");let t,n=this.channelPresenceMap.get(e.channel.toString());n&&n.queryPromise?(e.limit&&e.limit>n.membersLimit&&n.doQuery(e.limit),t=n.queryPromise):t=hu(e.channel,e.limit),t.then((t=>{e.onSuccess(t)})).catch((t=>{e.onFailed(t)}))}subscribe(e){if(nu.validateChannel(e.channel,"channel"),nc.isUndef(e.onPresence)||!nc.isFunction(e.onPresence))throw{code:400,content:"Subscription Presence failed. onPresence callback function is required"};let t=e.channel.toString(),n=this.channelPresenceMap.get(t);n||(n=new pu(t),this.channelPresenceMap.set(t,n)),n.subscribe(e)}unsubscribe(e){nu.validateChannel(e.channel,"channel");let t=e.channel.toString();if(this.channelPresenceMap.get(t)){let n=new Qc({name:dc.PUBSUB_PRESENCE_UNSUBSCRIBE,permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,params:{channel:t},success:n=>{this.channelPresenceMap.delete(t),e.onSuccess()},fail:t=>{e.onFailed(t)}});Wc.Socket.e(n)}else e.onSuccess()}},pu=class{constructor(e){this.membersLimit=10,this.queried=!1,this.channel=e}onPresence(e){return fc(this,void 0,void 0,(function*(){this.queried?this.update(e):yield this.queryPromise,this.on({channel:this.channel,action:e.action,member:e.member,time:e.time,amount:this.amount,members:this.membersByLimit()})}))}membersByLimit(){return this.members.slice(0,this.membersLimit)}subscribe(e){return fc(this,void 0,void 0,(function*(){if(e.membersLimit&&(this.membersLimit=Math.min(e.membersLimit,300)),!this.subscribed())try{yield this.doSubscribe()}catch(t){return void e.onFailed(t)}this.on=e.onPresence,e.onSuccess()}))}doSubscribe(){return this.doQuery(this.membersLimit),new Promise(((e,t)=>{let n=new Qc({name:dc.PUBSUB_PRESENCE_SUBSCRIBE,permission:Jc.READ,params:{channel:this.channel},singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:t=>{e()},fail:e=>{t(e)}});Wc.Socket.e(n)}))}doQuery(e){this.queryPromise=hu(this.channel,e),this.queryPromise.then((e=>{this.members=e.content.members,this.amount=e.content.amount,this.queried=!0})).catch((e=>{throw e}))}update(e){if(["join","back"].includes(e.action))this.members.unshift(e.member);else if(["leave","timeout"].includes(e.action)){let t=this.members.findIndex((t=>t.id===e.member.id));t>-1&&this.members.splice(t,1)}this.amount=e.amount}expire(){this.queried=!1,this.queryPromise=null}subscribed(){return void 0!==this.on}};function hu(e,t){return t||(t=10),new Promise(((n,i)=>{let o={channel:e,limit:t},s=new Qc({name:dc.PUBSUB_PRESENCE_HERENOW,permission:Jc.READ,params:o,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,success:e=>{n(e)},fail:e=>{i(e)}});Wc.Socket.e(s)}))}let gu=class e{constructor(){this.publisher=new ou,this.subscriber=new uu,this.presence2=new du,this.histories=new lu}static init(){this.instance=new e}publish(e){this.publisher.publish(e)}subscribe(e){this.subscriber.subscribe(e)}unsubscribe(e){this.subscriber.unsubscribe(e)}subscribePresence(e){this.presence2.subscribe(e)}unsubscribePresence(e){this.presence2.unsubscribe(e)}history(e){this.histories.get(e)}hereNow(e){this.presence2.hereNow(e)}},fu=class e extends Fc{static init(){return this.module=new e,this.module.name=this.GWS_MODULE_NAME,this.initGN(),this.module}static initGN(){eu.addAssembler(new class{assemble(e){return{channel:e.ch,content:e.ctt}}support(e){return!!e.ch}})}postConnect(){gu.init()}static check(){if(!this.module)throw{code:400,content:"PubSub not initialized. Please include 'PUBSUB' in the 'modules' during GoEasy initialization."}}};fu.GWS_MODULE_NAME="GWS";let mu=class{constructor(){}};!function(e){e.aliYun="ALI",e.qiNiu="QN",e.tencent="TX",e.s3="S3"}(cu||(cu={}));let _u=new class extends mu{constructor(){super()}upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{Nn.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.tempFilePath||t.fullPath||t.path}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(e);Nn.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{const i=this.getTempFilePath(e);if("undefined"!=typeof plus)plus.io.resolveLocalFileSystemURL(i,(e=>{e.file((e=>{let i=new plus.io.FileReader;i.onloadend=e=>{const n=Nn.base64ToArrayBuffer(e.target.result.split(",")[1]);t(n)},i.onerror=function(e){n(e)},i.readAsDataURL(e)}))}),(e=>{n("Resolve file URL failed: "+e.message)}));else if("undefined"!=typeof FileReader){const i=new FileReader;i.onload=()=>{t(i.result)},i.onerror=e=>{n(e)},i.readAsArrayBuffer(e.file)}else if("object"==typeof Pn&&Pn.canIUse("getFileSystemManager"))try{const e=Pn.getFileSystemManager().readFileSync(i);t(e)}catch(o){n(o)}}))}};const vu=new class extends mu{upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):new Promise(((n,i)=>{Pn.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))}))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file||e.fileRes;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));Pn.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{try{t(Pn.getFileSystemManager().readFileSync(e))}catch(i){n(i)}}))}},yu=new class extends mu{constructor(){super()}upload(e,t){return new Promise(((n,i)=>{try{const o=new XMLHttpRequest,s=e.storageLocation===cu.s3,a=s?"PUT":"POST",r=s?e.url:e.host;o.open(a,r,!0);for(let t in e.headers)o.setRequestHeader(t,e.headers[t]);o.upload.onprogress=function(e){t&&t(e)},o.upload.onloadstart=function(e){t&&t(e)},o.upload.onloadend=function(e){t&&t(e)};let c=new FormData;for(let t in e.parameters)"fileRes"==t?c.append("file",e.parameters[t]):c.append(t,e.parameters[t]);const u=s?e.file:c;o.send(u),o.onreadystatechange=function(){4==o.readyState&&(o.status>=200&&o.status<300||304==o.status?(s&&(e.url=e.url.split("?")[0]),n()):i({code:o.status,content:o.responseText}))}}catch(o){i({code:500,content:o})}}))}fileToArrayBuffer(e){return new Promise(((t,n)=>{const i=new FileReader;i.onload=()=>{t(i.result)},i.onerror=e=>{n(e)},i.readAsArrayBuffer(e)}))}},Iu=new class extends mu{upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{my.uploadFile({url:e.host,filePath:this.getTempFilePath(e),fileType:"image",name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));my.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{my.getFileSystemManager().readFile({filePath:e,success:e=>{t(e.data)},fail(e){n(e)}})}))}},Mu=new class extends mu{upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{swan.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));swan.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{swan.getFileSystemManager().readFile({filePath:e,success:e=>{t(e.data)},fail:e=>{n(e)}})}))}};let Cu=class{constructor(e,t,n){this.storageLocation=e,this.url=t,this.name=n}};const Su=new class{constructor(){this.uploader={[zr.UNIAPP]:_u,[ic.MP_WX]:vu,[ic.BROWSER]:yu,[ic.MP_ALI]:Iu,[ic.MP_BAIDU]:Mu,[zr.REACT_NATIVE]:yu,[ic.MP_BYTE]:vu}}upload(e,t){return fc(this,void 0,void 0,(function*(){const n=$r.currentFramework(),i=oc.currentPlatform(),o=n===zr.UNKNOWN?i:n;let s=this.uploader[o];return yield s.upload(e,t),new Cu(e.storageLocation,e.url,e.newFileName)}))}};let Eu=class{resolve(e){return new Promise(((t,n)=>{let i=new Qc({name:"uploadToken",params:{filename:e},permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail(e){n(e.content)},success(e){200===e.code?t(e.content):n(e.content)}});Wc.Socket.e(i)}))}},Tu=class{constructor(e,t,n,i,o,s,a){this.storageLocation=e,this.host=t,this.headers=n,this.parameters=i,this.file=o,this.newFileName=s,this.url=a}},ku=class{constructor(){}newFileName(e){return e&&e.newFilename||""}},Du=new class extends ku{constructor(){super()}url(e){return e.host+"/"+e.dir+"/"+this.newFileName(e)}build(e,t,n){let i,o=this.newFileName(e);return i={key:e.dir+"/"+o,OSSAccessKeyId:e.accessKeyId,policy:e.policy,signature:e.signature,success_action_status:"200",fileRes:t},n&&(i={key:e.dir+"/"+o,OSSAccessKeyId:e.accessKeyId,policy:e.policy,signature:e.signature,success_action_status:"200","Content-Disposition":"attachment;filename="+t.name,fileRes:t}),new Tu(cu.aliYun,e.host,null,i,t,o,this.url(e))}},Ru=new class extends ku{constructor(){super()}url(e){return e.host+"/"+e.key}build(e,t,n){let i={"q-sign-algorithm":e.qSignAlgorithm,"q-ak":e.qAk,"q-key-time":e.qKeyTime,"q-signature":e.qSignature,policy:e.policy,"x-cos-security-token":e.xCosSecurityToken,success_action_status:"200",key:e.key,fileRes:t};return n&&(i={"q-sign-algorithm":e.qSignAlgorithm,"q-ak":e.qAk,"q-key-time":e.qKeyTime,"q-signature":e.qSignature,policy:e.policy,"x-cos-security-token":e.xCosSecurityToken,success_action_status:"200",key:e.key,"Content-Disposition":`attachment;filename=${t.name}`,fileRes:t}),new Tu(cu.tencent,e.host,null,i,t,e.key,this.url(e))}},Ou=new class extends ku{constructor(){super()}url(e){return e.uploadUrl}build(e,t,n){const i={file:t};return new Tu(cu.s3,null,{"Content-Type":"application/octet-stream"},i,t,t.name,this.url(e))}},bu=class{constructor(){this.uploadTokenResolver=new Eu}builder(e){if(e===cu.aliYun)return Du;if(e===cu.tencent)return Ru;if(e===cu.s3)return Ou;throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e)}build(e,t,n){return fc(this,void 0,void 0,(function*(){try{let i=yield this.uploadTokenResolver.resolve(t),o=this.builder(i.vendor).build(i,e,n);return Promise.resolve(o)}catch(i){return Promise.reject(i)}}))}},Au=class{constructor(){this.requestBuilder=new bu,this.fileUploader=Su}upload(e,t,n,i){return fc(this,void 0,void 0,(function*(){try{let o=yield this.requestBuilder.build(e,t,i);return this.fileUploader.upload(o,n)}catch(o){return Promise.reject(o)}}))}};var Lu,Pu,Nu,wu;!function(e){e.MESSAGE_SENDING="IM_INTERNAL_MESSAGE_SENDING",e.MESSAGE_SEND_SUCCESS="IM_INTERNAL_MESSAGE_SEND_SUCCESS",e.MESSAGE_SEND_FAILED="IM_INTERNAL_MESSAGE_SEND_FAILED",e.MESSAGE_RECEIVED="IM_INTERNAL_MESSAGE_RECEIVED",e.MESSAGE_RECALLED="IM_INTERNAL_MESSAGE_RECALLED",e.MAX_MESSAGE_CHANGED="IM_INTERNAL_MAX_MESSAGE_CHANGED",e.MAX_MESSAGE_DELETED="IM_INTERNAL_MAX_MESSAGE_DELETED",e.UNREAD_AMOUNT_CHANGED="IM_INTERNAL_UNREAD_MESSAGE_CHANGED",e.CS_ONLINE_SUCCESS="CS_ONLINE_SUCCESS",e.CS_OFFLINE_SUCCESS="CS_OFFLINE_SUCCESS",e.CS_ACCEPTED="CS_ACCEPTED",e.CS_ENDED="CS_ENDED",e.CS_TRANSFER="CS_TRANSFER",e.CS_AGENT_MESSAGE_RECEIVED="CS_AGENT_MESSAGE_RECEIVED"}(Lu||(Lu={}));let Uu=class{clearUseLessAttribute(){delete this.buildOptions}isOtherSent(){return this.senderId!==Wc.Socket.user().id}getToData(){return this.buildOptions.createOptions.to.data}},Gu=class{};!function(e){e.TEXT="text",e.IMAGE="image",e.FILE="file",e.VIDEO="video",e.AUDIO="audio"}(Pu||(Pu={}));let xu=class extends Gu{constructor(){super(...arguments),this.goEasyUploader=new Au}improve(e){let t=e.message;return new Promise(((e,n)=>{let i,o,s=t.buildOptions.createOptions;t.type===Pu.VIDEO?(o=t.payload,i=o.video.name):(o=t.payload,i=o.name),this.goEasyUploader.upload(s.file,i,s.onProgress,t.type===Pu.FILE).then((n=>{n.storageLocation!==cu.s3&&(n.url=encodeURI(n.url)),this.setPayload(n,t),e()})).catch((e=>{n(e)}))}))}setPayload(e,t){t.payload.url=e.url}},Fu=class extends xu{setPayload(e,t){let n,i=t.payload;switch(i.video.url=e.url,i.video.name=e.name,i.thumbnail.height>200&&(i.thumbnail.height=200,i.thumbnail.width=200*i.video.width/i.video.height),e.storageLocation){case cu.aliYun:n="?x-oss-process=video/snapshot,t_0000,f_jpg,h_"+i.thumbnail.height+",m_fast,ar_auto";break;case cu.tencent:n="?ci-process=snapshot&time=1&format=jpg&height="+i.thumbnail.height;break;case cu.s3:n="?process=video&height="+i.thumbnail.height;break;default:throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e.storageLocation)}i.thumbnail.url=e.url+n}},Bu=class extends xu{setPayload(e,t){let n,i=t.payload;i.url=e.url;const o=i.height>200?200:i.height;switch(e.storageLocation){case cu.aliYun:n="?x-oss-process=image/resize,m_lfit,h_"+o;break;case cu.tencent:n=`?imageMogr2/thumbnail/x${o}`;break;case cu.s3:n=`?process=image&height=${o}`;break;default:throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e.storageLocation)}i.thumbnail=e.url+n}},qu=class{constructor(){this.improvers={[Pu.FILE]:new xu,[Pu.AUDIO]:new xu,[Pu.IMAGE]:new Bu,[Pu.VIDEO]:new Fu}}improve(e){let t=this.improvers[e.message.type];if(t)try{return t.improve(e)}catch(n){return Promise.reject(n)}return Promise.resolve()}},Vu=class e extends jc{static init(){this.i=new e}},ju=class{constructor(e,t,n,i,o){this.validate(e),this.mt=e.type,this.to=t.id.toString(),this.d=JSON.stringify(t.data),this.p=JSON.stringify(e.payload),n&&(this.nt=n),o&&(this.at=o),i&&(this.wxmpTemplateMsg=iu(i),this.wxmpTemplateMsg.data=JSON.stringify(this.wxmpTemplateMsg.data));let s=t.type;if(this.t=s,s===Qr.CS){let t=e;this.tid=t.teamId}this.guid=e.messageId}validate(e){if(e.type===Pu.TEXT&&JSON.stringify(e.payload).length>3072)throw Error("message-length limit 3kb")}},Hu=class{constructor(){this.payloadImprover=new qu}send(e){this.validate(e);let t=e.message,n=e.accessToken,i=t.buildOptions,o=i.createOptions,s=o.notification,a=o.wxmpTemplateMsg,r=o.to;r.data||(r.data={}),t.status=Zr.SENDING;let c=i.complete,u=this.payloadImprover.improve(e);Promise.all([c,u]).then((()=>fc(this,void 0,void 0,(function*(){if(o.beforeSend){const e=JSON.parse(JSON.stringify(t));yield o.beforeSend(e)}this.doSend(t,r,s,a,n,e)})))).catch((n=>{t.status=Zr.FAIL,gc.onFailed(e,{code:n&&n.code||400,content:n&&n.content||n})}))}doSend(e,t,n,i,o,s){let a=new ju(e,t,n,i,o);Vu.i.fire(Lu.MESSAGE_SENDING,e);let r=new Qc({name:dc.publishIM,params:a,unique:!0,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:t=>{e.status=Zr.FAIL,Vu.i.fire(Lu.MESSAGE_SEND_FAILED,e),gc.onFailed(s,{code:t.resultCode,content:t.content})},success:t=>{if(e.status=Zr.SUCCESS,e.timestamp=t.content.timestamp,e.messageId=JSON.stringify(t.content.id),e.scene()===Qr.CS){let n=e;n.customerId()!==Wc.Socket.user().id&&(n.sessionId=t.content.sessionId)}e.clearUseLessAttribute(),Vu.i.fire(Lu.MESSAGE_SEND_SUCCESS,e),gc.onSuccess(s,e)}});Wc.Socket.e(r)}validate(e){let t=e.message;if(!(t instanceof Uu))throw new Error("it is invalid message");if(t.status!==Zr.NEW)throw new Error("Please create a new message, a message can only be sent once")}},Ku=class{insert(e,t){let n=this.binarySearch(e,t);if(n>=0)e.splice(n,1,t);else{let i=-n-1;e.splice(i,0,t)}}binarySearch(e,t){let n=0,i=e.length-1;for(;n<=i;){let o=i+n>>1,s=this.compare(t,e[o]);if(s>0)n=o+1;else{if(!(s<0))return o;i=o-1}}return-n-1}},zu=class e{constructor(e){this.messages=new Array,this.allLoaded=!1,this.target=e}all(){return this.messages}sliceOverLengthMessages(){this.messages.length>e.CACHE_MAX_LENGTH&&(this.messages=this.messages.slice(-e.CACHE_MAX_LENGTH),!0===this.allLoaded&&(this.allLoaded=!1))}getMaxMessage(){return this.messages[this.messages.length-1]}loadLocalMessages(e,t){let n=[],i=this.messages.length;if(t){if(i>0){let o=this.messages[0].timestamp,s=this.messages[i-1].timestamp;if(t>=o&&t<=s)for(let a=i-1;a>=0;a--){let i=this.messages[a];if(i.timestamp0&&i.timestamp===t.lastTimestamp)&&(n.forEach((t=>{e.sortedInserter.insert(this.messages,t)})),n.lengthe===t.timestamp))}findMessagesByTimes(e){let t=[];return e.forEach((e=>{let n=this.findMessageByTime(e);nc.isDef(n)&&t.push(n)})),t}existsMessage(e){return this.findMessageIndexById(e)>-1}findMessageIndexById(e){return this.messages.findIndex((t=>e===t.messageId))}deleteMessage(e){let t=this.findMessageIndexById(e);t>=0&&this.messages.splice(t,1)}recallMessage(e){return e.times.map((e=>this.findMessageByTime(e))).filter((e=>nc.isDef(e))).map((t=>(t.recalled=!0,t.recaller=e.recaller,t)))}isEmpty(){return 0===this.messages.length}deleteMessages(e){e.forEach((e=>{this.deleteMessage(e.messageId)}))}saveMessage(t){e.sortedInserter.insert(this.messages,t),this.deleteGroupConversationMessage(),this.sliceOverLengthMessages()}deleteGroupConversationMessage(){this.target.scene===Qr.GROUP&&this.messages.length>=2&&1===this.messages[0].x&&this.messages.shift()}maxSuccessMessageTime(){for(let e=this.messages.length-1;e>=0;e--)if(this.messages[e].status===Zr.SUCCESS)return this.messages[e].timestamp;return 0}minTime(){return this.isEmpty()?0:this.messages[0].timestamp}correctPosition(e){this.deleteMessage(e.messageId),this.saveMessage(e)}};zu.CACHE_MAX_LENGTH=200,zu.sortedInserter=new class extends Ku{compare(e,t){let n=e.timestamp-t.timestamp;return n>0?1:0===n?0:-1}};let Wu=class e{constructor(e,t,n){this.scene=e,this.id=t,nc.isDef(n)&&(this.teamId=n)}toString(){return Qr.PRIVATE===this.scene||Qr.GROUP===this.scene?this.scene+"#"+this.id:this.scene+"#"+this.id+"#"+this.teamId}customerId(){if(Qr.CS===this.scene)return this.id===this.teamId?Wc.Socket.user().id:this.id}static byScene(t,n,i){return new e(t,n,i)}static byIMMessage(t){let n,i,o=t.scene();if(o===Qr.PRIVATE){let e=t.senderId,n=t.targetId();i=Wc.Socket.user().id===e?n:e}else if(o===Qr.GROUP)i=t.targetId();else{if(o!==Qr.CS)throw{code:400,content:`scene ${o} not exists`};i=t.targetId(),n=t.teamId}return new e(o,i,n)}static byMessageReadRemoteEvent(t){let n,i=t.scene,o=t.targetId,s=t.markerId,a=t.teamId;return i===Qr.PRIVATE?n=Wc.Socket.user().id===s?o:s:i===Qr.GROUP?n=o:i===Qr.CS&&(n=o===a?s===Wc.Socket.user().id?a:s:s===Wc.Socket.user().id?o:a),new e(i,n,a)}static byIMMessageDeletedEvent(t){let n=t.scene,i=t.deleterId;if(n===Qr.PRIVATE){let o=Wc.Socket.user().id===i?t.targetId:i;return new e(n,o)}if(n===Qr.GROUP)return new e(n,t.targetId)}static byConversationDTO(e){let t=e.lastMessage;return this.byIMMessage(t)}static byConversationId(t,n){let i;if(t===Qr.PRIVATE){let e=n.split(":",2);i=e[0]===Wc.Socket.user().id?e[1]:e[0]}else i=n;return new e(t,i)}},Yu=class{constructor(e){this.times=new Array;let t=e[0],n=Wu.byIMMessage(t);this.scene=n.scene,this.targetId=n.id,e.forEach((e=>{e.status===Zr.SUCCESS&&this.times.push(e.timestamp)})),this.times.sort(((e,t)=>e{let i=new Qc({name:dc.IM_DELETE_MESSAGE,params:t,permission:Jc.WRITE,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,success:t=>{200===t.code?e(t):n(t)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}static validate(e){let t=e.messages;for(let n=0;n{let n=new Qc({name:dc.IM_HISTORY_CHANGE,params:s,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{t(e)},success:t=>{let n=t.content;e(n)}});Wc.Socket.e(n)}))}loadServerMessages(e,t){return new Promise(((n,i)=>{let o=new Qc({name:dc.IM_HISTORY,params:t,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{i(e)},success:t=>{let i=t.content;i.messages=this.convertServerMessages(e,i.messages),n(i)}});Wc.Socket.e(o)}))}convertServerMessages(e,t){let n=[],i=e.scene,o=e.id;return t.forEach((t=>{if(t.t=i,Qr.PRIVATE===i)t.r=t.s===Wc.Socket.user().id?o:Wc.Socket.user().id;else if(Qr.GROUP===i)t.r=o;else if(Qr.CS===i){let n=e.customerId(),i=e.teamId;n===Wc.Socket.user().id?t.r=i:t.r=n}let s=this.builder.build(t);n.push(s)})),n}updateServerOffsets(e,t){return fc(this,void 0,void 0,(function*(){let n=new Xu(t.id,t.scene,e,t.teamId);return new Promise(((e,t)=>{let i=new Qc({name:dc.IM_MARK_AS_READ,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:t=>{e(t)},fail:e=>{t(e)}});Wc.Socket.e(i)}))}))}};nl.instance=new nl;let il=class{constructor(){this.offsetMap=new Map,this.markingTime=0,this.userId=Wc.Socket.user().id}updateOffset(e,t){let n=this.offsetMap.get(e);return nc.isDef(n)?t>n&&(this.offsetMap.set(e,t),!0):(this.offsetMap.set(e,t),!0)}updateUserOffsets(e){e.forEach((e=>{let t=e.userId,n=e.offset;this.updateOffset(t,n)}))}updateMyOffset(e){return this.updateOffset(this.userId,e)}myOffset(){return this.getOffset(this.userId)}getOffset(e){return this.offsetMap.get(e)||0}},ol=class{constructor(e,t,n,i,o){this.id=e,this.scene=t,this.lastTimestamp=n,this.limit=i,this.teamId=o}},sl=class{constructor(e){this.history=e}pre(){this.oldLastMessage=this.history.getMaxMessage(),this.oldUnreadAmount=this.history.unreadAmount(),this.oldLastMessage&&(this.oldLastMessageRecalled=this.oldLastMessage.recalled,this.oldLastMessageRead=this.oldLastMessage.read,this.oldLastMessageStatus=this.oldLastMessage.status)}post(){let e,t,n,i=this.history.unreadAmount(),o=this.history.getMaxMessage();o&&(n=o.status,e=o.read,t=o.recalled);let s=this.history.target;this.oldLastMessage!==o||this.oldLastMessageRead!==e||this.oldLastMessageRecalled!==t||this.oldLastMessageStatus!==n?o?Vu.i.fire(Lu.MAX_MESSAGE_CHANGED,o):Vu.i.fire(Lu.MAX_MESSAGE_DELETED,s):this.oldUnreadAmount!==i&&Vu.i.fire(Lu.UNREAD_AMOUNT_CHANGED,s)}},al=class{constructor(e,t,n,i){this.scene=e,this.conversationId=t,this.recaller=n,this.times=i}},rl=class{static init(){this.eventCenter=new zc}static on(e,t){this.eventCenter.on(e,t)}static fire(e,t){this.eventCenter.fire(e,t)}static off(e,t){this.eventCenter.off(e,t)}};!function(e){e.PRIVATE_MESSAGE_RECEIVED="PRIVATE_MESSAGE_RECEIVED",e.GROUP_MESSAGE_RECEIVED="GROUP_MESSAGE_RECEIVED",e.SYSTEM_MESSAGE_RECEIVED="SYSTEM_MESSAGE_RECEIVED",e.CONVERSATIONS_UPDATED="CONVERSATIONS_UPDATED",e.HISTORY_EXPIRED="HISTORY_EXPIRED",e.USER_PRESENCE="USER_PRESENCE",e.GROUP_PRESENCE="GROUP_PRESENCE",e.MESSAGE_DELETED="MESSAGE_DELETED",e.MESSAGE_READ="MESSAGE_READ",e.MESSAGE_RECALLED="MESSAGE_RECALLED",e.CS_MESSAGE_RECEIVED="CS_MESSAGE_RECEIVED",e.PENDING_CONVERSATIONS_UPDATED="PENDING_CONVERSATIONS_UPDATED"}(wu||(wu={}));let cl=class{constructor(e){this.expiredTime=0,this.remoteHistory=nl.instance,this.target=e,this.userOffsets=new il,this.messageCache=new zu(e)}initMaxMessageAndOffsets(e,t){this.existsMessage(e)||(this.messageCache.saveMessage(e),t.forEach((e=>{this.markLocalMessagesRead(this.messageCache.all(),e.userId,e.offset,!1)})))}existsMessage(e){return this.messageCache.existsMessage(e.messageId)}loadHistory(e,t){return fc(this,void 0,void 0,(function*(){return this.expiredTime>0&&!this.messageCache.isEmpty()&&(yield this.updateByServerChange()),nc.isUndef(t)?t=10:t>30&&(t=30),yield this.loadServerMessages(e,t)}))}loadServerMessages(e,t){return fc(this,void 0,void 0,(function*(){let n=this.messageCache.loadLocalMessages(t,e);if(!1===this.messageCache.allLoaded&&n.length!==t){let i=t-n.length,o=n[0]?n[0].timestamp:e,s=new ol(this.target.id.toString(),this.target.scene,o,i,this.target.teamId),a=yield this.remoteHistory.loadServerMessages(this.target,s),r=a.messages;n=r.concat(n),this.messageCache.cacheServerMessages(s,r),a.userOffsets.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),this.userOffsets.offsetMap.forEach(((e,t)=>{this.markLocalMessagesRead(r,t,e,!1)}))}return n}))}deleteMessages(e){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){let t=e.messages;yield $u.deleteServerMessages(t),this.messageCache.deleteMessages(t),gc.onSuccess(e)}))))}))}syncDeletedMessage(e,t){this.aopUnreadAmountMaxMessage((()=>{this.doSyncDeletedMessage(e,t)}))}doSyncDeletedMessage(e,t){if(e===Wc.Socket.user().id){let e=this.messageCache.findMessagesByTimes(t);this.messageCache.deleteMessages(e),e.length>0&&rl.fire(wu.MESSAGE_DELETED,e)}}recallMessages(e){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){this.doRecall(e)}))))}))}doRecall(e){let t=this.messageCache.recallMessage(e);t.length>0&&rl.fire(wu.MESSAGE_RECALLED,t)}expire(){this.messageCache.isEmpty()||(this.expiredTime=this.messageCache.maxSuccessMessageTime())}updateByServerChange(){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){let e=yield this.remoteHistory.sync(this.target.scene,this.target.id,this.expiredTime,this.messageCache.minTime(),this.target.teamId);e.userOffsets.forEach((e=>{this.markLocalMessagesRead(this.messageCache.all(),e.userId,e.offset,!0)}));let t=e.deletedMessageTimes;t.length>0&&this.doSyncDeletedMessage(Wc.Socket.user().id,t);let n=e.recalledMessages;n.length>0&&n.forEach((e=>{let t=new al(this.target.scene,this.target.id,e.recaller,e.times);this.doRecall(t)})),this.expiredTime=0}))))}))}markRead(){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){let e=this.messageCache.maxSuccessMessageTime();e>this.userOffsets.myOffset()&&(this.userOffsets.markingTime=e,yield this.remoteHistory.updateServerOffsets(e,this.target),e===this.userOffsets.markingTime&&this.markLocalMessagesRead(this.messageCache.all(),Wc.Socket.user().id,e,!0))}))))}))}syncMarkedMessage(e){this.aopUnreadAmountMaxMessage((()=>{this.markLocalMessagesRead(this.messageCache.all(),e.markerId,e.time,!0)}))}onMessageSending(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.saveMessage(e)}))}onMessageSendSuccess(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.correctPosition(e),this.markLocalMessagesRead(this.messageCache.all(),Wc.Socket.user().id,e.timestamp,!0)}))}onMessageSendFailed(e){this.getMaxMessage()===e&&Vu.i.fire(Lu.MAX_MESSAGE_CHANGED,e)}onMessageReceived(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.saveMessage(e),this.markLocalMessagesRead(this.messageCache.all(),e.senderId,e.timestamp,!0)}))}aopUnreadAmountMaxMessage(e,t){return fc(this,void 0,void 0,(function*(){try{let t=new sl(this);t.pre(),yield e(),t.post()}catch(n){gc.onFailed(t,n)}}))}markLocalMessagesRead(e,t,n,i){if(this.userOffsets.updateOffset(t,n),this.isOtherUserId(t)){let t=this.markMySentRead(e,n);i&&t.length>0&&rl.fire(wu.MESSAGE_READ,t)}else t===Wc.Socket.user().id&&this.markOthersSentRead(e,n)}markOthersSentRead(e,t){if(this.target.scene===Qr.PRIVATE)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.isOtherSent()&&i.timestamp<=t){if(i.read)break;i.read=!0}}}markMySentRead(e,t){let n=new Array;if(this.target.scene===Qr.PRIVATE)for(let i=e.length-1;i>=0;i--){let o=e[i];if(!o.isOtherSent()&&o.timestamp<=t&&o.status===Zr.SUCCESS){if(o.read)break;o.read=!0,n.push(o)}}return n}isOtherUserId(e){if(this.target.scene===Qr.CS){let t=this.target.customerId();return Wc.Socket.user().id===t?e!==Wc.Socket.user().id:e===t}return e!==Wc.Socket.user().id}unreadAmount(e){let t=0,n=this.userOffsets.myOffset(),i=this.messageCache.all();for(const o of i)o.isOtherSent()&&!1===o.recalled&&o.timestamp>n&&(t+=1);return t}getMaxMessage(e){return this.messageCache.getMaxMessage()}maxTime(e){let t=this.getMaxMessage();return nc.isDef(t)?t.timestamp:0}},ul=class{constructor(e,t){this.teamId=e,this.customerId=t}},ll=class{},dl=class{constructor(e,t,n){this.teamId=e,this.teamData=JSON.stringify(t),this.agentData=JSON.stringify(n)}},pl=class{constructor(e){this.teamId=e}},hl=class{constructor(e){this.teamId=e}};var gl={exports:{}},fl=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ml=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],_l=function(e){var t=e,n=e.indexOf("["),i=e.indexOf("]");-1!=n&&-1!=i&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));for(var o=fl.exec(e||""),s={},a=14;a--;)s[ml[a]]=o[a]||"";return-1!=n&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s},vl={exports:{}},yl={exports:{}},Il=1e3,Ml=6e4,Cl=36e5,Sl=24*Cl,El=function(e,t){t=t||{};var n,i=typeof e;if("string"===i&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"days":case"day":case"d":return n*Sl;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Cl;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ml;case"seconds":case"second":case"secs":case"sec":case"s":return n*Il;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===i&&!1===isNaN(e))return t.long?Tl(n=e,Sl,"day")||Tl(n,Cl,"hour")||Tl(n,Ml,"minute")||Tl(n,Il,"second")||n+" ms":function(e){return e>=Sl?Math.round(e/Sl)+"d":e>=Cl?Math.round(e/Cl)+"h":e>=Ml?Math.round(e/Ml)+"m":e>=Il?Math.round(e/Il)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Tl(e,t,n){if(!(e=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},t.enable(n())}(vl,vl.exports);var kl=_l,Dl=vl.exports("socket.io-client:url"),Rl=function(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(Dl("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),Dl("parse %s",e),n=kl(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var i=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port,n.href=n.protocol+"://"+i+(t&&t.port===n.port?"":":"+n.port),n},Ol={},bl={}.toString,Al=Array.isArray||function(e){return"[object Array]"==bl.call(e)};!function(e){vl.exports("socket.io-parser");var t=vc.exports,n=Al;function i(){}e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=i,e.Decoder=s;var o=e.ERROR+'"encode error"';function s(){this.reconstructor=null}function a(t){return{type:e.ERROR,data:"parser error: "+t}}i.prototype.encode=function(t,n){n([function(t){var n=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(n+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(n+=t.nsp+","),null!=t.id&&(n+=t.id),null!=t.data){var i=function(e){try{return JSON.stringify(e)}catch(t){return!1}}(t.data);if(!1===i)return o;n+=i}return n}(t)])},t(s.prototype),s.prototype.add=function(t){var i;if("string"!=typeof t)throw new Error("Unknown type: "+t);i=function(t){var i=0,o={type:Number(t.charAt(0))};if(null==e.types[o.type])return a("unknown packet type "+o.type);if(e.BINARY_EVENT===o.type||e.BINARY_ACK===o.type){for(var s="";"-"!==t.charAt(++i)&&(s+=t.charAt(i),i!=t.length););if(s!=Number(s)||"-"!==t.charAt(i))throw new Error("Illegal attachments");o.attachments=Number(s)}if("/"===t.charAt(i+1))for(o.nsp="";++i&&","!==(c=t.charAt(i))&&(o.nsp+=c,i!==t.length););else o.nsp="/";var r=t.charAt(i+1);if(""!==r&&Number(r)==r){for(o.id="";++i;){var c;if(null==(c=t.charAt(i))||Number(c)!=c){--i;break}if(o.id+=t.charAt(i),i===t.length)break}o.id=Number(o.id)}if(t.charAt(++i)){var u=function(e){try{return JSON.parse(e)}catch(t){return!1}}(t.substr(i));if(!1===u||o.type!==e.ERROR&&!n(u))return a("invalid payload");o.data=u}return o}(t),this.emit("decoded",i)},s.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}(Ol);var Ll={exports:{}},Pl={},Nl={},wl=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var i in e)n.call(e,i)&&t.push(i);return t},Ul=Al,Gl=Object.prototype.toString,xl="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Gl.call(Blob),Fl="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Gl.call(File),Bl=function e(t){if(!t||"object"!=typeof t)return!1;if(Ul(t)){for(var n=0,i=t.length;n=55296&&t<=56319&&o=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function $l(e,t){return zl(e>>t&63|128)}function Jl(e,t){if(!(4294967168&e))return zl(e);var n="";return 4294965248&e?4294901760&e?!(4292870144&e)&&(n=zl(e>>18&7|240),n+=$l(e,12),n+=$l(e,6)):(Yl(e,t)||(e=65533),n=zl(e>>12&15|224),n+=$l(e,6)):n=zl(e>>6&31|192),n+zl(63&e|128)}function Xl(){if(Kl>=Hl)throw Error("Invalid byte index");var e=255&jl[Kl];if(Kl++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function Ql(e){var t,n;if(Kl>Hl)throw Error("Invalid byte index");if(Kl==Hl)return!1;if(t=255&jl[Kl],Kl++,!(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|Xl())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|Xl()<<6|Xl())>=2048)return Yl(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|Xl()<<12|Xl()<<6|Xl())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}var Zl={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,i=Wl(e),o=i.length,s=-1,a="";++s65535&&(o+=zl((t-=65536)>>>10&1023|55296),t=56320|1023&t),o+=zl(t);return o}(o)}},ed=void 0!==ed?ed:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,td=function(){try{return 2===new Blob(["hi"]).size}catch(Yr){return!1}}(),nd=td&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(Yr){return!1}}(),id=ed&&ed.prototype.append&&ed.prototype.getBlob;function od(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e}))}function sd(e,t){t=t||{};var n=new ed;return od(e).forEach((function(e){n.append(e)})),t.type?n.getBlob(t.type):n.getBlob()}function ad(e,t){return new Blob(od(e),t||{})}"undefined"!=typeof Blob&&(sd.prototype=Blob.prototype,ad.prototype=Blob.prototype);var rd=td?nd?Blob:ad:id?sd:void 0;!function(e){var t=wl,n=Bl,i=ql,o=Zl;e.protocol=3;var s=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},a=t(s),r={type:"error",data:"parser error"},c=rd;e.encodePacket=function(e,t,n,i){"function"==typeof t&&(i=t,t=!1),"function"==typeof n&&(i=n,n=null),void 0===e.data||e.data.buffer||e.data;var a=s[e.type];return void 0!==e.data&&(a+=n?o.encode(String(e.data),{strict:!1}):String(e.data)),i(""+a)},e.decodePacket=function(e,t,n){if(void 0===e)return r;if("string"==typeof e){if(n&&!1===(e=function(e){try{e=o.decode(e,{strict:!1})}catch(t){return!1}return e}(e)))return r;var i=e.charAt(0);return Number(i)==i&&a[i]?e.length>1?{type:a[i],data:e.substring(1)}:{type:a[i]}:r}i=new Uint8Array(e)[0];var s=sliceBuffer(e,1);return c&&"blob"===t&&(s=new c([s])),{type:a[i],data:s}},e.encodePayload=function(t,o,s){"function"==typeof o&&(s=o,o=null);var a=n(t);if(!t.length)return s("0:");!function(t){for(var n=new Array(t.length),r=i(t.length,(function(e,t){return s(t.join(""))})),c=function(t,i,s){!function(t,n){e.encodePacket(t,!!a&&o,!0,(function(e){n(null,function(e){return e.length+":"+e}(e))}))}(i,(function(e,i){n[t]=i,s(e,n)}))},u=0;u0);return t}function yd(){var e=vd(+new Date);return e!==dd?(md=0,dd=e):e+"."+vd(md++)}for(;_d<64;_d++)fd[gd[_d]]=_d;yd.encode=vd,yd.decode=function(e){var t=0;for(_d=0;_d';i=document.createElement(e)}catch(t){(i=document.createElement("iframe")).name=n.iframeId,i.src="javascript:0"}i.id=n.iframeId,n.form.appendChild(i),n.iframe=i}this.form.action=this.uri(),c(),e=e.replace(Ud,"\\\n"),this.area.value=e.replace(wd,"\\n");try{this.form.submit()}catch(u){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&r()}:this.iframe.onload=r};var Fd,Bd,qd=ud,Vd=Nl,Hd=pd,Kd=hd,zd=Id,Wd=vl.exports("engine.io-client:websocket");(void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&("undefined"!=typeof WebSocket?Fd=WebSocket:"undefined"!=typeof self&&(Fd=self.WebSocket||self.MozWebSocket));var Yd=Fd||Bd;(void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&"undefined"==typeof GameGlobal||(Yd=function(e){var t=this;if(t.onopen=function(){},t.onclose=function(){},t.onmessage=function(e){},t.onerror=function(e){},"object"==typeof tt&&tt.getSystemInfo){let n=tt.connectSocket({url:e});t.send=function(e){n.send({data:e})},t.close=function(){n.close()},n.onOpen((function(){t.onopen()})),n.onError((function(e){t.onerror(e)})),n.onMessage((function(e){t.onmessage(e)})),n.onClose((function(){t.onclose()}))}else if("undefined"!=typeof my)my.connectSocket({url:e}),t.send=function(e){my.sendSocketMessage({data:e})},t.close=function(e){my.closeSocket()},my.onSocketOpen((function(e){t.onopen()})),my.onSocketError((function(e){t.onerror(e)})),my.onSocketMessage((function(e){t.onmessage(e)})),my.onSocketClose((e=>{t.onclose(e)}));else if("undefined"!=typeof swan)swan.connectSocket({url:e}),t.send=function(e){swan.sendSocketMessage({data:e})},t.close=function(e){swan.closeSocket()},swan.onSocketOpen((function(e){t.onopen()})),swan.onSocketError((function(e){t.onerror(e)})),swan.onSocketMessage((function(e){t.onmessage(e)})),swan.onSocketClose((e=>{t.onclose(e)}));else if(void 0!==Nn){var n=Nn.connectSocket({url:e,complete:()=>{}});t.send=function(e){n.send({data:e})},t.close=function(){n.close()},n.onOpen((function(e){t.onopen()})),n.onError((function(e){t.onerror(e)})),n.onMessage((function(e){t.onmessage(e)})),n.onClose((function(e){t.onclose()}))}else{var i=Pn.connectSocket({url:e});t.send=function(e){i.send({data:e})},t.close=function(e){i.close({code:1e3})},i.onOpen((function(){t.onopen()})),i.onError((function(e){t.onerror(e)})),i.onMessage((function(e){t.onmessage(e)})),i.onClose((function(e){t.onclose(e)}))}});var $d=Jd;function Jd(e){e&&e.forceBase64&&(this.supportsBinary=!1),(void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&(this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=Fd&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(Yd=Bd)),qd.call(this,e)}Kd(Jd,qd),Jd.prototype.name="websocket",Jd.prototype.supportsBinary=!1,Jd.prototype.doOpen=function(){if(this.check()){var e,t,n=this.uri();if((void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&(e=this.protocols),(t=void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket?{agent:this.agent,perMessageDeflate:this.perMessageDeflate}:{agent:this.agent}).pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,"object"==typeof navigator&&"ReactNative"===navigator.product&&(t={}),this.extraHeaders&&(t.headers=this.extraHeaders),this.localAddress&&(t.localAddress=this.localAddress),"undefined"!=typeof cc&&"Windows"===cc.sys.os)cc.resources.load("cacert",((e,t)=>{const i=t.nativeUrl;this.ws=new Yd(n,[],i),this.ws.binaryType="arraybuffer",this.addEventListeners()}));else{try{void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket?this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new Yd(n,e):new Yd(n):new Yd(n,e,t):this.ws=new Yd(n)}catch(i){return this.emit("error",i)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}}},Jd.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},Jd.prototype.write=function(e){var t=this;this.writable=!1;for(var n=e.length,i=0,o=n;i0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}up.priorWebsocketSuccess=!1,np(up.prototype),up.protocol=sp.protocol,up.Socket=up,up.Transport=ud,up.transports=Pl,up.parser=Nl,up.prototype.createTransport=function(e){ip('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=sp.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new tp[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},up.prototype.open=function(){var e;if(this.rememberUpgrade&&up.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(n){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},up.prototype.setTransport=function(e){ip("setting transport %s",e.name);var t=this;this.transport&&(ip("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},up.prototype.probe=function(e){ip('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,i=this;function o(){if(i.onlyBinaryUpgrades){var o=!this.supportsBinary&&i.transport.supportsBinary;n=n||o}n||(ip('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(o){if(!n)if("pong"===o.type&&"probe"===o.data){if(ip('probe transport "%s" pong',e),i.upgrading=!0,i.emit("upgrading",t),!t)return;up.priorWebsocketSuccess="websocket"===t.name,ip('pausing current transport "%s"',i.transport.name),i.transport.pause((function(){n||"closed"!==i.readyState&&(ip("changing transport and sending upgrade packet"),l(),i.setTransport(t),t.send([{type:"upgrade"}]),i.emit("upgrade",t),t=null,i.upgrading=!1,i.flush())}))}else{ip('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,i.emit("upgradeError",s)}})))}function s(){n||(n=!0,l(),t.close(),t=null)}function a(n){var o=new Error("probe error: "+n);o.transport=t.name,s(),ip('probe transport "%s" failed because of error: %s',e,n),i.emit("upgradeError",o)}function r(){a("transport closed")}function c(){a("socket closed")}function u(e){t&&e.name!==t.name&&(ip('"%s" works - aborting "%s"',e.name,t.name),s())}function l(){t.removeListener("open",o),t.removeListener("error",a),t.removeListener("close",r),i.removeListener("close",c),i.removeListener("upgrading",u)}up.priorWebsocketSuccess=!1,t.once("open",o),t.once("error",a),t.once("close",r),this.once("close",c),this.once("upgrading",u),t.open()},up.prototype.onOpen=function(){if(ip("socket open"),this.readyState="open",up.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){ip("starting upgrade probes");for(var e=0,t=this.upgrades.length;e0&&e.jitter<=1?e.jitter:0,this.attempts=0}mp.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},mp.prototype.reset=function(){this.attempts=0},mp.prototype.setMin=function(e){this.ms=e},mp.prototype.setMax=function(e){this.max=e},mp.prototype.setJitter=function(e){this.jitter=e};class _p{static init(e,t,n){this.host=e,(void 0!==t&&!1===t||!0===n)&&(this.https=!1)}static isMP(){return[ic.MP_WX,ic.MP_ALI,ic.MP_BYTE,ic.MP_WGAME,ic.MP_BAIDU].includes(oc.currentPlatform())}static uri(){let e="http";return this.https&&(e+="s"),e+"://"+this.index()+this.host}static index(){return 0==this.i?this.i=Math.floor(Math.random()*this.max)+1:this.i=this.i%this.max+1,this.i}}_p.i=0,_p.max=5,_p.https=!0;var vp=_c(Object.freeze({__proto__:null,URIResolver:_p})),yp=_c(hc),Ip=Ll.exports,Mp=lp.exports,Cp=vc.exports,Sp=Ol,Ep=pp,Tp=gp,kp=(vl.exports("socket.io-client:manager"),ep),Dp=fp;const{URIResolver:Rp}=vp;var Op=yp.runStatus,bp=Object.prototype.hasOwnProperty,Ap=Lp;function Lp(e,t){if(!(this instanceof Lp))return new Lp(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new Dp({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||Sp;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}Lp.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)bp.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},Lp.prototype.updateSocketIds=function(){for(var e in this.nsps)bp.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},Lp.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},Cp(Lp.prototype),Lp.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},Lp.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},Lp.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},Lp.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},Lp.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},Lp.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},Lp.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},Lp.prototype.open=Lp.prototype.connect=function(e,t){if(this.readyState,~this.readyState.indexOf("open"))return this;this.uri,this.engine=Ip(this.uri,this.opts);var n=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var o=Ep(n,"open",(function(){i.onopen(),e&&e()})),s=Ep(n,"error",(async function(t){if(i.uri=Rp.uri(),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else i.maybeReconnectOnOpen()}));if(!1!==this._timeout){var a=this._timeout,r=setTimeout((function(){o.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",a)}),a);this.subs.push({destroy:function(){clearTimeout(r)}})}return this.subs.push(o),this.subs.push(s),this},Lp.prototype.onopen=function(){this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(Ep(e,"data",Tp(this,"ondata"))),this.subs.push(Ep(e,"ping",Tp(this,"onping"))),this.subs.push(Ep(e,"pong",Tp(this,"onpong"))),this.subs.push(Ep(e,"error",Tp(this,"onerror"))),this.subs.push(Ep(e,"close",Tp(this,"onclose"))),this.subs.push(Ep(this.decoder,"decoded",Tp(this,"ondecoded")))},Lp.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},Lp.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},Lp.prototype.ondata=function(e){this.decoder.add(e)},Lp.prototype.ondecoded=function(e){this.emit("packet",e)},Lp.prototype.onerror=function(e){this.emitAll("error",e)},Lp.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new Mp(this,e,t),this.nsps[e]=n;var i=this;n.on("connecting",o),n.on("connect",(function(){n.id=i.generateId(e)})),this.autoConnect&&o()}function o(){~kp(i.connecting,n)||i.connecting.push(n)}return n},Lp.prototype.destroy=function(e){var t=kp(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},Lp.prototype.packet=function(e){var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,(function(n){for(var i=0;i0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},Lp.prototype.cleanup=function(){for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();this.reconnecting=!0;var n=setTimeout((function(){if(Op.isBackend())return e.reconnecting=!1,e.reconnect(),void e.emitAll("reconnect_error","Uniapp running backend, skipped reconnect...");e.skipReconnect||(e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open((function(t){t?(e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):e.onreconnect()})))}),t);this.subs.push({destroy:function(){clearTimeout(n)}})}},Lp.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)},function(e,t){var n=Rl,i=Ol,o=Ap;vl.exports("socket.io-client"),e.exports=t=a;var s=t.managers={};function a(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,a=n(e),r=a.source,c=a.id,u=a.path,l=s[c]&&u in s[c].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||l?i=o(r,t):(s[c]||(s[c]=o(r,t)),i=s[c]),a.query&&!t.query&&(t.query=a.query),i.socket(a.path,t)}t.protocol=i.protocol,t.connect=a,t.Manager=Ap,t.Socket=lp.exports}(gl,gl.exports);const Pp=gl.exports;class Np{constructor(){this.io=Pp,this.status=Wr.DISCONNECTED,this.permissions=[Jc.NONE],this.connectedObservers=[],this.disconnectedObservers=[]}connect(){this.status=Wr.CONNECTING}socketio(){return this.io}on(e,t){this.io.on(e,t)}disconnect(){this.io.disconnect()}getStatus(){return this.status}addConnectedObserver(e){nc.isFunction(e)&&this.connectedObservers.push(e)}addDisconnectedObserver(e){nc.isFunction(e)&&this.disconnectedObservers.push(e)}notify(e,t){for(let n=0;n{this.status=Wr.CONNECTED,this.notify(this.connectedObservers)})),this.io.on("reconnecting",(e=>{this.status=Wr.CONNECTING,this.notify(this.reconnectingObservers,e)})),this.io.on("disconnect",(()=>{this.status=Wr.DISCONNECTED,this.notify(this.disconnectedObservers)})),this.io.on("connect_error",(function(e){}))}addReconnectingObserver(e){this.reconnectingObservers.push(e)}}class Up{static get(e){const t=encodeURIComponent(e)+"=",n=document.cookie.split("; ");for(const i of n)if(i.startsWith(t))return decodeURIComponent(i.substring(t.length));return null}static set(e,t,n,i,o="/",s=!1){let a=encodeURIComponent(e)+"="+encodeURIComponent(t);n instanceof Date&&(a+="; expires="+n.toGMTString()),o&&(a+="; path="+o),i&&(a+="; domain="+i),s&&(a+="; secure"),document.cookie=a}static remove(e,t,n="/",i=!1){Up.set(e,"",new Date(0),t,n,i)}}class Gp{asyncGet(e){let t=this.get(e);return Promise.resolve(t)}asyncPut(e,t){return this.put(e,t),Promise.resolve()}get(e){let t=this.doGet(e);return t=JSON.parse(t),t}put(e,t){this.doPut(e,JSON.stringify(t))}}class xp extends Gp{constructor(){super(),this.domain=null,this.domain="undefined"!=typeof location&&/^(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/.test(location.host)?location.host.split(".").slice(-2).join("."):null}doGet(e){return Up.get(e)||null}doPut(e,t){const n=new Date(2030,12,31,0,0,0,0),i=this.domain;Up.set(e,t,n,i)}remove(e){const t=this.domain;Up.remove(e,t)}support(){return"undefined"!=typeof navigator&&!0===navigator.cookieEnabled}}class Fp extends Gp{doGet(e){return localStorage.getItem(e)||null}doPut(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}support(){return!("undefined"!=typeof GameGlobal||"undefined"==typeof localStorage||!localStorage.setItem)}}class Bp extends Gp{doGet(e){return Nn.getStorageSync(e)||null}doPut(e,t){Nn.setStorageSync(e,t)}remove(e){Nn.removeStorageSync(e)}support(){return!("object"!=typeof Nn||!Nn.getStorageSync)}}class qp extends Gp{doGet(e){return cc.sys.localStorage.getItem(e)||null}doPut(e,t){cc.sys.localStorage.setItem(e,t)}remove(e){cc.sys.localStorage.removeItem(e)}support(){return"undefined"!=typeof cc&&void 0!==cc.sys.localStorage}}class Vp extends Gp{doGet(e){return Pn.getStorageSync(e)||null}doPut(e,t){Pn.setStorageSync(e,t)}remove(e){Pn.removeStorageSync(e)}support(){return!("object"!=typeof Pn||!Pn.getStorageSync||"undefined"!=typeof tt)}}class jp extends Gp{asyncGet(e){return fc(this,void 0,void 0,(function*(){const t=yield Jr.asyncStorage.getItem(e);return JSON.parse(t)}))}asyncPut(e,t){return Jr.asyncStorage.setItem(e,JSON.stringify(t))}doPut(e,t){throw new Error("Method not implemented.")}remove(e){Jr.asyncStorage.removeItem(e)}support(){return $r.currentFramework()===zr.REACT_NATIVE}doGet(e){throw new Error("Method not implemented.")}}class Hp extends Gp{doGet(e){const t=my.getStorageSync({key:e}).data||null;return"string"==typeof JSON.parse(t)?JSON.parse(t):t}doPut(e,t){my.setStorageSync({key:e,data:JSON.stringify(t)})}remove(e){my.removeStorageSync({key:e})}support(){return!("undefined"==typeof my||!my.getStorageSync)}}class Kp extends Gp{doGet(e){return tt.getStorageSync(e)||null}doPut(e,t){tt.setStorageSync(e,t)}remove(e){tt.removeStorageSync(e)}support(){return!("object"!=typeof tt||!tt.getStorageSync)}}class zp extends Gp{doGet(e){return swan.getStorageSync(e)||null}doPut(e,t){swan.setStorageSync(e,t)}remove(e){swan.removeStorageSync(e)}support(){return!("undefined"==typeof swan||!swan.getStorageSync)}}class Wp{constructor(){this.supportedStorage=null;const e=Wp.storages;e.push(new Bp),e.push(new qp),e.push(new Fp),e.push(new Vp),e.push(new jp),e.push(new Hp),e.push(new zp),e.push(new Kp),e.push(new xp),this.dispatch(),this.supportedStorage}static localStorage(){return this.instance.supportedStorage}dispatch(){for(let e of Wp.storages)if(e.support()){this.supportedStorage=e;break}}}Wp.storages=new Array,Wp.instance=new Wp;class Yp{static get(){return fc(this,void 0,void 0,(function*(){let e,t=Wp.localStorage();return null!==t&&(e=yield t.asyncGet(Yp.SM_KEY)),e}))}static put(e){return fc(this,void 0,void 0,(function*(){var t=Wp.localStorage();let n=e.sm;null!==t&&n&&t.asyncPut(Yp.SM_KEY,n)}))}}Yp.SM_KEY="GE-SM";class $p{static e(e,t){let n="";for(let s=0;s=32&&o<=126?String.fromCharCode(function(e){let n=e+t;return n>126?n-126+32:n}(i)):String.fromCharCode(i));var i,o;return n}}class Jp{static initRNUniqueId(){if($r.currentFramework()===zr.REACT_NATIVE){let e=Jr.platform,t=e.constants,n={os:e.OS};return"android"===n.os?n.f=t.Fingerprint:n.v=e.Version,JSON.stringify(n)}return null}static initPlusDeviceId(){return new Promise(((e,t)=>{"undefined"!=typeof plus?plus.device.getInfo({success:t=>{e(t.uuid)},fail:e=>{t(e)}}):e(null)}))}static getVideoCard(){var e;if(oc.currentPlatform()===ic.BROWSER&&"undefined"!=typeof document){const t=document.createElement("canvas"),n=null!==(e=t.getContext("webgl"))&&void 0!==e?e:t.getContext("experimental-webgl");if(n&&"getExtension"in n){let e=0,t=0;if(navigator.userAgent.indexOf("Firefox")>-1)t=n.VENDOR,e=n.RENDERER;else{let i=n.getExtension("WEBGL_debug_renderer_info");if(!i)return null;t=i.UNMASKED_VENDOR_WEBGL,e=i.UNMASKED_RENDERER_WEBGL}const i={vendor:(n.getParameter(t)||"").toString(),renderer:(n.getParameter(e)||"").toString()};return JSON.stringify(i)}}return null}static z(){return fc(this,void 0,void 0,(function*(){const e={p:oc.currentPlatform(),f:$r.currentFramework(),vc:this.getVideoCard(),rfp:this.initRNUniqueId()};return $p.e(JSON.stringify(e),5)}))}}class Xp{constructor(e){this.rocketsBuffer=new Set,this.socket=e,this.socket.addConnectedObserver(this.onSocketConnected.bind(this))}emit(e){this.socket.status!==Wr.DISCONNECTED?(e.start(),this.doEmit(e)):e.fail({resultCode:"409",content:"Please connect first"})}doEmit(e){if(!e.complete)if(this.socket.status!==Wr.CONNECT_FAILED)if(this.isConnected())if(this.hasPermission(e)){let t=setTimeout((()=>{this.doEmit(e)}),e.singleTimeout);e.unique&&(e.params.retried=e.retried),this.socket.socketio().emit(e.name,e.params,(n=>{clearTimeout(t),200===n.resultCode||200==n.code?e.success(n):e.fail(n)})),e.retried++}else e.fail({resultCode:401,content:"No permission"});else this.isConnecting()&&this.rocketsBuffer.add(e);else e.fail({resultCode:408,content:"Failed to connect GoEasy."})}hasPermission(e){return!!this.socket.permissions.find((t=>t===e.permission))}isConnected(){return[Wr.CONNECTED,Wr.RECONNECTED,Wr.EXPIRED_RECONNECTED,Wr.DISCONNECTING].includes(this.socket.status)}isConnecting(){return[Wr.CONNECTING,Wr.RECONNECTING].includes(this.socket.status)}onSocketConnected(){this.emitBuffer()}emitBuffer(){Array.from(this.rocketsBuffer).forEach((e=>{this.rocketsBuffer.delete(e),this.doEmit(e)}))}}class Qp extends jc{static init(){Qp.i=new Qp}static fire(e,t){this.i.fire(e,t)}static on(e,t){this.i.on(e,t)}static off(e,t){this.i.off(e,t)}}class Zp extends Np{constructor(e,t){super(),this.ioSocket=null,this.sid=null,this.anonymous=!1,this.userId=null,this.artifactVersion=Xr,this.vname=null,this.uri=null,this.ioOpts=null,this.reconnectingTimes=0,this.messageObservers=new Map,this.connectFailedObservers=[],this.connectingObservers=[],this.expiredReconnectedObservers=[],this.options=e,this.ioSocket=new wp({onDisconnected:this.onIoDisconnected.bind(this),onReconnecting:this.onIoReconnecting.bind(this)}),this.ioSocketEmitter=new Xp(this.ioSocket),this.ioSocket.addConnectedObserver(this.onIoReconnected.bind(this)),this.initOptions(t),this.connect()}initUserId(){let e=this.connectOptions.id;nc.isEmpty(e)?this.anonymous=!0:this.userId=e.toString()}socketio(){return this.ioSocket.socketio()}extendOptions(){let e=this.connectOptions;if(nc.isNull(e.data)||nc.isDef(e.data)&&!nc.isObject(e.data))throw{code:400,content:"TypeError: data requires an object."};if((nc.isDef(e.data)?String(e.data).length:0)>300&&nc.isObject(e)&&nc.isFunction(e.onFailed))throw{code:400,content:"user.data-length limit 300 byte."};if(nc.isObject(e.wxmpId)){if(nc.isEmpty(e.wxmpId.appid))throw{code:400,content:"wxmpId.appid is required."};if(nc.isEmpty(e.wxmpId.openid))throw{code:400,content:"wxmpId.openid is required. requires string."}}else if(nc.isPrimitive(e.wxmpId))throw{code:400,content:"TypeError: wxmpId requires an object."}}initUriAndOpts(){let e=this.options;_p.init(e.host,e.forceTLS,e.supportOldBrowser),this.uri=_p.uri();let t=["websocket"];!0===e.supportOldBrowser&&t.push("polling"),this.ioOpts={transports:t,timeout:pc.connect,reconnectionDelayMax:pc.reconnectionDelayMax}}onIoReconnected(){this.status===Wr.RECONNECTING&&this.authorize()}sendAck(e,t){this.ioSocket.io.emit(e,t)}initOptions(e){this.connectOptions=e,this.addConnectedObserver(e.onSuccess),this.addConnectFailedObserver(e.onFailed),this.addConnectingObserver(e.onProgress),this.initUserId()}connect(){this.initUriAndOpts(),this.extendOptions(),super.connect(),this.onConnecting(),this.ioSocket.connect({uri:this.uri,opts:this.ioOpts}),this.authorize()}disconnect(){return new Promise(((e,t)=>{this.status=Wr.DISCONNECTING;let n=()=>{this.ioSocket.disconnect(),this.status=Wr.DISCONNECTED,Qp.fire(ru.DISCONNECTED),e()};const i=Bc.modules.get("GN");if(i&&(i.params.regId||this.connectOptions.wxmpId)){let e=e=>{t(e)},i=new Qc({name:dc.manualDisconnect,params:{},permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e,success:n});Wc.Socket.e(i)}else n()}))}authorize(){return fc(this,void 0,void 0,(function*(){let e=this.connectOptions,t={appkey:this.options.appkey,userId:this.userId,userData:JSON.stringify(e.data),otp:e.otp,artifactVersion:this.artifactVersion,sid:this.sid,mP:yield Bc.getParams(),a:this.anonymous,z:yield Jp.z(),sm:yield Yp.get(),c:{n:this.vname,v:this.artifactVersion}};JSON.stringify(t);let n=new Qc({name:dc.authorize,params:t,permission:Jc.NONE,singleTimeout:pc.commonInfiniteSingle,totalTimeout:pc.commonInfiniteTotal,success:e=>{this.onAuthorizeSuccess(e)},fail:e=>{this.onAuthorizeFailed(e)}});this.ioSocketEmitter.emit(n)}))}onConnecting(){Qp.fire(ru.CONNECTING,this.reconnectingTimes),this.notify(this.connectingObservers,this.reconnectingTimes)}onIoReconnecting(){this.reconnectingTimes++,this.status==Wr.CONNECTED||this.status==Wr.EXPIRED_RECONNECTED||this.status==Wr.RECONNECTING?this.status=Wr.RECONNECTING:this.status=Wr.CONNECTING,this.onConnecting()}onIoDisconnected(){this.status!==Wr.DISCONNECTING&&(this.status=Wr.RECONNECTING,Qp.fire(ru.LOST),this.notify(this.disconnectedObservers))}onAuthorizeSuccess(e){Yp.put(e),Bc.setDatas(e.mD),this.status===Wr.RECONNECTING?this.sid!==e.sid?(this.status=Wr.EXPIRED_RECONNECTED,this.sid=e.sid,Qp.fire(ru.EXPIRED_RECONNECTED),this.notify(this.expiredReconnectedObservers)):(this.status=Wr.RECONNECTED,Qp.fire(ru.RECONNECTED)):(this.status=Wr.CONNECTED,this.sid=e.sid),e.enablePublish&&(this.permissions.find((e=>e==Jc.WRITE))||this.permissions.push(Jc.WRITE)),e.enableSubscribe&&(this.permissions.find((e=>e==Jc.READ))||this.permissions.push(Jc.READ)),this.reconnectingTimes=0,Qp.fire(ru.CONNECTED),this.notify(this.connectedObservers)}onAuthorizeFailed(e){this.ioSocket.disconnect(),this.status=Wr.CONNECT_FAILED;let t={code:e.resultCode||408,content:e.content||"Host unreachable or timeout"};this.notify(this.connectFailedObservers,t)}addConnectingObserver(e){nc.isFunction(e)&&this.connectingObservers.push(e)}addConnectFailedObserver(e){nc.isFunction(e)&&this.connectFailedObservers.push(e)}addExpiredReconnectedObserver(e){nc.isFunction(e)&&this.expiredReconnectedObservers.push(e)}onMessage(e,t){this.ioSocket.io._callbacks.hasOwnProperty("$"+e)||this.ioSocket.io.on(e,t)}user(){let e=this.connectOptions;return e?{id:e.id,data:e.data}:null}}class eh{constructor(e){this.guidList=[],this.socket=e}offMessage(e,t){Qp.off(ru.NEW_MESSAGE+"_"+e,t)}onMessage(e,t){Qp.on(ru.NEW_MESSAGE+"_"+e,t),this.socket.onMessage(e,(t=>{this.fire(e,t)}))}fire(e,t){let n=this.filter(t);n&&Qp.fire(ru.NEW_MESSAGE+"_"+e,n)}filter(e){if("string"==typeof e&&(e=JSON.parse(e)),e.i){if(this.guidList.findIndex((t=>t===e.i))>-1)return;this.guidList.unshift(e.i),this.guidList.length>300&&this.guidList.pop()}return e}}class th{static init(e){this.i=new th(e)}constructor(e){this.goeasyOptions=e}static connect(e,t){if(this.status()!==Wr.DISCONNECTED&&nc.isObject(e)&&nc.isFunction(e.onFailed))return void e.onFailed({code:408,content:"It is already connected, don't try again until disconnect() is called. "});this.confirmUserIdAndData(e),Qp.init();let n=this.i;Bc.preConnect(e),n.socket=new Zp(n.goeasyOptions,e),n.socket.vname=t,n.emitter=new Xp(n.socket),n.messageListener=new eh(n.socket),Bc.postConnect()}static confirmUserIdAndData(e){if(Bc.modules.get("GIM"))nu.validateId(e.id,"id"),nu.validateObject(e.data,"data");else if("string"==typeof e.id&&e.id.length>60)throw{code:400,content:"id over max length 60"}}static e(e){this.i.emitter.emit(e)}static sendAck(e,t){this.i.socket.sendAck(e,t)}static status(){return this.i&&this.i.socket?this.i.socket.getStatus():Wr.DISCONNECTED}static on(e,t){Qp.on(e,t)}static off(e,t){Qp.off(e,t)}static offMessage(e,t){this.i.messageListener.offMessage(e,t)}static onMessage(e,t){this.i.messageListener.onMessage(e,t)}static disconnect(e){this.status()===Wr.CONNECTED||this.status()===Wr.RECONNECTED?this.i.socket.disconnect().then((()=>{gc.onSuccess(e)})).catch((t=>{gc.onFailed(e,t)})):gc.onFailed(e,{code:408,content:"Host unreachable or timeout"})}static user(){return this.i.socket.user()}}th.EVENT=ru;class nh{static getInstance(){return nh.instance||(nh.instance=new nh),nh.instance}constructor(){this.synchronized=!0,this.onlineChanged=e=>{e.online?this.teamIds.add(e.teamId):this.teamIds.delete(e.teamId)},this.onDisconnected=()=>{this.queryMyTeamPromise=null,this.teamIds=null},this.onConnected=()=>{this.synchronized&&(this.queryMyTeamPromise=this.queryTeams())},th.on(th.EVENT.LOST,this.onDisconnected),th.on(th.EVENT.RECONNECTED,this.onConnected),th.onMessage(au.CS_ONLINE_CHANGED,this.onlineChanged)}queryTeams(){return this.queryMyTeamPromise||(this.queryMyTeamPromise=new Promise(((e,t)=>{let n=new Qc({name:dc.CS_MY_TEAMS,params:{},permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{t(e)},success:t=>{this.teamIds=new Set(t.content),this.synchronized=!0,e(this.teamIds)}});Wc.Socket.e(n)}))),this.queryMyTeamPromise}myTeams(){if(this.synchronized&&this.queryMyTeamPromise)return this.teamIds;throw"please query team first."}isOnline(e,t){return fc(this,void 0,void 0,(function*(){yield this.queryTeams(),gc.onSuccess(t,this.teamIds.has(e))}))}online(e,t){if(!nc.isObject(t.agentData)||!nc.isObject(t.teamData))throw{code:400,content:"agentData and teamData require an object"};let n=new dl(e,t.teamData,t.agentData),i=new Qc({name:dc.CS_ONLINE,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:n=>{this.teamIds.add(e),gc.onSuccess(t),Vu.i.fire(Lu.CS_ONLINE_SUCCESS)}});Wc.Socket.e(i)}offline(e,t){let n=new pl(e),i=new Qc({name:dc.CS_OFFLINE,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:n=>{this.teamIds.delete(e),gc.onSuccess(t),Vu.i.fire(Lu.CS_OFFLINE_SUCCESS)}});Wc.Socket.e(i)}agents(e,t){let n=new hl(e),i=new Qc({name:dc.CS_AGENTS,params:n,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{e.content.forEach((e=>{e.data=JSON.parse(e.data)})),gc.onSuccess(t,e)}});Wc.Socket.e(i)}}class ih{constructor(e){this.onMessageReceived=e=>{let t=ih.session;if(e.scene()===Qr.CS&&t.liveOptions){let n=e,i=t.liveOptions.customerId;t.teamId===n.teamId&&n.customerId()===i&&(t.tryUpdateStatus(n),t.liveOptions.onNewMessage(n))}},this.teamId=e,Vu.i.on(Lu.CS_AGENT_MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.CS_ACCEPTED,this.onMessageReceived),Vu.i.on(Lu.CS_ENDED,this.onMessageReceived),Vu.i.on(Lu.CS_TRANSFER,this.onMessageReceived),th.on(ru.DISCONNECTED,ih.destroy)}static live(e,t){return fc(this,void 0,void 0,(function*(){let n=t.customerId;nu.validateId(n,"customerId");let i=new ul(e,n);yield nh.getInstance().queryTeams();let o=new Qc({name:dc.CS_LIVE_SESSION,params:i,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:n=>{ih.destroy(),this.session=new ih(e),this.session.liveOptions=t;let i=n.content.customerStatus;"ACCEPTED"===i.status&&(i.agent.data=JSON.parse(i.agent.data)),this.session.status=i,this.session.liveOptions.onStatusUpdated(this.session.status),gc.onSuccess(t)}});Wc.Socket.e(o)}))}customerId(){return this.liveOptions.customerId}static isMyCustomer(e){let t=ih.session;if(t&&t.teamId===e.teamId&&t.customerId()===e.customerId()){let n=nh.getInstance().myTeams(),i=t.status.agent;return n.has(e.teamId)&&(!i||i.id===Wc.Socket.user().id)}return!0}static isMyMessage(e){let t=Wu.byIMMessage(e);return e.type===Nu.TRANSFER&&e.payload.transferTo.id===Wc.Socket.user().id||this.isMyCustomer(t)}static quit(e){let t=ih.session;if(t){let n=t.liveOptions.customerId;nu.validateId(n,"customerId");let i=new ul(t.teamId,n),o=new Qc({name:dc.CS_QUIT_LIVE,params:i,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:t=>{gc.onFailed(e,t)},success:t=>{ih.destroy(),gc.onSuccess(e)}});Wc.Socket.e(o)}}tryUpdateStatus(e){if("FREE"!==this.status.status&&this.status.sessionId>e.sessionId)return;let t;switch(e.type){case Nu.ACCEPT:t=new ll,t.status="ACCEPTED",t.start=e.payload.sessionStart,t.sessionId=e.sessionId,t.agent=new tc(e.senderId,e.senderData);break;case Nu.END:t=new ll,t.status="FREE";break;case Nu.TRANSFER:t=new ll,t.status="ACCEPTED",t.start=e.payload.sessionStart,t.sessionId=e.sessionId,t.agent=e.payload.transferTo;break;default:"FREE"===this.status.status&&(t=new ll,t.status="PENDING",t.start=e.timestamp,t.sessionId=e.sessionId)}t&&(this.status=t,this.liveOptions.onStatusUpdated(t))}}ih.destroy=()=>{let e=ih.session;e&&(Vu.i.off(Lu.CS_AGENT_MESSAGE_RECEIVED,e.onMessageReceived),Vu.i.off(Lu.CS_ACCEPTED,e.onMessageReceived),Vu.i.off(Lu.CS_ENDED,e.onMessageReceived),Vu.i.off(Lu.CS_TRANSFER,e.onMessageReceived),th.off(ru.DISCONNECTED,ih.destroy),ih.session=null)};class oh extends cl{constructor(e){super(e),this.unread=0,this.markingAmount=0}loadHistory(e,t){return fc(this,void 0,void 0,(function*(){return nc.isUndef(t)?t=10:t>30&&(t=30),yield this.loadServerMessages(e,t)}))}loadServerMessages(e,t){return fc(this,void 0,void 0,(function*(){let n=new ol(this.target.id.toString(),this.target.scene,e,t,this.target.teamId),i=yield this.remoteHistory.loadServerMessages(this.target,n);return i.userOffsets.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),i.messages}))}deleteMessages(e){return fc(this,void 0,void 0,(function*(){gc.onFailed(e,"Delete CS message is not supported yet")}))}initMaxMessageAndOffsets(e,t){t.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),(nc.isUndef(this.acceptedMaxMessage)||this.acceptedMaxMessage.timestamp{this.userOffsets.updateOffset(e.userId,e.offset)})),this.savePendingMessage(e)}savePendingMessage(e){this.pendingMaxMessage?this.pendingMaxMessage.timestampthis.userOffsets.markingTime&&e>t&&(this.userOffsets.markingTime=e,this.markingAmount=this.unread,!0)}postMark(e){e===this.userOffsets.markingTime&&(this.unread-=this.markingAmount,this.markingAmount=0,this.userOffsets.updateOffset(Wc.Socket.user().id,e),Vu.i.fire(Lu.UNREAD_AMOUNT_CHANGED,this.target))}syncMarkedMessage(e){}getMaxMessage(e){return e?this.acceptedMaxMessage:this.pendingMaxMessage}unreadAmount(e){return e?this.unread:0}existsMessage(e){return this.acceptedMaxMessage&&this.acceptedMaxMessage.messageId===e.messageId||this.pendingMaxMessage&&this.pendingMaxMessage.messageId===e.messageId}maxAcceptedMessageTime(){return this.acceptedMaxMessage?this.acceptedMaxMessage.timestamp:0}maxTime(e){let t=this.getMaxMessage(e);return t?t.timestamp:0}}class sh extends cl{constructor(e){super(e)}deleteMessages(e){return fc(this,void 0,void 0,(function*(){gc.onFailed(e,"Delete CS message is not supported yet")}))}}class ah{static validateMessageArray(e){if(!nc.isArray(e)||nc.isEmpty(e))throw{code:400,content:"messages requires non empty array"};if(e.length>20)throw{code:400,content:"The maximum number of messages is 20"};let t=Wu.byIMMessage(e[0]);for(let n=0;n0){let e=Wu.byIMMessage(i);if(e.scene!==t.scene||e.id!==t.id)throw{code:400,content:"each message must be from the same friend or group"}}}}}class rh{static init(){return rh.instance=new rh,rh.instance}constructor(){this.map=new Map,this.onMessageSending=e=>{let t=Wu.byIMMessage(e);this.findOrCreateHistory(t).onMessageSending(e)},this.onMessageSendSuccess=e=>{let t=Wu.byIMMessage(e);this.findHistory(t).onMessageSendSuccess(e)},this.onMessageSendFailed=e=>{let t=Wu.byIMMessage(e);this.findHistory(t).onMessageSendFailed(e)},this.onMessageReceived=e=>{let t=Wu.byIMMessage(e),n=this.findOrCreateHistory(t);n.expiredTime>0&&(this.map.delete(t.toString()),n=this.findOrCreateHistory(t)),n.onMessageReceived(e)},this.onRemoteMarkRead=e=>{let t=Wu.byMessageReadRemoteEvent(e),n=this.findHistory(t);n&&n.syncMarkedMessage(e)},this.onRemoteMessageDeleted=e=>{let t=Wu.byIMMessageDeletedEvent(e),n=this.findHistory(t);n&&n.syncDeletedMessage(e.deleterId,e.times)},this.onMessageRecalled=e=>{let t=Wu.byConversationId(e.scene,e.conversationId),n=this.findHistory(t);n&&n.recallMessages(e)},this.onDisconnected=()=>{this.map.forEach(((e,t)=>{e.expire()}))},this.onReconnected=()=>{rl.fire(wu.HISTORY_EXPIRED)},this.destroy=()=>{},this.initialListeners()}initialListeners(){Vu.i.on(Lu.MESSAGE_SENDING,this.onMessageSending),Vu.i.on(Lu.MESSAGE_SEND_SUCCESS,this.onMessageSendSuccess),Vu.i.on(Lu.MESSAGE_SEND_FAILED,this.onMessageSendFailed),Vu.i.on(Lu.MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.CS_AGENT_MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.CS_ACCEPTED,this.onMessageReceived),Vu.i.on(Lu.CS_ENDED,this.onMessageReceived),Vu.i.on(Lu.CS_TRANSFER,this.onMessageReceived),Vu.i.on(Lu.MESSAGE_RECALLED,this.onMessageRecalled),th.onMessage(au.IM_MSG_READ,this.onRemoteMarkRead),th.onMessage(au.IM_MSG_DELETED,this.onRemoteMessageDeleted),th.on(th.EVENT.LOST,this.onDisconnected),th.on(th.EVENT.RECONNECTED,this.onReconnected)}loadHistory(e,t){return fc(this,void 0,void 0,(function*(){let n=this.queryToTarget(e,t),i=this.findOrCreateHistory(n);i.expiredTime>0&&(this.map.delete(n.toString()),i=this.findOrCreateHistory(n));let o=yield i.loadHistory(e.lastTimestamp,e.limit);gc.onSuccess(e,{code:200,content:o})}))}queryToTarget(e,t){if(nc.isDef(e.userId))return new Wu(Qr.PRIVATE,e.userId);if(nc.isDef(e.groupId))return new Wu(Qr.GROUP,e.groupId);if(nc.isDef(e.type)){if(!Object.values(Qr).includes(e.type))throw new Error("incorrect type, must be: "+Object.values(Qr));if(nc.isUndef(e.id))throw new Error("If type is not empty, id is required.");return Qr.CS==e.type&&nc.isUndef(t)&&(t=e.id),new Wu(e.type,e.id,t)}throw new Error("incorrect query options.")}privateMarkAsRead(e){return fc(this,void 0,void 0,(function*(){if(nc.isUndef(e.userId))throw new Error("userId could not be empty.");let t=Wu.byScene(Qr.PRIVATE,e.userId);yield this.markAsRead(t,e)}))}groupMarkAsRead(e){return fc(this,void 0,void 0,(function*(){if(nc.isUndef(e.groupId))throw new Error("groupId could not be empty.");let t=Wu.byScene(Qr.GROUP,e.groupId);yield this.markAsRead(t,e)}))}markMessageAsRead(e,t){return fc(this,void 0,void 0,(function*(){if(nc.isUndef(e.id))throw new Error("id could not be empty.");if(!Object.values(Qr).includes(e.type))throw new Error("incorrect type, must be: "+Object.values(Qr));Qr.CS==e.type&&nc.isUndef(t)&&(t=e.id);let n=Wu.byScene(e.type,e.id,t);yield this.markAsRead(n,e)}))}markAsRead(e,t){return fc(this,void 0,void 0,(function*(){let n=this.findHistory(e);n&&(yield n.markRead()),gc.onSuccess(t)}))}deleteMessage(e){return fc(this,void 0,void 0,(function*(){this.validateMessageArray(e.messages),$u.validate(e);let t=e.messages[0],n=Wu.byIMMessage(t),i=this.findHistory(n);if(!i)throw{code:400,content:"No message that could be deleted"};yield i.deleteMessages(e)}))}findOrCreateHistory(e){let t=this.findHistory(e);return t||(t=e.scene===Qr.CS?Wc.Socket.user().id===e.customerId()?new sh(e):new oh(e):new cl(e),this.map.set(e.toString(),t),t)}static get(e){return rh.instance.findOrCreateHistory(e)}findHistory(e){return this.map.get(e.toString())}validateMessageArray(e){ah.validateMessageArray(e)}}class ch{constructor(e){this.top=!1,this.data=null,this.dataLoaded=!1,this.target=e}toDto(){let e=this.target.scene,t=this.target.id,n=new ec;return e===Qr.PRIVATE?n.userId=t:e===Qr.GROUP?n.groupId=t:e===Qr.CS&&(n.id=this.target.teamId),n.type=e,n.lastMessage=this.getMaxMessage(),n.unread=this.getUnreadAmount(),n.top=this.top,n.data=this.data,n}getMaxMessage(){return rh.get(this.target).getMaxMessage()}getUnreadAmount(){return rh.get(this.target).unreadAmount()}maxMessageTime(){return rh.get(this.target).maxTime()}}class uh extends ch{constructor(e){super(e),this.accepted=!1}toDto(){let e=new ec,t=this.target.scene,n=this.target.id,i=this.target.teamId;return e.id=n,e.teamId=i,e.type=t,e.lastMessage=this.getMaxMessage(),e.unread=this.getUnreadAmount(),e.top=this.top,e.data=this.data,e.ended=this.isEnded(),e}isEnded(){let e=this.getMaxMessage(),t=e.type,n=e.payload;return t===Nu.END||t===Nu.TRANSFER&&n.transferTo.id!==Wc.Socket.user().id}getMaxMessage(){return rh.get(this.target).getMaxMessage(this.accepted)}getUnreadAmount(){return rh.get(this.target).unreadAmount(this.accepted)}maxMessageTime(){return rh.get(this.target).maxTime(this.accepted)}}class lh{constructor(e,t,n,i){this.type=e,this.top=t,this.targetId=n,this.teamId=i}}class dh{constructor(e,t,n){this.type=e,this.targetId=t,this.teamId=n}}class ph{constructor(e,t,n){this.type=e,this.targetId=t,this.teamId=n}}class hh{top(e,t){let n=new lh(e.scene,t,e.id,e.teamId);return new Promise(((e,t)=>{let i=new Qc({name:dc.topConversation,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:n=>{200===n.code?e(n):t(n)},fail:e=>{t(e)}});Wc.Socket.e(i)}))}remove(e){let t=new dh(e.scene,e.id,e.teamId);return new Promise(((e,n)=>{let i=new Qc({name:dc.removeConversation,params:t,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:t=>{200==t.code?e(t):n(t)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}query(e){return new Promise(((t,n)=>{let i=new Qc({name:e,params:{},permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{n(e)},success:e=>fc(this,void 0,void 0,(function*(){t(e)}))});Wc.Socket.e(i)}))}loadData(e){let t=new ph(e.scene,e.id,e.teamId);return new Promise(((e,n)=>{let i=new Qc({name:dc.imData,params:t,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,success:t=>{let n=JSON.parse(t.content);e(n)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}}hh.instance=new hh;class gh{constructor(){this.list=new Array,this.builder=new tl,this.remoteConversations=hh.instance,this.synchronized=!1,Vu.i.on(Lu.MAX_MESSAGE_CHANGED,this.onMaxMessageChanged.bind(this)),Vu.i.on(Lu.UNREAD_AMOUNT_CHANGED,this.onUnreadMessageChanged.bind(this)),Vu.i.on(Lu.MAX_MESSAGE_DELETED,this.onMaxMessageDeleted.bind(this))}onUnreadMessageChanged(e){this.findConversation(e)&&this.fireUpdated()}fireUpdated(){this.debounce(this.triggerUpdate.bind(this))}triggerUpdate(){let e=this.loadLocalConversations(),t=this.getUpdatedEventName();rl.fire(t,{unreadTotal:e.content.unreadTotal,conversations:e.content.conversations})}getUpdatedEventName(){return wu.CONVERSATIONS_UPDATED}latestConversations(e){return fc(this,void 0,void 0,(function*(){this.synchronized||(yield this.loadServerConversations());let t=this.loadLocalConversations();gc.onSuccess(e,t)}))}loadServerConversations(){return fc(this,void 0,void 0,(function*(){let e=this.rocketName(),t=yield this.remoteConversations.query(e);this.convertAbbrConversation(t.content),this.synchronized=!0}))}rocketName(){return dc.imLastConversations}convertAbbrConversation(e){let t=e;for(const n of t){let e=n.t,t=n.top,i=n.d?JSON.parse(n.d):{},o=n.userOffsets;n.lmsg.t=e;let s=n.lmsg,a=this.builder.build(s),r=Wu.byIMMessage(a),c=this.findConversation(r);nc.isUndef(c)?(c=this.buildByAbbr(n,a),this.insertOne(c)):(c.top=t,c.data=i),r.scene===Qr.GROUP&&(a.x=1),rh.get(r).initMaxMessageAndOffsets(a,o),this.correctPosition(c)}}onMaxMessageDeleted(e){this.removeConversation(e)}onMaxMessageChanged(e){return fc(this,void 0,void 0,(function*(){if(e.scene()===Qr.CS){let t=e;if(Wc.Socket.user().id!=t.customerId()&&(!1===t.accepted||t.type===Nu.ACCEPT&&t.senderId!=Wc.Socket.user().id))return}yield this.saveOrUpdateConversation(e)}))}saveOrUpdateConversation(e){return fc(this,void 0,void 0,(function*(){let t=e.status,n=Wu.byIMMessage(e),i=this.findConversation(n);nc.isUndef(i)&&t!==Zr.FAIL&&(i=this.buildByMessage(e),this.insertOne(i),t===Zr.SUCCESS&&(i.data=yield this.remoteConversations.loadData(n),i.dataLoaded=!0)),t===Zr.SENDING&&(i.data=e.getToData(),i.dataLoaded=!0),i&&i.dataLoaded&&(this.correctPosition(i),this.fireUpdated())}))}debounce(e){clearTimeout(this.timer),this.timer=setTimeout((()=>{e()}),500)}loadLocalConversations(){let e=0,t=new Array;for(const n of this.list)if(n.dataLoaded&&n.getMaxMessage()){e+=n.getUnreadAmount();let i=n.toDto();t.push(i)}return{code:200,content:{unreadTotal:e,conversations:t}}}findConversationIndex(e){return this.list.findIndex((t=>e.toString()===t.target.toString()))}findConversation(e){let t=this.findConversationIndex(e);return this.list[t]}removeLocalConversation(e){let t=this.findConversationIndex(e.target);this.list.splice(t,1)}insertOne(e){gh.sortedInserter.insert(this.list,e),this.list.length>gh.CONVERSATIONS_MAX_LENGTH&&0===this.list[this.list.length-1].getUnreadAmount()&&this.list.pop()}correctPosition(e){this.removeLocalConversation(e),this.insertOne(e)}removeConversation(e){let t=this.findConversation(e);t&&(this.removeLocalConversation(t),this.fireUpdated())}top(e,t,n){return fc(this,void 0,void 0,(function*(){if(!nc.isBoolean(t))throw new Error("top must be boolean.");let i=this.findConversation(e);if(!i)throw new Error("conversation does not exist.");i.top!=t&&(yield this.remoteConversations.top(e,t),i.top=t,this.correctPosition(i)),this.fireUpdated(),gc.onSuccess(n)}))}remove(e,t){return fc(this,void 0,void 0,(function*(){let n=this.findConversation(e);if(!n)throw new Error("conversation does not exist.");if(n instanceof uh&&!n.isEnded())throw new Error("CS conversation can only be deleted after it ends");yield this.remoteConversations.remove(e),this.removeLocalConversation(n),this.fireUpdated(),gc.onSuccess(t)}))}buildByAbbr(e,t){let n,i=Wu.byIMMessage(t);if(e.t===Qr.CS){let e=t;Wc.Socket.user().id===e.customerId()?n=new ch(i):(n=new uh(i),n.accepted=e.accepted)}else n=new ch(i);return n.dataLoaded=!0,n.top=e.top,n.data=e.d?JSON.parse(e.d):{},n}buildByMessage(e){let t,n=Wu.byIMMessage(e);if(e.scene()===Qr.CS){let i=e;Wc.Socket.user().id===i.customerId()?t=new ch(n):(t=new uh(n),t.accepted=i.accepted)}else t=new ch(n);return t}}gh.CONVERSATIONS_MAX_LENGTH=200,gh.sortedInserter=new class extends Ku{compare(e,t){let n;if(e.top==t.top){let i=e.maxMessageTime();n=t.maxMessageTime()-i}else n=e.top?-1:1;return 0===n?0:n>0?1:-1}};class fh extends Fc{static init(){return this.module=new fh,this.module.name=this.GIM_MODULE_NAME,this.initGN(),this.module}static initGN(){eu.addAssembler(new class{assemble(e){let t={messageId:e.id,timestamp:e.tm,type:e.t,senderId:e.sid,toType:e.tt};return e.tt===Qr.GROUP&&(t.groupId=e.gid),t}support(e){return!!e.sid}})}postConnect(){vg.init()}static check(){if(!this.module)throw{code:400,content:"IM not initialized. Please include 'IM' in the 'modules' during GoEasy initialization."}}}fh.GIM_MODULE_NAME="GIM";class mh extends gh{constructor(){super(),this.expired=!1,Vu.i.on(Lu.CS_ONLINE_SUCCESS,this.onCSOnlineSuccess.bind(this)),Vu.i.on(Lu.CS_OFFLINE_SUCCESS,this.onCSOfflineSuccess.bind(this)),th.on(th.EVENT.LOST,this.onDisconnected.bind(this)),th.on(th.EVENT.RECONNECTED,this.onConnected.bind(this))}onMaxMessageChanged(e){return fc(this,void 0,void 0,(function*(){if(e.scene()===Qr.CS){let t=e;if(t.customerId()!=Wc.Socket.user().id&&(!1===t.accepted||t.type===Nu.ACCEPT))if(Nu.ACCEPT===e.type){let t=Wu.byIMMessage(e);this.removeConversation(t)}else yield this.saveOrUpdateConversation(e)}}))}latestConversations(e){const t=Object.create(null,{latestConversations:{get:()=>super.latestConversations}});return fc(this,void 0,void 0,(function*(){let n=this.synchronized;yield t.latestConversations.call(this,e),this.list.length>0&&!n&&this.fireUpdated()}))}onUnreadMessageChanged(e){}onCSOnlineSuccess(){return fc(this,void 0,void 0,(function*(){yield this.loadServerConversations(),this.fireUpdated()}))}onCSOfflineSuccess(){this.list=[],this.fireUpdated()}getUpdatedEventName(){return wu.PENDING_CONVERSATIONS_UPDATED}rocketName(){return dc.CS_PENDING_CONVERSATION}convertAbbrConversation(e){return fc(this,void 0,void 0,(function*(){let t=e;for(const e of t){e.lastMessage.t=Qr.CS;let t=e.customerData,n=e.lastMessage,i=e.userOffsets,o=t?JSON.parse(t):{},s=this.builder.build(n),a=Wu.byIMMessage(s),r=this.findConversation(a);nc.isUndef(r)&&(r=new uh(a),r.accepted=s.accepted,r.dataLoaded=!0,this.insertOne(r)),r.top=!1,r.data=o,rh.get(a).initPendingMaxMessageAndOffsets(s,i),this.correctPosition(r)}}))}onDisconnected(){this.expired=!0}onConnected(){return fc(this,void 0,void 0,(function*(){this.expired&&fh.module&&fh.module.active&&(this.expired=!1,this.list=[],yield this.loadServerConversations(),this.fireUpdated())}))}}class _h{constructor(){this.conversations=new gh,this.pendingConversations=new mh}latestConversations(e){this.conversations.latestConversations(e)}latestPendingConversations(e){this.pendingConversations.latestConversations(e)}topPrivateConversation(e){let t=Wu.byScene(Qr.PRIVATE,e.userId);this.conversations.top(t,e.top,e)}topGroupConversation(e){let t=Wu.byScene(Qr.GROUP,e.groupId);this.conversations.top(t,e.top,e)}topConversation(e){let t=e.conversation;this.validateConversationDTO(t);let n=Wu.byConversationDTO(t);this.conversations.top(n,e.top,e)}removePrivateConversation(e){let t=Wu.byScene(Qr.PRIVATE,e.userId);this.conversations.remove(t,e)}removeGroupConversation(e){let t=Wu.byScene(Qr.GROUP,e.groupId);this.conversations.remove(t,e)}removeConversation(e){let t=e.conversation;this.validateConversationDTO(t);let n=Wu.byConversationDTO(t);this.conversations.remove(n,e)}validateConversationDTO(e){if(!(e instanceof ec))throw new Error("Incorrect conversation object.");{let t=e.lastMessage;if(t instanceof el&&t.customerId()!==Wc.Socket.user().id&&!1===t.accepted)throw new Error("pending conversation cannot be topped or removed.")}}}class vh{constructor(){this.builder=new tl,Wc.Socket.onMessage(au.imMessage,this.onMessageReceived.bind(this))}onMessageReceived(e){if(e.t!==Qr.CS){let t=this.builder.build(e);this.sendAck(t);let n=Wu.byIMMessage(t),i=n.scene;rh.get(n).existsMessage(t)||(this.createNotification(e),Vu.i.fire(Lu.MESSAGE_RECEIVED,t),i===Qr.PRIVATE?rl.fire(wu.PRIVATE_MESSAGE_RECEIVED,t):i===Qr.GROUP&&rl.fire(wu.GROUP_MESSAGE_RECEIVED,t))}}sendAck(e){Wc.Socket.sendAck("imAck",{publishGuid:e.messageId})}createNotification(e){const t=Wc.N.supportAppNotification();if(!nc.isObject(e.nt)||e.s===Wc.Socket.user().id||!t)return;let n={id:e.i,tm:e.ts,t:e.mt,sid:e.s,tt:e.t};n.tt===Qr.GROUP&&(n.gid=e.r),Wc.N.createLocalNotification(e.nt.t,e.nt.c,n,e.nt.sound,e.nt.badge)}}class yh{constructor(){this.subscribedGroups=[],Wc.Socket.on(ru.EXPIRED_RECONNECTED,this.expiredResubscribeGroups.bind(this))}expiredResubscribeGroups(){this.subscribedGroups.forEach((e=>fc(this,void 0,void 0,(function*(){yield this.doSubscribeGroup(e)}))))}subscribe(e){let t=e.groupIds;nu.validateIdArray(t,"groupIds");let n=new Ih(t,e.accessToken);this.doSubscribeGroup(n).then((()=>{this.subscribedGroups.push(n),gc.onSuccess(e,{code:200,content:"ok"})})).catch((t=>{gc.onFailed(e,{code:t.resultCode||408,content:t.content||"Failed to subscribe group message"})}))}doSubscribeGroup(e){return new Promise(((t,n)=>{let i=e.groupIds.toString().split(","),o=new Qc({name:dc.subscribeGroups,params:{groupIds:i,at:e.accessToken},permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:()=>{t()},fail:e=>{n(e)}});Wc.Socket.e(o)}))}unsubscribe(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t=new Qc({name:dc.unsubscribeGroup,params:{groupId:e.groupId},permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:()=>{this.deleteSubscriptionByGroupId(e.groupId),gc.onSuccess(e,{code:200,content:"ok"})},fail:t=>{gc.onFailed(e,{code:t.resultCode||408,content:t.content||"Failed to unsubscribe group message"})}});Wc.Socket.e(t)}deleteSubscriptionByGroupId(e){this.subscribedGroups=this.subscribedGroups.filter((t=>{const n=t.groupIds.findIndex((t=>t==e));return n>-1&&t.groupIds.splice(n,1),t.groupIds.length>0}))}}class Ih{constructor(e,t){this.groupIds=e,this.accessToken=t}}class Mh{constructor(){this.newMessageReceived=e=>{let t=null;e.c&&(t=JSON.parse(e.c)),t&&t.events&&t.events.map((e=>{let n=e.userData?JSON.parse(e.userData):{},i={time:e.time,action:e.action,groupOnlineCount:t.userAmount,groupId:t.groupId,id:e.userId,data:n};rl.fire(wu.GROUP_PRESENCE,i)}))},th.onMessage(au.groupPresence,this.newMessageReceived)}presence(e){nu.validateIdArray(e.groupIds,"groupIds"),e.groupIds.toString().split(",");let t={groupIds:e.groupIds};this.emitRocket(dc.subscribeGroupPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to subscribe group message"})}),pc.commonRequestSingle,pc.commonRequestTotal)}unPresence(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t={groupId:e.groupId};this.emitRocket(dc.unsubscribeGroupPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to unsubscribe presence"})}),pc.commonRequestSingle,pc.commonRequestTotal)}emitRocket(e,t,n,i,o,s){let a=new Qc({name:e,params:t,singleTimeout:o,totalTimeout:s,permission:Jc.WRITE,success:n,fail:i});Wc.Socket.e(a)}}class Ch{get(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t=new Qc({name:dc.imGroupOnlineCount,params:{groupId:e.groupId},permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:function(t){gc.onFailed(e,t||{code:408,content:"Failed to query online group users"})},success:function(t){200==t.code?gc.onSuccess(e,t):gc.onFailed(e,t)}});Wc.Socket.e(t)}}class Sh{doHereNow(e,t,n){let i=new Qc({name:e,params:t,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{gc.onFailed(n,e)},success:e=>{let t=e.content;e.content=t.map((e=>{let t=e.userData?JSON.parse(e.userData):{};return{id:e.userId,data:t}})),gc.onSuccess(n,e)}});Wc.Socket.e(i)}}class Eh extends Sh{hereNow(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t={groupId:e.groupId};this.doHereNow(dc.imGroupHereNow,t,e)}}class Th{constructor(){this.newMessageReceived=e=>{let t=[];e.c&&(t=JSON.parse(e.c).events||[]),t.map((e=>{let t=e.userData?JSON.parse(e.userData):{},n={time:e.time,action:e.action,id:e.userId,data:t};rl.fire(wu.USER_PRESENCE,n)}))},th.onMessage(au.userPresence,this.newMessageReceived)}presence(e){nu.validateIdArray(e.userIds,"userIds"),e.userIds.toString().split(",");let t={userIds:e.userIds};this.emitRocket(dc.subscribeUserPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to subscribe group message"})}),pc.commonRequestSingle,pc.commonRequestTotal)}unPresence(e){nu.validateId(e.userId,"userId"),e.userId=e.userId.toString();let t={userId:e.userId};this.emitRocket(dc.unsubscribeUserPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to unsubscribe presence"})}),pc.commonRequestSingle,pc.commonRequestTotal)}emitRocket(e,t,n,i,o,s){let a=new Qc({name:e,params:t,singleTimeout:o,totalTimeout:s,permission:Jc.WRITE,success:n,fail:i});Wc.Socket.e(a)}}class kh extends Sh{hereNow(e){let t=e.userIds;nu.validateIdArray(t,"userIds"),t.toString().split(","),this.doHereNow(dc.imHereNow,e,e)}}const Dh=new class{fileExtension(e,t){if(nc.isString(e))try{let n=e.split(t);return n[n.length-1]}catch(n){throw Error(n)}}};class Rh{}class Oh extends Rh{constructor(){super(...arguments),this.contentType="",this.name="",this.size=0,this.url=""}}class bh extends Oh{constructor(){super(...arguments),this.width=0,this.height=0}}class Ah{build(e){this.validate(e.createOptions);let t=this.create();return this.setPayload(e,t),t}}class Lh extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.name=i.name,n.size=i.size,n.contentType=i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Ph extends Lh{create(){return new bh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=n.path||n.tempFilePath,s=nc.isEmpty(n.name)||void 0===n.name?o:n.name;i.name="wx-image."+Dh.fileExtension(s,"."),i.contentType="image/"+Dh.fileExtension(s,"."),i.url=o,i.size=n.size,e.complete=new Promise(((e,t)=>{Pn.getImageInfo({src:i.url,success(t){i.width=t.width,i.height=t.height,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Nh extends Oh{constructor(){super(...arguments),this.duration=0}}class wh extends Lh{create(){return new Nh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=n.tempFilePath,s=nc.isEmpty(n.name)||null==n.name?o:n.name,a=n.duration,r=n.fileSize;i.url=o,i.size=r,i.duration=a/1e3,i.name="wx-audio."+Dh.fileExtension(s,"."),i.contentType="audio/"+Dh.fileExtension(s,"."),e.complete=Promise.resolve()}validate(e){super.validate(e)}}class Uh extends Rh{constructor(){super(...arguments),this.text=""}}class Gh extends Ah{create(){return new Uh}setPayload(e,t){let n=t,i=e.createOptions;n.text=i.text,e.complete=Promise.resolve()}validate(e){if(nc.isEmpty(e.text))throw{code:400,content:"text is empty"};if(!nc.isString(e.text))throw{code:400,content:"TypeError: text requires string."};if(""===e.text.trim())throw{code:400,content:"text is empty"};if(e.text.length>2500)throw{code:400,content:"Message text over max length 2500"}}}class xh extends Rh{constructor(){super(...arguments),this.video=new Bh,this.thumbnail=new Fh}}class Fh{constructor(){this.name="",this.url="",this.width=0,this.height=0,this.contentType=""}initURL(e){oc.currentPlatform()===ic.BROWSER&&this.htmlUrl(e)}htmlUrl(e){let t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height),this.url=t.toDataURL("image/png")}}class Bh{constructor(){this.name="",this.url="",this.width=0,this.height=0,this.contentType="",this.size=0,this.duration=0}}class qh extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,thumbTempFilePath:l,width:d,name:p=""}=n,h=nc.isEmpty(p)?u:p;o.contentType="video/"+Dh.fileExtension(h,"."),o.name="wx-video."+Dh.fileExtension(h,"."),o.url=u,o.width=s.width=d,o.height=s.height=r,o.size=c,o.duration=a,s.url=l,s.contentType="image/jpg",s.name="wx-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Vh extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.fullPath||i.path,n.name=i.name,n.size=i.size,n.contentType=i.type,i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class jh extends Vh{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size;let o=nc.isEmpty(i.name)||void 0===i.name?i.path:i.name;n.contentType="image/"+Dh.fileExtension(o,"."),n.name="uni-image."+Dh.fileExtension(o,"."),e.complete=new Promise(((e,t)=>{Nn.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Hh extends Vh{create(){return new Nh}setPayload(e,t){let n=e.createOptions,i=t,o=n.file,s=o.tempFilePath,a=nc.isEmpty(o.name)||null==o.name?s:o.name;i.url=s,i.name="uni-audio."+Dh.fileExtension(a,"."),i.contentType="audio/"+Dh.fileExtension(a,"."),e.complete=new Promise(((e,t)=>{Nn.getFileInfo({filePath:s,success:o=>{let a=o.size;if(i.size=a,0===a)e();else if(nc.isDef(n.file.duration))i.duration=n.file.duration/1e3,e();else{const n=Nn.createInnerAudioContext();n.src=s,n.onCanplay((function(o){o.errCode?(n.destroy(),t(o)):(i.duration=n.duration,n.destroy(),e())})),n.onError((i=>{n.destroy(),-99===i.errCode?e():t(i)}))}},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Kh extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,width:l,name:d=""}=n,p=nc.isEmpty(d)?u:d;o.size=c,o.width=l,o.height=r,o.url=u,o.duration=a,o.contentType="video/"+Dh.fileExtension(p,"."),o.name="uni-video."+Dh.fileExtension(p,"."),s.url=u,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",s.name="uni-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class zh extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file,o=window.URL||window.webkitURL;n.url=o.createObjectURL(i),n.name=i.name,n.size=i.size,n.contentType=i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!(e.file instanceof File))throw Error("wrong file type.");if(0==e.file.size)throw Error("File size is 0.");if(e.file.size>524288e3)throw Error("message-length limit 30mib")}}class Wh extends zh{create(){return new bh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=window.URL||window.webkitURL,s=new Image;s.src=o.createObjectURL(n),e.complete=new Promise(((e,t)=>{s.onload=function(){i.width=s.width,i.height=s.height,o.revokeObjectURL(s.src),e()},s.onerror=function(e){o.revokeObjectURL(s.src),t(e)}}))}validate(e){super.validate(e);let t=["gif","jpg","png","jpeg"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported image.")}}class Yh extends zh{create(){return new Nh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=window.URL||window.webkitURL,s=document.createElement("audio");s.src=o.createObjectURL(n),e.complete=new Promise(((e,t)=>{s.onloadedmetadata=()=>{i.duration=s.duration,o.revokeObjectURL(s.src),e()},s.onerror=e=>{o.revokeObjectURL(s.src),t(e)}}))}validate(e){super.validate(e);let t=["mp3","ogg","wav","wma","ape","acc","mpeg"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported audio.")}}class $h extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,a=window.URL||window.webkitURL,r=document.createElement("video");r.src=a.createObjectURL(n),o.size=n.size,o.name=n.name,o.contentType=n.type,o.url=r.src,s.name=n.name,s.contentType="image/jpg",e.complete=new Promise(((e,t)=>{r.onloadedmetadata=()=>{o.duration=r.duration,o.width=r.videoWidth,o.height=r.videoHeight,s.width=r.videoWidth,s.height=r.videoHeight,s.url=this.getThumbnailUrl(r),a.revokeObjectURL(r.src),e()},r.onerror=function(e){a.revokeObjectURL(r.src),t(e)}}))}getThumbnailUrl(e){let t=document.createElement("canvas");return t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height),t.toDataURL("image/png")}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!(e.file instanceof File))throw Error("wrong file type.");if(0==e.file.size)throw Error("File size is 0.");if(e.file.size>31457280)throw Error("message-length limit 30mib");let t=["avi","mov","rmvb","rm","flv","mp4","3gp","quicktime"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported video.")}}class Jh extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,tempVideoThumbPath:l,width:d}=n;o.size=c,o.width=d,o.height=r,o.url=u,o.duration=a,o.contentType="video/mp4",o.name="ali-video.mp4",s.url=l,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",s.name="ali-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Xh extends Ah{create(){return new Oh}setPayload(e,t){e.complete=Promise.reject("Alipay not support file message.")}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Qh extends Xh{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size,e.complete=new Promise(((e,t)=>{my.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,n.contentType="image/"+t.type,n.name="ali-image."+t.type,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Zh extends Xh{create(){return new Nh}setPayload(e,t){let n=t,i=e.createOptions.file,o=i.tempFilePath;n.url=o,n.name="ali-audio."+Dh.fileExtension(o,"."),n.contentType="audio/"+Dh.fileExtension(o,"."),n.duration=i.duration,n.size=i.fileSize,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class eg extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,thumbTempFilePath:l,width:d}=n;o.size=c,o.width=d,o.height=r,o.url=u,o.duration=a,o.contentType="video/"+Dh.fileExtension(u,"."),o.name="baidu-video."+Dh.fileExtension(u,"."),s.url=l,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/"+Dh.fileExtension(l,"."),s.name="baidu-thumbnail."+Dh.fileExtension(u,"."),e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class tg extends Ah{create(){return new Oh}setPayload(e,t){e.complete=Promise.reject("Baidu app not support file message.")}validate(e){}}class ng extends tg{create(){return new Nh}setPayload(e,t){let n=t,i=e.createOptions.file,o=i.tempFilePath;n.url=o,n.name="baidu-audio."+Dh.fileExtension(o,"."),n.contentType="audio/"+Dh.fileExtension(o,"."),n.duration=i.duration/1e3,n.size=i.fileSize,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class ig extends tg{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size,e.complete=new Promise(((e,t)=>{swan.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,n.contentType="image/"+t.type,n.name="baidu-image."+t.type,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class og extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;const{uri:o,type:s,size:a,name:r}=i;n.url=decodeURIComponent(o),n.name=r,n.size=a,n.contentType=s,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class sg extends og{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;const{uri:o,fileSize:s,type:a,fileName:r,width:c,height:u}=i;n.url=o,n.size=s,n.contentType=a,n.name=r,n.width=c,n.height=u,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class ag extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file;const i=t,{video:o,thumbnail:s}=i,{uri:a,type:r,fileSize:c,fileName:u,duration:l,height:d,width:p}=n;o.size=c,o.width=p,o.height=d,o.url=a,o.duration=l,o.contentType=r,o.name=u,s.url=a,s.name="rn-thumbnail.jpg",s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class rg extends og{create(){return new Nh}setPayload(e,t){let n=e.createOptions,i=t,o=n.file;const{uri:s,name:a,duration:r,size:c}=o;i.url=s,i.duration=Number((r/1e3).toFixed(2)),i.size=c,i.name=a||"rn-audio."+Dh.fileExtension(s,"."),i.contentType="audio/"+Dh.fileExtension(s,"."),n.file={uri:s,type:i.contentType,name:i.name},e.complete=Promise.resolve()}validate(e){super.validate(e)}}class cg extends Rh{}class ug extends Ah{create(){return new cg}setPayload(e,t){let n=e.createOptions;t.payload=n.payload,e.complete=Promise.resolve()}validate(e){let t=e.type,n=e.payload;if(nc.isEmpty(t))throw Error("type is empty.");if(!nc.isString(t))throw Error("type require a string");if(nc.isEmpty(n))throw Error("payload is empty.");if(!nc.isPlainObject(n)&&!nc.isStringOrNumber(n))throw Error("payload require object | string | number.")}}class lg{constructor(e,t){this.type=e,this.createOptions=t}}class dg{constructor(){this.framework=$r.currentFramework(),this.platform=oc.currentPlatform(),this.payloadBuilders={[zr.UNIAPP]:{image:new jh,file:new Vh,audio:new Hh,video:new Kh,text:new Gh},[ic.MP_WX]:{image:new Ph,file:new Lh,audio:new wh,video:new qh,text:new Gh},[ic.BROWSER]:{image:new Wh,file:new zh,audio:new Yh,video:new $h,text:new Gh},[ic.MP_ALI]:{image:new Qh,file:new Xh,audio:new Zh,video:new Jh,text:new Gh},[ic.MP_BAIDU]:{image:new ig,file:new tg,audio:new ng,video:new eg,text:new Gh},[zr.REACT_NATIVE]:{image:new sg,file:new og,audio:new rg,video:new ag,text:new Gh},[ic.MP_BYTE]:{image:new Ph,file:new Lh,audio:new wh,video:new qh,text:new Gh}}}buildMessage(e,t){const n=this.framework===zr.UNKNOWN?this.platform:this.framework;let i=this.payloadBuilders[n][e],o=new lg(e,t);if(i){let e=i.build(o);o.payload=e}else{let e=(new ug).build(o);o.payload=e.payload}let s=this.build(o);return o.complete.then((()=>{gc.onSuccess(t,s)})).catch((e=>{gc.onFailed(t,e)})),s}build(e){let t,n=e.type,i=e.payload,o=e.createOptions,s=o.to,a=s.type;return this.validate(o),a===Qr.GROUP?(t=new Zu,t.groupId=s.id.toString(),t.senderData=Wc.Socket.user().data):a===Qr.PRIVATE?(t=new Qu,t.read=!1,t.receiverId=s.id.toString()):a===Qr.CS&&(t=new el,t.to=s.id.toString(),t.teamId=s.id.toString(),t.senderData=Wc.Socket.user().data),t.senderId=Wc.Socket.user().id,t.messageId=$c.get(),t.payload=i,t.timestamp=Date.now(),t.type=n,t.recalled=!1,t.status=Zr.NEW,t.buildOptions=e,t}validate(e){const t=e.to;if(!t)throw new Error("message require property to.");if(!nc.isObject(t))throw new Error("TypeError: to requires an object.");if(!nc.isObject(t.data))throw new Error("TypeError: to.data requires an object.");if(!t.type||t.type!==Qr.GROUP&&t.type!==Qr.PRIVATE&&t.type!==Qr.CS)throw new Error("message require property to.type");if(nu.validateId(t.id,"to.id"),Wc.Socket.user().id===t.id)throw new Error("to.id can not be the same as your id.");nc.isDef(e.notification)&&nu.validateNotification(e.notification),e.wxmpTemplateMsg&&nu.validateWXMPTemplateMsg(e.wxmpTemplateMsg)}}class pg extends vh{onMessageReceived(e){if(e.t===Qr.CS){let t=this.builder.build(e);this.sendAck(t);let n=Wu.byIMMessage(t);rh.get(n).existsMessage(t)||(t.customerId()===Wc.Socket.user().id?(this.createNotification(e),Vu.i.fire(Lu.MESSAGE_RECEIVED,t),rl.fire(wu.CS_MESSAGE_RECEIVED,t)):nh.getInstance().queryTeams().then((()=>{ih.isMyMessage(t)&&this.createNotification(e),Vu.i.fire(Lu.CS_AGENT_MESSAGE_RECEIVED,t)})))}}}class hg{constructor(e){this.times=new Array;let t=e[0],n=Wu.byIMMessage(t);this.scene=n.scene,this.targetId=n.id,e.forEach((e=>{this.times.push(e.timestamp)})),this.times.sort(((e,t)=>e{Vu.i.fire(Lu.MESSAGE_RECALLED,e)},th.onMessage(au.IM_MSG_RECALLED,this.onRemoteRecalled)}recallMessage(e){return fc(this,void 0,void 0,(function*(){ah.validateMessageArray(e.messages),this.validate(e);let t=e.messages;yield this.recallServerMessages(t);let n=t[0],i=n.scene(),o=this.toConversationId(i,n.senderId,n.targetId()),s={id:Wc.Socket.user().id,data:Wc.Socket.user().data},a=t.map((e=>e.timestamp)),r=new al(i,o,s,a);Vu.i.fire(Lu.MESSAGE_RECALLED,r),gc.onSuccess(e)}))}toConversationId(e,t,n){if(Qr.PRIVATE===e)return o=n,(i=t).localeCompare(o)>0?`${i}:${o}`:`${o}:${i}`;var i,o;if(Qr.GROUP===e)return n;throw{code:400,content:`scene: ${e} not support`}}recallServerMessages(e){let t=new hg(e);return 0===t.times.length?Promise.resolve():new Promise(((e,n)=>{let i=new Qc({name:dc.IM_RECALL_MESSAGE,params:t,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{n(e)},success:t=>{200===t.code?e(t):n(t)}});Wc.Socket.e(i)}))}validate(e){let t=e.messages;for(let n=0;n{let i=this.dataCache.getData(e);i?n.set(e,i):t.push(e)})),0===t.length||(yield this.fetchData(...t)).forEach(((e,t)=>{this.dataCache.setData(t,e),n.set(t,e)})),Promise.resolve(n)}))}fetchData(...e){return new Promise(((t,n)=>{let i=new Qc({name:dc.MD_CMD,permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,params:{name:"GET",data:{ids:e}},success:e=>{if(200===e.code){const n=new Map;e.content.forEach((e=>{n.set(e.id,e.data)})),t(n)}else n(e)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}setData(e,t){this.dataCache.setData(e,t)}}class _g{constructor(){Vu.i.on(Lu.MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.MESSAGE_SENDING,this.onMessageSending)}onMessageSending(e){let t=Wu.byIMMessage(e);t.scene===Qr.PRIVATE&&mg.i.setData(t.id,e.getToData())}onMessageReceived(e){if(Wu.byIMMessage(e).scene===Qr.GROUP){let t=e;mg.i.setData(t.senderId,t.senderData)}}}class vg{constructor(){this._iMReceiver=new vh,this.csMessageReceiver=new pg,this.memberDataUpdator=new _g,this._userHereNow=new kh,this.goEasyUploader=new Au,this._groupHereNow=new Eh,this._groupOnlineCount=new Ch,this.groupMessageSubscriber=new yh,this.messageBuilder=new dg,this.messageSender=new Hu,this.recaller=new gg,this._groupPresenceSubscriber=new Mh,this._userPresenceSubscriber=new Th,this.conversations=new _h,this.histories=rh.init()}static init(){Vu.init(),rl.init(),vg.instance=new vg}static i(){if(vg.instance)return vg.instance;throw Error("Please connect first.")}validateModules(){if(th.status()===Wr.DISCONNECTED)throw Error("Please call connect() first.");fh.check()}catch(e,t){return fc(this,void 0,void 0,(function*(){try{this.validateModules(),nu.validateCallbackOptions(t),yield e()}catch(n){gc.onFailed(t,n)}}))}on(e,t){rl.on(e,t)}off(e,t){rl.off(e,t)}createTextMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.TEXT,e)}createImageMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.IMAGE,e)}createFileMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.FILE,e)}createAudioMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.AUDIO,e)}createVideoMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.VIDEO,e)}createCustomMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(e.type,e)}sendMessage(e){this.catch((()=>{this.messageSender.send(e)}),e)}recallMessage(e){this.catch((()=>{this.recaller.recallMessage(e)}),e)}deleteMessage(e){this.catch((()=>{this.histories.deleteMessage(e)}),e)}markGroupMessageAsRead(e){this.catch((()=>fc(this,void 0,void 0,(function*(){yield this.histories.groupMarkAsRead(e)}))),e)}markPrivateMessageAsRead(e){this.catch((()=>fc(this,void 0,void 0,(function*(){yield this.histories.privateMarkAsRead(e)}))),e)}markMessageAsRead(e,t){this.catch((()=>fc(this,void 0,void 0,(function*(){yield this.histories.markMessageAsRead(e,t)}))),e)}latestConversations(e){this.validateModules(),this.conversations.latestConversations(e)}removePrivateConversation(e){this.catch((()=>this.conversations.removePrivateConversation(e)),e)}removeGroupConversation(e){this.catch((()=>this.conversations.removeGroupConversation(e)),e)}topPrivateConversation(e){this.catch((()=>this.conversations.topPrivateConversation(e)),e)}topGroupConversation(e){this.catch((()=>this.conversations.topGroupConversation(e)),e)}history(e,t){this.catch((()=>{this.histories.loadHistory(e,t)}),e)}subscribeUserPresence(e){this.catch((()=>this._userPresenceSubscriber.presence(e)),e)}unsubscribeUserPresence(e){this.catch((()=>this._userPresenceSubscriber.unPresence(e)),e)}hereNow(e){this.catch((()=>this._userHereNow.hereNow(e)),e)}subscribeGroup(e){this.catch((()=>this.groupMessageSubscriber.subscribe(e)),e)}unsubscribeGroup(e){this.catch((()=>this.groupMessageSubscriber.unsubscribe(e)),e)}subscribeGroupPresence(e){this.catch((()=>this._groupPresenceSubscriber.presence(e)),e)}unsubscribeGroupPresence(e){this.catch((()=>this._groupPresenceSubscriber.unPresence(e)),e)}groupHereNow(e){this.catch((()=>this._groupHereNow.hereNow(e)),e)}groupOnlineCount(e){this.catch((()=>this._groupOnlineCount.get(e)),e)}latestPendingConversations(e){this.validateModules(),this.conversations.latestPendingConversations(e)}topConversation(e){this.validateModules(),this.conversations.topConversation(e)}removeConversation(e){this.validateModules(),this.conversations.removeConversation(e)}}class yg{constructor(e,t){this.customerId=e,this.teamId=t}}class Ig{constructor(e,t){this.teamId=e;let n=new tc(t.id.toString(),JSON.stringify(t.data));this.customer=n}}class Mg{constructor(e,t,n){this.customerId=e,this.teamId=t,this.agentId=n}}class Cg{constructor(e,t){this.customerId=e,this.teamId=t}}class Sg{constructor(e){this.builder=new tl,this.teamId=e}accept(e,t){let n=t.customer;if(nc.isUndef(n))throw{code:400,content:"customer is required."};nu.validateId(n.id,"customer.id");let i=n.data;if(nc.isUndef(i)||!nc.isObject(i))throw{code:400,content:"customer data must be non-empty object."};let o=new Ig(e,n),s=new Qc({name:dc.CS_ACCEPT,params:o,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);Vu.i.fire(Lu.CS_ACCEPTED,n),gc.onSuccess(t)}});Wc.Socket.e(s)}end(e,t){nu.validateId(t.id,"id");let n=t.id.toString(),i=new Cg(n,e),o=new Qc({name:dc.CS_END,params:i,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);Vu.i.fire(Lu.CS_ENDED,n),gc.onSuccess(t)}});Wc.Socket.e(o)}queryCustomerStatus(e,t){return fc(this,void 0,void 0,(function*(){nu.validateId(t.id,"id");let n=yield this.doCustomerStatus(e,t.id);this.activeCustomerStatus=n,this.activeCustomerStatusOptions=t,gc.onSuccess(t,n)}))}doCustomerStatus(e,t){let n=t.toString(),i=new yg(n,e);return new Promise(((e,t)=>{let n=new Qc({name:dc.CS_CUSTOMER_STATUS,params:i,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{t(e)},success:t=>{let n=t.content;n.agent&&(n.agent.data=JSON.parse(n.agent.data)),e(n)}});Wc.Socket.e(n)}))}transfer(e,t){nu.validateId(t.customerId,"customerId"),nu.validateId(t.agentId,"agentId");let n=t.customerId.toString(),i=t.agentId.toString(),o=new Mg(n,e,i),s=new Qc({name:dc.CS_TRANSFER,params:o,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);Vu.i.fire(Lu.CS_TRANSFER,n),gc.onSuccess(t)}});Wc.Socket.e(s)}}class Eg{createTextMessage(e,t){let n=vg.i().createTextMessage(t);this.extendProps(e,n)}createImageMessage(e,t){let n=vg.i().createImageMessage(t);this.extendProps(e,n)}createFileMessage(e,t){let n=vg.i().createFileMessage(t);this.extendProps(e,n)}createAudioMessage(e,t){let n=vg.i().createAudioMessage(t);this.extendProps(e,n)}createVideoMessage(e,t){let n=vg.i().createVideoMessage(t);this.extendProps(e,n)}createCustomMessage(e,t){let n=vg.i().createCustomMessage(t);this.extendProps(e,n)}extendProps(e,t){if(t.scene()===Qr.CS){let n=t;n.teamId=e,n.accepted=!0}}}class Tg{constructor(e){this.teamId=e,this.agentStatus=nh.getInstance(),this.conversationHandler=new Sg(e),this.messageCreator=new Eg}catch(e,t){return fc(this,void 0,void 0,(function*(){try{nu.validateCallbackOptions(t),yield e()}catch(n){gc.onFailed(t,n)}}))}isOnline(e){this.catch((()=>{this.agentStatus.isOnline(this.teamId,e)}),e)}online(e){this.catch((()=>{this.agentStatus.online(this.teamId,e)}),e)}offline(e){this.catch((()=>{this.agentStatus.offline(this.teamId,e)}),e)}customerStatus(e){this.catch((()=>{this.conversationHandler.queryCustomerStatus(this.teamId,e)}),e)}accept(e){this.catch((()=>{this.conversationHandler.accept(this.teamId,e)}),e)}end(e){this.catch((()=>{this.conversationHandler.end(this.teamId,e)}),e)}history(e){vg.i().history(e,this.teamId)}markMessageAsRead(e){vg.i().markMessageAsRead(e,this.teamId)}createTextMessage(e){this.messageCreator.createTextMessage(this.teamId,e)}createImageMessage(e){this.messageCreator.createImageMessage(this.teamId,e)}createFileMessage(e){this.messageCreator.createFileMessage(this.teamId,e)}createAudioMessage(e){this.messageCreator.createAudioMessage(this.teamId,e)}createVideoMessage(e){this.messageCreator.createVideoMessage(this.teamId,e)}createCustomMessage(e){this.messageCreator.createCustomMessage(this.teamId,e)}transfer(e){this.catch((()=>{this.conversationHandler.transfer(this.teamId,e)}),e)}agents(e){this.catch((()=>{this.agentStatus.agents(this.teamId,e)}),e)}liveSession(e){this.catch((()=>{ih.live(this.teamId,e)}),e)}quitLiveSession(e){this.catch((()=>{ih.quit(e)}),e)}listenCustomer(e){let t={customerId:e.id,onNewMessage:e.onNewMessage,onStatusUpdated:e.onStatusUpdated,onFailed:e.onFailed,onSuccess:e.onSuccess};this.catch((()=>{ih.live(this.teamId,t)}),e)}cancelListenCustomer(e){this.catch((()=>{ih.quit(e)}),e)}}class kg{static team(e){nu.validateId(e,"teamId");let t=this.teams.get(e);return t||(t=new Tg(e.toString()),this.teams.set(e.toString(),t)),t}}kg.teams=new Map;class Dg{constructor(e){this.id=e}isOnline(e){kg.team(this.id).isOnline(e)}online(e){kg.team(this.id).online(e)}offline(e){kg.team(this.id).offline(e)}customerStatus(e){kg.team(this.id).customerStatus(e)}accept(e){kg.team(this.id).accept(e)}end(e){kg.team(this.id).end(e)}history(e){kg.team(this.id).history(e)}markMessageAsRead(e){kg.team(this.id).markMessageAsRead(e)}createTextMessage(e){kg.team(this.id).createTextMessage(e)}createImageMessage(e){kg.team(this.id).createImageMessage(e)}createFileMessage(e){kg.team(this.id).createFileMessage(e)}createAudioMessage(e){kg.team(this.id).createAudioMessage(e)}createVideoMessage(e){kg.team(this.id).createVideoMessage(e)}createCustomMessage(e){kg.team(this.id).createCustomMessage(e)}transfer(e){kg.team(this.id).transfer(e)}agents(e){kg.team(this.id).agents(e)}liveSession(e){kg.team(this.id).liveSession(e)}quitLiveSession(e){kg.team(this.id).quitLiveSession(e)}listenCustomer(e){kg.team(this.id).listenCustomer(e)}cancelListenCustomer(e){kg.team(this.id).cancelListenCustomer(e)}}class Rg{static getInstance(e){return this.init(e),Rg}static init(e){if(this.getConnectionStatus()!==Wr.DISCONNECTED)throw new Error("Initialization failed. Please disconnect and try again.");this.validateOptions(e),Jr.init(e.reactNativeOptions),this.options=e,th.init(e),e.allowNotification&&eu.init(e.allowNotification),e.modules&&(e.modules.includes("PUBSUB")&&Bc.initModule(fu.init()),e.modules.includes("IM")&&Bc.initModule(fh.init())),mg.init(),Wc.init(th,eu,mg,Xr,sc,Bc)}static setBadge(e){eu.setBadge(e)}static connect(e){th.connect(e,"JS")}static disconnect(e){th.disconnect(e)}static getConnectionStatus(){return th.status()}static validateOptions(e){let t="";if(!nc.isObject(e))throw t="options is require an object.",Error(t);if(!nc.isPrimitive(e.appkey)||0==e.appkey.length)throw t="Invalid options:'appkey' is empty.",Error(t);if(!nc.isPrimitive(e.host)||0==e.host.length)throw t="Invalid options:'host' is empty.",Error(t);if(!nc.isArray(e.modules))throw t="Invalid options: 'modules' must be nonempty array",Error(t);if(!e.modules.includes("im")&&!e.modules.includes("pubsub"))throw t="Invalid options: 'modules' must include at least one of 'im' or 'pubsub'.",Error(t);e.modules=e.modules.map((e=>e.toUpperCase()))}static onClickNotification(e){eu.onClickNotification(e)}static c(e){e.init(Wc.Socket,Wc.N,Wc.Member,Wc.v,Wc.Platform,Bc)}}Rg.version=Xr,Rg.IM_EVENT=wu,Rg.IM_SCENE=Qr,Rg.im=class{static on(e,t){vg.i().on(e,t)}static off(e,t){vg.i().off(e,t)}static createTextMessage(e){return vg.i().createTextMessage(e)}static createImageMessage(e){return vg.i().createImageMessage(e)}static createFileMessage(e){return vg.i().createFileMessage(e)}static createAudioMessage(e){return vg.i().createAudioMessage(e)}static createVideoMessage(e){return vg.i().createVideoMessage(e)}static createCustomMessage(e){return vg.i().createCustomMessage(e)}static sendMessage(e){vg.i().sendMessage(e)}static recallMessage(e){vg.i().recallMessage(e)}static deleteMessage(e){vg.i().deleteMessage(e)}static markGroupMessageAsRead(e){vg.i().markGroupMessageAsRead(e)}static markPrivateMessageAsRead(e){vg.i().markPrivateMessageAsRead(e)}static latestConversations(e){vg.i().latestConversations(e)}static removePrivateConversation(e){vg.i().removePrivateConversation(e)}static removeGroupConversation(e){vg.i().removeGroupConversation(e)}static topPrivateConversation(e){vg.i().topPrivateConversation(e)}static topGroupConversation(e){vg.i().topGroupConversation(e)}static history(e){vg.i().history(e)}static subscribeUserPresence(e){vg.i().subscribeUserPresence(e)}static unsubscribeUserPresence(e){vg.i().unsubscribeUserPresence(e)}static hereNow(e){vg.i().hereNow(e)}static subscribeGroup(e){vg.i().subscribeGroup(e)}static unsubscribeGroup(e){vg.i().unsubscribeGroup(e)}static subscribeGroupPresence(e){vg.i().subscribeGroupPresence(e)}static unsubscribeGroupPresence(e){vg.i().unsubscribeGroupPresence(e)}static groupHereNow(e){vg.i().groupHereNow(e)}static groupOnlineCount(e){vg.i().groupOnlineCount(e)}static markMessageAsRead(e){vg.i().markMessageAsRead(e)}static csteam(e){return new Dg(e)}static pendingConversations(e){vg.i().latestPendingConversations(e)}static topConversation(e){vg.i().topConversation(e)}static removeConversation(e){vg.i().removeConversation(e)}},Rg.pubsub=class{static publish(e){this.catch((()=>{gu.instance.publish(e)}),e)}static subscribe(e){this.catch((()=>{gu.instance.subscribe(e)}),e)}static unsubscribe(e){this.catch((()=>{gu.instance.unsubscribe(e)}),e)}static subscribePresence(e){this.catch((()=>{gu.instance.subscribePresence(e)}),e)}static unsubscribePresence(e){this.catch((()=>{gu.instance.unsubscribePresence(e)}),e)}static history(e){this.catch((()=>{gu.instance.history(e)}),e)}static hereNow(e){this.catch((()=>{gu.instance.hereNow(e)}),e)}static catch(e,t){try{if(fu.check(),[Wr.DISCONNECTED,Wr.DISCONNECTING,Wr.CONNECT_FAILED].includes(Wc.Socket.status()))throw new Error("Please call connect() first.");e()}catch(n){gc.onFailed(t,n)}}};var Og="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function bg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ag={exports:{}};window,Ag.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/Users/chrisftian/Documents/projects/cos-sdk/cos-wx-sdk-v5/dist",n(n.s=8)}([function(e,t,n){function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(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)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,s=function(){};return{s:s,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},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,r=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return r=e.done,e},e:function(e){c=!0,a=e},f:function(){try{r||null==n.return||n.return()}finally{if(c)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n=0;--s){var a=this.tryEntries[s],r=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;A(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:P(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),v}},t}function a(e,t,n,i,o,s,a){try{var r=e[s](a),c=r.value}catch(u){return void n(u)}r.done?t(c):Promise.resolve(c).then(i,o)}function r(e){return(r="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)}var c=n(10),u=n(13),l=n(14),d=l.btoa,p=Pn.getFileSystemManager(),h=n(2),g=n(15),f=g.XMLParser,m=g.XMLBuilder,_=new f({ignoreDeclaration:!0,ignoreAttributes:!0,parseTagValue:!1,trimValues:!1}),v=new m,y=function e(t){if(R(t))for(var n in t){var i=t[n];"string"==typeof i?"#text"===n&&delete t[n]:Array.isArray(i)?i.forEach((function(t){e(t)})):R(i)&&e(i)}};function I(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function M(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&n.push(t?I(i).toLowerCase():i);return n.sort((function(e,t){return(e=e.toLowerCase())===(t=t.toLowerCase())?0:e>t?1:-1}))}var C=["cache-control","content-disposition","content-encoding","content-length","content-md5","content-type","expect","expires","host","if-match","if-modified-since","if-none-match","if-unmodified-since","origin","range","transfer-encoding","pic-operations"],S=function(){},E=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&void 0!==e[n]&&null!==e[n]&&(t[n]=e[n]);return t};function T(e){return b(e,(function(e){return"object"===r(e)&&null!==e?T(e):e}))}function k(e,t){return O(t,(function(n,i){e[i]=t[i]})),e}function D(e){return e instanceof Array}function R(e){return"[object Object]"===Object.prototype.toString.call(e)}function O(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}function b(e,t){var n=D(e)?[]:{};for(var i in e)e.hasOwnProperty(i)&&(n[i]=t(e[i],i));return n}var A,L,P=function(e,t){if(t=k({},t),"getAuth"!==e&&"getV4Auth"!==e&&"getObjectUrl"!==e){var n=t.Headers||{};t&&"object"===r(t)&&(function(){for(var e in t)t.hasOwnProperty(e)&&e.indexOf("x-cos-")>-1&&(n[e]=t[e])}(),F.each({"x-cos-mfa":"MFA","Content-MD5":"ContentMD5","Content-Length":"ContentLength","Content-Type":"ContentType",Expect:"Expect",Expires:"Expires","Cache-Control":"CacheControl","Content-Disposition":"ContentDisposition","Content-Encoding":"ContentEncoding",Range:"Range","If-Modified-Since":"IfModifiedSince","If-Unmodified-Since":"IfUnmodifiedSince","If-Match":"IfMatch","If-None-Match":"IfNoneMatch","x-cos-copy-source":"CopySource","x-cos-copy-source-Range":"CopySourceRange","x-cos-metadata-directive":"MetadataDirective","x-cos-copy-source-If-Modified-Since":"CopySourceIfModifiedSince","x-cos-copy-source-If-Unmodified-Since":"CopySourceIfUnmodifiedSince","x-cos-copy-source-If-Match":"CopySourceIfMatch","x-cos-copy-source-If-None-Match":"CopySourceIfNoneMatch","x-cos-acl":"ACL","x-cos-grant-read":"GrantRead","x-cos-grant-write":"GrantWrite","x-cos-grant-full-control":"GrantFullControl","x-cos-grant-read-acp":"GrantReadAcp","x-cos-grant-write-acp":"GrantWriteAcp","x-cos-storage-class":"StorageClass","x-cos-traffic-limit":"TrafficLimit","x-cos-mime-limit":"MimeLimit","x-cos-forbid-overwrite":"ForbidOverwrite","x-cos-server-side-encryption-customer-algorithm":"SSECustomerAlgorithm","x-cos-server-side-encryption-customer-key":"SSECustomerKey","x-cos-server-side-encryption-customer-key-MD5":"SSECustomerKeyMD5","x-cos-server-side-encryption":"ServerSideEncryption","x-cos-server-side-encryption-cos-kms-key-id":"SSEKMSKeyId","x-cos-server-side-encryption-context":"SSEContext","Pic-Operations":"PicOperations"},(function(e,i){void 0!==t[e]&&(n[i]=t[e])})),t.Headers=E(n))}return t},N=function(e){return new Promise((function(t,n){p.readFile({filePath:e,success:function(e){t(e.data)},fail:function(e){n((null==e?void 0:e.errMsg)||"")}})}))},w=(A=s().mark((function e(t,n,i){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("postObject"!==t){e.next=4;break}i(),e.next=21;break;case 4:if("putObject"!==t){e.next=20;break}if(void 0!==n.Body||!n.FilePath){e.next=17;break}return e.prev=6,e.next=9,N(n.FilePath);case 9:n.Body=e.sent,e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(6),n.Body=void 0,i({error:"readFile error, ".concat(e.t0)}),e.abrupt("return");case 17:void 0!==n.Body?(n.ContentLength=n.Body.byteLength,i(null,n.ContentLength)):i({error:"missing param Body"}),e.next=21;break;case 20:n.FilePath?p.stat({path:n.FilePath,success:function(e){var t=e.stats;n.FileStat=t,n.FileStat.FilePath=n.FilePath;var o=t.isDirectory()?0:t.size;n.ContentLength=o=o||0,i(null,o)},fail:function(e){i(e)}}):i({error:"missing param FilePath"});case 21:case"end":return e.stop()}}),e,null,[[6,12]])})),L=function(){var e=this,t=arguments;return new Promise((function(n,i){var o=A.apply(e,t);function s(e){a(o,n,i,s,r,"next",e)}function r(e){a(o,n,i,s,r,"throw",e)}s(void 0)}))},function(e,t,n){return L.apply(this,arguments)}),U=function(e){return Date.now()+(e||0)},G=function(e,t){if(!e||!t)return-1;e=e.split("."),t=t.split(".");for(var n=Math.max(e.length,t.length);e.lengths)return 1;if(o=0);return function(){return i}}(),F={noop:S,formatParams:P,apiWrapper:function(e,t){return function(n,i){var o,s=this;if("function"==typeof n&&(i=n,n={}),n=P(e,n),s.options.EnableReporter)if("sliceUploadFile"===n.calledBySdk||"sliceCopyFile"===n.calledBySdk)o=n.tracker&&n.tracker.generateSubTracker({apiName:e});else if(["uploadFile","uploadFiles"].includes(e))o=null;else{var a=0;n.Body&&(a="string"==typeof n.Body?n.Body.length:n.Body.size||n.Body.byteLength||0);var r=s.options.UseAccelerate||"string"==typeof s.options.Domain&&s.options.Domain.includes("accelerate.");o=new h({Beacon:s.options.BeaconReporter,clsReporter:s.options.ClsReporter,bucket:n.Bucket,region:n.Region,apiName:e,realApi:e,accelerate:r,fileKey:n.Key,fileSize:a,deepTracker:s.options.DeepTracker,customId:s.options.CustomId,delay:s.options.TrackerDelay})}n.tracker=o;var c=function(e){return e&&e.headers&&(e.headers["x-ci-request-id"]&&(e.RequestId=e.headers["x-ci-request-id"]),e.headers["x-cos-request-id"]&&(e.RequestId=e.headers["x-cos-request-id"]),e.headers["x-cos-version-id"]&&(e.VersionId=e.headers["x-cos-version-id"]),e.headers["x-cos-delete-marker"]&&(e.DeleteMarker=e.headers["x-cos-delete-marker"])),e},u=function(e,t){o&&o.report(e,t),i&&i(c(e),c(t))},l=function(){if("getService"!==e&&"abortUploadTask"!==e){var t=function(e,t){var n=t.Bucket,i=t.Region,o=t.Key;if(e.indexOf("Bucket")>-1||"deleteMultipleObject"===e||"multipartList"===e||"listObjectVersions"===e){if(!n)return"Bucket";if(!i)return"Region"}else if(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e||"uploadFile"===e){if(!n)return"Bucket";if(!i)return"Region";if(!o)return"Key"}return!1}(e,n);if(t)return"missing param "+t;if(n.Region){if(n.Region.indexOf("cos.")>-1)return'param Region should not be start with "cos."';if(!/^([a-z\d-]+)$/.test(n.Region))return"Region format error.";!s.options.CompatibilityMode&&-1===n.Region.indexOf("-")&&"yfb"!==n.Region&&"default"!==n.Region&&n.Region}if(n.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(n.Bucket))if(n.AppId)n.Bucket=n.Bucket+"-"+n.AppId;else{if(!s.options.AppId)return'Bucket should format as "test-1250000000".';n.Bucket=n.Bucket+"-"+s.options.AppId}n.AppId&&delete n.AppId}n.Key&&"/"===n.Key.substr(0,1)&&(n.Key=n.Key.substr(1))}}(),d=["getAuth","getObjectUrl"].includes(e);if(!d&&!i)return new Promise((function(e,o){if(i=function(t,n){t?o(t):e(n)},l)return u({error:l});t.call(s,n,u)}));if(l)return u({error:l});var p=t.call(s,n,u);return d?p:void 0}},xml2json:function(e){var t=_.parse(e);return y(t),t},json2xml:function(e){return v.build(e)},md5:c,clearKey:E,fileSlice:function(e,t,n,i){e?p.readFile({filePath:e,position:t,length:n-t,success:function(e){i(e.data)},fail:function(){i(null)}}):i(null)},getBodyMd5:function(e,t,n){n=n||S,e&&t&&t instanceof ArrayBuffer?F.getFileMd5(t,(function(e,t){n(t)})):n()},getFileMd5:function(e,t){var n=c(e);return t&&t(n),n},binaryBase64:function(e){var t,n,i,o="";for(t=0,n=e.length/2;t-1||i.indexOf("x-ci-")>-1||C.indexOf(i)>-1)&&(t[n]=e[n])}return t}(T(e.Headers||e.headers||{})),c=e.Key||"";e.UseRawKey?t=e.Pathname||e.pathname||"/"+c:0!==(t=e.Pathname||e.pathname||c).indexOf("/")&&(t="/"+t);var l=!1!==e.ForceSignHost;if(!r.Host&&!r.host&&e.Bucket&&e.Region&&l&&(r.Host=e.Bucket+".cos."+e.Region+".myqcloud.com"),n&&i){var d=Math.round(U(e.SystemClockOffset)/1e3)-1,p=d,h=e.Expires||e.expires;p+=void 0===h?900:1*h||0;var g=n,f=o||d+";"+p,m=o||d+";"+p,_=M(r,!0).join(";").toLowerCase(),v=M(a,!0).join(";").toLowerCase(),y=u.HmacSHA1(m,i).toString(),I=[s,t,F.obj2str(a,!0),F.obj2str(r,!0),""].join("\n"),S=["sha1",f,u.SHA1(I).toString(),""].join("\n");return["q-sign-algorithm=sha1","q-ak="+g,"q-sign-time="+f,"q-key-time="+m,"q-header-list="+_,"q-url-param-list="+v,"q-signature="+u.HmacSHA1(S,y).toString()].join("&")}},compareVersion:G,canFileSlice:x,isCIHost:function(e){return/^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(e)},error:function(e,t){var n=e;return e.message=e.message||null,"string"==typeof t?(e.error=t,e.message=t):"object"===r(t)&&null!==t&&(k(e,t),(t.code||t.name)&&(e.code=t.code||t.name),t.message&&(e.message=t.message),t.stack&&(e.stack=t.stack)),"function"==typeof Object.defineProperty&&(Object.defineProperty(e,"name",{writable:!0,enumerable:!1}),Object.defineProperty(e,"message",{enumerable:!0})),e.name=t&&t.name||e.name||e.code||"Error",e.code||(e.code=e.name),e.error||(e.error=T(n)),e},getSourceParams:function(e){var t=this.options.CopySourceParser;if(t)return t(e);var n=e.match(/^([^.]+-\d+)\.cos(v6|-cdc|-internal)?\.([^.]+)\.((myqcloud\.com)|(tencentcos\.cn))\/(.+)$/);return n?{Bucket:n[1],Region:n[3],Key:n[7]}:null},encodeBase64:function(e,t){var n=l.encode(e);return t&&(n=n.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")),n},simplifyPath:function(e){var t,n=[],o=i(e.split("/"));try{for(o.s();!(t=o.n()).done;){var s=t.value;".."===s?n.length&&n.pop():s.length&&"."!==s&&n.push(s)}}catch(a){o.e(a)}finally{o.f()}return"/"+n.join("/")},arrayBufferToString:function(e){return new TextDecoder("utf-8").decode(e)},parseResBody:function(e){var t;if(e&&"string"==typeof e){var n=e.trim(),i=0===n.indexOf("<"),o=0===n.indexOf("{");if(i)t=F.xml2json(e)||{};else if(o)try{var s=e.replace(/\n/g," "),a=JSON.parse(s);t="[object Object]"===Object.prototype.toString.call(a)?a:e}catch(r){t=e}else t=e}else t=e||{};return t}};e.exports=F},function(e,t,n){const i=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",o="["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",s=new RegExp("^"+o+"$");t.isExist=function(e){return void 0!==e},t.isEmptyObject=function(e){return 0===Object.keys(e).length},t.merge=function(e,t,n){if(t){const i=Object.keys(t),o=i.length;for(let s=0;s=0;--o){var a=this.tryEntries[o],r=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=s.call(a,"catchLoc"),u=s.call(a,"finallyLoc");if(c&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;A(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:P(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),v}},t}function s(e,t,n,i,o,s,a){try{var r=e[s](a),c=r.value}catch(u){return void n(u)}r.done?t(c):Promise.resolve(c).then(i,o)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){s(a,i,o,r,c,"next",e)}function c(e){s(a,i,o,r,c,"throw",e)}r(void 0)}))}}function r(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){for(var n=0;n5&&"xml"===i)return g("InvalidXml","XML declaration allowed only at the start of the document.",m(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}}return t}function r(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let n=1;for(t+=8;t"===e[t]&&(n--,0===n))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t"===e[t+2]){t+=2;break}return t}t.validate=function(e,t){t=Object.assign({},o,t);const n=[];let c=!1,u=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)v+=e[o];if(v=v.trim(),"/"===v[v.length-1]&&(v=v.substring(0,v.length-1),o--),d=v,!i.isName(d)){let t;return t=0===v.trim().length?"Invalid space after '<'.":"Tag '"+v+"' is an invalid name.",g("InvalidTag",t,m(e,o))}const y=l(e,o);if(!1===y)return g("InvalidAttr","Attributes for '"+v+"' have open quote.",m(e,o));let I=y.value;if(o=y.index,"/"===I[I.length-1]){const n=o-I.length;I=I.substring(0,I.length-1);const i=p(I,t);if(!0!==i)return g(i.err.code,i.err.msg,m(e,n+i.err.line));c=!0}else if(_){if(!y.tagClosed)return g("InvalidTag","Closing tag '"+v+"' doesn't have proper closing.",m(e,o));if(I.trim().length>0)return g("InvalidTag","Closing tag '"+v+"' can't have attributes or invalid starting.",m(e,f));if(0===n.length)return g("InvalidTag","Closing tag '"+v+"' has not been opened.",m(e,f));{const t=n.pop();if(v!==t.tagName){let n=m(e,t.tagStartPos);return g("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+v+"'.",m(e,f))}0==n.length&&(u=!0)}}else{const i=p(I,t);if(!0!==i)return g(i.err.code,i.err.msg,m(e,o-I.length+i.err.line));if(!0===u)return g("InvalidXml","Multiple possible root nodes found.",m(e,o));-1!==t.unpairedTags.indexOf(v)||n.push({tagName:v,tagStartPos:f}),c=!0}for(o++;o0)||g("InvalidXml","Invalid '"+JSON.stringify(n.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):g("InvalidXml","Start tag expected.",1)};const c='"',u="'";function l(e,t){let n="",i="",o=!1;for(;t"===e[t]&&""===i){o=!0;break}n+=e[t]}return""===i&&{value:n,index:t,tagClosed:o}}const d=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function p(e,t){const n=i.getAllMatches(e,d),o={};for(let i=0;i{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1}},function(e,t){var n=function(e){var t={},n=function(e){return!t[e]&&(t[e]=[]),t[e]};e.on=function(e,t){n(e).push(t)},e.off=function(e,t){for(var i=n(e),o=i.length-1;o>=0;o--)t===i[o]&&i.splice(o,1)},e.emit=function(e,t){for(var i=n(e).map((function(e){return e})),o=0;o=0;n--){var o=i[n][2];(!o||o+2592e3=0;s--){var a=i[s];(a[0]===e&&a[1]===t||e!==a[0]&&0===a[0].indexOf(o))&&i.splice(s,1)}i.unshift([e,t,Math.round(Date.now()/1e3)]),i.length>n&&i.splice(n),u()}},removeUploadId:function(e){c(),delete l.using[e];for(var t=i.length-1;t>=0;t--)i[t][1]===e&&i.splice(t,1);u()}};e.exports=l},function(e,t,n){var i=n(9);e.exports=i},function(e,t,n){var i=n(0),o=n(6),s=n(25),a=n(26),r=n(32),c=n(3),u={SecretId:"",SecretKey:"",SecurityToken:"",StartTime:0,ExpiredTime:0,ChunkRetryTimes:2,FileParallelLimit:3,ChunkParallelLimit:3,ChunkSize:1048576,SliceSize:1048576,CopyChunkParallelLimit:20,CopyChunkSize:10485760,CopySliceSize:10485760,MaxPartNumber:1e4,ProgressInterval:1e3,UploadQueueSize:1e4,Domain:"",ServiceDomain:"",Protocol:"",CompatibilityMode:!1,ForcePathStyle:!1,Timeout:0,CorrectClockSkew:!0,SystemClockOffset:0,UploadCheckContentMd5:!1,UploadAddMetaMd5:!1,UploadIdCacheLimit:50,UseAccelerate:!1,ForceSignHost:!0,HttpDNSServiceId:"",SimpleUploadMethod:"postObject",AutoSwitchHost:!1,CopySourceParser:null,ObjectKeySimplifyCheck:!0,DeepTracker:!1,TrackerDelay:5e3,CustomId:"",BeaconReporter:null,ClsReporter:null},l=function(e){if(this.options=i.extend(i.clone(u),e||{}),this.options.FileParallelLimit=Math.max(1,this.options.FileParallelLimit),this.options.ChunkParallelLimit=Math.max(1,this.options.ChunkParallelLimit),this.options.ChunkRetryTimes=Math.max(0,this.options.ChunkRetryTimes),this.options.ChunkSize=Math.max(1048576,this.options.ChunkSize),this.options.CopyChunkParallelLimit=Math.max(1,this.options.CopyChunkParallelLimit),this.options.CopyChunkSize=Math.max(1048576,this.options.CopyChunkSize),this.options.CopySliceSize=Math.max(0,this.options.CopySliceSize),this.options.MaxPartNumber=Math.max(1024,Math.min(1e4,this.options.MaxPartNumber)),this.options.Timeout=Math.max(0,this.options.Timeout),this.options.EnableReporter=this.options.BeaconReporter||this.options.ClsReporter,this.options.AppId,this.options.SecretId&&this.options.SecretId.indexOf(" "),this.options.SecretKey&&this.options.SecretKey.indexOf(" "),this.options.ForcePathStyle)throw new Error("ForcePathStyle is not supported");o.init(this),s.init(this)};a.init(l,s),r.init(l,s),l.util={md5:i.md5,xml2json:i.xml2json,json2xml:i.json2xml,encodeBase64:i.encodeBase64},l.getAuthorization=i.getAuth,l.version=c.version,e.exports=l},function(e,t,n){(function(e){var t;function i(e){return(i="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(){var o="input is invalid type",s="object"===("undefined"==typeof window?"undefined":i(window)),a=s?window:{};a.JS_MD5_NO_WINDOW&&(s=!1),!s&&"object"===("undefined"==typeof self?"undefined":i(self))&&(a=self);var r,c=!a.JS_MD5_NO_COMMON_JS&&"object"===i(e)&&e.exports,u=n(12),l=!a.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),p=[128,32768,8388608,-2147483648],h=[0,8,16,24],g=["hex","array","digest","buffer","arrayBuffer","base64"],f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),m=[];if(l){var _=new ArrayBuffer(68);r=new Uint8Array(_),m=new Uint32Array(_)}!a.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!l||!a.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===i(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});var v=function(e){return function(t){return new y(!0).update(t)[e]()}};function y(e){if(e)m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m,this.buffer8=r;else if(l){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}y.prototype.update=function(e){if(!this.finalized){var t,n=i(e);if("string"!==n){if("object"!==n)throw o;if(null===e)throw o;if(!l||e.constructor!==ArrayBuffer&&"ArrayBuffer"!==e.constructor.name){if(!(Array.isArray(e)||l&&ArrayBuffer.isView(e)))throw o}else e=new Uint8Array(e);t=!0}for(var s,a,r=0,c=e.length,u=this.blocks,d=this.buffer8;r>2]|=e[r]<>6,d[a++]=128|63&s):s<55296||s>=57344?(d[a++]=224|s>>12,d[a++]=128|s>>6&63,d[a++]=128|63&s):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++r)),d[a++]=240|s>>18,d[a++]=128|s>>12&63,d[a++]=128|s>>6&63,d[a++]=128|63&s);else for(a=this.start;r>2]|=s<>2]|=(192|s>>6)<>2]|=(128|63&s)<=57344?(u[a>>2]|=(224|s>>12)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<>2]|=(240|s>>18)<>2]|=(128|s>>12&63)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<=64?(this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},y.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=p[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},y.prototype.hash=function(){var e,t,n,i,o,s,a=this.blocks;this.first?t=((t=((e=((e=a[0]-680876937)<<7|e>>>25)-271733879|0)^(n=((n=(-271733879^(i=((i=(-1732584194^2004318071&e)+a[1]-117830708)<<12|i>>>20)+e|0)&(-271733879^e))+a[2]-1126478375)<<17|n>>>15)+i|0)&(i^e))+a[3]-1316259209)<<22|t>>>10)+n|0:(e=this.h0,t=this.h1,n=this.h2,t=((t+=((e=((e+=((i=this.h3)^t&(n^i))+a[0]-680876936)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[1]-389564586)<<12|i>>>20)+e|0)&(e^t))+a[2]+606105819)<<17|n>>>15)+i|0)&(i^e))+a[3]-1044525330)<<22|t>>>10)+n|0),t=((t+=((e=((e+=(i^t&(n^i))+a[4]-176418897)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[5]+1200080426)<<12|i>>>20)+e|0)&(e^t))+a[6]-1473231341)<<17|n>>>15)+i|0)&(i^e))+a[7]-45705983)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(i^t&(n^i))+a[8]+1770035416)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[9]-1958414417)<<12|i>>>20)+e|0)&(e^t))+a[10]-42063)<<17|n>>>15)+i|0)&(i^e))+a[11]-1990404162)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(i^t&(n^i))+a[12]+1804603682)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[13]-40341101)<<12|i>>>20)+e|0)&(e^t))+a[14]-1502002290)<<17|n>>>15)+i|0)&(i^e))+a[15]+1236535329)<<22|t>>>10)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[1]-165796510)<<5|e>>>27)+t|0)^t))+a[6]-1069501632)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[11]+643717713)<<14|n>>>18)+i|0)^i))+a[0]-373897302)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[5]-701558691)<<5|e>>>27)+t|0)^t))+a[10]+38016083)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[15]-660478335)<<14|n>>>18)+i|0)^i))+a[4]-405537848)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[9]+568446438)<<5|e>>>27)+t|0)^t))+a[14]-1019803690)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[3]-187363961)<<14|n>>>18)+i|0)^i))+a[8]+1163531501)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[13]-1444681467)<<5|e>>>27)+t|0)^t))+a[2]-51403784)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[7]+1735328473)<<14|n>>>18)+i|0)^i))+a[12]-1926607734)<<20|t>>>12)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[5]-378558)<<4|e>>>28)+t|0))+a[8]-2022574463)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[11]+1839030562)<<16|n>>>16)+i|0))+a[14]-35309556)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[1]-1530992060)<<4|e>>>28)+t|0))+a[4]+1272893353)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[7]-155497632)<<16|n>>>16)+i|0))+a[10]-1094730640)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[13]+681279174)<<4|e>>>28)+t|0))+a[0]-358537222)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[3]-722521979)<<16|n>>>16)+i|0))+a[6]+76029189)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[9]-640364487)<<4|e>>>28)+t|0))+a[12]-421815835)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[15]+530742520)<<16|n>>>16)+i|0))+a[2]-995338651)<<23|t>>>9)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[0]-198630844)<<6|e>>>26)+t|0)|~n))+a[7]+1126891415)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[14]-1416354905)<<15|n>>>17)+i|0)|~e))+a[5]-57434055)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[12]+1700485571)<<6|e>>>26)+t|0)|~n))+a[3]-1894986606)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[10]-1051523)<<15|n>>>17)+i|0)|~e))+a[1]-2054922799)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[8]+1873313359)<<6|e>>>26)+t|0)|~n))+a[15]-30611744)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[6]-1560198380)<<15|n>>>17)+i|0)|~e))+a[13]+1309151649)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[4]-145523070)<<6|e>>>26)+t|0)|~n))+a[11]-1120210379)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[2]+718787259)<<15|n>>>17)+i|0)|~e))+a[9]-343485551)<<21|t>>>11)+n|0,this.first?(this.h0=e+1732584193|0,this.h1=t-271733879|0,this.h2=n-1732584194|0,this.h3=i+271733878|0,this.first=!1):(this.h0=this.h0+e|0,this.h1=this.h1+t|0,this.h2=this.h2+n|0,this.h3=this.h3+i|0)},y.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3;return d[e>>4&15]+d[15&e]+d[e>>12&15]+d[e>>8&15]+d[e>>20&15]+d[e>>16&15]+d[e>>28&15]+d[e>>24&15]+d[t>>4&15]+d[15&t]+d[t>>12&15]+d[t>>8&15]+d[t>>20&15]+d[t>>16&15]+d[t>>28&15]+d[t>>24&15]+d[n>>4&15]+d[15&n]+d[n>>12&15]+d[n>>8&15]+d[n>>20&15]+d[n>>16&15]+d[n>>28&15]+d[n>>24&15]+d[i>>4&15]+d[15&i]+d[i>>12&15]+d[i>>8&15]+d[i>>20&15]+d[i>>16&15]+d[i>>28&15]+d[i>>24&15]},y.prototype.toString=y.prototype.hex,y.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&i,i>>8&255,i>>16&255,i>>24&255]},y.prototype.array=y.prototype.digest,y.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},y.prototype.buffer=y.prototype.arrayBuffer,y.prototype.base64=function(){for(var e,t,n,i="",o=this.array(),s=0;s<15;)e=o[s++],t=o[s++],n=o[s++],i+=f[e>>>2]+f[63&(e<<4|t>>>4)]+f[63&(t<<2|n>>>6)]+f[63&n];return e=o[s],i+(f[e>>>2]+f[e<<4&63]+"==")};var I=function(){var e=v("hex");e.getCtx=e.create=function(){return new y},e.update=function(t){return e.create().update(t)};for(var t=0;t>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(i+o)%4*8;else if(65535>>2]=n[o>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],i=0;i>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(n,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],i=0;i>>2]>>>24-i%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(n,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},l=n.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,r=o/(4*a);if(t=(r=t?e.ceil(r):e.max((0|r)-this._minBufferSize,0))*a,o=e.min(4*t,o),t){for(var c=0;cu;u++){if(16>u)s[u]=0|e[t+u];else{var l=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=l<<1|l>>>31}l=(i<<5|i>>>27)+c+s[u],l=20>u?l+(1518500249+(o&a|~o&r)):40>u?l+(1859775393+(o^a^r)):60>u?l+((o&a|o&r|a&r)-1894007588):l+((o^a^r)-899497514),c=r,r=a,a=o<<30|o>>>2,o=i,i=l}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+r|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(i+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),n.SHA1=o._createHelper(a),n.HmacSHA1=o._createHmacHelper(a),l=(u=d).enc.Utf8,u.algo.HMAC=u.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=l.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),a=o.words,r=s.words,c=0;c>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,r=0;r<4&&s+.75*r>>6*(3-r)&63));var c=i.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,n=this._map,i=n.charAt(64);if(i){var o=e.indexOf(i);-1!=o&&(t=o)}for(var s=[],a=0,r=0;r>>6-r%4*2;s[a>>>2]|=(u|l)<<24-a%4*8,a++}return c.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.exports=d},function(e,t){var n,i,o,s,a,r,c,u,l,d,p,h,g,f,m,_,v,y,I,M=(i=(n=n||{}).Base64,s=function(e){for(var t={},n=0,i=e.length;n>>6)+a(128|63&t):a(224|t>>>12&15)+a(128|t>>>6&63)+a(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return a(240|t>>>18&7)+a(128|t>>>12&63)+a(128|t>>>6&63)+a(128|63&t)},c=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,u=function(e){return e.replace(c,r)},l=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[o.charAt(n>>>18),o.charAt(n>>>12&63),t>=2?"=":o.charAt(n>>>6&63),t>=1?"=":o.charAt(63&n)].join("")},d=n.btoa?function(e){return n.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,l)},p=function(e){return d(u(e))},h=function(e,t){return t?p(String(e)).replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,""):p(String(e))},g=new RegExp(["[À-ß][€-¿]","[à-ï][€-¿]{2}","[ð-÷][€-¿]{3}"].join("|"),"g"),f=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return a(55296+(t>>>10))+a(56320+(1023&t));case 3:return a((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return a((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},m=function(e){return e.replace(g,f)},_=function(e){var t=e.length,n=t%4,i=(t>0?s[e.charAt(0)]<<18:0)|(t>1?s[e.charAt(1)]<<12:0)|(t>2?s[e.charAt(2)]<<6:0)|(t>3?s[e.charAt(3)]:0),o=[a(i>>>16),a(i>>>8&255),a(255&i)];return o.length-=[0,0,2,1][n],o.join("")},v=n.atob?function(e){return n.atob(e)}:function(e){return e.replace(/[\s\S]{1,4}/g,_)},y=function(e){return m(v(e))},{VERSION:"2.1.9",atob:v,btoa:d,fromBase64:I=function(e){return y(String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,""))},toBase64:h,utob:u,encode:h,encodeURI:function(e){return h(e,!0)},btou:m,decode:I,noConflict:function(){var e=n.Base64;return n.Base64=i,e}});e.exports=M},function(e,t,n){const i=n(4),o=n(16),s=n(23);e.exports={XMLParser:o,XMLValidator:i,XMLBuilder:s}},function(e,t,n){const{buildOptions:i}=n(17),o=n(18),{prettify:s}=n(22),a=n(4);e.exports=class{constructor(e){this.externalEntities={},this.options=i(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const n=a.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new o(this.options);n.addExternalEntities(this.externalEntities);const i=n.parseXml(e);return this.options.preserveOrder||void 0===i?i:s(i,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}}},function(e,t){const n={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}};t.buildOptions=function(e){return Object.assign({},n,e)},t.defaultOptions=n},function(e,t,n){const i=n(1),o=n(19),s=n(20),a=n(21),r=n(5);function c(e){const t=Object.keys(e);for(let n=0;n0)){a||(e=this.replaceEntitiesValue(e));const i=this.options.tagValueProcessor(t,e,n,o,s);return null==i?e:typeof i!=typeof e||i!==e?i:this.options.trimValues||e.trim()===e?M(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function l(e){if(this.options.removeNSPrefix){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}const d=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function p(e,t,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){const n=i.getAllMatches(e,d),o=n.length,s={};for(let e=0;e",r,"Closing Tag is not closed.");let o=e.substring(r+2,t).trim();if(this.options.removeNSPrefix){const e=o.indexOf(":");-1!==e&&(o=o.substr(e+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),n&&(i=this.saveTextToParentTag(i,n,a));const s=a.substring(a.lastIndexOf(".")+1);if(o&&-1!==this.options.unpairedTags.indexOf(o))throw new Error(`Unpaired tag can not be used as closing tag: `);let c=0;s&&-1!==this.options.unpairedTags.indexOf(s)?(c=a.lastIndexOf(".",a.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=a.lastIndexOf("."),a=a.substring(0,c),n=this.tagsNodeStack.pop(),i="",r=t}else if("?"===e[r+1]){let t=y(e,r,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,n,a),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new o(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,a,t.tagName)),this.addChild(n,e,a)}r=t.closeIndex+1}else if("!--"===e.substr(r+1,3)){const t=v(e,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=e.substring(r+4,t-2);i=this.saveTextToParentTag(i,n,a),n.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=t}else if("!D"===e.substr(r+1,2)){const t=s(e,r);this.docTypeEntities=t.entities,r=t.i}else if("!["===e.substr(r+1,2)){const t=v(e,"]]>",r,"CDATA is not closed.")-2,o=e.substring(r+9,t);i=this.saveTextToParentTag(i,n,a);let s=this.parseTextData(o,n.tagname,a,!0,!1,!0,!0);null==s&&(s=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):n.add(this.options.textNodeName,s),r=t+2}else{let s=y(e,r,this.options.removeNSPrefix),c=s.tagName;const u=s.rawTagName;let l=s.tagExp,d=s.attrExpPresent,p=s.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&i&&"!xml"!==n.tagname&&(i=this.saveTextToParentTag(i,n,a,!1));const h=n;if(h&&-1!==this.options.unpairedTags.indexOf(h.tagname)&&(n=this.tagsNodeStack.pop(),a=a.substring(0,a.lastIndexOf("."))),c!==t.tagname&&(a+=a?"."+c:c),this.isItStopNode(this.options.stopNodes,a,c)){let t="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===c[c.length-1]?(c=c.substr(0,c.length-1),a=a.substr(0,a.length-1),l=c):l=l.substr(0,l.length-1),r=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(c))r=s.closeIndex;else{const n=this.readStopNodeData(e,u,p+1);if(!n)throw new Error(`Unexpected end of ${u}`);r=n.i,t=n.tagContent}const i=new o(c);c!==l&&d&&(i[":@"]=this.buildAttributesMap(l,a,c)),t&&(t=this.parseTextData(t,c,a,!0,d,!0,!0)),a=a.substr(0,a.lastIndexOf(".")),i.add(this.options.textNodeName,t),this.addChild(n,i,a)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===c[c.length-1]?(c=c.substr(0,c.length-1),a=a.substr(0,a.length-1),l=c):l=l.substr(0,l.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const e=new o(c);c!==l&&d&&(e[":@"]=this.buildAttributesMap(l,a,c)),this.addChild(n,e,a),a=a.substr(0,a.lastIndexOf("."))}else{const e=new o(c);this.tagsNodeStack.push(n),c!==l&&d&&(e[":@"]=this.buildAttributesMap(l,a,c)),this.addChild(n,e,a),n=e}i="",r=p}}else i+=e[r];return t.child};function g(e,t,n){const i=this.options.updateTag(t.tagname,n,t[":@"]);!1===i||("string"==typeof i?(t.tagname=i,e.addChild(t)):e.addChild(t))}const f=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function m(e,t,n,i){return e&&(void 0===i&&(i=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,n,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,i))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function _(e,t,n){const i="*."+n;for(const o in e){const n=e[o];if(i===n||t===n)return!0}return!1}function v(e,t,n,i){const o=e.indexOf(t,n);if(-1===o)throw new Error(i);return o+t.length-1}function y(e,t,n,i=">"){const o=function(e,t,n=">"){let i,o="";for(let s=t;s",n,`${t} is not closed`);if(e.substring(n+2,s).trim()===t&&(o--,0===o))return{tagContent:e.substring(i,n),i:s};n=s}else if("?"===e[n+1])n=v(e,"?>",n+1,"StopNode is not closed.");else if("!--"===e.substr(n+1,3))n=v(e,"--\x3e",n+3,"StopNode is not closed.");else if("!["===e.substr(n+1,2))n=v(e,"]]>",n,"StopNode is not closed.")-2;else{const i=y(e,n,">");i&&((i&&i.tagName)===t&&"/"!==i.tagExp[i.tagExp.length-1]&&o++,n=i.closeIndex)}}function M(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&a(e,n)}return i.isExist(e)?e:""}e.exports=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=c,this.parseXml=h,this.parseTextData=u,this.resolveNameSpace=l,this.buildAttributesMap=p,this.isItStopNode=_,this.replaceEntitiesValue=f,this.readStopNodeData=I,this.saveTextToParentTag=m,this.addChild=g,this.ignoreAttributesFn=r(this.options.ignoreAttributes)}}},function(e,t,n){e.exports=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}},function(e,t,n){const i=n(1);function o(e,t){let n="";for(;t"===e[t]){if(p?"-"===e[t-1]&&"-"===e[t-2]&&(p=!1,i--):i--,0===i)break}else"["===e[t]?d=!0:h+=e[t];else{if(d&&a(e,t))t+=7,[entityName,val,t]=o(e,t+1),-1===val.indexOf("&")&&(n[l(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(d&&r(e,t))t+=8;else if(d&&c(e,t))t+=8;else if(d&&u(e,t))t+=9;else{if(!s)throw new Error("Invalid DOCTYPE");p=!0}i++,h=""}if(0!==i)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}}},function(e,t){const n=/^[-+]?0x[a-fA-F0-9]+$/,i=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const o={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};e.exports=function(e,t={}){if(t=Object.assign({},o,t),!e||"string"!=typeof e)return e;let s=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(s))return e;if(t.hex&&n.test(s))return Number.parseInt(s,16);{const n=i.exec(s);if(n){const i=n[1],o=n[2];let r=(a=n[3])&&-1!==a.indexOf(".")?("."===(a=a.replace(/0+$/,""))?a="0":"."===a[0]?a="0"+a:"."===a[a.length-1]&&(a=a.substr(0,a.length-1)),a):a;const c=n[4]||n[6];if(!t.leadingZeros&&o.length>0&&i&&"."!==s[2])return e;if(!t.leadingZeros&&o.length>0&&!i&&"."!==s[1])return e;{const n=Number(s),a=""+n;return-1!==a.search(/[eE]/)||c?t.eNotation?n:e:-1!==s.indexOf(".")?"0"===a&&""===r||a===r||i&&a==="-"+r?n:e:o?r===a||i+r===a?n:e:s===a||s===i+a?n:e}}return e}var a}},function(e,t,n){function i(e,t,n){let r;const c={};for(let u=0;u0&&(c[t.textNodeName]=r):void 0!==r&&(c[t.textNodeName]=r),c}function o(e){const t=Object.keys(e);for(let n=0;n","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function a(e){this.options=Object.assign({},s,e),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=o(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=u),this.processTextOrObjNode=r,this.options.format?(this.indentate=c,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function r(e,t,n,i){const o=this.j2x(e,n+1,i.concat(t));return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}function c(e){return this.options.indentBy.repeat(e)}function u(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}a.prototype.build=function(e){return this.options.preserveOrder?i(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},a.prototype.j2x=function(e,t,n){let i="",o="";const s=n.join(".");for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(void 0===e[a])this.isAttribute(a)&&(o+="");else if(null===e[a])this.isAttribute(a)?o+="":"?"===a[0]?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)o+=this.buildTextValNode(e[a],a,"",t);else if("object"!=typeof e[a]){const n=this.isAttribute(a);if(n&&!this.ignoreAttributesFn(n,s))i+=this.buildAttrPairStr(n,""+e[a]);else if(!n)if(a===this.options.textNodeName){let t=this.options.tagValueProcessor(a,""+e[a]);o+=this.replaceEntitiesValue(t)}else o+=this.buildTextValNode(e[a],a,"",t)}else if(Array.isArray(e[a])){const i=e[a].length;let s="",r="";for(let c=0;c"+e+o}},a.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(i)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(i)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),""===o?this.indentate(i)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(i)+"<"+t+n+">"+o+"0&&this.options.processEntities)for(let t=0;t`,l=!1;continue}if(h===t.commentPropName){u+=c+`\x3c!--${p[h][0][t.textNodeName]}--\x3e`,l=!0;continue}if("?"===h[0]){const e=o(p[":@"],t),n="?xml"===h?"":c;let i=p[h][0][t.textNodeName];i=0!==i.length?" "+i:"",u+=n+`<${h}${i}${e}?>`,l=!0;continue}let f=c;""!==f&&(f+=t.indentBy);const m=c+`<${h}${o(p[":@"],t)}`,_=n(p[h],t,g,f);-1!==t.unpairedTags.indexOf(h)?t.suppressUnpairedNode?u+=m+">":u+=m+"/>":_&&0!==_.length||!t.suppressEmptyNode?_&&_.endsWith(">")?u+=m+`>${_}${c}`:(u+=m+">",_&&""!==c&&(_.includes("/>")||_.includes("`):u+=m+"/>",l=!0}return u}function i(e){const t=Object.keys(e);for(let n=0;n0&&t.processEntities)for(let n=0;n0&&(i="\n"),n(e,t,"",i)}},function(e,t,n){var i=n(7),o=n(0),s={};e.exports.transferToTaskMethod=function(e,t){s[t]=e[t],e[t]=function(e,n){e.SkipTask?s[t].call(this,e,n):this._addTask(t,e,n)}},e.exports.init=function(e){var t,n,a=[],r={},c=0,u=0,l=function(e){var t={id:e.id,Bucket:e.Bucket,Region:e.Region,Key:e.Key,FilePath:e.FilePath,state:e.state,loaded:e.loaded,size:e.size,speed:e.speed,percent:e.percent,hashPercent:e.hashPercent,error:e.error};return e.FilePath&&(t.FilePath=e.FilePath),t},d=(n=function(){t=0,e.emit("task-list-update",{list:o.map(a,l)}),e.emit("list-update",{list:o.map(a,l)})},function(){t||(t=setTimeout(n))}),p=function(){if(!(a.length<=e.options.UploadQueueSize)){for(var t=0;te.options.UploadQueueSize;){var n="waiting"===a[t].state||"checking"===a[t].state||"uploading"===a[t].state;a[t]&&n?t++:(r[a[t].id]&&delete r[a[t].id],a.splice(t,1),u--)}d()}},h=function t(){if(!(c>=e.options.FileParallelLimit)){for(;a[u]&&"waiting"!==a[u].state;)u++;if(!(u>=a.length)){var n=a[u];u++,c++,n.state="checking",n.params.onTaskStart&&n.params.onTaskStart(l(n)),!n.params.UploadData&&(n.params.UploadData={});var i=o.formatParams(n.api,n.params);s[n.api].call(e,i,(function(i,o){e._isRunningTask(n.id)&&("checking"!==n.state&&"uploading"!==n.state||(n.state=i?"error":"success",i&&(n.error=i),c--,d(),t(),n.callback&&n.callback(i,o),"success"===n.state&&(n.params&&(delete n.params.UploadData,delete n.params.Body,delete n.params),delete n.callback)),p())})),d(),setTimeout(t)}}},g=function(t,n){var o=r[t];if(o){var s=o&&"waiting"===o.state,a=o&&("checking"===o.state||"uploading"===o.state);if("canceled"===n&&"canceled"!==o.state||"paused"===n&&s||"paused"===n&&a){if("paused"===n&&o.params.Body&&"function"==typeof o.params.Body.pipe)return;o.state=n,e.emit("inner-kill-task",{TaskId:t,toState:n});try{var u=o&&o.params&&o.params.UploadData.UploadId}catch(l){}"canceled"===n&&u&&i.removeUsing(u),d(),a&&(c--,h()),"canceled"===n&&(o.params&&(delete o.params.UploadData,delete o.params.Body,delete o.params),delete o.callback)}p()}};e._addTasks=function(t){o.each(t,(function(t){e._addTask(t.api,t.params,t.callback,!0)})),d()},e._addTask=function(t,n,i,s){var c="postObject"===e.options.SimpleUploadMethod?"postObject":"putObject";"sliceUploadFile"!==t||o.canFileSlice()||(t=c),n=o.formatParams(t,n);var u=o.uuid();n.TaskId=u,n.onTaskReady&&n.onTaskReady(u);var l={params:n,callback:i,api:t,index:a.length,id:u,Bucket:n.Bucket,Region:n.Region,Key:n.Key,FilePath:n.FilePath||"",state:"waiting",loaded:0,size:0,speed:0,percent:0,hashPercent:0,error:null},g=n.onHashProgress;n.onHashProgress=function(t){e._isRunningTask(l.id)&&(l.hashPercent=t.percent,g&&g(t),d())};var f=n.onProgress;return n.onProgress=function(t){e._isRunningTask(l.id)&&("checking"===l.state&&(l.state="uploading"),l.loaded=t.loaded,l.size=t.total,l.speed=t.speed,l.percent=t.percent,f&&f(t),d())},o.getFileSize(t,n,(function(e,t){e?i(e):(r[u]=l,a.push(l),l.size=t,!s&&d(),h(),p())})),u},e._isRunningTask=function(e){var t=r[e];return!(!t||"checking"!==t.state&&"uploading"!==t.state)},e.getTaskList=function(){return o.map(a,l)},e.cancelTask=function(e){g(e,"canceled")},e.pauseTask=function(e){g(e,"paused")},e.restartTask=function(e){var t=r[e];!t||"paused"!==t.state&&"error"!==t.state||(t.state="waiting",d(),u=Math.min(u,t.index),h())},e.isUploadRunning=function(){return c||u-1?"{Region}.myqcloud.com":"cos.{Region}.myqcloud.com",e.ForcePathStyle||(s="{Bucket}."+s)),s=(s=s.replace(/\{\{AppId\}\}/gi,i).replace(/\{\{Bucket\}\}/gi,n).replace(/\{\{Region\}\}/gi,a).replace(/\{\{.*?\}\}/gi,"")).replace(/\{AppId\}/gi,i).replace(/\{BucketName\}/gi,n).replace(/\{Bucket\}/gi,t).replace(/\{Region\}/gi,a).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(s)||(s="https://"+s),"/"===s.slice(-1)&&(s=s.slice(0,-1));var c=s;return e.ForcePathStyle&&(c+="/"+t),c+="/",r&&(c+=o.camSafeUrlEncode(r).replace(/%2F/g,"/")),e.isLocation&&(c=c.replace(/^https?:\/\//,"")),c}var u=function(e){if(!e.Bucket||!e.Region)return"";var t=void 0===e.UseAccelerate?this.options.UseAccelerate:e.UseAccelerate;return(e.Url||c({ForcePathStyle:this.options.ForcePathStyle,protocol:this.options.Protocol,domain:this.options.Domain,bucket:e.Bucket,region:t?"accelerate":e.Region})).replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1")};function l(e,t){var n=o.clone(e.Headers),i="";o.each(n,(function(e,t){(""===e||["content-type","cache-control"].indexOf(t.toLowerCase())>-1)&&delete n[t],"host"===t.toLowerCase()&&(i=e)}));var s=!1!==e.ForceSignHost;!i&&e.SignHost&&s&&(n.Host=e.SignHost);var a=!1,r=function(e,n){a||(a=!0,n&&n.XCosSecurityToken&&!n.SecurityToken&&((n=o.clone(n)).SecurityToken=n.XCosSecurityToken,delete n.XCosSecurityToken),t&&t(e,n))},c=this,u=e.Bucket||"",l=e.Region||"",d="name/cos:PostObject"!==e.Action&&e.Key?e.Key:"";c.options.ForcePathStyle&&u&&(d=u+"/"+d);var p="/"+d,h={},g=e.Scope;if(!g){var f=e.Action||"",m=e.ResourceKey||e.Key||"";g=e.Scope||[{action:f,bucket:u,region:l,prefix:m}]}var _=o.md5(JSON.stringify(g));c._StsCache=c._StsCache||[],function(){var e,t;for(e=c._StsCache.length-1;e>=0;e--){t=c._StsCache[e];var n=Math.round(o.getSkewTime(c.options.SystemClockOffset)/1e3)+30;if(t.StartTime&&n=t.ExpiredTime)c._StsCache.splice(e,1);else if(!t.ScopeLimit||t.ScopeLimit&&t.ScopeKey===_){h=t;break}}}();var v=function(){var t="";h.StartTime&&e.Expires?t=h.StartTime+";"+(h.StartTime+1*e.Expires):h.StartTime&&h.ExpiredTime&&(t=h.StartTime+";"+h.ExpiredTime);var i={Authorization:o.getAuth({SecretId:h.TmpSecretId,SecretKey:h.TmpSecretKey,Method:e.Method,Pathname:p,Query:e.Query,Headers:n,Expires:e.Expires,SystemClockOffset:c.options.SystemClockOffset,KeyTime:t,ForceSignHost:s}),SecurityToken:h.SecurityToken||h.XCosSecurityToken||"",Token:h.Token||"",ClientIP:h.ClientIP||"",ClientUA:h.ClientUA||"",SignFrom:"client"};r(null,i)},y=function(e){if(e.Authorization){var t=!1,n=e.Authorization;if(n)if(n.indexOf(" ")>-1)t=!1;else if(n.indexOf("q-sign-algorithm=")>-1&&n.indexOf("q-ak=")>-1&&n.indexOf("q-sign-time=")>-1&&n.indexOf("q-key-time=")>-1&&n.indexOf("q-url-param-list=")>-1)t=!0;else try{(n=atob(n)).indexOf("a=")>-1&&n.indexOf("k=")>-1&&n.indexOf("t=")>-1&&n.indexOf("r=")>-1&&n.indexOf("b=")>-1&&(t=!0)}catch(i){}if(!t)return o.error(new Error("getAuthorization callback params format error"))}else{if(!e.TmpSecretId)return o.error(new Error('getAuthorization callback params missing "TmpSecretId"'));if(!e.TmpSecretKey)return o.error(new Error('getAuthorization callback params missing "TmpSecretKey"'));if(!e.SecurityToken&&!e.XCosSecurityToken)return o.error(new Error('getAuthorization callback params missing "SecurityToken"'));if(!e.ExpiredTime)return o.error(new Error('getAuthorization callback params missing "ExpiredTime"'));if(e.ExpiredTime&&10!==e.ExpiredTime.toString().length)return o.error(new Error('getAuthorization callback params "ExpiredTime" should be 10 digits'));if(e.StartTime&&10!==e.StartTime.toString().length)return o.error(new Error('getAuthorization callback params "StartTime" should be 10 StartTime'))}return!1};if(h.ExpiredTime&&h.ExpiredTime-o.getSkewTime(c.options.SystemClockOffset)/1e3>60)v();else if(c.options.getAuthorization)c.options.getAuthorization.call(c,{Bucket:u,Region:l,Method:e.Method,Key:d,Pathname:p,Query:e.Query,Headers:n,Scope:g,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:s},(function(e){"string"==typeof e&&(e={Authorization:e});var t=y(e);if(t)return r(t);e.Authorization?r(null,e):((h=e||{}).Scope=g,h.ScopeKey=_,c._StsCache.push(h),v())}));else{if(!c.options.getSTS)return function(){var t="";if(c.options.StartTime&&e.Expires){if(10!==c.options.StartTime.toString().length)return r(o.error(new Error('params "StartTime" should be 10 digits')));t=c.options.StartTime+";"+(c.options.StartTime+1*e.Expires)}else if(c.options.StartTime&&c.options.ExpiredTime){if(10!==c.options.StartTime.toString().length)return r(o.error(new Error('params "StartTime" should be 10 digits')));if(10!==c.options.ExpiredTime.toString().length)return r(o.error(new Error('params "ExpiredTime" should be 10 digits')));t=c.options.StartTime+";"+1*c.options.ExpiredTime}var i={Authorization:o.getAuth({SecretId:e.SecretId||c.options.SecretId,SecretKey:e.SecretKey||c.options.SecretKey,Method:e.Method,Pathname:p,Query:e.Query,Headers:n,Expires:e.Expires,KeyTime:t,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:s}),SecurityToken:c.options.SecurityToken||c.options.XCosSecurityToken,SignFrom:"client"};return r(null,i),i}();c.options.getSTS.call(c,{Bucket:u,Region:l},(function(e){(h=e||{}).Scope=g,h.ScopeKey=_,h.TmpSecretId||(h.TmpSecretId=h.SecretId),h.TmpSecretKey||(h.TmpSecretKey=h.SecretKey);var t=y(h);if(t)return r(t);c._StsCache.push(h),v()}))}return""}function d(e){var t=this,n=!1,i=!1,s=!1,a=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var r=e.error.Code,c=e.error.Message;("RequestTimeTooSkewed"===r||"AccessDenied"===r&&"Request has expired"===c)&&(s=!0)}catch(p){}if(e){if(s&&a){var u=Date.parse(a);this.options.CorrectClockSkew&&Math.abs(o.getSkewTime(this.options.SystemClockOffset)-u)>=3e4&&(this.options.SystemClockOffset=u-Date.now(),n=!0)}else{if(5===Math.floor(e.statusCode/100))return{canRetry:!0,networkError:!1};if("timeout"===e.message)return{canRetry:!0,networkError:t.options.AutoSwitchHost}}if(e.statusCode){var l=Math.floor(e.statusCode/100),d=(null==e?void 0:e.headers)&&(null==e?void 0:e.headers["x-cos-request-id"]);[3,4,5].includes(l)&&!d&&(n=t.options.AutoSwitchHost,i=!0)}else n=!0,i=t.options.AutoSwitchHost}return{canRetry:n,networkError:i}}function p(e){var t=e.requestUrl,n=e.clientCalcSign,i=e.networkError;return!!this.options.AutoSwitchHost&&!!t&&!!n&&!!i&&/^https?:\/\/[^\/]*\.cos\.[^\/]*\.myqcloud\.com(\/.*)?$/.test(t)&&!/^https?:\/\/[^\/]*\.cos\.accelerate\.myqcloud\.com(\/.*)?$/.test(t)}function h(e,t){var n=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=o.clearKey(e.qs),e.headers&&(e.headers=o.clearKey(e.headers)),e.qs&&(e.qs=o.clearKey(e.qs));var i=o.clone(e.qs);e.action&&(i[e.action]="");var s=e.url||e.Url,a=e.SignHost||u.call(this,{Bucket:e.Bucket,Region:e.Region,Url:s}),r=e.tracker;!function o(s){var c=n.options.SystemClockOffset;e.SwitchHost&&(a=a.replace(/myqcloud.com/,"tencentcos.cn")),r&&r.setParams({signStartTime:(new Date).getTime(),httpRetryTimes:s-1}),l.call(n,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:i,Headers:e.headers,SignHost:a,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope,ForceSignHost:n.options.ForceSignHost},(function(i,a){i?t(i):(r&&r.setParams({signEndTime:(new Date).getTime(),httpStartTime:(new Date).getTime()}),e.AuthData=a,g.call(n,e,(function(i,u){var l=!1,h=!1;if(i){var g=d.call(n,i);l=g.canRetry||c!==n.options.SystemClockOffset,h=g.networkError}if(r&&r.setParams({httpEndTime:(new Date).getTime()}),i&&s<4&&l){e.headers&&(delete e.headers.Authorization,delete e.headers.token,delete e.headers.clientIP,delete e.headers.clientUA,e.headers["x-cos-security-token"]&&delete e.headers["x-cos-security-token"],e.headers["x-ci-security-token"]&&delete e.headers["x-ci-security-token"]);var f=p.call(n,{requestUrl:(null==i?void 0:i.url)||"",clientCalcSign:"client"===(null==a?void 0:a.SignFrom),networkError:h});e.SwitchHost=f,e.headers["x-cos-sdk-retry"]="true",o(s+1)}else t(i,u)})))}))}(1)}function g(e,t){var n=this,s=e.TaskId;if(!s||n._isRunningTask(s)){var a=e.Bucket,r=e.Region,u=e.Key,l=e.method||"GET",d=e.url||e.Url,p=e.body,h=e.json,g=e.rawBody,f=e.dataType,m=n.options.HttpDNSServiceId;n.options.UseAccelerate&&(r="accelerate"),d=d||c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:a,region:r,object:u}),e.SwitchHost&&(d=d.replace(/myqcloud.com/,"tencentcos.cn"));var _=u?d:"";e.action&&(d=d+"?"+e.action),e.qsStr&&(d=d.indexOf("?")>-1?d+"&"+e.qsStr:d+"?"+e.qsStr);var v={method:l,url:d,headers:e.headers,qs:e.qs,filePath:e.filePath,body:p,json:h,httpDNSServiceId:m,dataType:f},y="x-cos-security-token";o.isCIHost(d)&&(y="x-ci-security-token"),v.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(v.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(v.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(v.headers.clientUA=e.AuthData.ClientUA),e.AuthData.SecurityToken&&(v.headers[y]=e.AuthData.SecurityToken),v.headers&&(v.headers=o.clearKey(v.headers)),v=o.clearKey(v),e.onProgress&&"function"==typeof e.onProgress&&(v.onProgress=function(t){if(!s||n._isRunningTask(s)){var i=t?t.loaded:0;e.onProgress({loaded:i,total:t.total})}}),this.options.Timeout&&(v.timeout=this.options.Timeout),n.options.ForcePathStyle&&(v.pathStyle=n.options.ForcePathStyle),n.emit("before-send",v);var I,M=v.url.includes("accelerate."),C=v.qs?Object.keys(v.qs).map((function(e){return"".concat(e,"=").concat(v.qs[e])})).join("&"):"",S=C?v.url+"?"+C:v.url;e.tracker&&(e.tracker.setParams({url:S,httpMethod:v.method,accelerate:M,httpSize:(null===(I=v.body)||void 0===I?void 0:I.size)||0}),e.tracker.parent&&!e.tracker.parent.params.url&&e.tracker.parent.setParams({url:_,accelerate:M}));var E=i(v,(function(e,i,a){if("abort"!==e){var r,c=function(e,a){if(s&&n.off("inner-kill-task",T),!r){r=!0;var c={};i&&i.statusCode&&(c.statusCode=i.statusCode),i&&i.headers&&(c.headers=i.headers),e?(v.url&&(c.url=v.url),v.method&&(c.method=v.method),e=o.extend(e||{},c),t(e,null)):(a=o.extend(a||{},c),t(null,a)),E=null}};if(e)c({error:e});else{var u=i.statusCode,l=2===Math.floor(u/100);if(g){if(l)return c(null,{body:a});if(a instanceof ArrayBuffer){var d=o.arrayBufferToString(a),p=o.parseResBody(d);return c({error:p.Error||p})}}var h=o.parseResBody(a);l?h.Error?c({error:h.Error}):c(null,h):c({error:h.Error||h})}}})),T=function e(t){t.TaskId===s&&(E&&E.abort&&E.abort(),n.off("inner-kill-task",e))};s&&n.on("inner-kill-task",T)}}var f={getService:function(e,t){"function"==typeof e&&(t=e,e={});var n="https:",i=this.options.ServiceDomain,s=e.Region;i?(i=i.replace(/\{\{Region\}\}/gi,s||"").replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(i)||(i=n+"//"+i),"/"===i.slice(-1)&&(i=i.slice(0,-1))):i=s?n+"//cos."+s+".myqcloud.com":n+"//service.cos.myqcloud.com",i.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1"),h.call(this,{Action:"name/cos:GetService",url:i,method:"GET",headers:e.Headers,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Buckets&&n.ListAllMyBucketsResult.Buckets.Bucket||[];i=o.isArray(i)?i:[i];var s=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Owner||{};t(null,{Buckets:i,Owner:s,statusCode:n.statusCode,headers:n.headers})}))},putBucket:function(e,t){var n=this,i="";if(e.BucketAZConfig){var s={BucketAZConfig:e.BucketAZConfig};i=o.json2xml({CreateBucketConfiguration:s})}h.call(this,{Action:"name/cos:PutBucket",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,body:i,tracker:e.tracker},(function(i,o){if(i)return t(i);var s=c({protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,isLocation:!0});t(null,{Location:s,statusCode:o.statusCode,headers:o.headers})}))},headBucket:function(e,t){h.call(this,{Action:"name/cos:HeadBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"HEAD",tracker:e.tracker},(function(e,n){t(e,n)}))},getBucket:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n.marker=e.Marker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,h.call(this,{Action:"name/cos:GetBucket",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListBucketResult||{},s=i.Contents||[],a=i.CommonPrefixes||[];s=o.isArray(s)?s:[s],a=o.isArray(a)?a:[a];var r=o.clone(i);o.extend(r,{Contents:s,CommonPrefixes:a,statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},deleteBucket:function(e,t){h.call(this,{Action:"name/cos:DeleteBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"DELETE",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketAcl:function(e,t){var n=e.Headers,i="";if(e.AccessControlPolicy){var s=o.clone(e.AccessControlPolicy||{}),a=s.Grants||s.Grant;a=o.isArray(a)?a:[a],delete s.Grant,delete s.Grants,s.AccessControlList={Grant:a},i=o.json2xml({AccessControlPolicy:s}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(i))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=r(n[t]))})),h.call(this,{Action:"name/cos:PutBucketACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:n,action:"acl",body:i,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketAcl:function(e,t){h.call(this,{Action:"name/cos:GetBucketACL",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"acl",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.AccessControlPolicy||{},s=i.Owner||{},r=i.AccessControlList.Grant||[];r=o.isArray(r)?r:[r];var c=a(i);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:s,Grants:r,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putBucketCors:function(e,t){var n=(e.CORSConfiguration||{}).CORSRules||e.CORSRules||[];n=o.clone(o.isArray(n)?n:[n]),o.each(n,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",i=e[n]||e[t]||[];delete e[n],e[t]=o.isArray(i)?i:[i]}))}));var i={CORSRule:n};e.ResponseVary&&(i.ResponseVary=e.ResponseVary);var s=o.json2xml({CORSConfiguration:i}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketCORS",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"cors",headers:a,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketCors:function(e,t){h.call(this,{Action:"name/cos:GetBucketCORS",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchCORSConfiguration"===e.error.Code){var i={CORSRules:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.CORSConfiguration||{},a=s.CORSRules||s.CORSRule||[];a=o.clone(o.isArray(a)?a:[a]);var r=s.ResponseVary;o.each(a,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",i=e[n]||e[t]||[];delete e[t],e[n]=o.isArray(i)?i:[i]}))})),t(null,{CORSRules:a,ResponseVary:r,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketCors:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketCORS",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})}))},getBucketLocation:function(e,t){h.call(this,{Action:"name/cos:GetBucketLocation",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"location",tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,n)}))},getBucketPolicy:function(e,t){h.call(this,{Action:"name/cos:GetBucketPolicy",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",rawBody:!0,tracker:e.tracker},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t({ErrorStatus:"Access Denied"}):e.statusCode&&405===e.statusCode?t({ErrorStatus:"Method Not Allowed"}):e.statusCode&&404===e.statusCode?t({ErrorStatus:"Policy Not Found"}):t(e);var i={};try{i=JSON.parse(n.body)}catch(o){}t(null,{Policy:i,statusCode:n.statusCode,headers:n.headers})}))},putBucketPolicy:function(e,t){var n=e.Policy,i=n;try{"string"==typeof n?n=JSON.parse(i):i=JSON.stringify(n)}catch(a){t({error:"Policy format error"})}var s=e.Headers;s["Content-Type"]="application/json",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketPolicy",method:"PUT",Bucket:e.Bucket,Region:e.Region,action:"policy",body:i,headers:s,json:!0,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},deleteBucketPolicy:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketPolicy",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode||e.statusCode,headers:n.headers})}))},putBucketTagging:function(e,t){var n=e.Tagging||{},i=n.TagSet||n.Tags||e.Tags||[];i=o.clone(o.isArray(i)?i:[i]);var s=o.json2xml({Tagging:{TagSet:{Tag:i}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketTagging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"tagging",headers:a,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketTagging:function(e,t){h.call(this,{Action:"name/cos:GetBucketTagging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var i={Tags:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else{var s=[];try{s=n.Tagging.TagSet.Tag||[]}catch(a){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Tags:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketTagging:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLifecycle:function(e,t){var n=(e.LifecycleConfiguration||{}).Rules||e.Rules||[];n=o.clone(n);var i=o.json2xml({LifecycleConfiguration:{Rule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketLifecycle",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"lifecycle",headers:s,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketLifecycle:function(e,t){h.call(this,{Action:"name/cos:GetBucketLifecycle",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchLifecycleConfiguration"===e.error.Code){var i={Rules:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=[];try{s=n.LifecycleConfiguration.Rule||[]}catch(a){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Rules:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketLifecycle:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketLifecycle",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketVersioning:function(e,t){if(e.VersioningConfiguration){var n=e.VersioningConfiguration||{},i=o.json2xml({VersioningConfiguration:n}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketVersioning",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"versioning",headers:s,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t({error:"missing param VersioningConfiguration"})},getBucketVersioning:function(e,t){h.call(this,{Action:"name/cos:GetBucketVersioning",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"versioning",tracker:e.tracker},(function(e,n){e||!n.VersioningConfiguration&&(n.VersioningConfiguration={}),t(e,n)}))},putBucketReplication:function(e,t){var n=o.clone(e.ReplicationConfiguration),i=o.json2xml({ReplicationConfiguration:n});i=(i=i.replace(/<(\/?)Rules>/gi,"<$1Rule>")).replace(/<(\/?)Tags>/gi,"<$1Tag>");var s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"replication",headers:s,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketReplication:function(e,t){h.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication",tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"ReplicationConfigurationnotFoundError"!==e.error.Code)t(e);else{var i={ReplicationConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else e||!n.ReplicationConfiguration&&(n.ReplicationConfiguration={}),n.ReplicationConfiguration.Rule&&(n.ReplicationConfiguration.Rules=n.ReplicationConfiguration.Rule,delete n.ReplicationConfiguration.Rule),t(e,n)}))},deleteBucketReplication:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketWebsite:function(e,t){if(e.WebsiteConfiguration){var n=o.clone(e.WebsiteConfiguration||{}),i=n.RoutingRules||n.RoutingRule||[];i=o.isArray(i)?i:[i],delete n.RoutingRule,delete n.RoutingRules,i.length&&(n.RoutingRules={RoutingRule:i});var s=o.json2xml({WebsiteConfiguration:n}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketWebsite",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"website",headers:a,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t({error:"missing param WebsiteConfiguration"})},getBucketWebsite:function(e,t){h.call(this,{Action:"name/cos:GetBucketWebsite",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"website",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchWebsiteConfiguration"===e.error.Code){var i={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.WebsiteConfiguration||{};if(s.RoutingRules){var a=o.clone(s.RoutingRules.RoutingRule||[]);a=o.makeArray(a),s.RoutingRules=a}t(null,{WebsiteConfiguration:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketWebsite:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketWebsite",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"website",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketReferer:function(e,t){if(e.RefererConfiguration){var n=o.clone(e.RefererConfiguration||{}),i=n.DomainList||{},s=i.Domains||i.Domain||[];(s=o.isArray(s)?s:[s]).length&&(n.DomainList={Domain:s});var a=o.json2xml({RefererConfiguration:n}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(a)),h.call(this,{Action:"name/cos:PutBucketReferer",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"referer",headers:r,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t({error:"missing param RefererConfiguration"})},getBucketReferer:function(e,t){h.call(this,{Action:"name/cos:GetBucketReferer",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"referer",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchRefererConfiguration"===e.error.Code){var i={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.RefererConfiguration||{};if(s.DomainList){var a=o.makeArray(s.DomainList.Domain||[]);s.DomainList={Domains:a}}t(null,{RefererConfiguration:s,statusCode:n.statusCode,headers:n.headers})}}))},putBucketDomain:function(e,t){var n=(e.DomainConfiguration||{}).DomainRule||e.DomainRule||[];n=o.clone(n);var i=o.json2xml({DomainConfiguration:{DomainRule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketDomain",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"domain",headers:s,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketDomain:function(e,t){h.call(this,{Action:"name/cos:GetBucketDomain",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=[];try{i=n.DomainConfiguration.DomainRule||[]}catch(s){}i=o.clone(o.isArray(i)?i:[i]),t(null,{DomainRule:i,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketDomain:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketDomain",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketOrigin:function(e,t){var n=(e.OriginConfiguration||{}).OriginRule||e.OriginRule||[];n=o.clone(n);var i=o.json2xml({OriginConfiguration:{OriginRule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketOrigin",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"origin",headers:s,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketOrigin:function(e,t){h.call(this,{Action:"name/cos:GetBucketOrigin",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=[];try{i=n.OriginConfiguration.OriginRule||[]}catch(s){}i=o.clone(o.isArray(i)?i:[i]),t(null,{OriginRule:i,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketOrigin:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketOrigin",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLogging:function(e,t){var n=o.json2xml({BucketLoggingStatus:e.BucketLoggingStatus||""}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(n)),h.call(this,{Action:"name/cos:PutBucketLogging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:n,action:"logging",headers:i,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketLogging:function(e,t){h.call(this,{Action:"name/cos:GetBucketLogging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"logging",tracker:e.tracker},(function(e,n){if(e)return t(e);delete n.BucketLoggingStatus._xmlns,t(null,{BucketLoggingStatus:n.BucketLoggingStatus,statusCode:n.statusCode,headers:n.headers})}))},putBucketInventory:function(e,t){var n=o.clone(e.InventoryConfiguration);if(n.OptionalFields){var i=n.OptionalFields||[];n.OptionalFields={Field:i}}if(n.Destination&&n.Destination.COSBucketDestination&&n.Destination.COSBucketDestination.Encryption){var s=n.Destination.COSBucketDestination.Encryption;Object.keys(s).indexOf("SSECOS")>-1&&(s["SSE-COS"]=s.SSECOS,delete s.SSECOS)}var a=o.json2xml({InventoryConfiguration:n}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(a)),h.call(this,{Action:"name/cos:PutBucketInventory",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"inventory",qs:{id:e.Id},headers:r,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketInventory:function(e,t){h.call(this,{Action:"name/cos:GetBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id},tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.InventoryConfiguration;if(i&&i.OptionalFields&&i.OptionalFields.Field){var s=i.OptionalFields.Field;o.isArray(s)||(s=[s]),i.OptionalFields=s}if(i.Destination&&i.Destination.COSBucketDestination&&i.Destination.COSBucketDestination.Encryption){var a=i.Destination.COSBucketDestination.Encryption;Object.keys(a).indexOf("SSE-COS")>-1&&(a.SSECOS=a["SSE-COS"],delete a["SSE-COS"])}t(null,{InventoryConfiguration:i,statusCode:n.statusCode,headers:n.headers})}))},listBucketInventory:function(e,t){h.call(this,{Action:"name/cos:ListBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{"continuation-token":e.ContinuationToken},tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListInventoryConfigurationResult,s=i.InventoryConfiguration||[];s=o.isArray(s)?s:[s],delete i.InventoryConfiguration,o.each(s,(function(e){if(e&&e.OptionalFields&&e.OptionalFields.Field){var t=e.OptionalFields.Field;o.isArray(t)||(t=[t]),e.OptionalFields=t}if(e.Destination&&e.Destination.COSBucketDestination&&e.Destination.COSBucketDestination.Encryption){var n=e.Destination.COSBucketDestination.Encryption;Object.keys(n).indexOf("SSE-COS")>-1&&(n.SSECOS=n["SSE-COS"],delete n["SSE-COS"])}})),i.InventoryConfigurations=s,o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))},deleteBucketInventory:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketInventory",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id},tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketAccelerate:function(e,t){if(e.AccelerateConfiguration){var n={AccelerateConfiguration:e.AccelerateConfiguration||{}},i=o.json2xml(n),s={"Content-Type":"application/xml"};s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Interface:"putBucketAccelerate",Action:"name/cos:PutBucketAccelerate",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"accelerate",headers:s,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t({error:"missing param AccelerateConfiguration"})},getBucketAccelerate:function(e,t){h.call(this,{Interface:"getBucketAccelerate",Action:"name/cos:GetBucketAccelerate",method:"GET",Bucket:e.Bucket,Region:e.Region,action:"accelerate",tracker:e.tracker},(function(e,n){e||!n.AccelerateConfiguration&&(n.AccelerateConfiguration={}),t(e,n)}))},getObject:function(e,t){if(this.options.ObjectKeySimplifyCheck&&"/"===o.simplifyPath(e.Key))t(o.error(new Error("The Getobject Key is illegal")));else{var n=e.Query||{},i=e.QueryString||"",s=e.tracker;s&&s.setParams({signStartTime:(new Date).getTime()}),n["response-content-type"]=e.ResponseContentType,n["response-content-language"]=e.ResponseContentLanguage,n["response-expires"]=e.ResponseExpires,n["response-cache-control"]=e.ResponseCacheControl,n["response-content-disposition"]=e.ResponseContentDisposition,n["response-content-encoding"]=e.ResponseContentEncoding,h.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,qs:n,qsStr:i,rawBody:!0,dataType:e.DataType,tracker:s},(function(n,i){if(n){var s=n.statusCode;return e.Headers["If-Modified-Since"]&&s&&304===s?t(null,{NotModified:!0}):t(n)}t(null,{Body:i.body,ETag:o.attr(i.headers,"etag",""),statusCode:i.statusCode,headers:i.headers})}))}},headObject:function(e,t){h.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,tracker:e.tracker},(function(n,i){if(n){var s=n.statusCode;return e.Headers["If-Modified-Since"]&&s&&304===s?t(null,{NotModified:!0,statusCode:s}):t(n)}i.ETag=o.attr(i.headers,"etag",""),t(null,i)}))},listObjectVersions:function(e,t){var n={};n.prefix=e.Prefix||"",n.delimiter=e.Delimiter,n["key-marker"]=e.KeyMarker,n["version-id-marker"]=e.VersionIdMarker,n["max-keys"]=e.MaxKeys,n["encoding-type"]=e.EncodingType,h.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"versions",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListVersionsResult||{},s=i.DeleteMarker||[];s=o.isArray(s)?s:[s];var a=i.Version||[];a=o.isArray(a)?a:[a];var r=o.clone(i);delete r.DeleteMarker,delete r.Version,o.extend(r,{DeleteMarkers:s,Versions:a,statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},putObject:function(e,t){var n=this,i=e.ContentLength,a=o.throttleOnProgress.call(n,i,e.onProgress),r=e.Headers;r["Cache-Control"]||r["cache-control"]||(r["Cache-Control"]=""),r["Content-Type"]||r["content-type"]||(r["Content-Type"]=s.getType(e.Key)||"application/octet-stream");var u=e.UploadAddMetaMd5||n.options.UploadAddMetaMd5||n.options.UploadCheckContentMd5,l=e.tracker;u&&l&&l.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(u,e.Body,(function(s){s&&(l&&l.setParams({md5EndTime:(new Date).getTime()}),n.options.UploadCheckContentMd5&&(r["Content-MD5"]=o.binaryBase64(s)),(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5)&&(r["x-cos-meta-md5"]=s)),void 0!==e.ContentLength&&(r["Content-Length"]=e.ContentLength),a(null,!0),h.call(n,{Action:"name/cos:PutObject",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:e.Query,body:e.Body,onProgress:a,tracker:l},(function(s,r){if(s)return a(null,!0),t(s);a({loaded:i,total:i},!0);var u=c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:n.options.UseAccelerate?"accelerate":e.Region,object:e.Key});u=u.substr(u.indexOf("://")+3),r.Location=u,r.ETag=o.attr(r.headers,"etag",""),t(null,r)}))}))},postObject:function(e,t){var n=this,i={},s=e.FilePath;if(s){for(var a in i["Cache-Control"]=e.CacheControl,i["Content-Disposition"]=e.ContentDisposition,i["Content-Encoding"]=e.ContentEncoding,i["Content-MD5"]=e.ContentMD5,i["Content-Length"]=e.ContentLength,i["Content-Type"]=e.ContentType,i.Expect=e.Expect,i.Expires=e.Expires,i["x-cos-acl"]=e.ACL,i["x-cos-grant-read"]=e.GrantRead,i["x-cos-grant-write"]=e.GrantWrite,i["x-cos-grant-full-control"]=e.GrantFullControl,i["x-cos-storage-class"]=e.StorageClass,i["x-cos-mime-limit"]=e.MimeLimit,i["x-cos-traffic-limit"]=e.TrafficLimit,i["x-cos-forbid-overwrite"]=e.ForbidOverwrite,i["x-cos-server-side-encryption-customer-algorithm"]=e.SSECustomerAlgorithm,i["x-cos-server-side-encryption-customer-key"]=e.SSECustomerKey,i["x-cos-server-side-encryption-customer-key-MD5"]=e.SSECustomerKeyMD5,i["x-cos-server-side-encryption"]=e.ServerSideEncryption,i["x-cos-server-side-encryption-cos-kms-key-id"]=e.SSEKMSKeyId,i["x-cos-server-side-encryption-context"]=e.SSEContext,delete i["Content-Length"],delete i["content-length"],e)a.indexOf("x-cos-meta-")>-1&&(i[a]=e[a]);var r=o.throttleOnProgress.call(n,i["Content-Length"],e.onProgress);h.call(this,{Action:"name/cos:PostObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:i,qs:e.Query,filePath:s,TaskId:e.TaskId,onProgress:r,tracker:e.tracker},(function(i,o){if(r(null,!0),i)return t(i);if(o&&o.headers){var a=o.headers,u=a.etag||a.Etag||a.ETag||"",l=s.substr(s.lastIndexOf("/")+1),d=c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key.replace(/\$\{filename\}/g,l),isLocation:!0});return t(null,{Location:d,statusCode:o.statusCode,headers:a,ETag:u})}t(null,o)}))}else t({error:"missing param FilePath"})},deleteObject:function(e,t){h.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,VersionId:e.VersionId,tracker:e.tracker},(function(e,n){if(e){var i=e.statusCode;return i&&204===i?t(null,{statusCode:i}):i&&404===i?t(null,{BucketNotFound:!0,statusCode:i}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectAcl:function(e,t){var n={};e.VersionId&&(n.versionId=e.VersionId),h.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:n,action:"acl",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.AccessControlPolicy||{},s=i.Owner||{},r=i.AccessControlList&&i.AccessControlList.Grant||[];r=o.isArray(r)?r:[r];var c=a(i);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:s,Grants:r,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putObjectAcl:function(e,t){var n=e.Headers,i="";if(e.AccessControlPolicy){var s=o.clone(e.AccessControlPolicy||{}),a=s.Grants||s.Grant;a=o.isArray(a)?a:[a],delete s.Grant,delete s.Grants,s.AccessControlList={Grant:a},i=o.json2xml({AccessControlPolicy:s}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(i))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=r(n[t]))})),h.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"acl",headers:n,body:i,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},optionsObject:function(e,t){var n=e.Headers;n.Origin=e.Origin,n["Access-Control-Request-Method"]=e.AccessControlRequestMethod,n["Access-Control-Request-Headers"]=e.AccessControlRequestHeaders,h.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:n,tracker:e.tracker},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(null,{OptionsForbidden:!0,statusCode:e.statusCode}):t(e);var i=n.headers||{};t(null,{AccessControlAllowOrigin:i["access-control-allow-origin"],AccessControlAllowMethods:i["access-control-allow-methods"],AccessControlAllowHeaders:i["access-control-allow-headers"],AccessControlExposeHeaders:i["access-control-expose-headers"],AccessControlMaxAge:i["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})}))},putObjectCopy:function(e,t){var n=e.Headers;!n["Cache-Control"]&&n["cache-control"]&&(n["Cache-Control"]="");var i=e.CopySource||"",s=o.getSourceParams.call(this,i);if(s){var a=s.Bucket,r=s.Region,c=decodeURIComponent(s.Key);h.call(this,{Scope:[{action:"name/cos:GetObject",bucket:a,region:r,prefix:c},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=o.clone(n.CopyObjectResult||{});o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))}else t({error:"CopySource format error"})},deleteMultipleObject:function(e,t){var n=e.Objects||[],i=e.Quiet;n=o.isArray(n)?n:[n];var s=o.json2xml({Delete:{Object:n,Quiet:i||!1}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s));var r=o.map(n,(function(t){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:t.Key}}));h.call(this,{Scope:r,method:"POST",Bucket:e.Bucket,Region:e.Region,body:s,action:"delete",headers:a,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.DeleteResult||{},s=i.Deleted||[],a=i.Error||[];s=o.isArray(s)?s:[s],a=o.isArray(a)?a:[a];var r=o.clone(i);o.extend(r,{Error:a,Deleted:s,statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},restoreObject:function(e,t){var n=e.Headers;if(e.RestoreRequest){var i=e.RestoreRequest||{},s=o.json2xml({RestoreRequest:i});n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:s,action:"restore",headers:n,tracker:e.tracker},(function(e,n){t(e,n)}))}else t({error:"missing param RestoreRequest"})},putObjectTagging:function(e,t){var n=e.Tagging||{},i=n.TagSet||n.Tags||e.Tags||[];i=o.clone(o.isArray(i)?i:[i]);var s=o.json2xml({Tagging:{TagSet:{Tag:i}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Interface:"putObjectTagging",Action:"name/cos:PutObjectTagging",method:"PUT",Bucket:e.Bucket,Key:e.Key,Region:e.Region,body:s,action:"tagging",headers:a,VersionId:e.VersionId,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectTagging:function(e,t){h.call(this,{Interface:"getObjectTagging",Action:"name/cos:GetObjectTagging",method:"GET",Key:e.Key,Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",VersionId:e.VersionId,tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var i={Tags:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else{var s=[];try{s=n.Tagging.TagSet.Tag||[]}catch(a){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Tags:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteObjectTagging:function(e,t){h.call(this,{Interface:"deleteObjectTagging",Action:"name/cos:DeleteObjectTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"tagging",VersionId:e.VersionId,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},appendObject:function(e,t){h.call(this,{Action:"name/cos:AppendObject",method:"POST",Bucket:e.Bucket,Region:e.Region,action:"append",Key:e.Key,body:e.Body,qs:{position:e.Position},headers:e.Headers,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,n)}))},uploadPartCopy:function(e,t){var n=e.CopySource||"",i=o.getSourceParams.call(this,n);if(i){var s=i.Bucket,a=i.Region,r=decodeURIComponent(i.Key);h.call(this,{Scope:[{action:"name/cos:GetObject",bucket:s,region:a,prefix:r},{action:"name/cos:PutObject",bucket:e.Bucket,region:e.Region,prefix:e.Key}],method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=o.clone(n.CopyPartResult||{});o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))}else t({error:"CopySource format error"})},multipartInit:function(e,t){var n=e.Headers,i=e.tracker;n["Cache-Control"]||n["cache-control"]||(n["Cache-Control"]=""),n["Content-Type"]||n["content-type"]||(n["Content-Type"]=s.getType(e.Key)||"application/octet-stream"),h.call(this,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers,qs:e.Query,tracker:i},(function(e,n){return e?(i&&i.parent&&i.parent.setParams({errorNode:"multipartInit"}),t(e)):(n=o.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,o.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)}))},multipartUpload:function(e,t){var n=this;o.getFileSize("multipartUpload",e,(function(){var i=e.tracker,s=n.options.UploadCheckContentMd5;s&&i&&i.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(s,e.Body,(function(a){a&&(e.Headers["Content-MD5"]=o.binaryBase64(a),s&&i&&i.setParams({md5EndTime:(new Date).getTime()})),i&&i.setParams({partNumber:e.PartNumber}),h.call(n,{Action:"name/cos:UploadPart",TaskId:e.TaskId,method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,qs:{partNumber:e.PartNumber,uploadId:e.UploadId},headers:e.Headers,onProgress:e.onProgress,body:e.Body||null,tracker:i},(function(e,n){if(e)return i&&i.parent&&i.parent.setParams({errorNode:"multipartUpload"}),t(e);t(null,{ETag:o.attr(n.headers,"etag",{}),statusCode:n.statusCode,headers:n.headers})}))}))}))},multipartComplete:function(e,t){for(var n=this,i=e.UploadId,s=e.Parts,a=e.tracker,r=0,u=s.length;r-1?(o=n.Authorization,r=o.match(/q-url-param-list.*?(?=&)/g)[0],c="q-url-param-list="+encodeURIComponent(r.replace(/q-url-param-list=/,"")).toLowerCase(),u=new RegExp(r,"g"),o.replace(u,c)):"sign="+encodeURIComponent(n.Authorization)),n.SecurityToken&&(i+="&x-cos-security-token="+n.SecurityToken),n.ClientIP&&(i+="&clientIP="+n.ClientIP),n.ClientUA&&(i+="&clientUA="+n.ClientUA),n.Token&&(i+="&token="+n.Token),a&&(i+="&"+a),setTimeout((function(){t(null,{Url:i})}))}var o,r,c,u}));return p?(r+="?"+p.Authorization+(p.SecurityToken?"&x-cos-security-token="+p.SecurityToken:""),a&&(r+="&"+a)):a&&(r+="?"+a),r},getAuth:function(e){return o.getAuth({SecretId:e.SecretId||this.options.SecretId||"",SecretKey:e.SecretKey||this.options.SecretKey||"",Bucket:e.Bucket,Region:e.Region,Method:e.Method,Key:e.Key,Query:e.Query,Headers:e.Headers,Expires:e.Expires,SystemClockOffset:this.options.SystemClockOffset})}};e.exports.init=function(e,t){t.transferToTaskMethod(f,"postObject"),t.transferToTaskMethod(f,"putObject"),o.each(f,(function(t,n){e.prototype[n]=o.apiWrapper(n,t)}))}},function(e,t){function n(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}var i=function(e,t){var i,o,s,a=[],r=function(e,t){var i=[];for(var o in e)e.hasOwnProperty(o)&&i.push(t?n(o).toLowerCase():o);return i.sort((function(e,t){return(e=e.toLowerCase())===(t=t.toLowerCase())?0:e>t?1:-1}))}(e);for(i=0;i-1||g.indexOf(f)>-1)&&(h[f]=e.headers[f]);s["x-cos-acl"]&&(h.acl=s["x-cos-acl"]),!h["Content-Type"]&&(h["Content-Type"]=""),(n=Pn.uploadFile({url:a,method:r,name:"file",header:s,filePath:o,formData:h,timeout:e.timeout,success:function(e){l(null,e)},fail:function(e){l(e.errMsg,e)}})).onProgressUpdate((function(e){c&&c({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend,progress:e.progress/100})}))}else{var m=e.qs&&i(e.qs)||"";m&&(a+=(a.indexOf("?")>-1?"&":"?")+m),s["Content-Length"]&&delete s["Content-Length"];var _={url:a,method:r,header:s,dataType:"text",data:e.body,responseType:e.dataType||"text",timeout:e.timeout,redirect:"manual",success:function(e){l(null,e)},fail:function(e){l(e.errMsg,e)}};u&&Object.assign(_,{enableHttpDNS:!0,httpDNSServiceId:u}),n=Pn.request(_)}return n}},function(e,t,n){let i=n(29);e.exports=new i(n(30),n(31))},function(e,t,n){function i(){this._types=Object.create(null),this._extensions=Object.create(null);for(let e=0;e=0;--o){var a=this.tryEntries[o],r=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=s.call(a,"catchLoc"),u=s.call(a,"finallyLoc");if(c&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;A(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:P(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),v}},t}function o(e){return(o="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 s(e,t,n,i,o,s,a){try{var r=e[s](a),c=r.value}catch(u){return void n(u)}r.done?t(c):Promise.resolve(c).then(i,o)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){s(a,i,o,r,c,"next",e)}function c(e){s(a,i,o,r,c,"throw",e)}r(void 0)}))}}var r=n(7),c=n(33),u=n(6).EventProxy,l=n(0),d=n(2);function p(e,t){var n=e.TaskId,i=e.Bucket,o=e.Region,s=e.Key,a=e.StorageClass,d=this,p={},f=e.FileSize,m=e.SliceSize,_=Math.ceil(f/m),v=0,y=l.throttleOnProgress.call(d,f,e.onHashProgress),I=function(t,n){var i=t.length;return 0===i?n(null,!0):i>_||i>1&&Math.max(t[0].Size,t[1].Size)!==m?n(null,!1):void function o(s){if(s=c.length)M.emit("has_and_check_upload_id",t);else{var p=c[u];if(!l.isInArray(t,p))return r.removeUploadId(p),void a(u+1);r.using[p]?a(u+1):g.call(d,{Bucket:i,Region:o,Key:s,UploadId:p,tracker:e.tracker},(function(e,t){d._isRunningTask(n)&&(e?(r.removeUploadId(p),a(u+1)):M.emit("upload_id_available",{UploadId:p,PartList:t.PartList}))}))}}(0):M.emit("has_and_check_upload_id",t)})),M.on("get_remote_upload_id_list",(function(){h.call(d,{Bucket:i,Region:o,Key:s,tracker:e.tracker},(function(t,o){if(d._isRunningTask(n)){if(t)return M.emit("error",t);var c=l.filter(o.UploadList,(function(e){return e.Key===s&&(!a||e.StorageClass.toUpperCase()===a.toUpperCase())})).reverse().map((function(e){return e.UploadId||e.UploadID}));if(c.length)M.emit("seek_local_avail_upload_id",c);else{var u,p=r.getFileId(e.FileStat,e.ChunkSize,i,s);p&&(u=r.getUploadIdList(p))&&l.each(u,(function(e){r.removeUploadId(e)})),M.emit("no_available_upload_id")}}}))})),M.emit("get_remote_upload_id_list")}function h(e,t){var n=this,i=[],o={Bucket:e.Bucket,Region:e.Region,Prefix:e.Key,calledBySdk:e.calledBySdk||"sliceUploadFile",tracker:e.tracker};!function e(){n.multipartList(o,(function(n,s){if(n)return t(n);i.push.apply(i,s.Upload||[]),"true"===s.IsTruncated?(o.KeyMarker=s.NextKeyMarker,o.UploadIdMarker=s.NextUploadIdMarker,e()):t(null,{UploadList:i})}))}()}function g(e,t){var n=this,i=[],o={Bucket:e.Bucket,Region:e.Region,Key:e.Key,UploadId:e.UploadId,calledBySdk:"sliceUploadFile",tracker:e.tracker};!function e(){n.multipartListPart(o,(function(n,s){if(n)return t(n);i.push.apply(i,s.Part||[]),"true"===s.IsTruncated?(o.PartNumberMarker=s.NextPartNumberMarker,e()):t(null,{PartList:i})}))}()}function f(e,t){var n=this,i=e.TaskId,o=e.Bucket,s=e.Region,a=e.Key,r=e.UploadData,u=e.FileSize,d=e.SliceSize,p=Math.min(e.AsyncLimit||n.options.ChunkParallelLimit||1,256),h=e.FilePath,g=Math.ceil(u/d),f=0,_=e.ServerSideEncryption,v=l.filter(r.PartList,(function(e){return e.Uploaded&&(f+=e.PartNumber>=g&&u%d||d),!e.Uploaded})),y=e.onProgress;c.eachLimit(v,p,(function(t,c){if(n._isRunningTask(i)){var l=t.PartNumber,p=Math.min(u,t.PartNumber*d)-(t.PartNumber-1)*d,g=0;m.call(n,{TaskId:i,Bucket:o,Region:s,Key:a,SliceSize:d,FileSize:u,PartNumber:l,ServerSideEncryption:_,FilePath:h,UploadData:r,onProgress:function(e){f+=e.loaded-g,g=e.loaded,y({loaded:f,total:u})},tracker:e.tracker},(function(e,o){n._isRunningTask(i)&&(e?f-=g:(f+=p-g,t.ETag=o.ETag),y({loaded:f,total:u}),c(e||null,o))}))}}),(function(e){if(n._isRunningTask(i))return e?t(e):void t(null,{UploadId:r.UploadId,SliceList:r.PartList})}))}function m(e,t){var n=this,i=e.TaskId,o=e.Bucket,s=e.Region,a=e.Key,r=e.FileSize,u=e.FilePath,d=1*e.PartNumber,p=e.SliceSize,h=e.ServerSideEncryption,g=e.UploadData,f=n.options.ChunkRetryTimes+1,m=e.Headers||{},_=p*(d-1),v=p,y=_+p;y>r&&(v=(y=r)-_);var I=["x-cos-traffic-limit","x-cos-mime-limit"],M={};l.each(m,(function(e,t){I.indexOf(t)>-1&&(M[t]=e)})),l.fileSlice(u,_,y,(function(r){var u=l.getFileMd5(r),p=u?l.binaryBase64(u):null,m=g.PartList[d-1];c.retry(f,(function(t){n._isRunningTask(i)&&n.multipartUpload({TaskId:i,Bucket:o,Region:s,Key:a,ContentLength:v,PartNumber:d,UploadId:g.UploadId,ServerSideEncryption:h,Body:r,Headers:M,onProgress:e.onProgress,ContentMD5:p,calledBySdk:"sliceUploadFile",tracker:e.tracker},(function(e,o){if(n._isRunningTask(i))return e?t(e):(m.Uploaded=!0,t(null,o))}))}),(function(e,o){if(n._isRunningTask(i))return t(e,o)}))}))}function _(e,t){var n=e.Bucket,i=e.Region,o=e.Key,s=e.UploadId,a=e.SliceList,r=this,u=this.options.ChunkRetryTimes+1,l=a.map((function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}}));c.retry(u,(function(t){r.multipartComplete({Bucket:n,Region:i,Key:o,UploadId:s,Parts:l,calledBySdk:"sliceUploadFile",Headers:e.Headers||{},tracker:e.tracker},t)}),(function(e,n){t(e,n)}))}function v(e,t){var n=e.Bucket,i=e.Region,o=e.Key,s=e.AbortArray,a=e.AsyncLimit||1,r=this,u=0,l=new Array(s.length);c.eachLimit(s,a,(function(t,s){var a=u;if(o&&o!==t.Key)return l[a]={error:{KeyNotMatch:!0}},void s(null);var c=t.UploadId||t.UploadID;r.multipartAbort({Bucket:n,Region:i,Key:t.Key,Headers:e.Headers,UploadId:c},(function(e){var o={Bucket:n,Region:i,Key:t.Key,UploadId:c};l[a]={error:e,task:o},s(null)})),u++}),(function(e){if(e)return t(e);for(var n=[],i=[],o=0,s=l.length;oa?"sliceUploadFile":"putObject",t.tracker=new d({Beacon:s.options.BeaconReporter,clsReporter:s.options.ClsReporter,bucket:t.Bucket,region:t.Region,apiName:"uploadFile",realApi:h,fileKey:t.Key,fileSize:c,accelerate:p,deepTracker:s.options.DeepTracker,customId:s.options.CustomId,delay:s.options.TrackerDelay})),l.each(t,(function(e,t){"object"!==o(e)&&"function"!=typeof e&&(u[t]=e)})),g=t.onTaskReady,t.onTaskReady=function(e){u.TaskId=e,g&&g(e)},f=t.onFileFinish,m=function(e,i){t.tracker&&t.tracker.report(e,i),f&&f(e,i,u),n&&n(e,i)},_="postObject"===s.options.SimpleUploadMethod?"postObject":"putObject",v=c>a?"sliceUploadFile":_,r.push({api:v,params:t,callback:m}),s._addTasks(r);case 24:case"end":return e.stop()}}),e,this,[[3,9]])})))).apply(this,arguments)}function I(){return I=a(i().mark((function e(t,n){var s,r,c,u,p,h,g,f,m,_,v;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=this,r=void 0===t.SliceSize?s.options.SliceSize:t.SliceSize,c=0,u=0,p=l.throttleOnProgress.call(s,u,t.onProgress),h=t.files.length,g=t.onFileFinish,f=Array(h),m=function(e,t,i){p(null,!0),g&&g(e,t,i),f[i.Index]={options:i,error:e,data:t},--h<=0&&n&&n(null,{files:f})},_=[],v=function(){return t.files.map((function(e,t){return new Promise((n=a(i().mark((function n(a){var h,g,f,v,y,I,M,C,S,E,T;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return h=0,n.prev=1,n.next=4,l.getFileSizeByPath(e.FilePath);case 4:h=n.sent,n.next=9;break;case 7:n.prev=7,n.t0=n.catch(1);case 9:g={Index:t,TaskId:""},c+=h,s.options.EnableReporter&&(f=s.options.UseAccelerate||"string"==typeof s.options.Domain&&s.options.Domain.includes("accelerate."),v=h>r?"sliceUploadFile":"putObject",e.tracker=new d({Beacon:s.options.BeaconReporter,clsReporter:s.options.ClsReporter,bucket:e.Bucket,region:e.Region,apiName:"uploadFiles",realApi:v,fileKey:e.Key,fileSize:h,accelerate:f,deepTracker:s.options.DeepTracker,customId:s.options.CustomId,delay:s.options.TrackerDelay})),l.each(e,(function(e,t){"object"!==o(e)&&"function"!=typeof e&&(g[t]=e)})),y=e.onTaskReady,e.onTaskReady=function(e){g.TaskId=e,y&&y(e)},I=0,M=e.onProgress,e.onProgress=function(e){u=u-I+e.loaded,I=e.loaded,M&&M(e),p({loaded:u,total:c})},C=e.onFileFinish,S=function(t,n){e.tracker&&e.tracker.report(t,n),C&&C(t,n),m&&m(t,n,g)},E="postObject"===s.options.SimpleUploadMethod?"postObject":"putObject",T=h>r?"sliceUploadFile":E,_.push({api:T,params:e,callback:S}),a(!0);case 24:case"end":return n.stop()}}),n,null,[[1,7]])}))),function(e){return n.apply(this,arguments)}));var n}))},e.next=13,Promise.all(v());case 13:s._addTasks(_);case 14:case"end":return e.stop()}}),e,this)}))),I.apply(this,arguments)}function M(e,t){var n=e.TaskId,i=e.Bucket,o=e.Region,s=e.Key,a=e.CopySource,r=e.UploadId,u=1*e.PartNumber,l=e.CopySourceRange,d=this.options.ChunkRetryTimes+1,p=this;c.retry(d,(function(t){p.uploadPartCopy({TaskId:n,Bucket:i,Region:o,Key:s,CopySource:a,UploadId:r,PartNumber:u,CopySourceRange:l,onProgress:e.onProgress,tracker:e.tracker,calledBySdk:e.calledBySdk},(function(e,n){t(e||null,n)}))}),(function(e,n){return t(e,n)}))}var C={sliceUploadFile:function(e,t){var n=this;if(!l.canFileSlice())return e.SkipTask=!0,void("postObject"===n.options.SimpleUploadMethod?n.postObject(e,t):n.putObject(e,t));var i,o,s=new u,a=e.TaskId,c=e.Bucket,d=e.Region,h=e.Key,g=e.FilePath,m=e.ChunkSize||e.SliceSize||n.options.ChunkSize,v=e.AsyncLimit,y=e.StorageClass,I=e.ServerSideEncryption,M=e.onHashProgress,C=e.tracker;C&&C.setParams({chunkSize:m}),s.on("error",(function(i){if(n._isRunningTask(a)){var o={UploadId:e.UploadData.UploadId||"",err:i,error:i};return t(o)}})),s.on("upload_complete",(function(n){var i=l.extend({UploadId:e.UploadData.UploadId||""},n);t(null,i)})),s.on("upload_slice_complete",(function(t){var u={};l.each(e.Headers,(function(e,t){var n=t.toLowerCase();0!==n.indexOf("x-cos-meta-")&&"pic-operations"!==n||(u[t]=e)})),_.call(n,{Bucket:c,Region:d,Key:h,UploadId:t.UploadId,SliceList:t.SliceList,Headers:u,tracker:C},(function(e,c){if(n._isRunningTask(a)){if(r.removeUsing(t.UploadId),e)return o(null,!0),s.emit("error",e);r.removeUploadId(t.UploadId),o({loaded:i,total:i},!0),s.emit("upload_complete",c)}}))})),s.on("get_upload_data_finish",(function(t){var u=r.getFileId(e.FileStat,e.ChunkSize,c,h);u&&r.saveUploadId(u,t.UploadId,n.options.UploadIdCacheLimit),r.setUsing(t.UploadId),o(null,!0),f.call(n,{TaskId:a,Bucket:c,Region:d,Key:h,FilePath:g,FileSize:i,SliceSize:m,AsyncLimit:v,ServerSideEncryption:I,UploadData:t,onProgress:o,tracker:C},(function(e,t){if(n._isRunningTask(a))return e?(o(null,!0),s.emit("error",e)):void s.emit("upload_slice_complete",t)}))})),s.on("get_file_size_finish",(function(){if(o=l.throttleOnProgress.call(n,i,e.onProgress),e.UploadData.UploadId)s.emit("get_upload_data_finish",e.UploadData);else{var t=l.extend({TaskId:a,Bucket:c,Region:d,Key:h,Headers:e.Headers,StorageClass:y,FilePath:g,FileSize:i,SliceSize:m,onHashProgress:M,tracker:C},e);t.FileSize=i,p.call(n,t,(function(t,i){if(n._isRunningTask(a)){if(t)return s.emit("error",t);e.UploadData.UploadId=i.UploadId,e.UploadData.PartList=i.PartList,s.emit("get_upload_data_finish",e.UploadData)}}))}})),i=e.ContentLength,delete e.ContentLength,!e.Headers&&(e.Headers={}),l.each(e.Headers,(function(t,n){"content-length"===n.toLowerCase()&&delete e.Headers[n]})),function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],o=1048576,s=0;s=E&&v%I||I),!e.Uploaded}));c.eachLimit(h,C,(function(t,n){var r=t.PartNumber,l=t.CopySourceRange,p=t.end-t.start,h=0;c.retry(S,(function(t){M.call(i,{Bucket:o,Region:s,Key:a,CopySource:d,UploadId:u.UploadId,PartNumber:r,CopySourceRange:l,tracker:e.tracker,calledBySdk:"sliceCopyFile",onProgress:function(e){T+=e.loaded-h,h=e.loaded,y({loaded:T,total:v})}},t)}),(function(e,i){if(e)return n(e);y({loaded:T,total:v}),T+=p-h,t.ETag=i.ETag,n(e||null,i)}))}),(function(e){if(e)return r.removeUsing(u.UploadId),y(null,!0),t(e);n.emit("copy_slice_complete",u)}))})),n.on("get_chunk_size_finish",(function(){var c=function(){i.multipartInit({Bucket:o,Region:s,Key:a,Headers:R,tracker:e.tracker,calledBySdk:"sliceCopyFile"},(function(i,o){if(i)return t(i);e.UploadId=o.UploadId,n.emit("get_copy_data_finish",{UploadId:e.UploadId,PartList:e.PartList})}))},u=r.getCopyFileId(d,k,I,o,a),p=r.getUploadIdList(u);if(!u||!p)return c();!function t(u){if(u>=p.length)return c();var d=p[u];if(r.using[d])return t(u+1);g.call(i,{Bucket:o,Region:s,Key:a,UploadId:d,tracker:e.tracker,calledBySdk:"sliceCopyFile"},(function(i,o){if(i)r.removeUploadId(d),t(u+1);else{if(r.using[d])return t(u+1);var s={},a=0;l.each(o.PartList,(function(e){var t=parseInt(e.Size),n=a+t-1;s[e.PartNumber+"|"+a+"|"+n]=e.ETag,a+=t})),l.each(e.PartList,(function(e){var t=s[e.PartNumber+"|"+e.start+"|"+e.end];t&&(e.ETag=t,e.Uploaded=!0)})),n.emit("get_copy_data_finish",{UploadId:d,PartList:e.PartList})}}))}(0)})),n.on("get_file_size_finish",(function(){var o;if(function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],n=1048576,o=0;o11&&(D[t]=e)})),n.emit("get_file_size_finish")}else t({error:'get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.'})}))}else t({error:"CopySource format error"})}};e.exports.init=function(e,t){t.transferToTaskMethod(C,"sliceUploadFile"),l.each(C,(function(t,n){e.prototype[n]=l.apiWrapper(n,t)}))}},function(e,t){var n={eachLimit:function(e,t,n,i){if(i=i||function(){},!e.length||t<=0)return i();var o=0,s=0,a=0;!function r(){if(o>=e.length)return i();for(;a=e.length?i():r())}))}()},retry:function(e,t,n){e<1?n():function i(o){t((function(t,s){t&&oe.length)&&(t=e.length);for(var n=0,i=Array(t);n=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!e})()}function d(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)),i}function g(e){for(var t=1;ti&&(Jt({api:t,paramName:n,desc:Gn("MaximumArrayLengthLog",n,i)}),1)):(Jt({api:t,paramName:n,desc:on()}),!1)}function Mn(e,t,n,i){var o=i.allowUndefined,s=i.min;return i=i.max,lt(e)?!!o||(Jt({api:t,paramName:n,desc:en()}),!1):Ke(e)?Ke(s)&&e=Math.pow(2,64)&&(Jt({api:t,paramName:n,desc:Gn("NumberLessThanLog",n,"Math.pow(2,64)")}),1)):(Jt({api:t,paramName:n,desc:Zt()}),!1)}},enableMark:g({},Ln)},createConversationGroup:{conversationIDList:g({},Z),groupName:g(g({},Y),{},{validator:function(e,t,n){return!(!e||32=this.TOPIC_MSG_LIMIT&&this._convM.clearMemMsg(o,!0)}}catch(r){n.e(r)}finally{n.f()}}}},{key:"pushIn",value:function(e){var t=1>(-2*s&6))))o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);try{return decodeURIComponent(escape(n))}catch(r){return""}}Gi.mixin=function(e){(e=e.prototype||e)._isReady=!1,e.ready=function(e){if(e)return this._isReady?void(1=this.MAX_LENGTH&&(t=this.map.entries().next().value[0],this.map.delete(t)),this.map.set(e,1)}},{key:"has",value:function(e){return this.map.has(e)}},{key:"delete",value:function(e){this.has(e)&&this.map.delete(e)}},{key:"reset",value:function(){this.map.clear()}}]),Ki=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"],zi=s((function e(t){i(this,e),this.groupID="",this.name="",this.avatar="",this.type="",this.introduction="",this.notification="",this.ownerID="",this.createTime="",this.infoSequence="",this.lastInfoTime="",this.selfInfo={messageRemindType:"",joinTime:"",nameCard:"",role:"",userID:"",memberCustomField:void 0,readedSequence:0,excludedUnreadSequenceList:void 0},this.lastMessage={lastTime:"",lastSequence:"",fromAccount:"",messageForShow:""},this.nextMessageSeq="",this.memberNum="",this.memberCount="",this.maxMemberNum="",this.maxMemberCount="",this.joinOption="",this.inviteOption="",this.groupCustomField=[],this.muteAllMembers=!1,this.isSupportTopic=!1,this._lastRevokedTime=0,this._initGroup(t)}),[{key:"memberNum",get:function(){return this.memberCount},set:function(e){}},{key:"maxMemberNum",get:function(){return this.maxMemberCount},set:function(e){}},{key:"_initGroup",value:function(e){for(var t in e)Ki.indexOf(t)<0||("selfInfo"!==t?("memberNum"===t&&(this.memberCount=e[t]),"maxMemberNum"===t&&(this.maxMemberCount=e[t]),"isSupportTopic"!==t?this[t]=e[t]:this.isSupportTopic=1===e[t]):this.updateSelfInfo(e[t]))}},{key:"updateGroup",value:function(e){var t=this;(e.appid=void 0,e.grossTopicNextMsgSeq=void 0,e.selfInfo&&(e.selfInfo.grossTopicReadSeq=void 0),e=JSON.parse(JSON.stringify(e))).lastMsgTime&&(this.lastMessage.lastTime=e.lastMsgTime),lt(e.muteAllMembers)||("On"===e.muteAllMembers?e.muteAllMembers=!0:e.muteAllMembers=!1),e.groupCustomField&&_t(this.groupCustomField,e.groupCustomField),lt(e.memberNum)||(this.memberCount=e.memberNum),lt(e.maxMemberNum)||(this.maxMemberCount=e.maxMemberNum),lt(e.isSupportTopic)||(this.isSupportTopic=Ke(e.isSupportTopic)?1===e.isSupportTopic:e.isSupportTopic),Ze(this,e,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),Ye(e.members)&&0e?(c.messageList=o.slice(r-e,r),c.nextReqMessageID=a?o[r-e].ID:o[r-e].sequence+""):(c.messageList=o.slice(0,r),c.isCompleted=!0):ei||n&&s.sequence>n)){if("in"===s.flow&&s.isRead)break;s.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t,n=!(1o&&e.sequence<=i:e.sequence>o&&e.sequenceo&&e.length<60?a._recursiveGetMsgList(e,t,n,i,o,s):a._emitMsgReceived(t,e)}))}},{key:"_emitMsgReceived",value:function(e,t){var n,i,o=this;0=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(n),e._checkCountMap.delete(n)):e._checkCountMap.set(n,++i)}))}},{key:"onNewGroupTips",value:function(e){be.l("".concat(this._n,".onNewGroupTips options:").concat(JSON.stringify(e.dataList)));var t=(e=this._assembly(e)).eventDataList,n=e.result;0<(e=e.AVChatRoomMessageList).length&&this._grpM.onAVChatRoomMessage(e),0=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(n),e._checkCountMap.delete(n)):e._checkCountMap.set(n,++i)}))}},{key:"updateLastMsg",value:function(e){var t="".concat(this._n,".updateLastMsg");if(0!==this._grpM.getGroupMap().size){for(var n,i,o,s,a=!1,r=e.length,c=0;c=this.CACHE_EXPIRE_TIME||a=this.EXPIRE_TIME?this._getRemoteGroupCounters({groupID:i,avChatRoomKey:s}).then((function(e){return a.setMoreMessage("from remote. count:".concat(e.length)).end(),be.l("".concat(n," from remote. groupID:").concat(i)),Cn({counters:e=t._getLocalCounters(i,o)})})).catch((function(e){return a.setError(e).end(),En(e)})):(a.setMoreMessage("from cache").end(),be.l("".concat(n," from cache. groupID:").concat(i)),Sn({counters:e=this._getLocalCounters(i,o)}))}},{key:"_getRemoteGroupCounters",value:function(e){var t=this;return this._grpM.req({P:jn.GET_GRP_COUNTER,data:g({},e)}).then((function(n){var i=void 0===(i=(n=n.data).counterList)?[]:i;return n=n.groupCounterSeq,t._updateLocalGroupCounters({groupID:e.groupID,counterList:i,groupCounterSeq:n}),be.l("".concat(t._n,"._getRemoteGroupCounters ok. groupID:").concat(e.groupID)),i})).catch((function(e){return En(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 t="".concat(this._n,"._updateGroupCounters"),n=e.groupID,i=e.avChatRoomKey,o=e.mode;return be.l("".concat(t,". groupID:").concat(n," avChatRoomKey:").concat(i," mode:").concat(o)),this._grpM.req({P:jn.UPDATE_GRP_COUNTER,data:g({},e)}).then((function(e){be.l("".concat(t," ok.")),e=e.data.counterList;var n={};return(void 0===e?[]:e).forEach((function(e){var t=e.key;e=e.value,n[t]=e})),n})).catch((function(e){return En(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,n,i,o=e.groupID,s=void 0===(s=e.counterList)?[]:s;e=e.groupCounterSeq,this._hasLocalGroupCounters(o)&&(i=this._getLocalGroupCounters(o),t=i.counters,n=i.avChatRoomKey,i=i.groupCounterSeq,0this._startBroadcastSeq&&(this._startBroadcastSeq=r),Ye(s)&&01e3*t.expireTime&&1e4=o&&t.messageList.push(e)})),(Ct({groupID:n})||St(n))&&0===t.messageList.length&&s[0].sequenceo.nextMessageSeq&&(o.updateNextMessageSeq(n),o.updateLastMessage(e),o.updateSelfInfo({readedSequence:t}),o.updateUnreadCount(0),this.emitOEvt(S.TOPIC_UPDATED,{groupID:i,topic:o}))}},{key:"onMessageModified",value:function(e){var t,n=e.to,i=e.time,o=e.sequence,s=e.elements,a=e.cloudCustomData,r=e.messageVersion,c=xt(n),u=this.getLocalTopic(c,n);u&&(t=u.lastMessage,be.d("".concat(this._n,".onMessageModified topicID:").concat(n," lastMessage:"),JSON.stringify(t),"options:",JSON.stringify(e)),t)&&(null===t.payload||t.lastTime===i&&t.lastSequence===o&&t.version!==r)&&(t.type=s[0].type,t.payload=s[0].content,t.messageForShow=Ft(t.type,t.payload,this.isIntl()),t.cloudCustomData=a,t.version=r,t.lastSequence=o,t.lastTime=i,this.emitOEvt(S.TOPIC_UPDATED,{groupID:c,topic:u}))}},{key:"onMessageRevoked",value:function(e){var t,n,i,o=this;0!==e.length&&(n=t=null,i=!1,e.forEach((function(e){var s=e.to;n=xt(s),(t=o.getLocalTopic(n,s))&&(t.reduceUnreadCount()&&(i=!0),t.isLastMessageRevoked(e)&&(t.setLastMessageRevoked(!0),t.setLastMessageRevoker(e.revoker),i=!0),(s=t.selfInfo.excludedUnreadSequenceList||[]).push(e.sequence),t.updateSelfInfo({excludedUnreadSequenceList:s}))})),i)&&this.emitOEvt(S.TOPIC_UPDATED,{groupID:n,topic:t})}},{key:"isLastMessageRevoked",value:function(e){var t=e.topicID,n=(e=e.sequence,xt(t));return n=this.getLocalTopic(n,t),t=!1,n?n.isLastMessageRevoked({sequence:e}):t}},{key:"updateUnreadCountAndLastMsg",value:function(e,t,n){var i,o=xt(e),s=this.getLocalTopic(o,e);s&&(i=s.selfInfo.excludedUnreadSequenceList||[],lt(n)||(i=n),t._isExcludedFromUnreadCount&&i.push(t.sequence),s.updateSelfInfo({excludedUnreadSequenceList:i}),be.l("".concat(this._n,".updateUnreadCountAndLastMsg seq:").concat(t.sequence," lastSeq:").concat(s.lastMessage.lastSequence)),t.sequence>s.lastMessage.lastSequence)&&(s.updateLastMessage(t),n=t.sequence+1,s.updateNextMessageSeq(n),i=this._computeUnreadCount(s),s.updateUnreadCount(i),(t=this.get(11).getLocalConversation("".concat(E.CONV_GROUP).concat(e)))&&t.updateUnreadCount({nextUnreadCount:i,isFromGetConversations:!0}),this.emitOEvt(S.TOPIC_UPDATED,{groupID:o,topic:s}))}},{key:"getJoinedCommunityList",value:function(){return this.get(7).syncCommunityWithTopic()}},{key:"createTopicInCommunity",value:function(e){var t,n=this,i="".concat(this._n,".").concat("createTopicInCommunity"),o=e.topicID;return lt(o)||St(o)?e.topicName&&!1===this._filterProfanity("topicName",e)||e.introduction&&!1===this._filterProfanity("introduction",e)||e.notification&&!1===this._filterProfanity("notification",e)?En({code:qn.PROFANITY_FOUND}):(t=new oi("createTopicInCommunity"),this.req({P:jn.CREATE_TOPIC,data:g({},e)}).then((function(o){return o=o.data.topicID,t.setMessage("topicID:".concat(o)).end(),be.l("".concat(i," ok. topicID:").concat(o)),n._updateTopicMap([g(g({},e),{},{topicID:o})]),Cn({topicID:o})})).catch((function(e){return t.setError(e).end(),be.e("".concat(i," failed. error:"),e),En(e)}))):En({code:qn.ILLEGAL_TOPIC_ID})}},{key:"deleteTopicFromCommunity",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteTopicFromCommunity"),i=e.groupID,o=(e=void 0===(e=e.topicIDList)?[]:e,new oi("deleteTopicFromCommunity"));return o.setMessage("groupID:".concat(i," topicIDList:").concat(e)),this.req({P:jn.DEL_TOPIC,data:{groupID:i,topicIDList:e}}).then((function(e){e=e.data.resultList;var s=[],a=[];return(void 0===e?[]:e).forEach((function(e){var t=e.topicID,n=e.errorCode;e=e.errorInfo,0===n?s.push({topicID:t}):a.push({topicID:t,code:n,message:e})})),e="success count:".concat(s.length,", fail count:").concat(a.length),o.setMoreMessage(e).end(),be.l("".concat(n," ok. ").concat(e)),s.forEach((function(e){t._deleteLocalTopic(i,e.topicID)})),Cn({successTopicList:s,failureTopicList:a})})).catch((function(e){return o.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(e)}))}},{key:"updateTopicProfile",value:function(e){var t,n=this,i="".concat(this._n,".").concat("updateTopicProfile");return be.l("".concat(i," options:"),e),e.topicName&&!1===this._filterProfanity("topicName",e)||e.introduction&&!1===this._filterProfanity("introduction",e)||e.notification&&!1===this._filterProfanity("notification",e)?En({code:qn.PROFANITY_FOUND}):((t=new oi("updateTopicProfile")).setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),lt(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.req({P:jn.UPDATE_TOPIC_PROFILE,data:g({},e)}).then((function(){return t.end(),be.l("".concat(i," ok")),n._updateTopicMap([e]),Cn({topic:n.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return t.setError(e).end(),be.e("".concat(i," failed. error:"),e),En(e)})))}},{key:"getTopicList",value:function(e){var t=this,n="".concat(this._n,".").concat("getTopicList"),i=e.groupID,o=0===(e=void 0===(e=e.topicIDList)?[]:e).length,s=new oi("getTopicList");if(s.setMessage("groupID:".concat(i)),this._getTopicTimeMap.has(i)){var a=(r=this._getTopicTimeMap.get(i)).isGetAll,r=r.time;if((a||!a&&!o)&&Date.now()-r<1e3*this.TOPIC_CACHE_TIME&&(a=this._getLocalTopicList(i,e),o||a.length===e.length))return s.setMoreMessage("from cache, topic count:".concat(a.length)).end(),be.l("".concat(n," groupID:").concat(i," from cache, topic count:").concat(a.length)),Sn({successTopicList:a,failureTopicList:[]})}return this.req({P:jn.GET_TOPIC_LIST,data:{groupID:i,topicIDList:e}}).then((function(e){e=e.data.topicInfoList;var a=[],r=[],c=[];return(void 0===e?[]:e).forEach((function(e){var t=e.topic,n=e.selfInfo,i=e.errorCode,o=(e=e.errorInfo,t.topicID);0===i?(a.push(g(g({},t),{},{selfInfo:n})),r.push(o)):c.push({topicID:o,code:i,message:e})})),t._updateTopicMap(a),t._handleTopicAtInfo(a),e="success count:".concat(r.length,", fail count:").concat(c.length),s.setMoreMessage(e).end(),be.l("".concat(n," groupID:").concat(i," from remote, ").concat(e)),e=[],qe(r)||(t._getTopicTimeMap.set(i,{time:Date.now(),isGetAll:o}),e=t._getLocalTopicList(i,r)),Cn({successTopicList:e,failureTopicList:c})})).catch((function(e){return s.setError(e).end(),be.e("".concat(n," failed. error:"),e),En(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)?this._topicMap.get(e).get(t):n}},{key:"_getLocalTopicList",value:function(e){var t=1this.MAX_QUERY_USER_COUNT&&(be.w("".concat(t," ").concat(jt(this.MAX_QUERY_USER_COUNT))),i=n.slice(0,this.MAX_QUERY_USER_COUNT));var a=new oi("getUserStatus");return this._userM.req({P:jn.GET_USER_STATUS,data:{userIDList:i}}).then((function(e){var i=void 0===(i=(e=e.data).successUserList)?[]:i,s=(e=void 0===(e=e.failureUserList)?[]:e,i=i.map((function(e){return{userID:e.userID,statusType:e.statusType,customStatus:Bi(e=e.customStatus)}})),e=e.map((function(e){var t=e.userID,n=e.invalidUserID,i=e.errorCode;return e=e.errorInfo,{userID:qe(n)?t:n,code:i,message:e}})),lt(o)||i.unshift(o),"userID count:".concat(n.length,", success count:").concat(i.length,", fail count:").concat(e.length));return a.setMessage("".concat(s)).end(),be.l("".concat(t," ok. ").concat(s,".")),Cn({successUserList:i,failureUserList:e})})).catch((function(e){return a.setMessage("userID count:".concat(n.length)).setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))}},{key:"subscribeUserStatus",value:function(e){var t,n,i,o,s="subscribeUserStatus";return this._userM.canIUse(N.USER_STATUS)?(t="".concat(this._n,".").concat(s),(n=v(e=void 0===(e=e.userIDList)?[]:e)).length>this.MAX_SUBSCRIBE_USER_COUNT&&(be.w("".concat(t," ").concat(jt(this.MAX_SUBSCRIBE_USER_COUNT))),n=e.slice(0,this.MAX_SUBSCRIBE_USER_COUNT)),i=new oi(s),o="userID count:".concat(e.length),be.l("".concat(t," ").concat(o)),this._userM.req({P:jn.SUB_USER_STATUS,data:{userIDList:n}}).then((function(e){return e=(void 0===(e=e.data.failureUserList)?[]:e).map((function(e){var t=e.userID,n=e.invalidUserID,i=e.errorCode;return e=e.errorInfo,{userID:qe(n)?t:n,code:i,message:e}})),i.setMessage("".concat(o," fail count:").concat(e.length)).end(),be.l("".concat(t," ok. fail count:").concat(e.length,".")),Cn({failureUserList:e})})).catch((function(e){return i.setMessage(o).setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._userM.noUse(s)}},{key:"unsubscribeUserStatus",value:function(e){var t,n,i,o,s="unsubscribeUserStatus";return this._userM.canIUse(N.USER_STATUS)?(t="".concat(this._n,".").concat(s),n=v(e=void 0===(e=(e||{}).userIDList)?[]:e),e.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(be.w("".concat(t," ").concat(jt(this.MAX_UNSUBSCRIBE_USER_COUNT))),n=e.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT)),i=new oi(s),o="userID count:".concat(e.length),be.l("".concat(t," ").concat(o)),e={userIDList:n},0===n.length&&(e.userIDList=void 0,e.unsubscribeAll=1),this._userM.req({P:jn.UNSUB_USER_STATUS,data:e}).then((function(e){return e=(void 0===(e=e.data.failureUserList)?[]:e).map((function(e){var t=e.userID,n=e.invalidUserID,i=e.errorCode;return e=e.errorInfo,{userID:qe(n)?t:n,code:i,message:e}})),i.setMessage("".concat(o," fail count:").concat(e.length)).end(),be.l("".concat(t," ok. fail count:").concat(e.length,".")),Cn({failureUserList:e})})).catch((function(e){return i.setMessage("".concat(o)).setError(e).end(),be.e("".concat(t," failed. error:"),e),En(e)}))):this._userM.noUse(s)}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),yo=(u(Eo,wn),s(Eo,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"mockOnNickAvatarModified",value:function(e,t){be.l("".concat(this._n,"._mockOnNickAvatarModified nick:").concat(e," avatar:").concat(t)),this.onProfileModified({dataList:[{pushType:1,userID:this.getMyUserID(),profileList:[{tag:Le.NICK,value:e},{tag:Le.AVATAR,value:t}]}]})}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t,n;qe(e=e.dataList)||(t=[],e.forEach((function(e){e.blackListDelAccount&&t.push.apply(t,v(e.blackListDelAccount))})),0=this.MIN_THRESHOLD)&&this._report()}},{key:"onCheckTimer",value:function(){Date.now()n.MAX_THRESHOLD&&n._flushAtOnce()}))):this._lastReportTime=Date.now())}},{key:"_flushAtOnce",value:function(){var e=this.get(13),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory(),i="".concat(this._n,"._flushAtOnce");qe(t)?(be.l("".concat(i," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)):((n=n.concat(t)).length>this.MAX_THRESHOLD&&(n=n.slice(0,this.MAX_THRESHOLD)),be.l("".concat(i," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1))}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}])),Po="none",No="online",wo=s((function e(t){i(this,e),this._m=t,this._networkType=No,this._n="NetMonitorModule",this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null,this._removeListener=null,this._m.getIEmitInst().on(Ni.A2KEY_AND_TINYID_UPDATED,this._startRN,this)}),[{key:"_startRN",value:function(){var e,t=this;ee&&(e=this._m.get(18).getPlugin("chat-network-monitor"))&&(this._removeListener=e.addEventListener((function(e){var n=e.isConnected;e=e.type,t._networkType!==e&&t._onNetworkStatusChange({isConnected:void 0!==n&&n,networkType:e})})))}},{key:"start",value:function(){var e=this,t="".concat(this._n,".start");Q?(ne.getNetworkType({success:function(n){e._networkType=n.networkType||n.subtype||"",n.networkType===Po?be.w("".concat(t," no network, please check!")):be.i("".concat(t," networkType:").concat(n.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),ne.onNetworkStatusChange(this._mpNetworkStatusCallback)):te&&(this._networkType=No,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback))}},{key:"_onWebOnline",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:No})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:Po})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,n=(e=e.networkType,"".concat(this._n,"._onNetworkStatusChange")),i=!1,o="previous:".concat(this._networkType," current:").concat(e);t?(be.i("".concat(n," ").concat(o)),this._networkType!==e&&(i=!0,this._networkType=e,this._m.get(21).reConnect(!0))):this._networkType!==e&&(i=!0,this._networkType=e,be.w("".concat(n," no network, please check!")),this._m.get(21).offline()),i&&new oi("networkChange").setMessage("isConnected:".concat(t," ").concat(o)).end()}},{key:"isOnline",value:function(){return this._networkType!==Po}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),Q?null!==this._mpNetworkStatusCallback&&(ne.offNetworkStatusChange&&ne.offNetworkStatusChange(this._mpNetworkStatusCallback),this._mpNetworkStatusCallback=null):te?(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null)):ee&&this._removeListener&&(this._removeListener(),this._removeListener=null)}}]);function Uo(e){i(this,Uo),(e=n(this,Uo,[e]))._n="EventStatModule",e.TAG="im-ssolog-event",e._reportBody=new Ao,e.MIN_THRESHOLD=20,e.MAX_THRESHOLD=100,e.WAITING_TIME=6e4,e.REPORT_LEVEL=[4,5,6],e.REPORT_SDKAPPID_BLACKLIST=[],e.REPORT_TINYID_WHITELIST=[],e._lastReportTime=Date.now();var t=e.getIEmitInst();return t.on(Ni.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,e),t.on(Ni.CLOUD_CONFIG,e._onCloudConfig,e),e}function Go(e,t){return e(t={exports:{}},t.exports),t.exports}var xo=Go((function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,i,s,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");return i=new o(i,s||e,a),s=n?n+t:t,e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],i]:e._events[s].push(i):(e._events[s]=i,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function r(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),r.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},r.prototype.listeners=function(e){e=n?n+e:e;var t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var i=0,o=t.length,s=new Array(o);i=this.cosOptions.expiredTime-120&&this._getAuthorizationKey()}},{key:"getFileDNList",value:function(){return this._fileDNList}},{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._relayFlag)return Promise.resolve();var t=this.get(26);switch(e.type){case E.MSG_IMAGE:return t.addTotalCount(Jn),this._uploadImage(e);case E.MSG_FILE:return t.addTotalCount(Jn),this._uploadFile(e);case E.MSG_AUDIO:return t.addTotalCount(Jn),this._uploadAudio(e);case E.MSG_VIDEO:return t.addTotalCount(Jn),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var t=this,n=this.get(2),i=e.getElements()[0],o=n.getMessageOption(e.clientSequence);return this.doUploadImage({file:o.payload.file,to:o.to,message:e,onProgress:function(e){if(i.updatePercent(e),Je(o.onProgress))try{o.onProgress(e)}catch(t){return En({code:qn.MSG_ONPROGRESS_ERR})}}}).then((function(n){var o=n.location,s=n.fileType,a=n.fileSize,r=n.width,c=n.height,u=n.smallImageUrl,l=n.smallImageWidth,d=n.smallImageHeight,p=n.largeImageUrl,h=n.largeImageWidth,f=n.largeImageHeight,m=n.imageInfoArray;n=t.isPrivateNetWork()?o:at(o),i.updateImageFormat(s);var _,v,y={size:a,url:n,width:r,height:c};if(m&&0this.UPLOAD_SIZE_LIMIT.F?this._checkSizeError("F"):0===e.file.files[0].size?En({code:qn.MSG_F_IS_EMPTY}):(this._setUploadFileType(255),this.uploadByCOS(e))}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.V?this._checkSizeError("V"):0===e.file.videoFile.size?En({code:qn.MSG_F_IS_EMPTY}):-1===Vi.indexOf(e.file.videoFile.type)?En({code:qn.MSG_V_TYPES_LIMIT}):(this._setUploadFileType(2),Q||ee?this.handleVideoUpload(g(g({},e),{},{file:e.file.videoFile})):te?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var t=this;return new Promise((function(n,i){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){i(new Bn({code:qn.MSG_V_UPLOAD_FAIL}))}))}))}))}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.A?this._checkSizeError("A"):0===e.file.size?En({code:qn.MSG_F_IS_EMPTY}):(this._setUploadFileType(3),this.uploadByCOS(e)):En({code:qn.MSG_A_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(e){var t,n,i,o,s=this;return Je(this._cosUploadMethod)?this.timUploadPlugin?this._uploadWithPreSigUrl(e):(t=new oi("upload"),n="".concat(this._n,".uploadByCOS"),i=Date.now(),o=this._getFile(e),new Promise((function(a,r){var c=Q?s._createCosOptionsWXMiniApp(e):s._createCosOptionsWeb(e),u=s;s._cosUploadMethod(c,(function(e,c){var l,d,p=Object.create(null);c?e||Ye(c.files)&&c.files[0].error?(l=new Bn({code:qn.MSG_F_UPLOAD_FAIL}),t.setError(l).end(),be.l("".concat(n," failed. error:"),c.files[0].error),403===c.files[0].error.statusCode&&s._getAuthorizationKey(),r(l)):(p.fileName=o.name,p.fileSize=o.size,p.fileType=o.type.slice(o.type.indexOf("/")+1).toLowerCase(),p.location=(Q?c:c.files[0].data).Location,l=Date.now()-i,c=u._formatFileSize(o.size),d=u._formatSpeed(1e3*o.size/l),c="size:".concat(c," time:").concat(l,"ms speed:").concat(d),be.l("".concat(n," success. name:").concat(o.name," ").concat(c)),a(p),(d=s.get(26)).addCost(Jn,l),d.addFileSize(Jn,o.size),t.setMessage(c).end()):(p=new Bn({code:qn.MSG_F_UPLOAD_FAIL}),t.setError(p).end(),be.w("".concat(n," failed. error:"),e),403===e.statusCode&&s._getAuthorizationKey(),r(p))}))}))):(this.warn("PluginUndetected"),En({code:qn.COS_UNDETECTED}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,n="".concat(this._n,"._uploadWithPreSigUrl"),i=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(o,s){var a=new oi("upload"),r=e.requestSnapshotUrl,c=void 0===r?void 0:r,u=f(e,Bo),l=Date.now();t._cosUploadMethod(u,(function(r,d){if(r||403===d.statusCode)a.setError(new Bn(r)).end(),h={HttpStatusCode:9999,CostTime:zt(l,!1),error:r,url:e.url},d.data&&d.data.uploadIP&&(h.uploadIP=d.data.uploadIP),t._uploadSSOLog(h),be.l("".concat(n," failed, error:"),r),s(new Bn({code:qn.MSG_F_UPLOAD_FAIL}));else{var p=Object.create(null),h=d.data.location||"",g=(t.isPrivateNetWork()||0!==h.indexOf("https://")&&0!==h.indexOf("http://")||(h=h.split("//")[1]),p.fileName=i.name,p.fileSize=i.size,p.fileType=i.type.slice(i.type.indexOf("/")+1).toLowerCase(),p.location=h,r=zt(l,!1),h=t._formatFileSize(i.size),t._formatSpeed(1e3*i.size/r));if(h="size:".concat(h," time:").concat(r,"ms speed:").concat(g," res:").concat(JSON.stringify(d.data)),be.l("".concat(n," ok. name:").concat(i.name," ").concat(h)),a.setMessage(h).end(),g={HttpStatusCode:d.statusCode,FileSize:i.size,CostTime:r,url:e.url},(d.data&&d.data.uploadIP&&(g.uploadIP=d.data.uploadIP),t._uploadSSOLog(g),h=t.get(26)).addCost(Jn,r),h.addFileSize(Jn,i.size),g=[],u.thumbUrl&&u.largeUrl&&g.push.apply(g,[t._getSmallImageInfoByUrl(u.thumbUrl,p),t._getLargeImageInfoByUrl(u.largeUrl,p)]),1===t.uploadFileType&&t.isSimpleCos&&!t.isPrivateNetWork()&&(g.push(t._getImageInfoArray(u.downloadUrl,p)),d.data.uploadIP)&&g.push(t._getDownloadIP(u.downloadUrl.split("//")[1].split("/")[0],p)),c&&g.push(t._getSnapshotInfoByUrl(c,p)),0>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533;else t<=57343&&(t=65533);return t<=2047?ls(192|t>>>6,128|63&t):ls(224|t>>>12,128|t>>>6&63,128|63&t)},ps=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,ds),n=0|t.length,i=new Uint8Array(n),o=0;o=s&&(be.l("".concat(e._n,"._checkPromiseMap request timeout, delete requestID:").concat(n)),e._promiseMap.delete(n),i(new Bn({code:qn.NETWORK_TIMEOUT,data:{headSeq:t}})),e._chM.onRequestTimeout())}))}},{key:"_checkNativeAppWS",value:function(){$&&!this.isConnected()&&this._reConnect()}},{key:"onOpen",value:function(e){var t,n;this._readyState!==vs&&(this._onOpenTs=Date.now(),n=e.id,e=e.res,this._socketID=n,t=zt(this._startTs,!1),n="socketID:".concat(n," res:").concat(e),be.l("".concat(this._n,"._onOpen cost:").concat(t," ms. ").concat(n)),new oi("wsOnOpen").setMessage(t).setCostTime(t).setMoreMessage(n).end(),this._readyState=ms,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._chM.onReconnected(),this._reConnectFlag=!1),this._chM.onOpen())}},{key:"onClose",value:function(e){var t=new oi("wsOnClose"),n=e.id,i=(e=e.e,"sourceSocketID:".concat(n," currentSocketID:").concat(this._socketID," code:").concat(e.code," reason:").concat(e.reason)),o=0;0!==this._onOpenTs&&(o=Date.now()-this._onOpenTs),t.setMessage(o).setCostTime(o).setMoreMessage(i).setCode(e.code).end(!0),be.l("".concat(this._n,"._onClose ").concat(i," onlineTime:").concat(o)),n===this._socketID&&(this._readyState=vs,o<1e3?this._chM.onReconnectFailed():this._chM.onClose())}},{key:"onError",value:function(e){var t=e.id,n=(e=e.e,"sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID));new oi("wsOnError").setMessage(e.errMsg||JSON.stringify(e,["message","code"])).setMoreMessage(n).setLevel("error").end(!0),be.w("".concat(this._n,"._onError"),e,n),t===this._socketID&&(this._readyState=vs,this._chM.onError())}},{key:"onMessage",value:function(e){var t,n,i,o,s,a;try{t=JSON.parse(e.data)}catch(r){new oi("jsonParseError").setMessage(e.data).end()}t&&t.head&&(e=this._getRequestIDFromHead(t.head),n=t.body,this._chM.get(30).isTRTCCommand(e)||(a=Nt(t.head),n=function e(t,n){var i,o,s;return Ye(t)?t.map((function(t){return ze(t)?e(t,n):t})):ze(t)?(i=t,o=function(e,t){return lt(n[t])?rs(t):n[t]},s={},Object.keys(i).forEach((function(e){s[o(i[e],e)]=i[e]})),Dt(s,(function(t){return Ye(t)||ze(t)?e(t,n):t}))):void 0}(t.body,this._getResKeyMap(a))),be.d("".concat(this._n,".onMessage ret:").concat(JSON.stringify(n)," requestID:").concat(e," has:").concat(this._promiseMap.has(e))),this._setNextPingTs(),this._promiseMap.has(e)?(i=(a=this._promiseMap.get(e)).resolve,o=a.reject,s=a.timestamp,a=a.headSeq,this._promiseMap.delete(e),this._calcRTT(s),n.errorCode&&0!==n.errorCode?(this._chM.onErrorCodeNotZero(n),o(new Bn({code:n.errorCode,message:n.errorInfo||"",data:e.includes(jn.MODIFY_C2C_MSG)||e.includes(jn.MODIFY_GRP_MSG)?{elements:n.elements,messageVersion:n.messageVersion,cloudCustomData:n.cloudCustomData,headSeq:a}:{headSeq:a}}))):i(Cn(n))):this._chM.onMessage({head:t.head,body:n}))}},{key:"_calcRTT",value:function(e){e=Date.now()-e,this._chM.get(26).addRTT(e)}},{key:"_connect",value:function(){this._readyState!==_s&&this._readyState!==ms&&(this._startTs=Date.now(),this._onOpenTs=0,this._readyState=_s,this._socket=new hs(this),this._socketID=this._socket.getID(),be.l("".concat(this._n,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new oi("wsConnect").setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end())}},{key:"getURL",value:function(){this._chM.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=bt(),t=((W||V&&"windows"===e||$)&&(this._canIUseBinaryFrame=!1),-1),n=("ios"===e?t=ae||-1:"android"===e&&(t=ce||-1),this._chM.get(12)),i=this._chM.getPlatform(),o=n.getSDKAppID();return n=n.getInstanceID(),o="sdkappid=".concat(o,"&instanceid=").concat(n,"&random=").concat(this._getRandom(),"&platform=").concat(i,"&host=").concat(e)+"&version=".concat(t,"&sdkversion=").concat("3.5.5"),j&&(o+="&isminigame=1"),this._chM.canIUseInflate()&&(o+="&compress=gzip"),(this._canIUseBinaryFrame?"".concat(this._url,"/binfo?"):"".concat(this._url,"/info?")).concat(o)}},{key:"_closeConnection",value:function(e){be.l("".concat(this._n,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=vs)}},{key:"_resend",value:function(){var e=this;if(be.l("".concat(this._n,"._resend reConnectFlag:").concat(this._reConnectFlag),"promiseMap.size:".concat(this._promiseMap.size," simpleRequestMap.size:").concat(this._simpleRequestMap.size)),0>>=1:i=i>>>1^3988292384}return(4294967295^i)>>>0}},{key:"close",value:function(){be.l("".concat(this._n,".close")),this._closeConnection(4e3),this._promiseMap.clear(),this._startSequence=it(),this._readyState=vs,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}]),Is=function(e,t,n){return new Promise((function(i,o){var s,a,r="application/x-www-form-urlencoded;charset=UTF-8";Q?ne.request({url:t,data:n,method:e,timeout:3e3,header:{"content-type":r},success:function(e){e&&e.data&&e.data.NetCheckInfo&&be.l("".concat("getconninfo ok in"," miniapp. ret:"),e.data),i()},fail:function(){o(new Bn({code:qn.NETWORK_ERROR}))}}):(s=new XMLHttpRequest,a=setTimeout((function(){s.abort(),o(new Bn({code:qn.NETWORK_TIMEOUT}))}),3e3),s.onreadystatechange=function(){4===s.readyState&&(a&&clearTimeout(a),200===s.status||304===s.status?(s.responseText&&-1=this._socketHandler.getNextPingTs()&&this._ping()}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),-1>>30-e)}function ws(e,t){for(var n=e.toString(16),i=t-n.length,o="0";0>>=1,o+=o)1&i&&(n=o+n);return n}u(Da,wn);var Us=s(Da,[{key:"_init",value:function(){this._updateCmdFreqLimitMap(Ds)}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");lt(e)||(e=JSON.parse(e),this._updateCmdFreqLimitMap(e))}},{key:"_updateCmdFreqLimitMap",value:function(e){var t=this;e.forEach((function(e){t._cmdFreqLimitMap.set(e.cmd,{interval:e.interval,count:e.count})}))}},{key:"updateProtocolConfig",value:function(){this._pHandler.update()}},{key:"req",value:function(e){be.d("".concat(this._n,".req options:"),e);var t,n,i=e.P;return this._pHandler.has(i)?(t=(e=this.getProtocolData(e)).head.servcmd,this._isFreqOverLimit(t)?En({code:n=qn.OVER_FREQUENCY_LIMIT,message:this.getErrMsg(n,this._getCmd(t))}):this._isServerOverload(t)?En({code:n=qn.OPEN_SERVICE_OVERLOAD_ERROR,message:this.getErrMsg(n,this._getCmd(t))}):(n=this.get(21),Ts.includes(i)?n.simplySend(e):n.send(e))):(be.w("".concat(this._n,".req unknown P:").concat(i)),En({code:qn.NO_PROTOCOL}))}},{key:"getKeyMap",value:function(e){return this._pHandler.getKeyMap(e)}},{key:"genCommonHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:A,websdkversion:b,a2:e.getA2Key()||void 0,tinyid:e.getTinyID()||void 0,status_instid:e.getStatusInstanceID(),sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getA2Key()?void 0:e.getUserID(),usersig:e.getA2Key()?void 0:e.getUserSig(),sdkability:75689843,sdkability_ext:Ps(""),cappid:e.getApplicationID(),cs:0}}},{key:"genCosSpecifiedHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:A,websdkversion:b,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:75689843,sdkability_ext:Ps(""),cappid:e.getApplicationID(),cs:0}}},{key:"genSSOReportHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:A,websdkversion:b,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:75689843,sdkability_ext:Ps(""),cappid:e.getApplicationID(),cs:0}}},{key:"getProtocolData",value:function(e){return this._pHandler.getProtocolData(e)}},{key:"trans",value:function(e){var t=e.servcmd;return e=e.data,t={head:g(g({},this.genCommonHead()),{},{servcmd:t}),body:e},this.get(21).send(t)}},{key:"sendComboMessage",value:function(e){var t=e.servcmd;return e=e.data,t={head:g(g({},this.genCommonHead()),{},{servcmd:t}),body:e},this.get(21).send(t)}},{key:"onErrorCodeNotZero",value:function(e){var t,n=e.errorCode;n===qn.HELLO_ANSWER_KICKED_OUT&&(t=e.kickType,e=void 0===(e=e.newInstanceInfo)?{}:e,1===t?this.onMultipleAccountKickedOut(e):2===t?this.onMultipleDeviceKickedOut(e):3===t&&this.onRestApiKickedOut(e)),n!==qn.MSG_A2KEY_EXPIRED&&n!==qn.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.get(21).reConnect())}},{key:"onMessage",value:function(e){var t=(n=e.body).needAck,n=n.sessionData;1===(void 0===t?0:t)&&this._sendACK(n),this._msgDispatcher.onMessage(e)}},{key:"onReconnected",value:function(e){this._incrementalPullContactFlag=e<=300,this._reLoginOnReconnected()}},{key:"reLoginOnKickOther",value:function(){be.l("".concat(this._n,".reLoginOnKickOther")),this._reLogin()}},{key:"_reLoginOnReconnected",value:function(){be.l("".concat(this._n,"._reLoginOnReconnected")),this._reLogin()}},{key:"_reLogin",value:function(){var e,t,n,i=this,o="".concat(this._n,"._reLogin");this.isLoggedIn()&&(e=0,(t=this.get(1).getPushModule())&&(e=t.getUniAppPlatform()),n=new oi("reLogin"),this.req({P:jn.LOGIN,data:{isWebUniapp:e,customInfo:this.get(12).getCustomLoginInfo()}}).then((function(e){var t=(e=e.data).instanceID,s=(e=e.customStatus,i.get(12)),a=Bi(e),r=(s.setStatusInstanceID(t),i.get(21)),c=r.getSocketID();c="socketID:".concat(c," instanceID:").concat(t," customStatus:").concat(a),n.setMessage(c).end(!0),be.l("".concat(o," ok. ").concat(c)),s.getCustomStatus()!==a&&i.get(4).onUserStatusUpdated({dataList:[{to:i.getMyUserID(),statusType:E.USER_STATUS_ONLINE,customStatus:e}]}),r.diagnose(),i.get(11).syncConvList(i._incrementalPullContactFlag).then((function(){be.l("".concat(o,", sync conv list ok.")),i.get(25).start()})),((t=i.get(7))&&t.updateLocalMainSequenceOnReconnected(),c=i.get(10)).resetGetTopicTime(),c.getTopicListOnReconnected(),(s=i.get(35))&&s.clearCacheOnReconnected(),(a=i.get(8))&&a.updateCacheOnReconnected()})))}},{key:"onMultipleAccountKickedOut",value:function(e){this.get(1).onMultipleAccountKickedOut(e)}},{key:"onMultipleDeviceKickedOut",value:function(e){this.get(1).onMultipleDeviceKickedOut(e)}},{key:"_onUserSigExpired",value:function(){this.get(1).onUserSigExpired()}},{key:"onRestApiKickedOut",value:function(e){this.get(1).onRestApiKickedOut(e)}},{key:"_sendACK",value:function(e){this.req({P:jn.MSG_PUSH_ACK,data:{sessionData:e}})}},{key:"_isFreqOverLimit",value:function(e){var t,n,i,o;return e=e.split(".")[1],!!this._cmdFreqLimitMap.has(e)&&(!this._cmdReqInfoMap.has(e)||(t=(n=this._cmdFreqLimitMap.get(e)).count,n=n.interval,i=(o=this._cmdReqInfoMap.get(e)).startTime,o=o.requestCount,Date.now()-i>1e3*n)?(this._cmdReqInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1):(this._cmdReqInfoMap.set(e,{startTime:i,requestCount:o+=1}),t=this._expiredTime}},{key:"fetchConfig",value:function(){var e,t=this,n="".concat(this._n,".fetchConfig"),i=this._canFetch();be.l("".concat(n," canFetch:").concat(i)),i&&(e=new oi("fetchCloudCtrlConfig"),i=this.get(12).getSDKAppID(),this._isFetching=!0,this.req({P:jn.FETCH_CLOUD_CTRL_CONFIG,data:{SDKAppID:i,version:this._version}}).then((function(i){t._isFetching=!1;var o=(s=i.data).version,s=s.cloudControlConfig;e.setMessage("version:".concat(t._version," newVersion:").concat(o," config:").concat(s)).end(),be.l("".concat(n," ok")),t._parse(i.data)})).catch((function(i){t._isFetching=!1,e.setError(i).end(),be.l("".concat(n," failed. error:"),i),t._setExpiredTime(12e4)})))}},{key:"onPushedConfig",value:function(e){be.l("".concat(this._n,".onPushedConfig config:"),e),new oi("pushedCloudCtrlConfig").setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parse(e)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"_parse",value:function(e){var t=this,n="".concat(this._n,"._parse"),i=e.errorCode,o=e.errorMessage,s=e.cloudControlConfig,a=e.version,r=e.expiredTime;if(0===i){if(this._version!==a){var c=null;try{c=JSON.parse(s)}catch(u){this.isPrivateNetWork()||be.e("".concat(n," failed. config:"),s)}c&&(this._cloudConfig.clear(),Object.keys(c).forEach((function(e){t._cloudConfig.set(e,c[e])})),this._version=a,this.emitIEvt(Ni.CLOUD_CONFIG),this.emitOEvt(S.SERVER_CONFIG_UPDATED,{config:c}))}this._setExpiredTime(1e3*r)}else lt(i)?(be.l("".concat(n," failed. Invalid message format:"),e),this._setExpiredTime(36e5)):(be.e("".concat(n," errorCode:").concat(i," errorMessage:").concat(o)),this._setExpiredTime(12e4))}},{key:"_setExpiredTime",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}])),xs=(u(Ta,wn),s(Ta,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var e,t,n,i,o=this,s=this._getLocalConvList().filter((function(e){return e.type===E.CONV_GROUP&&e.groupProfile.type!==E.GRP_AVCHATROOM})),a=this.get(11),r=[];s.forEach((function(s){var c=s.conversationID;s=s.lastMessage,e=c.replace(E.CONV_GROUP,""),t=a.getLocalLastMessage(c),s&&0!==s.lastSequence&&t&&(n=s.lastSequence,t=t.sequence,i=n-t,0n[0])&&s",n[c].tag)}this.profile=new ji(g(g({},o),{},{profileCustomField:s}))}),[{key:"validate",value:function(e){var t,n=!0,i="";if(qe(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,s=null,a=0;a",e[s].tag)}}();this.timestamp=Date.now(),o.length=0}},{key:"updateProfile",value:function(e){this.profile=JSON.parse(JSON.stringify(e)),this.timestamp=Date.now()}},{key:"addToGroupList",value:function(e){-1===this.groupList.indexOf(e)&&(this.groupList.push(e),this.count=this.groupList.length)}},{key:"removeFromGroupList",value:function(e){-1<(e=this.groupList.indexOf(e))&&(this.groupList.splice(e,1),this.count=this.groupList.length)}}]),Ws=s((function e(t){i(this,e),this._snsM=t,this._n="FriendHandler",this._map=new Map,this._startIdx=0,this._standardSeq=0,this._customSeq=0,this._expirationTime=18e4}),[{key:"updateCacheOnReconnected",value:function(){this._startIdx=0,this._standardSeq=0,this._customSeq=0,this.pagingGetFriendList()}},{key:"getLocalFriendList",value:function(){return v(this._map.values())}},{key:"getFriendRemark",value:function(e){return this._map.has(e)?this._map.get(e).remark:""}},{key:"onFriendProfileModified",value:function(e){var t,n=this;qe(e=e.dataList)||(t=this._snsM.get(11),e.forEach((function(e){var i,o=e.userID;e=e.profileList,n.isMyFriend(o)&&(be.l("".concat(n._n,".onFriendProfileModified. friend account:").concat(o,", profileList:").concat(JSON.stringify(e))),(i=n._map.get(o)).update(e),t.modifyMessageSentByPeer({conversationID:"".concat(E.CONV_C2C).concat(o),latestNick:i.profile.nick,latestAvatar:i.profile.avatar}))})),this._onFriendListUpdated())}},{key:"onFriendAdded",value:function(e){var t=this;0!==e.length&&(be.l("".concat(this._n,".onFriendAdded userIDList:").concat(e)),e.forEach((function(e){t._map.set(e,new zs(e))})),this.getFriendProfile({userIDList:e}).then((function(n){e.forEach((function(e){var n=t._map.get(e);0 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),(t=this)._workerTimer.onmessage=function(e){e.data?(t._timerID=e.data,be.l("".concat(t._n,"._init seed:").concat(t._timerID))):t._m.onCheckTimer()})}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("enable_worker");be.l("".concat(this._n,"._onCloudConfig enableWorker:").concat(e)),lt(e)||"1"===e?!this._isWorkerEnabled&&he&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&he&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:"terminate",value:function(){be.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(){be.l("".concat(this._n,".reset"))}}])),Qs=s((function e(t){i(this,e),this._commercialConfigM=t,this._n="PurchasedFeatureHandler",this._isCSPluginReported=!1,this._featureMap=new Map}),[{key:"isValidPurchaseBits",value:function(e){return e&&"string"==typeof e&&1<=e.length&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){if(this.isValidPurchaseBits(e)){this._featureMap.clear();for(var t,n=e.length-1,i=0;0<=n;n--,i++)t=(i<32?new D(0,Math.pow(2,i)):new D(Math.pow(2,i-32),0)).toString(),"1"===e[n]?this._featureMap.set(t,!0):this._featureMap.set(t,!1)}else be.w("".concat(this._n,".parsePurchaseBits invalid purchasebits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._featureMap.get(e)}},{key:"isFeatureEnabled",value:function(e){for(var t=parseInt(e).toString(2),n=void 0,i=!0,o=t.length-1,s=0;0<=o;o--,s++)if("1"===t.charAt(o)&&(n=(s<32?new D(0,Math.pow(2,s)):new D(Math.pow(2,s-32),0)).toString(),!this._featureMap.get(n))){i=!1;break}return be.l("".concat(this._n,".isFeatureEnabled decimalNumber:").concat(e," key:").concat(n," ret:").concat(i)),Sn({enabled:i})}},{key:"isFeatureEnabledForStat",value:function(e){for(var t=parseInt(e).toString(2),n=t.length-1,i=0;0<=n;n--,i++)if("1"===t.charAt(n)){if(o=(i<32?new D(0,Math.pow(2,i)):new D(Math.pow(2,i-32),0)).toString(),!this._featureMap.get(o))break;var o,s="",a=0;o===N.PLUGIN_TRANSLATE?(s="plugin_translate",a=16):o===N.PLUGIN_VOICE_TO_TEXT?(s="plugin_voice_to_text",a=17):o===N.PLUGIN_CS?(s="plugin_cs",a=14):o===N.PLUGIN_PUSH?(s="plugin_push",a=13):o===N.PLUGIN_BOT?(s="plugin_bot",a=15):o===N.MSG_REACTION&&(s="plugin_emoji_reaction",a=18),""!==s&&(o=this._commercialConfigM.get(12).getUIPlatform(),new oi(s).setCode(a).setUIPlatform(o).end(),be.l("".concat(this._n,".isFeatureEnabledForStat ").concat(s," code:").concat(a," uiPlatform:").concat(o)))}}},{key:"isCSPluginEnabled",value:function(){var e;this._isCSPluginReported||(e=this._commercialConfigM.get(12).getUIPlatform(),new oi("plugin_search").setCode(6).setUIPlatform(e).end(),this._isCSPluginReported=!0)}},{key:"clear",value:function(){this._featureMap.clear(),this._isCSPluginReported=!1}}]),Zs=s((function e(t){i(this,e),this._m=t,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new Qs(this)}),[{key:"_canFetch",value:function(){return this.get(12).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,t,n=this,i=this._canFetch(),o="".concat(this._n,".fetchConfig");be.l("".concat(o," canFetch:").concat(i)),i&&(e=new oi("fetchCommercialConfig"),i=this.get(12).getSDKAppID(),t=this.get(20),this._isFetching=!0,t.req({P:jn.FETCH_COMMERCIAL_CONFIG,data:{SDKAppID:i}}).then((function(t){e.setMessage("purchaseBits:".concat(t.data.purchaseBits)).end(),be.l("".concat(o," ok.")),n._parseConfig(t.data),n._isFetching=!1})).catch((function(t){e.setError(t).end(),n._isFetching=!1})))}},{key:"onPushedConfig",value:function(e){var t="".concat(this._n,".onPushedConfig data:").concat(JSON.stringify(e));be.l("".concat(t)),new oi("pushedCommercialConfig").setMessage("purchaseBits:".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:"_parseConfig",value:function(e){var t="".concat(this._n,"._parseConfig"),n=e.errorCode,i=e.errorMessage,o=e.purchaseBits,s=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(o),this._expiredTime=Date.now()+1e3*s):lt(n)?(be.l("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(be.e("".concat(t," errorCode:").concat(n," errorMessage:").concat(i)),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:"isFeatureEnabledForStat",value:function(e){this._purchasedFeatureHandler.isFeatureEnabledForStat(e)}},{key:"isCSPluginEnabled",value:function(){this._purchasedFeatureHandler.isCSPluginEnabled()}},{key:"get",value:function(e){return this._m.get(e)}},{key:"reset",value:function(){be.l("".concat(this._n,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),ea=(u(Ma,wn),s(Ma,[{key:"registerPlugin",value:function(e){var t,n,i,o,s,a,r,c,u,l,d,p,h;$?(this._offlinePushPlugin=e["tim-offline-push-plugin"],t=(h=e.offlinePushConfig||{}).huaweiBusinessID,n=h.xiaomiBusinessID,i=h.xiaomiAppID,o=h.xiaomiAppKey,s=h.meizuBusinessID,a=h.meizuAppID,r=h.meizuAppKey,c=h.vivoBusinessID,u=h.oppoBusinessID,l=h.oppoAppKey,d=h.oppoAppSecret,p=h.honorBusinessID,h=h.iosBusinessID,this._androidPushConfig.huaweiPushBussinessId=t,this._androidPushConfig.xiaomiPushBussinessId=n,this._androidPushConfig.xiaomiPushAppId=i,this._androidPushConfig.xiaomiPushAppKey=o,this._androidPushConfig.meizuPushBussinessId=s,this._androidPushConfig.meizuPushAppId=a,this._androidPushConfig.meizuPushAppKey=r,this._androidPushConfig.vivoPushBussinessId=c,this._androidPushConfig.oppoPushBussinessId=u,this._androidPushConfig.oppoPushAppKey=l,this._androidPushConfig.oppoPushAppSecret=d,this._androidPushConfig.honorPushBussinessId=p,new oi("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!lt(this._offlinePushPlugin))).end(!0),be.l("".concat(this._n,".").concat("registerPlugin"," ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=h,this._setAppShowListener()):this.warn("OfflinePushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:"_getDeviceToken",value:function(){var e,t=this,n="".concat(this._n,".").concat("_getDeviceToken");Je(this._offlinePushPlugin.getDeviceToken)?(e="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID),be.l("".concat(n," start. ").concat(e)),new oi("_getDeviceToken").setMessage("".concat(e)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,(function(i){var o,s,a,r,c=new oi("getDeviceTokenRes"),u=i.code,l=i.msg;0===u?(o=(r=i.data).deviceToken,s=r.deviceBrand,a=r.deviceType,r=r.bussinessId,t._deviceToken=o,t._businessID=r||t._iosBusinessID,e="deviceToken:".concat(o,", deviceBrand:").concat(s||a,", businessID:").concat(t._businessID),be.l("".concat(n," ok. ").concat(e)),c.setMessage(e).end(!0),t._setToken()):(c.setMessage("code:".concat(u,", msg:").concat(l)).end(!0),be.e("".concat(n," failed. error:"),i))}))):be.e("".concat(n," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return $&&!lt(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var e=this,t="".concat(this._n,".").concat("_setAppShowListener");lt(this._offlinePushPlugin)?be.e("".concat(t," offlinePushPlugin is undefined")):Je(this._offlinePushPlugin.setAppShowListener)?(new oi("_setAppShowListener").end(!0),be.l("".concat(t," start")),this._offlinePushPlugin.setAppShowListener((function(n){n=(n||{}).appShow,new oi("setAppShowListenerRes").setMessage("appShow:".concat(n)).end(!0),be.l("".concat(t," ok. appShow:").concat(n)),e._m.isReady()&&(0===n?(e._getConvUnreadCount(),e._onBackground()):1===n&&e._onForeground())}))):be.e("".concat(t," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){var e;if(!lt(this._offlinePushPlugin)&&Je(this._offlinePushPlugin.getDeviceType))return e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType,be.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}},{key:"_setToken",value:function(){var e="".concat(this._n,"._setToken"),t=this.get(12),n=1,i="",o="",s=(qe(this._deviceToken)&&(n=0),this.getUniAppPlatform()),a=this.getDeviceBrand(),r=(s===O.IOS||s===O.IPAD||s===O.MAC?o=this._deviceToken:s===O.ANDROID&&(i=this._deviceToken),new oi("offlinePushSetToken"));return s="deviceToken:".concat(o||i,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(a,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(n,", platform:").concat(s),r.setMessage("".concat(s)),be.l("".concat(e," ").concat(s)),this.req({P:jn.SET_TOKEN,data:{tokenID:i,pushMsg:n,sdkAppID:t.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:a,deviceToken:o,isWebUniapp:this._isWebUniapp}}).then((function(t){return r.end(),be.l("".concat(e," ok")),t})).catch((function(t){return r.setError(t).end(),be.e("".concat(e," failed. error:"),t),En(t)}))}},{key:"_getConvUnreadCount",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(11).getLocalConvList().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 oi("_onBackground");this.req({P:jn.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then((function(i){return n.setMessage("c2cUnreadCount: ".concat(e._c2cUnreadCount,", groupUnreadCount: ").concat(e._groupUnreadCount)).end(),be.l("".concat(t," ok")),i})).catch((function(e){n.setError(e).end(),be.e("".concat(t," failed. error:"),e)}))}},{key:"_onForeground",value:function(){var e="".concat(this._n,".").concat("_onForeground"),t=new oi("_onForeground");this.req({P:jn.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then((function(n){return t.end(),be.l("".concat(e," ok")),n})).catch((function(n){t.setError(n).end(),be.e("".concat(e," failed. error:"),n)}))}},{key:"getUniAppPlatform",value:function(){var e=Nn.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?O.IOS:"android"===e?O.ANDROID:1002===t?O.IPAD:1001===t?O.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,be.l("".concat(this._n,".reset"))}}])),ta=(u(Ia,wn),s(Ia,[{key:"registerPlugin",value:function(e){var t,n,i;$?(t="".concat(this._n,".").concat("registerPlugin"),this._pushPlugin=e["tim-push"],this._getDeviceInfo(),n=(i=e.pushConfig||{}).androidConfig,i=i.iOSConfig,ze(n)&&(this._androidPushConfig=n[this._deviceInfo.packageName]),n=(i||{}).iOSBusinessID,this._iOSBusinessID=n,i=!lt(this._pushPlugin),new oi("registerPlugin").setMessage(this._pluginName).setMoreMessage("isExisted:".concat(i)).end(!0),be.l("".concat(t," ok. pushConfig:").concat(JSON.stringify(e.pushConfig))),i?(this._setAppShowListener(),this._setPushEventReportListener()):be.e("".concat(t," ").concat(this._pluginName," is undefined"))):this.warn("TIMPushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._reportEventCacheList(),this._getDeviceToken(),this.get(27).isFeatureEnabledForStat(Math.pow(2,41))}},{key:"_reportEventCacheList",value:function(){var e=this,t="".concat(this._n,".").concat("_reportEventCacheList");Je(this._pushPlugin.getPushEventCacheList)?(new oi("_reportEventCacheList").end(!0),this._pushPlugin.getPushEventCacheList((function(n){var i=n.code,o=n.data.eventList,s=new oi("getPushEventCacheListRes");if(s.setCode(i),0!==i)s.setMessage("res:".concat(JSON.stringify(n))).end(!0),be.e("".concat(t," failed. error:").concat(JSON.stringify(n)));else{i=o.length<10?"eventList:".concat(JSON.stringify(o)):"eventList.length:".concat(o.length),be.l("".concat(t," ok. ").concat(i)),s.setMessage(i).end(!0);for(var a=g(g({},n.data),{},{eventList:[]});0=this._expiredTime&&this._getLexicon()}},{key:"filterMessage",value:function(e,t){var n=!0;if(this._plugin&&this._canIUseLexicon&&(!t||!t.messageControlInfo||!0!==t.messageControlInfo.excludedFromContentModeration)){t=e.type;var i=e.conversationType;if(t===E.MSG_TEXT||t===E.MSG_CUSTOM){var o,s="".concat(this._n,".filterMessage");if(be.l("".concat(s)),t===E.MSG_TEXT){if(i===E.CONV_C2C?o="c2c_text_message":i===E.CONV_GROUP&&(o="group_text_message"),!this._isConfigOn(o))return n;var a=(r=this._plugin.filter(e.payload.text)).type,r=r.modifiedText;1===a?n=!1:2===a&&(e.payload.text=r)}else if(t===E.MSG_CUSTOM){if(i===E.CONV_C2C?o="c2c_custom_message":i===E.CONV_GROUP&&(o="group_custom_message"),!this._isConfigOn(o))return n;a=this._plugin.filter(e.payload.data),r=this._plugin.filter(e.payload.description),t=this._plugin.filter(e.payload.extension),1===a.type||1===r.type||1===t.type?n=!1:(2===a.type&&(e.payload.data=a.modifiedText),2===r.type&&(e.payload.description=r.modifiedText),2===t.type&&(e.payload.extension=t.modifiedText))}be.l("".concat(s," done. isAllowedToSend:").concat(n))}}return n}},{key:"filterText",value:function(e,t){var n="".concat(this._n,".filterText"),i={isAllowedToSend:!0,modifiedText:e};return this._plugin&&this._canIUseLexicon&&this._isConfigOn(t)&&(be.l("".concat(n)),e=(t=this._plugin.filter(e)).type,t=t.modifiedText,1===e?i.isAllowedToSend=!1:2===e&&(i.modifiedText=t),be.l("".concat(n," done. ret:"),i)),i}},{key:"_getLexicon",value:function(){var e=this,t=new oi("profanityFilter"),n="".concat(this._n,"._getLexicon");this._isFetching=!0,this.req({P:jn.GET_PROFANITY_LIST,data:{startIndex:this._startIndex,version:this._version}}).then((function(i){var o=(i=i.data).errorInfo,s=i.filterConfig,a=i.lexicon,r=i.strToken,c=i.completeFlag,u=i.nextStartIndex,l=i.version,d=(i=i.expiredTime,o.errorCode),p=o.errorMessage;return 0!==d?(e._isFetching=!1,be.w("".concat(n," failed. error:"),o),void t.setCode(d).setMessage(p).end()):(e._onFilterConfig(s),e._getToken(r),1===c?(be.l("".concat(n," done. version:").concat(l," expiredTime:").concat(i)),e._version=l,e._canIUseLexicon=!0,e._isFetching=!1,e._expiredTime=Date.now()+1e3*i,void e._plugin.onLexiconCompleted(a)):(e._startIndex=u,e._plugin.onLexiconSliced(a),void e._getLexicon()))})).catch((function(i){t.setError(i).end(),e._isFetching=!1,be.l("".concat(n," failed. error:"),i)}))}},{key:"_onFilterConfig",value:function(e){var t=this;qe(e)||(this._filterConfigMap.clear(),Object.keys(e).forEach((function(n){t._filterConfigMap.set(n,e[n])})),be.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(ut(e)){var t=e.length,n="";if(t%2==0)for(var i=0;i<=t-1;i+=2)n=(n+=e[i+1])+e[i];else{for(var o=0;o=this.STORAGE_EXPIRES_TIME,e=!e||"3.5.5"!==e,be.l("".concat(this._n,"._needToUpdate isTimeout:").concat(t," isDifferentVersion:").concat(e)),t||e}},{key:"_fetch",value:function(){this._m.get(12).isPrivateNetWork()||this._fetchWithRetry()}},{key:"_fetchWithRetry",value:function(){var e=this;this._fetchAdapter().catch((function(){e.CURRENT_DOMAIN!==B&&(e._generateCurrentDomain(),e._fetchWithRetry())}))}},{key:"_generateCurrentDomain",value:function(){this.CURRENT_DOMAIN===x?this.CURRENT_DOMAIN=F:this.CURRENT_DOMAIN===F&&(this.CURRENT_DOMAIN=B)}},{key:"_fetchAdapter",value:function(){var e="https://".concat(this.CURRENT_DOMAIN,"/im/download/error-message/v3/0.0.7/tim-error-message.txt"),t="application/x-www-form-urlencoded;charset=UTF-8",n="".concat(this._n,"._fetchAdapter ok in"),i=this;return new Promise((function(o,s){var a,r;Q?ne.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:function(e){i._fillAndSave(e.data),be.l("".concat(n," mini program.")),o()},fail:function(e){s(e)}}):(a=new XMLHttpRequest,r=setTimeout((function(){a.abort()}),3e3),a.onreadystatechange=function(){4===a.readyState&&(r&&clearTimeout(r),200===a.status||304===a.status?(be.l("".concat(n," browser.")),i._fillAndSave(a.responseText),o()):s(a.status))},a.onerror=function(e){s(e)},a.open("GET",e,!0),a.setRequestHeader("Content-type",t),a.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:"3.5.5"}),!0,!1)}},{key:"_getStorageModule",value:function(){return this._m.get(13)}},{key:"_fillMap",value:function(e){this._map.clear();for(var t,n,i=e.split(";\n"),o=i.length,s=new RegExp(/'/g),a=0;aSe()-this.EXPIRED_TIME}},{key:"_createPromiseList",value:function(e){for(var t=[],n=0;nthis.MAX_COUNT?this.MAX_COUNT:e,this._clearFollowList())}},{key:"clearCacheOnReconnected",value:function(){this._clearFollowList()}},{key:"onFollowNotify",value:function(e){var t=this;e=e.dataList||[],be.l("".concat(this._n,".onFollowNotify followChangeList:").concat(e.length)),e.forEach((function(e){var n=void 0===(n=e.followDiffList)?[]:n,i=(e=f(e,pa)).from,o=f(e,ha);n.forEach((function(e){var n=e.isAdd,s=(e=void 0===(e=e.followType)?0:e,t._initFollowInfo());1===n?(o.userID=i,s[e].userInfoList.push(o),s[e].isAdd=!0):(s[e].userInfoList.push(i),s[e].isAdd=!1),t._emitEvent(s)}))}))}},{key:"_initFollowInfo",value:function(){var e={};return Object.values(ga).forEach((function(t){t!==ga.NONE&&(e[t]={userInfoList:[],isAdd:!1})})),e}},{key:"_emitEvent",value:function(e){var t=this;Object.keys(e).forEach((function(n){n=Number(n);var i=e[n];0>>16&65535,a=0;0!==n;){for(n-=a=2e3>>8^o[255&(e^t[a])];return~e}function ba(e,t,n,i,o,s,a,r){var c,u,l,d,p,h,g,f,m,_=r.bits,v=0,y=0,I=0,M=0,C=0,S=0,E=0,T=0,k=0,D=0,R=null,O=0,b=new ma.Buf16(16),A=new ma.Buf16(16),L=null,P=0;for(v=0;v<=15;v++)b[v]=0;for(y=0;yh?(f=L[P+a[y]],R[O+a[y]]):(f=96,0),c=1<<(g=v-E),I=u=1<>E)+(u-=c)]=g<<24|f<<16|m,0!==u;);for(c=1<>=1;if(D=0!==c?(D&c-1)+c:0,y++,0==--b[v]){if(v===M)break;v=t[n+a[y]]}if(C>>1:n>>>1;e[t]=n}return e}(),La=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Pa=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],Na=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],wa=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function Ua(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function Ga(){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 ma.Buf16(320),this.work=new ma.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function xa(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 ma.Buf32(852),t.distcode=t.distdyn=new ma.Buf32(592),t.sane=1,t.back=-1,0):-2}function Fa(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,xa(e)):-2}function Ba(e,t){var n,i;return!e||!e.state||(i=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=e.wsize?(ma.arraySet(e.window,t,n-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):((o=e.wsize-e.wnext)>i&&(o=i),ma.arraySet(e.window,t,n-i,o,e.wnext),(i-=o)?(ma.arraySet(e.window,t,n-i,i,0),e.wnext=i,e.whave=e.wsize):(e.wnext+=o,e.wnext===e.wsize&&(e.wnext=0),e.whave>>8&255,n.check=Oa(n.check,D,2,0),l=u=0,n.mode=2;else if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&u)<<8)+(u>>8))%31)e.msg="incorrect header check",n.mode=30;else if(8!=(15&u))e.msg="unknown compression method",n.mode=30;else{if(l-=4,C=8+(15&(u>>>=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&&(D[0]=255&u,D[1]=u>>>8&255,n.check=Oa(n.check,D,2,0)),l=u=0,n.mode=3;case 3:for(;l<32;){if(0===r)break e;r--,u+=i[s++]<>>8&255,D[2]=u>>>16&255,D[3]=u>>>24&255,n.check=Oa(n.check,D,4,0)),l=u=0,n.mode=4;case 4:for(;l<16;){if(0===r)break e;r--,u+=i[s++]<>8),512&n.flags&&(D[0]=255&u,D[1]=u>>>8&255,n.check=Oa(n.check,D,2,0)),l=u=0,n.mode=5;case 5:if(1024&n.flags){for(;l<16;){if(0===r)break e;r--,u+=i[s++]<>>8&255,n.check=Oa(n.check,D,2,0)),l=u=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((h=(h=n.length)>r?r:h)&&(n.head&&(C=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),ma.arraySet(n.head.extra,i,s,h,C)),512&n.flags&&(n.check=Oa(n.check,i,h,s)),r-=h,s+=h,n.length-=h),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===r)break e;for(h=0;C=i[s+h++],n.head&&C&&n.length<65536&&(n.head.name+=String.fromCharCode(C)),C&&h>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--,u+=i[s++]<>>=7&l,l-=7&l,n.mode=27;else{for(;l<3;){if(0===r)break e;r--,u+=i[s++]<>>=1)){case 0:n.mode=14;break;case 1:O=b=void 0;var O,b=n;if(Ha){for(Va=new ma.Buf32(512),ja=new ma.Buf32(32),O=0;O<144;)b.lens[O++]=8;for(;O<256;)b.lens[O++]=9;for(;O<280;)b.lens[O++]=7;for(;O<288;)b.lens[O++]=8;for(ba(1,b.lens,0,288,Va,0,b.work,{bits:9}),O=0;O<32;)b.lens[O++]=5;ba(2,b.lens,0,32,ja,0,b.work,{bits:5}),Ha=!1}if(b.lencode=Va,b.lenbits=9,b.distcode=ja,b.distbits=5,n.mode=20,6!==t)break;u>>>=2,l-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}u>>>=2,l-=2}break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===r)break e;r--,u+=i[s++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&u,l=u=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(h=n.length){if(0===(h=c<(h=r>>=5,l-=5,n.ndist=1+(31&u),u>>>=5,l-=5,n.ncode=4+(15&u),u>>>=4,l-=4,286>>=3,l-=3}for(;n.have<19;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},S=ba(0,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,S){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,v=65535&k,!((m=k>>>24)<=l);){if(0===r)break e;r--,u+=i[s++]<>>=m,l-=m,n.lens[n.have++]=v;else{if(16===v){for(T=m+2;l>>=m,l-=m,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}C=n.lens[n.have-1],h=3+(3&u),u>>>=2,l-=2}else if(17===v){for(T=m+3;l>>=m)),u>>>=3,l=l-m-3}else{for(T=m+7;l>>=m)),u>>>=7,l=l-m-7}if(n.have+h>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;h--;)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,E={bits:n.lenbits},S=ba(1,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,S){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},S=ba(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,S){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(6<=r&&258<=c){e.next_out=a,e.avail_out=c,e.next_in=s,e.avail_in=r,n.hold=u,n.bits=l,H=q=U=w=N=P=L=A=ie=ne=te=ee=Z=Q=X=J=$=Y=W=z=K=j=V=B=F=void 0;var A,L,P,N,w,U,G=e,x=p,F=G.state,B=G.next_in,q=G.input,V=B+(G.avail_in-5),j=G.next_out,H=G.output,K=j-(x-G.avail_out),z=j+(G.avail_out-257),W=F.dmax,Y=F.wsize,$=F.whave,J=F.wnext,X=F.window,Q=F.hold,Z=F.bits,ee=F.lencode,te=F.distcode,ne=(1<>>=L=A>>>24,Z-=L,0==(L=A>>>16&255))H[j++]=65535&A;else{if(!(16&L)){if(!(64&L)){A=ee[(65535&A)+(Q&(1<>>=L,Z-=L),Z<15&&(Q+=q[B++]<>>=L=A>>>24,Z-=L,!(16&(L=A>>>16&255))){if(!(64&L)){A=te[(65535&A)+(Q&(1<W){G.msg="invalid distance too far back",F.mode=30;break t}if(Q>>>=L,Z-=L,N>(L=j-K)){if((L=N-L)>$&&F.sane){G.msg="invalid distance too far back",F.mode=30;break t}if(U=X,(w=0)===J){if(w+=Y-L,L>3,Q&=(1<<(Z-=P<<3))-1,G.next_in=B,G.next_out=j,G.avail_in=B>>16&255,v=65535&k,!((m=k>>>24)<=l);){if(0===r)break e;r--,u+=i[s++]<>y)])>>>16&255,v=65535&k,!(y+(m=k>>>24)<=l);){if(0===r)break e;r--,u+=i[s++]<>>=y,l-=y,n.back+=y}if(u>>>=m,l-=m,n.back+=m,n.length=v,0===_){n.mode=26;break}if(32&_){n.back=-1,n.mode=12;break}if(64&_){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&_,n.mode=22;case 22:if(n.extra){for(T=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;_=(k=n.distcode[u&(1<>>16&255,v=65535&k,!((m=k>>>24)<=l);){if(0===r)break e;r--,u+=i[s++]<>y)])>>>16&255,v=65535&k,!(y+(m=k>>>24)<=l);){if(0===r)break e;r--,u+=i[s++]<>>=y,l-=y,n.back+=y}if(u>>>=m,l-=m,n.back+=m,64&_){e.msg="invalid distance code",n.mode=30;break}n.offset=v,n.extra=15&_,n.mode=24;case 24:if(n.extra){for(T=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===c)break e;if(n.offset>(h=p-c)){if((h=n.offset-h)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}g=h>n.wnext?(h-=n.wnext,n.wsize-h):n.wnext-h,h>n.length&&(h=n.length),f=n.window}else f=o,g=a-n.offset,h=n.length;for(c-=h=c>10&1023,s[a++]=56320|1023&n)}var c=s,u=a;if(u<65534&&(c.subarray&&Ya||!c.subarray&&Wa))return String.fromCharCode.apply(null,ma.shrinkBuf(c,u));for(var l="",d=0;d>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(t.dictionary):"[object ArrayBuffer]"===nr.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw)&&(e=za.inflateSetDictionary(this.strm,t.dictionary))!==er.Z_OK)throw new Error(tr[e])}function or(e,t){if((t=new ir(t)).push(e,!0),t.err)throw t.msg||tr[t.err];return t.result}ir.prototype.push=function(e,t){var n,i,o,s,a,r=this.strm,c=this.options.chunkSize,u=this.options.dictionary,l=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?er.Z_FINISH:er.Z_NO_FLUSH,"string"==typeof e?r.input=function(e){for(var t=new ma.Buf8(e.length),n=0,i=t.length;ne.length?e.length:t)-1;0<=n&&128==(192&e[n]);)n--;return!(n<0||0===n)&&n+$a[e[n]]>t?n:t}(r.output,r.next_out),s=r.next_out-o,a=Xa(r.output,o),r.next_out=s,r.avail_out=c-s,s&&ma.arraySet(r.output,r.output,o,s,0),this.onData(a)):this.onData(ma.shrinkBuf(r.output,r.next_out))),0===r.avail_in&&0===r.avail_out&&(l=!0)}while((0"," %c"),"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",t):console.log("IM SDK API ->",t)),(t=this.getErrMsg("DOCS_GUIDE"))&&console.log(t),t=this.getErrMsg("IOS_WEBVIEW_WARNING"),me)&&t&&console.warn(t),be.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._get(2).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._get(2).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._get(2).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._get(2).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._get(2).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._get(2).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._get(2).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._get(2).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._get(2).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._get(2).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==E.MSG_MERGER?En({code:qn.MSG_MERGER_TYPE_INVALID}):qe(e.payload.downloadKey)?En({code:qn.MSG_MERGER_KEY_INVALID}):this._get(2).downloadMergerMessage(e).catch((function(e){return En({code:qn.MSG_MERGER_DOWNLOAD_FAIL})}))}},{key:"createForwardMessage",value:function(e){return this._get(2).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof ki?this._get(2).sendMessageInstance(e,t):En({code:qn.MSG_INSTANCE_REQUIRED})}},{key:"callExperimentalAPI",value:function(e,t){return"sendComboMessage"===e?this._get(31).sendMessage(t):"handleGroupInvitation"===e?this._get(7).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._get(27).isFeatureEnabled(t):"isFeatureEnabledForStat"===e?this._get(27).isFeatureEnabledForStat(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e||"sendRoomCustomData"===e?this._get(30).sendTRTCCustomData(t):"getTimerID"===e?this._m.getTimerID():"getPollingTimerID"===e?this._m.getPollingTimerID(t):"setApplicationID"===e?(this._get(12).setApplicationID(t),void this._get(20).updateProtocolConfig()):"getServerConfig"===e?this._get(23).getServerConfig(t):"canIUseModule"===e?this._m.canIUseModule(t):"startMessageLongPolling"===e?this._get(7).startMessageLongPolling(t):"stopMessageLongPolling"===e?this._get(7).stopMessageLongPolling(t):"disableMessagePullOnInvite"===e?this._get(11).disableMsgPullOnInvite(t):"clearLocalMessage"===e?this._get(11).clearMemMsg(t,!1):"setCustomLoginInfo"===e?this._get(12).setCustomLoginInfo(t):"statTUIKeyFeatures"===e?this._m.statTUIKeyFeatures(t):"getGroupReceiptsByUsers"===e?this._get(7).getGroupReceiptsByUsers(t):En({code:qn.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._get(2).revokeMessage(e)}},{key:"resendMessage",value:function(e,t){return e instanceof ki?this._get(2).resendMessage(e,t):En({code:qn.MSG_INSTANCE_REQUIRED})}},{key:"deleteMessage",value:function(e){return this._get(2).deleteMessage(e)}},{key:"translateText",value:function(e){return this._get(2).translateText(e)}},{key:"convertVoiceToText",value:function(e){return this._get(2).convertVoiceToText(e)}},{key:"setMessageExtensions",value:function(e,t){return this._get(3).setMessageExtensions(e,t)}},{key:"getMessageExtensions",value:function(e){return this._get(3).getMessageExtensions(e)}},{key:"deleteMessageExtensions",value:function(e,t){return this._get(3).deleteMessageExtensions(e,t)}},{key:"addMessageReaction",value:function(e,t){return this._get(34).addMessageReaction(e,t)}},{key:"removeMessageReaction",value:function(e,t){return this._get(34).removeMessageReaction(e,t)}},{key:"getMessageReactions",value:function(e){return this._get(34).getMessageReactions(e)}},{key:"getAllUserListOfMessageReaction",value:function(e){return this._get(34).getAllUserListOfMessageReaction(e)}},{key:"modifyMessage",value:function(e){return this._get(2).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._get(11).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._get(11).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._get(11).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._get(11).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){var t=this._get(7);return t?t.getReadReceiptDetail(e):En({code:qn.NO_MODULE})}},{key:"findMessage",value:function(e){return this._get(11).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._get(11).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._get(11).getConvList(e)}},{key:"getConversationProfile",value:function(e){return this._get(11).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._get(11).deleteConversation(e)}},{key:"setConversationDraft",value:function(e){return this._get(11).setConvDraft(e)}},{key:"clearHistoryMessage",value:function(e){return this._get(11).clearHistoryMessage(e)}},{key:"pinConversation",value:function(e){return this._get(11).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._get(11).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._get(11).setMessageRemindType(e)}},{key:"setAllReceiveMessageOpt",value:function(e){return this._get(11).setAllRcvMsgOpt(e)}},{key:"getAllReceiveMessageOpt",value:function(){return this._get(11).getAllRcvMsgOpt()}},{key:"getTotalUnreadMessageCount",value:function(){return this._get(11).getTotalUnreadCount()}},{key:"setConversationCustomData",value:function(e){return this._get(11).setConvCustomData(e)}},{key:"markConversation",value:function(e){return this._get(11).markConv(e)}},{key:"getConversationGroupList",value:function(){return this._get(11).getConvGroupList()}},{key:"createConversationGroup",value:function(e){return this._get(11).createConvGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._get(11).deleteConvGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._get(11).renameConvGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._get(11).addConvsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._get(11).deleteConvsFromGroup(e)}},{key:"searchCloudMessages",value:function(e){var t=this._get(38);return t?t.searchCloudMessages(e):En({code:qn.NO_MODULE})}},{key:"searchCloudUsers",value:function(e){var t=this._get(38);return t?t.searchCloudUsers(e):En({code:qn.NO_MODULE})}},{key:"searchCloudGroups",value:function(e){var t=this._get(38);return t?t.searchCloudGroups(e):En({code:qn.NO_MODULE})}},{key:"searchCloudGroupMembers",value:function(e){var t=this._get(38);return t?t.searchCloudGroupMembers(e):En({code:qn.NO_MODULE})}},{key:"getMyProfile",value:function(){return this._get(4).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._get(4).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._get(4).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._get(4).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._get(4).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._get(4).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._get(4).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._get(4).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._get(4).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._get(4).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._get(8);return e?e.getLocalFriendList():En({code:qn.NO_MODULE})}},{key:"addFriend",value:function(e){var t=this._get(8);return t?t.addFriend(e):En({code:qn.NO_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._get(8);return t?t.deleteFriend(e):En({code:qn.NO_MODULE})}},{key:"checkFriend",value:function(e){var t=this._get(8);return t?t.checkFriend(e):En({code:qn.NO_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._get(8);return t?t.getFriendProfile(e):En({code:qn.NO_MODULE})}},{key:"updateFriend",value:function(e){var t=this._get(8);return t?t.updateFriend(e):En({code:qn.NO_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._get(8);return e?e.getLocalFriendApplicationList():En({code:qn.NO_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._get(8);return t?t.acceptFriendApplication(e):En({code:qn.NO_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._get(8);return t?t.refuseFriendApplication(e):En({code:qn.NO_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._get(8);return t?t.deleteFriendApplication(e):En({code:qn.NO_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._get(8);return e?e.setFriendApplicationRead():En({code:qn.NO_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._get(8);return e?e.getLocalFriendGroupList():En({code:qn.NO_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._get(8);return t?t.createFriendGroup(e):En({code:qn.NO_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._get(8);return t?t.deleteFriendGroup(e):En({code:qn.NO_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._get(8);return t?t.addToFriendGroup(e):En({code:qn.NO_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._get(8);return t?t.removeFromFriendGroup(e):En({code:qn.NO_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._get(8);return t?t.renameFriendGroup(e):En({code:qn.NO_MODULE})}},{key:"followUser",value:function(e){var t=this._get(35);return t?t.followUser(e):En({code:qn.NO_MODULE})}},{key:"unfollowUser",value:function(e){var t=this._get(35);return t?t.unfollowUser(e):En({code:qn.NO_MODULE})}},{key:"getMyFollowersList",value:function(e){var t=this._get(35);return t?t.getMyFollowersList(e):En({code:qn.NO_MODULE})}},{key:"getMyFollowingList",value:function(e){var t=this._get(35);return t?t.getMyFollowingList(e):En({code:qn.NO_MODULE})}},{key:"getMutualFollowersList",value:function(e){var t=this._get(35);return t?t.getMutualFollowersList(e):En({code:qn.NO_MODULE})}},{key:"getUserFollowInfo",value:function(e){var t=this._get(35);return t?t.getUserFollowInfo(e):En({code:qn.NO_MODULE})}},{key:"checkFollowType",value:function(e){var t=this._get(35);return t?t.checkFollowType(e):En({code:qn.NO_MODULE})}},{key:"getGroupList",value:function(){var e=this._get(7);return e?e.getGroupList():En({code:qn.NO_MODULE})}},{key:"getGroupProfile",value:function(e){var t=this._get(7);return t?t.getGroupProfile(e):En({code:qn.NO_MODULE})}},{key:"createGroup",value:function(e){var t=this._get(7);return t?t.createGroup(e):En({code:qn.NO_MODULE})}},{key:"dismissGroup",value:function(e){var t=this._get(7);return t?t.dismissGroup(e):En({code:qn.NO_MODULE})}},{key:"updateGroupProfile",value:function(e){var t=this._get(7);return t?t.updateGroupProfile(e):En({code:qn.NO_MODULE})}},{key:"joinGroup",value:function(e){var t=this._get(7);return t?t.joinGroup(e):En({code:qn.NO_MODULE})}},{key:"quitGroup",value:function(e){var t=this._get(7);return t?t.quitGroup(e):En({code:qn.NO_MODULE})}},{key:"searchGroupByID",value:function(e){var t=this._get(7);return t?t.searchGroupByID(e):En({code:qn.NO_MODULE})}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._get(7);return t?t.getGroupOnlineMemberCount(e):En({code:qn.NO_MODULE})}},{key:"changeGroupOwner",value:function(e){var t=this._get(7);return t?t.changeGroupOwner(e):En({code:qn.NO_MODULE})}},{key:"getGroupApplicationList",value:function(){var e=this._get(7);return e?e.getGroupApplicationList():En({code:qn.NO_MODULE})}},{key:"handleGroupApplication",value:function(e){var t=this._get(7);return t?t.handleGroupApplication(e):En({code:qn.NO_MODULE})}},{key:"initGroupAttributes",value:function(e){var t=this._get(7);return t?t.initGroupAttributes(e):En({code:qn.NO_MODULE})}},{key:"setGroupAttributes",value:function(e){var t=this._get(7);return t?t.setGroupAttributes(e):En({code:qn.NO_MODULE})}},{key:"deleteGroupAttributes",value:function(e){var t=this._get(7);return t?t.deleteGroupAttributes(e):En({code:qn.NO_MODULE})}},{key:"getGroupAttributes",value:function(e){var t=this._get(7);return t?t.getGroupAttributes(e):En({code:qn.NO_MODULE})}},{key:"setGroupCounters",value:function(e){var t=this._get(7);return t?t.setGroupCounters(e):En({code:qn.NO_MODULE})}},{key:"increaseGroupCounter",value:function(e){var t=this._get(7);return t?t.increaseGroupCounter(e):En({code:qn.NO_MODULE})}},{key:"decreaseGroupCounter",value:function(e){var t=this._get(7);return t?t.decreaseGroupCounter(e):En({code:qn.NO_MODULE})}},{key:"getGroupCounters",value:function(e){var t=this._get(7);return t?t.getGroupCounters(e):En({code:qn.NO_MODULE})}},{key:"getGroupMemberList",value:function(e){var t=this._get(7);return t?t.getGroupMemberList(e):En({code:qn.NO_MODULE})}},{key:"getGroupMemberProfile",value:function(e){var t=this._get(7);return t?t.getGroupMemberProfile(e):En({code:qn.NO_MODULE})}},{key:"addGroupMember",value:function(e){var t=this._get(7);return t?t.addGroupMember(e):En({code:qn.NO_MODULE})}},{key:"deleteGroupMember",value:function(e){var t=this._get(7);return t?t.deleteGroupMember(e):En({code:qn.NO_MODULE})}},{key:"setGroupMemberMuteTime",value:function(e){var t=this._get(7);return t?t.setGroupMemberMuteTime(e):En({code:qn.NO_MODULE})}},{key:"setGroupMemberRole",value:function(e){var t=this._get(7);return t?t.setGroupMemberRole(e):En({code:qn.NO_MODULE})}},{key:"setGroupMemberNameCard",value:function(e){var t=this._get(7);return t?t.setGroupMemberNameCard(e):En({code:qn.NO_MODULE})}},{key:"setGroupMemberCustomField",value:function(e){var t=this._get(7);return t?t.setGroupMemberCustomField(e):En({code:qn.NO_MODULE})}},{key:"markGroupMemberList",value:function(e){var t=this._get(7);return t?t.markGroupMemberList(e):En({code:qn.NO_MODULE})}},{key:"getJoinedCommunityList",value:function(){return this._get(10).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._get(10).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._get(10).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._get(10).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._get(10).getTopicList(e)}},{key:"addSignalingListener",value:function(e,t,n){var i=this._get(33);i&&i.addSignalingListener(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"removeSignalingListener",value:function(e,t,n){var i,o=this._safetyCallbackFactory.find(e,t);null!==o&&(i=this._get(33))&&(i.removeSignalingListener(e,o,n),this._safetyCallbackFactory.delete(e,t))}},{key:"invite",value:function(e){var t=this._get(33);return t?t.invite(e):En({code:qn.NO_MODULE})}},{key:"inviteSync",value:function(e,t,n){var i=this._get(33);return i?i.inviteSync(e,t,n):""}},{key:"inviteInGroup",value:function(e){var t=this._get(33);return t?t.invite(e):En({code:qn.NO_MODULE})}},{key:"inviteInGroupSync",value:function(e,t,n){var i=this._get(33);return i?i.inviteSync(e,t,n):""}},{key:"cancel",value:function(e){var t=this._get(33);return t?t.cancel(e):En({code:qn.NO_MODULE})}},{key:"accept",value:function(e){var t=this._get(33);return t?t.accept(e):En({code:qn.NO_MODULE})}},{key:"reject",value:function(e){var t=this._get(33);return t?t.reject(e):En({code:qn.NO_MODULE})}},{key:"getSignalingInfo",value:function(e){var t=this._get(33);return t?t.getSignalingInfo(e):null}},{key:"modifyInvitation",value:function(e){var t=this._get(33);return t?t.modifyInvitation(e):En({code:qn.NO_MODULE})}}]),yr={login:1,logout:1,getLoginUser:1,destroy:1,on:1,off:1,ready:1,setLogLevel:1,joinGroup:1,quitGroup:1,registerPlugin:1,getGroupOnlineMemberCount:1,isReady:1,addSignalingListener:1,removeSignalingListener:1,callExperimentalAPI:1};function Ir(e){return i(this,Ir),(e=n(this,Ir,[e]))._n="CSModule",e}var Mr={};return(Un={}).create=function(e){var t,n,i,o="TencentCloudChat.create",s=0;if(Ke(i=e.SDKAppID))s=i;else if(s=parseInt(i),isNaN(i))return be.e("".concat(o," failed. Failed to parse the SDKAppID, please check the arguments")),null;return s&&Mr[s]?Mr[s]:(be.l("".concat(o)),(i=new vr(g(g({},e),{},{SDKAppID:s}))).on(S.SDK_DESTROY,(function(e){Mr[e.data.SDKAppID]=null,delete Mr[e.data.SDKAppID]})),t=i,n=Object.create(null),Object.keys(Fn).forEach((function(e){var i;t[e]&&(i=new k,n[e]=function(){var n=Array.from(arguments);return i.use((function(n,i){a=e;var o,s,a=!(!(o=t).isReady()&&1!==yr[a])||(s={code:s=o.getNotReadyReason(),message:"".concat(o.getErrMsg(s)," | ").concat(a," | ").concat(o.getErrMsg(qn.SDK_IS_NOT_READY))},o.onError(s),s);return!0===a?i():En(a)})).use((function(t,n){if(!0===function(e,t,n){if(void 0===t)return!0;var i=!0;if(We(t))Object.keys(t).forEach((function(o){var s=1===e.length?e[0][o]:void 0;i=!!Yt(s,t[o],n,o)&&i}));else if(Ye(t))for(var o=0;o=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=void 0!==Og?Og:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},u=void 0!==Pn&&"function"==typeof Pn.getSystemInfoSync&&Boolean(Pn.getSystemInfoSync().fontSizeSetting),l="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),d="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),p="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),h="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),g=void 0!==Nn&&"undefined"==typeof window&&"function"==typeof Nn.requireNativePlugin,f=g&&"ios"===Nn.getDeviceInfo().platform.toLocaleLowerCase(),m=(g&&Nn.getDeviceInfo().platform.toLocaleLowerCase(),u||l||d||p||h||g),_=void 0!==c&&(void 0!==c.nativeModuleProxy||void 0!==c.ReactNative),v=l?qq:d?tt:p?swan:h?my:u?Pn:g?Nn:{},y=function(e){if("object"!==n(e)||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var i=t;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return t===i};function I(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(y(e)){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1}var M=function(){function e(){i(this,e),this._n="WebRequest"}return s(e,[{key:"request",value:function(e,n){var i=this,o="".concat(this._n,".request"),s=e.downloadUrl||"",a=(e.method||"PUT").toUpperCase(),r=e.url;if(console.log("%c tim-upload-plugin %c","background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent","".concat(o," URL:").concat(r)),e.qs){var c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"=";return I(e)?"":y(e)?Object.keys(e).map((function(i){var o=encodeURIComponent(i)+n;return Array.isArray(e[i])?e[i].map((function(e){return o+encodeURIComponent(e)})).join(t):o+encodeURIComponent(e[i])})).filter(Boolean).join(t):void 0}(e.qs);c&&(r+="".concat(-1===r.indexOf("?")?"?":"&").concat(c))}var u=new XMLHttpRequest;u.open(a,r,!0),u.responseType=e.dataType||"text";var l=e.headers||{};if(e.uploadByIP&&(l=t(t({},l),{},{host:e.uploadIP})),!I(l))for(var d in l)l.hasOwnProperty(d)&&"content-length"!==d.toLowerCase()&&"user-agent"!==d.toLowerCase()&&"origin"!==d.toLowerCase()&&"host"!==d.toLowerCase()&&u.setRequestHeader(d,l[d]);return u.onload=function(){if(200===u.status)n(null,i._xhrRes(u,i._xhrBody(u,s,e.uploadByIP&&e.uploadIP),l));else{if(e.uploadIP&&-1===e.url.indexOf(e.uploadIP))return e.url=(o=e.url,a=e.uploadIP,o.replace(/^http(s)?:\/\/(.*?)\//,"https://".concat(a,"/"))),e.uploadByIP=!0,i.request(e,n);var t={code:u.status,message:JSON.stringify(u.responseText)};n(t,i._xhrRes(u,i._xhrBody(u,s,e.uploadByIP&&e.uploadIP),l))}var o,a},u.onerror=function(t){var o=i._xhrBody(u,s,e.uploadByIP&&e.uploadIP),a={code:u.status,message:JSON.stringify(u.responseText)};o||u.statusText||0!==u.status||(t.message="CORS blocked or network error"),n(a,i._xhrRes(u,o)),a=null},e.onProgress&&u.upload&&(u.upload.onprogress=function(t){var n=t.total,i=t.loaded,o=Math.floor(100*i/n);e.onProgress({total:n,loaded:i,percent:(o>=100?100:o)/100})}),u.send(e.resources),u}},{key:"_xhrRes",value:function(e,t){var n={};return e.getAllResponseHeaders().trim().split("\n").forEach((function(e){if(e){var t=e.indexOf(":"),i=e.substr(0,t).trim().toLowerCase(),o=e.substr(t+1).trim();n[i]=o}})),{statusCode:e.status,statusMessage:e.statusText,headers:n,data:t}}},{key:"_xhrBody",value:function(e,t,n){return 200===e.status&&t?{location:t,uploadIP:n}:{response:e.responseText,uploadIP:n}}}]),e}(),C=["unknown","image","video","audio","log"],S=["name"],E=function(){function e(){i(this,e)}return s(e,[{key:"request",value:function(e,n){var i=this,o=e.resources,s=void 0===o?"":o,a=e.headers,c=void 0===a?{}:a,u=e.url,l=e.downloadUrl,d=void 0===l?"":l,p=u,g=null,m=d.match(/^(https?:\/\/[^/]+\/)([^/]*\/?)(.*)$/),_=decodeURIComponent(m[3]),y=_.indexOf("?")>-1?_.split("?")[0]:_,I={key:e.fileKey?e.fileKey:y,success_action_status:200,"Content-Type":""},M={};if(f){var E=u.split("?sign=");if(E.length>1){var T=E[1];p="".concat(E[0],"?sign=").concat(encodeURIComponent("".concat(T))),M.sign=decodeURIComponent(T),M.signature=decodeURIComponent(T)}}var k={url:p,header:c,name:"file",filePath:s,formData:t(t({},I),M),timeout:e.timeout||3e5};if(h){var D=k;D.name,k=t(t({},r(D,S)),{},{fileName:"file",fileType:C[e.fileType]})}return(g=v.uploadFile(t(t({},k),{},{success:function(e){i._handleResponse({response:e,downloadUrl:d,callback:n})},fail:function(e){i._handleResponse({response:e,downloadUrl:d,callback:n})}}))).onProgressUpdate&&g.onProgressUpdate((function(t){e.onProgress&&e.onProgress({total:t.totalBytesExpectedToSend,loaded:t.totalBytesSent,percent:Math.floor(t.progress)/100})})),g}},{key:"_handleResponse",value:function(e){var n=e.downloadUrl,i=e.response,o=e.callback,s=i.header,a={};if(s)for(var r in s)s.hasOwnProperty(r)&&(a[r.toLowerCase()]=s[r]);var c=+i.statusCode;200===c?o(null,{statusCode:c,headers:a,data:t(t({},i.data),{},{location:n})}):o({code:c,message:JSON.stringify(i.data)},{statusCode:c,headers:a,data:void 0})}}]),e}(),T=function(){function e(){i(this,e)}return s(e,[{key:"request",value:function(e,t){var n=this,i=e.resources,o=void 0===i?"":i,s=e.fileKey,a=void 0===s?"":s,r=e.url,c=e.downloadUrl,u=void 0===c?"":c,l=new FormData;l.append("key",a),l.append("success_action_status",200),l.append("file",{uri:o,type:"application/octet-stream",name:"uploaded_file"}),fetch(r,{method:"POST",headers:{"Content-Type":"multipart/form-data"},body:l}).then((function(e){n._handleResponse({response:e,downloadUrl:u,callback:t})})).catch((function(e){n._handleResponse({response:e,downloadUrl:u,callback:t})}))}},{key:"_handleResponse",value:function(e){var t=e.downloadUrl,n=e.response,i=e.callback,o=n.headers,s=n.status,a=o&&o.map||{};200===s?i(null,{statusCode:200,headers:a,data:{location:t}}):i({code:s,message:JSON.stringify(n)},{statusCode:s,headers:a,data:void 0})}}]),e}();return function(){function e(){i(this,e),this.retry=1,this.tryCount=0,this.systemClockOffset=0,this.httpRequest=m?new E:_?new T:new M,console.log("TIMUploadPlugin.VERSION: ".concat("1.4.2"))}return s(e,[{key:"uploadFile",value:function(e,t){var n=this;return this.httpRequest.request(e,(function(i,o){i&&n.tryCount=3e4&&(this.systemClockOffset=r-a,t=!0)}else 5===Math.floor(e.statusCode/100)&&(t=!0)}return t}}],[{key:"getVersion",value:function(){return"1.4.2"}}]),e}()}();const Ug=bg(wg.exports);var Gg={exports:{}};Gg.exports=function(){function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}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,r=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return r=e.done,e},e:function(e){c=!0,a=e},f:function(){try{r||null==n.return||n.return()}finally{if(c)throw a}}}}var c,u,l=function(){for(var e=" \t\r\n~!@#$%^&*()_+-=【】、{}|;':\",。、《》?αβγδεζηθικλμνξοπρστυφχψωΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ。,、;:?!…—·ˉ¨‘’“”々~‖∶"'`|〃〔〕〈〉《》「」『』.〖〗【】()[]{}ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ⒈⒉⒊⒋⒌⒍⒎⒏⒐⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩①②③④⑤⑥⑦⑧⑨⑩⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇≈≡≠=≤≥<>≮≯∷±+-×÷/∫∮∝∞∧∨∑∏∪∩∈∵∴⊥∥∠⌒⊙≌∽√§№☆★○●◎◇◆□℃‰€■△▲※→←↑↓〓¤°#&@\︿_ ̄―♂♀┌┍┎┐┑┒┓─┄┈├┝┞┟┠┡┢┣│┆┊┬┭┮┯┰┱┲┳┼┽┾┿╀╁╂╃└┕┖┗┘┙┚┛━┅┉┤┥┦┧┨┩┪┫┃┇┋┴┵┶┷┸┹┺┻╋╊╉╈╇╆╅╄",t=new Map,n=0,i=e.length;n1&&(c+=u),p){if(a=!0,!n)break;var g=this._map.get(d)||"*";s=t.replace(new RegExp(d,"gi"),g)}}return{isMatched:a,modifiedText:s}}},{key:"reset",value:function(){this._trieTree={},this._map=null}}]),t}(),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==Og?Og:"undefined"!=typeof self?self:{},h={},g=(c=function(e,t){var n,i,o,s,a,r,c,u,l,d,g,f,m;e.exports=(r=r||function(e){var t;if("undefined"!=typeof window&&window.crypto&&(t=window.crypto),!t&&"undefined"!=typeof window&&window.msCrypto&&(t=window.msCrypto),!t&&void 0!==p&&p.crypto&&(t=p.crypto),!t)try{t=h}catch(m){}var n=function(){if(t){if("function"==typeof t.getRandomValues)try{return t.getRandomValues(new Uint32Array(1))[0]}catch(m){}if("function"==typeof t.randomBytes)try{return t.randomBytes(4).readInt32LE()}catch(m){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),o={},s=o.lib={},a=s.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},r=s.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,n=e.words,i=this.sigBytes,o=e.sigBytes;if(this.clamp(),i%4)for(var s=0;s>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(s=0;s>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i>>2]>>>24-o%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new r.init(n,t/2)}},l=c.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],o=0;o>>2]>>>24-o%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new r.init(n,t)}},d=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},g=s.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new r.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,i=this._data,o=i.words,s=i.sigBytes,a=this.blockSize,c=s/(4*a),u=(c=t?e.ceil(c):e.max((0|c)-this._minBufferSize,0))*a,l=e.min(4*u,s);if(u){for(var d=0;d>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,r=0;r<4&&s+.75*r>>6*(3-r)&63));var c=i.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o>>6-s%4*2;i[o>>>2]|=r<<24-o%4*8,o++}return a.create(i,o)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var i=t+n,o=e[i];e[i]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var s=this._hash.words,r=e[t+0],c=e[t+1],h=e[t+2],g=e[t+3],f=e[t+4],m=e[t+5],_=e[t+6],v=e[t+7],y=e[t+8],I=e[t+9],M=e[t+10],C=e[t+11],S=e[t+12],E=e[t+13],T=e[t+14],k=e[t+15],D=s[0],R=s[1],O=s[2],b=s[3];D=u(D,R,O,b,r,7,a[0]),b=u(b,D,R,O,c,12,a[1]),O=u(O,b,D,R,h,17,a[2]),R=u(R,O,b,D,g,22,a[3]),D=u(D,R,O,b,f,7,a[4]),b=u(b,D,R,O,m,12,a[5]),O=u(O,b,D,R,_,17,a[6]),R=u(R,O,b,D,v,22,a[7]),D=u(D,R,O,b,y,7,a[8]),b=u(b,D,R,O,I,12,a[9]),O=u(O,b,D,R,M,17,a[10]),R=u(R,O,b,D,C,22,a[11]),D=u(D,R,O,b,S,7,a[12]),b=u(b,D,R,O,E,12,a[13]),O=u(O,b,D,R,T,17,a[14]),D=l(D,R=u(R,O,b,D,k,22,a[15]),O,b,c,5,a[16]),b=l(b,D,R,O,_,9,a[17]),O=l(O,b,D,R,C,14,a[18]),R=l(R,O,b,D,r,20,a[19]),D=l(D,R,O,b,m,5,a[20]),b=l(b,D,R,O,M,9,a[21]),O=l(O,b,D,R,k,14,a[22]),R=l(R,O,b,D,f,20,a[23]),D=l(D,R,O,b,I,5,a[24]),b=l(b,D,R,O,T,9,a[25]),O=l(O,b,D,R,g,14,a[26]),R=l(R,O,b,D,y,20,a[27]),D=l(D,R,O,b,E,5,a[28]),b=l(b,D,R,O,h,9,a[29]),O=l(O,b,D,R,v,14,a[30]),D=d(D,R=l(R,O,b,D,S,20,a[31]),O,b,m,4,a[32]),b=d(b,D,R,O,y,11,a[33]),O=d(O,b,D,R,C,16,a[34]),R=d(R,O,b,D,T,23,a[35]),D=d(D,R,O,b,c,4,a[36]),b=d(b,D,R,O,f,11,a[37]),O=d(O,b,D,R,v,16,a[38]),R=d(R,O,b,D,M,23,a[39]),D=d(D,R,O,b,E,4,a[40]),b=d(b,D,R,O,r,11,a[41]),O=d(O,b,D,R,g,16,a[42]),R=d(R,O,b,D,_,23,a[43]),D=d(D,R,O,b,I,4,a[44]),b=d(b,D,R,O,S,11,a[45]),O=d(O,b,D,R,k,16,a[46]),D=p(D,R=d(R,O,b,D,h,23,a[47]),O,b,r,6,a[48]),b=p(b,D,R,O,v,10,a[49]),O=p(O,b,D,R,T,15,a[50]),R=p(R,O,b,D,m,21,a[51]),D=p(D,R,O,b,S,6,a[52]),b=p(b,D,R,O,g,10,a[53]),O=p(O,b,D,R,M,15,a[54]),R=p(R,O,b,D,c,21,a[55]),D=p(D,R,O,b,y,6,a[56]),b=p(b,D,R,O,k,10,a[57]),O=p(O,b,D,R,_,15,a[58]),R=p(R,O,b,D,E,21,a[59]),D=p(D,R,O,b,f,6,a[60]),b=p(b,D,R,O,C,10,a[61]),O=p(O,b,D,R,h,15,a[62]),R=p(R,O,b,D,I,21,a[63]),s[0]=s[0]+D|0,s[1]=s[1]+R|0,s[2]=s[2]+O|0,s[3]=s[3]+b|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,o=8*t.sigBytes;n[o>>>5]|=128<<24-o%32;var s=e.floor(i/4294967296),a=i;n[15+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),n[14+(o+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(n.length+1),this._process();for(var r=this._hash,c=r.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return r},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,i,o,s,a){var r=e+(t&n|~t&i)+o+a;return(r<>>32-s)+t}function l(e,t,n,i,o,s,a){var r=e+(t&i|n&~i)+o+a;return(r<>>32-s)+t}function d(e,t,n,i,o,s,a){var r=e+(t^n^i)+o+a;return(r<>>32-s)+t}function p(e,t,n,i,o,s,a){var r=e+(n^(t|~i))+o+a;return(r<>>32-s)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),u=(c=r).lib,l=u.WordArray,d=u.Hasher,g=c.algo,f=[],m=g.SHA1=d.extend({_doReset:function(){this._hash=new l.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],o=n[1],s=n[2],a=n[3],r=n[4],c=0;c<80;c++){if(c<16)f[c]=0|e[t+c];else{var u=f[c-3]^f[c-8]^f[c-14]^f[c-16];f[c]=u<<1|u>>>31}var l=(i<<5|i>>>27)+r+f[c];l+=c<20?1518500249+(o&s|~o&a):c<40?1859775393+(o^s^a):c<60?(o&s|o&a|s&a)-1894007588:(o^s^a)-899497514,r=a,a=s,s=o<<30|o>>>2,o=i,i=l}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+s|0,n[3]=n[3]+a|0,n[4]=n[4]+r|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(i+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=d.clone.call(this);return e._hash=this._hash.clone(),e}}),c.SHA1=d._createHelper(m),c.HmacSHA1=d._createHmacHelper(m),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],c=[];!function(){function t(t){for(var n=e.sqrt(t),i=2;i<=n;i++)if(!(t%i))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var i=2,o=0;o<64;)t(i)&&(o<8&&(a[o]=n(e.pow(i,.5))),c[o]=n(e.pow(i,1/3)),o++),i++}();var u=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],o=n[1],s=n[2],a=n[3],r=n[4],l=n[5],d=n[6],p=n[7],h=0;h<64;h++){if(h<16)u[h]=0|e[t+h];else{var g=u[h-15],f=(g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3,m=u[h-2],_=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[h]=f+u[h-7]+_+u[h-16]}var v=i&o^i&s^o&s,y=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),I=p+((r<<26|r>>>6)^(r<<21|r>>>11)^(r<<7|r>>>25))+(r&l^~r&d)+c[h]+u[h];p=d,d=l,l=r,r=a+I|0,a=s,s=o,o=i,i=I+(y+v)|0}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+s|0,n[3]=n[3]+a|0,n[4]=n[4]+r|0,n[5]=n[5]+l|0,n[6]=n[6]+d|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(i/4294967296),n[15+(o+64>>>9<<4)]=i,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),function(){var e=r,t=e.lib.WordArray,n=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],o=0;o>>2]>>>16-o%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var n=e.length,i=[],o=0;o>>1]|=e.charCodeAt(o)<<16-o%2*16;return t.create(i,2*n)}},n.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,o=[],s=0;s>>2]>>>16-s%4*8&65535);o.push(String.fromCharCode(a))}return o.join("")},parse:function(e){for(var n=e.length,o=[],s=0;s>>1]|=i(e.charCodeAt(s)<<16-s%2*16);return t.create(o,2*n)}}}(),function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,i=[],o=0;o>>2]|=e[o]<<24-o%4*8;t.call(this,i,n)}else t.apply(this,arguments)}).prototype=e}}(), /** @preserve (c) 2012 by C��dric Mesnil. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ function(){var e=r,t=e.lib,n=t.WordArray,i=t.Hasher,o=e.algo,s=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),l=n.create([0,1518500249,1859775393,2400959708,2840853838]),d=n.create([1352829926,1548603684,1836072691,2053994217,0]),p=o.RIPEMD160=i.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var i=t+n,o=e[i];e[i]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var r,p,y,I,M,C,S,E,T,k,D,R=this._hash.words,O=l.words,b=d.words,A=s.words,L=a.words,P=c.words,N=u.words;for(C=r=R[0],S=p=R[1],E=y=R[2],T=I=R[3],k=M=R[4],n=0;n<80;n+=1)D=r+e[t+A[n]]|0,D+=n<16?h(p,y,I)+O[0]:n<32?g(p,y,I)+O[1]:n<48?f(p,y,I)+O[2]:n<64?m(p,y,I)+O[3]:_(p,y,I)+O[4],D=(D=v(D|=0,P[n]))+M|0,r=M,M=I,I=v(y,10),y=p,p=D,D=C+e[t+L[n]]|0,D+=n<16?_(S,E,T)+b[0]:n<32?m(S,E,T)+b[1]:n<48?f(S,E,T)+b[2]:n<64?g(S,E,T)+b[3]:h(S,E,T)+b[4],D=(D=v(D|=0,N[n]))+k|0,C=k,k=T,T=v(E,10),E=S,S=D;D=R[1]+y+T|0,R[1]=R[2]+I+k|0,R[2]=R[3]+M+C|0,R[3]=R[4]+r+S|0,R[4]=R[0]+p+E|0,R[0]=D},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,s=o.words,a=0;a<5;a++){var r=s[a];s[a]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}return o},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function h(e,t,n){return e^t^n}function g(e,t,n){return e&t|~e&n}function f(e,t,n){return(e|~t)^n}function m(e,t,n){return e&n|t&~n}function _(e,t,n){return e^(t|~n)}function v(e,t){return e<>>32-t}e.RIPEMD160=i._createHelper(p),e.HmacRIPEMD160=i._createHmacHelper(p)}(),function(){var e=r,t=e.lib.Base,n=e.enc.Utf8;e.algo.HMAC=t.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var i=e.blockSize,o=4*i;t.sigBytes>o&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),r=s.words,c=a.words,u=0;u>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(R=n[o]).high^=a,R.low^=s}for(var r=0;r<24;r++){for(var p=0;p<5;p++){for(var h=0,g=0,f=0;f<5;f++)h^=(R=n[p+5*f]).high,g^=R.low;var m=d[p];m.high=h,m.low=g}for(p=0;p<5;p++){var _=d[(p+4)%5],v=d[(p+1)%5],y=v.high,I=v.low;for(h=_.high^(y<<1|I>>>31),g=_.low^(I<<1|y>>>31),f=0;f<5;f++)(R=n[p+5*f]).high^=h,R.low^=g}for(var M=1;M<25;M++){var C=(R=n[M]).high,S=R.low,E=c[M];E<32?(h=C<>>32-E,g=S<>>32-E):(h=S<>>64-E,g=C<>>64-E);var T=d[u[M]];T.high=h,T.low=g}var k=d[0],D=n[0];for(k.high=D.high,k.low=D.low,p=0;p<5;p++)for(f=0;f<5;f++){var R=n[M=p+5*f],O=d[M],b=d[(p+1)%5+5*f],A=d[(p+2)%5+5*f];R.high=O.high^~b.high&A.high,R.low=O.low^~b.low&A.low}R=n[0];var L=l[r];R.high^=L.high,R.low^=L.low}},_doFinalize:function(){var t=this._data,n=t.words,o=(this._nDataBytes,8*t.sigBytes),s=32*this.blockSize;n[o>>>5]|=1<<24-o%32,n[(e.ceil((o+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,r=this.cfg.outputLength/8,c=r/8,u=[],l=0;l>>24)|4278255360&(p<<24|p>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),u.push(h),u.push(p)}return new i.init(u,r)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),n=0;n<25;n++)t[n]=t[n].clone();return e}});t.SHA3=o._createHelper(p),t.HmacSHA3=o._createHmacHelper(p)}(Math),function(){var e=r,t=e.lib.Hasher,n=e.x64,i=n.Word,o=n.WordArray,s=e.algo;function a(){return i.create.apply(i,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=a()}();var l=s.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],o=n[1],s=n[2],a=n[3],r=n[4],l=n[5],d=n[6],p=n[7],h=i.high,g=i.low,f=o.high,m=o.low,_=s.high,v=s.low,y=a.high,I=a.low,M=r.high,C=r.low,S=l.high,E=l.low,T=d.high,k=d.low,D=p.high,R=p.low,O=h,b=g,A=f,L=m,P=_,N=v,w=y,U=I,G=M,x=C,F=S,B=E,q=T,V=k,j=D,H=R,K=0;K<80;K++){var z,W,Y=u[K];if(K<16)W=Y.high=0|e[t+2*K],z=Y.low=0|e[t+2*K+1];else{var $=u[K-15],J=$.high,X=$.low,Q=(J>>>1|X<<31)^(J>>>8|X<<24)^J>>>7,Z=(X>>>1|J<<31)^(X>>>8|J<<24)^(X>>>7|J<<25),ee=u[K-2],te=ee.high,ne=ee.low,ie=(te>>>19|ne<<13)^(te<<3|ne>>>29)^te>>>6,oe=(ne>>>19|te<<13)^(ne<<3|te>>>29)^(ne>>>6|te<<26),se=u[K-7],ae=se.high,re=se.low,ce=u[K-16],ue=ce.high,le=ce.low;W=(W=(W=Q+ae+((z=Z+re)>>>0>>0?1:0))+ie+((z+=oe)>>>0>>0?1:0))+ue+((z+=le)>>>0>>0?1:0),Y.high=W,Y.low=z}var de,pe=G&F^~G&q,he=x&B^~x&V,ge=O&A^O&P^A&P,fe=b&L^b&N^L&N,me=(O>>>28|b<<4)^(O<<30|b>>>2)^(O<<25|b>>>7),_e=(b>>>28|O<<4)^(b<<30|O>>>2)^(b<<25|O>>>7),ve=(G>>>14|x<<18)^(G>>>18|x<<14)^(G<<23|x>>>9),ye=(x>>>14|G<<18)^(x>>>18|G<<14)^(x<<23|G>>>9),Ie=c[K],Me=Ie.high,Ce=Ie.low,Se=j+ve+((de=H+ye)>>>0>>0?1:0),Ee=_e+fe;j=q,H=V,q=F,V=B,F=G,B=x,G=w+(Se=(Se=(Se=Se+pe+((de+=he)>>>0>>0?1:0))+Me+((de+=Ce)>>>0>>0?1:0))+W+((de+=z)>>>0>>0?1:0))+((x=U+de|0)>>>0>>0?1:0)|0,w=P,U=N,P=A,N=L,A=O,L=b,O=Se+(me+ge+(Ee>>>0<_e>>>0?1:0))+((b=de+Ee|0)>>>0>>0?1:0)|0}g=i.low=g+b,i.high=h+O+(g>>>0>>0?1:0),m=o.low=m+L,o.high=f+A+(m>>>0>>0?1:0),v=s.low=v+N,s.high=_+P+(v>>>0>>0?1:0),I=a.low=I+U,a.high=y+w+(I>>>0>>0?1:0),C=r.low=C+x,r.high=M+G+(C>>>0>>0?1:0),E=l.low=E+B,l.high=S+F+(E>>>0>>0?1:0),k=d.low=k+V,d.high=T+q+(k>>>0>>0?1:0),R=p.low=R+H,p.high=D+j+(R>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(i+128>>>10<<5)]=n,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(l),e.HmacSHA512=t._createHmacHelper(l)}(),function(){var e=r,t=e.x64,n=t.Word,i=t.WordArray,o=e.algo,s=o.SHA512,a=o.SHA384=s.extend({_doReset:function(){this._hash=new i.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}});e.SHA384=s._createHelper(a),e.HmacSHA384=s._createHmacHelper(a)}(),r.lib.Cipher||function(){var e=r,t=e.lib,n=t.Base,i=t.WordArray,o=t.BufferedBlockAlgorithm,s=e.enc,a=(s.Utf8,s.Base64),c=e.algo.EvpKDF,u=t.Cipher=o.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?v:m}return function(t){return{encrypt:function(n,i,o){return e(i).encrypt(t,n,i,o)},decrypt:function(n,i,o){return e(i).decrypt(t,n,i,o)}}}}()}),l=(t.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),e.mode={}),d=t.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=l.CBC=function(){var e=d.extend();function t(e,t,n){var i,o=this._iv;o?(i=o,this._iv=void 0):i=this._prevBlock;for(var s=0;s>>2];e.sigBytes-=t}},g=(t.BlockCipher=u.extend({cfg:u.cfg.extend({mode:p,padding:h}),reset:function(){var e;u.reset.call(this);var t=this.cfg,n=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,n&&n.words):(this._mode=e.call(i,this,n&&n.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),f=(e.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;return(n?i.create([1398893684,1701076831]).concat(n).concat(t):t).toString(a)},parse:function(e){var t,n=a.parse(e),o=n.words;return 1398893684==o[0]&&1701076831==o[1]&&(t=i.create(o.slice(2,4)),o.splice(0,4),n.sigBytes-=16),g.create({ciphertext:n,salt:t})}},m=t.SerializableCipher=n.extend({cfg:n.extend({format:f}),encrypt:function(e,t,n,i){i=this.cfg.extend(i);var o=e.createEncryptor(n,i),s=o.finalize(t),a=o.cfg;return g.create({ciphertext:s,key:n,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,n,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(n,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),_=(e.kdf={}).OpenSSL={execute:function(e,t,n,o){o||(o=i.random(8));var s=c.create({keySize:t+n}).compute(e,o),a=i.create(s.words.slice(t),4*n);return s.sigBytes=4*t,g.create({key:s,iv:a,salt:o})}},v=t.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:_}),encrypt:function(e,t,n,i){var o=(i=this.cfg.extend(i)).kdf.execute(n,e.keySize,e.ivSize);i.iv=o.iv;var s=m.encrypt.call(this,e,t,o.key,i);return s.mixIn(o),s},decrypt:function(e,t,n,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var o=i.kdf.execute(n,e.keySize,e.ivSize,t.salt);return i.iv=o.iv,m.decrypt.call(this,e,t,o.key,i)}})}(),r.mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,n,i){var o,s=this._iv;s?(o=s.slice(0),this._iv=void 0):o=this._prevBlock,i.encryptBlock(o,0);for(var a=0;a>>2]|=o<<24-s%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126={pad:function(e,t){var n=4*t,i=n-e.sigBytes%n;e.concat(r.lib.WordArray.random(i-1)).concat(r.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.mode.OFB=(i=(n=r.lib.BlockCipherMode.extend()).Encryptor=n.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=this._iv,s=this._keystream;o&&(s=this._keystream=o.slice(0),this._iv=void 0),n.encryptBlock(s,0);for(var a=0;a>>8^255&g^99,i[n]=g,o[g]=n;var f=e[n],m=e[f],_=e[m],v=257*e[g]^16843008*g;s[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,c[n]=v<<8|v>>>24,u[n]=v,v=16843009*_^65537*m^257*f^16843008*n,l[g]=v<<24|v>>>8,d[g]=v<<16|v>>>16,p[g]=v<<8|v>>>24,h[g]=v,n?(n=f^e[e[e[_^f]]],r^=e[e[r]]):n=r=1}}();var g=[0,1,2,4,8,16,32,64,128,27,54],f=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,o=4*((this._nRounds=n+6)+1),s=this._keySchedule=[],a=0;a6&&a%n==4&&(u=i[u>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u]):(u=i[(u=u<<8|u>>>24)>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u],u^=g[a/n|0]<<24),s[a]=s[a-n]^u);for(var r=this._invKeySchedule=[],c=0;c>>24]]^d[i[u>>>16&255]]^p[i[u>>>8&255]]^h[i[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,u,i)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,l,d,p,h,o),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,i,o,s,a,r){for(var c=this._nRounds,u=e[t]^n[0],l=e[t+1]^n[1],d=e[t+2]^n[2],p=e[t+3]^n[3],h=4,g=1;g>>24]^o[l>>>16&255]^s[d>>>8&255]^a[255&p]^n[h++],m=i[l>>>24]^o[d>>>16&255]^s[p>>>8&255]^a[255&u]^n[h++],_=i[d>>>24]^o[p>>>16&255]^s[u>>>8&255]^a[255&l]^n[h++],v=i[p>>>24]^o[u>>>16&255]^s[l>>>8&255]^a[255&d]^n[h++];u=f,l=m,d=_,p=v}f=(r[u>>>24]<<24|r[l>>>16&255]<<16|r[d>>>8&255]<<8|r[255&p])^n[h++],m=(r[l>>>24]<<24|r[d>>>16&255]<<16|r[p>>>8&255]<<8|r[255&u])^n[h++],_=(r[d>>>24]<<24|r[p>>>16&255]<<16|r[u>>>8&255]<<8|r[255&l])^n[h++],v=(r[p>>>24]<<24|r[u>>>16&255]<<16|r[l>>>8&255]<<8|r[255&d])^n[h++],e[t]=f,e[t+1]=m,e[t+2]=_,e[t+3]=v},keySize:8});e.AES=t._createHelper(f)}(),function(){var e=r,t=e.lib,n=t.WordArray,i=t.BlockCipher,o=e.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=o.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],n=0;n<56;n++){var i=s[n]-1;t[n]=e[i>>>5]>>>31-i%32&1}for(var o=this._subKeys=[],r=0;r<16;r++){var u=o[r]=[],l=c[r];for(n=0;n<24;n++)u[n/6|0]|=t[(a[n]-1+l)%28]<<31-n%6,u[4+(n/6|0)]|=t[28+(a[n+24]-1+l)%28]<<31-n%6;for(u[0]=u[0]<<1|u[0]>>>31,n=1;n<7;n++)u[n]=u[n]>>>4*(n-1)+3;u[7]=u[7]<<5|u[7]>>>27}var d=this._invSubKeys=[];for(n=0;n<16;n++)d[n]=o[15-n]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,n){this._lBlock=e[t],this._rBlock=e[t+1],p.call(this,4,252645135),p.call(this,16,65535),h.call(this,2,858993459),h.call(this,8,16711935),p.call(this,1,1431655765);for(var i=0;i<16;i++){for(var o=n[i],s=this._lBlock,a=this._rBlock,r=0,c=0;c<8;c++)r|=u[c][((a^o[c])&l[c])>>>0];this._lBlock=a,this._rBlock=s^r}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,p.call(this,1,1431655765),h.call(this,8,16711935),h.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function p(e,t){var n=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=n,this._lBlock^=n<>>e^this._lBlock)&t;this._lBlock^=n,this._rBlock^=n<192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),o=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(t)),this._des2=d.createEncryptor(n.create(i)),this._des3=d.createEncryptor(n.create(o))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(g)}(),function(){var e=r,t=e.lib.StreamCipher,n=e.algo,i=n.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,i=this._S=[],o=0;o<256;o++)i[o]=o;o=0;for(var s=0;o<256;o++){var a=o%n,r=t[a>>>2]>>>24-a%4*8&255;s=(s+i[o]+r)%256;var c=i[o];i[o]=i[s],i[s]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,n=this._j,i=0,o=0;o<4;o++){n=(n+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[n],e[n]=s,i|=e[(e[t]+e[n])%256]<<24-8*o}return this._i=t,this._j=n,i}e.RC4=t._createHelper(i);var s=n.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(s)}(), /** @preserve * Counter block mode compatible with Dr Brian Gladman fileenc.c * derived from CryptoJS.mode.CTR * Jan Hruby jhruby.web@gmail.com */ r.mode.CTRGladman=function(){var e=r.lib.BlockCipherMode.extend();function t(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,n=e>>8&255,i=255&e;255===t?(t=0,255===n?(n=0,255===i?i=0:++i):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=i}return e}var n=e.Encryptor=e.extend({processBlock:function(e,n){var i,o=this._cipher,s=o.blockSize,a=this._iv,r=this._counter;a&&(r=this._counter=a.slice(0),this._iv=void 0),0===((i=r)[0]=t(i[0]))&&(i[1]=t(i[1]));var c=r.slice(0);o.encryptBlock(c,0);for(var u=0;u>>24)|4278255360&(e[n]<<24|e[n]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)o[n]^=i[n+4&7];if(t){var s=t.words,a=s[0],r=s[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),d=u>>>16|4294901760&l,p=l<<16|65535&u;for(o[0]^=u,o[1]^=d,o[2]^=l,o[3]^=p,o[4]^=u,o[5]^=d,o[6]^=l,o[7]^=p,n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var o=0;o<4;o++)i[o]=16711935&(i[o]<<8|i[o]>>>24)|4278255360&(i[o]<<24|i[o]>>>8),e[t+o]^=i[o]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)o[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,n=0;n<8;n++){var i=e[n]+t[n],a=65535&i,r=i>>>16,c=((a*a>>>17)+a*r>>>15)+r*r,u=((4294901760&i)*i|0)+((65535&i)*i|0);s[n]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=t._createHelper(a)}(),r.mode.CTR=function(){var e=r.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0);var a=s.slice(0);n.encryptBlock(a,0),s[i-1]=s[i-1]+1|0;for(var r=0;r>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)i[o]^=n[o+4&7];if(t){var s=t.words,a=s[0],r=s[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),d=u>>>16|4294901760&l,p=l<<16|65535&u;for(i[0]^=u,i[1]^=d,i[2]^=l,i[3]^=p,i[4]^=u,i[5]^=d,i[6]^=l,i[7]^=p,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var o=0;o<4;o++)i[o]=16711935&(i[o]<<8|i[o]>>>24)|4278255360&(i[o]<<24|i[o]>>>8),e[t+o]^=i[o]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)o[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,n=0;n<8;n++){var i=e[n]+t[n],a=65535&i,r=i>>>16,c=((a*a>>>17)+a*r>>>15)+r*r,u=((4294901760&i)*i|0)+((65535&i)*i|0);s[n]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=t._createHelper(a)}(),r.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},r)},c(u={exports:{}},u.exports),u.exports);return function(){function t(n){e(this,t);var i=n.isArray,o=n.isMap,s=n.isDevMode;this._isArray=i,this._isMap=o,this._isDevMode=s,this._interceptProfanityList=[],this._interceptFilter=null,this._interceptRegExpList=[],this._replacingProfanityMap=new Map,this._replacingFilter=null,this._replacingRegExpMap=new Map,this._key="",this._iv="",this._decryptOptions=void 0,this._n="TIMProfanityFilterPlugin",!0===s&&console.log("".concat(this._n,".VERSION:").concat("1.1.0"))}return n(t,[{key:"onToken",value:function(e){this._key=g.enc.Utf8.parse(e.slice(0,32)),this._iv=this._key,this._decryptOptions={iv:this._iv,mode:g.mode.CBC,padding:g.pad.Pkcs7}}},{key:"onLexiconSliced",value:function(e){if(this._isArray(e)&&0!==e.length){var t,n,i,o=r(e);try{for(o.s();!(i=o.n()).done;){var s=i.value,a=s.filterType,c=s.profanityType,u=s.profanity,l=s.replacement;t=this._getDecryptedString(u),n=this._getDecryptedString(l),1===a?1===c?this._interceptProfanityList.push(t):2===c&&this._interceptRegExpList.push(t):2===a&&(1===c?this._replacingProfanityMap.set(t,n):2===c&&this._replacingRegExpMap.set(t,n))}}catch(d){o.e(d)}finally{o.f()}}}},{key:"_getDecryptedString",value:function(e){var t=g.AES.decrypt(e,this._key,this._decryptOptions);return g.enc.Utf8.stringify(t).toLowerCase()}},{key:"onLexiconCompleted",value:function(e){this.onLexiconSliced(e),this._interceptFilter=new d({input:this._interceptProfanityList,isArray:this._isArray,isMap:this._isMap}),this._replacingFilter=new d({input:this._replacingProfanityMap,isArray:this._isArray,isMap:this._isMap}),!0===this._isDevMode&&(console.log("".concat(this._n," _interceptProfanityList ->"),this._interceptProfanityList),console.log("".concat(this._n," _interceptRegExpList ->"),this._interceptRegExpList),console.log("".concat(this._n," _replacingProfanityMap ->"),this._replacingProfanityMap),console.log("".concat(this._n," _replacingRegExpMap ->"),this._replacingRegExpMap))}},{key:"filter",value:function(e){var t={type:0,modifiedText:e};if("string"!=typeof e)return!0===this._isDevMode&&console.warn("".concat(this._n,".filter invalid params, string required!")),t;if(!0===this._interceptFilter.filter({text:e,replacingEnabled:!1}).isMatched)return t.type=1,t;for(var n=!1,o=0,s=this._interceptRegExpList.length;o{this.events[e].clear()})),this.events={}}dispatch(e,t){if(this.events[e])for(const n of this.events[e].keys())n.call(this,t)}bindIMEvents(){this.engine.chat.on(this.engine.EVENT.SDK_READY,this.onSDKReady,this),this.engine.chat.on(this.engine.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.engine.chat.on(this.engine.EVENT.KICKED_OUT,this.onKickedOut,this),this.engine.chat.on(this.engine.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_RECEIVED,this.onReceiveMessage,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_MODIFIED,this.onMessageModified,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_REVOKED,this.onMessageRevoked,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated,this),this.engine.chat.on(this.engine.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated,this),this.engine.chat.on(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalMessageCountUpdated,this),this.engine.chat.on(this.engine.EVENT.PROFILE_UPDATED,this.onProfileUpdated,this),this.engine.chat.on(this.engine.EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated,this),this.engine.chat.on(this.engine.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated,this),this.engine.chat.on(this.engine.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated,this),this.engine.chat.on(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated,this)}unbindIMEvents(){this.engine.chat.off(this.engine.EVENT.SDK_READY,this.onSDKReady,this),this.engine.chat.off(this.engine.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.engine.chat.off(this.engine.EVENT.KICKED_OUT,this.onKickedOut,this),this.engine.chat.off(this.engine.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_RECEIVED,this.onReceiveMessage,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_MODIFIED,this.onMessageModified,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_REVOKED,this.onMessageRevoked,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated,this),this.engine.chat.off(this.engine.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated,this),this.engine.chat.off(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalMessageCountUpdated,this),this.engine.chat.off(this.engine.EVENT.PROFILE_UPDATED,this.onProfileUpdated,this),this.engine.chat.off(this.engine.EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated,this),this.engine.chat.off(this.engine.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated,this),this.engine.chat.off(this.engine.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated,this),this.engine.chat.off(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated,this),qg.instance=null}onSDKReady(e){this.dispatch(this.engine.EVENT.SDK_READY,e.data)}onSDKNotReady(e){this.dispatch(this.engine.EVENT.SDK_NOT_READY,e.data)}onKickedOut(e){this.dispatch(this.engine.EVENT.KICKED_OUT,e.data)}onNetStateChange(e){this.dispatch(this.engine.EVENT.NET_STATE_CHANGE,e.data)}onReceiveMessage(e){this.dispatch(this.engine.EVENT.MESSAGE_RECEIVED,e.data)}onMessageModified(e){this.dispatch(this.engine.EVENT.MESSAGE_MODIFIED,e.data)}onMessageRevoked(e){this.dispatch(this.engine.EVENT.MESSAGE_REVOKED,e.data)}onMessageReadByPeer(e){this.dispatch(this.engine.EVENT.MESSAGE_READ_BY_PEER,e.data)}onMessageReadReceiptReceived(e){this.dispatch(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,e.data)}onMessageReactionsUpdated(e){this.dispatch(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,e.data)}onConversationListUpdated(e){this.dispatch(this.engine.EVENT.CONVERSATION_LIST_UPDATED,e.data)}onTotalMessageCountUpdated(e){this.dispatch(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,e.data)}onProfileUpdated(e){this.dispatch(this.engine.EVENT.PROFILE_UPDATED,e.data)}onBlacklistUpdated(e){this.dispatch(this.engine.EVENT.BLACKLIST_UPDATED,e.data)}onUserStatusUpdated(e){this.dispatch(this.engine.EVENT.USER_STATUS_UPDATED,e.data)}onGroupListUpdated(e){this.dispatch(this.engine.EVENT.GROUP_LIST_UPDATED,e.data)}onGroupAttributesUpdated(e){this.dispatch(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,e.data)}onGroupCounterUpdated(e){this.dispatch(this.engine.EVENT.GROUP_COUNTER_UPDATED,e.data)}onFriendListUpdated(e){this.dispatch(this.engine.EVENT.FRIEND_LIST_UPDATED,e.data)}onFriendApplicationListUpdated(e){this.dispatch(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,e.data)}}var Vg,jg,Hg,Kg,zg,Wg,Yg,$g,Jg;!function(e){e.TUIStore="TUIStore",e.TUITranslate="TUITranslate",e.TUIConversation="TUIConversation",e.TUIChat="TUIChat",e.TUIGroup="TUIGroup",e.TUIUser="TUIUser",e.TUIFriend="TUIFriend",e.TUIReport="TUIReport"}(Vg||(Vg={})),function(e){e.APP="application",e.CONV="conversation",e.CHAT="chat",e.GRP="group",e.USER="user",e.FRIEND="friend",e.SEARCH="search",e.CUSTOM="custom"}(jg||(jg={})),function(e){e[e.UNSUB_USER=-1]="UNSUB_USER"}(Hg||(Hg={})),function(e){e.BUSINESS_ID="user_typing_status",e[e.STATUS_START=1]="STATUS_START",e[e.STATUS_END=0]="STATUS_END",e[e.VERSION=1]="VERSION",e[e.ACTION_START_ID=14]="ACTION_START_ID",e[e.ACTION_END_ID=0]="ACTION_END_ID",e.ACTION_START="EIMAMSG_InputStatus_Ing",e.ACTION_END="EIMAMSG_InputStatus_End",e[e.NEED_TYPING=1]="NEED_TYPING"}(Kg||(Kg={})),function(e){e.ADD="add",e.REMOVE="remove"}(zg||(zg={})),function(e){e[e.MSG_MODIFY_CONFLICT=2480]="MSG_MODIFY_CONFLICT",e[e.MSG_MODIFY_DISABLED_IN_AVCHATROOM=2481]="MSG_MODIFY_DISABLED_IN_AVCHATROOM",e[e.MODIFY_MESSAGE_NOT_EXIST=20026]="MODIFY_MESSAGE_NOT_EXIST"}(Wg||(Wg={})),function(e){e[e.NOT_INIT=-1e5]="NOT_INIT",e[e.INVALID_CONV_ID=-100001]="INVALID_CONV_ID",e[e.CONV_ID_SAME=-100002]="CONV_ID_SAME",e[e.CONV_NOT_EXIST=-100003]="CONV_NOT_EXIST",e[e.GET_MSG_LIST_ERROR=-100004]="GET_MSG_LIST_ERROR",e[e.MISMATCH_TYPE_AND_PAYLOAD=-100005]="MISMATCH_TYPE_AND_PAYLOAD"}(Yg||(Yg={})),function(e){e.MSG_MODIFY_CONFLICT="MODIFY_MESSAGE_ERROR,修改消息发生冲突, data.message 是最新的消息",e.MSG_MODIFY_DISABLED_IN_AVCHATROOM="MODIFY_MESSAGE_ERROR,不支持修改直播群消息.",e.MODIFY_MESSAGE_NOT_EXIST="MODIFY_MESSAGE_ERROR,消息不存在."}($g||($g={})),function(e){e.NOT_INIT="TUIChatEngine 初始化未完成,请确认 TUIChatEngine.login 接口调用是否正常。",e.INVALID_CONV_ID="会话 ID 无效",e.CONV_ID_SAME="您切换的是同一个会话 ID",e.CONV_NOT_EXIST="会话不存在",e.GET_MSG_LIST_ERROR="Chat SDK is not ready.",e.MISMATCH_TYPE_AND_PAYLOAD="type 与 payload 不匹配."}(Jg||(Jg={}));const Xg={logout:1,destroy:1},Qg=function(e){return void 0===e},Zg=function(e){return e.startsWith("_")},ef=function(e){return/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(e)},tf=function(e){return e&&function(e){if("string"==typeof e)try{return!!JSON.parse(e)}catch(t){return!1}return!1}(e)?JSON.parse(e):e},nf=function(e){let t="";return t=e>=1048576?`${(e/1048576).toFixed(2)} Mb`:e>=1024?`${(e/1024).toFixed(2)} Kb`:`${e.toFixed(2)}B`,t},of={"[TUIEmoji_Expect]":"emoji_0@2x.png","[TUIEmoji_Blink]":"emoji_1@2x.png","[TUIEmoji_Guffaw]":"emoji_2@2x.png","[TUIEmoji_KindSmile]":"emoji_3@2x.png","[TUIEmoji_Haha]":"emoji_4@2x.png","[TUIEmoji_Cheerful]":"emoji_5@2x.png","[TUIEmoji_Smile]":"emoji_6@2x.png","[TUIEmoji_Sorrow]":"emoji_7@2x.png","[TUIEmoji_Speechless]":"emoji_8@2x.png","[TUIEmoji_Amazed]":"emoji_9@2x.png","[TUIEmoji_Complacent]":"emoji_10@2x.png","[TUIEmoji_Lustful]":"emoji_11@2x.png","[TUIEmoji_Stareyes]":"emoji_12@2x.png","[TUIEmoji_Giggle]":"emoji_13@2x.png","[TUIEmoji_Daemon]":"emoji_14@2x.png","[TUIEmoji_Rage]":"emoji_15@2x.png","[TUIEmoji_Yawn]":"emoji_16@2x.png","[TUIEmoji_TearsLaugh]":"emoji_17@2x.png","[TUIEmoji_Silly]":"emoji_18@2x.png","[TUIEmoji_Wail]":"emoji_19@2x.png","[TUIEmoji_Kiss]":"emoji_20@2x.png","[TUIEmoji_Trapped]":"emoji_21@2x.png","[TUIEmoji_Fear]":"emoji_22@2x.png","[TUIEmoji_BareTeeth]":"emoji_23@2x.png","[TUIEmoji_FlareUp]":"emoji_24@2x.png","[TUIEmoji_Tact]":"emoji_25@2x.png","[TUIEmoji_Shit]":"emoji_26@2x.png","[TUIEmoji_ShutUp]":"emoji_27@2x.png","[TUIEmoji_Sigh]":"emoji_28@2x.png","[TUIEmoji_Hehe]":"emoji_29@2x.png","[TUIEmoji_Silent]":"emoji_30@2x.png","[TUIEmoji_Skull]":"emoji_31@2x.png","[TUIEmoji_Mask]":"emoji_32@2x.png","[TUIEmoji_Beer]":"emoji_33@2x.png","[TUIEmoji_Cake]":"emoji_34@2x.png","[TUIEmoji_RedPacket]":"emoji_35@2x.png","[TUIEmoji_Bombs]":"emoji_36@2x.png","[TUIEmoji_Ai]":"emoji_37@2x.png","[TUIEmoji_Celebrate]":"emoji_38@2x.png","[TUIEmoji_Bless]":"emoji_39@2x.png","[TUIEmoji_Flower]":"emoji_40@2x.png","[TUIEmoji_Watermelon]":"emoji_41@2x.png","[TUIEmoji_Cow]":"emoji_42@2x.png","[TUIEmoji_Fool]":"emoji_43@2x.png","[TUIEmoji_Surprised]":"emoji_44@2x.png","[TUIEmoji_Askance]":"emoji_45@2x.png","[TUIEmoji_Monster]":"emoji_46@2x.png","[TUIEmoji_Pig]":"emoji_47@2x.png","[TUIEmoji_Coffee]":"emoji_48@2x.png","[TUIEmoji_Ok]":"emoji_49@2x.png","[TUIEmoji_Heart]":"emoji_50@2x.png","[TUIEmoji_Sun]":"emoji_51@2x.png","[TUIEmoji_Moon]":"emoji_52@2x.png","[TUIEmoji_Star]":"emoji_53@2x.png","[TUIEmoji_Rich]":"emoji_54@2x.png","[TUIEmoji_Fortune]":"emoji_55@2x.png","[TUIEmoji_857]":"emoji_56@2x.png","[TUIEmoji_666]":"emoji_57@2x.png","[TUIEmoji_Prohibit]":"emoji_58@2x.png","[TUIEmoji_Convinced]":"emoji_59@2x.png","[TUIEmoji_Knife]":"emoji_60@2x.png","[TUIEmoji_Like]":"emoji_61@2x.png"},sf={"[TUIEmoji_Smile]":"[微笑]","[TUIEmoji_Expect]":"[期待]","[TUIEmoji_Blink]":"[眨眼]","[TUIEmoji_Guffaw]":"[大笑]","[TUIEmoji_KindSmile]":"[姨母笑]","[TUIEmoji_Haha]":"[哈哈哈]","[TUIEmoji_Cheerful]":"[愉快]","[TUIEmoji_Speechless]":"[无语]","[TUIEmoji_Amazed]":"[惊讶]","[TUIEmoji_Sorrow]":"[悲伤]","[TUIEmoji_Complacent]":"[得意]","[TUIEmoji_Silly]":"[傻了]","[TUIEmoji_Lustful]":"[色]","[TUIEmoji_Giggle]":"[憨笑]","[TUIEmoji_Kiss]":"[亲亲]","[TUIEmoji_Wail]":"[大哭]","[TUIEmoji_TearsLaugh]":"[哭笑]","[TUIEmoji_Trapped]":"[困]","[TUIEmoji_Mask]":"[口罩]","[TUIEmoji_Fear]":"[恐惧]","[TUIEmoji_BareTeeth]":"[龇牙]","[TUIEmoji_FlareUp]":"[发怒]","[TUIEmoji_Yawn]":"[打哈欠]","[TUIEmoji_Tact]":"[机智]","[TUIEmoji_Stareyes]":"[星星眼]","[TUIEmoji_ShutUp]":"[闭嘴]","[TUIEmoji_Sigh]":"[叹气]","[TUIEmoji_Hehe]":"[呵呵]","[TUIEmoji_Silent]":"[收声]","[TUIEmoji_Surprised]":"[惊喜]","[TUIEmoji_Askance]":"[白眼]","[TUIEmoji_Ok]":"[OK]","[TUIEmoji_Shit]":"[便便]","[TUIEmoji_Monster]":"[怪兽]","[TUIEmoji_Daemon]":"[恶魔]","[TUIEmoji_Rage]":"[恶魔怒]","[TUIEmoji_Fool]":"[衰]","[TUIEmoji_Pig]":"[猪]","[TUIEmoji_Cow]":"[牛]","[TUIEmoji_Ai]":"[AI]","[TUIEmoji_Skull]":"[骷髅]","[TUIEmoji_Bombs]":"[炸弹]","[TUIEmoji_Coffee]":"[咖啡]","[TUIEmoji_Cake]":"[蛋糕]","[TUIEmoji_Beer]":"[啤酒]","[TUIEmoji_Flower]":"[花]","[TUIEmoji_Watermelon]":"[瓜]","[TUIEmoji_Rich]":"[壕]","[TUIEmoji_Heart]":"[爱心]","[TUIEmoji_Moon]":"[月亮]","[TUIEmoji_Sun]":"[太阳]","[TUIEmoji_Star]":"[星星]","[TUIEmoji_RedPacket]":"[红包]","[TUIEmoji_Celebrate]":"[庆祝]","[TUIEmoji_Bless]":"[福]","[TUIEmoji_Fortune]":"[发]","[TUIEmoji_Convinced]":"[服]","[TUIEmoji_Prohibit]":"[禁]","[TUIEmoji_666]":"[666]","[TUIEmoji_857]":"[857]","[TUIEmoji_Knife]":"[刀]","[TUIEmoji_Like]":"[赞]"},af={enabledMessageReadReceipt:Math.pow(2,5),enabledEmojiPlugin:Math.pow(2,48),enabledOnlineStatus:Math.pow(2,7),enabledCustomerServicePlugin:Math.pow(2,40),enabledTranslationPlugin:Math.pow(2,38),enabledVoiceToText:Math.pow(2,39)},rf=["messageList","conversationList","newMessageList"],cf=["translateTextInfo","voiceToTextInfo"],uf=void 0!==Pn&&"function"==typeof Pn.getSystemInfoSync&&Boolean(Pn.getSystemInfoSync().fontSizeSetting),lf=void 0!==Nn&&"undefined"==typeof window,df=uf||lf,pf=(void 0!==Nn||"undefined"!=typeof window)&&!df,hf=uf?Pn:void 0!==Nn?Nn:window,gf=pf&&window&&window.navigator&&window.navigator.userAgent||"",ff=/Android/i.test(gf),mf=/(?:Windows Phone)/.test(gf),_f=/(?:SymbianOS)/.test(gf),vf=/iPad/i.test(gf)||/iPhone/i.test(gf)||/iPod/i.test(gf),yf=ff||mf||_f||vf,If=pf&&!yf;class Mf{constructor(){this.global=hf,this.isOfficial=!1}static getInstance(){return Mf.instance||(Mf.instance=new Mf),Mf.instance}initOfficial(e){this.isOfficial=e}getPlatform(){let e="";return If?e="pc":yf?e="h5":uf?e="wechat":lf&&!uf&&(e="app"),e}}class Cf{constructor(){this.EVENT=Ng.EVENT,this.TYPES=Ng.TYPES,this.loginStatusPromise=new Map,this.userID="",this.isInited=!1}static getInstance(){return Cf.instance||(Cf.instance=new Cf),Cf.instance}mount(e,t){this[e]=t}login(e){const{chat:t,SDKAppID:n,userID:i}=e,o=1400187352===n||1400188366===n;return this.createChat(e),this.userID=i,Mf.getInstance().initOfficial(o),this.TUIStore.update(jg.APP,"isOfficial",o),this.TUIStore.update(jg.APP,"SDKVersion",Ng.VERSION),this.eventCenter=new qg(this),this.eventCenter.removeEvents(),this.resetStore(),this.initService(),t&&t.isReady()?(console.log("TUIChatEngine.login ok, from TUICore."),this.TUIUser.getUserProfile(),this.checkCommercialAbility(),Promise.resolve({})):(this.registerPlugin(e),this.eventCenter.addEvent(this.EVENT.SDK_READY,(()=>{this.onSDKReady()})),this.eventCenter.addEvent(this.EVENT.SDK_NOT_READY,(()=>{this.onSDKNotReady()})),this.loginChat(e))}logout(){return this.userID="",this.isInited=!1,this.resetStore(),this.chat.logout()}isReady(){var e;return(null===(e=this.chat)||void 0===e?void 0:e.isReady())||!1}setLogLevel(e){this.chat?this.chat.setLogLevel(e):console.warn("TUIChatEngine 初始化未完成,请确认 TUIChatEngine.login 接口调用是否正常。")}destroy(){return this.eventCenter.unbindIMEvents(),this.isInited=!1,this.resetStore(),this.chat.destroy()}getMyUserID(){return this.userID}resetStore(){this.TUIStore.reset(jg.CHAT),this.TUIStore.reset(jg.CONV),this.TUIStore.reset(jg.GRP),this.TUIStore.reset(jg.USER),this.TUIStore.reset(jg.SEARCH),this.TUIStore.reset(jg.FRIEND),this.TUIStore.reset(jg.CUSTOM),console.log("TUIChatEngine.resetStore ok.")}initService(){this.TUIChat.init(),this.TUIConversation.init(),this.TUIUser.init(),this.initOptionalServices(),this.isInited=!0,console.log("TUIChatEngine.initService ok.")}initOptionalServices(){const e=Ng.VERSION.split(".");e[0]>3||3===e[0]&&e[1]>=3&&e[2]>0?(!0===this.chat.callExperimentalAPI("canIUseModule",["group-module"])&&this.TUIGroup.init(),!0===this.chat.callExperimentalAPI("canIUseModule",["relationship-module"])&&this.TUIFriend.init()):(this.TUIGroup.init(),this.TUIFriend.init())}createChat(e){const{chat:t}=e,n=Fg(e,["chat"]);Qg(t)?this.chat=Ng.create(Object.assign(Object.assign({},n),{scene:"chat-uikit-engine"})):this.chat=t}loginChat(e){const{userID:t,userSig:n}=e;return new Promise(((e,i)=>{this.chat.login({userID:t,userSig:n}).then((t=>{console.log("TUIChatEngine.loginChat ok."),this.checkCommercialAbility(),t.data.repeatLogin&&this.chat.isReady()&&e(t),this.loginStatusPromise.set("login",{resolve:e,reject:i,imResponse:t})})).catch((e=>{i(e)}))}))}registerPlugin(e){const{useUploadPlugin:t=!1,useProfanityFilterPlugin:n=!1,TIMPush:i,pushConfig:o,TUIOfflinePush:s,offlinePushConfig:a}=e;!0===t&&this.chat.registerPlugin({"tim-upload-plugin":Ug}),!0===n&&this.chat.registerPlugin({"tim-profanity-filter-plugin":xg}),!lf||uf||Qg(i)||Qg(o)||this.chat.registerPlugin({"tim-push":i,pushConfig:o}),!lf||uf||Qg(s)||Qg(a)||this.chat.registerPlugin({"tim-offline-push-plugin":s,offlinePushConfig:a})}onSDKReady(){if(this.loginStatusPromise.has("login")){const e=this.loginStatusPromise.get("login");e.resolve(e.imResponse),this.TUIUser.getUserProfile()}this.loginStatusPromise.delete("login")}onSDKNotReady(){this.loginStatusPromise.has("login")&&this.loginStatusPromise.get("login").reject(new Error("sdk not ready")),this.loginStatusPromise.delete("login"),this.resetStore()}checkCommercialAbility(){Object.keys(af).forEach((e=>{const t=af[e];this.chat.callExperimentalAPI("isCommercialAbilityEnabled",t).then((t=>{const{enabled:n=!1}=t.data;this.TUIStore.update(jg.APP,e,n)}))}))}}class Sf{constructor(){this.defaultStore={enabledMessageReadReceipt:!1,enabledEmojiPlugin:!1,enabledOnlineStatus:!1,enabledCustomerServicePlugin:!1,enabledTranslationPlugin:!1,enabledVoiceToText:!1,enableTyping:!0,enableConversationDraft:!0,isOfficial:!1,SDKVersion:"3.0.0",tasks:{sendMessage:!1,revokeMessage:!1,modifyNickName:!1,groupChat:!1,muteGroup:!1,dismissGroup:!1,call:!1,searchCloudMessage:!1,customerService:!1,translateTextMessage:!1}},this.store={enabledEmojiPlugin:!1,enabledMessageReadReceipt:!1,enabledOnlineStatus:!1,enabledCustomerServicePlugin:!1,enabledTranslationPlugin:!1,enabledVoiceToText:!1,enableTyping:!0,enableConversationDraft:!0,isOfficial:!1,SDKVersion:"3.0.0",tasks:{sendMessage:!1,revokeMessage:!1,modifyNickName:!1,groupChat:!1,muteGroup:!1,dismissGroup:!1,call:!1,searchCloudMessage:!1,customerService:!1,translateTextMessage:!1}}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class Ef{constructor(){this.defaultStore={userProfile:{},displayOnlineStatus:!1,displayMessageReadReceipt:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",userBlacklist:[],targetLanguage:"zh"},this.store={userProfile:{},displayOnlineStatus:!1,displayMessageReadReceipt:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",userBlacklist:[],targetLanguage:"zh"}}update(e,t){"userStatusList"===e?this.updateUserStatusList(t):this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateUserStatusList(e){0!==e.length?e.forEach((e=>{const{userID:t,statusType:n=0,customStatus:i=""}=e;n===Hg.UNSUB_USER?this.store.userStatusList.delete(t):this.store.userStatusList.set(t,{statusType:n,customStatus:i})})):this.store.userStatusList.clear()}}class Tf{getEngine(){return Cf.getInstance()}}const kf=function(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(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);if(null===t)return!0;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(e)){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1},Df=["[图片]","[语音]","[视频]","[文件]","[位置]","[地理位置]","[动画表情]","[自定义消息]","[群提示消息]","[聊天记录]"];class Rf extends Tf{constructor(e){super(),this.initProxy(e),this.isMuted=this.messageRemindType===this.getEngine().TYPES.MSG_REMIND_ACPT_NOT_NOTE||this.messageRemindType===this.getEngine().TYPES.MSG_REMIND_DISCARD,this.operationType=0,this._conversation=e}initProxy(e){Object.keys(e).forEach((t=>{Zg(t)||(this[t]=e[t])}))}updateProperties(e){Object.keys(e).forEach((t=>{Zg(t)||(this[t]=e[t])}))}updateOperationType(e){this.operationType=e}getConversation(){return this._conversation}deleteConversation(){return this.getEngine().TUIConversation.deleteConversation(this.conversationID)}pinConversation(){return this.getEngine().TUIConversation.pinConversation({conversationID:this.conversationID,isPinned:!this.isPinned})}muteConversation(){const e=this.getEngine(),t={messageRemindType:!0===this.isMuted?e.TYPES.MSG_REMIND_ACPT_AND_NOTE:e.TYPES.MSG_REMIND_ACPT_NOT_NOTE};if(this.type===e.TYPES.CONV_C2C){const n=this.conversationID.replace(e.TYPES.CONV_C2C,"");t.userIDList=[n]}else if(this.type===e.TYPES.CONV_GROUP){const n=this.conversationID.replace(e.TYPES.CONV_GROUP,"");t.groupID=n}return e.TUIConversation.muteConversation(t)}getAvatar(){var e,t,n,i,o,s;const a=this.getEngine();let r="";switch(this.type){case a.TYPES.CONV_C2C:r=ef(null===(e=this.userProfile)||void 0===e?void 0:e.avatar)?null===(t=this.userProfile)||void 0===t?void 0:t.avatar:"https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_16.png";break;case a.TYPES.CONV_GROUP:r=ef(null===(n=this.groupProfile)||void 0===n?void 0:n.avatar)?null===(i=this.groupProfile)||void 0===i?void 0:i.avatar:"https://web.sdk.qcloud.com/im/demo/TUIkit/web/img/constomer.png";break;case a.TYPES.CONV_SYSTEM:r=ef(null===(o=this.groupProfile)||void 0===o?void 0:o.avatar)?null===(s=this.groupProfile)||void 0===s?void 0:s.avatar:"https://web.sdk.qcloud.com/component/TUIKit/assets/group_avatar.png"}return r}getShowName(){var e,t,n,i;const o=this.getEngine();let s="";switch(this.type){case o.TYPES.CONV_C2C:s=this.remark||(null===(e=this.userProfile)||void 0===e?void 0:e.nick)||(null===(t=this.userProfile)||void 0===t?void 0:t.userID)||"";break;case o.TYPES.CONV_GROUP:s=(null===(n=this.groupProfile)||void 0===n?void 0:n.name)||(null===(i=this.groupProfile)||void 0===i?void 0:i.groupID)||"";break;case o.TYPES.CONV_SYSTEM:s=o.TUITranslate.t("系统通知")}return s}getGroupAtInfo(){const e=this.getEngine(),t=e.TUITranslate.t.bind(e.TUITranslate),n=[`[${t("TUIConversation.有人@我")}]`,`[${t("TUIConversation.@所有人")}]`,`[${t("TUIConversation.@所有人")}][${t("TUIConversation.有人@我")}]`];let i="";for(let o=0;o0&&(i=n[this.groupAtInfoList[o].atTypeArray[0]-1]);return i}getLastMessage(e){return"time"===e?this.getLastMessageTime():"text"===e?this.getLastMessageText():(console.warn(`ConversationModel.getLastMessage key:${e} is invalid.`),null)}getLastMessageTime(){var e;const t=this.getEngine();let n="";return(null===(e=this.lastMessage)||void 0===e?void 0:e.lastTime)>0&&(n=function(e,t){const n=36e5,i=24*n,o=7*i,s=(new Date).getTime()-e;let a="";if(s<0)return a;const r=s/6e4,c=s/n,u=s/i,l=s/o;if(l>=1&&l<=4)a=` ${parseInt(`${l}`,10)} ${t("time.周")}${t("time.前")}`;else if(u>=1&&u<=6)a=` ${parseInt(`${u}`,10)} ${t("time.天")}${t("time.前")}`;else if(c>=1&&c<=23)a=` ${parseInt(`${c}`,10)} ${t("time.小时")}${t("time.前")}`;else if(r>=1&&r<=59)a=` ${parseInt(`${r}`,10)} ${t("time.分钟")}${t("time.前")}`;else if(s>=0&&s<=6e4)a=`${t("time.刚刚")}`;else{const t=new Date;t.setTime(e),a=`${t.getFullYear()}-${t.getMonth()+1<10?`0${t.getMonth()+1}`:t.getMonth()+1}-${t.getDate()<10?`0${t.getDate()}`:t.getDate()}`}return a}(1e3*this.lastMessage.lastTime,t.TUITranslate.t.bind(t.TUITranslate))),n}getLastMessageText(){var e;if(this.draftText)return tf(this.draftText).abstract;const t=this.getEngine(),n=t.TUITranslate.t.bind(t.TUITranslate);if(4===this.operationType)return n("TUIConversation.您已被群管理员移出群聊");if(5===this.operationType)return n("TUIConversation.该群聊已被解散");if(8===this.operationType)return n("TUIConversation.您已退出该群聊");const i=this._conversation,{lastMessage:o}=this;let s="",a="";const r=i.unreadCount>0&&i.messageRemindType===t.TYPES.MSG_REMIND_ACPT_NOT_NOTE?`[${i.unreadCount>99?"99+":i.unreadCount}${n("TUIConversation.条")}]`:"";if(i.type===t.TYPES.CONV_GROUP)if(o.fromAccount===t.getMyUserID())s=n("TUIConversation.我");else{const e=o.fromAccount;s=t.TUIFriend.getFriendRemark([e])[e]||o.nameCard||o.nick||e}if(o.type===t.TYPES.MSG_TEXT)a=this.decodeTextMessage(o.payload.text);else if(o.type===t.TYPES.MSG_CUSTOM){const i=tf(null===(e=null==o?void 0:o.payload)||void 0===e?void 0:e.data);if(1===(null==i?void 0:i.businessID))return a=t.TUIChat.messageHandler.handleCallKitSignaling(o),a;a=Df.includes(o.messageForShow)?n(`TUIChat.${o.messageForShow}`):o.messageForShow}else a=Df.includes(o.messageForShow)?n(`TUIChat.${o.messageForShow}`):o.messageForShow;return o.isRevoked&&(a=n("TUIChat.撤回了一条消息")),i.type===t.TYPES.CONV_GROUP&&o.type===t.TYPES.MSG_GRP_TIP?a:`${r}${s?`${s}:`:""}${a}`}decodeTextMessage(e){if(kf(e))return e;const t=/(\[.+?\])/g;let n=e;if(t.test(e)){const i=this.getEngine(),o=i.TUITranslate.t.bind(i.TUITranslate);n=e.replace(t,(e=>{const t=o(`Emoji.${e}`);return uf||!t||t.startsWith("Emoji.")?sf[e]||e:t}))}return n}}class Of{constructor(){this.defaultStore={currentConversationID:"",totalUnreadCount:0,conversationList:[],currentConversation:null,operationTypeMap:new Map},this.store={currentConversationID:"",totalUnreadCount:0,conversationList:[],currentConversation:null,operationTypeMap:new Map}}update(e,t){switch(e){case"conversationList":this.updateConversationList(t);break;case"operationTypeMap":this.updateOperationTypeMap(t);break;default:this.store[e]=t}}getData(e){return this.store[e]}getModel(e){return this.store.conversationList.find((t=>t.conversationID===e))}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateConversationList(e){const t=[];e.forEach((e=>{let n=e;e instanceof Rf?n.updateProperties(e):n=new Rf(e);const i=this.getOperationType(e);n.updateOperationType(i),t.push(n)})),this.store.conversationList=t}updateOperationTypeMap(e){const{conversationID:t,operationType:n=0}=e;this.store.operationTypeMap.set(t,n)}getOperationType(e){const{conversationID:t}=e;return this.store.operationTypeMap.get(t)||0}}class bf extends Tf{constructor(e){super(),this.messageHandlers={[this.getEngine().TYPES.MSG_TEXT]:e=>this.getEngine().TUIChat.messageHandler.handleTextMessage(e),[this.getEngine().TYPES.MSG_FACE]:e=>this.getEngine().TUIChat.messageHandler.handleFaceMessage(e),[this.getEngine().TYPES.MSG_LOCATION]:e=>this.getEngine().TUIChat.messageHandler.handleLocationMessage(e),[this.getEngine().TYPES.MSG_IMAGE]:e=>this.getEngine().TUIChat.messageHandler.handleImageMessage(e),[this.getEngine().TYPES.MSG_AUDIO]:e=>this.getEngine().TUIChat.messageHandler.handleAudioMessage(e),[this.getEngine().TYPES.MSG_VIDEO]:e=>this.getEngine().TUIChat.messageHandler.handleVideoMessage(e),[this.getEngine().TYPES.MSG_FILE]:e=>this.getEngine().TUIChat.messageHandler.handleFileMessage(e),[this.getEngine().TYPES.MSG_CUSTOM]:e=>this.getEngine().TUIChat.messageHandler.handleCustomMessage(e),[this.getEngine().TYPES.MSG_MERGER]:e=>this.getEngine().TUIChat.messageHandler.handleMergeMessage(e),[this.getEngine().TYPES.MSG_GRP_TIP]:e=>this.getEngine().TUIChat.messageHandler.handleGroupTipsMessage(e)},this._message=e,this._signalingInfo=void 0,this.progress=0,this.reactionList=[],this.initProperties(e)}initProperties(e){Object.keys(e).forEach((t=>{Zg(t)||(this[t]=e[t])}))}updateProperties(e){this._message=e,Object.keys(e).forEach((t=>{Zg(t)||(this[t]=e[t])}))}getMessage(){return this._message}modifyMessage(e){return e.type&&this._message.type!==e.type&&!e.payload?Promise.reject({code:Yg.MISMATCH_TYPE_AND_PAYLOAD,message:Jg.MISMATCH_TYPE_AND_PAYLOAD}):(this._message.type=e.type||this._message.type,this._message.payload=e.payload||this._message.payload,this._message.cloudCustomData=e.cloudCustomData||this._message.cloudCustomData,this.getEngine().TUIChat.modifyMessage(this._message))}revokeMessage(){return this.getEngine().TUIChat.revokeMessage(this._message)}resendMessage(){return this.getEngine().TUIChat.resendMessage(this._message)}deleteMessage(){return this.getEngine().TUIChat.deleteMessage([this._message])}quoteMessage(){return this.getEngine().TUIChat.quoteMessage(this._message)}replyMessage(){return this.getEngine().TUIChat.replyMessage(this._message)}setMessageExtensions(e){return this.getEngine().TUIChat.setMessageExtensions(this._message,e)}getMessageExtensions(){return this.getEngine().TUIChat.getMessageExtensions(this._message)}deleteMessageExtensions(e){return this.getEngine().TUIChat.deleteMessageExtensions(this._message,e)}getSignalingInfo(){return this.type!==this.getEngine().TYPES.MSG_CUSTOM?null:Qg(this._signalingInfo)?(this._signalingInfo=this.getEngine().chat.getSignalingInfo(this._message),this._signalingInfo):this._signalingInfo}getMessageContent(){const e=this.messageHandlers[this.type];if(Qg(e))return{};if(this.type===this.getEngine().TYPES.MSG_GRP_TIP)return e(this._message);const t=this.getEngine().TUIFriend.getFriendRemark([this.from]);return Object.assign(Object.assign({},e(this._message)),{showName:t[this.from]||this.nameCard||this.nick||this.from})}sendForwardMessage(e){return this.getEngine().TUIChat.sendForwardMessage(e,[this._message])}}class Af{constructor(){this.defaultStore={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},newMessageList:[],typingStatus:!1,messageSource:void 0,translateTextInfo:void 0,voiceToTextInfo:void 0,userInfo:{}},this.store={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},newMessageList:[],typingStatus:!1,messageSource:void 0,translateTextInfo:void 0,voiceToTextInfo:void 0,userInfo:{}}}update(e,t){switch(e){case"messageList":this.updateMessageList(t);break;case"translateTextInfo":this.updateTranslateTextInfo(t);break;case"voiceToTextInfo":this.updateVoiceToTextInfo(t);break;default:this.store[e]=t}}getData(e){return this.store[e]}getModel(e){return this.store.messageList.find((t=>t.ID===e))}reset(e=[]){const t=e.filter((e=>!cf.includes(e)));this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),null==t?void 0:t.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateMessageList(e){const t=[];e.forEach((e=>{let n=e;e instanceof bf||(n=this.getModel(e.ID),n?n.updateProperties(e):n=new bf(e)),t.push(n)})),this.store.messageList=t}updateTranslateTextInfo(e){this.updateBykey("translateTextInfo",e)}updateVoiceToTextInfo(e){this.updateBykey("voiceToTextInfo",e)}updateBykey(e,t){const{conversationID:n,messageID:i,visible:o=!1}=t;this.store[e]||(this.store[e]=new Map),this.store[e].has(n)||this.store[e].set(n,[]);const s=this.store[e].get(n)||[];let a=!0;for(let r=0;r{Zg(t)||(this[t]=e[t])}))}}class Pf{constructor(){this.defaultStore={currentGroupID:"",currentGroup:{},currentGroupAttributes:{},currentGroupCounters:{},currentGroupMemberList:[],groupList:[],groupSystemNoticeList:[],isCompleted:!1,offset:0},this.store={currentGroupID:"",currentGroup:void 0,currentGroupAttributes:{},currentGroupCounters:{},currentGroupMemberList:[],groupList:[],groupSystemNoticeList:[],isCompleted:!1,offset:0}}update(e,t){switch(e){case"groupList":this.updateGroupList(t);break;case"currentGroup":this.store.currentGroup=t instanceof Lf?t:new Lf(t);break;default:this.store[e]=t}}getData(e){if("groupSystemNoticeList"===e){const e=[...this.store.groupSystemNoticeList];return this.store.groupSystemNoticeList.length=0,e}return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateGroupList(e){this.store.groupList=e.map((e=>e instanceof Lf?e:new Lf(e)))}}class Nf{constructor(){this.store={}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){0===e.length&&(this.store={}),this.store=Object.assign(Object.assign({},this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:void 0})),{}))}}class wf{constructor(){this.defaultStore={friendList:[],friendApplicationList:[],friendApplicationUnreadCount:0},this.store={friendList:[],friendApplicationList:[],friendApplicationUnreadCount:0}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class Uf{constructor(){this.defaultStore={currentSearchInputValue:{value:"",searchType:"global"},currentSearchMessageType:{value:{key:"",label:"",value:""},searchType:"global"},currentSearchMessageTime:{value:{key:"",label:"",value:{timePosition:0,timePeriod:0}},searchType:"global"},currentSearchingStatus:{isSearching:!1,searchType:"global"},isShowInConversationSearch:!1},this.store={currentSearchInputValue:{value:"",searchType:"global"},currentSearchMessageType:{value:{key:"",label:"",value:""},searchType:"global"},currentSearchMessageTime:{value:{key:"",label:"",value:{timePosition:0,timePeriod:0}},searchType:"global"},currentSearchingStatus:{isSearching:!1,searchType:"global"},isShowInConversationSearch:!1}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),null==e?void 0:e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class Gf{constructor(){this.storeMap={[jg.APP]:new Sf,[jg.USER]:new Ef,[jg.CONV]:new Of,[jg.CHAT]:new Af,[jg.GRP]:new Pf,[jg.FRIEND]:new wf,[jg.SEARCH]:new Uf},this.task={}}static getInstance(){return Gf.instance||(Gf.instance=new Gf),Gf.instance}watch(e,t){this.task[e]||(this.task[e]={});const n=this.task[e];Object.keys(t).forEach((i=>{const o=t[i];n[i]||(n[i]=new Map),n[i].set(o,1),this.notifyOnWatch(e,i,o)}))}unwatch(e,t){if(!this.task[e])return;const n=this.task[e];Object.keys(t).forEach((e=>{var i;null===(i=n[e])||void 0===i||i.delete(t[e])}))}update(e,t,n){var i;e!==jg.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new Nf),null===(i=this.storeMap[e])||void 0===i||i.update(t,n),this.notify(e,t)}getData(e,t){var n;return e!==jg.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new Nf),null===(n=this.storeMap[e])||void 0===n?void 0:n.getData(t)}getConversationModel(e){var t;return null===(t=this.storeMap[jg.CONV])||void 0===t?void 0:t.getModel(e)}getMessageModel(e){var t;return null===(t=this.storeMap[jg.CHAT])||void 0===t?void 0:t.getModel(e)}reset(e,t=[],n=!1){if(e in this.storeMap){const i=this.storeMap[e];0===t.length&&(t=Object.keys(null==i?void 0:i.store)),i.reset(t),n&&t.forEach((t=>{this.notify(e,t)}))}}notifyOnWatch(e,t,n){const i=this.getData(e,t);rf.indexOf(t)>-1&&0===i.length||n&&n.call(this,i)}notify(e,t){if(!this.task[e])return;const n=this.task[e];if(n[t]){const i=n[t],o=this.getData(e,t);for(const[e]of i.entries())e.call(this,o)}}}function xf(e){return(xf="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 Ff(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bf(e){var t=function(e){if("object"!=xf(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=xf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xf(t)?t:t+""}function qf(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,i=Array(t);n1&&void 0!==arguments[1]?arguments[1]:{};Ff(this,e),this.init(t,n)}return Vf(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Qf,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),i=1;i-1?e.replace(/###/g,"."):e}function o(){return!e||"string"==typeof e}for(var s="string"!=typeof t?[].concat(t):t.split(".");s.length>1;){if(o())return{};var a=i(s.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return o()?{}:{obj:e,k:i(s.shift())}}function om(e,t,n){var i=im(e,t,Object);i.obj[i.k]=n}function sm(e,t){var n=im(e,t),i=n.obj,o=n.k;if(i)return i[o]}function am(e,t,n){for(var i in t)"__proto__"!==i&&"constructor"!==i&&(i in e?"string"==typeof e[i]||e[i]instanceof String||"string"==typeof t[i]||t[i]instanceof String?n&&(e[i]=t[i]):am(e[i],t[i],n):e[i]=t[i]);return e}function rm(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var cm={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function um(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return cm[e]})):e}var lm="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,dm=[" ",",","?","!",";"];function pm(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var i=t.split(n),o=e,s=0;ss+a;)a++,c=o[r=i.slice(s,s+a).join(n)];if(void 0===c)return;if(null===c)return null;if(t.endsWith(r)){if("string"==typeof c)return c;if(r&&"string"==typeof c[r])return c[r]}var u=i.slice(s+a).join(n);return u?pm(c,u,n):void 0}o=o[i[s]]}return o}}function hm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function gm(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Ff(this,t),i=e.call(this),lm&&em.call(jf(i)),i.data=n||{},i.options=o,void 0===i.options.keySeparator&&(i.options.keySeparator="."),void 0===i.options.ignoreJSONStructure&&(i.options.ignoreJSONStructure=!0),i}return Vf(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,s=void 0!==i.ignoreJSONStructure?i.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(a=e.split("."));var r=sm(this.data,a);return r||!s||"string"!=typeof n?r:pm(this.data&&this.data[e]&&this.data[e][t],n,o)}},{key:"addResource",value:function(e,t,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},s=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,a=[e,t];n&&(a=a.concat(s?n.split(s):n)),e.indexOf(".")>-1&&(i=t,t=(a=e.split("."))[1]),this.addNamespaces(t),om(this.data,a,i),o.silent||this.emit("added",e,t,n,i)}},{key:"addResources",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var o in n)"string"!=typeof n[o]&&"[object Array]"!==Object.prototype.toString.apply(n[o])||this.addResource(e,t,o,n[o],{silent:!0});i.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,i,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(i=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var r=sm(this.data,a)||{};i?am(r,n,o):r=gm(gm({},r),n),om(this.data,a,r),s.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?gm(gm({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),t}(),mm={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,i,o){var s=this;return e.forEach((function(e){s.processors[e]&&(t=s.processors[e].process(t,n,i,o))})),t}};function _m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function vm(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};return Ff(this,t),i=e.call(this),lm&&em.call(jf(i)),o=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],s=n,a=jf(i),o.forEach((function(e){s[e]&&(a[e]=s[e])})),i.options=r,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i.logger=Zf.create("translator"),i}return Vf(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,o=t.ns||this.options.defaultNS||[],s=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var i=dm.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===i.length)return!0;var o=new RegExp("(".concat(i.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),s=!o.test(e);if(!s){var a=e.indexOf(n);a>0&&!o.test(e.substring(0,a))&&(s=!0)}return s}(e,n,i));if(s&&!a){var r=e.match(this.interpolator.nestingRegexp);if(r&&r.length>0)return{key:e,namespaces:o};var c=e.split(n);(n!==i||n===i&&this.options.ns.indexOf(c[0])>-1)&&(o=c.shift()),e=c.join(i)}return"string"==typeof o&&(o=[o]),{key:e,namespaces:o}}},{key:"translate",value:function(e,n,i){var o=this;if("object"!==xf(n)&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),"object"===xf(n)&&(n=vm({},n)),n||(n={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var s=void 0!==n.returnDetails?n.returnDetails:this.options.returnDetails,a=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,r=this.extractFromKey(e[e.length-1],n),c=r.key,u=r.namespaces,l=u[u.length-1],d=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(p){var h=n.nsSeparator||this.options.nsSeparator;return s?{res:"".concat(l).concat(h).concat(c),usedKey:c,exactUsedKey:c,usedLng:d,usedNS:l}:"".concat(l).concat(h).concat(c)}return s?{res:c,usedKey:c,exactUsedKey:c,usedLng:d,usedNS:l}:c}var g=this.resolve(e,n),f=g&&g.res,m=g&&g.usedKey||c,_=g&&g.exactUsedKey||c,v=Object.prototype.toString.apply(f),y=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,I=!this.i18nFormat||this.i18nFormat.handleAsObject;if(I&&f&&"string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f&&["[object Number]","[object Function]","[object RegExp]"].indexOf(v)<0&&("string"!=typeof y||"[object Array]"!==v)){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,f,vm(vm({},n),{},{ns:u})):"key '".concat(c," (").concat(this.language,")' returned an object instead of string.");return s?(g.res=M,g):M}if(a){var C="[object Array]"===v,S=C?[]:{},E=C?_:m;for(var T in f)if(Object.prototype.hasOwnProperty.call(f,T)){var k="".concat(E).concat(a).concat(T);S[T]=this.translate(k,vm(vm({},n),{joinArrays:!1,ns:u})),S[T]===k&&(S[T]=f[T])}f=S}}else if(I&&"string"==typeof y&&"[object Array]"===v)(f=f.join(y))&&(f=this.extendTranslation(f,e,n,i));else{var D=!1,R=!1,O=void 0!==n.count&&"string"!=typeof n.count,b=t.hasDefaultValue(n),A=O?this.pluralResolver.getSuffix(d,n.count,n):"",L=n["defaultValue".concat(A)]||n.defaultValue;!this.isValidLookup(f)&&b&&(D=!0,f=L),this.isValidLookup(f)||(R=!0,f=c);var P=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&R?void 0:f,N=b&&L!==f&&this.options.updateMissing;if(R||D||N){if(this.logger.log(N?"updateKey":"missingKey",d,l,c,N?L:f),a){var w=this.resolve(c,vm(vm({},n),{},{keySeparator:!1}));w&&w.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var U=[],G=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&G&&G[0])for(var x=0;x1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var c=a.extractFromKey(e,r),u=c.key;n=u;var l=c.namespaces;a.options.fallbackNS&&(l=l.concat(a.options.fallbackNS));var d=void 0!==r.count&&"string"!=typeof r.count,p=d&&!r.ordinal&&0===r.count&&a.pluralResolver.shouldUseIntlApi(),h=void 0!==r.context&&("string"==typeof r.context||"number"==typeof r.context)&&""!==r.context,g=r.lngs?r.lngs:a.languageUtils.toResolveHierarchy(r.lng||a.language,r.fallbackLng);l.forEach((function(e){a.isValidLookup(t)||(s=e,!ym["".concat(g[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(s)&&(ym["".concat(g[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(g.join(", "),'" won\'t get resolved as namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach((function(n){if(!a.isValidLookup(t)){o=n;var s,c=[u];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(c,u,n,e,r);else{var l;d&&(l=a.pluralResolver.getSuffix(n,r.count,r));var g="".concat(a.options.pluralSeparator,"zero");if(d&&(c.push(u+l),p&&c.push(u+g)),h){var f="".concat(u).concat(a.options.contextSeparator).concat(r.context);c.push(f),d&&(c.push(f+l),p&&c.push(f+g))}}for(;s=c.pop();)a.isValidLookup(t)||(i=s,t=a.getResource(n,e,s,r))}})))}))}})),{res:t,usedKey:n,exactUsedKey:i,usedLng:o,usedNS:s}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,i):this.resourceStore.getResource(e,t,n,i)}}],[{key:"hasDefaultValue",value:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&"defaultValue"===t.substring(0,12)&&void 0!==e[t])return!0;return!1}}]),t}();function Mm(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Cm=function(){function e(t){Ff(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Zf.create("languageUtils")}return Vf(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Mm(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Mm(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Mm(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var i=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(i)||(t=i)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var i=n.getLanguagePartFromCode(e);if(n.isSupportedCode(i))return t=i;t=n.options.supportedLngs.find((function(e){return e===i?e:e.indexOf("-")<0&&i.indexOf("-")<0?void 0:0===e.indexOf(i)?e:void 0}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,i=this.getFallbackCodes(t||this.options.fallbackLng||[],e),o=[],s=function(e){e&&(n.isSupportedCode(e)?o.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&s(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&s(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&s(this.getLanguagePartFromCode(e))):"string"==typeof e&&s(this.formatLanguageCode(e)),i.forEach((function(e){o.indexOf(e)<0&&s(n.formatLanguageCode(e))})),o}}]),e}(),Sm=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Em={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},Tm=["v1","v2","v3"],km={zero:0,one:1,two:2,few:3,many:4,other:5},Dm=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ff(this,e),this.languageUtils=t,this.options=i,this.logger=Zf.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(n={},Sm.forEach((function(e){e.lngs.forEach((function(t){n[t]={numbers:e.nr,plurals:Em[e.fc]}}))})),n)}return Vf(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(n){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.getRule(e,n);return i?this.shouldUseIntlApi()?i.resolvedOptions().pluralCategories.sort((function(e,t){return km[e]-km[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):i.numbers.map((function(i){return t.getSuffix(e,i,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this.getRule(e,n);return i?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(i.select(t)):this.getSuffixRetroCompatible(i,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,i=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),o=e.numbers[i];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var s=function(){return n.options.prepend&&o.toString()?n.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):s():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?s():this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}},{key:"shouldUseIntlApi",value:function(){return!Tm.includes(this.options.compatibilityJSON)}}]),e}();function Rm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Om(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:".",r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],c=(i=t,void 0!==(s=sm(e,o=n))?s:sm(i,o));return!c&&r&&"string"==typeof n&&void 0===(c=pm(e,n,a))&&(c=pm(t,n,a)),c}var Am=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ff(this,e),this.logger=Zf.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return Vf(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:um,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?rm(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?rm(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?rm(t.nestingPrefix):t.nestingPrefixEscaped||rm("$t("),this.nestingSuffix=t.nestingSuffix?rm(t.nestingSuffix):t.nestingSuffixEscaped||rm(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,i){var o,s,a,r=this,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var l=function(e){if(e.indexOf(r.formatSeparator)<0){var o=bm(t,c,e,r.options.keySeparator,r.options.ignoreJSONStructure);return r.alwaysFormat?r.format(o,void 0,n,Om(Om(Om({},i),t),{},{interpolationkey:e})):o}var s=e.split(r.formatSeparator),a=s.shift().trim(),u=s.join(r.formatSeparator).trim();return r.format(bm(t,c,a,r.options.keySeparator,r.options.ignoreJSONStructure),u,n,Om(Om(Om({},i),t),{},{interpolationkey:a}))};this.resetRegExp();var d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i&&i.interpolation&&void 0!==i.interpolation.skipOnVariables?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return r.escapeValue?u(r.escape(e)):u(e)}}].forEach((function(t){for(a=0;o=t.regex.exec(e);){var n=o[1].trim();if(void 0===(s=l(n)))if("function"==typeof d){var c=d(e,o,i);s="string"==typeof c?c:""}else if(i&&Object.prototype.hasOwnProperty.call(i,n))s="";else{if(p){s=o[0];continue}r.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),s=""}else"string"==typeof s||r.useRawValueToEscape||(s=nm(s));var u=t.safeValue(s);if(e=e.replace(o[0],u),p?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,++a>=r.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,i,o,s=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function r(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var i=e.split(new RegExp("".concat(n,"[ ]*{"))),s="{".concat(i[1]);e=i[0];var a=(s=this.interpolate(s,o)).match(/'/g),r=s.match(/"/g);(a&&a.length%2==0&&!r||r.length%2!=0)&&(s=s.replace(/'/g,'"'));try{o=JSON.parse(s),t&&(o=Om(Om({},t),o))}catch(c){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),c),"".concat(e).concat(n).concat(s)}return delete o.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var c=[];(o=(o=Om({},a)).replace&&"string"!=typeof o.replace?o.replace:o).applyPostProcessor=!1,delete o.defaultValue;var u=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var l=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=l.shift(),c=l,u=!0}if((i=t(r.call(this,n[1].trim(),o),o))&&n[0]===e&&"string"!=typeof i)return i;"string"!=typeof i&&(i=nm(i)),i||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),i=""),u&&(i=c.reduce((function(e,t){return s.format(e,t,a.lng,Om(Om({},a),{},{interpolationkey:n[1].trim()}))}),i.trim())),e=e.replace(n[0],i),this.regexp.lastIndex=0}return e}}]),e}();function Lm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Pm(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};Ff(this,e),this.logger=Zf.create("formatter"),this.options=t,this.formats={number:Nm((function(e,t){var n=new Intl.NumberFormat(e,Pm({},t));return function(e){return n.format(e)}})),currency:Nm((function(e,t){var n=new Intl.NumberFormat(e,Pm(Pm({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:Nm((function(e,t){var n=new Intl.DateTimeFormat(e,Pm({},t));return function(e){return n.format(e)}})),relativetime:Nm((function(e,t){var n=new Intl.RelativeTimeFormat(e,Pm({},t));return function(e){return n.format(e,t.range||"day")}})),list:Nm((function(e,t){var n=new Intl.ListFormat(e,Pm({},t));return function(e){return n.format(e)}}))},this.init(t)}return Vf(e,[{key:"init",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=Nm(t)}},{key:"format",value:function(e,t,n){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return t.split(this.formatSeparator).reduce((function(e,t){var s=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var i=e.split("(");t=i[0].toLowerCase().trim();var o=i[1].substring(0,i[1].length-1);"currency"===t&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach((function(e){if(e){var t=function(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return $f(e,t);var n={}.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)?$f(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e.split(":")),i=t[0],o=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[i.trim()]||(n[i.trim()]=o),"false"===o&&(n[i.trim()]=!1),"true"===o&&(n[i.trim()]=!0),isNaN(o)||(n[i.trim()]=parseInt(o,10))}}))}return{formatName:t,formatOptions:n}}(t),a=s.formatName,r=s.formatOptions;if(i.formats[a]){var c=e;try{var u=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},l=u.locale||u.lng||o.locale||o.lng||n;c=i.formats[a](e,l,Pm(Pm(Pm({},r),o),u))}catch(d){i.logger.warn(d)}return c}return i.logger.warn("there was no format function for ".concat(a)),e}),e)}}]),e}();function Um(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Gm(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:{};return Ff(this,t),s=e.call(this),lm&&em.call(jf(s)),s.backend=n,s.store=i,s.services=o,s.languageUtils=o.languageUtils,s.options=a,s.logger=Zf.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=a.maxParallelReads||10,s.readingCalls=0,s.maxRetries=a.maxRetries>=0?a.maxRetries:5,s.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(o,a.backend,a),s}return Vf(t,[{key:"queueLoad",value:function(e,t,n,i){var o=this,s={},a={},r={},c={};return e.forEach((function(e){var i=!0;t.forEach((function(t){var r="".concat(e,"|").concat(t);!n.reload&&o.store.hasResourceBundle(e,t)?o.state[r]=2:o.state[r]<0||(1===o.state[r]?void 0===a[r]&&(a[r]=!0):(o.state[r]=1,i=!1,void 0===a[r]&&(a[r]=!0),void 0===s[r]&&(s[r]=!0),void 0===c[t]&&(c[t]=!0)))})),i||(r[e]=!0)})),(Object.keys(s).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(a),toLoadLanguages:Object.keys(r),toLoadNamespaces:Object.keys(c)}}},{key:"loaded",value:function(e,t,n){var i=e.split("|"),o=i[0],s=i[1];t&&this.emit("failedLoading",o,s,t),n&&this.store.addResourceBundle(o,s,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){var i,r,c,u,l,d,p;i=n.loaded,r=s,(u=(c=im(i,[o],Object)).obj)[l=c.k]=u[l]||[],u[l].push(r),p=e,void 0!==(d=n).pending[p]&&(delete d.pending[p],d.pendingCount--),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:n,tried:o,wait:s,callback:a});else{this.readingCalls++;var r=function(r,c){if(i.readingCalls--,i.waitingReads.length>0){var u=i.waitingReads.shift();i.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}r&&c&&o2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var s=this.queueLoad(e,t,i,o);if(!s.toLoad.length)return s.pending.length||o(),null;s.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=e.split("|"),o=i[0],s=i[1];this.read(o,s,"read",void 0,void 0,(function(i,a){i&&t.logger.warn("".concat(n,"loading namespace ").concat(s," for language ").concat(o," failed"),i),!i&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(s," for language ").concat(o),a),t.loaded(e,i,a)}))}},{key:"saveMissing",value:function(e,t,n,i,o){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){var r=Gm(Gm({},s),{},{isUpdate:o}),c=this.backend.create.bind(this.backend);if(c.length<6)try{var u;(u=5===c.length?c(e,t,n,i,r):c(e,t,n,i))&&"function"==typeof u.then?u.then((function(e){return a(null,e)})).catch(a):a(null,u)}catch(l){a(l)}else c(e,t,n,i,a,r)}e&&e[0]&&this.store.addResource(e[0],t,n,i)}}}]),t}();function Fm(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===xf(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===xf(e[2])||"object"===xf(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Bm(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function qm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Vm(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(Ff(this,t),n=e.call(this),lm&&em.call(jf(n)),n.options=Bm(o),n.services={},n.logger=Zf,n.modules={external:[]},i=jf(n),Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((function(e){"function"==typeof i[e]&&(i[e]=i[e].bind(i))})),s&&!n.isInitialized&&!o.isClone){if(!n.options.initImmediate)return n.init(o,s),zf(n,jf(n));setTimeout((function(){n.init(o,s)}),0)}return n}return Vf(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var i=Fm();function o(e){return e?"function"==typeof e?new e:e:null}if(this.options=Vm(Vm(Vm({},i),this.options),Bm(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=Vm(Vm({},i.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var s;this.modules.logger?Zf.init(o(this.modules.logger),this.options):Zf.init(null,this.options),this.modules.formatter?s=this.modules.formatter:"undefined"!=typeof Intl&&(s=wm);var a=new Cm(this.options);this.store=new fm(this.options.resources,this.options);var r=this.services;r.logger=Zf,r.resourceStore=this.store,r.languageUtils=a,r.pluralResolver=new Dm(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!s||this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format||(r.formatter=o(s),r.formatter.init(r,this.options),this.options.interpolation.format=r.formatter.format.bind(r.formatter)),r.interpolator=new Am(this.options),r.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},r.backendConnector=new xm(o(this.modules.backend),r.resourceStore,r,this.options),r.backendConnector.on("*",(function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o1?n-1:0),o=1;o0&&"dev"!==c[0]&&(this.options.lng=c[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}})),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var u=tm(),l=function(){var t=function(t,i){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),u.resolve(i),n(t,i)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?l():setTimeout(l,0),u}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jm,i="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return n();var o=[],s=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){o.indexOf(e)<0&&o.push(e)}))};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return s(e)})),this.options.preload&&this.options.preload.forEach((function(e){return s(e)})),this.services.backendConnector.load(o,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),n(e)}))}else n(null)}},{key:"reloadResources",value:function(e,t,n){var i=tm();return e||(e=this.languages),t||(t=this.options.ns),n||(n=jm),this.services.backendConnector.reload(e,t,(function(e){i.resolve(),n(e)})),i}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&mm.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var i=tm();this.emit("languageChanging",e);var o=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},s=function(s){e||s||!n.services.languageDetector||(s=[]);var a="string"==typeof s?s:n.services.languageUtils.getBestMatchFromCodes(s);a&&(n.language||o(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,(function(e){var s,r;s=e,(r=a)?(o(r),n.translator.changeLanguage(r),n.isLanguageChangingTo=void 0,n.emit("languageChanged",r),n.logger.log("languageChanged",r)):n.isLanguageChangingTo=void 0,i.resolve((function(){return n.t.apply(n,arguments)})),t&&t(s,(function(){return n.t.apply(n,arguments)}))}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e):s(this.services.languageDetector.detect()),i}},{key:"getFixedT",value:function(e,t,n){var i=this,o=function e(t,o){var s;if("object"!==xf(o)){for(var a=arguments.length,r=new Array(a>2?a-2:0),c=2;c1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var i=n.lng||this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,s=this.languages[this.languages.length-1];if("cimode"===i.toLowerCase())return!0;var a=function(e,n){var i=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===i||2===i};if(n.precheck){var r=n.precheck(this,a);if(void 0!==r)return r}return!(!this.hasResourceBundle(i,e)&&this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages)&&(!a(i,e)||o&&!a(s,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,i=tm();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){i.resolve(),t&&t(e)})),i):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=tm();"string"==typeof e&&(e=[e]);var i=this.options.preload||[],o=e.filter((function(e){return i.indexOf(e)<0}));return o.length?(this.options.preload=i.concat(o),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new Cm(Fm());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jm,o=Vm(Vm(Vm({},this.options),n),{isClone:!0}),s=new t(o);return void 0===n.debug&&void 0===n.prefix||(s.logger=s.logger.clone(n)),["store","services","language"].forEach((function(t){s[t]=e[t]})),s.services=Vm({},this.services),s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s.translator=new Im(s.services,s.options),s.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}));var Km=Hm.createInstance();Km.createInstance=Hm.createInstance,Km.createInstance,Km.dir,Km.init,Km.loadResources,Km.reloadResources,Km.use,Km.changeLanguage,Km.getFixedT,Km.t,Km.exists,Km.setDefaultNamespace,Km.hasLoadedNamespace,Km.loadNamespaces,Km.loadLanguages;class zm extends Tf{constructor(){super(),this.languages=null,this.keyMap={}}static getInstance(){return zm.instance||(zm.instance=new zm),zm.instance}provideLanguages(e){var t;uf||(this.languages=e,(null===(t=e["zh-CN"])||void 0===t?void 0:t.Chat)&&this.setKeyMap(e["zh-CN"]),console.log("TUITranslateService.provideLanguages ok."))}useI18n(e){var t;if(uf)return;if(!this.languages)return void console.warn("TUITranslateService.useI18next not have messages.");const n={};for(const[o,s]of Object.entries(this.languages))n["zh_cn"===o?"zh":o]={translation:s};Km.init({compatibilityJSON:"v3",lng:e||"zh",fallbackLng:"zh",detection:{order:["querystring","navigator"],caches:["localStorage","cookie"]},resources:n});let i=this.normalizeLanguageKey(e||"zh");null===(t=this.getEngine().TUIReport)||void 0===t||t.reportFeature(201,i)}changeLanguage(e){let t=this.normalizeLanguageKey(e);return this.getEngine().TUIReport.reportFeature(201,t),Km.changeLanguage(e)}normalizeLanguageKey(e){return e.includes("en")?"en-us":e.includes("tw")?"zh-tw":e.includes("zh")||e.includes("cn")?"zh-cn":e.includes("ko")||e.includes("kr")?"ko-kr":e.includes("ja")||e.includes("jp")?"ja-jp":"other-"+e}t(e){if(!this.languages){let t=e;return!Qg(e)&&e.indexOf(".")>-1&&(t=e.split(".").pop()||""),t}const t=this.keyMap[e];return t?Km.t(t):Km.t(e)}setKeyMap(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=t?`${t}.${n}`:n;if(e[n]&&"object"==typeof e[n]&&!Array.isArray(e[n])&&null!==e[n])this.setKeyMap(e[n],i);else{let i=t?`${t}.${e[n]}`:e[n];i=this.replaceKey(i),this.keyMap[i]=`${t}.${n}`}}}replaceKey(e){return e.startsWith("Chat")?e.replace("Chat","TUIChat"):e.startsWith("Conversation")?e.replace("Conversation","TUIConversation"):e.startsWith("Message")?e.replace("Message","message.tip"):e.startsWith("Call")?e.replace("Call","message.custom"):e}}class Wm extends Tf{constructor(){super(),this.serv="TUIConversationService"}static getInstance(){return Wm.instance||(Wm.instance=new Wm),Wm.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalUnreadCountUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),this.getConversationInitData()}onConversationListUpdated(e){const t=this.filterSystemConversation(e);this.getEngine().TUIStore.update(jg.CONV,"conversationList",t),this.updateCurrentConversation()}onTotalUnreadCountUpdated(e){this.getEngine().TUIStore.update(jg.CONV,"totalUnreadCount",e)}onMessageReceived(e){const t=this.getEngine(),n=this.getEngine().TUIStore.getData(jg.CONV,"conversationList");let i=!1;for(let o=0;o0){this.getEngine().TUIStore.update(jg.CONV,"operationTypeMap",{conversationID:a,operationType:0}),i=!0;break}}}if(i){this.getEngine().TUIStore.update(jg.CONV,"conversationList",n);const e=this.getEngine().TUIStore.getData(jg.CONV,"currentConversationID")||"",t=this.findConversation(e);t&&this.getEngine().TUIStore.update(jg.CONV,"currentConversation",t)}}getConversationInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getConversationList().then((t=>{const{conversationList:n,isSyncCompleted:i}=t.data;if(console.log(`${this.serv}.init, getConversationList count:${n.length} isSyncCompleted:${i}`),n.length>0){this.onConversationListUpdated(n);const t=e.chat.getTotalUnreadMessageCount();this.onTotalUnreadCountUpdated(t)}}))}switchConversation(e){return Bg(this,void 0,void 0,(function*(){const t=`${this.serv}.switchConversation`,n=this.getEngine();if(!e)return n.TUIStore.reset(jg.CHAT,["messageList","isCompleted","nextReqMessageID"]),n.TUIStore.update(jg.CONV,"currentConversationID",""),n.TUIStore.update(jg.CONV,"currentConversation",null),console.log(`${t} conversationID is empty, conversationID:${e}`),Promise.resolve({});if(!e.startsWith(n.TYPES.CONV_C2C)&&!e.startsWith(n.TYPES.CONV_GROUP))return console.warn(`${t} conversationID is invalid, conversationID:${e}`),Promise.reject({code:Yg.INVALID_CONV_ID,message:Jg.INVALID_CONV_ID});const i=n.TUIStore.getData(jg.CONV,"currentConversationID");if(i&&i===e)return this.setMessageRead(i),console.warn(`${t} please check conversationID, conversationID:${e}`),Promise.resolve({code:Yg.CONV_ID_SAME,message:Jg.CONV_ID_SAME});const o=yield this.getConversationModel(e);return Qg(o)?(console.warn(`${t} target conversation is not exist, conversationID:${e}`),Promise.reject({code:Yg.CONV_NOT_EXIST,message:Jg.CONV_NOT_EXIST})):(i&&this.setMessageRead(i),e&&this.setMessageRead(e),n.TUIStore.reset(jg.CHAT,["messageList","isCompleted","nextReqMessageID"]),n.TUIStore.update(jg.CONV,"currentConversationID",e),n.TUIStore.update(jg.CONV,"currentConversation",o),Promise.resolve(o))}))}getConversationModel(e){return Bg(this,void 0,void 0,(function*(){let t=this.findConversation(e);if(Qg(t))try{const n=yield this.getConversationProfile(e);n.data&&n.data.conversation&&(t=new Rf(n.data.conversation))}catch(n){t=void 0}return t}))}findConversation(e){let t;const n=this.getEngine().TUIStore.getData(jg.CONV,"conversationList");for(let i=0;i{const n=this.getEngine().TUIStore.getData(jg.CONV,"currentConversationID");return console.log(`${this.serv}.deleteConversation conversationID:${e} currentConversationID:${n}`),e===n&&(this.getEngine().TUIStore.update(jg.CONV,"currentConversationID",""),this.getEngine().TUIStore.update(jg.CONV,"currentConversation",null)),t}))}pinConversation(e){return this.getEngine().chat.pinConversation(e)}muteConversation(e){return this.getEngine().chat.setMessageRemindType(e)}clearHistoryMessage(e){return this.getEngine().chat.clearHistoryMessage(e).then((e=>(this.getEngine().TUIStore.update(jg.CHAT,"messageList",[]),this.getEngine().TUIStore.update(jg.CHAT,"nextReqMessageID",""),this.getEngine().TUIStore.update(jg.CHAT,"isCompleted",!0),e)))}setMessageRead(e){return this.getEngine().chat.setMessageRead({conversationID:e})}setConversationDraft(e){const{conversationID:t,draftInfo:n}=e;let i="";return n&&(i=JSON.stringify(n)),this.getEngine().chat.setConversationDraft({conversationID:t,draftText:i}).then((e=>{const{conversation:t}=e.data;this.updateConversation(t)}))}updateConversation(e){let t=!1;const n=this.getEngine().TUIStore.getData(jg.CONV,"conversationList");for(let i=0;ie.type!==this.getEngine().TYPES.CONV_SYSTEM))}}class Ym{constructor(e){this.TUIUserService=e}getEngine(){return this.TUIUserService.getEngine()}init(){this.getEngine().eventCenter.addEvent(this.getEngine().EVENT.PROFILE_UPDATED,this.onProfileUpdated.bind(this)),this.getEngine().eventCenter.addEvent(this.getEngine().EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated.bind(this)),this.getUserProfileInitData()}onProfileUpdated(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.USER,"userProfile");e.forEach((e=>{e.userID===n.userID&&t.TUIStore.update(jg.USER,"userProfile",e)}))}onBlacklistUpdated(e){const t=this.getEngine();this.getBlacklistProfile(e).then((e=>{t.TUIStore.update(jg.USER,"userBlacklist",e)}))}getUserProfileInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getBlacklist().then((e=>{const t=e.data||[];console.log(`TUIUserProfileHandler.init, getBlacklist count:${t.length}`),t.length>0&&this.onBlacklistUpdated(t)}))}getBlacklistProfile(e){const t=[];let n=0;for(;n{i.push(this.TUIUserService.getUserProfile({userIDList:e}))}));const o=[];return Promise.all(i).then((e=>(e.forEach((e=>{const t=e.data.map((e=>{const{userID:t,nick:n,avatar:i}=e;return{userID:t,nick:n,avatar:i}}));o.push(...t)})),o)))}getUserProfile(e){const t=this.getEngine();return Qg(e)?t.chat.getMyProfile().then((e=>(t.TUIStore.update(jg.USER,"userProfile",e.data),e))).catch((e=>Promise.reject(e))):t.chat.getUserProfile(e)}updateMyProfile(e){return this.getEngine().chat.updateMyProfile(e)}addToBlacklist(e){return this.getEngine().chat.addToBlacklist(e)}removeFromBlacklist(e){return this.getEngine().chat.removeFromBlacklist(e)}}function $m(e,t,n=!0){var i,o;i=n?Xm(e):e,o=t,df?hf.setStorageSync(i,o):Qm()&&localStorage.setItem(i,JSON.stringify(o))}function Jm(e,t=!0){try{return function(e){if(df)return hf.getStorageSync(e);if(Qm()){const t=localStorage.getItem(e);if("undefined"!==t)return JSON.parse(t)}}(t?Xm(e):e)}catch(n){return void console.warn("Storage.getStorageItem error:",n)}}function Xm(e){return`chat_engine_${e}`}function Qm(){return navigator&&navigator.cookieEnabled&&localStorage}class Zm{constructor(e){this.TUIUserService=e}getEngine(){return this.TUIUserService.getEngine()}init(){const e=this.getEngine(),t=Jm("displayOnlineStatus")||!1;e.TUIStore.update(jg.USER,"displayOnlineStatus",t),e.eventCenter.addEvent(e.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated.bind(this)),this.onConversationListUpdated()}onConversationListUpdated(){const e=this.getEngine();e.TUIStore.watch(jg.CONV,{conversationList:()=>{const t=e.TUIStore.getData(jg.APP,"enabledOnlineStatus"),n=e.TUIStore.getData(jg.USER,"displayOnlineStatus");t&&n&&this.startToSubscribe()}})}onUserStatusUpdated(e){this.getEngine().TUIStore.update(jg.USER,"userStatusList",e)}switchUserStatus(e){const t=this.getEngine(),{displayOnlineStatus:n=!1}=e;t.TUIStore.update(jg.USER,"displayOnlineStatus",n),$m("displayOnlineStatus",n);const i=t.TUIStore.getData(jg.APP,"enabledOnlineStatus");i?!0===n?this.startToSubscribe():this.unsubscribeUserStatus():console.warn(`UserStatusHandler.switchUserStatus enabledOnlineStatus:${i} displayOnlineStatus:${n}`)}getUserStatus(e){const t=this.getEngine();return t.chat.getUserStatus(e).then((e=>{const{successUserList:n}=e.data;return n.length>0&&t.TUIStore.update(jg.USER,"userStatusList",n),e})).catch((e=>Promise.reject(e)))}subscribeUserStatus(e){var t;const n=(null===(t=null==e?void 0:e.userIDList)||void 0===t?void 0:t.length)||0;return 0===n?(console.warn(`UserStatusHandler.subscribeUserStatus userID count:${n}`),Promise.resolve()):this.getEngine().chat.subscribeUserStatus(e)}unsubscribeUserStatus(e){const t=this.getEngine(),{userIDList:n=[]}=e||{};return t.chat.unsubscribeUserStatus({userIDList:n}).then((e=>{const{failureUserList:i}=e.data,o=[];return n.forEach((e=>{i.includes(e)||o.push({userID:e,statusType:Hg.UNSUB_USER})})),t.TUIStore.update(jg.USER,"userStatusList",o),e})).catch((e=>Promise.reject(e)))}startToSubscribe(){const e=this.getEngine(),t=e.TUIStore.getData(jg.CONV,"conversationList"),n=e.TUIStore.getData(jg.USER,"userStatusList"),i=[];t.forEach((t=>{if(t.type===e.TYPES.CONV_C2C){const o=t.conversationID.replace(e.TYPES.CONV_C2C,"");n.has(o)||i.push(o)}})),0!==i.length&&e.chat.isReady()&&(this.subscribeUserStatus({userIDList:i}),this.getUserStatus({userIDList:i}))}}class e_ extends Tf{constructor(){super(),this.userProfileHandler=new Ym(this),this.userStatusHandler=new Zm(this)}static getInstance(){return e_.instance||(e_.instance=new e_),e_.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.KICKED_OUT,this.onKickedOut.bind(this)),e.eventCenter.addEvent(e.EVENT.NET_STATE_CHANGE,this.onNetStateChange.bind(this)),this.userProfileHandler.init(),this.userStatusHandler.init(),this.initMessageReadReceipt()}onKickedOut(e){this.getEngine().TUIStore.update(jg.USER,"kickedOut",e.type)}onNetStateChange(e){this.getEngine().TUIStore.update(jg.USER,"netStateChange",e.state)}initMessageReadReceipt(){const e=Jm("displayMessageReadReceipt")||!0;this.getEngine().TUIStore.update(jg.USER,"displayMessageReadReceipt",e)}switchUserStatus(e){return this.userStatusHandler.switchUserStatus(e)}switchMessageReadStatus(e){this.getEngine().TUIStore.update(jg.USER,"displayMessageReadReceipt",e),$m("displayMessageReadReceipt",e)}getUserProfile(e){return this.userProfileHandler.getUserProfile(e)}updateMyProfile(e){return this.userProfileHandler.updateMyProfile(e)}addToBlacklist(e){return this.userProfileHandler.addToBlacklist(e)}removeFromBlacklist(e){return this.userProfileHandler.removeFromBlacklist(e)}getUserStatus(e){return this.userStatusHandler.getUserStatus(e)}subscribeUserStatus(e){return this.userStatusHandler.subscribeUserStatus(e)}unsubscribeUserStatus(e){return this.userStatusHandler.unsubscribeUserStatus(e)}}class t_{constructor(e){this.TUIChatService=e,this.userShowNameMap=new Map,this.requestedUserMap=new Map}getEngine(){return this.TUIChatService.getEngine()}t(e){return this.getEngine().TUITranslate.t(e)}handleTextMessage(e){return{text:this.decodeText(e.payload)}}handleFaceMessage(e){const t={name:"",url:"",type:""};return e.payload.data.indexOf("@custom")>-1?(t.name=e.payload.data,t.type="custom",t):(t.name=e.payload.data.indexOf("@2x")<0?`${e.payload.data}@2x`:e.payload.data,t.url=`https://web.sdk.qcloud.com/im/assets/face-elem/${t.name}.png`,t)}handleLocationMessage(e){const t={lon:"",lat:"",href:"",url:"",description:""};return t.lon=e.payload.longitude.toFixed(6),t.lat=e.payload.latitude.toFixed(6),t.href=`https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&pointx=${t.lon}&pointy=${t.lat}&name=${e.payload.description}`,t.url=`https://apis.map.qq.com/ws/staticmap/v2/?center=${t.lat},${t.lon}&zoom=10&size=300*150&maptype=roadmap&markers=size:large|color:0xFFCCFF|label:k|${t.lat},${t.lon}&key=UBNBZ-PTP3P-TE7DB-LHRTI-Y4YLE-VWBBD`,t.description=e.payload.description,t}handleImageMessage(e){return{url:e.payload.imageInfoArray[0].url,width:e.payload.imageInfoArray[0].width,height:e.payload.imageInfoArray[0].height}}handleAudioMessage(e){return{url:e.payload.url,second:e.payload.second}}handleVideoMessage(e){return{url:e.payload.videoUrl,snapshotUrl:e.payload.snapshotUrl,snapshotWidth:e.payload.snapshotWidth,snapshotHeight:e.payload.snapshotHeight}}handleFileMessage(e){return{url:e.payload.fileUrl,name:e.payload.fileName,size:nf(e.payload.fileSize)}}handleCustomMessage(e){var t;const n=this.handleCreateGroupCustomMessage(e);return{custom:this.handleCallKitSignaling(e)||n||(null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.extension)||`${this.t("TUIChat.[自定义消息]")}`,businessID:n?"group_create":""}}handleMergeMessage(e){return Object.assign({},e.payload)}handleGroupTipsMessage(e){var t,n,i,o,s,a;const r=this.getEngine(),c={text:""};let u=(null==e?void 0:e.nick)||(null===(n=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.userIDList)||void 0===n?void 0:n.join(","));switch((null===(o=null===(i=null==e?void 0:e.payload)||void 0===i?void 0:i.memberList)||void 0===o?void 0:o.length)>0&&(u="",null===(a=null===(s=null==e?void 0:e.payload)||void 0===s?void 0:s.memberList)||void 0===a||a.map((e=>{const t=(null==e?void 0:e.nick)||(null==e?void 0:e.userID);return u+=`${this.substringByLength(t)},`,e})),u=null==u?void 0:u.slice(0,-1)),e.payload.operationType){case r.TYPES.GRP_TIP_MBR_JOIN:c.text=`${u} ${this.t("message.tip.加入群组")}`;break;case r.TYPES.GRP_TIP_MBR_QUIT:c.text=`${this.t("message.tip.群成员")}:${u} ${this.t("message.tip.退出群组")}`;break;case r.TYPES.GRP_TIP_MBR_KICKED_OUT:c.text=`${this.t("message.tip.群成员")}:${u} ${this.t("message.tip.被")}${this.t("message.tip.踢出群组")}`;break;case r.TYPES.GRP_TIP_MBR_SET_ADMIN:c.text=`${this.t("message.tip.群成员")}:${u} ${this.t("message.tip.成为管理员")}`;break;case r.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:c.text=`${this.t("message.tip.群成员")}:${u} ${this.t("message.tip.被撤销管理员")}`;break;case r.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:c.text=this.handleGroupProfileUpdated(e);break;case r.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:for(const t of e.payload.memberList)t.muteTime>0?c.text=`${this.t("message.tip.群成员")}:${u} ${this.t("message.tip.被禁言")}`:c.text=`${this.t("message.tip.群成员")}:${u} ${this.t("message.tip.被取消禁言")}`;break;default:c.text=`[${this.t("message.tip.群提示消息")}]`}return c}handleGroupSystemMessage(e){const t=e.payload.groupProfile.name||e.payload.groupProfile.groupID,n={text:""};switch(e.payload.operationType){case 1:n.text=`${e.payload.operatorID} ${this.t("message.tip.申请加入群组")}:${t}`;break;case 2:n.text=`${this.t("message.tip.成功加入群组")}:${t}`;break;case 3:n.text=`${this.t("message.tip.申请加入群组")}:${t} ${this.t("message.tip.被拒绝")}`;break;case 4:n.text=`${this.t("message.tip.你被管理员")}${e.payload.operatorID} ${this.t("message.tip.踢出群组")}:${t}`;break;case 5:n.text=`${this.t("message.tip.群")}:${t} ${this.t("message.tip.被")} ${e.payload.operatorID} ${this.t("message.tip.解散")}`;break;case 6:n.text=`${e.payload.operatorID} ${this.t("message.tip.创建群")}:${t}`;break;case 7:case 12:n.text=`${e.payload.operatorID} ${this.t("message.tip.邀请你加群")}:${t}`;break;case 8:n.text=`${this.t("message.tip.你退出群组")}:${t}`;break;case 9:n.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.设置为群")}:${t} ${this.t("message.tip.的管理员")}`;break;case 10:n.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.撤销群")}:${t} ${this.t("message.tip.的管理员身份")}`;break;case 13:n.text=`${e.payload.operatorID} ${this.t("message.tip.同意加群")}:${t}`;break;case 14:n.text=`${e.payload.operatorID} ${this.t("message.tip.拒接加群")}:${t}`;break;case 255:n.text=`${this.t("message.tip.自定义群系统通知")}: ${e.payload.userDefinedField}`;break;default:n.text="未解析的群系统通知"}return n}handleCallKitSignaling(e){var t,n,i,o,s,a,r,c,u,l;const d=tf(e.payload.data);if(1!==(null==d?void 0:d.businessID))return"";const p=tf(null==d?void 0:d.data),h=e.fromAccount||e.from,g=this.getEngine().TUIFriend.getFriendRemark([h]),f=this.getEngine().getMyUserID();let m=g[h]||e.nameCard||e.nick||h;switch(m=this.substringByLength(m),null==d?void 0:d.actionType){case 1:return"audioCall"!==(null===(t=null==p?void 0:p.data)||void 0===t?void 0:t.cmd)&&"videoCall"!==(null===(n=null==p?void 0:p.data)||void 0===n?void 0:n.cmd)||!(null==d?void 0:d.groupID)?"hangup"===(null===(i=null==p?void 0:p.data)||void 0===i?void 0:i.cmd)?(null==d?void 0:d.groupID)?`${this.t("message.custom.通话结束")}`:`${this.t("message.custom.通话时长")}:${function(e){const t=e;let n,i,o,s="";return t>=3600?(n=parseInt(""+t/3600,10)<10?`0${parseInt(""+t/3600,10)}`:parseInt(""+t/3600,10),i=parseInt(""+t%60/60,10)<10?`0${parseInt(""+t%60/60,10)}`:parseInt(""+t%60/60,10),o=t%3600<10?"0"+t%3600:t%3600,o>60&&(i=parseInt(""+o/60,10)<10?`0${parseInt(""+o/60,10)}`:parseInt(""+o/60,10),o=o%60<10?"0"+o%60:o%60),s=`${n}:${i}:${o}`):t>=60&&t<3600?(i=parseInt(""+t/60,10)<10?`0${parseInt(""+t/60,10)}`:parseInt(""+t/60,10),o=t%60<10?"0"+t%60:t%60,s=`00:${i}:${o}`):t<60&&(o=t<10?`0${t}`:t,s=`00:00:${o}`),s}(null==p?void 0:p.call_end)}`:"switchToAudio"===(null===(o=null==p?void 0:p.data)||void 0===o?void 0:o.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(s=null==p?void 0:p.data)||void 0===s?void 0:s.cmd)?`${this.t("message.custom.切换视频通话")}`:`${this.t("message.custom.发起通话")}`:`${m} ${this.t("message.custom.发起通话")}`;case 2:return(null==d?void 0:d.groupID)?`${m} ${this.t("message.custom.取消通话")}`:this.isOldUIKit("message.custom.已取消")?this.t("message.custom.取消通话"):(null==d?void 0:d.inviter)===f?this.t("message.custom.已取消"):this.t("message.custom.对方已取消");case 3:return"switchToAudio"===(null===(a=null==p?void 0:p.data)||void 0===a?void 0:a.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(r=null==p?void 0:p.data)||void 0===r?void 0:r.cmd)?`${this.t("message.custom.切换视频通话")}`:(null==d?void 0:d.groupID)?`${m} ${this.t("message.custom.已接听")}`:this.t("message.custom.已接听");case 4:return(null==d?void 0:d.groupID)?`${m} ${this.t("message.custom.拒绝通话")}`:this.isOldUIKit("message.custom.已拒绝")?this.t("message.custom.拒绝通话"):"line_busy"===(null==p?void 0:p.line_busy)||"lineBusy"===(null==p?void 0:p.data.message)?(null==d?void 0:d.inviter)===f?this.t("message.custom.对方忙线中"):this.t("message.custom.忙线未接听"):(null==d?void 0:d.inviter)===f?this.t("message.custom.对方已拒绝"):this.t("message.custom.已拒绝");case 5:if("switchToAudio"===(null===(c=null==p?void 0:p.data)||void 0===c?void 0:c.cmd))return`${this.t("message.custom.切换语音通话")}`;if("switchToVideo"===(null===(u=null==p?void 0:p.data)||void 0===u?void 0:u.cmd))return`${this.t("message.custom.切换视频通话")}`;if(null==d?void 0:d.groupID){if(h===(null==d?void 0:d.inviter)){this.handleCallkitTimeoutSignaling(d.inviteeList);let e="";return null===(l=d.inviteeList)||void 0===l||l.forEach((t=>{const n=this.userShowNameMap.get(t)||t;e+=`${this.substringByLength(n)}、`})),e=e.substring(0,e.lastIndexOf("、")),`${e} ${this.t("message.custom.无应答")}`}return`${m} ${this.t("message.custom.无应答")}`}return this.isOldUIKit("message.custom.对方无应答")?this.t("message.custom.无应答"):(null==d?void 0:d.inviter)===f?this.t("message.custom.对方无应答"):this.t("message.custom.超时无应答");default:return""}}handleCreateGroupCustomMessage(e){let t;const n=tf(e.payload.data);return"group_create"===(null==n?void 0:n.businessID)&&(t=`${n.opUser} ${n.content}`),t}decodeText(e){const t=[];let n=e.text,i=-1,o=-1;for(;""!==n;)switch(i=n.indexOf("["),o=n.indexOf("]"),i){case 0:if(-1===o)t.push({name:"text",text:n}),n="";else{const e=n.slice(0,o+1);e.indexOf("@custom")>-1?(t.push({name:"img",src:"",type:"custom",emojiKey:e}),n=n.substring(o+1)):of[e]?(t.push({name:"img",src:"https://web.sdk.qcloud.com/im/assets/emoji-plugin/"+of[e],emojiKey:e}),n=n.substring(o+1)):(t.push({name:"text",text:"["}),n=n.slice(1))}break;case-1:t.push({name:"text",text:n}),n="";break;default:t.push({name:"text",text:n.slice(0,i)}),n=n.substring(i)}return t}handleGroupProfileUpdated(e){const{nick:t,payload:n}=e,{newGroupProfile:i,memberList:o,operatorID:s}=n;let a="";const r=t||s,c=Object.keys(i)[0];switch(c){case"muteAllMembers":a=i[c]?`${this.t("message.tip.管理员")} ${r} ${this.t("message.tip.开启全员禁言")}`:`${this.t("message.tip.管理员")} ${r} ${this.t("message.tip.取消全员禁言")}`;break;case"ownerID":a=`${o[0].nick||o[0].userID} ${this.t("message.tip.成为新的群主")}`;break;case"groupName":a=`${r} ${this.t("message.tip.修改群名为")} ${i[c]}`;break;case"notification":a=this.isOldUIKit("message.tip.把群公告修改为")?`${r} ${this.t("message.tip.发布新公告")}`:`${r} ${this.t("message.tip.把群公告修改为")} "${i[c]}"`}return a}handleCallkitTimeoutSignaling(e=[]){if(0===e.length)return;const t=this.getEngine().TUIFriend.getFriendRemark(e),n=[];e.forEach((e=>{const i=t[e];i?this.userShowNameMap.set(e,i):this.requestedUserMap.has(e)||(n.push(e),this.requestedUserMap.set(e,1))})),n.length>0&&this.getEngine().TUIUser.getUserProfile({userIDList:n}).then((e=>{(e.data||[]).forEach((e=>{const{userID:t,nick:n}=e,i=n||t;this.userShowNameMap.set(t,i)}))})).catch((()=>{}))}substringByLength(e,t=12){return e.length>t?`${e.slice(0,t)}...`:e}isOldUIKit(e){var t;const n=e.lastIndexOf("."),i=e.slice(0,n+1);return null===(t=this.t(e))||void 0===t?void 0:t.startsWith(i)}}class n_{constructor(e){this.TUIChatService=e,this.typingTo="",this.timer=null}getEngine(){return this.TUIChatService.getEngine()}clearTypingStatus(){this.getEngine().TUIStore.getData(jg.CHAT,"typingStatus")&&this.getEngine().TUIStore.update(jg.CHAT,"typingStatus",!1),this.timer&&clearTimeout(this.timer),this.timer=null}handleLastMessage(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.CHAT,"typingStatus");if(e.type===this.getEngine().TYPES.MSG_CUSTOM&&"in"===e.flow){const i=tf(e.payload.data);if(i.businessID===Kg.BUSINESS_ID){const{typingStatus:e,userAction:o}=i;if(e===Kg.STATUS_START||o===Kg.ACTION_START_ID)return n?(this.timer&&clearTimeout(this.timer),this.timer=null):t.TUIStore.update(jg.CHAT,"typingStatus",!0),this.timer=setTimeout((()=>{this.clearTypingStatus()}),3e4),t.TUIStore.getData(jg.CHAT,"typingStatus");e!==Kg.STATUS_END&&o!==Kg.ACTION_END_ID||this.clearTypingStatus()}}}filterTypingMessage(e=[]){return 0===e.length?[]:(this.getEngine().TUIStore.getData(jg.APP,"enableTyping")&&this.handleLastMessage(e[e.length-1]),e.filter((e=>e.type!==this.getEngine().TYPES.MSG_CUSTOM||tf(e.payload.data).businessID!==Kg.BUSINESS_ID)))}createTypingMessage(e=Kg.STATUS_END,t=""){const{BUSINESS_ID:n,STATUS_START:i,VERSION:o,ACTION_START_ID:s,ACTION_END_ID:a,ACTION_START:r,ACTION_END:c,NEED_TYPING:u}=Kg;return{to:t,conversationType:this.getEngine().TYPES.CONV_C2C,payload:{data:JSON.stringify({businessID:n,typingStatus:e,version:o,userAction:e===i?s:a,actionParam:e===i?r:c}),description:"",extension:""},cloudCustomData:JSON.stringify({messageFeature:{needTyping:u,version:o}})}}sendTyping(e=!1,t=""){if(e){this.typingTo=t;const e=this.createTypingMessage(Kg.STATUS_START,t);this.getEngine().TUIChat.sendCustomMessage(e,{onlineUserOnly:!0})}else this.sendTypingEnd()}sendTypingEnd(){if(this.typingTo){const e=this.createTypingMessage(Kg.STATUS_END,this.typingTo);this.getEngine().TUIChat.sendCustomMessage(e,{onlineUserOnly:!0})}this.typingTo=""}}class i_{constructor(e){this.TUIChatService=e}getEngine(){return this.TUIChatService.getEngine()}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived.bind(this))}onMessageReadReceiptReceived(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.CONV,"currentConversationID"),i=[];e.forEach((e=>{const{messageID:o}=e,s=t.chat.findMessage(o);s&&n===s.conversationID&&i.push(s)})),i.length>0&&t.TUIChat.updateMessageList(i,"edit")}sendMessageReadReceipt(e){const t=[];return e.forEach((e=>{const n=e.getMessage();t.push(n)})),this.getEngine().chat.sendMessageReadReceipt(t)}getGroupMessageReadMemberList(e){const t=e.message.getMessage(),n=Object.assign(Object.assign({},e),{message:t});return this.getEngine().chat.getGroupMessageReadMemberList(n)}getMessageReadReceiptList(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.APP,"enabledMessageReadReceipt"),i=t.TUIStore.getData(jg.USER,"displayMessageReadReceipt");!n||!i||0===e.length||e[0].conversationType!==t.TYPES.CONV_GROUP||t.chat.getMessageReadReceiptList(e).then((e=>{const{messageList:t}=e.data;this.TUIChatService.updateMessageList(t,"edit")})).catch((e=>{console.warn(`ReadReceiptHandler.getMessageReadReceiptList error:${e.message}`)}))}}class o_ extends Tf{constructor(){super(),this.serv="TUIChatService",this.messageHandler=new t_(this),this.typingHandler=new n_(this),this.readReceiptHandler=new i_(this),this.isSwitching=!0,this.delayGetHoppingFunction=void 0,this.hoppingConfigMap=new Map}static getInstance(){return o_.instance||(o_.instance=new o_),o_.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_MODIFIED,this.onMessageModified.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_REVOKED,this.onMessageRevoked.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated.bind(this)),this.onCurrentConversationIDUpdated(),this.onMessageSource(),this.readReceiptHandler.init()}onMessageReceived(e){this.updateMessageList(e,"received"),this.getEngine().TUIStore.update(jg.CHAT,"newMessageList",e)}onMessageModified(e){this.updateMessageList(e,"edit")}onMessageRevoked(e){this.updateMessageList(e,"edit")}onMessageReadByPeer(e){this.updateMessageList(e,"edit")}onMessageReactionsUpdated(e){this.updateMessageReactionList([e])}onCurrentConversationIDUpdated(){const e=this.getEngine();e.TUIStore.watch(jg.CONV,{currentConversationID:t=>{this.isSwitching=!0,this.delayGetHoppingFunction=void 0,this.hoppingConfigMap.clear(),e.TUIStore.reset(jg.CHAT),this.typingHandler.clearTypingStatus(),this.typingHandler.sendTypingEnd(),kf(t)||this.getMessageList().finally((()=>{this.isSwitching=!1,this.delayGetHoppingFunction&&this.delayGetHoppingFunction()}))}})}onMessageSource(){const e=this.getEngine();e.TUIStore.watch(jg.CHAT,{messageSource:t=>{const n=this.getStoreData(jg.CONV,"currentConversationID");if(!n||t&&t.conversationID!==n)return;if(Qg(t))return this.hoppingConfigMap.clear(),e.TUIStore.update(jg.CHAT,"messageList",[]),e.TUIStore.update(jg.CHAT,"nextReqMessageID",""),e.TUIStore.update(jg.CHAT,"isCompleted",!1),void this.getMessageList();const i=this.getStoreData(jg.CHAT,"messageList");i&&i.find((e=>t&&e.ID===t.ID))||(this.isSwitching?this.delayGetHoppingFunction=this.getMessageListHoppingForDown:this.getMessageListHoppingForDown())}})}getMessageListHoppingForDown(){const e=this.getStoreData(jg.CHAT,"messageList"),{conversationID:t,sequence:n,time:i,ID:o}=this.getStoreData(jg.CHAT,"messageSource");if(e&&e.find((e=>o&&e.ID===o)))return;const s=this.getEngine();s.TUIStore.update(jg.CHAT,"messageList",[]),s.TUIStore.update(jg.CHAT,"nextReqMessageID",""),s.TUIStore.update(jg.CHAT,"isCompleted",!1),this.getMessageListHopping({conversationID:t,sequence:n,time:i,direction:1})}getStoreData(e,t){return this.getEngine().TUIStore.getData(e,t)}sendMessage(e,t){this.updateMessageList([e],"send");const n=this.getEngine().chat.sendMessage(e,t);return this.getResponse(n)}getResponse(e,t=!0,n=!0){return e.then((e=>{const n=e.data.messageList?e.data.messageList:[e.data.message];return t&&this.updateMessageList(n,"edit"),e})).catch((e=>{var t;return n&&(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.message)&&this.updateMessageList([e.data.message],"edit"),Promise.reject(e)}))}updateMessageList(e,t=""){if(this.getStoreData(jg.CHAT,"messageSource")&&"unshift"!==t&&"edit"!==t)return;const n=this.getStoreData(jg.CHAT,"messageList"),i=this.updateTargetMessageList(e,n,t);this.getEngine().TUIStore.update(jg.CHAT,"messageList",i)}updateTargetMessageList(e,t,n=""){const i=this.getStoreData(jg.CONV,"currentConversationID");let o=e.filter((e=>e.conversationID===i));if(o=this.handleC2CCallSignaling(o),!n||0===o.length)return t;const s=t||[];let a=[];if("send"===n||"push"===n){const e=this.getStoreData(jg.CHAT,"userInfo");Object.keys(e).length>0&&this.updateLocalMessage(o,e)}switch(n){case"edit":for(const e of t){const t=o.find((t=>t.ID===e.ID));a.push(t||e)}break;case"resend":a=s.filter((e=>e.ID!==o[0].ID)).concat(o);break;case"send":a=s.concat(this.typingHandler.filterTypingMessage(o));break;case"push":a=s.concat(this.typingHandler.filterTypingMessage(o)),this.getEngine().chat.setMessageRead({conversationID:i});break;case"received":a=s.concat(this.typingHandler.filterTypingMessage(o)),a=this.sortMessageList(a),this.getEngine().chat.setMessageRead({conversationID:i});break;case"unshift":a=o.filter((e=>0===s.length||!s.find((t=>t.ID===e.ID)))),a.push(...s),a=this.sortMessageList(a)}return a}enterTypingState(){this.getStoreData(jg.APP,"enableTyping")&&this.sendTyping(!0)}leaveTypingState(){this.getStoreData(jg.APP,"enableTyping")&&this.sendTyping(!1)}sendTyping(e){const t=this.getEngine(),n=this.getStoreData(jg.CONV,"currentConversationID");if(!n.startsWith(t.TYPES.CONV_C2C))return;const i=n.replace(t.TYPES.CONV_C2C,"");if(e){const e=this.getStoreData(jg.CHAT,"messageList").filter((e=>"in"===e.flow));if(0===e.length)return;const t=1e3*e[e.length-1].time;if((new Date).getTime()-t>3e4)return}this.typingHandler.sendTyping(e,i)}quoteMessage(e){var t;return this.getEngine().TUIStore.update(jg.CHAT,"quoteMessage",{message:e,type:"quote"}),null===(t=this.getEngine().TUIReport)||void 0===t||t.reportFeature(205),e}replyMessage(e){return this.getEngine().TUIStore.update(jg.CHAT,"quoteMessage",{message:e,type:"reply"}),e}getCurrentConvInfo(){const{conversationID:e="",type:t}=this.getStoreData(jg.CONV,"currentConversation")||{};return{to:e.replace(t,""),conversationType:t}}t(e){return this.getEngine().TUITranslate.t(e)||e}getMessageAbstractAndType(e){var t,n;const i=this.getEngine(),o={abstract:"",type:0};switch(e.type){case i.TYPES.MSG_TEXT:o.abstract=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.text,o.type=1;break;case i.TYPES.MSG_CUSTOM:o.abstract="[自定义消息]",o.type=2;break;case i.TYPES.MSG_IMAGE:o.abstract="[图片]",o.type=3;break;case i.TYPES.MSG_AUDIO:o.abstract="[语音]",o.type=4;break;case i.TYPES.MSG_VIDEO:o.abstract="[视频]",o.type=5;break;case i.TYPES.MSG_FILE:o.abstract="[文件]",o.type=6;break;case i.TYPES.MSG_LOCATION:o.type=7;break;case i.TYPES.MSG_FACE:o.abstract="[表情]",o.type=8;break;case i.TYPES.MSG_GRP_TIP:o.type=9;break;case i.TYPES.MSG_MERGER:o.abstract=null===(n=null==e?void 0:e.payload)||void 0===n?void 0:n.title,o.type=10}return o}genMessageReply(e,t){if("reply"!==t&&"quote"!==t)return{};const{abstract:n,type:i}=this.getMessageAbstractAndType(e),o={messageAbstract:n,messageSender:e.nick||e.from,messageID:e.ID},s=Object.assign(Object.assign({},o),{messageType:i,messageTime:null==e?void 0:e.time,messageSequence:null==e?void 0:e.sequence,version:1});if("reply"===t&&(s.messageRootID=e.ID,e.cloudCustomData)){const t=tf(e.cloudCustomData);t.messageReply&&t.messageReply.messageRootID&&(s.messageRootID=t.messageReply.messageRootID)}return{messageReply:s,messageReplyRoot:o}}getMessageInfo(e,t,n){const{messageReply:i,messageReplyRoot:o}=this.genMessageReply(t,n),s=e.cloudCustomData?tf(e.cloudCustomData):{};let a;if(s.messageReply?s.messageReply=Object.assign(Object.assign({},i),s.messageReply):s.messageReply=i,"reply"===n){const{messageRootID:e}=i;a=this.getEngine().chat.findMessage(e);const t=(null==a?void 0:a.cloudCustomData)?tf(a.cloudCustomData):{};t.messageReplies||(t.messageReplies={}),r=t.messageReplies.replies,("function"==typeof Array.isArray?Array.isArray(r):"array"===Object.prototype.toString.call(r).match(/^\[object (.*)\]$/)[1].toLowerCase())||(t.messageReplies.replies=[]),t.messageReplies.replies.push(o),a.cloudCustomData=JSON.stringify(t)}var r;return{cloudCustomData:JSON.stringify(s),rootMessage:a}}sendTextMessage(e,t){const n=this.getEngine(),{message:i,type:o}=this.getStoreData(jg.CHAT,"quoteMessage");let s={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};i&&(s=this.getMessageInfo(e,i,o));const a=n.chat.createTextMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{cloudCustomData:s.cloudCustomData}));return this.sendMessage(a,t).then((e=>(s.rootMessage&&this.modifyMessage(s.rootMessage),n.TUIStore.reset(jg.CHAT,["quoteMessage"],!0),e)))}sendTextAtMessage(e,t){const n=this.getEngine(),{message:i,type:o}=this.getStoreData(jg.CHAT,"quoteMessage");let s={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};i&&(s=this.getMessageInfo(e,i,o));const a=n.chat.createTextAtMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{cloudCustomData:s.cloudCustomData}));return this.sendMessage(a,t).then((e=>(s.rootMessage&&this.modifyMessage(s.rootMessage),n.TUIStore.reset(jg.CHAT,["quoteMessage"],!0),e)))}sendImageMessage(e,t){const n=this.getEngine().chat.createImageMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendAudioMessage(e,t){const n=this.getEngine().chat.createAudioMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendVideoMessage(e,t){const n=this.getEngine().chat.createVideoMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendCustomMessage(e,t){const n=this.getEngine().chat.createCustomMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}sendFaceMessage(e,t){const n=this.getEngine().chat.createFaceMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}sendFileMessage(e,t){const n=this.getEngine().chat.createFileMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendLocationMessage(e,t){const n=this.getEngine().chat.createLocationMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}onProgress(e,t){const n=this.getEngine().TUIStore.getMessageModel(e);n&&(t-n.progress>=.1||1===t)&&(n.progress=t,this.updateMessageList([n],"edit"))}setAbstractList(e){const t=this.getEngine(),n=e.nick||e.from;let i="";switch(e.type){case t.TYPES.MSG_TEXT:i=e.payload.text||"",i.length>20&&(i=i.slice(0,20));break;case t.TYPES.MSG_MERGER:i=`${this.t("TUIChat.[聊天记录]")}`;break;case t.TYPES.MSG_IMAGE:i=`${this.t("TUIChat.[图片]")}`;break;case t.TYPES.MSG_AUDIO:i=`${this.t("TUIChat.[音频]")}`;break;case t.TYPES.MSG_VIDEO:i=`${this.t("TUIChat.[视频]")}`;break;case t.TYPES.MSG_CUSTOM:i=`${this.t("TUIChat.[自定义消息]")}`;break;case t.TYPES.MSG_FILE:i=`${this.t("TUIChat.[文件]")}`;break;case t.TYPES.MSG_FACE:i=`${this.t("TUIChat.[动画表情]")}`}return`${n}: ${i}`}genMergerForwardPayload(e,t){const{abstractList:n=[],compatibleText:i="",title:o}=t;return 0===n.length&&e.forEach((e=>{n.push(this.setAbstractList(e))})),{messageList:e,title:o,abstractList:n,compatibleText:i||this.t("TUIChat.请升级IMSDK到v2.10.1或更高版本查看此消息")}}genSendMergerForwardMessage(e){const{conversationList:t,messageList:n,params:i,mergeInfo:o,sendMessageOptions:s}=e,a=[];for(let r=0;re instanceof bf?e.getMessage():e))}sendForwardMessage(e,t,n){t=this.getOriginMessageList(t);const i=n||{},{needMerge:o=!1,params:s={},mergeInfo:a={}}=i,r=Fg(i,["needMerge","params","mergeInfo"]);if(o)return this.sendMergerForwardMessage({conversationList:e,messageList:t,params:s,mergeInfo:a,sendMessageOptions:r});const c=[];for(let u=0;u{const{code:t=0,data:n={}}=e.code;throw t===Wg.MSG_MODIFY_CONFLICT?console.warn(`${$g.MSG_MODIFY_CONFLICT} data.message: ${null==n?void 0:n.message}`):t===Wg.MSG_MODIFY_DISABLED_IN_AVCHATROOM?console.warn($g.MSG_MODIFY_DISABLED_IN_AVCHATROOM):t===Wg.MODIFY_MESSAGE_NOT_EXIST&&console.warn($g.MODIFY_MESSAGE_NOT_EXIST),e}))}getMessageList(e={conversationID:this.getStoreData(jg.CONV,"currentConversationID"),nextReqMessageID:this.getStoreData(jg.CHAT,"nextReqMessageID")}){const t=this.getEngine();if(!t.chat.isReady())return Promise.reject({code:Yg.GET_MSG_LIST_ERROR,message:Jg.GET_MSG_LIST_ERROR});if(this.getStoreData(jg.CHAT,"isCompleted"))return Promise.resolve({data:{messageList:[],nextReqMessageID:"",isCompleted:!0}});const n=this.getStoreData(jg.CHAT,"messageSource"),i=this.hoppingConfigMap.get("nextMessageSeq"),o=this.hoppingConfigMap.get("nextMessageTime"),s=i||o;return n&&n.conversationID===(null==e?void 0:e.conversationID)&&s?this.getMessageListHopping():t.chat.getMessageList(e).then((e=>{var n;const{messageList:i,nextReqMessageID:o,isCompleted:s}=e.data,a=this.getStoreData(jg.CHAT,"userInfo");Object.keys(a).length>0&&this.updateLocalMessage(i,a),this.updateMessageList(i,"unshift"),t.TUIStore.update(jg.CHAT,"nextReqMessageID",o),t.TUIStore.update(jg.CHAT,"isCompleted",s);const r=null===(n=i[0])||void 0===n?void 0:n.conversationID,{operationType:c=0}=this.getEngine().TUIStore.getConversationModel(r)||{};return 0===c&&(this.getMessageReactions({messageList:i}),this.readReceiptHandler.getMessageReadReceiptList(i)),e})).catch((e=>Promise.reject(e)))}getMessageListHopping(e){var t;void 0===e&&(e={conversationID:null===(t=this.getStoreData(jg.CHAT,"messageSource"))||void 0===t?void 0:t.conversationID,sequence:this.hoppingConfigMap.get("nextMessageSeq"),time:this.hoppingConfigMap.get("nextMessageTime")});const n=this.getEngine();return n.chat.getMessageListHopping(e).then((t=>{const{messageList:i,nextMessageSeq:o,nextMessageTime:s,isCompleted:a}=t.data,r=1===e.direction?e.sequence:o,c=1===e.direction?e.time:s;return this.updateMessageList(i,"unshift"),this.delayGetHoppingFunction=void 0,this.hoppingConfigMap.set("nextMessageSeq",r),this.hoppingConfigMap.set("nextMessageTime",c),n.TUIStore.update(jg.CHAT,"isCompleted",a),t})).catch((e=>Promise.reject(e)))}sendMessageReadReceipt(e){return this.readReceiptHandler.sendMessageReadReceipt(e)}getGroupMessageReadMemberList(e){return this.readReceiptHandler.getGroupMessageReadMemberList(e).then((e=>{const{isCompleted:t,cursor:n,messageID:i,unreadUserIDList:o,readUserIDList:s}=e.data,a={code:0,data:{cursor:n,isCompleted:t,messageID:i,unreadUserInfoList:[],readUserInfoList:[]}},r=[...o,...s];return 0===r.length?a:this.getEngine().TUIUser.getUserProfile({userIDList:r}).then((e=>(o.length>0?e.data.forEach((e=>{const{userID:t,nick:n="",avatar:i=""}=e;a.data.unreadUserInfoList.push({userID:t,nick:n,avatar:i})})):e.data.forEach((e=>{const{userID:t,nick:n="",avatar:i=""}=e;a.data.readUserInfoList.push({userID:t,nick:n,avatar:i})})),a)))}))}downloadMergedMessages(e){return this.getEngine().chat.downloadMergerMessage(e)}setTranslationLanguage(e){this.getEngine().TUIStore.update(jg.USER,"targetLanguage",e)}translateText(e){const t=this.getStoreData(jg.USER,"targetLanguage"),n=Object.assign({targetLanguage:t,sourceLanguage:"auto"},e);return this.getEngine().chat.translateText(n)}searchCloudMessages(e){const t=this.getStoreData(jg.CONV,"conversationList");return this.getEngine().chat.searchCloudMessages(e).then((e=>{const{searchResultList:n}=e.data;return e.data.searchResultList=n.map((e=>{const{messageList:n,conversationID:i}=e,o=Fg(e,["messageList","conversationID"]),s=n.map((e=>new bf(e))),a=t.find((e=>e.conversationID===i));return Object.assign(Object.assign({},o),{messageList:s.sort(((e,t)=>t.time-e.time)),conversation:a})})),e}))}addMessageReaction(e,t){return this.getEngine().chat.addMessageReaction(e.getMessage(),t)}removeMessageReaction(e,t){return this.getEngine().chat.removeMessageReaction(e.getMessage(),t)}getMessageReactions(e){const{messageList:t=[]}=e,n=this.getStoreData(jg.APP,"enabledEmojiPlugin");console.log(`TUIChatService.getMessageReactions enabledEmojiPlugin:${n} messageList length:${t.length}`),n&&t.length>0&&this.getEngine().chat.getMessageReactions(e).then((e=>{const t=e.data.resultList||e.data;this.updateMessageReactionList(t)})).catch((()=>{}))}getAllUserListOfMessageReaction(e){var t;return this.getEngine().chat.getAllUserListOfMessageReaction(Object.assign(Object.assign({},e),{message:null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.getMessage()}))}updateMessageReactionList(e){const t=[];e.forEach((e=>{const{messageID:n,reactionList:i}=e,o=this.getEngine().TUIStore.getMessageModel(n);if(o){const e=[];for(let t=0;t0&&this.updateMessageList(t,"edit")}convertVoiceToText(e){const{message:t,language:n="zh"}=e,i=t.getMessage();return this.getEngine().chat.convertVoiceToText({message:i,language:n})}clearHistoryMessage(e){const t=this.getEngine();return t.chat.clearHistoryMessage(e).then((e=>(t.TUIStore.update(jg.CHAT,"messageList",[]),t.TUIStore.update(jg.CHAT,"nextReqMessageID",""),t.TUIStore.update(jg.CHAT,"isCompleted",!1),e)))}updateMessageInfo(e){const t=this.getStoreData(jg.CHAT,"userInfo");this.getEngine().TUIStore.update(jg.CHAT,"userInfo",Object.assign(t,e));const n=this.getStoreData(jg.CHAT,"messageList");n.length>0&&this.updateLocalMessage(n,e)&&this.getEngine().TUIStore.update(jg.CHAT,"messageList",n)}updateLocalMessage(e,t){let n=!1;return e.forEach((e=>{if(t[e.from]){const{nick:i,nameCard:o,avatar:s}=t[e.from];i&&(e.nick=i,n=!0),o&&(e.nameCard=o,n=!0),s&&(e.avatar=s,n=!0)}})),n}handleC2CCallSignaling(e){const t=this.getEngine(),n=t.getMyUserID();return e.filter((e=>{var i,o,s,a,r;const{conversationType:c,type:u,payload:l}=e;let d=!0;if(c===t.TYPES.CONV_C2C&&u===t.TYPES.MSG_CUSTOM&&t.chat.getSignalingInfo(e)){const t=tf(l.data);if(1===(null==t?void 0:t.businessID)){const c=tf(t.data);if(d=!(e._isExcludedFromUnreadCount&&e._isExcludedFromLastMessage),d&&!0!==(null===(i=null==c?void 0:c.data)||void 0===i?void 0:i.consumed)){let i=null===(o=null==c?void 0:c.data)||void 0===o?void 0:o.inviter;"line_busy"!==(null==c?void 0:c.line_busy)&&"lineBusy"!==(null===(s=null==c?void 0:c.data)||void 0===s?void 0:s.message)||(i=t.inviter);const{from:u,to:l}=e;if(i!==n&&e.from===n){const t=this.getStoreData(jg.CONV,"currentConversation");e.from=l,e.to=u,e.flow="in",e.avatar=(null===(a=null==t?void 0:t.userProfile)||void 0===a?void 0:a.avatar)||""}if(i===n&&e.from!==n){const t=this.getStoreData(jg.USER,"userProfile");e.from=l,e.to=u,e.flow="out",e.avatar=null==t?void 0:t.avatar}console.log(`${this.serv}.handleC2CCallSignaling myUserID:${n} callSignaling.inviter:${t.inviter} customData.data.inviter:${null===(r=null==c?void 0:c.data)||void 0===r?void 0:r.inviter}`)}}}return d}))}sortMessageList(e){const{conversationType:t}=e[0];if(t===this.getEngine().TYPES.CONV_C2C)return e.sort(((e,t)=>e.time-t.time));const n=e.filter((e=>"success"===e.status)).sort(((e,t)=>e.sequence-t.sequence));for(let i=0;i{e.groupID===n&&t.TUIStore.update(jg.GRP,"currentGroup",e)}))}onGroupAttributesUpdated(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.GRP,"currentGroupID");let i=t.TUIStore.getData(jg.GRP,"groupList");const{groupID:o,groupAttributes:s}=e;n===o&&t.TUIStore.update(jg.GRP,"currentGroupAttributes",s),i=i.map((e=>(e.groupID===o&&(e.groupAttributes=s),e))),t.TUIStore.update(jg.GRP,"groupList",i)}onGroupCounterUpdated(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.GRP,"currentGroupID"),i=t.TUIStore.getData(jg.GRP,"currentGroupCounters")||{};let o=t.TUIStore.getData(jg.GRP,"groupList");const{groupID:s,key:a,value:r}=e;n===s&&(i[a]=r,t.TUIStore.update(jg.GRP,"currentGroupCounters",i)),o=o.map((e=>(e.groupID===s&&(e.groupCounters=Object.assign(Object.assign({},e.groupCounters),{[a]:r})),e))),t.TUIStore.update(jg.GRP,"groupList",o)}onMessageReceived(e){const t=this.getEngine(),n=[];e.forEach((e=>{if(e.type===t.TYPES.MSG_GRP_TIP){const{payload:n}=e,{operationType:i,userIDList:o}=n;switch(i){case t.TYPES.GRP_TIP_MBR_JOIN:this.addMemberList(o);break;case t.TYPES.GRP_TIP_MBR_QUIT:case t.TYPES.GRP_TIP_MBR_KICKED_OUT:this.removeMemberList(o);break;case t.TYPES.GRP_TIP_MBR_SET_ADMIN:case t.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:this.updateGroupMember(o);break;case t.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:break;case t.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:case t.TYPES.GRP_TIP_BAN_AVCHATROOM_MEMBER:case t.TYPES.GRP_TIP_UNBAN_AVCHATROOM_MEMBER:this.updateGroupMember(o)}}e.type===t.TYPES.MSG_GRP_SYS_NOTICE&&n.push(e)})),n.length>0&&t.TUIStore.update(jg.GRP,"groupSystemNoticeList",n)}getGroupInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getGroupList().then((e=>{const{groupList:t=[]}=e.data;console.log(`TUIGroupService.init, getGroupList count:${t.length}`),t.length>0&&this.onGroupListUpdated(t)}))}updateGroupMember(e){return Bg(this,void 0,void 0,(function*(){const t=this.getEngine().TUIStore.getData(jg.GRP,"currentGroupID");if(t){const n=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:i}=n.data;this.updateMemberList(i)}}))}resetCurrentStore(){this.getEngine().TUIStore.reset(jg.GRP,["currentGroupID","currentGroup","currentGroupAttributes","currentGroupCounters","currentGroupMemberList"],!0)}switchGroup(e){return Bg(this,void 0,void 0,(function*(){const t=this.getEngine();t.TUIStore.update(jg.GRP,"offset",0),t.TUIStore.update(jg.GRP,"isCompleted",!1);const n=t.TUIStore.getConversationModel(`GROUP${e}`);if((null==n?void 0:n.operationType)>0){const e=t.TUIStore.getData(jg.GRP,"currentGroup");return Promise.resolve(e)}const i=t.TUIStore.getData(jg.GRP,"currentGroupID");if(!e)return this.resetCurrentStore(),Promise.resolve({});if(i===e){const e=t.TUIStore.getData(jg.GRP,"currentGroup");return Promise.resolve(e)}this.resetCurrentStore(),t.TUIStore.update(jg.GRP,"currentGroupID",e);try{yield this.getGroupInfo(e)}catch(a){Promise.reject(a)}const o=setTimeout((()=>{this.groupMap.delete(e),clearTimeout(o)}),5e3),s=t.TUIStore.getData(jg.GRP,"currentGroup");return Promise.resolve(s)}))}getGroupInfo(e){return Bg(this,void 0,void 0,(function*(){const t=this.getEngine(),n=this.groupMap.get(e);if(n)return this.updateMemberList((null==n?void 0:n.memberList)||[]),t.TUIStore.update(jg.GRP,"currentGroup",n.group),t.TUIStore.update(jg.GRP,"currentGroupAttributes",n.groupAttributes||{}),void t.TUIStore.update(jg.GRP,"currentGroupCounters",n.counters||{});const i={group:{},memberList:[],groupAttributes:void 0,counters:void 0},{data:{group:o}}=yield this.getGroupProfile({groupID:e});i.group=o;const{data:{memberList:s}}=yield this.getGroupMemberList({groupID:e});i.memberList=s;const a=yield this.getGroupAttributes({groupID:e,keyList:[]}),{groupAttributes:r}=a.data;i.groupAttributes=r,t.TUIStore.update(jg.GRP,"currentGroupAttributes",r);try{const n=yield this.getGroupCounters({groupID:e,keyList:[]}),{counters:o}=n.data;i.counters=o,t.TUIStore.update(jg.GRP,"currentGroupCounters",o)}catch(c){console.warn(null==c?void 0:c.message)}this.groupMap.set(e,i)}))}getGroupProfile(e){const t=this.getEngine();return t.chat.getGroupProfile(e).then((n=>Bg(this,void 0,void 0,(function*(){if(t.TUIStore.getData(jg.GRP,"currentGroupID")===e.groupID){const{group:e}=n.data;t.TUIStore.update(jg.GRP,"currentGroup",e)}return n}))))}updateGroupProfile(e){return this.getEngine().chat.updateGroupProfile(e)}createGroup(e){return this.getEngine().chat.createGroup(e)}dismissGroup(e){return this.getEngine().chat.dismissGroup(e)}searchGroupByID(e){const t=this.getEngine();return t.chat.searchGroupByID(e).then((e=>{const{group:n}=e.data,i=t.TUIStore.getData(jg.GRP,"groupList");return e.data.group.isJoinedGroup=i.some((e=>e.groupID===n.groupID)),e}))}joinGroup(e){return this.getEngine().chat.joinGroup(e)}quitGroup(e){return this.getEngine().chat.quitGroup(e)}getGroupApplicationList(){return this.getEngine().chat.getGroupApplicationList()}handleGroupApplication(e){return this.getEngine().chat.handleGroupApplication(e)}getGroupOnlineMemberCount(e){return this.getEngine().chat.getGroupOnlineMemberCount(e)}changeGroupOwner(e){return this.getEngine().chat.changeGroupOwner(e)}initGroupAttributes(e){return this.getEngine().chat.initGroupAttributes(e)}setGroupAttributes(e){return this.getEngine().chat.setGroupAttributes(e)}deleteGroupAttributes(e){return this.getEngine().chat.deleteGroupAttributes(e)}getGroupAttributes(e){return this.getEngine().chat.getGroupAttributes(e)}setGroupCounters(e){return this.getEngine().chat.setGroupCounters(e)}increaseGroupCounter(e){return this.getEngine().chat.increaseGroupCounter(e)}decreaseGroupCounter(e){return this.getEngine().chat.decreaseGroupCounter(e)}getGroupCounters(e){return this.getEngine().chat.getGroupCounters(e)}updateMemberList(e){const t=this.getEngine(),n=[...(t.TUIStore.getData(jg.GRP,"currentGroupMemberList")||[]).filter((t=>!e.find((e=>e.userID===t.userID)))),...e];t.TUIStore.update(jg.GRP,"currentGroupMemberList",n)}addMemberList(e){return Bg(this,void 0,void 0,(function*(){const t=this.getEngine().TUIStore.getData(jg.GRP,"currentGroupID");if(t)try{const n=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:i}=n.data;this.updateMemberList(i)}catch(n){const t=e.map((e=>({userID:e,avatar:"",nick:"",role:"",joinTime:0,nameCard:"",muteUntil:0,memberCustomField:[]})));this.updateMemberList(t)}}))}removeMemberList(e){const t=this.getEngine(),n=t.TUIStore.getData(jg.GRP,"currentGroupMemberList").filter((t=>-1===e.indexOf(t.userID)));t.TUIStore.update(jg.GRP,"currentGroupMemberList",n)}getGroupMemberList(e){const t=this.getEngine();if(Qg(e.offset)){const n=t.TUIStore.getData(jg.GRP,"offset");e.offset=n}return t.chat.getGroupMemberList(e).then((n=>{if(t.TUIStore.getData(jg.GRP,"currentGroupID")===e.groupID){const{memberList:e,offset:i=0}=n.data;this.updateMemberList(e),t.TUIStore.update(jg.GRP,"offset",i),0===i&&t.TUIStore.update(jg.GRP,"isCompleted",!0)}return n}))}getGroupMemberProfile(e){return this.getEngine().chat.getGroupMemberProfile(e)}addGroupMember(e){const t=this.getEngine();return t.chat.addGroupMember(e).then((n=>Bg(this,void 0,void 0,(function*(){if(t.TUIStore.getData(jg.GRP,"currentGroupID")===e.groupID){const{successUserIDList:e,group:i}=n.data;t.TUIStore.update(jg.GRP,"currentGroup",i),this.addMemberList(e)}return n}))))}deleteGroupMember(e){const t=this.getEngine();return t.chat.deleteGroupMember(e).then((n=>{if(t.TUIStore.getData(jg.GRP,"currentGroupID")===e.groupID){const{userIDList:e,group:i}=n.data;this.removeMemberList(e),t.TUIStore.update(jg.GRP,"currentGroup",i)}return n}))}setGroupMemberMuteTime(e){return this.getEngine().chat.setGroupMemberMuteTime(e)}setGroupMemberRole(e){return this.getEngine().chat.setGroupMemberRole(e)}setGroupMemberNameCard(e){return this.getEngine().chat.setGroupMemberNameCard(e)}setGroupMemberCustomField(e){return this.getEngine().chat.setGroupMemberCustomField(e)}markGroupMemberList(e){return this.getEngine().chat.markGroupMemberList(e)}}class a_ extends Tf{constructor(){super()}static getInstance(){return a_.instance||(a_.instance=new a_),a_.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated.bind(this)),this.getFriendInitData()}onFriendListUpdated(e){this.getEngine().TUIStore.update(jg.FRIEND,"friendList",e)}onFriendApplicationListUpdated(e){const{friendApplicationList:t,unreadCount:n=0}=e,i=this.getEngine();i.TUIStore.update(jg.FRIEND,"friendApplicationList",t),i.TUIStore.update(jg.FRIEND,"friendApplicationUnreadCount",n)}getFriendInitData(){const e=this.getEngine();e.chat.isReady()&&(e.chat.getFriendList().then((e=>{const t=e.data||[];console.log(`TUIFriendService.init, getFriendList count:${t.length}`),t.length>0&&this.onFriendListUpdated(t)})),e.chat.getFriendApplicationList().then((e=>{this.onFriendApplicationListUpdated(e.data)})))}getFriendList(){return this.getEngine().chat.getFriendList()}getFriendRemark(e){const t=this.getEngine().TUIStore.getData(jg.FRIEND,"friendList"),n={};return e.forEach((e=>{for(let i=0;i0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}run(e){return this.middlewares=this.cache.map((e=>e)),this.options=e,this.next()}}function u_(e,t,n){const i=Object.create(null);Object.keys(n).forEach((n=>{if(!t[n])return;i[n]=t[n];const o=new c_;t[n]=function(){const s=Array.from(arguments);return o.use(((t,i)=>e.isInited?i():Promise.reject({code:Yg.NOT_INIT,message:`${n} | ${Jg.NOT_INIT}`}))).use((e=>i[n].apply(t,e))),o.run(s)}}))}console.log("TUIChatEngine.VERSION:2.4.4");const l_=Cf.getInstance();Mf.getInstance();const d_=Gf.getInstance(),p_=zm.getInstance(),h_=Wm.getInstance(),g_=e_.getInstance(),f_=o_.getInstance(),m_=s_.getInstance(),__=a_.getInstance(),v_=r_.getInstance();l_.mount(Vg.TUIStore,d_),l_.mount(Vg.TUITranslate,p_),l_.mount(Vg.TUIConversation,h_),l_.mount(Vg.TUIUser,g_),l_.mount(Vg.TUIChat,f_),l_.mount(Vg.TUIGroup,m_),l_.mount(Vg.TUIFriend,__),l_.mount(Vg.TUIReport,v_),u_(l_,l_,Xg),u_(l_,h_,{deleteConversation:1,pinConversation:1,muteConversation:1,switchConversation:1,getConversationProfile:1,clearHistoryMessage:1}),u_(l_,f_,{modifyMessage:1,revokeMessage:1,resendMessage:1,deleteMessage:1,quoteMessage:1,replyMessage:1,setMessageExtensions:1,deleteMessageExtensions:1,getMessageExtensions:1,sendTextMessage:1,sendTextAtMessage:1,sendImageMessage:1,sendAudioMessage:1,sendVideoMessage:1,sendFileMessage:1,sendCustomMessage:1,sendFaceMessage:1,sendLocationMessage:1,sendForwardMessage:1,enterTypingState:1,leaveTypingState:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageList:1,downloadMergedMessages:1,setTranslationLanguage:1,translateText:1,searchCloudMessages:1,addMessageReaction:1,removeMessageReaction:1,getMessageReactions:1,getAllUserListOfMessageReaction:1}),u_(l_,m_,{switchGroup:1,getGroupProfile:1,updateGroupProfile:1,createGroup:1,dismissGroup:1,searchGroupByID:1,joinGroup:1,quitGroup:1,getGroupApplicationList:1,handleGroupApplication:1,getGroupOnlineMemberCount:1,changeGroupOwner:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getGroupMemberList:1,getGroupMemberProfile:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberNameCard:1,setGroupMemberCustomField:1,markGroupMemberList:1}),u_(l_,g_,{switchUserStatus:1,switchMessageReadStatus:1,getUserProfile:1,updateMyProfile:1,addToBlacklist:1,removeFromBlacklist:1}),u_(l_,__,{getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,getFriendProfile:1,updateFriend:1,acceptFriendApplication:1,refuseFriendApplication:1,deleteFriendApplication:1,setFriendApplicationRead:1}),u_(l_,v_,Xg),exports.COS=Lg,exports._export_sfc=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},exports.createPinia=function(){const e=xn(!0),t=e.run((()=>io({})));let n=[],i=[];const o=Ji({install(e){Lr(o),o._a=e,e.provide(Pr,o),e.config.globalProperties.$pinia=o,i.forEach((e=>n.push(e))),i=[]},use(e){return this._a?n.push(e):i.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o},exports.createSSRApp=ja,exports.defineStore=function(e,t,n){let i,o;const s="function"==typeof t;function a(e,n){(e=e||(!!(qs||wo||Wo)?Yo(Pr,null):null))&&Lr(e),(e=Ar)._s.has(i)||(s?Kr(i,t,o,e):Hr(i,o,e));return e._s.get(i)}return"string"==typeof e?(i=e,o=s?n:t):(o=e,i=e.id),a.$id=i,a},exports.e=(e,...t)=>r(e,...t),exports.f=(e,t)=>function(e,t){let n;if(d(e)||f(e)){n=new Array(e.length);for(let i=0,o=e.length;it(e,n,n)));else{const i=Object.keys(e);n=new Array(i.length);for(let o=0,s=i.length;o{if("function"!=typeof getApp)s=function(e,t){return o.t(e,t)};else{let e=!1;s=function(t,n){const i=getApp().$vm;return i&&(i.$locale,e||(e=!0,function(e,t){e.$watchLocale?e.$watchLocale((e=>{t.setLocale(e)})):e.$watch((()=>e.$locale),(e=>{t.setLocale(e)}))}(i,o))),o.t(t,n)}}return s(e,t)};return{i18n:o,f:(e,t,n)=>o.f(e,t,n),t:(e,t)=>s(e,t),add:(e,t,n=!0)=>o.add(e,t,n),watch:e=>o.watchLocale(e),getLocale:()=>o.getLocale(),setLocale:e=>o.setLocale(e)}},exports.jo=Rg,exports.n=e=>F(e),exports.o=(e,t)=>qa(e,t),exports.onMounted=ns,exports.p=e=>function(e){const{uid:t,__counter:n}=Vs();return t+","+((Ua[t]||(Ua[t]=[])).push(Gs(e))-1)+","+n}(e),exports.reactive=ji,exports.ref=io,exports.resolveComponent=function(e,t){return function(e,t,n=!0,i=!1){const o=wo||qs;if(o){const n=o.type;if(e===Go){const e=function(e,t=!0){return g(e)?e.displayName||e.name:e.name||t&&e.__name}(n,!1);if(e&&(e===t||e===k(t)||e===O(k(t))))return n}const s=xo(o[e]||n[e],t)||xo(o.appContext[e],t);return!s&&i?n:s}}(Go,e,!0,t)||e},exports.s=e=>Ba(e),exports.sr=(e,t,n)=>function(e,t,n={}){const{$templateRefs:i}=Vs();i.push({i:t,r:e,k:n.k,f:n.f})}(e,t,n),exports.t=e=>(e=>f(e)?e:null==e?"":d(e)||_(e)&&(e.toString===y||!g(e.toString))?JSON.stringify(e,B,2):String(e))(e),exports.unref=so,exports.wx$1=Pn;