module.exports = (function() {
var __MODS__ = {};
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
__DEFINE__(1676686826085, function(require, module, exports) {
/**
 * 
 *   Version: 0.12.1
 * 
 *   Git Hash: 0472a2784c9d5d24b994d1ff719440ce8c5124fe
 * 
 *   Created At: 2023/2/15 下午8:07:15
 * 
 *   Target: NIM_BROWSER_SDK.js
 *   
 */

!function(t,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):(t="undefined"!=typeof globalThis?globalThis:t||self).NIM=a()}(this,(function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function createCommonjsModule(t){var a={exports:{}};return t(a,a.exports),a.exports}var a,o,c=getDefaultExportFromCjs(createCommonjsModule((function(t){t.exports=function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports.default=t.exports}))),check=function(t){return t&&t.Math==Math&&t},m=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof t&&t)||function(){return this}()||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},h=!fails((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),v=Function.prototype,b=v.apply,S=v.call,T="object"==typeof Reflect&&Reflect.apply||(h?S.bind(b):function(){return S.apply(b,arguments)}),M=Function.prototype,w=M.bind,_=M.call,x=h&&w.bind(_,_),k=h?function(t){return t&&x(t)}:function(t){return t&&function(){return _.apply(t,arguments)}},isCallable=function(t){return"function"==typeof t},I=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),C=Function.prototype.call,E=h?C.bind(C):function(){return C.apply(C,arguments)},A={}.propertyIsEnumerable,P=Object.getOwnPropertyDescriptor,O={f:P&&!A.call({1:2},1)?function propertyIsEnumerable(t){var a=P(this,t);return!!a&&a.enumerable}:A},createPropertyDescriptor=function(t,a){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:a}},R=k({}.toString),j=k("".slice),classofRaw=function(t){return j(R(t),8,-1)},L=Object,N=k("".split),U=fails((function(){return!L("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?N(t,""):L(t)}:L,isNullOrUndefined=function(t){return null==t},B=TypeError,requireObjectCoercible=function(t){if(isNullOrUndefined(t))throw B("Can't call method on "+t);return t},toIndexedObject=function(t){return U(requireObjectCoercible(t))},q="object"==typeof document&&document.all,D=void 0===q&&void 0!==q?function(t){return"object"==typeof t?null!==t:isCallable(t)||t===q}:function(t){return"object"==typeof t?null!==t:isCallable(t)},H={},aFunction=function(t){return isCallable(t)?t:void 0},getBuiltIn=function(t,a){return arguments.length<2?aFunction(H[t])||aFunction(m[t]):H[t]&&H[t][a]||m[t]&&m[t][a]},z=k({}.isPrototypeOf),$=getBuiltIn("navigator","userAgent")||"",G=m.process,K=m.Deno,W=G&&G.versions||K&&K.version,V=W&&W.v8;V&&(o=(a=V.split("."))[0]>0&&a[0]<4?1:+(a[0]+a[1])),!o&&$&&(!(a=$.match(/Edge\/(\d+)/))||a[1]>=74)&&(a=$.match(/Chrome\/(\d+)/))&&(o=+a[1]);var J,X=o,Y=!!Object.getOwnPropertySymbols&&!fails((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&X&&X<41})),Q=Y&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Z=Object,ee=Q?function(t){return"symbol"==typeof t}:function(t){var a=getBuiltIn("Symbol");return isCallable(a)&&z(a.prototype,Z(t))},te=String,tryToString=function(t){try{return te(t)}catch(t){return"Object"}},re=TypeError,aCallable=function(t){if(isCallable(t))return t;throw re(tryToString(t)+" is not a function")},getMethod=function(t,a){var o=t[a];return isNullOrUndefined(o)?void 0:aCallable(o)},ne=TypeError,ie=Object.defineProperty,ae="__core-js_shared__",oe=m[ae]||function(t,a){try{ie(m,t,{value:a,configurable:!0,writable:!0})}catch(o){m[t]=a}return a}(ae,{}),se=createCommonjsModule((function(t){(t.exports=function(t,a){return oe[t]||(oe[t]=void 0!==a?a:{})})("versions",[]).push({version:"3.25.0",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.25.0/LICENSE",source:"https://github.com/zloirock/core-js"})})),ce=Object,toObject=function(t){return ce(requireObjectCoercible(t))},ue=k({}.hasOwnProperty),le=Object.hasOwn||function hasOwn(t,a){return ue(toObject(t),a)},pe=0,de=Math.random(),me=k(1..toString),uid=function(t){return"Symbol("+(void 0===t?"":t)+")_"+me(++pe+de,36)},fe=se("wks"),ge=m.Symbol,ye=ge&&ge.for,he=Q?ge:ge&&ge.withoutSetter||uid,wellKnownSymbol=function(t){if(!le(fe,t)||!Y&&"string"!=typeof fe[t]){var a="Symbol."+t;Y&&le(ge,t)?fe[t]=ge[t]:fe[t]=Q&&ye?ye(a):he(a)}return fe[t]},ve=TypeError,be=wellKnownSymbol("toPrimitive"),toPrimitive=function(t,a){if(!D(t)||ee(t))return t;var o,c=getMethod(t,be);if(c){if(void 0===a&&(a="default"),o=E(c,t,a),!D(o)||ee(o))return o;throw ve("Can't convert object to primitive value")}return void 0===a&&(a="number"),function(t,a){var o,c;if("string"===a&&isCallable(o=t.toString)&&!D(c=E(o,t)))return c;if(isCallable(o=t.valueOf)&&!D(c=E(o,t)))return c;if("string"!==a&&isCallable(o=t.toString)&&!D(c=E(o,t)))return c;throw ne("Can't convert object to primitive value")}(t,a)},toPropertyKey=function(t){var a=toPrimitive(t,"string");return ee(a)?a:a+""},Se=m.document,Te=D(Se)&&D(Se.createElement),documentCreateElement=function(t){return Te?Se.createElement(t):{}},Me=!I&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),we=Object.getOwnPropertyDescriptor,_e={f:I?we:function getOwnPropertyDescriptor(t,a){if(t=toIndexedObject(t),a=toPropertyKey(a),Me)try{return we(t,a)}catch(t){}if(le(t,a))return createPropertyDescriptor(!E(O.f,t,a),t[a])}},xe=/#|\.prototype\./,isForced=function(t,a){var o=Ie[ke(t)];return o==Ee||o!=Ce&&(isCallable(a)?fails(a):!!a)},ke=isForced.normalize=function(t){return String(t).replace(xe,".").toLowerCase()},Ie=isForced.data={},Ce=isForced.NATIVE="N",Ee=isForced.POLYFILL="P",Ae=isForced,Pe=k(k.bind),functionBindContext=function(t,a){return aCallable(t),void 0===a?t:h?Pe(t,a):function(){return t.apply(a,arguments)}},Oe=I&&fails((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Re=String,je=TypeError,anObject=function(t){if(D(t))return t;throw je(Re(t)+" is not an object")},Fe=TypeError,Le=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,Ue="enumerable",Be="configurable",qe="writable",De={f:I?Oe?function defineProperty(t,a,o){if(anObject(t),a=toPropertyKey(a),anObject(o),"function"==typeof t&&"prototype"===a&&"value"in o&&qe in o&&!o.writable){var c=Ne(t,a);c&&c.writable&&(t[a]=o.value,o={configurable:Be in o?o.configurable:c.configurable,enumerable:Ue in o?o.enumerable:c.enumerable,writable:!1})}return Le(t,a,o)}:Le:function defineProperty(t,a,o){if(anObject(t),a=toPropertyKey(a),anObject(o),Me)try{return Le(t,a,o)}catch(t){}if("get"in o||"set"in o)throw Fe("Accessors not supported");return"value"in o&&(t[a]=o.value),t}},He=I?function(t,a,o){return De.f(t,a,createPropertyDescriptor(1,o))}:function(t,a,o){return t[a]=o,t},ze=_e.f,wrapConstructor=function(t){var Wrapper=function(a,o,c){if(this instanceof Wrapper){switch(arguments.length){case 0:return new t;case 1:return new t(a);case 2:return new t(a,o)}return new t(a,o,c)}return T(t,this,arguments)};return Wrapper.prototype=t.prototype,Wrapper},_export=function(t,a){var o,c,h,v,b,S,T,M,w=t.target,_=t.global,x=t.stat,I=t.proto,C=_?m:x?m[w]:(m[w]||{}).prototype,E=_?H:H[w]||He(H,w,{})[w],A=E.prototype;for(h in a)o=!Ae(_?h:w+(x?".":"#")+h,t.forced)&&C&&le(C,h),b=E[h],o&&(S=t.dontCallGetSet?(M=ze(C,h))&&M.value:C[h]),v=o&&S?S:a[h],o&&typeof b==typeof v||(T=t.bind&&o?functionBindContext(v,m):t.wrap&&o?wrapConstructor(v):I&&isCallable(v)?k(v):v,(t.sham||v&&v.sham||b&&b.sham)&&He(T,"sham",!0),He(E,h,T),I&&(le(H,c=w+"Prototype")||He(H,c,{}),He(H[c],h,v),t.real&&A&&!A[h]&&He(A,h,v)))},$e=Math.ceil,Ge=Math.floor,Ke=Math.trunc||function trunc(t){var a=+t;return(a>0?Ge:$e)(a)},toIntegerOrInfinity=function(t){var a=+t;return a!=a||0===a?0:Ke(a)},We=Math.max,Ve=Math.min,toAbsoluteIndex=function(t,a){var o=toIntegerOrInfinity(t);return o<0?We(o+a,0):Ve(o,a)},Je=Math.min,lengthOfArrayLike=function(t){return(a=t.length)>0?Je(toIntegerOrInfinity(a),9007199254740991):0;var a},createMethod$4=function(t){return function(a,o,c){var m,h=toIndexedObject(a),v=lengthOfArrayLike(h),b=toAbsoluteIndex(c,v);if(t&&o!=o){for(;v>b;)if((m=h[b++])!=m)return!0}else for(;v>b;b++)if((t||b in h)&&h[b]===o)return t||b||0;return!t&&-1}},Xe={includes:createMethod$4(!0),indexOf:createMethod$4(!1)},Ye={},Qe=Xe.indexOf,Ze=k([].push),objectKeysInternal=function(t,a){var o,c=toIndexedObject(t),m=0,h=[];for(o in c)!le(Ye,o)&&le(c,o)&&Ze(h,o);for(;a.length>m;)le(c,o=a[m++])&&(~Qe(h,o)||Ze(h,o));return h},et=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],rt=Object.keys||function keys(t){return objectKeysInternal(t,et)},nt=I&&!Oe?Object.defineProperties:function defineProperties(t,a){anObject(t);for(var o,c=toIndexedObject(a),m=rt(a),h=m.length,v=0;h>v;)De.f(t,o=m[v++],c[o]);return t},it={f:nt},at=getBuiltIn("document","documentElement"),ot=se("keys"),sharedKey=function(t){return ot[t]||(ot[t]=uid(t))},st=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"</"+"script>"},NullProtoObjectViaActiveX=function(t){t.write(scriptTag("")),t.close();var a=t.parentWindow.Object;return t=null,a},NullProtoObject=function(){try{J=new ActiveXObject("htmlfile")}catch(t){}var t,a;NullProtoObject="undefined"!=typeof document?document.domain&&J?NullProtoObjectViaActiveX(J):((a=documentCreateElement("iframe")).style.display="none",at.appendChild(a),a.src=String("javascript:"),(t=a.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F):NullProtoObjectViaActiveX(J);for(var o=et.length;o--;)delete NullProtoObject.prototype[et[o]];return NullProtoObject()};Ye[st]=!0;var ct=Object.create||function create(t,a){var o;return null!==t?(EmptyConstructor.prototype=anObject(t),o=new EmptyConstructor,EmptyConstructor.prototype=null,o[st]=t):o=NullProtoObject(),void 0===a?o:it.f(o,a)};_export({target:"Object",stat:!0,sham:!I},{create:ct});var ut=H.Object,lt=function create(t,a){return ut.create(t,a)},pt=String,dt=TypeError,mt=Object.setPrototypeOf||("__proto__"in{}?function(){var t,a=!1,o={};try{(t=k(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(o,[]),a=o instanceof Array}catch(t){}return function setPrototypeOf(o,c){return anObject(o),function(t){if("object"==typeof t||isCallable(t))return t;throw dt("Can't set "+pt(t)+" as a prototype")}(c),a?t(o,c):o.__proto__=c,o}}():void 0);_export({target:"Object",stat:!0},{setPrototypeOf:mt});var ft=H.Object.setPrototypeOf,gt=k([].slice),yt=Function,ht=k([].concat),vt=k([].join),bt={},construct$8=function(t,a,o){if(!le(bt,a)){for(var c=[],m=0;m<a;m++)c[m]="a["+m+"]";bt[a]=yt("C,a","return new C("+vt(c,",")+")")}return bt[a](t,o)},St=h?yt.bind:function bind(t){var a=aCallable(this),o=a.prototype,c=gt(arguments,1),m=function bound(){var o=ht(c,gt(arguments));return this instanceof m?construct$8(a,o.length,o):a.apply(t,o)};return D(o)&&(m.prototype=o),m};_export({target:"Function",proto:!0,forced:Function.bind!==St},{bind:St});var entryVirtual=function(t){return H[t+"Prototype"]},Tt=entryVirtual("Function").bind,Mt=Function.prototype,bind$1=function(t){var a=t.bind;return t===Mt||z(Mt,t)&&a===Mt.bind?Tt:a},wt=createCommonjsModule((function(t){function _setPrototypeOf(a,o){var c;return t.exports=_setPrototypeOf=ft?bind$1(c=ft).call(c):function _setPrototypeOf(t,a){return t.__proto__=a,t},t.exports.__esModule=!0,t.exports.default=t.exports,_setPrototypeOf(a,o)}t.exports=_setPrototypeOf,t.exports.__esModule=!0,t.exports.default=t.exports})),_t=getDefaultExportFromCjs(createCommonjsModule((function(t){t.exports=function _inheritsLoose(t,a){t.prototype=lt(a.prototype),t.prototype.constructor=t,wt(t,a)},t.exports.__esModule=!0,t.exports.default=t.exports}))),xt=Array.isArray||function isArray(t){return"Array"==classofRaw(t)},kt=TypeError,doesNotExceedSafeInteger=function(t){if(t>9007199254740991)throw kt("Maximum allowed index exceeded");return t},createProperty=function(t,a,o){var c=toPropertyKey(a);c in t?De.f(t,c,createPropertyDescriptor(0,o)):t[c]=o},It={};It[wellKnownSymbol("toStringTag")]="z";var Ct="[object z]"===String(It),Et=wellKnownSymbol("toStringTag"),At=Object,Pt="Arguments"==classofRaw(function(){return arguments}()),Ot=Ct?classofRaw:function(t){var a,o,c;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(o=function(t,a){try{return t[a]}catch(t){}}(a=At(t),Et))?o:Pt?classofRaw(a):"Object"==(c=classofRaw(a))&&isCallable(a.callee)?"Arguments":c},Rt=k(Function.toString);isCallable(oe.inspectSource)||(oe.inspectSource=function(t){return Rt(t)});var jt=oe.inspectSource,noop$1=function(){},Ft=[],Lt=getBuiltIn("Reflect","construct"),Nt=/^\s*(?:class|function)\b/,Ut=k(Nt.exec),Bt=!Nt.exec(noop$1),qt=function isConstructor(t){if(!isCallable(t))return!1;try{return Lt(noop$1,Ft,t),!0}catch(t){return!1}},Dt=function isConstructor(t){if(!isCallable(t))return!1;switch(Ot(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Bt||!!Ut(Nt,jt(t))}catch(t){return!0}};Dt.sham=!0;var Ht=!Lt||fails((function(){var t;return qt(qt.call)||!qt(Object)||!qt((function(){t=!0}))||t}))?Dt:qt,zt=wellKnownSymbol("species"),$t=Array,arraySpeciesCreate=function(t,a){return new(function(t){var a;return xt(t)&&(a=t.constructor,(Ht(a)&&(a===$t||xt(a.prototype))||D(a)&&null===(a=a[zt]))&&(a=void 0)),void 0===a?$t:a}(t))(0===a?0:a)},Gt=wellKnownSymbol("species"),arrayMethodHasSpeciesSupport=function(t){return X>=51||!fails((function(){var a=[];return(a.constructor={})[Gt]=function(){return{foo:1}},1!==a[t](Boolean).foo}))},Kt=wellKnownSymbol("isConcatSpreadable"),Wt=X>=51||!fails((function(){var t=[];return t[Kt]=!1,t.concat()[0]!==t})),Vt=arrayMethodHasSpeciesSupport("concat"),isConcatSpreadable=function(t){if(!D(t))return!1;var a=t[Kt];return void 0!==a?!!a:xt(t)};_export({target:"Array",proto:!0,arity:1,forced:!Wt||!Vt},{concat:function concat(t){var a,o,c,m,h,v=toObject(this),b=arraySpeciesCreate(v,0),S=0;for(a=-1,c=arguments.length;a<c;a++)if(isConcatSpreadable(h=-1===a?v:arguments[a]))for(m=lengthOfArrayLike(h),doesNotExceedSafeInteger(S+m),o=0;o<m;o++,S++)o in h&&createProperty(b,S,h[o]);else doesNotExceedSafeInteger(S+1),createProperty(b,S++,h);return b.length=S,b}});var Jt,Xt,Yt,Qt=String,toString$1=function(t){if("Symbol"===Ot(t))throw TypeError("Cannot convert a Symbol value to a string");return Qt(t)},Zt=et.concat("length","prototype"),er={f:Object.getOwnPropertyNames||function getOwnPropertyNames(t){return objectKeysInternal(t,Zt)}},tr=Array,rr=Math.max,arraySliceSimple=function(t,a,o){for(var c=lengthOfArrayLike(t),m=toAbsoluteIndex(a,c),h=toAbsoluteIndex(void 0===o?c:o,c),v=tr(rr(h-m,0)),b=0;m<h;m++,b++)createProperty(v,b,t[m]);return v.length=b,v},nr=er.f,ir="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],ar={f:function getOwnPropertyNames(t){return ir&&"Window"==classofRaw(t)?function(t){try{return nr(t)}catch(t){return arraySliceSimple(ir)}}(t):nr(toIndexedObject(t))}},or={f:Object.getOwnPropertySymbols},defineBuiltIn=function(t,a,o,c){return c&&c.enumerable?t[a]=o:He(t,a,o),t},sr={f:wellKnownSymbol},cr=De.f,wellKnownSymbolDefine=function(t){var a=H.Symbol||(H.Symbol={});le(a,t)||cr(a,t,{value:sr.f(t)})},symbolDefineToPrimitive=function(){var t=getBuiltIn("Symbol"),a=t&&t.prototype,o=a&&a.valueOf,c=wellKnownSymbol("toPrimitive");a&&!a[c]&&defineBuiltIn(a,c,(function(t){return E(o,this)}),{arity:1})},ur=Ct?{}.toString:function toString(){return"[object "+Ot(this)+"]"},lr=De.f,pr=wellKnownSymbol("toStringTag"),setToStringTag=function(t,a,o,c){if(t){var m=o?t:t.prototype;le(m,pr)||lr(m,pr,{configurable:!0,value:a}),c&&!Ct&&He(m,"toString",ur)}},dr=m.WeakMap,mr=isCallable(dr)&&/native code/.test(String(dr)),fr="Object already initialized",gr=m.TypeError,yr=m.WeakMap;if(mr||oe.state){var hr=oe.state||(oe.state=new yr),vr=k(hr.get),br=k(hr.has),Sr=k(hr.set);Jt=function(t,a){if(br(hr,t))throw gr(fr);return a.facade=t,Sr(hr,t,a),a},Xt=function(t){return vr(hr,t)||{}},Yt=function(t){return br(hr,t)}}else{var Tr=sharedKey("state");Ye[Tr]=!0,Jt=function(t,a){if(le(t,Tr))throw gr(fr);return a.facade=t,He(t,Tr,a),a},Xt=function(t){return le(t,Tr)?t[Tr]:{}},Yt=function(t){return le(t,Tr)}}var Mr={set:Jt,get:Xt,has:Yt,enforce:function(t){return Yt(t)?Xt(t):Jt(t,{})},getterFor:function(t){return function(a){var o;if(!D(a)||(o=Xt(a)).type!==t)throw gr("Incompatible receiver, "+t+" required");return o}}},wr=k([].push),createMethod$3=function(t){var a=1==t,o=2==t,c=3==t,m=4==t,h=6==t,v=7==t,b=5==t||h;return function(S,T,M,w){for(var _,x,k=toObject(S),I=U(k),C=functionBindContext(T,M),E=lengthOfArrayLike(I),A=0,P=w||arraySpeciesCreate,O=a?P(S,E):o||v?P(S,0):void 0;E>A;A++)if((b||A in I)&&(x=C(_=I[A],A,k),t))if(a)O[A]=x;else if(x)switch(t){case 3:return!0;case 5:return _;case 6:return A;case 2:wr(O,_)}else switch(t){case 4:return!1;case 7:wr(O,_)}return h?-1:c||m?m:O}},_r={forEach:createMethod$3(0),map:createMethod$3(1),filter:createMethod$3(2),some:createMethod$3(3),every:createMethod$3(4),find:createMethod$3(5),findIndex:createMethod$3(6),filterReject:createMethod$3(7)},xr=_r.forEach,kr=sharedKey("hidden"),Ir="Symbol",Cr=Mr.set,Er=Mr.getterFor(Ir),Ar=Object.prototype,Pr=m.Symbol,Or=Pr&&Pr.prototype,Rr=m.TypeError,jr=m.QObject,Fr=_e.f,Lr=De.f,Nr=ar.f,Ur=O.f,Br=k([].push),qr=se("symbols"),Dr=se("op-symbols"),Hr=se("wks"),zr=!jr||!jr.prototype||!jr.prototype.findChild,$r=I&&fails((function(){return 7!=ct(Lr({},"a",{get:function(){return Lr(this,"a",{value:7}).a}})).a}))?function(t,a,o){var c=Fr(Ar,a);c&&delete Ar[a],Lr(t,a,o),c&&t!==Ar&&Lr(Ar,a,c)}:Lr,wrap$1=function(t,a){var o=qr[t]=ct(Or);return Cr(o,{type:Ir,tag:t,description:a}),I||(o.description=a),o},Gr=function defineProperty(t,a,o){t===Ar&&Gr(Dr,a,o),anObject(t);var c=toPropertyKey(a);return anObject(o),le(qr,c)?(o.enumerable?(le(t,kr)&&t[kr][c]&&(t[kr][c]=!1),o=ct(o,{enumerable:createPropertyDescriptor(0,!1)})):(le(t,kr)||Lr(t,kr,createPropertyDescriptor(1,{})),t[kr][c]=!0),$r(t,c,o)):Lr(t,c,o)},Kr=function defineProperties(t,a){anObject(t);var o=toIndexedObject(a),c=rt(o).concat($getOwnPropertySymbols(o));return xr(c,(function(a){I&&!E(Wr,o,a)||Gr(t,a,o[a])})),t},Wr=function propertyIsEnumerable(t){var a=toPropertyKey(t),o=E(Ur,this,a);return!(this===Ar&&le(qr,a)&&!le(Dr,a))&&(!(o||!le(this,a)||!le(qr,a)||le(this,kr)&&this[kr][a])||o)},Vr=function getOwnPropertyDescriptor(t,a){var o=toIndexedObject(t),c=toPropertyKey(a);if(o!==Ar||!le(qr,c)||le(Dr,c)){var m=Fr(o,c);return!m||!le(qr,c)||le(o,kr)&&o[kr][c]||(m.enumerable=!0),m}},Jr=function getOwnPropertyNames(t){var a=Nr(toIndexedObject(t)),o=[];return xr(a,(function(t){le(qr,t)||le(Ye,t)||Br(o,t)})),o},$getOwnPropertySymbols=function(t){var a=t===Ar,o=Nr(a?Dr:toIndexedObject(t)),c=[];return xr(o,(function(t){!le(qr,t)||a&&!le(Ar,t)||Br(c,qr[t])})),c};Y||(Pr=function Symbol(){if(z(Or,this))throw Rr("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?toString$1(arguments[0]):void 0,a=uid(t),setter=function(t){this===Ar&&E(setter,Dr,t),le(this,kr)&&le(this[kr],a)&&(this[kr][a]=!1),$r(this,a,createPropertyDescriptor(1,t))};return I&&zr&&$r(Ar,a,{configurable:!0,set:setter}),wrap$1(a,t)},Or=Pr.prototype,defineBuiltIn(Or,"toString",(function toString(){return Er(this).tag})),defineBuiltIn(Pr,"withoutSetter",(function(t){return wrap$1(uid(t),t)})),O.f=Wr,De.f=Gr,it.f=Kr,_e.f=Vr,er.f=ar.f=Jr,or.f=$getOwnPropertySymbols,sr.f=function(t){return wrap$1(wellKnownSymbol(t),t)},I&&Lr(Or,"description",{configurable:!0,get:function description(){return Er(this).description}})),_export({global:!0,constructor:!0,wrap:!0,forced:!Y,sham:!Y},{Symbol:Pr}),xr(rt(Hr),(function(t){wellKnownSymbolDefine(t)})),_export({target:Ir,stat:!0,forced:!Y},{useSetter:function(){zr=!0},useSimple:function(){zr=!1}}),_export({target:"Object",stat:!0,forced:!Y,sham:!I},{create:function create(t,a){return void 0===a?ct(t):Kr(ct(t),a)},defineProperty:Gr,defineProperties:Kr,getOwnPropertyDescriptor:Vr}),_export({target:"Object",stat:!0,forced:!Y},{getOwnPropertyNames:Jr}),symbolDefineToPrimitive(),setToStringTag(Pr,Ir),Ye[kr]=!0;var Xr=Y&&!!Symbol.for&&!!Symbol.keyFor,Yr=se("string-to-symbol-registry"),Qr=se("symbol-to-string-registry");_export({target:"Symbol",stat:!0,forced:!Xr},{for:function(t){var a=toString$1(t);if(le(Yr,a))return Yr[a];var o=getBuiltIn("Symbol")(a);return Yr[a]=o,Qr[o]=a,o}});var Zr=se("symbol-to-string-registry");_export({target:"Symbol",stat:!0,forced:!Xr},{keyFor:function keyFor(t){if(!ee(t))throw TypeError(tryToString(t)+" is not a symbol");if(le(Zr,t))return Zr[t]}});var en=getBuiltIn("JSON","stringify"),tn=k(/./.exec),rn=k("".charAt),nn=k("".charCodeAt),an=k("".replace),sn=k(1..toString),cn=/[\uD800-\uDFFF]/g,un=/^[\uD800-\uDBFF]$/,ln=/^[\uDC00-\uDFFF]$/,pn=!Y||fails((function(){var t=getBuiltIn("Symbol")();return"[null]"!=en([t])||"{}"!=en({a:t})||"{}"!=en(Object(t))})),dn=fails((function(){return'"\\udf06\\ud834"'!==en("\udf06\ud834")||'"\\udead"'!==en("\udead")})),stringifyWithSymbolsFix=function(t,a){var o=gt(arguments),c=a;if((D(a)||void 0!==t)&&!ee(t))return xt(a)||(a=function(t,a){if(isCallable(c)&&(a=E(c,this,t,a)),!ee(a))return a}),o[1]=a,T(en,null,o)},fixIllFormed=function(t,a,o){var c=rn(o,a-1),m=rn(o,a+1);return tn(un,t)&&!tn(ln,m)||tn(ln,t)&&!tn(un,c)?"\\u"+sn(nn(t,0),16):t};en&&_export({target:"JSON",stat:!0,arity:3,forced:pn||dn},{stringify:function stringify(t,a,o){var c=gt(arguments),m=T(pn?stringifyWithSymbolsFix:en,null,c);return dn&&"string"==typeof m?an(m,cn,fixIllFormed):m}});var mn=!Y||fails((function(){or.f(1)}));_export({target:"Object",stat:!0,forced:mn},{getOwnPropertySymbols:function getOwnPropertySymbols(t){var a=or.f;return a?a(toObject(t)):[]}}),wellKnownSymbolDefine("asyncIterator"),wellKnownSymbolDefine("hasInstance"),wellKnownSymbolDefine("isConcatSpreadable"),wellKnownSymbolDefine("iterator"),wellKnownSymbolDefine("match"),wellKnownSymbolDefine("matchAll"),wellKnownSymbolDefine("replace"),wellKnownSymbolDefine("search"),wellKnownSymbolDefine("species"),wellKnownSymbolDefine("split"),wellKnownSymbolDefine("toPrimitive"),symbolDefineToPrimitive(),wellKnownSymbolDefine("toStringTag"),setToStringTag(getBuiltIn("Symbol"),"Symbol"),wellKnownSymbolDefine("unscopables"),setToStringTag(m.JSON,"JSON",!0);var fn,gn,yn,hn=H.Symbol,vn={},bn=Function.prototype,Sn=I&&Object.getOwnPropertyDescriptor,Tn=le(bn,"name"),Mn={EXISTS:Tn,PROPER:Tn&&"something"===function something(){}.name,CONFIGURABLE:Tn&&(!I||I&&Sn(bn,"name").configurable)},wn=!fails((function(){function F(){}return F.prototype.constructor=null,Object.getPrototypeOf(new F)!==F.prototype})),_n=sharedKey("IE_PROTO"),xn=Object,kn=xn.prototype,In=wn?xn.getPrototypeOf:function(t){var a=toObject(t);if(le(a,_n))return a[_n];var o=a.constructor;return isCallable(o)&&a instanceof o?o.prototype:a instanceof xn?kn:null},Cn=wellKnownSymbol("iterator"),En=!1;[].keys&&("next"in(yn=[].keys())?(gn=In(In(yn)))!==Object.prototype&&(fn=gn):En=!0);var An=!D(fn)||fails((function(){var t={};return fn[Cn].call(t)!==t}));fn=An?{}:ct(fn),isCallable(fn[Cn])||defineBuiltIn(fn,Cn,(function(){return this}));var Pn={IteratorPrototype:fn,BUGGY_SAFARI_ITERATORS:En},On=Pn.IteratorPrototype,returnThis$1=function(){return this},Rn=Mn.PROPER,jn=Pn.BUGGY_SAFARI_ITERATORS,Fn=wellKnownSymbol("iterator"),Ln="keys",Nn="values",Un="entries",returnThis=function(){return this},iteratorDefine=function(t,a,o,c,m,h,v){!function(t,a,o,c){var m=a+" Iterator";t.prototype=ct(On,{next:createPropertyDescriptor(+!c,o)}),setToStringTag(t,m,!1,!0),vn[m]=returnThis$1}(o,a,c);var b,S,T,getIterationMethod=function(t){if(t===m&&k)return k;if(!jn&&t in _)return _[t];switch(t){case Ln:return function keys(){return new o(this,t)};case Nn:return function values(){return new o(this,t)};case Un:return function entries(){return new o(this,t)}}return function(){return new o(this)}},M=a+" Iterator",w=!1,_=t.prototype,x=_[Fn]||_["@@iterator"]||m&&_[m],k=!jn&&x||getIterationMethod(m),I="Array"==a&&_.entries||x;if(I&&(b=In(I.call(new t)))!==Object.prototype&&b.next&&(setToStringTag(b,M,!0,!0),vn[M]=returnThis),Rn&&m==Nn&&x&&x.name!==Nn&&(w=!0,k=function values(){return E(x,this)}),m)if(S={values:getIterationMethod(Nn),keys:h?k:getIterationMethod(Ln),entries:getIterationMethod(Un)},v)for(T in S)(jn||w||!(T in _))&&defineBuiltIn(_,T,S[T]);else _export({target:a,proto:!0,forced:jn||w},S);return v&&_[Fn]!==k&&defineBuiltIn(_,Fn,k,{name:m}),vn[a]=k,S};De.f;var Bn="Array Iterator",qn=Mr.set,Dn=Mr.getterFor(Bn);iteratorDefine(Array,"Array",(function(t,a){qn(this,{type:Bn,target:toIndexedObject(t),index:0,kind:a})}),(function(){var t=Dn(this),a=t.target,o=t.kind,c=t.index++;return!a||c>=a.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==o?{value:c,done:!1}:"values"==o?{value:a[c],done:!1}:{value:[c,a[c]],done:!1}}),"values"),vn.Arguments=vn.Array;var Hn=wellKnownSymbol("toStringTag");for(var zn in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var $n=m[zn],Gn=$n&&$n.prototype;Gn&&Ot(Gn)!==Hn&&He(Gn,Hn,zn),vn[zn]=vn.Array}var Kn=hn;wellKnownSymbolDefine("asyncDispose"),wellKnownSymbolDefine("dispose"),wellKnownSymbolDefine("matcher"),wellKnownSymbolDefine("metadataKey"),wellKnownSymbolDefine("observable"),wellKnownSymbolDefine("metadata"),wellKnownSymbolDefine("patternMatch"),wellKnownSymbolDefine("replaceAll");var Wn=Kn,Vn=k("".charAt),Jn=k("".charCodeAt),Xn=k("".slice),createMethod$2=function(t){return function(a,o){var c,m,h=toString$1(requireObjectCoercible(a)),v=toIntegerOrInfinity(o),b=h.length;return v<0||v>=b?t?"":void 0:(c=Jn(h,v))<55296||c>56319||v+1===b||(m=Jn(h,v+1))<56320||m>57343?t?Vn(h,v):c:t?Xn(h,v,v+2):m-56320+(c-55296<<10)+65536}},Yn={codeAt:createMethod$2(!1),charAt:createMethod$2(!0)}.charAt,Qn="String Iterator",Zn=Mr.set,ei=Mr.getterFor(Qn);iteratorDefine(String,"String",(function(t){Zn(this,{type:Qn,string:toString$1(t),index:0})}),(function next(){var t,a=ei(this),o=a.string,c=a.index;return c>=o.length?{value:void 0,done:!0}:(t=Yn(o,c),a.index+=t.length,{value:t,done:!1})}));var ti=sr.f("iterator"),ri=createCommonjsModule((function(t){function _typeof(a){return t.exports=_typeof="function"==typeof Wn&&"symbol"==typeof ti?function(t){return typeof t}:function(t){return t&&"function"==typeof Wn&&t.constructor===Wn&&t!==Wn.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,_typeof(a)}t.exports=_typeof,t.exports.__esModule=!0,t.exports.default=t.exports})),ni=De.f;_export({target:"Object",stat:!0,forced:Object.defineProperty!==ni,sham:!I},{defineProperty:ni});var ii=createCommonjsModule((function(t){var a=H.Object,o=t.exports=function defineProperty(t,o,c){return a.defineProperty(t,o,c)};a.defineProperty.sham&&(o.sham=!0)})),ai=ii,oi=fails((function(){In(1)}));_export({target:"Object",stat:!0,forced:oi,sham:!wn},{getPrototypeOf:function getPrototypeOf(t){return In(toObject(t))}});var si=H.Object.getPrototypeOf,arrayMethodIsStrict=function(t,a){var o=[][t];return!!o&&fails((function(){o.call(null,a||function(){return 1},1)}))},ci=_r.forEach,ui=arrayMethodIsStrict("forEach")?[].forEach:function forEach(t){return ci(this,t,arguments.length>1?arguments[1]:void 0)};_export({target:"Array",proto:!0,forced:[].forEach!=ui},{forEach:ui});var li=entryVirtual("Array").forEach,pi=Array.prototype,di={DOMTokenList:!0,NodeList:!0},forEach$1=function(t){var a=t.forEach;return t===pi||z(pi,t)&&a===pi.forEach||le(di,Ot(t))?li:a},mi=k([].concat),fi=getBuiltIn("Reflect","ownKeys")||function ownKeys(t){var a=er.f(anObject(t)),o=or.f;return o?mi(a,o(t)):a},gi=Error,yi=k("".replace),hi=String(gi("zxcasd").stack),vi=/\n\s*at [^:]*:[^\n]*/,bi=vi.test(hi),errorStackClear=function(t,a){if(bi&&"string"==typeof t&&!gi.prepareStackTrace)for(;a--;)t=yi(t,vi,"");return t},installErrorCause=function(t,a){D(a)&&"cause"in a&&He(t,"cause",a.cause)},Si=wellKnownSymbol("iterator"),Ti=Array.prototype,isArrayIteratorMethod=function(t){return void 0!==t&&(vn.Array===t||Ti[Si]===t)},Mi=wellKnownSymbol("iterator"),getIteratorMethod$5=function(t){if(!isNullOrUndefined(t))return getMethod(t,Mi)||getMethod(t,"@@iterator")||vn[Ot(t)]},wi=TypeError,getIterator=function(t,a){var o=arguments.length<2?getIteratorMethod$5(t):a;if(aCallable(o))return anObject(E(o,t));throw wi(tryToString(t)+" is not iterable")},iteratorClose=function(t,a,o){var c,m;anObject(t);try{if(!(c=getMethod(t,"return"))){if("throw"===a)throw o;return o}c=E(c,t)}catch(t){m=!0,c=t}if("throw"===a)throw o;if(m)throw c;return anObject(c),o},_i=TypeError,Result=function(t,a){this.stopped=t,this.result=a},xi=Result.prototype,iterate=function(t,a,o){var c,m,h,v,b,S,T,M=o&&o.that,w=!(!o||!o.AS_ENTRIES),_=!(!o||!o.IS_RECORD),x=!(!o||!o.IS_ITERATOR),k=!(!o||!o.INTERRUPTED),I=functionBindContext(a,M),stop=function(t){return c&&iteratorClose(c,"normal",t),new Result(!0,t)},callFn=function(t){return w?(anObject(t),k?I(t[0],t[1],stop):I(t[0],t[1])):k?I(t,stop):I(t)};if(_)c=t.iterator;else if(x)c=t;else{if(!(m=getIteratorMethod$5(t)))throw _i(tryToString(t)+" is not iterable");if(isArrayIteratorMethod(m)){for(h=0,v=lengthOfArrayLike(t);v>h;h++)if((b=callFn(t[h]))&&z(xi,b))return b;return new Result(!1)}c=getIterator(t,m)}for(S=_?t.next:c.next;!(T=E(S,c)).done;){try{b=callFn(T.value)}catch(t){iteratorClose(c,"throw",t)}if("object"==typeof b&&b&&z(xi,b))return b}return new Result(!1)},normalizeStringArgument=function(t,a){return void 0===t?arguments.length<2?"":a:toString$1(t)},ki=!fails((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",createPropertyDescriptor(1,7)),7!==t.stack)})),Ii=wellKnownSymbol("toStringTag"),Ci=Error,Ei=[].push,Ai=function AggregateError(t,a){var o,c=arguments.length>2?arguments[2]:void 0,m=z(Pi,this);mt?o=mt(Ci(),m?In(this):Pi):(o=m?this:ct(Pi),He(o,Ii,"Error")),void 0!==a&&He(o,"message",normalizeStringArgument(a)),ki&&He(o,"stack",errorStackClear(o.stack,1)),installErrorCause(o,c);var h=[];return iterate(t,Ei,{that:h}),He(o,"errors",h),o};mt?mt(Ai,Ci):function(t,a,o){for(var c=fi(a),m=De.f,h=_e.f,v=0;v<c.length;v++){var b=c[v];le(t,b)||o&&le(o,b)||m(t,b,h(a,b))}}(Ai,Ci,{name:!0});var Pi=Ai.prototype=ct(Ci.prototype,{constructor:createPropertyDescriptor(1,Ai),message:createPropertyDescriptor(1,""),name:createPropertyDescriptor(1,"AggregateError")});_export({global:!0,constructor:!0,arity:2},{AggregateError:Ai});var Oi,Ri,ji,Fi,Li="process"==classofRaw(m.process),Ni=wellKnownSymbol("species"),setSpecies=function(t){var a=getBuiltIn(t),o=De.f;I&&a&&!a[Ni]&&o(a,Ni,{configurable:!0,get:function(){return this}})},Ui=TypeError,anInstance=function(t,a){if(z(a,t))return t;throw Ui("Incorrect invocation")},Bi=TypeError,aConstructor=function(t){if(Ht(t))return t;throw Bi(tryToString(t)+" is not a constructor")},qi=wellKnownSymbol("species"),speciesConstructor=function(t,a){var o,c=anObject(t).constructor;return void 0===c||isNullOrUndefined(o=anObject(c)[qi])?a:aConstructor(o)},Di=TypeError,validateArgumentsLength=function(t,a){if(t<a)throw Di("Not enough arguments");return t},Hi=/(?:ipad|iphone|ipod).*applewebkit/i.test($),zi=m.setImmediate,$i=m.clearImmediate,Gi=m.process,Ki=m.Dispatch,Wi=m.Function,Vi=m.MessageChannel,Ji=m.String,Xi=0,Yi={},Qi="onreadystatechange";try{Oi=m.location}catch(t){}var run=function(t){if(le(Yi,t)){var a=Yi[t];delete Yi[t],a()}},runner=function(t){return function(){run(t)}},listener=function(t){run(t.data)},post=function(t){m.postMessage(Ji(t),Oi.protocol+"//"+Oi.host)};zi&&$i||(zi=function setImmediate(t){validateArgumentsLength(arguments.length,1);var a=isCallable(t)?t:Wi(t),o=gt(arguments,1);return Yi[++Xi]=function(){T(a,void 0,o)},Ri(Xi),Xi},$i=function clearImmediate(t){delete Yi[t]},Li?Ri=function(t){Gi.nextTick(runner(t))}:Ki&&Ki.now?Ri=function(t){Ki.now(runner(t))}:Vi&&!Hi?(Fi=(ji=new Vi).port2,ji.port1.onmessage=listener,Ri=functionBindContext(Fi.postMessage,Fi)):m.addEventListener&&isCallable(m.postMessage)&&!m.importScripts&&Oi&&"file:"!==Oi.protocol&&!fails(post)?(Ri=post,m.addEventListener("message",listener,!1)):Ri=Qi in documentCreateElement("script")?function(t){at.appendChild(documentCreateElement("script")).onreadystatechange=function(){at.removeChild(this),run(t)}}:function(t){setTimeout(runner(t),0)});var Zi,ea,ta,ra,na,ia,aa,oa,sa={set:zi,clear:$i},ca=/ipad|iphone|ipod/i.test($)&&void 0!==m.Pebble,ua=/web0s(?!.*chrome)/i.test($),la=_e.f,pa=sa.set,da=m.MutationObserver||m.WebKitMutationObserver,ma=m.document,fa=m.process,ga=m.Promise,ya=la(m,"queueMicrotask"),ha=ya&&ya.value;ha||(Zi=function(){var t,a;for(Li&&(t=fa.domain)&&t.exit();ea;){a=ea.fn,ea=ea.next;try{a()}catch(t){throw ea?ra():ta=void 0,t}}ta=void 0,t&&t.enter()},Hi||Li||ua||!da||!ma?!ca&&ga&&ga.resolve?((aa=ga.resolve(void 0)).constructor=ga,oa=functionBindContext(aa.then,aa),ra=function(){oa(Zi)}):Li?ra=function(){fa.nextTick(Zi)}:(pa=functionBindContext(pa,m),ra=function(){pa(Zi)}):(na=!0,ia=ma.createTextNode(""),new da(Zi).observe(ia,{characterData:!0}),ra=function(){ia.data=na=!na}));var va=ha||function(t){var a={fn:t,next:void 0};ta&&(ta.next=a),ea||(ea=a,ra()),ta=a},perform=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},Queue=function(){this.head=null,this.tail=null};Queue.prototype={add:function(t){var a={item:t,next:null};this.head?this.tail.next=a:this.head=a,this.tail=a},get:function(){var t=this.head;if(t)return this.head=t.next,this.tail===t&&(this.tail=null),t.item}};var ba,Sa,Ta=Queue,Ma=m.Promise,wa="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,_a=!wa&&!Li&&"object"==typeof window&&"object"==typeof document,xa=Ma&&Ma.prototype,ka=wellKnownSymbol("species"),Ia=!1,Ca=isCallable(m.PromiseRejectionEvent),Ea=Ae("Promise",(function(){var t=jt(Ma),a=t!==String(Ma);if(!a&&66===X)return!0;if(!xa.catch||!xa.finally)return!0;if(!X||X<51||!/native code/.test(t)){var o=new Ma((function(t){t(1)})),FakePromise=function(t){t((function(){}),(function(){}))};if((o.constructor={})[ka]=FakePromise,!(Ia=o.then((function(){}))instanceof FakePromise))return!0}return!a&&(_a||wa)&&!Ca})),Aa={CONSTRUCTOR:Ea,REJECTION_EVENT:Ca,SUBCLASSING:Ia},Pa=TypeError,PromiseCapability=function(t){var a,o;this.promise=new t((function(t,c){if(void 0!==a||void 0!==o)throw Pa("Bad Promise constructor");a=t,o=c})),this.resolve=aCallable(a),this.reject=aCallable(o)},Oa={f:function(t){return new PromiseCapability(t)}},Ra=sa.set,ja="Promise",Fa=Aa.CONSTRUCTOR,La=Aa.REJECTION_EVENT,Na=Mr.getterFor(ja),Ua=Mr.set,Ba=Ma&&Ma.prototype,qa=Ma,Da=Ba,Ha=m.TypeError,za=m.document,$a=m.process,Ga=Oa.f,Ka=Ga,Wa=!!(za&&za.createEvent&&m.dispatchEvent),Va="unhandledrejection",isThenable=function(t){var a;return!(!D(t)||!isCallable(a=t.then))&&a},callReaction=function(t,a){var o,c,m,h=a.value,v=1==a.state,b=v?t.ok:t.fail,S=t.resolve,T=t.reject,M=t.domain;try{b?(v||(2===a.rejection&&onHandleUnhandled(a),a.rejection=1),!0===b?o=h:(M&&M.enter(),o=b(h),M&&(M.exit(),m=!0)),o===t.promise?T(Ha("Promise-chain cycle")):(c=isThenable(o))?E(c,o,S,T):S(o)):T(h)}catch(t){M&&!m&&M.exit(),T(t)}},notify=function(t,a){t.notified||(t.notified=!0,va((function(){for(var o,c=t.reactions;o=c.get();)callReaction(o,t);t.notified=!1,a&&!t.rejection&&onUnhandled(t)})))},dispatchEvent=function(t,a,o){var c,h;Wa?((c=za.createEvent("Event")).promise=a,c.reason=o,c.initEvent(t,!1,!0),m.dispatchEvent(c)):c={promise:a,reason:o},!La&&(h=m["on"+t])?h(c):t===Va&&function(t,a){var o=m.console;o&&o.error&&(1==arguments.length?o.error(t):o.error(t,a))}("Unhandled promise rejection",o)},onUnhandled=function(t){E(Ra,m,(function(){var a,o=t.facade,c=t.value;if(isUnhandled(t)&&(a=perform((function(){Li?$a.emit("unhandledRejection",c,o):dispatchEvent(Va,o,c)})),t.rejection=Li||isUnhandled(t)?2:1,a.error))throw a.value}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t){E(Ra,m,(function(){var a=t.facade;Li?$a.emit("rejectionHandled",a):dispatchEvent("rejectionhandled",a,t.value)}))},bind=function(t,a,o){return function(c){t(a,c,o)}},internalReject=function(t,a,o){t.done||(t.done=!0,o&&(t=o),t.value=a,t.state=2,notify(t,!0))},internalResolve=function(t,a,o){if(!t.done){t.done=!0,o&&(t=o);try{if(t.facade===a)throw Ha("Promise can't be resolved itself");var c=isThenable(a);c?va((function(){var o={done:!1};try{E(c,a,bind(internalResolve,o,t),bind(internalReject,o,t))}catch(a){internalReject(o,a,t)}})):(t.value=a,t.state=1,notify(t,!1))}catch(a){internalReject({done:!1},a,t)}}};Fa&&(Da=(qa=function Promise(t){anInstance(this,Da),aCallable(t),E(ba,this);var a=Na(this);try{t(bind(internalResolve,a),bind(internalReject,a))}catch(t){internalReject(a,t)}}).prototype,(ba=function Promise(t){Ua(this,{type:ja,done:!1,notified:!1,parent:!1,reactions:new Ta,rejection:!1,state:0,value:void 0})}).prototype=defineBuiltIn(Da,"then",(function then(t,a){var o=Na(this),c=Ga(speciesConstructor(this,qa));return o.parent=!0,c.ok=!isCallable(t)||t,c.fail=isCallable(a)&&a,c.domain=Li?$a.domain:void 0,0==o.state?o.reactions.add(c):va((function(){callReaction(c,o)})),c.promise})),Sa=function(){var t=new ba,a=Na(t);this.promise=t,this.resolve=bind(internalResolve,a),this.reject=bind(internalReject,a)},Oa.f=Ga=function(t){return t===qa||undefined===t?new Sa(t):Ka(t)}),_export({global:!0,constructor:!0,wrap:!0,forced:Fa},{Promise:qa}),setToStringTag(qa,ja,!1,!0),setSpecies(ja);var Ja=wellKnownSymbol("iterator"),Xa=!1;try{var Ya=0,Qa={next:function(){return{done:!!Ya++}},return:function(){Xa=!0}};Qa[Ja]=function(){return this},Array.from(Qa,(function(){throw 2}))}catch(t){}var checkCorrectnessOfIteration=function(t,a){if(!a&&!Xa)return!1;var o=!1;try{var c={};c[Ja]=function(){return{next:function(){return{done:o=!0}}}},t(c)}catch(t){}return o},Za=Aa.CONSTRUCTOR||!checkCorrectnessOfIteration((function(t){Ma.all(t).then(void 0,(function(){}))}));_export({target:"Promise",stat:!0,forced:Za},{all:function all(t){var a=this,o=Oa.f(a),c=o.resolve,m=o.reject,h=perform((function(){var o=aCallable(a.resolve),h=[],v=0,b=1;iterate(t,(function(t){var S=v++,T=!1;b++,E(o,a,t).then((function(t){T||(T=!0,h[S]=t,--b||c(h))}),m)})),--b||c(h)}));return h.error&&m(h.value),o.promise}});var eo=Aa.CONSTRUCTOR;Ma&&Ma.prototype,_export({target:"Promise",proto:!0,forced:eo,real:!0},{catch:function(t){return this.then(void 0,t)}}),_export({target:"Promise",stat:!0,forced:Za},{race:function race(t){var a=this,o=Oa.f(a),c=o.reject,m=perform((function(){var m=aCallable(a.resolve);iterate(t,(function(t){E(m,a,t).then(o.resolve,c)}))}));return m.error&&c(m.value),o.promise}}),_export({target:"Promise",stat:!0,forced:Aa.CONSTRUCTOR},{reject:function reject(t){var a=Oa.f(this);return E(a.reject,void 0,t),a.promise}});var promiseResolve=function(t,a){if(anObject(t),D(a)&&a.constructor===t)return a;var o=Oa.f(t);return(0,o.resolve)(a),o.promise},to=Aa.CONSTRUCTOR,ro=getBuiltIn("Promise"),no=!to;_export({target:"Promise",stat:!0,forced:!0},{resolve:function resolve(t){return promiseResolve(no&&this===ro?Ma:this,t)}}),_export({target:"Promise",stat:!0},{allSettled:function allSettled(t){var a=this,o=Oa.f(a),c=o.resolve,m=o.reject,h=perform((function(){var o=aCallable(a.resolve),m=[],h=0,v=1;iterate(t,(function(t){var b=h++,S=!1;v++,E(o,a,t).then((function(t){S||(S=!0,m[b]={status:"fulfilled",value:t},--v||c(m))}),(function(t){S||(S=!0,m[b]={status:"rejected",reason:t},--v||c(m))}))})),--v||c(m)}));return h.error&&m(h.value),o.promise}});var io="No one promise resolved";_export({target:"Promise",stat:!0},{any:function any(t){var a=this,o=getBuiltIn("AggregateError"),c=Oa.f(a),m=c.resolve,h=c.reject,v=perform((function(){var c=aCallable(a.resolve),v=[],b=0,S=1,T=!1;iterate(t,(function(t){var M=b++,w=!1;S++,E(c,a,t).then((function(t){w||T||(T=!0,m(t))}),(function(t){w||T||(w=!0,v[M]=t,--S||h(new o(v,io)))}))})),--S||h(new o(v,io))}));return v.error&&h(v.value),c.promise}});var ao=Ma&&Ma.prototype,oo=!!Ma&&fails((function(){ao.finally.call({then:function(){}},(function(){}))}));_export({target:"Promise",proto:!0,real:!0,forced:oo},{finally:function(t){var a=speciesConstructor(this,getBuiltIn("Promise")),o=isCallable(t);return this.then(o?function(o){return promiseResolve(a,t()).then((function(){return o}))}:t,o?function(o){return promiseResolve(a,t()).then((function(){throw o}))}:t)}});var so=H.Promise;_export({target:"Promise",stat:!0,forced:!0},{try:function(t){var a=Oa.f(this),o=perform(t);return(o.error?a.reject:a.resolve)(o.value),a.promise}});var co=so,uo=k([].reverse),lo=[1,2];_export({target:"Array",proto:!0,forced:String(lo)===String(lo.reverse())},{reverse:function reverse(){return xt(this)&&(this.length=this.length),uo(this)}});var po=entryVirtual("Array").reverse,mo=Array.prototype,reverse$1=function(t){var a=t.reverse;return t===mo||z(mo,t)&&a===mo.reverse?po:a},fo=arrayMethodHasSpeciesSupport("slice"),go=wellKnownSymbol("species"),yo=Array,ho=Math.max;_export({target:"Array",proto:!0,forced:!fo},{slice:function slice(t,a){var o,c,m,h=toIndexedObject(this),v=lengthOfArrayLike(h),b=toAbsoluteIndex(t,v),S=toAbsoluteIndex(void 0===a?v:a,v);if(xt(h)&&(o=h.constructor,(Ht(o)&&(o===yo||xt(o.prototype))||D(o)&&null===(o=o[go]))&&(o=void 0),o===yo||void 0===o))return gt(h,b,S);for(c=new(void 0===o?yo:o)(ho(S-b,0)),m=0;b<S;b++,m++)b in h&&createProperty(c,m,h[b]);return c.length=m,c}});var vo=entryVirtual("Array").slice,bo=Array.prototype,slice=function(t){var a=t.slice;return t===bo||z(bo,t)&&a===bo.slice?vo:a},So=createCommonjsModule((function(t){var a=ri.default;function _regeneratorRuntime(){t.exports=_regeneratorRuntime=function _regeneratorRuntime(){return o},t.exports.__esModule=!0,t.exports.default=t.exports;var o={},c=Object.prototype,m=c.hasOwnProperty,h="function"==typeof Wn?Wn:{},v=h.iterator||"@@iterator",b=h.asyncIterator||"@@asyncIterator",S=h.toStringTag||"@@toStringTag";function define(t,a,o){return ai(t,a,{value:o,enumerable:!0,configurable:!0,writable:!0}),t[a]}try{define({},"")}catch(t){define=function define(t,a,o){return t[a]=o}}function wrap(t,a,o,c){var m=a&&a.prototype instanceof Generator?a:Generator,h=lt(m.prototype),v=new Context(c||[]);return h._invoke=function(t,a,o){var c="suspendedStart";return function(m,h){if("executing"===c)throw new Error("Generator is already running");if("completed"===c){if("throw"===m)throw h;return doneResult()}for(o.method=m,o.arg=h;;){var v=o.delegate;if(v){var b=maybeInvokeDelegate(v,o);if(b){if(b===T)continue;return b}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===c)throw c="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);c="executing";var S=tryCatch(t,a,o);if("normal"===S.type){if(c=o.done?"completed":"suspendedYield",S.arg===T)continue;return{value:S.arg,done:o.done}}"throw"===S.type&&(c="completed",o.method="throw",o.arg=S.arg)}}}(t,o,v),h}function tryCatch(t,a,o){try{return{type:"normal",arg:t.call(a,o)}}catch(t){return{type:"throw",arg:t}}}o.wrap=wrap;var T={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var M={};define(M,v,(function(){return this}));var w=si&&si(si(values([])));w&&w!==c&&m.call(w,v)&&(M=w);var _=GeneratorFunctionPrototype.prototype=Generator.prototype=lt(M);function defineIteratorMethods(t){var a;forEach$1(a=["next","throw","return"]).call(a,(function(a){define(t,a,(function(t){return this._invoke(a,t)}))}))}function AsyncIterator(t,o){function invoke(c,h,v,b){var S=tryCatch(t[c],t,h);if("throw"!==S.type){var T=S.arg,M=T.value;return M&&"object"==a(M)&&m.call(M,"__await")?o.resolve(M.__await).then((function(t){invoke("next",t,v,b)}),(function(t){invoke("throw",t,v,b)})):o.resolve(M).then((function(t){T.value=t,v(T)}),(function(t){return invoke("throw",t,v,b)}))}b(S.arg)}var c;this._invoke=function(t,a){function callInvokeWithMethodAndArg(){return new o((function(o,c){invoke(t,a,o,c)}))}return c=c?c.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,a){var o=t.iterator[a.method];if(void 0===o){if(a.delegate=null,"throw"===a.method){if(t.iterator.return&&(a.method="return",a.arg=void 0,maybeInvokeDelegate(t,a),"throw"===a.method))return T;a.method="throw",a.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var c=tryCatch(o,t.iterator,a.arg);if("throw"===c.type)return a.method="throw",a.arg=c.arg,a.delegate=null,T;var m=c.arg;return m?m.done?(a[t.resultName]=m.value,a.next=t.nextLoc,"return"!==a.method&&(a.method="next",a.arg=void 0),a.delegate=null,T):m:(a.method="throw",a.arg=new TypeError("iterator result is not an object"),a.delegate=null,T)}function pushTryEntry(t){var a={tryLoc:t[0]};1 in t&&(a.catchLoc=t[1]),2 in t&&(a.finallyLoc=t[2],a.afterLoc=t[3]),this.tryEntries.push(a)}function resetTryEntry(t){var a=t.completion||{};a.type="normal",delete a.arg,t.completion=a}function Context(t){this.tryEntries=[{tryLoc:"root"}],forEach$1(t).call(t,pushTryEntry,this),this.reset(!0)}function values(t){if(t){var a=t[v];if(a)return a.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,c=function next(){for(;++o<t.length;)if(m.call(t,o))return next.value=t[o],next.done=!1,next;return next.value=void 0,next.done=!0,next};return c.next=c}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(_,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,S,"GeneratorFunction"),o.isGeneratorFunction=function(t){var a="function"==typeof t&&t.constructor;return!!a&&(a===GeneratorFunction||"GeneratorFunction"===(a.displayName||a.name))},o.mark=function(t){return ft?ft(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,S,"GeneratorFunction")),t.prototype=lt(_),t},o.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,b,(function(){return this})),o.AsyncIterator=AsyncIterator,o.async=function(t,a,c,m,h){void 0===h&&(h=co);var v=new AsyncIterator(wrap(t,a,c,m),h);return o.isGeneratorFunction(a)?v:v.next().then((function(t){return t.done?t.value:v.next()}))},defineIteratorMethods(_),define(_,S,"Generator"),define(_,v,(function(){return this})),define(_,"toString",(function(){return"[object Generator]"})),o.keys=function(t){var a=[];for(var o in t)a.push(o);return reverse$1(a).call(a),function next(){for(;a.length;){var o=a.pop();if(o in t)return next.value=o,next.done=!1,next}return next.done=!0,next}},o.values=values,Context.prototype={constructor:Context,reset:function reset(t){var a;if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,forEach$1(a=this.tryEntries).call(a,resetTryEntry),!t)for(var o in this)"t"===o.charAt(0)&&m.call(this,o)&&!isNaN(+slice(o).call(o,1))&&(this[o]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var a=this;function handle(o,c){return h.type="throw",h.arg=t,a.next=o,c&&(a.method="next",a.arg=void 0),!!c}for(var o=this.tryEntries.length-1;o>=0;--o){var c=this.tryEntries[o],h=c.completion;if("root"===c.tryLoc)return handle("end");if(c.tryLoc<=this.prev){var v=m.call(c,"catchLoc"),b=m.call(c,"finallyLoc");if(v&&b){if(this.prev<c.catchLoc)return handle(c.catchLoc,!0);if(this.prev<c.finallyLoc)return handle(c.finallyLoc)}else if(v){if(this.prev<c.catchLoc)return handle(c.catchLoc,!0)}else{if(!b)throw new Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return handle(c.finallyLoc)}}}},abrupt:function abrupt(t,a){for(var o=this.tryEntries.length-1;o>=0;--o){var c=this.tryEntries[o];if(c.tryLoc<=this.prev&&m.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var h=c;break}}h&&("break"===t||"continue"===t)&&h.tryLoc<=a&&a<=h.finallyLoc&&(h=null);var v=h?h.completion:{};return v.type=t,v.arg=a,h?(this.method="next",this.next=h.finallyLoc,T):this.complete(v)},complete:function complete(t,a){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&a&&(this.next=a),T},finish:function finish(t){for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a];if(o.finallyLoc===t)return this.complete(o.completion,o.afterLoc),resetTryEntry(o),T}},catch:function _catch(t){for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a];if(o.tryLoc===t){var c=o.completion;if("throw"===c.type){var m=c.arg;resetTryEntry(o)}return m}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,a,o){return this.delegate={iterator:values(t),resultName:a,nextLoc:o},"next"===this.method&&(this.arg=void 0),T}},o}t.exports=_regeneratorRuntime,t.exports.__esModule=!0,t.exports.default=t.exports})),To=So(),Mo=To;try{regeneratorRuntime=To}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=To:Function("r","regeneratorRuntime = r")(To)}_export({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991});var wo=9007199254740991,_o=fails((function(){rt(1)}));_export({target:"Object",stat:!0,forced:_o},{keys:function keys(t){return rt(toObject(t))}});var xo=H.Object.keys,ko=Object.assign,Io=Object.defineProperty,Co=k([].concat),Eo=!ko||fails((function(){if(I&&1!==ko({b:1},ko(Io({},"a",{enumerable:!0,get:function(){Io(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},a={},o=Symbol(),c="abcdefghijklmnopqrst";return t[o]=7,c.split("").forEach((function(t){a[t]=t})),7!=ko({},t)[o]||rt(ko({},a)).join("")!=c}))?function assign(t,a){for(var o=toObject(t),c=arguments.length,m=1,h=or.f,v=O.f;c>m;)for(var b,S=U(arguments[m++]),T=h?Co(rt(S),h(S)):rt(S),M=T.length,w=0;M>w;)b=T[w++],I&&!E(v,S,b)||(o[b]=S[b]);return o}:ko;_export({target:"Object",stat:!0,arity:2,forced:Object.assign!==Eo},{assign:Eo});var Ao=H.Object.assign;H.JSON||(H.JSON={stringify:JSON.stringify});var Po=function stringify(t,a,o){return T(H.JSON.stringify,null,arguments)},Oo=Po,Ro=Xe.indexOf,jo=k([].indexOf),Fo=!!jo&&1/jo([1],1,-0)<0,Lo=arrayMethodIsStrict("indexOf");_export({target:"Array",proto:!0,forced:Fo||!Lo},{indexOf:function indexOf(t){var a=arguments.length>1?arguments[1]:void 0;return Fo?jo(this,t,a)||0:Ro(this,t,a)}});var No=entryVirtual("Array").indexOf,Uo=Array.prototype,indexOf=function(t){var a=t.indexOf;return t===Uo||z(Uo,t)&&a===Uo.indexOf?No:a},Bo=entryVirtual("Array").concat,qo=Array.prototype,concat=function(t){var a=t.concat;return t===qo||z(qo,t)&&a===qo.concat?Bo:a};function __rest(t,a){var o={};for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&a.indexOf(c)<0&&(o[c]=t[c]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var m=0;for(c=Object.getOwnPropertySymbols(t);m<c.length;m++)a.indexOf(c[m])<0&&Object.prototype.propertyIsEnumerable.call(t,c[m])&&(o[c[m]]=t[c[m]])}return o}function __awaiter(t,a,o,c){return new(o||(o=Promise))((function(m,h){function fulfilled(t){try{step(c.next(t))}catch(t){h(t)}}function rejected(t){try{step(c.throw(t))}catch(t){h(t)}}function step(t){t.done?m(t.value):function adopt(t){return t instanceof o?t:new o((function(a){a(t)}))}(t.value).then(fulfilled,rejected)}step((c=c.apply(t,a||[])).next())}))}var Do=fails((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),Ho=Object.isExtensible,zo=fails((function(){Ho(1)}))||Do?function isExtensible(t){return!!D(t)&&((!Do||"ArrayBuffer"!=classofRaw(t))&&(!Ho||Ho(t)))}:Ho,$o=!fails((function(){return Object.isExtensible(Object.preventExtensions({}))})),Go=createCommonjsModule((function(t){var a=De.f,o=!1,c=uid("meta"),m=0,setMetadata=function(t){a(t,c,{value:{objectID:"O"+m++,weakData:{}}})},h=t.exports={enable:function(){h.enable=function(){},o=!0;var t=er.f,a=k([].splice),m={};m[c]=1,t(m).length&&(er.f=function(o){for(var m=t(o),h=0,v=m.length;h<v;h++)if(m[h]===c){a(m,h,1);break}return m},_export({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:ar.f}))},fastKey:function(t,a){if(!D(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!le(t,c)){if(!zo(t))return"F";if(!a)return"E";setMetadata(t)}return t[c].objectID},getWeakData:function(t,a){if(!le(t,c)){if(!zo(t))return!0;if(!a)return!1;setMetadata(t)}return t[c].weakData},onFreeze:function(t){return $o&&o&&zo(t)&&!le(t,c)&&setMetadata(t),t}};Ye[c]=!0})),Ko=De.f,Wo=_r.forEach,Vo=Mr.set,Jo=Mr.getterFor,defineBuiltIns=function(t,a,o){for(var c in a)o&&o.unsafe&&t[c]?t[c]=a[c]:defineBuiltIn(t,c,a[c],o);return t},Xo=De.f,Yo=Go.fastKey,Qo=Mr.set,Zo=Mr.getterFor,es={getConstructor:function(t,a,o,c){var m=t((function(t,m){anInstance(t,h),Qo(t,{type:a,index:ct(null),first:void 0,last:void 0,size:0}),I||(t.size=0),isNullOrUndefined(m)||iterate(m,t[c],{that:t,AS_ENTRIES:o})})),h=m.prototype,v=Zo(a),define=function(t,a,o){var c,m,h=v(t),b=getEntry(t,a);return b?b.value=o:(h.last=b={index:m=Yo(a,!0),key:a,value:o,previous:c=h.last,next:void 0,removed:!1},h.first||(h.first=b),c&&(c.next=b),I?h.size++:t.size++,"F"!==m&&(h.index[m]=b)),t},getEntry=function(t,a){var o,c=v(t),m=Yo(a);if("F"!==m)return c.index[m];for(o=c.first;o;o=o.next)if(o.key==a)return o};return defineBuiltIns(h,{clear:function clear(){for(var t=v(this),a=t.index,o=t.first;o;)o.removed=!0,o.previous&&(o.previous=o.previous.next=void 0),delete a[o.index],o=o.next;t.first=t.last=void 0,I?t.size=0:this.size=0},delete:function(t){var a=this,o=v(a),c=getEntry(a,t);if(c){var m=c.next,h=c.previous;delete o.index[c.index],c.removed=!0,h&&(h.next=m),m&&(m.previous=h),o.first==c&&(o.first=m),o.last==c&&(o.last=h),I?o.size--:a.size--}return!!c},forEach:function forEach(t){for(var a,o=v(this),c=functionBindContext(t,arguments.length>1?arguments[1]:void 0);a=a?a.next:o.first;)for(c(a.value,a.key,this);a&&a.removed;)a=a.previous},has:function has(t){return!!getEntry(this,t)}}),defineBuiltIns(h,o?{get:function get(t){var a=getEntry(this,t);return a&&a.value},set:function set(t,a){return define(this,0===t?0:t,a)}}:{add:function add(t){return define(this,t=0===t?0:t,t)}}),I&&Xo(h,"size",{get:function(){return v(this).size}}),m},setStrong:function(t,a,o){var c=a+" Iterator",m=Zo(a),h=Zo(c);iteratorDefine(t,a,(function(t,a){Qo(this,{type:c,target:t,state:m(t),kind:a,last:void 0})}),(function(){for(var t=h(this),a=t.kind,o=t.last;o&&o.removed;)o=o.previous;return t.target&&(t.last=o=o?o.next:t.state.first)?"keys"==a?{value:o.key,done:!1}:"values"==a?{value:o.value,done:!1}:{value:[o.key,o.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),o?"entries":"values",!o,!0),setSpecies(a)}};!function(t,a,o){var c,h=-1!==t.indexOf("Map"),v=-1!==t.indexOf("Weak"),b=h?"set":"add",S=m[t],T=S&&S.prototype,M={};if(I&&isCallable(S)&&(v||T.forEach&&!fails((function(){(new S).entries().next()})))){var w=(c=a((function(a,o){Vo(anInstance(a,w),{type:t,collection:new S}),null!=o&&iterate(o,a[b],{that:a,AS_ENTRIES:h})}))).prototype,_=Jo(t);Wo(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(t){var a="add"==t||"set"==t;!(t in T)||v&&"clear"==t||He(w,t,(function(o,c){var m=_(this).collection;if(!a&&v&&!D(o))return"get"==t&&void 0;var h=m[t](0===o?0:o,c);return a?this:h}))})),v||Ko(w,"size",{configurable:!0,get:function(){return _(this).collection.size}})}else c=o.getConstructor(a,t,h,b),Go.enable();setToStringTag(c,t,!1,!0),M[t]=c,_export({global:!0,forced:!0},M),v||o.setStrong(c,t,h)}("Map",(function(t){return function Map(){return t(this,arguments.length?arguments[0]:void 0)}}),es);var ts=H.Map,rs=[].push;_export({target:"Map",stat:!0,forced:!0},{from:function from(t){var a,o,c,m,h=arguments.length,v=h>1?arguments[1]:void 0;return aConstructor(this),(a=void 0!==v)&&aCallable(v),isNullOrUndefined(t)?new this:(o=[],a?(c=0,m=functionBindContext(v,h>2?arguments[2]:void 0),iterate(t,(function(t){E(rs,o,m(t,c++))}))):iterate(t,rs,{that:o}),new this(o))}});_export({target:"Map",stat:!0,forced:!0},{of:function of(){return new this(gt(arguments))}});_export({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:function deleteAll(){for(var t,a=anObject(this),o=aCallable(a.delete),c=!0,m=0,h=arguments.length;m<h;m++)t=E(o,a,arguments[m]),c=c&&t;return!!c}});_export({target:"Map",proto:!0,real:!0,forced:!0},{emplace:function emplace(t,a){var o,c,m=anObject(this),h=aCallable(m.get),v=aCallable(m.has),b=aCallable(m.set);return E(v,m,t)?(o=E(h,m,t),"update"in a&&(o=a.update(o,t,m),E(b,m,t,o)),o):(c=a.insert(t,m),E(b,m,t,c),c)}});var ns=getIterator;_export({target:"Map",proto:!0,real:!0,forced:!0},{every:function every(t){var a=anObject(this),o=ns(a),c=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return!iterate(o,(function(t,o,m){if(!c(o,t,a))return m()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{filter:function filter(t){var a=anObject(this),o=ns(a),c=functionBindContext(t,arguments.length>1?arguments[1]:void 0),m=new(speciesConstructor(a,getBuiltIn("Map"))),h=aCallable(m.set);return iterate(o,(function(t,o){c(o,t,a)&&E(h,m,t,o)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),m}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{find:function find(t){var a=anObject(this),o=ns(a),c=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(o,(function(t,o,m){if(c(o,t,a))return m(o)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function findKey(t){var a=anObject(this),o=ns(a),c=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(o,(function(t,o,m){if(c(o,t,a))return m(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var is=k([].push);_export({target:"Map",stat:!0,forced:!0},{groupBy:function groupBy(t,a){aCallable(a);var o=getIterator(t),c=new this,m=aCallable(c.has),h=aCallable(c.get),v=aCallable(c.set);return iterate(o,(function(t){var o=a(t);E(m,c,o)?is(E(h,c,o),t):E(v,c,o,[t])}),{IS_ITERATOR:!0}),c}});_export({target:"Map",proto:!0,real:!0,forced:!0},{includes:function includes(t){return iterate(ns(anObject(this)),(function(a,o,c){if((m=o)===(h=t)||m!=m&&h!=h)return c();var m,h}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Map",stat:!0,forced:!0},{keyBy:function keyBy(t,a){var o=new this;aCallable(a);var c=aCallable(o.set);return iterate(t,(function(t){E(c,o,a(t),t)})),o}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function keyOf(t){return iterate(ns(anObject(this)),(function(a,o,c){if(o===t)return c(a)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function mapKeys(t){var a=anObject(this),o=ns(a),c=functionBindContext(t,arguments.length>1?arguments[1]:void 0),m=new(speciesConstructor(a,getBuiltIn("Map"))),h=aCallable(m.set);return iterate(o,(function(t,o){E(h,m,c(o,t,a),o)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),m}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function mapValues(t){var a=anObject(this),o=ns(a),c=functionBindContext(t,arguments.length>1?arguments[1]:void 0),m=new(speciesConstructor(a,getBuiltIn("Map"))),h=aCallable(m.set);return iterate(o,(function(t,o){E(h,m,t,c(o,t,a))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),m}}),_export({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function merge(t){for(var a=anObject(this),o=aCallable(a.set),c=arguments.length,m=0;m<c;)iterate(arguments[m++],o,{that:a,AS_ENTRIES:!0});return a}});var as=TypeError;_export({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function reduce(t){var a=anObject(this),o=ns(a),c=arguments.length<2,m=c?void 0:arguments[1];if(aCallable(t),iterate(o,(function(o,h){c?(c=!1,m=h):m=t(m,h,o,a)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),c)throw as("Reduce of empty map with no initial value");return m}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{some:function some(t){var a=anObject(this),o=ns(a),c=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(o,(function(t,o,m){if(c(o,t,a))return m()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var os=TypeError;_export({target:"Map",proto:!0,real:!0,forced:!0},{update:function update(t,a){var o=anObject(this),c=aCallable(o.get),m=aCallable(o.has),h=aCallable(o.set),v=arguments.length;aCallable(a);var b=E(m,o,t);if(!b&&v<3)throw os("Updating absent value");var S=b?E(c,o,t):aCallable(v>2?arguments[2]:void 0)(t,o);return E(h,o,t,a(S,t,o)),o}});var ss=TypeError,cs=function upsert(t,a){var o,c=anObject(this),m=aCallable(c.get),h=aCallable(c.has),v=aCallable(c.set),b=arguments.length>2?arguments[2]:void 0;if(!isCallable(a)&&!isCallable(b))throw ss("At least one callback required");return E(h,c,t)?(o=E(m,c,t),isCallable(a)&&(o=a(o),E(v,c,t,o))):isCallable(b)&&(o=b(),E(v,c,t,o)),o};_export({target:"Map",proto:!0,real:!0,forced:!0},{upsert:cs}),_export({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:cs});var us=ts,ls=/MSIE .\./.test($),ps=m.Function,wrap=function(t){return ls?function(a,o){var c=validateArgumentsLength(arguments.length,1)>2,m=isCallable(a)?a:ps(a),h=c?gt(arguments,2):void 0;return t(c?function(){T(m,this,h)}:m,o)}:t},ds={setTimeout:wrap(m.setTimeout),setInterval:wrap(m.setInterval)},ms=ds.setInterval;_export({global:!0,bind:!0,forced:m.setInterval!==ms},{setInterval:ms});var fs=ds.setTimeout;_export({global:!0,bind:!0,forced:m.setTimeout!==fs},{setTimeout:fs});var gs=H.setTimeout,ys=Date,hs=k(ys.prototype.getTime);_export({target:"Date",stat:!0},{now:function now(){return hs(new ys)}});var vs=H.Date.now,bs=_r.map,Ss=arrayMethodHasSpeciesSupport("map");_export({target:"Array",proto:!0,forced:!Ss},{map:function map(t){return bs(this,t,arguments.length>1?arguments[1]:void 0)}});var Ts=entryVirtual("Array").map,Ms=Array.prototype,map=function(t){var a=t.map;return t===Ms||z(Ms,t)&&a===Ms.map?Ts:a},ws=createCommonjsModule((function(t){var a=Object.prototype.hasOwnProperty,o="~";function Events(){}function EE(t,a,o){this.fn=t,this.context=a,this.once=o||!1}function addListener(t,a,c,m,h){if("function"!=typeof c)throw new TypeError("The listener must be a function");var v=new EE(c,m||t,h),b=o?o+a:a;return t._events[b]?t._events[b].fn?t._events[b]=[t._events[b],v]:t._events[b].push(v):(t._events[b]=v,t._eventsCount++),t}function clearEvent(t,a){0==--t._eventsCount?t._events=new Events:delete t._events[a]}function EventEmitter(){this._events=new Events,this._eventsCount=0}Object.create&&(Events.prototype=Object.create(null),(new Events).__proto__||(o=!1)),EventEmitter.prototype.eventNames=function eventNames(){var t,c,m=[];if(0===this._eventsCount)return m;for(c in t=this._events)a.call(t,c)&&m.push(o?c.slice(1):c);return Object.getOwnPropertySymbols?m.concat(Object.getOwnPropertySymbols(t)):m},EventEmitter.prototype.listeners=function listeners(t){var a=o?o+t:t,c=this._events[a];if(!c)return[];if(c.fn)return[c.fn];for(var m=0,h=c.length,v=new Array(h);m<h;m++)v[m]=c[m].fn;return v},EventEmitter.prototype.listenerCount=function listenerCount(t){var a=o?o+t:t,c=this._events[a];return c?c.fn?1:c.length:0},EventEmitter.prototype.emit=function emit(t,a,c,m,h,v){var b=o?o+t:t;if(!this._events[b])return!1;var S,T,M=this._events[b],w=arguments.length;if(M.fn){switch(M.once&&this.removeListener(t,M.fn,void 0,!0),w){case 1:return M.fn.call(M.context),!0;case 2:return M.fn.call(M.context,a),!0;case 3:return M.fn.call(M.context,a,c),!0;case 4:return M.fn.call(M.context,a,c,m),!0;case 5:return M.fn.call(M.context,a,c,m,h),!0;case 6:return M.fn.call(M.context,a,c,m,h,v),!0}for(T=1,S=new Array(w-1);T<w;T++)S[T-1]=arguments[T];M.fn.apply(M.context,S)}else{var _,x=M.length;for(T=0;T<x;T++)switch(M[T].once&&this.removeListener(t,M[T].fn,void 0,!0),w){case 1:M[T].fn.call(M[T].context);break;case 2:M[T].fn.call(M[T].context,a);break;case 3:M[T].fn.call(M[T].context,a,c);break;case 4:M[T].fn.call(M[T].context,a,c,m);break;default:if(!S)for(_=1,S=new Array(w-1);_<w;_++)S[_-1]=arguments[_];M[T].fn.apply(M[T].context,S)}}return!0},EventEmitter.prototype.on=function on(t,a,o){return addListener(this,t,a,o,!1)},EventEmitter.prototype.once=function once(t,a,o){return addListener(this,t,a,o,!0)},EventEmitter.prototype.removeListener=function removeListener(t,a,c,m){var h=o?o+t:t;if(!this._events[h])return this;if(!a)return clearEvent(this,h),this;var v=this._events[h];if(v.fn)v.fn!==a||m&&!v.once||c&&v.context!==c||clearEvent(this,h);else{for(var b=0,S=[],T=v.length;b<T;b++)(v[b].fn!==a||m&&!v[b].once||c&&v[b].context!==c)&&S.push(v[b]);S.length?this._events[h]=1===S.length?S[0]:S:clearEvent(this,h)}return this},EventEmitter.prototype.removeAllListeners=function removeAllListeners(t){var a;return t?(a=o?o+t:t,this._events[a]&&clearEvent(this,a)):(this._events=new Events,this._eventsCount=0),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.addListener=EventEmitter.prototype.on,EventEmitter.prefixed=o,EventEmitter.EventEmitter=EventEmitter,t.exports=EventEmitter})),_s=Backoff;function Backoff(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var a=Math.random(),o=Math.floor(a*this.jitter*t);t=0==(1&Math.floor(10*a))?t-o:t+o}return 0|Math.min(t,this.max)},Backoff.prototype.reset=function(){this.attempts=0},Backoff.prototype.setMin=function(t){this.ms=t},Backoff.prototype.setMax=function(t){this.max=t},Backoff.prototype.setJitter=function(t){this.jitter=t};var xs="object"==typeof t&&t&&t.Object===Object&&t,ks="object"==typeof self&&self&&self.Object===Object&&self,Is=xs||ks||Function("return this")(),Cs=Is.Symbol,Es=Object.prototype,As=Es.hasOwnProperty,Ps=Es.toString,Os=Cs?Cs.toStringTag:void 0;var Rs=function getRawTag(t){var a=As.call(t,Os),o=t[Os];try{t[Os]=void 0;var c=!0}catch(t){}var m=Ps.call(t);return c&&(a?t[Os]=o:delete t[Os]),m},js=Object.prototype.toString;var Fs=function objectToString(t){return js.call(t)},Ls=Cs?Cs.toStringTag:void 0;var Ns=function baseGetTag(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Ls&&Ls in Object(t)?Rs(t):Fs(t)};var Us=function isObject(t){var a=typeof t;return null!=t&&("object"==a||"function"==a)};var Bs=function isFunction(t){if(!Us(t))return!1;var a=Ns(t);return"[object Function]"==a||"[object GeneratorFunction]"==a||"[object AsyncFunction]"==a||"[object Proxy]"==a},qs={deviceId:"",timeout:8e3},Ds={account:"",appkey:"",token:"",debugLevel:"off",needReconnect:!0,reconnectionAttempts:wo,isAbtestEnable:!0,abtestUrl:"https://abt-online.netease.im/v1/api/abt/client/getExperimentInfo",abtestProjectKey:"imElite_sdk_abtest_web"},Hs="weblink.netease.im:443",zs=Xe.includes,$s=fails((function(){return!Array(1).includes()}));_export({target:"Array",proto:!0,forced:$s},{includes:function includes(t){return zs(this,t,arguments.length>1?arguments[1]:void 0)}});var Gs=entryVirtual("Array").includes,Ks=wellKnownSymbol("match"),Ws=TypeError,notARegexp=function(t){if(function(t){var a;return D(t)&&(void 0!==(a=t[Ks])?!!a:"RegExp"==classofRaw(t))}(t))throw Ws("The method doesn't accept regular expressions");return t},Vs=wellKnownSymbol("match"),Js=k("".indexOf);_export({target:"String",proto:!0,forced:!function(t){var a=/./;try{"/./"[t](a)}catch(o){try{return a[Vs]=!1,"/./"[t](a)}catch(t){}}return!1}("includes")},{includes:function includes(t){return!!~Js(toString$1(requireObjectCoercible(this)),toString$1(notARegexp(t)),arguments.length>1?arguments[1]:void 0)}});var Xs=entryVirtual("String").includes,Ys=Array.prototype,Qs=String.prototype,includes=function(t){var a=t.includes;return t===Ys||z(Ys,t)&&a===Ys.includes?Gs:"string"==typeof t||t===Qs||z(Qs,t)&&a===Qs.includes?Xs:a},Zs=_r.findIndex,ec="findIndex",tc=!0;ec in[]&&Array(1).findIndex((function(){tc=!1})),_export({target:"Array",proto:!0,forced:tc},{findIndex:function findIndex(t){return Zs(this,t,arguments.length>1?arguments[1]:void 0)}});var rc=entryVirtual("Array").findIndex,nc=Array.prototype,findIndex$1=function(t){var a=t.findIndex;return t===nc||z(nc,t)&&a===nc.findIndex?rc:a},ic=createCommonjsModule((function(t){function _getPrototypeOf(a){var o;return t.exports=_getPrototypeOf=ft?bind$1(o=si).call(o):function _getPrototypeOf(t){return t.__proto__||si(t)},t.exports.__esModule=!0,t.exports.default=t.exports,_getPrototypeOf(a)}t.exports=_getPrototypeOf,t.exports.__esModule=!0,t.exports.default=t.exports})),ac=createCommonjsModule((function(t){t.exports=function _isNativeFunction(t){var a;return-1!==indexOf(a=Function.toString.call(t)).call(a,"[native code]")},t.exports.__esModule=!0,t.exports.default=t.exports})),oc=getBuiltIn("Reflect","construct"),sc=Object.prototype,cc=[].push,uc=fails((function(){function F(){}return!(oc((function(){}),[],F)instanceof F)})),lc=!fails((function(){oc((function(){}))})),pc=uc||lc;_export({target:"Reflect",stat:!0,forced:pc,sham:pc},{construct:function construct(t,a){aConstructor(t),anObject(a);var o=arguments.length<3?t:aConstructor(arguments[2]);if(lc&&!uc)return oc(t,a,o);if(t==o){switch(a.length){case 0:return new t;case 1:return new t(a[0]);case 2:return new t(a[0],a[1]);case 3:return new t(a[0],a[1],a[2]);case 4:return new t(a[0],a[1],a[2],a[3])}var c=[null];return T(cc,c,a),new(T(St,t,c))}var m=o.prototype,h=ct(D(m)?m:sc),v=T(t,h,a);return D(v)?v:h}});var dc=H.Reflect.construct,mc=createCommonjsModule((function(t){t.exports=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!dc)return!1;if(dc.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(dc(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.__esModule=!0,t.exports.default=t.exports})),fc=createCommonjsModule((function(t){function _construct(a,o,c){var m;mc()?(t.exports=_construct=bind$1(m=dc).call(m),t.exports.__esModule=!0,t.exports.default=t.exports):(t.exports=_construct=function _construct(t,a,o){var c=[null];c.push.apply(c,a);var m=new(bind$1(Function).apply(t,c));return o&&wt(m,o.prototype),m},t.exports.__esModule=!0,t.exports.default=t.exports);return _construct.apply(null,arguments)}t.exports=_construct,t.exports.__esModule=!0,t.exports.default=t.exports})),gc=createCommonjsModule((function(t){function _wrapNativeSuper(a){var o="function"==typeof us?new us:void 0;return t.exports=_wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!ac(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==o){if(o.has(t))return o.get(t);o.set(t,Wrapper)}function Wrapper(){return fc(t,arguments,ic(this).constructor)}return Wrapper.prototype=lt(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),wt(Wrapper,t)},t.exports.__esModule=!0,t.exports.default=t.exports,_wrapNativeSuper(a)}t.exports=_wrapNativeSuper,t.exports.__esModule=!0,t.exports.default=t.exports})),yc=function(t){function CustomError(a,o,c){var m;return void 0===o&&(o={}),void 0===c&&(c=400),(m=t.call(this,a)||this).data=o,m.code=c,m.name="customError",m}return _t(CustomError,t),CustomError}(getDefaultExportFromCjs(gc)(Error)),hc=function(t){function ValidateError(a,o,c){var m;return void 0===o&&(o={}),(m=t.call(this,a,o,414)||this).code=414,m.name="validateError",m.rules=c,m}return _t(ValidateError,t),ValidateError}(yc),vc={200:null,406:null,808:null,810:null,201:"The client version is incorrect. You need to upgrade the SDK",302:"The user name or password is incorrect. Please check whether the appkey and token are valid and whether the account and token match",403:"Illegal operation or no permission",404:"Target object does not exist",405:"Parameter length too long",408:"Client request timed out",414:"Request parameter error",415:"Service unavailable",416:"Frequency control",417:"Repeat operation",422:"Account disabled",500:"Server internal error",503:"Server busy",508:"Expiration date",509:"Invalid",7101:"Be pulled black",700:"Partial failure of batch operation",801:"The number of people in the team has reached the upper limit",802:"No permission",803:"The team does not exist or has not changed",804:"The user is not in the team",805:"Team type mismatch",806:"The number of teams created has reached the limit",807:"Team member not valid",809:"Already in the team",811:"The number of accounts in the forced push list exceeds the limit",812:"The team is muted",813:"Due to the limited number of team, some pull people successfully",814:"Disable team message read service",815:"Maximum number of team administrators",816:"Batch operation partial failure",997:"The packet has expired",998:"Deserialize packet error",999:"Serialize packet error",9102:"Channel failure",9103:"This call has been answered / rejected at another end",10201:"Signaling: target NIM client is offline",10202:"Signaling: push is unreachable",10404:"Signaling: channel not exists",10405:"Signaling: channel already exists",10406:"Signaling: member of channel not exists",10407:"Signaling: member of channel already exists",10408:"Signaling: the invitation request does not exist or has expired",10409:"Signaling: the invitation request has been rejected",10410:"Signaling: the invitation request has been accepted",10414:"Signaling: request parameter error",10417:"Signaling: uid conflict",10419:"Signaling: the number of members of channel exceed the limit",10420:"Signaling: member is already in the channel on other client",10700:"Signaling: phased success",13002:"Abnormal chatroom status",13003:"In the blacklist",13004:"In the mute list",13006:"All members are muted, and only the administrator can speak"},bc=function(t){function CmdError(a,o,c,m,h){var v;return void 0===c&&(c=""),void 0===m&&(m=(new Date).getTime()),void 0===h&&(h={}),c=c||vc[a],(v=t.call(this,c,h,a)||this).name="cmdError",v.cmd=o,v.timetag=m,v}return _t(CmdError,t),CmdError}(yc);var Sc=function(t){function FormatError(a,o,c){var m;return(m=t.call(this,a,{},412)||this).code=412,m.name="formatError",m.key=o,m.reason=c,m}return _t(FormatError,t),FormatError}(yc),Tc=function(t){function UploadError(a,o,c,m,h){var v;return(v=t.call(this,a,{file:h},400)||this).name="uploadError",v.rawError=o,v.curProvider=c||1,v.mixStorePolicy=m,v}return _t(UploadError,t),UploadError}(yc),Mc=["error","warn","log","debug"],wc=function emptyFunc(){},_c=["off","error","warn","log","debug"],xc=function(){function Logger(t,a){this.name=a,this.strategies={debug:console.log,log:console.log,warn:console.warn,error:console.error},this.debug=wc,this.log=wc,this.warn=wc,this.error=wc,this.name=a,Logger.instancesName.push(a),includes(_c).call(_c,t)||(t="off"),this.setLogFunc(t)}var t=Logger.prototype;return t.setLogFunc=function setLogFunc(t){var a=this,o=findIndex$1(Mc).call(Mc,(function(a){return a===t}));forEach$1(Mc).call(Mc,(function(t,c){c<=o&&(a[t]=function(){var a=slice(Array.prototype).call(arguments),o=this.formatArgs(a,t);this.strategies[t](o)})}))},t.formatArgs=function formatArgs(t,a){var o=new Date,c=o.getMonth()+1+"-"+o.getDate()+" "+o.getHours()+":"+o.getMinutes()+":"+o.getSeconds()+":"+o.getMilliseconds();return"[NIM "+a+" "+this.name+" "+c+"] "+map(t).call(t,(function(t){return t instanceof yc?t.name+", "+t.code+", "+t.message:t instanceof Error?t&&t.message?t.message:t:"object"==typeof t?Oo(t):t})).join(" ")},Logger}();xc.instancesName=[];var kc=createCommonjsModule((function(t,a){t.exports=function(){function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,a){for(var o=0;o<a.length;o++){var c=a[o];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(t,c.key,c)}}function _createClass(t,a,o){return a&&_defineProperties(t.prototype,a),o&&_defineProperties(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}function __rest(t,a){var o={};for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&a.indexOf(c)<0&&(o[c]=t[c]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var m=0;for(c=Object.getOwnPropertySymbols(t);m<c.length;m++)a.indexOf(c[m])<0&&Object.prototype.propertyIsEnumerable.call(t,c[m])&&(o[c[m]]=t[c[m]])}return o}var t={reportUrl:"https://statistic.live.126.net/statics/report/common/form",maxSize:100,msgListMaxSize:1e3,cacheMaxSize:1e3,maxDelay:3e5,maxInterval:3e4,minInterval:1e4,timeout:5e3,autoStart:!0},a="https://statistic.live.126.net/dispatcher/req",o=function emptyFn(){},c=function(){function Reporter(a){_classCallCheck(this,Reporter),this.enable=!1,this.initConfigLoaded=!1,this.loading=!1,this.isDestroyed=!1,this.reportConfig=t,this.msgList=[],this.traceMsgCache={},this.lowPriorityMsgList=[],this.cacheMsgList=[],this.lastReportTime=Date.now(),this.timer=null,this.setConfig(a),this.reportConfig.autoStart&&this.initUploadConfig()}return _createClass(Reporter,[{key:"setConfig",value:function setConfig(t){this.reportConfig=Object.assign({},this.reportConfig,t)}},{key:"reportImmediately",value:function reportImmediately(t,a){var o=this;this.reportConfig.request(t,Object.assign({dataType:"json",method:"POST",timeout:this.reportConfig.timeout},a)).catch((function(t){var a,c;null===(c=null===(a=o.reportConfig)||void 0===a?void 0:a.logger)||void 0===c||c.warn("Reporter immediately upload failed",t)}))}},{key:"report",value:function report(t,a){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t){var c=Date.now();o?this.lowPriorityMsgList.push({module:t,msg:a,createTime:c}):this.msgList.push({module:t,msg:a,createTime:c}),this.msgList.length>this.reportConfig.msgListMaxSize&&this.msgList.shift(),this.lowPriorityMsgList.length>this.reportConfig.msgListMaxSize&&this.lowPriorityMsgList.shift(),this.doReport()}}},{key:"reportTraceStart",value:function reportTraceStart(t,a){if(t&&!this.traceMsgCache[t]){var o=Object.assign(Object.assign({start_time:Date.now()},a),{extension:[]});this.traceMsgCache[t]=o}}},{key:"reportTraceUpdate",value:function reportTraceUpdate(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.traceMsgCache[t]){var c,m=a.operation_type,h=a.code,v=a.target,b=a.error,S=__rest(a,["operation_type","code","target","error"]),T=Date.now(),M=this.traceMsgCache[t].extension.length;c=0===M?this.traceMsgCache[t].start_time:this.traceMsgCache[t].extension[M-1].end_time,b&&b.code&&(h=b.code),this.traceMsgCache[t].extension.push({operation_type:m,code:h,succeed:o,target:v,duration:T-c,description:JSON.stringify(S),end_time:T})}}},{key:"reportTraceUpdateV2",value:function reportTraceUpdateV2(t,a){if(this.traceMsgCache[t]){var o=this.traceMsgCache[t].extension.length;a.end_time=0===o?this.traceMsgCache[t].start_time+(a.duration?a.duration:0):this.traceMsgCache[t].extension[o-1].end_time+(a.duration?a.duration:0),this.traceMsgCache[t].extension.push(a)}}},{key:"reportTraceEnd",value:function reportTraceEnd(t){var a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.traceMsgCache[t]&&("nos"!==t||!1===a?("boolean"==typeof a?this.traceMsgCache[t].succeed=!!a:this.traceMsgCache[t].state=a,this.traceMsgCache[t].duration=Date.now()-this.traceMsgCache[t].start_time,this.traceMsgCache[t].extension.forEach((function(t){delete t.end_time})),this.report(t,this.traceMsgCache[t]),this.traceMsgCache[t]=null):this.traceMsgCache[t]=null)}},{key:"pause",value:function pause(){this.enable=!1}},{key:"restore",value:function restore(){this.enable=!0,this.initConfigLoaded||this.initUploadConfig()}},{key:"destroy",value:function destroy(){var t=this;Object.keys(this.traceMsgCache).forEach((function(a){t.reportTraceEnd(a,1)})),null!==this.timer&&clearTimeout(this.timer),this.setConfig=o,this.report=o,this.reportTraceStart=o,this.reportTraceUpdate=o,this.reportTraceEnd=o,this.pause=o,this.restore=o,this.destroy=o,this.cacheMsgList=[],this.traceMsgCache={},this.lowPriorityMsgList=[],this.msgList=[],this.reportConfig={},this.isDestroyed=!0}},{key:"initUploadConfig",value:function initUploadConfig(){var t,o,c=this;if(!this.loading){this.loading=!0;var m=this.reportConfig.common||{};try{this.reportConfig.request(a,{method:"GET",dataType:"json",params:{deviceId:m.dev_id,sdkVer:m.sdk_ver,platform:m.platform,appkey:m.app_key},timeout:this.reportConfig.timeout}).then((function(t){var a,o;if(!c.isDestroyed){if(200===t.status&&t.data&&200===t.data.code){var m=t.data.data||{};c.reportConfig.maxSize=m.maxSize>1e3?1e3:m.maxSize,c.reportConfig.maxInterval=m.maxInterval>1e4?1e4:m.maxInterval,c.reportConfig.maxInterval=m.maxInterval<10?10:m.maxInterval,c.reportConfig.minInterval=m.minInterval<2?2:m.minInterval,c.reportConfig.maxDelay=m.maxDelay||300,c.reportConfig.maxInterval=1e3*c.reportConfig.maxInterval,c.reportConfig.minInterval=1e3*c.reportConfig.minInterval,c.reportConfig.maxDelay=1e3*c.reportConfig.maxDelay,c.enable=!0,c.initConfigLoaded=!0,c.loading=!1,c.reportHeartBeat()}null===(o=null===(a=c.reportConfig)||void 0===a?void 0:a.logger)||void 0===o||o.log("Get reporter upload config success")}})).catch((function(t){var a,o;c.loading=!1,null===(o=null===(a=c.reportConfig)||void 0===a?void 0:a.logger)||void 0===o||o.error("Get reporter upload config failed",t)}))}catch(a){this.loading=!1,null===(o=null===(t=this.reportConfig)||void 0===t?void 0:t.logger)||void 0===o||o.error("Exec reporter request failed",a)}}}},{key:"reportHeartBeat",value:function reportHeartBeat(){var t=this;this.isDestroyed||(this.timer=setTimeout((function(){t.reportHeartBeat()}),this.reportConfig.minInterval),this.doReport())}},{key:"doReport",value:function doReport(){if(!this.isDestroyed){var t=this.msgList.length+this.lowPriorityMsgList.length+this.cacheMsgList.length>2*this.reportConfig.maxSize?this.reportConfig.minInterval:this.reportConfig.maxInterval;Date.now()-this.lastReportTime>=t&&this.upload()}}},{key:"getUploadMsg",value:function getUploadMsg(){var t=this,a={},o=Date.now();this.msgList=this.msgList.filter((function(a){return o-a.createTime<t.reportConfig.maxDelay})),this.lowPriorityMsgList=this.lowPriorityMsgList.filter((function(a){return o-a.createTime<t.reportConfig.maxDelay})),this.cacheMsgList=this.cacheMsgList.filter((function(a){return o-a.createTime<t.reportConfig.maxDelay}));var c=this.msgList.slice(0,this.reportConfig.maxSize);if(this.msgList=this.msgList.slice(c.length),c.length<this.reportConfig.maxSize){var m=this.reportConfig.maxSize-c.length;c=c.concat(this.lowPriorityMsgList.slice(0,m)),this.lowPriorityMsgList=this.lowPriorityMsgList.slice(m)}if(c.length<this.reportConfig.maxSize){var h=this.reportConfig.maxSize-c.length;c=c.concat(this.cacheMsgList.slice(0,h)),this.cacheMsgList=this.cacheMsgList.slice(h)}return c.forEach((function(t){a[t.module]?a[t.module].push(t.msg):a[t.module]=[t.msg]})),{uploadMsgArr:c,uploadMsg:a}}},{key:"upload",value:function upload(){var t,a,o=this;if(this.enable&&!(this.lastReportTime&&Date.now()-this.lastReportTime<this.reportConfig.minInterval)){var c=this.getUploadMsg(),m=c.uploadMsgArr,h=c.uploadMsg;if(m.length){this.lastReportTime=Date.now();try{this.reportConfig.request(this.reportConfig.reportUrl,{dataType:"json",method:"POST",params:{common:this.reportConfig.common,event:h},headers:{sdktype:"im"},timeout:this.reportConfig.timeout}).catch((function(t){var a,c;o.cacheMsgList=o.cacheMsgList.concat(m).slice(0,o.reportConfig.cacheMaxSize),null===(c=null===(a=o.reportConfig)||void 0===a?void 0:a.logger)||void 0===c||c.warn("Reporter upload failed",t)}))}catch(o){null===(a=null===(t=this.reportConfig)||void 0===t?void 0:t.logger)||void 0===a||a.warn("Exec reporter request failed",o)}clearTimeout(this.timer),this.reportHeartBeat()}}}}]),Reporter}();return c}()})),Ic={setLogger:function setLogger(t){throw new Error("Function not implemented.")},platform:"",WebSocket:function(){function AdapterSocket(t,a){throw this.CONNECTING=0,this.OPEN=1,this.CLOSING=2,this.CLOSED=3,new Error("Method not implemented.")}var t=AdapterSocket.prototype;return t.close=function close(t,a){throw new Error("Method not implemented.")},t.send=function send(t){throw new Error("Method not implemented.")},t.onclose=function onclose(t){throw new Error("Method not implemented.")},t.onerror=function onerror(t){throw new Error("Method not implemented.")},t.onmessage=function onmessage(t){throw new Error("Method not implemented.")},t.onopen=function onopen(t){throw new Error("Method not implemented.")},AdapterSocket}(),localStorage:{},request:function request(t,a){throw new Error("Function not implemented.")},uploadFile:function uploadFile(t){throw new Error("Function not implemented.")},getSystemInfo:function getSystemInfo(){throw new Error("Function not implemented.")}};var Cc=TypeError,createMethod$1=function(t){return function(a,o,c,m){aCallable(o);var h=toObject(a),v=U(h),b=lengthOfArrayLike(h),S=t?b-1:0,T=t?-1:1;if(c<2)for(;;){if(S in v){m=v[S],S+=T;break}if(S+=T,t?S<0:b<=S)throw Cc("Reduce of empty array with no initial value")}for(;t?S>=0:b>S;S+=T)S in v&&(m=o(m,v[S],S,h));return m}},Ec={left:createMethod$1(!1),right:createMethod$1(!0)}.left,Ac=arrayMethodIsStrict("reduce");_export({target:"Array",proto:!0,forced:!Ac||!Li&&X>79&&X<83},{reduce:function reduce(t){var a=arguments.length;return Ec(this,t,a,a>1?arguments[1]:void 0)}});var Pc=entryVirtual("Array").reduce,Oc=Array.prototype,reduce=function(t){var a=t.reduce;return t===Oc||z(Oc,t)&&a===Oc.reduce?Pc:a};var Rc=function isUndefined(t){return void 0===t},jc={},Fc={};function parseCmd(t,a){var o,c,m;try{m=JSON.parse(t)}catch(o){throw a.error("Parse command error: ",t),o}var h=m.sid+"_"+m.cid,v=m.r;if(includes(o=["4_1","4_2","4_10","4_11"]).call(o,h)){var b=m.r[1].headerPacket;h=b.sid+"_"+b.cid,v=m.r[1].body}var S,T=Fc[h],M=jc[T],w=function genCmdError(t,a){var o=vc[t];return null===o?null:new bc(t,a,o,(new Date).getTime())}(m.code,T),_={cmd:T,raw:m,error:w,service:null==M?void 0:M.service,content:{}};if(_.error){if(_.error.cmd=T,_.error.callFunc="parseCmd",!(null===(c=null==M?void 0:M.ignoreErrCodes)||void 0===c?void 0:includes(c).call(c,m.code)))return _;a.warn("parseCmd:: ignore error ",_.error),_.error.ignore=!0}if(!T||!M)return _.notFound=!0,_;M.response&&forEach$1(S=M.response).call(S,(function(t,a){var o=v[a],c=t.type,m=t.name,h=t.reflectMapper;if(!Rc(o))switch(c){case"Property":_.content[m]=h?deserialize(o,h):o;break;case"PropertyArray":_.content[m]=map(o).call(o,(function(t){return h?deserialize(t,h):t}));break;case"long":case"Long":case"byte":case"Byte":case"Number":_.content[m]=+o;break;default:_.content[m]=o}}));return _}function serialize(t,a){var o={};for(var c in t)void 0!==a[c]&&(o[a[c]]=t[c]);return o}function deserialize(t,a){var o={};for(var c in t)void 0!==a[c]&&(o[a[c]]=t[c]);return o}function registerParser(t){jc=Ao(jc,t.cmdConfig),Fc=Ao(Fc,t.cmdMap)}function invertSerializeMap(t){var a;return reduce(a=xo(t)).call(a,(function(a,o){var c,m=t[o];return a[o]=reduce(c=xo(m)).call(c,(function(t,a){return t[m[a]]=a,t}),{}),a}),{})}var Lc=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"],Nc=["transport not supported","client not handshaken","unauthorized"],Uc=["reconnect"],Bc=function(t){function NIMWebsocket(a,o,c){var m;return(m=t.call(this)||this).url=o,m.logger=c,m.websocket=null,m.core=a,m.url=o,m.status="disconnected",m.logger=c,m.connect(),m}_t(NIMWebsocket,t);var a=NIMWebsocket.prototype;return a.connect=function connect(){var t=this;"connecting"!==this.status&&"connected"!==this.status?(this.status="connecting",this.core.adapters.request("https://"+this.url+"/socket.io/1/?t="+vs(),{method:"GET",dataType:"text",timeout:8e3}).then((function(a){var o=a.data.split(":"),c=o[0],m=o[1];return t.sessionId=c,t.closeTimeout=1e3*m,t._createWebsocket("wss://"+t.url+"/socket.io/1/websocket/"+c)})).catch((function(a){t.logger.error("imsocket::handshake fail. ",a&&a.message),t.status="disconnected",t.emit("handshakeFailed")}))):this.logger.warn("imsocket::socket is connecting or connected",this.status)},a.close=function close(){var t;if(this.websocket){this.status="disconnected",this.websocket.onmessage=null,this.websocket.onopen=null,this.websocket.onerror=null;try{null===(t=this.websocket)||void 0===t||t.send(this.encodePacket({type:"disconnect"})),this.websocket.close()}catch(t){this.logger.warn("attempt to close websocket error",t)}this.websocket.onclose=null,this.websocket=null,this.emit("disconnect")}},a.onConnect=function onConnect(){this.status="connected",this.resetCloseTimer(),this.emit("connect")},a._createWebsocket=function _createWebsocket(t){var a,o=this;this.websocket=new Ic.WebSocket(t),this.websocket.onmessage=bind$1(a=this.onMessage).call(a,this),this.websocket.onclose=function(){o.logger.log("imsocket:: websocket onclose done"),"disconnected"!==o.status&&(o.logger.log("imsocket:: close()",o.status),o.close())},this.websocket.onerror=function(t){o.logger.error("imsocket:: onerror",t)}},a.onMessage=function onMessage(t){var a;this.resetCloseTimer();var o=this.decodePacket(t.data);if(o)switch(o.type){case"connect":this.onConnect();break;case"disconnect":this.close();break;case"message":case"json":this.emit("message",o.data);break;case"event":o.name&&this.emit(o.name,o.args);break;case"error":"unauthorized"===o.reason?this.emit("connect_failed",o.reason):this.emit("error",o.reason);break;case"heartbeat":null===(a=this.websocket)||void 0===a||a.send(this.encodePacket({type:"heartbeat"}));break;default:this.logger.warn("imsocket::no handler type",o.type)}},a.encodePacket=function encodePacket(t){var a,o,c=t.type,m=t.id,h=void 0===m?"":m,v=t.endpoint,b=void 0===v?"":v,S=t.ack,T=null;if(!c)return"";switch(c){case"error":a=t.reason?indexOf(Nc).call(Nc,t.reason):"",o=t.advice?indexOf(Uc).call(Uc,t.advice):"",""===a&&""===o||(T=a+(""!==o?"+"+o:""));break;case"message":""!==t.data&&(T=t.data);break;case"event":a={name:t.name},a=t.args&&t.args.length?{name:t.name,args:t.args}:{name:t.name},T=Oo(a);break;case"json":T=Oo(t.data);break;case"connect":t.qs&&(T=t.qs);break;case"ack":T=t.ackId+(t.args&&t.args.length?"+"+Oo(t.args):"")}var M=[indexOf(Lc).call(Lc,c),h+("data"===S?"+":""),b];return null!=T&&M.push(T),M.join(":")},a.decodePacket=function decodePacket(t){if(t)if("�"!=t.charAt(0)){var a=t.match(/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/);if(a){var o,c=a[1],m=a[2],h=a[3],v=a[4],b=a[5],S={type:Lc[+c],endpoint:v};switch(m&&(S.id=m,S.ack=!h||"data"),S.type){case"error":o=b.split("+"),S.reason=Nc[+o[0]]||"";break;case"message":S.data=b||"";break;case"connect":S.qs=b||"";break;case"event":try{var T=JSON.parse(b);S.name=T.name,S.args=T.args}catch(t){this.logger.error("imsocket::parseData::type::event error",t)}S.args=S.args||[];break;case"json":try{S.data=JSON.parse(b)}catch(t){this.logger.error("imsocket::parseData::type::json error",t)}break;case"ack":if((o=b.match(/^([0-9]+)(\+)?(.*)/))&&(S.ackId=o[1],S.args=[],o[3]))try{S.args=o[3]?JSON.parse(o[3]):[]}catch(t){this.logger.error("imsocket::parseData::type::ack error",t)}}return S}}else this.logger.error("imsocket::unrecognize dataStr",slice(t).call(t,0,20))},a.send=function send(t){var a,o={data:t,type:"message",endpoint:""};null===(a=this.websocket)||void 0===a||a.send(this.encodePacket(o))},a.resetCloseTimer=function resetCloseTimer(){var t=this;this.closeTimeout&&(clearTimeout(this.closeTimer),this.closeTimer=gs((function(){t.close()}),this.closeTimeout))},NIMWebsocket}(ws),qc=entryVirtual("Array").values,Dc=Array.prototype,Hc={DOMTokenList:!0,NodeList:!0},values=function(t){var a=t.values;return t===Dc||z(Dc,t)&&a===Dc.values||le(Hc,Ot(t))?qc:a};_export({target:"Array",stat:!0},{isArray:xt});var zc=H.Array.isArray,$c=_r.every,Gc=arrayMethodIsStrict("every");_export({target:"Array",proto:!0,forced:!Gc},{every:function every(t){return $c(this,t,arguments.length>1?arguments[1]:void 0)}});var Kc=entryVirtual("Array").every,Wc=Array.prototype,every=function(t){var a=t.every;return t===Wc||z(Wc,t)&&a===Wc.every?Kc:a};var Vc=function isObjectLike(t){return null!=t&&"object"==typeof t};var Jc=function baseIsRegExp(t){return Vc(t)&&"[object RegExp]"==Ns(t)};var Xc=function baseUnary(t){return function(a){return t(a)}},Yc=createCommonjsModule((function(t,a){var o=a&&!a.nodeType&&a,c=o&&t&&!t.nodeType&&t,m=c&&c.exports===o&&xs.process,h=function(){try{var t=c&&c.require&&c.require("util").types;return t||m&&m.binding&&m.binding("util")}catch(t){}}();t.exports=h})),Qc=Yc&&Yc.isRegExp,Zc=Qc?Xc(Qc):Jc,eu=Is["__core-js_shared__"],tu=function(){var t=/[^.]+$/.exec(eu&&eu.keys&&eu.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();var ru=function isMasked(t){return!!tu&&tu in t},nu=Function.prototype.toString;var iu=function toSource(t){if(null!=t){try{return nu.call(t)}catch(t){}try{return t+""}catch(t){}}return""},au=/^\[object .+?Constructor\]$/,ou=Function.prototype,su=Object.prototype,cu=ou.toString,uu=su.hasOwnProperty,lu=RegExp("^"+cu.call(uu).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var pu=function baseIsNative(t){return!(!Us(t)||ru(t))&&(Bs(t)?lu:au).test(iu(t))};var du=function getValue(t,a){return null==t?void 0:t[a]};var mu=function getNative(t,a){var o=du(t,a);return pu(o)?o:void 0},fu=mu(Object,"create");var gu=function hashClear(){this.__data__=fu?fu(null):{},this.size=0};var yu=function hashDelete(t){var a=this.has(t)&&delete this.__data__[t];return this.size-=a?1:0,a},hu=Object.prototype.hasOwnProperty;var vu=function hashGet(t){var a=this.__data__;if(fu){var o=a[t];return"__lodash_hash_undefined__"===o?void 0:o}return hu.call(a,t)?a[t]:void 0},bu=Object.prototype.hasOwnProperty;var Su=function hashHas(t){var a=this.__data__;return fu?void 0!==a[t]:bu.call(a,t)};var Tu=function hashSet(t,a){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=fu&&void 0===a?"__lodash_hash_undefined__":a,this};function Hash(t){var a=-1,o=null==t?0:t.length;for(this.clear();++a<o;){var c=t[a];this.set(c[0],c[1])}}Hash.prototype.clear=gu,Hash.prototype.delete=yu,Hash.prototype.get=vu,Hash.prototype.has=Su,Hash.prototype.set=Tu;var Mu=Hash;var wu=function listCacheClear(){this.__data__=[],this.size=0};var _u=function eq(t,a){return t===a||t!=t&&a!=a};var xu=function assocIndexOf(t,a){for(var o=t.length;o--;)if(_u(t[o][0],a))return o;return-1},ku=Array.prototype.splice;var Iu=function listCacheDelete(t){var a=this.__data__,o=xu(a,t);return!(o<0)&&(o==a.length-1?a.pop():ku.call(a,o,1),--this.size,!0)};var Cu=function listCacheGet(t){var a=this.__data__,o=xu(a,t);return o<0?void 0:a[o][1]};var Eu=function listCacheHas(t){return xu(this.__data__,t)>-1};var Au=function listCacheSet(t,a){var o=this.__data__,c=xu(o,t);return c<0?(++this.size,o.push([t,a])):o[c][1]=a,this};function ListCache(t){var a=-1,o=null==t?0:t.length;for(this.clear();++a<o;){var c=t[a];this.set(c[0],c[1])}}ListCache.prototype.clear=wu,ListCache.prototype.delete=Iu,ListCache.prototype.get=Cu,ListCache.prototype.has=Eu,ListCache.prototype.set=Au;var Pu=ListCache,Ou=mu(Is,"Map");var Ru=function mapCacheClear(){this.size=0,this.__data__={hash:new Mu,map:new(Ou||Pu),string:new Mu}};var ju=function isKeyable(t){var a=typeof t;return"string"==a||"number"==a||"symbol"==a||"boolean"==a?"__proto__"!==t:null===t};var Fu=function getMapData(t,a){var o=t.__data__;return ju(a)?o["string"==typeof a?"string":"hash"]:o.map};var Lu=function mapCacheDelete(t){var a=Fu(this,t).delete(t);return this.size-=a?1:0,a};var Nu=function mapCacheGet(t){return Fu(this,t).get(t)};var Uu=function mapCacheHas(t){return Fu(this,t).has(t)};var Bu=function mapCacheSet(t,a){var o=Fu(this,t),c=o.size;return o.set(t,a),this.size+=o.size==c?0:1,this};function MapCache(t){var a=-1,o=null==t?0:t.length;for(this.clear();++a<o;){var c=t[a];this.set(c[0],c[1])}}MapCache.prototype.clear=Ru,MapCache.prototype.delete=Lu,MapCache.prototype.get=Nu,MapCache.prototype.has=Uu,MapCache.prototype.set=Bu;var qu=MapCache;var Du=function setCacheAdd(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var Hu=function setCacheHas(t){return this.__data__.has(t)};function SetCache(t){var a=-1,o=null==t?0:t.length;for(this.__data__=new qu;++a<o;)this.add(t[a])}SetCache.prototype.add=SetCache.prototype.push=Du,SetCache.prototype.has=Hu;var zu=SetCache;var $u=function baseFindIndex(t,a,o,c){for(var m=t.length,h=o+(c?1:-1);c?h--:++h<m;)if(a(t[h],h,t))return h;return-1};var Gu=function baseIsNaN(t){return t!=t};var Ku=function strictIndexOf(t,a,o){for(var c=o-1,m=t.length;++c<m;)if(t[c]===a)return c;return-1};var Wu=function baseIndexOf(t,a,o){return a==a?Ku(t,a,o):$u(t,Gu,o)};var Vu=function arrayIncludes(t,a){return!!(null==t?0:t.length)&&Wu(t,a,0)>-1};var Ju=function arrayIncludesWith(t,a,o){for(var c=-1,m=null==t?0:t.length;++c<m;)if(o(a,t[c]))return!0;return!1};var Xu=function arrayMap(t,a){for(var o=-1,c=null==t?0:t.length,m=Array(c);++o<c;)m[o]=a(t[o],o,t);return m};var Yu=function cacheHas(t,a){return t.has(a)};var Qu=function baseDifference(t,a,o,c){var m=-1,h=Vu,v=!0,b=t.length,S=[],T=a.length;if(!b)return S;o&&(a=Xu(a,Xc(o))),c?(h=Ju,v=!1):a.length>=200&&(h=Yu,v=!1,a=new zu(a));e:for(;++m<b;){var M=t[m],w=null==o?M:o(M);if(M=c||0!==M?M:0,v&&w==w){for(var _=T;_--;)if(a[_]===w)continue e;S.push(M)}else h(a,w,c)||S.push(M)}return S};var Zu=function identity(t){return t};var el=function apply(t,a,o){switch(o.length){case 0:return t.call(a);case 1:return t.call(a,o[0]);case 2:return t.call(a,o[0],o[1]);case 3:return t.call(a,o[0],o[1],o[2])}return t.apply(a,o)},tl=Math.max;var rl=function overRest(t,a,o){return a=tl(void 0===a?t.length-1:a,0),function(){for(var c=arguments,m=-1,h=tl(c.length-a,0),v=Array(h);++m<h;)v[m]=c[a+m];m=-1;for(var b=Array(a+1);++m<a;)b[m]=c[m];return b[a]=o(v),el(t,this,b)}};var nl=function constant(t){return function(){return t}},il=function(){try{var t=mu(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),al=il?function(t,a){return il(t,"toString",{configurable:!0,enumerable:!1,value:nl(a),writable:!0})}:Zu,ol=Date.now;var sl=function shortOut(t){var a=0,o=0;return function(){var c=ol(),m=16-(c-o);if(o=c,m>0){if(++a>=800)return arguments[0]}else a=0;return t.apply(void 0,arguments)}},cl=sl(al);var ul=function isLength(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var ll=function isArrayLike(t){return null!=t&&ul(t.length)&&!Bs(t)};var pl=function isArrayLikeObject(t){return Vc(t)&&ll(t)},dl=function baseRest(t,a){return cl(rl(t,a,Zu),t+"")}((function(t,a){return pl(t)?Qu(t,a):[]})),ml=dl;function replacer(t,a){return a instanceof RegExp?"__REGEXP "+a.toString():a}function validate(t,a,o){var c;void 0===a&&(a={});var m={};return forEach$1(c=xo(t)).call(c,(function(c){var h=t[c].type,v=o?"In "+o+", ":"";if(void 0===a[c]){if(!1===t[c].required)return void(m[c]=a[c]);throw new hc(v+'param "'+c+'" is required',{key:c},"required")}var b=fl[h];if(b&&!b(a,c,t[c]))throw new hc(v+'param "'+c+'" expects '+Oo(t[c],replacer),{key:c,value:a[c]},Oo(t[c]));m[c]=a[c]})),m}var fl={string:function string(t,a,o){var c=o.allowEmpty,m=o.max,h=o.min,v=o.regExp,b=t[a];return"string"==typeof b&&((!1!==c||""!==b)&&(!("number"==typeof m&&b.length>m)&&(!("number"==typeof h&&b.length<h)&&!(Zc(v)&&!v.test(b)))))},number:function number(t,a,o){var c=o.min,m=o.max,h=t[a];return"number"==typeof h&&(!("number"==typeof c&&h<c)&&!("number"==typeof m&&h>m))},boolean:function boolean(t,a){return"boolean"==typeof t[a]},enum:function _enum(t,a,o){var c=values(o),m=t[a];return!c||indexOf(c).call(c,m)>-1},array:function array(t,a,o){var c,m=o.itemType,h=o.rules,v=o.min,b=o.max,S=values(o),T=t[a];return!!zc(T)&&(!("number"==typeof b&&T.length>b)&&(!("number"==typeof v&&T.length<v)&&(!(m&&"enum"!==m&&!every(T).call(T,(function(t){return typeof t===m})))&&(("enum"!==m||!S||!ml.apply(void 0,concat(c=[T]).call(c,S)).length)&&(h&&forEach$1(T).call(T,(function(t,o){return validate(h,t,a+"["+o+"]")})),!0)))))},object:function object(t,a,o){var c=o.rules,m=t[a];return c&&validate(c,m,a),!0}},gl=mu(Is,"Set");var yl=function noop(){};var hl=function setToArray(t){var a=-1,o=Array(t.size);return t.forEach((function(t){o[++a]=t})),o},vl=gl&&1/hl(new gl([,-0]))[1]==1/0?function(t){return new gl(t)}:yl,bl=vl;var Sl=function baseUniq(t,a,o){var c=-1,m=Vu,h=t.length,v=!0,b=[],S=b;if(o)v=!1,m=Ju;else if(h>=200){var T=a?null:bl(t);if(T)return hl(T);v=!1,m=Yu,S=new zu}else S=a?[]:b;e:for(;++c<h;){var M=t[c],w=a?a(M):M;if(M=o||0!==M?M:0,v&&w==w){for(var _=S.length;_--;)if(S[_]===w)continue e;a&&S.push(w),b.push(M)}else m(S,w,o)||(S!==b&&S.push(w),b.push(M))}return b};var Tl=function uniq(t){return t&&t.length?Sl(t):[]},Ml=_r.filter,wl=arrayMethodHasSpeciesSupport("filter");_export({target:"Array",proto:!0,forced:!wl},{filter:function filter(t){return Ml(this,t,arguments.length>1?arguments[1]:void 0)}});var _l=entryVirtual("Array").filter,xl=Array.prototype,filter=function(t){var a=t.filter;return t===xl||z(xl,t)&&a===xl.filter?_l:a},kl="\t\n\v\f\r                　\u2028\u2029\ufeff",Il=k("".replace),Cl="["+kl+"]",El=RegExp("^"+Cl+Cl+"*"),Al=RegExp(Cl+Cl+"*$"),createMethod=function(t){return function(a){var o=toString$1(requireObjectCoercible(a));return 1&t&&(o=Il(o,El,"")),2&t&&(o=Il(o,Al,"")),o}},Pl={start:createMethod(1),end:createMethod(2),trim:createMethod(3)}.trim,Ol=m.parseInt,Rl=m.Symbol,jl=Rl&&Rl.iterator,Fl=/^[+-]?0x/i,Ll=k(Fl.exec),Nl=8!==Ol(kl+"08")||22!==Ol(kl+"0x16")||jl&&!fails((function(){Ol(Object(jl))}))?function parseInt(t,a){var o=Pl(toString$1(t));return Ol(o,a>>>0||(Ll(Fl,o)?16:10))}:Ol;_export({global:!0,forced:parseInt!=Nl},{parseInt:Nl});var Ul,Bl=H.parseInt,ql=(Ul=function _s4(){return(65536*(1+Math.random())|0).toString(16).substring(1)},function(){return Ul()+Ul()+Ul()+Ul()+Ul()+Ul()+Ul()+Ul()});function getEnumKeys(t){var a;return filter(a=xo(t)).call(a,(function(t){return!(+t>=0)}))}function getEnumKeyByEnumValue(t,a){var o,c=filter(o=xo(t)).call(o,(function(o){return t[o]==a}));return c.length>0?c[0]:void 0}function getAccountFromSessionId(t,a){if(void 0===a&&(a="-"),!t)throw new Error("No sessionId");var o=indexOf(t).call(t,a);if(-1===o)throw new Error("Can not find conjunctions");var c=slice(t).call(t,0,o);return{accid:slice(t).call(t,o+1),scene:"super_team"===c?"superTeam":c}}var Dl=TypeError,Hl=Object.getOwnPropertyDescriptor,zl=I&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}()?function(t,a){if(xt(t)&&!Hl(t,"length").writable)throw Dl("Cannot set read only .length");return t.length=a}:function(t,a){return t.length=a},$l=TypeError,deletePropertyOrThrow=function(t,a){if(!delete t[a])throw $l("Cannot delete property "+tryToString(a)+" of "+tryToString(t))},Gl=arrayMethodHasSpeciesSupport("splice"),Kl=Math.max,Wl=Math.min;_export({target:"Array",proto:!0,forced:!Gl},{splice:function splice(t,a){var o,c,m,h,v,b,S=toObject(this),T=lengthOfArrayLike(S),M=toAbsoluteIndex(t,T),w=arguments.length;for(0===w?o=c=0:1===w?(o=0,c=T-M):(o=w-2,c=Wl(Kl(toIntegerOrInfinity(a),0),T-M)),doesNotExceedSafeInteger(T+o-c),m=arraySpeciesCreate(S,c),h=0;h<c;h++)(v=M+h)in S&&createProperty(m,h,S[v]);if(m.length=c,o<c){for(h=M;h<T-c;h++)b=h+o,(v=h+c)in S?S[b]=S[v]:deletePropertyOrThrow(S,b);for(h=T;h>T-c+o;h--)deletePropertyOrThrow(S,h-1)}else if(o>c)for(h=T-c;h>M;h--)b=h+o-1,(v=h+c-1)in S?S[b]=S[v]:deletePropertyOrThrow(S,b);for(h=0;h<o;h++)S[h+M]=arguments[h+2];return zl(S,T-c+o),m}});var Vl=entryVirtual("Array").splice,Jl=Array.prototype,splice=function(t){var a=t.splice;return t===Jl||z(Jl,t)&&a===Jl.splice?Vl:a},callWithSafeIterationClosing=function(t,a,o,c){try{return c?a(anObject(o)[0],o[1]):a(o)}catch(a){iteratorClose(t,"throw",a)}},Xl=Array,Yl=!checkCorrectnessOfIteration((function(t){Array.from(t)}));_export({target:"Array",stat:!0,forced:Yl},{from:function from(t){var a=toObject(t),o=Ht(this),c=arguments.length,m=c>1?arguments[1]:void 0,h=void 0!==m;h&&(m=functionBindContext(m,c>2?arguments[2]:void 0));var v,b,S,T,M,w,_=getIteratorMethod$5(a),x=0;if(!_||this===Xl&&isArrayIteratorMethod(_))for(v=lengthOfArrayLike(a),b=o?new this(v):Xl(v);v>x;x++)w=h?m(a[x],x):a[x],createProperty(b,x,w);else for(M=(T=getIterator(a,_)).next,b=o?new this:[];!(S=E(M,T)).done;x++)w=h?callWithSafeIterationClosing(T,m,[S.value,x],!0):S.value,createProperty(b,x,w);return b.length=x,b}});var Ql=H.Array.from,Zl=getIteratorMethod$5;function _createForOfIteratorHelperLoose$1(t,a){var o,c=void 0!==Wn&&Zl(t)||t["@@iterator"];if(c)return bind$1(o=(c=c.call(t)).next).call(o,c);if(zc(t)||(c=function _unsupportedIterableToArray$1(t,a){var o;if(!t)return;if("string"==typeof t)return _arrayLikeToArray$1(t,a);var c=slice(o=Object.prototype.toString.call(t)).call(o,8,-1);"Object"===c&&t.constructor&&(c=t.constructor.name);if("Map"===c||"Set"===c)return Ql(t);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return _arrayLikeToArray$1(t,a)}(t))||a&&t&&"number"==typeof t.length){c&&(t=c);var m=0;return function(){return m>=t.length?{done:!0}:{done:!1,value:t[m++]}}}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 _arrayLikeToArray$1(t,a){(null==a||a>t.length)&&(a=t.length);for(var o=0,c=new Array(a);o<a;o++)c[o]=t[o];return c}var ep,tp=function(){function TimerManager(){this.timerList=[],this.id=0,this.timer=null,this.timeout=0}var t=TimerManager.prototype;return t.addTimer=function addTimer(t,a,o){void 0===a&&(a=0),void 0===o&&(o=1);var c=(new Date).getTime(),m=this.id;return this.timerList.push({id:m,loop:o,count:0,timeout:c+a,interval:a,callback:t}),this.id++,this.checkTimer(c),m},t.checkTimer=function checkTimer(t){if(void 0===t&&(t=(new Date).getTime()),this.removeFinished(),0!==this.timerList.length||null==this.timer){for(var a,o,c=0,m=_createForOfIteratorHelperLoose$1(this.timerList);!(a=m()).done;){var h=a.value;(0===c||c>h.timeout)&&(c=h.timeout)}if(0!==this.timerList.length)if(null===this.timer||c<this.timeout||this.timeout<t)this.timer=gs(bind$1(o=this.nowTime).call(o,this),c-t),this.timeout=c}},t.nowTime=function nowTime(){for(var t,nowTime=(new Date).getTime(),a=_createForOfIteratorHelperLoose$1(this.timerList);!(t=a()).done;){var o=t.value;nowTime>=o.timeout&&(o.callback(),o.count++,o.timeout=nowTime+o.interval)}this.clerTime(),this.checkTimer(nowTime)},t.clerTime=function clerTime(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},t.deleteTimer=function deleteTimer(t){for(var a=this.timerList.length-1;a>=0;a--){var o;if(this.timerList[a].id===t)splice(o=this.timerList).call(o,a,1)}},t.removeFinished=function removeFinished(){for(var t=this.timerList.length-1;t>=0;t--){var a,o=this.timerList[t];if(o.loop>=0&&o.count>=o.loop)splice(a=this.timerList).call(a,t,1)}},t.destroy=function destroy(){this.clerTime(),this.timerList=[],this.id=0,this.timer=null},TimerManager}(),rp=function(){function CoreAdapters(t){this.core=t}var t=CoreAdapters.prototype;return t.request=function request(t,a){var o=this,c=(new Date).getTime();return Ic.request(t,a).catch((function(m){var h,v,b=m;throw o.core.reporter.reportTraceStart("exceptions",{user_id:o.core.options.account,trace_id:null===(v=null===(h=o.core)||void 0===h?void 0:h.socket)||void 0===v?void 0:v.sessionId,start_time:c,action:1}),o.core.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof b.code?b.code:0,description:b.message||""+b.code,operation_type:0,target:t,context:a?Oo(a):""}),o.core.reporter.reportTraceEnd("exceptions",1),m}))},t.uploadFile=function uploadFile(t){var a=this,o=(new Date).getTime();return Ic.uploadFile(t).catch((function(c){var m,h,v=c;a.core.reporter.reportTraceStart("exceptions",{user_id:a.core.options.account,trace_id:null===(h=null===(m=a.core)||void 0===m?void 0:m.socket)||void 0===h?void 0:h.sessionId,start_time:o,action:1});var b="BROWSER"===Ic.platform?t.chunkUploadHost:t.commonUploadHost?t.commonUploadHost+"/"+(t.nosToken&&t.nosToken.bucket):"https://nos.netease.com/nim";throw a.core.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof v.code?v.code:0,description:v.message||""+v.code,operation_type:1,target:b}),a.core.reporter.reportTraceEnd("exceptions",1),c}))},CoreAdapters}();!function(t){t[t.ACTIVE=1]="ACTIVE",t[t.KICKED=2]="KICKED",t[t.OFFLINE=3]="OFFLINE"}(ep||(ep={}));var np=window&&Bs(window.addEventListener)&&Bs(window.removeEventListener),ip=function(t){function Core(a,o){var m;(m=t.call(this)||this).status="unconnected",m.linkUrls=[],m.eventBus=new ws,m.packetSer=1,m.retryCount=0,m.reconnectTimer=0,m.backoff=new _s({max:8e3,min:1600,jitter:.01}),m.sendingCmdMap=new us,m.pingTimer=0,m.config=qs,m.abtInfo={},validate({linkUrls:{type:"array",itemType:"string",required:!1}},a),m.options=Ao(Ao({},Ds),a),m.adapters=new rp(c(m));var h=Ic.localStorage.getItem("__NIM_DEVC_ID__");m.options.isFixedDeviceId?(h=Ic.localStorage.getItem("__NIM_DEVC_ID__")||ql(),Ic.localStorage.setItem("__NIM_DEVC_ID__",h)):h=ql(),m.config=Ao(Ao(Ao({},qs),o),{deviceId:h}),m.timerManager=new tp,m.logger=new xc(m.options.debugLevel,m.options.account);var v=Ic.getSystemInfo();return m.reporter=new kc({common:{app_key:a.appkey,dev_id:h,platform:"Web",sdk_ver:"0.12.1",env:"online",os_name:v.os,os_ver:v.osVer,host_env:v.hostEnv,host_info:v.hostInfo,host_env_ver:v.hostEnvVer},request:Ic.request,logger:m.logger,autoStart:"BROWSER"===Ic.platform}),Ic.setLogger(m.logger),m.logger.log("Core init, version ","0.12.1"," sdk version ",90901," appkey ",a.appkey),m}_t(Core,t);var a=Core.prototype;return a.connect=function connect(t){return void 0===t&&(t={}),__awaiter(this,void 0,void 0,Mo.mark((function _callee(){var a,o,c,m,h,v;return Mo.wrap((function _callee$(b){for(;;)switch(b.prev=b.next){case 0:if(validate({linkUrls:{type:"array",itemType:"string",required:!1}},t),/^(unconnected|waitReconnect)$/.test(this.status)){b.next=5;break}return a="Core socket status is "+this.status+", and would not connect",this.logger.warn(a),b.abrupt("return",co.reject(a));case 5:this.status="connecting",t.linkUrls&&t.linkUrls.length>0&&(this.linkUrls=concat(o=t.linkUrls).call(o,this.linkUrls),this.linkUrls=Tl(this.linkUrls)),0===this.linkUrls.length&&this.linkUrls.push(Hs),c=0;case 9:if(!(c<this.linkUrls.length)){b.next=33;break}return m=this.linkUrls[c],h=(new Date).getTime(),b.prev=12,b.next=15,this.doConnect(m);case 15:return this.reporter.reportTraceUpdate("login",{operation_type:"TCP",target:m}),this.status="connected",this.logger.log("core:: connect success with url: "+m),this.abtRequest(),b.abrupt("return",m);case 22:b.prev=22,b.t0=b.catch(12),v=b.t0,this.reporter.reportTraceUpdate("login",{operation_type:"TCP",error:"ws_handshake_failed",target:m},!1),this.reporter.reportTraceStart("exceptions",{user_id:this.options.account,start_time:h,action:0}),this.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof v.code?v.code:0,description:v.message||""+v.code,operation_type:0,target:m}),this.reporter.reportTraceEnd("exceptions",1),this.logger.warn("core:: connect failed with url: "+m,b.t0);case 30:c++,b.next=9;break;case 33:throw this.reporter.reportTraceEnd("login",!1),0===this.retryCount?this.doDisconnect(ep.ACTIVE,"SocketHandshakeFailed"):this.doDisconnect(ep.OFFLINE,"ReconnectHadRetryAllLinks"),new Error("core: socket handshake failed");case 36:case"end":return b.stop()}}),_callee,this,[[12,22]])})))},a.doConnect=function doConnect(t){var a=this;return new co((function(o,c){var m;a.socket=new Bc(a,t,a.logger),a.socket.on("connect",(function(){a.logger.log("socket on connect",t),o()})),a.socket.on("message",bind$1(m=a.onMessage).call(m,a)),a.socket.on("disconnect",(function(t){a.logger.log("core:: socket on disconnect",t),a.doDisconnect(ep.OFFLINE,"SocketOnDisconnect")})),a.socket.on("handshakeFailed",(function(){a.logger.warn("core:: socket handshake failed"),c(new yc("handshake failed",{},408))}))}))},a.resetConnectStatus=function resetConnectStatus(){clearTimeout(this.reconnectTimer),this.backoff.reset(),this.retryCount=0,this.initOnlineListener()},a.doDisconnect=function doDisconnect(t,a){if(this.logger.log("doDisconnect: type "+t+", description "+a),"unconnected"!==this.status){this.markAllCmdInvaild(new yc("Packet timeout due to instance disconnect",{},408)),this.timerManager.destroy(),clearTimeout(this.pingTimer),this.socket&&("function"==typeof this.socket.removeAllListeners&&this.socket.removeAllListeners(),"function"==typeof this.socket.close&&this.socket.close(),this.socket=void 0);var o=!this.options.needReconnect||this.retryCount>=this.options.reconnectionAttempts;if(t===ep.ACTIVE||o)this.logger.log("doDisconnect: emit disconnect, type "+t,o),this.status="unconnected",this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.eventBus.emit("disconnect"),this.emit("disconnect"),this.destroyOnlineListener();else if(t===ep.KICKED){this.logger.log("doDisconnect: kicked"),this.status="unconnected",this.reconnectTimer&&clearTimeout(this.reconnectTimer);var c="string"==typeof a?{reason:"unknow",message:a}:a;this.eventBus.emit("kicked",c),this.emit("kicked",c),this.destroyOnlineListener()}else t===ep.OFFLINE?(this.logger.log("doDisconnect: start to reconnect"),this.attempToReconnect()):this.logger.log("doDisconnect: nothing to do")}else this.logger.warn("doDisconnect: already unconnected")},a.attempToReconnect=function attempToReconnect(){var t=this;if("waitReconnect"!==this.status){var a=this.backoff.duration();this.retryCount++,this.logger.log("willReconnect "+this.retryCount+" "+a),this.eventBus.emit("willReconnect",{retryCount:this.retryCount,duration:a}),this.emit("willReconnect",{retryCount:this.retryCount,duration:a}),this.status="waitReconnect",this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=gs((function(){"waitReconnect"===t.status?t.connect({isAutoReconnect:!0}).catch((function(){t.logger.error("core::attempToReconnect failed "+t.retryCount)})):t.logger.warn("doDisconnect: reconnectTimer status is "+t.status+", would not go on reconnecting")}),a)}else this.logger.warn("doDisconnect: already is waiting reconnect")},a.sendCmd=function sendCmd(t,a,o){var c=this;if("logined"!==this.status&&"login"!==t&&"chatroomLogin"!==t&&"qchatLogin"!==t)return this.logger.warn("nim status is "+this.status+", so can not sendCmd "+t),co.reject({cmd:t,error:{code:"No_connected",message:"Connection not established",timetag:(new Date).getTime()}});if(!this.socket||!this.socket.send)return co.reject("No_socket");var m="heartbeat"!==t,h=m?this.packetSer++:0,v=function createCmd(t,a,o,c){var m=jc[t];if(!m)return o.error("createCmd:: can not find cmd config: ",t),null;var h,v={SER:a,SID:m.sid,CID:m.cid,Q:[]};return m.params&&c&&forEach$1(h=m.params).call(h,(function(t){var a=c[t.name];if(!Rc(a)){var o=t.type,m=t.reflectMapper;switch(t.type){case"PropertyArray":o="ArrayMable",a=map(a).call(a,(function(t){return{t:"Property",v:m?serialize(t,m):t}}));break;case"Property":a=m?serialize(a,m):a;break;case"Bool":case"bool":a=a?"true":"false"}v.Q.push({t:o,v:a})}})),{packet:v,isNoResponse:m.isNoResponse||!1}}(t,h,this.logger,a);if(!v){var b="SendCmd "+h+" "+t+" error";return this.logger.error(b),co.reject(b)}var S=v.packet,T=v.isNoResponse,M=Oo(S);m&&("debug"===this.options.debugLevel?this.logger.debug("core::sendCmd",t,"ser:"+h,M):this.logger.log("core::sendCmd",t,"ser:"+h));var w=(new Date).getTime();return new co((function(m,v){c.sendingCmdMap.set(h,{cmd:t,params:a,callback:[m,v],timer:T?null:gs((function(){var a,o=new bc(504,t,"Packet Timeout",(new Date).getTime(),{message:"ser "+h+" cmd "+t+" timeout"});o.callFunc="sendCmd",c.markCmdInvalid(h,o,t),c.reporter.reportTraceStart("exceptions",{user_id:c.options.account,trace_id:null===(a=c.socket)||void 0===a?void 0:a.sessionId,start_time:w,action:2}),c.reporter.reportTraceUpdateV2("exceptions",{code:408,description:"Packet timeout",operation_type:1,target:S.SID+"-"+S.CID,context:""+S.SER}),c.reporter.reportTraceEnd("exceptions",1)}),o&&o.timeout?o.timeout:c.config.timeout)});try{c.socket.send(M)}catch(a){var b=new bc(415,t,a&&a.message||"Unable to send packet",(new Date).getTime(),{message:"send json error",rawError:a});b.callFunc="sendCmd",c.markCmdInvalid(h,b,t),v(a)}}))},a.onMessage=function onMessage(t){var a=parseCmd(t,this.logger);if(a){var o=a.raw.ser;if(a.error&&this.logger.error("core:onMessage packet error",a.raw.sid+"_"+a.raw.cid+", ser:"+o+",",a.error),!a.notFound)return"heartbeat"!==a.cmd&&("debug"===this.options.debugLevel?this.logger.debug("imsocket::recvCmd ser:"+o,a.cmd,a.content):this.logger.log("imsocket::recvCmd ser:"+o,a.cmd)),a.__receiveTime=vs(),a;this.logger.warn("core::onMessage packet not found",a.raw.sid+"_"+a.raw.cid+", ser:"+o)}},a.markCmdInvalid=function markCmdInvalid(t,a,o){var c=this.sendingCmdMap.get(t);if(c){var m=c.callback,h=c.timer;h&&clearTimeout(h),this.sendingCmdMap.delete(t),this.logger.warn("packet "+t+", "+o+" is invalid:",a),m[1](a)}},a.markAllCmdInvaild=function markAllCmdInvaild(t){var a;this.logger.log("markAllCmdInvaild"),forEach$1(a=this.sendingCmdMap).call(a,(function(a){var o=a.callback,c=a.timer;c&&clearTimeout(c),o[1](t)})),this.sendingCmdMap.clear()},a.ping=function ping(){return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var t=this;return Mo.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:return clearTimeout(this.pingTimer),a.prev=1,a.next=4,this.sendCmd("heartbeat");case 4:a.next=14;break;case 6:return a.prev=6,a.t0=a.catch(1),a.next=10,this.testHeartBeat5Timeout();case 10:if(!a.sent){a.next=14;break}return this.doDisconnect(ep.OFFLINE,"PingError"),a.abrupt("return");case 14:this.pingTimer=gs((function(){t.ping()}),3e4);case 15:case"end":return a.stop()}}),_callee2,this,[[1,6]])})))},a.testHeartBeat5Timeout=function testHeartBeat5Timeout(){return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){var t;return Mo.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:clearTimeout(this.pingTimer),t=0;case 2:if(!(t<5)){a.next=15;break}return a.prev=3,a.next=6,this.sendCmd("heartbeat",{},{timeout:3e3});case 6:return a.abrupt("return",!1);case 9:a.prev=9,a.t0=a.catch(3),this.logger.debug("core:: test heartbeat "+t+" Timeout");case 12:t++,a.next=2;break;case 15:return a.abrupt("return",!0);case 16:case"end":return a.stop()}}),_callee3,this,[[3,9]])})))},a.initOnlineListener=function initOnlineListener(){var t,a;this.onlineListener||(np?(this.onlineListener=bind$1(t=function _context7(){"logined"===this.status&&this.ping()}).call(t,this),this.offlineListener=bind$1(a=function _context8(){this.logger.log("offline"),this.doDisconnect(ep.OFFLINE,"OfflineListener")}).call(a,this),window.addEventListener("online",this.onlineListener),window.addEventListener("offline",this.offlineListener)):this.logger.warn("initOnlineListener not support add listener"))},a.destroyOnlineListener=function destroyOnlineListener(){this.onlineListener&&(window.removeEventListener("online",this.onlineListener),this.onlineListener=void 0),this.offlineListener&&(window.removeEventListener("offline",this.offlineListener),this.offlineListener=void 0)},a.disconnect=function disconnect(){switch(this.status){case"connected":case"logined":case"connecting":case"waitReconnect":return this.doDisconnect(ep.ACTIVE,"UserActiveDisconnect"),co.resolve();case"unconnected":case"destroyed":return co.resolve()}},a.destroy=function destroy(){var t=this;return this.disconnect().then((function(){t.status="destroyed",t.removeAllListeners(),t.eventBus.removeAllListeners(),t.reporter.destroy(),t.connect=function(){return co.resolve()},t.disconnect=function(){return co.resolve()},t.destroy=function(){return co.resolve()}}))},a.abtRequest=function abtRequest(){var t,a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee4(){var o,c;return Mo.wrap((function _callee4$(m){for(;;)switch(m.prev=m.next){case 0:if(this.options.isAbtestEnable){m.next=2;break}return m.abrupt("return");case 2:if(!this.abtInfo.experiments){m.next=4;break}return m.abrupt("return");case 4:if(this.options.abtestUrl){m.next=6;break}return m.abrupt("return");case 6:return m.prev=6,m.next=9,this.adapters.request(this.options.abtestUrl,{method:"POST",dataType:"json",headers:{sdktype:"ABTest"},params:{clientInfo:{projectKey:this.options.abtestProjectKey,appKey:this.options.appkey,osType:"Web",sdkVersion:"0.12.1",deviceId:this.config.deviceId},useLocalCache:!0}});case 9:o=m.sent,m.next=15;break;case 12:m.prev=12,m.t0=m.catch(6),this.logger.warn("ABTest request failed");case 15:this.abtInfo=(null===(a=null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.data)||void 0===a?void 0:a.abtInfo)||{},this.abtInfo.experiments&&this.abtInfo.experiments.length>0&&this.reporter.reportImmediately("https://statistic.live.126.net/statics/report/abtest/result",{params:{app_key:this.options.appkey,biz_sdk_type:"IM",sdk_ver:"0.12.1",device_id:this.config.deviceId,platform:"Web",projectKey:this.options.abtestProjectKey,experiments:map(c=this.abtInfo.experiments).call(c,(function(t){return{experimentKey:t.experimentKey,schemeKey:t.schemeKey}}))},headers:{sdktype:"ABTest"},method:"POST",dataType:"json"});case 17:case"end":return m.stop()}}),_callee4,this,[[6,12]])})))},Core}(ws);ip.setAdapters=function setAdapters(t){Ao(Ic,t)};var ap={"1_2":"heartbeat","2_3":"login","2_5":"kicked","2_6":"logout","2_7":"multiPortLogin","2_8":"kick"},op={login:{clientType:3,os:4,sdkVersion:6,appLogin:8,protocolVersion:9,pushTokenName:10,pushToken:11,deviceId:13,appkey:18,account:19,browser:24,session:26,deviceInfo:32,isReactNative:112,token:1e3,customTag:38,customClientType:39,sdkHumanVersion:40,sdkType:41,userAgent:42,authType:115,loginExt:116},loginRes:{lastLoginDeviceId:17,customTag:38,connectionId:102,ip:103,port:104,country:106,hasXMPush:111},loginPort:{type:3,os:4,mac:5,deviceId:13,account:19,deviceInfo:32,customTag:38,connectionId:102,ip:103,time:109},aosPushInfo:{pushType:110,hasTokenPreviously:111}},sp=invertSerializeMap(op),cp={login:{sid:2,cid:3,service:"auth",params:[{type:"Property",name:"login",reflectMapper:op.login}],response:[{type:"Property",name:"loginRes",reflectMapper:sp.loginRes},{type:"PropertyArray",name:"loginPorts",reflectMapper:sp.loginPort},{type:"Property",name:"aosPushInfo",reflectMapper:sp.aosPushInfo}]},logout:{sid:2,cid:6,service:"auth"},heartbeat:{sid:1,cid:2,service:"auth"},kicked:{sid:2,cid:5,service:"auth",response:[{type:"Number",name:"clientType"},{type:"Number",name:"reason"},{type:"String",name:"ext"},{type:"Number",name:"customClientType"}]},multiPortLogin:{sid:2,cid:7,service:"auth",response:[{type:"Number",name:"state"},{type:"PropertyArray",name:"loginPorts",reflectMapper:sp.loginPort}]},kick:{sid:2,cid:8,service:"auth",params:[{type:"StrArray",name:"deviceIds"}],response:[{type:"StrArray",name:"deviceIds"}]}},up=Array.isArray;var lp=function isSymbol(t){return"symbol"==typeof t||Vc(t)&&"[object Symbol]"==Ns(t)},pp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,dp=/^\w*$/;var mp=function isKey(t,a){if(up(t))return!1;var o=typeof t;return!("number"!=o&&"symbol"!=o&&"boolean"!=o&&null!=t&&!lp(t))||(dp.test(t)||!pp.test(t)||null!=a&&t in Object(a))};function memoize(t,a){if("function"!=typeof t||null!=a&&"function"!=typeof a)throw new TypeError("Expected a function");var memoized=function(){var o=arguments,c=a?a.apply(this,o):o[0],m=memoized.cache;if(m.has(c))return m.get(c);var h=t.apply(this,o);return memoized.cache=m.set(c,h)||m,h};return memoized.cache=new(memoize.Cache||qu),memoized}memoize.Cache=qu;var fp=memoize;var gp=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yp=/\\(\\)?/g,hp=function memoizeCapped(t){var a=fp(t,(function(t){return 500===o.size&&o.clear(),t})),o=a.cache;return a}((function(t){var a=[];return 46===t.charCodeAt(0)&&a.push(""),t.replace(gp,(function(t,o,c,m){a.push(c?m.replace(yp,"$1"):o||t)})),a})),vp=hp,bp=Cs?Cs.prototype:void 0,Sp=bp?bp.toString:void 0;var Tp=function baseToString(t){if("string"==typeof t)return t;if(up(t))return Xu(t,baseToString)+"";if(lp(t))return Sp?Sp.call(t):"";var a=t+"";return"0"==a&&1/t==-Infinity?"-0":a};var Mp=function toString(t){return null==t?"":Tp(t)};var wp=function castPath(t,a){return up(t)?t:mp(t,a)?[t]:vp(Mp(t))};var _p=function toKey(t){if("string"==typeof t||lp(t))return t;var a=t+"";return"0"==a&&1/t==-Infinity?"-0":a};var xp=function baseGet(t,a){for(var o=0,c=(a=wp(a,t)).length;null!=t&&o<c;)t=t[_p(a[o++])];return o&&o==c?t:void 0};var kp=function get(t,a,o){var c=null==t?void 0:xp(t,a);return void 0===c?o:c},Ip={debugLevel:"off",needReconnect:!0,reconnectionAttempts:wo,lbsUrls:["https://lbs.netease.im/lbs/webconf.jsp"],linkUrl:Hs,isAbtestEnable:!0,abtestUrl:"https://abt-online.netease.im/v1/api/abt/client/getExperimentInfo",abtestProjectKey:"imElite_sdk_abtest_web"},Cp={},Ep=function(t){function NIM(a,o){var m,h;void 0===o&&(o={serverConfig:{},syncOptions:{},sessionConfig:{}}),(h=t.call(this,a)||this).instanceName="NIM",h.account="",h.options={},h.auth={},h.sync={},h.msg={},h.msgLog={},h.session={},h.cloudSession={},h.misc={},h.user={},h.friend={},h.systemMessage={},h.team={},h.event={},h.msgExtend={},h.cloudStorage={},h.passThrough={},h.superTeam={},h.plugin={},h.signaling={},h.setOptions(a),registerParser({cmdMap:ap,cmdConfig:cp});var v=null;return forEach$1(m=xo(Cp)).call(m,(function(t){var a=Cp[t];"sync"===t?v=a:h[t]="session"===t?new a(c(h),o.sessionConfig):"cloudStorage"===t?new a(c(h),Ao({storageKeyPrefix:h.instanceName},o.serverConfig,o.cloudStorageConfig)):new a(c(h))})),v&&(h.sync=new v(c(h),o.syncOptions)),h.eventBus.on("willReconnect",(function(){h.reporter.reportTraceStart("login",{user_id:h.account,action:"auto_login"}),h.reporter.reportTraceUpdateV2("login",{code:0,description:Oo(Ao(Ao({},h.options),{account:"***",token:"***"})),duration:0,operation_type:"conf_init",succeed:!0,target:""})})),NIM.instance=c(h),h}_t(NIM,t),NIM.getInstance=function getInstance(t,a){if(!NIM.instance){if(t)return new NIM(t,a);throw new Error("Instance not exist, please input options")}if(t){if(NIM.instance.options.account===t.account&&NIM.instance.options.appkey===t.appkey)return NIM.instance.setOptions(t),NIM.instance;throw new Error("Unexpected login")}return NIM.instance};var a=NIM.prototype;return a.setOptions=function setOptions(t){validate({account:{type:"string"},appkey:{type:"string"},token:{type:"string"},needReconnect:{type:"boolean",required:!1},reconnectionAttempts:{type:"number",required:!1},customClientType:{type:"number",min:1,required:!1},authType:{type:"number",min:0,max:2,required:!1},lbsUrls:{type:"array",itemType:"string",min:1,required:!1},linkUrl:{type:"string",allowEmpty:!1,required:!1}},t),this.logger.log("NIM::setOptions options is",t),this.account=t.account,this.options=Ao(Ao({},Ip),t)},a.connect=function connect(a){void 0===a&&(a={});var o=lt(null,{connect:{get:function get(){return t.prototype.connect}}});return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var t;return Mo.wrap((function _callee$(c){for(;;)switch(c.prev=c.next){case 0:if(/^(unconnected|waitReconnect)$/.test(this.status)){c.next=4;break}return t="NIM status is "+this.status+", and would not connect",this.logger.warn(t),c.abrupt("return",co.reject(t));case 4:return a.isAutoReconnect||(this.reporter.reportTraceStart("login",{user_id:this.options.account,action:"manual_login"}),this.reporter.reportTraceUpdateV2("login",{code:0,description:Oo(Ao(Ao({},this.options),{account:"***",token:"***"})),operation_type:"conf_init",succeed:!0,duration:0,target:""})),c.next=7,this.getLbsInfos();case 7:return c.next=9,o.connect.call(this,a);case 9:return c.next=11,this.login(a.isAutoReconnect);case 11:case"end":return c.stop()}}),_callee,this)})))},a.login=function login(t){return void 0===t&&(t=!1),__awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var a;return Mo.wrap((function _callee2$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,this.auth.doLogin(t);case 3:a=o.sent,this.reporter.reportTraceUpdate("login",{operation_type:"protocol",target:"2-2"}),this.reporter.reportTraceEnd("login",!0),this.status="logined",o.next=19;break;case 9:if(o.prev=9,o.t0=o.catch(0),this.logger.warn("nim login:: login failed",o.t0),this.reporter.reportTraceUpdate("login",{operation_type:"protocol",error:o.t0},!1),this.reporter.reportTraceEnd("login",!1),0!==this.retryCount){o.next=17;break}throw this.doDisconnect(ep.ACTIVE,"FailedToInitializeLogin"),o.t0;case 17:return this.doDisconnect(ep.OFFLINE,"ReconnectLoginFailed"),o.abrupt("return");case 19:return o.prev=19,o.next=22,this.cloudStorage.init();case 22:o.next=27;break;case 24:o.prev=24,o.t1=o.catch(19),this.logger.error("NIM:login cloudStorage init failed ",o.t1);case 27:if(this.eventBus.emit("logined",a),this.emit("logined",a),this.logger.log("login done"),this.resetConnectStatus(),!this.sync||!this.sync.doSync){o.next=34;break}return o.next=34,this.sync.doSync();case 34:this.ping();case 35:case"end":return o.stop()}}),_callee2,this,[[0,9],[19,24]])})))},a.onMessage=function onMessage(a){var o,c,m=t.prototype.onMessage.call(this,a);if(m){var h=m.raw.ser,v=this.sendingCmdMap.get(h);if(v&&v.cmd===m.cmd){var b=v.callback,S=v.timer,T=v.params;if(clearTimeout(S),m.params=T,this.sendingCmdMap.delete(h),"heartbeat"===m.cmd)return void b[0]();var M=null===(o=this[m.service])||void 0===o?void 0:o.process(m);M&&"function"==typeof M.then?M.then((function(t){b[0](t)})).catch((function(t){b[1](t)})):(this.logger.log("imsocket:: handlerFn without promise",m.service,m.cmd),b[0]())}else null===(c=this[m.service])||void 0===c||c.process(m)}},a.getLbsInfos=function getLbsInfos(){var t;return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){var a,o,c,m,h,v,b,S;return Mo.wrap((function _callee3$(T){for(;;)switch(T.prev=T.next){case 0:return a=this.options.lbsUrls[0],o=indexOf(a).call(a,"?")>-1?"&":"?",c=a+o+"k="+this.options.appkey+"&id="+this.options.account+"&sv=180&pv=1&networkType=0",T.prev=3,this.logger.log("getLbsInfos ",c),T.next=7,this.adapters.request(c,{method:"GET",dataType:"json",timeout:1e4});case 7:if(200===(h=T.sent).status&&h.data){T.next=11;break}throw this.logger.error("getLbsInfos::error status",h.status,h),new Error("getLbsInfos failed, status "+h.status);case 11:this.reporter.reportTraceUpdate("login",{operation_type:"HTTP",target:c}),v=h.data,b=[this.options.linkUrl],kp(v,"common.link")&&(b=concat(S=kp(v,"common.link")).call(S,b)),kp(v,'common["link.default"]')&&(b=concat(b).call(b,kp(v,'common["link.default"]'))),this.linkUrls=Tl(b),h.data["nos-chunk"]&&(null===(t=this.cloudStorage)||void 0===t||t.setOptions({chunkUploadHost:h.data["nos-chunk"]})),this.logger.log("getLbsInfos success, socket link:",slice(m=this.linkUrls).call(m,0),"chunkUploadHost: ",h.data["nos-chunk"]),T.next=26;break;case 21:T.prev=21,T.t0=T.catch(3),this.logger.error("getLbsInfos::error",T.t0&&T.t0.message,T.t0),this.linkUrls=[this.options.linkUrl],this.reporter.reportTraceUpdate("login",{operation_type:"HTTP",target:c},!1);case 26:case"end":return T.stop()}}),_callee3,this,[[3,21]])})))},a.disconnect=function disconnect(){var a=this;switch(this.status){case"connected":case"logined":return this.sendCmd("logout").then((function(){t.prototype.doDisconnect.call(a,ep.ACTIVE,"UserActiveDisconnect")}));case"connecting":case"waitReconnect":return t.prototype.doDisconnect.call(this,ep.ACTIVE,"UserActiveDisconnect"),co.resolve();case"unconnected":case"destroyed":return co.resolve()}},a.destroy=function destroy(){return NIM.instance=null,t.prototype.destroy.call(this)},a.kick=function kick(t){return validate({deviceIds:{type:"array",itemType:"string"}},t),this.auth.kick(t)},NIM.registerService=function registerService(t,a){Cp[a]=t},NIM}(ip);Ep.instance=null;var Ap=Math.min,Pp=[].lastIndexOf,Op=!!Pp&&1/[1].lastIndexOf(1,-0)<0,Rp=arrayMethodIsStrict("lastIndexOf"),jp=Op||!Rp?function lastIndexOf(t){if(Op)return T(Pp,this,arguments)||0;var a=toIndexedObject(this),o=lengthOfArrayLike(a),c=o-1;for(arguments.length>1&&(c=Ap(c,toIntegerOrInfinity(arguments[1]))),c<0&&(c=o+c);c>=0;c--)if(c in a&&a[c]===t)return c||0;return-1}:Pp;_export({target:"Array",proto:!0,forced:jp!==[].lastIndexOf},{lastIndexOf:jp});var Fp=entryVirtual("Array").lastIndexOf,Lp=Array.prototype,lastIndexOf=function(t){var a=t.lastIndexOf;return t===Lp||z(Lp,t)&&a===Lp.lastIndexOf?Fp:a},Np=createCommonjsModule((function(a,o){(function(){var c={function:!0,object:!0}[typeof window]&&window||this,m=o,h=a&&!a.nodeType&&a,v=m&&h&&"object"==typeof t&&t;!v||v.global!==v&&v.window!==v&&v.self!==v||(c=v);var b=Math.pow(2,53)-1,S=/\bOpera/,T=Object.prototype,M=T.hasOwnProperty,w=T.toString;function capitalize(t){return(t=String(t)).charAt(0).toUpperCase()+t.slice(1)}function format(t){return t=trim(t),/^(?:webOS|i(?:OS|P))/.test(t)?t:capitalize(t)}function forOwn(t,a){for(var o in t)M.call(t,o)&&a(t[o],o,t)}function getClassOf(t){return null==t?capitalize(t):w.call(t).slice(8,-1)}function qualify(t){return String(t).replace(/([ -])(?!$)/g,"$1?")}function reduce(t,a){var o=null;return function each(t,a){var o=-1,c=t?t.length:0;if("number"==typeof c&&c>-1&&c<=b)for(;++o<c;)a(t[o],o,t);else forOwn(t,a)}(t,(function(c,m){o=a(o,c,m,t)})),o}function trim(t){return String(t).replace(/^ +| +$/g,"")}var _=function parse(t){var a=c,o=t&&"object"==typeof t&&"String"!=getClassOf(t);o&&(a=t,t=null);var m=a.navigator||{},h=m.userAgent||"";t||(t=h);var v,b,T=o?!!m.likeChrome:/\bChrome\b/.test(t)&&!/internal|\n/i.test(w.toString()),M="Object",_=o?M:"ScriptBridgingProxyObject",x=o?M:"Environment",k=o&&a.java?"JavaPackage":getClassOf(a.java),I=o?M:"RuntimeObject",C=/\bJava/.test(k)&&a.java,E=C&&getClassOf(a.environment)==x,A=C?"a":"α",P=C?"b":"β",O=a.document||{},R=a.operamini||a.opera,j=S.test(j=o&&R?R["[[Class]]"]:getClassOf(R))?j:R=null,L=t,N=[],U=null,B=t==h,q=B&&R&&"function"==typeof R.version&&R.version(),D=function getLayout(a){return reduce(a,(function(a,o){return a||RegExp("\\b"+(o.pattern||qualify(o))+"\\b","i").exec(t)&&(o.label||o)}))}([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"]),H=function getName(a){return reduce(a,(function(a,o){return a||RegExp("\\b"+(o.pattern||qualify(o))+"\\b","i").exec(t)&&(o.label||o)}))}(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"(?:Edge|Edg|EdgA|EdgiOS)"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Vivaldi","Waterfox","WebPositive",{label:"Yandex Browser",pattern:"YaBrowser"},{label:"UC Browser",pattern:"UCBrowser"},"Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chromium","Chrome",{label:"Chrome",pattern:"(?:HeadlessChrome)"},{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),z=getProduct([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),$=function getManufacturer(a){return reduce(a,(function(a,o,c){return a||(o[z]||o[/^[a-z]+(?: +[a-z]+\b)*/i.exec(z)]||RegExp("\\b"+qualify(c)+"(?:\\b|\\w*\\d)","i").exec(t))&&c}))}({Apple:{iPad:1,iPhone:1,iPod:1},Alcatel:{},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},Huawei:{},Lenovo:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Oppo:{},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1},Xiaomi:{Mi:1,Redmi:1}}),G=function getOS(a){return reduce(a,(function(a,o){var c=o.pattern||qualify(o);return!a&&(a=RegExp("\\b"+c+"(?:/[\\d.]+|[ \\w.]*)","i").exec(t))&&(a=function cleanupOS(t,a,o){var c={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"Server 2008 R2 / 7","6.0":"Server 2008 / Vista",5.2:"Server 2003 / XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return a&&o&&/^Win/i.test(t)&&!/^Windows Phone /i.test(t)&&(c=c[/[\d.]+$/.exec(t)])&&(t="Windows "+c),t=String(t),a&&o&&(t=t.replace(RegExp(a,"i"),o)),format(t.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}(a,c,o.label||o)),a}))}(["Windows Phone","KaiOS","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian",{label:"DragonFly BSD",pattern:"DragonFly"},"Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function getProduct(a){return reduce(a,(function(a,o){var c=o.pattern||qualify(o);return!a&&(a=RegExp("\\b"+c+" *\\d+[.\\w_]*","i").exec(t)||RegExp("\\b"+c+" *\\w+-[\\w]*","i").exec(t)||RegExp("\\b"+c+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(t))&&((a=String(o.label&&!RegExp(c,"i").test(o.label)?o.label:a).split("/"))[1]&&!/[\d.]+/.test(a[0])&&(a[0]+=" "+a[1]),o=o.label||o,a=format(a[0].replace(RegExp(c,"i"),o).replace(RegExp("; *(?:"+o+"[_-])?","i")," ").replace(RegExp("("+o+")[-_.]?(\\w)","i"),"$1 $2"))),a}))}function getVersion(a){return reduce(a,(function(a,o){return a||(RegExp(o+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(t)||0)[1]||null}))}if(D&&(D=[D]),/\bAndroid\b/.test(G)&&!z&&(v=/\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(t))&&(z=trim(v[1]).replace(/^[a-z]{2}-[a-z]{2};\s*/i,"")||null),$&&!z?z=getProduct([$]):$&&z&&(z=z.replace(RegExp("^("+qualify($)+")[-_.\\s]","i"),$+" ").replace(RegExp("^("+qualify($)+")[-_.]?(\\w)","i"),$+" $2")),(v=/\bGoogle TV\b/.exec(z))&&(z=v[0]),/\bSimulator\b/i.test(t)&&(z=(z?z+" ":"")+"Simulator"),"Opera Mini"==H&&/\bOPiOS\b/.test(t)&&N.push("running in Turbo/Uncompressed mode"),"IE"==H&&/\blike iPhone OS\b/.test(t)?($=(v=parse(t.replace(/like iPhone OS/,""))).manufacturer,z=v.product):/^iP/.test(z)?(H||(H="Safari"),G="iOS"+((v=/ OS ([\d_]+)/i.exec(t))?" "+v[1].replace(/_/g,"."):"")):"Konqueror"==H&&/^Linux\b/i.test(G)?G="Kubuntu":$&&"Google"!=$&&(/Chrome/.test(H)&&!/\bMobile Safari\b/i.test(t)||/\bVita\b/.test(z))||/\bAndroid\b/.test(G)&&/^Chrome/.test(H)&&/\bVersion\//i.test(t)?(H="Android Browser",G=/\bAndroid\b/.test(G)?G:"Android"):"Silk"==H?(/\bMobi/i.test(t)||(G="Android",N.unshift("desktop mode")),/Accelerated *= *true/i.test(t)&&N.unshift("accelerated")):"UC Browser"==H&&/\bUCWEB\b/.test(t)?N.push("speed mode"):"PaleMoon"==H&&(v=/\bFirefox\/([\d.]+)\b/.exec(t))?N.push("identifying as Firefox "+v[1]):"Firefox"==H&&(v=/\b(Mobile|Tablet|TV)\b/i.exec(t))?(G||(G="Firefox OS"),z||(z=v[1])):!H||(v=!/\bMinefield\b/i.test(t)&&/\b(?:Firefox|Safari)\b/.exec(H))?(H&&!z&&/[\/,]|^[^(]+?\)/.test(t.slice(t.indexOf(v+"/")+8))&&(H=null),(v=z||$||G)&&(z||$||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(G))&&(H=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(G)?G:v)+" Browser")):"Electron"==H&&(v=(/\bChrome\/([\d.]+)\b/.exec(t)||0)[1])&&N.push("Chromium "+v),q||(q=getVersion(["(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)","Version",qualify(H),"(?:Firefox|Minefield|NetFront)"])),(v=("iCab"==D&&parseFloat(q)>3?"WebKit":/\bOpera\b/.test(H)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(D)&&"WebKit"||!D&&/\bMSIE\b/i.test(t)&&("Mac OS"==G?"Tasman":"Trident")||"WebKit"==D&&/\bPlayStation\b(?! Vita\b)/i.test(H)&&"NetFront")&&(D=[v]),"IE"==H&&(v=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(H+=" Mobile",G="Windows Phone "+(/\+$/.test(v)?v:v+".x"),N.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(H="IE Mobile",G="Windows Phone 8.x",N.unshift("desktop mode"),q||(q=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=H&&"Trident"==D&&(v=/\brv:([\d.]+)/.exec(t))&&(H&&N.push("identifying as "+H+(q?" "+q:"")),H="IE",q=v[1]),B){if(function isHostType(t,a){var o=null!=t?typeof t[a]:"number";return!(/^(?:boolean|number|string|undefined)$/.test(o)||"object"==o&&!t[a])}(a,"global"))if(C&&(L=(v=C.lang.System).getProperty("os.arch"),G=G||v.getProperty("os.name")+" "+v.getProperty("os.version")),E){try{q=a.require("ringo/engine").version.join("."),H="RingoJS"}catch(t){(v=a.system)&&v.global.system==a.system&&(H="Narwhal",G||(G=v[0].os||null))}H||(H="Rhino")}else"object"==typeof a.process&&!a.process.browser&&(v=a.process)&&("object"==typeof v.versions&&("string"==typeof v.versions.electron?(N.push("Node "+v.versions.node),H="Electron",q=v.versions.electron):"string"==typeof v.versions.nw&&(N.push("Chromium "+q,"Node "+v.versions.node),H="NW.js",q=v.versions.nw)),H||(H="Node.js",L=v.arch,G=v.platform,q=(q=/[\d.]+/.exec(v.version))?q[0]:null));else getClassOf(v=a.runtime)==_?(H="Adobe AIR",G=v.flash.system.Capabilities.os):getClassOf(v=a.phantom)==I?(H="PhantomJS",q=(v=v.version||null)&&v.major+"."+v.minor+"."+v.patch):"number"==typeof O.documentMode&&(v=/\bTrident\/(\d+)/i.exec(t))?(q=[q,O.documentMode],(v=+v[1]+4)!=q[1]&&(N.push("IE "+q[1]+" mode"),D&&(D[1]=""),q[1]=v),q="IE"==H?String(q[1].toFixed(1)):q[0]):"number"==typeof O.documentMode&&/^(?:Chrome|Firefox)\b/.test(H)&&(N.push("masking as "+H+" "+q),H="IE",q="11.0",D=["Trident"],G="Windows");G=G&&format(G)}if(q&&(v=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(q)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(B&&m.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(U=/b/i.test(v)?"beta":"alpha",q=q.replace(RegExp(v+"\\+?$"),"")+("beta"==U?P:A)+(/\d+\+?/.exec(v)||"")),"Fennec"==H||"Firefox"==H&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(G))H="Firefox Mobile";else if("Maxthon"==H&&q)q=q.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(z))"Xbox 360"==z&&(G=null),"Xbox 360"==z&&/\bIEMobile\b/.test(t)&&N.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(H)&&(!H||z||/Browser|Mobi/.test(H))||"Windows CE"!=G&&!/Mobi/i.test(t))if("IE"==H&&B)try{null===a.external&&N.unshift("platform preview")}catch(t){N.unshift("embedded")}else(/\bBlackBerry\b/.test(z)||/\bBB10\b/.test(t))&&(v=(RegExp(z.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||q)?(G=((v=[v,/BB10/.test(t)])[1]?(z=null,$="BlackBerry"):"Device Software")+" "+v[0],q=null):this!=forOwn&&"Wii"!=z&&(B&&R||/Opera/.test(H)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==H&&/\bOS X (?:\d+\.){2,}/.test(G)||"IE"==H&&(G&&!/^Win/.test(G)&&q>5.5||/\bWindows XP\b/.test(G)&&q>8||8==q&&!/\bTrident\b/.test(t)))&&!S.test(v=parse.call(forOwn,t.replace(S,"")+";"))&&v.name&&(v="ing as "+v.name+((v=v.version)?" "+v:""),S.test(H)?(/\bIE\b/.test(v)&&"Mac OS"==G&&(G=null),v="identify"+v):(v="mask"+v,H=j?format(j.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(v)&&(G=null),B||(q=null)),D=["Presto"],N.push(v));else H+=" Mobile";(v=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(v=[parseFloat(v.replace(/\.(\d)$/,".0$1")),v],"Safari"==H&&"+"==v[1].slice(-1)?(H="WebKit Nightly",U="alpha",q=v[1].slice(0,-1)):q!=v[1]&&q!=(v[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(q=null),v[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==v[0]&&537.36==v[2]&&parseFloat(v[1])>=28&&"WebKit"==D&&(D=["Blink"]),B&&(T||v[1])?(D&&(D[1]="like Chrome"),v=v[1]||((v=v[0])<530?1:v<532?2:v<532.05?3:v<533?4:v<534.03?5:v<534.07?6:v<534.1?7:v<534.13?8:v<534.16?9:v<534.24?10:v<534.3?11:v<535.01?12:v<535.02?"13+":v<535.07?15:v<535.11?16:v<535.19?17:v<536.05?18:v<536.1?19:v<537.01?20:v<537.11?"21+":v<537.13?23:v<537.18?24:v<537.24?25:v<537.36?26:"Blink"!=D?"27":"28")):(D&&(D[1]="like Safari"),v=(v=v[0])<400?1:v<500?2:v<526?3:v<533?4:v<534?"4+":v<535?5:v<537?6:v<538?7:v<601?8:v<602?9:v<604?10:v<606?11:v<608?12:"12"),D&&(D[1]+=" "+(v+="number"==typeof v?".x":/[.+]/.test(v)?"":"+")),"Safari"==H&&(!q||parseInt(q)>45)?q=v:"Chrome"==H&&/\bHeadlessChrome/i.test(t)&&N.unshift("headless")),"Opera"==H&&(v=/\bzbov|zvav$/.exec(G))?(H+=" ",N.unshift("desktop mode"),"zvav"==v?(H+="Mini",q=null):H+="Mobile",G=G.replace(RegExp(" *"+v+"$"),"")):"Safari"==H&&/\bChrome\b/.exec(D&&D[1])?(N.unshift("desktop mode"),H="Chrome Mobile",q=null,/\bOS X\b/.test(G)?($="Apple",G="iOS 4.3+"):G=null):/\bSRWare Iron\b/.test(H)&&!q&&(q=getVersion("Chrome")),q&&0==q.indexOf(v=/[\d.]+$/.exec(G))&&t.indexOf("/"+v+"-")>-1&&(G=trim(G.replace(v,""))),G&&-1!=G.indexOf(H)&&!RegExp(H+" OS").test(G)&&(G=G.replace(RegExp(" *"+qualify(H)+" *"),"")),D&&!/\b(?:Avant|Nook)\b/.test(H)&&(/Browser|Lunascape|Maxthon/.test(H)||"Safari"!=H&&/^iOS/.test(G)&&/\bSafari\b/.test(D[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(H)&&D[1])&&(v=D[D.length-1])&&N.push(v),N.length&&(N=["("+N.join("; ")+")"]),$&&z&&z.indexOf($)<0&&N.push("on "+$),z&&N.push((/^on /.test(N[N.length-1])?"":"on ")+z),G&&(v=/ ([\d.+]+)$/.exec(G),b=v&&"/"==G.charAt(G.length-v[0].length-1),G={architecture:32,family:v&&!b?G.replace(v[0],""):G,version:v?v[1]:null,toString:function(){var t=this.version;return this.family+(t&&!b?" "+t:"")+(64==this.architecture?" 64-bit":"")}}),(v=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(L))&&!/\bi686\b/i.test(L)?(G&&(G.architecture=64,G.family=G.family.replace(RegExp(" *"+v),"")),H&&(/\bWOW64\b/i.test(t)||B&&/\w(?:86|32)$/.test(m.cpuClass||m.platform)&&!/\bWin64; x64\b/i.test(t))&&N.unshift("32-bit")):G&&/^OS X/.test(G.family)&&"Chrome"==H&&parseFloat(q)>=39&&(G.architecture=64),t||(t=null);var K={};return K.description=t,K.layout=D&&D[0],K.manufacturer=$,K.name=H,K.prerelease=U,K.product=z,K.ua=t,K.version=H&&q,K.os=G||{architecture:null,family:null,version:null,toString:function(){return"null"}},K.parse=parse,K.toString=function toStringPlatform(){return this.description||""},K.version&&N.unshift(q),K.name&&N.unshift(H),G&&H&&(G!=String(G).split(" ")[0]||G!=H.split(" ")[0]&&!z)&&N.push(z?"("+G+")":"on "+G),N.length&&(K.description=N.join(" ")),K}();m&&h?forOwn(_,(function(t,a){m[a]=t})):c.platform=_}).call(t)})),Up=createCommonjsModule((function(t,a){self,t.exports=function(){var t={d:function(a,o){for(var c in o)t.o(o,c)&&!t.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:o[c]})},o:function(t,a){return Object.prototype.hasOwnProperty.call(t,a)}},a={};t.d(a,{default:function(){return w}});var o=function e(t){for(var a in function(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}(this,e),this.directUploadAddr="https://wanproxy-web.127.net",this.retryCount=2,this.trunkSize=4194304,this.trunkUploadTimeout=5e4,this.getOffsetTimeout=1e4,this.version="1.0",this.onError=function(t){},this.onProgress=function(t){},this.onComplete=function(t){},t)this[a]=t[a]};function n(t,a){var o="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!o){if(Array.isArray(t)||(o=function(t,a){if(t){if("string"==typeof t)return r(t,a);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){o&&(t=o);var c=0,i=function(){};return{s:i,n:function(){return c>=t.length?{done:!0}:{done:!1,value:t[c++]}},e:function(t){throw t},f:i}}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 m,h=!0,v=!1;return{s:function(){o=o.call(t)},n:function(){var t=o.next();return h=t.done,t},e:function(t){v=!0,m=t},f:function(){try{h||null==o.return||o.return()}finally{if(v)throw m}}}}function r(t,a){(null==a||a>t.length)&&(a=t.length);for(var o=0,c=new Array(a);o<a;o++)c[o]=t[o];return c}var c=window.localStorage;window.localStorage&&"function"==typeof window.localStorage.getItem&&"function"==typeof window.localStorage.setItem&&"function"==typeof window.localStorage.removeItem||(c={privateObj:{},setItem:function(t,a){c.privateObj[t]=a},getItem:function(t){return c.privateObj[t]},removeItem:function(t){delete c.privateObj[t]},getKeys:function(){return Object.keys(c.privateObj)}});var m={getFileKey:function(t){var a=t.size.toString(),o=t.lastModified.toString();return t.name+a.slice(a.length-5)+o.slice(o.length-5)},getFileInfo:function(t){var a=c.getItem(t);if(!a)return null;try{return JSON.parse(a)}catch(t){return null}},initFile:function(t,a){m.clearExpiredInfo();var o=this.getFileKey(a),h={ctx:void 0!==t.ctx?t.ctx:"",bucket:t.bucketName,obj:t.objectName,token:t.token,modifyAt:Date.now(),end:!1};return t.payload&&(h.payload=t.payload),c.setItem(o,JSON.stringify(h)),o},setUploadContext:function(t,a){var o=this.getFileInfo(t);o&&(o.ctx=a,c.setItem(t,JSON.stringify(o)))},setComplete:function(t){var a=this.getFileInfo(t);a&&(a.modifyAt=Date.now(),a.end=!0,c.setItem(t,JSON.stringify(a)))},getUploadContext:function(t){var a=this.getFileInfo(t);return a?a.ctx:""},removeFileInfo:function(t){c.removeItem(t)},clearExpiredInfo:function(){var t,a="function"==typeof c.getKeys?c.getKeys():Object.keys(c),o=Date.now(),h=[],v=n(a);try{for(v.s();!(t=v.n()).done;){var b=t.value,S=m.getFileInfo(b);null===S||o-S.modifyAt>w.expireTime?c.removeItem(b):h.push({fileInfo:S,key:b})}}catch(t){v.e(t)}finally{v.f()}if(h.length>w.maxFileCache){var T,M=n(h.sort((function(t,a){return a.fileInfo.modifyAt-t.fileInfo.modifyAt})).slice(w.maxFileCache));try{for(M.s();!(T=M.n()).done;){var _=T.value;c.removeItem(_.key)}}catch(t){M.e(t)}finally{M.f()}}}},h=m;function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,a){return!a||"object"!==u(a)&&"function"!=typeof a?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):a}function l(t){var a="function"==typeof Map?new Map:void 0;return(l=function(t){if(null===t||(o=t,-1===Function.toString.call(o).indexOf("[native code]")))return t;var o;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==a){if(a.has(t))return a.get(t);a.set(t,n)}function n(){return s(t,arguments,y(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)})(t)}function s(t,a,o){return(s=p()?Reflect.construct:function(t,a,o){var c=[null];c.push.apply(c,a);var m=new(Function.bind.apply(t,c));return o&&d(m,o.prototype),m}).apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,a){return(d=Object.setPrototypeOf||function(t,a){return t.__proto__=a,t})(t,a)}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var v=function(t){!function(t,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(a&&a.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),a&&d(t,a)}(r,t);var a,o,c=(a=r,o=p(),function(){var t,c=y(a);if(o){var m=y(this).constructor;t=Reflect.construct(c,arguments,m)}else t=c.apply(this,arguments);return f(this,t)});function r(t,a){var o;return function(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}(this,r),(o=c.call(this,"NosUploadError:"+t)).errCode=a,o.errMsg=t,o}return r}(l(Error)),b=function e(t,a,o){if("uploading"===t.uploadState){var c=t.config,m=t.param,b=h.getUploadContext(t.fileKey);if(!b)return o(0);var S=new XMLHttpRequest,T=c.directUploadAddr+"/".concat(m.bucketName)+"/".concat(encodeURIComponent(m.objectName))+"?uploadContext"+"&context=".concat(b)+"&version=".concat(c.version);S.onreadystatechange=function(){if("abort"!==t.uploadState&&4===S.readyState){var m;try{m=JSON.parse(S.responseText)}catch(t){m={errMsg:"JsonParseError in getOffset",errCode:500}}200===S.status?m.errCode?t.config.onError(new v(m.errMsg,m.errCode)):o(m.offset):S.status.toString().match(/^5/)?e(t,a-1,o):(h.removeFileInfo(t.fileKey),S.status?c.onError(new v("getOffset(".concat(T,") error: ").concat(S.status," ").concat(S.statusText))):c.onError(new v("getOffset(".concat(T,") error. no Error Code"))))}},S.open("get",T),S.setRequestHeader("x-nos-token",m.token),S.timeout=c.getOffsetTimeout,S.send()}},S=function e(t,a,o,c){if("uploading"===t.uploadState){var m=t.param,b=t.config,S=File.prototype.slice,T=void 0!==m.ctx?m.ctx:"",M=a+b.trunkSize>t.file.size,w=M?t.file.size:a+b.trunkSize,_=new XMLHttpRequest,x=b.directUploadAddr+"/".concat(m.bucketName)+"/".concat(encodeURIComponent(m.objectName));if(_.upload.onprogress=function(o){var c=0;o.lengthComputable?(c=(a+o.loaded)/t.file.size,b.onProgress(c)):b.onError(new v("browser does not support query upload progress"))},_.onreadystatechange=function(){if("abort"!==t.uploadState&&4===_.readyState){var m;try{m=JSON.parse(_.responseText)}catch(t){console.error("JsonParseError in uploadTrunk",t),m={errMsg:"JsonParseError in uploadTrunk"}}200===_.status?(t.setContext(m.context),M?(c(),t.setComplete()):e(t,m.offset,b.retryCount,c)):_.status.toString().match(/^5/)?o>0?e(t,a,o-1,c):(h.removeFileInfo(t.fileKey),b.onError(new v(m.errMsg,m.errCode))):_.status?(h.removeFileInfo(t.fileKey),b.onError(new v("uploadTrunk(".concat(x,") error: ").concat(_.status," ").concat(_.statusText)))):(console.log("upload is paused",_),b.onError(new v("uploadTrunk(".concat(x,") error. no Error Code"))))}},_.open("post",x+"?offset=".concat(a)+"&complete=".concat(M)+"&context=".concat(T)+"&version=".concat(b.version)),_.setRequestHeader("x-nos-token",m.token),t.file.type&&_.setRequestHeader("content-type",t.file.type),_.timeout=b.trunkUploadTimeout,"undefined"!=typeof FileReader){var k=new FileReader;k.addEventListener("load",(function(t){var a;(null===(a=null==t?void 0:t.target)||void 0===a?void 0:a.result)?_.send(t.target.result):b.onError(new v("Read ArrayBuffer failed"))})),k.addEventListener("error",(function(t){var a=t.target.error;b.onError(new v("Read ArrayBuffer error. ".concat(a.toString()),a.code))})),k.readAsArrayBuffer(S.call(t.file,a,w))}else _.send(S.call(t.file,a,w))}};function g(t,a){for(var o=0;o<a.length;o++){var c=a[o];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(t,c.key,c)}}var T=function(){function e(t,a,o){!function(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}(this,e),this.uploadState="paused",this.config=o,this.file=t,this.param=a,this.fileKey=h.initFile(a,t),this.resume()}var t;return(t=[{key:"resume",value:function(){var t=this;if("uploading"!==this.uploadState){this.setUploadState("uploading");var a=this.config;b(this,a.retryCount,(function(o){S(t,o,a.retryCount,(function(){t.setUploadState("ended"),"function"==typeof a.onComplete&&a.onComplete(t.param)}))}))}}},{key:"pause",value:function(){this.setUploadState("paused")}},{key:"abort",value:function(){this.setUploadState("abort"),h.removeFileInfo(this.fileKey)}},{key:"setUploadState",value:function(t){t!==this.uploadState&&(this.uploadState=t)}},{key:"setContext",value:function(t){h.setUploadContext(this.fileKey,t),this.param.ctx=t}},{key:"setComplete",value:function(){h.setComplete(this.fileKey),this.setUploadState("ended")}}])&&g(e.prototype,t),e}(),M={maxFileCache:6,expireTime:864e5,getFileUploadInformation:function(t){var a=h.getFileKey(t),o=h.getFileInfo(a);return null===o?null:Date.now()-o.modifyAt>M.expireTime?(h.removeFileInfo(a),null):{uploadInfo:Object.assign({bucketName:o.bucket,objectName:o.obj,token:o.token,ctx:o.ctx},o.payload?{payload:o.payload}:{}),complete:o.end}},setMaxFileCache:function(t){M.maxFileCache=t},setExpireTime:function(t){M.expireTime=t},printCaches:function(){for(var t=0,a=Object.keys(localStorage);t<a.length;t++){var o=a[t],c=h.getFileInfo(o);c&&console.log(c,"modifiedAt",new Date(c.modifyAt).toTimeString())}},createConfig:function(t){return new o(t)},createTask:function(t,a,o){return new T(t,a,o)}},w=M;return a.default}()})),Bp=createCommonjsModule((function(t,a){t.exports=function(){const t=5e3;function object2String(t){if(t){let a="";return Object.entries(t).forEach((([t,o],c)=>{a+=0===c?"?":"&",a+=`${t}=${o}`})),a}return""}function timeoutPromise(a,o){return new Promise(((c,m)=>{setTimeout((()=>{m({message:"request timeout",params:o})}),a||t)}))}function request(a,o={dataType:"json",method:"GET",timeout:t}){const c="text"===o.dataType?"text/plain; charset=UTF-8":"application/json; charset=UTF-8";let m="GET"===o.method?object2String(o.params):"";return Promise.race([timeoutPromise(o.timeout,{url:a,params:o}),new Promise((function(t,h){if(window.fetch&&"function"==typeof window.fetch)try{let v={method:o.method,headers:Object.assign({"Content-Type":c},o.headers)};"POST"===o.method&&(v.body=JSON.stringify(o.params)),fetch(`${a}${m}`,v).then((a=>{"text"!==o.dataType?a.json().then((o=>{a.data=o,t(a)}),h):a.text().then((o=>{a.data=o,t(a)}),h)}),h)}catch(t){h(t)}else if(window.XMLHttpRequest){const v=new XMLHttpRequest;let b;if(v.onreadystatechange=function(){if(4===v.readyState)if(200===v.status){try{b=JSON.parse(v.response||"{}")}catch(t){b=v.response}t({status:v.status,data:b})}else h(v.status)},v.open(o.method,`${a}${m}`),v.setRequestHeader("Content-Type",c),o.headers)for(let t in o.headers)v.setRequestHeader(t,o.headers[t]);v.send(JSON.stringify(o.params))}else h("request no suppout")}))])}return request}()})),qp=console;var Dp,Hp,zp,$p,Gp,Kp={setLogger:function setLogger(t){qp=t},platform:"BROWSER",localStorage:window.localStorage,request:Bp,WebSocket:window.WebSocket,uploadFile:function uploadFile(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var a,o,c,m,h,v;return Mo.wrap((function _callee$(b){for(;;)switch(b.prev=b.next){case 0:if(t.fileInput||t.file){b.next=2;break}throw new Error("File not exist");case 2:if(!t.file){b.next=6;break}m=t.file,b.next=20;break;case 6:if("string"!=typeof t.fileInput){b.next=15;break}if(!((h=document.getElementById(t.fileInput))&&h.files&&h.files[0])){b.next=12;break}m=h.files[0],b.next=13;break;case 12:throw new Error("Can not get file from fileInput");case 13:b.next=20;break;case 15:if(!(t.fileInput&&t.fileInput.files&&t.fileInput.files[0])){b.next=19;break}m=t.fileInput.files[0],b.next=20;break;case 19:throw new Error("Can not get file from fileInput "+t.fileInput);case 20:if(!(t.maxSize&&m.size>t.maxSize)){b.next=22;break}throw new Error("The file exceeds maxSize limit. maxSize: "+t.maxSize+", get "+m.size);case 22:return b.next=24,new co((function(a,o){var c=Up.createConfig({directUploadAddr:t.chunkUploadHost,onError:function onError(t){o(t)},onProgress:t.onUploadProgress||function(){},onComplete:function onComplete(t){a(t)}}),h=Up.createTask(m,{bucketName:t.nosToken.bucket,objectName:decodeURIComponent(t.nosToken.objectName),token:t.nosToken.token},c);try{t.onUploadStart&&t.onUploadStart(h)}catch(t){qp.error("Adapter uploadFile: options.onUploadStart error",t&&t.message),h.abort(),o(t)}}));case 24:return(v=b.sent).name=m.name,v.size=m.size,v.type=m.type,v.ext=lastIndexOf(a=v.name).call(a,".")>-1?slice(o=v.name).call(o,lastIndexOf(c=v.name).call(c,".")+1).toLowerCase():"",b.abrupt("return",v);case 30:case"end":return b.stop()}}),_callee)})))},getSystemInfo:function getSystemInfo(){var t,a;return{os:(null===(t=Np.os)||void 0===t?void 0:t.family)||"",osVer:(null===(a=Np.os)||void 0===a?void 0:a.version)||"",browser:Np.name||"",browserVer:Np.version||"",hostEnv:"BROWSER",hostEnvVer:Np.version||"",hostInfo:Np.ua||""}}},Wp=function(){function Service(t,a){this.name=t,this.core=a,this.name=t,this.logger=a.logger,this.core=a}return Service.prototype.process=function process(t){var a=this[t.cmd+"Handler"];return"function"==typeof a?a.call(this,t):t.error&&!t.error.ignore?co.reject(t.error):co.resolve(t)},Service}();!function(t){t[t.text=0]="text",t[t.image=1]="image",t[t.audio=2]="audio",t[t.video=3]="video",t[t.geo=4]="geo",t[t.notification=5]="notification",t[t.file=6]="file",t[t.tip=10]="tip",t[t.robot=11]="robot",t[t.g2=12]="g2",t[t.custom=100]="custom"}(Dp||(Dp={})),function(t){t[t.p2p=0]="p2p",t[t.team=1]="team",t[t.superTeam=5]="superTeam"}(Hp||(Hp={})),function(t){t[t.Android=1]="Android",t[t.iOS=2]="iOS",t[t.PC=4]="PC",t[t.WindowsPhone=8]="WindowsPhone",t[t.Web=16]="Web",t[t.Server=32]="Server",t[t.Mac=64]="Mac"}(zp||(zp={})),function(t){t[t.unread=1]="unread",t[t.read=2]="read",t[t.deleted=3]="deleted",t[t.sending=4]="sending",t[t.sendFailed=5]="sendFailed",t[t.sent=6]="sent",t[t.receipt=7]="receipt",t[t.refused=10]="refused"}($p||($p={})),function(t){t[t.default=0]="default",t[t.leave=1]="leave",t[t.roam=2]="roam"}(Gp||(Gp={}));var Vp=function overArg(t,a){return function(o){return t(a(o))}},Jp=Vp(Object.getPrototypeOf,Object),Xp=Function.prototype,Yp=Object.prototype,Qp=Xp.toString,Zp=Yp.hasOwnProperty,ed=Qp.call(Object);var td=function isPlainObject(t){if(!Vc(t)||"[object Object]"!=Ns(t))return!1;var a=Jp(t);if(null===a)return!0;var o=Zp.call(a,"constructor")&&a.constructor;return"function"==typeof o&&o instanceof o&&Qp.call(o)==ed};function format(t,a){if(!td(a))return{};var o=JSON.parse(Oo(a)),c=doFormat(t,o);return JSON.parse(Oo(Ao(Ao({},o),c)))}function doFormat(t,a){if(!td(a))return{};var o={},c=xo(t);return forEach$1(c).call(c,(function(c){var m=t[c].type;if("string"!=typeof m){var h=doFormat(t[c],a);xo(h).length>0&&(o[c]=h)}else{var v=t[c],b=v.rawKey||c,S=rd[m](a,b,v);void 0!==S&&(a[b]=void 0,o[c]=S)}})),o}var rd={number:function number(t,a){if(void 0!==t[a])return+t[a]},string:function string(t,a){if(void 0!==t[a])return t[a]},boolean:function boolean(t,a){return+t[a]>0||0!=+t[a]&&void 0},enum:function _enum(t,a,o){return values(o)[t[a]]},object:function object(t,a){if(void 0!==t[a])try{return JSON.parse(t[a])}catch(t){return{}}}};function formatReverse(t,a){if(!td(a))return{};var o=JSON.parse(Oo(a)),c=doFormatReverse(t,o);return JSON.parse(Oo(Ao(Ao({},o),c)))}function doFormatReverse(t,a){var o;if(!td(a))return reduce(o=xo(t)).call(o,(function(a,o){return a[t[o].rawKey||o]=void 0,a}),{});var c={},m=xo(t);return forEach$1(m).call(m,(function(o){var m=t[o].type;if("string"!=typeof m){var h=doFormatReverse(t[o],a[o]);return Ao(c,h),void(a[o]=void 0)}var v=t[o],b=v.rawKey||o,S=nd[m](a,o,v);a[b]=void 0,c[b]=S})),c}var nd={number:function number(t,a){return t[a]},string:function string(t,a){return t[a]},boolean:function boolean(t,a){return!0===t[a]?1:!1===t[a]?0:void 0},enum:function _enum(t,a,o){return values(o)[t[a]]},object:function object(t,a){if(void 0!==t[a])try{return Oo(t[a])}catch(t){return""}}};var id=function createBaseFor(t){return function(a,o,c){for(var m=-1,h=Object(a),v=c(a),b=v.length;b--;){var S=v[t?b:++m];if(!1===o(h[S],S,h))break}return a}}();var ad=function baseTimes(t,a){for(var o=-1,c=Array(t);++o<t;)c[o]=a(o);return c};var od=function baseIsArguments(t){return Vc(t)&&"[object Arguments]"==Ns(t)},sd=Object.prototype,cd=sd.hasOwnProperty,ud=sd.propertyIsEnumerable,ld=od(function(){return arguments}())?od:function(t){return Vc(t)&&cd.call(t,"callee")&&!ud.call(t,"callee")},pd=ld;var dd=function stubFalse(){return!1},md=createCommonjsModule((function(t,a){var o=a&&!a.nodeType&&a,c=o&&t&&!t.nodeType&&t,m=c&&c.exports===o?Is.Buffer:void 0,h=(m?m.isBuffer:void 0)||dd;t.exports=h})),fd=/^(?:0|[1-9]\d*)$/;var gd=function isIndex(t,a){var o=typeof t;return!!(a=null==a?9007199254740991:a)&&("number"==o||"symbol"!=o&&fd.test(t))&&t>-1&&t%1==0&&t<a},yd={};yd["[object Float32Array]"]=yd["[object Float64Array]"]=yd["[object Int8Array]"]=yd["[object Int16Array]"]=yd["[object Int32Array]"]=yd["[object Uint8Array]"]=yd["[object Uint8ClampedArray]"]=yd["[object Uint16Array]"]=yd["[object Uint32Array]"]=!0,yd["[object Arguments]"]=yd["[object Array]"]=yd["[object ArrayBuffer]"]=yd["[object Boolean]"]=yd["[object DataView]"]=yd["[object Date]"]=yd["[object Error]"]=yd["[object Function]"]=yd["[object Map]"]=yd["[object Number]"]=yd["[object Object]"]=yd["[object RegExp]"]=yd["[object Set]"]=yd["[object String]"]=yd["[object WeakMap]"]=!1;var hd=function baseIsTypedArray(t){return Vc(t)&&ul(t.length)&&!!yd[Ns(t)]},vd=Yc&&Yc.isTypedArray,bd=vd?Xc(vd):hd,Sd=Object.prototype.hasOwnProperty;var Td=function arrayLikeKeys(t,a){var o=up(t),c=!o&&pd(t),m=!o&&!c&&md(t),h=!o&&!c&&!m&&bd(t),v=o||c||m||h,b=v?ad(t.length,String):[],S=b.length;for(var T in t)!a&&!Sd.call(t,T)||v&&("length"==T||m&&("offset"==T||"parent"==T)||h&&("buffer"==T||"byteLength"==T||"byteOffset"==T)||gd(T,S))||b.push(T);return b},Md=Object.prototype;var wd=function isPrototype(t){var a=t&&t.constructor;return t===("function"==typeof a&&a.prototype||Md)},_d=Vp(Object.keys,Object),xd=Object.prototype.hasOwnProperty;var kd=function baseKeys(t){if(!wd(t))return _d(t);var a=[];for(var o in Object(t))xd.call(t,o)&&"constructor"!=o&&a.push(o);return a};var Id=function keys(t){return ll(t)?Td(t):kd(t)};var Cd=function baseForOwn(t,a){return t&&id(t,a,Id)};var Ed=function baseInverter(t,a,o,c){return Cd(t,(function(t,m,h){a(c,o(t),m,h)})),c};var Ad,Pd=function createInverter(t,a){return function(o,c){return Ed(o,t,a(c),{})}},Od=Object.prototype.toString,Rd=Pd((function(t,a,o){null!=a&&"function"!=typeof a.toString&&(a=Od.call(a)),t[a]=o}),nl(Zu)),jd=Rd({Android:1,iOS:2,PC:4,WindowsPhone:8,Web:16,Server:32,Mac:64}),Fd={p2p:0,team:1,superTeam:5};function formatMultiPortLoginInfo(t,a){return t&&t.length>0?map(t).call(t,(function(t){return Ao(Ao({},t),{account:t.account,connectionId:t.connectionId,deviceId:t.deviceId,ip:t.ip,mac:t.mac,os:t.os,type:jd[t.type]||t.type,time:Bl(t.time),online:3!==a})})):[]}Rd(Fd),function(t){t[t.text=0]="text",t[t.image=1]="image",t[t.audio=2]="audio",t[t.video=3]="video",t[t.geo=4]="geo",t[t.notification=5]="notification",t[t.file=6]="file",t[t.tip=10]="tip",t[t.robot=11]="robot",t[t.g2=12]="g2",t[t.custom=100]="custom"}(Ad||(Ad={}));var Ld={1:{reason:"samePlatformKick",message:"The same account is not allowed to multiple login at the same time"},2:{reason:"serverKick",message:"Kicked out by IM server"},3:{reason:"otherPlatformKick",message:"Kicked out by other client of your account"},4:{reason:"silentlyKick",message:"Quietly kicked"}};var Nd={BROWSER:0,RN:2,UNIAPP:3,WECHAT:6},Ud=function(t){function AuthService(a){var o;return o=t.call(this,"auth",a)||this,registerParser({cmdMap:ap,cmdConfig:cp}),o}_t(AuthService,t);var a=AuthService.prototype;return a.doLogin=function doLogin(t){var a,o;return void 0===t&&(t=!1),__awaiter(this,void 0,void 0,Mo.mark((function _callee(){var c,m,h,v,b,S,T,M,w,_;return Mo.wrap((function _callee$(x){for(;;)switch(x.prev=x.next){case 0:return c=this.core.options,m=Ic.getSystemInfo(),h=Ao(Ao({},c),{appLogin:t?0:1,appkey:c.appkey,account:c.account,token:c.token,deviceId:this.core.config.deviceId,clientType:16,protocolVersion:1,sdkVersion:90901,sdkHumanVersion:"0.12.1",os:m.os,browser:m.browser,session:null===(a=this.core.socket)||void 0===a?void 0:a.sessionId,sdkType:Nd[Ic.platform]||0,userAgent:"Native/0.12.1"}),v=m.os.toLowerCase(),"UNIAPP"!==Ic.platform||"ios"!==v&&"android"!==v||(h.isReactNative=1,h.clientType="ios"===v?2:1,m.pushDeviceInfo&&m.pushDeviceInfo.MANUFACTURER&&(h.deviceInfo=Oo(m.pushDeviceInfo))),this.logger.log("auth::do login ",c.account,null===(o=this.core.socket)||void 0===o?void 0:o.sessionId),x.next=8,this.core.sendCmd("login",{login:h});case 8:if(!(b=x.sent).error){x.next=11;break}throw b.error;case 11:return S=b.content,T=S.loginRes,M=S.loginPorts,w=S.aosPushInfo,_=formatMultiPortLoginInfo(M,2),(_=filter(_).call(_,(function(t){return t.connectionId!==T.connectionId}))).length>0&&this.core.emit("multiPortLogin",_),x.abrupt("return",Ao(Ao({},T),{aosPushInfo:w}));case 16:case"end":return x.stop()}}),_callee,this)})))},a.kick=function kick(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var o;return Mo.wrap((function _callee2$(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this.core.sendCmd("kick",t);case 2:return o=c.sent,c.abrupt("return",null===(a=o.content)||void 0===a?void 0:a.deviceIds);case 4:case"end":return c.stop()}}),_callee2,this)})))},a.multiPortLoginHandler=function multiPortLoginHandler(t){if(t.error)this.logger.error("multiPortLoginHandler:: error, ",t.error);else{var a=t.content,o=formatMultiPortLoginInfo(a.loginPorts,a.state);o.length>0&&this.core.emit("multiPortLogin",o)}},a.kickedHandler=function kickedHandler(t){if(t.error)this.logger.error("kickedHandler:: error, ",t.error);else{var a=function formatBeKickedTag(t){var a=format({clientType:{type:"enum",values:zp},customClientType:{type:"number"}},t),o=Ld[a.reason];return Ao(a,o=o||{reason:"unknow",message:"Unknown reason"})}(t.content);this.logger.warn("kicked::",a),this.core.doDisconnect(ep.KICKED,a)}},AuthService}(Wp),Bd=Math.floor,mergeSort=function(t,a){var o=t.length,c=Bd(o/2);return o<8?insertionSort(t,a):merge(t,mergeSort(arraySliceSimple(t,0,c),a),mergeSort(arraySliceSimple(t,c),a),a)},insertionSort=function(t,a){for(var o,c,m=t.length,h=1;h<m;){for(c=h,o=t[h];c&&a(t[c-1],o)>0;)t[c]=t[--c];c!==h++&&(t[c]=o)}return t},merge=function(t,a,o,c){for(var m=a.length,h=o.length,v=0,b=0;v<m||b<h;)t[v+b]=v<m&&b<h?c(a[v],o[b])<=0?a[v++]:o[b++]:v<m?a[v++]:o[b++];return t},qd=mergeSort,Dd=$.match(/firefox\/(\d+)/i),Hd=!!Dd&&+Dd[1],zd=/MSIE|Trident/.test($),$d=$.match(/AppleWebKit\/(\d+)\./),Gd=!!$d&&+$d[1],Kd=[],Wd=k(Kd.sort),Vd=k(Kd.push),Jd=fails((function(){Kd.sort(void 0)})),Xd=fails((function(){Kd.sort(null)})),Yd=arrayMethodIsStrict("sort"),Qd=!fails((function(){if(X)return X<70;if(!(Hd&&Hd>3)){if(zd)return!0;if(Gd)return Gd<603;var t,a,o,c,m="";for(t=65;t<76;t++){switch(a=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:o=3;break;case 68:case 71:o=4;break;default:o=2}for(c=0;c<47;c++)Kd.push({k:a+c,v:o})}for(Kd.sort((function(t,a){return a.v-t.v})),c=0;c<Kd.length;c++)a=Kd[c].k.charAt(0),m.charAt(m.length-1)!==a&&(m+=a);return"DGBEFHACIJK"!==m}}));_export({target:"Array",proto:!0,forced:Jd||!Xd||!Yd||!Qd},{sort:function sort(t){void 0!==t&&aCallable(t);var a=toObject(this);if(Qd)return void 0===t?Wd(a):Wd(a,t);var o,c,m=[],h=lengthOfArrayLike(a);for(c=0;c<h;c++)c in a&&Vd(m,a[c]);for(qd(m,function(t){return function(a,o){return void 0===o?-1:void 0===a?1:void 0!==t?+t(a,o)||0:toString$1(a)>toString$1(o)?1:-1}}(t)),o=lengthOfArrayLike(m),c=0;c<o;)a[c]=m[c++];for(;c<h;)deletePropertyOrThrow(a,c++);return a}});var Zd=entryVirtual("Array").sort,em=Array.prototype,sort=function(t){var a=t.sort;return t===em||z(em,t)&&a===em.sort?Zd:a};_export({target:"Number",stat:!0},{isNaN:function isNaN(t){return t!=t}});var tm,rm=H.Number.isNaN,nm=Rd({none:0,normal:1,all:3}),im={normal:0,advanced:1},am=Rd(im),om=Rd({normal:0,owner:1,manager:2}),sm={noVerify:0,needVerify:1,rejectAll:2},cm=Rd(sm),um={needVerify:0,noVerify:1},lm=Rd(um),pm={manager:0,all:1},dm=Rd(pm),mm={manager:0,all:1},fm=Rd(mm),gm={manager:0,all:1},ym=Rd(gm);function formatTeam(t){var a,o=["teamId"],c=["level","memberNum","memberUpdateTime","createTime","updateTime"],m=["valid","validToCurrentUser","mute"],h={type:am,muteType:nm,joinMode:cm,beInviteMode:lm,inviteMode:dm,updateTeamMode:fm,updateExtMode:ym};t.bits;var v=__rest(t,["bits"]);return forEach$1(o).call(o,(function(t){v[t]&&(v[t]=v[t].toString())})),forEach$1(c).call(c,(function(t){void 0!==v[t]&&(v[t]=Bl(v[t]))})),forEach$1(m).call(m,(function(t){void 0!==v[t]&&(v[t]=1===Bl(v[t]))})),forEach$1(a=xo(h)).call(a,(function(t){void 0!==v[t]&&(v[t]=h[t][v[t]]||v[t])})),v}function formatTeams(t){return t&&t.length>0?map(t).call(t,(function(t){return formatTeam(t)})):[]}function generateTeam(t){var a,o=Ao({},t),c=["avatar","name","intro","announcement","ext"],m={type:im,joinMode:sm,beInviteMode:um,inviteMode:pm,updateTeamMode:mm,updateExtMode:gm};return forEach$1(c).call(c,(function(t){void 0!==o[t]&&(o[t]=o[t].toString())})),forEach$1(a=xo(m)).call(a,(function(t){void 0!==o[t]&&(o[t]=m[t][o[t]])})),o}function generatorTeamMemberForCmd(t){var a=["teamId","ext","account","nickInTeam"],o={};return void 0!==t.bitConfigMask&&(o.bits=Bl(t.bitConfigMask)),forEach$1(a).call(a,(function(a){t[a]&&(o[a]=t[a].toString())})),o}function formatTeamMember(t){var a,o=["teamId"],c=["joinTime","updateTime","bitConfigMask"],m=["active","valid","mute"],h={type:om},v=t.bits,b=__rest(t,["bits"]);return void 0!==v&&(b.muteTeam=1===Bl(v),b.bitConfigMask=v),b.id=b.teamId+"-"+b.account,forEach$1(o).call(o,(function(t){b[t]&&(b[t]=b[t].toString())})),forEach$1(c).call(c,(function(t){void 0!==b[t]&&(b[t]=Bl(b[t]))})),forEach$1(m).call(m,(function(t){void 0!==b[t]&&(b[t]=1===Bl(b[t]))})),forEach$1(a=xo(h)).call(a,(function(t){void 0!==b[t]&&(b[t]=h[t][b[t]]||b[t])})),b}function formatTeamMembers(t){return t&&t.length>0?map(t).call(t,(function(t){return formatTeamMember(t)})):[]}function generatorMemberByTeam(t,a,o){return void 0===o&&(o="normal"),{id:t.teamId+"-"+a,teamId:t.teamId,account:a,type:o,nickInTeam:"",muteTeam:!1,mute:!1,joinTime:t.memberUpdateTime,updateTime:t.memberUpdateTime,active:!0,valid:!0}}function generatorMembersByTeam(t,a,o){return void 0===o&&(o="normal"),a&&a.length>0?map(a).call(a,(function(a){return generatorMemberByTeam(t,a,o)})):[]}function formatUser(t){var a=Ao({},t);return a.createTime&&(a.createTime=+a.createTime),a.updateTime&&(a.updateTime=+a.updateTime),a.gender&&(a.gender=tm[+a.gender]),a}!function(t){t[t.unknown=0]="unknown",t[t.male=1]="male",t[t.female=2]="female"}(tm||(tm={}));var hm={"8_1":"createTeam","8_5":"addTeamMembers","8_6":"removeTeamMembers","8_7":"updateTeamInfo","8_8":"leaveTeam","8_9":"getTeamInfo","8_10":"getTeams","8_11":"getTeamMembers","8_12":"dismissTeam","8_13":"applyTeam","8_14":"passTeamApply","8_15":"rejectTeamApply","8_16":"addTeamManagers","8_17":"removeTeamManagers","8_18":"transferTeam","8_19":"updateMyMemberInfo","8_20":"updateNickInTeam","8_21":"acceptTeamInvite","8_22":"rejectTeamInvite","8_25":"muteTeamMember","8_27":"getMutedTeamMembers","8_28":"sendTeamMsgReceipt","8_29":"getTeamMsgReads","8_30":"getTeamMsgReadAccounts","8_31":"notifyTeamMsgReceipts","8_32":"muteTeam","8_33":"getTeamMemberInvitorAccid","8_34":"getTeamsById","8_101":"syncCreateTeam","8_109":"syncTeams","8_119":"syncUpdateTeamMember"},vm={team:{teamId:1,name:3,type:4,owner:5,level:6,selfCustom:7,valid:8,memberNum:9,memberUpdateTime:10,createTime:11,updateTime:12,validToCurrentUser:13,intro:14,announcement:15,joinMode:16,bits:17,ext:18,serverExt:19,avatar:20,beInviteMode:21,inviteMode:22,updateTeamMode:23,updateExtMode:24,mute:100,muteType:101},teamMsgReceiptTag:{teamId:0,idServer:1,read:100,unread:101,idClient:102,account:103},teamMember:{teamId:1,account:3,type:4,nickInTeam:5,bits:7,active:8,valid:9,joinTime:10,updateTime:11,ext:12,mute:13,invitorAccid:14}},bm=invertSerializeMap(vm),Sm={getTeamInfo:{sid:8,cid:9,service:"team",params:[{type:"Long",name:"teamId"}],response:[{type:"Property",name:"team",reflectMapper:bm.team}]},getTeams:{sid:8,cid:10,service:"team",params:[{type:"long",name:"timetag"}],response:[{type:"PropertyArray",name:"teams",reflectMapper:bm.team},{type:"Number",name:"timetag"}]},createTeam:{sid:8,cid:1,service:"team",params:[{type:"Property",name:"team",reflectMapper:vm.team},{type:"StrArray",name:"accounts"},{type:"String",name:"ps"}],response:[{type:"Property",name:"team",reflectMapper:bm.team},{type:"StrArray",name:"abortedAccidList"}]},sendTeamMsgReceipt:{sid:8,cid:28,service:"team",params:[{type:"PropertyArray",name:"teamMsgReceipts",reflectMapper:vm.teamMsgReceiptTag}],response:[{type:"PropertyArray",name:"teamMsgReceipts",reflectMapper:bm.teamMsgReceiptTag}]},getTeamMsgReads:{sid:8,cid:29,service:"team",params:[{type:"PropertyArray",name:"teamMsgReceipts",reflectMapper:vm.teamMsgReceiptTag}],response:[{type:"PropertyArray",name:"teamMsgReceipts",reflectMapper:bm.teamMsgReceiptTag}]},getTeamMsgReadAccounts:{sid:8,cid:30,service:"team",params:[{type:"Property",name:"teamMsgReceiptTag",reflectMapper:vm.teamMsgReceiptTag}],response:[{type:"Property",name:"teamMsgReceipt",reflectMapper:bm.teamMsgReceiptTag},{type:"StrArray",name:"readAccounts"},{type:"StrArray",name:"unreadAccounts"}]},notifyTeamMsgReceipts:{sid:8,cid:31,service:"team",response:[{type:"PropertyArray",name:"teamMsgReceipts",reflectMapper:bm.teamMsgReceiptTag}]},dismissTeam:{sid:8,cid:12,service:"team",params:[{type:"Long",name:"teamId"}]},leaveTeam:{sid:8,cid:8,service:"team",params:[{type:"Long",name:"teamId"}]},transferTeam:{sid:8,cid:18,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"account"},{type:"bool",name:"leave"}]},updateTeamInfo:{sid:8,cid:7,service:"team",params:[{type:"Property",name:"team",reflectMapper:vm.team}],response:[{type:"Number",name:"id"},{type:"Number",name:"time"}]},getTeamsById:{sid:8,cid:34,service:"team",params:[{type:"LongArray",name:"teamIds"}],response:[{type:"PropertyArray",name:"teams",reflectMapper:bm.team},{type:"StrArray",name:"tids"}],ignoreErrCodes:[816]},getTeamMembers:{sid:8,cid:11,service:"team",params:[{type:"Long",name:"teamId"},{type:"Long",name:"timetag"}],response:[{type:"String",name:"teamId"},{type:"PropertyArray",name:"teamMembers",reflectMapper:bm.teamMember},{type:"Number",name:"timetag"}]},getMutedTeamMembers:{sid:8,cid:27,service:"team",params:[{type:"Long",name:"teamId"}],response:[{type:"String",name:"teamId"},{type:"PropertyArray",name:"teamMembers",reflectMapper:bm.teamMember}]},addTeamMembers:{sid:8,cid:5,service:"team",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"},{type:"String",name:"ps"},{type:"String",name:"attach"}],response:[{type:"Long",name:"time"},{type:"StrArray",name:"abortedAccidList"}]},removeTeamMembers:{sid:8,cid:6,service:"team",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},applyTeam:{sid:8,cid:13,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"ps"}],response:[{type:"Property",name:"team",reflectMapper:bm.team}]},addTeamManagers:{sid:8,cid:16,service:"team",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},removeTeamManagers:{sid:8,cid:17,service:"team",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},updateMyMemberInfo:{sid:8,cid:19,service:"team",params:[{type:"Property",name:"teamMember",reflectMapper:vm.teamMember}]},updateNickInTeam:{sid:8,cid:20,service:"team",params:[{type:"Property",name:"teamMember",reflectMapper:vm.teamMember}]},muteTeamMember:{sid:8,cid:25,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"account"},{type:"Int",name:"mute"}]},getTeamMemberInvitorAccid:{sid:8,cid:33,service:"team",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}],response:[{type:"Object",name:"accountsMap"}]},muteTeam:{sid:8,cid:32,service:"team",params:[{type:"Long",name:"teamId"},{type:"Int",name:"mute"}]},passTeamApply:{sid:8,cid:14,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}]},rejectTeamApply:{sid:8,cid:15,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},acceptTeamInvite:{sid:8,cid:21,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}]},rejectTeamInvite:{sid:8,cid:22,service:"team",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},syncTeams:{sid:8,cid:109,service:"team",response:[{type:"Number",name:"timetag"},{type:"PropertyArray",name:"teams",reflectMapper:bm.team}]},syncCreateTeam:{sid:8,cid:101,service:"team",response:[{type:"Property",name:"team",reflectMapper:bm.team}]},syncUpdateTeamMember:{sid:8,cid:119,service:"team",response:[{type:"Property",name:"teamMember",reflectMapper:bm.teamMember}]}},Tm={"3_1":"updatePushToken","3_2":"updateAppBackground","3_7":"getUsersNameCardFromServer","3_10":"updateMyNameCard","3_109":"syncMyNameCard","3_110":"onUpdateMyNameCard","3_3":"setBlack","3_103":"onUpdateBlackList","3_5":"setMute","3_105":"onUpdateMuteList","3_8":"syncRelations"},Mm={user:{account:1,nick:3,avatar:4,signature:5,gender:6,email:7,birth:8,tel:9,ext:10,createTime:12,updateTime:13},relationMember:{account:0,isMuted:1,isBlack:2,createTime:3,updateTime:4}},wm=invertSerializeMap(Mm),_m={updatePushToken:{sid:3,cid:1,service:"user",params:[{type:"String",name:"tokenName"},{type:"String",name:"token"},{type:"Int",name:"pushkit"}]},updateAppBackground:{sid:3,cid:2,service:"user",params:[{type:"Boolean",name:"isBackground"},{type:"Int",name:"badge"}]},syncMyNameCard:{sid:3,cid:109,service:"user",response:[{type:"Property",name:"user",reflectMapper:wm.user},{type:"Number",name:"timetag"}]},setBlack:{service:"user",sid:3,cid:3,params:[{type:"String",name:"account"},{type:"bool",name:"isAdd"}]},onUpdateBlackList:{service:"user",sid:3,cid:103,response:[{type:"String",name:"account"},{type:"Boolean",name:"isAdd"}]},setMute:{service:"user",sid:3,cid:5,params:[{type:"String",name:"account"},{type:"bool",name:"isAdd"}]},onUpdateMuteList:{service:"user",sid:3,cid:105,response:[{type:"String",name:"account"},{type:"Boolean",name:"isAdd"}]},syncRelations:{service:"user",sid:3,cid:8,params:[{type:"long",name:"timetag"}],response:[{type:"PropertyArray",name:"list",reflectMapper:wm.relationMember},{type:"Number",name:"timetag"}]},getUsersNameCardFromServer:{service:"user",sid:3,cid:7,params:[{type:"StrArray",name:"accounts"}],response:[{type:"PropertyArray",name:"users",reflectMapper:wm.user}]},updateMyNameCard:{service:"user",sid:3,cid:10,params:[{type:"Property",name:"user",reflectMapper:Mm.user}],response:[{type:"Number",name:"timetag"}]},onUpdateMyNameCard:{service:"user",sid:3,cid:110,response:[{type:"Property",name:"user",reflectMapper:wm.user}]}},xm={subType:{type:"string"},setting:{resendFlag:{type:"boolean"},envConfig:{type:"string"},needSaveHistory:{type:"boolean"},needRoaming:{type:"boolean"},needOffline:{type:"boolean"},needSelfSync:{type:"boolean"},needRouted:{type:"boolean"},needUpdateSession:{type:"boolean"},isMuted:{type:"boolean"}},antiSpamInfo:{needAntiSpam:{type:"boolean"},antiSpamContent:{type:"string"},antiSpamBIZID:{type:"string"},clientAntispamHitting:{type:"boolean"},antiSpamUsingYidun:{type:"boolean"},yidunCallbackURL:{type:"string"},yidunAntiCheating:{type:"string"},yidunAntiSpamExtension:{type:"string"},yidunAntiSpamResult:{type:"string"}},pushInfo:{needPush:{type:"boolean"},needPushBadge:{type:"boolean"},needPushNick:{type:"boolean"},pushApnsText:{type:"string"},pushPayload:{type:"string"}},teamSpecializationInfo:{needForcePush:{type:"boolean"},needACK:{type:"boolean"},forcePushIDsList:{type:"string"},pushContent:{type:"string"},isACKSent:{type:"boolean"},ackSnapshot:{type:"number"}},threadMessageInfo:{replyMsgFromAccount:{type:"string"},replyMsgToAccount:{type:"string"},replyMsgTime:{type:"number"},replyMsgIdServer:{type:"string"},replyMsgIdClient:{type:"string"},threadMsgFromAccount:{type:"string"},threadMsgToAccount:{type:"string"},threadMsgTime:{type:"number"},threadMsgIdServer:{type:"string"},threadMsgIdClient:{type:"string"}}},km={0:"addTeamMembers",1:"removeTeamMembers",2:"leaveTeam",3:"updateTeam",4:"dismissTeam",5:"passTeamApply",6:"transferTeam",7:"addTeamManagers",8:"removeTeamManagers",9:"acceptTeamInvite",10:"updateTeamMemberMute",101:"netcallMiss",102:"netcallBill",103:"netcallReject",401:"addSuperTeamMembers",402:"removeSuperTeamMembers",403:"leaveSuperTeam",404:"updateSuperTeam",405:"dismissSuperTeam",406:"transferSuperTeam",407:"addSuperTeamManagers",408:"removeSuperTeamManagers",409:"updateSuperTeamMembersMute",410:"passSuperTeamApply",411:"acceptSuperTeamInvite"};function getSessionId(t,a){return Hp[t.scene]+"-"+(t.to===a?t.from:t.to)}function formatMsg(t,a){var o=a.account,c=a.featureValue,m=a.statusValue,h=a.sessionAck,v=a.msgReceiptTime,b=Hp[t.scene],S=t.to===o?t.from:t.to,T=Gp.default,M=$p.unread;Bl(t.isInBlackList)>0?(M=$p.refused,delete t.isInBlackList):M=t.from===o?v&&v>=+t.time?$p.receipt:$p.sent:h&&h>=+t.time?$p.read:$p.unread;var w=Ao(Ao({},format(xm,t)),{scene:b,type:Dp[t.type],fromClientType:zp[t.fromClientType],flow:t.from===o?"out":"in",target:S,to:t.to,from:t.from,time:t.time?+t.time:void 0,userUpdateTime:t.userUpdateTime?+t.userUpdateTime:void 0,idClient:t.idClient,sessionId:b+"-"+S,status:$p[m||M],feature:Gp[c||T]});if("string"==typeof w.attach)try{w.attach=JSON.parse(w.attach)}catch(t){}return"notification"===w.type&&(w.attach=w.attach?function formatNotificationAttach(t){var a,o={};if(o.type=km[t.id]||t.id,!t.data)return o;var c,m={ids:"accounts",id:"account",attach:"custom",channel:"channelId",calltype:"netcallType",mute:"mute",duration:"duration",time:"time",from:"from",ext:"ext"},h=t.data;return forEach$1(a=xo(m)).call(a,(function(t){void 0!==h[t]&&(o[m[t]]=h[t])})),h.tinfo&&(o.team=formatTeam(deserialize(h.tinfo,bm.team))),h.uinfos&&(o.users=map(c=h.uinfos).call(c,(function(t){return formatUser(deserialize(t,wm.user))}))),void 0!==h.mute&&(o.mute=1===Bl(h.mute)),o}(w.attach):{}),w}function formatMsgs(t,a){return t&&t.length>0?map(t).call(t,(function(t){return formatMsg(t,a)})):[]}function formatDeletedMsgs(t,a){return map(t).call(t,(function(t){var o;return o=a||(rm(Bl(t.scene))?t.scene:1===Bl(t.scene)?"p2p":"team"),{deletedTime:Bl(t.time),from:t.from,idClient:t.deletedIdClient||t.idClient,idServer:t.deletedIdServer||t.idServer,scene:o,time:Bl(t.time),to:t.to}}))}var Im=Array.prototype.reverse;var Cm=function reverse(t){return null==t?t:Im.call(t)},Em=function(){function ModuleService(t){this.core=t}return ModuleService.prototype.processBroadcastMsg=function processBroadcastMsg(t){var a=map(t).call(t,(function(t){return Ao(Ao({},t),{time:Bl(t.time)})}));return this.core.sendCmd("batchMarkRead",{sid:7,cid:17,ids:map(a).call(a,(function(t){return t.id}))}),a},ModuleService}(),Am={"4_4":"syncOfflineMsgs","4_9":"syncRoamingMsgs","4_17":"syncRoamingMsgs","4_21":"syncDeleteSelfMsgs","7_1":"sendMsg","8_23":"getHistoryTeamMsgs","21_14":"getHistorySuperTeamMsgs","8_2":"sendTeamMsg","21_2":"sendSuperTeamMsg","7_11":"sendMsgReceipt","7_13":"recallMsg","7_24":"deleteSelfMsgs","21_17":"recallSuperTeamMsg","7_2":"onMsg","8_3":"onMsg","21_3":"onMsg","7_101":"onMsg","8_102":"onMsg","21_102":"onMsg","8_4":"nimOnTeamMsgs","4_16":"syncBroadcastMsg","7_17":"onBroadcastMsg","7_123":"onDeleteSelfMsg","7_124":"onDeleteSelfMsgs"},Pm={scene:0,to:1,from:2,fromClientType:4,fromDeviceId:5,fromNick:6,time:7,type:8,body:9,attach:10,idClient:11,idServer:12,resendFlag:13,userUpdateTime:14,ext:15,pushPayload:16,pushApnsText:17,forcePushIDsList:18,pushContent:19,needForcePush:20,needAntiSpam:21,antiSpamContent:22,antiSpamBIZID:23,clientAntispamHitting:24,antiSpamUsingYidun:25,needACK:26,yidunCallbackURL:27,needUpdateSession:28,replyMsgFromAccount:29,replyMsgToAccount:30,replyMsgTime:31,replyMsgIdServer:32,replyMsgIdClient:33,threadMsgFromAccount:34,threadMsgToAccount:35,threadMsgTime:36,threadMsgIdServer:37,threadMsgIdClient:38,isDeleted:39,callbackExt:40,subType:41,yidunAntiCheating:42,envConfig:43,yidunAntiSpamExtension:44,yidunAntiSpamResult:45,needSaveHistory:100,needRoaming:101,needSelfSync:102,isMuted:104,needRouted:105,isInBlackList:106,needPush:107,needOffline:108,needPushBadge:109,needPushNick:110,isReplyMsg:111,ackSnapshot:112},Om={msg:Pm,recallMsgTag:{time:0,type:1,to:2,from:3,ps:4,attach:5,apnsText:8,pushPayload:9,deletedIdClient:10,deletedIdServer:11,opeAccount:16,env:21},deleteSelfMsgTag:{scene:1,from:2,to:3,idServer:4,idClient:5,time:6,deletedTime:7,ext:8},msgReceiptTag:{to:1,from:2,time:7,idClient:11},broadcastMsg:{id:1,fromAccid:2,time:4,body:5}},Rm=invertSerializeMap(Om),jm={sendMsg:{sid:7,cid:1,service:"msg",params:[{type:"Property",name:"msg",reflectMapper:Om.msg}],response:[{type:"Property",name:"msg",reflectMapper:Rm.msg}],ignoreErrCodes:[7101]},sendTeamMsg:{sid:8,cid:2,service:"msg",params:[{type:"Property",name:"msg",reflectMapper:Om.msg}],response:[{type:"Property",name:"msg",reflectMapper:Rm.msg}]},sendSuperTeamMsg:{sid:21,cid:2,service:"msg",params:[{type:"Property",name:"msg",reflectMapper:Om.msg}],response:[{type:"Property",name:"msg",reflectMapper:Rm.msg}]},onMsg:{sid:7,cid:2,service:"msg",response:[{type:"Property",name:"msg",reflectMapper:Rm.msg}]},nimOnTeamMsgs:{sid:8,cid:4,service:"msg",response:[{type:"PropertyArray",name:"datas",reflectMapper:Rm.msg}]},getHistoryTeamMsgs:{sid:8,cid:23,service:"msg",params:[{type:"Long",name:"to"},{type:"Long",name:"beginTime"},{type:"Long",name:"endTime"},{type:"Long",name:"lastMsgId"},{type:"int",name:"limit"},{type:"bool",name:"reverse"},{type:"LongArray",name:"msgTypes"}],response:[{type:"PropertyArray",name:"msgs",reflectMapper:Rm.msg}]},getHistorySuperTeamMsgs:{sid:21,cid:14,params:[{type:"Long",name:"to"},{type:"Long",name:"beginTime"},{type:"Long",name:"endTime"},{type:"Long",name:"lastMsgId"},{type:"int",name:"limit"},{type:"bool",name:"reverse"},{type:"LongArray",name:"msgTypes"}],response:[{type:"PropertyArray",name:"msgs",reflectMapper:Rm.msg}],service:"msg"},recallMsg:{sid:7,cid:13,service:"msg",params:[{type:"Property",name:"recallMsgTag",reflectMapper:Om.recallMsgTag}]},deleteSelfMsgs:{sid:7,cid:24,service:"msg",params:[{type:"PropertyArray",name:"deletedMsgs",reflectMapper:Om.deleteSelfMsgTag}],response:[{type:"Long",name:"timetag"}]},recallSuperTeamMsg:{sid:21,cid:17,service:"msg",params:[{type:"Property",name:"recallMsgTag",reflectMapper:Om.recallMsgTag}]},sendMsgReceipt:{sid:7,cid:11,service:"msg",params:[{type:"Property",name:"msgReceiptTag",reflectMapper:Om.msgReceiptTag}],response:[{type:"Property",name:"msgReceiptTag",reflectMapper:Rm.msgReceiptTag}]},batchMarkRead:{sid:4,cid:5,service:"msg",isNoResponse:!0,params:[{type:"byte",name:"sid"},{type:"byte",name:"cid"},{type:"LongArray",name:"ids"}]},syncMsgReceipts:{sid:4,cid:12,service:"msg",response:[{type:"PropertyArray",name:"msgReceipts",reflectMapper:Rm.msgReceiptTag},{type:"Number",name:"timetag"}]},syncOfflineMsgs:{sid:4,cid:4,service:"msg",response:[{type:"PropertyArray",name:"msgs",reflectMapper:Rm.msg}]},syncRoamingMsgs:{sid:4,cid:9,service:"msg",response:[{type:"PropertyArray",name:"msgs",reflectMapper:Rm.msg}]},syncBroadcastMsg:{sid:4,cid:16,service:"msg",response:[{type:"PropertyArray",name:"msgs",reflectMapper:Rm.broadcastMsg}]},onBroadcastMsg:{sid:7,cid:17,service:"msg",response:[{type:"Property",name:"msg",reflectMapper:Rm.broadcastMsg}]},onDeleteSelfMsg:{sid:7,cid:123,service:"msg",response:[{type:"Property",name:"deletedMsg",reflectMapper:Rm.deleteSelfMsgTag}]},onDeleteSelfMsgs:{sid:7,cid:124,service:"msg",response:[{type:"PropertyArray",name:"deletedMsgs",reflectMapper:Rm.deleteSelfMsgTag}]},syncDeleteSelfMsgs:{sid:4,cid:21,service:"msg",response:[{type:"PropertyArray",name:"deletedMsgs",reflectMapper:Rm.deleteSelfMsgTag}]}},Fm=function(t){function MsgService(a){var o;return(o=t.call(this,"msg",a)||this).service=new Em(a),registerParser({cmdMap:Am,cmdConfig:jm}),o}_t(MsgService,t);var a=MsgService.prototype;return a.sendTextMsg=function sendTextMsg(t){return validate({body:{type:"string",allowEmpty:!1}},t),this.sendMsg(Ao(Ao({},t),{type:"text"}))},a.sendTipMsg=function sendTipMsg(t){return validate({body:{type:"string",allowEmpty:!1}},t),this.sendMsg(Ao(Ao({},t),{type:"tip"}))},a.sendGeoLocationMsg=function sendGeoLocationMsg(t){return validate({attach:{type:"object",rules:{title:{type:"string",allowEmpty:!1},lat:{type:"number"},lng:{type:"number"}}}},t),this.sendMsg(Ao(Ao({},t),{type:"geo",attach:Oo(t.attach)}))},a.sendCustomMsg=function sendCustomMsg(t){return validate({attach:{type:"string",allowEmpty:!1}},t),this.sendMsg(Ao(Ao({},t),{type:"custom"}))},a.sendMsg=function sendMsg(t){var a,o=this;validate({scene:{type:"enum",values:getEnumKeys(Hp)},type:{type:"enum",values:getEnumKeys(Dp)},to:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1},setting:{type:"object",rules:{resendFlag:{type:"boolean",required:!1},needSaveHistory:{type:"boolean",required:!1},needRoaming:{type:"boolean",required:!1},needOffline:{type:"boolean",required:!1},needSelfSync:{type:"boolean",required:!1},needRouted:{type:"boolean",required:!1},needUpdateSession:{type:"boolean",required:!1}},required:!1},antiSpamInfo:{type:"object",required:!1,rules:{clientAntispamHitting:{type:"boolean",required:!1},antiSpamUsingYidun:{type:"boolean",required:!1}}},pushInfo:{type:"object",required:!1,rules:{needPush:{type:"boolean",required:!1},pushApnsText:{type:"string",allowEmpty:!1,required:!1},pushPayload:{type:"string",allowEmpty:!1,max:2048,required:!1}}},teamSpecializationInfo:{type:"object",required:!1,rules:{needForcePush:{type:"boolean",required:!1},needACK:{type:"boolean",required:!1},forcePushIDsList:{type:"string",allowEmpty:!1,required:!1},pushContent:{type:"string",allowEmpty:!1,max:150,required:!1}}}},t);var c,m="p2p"===t.scene?"sendMsg":"team"===t.scene?"sendTeamMsg":"sendSuperTeamMsg",h=function generatorMsgForCmd(t,a,o,c){t.onSendBefore,t.onUploadStart,t.onUploadDone;var m=t.replyMsg,h=__rest(t,["onSendBefore","onUploadStart","onUploadDone","replyMsg"]),v=Ao(Ao({},formatReverse(xm,h)),{scene:Hp[t.scene],type:Dp[t.type],from:a,fromClientType:16,fromDeviceId:o,fromNick:null==c?void 0:c.nick,userUpdateTime:null==c?void 0:c.updateTime,status:$p[$p.sending]});if(v.idClient=v.resendFlag?t.idClient:ql(),!v.idClient)throw new Sc("idClient is required to resend a message","idClient","required");return v.scene===Hp.team&&v.needForcePush&&(v.pushContent=v.pushContent||v.pushApnsText,v.forcePushIDsList=v.forcePushIDsList?v.forcePushIDsList:"#%@all@%#"),m&&(v.replyMsgFromAccount=m.from,v.replyMsgToAccount=m.to,v.replyMsgTime=+m.time,v.replyMsgIdServer=m.idServer,v.replyMsgIdClient=m.idClient,v.threadMsgFromAccount=m.from,v.threadMsgToAccount=m.to,v.threadMsgTime=+m.time,v.threadMsgIdServer=m.idServer,v.threadMsgIdClient=m.idClient,m.threadMessageInfo&&m.threadMessageInfo.threadMsgIdServer&&(v.threadMsgFromAccount=m.threadMessageInfo.threadMsgFromAccount,v.threadMsgToAccount=m.threadMessageInfo.threadMsgToAccount,v.threadMsgTime=m.threadMessageInfo.threadMsgTime,v.threadMsgIdServer=m.threadMessageInfo.threadMsgIdServer,v.threadMsgIdClient=m.threadMessageInfo.threadMsgIdClient)),v}(t,this.core.account,this.core.config.deviceId,null===(a=this.core.user)||void 0===a?void 0:a.myInfo),v=formatMsg(Ao(Ao({},h),{time:(new Date).getTime()}),{account:this.core.account,featureValue:Gp.default,statusValue:$p.sending});try{t.onSendBefore&&t.onSendBefore(v)}catch(t){this.logger.error("sendMsg: options.onSendBefore error",t)}return this.core.eventBus.emit("session/updateForNewMsg",v),this.core.sendCmd(m,{msg:h}).then((function(a){var m=a.content,b=a.error,S=formatMsg(Ao(Ao({},h),m.msg),{account:o.core.account,featureValue:Gp.default,statusValue:$p.sent});if(c=m.msg,o.core.eventBus.emit("session/updateForNewMsg",S),o.core.reporter.report("msgSend",{msgId:S.idServer,clientId:S.idClient,msgTime:S.time,fromAccid:"p2p"===t.scene?o.core.account:"",toAccid:S.to,type:Hp[S.scene],roomId:"",tid:"p2p"===t.scene?"":S.to,result:200,faiReason:"",rt:vs()-v.time}),b)throw b;return S})).catch((function(a){var m=formatMsg(Ao(Ao(Ao({},h),c),{time:(new Date).getTime()}),{account:o.core.account,featureValue:Gp.default,statusValue:7101===a.code?$p.refused:$p.sendFailed});throw a.msg=m,o.core.eventBus.emit("session/updateForNewMsg",m),o.core.reporter.report("msgSend",{msgId:m.idServer,clientId:m.idClient,msgTime:m.time,fromAccid:"p2p"===t.scene?o.core.account:"",toAccid:m.to,type:Hp[m.scene],roomId:"",tid:"p2p"===t.scene?"":m.to,result:null==a?void 0:a.code,faiReason:(null==a?void 0:a.message)||"",rt:vs()-v.time}),a}))},a.resendMsg=function resendMsg(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var a,o;return Mo.wrap((function _callee$(c){for(;;)switch(c.prev=c.next){case 0:if(validate({msg:{type:"object",rules:{idClient:{type:"string",allowEmpty:!1}}}},t),a=t.msg,o=Ao(Ao({},a),{attach:a.attach?Oo(a.attach):void 0,setting:{resendFlag:!0}}),a.from===this.core.account){c.next=5;break}throw new Error("You can only resend messages that you sent: "+a.idClient);case 5:return c.abrupt("return",this.sendMsg(o));case 6:case"end":return c.stop()}}),_callee,this)})))},a.forwardMsg=function forwardMsg(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var a,o;return Mo.wrap((function _callee2$(c){for(;;)switch(c.prev=c.next){case 0:return validate({msg:{type:"object",rules:{idClient:{type:"string",allowEmpty:!1}}},scene:{type:"enum",values:getEnumKeys(Hp)},to:{type:"string",allowEmpty:!1}},t),a=t.msg,o=Ao(Ao({},a),{scene:t.scene,to:t.to,attach:a.attach?Oo(a.attach):void 0}),c.abrupt("return",this.sendMsg(o));case 4:case"end":return c.stop()}}),_callee2,this)})))},a.sendImageMsg=function sendImageMsg(t){return this.doSendFile(Ao(Ao({},t),{type:"image"}))},a.sendFileMsg=function sendFileMsg(t){return this.doSendFile(Ao(Ao({},t),{type:"file"}))},a.sendAudioMsg=function sendAudioMsg(t){return this.doSendFile(Ao(Ao({},t),{type:"audio"}))},a.sendVideoMsg=function sendVideoMsg(t){return this.doSendFile(Ao(Ao({},t),{type:"video"}))},a.doSendFile=function doSendFile(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){var a;return Mo.wrap((function _callee3$(o){for(;;)switch(o.prev=o.next){case 0:if(validate({scene:{type:"enum",values:getEnumKeys(Hp)},to:{type:"string",allowEmpty:!1},type:{type:"string",allowEmpty:!1},attach:{type:"object",rules:{url:{type:"string",allowEmpty:!1}},required:!1},maxSize:{type:"number",min:1,required:!1}},t),a=t.attach){o.next=27;break}if(this.core.cloudStorage&&this.core.cloudStorage.uploadFile){o.next=5;break}throw new Error('Service "cloudStorage" does not exist');case 5:return o.prev=5,this.core.reporter.reportTraceStart("nos",{user_id:this.core.account,action:"upload"}),o.next=9,this.core.cloudStorage.uploadFile(t);case 9:a=o.sent,this.core.reporter.reportTraceEnd("nos",!0),o.next=19;break;case 13:throw o.prev=13,o.t0=o.catch(5),this.core.reporter.reportTraceUpdate("nos",{operation_type:"transfer",error:o.t0},!1),this.core.reporter.reportTraceEnd("nos",!1),this.logger.error("sendFile:: upload File error or abort",o.t0),o.t0;case 19:o.prev=19,t.onUploadDone&&t.onUploadDone(a),o.next=27;break;case 23:throw o.prev=23,o.t1=o.catch(19),this.logger.error("sendFile options.onUploadDone err",o.t1),o.t1;case 27:return o.abrupt("return",this.sendMsg(Ao(Ao({},t),{attach:Oo(a),type:t.type})));case 28:case"end":return o.stop()}}),_callee3,this,[[5,13],[19,23]])})))},a.recallMsg=function recallMsg(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee4(){var a,o,c;return Mo.wrap((function _callee4$(m){for(;;)switch(m.prev=m.next){case 0:return validate({msg:{type:"object",rules:{idClient:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1},scene:{type:"enum",values:getEnumKeys(Hp)},time:{type:"number"}}},apnsText:{type:"string",allowEmpty:!1,required:!1},ps:{type:"string",allowEmpty:!1,required:!1}},t),a=t.msg,o={p2p:"recallMsg",team:"recallMsg",superTeam:"recallSuperTeamMsg"},c={p2p:7,team:8,superTeam:12},m.next=6,this.core.sendCmd(o[a.scene],{recallMsgTag:{time:a.time,type:c[a.scene],to:a.to,from:a.from,ps:t.ps,attach:t.attach,apnsText:t.apnsText,pushPayload:t.pushPayload,deletedIdClient:a.idClient,deletedIdServer:a.idServer,opeAccount:a.from,env:t.env}});case 6:return this.core.eventBus.emit("session/updateForDeletedMsg",formatDeletedMsgs([a])),m.abrupt("return",a);case 8:case"end":return m.stop()}}),_callee4,this)})))},a.deleteSelfMsgs=function deleteSelfMsgs(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee5(){var a,o,c;return Mo.wrap((function _callee5$(m){for(;;)switch(m.prev=m.next){case 0:return validate({msgs:{type:"array",rules:{scene:{type:"enum",values:["p2p","team"]},from:{type:"string",allowEmpty:!1},to:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1},idClient:{type:"string",allowEmpty:!1},time:{type:"number",allowEmpty:!1}}},ext:{type:"string",allowEmpty:!1,required:!1}},t),a=t.msgs,o=map(a).call(a,(function(a){return{scene:"p2p"===a.scene?1:2,from:a.from,to:a.to,idServer:a.idServer,idClient:a.idClient,time:a.time,ext:t.ext}})),m.next=5,this.core.sendCmd("deleteSelfMsgs",{deletedMsgs:o});case 5:return c=formatDeletedMsgs(o),this.core.eventBus.emit("session/updateForDeletedMsg",c),m.abrupt("return",c);case 8:case"end":return m.stop()}}),_callee5,this)})))},a.sendMsgReceipt=function sendMsgReceipt(t){var a,o;return __awaiter(this,void 0,void 0,Mo.mark((function _callee6(){var c,m,h,v;return Mo.wrap((function _callee6$(b){for(;;)switch(b.prev=b.next){case 0:if(validate({msg:{type:"object",rules:{idClient:{type:"string",allowEmpty:!1},target:{type:"string",allowEmpty:!1},time:{type:"number"}}}},t),"p2p"===(c=t.msg).scene&&"in"===c.flow){b.next=5;break}return this.logger.warn("Msg scene: "+c.scene+", flow: "+c.flow+" is not allowed to send msg receipt"),b.abrupt("return",void 0);case 5:return m={to:c.target,idClient:c.idClient,time:c.time},b.next=8,this.core.sendCmd("sendMsgReceipt",{msgReceiptTag:m});case 8:return h=b.sent,v=Bl(null===(o=null===(a=h.content)||void 0===a?void 0:a.msgReceiptTag)||void 0===o?void 0:o.time),b.abrupt("return",Ao(Ao({},m),{time:v?Math.min(v,m.time):m.time}));case 11:case"end":return b.stop()}}),_callee6,this)})))},a.sendTeamMsgReceipt=function sendTeamMsgReceipt(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee7(){var a;return Mo.wrap((function _callee7$(o){for(;;)switch(o.prev=o.next){case 0:return validate({teamMsgReceipts:{type:"array",rules:{teamId:{type:"string",allowEmpty:!1},idClient:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1}},max:50}},t),a=t.teamMsgReceipts,this.core.sendCmd("sendTeamMsgReceipt",{teamMsgReceipts:a}),o.abrupt("return",void 0);case 4:case"end":return o.stop()}}),_callee7,this)})))},a.getTeamMsgReads=function getTeamMsgReads(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee8(){var o,c,m;return Mo.wrap((function _callee8$(h){for(;;)switch(h.prev=h.next){case 0:return validate({teamMsgReceipts:{type:"array",rules:{teamId:{type:"string",allowEmpty:!1},idClient:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1}}}},t),o=t.teamMsgReceipts,h.next=4,this.core.sendCmd("getTeamMsgReads",{teamMsgReceipts:o});case 4:return c=h.sent,m=(m=null===(a=c.content)||void 0===a?void 0:a.teamMsgReceipts)?map(m).call(m,(function(t){return Ao(Ao({},t),{read:Bl(t.read),unread:Bl(t.unread)})})):[],h.abrupt("return",m);case 8:case"end":return h.stop()}}),_callee8,this)})))},a.getTeamMsgReadAccounts=function getTeamMsgReadAccounts(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee9(){var a,o;return Mo.wrap((function _callee9$(c){for(;;)switch(c.prev=c.next){case 0:return validate({teamMsgReceipt:{type:"object",rules:{teamId:{type:"string",allowEmpty:!1},idClient:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1}}}},t),a=t.teamMsgReceipt,c.next=4,this.core.sendCmd("getTeamMsgReadAccounts",{teamMsgReceiptTag:a});case 4:return o=c.sent,c.abrupt("return",o.content);case 6:case"end":return c.stop()}}),_callee9,this)})))},a.markMsgsAck=function markMsgsAck(t){if(t&&t.length>0){var a=[],o=[];forEach$1(t).call(t,(function(t){"p2p"===t.scene&&"in"===t.flow?a.push(t):"team"===t.scene&&"in"===t.flow&&o.push(t)})),a.length>0&&this.core.sendCmd("batchMarkRead",{sid:7,cid:2,ids:map(a).call(a,(function(t){return t.idServer}))}),o.length>0&&this.core.sendCmd("batchMarkRead",{sid:8,cid:3,ids:map(o).call(o,(function(t){return t.idServer}))})}},a.onMsgHandler=function onMsgHandler(t){var a;if(t.error)this.logger.error("msgHandler::recvError",t.error);else{var o=vs(),c=getSessionId(t.content.msg,this.core.account),m=null===(a=this.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:c}),h=formatMsg(t.content.msg,m?{account:this.core.account,sessionAck:m.ack,msgReceiptTime:m.msgReceiptTime}:{account:this.core.account});if("debug"===this.core.options.debugLevel?this.logger.debug("msgHandler::recvMsg",h.idClient,h.idServer,h):this.logger.log("msgHandler::recvMsg",h.idClient,h.idServer),this.markMsgsAck([h]),"notification"===h.type)this.core.eventBus.emit("session/updateForNewMsg",h),this.core.eventBus.emit("team/onNotification",h);else{if("out"!==h.flow){var v="p2p"===h.scene,b={msgId:h.idServer,clientId:h.idClient,receiveTime:t.__receiveTime,serverTime:h.time,callbackTime:vs(),preHandleTime:o,fromAccid:h.from,toAccid:this.core.account,type:Hp[h.scene],tid:v?"":h.to,result:200,failReason:"",rt:vs()-h.time};this.core.reporter.report("msgReceive",b,!0)}this.core.eventBus.emit("session/updateForNewMsg",h),this.core.emit("msg",h)}}},a.nimOnTeamMsgsHandler=function nimOnTeamMsgsHandler(t){var a,o=this;forEach$1(a=t.content.datas).call(a,(function(a){o.onMsgHandler(Ao({},t,{content:{msg:a}}))}))},a.syncRoamingMsgsHandler=function syncRoamingMsgsHandler(t){var a,o=t.content.msgs||[];if(0!==o.length){var c=getSessionId(o[0],this.core.account),m=null===(a=this.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:c}),h=(o=formatMsgs(o,m?{account:this.core.account,featureValue:Gp.roam,sessionAck:m.ack,msgReceiptTime:m.msgReceiptTime}:{account:this.core.account,featureValue:Gp.roam}))[0].time,v={timetag:h,sessionId:c,msgs:Cm(o)};this.core.eventBus.emit("session/syncMsgs",v),this.core.emit("syncRoamingMsgs",v),this.core.eventBus.emit("sync/updateTimetag",{roamingMsgs:h})}},a.syncOfflineMsgsHandler=function syncOfflineMsgsHandler(t){var a,o=this,c=t.content.msgs||[];if(0!==c.length){var m={},h=[];forEach$1(c).call(c,(function(t){var a=getSessionId(t,o.core.account),c=o.core.session.getSessionWithUncomplete({id:a}),v=formatMsg(t,c?{account:o.core.account,featureValue:Gp.leave,sessionAck:c.ack,msgReceiptTime:c.msgReceiptTime}:{account:o.core.account,featureValue:Gp.leave});h.push(v),m[v.sessionId]?m[v.sessionId].push(v):m[v.sessionId]=[v]})),this.markMsgsAck(h);var v=0;forEach$1(a=xo(m)).call(a,(function(t){var a,c=sort(a=m[t]).call(a,(function(t,a){return a.time-t.time}));c[0].time>v&&(v=c[0].time);var h={timetag:c[0].time,sessionId:t,msgs:c};o.core.eventBus.emit("session/syncMsgs",h),o.core.emit("syncOfflineMsgs",h)})),this.core.eventBus.emit("sync/updateTimetag",{offlineMsgs:v})}},a.syncDeleteSelfMsgsHandler=function syncDeleteSelfMsgsHandler(t){var a,o=null===(a=t.content)||void 0===a?void 0:a.deletedMsgs;o&&o.length>0||this.logger.warn("syncDeleteSelfMsgs:: no msgs");var c=o[o.length-1].time;this.core.eventBus.emit("sync/updateTimetag",{deleteSelfMsgs:c})},a.onDeleteSelfMsgHandler=function onDeleteSelfMsgHandler(t){var a=formatDeletedMsgs([t.content.deletedMsg]);this.core.eventBus.emit("session/updateForDeletedMsg",a),this.core.emit("deleteSelfMsgs",a)},a.onDeleteSelfMsgsHandler=function onDeleteSelfMsgsHandler(t){var a=formatDeletedMsgs(t.content.deletedMsgs);this.core.eventBus.emit("session/updateForDeletedMsg",a),this.core.emit("deleteSelfMsgs",a)},a.onBroadcastMsgHandler=function onBroadcastMsgHandler(t){var a=t.content.msg,o=this.service.processBroadcastMsg([a]);this.core.emit("broadcastMsgs",o)},a.syncBroadcastMsgHandler=function syncBroadcastMsgHandler(t){var a=t.content.msgs,o=this.service.processBroadcastMsg(a);this.core.emit("broadcastMsgs",o)},MsgService}(Wp),Lm={"5_1":"sync"},Nm={sync:{sid:5,cid:1,service:"sync",isNoResponse:!0,params:[{type:"Property",name:"sync",reflectMapper:{myInfo:1,offlineMsgs:2,teams:3,roamingMsgs:7,relations:9,friends:11,friendUsers:13,msgReceipts:14,myTeamMembers:15,donnop:16,recallMsg:17,sessionAck:18,broadcastMsgs:20,signaling:21,superTeams:22,myInfoInSuperTeams:23,superTeamRoamingMsgs:24,deleteSuperTeamMsg:25,superTeamSessionAck:26,deleteSelfMsgs:27,stickTopSessions:28,sessionHistoryMsgsDelete:29}}],response:[{type:"Number",name:"timetag"}]}},Um=function(t){function SyncService(a,o){var c;return void 0===o&&(o={}),(c=t.call(this,"sync",a)||this).options=o,c.options=Ao({myInfo:!!a.user.name,offlineMsgs:!!a.msg.name,teams:!!a.team.name,roamingMsgs:!!a.msg.name,relations:!!a.user.name,friends:!!a.friend.name,friendUsers:!!a.user.name,msgReceipts:!!a.msg.name,recallMsg:!!a.msg.name,sessionAck:!!a.session.name,superTeamSessionAck:!!a.session.name,superTeams:!!a.superTeam.name,superTeamRoamingMsgs:!!a.superTeam.name,deleteSuperTeamMsg:!!a.superTeam.name,deleteSelfMsgs:!!a.msg.name,sessionHistoryMsgsDelete:!!a.msgLog.name,signaling:!!a.signaling.name},o),c.timetags={},c.pArray=[],c.initEventListeners(),registerParser({cmdMap:Lm,cmdConfig:Nm}),c}_t(SyncService,t);var a=SyncService.prototype;return a.doSync=function doSync(){return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var t;return Mo.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:return t=this.genSyncParams(),this.logger.log("doSync: ",t),a.next=4,this.core.sendCmd("sync",{sync:t});case 4:case"end":return a.stop()}}),_callee,this)})))},a.initEventListeners=function initEventListeners(){var t=this;this.core.eventBus.on("sync/updateTimetag",(function(a){var o;forEach$1(o=xo(a)).call(o,(function(o){a[o]>(t.timetags[o]||0)&&(t.timetags[o]=a[o])}))}))},a.genSyncParams=function genSyncParams(){var t,a,o=this;return reduce(t=filter(a=xo(this.options)).call(a,(function(t){var a=t;return o.options[a]}))).call(t,(function(t,a){var c=a;return t[c]=o.timetags[c]||0,t}),{})},a.handleImmediate=function handleImmediate(t){var a;this.core.session&&this.core.session.onSyncDone&&this.core.session.onSyncDone(),this.logger.log("sync: emit syncdone",null===(a=t.content)||void 0===a?void 0:a.timetag),this.core.emit("syncdone")},a.syncHandler=function syncHandler(t){var a=this;"ALI"===function getMiniappEnv(){return"undefined"!=typeof tt&&tt.getSystemInfo?"TT":"undefined"!=typeof swan&&swan.getSystemInfo?"BAIDU":"undefined"!=typeof my&&my.getSystemInfo?"ALI":"undefined"!=typeof wx&&wx.getSystemInfo?"WX":"unknow environment"}()?(this.logger.log("sync: emit ALIAPP sycnHandler, handle later"),gs((function(){a.handleImmediate(t)}),100)):this.handleImmediate(t)},SyncService}(Wp),Bm={"6_26":"getNosCdnHost"},qm={getNosCdnHost:{sid:6,cid:26,service:"misc",response:[{type:"Property",name:"nosConfigTag",reflectMapper:invertSerializeMap({nosConfigTag:{bucket:1,cdnDomain:2,expire:3,objectNamePrefix:4}}).nosConfigTag}]}},Dm=function(t){function MiscService(a){var o;return(o=t.call(this,"misc",a)||this).core=a,o.nosCdnHostTimer=0,registerParser({cmdMap:Bm,cmdConfig:qm}),o}return _t(MiscService,t),MiscService}(Wp);var Hm=function baseAssignValue(t,a,o){"__proto__"==a&&il?il(t,a,{configurable:!0,enumerable:!0,value:o,writable:!0}):t[a]=o},zm=Object.prototype.hasOwnProperty;var $m=function assignValue(t,a,o){var c=t[a];zm.call(t,a)&&_u(c,o)&&(void 0!==o||a in t)||Hm(t,a,o)};var Gm=function baseSet(t,a,o,c){if(!Us(t))return t;for(var m=-1,h=(a=wp(a,t)).length,v=h-1,b=t;null!=b&&++m<h;){var S=_p(a[m]),T=o;if("__proto__"===S||"constructor"===S||"prototype"===S)return t;if(m!=v){var M=b[S];void 0===(T=c?c(M,S,b):void 0)&&(T=Us(M)?M:gd(a[m+1])?[]:{})}$m(b,S,T),b=b[S]}return t};var Km=function basePickBy(t,a,o){for(var c=-1,m=a.length,h={};++c<m;){var v=a[c],b=xp(t,v);o(b,v)&&Gm(h,wp(v,t),b)}return h};var Wm=function baseHasIn(t,a){return null!=t&&a in Object(t)};var Vm=function hasPath(t,a,o){for(var c=-1,m=(a=wp(a,t)).length,h=!1;++c<m;){var v=_p(a[c]);if(!(h=null!=t&&o(t,v)))break;t=t[v]}return h||++c!=m?h:!!(m=null==t?0:t.length)&&ul(m)&&gd(v,m)&&(up(t)||pd(t))};var Jm=function hasIn(t,a){return null!=t&&Vm(t,a,Wm)};var Xm=function basePick(t,a){return Km(t,a,(function(a,o){return Jm(t,o)}))};var Ym=function arrayPush(t,a){for(var o=-1,c=a.length,m=t.length;++o<c;)t[m+o]=a[o];return t},Qm=Cs?Cs.isConcatSpreadable:void 0;var Zm=function isFlattenable(t){return up(t)||pd(t)||!!(Qm&&t&&t[Qm])};var ef=function baseFlatten(t,a,o,c,m){var h=-1,v=t.length;for(o||(o=Zm),m||(m=[]);++h<v;){var b=t[h];a>0&&o(b)?a>1?baseFlatten(b,a-1,o,c,m):Ym(m,b):c||(m[m.length]=b)}return m};var tf=function flatten(t){return(null==t?0:t.length)?ef(t,1):[]};var rf=function flatRest(t){return cl(rl(t,void 0,tf),t+"")}((function(t,a){return null==t?{}:Xm(t,a)}));_export({global:!0},{globalThis:m});var nf=m,af=af||function(t){var a;"undefined"!=typeof window&&window.crypto&&(a=window.crypto),"undefined"!=typeof self&&self.crypto&&(a=self.crypto),void 0!==nf&&nf.crypto&&(a=nf.crypto),!a&&"undefined"!=typeof window&&window.msCrypto&&(a=window.msCrypto),!a&&"undefined"!=typeof global&&global.crypto&&(a=global.crypto);var o=function cryptoSecureRandomInt(){if(a){if("function"==typeof a.getRandomValues)try{return a.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof a.randomBytes)try{return a.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},c=lt||function(){function F(){}return function(t){var a;return F.prototype=t,a=new F,F.prototype=null,a}}(),m={},h=m.lib={},v=h.Base={extend:function extend(t){var a=c(this);return t&&a.mixIn(t),a.hasOwnProperty("init")&&this.init!==a.init||(a.init=function(){a.$super.init.apply(this,arguments)}),a.init.prototype=a,a.$super=this,a},create:function create(){var t=this.extend();return t.init.apply(t,arguments),t},init:function init(){},mixIn:function mixIn(t){for(var a in t)t.hasOwnProperty(a)&&(this[a]=t[a]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function clone(){return this.init.prototype.extend(this)}},b=h.WordArray=v.extend({init:function init(t,a){t=this.words=t||[],this.sigBytes=null!=a?a:4*t.length},toString:function toString(t){return(t||T).stringify(this)},concat:function concat(t){var a=this.words,o=t.words,c=this.sigBytes,m=t.sigBytes;if(this.clamp(),c%4)for(var h=0;h<m;h++){var v=o[h>>>2]>>>24-h%4*8&255;a[c+h>>>2]|=v<<24-(c+h)%4*8}else for(var b=0;b<m;b+=4)a[c+b>>>2]=o[b>>>2];return this.sigBytes+=m,this},clamp:function clamp(){var a=this.words,o=this.sigBytes;a[o>>>2]&=4294967295<<32-o%4*8,a.length=t.ceil(o/4)},clone:function clone(){var t,clone=v.clone.call(this);return clone.words=slice(t=this.words).call(t,0),clone},random:function random(t){for(var a=[],c=0;c<t;c+=4)a.push(o());return new b.init(a,t)}}),S=m.enc={},T=S.Hex={stringify:function stringify(t){for(var a=t.words,o=t.sigBytes,c=[],m=0;m<o;m++){var h=a[m>>>2]>>>24-m%4*8&255;c.push((h>>>4).toString(16)),c.push((15&h).toString(16))}return c.join("")},parse:function parse(t){for(var a=t.length,o=[],c=0;c<a;c+=2)o[c>>>3]|=Bl(t.substr(c,2),16)<<24-c%8*4;return new b.init(o,a/2)}},M=S.Latin1={stringify:function stringify(t){for(var a=t.words,o=t.sigBytes,c=[],m=0;m<o;m++){var h=a[m>>>2]>>>24-m%4*8&255;c.push(String.fromCharCode(h))}return c.join("")},parse:function parse(t){for(var a=t.length,o=[],c=0;c<a;c++)o[c>>>2]|=(255&t.charCodeAt(c))<<24-c%4*8;return new b.init(o,a)}},w=S.Utf8={stringify:function stringify(t){try{return decodeURIComponent(escape(M.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function parse(t){return M.parse(unescape(encodeURIComponent(t)))}},_=h.BufferedBlockAlgorithm=v.extend({reset:function reset(){this._data=new b.init,this._nDataBytes=0},_append:function _append(t){var a;"string"==typeof t&&(t=w.parse(t)),concat(a=this._data).call(a,t),this._nDataBytes+=t.sigBytes},_process:function _process(a){var o,c=this._data,m=c.words,h=c.sigBytes,v=this.blockSize,S=h/(4*v),T=(S=a?t.ceil(S):t.max((0|S)-this._minBufferSize,0))*v,M=t.min(4*T,h);if(T){for(var w=0;w<T;w+=v)this._doProcessBlock(m,w);o=splice(m).call(m,0,T),c.sigBytes-=M}return new b.init(o,M)},clone:function clone(){var clone=v.clone.call(this);return clone._data=this._data.clone(),clone},_minBufferSize:0});h.Hasher=_.extend({cfg:v.extend(),init:function init(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function reset(){_.reset.call(this),this._doReset()},update:function update(t){return this._append(t),this._process(),this},finalize:function finalize(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function _createHelper(t){return function(a,o){return new t.init(o).finalize(a)}},_createHmacHelper:function _createHmacHelper(t){return function(a,o){return new x.HMAC.init(t,o).finalize(a)}}});var x=m.algo={};return m}(Math),sf=af,cf=sf.lib,uf=cf.WordArray,lf=cf.Hasher,pf=sf.algo,df=[],mf=pf.SHA1=lf.extend({_doReset:function _doReset(){this._hash=new uf.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function _doProcessBlock(t,a){for(var o=this._hash.words,c=o[0],m=o[1],h=o[2],v=o[3],b=o[4],S=0;S<80;S++){if(S<16)df[S]=0|t[a+S];else{var T=df[S-3]^df[S-8]^df[S-14]^df[S-16];df[S]=T<<1|T>>>31}var M=(c<<5|c>>>27)+b+df[S];M+=S<20?1518500249+(m&h|~m&v):S<40?1859775393+(m^h^v):S<60?(m&h|m&v|h&v)-1894007588:(m^h^v)-899497514,b=v,v=h,h=m<<30|m>>>2,m=c,c=M}o[0]=o[0]+c|0,o[1]=o[1]+m|0,o[2]=o[2]+h|0,o[3]=o[3]+v|0,o[4]=o[4]+b|0},_doFinalize:function _doFinalize(){var t=this._data,a=t.words,o=8*this._nDataBytes,c=8*t.sigBytes;return a[c>>>5]|=128<<24-c%32,a[14+(c+64>>>9<<4)]=Math.floor(o/4294967296),a[15+(c+64>>>9<<4)]=o,t.sigBytes=4*a.length,this._process(),this._hash},clone:function clone(){var clone=lf.clone.call(this);return clone._hash=this._hash.clone(),clone}});sf.SHA1=lf._createHelper(mf),sf.HmacSHA1=lf._createHmacHelper(mf),af.SHA1,function(t){var a=t,o=a.lib.Base,c=a.enc.Utf8;a.algo.HMAC=o.extend({init:function init(t,a){t=this._hasher=new t.init,"string"==typeof a&&(a=c.parse(a));var o=t.blockSize,m=4*o;a.sigBytes>m&&(a=t.finalize(a)),a.clamp();for(var h=this._oKey=a.clone(),v=this._iKey=a.clone(),b=h.words,S=v.words,T=0;T<o;T++)b[T]^=1549556828,S[T]^=909522486;h.sigBytes=v.sigBytes=m,this.reset()},reset:function reset(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function update(t){return this._hasher.update(t),this},finalize:function finalize(t){var a,o=this._hasher,c=o.finalize(t);return o.reset(),o.finalize(concat(a=this._oKey.clone()).call(a,c))}})}(af);var ff=af,gf=ff.lib,yf=gf.Base,hf=gf.WordArray,vf=ff.algo,bf=vf.MD5,Sf=vf.EvpKDF=yf.extend({cfg:yf.extend({keySize:4,hasher:bf,iterations:1}),init:function init(t){this.cfg=this.cfg.extend(t)},compute:function compute(t,a){for(var o,c=this.cfg,m=c.hasher.create(),h=hf.create(),v=h.words,b=c.keySize,S=c.iterations;v.length<b;){o&&m.update(o),o=m.update(t).finalize(a),m.reset();for(var T=1;T<S;T++)o=m.finalize(o),m.reset();concat(h).call(h,o)}return h.sigBytes=4*b,h}});ff.EvpKDF=function(t,a,o){return Sf.create(o).compute(t,a)},af.EvpKDF;var Tf=af,Mf=Tf.lib.WordArray;Tf.enc.Base64={stringify:function stringify(t){var a=t.words,o=t.sigBytes,c=this._map;t.clamp();for(var m=[],h=0;h<o;h+=3)for(var v=(a[h>>>2]>>>24-h%4*8&255)<<16|(a[h+1>>>2]>>>24-(h+1)%4*8&255)<<8|a[h+2>>>2]>>>24-(h+2)%4*8&255,b=0;b<4&&h+.75*b<o;b++)m.push(c.charAt(v>>>6*(3-b)&63));var S=c.charAt(64);if(S)for(;m.length%4;)m.push(S);return m.join("")},parse:function parse(t){var a=t.length,o=this._map,c=this._reverseMap;if(!c){c=this._reverseMap=[];for(var m=0;m<o.length;m++)c[o.charCodeAt(m)]=m}var h=o.charAt(64);if(h){var v=indexOf(t).call(t,h);-1!==v&&(a=v)}return function parseLoop(t,a,o){for(var c=[],m=0,h=0;h<a;h++)if(h%4){var v=o[t.charCodeAt(h-1)]<<h%4*2|o[t.charCodeAt(h)]>>>6-h%4*2;c[m>>>2]|=v<<24-m%4*8,m++}return Mf.create(c,m)}(t,a,c)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},af.enc.Base64;var wf=af,_f=wf.lib,xf=_f.WordArray,kf=_f.Hasher,If=wf.algo,Cf=[];!function(){for(var t=0;t<64;t++)Cf[t]=4294967296*Math.abs(Math.sin(t+1))|0}();var Ef=If.MD5=kf.extend({_doReset:function _doReset(){this._hash=new xf.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function _doProcessBlock(t,a){for(var o=0;o<16;o++){var c=a+o,m=t[c];t[c]=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8)}var h=this._hash.words,v=t[a+0],b=t[a+1],S=t[a+2],T=t[a+3],M=t[a+4],w=t[a+5],_=t[a+6],x=t[a+7],k=t[a+8],I=t[a+9],C=t[a+10],E=t[a+11],A=t[a+12],P=t[a+13],O=t[a+14],R=t[a+15],j=h[0],L=h[1],N=h[2],U=h[3];j=FF(j,L,N,U,v,7,Cf[0]),U=FF(U,j,L,N,b,12,Cf[1]),N=FF(N,U,j,L,S,17,Cf[2]),L=FF(L,N,U,j,T,22,Cf[3]),j=FF(j,L,N,U,M,7,Cf[4]),U=FF(U,j,L,N,w,12,Cf[5]),N=FF(N,U,j,L,_,17,Cf[6]),L=FF(L,N,U,j,x,22,Cf[7]),j=FF(j,L,N,U,k,7,Cf[8]),U=FF(U,j,L,N,I,12,Cf[9]),N=FF(N,U,j,L,C,17,Cf[10]),L=FF(L,N,U,j,E,22,Cf[11]),j=FF(j,L,N,U,A,7,Cf[12]),U=FF(U,j,L,N,P,12,Cf[13]),N=FF(N,U,j,L,O,17,Cf[14]),j=GG(j,L=FF(L,N,U,j,R,22,Cf[15]),N,U,b,5,Cf[16]),U=GG(U,j,L,N,_,9,Cf[17]),N=GG(N,U,j,L,E,14,Cf[18]),L=GG(L,N,U,j,v,20,Cf[19]),j=GG(j,L,N,U,w,5,Cf[20]),U=GG(U,j,L,N,C,9,Cf[21]),N=GG(N,U,j,L,R,14,Cf[22]),L=GG(L,N,U,j,M,20,Cf[23]),j=GG(j,L,N,U,I,5,Cf[24]),U=GG(U,j,L,N,O,9,Cf[25]),N=GG(N,U,j,L,T,14,Cf[26]),L=GG(L,N,U,j,k,20,Cf[27]),j=GG(j,L,N,U,P,5,Cf[28]),U=GG(U,j,L,N,S,9,Cf[29]),N=GG(N,U,j,L,x,14,Cf[30]),j=HH(j,L=GG(L,N,U,j,A,20,Cf[31]),N,U,w,4,Cf[32]),U=HH(U,j,L,N,k,11,Cf[33]),N=HH(N,U,j,L,E,16,Cf[34]),L=HH(L,N,U,j,O,23,Cf[35]),j=HH(j,L,N,U,b,4,Cf[36]),U=HH(U,j,L,N,M,11,Cf[37]),N=HH(N,U,j,L,x,16,Cf[38]),L=HH(L,N,U,j,C,23,Cf[39]),j=HH(j,L,N,U,P,4,Cf[40]),U=HH(U,j,L,N,v,11,Cf[41]),N=HH(N,U,j,L,T,16,Cf[42]),L=HH(L,N,U,j,_,23,Cf[43]),j=HH(j,L,N,U,I,4,Cf[44]),U=HH(U,j,L,N,A,11,Cf[45]),N=HH(N,U,j,L,R,16,Cf[46]),j=II(j,L=HH(L,N,U,j,S,23,Cf[47]),N,U,v,6,Cf[48]),U=II(U,j,L,N,x,10,Cf[49]),N=II(N,U,j,L,O,15,Cf[50]),L=II(L,N,U,j,w,21,Cf[51]),j=II(j,L,N,U,A,6,Cf[52]),U=II(U,j,L,N,T,10,Cf[53]),N=II(N,U,j,L,C,15,Cf[54]),L=II(L,N,U,j,b,21,Cf[55]),j=II(j,L,N,U,k,6,Cf[56]),U=II(U,j,L,N,R,10,Cf[57]),N=II(N,U,j,L,_,15,Cf[58]),L=II(L,N,U,j,P,21,Cf[59]),j=II(j,L,N,U,M,6,Cf[60]),U=II(U,j,L,N,E,10,Cf[61]),N=II(N,U,j,L,S,15,Cf[62]),L=II(L,N,U,j,I,21,Cf[63]),h[0]=h[0]+j|0,h[1]=h[1]+L|0,h[2]=h[2]+N|0,h[3]=h[3]+U|0},_doFinalize:function _doFinalize(){var t=this._data,a=t.words,o=8*this._nDataBytes,c=8*t.sigBytes;a[c>>>5]|=128<<24-c%32;var m=Math.floor(o/4294967296),h=o;a[15+(c+64>>>9<<4)]=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8),a[14+(c+64>>>9<<4)]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),t.sigBytes=4*(a.length+1),this._process();for(var v=this._hash,b=v.words,S=0;S<4;S++){var T=b[S];b[S]=16711935&(T<<8|T>>>24)|4278255360&(T<<24|T>>>8)}return v},clone:function clone(){var clone=kf.clone.call(this);return clone._hash=this._hash.clone(),clone}});function FF(t,a,o,c,m,h,v){var b=t+(a&o|~a&c)+m+v;return(b<<h|b>>>32-h)+a}function GG(t,a,o,c,m,h,v){var b=t+(a&c|o&~c)+m+v;return(b<<h|b>>>32-h)+a}function HH(t,a,o,c,m,h,v){var b=t+(a^o^c)+m+v;return(b<<h|b>>>32-h)+a}function II(t,a,o,c,m,h,v){var b=t+(o^(a|~c))+m+v;return(b<<h|b>>>32-h)+a}wf.MD5=kf._createHelper(Ef),wf.HmacMD5=kf._createHmacHelper(Ef),af.MD5,function(t){t.lib.Cipher||function(){var a=t,o=a.lib,c=o.Base,m=o.WordArray,h=o.BufferedBlockAlgorithm,v=a.enc;v.Utf8;var b=v.Base64,S=a.algo.EvpKDF,T=o.Cipher=h.extend({cfg:c.extend(),createEncryptor:function createEncryptor(t,a){return this.create(this._ENC_XFORM_MODE,t,a)},createDecryptor:function createDecryptor(t,a){return this.create(this._DEC_XFORM_MODE,t,a)},init:function init(t,a,o){this.cfg=this.cfg.extend(o),this._xformMode=t,this._key=a,this.reset()},reset:function reset(){h.reset.call(this),this._doReset()},process:function process(t){return this._append(t),this._process()},finalize:function finalize(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function selectCipherStrategy(t){return"string"==typeof t?A:C}return function(t){return{encrypt:function encrypt(a,o,c){return selectCipherStrategy(o).encrypt(t,a,o,c)},decrypt:function decrypt(a,o,c){return selectCipherStrategy(o).decrypt(t,a,o,c)}}}}()});o.StreamCipher=T.extend({_doFinalize:function _doFinalize(){return this._process(!0)},blockSize:1});var M=a.mode={},w=o.BlockCipherMode=c.extend({createEncryptor:function createEncryptor(t,a){return this.Encryptor.create(t,a)},createDecryptor:function createDecryptor(t,a){return this.Decryptor.create(t,a)},init:function init(t,a){this._cipher=t,this._iv=a}}),_=M.CBC=function(){var t=w.extend();function xorBlock(t,a,o){var c,m=this._iv;m?(c=m,this._iv=void 0):c=this._prevBlock;for(var h=0;h<o;h++)t[a+h]^=c[h]}return t.Encryptor=t.extend({processBlock:function processBlock(t,a){var o=this._cipher,c=o.blockSize;xorBlock.call(this,t,a,c),o.encryptBlock(t,a),this._prevBlock=slice(t).call(t,a,a+c)}}),t.Decryptor=t.extend({processBlock:function processBlock(t,a){var o=this._cipher,c=o.blockSize,m=slice(t).call(t,a,a+c);o.decryptBlock(t,a),xorBlock.call(this,t,a,c),this._prevBlock=m}}),t}(),x=(a.pad={}).Pkcs7={pad:function pad(t,a){for(var o=4*a,c=o-t.sigBytes%o,h=c<<24|c<<16|c<<8|c,v=[],b=0;b<c;b+=4)v.push(h);var S=m.create(v,c);concat(t).call(t,S)},unpad:function unpad(t){var a=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=a}};o.BlockCipher=T.extend({cfg:T.cfg.extend({mode:_,padding:x}),reset:function reset(){var t;T.reset.call(this);var a=this.cfg,o=a.iv,c=a.mode;this._xformMode==this._ENC_XFORM_MODE?t=c.createEncryptor:(t=c.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,o&&o.words):(this._mode=t.call(c,this,o&&o.words),this._mode.__creator=t)},_doProcessBlock:function _doProcessBlock(t,a){this._mode.processBlock(t,a)},_doFinalize:function _doFinalize(){var t,a=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(a.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),a.unpad(t)),t},blockSize:4});var k=o.CipherParams=c.extend({init:function init(t){this.mixIn(t)},toString:function toString(t){return(t||this.formatter).stringify(this)}}),I=(a.format={}).OpenSSL={stringify:function stringify(t){var a,o,c,h=t.ciphertext,v=t.salt;v?a=concat(o=concat(c=m.create([1398893684,1701076831])).call(c,v)).call(o,h):a=h;return a.toString(b)},parse:function parse(t){var a,o=b.parse(t),c=o.words;return 1398893684==c[0]&&1701076831==c[1]&&(a=m.create(slice(c).call(c,2,4)),splice(c).call(c,0,4),o.sigBytes-=16),k.create({ciphertext:o,salt:a})}},C=o.SerializableCipher=c.extend({cfg:c.extend({format:I}),encrypt:function encrypt(t,a,o,c){c=this.cfg.extend(c);var m=t.createEncryptor(o,c),h=m.finalize(a),v=m.cfg;return k.create({ciphertext:h,key:o,iv:v.iv,algorithm:t,mode:v.mode,padding:v.padding,blockSize:t.blockSize,formatter:c.format})},decrypt:function decrypt(t,a,o,c){return c=this.cfg.extend(c),a=this._parse(a,c.format),t.createDecryptor(o,c).finalize(a.ciphertext)},_parse:function _parse(t,a){return"string"==typeof t?a.parse(t,this):t}}),E=(a.kdf={}).OpenSSL={execute:function execute(t,a,o,c){var h;c||(c=m.random(8));var v=S.create({keySize:a+o}).compute(t,c),b=m.create(slice(h=v.words).call(h,a),4*o);return v.sigBytes=4*a,k.create({key:v,iv:b,salt:c})}},A=o.PasswordBasedCipher=C.extend({cfg:C.cfg.extend({kdf:E}),encrypt:function encrypt(t,a,o,c){var m=(c=this.cfg.extend(c)).kdf.execute(o,t.keySize,t.ivSize);c.iv=m.iv;var h=C.encrypt.call(this,t,a,m.key,c);return h.mixIn(m),h},decrypt:function decrypt(t,a,o,c){c=this.cfg.extend(c),a=this._parse(a,c.format);var m=c.kdf.execute(o,t.keySize,t.ivSize,a.salt);return c.iv=m.iv,C.decrypt.call(this,t,a,m.key,c)}})}()}(af);var Af=af,Pf=Af.lib.StreamCipher,Of=Af.algo,Rf=Of.RC4=Pf.extend({_doReset:function _doReset(){for(var t=this._key,a=t.words,o=t.sigBytes,c=this._S=[],m=0;m<256;m++)c[m]=m;m=0;for(var h=0;m<256;m++){var v=m%o,b=a[v>>>2]>>>24-v%4*8&255;h=(h+c[m]+b)%256;var S=c[m];c[m]=c[h],c[h]=S}this._i=this._j=0},_doProcessBlock:function _doProcessBlock(t,a){t[a]^=generateKeystreamWord.call(this)},keySize:8,ivSize:0});function generateKeystreamWord(){for(var t=this._S,a=this._i,o=this._j,c=0,m=0;m<4;m++){o=(o+t[a=(a+1)%256])%256;var h=t[a];t[a]=t[o],t[o]=h,c|=t[(t[a]+t[o])%256]<<24-8*m}return this._i=a,this._j=o,c}Af.RC4=Pf._createHelper(Rf);var jf=Of.RC4Drop=Rf.extend({cfg:Rf.cfg.extend({drop:192}),_doReset:function _doReset(){Rf._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)generateKeystreamWord.call(this)}});Af.RC4Drop=Pf._createHelper(jf);var Ff=af.RC4,Lf=af.enc.Utf8,Nf=function(t){function UserService(a){var o;return(o=t.call(this,"user",a)||this).myInfo=formatUser({}),registerParser({cmdMap:Tm,cmdConfig:_m}),o}_t(UserService,t);var a=UserService.prototype;return a.setBlack=function setBlack(t){return validate({account:{type:"string",allowEmpty:!1},isAdd:{type:"boolean"}},t),this.core.sendCmd("setBlack",t).then((function(){}))},a.setMute=function setMute(t){return validate({account:{type:"string",allowEmpty:!1},isAdd:{type:"boolean"}},t),this.core.sendCmd("setMute",t).then((function(){}))},a.getRelations=function getRelations(){return this.core.sendCmd("syncRelations",{timetag:0})},a.getBlackList=function getBlackList(){return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var t;return Mo.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.core.sendCmd("syncRelations",{timetag:0});case 2:return t=a.sent,a.abrupt("return",t.blackList||[]);case 4:case"end":return a.stop()}}),_callee,this)})))},a.getMuteList=function getMuteList(){return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var t;return Mo.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.core.sendCmd("syncRelations",{timetag:0});case 2:return t=a.sent,a.abrupt("return",t.muteList||[]);case 4:case"end":return a.stop()}}),_callee2,this)})))},a.updatePushToken=function updatePushToken(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){var a,o;return Mo.wrap((function _callee3$(c){for(;;)switch(c.prev=c.next){case 0:return validate({tokenName:{type:"string",allowEmpty:!1,required:!0},token:{type:"string",allowEmpty:!1,required:!0},pushkit:{type:"number",required:!1}},t),a=Lf.parse("557d1e3cafa43e2589a588270c53d56f"),o=Lf.stringify(Ff.decrypt(t.token,a)),c.next=5,this.core.sendCmd("updatePushToken",Ao(Ao({},t),{token:o}));case 5:case"end":return c.stop()}}),_callee3,this)})))},a.updateAppBackground=function updateAppBackground(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee4(){return Mo.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:return validate({isBackground:{type:"boolean",required:!0},badge:{type:"number",required:!1}},t),a.next=3,this.core.sendCmd("updateAppBackground",{isBackground:t.isBackground,badge:t.badge||0});case 3:case"end":return a.stop()}}),_callee4,this)})))},a.getUsersNameCardFromServer=function getUsersNameCardFromServer(t){var a=this;return validate({accounts:{type:"array",max:150,itemType:"string"}},t),this.core.sendCmd("getUsersNameCardFromServer",rf(t,["accounts"])).then((function(o){var c,m=o.content;return a.logger.log("user:: getUsers done",t.accounts),m&&m.users?map(c=m.users).call(c,(function(t){return formatUser(t)})):[]}))},a.updateMyNameCard=function updateMyNameCard(t){var a=this;if(validate({nick:{type:"string",required:!1},avatar:{type:"string",required:!1},signature:{type:"string",required:!1},gender:{type:"enum",values:getEnumKeys(tm),required:!1},email:{type:"string",required:!1},birth:{type:"string",required:!1},tel:{type:"string",required:!1},ext:{type:"string",required:!1}},t),0===xo(t).length)return co.resolve(this.myInfo);var o=rf(t,["nick","avatar","signature","email","birth","tel","ext"]);return t.gender&&(o.gender=tm[t.gender]),this.core.sendCmd("updateMyNameCard",{user:o}).then((function(c){var m=c.content;return m&&m.timetag&&a.core.eventBus.emit("sync/updateTimetag",{myInfo:+m.timetag}),t.gender&&(o.gender=t.gender),a.myInfo=Ao({},a.myInfo,o),a.myInfo}))},a.onUpdateBlackListHandler=function onUpdateBlackListHandler(t){var a=t.content;a.account?this.core.emit("updateBlackList",a):this.logger.warn("onUpdateBlackListHandler: no account")},a.onUpdateMuteListHandler=function onUpdateMuteListHandler(t){var a=t.content;a.account?this.core.emit("updateMuteList",a):this.logger.warn("onUpdateBlackListHandler: no account")},a.syncRelationsHandler=function syncRelationsHandler(t){var a=t.content,o=a.list,c=a.timetag,m={blackList:[],muteList:[]};return c&&this.core.eventBus.emit("sync/updateTimetag",{relations:c}),o&&o.length&&forEach$1(o).call(o,(function(t){var a=function formatRelationMember(t){var a={account:t.account,updateTime:+t.updateTime,createTime:+t.createTime};return"1"===t.isMuted&&(a.isMuted=!0),"1"===t.isBlack&&(a.isBlack=!0),a}(t);a.isBlack&&m.blackList.push(a),a.isMuted&&m.muteList.push(a)})),this.core.emit("relations",m),co.resolve(m)},a.syncMyNameCardHandler=function syncMyNameCardHandler(t){t.content.user&&(this.myInfo=formatUser(t.content.user),this.core.emit("syncMyNameCard",this.myInfo),this.core.eventBus.emit("sync/updateTimetag",{myInfo:t.content.timetag}))},a.onUpdateMyNameCardHandler=function onUpdateMyNameCardHandler(t){var a=t.content.user;a?(Ao(this.myInfo,formatUser(a)),this.core.emit("updateMyNameCard",this.myInfo)):this.logger.warn("onUpdateMyNameCardHandler no user info")},UserService}(Wp);var Uf=function stackClear(){this.__data__=new Pu,this.size=0};var Bf=function stackDelete(t){var a=this.__data__,o=a.delete(t);return this.size=a.size,o};var qf=function stackGet(t){return this.__data__.get(t)};var Df=function stackHas(t){return this.__data__.has(t)};var Hf=function stackSet(t,a){var o=this.__data__;if(o instanceof Pu){var c=o.__data__;if(!Ou||c.length<199)return c.push([t,a]),this.size=++o.size,this;o=this.__data__=new qu(c)}return o.set(t,a),this.size=o.size,this};function Stack(t){var a=this.__data__=new Pu(t);this.size=a.size}Stack.prototype.clear=Uf,Stack.prototype.delete=Bf,Stack.prototype.get=qf,Stack.prototype.has=Df,Stack.prototype.set=Hf;var zf=Stack;var $f=function arraySome(t,a){for(var o=-1,c=null==t?0:t.length;++o<c;)if(a(t[o],o,t))return!0;return!1};var Gf=function equalArrays(t,a,o,c,m,h){var v=1&o,b=t.length,S=a.length;if(b!=S&&!(v&&S>b))return!1;var T=h.get(t),M=h.get(a);if(T&&M)return T==a&&M==t;var w=-1,_=!0,x=2&o?new zu:void 0;for(h.set(t,a),h.set(a,t);++w<b;){var k=t[w],I=a[w];if(c)var C=v?c(I,k,w,a,t,h):c(k,I,w,t,a,h);if(void 0!==C){if(C)continue;_=!1;break}if(x){if(!$f(a,(function(t,a){if(!Yu(x,a)&&(k===t||m(k,t,o,c,h)))return x.push(a)}))){_=!1;break}}else if(k!==I&&!m(k,I,o,c,h)){_=!1;break}}return h.delete(t),h.delete(a),_},Kf=Is.Uint8Array;var Wf=function mapToArray(t){var a=-1,o=Array(t.size);return t.forEach((function(t,c){o[++a]=[c,t]})),o},Vf=Cs?Cs.prototype:void 0,Jf=Vf?Vf.valueOf:void 0;var Xf=function equalByTag(t,a,o,c,m,h,v){switch(o){case"[object DataView]":if(t.byteLength!=a.byteLength||t.byteOffset!=a.byteOffset)return!1;t=t.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=a.byteLength||!h(new Kf(t),new Kf(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return _u(+t,+a);case"[object Error]":return t.name==a.name&&t.message==a.message;case"[object RegExp]":case"[object String]":return t==a+"";case"[object Map]":var b=Wf;case"[object Set]":var S=1&c;if(b||(b=hl),t.size!=a.size&&!S)return!1;var T=v.get(t);if(T)return T==a;c|=2,v.set(t,a);var M=Gf(b(t),b(a),c,m,h,v);return v.delete(t),M;case"[object Symbol]":if(Jf)return Jf.call(t)==Jf.call(a)}return!1};var Yf=function baseGetAllKeys(t,a,o){var c=a(t);return up(t)?c:Ym(c,o(t))};var Qf=function arrayFilter(t,a){for(var o=-1,c=null==t?0:t.length,m=0,h=[];++o<c;){var v=t[o];a(v,o,t)&&(h[m++]=v)}return h};var Zf=function stubArray(){return[]},eg=Object.prototype.propertyIsEnumerable,tg=Object.getOwnPropertySymbols,rg=tg?function(t){return null==t?[]:(t=Object(t),Qf(tg(t),(function(a){return eg.call(t,a)})))}:Zf,ng=rg;var ig=function getAllKeys(t){return Yf(t,Id,ng)},ag=Object.prototype.hasOwnProperty;var og=function equalObjects(t,a,o,c,m,h){var v=1&o,b=ig(t),S=b.length;if(S!=ig(a).length&&!v)return!1;for(var T=S;T--;){var M=b[T];if(!(v?M in a:ag.call(a,M)))return!1}var w=h.get(t),_=h.get(a);if(w&&_)return w==a&&_==t;var x=!0;h.set(t,a),h.set(a,t);for(var k=v;++T<S;){var I=t[M=b[T]],C=a[M];if(c)var E=v?c(C,I,M,a,t,h):c(I,C,M,t,a,h);if(!(void 0===E?I===C||m(I,C,o,c,h):E)){x=!1;break}k||(k="constructor"==M)}if(x&&!k){var A=t.constructor,P=a.constructor;A==P||!("constructor"in t)||!("constructor"in a)||"function"==typeof A&&A instanceof A&&"function"==typeof P&&P instanceof P||(x=!1)}return h.delete(t),h.delete(a),x},sg=mu(Is,"DataView"),cg=mu(Is,"Promise"),ug=mu(Is,"WeakMap"),lg="[object Map]",pg="[object Promise]",dg="[object Set]",mg="[object WeakMap]",fg="[object DataView]",gg=iu(sg),yg=iu(Ou),hg=iu(cg),vg=iu(gl),bg=iu(ug),Sg=Ns;(sg&&Sg(new sg(new ArrayBuffer(1)))!=fg||Ou&&Sg(new Ou)!=lg||cg&&Sg(cg.resolve())!=pg||gl&&Sg(new gl)!=dg||ug&&Sg(new ug)!=mg)&&(Sg=function(t){var a=Ns(t),o="[object Object]"==a?t.constructor:void 0,c=o?iu(o):"";if(c)switch(c){case gg:return fg;case yg:return lg;case hg:return pg;case vg:return dg;case bg:return mg}return a});var Tg=Sg,Mg="[object Arguments]",wg="[object Array]",_g="[object Object]",xg=Object.prototype.hasOwnProperty;var kg=function baseIsEqualDeep(t,a,o,c,m,h){var v=up(t),b=up(a),S=v?wg:Tg(t),T=b?wg:Tg(a),M=(S=S==Mg?_g:S)==_g,w=(T=T==Mg?_g:T)==_g,_=S==T;if(_&&md(t)){if(!md(a))return!1;v=!0,M=!1}if(_&&!M)return h||(h=new zf),v||bd(t)?Gf(t,a,o,c,m,h):Xf(t,a,S,o,c,m,h);if(!(1&o)){var x=M&&xg.call(t,"__wrapped__"),k=w&&xg.call(a,"__wrapped__");if(x||k){var I=x?t.value():t,C=k?a.value():a;return h||(h=new zf),m(I,C,o,c,h)}}return!!_&&(h||(h=new zf),og(t,a,o,c,m,h))};var Ig=function baseIsEqual(t,a,o,c,m){return t===a||(null==t||null==a||!Vc(t)&&!Vc(a)?t!=t&&a!=a:kg(t,a,o,c,baseIsEqual,m))};var Cg=function baseIsMatch(t,a,o,c){var m=o.length,h=m,v=!c;if(null==t)return!h;for(t=Object(t);m--;){var b=o[m];if(v&&b[2]?b[1]!==t[b[0]]:!(b[0]in t))return!1}for(;++m<h;){var S=(b=o[m])[0],T=t[S],M=b[1];if(v&&b[2]){if(void 0===T&&!(S in t))return!1}else{var w=new zf;if(c)var _=c(T,M,S,t,a,w);if(!(void 0===_?Ig(M,T,3,c,w):_))return!1}}return!0};var Eg=function isStrictComparable(t){return t==t&&!Us(t)};var Ag=function getMatchData(t){for(var a=Id(t),o=a.length;o--;){var c=a[o],m=t[c];a[o]=[c,m,Eg(m)]}return a};var Pg=function matchesStrictComparable(t,a){return function(o){return null!=o&&(o[t]===a&&(void 0!==a||t in Object(o)))}};var Og=function baseMatches(t){var a=Ag(t);return 1==a.length&&a[0][2]?Pg(a[0][0],a[0][1]):function(o){return o===t||Cg(o,t,a)}};var Rg=function baseMatchesProperty(t,a){return mp(t)&&Eg(a)?Pg(_p(t),a):function(o){var c=kp(o,t);return void 0===c&&c===a?Jm(o,t):Ig(a,c,3)}};var jg=function baseProperty(t){return function(a){return null==a?void 0:a[t]}};var Fg=function basePropertyDeep(t){return function(a){return xp(a,t)}};var Lg=function property(t){return mp(t)?jg(_p(t)):Fg(t)};var Ng=function baseIteratee(t){return"function"==typeof t?t:null==t?Zu:"object"==typeof t?up(t)?Rg(t[0],t[1]):Og(t):Lg(t)},Ug=/\s/;var Bg=function trimmedEndIndex(t){for(var a=t.length;a--&&Ug.test(t.charAt(a)););return a},qg=/^\s+/;var Dg=function baseTrim(t){return t?t.slice(0,Bg(t)+1).replace(qg,""):t},Hg=/^[-+]0x[0-9a-f]+$/i,zg=/^0b[01]+$/i,$g=/^0o[0-7]+$/i,Gg=parseInt;var Kg=function toNumber(t){if("number"==typeof t)return t;if(lp(t))return NaN;if(Us(t)){var a="function"==typeof t.valueOf?t.valueOf():t;t=Us(a)?a+"":a}if("string"!=typeof t)return 0===t?t:+t;t=Dg(t);var o=zg.test(t);return o||$g.test(t)?Gg(t.slice(2),o?2:8):Hg.test(t)?NaN:+t},Wg=1/0;var Vg=function toFinite(t){return t?(t=Kg(t))===Wg||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var Jg=function toInteger(t){var a=Vg(t),o=a%1;return a==a?o?a-o:a:0},Xg=Math.max;var Yg=function findIndex(t,a,o){var c=null==t?0:t.length;if(!c)return-1;var m=null==o?0:Jg(o);return m<0&&(m=Xg(c+m,0)),$u(t,Ng(a),m)},Qg={"4_12":"syncMsgReceipts","4_14":"syncSessionAck","4_20":"syncSuperTeamSessionAck","4_22":"nimSyncSessionsWithMoreRoaming","4_25":"syncSessionReliableInfo","7_12":"multiSyncMsgReceipt","7_16":"markSessionAck","7_25":"markMultSessionsAck","7_116":"syncMarkSessionAck","21_25":"markSuperTeamSessionAck","21_32":"markMultSuperTeamSessionsAck","21_125":"syncMarkSuperTeamSessionAck","4_23":"nimSyncStickTopSessions","23_12":"nimAddStickTopSession","23_13":"nimDeleteStickTopSession","23_14":"nimUpdateStickTopSession","23_112":"nimMultiSyncAddStickTopSession","23_113":"nimMultiSyncDeleteStickTopSession","23_114":"nimMultiSyncUpdateStickTopSession"},Zg={msgReceiptTag:{to:1,from:2,time:7,idClient:11},stickTopSessionTag:{id:1,ext:2,createTime:3,updateTime:4},sessionAckTag:{scene:1,to:2,timetag:3},sessionReliableSyncTag:{scene:1,sessionId:2,syncStatus:3,syncEndMsgId:4,syncEndMsgidClient:5,syncEndMsgTime:6,syncStartMsgid:7,syncStartMsgidClient:8,syncStartMsgTime:9,nextMsgid:10,nextMsgidClient:11,nextMsgTime:12,roamMsgSync:13,offlineMsgSync:14,netCallOfflineMsgSync:15}},ey=invertSerializeMap(Zg),ty={syncMsgReceipts:{sid:4,cid:12,service:"session",response:[{type:"PropertyArray",name:"msgReceipts",reflectMapper:ey.msgReceiptTag},{type:"Number",name:"timetag"}]},syncSessionAck:{sid:4,cid:14,service:"session",response:[{type:"StrLongMap",name:"p2p"},{type:"LongLongMap",name:"team"},{type:"Number",name:"timetag"}]},syncSuperTeamSessionAck:{sid:4,cid:20,service:"session",response:[{type:"LongLongMap",name:"superTeam"},{type:"Number",name:"timetag"}]},multiSyncMsgReceipt:{sid:7,cid:12,service:"session",response:[{type:"Property",name:"msgReceiptTag",reflectMapper:ey.msgReceiptTag}]},markSessionAck:{sid:7,cid:16,service:"session",params:[{type:"byte",name:"scene"},{type:"String",name:"to"},{type:"long",name:"timetag"}]},syncMarkSessionAck:{sid:7,cid:116,service:"session",response:[{type:"byte",name:"scene"},{type:"String",name:"to"},{type:"long",name:"timetag"}]},syncMarkSuperTeamSessionAck:{sid:21,cid:125,service:"session",response:[{type:"String",name:"to"},{type:"long",name:"timetag"}]},markMultSessionsAck:{sid:7,cid:25,service:"session",ignoreErrCodes:[700],params:[{type:"PropertyArray",name:"datas",reflectMapper:Zg.sessionAckTag}]},markSuperTeamSessionAck:{sid:21,cid:25,service:"session",params:[{type:"long",name:"to"},{type:"long",name:"timetag"}]},nimAddStickTopSession:{sid:23,cid:12,service:"session",params:[{type:"Property",name:"tag",reflectMapper:Zg.stickTopSessionTag}],response:[{type:"Property",name:"data",reflectMapper:ey.stickTopSessionTag}]},nimDeleteStickTopSession:{sid:23,cid:13,service:"session",params:[{type:"Property",name:"tag",reflectMapper:Zg.stickTopSessionTag}],response:[{type:"Number",name:"timetag"}]},nimUpdateStickTopSession:{sid:23,cid:14,service:"session",params:[{type:"Property",name:"tag",reflectMapper:Zg.stickTopSessionTag}],response:[{type:"Property",name:"data",reflectMapper:ey.stickTopSessionTag}]},nimMultiSyncAddStickTopSession:{sid:23,cid:112,service:"session",response:[{type:"Property",name:"data",reflectMapper:ey.stickTopSessionTag}]},nimMultiSyncDeleteStickTopSession:{sid:23,cid:113,service:"session",response:[{type:"Number",name:"timetag"},{type:"Property",name:"data",reflectMapper:ey.stickTopSessionTag}]},nimMultiSyncUpdateStickTopSession:{sid:23,cid:114,service:"session",response:[{type:"Property",name:"data",reflectMapper:ey.stickTopSessionTag}]},nimSyncStickTopSessions:{sid:4,cid:23,service:"session",response:[{type:"Number",name:"timetag"},{type:"Boolean",name:"isThereAnyChange"},{type:"PropertyArray",name:"datas",reflectMapper:ey.stickTopSessionTag}]},markMultSuperTeamSessionsAck:{sid:21,cid:32,service:"session",ignoreErrCodes:[700],params:[{type:"PropertyArray",name:"datas",reflectMapper:Zg.sessionAckTag}]},nimSyncSessionsWithMoreRoaming:{sid:21,cid:22,service:"session",response:[{type:"PropertyArray",name:"datas",reflectMapper:{0:"scene",1:"to",2:"from",7:"time",12:"idServer"}}]},syncSessionReliableInfo:{sid:4,cid:25,service:"session",response:[{type:"Property",name:"context",reflectMapper:{1:"timetag",2:"type"}},{type:"PropertyArray",name:"datas",reflectMapper:ey.sessionReliableSyncTag}]}},ry={id:{type:"string"},ext:{type:"string"},createTime:{type:"number"},updateTime:{type:"number"}};function formatStickTop(t,a,o){void 0===o&&(o=!0);var c=format(ry,t);return c.isStickOnTop=o,c.id=a.id,Ao(Ao({},a),{stickTopInfo:a.stickTopInfo?Ao({},a.stickTopInfo,c):c})}var ny={scene:{type:"enum",values:Hp},time:{type:"number"}};var iy=function(){function StickTopService(t){this.core=t}var t=StickTopService.prototype;return t.getSession=function getSession(t){return this.core.session.getSessionWithUncomplete({id:t})||this.core.session.createSession(t)},t.addStickTopSession=function addStickTopSession(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var a,o,c,m,h,v;return Mo.wrap((function _callee$(b){for(;;)switch(b.prev=b.next){case 0:return validate({id:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1}},t),a=getAccountFromSessionId(t.id),o=a.scene,c=a.accid,b.next=4,this.core.sendCmd("nimAddStickTopSession",{tag:{id:("superTeam"===o?"super_team":o)+"|"+c,ext:t.ext}});case 4:return m=b.sent,h=this.getSession(t.id),v=formatStickTop(m.content.data,h),b.abrupt("return",v);case 8:case"end":return b.stop()}}),_callee,this)})))},t.deleteStickTopSession=function deleteStickTopSession(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var a,o,c,m,h,v;return Mo.wrap((function _callee2$(b){for(;;)switch(b.prev=b.next){case 0:return validate({id:{type:"string",allowEmpty:!1}},t),a=getAccountFromSessionId(t.id),o=a.scene,c=a.accid,b.next=4,this.core.sendCmd("nimDeleteStickTopSession",{tag:{id:("superTeam"===o?"super_team":o)+"|"+c}});case 4:return m=b.sent,h=this.getSession(t.id),v=formatStickTop({updateTime:m.content.timetag},h,!1),b.abrupt("return",v);case 8:case"end":return b.stop()}}),_callee2,this)})))},t.updateStickTopSession=function updateStickTopSession(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){var a,o,c,m,h,v;return Mo.wrap((function _callee3$(b){for(;;)switch(b.prev=b.next){case 0:return validate({id:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1}},t),a=getAccountFromSessionId(t.id),o=a.scene,c=a.accid,b.next=4,this.core.sendCmd("nimUpdateStickTopSession",{tag:{id:("superTeam"===o?"super_team":o)+"|"+c,ext:t.ext}});case 4:return m=b.sent,h=this.getSession(t.id),v=formatStickTop(m.content.data,h),b.abrupt("return",v);case 8:case"end":return b.stop()}}),_callee3,this)})))},t.stickTopSessionHandler=function stickTopSessionHandler(t,a){void 0===a&&(a=!0);var o=getAccountFromSessionId(t.id,"|"),c=o.scene+"-"+o.accid;return formatStickTop(t,this.getSession(c),a)},StickTopService}(),ay=function(){function UnreadModuleService(t){this.core=t,this.logger=t.logger}var t=UnreadModuleService.prototype;return t.canSessionResetUnreadCount=function canSessionResetUnreadCount(t){var a=t.id;if(void 0===t.lastMsg)throw new Error("Session::canSessionResetUnreadCount: session "+a+" is not completly, lastMsg undefined");return null!==t.lastMsg||t.unread>0?!(t.ack&&t.lastMsg&&t.ack>=t.lastMsg.time)||(this.logger.log("Session::canSessionResetUnreadCount: session "+a+" reset failed, ack time is greater than last message time"),!1):(this.logger.log("Session::canSessionResetUnreadCount: session "+a+" doesn't need to be updated, lastMsg null and unread 0"),!1)},t.filterSessionForResetUnreadCount=function filterSessionForResetUnreadCount(t){var a=this,o={cmd:"markMultSuperTeamSessionsAck",params:[]},c={cmd:"markMultSessionsAck",params:[]};return forEach$1(t).call(t,(function(t){var m;try{if(!a.canSessionResetUnreadCount(t))return;var h=getAccountFromSessionId(t.id),v=h.accid,b=h.scene,S={to:v,sessionId:t.id,timetag:(null===(m=null==t?void 0:t.lastMsg)||void 0===m?void 0:m.time)||t.updateTime||0},T=function generateSceneForCmd(t){return formatReverse({scene:{type:"enum",values:Hp}},t)}({scene:b});"superTeam"===b?o.params.push(S):c.params.push(Ao(Ao({},S),T))}catch(t){a.logger.warn(t)}})),{superTeam:o,p2pOrTeam:c}},UnreadModuleService}();var oy=function baseSlice(t,a,o){var c=-1,m=t.length;a<0&&(a=-a>m?0:m+a),(o=o>m?m:o)<0&&(o+=m),m=a>o?0:o-a>>>0,a>>>=0;for(var h=Array(m);++c<m;)h[c]=t[c+a];return h};var sy=function isIterateeCall(t,a,o){if(!Us(o))return!1;var c=typeof a;return!!("number"==c?ll(o)&&gd(a,o.length):"string"==c&&a in o)&&_u(o[a],t)},cy=Math.ceil,uy=Math.max;var ly=function chunk(t,a,o){a=(o?sy(t,a,o):void 0===a)?1:uy(Jg(a),0);var c=null==t?0:t.length;if(!c||a<1)return[];for(var m=0,h=0,v=Array(cy(c/a));m<c;)v[h++]=oy(t,m,m+=a);return v};function _createForOfIteratorHelperLoose(t,a){var o,c=void 0!==Wn&&Zl(t)||t["@@iterator"];if(c)return bind$1(o=(c=c.call(t)).next).call(o,c);if(zc(t)||(c=function _unsupportedIterableToArray(t,a){var o;if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,a);var c=slice(o=Object.prototype.toString.call(t)).call(o,8,-1);"Object"===c&&t.constructor&&(c=t.constructor.name);if("Map"===c||"Set"===c)return Ql(t);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return _arrayLikeToArray(t,a)}(t))||a&&t&&"number"==typeof t.length){c&&(t=c);var m=0;return function(){return m>=t.length?{done:!0}:{done:!1,value:t[m++]}}}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 _arrayLikeToArray(t,a){(null==a||a>t.length)&&(a=t.length);for(var o=0,c=new Array(a);o<a;o++)c[o]=t[o];return c}var py,dy,fy=function(t){function SessionService(a,o){var c;return(c=t.call(this,"session",a)||this).list=new us,c.unreadCountFilterFn=function(t){return!0},c.lastMessageFilterFn=function(t){return!0},c.initEventListeners(),registerParser({cmdMap:Qg,cmdConfig:ty}),"function"==typeof(null==o?void 0:o.unreadCountFilterFn)&&(c.unreadCountFilterFn=o.unreadCountFilterFn),"function"==typeof(null==o?void 0:o.lastMessageFilterFn)&&(c.lastMessageFilterFn=o.lastMessageFilterFn),c.stickTopService=new iy(a),c.unreadModule=new ay(a),c}_t(SessionService,t);var a=SessionService.prototype;return a.initEventListeners=function initEventListeners(){var t,a,o,c=this;this.core.eventBus.on("session/syncMsgs",bind$1(t=this.onSyncMsgs).call(t,this)),this.core.eventBus.on("session/updateForNewMsg",bind$1(a=this.updateSessionWithMsg).call(a,this)),this.core.eventBus.on("session/updateForClearMsg",(function(t,a){void 0===a&&(a=!0),t&&t.length>0&&forEach$1(t).call(t,(function(t){c.updateSession({id:t.sessionId,lastMsg:null,unread:0,unreadMsgs:[]},a)}))})),this.core.eventBus.on("session/updateForDeletedMsg",bind$1(o=this.updateSessionForDeletedMsg).call(o,this))},a.createSession=function createSession(t,a){try{var o=getAccountFromSessionId(t);return{id:t,scene:o.scene,to:o.accid,lastMsg:a,updateTime:a?a.time:0,unread:0,unreadMsgs:[],ack:0}}catch(a){throw this.logger.error("Failed to create session with "+t,a),new Error("Failed to create session with "+t)}},a.getSession=function getSession(t){validate({id:{type:"string",allowEmpty:!1}},t);var a=this.list.get(t.id);if(this.isSessionComplete(a))return a},a.getSessionWithUncomplete=function getSessionWithUncomplete(t){return this.list.get(t.id)},a.getSessions=function getSessions(t){validate({limit:{type:"number",required:!1},lastSessionId:{type:"string",allowEmpty:!1,required:!1},desc:{type:"boolean",required:!1}},t);var a=[],o=t.limit,c=void 0===o?100:o,m=t.desc,h=void 0===m||m,v=t.lastSessionId,b=0;if(h){for(var S,T,M=_createForOfIteratorHelperLoose(this.list);!(T=M()).done;){var w=T.value,_=w[0],x=w[1];if(v===_)break;this.isSessionComplete(x)&&a.push(x)}return reverse$1(S=slice(a).call(a,-c)).call(S)}for(var k,I=_createForOfIteratorHelperLoose(this.list);!(k=I()).done;){var C=k.value,E=C[0],A=C[1];if(v)E===v&&(v=void 0);else if(this.isSessionComplete(A)){if(++b>c)break;a.push(A)}}return a},a.resetSessionUnreadCount=function resetSessionUnreadCount(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var o,c,m,h,v,b,S,T,M=this;return Mo.wrap((function _callee$(w){for(;;)switch(w.prev=w.next){case 0:if(validate({id:{type:"string",allowEmpty:!1}},t),validate({id:{type:"string",allowEmpty:!1}},t),o=t.id,c=this.list.get(o)){w.next=7;break}throw this.logger.warn("resetSessionUnreadCount: can not find session "+o),new Error("Session::canSessionResetUnreadCount: can not find session "+o);case 7:m=!1;try{m=this.unreadModule.canSessionResetUnreadCount(c)}catch(t){this.logger.warn(t)}if(!1!==m){w.next=11;break}return w.abrupt("return");case 11:return h=getAccountFromSessionId(o),v=h.accid,b=h.scene,S={to:v,timetag:(null===(a=null==c?void 0:c.lastMsg)||void 0===a?void 0:a.time)||c.updateTime||0},T="markSuperTeamSessionAck","superTeam"!==b&&(S.scene="p2p"===b?0:1,T="markSessionAck"),w.abrupt("return",this.core.sendCmd(T,S).then((function(){var t=M.storeUnreadByAck(o,S.timetag);t&&M.core.emit("updateSession",t)})));case 16:case"end":return w.stop()}}),_callee,this)})))},a.resetMultiSessionUnreadCount=function resetMultiSessionUnreadCount(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var a,o,c,m,h,v,b,S,T,M,w,_,x,k,I=this;return Mo.wrap((function _callee2$(C){for(;;)switch(C.prev=C.next){case 0:validate({ids:{type:"array",itemType:"string",min:1}},t),c=filter(a=map(o=t.ids).call(o,(function(t){return I.list.get(t)}))).call(a,(function(a,o){return!!a||(I.logger.warn("Session::canSessionResetUnreadCount: can not find session "+t.ids[o]),!1)})),m=this.unreadModule.filterSessionForResetUnreadCount(c),h=m.superTeam,v=m.p2pOrTeam,b=ly(h.params,10),S=ly(v.params,10),T=_createForOfIteratorHelperLoose(b);case 6:if((M=T()).done){C.next=13;break}return w=M.value,C.next=10,this.core.sendCmd(h.cmd,{datas:w});case 10:forEach$1(w).call(w,(function(t){var a=I.storeUnreadByAck(t.sessionId,t.timetag);a&&I.core.emit("updateSession",a)}));case 11:C.next=6;break;case 13:_=_createForOfIteratorHelperLoose(S);case 14:if((x=_()).done){C.next=21;break}return k=x.value,C.next=18,this.core.sendCmd(v.cmd,{datas:k});case 18:forEach$1(k).call(k,(function(t){var a=I.storeUnreadByAck(t.sessionId,t.timetag);a&&I.core.emit("updateSession",a)}));case 19:C.next=14;break;case 21:case"end":return C.stop()}}),_callee2,this)})))},a.resetAllSessionsUnreadCount=function resetAllSessionsUnreadCount(){var t,a=[];return forEach$1(t=this.list).call(t,(function(t){a.push(t.id)})),this.resetMultiSessionUnreadCount({ids:a})},a.deleteSession=function deleteSession(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){return Mo.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:if(validate({id:{type:"string",allowEmpty:!1},isSyncToServer:{type:"boolean",required:!1}},t),this.list.delete(t.id),!this.core.msgLog||!t.isSyncToServer){a.next=5;break}return a.next=5,this.core.msgLog.deleteRoamingMsgs({ids:[t.id]});case 5:case"end":return a.stop()}}),_callee3,this)})))},a.deleteAllSessionsFromLocal=function deleteAllSessionsFromLocal(){this.list.clear()},a.addStickTopSession=function addStickTopSession(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee4(){var a;return Mo.wrap((function _callee4$(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this.stickTopService.addStickTopSession(t);case 2:return a=o.sent,this.list.set(a.id,a),o.abrupt("return",a);case 5:case"end":return o.stop()}}),_callee4,this)})))},a.deleteStickTopSession=function deleteStickTopSession(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee5(){var a;return Mo.wrap((function _callee5$(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this.stickTopService.deleteStickTopSession(t);case 2:return a=o.sent,this.list.set(a.id,a),o.abrupt("return",a);case 5:case"end":return o.stop()}}),_callee5,this)})))},a.updateStickTopSession=function updateStickTopSession(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee6(){var a;return Mo.wrap((function _callee6$(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this.stickTopService.updateStickTopSession(t);case 2:return a=o.sent,this.list.set(a.id,a),o.abrupt("return",a);case 5:case"end":return o.stop()}}),_callee6,this)})))},a.nimMultiSyncAddStickTopSessionHandler=function nimMultiSyncAddStickTopSessionHandler(t){var a=this.stickTopService.stickTopSessionHandler(t.content.data);this.list.set(a.id,a),this.core.emit("updateSession",a)},a.nimMultiSyncDeleteStickTopSessionHandler=function nimMultiSyncDeleteStickTopSessionHandler(t){var a=this.stickTopService.stickTopSessionHandler({id:t.content.data.id,updateTime:t.content.timetag},!1);this.list.set(a.id,a),this.core.emit("updateSession",a)},a.nimMultiSyncUpdateStickTopSessionHandler=function nimMultiSyncUpdateStickTopSessionHandler(t){var a=this.stickTopService.stickTopSessionHandler(t.content.data);this.list.set(a.id,a),this.core.emit("updateSession",a)},a.nimSyncStickTopSessionsHandler=function nimSyncStickTopSessionsHandler(t){var a=this,o=t.content.datas;forEach$1(o).call(o,(function(t){var o=a.stickTopService.stickTopSessionHandler(t);a.list.set(o.id,o)}))},a.updateSessionWithMsg=function updateSessionWithMsg(t){var a=!0,o=!0;try{a=!!this.unreadCountFilterFn(t)}catch(t){this.logger.error("session:updateSessionWithMsg, unreadCountFilterFn error",t)}try{o=!!this.lastMessageFilterFn(t)}catch(t){this.logger.error("session:updateSessionWithMsg, lastMessageFilterFn error",t)}var c=this.list.get(t.sessionId)||this.createSession(t.sessionId),m=!1;if(this.logger.log("session:updateSessionWithMsg, pending ",t.sessionId,t.idClient,t.idServer,o,a),o&&(!c.lastMsg||c.lastMsg.time<t.time||t.status===$p[$p.sending]||c.lastMsg.status===$p[$p.sending])&&(c.lastMsg=t,c.updateTime=t.time,m=!0),a&&t.status===$p[$p.unread]&&t.time>(c.ack||0)){c.unread++;var h=c.unreadMsgs||[];h.unshift(t),sort(h).call(h,(function(t,a){return a.time-t.time})),m=!0}m&&(this.logger.log("session:updateSessionWithMsg updating ",c.id,c.unread,c.lastMsg&&c.lastMsg.idClient),this.list.set(c.id,c),this.core.emit("updateSession",c))},a.storeUnreadByAck=function storeUnreadByAck(t,a){var o=this.list.get(t)||this.createSession(t);if(!(o.ack&&a<o.ack)){var c=o.unreadMsgs||[],m=[],h=0;return o.unreadMsgs=[],c.length>0&&(forEach$1(c).call(c,(function(t){t.time>a&&(h++,m.push(t))})),o.unreadMsgs=sort(m).call(m,(function(t,a){return a.time-t.time}))),o.ack=a,o.unread=h,o.lastMsg&&"unread"===o.lastMsg.status&&a>=o.lastMsg.time&&(o.lastMsg.status="read"),this.list.set(t,o),o}this.logger.warn("storeUnreadByAck: not need update ack",t,a,o.ack)},a.updateSession=function updateSession(t,a){void 0===a&&(a=!0);var o=t.id,c=this.list.get(o)||this.createSession(t.id),m=Ao(c,t);return this.list.set(o,m),this.logger.log("updateSession: update",a,rf(t,["id","ack","unread"]),m.lastMsg&&m.lastMsg.idClient),a&&this.core.emit("updateSession",m),m},a.isSessionComplete=function isSessionComplete(t){return!!t&&(!!(t.id&&t.scene&&t.to)&&void 0!==t.lastMsg)},a.syncSessionAckHandler=function syncSessionAckHandler(t){var a,o,c=this,m=t.content.p2p||{},h=t.content.team.m_map||{};this.logger.log("syncSessionAck::",m,h),forEach$1(a=xo(m)).call(a,(function(t){c.updateSession({id:"p2p-"+t,ack:m[t]},!1)})),forEach$1(o=xo(h)).call(o,(function(t){c.updateSession({id:"team-"+t,ack:h[t]},!1)}))},a.syncSuperTeamSessionAckHandler=function syncSuperTeamSessionAckHandler(t){var a,o=this,c=t.content.superTeam.m_map;this.logger.log("syncSuperTeamSessionAck::",c),forEach$1(a=xo(c)).call(a,(function(t){o.updateSession({id:"superTeam-"+t,ack:c[t]},!1)}))},a.syncMarkSessionAckHandler=function syncMarkSessionAckHandler(t){var a=t.content,o=(0===a.scene?"p2p":1===a.scene?"team":"superTeam")+"-"+a.to,c=this.list.get(o);if(c&&c.ack&&a.timetag<c.ack)this.logger.warn("syncMarkSessionAckHandler: "+o+" do not need update ack",c.ack,a.timetag);else{var m=this.storeUnreadByAck(o,a.timetag);m&&this.core.emit("updateSession",m)}},a.syncMarkSuperTeamSessionAckHandler=function syncMarkSuperTeamSessionAckHandler(t){t.content.scene=5,this.syncMarkSessionAckHandler(t)},a.onSyncDone=function onSyncDone(){var t,a,o,c=this,m=[];forEach$1(t=this.list).call(t,(function(t,a){m.push(c.storeUnreadByAck(a,t.ack||0))})),this.list.clear(),forEach$1(a=sort(m).call(m,(function(t,a){return t.updateTime-a.updateTime}))).call(a,(function(t){c.list.set(t.id,t)})),(m=sort(o=filter(m).call(m,(function(t){return c.isSessionComplete(t)}))).call(o,(function(t,a){return a.updateTime-t.updateTime}))).length>0&&this.core.emit("sessions",m)},a.onSyncMsgs=function onSyncMsgs(t){var a,o=this,c=this.list.get(t.sessionId),m=[];try{var h;m=filter(h=t.msgs).call(h,(function(t){return o.unreadCountFilterFn(JSON.parse(Oo(t)))}))}catch(t){this.logger.error("session:onSyncMsgs, unreadCountFilterFn error ",t)}var v,b=[];try{var S;b=filter(S=t.msgs).call(S,(function(t){return o.lastMessageFilterFn(JSON.parse(Oo(t)))}))}catch(t){this.logger.error("session:onSyncMsgs, lastMessageFilterFn error ",t)}b&&b.length>0&&(v=b[b.length-1],v=b[0].time>v.time?b[0]:v);var T=v?v.time:0;c||(c=v?this.createSession(t.sessionId,v):this.createSession(t.sessionId)),c.unreadMsgs=c.unreadMsgs?filter(a=concat(m).call(m,c.unreadMsgs)).call(a,(function(t){return t.status===$p[$p.unread]})):filter(m).call(m,(function(t){return t.status===$p[$p.unread]})),c.updateTime&&c.updateTime>=T||(c.updateTime=T),c.lastMsg&&c.lastMsg.time>=T||(c.lastMsg=v),this.list.set(c.id,c)},a.updateSessionForDeletedMsg=function updateSessionForDeletedMsg(t){var a,o=this,c={};forEach$1(t).call(t,(function(t){var a=t.to===o.core.account?t.from:t.to,m=t.scene+"-"+a,h=o.list.get(m);if(h){if((h.ack||0)<t.time&&t.from!==o.core.account&&h.unread>0&&(h.unread=h.unread-1,h.unreadMsgs&&h.unreadMsgs.length>0)){var v,b=Yg(h.unreadMsgs,{idClient:t.idClient});b>=0&&splice(v=h.unreadMsgs).call(v,b,1)}h.lastMsg&&h.lastMsg.idClient===t.idClient&&(h.lastMsg=null),c[h.id]=!0}})),forEach$1(a=xo(c)).call(a,(function(t){var a=o.list.get(t);a&&o.core.emit("updateSession",a)}))},a.multiSyncMsgReceiptHandler=function multiSyncMsgReceiptHandler(t){var a,o=null===(a=t.content)||void 0===a?void 0:a.msgReceiptTag;o&&this.updateSessionMsgReceiptTime([o],!0)},a.syncMsgReceiptsHandler=function syncMsgReceiptsHandler(t){var a,o=null===(a=t.content)||void 0===a?void 0:a.msgReceipts;o&&this.updateSessionMsgReceiptTime(o,!1)},a.updateSessionMsgReceiptTime=function updateSessionMsgReceiptTime(t,a){var o=this;void 0===a&&(a=!0),t&&t.length>0&&forEach$1(t).call(t,(function(t){var c=o.list.get("p2p-"+t.from);c||(c=o.createSession("p2p-"+t.from));var m=Bl(t.time);c.msgReceiptTime&&c.msgReceiptTime>=m||(c.msgReceiptTime=m,c.lastMsg&&"sent"===c.lastMsg.status&&m>=c.lastMsg.time&&(c.lastMsg.status="receipt"),o.logger.log("session: update session "+c.id+" msgReceiptTime: "+c.msgReceiptTime),o.list.set(c.id,c),a&&o.core.emit("updateSession",c))}))},a.nimSyncSessionsWithMoreRoamingHandler=function nimSyncSessionsWithMoreRoamingHandler(t){var a=function formatMoreRoamingSession(t,a){return map(t).call(t,(function(t){var o=format(ny,t);return o.sessionId=getSessionId(t,a),o}))}(t.content.datas,this.core.account);this.logger.log("session:syncSessionsWithMoreRoaming",a)},SessionService}(Wp),gy=function(){function ModuleService(t){this.core=t}var t=ModuleService.prototype;return t.notifyAddTeamMembers=function notifyAddTeamMembers(t,a){this.core.emit("addTeamMembers",{team:t,accounts:a,members:generatorMembersByTeam(t,a)})},t.notifyUpdateTeamManagers=function notifyUpdateTeamManagers(t,a,o,c){this.core.emit("updateTeamManagers",{team:{teamId:t,memberUpdateTime:c},accounts:a,isManager:o,members:map(a).call(a,(function(a){return{id:t+"-"+a,account:a,type:"manager",updateTime:c}}))})},t.notifyRemoveTeamMembers=function notifyRemoveTeamMembers(t,a){this.core.emit("removeTeamMembers",{team:t,accounts:a})},t.notifyTransferTeam=function notifyTransferTeam(t,a,o){this.core.emit("transferTeam",{team:t,from:{id:t.teamId+"-"+a,type:"normal",account:a,updateTime:t.memberUpdateTime},to:{id:t.teamId+"-"+o,type:"owner",account:o,updateTime:t.memberUpdateTime}})},t.notifyUpdateTeamMembersMute=function notifyUpdateTeamMembersMute(t,a,o){this.core.emit("updateTeamMembersMute",{team:t,accounts:a,members:map(a).call(a,(function(a){return{id:t.teamId+"-"+a,account:a,teamId:t.teamId,mute:o,updateTime:t.memberUpdateTime}})),mute:o})},ModuleService}(),yy=function(t){function TeamService(a){var o;return(o=t.call(this,"team",a)||this).service=new gy(a),o.core.eventBus.on("team/onNotification",(function(t){return o.notificationHandler(t)})),registerParser({cmdMap:hm,cmdConfig:Sm}),o}_t(TeamService,t);var a=TeamService.prototype;return a.getTeamInfo=function getTeamInfo(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var a,o;return Mo.wrap((function _callee$(c){for(;;)switch(c.prev=c.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),c.next=3,this.core.sendCmd("getTeamInfo",{teamId:t.teamId});case 3:return a=c.sent,o=a.content.team,c.abrupt("return",formatTeam(o));case 6:case"end":return c.stop()}}),_callee,this)})))},a.getTeams=function getTeams(){return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var t,a;return Mo.wrap((function _callee2$(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this.core.sendCmd("getTeams",{timetag:0});case 2:return t=o.sent,a=t.content.teams,o.abrupt("return",formatTeams(a));case 5:case"end":return o.stop()}}),_callee2,this)})))},a.getTeamsById=function getTeamsById(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){var a,o;return Mo.wrap((function _callee3$(c){for(;;)switch(c.prev=c.next){case 0:return validate({teamIds:{type:"array",itemType:"string"}},t),c.next=3,this.core.sendCmd("getTeamsById",{teamIds:t.teamIds});case 3:return a=c.sent,o=formatTeams(a.content.teams),c.abrupt("return",{teams:o,tids:a.content.tids});case 6:case"end":return c.stop()}}),_callee3,this)})))},a.createTeam=function createTeam(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee4(){var a,o,c;return Mo.wrap((function _callee4$(m){for(;;)switch(m.prev=m.next){case 0:return validate({type:{type:"enum",values:["advanced","normal"]},name:{type:"string",allowEmpty:!1},level:{type:"number",required:!1},accounts:{type:"array",itemType:"string",required:!1},ps:{type:"string",allowEmpty:!1,max:5e3,required:!1},joinMode:{type:"enum",values:["noVerify","needVerify","rejectAll"],required:!1},beInviteMode:{type:"enum",values:["noVerify","needVerify"],required:!1},inviteMode:{type:"enum",values:["manager","all"],required:!1},updateTeamMode:{type:"enum",values:["manager","all"],required:!1},updateExtMode:{type:"enum",values:["manager","all"],required:!1},intro:{type:"string",allowEmpty:!1,required:!1},announcement:{type:"string",allowEmpty:!1,required:!1},avatar:{type:"string",allowEmpty:!1,required:!1},ext:{type:"string",allowEmpty:!1,required:!1}},t),a=generateTeam(t),m.next=4,this.core.sendCmd("createTeam",{team:a,accounts:t.accounts||[],ps:t.ps||""});case 4:return o=m.sent,c=formatTeam(o.content.team),m.abrupt("return",c);case 7:case"end":return m.stop()}}),_callee4,this)})))},a.dismissTeam=function dismissTeam(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee5(){return Mo.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),a.next=3,this.core.sendCmd("dismissTeam",{teamId:t.teamId});case 3:case"end":return a.stop()}}),_callee5,this)})))},a.leaveTeam=function leaveTeam(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee6(){return Mo.wrap((function _callee6$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),a.next=3,this.core.sendCmd("leaveTeam",{teamId:t.teamId});case 3:case"end":return a.stop()}}),_callee6,this)})))},a.transferTeam=function transferTeam(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee7(){return Mo.wrap((function _callee7$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},account:{type:"string",allowEmpty:!1},leave:{type:"boolean"}},t),a.next=3,this.core.sendCmd("transferTeam",t);case 3:case"end":return a.stop()}}),_callee7,this)})))},a.updateTeamInfo=function updateTeamInfo(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee8(){var a;return Mo.wrap((function _callee8$(o){for(;;)switch(o.prev=o.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},joinMode:{type:"enum",values:["noVerify","needVerify","rejectAll"],required:!1},beInviteMode:{type:"enum",values:["noVerify","needVerify"],required:!1},inviteMode:{type:"enum",values:["manager","all"],required:!1},updateTeamMode:{type:"enum",values:["manager","all"],required:!1},updateExtMode:{type:"enum",values:["manager","all"],required:!1},intro:{type:"string",allowEmpty:!1,required:!1},announcement:{type:"string",allowEmpty:!1,required:!1},avatar:{type:"string",allowEmpty:!1,required:!1},ext:{type:"string",allowEmpty:!1,required:!1}},t),a=generateTeam(t),o.next=4,this.core.sendCmd("updateTeamInfo",{team:a});case 4:return o.abrupt("return",formatTeam(a));case 5:case"end":return o.stop()}}),_callee8,this)})))},a.getTeamMembers=function getTeamMembers(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee9(){var o,c;return Mo.wrap((function _callee9$(m){for(;;)switch(m.prev=m.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",required:!1}},t),m.next=3,this.core.sendCmd("getTeamMembers",{teamId:t.teamId,timetag:0});case 3:if(o=m.sent,c=formatTeamMembers(null===(a=o.content)||void 0===a?void 0:a.teamMembers),t.accounts&&t.accounts.length>0){m.next=7;break}return m.abrupt("return",c);case 7:return m.abrupt("return",filter(c).call(c,(function(a){var o;return null===(o=t.accounts)||void 0===o?void 0:includes(o).call(o,a.account)})));case 8:case"end":return m.stop()}}),_callee9,this)})))},a.getMutedTeamMembers=function getMutedTeamMembers(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee10(){var a,o;return Mo.wrap((function _callee10$(c){for(;;)switch(c.prev=c.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),c.next=3,this.core.sendCmd("getMutedTeamMembers",{teamId:t.teamId});case 3:return a=c.sent,o=a.content,c.abrupt("return",formatTeamMembers(o.teamMembers));case 6:case"end":return c.stop()}}),_callee10,this)})))},a.addTeamMembers=function addTeamMembers(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee11(){return Mo.wrap((function _callee11$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",min:1},ps:{type:"string",allowEmpty:!0,max:5e3,required:!1}},t),a.next=3,this.core.sendCmd("addTeamMembers",{teamId:t.teamId,accounts:t.accounts,ps:t.ps||"",attach:t.ext||""});case 3:case"end":return a.stop()}}),_callee11,this)})))},a.removeTeamMembers=function removeTeamMembers(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee12(){return Mo.wrap((function _callee12$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",min:1}},t),a.next=3,this.core.sendCmd("removeTeamMembers",{teamId:t.teamId,accounts:t.accounts});case 3:case"end":return a.stop()}}),_callee12,this)})))},a.applyTeam=function applyTeam(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee13(){var a;return Mo.wrap((function _callee13$(o){for(;;)switch(o.prev=o.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},ps:{type:"string",allowEmpty:!0,max:5e3,required:!1}},t),o.next=3,this.core.sendCmd("applyTeam",{teamId:t.teamId,ps:t.ps||""});case 3:return a=o.sent,o.abrupt("return",formatTeam(a.content.team));case 5:case"end":return o.stop()}}),_callee13,this)})))},a.addTeamManagers=function addTeamManagers(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee14(){return Mo.wrap((function _callee14$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",min:1,itemType:"string"}},t),a.next=3,this.core.sendCmd("addTeamManagers",t);case 3:case"end":return a.stop()}}),_callee14,this)})))},a.removeTeamManagers=function removeTeamManagers(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee15(){return Mo.wrap((function _callee15$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",min:1,itemType:"string"}},t),a.next=3,this.core.sendCmd("removeTeamManagers",t);case 3:case"end":return a.stop()}}),_callee15,this)})))},a.updateMyMemberInfo=function updateMyMemberInfo(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee16(){var a,o;return Mo.wrap((function _callee16$(c){for(;;)switch(c.prev=c.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},nickInTeam:{type:"string",allowEmpty:!1,required:!1},bitConfigMask:{type:"number",min:0,max:2,required:!1},ext:{type:"string",required:!1}},t),a=generatorTeamMemberForCmd({teamId:t.teamId,nickInTeam:t.nickInTeam,bitConfigMask:t.bitConfigMask,ext:t.ext}),c.next=4,this.core.sendCmd("updateMyMemberInfo",{teamMember:a});case 4:return o=formatTeamMember(Ao({updateTime:(new Date).getTime(),account:this.core.account},a)),this.core.emit("updateTeamMember",o),c.abrupt("return",o);case 7:case"end":return c.stop()}}),_callee16,this)})))},a.updateMemberNick=function updateMemberNick(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee17(){var a,o;return Mo.wrap((function _callee17$(c){for(;;)switch(c.prev=c.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},account:{type:"string",allowEmpty:!1},nickInTeam:{type:"string",allowEmpty:!1}},t),a=generatorTeamMemberForCmd({teamId:t.teamId,nickInTeam:t.nickInTeam,account:t.account}),c.next=4,this.core.sendCmd("updateNickInTeam",{teamMember:a});case 4:return o=formatTeamMember(Ao({updateTime:(new Date).getTime()},a)),c.abrupt("return",o);case 6:case"end":return c.stop()}}),_callee17,this)})))},a.muteTeamMember=function muteTeamMember(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee18(){return Mo.wrap((function _callee18$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},account:{type:"string",allowEmpty:!1},mute:{type:"boolean"}},t),a.next=3,this.core.sendCmd("muteTeamMember",{teamId:t.teamId,account:t.account,mute:t.mute?1:0});case 3:case"end":return a.stop()}}),_callee18,this)})))},a.getTeamMemberInvitorAccid=function getTeamMemberInvitorAccid(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee19(){var o,c;return Mo.wrap((function _callee19$(m){for(;;)switch(m.prev=m.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",max:200}},t),o={teamId:t.teamId},t.accounts&&t.accounts.length>0&&(o.accounts=t.accounts),m.next=5,this.core.sendCmd("getTeamMemberInvitorAccid",o);case 5:return c=m.sent,m.abrupt("return",(null===(a=c.content)||void 0===a?void 0:a.accountsMap)||{});case 7:case"end":return m.stop()}}),_callee19,this)})))},a.muteTeam=function muteTeam(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee20(){return Mo.wrap((function _callee20$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},mute:{type:"boolean"}},t),a.next=3,this.core.sendCmd("muteTeam",{teamId:t.teamId,mute:t.mute?1:0});case 3:case"end":return a.stop()}}),_callee20,this)})))},a.passTeamApply=function passTeamApply(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee21(){return Mo.wrap((function _callee21$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("passTeamApply",t);case 3:case"end":return a.stop()}}),_callee21,this)})))},a.rejectTeamApply=function rejectTeamApply(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee22(){return Mo.wrap((function _callee22$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1},ps:{type:"string",max:5e3,required:!1}},t),a.next=3,this.core.sendCmd("rejectTeamApply",{teamId:t.teamId,from:t.from,ps:t.ps||""});case 3:case"end":return a.stop()}}),_callee22,this)})))},a.acceptTeamInvite=function acceptTeamInvite(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee23(){return Mo.wrap((function _callee23$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("acceptTeamInvite",t);case 3:case"end":return a.stop()}}),_callee23,this)})))},a.rejectTeamInvite=function rejectTeamInvite(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee24(){return Mo.wrap((function _callee24$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1},ps:{type:"string",max:5e3,required:!1}},t),a.next=3,this.core.sendCmd("rejectTeamInvite",{teamId:t.teamId,from:t.from,ps:t.ps||""});case 3:case"end":return a.stop()}}),_callee24,this)})))},a.notifyTeamMsgReceiptsHandler=function notifyTeamMsgReceiptsHandler(t){var a,o=null===(a=t.content)||void 0===a?void 0:a.teamMsgReceipts;o&&o.length>0&&this.core.emit("teamMsgReceipts",o)},a.syncTeamsHandler=function syncTeamsHandler(t){var a=t.content;this.core.eventBus.emit("sync/updateTimetag",{teams:Bl(a.timetag)});var o=null==a?void 0:a.teams;if(o&&o.length){var c=formatTeams(o);this.core.emit("teams",c)}},a.syncCreateTeamHandler=function syncCreateTeamHandler(t){var a=t.content,o=formatTeam(null==a?void 0:a.team),c=generatorMemberByTeam(o,o.owner,"owner");this.core.emit("createTeam",o,c)},a.syncUpdateTeamMemberHandler=function syncUpdateTeamMemberHandler(t){var a=t.content,o=formatTeamMember(null==a?void 0:a.teamMember);o.updateTime||(o.updateTime=(new Date).getTime()),this.core.emit("updateTeamMember",o)},a.notificationHandler=function notificationHandler(t){var a=t.attach,o=t.scene,c=t.from,m=t.to,h=t.time,v=t.idServer,b=t.idClient,S=a.team,T=a.account,M=a.accounts,w=a.type;if("team"===o)switch("debug"===this.core.options.debugLevel?this.logger.debug("team::recvNotification",v,b,a):this.logger.log("team::recvNotification",v,b,m,w,T,M),w){case"updateTeam":S.updateTime=h,this.core.emit("updateTeam",S);break;case"addTeamMembers":this.service.notifyAddTeamMembers(S,M);break;case"acceptTeamInvite":this.service.notifyAddTeamMembers(S,[c]);break;case"passTeamApply":this.service.notifyAddTeamMembers(S,[T]);break;case"addTeamManagers":this.service.notifyUpdateTeamManagers(m,M,!0,h);break;case"removeTeamManagers":this.service.notifyUpdateTeamManagers(m,M,!1,h);break;case"removeTeamMembers":this.service.notifyRemoveTeamMembers(S,M);break;case"leaveTeam":this.service.notifyRemoveTeamMembers(S,[c]);break;case"dismissTeam":this.core.emit("dismissTeam",{teamId:m});break;case"transferTeam":this.service.notifyTransferTeam(S,c,T);break;case"updateTeamMemberMute":this.service.notifyUpdateTeamMembersMute(S,[T],a.mute)}},TeamService}(Wp);!function(t){t[t.none=0]="none",t[t.pass=1]="pass",t[t.decline=2]="decline",t[t.read=3]="read",t[t.deleted=4]="deleted",t[t.invalid=5]="invalid"}(py||(py={})),function(t){t[t.default=0]="default",t[t.leave=1]="leave",t[t.roam=2]="roam"}(dy||(dy={}));var hy={applyTeam:0,rejectTeamApply:1,teamInvite:2,rejectTeamInvite:3,friendRequest:5,deleteFriend:6,recallMsgP2p:7,recallMsgTeam:8,recallMsgSuperTeam:12,deleteMsgP2pOneWay:13,deleteMsgTeamOneWay:14,applySuperTeam:15,rejectSuperTeamApply:16,superTeamInvite:17,rejectSuperTeamInvite:18,customP2p:100,customTeam:101,customSuperTeam:103},vy={1:"addFriend",2:"applyFriend",3:"passFriendApply",4:"rejectFriendApply"};var by={setting:{needSaveOffline:{type:"boolean"},isRoutable:{type:"boolean"},envConfig:{type:"string"}},antiSpamInfo:{needAntiSpam:{type:"boolean"},antiSpamContent:{type:"boolean"}},pushInfo:{needPush:{type:"boolean"},needPushBadge:{type:"boolean"},needPushNick:{type:"boolean"},pushApnsText:{type:"string"},pushPayload:{type:"string"},needForcePush:{type:"boolean"},forcePushIDsList:{type:"string"},pushContent:{type:"string",rawKey:"forcePushContent"}},recallMessageInfo:{idClient:{type:"string",rawKey:"deletedIdClient"},idServer:{type:"string",rawKey:"deletedIdServer"},createTime:{type:"number",rawKey:"deletedMsgTime"},fromNick:{type:"string",rawKey:"deletedMsgFromNick"},opeAccount:{type:"string"}}};function formatSystemMessage(t,a,o){var c=+t.type,m=getEnumKeyByEnumValue(hy,c);o=o||dy.default;var h=Ao(Ao({},format(by,t)),{type:m,time:+t.time,to:t.to,from:t.from,idServer:t.idServer,state:py[py.none],feature:dy[o]});if("string"==typeof h.attach)try{h.attach=JSON.parse(h.attach)}catch(t){a.error("formatSystemMessage: "+h.idServer+" parse attach error",t&&t.message)}return 5===c&&h.attach?(h.attach.type=vy[+h.attach.vt],"passFriendApply"===h.attach.type?h.state=py[py.pass]:"rejectFriendApply"===h.attach.type&&(h.state=py[py.decline])):c<=3&&h.attach&&(h.attach=function formatTeamAttach(t){var a=t.attach,o=t.tinfo,c=__rest(t,["attach","tinfo"]);return c.ext=a,void 0!==o&&(c.team=formatTeam(deserialize(t.tinfo,bm.team))),c}(h.attach)),h}function generatorSysMsgForCmd(t){var a=Ao({},t);return Ao(Ao({},formatReverse(by,a)),{type:hy[a.type],to:a.to,attach:a.attach})}var Sy={"4_6":"syncOfflineSysMsgs","4_18":"syncOfflineSysMsgs","4_19":"syncRecallMsgOfflineAndRoaming","4_101":"syncOfflineSysMsgs","7_3":"onSysMsg","7_7":"sendCustomSysMsg","7_14":"onRecallMsg","21_18":"onRecallMsg","21_117":"onRecallMsg","7_15":"syncRecallMsgOfflineAndRoaming","21_19":"onSysMsg","21_16":"sendSuperTeamCustomSysMsg","101_3":"onSysMsg","101_7":"sendFilterCustomSysMsg"},Ty={sysMsg:{time:0,type:1,to:2,from:3,content:4,attach:5,idServer:6,needSaveOffline:7,pushApnsText:8,pushPayload:9,deletedIdClient:10,deletedIdServer:11,needcAntiSpam:12,antiSpamContent:13,deletedMsgTime:14,deletedMsgFromNick:15,opeAccount:16,forcePushIDsList:18,forcePushContent:19,needForcePush:20,envConfig:21,callbackExt:22,isRoutable:105,needPush:107,needPushBadge:109,needPushNick:110}},My=invertSerializeMap(Ty),wy={onSysMsg:{service:"systemMessage",sid:7,cid:3,response:[{type:"Property",name:"sysMsg",reflectMapper:My.sysMsg}]},sendCustomSysMsg:{service:"systemMessage",sid:7,cid:7,params:[{type:"Property",name:"sysMsg",reflectMapper:Ty.sysMsg}]},sendSuperTeamCustomSysMsg:{service:"systemMessage",sid:21,cid:16,params:[{type:"Property",name:"sysMsg",reflectMapper:Ty.sysMsg}]},sendFilterCustomSysMsg:{service:"systemMessage",sid:101,cid:7,params:[{type:"Property",name:"sysMsg",reflectMapper:Ty.sysMsg}]},batchMarkRead:{service:"systemMessage",sid:4,cid:5,isNoResponse:!0,params:[{type:"byte",name:"sid"},{type:"byte",name:"cid"},{type:"LongArray",name:"ids"}]},onRecallMsg:{sid:7,cid:14,service:"systemMessage",response:[{type:"Property",name:"sysMsg",reflectMapper:My.sysMsg}]},syncRecallMsgOfflineAndRoaming:{sid:7,cid:15,service:"systemMessage",response:[{type:"PropertyArray",name:"sysMsgs",reflectMapper:My.sysMsg},{type:"Number",name:"timetag"},{type:"Number",name:"type"}]},syncOfflineSysMsgs:{sid:4,cid:9,service:"systemMessage",response:[{type:"PropertyArray",name:"sysMsgs",reflectMapper:My.sysMsg}]}},_y=function(t){function SystemMessageService(a){var o;return(o=t.call(this,"systemMessage",a)||this).sysMsgUnread={total:0,friend:0,msg:0,team:0,superTeam:0},o.core.eventBus.on("logined",(function(){o.initEventListeners()})),registerParser({cmdMap:Sy,cmdConfig:wy}),o}_t(SystemMessageService,t);var a=SystemMessageService.prototype;return a.initEventListeners=function initEventListeners(){var t=this;this.core.eventBus.on("systemMessage/passFriendApply",(function(a){t.core.emit("updateSystemMessages",[{idServer:a.idServer,from:a.account,state:"pass",type:"friendRequest"}])})),this.core.eventBus.on("systemMessage/rejectFriendApply",(function(a){t.core.emit("updateSystemMessages",[{idServer:a.idServer,from:a.account,state:"decline",type:"friendRequest"}])}))},a.doMarkSysMsgAck=function doMarkSysMsgAck(t){var a=[],o=[],c=["applySuperTeam","rejectSuperTeamApply","superTeamInvite","rejectSuperTeamInvite","customSuperTeam"];forEach$1(t).call(t,(function(t){t.idServer&&(includes(c).call(c,t.type)?o.push(t.idServer):a.push(t.idServer))})),a.length>0&&this.core.sendCmd("batchMarkRead",{sid:"7",cid:"3",ids:a}),o.length>0&&this.core.sendCmd("batchMarkRead",{sid:"21",cid:"19",ids:o})},a.sendCustomSysMsg=function sendCustomSysMsg(t){var a=this;validate({to:{type:"string",allowEmpty:!1},type:{type:"enum",values:["customP2p","customTeam","customSuperTeam"]},attach:{type:"string",allowEmpty:!1},setting:{type:"object",rules:{needSaveOffline:{type:"boolean",required:!1},env:{type:"string",allowEmpty:!1,required:!1}},required:!1},pushInfo:{type:"object",required:!1,rules:{needPush:{type:"boolean",required:!1},pushApnsText:{type:"string",required:!1},pushPayload:{type:"string",required:!1}}}},t);var o="customSuperTeam"===t.type?"sendSuperTeamCustomSysMsg":"sendCustomSysMsg";return this.core.sendCmd(o,{sysMsg:generatorSysMsgForCmd(t)}).then((function(){a.logger.log("sendCustomSysMsg success")})).catch((function(t){throw a.logger.error("sendCustomSysMsg failed",t.message),t}))},a.onSysMsgHandler=function onSysMsgHandler(t){var a=t.content.sysMsg;if(a){var o=formatSystemMessage(a,this.logger,dy.default);this.core.emit("sysMsg",o),this.doMarkSysMsgAck([o])}else this.logger.warn("onSysMsg no content.sysMsg")},a.syncOfflineSysMsgsHandler=function syncOfflineSysMsgsHandler(t){var a,o=this;if(t.content.sysMsgs&&t.content.sysMsgs.length>0){var c=map(a=t.content.sysMsgs).call(a,(function(t){return formatSystemMessage(t,o.logger,dy.leave)}));this.core.emit("syncSysMsgs",c),this.doMarkSysMsgAck(c)}},a.onRecallMsgHandler=function onRecallMsgHandler(t){var a=t.content.sysMsg;if(a){var o=formatDeletedMsgs([a],function getSceneFromRecallSysMsg(t){return t===hy.recallMsgP2p?"p2p":t===hy.recallMsgTeam?"team":t===hy.recallMsgSuperTeam?"superTeam":""}(+a.type));this.core.eventBus.emit("session/updateForDeletedMsg",o);var c=formatSystemMessage(a,this.logger,dy.default);this.core.emit("sysMsg",c),this.doMarkSysMsgAck([c])}else this.logger.warn("onSysMsg no content.sysMsg")},a.syncRecallMsgOfflineAndRoamingHandler=function syncRecallMsgOfflineAndRoamingHandler(t){var a=this,o=t.content,c=o.timetag,m=o.type,h=o.sysMsgs,v=Bl(m),b=1===v?dy.leave:dy.roam,S=map(h).call(h,(function(t){return formatSystemMessage(t,a.logger,b)}));1===v&&this.doMarkSysMsgAck(S),this.core.eventBus.emit("sync/updateTimetag",{recallMsg:c}),this.core.emit("syncSysMsgs",S)},SystemMessageService}(Wp);function reverseFriend(t){var a=["bitsExtension","createTime","updateTime","passRelationShip","relationShip","source"],o=Ao({},t);return forEach$1(a).call(a,(function(t){void 0!==o[t]&&(o[t]=Bl(o[t]))})),void 0!==o.relationShip&&(o.valid=1===o.relationShip),o}var xy={1:"addFriend",2:"applyFriend",3:"passFriendApply",4:"rejectFriendApply"};var ky={"12_4":"getFriends","12_1":"friendReuqest","12_2":"deleteFriend","12_3":"updateFriend","12_5":"syncFriends","12_6":"syncFriendUsers","12_101":"syncFriendRequest","12_102":"syncDeleteFriend","12_103":"syncUpdateFriend"},Iy={updateFriendTag:{account:4,alias:8,ext:10},delFriendParams:{delAlias:1},friendTag:{account:4,relationShip:5,passRelationShip:6,source:7,alias:8,bitsExtension:9,ext:10,createTime:11,updateTime:12,serverex:13},userTag:{account:1,nick:3,avatar:4,sign:5,gender:6,email:7,birth:8,tel:9,ext:10,createTime:12,updateTime:13}},Cy=invertSerializeMap(Iy),Ey={getFriends:{sid:12,cid:4,service:"friend",params:[{type:"Long",name:"timetag"}],response:[{type:"PropertyArray",name:"friends",reflectMapper:Cy.friendTag},{type:"Number",name:"timetag"}]},friendReuqest:{sid:12,cid:1,service:"friend",params:[{type:"String",name:"account"},{type:"Byte",name:"type"},{type:"String",name:"ps"}]},deleteFriend:{sid:12,cid:2,service:"friend",params:[{type:"String",name:"account"},{type:"Property",name:"delFriendParams",reflectMapper:Iy.delFriendParams}]},updateFriend:{sid:12,cid:3,service:"friend",params:[{type:"Property",name:"updateFriendTag",reflectMapper:Iy.updateFriendTag}]},syncFriends:{sid:12,cid:5,service:"friend",response:[{type:"PropertyArray",name:"friends",entity:"friendTag",reflectMapper:Cy.friendTag},{type:"Number",name:"timetag"}]},syncFriendUsers:{sid:12,cid:6,service:"friend",response:[{type:"PropertyArray",name:"users",entity:"userTag",reflectMapper:Cy.userTag},{type:"Number",name:"timetag"}]},syncFriendRequest:{sid:12,cid:101,service:"friend",params:[{type:"String",name:"account"},{type:"Number",name:"type"},{type:"String",name:"ps"}],response:[{type:"String",name:"account"},{type:"Number",name:"type"},{type:"String",name:"ps"}]},syncDeleteFriend:{sid:12,cid:102,service:"friend",response:[{type:"String",name:"account"}]},syncUpdateFriend:{sid:12,cid:103,service:"friend",response:[{type:"Property",name:"friend",reflectMapper:Cy.friendTag}]}},Ay=function(t){function FriendService(a){var o;return o=t.call(this,"friend",a)||this,registerParser({cmdMap:ky,cmdConfig:Ey}),o}_t(FriendService,t);var a=FriendService.prototype;return a.getFriends=function getFriends(){var t;return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var a,o;return Mo.wrap((function _callee$(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this.core.sendCmd("getFriends",{timetag:0});case 2:return a=c.sent,o=(null===(t=a.content)||void 0===t?void 0:t.friends)||[],o=map(o).call(o,(function(t){return reverseFriend(t)})),c.abrupt("return",o);case 6:case"end":return c.stop()}}),_callee,this)})))},a.addFriend=function addFriend(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var a;return Mo.wrap((function _callee2$(o){for(;;)switch(o.prev=o.next){case 0:return validate({account:{type:"string",allowEmpty:!1},ps:{type:"string",allowEmpty:!1,required:!1}},t),o.next=3,this.core.sendCmd("friendReuqest",{account:t.account,type:1,ps:t.ps||""});case 3:return a=(new Date).getTime(),o.abrupt("return",{account:t.account,createTime:a,updateTime:a,valid:!0,source:0,passRelationShip:1,relationShip:1,bitsExtension:0});case 5:case"end":return o.stop()}}),_callee2,this)})))},a.applyFriend=function applyFriend(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){return Mo.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:return validate({account:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("friendReuqest",{account:t.account,type:2,ps:t.ps||""});case 3:case"end":return a.stop()}}),_callee3,this)})))},a.passFriendApply=function passFriendApply(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee4(){var a=this;return Mo.wrap((function _callee4$(o){for(;;)switch(o.prev=o.next){case 0:return validate({account:{type:"string",allowEmpty:!1}},t),o.next=3,this.core.sendCmd("friendReuqest",{account:t.account,type:3,ps:t.ps||""}).then((function(o){return a.core.eventBus.emit("systemMessage/passFriendApply",t),o}));case 3:case"end":return o.stop()}}),_callee4,this)})))},a.rejectFriendApply=function rejectFriendApply(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee5(){var a=this;return Mo.wrap((function _callee5$(o){for(;;)switch(o.prev=o.next){case 0:return validate({account:{type:"string",allowEmpty:!1}},t),o.next=3,this.core.sendCmd("friendReuqest",{account:t.account,type:4,ps:t.ps||""}).then((function(o){return a.core.eventBus.emit("systemMessage/rejectFriendApply",t),o}));case 3:case"end":return o.stop()}}),_callee5,this)})))},a.deleteFriend=function deleteFriend(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee6(){return Mo.wrap((function _callee6$(a){for(;;)switch(a.prev=a.next){case 0:return validate({account:{type:"string",allowEmpty:!1},delAlias:{type:"boolean"}},t),a.next=3,this.core.sendCmd("deleteFriend",{account:t.account,delFriendParams:{delAlias:!0===t.delAlias?1:0}});case 3:case"end":return a.stop()}}),_callee6,this)})))},a.updateFriend=function updateFriend(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee7(){return Mo.wrap((function _callee7$(a){for(;;)switch(a.prev=a.next){case 0:return validate({account:{type:"string",allowEmpty:!1},alias:{type:"string"},ext:{type:"string",required:!1}},t),a.next=3,this.core.sendCmd("updateFriend",{updateFriendTag:t});case 3:case"end":return a.stop()}}),_callee7,this)})))},a.syncFriendRequestHandler=function syncFriendRequestHandler(t){var a=function formatFriendRequest(t){var a=Ao({},t);try{a.ps=a.ps&&JSON.parse(a.ps)}catch(t){}if(a.type=xy[a.type],"addFriend"===a.type||"passFriendApply"===a.type){var o=(new Date).getTime();a.friend={account:t.account,alias:"",createTime:o,ext:"",updateTime:o,valid:!0}}return a}(t.content);this.core.emit("syncFriend",a)},a.syncDeleteFriendHandler=function syncDeleteFriendHandler(t){var a=t.content.account;this.logger.log("friend::emit syncFriendAction: deleteFriend "+a),this.core.emit("syncFriend",{type:"deleteFriend",account:a})},a.syncUpdateFriendHandler=function syncUpdateFriendHandler(t){var a=reverseFriend(t.content.friend);this.logger.log("friend::emit syncFriendAction: updateFriend, ",null==a?void 0:a.account),this.core.emit("syncFriend",{type:"updateFriend",friend:a})},a.syncFriendsHandler=function syncFriendsHandler(t){var a=t.content;this.core.eventBus.emit("sync/updateTimetag",{friends:Bl(a.timetag)});var o=null==a?void 0:a.friends;if(o&&o.length){var c=map(o).call(o,(function(t){return reverseFriend(t)}));this.core.emit("friends",c)}},a.syncFriendUsersHandler=function syncFriendUsersHandler(t){var a=t.content;this.core.eventBus.emit("sync/updateTimetag",{friendUsers:Bl(a.timetag)});var o=null==a?void 0:a.users;if(o&&o.length){var c=map(o).call(o,(function(t){return formatUser(t)}));this.core.emit("users",c)}},FriendService}(Wp),Py={1:"Android",2:"iOS",4:"PC",8:"WindowsPhone",16:"Web",32:"Server",64:"Mac"};function formatSubscribes(t){return t&&t.length>0?map(t).call(t,(function(t){return function formatSubscribe(t){var a=Ao({},t),o=["subscribeTime","time"];return forEach$1(o).call(o,(function(t){a[t]&&(a[t]=Bl(a[t]))})),a}(t)})):[]}function formatEvent(t){if(!t)return t;var a=t.serverExt,o=__rest(t,["serverExt"]),c=["time","type","value"];if(forEach$1(c).call(c,(function(t){o[t]&&(o[t]=Bl(o[t]))})),o.clientType&&(o.clientType=Py[o.clientType]||""),a)try{o.ext=JSON.parse(a),"string"==typeof o.ext[0]&&(o.ext=o.ext[0])}catch(t){}return o}var Oy={"14_1":"publishEvent","14_2":"pushEvent","14_3":"subscribeEvent","14_4":"unSubscribeEventsByAccounts","14_5":"unSubscribeEventsByType","14_6":"querySubscribeEventsByAccounts","14_7":"querySubscribeEventsByType","14_9":"pushEvents"},Ry={msgEvent:{type:1,value:2,idClient:3,ext:4,validTime:5,broadcastType:6,sync:7,validTimeType:8,durable:9,time:10,idServer:11,clientType:12,serverConfig:13,serverExt:14,appid:101,account:103,enableMultiClient:104,consid:106},msgEventSubscribe:{type:1,subscribeTime:2,sync:3,to:102,from:104,time:105}},jy=invertSerializeMap(Ry),Fy={publishEvent:{sid:14,cid:1,service:"event",params:[{type:"Property",name:"msgEvent",reflectMapper:Ry.msgEvent}],response:[{type:"Property",name:"msgEvent",reflectMapper:jy.msgEvent}]},pushEvent:{sid:14,cid:2,service:"event",response:[{type:"Property",name:"msgEvent",reflectMapper:jy.msgEvent}]},subscribeEvent:{sid:14,cid:3,service:"event",params:[{type:"Property",name:"msgEventSubscribe",reflectMapper:Ry.msgEventSubscribe},{type:"StrArray",name:"accounts"}],response:[{type:"StrArray",name:"accounts"}]},unSubscribeEventsByAccounts:{sid:14,cid:4,service:"event",params:[{type:"Property",name:"msgEventSubscribe",reflectMapper:Ry.msgEventSubscribe},{type:"StrArray",name:"accounts"}],response:[{type:"StrArray",name:"accounts"}]},unSubscribeEventsByType:{sid:14,cid:5,service:"event",params:[{type:"Property",name:"msgEventSubscribe",reflectMapper:Ry.msgEventSubscribe}]},querySubscribeEventsByAccounts:{sid:14,cid:6,service:"event",params:[{type:"Property",name:"msgEventSubscribe",reflectMapper:Ry.msgEventSubscribe},{type:"StrArray",name:"accounts"}],response:[{type:"PropertyArray",name:"msgEventSubscribes",reflectMapper:jy.msgEventSubscribe}]},querySubscribeEventsByType:{sid:14,cid:7,service:"event",params:[{type:"Property",name:"msgEventSubscribe",reflectMapper:Ry.msgEventSubscribe}],response:[{type:"PropertyArray",name:"msgEventSubscribes",reflectMapper:jy.msgEventSubscribe}]},pushEvents:{sid:14,cid:9,service:"event",response:[{type:"PropertyArray",name:"msgEvents",reflectMapper:jy.msgEvent}]}},Ly=function(t){function EventService(a){var o;return o=t.call(this,"event",a)||this,registerParser({cmdMap:Oy,cmdConfig:Fy}),o}_t(EventService,t);var a=EventService.prototype;return a.publishEvent=function publishEvent(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var o,c,m;return Mo.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:return validate({type:{type:"number"},value:{type:"number"},ext:{type:"string",required:!1},validTime:{type:"number",min:60,max:2592e3,required:!1},broadcastType:{type:"number",required:!1},sync:{type:"boolean",required:!1}},t),o=Ao(Ao({validTime:604800},t),{idClient:ql(),sync:!0===t.sync?1:0}),h.next=4,this.core.sendCmd("publishEvent",{msgEvent:o});case 4:return c=h.sent,m=(null===(a=c.content)||void 0===a?void 0:a.msgEvent)||{},h.abrupt("return",formatEvent(m));case 7:case"end":return h.stop()}}),_callee,this)})))},a.subscribeEvent=function subscribeEvent(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var o,c,m;return Mo.wrap((function _callee2$(h){for(;;)switch(h.prev=h.next){case 0:return validate({type:{type:"number"},accounts:{type:"array",itemType:"string",max:100},subscribeTime:{type:"number",min:60,max:2592e3,required:!1}},t),o=Ao(Ao({subscribeTime:2592e3},t),{sync:!0===t.sync?1:0}),h.next=4,this.core.sendCmd("subscribeEvent",{msgEventSubscribe:o,accounts:t.accounts});case 4:return c=h.sent,m=(null===(a=c.content)||void 0===a?void 0:a.accounts)||[],h.abrupt("return",{failedAccounts:m});case 7:case"end":return h.stop()}}),_callee2,this)})))},a.unSubscribeEvents=function unSubscribeEvents(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){var o,c,m;return Mo.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:if(validate({type:{type:"number"},accounts:{type:"array",itemType:"string",max:100,required:!1}},t),o={type:t.type},!(t.accounts&&t.accounts.length>0)){h.next=9;break}return h.next=5,this.core.sendCmd("unSubscribeEventsByAccounts",{msgEventSubscribe:o,accounts:t.accounts});case 5:m=h.sent,c=(null===(a=m.content)||void 0===a?void 0:a.accounts)||[],h.next=12;break;case 9:return h.next=11,this.core.sendCmd("unSubscribeEventsByType",{msgEventSubscribe:o});case 11:c=[];case 12:return h.abrupt("return",{failedAccounts:c});case 13:case"end":return h.stop()}}),_callee3,this)})))},a.querySubscribeEvents=function querySubscribeEvents(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee4(){var o;return Mo.wrap((function _callee4$(c){for(;;)switch(c.prev=c.next){case 0:if(validate({type:{type:"number"},accounts:{type:"array",itemType:"string",max:100,required:!1}},t),!(t.accounts&&t.accounts.length>0)){c.next=7;break}return c.next=4,this.core.sendCmd("querySubscribeEventsByAccounts",{msgEventSubscribe:{type:t.type},accounts:t.accounts});case 4:o=c.sent,c.next=10;break;case 7:return c.next=9,this.core.sendCmd("querySubscribeEventsByType",{msgEventSubscribe:{type:t.type}});case 9:o=c.sent;case 10:return c.abrupt("return",formatSubscribes(null===(a=o.content)||void 0===a?void 0:a.msgEventSubscribes));case 11:case"end":return c.stop()}}),_callee4,this)})))},a.pushEventHandler=function pushEventHandler(t){var a,o=(null===(a=t.content)||void 0===a?void 0:a.msgEvent)||{};this.core.emit("pushEvents",[formatEvent(o)])},a.pushEventsHandler=function pushEventsHandler(t){var a,o=(null===(a=t.content)||void 0===a?void 0:a.msgEvents)||{};this.core.emit("pushEvents",function formatEvents(t){return zc(t)&&t.length>0?map(t).call(t,(function(t){return formatEvent(t)})):[]}(o))},EventService}(Wp);function generateThreadMsgsParams(t){var a={scene:Fd[t.scene],from:t.threadMsgFromAccount,to:t.threadMsgToAccount,time:t.threadMsgTime,idServer:t.threadMsgIdServer},o={limit:t.limit<100?t.limit:100,beginTime:"number"==typeof t.beginTime?t.beginTime:0,reverse:!0===reverse$1(t)?1:0};return t.lastMsgId&&(o.lastMsgId=t.lastMsgId),{msg:a,threadMsgReq:o}}var Ny,Uy={"23_1":"getThreadMsgs","23_2":"getMsgsByIdServer"},By={msg:Pm,threadMsgReq:{beginTime:1,endTime:2,lastMsgId:3,limit:4,reverse:5},threadMsgsMeta:{total:1,lastMsgTime:2}},qy=invertSerializeMap(By),Dy={getThreadMsgs:{sid:23,cid:1,service:"msgExtend",params:[{type:"Property",name:"msg",reflectMapper:By.msg},{type:"Property",name:"threadMsgReq",reflectMapper:By.threadMsgReq}],response:[{type:"Property",name:"threadMsg",reflectMapper:qy.msg},{type:"Property",name:"threadMsgsMeta",reflectMapper:qy.threadMsgsMeta},{type:"PropertyArray",name:"msgs",reflectMapper:qy.msg}]},getMsgsByIdServer:{sid:23,cid:2,service:"msgExtend",params:[{type:"PropertyArray",name:"reqMsgs",reflectMapper:By.msg}],response:[{type:"PropertyArray",name:"msgs",reflectMapper:qy.msg}]}},Hy=function(t){function MsgExtendService(a){var o;return o=t.call(this,"msgExtend",a)||this,registerParser({cmdMap:Uy,cmdConfig:Dy}),o}_t(MsgExtendService,t);var a=MsgExtendService.prototype;return a.getThreadMsgs=function getThreadMsgs(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var o,c,m,h,v,b,S;return Mo.wrap((function _callee$(T){for(;;)switch(T.prev=T.next){case 0:return validate({scene:{type:"enum",values:getEnumKeys(Hp)},threadMsgFromAccount:{type:"string",allowEmpty:!1},threadMsgIdServer:{type:"string",allowEmpty:!1},threadMsgTime:{type:"number"},threadMsgToAccount:{type:"string",allowEmpty:!1},beginTime:{type:"number",required:!1},endTime:{type:"number",required:!1},lastMsgId:{type:"string",allowEmpty:!1,required:!1},limit:{type:"number",min:1,max:100,required:!1},reverse:{type:"boolean",required:!1}},t),T.next=3,this.core.sendCmd("getThreadMsgs",generateThreadMsgsParams(t));case 3:return o=T.sent,c=o.content,m=c.msgs,h=c.threadMsg,v=o.content.threadMsgsMeta,b=getSessionId(h,this.core.account),S=null===(a=this.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:b}),m=formatMsgs(m,S?{account:this.core.account,sessionAck:S.ack,msgReceiptTime:S.msgReceiptTime}:{account:this.core.account}),h=formatMsg(h,S?{account:this.core.account,sessionAck:S.ack,msgReceiptTime:S.msgReceiptTime}:{account:this.core.account}),T.abrupt("return",{msgs:m,threadMsg:h,total:Bl(v.total),timetag:Bl(v.lastMsgTime)});case 11:case"end":return T.stop()}}),_callee,this)})))},a.getMsgsByIdServer=function getMsgsByIdServer(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var a,o,c,m,h=this;return Mo.wrap((function _callee2$(v){for(;;)switch(v.prev=v.next){case 0:return validate({reqMsgs:{type:"array",rules:{scene:{type:"enum",values:getEnumKeys(Hp)},from:{type:"string",allowEmpty:!1},to:{type:"string",allowEmpty:!1},idServer:{type:"string",allowEmpty:!1},time:{type:"number"}},min:1,max:100}},t),v.next=3,this.core.sendCmd("getMsgsByIdServer",{reqMsgs:map(a=t.reqMsgs).call(a,(function(t){return Ao(Ao({},t),{scene:getEnumKeyByEnumValue(Hp,t.scene)})}))});case 3:return c=v.sent,m=map(o=c.content.msgs).call(o,(function(t){var a,o=getSessionId(t,h.core.account),c=null===(a=h.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:o});return formatMsg(t,c?{account:h.core.account,sessionAck:c.ack,msgReceiptTime:c.msgReceiptTime}:{account:h.core.account})})),v.abrupt("return",m);case 6:case"end":return v.stop()}}),_callee2,this)})))},MsgExtendService}(Wp);!function(t){t[t.ASC=1]="ASC",t[t.DESC=2]="DESC"}(Ny||(Ny={}));var zy,$y={"7_6":"getHistoryMsgs","7_9":"deleteRoamingMsgs","4_24":"syncClearServerHistoryMsgs","7_18":"clearHistoryMsgsFromServer","7_118":"multiSyncClearServerHistoryMsgs","7_26":"nimFtsCloudMsgLogsAggWithSession","7_27":"nimFtsCloudMsgLogs"},Gy={msg:Pm,clearHistoryMsgsFromServerReqTag:{type:0,otherAccid:1,isDeleteRoam:2,toTid:3,isSyncSelf:4,ext:7},clearMsgsParamsWithSync:{type:0,otherAccid:1,isDeleteRoam:2,toTid:3,isSyncSelf:4,fromAccid:5,time:6,ext:7},ftsReqTag:{keyword:1,fromTime:2,toTime:3,sessionLimit:4,msglogsLimit:5,orderRule:6,p2pSessionList:7,teamSessionList:8,senderList:9,msgTypeList:10,msgSubTypeList:11}},Ky=invertSerializeMap(Gy),Wy={deleteRoamingMsgs:{sid:7,cid:9,service:"msgLog",params:[{type:"StrArray",name:"ids"}]},getHistoryMsgs:{sid:7,cid:6,params:[{type:"String",name:"to"},{type:"Long",name:"beginTime"},{type:"Long",name:"endTime"},{type:"Long",name:"lastMsgId"},{type:"int",name:"limit"},{type:"bool",name:"reverse"},{type:"LongArray",name:"msgTypes"}],response:[{type:"PropertyArray",name:"msgs",reflectMapper:Ky.msg}],service:"msgLog"},clearHistoryMsgsFromServer:{sid:7,cid:18,params:[{type:"Property",name:"clearHistoryMsgsFromServerReqTag",reflectMapper:Gy.clearHistoryMsgsFromServerReqTag}],response:[{type:"Long",name:"timetag"}],service:"msgLog"},multiSyncClearServerHistoryMsgs:{sid:7,cid:118,response:[{type:"Property",name:"data",reflectMapper:Ky.clearMsgsParamsWithSync}],service:"msgLog"},syncClearServerHistoryMsgs:{sid:4,cid:24,service:"msgLog",response:[{type:"PropertyArray",name:"datas",reflectMapper:Ky.clearMsgsParamsWithSync}]},nimFtsCloudMsgLogsAggWithSession:{sid:7,cid:26,service:"msgLog",params:[{type:"Property",name:"tag",reflectMapper:Gy.ftsReqTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:Ky.msg}]},nimFtsCloudMsgLogs:{sid:7,cid:27,service:"msgLog",params:[{type:"Property",name:"tag",reflectMapper:Gy.ftsReqTag}],response:[{type:"PropertyArray",name:"datas",reflectMapper:Ky.msg}]}};!function(t){t[t.p2p=1]="p2p",t[t.team=2]="team"}(zy||(zy={}));var Vy={type:{type:"enum",values:zy},isDeleteRoam:{type:"boolean"},isSyncSelf:{type:"boolean"},time:{type:"number"}};function formatClearResult(t){var a=format(Vy,t);return{sessionId:"p2p"===a.type?"p2p-"+a.otherAccid:"team-"+a.toTid,time:a.time}}var Jy={orderRule:{type:"enum",values:Ny}};function generateFtsTagForCmd(t){var a,o=format(Jy,t);zc(o.msgTypeList)&&(o.msgTypeList=map(a=o.msgTypeList).call(a,(function(t){return Dp[t]})).join(","));var c=["p2pSessionList","teamSessionList","senderList","msgSubTypeList"];return forEach$1(c).call(c,(function(t){zc(o[t])&&(o[t]=o[t].join(","))})),o}var Xy=function(t){function MsgLogService(a){var o;return o=t.call(this,"msgLog",a)||this,registerParser({cmdMap:$y,cmdConfig:Wy}),o}_t(MsgLogService,t);var a=MsgLogService.prototype;return a.deleteRoamingMsgs=function deleteRoamingMsgs(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var a,o;return Mo.wrap((function _callee$(c){for(;;)switch(c.prev=c.next){case 0:validate({ids:{type:"array",itemType:"string"}},t),a=[],c.prev=2,a=map(o=t.ids).call(o,(function(t){var a=getAccountFromSessionId(t);return a.scene+"|"+a.accid})),c.next=10;break;case 6:throw c.prev=6,c.t0=c.catch(2),this.logger.error("Failed to delete roaming msgs with "+t.ids,c.t0),new Error("Failed to create session with "+t.ids);case 10:return c.next=12,this.core.sendCmd("deleteRoamingMsgs",{ids:a});case 12:case"end":return c.stop()}}),_callee,this,[[2,6]])})))},a.getHistoryMsgs=function getHistoryMsgs(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var o,c,m,h,v,b,S;return Mo.wrap((function _callee2$(T){for(;;)switch(T.prev=T.next){case 0:return validate({scene:{type:"enum",values:xo(Fd)},to:{type:"string",allowEmpty:!1},beginTime:{type:"number",required:!1},endTime:{type:"number",required:!1},limit:{type:"number",min:1,max:100,required:!1},reverse:{type:"boolean",required:!1},lastMsgId:{type:"string",required:!1,allowEmpty:!1},asc:{type:"boolean",required:!1},msgTypes:{type:"array",itemType:"string",required:!1}},t),c="p2p"===t.scene?"getHistoryMsgs":"team"===t.scene?"getHistoryTeamMsgs":"getHistorySuperTeamMsgs",T.next=4,this.core.sendCmd(c,Ao(Ao({beginTime:0,endTime:0,lastMsgId:0,limit:100,reverse:!1},t),{msgTypes:t.msgTypes?map(o=t.msgTypes).call(o,(function(t){return Ad[t]})):[]}));case 4:if(m=T.sent,(h=m.content).msgs&&h.msgs.length>0){T.next=8;break}return T.abrupt("return",[]);case 8:if(v=getSessionId(h.msgs[0],this.core.account),b=null===(a=this.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:v}),S=formatMsgs(h.msgs,b?{account:this.core.account,sessionAck:b.ack,msgReceiptTime:b.msgReceiptTime}:{account:this.core.account}),!0!==t.asc){T.next=13;break}return T.abrupt("return",sort(S).call(S,(function(t,a){return t.time-a.time})));case 13:return T.abrupt("return",S);case 14:case"end":return T.stop()}}),_callee2,this)})))},a.clearHistoryMsgsFromServer=function clearHistoryMsgsFromServer(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){var a,o,c;return Mo.wrap((function _callee3$(m){for(;;)switch(m.prev=m.next){case 0:return validate({scene:{type:"enum",values:["p2p","team"]},to:{type:"string",allowEmpty:!1},ext:{type:"string",required:!1},isSyncSelf:{type:"boolean",required:!1}},t),(a=Ao(Ao({isDeleteRoam:1},t),{type:"team"===t.scene?2:1,isSyncSelf:!0===t.isSyncSelf?1:0}))[2===a.type?"toTid":"otherAccid"]=t.to,m.next=5,this.core.sendCmd("clearHistoryMsgsFromServer",{clearHistoryMsgsFromServerReqTag:a});case 5:return o=m.sent,c=o.content,this.core.eventBus.emit("session/updateForClearMsg",[{sessionId:t.scene+"-"+t.to}],!0),m.abrupt("return",c);case 9:case"end":return m.stop()}}),_callee3,this)})))},a.multiSyncClearServerHistoryMsgsHandler=function multiSyncClearServerHistoryMsgsHandler(t){var a=formatClearResult(t.content.data);this.core.eventBus.emit("session/updateForClearMsg",[a],!0),this.core.emit("clearServerHistoryMsgs",[a])},a.ftsCloudMsgLogs=function ftsCloudMsgLogs(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee4(){return Mo.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.baseFtsCloudMsgLogs(t,"nimFtsCloudMsgLogs"));case 1:case"end":return a.stop()}}),_callee4,this)})))},a.ftsCloudMsgLogsAggWithSession=function ftsCloudMsgLogsAggWithSession(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee5(){return Mo.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.baseFtsCloudMsgLogs(t,"nimFtsCloudMsgLogsAggWithSession"));case 1:case"end":return a.stop()}}),_callee5,this)})))},a.baseFtsCloudMsgLogs=function baseFtsCloudMsgLogs(t,a){return __awaiter(this,void 0,void 0,Mo.mark((function _callee6(){var o,c,m,h=this;return Mo.wrap((function _callee6$(v){for(;;)switch(v.prev=v.next){case 0:if(validate({keyword:{type:"string",allowEmpty:!1},fromTime:{type:"number",required:!1},toTime:{type:"number",required:!1},sessionLimit:{type:"number",required:!1},msglogsLimit:{type:"number",required:!1},orderRule:{type:"enum",values:getEnumKeys(Ny),required:!1},p2pSessionList:{type:"array",itemType:"string",required:!1},teamSessionList:{type:"array",itemType:"string",required:!1},senderList:{type:"array",itemType:"string",required:!1},msgTypeList:{type:"array",itemType:"enum",values:getEnumKeys(Dp),required:!1},msgSubTypeList:{type:"array",itemType:"number",required:!1}},t),!(t.fromTime&&t.toTime&&t.toTime<t.fromTime)){v.next=3;break}throw new hc("Request parameter error: toTime should be greater than fromTime",t,"");case 3:return c=generateFtsTagForCmd(t),v.next=6,this.core.sendCmd(a,{tag:c});case 6:return m=v.sent,v.abrupt("return",map(o=m.content.datas).call(o,(function(t){var a,o=getSessionId(t,h.core.account),c=null===(a=h.core.session)||void 0===a?void 0:a.getSessionWithUncomplete({id:o});return formatMsg(t,c?{account:h.core.account,sessionAck:c.ack,msgReceiptTime:c.msgReceiptTime}:{account:h.core.account})})));case 8:case"end":return v.stop()}}),_callee6,this)})))},a.syncClearServerHistoryMsgsHandler=function syncClearServerHistoryMsgsHandler(t){var a=function formatClearResults(t){return zc(t)&&t.length>0?map(t).call(t,(function(t){return formatClearResult(t)})):[]}(t.content.datas);this.core.emit("clearServerHistoryMsgs",a)},MsgLogService}(Wp),Yy={"22_1":"requestProxy","22_2":"onRequestProxy"},Qy={requestProxyTag:{zone:1,path:2,method:3,header:4,body:5},requestProxyMsgTag:{from:1,body:2,time:3}},Zy=invertSerializeMap(Qy),eh={requestProxy:{sid:22,cid:1,service:"passThrough",params:[{type:"Property",name:"requestProxyTag",reflectMapper:Qy.requestProxyTag}],response:[{type:"Property",name:"requestProxyTag",reflectMapper:Zy.requestProxyTag}]},onRequestProxy:{sid:22,cid:2,service:"passThrough",response:[{type:"Property",name:"proxyMsg",reflectMapper:Zy.requestProxyMsgTag}]}},th=function(t){function PassThroughService(a){var o;return(o=t.call(this,"passThrough",a)||this).core=a,registerParser({cmdMap:Yy,cmdConfig:eh}),o}_t(PassThroughService,t);var a=PassThroughService.prototype;return a.request=function request(t){return validate({path:{type:"string",allowEmpty:!1}},t),this.core.sendCmd("requestProxy",{requestProxyTag:t}).then((function(t){return t.content.proxyTag}))},a.onRequestProxyHandler=function onRequestProxyHandler(t){var a=t.content.proxyMsg;a&&a.time&&(a.time=+a.time),this.core.emit("proxyMsg",a)},PassThroughService}(Wp),rh=_r.some,nh=arrayMethodIsStrict("some");_export({target:"Array",proto:!0,forced:!nh},{some:function some(t){return rh(this,t,arguments.length>1?arguments[1]:void 0)}});var ih=entryVirtual("Array").some,ah=Array.prototype,some=function(t){var a=t.some;return t===ah||z(ah,t)&&a===ah.some?ih:a},oh=Object.getOwnPropertySymbols?function(t){for(var a=[];t;)Ym(a,ng(t)),t=Jp(t);return a}:Zf;var sh=function nativeKeysIn(t){var a=[];if(null!=t)for(var o in Object(t))a.push(o);return a},ch=Object.prototype.hasOwnProperty;var uh=function baseKeysIn(t){if(!Us(t))return sh(t);var a=wd(t),o=[];for(var c in t)("constructor"!=c||!a&&ch.call(t,c))&&o.push(c);return o};var lh=function keysIn(t){return ll(t)?Td(t,!0):uh(t)};var ph=function getAllKeysIn(t){return Yf(t,lh,oh)};var dh,mh,fh=function pickBy(t,a){if(null==t)return{};var o=Xu(ph(t),(function(t){return[t]}));return a=Ng(a),Km(t,o,(function(t,o){return a(t,o[0])}))},gh={"6_2":"getNosToken","6_22":"getOriginUrl","6_26":"getNosCdnHost","6_27":"getGrayscaleConfig","6_28":"getMixStorePolicy","6_29":"getMixStoreToken","6_30":"getFileAuthToken"},yh={nosToken:{objectName:1,token:2,bucket:3,expireTime:4,expireSec:7,tag:8,shortUrl:9},mixStoreTokenReqTag:{provider:0,tokenCount:1,fileExpireSec:2,tag:3,returnBody:4},nosConfigTag:{bucket:1,cdnDomain:2,expire:3,objectNamePrefix:4},grayConfigTag:{config:0,ttl:1},mixStorePolicyTag:{providers:0,ttl:1,mixEnable:2,nosPolicy:3,s3Policy:4},mixStoreTokenResTag:{provider:0,accessKeyId:1,secretAccessKey:2,sessionToken:3,token:4,expireTime:5,bucket:6,objectName:7,fileExpireSec:8,tag:9,shortUrl:10,region:11},nosSafeUrlTag:{safeUrl:0,originUrl:1},mixStoreAuthTokenReqTag:{type:1,urls:2},mixStoreAuthTokenResTag:{type:1,tokens:2,token:3,ttl:4}},hh=invertSerializeMap(yh),vh={getNosToken:{sid:6,cid:2,service:"cloudStorage",response:[{type:"Property",name:"nosToken",reflectMapper:hh.nosToken}],params:[{type:"String",name:"responseBody"},{type:"Property",name:"nosToken",entity:"nosToken",reflectMapper:yh.nosToken}]},getOriginUrl:{sid:6,cid:22,service:"cloudStorage",response:[{type:"Property",name:"nosSafeUrlTag",reflectMapper:hh.nosSafeUrlTag}],params:[{type:"Property",name:"nosSafeUrlTag",reflectMapper:yh.nosSafeUrlTag}]},getNosCdnHost:{sid:6,cid:26,service:"misc",response:[{type:"Property",name:"nosConfigTag",reflectMapper:hh.nosConfigTag}]},getGrayscaleConfig:{sid:6,cid:27,service:"cloudStorage",response:[{type:"Property",name:"grayConfigTag",reflectMapper:hh.grayConfigTag}],params:[{type:"Property",name:"config"}]},getMixStorePolicy:{sid:6,cid:28,service:"cloudStorage",params:[{type:"LongArray",name:"supportType"}],response:[{type:"Property",name:"mixStorePolicyTag",reflectMapper:hh.mixStorePolicyTag}]},getMixStoreToken:{sid:6,cid:29,service:"cloudStorage",params:[{type:"Property",name:"mixStoreTokenReqTag",reflectMapper:yh.mixStoreTokenReqTag}],response:[{type:"Property",name:"mixStoreTokenResTag",reflectMapper:hh.mixStoreTokenResTag}]},getFileAuthToken:{sid:6,cid:30,service:"cloudStorage",params:[{type:"Property",name:"mixStoreAuthTokenReqTag",reflectMapper:yh.mixStoreAuthTokenReqTag}],response:[{type:"Property",name:"mixStoreAuthTokenResTag",reflectMapper:hh.mixStoreAuthTokenResTag}]}};!function(t){t[t.nos=1]="nos",t[t.s3=2]="s3"}(dh||(dh={})),function(t){t[t.dontNeed=-1]="dontNeed",t[t.time=2]="time",t[t.urls=3]="urls"}(mh||(mh={}));var bh,Sh,Th={chunkUploadHost:"https://wanproxy-web.127.net",commonUploadHost:"https://nos.netease.com",chunkMaxSize:4194304e4,commonMaxSize:104857600,uploadReplaceFormat:"https://{host}/{object}",cdn:{defaultCdnDomain:"nim.nosdn.127.net",cdnDomain:"",bucket:"",objectNamePrefix:""},downloadUrl:"https://{bucket}-nosdn.netease.im/{object}",downloadHostList:["nos.netease.com"],nosCdnEnable:!0,isNeedToGetUploadPolicyFromServer:!0},Mh={file:{md5:"$(Etag)",size:"$(ObjectSize)"},image:{md5:"$(Etag)",size:"$(ObjectSize)",w:"$(ImageInfo.Width)",h:"$(ImageInfo.Height)",orientation:"$(ImageInfo.Orientation)"},audio:{md5:"$(Etag)",size:"$(ObjectSize)",dur:"$(AVinfo.Audio.Duration)"},video:{md5:"$(Etag)",size:"$(ObjectSize)",dur:"$(AVinfo.Video.Duration)",w:"$(AVinfo.Video.Width)",h:"$(AVinfo.Video.Height)"}},wh={accessKeyId:"",secretAccessKey:"",sessionToken:"",region:"",maxRetries:0,bucket:"",objectName:"",token:"",shortUrl:""};function getUploadResponseFormat(t){return void 0===t&&(t="file"),Oo(Mh[t]||{}).replace(/"/gi,'\\"')}!function(t){t[t.nos=1]="nos",t[t.s3=2]="s3"}(bh||(bh={})),function(t){t[t.dontNeed=-1]="dontNeed",t[t.time=2]="time",t[t.urls=3]="urls"}(Sh||(Sh={}));var _h=function(){function CloudStorageService(t,a){void 0===a&&(a={}),this.GRAYKEY="AllGrayscaleConfig",this.MIXSTOREKEY="AllMixStorePolicy",this.config={},this.nosCdnHostTimer=0,this.grayConfig={mixStoreEnable:!1,timeStamp:0,ttl:0},this.mixStorePolicy={providers:[],timeStamp:0,ttl:0,s3Policy:null,nosPolicy:null},this.curProvider=bh.nos,this.s3=null,this.mixStoreErrorCount=10,this.nosErrorCount=0,this.circuitTimer=0,this.name="cloudStorage",this.logger=t.logger,this.core=t,registerParser({cmdMap:gh,cmdConfig:vh}),this.setOptions(a)}var t=CloudStorageService.prototype;return t.setOptions=function setOptions(t){void 0===t&&(t={});var a=t.storageKeyPrefix||"NIMClient";this.GRAYKEY=a+"-AllGrayscaleConfig",this.MIXSTOREKEY=a+"-AllMixStorePolicy";var o=t.s3,c=__rest(t,["s3"]),m=Ao({},Th,this.config);if(c&&Object.prototype.hasOwnProperty.call(c,"cdn")){var h={cdn:Ao(Ao({},m.cdn),c.cdn)};this.config=Ao({},m,c,h)}else this.config=Ao({},m,c);o&&(this.s3=o)},t.init=function init(){return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){return Mo.wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:if(this.grayConfig=null,this.mixStorePolicy={providers:[],timeStamp:0,ttl:0,s3Policy:null,nosPolicy:null},this.curProvider=bh.nos,this.mixStoreErrorCount=10,!this.config.isNeedToGetUploadPolicyFromServer){t.next=9;break}return t.next=7,this.getGrayscaleConfig(this.core.options.appkey);case 7:return t.next=9,this.getNosCdnHost();case 9:case"end":return t.stop()}}),_callee,this)})))},t.uploadFile=function uploadFile(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var a,o,c;return Mo.wrap((function _callee2$(m){for(;;)switch(m.prev=m.next){case 0:if(validate({maxSize:{type:"number",required:!1},type:{type:"enum",values:["file","image","audio","video"]}},t),t.fileInput||t.file||t.filePath){m.next=3;break}throw new Error("uploadFile needs target file object or a filePath");case 3:if(!t.type||"file"===t.type){m.next=7;break}if("string"!=typeof(a=kp(t,"file.type"))||-1!==indexOf(a).call(a,t.type)){m.next=7;break}throw new Error('The meta type "'+a+'" does not match "'+t.type+'"');case 7:if(this.grayConfig&&this.grayConfig.mixStoreEnable&&this.mixStorePolicy.providers.length){m.next=10;break}return this.logger.log("uploadFile:: uploadFile begin, use old nos"),m.abrupt("return",this.nosUpload(t));case 10:return this.logger.log("uploadFile:: uploadFile begin,Current settings grayConfig mixStoreEnable:"+this.grayConfig.mixStoreEnable+" curProvider:"+this.curProvider),this.s3||(this.curProvider=bh.nos),o=wh,m.prev=13,m.next=16,this.core.sendCmd("getMixStoreToken",{mixStoreTokenReqTag:{provider:this.curProvider,tokenCount:1,tag:"qchat",returnBody:getUploadResponseFormat(t.type)}});case 16:c=m.sent,o=c.content.mixStoreTokenResTag,m.next=24;break;case 20:throw m.prev=20,m.t0=m.catch(13),this.core.logger.error("uploadFile:: getMixStoreToken error",m.t0),new Tc("getMixStoreToken error",m.t0,this.curProvider,this.mixStorePolicy);case 24:return m.abrupt("return",this.curProvider===bh.s3?this.s3Upload(t,o):this.nosUpload(t,o));case 25:case"end":return m.stop()}}),_callee2,this,[[13,20]])})))},t.nosUpload=function nosUpload(t,a){var o,c;return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){var m,h,v,b,S,T,M,w,_,x,k,I,C;return Mo.wrap((function _callee3$(E){for(;;)switch(E.prev=E.next){case 0:if(m=kp(this.core,"config.cdn.bucket"),h={tag:t.nosScenes||m||"nim",expireSec:t.nosSurvivalTime},a){E.next=13;break}return E.prev=3,E.next=6,this.core.sendCmd("getNosToken",{responseBody:getUploadResponseFormat(t.type),nosToken:h});case 6:v=E.sent,E.next=13;break;case 9:throw E.prev=9,E.t0=E.catch(3),this.core.logger.error("uploadFile:: getNosToken error",E.t0),new Tc("getNosToken error",E.t0,1);case 13:return E.prev=13,S=v?v.content.nosToken:a,this.core.logger.debug("uploadFile:: uploadFile params",{nosToken:S,chunkUploadHost:this.config.chunkUploadHost,commonUploadHost:this.config.commonUploadHost,platform:Ic.platform}),E.next=18,this.core.adapters.uploadFile(Ao(Ao({},t),{nosToken:S,chunkUploadHost:this.config.chunkUploadHost,commonUploadHost:this.config.commonUploadHost,maxSize:t.maxSize||this.config.chunkMaxSize}));case 18:b=E.sent,E.next=42;break;case 21:if(E.prev=21,E.t1=E.catch(13),this.core.logger.error("uploadFile::nos uploadFile error",E.t1),!a){E.next=41;break}if(0!==this.nosErrorCount){E.next=37;break}E.prev=26,this._addCircuitTimer(),E.next=33;break;case 30:throw E.prev=30,E.t2=E.catch(26),new Tc("upload file error",E.t2,this.curProvider,this.mixStorePolicy,t.file||t.filePath);case 33:return this.nosErrorCount=null===(o=this.mixStorePolicy.nosPolicy)||void 0===o?void 0:o.uploadConfig.retryPolicy.retry,E.abrupt("return",this.uploadFile(t));case 37:return this.nosErrorCount--,E.abrupt("return",this.nosUpload(t,a));case 39:E.next=42;break;case 41:throw new Tc("nos uploadFile error",E.t1,1);case 42:if(T=null==b?void 0:b.type,M=T&&indexOf(T).call(T,"/")>-1?slice(T).call(T,0,indexOf(T).call(T,"/")):"",w={image:"imageInfo",video:"vinfo",audio:"vinfo"},_=this.config.uploadReplaceFormat.replace("{host}",this.config.cdn.cdnDomain||this.config.cdn.defaultCdnDomain).replace("{object}",v?v.content.nosToken.objectName:null==a?void 0:a.objectName),a&&a.shortUrl&&(_=a.shortUrl),w[M]){E.next=49;break}return E.abrupt("return",Ao({url:_},b));case 49:if(E.prev=49,!(indexOf(_).call(_,"_im_url=1")<0)){E.next=54;break}return E.next=53,this.core.adapters.request(_+"?"+w[M],{method:"GET",dataType:"json",timeout:5e3});case 53:x=E.sent;case 54:E.next=60;break;case 56:return E.prev=56,E.t3=E.catch(49),this.core.logger.error("uploadFile:: fetch file info error",E.t3),E.abrupt("return",Ao({url:_},b));case 60:if(!x){E.next=67;break}return k=x.data,I="imageInfo"===w[M]?k:null===(c=null==k?void 0:k.GetVideoInfo)||void 0===c?void 0:c.VideoInfo,C={url:_,name:b.name,size:b.size,ext:b.ext,w:I.Width,h:I.Height,orientation:I.Orientation,dur:I.Duration,audioCodec:I.AudioCodec,videoCodec:I.VideoCodec,container:I.Container},E.abrupt("return",fh(C,(function(t,a){return void 0!==a})));case 67:return E.abrupt("return",Ao({url:_},b));case 68:case"end":return E.stop()}}),_callee3,this,[[3,9],[13,21],[26,30],[49,56]])})))},t.getNosCdnHost=function getNosCdnHost(){var t;return __awaiter(this,void 0,void 0,Mo.mark((function _callee4(){var a,o,c,m=this;return Mo.wrap((function _callee4$(h){for(;;)switch(h.prev=h.next){case 0:return h.prev=0,h.next=3,this.core.sendCmd("getNosCdnHost");case 3:a=h.sent,h.next=10;break;case 6:return h.prev=6,h.t0=h.catch(0),this.logger.error("getNosCdnHost::error",h.t0),h.abrupt("return");case 10:if(a){h.next=12;break}return h.abrupt("return");case 12:o=null===(t=null==a?void 0:a.content)||void 0===t?void 0:t.nosConfigTag,0!==(c=Bl(null==o?void 0:o.expire))&&o.cdnDomain?-1===c?(this.config.cdn.bucket=o.bucket,this.config.cdn.cdnDomain=o.cdnDomain,this.config.cdn.objectNamePrefix=o.objectNamePrefix):(this.config.cdn.bucket=o.bucket,this.config.cdn.cdnDomain=o.cdnDomain,this.config.cdn.objectNamePrefix=o.objectNamePrefix,this.nosCdnHostTimer=this.core.timerManager.addTimer((function(){m.getNosCdnHost()}),1e3*c)):(this.config.cdn.bucket="",this.config.cdn.cdnDomain="",this.config.cdn.objectNamePrefix="");case 15:case"end":return h.stop()}}),_callee4,this,[[0,6]])})))},t.getGrayscaleConfig=function getGrayscaleConfig(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee5(){var o,c;return Mo.wrap((function _callee5$(m){for(;;)switch(m.prev=m.next){case 0:if(Ic.localStorage)try{Ic.localStorage.getItem&&Ic.localStorage.getItem(this.GRAYKEY)&&(this.grayConfig=JSON.parse(Ic.localStorage.getItem(this.GRAYKEY))[t])}catch(t){Ic.localStorage.getItem(this.GRAYKEY)&&this.core.logger.error("uploadFile:: JSON.parse grayscaleConfig error ",t)}if(this.grayConfig&&!(this.grayConfig.timeStamp+1e3*this.grayConfig.ttl<(new Date).getTime())){m.next=17;break}return m.next=4,this.core.sendCmd("getGrayscaleConfig",{config:{}});case 4:if(!(o=m.sent).content||!o.content.grayConfigTag){m.next=16;break}this.logger.log("uploadFile::getAppGrayConfigRequest success ");try{this.grayConfig=JSON.parse(o.content.grayConfigTag.config),this.grayConfig.ttl=JSON.parse(o.content.grayConfigTag.ttl)}catch(t){this.logger.error("getGrayscaleConfig error",t)}if(this.grayConfig){m.next=10;break}return m.abrupt("return");case 10:c=Ic.localStorage.getItem(this.GRAYKEY)?JSON.parse(Ic.localStorage.getItem(this.GRAYKEY)):{},this.grayConfig.timeStamp=(new Date).getTime(),c[t]=this.grayConfig,Ic.localStorage.setItem(this.GRAYKEY,Oo(c)),m.next=17;break;case 16:this.logger.debug("uploadFile:: result grayConfig:",o.content);case 17:if(!(null===(a=this.grayConfig)||void 0===a?void 0:a.mixStoreEnable)){m.next=20;break}return m.next=20,this._getMixStorePolicy(t);case 20:case"end":return m.stop()}}),_callee5,this)})))},t._getMixStorePolicy=function _getMixStorePolicy(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee6(){var a,o,c,m,h,v,b;return Mo.wrap((function _callee6$(S){for(;;)switch(S.prev=S.next){case 0:if(a=(new Date).getTime(),Ic.localStorage)try{this.mixStorePolicy=JSON.parse(Ic.localStorage.getItem(this.MIXSTOREKEY))[t],this.curProvider=Bl(this.mixStorePolicy.providers[0]),this.mixStorePolicy.timeStamp&&this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl>a&&(c=this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl-a,this.core.timerManager.addTimer(bind$1(o=this._getMixStorePolicy).call(o,this,t),c))}catch(a){Ic.localStorage.getItem(this.MIXSTOREKEY)&&JSON.parse(Ic.localStorage.getItem(this.MIXSTOREKEY))[t]&&this.core.logger.error("uploadFile:: JSON.parse mixStorePolicy error ",a)}if(this.mixStorePolicy&&!(this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl<=a)){S.next=30;break}return S.prev=3,S.next=6,this.core.sendCmd("getMixStorePolicy",{supportType:this.s3?[1,2]:[1]});case 6:h=S.sent,v=h.content.mixStorePolicyTag,this.mixStorePolicy={providers:[],timeStamp:0,ttl:0,s3Policy:null,nosPolicy:null},this.mixStorePolicy.ttl=Number(v.ttl),this.mixStorePolicy.providers=v.providers.split(","),this.circuitTimer&&this.core.timerManager.deleteTimer(this.circuitTimer),this.curProvider=Bl(this.mixStorePolicy.providers[0]),this.mixStorePolicy.nosPolicy=v.nosPolicy?JSON.parse(v.nosPolicy):null,this.mixStorePolicy.s3Policy=v.s3Policy?JSON.parse(v.s3Policy):null,null===this.mixStorePolicy.s3Policy?this.mixStorePolicy.providers=["1"]:null===this.mixStorePolicy.nosPolicy?this.mixStorePolicy.providers=["2"]:this.mixStorePolicy.providers=this.mixStorePolicy.s3Policy.priority<this.mixStorePolicy.nosPolicy.priority?["2","1"]:["1","2"],this.core.timerManager.addTimer(bind$1(m=this._getMixStorePolicy).call(m,this,t),1e3*this.mixStorePolicy.ttl),b=Ic.localStorage.getItem(this.MIXSTOREKEY)?JSON.parse(Ic.localStorage.getItem(this.MIXSTOREKEY)):{},this.mixStorePolicy.timeStamp=(new Date).getTime(),b[t]=this.mixStorePolicy,Ic.localStorage.setItem(this.MIXSTOREKEY,Oo(b)),S.next=30;break;case 23:if(S.prev=23,S.t0=S.catch(3),this.logger.error("getMixStorePolicy error",S.t0),0!==this.mixStoreErrorCount){S.next=28;break}throw new Error("getMixStorePolicy all count error");case 28:this._getMixStorePolicy(t),this.mixStoreErrorCount--;case 30:this.mixStorePolicy.nosPolicy&&(this.nosErrorCount=this.mixStorePolicy.nosPolicy.uploadConfig.retryPolicy.retry);case 31:case"end":return S.stop()}}),_callee6,this,[[3,23]])})))},t.s3Upload=function s3Upload(t,a){return __awaiter(this,void 0,void 0,Mo.mark((function _callee7(){var o,c,m,h,v,b,S,T,M,w,_=this;return Mo.wrap((function _callee7$(x){for(;;)switch(x.prev=x.next){case 0:if(!t.file){x.next=4;break}o=t.file,x.next=19;break;case 4:if("string"!=typeof t.fileInput){x.next=14;break}if(this.logger.warn("fileInput will abandon,Please use file or filepath"),!((c=document.getElementById(t.fileInput))&&c.files&&c.files[0])){x.next=11;break}o=c.files[0],x.next=12;break;case 11:throw new Error("Can not get file from fileInput");case 12:x.next=19;break;case 14:if(!(t.fileInput&&t.fileInput.files&&t.fileInput.files[0])){x.next=18;break}o=t.fileInput.files[0],x.next=19;break;case 18:throw new Error("Can not get file from fileInput "+t.fileInput);case 19:if(this.mixStorePolicy.s3Policy){x.next=21;break}throw new Error("dont get s3 policy");case 21:return m={accessKeyId:a.accessKeyId,secretAccessKey:a.secretAccessKey,sessionToken:a.sessionToken,region:a.region,maxRetries:this.mixStorePolicy.s3Policy.uploadConfig.retryPolicy.retry},h=this.s3,(v=new h).config.update(m),b=decodeURIComponent(a.bucket),S=decodeURIComponent(a.objectName),M={Bucket:b,Key:S,Body:T=o,Metadata:{token:a.token},ContentType:T.type||"application/octet-stream"},this.core.logger.debug("uploadFile:: s3 upload params:",M),w=v.upload(M),x.abrupt("return",new co((function(o){var c=(new Date).getTime();w.send((function(m,h){var v,b;if(m){_.logger.error("uploadFile:","api::s3:upload file failed",m),_.core.reporter.reportTraceStart("exceptions",{user_id:_.core.options.account,trace_id:null===(b=null===(v=_.core)||void 0===v?void 0:v.socket)||void 0===b?void 0:b.sessionId,start_time:c,action:1}),_.core.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof m.status?m.status:"number"==typeof m.code?m.code:0,description:m.message||""+m.code,operation_type:1,target:m.hostname}),_.core.reporter.reportTraceEnd("exceptions",1);try{_._addCircuitTimer()}catch(m){throw new Tc("upload file error",m,_.curProvider,_.mixStorePolicy,t.file||t.filePath)}o(_.uploadFile(t))}else{var S=_.mixStorePolicy.s3Policy.cdnSchema;S=(S=S.replace("{cdnDomain}",_.mixStorePolicy.s3Policy.dlcdn)).replace("{objectName}",h.Key),o({size:T.size,name:T.name,url:a.shortUrl?a.shortUrl:S,ext:T.name.split(".")[1]||"unknown"})}}))})));case 32:case"end":return x.stop()}}),_callee7,this)})))},t.getPrivateUrl=function getPrivateUrl(t){var a;if(!new RegExp(/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/).test(t))return this.logger.error("illegal file url:"+t),"";var o=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.exec(t);o[0];var c=o[1];o[2];var m=o[3];o[4];var h=o[5];if(o[6],o[7],null===(a=this.grayConfig)||void 0===a?void 0:a.mixStoreEnable){var v=this._getUrlType(t);return v===bh.s3&&this.mixStorePolicy.s3Policy&&(t=this.mixStorePolicy.s3Policy.cdnSchema.replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn).replace("{objectName}",h)),v===bh.nos&&this.mixStorePolicy.nosPolicy&&(t=this.mixStorePolicy.nosPolicy.cdnSchema.replace("{cdnDomain}",this.mixStorePolicy.nosPolicy.dlcdn).replace("{objectName}",h)),t}var b=this.config,S=b.downloadUrl,T=b.downloadHostList,M=b.nosCdnEnable,w=this.config.cdn.cdnDomain,_=this.config.cdn.objectNamePrefix?decodeURIComponent(this.config.cdn.objectNamePrefix):"",x=decodeURIComponent(h),k=indexOf(x).call(x,_);if(w&&k>-1&&M)return""+c+w+"/"+slice(x).call(x,k);if(includes(T).call(T,m)&&includes(h).call(h,"/")){var I=indexOf(h).call(h,"/"),C=h.substring(0,I),E=h.substring(I+1);return S.replace("{bucket}",C).replace("{object}",E)}var A=filter(T).call(T,(function(t){return"string"==typeof m&&includes(m).call(m,t)}))[0],P=A?m.replace(A,"").replace(/\W/g,""):null;return P?S.replace("{bucket}",P).replace("{object}",h):t},t.getOriginUrl=function getOriginUrl(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee8(){var a;return Mo.wrap((function _callee8$(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this.core.sendCmd("getOriginUrl",{nosSafeUrlTag:{safeUrl:t}});case 2:return a=o.sent,o.abrupt("return",a.content.nosSafeUrlTag.originUrl);case 4:case"end":return o.stop()}}),_callee8,this)})))},t.getFileToken=function getFileToken(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee9(){var a,o,c,m,h,v=this;return Mo.wrap((function _callee9$(b){for(;;)switch(b.prev=b.next){case 0:if(validate({type:{type:"number",min:2,max:3},urls:{type:"array",required:!1,itemType:"string"}},t),a=this.mixStorePolicy.nosPolicy?this.mixStorePolicy.nosPolicy.authPolicy.policyType:null,o=this.mixStorePolicy.s3Policy?this.mixStorePolicy.s3Policy.authPolicy.policyType:null,a!==String(Sh.dontNeed)||o!==String(Sh.dontNeed)){b.next=8;break}throw this.logger.error("don't need token"),new Error("don't need token");case 8:if(t.type!==Sh.time){b.next=17;break}if(!(a&&indexOf(a).call(a,String(Sh.time))>=0||o&&indexOf(o).call(o,String(Sh.time))>0)){b.next=13;break}return b.abrupt("return",this.getFileAuthToken(t));case 13:throw this.logger.error("don't support time token "),new Error("don't support type time token ");case 15:b.next=33;break;case 17:if(t.urls&&t.urls.length){b.next=20;break}throw this.logger.error("urls is required when urls token"),new Error("urls is required when urls token");case 20:if(m=[],h=[],forEach$1(c=t.urls).call(c,(function(t){var a=v._getUrlType(t);a===bh.nos&&h.push(t),a===bh.s3&&m.push(t)})),(!o||0!==m.length&&indexOf(o).call(o,String(Sh.urls))<0)&&(this.logger.warn("s3 url don't support url token"),m=[]),(!a||0!==h.length&&indexOf(a).call(a,String(Sh.urls))<0)&&(this.logger.warn("nos url don't support url token"),h=[]),0!==m.length||0!==h.length){b.next=30;break}throw this.logger.error("not support urls"),new Error("not support urls");case 30:if(0!==m.length&&0!==h.length){b.next=33;break}return t.urls=Oo(t.urls),b.abrupt("return",this.getFileAuthToken(t));case 33:case"end":return b.stop()}}),_callee9,this)})))},t.getFileAuthToken=function getFileAuthToken(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee10(){var a;return Mo.wrap((function _callee10$(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this.core.sendCmd("getFileAuthToken",{mixStoreAuthTokenReqTag:t});case 2:return a=o.sent,o.abrupt("return",a.content.mixStoreAuthTokenResTag);case 4:case"end":return o.stop()}}),_callee10,this)})))},t._getUrlType=function _getUrlType(t){var a,o;return this.mixStorePolicy.nosPolicy&&some(a=this.mixStorePolicy.nosPolicy.dlcdns).call(a,(function(a){return indexOf(t).call(t,a)>=0}))?bh.nos:this.mixStorePolicy.s3Policy&&some(o=this.mixStorePolicy.s3Policy.dlcdns).call(o,(function(a){return indexOf(t).call(t,a)>=0}))?bh.s3:null},t._addCircuitTimer=function _addCircuitTimer(){var t=this,a=this.mixStorePolicy.providers,o=a[(indexOf(a).call(a,String(this.curProvider))+1)%a.length];if(o===a[0])throw new Error("uploadFile all policy fail");var c=kp(this.mixStorePolicy,"s3Policy.uploadConfig.retryPolicy");if(c&&c.retryNext&&o&&(this.logger.log("uploadFile:: upload policy will change,now policy:"+this.curProvider+" nextProvider:"+o),this.curProvider=Bl(o),this.mixStorePolicy.nosPolicy&&this.mixStorePolicy.s3Policy)){var m=this.mixStorePolicy[this.curProvider===bh.nos?"nosPolicy":"s3Policy"].uploadConfig.retryPolicy.circuit;if(!m||0===m)return;this.circuitTimer=this.core.timerManager.addTimer((function(){t.logger.log("uploadFile:: upload policy will change,now policy:"+t.curProvider+" nextProvider:"+Bl(t.mixStorePolicy.providers[0])),t.curProvider=Bl(t.mixStorePolicy.providers[0]),t.core.timerManager.deleteTimer(t.circuitTimer)}),1e3*m)}},t.process=function process(t){var a=this[t.cmd+"Handler"];return"function"==typeof a?a.call(this,t):t.error&&!t.error.ignore?co.reject(t.error):co.resolve(t)},CloudStorageService}(),xh=Rd({none:0,normal:1,all:3}),kh=Rd({normal:0,advanced:1}),Ih=Rd({normal:0,owner:1,manager:2}),Ch={noVerify:0,needVerify:1,rejectAll:2},Eh=Rd(Ch),Ah={needVerify:0,noVerify:1},Ph=Rd(Ah),Oh={manager:0,all:1},Rh=Rd(Oh),jh={manager:0,all:1},Fh=Rd(jh),Lh={manager:0,all:1},Nh=Rd(Lh);function formatSuperTeam(t){var a,o=["teamId"],c=["level","memberNum","memberUpdateTime","createTime","updateTime"],m=["valid","validToCurrentUser","mute"],h={type:kh,muteType:xh,joinMode:Eh,beInviteMode:Ph,inviteMode:Rh,updateTeamMode:Fh,updateExtMode:Nh};t.bits;var v=__rest(t,["bits"]);return forEach$1(o).call(o,(function(t){v[t]&&(v[t]=v[t].toString())})),forEach$1(c).call(c,(function(t){void 0!==v[t]&&(v[t]=Bl(v[t]))})),forEach$1(m).call(m,(function(t){void 0!==v[t]&&(v[t]=1===Bl(v[t]))})),forEach$1(a=xo(h)).call(a,(function(t){void 0!==v[t]&&(v[t]=h[t][v[t]]||v[t])})),v}function formatSuperTeams(t){return t&&t.length>0?map(t).call(t,(function(t){return formatSuperTeam(t)})):[]}function generateSuperTeam(t){var a,o=Ao({},t),c=["avatar","name","intro","announcement","ext"],m={joinMode:Ch,beInviteMode:Ah,inviteMode:Oh,updateTeamMode:jh,updateExtMode:Lh};return forEach$1(c).call(c,(function(t){void 0!==o[t]&&(o[t]=o[t].toString())})),forEach$1(a=xo(m)).call(a,(function(t){void 0!==o[t]&&(o[t]=m[t][o[t]])})),o}function generatorSuperTeamMemberForCmd(t){var a=["teamId","ext","account","nickInTeam"],o={};return void 0!==t.bitConfigMask&&(o.bits=Bl(t.bitConfigMask)),forEach$1(a).call(a,(function(a){t[a]&&(o[a]=t[a].toString())})),o}function formatSuperTeamMember(t){var a,o=["teamId"],c=["joinTime","updateTime","bitConfigMask"],m=["active","valid","mute"],h={type:Ih},v=t.bits,b=__rest(t,["bits"]);return void 0!==v&&(b.muteTeam=1===Bl(v),b.bitConfigMask=v),b.id=b.teamId+"-"+b.account,forEach$1(o).call(o,(function(t){b[t]&&(b[t]=b[t].toString())})),forEach$1(c).call(c,(function(t){void 0!==b[t]&&(b[t]=Bl(b[t]))})),forEach$1(m).call(m,(function(t){void 0!==b[t]&&(b[t]=1===Bl(b[t]))})),forEach$1(a=xo(h)).call(a,(function(t){void 0!==b[t]&&(b[t]=h[t][b[t]]||b[t])})),b}function formatSuperTeamMembers(t){return t&&t.length>0?map(t).call(t,(function(t){return formatSuperTeamMember(t)})):[]}function generatorMemberBySuperTeam(t,a,o){return void 0===o&&(o="normal"),{id:t.teamId+"-"+a,teamId:t.teamId,account:a,type:o,nickInTeam:"",muteTeam:!1,mute:!1,joinTime:t.memberUpdateTime,updateTime:t.memberUpdateTime,active:!0,valid:!0}}function generatorMembersBySuperTeam(t,a,o){return void 0===o&&(o="normal"),a&&a.length>0?map(a).call(a,(function(a){return generatorMemberBySuperTeam(t,a,o)})):[]}var Uh,Bh,qh,Dh=function(){function ModuleService(t){this.core=t}var t=ModuleService.prototype;return t.notifyAddSuperTeamMembers=function notifyAddSuperTeamMembers(t,a){this.core.emit("addSuperTeamMembers",{team:t,accounts:a,members:generatorMembersBySuperTeam(t,a)})},t.notifyUpdateSuperTeamManagers=function notifyUpdateSuperTeamManagers(t,a,o,c){this.core.emit("updateSuperTeamManagers",{team:{teamId:t,memberUpdateTime:c},accounts:a,isManager:o,members:map(a).call(a,(function(a){return{id:t+"-"+a,type:"manager",account:a,updateTime:c}}))})},t.notifyRemoveSuperTeamMembers=function notifyRemoveSuperTeamMembers(t,a){this.core.emit("removeSuperTeamMembers",{team:t,accounts:a})},t.notifyTransferSuperTeam=function notifyTransferSuperTeam(t,a,o){this.core.emit("transferSuperTeam",{team:t,from:{id:t.teamId+"-"+a,account:a,type:"normal",updateTime:t.memberUpdateTime},to:{id:t.teamId+"-"+o,account:o,type:"owner",updateTime:t.memberUpdateTime}})},t.notifyUpdateSuperTeamMembersMute=function notifyUpdateSuperTeamMembersMute(t,a,o){this.core.emit("updateSuperTeamMembersMute",{team:t,accounts:a,members:map(a).call(a,(function(a){return{id:t.teamId+"-"+a,account:a,teamId:t.teamId,mute:o,updateTime:t.memberUpdateTime}})),mute:o})},ModuleService}(),Hh={"21_5":"addSuperTeamMembers","21_6":"removeSuperTeamMembers","21_7":"leaveSuperTeam","21_8":"updateSuperTeamInfo","21_9":"getSuperTeamInfo","21_12":"getSuperTeams","21_15":"getSuperTeamMembers","21_10":"updateMySuperTeamMemberInfo","21_20":"applySuperTeam","21_21":"passSuperTeamApply","21_22":"rejectSuperTeamApply","21_23":"acceptSuperTeamInvite","21_24":"rejectSuperTeamInvite","21_26":"addSuperTeamManagers","21_27":"removeSuperTeamManagers","21_28":"muteSuperTeam","21_29":"muteSuperTeamMembers","21_30":"updateSuperTeamMemberNick","21_31":"transferSuperTeam","21_33":"getSuperTeamMembersByAccounts","21_34":"queryMuteSuperTeamMembers","21_101":"syncCreateSuperTeam","21_109":"syncSuperTeams","21_110":"syncUpdateSuperTeamMember"},zh={superTeam:{teamId:1,name:3,type:4,owner:5,level:6,selfCustom:7,valid:8,memberNum:9,memberUpdateTime:10,createTime:11,updateTime:12,validToCurrentUser:13,intro:14,announcement:15,joinMode:16,bits:17,ext:18,serverExt:19,avatar:20,beInviteMode:21,inviteMode:22,updateTeamMode:23,updateExtMode:24,mute:100,muteType:101},superTeamMember:{teamId:1,account:3,type:4,nickInTeam:5,bits:7,active:8,valid:9,updateTime:11,ext:12,mute:13,invitorAccid:14,joinTime:15}},$h=invertSerializeMap(zh),Gh={getSuperTeamInfo:{sid:21,cid:9,service:"superTeam",params:[{type:"Long",name:"teamId"}],response:[{type:"Property",name:"superTeam",reflectMapper:$h.superTeam}]},getSuperTeams:{sid:21,cid:12,service:"superTeam",params:[{type:"long",name:"timetag"}],response:[{type:"PropertyArray",name:"superTeams",reflectMapper:$h.superTeam},{type:"Number",name:"timetag"}]},updateSuperTeamInfo:{sid:21,cid:8,service:"superTeam",params:[{type:"Property",name:"superTeam",reflectMapper:zh.superTeam}],response:[{type:"Number",name:"time"}]},addSuperTeamMembers:{sid:21,cid:5,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"},{type:"String",name:"ps"}],response:[{type:"StrArray",name:"abortedAccidList"},{type:"Long",name:"time"}]},removeSuperTeamMembers:{sid:21,cid:6,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},addSuperTeamManagers:{sid:21,cid:26,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},removeSuperTeamManagers:{sid:21,cid:27,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"}]},applySuperTeam:{sid:21,cid:20,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"ps"}],response:[{type:"Property",name:"superTeam",reflectMapper:$h.superTeam}]},transferSuperTeam:{sid:21,cid:31,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"account"},{type:"bool",name:"leave"}]},muteSuperTeam:{sid:21,cid:28,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"Int",name:"mute"}]},muteSuperTeamMembers:{sid:21,cid:29,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"StrArray",name:"accounts"},{type:"Int",name:"mute"}]},updateSuperTeamMemberNick:{sid:21,cid:30,service:"superTeam",params:[{type:"Property",name:"teamMember",reflectMapper:zh.superTeamMember}]},updateMySuperTeamMemberInfo:{sid:21,cid:10,service:"superTeam",params:[{type:"Property",name:"teamMember",reflectMapper:zh.superTeamMember}]},getSuperTeamMembersByAccounts:{sid:21,cid:33,service:"superTeam",params:[{type:"StrArray",name:"memberIds"}],response:[{type:"PropertyArray",name:"superTeamMembers",reflectMapper:$h.superTeamMember}]},getSuperTeamMembers:{sid:21,cid:15,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"Long",name:"joinTime"},{type:"Int",name:"limit"},{type:"Bool",name:"reverse"}],response:[{type:"PropertyArray",name:"superTeamMembers",reflectMapper:$h.superTeamMember}]},queryMuteSuperTeamMembers:{sid:21,cid:34,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"Long",name:"joinTime"},{type:"Int",name:"limit"},{type:"Bool",name:"reverse"}],response:[{type:"PropertyArray",name:"superTeamMembers",reflectMapper:$h.superTeamMember}]},leaveSuperTeam:{sid:21,cid:7,service:"superTeam",params:[{type:"Long",name:"teamId"}]},passSuperTeamApply:{sid:21,cid:21,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}]},rejectSuperTeamApply:{sid:21,cid:22,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},acceptSuperTeamInvite:{sid:21,cid:23,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"}]},rejectSuperTeamInvite:{sid:21,cid:24,service:"superTeam",params:[{type:"Long",name:"teamId"},{type:"String",name:"from"},{type:"String",name:"ps"}]},syncSuperTeams:{sid:21,cid:109,service:"superTeam",response:[{type:"PropertyArray",name:"teams",reflectMapper:$h.superTeam},{type:"Bool",name:"isAll"},{type:"Long",name:"timetag"}]},syncCreateSuperTeam:{sid:21,cid:101,service:"superTeam",response:[{type:"Property",name:"superTeam",reflectMapper:$h.superTeam}]},syncUpdateSuperTeamMember:{sid:21,cid:110,service:"superTeam",response:[{type:"Property",name:"teamMember",reflectMapper:$h.superTeamMember}]}},Kh=function(t){function SuperTeamService(a){var o;return(o=t.call(this,"superTeam",a)||this).service=new Dh(a),registerParser({cmdMap:Hh,cmdConfig:Gh}),o.core.eventBus.on("team/onNotification",(function(t){return o.notificationHandler(t)})),o}_t(SuperTeamService,t);var a=SuperTeamService.prototype;return a.getSuperTeamInfo=function getSuperTeamInfo(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var a,o;return Mo.wrap((function _callee$(c){for(;;)switch(c.prev=c.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),c.next=3,this.core.sendCmd("getSuperTeamInfo",{teamId:t.teamId});case 3:return a=c.sent,o=a.content.superTeam,c.abrupt("return",formatSuperTeam(o));case 6:case"end":return c.stop()}}),_callee,this)})))},a.getSuperTeams=function getSuperTeams(){return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var t,a;return Mo.wrap((function _callee2$(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this.core.sendCmd("getSuperTeams",{timetag:0});case 2:return t=o.sent,a=t.content.superTeams,o.abrupt("return",formatSuperTeams(a));case 5:case"end":return o.stop()}}),_callee2,this)})))},a.updateSuperTeamInfo=function updateSuperTeamInfo(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){var a;return Mo.wrap((function _callee3$(o){for(;;)switch(o.prev=o.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},name:{type:"string",allowEmpty:!1,required:!1},joinMode:{type:"enum",values:["noVerify","needVerify","rejectAll"],required:!1},beInviteMode:{type:"enum",values:["noVerify","needVerify"],required:!1},inviteMode:{type:"enum",values:["manager","all"],required:!1},updateTeamMode:{type:"enum",values:["manager","all"],required:!1},updateExtMode:{type:"enum",values:["manager","all"],required:!1},intro:{type:"string",allowEmpty:!1,required:!1},announcement:{type:"string",allowEmpty:!1,required:!1},avatar:{type:"string",allowEmpty:!1,required:!1},ext:{type:"string",allowEmpty:!1,required:!1}},t),a=generateSuperTeam(t),o.next=4,this.core.sendCmd("updateSuperTeamInfo",{superTeam:a});case 4:return o.abrupt("return",formatSuperTeam(a));case 5:case"end":return o.stop()}}),_callee3,this)})))},a.addSuperTeamMembers=function addSuperTeamMembers(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee4(){return Mo.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",min:1},ps:{type:"string",allowEmpty:!0,max:5e3,required:!1}},t),a.next=3,this.core.sendCmd("addSuperTeamMembers",{teamId:t.teamId,accounts:t.accounts,ps:t.ps||"",attach:t.ext||""});case 3:case"end":return a.stop()}}),_callee4,this)})))},a.removeSuperTeamMembers=function removeSuperTeamMembers(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee5(){return Mo.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",min:1}},t),a.next=3,this.core.sendCmd("removeSuperTeamMembers",{teamId:t.teamId,accounts:t.accounts});case 3:case"end":return a.stop()}}),_callee5,this)})))},a.addSuperTeamManagers=function addSuperTeamManagers(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee6(){return Mo.wrap((function _callee6$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",min:1,itemType:"string"}},t),a.next=3,this.core.sendCmd("addSuperTeamManagers",t);case 3:case"end":return a.stop()}}),_callee6,this)})))},a.removeSuperTeamManagers=function removeSuperTeamManagers(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee7(){return Mo.wrap((function _callee7$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",min:1,itemType:"string"}},t),a.next=3,this.core.sendCmd("removeSuperTeamManagers",t);case 3:case"end":return a.stop()}}),_callee7,this)})))},a.applySuperTeam=function applySuperTeam(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee8(){var a;return Mo.wrap((function _callee8$(o){for(;;)switch(o.prev=o.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},ps:{type:"string",allowEmpty:!0,max:5e3,required:!1}},t),o.next=3,this.core.sendCmd("applySuperTeam",{teamId:t.teamId,ps:t.ps||""});case 3:return a=o.sent,o.abrupt("return",formatSuperTeam(a.content.superTeam));case 5:case"end":return o.stop()}}),_callee8,this)})))},a.transferSuperTeam=function transferSuperTeam(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee9(){return Mo.wrap((function _callee9$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},account:{type:"string",allowEmpty:!1},leave:{type:"boolean"}},t),a.next=3,this.core.sendCmd("transferSuperTeam",t);case 3:case"end":return a.stop()}}),_callee9,this)})))},a.muteSuperTeam=function muteSuperTeam(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee10(){return Mo.wrap((function _callee10$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},mute:{type:"boolean"}},t),a.next=3,this.core.sendCmd("muteSuperTeam",{teamId:t.teamId,mute:t.mute?1:0});case 3:case"end":return a.stop()}}),_callee10,this)})))},a.muteSuperTeamMembers=function muteSuperTeamMembers(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee11(){return Mo.wrap((function _callee11$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string"},mute:{type:"boolean"}},t),a.next=3,this.core.sendCmd("muteSuperTeamMembers",{teamId:t.teamId,accounts:t.accounts,mute:t.mute?1:0});case 3:case"end":return a.stop()}}),_callee11,this)})))},a.updateMemberNick=function updateMemberNick(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee12(){var a,o;return Mo.wrap((function _callee12$(c){for(;;)switch(c.prev=c.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},account:{type:"string",allowEmpty:!1},nickInTeam:{type:"string",allowEmpty:!1}},t),a=generatorSuperTeamMemberForCmd({teamId:t.teamId,nickInTeam:t.nickInTeam,account:t.account}),c.next=4,this.core.sendCmd("updateSuperTeamMemberNick",{teamMember:a});case 4:return o=formatSuperTeamMember(Ao({updateTime:(new Date).getTime()},a)),c.abrupt("return",o);case 6:case"end":return c.stop()}}),_callee12,this)})))},a.updateMyMemberInfo=function updateMyMemberInfo(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee13(){var a,o;return Mo.wrap((function _callee13$(c){for(;;)switch(c.prev=c.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},nickInTeam:{type:"string",allowEmpty:!1,required:!1},bitConfigMask:{type:"number",min:0,max:2,required:!1},ext:{type:"string",required:!1}},t),a=generatorSuperTeamMemberForCmd({teamId:t.teamId,nickInTeam:t.nickInTeam,bitConfigMask:t.bitConfigMask,ext:t.ext}),c.next=4,this.core.sendCmd("updateMySuperTeamMemberInfo",{teamMember:a});case 4:return o=formatSuperTeamMember(Ao({updateTime:(new Date).getTime(),account:this.core.account},a)),this.core.emit("updateSuperTeamMember",o),c.abrupt("return",o);case 7:case"end":return c.stop()}}),_callee13,this)})))},a.getSuperTeamMembersByAccounts=function getSuperTeamMembersByAccounts(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee14(){var o,c,m;return Mo.wrap((function _callee14$(h){for(;;)switch(h.prev=h.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},accounts:{type:"array",itemType:"string",max:20,min:1}},t),c=map(o=t.accounts).call(o,(function(a){return t.teamId+"|"+a})),h.next=4,this.core.sendCmd("getSuperTeamMembersByAccounts",{memberIds:c});case 4:return m=h.sent,h.abrupt("return",formatSuperTeamMembers(null===(a=m.content)||void 0===a?void 0:a.superTeamMembers));case 6:case"end":return h.stop()}}),_callee14,this)})))},a.getSuperTeamMembers=function getSuperTeamMembers(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee15(){var o;return Mo.wrap((function _callee15$(c){for(;;)switch(c.prev=c.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},joinTime:{type:"number",min:0,required:!1},limit:{type:"number",min:1,max:1e3,required:!1},reverse:{type:"boolean",required:!1}},t),c.next=3,this.core.sendCmd("getSuperTeamMembers",Ao({joinTime:0,limit:100,reverse:!1},t));case 3:return o=c.sent,c.abrupt("return",formatSuperTeamMembers(null===(a=o.content)||void 0===a?void 0:a.superTeamMembers));case 5:case"end":return c.stop()}}),_callee15,this)})))},a.queryMuteMembers=function queryMuteMembers(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee16(){var a,o;return Mo.wrap((function _callee16$(c){for(;;)switch(c.prev=c.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},joinTime:{type:"number",min:0,required:!1},limit:{type:"number",min:1,required:!1},reverse:{type:"boolean",required:!1}},t),c.next=3,this.core.sendCmd("queryMuteSuperTeamMembers",Ao({limit:100,joinTime:0,reverse:!1},t));case 3:return a=c.sent,o=a.content,c.abrupt("return",formatSuperTeamMembers(o.superTeamMembers));case 6:case"end":return c.stop()}}),_callee16,this)})))},a.leaveSuperTeam=function leaveSuperTeam(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee17(){return Mo.wrap((function _callee17$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1}},t),a.next=3,this.core.sendCmd("leaveSuperTeam",{teamId:t.teamId});case 3:case"end":return a.stop()}}),_callee17,this)})))},a.passSuperTeamApply=function passSuperTeamApply(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee18(){return Mo.wrap((function _callee18$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("passSuperTeamApply",t);case 3:case"end":return a.stop()}}),_callee18,this)})))},a.rejectSuperTeamApply=function rejectSuperTeamApply(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee19(){return Mo.wrap((function _callee19$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1},ps:{type:"string",max:5e3,required:!1}},t),a.next=3,this.core.sendCmd("rejectSuperTeamApply",{teamId:t.teamId,from:t.from,ps:t.ps||""});case 3:case"end":return a.stop()}}),_callee19,this)})))},a.acceptSuperTeamInvite=function acceptSuperTeamInvite(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee20(){return Mo.wrap((function _callee20$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1}},t),a.next=3,this.core.sendCmd("acceptSuperTeamInvite",t);case 3:case"end":return a.stop()}}),_callee20,this)})))},a.rejectSuperTeamInvite=function rejectSuperTeamInvite(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee21(){return Mo.wrap((function _callee21$(a){for(;;)switch(a.prev=a.next){case 0:return validate({teamId:{type:"string",regExp:/\d+/,allowEmpty:!1},from:{type:"string",allowEmpty:!1},ps:{type:"string",max:5e3,required:!1}},t),a.next=3,this.core.sendCmd("rejectSuperTeamInvite",{teamId:t.teamId,from:t.from,ps:t.ps||""});case 3:case"end":return a.stop()}}),_callee21,this)})))},a.syncSuperTeamsHandler=function syncSuperTeamsHandler(t){var a=t.content;this.core.eventBus.emit("sync/updateTimetag",{superTeams:Bl(a.timetag)});var o=null==a?void 0:a.superTeams;if(o&&o.length){var c=formatSuperTeams(o);this.core.emit("superTeams",c)}},a.syncCreateSuperTeamHandler=function syncCreateSuperTeamHandler(t){var a=t.content,o=formatSuperTeam(null==a?void 0:a.superTeam),c=generatorMemberBySuperTeam(o,o.owner,"owner");this.core.emit("createSuperTeam",o,c)},a.syncUpdateSuperTeamMemberHandler=function syncUpdateSuperTeamMemberHandler(t){var a=t.content,o=formatSuperTeamMember(null==a?void 0:a.teamMember);o.updateTime||(o.updateTime=(new Date).getTime()),this.core.emit("updateSuperTeamMember",o)},a.notificationHandler=function notificationHandler(t){var a=t.attach,o=t.scene,c=t.from,m=t.to,h=t.time,v=t.idServer,b=t.idClient,S=a.team,T=a.account,M=a.accounts,w=a.type;if("superTeam"===o)switch("debug"===this.core.options.debugLevel?this.logger.debug("superTeam::recvNotification",v,b,a):this.logger.log("superTeam::recvNotification",v,b,m,w,T,M),w){case"updateSuperTeam":S.updateTime=h,this.core.emit("updateSuperTeam",S);break;case"addSuperTeamMembers":this.service.notifyAddSuperTeamMembers(S,M);break;case"acceptSuperTeamInvite":this.service.notifyAddSuperTeamMembers(S,[c]);break;case"passSuperTeamApply":this.service.notifyAddSuperTeamMembers(S,[T]);break;case"addSuperTeamManagers":this.service.notifyUpdateSuperTeamManagers(m,M,!0,h);break;case"removeSuperTeamManagers":this.service.notifyUpdateSuperTeamManagers(m,M,!1,h);break;case"removeSuperTeamMembers":this.service.notifyRemoveSuperTeamMembers(S,M);break;case"leaveSuperTeam":this.service.notifyRemoveSuperTeamMembers(S,[c]);break;case"dismissSuperTeam":this.core.emit("dismissSuperTeam",{teamId:m});break;case"transferSuperTeam":this.service.notifyTransferSuperTeam(S,c,T);break;case"updateSuperTeamMembersMute":this.service.notifyUpdateSuperTeamMembersMute(S,M,a.mute)}},SuperTeamService}(Wp),Wh={"13_1":"getChatroomAddress","24_1":"getQChatAddress"},Vh={getChatroomAddress:{sid:13,cid:1,service:"plugin",params:[{type:"Long",name:"chatroomId"},{type:"Boolean",name:"isWeixinApp"},{type:"Number",name:"ipType"}],response:[{type:"StrArray",name:"address"}]},getQChatAddress:{sid:24,cid:1,service:"plugin",params:[{type:"Property",name:"getQChatAddressTag",reflectMapper:{ipType:1}}],response:[{type:"StrArray",name:"address"}]}},Jh=function(t){function PluginService(a){var o;return(o=t.call(this,"plugin",a)||this).core=a,registerParser({cmdMap:Wh,cmdConfig:Vh}),o}_t(PluginService,t);var a=PluginService.prototype;return a.getChatroomAddress=function getChatroomAddress(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var a;return Mo.wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return validate({chatroomId:{type:"string",allowEmpty:!1},ipType:{type:"number",required:!1}},t),o.next=3,this.core.sendCmd("getChatroomAddress",{chatroomId:t.chatroomId,isWeixinApp:"WXAPP"===Ic.platform,ipType:t.ipType||0});case 3:return a=o.sent,o.abrupt("return",a.content.address);case 5:case"end":return o.stop()}}),_callee,this)})))},a.getQChatAddress=function getQChatAddress(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var a;return Mo.wrap((function _callee2$(o){for(;;)switch(o.prev=o.next){case 0:return validate({ipType:{type:"number",required:!1}},t),o.next=3,this.core.sendCmd("getQChatAddress",{getQChatAddressTag:{ipType:(null==t?void 0:t.ipType)||0}});case 3:return a=o.sent,o.abrupt("return",a.content.address);case 5:case"end":return o.stop()}}),_callee2,this)})))},PluginService}(Wp);!function(t){t[t.audio=1]="audio",t[t.video=2]="video",t[t.custom=3]="custom"}(Uh||(Uh={})),function(t){t[t.kClose=1]="kClose",t[t.kJoin=2]="kJoin",t[t.kInvite=3]="kInvite",t[t.kCancelInvite=4]="kCancelInvite",t[t.kReject=5]="kReject",t[t.kAccept=6]="kAccept",t[t.kLeave=7]="kLeave",t[t.kCustom=8]="kCustom"}(Bh||(Bh={})),function(t){t[t.kDefault=0]="kDefault",t[t.kLeave=1]="kLeave",t[t.kSelfSync=3]="kSelfSync"}(qh||(qh={}));var Xh={"15_1":"signalingCreate","15_2":"signalingDelay","15_3":"signalingClose","15_4":"signalingJoin","15_5":"signalingLeave","15_6":"signalingInvite","15_7":"signalingCancelInvite","15_8":"signalingReject","15_9":"signalingAccept","15_10":"signalingSendCustomCommand","15_11":"signalingRecvNotification","15_12":"signalingMultiSyncNotification","15_13":"signalingSyncNotification","15_14":"singalingSyncChannels","15_15":"signalingQueryInfo","15_16":"signalingCallEx","15_17":"signalingJoinAndAccept"},Yh={avSignalTag:{type:1,name:2,channelId:3,createTime:4,expireTime:5,creatorAccid:6,ext:7,invalid:8,fromAccid:10,toAccid:11,requestId:12,needPush:13,pushTitle:14,pushContent:15,pushPayload:16,needBadge:17,members:18,attach:19,attachExt:20,needOffline:21,msgId:22,uid:23,time:24,nertcChannelName:25,nertcTokenTtl:26,nertcToken:27,nertcJoinRoomQueryParamMap:28,nertcJoinRoomResponse:29,callStatus:30}},Qh=invertSerializeMap(Yh),Zh={signalingCreate:{sid:15,cid:1,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:Qh.avSignalTag}]},signalingDelay:{sid:15,cid:2,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:Qh.avSignalTag}]},signalingClose:{sid:15,cid:3,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:Qh.avSignalTag}]},signalingJoin:{sid:15,cid:4,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:Qh.avSignalTag}]},signalingLeave:{sid:15,cid:5,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}]},signalingInvite:{sid:15,cid:6,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}]},signalingCancelInvite:{sid:15,cid:7,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}]},signalingReject:{sid:15,cid:8,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}]},signalingAccept:{sid:15,cid:9,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}]},signalingSendCustomCommand:{sid:15,cid:10,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}]},signalingRecvNotification:{sid:15,cid:11,service:"signaling",response:[{type:"Property",name:"data",reflectMapper:Qh.avSignalTag}]},signalingMultiSyncNotification:{sid:15,cid:12,service:"signaling",response:[{type:"Property",name:"data",reflectMapper:Qh.avSignalTag}]},signalingSyncNotification:{sid:15,cid:13,service:"signaling",response:[{type:"PropertyArray",name:"datas",reflectMapper:Qh.avSignalTag}]},singalingSyncChannels:{sid:15,cid:14,service:"signaling",response:[{type:"PropertyArray",name:"datas",reflectMapper:Qh.avSignalTag}]},signalingQueryInfo:{sid:15,cid:15,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:Qh.avSignalTag}]},signalingCallEx:{sid:15,cid:16,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:Qh.avSignalTag}]},signalingJoinAndAccept:{sid:15,cid:17,service:"signaling",params:[{type:"Property",name:"tag",reflectMapper:Yh.avSignalTag}],response:[{type:"Property",name:"data",reflectMapper:Qh.avSignalTag}]},signalingBatchMarkRead:{sid:4,cid:5,isNoResponse:!0,service:"signaling",params:[{type:"byte",name:"sid"},{type:"byte",name:"cid"},{type:"LongArray",name:"ids"}]}},ev={type:{type:"number"},createTime:{type:"number"},expireTime:{type:"number"},invalid:{type:"boolean"},pushInfo:{needPush:{type:"boolean"},pushTitle:{type:"string"},pushContent:{type:"string"},pushPayload:{type:"string"},needBadge:{type:"boolean"}},pluginSetting:{nertcInfo:{nertcChannelName:{type:"string"},nertcTokenTtl:{type:"number"},nertcToken:{type:"string"},nertcJoinRoomQueryParamMap:{type:"string"},callStatus:{type:"number"}}},attach:{type:"object"},members:{type:"object"},needOffline:{type:"boolean"},uid:{type:"number"},time:{type:"number"}};function formatSignaling(t){var a,o=format(ev,t),c=[];o.members&&o.members.length>0&&(c=map(a=o.members).call(a,(function(t){return function formatSignalingChannelMember(t){return format(ev,deserialize(t,{1:"accid",2:"uid",3:"createTime",4:"expireTime"}))}(t)})),delete o.members);return c.length>0?{channelInfo:o,memberList:c}:{channelInfo:o}}function generateSignalingForCmd(t){return formatReverse(ev,t)}var tv=function arrayEach(t,a){for(var o=-1,c=null==t?0:t.length;++o<c&&!1!==a(t[o],o,t););return t};var rv=function copyObject(t,a,o,c){var m=!o;o||(o={});for(var h=-1,v=a.length;++h<v;){var b=a[h],S=c?c(o[b],t[b],b,o,t):void 0;void 0===S&&(S=t[b]),m?Hm(o,b,S):$m(o,b,S)}return o};var nv=function baseAssign(t,a){return t&&rv(a,Id(a),t)};var iv=function baseAssignIn(t,a){return t&&rv(a,lh(a),t)},av=createCommonjsModule((function(t,a){var o=a&&!a.nodeType&&a,c=o&&t&&!t.nodeType&&t,m=c&&c.exports===o?Is.Buffer:void 0,h=m?m.allocUnsafe:void 0;t.exports=function cloneBuffer(t,a){if(a)return t.slice();var o=t.length,c=h?h(o):new t.constructor(o);return t.copy(c),c}}));var ov=function copyArray(t,a){var o=-1,c=t.length;for(a||(a=Array(c));++o<c;)a[o]=t[o];return a};var sv=function copySymbols(t,a){return rv(t,ng(t),a)};var cv=function copySymbolsIn(t,a){return rv(t,oh(t),a)},uv=Object.prototype.hasOwnProperty;var lv=function initCloneArray(t){var a=t.length,o=new t.constructor(a);return a&&"string"==typeof t[0]&&uv.call(t,"index")&&(o.index=t.index,o.input=t.input),o};var pv=function cloneArrayBuffer(t){var a=new t.constructor(t.byteLength);return new Kf(a).set(new Kf(t)),a};var dv=function cloneDataView(t,a){var o=a?pv(t.buffer):t.buffer;return new t.constructor(o,t.byteOffset,t.byteLength)},mv=/\w*$/;var fv=function cloneRegExp(t){var a=new t.constructor(t.source,mv.exec(t));return a.lastIndex=t.lastIndex,a},gv=Cs?Cs.prototype:void 0,yv=gv?gv.valueOf:void 0;var hv=function cloneSymbol(t){return yv?Object(yv.call(t)):{}};var vv=function cloneTypedArray(t,a){var o=a?pv(t.buffer):t.buffer;return new t.constructor(o,t.byteOffset,t.length)};var bv=function initCloneByTag(t,a,o){var c=t.constructor;switch(a){case"[object ArrayBuffer]":return pv(t);case"[object Boolean]":case"[object Date]":return new c(+t);case"[object DataView]":return dv(t,o);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return vv(t,o);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(t);case"[object RegExp]":return fv(t);case"[object Symbol]":return hv(t)}},Sv=Object.create,Tv=function(){function object(){}return function(t){if(!Us(t))return{};if(Sv)return Sv(t);object.prototype=t;var a=new object;return object.prototype=void 0,a}}();var Mv=function initCloneObject(t){return"function"!=typeof t.constructor||wd(t)?{}:Tv(Jp(t))};var wv=function baseIsMap(t){return Vc(t)&&"[object Map]"==Tg(t)},_v=Yc&&Yc.isMap,xv=_v?Xc(_v):wv;var kv=function baseIsSet(t){return Vc(t)&&"[object Set]"==Tg(t)},Iv=Yc&&Yc.isSet,Cv=Iv?Xc(Iv):kv,Ev="[object Arguments]",Av="[object Function]",Pv="[object Object]",Ov={};Ov[Ev]=Ov["[object Array]"]=Ov["[object ArrayBuffer]"]=Ov["[object DataView]"]=Ov["[object Boolean]"]=Ov["[object Date]"]=Ov["[object Float32Array]"]=Ov["[object Float64Array]"]=Ov["[object Int8Array]"]=Ov["[object Int16Array]"]=Ov["[object Int32Array]"]=Ov["[object Map]"]=Ov["[object Number]"]=Ov[Pv]=Ov["[object RegExp]"]=Ov["[object Set]"]=Ov["[object String]"]=Ov["[object Symbol]"]=Ov["[object Uint8Array]"]=Ov["[object Uint8ClampedArray]"]=Ov["[object Uint16Array]"]=Ov["[object Uint32Array]"]=!0,Ov["[object Error]"]=Ov[Av]=Ov["[object WeakMap]"]=!1;var Rv=function baseClone(t,a,o,c,m,h){var v,b=1&a,S=2&a,T=4&a;if(o&&(v=m?o(t,c,m,h):o(t)),void 0!==v)return v;if(!Us(t))return t;var M=up(t);if(M){if(v=lv(t),!b)return ov(t,v)}else{var w=Tg(t),_=w==Av||"[object GeneratorFunction]"==w;if(md(t))return av(t,b);if(w==Pv||w==Ev||_&&!m){if(v=S||_?{}:Mv(t),!b)return S?cv(t,iv(v,t)):sv(t,nv(v,t))}else{if(!Ov[w])return m?t:{};v=bv(t,w,b)}}h||(h=new zf);var x=h.get(t);if(x)return x;h.set(t,v),Cv(t)?t.forEach((function(c){v.add(baseClone(c,a,o,c,t,h))})):xv(t)&&t.forEach((function(c,m){v.set(m,baseClone(c,a,o,m,t,h))}));var k=M?void 0:(T?S?ph:ig:S?lh:Id)(t);return tv(k||t,(function(c,m){k&&(c=t[m=c]),$m(v,m,baseClone(c,a,o,m,t,h))})),v};var jv=function cloneDeep(t){return Rv(t,5)},Fv=function(t){function SignalingService(a){var o;return(o=t.call(this)||this).timer=0,o.pollingInterval=12e4,o.name="signaling",o.logger=a.logger,o.core=a,o.channels={},registerParser({cmdMap:Xh,cmdConfig:Zh}),o}_t(SignalingService,t);var a=SignalingService.prototype;return a.callEx=function callEx(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee(){var o,c,m,h;return Mo.wrap((function _callee$(v){for(;;)switch(v.prev=v.next){case 0:return validate({type:{type:"number"},toAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",allowEmpty:!1},needOffline:{type:"boolean",required:!1},pushInfo:{type:"object",required:!1,rules:{needPush:{type:"boolean",required:!1},pushTitle:{type:"string",required:!1},pushContent:{type:"string",required:!1},pushPayload:{type:"string",required:!1},needBadge:{type:"boolean",required:!1}}},pluginSetting:{type:"object",required:!1,rules:{nertcInfo:{type:"object",required:!1}}}},t),v.next=3,this.core.sendCmd("signalingCallEx",{tag:generateSignalingForCmd(t)});case 3:return o=v.sent,c=(null===(a=o.content)||void 0===a?void 0:a.data)||{},m=formatSignaling(c),this.channels[m.channelInfo.channelId]=jv(m.channelInfo),this.timer||(this.timer=this.core.timerManager.addTimer(bind$1(h=this.aotoDelay).call(h,this),this.pollingInterval,-1)),v.abrupt("return",m);case 9:case"end":return v.stop()}}),_callee,this)})))},a.joinAndAccept=function joinAndAccept(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee2(){var o,c,m,h,v,b;return Mo.wrap((function _callee2$(S){for(;;)switch(S.prev=S.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},fromAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",required:!1},needOffline:{type:"boolean",required:!1},uid:{type:"number",required:!1},pluginSetting:{type:"object",required:!1,rules:{nertcInfo:{type:"object",required:!1}}}},t),o=t.fromAccid,(c=__rest(t,["fromAccid"])).toAccid=o,S.next=5,this.core.sendCmd("signalingJoinAndAccept",{tag:generateSignalingForCmd(c)});case 5:return m=S.sent,h=(null===(a=m.content)||void 0===a?void 0:a.data)||{},v=formatSignaling(h),this.channels[v.channelInfo.channelId]=jv(v.channelInfo),this.timer||(this.timer=this.core.timerManager.addTimer(bind$1(b=this.aotoDelay).call(b,this),this.pollingInterval,-1)),S.abrupt("return",v);case 11:case"end":return S.stop()}}),_callee2,this)})))},a.create=function create(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee3(){var o,c;return Mo.wrap((function _callee3$(m){for(;;)switch(m.prev=m.next){case 0:return validate({type:{type:"number"},ext:{type:"string",required:!1}},t),m.next=3,this.core.sendCmd("signalingCreate",{tag:generateSignalingForCmd(t)});case 3:return o=m.sent,c=(null===(a=o.content)||void 0===a?void 0:a.data)||{},m.abrupt("return",formatSignaling(c));case 6:case"end":return m.stop()}}),_callee3,this)})))},a.close=function close(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee4(){return Mo.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1}},t),a.next=3,this.core.sendCmd("signalingClose",{tag:generateSignalingForCmd(t)});case 3:case"end":return a.stop()}}),_callee4,this)})))},a.queryInfo=function queryInfo(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee5(){var o,c;return Mo.wrap((function _callee5$(m){for(;;)switch(m.prev=m.next){case 0:return validate({name:{type:"string",allowEmpty:!1}},t),m.next=3,this.core.sendCmd("signalingQueryInfo",{tag:t});case 3:return o=m.sent,c=(null===(a=o.content)||void 0===a?void 0:a.data)||{},m.abrupt("return",formatSignaling(c));case 6:case"end":return m.stop()}}),_callee5,this)})))},a.join=function join(t){var a;return __awaiter(this,void 0,void 0,Mo.mark((function _callee6(){var o,c,m,h;return Mo.wrap((function _callee6$(v){for(;;)switch(v.prev=v.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},uid:{type:"number",min:0,required:!1},needOffline:{type:"boolean",required:!1}},t),v.next=3,this.core.sendCmd("signalingJoin",{tag:generateSignalingForCmd(t)});case 3:return o=v.sent,c=(null===(a=o.content)||void 0===a?void 0:a.data)||{},m=formatSignaling(c),this.channels[m.channelInfo.channelId]=jv(m.channelInfo),this.timer||(this.timer=this.core.timerManager.addTimer(bind$1(h=this.aotoDelay).call(h,this),this.pollingInterval,-1)),v.abrupt("return",m);case 9:case"end":return v.stop()}}),_callee6,this)})))},a.aotoDelay=function aotoDelay(){return __awaiter(this,void 0,void 0,Mo.mark((function _callee7(){var t,a,o,c,m;return Mo.wrap((function _callee7$(h){for(;;)switch(h.prev=h.next){case 0:if(0!==(t=xo(this.channels)).length){h.next=4;break}return this.timer&&this.core.timerManager.deleteTimer(this.timer),h.abrupt("return");case 4:this.logger.log("signling:autoDelay",t),a=0;case 6:if(!(a<t.length)){h.next=23;break}return o=t[a],h.prev=8,h.next=11,this.core.sendCmd("signalingDelay",{tag:{channelId:o}});case 11:c=h.sent,m=formatSignaling(c.content.data),this.channels[o]=m.channelInfo,h.next=20;break;case 16:h.prev=16,h.t0=h.catch(8),this.logger.warn("signling:autoDelay "+o+" failed",h.t0),delete this.channels[o];case 20:a++,h.next=6;break;case 23:case"end":return h.stop()}}),_callee7,this,[[8,16]])})))},a.leave=function leave(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee8(){return Mo.wrap((function _callee8$(a){for(;;)switch(a.prev=a.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1}},t),a.next=3,this.core.sendCmd("signalingLeave",{tag:generateSignalingForCmd(t)});case 3:delete this.channels[t.channelId];case 4:case"end":return a.stop()}}),_callee8,this)})))},a.invite=function invite(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee9(){return Mo.wrap((function _callee9$(a){for(;;)switch(a.prev=a.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},toAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1},pushInfo:{type:"object",required:!1,rules:{needPush:{type:"boolean",required:!1},pushTitle:{type:"string",required:!1},pushContent:{type:"string"},pushPayload:{type:"string",required:!1},needBadge:{type:"boolean",required:!1}}}},t),a.next=3,this.core.sendCmd("signalingInvite",{tag:generateSignalingForCmd(t)});case 3:case"end":return a.stop()}}),_callee9,this)})))},a.cancelInvite=function cancelInvite(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee10(){return Mo.wrap((function _callee10$(a){for(;;)switch(a.prev=a.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},toAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1}},t),a.next=3,this.core.sendCmd("signalingCancelInvite",{tag:generateSignalingForCmd(t)});case 3:case"end":return a.stop()}}),_callee10,this)})))},a.reject=function reject(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee11(){var a,o;return Mo.wrap((function _callee11$(c){for(;;)switch(c.prev=c.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},fromAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1}},t),a=t.fromAccid,(o=__rest(t,["fromAccid"])).toAccid=a,c.next=5,this.core.sendCmd("signalingReject",{tag:generateSignalingForCmd(o)});case 5:case"end":return c.stop()}}),_callee11,this)})))},a.accept=function accept(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee12(){var a,o,c,m,h;return Mo.wrap((function _callee12$(v){for(;;)switch(v.prev=v.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},fromAccid:{type:"string",allowEmpty:!1},requestId:{type:"string",allowEmpty:!1},attachExt:{type:"string",required:!1},needOffline:{type:"boolean",required:!1},autoJoin:{type:"boolean",required:!1},uid:{type:"number",min:0,required:!1},joinAttachExt:{type:"string",required:!1}},t),a=t.autoJoin,o=t.joinAttachExt,c=t.fromAccid,(m=__rest(t,["autoJoin","joinAttachExt","fromAccid"])).toAccid=c,v.next=5,this.core.sendCmd("signalingAccept",{tag:generateSignalingForCmd(m)});case 5:if(this.logger.log("Signaling:accept, accept success, autoJoin "+t.autoJoin),!a){v.next=10;break}return h={channelId:t.channelId,needOffline:t.needOffline,attachExt:o,uid:t.uid},v.next=10,this.join(h);case 10:case"end":return v.stop()}}),_callee12,this)})))},a.sendCustomCommand=function sendCustomCommand(t){return __awaiter(this,void 0,void 0,Mo.mark((function _callee13(){return Mo.wrap((function _callee13$(a){for(;;)switch(a.prev=a.next){case 0:return validate({channelId:{type:"string",allowEmpty:!1},fromAccid:{type:"string",allowEmpty:!1,required:!1},attachExt:{type:"string",required:!1}},t),a.next=3,this.core.sendCmd("signalingSendCustomCommand",{tag:generateSignalingForCmd(t)});case 3:case"end":return a.stop()}}),_callee13,this)})))},a.signalingRecvNotificationHandler=function signalingRecvNotificationHandler(t){this.doNotify(t.content.data);var a=t.raw.r[0];a&&this.core.sendCmd("signalingBatchMarkRead",{sid:15,cid:11,ids:[a]})},a.signalingMultiSyncNotificationHandler=function signalingMultiSyncNotificationHandler(t){this.doNotify(t.content.data,qh.kSelfSync)},a.doNotify=function doNotify(t,a){void 0===a&&(a=qh.kDefault);var o=function formatSignalingNotification(t,a){void 0===a&&(a=qh.kDefault);var o=format(ev,t),c=o.attach,m=o.time,h=o.msgId;o.fromAccid,o.toAccid,o.members,o.requestId,o.pushInfo;var v=__rest(o,["attach","time","msgId","fromAccid","toAccid","members","requestId","pushInfo"]),b=c.type,S=o.ext;return delete o.attach,{metaData:{eventType:b,channelInfo:v,feature:a,ext:S,time:m,msgId:h},rawData:o}}(t,a),c=o.metaData,m=o.rawData,h=m.fromAccid,v=m.toAccid,b=m.members,S=m.requestId,T=m.pushInfo,M=m.msgId;switch(c.eventType){case Bh.kClose:this.emit("signalingClose",{fromAccid:h,metaData:c});break;case Bh.kJoin:this.emit("signalingJoin",{member:b,metaData:c});break;case Bh.kInvite:this.emit("signalingInvite",{fromAccid:h,toAccid:v,requestId:S,pushInfo:T,metaData:c});break;case Bh.kCancelInvite:this.emit("signalingCancelInvite",{fromAccid:h,toAccid:v,requestId:S,metaData:c});break;case Bh.kReject:this.emit("signalingReject",{toAccid:v,requestId:S,metaData:c});break;case Bh.kAccept:this.emit("signalingAccept",{toAccid:v,requestId:S,metaData:c});break;case Bh.kLeave:this.emit("signalingLeave",{fromAccid:h,metaData:c});break;case Bh.kCustom:this.emit("signalingCustomCommand",{fromAccid:h,metaData:c});break;default:this.logger.warn("signaling:notification, no such a type "+c.eventType,m)}return M},a.signalingSyncNotificationHandler=function signalingSyncNotificationHandler(t){var a,o,c=this;if(t.content.datas&&t.content.datas.length>0){var m=filter(a=map(o=t.content.datas).call(o,(function(t){return c.doNotify(t)}))).call(a,(function(t){return t}));m.length>0&&this.core.sendCmd("signalingBatchMarkRead",{sid:15,cid:11,ids:m})}},a.singalingSyncChannelsHandler=function singalingSyncChannelsHandler(t){var a;if(this.timer=0,this.channels={},t.content.datas&&t.content.datas.length>0){var o=map(a=t.content.datas).call(a,(function(t){return formatSignaling(t)}));this.emit("singalingSyncChannels",o)}},a.process=function process(t){var a=this[t.cmd+"Handler"];return"function"==typeof a?(a.call(this,t),co.resolve(t)):t.error&&!t.error.ignore?co.reject(t.error):co.resolve(t)},SignalingService}(ws.EventEmitter);return Ep.setAdapters(Kp),Ep.registerService(Ud,"auth"),Ep.registerService(Fm,"msg"),Ep.registerService(Dm,"misc"),Ep.registerService(Nf,"user"),Ep.registerService(fy,"session"),Ep.registerService(yy,"team"),Ep.registerService(_y,"systemMessage"),Ep.registerService(Ay,"friend"),Ep.registerService(Ly,"event"),Ep.registerService(Hy,"msgExtend"),Ep.registerService(Xy,"msgLog"),Ep.registerService(th,"passThrough"),Ep.registerService(_h,"cloudStorage"),Ep.registerService(Kh,"superTeam"),Ep.registerService(Um,"sync"),Ep.registerService(Jh,"plugin"),Ep.registerService(Fv,"signaling"),Ep}));

}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
return __REQUIRE__(1676686826085);
})()
//miniprogram-npm-outsideDeps=[]
//# sourceMappingURL=index.js.map