UNPKG

nim-web-sdk-ng

Version:

Yunxin IM SDK next generation

24 lines 464 kB
/**
 * 
 *   Version: 10.9.71
 * 
 *   Git Hash: f2dd8dce716f63985d0823f710605b924090d68b
 * 
 *   Created At: 1/5/2026, 9:48:45 AM
 * 
 *   Target: CHATROOM_BROWSER_SDK.js
 *   
 */

!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).Chatroom={})}(this,(function(t){"use strict";var i="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 i={exports:{}};return t(i,i.exports),i.exports}var u,_,check=function(t){return t&&t.Math==Math&&t},h=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof i&&i)||function(){return this}()||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},E=!fails((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),m=Function.prototype,I=m.apply,v=m.call,T="object"==typeof Reflect&&Reflect.apply||(E?v.bind(I):function(){return v.apply(I,arguments)}),N=Function.prototype,M=N.bind,O=N.call,S=E&&M.bind(O,O),R=E?function(t){return t&&S(t)}:function(t){return t&&function(){return O.apply(t,arguments)}},isCallable=function(t){return"function"==typeof t},A=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),C=Function.prototype.call,L=E?C.bind(C):function(){return C.apply(C,arguments)},k={}.propertyIsEnumerable,D=Object.getOwnPropertyDescriptor,V={f:D&&!k.call({1:2},1)?function propertyIsEnumerable(t){var i=D(this,t);return!!i&&i.enumerable}:k},createPropertyDescriptor=function(t,i){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:i}},w=R({}.toString),P=R("".slice),classofRaw=function(t){return P(w(t),8,-1)},x=Object,U=R("".split),G=fails((function(){return!x("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?U(t,""):x(t)}:x,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 G(requireObjectCoercible(t))},H="object"==typeof document&&document.all,Y=void 0===H&&void 0!==H?function(t){return"object"==typeof t?null!==t:isCallable(t)||t===H}:function(t){return"object"==typeof t?null!==t:isCallable(t)},j={},aFunction=function(t){return isCallable(t)?t:void 0},getBuiltIn=function(t,i){return arguments.length<2?aFunction(j[t])||aFunction(h[t]):j[t]&&j[t][i]||h[t]&&h[t][i]},K=R({}.isPrototypeOf),q=getBuiltIn("navigator","userAgent")||"",W=h.process,z=h.Deno,$=W&&W.versions||z&&z.version,X=$&&$.v8;X&&(_=(u=X.split("."))[0]>0&&u[0]<4?1:+(u[0]+u[1])),!_&&q&&(!(u=q.match(/Edge\/(\d+)/))||u[1]>=74)&&(u=q.match(/Chrome\/(\d+)/))&&(_=+u[1]);var J=_,Q=!!Object.getOwnPropertySymbols&&!fails((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&J&&J<41})),Z=Q&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ee=Object,te=Z?function(t){return"symbol"==typeof t}:function(t){var i=getBuiltIn("Symbol");return isCallable(i)&&K(i.prototype,ee(t))},re=String,tryToString=function(t){try{return re(t)}catch(t){return"Object"}},ne=TypeError,aCallable=function(t){if(isCallable(t))return t;throw ne(tryToString(t)+" is not a function")},getMethod=function(t,i){var u=t[i];return isNullOrUndefined(u)?void 0:aCallable(u)},oe=TypeError,ie=Object.defineProperty,ae="__core-js_shared__",se=h[ae]||function(t,i){try{ie(h,t,{value:i,configurable:!0,writable:!0})}catch(u){h[t]=i}return i}(ae,{}),ce=createCommonjsModule((function(t){(t.exports=function(t,i){return se[t]||(se[t]=void 0!==i?i:{})})("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"})})),le=Object,toObject=function(t){return le(requireObjectCoercible(t))},ue=R({}.hasOwnProperty),de=Object.hasOwn||function hasOwn(t,i){return ue(toObject(t),i)},_e=0,pe=Math.random(),he=R(1..toString),uid=function(t){return"Symbol("+(void 0===t?"":t)+")_"+he(++_e+pe,36)},fe=ce("wks"),Ee=h.Symbol,me=Ee&&Ee.for,ge=Z?Ee:Ee&&Ee.withoutSetter||uid,wellKnownSymbol=function(t){if(!de(fe,t)||!Q&&"string"!=typeof fe[t]){var i="Symbol."+t;Q&&de(Ee,t)?fe[t]=Ee[t]:fe[t]=Z&&me?me(i):ge(i)}return fe[t]},Ie=TypeError,ve=wellKnownSymbol("toPrimitive"),toPrimitive=function(t,i){if(!Y(t)||te(t))return t;var u,_=getMethod(t,ve);if(_){if(void 0===i&&(i="default"),u=L(_,t,i),!Y(u)||te(u))return u;throw Ie("Can't convert object to primitive value")}return void 0===i&&(i="number"),function(t,i){var u,_;if("string"===i&&isCallable(u=t.toString)&&!Y(_=L(u,t)))return _;if(isCallable(u=t.valueOf)&&!Y(_=L(u,t)))return _;if("string"!==i&&isCallable(u=t.toString)&&!Y(_=L(u,t)))return _;throw oe("Can't convert object to primitive value")}(t,i)},toPropertyKey=function(t){var i=toPrimitive(t,"string");return te(i)?i:i+""},Te=h.document,Ne=Y(Te)&&Y(Te.createElement),documentCreateElement=function(t){return Ne?Te.createElement(t):{}},Me=!A&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),Oe=Object.getOwnPropertyDescriptor,Se={f:A?Oe:function getOwnPropertyDescriptor(t,i){if(t=toIndexedObject(t),i=toPropertyKey(i),Me)try{return Oe(t,i)}catch(t){}if(de(t,i))return createPropertyDescriptor(!L(V.f,t,i),t[i])}},Re=/#|\.prototype\./,isForced=function(t,i){var u=Ae[ye(t)];return u==be||u!=Ce&&(isCallable(i)?fails(i):!!i)},ye=isForced.normalize=function(t){return String(t).replace(Re,".").toLowerCase()},Ae=isForced.data={},Ce=isForced.NATIVE="N",be=isForced.POLYFILL="P",Le=isForced,ke=R(R.bind),functionBindContext=function(t,i){return aCallable(t),void 0===i?t:E?ke(t,i):function(){return t.apply(i,arguments)}},De=A&&fails((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ve=String,we=TypeError,anObject=function(t){if(Y(t))return t;throw we(Ve(t)+" is not an object")},Pe=TypeError,xe=Object.defineProperty,Ue=Object.getOwnPropertyDescriptor,Fe="enumerable",Ge="configurable",Be="writable",He={f:A?De?function defineProperty(t,i,u){if(anObject(t),i=toPropertyKey(i),anObject(u),"function"==typeof t&&"prototype"===i&&"value"in u&&Be in u&&!u.writable){var _=Ue(t,i);_&&_.writable&&(t[i]=u.value,u={configurable:Ge in u?u.configurable:_.configurable,enumerable:Fe in u?u.enumerable:_.enumerable,writable:!1})}return xe(t,i,u)}:xe:function defineProperty(t,i,u){if(anObject(t),i=toPropertyKey(i),anObject(u),Me)try{return xe(t,i,u)}catch(t){}if("get"in u||"set"in u)throw Pe("Accessors not supported");return"value"in u&&(t[i]=u.value),t}},Ye=A?function(t,i,u){return He.f(t,i,createPropertyDescriptor(1,u))}:function(t,i,u){return t[i]=u,t},je=Se.f,wrapConstructor=function(t){var Wrapper=function(i,u,_){if(this instanceof Wrapper){switch(arguments.length){case 0:return new t;case 1:return new t(i);case 2:return new t(i,u)}return new t(i,u,_)}return T(t,this,arguments)};return Wrapper.prototype=t.prototype,Wrapper},_export=function(t,i){var u,_,E,m,I,v,T,N,M=t.target,O=t.global,S=t.stat,A=t.proto,C=O?h:S?h[M]:(h[M]||{}).prototype,L=O?j:j[M]||Ye(j,M,{})[M],k=L.prototype;for(E in i)u=!Le(O?E:M+(S?".":"#")+E,t.forced)&&C&&de(C,E),I=L[E],u&&(v=t.dontCallGetSet?(N=je(C,E))&&N.value:C[E]),m=u&&v?v:i[E],u&&typeof I==typeof m||(T=t.bind&&u?functionBindContext(m,h):t.wrap&&u?wrapConstructor(m):A&&isCallable(m)?R(m):m,(t.sham||m&&m.sham||I&&I.sham)&&Ye(T,"sham",!0),Ye(L,E,T),A&&(de(j,_=M+"Prototype")||Ye(j,_,{}),Ye(j[_],E,m),t.real&&k&&!k[E]&&Ye(k,E,m)))},Ke=He.f;_export({target:"Object",stat:!0,forced:Object.defineProperty!==Ke,sham:!A},{defineProperty:Ke});var qe,We=createCommonjsModule((function(t){var i=j.Object,u=t.exports=function defineProperty(t,u,_){return i.defineProperty(t,u,_)};i.defineProperty.sham&&(u.sham=!0)})),ze=We,$e=getDefaultExportFromCjs(createCommonjsModule((function(t){function _defineProperties(t,i){for(var u=0;u<i.length;u++){var _=i[u];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),ze(t,_.key,_)}}t.exports=function _createClass(t,i,u){return i&&_defineProperties(t.prototype,i),u&&_defineProperties(t,u),ze(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports}))),Xe=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}))),Je=Math.ceil,Qe=Math.floor,Ze=Math.trunc||function trunc(t){var i=+t;return(i>0?Qe:Je)(i)},toIntegerOrInfinity=function(t){var i=+t;return i!=i||0===i?0:Ze(i)},et=Math.max,tt=Math.min,toAbsoluteIndex=function(t,i){var u=toIntegerOrInfinity(t);return u<0?et(u+i,0):tt(u,i)},rt=Math.min,lengthOfArrayLike=function(t){return(i=t.length)>0?rt(toIntegerOrInfinity(i),9007199254740991):0;var i},createMethod$5=function(t){return function(i,u,_){var h,E=toIndexedObject(i),m=lengthOfArrayLike(E),I=toAbsoluteIndex(_,m);if(t&&u!=u){for(;m>I;)if((h=E[I++])!=h)return!0}else for(;m>I;I++)if((t||I in E)&&E[I]===u)return t||I||0;return!t&&-1}},nt={includes:createMethod$5(!0),indexOf:createMethod$5(!1)},ot={},it=nt.indexOf,at=R([].push),objectKeysInternal=function(t,i){var u,_=toIndexedObject(t),h=0,E=[];for(u in _)!de(ot,u)&&de(_,u)&&at(E,u);for(;i.length>h;)de(_,u=i[h++])&&(~it(E,u)||at(E,u));return E},st=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ct=Object.keys||function keys(t){return objectKeysInternal(t,st)},lt=A&&!De?Object.defineProperties:function defineProperties(t,i){anObject(t);for(var u,_=toIndexedObject(i),h=ct(i),E=h.length,m=0;E>m;)He.f(t,u=h[m++],_[u]);return t},ut={f:lt},dt=getBuiltIn("document","documentElement"),_t=ce("keys"),sharedKey=function(t){return _t[t]||(_t[t]=uid(t))},pt=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"</"+"script>"},NullProtoObjectViaActiveX=function(t){t.write(scriptTag("")),t.close();var i=t.parentWindow.Object;return t=null,i},NullProtoObject=function(){try{qe=new ActiveXObject("htmlfile")}catch(t){}var t,i;NullProtoObject="undefined"!=typeof document?document.domain&&qe?NullProtoObjectViaActiveX(qe):((i=documentCreateElement("iframe")).style.display="none",dt.appendChild(i),i.src=String("javascript:"),(t=i.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F):NullProtoObjectViaActiveX(qe);for(var u=st.length;u--;)delete NullProtoObject.prototype[st[u]];return NullProtoObject()};ot[pt]=!0;var ht=Object.create||function create(t,i){var u;return null!==t?(EmptyConstructor.prototype=anObject(t),u=new EmptyConstructor,EmptyConstructor.prototype=null,u[pt]=t):u=NullProtoObject(),void 0===i?u:ut.f(u,i)};_export({target:"Object",stat:!0,sham:!A},{create:ht});var ft=j.Object,Et=function create(t,i){return ft.create(t,i)},mt=String,gt=TypeError,It=Object.setPrototypeOf||("__proto__"in{}?function(){var t,i=!1,u={};try{(t=R(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(u,[]),i=u instanceof Array}catch(t){}return function setPrototypeOf(u,_){return anObject(u),function(t){if("object"==typeof t||isCallable(t))return t;throw gt("Can't set "+mt(t)+" as a prototype")}(_),i?t(u,_):u.__proto__=_,u}}():void 0);_export({target:"Object",stat:!0},{setPrototypeOf:It});var vt=j.Object.setPrototypeOf,Tt=R([].slice),Nt=Function,Mt=R([].concat),Ot=R([].join),St={},construct$8=function(t,i,u){if(!de(St,i)){for(var _=[],h=0;h<i;h++)_[h]="a["+h+"]";St[i]=Nt("C,a","return new C("+Ot(_,",")+")")}return St[i](t,u)},Rt=E?Nt.bind:function bind(t){var i=aCallable(this),u=i.prototype,_=Tt(arguments,1),h=function bound(){var u=Mt(_,Tt(arguments));return this instanceof h?construct$8(i,u.length,u):i.apply(t,u)};return Y(u)&&(h.prototype=u),h};_export({target:"Function",proto:!0,forced:Function.bind!==Rt},{bind:Rt});var entryVirtual=function(t){return j[t+"Prototype"]},yt=entryVirtual("Function").bind,At=Function.prototype,bind$1=function(t){var i=t.bind;return t===At||K(At,t)&&i===At.bind?yt:i},Ct=createCommonjsModule((function(t){function _setPrototypeOf(i,u){var _;return t.exports=_setPrototypeOf=vt?bind$1(_=vt).call(_):function _setPrototypeOf(t,i){return t.__proto__=i,t},t.exports.__esModule=!0,t.exports.default=t.exports,_setPrototypeOf(i,u)}t.exports=_setPrototypeOf,t.exports.__esModule=!0,t.exports.default=t.exports})),bt=getDefaultExportFromCjs(createCommonjsModule((function(t){t.exports=function _inheritsLoose(t,i){t.prototype=Et(i.prototype),t.prototype.constructor=t,Ct(t,i)},t.exports.__esModule=!0,t.exports.default=t.exports}))),Lt=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,i,u){var _=toPropertyKey(i);_ in t?He.f(t,_,createPropertyDescriptor(0,u)):t[_]=u},Dt={};Dt[wellKnownSymbol("toStringTag")]="z";var Vt="[object z]"===String(Dt),wt=wellKnownSymbol("toStringTag"),Pt=Object,xt="Arguments"==classofRaw(function(){return arguments}()),Ut=Vt?classofRaw:function(t){var i,u,_;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(u=function(t,i){try{return t[i]}catch(t){}}(i=Pt(t),wt))?u:xt?classofRaw(i):"Object"==(_=classofRaw(i))&&isCallable(i.callee)?"Arguments":_},Ft=R(Function.toString);isCallable(se.inspectSource)||(se.inspectSource=function(t){return Ft(t)});var Gt=se.inspectSource,noop=function(){},Bt=[],Ht=getBuiltIn("Reflect","construct"),Yt=/^\s*(?:class|function)\b/,jt=R(Yt.exec),Kt=!Yt.exec(noop),qt=function isConstructor(t){if(!isCallable(t))return!1;try{return Ht(noop,Bt,t),!0}catch(t){return!1}},Wt=function isConstructor(t){if(!isCallable(t))return!1;switch(Ut(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Kt||!!jt(Yt,Gt(t))}catch(t){return!0}};Wt.sham=!0;var zt=!Ht||fails((function(){var t;return qt(qt.call)||!qt(Object)||!qt((function(){t=!0}))||t}))?Wt:qt,$t=wellKnownSymbol("species"),Xt=Array,arraySpeciesCreate=function(t,i){return new(function(t){var i;return Lt(t)&&(i=t.constructor,(zt(i)&&(i===Xt||Lt(i.prototype))||Y(i)&&null===(i=i[$t]))&&(i=void 0)),void 0===i?Xt:i}(t))(0===i?0:i)},Jt=wellKnownSymbol("species"),arrayMethodHasSpeciesSupport=function(t){return J>=51||!fails((function(){var i=[];return(i.constructor={})[Jt]=function(){return{foo:1}},1!==i[t](Boolean).foo}))},Qt=wellKnownSymbol("isConcatSpreadable"),Zt=J>=51||!fails((function(){var t=[];return t[Qt]=!1,t.concat()[0]!==t})),er=arrayMethodHasSpeciesSupport("concat"),isConcatSpreadable=function(t){if(!Y(t))return!1;var i=t[Qt];return void 0!==i?!!i:Lt(t)};_export({target:"Array",proto:!0,arity:1,forced:!Zt||!er},{concat:function concat(t){var i,u,_,h,E,m=toObject(this),I=arraySpeciesCreate(m,0),v=0;for(i=-1,_=arguments.length;i<_;i++)if(isConcatSpreadable(E=-1===i?m:arguments[i]))for(h=lengthOfArrayLike(E),doesNotExceedSafeInteger(v+h),u=0;u<h;u++,v++)u in E&&createProperty(I,v,E[u]);else doesNotExceedSafeInteger(v+1),createProperty(I,v++,E);return I.length=v,I}});var tr,rr,nr,or=String,toString=function(t){if("Symbol"===Ut(t))throw TypeError("Cannot convert a Symbol value to a string");return or(t)},ir=st.concat("length","prototype"),ar={f:Object.getOwnPropertyNames||function getOwnPropertyNames(t){return objectKeysInternal(t,ir)}},sr=Array,cr=Math.max,arraySliceSimple=function(t,i,u){for(var _=lengthOfArrayLike(t),h=toAbsoluteIndex(i,_),E=toAbsoluteIndex(void 0===u?_:u,_),m=sr(cr(E-h,0)),I=0;h<E;h++,I++)createProperty(m,I,t[h]);return m.length=I,m},lr=ar.f,ur="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],dr={f:function getOwnPropertyNames(t){return ur&&"Window"==classofRaw(t)?function(t){try{return lr(t)}catch(t){return arraySliceSimple(ur)}}(t):lr(toIndexedObject(t))}},_r={f:Object.getOwnPropertySymbols},defineBuiltIn=function(t,i,u,_){return _&&_.enumerable?t[i]=u:Ye(t,i,u),t},pr={f:wellKnownSymbol},hr=He.f,wellKnownSymbolDefine=function(t){var i=j.Symbol||(j.Symbol={});de(i,t)||hr(i,t,{value:pr.f(t)})},symbolDefineToPrimitive=function(){var t=getBuiltIn("Symbol"),i=t&&t.prototype,u=i&&i.valueOf,_=wellKnownSymbol("toPrimitive");i&&!i[_]&&defineBuiltIn(i,_,(function(t){return L(u,this)}),{arity:1})},fr=Vt?{}.toString:function toString(){return"[object "+Ut(this)+"]"},Er=He.f,mr=wellKnownSymbol("toStringTag"),setToStringTag=function(t,i,u,_){if(t){var h=u?t:t.prototype;de(h,mr)||Er(h,mr,{configurable:!0,value:i}),_&&!Vt&&Ye(h,"toString",fr)}},gr=h.WeakMap,Ir=isCallable(gr)&&/native code/.test(String(gr)),vr="Object already initialized",Tr=h.TypeError,Nr=h.WeakMap;if(Ir||se.state){var Mr=se.state||(se.state=new Nr),Or=R(Mr.get),Sr=R(Mr.has),Rr=R(Mr.set);tr=function(t,i){if(Sr(Mr,t))throw Tr(vr);return i.facade=t,Rr(Mr,t,i),i},rr=function(t){return Or(Mr,t)||{}},nr=function(t){return Sr(Mr,t)}}else{var yr=sharedKey("state");ot[yr]=!0,tr=function(t,i){if(de(t,yr))throw Tr(vr);return i.facade=t,Ye(t,yr,i),i},rr=function(t){return de(t,yr)?t[yr]:{}},nr=function(t){return de(t,yr)}}var Ar={set:tr,get:rr,has:nr,enforce:function(t){return nr(t)?rr(t):tr(t,{})},getterFor:function(t){return function(i){var u;if(!Y(i)||(u=rr(i)).type!==t)throw Tr("Incompatible receiver, "+t+" required");return u}}},Cr=R([].push),createMethod$4=function(t){var i=1==t,u=2==t,_=3==t,h=4==t,E=6==t,m=7==t,I=5==t||E;return function(v,T,N,M){for(var O,S,R=toObject(v),A=G(R),C=functionBindContext(T,N),L=lengthOfArrayLike(A),k=0,D=M||arraySpeciesCreate,V=i?D(v,L):u||m?D(v,0):void 0;L>k;k++)if((I||k in A)&&(S=C(O=A[k],k,R),t))if(i)V[k]=S;else if(S)switch(t){case 3:return!0;case 5:return O;case 6:return k;case 2:Cr(V,O)}else switch(t){case 4:return!1;case 7:Cr(V,O)}return E?-1:_||h?h:V}},br={forEach:createMethod$4(0),map:createMethod$4(1),filter:createMethod$4(2),some:createMethod$4(3),every:createMethod$4(4),find:createMethod$4(5),findIndex:createMethod$4(6),filterReject:createMethod$4(7)},Lr=br.forEach,kr=sharedKey("hidden"),Dr="Symbol",Vr=Ar.set,wr=Ar.getterFor(Dr),Pr=Object.prototype,xr=h.Symbol,Ur=xr&&xr.prototype,Fr=h.TypeError,Gr=h.QObject,Br=Se.f,Hr=He.f,Yr=dr.f,jr=V.f,Kr=R([].push),qr=ce("symbols"),Wr=ce("op-symbols"),zr=ce("wks"),$r=!Gr||!Gr.prototype||!Gr.prototype.findChild,Xr=A&&fails((function(){return 7!=ht(Hr({},"a",{get:function(){return Hr(this,"a",{value:7}).a}})).a}))?function(t,i,u){var _=Br(Pr,i);_&&delete Pr[i],Hr(t,i,u),_&&t!==Pr&&Hr(Pr,i,_)}:Hr,wrap$1=function(t,i){var u=qr[t]=ht(Ur);return Vr(u,{type:Dr,tag:t,description:i}),A||(u.description=i),u},Jr=function defineProperty(t,i,u){t===Pr&&Jr(Wr,i,u),anObject(t);var _=toPropertyKey(i);return anObject(u),de(qr,_)?(u.enumerable?(de(t,kr)&&t[kr][_]&&(t[kr][_]=!1),u=ht(u,{enumerable:createPropertyDescriptor(0,!1)})):(de(t,kr)||Hr(t,kr,createPropertyDescriptor(1,{})),t[kr][_]=!0),Xr(t,_,u)):Hr(t,_,u)},Qr=function defineProperties(t,i){anObject(t);var u=toIndexedObject(i),_=ct(u).concat($getOwnPropertySymbols(u));return Lr(_,(function(i){A&&!L(Zr,u,i)||Jr(t,i,u[i])})),t},Zr=function propertyIsEnumerable(t){var i=toPropertyKey(t),u=L(jr,this,i);return!(this===Pr&&de(qr,i)&&!de(Wr,i))&&(!(u||!de(this,i)||!de(qr,i)||de(this,kr)&&this[kr][i])||u)},en=function getOwnPropertyDescriptor(t,i){var u=toIndexedObject(t),_=toPropertyKey(i);if(u!==Pr||!de(qr,_)||de(Wr,_)){var h=Br(u,_);return!h||!de(qr,_)||de(u,kr)&&u[kr][_]||(h.enumerable=!0),h}},tn=function getOwnPropertyNames(t){var i=Yr(toIndexedObject(t)),u=[];return Lr(i,(function(t){de(qr,t)||de(ot,t)||Kr(u,t)})),u},$getOwnPropertySymbols=function(t){var i=t===Pr,u=Yr(i?Wr:toIndexedObject(t)),_=[];return Lr(u,(function(t){!de(qr,t)||i&&!de(Pr,t)||Kr(_,qr[t])})),_};Q||(xr=function Symbol(){if(K(Ur,this))throw Fr("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?toString(arguments[0]):void 0,i=uid(t),setter=function(t){this===Pr&&L(setter,Wr,t),de(this,kr)&&de(this[kr],i)&&(this[kr][i]=!1),Xr(this,i,createPropertyDescriptor(1,t))};return A&&$r&&Xr(Pr,i,{configurable:!0,set:setter}),wrap$1(i,t)},Ur=xr.prototype,defineBuiltIn(Ur,"toString",(function toString(){return wr(this).tag})),defineBuiltIn(xr,"withoutSetter",(function(t){return wrap$1(uid(t),t)})),V.f=Zr,He.f=Jr,ut.f=Qr,Se.f=en,ar.f=dr.f=tn,_r.f=$getOwnPropertySymbols,pr.f=function(t){return wrap$1(wellKnownSymbol(t),t)},A&&Hr(Ur,"description",{configurable:!0,get:function description(){return wr(this).description}})),_export({global:!0,constructor:!0,wrap:!0,forced:!Q,sham:!Q},{Symbol:xr}),Lr(ct(zr),(function(t){wellKnownSymbolDefine(t)})),_export({target:Dr,stat:!0,forced:!Q},{useSetter:function(){$r=!0},useSimple:function(){$r=!1}}),_export({target:"Object",stat:!0,forced:!Q,sham:!A},{create:function create(t,i){return void 0===i?ht(t):Qr(ht(t),i)},defineProperty:Jr,defineProperties:Qr,getOwnPropertyDescriptor:en}),_export({target:"Object",stat:!0,forced:!Q},{getOwnPropertyNames:tn}),symbolDefineToPrimitive(),setToStringTag(xr,Dr),ot[kr]=!0;var rn=Q&&!!Symbol.for&&!!Symbol.keyFor,nn=ce("string-to-symbol-registry"),an=ce("symbol-to-string-registry");_export({target:"Symbol",stat:!0,forced:!rn},{for:function(t){var i=toString(t);if(de(nn,i))return nn[i];var u=getBuiltIn("Symbol")(i);return nn[i]=u,an[u]=i,u}});var sn=ce("symbol-to-string-registry");_export({target:"Symbol",stat:!0,forced:!rn},{keyFor:function keyFor(t){if(!te(t))throw TypeError(tryToString(t)+" is not a symbol");if(de(sn,t))return sn[t]}});var cn=getBuiltIn("JSON","stringify"),ln=R(/./.exec),un=R("".charAt),dn=R("".charCodeAt),_n=R("".replace),pn=R(1..toString),hn=/[\uD800-\uDFFF]/g,fn=/^[\uD800-\uDBFF]$/,En=/^[\uDC00-\uDFFF]$/,mn=!Q||fails((function(){var t=getBuiltIn("Symbol")();return"[null]"!=cn([t])||"{}"!=cn({a:t})||"{}"!=cn(Object(t))})),gn=fails((function(){return'"\\udf06\\ud834"'!==cn("\udf06\ud834")||'"\\udead"'!==cn("\udead")})),stringifyWithSymbolsFix=function(t,i){var u=Tt(arguments),_=i;if((Y(i)||void 0!==t)&&!te(t))return Lt(i)||(i=function(t,i){if(isCallable(_)&&(i=L(_,this,t,i)),!te(i))return i}),u[1]=i,T(cn,null,u)},fixIllFormed=function(t,i,u){var _=un(u,i-1),h=un(u,i+1);return ln(fn,t)&&!ln(En,h)||ln(En,t)&&!ln(fn,_)?"\\u"+pn(dn(t,0),16):t};cn&&_export({target:"JSON",stat:!0,arity:3,forced:mn||gn},{stringify:function stringify(t,i,u){var _=Tt(arguments),h=T(mn?stringifyWithSymbolsFix:cn,null,_);return gn&&"string"==typeof h?_n(h,hn,fixIllFormed):h}});var In=!Q||fails((function(){_r.f(1)}));_export({target:"Object",stat:!0,forced:In},{getOwnPropertySymbols:function getOwnPropertySymbols(t){var i=_r.f;return i?i(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(h.JSON,"JSON",!0);var vn,Tn,Nn,Mn=j.Symbol,On={},Sn=Function.prototype,Rn=A&&Object.getOwnPropertyDescriptor,yn=de(Sn,"name"),An={EXISTS:yn,PROPER:yn&&"something"===function something(){}.name,CONFIGURABLE:yn&&(!A||A&&Rn(Sn,"name").configurable)},Cn=!fails((function(){function F(){}return F.prototype.constructor=null,Object.getPrototypeOf(new F)!==F.prototype})),bn=sharedKey("IE_PROTO"),Ln=Object,kn=Ln.prototype,Dn=Cn?Ln.getPrototypeOf:function(t){var i=toObject(t);if(de(i,bn))return i[bn];var u=i.constructor;return isCallable(u)&&i instanceof u?u.prototype:i instanceof Ln?kn:null},Vn=wellKnownSymbol("iterator"),wn=!1;[].keys&&("next"in(Nn=[].keys())?(Tn=Dn(Dn(Nn)))!==Object.prototype&&(vn=Tn):wn=!0);var Pn=!Y(vn)||fails((function(){var t={};return vn[Vn].call(t)!==t}));vn=Pn?{}:ht(vn),isCallable(vn[Vn])||defineBuiltIn(vn,Vn,(function(){return this}));var xn={IteratorPrototype:vn,BUGGY_SAFARI_ITERATORS:wn},Un=xn.IteratorPrototype,returnThis$1=function(){return this},Fn=An.PROPER,Gn=xn.BUGGY_SAFARI_ITERATORS,Bn=wellKnownSymbol("iterator"),Hn="keys",Yn="values",jn="entries",returnThis=function(){return this},iteratorDefine=function(t,i,u,_,h,E,m){!function(t,i,u,_){var h=i+" Iterator";t.prototype=ht(Un,{next:createPropertyDescriptor(+!_,u)}),setToStringTag(t,h,!1,!0),On[h]=returnThis$1}(u,i,_);var I,v,T,getIterationMethod=function(t){if(t===h&&R)return R;if(!Gn&&t in O)return O[t];switch(t){case Hn:return function keys(){return new u(this,t)};case Yn:return function values(){return new u(this,t)};case jn:return function entries(){return new u(this,t)}}return function(){return new u(this)}},N=i+" Iterator",M=!1,O=t.prototype,S=O[Bn]||O["@@iterator"]||h&&O[h],R=!Gn&&S||getIterationMethod(h),A="Array"==i&&O.entries||S;if(A&&(I=Dn(A.call(new t)))!==Object.prototype&&I.next&&(setToStringTag(I,N,!0,!0),On[N]=returnThis),Fn&&h==Yn&&S&&S.name!==Yn&&(M=!0,R=function values(){return L(S,this)}),h)if(v={values:getIterationMethod(Yn),keys:E?R:getIterationMethod(Hn),entries:getIterationMethod(jn)},m)for(T in v)(Gn||M||!(T in O))&&defineBuiltIn(O,T,v[T]);else _export({target:i,proto:!0,forced:Gn||M},v);return m&&O[Bn]!==R&&defineBuiltIn(O,Bn,R,{name:h}),On[i]=R,v};He.f;var Kn="Array Iterator",qn=Ar.set,Wn=Ar.getterFor(Kn);iteratorDefine(Array,"Array",(function(t,i){qn(this,{type:Kn,target:toIndexedObject(t),index:0,kind:i})}),(function(){var t=Wn(this),i=t.target,u=t.kind,_=t.index++;return!i||_>=i.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==u?{value:_,done:!1}:"values"==u?{value:i[_],done:!1}:{value:[_,i[_]],done:!1}}),"values"),On.Arguments=On.Array;var zn=wellKnownSymbol("toStringTag");for(var $n 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 Xn=h[$n],Jn=Xn&&Xn.prototype;Jn&&Ut(Jn)!==zn&&Ye(Jn,zn,$n),On[$n]=On.Array}var Qn=Mn;wellKnownSymbolDefine("asyncDispose"),wellKnownSymbolDefine("dispose"),wellKnownSymbolDefine("matcher"),wellKnownSymbolDefine("metadataKey"),wellKnownSymbolDefine("observable"),wellKnownSymbolDefine("metadata"),wellKnownSymbolDefine("patternMatch"),wellKnownSymbolDefine("replaceAll");var Zn=Qn,eo=R("".charAt),to=R("".charCodeAt),ro=R("".slice),createMethod$3=function(t){return function(i,u){var _,h,E=toString(requireObjectCoercible(i)),m=toIntegerOrInfinity(u),I=E.length;return m<0||m>=I?t?"":void 0:(_=to(E,m))<55296||_>56319||m+1===I||(h=to(E,m+1))<56320||h>57343?t?eo(E,m):_:t?ro(E,m,m+2):h-56320+(_-55296<<10)+65536}},no={codeAt:createMethod$3(!1),charAt:createMethod$3(!0)},oo=no.charAt,io="String Iterator",ao=Ar.set,so=Ar.getterFor(io);iteratorDefine(String,"String",(function(t){ao(this,{type:io,string:toString(t),index:0})}),(function next(){var t,i=so(this),u=i.string,_=i.index;return _>=u.length?{value:void 0,done:!0}:(t=oo(u,_),i.index+=t.length,{value:t,done:!1})}));var co=pr.f("iterator"),lo=createCommonjsModule((function(t){function _typeof(i){return t.exports=_typeof="function"==typeof Zn&&"symbol"==typeof co?function(t){return typeof t}:function(t){return t&&"function"==typeof Zn&&t.constructor===Zn&&t!==Zn.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,_typeof(i)}t.exports=_typeof,t.exports.__esModule=!0,t.exports.default=t.exports})),uo=fails((function(){Dn(1)}));_export({target:"Object",stat:!0,forced:uo,sham:!Cn},{getPrototypeOf:function getPrototypeOf(t){return Dn(toObject(t))}});var _o=j.Object.getPrototypeOf,arrayMethodIsStrict=function(t,i){var u=[][t];return!!u&&fails((function(){u.call(null,i||function(){return 1},1)}))},po=br.forEach,ho=arrayMethodIsStrict("forEach")?[].forEach:function forEach(t){return po(this,t,arguments.length>1?arguments[1]:void 0)};_export({target:"Array",proto:!0,forced:[].forEach!=ho},{forEach:ho});var fo=entryVirtual("Array").forEach,Eo=Array.prototype,mo={DOMTokenList:!0,NodeList:!0},forEach$1=function(t){var i=t.forEach;return t===Eo||K(Eo,t)&&i===Eo.forEach||de(mo,Ut(t))?fo:i},go=R([].concat),Io=getBuiltIn("Reflect","ownKeys")||function ownKeys(t){var i=ar.f(anObject(t)),u=_r.f;return u?go(i,u(t)):i},vo=Error,To=R("".replace),No=String(vo("zxcasd").stack),Mo=/\n\s*at [^:]*:[^\n]*/,Oo=Mo.test(No),errorStackClear=function(t,i){if(Oo&&"string"==typeof t&&!vo.prepareStackTrace)for(;i--;)t=To(t,Mo,"");return t},installErrorCause=function(t,i){Y(i)&&"cause"in i&&Ye(t,"cause",i.cause)},So=wellKnownSymbol("iterator"),Ro=Array.prototype,isArrayIteratorMethod=function(t){return void 0!==t&&(On.Array===t||Ro[So]===t)},yo=wellKnownSymbol("iterator"),getIteratorMethod$5=function(t){if(!isNullOrUndefined(t))return getMethod(t,yo)||getMethod(t,"@@iterator")||On[Ut(t)]},Ao=TypeError,getIterator=function(t,i){var u=arguments.length<2?getIteratorMethod$5(t):i;if(aCallable(u))return anObject(L(u,t));throw Ao(tryToString(t)+" is not iterable")},iteratorClose=function(t,i,u){var _,h;anObject(t);try{if(!(_=getMethod(t,"return"))){if("throw"===i)throw u;return u}_=L(_,t)}catch(t){h=!0,_=t}if("throw"===i)throw u;if(h)throw _;return anObject(_),u},Co=TypeError,Result=function(t,i){this.stopped=t,this.result=i},bo=Result.prototype,iterate=function(t,i,u){var _,h,E,m,I,v,T,N=u&&u.that,M=!(!u||!u.AS_ENTRIES),O=!(!u||!u.IS_RECORD),S=!(!u||!u.IS_ITERATOR),R=!(!u||!u.INTERRUPTED),A=functionBindContext(i,N),stop=function(t){return _&&iteratorClose(_,"normal",t),new Result(!0,t)},callFn=function(t){return M?(anObject(t),R?A(t[0],t[1],stop):A(t[0],t[1])):R?A(t,stop):A(t)};if(O)_=t.iterator;else if(S)_=t;else{if(!(h=getIteratorMethod$5(t)))throw Co(tryToString(t)+" is not iterable");if(isArrayIteratorMethod(h)){for(E=0,m=lengthOfArrayLike(t);m>E;E++)if((I=callFn(t[E]))&&K(bo,I))return I;return new Result(!1)}_=getIterator(t,h)}for(v=O?t.next:_.next;!(T=L(v,_)).done;){try{I=callFn(T.value)}catch(t){iteratorClose(_,"throw",t)}if("object"==typeof I&&I&&K(bo,I))return I}return new Result(!1)},normalizeStringArgument=function(t,i){return void 0===t?arguments.length<2?"":i:toString(t)},Lo=!fails((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",createPropertyDescriptor(1,7)),7!==t.stack)})),ko=wellKnownSymbol("toStringTag"),Do=Error,Vo=[].push,wo=function AggregateError(t,i){var u,_=arguments.length>2?arguments[2]:void 0,h=K(Po,this);It?u=It(Do(),h?Dn(this):Po):(u=h?this:ht(Po),Ye(u,ko,"Error")),void 0!==i&&Ye(u,"message",normalizeStringArgument(i)),Lo&&Ye(u,"stack",errorStackClear(u.stack,1)),installErrorCause(u,_);var E=[];return iterate(t,Vo,{that:E}),Ye(u,"errors",E),u};It?It(wo,Do):function(t,i,u){for(var _=Io(i),h=He.f,E=Se.f,m=0;m<_.length;m++){var I=_[m];de(t,I)||u&&de(u,I)||h(t,I,E(i,I))}}(wo,Do,{name:!0});var Po=wo.prototype=ht(Do.prototype,{constructor:createPropertyDescriptor(1,wo),message:createPropertyDescriptor(1,""),name:createPropertyDescriptor(1,"AggregateError")});_export({global:!0,constructor:!0,arity:2},{AggregateError:wo});var xo,Uo,Fo,Go,Bo="process"==classofRaw(h.process),Ho=wellKnownSymbol("species"),setSpecies=function(t){var i=getBuiltIn(t),u=He.f;A&&i&&!i[Ho]&&u(i,Ho,{configurable:!0,get:function(){return this}})},Yo=TypeError,anInstance=function(t,i){if(K(i,t))return t;throw Yo("Incorrect invocation")},jo=TypeError,aConstructor=function(t){if(zt(t))return t;throw jo(tryToString(t)+" is not a constructor")},Ko=wellKnownSymbol("species"),speciesConstructor=function(t,i){var u,_=anObject(t).constructor;return void 0===_||isNullOrUndefined(u=anObject(_)[Ko])?i:aConstructor(u)},qo=TypeError,validateArgumentsLength=function(t,i){if(t<i)throw qo("Not enough arguments");return t},Wo=/(?:ipad|iphone|ipod).*applewebkit/i.test(q),zo=h.setImmediate,$o=h.clearImmediate,Xo=h.process,Jo=h.Dispatch,Qo=h.Function,Zo=h.MessageChannel,ei=h.String,ti=0,ri={},ni="onreadystatechange";try{xo=h.location}catch(t){}var run=function(t){if(de(ri,t)){var i=ri[t];delete ri[t],i()}},runner=function(t){return function(){run(t)}},listener=function(t){run(t.data)},post=function(t){h.postMessage(ei(t),xo.protocol+"//"+xo.host)};zo&&$o||(zo=function setImmediate(t){validateArgumentsLength(arguments.length,1);var i=isCallable(t)?t:Qo(t),u=Tt(arguments,1);return ri[++ti]=function(){T(i,void 0,u)},Uo(ti),ti},$o=function clearImmediate(t){delete ri[t]},Bo?Uo=function(t){Xo.nextTick(runner(t))}:Jo&&Jo.now?Uo=function(t){Jo.now(runner(t))}:Zo&&!Wo?(Go=(Fo=new Zo).port2,Fo.port1.onmessage=listener,Uo=functionBindContext(Go.postMessage,Go)):h.addEventListener&&isCallable(h.postMessage)&&!h.importScripts&&xo&&"file:"!==xo.protocol&&!fails(post)?(Uo=post,h.addEventListener("message",listener,!1)):Uo=ni in documentCreateElement("script")?function(t){dt.appendChild(documentCreateElement("script")).onreadystatechange=function(){dt.removeChild(this),run(t)}}:function(t){setTimeout(runner(t),0)});var oi,ii,ai,si,ci,li,ui,di,_i={set:zo,clear:$o},pi=/ipad|iphone|ipod/i.test(q)&&void 0!==h.Pebble,hi=/web0s(?!.*chrome)/i.test(q),fi=Se.f,Ei=_i.set,mi=h.MutationObserver||h.WebKitMutationObserver,gi=h.document,Ii=h.process,vi=h.Promise,Ti=fi(h,"queueMicrotask"),Ni=Ti&&Ti.value;Ni||(oi=function(){var t,i;for(Bo&&(t=Ii.domain)&&t.exit();ii;){i=ii.fn,ii=ii.next;try{i()}catch(t){throw ii?si():ai=void 0,t}}ai=void 0,t&&t.enter()},Wo||Bo||hi||!mi||!gi?!pi&&vi&&vi.resolve?((ui=vi.resolve(void 0)).constructor=vi,di=functionBindContext(ui.then,ui),si=function(){di(oi)}):Bo?si=function(){Ii.nextTick(oi)}:(Ei=functionBindContext(Ei,h),si=function(){Ei(oi)}):(ci=!0,li=gi.createTextNode(""),new mi(oi).observe(li,{characterData:!0}),si=function(){li.data=ci=!ci}));var Mi=Ni||function(t){var i={fn:t,next:void 0};ai&&(ai.next=i),ii||(ii=i,si()),ai=i},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 i={item:t,next:null};this.head?this.tail.next=i:this.head=i,this.tail=i},get:function(){var t=this.head;if(t)return this.head=t.next,this.tail===t&&(this.tail=null),t.item}};var Oi,Si,Ri=Queue,yi=h.Promise,Ai="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Ci=!Ai&&!Bo&&"object"==typeof window&&"object"==typeof document,bi=yi&&yi.prototype,Li=wellKnownSymbol("species"),ki=!1,Di=isCallable(h.PromiseRejectionEvent),Vi=Le("Promise",(function(){var t=Gt(yi),i=t!==String(yi);if(!i&&66===J)return!0;if(!bi.catch||!bi.finally)return!0;if(!J||J<51||!/native code/.test(t)){var u=new yi((function(t){t(1)})),FakePromise=function(t){t((function(){}),(function(){}))};if((u.constructor={})[Li]=FakePromise,!(ki=u.then((function(){}))instanceof FakePromise))return!0}return!i&&(Ci||Ai)&&!Di})),wi={CONSTRUCTOR:Vi,REJECTION_EVENT:Di,SUBCLASSING:ki},Pi=TypeError,PromiseCapability=function(t){var i,u;this.promise=new t((function(t,_){if(void 0!==i||void 0!==u)throw Pi("Bad Promise constructor");i=t,u=_})),this.resolve=aCallable(i),this.reject=aCallable(u)},xi={f:function(t){return new PromiseCapability(t)}},Ui=_i.set,Fi="Promise",Gi=wi.CONSTRUCTOR,Bi=wi.REJECTION_EVENT,Hi=Ar.getterFor(Fi),Yi=Ar.set,ji=yi&&yi.prototype,Ki=yi,qi=ji,Wi=h.TypeError,zi=h.document,$i=h.process,Xi=xi.f,Ji=Xi,Qi=!!(zi&&zi.createEvent&&h.dispatchEvent),Zi="unhandledrejection",isThenable=function(t){var i;return!(!Y(t)||!isCallable(i=t.then))&&i},callReaction=function(t,i){var u,_,h,E=i.value,m=1==i.state,I=m?t.ok:t.fail,v=t.resolve,T=t.reject,N=t.domain;try{I?(m||(2===i.rejection&&onHandleUnhandled(i),i.rejection=1),!0===I?u=E:(N&&N.enter(),u=I(E),N&&(N.exit(),h=!0)),u===t.promise?T(Wi("Promise-chain cycle")):(_=isThenable(u))?L(_,u,v,T):v(u)):T(E)}catch(t){N&&!h&&N.exit(),T(t)}},notify=function(t,i){t.notified||(t.notified=!0,Mi((function(){for(var u,_=t.reactions;u=_.get();)callReaction(u,t);t.notified=!1,i&&!t.rejection&&onUnhandled(t)})))},dispatchEvent=function(t,i,u){var _,E;Qi?((_=zi.createEvent("Event")).promise=i,_.reason=u,_.initEvent(t,!1,!0),h.dispatchEvent(_)):_={promise:i,reason:u},!Bi&&(E=h["on"+t])?E(_):t===Zi&&function(t,i){var u=h.console;u&&u.error&&(1==arguments.length?u.error(t):u.error(t,i))}("Unhandled promise rejection",u)},onUnhandled=function(t){L(Ui,h,(function(){var i,u=t.facade,_=t.value;if(isUnhandled(t)&&(i=perform((function(){Bo?$i.emit("unhandledRejection",_,u):dispatchEvent(Zi,u,_)})),t.rejection=Bo||isUnhandled(t)?2:1,i.error))throw i.value}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t){L(Ui,h,(function(){var i=t.facade;Bo?$i.emit("rejectionHandled",i):dispatchEvent("rejectionhandled",i,t.value)}))},bind=function(t,i,u){return function(_){t(i,_,u)}},internalReject=function(t,i,u){t.done||(t.done=!0,u&&(t=u),t.value=i,t.state=2,notify(t,!0))},internalResolve=function(t,i,u){if(!t.done){t.done=!0,u&&(t=u);try{if(t.facade===i)throw Wi("Promise can't be resolved itself");var _=isThenable(i);_?Mi((function(){var u={done:!1};try{L(_,i,bind(internalResolve,u,t),bind(internalReject,u,t))}catch(i){internalReject(u,i,t)}})):(t.value=i,t.state=1,notify(t,!1))}catch(i){internalReject({done:!1},i,t)}}};Gi&&(qi=(Ki=function Promise(t){anInstance(this,qi),aCallable(t),L(Oi,this);var i=Hi(this);try{t(bind(internalResolve,i),bind(internalReject,i))}catch(t){internalReject(i,t)}}).prototype,(Oi=function Promise(t){Yi(this,{type:Fi,done:!1,notified:!1,parent:!1,reactions:new Ri,rejection:!1,state:0,value:void 0})}).prototype=defineBuiltIn(qi,"then",(function then(t,i){var u=Hi(this),_=Xi(speciesConstructor(this,Ki));return u.parent=!0,_.ok=!isCallable(t)||t,_.fail=isCallable(i)&&i,_.domain=Bo?$i.domain:void 0,0==u.state?u.reactions.add(_):Mi((function(){callReaction(_,u)})),_.promise})),Si=function(){var t=new Oi,i=Hi(t);this.promise=t,this.resolve=bind(internalResolve,i),this.reject=bind(internalReject,i)},xi.f=Xi=function(t){return t===Ki||undefined===t?new Si(t):Ji(t)}),_export({global:!0,constructor:!0,wrap:!0,forced:Gi},{Promise:Ki}),setToStringTag(Ki,Fi,!1,!0),setSpecies(Fi);var ea=wellKnownSymbol("iterator"),ta=!1;try{var ra=0,na={next:function(){return{done:!!ra++}},return:function(){ta=!0}};na[ea]=function(){return this},Array.from(na,(function(){throw 2}))}catch(t){}var checkCorrectnessOfIteration=function(t,i){if(!i&&!ta)return!1;var u=!1;try{var _={};_[ea]=function(){return{next:function(){return{done:u=!0}}}},t(_)}catch(t){}return u},oa=wi.CONSTRUCTOR||!checkCorrectnessOfIteration((function(t){yi.all(t).then(void 0,(function(){}))}));_export({target:"Promise",stat:!0,forced:oa},{all:function all(t){var i=this,u=xi.f(i),_=u.resolve,h=u.reject,E=perform((function(){var u=aCallable(i.resolve),E=[],m=0,I=1;iterate(t,(function(t){var v=m++,T=!1;I++,L(u,i,t).then((function(t){T||(T=!0,E[v]=t,--I||_(E))}),h)})),--I||_(E)}));return E.error&&h(E.value),u.promise}});var ia=wi.CONSTRUCTOR;yi&&yi.prototype,_export({target:"Promise",proto:!0,forced:ia,real:!0},{catch:function(t){return this.then(void 0,t)}}),_export({target:"Promise",stat:!0,forced:oa},{race:function race(t){var i=this,u=xi.f(i),_=u.reject,h=perform((function(){var h=aCallable(i.resolve);iterate(t,(function(t){L(h,i,t).then(u.resolve,_)}))}));return h.error&&_(h.value),u.promise}}),_export({target:"Promise",stat:!0,forced:wi.CONSTRUCTOR},{reject:function reject(t){var i=xi.f(this);return L(i.reject,void 0,t),i.promise}});var promiseResolve=function(t,i){if(anObject(t),Y(i)&&i.constructor===t)return i;var u=xi.f(t);return(0,u.resolve)(i),u.promise},aa=wi.CONSTRUCTOR,sa=getBuiltIn("Promise"),ca=!aa;_export({target:"Promise",stat:!0,forced:!0},{resolve:function resolve(t){return promiseResolve(ca&&this===sa?yi:this,t)}}),_export({target:"Promise",stat:!0},{allSettled:function allSettled(t){var i=this,u=xi.f(i),_=u.resolve,h=u.reject,E=perform((function(){var u=aCallable(i.resolve),h=[],E=0,m=1;iterate(t,(function(t){var I=E++,v=!1;m++,L(u,i,t).then((function(t){v||(v=!0,h[I]={status:"fulfilled",value:t},--m||_(h))}),(function(t){v||(v=!0,h[I]={status:"rejected",reason:t},--m||_(h))}))})),--m||_(h)}));return E.error&&h(E.value),u.promise}});var la="No one promise resolved";_export({target:"Promise",stat:!0},{any:function any(t){var i=this,u=getBuiltIn("AggregateError"),_=xi.f(i),h=_.resolve,E=_.reject,m=perform((function(){var _=aCallable(i.resolve),m=[],I=0,v=1,T=!1;iterate(t,(function(t){var N=I++,M=!1;v++,L(_,i,t).then((function(t){M||T||(T=!0,h(t))}),(function(t){M||T||(M=!0,m[N]=t,--v||E(new u(m,la)))}))})),--v||E(new u(m,la))}));return m.error&&E(m.value),_.promise}});var ua=yi&&yi.prototype,da=!!yi&&fails((function(){ua.finally.call({then:function(){}},(function(){}))}));_export({target:"Promise",proto:!0,real:!0,forced:da},{finally:function(t){var i=speciesConstructor(this,getBuiltIn("Promise")),u=isCallable(t);return this.then(u?function(u){return promiseResolve(i,t()).then((function(){return u}))}:t,u?function(u){return promiseResolve(i,t()).then((function(){throw u}))}:t)}});var _a=j.Promise;_export({target:"Promise",stat:!0,forced:!0},{try:function(t){var i=xi.f(this),u=perform(t);return(u.error?i.reject:i.resolve)(u.value),i.promise}});var pa=_a,ha=R([].reverse),fa=[1,2];_export({target:"Array",proto:!0,forced:String(fa)===String(fa.reverse())},{reverse:function reverse(){return Lt(this)&&(this.length=this.length),ha(this)}});var Ea=entryVirtual("Array").reverse,ma=Array.prototype,reverse=function(t){var i=t.reverse;return t===ma||K(ma,t)&&i===ma.reverse?Ea:i},ga=arrayMethodHasSpeciesSupport("slice"),Ia=wellKnownSymbol("species"),va=Array,Ta=Math.max;_export({target:"Array",proto:!0,forced:!ga},{slice:function slice(t,i){var u,_,h,E=toIndexedObject(this),m=lengthOfArrayLike(E),I=toAbsoluteIndex(t,m),v=toAbsoluteIndex(void 0===i?m:i,m);if(Lt(E)&&(u=E.constructor,(zt(u)&&(u===va||Lt(u.prototype))||Y(u)&&null===(u=u[Ia]))&&(u=void 0),u===va||void 0===u))return Tt(E,I,v);for(_=new(void 0===u?va:u)(Ta(v-I,0)),h=0;I<v;I++,h++)I in E&&createProperty(_,h,E[I]);return _.length=h,_}});var Na=entryVirtual("Array").slice,Ma=Array.prototype,slice=function(t){var i=t.slice;return t===Ma||K(Ma,t)&&i===Ma.slice?Na:i},Oa=createCommonjsModule((function(t){var i=lo.default;function _regeneratorRuntime(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
t.exports=_regeneratorRuntime=function _regeneratorRuntime(){return u},t.exports.__esModule=!0,t.exports.default=t.exports;var u={},_=Object.prototype,h=_.hasOwnProperty,E="function"==typeof Zn?Zn:{},m=E.iterator||"@@iterator",I=E.asyncIterator||"@@asyncIterator",v=E.toStringTag||"@@toStringTag";function define(t,i,u){return ze(t,i,{value:u,enumerable:!0,configurable:!0,writable:!0}),t[i]}try{define({},"")}catch(t){define=function define(t,i,u){return t[i]=u}}function wrap(t,i,u,_){var h=i&&i.prototype instanceof Generator?i:Generator,E=Et(h.prototype),m=new Context(_||[]);return E._invoke=function(t,i,u){var _="suspendedStart";return function(h,E){if("executing"===_)throw new Error("Generator is already running");if("completed"===_){if("throw"===h)throw E;return doneResult()}for(u.method=h,u.arg=E;;){var m=u.delegate;if(m){var I=maybeInvokeDelegate(m,u);if(I){if(I===T)continue;return I}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===_)throw _="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);_="executing";var v=tryCatch(t,i,u);if("normal"===v.type){if(_=u.done?"completed":"suspendedYield",v.arg===T)continue;return{value:v.arg,done:u.done}}"throw"===v.type&&(_="completed",u.method="throw",u.arg=v.arg)}}}(t,u,m),E}function tryCatch(t,i,u){try{return{type:"normal",arg:t.call(i,u)}}catch(t){return{type:"throw",arg:t}}}u.wrap=wrap;var T={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var N={};define(N,m,(function(){return this}));var M=_o&&_o(_o(values([])));M&&M!==_&&h.call(M,m)&&(N=M);var O=GeneratorFunctionPrototype.prototype=Generator.prototype=Et(N);function defineIteratorMethods(t){var i;forEach$1(i=["next","throw","return"]).call(i,(function(i){define(t,i,(function(t){return this._invoke(i,t)}))}))}function AsyncIterator(t,u){function invoke(_,E,m,I){var v=tryCatch(t[_],t,E);if("throw"!==v.type){var T=v.arg,N=T.value;return N&&"object"==i(N)&&h.call(N,"__await")?u.resolve(N.__await).then((function(t){invoke("next",t,m,I)}),(function(t){invoke("throw",t,m,I)})):u.resolve(N).then((function(t){T.value=t,m(T)}),(function(t){return invoke("throw",t,m,I)}))}I(v.arg)}var _;this._invoke=function(t,i){function callInvokeWithMethodAndArg(){return new u((function(u,_){invoke(t,i,u,_)}))}return _=_?_.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,i){var u=t.iterator[i.method];if(void 0===u){if(i.delegate=null,"throw"===i.method){if(t.iterator.return&&(i.method="return",i.arg=void 0,maybeInvokeDelegate(t,i),"throw"===i.method))return T;i.method="throw",i.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var _=tryCatch(u,t.iterator,i.arg);if("throw"===_.type)return i.method="throw",i.arg=_.arg,i.delegate=null,T;var h=_.arg;return h?h.done?(i[t.resultName]=h.value,i.next=t.nextLoc,"return"!==i.method&&(i.method="next",i.arg=void 0),i.delegate=null,T):h:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,T)}function pushTryEntry(t){var i={tryLoc:t[0]};1 in t&&(i.catchLoc=t[1]),2 in t&&(i.finallyLoc=t[2],i.afterLoc=t[3]),this.tryEntries.push(i)}function resetTryEntry(t){var i=t.completion||{};i.type="normal",delete i.arg,t.completion=i}function Context(t){this.tryEntries=[{tryLoc:"root"}],forEach$1(t).call(t,pushTryEntry,this),this.reset(!0)}function values(t){if(t){var i=t[m];if(i)return i.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var u=-1,_=function next(){for(;++u<t.length;)if(h.call(t,u))return next.value=t[u],next.done=!1,next;return next.value=void 0,next.done=!0,next};return _.next=_}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(O,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,v,"GeneratorFunction"),u.isGeneratorFunction=function(t){var i="function"==typeof t&&t.constructor;return!!i&&(i===GeneratorFunction||"GeneratorFunction"===(i.displayName||i.name))},u.mark=function(t){return vt?vt(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,v,"GeneratorFunction")),t.prototype=Et(O),t},u.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,I,(function(){return this})),u.AsyncIterator=AsyncIterator,u.async=function(t,i,_,h,E){void 0===E&&(E=pa);var m=new AsyncIterator(wrap(t,i,_,h),E);return u.isGeneratorFunction(i)?m:m.next().then((function(t){return t.done?t.value:m.next()}))},defineIteratorMethods(O),define(O,v,"Generator"),define(O,m,(function(){return this})),define(O,"toString",(function(){return"[object Generator]"})),u.keys=function(t){var i=[];for(var u in t)i.push(u);return reverse(i).call(i),function next(){for(;i.length;){var u=i.pop();if(u in t)return next.value=u,next.done=!1,next}return next.done=!0,next}},u.values=values,Context.prototype={constructor:Context,reset:function reset(t){var i;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(i=this.tryEntries).call(i,resetTryEntry),!t)for(var u in this)"t"===u.charAt(0)&&h.call(this,u)&&!isNaN(+slice(u).call(u,1))&&(this[u]=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 i=this;function handle(u,_){return E.type="throw",E.arg=t,i.next=u,_&&(i.method="next",i.arg=void 0),!!_}for(var u=this.tryEntries.length-1;u>=0;--u){var _=this.tryEntries[u],E=_.completion;if("root"===_.tryLoc)return handle("end");if(_.tryLoc<=this.prev){var m=h.call(_,"catchLoc"),I=h.call(_,"finallyLoc");if(m&&I){if(this.prev<_.catchLoc)return handle(_.catchLoc,!0);if(this.prev<_.finallyLoc)return handle(_.finallyLoc)}else if(m){if(this.prev<_.catchLoc)return handle(_.catchLoc,!0)}else{if(!I)throw new Error("try statement without catch or finally");if(this.prev<_.finallyLoc)return handle(_.finallyLoc)}}}},abrupt:function abrupt(t,i){for(var u=this.tryEntries.length-1;u>=0;--u){var _=this.tryEntries[u];if(_.tryLoc<=this.prev&&h.call(_,"finallyLoc")&&this.prev<_.finallyLoc){var E=_;break}}E&&("break"===t||"continue"===t)&&E.tryLoc<=i&&i<=E.finallyLoc&&(E=null);var m=E?E.completion:{};return m.type=t,m.arg=i,E?(this.method="next",this.next=E.finallyLoc,T):this.complete(m)},complete:function complete(t,i){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&&i&&(this.next=i),T},finish:function finish(t){for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i];if(u.finallyLoc===t)return this.complete(u.completion,u.afterLoc),resetTryEntry(u),T}},catch:function _catch(t){for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i];if(u.tryLoc===t){var _=u.completion;if("throw"===_.type){var h=_.arg;resetTryEntry(u)}return h}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,i,u){return this.delegate={iterator:values(t),resultName:i,nextLoc:u},"next"===this.method&&(this.arg=void 0),T}},u}t.exports=_regeneratorRuntime,t.exports.__esModule=!0,t.exports.default=t.exports})),Sa=Oa(),Ra=Sa;try{regeneratorRuntime=Sa}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=Sa:Function("r","regeneratorRuntime = r")(Sa)}var ya=Object.assign,Aa=Object.defineProperty,Ca=R([].concat),ba=!ya||fails((function(){if(A&&1!==ya({b:1},ya(Aa({},"a",{enumerable:!0,get:function(){Aa(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},i={},u=Symbol(),_="abcdefghijklmnopqrst";return t[u]=7,_.split("").forEach((function(t){i[t]=t})),7!=ya({},t)[u]||ct(ya({},i)).join("")!=_}))?function assign(t,i){for(var u=toObject(t),_=arguments.length,h=1,E=_r.f,m=V.f;_>h;)for(var I,v=G(arguments[h++]),T=E?Ca(ct(v),E(v)):ct(v),N=T.length,M=0;N>M;)I=T[M++],A&&!L(m,v,I)||(u[I]=v[I]);return u}:ya;_export({target:"Object",stat:!0,arity:2,forced:Object.assign!==ba},{assign:ba});var La=j.Object.assign,ka=V.f,Da=R(ka),Va=R([].push),createMethod$2=function(t){return function(i){for(var u,_=toIndexedObject(i),h=ct(_),E=h.length,m=0,I=[];E>m;)u=h[m++],A&&!Da(_,u)||Va(I,t?[u,_[u]]:_[u]);return I}},wa={entries:createMethod$2(!0),values:createMethod$2(!1)}.values;_export({target:"Object",stat:!0},{values:function values(t){return wa(t)}});var Pa=j.Object.values;j.JSON||(j.JSON={stringify:JSON.stringify});var xa=function stringify(t,i,u){return T(j.JSON.stringify,null,arguments)},Ua=xa;_export({target:"Array",stat:!0},{isArray:Lt});var Fa=j.Array.isArray,Ga=entryVirtual("Array").concat,Ba=Array.prototype,concat=function(t){var i=t.concat;return t===Ba||K(Ba,t)&&i===Ba.concat?Ga:i};function __rest(t,i){var u={};for(var _ in t)Object.prototype.hasOwnProperty.call(t,_)&&i.indexOf(_)<0&&(u[_]=t[_]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(_=Object.getOwnPropertySymbols(t);h<_.length;h++)i.indexOf(_[h])<0&&Object.prototype.propertyIsEnumerable.call(t,_[h])&&(u[_[h]]=t[_[h]])}return u}function __awaiter(t,i,u,_){return new(u||(u=Promise))((function(h,E){function fulfilled(t){try{step(_.next(t))}catch(t){E(t)}}function rejected(t){try{step(_.throw(t))}catch(t){E(t)}}function step(t){t.done?h(t.value):function adopt(t){return t instanceof u?t:new u((function(i){i(t)}))}(t.value).then(fulfilled,rejected)}step((_=_.apply(t,i||[])).next())}))}_export({global:!0},{globalThis:h});var Ha=h,Ya=Date,ja=R(Ya.prototype.getTime);_export({target:"Date",stat:!0},{now:function now(){return ja(new Ya)}});var Ka=j.Date.now,qa=br.find,Wa="find",za=!0;Wa in[]&&Array(1).find((function(){za=!1})),_export({target:"Array",proto:!0,forced:za},{find:function find(t){return qa(this,t,arguments.length>1?arguments[1]:void 0)}});var $a=entryVirtual("Array").find,Xa=Array.prototype,find=function(t){var i=t.find;return t===Xa||K(Xa,t)&&i===Xa.find?$a:i},Ja=nt.includes,Qa=fails((function(){return!Array(1).includes()}));_export({target:"Array",proto:!0,forced:Qa},{includes:function includes(t){return Ja(this,t,arguments.length>1?arguments[1]:void 0)}});var Za=entryVirtual("Array").includes,es=wellKnownSymbol("match"),ts=TypeError,notARegexp=function(t){if(function(t){var i;return Y(t)&&(void 0!==(i=t[es])?!!i:"RegExp"==classofRaw(t))}(t))throw ts("The method doesn't accept regular expressions");return t},rs=wellKnownSymbol("match"),ns=R("".indexOf);_export({target:"String",proto:!0,forced:!function(t){var i=/./;try{"/./"[t](i)}catch(u){try{return i[rs]=!1,"/./"[t](i)}catch(t){}}return!1}("includes")},{includes:function includes(t){return!!~ns(toString(requireObjectCoercible(this)),toString(notARegexp(t)),arguments.length>1?arguments[1]:void 0)}});var os=entryVirtual("String").includes,is=Array.prototype,as=String.prototype,includes=function(t){var i=t.includes;return t===is||K(is,t)&&i===is.includes?Za:"string"==typeof t||t===as||K(as,t)&&i===as.includes?os:i},ss=fails((function(){ct(1)}));_export({target:"Object",stat:!0,forced:ss},{keys:function keys(t){return ct(toObject(t))}});var cs=j.Object.keys,ls=br.map,us=arrayMethodHasSpeciesSupport("map");_export({target:"Array",proto:!0,forced:!us},{map:function map(t){return ls(this,t,arguments.length>1?arguments[1]:void 0)}});var ds=entryVirtual("Array").map,_s=Array.prototype,map$7=function(t){var i=t.map;return t===_s||K(_s,t)&&i===_s.map?ds:i},ps=/MSIE .\./.test(q),hs=h.Function,wrap=function(t){return ps?function(i,u){var _=validateArgumentsLength(arguments.length,1)>2,h=isCallable(i)?i:hs(i),E=_?Tt(arguments,2):void 0;return t(_?function(){T(h,this,E)}:h,u)}:t},fs={setTimeout:wrap(h.setTimeout),setInterval:wrap(h.setInterval)},Es=fs.setInterval;_export({global:!0,bind:!0,forced:h.setInterval!==Es},{setInterval:Es});var ms=fs.setTimeout;_export({global:!0,bind:!0,forced:h.setTimeout!==ms},{setTimeout:ms});var gs=j.setTimeout,Is=br.filter,vs=arrayMethodHasSpeciesSupport("filter");_export({target:"Array",proto:!0,forced:!vs},{filter:function filter(t){return Is(this,t,arguments.length>1?arguments[1]:void 0)}});var Ts=entryVirtual("Array").filter,Ns=Array.prototype,filter=function(t){var i=t.filter;return t===Ns||K(Ns,t)&&i===Ns.filter?Ts:i},Ms=createCommonjsModule((function(t,i){t.exports=function(){function _regeneratorRuntime(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
_regeneratorRuntime=function _regeneratorRuntime(){return t};var t={},i=Object.prototype,u=i.hasOwnProperty,_="function"==typeof Zn?Zn:{},h=_.iterator||"@@iterator",E=_.asyncIterator||"@@asyncIterator",m=_.toStringTag||"@@toStringTag";function define(t,i,u){return ze(t,i,{value:u,enumerable:!0,configurable:!0,writable:!0}),t[i]}try{define({},"")}catch(t){define=function define(t,i,u){return t[i]=u}}function wrap(t,i,u,_){var h=i&&i.prototype instanceof Generator?i:Generator,E=Et(h.prototype),m=new Context(_||[]);return E._invoke=function(t,i,u){var _="suspendedStart";return function(h,E){if("executing"===_)throw new Error("Generator is already running");if("completed"===_){if("throw"===h)throw E;return doneResult()}for(u.method=h,u.arg=E;;){var m=u.delegate;if(m){var v=maybeInvokeDelegate(m,u);if(v){if(v===I)continue;return v}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if("suspendedStart"===_)throw _="completed",u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);_="executing";var T=tryCatch(t,i,u);if("normal"===T.type){if(_=u.done?"completed":"suspendedYield",T.arg===I)continue;return{value:T.arg,done:u.done}}"throw"===T.type&&(_="completed",u.method="throw",u.arg=T.arg)}}}(t,u,m),E}function tryCatch(t,i,u){try{return{type:"normal",arg:t.call(i,u)}}catch(t){return{type:"throw",arg:t}}}t.wrap=wrap;var I={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var v={};define(v,h,(function(){return this}));var T=_o&&_o(_o(values([])));T&&T!==i&&u.call(T,h)&&(v=T);var N=GeneratorFunctionPrototype.prototype=Generator.prototype=Et(v);function defineIteratorMethods(t){var i;forEach$1(i=["next","throw","return"]).call(i,(function(i){define(t,i,(function(t){return this._invoke(i,t)}))}))}function AsyncIterator(t,i){function invoke(_,h,E,m){var I=tryCatch(t[_],t,h);if("throw"!==I.type){var v=I.arg,T=v.value;return T&&"object"==typeof T&&u.call(T,"__await")?i.resolve(T.__await).then((function(t){invoke("next",t,E,m)}),(function(t){invoke("throw",t,E,m)})):i.resolve(T).then((function(t){v.value=t,E(v)}),(function(t){return invoke("throw",t,E,m)}))}m(I.arg)}var _;this._invoke=function(t,u){function callInvokeWithMethodAndArg(){return new i((function(i,_){invoke(t,u,i,_)}))}return _=_?_.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,i){var u=t.iterator[i.method];if(void 0===u){if(i.delegate=null,"throw"===i.method){if(t.iterator.return&&(i.method="return",i.arg=void 0,maybeInvokeDelegate(t,i),"throw"===i.method))return I;i.method="throw",i.arg=new TypeError("The iterator does not provide a 'throw' method")}return I}var _=tryCatch(u,t.iterator,i.arg);if("throw"===_.type)return i.method="throw",i.arg=_.arg,i.delegate=null,I;var h=_.arg;return h?h.done?(i[t.resultName]=h.value,i.next=t.nextLoc,"return"!==i.method&&(i.method="next",i.arg=void 0),i.delegate=null,I):h:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,I)}function pushTryEntry(t){var i={tryLoc:t[0]};1 in t&&(i.catchLoc=t[1]),2 in t&&(i.finallyLoc=t[2],i.afterLoc=t[3]),this.tryEntries.push(i)}function resetTryEntry(t){var i=t.completion||{};i.type="normal",delete i.arg,t.completion=i}function Context(t){this.tryEntries=[{tryLoc:"root"}],forEach$1(t).call(t,pushTryEntry,this),this.reset(!0)}function values(t){if(t){var i=t[h];if(i)return i.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var _=-1,E=function next(){for(;++_<t.length;)if(u.call(t,_))return next.value=t[_],next.done=!1,next;return next.value=void 0,next.done=!0,next};return E.next=E}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(N,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,m,"GeneratorFunction"),t.isGeneratorFunction=function(t){var i="function"==typeof t&&t.constructor;return!!i&&(i===GeneratorFunction||"GeneratorFunction"===(i.displayName||i.name))},t.mark=function(t){return vt?vt(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,m,"GeneratorFunction")),t.prototype=Et(N),t},t.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,E,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(i,u,_,h,E){void 0===E&&(E=pa);var m=new AsyncIterator(wrap(i,u,_,h),E);return t.isGeneratorFunction(u)?m:m.next().then((function(t){return t.done?t.value:m.next()}))},defineIteratorMethods(N),define(N,m,"Generator"),define(N,h,(function(){return this})),define(N,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var i=[];for(var u in t)i.push(u);return reverse(i).call(i),function next(){for(;i.length;){var u=i.pop();if(u in t)return next.value=u,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function reset(t){var i;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(i=this.tryEntries).call(i,resetTryEntry),!t)for(var _ in this)"t"===_.charAt(0)&&u.call(this,_)&&!isNaN(+slice(_).call(_,1))&&(this[_]=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 i=this;function handle(u,_){return E.type="throw",E.arg=t,i.next=u,_&&(i.method="next",i.arg=void 0),!!_}for(var _=this.tryEntries.length-1;_>=0;--_){var h=this.tryEntries[_],E=h.completion;if("root"===h.tryLoc)return handle("end");if(h.tryLoc<=this.prev){var m=u.call(h,"catchLoc"),I=u.call(h,"finallyLoc");if(m&&I){if(this.prev<h.catchLoc)return handle(h.catchLoc,!0);if(this.prev<h.finallyLoc)return handle(h.finallyLoc)}else if(m){if(this.prev<h.catchLoc)return handle(h.catchLoc,!0)}else{if(!I)throw new Error("try statement without catch or finally");if(this.prev<h.finallyLoc)return handle(h.finallyLoc)}}}},abrupt:function abrupt(t,i){for(var _=this.tryEntries.length-1;_>=0;--_){var h=this.tryEntries[_];if(h.tryLoc<=this.prev&&u.call(h,"finallyLoc")&&this.prev<h.finallyLoc){var E=h;break}}E&&("break"===t||"continue"===t)&&E.tryLoc<=i&&i<=E.finallyLoc&&(E=null);var m=E?E.completion:{};return m.type=t,m.arg=i,E?(this.method="next",this.next=E.finallyLoc,I):this.complete(m)},complete:function complete(t,i){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&&i&&(this.next=i),I},finish:function finish(t){for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i];if(u.finallyLoc===t)return this.complete(u.completion,u.afterLoc),resetTryEntry(u),I}},catch:function _catch(t){for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i];if(u.tryLoc===t){var _=u.completion;if("throw"===_.type){var h=_.arg;resetTryEntry(u)}return h}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,i,u){return this.delegate={iterator:values(t),resultName:i,nextLoc:u},"next"===this.method&&(this.arg=void 0),I}},t}function _typeof(t){return _typeof="function"==typeof Zn&&"symbol"==typeof co?function(t){return typeof t}:function(t){return t&&"function"==typeof Zn&&t.constructor===Zn&&t!==Zn.prototype?"symbol":typeof t},_typeof(t)}function _classCallCheck(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,i){for(var u=0;u<i.length;u++){var _=i[u];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),ze(t,_.key,_)}}function _createClass(t,i,u){return i&&_defineProperties(t.prototype,i),u&&_defineProperties(t,u),ze(t,"prototype",{writable:!1}),t}function __awaiter(t,i,u,_){function adopt(t){return t instanceof u?t:new u((function(i){i(t)}))}return new(u||(u=pa))((function(u,h){function fulfilled(t){try{step(_.next(t))}catch(t){h(t)}}function rejected(t){try{step(_.throw(t))}catch(t){h(t)}}function step(t){t.done?u(t.value):adopt(t.value).then(fulfilled,rejected)}step((_=_.apply(t,i||[])).next())}))}var t={isDataReportEnable:!0,maxSize:100,msgListMaxSize:1e3,cacheMaxSize:1e3,maxDelay:3e5,maxInterval:3e4,minInterval:1e4,timeout:5e3,autoStart:!0,loginFailIgnoreInterval:72e5},i=12,u=8e3,_=function emptyFn(){},h=function(){function Reporter(i){_classCallCheck(this,Reporter),this.isUploadEnable=!0,this.serverAllowUpload=!1,this.initConfigLoaded=!1,this.loading=!1,this.isDestroyed=!1,this.reportConfig=t,this.configPath="dispatcher/req",this.dataReportPath="statics/report/common/form",this.traceMsgCache={},this.reqRetryCount=0,this.highPriorityMsgList=[],this.msgList=[],this.lowPriorityMsgList=[],this.cacheMsgList=[],this.lastReportTime=Ka(),this.timer=null,this.endedAsyncMsgByModule={},this.lastFailLogin={},this.setConfig(i),this.reportConfig.isDataReportEnable&&this.reportConfig.autoStart&&this.initUploadConfig()}return _createClass(Reporter,[{key:"setConfig",value:function setConfig(t){var i=La({},this.reportConfig.common,t.common);this.reportConfig=La({},this.reportConfig,t),this.reportConfig.common=i,this.reportConfig.common.sdk_type||(this.reportConfig.common.sdk_type="im")}},{key:"reportImmediately",value:function reportImmediately(t,i){var u=this;this.reportConfig.isDataReportEnable&&this.reportConfig.request(t,La({dataType:"json",method:"POST",timeout:this.reportConfig.timeout},i)).catch((function(t){var i,_;null===(_=null===(i=u.reportConfig)||void 0===i?void 0:i.logger)||void 0===_||_.warn("Reporter immediately upload failed",t)}))}},{key:"report",value:function report(i,u){var _=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_.priority||(_.priority=this.getEventPriority(i,u)),this.reportConfig.isDataReportEnable&&i){if("login"===i&&!1===u.succeed&&u.process_id){var h,E=u.extension&&find(h=u.extension).call(h,(function(t){return"TCP"===t.operation_type})),m=E&&E.target||"",I=u.process_id+m,v=this.lastFailLogin[I]||0;if(u.start_time-v<t.loginFailIgnoreInterval)return;this.lastFailLogin[I]=u.start_time}var T=Ka();"HIGH"===_.priority?this.highPriorityMsgList.push({module:i,msg:u,createTime:T}):"NORMAL"===_.priority?this.msgList.push({module:i,msg:u,createTime:T}):"LOW"===_.priority&&this.lowPriorityMsgList.push({module:i,msg:u,createTime:T}),this.highPriorityMsgList.length>this.reportConfig.msgListMaxSize&&this.highPriorityMsgList.shift(),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,i){if(this.reportConfig.isDataReportEnable&&t&&!this.traceMsgCache[t]){var u=La(La({start_time:Ka()},i),{extension:[]});this.traceMsgCache[t]=u}}},{key:"reportTraceUpdate",value:function reportTraceUpdate(t){}},{key:"reportTraceUpdateV2",value:function reportTraceUpdateV2(t,i,u){var _,h=this;if(this.reportConfig.isDataReportEnable&&this.traceMsgCache[t]){var E=this.traceMsgCache[t].extension,m=E.length,I=(new Date).getTime();0===m?i.duration=I-this.traceMsgCache[t].start_time:E[m-1].end_time?i.duration=I-E[m-1].end_time:i.duration=I-this.traceMsgCache[t].start_time,E.push(La({end_time:I},i));var v=E.length-1;(null==u?void 0:u.asyncParams)&&((_=this.traceMsgCache[t]).asyncPromiseArray||(_.asyncPromiseArray=[]),this.traceMsgCache[t].asyncPromiseArray.push(u.asyncParams.then((function(i){h.traceMsgCache[t]&&h.traceMsgCache[t].extension[v]&&La(h.traceMsgCache[t].extension[v],i)}))))}}},{key:"reportTraceEnd",value:function reportTraceEnd(t){var i,u,_=this,h=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.reportConfig.isDataReportEnable&&this.traceMsgCache[t])if("nos"!==t||!1===h){"boolean"==typeof h?this.traceMsgCache[t].succeed=!!h:this.traceMsgCache[t].state=h,this.traceMsgCache[t].duration=Ka()-this.traceMsgCache[t].start_time,forEach$1(i=this.traceMsgCache[t].extension).call(i,(function(t){delete t.end_time}));var E=this.traceMsgCache[t];if(this.traceMsgCache[t]=null,E.asyncPromiseArray){(u=this.endedAsyncMsgByModule)[t]||(u[t]=[]),this.endedAsyncMsgByModule[t].push(E);var m=function asyncCallback(){var i;_.endedAsyncMsgByModule[t]&&includes(i=_.endedAsyncMsgByModule[t]).call(i,E)&&(delete E.asyncPromiseArray,_.report(t,E,{priority:_.getEventPriority(t,E)}))};pa.all(E.asyncPromiseArray).then(m).catch(m)}else this.report(t,E,{priority:this.getEventPriority(t,E)})}else this.traceMsgCache[t]=null}},{key:"getEventPriority",value:function getEventPriority(t,i){if("exceptions"===t){if(0===i.action)return"HIGH";if(2===i.action)return"HIGH";if(1===i.action&&0!==i.exception_service)return"HIGH"}else{if("msgReceive"===t)return"LOW";if("nim_api_trace"===t)return"LOW"}return"NORMAL"}},{key:"reportTraceCancel",value:function reportTraceCancel(t){this.reportConfig.isDataReportEnable&&(this.endedAsyncMsgByModule[t]=[],this.traceMsgCache[t]=null)}},{key:"pause",value:function pause(){this.reportConfig.isDataReportEnable&&(this.isUploadEnable=!1)}},{key:"restore",value:function restore(){this.reportConfig.isDataReportEnable&&(this.isUploadEnable=!0,this.initConfigLoaded||this.initUploadConfig())}},{key:"destroy",value:function destroy(){var t,i=this;this.reportConfig.isDataReportEnable&&(forEach$1(t=cs(this.traceMsgCache)).call(t,(function(t){i.reportTraceEnd(t,1)})),null!==this.timer&&clearTimeout(this.timer),this.setConfig=_,this.report=_,this.reportTraceStart=_,this.reportTraceUpdate=_,this.reportTraceEnd=_,this.pause=_,this.restore=_,this.destroy=_,this.reqRetryCount=0,this.cacheMsgList=[],this.traceMsgCache={},this.lowPriorityMsgList=[],this.msgList=[],this.highPriorityMsgList=[],this.reportConfig={},this.isDestroyed=!0)}},{key:"initUploadConfig",value:function initUploadConfig(){var t,_;return __awaiter(this,void 0,void 0,_regeneratorRuntime().mark((function _callee(){var h,E,m,I,v,T=this;return _regeneratorRuntime().wrap((function _callee$(N){for(var M;;)switch(N.prev=N.next){case 0:if(!this.loading){N.next=2;break}return N.abrupt("return");case 2:this.loading=!0,h=this.reportConfig.common||{},E=map$7(M=this.reportConfig.compassDataEndpoint.split(",")).call(M,(function(t){var i;return concat(i="".concat(t,"/")).call(i,T.configPath)})),m=_regeneratorRuntime().mark((function _loop(m){return _regeneratorRuntime().wrap((function _loop$(I){for(;;)switch(I.prev=I.next){case 0:if(!T.initConfigLoaded&&!T.isDestroyed){I.next=2;break}return I.abrupt("return","break");case 2:return I.prev=2,I.next=5,T.reportConfig.request(E[m],{method:"GET",dataType:"json",params:{deviceId:h.dev_id,sdkVer:h.sdk_ver,platform:h.platform,hostEnv:h.host_env,appkey:h.app_key},timeout:T.reportConfig.timeout}).then((function(t){var i,u;if(!T.isDestroyed){if(200===t.status&&t.data&&200===t.data.code){T.initConfigLoaded=!0;var _=t.data.data||{};T.reportConfig.maxSize=_.maxSize>1e3?1e3:_.maxSize,T.reportConfig.maxInterval=_.maxInterval>1e4?1e4:_.maxInterval,T.reportConfig.maxInterval=_.maxInterval<10?10:_.maxInterval,T.reportConfig.minInterval=_.minInterval<2?2:_.minInterval,T.reportConfig.maxDelay=_.maxDelay||300,T.reportConfig.maxInterval=1e3*T.reportConfig.maxInterval,T.reportConfig.minInterval=1e3*T.reportConfig.minInterval,T.reportConfig.maxDelay=1e3*T.reportConfig.maxDelay,_.endpoint?T.dataReportEndpoint=_.endpoint:T.dataReportEndpoint=E[m],T.serverAllowUpload=!0,T.loading=!1,T.reportHeartBeat()}else 200===t.status&&(T.initConfigLoaded=!0);null===(u=null===(i=T.reportConfig)||void 0===i?void 0:i.logger)||void 0===u||u.log("Get reporter upload config success")}})).catch((function(t){var _,h;T.isDestroyed||(T.loading=!1,null===(h=null===(_=T.reportConfig)||void 0===_?void 0:_.logger)||void 0===h||h.error("Get reporter upload config failed",t),T.reqRetryCount<i&&(T.reqRetryCount++,gs((function(){T.isDestroyed||T.initUploadConfig()}),u)))}));case 5:I.next=14;break;case 7:if(I.prev=7,I.t0=I.catch(2),!T.isDestroyed){I.next=11;break}return I.abrupt("return",{v:void 0});case 11:T.loading=!1,null===(_=null===(t=T.reportConfig)||void 0===t?void 0:t.logger)||void 0===_||_.error("Exec reporter request failed",I.t0),T.reqRetryCount<i&&(T.reqRetryCount++,gs((function(){T.isDestroyed||T.initUploadConfig()}),u));case 14:case"end":return I.stop()}}),_loop,null,[[2,7]])})),I=0;case 7:if(!(I<E.length)){N.next=17;break}return N.delegateYield(m(I),"t0",9);case 9:if("break"!==(v=N.t0)){N.next=12;break}return N.abrupt("break",17);case 12:if("object"!==_typeof(v)){N.next=14;break}return N.abrupt("return",v.v);case 14:I++,N.next=7;break;case 17:case"end":return N.stop()}}),_callee,this)})))}},{key:"reportHeartBeat",value:function reportHeartBeat(){var t=this;this.isDestroyed||(this.timer=gs((function(){t.reportHeartBeat()}),this.reportConfig.minInterval),this.doReport())}},{key:"doReport",value:function doReport(){if(!this.isDestroyed){var t=this.highPriorityMsgList.length+this.msgList.length+this.lowPriorityMsgList.length+this.cacheMsgList.length>2*this.reportConfig.maxSize?this.reportConfig.minInterval:this.reportConfig.maxInterval;Ka()-this.lastReportTime>=t&&this.upload()}}},{key:"getUploadMsg",value:function getUploadMsg(){var t,i,u,_,h,E,m=this,I={},v=Ka();this.highPriorityMsgList=filter(t=this.highPriorityMsgList).call(t,(function(t){return v-t.createTime<m.reportConfig.maxDelay})),this.msgList=filter(i=this.msgList).call(i,(function(t){return v-t.createTime<m.reportConfig.maxDelay})),this.lowPriorityMsgList=filter(u=this.lowPriorityMsgList).call(u,(function(t){return v-t.createTime<m.reportConfig.maxDelay})),this.cacheMsgList=filter(_=this.cacheMsgList).call(_,(function(t){return v-t.createTime<m.reportConfig.maxDelay}));var T=slice(h=this.highPriorityMsgList).call(h,0,this.reportConfig.maxSize);if(this.highPriorityMsgList=slice(E=this.highPriorityMsgList).call(E,T.length),T.length<this.reportConfig.maxSize){var N,M,O=this.reportConfig.maxSize-T.length;T=concat(T).call(T,slice(N=this.msgList).call(N,0,O)),this.msgList=slice(M=this.msgList).call(M,O)}if(T.length<this.reportConfig.maxSize){var S,R,A=this.reportConfig.maxSize-T.length;T=concat(T).call(T,slice(S=this.lowPriorityMsgList).call(S,0,A)),this.lowPriorityMsgList=slice(R=this.lowPriorityMsgList).call(R,A)}if(T.length<this.reportConfig.maxSize){var C,L,k=this.reportConfig.maxSize-T.length;T=concat(T).call(T,slice(C=this.cacheMsgList).call(C,0,k)),this.cacheMsgList=slice(L=this.cacheMsgList).call(L,k)}return forEach$1(T).call(T,(function(t){I[t.module]?I[t.module].push(t.msg):I[t.module]=[t.msg]})),{uploadMsgArr:T,uploadMsg:I}}},{key:"upload",value:function upload(){var t,i,u=this;if(this.isUploadEnable&&this.serverAllowUpload&&!(this.lastReportTime&&Ka()-this.lastReportTime<this.reportConfig.minInterval)){var _=this.getUploadMsg(),h=_.uploadMsgArr,E=_.uploadMsg;if(h.length){this.lastReportTime=Ka();try{var m,I=concat(m="".concat(this.dataReportEndpoint,"/")).call(m,this.dataReportPath);this.reportConfig.request(I,{dataType:"json",method:"POST",data:{common:this.reportConfig.common,event:E},headers:{sdktype:"im"},timeout:this.reportConfig.timeout}).catch((function(t){var i,_,E,m;u.cacheMsgList=slice(i=concat(_=u.cacheMsgList).call(_,h)).call(i,0,u.reportConfig.cacheMaxSize),null===(m=null===(E=u.reportConfig)||void 0===E?void 0:E.logger)||void 0===m||m.warn("Reporter upload failed",t)}))}catch(u){null===(i=null===(t=this.reportConfig)||void 0===t?void 0:t.logger)||void 0===i||i.warn("Exec reporter request failed",u)}clearTimeout(this.timer),this.reportHeartBeat()}}}}]),Reporter}();return h}()}));function isPlainObject(t){return null!=t&&"object"==typeof t&&_o(t)==Object.prototype}function merge$1(t,i){var u=isPlainObject(t)||Fa(t),_=isPlainObject(i)||Fa(i);if(u&&_){for(var h in i){var E=merge$1(t[h],i[h]);void 0!==E&&(t[h]=E)}return t}return i}var Os={setLogger:function setLogger(t){throw new Error("setLogger not implemented.")},platform:"",WebSocket:function(){function AdapterSocket(t,i){throw this.CONNECTING=0,this.OPEN=1,this.CLOSING=2,this.CLOSED=3,this.binaryType="",new Error("Method not implemented.")}var t=AdapterSocket.prototype;return t.close=function close(t,i){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,i){throw new Error("request not implemented.")},uploadFile:function uploadFile(t){throw new Error("uploadFile not implemented.")},getSystemInfo:function getSystemInfo(){throw new Error("getSystemInfo not implemented.")},getFileUploadInformation:function getFileUploadInformation(t){throw new Error("getFileUploadInformation not implemented.")},envPayload:{},net:{getNetworkStatus:function getNetworkStatus(){return pa.resolve({net_type:0,net_connect:!0})},onNetworkStatusChange:function onNetworkStatusChange(t){},offNetworkStatusChange:function offNetworkStatusChange(){}},powerMonitor:{isActive:function isActive(){return!0},getStatus:function getStatus(){return 0},setStatus:function setStatus(t){},destroy:function destroy(){}},logStorage:function(){function AdapterLogStorageImpl(t){}var t=AdapterLogStorageImpl.prototype;return t.open=function open(){return pa.resolve()},t.close=function close(){},t.addLogs=function addLogs(t){return pa.resolve()},t.extractLogs=function extractLogs(){return pa.resolve()},t.afterUpload=function afterUpload(){return pa.resolve()},AdapterLogStorageImpl}()};var Ss=nt.indexOf,Rs=R([].indexOf),ys=!!Rs&&1/Rs([1],1,-0)<0,As=arrayMethodIsStrict("indexOf");_export({target:"Array",proto:!0,forced:ys||!As},{indexOf:function indexOf(t){var i=arguments.length>1?arguments[1]:void 0;return ys?Rs(this,t,i)||0:Ss(this,t,i)}});var Cs=entryVirtual("Array").indexOf,bs=Array.prototype,indexOf=function(t){var i=t.indexOf;return t===bs||K(bs,t)&&i===bs.indexOf?Cs:i},Ls=br.findIndex,ks="findIndex",Ds=!0;ks in[]&&Array(1).findIndex((function(){Ds=!1})),_export({target:"Array",proto:!0,forced:Ds},{findIndex:function findIndex(t){return Ls(this,t,arguments.length>1?arguments[1]:void 0)}});var Vs=entryVirtual("Array").findIndex,ws=Array.prototype,findIndex=function(t){var i=t.findIndex;return t===ws||K(ws,t)&&i===ws.findIndex?Vs:i},Ps=fails((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),xs=Object.isExtensible,Us=fails((function(){xs(1)}))||Ps?function isExtensible(t){return!!Y(t)&&((!Ps||"ArrayBuffer"!=classofRaw(t))&&(!xs||xs(t)))}:xs,Fs=!fails((function(){return Object.isExtensible(Object.preventExtensions({}))})),Gs=createCommonjsModule((function(t){var i=He.f,u=!1,_=uid("meta"),h=0,setMetadata=function(t){i(t,_,{value:{objectID:"O"+h++,weakData:{}}})},E=t.exports={enable:function(){E.enable=function(){},u=!0;var t=ar.f,i=R([].splice),h={};h[_]=1,t(h).length&&(ar.f=function(u){for(var h=t(u),E=0,m=h.length;E<m;E++)if(h[E]===_){i(h,E,1);break}return h},_export({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:dr.f}))},fastKey:function(t,i){if(!Y(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!de(t,_)){if(!Us(t))return"F";if(!i)return"E";setMetadata(t)}return t[_].objectID},getWeakData:function(t,i){if(!de(t,_)){if(!Us(t))return!0;if(!i)return!1;setMetadata(t)}return t[_].weakData},onFreeze:function(t){return Fs&&u&&Us(t)&&!de(t,_)&&setMetadata(t),t}};ot[_]=!0})),Bs=He.f,Hs=br.forEach,Ys=Ar.set,js=Ar.getterFor,defineBuiltIns=function(t,i,u){for(var _ in i)u&&u.unsafe&&t[_]?t[_]=i[_]:defineBuiltIn(t,_,i[_],u);return t},Ks=He.f,qs=Gs.fastKey,Ws=Ar.set,zs=Ar.getterFor,$s={getConstructor:function(t,i,u,_){var h=t((function(t,h){anInstance(t,E),Ws(t,{type:i,index:ht(null),first:void 0,last:void 0,size:0}),A||(t.size=0),isNullOrUndefined(h)||iterate(h,t[_],{that:t,AS_ENTRIES:u})})),E=h.prototype,m=zs(i),define=function(t,i,u){var _,h,E=m(t),I=getEntry(t,i);return I?I.value=u:(E.last=I={index:h=qs(i,!0),key:i,value:u,previous:_=E.last,next:void 0,removed:!1},E.first||(E.first=I),_&&(_.next=I),A?E.size++:t.size++,"F"!==h&&(E.index[h]=I)),t},getEntry=function(t,i){var u,_=m(t),h=qs(i);if("F"!==h)return _.index[h];for(u=_.first;u;u=u.next)if(u.key==i)return u};return defineBuiltIns(E,{clear:function clear(){for(var t=m(this),i=t.index,u=t.first;u;)u.removed=!0,u.previous&&(u.previous=u.previous.next=void 0),delete i[u.index],u=u.next;t.first=t.last=void 0,A?t.size=0:this.size=0},delete:function(t){var i=this,u=m(i),_=getEntry(i,t);if(_){var h=_.next,E=_.previous;delete u.index[_.index],_.removed=!0,E&&(E.next=h),h&&(h.previous=E),u.first==_&&(u.first=h),u.last==_&&(u.last=E),A?u.size--:i.size--}return!!_},forEach:function forEach(t){for(var i,u=m(this),_=functionBindContext(t,arguments.length>1?arguments[1]:void 0);i=i?i.next:u.first;)for(_(i.value,i.key,this);i&&i.removed;)i=i.previous},has:function has(t){return!!getEntry(this,t)}}),defineBuiltIns(E,u?{get:function get(t){var i=getEntry(this,t);return i&&i.value},set:function set(t,i){return define(this,0===t?0:t,i)}}:{add:function add(t){return define(this,t=0===t?0:t,t)}}),A&&Ks(E,"size",{get:function(){return m(this).size}}),h},setStrong:function(t,i,u){var _=i+" Iterator",h=zs(i),E=zs(_);iteratorDefine(t,i,(function(t,i){Ws(this,{type:_,target:t,state:h(t),kind:i,last:void 0})}),(function(){for(var t=E(this),i=t.kind,u=t.last;u&&u.removed;)u=u.previous;return t.target&&(t.last=u=u?u.next:t.state.first)?"keys"==i?{value:u.key,done:!1}:"values"==i?{value:u.value,done:!1}:{value:[u.key,u.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),u?"entries":"values",!u,!0),setSpecies(i)}};!function(t,i,u){var _,E=-1!==t.indexOf("Map"),m=-1!==t.indexOf("Weak"),I=E?"set":"add",v=h[t],T=v&&v.prototype,N={};if(A&&isCallable(v)&&(m||T.forEach&&!fails((function(){(new v).entries().next()})))){var M=(_=i((function(i,u){Ys(anInstance(i,M),{type:t,collection:new v}),null!=u&&iterate(u,i[I],{that:i,AS_ENTRIES:E})}))).prototype,O=js(t);Hs(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(t){var i="add"==t||"set"==t;!(t in T)||m&&"clear"==t||Ye(M,t,(function(u,_){var h=O(this).collection;if(!i&&m&&!Y(u))return"get"==t&&void 0;var E=h[t](0===u?0:u,_);return i?this:E}))})),m||Bs(M,"size",{configurable:!0,get:function(){return O(this).collection.size}})}else _=u.getConstructor(i,t,E,I),Gs.enable();setToStringTag(_,t,!1,!0),N[t]=_,_export({global:!0,forced:!0},N),m||u.setStrong(_,t,E)}("Map",(function(t){return function Map(){return t(this,arguments.length?arguments[0]:void 0)}}),$s);var Xs=j.Map,Js=[].push;_export({target:"Map",stat:!0,forced:!0},{from:function from(t){var i,u,_,h,E=arguments.length,m=E>1?arguments[1]:void 0;return aConstructor(this),(i=void 0!==m)&&aCallable(m),isNullOrUndefined(t)?new this:(u=[],i?(_=0,h=functionBindContext(m,E>2?arguments[2]:void 0),iterate(t,(function(t){L(Js,u,h(t,_++))}))):iterate(t,Js,{that:u}),new this(u))}});_export({target:"Map",stat:!0,forced:!0},{of:function of(){return new this(Tt(arguments))}});_export({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:function deleteAll(){for(var t,i=anObject(this),u=aCallable(i.delete),_=!0,h=0,E=arguments.length;h<E;h++)t=L(u,i,arguments[h]),_=_&&t;return!!_}});_export({target:"Map",proto:!0,real:!0,forced:!0},{emplace:function emplace(t,i){var u,_,h=anObject(this),E=aCallable(h.get),m=aCallable(h.has),I=aCallable(h.set);return L(m,h,t)?(u=L(E,h,t),"update"in i&&(u=i.update(u,t,h),L(I,h,t,u)),u):(_=i.insert(t,h),L(I,h,t,_),_)}});var Qs=getIterator;_export({target:"Map",proto:!0,real:!0,forced:!0},{every:function every(t){var i=anObject(this),u=Qs(i),_=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return!iterate(u,(function(t,u,h){if(!_(u,t,i))return h()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{filter:function filter(t){var i=anObject(this),u=Qs(i),_=functionBindContext(t,arguments.length>1?arguments[1]:void 0),h=new(speciesConstructor(i,getBuiltIn("Map"))),E=aCallable(h.set);return iterate(u,(function(t,u){_(u,t,i)&&L(E,h,t,u)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),h}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{find:function find(t){var i=anObject(this),u=Qs(i),_=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u,h){if(_(u,t,i))return h(u)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function findKey(t){var i=anObject(this),u=Qs(i),_=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u,h){if(_(u,t,i))return h(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var Zs=R([].push);_export({target:"Map",stat:!0,forced:!0},{groupBy:function groupBy(t,i){aCallable(i);var u=getIterator(t),_=new this,h=aCallable(_.has),E=aCallable(_.get),m=aCallable(_.set);return iterate(u,(function(t){var u=i(t);L(h,_,u)?Zs(L(E,_,u),t):L(m,_,u,[t])}),{IS_ITERATOR:!0}),_}});_export({target:"Map",proto:!0,real:!0,forced:!0},{includes:function includes(t){return iterate(Qs(anObject(this)),(function(i,u,_){if((h=u)===(E=t)||h!=h&&E!=E)return _();var h,E}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),_export({target:"Map",stat:!0,forced:!0},{keyBy:function keyBy(t,i){var u=new this;aCallable(i);var _=aCallable(u.set);return iterate(t,(function(t){L(_,u,i(t),t)})),u}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function keyOf(t){return iterate(Qs(anObject(this)),(function(i,u,_){if(u===t)return _(i)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function mapKeys(t){var i=anObject(this),u=Qs(i),_=functionBindContext(t,arguments.length>1?arguments[1]:void 0),h=new(speciesConstructor(i,getBuiltIn("Map"))),E=aCallable(h.set);return iterate(u,(function(t,u){L(E,h,_(u,t,i),u)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),h}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function mapValues(t){var i=anObject(this),u=Qs(i),_=functionBindContext(t,arguments.length>1?arguments[1]:void 0),h=new(speciesConstructor(i,getBuiltIn("Map"))),E=aCallable(h.set);return iterate(u,(function(t,u){L(E,h,t,_(u,t,i))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),h}}),_export({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function merge(t){for(var i=anObject(this),u=aCallable(i.set),_=arguments.length,h=0;h<_;)iterate(arguments[h++],u,{that:i,AS_ENTRIES:!0});return i}});var ec=TypeError;_export({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function reduce(t){var i=anObject(this),u=Qs(i),_=arguments.length<2,h=_?void 0:arguments[1];if(aCallable(t),iterate(u,(function(u,E){_?(_=!1,h=E):h=t(h,E,u,i)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),_)throw ec("Reduce of empty map with no initial value");return h}}),_export({target:"Map",proto:!0,real:!0,forced:!0},{some:function some(t){var i=anObject(this),u=Qs(i),_=functionBindContext(t,arguments.length>1?arguments[1]:void 0);return iterate(u,(function(t,u,h){if(_(u,t,i))return h()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var tc=TypeError;_export({target:"Map",proto:!0,real:!0,forced:!0},{update:function update(t,i){var u=anObject(this),_=aCallable(u.get),h=aCallable(u.has),E=aCallable(u.set),m=arguments.length;aCallable(i);var I=L(h,u,t);if(!I&&m<3)throw tc("Updating absent value");var v=I?L(_,u,t):aCallable(m>2?arguments[2]:void 0)(t,u);return L(E,u,t,i(v,t,u)),u}});var rc=TypeError,nc=function upsert(t,i){var u,_=anObject(this),h=aCallable(_.get),E=aCallable(_.has),m=aCallable(_.set),I=arguments.length>2?arguments[2]:void 0;if(!isCallable(i)&&!isCallable(I))throw rc("At least one callback required");return L(E,_,t)?(u=L(h,_,t),isCallable(i)&&(u=i(u),L(m,_,t,u))):isCallable(I)&&(u=I(),L(m,_,t,u)),u};_export({target:"Map",proto:!0,real:!0,forced:!0},{upsert:nc}),_export({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:nc});var oc=Xs,ic=createCommonjsModule((function(t){function _getPrototypeOf(i){var u;return t.exports=_getPrototypeOf=vt?bind$1(u=_o).call(u):function _getPrototypeOf(t){return t.__proto__||_o(t)},t.exports.__esModule=!0,t.exports.default=t.exports,_getPrototypeOf(i)}t.exports=_getPrototypeOf,t.exports.__esModule=!0,t.exports.default=t.exports})),ac=createCommonjsModule((function(t){t.exports=function _isNativeFunction(t){var i;return-1!==indexOf(i=Function.toString.call(t)).call(i,"[native code]")},t.exports.__esModule=!0,t.exports.default=t.exports})),sc=getBuiltIn("Reflect","construct"),cc=Object.prototype,lc=[].push,uc=fails((function(){function F(){}return!(sc((function(){}),[],F)instanceof F)})),dc=!fails((function(){sc((function(){}))})),_c=uc||dc;_export({target:"Reflect",stat:!0,forced:_c,sham:_c},{construct:function construct(t,i){aConstructor(t),anObject(i);var u=arguments.length<3?t:aConstructor(arguments[2]);if(dc&&!uc)return sc(t,i,u);if(t==u){switch(i.length){case 0:return new t;case 1:return new t(i[0]);case 2:return new t(i[0],i[1]);case 3:return new t(i[0],i[1],i[2]);case 4:return new t(i[0],i[1],i[2],i[3])}var _=[null];return T(lc,_,i),new(T(Rt,t,_))}var h=u.prototype,E=ht(Y(h)?h:cc),m=T(t,E,i);return Y(m)?m:E}});var pc=j.Reflect.construct,hc=createCommonjsModule((function(t){t.exports=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!pc)return!1;if(pc.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(pc(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.__esModule=!0,t.exports.default=t.exports})),fc=createCommonjsModule((function(t){function _construct(i,u,_){var h;hc()?(t.exports=_construct=bind$1(h=pc).call(h),t.exports.__esModule=!0,t.exports.default=t.exports):(t.exports=_construct=function _construct(t,i,u){var _=[null];_.push.apply(_,i);var h=new(bind$1(Function).apply(t,_));return u&&Ct(h,u.prototype),h},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})),Ec=createCommonjsModule((function(t){function _wrapNativeSuper(i){var u="function"==typeof oc?new oc: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!==u){if(u.has(t))return u.get(t);u.set(t,Wrapper)}function Wrapper(){return fc(t,arguments,ic(this).constructor)}return Wrapper.prototype=Et(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),Ct(Wrapper,t)},t.exports.__esModule=!0,t.exports.default=t.exports,_wrapNativeSuper(i)}t.exports=_wrapNativeSuper,t.exports.__esModule=!0,t.exports.default=t.exports})),mc=getDefaultExportFromCjs(Ec),gc=TypeError,createMethod$1=function(t){return function(i,u,_,h){aCallable(u);var E=toObject(i),m=G(E),I=lengthOfArrayLike(E),v=t?I-1:0,T=t?-1:1;if(_<2)for(;;){if(v in m){h=m[v],v+=T;break}if(v+=T,t?v<0:I<=v)throw gc("Reduce of empty array with no initial value")}for(;t?v>=0:I>v;v+=T)v in m&&(h=u(h,m[v],v,E));return h}},Ic={left:createMethod$1(!1),right:createMethod$1(!0)}.left,vc=arrayMethodIsStrict("reduce");_export({target:"Array",proto:!0,forced:!vc||!Bo&&J>79&&J<83},{reduce:function reduce(t){var i=arguments.length;return Ic(this,t,i,i>1?arguments[1]:void 0)}});var Tc,Nc,Mc,Oc,Sc,Rc,yc,Ac,Cc,bc,Lc,kc,Dc,Vc,wc,Pc,xc,Uc,Fc,Gc,Bc,Hc,Yc,jc,Kc,qc,Wc,zc,$c,Xc,Jc,Qc,Zc,el,tl,rl,nl,ol,il,al,sl,cl,ll,ul,dl,_l,pl,hl,fl,El,ml,gl,Il,vl,Tl,Nl,Ml,Ol=entryVirtual("Array").reduce,Sl=Array.prototype,reduce=function(t){var i=t.reduce;return t===Sl||K(Sl,t)&&i===Sl.reduce?Ol:i};!function(t){t[t.V2NIM_DATA_SYNC_TYPE_LEVEL_FULL=0]="V2NIM_DATA_SYNC_TYPE_LEVEL_FULL",t[t.V2NIM_DATA_SYNC_TYPE_LEVEL_BASIC=1]="V2NIM_DATA_SYNC_TYPE_LEVEL_BASIC"}(Tc||(Tc={})),function(t){t[t.V2NIM_DATA_SYNC_TYPE_MAIN=1]="V2NIM_DATA_SYNC_TYPE_MAIN",t[t.V2NIM_DATA_SYNC_TYPE_TEAM_MEMBER=2]="V2NIM_DATA_SYNC_TYPE_TEAM_MEMBER",t[t.V2NIM_DATA_SYNC_TYPE_SUPER_TEAM_MEMBER=3]="V2NIM_DATA_SYNC_TYPE_SUPER_TEAM_MEMBER"}(Nc||(Nc={})),function(t){t[t.V2NIM_DATA_SYNC_STATE_WAITING=1]="V2NIM_DATA_SYNC_STATE_WAITING",t[t.V2NIM_DATA_SYNC_STATE_SYNCING=2]="V2NIM_DATA_SYNC_STATE_SYNCING",t[t.V2NIM_DATA_SYNC_STATE_COMPLETED=3]="V2NIM_DATA_SYNC_STATE_COMPLETED"}(Mc||(Mc={})),function(t){t[t.V2NIM_CONVERSATION_TYPE_UNKNOWN=0]="V2NIM_CONVERSATION_TYPE_UNKNOWN",t[t.V2NIM_CONVERSATION_TYPE_P2P=1]="V2NIM_CONVERSATION_TYPE_P2P",t[t.V2NIM_CONVERSATION_TYPE_TEAM=2]="V2NIM_CONVERSATION_TYPE_TEAM",t[t.V2NIM_CONVERSATION_TYPE_SUPER_TEAM=3]="V2NIM_CONVERSATION_TYPE_SUPER_TEAM"}(Oc||(Oc={})),function(t){t[t.V2NIM_MESSAGE_STATUS_DEFAULT=0]="V2NIM_MESSAGE_STATUS_DEFAULT",t[t.V2NIM_MESSAGE_STATUS_REVOKE=1]="V2NIM_MESSAGE_STATUS_REVOKE",t[t.V2NIM_MESSAGE_STATUS_BACKFILL=2]="V2NIM_MESSAGE_STATUS_BACKFILL"}(Sc||(Sc={})),function(t){t[t.V2NIM_FRIEND_MODE_TYPE_ADD=1]="V2NIM_FRIEND_MODE_TYPE_ADD",t[t.V2NIM_FRIEND_MODE_TYPE_APPLY=2]="V2NIM_FRIEND_MODE_TYPE_APPLY"}(Rc||(Rc={})),function(t){t[t.V2NIM_FRIEND_ADD_APPLICATION_TYPE_LEGACY=0]="V2NIM_FRIEND_ADD_APPLICATION_TYPE_LEGACY",t[t.V2NIM_FRIEND_ADD_APPLICATION_TYPE_FROM_SELF=1]="V2NIM_FRIEND_ADD_APPLICATION_TYPE_FROM_SELF",t[t.V2NIM_FRIEND_ADD_APPLICATION_TYPE_TO_SELF=2]="V2NIM_FRIEND_ADD_APPLICATION_TYPE_TO_SELF",t[t.V2NIM_FRIEND_ADD_APPLICATION_TYPE_ALL=3]="V2NIM_FRIEND_ADD_APPLICATION_TYPE_ALL"}(yc||(yc={})),function(t){t[t.V2NIM_FRIEND_ADD_APPLICATION_STATUS_INIT=0]="V2NIM_FRIEND_ADD_APPLICATION_STATUS_INIT",t[t.V2NIM_FRIEND_ADD_APPLICATION_STATUS_AGREED=1]="V2NIM_FRIEND_ADD_APPLICATION_STATUS_AGREED",t[t.V2NIM_FRIEND_ADD_APPLICATION_STATUS_REJECTED=2]="V2NIM_FRIEND_ADD_APPLICATION_STATUS_REJECTED",t[t.V2NIM_FRIEND_ADD_APPLICATION_STATUS_EXPIRED=3]="V2NIM_FRIEND_ADD_APPLICATION_STATUS_EXPIRED",t[t.V2NIM_FRIEND_ADD_APPLICATION_STATUS_DIRECT_ADD=4]="V2NIM_FRIEND_ADD_APPLICATION_STATUS_DIRECT_ADD"}(Ac||(Ac={})),function(t){t[t.V2NIM_FRIEND_DELETION_TYPE_BY_SELF=1]="V2NIM_FRIEND_DELETION_TYPE_BY_SELF",t[t.V2NIM_FRIEND_DELETION_TYPE_BY_PEER=2]="V2NIM_FRIEND_DELETION_TYPE_BY_PEER"}(Cc||(Cc={})),function(t){t[t.V2NIM_FRIEND_VERIFY_TYPE_ADD=1]="V2NIM_FRIEND_VERIFY_TYPE_ADD",t[t.V2NIM_FRIEND_VERIFY_TYPE_APPLY=2]="V2NIM_FRIEND_VERIFY_TYPE_APPLY",t[t.V2NIM_FRIEND_VERIFY_TYPE_ACCEPT=3]="V2NIM_FRIEND_VERIFY_TYPE_ACCEPT",t[t.V2NIM_FRIEND_VERIFY_TYPE_REJECT=4]="V2NIM_FRIEND_VERIFY_TYPE_REJECT"}(bc||(bc={})),function(t){t[t.V2NIM_LOGIN_AUTH_TYPE_DEFAULT=0]="V2NIM_LOGIN_AUTH_TYPE_DEFAULT",t[t.V2NIM_LOGIN_AUTH_TYPE_DYNAMIC_TOKEN=1]="V2NIM_LOGIN_AUTH_TYPE_DYNAMIC_TOKEN",t[t.V2NIM_LOGIN_AUTH_TYPE_THIRD_PARTY=2]="V2NIM_LOGIN_AUTH_TYPE_THIRD_PARTY"}(Lc||(Lc={})),function(t){t[t.V2NIM_LOGIN_STATUS_LOGOUT=0]="V2NIM_LOGIN_STATUS_LOGOUT",t[t.V2NIM_LOGIN_STATUS_LOGINED=1]="V2NIM_LOGIN_STATUS_LOGINED",t[t.V2NIM_LOGIN_STATUS_LOGINING=2]="V2NIM_LOGIN_STATUS_LOGINING",t[t.V2NIM_LOGIN_STATUS_UNLOGIN=3]="V2NIM_LOGIN_STATUS_UNLOGIN"}(kc||(kc={})),function(t){t[t.V2NIM_LOGIN_CLIENT_TYPE_UNKNOWN=0]="V2NIM_LOGIN_CLIENT_TYPE_UNKNOWN",t[t.V2NIM_LOGIN_CLIENT_TYPE_ANDROID=1]="V2NIM_LOGIN_CLIENT_TYPE_ANDROID",t[t.V2NIM_LOGIN_CLIENT_TYPE_IOS=2]="V2NIM_LOGIN_CLIENT_TYPE_IOS",t[t.V2NIM_LOGIN_CLIENT_TYPE_PC=4]="V2NIM_LOGIN_CLIENT_TYPE_PC",t[t.V2NIM_LOGIN_CLIENT_TYPE_WP=8]="V2NIM_LOGIN_CLIENT_TYPE_WP",t[t.V2NIM_LOGIN_CLIENT_TYPE_WEB=16]="V2NIM_LOGIN_CLIENT_TYPE_WEB",t[t.V2NIM_LOGIN_CLIENT_TYPE_RESTFUL=32]="V2NIM_LOGIN_CLIENT_TYPE_RESTFUL",t[t.V2NIM_LOGIN_CLIENT_TYPE_MAC_OS=64]="V2NIM_LOGIN_CLIENT_TYPE_MAC_OS",t[t.V2NIM_LOGIN_CLIENT_TYPE_HARMONY_OS=65]="V2NIM_LOGIN_CLIENT_TYPE_HARMONY_OS"}(Dc||(Dc={})),function(t){t[t.V2NIM_KICKED_OFFLINE_REASON_CLIENT_EXCLUSIVE=1]="V2NIM_KICKED_OFFLINE_REASON_CLIENT_EXCLUSIVE",t[t.V2NIM_KICKED_OFFLINE_REASON_SERVER=2]="V2NIM_KICKED_OFFLINE_REASON_SERVER",t[t.V2NIM_KICKED_OFFLINE_REASON_CLIENT=3]="V2NIM_KICKED_OFFLINE_REASON_CLIENT",t[t.V2NIM_KICKED_OFFLINE_REASON_CLIENT_QUIETLY=4]="V2NIM_KICKED_OFFLINE_REASON_CLIENT_QUIETLY"}(Vc||(Vc={})),function(t){t[t.V2NIM_LOGIN_CLIENT_CHANGE_LIST=1]="V2NIM_LOGIN_CLIENT_CHANGE_LIST",t[t.V2NIM_LOGIN_CLIENT_CHANGE_LOGIN=2]="V2NIM_LOGIN_CLIENT_CHANGE_LOGIN",t[t.V2NIM_LOGIN_CLIENT_CHANGE_LOGOUT=3]="V2NIM_LOGIN_CLIENT_CHANGE_LOGOUT"}(wc||(wc={})),function(t){t[t.V2NIM_CONNECT_STATUS_DISCONNECTED=0]="V2NIM_CONNECT_STATUS_DISCONNECTED",t[t.V2NIM_CONNECT_STATUS_CONNECTED=1]="V2NIM_CONNECT_STATUS_CONNECTED",t[t.V2NIM_CONNECT_STATUS_CONNECTING=2]="V2NIM_CONNECT_STATUS_CONNECTING",t[t.V2NIM_CONNECT_STATUS_WAITING=3]="V2NIM_CONNECT_STATUS_WAITING"}(Pc||(Pc={})),function(t){t[t.NIM_MESSAGE_AI_STREAM_STATUS_STREAMING=-1]="NIM_MESSAGE_AI_STREAM_STATUS_STREAMING",t[t.NIM_MESSAGE_AI_STREAM_STATUS_NONE=0]="NIM_MESSAGE_AI_STREAM_STATUS_NONE",t[t.NIM_MESSAGE_AI_STREAM_STATUS_PLACEHOLDER=1]="NIM_MESSAGE_AI_STREAM_STATUS_PLACEHOLDER",t[t.NIM_MESSAGE_AI_STREAM_STATUS_CANCEL=2]="NIM_MESSAGE_AI_STREAM_STATUS_CANCEL",t[t.NIM_MESSAGE_AI_STREAM_STATUS_UPDATE=3]="NIM_MESSAGE_AI_STREAM_STATUS_UPDATE",t[t.NIM_MESSAGE_AI_STREAM_STATUS_COMPLETE=4]="NIM_MESSAGE_AI_STREAM_STATUS_COMPLETE",t[t.NIM_MESSAGE_AI_STREAM_STATUS_EXCEPTION=5]="NIM_MESSAGE_AI_STREAM_STATUS_EXCEPTION"}(xc||(xc={})),function(t){t[t.V2NIM_MESSAGE_AI_STREAM_STOP_OP_DEFAULT=0]="V2NIM_MESSAGE_AI_STREAM_STOP_OP_DEFAULT",t[t.V2NIM_MESSAGE_AI_STREAM_STOP_OP_REVOKE=1]="V2NIM_MESSAGE_AI_STREAM_STOP_OP_REVOKE",t[t.V2NIM_MESSAGE_AI_STREAM_STOP_OP_UPDATE=2]="V2NIM_MESSAGE_AI_STREAM_STOP_OP_UPDATE"}(Uc||(Uc={})),function(t){t[t.V2NIM_MESSAGE_AI_REGEN_OP_UPDATE=1]="V2NIM_MESSAGE_AI_REGEN_OP_UPDATE",t[t.V2NIM_MESSAGE_AI_REGEN_OP_NEW=2]="V2NIM_MESSAGE_AI_REGEN_OP_NEW"}(Fc||(Fc={})),function(t){t[t.V2NIM_MESSAGE_AI_STATUS_UNKNOW=0]="V2NIM_MESSAGE_AI_STATUS_UNKNOW",t[t.V2NIM_MESSAGE_AI_STATUS_AT=1]="V2NIM_MESSAGE_AI_STATUS_AT",t[t.V2NIM_MESSAGE_AI_STATUS_RESPONSE=2]="V2NIM_MESSAGE_AI_STATUS_RESPONSE"}(Gc||(Gc={})),function(t){t[t.V2NIM_MESSAGE_TYPE_INVALID=-1]="V2NIM_MESSAGE_TYPE_INVALID",t[t.V2NIM_MESSAGE_TYPE_TEXT=0]="V2NIM_MESSAGE_TYPE_TEXT",t[t.V2NIM_MESSAGE_TYPE_IMAGE=1]="V2NIM_MESSAGE_TYPE_IMAGE",t[t.V2NIM_MESSAGE_TYPE_AUDIO=2]="V2NIM_MESSAGE_TYPE_AUDIO",t[t.V2NIM_MESSAGE_TYPE_VIDEO=3]="V2NIM_MESSAGE_TYPE_VIDEO",t[t.V2NIM_MESSAGE_TYPE_LOCATION=4]="V2NIM_MESSAGE_TYPE_LOCATION",t[t.V2NIM_MESSAGE_TYPE_NOTIFICATION=5]="V2NIM_MESSAGE_TYPE_NOTIFICATION",t[t.V2NIM_MESSAGE_TYPE_FILE=6]="V2NIM_MESSAGE_TYPE_FILE",t[t.V2NIM_MESSAGE_TYPE_AVCHAT=7]="V2NIM_MESSAGE_TYPE_AVCHAT",t[t.V2NIM_MESSAGE_TYPE_TIPS=10]="V2NIM_MESSAGE_TYPE_TIPS",t[t.V2NIM_MESSAGE_TYPE_ROBOT=11]="V2NIM_MESSAGE_TYPE_ROBOT",t[t.V2NIM_MESSAGE_TYPE_CALL=12]="V2NIM_MESSAGE_TYPE_CALL",t[t.V2NIM_MESSAGE_TYPE_CUSTOM=100]="V2NIM_MESSAGE_TYPE_CUSTOM"}(Bc||(Bc={})),function(t){t[t.V2NIM_SEARCH_KEYWORD_MATCH_TYPE_OR=0]="V2NIM_SEARCH_KEYWORD_MATCH_TYPE_OR",t[t.V2NIM_SEARCH_KEYWORD_MATCH_TYPE_AND=1]="V2NIM_SEARCH_KEYWORD_MATCH_TYPE_AND"}(Hc||(Hc={})),function(t){t[t.V2NIM_SEARCH_DIRECTION_BACKWARD=0]="V2NIM_SEARCH_DIRECTION_BACKWARD",t[t.V2NIM_SEARCH_DIRECTION_FORWARD=1]="V2NIM_SEARCH_DIRECTION_FORWARD"}(Yc||(Yc={})),function(t){t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_UNDEFINED=-1]="V2NIM_MESSAGE_NOTIFICATION_TYPE_UNDEFINED",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_INVITE=0]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_INVITE",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_KICK=1]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_KICK",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_LEAVE=2]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_LEAVE",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_UPDATE_TINFO=3]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_UPDATE_TINFO",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_DISMISS=4]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_DISMISS",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_APPLY_PASS=5]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_APPLY_PASS",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_OWNER_TRANSFER=6]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_OWNER_TRANSFER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_ADD_MANAGER=7]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_ADD_MANAGER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_REMOVE_MANAGER=8]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_REMOVE_MANAGER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_INVITE_ACCEPT=9]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_INVITE_ACCEPT",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_BANNED_TEAM_MEMBER=10]="V2NIM_MESSAGE_NOTIFICATION_TYPE_TEAM_BANNED_TEAM_MEMBER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_INVITE=401]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_INVITE",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_KICK=402]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_KICK",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_LEAVE=403]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_LEAVE",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_UPDATE_TINFO=404]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_UPDATE_TINFO",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_DISMISS=405]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_DISMISS",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_APPLY_PASS=410]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_APPLY_PASS",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_OWNER_TRANSFER=406]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_OWNER_TRANSFER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_ADD_MANAGER=407]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_ADD_MANAGER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_REMOVE_MANAGER=408]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_REMOVE_MANAGER",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_INVITE_ACCEPT=411]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_INVITE_ACCEPT",t[t.V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_BANNED_TEAM_MEMBER=409]="V2NIM_MESSAGE_NOTIFICATION_TYPE_SUPER_TEAM_BANNED_TEAM_MEMBER"}(jc||(jc={})),function(t){t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UNKNOWN=0]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UNKNOWN",t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_SUCCESS=1]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_SUCCESS",t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_FAILED=2]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_FAILED",t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UPLOADING=3]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UPLOADING"}(Kc||(Kc={})),function(t){t[t.V2NIM_MESSAGE_SENDING_STATE_UNKNOWN=0]="V2NIM_MESSAGE_SENDING_STATE_UNKNOWN",t[t.V2NIM_MESSAGE_SENDING_STATE_SUCCEEDED=1]="V2NIM_MESSAGE_SENDING_STATE_SUCCEEDED",t[t.V2NIM_MESSAGE_SENDING_STATE_FAILED=2]="V2NIM_MESSAGE_SENDING_STATE_FAILED",t[t.V2NIM_MESSAGE_SENDING_STATE_SENDING=3]="V2NIM_MESSAGE_SENDING_STATE_SENDING"}(qc||(qc={})),function(t){t[t.V2NIM_QUERY_DIRECTION_DESC=0]="V2NIM_QUERY_DIRECTION_DESC",t[t.V2NIM_QUERY_DIRECTION_ASC=1]="V2NIM_QUERY_DIRECTION_ASC"}(Wc||(Wc={})),function(t){t[t.V2NIM_CLEAR_HISTORY_MODE_ALL=0]="V2NIM_CLEAR_HISTORY_MODE_ALL",t[t.V2NIM_CLEAR_HISTORY_MODE_LOCAL=1]="V2NIM_CLEAR_HISTORY_MODE_LOCAL",t[t.V2NIM_CLEAR_HISTORY_MODE_LOCAL_IRREPARABLY=2]="V2NIM_CLEAR_HISTORY_MODE_LOCAL_IRREPARABLY"}(zc||(zc={})),function(t){t[t.V2NIM_MESSAGE_REVOKE_TYPE_UNDEFINED=0]="V2NIM_MESSAGE_REVOKE_TYPE_UNDEFINED",t[t.V2NIM_MESSAGE_REVOKE_TYPE_P2P_BOTHWAY=1]="V2NIM_MESSAGE_REVOKE_TYPE_P2P_BOTHWAY",t[t.V2NIM_MESSAGE_REVOKE_TYPE_TEAM_BOTHWAY=2]="V2NIM_MESSAGE_REVOKE_TYPE_TEAM_BOTHWAY",t[t.V2NIM_MESSAGE_REVOKE_TYPE_SUPERTEAM_BOTHWAY=3]="V2NIM_MESSAGE_REVOKE_TYPE_SUPERTEAM_BOTHWAY",t[t.V2NIM_MESSAGE_REVOKE_TYPE_P2P_ONEWAY=4]="V2NIM_MESSAGE_REVOKE_TYPE_P2P_ONEWAY",t[t.V2NIM_MESSAGE_REVOKE_TYPE_TEAM_ONEWAY=5]="V2NIM_MESSAGE_REVOKE_TYPE_TEAM_ONEWAY"}($c||($c={})),function(t){t[t.V2NIM_MESSAGE_PIN_STATE_NOT_PINNED=0]="V2NIM_MESSAGE_PIN_STATE_NOT_PINNED",t[t.V2NIM_MESSAGE_PIN_STATE_PINNED=1]="V2NIM_MESSAGE_PIN_STATE_PINNED",t[t.V2NIM_MESSAGE_PIN_STATE_UPDATED=2]="V2NIM_MESSAGE_PIN_STATE_UPDATED"}(Xc||(Xc={})),function(t){t[t.V2NIM_QUICK_COMMENT_STATE_ADD=1]="V2NIM_QUICK_COMMENT_STATE_ADD",t[t.V2NIM_QUICK_COMMENT_STATE_REMOVE=2]="V2NIM_QUICK_COMMENT_STATE_REMOVE"}(Jc||(Jc={})),function(t){t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_NONE=0]="V2NIM_CLIENT_ANTISPAM_OPERATE_NONE",t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_REPLACE=1]="V2NIM_CLIENT_ANTISPAM_OPERATE_REPLACE",t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_CLIENT_SHIELD=2]="V2NIM_CLIENT_ANTISPAM_OPERATE_CLIENT_SHIELD",t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_SERVER_SHIELD=3]="V2NIM_CLIENT_ANTISPAM_OPERATE_SERVER_SHIELD"}(Qc||(Qc={})),function(t){t[t.V2NIM_SORT_ORDER_DESC=0]="V2NIM_SORT_ORDER_DESC",t[t.V2NIM_SORT_ORDER_ASC=1]="V2NIM_SORT_ORDER_ASC"}(Zc||(Zc={})),function(t){t[t.P2P_DELETE_MSG=7]="P2P_DELETE_MSG",t[t.TEAM_DELETE_MSG=8]="TEAM_DELETE_MSG",t[t.SUPERTEAM_DELETE_MSG=12]="SUPERTEAM_DELETE_MSG",t[t.P2P_ONE_WAY_DELETE_MSG=13]="P2P_ONE_WAY_DELETE_MSG",t[t.TEAM_ONE_WAY_DELETE_MSG=14]="TEAM_ONE_WAY_DELETE_MSG",t[t.CUSTOM_P2P_MSG=100]="CUSTOM_P2P_MSG",t[t.CUSTOM_TEAM_MSG=101]="CUSTOM_TEAM_MSG",t[t.CUSTOM_SUPERTEAM_MSG=103]="CUSTOM_SUPERTEAM_MSG"}(el||(el={})),function(t){t[t.NIM_MESSAGE_STREAM_STATUS_STREAMING=-1]="NIM_MESSAGE_STREAM_STATUS_STREAMING",t[t.NIM_MESSAGE_STREAM_STATUS_NONE=0]="NIM_MESSAGE_STREAM_STATUS_NONE",t[t.NIM_MESSAGE_STREAM_STATUS_PLACEHOLDER=1]="NIM_MESSAGE_STREAM_STATUS_PLACEHOLDER",t[t.NIM_MESSAGE_STREAM_STATUS_CANCEL=2]="NIM_MESSAGE_STREAM_STATUS_CANCEL",t[t.NIM_MESSAGE_AI_STREAM_STATUS_UPDATE=3]="NIM_MESSAGE_AI_STREAM_STATUS_UPDATE",t[t.NIM_MESSAGE_STREAM_STATUS_COMPLETE=4]="NIM_MESSAGE_STREAM_STATUS_COMPLETE",t[t.NIM_MESSAGE_STREAM_STATUS_EXCEPTION=5]="NIM_MESSAGE_STREAM_STATUS_EXCEPTION"}(tl||(tl={})),function(t){t[t.V2NIM_MESSAGE_SOURCE_UNKNOWN=0]="V2NIM_MESSAGE_SOURCE_UNKNOWN",t[t.V2NIM_MESSAGE_SOURCE_ONLINE=1]="V2NIM_MESSAGE_SOURCE_ONLINE",t[t.V2NIM_MESSAGE_SOURCE_OFFLINE=2]="V2NIM_MESSAGE_SOURCE_OFFLINE",t[t.V2NIM_MESSAGE_SOURCE_ROAMING=3]="V2NIM_MESSAGE_SOURCE_ROAMING"}(rl||(rl={})),function(t){t[t.V2NIM_TEAM_MESSAGE_MUTE_MODE_OFF=0]="V2NIM_TEAM_MESSAGE_MUTE_MODE_OFF",t[t.V2NIM_TEAM_MESSAGE_MUTE_MODE_ON=1]="V2NIM_TEAM_MESSAGE_MUTE_MODE_ON",t[t.V2NIM_TEAM_MESSAGE_MUTE_MODE_NORMAL_ON=2]="V2NIM_TEAM_MESSAGE_MUTE_MODE_NORMAL_ON"}(nl||(nl={})),function(t){t[t.V2NIM_P2P_MESSAGE_MUTE_MODE_OFF=0]="V2NIM_P2P_MESSAGE_MUTE_MODE_OFF",t[t.V2NIM_P2P_MESSAGE_MUTE_MODE_ON=1]="V2NIM_P2P_MESSAGE_MUTE_MODE_ON"}(ol||(ol={})),function(t){t[t.V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_NORMAL=1]="V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_NORMAL",t[t.V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_SUPER=2]="V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_SUPER",t[t.V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_ALL=3]="V2NIM_TEAM_JOIN_ACTION_TEAM_TYPE_ALL"}(il||(il={})),function(t){t[t.V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_ALL=0]="V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_ALL",t[t.V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_NORMAL=1]="V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_NORMAL",t[t.V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_MANAGER=2]="V2NIM_TEAM_MEMBER_ROLE_QUERY_TYPE_MANAGER"}(al||(al={})),function(t){t[t.V2NIM_TEAM_TYPE_INVALID=0]="V2NIM_TEAM_TYPE_INVALID",t[t.V2NIM_TEAM_TYPE_ADVANCED=1]="V2NIM_TEAM_TYPE_ADVANCED",t[t.V2NIM_TEAM_TYPE_SUPER=2]="V2NIM_TEAM_TYPE_SUPER"}(sl||(sl={})),function(t){t[t.V2NIM_TEAM_JOIN_MODE_FREE=0]="V2NIM_TEAM_JOIN_MODE_FREE",t[t.V2NIM_TEAM_JOIN_MODE_APPLY=1]="V2NIM_TEAM_JOIN_MODE_APPLY",t[t.V2NIM_TEAM_JOIN_MODE_INVITE=2]="V2NIM_TEAM_JOIN_MODE_INVITE"}(cl||(cl={})),function(t){t[t.V2NIM_TEAM_AGREE_MODE_AUTH=0]="V2NIM_TEAM_AGREE_MODE_AUTH",t[t.V2NIM_TEAM_AGREE_MODE_NO_AUTH=1]="V2NIM_TEAM_AGREE_MODE_NO_AUTH"}(ll||(ll={})),function(t){t[t.V2NIM_TEAM_INVITE_MODE_MANAGER=0]="V2NIM_TEAM_INVITE_MODE_MANAGER",t[t.V2NIM_TEAM_INVITE_MODE_ALL=1]="V2NIM_TEAM_INVITE_MODE_ALL"}(ul||(ul={})),function(t){t[t.V2NIM_TEAM_UPDATE_INFO_MODE_MANAGER=0]="V2NIM_TEAM_UPDATE_INFO_MODE_MANAGER",t[t.V2NIM_TEAM_UPDATE_INFO_MODE_ALL=1]="V2NIM_TEAM_UPDATE_INFO_MODE_ALL"}(dl||(dl={})),function(t){t[t.V2NIM_TEAM_CHAT_BANNED_MODE_UNBAN=0]="V2NIM_TEAM_CHAT_BANNED_MODE_UNBAN",t[t.V2NIM_TEAM_CHAT_BANNED_MODE_BANNED_NORMAL=1]="V2NIM_TEAM_CHAT_BANNED_MODE_BANNED_NORMAL",t[t.V2NIM_TEAM_CHAT_BANNED_MODE_BANNED_ALL=3]="V2NIM_TEAM_CHAT_BANNED_MODE_BANNED_ALL"}(_l||(_l={})),function(t){t[t.V2NIM_TEAM_UPDATE_EXTENSION_MODE_MANAGER=0]="V2NIM_TEAM_UPDATE_EXTENSION_MODE_MANAGER",t[t.V2NIM_TEAM_UPDATE_EXTENSION_MODE_ALL=1]="V2NIM_TEAM_UPDATE_EXTENSION_MODE_ALL"}(pl||(pl={})),function(t){t[t.V2NIM_TEAM_MEMBER_ROLE_NORMAL=0]="V2NIM_TEAM_MEMBER_ROLE_NORMAL",t[t.V2NIM_TEAM_MEMBER_ROLE_OWNER=1]="V2NIM_TEAM_MEMBER_ROLE_OWNER",t[t.V2NIM_TEAM_MEMBER_ROLE_MANAGER=2]="V2NIM_TEAM_MEMBER_ROLE_MANAGER"}(hl||(hl={})),function(t){t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_APPLICATION=0]="V2NIM_TEAM_JOIN_ACTION_TYPE_APPLICATION",t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_APPLICATION=1]="V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_APPLICATION",t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_INVITATION=2]="V2NIM_TEAM_JOIN_ACTION_TYPE_INVITATION",t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_INVITATION=3]="V2NIM_TEAM_JOIN_ACTION_TYPE_REJECT_INVITATION",t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_ACCEPT_APPLICATION=4]="V2NIM_TEAM_JOIN_ACTION_TYPE_ACCEPT_APPLICATION",t[t.V2NIM_TEAM_JOIN_ACTION_TYPE_ACCEPT_INVITATION=5]="V2NIM_TEAM_JOIN_ACTION_TYPE_ACCEPT_INVITATION"}(fl||(fl={})),function(t){t[t.V2NIM_TEAM_JOIN_ACTION_STATUS_INIT=0]="V2NIM_TEAM_JOIN_ACTION_STATUS_INIT",t[t.V2NIM_TEAM_JOIN_ACTION_STATUS_AGREED=1]="V2NIM_TEAM_JOIN_ACTION_STATUS_AGREED",t[t.V2NIM_TEAM_JOIN_ACTION_STATUS_REJECTED=2]="V2NIM_TEAM_JOIN_ACTION_STATUS_REJECTED",t[t.V2NIM_TEAM_JOIN_ACTION_STATUS_EXPIRED=3]="V2NIM_TEAM_JOIN_ACTION_STATUS_EXPIRED"}(El||(El={})),function(t){t[t.teamApply=0]="teamApply",t[t.teamApplyReject=1]="teamApplyReject",t[t.teamInvite=2]="teamInvite",t[t.teamInviteReject=3]="teamInviteReject",t[t.tlistUpdate=4]="tlistUpdate",t[t.superTeamApply=15]="superTeamApply",t[t.superTeamApplyReject=16]="superTeamApplyReject",t[t.superTeamInvite=17]="superTeamInvite",t[t.superTeamInviteReject=18]="superTeamInviteReject"}(ml||(ml={})),function(t){t[t.V2NIM_AI_MODEL_TYPE_UNKNOW=0]="V2NIM_AI_MODEL_TYPE_UNKNOW",t[t.V2NIM_AI_MODEL_TYPE_QWEN=1]="V2NIM_AI_MODEL_TYPE_QWEN",t[t.V2NIM_AI_MODEL_TYPE_AZURE=2]="V2NIM_AI_MODEL_TYPE_AZURE",t[t.V2NIM_AI_MODEL_TYPE_PRIVATE=3]="V2NIM_AI_MODEL_TYPE_PRIVATE"}(gl||(gl={})),function(t){t[t.V2NIM_AI_MODEL_STREAM_CALL_STATUS_NONE=0]="V2NIM_AI_MODEL_STREAM_CALL_STATUS_NONE",t[t.V2NIM_AI_MODEL_STREAM_CALL_STATUS_CANCEL=2]="V2NIM_AI_MODEL_STREAM_CALL_STATUS_CANCEL",t[t.V2NIM_AI_MODEL_STREAM_CALL_STATUS_COMPLETE=4]="V2NIM_AI_MODEL_STREAM_CALL_STATUS_COMPLETE",t[t.V2NIM_AI_MODEL_STREAM_CALL_STATUS_EXCEPTION=5]="V2NIM_AI_MODEL_STREAM_CALL_STATUS_EXCEPTION"}(Il||(Il={})),function(t){t.V2NIM_AI_MODEL_ROLE_TYPE_SYSTEM="system",t.V2NIM_AI_MODEL_ROLE_TYPE_USER="user",t.V2NIM_AI_MODEL_ROLE_TYPE_ASSISTANT="assistant"}(vl||(vl={})),function(t){t[t.V2NIM_SIGNALLING_EVENT_TYPE_UNKNOWN=0]="V2NIM_SIGNALLING_EVENT_TYPE_UNKNOWN",t[t.V2NIM_SIGNALLING_EVENT_TYPE_CLOSE=1]="V2NIM_SIGNALLING_EVENT_TYPE_CLOSE",t[t.V2NIM_SIGNALLING_EVENT_TYPE_JOIN=2]="V2NIM_SIGNALLING_EVENT_TYPE_JOIN",t[t.V2NIM_SIGNALLING_EVENT_TYPE_INVITE=3]="V2NIM_SIGNALLING_EVENT_TYPE_INVITE",t[t.V2NIM_SIGNALLING_EVENT_TYPE_CANCEL_INVITE=4]="V2NIM_SIGNALLING_EVENT_TYPE_CANCEL_INVITE",t[t.V2NIM_SIGNALLING_EVENT_TYPE_REJECT=5]="V2NIM_SIGNALLING_EVENT_TYPE_REJECT",t[t.V2NIM_SIGNALLING_EVENT_TYPE_ACCEPT=6]="V2NIM_SIGNALLING_EVENT_TYPE_ACCEPT",t[t.V2NIM_SIGNALLING_EVENT_TYPE_LEAVE=7]="V2NIM_SIGNALLING_EVENT_TYPE_LEAVE",t[t.V2NIM_SIGNALLING_EVENT_TYPE_CONTROL=8]="V2NIM_SIGNALLING_EVENT_TYPE_CONTROL",t[t.V2NIM_SIGNALLING_EVENT_TYPE_KICK=9]="V2NIM_SIGNALLING_EVENT_TYPE_KICK"}(Tl||(Tl={})),function(t){t[t.V2NIM_SIGNALLING_CHANNEL_TYPE_AUDIO=1]="V2NIM_SIGNALLING_CHANNEL_TYPE_AUDIO",t[t.V2NIM_SIGNALLING_CHANNEL_TYPE_VIDEO=2]="V2NIM_SIGNALLING_CHANNEL_TYPE_VIDEO",t[t.V2NIM_SIGNALLING_CHANNEL_TYPE_CUSTOM=3]="V2NIM_SIGNALLING_CHANNEL_TYPE_CUSTOM"}(Nl||(Nl={})),function(t){t[t.V2NIM_USER_STATUS_TYPE_UNKNOWN=0]="V2NIM_USER_STATUS_TYPE_UNKNOWN",t[t.V2NIM_USER_STATUS_TYPE_LOGIN=1]="V2NIM_USER_STATUS_TYPE_LOGIN",t[t.V2NIM_USER_STATUS_TYPE_LOGOUT=2]="V2NIM_USER_STATUS_TYPE_LOGOUT",t[t.V2NIM_USER_STATUS_TYPE_DISCONNECT=3]="V2NIM_USER_STATUS_TYPE_DISCONNECT"}(Ml||(Ml={}));var Rl={V2NIM_ERROR_CODE_UNKNOWN:{code:0,message:"unknown error"},V2NIM_ERROR_CODE_SUCCESS:{code:200,message:"success"},V2NIM_ERROR_CODE_HANDSHAKE:{code:201,message:"handshake error"},V2NIM_ERROR_CODE_REQUEST_TEMPERARY_FORBIDDEN:{code:398,message:"request temprary forbidden"},V2NIM_ERROR_CODE_SERVER_UNIT_ERROR:{code:399,message:"server unit error"},V2NIM_ERROR_CODE_FORBIDDEN:{code:403,message:"forbidden"},V2NIM_ERROR_CODE_NOT_FOUND:{code:404,message:"not found"},V2NIM_ERROR_CODE_PARAMETER_ERROR:{code:414,message:"parameter error"},V2NIM_ERROR_CODE_RATE_LIMIT_REACHED:{code:416,message:"rate limit reached"},V2NIM_ERROR_CODE_MULTI_LOGIN_FORBIDDEN:{code:417,message:"multi login forbidden"},V2NIM_ERROR_CODE_SERVER_INTERNAL_ERROR:{code:500,message:"server internal error"},V2NIM_ERROR_CODE_SERVER_BUSY:{code:503,message:"server busy"},V2NIM_ERROR_CODE_APP_UNREACHABLE:{code:511,message:"app server unreachable"},V2NIM_ERROR_CODE_SERVICE_UNAVAILABLE:{code:514,message:"service unavailable"},V2NIM_ERROR_CODE_PROTOCOL_BLACKHOLE_FILTERED:{code:599,message:"protocol filtered by blackhole rule"},V2NIM_ERROR_CODE_NO_PERMISSION:{code:997,message:"appid has no permission to call the protocol"},V2NIM_ERROR_CODE_UNPACK_ERROR:{code:998,message:"unpack error"},V2NIM_ERROR_CODE_PACK_ERROR:{code:999,message:"pack error"},V2NIM_ERROR_CODE_IM_DISABLED:{code:101301,message:"IM disabled"},V2NIM_ERROR_CODE_SERVICE_ADDRESS_INVALID:{code:101302,message:"service address invalid"},V2NIM_ERROR_CODE_APPKEY_NOT_EXIST:{code:101303,message:"appkey not exist"},V2NIM_ERROR_CODE_BUNDLEID_CHECK_FAILED:{code:101304,message:"bundleid check failed"},V2NIM_ERROR_CODE_APPKEY_BLOCKED:{code:101403,message:"appkey blocked"},V2NIM_ERROR_CODE_INVALID_TOKEN:{code:102302,message:"invalid token"},V2NIM_ERROR_CODE_ROBOT_NOT_ALLOWED:{code:102303,message:"robot not allowed"},V2NIM_ERROR_CODE_ACCOUNT_NOT_EXIST:{code:102404,message:"account not exist"},V2NIM_ERROR_CODE_ACCOUNT_CHAT_BANNED:{code:102421,message:"account chat banned"},V2NIM_ERROR_CODE_ACCOUNT_BANNED:{code:102422,message:"account banned"},V2NIM_ERROR_CODE_ACCOUNT_IN_BLOCK_LIST:{code:102426,message:"account in block list"},V2NIM_ERROR_CODE_USER_PROFILE_NOT_EXIST:{code:103404,message:"user profile not exist"},V2NIM_ERROR_CODE_USER_PROFILE_HIT_ANTISPAM:{code:103451,message:"user profile hit antispam"},V2NIM_ERROR_CODE_PEER_FRIEND_LIMIT:{code:104301,message:"peer friend limit"},V2NIM_ERROR_CODE_FRIEND_APPLICATION_NOT_EXIST:{code:104302,message:"friend application not exist"},V2NIM_ERROR_CODE_FRIEND_NOT_EXIST:{code:104404,message:"friend not exist"},V2NIM_ERROR_CODE_FRIEND_ALREADY_EXIST:{code:104405,message:"friend already exist"},V2NIM_ERROR_CODE_SELF_FRIEND_OPERATION_NOT_ALLOWED:{code:104429,message:"self friend operation not allowed"},V2NIM_ERROR_CODE_FRIEND_LIMIT:{code:104435,message:"friend limit"},V2NIM_ERROR_CODE_FRIEND_OPERATION_RATE_LIMIT:{code:104449,message:"friend operation rate limit"},V2NIM_ERROR_CODE_FRIEND_HIT_ANTISPAM:{code:104451,message:"friend hit antispam"},V2NIM_ERROR_CODE_SELF_MUTE_OPERATION_NOT_ALLOWED:{code:105429,message:"self mute operation not allowed"},V2NIM_ERROR_CODE_MUTE_LIST_LIMIT:{code:105435,message:"mute list limit"},V2NIM_ERROR_CODE_SELF_BLOCK_LIST_OPERATION_NOT_ALLOWED:{code:106429,message:"self block list operation not allowed"},V2NIM_ERROR_CODE_BLOCK_LIST_LIMIT:{code:106435,message:"block list limit"},V2NIM_ERROR_CODE_REVOKE_THIRD_PARTY_MESSAGE_NOT_ALLOWED:{code:107301,message:"revoke third party message not allowed"},V2NIM_ERROR_CODE_SHORT_TO_LONG_URL_FAILED:{code:107307,message:"short to long URL failed"},V2NIM_ERROR_CODE_URL_INVALID:{code:107308,message:"URL invalid"},V2NIM_ERROR_CODE_DURATION_OUT_OF_RANGE:{code:107309,message:"duration out of range"},V2NIM_ERROR_CODE_GET_FILE_META_INFO_FAILED:{code:107310,message:"get file meta info failed"},V2NIM_ERROR_CODE_AUDIO_FILE_SIZE_LIMIT:{code:107311,message:"audio file size limit"},V2NIM_ERROR_CODE_VOICE_TO_TEXT_TIMEOUT:{code:107312,message:"voice to text timeout"},V2NIM_ERROR_CODE_VOICE_TO_TEXT_FAILED:{code:107313,message:"voice to text failed"},V2NIM_ERROR_CODE_REVOKE_EXCEED_TIME_LIMIT:{code:107314,message:"revoke message exceed time limit"},V2NIM_ERROR_CODE_REVOKE_MESSAGE_NOT_ALLOWED:{code:107315,message:"revoke specific message not allowed"},V2NIM_ERROR_CODE_FORCE_PUSH_LIST_LIMIT:{code:107316,message:"force push list limit"},V2NIM_ERROR_CODE_TEAM_MESSAGE_RECEIPT_RATE_LIMIT:{code:107317,message:"team message receipt rate limit"},V2NIM_ERROR_CODE_SNAPSHOT_NOT_EXIST:{code:107318,message:"snapshot not exist"},V2NIM_ERROR_CODE_PIN_LIMIT:{code:107319,message:"pin limit"},V2NIM_ERROR_CODE_PIN_NOT_EXIST:{code:107320,message:"pin not exist"},V2NIM_ERROR_CODE_QUICK_COMMENT_LIMIT:{code:107321,message:"quick comment limit"},V2NIM_ERROR_CODE_PIN_ALREADY_EXIST:{code:107322,message:"pin already exist"},V2NIM_ERROR_CODE_VOICE_TO_TEXT_FUNCTION_DISABLED:{code:107333,message:"voice to text function disabled"},V2NIM_ERROR_CODE_CLOUD_SEARCH_FUNCTION_DISABLED:{code:107334,message:"cloud search function disabled"},V2NIM_ERROR_CODE_ONE_WAY_DELETE_FUNCTION_DISABLED:{code:107335,message:"one-way delete function disabled"},V2NIM_ERRPR_CODE_ONEWAY_DELETION_NOT_ALLOW_FOR_TARGET_MESSAGES:{code:107338,message:"one-way deletion is not allowed for target messages"},V2NIM_ERRPR_CODE_SENDER_CANNOT_INCLUDED_IN_TARGET_LIST:{code:107339,message:"The message sender cannot be included in the target list"},V2NIM_ERROR_CODE_ROBOT_CANNOT_SEND_TARGET_MESSAGE:{code:107340,message:"Robot can not send target message"},V2NIM_ERROR_CODE_PIN_TARGET_MESSAGE_NOT_ALLOWED:{code:107345,message:"Pin target message is not allowed"},V2NIM_ERROR_CODE_TARGET_MESSAGE_NOT_ALLOWED_REPLY:{code:107346,message:"Target message not allowed reply"},V2NIM_ERROR_CODE_TARGET_MESSAGE_NOT_ALLOWED_QUICK_COMMENT:{code:107347,message:"Target message not allowed quick comment"},V2NIM_ERROR_CODE_REVOKE_MESSAGE_TO_SELF_NOT_ALLOWED:{code:107429,message:"revoke message to self not allowed"},V2NIM_ERROR_CODE_APP_CHAT_BANNED:{code:107410,message:"app chat banned"},V2NIM_ERROR_CODE_QUICK_COMMENT_FUNCTION_DISABLED:{code:107326,message:"quick comment function disabled"},V2NIM_ERROR_CODE_PIN_FUNCTION_DISABLED:{code:107327,message:"PIN function disabled"},V2NIM_ERROR_CODE_TEAM_READ_RECEIPT_FUNCTION_DISABLED:{code:107324,message:"read receipt for team messages function disabled"},V2NIM_ERROR_CODE_P2P_READ_RECEIPT_FUNCTION_DISABLED:{code:107325,message:"read receipt for p2p messages function disabled"},V2NIM_ERROR_CODE_RATE_LIMIT_FOR_MESSAGING_REACHED:{code:107323,message:"rate limit for messaging reached"},V2NIM_ERROR_CODE_MESSAGE_HIT_ANTISPAM:{code:107451,message:"message hit antispam"},V2NIM_ERROR_CODE_MESSAGE_NOT_EXIST:{code:107404,message:"message not exist"},V2NIM_ERROR_CODE_UNSENDING_MESSAGE_EXPIRED:{code:107406,message:"unsending message expired"},V2NIM_ERROR_CODE_TEAM_MARK_READ_FAILED:{code:107302,message:"sending message failed for marking message read failed for too many team members"},V2NIM_ERROR_CODE_SENDER_OR_MANAGER_PERMISSION_ONLY_REVOKE:{code:107303,message:"only sender or manager can revoke message"},V2NIM_ERROR_CODE_DELETE_SELF_MESSAGE_NOT_ALLOWED:{code:107328,message:"delete self message not allowed"},V2NIM_ERROR_CODE_NOT_CHATBOT_ACCOUNT:{code:107329,message:"is not chatbot account"},V2NIM_ERROR_CODE_MESSAGE_SENSE_REQUIRED:{code:107330,message:"sender or receiver must sense message"},V2NIM_ERROR_CODE_HIGH_PRIORITY_MESSAGE_RATE_LIMIT:{code:107304,message:"rate limit of high-priority messages exceeded"},ACK_MESSAGE_BE_HIGH_PRIORITY:{code:107305,message:"ack message should be high-priority"},V2NIM_ERROR_CODE_DUPLICATE_CLIENT_MESSAGE_ID:{code:107306,message:"duplicate client message ID"},V2NIM_ERROR_CODE_INVALID_TIME_RANGE:{code:107439,message:"invalid time range"},V2NIM_ERROR_CODE_NOT_ADVANCED_TEAM:{code:108302,message:"not advanced team"},V2NIM_ERROR_CODE_TEAM_MANAGER_LIMIT:{code:108303,message:"team manager limit"},V2NIM_ERROR_CODE_JOINED_TEAM_LIMIT:{code:108305,message:"joined team limit"},V2NIM_ERROR_CODE_TEAM_NORMAL_MEMBER_CHAT_BANNED:{code:108306,message:"team normal member chat banned"},V2NIM_ERROR_CODE_INVITED_ACCOUNT_NOT_FRIEND:{code:108307,message:"invited account not friend"},V2NIM_ERROR_CODE_REJECT_ALL_TEAM_APPLICATIONS:{code:108308,message:"reject all team applications"},V2NIM_ERROR_CODE_TARGETING_MESSAGE_FOR_TEAM_DISABLED:{code:108318,message:"Targeting messages for group chat is disabled"},V2NIM_ERROR_CODE_INCLUSIVE_AS_FALSE_NOT_ALLOWED_FOR_SUPER_TEAM:{code:108319,message:'Setting "inclusive" to false for super teams is not allowed'},V2NIM_ERROR_CODE_CANNOT_MAKE_SUPER_TEAM_MESSAGE_VISIBLE_TO_NEW_MEMBERS:{code:108320,message:"Cannot make super team targeted messages visible to new members"},V2NIM_ERROR_CODE_CANNOT_ALLOW_TARGETED_MESSAGES_INCLUSIVE_TO_NEW_MEMBERS:{code:108321,message:"Cannot allow targeted messages inclusive to new members"},V2NIM_ERROR_CODE_TEAM_NOT_EXIST:{code:108404,message:"team not exist"},V2NIM_ERROR_CODE_TEAM_ALREADY_CHAT_BANNED:{code:108420,message:"team already chat banned"},V2NIM_ERROR_CODE_ALL_TEAM_MEMBER_CHAT_BANNED:{code:108423,message:"all team member chat banned"},V2NIM_ERROR_CODE_EXTENDED_SUPER_TEAM_LIMIT:{code:108434,message:"extended super team limit"},V2NIM_ERROR_CODE_CREATED_TEAM_LIMIT:{code:108435,message:"created team limit"},V2NIM_ERROR_CODE_TEAM_INVITATION_LIMIT:{code:108437,message:"team invitation limit"},V2NIM_ERROR_CODE_TEAM_HIT_ANTISPAM:{code:108451,message:"team hit antispam"},V2NIM_ERROR_CODE_EXTENDED_SUPER_TEAM_LIMIT_NOT_CONFIGURED:{code:108304,message:"extended super team limit not configured"},V2NIM_ERROR_CODE_SUPER_TEAM_SERVICE_DISABLED:{code:108311,message:"super team service disabled"},V2NIM_ERROR_CODE_TEAM_READ_RECEIPT_RECORD_NOT_FOUND:{code:108301,message:"read receipt record for the team message not found"},V2NIM_ERROR_CODE_NOT_MANAGER:{code:108430,message:"unable to assign owner manager"},V2NIM_ERROR_CODE_ONLINE_MEMBER_COUNT_DISABLED:{code:108406,message:"number of online users service disabled"},V2NIM_ERROR_CODE_TRANSFER_DISABLED:{code:108310,message:"unable to transfer the ownership to owner"},V2NIM_ERROR_CODE_CREATE_TEAM_DISABLED:{code:108309,message:"unable to create team with more than %s people"},V2NIM_ERROR_CODE_EXTENDED_SUPER_TEAM_CREATE_FAILED:{code:108313,message:"/ extended super team creation failed,use open api to create the team"},V2NIM_ERROR_CODE_TEAM_MESSAGE_READ_RECEIPT_DISABLED:{code:108312,message:"read receipt for team messages function disabled"},V2NIM_ERROR_CODE_RETRY:{code:108449,message:"an error occurred, try again"},V2NIM_ERROR_CODE_CHAT_BAN_LIST_CONTAIN_NOT_TEAM_MEMBER:{code:109301,message:"list of chat banned users contains non team members"},V2NIM_ERROR_CODE_CHAT_BAN_LIST_CONTAIN_OPERATOR:{code:109303,message:"list of chat banned users contains the operator"},V2NIM_ERROR_CODE_CHAT_BAN_LIST_CONTAIN_TEAM_OWNER:{code:109304,message:"list of chat banned users contains the team owner"},V2NIM_ERROR_CODE_OPERATION_ON_TEAM_MANAGER_NOT_ALLOWED:{code:109305,message:"operation on team manager not allowed"},V2NIM_ERROR_CODE_NO_TEAM_INVITE_PERMISSION:{code:109306,message:"no team invite permission"},V2NIM_ERROR_CODE_TEAM_OWNER_QUIT_NOT_ALLOWED:{code:109307,message:"team owner quit not allowed"},V2NIM_ERROR_CODE_TEAM_OWNER_IN_KICK_LIST:{code:109308,message:"list of kicked user contains the team owner"},V2NIM_ERROR_CODE_INVITE_ROBOT_ACCOUNT_NOT_ALLOWED:{code:109309,message:"invite robot account not allowed"},V2NIM_ERROR_CODE_KICK_OPERATOR_NOT_ALLOWED:{code:109310,message:"kick operator not allowed"},V2NIM_ERROR_CODE_TEAM_MEMBER_ALREADY_EXIST:{code:109311,message:"team member already exist"},V2NIM_ERROR_CODE_TEAM_INVITATION_OR_APPLICATION_NOT_EXIST:{code:109313,message:"team invitation or application not exist"},V2NIM_ERROR_CODE_OPERATION_ON_TEAM_OWNER_NOT_ALLOWED:{code:109314,message:"operation on team owner not allowed"},V2NIM_ERROR_CODE_FORCED_PUSH_LIST_INCLUDES_NON_TARGETED_ACCOUNTS:{code:109318,message:"The forced push list includes non-targeted accounts"},V2NIM_ERROR_CODE_TEAM_MEMBER_NOT_EXIST:{code:109404,message:"team member not exist"},V2NIM_ERROR_CODE_TEAM_MEMBER_CHAT_BANNED:{code:109424,message:"team member chat banned"},V2NIM_ERROR_CODE_TEAM_OWNER_OPERATION_PERMISSION_REQUIRED:{code:109427,message:"team owner operation permission required"},V2NIM_ERROR_CODE_TEAM_OWNER_OR_MANAGER_OPERATION_PERMISSION_REQUIRED:{code:109432,message:"team owner or manager operation permission required"},V2NIM_ERROR_CODE_TEAM_MEMBER_CONCURRENT_OPERATION_FAILED:{code:109449,message:"team member concurrent operation failed"},V2NIM_ERROR_CODE_TEAM_MEMBER_HIT_ANTISPAM:{code:109451,message:"team member hit antispam"},V2NIM_ERROR_CODE_CONVERSATION_AND_ACCOUNT_MISMATCH:{code:110302,message:"conversation and account mismatch"},V2NIM_ERROR_CODE_CONVERSATION_STICK_TOP_LIMIT:{code:110303,message:"conversation stick top limit"},V2NIM_ERROR_CODE_CONVERSATION_BELONGED_GROUP_LIMIT:{code:110304,message:"conversation belonged group limit"},V2NIM_ERROR_CODE_CONVERSATION_IS_NOT_STICK_TOP:{code:110305,message:"conversation is not stick top"},V2NIM_ERROR_CODE_STICK_TOP_DISABLED:{code:110306,message:"conversation stick top disabled"},V2NIM_ERROR_CODE_CONVERSATION_NOT_EXIST:{code:110404,message:"conversation not exist"},V2NIM_ERROR_CODE_CHATROOM_LINK_UNAVAILABLE:{code:113304,message:"chatroom link unavailable"},V2NIM_ERROR_CODE_IM_CONNECTION_ABNORMAL:{code:113305,message:"IM connection abnormal"},V2NIM_ERROR_CODE_CHATROOM_NOT_EXIST:{code:113404,message:"chatroom not exist"},V2NIM_ERROR_CODE_CHATROOM_CLOSED:{code:113406,message:"chatroom closed"},V2NIM_ERROR_CODE_CHATROOM_REPEATED_OPERATION:{code:113409,message:"chatroom repeated operation"},V2NIM_ERROR_CODE_CHATROOM_DISABLED:{code:113410,message:"chatroom disabled"},V2NIM_ERROR_CODE_ALL_CHATROOM_MEMBER_CHAT_BANNED:{code:113423,message:"all chatroom member chat banned"},V2NIM_ERROR_CODE_CHATROOM_HIT_ANTISPAM:{code:113451,message:"chatroom hit antispam"},V2NIM_ERROR_CODE_ANONYMOUS_MEMBER_FORBIDDEN:{code:114303,message:"anonymous member forbidden"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_NOT_EXIST:{code:114404,message:"chatroom member not exist"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_REPEATED_OPERATION:{code:114405,message:"chatroom member repeated operation"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_CHAT_BANNED:{code:114421,message:"chatroom member chat banned"},V2NIM_ERROR_CODE_ACCOUNT_IN_CHATROOM_BLOCK_LIST:{code:114426,message:"account in chatroom block list"},V2NIM_ERROR_CODE_CHATROOM_OWNER_OPERATION_PERMISSION_REQUIRED:{code:114427,message:"chatroom owner operation permission required"},V2NIM_ERROR_CODE_SELF_IN_CHATROOM_MEMBER_OPERATION_LIST:{code:114429,message:"self in chatroom member operation list"},V2NIM_ERROR_CODE_CHATROOM_OWNER_OR_MANAGER_OPERATION_PERMISSION_REQUIRED:{code:114432,message:"chatroom owner or manager operation permission required"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_LIMIT:{code:114437,message:"chatroom member limit"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_CONCURRENT_OPERATION_FAILED:{code:114449,message:"chatroom member concurrent operation failed"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_HIT_ANTISPAM:{code:114451,message:"chatroom member hit antispam"},V2NIM_ERROR_CODE_CONVERSATION_GROUP_NOT_EXIST:{code:116404,message:"conversation group not exist"},V2NIM_ERROR_CODE_CONVERSATION_GROUP_LIMIT:{code:116435,message:"conversation group limit"},V2NIM_ERROR_CODE_CONVERSATIONS_IN_GROUP_LIMIT:{code:116437,message:"conversations in group limit"},V2NIM_ERROR_CODE_COLLECTION_LIMIT:{code:189301,message:"collection limit"},V2NIM_ERROR_CODE_COLLECTION_NOT_EXIST:{code:189302,message:"collection not exist"},V2NIM_ERROR_CODE_COLLECTION_CONCURRENT_OPERATION_FAILED:{code:189449,message:"collection concurrent operation failed"},V2NIM_ERROR_CODE_INTERNAL:{code:190001,message:"internal error"},V2NIM_ERROR_CODE_ILLEGAL_STATE:{code:190002,message:"illegal state"},V2NIM_ERROR_CODE_MISUSE:{code:191001,message:"misuse"},V2NIM_ERROR_CODE_CANCELLED:{code:191002,message:"operation cancelled"},V2NIM_ERROR_CODE_CALLBACK_FAILED:{code:191003,message:"callback failed"},V2NIM_ERROR_CODE_INVALID_PARAMETER:{code:191004,message:"invalid parameter"},V2NIM_ERROR_CODE_TIMEOUT:{code:191005,message:"timeout"},V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST:{code:191006,message:"resource not exist"},V2NIM_ERROR_CODE_RESOURCE_ALREADY_EXIST:{code:191007,message:"resource already exist"},V2NIM_ERROR_CODE_CONNECT_FAILED:{code:192001,message:"connect failed"},V2NIM_ERROR_CODE_CONNECT_TIMEOUT:{code:192002,message:"connect timeout"},V2NIM_ERROR_CODE_DISCONNECT:{code:192003,message:"disconnect"},V2NIM_ERROR_CODE_PROTOCOL_TIMEOUT:{code:192004,message:"protocol timeout"},V2NIM_ERROR_CODE_PROTOCOL_SEND_FAILED:{code:192005,message:"protocol send failed"},V2NIM_ERROR_CODE_REQUEST_FAILED:{code:192006,message:"request failed"},V2NIM_ERROR_CODE_FILE_NOT_FOUND:{code:194001,message:"file not found"},V2NIM_ERROR_CODE_FILE_CREATE_FAILED:{code:194002,message:"file create failed"},V2NIM_ERROR_CODE_FILE_OPEN_FAILED:{code:194003,message:"file open failed"},V2NIM_ERROR_CODE_FILE_WRITE_FAILED:{code:194004,message:"file write failed"},V2NIM_ERROR_CODE_FILE_READ_FAILED:{code:194005,message:"file read failed"},V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:{code:194006,message:"file upload failed"},V2NIM_ERROR_CODE_FILE_DOWNLOAD_FAILED:{code:194007,message:"file download failed"},V2NIM_ERROR_CODE_CLIENT_ANTISPAM:{code:195001,message:"client anti-spam"},V2NIM_ERROR_CODE_SERVER_ANTISPAM:{code:195002,message:"server anti-spam"},V2NIM_ERROR_CODE_STREAM_OUTPUT_STOPPED:{code:189318,message:"Streaming text response stopped"},V2NIM_ERROR_CODE_STREAM_OUTPUT_GENERATED:{code:189319,message:"Streaming text response generated"},V2NIM_ERROR_CODE_STREAM_OUTPUT_ABORTED:{code:189320,message:"Streaming text response aborted due to exception"},V2NIM_ERROR_CODE_INTERRUPTION_REJECTED:{code:189321,message:"Non-streaming messages cannot be interrupted"}},yl=cs(Rl),Al=reduce(yl).call(yl,(function(t,i){var u=Rl[i];return t[i]=u.code,t}),{}),Cl=reduce(yl).call(yl,(function(t,i){var u=Rl[i];return t[u.code]=u.message,t}),{}),bl=function(t){function V2NIMErrorImpl(i){var u;return(u=t.call(this,i.desc)||this).name="V2NIMError",u.code=i.code||0,u.desc=i.desc||Cl[u.code]||Vl[u.code]||"",u.message=u.desc,u.detail=i.detail||{},u}return bt(V2NIMErrorImpl,t),V2NIMErrorImpl.prototype.toString=function toString(){var t,i=this.name+"\n code: "+this.code+'\n message: "'+this.message+'"\n detail: '+(this.detail?Ua(this.detail):"");return(null===(t=null==this?void 0:this.detail)||void 0===t?void 0:t.rawError)&&(i+="\n rawError: "+this.detail.rawError.message),i},V2NIMErrorImpl}(mc(Error));var Ll=function(t){function ValidateError(i,u,_){var h;return void 0===u&&(u={}),(h=t.call(this,{code:Al.V2NIM_ERROR_CODE_PARAMETER_ERROR,detail:{reason:i,rules:_,data:u}})||this).name="validateError",h.message=h.message+"\n"+Ua(h.detail,null,2),h.data=u,h.rules=_,h}return bt(ValidateError,t),ValidateError}(bl),kl=function(t){function ValidateErrorV2(i){var u,_,h,E;return(u=t.call(this,{code:Al.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:null===(_=i.detail)||void 0===_?void 0:_.reason,rules:null===(h=i.detail)||void 0===h?void 0:h.rules,data:null===(E=i.detail)||void 0===E?void 0:E.data}})||this).name="ValidateErrorV2",u}return bt(ValidateErrorV2,t),ValidateErrorV2}(bl),Dl=function(t){function UploadError(i){var u;return(u=t.call(this,La({code:400},i))||this).desc=u.desc||"upload file error",u.message=u.desc,u.name="uploadError",u}return bt(UploadError,t),UploadError}(bl),Vl={200:null,406:null,808:null,810:null,302:"The user name or password is incorrect.",405:"Parameter length too long",408:"Client request timed out",415:"Client network unavailable",422:"Account disabled",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",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"},wl=["error","warn","log","debug"],Pl=function emptyFunc(){},xl=["off","error","warn","log","debug"],Ul=function(){function Logger(t,i){void 0===i&&(i={}),this.storageArr=[],this.debugLevel="off",this.timer=0,this.strategies={debug:{name:"debg",func:console.log},log:{name:"info",func:console.log},warn:{name:"warn",func:console.warn},error:{name:"erro",func:console.error}},this.debug=Pl,this.log=Pl,this.warn=Pl,this.error=Pl,this.iid=Math.round(1e3*Math.random()),this.debugLevel=indexOf(xl).call(xl,t)>-1?t:"off",i.debugLevel&&(this.debugLevel=indexOf(xl).call(xl,i.debugLevel)>-1?i.debugLevel:this.debugLevel),this.logStorage=!1===i.storageEnable?null:new Os.logStorage({logDirPath:i.logDirPath||i.storageName||"nim_logs",logRetentionDays:i.logRetentionDays||10,totalLogSizeInMB:i.totalLogSizeInMB||200,maxLogFileSizeInMB:i.maxLogFileSizeInMB||10}),this.setOptions(i),this.setLogFunc(this.debugLevel),this.setTimer(),Os.setLogger(this),this.open()}var t=Logger.prototype;return t.getDebugMode=function getDebugMode(){return"debug"===this.debugLevel},t.open=function open(){var t=this;this.logStorage&&this.logStorage.open().then((function(){t.log("Logger::open success")})).catch((function(i){t.warn("Logger::open failed",i)}))},t.setOptions=function setOptions(t){if(t&&t.logFunc){var i=t.logFunc;for(var u in i){var _=u,h=i[_];h&&(this.strategies[_].func=h)}}},t.setLogFunc=function setLogFunc(t,i){var u=this;void 0===i&&(i="log");var _=findIndex(wl).call(wl,(function(i){return i===t})),h=findIndex(wl).call(wl,(function(t){return t===i}));forEach$1(wl).call(wl,(function(t,i){u[t]=function(){if(!(i>_&&i>h)){var u=slice(Array.prototype).call(arguments),E=this.strategies[t],m=this.formatArgs(u,E.name);i<=h&&this.logStorage&&this.prepareSaveLog(m,t),i<=_&&E.func(m)}}}))},t.extractLogs=function extractLogs(){var t;return this.logStorage?null===(t=this.logStorage)||void 0===t?void 0:t.extractLogs():pa.resolve("")},t.afterUpload=function afterUpload(){var t;return this.logStorage?null===(t=this.logStorage)||void 0===t?void 0:t.afterUpload():pa.resolve("")},t.prepareSaveLog=function prepareSaveLog(t,i){this.storageArr.push({text:t,level:i,time:Ka(),iid:this.iid}),this.timer||this.setTimer(),this.storageArr.length>=100&&(this.triggerTimer(),this.storageArr=[])},t.saveLogs=function saveLogs(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var t;return Ra.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:if(this.logStorage){i.next=2;break}return i.abrupt("return");case 2:return t=this.storageArr,this.storageArr=[],i.prev=4,i.next=7,this.logStorage.addLogs(t);case 7:i.next=11;break;case 9:i.prev=9,i.t0=i.catch(4);case 11:case"end":return i.stop()}}),_callee,this,[[4,9]])})))},t.clearTimer=function clearTimer(){this.timer&&clearTimeout(this.timer),this.timer=0},t.setTimer=function setTimer(){var t;this.clearTimer(),this.timer=gs(bind$1(t=this.triggerTimer).call(t,this),5e3)},t.triggerTimer=function triggerTimer(){this.clearTimer(),this.saveLogs()},t.formatArgs=function formatArgs(t,i){var u=new Date;return"[NIM "+this.iid+" "+i+" "+(u.getMonth()+1+"-"+u.getDate()+" "+u.getHours()+":"+u.getMinutes()+":"+u.getSeconds()+":"+u.getMilliseconds())+"] "+map$7(t).call(t,(function(t){return t instanceof bl?t.toString():t instanceof Error?t&&t.message?t.message:t:"object"==typeof t?Ua(t):t})).join(" ")},t.destroy=function destroy(){this.debug=Pl,this.log=Pl,this.warn=Pl,this.error=Pl,this.saveLogs(),this.clearTimer(),this.storageArr=[],this.logStorage&&this.logStorage.close()},Logger}(),Fl="https://abt-online.netease.im/v1/api/abt/client/getExperimentInfo",Gl="imElite_sdk_abtest_web",callWithSafeIterationClosing=function(t,i,u,_){try{return _?i(anObject(u)[0],u[1]):i(u)}catch(i){iteratorClose(t,"throw",i)}},Bl=Array,Hl=!checkCorrectnessOfIteration((function(t){Array.from(t)}));_export({target:"Array",stat:!0,forced:Hl},{from:function from(t){var i=toObject(t),u=zt(this),_=arguments.length,h=_>1?arguments[1]:void 0,E=void 0!==h;E&&(h=functionBindContext(h,_>2?arguments[2]:void 0));var m,I,v,T,N,M,O=getIteratorMethod$5(i),S=0;if(!O||this===Bl&&isArrayIteratorMethod(O))for(m=lengthOfArrayLike(i),I=u?new this(m):Bl(m);m>S;S++)M=E?h(i[S],S):i[S],createProperty(I,S,M);else for(N=(T=getIterator(i,O)).next,I=u?new this:[];!(v=L(N,T)).done;S++)M=E?callWithSafeIterationClosing(T,h,[v.value,S],!0):v.value,createProperty(I,S,M);return I.length=S,I}});var Yl=j.Array.from,jl=getIteratorMethod$5,Kl=function(){function Backoff(t){void 0===t&&(t={}),this.attempts=0,this.ms=t.min||100,this.max=t.max||1e4,this.jitter=t.jitter||0,this.factor=t.factor||2}var t=Backoff.prototype;return t.duration=function duration(){var t,i=Math.pow(this.factor,this.attempts++);if(i===1/0||!isFinite(i))return 0|this.max;if(t=this.ms*i,!isFinite(t)||t>=this.max)return 0|this.max;if(this.jitter){var u=Math.random(),_=Math.floor(u*this.jitter*t);t=0==(1&Math.floor(10*u))?t-_:t+_,t=Math.max(Math.min(t,this.max),this.ms)}return 0|t},t.reset=function reset(){this.attempts=0},t.setMin=function setMin(t){this.ms=t},t.setMax=function setMax(t){this.max=t},t.setJitter=function setJitter(t){this.jitter=t},Backoff}(),ql=createCommonjsModule((function(t){var i=Object.prototype.hasOwnProperty,u="~";function Events(){}function EE(t,i,u){this.fn=t,this.context=i,this.once=u||!1}function addListener(t,i,_,h,E){if("function"!=typeof _)throw new TypeError("The listener must be a function");var m=new EE(_,h||t,E),I=u?u+i:i;return t._events[I]?t._events[I].fn?t._events[I]=[t._events[I],m]:t._events[I].push(m):(t._events[I]=m,t._eventsCount++),t}function clearEvent(t,i){0==--t._eventsCount?t._events=new Events:delete t._events[i]}function EventEmitter(){this._events=new Events,this._eventsCount=0}Object.create&&(Events.prototype=Object.create(null),(new Events).__proto__||(u=!1)),EventEmitter.prototype.eventNames=function eventNames(){var t,_,h=[];if(0===this._eventsCount)return h;for(_ in t=this._events)i.call(t,_)&&h.push(u?_.slice(1):_);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(t)):h},EventEmitter.prototype.listeners=function listeners(t){var i=u?u+t:t,_=this._events[i];if(!_)return[];if(_.fn)return[_.fn];for(var h=0,E=_.length,m=new Array(E);h<E;h++)m[h]=_[h].fn;return m},EventEmitter.prototype.listenerCount=function listenerCount(t){var i=u?u+t:t,_=this._events[i];return _?_.fn?1:_.length:0},EventEmitter.prototype.emit=function emit(t,i,_,h,E,m){var I=u?u+t:t;if(!this._events[I])return!1;var v,T,N=this._events[I],M=arguments.length;if(N.fn){switch(N.once&&this.removeListener(t,N.fn,void 0,!0),M){case 1:return N.fn.call(N.context),!0;case 2:return N.fn.call(N.context,i),!0;case 3:return N.fn.call(N.context,i,_),!0;case 4:return N.fn.call(N.context,i,_,h),!0;case 5:return N.fn.call(N.context,i,_,h,E),!0;case 6:return N.fn.call(N.context,i,_,h,E,m),!0}for(T=1,v=new Array(M-1);T<M;T++)v[T-1]=arguments[T];N.fn.apply(N.context,v)}else{var O,S=N.length;for(T=0;T<S;T++)switch(N[T].once&&this.removeListener(t,N[T].fn,void 0,!0),M){case 1:N[T].fn.call(N[T].context);break;case 2:N[T].fn.call(N[T].context,i);break;case 3:N[T].fn.call(N[T].context,i,_);break;case 4:N[T].fn.call(N[T].context,i,_,h);break;default:if(!v)for(O=1,v=new Array(M-1);O<M;O++)v[O-1]=arguments[O];N[T].fn.apply(N[T].context,v)}}return!0},EventEmitter.prototype.on=function on(t,i,u){return addListener(this,t,i,u,!1)},EventEmitter.prototype.once=function once(t,i,u){return addListener(this,t,i,u,!0)},EventEmitter.prototype.removeListener=function removeListener(t,i,_,h){var E=u?u+t:t;if(!this._events[E])return this;if(!i)return clearEvent(this,E),this;var m=this._events[E];if(m.fn)m.fn!==i||h&&!m.once||_&&m.context!==_||clearEvent(this,E);else{for(var I=0,v=[],T=m.length;I<T;I++)(m[I].fn!==i||h&&!m[I].once||_&&m[I].context!==_)&&v.push(m[I]);v.length?this._events[E]=1===v.length?v[0]:v:clearEvent(this,E)}return this},EventEmitter.prototype.removeAllListeners=function removeAllListeners(t){var i;return t?(i=u?u+t:t,this._events[i]&&clearEvent(this,i)):(this._events=new Events,this._eventsCount=0),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.addListener=EventEmitter.prototype.on,EventEmitter.prefixed=u,EventEmitter.EventEmitter=EventEmitter,t.exports=EventEmitter})),Wl="\t\n\v\f\r                 \u2028\u2029\ufeff",zl=R("".replace),$l="["+Wl+"]",Xl=RegExp("^"+$l+$l+"*"),Jl=RegExp($l+$l+"*$"),createMethod=function(t){return function(i){var u=toString(requireObjectCoercible(i));return 1&t&&(u=zl(u,Xl,"")),2&t&&(u=zl(u,Jl,"")),u}},Ql={start:createMethod(1),end:createMethod(2),trim:createMethod(3)},Zl=Ql.trim,eu=h.parseInt,tu=h.Symbol,ru=tu&&tu.iterator,nu=/^[+-]?0x/i,ou=R(nu.exec),iu=8!==eu(Wl+"08")||22!==eu(Wl+"0x16")||ru&&!fails((function(){eu(Object(ru))}))?function parseInt(t,i){var u=Zl(toString(t));return eu(u,i>>>0||(ou(nu,u)?16:10))}:eu;_export({global:!0,forced:parseInt!=iu},{parseInt:iu});var au=j.parseInt;function get(t,i){if("object"!=typeof t||null===t)return t;for(var u=(i=i||"").split("."),_=0;_<u.length;_++){var h=u[_],E=t[h],m=indexOf(h).call(h,"["),I=indexOf(h).call(h,"]");if(-1!==m&&-1!==I&&m<I){var v=slice(h).call(h,0,m),T=au(slice(h).call(h,m+1,I));E=t[v],E=Fa(E)?E[T]:void 0}if(null==E)return E;t=E}return t}var su=no.codeAt;_export({target:"String",proto:!0},{codePointAt:function codePointAt(t){return su(this,t)}});var cu=entryVirtual("String").codePointAt,lu=String.prototype,codePointAt=function(t){var i=t.codePointAt;return"string"==typeof t||t===lu||K(lu,t)&&i===lu.codePointAt?cu:i},uu=RangeError,du=String.fromCharCode,_u=String.fromCodePoint,pu=R([].join),hu=!!_u&&1!=_u.length;_export({target:"String",stat:!0,arity:1,forced:hu},{fromCodePoint:function fromCodePoint(t){for(var i,u=[],_=arguments.length,h=0;_>h;){if(i=+arguments[h++],toAbsoluteIndex(i,1114111)!==i)throw uu(i+" is not a valid code point");u[h]=i<65536?du(i):du(55296+((i-=65536)>>10),i%1024+56320)}return pu(u,"")}});var fu=j.String.fromCodePoint,Eu=br.some,mu=arrayMethodIsStrict("some");_export({target:"Array",proto:!0,forced:!mu},{some:function some(t){return Eu(this,t,arguments.length>1?arguments[1]:void 0)}});var gu=entryVirtual("Array").some,Iu=Array.prototype,some=function(t){var i=t.some;return t===Iu||K(Iu,t)&&i===Iu.some?gu:i},vu=TypeError,Tu=Object.getOwnPropertyDescriptor,Nu=A&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}()?function(t,i){if(Lt(t)&&!Tu(t,"length").writable)throw vu("Cannot set read only .length");return t.length=i}:function(t,i){return t.length=i},Mu=TypeError,deletePropertyOrThrow=function(t,i){if(!delete t[i])throw Mu("Cannot delete property "+tryToString(i)+" of "+tryToString(t))},Ou=arrayMethodHasSpeciesSupport("splice"),Su=Math.max,Ru=Math.min;_export({target:"Array",proto:!0,forced:!Ou},{splice:function splice(t,i){var u,_,h,E,m,I,v=toObject(this),T=lengthOfArrayLike(v),N=toAbsoluteIndex(t,T),M=arguments.length;for(0===M?u=_=0:1===M?(u=0,_=T-N):(u=M-2,_=Ru(Su(toIntegerOrInfinity(i),0),T-N)),doesNotExceedSafeInteger(T+u-_),h=arraySpeciesCreate(v,_),E=0;E<_;E++)(m=N+E)in v&&createProperty(h,E,v[m]);if(h.length=_,u<_){for(E=N;E<T-_;E++)I=E+u,(m=E+_)in v?v[I]=v[m]:deletePropertyOrThrow(v,I);for(E=T;E>T-_+u;E--)deletePropertyOrThrow(v,E-1)}else if(u>_)for(E=T-_;E>N;E--)I=E+u-1,(m=E+_-1)in v?v[I]=v[m]:deletePropertyOrThrow(v,I);for(E=0;E<u;E++)v[E+N]=arguments[E+2];return Nu(v,T-_+u),h}});var yu=entryVirtual("Array").splice,Au=Array.prototype,splice=function(t){var i=t.splice;return t===Au||K(Au,t)&&i===Au.splice?yu:i},Cu=function abs(t){var i;if(void 0!==t)return(i=BigNumber(t)).sign=1,i},bu=function isArray(t){return"[object Array]"===Object.prototype.toString.call(t)},Lu=function isValidType(t){var i;return some(i=["number"==typeof t,"string"==typeof t&&t.length>0,bu(t)&&t.length>0,t instanceof BigNumber]).call(i,(function(t){return!0===t}))},ku="Invalid Number",Du="Invalid Number - Division By Zero";function BigNumber(t){var i;if(!(this instanceof BigNumber))return new BigNumber(t);if(this.number=[],this.sign=1,this.rest=0,Lu(t)){if(bu(t)){for((t.length&&"-"===t[0]||"+"===t[0])&&(this.sign="+"===t[0]?1:-1,t.shift(0)),i=t.length-1;i>=0;i--)if(!this.addDigit(t[i]))return}else for("-"!==(t=t.toString()).charAt(0)&&"+"!==t.charAt(0)||(this.sign="+"===t.charAt(0)?1:-1,t=t.substring(1)),i=t.length-1;i>=0;i--)if(!this.addDigit(au(t.charAt(i),10)))return}else this.number=ku}BigNumber.prototype.addDigit=function(t){return function testDigit(t){return/^\d$/.test(t)}(t)?(this.number.push(t),this):(this.number=ku,!1)},BigNumber.prototype._compare=function(t){var i,u;if(!Lu(t))return null;if(i=BigNumber(t),this.sign!==i.sign)return this.sign;if(this.number.length>i.number.length)return this.sign;if(this.number.length<i.number.length)return-1*this.sign;for(u=this.number.length-1;u>=0;u--){if(this.number[u]>i.number[u])return this.sign;if(this.number[u]<i.number[u])return-1*this.sign}return 0},BigNumber.prototype.gt=function(t){return this._compare(t)>0},BigNumber.prototype.gte=function(t){return this._compare(t)>=0},BigNumber.prototype.equals=function(t){return 0===this._compare(t)},BigNumber.prototype.lte=function(t){return this._compare(t)<=0},BigNumber.prototype.lt=function(t){return this._compare(t)<0},BigNumber.prototype.subtract=function(t){var i;return void 0===t?this:(i=BigNumber(t),this.sign!==i.sign?(this.number=BigNumber._add(this,i),this):(this.sign=this.lt(i)?-1:1,this.number=Cu(this).lt(Cu(i))?BigNumber._subtract(i,this):BigNumber._subtract(this,i),this))},BigNumber._add=function(t,i){var u,_=0,h=Math.max(t.number.length,i.number.length);for(u=0;u<h||_>0;u++)t.number[u]=(_+=(t.number[u]||0)+(i.number[u]||0))%10,_=Math.floor(_/10);return t.number},BigNumber._subtract=function(t,i){var u,_,h=0,E=t.number.length;for(u=0;u<E;u++)t.number[u]-=(i.number[u]||0)+h,t.number[u]+=10*(h=t.number[u]<0?1:0);for(u=0,E=t.number.length-1;0===t.number[E-u]&&E-u>0;)u++;u>0&&splice(_=t.number).call(_,-u);return t.number},BigNumber.prototype.multiply=function(t){if(void 0===t)return this;var i,u,_=BigNumber(t),h=0,E=[];if(this.isZero()||_.isZero())return BigNumber(0);for(this.sign*=_.sign,i=0;i<this.number.length;i++)for(h=0,u=0;u<_.number.length||h>0;u++)E[i+u]=(h+=(E[i+u]||0)+this.number[i]*(_.number[u]||0))%10,h=Math.floor(h/10);return this.number=E,this},BigNumber.prototype.divide=function(t){if(void 0===t)return this;var i,u,_=BigNumber(t),h=[],E=BigNumber(0);if(_.isZero())return this.number=Du,this;if(this.isZero())return this.rest=BigNumber(0),this;if(this.sign*=_.sign,_.sign=1,1===_.number.length&&1===_.number[0])return this.rest=BigNumber(0),this;for(i=this.number.length-1;i>=0;i--)for(E.multiply(10),E.number[0]=this.number[i],h[i]=0;_.lte(E);)h[i]++,E.subtract(_);for(i=0,u=h.length-1;0===h[u-i]&&u-i>0;)i++;return i>0&&splice(h).call(h,-i),this.rest=E,this.number=h,this},BigNumber.prototype.mod=function(t){return this.divide(t).rest},BigNumber.prototype.isZero=function(){var t;for(t=0;t<this.number.length;t++)if(0!==this.number[t])return!1;return!0},BigNumber.prototype.toString=function(){var t,i="";if("string"==typeof this.number)return this.number;for(t=this.number.length-1;t>=0;t--)i+=this.number[t];return this.sign>0?i:"-"+i};var Vu=Math.pow(2,32);function varintToBytes(t){for(var i=new Uint8Array(5),u=new DataView(i.buffer),_=0;0!=(4294967168&t);)u.setUint8(_++,127&t|128),t>>>=7;return u.setUint8(_++,127&t),slice(i).call(i,0,_)}function encodeText(t){if("function"==typeof TextEncoder)return(new TextEncoder).encode(t);var i=function textEncoder(t){for(var i=[],u=t.length,_=0;_<u;){var h=codePointAt(t).call(t,_),E=0,m=0;for(h<=127?(E=0,m=0):h<=2047?(E=6,m=192):h<=65535?(E=12,m=224):h<=2097151&&(E=18,m=240),i.push(m|h>>E),E-=6;E>=0;)i.push(128|h>>E&63),E-=6;_+=h>=65536?2:1}return i}(t);return new Uint8Array(i)}function decodeText(t){return"function"==typeof TextDecoder?new TextDecoder("utf-8").decode(t):function textDecoder(t){for(var i="",u=0;u<t.length;){var _=t[u],h=0,E=0;if(_<=127?(h=0,E=255&_):_<=223?(h=1,E=31&_):_<=239?(h=2,E=15&_):_<=244&&(h=3,E=7&_),t.length-u-h>0)for(var m=0;m<h;)E=E<<6|63&(_=t[u+m+1]),m+=1;else E=65533,h=t.length-u;i+=fu(E),u+=h+1}return i}(t)}var wu=function(){function Unpack(t){this.offset=0,this.buffer=new Uint8Array(t),this.view=new DataView(t)}var t=Unpack.prototype;return t.checkBufferBoundaryAccess=function checkBufferBoundaryAccess(){return this.offset>=this.buffer.byteLength},t.length=function length(){var t;return(null===(t=this.view)||void 0===t?void 0:t.byteLength)||0},t.getBuffer=function getBuffer(){return this.view.buffer},t.getOffset=function getOffset(){return this.offset},t.popRaw=function popRaw(t){try{var i,u=slice(i=this.buffer).call(i,this.offset,this.offset+t);return this.offset+=t,u}catch(t){throw new Error("UnpackException raw "+(t&&t.message))}},t.popByte=function popByte(){try{var t=this.view.getUint8(this.offset);return this.offset+=1,t}catch(t){throw new Error("UnpackException byte "+(t&&t.message))}},t.popVarbin=function popVarbin(){return this.popRaw(this.popVarInt())},t.popString=function popString(){try{return decodeText(this.popVarbin())}catch(t){throw new Error("UnpackException string "+(t&&t.message))}},t.popInt=function popInt(){try{var t=this.view.getUint32(this.offset,!0);return this.offset+=4,t}catch(t){throw new Error("UnpackException int "+(t&&t.message))}},t.popVarInt=function popVarInt(){var t=1,i=0,u=0,_=0;do{if(i+=(127&(u=this.popByte()))*t,t*=128,(_+=1)>5)throw new Error("Variable length quantity is too long")}while(0!=(128&u));return i},t.popLong=function popLong(){try{var t,i=function getBigUint64(t,i){void 0===i&&(i=!1);var u=new DataView(t.buffer),_=i?[4,0]:[0,4],h=_[0],E=_[1],m=u.getUint32(h,i),I=u.getUint32(E,i);return m>0?m*Vu+I:I}(slice(t=this.buffer).call(t,this.offset,this.offset+8),!0);return this.offset+=8,Number(i)}catch(t){throw new Error("UnpackException long "+(t&&t.message))}},t.popShort=function popShort(){try{var t=this.view.getUint16(this.offset,!0);return this.offset+=2,t}catch(t){throw new Error("UnpackException short "+(t&&t.message))}},t.popBoolean=function popBoolean(){return this.popByte()>0},t.toString=function toString(){return Yl(new Uint8Array(this.buffer)).toString()},t.reset=function reset(){this.offset=0,this.buffer=null,this.view=null},Unpack}(),Pu=function(){function PacketDecoder(t){this.packetLength=0,this.serviceId=0,this.commandId=0,this.serialId=0,this.tag=0,this.resCode=200,this.innerHeader=null,this.msgId=0,this.bodyArr=[],this.unpack=new wu(t)}var t=PacketDecoder.prototype;return t.reset=function reset(){this.innerHeader=null,this.bodyArr=[],this.unpack.reset()},t.getBodyDetail=function getBodyDetail(){return this.bodyArr.join("")},t.unmarshalHeader=function unmarshalHeader(){var t,i=this._unmarshalHeader();this.packetLength=i.packetLength,this.serviceId=i.serviceId,this.commandId=i.commandId,this.serialId=i.serialId,this.tag=i.tag,this.resCode=i.resCode,4===i.serviceId&&includes(t=[1,2,10,11]).call(t,i.commandId)&&(this.msgId=this.unmarshalLong(),this.innerHeader=this._unmarshalHeader())},t._unmarshalHeader=function _unmarshalHeader(){var t=this.unpack.popVarInt(),i=this.unpack.popByte(),u=this.unpack.popByte(),_=this.unpack.popShort(),h=this.unpack.popByte(),E=200;return this.hasRescode(h)&&(E=this.unpack.popShort()),{packetLength:t,serviceId:i,commandId:u,serialId:_,tag:h,resCode:E}},t.hasRescode=function hasRescode(t){return 0!=((t=t||this.tag)&PacketDecoder.RES_CODE)},t.getHeader=function getHeader(){return{packetLength:this.packetLength,sid:this.serviceId,cid:this.commandId,ser:this.serialId,code:this.resCode}},t.getInnerHeader=function getInnerHeader(){return this.innerHeader?{sid:this.innerHeader.serviceId,cid:this.innerHeader.commandId}:null},t.unmarshalProperty=function unmarshalProperty(){var t=this.unpack.popVarInt(),i={};this.bodyArr.push("\nProperty("+t+") {");for(var u=0;u<t;u++){var _=this.unpack.popVarInt();this.bodyArr.push(_+":");var h=this.unpack.popString();this.bodyArr.push('"'+h.length+" "+this.unpack.getOffset()+'",'),i[_]=h}return this.bodyArr.push("},"),i},t.unmarshalPropertyArray=function unmarshalPropertyArray(){var t=this.unpack.popVarInt(),i=[];this.bodyArr.push("\nPropertyArray("+t+") [");for(var u=0;u<t;u++)i.push(this.unmarshalProperty());return this.bodyArr.push("],"),i},t.unmarshalLong=function unmarshalLong(){var t=this.unpack.popLong();return this.bodyArr.push("\nLong:"+t),t},t.unmarshalLongArray=function unmarshalLongArray(){var t=this.unpack.popVarInt(),i=[];this.bodyArr.push("\nLongArray "+t+":");for(var u=0;u<t;u++){var _=this.unpack.popLong();this.bodyArr.push(_+","),i.push(_)}return i},t.unmarshalStrArray=function unmarshalStrArray(){var t=this.unpack.popVarInt(),i=[];this.bodyArr.push("\nStrArray "+t+":");for(var u=0;u<t;u++){var _=this.unpack.popString();this.bodyArr.push(_+","),i.push(_)}return i},t.unmarshalStrLongMap=function unmarshalStrLongMap(){var t=this.unpack.popVarInt(),i={};this.bodyArr.push("\nStrLongMap "+t+":");for(var u=0;u<t;u++){var _=this.unpack.popString();this.bodyArr.push(_+",");var h=this.unpack.popLong();this.bodyArr.push(h+";"),i[_]=h}return i},t.unmarshalStrStrMap=function unmarshalStrStrMap(){var t=this.unpack.popVarInt(),i={};this.bodyArr.push("\nStrStrMap "+t+":");for(var u=0;u<t;u++){var _=this.unpack.popString();this.bodyArr.push(_+",");var h=this.unpack.popString();this.bodyArr.push(h+";"),i[_]=h}return i},t.unmarshalLongLongMap=function unmarshalLongLongMap(){var t=this.unpack.popVarInt(),i={};this.bodyArr.push("\nStrLongLongMap "+t+":");for(var u=0;u<t;u++){var _=this.unpack.popLong();this.bodyArr.push(_+",");var h=this.unpack.popLong();this.bodyArr.push(h+";"),i[_]=h}return{m_map:i}},t.unmarshalKVArray=function unmarshalKVArray(){var t=this.unpack.popVarInt(),i=[];this.bodyArr.push("\nKVArray "+t+":");for(var u=0;u<t;u++)i.push(this.unmarshalStrStrMap());return i},t.unmarshal=function unmarshal(t){var i,u=this,_=La(La({},this.getHeader()),{r:[]});if(this.innerHeader&&(_.r[0]=this.msgId,_.r[1]={body:[],headerPacket:this.getInnerHeader()}),!includes(i=[200,406,808,810,7101]).call(i,_.code))return Ua(_);if(this.packetLength>0&&this.packetLength>this.unpack.length())throw new Error("UnpackException packetLength("+this.packetLength+") greater than bufferLength("+this.unpack.length()+")");var h=[];return t&&forEach$1(t).call(t,(function(t){if(!u.unpack.checkBufferBoundaryAccess())switch(t.type){case"PropertyArray":h.push(u.unmarshalPropertyArray());break;case"Property":h.push(u.unmarshalProperty());break;case"Byte":h.push(u.unpack.popByte());break;case"Int":h.push(u.unpack.popInt());break;case"Bool":h.push(u.unpack.popBoolean());break;case"Long":h.push(u.unmarshalLong());break;case"LongArray":h.push(u.unmarshalLongArray());break;case"String":h.push(u.unpack.popString());break;case"StrArray":h.push(u.unmarshalStrArray());break;case"StrStrMap":h.push(u.unmarshalStrStrMap());break;case"StrLongMap":h.push(u.unmarshalStrLongMap());break;case"LongLongMap":h.push(u.unmarshalLongLongMap());break;case"KVArray":h.push(u.unmarshalKVArray())}})),this.innerHeader?_.r[1].body=h:_.r=h,Ua(_)},PacketDecoder}();function getPromiseWithAbort(t){var i={},u=new pa((function(t,u){i.abort=u}));return i.promise=pa.race([t,u]),i}Pu.RES_CODE=2,pa.reject;var xu=function(){function PromiseManager(){this.abortFns=[]}var t=PromiseManager.prototype;return t.add=function add(t){var i=getPromiseWithAbort(t);return this.abortFns.push(i.abort),i.promise},t.clear=function clear(t){var i;forEach$1(i=this.abortFns).call(i,(function(i){return i(t||new bl({code:Al.V2NIM_ERROR_CODE_CANCELLED,detail:{reason:"Aborted"}}))})),this.abortFns=[]},t.destroy=function destroy(){this.clear()},PromiseManager}(),Uu={tolerantRTT:3e3,bestRTT:100,maxChances:5,enable:!0},Fu={timestamp:0,rtt:0,baseClock:0,baseTime:0},Gu=function(){function TimeOrigin(t,i,u){void 0===u&&(u="getServerTime"),this.serverOrigin=Fu,this.config=Uu,this.isSettingNTP=!1,this.currentChance=0,this.failedDelay=2e3,this.successDelay=3e5,this.timer=0,this.cmdName="getServerTime",this.core=t,this.logger=t.logger,this.promiseManager=new xu,this.cmdName=u,i&&this.setOptions(i)}var t=TimeOrigin.prototype;return t.setOptions=function setOptions(t){this.config=La({},Uu,this.config,t)},t.reset=function reset(){this.timer&&clearTimeout(this.timer),this.promiseManager.clear(),this.serverOrigin=Fu,this.currentChance=0},t.setOriginTimetick=function setOriginTimetick(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var t,i,u,_,h,E,m,I,v,T;return Ra.wrap((function _callee$(N){for(;;)switch(N.prev=N.next){case 0:if(this.config.enable){N.next=2;break}return N.abrupt("return");case 2:if(!this.isSettingNTP){N.next=4;break}return N.abrupt("return");case 4:if(!(this.currentChance>=this.config.maxChances)){N.next=6;break}return N.abrupt("return");case 6:if(t=get(this.core,"auth.status"),i=get(this.core,"status"),u=get(this.core,"V2NIMLoginService.lifeCycle.loginStatus"),"logined"===t||"logined"===i||1===u){N.next=11;break}return N.abrupt("return");case 11:return this.isSettingNTP=!0,this.currentChance++,this.timer&&clearTimeout(this.timer),this.timer=0,_="TimeOrigin::setOriginTimetick:",h=Ka(),this.core.logger.debug(_+" getServerTime start, times "+this.currentChance),N.prev=18,N.next=21,this.promiseManager.add(this.core.sendCmd(this.cmdName));case 21:m=N.sent,E=get(m,"content.time"),this.isSettingNTP=!1,N.next=33;break;case 26:return N.prev=26,N.t0=N.catch(18),I=N.t0,this.isSettingNTP=!1,this.logger.warn(_+" Calculate Delay time, getServerTime error",I),I.code!==Al.V2NIM_ERROR_CODE_CANCELLED&&(clearTimeout(this.timer),this.timer=gs(bind$1(v=this.setOriginTimetick).call(v,this),this.failedDelay)),N.abrupt("return");case 33:if(E){N.next=37;break}return this.core.logger.warn(_+" Calculate Delay time incorrect format"),this.config.enable=!1,N.abrupt("return");case 37:T=Ka()-h,this.doSet(E,T);case 39:case"end":return N.stop()}}),_callee,this,[[18,26]])})))},t.doSet=function doSet(t,i){var u,_="TimeOrigin::setOriginTimetick:";if(i>this.config.tolerantRTT)this.logger.warn(_+" denied RTT:"+i),clearTimeout(this.timer),this.timer=gs(bind$1(u=this.setOriginTimetick).call(u,this),this.failedDelay);else if(i>this.config.bestRTT){var h;this.serverOrigin.rtt&&i>=this.serverOrigin.rtt?this.logger.warn(_+" ignore RTT:"+i):(this.setServerOrigin(i,t),this.logger.log(_+" accept reluctantly RTT:"+i)),clearTimeout(this.timer),this.timer=gs(bind$1(h=this.setOriginTimetick).call(h,this),this.failedDelay)}else{var E;this.setServerOrigin(i,t),this.logger.debug(_+" accept best RTT:"+i),this.currentChance=0,clearTimeout(this.timer),this.timer=gs(bind$1(E=this.setOriginTimetick).call(E,this),this.successDelay)}},t.getNTPTime=function getNTPTime(t){if(void 0===t&&(t=this.getTimeNode()),this.checkNodeReliable(t)){var i=Math.floor(t.time-this.serverOrigin.baseTime);return this.serverOrigin.timestamp+i}return Ka()},t.checkNodeReliable=function checkNodeReliable(t){if(void 0===t&&(t=this.getTimeNode()),this.serverOrigin.timestamp){if(0===this.serverOrigin.baseClock)return!0;var i=t.clock-this.serverOrigin.baseClock,u=t.time-this.serverOrigin.baseTime;return Math.abs(u-i)<500}return!1},t.checkPerformance=function checkPerformance(){return"BROWSER"===Os.platform&&!("undefined"==typeof performance||!performance.now)},TimeOrigin.checkPerformance=function checkPerformance(){return"BROWSER"===Os.platform&&!("undefined"==typeof performance||!performance.now)},t.getTimeNode=function getTimeNode(){return{clock:this.checkPerformance()?performance.now():0,time:Ka()}},TimeOrigin.getTimeNode=function getTimeNode(){return{clock:TimeOrigin.checkPerformance()?performance.now():0,time:Ka()}},t.setServerOrigin=function setServerOrigin(t,i){this.serverOrigin={timestamp:i+Math.floor(t/2),rtt:t,baseClock:this.checkPerformance()?performance.now():0,baseTime:Ka()}},TimeOrigin}();function _createForOfIteratorHelperLoose$3(t,i){var u,_=void 0!==Zn&&jl(t)||t["@@iterator"];if(_)return bind$1(u=(_=_.call(t)).next).call(u,_);if(Fa(t)||(_=function _unsupportedIterableToArray$3(t,i){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$3(t,i);var _=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===_&&t.constructor&&(_=t.constructor.name),"Map"===_||"Set"===_?Yl(t):"Arguments"===_||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_)?_arrayLikeToArray$3(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){_&&(t=_);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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$3(t,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,_=Array(i);u<i;u++)_[u]=t[u];return _}var Bu={},Hu={};function createCmd(t,i,u,_){var h=Bu[t];if(!h)return u.error("createCmd:: can not find cmd config: ",t),null;var E,m={SER:i,SID:h.sid,CID:h.cid,Q:[]};h.params&&_&&forEach$1(E=h.params).call(E,(function(t){var i=_[t.name];if(null!=i){var u=t.type,h=t.reflectMapper,E=t.select;switch(t.type){case"PropertyArray":u="ArrayMable",i=map$7(i).call(i,(function(t){return{t:"Property",v:h?serialize(t,h,E):t}}));break;case"Property":i=h?serialize(i,h,E):i;break;case"Bool":i=i?"true":"false"}m.Q.push({t:u,v:i})}}));return{packet:m,hasPacketResponse:"boolean"!=typeof h.hasPacketResponse||h.hasPacketResponse,hasPacketTimer:"boolean"!=typeof h.hasPacketTimer||h.hasPacketTimer}}function parseCmd(t,i){var u,_;try{_=JSON.parse(t)}catch(u){return void i.error('Parse command error:"'+t+'"')}var h=_.sid+"_"+_.cid,E=_.r;if(includes(u=["4_1","4_2","4_10","4_11"]).call(u,h)){var m=_.r[1].headerPacket;h=m.sid+"_"+m.cid,_.sid=m.sid,_.cid=m.cid,E=_.r[1].body}var I=Hu[h],v=[];if(I&&I.length>0){for(var T,N=_createForOfIteratorHelperLoose$3(I);!(T=N()).done;){var M=T.value;v.push(parseEachCmd(_,M.config,M.cmd,E,i))}return v}i.error("parseCmd:: mapper not exist",h,_.code)}function parseEachCmd(t,i,u,_,h){var E,m={cmd:u,raw:t,error:null,service:null==i?void 0:i.service,content:{},__receiveTimeNode:Gu.getTimeNode()};(function isV2Sid(t){var i;return includes(i=[18,19,26,27,28,29,30,31,32,33,34,35,36]).call(i,t)})(i.sid)&&(t.code=function toReadableCode(t){if("number"!=typeof t||t!=t)throw new bl({code:Al.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"Read code failed",rawData:""+t}});if(t<0||t>=0&&t<1e3||t>=2e4&&t<=20099)return t;var i=(65535&t)>>9;i-=i<=38?1:2;return 1e5+1e3*i+(511&t)}(t.code));var I,v=function genCmdError(t,i){var u=Cl[t],_=Vl[t];return null===_?null:new bl({code:t,desc:u||_||t,detail:{cmd:i,timetag:Ka()}})}(t.code,u);if(m.error=v,m.error){if(m.error.detail.cmd=u,!(null===(E=null==i?void 0:i.ignoreErrCodes)||void 0===E?void 0:includes(E).call(E,t.code)))return m;h.warn("parseCmd:: ignore error ",m.error),m.error.detail.ignore=!0}i.response&&forEach$1(I=i.response).call(I,(function(t,i){var u=_[i],h=t.type,E=t.name,I=t.reflectMapper;if(void 0!==u)switch(h){case"Property":m.content[E]=I?deserialize(u,I):u;break;case"PropertyArray":m.content[E]=map$7(u).call(u,(function(t){return I?deserialize(t,I):t}));break;case"Int":case"Long":case"Byte":m.content[E]=+u;break;case"Bool":m.content[E]="true"===u||!0===u||1===u;break;default:m.content[E]=u}}));return m}function serialize(t,i,u){var _={};for(var h in t=function flattenObjByMapper(t,i){var u={};for(var _ in i){for(var h,E=i[_],m="number"==typeof E?_:E.access?E.access:_,I=t,v=_createForOfIteratorHelperLoose$3(m.split("."));!(h=v()).done;){var T=h.value;if(void 0===I[T]||null===I[T]){I=void 0;break}I=I[T]}void 0!==I&&(u[m]=I)}return u}(t,i),i){var E=i[h],m="number"==typeof E?h:E.access?E.access:h;if(!u||includes(u).call(u,h))if(m in t){if("number"==typeof E)_[E]=t[m];else if("object"==typeof E)if(E.converter){var I=E.converter(t[m],t);void 0!==I&&(_[E.id]=I)}else _[E.id]=t[m]}else"object"==typeof E&&E.def&&("function"==typeof E.def?_[E.id]=E.def(t):_[E.id]=E.def)}return _}function deserialize(t,i){var u={};for(var _ in t){var h=i[_];if("string"==typeof h)u[h]=t[_];else if("object"==typeof h&&"prop"in h){var E=h.access?h.access:h.prop;if(h.converter){var m=h.converter(t[_],t);void 0!==m&&(u[E]=m)}else h.type&&"number"===h.type?u[E]=+t[_]:h.type&&"boolean"===h.type?u[E]=!("0"===t[_]||!t[_]):u[E]=t[_]}}for(var I in i){var v=i[I];if(v&&void 0!==v.def){var T=v.access?v.access:v.prop;T in u||("function"==typeof v.def?u[T]=v.def(t):u[T]=v.def)}}return u=function unflattenObj(t){var i={},u=function _loop(u){var _=u.split(".");reduce(_).call(_,(function(i,h,E){return i[h]||(i[h]=isNaN(Number(_[E+1]))?_.length-1==E?t[u]:{}:[])}),i)};for(var _ in t)u(_);return i}(u),u}function registerParser(t){for(var i in La(Bu,t.cmdConfig),t.cmdMap){var u=t.cmdMap[i],_=t.cmdConfig[u];if(_)if(Fa(Hu[i])){for(var h,E=!1,m=_createForOfIteratorHelperLoose$3(Hu[i]);!(h=m()).done;){var I=h.value;if(I.cmd===u&&I.config.service===_.service){E=!0;break}}E||Hu[i].push({config:_,cmd:u})}else Hu[i]=[{config:_,cmd:u}]}}function invertSerializeItem(t){var i={};for(var u in t){var _=t[u];"number"==typeof _?i[_]=u:"object"==typeof _&&(i[_.id]={prop:u,type:_.retType,access:_.retAccess?_.retAccess:_.access?_.access:u,def:_.retDef,converter:_.retConverter})}return i}function boolToInt(t){return t?1:0}function objectToJSONString(t){if(t&&"object"==typeof t)try{return Ua(t)}catch(t){return}}function stringToJSONObject(t){if(t&&"string"==typeof t)try{return JSON.parse(t)}catch(t){return}}var Yu=function(){function Pack(){this.offset=0,this.pageSize=1024,this.capacity=1048576,this.buffer=new Uint8Array(this.pageSize),this.view=new DataView(this.buffer.buffer)}var t=Pack.prototype;return t.reset=function reset(){this.offset=0,this.buffer=null,this.view=null},t.size=function size(){return this.offset},t.getBuffer=function getBuffer(){var t;return slice(t=this.buffer).call(t,0,this.offset).buffer},t.ensureCapacity=function ensureCapacity(t){var i=this.offset+t;if(i>this.capacity)throw new Error("PackException over limit");if(i>this.buffer.byteLength){var u=Math.ceil(i/this.pageSize)*this.pageSize,_=new Uint8Array(u);_.set(this.buffer),this.buffer=_,this.view=new DataView(this.buffer.buffer)}},t.putRaw=function putRaw(t){this.ensureCapacity(t.length);try{this.buffer.set(t,this.offset),this.offset+=t.length}catch(t){throw new Error("PackException raw")}},t.putByte=function putByte(t){this.ensureCapacity(1);try{this.view.setUint8(this.offset++,t)}catch(t){throw new Error("PackException byte")}},t.putString=function putString(t){try{var i=encodeText(t);this.putVarbin(i)}catch(t){throw new Error("PackException string")}},t.putInt=function putInt(t){this.ensureCapacity(4);try{this.view.setInt32(this.offset,t,!0),this.offset+=4}catch(t){throw new Error("PackException int")}},t.putVarInt=function putVarInt(t){var i=varintToBytes(t);this.putRaw(i)},t.putBoolean=function putBoolean(t){this.ensureCapacity(1);try{this.view.setUint8(this.offset++,t?1:0)}catch(t){throw new Error("PackException boolean")}},t.putLong=function putLong(t){this.ensureCapacity(8);try{var i=function setBigUint64(t,i){void 0===i&&(i=!1);var u=new Uint8Array(8),_=new DataView(u.buffer),h=Number(t>Vu-1?t/Vu:0),E=Number(4294967295&t),m=i?[4,0]:[0,4],I=m[0],v=m[1];return _.setUint32(I,h,i),_.setUint32(v,E,i),u}(t,!0);this.buffer.set(i,this.offset),this.offset+=8}catch(t){throw new Error("PackException long")}},t.putStringAsLong=function putStringAsLong(t){this.ensureCapacity(8);try{var i=function setBigUint64ForNumberOverflow(t,i){var u,_;void 0===i&&(i=!1);var h=new Uint8Array(8),E=new DataView(h.buffer),m=reverse(u=BigNumber(t).divide(Vu).number).call(u).join(""),I=reverse(_=BigNumber(t).mod(Vu).number).call(_).join(""),v=Number(m),T=Number(I),N=i?[4,0]:[0,4],M=N[0],O=N[1];return E.setUint32(M,v,i),E.setUint32(O,T,i),h}(t,!0);this.buffer.set(i,this.offset),this.offset+=8}catch(t){throw new Error("PackException stringAsLong")}},t.putShort=function putShort(t){this.ensureCapacity(2);try{this.view.setInt16(this.offset,t,!0),this.offset+=2}catch(t){throw new Error("PackException short")}},t.putVarbin=function putVarbin(t){if(!t)return this.ensureCapacity(1),this.putVarInt(0);if(t.byteLength>Math.pow(2,31)-2)throw new Error("PackException varbin. too long");var i=varintToBytes(t.length);this.ensureCapacity(i.length+t.length);try{this.buffer.set(i,this.offset),this.offset+=i.length,this.buffer.set(t,this.offset),this.offset+=t.length}catch(t){throw new Error("PackException varbin")}},Pack}();function isConvertibleToNumber(t){if("number"!=typeof t){if(null==t)return!1;t=Number(t)}if(isNaN(t))throw new Error("Number type conversion error");return!0}function isUndefinedOrNull(t){return null==t}var ju=function(){function PacketEncoder(t,i,u){this.pack=new Yu,this.packetLength=0,this.serviceId=0,this.commandId=0,this.serialId=0,this.tag=0,this.serviceId=t,this.commandId=i,this.serialId=u}var t=PacketEncoder.prototype;return t.marshalHeader=function marshalHeader(){this.pack.putVarInt(this.packetLength),this.pack.putByte(this.serviceId),this.pack.putByte(this.commandId),this.pack.putShort(this.serialId),this.pack.putByte(this.tag)},t.marshalProperty=function marshalProperty(t){var i=this,u=cs(t),_=filter(u).call(u,(function(t){return!isUndefinedOrNull(t)}));this.pack.putVarInt(_.length),forEach$1(_).call(_,(function(u){i.pack.putVarInt(Number(u)),Fa(t[u])||"[object Object]"===Object.prototype.toString.call(t[u])?i.pack.putString(Ua(t[u])):i.pack.putString(String(t[u]))}))},t.marshalPropertyArray=function marshalPropertyArray(t){var i=this,u=t.length;this.pack.putVarInt(u),forEach$1(t).call(t,(function(t){i.marshalProperty(null==t?void 0:t.v)}))},t.marshalStrArray=function marshalStrArray(t){var i=this,u=filter(t).call(t,(function(t){return!isUndefinedOrNull(t)})),_=u.length;this.pack.putVarInt(_),forEach$1(u).call(u,(function(t){i.pack.putString(String(t))}))},t.marshalLongArray=function marshalLongArray(t){var i=this,u=filter(t).call(t,(function(t){return isConvertibleToNumber(t)})),_=u.length;this.pack.putVarInt(_),forEach$1(u).call(u,(function(t){i.putLong(t)}))},t.marshalStrStrMap=function marshalStrStrMap(t){var i=this,u=cs(t),_=filter(u).call(u,(function(i){return!isUndefinedOrNull(t[i])&&!isUndefinedOrNull(i)}));this.pack.putVarInt(_.length),forEach$1(_).call(_,(function(u){i.pack.putString(String(u)),i.pack.putString(String(t[u]))}))},t.marshalStrLongMap=function marshalStrLongMap(t){var i=this,u=cs(t),_=filter(u).call(u,(function(i){return isConvertibleToNumber(t[i])&&!isUndefinedOrNull(i)}));this.pack.putVarInt(_.length),forEach$1(_).call(_,(function(u){i.pack.putString(String(u)),i.putLong(t[u])}))},t.marshalLongLongMap=function marshalLongLongMap(t){var i=this,u=cs(t),_=filter(u).call(u,(function(i){var u=Number(i);return isConvertibleToNumber(u)&&isConvertibleToNumber(t[u])}));this.pack.putVarInt(_.length),forEach$1(_).call(_,(function(u){var _=Number(u);i.putLong(_),i.putLong(t[_])}))},t.marshalKVArray=function marshalKVArray(t){var i=this,u=t.length;this.pack.putVarInt(u),forEach$1(t).call(t,(function(t){i.marshalStrStrMap(t)}))},t.putLong=function putLong(t){"string"==typeof t&&t.length>15?this.pack.putStringAsLong(t):this.pack.putLong(Number(t))},t.marshal=function marshal(t,i){var u=this;return this.marshalHeader(),i&&forEach$1(i).call(i,(function(i,_){var h,E=i.type,m=null===(h=t[_])||void 0===h?void 0:h.v;if(!isUndefinedOrNull(m))switch(E){case"PropertyArray":u.marshalPropertyArray(m);break;case"Property":u.marshalProperty(m);break;case"Byte":if(!isConvertibleToNumber(m))return;u.pack.putByte(Number(m));break;case"Int":if(!isConvertibleToNumber(m))return;u.pack.putInt(Number(m));break;case"Bool":"false"===m?m=!1:"true"===m&&(m=!0),u.pack.putBoolean(m);break;case"Long":if(!isConvertibleToNumber(m))return;u.putLong(m);break;case"LongArray":u.marshalLongArray(m);break;case"String":u.pack.putString(String(m));break;case"StrArray":u.marshalStrArray(m);break;case"StrStrMap":u.marshalStrStrMap(m);break;case"StrLongMap":u.marshalStrLongMap(m);break;case"LongLongMap":u.marshalLongLongMap(m);break;case"KVArray":u.marshalKVArray(m)}})),this.pack.getBuffer()},t.reset=function reset(){this.pack.reset()},PacketEncoder}(),Ku=Math.min,qu=[].lastIndexOf,Wu=!!qu&&1/[1].lastIndexOf(1,-0)<0,zu=arrayMethodIsStrict("lastIndexOf"),$u=Wu||!zu?function lastIndexOf(t){if(Wu)return T(qu,this,arguments)||0;var i=toIndexedObject(this),u=lengthOfArrayLike(i),_=u-1;for(arguments.length>1&&(_=Ku(_,toIntegerOrInfinity(arguments[1]))),_<0&&(_=u+_);_>=0;_--)if(_ in i&&i[_]===t)return _||0;return-1}:qu;_export({target:"Array",proto:!0,forced:$u!==[].lastIndexOf},{lastIndexOf:$u});var Xu,Ju=entryVirtual("Array").lastIndexOf,Qu=Array.prototype,lastIndexOf=function(t){var i=t.lastIndexOf;return t===Qu||K(Qu,t)&&i===Qu.lastIndexOf?Ju:i},Zu=An.PROPER,ed=Ql.trim;_export({target:"String",proto:!0,forced:(Xu="trim",fails((function(){return!!Wl[Xu]()||"​…᠎"!=="​…᠎"[Xu]()||Zu&&Wl[Xu].name!==Xu})))},{trim:function trim(){return ed(this)}});var td=entryVirtual("String").trim,rd=String.prototype,trim$1=function(t){var i=t.trim;return"string"==typeof t||t===rd||K(rd,t)&&i===rd.trim?td:i};var nd,od=(nd=function _s4(){return(65536*(1+Math.random())|0).toString(16).substring(1)},function(){return nd()+nd()+nd()+nd()+nd()+nd()+nd()+nd()});function assignOptions(t,i){return function assignWith(t,i,u,_){for(var h in t=t||{},u=u||{},_=_||function(){},i=i||{}){var E=_(t[h],i[h]);t[h]=void 0===E?i[h]:E}for(var m in u){var I=_(t[m],u[m]);t[m]=void 0===I?u[m]:I}return t}({},t,i,(function(t,i){return void 0===i?t:i}))}function getFileExtension(t){var i=lastIndexOf(t).call(t,"."),u=i>-1?slice(t).call(t,i+1):"";return/^\d+$/.test(trim$1(u).call(u))&&(u=""),u}var id,ad=function(t){function BaseWebsocket(i,u,_){var h;return(h=t.call(this)||this).websocket=null,h.socketConnectTimer=0,h.linkSSL=!0,h.url="",h.core=i,h.url=u,h.linkSSL=_,h.status="disconnected",h.logger=i.logger,h.connect(),h}bt(BaseWebsocket,t);var i=BaseWebsocket.prototype;return i.connect=function connect(){"connecting"!==this.status&&"connected"!==this.status?(this.status="connecting",this._createWebsocket((this.linkSSL?"wss":"ws")+"://"+this.url+"/websocket")):this.logger.warn("imsocket::socket is connecting or connected",this.status)},i.close=function close(){if(this.status="disconnected",this.websocket){this.logger.log("imsocket:: close websocket");try{this.websocket.close()}catch(t){this.logger.warn("imsocket::attempt to close websocket error",t)}this.clean(),this.emit("disconnect")}},i.clean=function clean(){this.status="disconnected",clearTimeout(this.socketConnectTimer),this.websocket&&(this.socketUrl=void 0,this.websocket.onmessage=null,this.websocket.onopen=null,this.websocket.onerror=null,this.websocket.onclose=null,this.websocket=null)},i.onConnect=function onConnect(){this.status="connected",this.emit("connect"),clearTimeout(this.socketConnectTimer)},i._createWebsocket=function _createWebsocket(t){var i,u=this;this.socketConnectTimer=gs((function(){u.logger.error("imsocket::Websocket connect timeout. url: ",t),u.emit("connectFailed",new bl({code:"v2"===get(u.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_CONNECT_TIMEOUT:415,detail:{reason:"imsocket::Websocket connect timeout. url: "+t}}))}),this.core.options.socketConnectTimeout||8e3),this.socketUrl=t,this.websocket=new Os.WebSocket(t),this.websocket.binaryType="arraybuffer",this.websocket.onmessage=bind$1(i=this.onMessage).call(i,this),this.websocket.onclose=function(t){t=t||{},u.logger.log("imsocket::Websocket onclose done "+t.wasClean+"/"+t.code+"/"+t.reason),"connected"===u.status?(u.clean(),u.emit("disconnect")):(u.clean(),u.emit("connectFailed",new bl({code:"v2"===get(u.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_CONNECT_FAILED:414,detail:{reason:"imsocket::Websocket onclose done"}})))},this.websocket.onerror=function(t){u.logger.error("imsocket::Websocket onerror",t),"connected"===u.status?(u.clean(),u.emit("disconnect")):(u.clean(),u.emit("connectFailed",new bl({code:"v2"===get(u.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_CONNECT_FAILED:414,detail:{reason:"imsocket::Websocket onerror."}})))},this.websocket.onopen=function(){u.onConnect()}},i.onMessage=function onMessage(t){if(t.data){var i=new Pu(t.data),u={sid:-1,cid:-1,ser:-1,packetLength:-1},_=null;try{i.unmarshalHeader(),u=i.getHeader(),_=i.getInnerHeader()}catch(i){this.reportBinaryError({err:i,sid:_?_.sid:null==u?void 0:u.sid,cid:_?_.cid:null==u?void 0:u.cid,rawBuf:t.data,type:"decode"})}var h=_?_.sid:u.sid,E=_?_.cid:u.cid,m=h+"_"+E,I=Hu[m];if(I&&I.length>0){var v,T=I[0].config;try{v=i.unmarshal(T.response)}catch(_){var N=i.getBodyDetail();this.reportBinaryError({err:_,rawBuf:t.data,sid:h,cid:E,parseDetail:N,type:"decode"}),i.reset();var M=La(La({},u),{sid:h,cid:E,code:Al.V2NIM_ERROR_CODE_UNPACK_ERROR});return this.logger.error('imsocket::onMessage "'+M.sid+"_"+M.cid+'", ser '+M.ser+", packetLength "+M.packetLength+" unmarshal error. "+N+" \n",_),void this.emit("message",Ua(M))}this.emit("message",v)}else this.core.logger.warn("imsocket::onMessage cmd not found",m);i.reset()}},i.send=function send(t,i,u,_,h){var E,m,I=new ju(t,i,u),v=Bu[_],T="";try{T=Ua(h),m=I.marshal(JSON.parse(T),v.params)}catch(_){throw this.reportBinaryError({err:_,sid:t,cid:i,rawStr:T,type:"encode"}),I.reset(),new bl({code:Al.V2NIM_ERROR_CODE_PACK_ERROR,detail:{reason:t+"-"+i+", ser "+u+" marshal error",rawError:_}})}null===(E=this.websocket)||void 0===E||E.send(m),I.reset()},i.reportBinaryError=function reportBinaryError(t){var i,u,_,h=t.err,E=t.rawStr,m=t.sid,I=t.cid,v=t.type,T=t.parseDetail,N=t.rawBuf;if(N){try{_=function arrayBufferToBase64(t){if("function"!=typeof btoa)return"";for(var i="",u=new Uint8Array(t),_=u.byteLength,h=0;h<_;h++)i+=String.fromCharCode(u[h]);return u=null,btoa(i)}(N)}catch(t){_="reportBinaryError::arrayBufferToBase64 parsing failed, error: "+(null==t?void 0:t.message)+", sid: "+m+", cid: "+I,this.core.logger.error(_)}N=null}this.core.reporter.reportTraceStart("exceptions",{user_id:null===(i=this.core.auth)||void 0===i?void 0:i.account,trace_id:null===(u=this.core.clientSocket.socket)||void 0===u?void 0:u.sessionId,start_time:Ka(),action:2,exception_service:9});var M=h?(h.message+";;;"||h.code+";;;")+(T?"parseDetail: "+T+";;;":"")+(E?" rawStr: "+E:"")+(_?" rawBuf: "+_:""):"";this.core.reporter.reportTraceUpdateV2("exceptions",{code:"encode"===v?Al.V2NIM_ERROR_CODE_PACK_ERROR:Al.V2NIM_ERROR_CODE_UNPACK_ERROR,description:M,operation_type:"encode"===v?3:4,target:m+"-"+I},{asyncParams:Os.net.getNetworkStatus()}),this.core.reporter.reportTraceEnd("exceptions",1)},BaseWebsocket}(ql);function _createForOfIteratorHelperLoose$2(t,i){var u,_=void 0!==Zn&&jl(t)||t["@@iterator"];if(_)return bind$1(u=(_=_.call(t)).next).call(u,_);if(Fa(t)||(_=function _unsupportedIterableToArray$2(t,i){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$2(t,i);var _=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===_&&t.constructor&&(_=t.constructor.name),"Map"===_||"Set"===_?Yl(t):"Arguments"===_||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_)?_arrayLikeToArray$2(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){_&&(t=_);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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$2(t,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,_=Array(i);u<i;u++)_[u]=t[u];return _}!function(t){t[t.ACTIVE=1]="ACTIVE",t[t.KICKED=2]="KICKED",t[t.OFFLINE=3]="OFFLINE"}(id||(id={}));var sd,cd=function(){function V2BinaryClientSocket(t){this.isReconnect=!1,this.packetTimeout=8e3,this.linkSSL=!0,this.packetSer=1,this.backoff=new Kl({max:8e3,min:1600,jitter:.01}),this.sendingCmdMap=new oc,this.pingTimer=0,this.hasNetworkListener=!1,this.core=t,this.auth=t.auth,this.logger=t.logger,this.reporter=t.reporter,this.timerManager=t.timerManager,this.eventBus=t.eventBus,this.setListener()}var t=V2BinaryClientSocket.prototype;return t.setListener=function setListener(){var t=this;this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLoginSucc",(function(){t.isReconnect=!0}))},t.setSessionId=function setSessionId(t){this.socket&&(this.socket.sessionId=t)},t.setLinkSSL=function setLinkSSL(t){this.linkSSL=t},t.connect=function connect(t,i){var u,_;return void 0===i&&(i=!1),__awaiter(this,void 0,void 0,Ra.mark((function _callee(){var h,E,m,I;return Ra.wrap((function _callee$(v){for(;;)switch(v.prev=v.next){case 0:if(this.isReconnect=i,1!==(h=this.core.auth.getConnectStatus())){v.next=7;break}return E="clientSocket::connect status is "+h+", and would not repeat connect",m=new bl({code:Al.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:{reason:E}}),this.logger.warn(E),v.abrupt("return",pa.reject(m));case 7:return this.auth.lifeCycle.processEvent("connect"),v.prev=8,v.next=11,this.auth.doLoginStepsManager.add(this.doConnect(t));case 11:this.logger.log("clientSocketV2:: connect success with link url: "+t+", isReconnect: "+i),this.core.reporter.reportTraceUpdateV2("login",{operation_type:"TCP",target:t,code:200,mixlink:!0,succeed:!0},{asyncParams:Os.net.getNetworkStatus()}),this.auth.lifeCycle.processEvent("connectSucc"),v.next=28;break;case 16:if(v.prev=16,v.t0=v.catch(8),I=v.t0,this.core.reporter.reportTraceUpdateV2("login",{operation_type:"TCP",target:t,code:I.code||0,description:"connectFailed:"+I.message,mixlink:!0,succeed:!1},{asyncParams:Os.net.getNetworkStatus()}),I.code!==Al.V2NIM_ERROR_CODE_CANCELLED&&I.code!==Al.V2NIM_ERROR_CODE_TIMEOUT){v.next=25;break}throw null===(u=this.socket)||void 0===u||u.close(),null===(_=this.socket)||void 0===_||_.removeAllListeners(),this.socket=void 0,v.t0;case 25:throw this.logger.warn("clientSocketV2::connect failed with link url: "+t,I),this.auth.lifeCycle.processEvent("connectFail",I),v.t0;case 28:case"end":return v.stop()}}),_callee,this,[[8,16]])})))},t.doConnect=function doConnect(t){var i=this,u=!1;return new pa((function(_,h){var E;i.socket=new ad(i.core,t,i.linkSSL),i.socket.on("connect",(function(){i.logger.log("clientSocketV2::socket on connect",t),i.core.reporterHookLinkKeep.start(),i.core.reporterHookLinkKeep.update({code:0,description:"connection begin",operation_type:0,target:t}),u=!0,_()})),i.socket.on("message",bind$1(E=i.onMessage).call(E,i)),i.socket.on("disconnect",(function(_){return __awaiter(i,void 0,void 0,Ra.mark((function _callee2(){return Ra.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:return u=!0,this.logger.log("clientSocketV2::socket on disconnect "+t,_),i.next=4,this.core.reporterHookLinkKeep.update({code:(null==_?void 0:_.code)||0,description:(null==_?void 0:_.reason)||"socket on disconnect",operation_type:1,target:t});case 4:this.core.reporterHookLinkKeep.end(!1),this.doDisconnect(id.OFFLINE,"SocketOnDisconnect");case 6:case"end":return i.stop()}}),_callee2,this)})))})),i.socket.on("connectFailed",(function(_){u?i.ping():(i.logger.error("clientSocketV2::connectFailed:"+t+", reason:"+(_&&_.message)),i.cleanSocket()),u=!0,h(_)}))}))},t.cleanSocket=function cleanSocket(){this.socket&&("function"==typeof this.socket.removeAllListeners&&this.socket.removeAllListeners(),"function"==typeof this.socket.close&&this.socket.close(),this.socket=void 0)},t.resetSocketConfig=function resetSocketConfig(){this.backoff.reset(),this.initOnlineListener()},t.doDisconnect=function doDisconnect(t,i){if(this.logger.log("clientSocketV2::doDisconnect:type:"+t+",reason:",i),0!==this.core.auth.getConnectStatus()){var u={1:"close",2:"kicked",3:"broken"}[t]||"";this.markAllCmdInvaild(new bl({code:Al.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"Packet timeout due to instance disconnect",disconnect_reason:u}})),this.timerManager.destroy(),clearTimeout(this.pingTimer),this.cleanSocket(),t===id.ACTIVE||t===id.KICKED?this.destroyOnlineListener():t===id.OFFLINE&&(this.auth.lifeCycle.processEvent("connectionBroken",new bl({code:Al.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"connection broken due to internal reasons"}})),this.logger.log("clientSocketV2::doDisconnect: pending reconnect "+this.isReconnect),this.isReconnect&&this.auth.lifeCycle.processEvent("waiting"))}else this.logger.warn("clientSocketV2::doDisconnect:already disconnected")},t.sendCmd=function sendCmd(t,i,u){var _=this,h=this.core.auth.getLoginStatus(),E=["v2Login","login","chatroomLogin","v2ChatroomLogin"],m={cmd:t};if(1!==h&&!includes(E).call(E,t))return this.logger.warn("clientSocketV2::NIM login status is "+h+", so can not sendCmd "+t),pa.reject(new bl({code:Al.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:La({reason:"Can not sendCmd due to no logined"},m)}));var I="heartbeat"!==t,v=I?this.packetSer++:0,T=createCmd(t,v,this.logger,i);if(!T){var N=new bl({code:Al.V2NIM_ERROR_CODE_INTERNAL,detail:La(La({},m),{reason:"SendCmd::createCmd error: "+v+" "+t})});return this.logger.error(N),pa.reject(N)}var M=T.packet,O=T.hasPacketResponse,S=T.hasPacketTimer,R=Ua(M);I&&(this.logger.getDebugMode()?this.logger.debug("clientSocketV2::sendCmd: "+M.SID+"_"+M.CID+","+t+",ser:"+v,R):this.logger.log("clientSocketV2::sendCmd: "+M.SID+"_"+M.CID+","+t+",ser:"+v));var A=(new Date).getTime();return new pa((function(h,E){O&&_.sendingCmdMap.set(v,{cmd:t,params:i,callback:[h,E],timer:S?gs((function(){var i=new bl({code:Al.V2NIM_ERROR_CODE_PROTOCOL_TIMEOUT,detail:La({ser:v,reason:"Packet Timeout: ser "+v+" cmd "+t,timetag:(new Date).getTime()},m)});_.markCmdInvalid(v,i,t)}),u&&u.timeout?u.timeout:_.packetTimeout):null});try{_.socket.send(M.SID,M.CID,v,t,M.Q),O||h(M)}catch(i){var I=new bl({code:Al.V2NIM_ERROR_CODE_PROTOCOL_SEND_FAILED,detail:La({ser:v,reason:"Unable to send packet"+(i&&i.message?": "+i.message:""),timetag:(new Date).getTime(),rawError:i},m)});_.markCmdInvalid(v,I,t),E(I)}})).catch((function(t){return __awaiter(_,void 0,void 0,Ra.mark((function _callee3(){var i,u;return Ra.wrap((function _callee3$(_){for(;;)switch(_.prev=_.next){case 0:if(i=t,u=[Al.V2NIM_ERROR_CODE_DISCONNECT,Al.V2NIM_ERROR_CODE_PROTOCOL_TIMEOUT,Al.V2NIM_ERROR_CODE_PROTOCOL_SEND_FAILED],includes(u).call(u,i.code)){_.next=4;break}return _.abrupt("return",pa.reject(i));case 4:return this.reportSendCmdFailed(i,{sid:M.SID,cid:M.CID,ser:v},A),_.abrupt("return",pa.reject(i));case 6:case"end":return _.stop()}}),_callee3,this)})))}))},t.reportSendCmdFailed=function reportSendCmdFailed(t,i,u){var _;this.reporter.reportTraceStart("exceptions",{user_id:this.core.auth.getLoginUser(),trace_id:null===(_=this.socket)||void 0===_?void 0:_.sessionId,start_time:u,action:2,exception_service:6});var h=get(t,"detail.disconnect_reason")||"",E=t.code===Al.V2NIM_ERROR_CODE_DISCONNECT?Ua({disconnect_reason:h}):t.detail.reason;this.reporter.reportTraceUpdateV2("exceptions",{code:t.code,description:E,operation_type:1,target:i.sid+"-"+i.cid,context:""+i.ser},{asyncParams:Os.net.getNetworkStatus()}),this.reporter.reportTraceEnd("exceptions",1)},t.onMessage=function onMessage(t){var i=parseCmd(t,this.logger);if(i&&i.length>0){var u=i[0],_=u.raw.ser;u.error&&(this.logger.error("clientSocketV2::onMessage packet error",u.raw.sid+"_"+u.raw.cid+", ser:"+_+",",u.error),u.error.code===Al.V2NIM_ERROR_CODE_UNPACK_ERROR&&this.core.eventBus.emit("BinaryClientSocket/unpackError")),"heartbeat"!==u.cmd&&(this.logger.getDebugMode()?this.logger.debug("clientSocketV2::recvCmd "+u.raw.sid+"_"+u.raw.cid+","+u.cmd+",ser:"+_,t):this.logger.log("clientSocketV2::recvCmd "+u.raw.sid+"_"+u.raw.cid+","+u.cmd+",ser:"+_+",code:"+u.raw.code));for(var h,E=_createForOfIteratorHelperLoose$2(i);!(h=E()).done;){var m=h.value;this.packetHandler(m)}}},t.packetHandler=function packetHandler(t){var i,u,_,h,E=this;if(t){var m=t.raw.ser,I=this.sendingCmdMap.get(m);if(I&&I.cmd===t.cmd){var v=I.callback,T=I.timer,N=I.params;if(clearTimeout(T),t.params=N,this.sendingCmdMap.delete(m),"heartbeat"===t.cmd)return void v[0]();var M=null===(u=null===(i=this.core[t.service])||void 0===i?void 0:i.process)||void 0===u?void 0:u.call(i,t);M&&"function"==typeof M.then?M.then((function(t){v[0](t)})).catch((function(t){v[1](t)})):(this.logger.log("clientSocketV2::handlerFn without promise",t.service,t.cmd),v[0](t))}else{var O=null===(h=null===(_=this.core[t.service])||void 0===_?void 0:_.process)||void 0===h?void 0:h.call(_,t);O&&"function"==typeof O.then&&O.catch((function(t){E.logger.error("clientSocketV2::no obj cache, no process handler",t)}))}}},t.markCmdInvalid=function markCmdInvalid(t,i,u){var _=this.sendingCmdMap.get(t);if(_){var h=_.callback,E=_.timer;E&&clearTimeout(E),this.sendingCmdMap.delete(t),this.logger.warn("clientSocketV2::packet "+t+", "+u+" is invalid:",i),h[1](i)}},t.markAllCmdInvaild=function markAllCmdInvaild(t){var i,u=this;this.logger.log("markAllCmdInvaild",t),forEach$1(i=this.sendingCmdMap).call(i,(function(i){var _=i.callback,h=i.timer,E=i.cmd;u.logger.log("clientSocketV2::markAllCmdInvaild:cmd "+E),h&&clearTimeout(h),_[1](t)})),this.sendingCmdMap.clear()},t.ping=function ping(){var t;return __awaiter(this,void 0,void 0,Ra.mark((function _callee4(){var i=this;return Ra.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return clearTimeout(this.pingTimer),u.prev=1,u.next=4,this.sendCmd("heartbeat");case 4:u.next=20;break;case 6:if(u.prev=6,u.t0=u.catch(1),u.t0.code!==Al.V2NIM_ERROR_CODE_DISCONNECT){u.next=11;break}return u.abrupt("return");case 11:return u.next=13,this.testHeartBeat5Timeout();case 13:if(!u.sent){u.next=20;break}return u.next=17,this.core.reporterHookLinkKeep.update({code:0,description:"Heartbeat-discovered link failure",operation_type:1,target:null===(t=this.socket)||void 0===t?void 0:t.url});case 17:return this.core.reporterHookLinkKeep.end(!0),this.doDisconnect(id.OFFLINE,"PingError"),u.abrupt("return");case 20:this.pingTimer=gs((function(){i.ping()}),3e4);case 21:case"end":return u.stop()}}),_callee4,this,[[1,6]])})))},t.testHeartBeat5Timeout=function testHeartBeat5Timeout(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee5(){var t;return Ra.wrap((function _callee5$(i){for(;;)switch(i.prev=i.next){case 0:clearTimeout(this.pingTimer),t=0;case 2:if(!(t<5)){i.next=15;break}return i.prev=3,i.next=6,this.sendCmd("heartbeat",{},{timeout:3e3});case 6:return i.abrupt("return",!1);case 9:i.prev=9,i.t0=i.catch(3),this.logger.log("clientSocketV2::test heartbeat "+t+" Timeout");case 12:t++,i.next=2;break;case 15:return i.abrupt("return",!0);case 16:case"end":return i.stop()}}),_callee5,this,[[3,9]])})))},t.initOnlineListener=function initOnlineListener(){var t=this;this.hasNetworkListener||(this.logger.log("clientSocketV2::onlineListener:init"),this.hasNetworkListener=!0,Os.net.onNetworkStatusChange((function(i){t.logger.log("clientSocketV2::onlineListener:network change",i);var u=t.auth.getLoginStatus();i.isConnected&&1===u?t.ping():i.isConnected&&3===u?(t.logger.log("clientSocketV2::onlineListener:online and connectStatus is waiting, do reLogin"),t.auth.reconnect.clearReconnectTimer(),t.auth.reconnect.doReLogin()):i.isConnected||t.doDisconnect(id.OFFLINE,"OfflineListener")})))},t.destroyOnlineListener=function destroyOnlineListener(){this.logger.log("clientSocketV2::onlineListener:destroy"),Os.net.offNetworkStatusChange(),this.hasNetworkListener=!1},V2BinaryClientSocket}(),ld=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"],ud=["transport not supported","client not handshaken","unauthorized"],dd=["reconnect"],_d=function(t){function BaseWebsocket(i,u,_){var h;return(h=t.call(this)||this).websocket=null,h.socketConnectTimer=0,h.url="",h.linkSSL=!0,h.core=i,h.url=u,h.linkSSL=_,h.status="disconnected",h.logger=i.logger,h.connect(),h}bt(BaseWebsocket,t);var i=BaseWebsocket.prototype;return i.connect=function connect(){var t=this;"connecting"!==this.status&&"connected"!==this.status?(this.status="connecting",this.core.adapters.request((this.linkSSL?"https":"http")+"://"+this.url+"/socket.io/1/?t="+Ka(),{method:"GET",dataType:"text",timeout:this.core.options.xhrConnectTimeout||8e3},{exception_service:6}).then((function(i){if("connecting"===t.status){var u=i.data.split(":"),_=u[0];return u[1],t.sessionId=_,t.logger.log("imsocket::XHR success. status "+t.status+", "+("connecting"===t.status?"continue websocket connection":"stop websocket connection")),t._createWebsocket((t.linkSSL?"wss":"ws")+"://"+t.url+"/socket.io/1/websocket/"+_)}})).catch((function(i){if("connecting"===t.status){var u='imsocket::XHR fail. raw message: "'+(i=i||{}).message+'", code: "'+i.code+'"',_=i.code;_="v2"===get(t.core,"options.apiVersion")?i.code===Al.V2NIM_ERROR_CODE_CONNECT_TIMEOUT?Al.V2NIM_ERROR_CODE_CONNECT_TIMEOUT:Al.V2NIM_ERROR_CODE_CONNECT_FAILED:408===i.code?408:415;var h=new bl({code:_,detail:{reason:u,rawError:i}});t.logger.error(u),t.status="disconnected",t.emit("handshakeFailed",h)}}))):this.logger.warn("imsocket::socket is connecting or connected",this.status)},i.close=function close(){if(this.status="disconnected",this.websocket){this.logger.log("imsocket:: close websocket");try{this.websocket.send(this.encodePacket({type:"disconnect"}))}catch(t){this.logger.warn("imsocket::attempt to send encodePacket error",t)}try{this.websocket.close()}catch(t){this.logger.warn("imsocket::attempt to close websocket error",t)}this.clean(),this.emit("disconnect",{code:0,reason:"Active close websocket"})}},i.clean=function clean(){this.status="disconnected",clearTimeout(this.socketConnectTimer),this.websocket&&(this.socketUrl=void 0,this.websocket.onmessage=null,this.websocket.onopen=null,this.websocket.onerror=null,this.websocket.onclose=null,this.websocket=null)},i.onConnect=function onConnect(){this.status="connected",this.emit("connect"),clearTimeout(this.socketConnectTimer)},i._createWebsocket=function _createWebsocket(t){var i,u=this;this.socketConnectTimer=gs((function(){u.logger.error("imsocket::Websocket connect timeout. url: ",u.socketUrl),u.emit("handshakeFailed",new bl({code:"v2"===get(u.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_CONNECT_TIMEOUT:415,detail:{reason:"imsocket::Websocket connect timeout. url: "+u.socketUrl}}))}),this.core.options.socketConnectTimeout||8e3),this.socketUrl=t,this.websocket=new Os.WebSocket(t),this.websocket.onmessage=bind$1(i=this.onMessage).call(i,this),this.websocket.onclose=function(t){t=t||{},u.logger.log("imsocket::Websocket onclose done "+t.wasClean+"/"+t.code+"/"+t.reason),u.clean(),u.emit("disconnect",{code:t.code||0,reason:t.reason})},this.websocket.onerror=function(t){u.logger.error("imsocket::Websocket onerror",t),"logined"===u.core.status&&u.core.clientSocket.ping()}},i.onMessage=function onMessage(t){var i,u=this.decodePacket(t.data);if(u)switch(u.type){case"connect":this.onConnect();break;case"disconnect":this.close(),this.emit("disconnect",{code:0,reason:"MessageEvent type disconnect"});break;case"message":case"json":this.emit("message",u.data);break;case"event":u.name&&this.emit(u.name,u.args);break;case"error":"unauthorized"===u.reason?this.emit("connect_failed",u.reason):this.emit("error",u.reason),this.logger.error("imsocket::Websocket connect failed, onmessage type error. url: ",this.socketUrl),clearTimeout(this.socketConnectTimer),this.emit("handshakeFailed",new bl({code:"v2"===get(this.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_CONNECT_FAILED:408,detail:{reason:"imsocket::Websocket connect failed, onMessage socket error. url: "+this.socketUrl}}));break;case"heartbeat":null===(i=this.websocket)||void 0===i||i.send(this.encodePacket({type:"heartbeat"}));break;default:this.logger.warn("imsocket::Websocket no handler type",u.type)}},i.encodePacket=function encodePacket(t){var i,u,_=t.type,h=t.id,E=void 0===h?"":h,m=t.endpoint,I=void 0===m?"":m,v=t.ack,T=null;if(!_)return"";switch(_){case"error":i=t.reason?indexOf(ud).call(ud,t.reason):"",u=t.advice?indexOf(dd).call(dd,t.advice):"",""===i&&""===u||(T=i+(""!==u?"+"+u:""));break;case"message":""!==t.data&&(T=t.data);break;case"event":i={name:t.name},i=t.args&&t.args.length?{name:t.name,args:t.args}:{name:t.name},T=Ua(i);break;case"json":T=Ua(t.data);break;case"connect":t.qs&&(T=t.qs);break;case"ack":T=t.ackId+(t.args&&t.args.length?"+"+Ua(t.args):"")}var N=[indexOf(ld).call(ld,_),E+("data"===v?"+":""),I];return null!=T&&N.push(T),N.join(":")},i.decodePacket=function decodePacket(t){if(t)if("�"!=t.charAt(0)){var i=t.match(/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/);if(i){var u,_=i[1],h=i[2],E=i[3],m=i[4],I=i[5],v={type:ld[+_],endpoint:m};switch(h&&(v.id=h,v.ack=!E||"data"),v.type){case"error":u=I.split("+"),v.reason=ud[+u[0]]||"";break;case"message":v.data=I||"";break;case"connect":v.qs=I||"";break;case"event":try{var T=JSON.parse(I);v.name=T.name,v.args=T.args}catch(t){this.logger.error("imsocket::parseData::type::event error",t)}v.args=v.args||[];break;case"json":try{v.data=JSON.parse(I)}catch(t){this.logger.error("imsocket::parseData::type::json error",t)}break;case"ack":if((u=I.match(/^([0-9]+)(\+)?(.*)/))&&(v.ackId=u[1],v.args=[],u[3]))try{v.args=u[3]?JSON.parse(u[3]):[]}catch(t){this.logger.error("imsocket::parseData::type::ack error",t)}}return v}}else this.logger.error("imsocket::unrecognize dataStr",slice(t).call(t,0,20))},i.send=function send(t){var i,u={data:t,type:"message",endpoint:""};null===(i=this.websocket)||void 0===i||i.send(this.encodePacket(u))},BaseWebsocket}(ql);function _createForOfIteratorHelperLoose$1(t,i){var u,_=void 0!==Zn&&jl(t)||t["@@iterator"];if(_)return bind$1(u=(_=_.call(t)).next).call(u,_);if(Fa(t)||(_=function _unsupportedIterableToArray$1(t,i){if(t){var u;if("string"==typeof t)return _arrayLikeToArray$1(t,i);var _=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===_&&t.constructor&&(_=t.constructor.name),"Map"===_||"Set"===_?Yl(t):"Arguments"===_||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_)?_arrayLikeToArray$1(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){_&&(t=_);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,_=Array(i);u<i;u++)_[u]=t[u];return _}!function(t){t[t.ACTIVE=1]="ACTIVE",t[t.KICKED=2]="KICKED",t[t.OFFLINE=3]="OFFLINE"}(sd||(sd={}));var pd=function(){function V2ClientSocket(t){this.isReconnect=!1,this.packetTimeout=8e3,this.linkSSL=!0,this.packetSer=1,this.backoff=new Kl({max:8e3,min:1600,jitter:.01}),this.sendingCmdMap=new oc,this.pingTimer=0,this.hasNetworkListener=!1,this.core=t,this.auth=t.auth,this.logger=t.logger,this.reporter=t.reporter,this.timerManager=t.timerManager,this.eventBus=t.eventBus,this.setListener()}var t=V2ClientSocket.prototype;return t.setListener=function setListener(){var t=this;this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLoginSucc",(function(){t.isReconnect=!0}))},t.setSessionId=function setSessionId(t){this.socket&&(this.socket.sessionId=t)},t.setLinkSSL=function setLinkSSL(t){this.linkSSL=t},t.connect=function connect(t,i){var u,_;return void 0===i&&(i=!1),__awaiter(this,void 0,void 0,Ra.mark((function _callee(){var h,E,m,I;return Ra.wrap((function _callee$(v){for(;;)switch(v.prev=v.next){case 0:if(this.isReconnect=i,1!==(h=this.core.auth.getConnectStatus())){v.next=7;break}return E="clientSocket::connect status is "+h+", and would not repeat connect",m=new bl({code:Al.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:{reason:E}}),this.logger.warn(E),v.abrupt("return",pa.reject(m));case 7:return this.auth.lifeCycle.processEvent("connect"),v.prev=8,v.next=11,this.auth.doLoginStepsManager.add(this.doConnect(t));case 11:this.logger.log("clientSocketV2:: connect success with link url: "+t+", isReconnect: "+i),this.core.reporter.reportTraceUpdateV2("login",{operation_type:"TCP",target:t,code:200,mixlink:!0,succeed:!0},{asyncParams:Os.net.getNetworkStatus()}),this.auth.lifeCycle.processEvent("connectSucc"),v.next=28;break;case 16:if(v.prev=16,v.t0=v.catch(8),I=v.t0,this.core.reporter.reportTraceUpdateV2("login",{operation_type:"TCP",target:t,code:I.code||0,description:"connectFailed:"+I.message,mixlink:!0,succeed:!1},{asyncParams:Os.net.getNetworkStatus()}),I.code!==Al.V2NIM_ERROR_CODE_CANCELLED&&I.code!==Al.V2NIM_ERROR_CODE_TIMEOUT){v.next=25;break}throw null===(u=this.socket)||void 0===u||u.close(),null===(_=this.socket)||void 0===_||_.removeAllListeners(),this.socket=void 0,v.t0;case 25:throw this.logger.warn("clientSocketV2::connect failed with link url: "+t,I),this.auth.lifeCycle.processEvent("connectFail",I),v.t0;case 28:case"end":return v.stop()}}),_callee,this,[[8,16]])})))},t.doConnect=function doConnect(t){var i=this,u=!1;return new pa((function(_,h){var E;i.socket=new _d(i.core,t,i.linkSSL),i.socket.on("connect",(function(){i.logger.log("clientSocketV2::socket on connect",t),i.core.reporterHookLinkKeep.start(),i.core.reporterHookLinkKeep.update({code:0,description:"connection begin",operation_type:0,target:t}),u=!0,_()})),i.socket.on("message",bind$1(E=i.onMessage).call(E,i)),i.socket.on("disconnect",(function(_){return __awaiter(i,void 0,void 0,Ra.mark((function _callee2(){return Ra.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:return u=!0,this.logger.log("clientSocketV2::socket on disconnect",_),i.next=4,this.core.reporterHookLinkKeep.update({code:(null==_?void 0:_.code)||0,description:(null==_?void 0:_.reason)||"socket on disconnect",operation_type:1,target:t});case 4:this.core.reporterHookLinkKeep.end(!1),this.doDisconnect(sd.OFFLINE,"SocketOnDisconnect");case 6:case"end":return i.stop()}}),_callee2,this)})))})),i.socket.on("handshakeFailed",(function(t){u?i.ping():(i.logger.error('clientSocketV2::handshake failed: "'+(t&&t.message)+'"'),i.cleanSocket()),u=!0,h(t)}))}))},t.cleanSocket=function cleanSocket(){this.socket&&("function"==typeof this.socket.removeAllListeners&&this.socket.removeAllListeners(),"function"==typeof this.socket.close&&this.socket.close(),this.socket=void 0)},t.resetSocketConfig=function resetSocketConfig(){this.backoff.reset(),this.initOnlineListener()},t.doDisconnect=function doDisconnect(t,i){if(this.logger.log("clientSocketV2::doDisconnect:type:"+t+",reason:",i),0!==this.core.auth.getConnectStatus()){var u={1:"close",2:"kicked",3:"broken"}[t]||"";this.markAllCmdInvaild(new bl({code:Al.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"Packet timeout due to instance disconnect",disconnect_reason:u}})),this.timerManager.destroy(),clearTimeout(this.pingTimer),this.cleanSocket(),t===sd.ACTIVE||t===sd.KICKED?this.destroyOnlineListener():t===sd.OFFLINE&&(this.auth.lifeCycle.processEvent("connectionBroken",new bl({code:Al.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"connection broken due to internal reasons"}})),this.logger.log("clientSocketV2::doDisconnect: pending reconnect "+this.isReconnect),this.isReconnect&&this.auth.lifeCycle.processEvent("waiting"))}else this.logger.warn("clientSocketV2::doDisconnect:already disconnected")},t.sendCmd=function sendCmd(t,i,u){var _=this,h=this.core.auth.getLoginStatus(),E=["v2Login","login","chatroomLogin","v2ChatroomLogin"],m={cmd:t};if(1!==h&&!includes(E).call(E,t))return this.logger.warn("clientSocketV2::NIM login status is "+h+", so can not sendCmd "+t),pa.reject(new bl({code:Al.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:La({reason:"Can not sendCmd due to no logined"},m)}));var I="heartbeat"!==t,v=I?this.packetSer++:0,T=createCmd(t,v,this.logger,i);if(!T){var N=new bl({code:Al.V2NIM_ERROR_CODE_INTERNAL,detail:La(La({},m),{reason:"SendCmd::createCmd error: "+v+" "+t})});return this.logger.error(N),pa.reject(N)}var M=T.packet,O=T.hasPacketResponse,S=T.hasPacketTimer,R=Ua(M);I&&(this.logger.getDebugMode()?this.logger.debug("clientSocketV2::sendCmd: "+M.SID+"_"+M.CID+","+t+",ser:"+v,R):this.logger.log("clientSocketV2::sendCmd: "+M.SID+"_"+M.CID+","+t+",ser:"+v));var A=(new Date).getTime();return new pa((function(h,E){O&&_.sendingCmdMap.set(v,{cmd:t,params:i,callback:[h,E],timer:S?gs((function(){var i=new bl({code:Al.V2NIM_ERROR_CODE_PROTOCOL_TIMEOUT,detail:La({ser:v,reason:"Packet Timeout: ser "+v+" cmd "+t,timetag:(new Date).getTime()},m)});_.markCmdInvalid(v,i,t)}),u&&u.timeout?u.timeout:_.packetTimeout):null});try{_.socket.send(R),O||h(M)}catch(i){var I=new bl({code:Al.V2NIM_ERROR_CODE_PROTOCOL_SEND_FAILED,detail:La({ser:v,reason:"Unable to send packet"+(i&&i.message?": "+i.message:""),timetag:(new Date).getTime(),rawError:i},m)});_.markCmdInvalid(v,I,t),E(I)}})).catch((function(t){return __awaiter(_,void 0,void 0,Ra.mark((function _callee3(){var i,u,_,h,E;return Ra.wrap((function _callee3$(m){for(;;)switch(m.prev=m.next){case 0:if(u=t,_=[Al.V2NIM_ERROR_CODE_DISCONNECT,Al.V2NIM_ERROR_CODE_PROTOCOL_TIMEOUT,Al.V2NIM_ERROR_CODE_PROTOCOL_SEND_FAILED],includes(_).call(_,u.code)){m.next=4;break}return m.abrupt("return",pa.reject(u));case 4:return this.reporter.reportTraceStart("exceptions",{user_id:this.core.auth.getLoginUser(),trace_id:null===(i=this.socket)||void 0===i?void 0:i.sessionId,start_time:A,action:2,exception_service:6}),h=get(u,"detail.disconnect_reason")||"",E=u.code===Al.V2NIM_ERROR_CODE_DISCONNECT?Ua({disconnect_reason:h}):u.detail.reason,this.reporter.reportTraceUpdateV2("exceptions",{code:u.code,description:E,operation_type:1,target:M.SID+"-"+M.CID,context:""+M.SER},{asyncParams:Os.net.getNetworkStatus()}),this.reporter.reportTraceEnd("exceptions",1),m.abrupt("return",pa.reject(u));case 10:case"end":return m.stop()}}),_callee3,this)})))}))},t.onMessage=function onMessage(t){var i=parseCmd(t,this.logger);if(i&&i.length>0){var u=i[0],_=u.raw.ser;u.error&&this.logger.error("clientSocketV2::onMessage packet error",u.raw.sid+"_"+u.raw.cid+", ser:"+_+",",u.error),"heartbeat"!==u.cmd&&(this.logger.getDebugMode()?this.logger.debug("clientSocketV2::recvCmd "+u.raw.sid+"_"+u.raw.cid+","+u.cmd+",ser:"+_,u.content):this.logger.log("clientSocketV2::recvCmd "+u.raw.sid+"_"+u.raw.cid+","+u.cmd+",ser:"+_+";code:"+u.raw.code));for(var h,E=_createForOfIteratorHelperLoose$1(i);!(h=E()).done;){var m=h.value;this.packetHandler(m)}}},t.packetHandler=function packetHandler(t){var i,u,_,h,E=this;if(t){var m=t.raw.ser,I=this.sendingCmdMap.get(m);if(I&&I.cmd===t.cmd){var v=I.callback,T=I.timer,N=I.params;if(clearTimeout(T),t.params=N,this.sendingCmdMap.delete(m),"heartbeat"===t.cmd)return void v[0]();var M=null===(u=null===(i=this.core[t.service])||void 0===i?void 0:i.process)||void 0===u?void 0:u.call(i,t);M&&"function"==typeof M.then?M.then((function(t){v[0](t)})).catch((function(t){v[1](t)})):(this.logger.log("clientSocketV2::handlerFn without promise",t.service,t.cmd),v[0](t))}else{var O=null===(h=null===(_=this.core[t.service])||void 0===_?void 0:_.process)||void 0===h?void 0:h.call(_,t);O&&"function"==typeof O.then&&O.catch((function(t){E.logger.error("clientSocketV2::no obj cache, no process handler",t)}))}}},t.markCmdInvalid=function markCmdInvalid(t,i,u){var _=this.sendingCmdMap.get(t);if(_){var h=_.callback,E=_.timer;E&&clearTimeout(E),this.sendingCmdMap.delete(t),this.logger.warn("clientSocketV2::packet "+t+", "+u+" is invalid:",i),h[1](i)}},t.markAllCmdInvaild=function markAllCmdInvaild(t){var i,u=this;this.logger.log("markAllCmdInvaild",t),forEach$1(i=this.sendingCmdMap).call(i,(function(i){var _=i.callback,h=i.timer,E=i.cmd;u.logger.log("clientSocketV2::markAllCmdInvaild:cmd "+E),h&&clearTimeout(h),_[1](t)})),this.sendingCmdMap.clear()},t.ping=function ping(){var t;return __awaiter(this,void 0,void 0,Ra.mark((function _callee4(){var i=this;return Ra.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:return clearTimeout(this.pingTimer),u.prev=1,u.next=4,this.sendCmd("heartbeat");case 4:u.next=20;break;case 6:if(u.prev=6,u.t0=u.catch(1),u.t0.code!==Al.V2NIM_ERROR_CODE_DISCONNECT){u.next=11;break}return u.abrupt("return");case 11:return u.next=13,this.testHeartBeat5Timeout();case 13:if(!u.sent){u.next=20;break}return u.next=17,this.core.reporterHookLinkKeep.update({code:0,description:"Heartbeat-discovered link failure",operation_type:1,target:null===(t=this.socket)||void 0===t?void 0:t.url});case 17:return this.core.reporterHookLinkKeep.end(!0),this.doDisconnect(sd.OFFLINE,"PingError"),u.abrupt("return");case 20:this.pingTimer=gs((function(){i.ping()}),3e4);case 21:case"end":return u.stop()}}),_callee4,this,[[1,6]])})))},t.testHeartBeat5Timeout=function testHeartBeat5Timeout(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee5(){var t;return Ra.wrap((function _callee5$(i){for(;;)switch(i.prev=i.next){case 0:clearTimeout(this.pingTimer),t=0;case 2:if(!(t<5)){i.next=15;break}return i.prev=3,i.next=6,this.sendCmd("heartbeat",{},{timeout:3e3});case 6:return i.abrupt("return",!1);case 9:i.prev=9,i.t0=i.catch(3),this.logger.log("clientSocketV2::test heartbeat "+t+" Timeout");case 12:t++,i.next=2;break;case 15:return i.abrupt("return",!0);case 16:case"end":return i.stop()}}),_callee5,this,[[3,9]])})))},t.initOnlineListener=function initOnlineListener(){var t=this;this.hasNetworkListener||(this.logger.log("clientSocketV2::onlineListener:init"),this.hasNetworkListener=!0,Os.net.onNetworkStatusChange((function(i){t.logger.log("clientSocketV2::onlineListener:network change",i);var u=t.auth.getConnectStatus(),_=t.auth.getLoginStatus();i.isConnected&&1===_?t.ping():i.isConnected&&3===u?(t.logger.log("clientSocketV2::onlineListener:online and connectStatus is waiting, do reLogin"),t.auth.reconnect.clearReconnectTimer(),t.auth.reconnect.doReLogin()):i.isConnected||t.doDisconnect(sd.OFFLINE,"OfflineListener")})))},t.destroyOnlineListener=function destroyOnlineListener(){this.logger.log("clientSocketV2::onlineListener:destroy"),Os.net.offNetworkStatusChange(),this.hasNetworkListener=!1},V2ClientSocket}();function _createForOfIteratorHelperLoose(t,i){var u,_=void 0!==Zn&&jl(t)||t["@@iterator"];if(_)return bind$1(u=(_=_.call(t)).next).call(u,_);if(Fa(t)||(_=function _unsupportedIterableToArray(t,i){if(t){var u;if("string"==typeof t)return _arrayLikeToArray(t,i);var _=slice(u={}.toString.call(t)).call(u,8,-1);return"Object"===_&&t.constructor&&(_=t.constructor.name),"Map"===_||"Set"===_?Yl(t):"Arguments"===_||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_)?_arrayLikeToArray(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){_&&(t=_);var h=0;return function(){return h>=t.length?{done:!0}:{done:!1,value:t[h++]}}}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,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,_=Array(i);u<i;u++)_[u]=t[u];return _}var hd=function(){function TimerManager(){this.timerList=[],this.id=1,this.timer=null,this.timeout=0}var t=TimerManager.prototype;return t.addTimer=function addTimer(t,i,u){void 0===i&&(i=0),void 0===u&&(u=1);var _=(new Date).getTime(),h=this.id;return this.timerList.push({id:h,loop:u,count:0,timeout:_+i,interval:i,callback:t}),this.id++,this.checkTimer(_),h},t.checkTimer=function checkTimer(t){if(void 0===t&&(t=(new Date).getTime()),this.removeFinished(),0!==this.timerList.length||null==this.timer){for(var i,u,_=0,h=_createForOfIteratorHelperLoose(this.timerList);!(i=h()).done;){var E=i.value;(0===_||_>E.timeout)&&(_=E.timeout)}if(0!==this.timerList.length)if(null===this.timer||_<this.timeout||this.timeout<t)this.timer=gs(bind$1(u=this.nowTime).call(u,this),_-t),this.timeout=_}},t.nowTime=function nowTime(){for(var t,nowTime=(new Date).getTime(),i=_createForOfIteratorHelperLoose(this.timerList);!(t=i()).done;){var u=t.value;nowTime>=u.timeout&&(u.callback(),u.count++,u.timeout=nowTime+u.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 i=this.timerList.length-1;i>=0;i--){var u;if(this.timerList[i].id===t)splice(u=this.timerList).call(u,i,1)}},t.removeFinished=function removeFinished(){for(var t=this.timerList.length-1;t>=0;t--){var i,u=this.timerList[t];if(u.loop>=0&&u.count>=u.loop)splice(i=this.timerList).call(i,t,1)}},t.destroy=function destroy(){this.clerTime(),this.timerList=[],this.id=1,this.timer=null},TimerManager}(),fd=function(){function CoreAdapters(t){this.lastSuccUploadHost="",this.core=t}var t=CoreAdapters.prototype;return t.getFileUploadInformation=function getFileUploadInformation(t){return Os.getFileUploadInformation(t)},t.request=function request(t,i,u){var _=this,h=(new Date).getTime(),E=(null==u?void 0:u.exception_service)||0;return Os.request(t,i).catch((function(u){var m,I,v,T,N=u;throw _.core.reporter.reportTraceStart("exceptions",{user_id:_.core.options.account||(null===(I=null===(m=_.core)||void 0===m?void 0:m.auth)||void 0===I?void 0:I.account),trace_id:null===(T=null===(v=_.core.clientSocket)||void 0===v?void 0:v.socket)||void 0===T?void 0:T.sessionId,start_time:h,action:1,exception_service:E}),_.core.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof N.code?N.code:0,description:N.message||""+N.code,operation_type:0,target:t,context:i?Ua(i):""},{asyncParams:Os.net.getNetworkStatus()}),_.core.reporter.reportTraceEnd("exceptions",1),u}))},t.uploadFile=function uploadFile(t,i){var u,_,h,E;return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var m,I,v,T,N,M,O,S,R,A,C,L,k,D;return Ra.wrap((function _callee$(V){for(;;)switch(V.prev=V.next){case 0:v="BROWSER"===Os.platform,T=v?t.chunkUploadHostBackupList:t.commonUploadHostBackupList,N=v?t.chunkUploadHost:t.commonUploadHost,M=indexOf(T).call(T,N),O=-1===M?concat(m=[N]).call(m,T):concat(I=[N]).call(I,slice(T).call(T,0,M),slice(T).call(T,M+1)),S=Math.max(indexOf(O).call(O,this.lastSuccUploadHost),0),R=null,A=0;case 8:if(!(A<O.length)){V.next=36;break}return C=(new Date).getTime(),L=O[(A+S)%O.length],null==i||i.update({retry_times:A}),V.prev=12,V.next=15,Os.uploadFile(La(La({},t),v?{chunkUploadHost:L}:{commonUploadHost:L}));case 15:return k=V.sent,this.lastSuccUploadHost=L,"string"==typeof k.size&&(k.size=au(k.size)),"string"==typeof k.dur&&(k.dur=au(k.dur)),"string"==typeof k.w&&(k.w=au(k.w)),"string"==typeof k.h&&(k.h=au(k.h)),V.abrupt("return",k);case 24:V.prev=24,V.t0=V.catch(12),this.core.cloudStorage.nos.nosErrorCount--,R=V.t0,D=V.t0,this.core.reporter.reportTraceStart("exceptions",{user_id:this.core.options.account||(null===(_=null===(u=this.core)||void 0===u?void 0:u.auth)||void 0===_?void 0:_.account),trace_id:null===(E=null===(h=this.core.clientSocket)||void 0===h?void 0:h.socket)||void 0===E?void 0:E.sessionId,start_time:C,action:1,exception_service:3}),this.core.reporter.reportTraceUpdateV2("exceptions",{code:"number"==typeof D.code?D.code:0,description:D.message||""+D.code,operation_type:1,target:L},{asyncParams:Os.net.getNetworkStatus()}),this.core.reporter.reportTraceEnd("exceptions",1),this._uploadFileErrHanler(V.t0);case 33:A++,V.next=8;break;case 36:throw R;case 37:case"end":return V.stop()}}),_callee,this,[[12,24]])})))},t._uploadFileErrHanler=function _uploadFileErrHanler(t){if(t&&(t.code>200||t.errCode>200))throw t},CoreAdapters}(),Ed=function(){function ABTest(t,i){this.abtInfo={},this.core=t,this.config=assignOptions({isAbtestEnable:!0,abtestUrl:Fl,abtestProjectKey:Gl},i)}var t=ABTest.prototype;return t.setOptions=function setOptions(t){this.config=assignOptions(this.config,t)},t.abtRequest=function abtRequest(){var t,i;return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var u;return Ra.wrap((function _callee$(_){for(;;)switch(_.prev=_.next){case 0:if(this.config.isAbtestEnable){_.next=2;break}return _.abrupt("return");case 2:if(!this.abtInfo.experiments){_.next=4;break}return _.abrupt("return");case 4:if(this.config.abtestUrl){_.next=6;break}return _.abrupt("return");case 6:return _.prev=6,_.next=9,this.core.adapters.request(this.config.abtestUrl,{method:"POST",dataType:"json",headers:{sdktype:"ABTest"},data:{clientInfo:{projectKey:this.config.abtestProjectKey,appKey:this.core.options.appkey,osType:"Web",sdkVersion:"10.9.71",deviceId:this.core.config.deviceId},useLocalCache:!0}},{exception_service:7});case 9:u=_.sent,_.next=15;break;case 12:_.prev=12,_.t0=_.catch(6),this.core.logger.warn("ABTest request failed");case 15:this.abtInfo=(null===(i=null===(t=null==u?void 0:u.data)||void 0===t?void 0:t.data)||void 0===i?void 0:i.abtInfo)||{};case 16:case"end":return _.stop()}}),_callee,this,[[6,12]])})))},ABTest}();function pickBy(t,i){t=t||{},i=i||function(){return!0};var u={};for(var _ in t)i(t[_])&&(u[_]=t[_]);return u}function formatQueueElementsFromKVObject(t){var i;return map$7(i=cs(t)).call(i,(function(i){return{key:i,value:t[i]}}))}function formatQueueElementsFromElements(t){return t&&t.length>0?map$7(t).call(t,(function(t){return{key:t.key,value:t.value,accountId:t.accid,nick:t.nick}})):[]}function formatMessage(t,i,u){if(i.isSelf=i.senderId===u,delete i.resend,0===i.messageType||10===i.messageType){var _="string"==typeof i.attachment?i.attachment:"object"==typeof i.attachment?i.attachment.raw:"";i.text=i.text||_,delete i.attachment}return 5===i.messageType?i.attachment=function formatNotificationAttachment(t,i){var u,_,h,E,m,I,v,T,N,M,O,S,R,A,C,L,k,D,V={type:"number"==typeof md[t.id]?md[t.id]:t.id,targetIds:null===(u=t.data)||void 0===u?void 0:u.target,targetNicks:null===(_=t.data)||void 0===_?void 0:_.tarNick,targetTag:null===(h=t.data)||void 0===h?void 0:h.targetTag,operatorId:null===(E=t.data)||void 0===E?void 0:E.operator,operatorNick:null===(m=t.data)||void 0===m?void 0:m.opeNick,notificationExtension:null===(I=t.data)||void 0===I?void 0:I.ext,tags:null===(v=t.data)||void 0===v?void 0:v.tags,messageClientId:null===(T=t.data)||void 0===T?void 0:T.msgId,messageTime:null===(N=t.data)||void 0===N?void 0:N.msgTime,chatBanned:void 0!==(null===(M=t.data)||void 0===M?void 0:M.muted)?Boolean(null===(O=t.data)||void 0===O?void 0:O.muted):void 0,tempChatBanned:void 0!==(null===(S=t.data)||void 0===S?void 0:S.tempMuted)?Boolean(null===(R=t.data)||void 0===R?void 0:R.tempMuted):void 0,previousRole:null===(A=t.data)||void 0===A?void 0:A.previousRole,tempChatBannedDuration:"number"==typeof(null===(C=t.data)||void 0===C?void 0:C.muteTtl)?t.data.muteTtl:null===(L=t.data)||void 0===L?void 0:L.muteDuration};14===(V=pickBy(V,(function(t){return void 0!==t}))).type?V.tempChatBanned=!0:15===V.type&&(V.tempChatBanned=!1);if(null===(k=t.data)||void 0===k?void 0:k.member){var w=t.data.member;V.currentMember=pickBy({roomId:i,accountId:w.accountId,memberRole:w.memberRole,memberLevel:w.memberLevel,roomNick:w.nick,roomAvatar:w.avatar,serverExtension:w.ext,isOnline:!!w.onlineStat,blocked:!!w.blockList,chatBanned:!!w.chatBanned,tempChatBanned:!!w.tempChatBanned,tempChatBannedDuration:"number"==typeof w.muteTtl?w.muteTtl:w.muteDuration,tags:stringToJSONObject(w.tags),notifyTargetTags:w.notifyTargetTags,enterTime:w.enterTime,updateTime:w.updateTime,valid:void 0===w.valid||!!w.valid,multiEnterInfo:formatMultiEnterInfo(w.onlineList)},(function(t){return void 0!==t}))}if(null===(D=t.data)||void 0===D?void 0:D.queueChange){var P=function formatNotificationAttachmentForQueue(t){try{var i=JSON.parse(t);if("OFFER"===i._e)return{elements:[{key:i.key,value:i.content}],queueChangeType:1};if("POLL"===i._e)return{elements:[{key:i.key,value:i.content}],queueChangeType:2};if("DROP"===i._e)return{elements:[],queueChangeType:3};if("BATCH_UPDATE"===i._e)return{elements:formatQueueElementsFromKVObject(i.kvObject),queueChangeType:5};if("PARTCLEAR"===i._e)return{elements:formatQueueElementsFromKVObject(i.kvObject),queueChangeType:4};if("BATCH_OFFER"===i._e)return{elements:formatQueueElementsFromElements(i.elements),queueChangeType:6}}catch(t){}return{elements:[],queueChangeType:0}}(t.data.queueChange),x=P.elements,U=P.queueChangeType;V.elements=x,U>0&&(V.queueChangeType=U)}return V.raw=t.raw,V}(i.attachment,i.roomId):100===i.messageType&&(i=function formatCustomAttachment(t,i){var u,_,h;if("string"==typeof(null===(u=i.attachment)||void 0===u?void 0:u.raw)&&(null===(h=null===(_=t.V2NIMChatroomMessageService)||void 0===_?void 0:_.customAttachmentParsers)||void 0===h?void 0:h.length)>0){var E=i.subType||0,m=t.V2NIMChatroomMessageService.customAttachmentParsers,I=i.attachment.raw;some(m).call(m,(function(u){try{var _=u(E,I);if(isPlainObject(_))return _.raw=I,i.attachment=_,!0}catch(i){return t.logger.warn("customAttachmentParser: subType "+E+", raw: "+I+". parse error with "+i),!1}}))}return i}(t,i)),i}function formatMultiEnterInfo(t){if(t&&"string"==typeof t)try{var i=JSON.parse(t);return map$7(i).call(i,(function(t){return{roomNick:t.room_nick,roomAvatar:t.room_avatar,enterTime:t.enter_time,clientType:t.client_type}}))}catch(t){return}}var md={301:0,302:1,303:2,304:3,305:4,306:5,312:6,313:7,314:8,315:9,316:10,317:11,320:11,324:11,318:12,319:13,321:14,322:15,323:16,325:17,326:18};function attachmentToRaw(t,i){if(!i)return"";switch(t){case 100:return i.raw||"";case 1:case 3:case 2:case 6:return function mediaAttachmentToRaw(t){var i=t,u=i.width,_=i.height,h=i.duration;i.path,i.file,i.raw,i.ctx,i.payload,i.bucketName,i.objectName,i.token;var E=i.ext,m=__rest(i,["width","height","duration","path","file","raw","ctx","payload","bucketName","objectName","token","ext"]),I="string"==typeof E&&"."===E[0]?slice(E).call(E,1):E;return Ua(La(La(La(La(La({},m),void 0===E?{}:{ext:I}),void 0===u?{}:{w:u}),void 0===_?{}:{h:_}),void 0===h?{}:{dur:h}))}(i);case 4:return function locationAttachmentToRaw(t){return Ua({lat:t.latitude,lng:t.longitude,title:t.address})}(i);case 12:return function callAttachmentToRaw(t){t.raw;var i=__rest(t,["raw"]);try{var u;return Ua(La(La({},i),{durations:map$7(u=t.durations).call(u,(function(t){return{accid:t.accountId,duration:t.duration}}))}))}catch(i){return Ua(t)}}(i);default:return"string"==typeof i?i:Ua(i)}}function rawToAttachment(t,i){var u;try{switch(u=JSON.parse(t),i){case 100:return{raw:t};case 4:return function locationRawToAttachment(t,i){return{latitude:i.lat,longitude:i.lng,address:i.title,raw:t}}(t,u);case 2:case 3:case 1:case 6:return function mediaRawToAttachment(t,i){var u=i.w,_=i.h,h=i.dur,E=i.ext,m=__rest(i,["w","h","dur","ext"]),I="string"==typeof E&&"."!==E[0]?"."+E:E;return La(La(La(La(La(La({},m),void 0===E?{}:{ext:I}),void 0===u?{}:{width:u}),void 0===_?{}:{height:_}),void 0===h?{}:{duration:h}),{raw:t})}(t,u);case 12:return function callRawToAttachment(t,i){var u;return La(La({},i),{durations:map$7(u=i.durations).call(u,(function(t){return{accountId:t.accid,duration:t.duration}})),raw:t})}(t,u);default:return"object"==typeof u&&u?La(La({},u),{raw:t}):{raw:t}}}catch(i){return"object"==typeof u&&u?La(La({},u),{raw:t}):{raw:t}}}var gd,Id,vd,Td,Nd,Md,Od,Sd,Rd,yd,Ad,Cd,bd,Ld,kd,Dd,Vd,wd="V2NIMChatroomMemberService",Pd={"36_15":"v2ChatroomUpdateSelfMemberInfo","36_16":"v2ChatroomGetMemberByIds","36_17":"v2ChatroomKickMember","36_19":"v2ChatroomSetMemberTempChatBanned","36_41":"v2ChatroomGetMemberListByTag","36_32":"v2ChatroomGetMemberCountByTag","36_37":"v2ChatroomGetMemberListByOption","36_38":"v2ChatroomUpdateMemberRole","36_39":"v2ChatroomSetMemberBlockedStatus","36_40":"v2ChatroomSetMemberChatBannedStatus","13_101":"v2ChatroomOnMemberTagUpdated"},xd={roomId:1,accountId:2,memberRole:{id:3,retType:"number"},memberLevel:{id:4,retDef:0,retType:"number"},roomNick:5,roomAvatar:6,serverExtension:7,isOnline:{id:8,retType:"boolean"},enterTime:{id:10,retType:"number"},blocked:{id:12,retType:"boolean"},chatBanned:{id:13,retType:"boolean"},valid:{id:14,retDef:!0,retType:"boolean"},updateTime:{id:15,retDef:0,retType:"number"},tempChatBanned:{id:16,retType:"boolean",retDef:!1},tempChatBannedDuration:{id:17,retType:"number"},tags:{id:18,converter:objectToJSONString,retConverter:stringToJSONObject},notifyTargetTags:19,multiEnterInfo:{id:20,retConverter:formatMultiEnterInfo}},Ud={memberRoles:{id:1,converter:function converter(t){return t.join(",")}},onlyBlocked:{id:2,converter:boolToInt},onlyChatBanned:{id:3,converter:boolToInt},onlyOnline:{id:4,converter:boolToInt},pageToken:5,limit:6},Fd={v2ChatroomGetMemberByIds:{sid:36,cid:16,service:wd,params:[{type:"StrArray",name:"accountIds"}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(xd)}]},v2ChatroomGetMemberListByOption:{sid:36,cid:37,service:wd,params:[{type:"Property",name:"tag",reflectMapper:Ud}],response:[{type:"Int",name:"hasMore"},{type:"String",name:"pageToken"},{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(xd)}]},v2ChatroomUpdateSelfMemberInfo:{sid:36,cid:15,service:wd,params:[{type:"Property",name:"tag",reflectMapper:xd},{type:"Bool",name:"notificationEnabled"},{type:"String",name:"notificationExtension"},{type:"Bool",name:"persistence"},{type:"Property",name:"antispamConfig",reflectMapper:{antispamBusinessId:1}}]},v2ChatroomSetMemberTempChatBanned:{sid:36,cid:19,service:wd,params:[{type:"String",name:"accountId"},{type:"Long",name:"tempChatBannedDuration"},{type:"Bool",name:"notificationEnabled"},{type:"String",name:"notificationExtension"}]},v2ChatroomGetMemberListByTag:{sid:36,cid:41,service:wd,params:[{type:"Property",name:"tag",reflectMapper:{tag:1,pageToken:2,limit:3}}],response:[{type:"Int",name:"hasMore"},{type:"String",name:"pageToken"},{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(xd)}]},v2ChatroomGetMemberCountByTag:{sid:36,cid:32,service:wd,params:[{type:"String",name:"tag"}],response:[{type:"Long",name:"data"}]},v2ChatroomKickMember:{sid:36,cid:17,service:wd,params:[{type:"String",name:"accountId"},{type:"String",name:"notificationExtension"}]},v2ChatroomUpdateMemberRole:{sid:36,cid:38,service:wd,params:[{type:"Property",name:"tag",reflectMapper:{accountId:1,memberRole:2,memberLevel:3,notificationExtension:4}}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(xd)}]},v2ChatroomSetMemberBlockedStatus:{sid:36,cid:39,service:wd,params:[{type:"String",name:"accountId"},{type:"Bool",name:"blocked"},{type:"String",name:"notificationExtension"}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(xd)}]},v2ChatroomSetMemberChatBannedStatus:{sid:36,cid:40,service:wd,params:[{type:"String",name:"accountId"},{type:"Bool",name:"chatBanned"},{type:"String",name:"notificationExtension"}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(xd)}]},v2ChatroomOnMemberTagUpdated:{sid:36,cid:101,service:wd,response:[{type:"Property",name:"data",reflectMapper:{1:"tag"}}]}},Gd="V2NIMChatroomLoginService",Bd={"1_2":"heartbeat","36_2":"v2ChatroomLogin","13_3":"v2ChatroomBeKicked","36_4":"v2ChatroomLogout"},Hd={roomId:1,roomName:3,announcement:4,liveUrl:5,isValidRoom:{id:9,retType:"boolean"},serverExtension:12,queueLevelMode:{id:16,retType:"number"},creatorAccountId:100,onlineUserCount:{id:101,retType:"number"},chatBanned:{id:102,retType:"boolean"}},Yd={enabled:{id:1,retType:"boolean"},cdnUrls:{id:2,retConverter:function retConverter(t){if("string"==typeof t&&""!==t)return t.split("|")}},timestamp:{id:3,retType:"number"},pollingIntervalSeconds:{id:4,retType:"number"},decryptType:{id:5,retType:"number"},decryptKey:6,pollingTimeoutMillis:{id:7,retType:"number"}},jd={heartbeat:{sid:1,cid:2,service:Gd},v2ChatroomLogin:{sid:36,cid:2,service:Gd,params:[{type:"Byte",name:"type"},{type:"Property",name:"chatroomLogin",reflectMapper:{appkey:1,account:2,deviceId:3,chatroomId:5,appLogin:8,chatroomNick:20,chatroomAvatar:21,serverExtension:22,notificationExtension:23,clientSession:26,isAnonymous:{id:38,converter:function converter(t){return+t}},tags:{id:39,converter:function converter(t){if(Fa(t)&&t.length>0)return Ua(t)}},notifyTargetTags:40,authType:41,loginExt:42,x:43,y:44,z:45,distance:46,antiSpamBusinessId:47,env:49,isRoutable:{id:50,converter:boolToInt}}},{type:"Property",name:"chatroomIMLogin",reflectMapper:{clientType:3,os:4,sdkVersion:6,appLogin:8,protocolVersion:9,pushTokenName:10,pushToken:11,deviceId:13,appkey:18,account:19,browser:24,clientSession:26,deviceInfo:32,customTag:38,customClientType:39,sdkHumanVersion:40,hostEnv:41,userAgent:42,libEnv:44,isReactNative:{id:112,converter:function converter(t){return+t}},authType:115,loginExt:116,token:1e3}}],response:[{type:"Property",name:"chatroomInfo",reflectMapper:invertSerializeItem(Hd)},{type:"Property",name:"chatroomMember",reflectMapper:invertSerializeItem(xd)},{type:"Property",name:"chatroomCdnInfo",reflectMapper:invertSerializeItem(Yd)}]},v2ChatroomLogout:{sid:36,cid:4,service:Gd,params:[]},v2ChatroomBeKicked:{sid:13,cid:3,service:Gd,response:[{type:"Int",name:"kickedReason"},{type:"String",name:"serverExtension"}]}};!function(t){t[t.V2NIM_LOGIN_AUTH_TYPE_DEFAULT=0]="V2NIM_LOGIN_AUTH_TYPE_DEFAULT",t[t.V2NIM_LOGIN_AUTH_TYPE_DYNAMIC_TOKEN=1]="V2NIM_LOGIN_AUTH_TYPE_DYNAMIC_TOKEN",t[t.V2NIM_LOGIN_AUTH_TYPE_THIRD_PARTY=2]="V2NIM_LOGIN_AUTH_TYPE_THIRD_PARTY"}(gd||(gd={})),function(t){t[t.V2NIM_LOGIN_STATUS_LOGOUT=0]="V2NIM_LOGIN_STATUS_LOGOUT",t[t.V2NIM_LOGIN_STATUS_LOGINED=1]="V2NIM_LOGIN_STATUS_LOGINED",t[t.V2NIM_LOGIN_STATUS_LOGINING=2]="V2NIM_LOGIN_STATUS_LOGINING",t[t.V2NIM_LOGIN_STATUS_UNLOGIN=3]="V2NIM_LOGIN_STATUS_UNLOGIN"}(Id||(Id={})),function(t){t[t.V2NIM_LOGIN_CLIENT_TYPE_UNKNOWN=0]="V2NIM_LOGIN_CLIENT_TYPE_UNKNOWN",t[t.V2NIM_LOGIN_CLIENT_TYPE_ANDROID=1]="V2NIM_LOGIN_CLIENT_TYPE_ANDROID",t[t.V2NIM_LOGIN_CLIENT_TYPE_IOS=2]="V2NIM_LOGIN_CLIENT_TYPE_IOS",t[t.V2NIM_LOGIN_CLIENT_TYPE_PC=4]="V2NIM_LOGIN_CLIENT_TYPE_PC",t[t.V2NIM_LOGIN_CLIENT_TYPE_WP=8]="V2NIM_LOGIN_CLIENT_TYPE_WP",t[t.V2NIM_LOGIN_CLIENT_TYPE_WEB=16]="V2NIM_LOGIN_CLIENT_TYPE_WEB",t[t.V2NIM_LOGIN_CLIENT_TYPE_RESTFUL=32]="V2NIM_LOGIN_CLIENT_TYPE_RESTFUL",t[t.V2NIM_LOGIN_CLIENT_TYPE_MAC_OS=64]="V2NIM_LOGIN_CLIENT_TYPE_MAC_OS",t[t.V2NIM_LOGIN_CLIENT_TYPE_HARMONY_OS=65]="V2NIM_LOGIN_CLIENT_TYPE_HARMONY_OS"}(vd||(vd={})),function(t){t[t.V2NIM_LOGIN_CLIENT_CHANGE_LIST=1]="V2NIM_LOGIN_CLIENT_CHANGE_LIST",t[t.V2NIM_LOGIN_CLIENT_CHANGE_LOGIN=2]="V2NIM_LOGIN_CLIENT_CHANGE_LOGIN",t[t.V2NIM_LOGIN_CLIENT_CHANGE_LOGOUT=3]="V2NIM_LOGIN_CLIENT_CHANGE_LOGOUT"}(Td||(Td={})),function(t){t[t.V2NIM_CONNECT_STATUS_DISCONNECTED=0]="V2NIM_CONNECT_STATUS_DISCONNECTED",t[t.V2NIM_CONNECT_STATUS_CONNECTED=1]="V2NIM_CONNECT_STATUS_CONNECTED",t[t.V2NIM_CONNECT_STATUS_CONNECTING=2]="V2NIM_CONNECT_STATUS_CONNECTING",t[t.V2NIM_CONNECT_STATUS_WAITING=3]="V2NIM_CONNECT_STATUS_WAITING"}(Nd||(Nd={})),function(t){t[t.V2NIM_CHATROOM_KICKED_REASON_UNKNOWN=-1]="V2NIM_CHATROOM_KICKED_REASON_UNKNOWN",t[t.V2NIM_CHATROOM_KICKED_REASON_CHATROOM_INVALID=1]="V2NIM_CHATROOM_KICKED_REASON_CHATROOM_INVALID",t[t.V2NIM_CHATROOM_KICKED_REASON_BY_MANAGER=2]="V2NIM_CHATROOM_KICKED_REASON_BY_MANAGER",t[t.V2NIM_CHATROOM_KICKED_REASON_BY_CONFLICT_LOGIN=3]="V2NIM_CHATROOM_KICKED_REASON_BY_CONFLICT_LOGIN",t[t.V2NIM_CHATROOM_KICKED_REASON_SILENTLY=4]="V2NIM_CHATROOM_KICKED_REASON_SILENTLY",t[t.V2NIM_CHATROOM_KICKED_REASON_BE_BLOCKED=5]="V2NIM_CHATROOM_KICKED_REASON_BE_BLOCKED"}(Md||(Md={})),function(t){t[t.V2NIM_CHATROOM_MEMBER_ROLE_NORMAL=0]="V2NIM_CHATROOM_MEMBER_ROLE_NORMAL",t[t.V2NIM_CHATROOM_MEMBER_ROLE_CREATOR=1]="V2NIM_CHATROOM_MEMBER_ROLE_CREATOR",t[t.V2NIM_CHATROOM_MEMBER_ROLE_MANAGER=2]="V2NIM_CHATROOM_MEMBER_ROLE_MANAGER",t[t.V2NIM_CHATROOM_MEMBER_ROLE_NORMAL_GUEST=3]="V2NIM_CHATROOM_MEMBER_ROLE_NORMAL_GUEST",t[t.V2NIM_CHATROOM_MEMBER_ROLE_ANONYMOUS_GUEST=4]="V2NIM_CHATROOM_MEMBER_ROLE_ANONYMOUS_GUEST",t[t.V2NIM_CHATROOM_MEMBER_ROLE_VIRTUAL=5]="V2NIM_CHATROOM_MEMBER_ROLE_VIRTUAL"}(Od||(Od={})),function(t){t[t.V2NIM_MESSAGE_SENDING_STATE_UNKNOWN=0]="V2NIM_MESSAGE_SENDING_STATE_UNKNOWN",t[t.V2NIM_MESSAGE_SENDING_STATE_SUCCEEDED=1]="V2NIM_MESSAGE_SENDING_STATE_SUCCEEDED",t[t.V2NIM_MESSAGE_SENDING_STATE_FAILED=2]="V2NIM_MESSAGE_SENDING_STATE_FAILED",t[t.V2NIM_MESSAGE_SENDING_STATE_SENDING=3]="V2NIM_MESSAGE_SENDING_STATE_SENDING"}(Sd||(Sd={})),function(t){t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UNKNOWN=0]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UNKNOWN",t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_SUCCESS=1]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_SUCCESS",t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_FAILED=2]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_FAILED",t[t.V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UPLOADING=3]="V2NIM_MESSAGE_ATTACHMENT_UPLOAD_STATE_UPLOADING"}(Rd||(Rd={})),function(t){t[t.V2NIM_MESSAGE_TYPE_INVALID=-1]="V2NIM_MESSAGE_TYPE_INVALID",t[t.V2NIM_MESSAGE_TYPE_TEXT=0]="V2NIM_MESSAGE_TYPE_TEXT",t[t.V2NIM_MESSAGE_TYPE_IMAGE=1]="V2NIM_MESSAGE_TYPE_IMAGE",t[t.V2NIM_MESSAGE_TYPE_AUDIO=2]="V2NIM_MESSAGE_TYPE_AUDIO",t[t.V2NIM_MESSAGE_TYPE_VIDEO=3]="V2NIM_MESSAGE_TYPE_VIDEO",t[t.V2NIM_MESSAGE_TYPE_LOCATION=4]="V2NIM_MESSAGE_TYPE_LOCATION",t[t.V2NIM_MESSAGE_TYPE_NOTIFICATION=5]="V2NIM_MESSAGE_TYPE_NOTIFICATION",t[t.V2NIM_MESSAGE_TYPE_FILE=6]="V2NIM_MESSAGE_TYPE_FILE",t[t.V2NIM_MESSAGE_TYPE_AVCHAT=7]="V2NIM_MESSAGE_TYPE_AVCHAT",t[t.V2NIM_MESSAGE_TYPE_TIPS=10]="V2NIM_MESSAGE_TYPE_TIPS",t[t.V2NIM_MESSAGE_TYPE_ROBOT=11]="V2NIM_MESSAGE_TYPE_ROBOT",t[t.V2NIM_MESSAGE_TYPE_CALL=12]="V2NIM_MESSAGE_TYPE_CALL",t[t.V2NIM_MESSAGE_TYPE_CUSTOM=100]="V2NIM_MESSAGE_TYPE_CUSTOM"}(yd||(yd={})),function(t){t[t.V2NIM_QUERY_DIRECTION_DESC=0]="V2NIM_QUERY_DIRECTION_DESC",t[t.V2NIM_QUERY_DIRECTION_ASC=1]="V2NIM_QUERY_DIRECTION_ASC"}(Ad||(Ad={})),function(t){t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_ENTER=0]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_ENTER",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_EXIT=1]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_EXIT",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_BLOCK_ADDED=2]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_BLOCK_ADDED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_BLOCK_REMOVED=3]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_BLOCK_REMOVED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_CHAT_BANNED_ADDED=4]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_CHAT_BANNED_ADDED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_CHAT_BANNED_REMOVED=5]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_CHAT_BANNED_REMOVED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_ROOM_INFO_UPDATED=6]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_ROOM_INFO_UPDATED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_KICKED=7]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_KICKED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_TEMP_CHAT_BANNED_ADDED=8]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_TEMP_CHAT_BANNED_ADDED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_TEMP_CHAT_BANNED_REMOVED=9]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_TEMP_CHAT_BANNED_REMOVED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_INFO_UPDATED=10]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MEMBER_INFO_UPDATED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_QUEUE_CHANGE=11]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_QUEUE_CHANGE",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_CHAT_BANNED=12]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_CHAT_BANNED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_CHAT_BANNED_REMOVED=13]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_CHAT_BANNED_REMOVED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_TAG_TEMP_CHAT_BANNED_ADDED=14]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_TAG_TEMP_CHAT_BANNED_ADDED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_TAG_TEMP_CHAT_BANNED_REMOVED=15]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_TAG_TEMP_CHAT_BANNED_REMOVED",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MESSAGE_REVOKE=16]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_MESSAGE_REVOKE",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_TAGS_UPDATE=17]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_TAGS_UPDATE",t[t.V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_ROLE_UPDATE=18]="V2NIM_CHATROOM_MESSAGE_NOTIFICATION_TYPE_ROLE_UPDATE"}(Cd||(Cd={})),function(t){t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_NONE=0]="V2NIM_CLIENT_ANTISPAM_OPERATE_NONE",t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_REPLACE=1]="V2NIM_CLIENT_ANTISPAM_OPERATE_REPLACE",t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_CLIENT_SHIELD=2]="V2NIM_CLIENT_ANTISPAM_OPERATE_CLIENT_SHIELD",t[t.V2NIM_CLIENT_ANTISPAM_OPERATE_SERVER_SHIELD=3]="V2NIM_CLIENT_ANTISPAM_OPERATE_SERVER_SHIELD"}(bd||(bd={})),function(t){t[t.V2NIM_CHATROOM_STATUS_DISCONNECTED=0]="V2NIM_CHATROOM_STATUS_DISCONNECTED",t[t.V2NIM_CHATROOM_STATUS_WAITING=1]="V2NIM_CHATROOM_STATUS_WAITING",t[t.V2NIM_CHATROOM_STATUS_CONNECTING=2]="V2NIM_CHATROOM_STATUS_CONNECTING",t[t.V2NIM_CHATROOM_STATUS_CONNECTED=3]="V2NIM_CHATROOM_STATUS_CONNECTED",t[t.V2NIM_CHATROOM_STATUS_ENTERING=4]="V2NIM_CHATROOM_STATUS_ENTERING",t[t.V2NIM_CHATROOM_STATUS_ENTERED=5]="V2NIM_CHATROOM_STATUS_ENTERED",t[t.V2NIM_CHATROOM_STATUS_EXITED=6]="V2NIM_CHATROOM_STATUS_EXITED"}(Ld||(Ld={})),function(t){t.off="off",t.error="error",t.warn="warn",t.log="log",t.debug="debug"}(kd||(kd={})),function(t){t[t.V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_UNKNOWN=0]="V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_UNKNOWN",t[t.V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_OFFER=1]="V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_OFFER",t[t.V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_POLL=2]="V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_POLL",t[t.V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_DROP=3]="V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_DROP",t[t.V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_PARTCLEAR=4]="V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_PARTCLEAR",t[t.V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_BATCH_UPDATE=5]="V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_BATCH_UPDATE",t[t.V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_BATCH_OFFER=6]="V2NIM_CHATROOM_QUEUE_CHANGE_TYPE_BATCH_OFFER"}(Dd||(Dd={})),function(t){t[t.V2NIM_CHATROOM_QUEUE_LEVEL_MODE_ANY=0]="V2NIM_CHATROOM_QUEUE_LEVEL_MODE_ANY",t[t.V2NIM_CHATROOM_QUEUE_LEVEL_MODE_MANAGER=1]="V2NIM_CHATROOM_QUEUE_LEVEL_MODE_MANAGER"}(Vd||(Vd={}));var Kd={V2NIM_ERROR_CODE_UNKNOWN:{code:0,message:"unknown error"},V2NIM_ERROR_CODE_SUCCESS:{code:200,message:"success"},V2NIM_ERROR_CODE_HANDSHAKE:{code:201,message:"handshake error"},V2NIM_ERROR_CODE_REQUEST_TEMPERARY_FORBIDDEN:{code:398,message:"request temprary forbidden"},V2NIM_ERROR_CODE_SERVER_UNIT_ERROR:{code:399,message:"server unit error"},V2NIM_ERROR_CODE_FORBIDDEN:{code:403,message:"forbidden"},V2NIM_ERROR_CODE_NOT_FOUND:{code:404,message:"not found"},V2NIM_ERROR_CODE_PARAMETER_ERROR:{code:414,message:"parameter error"},V2NIM_ERROR_CODE_RATE_LIMIT_REACHED:{code:416,message:"rate limit reached"},V2NIM_ERROR_CODE_MULTI_LOGIN_FORBIDDEN:{code:417,message:"multi login forbidden"},V2NIM_ERROR_CODE_SERVER_INTERNAL_ERROR:{code:500,message:"server internal error"},V2NIM_ERROR_CODE_SERVER_BUSY:{code:503,message:"server busy"},V2NIM_ERROR_CODE_APP_UNREACHABLE:{code:511,message:"app server unreachable"},V2NIM_ERROR_CODE_SERVICE_UNAVAILABLE:{code:514,message:"service unavailable"},V2NIM_ERROR_CODE_PROTOCOL_BLACKHOLE_FILTERED:{code:599,message:"protocol filtered by blackhole rule"},V2NIM_ERROR_CODE_NO_PERMISSION:{code:997,message:"appid has no permission to call the protocol"},V2NIM_ERROR_CODE_UNPACK_ERROR:{code:998,message:"unpack error"},V2NIM_ERROR_CODE_PACK_ERROR:{code:999,message:"pack error"},V2NIM_ERROR_CODE_IM_DISABLED:{code:101301,message:"IM disabled"},V2NIM_ERROR_CODE_SERVICE_ADDRESS_INVALID:{code:101302,message:"service address invalid"},V2NIM_ERROR_CODE_APPKEY_NOT_EXIST:{code:101303,message:"appkey not exist"},V2NIM_ERROR_CODE_BUNDLEID_CHECK_FAILED:{code:101304,message:"bundleid check failed"},V2NIM_ERROR_CODE_APPKEY_BLOCKED:{code:101403,message:"appkey blocked"},V2NIM_ERROR_CODE_INVALID_TOKEN:{code:102302,message:"invalid token"},V2NIM_ERROR_CODE_ROBOT_NOT_ALLOWED:{code:102303,message:"robot not allowed"},V2NIM_ERROR_CODE_ACCOUNT_NOT_EXIST:{code:102404,message:"account not exist"},V2NIM_ERROR_CODE_ACCOUNT_CHAT_BANNED:{code:102421,message:"account chat banned"},V2NIM_ERROR_CODE_ACCOUNT_BANNED:{code:102422,message:"account banned"},V2NIM_ERROR_CODE_ACCOUNT_IN_BLOCK_LIST:{code:102426,message:"account in block list"},V2NIM_ERROR_CODE_USER_PROFILE_NOT_EXIST:{code:103404,message:"user profile not exist"},V2NIM_ERROR_CODE_USER_PROFILE_HIT_ANTISPAM:{code:103451,message:"user profile hit antispam"},V2NIM_ERROR_CODE_PEER_FRIEND_LIMIT:{code:104301,message:"peer friend limit"},V2NIM_ERROR_CODE_FRIEND_APPLICATION_NOT_EXIST:{code:104302,message:"friend application not exist"},V2NIM_ERROR_CODE_FRIEND_NOT_EXIST:{code:104404,message:"friend not exist"},V2NIM_ERROR_CODE_FRIEND_ALREADY_EXIST:{code:104405,message:"friend already exist"},V2NIM_ERROR_CODE_SELF_FRIEND_OPERATION_NOT_ALLOWED:{code:104429,message:"self friend operation not allowed"},V2NIM_ERROR_CODE_FRIEND_LIMIT:{code:104435,message:"friend limit"},V2NIM_ERROR_CODE_FRIEND_OPERATION_RATE_LIMIT:{code:104449,message:"friend operation rate limit"},V2NIM_ERROR_CODE_FRIEND_HIT_ANTISPAM:{code:104451,message:"friend hit antispam"},V2NIM_ERROR_CODE_SELF_MUTE_OPERATION_NOT_ALLOWED:{code:105429,message:"self mute operation not allowed"},V2NIM_ERROR_CODE_MUTE_LIST_LIMIT:{code:105435,message:"mute list limit"},V2NIM_ERROR_CODE_SELF_BLOCK_LIST_OPERATION_NOT_ALLOWED:{code:106429,message:"self block list operation not allowed"},V2NIM_ERROR_CODE_BLOCK_LIST_LIMIT:{code:106435,message:"block list limit"},V2NIM_ERROR_CODE_REVOKE_THIRD_PARTY_MESSAGE_NOT_ALLOWED:{code:107301,message:"revoke third party message not allowed"},V2NIM_ERROR_CODE_SHORT_TO_LONG_URL_FAILED:{code:107307,message:"short to long URL failed"},V2NIM_ERROR_CODE_URL_INVALID:{code:107308,message:"URL invalid"},V2NIM_ERROR_CODE_DURATION_OUT_OF_RANGE:{code:107309,message:"duration out of range"},V2NIM_ERROR_CODE_GET_FILE_META_INFO_FAILED:{code:107310,message:"get file meta info failed"},V2NIM_ERROR_CODE_AUDIO_FILE_SIZE_LIMIT:{code:107311,message:"audio file size limit"},V2NIM_ERROR_CODE_VOICE_TO_TEXT_TIMEOUT:{code:107312,message:"voice to text timeout"},V2NIM_ERROR_CODE_VOICE_TO_TEXT_FAILED:{code:107313,message:"voice to text failed"},V2NIM_ERROR_CODE_REVOKE_EXCEED_TIME_LIMIT:{code:107314,message:"revoke message exceed time limit"},V2NIM_ERROR_CODE_REVOKE_MESSAGE_NOT_ALLOWED:{code:107315,message:"revoke specific message not allowed"},V2NIM_ERROR_CODE_FORCE_PUSH_LIST_LIMIT:{code:107316,message:"force push list limit"},V2NIM_ERROR_CODE_TEAM_MESSAGE_RECEIPT_RATE_LIMIT:{code:107317,message:"team message receipt rate limit"},V2NIM_ERROR_CODE_SNAPSHOT_NOT_EXIST:{code:107318,message:"snapshot not exist"},V2NIM_ERROR_CODE_PIN_LIMIT:{code:107319,message:"pin limit"},V2NIM_ERROR_CODE_PIN_NOT_EXIST:{code:107320,message:"pin not exist"},V2NIM_ERROR_CODE_QUICK_COMMENT_LIMIT:{code:107321,message:"quick comment limit"},V2NIM_ERROR_CODE_PIN_ALREADY_EXIST:{code:107322,message:"pin already exist"},V2NIM_ERROR_CODE_VOICE_TO_TEXT_FUNCTION_DISABLED:{code:107333,message:"voice to text function disabled"},V2NIM_ERROR_CODE_CLOUD_SEARCH_FUNCTION_DISABLED:{code:107334,message:"cloud search function disabled"},V2NIM_ERROR_CODE_ONE_WAY_DELETE_FUNCTION_DISABLED:{code:107335,message:"one-way delete function disabled"},V2NIM_ERROR_CODE_REVOKE_MESSAGE_TO_SELF_NOT_ALLOWED:{code:107429,message:"revoke message to self not allowed"},V2NIM_ERROR_CODE_APP_CHAT_BANNED:{code:107410,message:"app chat banned"},V2NIM_ERROR_CODE_QUICK_COMMENT_FUNCTION_DISABLED:{code:107326,message:"quick comment function disabled"},V2NIM_ERROR_CODE_PIN_FUNCTION_DISABLED:{code:107327,message:"PIN function disabled"},V2NIM_ERROR_CODE_TEAM_READ_RECEIPT_FUNCTION_DISABLED:{code:107324,message:"read receipt for team messages function disabled"},V2NIM_ERROR_CODE_P2P_READ_RECEIPT_FUNCTION_DISABLED:{code:107325,message:"read receipt for p2p messages function disabled"},V2NIM_ERROR_CODE_RATE_LIMIT_FOR_MESSAGING_REACHED:{code:107323,message:"rate limit for messaging reached"},V2NIM_ERROR_CODE_MESSAGE_HIT_ANTISPAM:{code:107451,message:"message hit antispam"},V2NIM_ERROR_CODE_MESSAGE_NOT_EXIST:{code:107404,message:"message not exist"},V2NIM_ERROR_CODE_UNSENDING_MESSAGE_EXPIRED:{code:107406,message:"unsending message expired"},V2NIM_ERROR_CODE_TEAM_MARK_READ_FAILED:{code:107302,message:"sending message failed for marking message read failed for too many team members"},V2NIM_ERROR_CODE_SENDER_OR_MANAGER_PERMISSION_ONLY_REVOKE:{code:107303,message:"only sender or manager can revoke message"},V2NIM_ERROR_CODE_DELETE_SELF_MESSAGE_NOT_ALLOWED:{code:107328,message:"delete self message not allowed"},V2NIM_ERROR_CODE_NOT_CHATBOT_ACCOUNT:{code:107329,message:"is not chatbot account"},V2NIM_ERROR_CODE_MESSAGE_SENSE_REQUIRED:{code:107330,message:"sender or receiver must sense message"},V2NIM_ERROR_CODE_HIGH_PRIORITY_MESSAGE_RATE_LIMIT:{code:107304,message:"rate limit of high-priority messages exceeded"},ACK_MESSAGE_BE_HIGH_PRIORITY:{code:107305,message:"ack message should be high-priority"},V2NIM_ERROR_CODE_DUPLICATE_CLIENT_MESSAGE_ID:{code:107306,message:"duplicate client message ID"},V2NIM_ERROR_CODE_INVALID_TIME_RANGE:{code:107439,message:"invalid time range"},V2NIM_ERROR_CODE_NOT_ADVANCED_TEAM:{code:108302,message:"not advanced team"},V2NIM_ERROR_CODE_TEAM_MANAGER_LIMIT:{code:108303,message:"team manager limit"},V2NIM_ERROR_CODE_JOINED_TEAM_LIMIT:{code:108305,message:"joined team limit"},V2NIM_ERROR_CODE_TEAM_NORMAL_MEMBER_CHAT_BANNED:{code:108306,message:"team normal member chat banned"},V2NIM_ERROR_CODE_INVITED_ACCOUNT_NOT_FRIEND:{code:108307,message:"invited account not friend"},V2NIM_ERROR_CODE_REJECT_ALL_TEAM_APPLICATIONS:{code:108308,message:"reject all team applications"},V2NIM_ERROR_CODE_TEAM_NOT_EXIST:{code:108404,message:"team not exist"},V2NIM_ERROR_CODE_TEAM_ALREADY_CHAT_BANNED:{code:108420,message:"team already chat banned"},V2NIM_ERROR_CODE_ALL_TEAM_MEMBER_CHAT_BANNED:{code:108423,message:"all team member chat banned"},V2NIM_ERROR_CODE_EXTENDED_SUPER_TEAM_LIMIT:{code:108434,message:"extended super team limit"},V2NIM_ERROR_CODE_CREATED_TEAM_LIMIT:{code:108435,message:"created team limit"},V2NIM_ERROR_CODE_TEAM_INVITATION_LIMIT:{code:108437,message:"team invitation limit"},V2NIM_ERROR_CODE_TEAM_HIT_ANTISPAM:{code:108451,message:"team hit antispam"},V2NIM_ERROR_CODE_EXTENDED_SUPER_TEAM_LIMIT_NOT_CONFIGURED:{code:108304,message:"extended super team limit not configured"},V2NIM_ERROR_CODE_SUPER_TEAM_SERVICE_DISABLED:{code:108311,message:"super team service disabled"},V2NIM_ERROR_CODE_TEAM_READ_RECEIPT_RECORD_NOT_FOUND:{code:108301,message:"read receipt record for the team message not found"},V2NIM_ERROR_CODE_NOT_MANAGER:{code:108430,message:"unable to assign owner manager"},V2NIM_ERROR_CODE_ONLINE_MEMBER_COUNT_DISABLED:{code:108406,message:"number of online users service disabled"},V2NIM_ERROR_CODE_TRANSFER_DISABLED:{code:108310,message:"unable to transfer the ownership to owner"},V2NIM_ERROR_CODE_CREATE_TEAM_DISABLED:{code:108309,message:"unable to create team with more than %s people"},V2NIM_ERROR_CODE_EXTENDED_SUPER_TEAM_CREATE_FAILED:{code:108313,message:"/ extended super team creation failed,use open api to create the team"},V2NIM_ERROR_CODE_TEAM_MESSAGE_READ_RECEIPT_DISABLED:{code:108312,message:"read receipt for team messages function disabled"},V2NIM_ERROR_CODE_RETRY:{code:108449,message:"an error occurred, try again"},V2NIM_ERROR_CODE_CHAT_BAN_LIST_CONTAIN_NOT_TEAM_MEMBER:{code:109301,message:"list of chat banned users contains non team members"},V2NIM_ERROR_CODE_CHAT_BAN_LIST_CONTAIN_OPERATOR:{code:109303,message:"list of chat banned users contains the operator"},V2NIM_ERROR_CODE_CHAT_BAN_LIST_CONTAIN_TEAM_OWNER:{code:109304,message:"list of chat banned users contains the team owner"},V2NIM_ERROR_CODE_OPERATION_ON_TEAM_MANAGER_NOT_ALLOWED:{code:109305,message:"operation on team manager not allowed"},V2NIM_ERROR_CODE_NO_TEAM_INVITE_PERMISSION:{code:109306,message:"no team invite permission"},V2NIM_ERROR_CODE_TEAM_OWNER_QUIT_NOT_ALLOWED:{code:109307,message:"team owner quit not allowed"},V2NIM_ERROR_CODE_TEAM_OWNER_IN_KICK_LIST:{code:109308,message:"list of kicked user contains the team owner"},V2NIM_ERROR_CODE_INVITE_ROBOT_ACCOUNT_NOT_ALLOWED:{code:109309,message:"invite robot account not allowed"},V2NIM_ERROR_CODE_KICK_OPERATOR_NOT_ALLOWED:{code:109310,message:"kick operator not allowed"},V2NIM_ERROR_CODE_TEAM_MEMBER_ALREADY_EXIST:{code:109311,message:"team member already exist"},V2NIM_ERROR_CODE_TEAM_MEMBER_CAN_NOT_MODIFY_SELF:{code:109312,message:"operation on self not allowed"},V2NIM_ERROR_CODE_TEAM_INVITATION_OR_APPLICATION_NOT_EXIST:{code:109313,message:"team invitation or application not exist"},V2NIM_ERROR_CODE_OPERATION_ON_TEAM_OWNER_NOT_ALLOWED:{code:109314,message:"operation on team owner not allowed"},V2NIM_ERROR_CODE_TEAM_MEMBER_NOT_EXIST:{code:109404,message:"team member not exist"},V2NIM_ERROR_CODE_TEAM_MEMBER_CHAT_BANNED:{code:109424,message:"team member chat banned"},V2NIM_ERROR_CODE_TEAM_OWNER_OPERATION_PERMISSION_REQUIRED:{code:109427,message:"team owner operation permission required"},V2NIM_ERROR_CODE_TEAM_OWNER_OR_MANAGER_OPERATION_PERMISSION_REQUIRED:{code:109432,message:"team owner or manager operation permission required"},V2NIM_ERROR_CODE_TEAM_MEMBER_CONCURRENT_OPERATION_FAILED:{code:109449,message:"team member concurrent operation failed"},V2NIM_ERROR_CODE_TEAM_MEMBER_HIT_ANTISPAM:{code:109451,message:"team member hit antispam"},V2NIM_ERROR_CODE_CONVERSATION_AND_ACCOUNT_MISMATCH:{code:110302,message:"conversation and account mismatch"},V2NIM_ERROR_CODE_CONVERSATION_STICK_TOP_LIMIT:{code:110303,message:"conversation stick top limit"},V2NIM_ERROR_CODE_CONVERSATION_BELONGED_GROUP_LIMIT:{code:110304,message:"conversation belonged group limit"},V2NIM_ERROR_CODE_CONVERSATION_NOT_EXIST:{code:110404,message:"conversation not exist"},V2NIM_ERROR_CODE_CHATROOM_LINK_UNAVAILABLE:{code:113304,message:"chatroom link unavailable"},V2NIM_ERROR_CODE_IM_CONNECTION_ABNORMAL:{code:113305,message:"IM connection abnormal"},V2NIM_ERROR_CODE_CHATROOM_NOT_EXIST:{code:113404,message:"chatroom not exist"},V2NIM_ERROR_CODE_CHATROOM_CLOSED:{code:113406,message:"chatroom closed"},V2NIM_ERROR_CODE_CHATROOM_REPEATED_OPERATION:{code:113409,message:"chatroom repeated operation"},V2NIM_ERROR_CODE_CHATROOM_DISABLED:{code:113410,message:"chatroom disabled"},V2NIM_ERROR_CODE_ALL_CHATROOM_MEMBER_CHAT_BANNED:{code:113423,message:"all chatroom member chat banned"},V2NIM_ERROR_CODE_CHATROOM_HIT_ANTISPAM:{code:113451,message:"chatroom hit antispam"},V2NIM_ERROR_CODE_ANONYMOUS_MEMBER_FORBIDDEN:{code:114303,message:"anonymous member forbidden"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_NOT_EXIST:{code:114404,message:"chatroom member not exist"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_REPEATED_OPERATION:{code:114405,message:"chatroom member repeated operation"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_CHAT_BANNED:{code:114421,message:"chatroom member chat banned"},V2NIM_ERROR_CODE_ACCOUNT_IN_CHATROOM_BLOCK_LIST:{code:114426,message:"account in chatroom block list"},V2NIM_ERROR_CODE_CHATROOM_OWNER_OPERATION_PERMISSION_REQUIRED:{code:114427,message:"chatroom owner operation permission required"},V2NIM_ERROR_CODE_SELF_IN_CHATROOM_MEMBER_OPERATION_LIST:{code:114429,message:"self in chatroom member operation list"},V2NIM_ERROR_CODE_CHATROOM_OWNER_OR_MANAGER_OPERATION_PERMISSION_REQUIRED:{code:114432,message:"chatroom owner or manager operation permission required"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_LIMIT:{code:114437,message:"chatroom member limit"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_CONCURRENT_OPERATION_FAILED:{code:114449,message:"chatroom member concurrent operation failed"},V2NIM_ERROR_CODE_CHATROOM_MEMBER_HIT_ANTISPAM:{code:114451,message:"chatroom member hit antispam"},V2NIM_ERROR_CODE_CONVERSATION_GROUP_NOT_EXIST:{code:116404,message:"conversation group not exist"},V2NIM_ERROR_CODE_CONVERSATION_GROUP_LIMIT:{code:116435,message:"conversation group limit"},V2NIM_ERROR_CODE_CONVERSATIONS_IN_GROUP_LIMIT:{code:116437,message:"conversations in group limit"},V2NIM_ERROR_CODE_COLLECTION_LIMIT:{code:189301,message:"collection limit"},V2NIM_ERROR_CODE_COLLECTION_NOT_EXIST:{code:189302,message:"collection not exist"},V2NIM_ERROR_CODE_COLLECTION_CONCURRENT_OPERATION_FAILED:{code:189449,message:"collection concurrent operation failed"},V2NIM_ERROR_CODE_INTERNAL:{code:190001,message:"internal error"},V2NIM_ERROR_CODE_ILLEGAL_STATE:{code:190002,message:"illegal state"},V2NIM_ERROR_CODE_MISUSE:{code:191001,message:"misuse"},V2NIM_ERROR_CODE_CANCELLED:{code:191002,message:"operation cancelled"},V2NIM_ERROR_CODE_CALLBACK_FAILED:{code:191003,message:"callback failed"},V2NIM_ERROR_CODE_INVALID_PARAMETER:{code:191004,message:"invalid parameter"},V2NIM_ERROR_CODE_TIMEOUT:{code:191005,message:"timeout"},V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST:{code:191006,message:"resource not exist"},V2NIM_ERROR_CODE_RESOURCE_ALREADY_EXIST:{code:191007,message:"resource already exist"},V2NIM_ERROR_CODE_CONNECT_FAILED:{code:192001,message:"connect failed"},V2NIM_ERROR_CODE_CONNECT_TIMEOUT:{code:192002,message:"connect timeout"},V2NIM_ERROR_CODE_DISCONNECT:{code:192003,message:"disconnect"},V2NIM_ERROR_CODE_PROTOCOL_TIMEOUT:{code:192004,message:"protocol timeout"},V2NIM_ERROR_CODE_PROTOCOL_SEND_FAILED:{code:192005,message:"protocol send failed"},V2NIM_ERROR_CODE_REQUEST_FAILED:{code:192006,message:"request failed"},V2NIM_ERROR_CODE_FILE_NOT_FOUND:{code:194001,message:"file not found"},V2NIM_ERROR_CODE_FILE_CREATE_FAILED:{code:194002,message:"file create failed"},V2NIM_ERROR_CODE_FILE_OPEN_FAILED:{code:194003,message:"file open failed"},V2NIM_ERROR_CODE_FILE_WRITE_FAILED:{code:194004,message:"file write failed"},V2NIM_ERROR_CODE_FILE_READ_FAILED:{code:194005,message:"file read failed"},V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:{code:194006,message:"file upload failed"},V2NIM_ERROR_CODE_FILE_DOWNLOAD_FAILED:{code:194007,message:"file download failed"},V2NIM_ERROR_CODE_CLIENT_ANTISPAM:{code:195001,message:"client anti-spam"},V2NIM_ERROR_CODE_SERVER_ANTISPAM:{code:195002,message:"server anti-spam"}},qd=cs(Kd),Wd=reduce(qd).call(qd,(function(t,i){var u=Kd[i];return t[i]=u.code,t}),{}),zd=reduce(qd).call(qd,(function(t,i){var u=Kd[i];return t[u.code]=u.message,t}),{}),$d=Object.freeze({__proto__:null,V2NIMErrorCode:Wd,V2NIMErrorDesc:zd,get V2NIMLoginAuthType(){return gd},get V2NIMLoginStatus(){return Id},get V2NIMLoginClientType(){return vd},get V2NIMLoginClientChange(){return Td},get V2NIMConnectStatus(){return Nd},get V2NIMChatroomKickedReason(){return Md},get V2NIMChatroomMemberRole(){return Od},get V2NIMMessageSendingState(){return Sd},get V2NIMMessageAttachmentUploadState(){return Rd},get V2NIMMessageType(){return yd},get V2NIMQueryDirection(){return Ad},get V2NIMChatroomMessageNotificationType(){return Cd},get V2NIMClientAntispamOperateType(){return bd},get V2NIMChatroomStatus(){return Ld},get V2NIMChatroomQueueLevelMode(){return Vd}}),Xd=function(){function V2NIMLoginReconnect(t){this.currenRetryCount=0,this.reconnectTimer=0,this.backoffIntervals=[1e3,2e3,3e3],this.currReconnectInterval=0,this.core=t,this.auth=t.auth}var t=V2NIMLoginReconnect.prototype;return t.reset=function reset(){this.currenRetryCount=0,this.reconnectTimer&&clearTimeout(this.reconnectTimer)},t.clearReconnectTimer=function clearReconnectTimer(){this.reconnectTimer&&clearTimeout(this.reconnectTimer)},t.attempToReLogin=function attempToReLogin(){var t=this,i=this.backoffIntervals[this.currReconnectInterval];return this.currReconnectInterval=(this.currReconnectInterval+1)%this.backoffIntervals.length,this.currenRetryCount++,this.core.logger.log("reconnect::reconnect timer is about to be set, delay "+i+" ms, current retry count is "+this.currenRetryCount),this.clearReconnectTimer(),this.reconnectTimer=gs((function(){t.core.logger.log("reconnect::reconnect timer is now triggered");var i=t.auth.getConnectStatus();3===i?t.doReLogin():t.core.logger.warn("reconnect::reconnect timer is over because connect status now is "+i)}),i),!0},t.doReLogin=function doReLogin(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var t,i,u=this;return Ra.wrap((function _callee$(_){for(;;)switch(_.prev=_.next){case 0:return this.auth.connectParams.forceMode=!1,_.prev=1,_.next=4,this.auth.updateDynamicParamters(!1);case 4:_.next=9;break;case 6:return _.prev=6,_.t0=_.catch(1),_.abrupt("return",this.auth.lifeCycle.processEvent("waiting"));case 9:return t=this.core.timeOrigin.getTimeNode(),this.auth.originLoginPromise=this.auth.doLogin(!0),_.prev=11,_.next=14,this.auth.previousLoginManager.add(this.auth.originLoginPromise);case 14:this.currReconnectInterval=0,this.auth.reportLoginSucc(t),_.next=29;break;case 18:if(_.prev=18,_.t1=_.catch(11),i=_.t1,this.core.logger.warn("reconnect::try login but failed due to",i),this.auth.reportLoginFail(t,i),!this.auth.checkLoginTerminalCode(i&&i.code)){_.next=28;break}return this.auth.clientSocket.doDisconnect(id.ACTIVE,"ReloginTerminated}"),this.auth.lifeCycle.processEvent("exited",i),_.abrupt("return");case 28:i&&i.code===Wd.V2NIM_ERROR_CODE_SERVER_UNIT_ERROR?this.auth.updateLinkAddress().then((function(){u.auth.lifeCycle.processEvent("waiting")})).catch((function(t){u.auth.lifeCycle.processEvent("reconnectFail",t)})):this.auth.lifeCycle.processEvent("waiting");case 29:case"end":return _.stop()}}),_callee,this,[[1,6],[11,18]])})))},V2NIMLoginReconnect}(),Jd=function(){function V2NIMLoginAuthenticator(t){this.lastLoginClientKey="__NIM_LAST_LOGIN_CLIENT__",this.loginClients=[],this.loginClientOfThisConnection={},this.core=t,this.auth=t.auth}var t=V2NIMLoginAuthenticator.prototype;return t.verifyAuthentication=function verifyAuthentication(t){var i,u,_,h,E,m,I,v,T,N,M,O,S,R;return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var A,C,L,k,D,V,w,P,x,U;return Ra.wrap((function _callee$(G){for(;;)switch(G.prev=G.next){case 0:return C=Os.getSystemInfo(),L={clientType:16,os:C.os,sdkVersion:100971,appLogin:t?0:1,protocolVersion:1,deviceId:this.auth.deviceId,appkey:this.auth.appkey,account:this.auth.account,browser:C.browser,clientSession:this.auth.clientSession,customClientType:this.core.options.customClientType,sdkHumanVersion:"10.9.71",userAgent:this.core.options.loginSDKTypeParamCompat?"Native/10.9.71":slice(A=C.userAgent.replace("{{appkey}}",this.auth.appkey)).call(A,0,299),libEnv:this.core.options.loginSDKTypeParamCompat?void 0:C.libEnv,hostEnv:this.core.options.loginSDKTypeParamCompat?0:C.hostEnvEnum,authType:this.auth.authType,loginExt:this.auth.loginExt,token:this.auth.token},k=La(La({appkey:this.auth.appkey,account:this.auth.account,deviceId:this.auth.deviceId,chatroomId:this.auth.roomId,appLogin:t?0:1,chatroomNick:null===(i=this.auth.enterParams)||void 0===i?void 0:i.roomNick,chatroomAvatar:(null===(u=this.auth.enterParams)||void 0===u?void 0:u.roomAvatar)||"",serverExtension:null===(_=this.auth.enterParams)||void 0===_?void 0:_.serverExtension,notificationExtension:null===(h=this.auth.enterParams)||void 0===h?void 0:h.notificationExtension,clientSession:this.auth.clientSession,isAnonymous:this.auth.isAnonymous,tags:null===(m=null===(E=this.auth.enterParams)||void 0===E?void 0:E.tagConfig)||void 0===m?void 0:m.tags,notifyTargetTags:null===(v=null===(I=this.auth.enterParams)||void 0===I?void 0:I.tagConfig)||void 0===v?void 0:v.notifyTargetTags,authType:this.auth.authType,loginExt:this.auth.loginExt},null===(N=null===(T=this.auth.enterParams)||void 0===T?void 0:T.locationConfig)||void 0===N?void 0:N.locationInfo),{distance:null===(O=null===(M=this.auth.enterParams)||void 0===M?void 0:M.locationConfig)||void 0===O?void 0:O.distance,antiSpamBusinessId:null===(R=null===(S=this.auth.enterParams)||void 0===S?void 0:S.antispamConfig)||void 0===R?void 0:R.antispamBusinessId,isRoutable:!1===get(this.auth,"enterParams.loginOption.routeConfig.routeEnabled")?0:1,env:get(this.auth,"enterParams.loginOption.routeConfig.routeEnvironment")}),G.prev=3,this.auth.lifeCycle.processEvent("loginStart"),G.next=7,this.auth.doLoginStepsManager.add(this.auth.clientSocket.sendCmd("v2ChatroomLogin",{type:1,chatroomLogin:k,chatroomIMLogin:L}));case 7:D=G.sent,G.next=18;break;case 10:if(G.prev=10,G.t0=G.catch(3),V=G.t0,this.core.reporter.reportTraceUpdateV2("login",{operation_type:"protocol",target:"26-3",code:V.code||0,succeed:!1,description:V.message},{asyncParams:Os.net.getNetworkStatus()}),V.code!==Wd.V2NIM_ERROR_CODE_CANCELLED&&V.code!==Wd.V2NIM_ERROR_CODE_TIMEOUT){G.next=16;break}throw V;case 16:throw this.processLoginFailed(V),V;case 18:return w=D.content,P=w.chatroomInfo,x=w.chatroomMember,U=w.chatroomCdnInfo,this.core.V2NIMChatroomMessageService.cdnUtil.setOptions(U),G.abrupt("return",{chatroom:P,selfMember:x});case 21:case"end":return G.stop()}}),_callee,this,[[3,10]])})))},t.processLoginFailed=function processLoginFailed(t){this.auth.clientSocket.doDisconnect(id.ACTIVE,t),this.checkLoginTerminalCode(t.code)&&(this.auth.authenticator.reset(),this.auth.authenticator.clearLastLoginClient()),this.auth.lifeCycle.processEvent("loginFail",t)},t.changeLoginClient=function changeLoginClient(t,i){},t.checkAutoLogin=function checkAutoLogin(t){if(t)return!1;var i=Os.localStorage.getItem(this.lastLoginClientKey);if(!i)return!1;var u="",_="";try{var h=JSON.parse(i);u=get(h,"clientId"),_=get(h,"account")}catch(t){return!1}return u===this.auth.deviceId&&_===this.auth.account},t.checkLoginTerminalCode=function checkLoginTerminalCode(t){var i=[Wd.V2NIM_ERROR_CODE_CANCELLED,Wd.V2NIM_ERROR_CODE_TIMEOUT,Wd.V2NIM_ERROR_CODE_HANDSHAKE,302,317,Wd.V2NIM_ERROR_CODE_FORBIDDEN,Wd.V2NIM_ERROR_CODE_NOT_FOUND,Wd.V2NIM_ERROR_CODE_PARAMETER_ERROR,Wd.V2NIM_ERROR_CODE_MULTI_LOGIN_FORBIDDEN,422,Wd.V2NIM_ERROR_CODE_IM_DISABLED,Wd.V2NIM_ERROR_CODE_APPKEY_NOT_EXIST,Wd.V2NIM_ERROR_CODE_BUNDLEID_CHECK_FAILED,Wd.V2NIM_ERROR_CODE_APPKEY_BLOCKED,Wd.V2NIM_ERROR_CODE_INVALID_TOKEN,Wd.V2NIM_ERROR_CODE_ROBOT_NOT_ALLOWED,Wd.V2NIM_ERROR_CODE_ACCOUNT_NOT_EXIST,Wd.V2NIM_ERROR_CODE_ACCOUNT_BANNED,Wd.V2NIM_ERROR_CODE_SERVICE_ADDRESS_INVALID,Wd.V2NIM_ERROR_CODE_CHATROOM_DISABLED,Wd.V2NIM_ERROR_CODE_CHATROOM_NOT_EXIST,Wd.V2NIM_ERROR_CODE_CHATROOM_CLOSED,Wd.V2NIM_ERROR_CODE_ACCOUNT_IN_CHATROOM_BLOCK_LIST];return includes(i).call(i,t)},t.reset=function reset(){this.loginClients=[],this.loginClientOfThisConnection={}},t.clearLastLoginClient=function clearLastLoginClient(){Os.localStorage.removeItem(this.lastLoginClientKey)},V2NIMLoginAuthenticator}(),Qd=function(){function V2NIMLoginLifeCycle(t){this.name="V2NIMLoginLifeCycle",this.chatroomStatus=6,this.entered=!1,this.core=t,this.auth=t.auth,this.logger=t.logger}var t=V2NIMLoginLifeCycle.prototype;return t.processEvent=function processEvent(t,i,u){var _=this.getConnectStatus();switch(t){case"connect":this.logger.log(this.name+"::connecting"),this.setChatroomStatus(2);break;case"connectSucc":this.logger.log(this.name+"::connect success"),this.setChatroomStatus(3);break;case"connectFail":this.logger.log(this.name+"::connect fail",i),this.setChatroomStatus(0,i);break;case"connectionBroken":this.logger.log(this.name+"::connectionBroken",i),this.setChatroomStatus(0,i);break;case"loginStart":this.logger.log(this.name+"::login start"),this.setChatroomStatus(4);break;case"loginSucc":this.logger.log(this.name+"::login success, verify authentication success"),this.setChatroomStatus(5),this.core.eventBus.emit("V2NIMLoginService/loginLifeCycleLoginSucc",u);break;case"loginFail":this.logger.log(this.name+"::login fail due to verify authentication failed:",i),this.setChatroomStatus(0,i);break;case"logout":this.logger.log(this.name+"::logout"),this.setChatroomStatus(6),this.core.eventBus.emit("V2NIMLoginService/loginLifeCycleLogout");break;case"kicked":this.logger.log(this.name+"::kicked",u),this.setChatroomStatus(6,i),this.core.eventBus.emit("V2NIMLoginService/loginLifeCycleKicked");break;case"reconnectFail":this.logger.log(this.name+"::reconnect fail",i),this.setChatroomStatus(6,i),this.core.eventBus.emit("V2NIMLoginService/loginLifeCycleLogout");break;case"exited":if(this.logger.log(this.name+"::exited, isEntered: "+this.entered,i),6===this.chatroomStatus)return;this.setChatroomStatus(this.entered?6:0,i);break;case"waiting":this.logger.log(this.name+"::waiting to reconnect"),this.setChatroomStatus(1),2!==_&&this.auth.reconnect.attempToReLogin()}},t.getConnectStatus=function getConnectStatus(){switch(this.chatroomStatus){case 6:case 0:return 0;case 5:case 4:case 3:return 1;case 2:return 2;case 1:return 3}},t.getLoginStatus=function getLoginStatus(){switch(this.chatroomStatus){case 1:return 3;case 6:case 0:return 0;case 3:case 2:case 4:return 2;case 5:return 1}},t.setChatroomStatus=function setChatroomStatus(t,i){5===t&&(this.entered=!0),this.chatroomStatus!==t&&(this.chatroomStatus=t,6===t&&this.core._clearModuleData(),this.core.emit("onChatroomStatus",t,i),6===t&&this.entered&&(this.entered=!1,this.core.emit("onChatroomExited",i)))},V2NIMLoginLifeCycle}(),Zd=entryVirtual("Array").values,e_=Array.prototype,t_={DOMTokenList:!0,NodeList:!0},values=function(t){var i=t.values;return t===e_||K(e_,t)&&i===e_.values||de(t_,Ut(t))?Zd:i},r_=br.every,n_=arrayMethodIsStrict("every");_export({target:"Array",proto:!0,forced:!n_},{every:function every(t){return r_(this,t,arguments.length>1?arguments[1]:void 0)}});var o_=entryVirtual("Array").every,i_=Array.prototype,every=function(t){var i=t.every;return t===i_||K(i_,t)&&i===i_.every?o_:i};function replacer(t,i){return i instanceof RegExp?"__REGEXP "+i.toString():i}function validate(t,i,u,_){var h;void 0===i&&(i={}),void 0===_&&(_=!1);var E={};return forEach$1(h=cs(t)).call(h,(function(h){var m=t[h].type,I=u?"In "+u+", ":"";if(null==i){var v=I+"param is null or undefined";throw _?new kl({detail:{reason:v,data:{key:h},rules:"required"}}):new Ll(v,{key:h},"required")}if(void 0===i[h]){if(!1===t[h].required)return void(E[h]=i[h]);var T=I+"param '"+h+"' is required";throw _?new kl({detail:{reason:T,data:{key:h},rules:"required"}}):new Ll(T,{key:h},"required")}var N=a_[m];if(N&&!N(i,h,t[h],_)){var M=I+"param '"+h+"' unexpected",O={key:h,value:i[h]};throw _?new kl({detail:{reason:M,data:O,rules:Ua(t[h],replacer)}}):new Ll(M,O,Ua(t[h],replacer))}E[h]=i[h]})),E}var a_={string:function string(t,i,u){var _=u.allowEmpty,h=u.max,E=u.min,m=u.regExp,I=t[i];return"string"==typeof I&&((!1!==_||""!==I)&&(!("number"==typeof h&&I.length>h)&&(!("number"==typeof E&&I.length<E)&&!(function isRegExp(t){return"[object RegExp]"===Object.prototype.toString.call(t)}(m)&&!m.test(I)))))},number:function number(t,i,u){var _=u.min,h=u.max,E=t[i];return"number"==typeof E&&(!("number"==typeof _&&E<_)&&!("number"==typeof h&&E>h))},boolean:function boolean(t,i){return"boolean"==typeof t[i]},file:function file(t,i){return!0},enum:function _enum(t,i,u){var _=values(u),h=t[i];return!_||indexOf(_).call(_,h)>-1},jsonstr:function jsonstr(t,i){try{var u=JSON.parse(t[i]);return"object"==typeof u&&null!==u}catch(t){return!1}},func:function func(t,i){return"function"==typeof t[i]},array:function array(t,i,u,_){void 0===_&&(_=!1);var h=u.itemType,E=u.itemRules,m=u.rules,I=u.min,v=u.max,T=values(u),N=t[i];if(!Fa(N))return!1;if("number"==typeof v&&N.length>v)return!1;if("number"==typeof I&&N.length<I)return!1;if(E)forEach$1(N).call(N,(function(t,u){var h,m;validate(((h={})[u]=E,h),((m={})[u]=t,m),i+"["+u+"]",_)}));else if(m)forEach$1(N).call(N,(function(t,u){return validate(m,t,i+"["+u+"]",_)}));else if("enum"===h){if(T&&function difference(t,i){return i=i||[],filter(t=t||[]).call(t,(function(t){return-1===indexOf(i).call(i,t)}))}(N,T).length)return!1}else if(h&&!every(N).call(N,(function(t){return typeof t===h})))return!1;return!0},object:function object(t,i,u,_){void 0===_&&(_=!1);var h=u.rules,E=u.allowEmpty,m=t[i];if("object"!=typeof m||null===m)return!1;if(h){var I=cs(h),v=cs(m),T=filter(v).call(v,(function(t){return indexOf(I).call(I,t)>-1}));if(!1===E&&0===T.length)return!1;validate(h,m,i,_)}return!0}},s_={updateParams:{type:"object",allowEmpty:!1,rules:{roomName:{type:"string",required:!1,allowEmpty:!1},announcement:{type:"string",required:!1},liveUrl:{type:"string",required:!1},serverExtension:{type:"string",required:!1},notificationEnabled:{type:"boolean",required:!1},notificationExtension:{type:"string",required:!1}}},antispamConfig:{type:"object",required:!1,rules:{antispamBusinessId:{type:"string",required:!1}}}},c_={locationInfo:{type:"object",rules:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},distance:{type:"number"}},l_={updateParams:{type:"object",allowEmpty:!1,rules:{tags:{type:"array",required:!1,itemType:"string"},notifyTargetTags:{type:"string",required:!1},notificationEnabled:{type:"boolean",required:!1},notificationExtension:{type:"string",required:!1}}}},u_={targetTag:{type:"string",required:!0,allowEmpty:!1},notifyTargetTags:{type:"string",required:!1},duration:{type:"number",required:!1},notificationEnabled:{type:"boolean",required:!1},notificationExtension:{type:"string",required:!1}},d_={roomId:{allowEmpty:!1,type:"string"},enterParams:{type:"object",required:!0,rules:{anonymousMode:{required:!1,type:"boolean"},accountId:{required:!1,type:"string",allowEmpty:!1},token:{required:!1,type:"string",allowEmpty:!1},roomNick:{required:!1,type:"string"},roomAvatar:{required:!1,type:"string"},loginOption:{type:"object",required:!1,rules:{authType:{type:"enum",required:!1,values:[0,1,2]},tokenProvider:{required:!1,type:"func"},loginExtensionProvider:{required:!1,type:"func"},routeConfig:{type:"object",required:!1,rules:{routeEnabled:{type:"boolean",required:!1},routeEnv:{type:"string",required:!1}}}}},linkProvider:{type:"func"},serverExtension:{type:"string",required:!1,allowEmpty:!1},notificationExtension:{type:"string",required:!1,allowEmpty:!1},tagConfig:{type:"object",required:!1,rules:{notifyTargetTags:{type:"string",required:!1},tags:{type:"array",required:!1,itemType:"string"}}},locationConfig:{type:"object",required:!1,rules:c_},antispamConfig:{type:"object",required:!1,rules:{antispamBusinessId:{type:"string",required:!1,allowEmpty:!1}}}}}},__=function validateLinkAddressArray(t){if(!Fa(t))throw new bl({code:400,message:"linkAddressArray must be an array"});if(0===t.length)throw new bl({code:400,message:"linkAddressArray must not be empty"});forEach$1(t).call(t,(function(t){if(!t)throw new bl({code:400,message:"linkAddress must not be empty"})}))},p_=function(t){function V2ChatroomService(i,u){var _;return(_=t.call(this)||this).name=i,_.logger=u.logger,_.core=u,_}bt(V2ChatroomService,t);var i=V2ChatroomService.prototype;return i.emit=function emit(i){for(var u=this,_=arguments.length,h=new Array(_>1?_-1:0),E=1;E<_;E++)h[E-1]=arguments[E];this.logger.debug(this.name+"::emit event: '"+i.toString()+"',",void 0!==h[0]?h[0]:"",void 0!==h[1]?h[1]:"",void 0!==h[2]?h[2]:"");try{var m,I,v=(m=t.prototype.emit).call.apply(m,concat(I=[this,i]).call(I,h));return v}catch(t){return gs((function(){throw u.logger.error(u.name+"::emit throw error in setTimeout. event: "+i.toString()+". Error",t),t}),0),!1}},i.process=function process(t){var i=this[t.cmd+"Handler"];if("function"==typeof i){if(t.error)return this.logger.error(t.cmd+"::recvError",t.error),pa.reject(t.error);try{var u=i.call(this,t);return pa.resolve(u)}catch(t){return pa.reject(t)}}var _=get(t,"error.detail.ignore");return t.error&&!_?pa.reject(t.error):pa.resolve(t)},V2ChatroomService}(ql),h_=function(t){function V2NIMChatroomLoginServiceImpl(i){var u;return(u=t.call(this,"V2NIMChatroomLoginService",i)||this).roomId="",u.token="",u.loginExt="",u.authType=0,u.linkAddressArray=[],u.currLinkIdx=-1,u.isAnonymous=!1,u.processId="",u.connectParams={forceMode:!1},registerParser({cmdMap:Bd,cmdConfig:jd}),i.auth=Xe(u),u.previousLoginManager=new xu,u.doLoginStepsManager=new xu,u.loginTimerManager=new hd,u.lifeCycle=new Qd(i),u.reconnect=new Xd(i),u.authenticator=new Jd(i),u}bt(V2NIMChatroomLoginServiceImpl,t);var i=V2NIMChatroomLoginServiceImpl.prototype;return i.getNextLink=function getNextLink(){return this.currLinkIdx=(this.currLinkIdx+1)%this.linkAddressArray.length,this.linkAddressArray[this.currLinkIdx]},i.getCurrLink=function getCurrLink(){return this.linkAddressArray[this.currLinkIdx]},i.reset=function reset(){this.roomId="",this.token="",this.loginExt="",this.processId="",this.reconnect.reset(),this.authenticator.reset(),this.authenticator.clearLastLoginClient()},i.login=function login(t,i,u){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var _,h=this;return Ra.wrap((function _callee$(E){for(;;)switch(E.prev=E.next){case 0:if(validate(d_,{appkey:t,roomId:i,enterParams:u},"",!0),0!==this.getLoginStatus()){E.next=5;break}this.logger.log("V2NIMChatroomLoginService::login:allowLogin. appkey:"+t+";roomId:"+i+";accountId:"+u.accountId+" "),E.next=11;break;case 5:if(1!==this.getLoginStatus()){E.next=9;break}return E.abrupt("return",this.smoothForLogined(t,i,u));case 9:if(2!==this.getLoginStatus()){E.next=11;break}return E.abrupt("return",this.smoothForLogining(t,i,u));case 11:return this.processId=od(),E.next=14,this.setLoginParams(t,i,u);case 14:return this.loginTimerManager.destroy(),this.loginTimerManager.addTimer((function(){var t=new bl({code:Wd.V2NIM_ERROR_CODE_TIMEOUT,detail:{reason:"Login API timeout"}});h.doLoginStepsManager.clear(t),h.previousLoginManager.clear(t),h.originLoginPromise=void 0,h.lifeCycle.processEvent("exited",t)}),u.timeout?1e3*u.timeout:6e4,1),E.prev=16,E.next=19,this.multiTryDoLogin();case 19:return _=E.sent,this.core.emit("onChatroomEntered"),this.loginTimerManager.destroy(),E.abrupt("return",_);case 25:throw E.prev=25,E.t0=E.catch(16),this.loginTimerManager.destroy(),E.t0;case 29:case"end":return E.stop()}}),_callee,this,[[16,25]])})))},i.multiTryDoLogin=function multiTryDoLogin(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){var i,u,_,h,E;return Ra.wrap((function _callee2$(m){for(;;)switch(m.prev=m.next){case 0:i=this.core.timeOrigin.getTimeNode(),u=new bl({code:Wd.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"loginFailed"}}),_=0;case 3:if(!(_<this.linkAddressArray.length)){m.next=32;break}return h="V2NIMChatroomLoginService:: "+(_+1)+"th login attempt.",_>0?this.logger.warn(h):this.logger.log(h),m.prev=6,this.originLoginPromise=t||this.doLogin(!1),t=void 0,m.next=11,this.previousLoginManager.add(this.originLoginPromise);case 11:return E=m.sent,this.doLoginStepsManager.clear(),this.previousLoginManager.clear(),this.originLoginPromise=void 0,this.reportLoginSucc(i),m.abrupt("return",E);case 19:if(m.prev=19,m.t0=m.catch(6),u=m.t0||u,this.logger.error("V2NIMChatroomLoginService::login failed, times of login try: "+_+", err.code: "+(null==u?void 0:u.code)+', err.message: "'+(null==u?void 0:u.message)+'"'),this.reportLoginFail(i,u),this.reconnect.clearReconnectTimer(),!(this.checkLoginTerminalCode(u&&u.code)||u&&u.code===Wd.V2NIM_ERROR_CODE_SERVER_UNIT_ERROR)){m.next=29;break}throw this.lifeCycle.processEvent("exited",u),u;case 29:_++,m.next=3;break;case 32:throw this.lifeCycle.processEvent("exited",u),u;case 34:case"end":return m.stop()}}),_callee2,this,[[6,19]])})))},i.doLogin=function doLogin(t){var i;return __awaiter(this,void 0,void 0,Ra.mark((function _callee3(){var u,_;return Ra.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:return u=!!t||this.authenticator.checkAutoLogin(this.connectParams.forceMode),h.next=3,this.doLoginStepsManager.add(this.clientSocket.connect(this.getNextLink(),t));case 3:return h.next=5,this.doLoginStepsManager.add(this.authenticator.verifyAuthentication(u));case 5:return _=h.sent,this.lifeCycle.processEvent("loginSucc",void 0,La(La({},_),{isReconnect:t})),this.clientSocket.resetSocketConfig(),this.reconnect.reset(),this.clientSocket.ping(),this.core.abtest.abtRequest(),this.core.V2NIMClientAntispamUtil.downloadLocalAntiSpamVocabs(),h.prev=12,h.next=15,this.core.cloudStorage.init(null===(i=_.selfMember)||void 0===i?void 0:i.enterTime);case 15:h.next=20;break;case 17:h.prev=17,h.t0=h.catch(12),this.logger.warn("doLogin::cloudStorage init error",h.t0);case 20:return this.prevLoginResult=_,h.abrupt("return",_);case 22:case"end":return h.stop()}}),_callee3,this,[[12,17]])})))},i.reportLoginSucc=function reportLoginSucc(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee4(){var i,u,_,h;return Ra.wrap((function _callee4$(E){for(;;)switch(E.prev=E.next){case 0:return i=this.core.timeOrigin.getNTPTime(),u=Ka()-t.time,this.core.timeOrigin.checkNodeReliable(t)&&(u=i-this.core.timeOrigin.getNTPTime(t)),E.next=5,Os.net.getNetworkStatus();case 5:_=E.sent,h=_.net_connect,this.core.reporter.report("chatroomLogin",{accid:this.account,roomId:this.roomId,serverIps:this.linkAddressArray,currentServerIp:this.getCurrLink(),rt:u,result:200,failReason:"",time:i,net_connect:h,binary_websocket:this.core.config.binaryWebsocket});case 8:case"end":return E.stop()}}),_callee4,this)})))},i.reportLoginFail=function reportLoginFail(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee5(){var u,_,h,E,m,I;return Ra.wrap((function _callee5$(v){for(;;)switch(v.prev=v.next){case 0:if(u=get(i,"code")||get(i,"detail.rawError.code")||0,_=get(i,"detail.rawError.message")||get(i,"message")||"login failed",u!==Wd.V2NIM_ERROR_CODE_CANCELLED){v.next=4;break}return v.abrupt("return");case 4:return h=this.core.timeOrigin.getNTPTime(),E=Ka()-t.time,this.core.timeOrigin.checkNodeReliable(t)&&(E=h-this.core.timeOrigin.getNTPTime(t)),v.next=9,Os.net.getNetworkStatus();case 9:m=v.sent,I=m.net_connect,this.core.reporter.report("chatroomLogin",{accid:this.account,roomId:this.roomId,serverIps:this.linkAddressArray,currentServerIp:this.getCurrLink(),rt:E,result:u,failReason:_,time:h,net_connect:I,binary_websocket:this.core.config.binaryWebsocket});case 12:case"end":return v.stop()}}),_callee5,this)})))},i.smoothForLogined=function smoothForLogined(t,i,u){return __awaiter(this,void 0,void 0,Ra.mark((function _callee6(){var _;return Ra.wrap((function _callee6$(h){for(;;)switch(h.prev=h.next){case 0:if(_=this.checkIsSameLogin(t,i,u),this.logger.warn("V2NIMChatroomLoginService::smoothForLogined:Logined, isSameLogin "+_),!_){h.next=6;break}return h.abrupt("return",this.prevLoginResult);case 6:return h.next=8,this.logout();case 8:return h.abrupt("return",this.login(t,i,u));case 9:case"end":return h.stop()}}),_callee6,this)})))},i.smoothForLogining=function smoothForLogining(t,i,u){return __awaiter(this,void 0,void 0,Ra.mark((function _callee7(){var _;return Ra.wrap((function _callee7$(h){for(;;)switch(h.prev=h.next){case 0:if(_=this.checkIsSameLogin(t,i,u),this.previousLoginManager.clear(),this.reconnect.reset(),!_){h.next=14;break}if(this.originLoginPromise){h.next=6;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"NoPreviousLoginExists"}});case 6:return this.reconnect.reset(),h.next=9,pa.resolve();case 9:return h.next=11,this.multiTryDoLogin(this.originLoginPromise);case 11:return h.abrupt("return",h.sent);case 14:return this.doLoginStepsManager.clear(),this.clientSocket.doDisconnect(id.ACTIVE,"Aborted"),this.reset(),this.lifeCycle.processEvent("logout",new bl({code:Wd.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"disconnect due to logout. aborted previous login."}})),h.next=20,pa.resolve();case 20:return h.abrupt("return",this.login(t,i,u));case 21:case"end":return h.stop()}}),_callee7,this)})))},i.checkIsSameLogin=function checkIsSameLogin(t,i,u){var _,h,E,m,I,v,T,N=void 0!==u.anonymousMode&&u.anonymousMode,M=(null===(_=u.loginOption)||void 0===_?void 0:_.authType)||0,O=Ua((null===(E=null===(h=this.enterParams)||void 0===h?void 0:h.tagConfig)||void 0===E?void 0:E.tags)||[]),S=Ua((null===(m=u.tagConfig)||void 0===m?void 0:m.tags)||[]),R=Ua((null===(I=this.enterParams)||void 0===I?void 0:I.locationConfig)||{}),A=Ua(u.locationConfig||{});return this.appkey===t&&this.roomId===i&&this.authType===M&&this.isAnonymous===N&&this.account===u.accountId&&(null===(v=this.enterParams)||void 0===v?void 0:v.roomNick)===u.roomNick&&(null===(T=this.enterParams)||void 0===T?void 0:T.roomAvatar)===u.roomAvatar&&O===S&&R===A},i.logout=function logout(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee8(){var t,i,u;return Ra.wrap((function _callee8$(_){for(;;)switch(_.prev=_.next){case 0:this.doLoginStepsManager.clear(),this.previousLoginManager.clear(),this.loginTimerManager.destroy(),this.originLoginPromise=void 0,t=this.getConnectStatus(),i=this.getLoginStatus(),u=new bl({code:Wd.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"disconnect due to logout"}}),_.t0=i,_.next=1===_.t0?10:2===_.t0?23:3===_.t0?26:0===_.t0?30:32;break;case 10:return _.prev=10,_.next=13,this.clientSocket.sendCmd("v2ChatroomLogout",void 0,{timeout:1e3});case 13:this.clientSocket.doDisconnect(id.ACTIVE,"UserActiveDisconnect"),this.lifeCycle.processEvent("logout",u),_.next=22;break;case 17:_.prev=17,_.t1=_.catch(10),this.logger.error("Instance::disconnect sendCmd:logout error",_.t1),this.clientSocket.doDisconnect(id.ACTIVE,"UserActiveDisconnect"),this.lifeCycle.processEvent("logout",u);case 22:return _.abrupt("break",34);case 23:return this.clientSocket.doDisconnect(id.ACTIVE,"UserActiveDisconnect"),this.lifeCycle.processEvent("logout",u),_.abrupt("break",34);case 26:return this.clientSocket.doDisconnect(id.ACTIVE,"UserActiveDisconnect"),this.core._clearModuleData(),this.lifeCycle.processEvent("logout",u),_.abrupt("break",34);case 30:throw this.core._clearModuleData(),new bl({code:Wd.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:{reason:"Illegal logout. loginStatus "+i+". connectStatus "+t}});case 32:throw this.core._clearModuleData(),new bl({code:Wd.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:{reason:"Illegal logout. illegal status: loginStatus "+i+". connectStatus "+t}});case 34:case"end":return _.stop()}}),_callee8,this,[[10,17]])})))},i.getConnectStatus=function getConnectStatus(){return this.lifeCycle.getConnectStatus()},i.getLoginStatus=function getLoginStatus(){return this.lifeCycle.getLoginStatus()},i.getLoginUser=function getLoginUser(){return this.account},i.getRoomId=function getRoomId(){return this.roomId},i.checkLoginTerminalCode=function checkLoginTerminalCode(t){return this.authenticator.checkLoginTerminalCode(t)},i.updateLinkAddress=function updateLinkAddress(){var t;return __awaiter(this,void 0,void 0,Ra.mark((function _callee9(){return Ra.wrap((function _callee9$(i){for(;;)switch(i.prev=i.next){case 0:if(!(null===(t=this.enterParams)||void 0===t?void 0:t.linkProvider)){i.next=12;break}return i.prev=1,i.next=4,this.enterParams.linkProvider(this.account,this.roomId);case 4:this.linkAddressArray=i.sent,this.currLinkIdx=-1,__(this.linkAddressArray),i.next=12;break;case 9:throw i.prev=9,i.t0=i.catch(1),new bl({code:Wd.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"linkProvider error: "+i.t0}});case 12:case"end":return i.stop()}}),_callee9,this,[[1,9]])})))},i.updateDynamicParamters=function updateDynamicParamters(t){var i,u,_,h;return __awaiter(this,void 0,void 0,Ra.mark((function _callee10(){return Ra.wrap((function _callee10$(E){for(;;)switch(E.prev=E.next){case 0:if(this.enterParams){E.next=2;break}return E.abrupt("return");case 2:if(!t){E.next=5;break}return E.next=5,this.updateLinkAddress();case 5:if(0===this.authType||!(null===(u=null===(i=this.enterParams)||void 0===i?void 0:i.loginOption)||void 0===u?void 0:u.tokenProvider)){E.next=21;break}return E.prev=6,E.next=9,this.enterParams.loginOption.tokenProvider(this.appkey,this.roomId,this.account);case 9:this.token=E.sent,E.next=15;break;case 12:throw E.prev=12,E.t0=E.catch(6),new bl({code:Wd.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"tokenProvider error: "+E.t0}});case 15:if(null!==this.token&&void 0!==this.token){E.next=19;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_CALLBACK_FAILED,detail:{reason:"tokenProvider should not return null or undefined when authType === 1 or authType === 2"}});case 19:if(this.token||1!==this.authType){E.next=21;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_CALLBACK_FAILED,detail:{reason:"tokenProvider should not return empty string when authType === 1"}});case 21:if(!(null===(h=null===(_=this.enterParams)||void 0===_?void 0:_.loginOption)||void 0===h?void 0:h.loginExtensionProvider)){E.next=33;break}return E.prev=22,E.next=25,this.enterParams.loginOption.loginExtensionProvider(this.appkey,this.roomId,this.account);case 25:this.loginExt=E.sent,E.next=31;break;case 28:throw E.prev=28,E.t1=E.catch(22),new bl({code:Wd.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"loginExtensionProvider error: "+E.t1}});case 31:if(null!==this.loginExt&&void 0!==this.loginExt||2!==this.authType){E.next=33;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_CALLBACK_FAILED,detail:{reason:"loginExtensionProvider should not return null or undefined when authType === 2"}});case 33:case"end":return E.stop()}}),_callee10,this,[[6,12],[22,28]])})))},i.setLoginParams=function setLoginParams(t,i,u){var _,h;return __awaiter(this,void 0,void 0,Ra.mark((function _callee11(){return Ra.wrap((function _callee11$(E){for(;;)switch(E.prev=E.next){case 0:if(this.reset(),this.roomId=i,this.enterParams=u,this.core.options.appkey=t,this.core.options.tags=(null===(_=u.tagConfig)||void 0===_?void 0:_.tags)||[],u.token&&(this.token=u.token),u.anonymousMode&&!u.accountId?this.core.options.account="nimanon_"+od():this.core.options.account=u.accountId,this.isAnonymous=void 0!==u.anonymousMode&&u.anonymousMode,!this.isAnonymous||u.roomNick){E.next=14;break}if(void 0!==u.roomNick){E.next=13;break}u.roomNick=this.core.options.account,E.next=14;break;case 13:throw new bl({code:Wd.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"roomNick is required when anonymousMode is true"}});case 14:return this.authType=(null===(h=u.loginOption)||void 0===h?void 0:h.authType)||0,E.next=17,this.updateDynamicParamters(!0);case 17:case"end":return E.stop()}}),_callee11,this)})))},i.v2LoginHandler=function v2LoginHandler(t){if(t.error)throw this.clientSocket.doDisconnect(id.ACTIVE,t.error),t.error;return t},i.v2LoginClientChangeHandler=function v2LoginClientChangeHandler(t){this.authenticator.changeLoginClient(au(t.content.state),t.content.datas)},i.nimLoginClientChangeHandler=function nimLoginClientChangeHandler(t){this.authenticator.changeLoginClient(au(t.content.state),t.content.datas)},i.v2ChatroomBeKickedHandler=function v2ChatroomBeKickedHandler(t){var i=t.content,u=i.kickedReason,_=i.serverExtension;this.clientSocket.doDisconnect(id.KICKED,u),this.core._clearModuleData(),this.lifeCycle.processEvent("kicked",new bl({code:Wd.V2NIM_ERROR_CODE_DISCONNECT,detail:{reason:"disconnect due to kicked"}}),u),this.core.emit("onChatroomKicked",{kickedReason:u,serverExtension:_})},$e(V2NIMChatroomLoginServiceImpl,[{key:"clientSocket",get:function get(){return this.core.clientSocket}},{key:"account",get:function get(){return this.core.options.account}},{key:"appkey",get:function get(){return this.core.options.appkey}},{key:"deviceId",get:function get(){return this.core.config.deviceId}},{key:"clientSession",get:function get(){return this.core.config.clientSession}}]),V2NIMChatroomLoginServiceImpl}(p_),f_={user_id:"",trace_id:"",action:7,exception_service:6,duration:0,start_time:0,state:1,extension:[]},E_=function(){function ReporterHookLinkKeep(t,i){this.traceData=f_,this.core=t,this.traceData=La({},f_,i),this.traceData.extension=[]}var t=ReporterHookLinkKeep.prototype;return t.reset=function reset(){this.traceData=La({},f_),this.traceData.extension=[]},t.start=function start(){var t,i;this.reset(),this.traceData.user_id=this.core.account,this.traceData.trace_id=(null===(i=null===(t=this.core.clientSocket)||void 0===t?void 0:t.socket)||void 0===i?void 0:i.sessionId)||"",this.traceData.start_time=(new Date).getTime()},t.update=function update(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var i,u,_;return Ra.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,Os.net.getNetworkStatus();case 2:i=h.sent,u=i.net_type,_=i.net_connect,this.traceData.extension.push(La({code:0,foreground:!0,foreg_backg_switch:!1,net_type:u,net_connect:_},t));case 6:case"end":return h.stop()}}),_callee,this)})))},t.end=function end(t){var i=this.traceData.extension[0],u=this.traceData.extension[1];if(i&&0===i.operation_type&&u&&1===u.operation_type){var _=i.net_type!==u.net_type||i.net_connect!==u.net_connect;if(t||!_)return this.traceData.duration=(new Date).getTime()-this.traceData.start_time,this.core.reporter.report("exceptions",this.traceData),void this.reset();this.reset()}else this.reset()},ReporterHookLinkKeep}(),m_="V2NIMChatroomInfoService",g_={"36_13":"v2GetChatroomInfo","36_14":"v2UpdateChatroomInfo","36_30":"v2SetTempChatBannedByTag","13_33":"v2UpdateChatroomLocation","36_34":"v2UpdateChatroomTags"},I_={tags:{id:1,converter:function converter(t){return Ua(t)}},notifyTargetTags:2,notificationEnabled:{id:3,converter:function converter(t){return+t}},notificationExtension:4},v_={v2GetChatroomInfo:{sid:36,cid:13,service:m_,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(Hd)}]},v2UpdateChatroomInfo:{sid:36,cid:14,service:m_,params:[{type:"Property",name:"chatroom",reflectMapper:Hd},{type:"Bool",name:"notificationEnabled"},{type:"String",name:"notificationExtension"}]},v2SetTempChatBannedByTag:{sid:36,cid:30,service:m_,params:[{type:"Property",name:"tag",reflectMapper:{targetTag:1,duration:2,notificationEnabled:{id:3,converter:function converter(t){return+t}},notificationExtension:4,notifyTargetTags:5}}]},v2UpdateChatroomLocation:{sid:13,cid:33,service:m_,params:[{type:"Property",name:"tag",reflectMapper:{x:1,y:2,z:3,distance:4}}]},v2UpdateChatroomTags:{sid:36,cid:34,service:m_,params:[{type:"Property",name:"tag",reflectMapper:I_}]}},T_=function(){function Service(t,i){this.name=t,this.core=i,this.name=t,this.logger=i.logger,this.core=i}return Service.prototype.process=function process(t){var i=this[t.cmd+"Handler"];if("function"==typeof i)return i.call(this,t);var u=get(t,"error.detail.ignore");return t.error&&!u?pa.reject(t.error):pa.resolve(t)},Service}(),N_=function(){function V2NIMChatroomInfoModel(){this.chatroomInfo=null}return V2NIMChatroomInfoModel.prototype.reset=function reset(){this.chatroomInfo=null},V2NIMChatroomInfoModel}();function pick(t,i){t=t||{};var u={};return forEach$1(i=i||[]).call(i,(function(i){void 0!==t[i]&&(u[i]=t[i])})),u}var M_,O_,S_=function(t){function V2NIMChatroomInfoServiceImpl(i){var u;return u=t.call(this,"V2NIMChatroomInfoService",i)||this,registerParser({cmdMap:g_,cmdConfig:v_}),u.model=new N_,u.setListener(),u}bt(V2NIMChatroomInfoServiceImpl,t);var i=V2NIMChatroomInfoServiceImpl.prototype;return i.setListener=function setListener(){var t=this;this.core.eventBus.on("V2NIMChatroomMessageService/onReceiveNotification",(function(i,u){return __awaiter(t,void 0,void 0,Ra.mark((function _callee(){var t,_,h,E,m,I;return Ra.wrap((function _callee$(v){for(;;)switch(v.prev=v.next){case 0:v.t0=i.attachment.type,v.next=6===v.t0?3:13;break;case 3:return h=null===(t=u.data.roomInfo)||void 0===t?void 0:t.extension,E=null===(_=u.data.roomInfo)||void 0===_?void 0:_.queueLevel,delete(m=La(La(La({},u.data.roomInfo||{}),void 0!==h?{serverExtension:h}:{}),void 0!==E?{queueLevelMode:E}:{})).extension,delete m.queueLevel,v.next=10,this._updateChatroomInfo(m);case 10:return I=v.sent,this.core.V2NIMChatroomService.emit("onChatroomInfoUpdated",I),v.abrupt("break",13);case 13:case"end":return v.stop()}}),_callee,this)})))}))},i.reset=function reset(){this.model.reset()},i.getChatroomInfo=function getChatroomInfo(){return this.model.chatroomInfo},i.updateChatroomInfo=function updateChatroomInfo(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){var u;return Ra.wrap((function _callee2$(_){for(;;)switch(_.prev=_.next){case 0:if(validate(s_,{updateParams:t,antispamConfig:i},"",!0),t.announcement||t.liveUrl||t.roomName||t.serverExtension){_.next=3;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"updateParams.announcement, updateParams.liveUrl, updateParams.roomName, updateParams.serverExtension 至少有一个不为空"}});case 3:return u=void 0===t.notificationEnabled||t.notificationEnabled,_.next=6,this.core.sendCmd("v2UpdateChatroomInfo",{chatroom:t,notificationEnabled:u,notificationExtension:t.notificationExtension||""});case 6:this._updateChatroomInfo(pick(t,["announcement","liveUrl","roomName","serverExtension"]));case 7:case"end":return _.stop()}}),_callee2,this)})))},i.updateChatroomLocationInfo=function updateChatroomLocationInfo(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee3(){return Ra.wrap((function _callee3$(i){for(;;)switch(i.prev=i.next){case 0:return validate(c_,t,"",!0),i.next=3,this.core.sendCmd("v2UpdateChatroomLocation",{tag:La(La({},t.locationInfo),{distance:t.distance})});case 3:case"end":return i.stop()}}),_callee3,this)})))},i.updateChatroomTags=function updateChatroomTags(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee4(){return Ra.wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:if(validate(l_,{updateParams:t},"",!0),t.tags||void 0!==t.notifyTargetTags){i.next=3;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"updateParams.tags, updateParams.notifyTargetTags 至少有一个不为空"}});case 3:return t.notificationEnabled=void 0===t.notificationEnabled||t.notificationEnabled,i.next=6,this.core.sendCmd("v2UpdateChatroomTags",{tag:t});case 6:case"end":return i.stop()}}),_callee4,this)})))},i.setTempChatBannedByTag=function setTempChatBannedByTag(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee5(){return Ra.wrap((function _callee5$(i){for(;;)switch(i.prev=i.next){case 0:return validate(u_,t,"",!0),t.notificationEnabled=void 0===t.notificationEnabled||t.notificationEnabled,i.next=4,this.core.sendCmd("v2SetTempChatBannedByTag",{tag:t});case 4:case"end":return i.stop()}}),_callee5,this)})))},i._updateChatroomInfo=function _updateChatroomInfo(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee6(){return Ra.wrap((function _callee6$(i){for(;;)switch(i.prev=i.next){case 0:if(!this.model.chatroomInfo){i.next=4;break}La(this.model.chatroomInfo,t),i.next=6;break;case 4:return i.next=6,this._getChatroomInfoAsync();case 6:return i.abrupt("return",this.model.chatroomInfo);case 7:case"end":return i.stop()}}),_callee6,this)})))},i._getChatroomInfoAsync=function _getChatroomInfoAsync(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee7(){var t;return Ra.wrap((function _callee7$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.core.sendCmd("v2GetChatroomInfo");case 2:t=i.sent,this._setChatroomInfo(t.content.data);case 4:case"end":return i.stop()}}),_callee7,this)})))},i._setChatroomInfo=function _setChatroomInfo(t){this.model.chatroomInfo=t},V2NIMChatroomInfoServiceImpl}(T_),R_={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)"}},y_={accessKeyId:"",secretAccessKey:"",sessionToken:"",region:"",maxRetries:0,bucket:"",objectName:"",token:"",shortUrl:""};function getUploadResponseFormat(t){return void 0===t&&(t="file"),Ua(R_[t]||{}).replace(/"/gi,'\\"')}!function(t){t[t.nos=1]="nos",t[t.s3=2]="s3"}(M_||(M_={})),function(t){t[t.dontNeed=-1]="dontNeed",t[t.time=2]="time",t[t.urls=3]="urls"}(O_||(O_={}));var A_={chunkUploadHost:"https://wannos-web.127.net",chunkUploadHostBackupList:["https://fileup.chatnos.com","https://oss.chatnos.com"],commonUploadHost:"https://fileup.chatnos.com",commonUploadHostBackupList:["https://upload.chatnos.com","https://oss.chatnos.com"],chunkMaxSize:4194304e4,commonMaxSize:104857600,uploadReplaceFormat:"https://{host}/{object}",cdn:{defaultCdnDomain:"nim-nosdn.netease.im",cdnDomain:"",bucket:"nim",objectNamePrefix:""},downloadUrl:"https://{bucket}-nosdn.netease.im/{object}",downloadHostList:["nos.netease.com"],nosCdnEnable:!0,isNeedToGetUploadPolicyFromServer:!0},C_=function(){function NOS(t,i){this.nosCdnHostTimer=0,this.nosErrorCount=0,this.core=t,this.cloudStorage=i}var t=NOS.prototype;return t.reset=function reset(){this.nosErrorCount=0},t.getNosAccessToken=function getNosAccessToken(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var i,u,_;return Ra.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.core.sendCmd("getNosAccessToken",{tag:t});case 2:return i=h.sent,u=get(i,"content.nosAccessTokenTag.token"),_=t.url,h.abrupt("return",{token:u,url:-1!==indexOf(_).call(_,"?")?_+"&token="+u:_+"?token="+u});case 6:case"end":return h.stop()}}),_callee,this)})))},t.deleteNosAccessToken=function deleteNosAccessToken(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){return Ra.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.core.sendCmd("deleteNosAccessToken",{tag:t});case 2:case"end":return i.stop()}}),_callee2,this)})))},t.nosUpload=function nosUpload(t,i,u){var _,h,E,m,I,v,T,N,M,O;return __awaiter(this,void 0,void 0,Ra.mark((function _callee3(){var S,R,A,C,L,k,D,V,w,P,x,U,G,B,H,Y,j,K,q,W,z,$;return Ra.wrap((function _callee3$(X){for(;;)switch(X.prev=X.next){case 0:if(S=get(this.core,"config.cdn.bucket"),R={tag:t.nosScenes||S||"nim"},t.nosSurvivalTime&&(R.expireSec=t.nosSurvivalTime),(A=this.core.adapters.getFileUploadInformation(t))&&A.complete&&i.destroy(),!(!u&&!A)){X.next=20;break}return X.prev=7,X.next=10,this.core.sendCmd("getNosToken",{responseBody:getUploadResponseFormat(t.type),nosToken:R});case 10:C=X.sent,X.next=20;break;case 13:if(X.prev=13,X.t0=X.catch(7),this.core.logger.error("uploadFile:: getNosToken error",X.t0),i.destroy(),!(X.t0 instanceof bl)){X.next=19;break}throw X.t0;case 19:throw new Dl({code:"v2"===get(this.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"getNosToken error",rawError:X.t0,curProvider:1}});case 20:return L=this.config.uploadReplaceFormat.replace("{bucket}",this.config.cdn.bucket).replace("{host}",this.config.cdn.cdnDomain||this.config.cdn.defaultCdnDomain).replace("{object}",A?null===(_=A.uploadInfo)||void 0===_?void 0:_.objectName:u?null==u?void 0:u.objectName:C.content.nosToken.objectName),k="",u&&u.shortUrl&&(k=u.shortUrl),(null===(m=null===(E=null===(h=null==A?void 0:A.uploadInfo)||void 0===h?void 0:h.payload)||void 0===E?void 0:E.mixStoreToken)||void 0===m?void 0:m.shortUrl)&&(k=A.uploadInfo.payload.mixStoreToken.shortUrl),D=k||L,X.prev=25,w=A?{token:null===(I=null==A?void 0:A.uploadInfo)||void 0===I?void 0:I.token,bucket:null===(v=null==A?void 0:A.uploadInfo)||void 0===v?void 0:v.bucketName,objectName:null===(T=null==A?void 0:A.uploadInfo)||void 0===T?void 0:T.objectName}:u||C.content.nosToken,this.core.logger.log("uploadFile:: uploadFile params",{nosToken:w,chunkUploadHost:this.config.chunkUploadHost,chunkUploadHostBackupList:this.config.chunkUploadHostBackupList,commonUploadHost:this.config.commonUploadHost,commonUploadHostBackupList:this.config.commonUploadHostBackupList,platform:Os.platform}),P="BROWSER"===Os.platform?this.config.chunkUploadHost:this.config.commonUploadHost+"/"+(w&&w.bucket),x="UNIAPP"===Os.platform||"MINIAPP"===(null===(N=Os.getSystemInfo())||void 0===N?void 0:N.libEnv)?4:u?2:0,U=t.filePath?t.filePath:"object"==typeof t.file?t.file.name:"",i.update({remote_addr:P,operation_type:x}),U&&i.update({local_file:U}),X.next=35,this.core.adapters.uploadFile(La(La(La(La({},t),{nosToken:w,chunkUploadHost:this.config.chunkUploadHost,chunkUploadHostBackupList:this.config.chunkUploadHostBackupList,commonUploadHost:this.config.commonUploadHost,commonUploadHostBackupList:this.config.commonUploadHostBackupList,maxSize:t.maxSize||this.config.chunkMaxSize}),u?{payload:{mixStoreToken:u}}:{}),{onUploadInfo:function onUploadInfo(t){i.update(La({},t))}}),i);case 35:V=X.sent,X.next=70;break;case 38:if(X.prev=38,X.t1=X.catch(25),this.core.logger.error("uploadFile::nos uploadFile error:",X.t1),G="v2"===get(this.core,"options.apiVersion"),X.t1.code!==Al.V2NIM_ERROR_CODE_CANCELLED&&10499!==X.t1.errCode){X.next=44;break}throw new Dl({code:G?Al.V2NIM_ERROR_CODE_CANCELLED:400,detail:{reason:get(X.t1,"message")||"Request abort",rawError:X.t1,curProvider:1}});case 44:if(!G||X.t1.errCode!==Al.V2NIM_ERROR_CODE_FILE_OPEN_FAILED){X.next=46;break}throw new bl({code:Al.V2NIM_ERROR_CODE_FILE_OPEN_FAILED,detail:{reason:get(X.t1,"message")||"Read file failed",rawError:X.t1,curProvider:1}});case 46:return X.next=48,Os.net.getNetworkStatus();case 48:if(B=X.sent,!1!==B.net_connect){X.next=52;break}throw new Dl({code:"v2"===get(this.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"No network",rawError:X.t1,curProvider:1}});case 52:if(!u){X.next=69;break}if(!(this.nosErrorCount<=0)){X.next=65;break}X.prev=54,this.cloudStorage.mixStorage._addCircuitTimer(),X.next=61;break;case 58:throw X.prev=58,X.t2=X.catch(54),new Dl({code:"v2"===get(this.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"All upload attempts failed",rawError:X.t2,curProvider:this.cloudStorage.mixStorage.curProvider,mixStorePolicy:this.cloudStorage.mixStorage.mixStorePolicy,file:t.file||t.filePath}});case 61:return this.nosErrorCount=get(this.cloudStorage,"mixStorePolicy.nosPolicy.uploadConfig.retryPolicy.retry"),X.abrupt("return",this.cloudStorage._uploadFile(t,i));case 65:return this.nosErrorCount--,X.abrupt("return",this.nosUpload(t,i,u));case 67:X.next=70;break;case 69:throw new Dl({code:"v2"===get(this.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"NOS attempts failed",rawError:X.t1,curProvider:1}});case 70:if(H=null==V?void 0:V.type,(Y=H&&indexOf(H).call(H,"/")>-1?slice(H).call(H,0,indexOf(H).call(H,"/")):"")||(Y=t.type||""),(j={image:"imageInfo",video:"vinfo",audio:"vinfo"})[Y]){X.next=78;break}return X.abrupt("return",La({url:D},V));case 78:if(!(V.w&&V.h||V.dur)){X.next=80;break}return X.abrupt("return",La({url:D},V));case 80:return X.prev=80,X.next=83,this.core.adapters.request(L+"?"+j[Y],{method:"GET",dataType:"json",timeout:5e3},{exception_service:3});case 83:K=X.sent,X.next=92;break;case 86:return X.prev=86,X.t3=X.catch(80),q=X.t3,i.update({exception:"Fetch media info failed;url:"+L+"?"+j[Y]+";errMsg:"+((null===(M=q.detail)||void 0===M?void 0:M.reason)||q.message),external_code:q.code}),this.core.logger.error("uploadFile:: fetch file info error",X.t3),X.abrupt("return",La({url:D},V));case 92:if(!K){X.next=99;break}return W=K.data,z="imageInfo"===j[Y]?W:null===(O=null==W?void 0:W.GetVideoInfo)||void 0===O?void 0:O.VideoInfo,$={url:D,name:V.name,size:V.size,ext:V.ext,w:null==z?void 0:z.Width,h:null==z?void 0:z.Height,orientation:null==z?void 0:z.Orientation,dur:null==z?void 0:z.Duration,audioCodec:null==z?void 0:z.AudioCodec,videoCodec:null==z?void 0:z.VideoCodec,container:null==z?void 0:z.Container},X.abrupt("return",pickBy($,(function(t){return void 0!==t})));case 99:return X.abrupt("return",La({url:D},V));case 100:case"end":return X.stop()}}),_callee3,this,[[7,13],[25,38],[54,58],[80,86]])})))},t._getNosCdnHost=function _getNosCdnHost(){var t;return __awaiter(this,void 0,void 0,Ra.mark((function _callee4(){var i,u,_,h=this;return Ra.wrap((function _callee4$(E){for(;;)switch(E.prev=E.next){case 0:return E.prev=0,E.next=3,this.core.sendCmd("getNosCdnHost");case 3:i=E.sent,E.next=10;break;case 6:return E.prev=6,E.t0=E.catch(0),this.core.logger.error("getNosCdnHost::error",E.t0),E.abrupt("return");case 10:if(i){E.next=12;break}return E.abrupt("return");case 12:u=null===(t=null==i?void 0:i.content)||void 0===t?void 0:t.nosConfigTag,0!==(_=au(null==u?void 0:u.expire))&&u.cdnDomain?-1===_?(this.config.cdn.bucket=u.bucket,this.config.cdn.cdnDomain=u.cdnDomain,this.config.cdn.objectNamePrefix=u.objectNamePrefix):(this.config.cdn.bucket=u.bucket,this.config.cdn.cdnDomain=u.cdnDomain,this.config.cdn.objectNamePrefix=u.objectNamePrefix,this.nosCdnHostTimer=this.core.timerManager.addTimer((function(){h._getNosCdnHost()}),1e3*_)):(this.config.cdn.bucket="",this.config.cdn.cdnDomain="",this.config.cdn.objectNamePrefix="");case 15:case"end":return E.stop()}}),_callee4,this,[[0,6]])})))},$e(NOS,[{key:"config",get:function get(){return this.cloudStorage.config}}]),NOS}(),b_={"6_2":"getNosToken","6_22":"getOriginUrl","6_24":"getNosAccessToken","6_25":"deleteNosAccessToken","6_26":"getNosCdnHost","6_27":"getGrayscaleConfig","6_28":"getMixStorePolicy","6_29":"getMixStoreToken","6_30":"getFileAuthToken"},L_={nosToken:{objectName:1,token:2,bucket:3,expireTime:4,expireSec:7,tag:8,shortUrl:9},mixStoreTokenReqTag:{provider:0,tokenCount:1,nosSurvivalTime:2,tag:3,returnBody:4,policyVersion:5},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,policyVersion:5},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},nosAccessTokenTag:{token:0,url:1,userAgent:2,ext:3}},k_={getNosToken:{sid:6,cid:2,service:"cloudStorage",params:[{type:"String",name:"responseBody"},{type:"Property",name:"nosToken",entity:"nosToken",reflectMapper:L_.nosToken}],response:[{type:"Property",name:"nosToken",reflectMapper:invertSerializeItem(L_.nosToken)}]},getOriginUrl:{sid:6,cid:22,service:"cloudStorage",params:[{type:"Property",name:"nosSafeUrlTag",reflectMapper:L_.nosSafeUrlTag}],response:[{type:"Property",name:"nosSafeUrlTag",reflectMapper:invertSerializeItem(L_.nosSafeUrlTag)}]},getNosCdnHost:{sid:6,cid:26,service:"cloudStorage",response:[{type:"Property",name:"nosConfigTag",reflectMapper:invertSerializeItem(L_.nosConfigTag)}]},getGrayscaleConfig:{sid:6,cid:27,service:"cloudStorage",params:[{type:"Property",name:"config"}],response:[{type:"Property",name:"grayConfigTag",reflectMapper:invertSerializeItem(L_.grayConfigTag)}]},getMixStorePolicy:{sid:6,cid:28,service:"cloudStorage",params:[{type:"LongArray",name:"supportType"}],response:[{type:"Property",name:"mixStorePolicyTag",reflectMapper:invertSerializeItem(L_.mixStorePolicyTag)}]},getMixStoreToken:{sid:6,cid:29,service:"cloudStorage",params:[{type:"Property",name:"mixStoreTokenReqTag",reflectMapper:L_.mixStoreTokenReqTag}],response:[{type:"Property",name:"mixStoreTokenResTag",reflectMapper:invertSerializeItem(L_.mixStoreTokenResTag)}]},getFileAuthToken:{sid:6,cid:30,service:"cloudStorage",params:[{type:"Property",name:"mixStoreAuthTokenReqTag",reflectMapper:L_.mixStoreAuthTokenReqTag}],response:[{type:"Property",name:"mixStoreAuthTokenResTag",reflectMapper:invertSerializeItem(L_.mixStoreAuthTokenResTag)}]},getNosAccessToken:{sid:6,cid:24,service:"cloudStorage",params:[{type:"Property",name:"tag",reflectMapper:L_.nosAccessTokenTag}],response:[{type:"Property",name:"tag",reflectMapper:invertSerializeItem(L_.nosAccessTokenTag)}]},deleteNosAccessToken:{sid:6,cid:25,service:"cloudStorage",params:[{type:"Property",name:"tag",reflectMapper:L_.nosAccessTokenTag}]}},D_=function(){function MixStorage(t,i){this.GRAYKEY="AllGrayscaleConfig",this.MIXSTOREKEY="AllMixStorePolicy",this.grayConfig={mixStoreEnable:!1,timeStamp:0,ttl:0},this.mixStorePolicy={providers:[],timeStamp:0,ttl:0,s3Policy:null,nosPolicy:null,policyVersion:void 0},this.curProvider=1,this.mixStoreErrorCount=10,this.circuitTimer=0,this.core=t,this.cloudStorage=i,this.logger=t.logger}var t=MixStorage.prototype;return t.reset=function reset(){this.grayConfig=null,this.mixStorePolicy={providers:[],timeStamp:0,ttl:0,s3Policy:null,nosPolicy:null,policyVersion:void 0},this.curProvider=1,this.mixStoreErrorCount=10},t.getGrayscaleConfig=function getGrayscaleConfig(t,i){var u;return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var _,h;return Ra.wrap((function _callee$(E){for(;;)switch(E.prev=E.next){case 0:if(Os.localStorage)try{Os.localStorage.getItem&&Os.localStorage.getItem(this.GRAYKEY)&&(this.grayConfig=JSON.parse(Os.localStorage.getItem(this.GRAYKEY))[t])}catch(t){Os.localStorage.getItem(this.GRAYKEY)&&this.core.logger.error("uploadFile:: JSON.parse grayscaleConfig error ",t)}if(this.grayConfig&&!(this.grayConfig.timeStamp+1e3*this.grayConfig.ttl<i)){E.next=17;break}return E.next=4,this.core.sendCmd("getGrayscaleConfig",{config:{}});case 4:if(!(_=E.sent).content||!_.content.grayConfigTag){E.next=16;break}this.logger.log("uploadFile::getAppGrayConfigRequest success ");try{this.grayConfig=JSON.parse(_.content.grayConfigTag.config),this.grayConfig.ttl=JSON.parse(_.content.grayConfigTag.ttl)}catch(t){this.logger.error("getGrayscaleConfig error",t)}if(this.grayConfig){E.next=10;break}return E.abrupt("return");case 10:h=Os.localStorage.getItem(this.GRAYKEY)?JSON.parse(Os.localStorage.getItem(this.GRAYKEY)):{},this.grayConfig.timeStamp=(new Date).getTime(),h[t]=this.grayConfig,Os.localStorage.setItem(this.GRAYKEY,Ua(h)),E.next=17;break;case 16:this.logger.log("uploadFile:: result grayConfig:",_.content);case 17:if(!(null===(u=this.grayConfig)||void 0===u?void 0:u.mixStoreEnable)){E.next=20;break}return E.next=20,this._getMixStorePolicy(t);case 20:case"end":return E.stop()}}),_callee,this)})))},t._getMixStorePolicy=function _getMixStorePolicy(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){var i,u,_,h,E,m,I;return Ra.wrap((function _callee2$(v){for(;;)switch(v.prev=v.next){case 0:if(i=(new Date).getTime(),Os.localStorage)try{this.mixStorePolicy=JSON.parse(Os.localStorage.getItem(this.MIXSTOREKEY))[t],this.curProvider=au(this.mixStorePolicy.providers[0]),this.mixStorePolicy.timeStamp&&this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl>i&&(_=this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl-i,this.core.timerManager.addTimer(bind$1(u=this._getMixStorePolicy).call(u,this,t),_))}catch(i){Os.localStorage.getItem(this.MIXSTOREKEY)&&JSON.parse(Os.localStorage.getItem(this.MIXSTOREKEY))[t]&&this.core.logger.error("uploadFile:: JSON.parse mixStorePolicy error ",i)}if(this.mixStorePolicy&&!(this.mixStorePolicy.timeStamp+1e3*this.mixStorePolicy.ttl<=i)){v.next=31;break}return v.prev=3,v.next=6,this.core.sendCmd("getMixStorePolicy",{supportType:this.cloudStorage.aws.s3?[1,2]:[1]});case 6:E=v.sent,m=E.content.mixStorePolicyTag,this.mixStorePolicy={providers:[],timeStamp:0,ttl:0,s3Policy:null,nosPolicy:null,policyVersion:void 0},this.mixStorePolicy.policyVersion=m.policyVersion,this.mixStorePolicy.ttl=Number(m.ttl),this.mixStorePolicy.providers=m.providers.split(","),this.circuitTimer&&this.core.timerManager.deleteTimer(this.circuitTimer),this.curProvider=au(this.mixStorePolicy.providers[0]),this.mixStorePolicy.nosPolicy=m.nosPolicy?JSON.parse(m.nosPolicy):null,this.mixStorePolicy.s3Policy=m.s3Policy?JSON.parse(m.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(h=this._getMixStorePolicy).call(h,this,t),1e3*this.mixStorePolicy.ttl),I=Os.localStorage.getItem(this.MIXSTOREKEY)?JSON.parse(Os.localStorage.getItem(this.MIXSTOREKEY)):{},this.mixStorePolicy.timeStamp=(new Date).getTime(),I[t]=this.mixStorePolicy,Os.localStorage.setItem(this.MIXSTOREKEY,Ua(I)),v.next=31;break;case 24:if(v.prev=24,v.t0=v.catch(3),this.logger.error("getMixStorePolicy error",v.t0),0!==this.mixStoreErrorCount){v.next=29;break}throw new Error("getMixStorePolicy all count error");case 29:this._getMixStorePolicy(t),this.mixStoreErrorCount--;case 31:this.mixStorePolicy.nosPolicy&&(this.cloudStorage.nos.nosErrorCount=this.mixStorePolicy.nosPolicy.uploadConfig.retryPolicy.retry);case 32:case"end":return v.stop()}}),_callee2,this,[[3,24]])})))},t._addCircuitTimer=function _addCircuitTimer(){var t=this,i=this.mixStorePolicy.providers,u=i[(indexOf(i).call(i,String(this.curProvider))+1)%i.length];if(!u)throw new Error("uploadFile nextProvider error");if(u===i[0])throw new Error("uploadFile all policy fail");if(this.logger.log("uploadFile:: upload policy will change,now policy:"+this.curProvider+" nextProvider:"+u),this.curProvider=au(u),this.mixStorePolicy.nosPolicy&&this.mixStorePolicy.s3Policy){var _=this.mixStorePolicy[1===this.curProvider?"nosPolicy":"s3Policy"].uploadConfig.retryPolicy.circuit;if(!_||0===_)throw new Error("uploadFile circuit error");this.circuitTimer=this.core.timerManager.addTimer((function(){t.logger.log("uploadFile:: upload policy will change,now policy:"+t.curProvider+" nextProvider:"+au(t.mixStorePolicy.providers[0])),t.curProvider=au(t.mixStorePolicy.providers[0]),t.core.timerManager.deleteTimer(t.circuitTimer)}),1e3*_)}throw new Error("uploadFile will not retry again")},t.getFileAuthToken=function getFileAuthToken(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee3(){var i;return Ra.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.core.sendCmd("getFileAuthToken",{mixStoreAuthTokenReqTag:t});case 2:return i=u.sent,u.abrupt("return",i.content.mixStoreAuthTokenResTag);case 4:case"end":return u.stop()}}),_callee3,this)})))},MixStorage}(),V_=Ql.trim,w_=R("".charAt),P_=h.parseFloat,x_=h.Symbol,U_=x_&&x_.iterator,F_=1/P_(Wl+"-0")!=-1/0||U_&&!fails((function(){P_(Object(U_))}))?function parseFloat(t){var i=V_(toString(t)),u=P_(i);return 0===u&&"-"==w_(i,0)?-0:u}:P_;_export({global:!0,forced:parseFloat!=F_},{parseFloat:F_});var G_=j.parseFloat,B_=-1,H_=function(){function AWS(t,i){this.s3=null,this.core=t,this.cloudStorage=i,this.logger=t.logger}var t=AWS.prototype;return t.s3Upload=function s3Upload(t,i,u){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){var _,h,E,m,I,v,T,N,M,O,S,R,A,C,L=this;return Ra.wrap((function _callee2$(k){for(;;)switch(k.prev=k.next){case 0:if(B_+=1,!t.file){k.next=5;break}_=t.file,k.next=20;break;case 5:if("string"!=typeof t.fileInput){k.next=15;break}if(this.logger.warn("fileInput will abandon,Please use file or filepath"),!((h=document.getElementById(t.fileInput))&&h.files&&h.files[0])){k.next=12;break}_=h.files[0],k.next=13;break;case 12:throw new Error("Can not get file from fileInput");case 13:k.next=20;break;case 15:if(!(t.fileInput&&t.fileInput.files&&t.fileInput.files[0])){k.next=19;break}_=t.fileInput.files[0],k.next=20;break;case 19:throw new Error("Can not get file from fileInput "+t.fileInput);case 20:if(this.mixStorePolicy.s3Policy){k.next=22;break}throw new Error("dont get s3 policy");case 22:return E={accessKeyId:u.accessKeyId,secretAccessKey:u.secretAccessKey,sessionToken:u.sessionToken,region:u.region,maxRetries:this.mixStorePolicy.s3Policy.uploadConfig.retryPolicy.retry},m=this.s3,I=decodeURIComponent(u.bucket),v=decodeURIComponent(u.objectName),T=_,N="https://"+I+".s3.amazonaws.com/"+v,M={},(O=this.mixStorePolicy.s3Policy)&&O.uploadConfig&&Fa(O.uploadConfig.uploadUrl)&&O.uploadConfig.uploadUrl.length>0&&(S=O.uploadConfig.uploadUrl.length,B_%=S,M.endpoint=O.uploadConfig.uploadUrl[B_],M.s3ForcePathStyle=!0,N=M.endpoint+"/"+I+"/"+v),i.update({local_file:_.name,remote_addr:N,operation_type:1}),(R=new m(M)).config.update(E),A={Bucket:I,Key:v,Body:T,Metadata:{token:u.token},ContentType:T.type||"application/octet-stream"},this.core.logger.log("uploadFile:: s3 upload params:",A),(C=R.upload(A)).on("httpUploadProgress",(function(u){i.update({index:u.part});var _=G_((u.loaded/u.total).toFixed(2));t.onUploadProgress&&t.onUploadProgress({total:u.total,loaded:u.loaded,percentage:_,percentageText:Math.round(100*_)+"%"})})),k.abrupt("return",new pa((function(_,h){var E=(new Date).getTime();C.send((function(m,N){return __awaiter(L,void 0,void 0,Ra.mark((function _callee(){var M,O,S,R,A,C,L,k;return Ra.wrap((function _callee$(D){for(;;)switch(D.prev=D.next){case 0:if(!m||"RequestAbortedError"!==m.code){D.next=6;break}this.logger.error("uploadFile:","api::s3:upload file abort.",m),i.update({http_code:m.statusCode,exception:m}),h(new Dl({code:"v2"===get(this.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_CANCELLED:400,detail:{reason:"S3RequestAbortedError",rawError:m,curProvider:2}})),D.next=43;break;case 6:if(!m){D.next=27;break}return i.update({http_code:m.statusCode,exception:m}),this.core.reporter.reportTraceStart("exceptions",{user_id:this.core.options.account||(null===(O=null===(M=this.core)||void 0===M?void 0:M.auth)||void 0===O?void 0:O.account),trace_id:null===(S=this.core.clientSocket.socket)||void 0===S?void 0:S.sessionId,start_time:E,action:1,exception_service:4}),this.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:Ua({bucket:I,object:v})},{asyncParams:Os.net.getNetworkStatus()}),this.core.reporter.reportTraceEnd("exceptions",1),D.next=13,Os.net.getNetworkStatus();case 13:if(R=D.sent,!1!==R.net_connect){D.next=17;break}return D.abrupt("return",h(new Dl({code:"v2"===get(this.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"No network",rawError:m,curProvider:this.cloudStorage.mixStorage.curProvider}})));case 17:D.prev=17,this.cloudStorage.mixStorage._addCircuitTimer(),D.next=24;break;case 21:return D.prev=21,D.t0=D.catch(17),D.abrupt("return",h(new Dl({code:"v2"===get(this.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"All upload attempts failed",rawError:D.t0,curProvider:this.cloudStorage.mixStorage.curProvider,mixStorePolicy:this.mixStorePolicy,file:t.file||t.filePath}})));case 24:_(this.cloudStorage._uploadFile(t,i)),D.next=43;break;case 27:if(i.update({http_code:200}),A=(A=(A=this.mixStorePolicy.s3Policy.cdnSchema).replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn)).replace("{objectName}",N.Key),C={size:T.size,name:T.name,url:u.shortUrl?u.shortUrl:A,ext:T.name.split(".")[1]||"unknown"},L=t.type||"",(k={image:"imageInfo"})[L]){D.next=38;break}return D.abrupt("return",_(C));case 38:return D.t1=_,D.next=41,this.getS3FileInfo({url:A,infoSuffix:k[L],s3Result:C});case 41:return D.t2=D.sent,D.abrupt("return",(0,D.t1)(D.t2));case 43:case"end":return D.stop()}}),_callee,this,[[17,21]])})))})),t.onUploadStart&&t.onUploadStart(C)})));case 39:case"end":return k.stop()}}),_callee2,this)})))},t.getS3FileInfo=function getS3FileInfo(t){var i;return __awaiter(this,void 0,void 0,Ra.mark((function _callee3(){var u,_,h,E,m,I,v;return Ra.wrap((function _callee3$(T){for(;;)switch(T.prev=T.next){case 0:return u=t.url,_=t.infoSuffix,h=t.s3Result,T.prev=1,T.next=4,this.core.adapters.request(u+"?"+_,{method:"GET",dataType:"text",timeout:5e3},{exception_service:3});case 4:E=T.sent,T.next=11;break;case 7:return T.prev=7,T.t0=T.catch(1),this.core.logger.error("uploadFile:: fetch file info error",T.t0),T.abrupt("return",h);case 11:if(!E){T.next=18;break}return m=E.data,I="imageInfo"===_?m:null===(i=null==m?void 0:m.GetVideoInfo)||void 0===i?void 0:i.VideoInfo,v=La(La({},h),{w:null==I?void 0:I.Width,h:null==I?void 0:I.Height,orientation:null==I?void 0:I.Orientation,dur:null==I?void 0:I.Duration,audioCodec:null==I?void 0:I.AudioCodec,videoCodec:null==I?void 0:I.VideoCodec,container:null==I?void 0:I.Container}),T.abrupt("return",pickBy(v,(function(t){return void 0!==t})));case 18:return this.core.logger.error("uploadFile:: fetch s3 file info no result",u+"?"+_),T.abrupt("return",h);case 20:case"end":return T.stop()}}),_callee3,this,[[1,7]])})))},$e(AWS,[{key:"mixStorePolicy",get:function get(){return this.cloudStorage.mixStorage.mixStorePolicy}}]),AWS}(),Y_={user_id:"",trace_id:"",action:0,state:0,duration:0,start_time:0,offset:0,full_size:0,transferred_size:0,operation_type:0,remote_addr:"",local_file:"",retry_times:0,index:0,part_size:0,transfer_latency:0,http_code:0,exception:"",req_headers:"",rsp_headers:""},j_="ReporterHook::setMonitorForResources:",K_=function(){function ReporterHookCloudStorage(t,i){this.traceData=Y_,this.core=t,this.id=Math.round(1e3*Math.random()),this.traceData=La({},Y_,i)}var t=ReporterHookCloudStorage.prototype;return t.start=function start(){var t,i;this.core&&(this.reset(),this.traceData.user_id=this.core.account,this.traceData.trace_id=(null===(i=null===(t=this.core.clientSocket)||void 0===t?void 0:t.socket)||void 0===i?void 0:i.sessionId)||"",this.traceData.start_time="timeOrigin"in this.core?this.core.timeOrigin.getNTPTime():Ka())},t.update=function update(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){return Ra.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:if(this.core){i.next=2;break}return i.abrupt("return");case 2:if(this.traceData.user_id){i.next=4;break}return i.abrupt("return");case 4:if(t.transferred_size&&this.core.logger.log(this.id+"."+j_+" upload update",t),"object"==typeof t.exception)try{t.exception=Ua(t.exception)}catch(i){t.exception="UnknownObject"}if("object"==typeof t.req_headers)try{t.req_headers=Ua(t.req_headers)}catch(i){t.req_headers="UnknownObject"}if("object"==typeof t.rsp_headers)try{t.rsp_headers=Ua(t.rsp_headers)}catch(i){t.rsp_headers="UnknownObject"}La(this.traceData,t);case 9:case"end":return i.stop()}}),_callee,this)})))},t.end=function end(t){this.core&&this.traceData.user_id&&(this.core.logger.log(j_+" upload end cause of "+t),this.traceData.state=t,this.traceData.duration=("timeOrigin"in this.core?this.core.timeOrigin.getNTPTime():Ka())-(this.traceData.start_time||0),this.core.reporter.report("nim_sdk_resources",this.traceData),this.traceData=Y_,this.destroy())},t.reset=function reset(){this.traceData=La({},Y_)},t.destroy=function destroy(){this.core=void 0,this.traceData=Y_},ReporterHookCloudStorage}(),q_=function(){function CloudStorageService(t,i){void 0===i&&(i={}),this.config={},this.uploadTaskMap={},this.name="cloudStorage",this.logger=t.logger,this.core=t,this.nos=new C_(t,this),this.mixStorage=new D_(t,this),this.aws=new H_(t,this),registerParser({cmdMap:b_,cmdConfig:k_}),this.setOptions(i),this.setListeners()}var t=CloudStorageService.prototype;return t.setOptions=function setOptions(t){void 0===t&&(t={});var i=t.storageKeyPrefix||"NIMClient";this.mixStorage.GRAYKEY=i+"-AllGrayscaleConfig",this.mixStorage.MIXSTOREKEY=i+"-AllMixStorePolicy";var u=t.s3,_=__rest(t,["s3"]),h=La({},A_,this.config);if(_&&Object.prototype.hasOwnProperty.call(_,"cdn")){var E=La(La({},h.cdn),_.cdn);this.config=La({},h,_),this.config.cdn=E}else this.config=La({},h,_);u&&(this.aws.s3=u)},t.setListeners=function setListeners(){var t,i,u,_;this.core.eventBus.on("kicked",bind$1(t=this._clearUnCompleteTask).call(t,this)),this.core.eventBus.on("disconnect",bind$1(i=this._clearUnCompleteTask).call(i,this)),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLogout",bind$1(u=this._clearUnCompleteTask).call(u,this)),this.core.eventBus.on("V2NIMLoginService/loginLifeCycleKicked",bind$1(_=this._clearUnCompleteTask).call(_,this))},t._clearUnCompleteTask=function _clearUnCompleteTask(){var t,i=this;forEach$1(t=cs(this.uploadTaskMap)).call(t,(function(t){var u=i.uploadTaskMap[t];u&&u.abort&&u.abort()})),this.uploadTaskMap={}},t.init=function init(t){return void 0===t&&(t=Ka()),__awaiter(this,void 0,void 0,Ra.mark((function _callee(){return Ra.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:if(this.mixStorage.reset(),this.nos.reset(),!this.config.isNeedToGetUploadPolicyFromServer){i.next=5;break}return i.next=5,this.mixStorage.getGrayscaleConfig(this.core.options.appkey,t);case 5:return i.next=7,this.nos._getNosCdnHost();case 7:case"end":return i.stop()}}),_callee,this)})))},t.processCallback=function processCallback(t,i,u){var _=this,h=t.onUploadProgress,E=t.onUploadDone,m=t.onUploadStart;return{onUploadStart:"function"==typeof m?function(t){_.uploadTaskMap[i]=t;try{m(t)}catch(t){_.logger.error("CloudStorage::uploadFile:options.onUploadStart execute error",t)}}:function(t){_.uploadTaskMap[i]=t},onUploadProgress:"function"==typeof h?function(t){u.update({transferred_size:t.loaded,full_size:t.total});try{h(t)}catch(t){_.logger.error("CloudStorage::uploadFile:options.onUploadProgress execute error",t)}}:function(t){u.update({transferred_size:t.loaded,full_size:t.total})},onUploadDone:"function"==typeof E?function(t){u.end(0);try{E(t)}catch(t){_.logger.error("CloudStorage::uploadFile:options.onUploadDone execute error",t)}}:function(){u.end(0)},taskKey:i}},t.uploadFile=function uploadFile(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){var i,u,_,h,E,m,I,v,T;return Ra.wrap((function _callee2$(N){for(;;)switch(N.prev=N.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){N.next=3;break}throw new Error("uploadFile needs target file object or a filePath");case 3:if(!t.type||"file"===t.type){N.next=7;break}if(!(i=get(t,"file.type"))||"string"!=typeof i||-1!==indexOf(i).call(i,t.type)){N.next=7;break}throw new Error('The meta type "'+i+'" does not match "'+t.type+'"');case 7:return(u=new K_(this.core)).start(),t.file?u.update({full_size:t.file.size,local_file:t.file.name}):"string"==typeof t.fileInput?(_=document.getElementById(t.fileInput))&&_.files&&_.files[0]&&u.update({full_size:_.files[0].size,local_file:_.files[0].name}):t.fileInput&&t.fileInput.files&&t.fileInput.files[0]&&u.update({full_size:t.fileInput.files[0].size,local_file:t.fileInput.files[0].name}),h=od(),E=this.processCallback(t,h,u),m=E.onUploadStart,I=E.onUploadProgress,v=E.onUploadDone,t.onUploadStart=m,t.onUploadProgress=I,t.onUploadDone=v,T=null,N.prev=16,N.next=19,this._uploadFile(t,u);case 19:T=N.sent,t.md5&&(T.md5=t.md5),delete this.uploadTaskMap[h],N.next=29;break;case 24:throw N.prev=24,N.t0=N.catch(16),delete this.uploadTaskMap[h],u.end((N.t0&&N.t0.code)===Al.V2NIM_ERROR_CODE_CANCELLED?3:1),N.t0;case 29:return T&&(T.size=void 0===T.size?void 0:Number(T.size),T.w=void 0===T.w?void 0:Number(T.w),T.h=void 0===T.h?void 0:Number(T.h),T.dur=void 0===T.dur?void 0:Number(T.dur)),T.url=decodeURIComponent(T.url),t.onUploadDone({size:T.size,name:T.name,url:T.url,ext:T.name.split(".")[1]||"unknown"}),N.abrupt("return",T);case 33:case"end":return N.stop()}}),_callee2,this,[[16,24]])})))},t._uploadFile=function _uploadFile(t,i){var u,_;return __awaiter(this,void 0,void 0,Ra.mark((function _callee3(){var h,E,m,I;return Ra.wrap((function _callee3$(v){for(;;)switch(v.prev=v.next){case 0:if(get(this.mixStorage,"grayConfig.mixStoreEnable")&&get(this.mixStorage,"mixStorePolicy.providers.length")){v.next=3;break}return this.logger.log("uploadFile:: uploadFile begin, use old nos"),v.abrupt("return",this.nos.nosUpload(t,i));case 3:if(this.logger.log("uploadFile::_uploadFile, grayConfig enable:"+get(this.mixStorage,"grayConfig.mixStoreEnable")+" curProvider:"+get(this.mixStorage,"curProvider")),h=this.core.adapters.getFileUploadInformation(t),E=!0,h?!1===h.complete&&2===this.mixStorage.curProvider?E=!1:h.complete&&i.destroy():E=!1,this.aws.s3||(this.mixStorage.curProvider=1),m=y_,E){v.next=24;break}return v.prev=10,v.next=13,this.core.sendCmd("getMixStoreToken",{mixStoreTokenReqTag:{provider:this.mixStorage.curProvider,tokenCount:1,tag:"qchat",nosSurvivalTime:t.nosSurvivalTime,returnBody:getUploadResponseFormat(t.type),policyVersion:this.mixStorage.mixStorePolicy.policyVersion}});case 13:I=v.sent,m=I.content.mixStoreTokenResTag,v.next=24;break;case 17:if(v.prev=17,v.t0=v.catch(10),this.core.logger.error("uploadFile:: getMixStoreToken error",v.t0),i.destroy(),!(v.t0 instanceof bl)){v.next=23;break}throw v.t0;case 23:throw new Dl({code:"v2"===get(this.core,"options.apiVersion")?Al.V2NIM_ERROR_CODE_FILE_UPLOAD_FAILED:400,detail:{reason:"getMixStoreToken error",rawError:v.t0,curProvider:this.mixStorage.curProvider,mixStorePolicy:this.mixStorage.mixStorePolicy}});case 24:if(E){v.next=28;break}return v.abrupt("return",2===this.mixStorage.curProvider?this.aws.s3Upload(t,i,m):this.nos.nosUpload(t,i,m));case 28:return v.abrupt("return",this.nos.nosUpload(t,i,null===(_=null===(u=null==h?void 0:h.uploadInfo)||void 0===u?void 0:u.payload)||void 0===_?void 0:_.mixStoreToken));case 29:case"end":return v.stop()}}),_callee3,this,[[10,17]])})))},t.getThumbUrl=function getThumbUrl(t,i){var u,_,h,E,m;if(!new RegExp(/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/).test(t))return this.logger.error("illegal file url:"+t),t;var I=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.exec(t);I[0],I[1],I[2],I[3],I[4];var v=I[5];if(I[6],I[7],null===(u=this.grayConfig)||void 0===u?void 0:u.mixStoreEnable){var T=this._getUrlType(t);if(2===T&&this.mixStorePolicy.s3Policy&&get(this.mixStorePolicy,"s3Policy.thumbPolicy.imagethumb"))return(null===(h=null===(_=this.mixStorePolicy.s3Policy)||void 0===_?void 0:_.thumbPolicy)||void 0===h?void 0:h.imagethumb).replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn).replace("{objectName}",v).replace("{x}",i.width.toString()).replace("{y}",i.height.toString());if(1===T&&this.mixStorePolicy.nosPolicy&&get(this.mixStorePolicy,"nosPolicy.thumbPolicy.imagethumb"))return(null===(m=null===(E=this.mixStorePolicy.nosPolicy)||void 0===E?void 0:E.thumbPolicy)||void 0===m?void 0:m.imagethumb).replace("{cdnDomain}",this.mixStorePolicy.nosPolicy.dlcdn).replace("{objectName}",v).replace("{x}",i.width.toString()).replace("{y}",i.height.toString())}return includes(t).call(t,"?")?t+"&imageView&thumbnail="+i.width+"x"+i.height:t+"?imageView&thumbnail="+i.width+"x"+i.height},t.getVideoCoverUrl=function getVideoCoverUrl(t,i){var u,_,h,E,m;if(!new RegExp(/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/).test(t))return this.logger.error("illegal file url:"+t),t;var I=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.exec(t);I[0],I[1],I[2],I[3],I[4];var v=I[5];if(I[6],I[7],null===(u=this.grayConfig)||void 0===u?void 0:u.mixStoreEnable){var T=this._getUrlType(t);if(2===T&&this.mixStorePolicy.s3Policy&&get(this.mixStorePolicy,"s3Policy.thumbPolicy.vframe"))return(null===(h=null===(_=this.mixStorePolicy.s3Policy)||void 0===_?void 0:_.thumbPolicy)||void 0===h?void 0:h.vframe).replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn).replace("{objectName}",v).replace("{x}",i.width.toString()).replace("{y}",i.height.toString()).replace("{offset}","0").replace("{type}","png");if(1===T&&this.mixStorePolicy.nosPolicy&&get(this.mixStorePolicy,"nosPolicy.thumbPolicy.vframe"))return(null===(m=null===(E=this.mixStorePolicy.nosPolicy)||void 0===E?void 0:E.thumbPolicy)||void 0===m?void 0:m.vframe).replace("{cdnDomain}",this.mixStorePolicy.nosPolicy.dlcdn).replace("{objectName}",v).replace("{x}",i.width.toString()).replace("{y}",i.height.toString()).replace("{offset}","0").replace("{type}","png")}return includes(t).call(t,"?")?t+"&vframe&offset=0&resize="+i.width+"x"+i.height+"&type=png":t+"?vframe&offset=0&resize="+i.width+"x"+i.height+"&type=png"},t.getPrivateUrl=function getPrivateUrl(t){var i;if(!new RegExp(/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/).test(t))return this.logger.error("illegal file url:"+t),"";var u=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.exec(t);u[0];var _=u[1],h=u[2],E=u[3];u[4];var m=u[5];if(u[6],u[7],null===(i=this.grayConfig)||void 0===i?void 0:i.mixStoreEnable){var I=this._getUrlType(t);return 2===I&&this.mixStorePolicy.s3Policy&&(t=this.mixStorePolicy.s3Policy.cdnSchema.replace("{cdnDomain}",this.mixStorePolicy.s3Policy.dlcdn).replace("{objectName}",m)),1===I&&this.mixStorePolicy.nosPolicy&&(t=this.mixStorePolicy.nosPolicy.cdnSchema.replace("{cdnDomain}",this.mixStorePolicy.nosPolicy.dlcdn).replace("{objectName}",m)),t}var v=this.config,T=v.downloadUrl,N=v.downloadHostList,M=v.nosCdnEnable,O=this.config.cdn.cdnDomain,S=this.config.cdn.objectNamePrefix?decodeURIComponent(this.config.cdn.objectNamePrefix):"",R=decodeURIComponent(m),A=indexOf(R).call(R,S);if(O&&A>-1&&M)return _+":"+h+O+"/"+slice(R).call(R,A);if(includes(N).call(N,E)&&includes(m).call(m,"/")){var C=indexOf(m).call(m,"/"),L=m.substring(0,C),k=m.substring(C+1);return T.replace("{bucket}",L).replace("{object}",k)}var D=filter(N).call(N,(function(t){return"string"==typeof E&&includes(E).call(E,t)}))[0],V=D?E.replace(D,"").replace(/\W/g,""):null;return V?T.replace("{bucket}",V).replace("{object}",m):t},t.getOriginUrl=function getOriginUrl(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee4(){var i;return Ra.wrap((function _callee4$(u){for(;;)switch(u.prev=u.next){case 0:if("string"==typeof t&&includes(t).call(t,"_im_url=1")){u.next=2;break}return u.abrupt("return",t);case 2:return u.next=4,this.core.sendCmd("getOriginUrl",{nosSafeUrlTag:{safeUrl:t}});case 4:return i=u.sent,u.abrupt("return",i.content.nosSafeUrlTag.originUrl);case 6:case"end":return u.stop()}}),_callee4,this)})))},t.getFileToken=function getFileToken(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee5(){var i,u,_,h,E,m=this;return Ra.wrap((function _callee5$(I){for(;;)switch(I.prev=I.next){case 0:if(validate({type:{type:"number",min:2,max:3},urls:{type:"array",required:!1,itemType:"string"}},t),i=this.mixStorePolicy.nosPolicy?this.mixStorePolicy.nosPolicy.authPolicy.policyType:null,u=this.mixStorePolicy.s3Policy?this.mixStorePolicy.s3Policy.authPolicy.policyType:null,i!==String(-1)||u!==String(-1)){I.next=8;break}throw this.logger.error("don't need token"),new Error("don't need token");case 8:if(2!==t.type){I.next=17;break}if(!(i&&indexOf(i).call(i,String(2))>=0||u&&indexOf(u).call(u,String(2))>0)){I.next=13;break}return I.abrupt("return",this.mixStorage.getFileAuthToken(t));case 13:throw this.logger.error("don't support time token "),new Error("don't support type time token ");case 15:I.next=33;break;case 17:if(t.urls&&t.urls.length){I.next=20;break}throw this.logger.error("urls is required when urls token"),new Error("urls is required when urls token");case 20:if(h=[],E=[],forEach$1(_=t.urls).call(_,(function(t){var i=m._getUrlType(t);1===i&&E.push(t),2===i&&h.push(t)})),(!u||0!==h.length&&indexOf(u).call(u,String(3))<0)&&(this.logger.warn("s3 url don't support url token"),h=[]),(!i||0!==E.length&&indexOf(i).call(i,String(3))<0)&&(this.logger.warn("nos url don't support url token"),E=[]),0!==h.length||0!==E.length){I.next=30;break}throw this.logger.error("not support urls"),new Error("not support urls");case 30:if(0!==h.length&&0!==E.length){I.next=33;break}return t.urls=Ua(t.urls),I.abrupt("return",this.mixStorage.getFileAuthToken(t));case 33:case"end":return I.stop()}}),_callee5,this)})))},t._getUrlType=function _getUrlType(t){var i,u;return this.mixStorePolicy.nosPolicy&&some(i=this.mixStorePolicy.nosPolicy.dlcdns).call(i,(function(i){return indexOf(t).call(t,i)>=0}))?1:this.mixStorePolicy.s3Policy&&some(u=this.mixStorePolicy.s3Policy.dlcdns).call(u,(function(i){return indexOf(t).call(t,i)>=0}))?2:null},t.getNosAccessToken=function getNosAccessToken(t){return validate({url:{type:"string",allowEmpty:!1}},t),this.nos.getNosAccessToken(t)},t.deleteNosAccessToken=function deleteNosAccessToken(t){return validate({token:{type:"string",allowEmpty:!1}},t),this.nos.deleteNosAccessToken(t)},t.process=function process(t){var i=get(t,"error.detail.ignore");return t.error&&!i?pa.reject(t.error):pa.resolve(t)},$e(CloudStorageService,[{key:"grayConfig",get:function get(){return this.mixStorage.grayConfig}},{key:"mixStorePolicy",get:function get(){return this.mixStorage.mixStorePolicy}}]),CloudStorageService}();function getFileOrPath(t){var i="object"==typeof t?t:void 0,u="string"==typeof t?t:void 0;if(!i&&!u)throw new bl({code:Al.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"getFileOrPath::incorrect file and path"}});if("string"==typeof u)if(0===indexOf(u).call(u,"nim-external")){var _=document.getElementById(u);if(!(_&&_.files&&_.files[0]))throw new bl({code:Al.V2NIM_ERROR_CODE_FILE_NOT_FOUND,detail:{reason:"getFileOrPath::file not exist: "+u}});i=_.files[0]}else if("BROWSER"===Os.platform)throw new bl({code:Al.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"getFileOrPath::incorrect path: "+u}});if("object"==typeof i&&void 0===i.size)throw new bl({code:Al.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"getFileOrPath::file no size"}});return{file:i,path:u}}var W_=function(t){function V2Service(i,u){var _;return(_=t.call(this)||this).name=i,_.logger=u.logger,_.core=u,_}bt(V2Service,t);var i=V2Service.prototype;return i.checkV2=function checkV2(){var t=this.core.options.apiVersion;if("v2"===t)return!0;throw new bl({code:Al.V2NIM_ERROR_CODE_MISUSE,detail:{reason:'The version "'+t+'" of client is not supported.'}})},i.checkLogin=function checkLogin(){if(0===this.core.V2NIMLoginService.getLoginStatus())throw new bl({code:Al.V2NIM_ERROR_CODE_ILLEGAL_STATE,detail:{reason:"Client logout."}})},i.emit=function emit(i){for(var u=this,_=arguments.length,h=new Array(_>1?_-1:0),E=1;E<_;E++)h[E-1]=arguments[E];this.logger.debug(this.name+"::emit event: '"+i.toString()+"',",void 0!==h[0]?h[0]:"",void 0!==h[1]?h[1]:"",void 0!==h[2]?h[2]:"");try{var m,I,v=(m=t.prototype.emit).call.apply(m,concat(I=[this,i]).call(I,h));return v}catch(t){return gs((function(){throw u.logger.error(u.name+"::emit throw error in setTimeout. event: "+i.toString()+". Error",t),t}),0),!1}},i.process=function process(t){var i=this[t.cmd+"Handler"],u=this.handler&&this.handler[t.cmd+"Handler"];if("function"==typeof i||"function"==typeof u){if(t.error)return this.logger.error(t.cmd+"::recvError",t.error),pa.reject(t.error);try{var _=i?i.call(this,t):u.call(this.handler,t);return pa.resolve(_)}catch(t){return pa.reject(t)}}var h=get(t,"error.detail.ignore");return t.error&&!h?pa.reject(t.error):pa.resolve(t)},V2Service}(ql),z_={attachment:{type:"object",rules:{url:{type:"string",allowEmpty:!1}}},thumbSize:{type:"object",rules:{width:{type:"number",required:!1,min:0},height:{type:"number",required:!1,min:0}}}},$_=function(t){function V2NIMStorageUtil(i){var u;return(u=t.call(this,"V2NIMStorageUtil",i)||this).core=i,u}bt(V2NIMStorageUtil,t);var i=V2NIMStorageUtil.prototype;return i.imageThumbUrl=function imageThumbUrl(t,i){return t+"?imageView&thumbnail="+i+"z"+i},i.videoCoverUrl=function videoCoverUrl(t,i){return t+"?vframe&offset="+i},i.getImageThumbUrl=function getImageThumbUrl(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var u,_;return Ra.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkV2(),validate(z_,{attachment:u=t,thumbSize:i},"",!0),i.width=i.width||0,i.height=i.height||0,0===i.width&&0===i.height&&(i.width=150),_=u.url,h.prev=7,h.next=10,this.core.V2NIMStorageService.shortUrlToLong(u.url);case 10:_=h.sent,h.next=16;break;case 13:h.prev=13,h.t0=h.catch(7),this.core.logger.warn("shortUrlToLong error:",h.t0);case 16:return h.abrupt("return",{url:this.core.cloudStorage.getThumbUrl(_,i)});case 17:case"end":return h.stop()}}),_callee,this,[[7,13]])})))},i.getVideoCoverUrl=function getVideoCoverUrl(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){var u,_;return Ra.wrap((function _callee2$(h){for(;;)switch(h.prev=h.next){case 0:return this.checkV2(),validate(z_,{attachment:u=t,thumbSize:i},"",!0),i.width=i.width||0,i.height=i.height||0,0===i.width&&0===i.height&&(i.width=150),_=u.url,h.prev=7,h.next=10,this.core.V2NIMStorageService.shortUrlToLong(u.url);case 10:_=h.sent,h.next=16;break;case 13:h.prev=13,h.t0=h.catch(7),this.core.logger.warn("shortUrlToLong error:",h.t0);case 16:return h.abrupt("return",{url:this.core.cloudStorage.getVideoCoverUrl(_,i)});case 17:case"end":return h.stop()}}),_callee2,this,[[7,13]])})))},V2NIMStorageUtil}(W_);var X_=function(t){function V2NIMStorageServiceImpl(i){var u;return(u=t.call(this,"V2NIMStorageService",i)||this).sceneMap={nim_default_profile_icon:{sceneName:"nim_default_profile_icon",expireTime:0},nim_default_im:{sceneName:"nim_default_im",expireTime:0},nim_system_nos_scene:{sceneName:"nim_system_nos_scene",expireTime:0},nim_security:{sceneName:"nim_security",expireTime:0}},u.uploadingMessageInfo={},u.core=i,u.core._registerDep(q_,"cloudStorage"),u.core._registerDep($_,"V2NIMStorageUtil"),u}bt(V2NIMStorageServiceImpl,t);var i=V2NIMStorageServiceImpl.prototype;return i.addCustomStorageScene=function addCustomStorageScene(t,i){return this.checkV2(),validate({sceneName:{type:"string",allowEmpty:!1},expireTime:{type:"number",min:0}},{sceneName:t,expireTime:i},"",!0),this.sceneMap[t]={sceneName:t,expireTime:i},{sceneName:t,expireTime:i}},i.getStorageSceneList=function getStorageSceneList(){return this.checkV2(),Pa(this.sceneMap)},i.getStorageScene=function getStorageScene(t){return t&&this.sceneMap[t]||this.sceneMap.nim_default_im},i.hasStorageScene=function hasStorageScene(t){return void 0!==this.sceneMap[t]},i.createUploadFileTask=function createUploadFileTask(t){var i;if(this.checkV2(),"string"==typeof t.fileObj&&0===indexOf(i=t.fileObj).call(i,"nim-external")){var u=document.getElementById(t.fileObj);u&&u.files&&u.files[0]&&(t.fileObj=u.files[0])}return{taskId:od(),uploadParams:t}},i.uploadFile=function uploadFile(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var u;return Ra.wrap((function _callee$(_){for(;;)switch(_.prev=_.next){case 0:return this.checkV2(),validate({taskId:{type:"string",allowEmpty:!1}},t,"fileTask",!0),_.next=4,this._uploadFile(t,i);case 4:return u=_.sent,_.abrupt("return",u[0]);case 6:case"end":return _.stop()}}),_callee,this)})))},i.uploadFileWithMetaInfo=function uploadFileWithMetaInfo(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){var u;return Ra.wrap((function _callee2$(_){for(;;)switch(_.prev=_.next){case 0:return this.checkV2(),validate({taskId:{type:"string",allowEmpty:!1}},t,"fileTask",!0),_.next=4,this._uploadFile(t,i);case 4:return u=_.sent,_.abrupt("return",(h=u[1],E=void 0,m=void 0,I=void 0,v=void 0,T=void 0,N=void 0,M=void 0,O=void 0,S=void 0,R=void 0,A=void 0,C=void 0,E=h.url,m=h.name,I=h.size,v=h.ext,T=h.md5,N=h.h,M=h.w,O=h.orientation,S=h.dur,R=h.audioCodec,A=h.videoCodec,C=h.container,JSON.parse(Ua({url:E,name:m,size:I,ext:v,md5:T,height:N,width:M,orientation:O,duration:S,audioCodec:R,videoCodec:A,container:C}))));case 6:case"end":return _.stop()}var h,E,m,I,v,T,N,M,O,S,R,A,C}),_callee2,this)})))},i._uploadFile=function _uploadFile(t,i,u){var _;return __awaiter(this,void 0,void 0,Ra.mark((function _callee3(){var h,E,m,I,v,T,N,M,O,S,R=this;return Ra.wrap((function _callee3$(A){for(;;)switch(A.prev=A.next){case 0:if(this.core.cloudStorage&&this.core.cloudStorage.uploadFile){A.next=2;break}throw new Error('Service "cloudStorage" does not exist');case 2:if(h=t.uploadParams,E=t.taskId,m=getFileOrPath(h.fileObj),I=m.file,v=m.path,T=(u||{}).fileType,!this.uploadingMessageInfo[E]){A.next=7;break}throw new bl({code:Al.V2NIM_ERROR_CODE_RESOURCE_ALREADY_EXIST,detail:{reason:"V2NIMStorageService.uploadFile: repeat upload"}});case 7:if(A.prev=7,N={},I?N.file=I:v&&(0===(null==v?void 0:indexOf(v).call(v,"nim-external"))?N.fileInput=v:N.filePath=v),M=this.getStorageScene(h.sceneName),N.nosScenes=M.sceneName,N.nosSurvivalTime=M.expireTime,N.type=1===T?"image":2===T?"audio":3===T?"video":"file",!N.file||!this.core.pluginMap["browser-md5-file"]){A.next=19;break}return A.next=17,this.getFileMd5(this.core.pluginMap["browser-md5-file"],E,N.file);case 17:O=A.sent,N.md5=O;case 19:return N.onUploadProgress=function(t){"function"==typeof i&&i(Math.round(100*t.percentage))},N.onUploadStart=function(t){var i;if(null===(i=R.uploadingMessageInfo[E])||void 0===i?void 0:i.abort)return t.abort(),void delete R.uploadingMessageInfo[E];R.uploadingMessageInfo[E]={abort:!1,task:t}},this.uploadingMessageInfo[E]={abort:!1},A.next=24,this.core.cloudStorage.uploadFile(N);case 24:if(S=A.sent,!(null===(_=this.uploadingMessageInfo[E])||void 0===_?void 0:_.abort)){A.next=27;break}throw new bl({code:Al.V2NIM_ERROR_CODE_CANCELLED,detail:{reason:"upload file aborted"}});case 27:return delete this.uploadingMessageInfo[E],A.abrupt("return",[S.url,S]);case 31:throw A.prev=31,A.t0=A.catch(7),delete this.uploadingMessageInfo[E],this.core.logger.error("sendFile:: upload File error or abort.",A.t0),A.t0;case 36:case"end":return A.stop()}}),_callee3,this,[[7,31]])})))},i.cancelUploadFile=function cancelUploadFile(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee4(){return Ra.wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:return this.checkV2(),i.next=3,this._cancelUploadFile(t.taskId);case 3:case"end":return i.stop()}}),_callee4,this)})))},i._cancelUploadFile=function _cancelUploadFile(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee5(){var i;return Ra.wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:if(this.checkV2(),!(null==(i=this.uploadingMessageInfo[t])?void 0:i.task)){u.next=16;break}return u.prev=3,this.logger.log("V2NIMStorageService.cancelUploadFile: uploadInfo task exist"),u.next=7,i.task.abort();case 7:delete this.uploadingMessageInfo[t],u.next=14;break;case 10:u.prev=10,u.t0=u.catch(3),delete this.uploadingMessageInfo[t],this.core.logger.error("cancelMessageAttachmentUpload::abort error.",u.t0);case 14:u.next=22;break;case 16:if(!i){u.next=21;break}this.logger.log("V2NIMStorageService.cancelUploadFile: uploadInfo task not exist"),i.abort=!0,u.next=22;break;case 21:throw new bl({code:Al.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST,detail:{reason:"V2NIMStorageService.cancelUploadFile: uploadInfo not exist"}});case 22:case"end":return u.stop()}}),_callee5,this,[[3,10]])})))},i.getFileMd5=function getFileMd5(t,i,u){return __awaiter(this,void 0,void 0,Ra.mark((function _callee6(){var _=this;return Ra.wrap((function _callee6$(h){for(;;)switch(h.prev=h.next){case 0:return h.abrupt("return",new pa((function(h,E){var m,I=new t;(null===(m=_.uploadingMessageInfo[i])||void 0===m?void 0:m.abort)?E(new bl({code:Al.V2NIM_ERROR_CODE_CANCELLED,detail:{reason:"upload file aborted"}})):_.uploadingMessageInfo[i]={abort:!1,task:I};try{I.md5(u,(function(t,i){"aborted"===t?E(new bl({code:Al.V2NIM_ERROR_CODE_CANCELLED,detail:{reason:t}})):t?E(new bl({code:Al.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"md5 calculate error in callback",rawError:t}})):h(i)}))}catch(t){E(new bl({code:Al.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"md5 calculate error",rawError:t}}))}})));case 1:case"end":return h.stop()}}),_callee6)})))},i.shortUrlToLong=function shortUrlToLong(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee7(){return Ra.wrap((function _callee7$(i){for(;;)switch(i.prev=i.next){case 0:return this.checkV2(),i.abrupt("return",this.core.cloudStorage.getOriginUrl(t));case 2:case"end":return i.stop()}}),_callee7,this)})))},i.getImageThumbUrl=function getImageThumbUrl(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee8(){return Ra.wrap((function _callee8$(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",this.core.V2NIMStorageUtil.getImageThumbUrl(t,i));case 1:case"end":return u.stop()}}),_callee8,this)})))},i.getVideoCoverUrl=function getVideoCoverUrl(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee9(){return Ra.wrap((function _callee9$(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",this.core.V2NIMStorageUtil.getVideoCoverUrl(t,i));case 1:case"end":return u.stop()}}),_callee9,this)})))},V2NIMStorageServiceImpl}(W_),J_=function(){function FileUtil(t,i){this.core=t,this.service=i}var t=FileUtil.prototype;return t.doSendFile=function doSendFile(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var u,_,h,E,m,I,v,T;return Ra.wrap((function _callee$(N){for(;;)switch(N.prev=N.next){case 0:return u=t.attachment,N.prev=1,N.next=4,this.core.V2NIMStorageService._uploadFile({taskId:t.messageClientId,uploadParams:{fileObj:(null==u?void 0:u.file)||(null==u?void 0:u.path),sceneName:null==u?void 0:u.sceneName}},i,{fileType:t.messageType});case 4:for(v in(h=N.sent)[0],E=h[1],m=La(La({},u),{uploadState:1}),E.w&&(m.width=m.width||E.w),E.h&&(m.height=m.height||E.h),E.dur&&(m.duration=m.duration||E.dur),m.ext=m.ext&&-1===indexOf(_=m.ext).call(_,".")?"."+m.ext:m.ext,I=["w","h","dur","ext","name"],E)includes(I).call(I,v)||(m[v]=E[v]);m.raw,m.file,m.path,T=__rest(m,["raw","file","path"]),t.attachment=JSON.parse(Ua(T)),t.attachment&&(t.attachment.raw=attachmentToRaw(t.messageType,t.attachment)),N.next=23;break;case 19:throw N.prev=19,N.t0=N.catch(1),t.attachment&&(t.attachment.uploadState=2),N.t0;case 23:case"end":return N.stop()}}),_callee,this,[[1,19]])})))},t.cancelMessageAttachmentUpload=function cancelMessageAttachmentUpload(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){var i;return Ra.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:if(validate({messageClientId:{type:"string",allowEmpty:!1}},t,"",!0),includes(i=[2,6,1,3]).call(i,t.messageType)){u.next=3;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"cancelMessageAttachmentUpload: messageType "+t.messageType+" incorrect"}});case 3:if(2!==t.sendingState&&1!==t.sendingState){u.next=5;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_RESOURCE_NOT_EXIST,detail:{reason:"cancelMessageAttachmentUpload: message is already failed or succeeded"}});case 5:return u.next=7,this.core.V2NIMStorageService._cancelUploadFile(t.messageClientId);case 7:case"end":return u.stop()}}),_callee2,this)})))},FileUtil}(),Q_=function(){function SendUtil(t,i){this.msgs=[],this.maxIdCount=100,this.core=t,this.service=i}var t=SendUtil.prototype;return t.reset=function reset(){this.msgs=[]},t.prepareMessage=function prepareMessage(t,i){void 0===i&&(i={});var u=this.checkIfResend(t),_=this.generateSendMessage({message:t,params:i,resend:u}),h=this.checkIfAntispam(i,_),E=h.clientAntispamResult,m=h.text;return _.text=m,_.clientAntispamHit=!!E&&3===E.operateType,{messageBeforeSend:_,clientAntispamResult:E}},t.doSendMessage=function doSendMessage(t,i,u,_){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var h,E,m,I,v;return Ra.wrap((function _callee$(T){for(;;)switch(T.prev=T.next){case 0:if(h={enabled:!1},!i.attachment||"object"!=typeof i.attachment||!("uploadState"in i.attachment)||i.attachment.url||0!==i.attachment.uploadState&&2!==i.attachment.uploadState){T.next=26;break}return E=Ka(),T.prev=3,i.attachmentUploadState=3,i.attachment.uploadState=3,this.core.V2NIMChatroomService.emit("onSendMessage",i),T.next=9,this.service.fileUtil.doSendFile(i,_);case 9:i.attachmentUploadState=1,i.attachment.uploadState=1,this.core.V2NIMChatroomService.emit("onSendMessage",i),T.next=23;break;case 14:throw T.prev=14,T.t0=T.catch(3),i.attachmentUploadState=2,i.attachment.uploadState=2,i.sendingState=2,this.core.V2NIMChatroomService.emit("onSendMessage",i),h.attachUploadDuration=Ka()-E,this.doMsgSendReport(t,h,i,T.t0),T.t0;case 23:h.attachUploadDuration=Ka()-E,T.next=27;break;case 26:this.core.V2NIMChatroomService.emit("onSendMessage",i);case 27:return this.cacheMsg(i),this.core.timeOrigin.checkNodeReliable(t)&&(h.apiCallingTime=this.core.timeOrigin.getNTPTime(t),h.sendTime=this.core.timeOrigin.getNTPTime(),i.__clientExt={statistics:h}),T.prev=29,T.next=32,this.core.clientSocket.sendCmd("v2ChatroomSendMessage",{tag:i});case 32:m=T.sent,T.next=41;break;case 35:throw T.prev=35,T.t1=T.catch(29),i.sendingState=2,this.core.V2NIMChatroomService.emit("onSendMessage",i),this.doMsgSendReport(t,h,i,T.t1),T.t1;case 41:return I=formatMessage(this.core,La(La(La({},i),m.content.data),{sendingState:1}),this.core.account),this.doMsgSendReport(t,h,I),v=I.antispamResult,delete I.antispamResult,delete I.__clientExt,this.core.V2NIMChatroomService.emit("onSendMessage",I),T.abrupt("return",La(La({message:I},v?{antispamResult:v}:{}),u?{clientAntispamResult:u}:{}));case 48:case"end":return T.stop()}}),_callee,this,[[3,14],[29,35]])})))},t.doMsgSendReport=function doMsgSendReport(t,i,u,_){i.apiCallingTime=this.core.timeOrigin.getNTPTime(t),i.sendTime=this.core.timeOrigin.getNTPTime();var h=this.core.timeOrigin.getNTPTime(),E=get(_,"detail.reason");this.core.reporter.report("msgSend",{clientId:u.messageClientId,msgTime:u.createTime,fromAccid:u.senderId,type:4,roomId:u.roomId,result:_?_.code:200,failReason:E||(null==_?void 0:_.message)||"",rt:h-i.apiCallingTime,apiCallingTime:i.apiCallingTime,sendTime:i.sendTime,attachUploadDuration:i.attachUploadDuration,apiCallbackTime:h})},t.doMsgReceiveReport=function doMsgReceiveReport(t,i){if(t.senderId!==this.core.account){var u=get(t,"__clientExt.statistics.apiCallingTime")||0,_=get(t,"__clientExt.statistics.sendTime")||0,h=get(t,"__clientExt.statistics.attachUploadDuration")||0,E=this.core.timeOrigin.getNTPTime(),m=t.createTime,I=this.core.timeOrigin.checkNodeReliable(i.__receiveTimeNode)?this.core.timeOrigin.getNTPTime(i.__receiveTimeNode):E;this.core.reporter.report("msgReceive",{clientId:t.messageClientId,receiveTime:I,serverTime:m,apiCallingTime:u,sendTime:_,attachUploadDuration:h,callbackTime:E,preHandleTime:E,fromAccid:t.senderId,type:4,roomId:t.roomId,result:200,failReason:"",rt:E-m})}},t.cacheMsg=function cacheMsg(t){this.msgs.push({messageClientId:t.messageClientId,senderId:t.senderId}),this.msgs.length>this.maxIdCount&&this.msgs.shift()},t.checkIfResend=function checkIfResend(t){var i;return some(i=this.msgs).call(i,(function(i){return i.messageClientId===t.messageClientId}))},t.generateSendMessage=function generateSendMessage(t){var i,u,_,h=t.message,E=t.params,m=t.resend,I={};(h.locationInfo||E.locationInfo)&&(I.x=(null===(i=h.locationInfo||E.locationInfo)||void 0===i?void 0:i.x)||0,I.y=(null===(u=h.locationInfo||E.locationInfo)||void 0===u?void 0:u.y)||0,I.z=(null===(_=h.locationInfo||E.locationInfo)||void 0===_?void 0:_.z)||0);var v=La(La(La(La(La({},h),E),{messageConfig:La(La({},h.messageConfig),E.messageConfig),routeConfig:La(La({},h.routeConfig),E.routeConfig),antispamConfig:La(La({},h.antispamConfig),E.antispamConfig)}),h.attachment?{attachment:La({},h.attachment)}:{}),{locationInfo:I,resend:m,sendingState:3});return 0!==v.messageType&&10!==v.messageType||(v.attachment=v.text),v},t.checkIfAntispam=function checkIfAntispam(t,i){var u,_=i.text;if(t.clientAntispamEnabled&&100!==i.messageType&&i.text)if(1===(u=this.core.V2NIMClientAntispamUtil.checkTextAntispam(i.text||"",t.clientAntispamReplace)).operateType)_=u.replacedText;else if(2===u.operateType)throw this.core.V2NIMChatroomService.emit("onSendMessage",La(La({},i),{sendingState:2})),new bl({code:Wd.V2NIM_ERROR_CODE_CLIENT_ANTISPAM,detail:{reason:"sendMessage: text intercepted by client antispam"}});return{clientAntispamResult:u,text:_}},SendUtil}(),Z_=[2,7,12,100,6,1,-1,4,5,11,0,10,3],ep={message:{type:"object",rules:{messageClientId:{type:"string",allowEmpty:!1},senderId:{type:"string",allowEmpty:!1},roomId:{type:"string",allowEmpty:!1},text:{type:"string",required:!1},attachment:{type:"object",required:!1,rules:{file:{type:"file",required:!1}}}}}},tp={params:{type:"object",required:!1,rules:{messageConfig:{type:"object",required:!1,rules:{readReceiptEnabled:{type:"boolean",required:!1},lastMessageUpdateEnabled:{type:"boolean",required:!1},historyEnabled:{type:"boolean",required:!1},roamingEnabled:{type:"boolean",required:!1},onlineSyncEnabled:{type:"boolean",required:!1},offlineEnabled:{type:"boolean",required:!1},unreadEnabled:{type:"boolean",required:!1}}},routeConfig:{type:"object",required:!1,rules:{routeEnabled:{type:"boolean",required:!1},routeEnvironment:{type:"string",required:!1}}},antiSpamConfig:{type:"object",required:!1,rules:{antispamEnabled:{type:"boolean",required:!1},antispamBusinessId:{type:"string",required:!1},antispamCustomMessage:{type:"string",required:!1},antispamCheating:{type:"string",required:!1},antispamExtension:{type:"string",required:!1}}},receiverIds:{type:"array",required:!1},notifyTargetTags:{type:"string",required:!1},locationInfo:{type:"object",required:!1,rules:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}}},rp={sceneName:{type:"string",required:!1},name:{type:"string",required:!1}},np=La(La({},rp),{duration:{type:"number",required:!1}}),op=La(La({},np),{width:{type:"number",required:!1},height:{type:"number",required:!1}}),ip=La(La({},rp),{width:{type:"number",required:!1},height:{type:"number",required:!1}}),ap={option:{type:"object",rules:{direction:{type:"enum",values:[1,0],required:!1},messageTypes:{type:"array",required:!1,itemType:"enum",values:Z_},beginTime:{type:"number",min:0,required:!1},limit:{type:"number",min:1,required:!1}}}},sp={messageOption:{type:"object",rules:{tags:{type:"array",min:1,itemType:"string"},direction:{type:"enum",values:[1,0],required:!1},messageTypes:{type:"array",required:!1,itemType:"enum",values:Z_},beginTime:{type:"number",min:0,required:!1},endTime:{type:"number",min:0,required:!1},limit:{type:"number",min:1,required:!1}}}},cp="V2NIMChatroomMessageService",lp={"36_6":"v2ChatroomSendMessage","36_9":"v2ChatroomGetMessageList","36_35":"v2ChatroomMessageAck","36_36":"v2ChatroomGetMessageListByTag","13_7":"v2ChatroomOnMessage","29_17":"v2ChatroomDownloadLocalAntiSpamVocabs","6_23":"v2ChatroomGetServerTime","13_99":"v2ChatroomUpdateCDNInfo"},up={version:1,md5:2,nosurl:3,thesaurus:4},dp={messageClientId:1,messageType:{id:2,retType:"number"},attachment:{id:3,converter:function converter(t,i){return attachmentToRaw(i.messageType,t)},retConverter:function retConverter(t,i){return rawToAttachment(t,Number(i[2]))}},serverExtension:4,resend:{id:5,converter:boolToInt,retType:"boolean"},userInfoTimestamp:{id:6,access:"userInfoConfig.userInfoTimestamp",retType:"number"},senderNick:{id:7,access:"userInfoConfig.senderNick"},senderAvatar:{id:8,access:"userInfoConfig.senderAvatar"},senderExtension:{id:9,access:"userInfoConfig.senderExtension"},antispamCustomMessageEnabled:{id:10,def:function def(t){return get(t,"antispamConfig.antispamCustomMessage")?1:void 0},retConverter:function retConverter(){}},antispamCustomMessage:{id:11,access:"antispamConfig.antispamCustomMessage"},historyEnabled:{id:12,access:"messageConfig.historyEnabled",converter:function converter(t){return t?0:1},retConverter:function retConverter(t){return!au(t)}},text:13,antiSpamBusinessId:{id:14,access:"antispamConfig.antispamBusinessId"},clientAntispamHit:{id:15,access:"clientAntispamHit",converter:boolToInt,retType:"boolean"},antispamEnabled:{id:16,access:"antispamConfig.antispamEnabled",converter:boolToInt,retType:"boolean"},createTime:{id:20,retType:"number"},senderId:21,roomId:22,senderClientType:{id:23,retType:"number"},highPriority:{id:25,access:"messageConfig.highPriority",converter:boolToInt,retType:"boolean"},callbackExtension:27,subType:{id:28,retType:"number"},antispamCheating:{id:29,access:"antispamConfig.antispamCheating"},routeEnvironment:{id:30,access:"routeConfig.routeEnvironment"},notifyTargetTags:31,antispamExtension:{id:32,access:"antispamConfig.antispamExtension"},antispamResult:33,x:{id:34,access:"locationInfo.x",retType:"number"},y:{id:35,access:"locationInfo.y",retType:"number"},z:{id:36,access:"locationInfo.z",retType:"number"},receiverIds:{id:37,converter:objectToJSONString},__clientExt:{id:39,converter:objectToJSONString,retConverter:stringToJSONObject},routeEnabled:{id:100,access:"routeConfig.routeEnabled",converter:boolToInt,retType:"boolean",retDef:!0}},_p={v2ChatroomSendMessage:{sid:36,cid:6,service:cp,params:[{type:"Property",name:"tag",reflectMapper:dp}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(dp)}]},v2ChatroomOnMessage:{sid:13,cid:7,service:cp,response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(dp)}]},v2ChatroomGetMessageList:{sid:36,cid:9,service:cp,params:[{type:"Long",name:"beginTime"},{type:"Int",name:"limit"},{type:"Bool",name:"reverse"},{type:"LongArray",name:"messageTypes"}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(dp)}]},v2ChatroomMessageAck:{sid:36,cid:35,service:cp,params:[{type:"Property",name:"tag",reflectMapper:{messageClientId:1,roomId:2}}]},v2ChatroomGetMessageListByTag:{sid:36,cid:36,service:cp,params:[{type:"Property",name:"tag",reflectMapper:{tags:1,messageTypes:2,beginTime:3,endTime:4,limit:5,reverse:6}}],response:[{type:"PropertyArray",name:"datas",reflectMapper:invertSerializeItem(dp)}]},v2ChatroomDownloadLocalAntiSpamVocabs:{sid:29,cid:17,service:cp,params:[{type:"Property",name:"tag",reflectMapper:up}],response:[{type:"Property",name:"data",reflectMapper:invertSerializeItem(up)}]},v2ChatroomGetServerTime:{sid:6,cid:23,service:cp,response:[{type:"Long",name:"time"}]},v2ChatroomUpdateCDNInfo:{sid:13,cid:99,service:cp,response:[{type:"Property",name:"chatroomCdnInfo",reflectMapper:invertSerializeItem(Yd)}]}},pp=j.setInterval,hp=hp||function(t){var i;"undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),void 0!==Ha&&Ha.crypto&&(i=Ha.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&"undefined"!=typeof global&&global.crypto&&(i=global.crypto);var u=function cryptoSecureRandomInt(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},_=Et||function(){function F(){}return function(t){var i;return F.prototype=t,i=new F,F.prototype=null,i}}(),h={},E=h.lib={},m=E.Base={extend:function extend(t){var i=_(this);return t&&i.mixIn(t),i.hasOwnProperty("init")&&this.init!==i.init||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function create(){var t=this.extend();return t.init.apply(t,arguments),t},init:function init(){},mixIn:function mixIn(t){for(var i in t)t.hasOwnProperty(i)&&(this[i]=t[i]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function clone(){return this.init.prototype.extend(this)}},I=E.WordArray=m.extend({init:function init(t,i){t=this.words=t||[],this.sigBytes=null!=i?i:4*t.length},toString:function toString(t){return(t||T).stringify(this)},concat:function concat(t){var i=this.words,u=t.words,_=this.sigBytes,h=t.sigBytes;if(this.clamp(),_%4)for(var E=0;E<h;E++){var m=u[E>>>2]>>>24-E%4*8&255;i[_+E>>>2]|=m<<24-(_+E)%4*8}else for(var I=0;I<h;I+=4)i[_+I>>>2]=u[I>>>2];return this.sigBytes+=h,this},clamp:function clamp(){var i=this.words,u=this.sigBytes;i[u>>>2]&=4294967295<<32-u%4*8,i.length=t.ceil(u/4)},clone:function clone(){var t,clone=m.clone.call(this);return clone.words=slice(t=this.words).call(t,0),clone},random:function random(t){for(var i=[],_=0;_<t;_+=4)i.push(u());return new I.init(i,t)}}),v=h.enc={},T=v.Hex={stringify:function stringify(t){for(var i=t.words,u=t.sigBytes,_=[],h=0;h<u;h++){var E=i[h>>>2]>>>24-h%4*8&255;_.push((E>>>4).toString(16)),_.push((15&E).toString(16))}return _.join("")},parse:function parse(t){for(var i=t.length,u=[],_=0;_<i;_+=2)u[_>>>3]|=au(t.substr(_,2),16)<<24-_%8*4;return new I.init(u,i/2)}},N=v.Latin1={stringify:function stringify(t){for(var i=t.words,u=t.sigBytes,_=[],h=0;h<u;h++){var E=i[h>>>2]>>>24-h%4*8&255;_.push(String.fromCharCode(E))}return _.join("")},parse:function parse(t){for(var i=t.length,u=[],_=0;_<i;_++)u[_>>>2]|=(255&t.charCodeAt(_))<<24-_%4*8;return new I.init(u,i)}},M=v.Utf8={stringify:function stringify(t){try{return decodeURIComponent(escape(N.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function parse(t){return N.parse(unescape(encodeURIComponent(t)))}},O=E.BufferedBlockAlgorithm=m.extend({reset:function reset(){this._data=new I.init,this._nDataBytes=0},_append:function _append(t){var i;"string"==typeof t&&(t=M.parse(t)),concat(i=this._data).call(i,t),this._nDataBytes+=t.sigBytes},_process:function _process(i){var u,_=this._data,h=_.words,E=_.sigBytes,m=this.blockSize,v=E/(4*m),T=(v=i?t.ceil(v):t.max((0|v)-this._minBufferSize,0))*m,N=t.min(4*T,E);if(T){for(var M=0;M<T;M+=m)this._doProcessBlock(h,M);u=splice(h).call(h,0,T),_.sigBytes-=N}return new I.init(u,N)},clone:function clone(){var clone=m.clone.call(this);return clone._data=this._data.clone(),clone},_minBufferSize:0});E.Hasher=O.extend({cfg:m.extend(),init:function init(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function reset(){O.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(i,u){return new t.init(u).finalize(i)}},_createHmacHelper:function _createHmacHelper(t){return function(i,u){return new S.HMAC.init(t,u).finalize(i)}}});var S=h.algo={};return h}(Math),fp=hp,Ep=fp.lib,mp=Ep.Base,gp=Ep.WordArray,Ip=fp.algo,vp=Ip.MD5,Tp=Ip.EvpKDF=mp.extend({cfg:mp.extend({keySize:4,hasher:vp,iterations:1}),init:function init(t){this.cfg=this.cfg.extend(t)},compute:function compute(t,i){for(var u,_=this.cfg,h=_.hasher.create(),E=gp.create(),m=E.words,I=_.keySize,v=_.iterations;m.length<I;){u&&h.update(u),u=h.update(t).finalize(i),h.reset();for(var T=1;T<v;T++)u=h.finalize(u),h.reset();concat(E).call(E,u)}return E.sigBytes=4*I,E}});fp.EvpKDF=function(t,i,u){return Tp.create(u).compute(t,i)},hp.EvpKDF;var Np=hp,Mp=Np.lib.WordArray;Np.enc.Base64={stringify:function stringify(t){var i=t.words,u=t.sigBytes,_=this._map;t.clamp();for(var h=[],E=0;E<u;E+=3)for(var m=(i[E>>>2]>>>24-E%4*8&255)<<16|(i[E+1>>>2]>>>24-(E+1)%4*8&255)<<8|i[E+2>>>2]>>>24-(E+2)%4*8&255,I=0;I<4&&E+.75*I<u;I++)h.push(_.charAt(m>>>6*(3-I)&63));var v=_.charAt(64);if(v)for(;h.length%4;)h.push(v);return h.join("")},parse:function parse(t){var i=t.length,u=this._map,_=this._reverseMap;if(!_){_=this._reverseMap=[];for(var h=0;h<u.length;h++)_[u.charCodeAt(h)]=h}var E=u.charAt(64);if(E){var m=indexOf(t).call(t,E);-1!==m&&(i=m)}return function parseLoop(t,i,u){for(var _=[],h=0,E=0;E<i;E++)if(E%4){var m=u[t.charCodeAt(E-1)]<<E%4*2|u[t.charCodeAt(E)]>>>6-E%4*2;_[h>>>2]|=m<<24-h%4*8,h++}return Mp.create(_,h)}(t,i,_)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};var Op=hp.enc.Base64;!function(t){t.lib.Cipher||function(){var i=t,u=i.lib,_=u.Base,h=u.WordArray,E=u.BufferedBlockAlgorithm,m=i.enc;m.Utf8;var I=m.Base64,v=i.algo.EvpKDF,T=u.Cipher=E.extend({cfg:_.extend(),createEncryptor:function createEncryptor(t,i){return this.create(this._ENC_XFORM_MODE,t,i)},createDecryptor:function createDecryptor(t,i){return this.create(this._DEC_XFORM_MODE,t,i)},init:function init(t,i,u){this.cfg=this.cfg.extend(u),this._xformMode=t,this._key=i,this.reset()},reset:function reset(){E.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?k:C}return function(t){return{encrypt:function encrypt(i,u,_){return selectCipherStrategy(u).encrypt(t,i,u,_)},decrypt:function decrypt(i,u,_){return selectCipherStrategy(u).decrypt(t,i,u,_)}}}}()});u.StreamCipher=T.extend({_doFinalize:function _doFinalize(){return this._process(!0)},blockSize:1});var N=i.mode={},M=u.BlockCipherMode=_.extend({createEncryptor:function createEncryptor(t,i){return this.Encryptor.create(t,i)},createDecryptor:function createDecryptor(t,i){return this.Decryptor.create(t,i)},init:function init(t,i){this._cipher=t,this._iv=i}}),O=N.CBC=function(){var t=M.extend();function xorBlock(t,i,u){var _,h=this._iv;h?(_=h,this._iv=void 0):_=this._prevBlock;for(var E=0;E<u;E++)t[i+E]^=_[E]}return t.Encryptor=t.extend({processBlock:function processBlock(t,i){var u=this._cipher,_=u.blockSize;xorBlock.call(this,t,i,_),u.encryptBlock(t,i),this._prevBlock=slice(t).call(t,i,i+_)}}),t.Decryptor=t.extend({processBlock:function processBlock(t,i){var u=this._cipher,_=u.blockSize,h=slice(t).call(t,i,i+_);u.decryptBlock(t,i),xorBlock.call(this,t,i,_),this._prevBlock=h}}),t}(),S=(i.pad={}).Pkcs7={pad:function pad(t,i){for(var u=4*i,_=u-t.sigBytes%u,E=_<<24|_<<16|_<<8|_,m=[],I=0;I<_;I+=4)m.push(E);var v=h.create(m,_);concat(t).call(t,v)},unpad:function unpad(t){var i=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=i}};u.BlockCipher=T.extend({cfg:T.cfg.extend({mode:O,padding:S}),reset:function reset(){var t;T.reset.call(this);var i=this.cfg,u=i.iv,_=i.mode;this._xformMode==this._ENC_XFORM_MODE?t=_.createEncryptor:(t=_.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,u&&u.words):(this._mode=t.call(_,this,u&&u.words),this._mode.__creator=t)},_doProcessBlock:function _doProcessBlock(t,i){this._mode.processBlock(t,i)},_doFinalize:function _doFinalize(){var t,i=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(i.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),i.unpad(t)),t},blockSize:4});var R=u.CipherParams=_.extend({init:function init(t){this.mixIn(t)},toString:function toString(t){return(t||this.formatter).stringify(this)}}),A=(i.format={}).OpenSSL={stringify:function stringify(t){var i,u,_,E=t.ciphertext,m=t.salt;m?i=concat(u=concat(_=h.create([1398893684,1701076831])).call(_,m)).call(u,E):i=E;return i.toString(I)},parse:function parse(t){var i,u=I.parse(t),_=u.words;return 1398893684==_[0]&&1701076831==_[1]&&(i=h.create(slice(_).call(_,2,4)),splice(_).call(_,0,4),u.sigBytes-=16),R.create({ciphertext:u,salt:i})}},C=u.SerializableCipher=_.extend({cfg:_.extend({format:A}),encrypt:function encrypt(t,i,u,_){_=this.cfg.extend(_);var h=t.createEncryptor(u,_),E=h.finalize(i),m=h.cfg;return R.create({ciphertext:E,key:u,iv:m.iv,algorithm:t,mode:m.mode,padding:m.padding,blockSize:t.blockSize,formatter:_.format})},decrypt:function decrypt(t,i,u,_){return _=this.cfg.extend(_),i=this._parse(i,_.format),t.createDecryptor(u,_).finalize(i.ciphertext)},_parse:function _parse(t,i){return"string"==typeof t?i.parse(t,this):t}}),L=(i.kdf={}).OpenSSL={execute:function execute(t,i,u,_){var E;_||(_=h.random(8));var m=v.create({keySize:i+u}).compute(t,_),I=h.create(slice(E=m.words).call(E,i),4*u);return m.sigBytes=4*i,R.create({key:m,iv:I,salt:_})}},k=u.PasswordBasedCipher=C.extend({cfg:C.cfg.extend({kdf:L}),encrypt:function encrypt(t,i,u,_){var h=(_=this.cfg.extend(_)).kdf.execute(u,t.keySize,t.ivSize);_.iv=h.iv;var E=C.encrypt.call(this,t,i,h.key,_);return E.mixIn(h),E},decrypt:function decrypt(t,i,u,_){_=this.cfg.extend(_),i=this._parse(i,_.format);var h=_.kdf.execute(u,t.keySize,t.ivSize,i.salt);return _.iv=h.iv,C.decrypt.call(this,t,i,h.key,_)}})}()}(hp);var Sp=hp,Rp=Sp.lib.BlockCipher,yp=Sp.algo,Ap=[],Cp=[],bp=[],Lp=[],kp=[],Dp=[],Vp=[],wp=[],Pp=[],xp=[];!function(){for(var t=[],i=0;i<256;i++)t[i]=i<128?i<<1:i<<1^283;var u=0,_=0;for(i=0;i<256;i++){var h=_^_<<1^_<<2^_<<3^_<<4;h=h>>>8^255&h^99,Ap[u]=h,Cp[h]=u;var E=t[u],m=t[E],I=t[m],v=257*t[h]^16843008*h;bp[u]=v<<24|v>>>8,Lp[u]=v<<16|v>>>16,kp[u]=v<<8|v>>>24,Dp[u]=v;v=16843009*I^65537*m^257*E^16843008*u;Vp[h]=v<<24|v>>>8,wp[h]=v<<16|v>>>16,Pp[h]=v<<8|v>>>24,xp[h]=v,u?(u=E^t[t[t[I^E]]],_^=t[t[_]]):u=_=1}}();var Up=[0,1,2,4,8,16,32,64,128,27,54],Fp=yp.AES=Rp.extend({_doReset:function _doReset(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,i=t.words,u=t.sigBytes/4,_=4*((this._nRounds=u+6)+1),h=this._keySchedule=[],E=0;E<_;E++)E<u?h[E]=i[E]:(v=h[E-1],E%u?u>6&&E%u==4&&(v=Ap[v>>>24]<<24|Ap[v>>>16&255]<<16|Ap[v>>>8&255]<<8|Ap[255&v]):(v=Ap[(v=v<<8|v>>>24)>>>24]<<24|Ap[v>>>16&255]<<16|Ap[v>>>8&255]<<8|Ap[255&v],v^=Up[E/u|0]<<24),h[E]=h[E-u]^v);for(var m=this._invKeySchedule=[],I=0;I<_;I++){E=_-I;if(I%4)var v=h[E];else v=h[E-4];m[I]=I<4||E<=4?v:Vp[Ap[v>>>24]]^wp[Ap[v>>>16&255]]^Pp[Ap[v>>>8&255]]^xp[Ap[255&v]]}}},encryptBlock:function encryptBlock(t,i){this._doCryptBlock(t,i,this._keySchedule,bp,Lp,kp,Dp,Ap)},decryptBlock:function decryptBlock(t,i){var u=t[i+1];t[i+1]=t[i+3],t[i+3]=u,this._doCryptBlock(t,i,this._invKeySchedule,Vp,wp,Pp,xp,Cp);u=t[i+1];t[i+1]=t[i+3],t[i+3]=u},_doCryptBlock:function _doCryptBlock(t,i,u,_,h,E,m,I){for(var v=this._nRounds,T=t[i]^u[0],N=t[i+1]^u[1],M=t[i+2]^u[2],O=t[i+3]^u[3],S=4,R=1;R<v;R++){var A=_[T>>>24]^h[N>>>16&255]^E[M>>>8&255]^m[255&O]^u[S++],C=_[N>>>24]^h[M>>>16&255]^E[O>>>8&255]^m[255&T]^u[S++],L=_[M>>>24]^h[O>>>16&255]^E[T>>>8&255]^m[255&N]^u[S++],k=_[O>>>24]^h[T>>>16&255]^E[N>>>8&255]^m[255&M]^u[S++];T=A,N=C,M=L,O=k}A=(I[T>>>24]<<24|I[N>>>16&255]<<16|I[M>>>8&255]<<8|I[255&O])^u[S++],C=(I[N>>>24]<<24|I[M>>>16&255]<<16|I[O>>>8&255]<<8|I[255&T])^u[S++],L=(I[M>>>24]<<24|I[O>>>16&255]<<16|I[T>>>8&255]<<8|I[255&N])^u[S++],k=(I[O>>>24]<<24|I[T>>>16&255]<<16|I[N>>>8&255]<<8|I[255&M])^u[S++];t[i]=A,t[i+1]=C,t[i+2]=L,t[i+3]=k},keySize:8});Sp.AES=Rp._createHelper(Fp);var Gp,Bp=hp.AES;hp.mode.ECB=((Gp=hp.lib.BlockCipherMode.extend()).Encryptor=Gp.extend({processBlock:function processBlock(t,i){this._cipher.encryptBlock(t,i)}}),Gp.Decryptor=Gp.extend({processBlock:function processBlock(t,i){this._cipher.decryptBlock(t,i)}}),Gp);var Hp=hp.mode.ECB,Yp=hp.enc.Utf8,jp=hp.pad.Pkcs7;var Kp={enabled:!1,cdnUrls:[],timestamp:Ka(),pollingIntervalSeconds:5,pollingTimeoutMillis:1e3},qp=invertSerializeItem(dp),Wp=function(){function CDNUtil(t,i){this.config=Kp,this.lastSuccessTimestamp=0,this.pollingTimer=0,this.msgBufferInterval=300,this.emitTimer=0,this.core=t,this.service=i,this.promiseManager=new xu}var t=CDNUtil.prototype;return t.reset=function reset(){this.config=Kp,this.lastSuccessTimestamp=0,this.pollingTimer&&clearInterval(this.pollingTimer),this.pollingTimer=0,this.emitTimer&&clearInterval(this.emitTimer),this.emitTimer=0},t.setOptions=function setOptions(t){this.config=La({},this.config,t),this.core.logger.log("CDNUtil::setOptions",this.config),this.polling()},t.polling=function polling(){var t;(this.pollingTimer&&clearInterval(this.pollingTimer),this.pollingTimer=0,this.config.enabled)&&(this.pollingTimer=pp(bind$1(t=this.fetchMsgs).call(t,this),1e3*this.config.pollingIntervalSeconds))},t.fetchMsgs=function fetchMsgs(t){return void 0===t&&(t=0),__awaiter(this,void 0,void 0,Ra.mark((function _callee(){var i,u,_,h,E,m;return Ra.wrap((function _callee$(I){for(;;)switch(I.prev=I.next){case 0:if((i=this.config.cdnUrls)&&i.length>0){I.next=3;break}return I.abrupt("return");case 3:if(u=i.shift()){I.next=6;break}return I.abrupt("return");case 6:if(this.config.cdnUrls.push(u),_=this.core.timeOrigin.getNTPTime(),_-=_%(1e3*this.config.pollingIntervalSeconds),this.lastSuccessTimestamp!==_){I.next=11;break}return I.abrupt("return");case 11:return u=u.replace("#time",""+_),h=this.config.pollingTimeoutMillis||1e3*this.config.pollingIntervalSeconds/2,this.core.logger.log("CDNUtil::fetchMsgs start:",u),E={},I.prev=15,I.next=18,this.promiseManager.add(this.core.adapters.request(u,{method:"GET",dataType:"json",timeout:h},{exception_service:8}));case 18:E=I.sent,I.next=31;break;case 21:if(I.prev=21,I.t0=I.catch(15),this.core.logger.warn("CDNUtil::fetchMsgs failed:",I.t0),(m=I.t0).code!==Wd.V2NIM_ERROR_CODE_CANCELLED){I.next=27;break}return I.abrupt("return");case 27:if(!(t>=3)){I.next=29;break}return I.abrupt("return");case 29:return 404===m.code&&this.core.timeOrigin.setOriginTimetick(),I.abrupt("return",this.fetchMsgs(t+1));case 31:this.requestSuccess(E,_);case 32:case"end":return I.stop()}}),_callee,this,[[15,21]])})))},t.requestSuccess=function requestSuccess(t,i){var u=this;if(this.lastSuccessTimestamp>i)return this.core.logger.warn("CDNUtil::fetchMsgs:ignore",this.lastSuccessTimestamp,i),void(this.lastSuccessTimestamp=0);this.lastSuccessTimestamp=i;var _=get(t,"data.data");if(_){if(t.data.ptm&&(this.config.pollingTimeoutMillis=t.data.ptm),t.data.pis){var h=this.config.pollingIntervalSeconds;this.config.pollingIntervalSeconds=t.data.pis,t.data.pis!==h&&this.polling()}var E=!0===t.data.e?this.decryptAES(_,this.config.decryptKey):_,m=this.formatMessages(E);m=function uniqBy(t,i){t=t||[],i=i||"";for(var u=[],_=[],h=0;h<t.length;h++){var E=t[h][i];-1===indexOf(_).call(_,E)&&(_.push(E),u.push(t[h]))}return u}(m,"messageClientId"),m=filter(m).call(m,(function(t){return!u.service.sendUtil.checkIfResend(t)&&(u.service.sendUtil.cacheMsg(t),!0)})),this.core.logger.log("CDNUtil::fetchMsgs success at "+i+", msg.length: "+m.length),this.emitSmoothly(m,1e3*t.data.c)}},t.decryptAES=function decryptAES(t,i){if(!t||!i)return"[]";try{return Bp.decrypt(t,Op.parse(i),{mode:Hp,padding:jp}).toString(Yp)}catch(t){var u=t;throw new bl({code:Wd.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"Decrypt AES failed",rawError:u}})}},t.formatMessages=function formatMessages(t){var i=this,u=[];try{u=JSON.parse(t)}catch(i){var _=i;throw new bl({code:Wd.V2NIM_ERROR_CODE_INTERNAL,detail:{reason:"JSON parse error",rawData:t,rawError:_}})}return map$7(u).call(u,(function(t){return formatMessage(i.core,deserialize(t,qp),i.core.account)}))},t.emitSmoothly=function emitSmoothly(t,i){var u=this;if(t&&t.length>0){var _=Math.ceil(i/this.msgBufferInterval),h=Math.ceil(t.length*this.msgBufferInterval/i);this.core.logger.log("CDNUtil::emitSmoothly total length: "+t.length+", group length: "+h+", times: "+_),this.emitTimer&&clearInterval(this.emitTimer),this.emitTimer=0,this.emitTimer=pp((function(){var i=splice(t).call(t,0,h);if(0===i.length)return u.emitTimer&&clearInterval(u.emitTimer),void(u.emitTimer=0);u.core.V2NIMChatroomService.emit("onReceiveMessages",i)}),this.msgBufferInterval)}},CDNUtil}(),zp=function(t){function V2NIMChatroomMessageServiceImpl(i){var u;return(u=t.call(this,"V2NIMChatroomMessageService",i)||this).customAttachmentParsers=[],registerParser({cmdMap:lp,cmdConfig:_p}),u.fileUtil=new J_(u.core,Xe(u)),u.sendUtil=new Q_(u.core,Xe(u)),u.cdnUtil=new Wp(u.core,Xe(u)),u.setListener(),u}bt(V2NIMChatroomMessageServiceImpl,t);var i=V2NIMChatroomMessageServiceImpl.prototype;return i.reset=function reset(t){this.sendUtil.reset(),this.cdnUtil.reset(),this.core.V2NIMClientAntispamUtil.reset(t)},i.setListener=function setListener(){var t=this;this.core.eventBus.on("V2NIMLoginService/loginLifeCycleLoginSucc",(function(){t.core.timeOrigin.setOriginTimetick()})),this.core.eventBus.on("V2NIMChatroomMessageService/onReceiveNotification",(function(i,u){16===get(i,"attachment.type")&&t.core.V2NIMChatroomService.emit("onMessageRevokedNotification",u.data.msgId,u.data.msgTime)}))},i.getMessageList=function getMessageList(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var i,u,_=this;return Ra.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:return validate(ap,{option:t},"",!0),h.next=3,this.core.clientSocket.sendCmd("v2ChatroomGetMessageList",La(La({beginTime:0,limit:100},t),{reverse:1===t.direction}));case 3:return i=h.sent,u=i.content.datas,map$7(u).call(u,(function(t){return formatMessage(_.core,t,_.core.account)})),h.abrupt("return",u);case 7:case"end":return h.stop()}}),_callee,this)})))},i.getMessageListByTag=function getMessageListByTag(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){var i,u,_=this;return Ra.wrap((function _callee2$(h){for(;;)switch(h.prev=h.next){case 0:if(validate(sp,{messageOption:t},"",!0),!("number"==typeof(null==t?void 0:t.beginTime)&&"number"==typeof(null==t?void 0:t.endTime)&&t.beginTime>t.endTime)){h.next=3;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"beginTime must be less than endTime"}});case 3:return h.next=5,this.core.clientSocket.sendCmd("v2ChatroomGetMessageListByTag",{tag:La(La({},t),{tags:Ua(t.tags),messageType:t.messageTypes?Ua(t.messageTypes):void 0,reverse:1===t.direction?0:1})});case 5:return i=h.sent,u=i.content.datas,map$7(u).call(u,(function(t){return formatMessage(_.core,t,_.core.account)})),h.abrupt("return",u);case 9:case"end":return h.stop()}}),_callee2,this)})))},i.sendMessage=function sendMessage(t,i,u){return void 0===i&&(i={}),__awaiter(this,void 0,void 0,Ra.mark((function _callee3(){var _,h,E,m,I;return Ra.wrap((function _callee3$(v){for(;;)switch(v.prev=v.next){case 0:if(validate(ep,{message:t},"",!0),validate(tp,{params:i},"",!0),t.senderId===this.core.account){v.next=4;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_MISUSE,detail:{reason:"message.senderId must be self"}});case 4:return _=this.core.timeOrigin.getTimeNode(),h=this.sendUtil.prepareMessage(t,i),E=h.messageBeforeSend,m=h.clientAntispamResult,v.next=8,this.sendUtil.doSendMessage(_,E,m,u);case 8:return I=v.sent,v.abrupt("return",I);case 10:case"end":return v.stop()}}),_callee3,this)})))},i.registerCustomAttachmentParser=function registerCustomAttachmentParser(t){var i;"function"==typeof t&&-1===indexOf(i=this.customAttachmentParsers).call(i,t)&&this.customAttachmentParsers.unshift(t)},i.unregisterCustomAttachmentParser=function unregisterCustomAttachmentParser(t){var i,u,_=indexOf(i=this.customAttachmentParsers).call(i,t);_>-1&&splice(u=this.customAttachmentParsers).call(u,_,1)},i.v2ChatroomMessageAck=function v2ChatroomMessageAck(t,i){this.core.clientSocket.sendCmd("v2ChatroomMessageAck",{tag:{messageClientId:t,roomId:i}})},i.v2ChatroomOnMessageHandler=function v2ChatroomOnMessageHandler(t){var i=t.content.data,u=i.attachment,_=formatMessage(this.core,i,this.core.account);this.sendUtil.checkIfResend(_)||(5===i.messageType?this.core.eventBus.emit("V2NIMChatroomMessageService/onReceiveNotification",_,u):this.sendUtil.cacheMsg(_),this.sendUtil.doMsgReceiveReport(_,t),delete _.__clientExt,this.core.V2NIMChatroomService.emit("onReceiveMessages",[_]))},i.v2ChatroomUpdateCDNInfoHandler=function v2ChatroomUpdateCDNInfoHandler(t){var i=t.content.chatroomCdnInfo;this.cdnUtil.setOptions(i)},V2NIMChatroomMessageServiceImpl}(T_),$p=function(){function V2NIMChatroomMessageCreatorImpl(t){this.name="V2NIMChatroomMessageCreator",this.defaultNosSceneName="nim_default_im",this.core=t}var t=V2NIMChatroomMessageCreatorImpl.prototype;return t.createMessage=function createMessage(t,i){return La(La(La({messageClientId:od(),createTime:this.core.timeOrigin.getNTPTime(),senderId:this.core.auth.getLoginUser(),roomId:this.core.auth.getRoomId(),isSelf:!0,sendingState:0,messageType:t,senderClientType:16},i),i.attachment?{attachment:La(La({},i.attachment),{raw:attachmentToRaw(t,i.attachment)})}:{}),{messageConfig:La({historyEnabled:!0,highPriority:!1},i.messageConfig),routeConfig:La({routeEnabled:!0},i.routeConfig),antispamConfig:La({antispamEnabled:!0},i.antispamConfig)})},t.createTextMessage=function createTextMessage(t){return validate({text:{type:"string",allowEmpty:!1}},{text:t},"",!0),this.createMessage(0,{text:t})},t.createImageMessage=function createImageMessage(t,i,u,_,h){validate(ip,{name:i,sceneName:u,width:_,height:h},"",!0);var E=this.createGenericFileMessageAttachment(t,i,u,void 0,_,h,"jpeg");return this.createMessage(1,{attachment:E,attachmentUploadState:0})},t.createAudioMessage=function createAudioMessage(t,i,u,_){validate(np,{name:i,sceneName:u,duration:_},"",!0);var h=this.createGenericFileMessageAttachment(t,i,u,_,void 0,void 0,"aac");return this.createMessage(2,{attachment:h,attachmentUploadState:0})},t.createVideoMessage=function createVideoMessage(t,i,u,_,h,E){validate(op,{name:i,sceneName:u,duration:_,width:h,height:E},"",!0);var m=this.createGenericFileMessageAttachment(t,i,u,_,h,E,"mp4");return this.createMessage(3,{attachment:m,attachmentUploadState:0})},t.createFileMessage=function createFileMessage(t,i,u){validate(rp,{name:i,sceneName:u},"",!0);var _=this.createGenericFileMessageAttachment(t,i,u,void 0,void 0,void 0,"txt");return this.createMessage(6,{attachment:_,attachmentUploadState:0})},t.createGenericFileMessageAttachment=function createGenericFileMessageAttachment(t,i,u,_,h,E,m){if(u=u||this.defaultNosSceneName,!this.core.V2NIMStorageService.hasStorageScene(u))throw new bl({code:Wd.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"sceneName: "+u+" has not been added"}});var I=getFileOrPath(t),v=I.file,T=I.path,N=La(La(La({name:i,uploadState:0,sceneName:u||this.defaultNosSceneName},_?{duration:_}:{}),h?{width:h}:{}),E?{height:E}:{});if(v){var M,O=lastIndexOf(M=v.name).call(M,"."),S=-1===O?v.name:v.name.substring(0,O);N.name=N.name||S,N.size=v.size,N.ext="."+(getFileExtension(v.name)||getFileExtension(i||"")||m)}else if(T){var R=lastIndexOf(T).call(T,"/"),A=lastIndexOf(T).call(T,"."),C=-1===A?T.substring(R+1):T.substring(R+1,A);N.name=N.name||C,N.ext="."+(getFileExtension(T)||getFileExtension(i||"")||m)}return N=JSON.parse(Ua(N)),T?N.path=T:v&&(N.file=v),N},t.createLocationMessage=function createLocationMessage(t,i,u){return validate({latitude:{type:"number",allowEmpty:!1},longitude:{type:"number",allowEmpty:!1},address:{type:"string",allowEmpty:!1}},{latitude:t,longitude:i,address:u},"",!0),this.createMessage(4,{attachment:{latitude:t,longitude:i,address:u}})},t.createCustomMessage=function createCustomMessage(t){return validate({rawAttachment:{type:"string"}},{rawAttachment:t},"",!0),this.createMessage(100,{attachment:{raw:t}})},t.createCustomMessageWithAttachment=function createCustomMessageWithAttachment(t,i){return validate({raw:{type:"string"}},t,"attachment",!0),validate({subType:{type:"number",min:0,required:!1}},{subType:i},"",!0),this.createMessage(100,i?{attachment:t,subType:i}:{attachment:t})},t.createForwardMessage=function createForwardMessage(t){var i=[11,5,7,10];if(includes(i).call(i,t.messageType))return null;var u={messageClientId:od(),messageType:t.messageType};return t.text&&(u.text=t.text),t.attachment&&(u.attachment=t.attachment),t.attachment&&"uploadState"in t.attachment&&(u.attachmentUploadState=t.attachment.uploadState),this.createMessage(t.messageType,u)},t.createTipsMessage=function createTipsMessage(t){return validate({text:{type:"string",allowEmpty:!1}},{text:t},"",!0),this.createMessage(10,{text:t})},V2NIMChatroomMessageCreatorImpl}(),Xp={option:{type:"object",rules:{memberRoles:{type:"array",itemType:"enum",values:[4,1,2,0,3,5],required:!1},onlyBlocked:{type:"boolean",required:!1},onlyChatBanned:{type:"boolean",required:!1},onlyOnline:{type:"boolean",required:!1},pageToken:{type:"string",required:!1},limit:{type:"number",min:1,required:!1}}}},Jp={accountId:{type:"string",allowEmpty:!1},updateParams:{type:"object",rules:{memberRole:{type:"enum",values:[2,0,3]},memberLevel:{type:"number",min:0,required:!1},notificationExtension:{type:"string",required:!1}}}},Qp={accountId:{type:"string",allowEmpty:!1},blocked:{type:"boolean"},notificationExtension:{type:"string",required:!1}},Zp={accountId:{type:"string",allowEmpty:!1},chatBanned:{type:"boolean"},notificationExtension:{type:"string",required:!1}},eh={updateParams:{type:"object",rules:{roomNick:{type:"string",allowEmpty:!1,required:!1},roomAvatar:{type:"string",required:!1},serverExtension:{type:"string",required:!1},notificationEnabled:{type:"boolean",required:!1},notificationExtension:{type:"string",required:!1},persistence:{type:"boolean",required:!1}}},antispamConfig:{type:"object",required:!1,rules:{antispamBusinessId:{type:"string",required:!1}}}},th={accountId:{type:"string",allowEmpty:!1},tempChatBannedDuration:{type:"number",min:0},notificationEnabled:{type:"boolean"},notificationExtension:{type:"string",required:!1}},rh={option:{type:"object",rules:{tag:{type:"string",allowEmpty:!1},pageToken:{type:"string",required:!1},limit:{type:"number",min:1,required:!1}}}},nh=function(t){function V2NIMChatroomMemberServiceImpl(i){var u;return u=t.call(this,"V2NIMChatroomMemberService",i)||this,registerParser({cmdMap:Pd,cmdConfig:Fd}),u}bt(V2NIMChatroomMemberServiceImpl,t);var i=V2NIMChatroomMemberServiceImpl.prototype;return i.getMemberListByOption=function getMemberListByOption(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var i;return Ra.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return validate(Xp,{option:t},"",!0),u.next=3,this.core.clientSocket.sendCmd("v2ChatroomGetMemberListByOption",{tag:t});case 3:return i=u.sent,u.abrupt("return",{finished:!i.content.hasMore,pageToken:i.content.pageToken,memberList:i.content.datas});case 5:case"end":return u.stop()}}),_callee,this)})))},i.updateMemberRole=function updateMemberRole(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){return Ra.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return validate(Jp,{accountId:t,updateParams:i},"",!0),u.next=3,this.core.sendCmd("v2ChatroomUpdateMemberRole",{tag:La(La({notificationExtension:""},i),{accountId:t})});case 3:case"end":return u.stop()}}),_callee2,this)})))},i.setMemberBlockedStatus=function setMemberBlockedStatus(t,i,u){return __awaiter(this,void 0,void 0,Ra.mark((function _callee3(){var _;return Ra.wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:return(_={accountId:t,blocked:i,notificationExtension:u}).notificationExtension=_.notificationExtension||"",validate(Qp,_,"",!0),h.next=5,this.core.sendCmd("v2ChatroomSetMemberBlockedStatus",_);case 5:case"end":return h.stop()}}),_callee3,this)})))},i.setMemberChatBannedStatus=function setMemberChatBannedStatus(t,i,u){return __awaiter(this,void 0,void 0,Ra.mark((function _callee4(){var _;return Ra.wrap((function _callee4$(h){for(;;)switch(h.prev=h.next){case 0:return(_={accountId:t,chatBanned:i,notificationExtension:u}).notificationExtension=_.notificationExtension||"",validate(Zp,_,"",!0),h.next=5,this.core.sendCmd("v2ChatroomSetMemberChatBannedStatus",_);case 5:case"end":return h.stop()}}),_callee4,this)})))},i.setMemberTempChatBanned=function setMemberTempChatBanned(t,i,u,_){return __awaiter(this,void 0,void 0,Ra.mark((function _callee5(){var h;return Ra.wrap((function _callee5$(E){for(;;)switch(E.prev=E.next){case 0:return validate(th,h={accountId:t,tempChatBannedDuration:i,notificationEnabled:u,notificationExtension:_},"",!0),h.notificationExtension=h.notificationExtension||"",E.next=5,this.core.sendCmd("v2ChatroomSetMemberTempChatBanned",h);case 5:case"end":return E.stop()}}),_callee5,this)})))},i.updateSelfMemberInfo=function updateSelfMemberInfo(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee6(){return Ra.wrap((function _callee6$(u){for(;;)switch(u.prev=u.next){case 0:if(validate(eh,{updateParams:t,antispamConfig:i},"",!0),void 0!==t.roomAvatar||void 0!==t.roomNick||void 0!==t.serverExtension){u.next=3;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"updateSelfMemberInfo: nothing to update"}});case 3:return u.next=5,this.core.clientSocket.sendCmd("v2ChatroomUpdateSelfMemberInfo",{tag:t,notificationEnabled:"boolean"!=typeof t.notificationEnabled||t.notificationEnabled,notificationExtension:t.notificationExtension||"",persistence:"boolean"==typeof t.persistence&&t.persistence,antispamConfig:i});case 5:case"end":return u.stop()}}),_callee6,this)})))},i.getMemberByIds=function getMemberByIds(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee7(){var i;return Ra.wrap((function _callee7$(u){for(;;)switch(u.prev=u.next){case 0:return validate({accountIds:{type:"array",itemType:"string",min:1}},{accountIds:t},"",!0),u.next=3,this.core.clientSocket.sendCmd("v2ChatroomGetMemberByIds",{accountIds:t});case 3:return i=u.sent,u.abrupt("return",i.content.datas);case 5:case"end":return u.stop()}}),_callee7,this)})))},i.kickMember=function kickMember(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee8(){return Ra.wrap((function _callee8$(u){for(;;)switch(u.prev=u.next){case 0:return validate({accountId:{type:"string",allowEmpty:!1}},{accountId:t},"",!0),validate({notificationExtension:{type:"string",required:!1}},{notificationExtension:i},"",!0),u.next=4,this.core.clientSocket.sendCmd("v2ChatroomKickMember",{accountId:t,notificationExtension:i});case 4:case"end":return u.stop()}}),_callee8,this)})))},i.getMemberListByTag=function getMemberListByTag(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee9(){var i;return Ra.wrap((function _callee9$(u){for(;;)switch(u.prev=u.next){case 0:return validate(rh,{option:t},"",!0),u.next=3,this.core.clientSocket.sendCmd("v2ChatroomGetMemberListByTag",{tag:La({limit:100},t)});case 3:return i=u.sent,u.abrupt("return",{finished:!i.content.hasMore,pageToken:i.content.pageToken,memberList:i.content.datas});case 5:case"end":return u.stop()}}),_callee9,this)})))},i.getMemberCountByTag=function getMemberCountByTag(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee10(){var i;return Ra.wrap((function _callee10$(u){for(;;)switch(u.prev=u.next){case 0:return validate({tag:{type:"string",allowEmpty:!1}},{tag:t},"",!0),u.next=3,this.core.clientSocket.sendCmd("v2ChatroomGetMemberCountByTag",{tag:t});case 3:return i=u.sent,u.abrupt("return",i.content.data);case 5:case"end":return u.stop()}}),_callee10,this)})))},i.v2ChatroomOnMemberTagUpdatedHandler=function v2ChatroomOnMemberTagUpdatedHandler(t){var i;if(null===(i=t.content.data)||void 0===i?void 0:i.tag){var u=JSON.parse(t.content.data.tag);this.core.V2NIMChatroomService.emit("onChatroomTagsUpdated",u)}},V2NIMChatroomMemberServiceImpl}(T_),oh=function(){function V2NIMChatroomServiceEventImpl(t,i){this.core=t,this.service=i,this.logger=this.core.logger}var t=V2NIMChatroomServiceEventImpl.prototype;return t.setListener=function setListener(){var t;this.core.eventBus.on("V2NIMChatroomMessageService/onReceiveNotification",bind$1(t=this.onReceiveNotification).call(t,this))},t.onReceiveNotification=function onReceiveNotification(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var u,_,h,E,m,I,v,T,N,M,O,S;return Ra.wrap((function _callee$(R){for(;;)switch(R.prev=R.next){case 0:u=t.attachment,_=get(t,"attachment.type"),R.t0=_,R.next=0===R.t0?5:7===R.t0?9:1===R.t0?11:3===R.t0?14:4===R.t0?15:5===R.t0?17:18===R.t0?19:8===R.t0?21:14===R.t0?23:9===R.t0?25:15===R.t0?27:12===R.t0?29:13===R.t0?32:17===R.t0?35:10===R.t0?38:41;break;case 5:return(h=t.attachment.currentMember)&&this.service.emit("onChatroomMemberEnter",h),u.operatorId!==this.core.account&&this.core.V2NIMChatroomInfoService.model.chatroomInfo&&this.core.V2NIMChatroomInfoService.model.chatroomInfo.onlineUserCount++,R.abrupt("break",41);case 9:if(Fa(u.targetIds))for(E=0;E<u.targetIds.length;E++)this.service.emit("onChatroomMemberExit",u.targetIds[E]);return R.abrupt("break",41);case 11:return this.service.emit("onChatroomMemberExit",u.operatorId),u.operatorId!==this.core.account&&this.core.V2NIMChatroomInfoService.model.chatroomInfo&&this.core.V2NIMChatroomInfoService.model.chatroomInfo.onlineUserCount--,R.abrupt("break",41);case 14:return R.abrupt("break",41);case 15:return u.targetIds&&includes(m=u.targetIds).call(m,this.core.account)&&this.service.emit("onSelfChatBannedUpdated",!0),R.abrupt("break",41);case 17:return u.targetIds&&includes(I=u.targetIds).call(I,this.core.account)&&this.service.emit("onSelfChatBannedUpdated",!1),R.abrupt("break",41);case 19:return"currentMember"in u&&"previousRole"in u&&this.service.emit("onChatroomMemberRoleUpdated",u.previousRole,u.currentMember),R.abrupt("break",41);case 21:return includes(v=t.attachment.targetIds).call(v,this.core.account)&&(T=i.data.muteDuration,this.service.emit("onSelfTempChatBannedUpdated",!0,T)),R.abrupt("break",41);case 23:return includes(N=this.core.tags).call(N,i.data.targetTag)&&(M=i.data.muteDuration,this.service.emit("onSelfTempChatBannedUpdated",!0,M)),R.abrupt("break",41);case 25:return includes(O=t.attachment.targetIds).call(O,this.core.account)&&this.service.emit("onSelfTempChatBannedUpdated",!1,0),R.abrupt("break",41);case 27:return this.service.emit("onSelfTempChatBannedUpdated",!1,0),R.abrupt("break",41);case 29:return this.service.emit("onChatroomChatBannedUpdated",!0),this.core.V2NIMChatroomInfoService.model.chatroomInfo&&(this.core.V2NIMChatroomInfoService.model.chatroomInfo.chatBanned=!0),R.abrupt("break",41);case 32:return this.service.emit("onChatroomChatBannedUpdated",!1),this.core.V2NIMChatroomInfoService.model.chatroomInfo&&(this.core.V2NIMChatroomInfoService.model.chatroomInfo.chatBanned=!1),R.abrupt("break",41);case 35:return this.core.options.tags=i.data.tags||[],this.service.emit("onChatroomTagsUpdated",i.data.tags),R.abrupt("break",41);case 38:return(S=t.attachment.currentMember)&&(S.memberLevel=S.memberLevel||0,this.service.emit("onChatroomMemberInfoUpdated",S)),R.abrupt("break",41);case 41:case"end":return R.stop()}}),_callee,this)})))},t.beforeEmit=function beforeEmit(t){for(var i=this.service.name+"::emit "+t.toString(),u=arguments.length,_=new Array(u>1?u-1:0),h=1;h<u;h++)_[h-1]=arguments[h];if("onSendMessage"===t){var E=_[0];this.logger.log(""+i,E.messageClientId+";createTime:"+E.createTime+";","sendingState:"+E.sendingState+";attachmentUploadState:"+(E.attachmentUploadState||0))}else if("onReceiveMessages"===t){var m=_[0];this.logger.log(""+i,map$7(m).call(m,(function(t){return t.messageClientId+";createTime:"+t.createTime})))}else if("onChatroomMemberEnter"===t||"onChatroomMemberInfoUpdated"===t){var I=_[0];this.logger.log(""+i,"accountId:"+I.accountId)}else if("onChatroomMemberRoleUpdated"===t){var v=_[1];this.logger.log(""+i,_[0],"accountId:"+v.accountId+";memberRole:"+v.memberRole)}else{var T,N;(T=this.logger).log.apply(T,concat(N=[""+i]).call(N,_))}},V2NIMChatroomServiceEventImpl}(),ih=function(t){function V2NIMChatroomServiceImpl(i){var u;return(u=t.call(this,"V2NIMChatroomService",i)||this).event=new oh(i,Xe(u)),u.setListener(),u}bt(V2NIMChatroomServiceImpl,t);var i=V2NIMChatroomServiceImpl.prototype;return i.setListener=function setListener(){this.event.setListener()},i.emit=function emit(i){for(var u,_,h,E,m=arguments.length,I=new Array(m>1?m-1:0),v=1;v<m;v++)I[v-1]=arguments[v];return(u=this.event).beforeEmit.apply(u,concat(_=[i]).call(_,I)),(h=t.prototype.emit).call.apply(h,concat(E=[this,i]).call(E,I))},i.sendMessage=function sendMessage(t,i,u){return this.core.V2NIMChatroomMessageService.sendMessage(t,i,u)},i.cancelMessageAttachmentUpload=function cancelMessageAttachmentUpload(t){return this.core.V2NIMChatroomMessageService.fileUtil.cancelMessageAttachmentUpload(t)},i.registerCustomAttachmentParser=function registerCustomAttachmentParser(t){this.core.V2NIMChatroomMessageService.registerCustomAttachmentParser(t)},i.unregisterCustomAttachmentParser=function unregisterCustomAttachmentParser(t){this.core.V2NIMChatroomMessageService.unregisterCustomAttachmentParser(t)},i.getMessageList=function getMessageList(t){return this.core.V2NIMChatroomMessageService.getMessageList(t)},i.getMessageListByTag=function getMessageListByTag(t){return this.core.V2NIMChatroomMessageService.getMessageListByTag(t)},i.getMemberListByOption=function getMemberListByOption(t){return this.core.V2NIMChatroomMemberService.getMemberListByOption(t)},i.updateMemberRole=function updateMemberRole(t,i){return this.core.V2NIMChatroomMemberService.updateMemberRole(t,i)},i.setMemberBlockedStatus=function setMemberBlockedStatus(t,i,u){return this.core.V2NIMChatroomMemberService.setMemberBlockedStatus(t,i,u)},i.setMemberChatBannedStatus=function setMemberChatBannedStatus(t,i,u){return this.core.V2NIMChatroomMemberService.setMemberChatBannedStatus(t,i,u)},i.setMemberTempChatBanned=function setMemberTempChatBanned(t,i,u,_){return this.core.V2NIMChatroomMemberService.setMemberTempChatBanned(t,i,u,_)},i.updateSelfMemberInfo=function updateSelfMemberInfo(t,i){return this.core.V2NIMChatroomMemberService.updateSelfMemberInfo(t,i)},i.getMemberByIds=function getMemberByIds(t){return this.core.V2NIMChatroomMemberService.getMemberByIds(t)},i.kickMember=function kickMember(t,i){return this.core.V2NIMChatroomMemberService.kickMember(t,i)},i.getMemberListByTag=function getMemberListByTag(t){return this.core.V2NIMChatroomMemberService.getMemberListByTag(t)},i.getMemberCountByTag=function getMemberCountByTag(t){return this.core.V2NIMChatroomMemberService.getMemberCountByTag(t)},i.getChatroomInfo=function getChatroomInfo(){return this.core.V2NIMChatroomInfoService.getChatroomInfo()},i.updateChatroomInfo=function updateChatroomInfo(t,i){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){return Ra.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",this.core.V2NIMChatroomInfoService.updateChatroomInfo(t,i));case 1:case"end":return u.stop()}}),_callee,this)})))},i.updateChatroomLocationInfo=function updateChatroomLocationInfo(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){return Ra.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",this.core.V2NIMChatroomInfoService.updateChatroomLocationInfo(t));case 1:case"end":return i.stop()}}),_callee2,this)})))},i.updateChatroomTags=function updateChatroomTags(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee3(){return Ra.wrap((function _callee3$(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",this.core.V2NIMChatroomInfoService.updateChatroomTags(t));case 1:case"end":return i.stop()}}),_callee3,this)})))},i.setTempChatBannedByTag=function setTempChatBannedByTag(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee4(){return Ra.wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",this.core.V2NIMChatroomInfoService.setTempChatBannedByTag(t));case 1:case"end":return i.stop()}}),_callee4,this)})))},V2NIMChatroomServiceImpl}(p_),ah=entryVirtual("Array").keys,sh=Array.prototype,ch={DOMTokenList:!0,NodeList:!0},keys=function(t){var i=t.keys;return t===sh||K(sh,t)&&i===sh.keys||de(ch,Ut(t))?ah:i},lh=function(){function V2NIMClientAntispamUtilImpl(t,i){this.config={enable:!1},this.core=t,i&&this.setOptions(i)}var t=V2NIMClientAntispamUtilImpl.prototype;return t.setOptions=function setOptions(t){this.config=La(this.config,t)},t.reset=function reset(t){"destroy"===t&&(this.vocabInfo=void 0)},t.downloadLocalAntiSpamVocabs=function downloadLocalAntiSpamVocabs(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var t;return Ra.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:if(this.config.enable){i.next=2;break}return i.abrupt("return");case 2:if(!this.vocabInfo){i.next=4;break}return i.abrupt("return");case 4:return i.prev=4,i.next=7,this.core.sendCmd("v2ChatroomDownloadLocalAntiSpamVocabs",{tag:{version:0,md5:""}});case 7:(t=i.sent).content.data&&(this.vocabInfo=La(La({},t.content.data),{thesaurus:t.content.data.thesaurus?JSON.parse(t.content.data.thesaurus).thesaurus:[]})),i.next=14;break;case 11:i.prev=11,i.t0=i.catch(4),this.core.logger.warn("V2NIMLocalAntispamUtil::downloadLocalAntiSpamVocabs error",i.t0);case 14:case"end":return i.stop()}}),_callee,this,[[4,11]])})))},t.checkTextAntispam=function checkTextAntispam(t,i){if(void 0===i&&(i="**"),!this.config.enable)return{operateType:0,replacedText:t};if(validate({text:{type:"string",required:!0,allowEmpty:!1},replace:{type:"string"}},{text:t,replace:i},"",!0),!this.vocabInfo)return{operateType:0,replacedText:t};for(var u=t,_=0;_<this.vocabInfo.thesaurus.length;_++){var h=this.filterContent(u,this.vocabInfo.thesaurus[_],i);if(u=h.replacedText,2===h.operateType||3===h.operateType)return h}return{operateType:u===t?0:1,replacedText:u}},t.filterContent=function filterContent(t,i,u){for(var _=0;_<keys(i).length;_++){var h=keys(i)[_],E=h.match||i.match,m=h.operate||i.operate,I=void 0;try{I=this.matchContent(t,h.key,E,m,u)}catch(t){}if(I&&(t=I.replacedText,2===I.operateType||3===I.operateType))return I}return{operateType:1,replacedText:t}},t.matchContent=function matchContent(t,i,u,_,h){var E=!1,m=null;if(1===u){if(indexOf(t).call(t,i)>=0){E=!0;var I=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");m=new RegExp(I,"g")}}else 2===u&&(m=new RegExp(i,"g")).test(t)&&(E=!0);if(E&&m)switch(_){case 1:return{operateType:1,replacedText:t.replace(m,h)};case 2:return{operateType:2,replacedText:t};case 3:return{operateType:3,replacedText:t}}return{operateType:0,replacedText:t}},V2NIMClientAntispamUtilImpl}(),uh={initParams:{type:"object",rules:{appkey:{type:"string",allowEmpty:!1},customClientType:{type:"number",required:!1},isFixedDeviceId:{type:"boolean",required:!1},debugLevel:{type:"enum",values:["off","error","warn","log","debug"],required:!1}}},otherParams:{type:"object",rules:{cloudStorageConfig:{type:"object",required:!1,rules:{commonUploadHost:{type:"string",required:!1},commonUploadHostBackupList:{type:"array",required:!1,itemType:"string"},chunkUploadHost:{type:"string",required:!1},uploadReplaceFormat:{type:"string",required:!1},downloadUrl:{type:"string",required:!1},downloadHostList:{type:"array",required:!1},nosCdnEnable:{type:"boolean",required:!1},storageKeyPrefix:{type:"string",required:!1},isNeedToGetUploadPolicyFromServer:{type:"boolean",required:!1},cdn:{type:"object",required:!1,allowEmpty:!1,rules:{defaultCdnDomain:{type:"string",required:!1},cdnDomain:{type:"string",required:!1},bucket:{type:"string",required:!1},objectNamePrefix:{type:"string",required:!1}}}}},reporterConfig:{type:"object",allowEmpty:!1,required:!1,rules:{enableCompass:{type:"boolean",required:!1},compassDataEndpoint:{type:"string",required:!1},isDataReportEnable:{type:"boolean",required:!1}}},abtestConfig:{type:"object",allowEmpty:!1,required:!1,rules:{isAbtestEnable:{type:"boolean",required:!1},abtestUrl:{type:"string",required:!1}}}}}};function getIsDataReportEnable(t){var i,u,_=!0;return"boolean"==typeof(null===(i=null==t?void 0:t.reporterConfig)||void 0===i?void 0:i.enableCompass)?_=t.reporterConfig.enableCompass:"boolean"==typeof(null===(u=null==t?void 0:t.reporterConfig)||void 0===u?void 0:u.isDataReportEnable)&&(_=t.reporterConfig.isDataReportEnable),_}function getCompassDataEndpoint(t,i){var u,_,h=null===(u=null==i?void 0:i.reporterConfig)||void 0===u?void 0:u.compassDataEndpoint,E=null===(_=null==i?void 0:i.reporterConfig)||void 0===_?void 0:_.reportConfigUrl;if(h)return h;if(E){var m=E.match(/^https:\/\/([^/]+)\/*/);if(Fa(m)&&m.length>=1)return"https://"+m[1];t.error("Invalid reportConfigUrl: "+E)}return function pendingIsMiniappEnv(){var t=Os.getSystemInfo().hostEnvEnum;return 6===t||102===t||103===t||104===t}()?"https://statistic.live.126.net":"https://statistic.live.126.net,https://statistic-overseas.yunxinfw.com"}var dh="V2NIMChatroomQueueService",_h={"36_20":"v2ChatroomQueueOffer","36_21":"v2ChatroomQueuePoll","36_22":"v2ChatroomQueueList","36_23":"v2ChatroomQueuePeek","36_24":"v2ChatroomQueueDrop","36_25":"v2ChatroomQueueInit","36_26":"v2ChatroomQueueBatchUpdate"},ph={v2ChatroomQueueOffer:{sid:36,cid:20,service:dh,params:[{type:"String",name:"elementKey"},{type:"String",name:"elementValue"},{type:"Bool",name:"transient"},{type:"String",name:"elementOwnerAccountId"}]},v2ChatroomQueuePoll:{sid:36,cid:21,service:dh,params:[{type:"String",name:"elementKey"}],response:[{type:"String",name:"elementKey"},{type:"String",name:"elementValue"}]},v2ChatroomQueueList:{sid:36,cid:22,service:dh,params:[],response:[{type:"KVArray",name:"datas"}]},v2ChatroomQueuePeek:{sid:36,cid:23,service:dh,params:[],response:[{type:"String",name:"elementKey"},{type:"String",name:"elementValue"}]},v2ChatroomQueueDrop:{sid:36,cid:24,service:dh,params:[]},v2ChatroomQueueInit:{sid:36,cid:25,service:dh,params:[{type:"Int",name:"size"}]},v2ChatroomQueueBatchUpdate:{sid:36,cid:26,service:dh,params:[{type:"StrStrMap",name:"keyValues"},{type:"Bool",name:"notificationEnabled"},{type:"String",name:"notificationExtension"}],response:[{type:"StrArray",name:"datas"}]}},hh={elementKey:{type:"string",required:!0,allowEmpty:!1},elementValue:{type:"string",required:!0,allowEmpty:!1},transient:{type:"boolean",required:!1},elementOwnerAccountId:{type:"string",required:!1,allowEmpty:!1}},fh={elements:{type:"array",min:1,max:100,rules:{key:{type:"string",required:!0,allowEmpty:!1},value:{type:"string",required:!0,allowEmpty:!1}},required:!0},notificationEnabled:{type:"boolean",required:!1},notificationExtension:{type:"string",required:!1}},Eh=function(t){function V2NIMChatroomQueueServiceImpl(i){var u;return u=t.call(this,"V2NIMChatroomQueueService",i)||this,registerParser({cmdMap:_h,cmdConfig:ph}),u.setListeners(),u}bt(V2NIMChatroomQueueServiceImpl,t);var i=V2NIMChatroomQueueServiceImpl.prototype;return i.setListeners=function setListeners(){var t=this;this.core.eventBus.on("V2NIMChatroomMessageService/onReceiveNotification",(function(i){return __awaiter(t,void 0,void 0,Ra.mark((function _callee(){var t,u,_,h,E;return Ra.wrap((function _callee$(m){for(;;)switch(m.prev=m.next){case 0:m.t0=i.attachment.type,m.next=11===m.t0?3:5;break;case 3:try{t=JSON.parse(i.attachment.raw),"OFFER"===(u=JSON.parse(t.data.queueChange))._e?this.emit("onChatroomQueueOffered",{key:u.key,value:u.content}):"POLL"===u._e?this.emit("onChatroomQueuePolled",{key:u.key,value:u.content}):"DROP"===u._e?this.emit("onChatroomQueueDropped"):"BATCH_UPDATE"===u._e?(_=formatQueueElementsFromKVObject(u.kvObject)).length>0&&this.emit("onChatroomQueueBatchUpdated",_):"PARTCLEAR"===u._e?(h=formatQueueElementsFromKVObject(u.kvObject)).length>0&&this.emit("onChatroomQueuePartCleared",h):"BATCH_OFFER"===u._e&&(E=formatQueueElementsFromElements(u.elements)).length>0&&this.emit("onChatroomQueueBatchOffered",E)}catch(t){this.logger.error("V2NIMChatroomQueueServiceImpl json parse error",t," raw = ",i.attachment.raw)}return m.abrupt("break",5);case 5:case"end":return m.stop()}}),_callee,this)})))}))},i.emit=function emit(i){for(var u,_,h,E,m=this.name+"::emit "+i.toString(),I=arguments.length,v=new Array(I>1?I-1:0),T=1;T<I;T++)v[T-1]=arguments[T];return(u=this.logger).log.apply(u,concat(_=[""+m]).call(_,v)),(h=t.prototype.emit).call.apply(h,concat(E=[this,i]).call(E,v))},i.queueOffer=function queueOffer(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){return Ra.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:return validate(hh,t,"",!0),i.next=3,this.core.sendCmd("v2ChatroomQueueOffer",t);case 3:case"end":return i.stop()}}),_callee2,this)})))},i.queuePoll=function queuePoll(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee3(){var i;return Ra.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:return t="string"==typeof t?t:"",u.next=3,this.core.sendCmd("v2ChatroomQueuePoll",{elementKey:t});case 3:return i=u.sent,u.abrupt("return",{key:i.content.elementKey,value:i.content.elementValue});case 5:case"end":return u.stop()}}),_callee3,this)})))},i.queueList=function queueList(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee4(){var t;return Ra.wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.core.sendCmd("v2ChatroomQueueList");case 2:return t=i.sent,i.abrupt("return",(u=t.content.datas)&&u.length>0?map$7(u).call(u,(function(t){var i=cs(t)[0];return{key:i,value:t[i]}})):[]);case 4:case"end":return i.stop()}var u}),_callee4,this)})))},i.queuePeek=function queuePeek(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee5(){var t;return Ra.wrap((function _callee5$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.core.sendCmd("v2ChatroomQueuePeek");case 2:return t=i.sent,i.abrupt("return",{key:t.content.elementKey,value:t.content.elementValue});case 4:case"end":return i.stop()}}),_callee5,this)})))},i.queueDrop=function queueDrop(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee6(){return Ra.wrap((function _callee6$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.sendCmd("v2ChatroomQueueDrop");case 2:case"end":return t.stop()}}),_callee6,this)})))},i.queueInit=function queueInit(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee7(){return Ra.wrap((function _callee7$(i){for(;;)switch(i.prev=i.next){case 0:return validate({size:{type:"number",min:0,max:1e3}},{size:t},"",!0),i.next=3,this.core.sendCmd("v2ChatroomQueueInit",{size:t});case 3:case"end":return i.stop()}}),_callee7,this)})))},i.queueBatchUpdate=function queueBatchUpdate(t,i,u){return void 0===i&&(i=!0),__awaiter(this,void 0,void 0,Ra.mark((function _callee8(){var _,h;return Ra.wrap((function _callee8$(E){for(;;)switch(E.prev=E.next){case 0:return validate(fh,{elements:t,notificationEnabled:i,notificationExtension:u},"",!0),_=reduce(t).call(t,(function(t,i){return t[i.key]=i.value,t}),{}),E.next=4,this.core.sendCmd("v2ChatroomQueueBatchUpdate",{keyValues:_,notificationEnabled:i,notificationExtension:u});case 4:return h=E.sent,E.abrupt("return",h.content.datas);case 6:case"end":return E.stop()}}),_callee8,this)})))},V2NIMChatroomQueueServiceImpl}(p_),mh=1,gh={},Ih=function(t){function V2NIMChatroomClient(i,u){var _,h,E,m;if(void 0===u&&(u={}),(_=t.call(this)||this).pluginMap={},_.eventBus=new ql,_.options={appkey:"",account:"",tags:[],debugLevel:"debug",xhrConnectTimeout:8e3,socketConnectTimeout:8e3,apiVersion:"v2",isFixedDeviceId:!1,loginSDKTypeParamCompat:!1,binaryWebsocket:!0},_.config={deviceId:"",clientSession:"",binaryWebsocket:!0},_.options.appkey=i.appkey,_.options.customClientType=i.customClientType,_.options.isFixedDeviceId=i.isFixedDeviceId,_.options.loginSDKTypeParamCompat=i.loginSDKTypeParamCompat,_.instanceId=mh,mh+=1,_.logger=new Ul(i.debugLevel||"debug",u.loggerConfig),u.privateConf){var I=_.getConfigFromPrivate(u.privateConf),v=I.cloudStorageConfig,T=I.reporterConfig;u=La(La({},u),{cloudStorageConfig:La(La({},u.cloudStorageConfig||{}),v),reporterConfig:La(La({},u.reporterConfig||{}),T)})}_.timerManager=new hd,_.adapters=new fd(Xe(_)),_.timeOrigin=new Gu(Xe(_),{},"v2ChatroomGetServerTime"),_.reporterHookLinkKeep=new E_(Xe(_)),"boolean"==typeof i.binaryWebsocket&&(_.options.binaryWebsocket=i.binaryWebsocket),_.options.isFixedDeviceId?(_.config.deviceId=Os.localStorage.getItem("__CHATROOM_DEVC_ID__")||od(),_.config.clientSession=Os.localStorage.getItem("__CHATROOM_CLIENT_SESSION_ID__")||od(),Os.localStorage.setItem("__CHATROOM_DEVC_ID__",_.config.deviceId),Os.localStorage.setItem("__CHATROOM_CLIENT_SESSION_ID__",_.config.clientSession)):(_.config.deviceId=od(),_.config.clientSession=od()),_.abtest=new Ed(Xe(_),{isAbtestEnable:void 0===(null===(h=u.abtestConfig)||void 0===h?void 0:h.isAbtestEnable)||(null===(E=u.abtestConfig)||void 0===E?void 0:E.isAbtestEnable),abtestUrl:(null===(m=u.abtestConfig)||void 0===m?void 0:m.abtestUrl)||Fl,abtestProjectKey:Gl});var N=Os.getSystemInfo(),M=getCompassDataEndpoint(_.logger,u);return _.reporter=new Ms(La(La({},M?{compassDataEndpoint:M}:{}),{isDataReportEnable:getIsDataReportEnable(u),common:{app_key:i.appkey,dev_id:_.config.deviceId,platform:"Web",sdk_ver:"10.9.71",env:"online",os_name:N.os,os_ver:N.osVer,lib_env:N.libEnv,host_env:N.hostEnv,host_env_ver:N.hostEnvVer,manufactor:N.manufactor,model:N.model,v2:!0},request:Os.request,logger:_.logger,autoStart:!0})),Os.setLogger(_.logger),_.auth=new h_(Xe(_)),_.V2NIMChatroomLoginService=_.auth,!1!==_.options.binaryWebsocket&&"function"==typeof Uint8Array?(_.config.binaryWebsocket=!0,_.clientSocket=new cd(Xe(_))):(_.config.binaryWebsocket=!1,_.clientSocket=new pd(Xe(_))),_.cloudStorage=new q_(Xe(_),La({storageKeyPrefix:"V2NIMChatroomClient"},u.cloudStorageConfig)),_.V2NIMChatroomQueueService=new Eh(Xe(_)),_.V2NIMChatroomInfoService=new S_(Xe(_)),_.V2NIMStorageService=new X_(Xe(_)),_.V2NIMStorageUtil=new $_(Xe(_)),_.V2NIMChatroomMessageService=new zp(Xe(_)),_.V2NIMChatroomMessageCreator=new $p(Xe(_)),_.V2NIMClientAntispamUtil=new lh(Xe(_),u.V2NIMClientAntispamUtilConfig),_.V2NIMChatroomMemberService=new nh(Xe(_)),_.V2NIMChatroomService=new ih(Xe(_)),_.logger.log("NIM chatroom init, version:10.9.71, sdk version:100971, appkey:"+i.appkey),_}bt(V2NIMChatroomClient,t),V2NIMChatroomClient.getInstanceList=function getInstanceList(){return Pa(gh)},V2NIMChatroomClient.getInstance=function getInstance(t){return validate({instanceId:{type:"number",allowEmpty:!1}},{instanceId:t},"",!0),gh[t]},V2NIMChatroomClient.newInstance=function newInstance(t,i){void 0===i&&(i={}),validate(uh,{initParams:t,otherParams:i},"",!0);var u=new V2NIMChatroomClient(t,i);return gh[u.instanceId]=u,u},V2NIMChatroomClient.destroyInstance=function destroyInstance(t){var i=this.getInstance(t);if(i)return delete gh[t],i._exitAsync().then((function(){i._clear()})).catch((function(){i._clear()}))},V2NIMChatroomClient.destroyAll=function destroyAll(){for(var t in gh)this.destroyInstance(Number(t))};var i=V2NIMChatroomClient.prototype;return i.getConfigFromPrivate=function getConfigFromPrivate(t){return t?{cloudStorageConfig:JSON.parse(Ua({chunkUploadHost:t.nos_uploader||void 0,commonUploadHost:t.nos_uploader||void 0,commonUploadHostBackupList:t.nos_uploader?[t.nos_uploader]:void 0,chunkUploadHostBackupList:t.nos_uploader?[t.nos_uploader]:void 0,uploadReplaceFormat:t.nos_downloader_v2?(t.nosSsl?"https://":"http://")+t.nos_downloader_v2:void 0,downloadUrl:void 0!==t.nos_accelerate?t.nos_accelerate:void 0,downloadHostList:""===t.nos_accelerate_host?[]:"string"==typeof t.nos_accelerate_host?[t.nos_accelerate_host]:Fa(t.nos_accelerate_host)?t.nos_accelerate_host:void 0})),reporterConfig:JSON.parse(Ua({enableCompass:"boolean"==typeof t.enableCompass?t.enableCompass:void 0,compassDataEndpoint:t.compassDataEndpoint||void 0}))}:{cloudStorageConfig:{},reporterConfig:{}}},i.getInstanceId=function getInstanceId(){return this.instanceId},i._clearModuleData=function _clearModuleData(t){void 0===t&&(t="logout");var i=Pa(this);forEach$1(i).call(i,(function(i){i&&"function"==typeof i.reset&&i.reset(t)}))},i._removeAllModuleListeners=function _removeAllModuleListeners(){var t=Pa(this);forEach$1(t).call(t,(function(t){t&&"function"==typeof t.removeAllListeners&&t.removeAllListeners()}))},i._clear=function _clear(){this.removeAllListeners(),this.eventBus.removeAllListeners(),this.logger.destroy(),this.reporter.destroy(),this.timerManager.destroy(),this._clearModuleData("destroy"),this._removeAllModuleListeners()},i.enter=function enter(t,i){var u;return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var _,h;return Ra.wrap((function _callee$(E){for(;;)switch(E.prev=E.next){case 0:if(validate(d_,{roomId:t,enterParams:i},"",!0),i.accountId||i.anonymousMode){E.next=3;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"accountId is required"}});case 3:if(_=get(i,"loginOption.authType")||0,i.loginOption=i.loginOption||{authType:_},0!==_){E.next=8;break}if(i.anonymousMode||i.token){E.next=8;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"token is required when authType == 0"}});case 8:if(1!==_){E.next=11;break}if(null===(u=i.loginOption)||void 0===u?void 0:u.tokenProvider){E.next=11;break}throw new bl({code:Wd.V2NIM_ERROR_CODE_INVALID_PARAMETER,detail:{reason:"tokenProvider is required when authType == 1"}});case 11:return E.next=13,this.auth.login(this.options.appkey,t,i);case 13:return h=E.sent,this.V2NIMChatroomInfoService._setChatroomInfo(h.chatroom),E.abrupt("return",h);case 16:case"end":return E.stop()}}),_callee,this)})))},i._exitAsync=function _exitAsync(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){return Ra.wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:return this.auth.reset(),t.prev=1,t.next=4,this.auth.logout();case 4:return t.abrupt("return");case 7:return t.prev=7,t.t0=t.catch(1),t.abrupt("return",pa.resolve());case 10:case"end":return t.stop()}}),_callee2,this,[[1,7]])})))},i.exit=function exit(){this._exitAsync()},i.sendCmd=function sendCmd(t,i,u){return this.clientSocket.sendCmd(t,i,u)},i.getChatroomInfo=function getChatroomInfo(){return this.V2NIMChatroomInfoService.getChatroomInfo()},i._registerDep=function _registerDep(t,i){},i.emit=function emit(i){for(var u,_,h,E,m="core::emit "+i.toString(),I=arguments.length,v=new Array(I>1?I-1:0),T=1;T<I;T++)v[T-1]=arguments[T];return(u=this.logger).log.apply(u,concat(_=[""+m]).call(_,v)),(h=t.prototype.emit).call.apply(h,concat(E=[this,i]).call(E,v))},$e(V2NIMChatroomClient,[{key:"account",get:function get(){return this.options.account}},{key:"tags",get:function get(){return this.options.tags}},{key:"status",get:function get(){return 5===this.auth.lifeCycle.chatroomStatus?"logined":""}}]),V2NIMChatroomClient}(ql);Ih.sdkVersion=100971,Ih.sdkVersionFormat="10.9.71";var vh=createCommonjsModule((function(t,i){t.exports=function(){function object2String(t){if(t){var i,u="";return forEach$1(i=cs(t)).call(i,(function(i,_){u+=0===_?"?":"&",u+=i+"="+t[i]})),u}return""}var t=function(t){function V2NIMError(i,u,_,h){var E;return(E=t.call(this,_)||this).source=i,E.code=u,E.desc=_,E.detail=h||{},E}return bt(V2NIMError,t),V2NIMError}(mc(Error));function request(i,u){void 0===u&&(u={dataType:"json",method:"GET",timeout:5e3});var _="text"===u.dataType?"text/plain; charset=UTF-8":"application/json; charset=UTF-8",h="GET"===u.method?object2String(u.params):"";return new pa((function(E,m){if(window.XMLHttpRequest){var I,v=new XMLHttpRequest;if(v.onreadystatechange=function(){if(4===v.readyState)if(200===v.status){try{I=JSON.parse(v.response||"{}")}catch(t){I=v.response}E({status:v.status,data:I})}else gs((function(){m(new t(1,v.status,"readyState: "+v.readyState+"; statusText: "+v.statusText))}),0)},v.open(u.method,""+i+h),v.timeout=u.timeout||5e3,v.setRequestHeader("Content-Type",_),u.headers)for(var T in u.headers)v.setRequestHeader(T,u.headers[T]);v.ontimeout=function(i){m(new t(1,408,i&&i.message?i.message:"request timeout"))},v.send(Ua(u.data))}else m(new t(2,10400,"request no suppout"))}))}return request}()})),Th=Math.floor,mergeSort=function(t,i){var u=t.length,_=Th(u/2);return u<8?insertionSort(t,i):merge(t,mergeSort(arraySliceSimple(t,0,_),i),mergeSort(arraySliceSimple(t,_),i),i)},insertionSort=function(t,i){for(var u,_,h=t.length,E=1;E<h;){for(_=E,u=t[E];_&&i(t[_-1],u)>0;)t[_]=t[--_];_!==E++&&(t[_]=u)}return t},merge=function(t,i,u,_){for(var h=i.length,E=u.length,m=0,I=0;m<h||I<E;)t[m+I]=m<h&&I<E?_(i[m],u[I])<=0?i[m++]:u[I++]:m<h?i[m++]:u[I++];return t},Nh=mergeSort,Mh=q.match(/firefox\/(\d+)/i),Oh=!!Mh&&+Mh[1],Sh=/MSIE|Trident/.test(q),Rh=q.match(/AppleWebKit\/(\d+)\./),yh=!!Rh&&+Rh[1],Ah=[],Ch=R(Ah.sort),bh=R(Ah.push),Lh=fails((function(){Ah.sort(void 0)})),kh=fails((function(){Ah.sort(null)})),Dh=arrayMethodIsStrict("sort"),Vh=!fails((function(){if(J)return J<70;if(!(Oh&&Oh>3)){if(Sh)return!0;if(yh)return yh<603;var t,i,u,_,h="";for(t=65;t<76;t++){switch(i=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:u=3;break;case 68:case 71:u=4;break;default:u=2}for(_=0;_<47;_++)Ah.push({k:i+_,v:u})}for(Ah.sort((function(t,i){return i.v-t.v})),_=0;_<Ah.length;_++)i=Ah[_].k.charAt(0),h.charAt(h.length-1)!==i&&(h+=i);return"DGBEFHACIJK"!==h}}));_export({target:"Array",proto:!0,forced:Lh||!kh||!Dh||!Vh},{sort:function sort(t){void 0!==t&&aCallable(t);var i=toObject(this);if(Vh)return void 0===t?Ch(i):Ch(i,t);var u,_,h=[],E=lengthOfArrayLike(i);for(_=0;_<E;_++)_ in i&&bh(h,i[_]);for(Nh(h,function(t){return function(i,u){return void 0===u?-1:void 0===i?1:void 0!==t?+t(i,u)||0:toString(i)>toString(u)?1:-1}}(t)),u=lengthOfArrayLike(h),_=0;_<u;)i[_]=h[_++];for(;_<E;)deletePropertyOrThrow(i,_++);return i}});var wh=entryVirtual("Array").sort,Ph=Array.prototype,sort=function(t){var i=t.sort;return t===Ph||K(Ph,t)&&i===Ph.sort?wh:i},xh=createCommonjsModule((function(t,i){self,t.exports=function(){var t={d:function d(i,u){for(var _ in u)t.o(u,_)&&!t.o(i,_)&&ze(i,_,{enumerable:!0,get:u[_]})},o:function o(t,i){return Object.prototype.hasOwnProperty.call(t,i)}},i={};t.d(i,{default:function _default(){return M}});var u=function e(t){for(var i in function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,e),this.directUploadAddr="https://wanproxy-web.127.net",this.retryCount=4,this.trunkSize=4194304,this.trunkUploadTimeout=0,this.getOffsetTimeout=1e4,this.version="1.0",this.enableCache=!0,this.logger=console,this.onError=function(t){},this.onProgress=function(t){},this.onUploadProgress=function(t){},this.onComplete=function(t){},this.onUploadInfo=function(t){},t)this[i]=t[i]};function n(t,i){var u=void 0!==Zn&&jl(t)||t["@@iterator"];if(!u){if(Fa(t)||(u=function(t,i){if(t){var u;if("string"==typeof t)return r(t,i);var _=slice(u=Object.prototype.toString.call(t)).call(u,8,-1);return"Object"===_&&t.constructor&&(_=t.constructor.name),"Map"===_||"Set"===_?Yl(t):"Arguments"===_||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_)?r(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){u&&(t=u);var _=0,h=function a(){};return{s:h,n:function n(){return _>=t.length?{done:!0}:{done:!1,value:t[_++]}},e:function e(t){throw t},f:h}}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 E,m=!0,I=!1;return{s:function s(){u=u.call(t)},n:function n(){var t=u.next();return m=t.done,t},e:function e(t){I=!0,E=t},f:function f(){try{m||null==u.return||u.return()}finally{if(I)throw E}}}}function r(t,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,_=new Array(i);u<i;u++)_[u]=t[u];return _}var _={privateObj:{},setItem:function setItem(t,i){_.privateObj[t]=i},getItem:function getItem(t){return _.privateObj[t]},removeItem:function removeItem(t){delete _.privateObj[t]},getKeys:function getKeys(){return cs(_.privateObj)}},h={getFileKey:function getFileKey(t){var i=t.size.toString(),u=t.lastModified.toString();return"_NosUploader_"+t.name+slice(i).call(i,i.length-5)+slice(u).call(u,u.length-5)},getFileInfo:function getFileInfo(t){var i=_.getItem(t);if(!i)return null;try{return JSON.parse(i)}catch(t){return null}},initFile:function initFile(t,i,u){h.clearExpiredInfo();var E=this.getFileKey(i),m={ctx:void 0!==t.ctx?t.ctx:"",bucket:t.bucketName,obj:t.objectName,token:t.token,modifyAt:Ka(),end:!1};return t.payload&&(m.payload=t.payload),u&&_.setItem(E,Ua(m)),E},setUploadContext:function setUploadContext(t,i,u){var h=this.getFileInfo(t);h&&(h.ctx=i,u&&_.setItem(t,Ua(h)))},setComplete:function setComplete(t,i){var u=this.getFileInfo(t);u&&(u.modifyAt=Ka(),u.end=!0,i&&_.setItem(t,Ua(u)))},getUploadContext:function getUploadContext(t){var i=this.getFileInfo(t);return i?i.ctx:""},removeFileInfo:function removeFileInfo(t){0===indexOf(t).call(t,"_NosUploader_")&&_.removeItem(t)},clearExpiredInfo:function clearExpiredInfo(){var t,i="function"==typeof _.getKeys?_.getKeys():cs(_),u=Ka(),E=[],m=n(i);try{for(m.s();!(t=m.n()).done;){var I=t.value;if(0===indexOf(I).call(I,"_NosUploader_")){var v=h.getFileInfo(I);null===v||u-v.modifyAt>M.expireTime?_.removeItem(I):E.push({fileInfo:v,key:I})}}}catch(t){m.e(t)}finally{m.f()}if(E.length>M.maxFileCache){var T,N,O=n(slice(T=sort(E).call(E,(function(t,i){return i.fileInfo.modifyAt-t.fileInfo.modifyAt}))).call(T,M.maxFileCache));try{for(O.s();!(N=O.n()).done;){var S,R=N.value;0===indexOf(S=R.key).call(S,"_NosUploader_")&&_.removeItem(R.key)}}catch(t){O.e(t)}finally{O.f()}}}},E=h;function c(t){return(c="function"==typeof Zn&&"symbol"==typeof co?function(t){return typeof t}:function(t){return t&&"function"==typeof Zn&&t.constructor===Zn&&t!==Zn.prototype?"symbol":typeof t})(t)}function l(t,i){return!i||"object"!==c(i)&&"function"!=typeof i?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):i}function s(t){var i="function"==typeof oc?new oc:void 0;return(s=function s(t){var u,_;if(null===t||(_=t,-1===indexOf(u=Function.toString.call(_)).call(u,"[native code]")))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(t))return i.get(t);i.set(t,n)}function n(){return f(t,arguments,y(this).constructor)}return n.prototype=Et(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)})(t)}function f(t,i,u){return(f=p()?pc:function(t,i,u){var _=[null];_.push.apply(_,i);var h=new(bind$1(Function).apply(t,_));return u&&d(h,u.prototype),h}).apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!pc)return!1;if(pc.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(pc(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,i){return(d=vt||function(t,i){return t.__proto__=i,t})(t,i)}function y(t){return(y=vt?_o:function(t){return t.__proto__||_o(t)})(t)}var m=function(t){!function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");t.prototype=Et(i&&i.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),i&&d(t,i)}(r,t);var i,u,_=(i=r,u=p(),function(){var t,_=y(i);if(u){var h=y(this).constructor;t=pc(_,arguments,h)}else t=_.apply(this,arguments);return l(this,t)});function r(t,i){var u;return function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,r),(u=_.call(this,"NosUploadError:"+t)).errCode=i,u.errMsg=t,u}return r}(s(Error)),I=function e(t,i,u){if("uploading"===t.uploadState){var _=t.config,h=t.param,I=E.getUploadContext(t.fileKey);if(!I)return u(0);var v=new XMLHttpRequest,T=_.directUploadAddr+"/".concat(h.bucketName)+"/".concat(encodeURIComponent(h.objectName))+"?uploadContext"+"&context=".concat(I)+"&version=".concat(_.version);v.onreadystatechange=function(){var h;if("abort"!==t.uploadState&&4===v.readyState){var I,N,M,O;try{O=JSON.parse(v.responseText)}catch(t){O={errMsg:"JsonParseError in getOffset. xhr.status = "+v.status+". xhr.responseText: "+v.responseText,errCode:500}}200===v.status?O.errCode?t.config.onError(new m(O.errMsg,O.errCode)):u(O.offset):v.status.toString().match(/^5/)?e(t,i-1,u):i>0?("function"==typeof(null===(h=_.logger)||void 0===h?void 0:h.error)&&_.logger.error(concat(I="getOffset(".concat(T,") error. retry after 3 seconds. ")).call(I,(new Date).toTimeString())),gs((function(){e(t,i-1,u)}),3500)):v.status?(E.removeFileInfo(t.fileKey),_.onError(new m(concat(N=concat(M="getOffset(".concat(T,") error: ")).call(M,v.status," ")).call(N,v.statusText)))):_.onError(new m("getOffset(".concat(T,") error. no Error Code")))}},v.open("get",T),v.setRequestHeader("x-nos-token",h.token),v.timeout=_.getOffsetTimeout,v.send()}};function g(t,i){(null==i||i>t.length)&&(i=t.length);for(var u=0,_=new Array(i);u<i;u++)_[u]=t[u];return _}var v=function e(t,i,u,_){if("uploading"===t.uploadState){var h=t.param,I=t.config,v=slice(File.prototype),T=void 0!==h.ctx?h.ctx:"",N=i+I.trunkSize>=t.file.size,M=N?t.file.size:i+I.trunkSize,O=Ka(),S=new XMLHttpRequest,R=I.directUploadAddr+"/".concat(h.bucketName)+"/".concat(encodeURIComponent(h.objectName)),A={};S.upload.onprogress=function(u){if("abort"!==t.uploadState){var _=0;if(u.lengthComputable){var h=i+u.loaded;_=h/t.file.size,I.onProgress(_),I.onUploadProgress({loaded:h,total:t.file.size,percentage:_,percentageText:(100*_).toFixed(2)+"%"})}else I.onError(new m("browser does not support query upload progress"))}},S.onload=function(){if(200!==S.status){var t=S.getAllResponseHeaders();if(t){var i,u=reduce(i=t.split("\n")).call(i,(function(t,i){if(0===i.length)return t;var u,_,h=(_=2,function(t){if(Fa(t))return t}(u=i.split(": "))||function(t,i){var u=null==t?null:void 0!==Zn&&jl(t)||t["@@iterator"];if(null!=u){var _,h,E=[],m=!0,I=!1;try{for(u=u.call(t);!(m=(_=u.next()).done)&&(E.push(_.value),!i||E.length!==i);m=!0);}catch(t){I=!0,h=t}finally{try{m||null==u.return||u.return()}finally{if(I)throw h}}return E}}(u,_)||function(t,i){if(t){var u;if("string"==typeof t)return g(t,i);var _=slice(u=Object.prototype.toString.call(t)).call(u,8,-1);return"Object"===_&&t.constructor&&(_=t.constructor.name),"Map"===_||"Set"===_?Yl(t):"Arguments"===_||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_)?g(t,i):void 0}}(u,_)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),E=h[0],m=h[1];return t[E]=m,t}),{});I.onUploadInfo({rsp_headers:u})}}},S.onreadystatechange=function(){var h,v,T;if("abort"!==t.uploadState&&4===S.readyState){var M,C,L,k;if(S.responseText)try{k=JSON.parse(S.responseText)}catch(t){"function"==typeof(null===(h=I.logger)||void 0===h?void 0:h.error)&&I.logger.error("JsonParseError in uploadTrunk. xhr.status = "+S.status+". xhr.responseText: "+S.responseText,t),k={errMsg:"JsonParseError in uploadTrunk. xhr.status = "+S.status+". xhr.responseText: "+S.responseText}}else"function"==typeof(null===(v=I.logger)||void 0===v?void 0:v.error)&&I.logger.error("xhr.status = "+S.status+" and xhr.responseText empty");I.onUploadInfo({transfer_latency:Ka()-O}),200===S.status?(I.onUploadInfo({http_code:200}),t.setContext(k.context),N?(_(),t.setComplete()):e(t,k.offset,I.retryCount,_)):S.status.toString().match(/^5/)?(I.onUploadInfo({http_code:S.status,req_headers:A}),u>0?e(t,i,u-1,_):(E.removeFileInfo(t.fileKey),I.onError(new m(k.errMsg,k.errCode)))):(I.onUploadInfo({http_code:S.status||0,req_headers:A}),u>0?("function"==typeof(null===(T=I.logger)||void 0===T?void 0:T.error)&&I.logger.error(concat(M="uploadTrunk(".concat(R,") error. retry after 3 seconds. ")).call(M,(new Date).toTimeString())),gs((function(){e(t,i,u-1,_)}),3500)):S.status?(E.removeFileInfo(t.fileKey),I.onError(new m(concat(C=concat(L="uploadTrunk(".concat(R,") error: ")).call(L,S.status," ")).call(C,S.statusText)))):I.onError(new m("uploadTrunk(".concat(R,") error. no Error Code. Please check your network"))))}};var C=R+"?offset=".concat(i)+"&complete=".concat(N)+"&context=".concat(T)+"&version=".concat(I.version);if(I.onUploadInfo({remote_addr:C,part_size:N?t.file.size-i:I.trunkSize,index:Math.ceil(i/I.trunkSize)}),S.open("post",C),S.setRequestHeader("x-nos-token",h.token),A["x-nos-token"]=h.token,h.md5&&(S.setRequestHeader("content-md5",h.md5),A["content-md5"]=h.md5),t.file.type&&(S.setRequestHeader("content-type",t.file.type),A["content-type"]=t.file.type),I.trunkUploadTimeout&&I.trunkUploadTimeout>0&&(S.timeout=I.trunkUploadTimeout),"undefined"!=typeof FileReader){var L=new FileReader;L.onload=function(t){var i;(null===(i=null==t?void 0:t.target)||void 0===i?void 0:i.result)instanceof ArrayBuffer&&t.target.result.byteLength>0?S.send(t.target.result):I.onError(new m("Read ArrayBuffer failed",194003))},L.onerror=function(t){var i=t.target.error;I.onError(new m("Read ArrayBuffer error. ".concat(i.toString()),194003))},L.readAsArrayBuffer(v.call(t.file,i,M))}else S.send(v.call(t.file,i,M))}};function b(t,i){for(var u=0;u<i.length;u++){var _=i[u];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),ze(t,_.key,_)}}var T=function(){function e(t,i,u){!function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,e),this.uploadState="paused",this.config=u,this.file=t,this.param=i,this.fileKey=E.initFile(i,t,this.config.enableCache),this.resume()}var t;return(t=[{key:"resume",value:function value(){var t=this;if("uploading"!==this.uploadState){this.setUploadState("uploading");var i=this.config;I(this,i.retryCount,(function(u){v(t,u,i.retryCount,(function(){t.setUploadState("ended"),"function"==typeof i.onComplete&&i.onComplete(t.param)}))}))}}},{key:"pause",value:function value(){this.setUploadState("paused")}},{key:"abort",value:function value(){"ended"!==this.uploadState&&"abort"!==this.uploadState&&(this.setUploadState("abort"),this.config.onError(new m("Upload Aborted",10499)))}},{key:"setUploadState",value:function value(t){t!==this.uploadState&&(this.uploadState=t)}},{key:"setContext",value:function value(t){E.setUploadContext(this.fileKey,t,this.config.enableCache),this.param.ctx=t}},{key:"setComplete",value:function value(){E.setComplete(this.fileKey,this.config.enableCache),this.setUploadState("ended")}}])&&b(e.prototype,t),e}(),N={maxFileCache:1/0,expireTime:864e5,getFileUploadInformation:function getFileUploadInformation(t){var i=E.getFileKey(t),u=E.getFileInfo(i);return null===u?null:Ka()-u.modifyAt>N.expireTime?(E.removeFileInfo(i),null):{uploadInfo:La({bucketName:u.bucket,objectName:u.obj,token:u.token,ctx:u.ctx},u.payload?{payload:u.payload}:{}),complete:u.end}},setMaxFileCache:function setMaxFileCache(t){N.maxFileCache=t},setExpireTime:function setExpireTime(t){N.expireTime=t},printCaches:function printCaches(){if("undefined"!=typeof localStorage)for(var t=0,i=cs(localStorage);t<i.length;t++){var u=i[t],_=E.getFileInfo(u);_&&console.log(_,"modifiedAt",new Date(_.modifyAt).toTimeString())}},createConfig:function createConfig(t){return new u(t)},createTask:function createTask(t,i,u){return new T(t,i,u)}},M=N;return i.default}()})),Uh={debug:function debug(){},log:function log(){},warn:function warn(){},error:function error(){}};function setLogger(t){Uh=t}function getLogger(){return Uh}function isMobile(){if(!navigator||!navigator.userAgent)return!1;var t=[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i];return some(t).call(t,(function(t){return navigator.userAgent.match(t)}))}function isElectron(){var t;return!(!navigator||!navigator.userAgent)&&("object"==typeof navigator&&"string"==typeof navigator.userAgent&&indexOf(t=navigator.userAgent).call(t,"Electron")>=0)}function isBrowser(){return navigator&&navigator.userAgent}function uploadFileFn(t){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var i,u,_,h,E,m,I;return Ra.wrap((function _callee$(v){for(;;)switch(v.prev=v.next){case 0:if(h=getLogger(),t.fileInput||t.file){v.next=3;break}throw new Error("File not exist");case 3:if(!t.file){v.next=7;break}E=t.file,v.next=21;break;case 7:if("string"!=typeof t.fileInput){v.next=16;break}if(!((m=document.getElementById(t.fileInput))&&m.files&&m.files[0])){v.next=13;break}E=m.files[0],v.next=14;break;case 13:throw new Error("Can not get file from fileInput");case 14:v.next=21;break;case 16:if(!(t.fileInput&&t.fileInput.files&&t.fileInput.files[0])){v.next=20;break}E=t.fileInput.files[0],v.next=21;break;case 20:throw new Error("Can not get file from fileInput "+t.fileInput);case 21:if(!(t.maxSize&&E.size>t.maxSize)){v.next=23;break}throw new Error("The file exceeds maxSize limit. maxSize: "+t.maxSize+", get "+E.size);case 23:return v.next=25,new pa((function(i,u){var _,m=xh.getFileUploadInformation(E),I=xh.createConfig({enableCache:!0,retryCount:0,directUploadAddr:t.chunkUploadHost,onError:function onError(t){u(t)},onUploadProgress:t.onUploadProgress||function(){},onComplete:function onComplete(t){i(t)},onUploadInfo:function onUploadInfo(i){t.onUploadInfo&&t.onUploadInfo(i)}});if(m)if(m.complete)t.onUploadProgress&&t.onUploadProgress({total:E.size,loaded:E.size,percentage:1,percentageText:"100%"}),i(m.uploadInfo);else{_=xh.createTask(E,m.uploadInfo,I);try{t.onUploadStart&&t.onUploadStart(_)}catch(t){h.error("Adapter uploadFile: options.onUploadStart error",t&&t.message),_.abort(),u(t)}}else{_=xh.createTask(E,La(La({bucketName:t.nosToken.bucket,objectName:decodeURIComponent(t.nosToken.objectName),token:t.nosToken.token},t.md5?{md5:t.md5}:{}),t.payload?{payload:t.payload}:{}),I);try{t.onUploadStart&&t.onUploadStart(_)}catch(t){h.error("Adapter uploadFile: options.onUploadStart error",t&&t.message),_.abort(),u(t)}}}));case 25:return(I=v.sent).name=E.name,I.size=E.size,I.type=E.type,I.ext=lastIndexOf(i=I.name).call(i,".")>-1?slice(u=I.name).call(u,lastIndexOf(_=I.name).call(_,".")+1).toLowerCase():"",v.abrupt("return",I);case 31:case"end":return v.stop()}}),_callee)})))}function getFileUploadInformationFn(t){var i;if(t.file)i=t.file;else if("string"==typeof t.fileInput){var u=document.getElementById(t.fileInput);if(!(u&&u.files&&u.files[0]))throw new Error("Can not get file from fileInput");i=u.files[0]}else{if(!(t.fileInput&&t.fileInput.files&&t.fileInput.files[0]))throw new Error("Can not get file from fileInput "+t.fileInput);i=t.fileInput.files[0]}return xh.getFileUploadInformation(i)}
/*!
	 * Platform.js v1.3.6
	 * Copyright 2014-2020 Benjamin Tan
	 * Copyright 2011-2013 John-David Dalton
	 * Available under MIT license
	 */var Fh=createCommonjsModule((function(t,u){(function(){var _={function:!0,object:!0}[typeof window]&&window||this,h=u,E=t&&!t.nodeType&&t,m=h&&E&&"object"==typeof i&&i;!m||m.global!==m&&m.window!==m&&m.self!==m||(_=m);var I=Math.pow(2,53)-1,v=/\bOpera/,T=Object.prototype,N=T.hasOwnProperty,M=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,i){for(var u in t)N.call(t,u)&&i(t[u],u,t)}function getClassOf(t){return null==t?capitalize(t):M.call(t).slice(8,-1)}function qualify(t){return String(t).replace(/([ -])(?!$)/g,"$1?")}function reduce(t,i){var u=null;return function each(t,i){var u=-1,_=t?t.length:0;if("number"==typeof _&&_>-1&&_<=I)for(;++u<_;)i(t[u],u,t);else forOwn(t,i)}(t,(function(_,h){u=i(u,_,h,t)})),u}function trim(t){return String(t).replace(/^ +| +$/g,"")}var O=function parse(t){var i=_,u=t&&"object"==typeof t&&"String"!=getClassOf(t);u&&(i=t,t=null);var h=i.navigator||{},E=h.userAgent||"";t||(t=E);var m,I,T=u?!!h.likeChrome:/\bChrome\b/.test(t)&&!/internal|\n/i.test(M.toString()),N="Object",O=u?N:"ScriptBridgingProxyObject",S=u?N:"Environment",R=u&&i.java?"JavaPackage":getClassOf(i.java),A=u?N:"RuntimeObject",C=/\bJava/.test(R)&&i.java,L=C&&getClassOf(i.environment)==S,k=C?"a":"α",D=C?"b":"β",V=i.document||{},w=i.operamini||i.opera,P=v.test(P=u&&w?w["[[Class]]"]:getClassOf(w))?P:w=null,x=t,U=[],G=null,B=t==E,H=B&&w&&"function"==typeof w.version&&w.version(),Y=function getLayout(i){return reduce(i,(function(i,u){return i||RegExp("\\b"+(u.pattern||qualify(u))+"\\b","i").exec(t)&&(u.label||u)}))}([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"]),j=function getName(i){return reduce(i,(function(i,u){return i||RegExp("\\b"+(u.pattern||qualify(u))+"\\b","i").exec(t)&&(u.label||u)}))}(["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"]),K=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"]),q=function getManufacturer(i){return reduce(i,(function(i,u,_){return i||(u[K]||u[/^[a-z]+(?: +[a-z]+\b)*/i.exec(K)]||RegExp("\\b"+qualify(_)+"(?:\\b|\\w*\\d)","i").exec(t))&&_}))}({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}}),W=function getOS(i){return reduce(i,(function(i,u){var _=u.pattern||qualify(u);return!i&&(i=RegExp("\\b"+_+"(?:/[\\d.]+|[ \\w.]*)","i").exec(t))&&(i=function cleanupOS(t,i,u){var _={"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 i&&u&&/^Win/i.test(t)&&!/^Windows Phone /i.test(t)&&(_=_[/[\d.]+$/.exec(t)])&&(t="Windows "+_),t=String(t),i&&u&&(t=t.replace(RegExp(i,"i"),u)),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])}(i,_,u.label||u)),i}))}(["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(i){return reduce(i,(function(i,u){var _=u.pattern||qualify(u);return!i&&(i=RegExp("\\b"+_+" *\\d+[.\\w_]*","i").exec(t)||RegExp("\\b"+_+" *\\w+-[\\w]*","i").exec(t)||RegExp("\\b"+_+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(t))&&((i=String(u.label&&!RegExp(_,"i").test(u.label)?u.label:i).split("/"))[1]&&!/[\d.]+/.test(i[0])&&(i[0]+=" "+i[1]),u=u.label||u,i=format(i[0].replace(RegExp(_,"i"),u).replace(RegExp("; *(?:"+u+"[_-])?","i")," ").replace(RegExp("("+u+")[-_.]?(\\w)","i"),"$1 $2"))),i}))}function getVersion(i){return reduce(i,(function(i,u){return i||(RegExp(u+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(t)||0)[1]||null}))}if(Y&&(Y=[Y]),/\bAndroid\b/.test(W)&&!K&&(m=/\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(t))&&(K=trim(m[1]).replace(/^[a-z]{2}-[a-z]{2};\s*/i,"")||null),q&&!K?K=getProduct([q]):q&&K&&(K=K.replace(RegExp("^("+qualify(q)+")[-_.\\s]","i"),q+" ").replace(RegExp("^("+qualify(q)+")[-_.]?(\\w)","i"),q+" $2")),(m=/\bGoogle TV\b/.exec(K))&&(K=m[0]),/\bSimulator\b/i.test(t)&&(K=(K?K+" ":"")+"Simulator"),"Opera Mini"==j&&/\bOPiOS\b/.test(t)&&U.push("running in Turbo/Uncompressed mode"),"IE"==j&&/\blike iPhone OS\b/.test(t)?(q=(m=parse(t.replace(/like iPhone OS/,""))).manufacturer,K=m.product):/^iP/.test(K)?(j||(j="Safari"),W="iOS"+((m=/ OS ([\d_]+)/i.exec(t))?" "+m[1].replace(/_/g,"."):"")):"Konqueror"==j&&/^Linux\b/i.test(W)?W="Kubuntu":q&&"Google"!=q&&(/Chrome/.test(j)&&!/\bMobile Safari\b/i.test(t)||/\bVita\b/.test(K))||/\bAndroid\b/.test(W)&&/^Chrome/.test(j)&&/\bVersion\//i.test(t)?(j="Android Browser",W=/\bAndroid\b/.test(W)?W:"Android"):"Silk"==j?(/\bMobi/i.test(t)||(W="Android",U.unshift("desktop mode")),/Accelerated *= *true/i.test(t)&&U.unshift("accelerated")):"UC Browser"==j&&/\bUCWEB\b/.test(t)?U.push("speed mode"):"PaleMoon"==j&&(m=/\bFirefox\/([\d.]+)\b/.exec(t))?U.push("identifying as Firefox "+m[1]):"Firefox"==j&&(m=/\b(Mobile|Tablet|TV)\b/i.exec(t))?(W||(W="Firefox OS"),K||(K=m[1])):!j||(m=!/\bMinefield\b/i.test(t)&&/\b(?:Firefox|Safari)\b/.exec(j))?(j&&!K&&/[\/,]|^[^(]+?\)/.test(t.slice(t.indexOf(m+"/")+8))&&(j=null),(m=K||q||W)&&(K||q||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(W))&&(j=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(W)?W:m)+" Browser")):"Electron"==j&&(m=(/\bChrome\/([\d.]+)\b/.exec(t)||0)[1])&&U.push("Chromium "+m),H||(H=getVersion(["(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)","Version",qualify(j),"(?:Firefox|Minefield|NetFront)"])),(m=("iCab"==Y&&parseFloat(H)>3?"WebKit":/\bOpera\b/.test(j)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(Y)&&"WebKit"||!Y&&/\bMSIE\b/i.test(t)&&("Mac OS"==W?"Tasman":"Trident")||"WebKit"==Y&&/\bPlayStation\b(?! Vita\b)/i.test(j)&&"NetFront")&&(Y=[m]),"IE"==j&&(m=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(j+=" Mobile",W="Windows Phone "+(/\+$/.test(m)?m:m+".x"),U.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(j="IE Mobile",W="Windows Phone 8.x",U.unshift("desktop mode"),H||(H=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=j&&"Trident"==Y&&(m=/\brv:([\d.]+)/.exec(t))&&(j&&U.push("identifying as "+j+(H?" "+H:"")),j="IE",H=m[1]),B){if(function isHostType(t,i){var u=null!=t?typeof t[i]:"number";return!(/^(?:boolean|number|string|undefined)$/.test(u)||"object"==u&&!t[i])}(i,"global"))if(C&&(x=(m=C.lang.System).getProperty("os.arch"),W=W||m.getProperty("os.name")+" "+m.getProperty("os.version")),L){try{H=i.require("ringo/engine").version.join("."),j="RingoJS"}catch(t){(m=i.system)&&m.global.system==i.system&&(j="Narwhal",W||(W=m[0].os||null))}j||(j="Rhino")}else"object"==typeof i.process&&!i.process.browser&&(m=i.process)&&("object"==typeof m.versions&&("string"==typeof m.versions.electron?(U.push("Node "+m.versions.node),j="Electron",H=m.versions.electron):"string"==typeof m.versions.nw&&(U.push("Chromium "+H,"Node "+m.versions.node),j="NW.js",H=m.versions.nw)),j||(j="Node.js",x=m.arch,W=m.platform,H=(H=/[\d.]+/.exec(m.version))?H[0]:null));else getClassOf(m=i.runtime)==O?(j="Adobe AIR",W=m.flash.system.Capabilities.os):getClassOf(m=i.phantom)==A?(j="PhantomJS",H=(m=m.version||null)&&m.major+"."+m.minor+"."+m.patch):"number"==typeof V.documentMode&&(m=/\bTrident\/(\d+)/i.exec(t))?(H=[H,V.documentMode],(m=+m[1]+4)!=H[1]&&(U.push("IE "+H[1]+" mode"),Y&&(Y[1]=""),H[1]=m),H="IE"==j?String(H[1].toFixed(1)):H[0]):"number"==typeof V.documentMode&&/^(?:Chrome|Firefox)\b/.test(j)&&(U.push("masking as "+j+" "+H),j="IE",H="11.0",Y=["Trident"],W="Windows");W=W&&format(W)}if(H&&(m=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(H)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(B&&h.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(G=/b/i.test(m)?"beta":"alpha",H=H.replace(RegExp(m+"\\+?$"),"")+("beta"==G?D:k)+(/\d+\+?/.exec(m)||"")),"Fennec"==j||"Firefox"==j&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(W))j="Firefox Mobile";else if("Maxthon"==j&&H)H=H.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(K))"Xbox 360"==K&&(W=null),"Xbox 360"==K&&/\bIEMobile\b/.test(t)&&U.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(j)&&(!j||K||/Browser|Mobi/.test(j))||"Windows CE"!=W&&!/Mobi/i.test(t))if("IE"==j&&B)try{null===i.external&&U.unshift("platform preview")}catch(t){U.unshift("embedded")}else(/\bBlackBerry\b/.test(K)||/\bBB10\b/.test(t))&&(m=(RegExp(K.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||H)?(W=((m=[m,/BB10/.test(t)])[1]?(K=null,q="BlackBerry"):"Device Software")+" "+m[0],H=null):this!=forOwn&&"Wii"!=K&&(B&&w||/Opera/.test(j)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==j&&/\bOS X (?:\d+\.){2,}/.test(W)||"IE"==j&&(W&&!/^Win/.test(W)&&H>5.5||/\bWindows XP\b/.test(W)&&H>8||8==H&&!/\bTrident\b/.test(t)))&&!v.test(m=parse.call(forOwn,t.replace(v,"")+";"))&&m.name&&(m="ing as "+m.name+((m=m.version)?" "+m:""),v.test(j)?(/\bIE\b/.test(m)&&"Mac OS"==W&&(W=null),m="identify"+m):(m="mask"+m,j=P?format(P.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(m)&&(W=null),B||(H=null)),Y=["Presto"],U.push(m));else j+=" Mobile";(m=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(m=[parseFloat(m.replace(/\.(\d)$/,".0$1")),m],"Safari"==j&&"+"==m[1].slice(-1)?(j="WebKit Nightly",G="alpha",H=m[1].slice(0,-1)):H!=m[1]&&H!=(m[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(H=null),m[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==m[0]&&537.36==m[2]&&parseFloat(m[1])>=28&&"WebKit"==Y&&(Y=["Blink"]),B&&(T||m[1])?(Y&&(Y[1]="like Chrome"),m=m[1]||((m=m[0])<530?1:m<532?2:m<532.05?3:m<533?4:m<534.03?5:m<534.07?6:m<534.1?7:m<534.13?8:m<534.16?9:m<534.24?10:m<534.3?11:m<535.01?12:m<535.02?"13+":m<535.07?15:m<535.11?16:m<535.19?17:m<536.05?18:m<536.1?19:m<537.01?20:m<537.11?"21+":m<537.13?23:m<537.18?24:m<537.24?25:m<537.36?26:"Blink"!=Y?"27":"28")):(Y&&(Y[1]="like Safari"),m=(m=m[0])<400?1:m<500?2:m<526?3:m<533?4:m<534?"4+":m<535?5:m<537?6:m<538?7:m<601?8:m<602?9:m<604?10:m<606?11:m<608?12:"12"),Y&&(Y[1]+=" "+(m+="number"==typeof m?".x":/[.+]/.test(m)?"":"+")),"Safari"==j&&(!H||parseInt(H)>45)?H=m:"Chrome"==j&&/\bHeadlessChrome/i.test(t)&&U.unshift("headless")),"Opera"==j&&(m=/\bzbov|zvav$/.exec(W))?(j+=" ",U.unshift("desktop mode"),"zvav"==m?(j+="Mini",H=null):j+="Mobile",W=W.replace(RegExp(" *"+m+"$"),"")):"Safari"==j&&/\bChrome\b/.exec(Y&&Y[1])?(U.unshift("desktop mode"),j="Chrome Mobile",H=null,/\bOS X\b/.test(W)?(q="Apple",W="iOS 4.3+"):W=null):/\bSRWare Iron\b/.test(j)&&!H&&(H=getVersion("Chrome")),H&&0==H.indexOf(m=/[\d.]+$/.exec(W))&&t.indexOf("/"+m+"-")>-1&&(W=trim(W.replace(m,""))),W&&-1!=W.indexOf(j)&&!RegExp(j+" OS").test(W)&&(W=W.replace(RegExp(" *"+qualify(j)+" *"),"")),Y&&!/\b(?:Avant|Nook)\b/.test(j)&&(/Browser|Lunascape|Maxthon/.test(j)||"Safari"!=j&&/^iOS/.test(W)&&/\bSafari\b/.test(Y[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(j)&&Y[1])&&(m=Y[Y.length-1])&&U.push(m),U.length&&(U=["("+U.join("; ")+")"]),q&&K&&K.indexOf(q)<0&&U.push("on "+q),K&&U.push((/^on /.test(U[U.length-1])?"":"on ")+K),W&&(m=/ ([\d.+]+)$/.exec(W),I=m&&"/"==W.charAt(W.length-m[0].length-1),W={architecture:32,family:m&&!I?W.replace(m[0],""):W,version:m?m[1]:null,toString:function(){var t=this.version;return this.family+(t&&!I?" "+t:"")+(64==this.architecture?" 64-bit":"")}}),(m=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(x))&&!/\bi686\b/i.test(x)?(W&&(W.architecture=64,W.family=W.family.replace(RegExp(" *"+m),"")),j&&(/\bWOW64\b/i.test(t)||B&&/\w(?:86|32)$/.test(h.cpuClass||h.platform)&&!/\bWin64; x64\b/i.test(t))&&U.unshift("32-bit")):W&&/^OS X/.test(W.family)&&"Chrome"==j&&parseFloat(H)>=39&&(W.architecture=64),t||(t=null);var z={};return z.description=t,z.layout=Y&&Y[0],z.manufacturer=q,z.name=j,z.prerelease=G,z.product=K,z.ua=t,z.version=j&&H,z.os=W||{architecture:null,family:null,version:null,toString:function(){return"null"}},z.parse=parse,z.toString=function toStringPlatform(){return this.description||""},z.version&&U.unshift(H),z.name&&U.unshift(j),W&&j&&(W!=String(W).split(" ")[0]||W!=j.split(" ")[0]&&!K)&&U.push(K?"("+W+")":"on "+W),U.length&&(z.description=U.join(" ")),z}();h&&E?forOwn(O,(function(t,i){h[i]=t})):_.platform=O}).call(i)}));function getSystemInfoFn(){var t,i,u=Fh.version||"";if(isElectron())try{var _=navigator.userAgent.match(/Electron\/([\d.]+\d+)/);_&&_[1]&&"string"==typeof _[1]&&(u=_[1])}catch(t){}return{os:(null===(t=Fh.os)||void 0===t?void 0:t.family)||"",osVer:(null===(i=Fh.os)||void 0===i?void 0:i.version)||"",browser:Fh.name||"",browserVer:Fh.version||"",libEnv:"BROWSER",hostEnv:isElectron()?"Electron":isMobile()?"H5":isBrowser()?"BROWSER":"Unset",hostEnvEnum:isElectron()?5:isMobile()?101:isBrowser()?100:0,hostEnvVer:u,userAgent:navigator&&navigator.userAgent,model:u,manufactor:Fh.name||""}}var Gh=null,Bh=null,Hh={getNetworkStatus:function getNetworkStatus(){return pa.resolve({net_type:0,net_connect:"undefined"==typeof navigator||"boolean"!=typeof navigator.onLine||navigator.onLine})},onNetworkStatusChange:function onNetworkStatusChange(t){Gh=function onlineListener(){t({isConnected:!0,networkType:0})},Bh=function offlineListener(){t({isConnected:!1,networkType:0})},window.addEventListener("online",Gh),window.addEventListener("offline",Bh)},offNetworkStatusChange:function offNetworkStatusChange(){Gh&&window.removeEventListener("online",Gh),Bh&&window.removeEventListener("offline",Bh),Gh=null,Bh=null}},Yh=getLogger(),jh=function getVisibilityEvent(){var t="hidden",i="visibilitychange";return"undefined"==typeof document||void 0!==document.hidden||(void 0!==document.webkitHidden?(t="webkitHidden",i="webkitvisibilitychange"):void 0!==document.msHidden?(t="msHidden",i="msvisibilitychange"):void 0!==document.mozHidden&&(t="mozHidden",i="mozvisibilitychange")),{hidden:t,visibilityChange:i}},Kh=function(t){function PowerMonitor(){var i;return(i=t.call(this)||this).status=0,i.visibilityListener=null,i.flag=!1,i._initVisibilityListener(),i}bt(PowerMonitor,t);var i=PowerMonitor.prototype;return i.isActive=function isActive(){return 0===this.status},i.getStatus=function getStatus(){return this.status},i.setStatus=function setStatus(t){var i=this.status;t!==i&&(this.status=t,0===t&&1===i&&this.emit("onPowerMonitorTurnActive"),Yh.log("Adapter powerMonitor::setStatus: ",t))},i.destroy=function destroy(){if(this.status=0,this.flag=!1,this._canIUse()&&this.visibilityListener){var t=jh().visibilityChange;document.removeEventListener(t,this.visibilityListener),this.visibilityListener=null}},i._initVisibilityListener=function _initVisibilityListener(){if(!this.flag)if(!1!==this._canIUse()){var t=jh(),i=t.hidden,u=t.visibilityChange;i&&void 0!==document[i]&&(this.visibilityListener=function genVisibilityListener(t){return function(){var i=t.status,u=jh().hidden;u&&document[u]?t.status=1:(t.status=0,1===i&&t.emit("onPowerMonitorTurnActive")),Yh.log("Adapter powerMonitor::visibility change status:",t.status)}}(this),document.addEventListener(u,this.visibilityListener),this.flag=!0,Yh.log("Adapter powerMonitor::_initVisibilityListener success, isHidden:",null===document||void 0===document?void 0:document[i]))}else Yh.warn("Adapter powerMonitor::_initVisibilityListener no document.addEventListener")},i._canIUse=function _canIUse(){return"undefined"!=typeof document&&void 0!==document.addEventListener},PowerMonitor}(ql),qh="log",Wh=function(){function IDB(t,i){this.db=null,this.stores=[],this.name=t,this.version=i}var t=IDB.prototype;return t.getDB=function getDB(){if(!this.db)throw new Error("DB not ready");return this.db},t.getStore=function getStore(t){var i,u=find(i=this.stores).call(i,(function(i){return i.storeName===t}));if(!u)throw new Error("LogStorage: store not found. "+t);return u},t.open=function open(){var t=this,i=window.indexedDB.open(this.name,this.version);return new pa((function(u,_){i.onerror=function(t){var i=t.target;_(i.error)},i.onsuccess=function(i){var _,h,E=i.target;t.db=E.result,t.db.removeEventListener("close",bind$1(_=t.triggerDBCloseEvt).call(_,t)),t.db.addEventListener("close",bind$1(h=t.triggerDBCloseEvt).call(h,t)),t.stores.push(new zh(qh,t)),u()},i.onupgradeneeded=function(i){var u=i.target;t.upgradeDBBySchema(u)}}))},t.triggerDBCloseEvt=function triggerDBCloseEvt(){try{this.db&&this.db.close(),this.db=null}catch(t){}this.open()},t.upgradeDBBySchema=function upgradeDBBySchema(t){var i=t.result,u=t.transaction&&i.objectStoreNames.contains(qh)?t.transaction.objectStore(qh):i.createObjectStore(qh,{keyPath:"id",autoIncrement:!0});try{u.index("time")}catch(t){u.createIndex("time","time",{unique:!1})}},t.close=function close(){var t;this.db&&(this.db.removeEventListener("close",bind$1(t=this.triggerDBCloseEvt).call(t,this)),this.db.close(),this.stores=[],this.db=null)},IDB}(),zh=function(){function IDBStore(t,i){this.idb=null,this.storeName=t,this.idb=i}var t=IDBStore.prototype;return t.getDB=function getDB(){if(!this.idb)throw new Error("DB not ready");return this.idb.getDB()},t.getStoreName=function getStoreName(){return this.storeName},t.bulkCreate=function bulkCreate(t){var i=this.getDB(),u=this.getStoreName(),_=i.transaction(u,"readwrite"),h=_.objectStore(u);return forEach$1(t).call(t,(function(t){h.add(t)})),new pa((function(t,i){_.oncomplete=function(){t()},_.onerror=function(t){var u=t.target;i(u.error)},_.onabort=function(t){var u=t.target;u.error instanceof Error?i(u.error):i(new Error("TransactionAborted"))}}))},t.bulkDelete=function bulkDelete(t){var i=t.keyName,u=t.lower,_=t.upper,h=t.lowerOpen,E=void 0!==h&&h,m=t.upperOpen,I=void 0!==m&&m,v=IDBKeyRange.bound(u,_,E,I),T=this.getDB(),N=this.getStoreName(),M=T.transaction(N,"readwrite"),O=M.objectStore(N).index(i).openCursor(v),S=0;return O.onsuccess=function(t){var i=t.target.result;i&&(i.delete(),S++,i.continue())},new pa((function(t,i){M.oncomplete=function(){t(S)},M.onerror=function(t){var u=t.target;i(u.error)},M.onabort=function(t){var u=t.target;u.error instanceof Error?i(u.error):i(new Error("TransactionAborted"))}}))},t.readAll=function readAll(){var t=this.getDB(),i=this.getStoreName(),u=t.transaction(i,"readonly").objectStore(i);if(!u.getAll)throw new Error("IDBExtract not support");var _=u.getAll();return new pa((function(t,i){_.onsuccess=function(i){var u=i.target;t(u.result)},_.onerror=function(t){var u=t.target;i(u.error)}}))},IDBStore}(),$h=function(){function LogStorageImpl(t){this.logRetentionDays=10,this.idb=new Wh(t.logDirPath,1),this.logRetentionDays=t.logRetentionDays>=1?t.logRetentionDays:10}var t=LogStorageImpl.prototype;return t.open=function open(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee(){var t;return Ra.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.idb.open();case 2:return t=this.idb.getStore(qh),i.prev=3,i.next=6,t.bulkDelete({keyName:"time",lower:0,upper:Ka()-24*this.logRetentionDays*60*60*1e3});case 6:i.next=10;break;case 8:i.prev=8,i.t0=i.catch(3);case 10:case"end":return i.stop()}}),_callee,this,[[3,8]])})))},t.close=function close(){this.idb.close()},t.addLogs=function addLogs(t){return this.idb.getStore(qh).bulkCreate(t)},t.extractLogs=function extractLogs(){return __awaiter(this,void 0,void 0,Ra.mark((function _callee2(){var t,i,u,_,h;return Ra.wrap((function _callee2$(E){for(;;)switch(E.prev=E.next){case 0:return i=this.idb.getStore(qh),E.next=3,i.readAll();case 3:if(0!==(u=E.sent).length){E.next=6;break}return E.abrupt("return",void 0);case 6:return _=reduce(u).call(u,(function(t,i){var u=i.iid;return t[u]||(t[u]=[]),t[u].push(i),t}),{}),h=map$7(t=cs(_)).call(t,(function(t){var i=_[t];return"==========iid:"+t+"==========\n "+map$7(i).call(i,(function(t){return t.text})).join("\n")})).join("\n"),E.abrupt("return",new File([h],"nim-logs.txt",{type:"text/plain"}));case 9:case"end":return E.stop()}}),_callee2,this)})))},t.afterUpload=function afterUpload(){return pa.resolve()},LogStorageImpl}();!function setAdapters(t){merge$1(Os,t())}((function getAdapter(){return{setLogger:setLogger,platform:"BROWSER",localStorage:window.localStorage,request:vh,WebSocket:window.WebSocket,uploadFile:uploadFileFn,getFileUploadInformation:getFileUploadInformationFn,getSystemInfo:getSystemInfoFn,net:Hh,powerMonitor:new Kh,logStorage:$h}})),t.V2NIMChatroomConst=$d,t.default=Ih,Object.defineProperty(t,"__esModule",{value:!0})}));