@byteplus/rtc 4.45.0-blw.14 → 4.45.0-blw.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +70 -0
- package/index.d.ts +14 -1
- package/index.esm.min.js +2 -2
- package/index.min.js +2 -2
- package/package.json +1 -1
package/index.esm.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright (c) 2020 The BytePlusRTC project authors. All Rights Reserved.
|
|
3
3
|
* @brief BytePlusRTC Advance API
|
|
4
|
-
* version: 4.45.0-blw.
|
|
4
|
+
* version: 4.45.0-blw.15
|
|
5
5
|
*/
|
|
6
|
-
function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(i){if("default"!==i&&!(i in e)){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}))})),Object.freeze(e)}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})})),t}var r=function(e){return e&&e.Math==Math&&e},n=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")(),o={},a=function(e){try{return!!e()}catch(e){return!0}},s=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),c=!a((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),u=c,d=Function.prototype.call,l=u?d.bind(d):function(){return d.apply(d,arguments)},h={},p={}.propertyIsEnumerable,f=Object.getOwnPropertyDescriptor,_=f&&!p.call({1:2},1);h.f=_?function(e){var t=f(this,e);return!!t&&t.enumerable}:p;var v,m,y=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},g=c,S=Function.prototype,E=S.bind,b=S.call,I=g&&E.bind(b,b),T=g?function(e){return e&&I(e)}:function(e){return e&&function(){return b.apply(e,arguments)}},A=T,R=A({}.toString),C=A("".slice),O=function(e){return C(R(e),8,-1)},w=T,k=a,N=O,P=n.Object,D=w("".split),M=k((function(){return!P("z").propertyIsEnumerable(0)}))?function(e){return"String"==N(e)?D(e,""):P(e)}:P,L=n.TypeError,U=function(e){if(null==e)throw L("Can't call method on "+e);return e},x=M,V=U,F=function(e){return x(V(e))},B=function(e){return"function"==typeof e},j=B,G=function(e){return"object"==typeof e?null!==e:j(e)},H=n,z=B,K=function(e){return z(e)?e:void 0},W=function(e,t){return arguments.length<2?K(H[e]):H[e]&&H[e][t]},X=T({}.isPrototypeOf),q=W("navigator","userAgent")||"",Y=n,J=q,Q=Y.process,Z=Y.Deno,$=Q&&Q.versions||Z&&Z.version,ee=$&&$.v8;ee&&(m=(v=ee.split("."))[0]>0&&v[0]<4?1:+(v[0]+v[1])),!m&&J&&(!(v=J.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=J.match(/Chrome\/(\d+)/))&&(m=+v[1]);var te=m,ie=te,re=a,ne=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ie&&ie<41})),oe=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ae=W,se=B,ce=X,ue=oe,de=n.Object,le=ue?function(e){return"symbol"==typeof e}:function(e){var t=ae("Symbol");return se(t)&&ce(t.prototype,de(e))},he=n.String,pe=function(e){try{return he(e)}catch(e){return"Object"}},fe=B,_e=pe,ve=n.TypeError,me=function(e){if(fe(e))return e;throw ve(_e(e)+" is not a function")},ye=me,ge=function(e,t){var i=e[t];return null==i?void 0:ye(i)},Se=l,Ee=B,be=G,Ie=n.TypeError,Te={exports:{}},Ae=n,Re=Object.defineProperty,Ce=function(e,t){try{Re(Ae,e,{value:t,configurable:!0,writable:!0})}catch(i){Ae[e]=t}return t},Oe=Ce,we=n["__core-js_shared__"]||Oe("__core-js_shared__",{}),ke=we;(Te.exports=function(e,t){return ke[e]||(ke[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Ne=U,Pe=n.Object,De=function(e){return Pe(Ne(e))},Me=De,Le=T({}.hasOwnProperty),Ue=Object.hasOwn||function(e,t){return Le(Me(e),t)},xe=T,Ve=0,Fe=Math.random(),Be=xe(1..toString),je=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Be(++Ve+Fe,36)},Ge=n,He=Te.exports,ze=Ue,Ke=je,We=ne,Xe=oe,qe=He("wks"),Ye=Ge.Symbol,Je=Ye&&Ye.for,Qe=Xe?Ye:Ye&&Ye.withoutSetter||Ke,Ze=function(e){if(!ze(qe,e)||!We&&"string"!=typeof qe[e]){var t="Symbol."+e;We&&ze(Ye,e)?qe[e]=Ye[e]:qe[e]=Xe&&Je?Je(t):Qe(t)}return qe[e]},$e=l,et=G,tt=le,it=ge,rt=function(e,t){var i,r;if("string"===t&&Ee(i=e.toString)&&!be(r=Se(i,e)))return r;if(Ee(i=e.valueOf)&&!be(r=Se(i,e)))return r;if("string"!==t&&Ee(i=e.toString)&&!be(r=Se(i,e)))return r;throw Ie("Can't convert object to primitive value")},nt=Ze,ot=n.TypeError,at=nt("toPrimitive"),st=function(e,t){if(!et(e)||tt(e))return e;var i,r=it(e,at);if(r){if(void 0===t&&(t="default"),i=$e(r,e,t),!et(i)||tt(i))return i;throw ot("Can't convert object to primitive value")}return void 0===t&&(t="number"),rt(e,t)},ct=st,ut=le,dt=function(e){var t=ct(e,"string");return ut(t)?t:t+""},lt=G,ht=n.document,pt=lt(ht)&<(ht.createElement),ft=function(e){return pt?ht.createElement(e):{}},_t=ft,vt=!s&&!a((function(){return 7!=Object.defineProperty(_t("div"),"a",{get:function(){return 7}}).a})),mt=s,yt=l,gt=h,St=y,Et=F,bt=dt,It=Ue,Tt=vt,At=Object.getOwnPropertyDescriptor;o.f=mt?At:function(e,t){if(e=Et(e),t=bt(t),Tt)try{return At(e,t)}catch(e){}if(It(e,t))return St(!yt(gt.f,e,t),e[t])};var Rt={},Ct=s&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ot=n,wt=G,kt=Ot.String,Nt=Ot.TypeError,Pt=function(e){if(wt(e))return e;throw Nt(kt(e)+" is not an object")},Dt=s,Mt=vt,Lt=Ct,Ut=Pt,xt=dt,Vt=n.TypeError,Ft=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor;Rt.f=Dt?Lt?function(e,t,i){if(Ut(e),t=xt(t),Ut(i),"function"==typeof e&&"prototype"===t&&"value"in i&&"writable"in i&&!i.writable){var r=Bt(e,t);r&&r.writable&&(e[t]=i.value,i={configurable:"configurable"in i?i.configurable:r.configurable,enumerable:"enumerable"in i?i.enumerable:r.enumerable,writable:!1})}return Ft(e,t,i)}:Ft:function(e,t,i){if(Ut(e),t=xt(t),Ut(i),Mt)try{return Ft(e,t,i)}catch(e){}if("get"in i||"set"in i)throw Vt("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var jt=Rt,Gt=y,Ht=s?function(e,t,i){return jt.f(e,t,Gt(1,i))}:function(e,t,i){return e[t]=i,e},zt={exports:{}},Kt=B,Wt=we,Xt=T(Function.toString);Kt(Wt.inspectSource)||(Wt.inspectSource=function(e){return Xt(e)});var qt,Yt,Jt,Qt=Wt.inspectSource,Zt=B,$t=Qt,ei=n.WeakMap,ti=Zt(ei)&&/native code/.test($t(ei)),ii=Te.exports,ri=je,ni=ii("keys"),oi=function(e){return ni[e]||(ni[e]=ri(e))},ai={},si=ti,ci=n,ui=T,di=G,li=Ht,hi=Ue,pi=we,fi=oi,_i=ai,vi=ci.TypeError,mi=ci.WeakMap;if(si||pi.state){var yi=pi.state||(pi.state=new mi),gi=ui(yi.get),Si=ui(yi.has),Ei=ui(yi.set);qt=function(e,t){if(Si(yi,e))throw new vi("Object already initialized");return t.facade=e,Ei(yi,e,t),t},Yt=function(e){return gi(yi,e)||{}},Jt=function(e){return Si(yi,e)}}else{var bi=fi("state");_i[bi]=!0,qt=function(e,t){if(hi(e,bi))throw new vi("Object already initialized");return t.facade=e,li(e,bi,t),t},Yt=function(e){return hi(e,bi)?e[bi]:{}},Jt=function(e){return hi(e,bi)}}var Ii={set:qt,get:Yt,has:Jt,enforce:function(e){return Jt(e)?Yt(e):qt(e,{})},getterFor:function(e){return function(t){var i;if(!di(t)||(i=Yt(t)).type!==e)throw vi("Incompatible receiver, "+e+" required");return i}}},Ti=s,Ai=Ue,Ri=Function.prototype,Ci=Ti&&Object.getOwnPropertyDescriptor,Oi=Ai(Ri,"name"),wi={EXISTS:Oi,PROPER:Oi&&"something"===function(){}.name,CONFIGURABLE:Oi&&(!Ti||Ti&&Ci(Ri,"name").configurable)},ki=n,Ni=B,Pi=Ue,Di=Ht,Mi=Ce,Li=Qt,Ui=wi.CONFIGURABLE,xi=Ii.get,Vi=Ii.enforce,Fi=String(String).split("String");(zt.exports=function(e,t,i,r){var n,o=!!r&&!!r.unsafe,a=!!r&&!!r.enumerable,s=!!r&&!!r.noTargetGet,c=r&&void 0!==r.name?r.name:t;Ni(i)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Pi(i,"name")||Ui&&i.name!==c)&&Di(i,"name",c),(n=Vi(i)).source||(n.source=Fi.join("string"==typeof c?c:""))),e!==ki?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=i:Di(e,t,i)):a?e[t]=i:Mi(t,i)})(Function.prototype,"toString",(function(){return Ni(this)&&xi(this).source||Li(this)}));var Bi={},ji=Math.ceil,Gi=Math.floor,Hi=function(e){var t=+e;return t!=t||0===t?0:(t>0?Gi:ji)(t)},zi=Hi,Ki=Math.max,Wi=Math.min,Xi=function(e,t){var i=zi(e);return i<0?Ki(i+t,0):Wi(i,t)},qi=Hi,Yi=Math.min,Ji=function(e){return e>0?Yi(qi(e),9007199254740991):0},Qi=Ji,Zi=function(e){return Qi(e.length)},$i=F,er=Xi,tr=Zi,ir=function(e){return function(t,i,r){var n,o=$i(t),a=tr(o),s=er(r,a);if(e&&i!=i){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===i)return e||s||0;return!e&&-1}},rr={includes:ir(!0),indexOf:ir(!1)},nr=Ue,or=F,ar=rr.indexOf,sr=ai,cr=T([].push),ur=function(e,t){var i,r=or(e),n=0,o=[];for(i in r)!nr(sr,i)&&nr(r,i)&&cr(o,i);for(;t.length>n;)nr(r,i=t[n++])&&(~ar(o,i)||cr(o,i));return o},dr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],lr=ur,hr=dr.concat("length","prototype");Bi.f=Object.getOwnPropertyNames||function(e){return lr(e,hr)};var pr={};pr.f=Object.getOwnPropertySymbols;var fr=W,_r=Bi,vr=pr,mr=Pt,yr=T([].concat),gr=fr("Reflect","ownKeys")||function(e){var t=_r.f(mr(e)),i=vr.f;return i?yr(t,i(e)):t},Sr=Ue,Er=gr,br=o,Ir=Rt,Tr=function(e,t,i){for(var r=Er(t),n=Ir.f,o=br.f,a=0;a<r.length;a++){var s=r[a];Sr(e,s)||i&&Sr(i,s)||n(e,s,o(t,s))}},Ar=a,Rr=B,Cr=/#|\.prototype\./,Or=function(e,t){var i=kr[wr(e)];return i==Pr||i!=Nr&&(Rr(t)?Ar(t):!!t)},wr=Or.normalize=function(e){return String(e).replace(Cr,".").toLowerCase()},kr=Or.data={},Nr=Or.NATIVE="N",Pr=Or.POLYFILL="P",Dr=Or,Mr=n,Lr=o.f,Ur=Ht,xr=zt.exports,Vr=Ce,Fr=Tr,Br=Dr,jr=function(e,t){var i,r,n,o,a,s=e.target,c=e.global,u=e.stat;if(i=c?Mr:u?Mr[s]||Vr(s,{}):(Mr[s]||{}).prototype)for(r in t){if(o=t[r],n=e.noTargetGet?(a=Lr(i,r))&&a.value:i[r],!Br(c?r:s+(u?".":"#")+r,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;Fr(o,n)}(e.sham||n&&n.sham)&&Ur(o,"sham",!0),xr(i,r,o,e)}},Gr=me,Hr=c,zr=T(T.bind),Kr=function(e,t){return Gr(e),void 0===t?e:Hr?zr(e,t):function(){return e.apply(t,arguments)}},Wr=O,Xr=Array.isArray||function(e){return"Array"==Wr(e)},qr={};qr[Ze("toStringTag")]="z";var Yr="[object z]"===String(qr),Jr=n,Qr=Yr,Zr=B,$r=O,en=Ze("toStringTag"),tn=Jr.Object,rn="Arguments"==$r(function(){return arguments}()),nn=Qr?$r:function(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=tn(e),en))?i:rn?$r(t):"Object"==(r=$r(t))&&Zr(t.callee)?"Arguments":r},on=T,an=a,sn=B,cn=nn,un=Qt,dn=function(){},ln=[],hn=W("Reflect","construct"),pn=/^\s*(?:class|function)\b/,fn=on(pn.exec),_n=!pn.exec(dn),vn=function(e){if(!sn(e))return!1;try{return hn(dn,ln,e),!0}catch(e){return!1}},mn=function(e){if(!sn(e))return!1;switch(cn(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _n||!!fn(pn,un(e))}catch(e){return!0}};mn.sham=!0;var yn=!hn||an((function(){var e;return vn(vn.call)||!vn(Object)||!vn((function(){e=!0}))||e}))?mn:vn,gn=n,Sn=Xr,En=yn,bn=G,In=Ze("species"),Tn=gn.Array,An=function(e){var t;return Sn(e)&&(t=e.constructor,(En(t)&&(t===Tn||Sn(t.prototype))||bn(t)&&null===(t=t[In]))&&(t=void 0)),void 0===t?Tn:t},Rn=function(e,t){return new(An(e))(0===t?0:t)},Cn=Kr,On=M,wn=De,kn=Zi,Nn=Rn,Pn=T([].push),Dn=function(e){var t=1==e,i=2==e,r=3==e,n=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,p,f=wn(c),_=On(f),v=Cn(u,d),m=kn(_),y=0,g=l||Nn,S=t?g(c,m):i||a?g(c,0):void 0;m>y;y++)if((s||y in _)&&(p=v(h=_[y],y,f),e))if(t)S[y]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:Pn(S,h)}else switch(e){case 4:return!1;case 7:Pn(S,h)}return o?-1:r||n?n:S}},Mn={forEach:Dn(0),map:Dn(1),filter:Dn(2),some:Dn(3),every:Dn(4),find:Dn(5),findIndex:Dn(6),filterReject:Dn(7)},Ln=a,Un=function(e,t){var i=[][e];return!!i&&Ln((function(){i.call(null,t||function(){throw 1},1)}))},xn=Mn.forEach,Vn=Un("forEach")?[].forEach:function(e){return xn(this,e,arguments.length>1?arguments[1]:void 0)};jr({target:"Array",proto:!0,forced:[].forEach!=Vn},{forEach:Vn});var Fn=nn,Bn=Yr?{}.toString:function(){return"[object "+Fn(this)+"]"},jn=Yr,Gn=zt.exports,Hn=Bn;jn||Gn(Object.prototype,"toString",Hn,{unsafe:!0});var zn={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},Kn=ft("span").classList,Wn=Kn&&Kn.constructor&&Kn.constructor.prototype,Xn=Wn===Object.prototype?void 0:Wn,qn=n,Yn=zn,Jn=Xn,Qn=Vn,Zn=Ht,$n=function(e){if(e&&e.forEach!==Qn)try{Zn(e,"forEach",Qn)}catch(t){e.forEach=Qn}};for(var eo in Yn)Yn[eo]&&$n(qn[eo]&&qn[eo].prototype);$n(Jn);var to={},io=ur,ro=dr,no=Object.keys||function(e){return io(e,ro)},oo=s,ao=Ct,so=Rt,co=Pt,uo=F,lo=no;to.f=oo&&!ao?Object.defineProperties:function(e,t){co(e);for(var i,r=uo(t),n=lo(t),o=n.length,a=0;o>a;)so.f(e,i=n[a++],r[i]);return e};var ho,po=W("document","documentElement"),fo=Pt,_o=to,vo=dr,mo=ai,yo=po,go=ft,So=oi("IE_PROTO"),Eo=function(){},bo=function(e){return"<script>"+e+"<\/script>"},Io=function(e){e.write(bo("")),e.close();var t=e.parentWindow.Object;return e=null,t},To=function(){try{ho=new ActiveXObject("htmlfile")}catch(e){}var e,t;To="undefined"!=typeof document?document.domain&&ho?Io(ho):((t=go("iframe")).style.display="none",yo.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(bo("document.F=Object")),e.close(),e.F):Io(ho);for(var i=vo.length;i--;)delete To.prototype[vo[i]];return To()};mo[So]=!0;var Ao=Object.create||function(e,t){var i;return null!==e?(Eo.prototype=fo(e),i=new Eo,Eo.prototype=null,i[So]=e):i=To(),void 0===t?i:_o.f(i,t)},Ro=Ao,Co=Rt,Oo=Ze("unscopables"),wo=Array.prototype;null==wo[Oo]&&Co.f(wo,Oo,{configurable:!0,value:Ro(null)});var ko=function(e){wo[Oo][e]=!0},No=rr.includes,Po=ko;jr({target:"Array",proto:!0},{includes:function(e){return No(this,e,arguments.length>1?arguments[1]:void 0)}}),Po("includes");var Do=G,Mo=O,Lo=Ze("match"),Uo=function(e){var t;return Do(e)&&(void 0!==(t=e[Lo])?!!t:"RegExp"==Mo(e))},xo=Uo,Vo=n.TypeError,Fo=function(e){if(xo(e))throw Vo("The method doesn't accept regular expressions");return e},Bo=nn,jo=n.String,Go=function(e){if("Symbol"===Bo(e))throw TypeError("Cannot convert a Symbol value to a string");return jo(e)},Ho=Ze("match"),zo=function(e){var t=/./;try{"/./"[e](t)}catch(i){try{return t[Ho]=!1,"/./"[e](t)}catch(e){}}return!1},Ko=jr,Wo=Fo,Xo=U,qo=Go,Yo=zo,Jo=T("".indexOf);Ko({target:"String",proto:!0,forced:!Yo("includes")},{includes:function(e){return!!~Jo(qo(Xo(this)),qo(Wo(e)),arguments.length>1?arguments[1]:void 0)}});var Qo=Pt,Zo=function(){var e=Qo(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},$o=a,ea=n.RegExp,ta=$o((function(){var e=ea("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),ia=ta||$o((function(){return!ea("a","y").sticky})),ra={BROKEN_CARET:ta||$o((function(){var e=ea("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:ia,UNSUPPORTED_Y:ta},na=a,oa=n.RegExp,aa=na((function(){var e=oa(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),sa=a,ca=n.RegExp,ua=sa((function(){var e=ca("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),da=l,la=T,ha=Go,pa=Zo,fa=ra,_a=Te.exports,va=Ao,ma=Ii.get,ya=aa,ga=ua,Sa=_a("native-string-replace",String.prototype.replace),Ea=RegExp.prototype.exec,ba=Ea,Ia=la("".charAt),Ta=la("".indexOf),Aa=la("".replace),Ra=la("".slice),Ca=function(){var e=/a/,t=/b*/g;return da(Ea,e,"a"),da(Ea,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Oa=fa.BROKEN_CARET,wa=void 0!==/()??/.exec("")[1];(Ca||wa||Oa||ya||ga)&&(ba=function(e){var t,i,r,n,o,a,s,c=this,u=ma(c),d=ha(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=da(ba,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=Oa&&c.sticky,f=da(pa,c),_=c.source,v=0,m=d;if(p&&(f=Aa(f,"y",""),-1===Ta(f,"g")&&(f+="g"),m=Ra(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Ia(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),i=new RegExp("^(?:"+_+")",f)),wa&&(i=new RegExp("^"+_+"$(?!\\s)",f)),Ca&&(r=c.lastIndex),n=da(Ea,p?i:c,m),p?n?(n.input=Ra(n.input,v),n[0]=Ra(n[0],v),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:Ca&&n&&(c.lastIndex=c.global?n.index+n[0].length:r),wa&&n&&n.length>1&&da(Sa,n[0],i,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n&&h)for(n.groups=a=va(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=n[s[1]];return n});var ka=ba;jr({target:"RegExp",proto:!0,forced:/./.exec!==ka},{exec:ka});var Na=T,Pa=zt.exports,Da=ka,Ma=a,La=Ze,Ua=Ht,xa=La("species"),Va=RegExp.prototype,Fa=function(e,t,i,r){var n=La(e),o=!Ma((function(){var t={};return t[n]=function(){return 7},7!=""[e](t)})),a=o&&!Ma((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[xa]=function(){return i},i.flags="",i[n]=/./[n]),i.exec=function(){return t=!0,null},i[n](""),!t}));if(!o||!a||i){var s=Na(/./[n]),c=t(n,""[e],(function(e,t,i,r,n){var a=Na(e),c=t.exec;return c===Da||c===Va.exec?o&&!n?{done:!0,value:s(t,i,r)}:{done:!0,value:a(i,t,r)}:{done:!1}}));Pa(String.prototype,e,c[0]),Pa(Va,n,c[1])}r&&Ua(Va[n],"sham",!0)},Ba=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},ja=l,Ga=Pt,Ha=B,za=O,Ka=ka,Wa=n.TypeError,Xa=function(e,t){var i=e.exec;if(Ha(i)){var r=ja(i,e,t);return null!==r&&Ga(r),r}if("RegExp"===za(e))return ja(Ka,e,t);throw Wa("RegExp#exec called on incompatible receiver")},qa=l,Ya=Pt,Ja=U,Qa=Ba,Za=Go,$a=ge,es=Xa;Fa("search",(function(e,t,i){return[function(t){var i=Ja(this),r=null==t?void 0:$a(t,e);return r?qa(r,t,i):new RegExp(t)[e](Za(i))},function(e){var r=Ya(this),n=Za(e),o=i(t,r,n);if(o.done)return o.value;var a=r.lastIndex;Qa(a,0)||(r.lastIndex=0);var s=es(r,n);return Qa(r.lastIndex,a)||(r.lastIndex=a),null===s?-1:s.index}]}));var ts=jr,is=rr.indexOf,rs=Un,ns=T([].indexOf),os=!!ns&&1/ns([1],1,-0)<0,as=rs("indexOf");ts({target:"Array",proto:!0,forced:os||!as},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return os?ns(this,e,t)||0:is(this,e,t)}});var ss=jr,cs=T,us=n.Date,ds=cs(us.prototype.getTime);ss({target:"Date",stat:!0},{now:function(){return ds(new us)}});var ls=T,hs=zt.exports,ps=Date.prototype,fs=ls(ps.toString),_s=ls(ps.getTime);function vs(e){return vs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vs(e)}"Invalid Date"!=String(new Date(NaN))&&hs(ps,"toString",(function(){var e=_s(this);return e==e?fs(this):"Invalid Date"}));var ms=n,ys=B,gs=ms.String,Ss=ms.TypeError,Es=T,bs=Pt,Is=function(e){if("object"==typeof e||ys(e))return e;throw Ss("Can't set "+gs(e)+" as a prototype")},Ts=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=Es(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(i,[]),t=i instanceof Array}catch(e){}return function(i,r){return bs(i),Is(r),t?e(i,r):i.__proto__=r,i}}():void 0);jr({target:"Object",stat:!0},{setPrototypeOf:Ts}),jr({target:"Object",stat:!0,sham:!s},{create:Ao});var As=s,Rs=T,Cs=l,Os=a,ws=no,ks=pr,Ns=h,Ps=De,Ds=M,Ms=Object.assign,Ls=Object.defineProperty,Us=Rs([].concat),xs=!Ms||Os((function(){if(As&&1!==Ms({b:1},Ms(Ls({},"a",{enumerable:!0,get:function(){Ls(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol(),r="abcdefghijklmnopqrst";return e[i]=7,r.split("").forEach((function(e){t[e]=e})),7!=Ms({},e)[i]||ws(Ms({},t)).join("")!=r}))?function(e,t){for(var i=Ps(e),r=arguments.length,n=1,o=ks.f,a=Ns.f;r>n;)for(var s,c=Ds(arguments[n++]),u=o?Us(ws(c),o(c)):ws(c),d=u.length,l=0;d>l;)s=u[l++],As&&!Cs(a,c,s)||(i[s]=c[s]);return i}:Ms,Vs=xs;jr({target:"Object",stat:!0,forced:Object.assign!==Vs},{assign:Vs});var Fs=c,Bs=Function.prototype,js=Bs.apply,Gs=Bs.call,Hs="object"==typeof Reflect&&Reflect.apply||(Fs?Gs.bind(js):function(){return Gs.apply(js,arguments)}),zs={},Ks=dt,Ws=Rt,Xs=y,qs=function(e,t,i){var r=Ks(t);r in e?Ws.f(e,r,Xs(0,i)):e[r]=i},Ys=Xi,Js=Zi,Qs=qs,Zs=n.Array,$s=Math.max,ec=function(e,t,i){for(var r=Js(e),n=Ys(t,r),o=Ys(void 0===i?r:i,r),a=Zs($s(o-n,0)),s=0;n<o;n++,s++)Qs(a,s,e[n]);return a.length=s,a},tc=O,ic=F,rc=Bi.f,nc=ec,oc="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];zs.f=function(e){return oc&&"Window"==tc(e)?function(e){try{return rc(e)}catch(e){return nc(oc)}}(e):rc(ic(e))};var ac=T([].slice),sc={},cc=Ze;sc.f=cc;var uc=n,dc=Ue,lc=sc,hc=Rt.f,pc=function(e){var t=uc.Symbol||(uc.Symbol={});dc(t,e)||hc(t,e,{value:lc.f(e)})},fc=Rt.f,_c=Ue,vc=Ze("toStringTag"),mc=function(e,t,i){e&&!i&&(e=e.prototype),e&&!_c(e,vc)&&fc(e,vc,{configurable:!0,value:t})},yc=jr,gc=n,Sc=W,Ec=Hs,bc=l,Ic=T,Tc=s,Ac=ne,Rc=a,Cc=Ue,Oc=Xr,wc=B,kc=G,Nc=X,Pc=le,Dc=Pt,Mc=De,Lc=F,Uc=dt,xc=Go,Vc=y,Fc=Ao,Bc=no,jc=Bi,Gc=zs,Hc=pr,zc=o,Kc=Rt,Wc=to,Xc=h,qc=ac,Yc=zt.exports,Jc=Te.exports,Qc=ai,Zc=je,$c=Ze,eu=sc,tu=pc,iu=mc,ru=Ii,nu=Mn.forEach,ou=oi("hidden"),au=$c("toPrimitive"),su=ru.set,cu=ru.getterFor("Symbol"),uu=Object.prototype,du=gc.Symbol,lu=du&&du.prototype,hu=gc.TypeError,pu=gc.QObject,fu=Sc("JSON","stringify"),_u=zc.f,vu=Kc.f,mu=Gc.f,yu=Xc.f,gu=Ic([].push),Su=Jc("symbols"),Eu=Jc("op-symbols"),bu=Jc("string-to-symbol-registry"),Iu=Jc("symbol-to-string-registry"),Tu=Jc("wks"),Au=!pu||!pu.prototype||!pu.prototype.findChild,Ru=Tc&&Rc((function(){return 7!=Fc(vu({},"a",{get:function(){return vu(this,"a",{value:7}).a}})).a}))?function(e,t,i){var r=_u(uu,t);r&&delete uu[t],vu(e,t,i),r&&e!==uu&&vu(uu,t,r)}:vu,Cu=function(e,t){var i=Su[e]=Fc(lu);return su(i,{type:"Symbol",tag:e,description:t}),Tc||(i.description=t),i},Ou=function(e,t,i){e===uu&&Ou(Eu,t,i),Dc(e);var r=Uc(t);return Dc(i),Cc(Su,r)?(i.enumerable?(Cc(e,ou)&&e[ou][r]&&(e[ou][r]=!1),i=Fc(i,{enumerable:Vc(0,!1)})):(Cc(e,ou)||vu(e,ou,Vc(1,{})),e[ou][r]=!0),Ru(e,r,i)):vu(e,r,i)},wu=function(e,t){Dc(e);var i=Lc(t),r=Bc(i).concat(Du(i));return nu(r,(function(t){Tc&&!bc(ku,i,t)||Ou(e,t,i[t])})),e},ku=function(e){var t=Uc(e),i=bc(yu,this,t);return!(this===uu&&Cc(Su,t)&&!Cc(Eu,t))&&(!(i||!Cc(this,t)||!Cc(Su,t)||Cc(this,ou)&&this[ou][t])||i)},Nu=function(e,t){var i=Lc(e),r=Uc(t);if(i!==uu||!Cc(Su,r)||Cc(Eu,r)){var n=_u(i,r);return!n||!Cc(Su,r)||Cc(i,ou)&&i[ou][r]||(n.enumerable=!0),n}},Pu=function(e){var t=mu(Lc(e)),i=[];return nu(t,(function(e){Cc(Su,e)||Cc(Qc,e)||gu(i,e)})),i},Du=function(e){var t=e===uu,i=mu(t?Eu:Lc(e)),r=[];return nu(i,(function(e){!Cc(Su,e)||t&&!Cc(uu,e)||gu(r,Su[e])})),r};(Ac||(Yc(lu=(du=function(){if(Nc(lu,this))throw hu("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?xc(arguments[0]):void 0,t=Zc(e),i=function(e){this===uu&&bc(i,Eu,e),Cc(this,ou)&&Cc(this[ou],t)&&(this[ou][t]=!1),Ru(this,t,Vc(1,e))};return Tc&&Au&&Ru(uu,t,{configurable:!0,set:i}),Cu(t,e)}).prototype,"toString",(function(){return cu(this).tag})),Yc(du,"withoutSetter",(function(e){return Cu(Zc(e),e)})),Xc.f=ku,Kc.f=Ou,Wc.f=wu,zc.f=Nu,jc.f=Gc.f=Pu,Hc.f=Du,eu.f=function(e){return Cu($c(e),e)},Tc&&(vu(lu,"description",{configurable:!0,get:function(){return cu(this).description}}),Yc(uu,"propertyIsEnumerable",ku,{unsafe:!0}))),yc({global:!0,wrap:!0,forced:!Ac,sham:!Ac},{Symbol:du}),nu(Bc(Tu),(function(e){tu(e)})),yc({target:"Symbol",stat:!0,forced:!Ac},{for:function(e){var t=xc(e);if(Cc(bu,t))return bu[t];var i=du(t);return bu[t]=i,Iu[i]=t,i},keyFor:function(e){if(!Pc(e))throw hu(e+" is not a symbol");if(Cc(Iu,e))return Iu[e]},useSetter:function(){Au=!0},useSimple:function(){Au=!1}}),yc({target:"Object",stat:!0,forced:!Ac,sham:!Tc},{create:function(e,t){return void 0===t?Fc(e):wu(Fc(e),t)},defineProperty:Ou,defineProperties:wu,getOwnPropertyDescriptor:Nu}),yc({target:"Object",stat:!0,forced:!Ac},{getOwnPropertyNames:Pu,getOwnPropertySymbols:Du}),yc({target:"Object",stat:!0,forced:Rc((function(){Hc.f(1)}))},{getOwnPropertySymbols:function(e){return Hc.f(Mc(e))}}),fu)&&yc({target:"JSON",stat:!0,forced:!Ac||Rc((function(){var e=du();return"[null]"!=fu([e])||"{}"!=fu({a:e})||"{}"!=fu(Object(e))}))},{stringify:function(e,t,i){var r=qc(arguments),n=t;if((kc(t)||void 0!==e)&&!Pc(e))return Oc(t)||(t=function(e,t){if(wc(n)&&(t=bc(n,this,e,t)),!Pc(t))return t}),r[1]=t,Ec(fu,null,r)}});if(!lu[au]){var Mu=lu.valueOf;Yc(lu,au,(function(e){return bc(Mu,this)}))}iu(du,"Symbol"),Qc[ou]=!0;var Lu=jr,Uu=a,xu=F,Vu=o.f,Fu=s,Bu=Uu((function(){Vu(1)}));Lu({target:"Object",stat:!0,forced:!Fu||Bu,sham:!Fu},{getOwnPropertyDescriptor:function(e,t){return Vu(xu(e),t)}});var ju=jr,Gu=s,Hu=Rt.f;ju({target:"Object",stat:!0,forced:Object.defineProperty!==Hu,sham:!Gu},{defineProperty:Hu});var zu=n.Promise,Ku=zt.exports,Wu=function(e,t,i){for(var r in t)Ku(e,r,t[r],i);return e},Xu=W,qu=Rt,Yu=s,Ju=Ze("species"),Qu=function(e){var t=Xu(e),i=qu.f;Yu&&t&&!t[Ju]&&i(t,Ju,{configurable:!0,get:function(){return this}})},Zu=X,$u=n.TypeError,ed=function(e,t){if(Zu(t,e))return e;throw $u("Incorrect invocation")},td={},id=td,rd=Ze("iterator"),nd=Array.prototype,od=function(e){return void 0!==e&&(id.Array===e||nd[rd]===e)},ad=nn,sd=ge,cd=td,ud=Ze("iterator"),dd=function(e){if(null!=e)return sd(e,ud)||sd(e,"@@iterator")||cd[ad(e)]},ld=l,hd=me,pd=Pt,fd=pe,_d=dd,vd=n.TypeError,md=function(e,t){var i=arguments.length<2?_d(e):t;if(hd(i))return pd(ld(i,e));throw vd(fd(e)+" is not iterable")},yd=l,gd=Pt,Sd=ge,Ed=function(e,t,i){var r,n;gd(e);try{if(!(r=Sd(e,"return"))){if("throw"===t)throw i;return i}r=yd(r,e)}catch(e){n=!0,r=e}if("throw"===t)throw i;if(n)throw r;return gd(r),i},bd=Kr,Id=l,Td=Pt,Ad=pe,Rd=od,Cd=Zi,Od=X,wd=md,kd=dd,Nd=Ed,Pd=n.TypeError,Dd=function(e,t){this.stopped=e,this.result=t},Md=Dd.prototype,Ld=function(e,t,i){var r,n,o,a,s,c,u,d=i&&i.that,l=!(!i||!i.AS_ENTRIES),h=!(!i||!i.IS_ITERATOR),p=!(!i||!i.INTERRUPTED),f=bd(t,d),_=function(e){return r&&Nd(r,"normal",e),new Dd(!0,e)},v=function(e){return l?(Td(e),p?f(e[0],e[1],_):f(e[0],e[1])):p?f(e,_):f(e)};if(h)r=e;else{if(!(n=kd(e)))throw Pd(Ad(e)+" is not iterable");if(Rd(n)){for(o=0,a=Cd(e);a>o;o++)if((s=v(e[o]))&&Od(Md,s))return s;return new Dd(!1)}r=wd(e,n)}for(c=r.next;!(u=Id(c,r)).done;){try{s=v(u.value)}catch(e){Nd(r,"throw",e)}if("object"==typeof s&&s&&Od(Md,s))return s}return new Dd(!1)},Ud=Ze("iterator"),xd=!1;try{var Vd=0,Fd={next:function(){return{done:!!Vd++}},return:function(){xd=!0}};Fd[Ud]=function(){return this},Array.from(Fd,(function(){throw 2}))}catch(e){}var Bd,jd,Gd,Hd,zd=function(e,t){if(!t&&!xd)return!1;var i=!1;try{var r={};r[Ud]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(e){}return i},Kd=yn,Wd=pe,Xd=n.TypeError,qd=function(e){if(Kd(e))return e;throw Xd(Wd(e)+" is not a constructor")},Yd=Pt,Jd=qd,Qd=Ze("species"),Zd=function(e,t){var i,r=Yd(e).constructor;return void 0===r||null==(i=Yd(r)[Qd])?t:Jd(i)},$d=n.TypeError,el=function(e,t){if(e<t)throw $d("Not enough arguments");return e},tl=/(?:ipad|iphone|ipod).*applewebkit/i.test(q),il="process"==O(n.process),rl=n,nl=Hs,ol=Kr,al=B,sl=Ue,cl=a,ul=po,dl=ac,ll=ft,hl=el,pl=tl,fl=il,_l=rl.setImmediate,vl=rl.clearImmediate,ml=rl.process,yl=rl.Dispatch,gl=rl.Function,Sl=rl.MessageChannel,El=rl.String,bl=0,Il={};try{Bd=rl.location}catch(e){}var Tl=function(e){if(sl(Il,e)){var t=Il[e];delete Il[e],t()}},Al=function(e){return function(){Tl(e)}},Rl=function(e){Tl(e.data)},Cl=function(e){rl.postMessage(El(e),Bd.protocol+"//"+Bd.host)};_l&&vl||(_l=function(e){hl(arguments.length,1);var t=al(e)?e:gl(e),i=dl(arguments,1);return Il[++bl]=function(){nl(t,void 0,i)},jd(bl),bl},vl=function(e){delete Il[e]},fl?jd=function(e){ml.nextTick(Al(e))}:yl&&yl.now?jd=function(e){yl.now(Al(e))}:Sl&&!pl?(Hd=(Gd=new Sl).port2,Gd.port1.onmessage=Rl,jd=ol(Hd.postMessage,Hd)):rl.addEventListener&&al(rl.postMessage)&&!rl.importScripts&&Bd&&"file:"!==Bd.protocol&&!cl(Cl)?(jd=Cl,rl.addEventListener("message",Rl,!1)):jd="onreadystatechange"in ll("script")?function(e){ul.appendChild(ll("script")).onreadystatechange=function(){ul.removeChild(this),Tl(e)}}:function(e){setTimeout(Al(e),0)});var Ol,wl,kl,Nl,Pl,Dl,Ml,Ll,Ul={set:_l,clear:vl},xl=n,Vl=/ipad|iphone|ipod/i.test(q)&&void 0!==xl.Pebble,Fl=/web0s(?!.*chrome)/i.test(q),Bl=n,jl=Kr,Gl=o.f,Hl=Ul.set,zl=tl,Kl=Vl,Wl=Fl,Xl=il,ql=Bl.MutationObserver||Bl.WebKitMutationObserver,Yl=Bl.document,Jl=Bl.process,Ql=Bl.Promise,Zl=Gl(Bl,"queueMicrotask"),$l=Zl&&Zl.value;$l||(Ol=function(){var e,t;for(Xl&&(e=Jl.domain)&&e.exit();wl;){t=wl.fn,wl=wl.next;try{t()}catch(e){throw wl?Nl():kl=void 0,e}}kl=void 0,e&&e.enter()},zl||Xl||Wl||!ql||!Yl?!Kl&&Ql&&Ql.resolve?((Ml=Ql.resolve(void 0)).constructor=Ql,Ll=jl(Ml.then,Ml),Nl=function(){Ll(Ol)}):Xl?Nl=function(){Jl.nextTick(Ol)}:(Hl=jl(Hl,Bl),Nl=function(){Hl(Ol)}):(Pl=!0,Dl=Yl.createTextNode(""),new ql(Ol).observe(Dl,{characterData:!0}),Nl=function(){Dl.data=Pl=!Pl}));var eh=$l||function(e){var t={fn:e,next:void 0};kl&&(kl.next=t),wl||(wl=t,Nl()),kl=t},th={},ih=me,rh=function(e){var t,i;this.promise=new e((function(e,r){if(void 0!==t||void 0!==i)throw TypeError("Bad Promise constructor");t=e,i=r})),this.resolve=ih(t),this.reject=ih(i)};th.f=function(e){return new rh(e)};var nh=Pt,oh=G,ah=th,sh=function(e,t){if(nh(e),oh(t)&&t.constructor===e)return t;var i=ah.f(e);return(0,i.resolve)(t),i.promise},ch=n,uh=function(){this.head=null,this.tail=null};uh.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var dh,lh,hh,ph,fh=uh,_h="object"==typeof window,vh=jr,mh=n,yh=W,gh=l,Sh=zu,Eh=zt.exports,bh=Wu,Ih=Ts,Th=mc,Ah=Qu,Rh=me,Ch=B,Oh=G,wh=ed,kh=Qt,Nh=Ld,Ph=zd,Dh=Zd,Mh=Ul.set,Lh=eh,Uh=sh,xh=function(e,t){var i=ch.console;i&&i.error&&(1==arguments.length?i.error(e):i.error(e,t))},Vh=th,Fh=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Bh=fh,jh=Ii,Gh=Dr,Hh=_h,zh=il,Kh=te,Wh=Ze("species"),Xh="Promise",qh=jh.getterFor(Xh),Yh=jh.set,Jh=jh.getterFor(Xh),Qh=Sh&&Sh.prototype,Zh=Sh,$h=Qh,ep=mh.TypeError,tp=mh.document,ip=mh.process,rp=Vh.f,np=rp,op=!!(tp&&tp.createEvent&&mh.dispatchEvent),ap=Ch(mh.PromiseRejectionEvent),sp=!1,cp=Gh(Xh,(function(){var e=kh(Zh),t=e!==String(Zh);if(!t&&66===Kh)return!0;if(Kh>=51&&/native code/.test(e))return!1;var i=new Zh((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(i.constructor={})[Wh]=r,!(sp=i.then((function(){}))instanceof r)||!t&&Hh&&!ap})),up=cp||!Ph((function(e){Zh.all(e).catch((function(){}))})),dp=function(e){var t;return!(!Oh(e)||!Ch(t=e.then))&&t},lp=function(e,t){var i,r,n,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&vp(t),t.rejection=1),!0===s?i=o:(d&&d.enter(),i=s(o),d&&(d.exit(),n=!0)),i===e.promise?u(ep("Promise-chain cycle")):(r=dp(i))?gh(r,i,c,u):c(i)):u(o)}catch(e){d&&!n&&d.exit(),u(e)}},hp=function(e,t){e.notified||(e.notified=!0,Lh((function(){for(var i,r=e.reactions;i=r.get();)lp(i,e);e.notified=!1,t&&!e.rejection&&fp(e)})))},pp=function(e,t,i){var r,n;op?((r=tp.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),mh.dispatchEvent(r)):r={promise:t,reason:i},!ap&&(n=mh["on"+e])?n(r):"unhandledrejection"===e&&xh("Unhandled promise rejection",i)},fp=function(e){gh(Mh,mh,(function(){var t,i=e.facade,r=e.value;if(_p(e)&&(t=Fh((function(){zh?ip.emit("unhandledRejection",r,i):pp("unhandledrejection",i,r)})),e.rejection=zh||_p(e)?2:1,t.error))throw t.value}))},_p=function(e){return 1!==e.rejection&&!e.parent},vp=function(e){gh(Mh,mh,(function(){var t=e.facade;zh?ip.emit("rejectionHandled",t):pp("rejectionhandled",t,e.value)}))},mp=function(e,t,i){return function(r){e(t,r,i)}},yp=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,hp(e,!0))},gp=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw ep("Promise can't be resolved itself");var r=dp(t);r?Lh((function(){var i={done:!1};try{gh(r,t,mp(gp,i,e),mp(yp,i,e))}catch(t){yp(i,t,e)}})):(e.value=t,e.state=1,hp(e,!1))}catch(t){yp({done:!1},t,e)}}};if(cp&&($h=(Zh=function(e){wh(this,$h),Rh(e),gh(dh,this);var t=qh(this);try{e(mp(gp,t),mp(yp,t))}catch(e){yp(t,e)}}).prototype,(dh=function(e){Yh(this,{type:Xh,done:!1,notified:!1,parent:!1,reactions:new Bh,rejection:!1,state:0,value:void 0})}).prototype=bh($h,{then:function(e,t){var i=Jh(this),r=rp(Dh(this,Zh));return i.parent=!0,r.ok=!Ch(e)||e,r.fail=Ch(t)&&t,r.domain=zh?ip.domain:void 0,0==i.state?i.reactions.add(r):Lh((function(){lp(r,i)})),r.promise},catch:function(e){return this.then(void 0,e)}}),lh=function(){var e=new dh,t=qh(e);this.promise=e,this.resolve=mp(gp,t),this.reject=mp(yp,t)},Vh.f=rp=function(e){return e===Zh||e===hh?new lh(e):np(e)},Ch(Sh)&&Qh!==Object.prototype)){ph=Qh.then,sp||(Eh(Qh,"then",(function(e,t){var i=this;return new Zh((function(e,t){gh(ph,i,e,t)})).then(e,t)}),{unsafe:!0}),Eh(Qh,"catch",$h.catch,{unsafe:!0}));try{delete Qh.constructor}catch(e){}Ih&&Ih(Qh,$h)}vh({global:!0,wrap:!0,forced:cp},{Promise:Zh}),Th(Zh,Xh,!1),Ah(Xh),hh=yh(Xh),vh({target:Xh,stat:!0,forced:cp},{reject:function(e){var t=rp(this);return gh(t.reject,void 0,e),t.promise}}),vh({target:Xh,stat:!0,forced:cp},{resolve:function(e){return Uh(this,e)}}),vh({target:Xh,stat:!0,forced:up},{all:function(e){var t=this,i=rp(t),r=i.resolve,n=i.reject,o=Fh((function(){var i=Rh(t.resolve),o=[],a=0,s=1;Nh(e,(function(e){var c=a++,u=!1;s++,gh(i,t,e).then((function(e){u||(u=!0,o[c]=e,--s||r(o))}),n)})),--s||r(o)}));return o.error&&n(o.value),i.promise},race:function(e){var t=this,i=rp(t),r=i.reject,n=Fh((function(){var n=Rh(t.resolve);Nh(e,(function(e){gh(n,t,e).then(i.resolve,r)}))}));return n.error&&r(n.value),i.promise}});var Sp=jr,Ep=s,bp=n,Ip=T,Tp=Ue,Ap=B,Rp=X,Cp=Go,Op=Rt.f,wp=Tr,kp=bp.Symbol,Np=kp&&kp.prototype;if(Ep&&Ap(kp)&&(!("description"in Np)||void 0!==kp().description)){var Pp={},Dp=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:Cp(arguments[0]),t=Rp(Np,this)?new kp(e):void 0===e?kp():kp(e);return""===e&&(Pp[t]=!0),t};wp(Dp,kp),Dp.prototype=Np,Np.constructor=Dp;var Mp="Symbol(test)"==String(kp("test")),Lp=Ip(Np.toString),Up=Ip(Np.valueOf),xp=/^Symbol\((.*)\)[^)]+$/,Vp=Ip("".replace),Fp=Ip("".slice);Op(Np,"description",{configurable:!0,get:function(){var e=Up(this),t=Lp(e);if(Tp(Pp,e))return"";var i=Mp?Fp(t,7,-1):Vp(t,xp,"$1");return""===i?void 0:i}}),Sp({global:!0,forced:!0},{Symbol:Dp})}pc("iterator");var Bp,jp,Gp,Hp=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),zp=n,Kp=Ue,Wp=B,Xp=De,qp=Hp,Yp=oi("IE_PROTO"),Jp=zp.Object,Qp=Jp.prototype,Zp=qp?Jp.getPrototypeOf:function(e){var t=Xp(e);if(Kp(t,Yp))return t[Yp];var i=t.constructor;return Wp(i)&&t instanceof i?i.prototype:t instanceof Jp?Qp:null},$p=a,ef=B,tf=Zp,rf=zt.exports,nf=Ze("iterator"),of=!1;[].keys&&("next"in(Gp=[].keys())?(jp=tf(tf(Gp)))!==Object.prototype&&(Bp=jp):of=!0);var af=null==Bp||$p((function(){var e={};return Bp[nf].call(e)!==e}));af&&(Bp={}),ef(Bp[nf])||rf(Bp,nf,(function(){return this}));var sf={IteratorPrototype:Bp,BUGGY_SAFARI_ITERATORS:of},cf=sf.IteratorPrototype,uf=Ao,df=y,lf=mc,hf=td,pf=function(){return this},ff=function(e,t,i,r){var n=t+" Iterator";return e.prototype=uf(cf,{next:df(+!r,i)}),lf(e,n,!1),hf[n]=pf,e},_f=jr,vf=l,mf=wi,yf=B,gf=ff,Sf=Zp,Ef=Ts,bf=mc,If=Ht,Tf=zt.exports,Af=td,Rf=mf.PROPER,Cf=mf.CONFIGURABLE,Of=sf.IteratorPrototype,wf=sf.BUGGY_SAFARI_ITERATORS,kf=Ze("iterator"),Nf=function(){return this},Pf=function(e,t,i,r,n,o,a){gf(i,t,r);var s,c,u,d=function(e){if(e===n&&_)return _;if(!wf&&e in p)return p[e];switch(e){case"keys":case"values":case"entries":return function(){return new i(this,e)}}return function(){return new i(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[kf]||p["@@iterator"]||n&&p[n],_=!wf&&f||d(n),v="Array"==t&&p.entries||f;if(v&&(s=Sf(v.call(new e)))!==Object.prototype&&s.next&&(Sf(s)!==Of&&(Ef?Ef(s,Of):yf(s[kf])||Tf(s,kf,Nf)),bf(s,l,!0)),Rf&&"values"==n&&f&&"values"!==f.name&&(Cf?If(p,"name","values"):(h=!0,_=function(){return vf(f,this)})),n)if(c={values:d("values"),keys:o?_:d("keys"),entries:d("entries")},a)for(u in c)(wf||h||!(u in p))&&Tf(p,u,c[u]);else _f({target:t,proto:!0,forced:wf||h},c);return p[kf]!==_&&Tf(p,kf,_,{name:n}),Af[t]=_,c},Df=F,Mf=ko,Lf=td,Uf=Ii,xf=Rt.f,Vf=Pf,Ff=s,Bf=Uf.set,jf=Uf.getterFor("Array Iterator"),Gf=Vf(Array,"Array",(function(e,t){Bf(this,{type:"Array Iterator",target:Df(e),index:0,kind:t})}),(function(){var e=jf(this),t=e.target,i=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:r,done:!1}:"values"==i?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),Hf=Lf.Arguments=Lf.Array;if(Mf("keys"),Mf("values"),Mf("entries"),Ff&&"values"!==Hf.name)try{xf(Hf,"name",{value:"values"})}catch(e){}var zf=T,Kf=Hi,Wf=Go,Xf=U,qf=zf("".charAt),Yf=zf("".charCodeAt),Jf=zf("".slice),Qf=function(e){return function(t,i){var r,n,o=Wf(Xf(t)),a=Kf(i),s=o.length;return a<0||a>=s?e?"":void 0:(r=Yf(o,a))<55296||r>56319||a+1===s||(n=Yf(o,a+1))<56320||n>57343?e?qf(o,a):r:e?Jf(o,a,a+2):n-56320+(r-55296<<10)+65536}},Zf={codeAt:Qf(!1),charAt:Qf(!0)},$f=Zf.charAt,e_=Go,t_=Ii,i_=Pf,r_=t_.set,n_=t_.getterFor("String Iterator");i_(String,"String",(function(e){r_(this,{type:"String Iterator",string:e_(e),index:0})}),(function(){var e,t=n_(this),i=t.string,r=t.index;return r>=i.length?{value:void 0,done:!0}:(e=$f(i,r),t.index+=e.length,{value:e,done:!1})}));var o_=n,a_=zn,s_=Xn,c_=Gf,u_=Ht,d_=Ze,l_=d_("iterator"),h_=d_("toStringTag"),p_=c_.values,f_=function(e,t){if(e){if(e[l_]!==p_)try{u_(e,l_,p_)}catch(t){e[l_]=p_}if(e[h_]||u_(e,h_,t),a_[t])for(var i in c_)if(e[i]!==c_[i])try{u_(e,i,c_[i])}catch(t){e[i]=c_[i]}}};for(var __ in a_)f_(o_[__]&&o_[__].prototype,__);f_(s_,"DOMTokenList");var v_=a,m_=te,y_=Ze("species"),g_=function(e){return m_>=51||!v_((function(){var t=[];return(t.constructor={})[y_]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},S_=jr,E_=n,b_=a,I_=Xr,T_=G,A_=De,R_=Zi,C_=qs,O_=Rn,w_=g_,k_=te,N_=Ze("isConcatSpreadable"),P_=E_.TypeError,D_=k_>=51||!b_((function(){var e=[];return e[N_]=!1,e.concat()[0]!==e})),M_=w_("concat"),L_=function(e){if(!T_(e))return!1;var t=e[N_];return void 0!==t?!!t:I_(e)};S_({target:"Array",proto:!0,forced:!D_||!M_},{concat:function(e){var t,i,r,n,o,a=A_(this),s=O_(a,0),c=0;for(t=-1,r=arguments.length;t<r;t++)if(L_(o=-1===t?a:arguments[t])){if(c+(n=R_(o))>9007199254740991)throw P_("Maximum allowed index exceeded");for(i=0;i<n;i++,c++)i in o&&C_(s,c,o[i])}else{if(c>=9007199254740991)throw P_("Maximum allowed index exceeded");C_(s,c++,o)}return s.length=c,s}});var U_=jr,x_=n,V_=Xr,F_=yn,B_=G,j_=Xi,G_=Zi,H_=F,z_=qs,K_=Ze,W_=ac,X_=g_("slice"),q_=K_("species"),Y_=x_.Array,J_=Math.max;U_({target:"Array",proto:!0,forced:!X_},{slice:function(e,t){var i,r,n,o=H_(this),a=G_(o),s=j_(e,a),c=j_(void 0===t?a:t,a);if(V_(o)&&(i=o.constructor,(F_(i)&&(i===Y_||V_(i.prototype))||B_(i)&&null===(i=i[q_]))&&(i=void 0),i===Y_||void 0===i))return W_(o,s,c);for(r=new(void 0===i?Y_:i)(J_(c-s,0)),n=0;s<c;s++,n++)s in o&&z_(r,n,o[s]);return r.length=n,r}}),pc("asyncIterator");var Q_=function(e,t){return Q_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},Q_(e,t)};function Z_(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}Q_(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var $_=function(){return $_=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},$_.apply(this,arguments)};function ev(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===("undefined"==typeof Reflect?"undefined":vs(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a}function tv(e,t,i,r){return new(i||(i=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function iv(e,t){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function rv(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],r=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function nv(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var r,n,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return a}function ov(e,t,i){if(i||2===arguments.length)for(var r,n=0,o=t.length;n<o;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))}function av(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=rv(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(i){t[i]=e[i]&&function(t){return new Promise((function(r,n){(function(e,t,i,r){Promise.resolve(r).then((function(t){e({value:t,done:i})}),t)})(r,n,(t=e[i](t)).done,t.value)}))}}}function sv(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var cv=Zf.charAt,uv=function(e,t,i){return t+(i?cv(e,t).length:1)},dv=l,lv=Pt,hv=Ji,pv=Go,fv=U,_v=ge,vv=uv,mv=Xa;Fa("match",(function(e,t,i){return[function(t){var i=fv(this),r=null==t?void 0:_v(t,e);return r?dv(r,t,i):new RegExp(t)[e](pv(i))},function(e){var r=lv(this),n=pv(e),o=i(t,r,n);if(o.done)return o.value;if(!r.global)return mv(r,n);var a=r.unicode;r.lastIndex=0;for(var s,c=[],u=0;null!==(s=mv(r,n));){var d=pv(s[0]);c[u]=d,""===d&&(r.lastIndex=vv(n,hv(r.lastIndex),a)),u++}return 0===u?null:c}]}));var yv="\t\n\v\f\r \u2028\u2029\ufeff",gv=U,Sv=Go,Ev=T("".replace),bv="[\t\n\v\f\r \u2028\u2029\ufeff]",Iv=RegExp("^"+bv+bv+"*"),Tv=RegExp(bv+bv+"*$"),Av=function(e){return function(t){var i=Sv(gv(t));return 1&e&&(i=Ev(i,Iv,"")),2&e&&(i=Ev(i,Tv,"")),i}},Rv={start:Av(1),end:Av(2),trim:Av(3)},Cv=n,Ov=a,wv=T,kv=Go,Nv=Rv.trim,Pv=Cv.parseInt,Dv=Cv.Symbol,Mv=Dv&&Dv.iterator,Lv=/^[+-]?0x/i,Uv=wv(Lv.exec),xv=8!==Pv("\t\n\v\f\r \u2028\u2029\ufeff08")||22!==Pv("\t\n\v\f\r \u2028\u2029\ufeff0x16")||Mv&&!Ov((function(){Pv(Object(Mv))}))?function(e,t){var i=Nv(kv(e));return Pv(i,t>>>0||(Uv(Lv,i)?16:10))}:Pv;jr({global:!0,forced:parseInt!=xv},{parseInt:xv});var Vv={exports:{}},Fv=a((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Bv=a,jv=G,Gv=O,Hv=Fv,zv=Object.isExtensible,Kv=Bv((function(){zv(1)}))||Hv?function(e){return!!jv(e)&&((!Hv||"ArrayBuffer"!=Gv(e))&&(!zv||zv(e)))}:zv,Wv=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),Xv=jr,qv=T,Yv=ai,Jv=G,Qv=Ue,Zv=Rt.f,$v=Bi,em=zs,tm=Kv,im=Wv,rm=!1,nm=je("meta"),om=0,am=function(e){Zv(e,nm,{value:{objectID:"O"+om++,weakData:{}}})},sm=Vv.exports={enable:function(){sm.enable=function(){},rm=!0;var e=$v.f,t=qv([].splice),i={};i[nm]=1,e(i).length&&($v.f=function(i){for(var r=e(i),n=0,o=r.length;n<o;n++)if(r[n]===nm){t(r,n,1);break}return r},Xv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:em.f}))},fastKey:function(e,t){if(!Jv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Qv(e,nm)){if(!tm(e))return"F";if(!t)return"E";am(e)}return e[nm].objectID},getWeakData:function(e,t){if(!Qv(e,nm)){if(!tm(e))return!0;if(!t)return!1;am(e)}return e[nm].weakData},onFreeze:function(e){return im&&rm&&tm(e)&&!Qv(e,nm)&&am(e),e}};Yv[nm]=!0;var cm=B,um=G,dm=Ts,lm=function(e,t,i){var r,n;return dm&&cm(r=t.constructor)&&r!==i&&um(n=r.prototype)&&n!==i.prototype&&dm(e,n),e},hm=jr,pm=n,fm=T,_m=Dr,vm=zt.exports,mm=Vv.exports,ym=Ld,gm=ed,Sm=B,Em=G,bm=a,Im=zd,Tm=mc,Am=lm,Rm=function(e,t,i){var r=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=r?"set":"add",a=pm[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=fm(s[e]);vm(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(n&&!Em(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!Em(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!Em(e))&&t(this,0===e?0:e)}:function(e,i){return t(this,0===e?0:e,i),this})};if(_m(e,!Sm(a)||!(n||s.forEach&&!bm((function(){(new a).entries().next()})))))c=i.getConstructor(t,e,r,o),mm.enable();else if(_m(e,!0)){var l=new c,h=l[o](n?{}:-0,1)!=l,p=bm((function(){l.has(1)})),f=Im((function(e){new a(e)})),_=!n&&bm((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));f||((c=t((function(e,t){gm(e,s);var i=Am(new a,e,c);return null!=t&&ym(t,i[o],{that:i,AS_ENTRIES:r}),i}))).prototype=s,s.constructor=c),(p||_)&&(d("delete"),d("has"),r&&d("get")),(_||h)&&d(o),n&&s.clear&&delete s.clear}return u[e]=c,hm({global:!0,forced:c!=a},u),Tm(c,e),n||i.setStrong(c,e,r),c},Cm=Rt.f,Om=Ao,wm=Wu,km=Kr,Nm=ed,Pm=Ld,Dm=Pf,Mm=Qu,Lm=s,Um=Vv.exports.fastKey,xm=Ii.set,Vm=Ii.getterFor,Fm={getConstructor:function(e,t,i,r){var n=e((function(e,n){Nm(e,o),xm(e,{type:t,index:Om(null),first:void 0,last:void 0,size:0}),Lm||(e.size=0),null!=n&&Pm(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=Vm(t),s=function(e,t,i){var r,n,o=a(e),s=c(e,t);return s?s.value=i:(o.last=s={index:n=Um(t,!0),key:t,value:i,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),Lm?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},c=function(e,t){var i,r=a(e),n=Um(t);if("F"!==n)return r.index[n];for(i=r.first;i;i=i.next)if(i.key==t)return i};return wm(o,{clear:function(){for(var e=a(this),t=e.index,i=e.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete t[i.index],i=i.next;e.first=e.last=void 0,Lm?e.size=0:this.size=0},delete:function(e){var t=this,i=a(t),r=c(t,e);if(r){var n=r.next,o=r.previous;delete i.index[r.index],r.removed=!0,o&&(o.next=n),n&&(n.previous=o),i.first==r&&(i.first=n),i.last==r&&(i.last=o),Lm?i.size--:t.size--}return!!r},forEach:function(e){for(var t,i=a(this),r=km(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:i.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),wm(o,i?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),Lm&&Cm(o,"size",{get:function(){return a(this).size}}),n},setStrong:function(e,t,i){var r=t+" Iterator",n=Vm(t),o=Vm(r);Dm(e,t,(function(e,t){xm(this,{type:r,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,i=e.last;i&&i.removed;)i=i.previous;return e.target&&(e.last=i=i?i.next:e.state.first)?"keys"==t?{value:i.key,done:!1}:"values"==t?{value:i.value,done:!1}:{value:[i.key,i.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),i?"entries":"values",!i,!0),Mm(t)}};Rm("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Fm);var Bm=De,jm=no;jr({target:"Object",stat:!0,forced:a((function(){jm(1)}))},{keys:function(e){return jm(Bm(e))}});var Gm=me,Hm=De,zm=M,Km=Zi,Wm=n.TypeError,Xm=function(e){return function(t,i,r,n){Gm(i);var o=Hm(t),a=zm(o),s=Km(o),c=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(c in a){n=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw Wm("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(n=i(n,a[c],c,o));return n}},qm={left:Xm(!1),right:Xm(!0)},Ym=qm.left,Jm=te,Qm=il;jr({target:"Array",proto:!0,forced:!Un("reduce")||!Qm&&Jm>79&&Jm<83},{reduce:function(e){var t=arguments.length;return Ym(this,e,t,t>1?arguments[1]:void 0)}});var Zm,$m=jr,ey=T,ty=o.f,iy=Ji,ry=Go,ny=Fo,oy=U,ay=zo,sy=ey("".endsWith),cy=ey("".slice),uy=Math.min,dy=ay("endsWith");$m({target:"String",proto:!0,forced:!!(dy||(Zm=ty(String.prototype,"endsWith"),!Zm||Zm.writable))&&!dy},{endsWith:function(e){var t=ry(oy(this));ny(e);var i=arguments.length>1?arguments[1]:void 0,r=t.length,n=void 0===i?r:uy(iy(i),r),o=ry(e);return sy?sy(t,o,n):cy(t,n-o.length,n)===o}});var ly=!0,hy=!0;function py(e,t,i){var r=e.match(t);return r&&r.length>=i&&parseInt(r[i],10)}function fy(e,t,i){if(e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,n=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return n.apply(this,arguments);var o=function(e){var t=i(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),n.apply(this,[e,o])};var o=r.removeEventListener;r.removeEventListener=function(e,i){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(i))return o.apply(this,arguments);var r=this._eventMap[t].get(i);return this._eventMap[t].delete(i),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function _y(e){return"boolean"!=typeof e?new Error("Argument type: "+vs(e)+". Please use a boolean."):(ly=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function vy(e){return"boolean"!=typeof e?new Error("Argument type: "+vs(e)+". Please use a boolean."):(hy=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function my(){if("object"===("undefined"==typeof window?"undefined":vs(window))){if(ly)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function yy(e,t){hy&&console.warn(e+" is deprecated, please use "+t+" instead.")}function gy(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var i=e.navigator;if(i.mozGetUserMedia)t.browser="firefox",t.version=py(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=py(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!i.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=py(i.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function Sy(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ey(e){return Sy(e)?Object.keys(e).reduce((function(t,i){var r=Sy(e[i]),n=r?Ey(e[i]):e[i],o=r&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,sv({},i,n))}),{}):e}function by(e,t,i){t&&!i.has(t.id)&&(i.set(t.id,t),Object.keys(t).forEach((function(r){r.endsWith("Id")?by(e,e.get(t[r]),i):r.endsWith("Ids")&&t[r].forEach((function(t){by(e,e.get(t),i)}))})))}function Iy(e,t,i){var r=i?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(i){i.type===r&&i.trackId===t.id&&by(e,i,n)}))})),n}var Ty=jr,Ay=Mn.find,Ry=ko,Cy=!0;"find"in[]&&Array(1).find((function(){Cy=!1})),Ty({target:"Array",proto:!0,forced:Cy},{find:function(e){return Ay(this,e,arguments.length>1?arguments[1]:void 0)}}),Ry("find");var Oy=jr,wy=n,ky=Xi,Ny=Hi,Py=Zi,Dy=De,My=Rn,Ly=qs,Uy=g_("splice"),xy=wy.TypeError,Vy=Math.max,Fy=Math.min;Oy({target:"Array",proto:!0,forced:!Uy},{splice:function(e,t){var i,r,n,o,a,s,c=Dy(this),u=Py(c),d=ky(e,u),l=arguments.length;if(0===l?i=r=0:1===l?(i=0,r=u-d):(i=l-2,r=Fy(Vy(Ny(t),0),u-d)),u+i-r>9007199254740991)throw xy("Maximum allowed length exceeded");for(n=My(c,r),o=0;o<r;o++)(a=d+o)in c&&Ly(n,o,c[a]);if(n.length=r,i<r){for(o=d;o<u-r;o++)s=o+i,(a=o+r)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-r+i;o--)delete c[o-1]}else if(i>r)for(o=u-r;o>d;o--)s=o+i-1,(a=o+r-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<i;o++)c[o+d]=arguments[o+2];return c.length=u-r+i,n}});var By=Mn.map;jr({target:"Array",proto:!0,forced:!g_("map")},{map:function(e){return By(this,e,arguments.length>1?arguments[1]:void 0)}});var jy=Mn.filter;jr({target:"Array",proto:!0,forced:!g_("filter")},{filter:function(e){return jy(this,e,arguments.length>1?arguments[1]:void 0)}});var Gy=T,Hy=De,zy=Math.floor,Ky=Gy("".charAt),Wy=Gy("".replace),Xy=Gy("".slice),qy=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Yy=/\$([$&'`]|\d{1,2})/g,Jy=function(e,t,i,r,n,o){var a=i+e.length,s=r.length,c=Yy;return void 0!==n&&(n=Hy(n),c=qy),Wy(o,c,(function(o,c){var u;switch(Ky(c,0)){case"$":return"$";case"&":return e;case"`":return Xy(t,0,i);case"'":return Xy(t,a);case"<":u=n[Xy(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=zy(d/10);return 0===l?o:l<=s?void 0===r[l-1]?Ky(c,1):r[l-1]+Ky(c,1):o}u=r[d-1]}return void 0===u?"":u}))},Qy=Hs,Zy=l,$y=T,eg=Fa,tg=a,ig=Pt,rg=B,ng=Hi,og=Ji,ag=Go,sg=U,cg=uv,ug=ge,dg=Jy,lg=Xa,hg=Ze("replace"),pg=Math.max,fg=Math.min,_g=$y([].concat),vg=$y([].push),mg=$y("".indexOf),yg=$y("".slice),gg="$0"==="a".replace(/./,"$0"),Sg=!!/./[hg]&&""===/./[hg]("a","$0");eg("replace",(function(e,t,i){var r=Sg?"$":"$0";return[function(e,i){var r=sg(this),n=null==e?void 0:ug(e,hg);return n?Zy(n,e,r,i):Zy(t,ag(r),e,i)},function(e,n){var o=ig(this),a=ag(e);if("string"==typeof n&&-1===mg(n,r)&&-1===mg(n,"$<")){var s=i(t,o,a,n);if(s.done)return s.value}var c=rg(n);c||(n=ag(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=lg(o,a);if(null===h)break;if(vg(l,h),!u)break;""===ag(h[0])&&(o.lastIndex=cg(a,og(o.lastIndex),d))}for(var p,f="",_=0,v=0;v<l.length;v++){for(var m=ag((h=l[v])[0]),y=pg(fg(ng(h.index),a.length),0),g=[],S=1;S<h.length;S++)vg(g,void 0===(p=h[S])?p:String(p));var E=h.groups;if(c){var b=_g([m],g,y,a);void 0!==E&&vg(b,E);var I=ag(Qy(n,void 0,b))}else I=dg(m,a,y,g,E,n);y>=_&&(f+=yg(a,_,y)+I,_=y+m.length)}return f+yg(a,_)}]}),!!tg((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!gg||Sg);var Eg=s,bg=n,Ig=T,Tg=Dr,Ag=lm,Rg=Ht,Cg=Rt.f,Og=Bi.f,wg=X,kg=Uo,Ng=Go,Pg=Zo,Dg=ra,Mg=zt.exports,Lg=a,Ug=Ue,xg=Ii.enforce,Vg=Qu,Fg=aa,Bg=ua,jg=Ze("match"),Gg=bg.RegExp,Hg=Gg.prototype,zg=bg.SyntaxError,Kg=Ig(Pg),Wg=Ig(Hg.exec),Xg=Ig("".charAt),qg=Ig("".replace),Yg=Ig("".indexOf),Jg=Ig("".slice),Qg=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Zg=/a/g,$g=/a/g,eS=new Gg(Zg)!==Zg,tS=Dg.MISSED_STICKY,iS=Dg.UNSUPPORTED_Y,rS=Eg&&(!eS||tS||Fg||Bg||Lg((function(){return $g[jg]=!1,Gg(Zg)!=Zg||Gg($g)==$g||"/a/i"!=Gg(Zg,"i")})));if(Tg("RegExp",rS)){for(var nS=function(e,t){var i,r,n,o,a,s,c=wg(Hg,this),u=kg(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===nS)return e;if((u||wg(Hg,e))&&(e=e.source,d&&(t="flags"in h?h.flags:Kg(h))),e=void 0===e?"":Ng(e),t=void 0===t?"":Ng(t),h=e,Fg&&"dotAll"in Zg&&(r=!!t&&Yg(t,"s")>-1)&&(t=qg(t,/s/g,"")),i=t,tS&&"sticky"in Zg&&(n=!!t&&Yg(t,"y")>-1)&&iS&&(t=qg(t,/y/g,"")),Bg&&(o=function(e){for(var t,i=e.length,r=0,n="",o=[],a={},s=!1,c=!1,u=0,d="";r<=i;r++){if("\\"===(t=Xg(e,r)))t+=Xg(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:Wg(Qg,Jg(e,r+1))&&(r+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||Ug(a,d))throw new zg("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:n+=t}return[n,o]}(e),e=o[0],l=o[1]),a=Ag(Gg(e,t),c?this:Hg,nS),(r||n||l.length)&&(s=xg(a),r&&(s.dotAll=!0,s.raw=nS(function(e){for(var t,i=e.length,r=0,n="",o=!1;r<=i;r++)"\\"!==(t=Xg(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+Xg(e,++r);return n}(e),i)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{Rg(a,"source",""===h?"(?:)":h)}catch(e){}return a},oS=function(e){e in nS||Cg(nS,e,{configurable:!0,get:function(){return Gg[e]},set:function(t){Gg[e]=t}})},aS=Og(Gg),sS=0;aS.length>sS;)oS(aS[sS++]);Hg.constructor=nS,nS.prototype=Hg,Mg(bg,"RegExp",nS)}Vg("RegExp");var cS=T,uS=wi.PROPER,dS=zt.exports,lS=Pt,hS=X,pS=Go,fS=a,_S=Zo,vS=RegExp.prototype,mS=vS.toString,yS=cS(_S),gS=fS((function(){return"/a/b"!=mS.call({source:"a",flags:"b"})})),SS=uS&&"toString"!=mS.name;(gS||SS)&&dS(RegExp.prototype,"toString",(function(){var e=lS(this),t=pS(e.source),i=e.flags;return"/"+t+"/"+pS(void 0===i&&hS(vS,e)&&!("flags"in vS)?yS(e):i)}),{unsafe:!0});var ES=Mn.some;jr({target:"Array",proto:!0,forced:!Un("some")},{some:function(e){return ES(this,e,arguments.length>1?arguments[1]:void 0)}});var bS=s,IS=wi.EXISTS,TS=T,AS=Rt.f,RS=Function.prototype,CS=TS(RS.toString),OS=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,wS=TS(OS.exec);bS&&!IS&&AS(RS,"name",{configurable:!0,get:function(){try{return wS(OS,CS(this))[1]}catch(e){return""}}});var kS=T,NS=me,PS=G,DS=Ue,MS=ac,LS=c,US=n.Function,xS=kS([].concat),VS=kS([].join),FS={},BS=function(e,t,i){if(!DS(FS,t)){for(var r=[],n=0;n<t;n++)r[n]="a["+n+"]";FS[t]=US("C,a","return new C("+VS(r,",")+")")}return FS[t](e,i)},jS=LS?US.bind:function(e){var t=NS(this),i=t.prototype,r=MS(arguments,1),n=function(){var i=xS(r,MS(arguments));return this instanceof n?BS(t,i.length,i):t.apply(e,i)};return PS(i)&&(n.prototype=i),n},GS=jS;jr({target:"Function",proto:!0,forced:Function.bind!==GS},{bind:GS});var HS=my;function zS(e,t){var i=e&&e.navigator;if(i.mediaDevices){var r=function(e){if("object"!==vs(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(i){if("require"!==i&&"advanced"!==i&&"mediaSource"!==i){var r="object"===vs(e[i])?e[i]:{ideal:e[i]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var o={};"number"==typeof r.ideal?(o[n("min",i)]=r.ideal,t.optional.push(o),(o={})[n("max",i)]=r.ideal,t.optional.push(o)):(o[n("",i)]=r.ideal,t.optional.push(o))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",i)]=r.exact):["min","max"].forEach((function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,i)]=r[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===vs(e.audio)){var o=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"===vs(e.video)){var a=e.video.facingMode;a=a&&("object"===vs(a)?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!i.mediaDevices.getSupportedConstraints||!i.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return i.mediaDevices.enumerateDevices().then((function(t){var i=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return s.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!i&&t.length&&s.includes("back")&&(i=t[t.length-1]),i&&(e.video.deviceId=a.exact?{exact:i.deviceId}:{ideal:i.deviceId}),e.video=r(e.video),HS("chrome: "+JSON.stringify(e)),n(e)}));e.video=r(e.video)}return HS("chrome: "+JSON.stringify(e)),n(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(i.getUserMedia=function(e,t,r){n(e,(function(e){i.webkitGetUserMedia(e,t,(function(e){r&&r(o(e))}))}))}.bind(i),i.mediaDevices.getUserMedia){var a=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(e){return n(e,(function(e){return a(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(o(e))}))}))}}}}function KS(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function WS(e){if("object"===vs(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var i=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find((function(e){return e.track&&e.track.id===r.track.id})):{track:r.track};var o=new Event("track");o.track=r.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[t.stream],i.dispatchEvent(o)})),t.stream.getTracks().forEach((function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find((function(e){return e.track&&e.track.id===r.id})):{track:r};var o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=[t.stream],i.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else fy(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function XS(e){if("object"===vs(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var n=i.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};var r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var i=this;this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((function(e){i._senders.push(t(i,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var i=t._senders.find((function(t){return t.track===e}));i&&t._senders.splice(t._senders.indexOf(i),1)}))}}else if("object"===vs(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function qS(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,i=Array.prototype.slice.call(arguments),r=i[0],n=i[1],o=i[2];if(arguments.length>0&&"function"==typeof r)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof r))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var i={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){i[t]=e.stat(t)})),t[i.id]=i})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){n(s(a(e)))};return t.apply(this,[c,r])}return new Promise((function(i,r){t.apply(e,[function(e){i(s(a(e)))},r])})).then(n,o)}}}function YS(e){if("object"===vs(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return Iy(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var r=e.RTCPeerConnection.prototype.getReceivers;r&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=r.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),fy(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return Iy(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,i,r,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?r=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(i?r=!0:i=e),e.track===o})),r||t&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return n.apply(this,arguments)}}}}function JS(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){if(!i)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var r=t.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(r)&&this._shimmedLocalStreams[i.id].push(r):this._shimmedLocalStreams[i.id]=[i,r],r};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var r=this.getSenders();i.apply(this,arguments);var n=this.getSenders().filter((function(e){return-1===r.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(n)};var r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(i){var r=t._shimmedLocalStreams[i].indexOf(e);-1!==r&&t._shimmedLocalStreams[i].splice(r,1),1===t._shimmedLocalStreams[i].length&&delete t._shimmedLocalStreams[i]})),n.apply(this,arguments)}}function QS(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return JS(e);var i=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=i.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var i=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(i.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,i){var r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[i.id];if(a)a.addTrack(t),Promise.resolve().then((function(){r.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[i.id]=s,this._reverseStreams[s.id]=i,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=sv({},t,(function(){var e=this,t=arguments,r=arguments.length&&"function"==typeof arguments[0];return r?i.apply(this,[function(i){var r=s(e,i);t[0].apply(null,[r])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):i.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=r[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,i=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(r){i._streams[r].getTracks().find((function(t){return e.track===t}))&&(t=i._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(n.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:i})}function c(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(r.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:i})}}function ZS(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=sv({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}))}function $S(e,t){fy(e,"negotiationneeded",(function(e){var i=e.target;if(!(t.version<72||i.getConfiguration&&"plan-b"===i.getConfiguration().sdpSemantics)||"stable"===i.signalingState)return e}))}var eE=Object.freeze({__proto__:null,shimMediaStream:KS,shimOnTrack:WS,shimGetSendersWithDtmf:XS,shimGetStats:qS,shimSenderReceiverGetStats:YS,shimAddTrackRemoveTrackWithNative:JS,shimAddTrackRemoveTrack:QS,shimPeerConnection:ZS,fixNegotiationNeeded:$S,shimGetUserMedia:zS,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then((function(t){var r=i.video&&i.video.width,n=i.video&&i.video.height,o=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(i.video.mandatory.maxWidth=r),n&&(i.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(i)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),tE=n,iE=a,rE=Go,nE=Rv.trim,oE=T("".charAt),aE=tE.parseFloat,sE=tE.Symbol,cE=sE&&sE.iterator,uE=1/aE("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||cE&&!iE((function(){aE(Object(cE))}))?function(e){var t=nE(rE(e)),i=aE(t);return 0===i&&"-"==oE(t,0)?-0:i}:aE;jr({global:!0,forced:parseFloat!=uE},{parseFloat:uE});var dE=jr,lE=zu,hE=a,pE=W,fE=B,_E=Zd,vE=sh,mE=zt.exports;if(dE({target:"Promise",proto:!0,real:!0,forced:!!lE&&hE((function(){lE.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=_E(this,pE("Promise")),i=fE(e);return this.then(i?function(i){return vE(t,e()).then((function(){return i}))}:e,i?function(i){return vE(t,e()).then((function(){throw i}))}:e)}}),fE(lE)){var yE=pE("Promise").prototype.finally;lE.prototype.finally!==yE&&mE(lE.prototype,"finally",yE,{unsafe:!0})}function gE(e,t){var i=e&&e.navigator,r=e&&e.MediaStreamTrack;if(i.getUserMedia=function(e,t,r){yy("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){var n=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])},o=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(e){return"object"===vs(e)&&"object"===vs(e.audio)&&(e=JSON.parse(JSON.stringify(e)),n(e.audio,"autoGainControl","mozAutoGainControl"),n(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},r&&r.prototype.getSettings){var a=r.prototype.getSettings;r.prototype.getSettings=function(){var e=a.apply(this,arguments);return n(e,"mozAutoGainControl","autoGainControl"),n(e,"mozNoiseSuppression","noiseSuppression"),e}}if(r&&r.prototype.applyConstraints){var s=r.prototype.applyConstraints;r.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===vs(e)&&(e=JSON.parse(JSON.stringify(e)),n(e,"autoGainControl","mozAutoGainControl"),n(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function SE(e){"object"===vs(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function EE(e,t){if("object"===vs(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=sv({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}));var i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),n=e[0],o=e[1],a=e[2];return r.apply(this,[n||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=i[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,r){e.set(r,Object.assign({},t,{type:i[t.type]||t.type}))}))}return e})).then(o,a)}}}function bE(e){if("object"===vs(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function IE(e){if("object"===vs(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i}),fy(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function TE(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;yy("removeStream","removeTrack"),this.getSenders().forEach((function(i){i.track&&e.getTracks().includes(i.track)&&t.removeTrack(i)}))})}function AE(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function RE(e){if("object"===vs(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],i=e&&"sendEncodings"in e;i&&e.sendEncodings.forEach((function(e){if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var r=t.apply(this,arguments);if(i){var n=r.sender,o=n.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,n.sendEncodings=e.sendEncodings,this.setParametersPromises.push(n.setParameters(o).then((function(){delete n.sendEncodings})).catch((function(){delete n.sendEncodings}))))}return r})}}function CE(e){if("object"===vs(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function OE(e){if("object"===vs(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,i=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(i,e)})).finally((function(){i.setParametersPromises=[]})):t.apply(this,arguments)}}}function wE(e){if("object"===vs(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,i=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(i,e)})).finally((function(){i.setParametersPromises=[]})):t.apply(this,arguments)}}}var kE=Object.freeze({__proto__:null,shimOnTrack:SE,shimPeerConnection:EE,shimSenderGetStats:bE,shimReceiverGetStats:IE,shimRemoveStream:TE,shimRTCDataChannel:AE,shimAddTransceiver:RE,shimGetParameters:CE,shimCreateOffer:OE,shimCreateAnswer:wE,shimGetUserMedia:gE,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(i){if(!i||!i.video){var r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return!0===i.video?i.video={mediaSource:t}:i.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(i)})}});function NE(e){if("object"===vs(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return t.call(i,r,e)})),e.getVideoTracks().forEach((function(r){return t.call(i,r,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var i=this,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n&&n.forEach((function(e){i._localStreams?i._localStreams.includes(e)||i._localStreams.push(e):i._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var i=this._localStreams.indexOf(e);if(-1!==i){this._localStreams.splice(i,1);var r=e.getTracks();this.getSenders().forEach((function(e){r.includes(e.track)&&t.removeTrack(e)}))}})}}function PE(e){if("object"===vs(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var i=new Event("addstream");i.stream=e,t.dispatchEvent(i)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var i=new Event("addstream");i.stream=t,e.dispatchEvent(i)}}))}),t.apply(e,arguments)}}}function DE(e){if("object"===vs(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,i=t.createOffer,r=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n};var s=function(e,t,i){var r=n.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,i){var r=o.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,i){var r=a.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},t.addIceCandidate=s}}function ME(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var i=t.mediaDevices,r=i.getUserMedia.bind(i);t.mediaDevices.getUserMedia=function(e){return r(LE(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,i,r){t.mediaDevices.getUserMedia(e).then(i,r)}.bind(t))}function LE(e){return e&&void 0!==e.video?Object.assign({},e,{video:Ey(e.video)}):e}function UE(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,i){if(e&&e.iceServers){for(var r=[],n=0;n<e.iceServers.length;n++){var o=e.iceServers[n];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(yy("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,r.push(o)):r.push(e.iceServers[n])}e.iceServers=r}return new t(e,i)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function xE(e){"object"===vs(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function VE(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveAudio||i||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var r=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function FE(e){"object"!==vs(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var BE=Object.freeze({__proto__:null,shimLocalStreamsAPI:NE,shimRemoteStreamsAPI:PE,shimCallbacksAPI:DE,shimGetUserMedia:ME,shimConstraints:LE,shimRTCIceServerUrls:UE,shimTrackEventTransceiver:xE,shimCreateOfferLegacy:VE,shimAudioContext:FE}),jE=De,GE=st;jr({target:"Date",proto:!0,forced:a((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=jE(this),i=GE(t,"number");return"number"!=typeof i||isFinite(i)?t.toISOString():null}});var HE=l;jr({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return HE(URL.prototype.toString,this)}});var zE=T(1..valueOf),KE=s,WE=n,XE=T,qE=Dr,YE=zt.exports,JE=Ue,QE=lm,ZE=X,$E=le,eb=st,tb=a,ib=Bi.f,rb=o.f,nb=Rt.f,ob=zE,ab=Rv.trim,sb=WE.Number,cb=sb.prototype,ub=WE.TypeError,db=XE("".slice),lb=XE("".charCodeAt),hb=function(e){var t=eb(e,"number");return"bigint"==typeof t?t:pb(t)},pb=function(e){var t,i,r,n,o,a,s,c,u=eb(e,"number");if($E(u))throw ub("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=ab(u),43===(t=lb(u,0))||45===t){if(88===(i=lb(u,2))||120===i)return NaN}else if(48===t){switch(lb(u,1)){case 66:case 98:r=2,n=49;break;case 79:case 111:r=8,n=55;break;default:return+u}for(a=(o=db(u,2)).length,s=0;s<a;s++)if((c=lb(o,s))<48||c>n)return NaN;return parseInt(o,r)}return+u};if(qE("Number",!sb(" 0o1")||!sb("0b1")||sb("+0x1"))){for(var fb,_b=function(e){var t=arguments.length<1?0:sb(hb(e)),i=this;return ZE(cb,i)&&tb((function(){ob(i)}))?QE(Object(t),i,_b):t},vb=KE?ib(sb):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),mb=0;vb.length>mb;mb++)JE(sb,fb=vb[mb])&&!JE(_b,fb)&&nb(_b,fb,rb(sb,fb));_b.prototype=cb,cb.constructor=_b,YE(WE,"Number",_b)}var yb=jr,gb=M,Sb=F,Eb=Un,bb=T([].join),Ib=gb!=Object,Tb=Eb("join",",");yb({target:"Array",proto:!0,forced:Ib||!Tb},{join:function(e){return bb(Sb(this),void 0===e?",":e)}});var Ab=Hs,Rb=l,Cb=T,Ob=Fa,wb=Uo,kb=Pt,Nb=U,Pb=Zd,Db=uv,Mb=Ji,Lb=Go,Ub=ge,xb=ec,Vb=Xa,Fb=ka,Bb=a,jb=ra.UNSUPPORTED_Y,Gb=Math.min,Hb=[].push,zb=Cb(/./.exec),Kb=Cb(Hb),Wb=Cb("".slice);Ob("split",(function(e,t,i){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,i){var r=Lb(Nb(this)),n=void 0===i?4294967295:i>>>0;if(0===n)return[];if(void 0===e)return[r];if(!wb(e))return Rb(t,r,e,n);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=Rb(Fb,l,r))&&!((a=l.lastIndex)>d&&(Kb(c,Wb(r,d,o.index)),o.length>1&&o.index<r.length&&Ab(Hb,c,xb(o,1)),s=o[0].length,d=a,c.length>=n));)l.lastIndex===o.index&&l.lastIndex++;return d===r.length?!s&&zb(l,"")||Kb(c,""):Kb(c,Wb(r,d)),c.length>n?xb(c,0,n):c}:"0".split(void 0,0).length?function(e,i){return void 0===e&&0===i?[]:Rb(t,this,e,i)}:t,[function(t,i){var n=Nb(this),o=null==t?void 0:Ub(t,e);return o?Rb(o,t,n,i):Rb(r,Lb(n),t,i)},function(e,n){var o=kb(this),a=Lb(e),s=i(r,o,a,n,r!==t);if(s.done)return s.value;var c=Pb(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(jb?"g":"y"),l=new c(jb?"^(?:"+o.source+")":o,d),h=void 0===n?4294967295:n>>>0;if(0===h)return[];if(0===a.length)return null===Vb(l,a)?[a]:[];for(var p=0,f=0,_=[];f<a.length;){l.lastIndex=jb?0:f;var v,m=Vb(l,jb?Wb(a,f):a);if(null===m||(v=Gb(Mb(l.lastIndex+(jb?f:0)),a.length))===p)f=Db(a,f,u);else{if(Kb(_,Wb(a,p,f)),_.length===h)return _;for(var y=1;y<=m.length-1;y++)if(Kb(_,m[y]),_.length===h)return _;f=p=v}}return Kb(_,Wb(a,p)),_}]}),!!Bb((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var i="ab".split(e);return 2!==i.length||"a"!==i[0]||"b"!==i[1]})),jb);var Xb=wi.PROPER,qb=a,Yb=yv,Jb=Rv.trim;jr({target:"String",proto:!0,forced:function(e){return qb((function(){return!!Yb[e]()||"
"!=="
"[e]()||Xb&&Yb[e].name!==e}))}("trim")},{trim:function(){return Jb(this)}});var Qb={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var i=t.splitSections(e);return i&&i[0]},t.getMediaSections=function(e){var i=t.splitSections(e);return i.shift(),i},t.matchPrefix=function(e,i){return t.splitLines(e).filter((function(e){return 0===e.indexOf(i)}))},t.parseCandidate=function(e){for(var t,i={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":i.relatedAddress=t[r+1];break;case"rport":i.relatedPort=parseInt(t[r+1],10);break;case"tcptype":i.tcpType=t[r+1];break;case"ufrag":i.ufrag=t[r+1],i.usernameFragment=t[r+1];break;default:void 0===i[t[r]]&&(i[t[r]]=t[r+1])}return i},t.writeCandidate=function(e){var t=[];t.push(e.foundation);var i=e.component;"rtp"===i?t.push(1):"rtcp"===i?t.push(2):t.push(i),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),i={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),i.name=t[0],i.clockRate=parseInt(t[1],10),i.channels=3===t.length?parseInt(t[2],10):1,i.numChannels=i.channels,i},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var i=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==i?"/"+i:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,i={},r=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<r.length;n++)i[(t=r[n].trim().split("="))[0].trim()]=t[1];return i},t.writeFmtp=function(e){var t="",i=e.payloadType;if(void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+i+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",i=e.payloadType;return void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+i+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),i={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(i.attribute=e.substr(t+1,r-t-1),i.value=e.substr(r+1)):i.attribute=e.substr(t+1),i},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var i=t.matchPrefix(e,"a=mid:")[0];if(i)return i.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,i){return{role:"auto",fingerprints:t.matchPrefix(e+i,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var i="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){i+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),i},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===vs(e.keyParams)?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,i){return t.matchPrefix(e+i,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,i){var r=t.matchPrefix(e+i,"a=ice-ufrag:")[0],n=t.matchPrefix(e+i,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},t.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){for(var i={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var o=r[n],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),i.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":i.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){i.headerExtensions.push(t.parseExtmap(e))})),i},t.writeRtpDescription=function(e,i){var r="";r+="m="+e+" ",r+=i.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=i.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",i.codecs.forEach((function(e){r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));var n=0;return i.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(r+="a=maxptime:"+n+"\r\n"),i.headerExtensions&&i.headerExtensions.forEach((function(e){r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){var i,r=[],n=t.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(i=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&i&&(t.rtx={ssrc:i}),r.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&c&&r.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){var i={},r=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(i.cname=r.value,i.ssrc=r.ssrc);var n=t.matchPrefix(e,"a=rtcp-rsize");i.reducedSize=n.length>0,i.compound=0===n.length;var o=t.matchPrefix(e,"a=rtcp-mux");return i.mux=o.length>0,i},t.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){var i,r=t.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(i=r[0].substr(7).split(" "))[0],track:i[1]};var n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(i=n[0].value.split(" "))[0],track:i[1]}:void 0},t.parseSctpDescription=function(e){var i,r=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");n.length>0&&(i=parseInt(n[0].substr(19),10)),isNaN(i)&&(i=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:r.fmt,maxMessageSize:i};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:i}}},t.writeSctpDescription=function(e,t){var i=[];return i="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&i.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),i.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,i,r){var n=void 0!==i?i:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,i){for(var r=t.splitLines(e),n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].substr(2)}return i?t.getDirection(i):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var i=t.splitLines(e)[0].substr(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},t.parseOLine=function(e){var i=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var i=t.splitLines(e),r=0;r<i.length;r++)if(i[r].length<2||"="!==i[r].charAt(1))return!1;return!0},e.exports=t}(Qb);var Zb=Qb.exports,$b=Object.freeze(e({__proto__:null,default:Zb},[Qb.exports]));function eI(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===vs(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var i=new t(e),r=Zb.parseCandidate(e.candidate),n=Object.assign(i,r);return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,fy(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function tI(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var i=function(e){if(!e||!e.sdp)return!1;var t=Zb.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=Zb.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},r=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var i=parseInt(t[1],10);return i!=i?-1:i},n=function(e){var i=65536;return"firefox"===t.browser&&(i=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),i},o=function(e,i){var r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);var n=Zb.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?r=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==i&&(r=2147483637),r},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(i(arguments[0])){var c,u=r(arguments[0]),d=n(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function iI(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return i(e,this),e},fy(e,"datachannel",(function(e){return i(e.channel,e.target),e}))}function i(e,t){var i=e.send;e.send=function(){var r=arguments[0],n=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return i.apply(e,arguments)}}}function rI(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var i=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var i=new Event("connectionstatechange",e);t.dispatchEvent(i)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}}))}}function nI(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var r=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return i.apply(this,arguments)}}}function oI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.addIceCandidate;i&&0!==i.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function aI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.setLocalDescription;i&&0!==i.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==vs(t)||t.type&&t.sdp)return i.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return i.apply(this,[t]);var r="offer"===t.type?this.createOffer:this.createAnswer;return r.apply(this).then((function(t){return i.apply(e,[t])}))})}}var sI=Object.freeze({__proto__:null,shimRTCIceCandidate:eI,shimMaxMessageSize:tI,shimSendThrowTypeError:iI,shimConnectionState:rI,removeExtmapAllowMixed:nI,shimAddIceCandidateNullOrEmpty:oI,shimParameterlessSetLocalDescription:aI});function cI(e,t,i,r,n,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(r,n)}function uI(e){return function(){var t=this,i=arguments;return new Promise((function(r,n){var o=e.apply(t,i);function a(e){cI(o,r,n,a,s,"next",e)}function s(e){cI(o,r,n,a,s,"throw",e)}a(void 0)}))}}!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},r=my,n=gy(t),o={browserDetails:n,commonShim:sI,extractVersion:py,disableLog:_y,disableWarnings:vy,sdp:$b};switch(n.browser){case"chrome":if(!eE||!ZS||!i.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=eE,oI(t,n),aI(t),zS(t,n),KS(t),ZS(t,n),WS(t),QS(t,n),XS(t),qS(t),YS(t),$S(t,n),eI(t),rI(t),tI(t,n),iI(t),nI(t,n);break;case"firefox":if(!kE||!EE||!i.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=kE,oI(t,n),aI(t),gE(t,n),EE(t,n),SE(t),TE(t),bE(t),IE(t),AE(t),RE(t),CE(t),OE(t),wE(t),eI(t),rI(t),tI(t,n),iI(t);break;case"safari":if(!BE||!i.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=BE,oI(t,n),aI(t),UE(t),VE(t),DE(t),NE(t),PE(t),xE(t),ME(t),FE(t),eI(t),tI(t,n),iI(t),nI(t,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),pc("toStringTag"),mc(n.JSON,"JSON",!0),mc(Math,"Math",!0);var dI=De,lI=Zp,hI=Hp;jr({target:"Object",stat:!0,forced:a((function(){lI(1)})),sham:!hI},{getPrototypeOf:function(e){return lI(dI(e))}});var pI=jr,fI=Xr,_I=T([].reverse),vI=[1,2];pI({target:"Array",proto:!0,forced:String(vI)===String(vI.reverse())},{reverse:function(){return fI(this)&&(this.length=this.length),_I(this)}}),jr({global:!0},{globalThis:n});var mI={exports:{}};!function(e){var t=function(e){var t,i=Object.prototype,r=i.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function c(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,i){return e[t]=i}}function u(e,t,i,r){var n=t&&t.prototype instanceof v?t:v,o=Object.create(n.prototype),a=new O(r||[]);return o._invoke=function(e,t,i){var r=l;return function(n,o){if(r===p)throw new Error("Generator is already running");if(r===f){if("throw"===n)throw o;return k()}for(i.method=n,i.arg=o;;){var a=i.delegate;if(a){var s=A(a,i);if(s){if(s===_)continue;return s}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===l)throw r=f,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=p;var c=d(e,t,i);if("normal"===c.type){if(r=i.done?f:h,c.arg===_)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(r=f,i.method="throw",i.arg=c.arg)}}}(e,i,a),o}function d(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l="suspendedStart",h="suspendedYield",p="executing",f="completed",_={};function v(){}function m(){}function y(){}var g={};c(g,o,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(w([])));E&&E!==i&&r.call(E,o)&&(g=E);var b=y.prototype=v.prototype=Object.create(g);function I(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function i(n,o,a,s){var c=d(e[n],e,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"===vs(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return i("throw",e,a,s)}))}s(c.arg)}var n;this._invoke=function(e,r){function o(){return new t((function(t,n){i(e,r,t,n)}))}return n=n?n.then(o,o):o()}}function A(e,i){var r=e.iterator[i.method];if(r===t){if(i.delegate=null,"throw"===i.method){if(e.iterator.return&&(i.method="return",i.arg=t,A(e,i),"throw"===i.method))return _;i.method="throw",i.arg=new TypeError("The iterator does not provide a 'throw' method")}return _}var n=d(r,e.iterator,i.arg);if("throw"===n.type)return i.method="throw",i.arg=n.arg,i.delegate=null,_;var o=n.arg;return o?o.done?(i[e.resultName]=o.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=t),i.delegate=null,_):o:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,_)}function R(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(R,this),this.reset(!0)}function w(e){if(e){var i=e[o];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function i(){for(;++n<e.length;)if(r.call(e,n))return i.value=e[n],i.done=!1,i;return i.value=t,i.done=!0,i};return a.next=a}}return{next:k}}function k(){return{value:t,done:!0}}return m.prototype=y,c(b,"constructor",y),c(y,"constructor",m),m.displayName=c(y,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,c(e,s,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},I(T.prototype),c(T.prototype,a,(function(){return this})),e.AsyncIterator=T,e.async=function(t,i,r,n,o){void 0===o&&(o=Promise);var a=new T(u(t,i,r,n),o);return e.isGeneratorFunction(i)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},I(b),c(b,s,"Generator"),c(b,o,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var i in e)t.push(i);return t.reverse(),function i(){for(;t.length;){var r=t.pop();if(r in e)return i.value=r,i.done=!1,i}return i.done=!0,i}},e.values=w,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var i in this)"t"===i.charAt(0)&&r.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var i=this;function n(r,n){return s.type="throw",s.arg=e,i.next=r,n&&(i.method="next",i.arg=t),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,_):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),C(i),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var r=i.completion;if("throw"===r.type){var n=r.arg;C(i)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,i,r){return this.delegate={iterator:w(e),resultName:i,nextLoc:r},"next"===this.method&&(this.arg=t),_}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":vs(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(mI);var yI=mI.exports,gI=jr,SI=n,EI=Hs,bI=B,II=ac,TI=el,AI=/MSIE .\./.test(q),RI=SI.Function,CI=function(e){return function(t,i){var r=TI(arguments.length,1)>2,n=bI(t)?t:RI(t),o=r?II(arguments,2):void 0;return e(r?function(){EI(n,this,o)}:n,i)}};gI({global:!0,bind:!0,forced:AI},{setTimeout:CI(SI.setTimeout),setInterval:CI(SI.setInterval)});var OI=Pt,wI=Ed,kI=Kr,NI=l,PI=De,DI=function(e,t,i,r){try{return r?t(OI(i)[0],i[1]):t(i)}catch(t){wI(e,"throw",t)}},MI=od,LI=yn,UI=Zi,xI=qs,VI=md,FI=dd,BI=n.Array,jI=function(e){var t=PI(e),i=LI(this),r=arguments.length,n=r>1?arguments[1]:void 0,o=void 0!==n;o&&(n=kI(n,r>2?arguments[2]:void 0));var a,s,c,u,d,l,h=FI(t),p=0;if(!h||this==BI&&MI(h))for(a=UI(t),s=i?new this(a):BI(a);a>p;p++)l=o?n(t[p],p):t[p],xI(s,p,l);else for(d=(u=VI(t,h)).next,s=i?new this:[];!(c=NI(d,u)).done;p++)l=o?DI(u,n,[c.value,p],!0):c.value,xI(s,p,l);return s.length=p,s},GI=jI;jr({target:"Array",stat:!0,forced:!zd((function(e){Array.from(e)}))},{from:GI});var HI=a,zI=Ze("iterator"),KI=!HI((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[zI]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==i||"x"!==new URL("http://x",void 0).host})),WI=T,XI=/[^\0-\u007E]/,qI=/[.\u3002\uFF0E\uFF61]/g,YI="Overflow: input needs wider integers to process",JI=n.RangeError,QI=WI(qI.exec),ZI=Math.floor,$I=String.fromCharCode,eT=WI("".charCodeAt),tT=WI([].join),iT=WI([].push),rT=WI("".replace),nT=WI("".split),oT=WI("".toLowerCase),aT=function(e){return e+22+75*(e<26)},sT=function(e,t,i){var r=0;for(e=i?ZI(e/700):e>>1,e+=ZI(e/t);e>455;)e=ZI(e/35),r+=36;return ZI(r+36*e/(e+38))},cT=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var n=eT(e,i++);if(n>=55296&&n<=56319&&i<r){var o=eT(e,i++);56320==(64512&o)?iT(t,((1023&n)<<10)+(1023&o)+65536):(iT(t,n),i--)}else iT(t,n)}return t}(e);var i,r,n=e.length,o=128,a=0,s=72;for(i=0;i<e.length;i++)(r=e[i])<128&&iT(t,$I(r));var c=t.length,u=c;for(c&&iT(t,"-");u<n;){var d=2147483647;for(i=0;i<e.length;i++)(r=e[i])>=o&&r<d&&(d=r);var l=u+1;if(d-o>ZI((2147483647-a)/l))throw JI(YI);for(a+=(d-o)*l,o=d,i=0;i<e.length;i++){if((r=e[i])<o&&++a>2147483647)throw JI(YI);if(r==o){for(var h=a,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var _=h-f,v=36-f;iT(t,$I(aT(f+_%v))),h=ZI(_/v),p+=36}iT(t,$I(aT(h))),s=sT(a,l,u==c),a=0,u++}}a++,o++}return tT(t,"")},uT=ec,dT=Math.floor,lT=function(e,t){var i=e.length,r=dT(i/2);return i<8?hT(e,t):pT(e,lT(uT(e,0,r),t),lT(uT(e,r),t),t)},hT=function(e,t){for(var i,r,n=e.length,o=1;o<n;){for(r=o,i=e[o];r&&t(e[r-1],i)>0;)e[r]=e[--r];r!==o++&&(e[r]=i)}return e},pT=function(e,t,i,r){for(var n=t.length,o=i.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?r(t[a],i[s])<=0?t[a++]:i[s++]:a<n?t[a++]:i[s++];return e},fT=lT,_T=jr,vT=n,mT=W,yT=l,gT=T,ST=KI,ET=zt.exports,bT=Wu,IT=mc,TT=ff,AT=Ii,RT=ed,CT=B,OT=Ue,wT=Kr,kT=nn,NT=Pt,PT=G,DT=Go,MT=Ao,LT=y,UT=md,xT=dd,VT=el,FT=fT,BT=Ze("iterator"),jT=AT.set,GT=AT.getterFor("URLSearchParams"),HT=AT.getterFor("URLSearchParamsIterator"),zT=mT("fetch"),KT=mT("Request"),WT=mT("Headers"),XT=KT&&KT.prototype,qT=WT&&WT.prototype,YT=vT.RegExp,JT=vT.TypeError,QT=vT.decodeURIComponent,ZT=vT.encodeURIComponent,$T=gT("".charAt),eA=gT([].join),tA=gT([].push),iA=gT("".replace),rA=gT([].shift),nA=gT([].splice),oA=gT("".split),aA=gT("".slice),sA=/\+/g,cA=Array(4),uA=function(e){return cA[e-1]||(cA[e-1]=YT("((?:%[\\da-f]{2}){"+e+"})","gi"))},dA=function(e){try{return QT(e)}catch(t){return e}},lA=function(e){var t=iA(e,sA," "),i=4;try{return QT(t)}catch(e){for(;i;)t=iA(t,uA(i--),dA);return t}},hA=/[!'()~]|%20/g,pA={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},fA=function(e){return pA[e]},_A=function(e){return iA(ZT(e),hA,fA)},vA=TT((function(e,t){jT(this,{type:"URLSearchParamsIterator",iterator:UT(GT(e).entries),kind:t})}),"Iterator",(function(){var e=HT(this),t=e.kind,i=e.iterator.next(),r=i.value;return i.done||(i.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),i}),!0),mA=function(e){this.entries=[],this.url=null,void 0!==e&&(PT(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===$T(e,0)?aA(e,1):e:DT(e)))};mA.prototype={type:"URLSearchParams",bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,n,o,a,s,c=xT(e);if(c)for(i=(t=UT(e,c)).next;!(r=yT(i,t)).done;){if(o=(n=UT(NT(r.value))).next,(a=yT(o,n)).done||(s=yT(o,n)).done||!yT(o,n).done)throw JT("Expected sequence with length 2");tA(this.entries,{key:DT(a.value),value:DT(s.value)})}else for(var u in e)OT(e,u)&&tA(this.entries,{key:u,value:DT(e[u])})},parseQuery:function(e){if(e)for(var t,i,r=oA(e,"&"),n=0;n<r.length;)(t=r[n++]).length&&(i=oA(t,"="),tA(this.entries,{key:lA(rA(i)),value:lA(eA(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],tA(i,_A(e.key)+"="+_A(e.value));return eA(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var yA=function(){RT(this,gA);var e=arguments.length>0?arguments[0]:void 0;jT(this,new mA(e))},gA=yA.prototype;if(bT(gA,{append:function(e,t){VT(arguments.length,2);var i=GT(this);tA(i.entries,{key:DT(e),value:DT(t)}),i.updateURL()},delete:function(e){VT(arguments.length,1);for(var t=GT(this),i=t.entries,r=DT(e),n=0;n<i.length;)i[n].key===r?nA(i,n,1):n++;t.updateURL()},get:function(e){VT(arguments.length,1);for(var t=GT(this).entries,i=DT(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){VT(arguments.length,1);for(var t=GT(this).entries,i=DT(e),r=[],n=0;n<t.length;n++)t[n].key===i&&tA(r,t[n].value);return r},has:function(e){VT(arguments.length,1);for(var t=GT(this).entries,i=DT(e),r=0;r<t.length;)if(t[r++].key===i)return!0;return!1},set:function(e,t){VT(arguments.length,1);for(var i,r=GT(this),n=r.entries,o=!1,a=DT(e),s=DT(t),c=0;c<n.length;c++)(i=n[c]).key===a&&(o?nA(n,c--,1):(o=!0,i.value=s));o||tA(n,{key:a,value:s}),r.updateURL()},sort:function(){var e=GT(this);FT(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,i=GT(this).entries,r=wT(e,arguments.length>1?arguments[1]:void 0),n=0;n<i.length;)r((t=i[n++]).value,t.key,this)},keys:function(){return new vA(this,"keys")},values:function(){return new vA(this,"values")},entries:function(){return new vA(this,"entries")}},{enumerable:!0}),ET(gA,BT,gA.entries,{name:"entries"}),ET(gA,"toString",(function(){return GT(this).serialize()}),{enumerable:!0}),IT(yA,"URLSearchParams"),_T({global:!0,forced:!ST},{URLSearchParams:yA}),!ST&&CT(WT)){var SA=gT(qT.has),EA=gT(qT.set),bA=function(e){if(PT(e)){var t,i=e.body;if("URLSearchParams"===kT(i))return t=e.headers?new WT(e.headers):new WT,SA(t,"content-type")||EA(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),MT(e,{body:LT(0,DT(i)),headers:LT(0,t)})}return e};if(CT(zT)&&_T({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return zT(e,arguments.length>1?bA(arguments[1]):{})}}),CT(KT)){var IA=function(e){return RT(this,XT),new KT(e,arguments.length>1?bA(arguments[1]):{})};XT.constructor=IA,IA.prototype=XT,_T({global:!0,forced:!0},{Request:IA})}}var TA,AA={URLSearchParams:yA,getState:GT},RA=jr,CA=s,OA=KI,wA=n,kA=Kr,NA=T,PA=to.f,DA=zt.exports,MA=ed,LA=Ue,UA=xs,xA=jI,VA=ec,FA=Zf.codeAt,BA=function(e){var t,i,r=[],n=nT(rT(oT(e),qI,"."),".");for(t=0;t<n.length;t++)i=n[t],iT(r,QI(XI,i)?"xn--"+cT(i):i);return tT(r,".")},jA=Go,GA=mc,HA=el,zA=AA,KA=Ii,WA=KA.set,XA=KA.getterFor("URL"),qA=zA.URLSearchParams,YA=zA.getState,JA=wA.URL,QA=wA.TypeError,ZA=wA.parseInt,$A=Math.floor,eR=Math.pow,tR=NA("".charAt),iR=NA(/./.exec),rR=NA([].join),nR=NA(1..toString),oR=NA([].pop),aR=NA([].push),sR=NA("".replace),cR=NA([].shift),uR=NA("".split),dR=NA("".slice),lR=NA("".toLowerCase),hR=NA([].unshift),pR=/[a-z]/i,fR=/[\d+-.a-z]/i,_R=/\d/,vR=/^0x/i,mR=/^[0-7]+$/,yR=/^\d+$/,gR=/^[\da-f]+$/i,SR=/[\0\t\n\r #%/:<>?@[\\\]^|]/,ER=/[\0\t\n\r #/:<>?@[\\\]^|]/,bR=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,IR=/[\t\n\r]/g,TR=function(e){var t,i,r,n;if("number"==typeof e){for(t=[],i=0;i<4;i++)hR(t,e%256),e=$A(e/256);return rR(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,i=1,r=null,n=0,o=0;o<8;o++)0!==e[o]?(n>i&&(t=r,i=n),r=null,n=0):(null===r&&(r=o),++n);return n>i&&(t=r,i=n),t}(e),i=0;i<8;i++)n&&0===e[i]||(n&&(n=!1),r===i?(t+=i?":":"::",n=!0):(t+=nR(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},AR={},RR=UA({},AR,{" ":1,'"':1,"<":1,">":1,"`":1}),CR=UA({},RR,{"#":1,"?":1,"{":1,"}":1}),OR=UA({},CR,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),wR=function(e,t){var i=FA(e,0);return i>32&&i<127&&!LA(t,e)?e:encodeURIComponent(e)},kR={ftp:21,file:null,http:80,https:443,ws:80,wss:443},NR=function(e,t){var i;return 2==e.length&&iR(pR,tR(e,0))&&(":"==(i=tR(e,1))||!t&&"|"==i)},PR=function(e){var t;return e.length>1&&NR(dR(e,0,2))&&(2==e.length||"/"===(t=tR(e,2))||"\\"===t||"?"===t||"#"===t)},DR=function(e){return"."===e||"%2e"===lR(e)},MR={},LR={},UR={},xR={},VR={},FR={},BR={},jR={},GR={},HR={},zR={},KR={},WR={},XR={},qR={},YR={},JR={},QR={},ZR={},$R={},eC={},tC=function(e,t,i){var r,n,o,a=jA(e);if(t){if(n=this.parse(a))throw QA(n);this.searchParams=null}else{if(void 0!==i&&(r=new tC(i,!0)),n=this.parse(a,null,r))throw QA(n);(o=YA(new qA)).bindURL(this),this.searchParams=o}};tC.prototype={type:"URL",parse:function(e,t,i){var r,n,o,a,s,c=this,u=t||MR,d=0,l="",h=!1,p=!1,f=!1;for(e=jA(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=sR(e,bR,"")),e=sR(e,IR,""),r=xA(e);d<=r.length;){switch(n=r[d],u){case MR:if(!n||!iR(pR,n)){if(t)return"Invalid scheme";u=UR;continue}l+=lR(n),u=LR;break;case LR:if(n&&(iR(fR,n)||"+"==n||"-"==n||"."==n))l+=lR(n);else{if(":"!=n){if(t)return"Invalid scheme";l="",u=UR,d=0;continue}if(t&&(c.isSpecial()!=LA(kR,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&kR[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=XR:c.isSpecial()&&i&&i.scheme==c.scheme?u=xR:c.isSpecial()?u=jR:"/"==r[d+1]?(u=VR,d++):(c.cannotBeABaseURL=!0,aR(c.path,""),u=ZR)}break;case UR:if(!i||i.cannotBeABaseURL&&"#"!=n)return"Invalid scheme";if(i.cannotBeABaseURL&&"#"==n){c.scheme=i.scheme,c.path=VA(i.path),c.query=i.query,c.fragment="",c.cannotBeABaseURL=!0,u=eC;break}u="file"==i.scheme?XR:FR;continue;case xR:if("/"!=n||"/"!=r[d+1]){u=FR;continue}u=GR,d++;break;case VR:if("/"==n){u=HR;break}u=QR;continue;case FR:if(c.scheme=i.scheme,n==TA)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=VA(i.path),c.query=i.query;else if("/"==n||"\\"==n&&c.isSpecial())u=BR;else if("?"==n)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=VA(i.path),c.query="",u=$R;else{if("#"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=VA(i.path),c.path.length--,u=QR;continue}c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=VA(i.path),c.query=i.query,c.fragment="",u=eC}break;case BR:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,u=QR;continue}u=HR}else u=GR;break;case jR:if(u=GR,"/"!=n||"/"!=tR(l,d+1))continue;d++;break;case GR:if("/"!=n&&"\\"!=n){u=HR;continue}break;case HR:if("@"==n){h&&(l="%40"+l),h=!0,o=xA(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||f){var m=wR(v,OR);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(n==TA||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=xA(l).length+1,l="",u=zR}else l+=n;break;case zR:case KR:if(t&&"file"==c.scheme){u=YR;continue}if(":"!=n||p){if(n==TA||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return"Invalid host";if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=JR,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return"Invalid host";if(a=c.parseHost(l))return a;if(l="",u=WR,t==KR)return}break;case WR:if(!iR(_R,n)){if(n==TA||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var y=ZA(l,10);if(y>65535)return"Invalid port";c.port=c.isSpecial()&&y===kR[c.scheme]?null:y,l=""}if(t)return;u=JR;continue}return"Invalid port"}l+=n;break;case XR:if(c.scheme="file","/"==n||"\\"==n)u=qR;else{if(!i||"file"!=i.scheme){u=QR;continue}if(n==TA)c.host=i.host,c.path=VA(i.path),c.query=i.query;else if("?"==n)c.host=i.host,c.path=VA(i.path),c.query="",u=$R;else{if("#"!=n){PR(rR(VA(r,d),""))||(c.host=i.host,c.path=VA(i.path),c.shortenPath()),u=QR;continue}c.host=i.host,c.path=VA(i.path),c.query=i.query,c.fragment="",u=eC}}break;case qR:if("/"==n||"\\"==n){u=YR;break}i&&"file"==i.scheme&&!PR(rR(VA(r,d),""))&&(NR(i.path[0],!0)?aR(c.path,i.path[0]):c.host=i.host),u=QR;continue;case YR:if(n==TA||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&NR(l))u=QR;else if(""==l){if(c.host="",t)return;u=JR}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=JR}continue}l+=n;break;case JR:if(c.isSpecial()){if(u=QR,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=TA&&(u=QR,"/"!=n))continue}else c.fragment="",u=eC;else c.query="",u=$R;break;case QR:if(n==TA||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=lR(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||aR(c.path,"")):DR(l)?"/"==n||"\\"==n&&c.isSpecial()||aR(c.path,""):("file"==c.scheme&&!c.path.length&&NR(l)&&(c.host&&(c.host=""),l=tR(l,0)+":"),aR(c.path,l)),l="","file"==c.scheme&&(n==TA||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)cR(c.path);"?"==n?(c.query="",u=$R):"#"==n&&(c.fragment="",u=eC)}else l+=wR(n,CR);break;case ZR:"?"==n?(c.query="",u=$R):"#"==n?(c.fragment="",u=eC):n!=TA&&(c.path[0]+=wR(n,AR));break;case $R:t||"#"!=n?n!=TA&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":wR(n,AR)):(c.fragment="",u=eC);break;case eC:n!=TA&&(c.fragment+=wR(n,RR))}d++}},parseHost:function(e){var t,i,r;if("["==tR(e,0)){if("]"!=tR(e,e.length-1))return"Invalid host";if(t=function(e){var t,i,r,n,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return tR(e,l)};if(":"==h()){if(":"!=tR(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=i=0;i<4&&iR(gR,h());)t=16*t+ZA(h(),16),l++,i++;if("."==h()){if(0==i)return;if(l-=i,u>6)return;for(r=0;h();){if(n=null,r>0){if(!("."==h()&&r<4))return;l++}if(!iR(_R,h()))return;for(;iR(_R,h());){if(o=ZA(h(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;l++}c[u]=256*c[u]+n,2!=++r&&4!=r||u++}if(4!=r)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(dR(e,1,-1)),!t)return"Invalid host";this.host=t}else if(this.isSpecial()){if(e=BA(e),iR(SR,e))return"Invalid host";if(t=function(e){var t,i,r,n,o,a,s,c=uR(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(i=[],r=0;r<t;r++){if(""==(n=c[r]))return e;if(o=10,n.length>1&&"0"==tR(n,0)&&(o=iR(vR,n)?16:8,n=dR(n,8==o?1:2)),""===n)a=0;else{if(!iR(10==o?yR:8==o?mR:gR,n))return e;a=ZA(n,o)}aR(i,a)}for(r=0;r<t;r++)if(a=i[r],r==t-1){if(a>=eR(256,5-t))return null}else if(a>255)return null;for(s=oR(i),r=0;r<i.length;r++)s+=i[r]*eR(256,3-r);return s}(e),null===t)return"Invalid host";this.host=t}else{if(iR(ER,e))return"Invalid host";for(t="",i=xA(e),r=0;r<i.length;r++)t+=wR(i[r],AR);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return LA(kR,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&NR(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,r=e.password,n=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==n?(u+="//",e.includesCredentials()&&(u+=i+(r?":"+r:"")+"@"),u+=TR(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+rR(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw QA(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new iC(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+TR(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(jA(e)+":",MR)},getUsername:function(){return this.username},setUsername:function(e){var t=xA(jA(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=wR(t[i],OR)}},getPassword:function(){return this.password},setPassword:function(e){var t=xA(jA(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=wR(t[i],OR)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?TR(e):TR(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,zR)},getHostname:function(){var e=this.host;return null===e?"":TR(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,KR)},getPort:function(){var e=this.port;return null===e?"":jA(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=jA(e))?this.port=null:this.parse(e,WR))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+rR(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,JR))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=jA(e))?this.query=null:("?"==tR(e,0)&&(e=dR(e,1)),this.query="",this.parse(e,$R)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=jA(e))?("#"==tR(e,0)&&(e=dR(e,1)),this.fragment="",this.parse(e,eC)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var iC=function(e){var t=MA(this,rC),i=HA(arguments.length,1)>1?arguments[1]:void 0,r=WA(t,new tC(e,!1,i));CA||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},rC=iC.prototype,nC=function(e,t){return{get:function(){return XA(this)[e]()},set:t&&function(e){return XA(this)[t](e)},configurable:!0,enumerable:!0}};if(CA&&PA(rC,{href:nC("serialize","setHref"),origin:nC("getOrigin"),protocol:nC("getProtocol","setProtocol"),username:nC("getUsername","setUsername"),password:nC("getPassword","setPassword"),host:nC("getHost","setHost"),hostname:nC("getHostname","setHostname"),port:nC("getPort","setPort"),pathname:nC("getPathname","setPathname"),search:nC("getSearch","setSearch"),searchParams:nC("getSearchParams"),hash:nC("getHash","setHash")}),DA(rC,"toJSON",(function(){return XA(this).serialize()}),{enumerable:!0}),DA(rC,"toString",(function(){return XA(this).serialize()}),{enumerable:!0}),JA){var oC=JA.createObjectURL,aC=JA.revokeObjectURL;oC&&DA(iC,"createObjectURL",kA(oC,JA)),aC&&DA(iC,"revokeObjectURL",kA(aC,JA))}GA(iC,"URL"),RA({global:!0,forced:!OA,sham:!CA},{URL:iC});var sC=jr,cC=n,uC=l,dC=T,lC=U,hC=B,pC=Uo,fC=Go,_C=ge,vC=Zo,mC=Jy,yC=Ze("replace"),gC=RegExp.prototype,SC=cC.TypeError,EC=dC(vC),bC=dC("".indexOf);dC("".replace);var IC=dC("".slice),TC=Math.max,AC=function(e,t,i){return i>e.length?-1:""===t?i:bC(e,t,i)};sC({target:"String",proto:!0},{replaceAll:function(e,t){var i,r,n,o,a,s,c,u,d=lC(this),l=0,h=0,p="";if(null!=e){if(pC(e)&&(i=fC(lC("flags"in gC?e.flags:EC(e))),!~bC(i,"g")))throw SC("`.replaceAll` does not allow non-global regexes");if(r=_C(e,yC))return uC(r,e,d,t)}for(n=fC(d),o=fC(e),(a=hC(t))||(t=fC(t)),s=o.length,c=TC(1,s),l=AC(n,o,0);-1!==l;)u=a?fC(t(o,l,n)):mC(o,n,l,[],void 0,t),p+=IC(n,h,l)+u,h=l+s,l=AC(n,o,l+c);return h<n.length&&(p+=IC(n,h)),p}});var RC="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,CC=Hi,OC=Ji,wC=n.RangeError,kC=function(e){if(void 0===e)return 0;var t=CC(e),i=OC(t);if(t!==i)throw wC("Wrong length or index");return i},NC=n.Array,PC=Math.abs,DC=Math.pow,MC=Math.floor,LC=Math.log,UC=Math.LN2,xC={pack:function(e,t,i){var r,n,o,a=NC(i),s=8*i-t-1,c=(1<<s)-1,u=c>>1,d=23===t?DC(2,-24)-DC(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=PC(e))!=e||e===1/0?(n=e!=e?1:0,r=c):(r=MC(LC(e)/UC),e*(o=DC(2,-r))<1&&(r--,o*=2),(e+=r+u>=1?d/o:d*DC(2,1-u))*o>=2&&(r++,o/=2),r+u>=c?(n=0,r=c):r+u>=1?(n=(e*o-1)*DC(2,t),r+=u):(n=e*DC(2,u-1)*DC(2,t),r=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(r=r<<t|n,s+=t;s>0;)a[h++]=255&r,r/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var i,r=e.length,n=8*r-t-1,o=(1<<n)-1,a=o>>1,s=n-7,c=r-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(i=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)i=256*i+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return i?NaN:u?-1/0:1/0;i+=DC(2,t),d-=a}return(u?-1:1)*i*DC(2,d-t)}},VC=De,FC=Xi,BC=Zi,jC=function(e){for(var t=VC(this),i=BC(t),r=arguments.length,n=FC(r>1?arguments[1]:void 0,i),o=r>2?arguments[2]:void 0,a=void 0===o?i:FC(o,i);a>n;)t[n++]=e;return t},GC=n,HC=T,zC=s,KC=RC,WC=wi,XC=Ht,qC=Wu,YC=a,JC=ed,QC=Hi,ZC=Ji,$C=kC,eO=xC,tO=Zp,iO=Ts,rO=Bi.f,nO=Rt.f,oO=jC,aO=ec,sO=mc,cO=WC.PROPER,uO=WC.CONFIGURABLE,dO=Ii.get,lO=Ii.set,hO=GC.ArrayBuffer,pO=hO,fO=pO&&pO.prototype,_O=GC.DataView,vO=_O&&_O.prototype,mO=Object.prototype,yO=GC.Array,gO=GC.RangeError,SO=HC(oO),EO=HC([].reverse),bO=eO.pack,IO=eO.unpack,TO=function(e){return[255&e]},AO=function(e){return[255&e,e>>8&255]},RO=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},CO=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},OO=function(e){return bO(e,23,4)},wO=function(e){return bO(e,52,8)},kO=function(e,t){nO(e.prototype,t,{get:function(){return dO(this)[t]}})},NO=function(e,t,i,r){var n=$C(i),o=dO(e);if(n+t>o.byteLength)throw gO("Wrong index");var a=dO(o.buffer).bytes,s=n+o.byteOffset,c=aO(a,s,s+t);return r?c:EO(c)},PO=function(e,t,i,r,n,o){var a=$C(i),s=dO(e);if(a+t>s.byteLength)throw gO("Wrong index");for(var c=dO(s.buffer).bytes,u=a+s.byteOffset,d=r(+n),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(KC){var DO=cO&&"ArrayBuffer"!==hO.name;if(YC((function(){hO(1)}))&&YC((function(){new hO(-1)}))&&!YC((function(){return new hO,new hO(1.5),new hO(NaN),DO&&!uO})))DO&&uO&&XC(hO,"name","ArrayBuffer");else{(pO=function(e){return JC(this,fO),new hO($C(e))}).prototype=fO;for(var MO,LO=rO(hO),UO=0;LO.length>UO;)(MO=LO[UO++])in pO||XC(pO,MO,hO[MO]);fO.constructor=pO}iO&&tO(vO)!==mO&&iO(vO,mO);var xO=new _O(new pO(2)),VO=HC(vO.setInt8);xO.setInt8(0,2147483648),xO.setInt8(1,2147483649),!xO.getInt8(0)&&xO.getInt8(1)||qC(vO,{setInt8:function(e,t){VO(this,e,t<<24>>24)},setUint8:function(e,t){VO(this,e,t<<24>>24)}},{unsafe:!0})}else fO=(pO=function(e){JC(this,fO);var t=$C(e);lO(this,{bytes:SO(yO(t),0),byteLength:t}),zC||(this.byteLength=t)}).prototype,vO=(_O=function(e,t,i){JC(this,vO),JC(e,fO);var r=dO(e).byteLength,n=QC(t);if(n<0||n>r)throw gO("Wrong offset");if(n+(i=void 0===i?r-n:ZC(i))>r)throw gO("Wrong length");lO(this,{buffer:e,byteLength:i,byteOffset:n}),zC||(this.buffer=e,this.byteLength=i,this.byteOffset=n)}).prototype,zC&&(kO(pO,"byteLength"),kO(_O,"buffer"),kO(_O,"byteLength"),kO(_O,"byteOffset")),qC(vO,{getInt8:function(e){return NO(this,1,e)[0]<<24>>24},getUint8:function(e){return NO(this,1,e)[0]},getInt16:function(e){var t=NO(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=NO(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return CO(NO(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return CO(NO(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return IO(NO(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return IO(NO(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){PO(this,1,e,TO,t)},setUint8:function(e,t){PO(this,1,e,TO,t)},setInt16:function(e,t){PO(this,2,e,AO,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){PO(this,2,e,AO,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){PO(this,4,e,RO,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){PO(this,4,e,RO,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){PO(this,4,e,OO,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){PO(this,8,e,wO,t,arguments.length>2?arguments[2]:void 0)}});sO(pO,"ArrayBuffer"),sO(_O,"DataView");var FO={ArrayBuffer:pO,DataView:_O},BO=jr,jO=T,GO=a,HO=Pt,zO=Xi,KO=Ji,WO=Zd,XO=FO.ArrayBuffer,qO=FO.DataView,YO=qO.prototype,JO=jO(XO.prototype.slice),QO=jO(YO.getUint8),ZO=jO(YO.setUint8);BO({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:GO((function(){return!new XO(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(JO&&void 0===t)return JO(HO(this),e);for(var i=HO(this).byteLength,r=zO(e,i),n=zO(void 0===t?i:t,i),o=new(WO(this,XO))(KO(n-r)),a=new qO(this),s=new qO(o),c=0;r<n;)ZO(s,c++,QO(a,r++));return o}});var $O,ew,tw,iw={exports:{}},rw=RC,nw=s,ow=n,aw=B,sw=G,cw=Ue,uw=nn,dw=pe,lw=Ht,hw=zt.exports,pw=Rt.f,fw=X,_w=Zp,vw=Ts,mw=Ze,yw=je,gw=ow.Int8Array,Sw=gw&&gw.prototype,Ew=ow.Uint8ClampedArray,bw=Ew&&Ew.prototype,Iw=gw&&_w(gw),Tw=Sw&&_w(Sw),Aw=Object.prototype,Rw=ow.TypeError,Cw=mw("toStringTag"),Ow=yw("TYPED_ARRAY_TAG"),ww=yw("TYPED_ARRAY_CONSTRUCTOR"),kw=rw&&!!vw&&"Opera"!==uw(ow.opera),Nw=!1,Pw={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Dw={BigInt64Array:8,BigUint64Array:8},Mw=function(e){if(!sw(e))return!1;var t=uw(e);return cw(Pw,t)||cw(Dw,t)};for($O in Pw)(tw=(ew=ow[$O])&&ew.prototype)?lw(tw,ww,ew):kw=!1;for($O in Dw)(tw=(ew=ow[$O])&&ew.prototype)&&lw(tw,ww,ew);if((!kw||!aw(Iw)||Iw===Function.prototype)&&(Iw=function(){throw Rw("Incorrect invocation")},kw))for($O in Pw)ow[$O]&&vw(ow[$O],Iw);if((!kw||!Tw||Tw===Aw)&&(Tw=Iw.prototype,kw))for($O in Pw)ow[$O]&&vw(ow[$O].prototype,Tw);if(kw&&_w(bw)!==Tw&&vw(bw,Tw),nw&&!cw(Tw,Cw))for($O in Nw=!0,pw(Tw,Cw,{get:function(){return sw(this)?this[Ow]:void 0}}),Pw)ow[$O]&&lw(ow[$O],Ow,$O);var Lw={NATIVE_ARRAY_BUFFER_VIEWS:kw,TYPED_ARRAY_CONSTRUCTOR:ww,TYPED_ARRAY_TAG:Nw&&Ow,aTypedArray:function(e){if(Mw(e))return e;throw Rw("Target is not a typed array")},aTypedArrayConstructor:function(e){if(aw(e)&&(!vw||fw(Iw,e)))return e;throw Rw(dw(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,r){if(nw){if(i)for(var n in Pw){var o=ow[n];if(o&&cw(o.prototype,e))try{delete o.prototype[e]}catch(i){try{o.prototype[e]=t}catch(e){}}}Tw[e]&&!i||hw(Tw,e,i?t:kw&&Sw[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,i){var r,n;if(nw){if(vw){if(i)for(r in Pw)if((n=ow[r])&&cw(n,e))try{delete n[e]}catch(e){}if(Iw[e]&&!i)return;try{return hw(Iw,e,i?t:kw&&Iw[e]||t)}catch(e){}}for(r in Pw)!(n=ow[r])||n[e]&&!i||hw(n,e,t)}},isView:function(e){if(!sw(e))return!1;var t=uw(e);return"DataView"===t||cw(Pw,t)||cw(Dw,t)},isTypedArray:Mw,TypedArray:Iw,TypedArrayPrototype:Tw},Uw=n,xw=a,Vw=zd,Fw=Lw.NATIVE_ARRAY_BUFFER_VIEWS,Bw=Uw.ArrayBuffer,jw=Uw.Int8Array,Gw=!Fw||!xw((function(){jw(1)}))||!xw((function(){new jw(-1)}))||!Vw((function(e){new jw,new jw(null),new jw(1.5),new jw(e)}),!0)||xw((function(){return 1!==new jw(new Bw(2),1,void 0).length})),Hw=G,zw=Math.floor,Kw=Number.isInteger||function(e){return!Hw(e)&&isFinite(e)&&zw(e)===e},Ww=Hi,Xw=n.RangeError,qw=function(e){var t=Ww(e);if(t<0)throw Xw("The argument can't be less than 0");return t},Yw=n.RangeError,Jw=function(e,t){var i=qw(e);if(i%t)throw Yw("Wrong offset");return i},Qw=Kr,Zw=l,$w=qd,ek=De,tk=Zi,ik=md,rk=dd,nk=od,ok=Lw.aTypedArrayConstructor,ak=jr,sk=n,ck=l,uk=s,dk=Gw,lk=Lw,hk=FO,pk=ed,fk=y,_k=Ht,vk=Kw,mk=Ji,yk=kC,gk=Jw,Sk=dt,Ek=Ue,bk=nn,Ik=G,Tk=le,Ak=Ao,Rk=X,Ck=Ts,Ok=Bi.f,wk=function(e){var t,i,r,n,o,a,s=$w(this),c=ek(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=rk(c);if(h&&!nk(h))for(a=(o=ik(c,h)).next,c=[];!(n=Zw(a,o)).done;)c.push(n.value);for(l&&u>2&&(d=Qw(d,arguments[2])),i=tk(c),r=new(ok(s))(i),t=0;i>t;t++)r[t]=l?d(c[t],t):c[t];return r},kk=Mn.forEach,Nk=Qu,Pk=Rt,Dk=o,Mk=lm,Lk=Ii.get,Uk=Ii.set,xk=Pk.f,Vk=Dk.f,Fk=Math.round,Bk=sk.RangeError,jk=hk.ArrayBuffer,Gk=jk.prototype,Hk=hk.DataView,zk=lk.NATIVE_ARRAY_BUFFER_VIEWS,Kk=lk.TYPED_ARRAY_CONSTRUCTOR,Wk=lk.TYPED_ARRAY_TAG,Xk=lk.TypedArray,qk=lk.TypedArrayPrototype,Yk=lk.aTypedArrayConstructor,Jk=lk.isTypedArray,Qk=function(e,t){Yk(e);for(var i=0,r=t.length,n=new e(r);r>i;)n[i]=t[i++];return n},Zk=function(e,t){xk(e,t,{get:function(){return Lk(this)[t]}})},$k=function(e){var t;return Rk(Gk,e)||"ArrayBuffer"==(t=bk(e))||"SharedArrayBuffer"==t},eN=function(e,t){return Jk(e)&&!Tk(t)&&t in e&&vk(+t)&&t>=0},tN=function(e,t){return t=Sk(t),eN(e,t)?fk(2,e[t]):Vk(e,t)},iN=function(e,t,i){return t=Sk(t),!(eN(e,t)&&Ik(i)&&Ek(i,"value"))||Ek(i,"get")||Ek(i,"set")||i.configurable||Ek(i,"writable")&&!i.writable||Ek(i,"enumerable")&&!i.enumerable?xk(e,t,i):(e[t]=i.value,e)};uk?(zk||(Dk.f=tN,Pk.f=iN,Zk(qk,"buffer"),Zk(qk,"byteOffset"),Zk(qk,"byteLength"),Zk(qk,"length")),ak({target:"Object",stat:!0,forced:!zk},{getOwnPropertyDescriptor:tN,defineProperty:iN}),iw.exports=function(e,t,i){var r=e.match(/\d+$/)[0]/8,n=e+(i?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=sk[n],c=s,u=c&&c.prototype,d={},l=function(e,t){xk(e,t,{get:function(){return function(e,t){var i=Lk(e);return i.view[o](t*r+i.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=Lk(e);i&&(n=(n=Fk(n))<0?0:n>255?255:255&n),o.view[a](t*r+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};zk?dk&&(c=t((function(e,t,i,n){return pk(e,u),Mk(Ik(t)?$k(t)?void 0!==n?new s(t,gk(i,r),n):void 0!==i?new s(t,gk(i,r)):new s(t):Jk(t)?Qk(c,t):ck(wk,c,t):new s(yk(t)),e,c)})),Ck&&Ck(c,Xk),kk(Ok(s),(function(e){e in c||_k(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,i,n){pk(e,u);var o,a,s,d=0,h=0;if(Ik(t)){if(!$k(t))return Jk(t)?Qk(c,t):ck(wk,c,t);o=t,h=gk(i,r);var p=t.byteLength;if(void 0===n){if(p%r)throw Bk("Wrong length");if((a=p-h)<0)throw Bk("Wrong length")}else if((a=mk(n)*r)+h>p)throw Bk("Wrong length");s=a/r}else s=yk(t),o=new jk(a=s*r);for(Uk(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new Hk(o)});d<s;)l(e,d++)})),Ck&&Ck(c,Xk),u=c.prototype=Ak(qk)),u.constructor!==c&&_k(u,"constructor",c),_k(u,Kk,c),Wk&&_k(u,Wk,n),d[n]=c,ak({global:!0,forced:c!=s,sham:!zk},d),"BYTES_PER_ELEMENT"in c||_k(c,"BYTES_PER_ELEMENT",r),"BYTES_PER_ELEMENT"in u||_k(u,"BYTES_PER_ELEMENT",r),Nk(n)}):iw.exports=function(){},(0,iw.exports)("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var rN=De,nN=Xi,oN=Zi,aN=Math.min,sN=[].copyWithin||function(e,t){var i=rN(this),r=oN(i),n=nN(e,r),o=nN(t,r),a=arguments.length>2?arguments[2]:void 0,s=aN((void 0===a?r:nN(a,r))-o,r-n),c=1;for(o<n&&n<o+s&&(c=-1,o+=s-1,n+=s-1);s-- >0;)o in i?i[n]=i[o]:delete i[n],n+=c,o+=c;return i},cN=Lw,uN=T(sN),dN=cN.aTypedArray;(0,cN.exportTypedArrayMethod)("copyWithin",(function(e,t){return uN(dN(this),e,t,arguments.length>2?arguments[2]:void 0)}));var lN=Mn.every,hN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("every",(function(e){return lN(hN(this),e,arguments.length>1?arguments[1]:void 0)}));var pN=l,fN=jC,_N=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return pN(fN,_N(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var vN=Zi,mN=Zd,yN=Lw.TYPED_ARRAY_CONSTRUCTOR,gN=Lw.aTypedArrayConstructor,SN=function(e){return gN(mN(e,e[yN]))},EN=function(e,t){for(var i=0,r=vN(t),n=new e(r);r>i;)n[i]=t[i++];return n},bN=SN,IN=Mn.filter,TN=function(e,t){return EN(bN(e),t)},AN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("filter",(function(e){var t=IN(AN(this),e,arguments.length>1?arguments[1]:void 0);return TN(this,t)}));var RN=Mn.find,CN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("find",(function(e){return RN(CN(this),e,arguments.length>1?arguments[1]:void 0)}));var ON=Mn.findIndex,wN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("findIndex",(function(e){return ON(wN(this),e,arguments.length>1?arguments[1]:void 0)}));var kN=Mn.forEach,NN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("forEach",(function(e){kN(NN(this),e,arguments.length>1?arguments[1]:void 0)}));var PN=rr.includes,DN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("includes",(function(e){return PN(DN(this),e,arguments.length>1?arguments[1]:void 0)}));var MN=rr.indexOf,LN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("indexOf",(function(e){return MN(LN(this),e,arguments.length>1?arguments[1]:void 0)}));var UN=n,xN=a,VN=T,FN=Lw,BN=Gf,jN=Ze("iterator"),GN=UN.Uint8Array,HN=VN(BN.values),zN=VN(BN.keys),KN=VN(BN.entries),WN=FN.aTypedArray,XN=FN.exportTypedArrayMethod,qN=GN&&GN.prototype,YN=!xN((function(){qN[jN].call([1])})),JN=!!qN&&qN.values&&qN[jN]===qN.values&&"values"===qN.values.name,QN=function(){return HN(WN(this))};XN("entries",(function(){return KN(WN(this))}),YN),XN("keys",(function(){return zN(WN(this))}),YN),XN("values",QN,YN||!JN,{name:"values"}),XN(jN,QN,YN||!JN,{name:"values"});var ZN=Lw.aTypedArray,$N=Lw.exportTypedArrayMethod,eP=T([].join);$N("join",(function(e){return eP(ZN(this),e)}));var tP=Hs,iP=F,rP=Hi,nP=Zi,oP=Un,aP=Math.min,sP=[].lastIndexOf,cP=!!sP&&1/[1].lastIndexOf(1,-0)<0,uP=oP("lastIndexOf"),dP=cP||!uP?function(e){if(cP)return tP(sP,this,arguments)||0;var t=iP(this),i=nP(t),r=i-1;for(arguments.length>1&&(r=aP(r,rP(arguments[1]))),r<0&&(r=i+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:sP,lP=Hs,hP=dP,pP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return lP(hP,pP(this),t>1?[e,arguments[1]]:[e])}));var fP=Mn.map,_P=SN,vP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("map",(function(e){return fP(vP(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(_P(e))(t)}))}));var mP=qm.left,yP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return mP(yP(this),e,t,t>1?arguments[1]:void 0)}));var gP=qm.right,SP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return gP(SP(this),e,t,t>1?arguments[1]:void 0)}));var EP=Lw.aTypedArray,bP=Lw.exportTypedArrayMethod,IP=Math.floor;bP("reverse",(function(){for(var e,t=this,i=EP(t).length,r=IP(i/2),n=0;n<r;)e=t[n],t[n++]=t[--i],t[i]=e;return t}));var TP=n,AP=l,RP=Lw,CP=Zi,OP=Jw,wP=De,kP=a,NP=TP.RangeError,PP=TP.Int8Array,DP=PP&&PP.prototype,MP=DP&&DP.set,LP=RP.aTypedArray,UP=RP.exportTypedArrayMethod,xP=!kP((function(){var e=new Uint8ClampedArray(2);return AP(MP,e,{length:1,0:3},1),3!==e[1]})),VP=xP&&RP.NATIVE_ARRAY_BUFFER_VIEWS&&kP((function(){var e=new PP(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));UP("set",(function(e){LP(this);var t=OP(arguments.length>1?arguments[1]:void 0,1),i=wP(e);if(xP)return AP(MP,this,i,t);var r=this.length,n=CP(i),o=0;if(n+t>r)throw NP("Wrong length");for(;o<n;)this[t+o]=i[o++]}),!xP||VP);var FP=SN,BP=ac,jP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("slice",(function(e,t){for(var i=BP(jP(this),e,t),r=FP(this),n=0,o=i.length,a=new r(o);o>n;)a[n]=i[n++];return a}),a((function(){new Int8Array(1).slice()})));var GP=Mn.some,HP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("some",(function(e){return GP(HP(this),e,arguments.length>1?arguments[1]:void 0)}));var zP=q.match(/firefox\/(\d+)/i),KP=!!zP&&+zP[1],WP=/MSIE|Trident/.test(q),XP=q.match(/AppleWebKit\/(\d+)\./),qP=!!XP&&+XP[1],YP=n,JP=T,QP=a,ZP=me,$P=fT,eD=Lw,tD=KP,iD=WP,rD=te,nD=qP,oD=YP.Array,aD=eD.aTypedArray,sD=eD.exportTypedArrayMethod,cD=YP.Uint16Array,uD=cD&&JP(cD.prototype.sort),dD=!(!uD||QP((function(){uD(new cD(2),null)}))&&QP((function(){uD(new cD(2),{})}))),lD=!!uD&&!QP((function(){if(rD)return rD<74;if(tD)return tD<67;if(iD)return!0;if(nD)return nD<602;var e,t,i=new cD(516),r=oD(516);for(e=0;e<516;e++)t=e%4,i[e]=515-e,r[e]=e-2*t+3;for(uD(i,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(i[e]!==r[e])return!0}));sD("sort",(function(e){return void 0!==e&&ZP(e),lD?uD(this,e):$P(aD(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?-1:t!=t?1:0===t&&0===i?1/t>0&&1/i<0?1:-1:t>i}}(e))}),!lD||dD);var hD=Ji,pD=Xi,fD=SN,_D=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("subarray",(function(e,t){var i=_D(this),r=i.length,n=pD(e,r);return new(fD(i))(i.buffer,i.byteOffset+n*i.BYTES_PER_ELEMENT,hD((void 0===t?r:pD(t,r))-n))}));var vD=Hs,mD=Lw,yD=a,gD=ac,SD=n.Int8Array,ED=mD.aTypedArray,bD=mD.exportTypedArrayMethod,ID=[].toLocaleString,TD=!!SD&&yD((function(){ID.call(new SD(1))}));bD("toLocaleString",(function(){return vD(ID,TD?gD(ED(this)):ED(this),gD(arguments))}),yD((function(){return[1,2].toLocaleString()!=new SD([1,2]).toLocaleString()}))||!yD((function(){SD.prototype.toLocaleString.call([1,2])})));var AD=Lw.exportTypedArrayMethod,RD=a,CD=T,OD=n.Uint8Array,wD=OD&&OD.prototype||{},kD=[].toString,ND=CD([].join);RD((function(){kD.call({})}))&&(kD=function(){return ND(this)});var PD,DD,MD=wD.toString!=kD;AD("toString",kD,MD),jr({target:"Array",stat:!0},{isArray:Xr}),function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onLocalCameraStalled="onLocalCameraStalled"}(PD||(PD={})),function(e){e[e.ERR_OK=0]="ERR_OK",e[e.ERR_PARAM_INVALID=1]="ERR_PARAM_INVALID",e[e.ERR_FRAME_TIMEOUT=2]="ERR_FRAME_TIMEOUT",e[e.ERR_POSTPROCESS=3]="ERR_POSTPROCESS",e[e.ERR_PUSH_CDN=4]="ERR_PUSH_CDN",e[e.ERR_UNKNOWN=9999]="ERR_UNKNOWN"}(DD||(DD={}));var LD=s,UD=T,xD=no,VD=F,FD=UD(h.f),BD=UD([].push),jD=function(e){return function(t){for(var i,r=VD(t),n=xD(r),o=n.length,a=0,s=[];o>a;)i=n[a++],LD&&!FD(r,i)||BD(s,e?[i,r[i]]:r[i]);return s}},GD={entries:jD(!0),values:jD(!1)}.entries;jr({target:"Object",stat:!0},{entries:function(e){return GD(e)}});var HD=Hi,zD=Go,KD=U,WD=n.RangeError,XD=function(e){var t=zD(KD(this)),i="",r=HD(e);if(r<0||r==1/0)throw WD("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(i+=t);return i},qD=T,YD=Ji,JD=Go,QD=U,ZD=qD(XD),$D=qD("".slice),eM=Math.ceil,tM=function(e){return function(t,i,r){var n,o,a=JD(QD(t)),s=YD(i),c=a.length,u=void 0===r?" ":JD(r);return s<=c||""==u?a:((o=ZD(u,eM((n=s-c)/u.length))).length>n&&(o=$D(o,0,n)),e?a+o:o+a)}},iM={start:tM(!1),end:tM(!0)},rM=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(q),nM=iM.end;jr({target:"String",proto:!0,forced:rM},{padEnd:function(e){return nM(this,e,arguments.length>1?arguments[1]:void 0)}});var oM=xv;jr({target:"Number",stat:!0,forced:Number.parseInt!=oM},{parseInt:oM});var aM=Qu,sM=FO.ArrayBuffer;jr({global:!0,forced:n.ArrayBuffer!==sM},{ArrayBuffer:sM}),aM("ArrayBuffer");jr({target:"ArrayBuffer",stat:!0,forced:!Lw.NATIVE_ARRAY_BUFFER_VIEWS},{isView:Lw.isView}),jr({global:!0,forced:!RC},{DataView:FO.DataView});var cM=jr,uM=n,dM=T,lM=Hi,hM=zE,pM=XD,fM=a,_M=uM.RangeError,vM=uM.String,mM=Math.floor,yM=dM(pM),gM=dM("".slice),SM=dM(1..toFixed),EM=function(e,t,i){return 0===t?i:t%2==1?EM(e,t-1,i*e):EM(e*e,t/2,i)},bM=function(e,t,i){for(var r=-1,n=i;++r<6;)n+=t*e[r],e[r]=n%1e7,n=mM(n/1e7)},IM=function(e,t){for(var i=6,r=0;--i>=0;)r+=e[i],e[i]=mM(r/t),r=r%t*1e7},TM=function(e){for(var t=6,i="";--t>=0;)if(""!==i||0===t||0!==e[t]){var r=vM(e[t]);i=""===i?r:i+yM("0",7-r.length)+r}return i};cM({target:"Number",proto:!0,forced:fM((function(){return"0.000"!==SM(8e-5,3)||"1"!==SM(.9,0)||"1.25"!==SM(1.255,2)||"1000000000000000128"!==SM(0xde0b6b3a7640080,0)}))||!fM((function(){SM({})}))},{toFixed:function(e){var t,i,r,n,o=hM(this),a=lM(e),s=[0,0,0,0,0,0],c="",u="0";if(a<0||a>20)throw _M("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return vM(o);if(o<0&&(c="-",o=-o),o>1e-21)if(i=(t=function(e){for(var t=0,i=e;i>=4096;)t+=12,i/=4096;for(;i>=2;)t+=1,i/=2;return t}(o*EM(2,69,1))-69)<0?o*EM(2,-t,1):o/EM(2,t,1),i*=4503599627370496,(t=52-t)>0){for(bM(s,0,i),r=a;r>=7;)bM(s,1e7,0),r-=7;for(bM(s,EM(10,r,1),0),r=t-1;r>=23;)IM(s,1<<23),r-=23;IM(s,1<<r),bM(s,1,1),IM(s,2),u=TM(s)}else bM(s,0,i),bM(s,1<<-t,0),u=TM(s)+yM("0",a);return u=a>0?c+((n=u.length)<=a?"0."+yM("0",a-n)+u:gM(u,0,n-a)+"."+gM(u,n-a)):c+u}});var AM=Math.log,RM=Math.LOG10E;jr({target:"Math",stat:!0},{log10:Math.log10||function(e){return AM(e)*RM}});var CM=jr,OM=T,wM=o.f,kM=Ji,NM=Go,PM=Fo,DM=U,MM=zo,LM=OM("".startsWith),UM=OM("".slice),xM=Math.min,VM=MM("startsWith"),FM=!VM&&!!function(){var e=wM(String.prototype,"startsWith");return e&&!e.writable}();CM({target:"String",proto:!0,forced:!FM&&!VM},{startsWith:function(e){var t=NM(DM(this));PM(e);var i=kM(xM(arguments.length>1?arguments[1]:void 0,t.length)),r=NM(e);return LM?LM(t,r,i):UM(t,i,i+r.length)===r}});var BM,jM,GM,HM,zM,KM,WM,XM,qM,YM,JM,QM,ZM,$M,eL,tL,iL,rL,nL,oL,aL,sL,cL,uL,dL,lL,hL=["click","contextmenu","mousedown","mouseup","pointerup","touchend","keydown","keyup"],pL=function(){function e(){var e=this;this._contextStuckAt=0,this._haslistener=!1,this._hasIOSListener=!1;var t=0;setInterval((function(){if(e._audioContextInstance){var i=e._audioContextInstance.currentTime;e._contextStuckAt?e._contextStuckAt!==i&&(e._contextStuckAt=0):t===i&&(e._contextStuckAt=i),t=i}}),5e3)}return e.prototype.resume=function(){var e,t,i=this;"running"!==(null===(e=this._audioContextInstance)||void 0===e?void 0:e.state)&&(null===(t=this._audioContextInstance)||void 0===t||t.resume().then((function(){var e;"running"!==(null===(e=i._audioContextInstance)||void 0===e?void 0:e.state)&&i.addInteractionListener()})).catch((function(){i.addInteractionListener()})))},e.prototype.getAudioContextInstance=function(){var e=this;if(!this._audioContextInstance){var t=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new t,this._audioContextInstance.onstatechange=function(){var t,i,r;"suspended"!==(null===(t=e._audioContextInstance)||void 0===t?void 0:t.state)&&"interrupted"!==(null===(i=e._audioContextInstance)||void 0===i?void 0:i.state)||(null===(r=e._audioContextInstance)||void 0===r||r.resume(),e.addInteractionListener())},this.addInteractionListener()}return this._audioContextInstance},e.prototype.addInteractionListener=function(){var e=this;this._haslistener||(this._resumeContext||(this._resumeContext=function(){var t,i;"running"===(null===(t=e._audioContextInstance)||void 0===t?void 0:t.state)?(hL.forEach((function(t){window.removeEventListener(t,e._resumeContext)})),e._haslistener=!1):null===(i=e._audioContextInstance)||void 0===i||i.resume()}),hL.forEach((function(t){window.addEventListener(t,e._resumeContext)})),this._haslistener=!0),eU&&!this._hasIOSListener&&(this._playSoundInIOS||(this._playSoundInIOS=function(){window.removeEventListener("touchend",e._playSoundInIOS),e._hasIOSListener=!1;var t=e._audioContextInstance;if(t){var i=t.createBuffer(1,1,44100),r=t.createBufferSource();r.buffer=i,r.connect(t.destination),r.start(0),r.disconnect()}}),window.addEventListener("touchend",this._playSoundInIOS),this._hasIOSListener=!0)},e}(),fL=function(){function e(e){this._buffer=[];var t=_L.getAudioContextInstance();if(e instanceof MediaStreamTrack){var i=new MediaStream;i.addTrack(e),this._stream=i,this._audioSource=t.createMediaStreamSource(i)}else this._audioSource=t.createMediaElementSource(e),this._audioSource.connect(t.destination);var r=t.createAnalyser();this._audioSource.connect(r),this._analyserNode=r,this._ctx=t}return e.prototype.getAudioLevel=function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var i=0;return t.forEach((function(e){return i=Math.max(i,Math.abs(e-128))})),i/128*255},e.prototype.checkHasInput=function(){var e=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(e);var t=!1;return e.forEach((function(e){0!==e&&(t=!0)})),t},e.prototype.reset=function(){if(this._stream){this._audioSource.disconnect(),this._analyserNode.disconnect();var e=_L.getAudioContextInstance(),t=e.createAnalyser();this._audioSource=e.createMediaStreamSource(this._stream),this._audioSource.connect(t),this._analyserNode=t,this._ctx=e}},e.prototype.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect(),delete this._stream},e}(),_L=new pL;!function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(BM||(BM={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(jM||(jM={})),function(e){e[e.QUIT=0]="QUIT",e[e.DROPPED=1]="DROPPED",e[e.SWITCH_TO_INVISIBLE=2]="SWITCH_TO_INVISIBLE",e[e.KICKED_BY_ADMIN=3]="KICKED_BY_ADMIN"}(GM||(GM={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(HM||(HM={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(zM||(zM={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(KM||(KM={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(WM||(WM={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(XM||(XM={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(qM||(qM={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(YM||(YM={})),function(e){e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO"}(JM||(JM={})),function(e){e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER"}(QM||(QM={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST"}(ZM||(ZM={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}($M||($M={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(eL||(eL={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(tL||(tL={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY"}(iL||(iL={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(rL||(rL={})),function(e){e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY"}(nL||(nL={})),function(e){e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH"}(oL||(oL={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(aL||(aL={})),function(e){e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth"}(sL||(sL={})),function(e){e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom"}(cL||(cL={})),function(e){e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono"}(uL||(uL={})),function(e){e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY"}(dL||(dL={}));var vL=new Uint8Array(16);function mL(){if(!lL&&!(lL="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return lL(vL)}var yL=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function gL(e){return"string"==typeof e&&yL.test(e)}for(var SL=[],EL=0;EL<256;++EL)SL.push((EL+256).toString(16).substr(1));function bL(e,t,i){var r=(e=e||{}).random||(e.rng||mL)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){i=i||0;for(var n=0;n<16;++n)t[i+n]=r[n];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(SL[e[t+0]]+SL[e[t+1]]+SL[e[t+2]]+SL[e[t+3]]+"-"+SL[e[t+4]]+SL[e[t+5]]+"-"+SL[e[t+6]]+SL[e[t+7]]+"-"+SL[e[t+8]]+SL[e[t+9]]+"-"+SL[e[t+10]]+SL[e[t+11]]+SL[e[t+12]]+SL[e[t+13]]+SL[e[t+14]]+SL[e[t+15]]).toLowerCase();if(!gL(i))throw TypeError("Stringified UUID is invalid");return i}(r)}(0,iw.exports)("Uint32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Int8",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}}),!0),(0,iw.exports)("Int16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Uint16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Int32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Float32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Float64",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var IL,TL={exports:{}},AL={exports:{}};AL.exports=(IL=IL||function(e,i){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==t&&t.crypto&&(r=t.crypto),!r)try{r=require("crypto")}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var i;return e.prototype=t,i=new e,e.prototype=null,i}}(),a={},s=a.lib={},c=s.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=s.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=t!=i?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,i=e.words,r=this.sigBytes,n=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<n;o++){var a=i[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=a<<24-(r+o)%4*8}else for(var s=0;s<n;s+=4)t[r+s>>>2]=i[s>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i<e;i+=4)t.push(n());return new u.init(t,e)}}),d=a.enc={},l=d.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],n=0;n<i;n++){var o=t[n>>>2]>>>24-n%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r+=2)i[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(i,t/2)}},h=d.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],n=0;n<i;n++){var o=t[n>>>2]>>>24-n%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r++)i[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(i,t)}},p=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},f=s.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,r=this._data,n=r.words,o=r.sigBytes,a=this.blockSize,s=o/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,d=e.min(4*c,o);if(c){for(var l=0;l<c;l+=a)this._doProcessBlock(n,l);i=n.splice(0,c),r.sigBytes-=d}return new u.init(i,d)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});s.Hasher=f.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e.init(i).finalize(t)}},_createHmacHelper:function(e){return function(t,i){return new _.HMAC.init(e,i).finalize(t)}}});var _=a.algo={};return a}(Math),IL);var RL=TL.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,i=t.init,r=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,r=[],n=0;n<t;n++)r[n>>>2]|=e[n]<<24-n%4*8;i.call(this,r,t)}else i.apply(this,arguments)};r.prototype=t}}(),e.lib.WordArray}(AL.exports),CL={exports:{}},OL={exports:{}};OL.exports=function(e){return function(){var t=e,i=t.lib.WordArray;function r(e,t,r){for(var n=[],o=0,a=0;a<t;a++)if(a%4){var s=r[e.charCodeAt(a-1)]<<a%4*2|r[e.charCodeAt(a)]>>>6-a%4*2;n[o>>>2]|=s<<24-o%4*8,o++}return i.create(n,o)}t.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,r=this._map;e.clamp();for(var n=[],o=0;o<i;o+=3)for(var a=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<i;s++)n.push(r.charAt(a>>>6*(3-s)&63));var c=r.charAt(64);if(c)for(;n.length%4;)n.push(c);return n.join("")},parse:function(e){var t=e.length,i=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o<i.length;o++)n[i.charCodeAt(o)]=o}var a=i.charAt(64);if(a){var s=e.indexOf(a);-1!==s&&(t=s)}return r(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(AL.exports);var wL={exports:{}};wL.exports=function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,o=r.Hasher,a=i.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=a.MD5=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var r=t+i,n=e[r];e[r]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],p=e[t+2],f=e[t+3],_=e[t+4],v=e[t+5],m=e[t+6],y=e[t+7],g=e[t+8],S=e[t+9],E=e[t+10],b=e[t+11],I=e[t+12],T=e[t+13],A=e[t+14],R=e[t+15],C=o[0],O=o[1],w=o[2],k=o[3];C=u(C,O,w,k,a,7,s[0]),k=u(k,C,O,w,c,12,s[1]),w=u(w,k,C,O,p,17,s[2]),O=u(O,w,k,C,f,22,s[3]),C=u(C,O,w,k,_,7,s[4]),k=u(k,C,O,w,v,12,s[5]),w=u(w,k,C,O,m,17,s[6]),O=u(O,w,k,C,y,22,s[7]),C=u(C,O,w,k,g,7,s[8]),k=u(k,C,O,w,S,12,s[9]),w=u(w,k,C,O,E,17,s[10]),O=u(O,w,k,C,b,22,s[11]),C=u(C,O,w,k,I,7,s[12]),k=u(k,C,O,w,T,12,s[13]),w=u(w,k,C,O,A,17,s[14]),C=d(C,O=u(O,w,k,C,R,22,s[15]),w,k,c,5,s[16]),k=d(k,C,O,w,m,9,s[17]),w=d(w,k,C,O,b,14,s[18]),O=d(O,w,k,C,a,20,s[19]),C=d(C,O,w,k,v,5,s[20]),k=d(k,C,O,w,E,9,s[21]),w=d(w,k,C,O,R,14,s[22]),O=d(O,w,k,C,_,20,s[23]),C=d(C,O,w,k,S,5,s[24]),k=d(k,C,O,w,A,9,s[25]),w=d(w,k,C,O,f,14,s[26]),O=d(O,w,k,C,g,20,s[27]),C=d(C,O,w,k,T,5,s[28]),k=d(k,C,O,w,p,9,s[29]),w=d(w,k,C,O,y,14,s[30]),C=l(C,O=d(O,w,k,C,I,20,s[31]),w,k,v,4,s[32]),k=l(k,C,O,w,g,11,s[33]),w=l(w,k,C,O,b,16,s[34]),O=l(O,w,k,C,A,23,s[35]),C=l(C,O,w,k,c,4,s[36]),k=l(k,C,O,w,_,11,s[37]),w=l(w,k,C,O,y,16,s[38]),O=l(O,w,k,C,E,23,s[39]),C=l(C,O,w,k,T,4,s[40]),k=l(k,C,O,w,a,11,s[41]),w=l(w,k,C,O,f,16,s[42]),O=l(O,w,k,C,m,23,s[43]),C=l(C,O,w,k,S,4,s[44]),k=l(k,C,O,w,I,11,s[45]),w=l(w,k,C,O,R,16,s[46]),C=h(C,O=l(O,w,k,C,p,23,s[47]),w,k,a,6,s[48]),k=h(k,C,O,w,y,10,s[49]),w=h(w,k,C,O,A,15,s[50]),O=h(O,w,k,C,v,21,s[51]),C=h(C,O,w,k,I,6,s[52]),k=h(k,C,O,w,f,10,s[53]),w=h(w,k,C,O,E,15,s[54]),O=h(O,w,k,C,c,21,s[55]),C=h(C,O,w,k,g,6,s[56]),k=h(k,C,O,w,R,10,s[57]),w=h(w,k,C,O,m,15,s[58]),O=h(O,w,k,C,T,21,s[59]),C=h(C,O,w,k,_,6,s[60]),k=h(k,C,O,w,b,10,s[61]),w=h(w,k,C,O,p,15,s[62]),O=h(O,w,k,C,S,21,s[63]),o[0]=o[0]+C|0,o[1]=o[1]+O|0,o[2]=o[2]+w|0,o[3]=o[3]+k|0},_doFinalize:function(){var e=this._data,i=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;i[n>>>5]|=128<<24-n%32;var o=t.floor(r/4294967296),a=r;i[15+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),i[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(i.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var d=c[u];c[u]=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,i,r,n,o,a){var s=e+(t&i|~t&r)+n+a;return(s<<o|s>>>32-o)+t}function d(e,t,i,r,n,o,a){var s=e+(t&r|i&~r)+n+a;return(s<<o|s>>>32-o)+t}function l(e,t,i,r,n,o,a){var s=e+(t^i^r)+n+a;return(s<<o|s>>>32-o)+t}function h(e,t,i,r,n,o,a){var s=e+(i^(t|~r))+n+a;return(s<<o|s>>>32-o)+t}i.MD5=o._createHelper(c),i.HmacMD5=o._createHmacHelper(c)}(Math),e.MD5}(AL.exports);var kL={exports:{}},NL={exports:{}};NL.exports=function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=i.Hasher,o=t.algo,a=[],s=o.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],n=i[1],o=i[2],s=i[3],c=i[4],u=0;u<80;u++){if(u<16)a[u]=0|e[t+u];else{var d=a[u-3]^a[u-8]^a[u-14]^a[u-16];a[u]=d<<1|d>>>31}var l=(r<<5|r>>>27)+c+a[u];l+=u<20?1518500249+(n&o|~n&s):u<40?1859775393+(n^o^s):u<60?(n&o|n&s|o&s)-1894007588:(n^o^s)-899497514,c=s,s=o,o=n<<30|n>>>2,n=r,r=l}i[0]=i[0]+r|0,i[1]=i[1]+n|0,i[2]=i[2]+o|0,i[3]=i[3]+s|0,i[4]=i[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(r+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=n._createHelper(s),t.HmacSHA1=n._createHmacHelper(s)}(),e.SHA1}(AL.exports);var PL={exports:{}};PL.exports=function(e){var t,i,r;i=(t=e).lib.Base,r=t.enc.Utf8,t.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var i=e.blockSize,n=4*i;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),s=o.words,c=a.words,u=0;u<i;u++)s[u]^=1549556828,c[u]^=909522486;o.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,i=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(i))}})}(AL.exports),kL.exports=function(e){return function(){var t=e,i=t.lib,r=i.Base,n=i.WordArray,o=t.algo,a=o.MD5,s=o.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var i,r=this.cfg,o=r.hasher.create(),a=n.create(),s=a.words,c=r.keySize,u=r.iterations;s.length<c;){i&&o.update(i),i=o.update(e).finalize(t),o.reset();for(var d=1;d<u;d++)i=o.finalize(i),o.reset();a.concat(i)}return a.sigBytes=4*c,a}});t.EvpKDF=function(e,t,i){return s.create(i).compute(e,t)}}(),e.EvpKDF}(AL.exports);var DL={exports:{}};DL.exports=function(e){e.lib.Cipher||function(t){var i=e,r=i.lib,n=r.Base,o=r.WordArray,a=r.BufferedBlockAlgorithm,s=i.enc;s.Utf8;var c=s.Base64,u=i.algo.EvpKDF,d=r.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,i){this.cfg=this.cfg.extend(i),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?g:m}return function(t){return{encrypt:function(i,r,n){return e(r).encrypt(t,i,r,n)},decrypt:function(i,r,n){return e(r).decrypt(t,i,r,n)}}}}()});r.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=i.mode={},h=r.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=l.CBC=function(){var e=h.extend();function i(e,i,r){var n,o=this._iv;o?(n=o,this._iv=t):n=this._prevBlock;for(var a=0;a<r;a++)e[i+a]^=n[a]}return e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize;i.call(this,e,t,n),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),e.Decryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=e.slice(t,t+n);r.decryptBlock(e,t),i.call(this,e,t,n),this._prevBlock=o}}),e}(),f=(i.pad={}).Pkcs7={pad:function(e,t){for(var i=4*t,r=i-e.sigBytes%i,n=r<<24|r<<16|r<<8|r,a=[],s=0;s<r;s+=4)a.push(n);var c=o.create(a,r);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};r.BlockCipher=d.extend({cfg:d.cfg.extend({mode:p,padding:f}),reset:function(){var e;d.reset.call(this);var t=this.cfg,i=t.iv,r=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(r,this,i&&i.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var _=r.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),v=(i.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?o.create([1398893684,1701076831]).concat(i).concat(t):t).toString(c)},parse:function(e){var t,i=c.parse(e),r=i.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=o.create(r.slice(2,4)),r.splice(0,4),i.sigBytes-=16),_.create({ciphertext:i,salt:t})}},m=r.SerializableCipher=n.extend({cfg:n.extend({format:v}),encrypt:function(e,t,i,r){r=this.cfg.extend(r);var n=e.createEncryptor(i,r),o=n.finalize(t),a=n.cfg;return _.create({ciphertext:o,key:i,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(i,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(i.kdf={}).OpenSSL={execute:function(e,t,i,r,n){if(r||(r=o.random(8)),n)a=u.create({keySize:t+i,hasher:n}).compute(e,r);else var a=u.create({keySize:t+i}).compute(e,r);var s=o.create(a.words.slice(t),4*i);return a.sigBytes=4*t,_.create({key:a,iv:s,salt:r})}},g=r.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:y}),encrypt:function(e,t,i,r){var n=(r=this.cfg.extend(r)).kdf.execute(i,e.keySize,e.ivSize,r.salt,r.hasher);r.iv=n.iv;var o=m.encrypt.call(this,e,t,n.key,r);return o.mixIn(n),o},decrypt:function(e,t,i,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var n=r.kdf.execute(i,e.keySize,e.ivSize,t.salt,r.hasher);return r.iv=n.iv,m.decrypt.call(this,e,t,n.key,r)}})}()}(AL.exports),CL.exports=function(e){return function(){var t=e,i=t.lib.BlockCipher,r=t.algo,n=[],o=[],a=[],s=[],c=[],u=[],d=[],l=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,r=0;for(t=0;t<256;t++){var f=r^r<<1^r<<2^r<<3^r<<4;f=f>>>8^255&f^99,n[i]=f,o[f]=i;var _=e[i],v=e[_],m=e[v],y=257*e[f]^16843008*f;a[i]=y<<24|y>>>8,s[i]=y<<16|y>>>16,c[i]=y<<8|y>>>24,u[i]=y,y=16843009*m^65537*v^257*_^16843008*i,d[f]=y<<24|y>>>8,l[f]=y<<16|y>>>16,h[f]=y<<8|y>>>24,p[f]=y,i?(i=_^e[e[e[m^_]]],r^=e[e[r]]):i=r=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=r.AES=i.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,r=4*((this._nRounds=i+6)+1),o=this._keySchedule=[],a=0;a<r;a++)a<i?o[a]=t[a]:(u=o[a-1],a%i?i>6&&a%i==4&&(u=n[u>>>24]<<24|n[u>>>16&255]<<16|n[u>>>8&255]<<8|n[255&u]):(u=n[(u=u<<8|u>>>24)>>>24]<<24|n[u>>>16&255]<<16|n[u>>>8&255]<<8|n[255&u],u^=f[a/i|0]<<24),o[a]=o[a-i]^u);for(var s=this._invKeySchedule=[],c=0;c<r;c++){if(a=r-c,c%4)var u=o[a];else u=o[a-4];s[c]=c<4||a<=4?u:d[n[u>>>24]]^l[n[u>>>16&255]]^h[n[u>>>8&255]]^p[n[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,n)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,d,l,h,p,o),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,r,n,o,a,s){for(var c=this._nRounds,u=e[t]^i[0],d=e[t+1]^i[1],l=e[t+2]^i[2],h=e[t+3]^i[3],p=4,f=1;f<c;f++){var _=r[u>>>24]^n[d>>>16&255]^o[l>>>8&255]^a[255&h]^i[p++],v=r[d>>>24]^n[l>>>16&255]^o[h>>>8&255]^a[255&u]^i[p++],m=r[l>>>24]^n[h>>>16&255]^o[u>>>8&255]^a[255&d]^i[p++],y=r[h>>>24]^n[u>>>16&255]^o[d>>>8&255]^a[255&l]^i[p++];u=_,d=v,l=m,h=y}_=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^i[p++],v=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&u])^i[p++],m=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^i[p++],y=(s[h>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^i[p++],e[t]=_,e[t+1]=v,e[t+2]=m,e[t+3]=y},keySize:8});t.AES=i._createHelper(_)}(),e.AES}(AL.exports);var ML,LL={exports:{}},UL=LL.exports=function(e){return e.enc.Hex}(AL.exports),xL={exports:{}},VL=xL.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),i=t.Encryptor=t.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,n=this._iv,o=this._counter;n&&(o=this._counter=n.slice(0),this._iv=void 0);var a=o.slice(0);i.encryptBlock(a,0),o[r-1]=o[r-1]+1|0;for(var s=0;s<r;s++)e[t+s]^=a[s]}}),t.Decryptor=i,t),e.mode.CTR;var t,i}(AL.exports),FL={exports:{}},BL=FL.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(AL.exports),jL=new TextDecoder,GL=new TextEncoder,HL=function(){return bL()},zL=function(){return Date.now()};function KL(e){for(var t,i,r,n,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=rv(o),u=c.next();!u.done;u=c.next()){s+=(f=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=rv(o),p=h.next();!p.done;p=h.next()){var f=p.value;d.set(f,l),l+=f.length}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}return d}var WL=function(){return"undefined"==typeof window},XL=function(){function e(){}return e.token2auth=function(t,i,r,n){return n?"Bearer ".concat(n):"Basic ".concat(e.createUnsafeToken(t,i,r))},e.createUnsafeToken=function(e,t,i){return window.btoa([e,t,i].filter((function(e){return null!==e})).join(":"))},e.merge=function(t,i){var r,n;void 0===t&&(t={}),void 0===i&&(i={});try{for(var o=rv(Object.entries(t)),a=o.next();!a.done;a=o.next()){var s=nv(a.value,2),c=s[0],u=s[1];null!==u&&"object"===vs(u)?e.merge(t[c],i[c]):void 0!==i[c]&&(t[c]=i[c])}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.ab2str=function(e){return jL.decode(e)},e.ab2obj=function(t){try{var i=e.ab2str(t);return JSON.parse(i)}catch(e){return{}}},e.str2ab=function(e){return GL.encode(e).buffer},e.ab2b64str=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var i=new FileReader;i.onload=function(){return t(i.result)},i.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function qL(){var e="none";return WL()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var YL="mozilla"===qL(),JL="safari"===qL(),QL=0,ZL=null===(ML=navigator.userAgent.match(/version\/(\d+)/i))||void 0===ML?void 0:ML[1];JL&&ZL&&(QL=+ZL);var $L=QL,eU=!WL()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!WL()&&/(iPhone|iPod)/i.exec(navigator.userAgent),!WL()&&(/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&document);var tU=!WL()&&/MicroMessenger/i.test(navigator.userAgent),iU=!WL()&&/Android/i.test(navigator.userAgent),rU=!WL()&&navigator.userAgent.toLowerCase().includes("mobile"),nU=!WL()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent),oU=!WL()&&/DingTalk/i.test(navigator.userAgent);function aU(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,i){var r=i===t.length-1?"0":"1";return Number.parseInt(r+e.join(""),2)}))}var sU=function(){return Math.floor(65535*Math.random())};function cU(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function uU(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var i=ArrayBuffer.isView(t)?t.buffer:t,r=i.byteLength,n=[];if(r>10){var o=new DataView(i),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return r-1-t})).reverse().map((function(e){return o.getUint8(e)}));n=ov(ov(ov([],nv(a),!1),["..."],!1),nv(s),!1)}else n=Array.from(new Uint8Array(i));return"".concat(t.constructor.name,"(").concat(r,") [").concat(n.join(", "),"]")}if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var dU=function(e){return void 0===e&&(e=!1),tv(void 0,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),t.addTransceiver("audio",{direction:"recvonly"}),t.addTransceiver("video",{direction:"recvonly"}),e&&(t.addTransceiver("audio",{direction:"sendonly"}),t.addTransceiver("video",{direction:"sendonly"})),[4,t.createOffer()];case 1:return i=r.sent(),t.close(),[2,i.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))},lU=function(e){return new Promise((function(t,i){var r=(e=Array.isArray(e)?e:[]).length,n=[];0===r?i([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){r--,n.push(e),0===r&&i(n)}))}))}))};function hU(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function pU(e){return(e&JM.AUDIO)===JM.AUDIO}function fU(e){return(e&JM.VIDEO)===JM.VIDEO}function _U(e){var t={};return Object.keys(e).forEach((function(i){"object"===vs(e[i])?t[i]=_U(e[i]):i.startsWith("_")||(t[i]=e[i])})),t}function vU(e){return null==e?"undefined | null":"string"==typeof e?e:JSON.stringify({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function mU(e){return"number"==typeof e?e:"number"==typeof(null==e?void 0:e.exact)?e.exact:"number"==typeof(null==e?void 0:e.ideal)?e.ideal:"number"==typeof(null==e?void 0:e.max)?e.max:"number"==typeof(null==e?void 0:e.min)?e.min:1}var yU=function(){if("chrome-stable"===qL()){var e=window.navigator.userAgent.match(/Chrome\/([\d.]+)/);if(e&&e.length>1)if(Number(e[1].split(".")[0])<117)return!0}return!1}();function gU(e){for(var t=atob(e),i=t.length,r=new Uint8Array(i),n=0;n<i;n++)r[n]=t.charCodeAt(n);return r}function SU(e){for(var t="",i=e.byteLength,r=0;r<i;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function EU(e,t,i){var r=bU(e),n=bU(t),o=bU(i);return function(e){for(var t=e.toString(UL),i=new Uint8Array(t.length/2),r=0;r<t.length;r+=2)i[r/2]=parseInt(t.substr(r,2),16);return i}(CL.exports.encrypt(r,n,{iv:o,mode:VL,padding:BL}).ciphertext)}function bU(e){for(var t=[],i=0;i<e.length;i+=4)t.push(e[i]<<24|(e[i+1]||0)<<16|(e[i+2]||0)<<8|(e[i+3]||0));return RL.create(t,e.length)}var IU={};!function(e){var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!==vs(r))throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(e[n]=r[n])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){var t,i,r,n,o,a;for(r=0,t=0,i=e.length;t<i;t++)r+=e[t].length;for(a=new Uint8Array(r),n=0,t=0,i=e.length;t<i;t++)o=e[t],a.set(o,n),n+=o.length;return a}},n={arraySet:function(e,t,i,r,n){for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,r)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,n))},e.setTyped(t)}(IU);var TU={},AU={},RU={},CU=IU;function OU(e){for(var t=e.length;--t>=0;)e[t]=0}var wU=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],kU=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],NU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],PU=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],DU=new Array(576);OU(DU);var MU=new Array(60);OU(MU);var LU=new Array(512);OU(LU);var UU=new Array(256);OU(UU);var xU=new Array(29);OU(xU);var VU,FU,BU,jU=new Array(30);function GU(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function HU(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function zU(e){return e<256?LU[e]:LU[256+(e>>>7)]}function KU(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function WU(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,KU(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function XU(e,t,i){WU(e,i[2*t],i[2*t+1])}function qU(e,t){var i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1}function YU(e,t,i){var r,n,o=new Array(16),a=0;for(r=1;r<=15;r++)o[r]=a=a+i[r-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=qU(o[s]++,s))}}function JU(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function QU(e){e.bi_valid>8?KU(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function ZU(e,t,i,r){var n=2*t,o=2*i;return e[n]<e[o]||e[n]===e[o]&&r[t]<=r[i]}function $U(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&ZU(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!ZU(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function ex(e,t,i){var r,n,o,a,s=0;if(0!==e.last_lit)do{r=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],n=e.pending_buf[e.l_buf+s],s++,0===r?XU(e,n,t):(XU(e,(o=UU[n])+256+1,t),0!==(a=wU[o])&&WU(e,n-=xU[o],a),XU(e,o=zU(--r),i),0!==(a=kU[o])&&WU(e,r-=jU[o],a))}while(s<e.last_lit);XU(e,256,t)}function tx(e,t){var i,r,n,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<c;i++)0!==o[2*i]?(e.heap[++e.heap_len]=u=i,e.depth[i]=0):o[2*i+1]=0;for(;e.heap_len<2;)o[2*(n=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=a[2*n+1]);for(t.max_code=u,i=e.heap_len>>1;i>=1;i--)$U(e,o,i);n=c;do{i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],$U(e,o,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,o[2*n]=o[2*i]+o[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,o[2*i+1]=o[2*r+1]=n,e.heap[1]=n++,$U(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,f=t.stat_desc.max_length,_=0;for(o=0;o<=15;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)(o=c[2*c[2*(r=e.heap[i])+1]+1]+1)>f&&(o=f,_++),c[2*r+1]=o,r>u||(e.bl_count[o]++,a=0,r>=p&&(a=h[r-p]),s=c[2*r],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*r+1]+a)));if(0!==_){do{for(o=f-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[f]--,_-=2}while(_>0);for(o=f;0!==o;o--)for(r=e.bl_count[o];0!==r;)(n=e.heap[--i])>u||(c[2*n+1]!==o&&(e.opt_len+=(o-c[2*n+1])*c[2*n],c[2*n+1]=o),r--)}}(e,t),YU(o,u,e.bl_count)}function ix(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=a,a=t[2*(r+1)+1],++s<c&&n===a||(s<u?e.bl_tree[2*n]+=s:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4))}function rx(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),r=0;r<=i;r++)if(n=a,a=t[2*(r+1)+1],!(++s<c&&n===a)){if(s<u)do{XU(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(XU(e,n,e.bl_tree),s--),XU(e,16,e.bl_tree),WU(e,s-3,2)):s<=10?(XU(e,17,e.bl_tree),WU(e,s-3,3)):(XU(e,18,e.bl_tree),WU(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}OU(jU);var nx=!1;function ox(e,t,i,r){WU(e,0+(r?1:0),3),function(e,t,i,r){QU(e),r&&(KU(e,i),KU(e,~i)),CU.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}(e,t,i,!0)}RU._tr_init=function(e){nx||(!function(){var e,t,i,r,n,o=new Array(16);for(i=0,r=0;r<28;r++)for(xU[r]=i,e=0;e<1<<wU[r];e++)UU[i++]=r;for(UU[i-1]=r,n=0,r=0;r<16;r++)for(jU[r]=n,e=0;e<1<<kU[r];e++)LU[n++]=r;for(n>>=7;r<30;r++)for(jU[r]=n<<7,e=0;e<1<<kU[r]-7;e++)LU[256+n++]=r;for(t=0;t<=15;t++)o[t]=0;for(e=0;e<=143;)DU[2*e+1]=8,e++,o[8]++;for(;e<=255;)DU[2*e+1]=9,e++,o[9]++;for(;e<=279;)DU[2*e+1]=7,e++,o[7]++;for(;e<=287;)DU[2*e+1]=8,e++,o[8]++;for(YU(DU,287,o),e=0;e<30;e++)MU[2*e+1]=5,MU[2*e]=qU(e,5);VU=new GU(DU,wU,257,286,15),FU=new GU(MU,kU,0,30,15),BU=new GU(new Array(0),NU,0,19,7)}(),nx=!0),e.l_desc=new HU(e.dyn_ltree,VU),e.d_desc=new HU(e.dyn_dtree,FU),e.bl_desc=new HU(e.bl_tree,BU),e.bi_buf=0,e.bi_valid=0,JU(e)},RU._tr_stored_block=ox,RU._tr_flush_block=function(e,t,i,r){var n,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),tx(e,e.l_desc),tx(e,e.d_desc),a=function(e){var t;for(ix(e,e.dyn_ltree,e.l_desc.max_code),ix(e,e.dyn_dtree,e.d_desc.max_code),tx(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*PU[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==t?ox(e,t,i,r):4===e.strategy||o===n?(WU(e,2+(r?1:0),3),ex(e,DU,MU)):(WU(e,4+(r?1:0),3),function(e,t,i,r){var n;for(WU(e,t-257,5),WU(e,i-1,5),WU(e,r-4,4),n=0;n<r;n++)WU(e,e.bl_tree[2*PU[n]+1],3);rx(e,e.dyn_ltree,t-1),rx(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),ex(e,e.dyn_ltree,e.dyn_dtree)),JU(e),r&&QU(e)},RU._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(UU[i]+256+1)]++,e.dyn_dtree[2*zU(t)]++),e.last_lit===e.lit_bufsize-1},RU._tr_align=function(e){WU(e,2,3),XU(e,256,DU),function(e){16===e.bi_valid?(KU(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var ax=function(e,t,i,r){for(var n=65535&e|0,o=e>>>16&65535|0,a=0;0!==i;){i-=a=i>2e3?2e3:i;do{o=o+(n=n+t[r++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0};var sx=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();var cx,ux=function(e,t,i,r){var n=sx,o=r+i;e^=-1;for(var a=r;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},dx={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},lx=IU,hx=RU,px=ax,fx=ux,_x=dx;function vx(e,t){return e.msg=_x[t],t}function mx(e){return(e<<1)-(e>4?9:0)}function yx(e){for(var t=e.length;--t>=0;)e[t]=0}function gx(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(lx.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function Sx(e,t){hx._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,gx(e.strm)}function Ex(e,t){e.pending_buf[e.pending++]=t}function bx(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function Ix(e,t){var i,r,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+258,p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(i=t)+a]===f&&u[i+a-1]===p&&u[i]===u[o]&&u[++i]===u[o+1]){o+=2,i++;do{}while(u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&o<h);if(r=258-(h-o),o=h-258,r>a){if(e.match_start=t,a=r,r>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=l[t&d])>c&&0!=--n);return a<=e.lookahead?a:e.lookahead}function Tx(e){var t,i,r,n,o,a,s,c,u,d,l=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-262)){lx.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=i=e.hash_size;do{r=e.head[--t],e.head[t]=r>=l?r-l:0}while(--i);t=i=l;do{r=e.prev[--t],e.prev[t]=r>=l?r-l:0}while(--i);n+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=n,d=void 0,(d=a.avail_in)>u&&(d=u),i=0===d?0:(a.avail_in-=d,lx.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=px(a.adler,s,d,c):2===a.state.wrap&&(a.adler=fx(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=i,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)}function Ax(e,t){for(var i,r;;){if(e.lookahead<262){if(Tx(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-262&&(e.match_length=Ix(e,i)),e.match_length>=3)if(r=hx._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=hx._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Sx(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(Sx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Sx(e,!1),0===e.strm.avail_out)?1:2}function Rx(e,t){for(var i,r,n;;){if(e.lookahead<262){if(Tx(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-262&&(e.match_length=Ix(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,r=hx._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Sx(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=hx._tr_tally(e,0,e.window[e.strstart-1]))&&Sx(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=hx._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(Sx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Sx(e,!1),0===e.strm.avail_out)?1:2}function Cx(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function Ox(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new lx.Buf16(1146),this.dyn_dtree=new lx.Buf16(122),this.bl_tree=new lx.Buf16(78),yx(this.dyn_ltree),yx(this.dyn_dtree),yx(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new lx.Buf16(16),this.heap=new lx.Buf16(573),yx(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new lx.Buf16(573),yx(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function wx(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=0,hx._tr_init(t),0):vx(e,-2)}function kx(e){var t,i=wx(e);return 0===i&&((t=e.state).window_size=2*t.w_size,yx(t.head),t.max_lazy_match=cx[t.level].max_lazy,t.good_match=cx[t.level].good_length,t.nice_match=cx[t.level].nice_length,t.max_chain_length=cx[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),i}function Nx(e,t,i,r,n,o){if(!e)return-2;var a=1;if(-1===t&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),n<1||n>9||8!==i||r<8||r>15||t<0||t>9||o<0||o>4)return vx(e,-2);8===r&&(r=9);var s=new Ox;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new lx.Buf8(2*s.w_size),s.head=new lx.Buf16(s.hash_size),s.prev=new lx.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new lx.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=i,kx(e)}cx=[new Cx(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Tx(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,Sx(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(Sx(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Sx(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(Sx(e,!1),e.strm.avail_out),1)})),new Cx(4,4,8,4,Ax),new Cx(4,5,16,8,Ax),new Cx(4,6,32,32,Ax),new Cx(4,4,16,16,Rx),new Cx(8,16,32,32,Rx),new Cx(8,16,128,128,Rx),new Cx(8,32,128,256,Rx),new Cx(32,128,258,1024,Rx),new Cx(32,258,258,4096,Rx)],AU.deflateInit=function(e,t){return Nx(e,t,8,15,8,0)},AU.deflateInit2=Nx,AU.deflateReset=kx,AU.deflateResetKeep=wx,AU.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},AU.deflate=function(e,t){var i,r,n,o;if(!e||!e.state||t>5||t<0)return e?vx(e,-2):-2;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||666===r.status&&4!==t)return vx(e,0===e.avail_out?-5:-2);if(r.strm=e,i=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,Ex(r,31),Ex(r,139),Ex(r,8),r.gzhead?(Ex(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Ex(r,255&r.gzhead.time),Ex(r,r.gzhead.time>>8&255),Ex(r,r.gzhead.time>>16&255),Ex(r,r.gzhead.time>>24&255),Ex(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Ex(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Ex(r,255&r.gzhead.extra.length),Ex(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=fx(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(Ex(r,0),Ex(r,0),Ex(r,0),Ex(r,0),Ex(r,0),Ex(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Ex(r,3),r.status=113);else{var a=8+(r.w_bits-8<<4)<<8;a|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(a|=32),a+=31-a%31,r.status=113,bx(r,a),0!==r.strstart&&(bx(r,e.adler>>>16),bx(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(n=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),gx(e),n=r.pending,r.pending!==r.pending_buf_size));)Ex(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),gx(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Ex(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),gx(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Ex(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&gx(e),r.pending+2<=r.pending_buf_size&&(Ex(r,255&e.adler),Ex(r,e.adler>>8&255),e.adler=0,r.status=113)):r.status=113),0!==r.pending){if(gx(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&mx(t)<=mx(i)&&4!==t)return vx(e,-5);if(666===r.status&&0!==e.avail_in)return vx(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&666!==r.status){var s=2===r.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(Tx(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=hx._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Sx(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Sx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Sx(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var i,r,n,o,a=e.window;;){if(e.lookahead<=258){if(Tx(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=a[n=e.strstart-1])===a[++n]&&r===a[++n]&&r===a[++n]){o=e.strstart+258;do{}while(r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&n<o);e.match_length=258-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=hx._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=hx._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Sx(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Sx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Sx(e,!1),0===e.strm.avail_out)?1:2}(r,t):cx[r.level].func(r,t);if(3!==s&&4!==s||(r.status=666),1===s||3===s)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===s&&(1===t?hx._tr_align(r):5!==t&&(hx._tr_stored_block(r,0,0,!1),3===t&&(yx(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),gx(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?(Ex(r,255&e.adler),Ex(r,e.adler>>8&255),Ex(r,e.adler>>16&255),Ex(r,e.adler>>24&255),Ex(r,255&e.total_in),Ex(r,e.total_in>>8&255),Ex(r,e.total_in>>16&255),Ex(r,e.total_in>>24&255)):(bx(r,e.adler>>>16),bx(r,65535&e.adler)),gx(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)},AU.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t?vx(e,-2):(e.state=null,113===t?vx(e,-3):0):-2},AU.deflateSetDictionary=function(e,t){var i,r,n,o,a,s,c,u,d=t.length;if(!e||!e.state)return-2;if(2===(o=(i=e.state).wrap)||1===o&&42!==i.status||i.lookahead)return-2;for(1===o&&(e.adler=px(e.adler,t,d,0)),i.wrap=0,d>=i.w_size&&(0===o&&(yx(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new lx.Buf8(i.w_size),lx.arraySet(u,t,d-i.w_size,i.w_size,0),t=u,d=i.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,Tx(i);i.lookahead>=3;){r=i.strstart,n=i.lookahead-2;do{i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++}while(--n);i.strstart=r,i.lookahead=2,Tx(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,i.wrap=o,0},AU.deflateInfo="pako deflate (from Nodeca project)";var Px={},Dx=IU,Mx=!0,Lx=!0;try{String.fromCharCode.apply(null,[0])}catch(e){Mx=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Lx=!1}for(var Ux=new Dx.Buf8(256),xx=0;xx<256;xx++)Ux[xx]=xx>=252?6:xx>=248?5:xx>=240?4:xx>=224?3:xx>=192?2:1;function Vx(e,t){if(t<65534&&(e.subarray&&Lx||!e.subarray&&Mx))return String.fromCharCode.apply(null,Dx.shrinkBuf(e,t));for(var i="",r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i}Ux[254]=Ux[254]=1,Px.string2buf=function(e){var t,i,r,n,o,a=e.length,s=0;for(n=0;n<a;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),s+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Dx.Buf8(s),o=0,n=0;o<s;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),i<128?t[o++]=i:i<2048?(t[o++]=192|i>>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},Px.buf2binstring=function(e){return Vx(e,e.length)},Px.binstring2buf=function(e){for(var t=new Dx.Buf8(e.length),i=0,r=t.length;i<r;i++)t[i]=e.charCodeAt(i);return t},Px.buf2string=function(e,t){var i,r,n,o,a=t||e.length,s=new Array(2*a);for(r=0,i=0;i<a;)if((n=e[i++])<128)s[r++]=n;else if((o=Ux[n])>4)s[r++]=65533,i+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&i<a;)n=n<<6|63&e[i++],o--;o>1?s[r++]=65533:n<65536?s[r++]=n:(n-=65536,s[r++]=55296|n>>10&1023,s[r++]=56320|1023&n)}return Vx(s,r)},Px.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Ux[e[i]]>t?i:t};var Fx=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},Bx=AU,jx=IU,Gx=Px,Hx=dx,zx=Fx,Kx=Object.prototype.toString;function Wx(e){if(!(this instanceof Wx))return new Wx(e);this.options=jx.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zx,this.strm.avail_out=0;var i=Bx.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(Hx[i]);if(t.header&&Bx.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(r="string"==typeof t.dictionary?Gx.string2buf(t.dictionary):"[object ArrayBuffer]"===Kx.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=Bx.deflateSetDictionary(this.strm,r)))throw new Error(Hx[i]);this._dict_set=!0}}function Xx(e,t){var i=new Wx(t);if(i.push(e,!0),i.err)throw i.msg||Hx[i.err];return i.result}Wx.prototype.push=function(e,t){var i,r,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;r=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=Gx.string2buf(e):"[object ArrayBuffer]"===Kx.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new jx.Buf8(o),n.next_out=0,n.avail_out=o),1!==(i=Bx.deflate(n,r))&&0!==i)return this.onEnd(i),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(Gx.buf2binstring(jx.shrinkBuf(n.output,n.next_out))):this.onData(jx.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==i);return 4===r?(i=Bx.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),n.avail_out=0,!0)},Wx.prototype.onData=function(e){this.chunks.push(e)},Wx.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=jx.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},TU.Deflate=Wx,TU.deflate=Xx,TU.deflateRaw=function(e,t){return(t=t||{}).raw=!0,Xx(e,t)},TU.gzip=function(e,t){return(t=t||{}).gzip=!0,Xx(e,t)};var qx={},Yx=s,Jx=Rt,Qx=Zo,Zx=a,$x=RegExp.prototype;Yx&&Zx((function(){return"sy"!==Object.getOwnPropertyDescriptor($x,"flags").get.call({dotAll:!0,sticky:!0})}))&&Jx.f($x,"flags",{configurable:!0,get:Qx});var eV={},tV=IU,iV=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],rV=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],nV=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],oV=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],aV=IU,sV=ax,cV=ux,uV=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R;i=e.state,r=e.next_in,A=e.input,n=r+(e.avail_in-5),o=e.next_out,R=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=i.dmax,u=i.wsize,d=i.whave,l=i.wnext,h=i.window,p=i.hold,f=i.bits,_=i.lencode,v=i.distcode,m=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;e:do{f<15&&(p+=A[r++]<<f,f+=8,p+=A[r++]<<f,f+=8),g=_[p&m];t:for(;;){if(p>>>=S=g>>>24,f-=S,0===(S=g>>>16&255))R[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=_[(65535&g)+(p&(1<<S)-1)];continue t}if(32&S){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}E=65535&g,(S&=15)&&(f<S&&(p+=A[r++]<<f,f+=8),E+=p&(1<<S)-1,p>>>=S,f-=S),f<15&&(p+=A[r++]<<f,f+=8,p+=A[r++]<<f,f+=8),g=v[p&y];i:for(;;){if(p>>>=S=g>>>24,f-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=v[(65535&g)+(p&(1<<S)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(b=65535&g,f<(S&=15)&&(p+=A[r++]<<f,(f+=8)<S&&(p+=A[r++]<<f,f+=8)),(b+=p&(1<<S)-1)>c){e.msg="invalid distance too far back",i.mode=30;break e}if(p>>>=S,f-=S,b>(S=o-a)){if((S=b-S)>d&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(I=0,T=h,0===l){if(I+=u-S,S<E){E-=S;do{R[o++]=h[I++]}while(--S);I=o-b,T=R}}else if(l<S){if(I+=u+l-S,(S-=l)<E){E-=S;do{R[o++]=h[I++]}while(--S);if(I=0,l<E){E-=S=l;do{R[o++]=h[I++]}while(--S);I=o-b,T=R}}}else if(I+=l-S,S<E){E-=S;do{R[o++]=h[I++]}while(--S);I=o-b,T=R}for(;E>2;)R[o++]=T[I++],R[o++]=T[I++],R[o++]=T[I++],E-=3;E&&(R[o++]=T[I++],E>1&&(R[o++]=T[I++]))}else{I=o-b;do{R[o++]=R[I++],R[o++]=R[I++],R[o++]=R[I++],E-=3}while(E>2);E&&(R[o++]=R[I++],E>1&&(R[o++]=R[I++]))}break}}break}}while(r<n&&o<s);r-=E=f>>3,p&=(1<<(f-=E<<3))-1,e.next_in=r,e.next_out=o,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=o<s?s-o+257:257-(o-s),i.hold=p,i.bits=f},dV=function(e,t,i,r,n,o,a,s){var c,u,d,l,h,p,f,_,v,m=s.bits,y=0,g=0,S=0,E=0,b=0,I=0,T=0,A=0,R=0,C=0,O=null,w=0,k=new tV.Buf16(16),N=new tV.Buf16(16),P=null,D=0;for(y=0;y<=15;y++)k[y]=0;for(g=0;g<r;g++)k[t[i+g]]++;for(b=m,E=15;E>=1&&0===k[E];E--);if(b>E&&(b=E),0===E)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(S=1;S<E&&0===k[S];S++);for(b<S&&(b=S),A=1,y=1;y<=15;y++)if(A<<=1,(A-=k[y])<0)return-1;if(A>0&&(0===e||1!==E))return-1;for(N[1]=0,y=1;y<15;y++)N[y+1]=N[y]+k[y];for(g=0;g<r;g++)0!==t[i+g]&&(a[N[t[i+g]]++]=g);if(0===e?(O=P=a,p=19):1===e?(O=iV,w-=257,P=rV,D-=257,p=256):(O=nV,P=oV,p=-1),C=0,g=0,y=S,h=o,I=b,T=0,d=-1,l=(R=1<<b)-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){f=y-T,a[g]<p?(_=0,v=a[g]):a[g]>p?(_=P[D+a[g]],v=O[w+a[g]]):(_=96,v=0),c=1<<y-T,S=u=1<<I;do{n[h+(C>>T)+(u-=c)]=f<<24|_<<16|v|0}while(0!==u);for(c=1<<y-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,g++,0==--k[y]){if(y===E)break;y=t[i+a[g]]}if(y>b&&(C&l)!==d){for(0===T&&(T=b),h+=S,A=1<<(I=y-T);I+T<E&&!((A-=k[I+T])<=0);)I++,A<<=1;if(R+=1<<I,1===e&&R>852||2===e&&R>592)return 1;n[d=C&l]=b<<24|I<<16|h-o|0}}return 0!==C&&(n[h+C]=y-T<<24|64<<16|0),s.bits=b,0};function lV(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function hV(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new aV.Buf16(320),this.work=new aV.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function pV(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new aV.Buf32(852),t.distcode=t.distdyn=new aV.Buf32(592),t.sane=1,t.back=-1,0):-2}function fV(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,pV(e)):-2}function _V(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,fV(e))):-2}function vV(e,t){var i,r;return e?(r=new hV,e.state=r,r.window=null,0!==(i=_V(e,t))&&(e.state=null),i):-2}var mV,yV,gV=!0;function SV(e){if(gV){var t;for(mV=new aV.Buf32(512),yV=new aV.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(dV(1,e.lens,0,288,mV,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;dV(2,e.lens,0,32,yV,0,e.work,{bits:5}),gV=!1}e.lencode=mV,e.lenbits=9,e.distcode=yV,e.distbits=5}function EV(e,t,i,r){var n,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new aV.Buf8(o.wsize)),r>=o.wsize?(aV.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),aV.arraySet(o.window,t,i-r,n,o.wnext),(r-=n)?(aV.arraySet(o.window,t,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}eV.inflateReset=fV,eV.inflateReset2=_V,eV.inflateResetKeep=pV,eV.inflateInit=function(e){return vV(e,15)},eV.inflateInit2=vV,eV.inflate=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R=0,C=new aV.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(i=e.state).mode&&(i.mode=13),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,l=s,h=c,I=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(2&i.wrap&&35615===u){i.check=0,C[0]=255&u,C[1]=u>>>8&255,i.check=cV(i.check,C,2,0),u=0,d=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",i.mode=30;break}if(d-=4,b=8+(15&(u>>>=4)),0===i.wbits)i.wbits=b;else if(b>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<b,e.adler=i.check=1,i.mode=512&u?10:12,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.flags=u,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=cV(i.check,C,2,0)),u=0,d=0,i.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.time=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,i.check=cV(i.check,C,4,0)),u=0,d=0,i.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=cV(i.check,C,2,0)),u=0,d=0,i.mode=5;case 5:if(1024&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=cV(i.check,C,2,0)),u=0,d=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((p=i.length)>s&&(p=s),p&&(i.head&&(b=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),aV.arraySet(i.head.extra,r,o,p,b)),512&i.flags&&(i.check=cV(i.check,r,p,o)),s-=p,o+=p,i.length-=p),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=cV(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=cV(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}u=0,d=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}e.adler=i.check=lV(u),u=0,d=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){u>>>=7&d,d-=7&d,i.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}switch(i.last=1&u,d-=1,3&(u>>>=1)){case 0:i.mode=14;break;case 1:if(SV(i),i.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&u,u=0,d=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(p=i.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;aV.arraySet(n,r,o,p,a),s-=p,o+=p,c-=p,a+=p,i.length-=p;break}i.mode=12;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.nlen=257+(31&u),u>>>=5,d-=5,i.ndist=1+(31&u),u>>>=5,d-=5,i.ncode=4+(15&u),u>>>=4,d-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.lens[O[i.have++]]=7&u,u>>>=3,d-=3}for(;i.have<19;)i.lens[O[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,T={bits:i.lenbits},I=dV(0,i.lens,0,19,i.lencode,0,i.work,T),i.lenbits=T.bits,I){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;m=(R=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(y<16)u>>>=v,d-=v,i.lens[i.have++]=y;else{if(16===y){for(A=v+2;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u>>>=v,d-=v,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}b=i.lens[i.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===y){for(A=v+3;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(A=v+7;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=11+(127&(u>>>=v)),u>>>=7,d-=7}if(i.have+p>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;p--;)i.lens[i.have++]=b}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,T={bits:i.lenbits},I=dV(1,i.lens,0,i.nlen,i.lencode,0,i.work,T),i.lenbits=T.bits,I){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,T={bits:i.distbits},I=dV(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,T),i.distbits=T.bits,I){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,uV(e,h),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;m=(R=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=v,S=m,E=y;m=(R=i.lencode[E+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&R,!(g+(v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=g,d-=g,i.back+=g}if(u>>>=v,d-=v,i.back+=v,i.length=y,0===m){i.mode=26;break}if(32&m){i.back=-1,i.mode=12;break}if(64&m){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&m,i.mode=22;case 22:if(i.extra){for(A=i.extra;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;m=(R=i.distcode[u&(1<<i.distbits)-1])>>>16&255,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(0==(240&m)){for(g=v,S=m,E=y;m=(R=i.distcode[E+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&R,!(g+(v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=g,d-=g,i.back+=g}if(u>>>=v,d-=v,i.back+=v,64&m){e.msg="invalid distance code",i.mode=30;break}i.offset=y,i.extra=15&m,i.mode=24;case 24:if(i.extra){for(A=i.extra;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===c)break e;if(p=h-c,i.offset>p){if((p=i.offset-p)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}p>i.wnext?(p-=i.wnext,f=i.wsize-p):f=i.wnext-p,p>i.length&&(p=i.length),_=i.window}else _=n,f=a-i.offset,p=i.length;p>c&&(p=c),c-=p,i.length-=p;do{n[a++]=_[f++]}while(--p);0===i.length&&(i.mode=21);break;case 26:if(0===c)break e;n[a++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;d<32;){if(0===s)break e;s--,u|=r[o++]<<d,d+=8}if(h-=c,e.total_out+=h,i.total+=h,h&&(e.adler=i.check=i.flags?cV(i.check,n,h,a-h):sV(i.check,n,h,a-h)),h=c,(i.flags?u:lV(u))!==i.check){e.msg="incorrect data check",i.mode=30;break}u=0,d=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}u=0,d=0}i.mode=29;case 29:I=1;break e;case 30:I=-3;break e;case 31:return-4;default:return-2}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,(i.wsize||h!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&EV(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,i.total+=h,i.wrap&&h&&(e.adler=i.check=i.flags?cV(i.check,n,h,e.next_out-h):sV(i.check,n,h,e.next_out-h)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0===l&&0===h||4===t)&&0===I&&(I=-5),I},eV.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},eV.inflateGetHeader=function(e,t){var i;return e&&e.state?0==(2&(i=e.state).wrap)?-2:(i.head=t,t.done=!1,0):-2},eV.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?-2:11===i.mode&&sV(1,t,r,0)!==i.check?-3:EV(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):-2},eV.inflateInfo="pako inflate (from Nodeca project)";var bV={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var IV=eV,TV=IU,AV=Px,RV=bV,CV=dx,OV=Fx,wV=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},kV=Object.prototype.toString;function NV(e){if(!(this instanceof NV))return new NV(e);this.options=TV.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new OV,this.strm.avail_out=0;var i=IV.inflateInit2(this.strm,t.windowBits);if(i!==RV.Z_OK)throw new Error(CV[i]);if(this.header=new wV,IV.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=AV.string2buf(t.dictionary):"[object ArrayBuffer]"===kV.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=IV.inflateSetDictionary(this.strm,t.dictionary))!==RV.Z_OK))throw new Error(CV[i])}function PV(e,t){var i=new NV(t);if(i.push(e,!0),i.err)throw i.msg||CV[i.err];return i.result}NV.prototype.push=function(e,t){var i,r,n,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;r=t===~~t?t:!0===t?RV.Z_FINISH:RV.Z_NO_FLUSH,"string"==typeof e?s.input=AV.binstring2buf(e):"[object ArrayBuffer]"===kV.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new TV.Buf8(c),s.next_out=0,s.avail_out=c),(i=IV.inflate(s,RV.Z_NO_FLUSH))===RV.Z_NEED_DICT&&u&&(i=IV.inflateSetDictionary(this.strm,u)),i===RV.Z_BUF_ERROR&&!0===d&&(i=RV.Z_OK,d=!1),i!==RV.Z_STREAM_END&&i!==RV.Z_OK)return this.onEnd(i),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&i!==RV.Z_STREAM_END&&(0!==s.avail_in||r!==RV.Z_FINISH&&r!==RV.Z_SYNC_FLUSH)||("string"===this.options.to?(n=AV.utf8border(s.output,s.next_out),o=s.next_out-n,a=AV.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&TV.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(TV.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&i!==RV.Z_STREAM_END);return i===RV.Z_STREAM_END&&(r=RV.Z_FINISH),r===RV.Z_FINISH?(i=IV.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===RV.Z_OK):r!==RV.Z_SYNC_FLUSH||(this.onEnd(RV.Z_OK),s.avail_out=0,!0)},NV.prototype.onData=function(e){this.chunks.push(e)},NV.prototype.onEnd=function(e){e===RV.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=TV.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},qx.Inflate=NV,qx.inflate=PV,qx.inflateRaw=function(e,t){return(t=t||{}).raw=!0,PV(e,t)},qx.ungzip=PV;var DV={};(0,IU.assign)(DV,TU,qx,bV);var MV=DV,LV=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);if(!t)return null;try{var i=JSON.parse(t);return i.ttl>0&&Date.now()-i.saveTime>i.ttl?(this.delete(e),null):i.message}catch(e){return null}},e.prototype.set=function(e,t,i){void 0===i&&(i=-1);var r={ttl:i,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(r)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),UV=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._accessVersion="v2",t}return Z_(t,e),t.prototype.getDeviceId=function(){if(WL())return"";var e=this.get("RTC_DEVICE_ID");return e||(e=bL()),this.set("RTC_DEVICE_ID",e),e},t.prototype.setDeviceId=function(e){return[iB,rB,nB].forEach((function(t){return t.setStats({device_id:e})})),this.set("RTC_DEVICE_ID",e),e},t.prototype.getAccessNode=function(e){return this.get("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus-").concat(this._accessVersion))},t.prototype.setAccessNode=function(e,t,i){},t.prototype.clearAccessNode=function(e){this.delete("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat("RTC_ACCESS_URLS","-BytePlus"))},t.prototype.setAccessUrls=function(e){},t.prototype.clearAccessUrls=function(){this.delete("".concat("RTC_ACCESS_URLS","-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get("RTC_H264_BLACK_LIST")},t.prototype.setH264BlackList=function(e){return this.set("RTC_H264_BLACK_LIST",e)},t.prototype.getAudioProfile=function(){return this.get("engine_BAC")},t.prototype.setAudioProfile=function(e){return this.set("engine_BAC",e)},t.prototype.getServerConfig=function(e){var t,i="".concat(e),r=this.get("SERVER_CONFIG");return(null===(t=null==r?void 0:r.find((function(e){return e.key===i})))||void 0===t?void 0:t.config)||{}},t.prototype.setServerConfig=function(e,t){if(t){var i="".concat(e),r=this.get("SERVER_CONFIG")||[];return r=r.filter((function(e){return e.key!==i})),r.push({key:i,config:t}),this.set("SERVER_CONFIG",r.slice(-5))}},t}(LV),xV=new UV,VV="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function FV(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var BV="rtc.rtcplus.com".split(","),jV={VERSION:"4.45.0-blw.14",ICE_CONFIG_REQUEST_URLS_INTERNAL:VV.map(FV),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:"https://web-log-report.rtcplus.com/video/v1/webrtc_log/",CONFIG_REQUEST_DOMAINS:BV,DEVICE_ID:"",OVERSEA:!1,ENABLE_FALLBACK_HANDLER:!1};function GV(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(jV.ICE_CONFIG_REQUEST_URLS=t.map(FV))):void("LOG_SERVER_URL"!==e||t!==eL.overseas?"LOG_SERVER_URL"!==e||t!==eL.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?"ENABLE_FALLBACK_HANDLER"!==e?("DEVICE_ID"===e&&xV.setDeviceId(t),jV[e]=t):jV.ENABLE_FALLBACK_HANDLER=t:jV.OVERSEA=t:jV.LOG_SERVER_URL=t:jV.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/":jV.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function HV(e){return"DEVICE_ID"===e?xV.getDeviceId():jV[e]}function zV(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:(null===(i=t.audio)||void 0===i?void 0:i.codec)||WV.audio.codec,bitRate:1e3*((null===(r=t.audio)||void 0===r?void 0:r.kBitRate)||WV.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||WV.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||WV.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||WV.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||WV.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||WV.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||WV.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:WV.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||WV.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||WV.video.width,height:(null===(f=t.video)||void 0===f?void 0:f.height)||WV.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||WV.layout.backgroundColor},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(y=t.layout)||void 0===y?void 0:y.appData)||WV.layout.appData}}}}function KV(e,t,i){var r,n,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(r=i.video)||void 0===r?void 0:r.fps)||15,bitrate:1e3*((null===(n=i.video)||void 0===n?void 0:n.kBitRate)||40),width:(null===(o=i.video)||void 0===o?void 0:o.width)||640,height:(null===(a=i.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=i.layout)||void 0===s?void 0:s.interpolationMode)||rL.PREV_FRAME,canvas:{bgColor:(null===(c=i.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=i.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(l=null===(d=i.layout)||void 0===d?void 0:d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:e.alpha,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var WV={url:"",video:{codec:"H264",width:640,height:360,fps:30,gop:60,kBitRate:600,lowLatency:!0},audio:{codec:"AAC",kBitRate:64,sampleRate:48,channels:2,AACProfile:"LC"},layout:{regions:[],appData:"",backgroundColor:"#000000"}},XV=[{width:320,height:180,frameRate:15,maxKbps:200},{width:640,height:360,frameRate:15,maxKbps:500},{width:640,height:480,frameRate:15,maxKbps:600},{width:960,height:540,frameRate:15,maxKbps:900},{width:1280,height:720,frameRate:15,maxKbps:2e3},{width:1920,height:1080,frameRate:15,maxKbps:3500}];var qV={width:640,height:360,frameRate:30,maxKbps:600},YV={width:1920,height:1080,frameRate:15,maxKbps:3e3},JV={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function r(){}function n(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new n(r,o||e,a),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,r,n=[];if(0===this._eventsCount)return n;for(r in e=this._events)t.call(e,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,a=new Array(o);n<o;n++)a[n]=r[n].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,n,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,n),!0;case 5:return d.fn.call(d.context,t,r,n,o),!0;case 6:return d.fn.call(d.context,t,r,n,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,r);break;case 4:d[u].fn.call(d[u].context,t,r,n);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,r,n){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||n&&!s.once||r&&s.context!==r||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||r&&s[c].context!==r)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}(JV);var QV,ZV,$V,eF,tF,iF,rF,nF,oF,aF,sF,cF,uF,dF,lF,hF,pF,fF,_F,vF,mF,yF,gF,SF,EF,bF,IF,TF,AF,RF,CF,OF,wF,kF,NF,PF,DF,MF,LF,UF,xF,VF,FF,BF,jF,GF,HF,zF=JV.exports,KF=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],WF=!WL()&&window.location.search.includes("_rtc_debug_"),XF=function(){function e(e,t,i){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(window._ve_sdk_cb&&window._ve_sdk_cb.apply(window,ov(["".concat("[VERTC]","[").concat(this._module,".").concat(e,"] ").concat(t.shift())],nv(t),!1)),WF){for(var r="",n=0;n<this._indent;n++)r+=" ";console.log.apply(console,ov(["%c".concat(qF(),"-").concat("[VERTC]").concat(r,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(KF[this._indent],";")],nv(t),!1))}},e}(),qF=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},YF=new XF("VERTC",0),JF=function(e){function t(){return e.call(this)||this}return Z_(t,e),t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];var n=this.listenerCount(t);try{return e.prototype.emit.apply(this,ov([t],nv(i),!1))}catch(e){return YF.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(n)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return tv(this,void 0,void 0,(function(){var i=this;return iv(this,(function(r){return[2,new Promise((function(r,n){try{i.emit.apply(i,ov(ov([e],nv(t),!1),[r,n],!1))}catch(t){YF.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}(JV.exports.EventEmitter);!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",e.RTC_GET_CONFIG="rtc_get_config",e.RTC_RECONNECT="rtc_reconnect",e.RTC_RECONNECTED="rtc_reconnected",e.RTC_GET_ACCESS="rtc_get_access",e.RTC_PRE_ICE_STATE="rtc_pre_ice_state",e.RTC_NODE_CHANGE="rtc_node_change",e.RTC_SIGNALING_MSG_ERROR="rtc_signaling_msg_error",e.RTC_SIGNALING="rtc_signaling",e.RTC_JOIN_ROOM="rtc_join_room",e.RTC_LEAVE_ROOM="rtc_leave_room",e.RTC_BEGIN_CREATE_OFFER="rtc_begin_create_offer",e.RTC_CREATE_OFFER="rtc_create_offer",e.RTC_SET_DESCRIPTION="rtc_set_description",e.RTC_RECV_ANSWER="rtc_recv_answer",e.FIRST_REMOTE_AUDIO_RENDER="first_remote_audio_render",e.FIRST_REMOTE_VIDEO_RENDER="first_remote_video_render",e.RTC_PUBLISH_STAT="rtc_publish_stat",e.RTC_SUBSCRIBE_STAT="rtc_subscribe_stat",e.RTC_AUDIO_DEVICE="rtc_audio_device",e.RTC_MEDIA_STATISTICS="rtc_media_statistics",e.RTC_MESSAGE_STATISTICS="rtc_message_statistics",e.RTC_ERROR="rtc_error",e.RTC_INVOKE_STATUS="rtc_invoke_status",e.RTC_FIRST_FRAME="rtc_first_frame",e.RTC_MUTE_REMOTE="rtc_mute_remote",e.SDK_INIT_ENGINE="sdk_init_engine",e.JOIN_ROOM="join_room",e.P2P_CONNECTION_STATUS="p2p_connection_status",e.P2P_CONNECT_CLOSED="p2p_connect_closed",e.RTC_DEVICE_ERROR="rtc_device_error",e.RTC_VIDEO_DEVICE="rtc_video_device",e.RTC_VIDEO_CAPTURE_EVENT="rtc_video_capture_event",e.RTC_ENCODE_FIRST_FRAME="rtc_encode_first_frame",e.RTC_FIRST_FRAME_ENCODED="rtc_first_frame_encoded",e.RTC_SEND_FIRST_PACKET="rtc_send_first_packet",e.RTC_RECV_FIRST_PACKET="rtc_recv_first_packet",e.RTC_RECV_FIRST_FRAME="rtc_recv_first_frame",e.RTC_DECODE_FIRST_FRAME="rtc_decode_first_frame"}(QV||(QV={})),function(e){e.RTC="rtc"}(ZV||(ZV={})),function(e){e.W_5="5"}($V||($V={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(eF||(eF={})),function(e){e.UNKNOWN="unknown",e.DISCONNECTED="disconnected",e.LAN="lan",e.WIFI="wifi",e.W_2="2g",e.W_3="3g",e.W_4="4g",e.W_5="5g"}(tF||(tF={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(iF||(iF={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(rF||(rF={})),function(e){e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN"}(nF||(nF={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(oF||(oF={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(aF||(aF={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(sF||(sF={})),function(e){e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response"}(cF||(cF={})),function(e){e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED"}(uF||(uF={})),function(e){e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed"}(dF||(dF={})),function(e){e.CALL_JOINROOM="call-joinRoom",e.JOINROOM="joinRoom",e.CALL_RECONNECTED="call-reconnected",e.RECONNECTED="reconnected",e.CALL_PUBLISH="call-publish",e.PUBLISH="publish",e.CALL_UPDATESTREAMATTRIBUTES="call-updateStreamAttributes",e.UPDATESTREAMATTRIBUTES="updateStreamAttributes",e.CALL_UNPUBLISH="call-unpublish",e.UNPUBLISH="unpublish",e.CALL_SUBSCRIBE="call-subscribe",e.SUBSCRIBE="subscribe",e.CALL_UPDATESUBSCRIBE="call-updateSubscribe",e.UPDATESUBSCRIBE="updateSubscribe",e.CALL_UNSUBSCRIBE="call-unsubscribe",e.UNSUBSCRIBE="unsubscribe",e.CALL_UPDATEUSERATTRIBUTES="call-updateUserAttributes",e.UPDATEUSERATTRIBUTES="updateUserAttributes",e.CALL_LEAVEROOM="call-leaveRoom",e.LEAVEROOM="leaveRoom",e.ON_USERCONNECTION="on-userConnection",e.ON_USERDISCONNECTION="on-userDisconnection",e.ON_ONADDSTREAM="on-onAddStream",e.ON_ONPUSHSTREAM="on-onPushStream",e.ON_ONREMOVESTREAM="on-onRemoveStream",e.ON_ONPUSHTRACK="on-onPushTrack",e.ON_ONREMOVETRACK="on-onRemoveTrack",e.ON_ONUPDATEUSERATTRIBUTES="on-onUpdateUserAttributes",e.ON_ONUPDATEROOMATTRIBUTES="on-onUpdateRoomAttributes",e.ON_ONUPDATESTREAMATTRIBUTES="on-onUpdateStreamAttributes",e.ON_STREAMFAILED="on-streamFailed",e.ON_POSTPROCESSINGMESSAGE="on-postProcessingMessage",e.ON_ENGINECONTROLMESSAGE="on-engineControlMessage",e.ON_WEBSOCKETENGINECUSTOMMESSAGE="on-websocketEngineCustomMessage",e.UNKNOWN="unknown",e.CALL_UPDATEPUBLISHSTREAMCHANNEL="call-updatePublishStreamChannel",e.UPDATEPUBLISHSTREAMCHANNEL="updatePublishStreamChannel",e.CALL_UPDATESUBSCRIBESTREAMCHANNEL="call-updateSubscribeStreamChannel",e.UPDATESUBSCRIBESTREAMCHANNEL="updateSubscribeStreamChannel",e.ON_ONSTREAMCHANNELCHANGE="on-onStreamChannelChange",e.P2PDIRECT="p2pdirect",e.INTERNAL_CUSTOM="internal_custom",e.REPORT="report",e.CONNECTION_CONTROL="connection_control",e.ON_INTERNAL_CUSTOM="on_internal_custom",e.CONTROLMESSAGE="controlMessage",e.CALL_LOGIN="call-login",e.LOGIN="login",e.CALL_RECONNECTLOGIN="call-reconnectLogin",e.RECONNECTLOGIN="reconnectLogin",e.CALL_LOGOUT="call-logout",e.LOGOUT="logout",e.CALL_UPDATELOGINTOKEN="call-updateLoginToken",e.UPDATELOGINTOKEN="updateLoginToken",e.CALL_SETSERVERPARAMS="call-setServerParams",e.SETSERVERPARAMS="setServerParams",e.CALL_GETPEERONLINESTATUS="call-getPeerOnlineStatus",e.GETPEERONLINESTATUS="getPeerOnlineStatus",e.ON_ONSCENECONFIG="on-onSceneConfig",e.ON_STREAMCONTROLMESSAGE="on-streamControlMessage",e.CALL_STARTPUSHSTREAM="call-startPushStream",e.STARTPUSHSTREAM="startPushStream",e.CALL_STOPPUSHSTREAM="call-stopPushStream",e.STOPPUSHSTREAM="stopPushStream",e.CALL_STARTPULLSTREAM="call-startPullStream",e.STARTPULLSTREAM="startPullStream",e.CALL_STOPPULLSTREAM="call-stopPullStream",e.STOPPULLSTREAM="stopPullStream",e.CALL_UPDATEPULLSTREAM="call-updatePullStream",e.UPDATEPULLSTREAM="updatePullStream",e.ON_ONSTREAMPUSHEDBYOTHER="on-onStreamPushedByOther",e.CALL_UPDATETOKEN="call-updateToken",e.UPDATETOKEN="updateToken",e.ON_ONTOKENWILLEXPIRE="on-onTokenWillExpire",e.ON_ONPUSHCLIENTCONFIG="on-onPushClientConfig",e.CALL_GETCLIENTCONFIG="call-getClientConfig",e.GETCLIENTCONFIG="getClientConfig"}(lF||(lF={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(hF||(hF={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(pF||(pF={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(fF||(fF={})),function(e){e.W_0="0",e.W_1="1"}(_F||(_F={})),function(e){e.UP="up",e.DOWN="down"}(vF||(vF={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(mF||(mF={})),function(e){e.UP="up",e.DOWN="down"}(yF||(yF={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(gF||(gF={})),function(e){e.W_0="0",e.W_1="1"}(SF||(SF={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown"}(EF||(EF={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(bF||(bF={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish"}(IF||(IF={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(TF||(TF={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(AF||(AF={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(RF||(RF={})),function(e){e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p"}(CF||(CF={})),function(e){e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave"}(OF||(OF={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(wF||(wF={})),function(e){e.BEGIN="begin",e.END="end"}(kF||(kF={})),function(e){e.BEGIN="begin",e.END="end"}(NF||(NF={})),function(e){e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60"}(PF||(PF={})),function(e){e.UNKNOWN="unknown",e.NEW="new",e.CHECKING="checking",e.CONNECTED="connected",e.FAILED="failed",e.SELECTED="selected",e.CLOSING="closing",e.CLOSED="closed",e.UNSELECTED="unselected"}(DF||(DF={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(MF||(MF={})),function(e){e.UNKNOWN="UNKNOWN",e.AUDIO_RECORD="AUDIO_RECORD",e.AUDIO_PLAYOUT="AUDIO_PLAYOUT",e.VIDEO="VIDEO",e.SHARE_AUDIO_RECORD="SHARE_AUDIO_RECORD",e.SHARE_VIDEO="SHARE_VIDEO"}(LF||(LF={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(UF||(UF={})),function(e){e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped"}(xF||(xF={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(VF||(VF={})),function(e){e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort"}(FF||(FF={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(BF||(BF={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(jF||(jF={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(GF||(GF={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(HF||(HF={}));var QF=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(i){t["_"+i]=e[i]})),this.monitor.StartUp()},Object.defineProperty(e.prototype,"event_key",{get:function(){return this._event_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_id",{get:function(){return this._device_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_app_id",{get:function(){return this._rtc_app_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"product_line",{get:function(){return this._product_line},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_version",{get:function(){return this._report_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"os",{get:function(){return this._os},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_version",{get:function(){return this._rtc_sdk_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_timestamp",{get:function(){return this._rtc_timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_git_commit",{get:function(){return this._rtc_sdk_git_commit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_id",{get:function(){return this._report_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connection_id",{get:function(){return this._connection_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sid",{get:function(){return this._rtc_sid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"engine_session_id",{get:function(){return this._engine_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_business_id",{get:function(){return this._rtc_business_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"project_key",{get:function(){return this._project_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"network_type",{get:function(){return this._network_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app_version",{get:function(){return this._app_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aid",{get:function(){return this._aid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_model",{get:function(){return this._device_model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_brand",{get:function(){return this._device_brand},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"common_extra_info",{get:function(){return this._common_extra_info},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"had_selected_p2p",{get:function(){return this._had_selected_p2p},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_env_type",{get:function(){return this._rtc_env_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"room_id",{get:function(){return this._room_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_id",{get:function(){return this._user_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_session_id",{get:function(){return this._rtc_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_agent",{get:function(){return this._user_agent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auto_play_policy",{get:function(){return this._auto_play_policy},enumerable:!1,configurable:!0}),e}(),ZF=function(e){function t(){var t=e.call(this)||this;return t.report_id=0,t.dataBuffer=[],t.posting=!1,t.report_common={},t.modify_ids={},t.preSucTime=0,t.errSendDelay=100,t.commonStats=new QF(t),WL()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return Z_(t,e),t.prototype.push=function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))},t.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},t.prototype.send=function(e,t){var i=this;if(e||this.dataBuffer.length){var r={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},n=new XMLHttpRequest;n.timeout=1e4,n.onreadystatechange=function(){if(4===n.readyState){e||(i.posting=!1);var o=void 0;if(200===n.status||304===n.status)try{o=JSON.parse(n.responseText)}catch(e){}o&&0===o.StatusCode?e||t||i.sucSend():e?i.send(e):(i.unshift(r.data),t?i.send():i.errSend())}};var o=jV.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!WL()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",r),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!WL()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(r));else{var a=MV.gzip(JSON.stringify(r));n.setRequestHeader("Content-Encoding","gzip"),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(a)}}},t.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},t.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},t.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,i=t.event_key,r=t.device_id,n=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,p=t.engine_session_id,f=t.rtc_business_id,_=t.project_key,v=t.network_type,m=t.app_version,y=t.aid,g=t.device_model,S=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,I=t.rtc_env_type,T=t.user_agent,A=t.auto_play_policy;Object.assign(e,{event_key:i,device_id:r,rtc_app_id:n,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:p,rtc_business_id:f,project_key:_,network_type:v,app_version:m,aid:y,device_model:g,device_brand:S,common_extra_info:E,had_selected_p2p:b,rtc_env_type:I,user_agent:T,auto_play_policy:A}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),this.commonStats.connection_id&&(this.modify_ids.connection_id=this.commonStats.connection_id)},t.prototype.rtcSdkApiCall=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});r.streamId&&(n.stream_id=r.streamId),this.push(n)},t.prototype.rtcSdkCallback=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcGetConfig=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,host:r,type:n,config_id:o,enable_cloud_proxy:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcReconnect=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:i,reconnect_type:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcReconnected=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcGetAccess=function(e,t,i,r,n,o,a){void 0===a&&(a={});var s=$_($_({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,type:r,host:n,connect_session_id:o},this.modify_ids),{common_extra_info:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcNodeChange=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignalingMsgError=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignaling=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:i,signaling_type:r,direction:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:i,elapse:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcBeginCreateOffer=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcCreateOffer=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:i,stream_user_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:i,direction:r,stream_id:n,stream_user_id:o,elapse:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcRecvAnswer=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:i,message:r,direction:n,stream_id:o,stream_user_id:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.firstRemoteAudioRender=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.firstRemoteVideoRender=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcPublishStat=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:i,message:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:i,stream_user_id:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcMediaStatistics=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcMessageStatistics=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcError=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcInvokeStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:i,stream_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var i=$_($_($_({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcMuteRemote=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.sdkInitEngine=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.joinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:i,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:i,status:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var i=$_($_({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcDeviceError=function(e,t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v){void 0===v&&(v={});var m=$_($_({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:i,system_error_code:r,system_api:n,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:p,device_vid:f,media_mode:_},this.modify_ids),{common_extra_info:JSON.stringify(v)});this.push(m)},t.prototype.rtcVideoDevice=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var i=$_($_($_({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcEncodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcFirstFrameEncoded=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcSendFirstPacket=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstPacket=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcDecodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t}(JF),$F=new ZF,eB=new ZF,tB=new ZF,iB=$F.commonStats,rB=eB.commonStats,nB=tB.commonStats,oB={default:$F,rtm:eB,outsideRoom:tB};function aB(e){void 0===e&&(e="default");for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return function(i,r,n){if("function"==typeof n.value){var o=n.value;n.value=function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var a={};t.forEach((function(e,t){a[e]=i[t]})),"joinRoom"===r&&iB.setStats({room_id:i[1]}),oB[e].rtcSdkApiCall(r,0,JSON.stringify(uU(i)),a);var s=o.apply(this,i);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return oB[e].rtcSdkCallback(r,0,JSON.stringify(uU([t||{}]))),t})).catch((function(t){throw oB[e].rtcSdkCallback(r,t.code,JSON.stringify(t.message)),t})):(oB[e].rtcSdkCallback(r,0,JSON.stringify(uU([s||{}]))),s)}}}}function sB(e,t,i){var r,n;void 0===i&&(i=0);var o=e===PD.onUserMessageReceivedOutsideRoom||e===PD.onUserBinaryMessageReceivedOutsideRoom;Array.isArray(t)&&(null===(r=t[0])||void 0===r?void 0:r.userId)&&(e="".concat(e,"_").concat(null===(n=t[0])||void 0===n?void 0:n.userId)),(o?eB:$F).rtcSdkCallback(e,i,JSON.stringify(t))}function cB(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=!1),(r?eB:$F).rtcInvokeStatus(JSON.stringify(t),i,e,"",0)}var uB=i(Object.freeze({__proto__:null,Monitor:ZF,monitor:$F,reportRtcSdkApiCall:aB,reportRtcSdkCallback:sB,reportRtcInvokeStatus:cB,get CommonEventKey(){return QV},get CommonProductLine(){return ZV},get CommonReportVersion(){return $V},get CommonOs(){return eF},get CommonNetworkType(){return tF},get RoominfoChannelRole(){return iF},get RtcgetconfigType(){return rF},get RtcreconnectMessage(){return nF},get RtcreconnectReconnectType(){return oF},get RtcreconnectedMessage(){return aF},get RtcreconnectedReconnectType(){return sF},get RtcgetaccessType(){return cF},get RtcpreicestateIceState(){return uF},get RtcsignalingmsgerrorReason(){return dF},get RtcsignalingSignalingEvent(){return lF},get RtcsignalingDirection(){return hF},get RtcbegincreateofferDirection(){return pF},get RtccreateofferDirection(){return fF},get RtcsetdescriptionIsLocal(){return _F},get RtcsetdescriptionDirection(){return vF},get RtcrecvanswerAnswerType(){return mF},get RtcrecvanswerDirection(){return yF},get RtcpublishstatResult(){return gF},get RtcpublishstatIsScreen(){return SF},get RtcpublishstatMessage(){return EF},get RtcsubscribestatResult(){return bF},get RtcsubscribestatMessage(){return IF},get RtcaudiodeviceAudioEvent(){return TF},get FirstframeinfoEventType(){return AF},get FirstframeinfoMediaType(){return RF},get FirstframeinfoType(){return CF},get FirstframeinfoReason(){return OF},get RtcmuteremoteMediaType(){return wF},get SdkinitengineType(){return kF},get JoinroomType(){return NF},get JoinroomReason(){return PF},get P2pconnectionstatusStatus(){return DF},get PerformanceinfoThermalState(){return MF},get RtcdeviceerrorDeviceType(){return LF},get DcusermessageDcMessageType(){return UF},get CaptureeventinfoEventType(){return xF},get CaptureeventinfoType(){return VF},get CaptureeventinfoReason(){return FF},get RtcdeviceerrorScenario(){return BF},get RtcdeviceerrorMediaMode(){return jF},get PerformanceinfoDeviceStatus(){return GF},get CommonRtcEnvType(){return HF},commonStats:iB,rtmCommonStats:rB,rtmMonitor:eB,outsideRoomMonitor:tB,outsideRoomCommonStats:nB})).monitor,dB=!1,lB=[];function hB(){var e;if(dB){var t=[].slice.call(arguments);lB.push(t)}(e=console).log.apply(e,arguments)}function pB(){var e=window.__rtc_engine__,t=e._localVideoTrack,i=e._localAudioTrack;function r(e){if(e){var t=e.getTrack(),i=t.kind,r=t.id.slice(-6);hB(i+"track("+r+").getSettings(): ",t.getSettings()),hB(i+"track("+r+").readyState: ",t.readyState),hB(i+"track("+r+").muted: ",t.muted),hB(i+"track("+r+").enabled: ",t.enabled)}}hB("engine._localVideoTrack: ",e._localVideoTrack),hB("engine._localAudioTrack: ",e._localAudioTrack),r(t),r(i)}function fB(){var e=setInterval((function(){__rtc_engine__._room._mediaServerClient._handler.pc.getStats().then((function(e){var t={};e.forEach((function(i){if("track"===i.type){var r=i.trackIdentifier;__rtc_engine__._room._remoteStreams.forEach((function(n){n.forEach((function(n,o){var a,s;n&&n.videoTrack&&n.videoTrack._mediaTrack&&(n.videoTrack.getTrack().id===r&&(e.forEach((function(e){"inbound-rtp"===e.type&&i.id===e.trackId&&(a=e)})),t[n.userId+"(video-".concat(o,")")]={userId:n.userId+"(video-".concat(o,")"),track:i,inboundRTP:a}));n&&n.audioTrack&&n.audioTrack._mediaTrack&&(n.audioTrack.getTrack().id===r&&(e.forEach((function(e){"inbound-rtp"===e.type&&i.id===e.trackId&&(s=e)})),t[n.userId+"(audio-".concat(o,")")]={userId:n.userId+"(audio-".concat(o,")"),track:i,inboundRTP:s}))}))}));try{if(!__rtc_engine__._room._localStream.videoTrack)return;if(__rtc_engine__._room._localStream.videoTrack.getTrack().id===r){var n;e.forEach((function(e){"outbound-rtp"===e.type&&i.id===e.trackId&&(n=e)}));var o=__rtc_engine__._room._roomInfo.userInfo.userId+" (localVideo)";t[o]={userId:o,track:i,outboundRTP:n}}}catch(e){hB(e)}try{if(!__rtc_engine__._room._localStream.audioTrack)return;if(__rtc_engine__._room._localStream.audioTrack.getTrack().id===r){var a;e.forEach((function(e){"outbound-rtp"===e.type&&i.id===e.trackId&&(a=e)}));var s=__rtc_engine__._room._roomInfo.userInfo.userId+" (localAudio)";t[s]={userId:s,track:i,outboundRTP:a}}}catch(e){hB(e)}}})),hB(t)}))}),1e3);setTimeout((function(){clearInterval(e)}),2e3)}function _B(){return(_B=uI(yI.mark((function e(){var t;return yI.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=window.__rtc_engine__,e.next=3,t.stopVideoCapture();case 3:return e.next=5,t.startVideoCapture();case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vB(){return(vB=uI(yI.mark((function e(){var t;return yI.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=window.__rtc_engine__,e.next=3,t.stopAudioCapture();case 3:return e.next=5,t.startAudioCapture();case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mB(){return(mB=uI(yI.mark((function e(t){var i;return yI.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=window.__rtc_engine__,e.next=3,i.unsubscribeStream(t,3);case 3:return e.next=5,i.subscribeStream(t,3);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yB(){for(var e=window.__rtc_engine__,t=0;t<5;t++)setTimeout((function(){e._room._remoteStreams.forEach((function(e){e.forEach((function(e,t){e&&e.audioTrack&&hB(e.userId+" volume:"+e.audioTrack.getAudioLevel())}))})),hB("local volume: ",e._localAudioTrack.getAudioLevel())}),200*t)}function gB(){var e=window.__rtc_engine__._remoteVideoPlayer;hB("videoplayers: ",e.size,Array.from(e.keys())),e&&e.size>=1&&e.forEach((function(e,t){var i=e._videoDom;hB("videoplayer("+t+(e.isScreen?"_screen":"")+").readyState: ",i.readyState),hB("videoplayer("+t+(e.isScreen?"_screen":"")+").currentTime: ",10*Math.floor(i.currentTime/10)),hB("videoplayer("+t+(e.isScreen?"_screen":"")+").paused: ",i.paused),hB("videoplayer("+t+(e.isScreen?"_screen":"")+").srcObject.id: ",i.srcObject.id),hB("videoplayer("+t+(e.isScreen?"_screen":"")+").srcObject.active: ",i.srcObject.active)}))}function SB(){var e=window.__rtc_engine__._remoteAudioPlayer;e&&e.size>=1&&e.forEach((function(e,t){var i=e._audioDom;hB("audioplayer("+t+").readyState: ",i.readyState),hB("audioplayer("+t+").currentTime: ",i.currentTime),hB("audioplayer("+t+").paused: ",i.paused),hB("audioplayer("+t+").srcObject.id: ",i.srcObject.id),hB("audioplayer("+t+").srcObject.active: ",i.srcObject.active)}))}function EB(e){if(!e)return!1;var t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.backgroundColor="rgba(0, 0, 0, 0.2)",t.style.color="wheat",t.style.zIndex="9999999",t.style.pointerEvents="none",document.body.insertBefore(t,document.body.firstChild),window.counter=0,window.panel=t;try{var i=localStorage.getItem("ve_crash_log"),r=URL.createObjectURL(new Blob([i])),n=document.createElement("a");n.download="ve_crash_log.log",n.href=r,n.click(),localStorage.removeItem("ve_crash_log")}catch(e){}function o(e){var t=localStorage.getItem("ve_crash_log");localStorage.setItem("ve_crash_log",t+"\r\n"+e)}window._ve_sdk_cb=function(){var e,t=Array.prototype.slice.call(arguments);try{e=JSON.stringify(t)}catch(t){e="JSON.stringify failed"}e.length>1e3&&(e=e.slice(0,1e3)+"... <too large to show>"),e="seq".concat(window.counter++," - ").concat(e);var i=document.createElement("div");i.style.whiteSpace="nowrap",i.innerHTML=e,panel.childNodes.length>20&&panel.removeChild(panel.childNodes[0]),window.panel.append(i);try{o(e)}catch(e){}}}window.location.search.includes("adp")?EB(!0):EB(!1);var bB=function(){var e=new Date;return e.toDateString().replaceAll(" ","_")+"-"+e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()};window.rvc=function(){return _B.apply(this,arguments)},window.rac=function(){return vB.apply(this,arguments)},window.rs=function(e){return mB.apply(this,arguments)},window.wrv=gB,window.wra=SB,window.wlt=pB,window.ws=function(){var e=window.__rtc_engine__;if(e._room){var t=[];try{t=e._room._mediaServerClient.handler.pc.getSenders()}catch(e){t=[]}hB("senders: ",t.length,";empty senders: ",t.filter((function(e){return!!e.track})).length),t.forEach((function(e,t){var i=e.track,r=Object.assign({},e.getParameters());(r.transactionId&&delete r.transactionId,i)?hB(i.kind+"sender("+i.id.slice(-6)+").getParameters(): ",r):hB("emptysender("+t+").getParameters(): ",r)}))}},window.ss5=fB,window.gv5=yB,window.ap=EB,window.dv=function(e,t,i,r){var n=[],o=null,a=!1,s=__rtc_engine__._room.roomInfo.userInfo.userId,c=function(r,s){if(e===r){if("key"===s.type&&(a=!0,o||(hB(" ============ start dump ============="),o=setTimeout(u,1e3*(t||7)))),i&&!a)return;hB("dump video: ",s),n.push(new Uint8Array(s.data))}},u=function(){__rtc_engine__._room._remoteStreams.get(e)[0].off("onTransformData",c);var t=n.reduce((function(e,t){return e+t.byteLength}),0);hB("byteLength: ",t);var i=n.reduce((function(e,t){return e.data.set(t,e.offset),e.offset+=t.byteLength,e}),{data:new Uint8Array(t),offset:0}),o=i.data.reduce((function(e,t){return e+String.fromCharCode(t)}),""),a=window.btoa(o);console.log("base64str:",a),uB.rtcInvokeStatus(a,0,"dumpVideo_".concat(s,"_sub_").concat(e,"_").concat(bB()),"",0);var u=URL.createObjectURL(new Blob([i.data])),d=document.createElement("a");d.download="dumpVideo_".concat(s,"_sub_").concat(e,"_").concat(bB(),".").concat(r||"h264"),d.href=u,d.click()};__rtc_engine__._room._remoteStreams.get(e)[0].on("onTransformData",c),i||(o=setTimeout(u,1e3*(t||7)))},window.cs=function(){dB=!0,setTimeout((function(){console.log(lB);var e=[],t=JSON.stringify(lB,(function(t,i){if("object"===vs(i)&&null!==i){if(-1!==e.indexOf(i))return;e.push(i)}return i}));e=null,console.log(t.length),uB.rtcInvokeStatus(t,0,"console.monitor","",0),lB=[]}),1e4);try{gB()}catch(e){}try{SB()}catch(e){}try{pB()}catch(e){}try{fB()}catch(e){}try{yB()}catch(e){}},Rm("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Fm);var IB=jr,TB=T,AB=me,RB=De,CB=Zi,OB=Go,wB=a,kB=fT,NB=Un,PB=KP,DB=WP,MB=te,LB=qP,UB=[],xB=TB(UB.sort),VB=TB(UB.push),FB=wB((function(){UB.sort(void 0)})),BB=wB((function(){UB.sort(null)})),jB=NB("sort"),GB=!wB((function(){if(MB)return MB<70;if(!(PB&&PB>3)){if(DB)return!0;if(LB)return LB<603;var e,t,i,r,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(r=0;r<47;r++)UB.push({k:t+r,v:i})}for(UB.sort((function(e,t){return t.v-e.v})),r=0;r<UB.length;r++)t=UB[r].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));IB({target:"Array",proto:!0,forced:FB||!BB||!jB||!GB},{sort:function(e){void 0!==e&&AB(e);var t=RB(this);if(GB)return void 0===e?xB(t):xB(t,e);var i,r,n=[],o=CB(t);for(r=0;r<o;r++)r in t&&VB(n,t[r]);for(kB(n,function(e){return function(t,i){return void 0===i?-1:void 0===t?1:void 0!==e?+e(t,i)||0:OB(t)>OB(i)?1:-1}}(e)),i=n.length,r=0;r<i;)t[r]=n[r++];for(;r<o;)delete t[r++];return t}});var HB,zB,KB=jr,WB=Mn.findIndex,XB=ko,qB=!0;"findIndex"in[]&&Array(1).findIndex((function(){qB=!1})),KB({target:"Array",proto:!0,forced:qB},{findIndex:function(e){return WB(this,e,arguments.length>1?arguments[1]:void 0)}}),XB("findIndex"),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED",e.PUBLIC_STREAM_DECODE_FAILED="PUBLIC_STREAM_DECODE_FAILED"}(HB||(HB={})),function(e){e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK"}(zB||(zB={}));var YB=function(e,t,i){this.code=e,this.message=t,this.error=i};function JB(e,t){if("boolean"!=typeof e)throw new YB(HB.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function QB(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),e<i||e>r||"number"!=typeof e)throw new YB(HB.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(i,", ").concat(r,"]. integer only"))}function ZB(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),null==e)throw new YB(HB.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,i){void 0===t&&(t=1);void 0===i&&(i=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=i&&e.length>=t}(e,i,r))throw new YB(HB.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(i,",").concat(r,"]"))}function $B(e,t,i){if(!i.includes(e))throw new YB(HB.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(i)))}function ej(e,t){if(ij(e))throw new YB(HB.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function tj(e,t){if(!(e instanceof ArrayBuffer))throw new YB(HB.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function ij(e){return null==e}function rj(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new YB(HB.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function nj(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new YB(HB.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function oj(e){ej(e,"videoPlayerOption")}function aj(e,t){var i,r;if(void 0===t&&(t=64),!e||0===(null===(i=e)||void 0===i?void 0:i.byteLength))throw new YB(HB.INVALID_PARAMS,"The message cannot be empty");if((null==(r=e instanceof ArrayBuffer?e:XL.str2ab(JSON.stringify(e)))?void 0:r.byteLength)>1e3*t)throw new YB(HB.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function sj(e){return![PD.onRemoteStreamStats,PD.onLocalStreamStats,PD.onAudioVolumeIndication,PD.onLocalAudioPropertiesReport,PD.onRemoteAudioPropertiesReport].includes(e)}var cj=Ue,uj=function(e){return void 0!==e&&(cj(e,"value")||cj(e,"writable"))},dj=l,lj=G,hj=Pt,pj=uj,fj=o,_j=Zp;jr({target:"Reflect",stat:!0},{get:function e(t,i){var r,n,o=arguments.length<3?t:arguments[2];return hj(t)===o?t[i]:(r=fj.f(t,i))?pj(r)?r.value:void 0===r.get?void 0:dj(r.get,o):lj(n=_j(t))?e(n,i,o):void 0}});var vj=jr,mj=l,yj=Pt,gj=G,Sj=uj,Ej=Rt,bj=o,Ij=Zp,Tj=y;var Aj,Rj,Cj,Oj,wj,kj,Nj,Pj,Dj,Mj,Lj,Uj=a((function(){var e=function(){},t=Ej.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));vj({target:"Reflect",stat:!0,forced:Uj},{set:function e(t,i,r){var n,o,a,s=arguments.length<4?t:arguments[3],c=bj.f(yj(t),i);if(!c){if(gj(o=Ij(t)))return e(o,i,r,s);c=Tj(0)}if(Sj(c)){if(!1===c.writable||!gj(s))return!1;if(n=bj.f(s,i)){if(n.get||n.set||!1===n.writable)return!1;n.value=r,Ej.f(s,i,n)}else Ej.f(s,i,Tj(0,r))}else{if(void 0===(a=c.set))return!1;mj(a,s,r)}return!0}}),function(e){e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted"}(Aj||(Aj={})),function(e){e.PushLimitWarn="PushLimitWarn"}(Rj||(Rj={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig",e.ON_STREAM_FAILED="streamFailed"}(Cj||(Cj={})),function(e){e.RSCP="RSCP"}(Oj||(Oj={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(wj||(wj={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(kj||(kj={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(Nj||(Nj={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(Dj||(Dj={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(Mj||(Mj={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.EXCEED_MAX_LENGTH=103]="EXCEED_MAX_LENGTH",e[e.EMPTY_USER=104]="EMPTY_USER",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN"}(Lj||(Lj={}));var xj,Vj,Fj=((Pj={})[Lj.SUCCESS]=[0,"success"],Pj[Lj.TIMEOUT]=[HB.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],Pj[Lj.BROKEN]=[HB.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],Pj[Lj.NO_RECEIVER]=[HB.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],Pj[Lj.NO_RELAYPATH]=[HB.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],Pj[Lj.SEND_TO_SERVER_ERROR]=[HB.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],Pj[Lj.SERVER_RESPONSE_ERROR]=[HB.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],Pj[Lj.NOT_JOIN]=[HB.USER_MESSAGE_NOT_JOIN,"not join room"],Pj[Lj.INIT]=[HB.USER_MESSAGE_INIT,"not init."],Pj[Lj.NO_CONNECTION]=[HB.USER_MESSAGE_NO_CONNECTION,"no connection."],Pj[Lj.EXCEED_MAX_LENGTH]=[HB.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],Pj[Lj.EMPTY_USER]=[HB.USER_MESSAGE_EMPTY_USER,"user id is empty."],Pj[Lj.NOT_LOGIN]=[HB.USER_MESSAGE_NOT_LOGIN,"not login."],Pj[Lj.SERVER_PARAMS_NOTSET]=[HB.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],Pj[Lj.UNKNOWN]=[HB.USER_MESSAGE_UNKNOWN,"unknown."],Pj),Bj=new XF("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(xj||(xj={})),function(e){e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM"}(Vj||(Vj={}));var jj=function(e){function t(t){var i=e.call(this)||this;return i._dataChannel=t,i._singlingCache=new Map,i._p2pCache=new Map,i._rttIds={},i._p2pMessageId=0,i._clearDataChannelListener=i._handleHandler(),window.__rtc_mock_signaling__=i.emit.bind(i),i}return Z_(t,e),t.prototype.destroy=function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}},t.prototype.sendSignaling=function(e,t,i){var r=this;return $F.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",hF.UP),new Promise((function(n,o){var a=r._genHeader(i);a.id=aU();var s=a.id.join("-"),c=setTimeout((function(){r._singlingCache.delete(s),o(new YB(HB.TIME_OUT,"".concat(e," message time out")))}),6e4);r._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),n(e)},error:function(e){clearTimeout(c),o(e)}}),Bj.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),r._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:Vj.C2GW})},t.prototype.sendP2PMessage=function(e,t){var i=e.msg,r=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i}(e,["msg"]);return tv(this,void 0,void 0,(function(){var e,n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:return e=i instanceof ArrayBuffer,n=this._sendP2PMessage,o=[$_({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:Dj.SEND,type:Mj.P2P,err:Lj.SUCCESS},r)],s={binary:e},e?[4,XL.ab2b64str(i)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=i,c.label=3;case 3:return[2,n.apply(this,[$_.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var i=this;return void 0===t&&(t={}),cU(e.msg)?this._rttIds[e.id]=e.id:e.dir===Dj.SEND&&Bj.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(r,n){var o=i._genHeader($_($_({needAck:!0,functionType:Vj.C2C},t),{id:aU()}));if(e.dir===Dj.SEND){var a=setTimeout((function(){i._p2pCache.delete(e.id),n(new YB(HB.TIME_OUT,"P2P message timeout"))}),6e4);i._p2pCache.set(e.id,{success:function(e,t){clearTimeout(a),r(t)},error:function(e){clearTimeout(a);var t=nv(Fj[e.err]||[HB.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),i=t[0],r=t[1];n({code:i,message:e.msg||r})}})}i._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,i){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new YB(HB.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var r=t.version+(+t.zip<<5)+(+t.encrypt<<6),n=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=XL.str2ab(JSON.stringify([e,i])),a=KL(Uint8Array,ov([r,n],nv(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),i=0,r=t[i++],n=t[i++],o={version:15&r,zip:16==(16&r),encrypt:32==(32&r),needAck:1==(1&n),direction:(2&n)>>1,functionType:(60&n)>>2,binary:64==(64&n)};if(o.needAck||o.direction===xj.ACK){for(;i<=6;i++)if(128!=(128&t[i])){i++;break}o.id=Array.from(t.slice(2,i))}return{header:o,data:t.slice(i)}},t.prototype._feedbackSignaling=function(e,t){var i=this._genHeader({needAck:!0,direction:xj.ACK,id:e.split("-").map((function(e){return+e}))});Bj.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),i,"")},t.prototype._handleMessage=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L,U,x;return iv(this,(function(V){switch(V.label){case 0:r=this._dispartData(e),n=r.header,o=r.data,n.zip&&((a=new MV.Inflate).push(o,!0),o=a.result),s=XL.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&$F.rtcSignalingMsgError(-1,e.message,dF.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case Vj.C2S:return[3,1];case Vj.C2C:return[3,6];case Vj.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==xj.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],Bj.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,XL.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=V.sent(),V.label=4;case 4:this.emit(d,$_({},c)),$F.rtcSignaling(0,s,"on-".concat(d),"Recv",hF.DOWN),V.label=5;case 5:return[3,19];case 6:switch(Array.isArray(c)&&(c=c[1]),h=null==c?void 0:c.id,this._rttIds[h]||(null==c?void 0:c.dir)===Dj.FEEDBACK||cU(null==c?void 0:c.msg)?delete this._rttIds[h]:Bj.print("Signal","<<<<<< p2p response",c),c.dir){case Dj.SEND:return[3,7];case Dj.FEEDBACK:return[3,16]}return[3,17];case 7:return cU(null==c?void 0:c.msg)?[3,15]:(f=(p=c).binary,_=p.msg,v=p.room,m=p.to,y=p.from,g=""===v?f?Cj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:Cj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:f?Cj.USER_BINARY_MESSAGE_RECEIVED:Cj.USER_MESSAGE_RECEIVED,m?[3,11]:(S=this.emit,E=[Cj.ON_CUSTOM_MESSAGE],U={clientId:y,binary:f},f?[4,XL.b64str2ab(_)]:[3,9]));case 8:return b=V.sent(),[3,10];case 9:b=_,V.label=10;case 10:return S.apply(this,E.concat([(U.message=b,U)])),[3,15];case 11:return I=this.emit,T=[g],A=[$_({},c)],x={},f?[4,XL.b64str2ab(_)]:[3,13];case 12:return R=V.sent(),[3,14];case 13:R=_,V.label=14;case 14:I.apply(this,T.concat([$_.apply(void 0,A.concat([(x.msg=R,x)]))])),V.label=15;case 15:return this._sendP2PMessage($_($_({},c),{dir:Dj.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===Lj.SUCCESS?C.success(c.id,c):C.error(c)),[3,17];case 17:return[3,19];case 18:if(n.direction===xj.ACK)O=(null===(i=n.id)||void 0===i?void 0:i.join("-"))||"",this._handleAckMessage(O,c[0]||{},s);else if(w=nv(c,2),k=w[0],N=w[1],P=void 0===N?{}:N,"RXMediaMsg"===k&&(D=P.type,M=P.data,$F.rtcSignaling(0,s,"on-".concat(D),"Recv",hF.DOWN),"RSCP"===D))try{L=JSON.parse(M),Array.isArray(L)&&this.emit(D,L)}catch(e){}V.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){Bj.print("_handleHandler","dataChannel close",t),e.emit("close",t)},i=function(t){Bj.print("_handleHandler","dataChannel error",t),e.emit("close",t)},r=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",i),this._dataChannel.addEventListener("message",r),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",i),e._dataChannel.removeEventListener("message",r)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),$_({version:2,zip:!1,encrypt:!1,needAck:!0,direction:xj.SEND,functionType:Vj.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,i){var r=this._singlingCache.get(e);r&&(this._singlingCache.delete(e),200===t.code?r.success(t):r.error(t),Bj.print("Signal","<<<<<< [".concat(r.signalingType,"-ack]"),t)),$F.rtcSignaling(0,i,null==r?void 0:r.signalingType,"Ack",hF.DOWN)},t}(JV.exports.EventEmitter),Gj=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,i=e.method,r=e.url,n=e.body,o=void 0===n?{}:n,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,n){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(i,r,!0);try{for(var l=rv(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=nv(h.value,2),f=p[0],_=p[1];d.setRequestHeader(f,_)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(a)throw a.error}}d.onreadystatechange=function(){4===d.readyState&&(t.isSending=!1,200===d.status?e(JSON.parse(d.responseText)):n({message:d.statusText,code:d.status})),0===d.status&&n({code:0,message:"Request abort"})},d.onerror=function(e){t.isSending=!1,n({code:-1,message:d.responseText||"unknown"})},t.timeout&&(d.timeout=t.timeout),u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,i,r){return this.ajax({method:"POST",url:e,body:t,headers:i,stringify:r})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),Hj=new XF("ICE Request",3),zj=function(){function e(){this._request=new Gj}return e.prototype.getAccessNode=function(e,t,i,r,n,o,a){return tv(this,void 0,void 0,(function(){var s;return iv(this,(function(c){return(s=xV.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,i,r,n,o,a),cB("es.R.node.cache",s),Array.isArray(s)?[2,Promise.resolve(s)]:[2,Promise.resolve([s])]):[2,this.getAccessNodeFromServer(e,t,i,r,n,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,i,r,n,o,a){return tv(this,void 0,void 0,(function(){var s,c,u=this;return iv(this,(function(d){return s=xV.getAccessUrls(),c=!0,cB("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=jV.ICE_CONFIG_REQUEST_URLS,c=!1,cB("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=jV.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,cB("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,i,r,n,o,a).then((function(t){var i=t.nodes;return xV.setAccessNode(e,i,t.ttl||11200),t.dispatchDomains&&xV.setAccessUrls(t.dispatchDomains),i})).catch((function(s){if(c)return cB("es.R.req.fallback",""),xV.clearAccessUrls(),u.getAccessNodeFromServer(e,t,i,r,n,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,i,r,n,o,a,s){var c;return tv(this,void 0,void 0,(function(){var i,u,d,l=this;return iv(this,(function(h){return i={appID:t,userID:r,deviceID:n,connectSessionID:HL(),os:"web",sdkVersion:jV.VERSION,isOversea:jV.OVERSEA,expectedAddr:HV("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s,accessParams:JSON.stringify({requireICEUfragV2:!0})},o&&a&&(i.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NODE_CHANGED",reason:o}}],delete i.expectedAddr),u=Date.now(),$F.rtcGetAccess(0,JSON.stringify(i),0,cF.REQUEST,e.join(","),i.connectSessionID),d=e.map((function(e,t){return tv(l,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,i)];case 1:return r=a.sent(),[3,3];case 2:throw n=a.sent(),new YB(HB.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==r.code)throw new YB(HB.ICE_SERVER_WRONG,"get ICE config failed",{server_code:r.code,message:JSON.stringify(r)});if(!(o=r.nodes[0]))throw new YB(HB.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:r.code,message:JSON.stringify(r)});return[2,{result:r,firstNode:o,index:t}]}}))}))})),[2,lU(d).then((function(t){var r=t.result;t.firstNode;var n=t.index;return $F.rtcGetAccess(200,JSON.stringify(r),Date.now()-u,cF.RESPONSE,e[n],i.connectSessionID),r})).catch((function(t){var r,n,o=null===(r=t[0])||void 0===r?void 0:r.error;throw $F.rtcGetAccess(+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),null===(n=t[0])||void 0===n?void 0:n.message,Date.now()-u,cF.RESPONSE,e.join(","),i.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(Hj.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),Kj=function(){function e(){this._request=new Gj}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.45.0-blw.14",deviceType:"web"};this._request.timeout=800;var i=jV.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));$F.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),rF.REQUEST,"",!1);var r=i.map((function(i,r){return tv(e,void 0,void 0,(function(){var e;return iv(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new YB(HB.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new YB(HB.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){lU(r).then((function(t){var r=t.result,n=t.index;xV.setH264BlackList(r.web_h264_black_list),$F.rtcGetConfig(200,JSON.stringify(r),0,i[n],rF.RESPONSE,"",!1),e(r.web_h264_black_list)})).catch((function(t){$F.rtcGetConfig(500,t.message,0,"",rF.RESPONSE,"",!1),e(xV.getH264BlackList()||[])}))}))},e.prototype.getAudioProfile=function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.45.0-blw.14",deviceType:"web"},i=jV.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));$F.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),rF.REQUEST,"",!1);var r=i.map((function(i,r){return tv(e,void 0,void 0,(function(){var e;return iv(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new YB(HB.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.engine_BAC))throw new YB(HB.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){lU(r).then((function(t){var r=t.result,n=t.index;xV.setAudioProfile(r.engine_BAC),$F.rtcGetConfig(200,JSON.stringify(r),0,i[n],rF.RESPONSE,"",!1),e(r.engine_BAC)})).catch((function(t){$F.rtcGetConfig(500,t.message,0,"",rF.RESPONSE,"",!1),e(xV.getAudioProfile()||[])}))}))},e.prototype.getWebRtcConfig=function(e){var t=this,i=e.appId,r=e.deviceId,n={keys:["web_rtc_config"],labelSelector:"",sdkVersion:"4.45.0-blw.14",deviceType:"web",appId:i,deviceId:r,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0},o=jV.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));$F.rtcGetConfig(0,JSON.stringify(n),0,o.join(","),rF.REQUEST,"",!1);var a=o.map((function(e,i){return tv(t,void 0,void 0,(function(){var t;return iv(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._request.post(e,n)];case 1:return t=r.sent(),[3,3];case 2:throw r.sent(),new YB(HB.ICE_SERVER_WRONG,"get config failed");case 3:return[2,{result:t,index:i}]}}))}))}));return new Promise((function(e){lU(a).then((function(t){var r=t.result,n=t.index;xV.setServerConfig(i,r),$F.rtcGetConfig(200,JSON.stringify(r),0,o[n],rF.RESPONSE,"",!1),e(r.web_rtc_config)})).catch((function(t){$F.rtcGetConfig(500,t.message,0,"",rF.RESPONSE,"",!1),e(xV.getServerConfig(i).web_rtc_config||{})}))}))},e}();function Wj(e,t){var i=1,r=e;(e.width>t.width||e.height>t.height)&&(i=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,r={width:Math.floor(e.width/i),height:Math.floor(e.height/i)});return $_($_({},r),{scaleResolutionDownBy:i})}var Xj=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],qj=[{width:1920,height:1080,maxLayers:3,totalPixels:2073600},{width:1280,height:720,maxLayers:3,totalPixels:921600},{width:960,height:540,maxLayers:3,totalPixels:518400},{width:640,height:360,maxLayers:2,totalPixels:230400},{width:480,height:270,maxLayers:2,totalPixels:129600},{width:320,height:180,maxLayers:1,totalPixels:57600},{width:0,height:0,maxLayers:1,totalPixels:0}];var Yj={width:160,height:90,frameRate:15,maxkbps:100},Jj={width:480,height:270,frameRate:15,maxkbps:400};function Qj(e){if(!e.length)return[];var t=e.shift(),i=t.width/t.height,r=0,n=0,o=$_($_({},t),{video_index:n,sub_index:r++});delete o.rid;for(var a=[o],s=0,c=0;c<Xj.length;c++)if(Xj[c].height<t.height){s=c;break}var u=e.shift();for(c=s;c<Xj.length;c++){var d=Xj[c];if(u&&d.height<=(null==u?void 0:u.height)){var l=d.height===(null==u?void 0:u.height),h=$_($_({},u),{video_index:++n,sub_index:r++});if(delete h.rid,a.push(h),u=e.shift(),l)continue}a.push($_($_({},d),{width:Math.floor(d.height*i),video_index:n,sub_index:r++}))}return a}var Zj,$j,eG,tG,iG=new Map,rG=function(e){return tv(void 0,void 0,void 0,(function(){return iv(this,(function(t){return[2,new Promise((function(t,i){if("chrome-stable"===qL()&&void 0===window.InstallTrigger)try{e.getStats((function(e){var i=[];e.result().forEach((function(e){if(!uG.includes(e.type)){var t={};e.names().forEach((function(i){t[i]=e.stat(i)})),i.push($_($_({},t),{id:e.id,type:e.type,timestamp:e.timestamp}))}})),t({all:i,getTrackStats:function(e){return i.filter((function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})}))}catch(e){i(e)}else t({all:[],getTrackStats:function(){return[]}})}))]}))}))},nG=function(e){return tv(void 0,void 0,void 0,(function(){var t,i,r,n,o,a;return iv(this,(function(s){switch(s.label){case 0:return[4,e.getStats()];case 1:return t=s.sent(),i={all:[]},r=new Map,t.forEach((function(e){var t=r.get(e.type)||new Map;t.set(e.id,e),r.set(e.type,t),i.all.push(e)})),n=function(e,t){e.forEach((function(e){var i,n,o,a,s,c,u,d,l,h,p=e.codecId,f=e.transportId,_=e.trackId,v=e.playoutId;if(null===(i=r.get(Zj.codec))||void 0===i||i.forEach((function(e){e.id===p&&t.add(e)})),null===(n=r.get(Zj.transport))||void 0===n||n.forEach((function(e){e.id===f&&(l=e,t.add(e))})),null===(o=r.get(Zj.track))||void 0===o||o.forEach((function(e){e.id===_&&t.add(e)})),null===(a=r.get(Zj.mediaPlayout))||void 0===a||a.forEach((function(e){e.id===v&&t.add(e)})),l){var m=l.localCertificateId,y=l.remoteCertificateId,g=l.selectedCandidatePairId;null===(s=r.get(Zj.certificate))||void 0===s||s.forEach((function(e){(e.id===m||e.id===y)&&t.add(e)})),null===(c=r.get(Zj.candidatePair))||void 0===c||c.forEach((function(e){e.id===g&&(h=e,t.add(e))}))}if(h){var S=h.localCandidateId,E=h.remoteCandidateId;null===(u=r.get(Zj.localCandidate))||void 0===u||u.forEach((function(e){e.id===S&&t.add(e)})),null===(d=r.get(Zj.remoteCandidate))||void 0===d||d.forEach((function(e){e.id===E&&t.add(e)}))}}))},null===(o=r.get(Zj.mediaSource))||void 0===o||o.forEach((function(e){var t,o=new Set;o.add(e);var a=[];null===(t=r.get(Zj.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(o.add(t),a.push(t),null===(i=r.get(Zj.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&o.add(e)})))})),n(a,o),i[e.trackIdentifier]=Array.from(o)})),null===(a=r.get(Zj.inboundRtp))||void 0===a||a.forEach((function(e){var t,o,a=new Set;a.add(e),null===(t=r.get(Zj.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&a.add(t)})),n([e],a);var s=e.trackIdentifier;s||null===(o=r.get(Zj.track))||void 0===o||o.forEach((function(t){t.id===e.trackId&&(s=t.trackIdentifier)})),i[s]=Array.from(a)})),[2,i]}}))}))},oG=function(e,t,i){return tv(void 0,void 0,void 0,(function(){var r,n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:return r=null==t?void 0:t.id,e instanceof RTCPeerConnection?((!(n=iG.get(e))||Date.now()-n.timestamp>100)&&(n={timestamp:Date.now(),statsPromise:nG(e),extraStatsPromise:yU?rG(e):Promise.resolve(void 0)},iG.set(e,n)),[4,n.statsPromise]):[2,[]];case 1:return o=c.sent(),a=(r?o[r]:o.all)||[],i||!yU?[3,3]:[4,n.extraStatsPromise];case 2:(s=c.sent())&&(a=a.concat((r?s.getTrackStats(r):s.all)||[])),c.label=3;case 3:return[2,a]}}))}))};qL(),function(e){e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server",e.mediaPlayout="media-playout"}(Zj||(Zj={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}($j||($j={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(eG||(eG={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(tG||(tG={}));var aG,sG,cG,uG=["codec","inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","media-source","csrc","peer-connection","data-channel","stream","track","transceiver","sender","receiver","transport","sctp-transport","candidate-pair","local-candidate","remote-candidate","certificate","ice-server"];!function(e){e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX"}(aG||(aG={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(sG||(sG={})),function(e){e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED"}(cG||(cG={}));var dG,lG=function(){return tv(void 0,void 0,void 0,(function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p;return iv(this,(function(f){switch(f.label){case 0:if(dG)return[2,dG];e=[],f.label=1;case 1:return f.trys.push([1,5,,6]),[4,dU()];case 2:if(!(t=f.sent()))return[2,e];i=t.split("\n"),r=!1;try{for(n=rv(i),o=n.next();!o.done;o=n.next())if((a=o.value).includes("level-asymmetry-allowed=1")&&a.includes("packetization-mode=1")&&a.includes("profile-level-id=42e0")){r=!0;break}}catch(e){h={error:e}}finally{try{o&&!o.done&&(p=n.return)&&p.call(n)}finally{if(h)throw h.error}}return r?(s=navigator.userAgent.toLowerCase(),c=!1,u=["mqqbrowser","miuibrowser"],[4,(new Kj).getH264BlackList()]):[3,4];case 3:for(d=f.sent(),u.push.apply(u,ov([],nv(d),!1)),l=0;l<u.length;l++)s.includes(u[l])&&(c=!0);!c&&e.push("H264"),f.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),dG=e,[2,e];case 5:return f.sent(),[2,e];case 6:return[2]}}))}))},hG=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},pG=new XF("BasicHandler",3),fG={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!hG()||void 0};function _G(e){return Math.ceil(e)}var vG=function(e){function t(t,i){var r=e.call(this)||this;return r._offerIce={},r._answerIce={},r._initSctpEvents=!1,r.monitor=t,r._peerConnection=new RTCPeerConnection(fG),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=i,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,i;pG.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){pG.print("constructor","onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ").concat(r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var e=r._peerConnection.iceConnectionState;t.rtcPreIceState(e,uF["".concat(e.toUpperCase())])},r}return Z_(t,e),t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){pG.print("destroy"),this.disconnect(),this._context=void 0},t.prototype._simulcast=function(e,t,i,r,n){var o=[];1===e.videoEncodeConfig.length?(o=function(e,t){var i=[];if(t<=1)return i;var r=1,n=1;return e.width/e.height>16/9?(r=e.width/Yj.width,n=e.width/Jj.width):(r=e.height/Yj.height,n=e.height/Jj.height),i.push({maxkbps:Yj.maxkbps,scaleResolutionDownBy:r,frameRate:Yj.frameRate,width:Math.floor(e.width/r),height:Math.floor(e.height/r)}),t<=2||r>2&&i.unshift({maxkbps:Jj.maxkbps,scaleResolutionDownBy:n,frameRate:Jj.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),i}(t,n),pG.print("simulcast() ","simulcastLayers: %o",o)):(o=e.videoEncodeConfig.slice(1).slice(1-n).map((function(e){return $_({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},Wj(t,e))})),pG.print("simulcast() ","simulcastLayers2: %o",o)),o.forEach((function(e,t){var n={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:_G(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};i.sendEncodings&&i.sendEncodings.unshift(n),r.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))},t.prototype.internalPublish=function(e,t){var i=e.stream,r=e.videoTrack,n=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,c={direction:"sendonly",streams:[i]},u={direction:"sendonly",streams:[i]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==r?void 0:r.getTrack(),p={width:640,height:360,frameRate:30};if(h){var f=null==h?void 0:h.getSettings();p={width:Math.floor(f.width),height:Math.floor(f.height),frameRate:Math.floor(f.frameRate)}}var _=null==e?void 0:e.videoEncodeConfig[0],v=Wj(p,_);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=p;var m={maxBitrate:1e3*_.maxKbps,scaleResolutionDownBy:_G(v.scaleResolutionDownBy),rid:"0",maxFramerate:_.frameRate||15};if(u.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:_.frameRate,maxkbps:_.maxKbps,rid:"0"}),o){var y=function(e){for(var t=0,i=e.width*e.height,r=0;r<qj.length;r++)if(i>=qj[r].totalPixels){t=r;break}if(0===t)return qj[t].maxLayers;var n=qj[t-1].totalPixels;return(n-i)/(n-qj[t].totalPixels)<.1?qj[t-1].maxLayers:qj[t].maxLayers}(v);pG.print("simulcast() ","maxLayers: %o",y),y>1&&(this._simulcast(e,p,u,d,y),(null==t?void 0:t.simulcastOnDemand)&&(l=Qj(ov([],nv(d),!1))),pG.print("subVideoDesc","desc: %o ",l))}}pG.print("publish videoTransceiverInit videoDescriptions","",u,d);var g=null==n?void 0:n.getTrack();(null==n?void 0:n.mixType)!==sG.PLAYOUT&&(null==n?void 0:n.mixedAudioTrack)&&(g=null==n?void 0:n.mixedAudioTrack),g=a&&g?g:"audio";var S=null==r?void 0:r.getTrack();S=s&&S?S:"video";try{this.monitor.rtcInvokeStatus(JSON.stringify({aTrack:vU(g),vTrack:vU(S),audioTransceiverInit:c,videoTransceiverInit:u}),0,"Handler.internalPublish","",0)}catch(e){}return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:g,vTrack:S,audioTransceiverInit:c,videoTransceiverInit:u}}},t.prototype.updateDegradationPreference=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:return pG.print("updateDegradationPreference()"),r=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),n=e.videoTransceiver,r&&e.pubVideo&&n?(o=null===(i=n.sender)||void 0===i?void 0:i.getParameters())?(r.contentHint?o.degradationPreference=r.degradationPreference?r.degradationPreference:"motion"===(s=r.contentHint)?"maintain-framerate":"detail"===s||"text"===s?"maintain-resolution":void 0:delete o.degradationPreference,[4,null==n?void 0:n.sender.setParameters(o)]):[3,2]:(pG.print("updateDegradationPreference()","no pub"),[2]);case 1:a.sent();try{this.monitor.rtcInvokeStatus(JSON.stringify(o),0,"Handler.updateDegradationPreference","",0)}catch(e){}a.label=2;case 2:return[2]}var s}))}))},t.prototype.updateMaxBitrate=function(e){var t,i,r;pG.print("updateMaxBitrate()");var n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver;if(n&&e.pubVideo&&o){var a=null===(i=o.sender)||void 0===i?void 0:i.getParameters();if(a){a.encodings=null===(r=null==a?void 0:a.encodings)||void 0===r?void 0:r.map((function(t){var i,r=+t.rid||0,n=null===(i=e.videoEncodeConfig[r])||void 0===i?void 0:i.maxKbps;return"number"==typeof n&&(t.maxBitrate=1e3*n),t})),null==o||o.sender.setParameters(a);try{this.monitor.rtcInvokeStatus(JSON.stringify(a.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(e){}}}else pG.print("updateMaxBitrate()","no pub")},t.prototype.updateScaleResolutionDownBy=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n,o,a,s,c,u,d;return iv(this,(function(l){if(pG.print("updateScaleResolutionDownBy()"),n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver,!n||!e.pubVideo||!o)return pG.print("updateScaleResolutionDownBy()","no pub"),[2];if(a=null==n?void 0:n.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(c=Wj(s,e.videoEncodeConfig[0])).scaleResolutionDownBy===e.prevScaleResolutionDownBy&&pG.print("updateScaleResolutionDownBy()","no change %o",e.prevScaleResolutionDownBy),u=null===(i=o.sender)||void 0===i?void 0:i.getParameters()){d=c.scaleResolutionDownBy/e.prevScaleResolutionDownBy,u.encodings=null===(r=null==u?void 0:u.encodings)||void 0===r?void 0:r.map((function(t){var i;Math.max(t.scaleResolutionDownBy=(t.scaleResolutionDownBy||1)*d,1);var r=+t.rid||0;return t.maxFramerate=(null===(i=e.videoEncodeConfig[r])||void 0===i?void 0:i.frameRate)||t.maxFramerate,t})),e.prevScaleResolutionDownBy=c.scaleResolutionDownBy,e.videoInputConfig=s,null==o||o.sender.setParameters(u);try{this.monitor.rtcInvokeStatus(JSON.stringify(u.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(e){}}return[2]}))}))},t.prototype.getStats=function(e,t){return oG(this._peerConnection,e,t)},t.prototype.setLocalDescription=function(e,t){var i;return tv(this,void 0,void 0,(function(){var r,n,o,a=this;return iv(this,(function(s){switch(s.label){case 0:r=zL(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:e}))];case 2:return s.sent(),this.monitor.rtcSetDescription(0,e,_F.W_1,"local"===(null==t?void 0:t.streamUserId)?vF.UP:vF.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",zL()-r,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(n=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(n.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(n.state),0,"sctp","",0)},n.transport&&(n.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null===(e=null==n?void 0:n.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),[3,4];case 3:return o=s.sent(),this.monitor.rtcSetDescription(-1,o.message+e,_F.W_1,"local"===(null==t?void 0:t.streamUserId)?vF.UP:vF.DOWN,"","",zL()-r,{type:"offer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t){return tv(this,void 0,void 0,(function(){var i,r;return iv(this,(function(n){switch(n.label){case 0:i=zL(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e}))];case 2:return n.sent(),this.monitor.rtcSetDescription(0,e,_F.W_0,"local"===(null==t?void 0:t.streamUserId)?vF.UP:vF.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",zL()-i,{type:"answer"}),[3,4];case 3:return r=n.sent(),this.monitor.rtcSetDescription(-1,r.message+e,_F.W_1,"local"===(null==t?void 0:t.streamUserId)?vF.UP:vF.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",zL()-i,{type:"answer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){return[2]}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t.prototype.addBitrateLimit=function(e,t){null==e||e.rtp.forEach((function(i){var r=i.codec,n=i.payload;if(["vp8","h264"].includes(r.toLocaleLowerCase())){var o=e.fmtp.find((function(e){return e.payload===n}));o?o.config=ov(ov([],nv(o.config.split(";")),!1),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)],!1).join(";"):e.fmtp.push({payload:n,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))},t}(JV.exports.EventEmitter),mG=ko;jr({target:"Array",proto:!0},{fill:jC}),mG("fill");var yG={},gG={},SG={exports:{}},EG=SG.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(EG).forEach((function(e){EG[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},i=function(e,i,r){var n=e.name&&e.names;e.push&&!i[e.push]?i[e.push]=[]:n&&!i[e.name]&&(i[e.name]={});var o=e.push?{}:n?i[e.name]:i;!function(e,i,r,n){if(n&&!r)i[n]=t(e[1]);else for(var o=0;o<r.length;o+=1)null!=e[o+1]&&(i[r[o]]=t(e[o+1]))}(r.match(e.reg),o,e.names,e.name),e.push&&i[e.push].push(o)},r=SG.exports,n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach((function(e){var t=e[0],n=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(r[t]||[]).length;s+=1){var c=r[t][s];if(c.reg.test(n))return i(c,a,n)}})),t.media=o,t};var o=function(e,i){var r=i.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&i.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var i=[],r=e.split(" ").map(t),n=0;n<r.length;n+=3)i.push({component:r[n],ip:r[n+1],port:r[n+2]});return i},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var i,r=!1;return"~"!==e[0]?i=t(e):(i=t(e.substring(1,e.length)),r=!0),{scid:i,paused:r}}))}))}}(gG);var bG=SG.exports,IG=/%[sdv%]/g,TG=function(e){var t=1,i=arguments,r=i.length;return e.replace(IG,(function(e){if(t>=r)return e;var n=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(n);case"%d":return Number(n);case"%v":return""}}))},AG=function(e,t,i){var r=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var o=t.names[n];t.name?r.push(i[t.name][o]):r.push(i[t.names[n]])}else r.push(i[t.name]);return TG.apply(null,r)},RG=["v","o","s","i","u","e","p","c","b","t","r","z","a"],CG=["i","c","b","a"],OG=gG,wG=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var i=t.outerOrder||RG,r=t.innerOrder||CG,n=[];return i.forEach((function(t){bG[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(AG(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(AG(t,i,e))}))}))})),e.media.forEach((function(e){n.push(AG("m",bG.m[0],e)),r.forEach((function(t){bG[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(AG(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(AG(t,i,e))}))}))}))})),n.join("\r\n")+"\r\n"};yG.write=wG,yG.parse=OG.parse,yG.parseParams=OG.parseParams,yG.parseFmtpConfig=OG.parseFmtpConfig,yG.parsePayloads=OG.parsePayloads,yG.parseRemoteCandidates=OG.parseRemoteCandidates,yG.parseImageAttributes=OG.parseImageAttributes,yG.parseSimulcastStreamList=OG.parseSimulcastStreamList;var kG=Math.pow(2,32),NG=function(){return Math.floor(Math.random()*kG+1e3)},PG=function(e,t,i){return i||(i=NG()),[{id:i,attribute:"cname",value:"kp34Za0H+aVf862l"},{id:i,attribute:"msid",value:"".concat(e.id," ").concat(e.id,"-").concat(t)},{id:i,attribute:"mslabel",value:"".concat(e.id)},{id:i,attribute:"label",value:"".concat(e.id,"-").concat(t)}]};function DG(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly,e}var MG=function(e,t,i){var r=$_($_({},e),{invalid:[{value:"realx-exts:rscp"}],media:[t,i]});return delete r.groups,delete r.msidSemantic,yG.write(r)};function LG(e){return tv(this,void 0,void 0,(function(){var t,i,r,n,o;return iv(this,(function(a){switch(a.label){case 0:return t={},i=e.publicIPs,r=e.certFingerprint,n=e.iceParams,t.fingerprint={type:"sha-256",hash:r},t.icePwd=n.serverIcePwd,o=t,[4,xG(n.serverIceUfrag)];case 1:return o.iceUfrag=a.sent(),iB.setStats({connection_id:t.iceUfrag}),t.candidates=function(e){if(!Array.isArray(e))return[];var t=0,i=2130706431,r=[];return e.forEach((function(e){var n={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){r.push($_($_({},n),{foundation:t++,transport:"udp",port:e,priority:i}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){r.push($_($_({},n),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:i-1e3}))}))})),r}(i),t.setup="active",t.iceOptions="renomination",[2,t]}}))}))}var UG,xG=function(e){return tv(void 0,void 0,void 0,(function(){var t,i,r,n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:return t=new TextEncoder,i=t.encode("PREC"),n=Uint8Array.bind,[4,XL.b64str2ab(e)];case 1:return r=new(n.apply(Uint8Array,[void 0,c.sent()])),o=t.encode(Date.now().toString()).slice(-4),(a=new Uint8Array(2))[0]=0,a[1]=1,s=KL(Uint8Array,i,r,o,a),[4,XL.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))};function VG(e){var t=e.random,i=e.serverUfrag,r=e.serverPwd,n=e.clientPwd,o=e.options,a=(new TextEncoder).encode("WPRE");t||(t=new Uint8Array(4),crypto.getRandomValues(t));var s=gU(i);s.byteLength;var c=EU(gU(n),gU(r).subarray(0,16),gU(i).subarray(0,16));c.byteLength;var u=new Uint8Array(Object.keys(o).reduce((function(e,t){var i=Number(t);return e.push(i),e.push(o[i]?1:0),e}),[]));u.byteLength;var d=KL(Uint8Array,a,t,[s.byteLength],s,[c.byteLength],c,u);return d.byteLength%3!=0&&(d=KL(Uint8Array,d,new Uint8Array(3-d.byteLength%3).fill(255))),[SU(d),SU(KL(Uint8Array,t,s.subarray(0,20)))]}!function(e){e[e.kICEConfigTypeSrtpDtlsType=0]="kICEConfigTypeSrtpDtlsType",e[e.kICEConfigTypeRenominationType=1]="kICEConfigTypeRenominationType",e[e.kICEConfigTypeTcpType=2]="kICEConfigTypeTcpType",e[e.kICEConfigTypeMultiSendType=3]="kICEConfigTypeMultiSendType",e[e.kICEConfigTypeKcpType=4]="kICEConfigTypeKcpType",e[e.kICEConfigTypeSrtpSdesType=5]="kICEConfigTypeSrtpSdesType"}(UG||(UG={}));var FG=function(e,t){var i,r,n=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){try{for(var o=rv(e.fmtp),a=o.next();!a.done;a=o.next()){var s=a.value;if(s.config.includes("level-asymmetry-allowed=1")&&s.config.includes("packetization-mode=1")&&s.config.includes("profile-level-id=42e0")){n=s.payload;break}}}catch(e){i={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}for(var c=0;c<e.rtp.length;c++){var u=e.rtp[c];if("H264"===t){if(u.payload===n){e.rtp.unshift(e.rtp.splice(c,1)[0]);break}}else if(u.codec===t){e.rtp.unshift(e.rtp.splice(c,1)[0]);break}}var d=[];e.rtp.forEach((function(e){return d.push(e.payload)})),e.payloads=d.join(" ")}},BG=T,jG=Wu,GG=Vv.exports.getWeakData,HG=Pt,zG=G,KG=ed,WG=Ld,XG=Ue,qG=Ii.set,YG=Ii.getterFor,JG=Mn.find,QG=Mn.findIndex,ZG=BG([].splice),$G=0,eH=function(e){return e.frozen||(e.frozen=new tH)},tH=function(){this.entries=[]},iH=function(e,t){return JG(e.entries,(function(e){return e[0]===t}))};tH.prototype={get:function(e){var t=iH(this,e);if(t)return t[1]},has:function(e){return!!iH(this,e)},set:function(e,t){var i=iH(this,e);i?i[1]=t:this.entries.push([e,t])},delete:function(e){var t=QG(this.entries,(function(t){return t[0]===e}));return~t&&ZG(this.entries,t,1),!!~t}};var rH,nH={getConstructor:function(e,t,i,r){var n=e((function(e,n){KG(e,o),qG(e,{type:t,id:$G++,frozen:void 0}),null!=n&&WG(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=YG(t),s=function(e,t,i){var r=a(e),n=GG(HG(t),!0);return!0===n?eH(r).set(t,i):n[r.id]=i,e};return jG(o,{delete:function(e){var t=a(this);if(!zG(e))return!1;var i=GG(e);return!0===i?eH(t).delete(e):i&&XG(i,t.id)&&delete i[t.id]},has:function(e){var t=a(this);if(!zG(e))return!1;var i=GG(e);return!0===i?eH(t).has(e):i&&XG(i,t.id)}}),jG(o,i?{get:function(e){var t=a(this);if(zG(e)){var i=GG(e);return!0===i?eH(t).get(e):i?i[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),n}},oH=n,aH=T,sH=Wu,cH=Vv.exports,uH=Rm,dH=nH,lH=G,hH=Kv,pH=Ii.enforce,fH=ti,_H=!oH.ActiveXObject&&"ActiveXObject"in oH,vH=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},mH=uH("WeakMap",vH,dH);if(fH&&_H){rH=dH.getConstructor(vH,"WeakMap",!0),cH.enable();var yH=mH.prototype,gH=aH(yH.delete),SH=aH(yH.has),EH=aH(yH.get),bH=aH(yH.set);sH(yH,{delete:function(e){if(lH(e)&&!hH(e)){var t=pH(this);return t.frozen||(t.frozen=new rH),gH(this,e)||t.frozen.delete(e)}return gH(this,e)},has:function(e){if(lH(e)&&!hH(e)){var t=pH(this);return t.frozen||(t.frozen=new rH),SH(this,e)||t.frozen.has(e)}return SH(this,e)},get:function(e){if(lH(e)&&!hH(e)){var t=pH(this);return t.frozen||(t.frozen=new rH),SH(this,e)?EH(this,e):t.frozen.get(e)}return EH(this,e)},set:function(e,t){if(lH(e)&&!hH(e)){var i=pH(this);i.frozen||(i.frozen=new rH),SH(this,e)?bH(this,e,t):i.frozen.set(e,t)}else bH(this,e,t);return this}})}var IH=function(e){function t(){var t,i,r=e.call(this)||this;return r.inited=!1,r.deviceMap={audioinput:new Map,audiooutput:new Map,videoinput:new Map},r.checkDeviceChangeTimer=null,r.isSupportedPermissionsQuery=!1,r.isGrantedMicrophonePermission=!1,r.isGrantedCameraPermission=!1,r.isSupportedPermissionsQuery=!WL()&&!!(null===(i=null===(t=navigator)||void 0===t?void 0:t.permissions)||void 0===i?void 0:i.query),r._handleDeviceChange=r._handleDeviceChange.bind(r),!WL()&&r.refreshDevices(),r}return Z_(t,e),t.prototype.refreshDevices=function(){return tv(this,void 0,void 0,(function(){var e,t,i=this;return iv(this,(function(r){switch(r.label){case 0:if(!navigator.mediaDevices)return[2];if(e=void 0,!YL)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 2:return e=r.sent(),[3,4];case 3:return r.sent(),[3,4];case 4:return[4,navigator.mediaDevices.enumerateDevices()];case 5:return t=r.sent(),e&&e.getTracks().forEach((function(e){return e.stop()})),t.forEach((function(e){var t;e.deviceId&&(null===(t=i.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e,t;return tv(this,void 0,void 0,(function(){var i,r,n=this;return iv(this,(function(o){switch(o.label){case 0:if(void 0!==(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.ondevicechange)&&"function"==typeof(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.addEventListener)?navigator.mediaDevices.addEventListener("devicechange",(function(){n._handleDeviceChange(),setTimeout((function(){n._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){n._handleDeviceChange()}),3e3),!this.isSupportedPermissionsQuery)return[3,7];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,navigator.permissions.query({name:"microphone"})];case 2:return i=o.sent(),this.isGrantedMicrophonePermission="granted"===i.state,i.addEventListener("change",(function(){n.isGrantedMicrophonePermission="granted"===i.state})),[3,4];case 3:return o.sent(),[3,4];case 4:return o.trys.push([4,6,,7]),[4,navigator.permissions.query({name:"camera"})];case 5:return r=o.sent(),this.isGrantedCameraPermission="granted"===r.state,r.addEventListener("change",(function(){n.isGrantedCameraPermission="granted"===r.state})),[3,7];case 6:return o.sent(),[3,7];case 7:return[2]}}))}))},t.prototype._handleDeviceChange=function(){return tv(this,void 0,void 0,(function(){var e,t,i,r=this;return iv(this,(function(n){switch(n.label){case 0:return e=void 0,YL?[4,navigator.mediaDevices.getUserMedia({audio:!0})]:[3,2];case 1:e=n.sent(),n.label=2;case 2:return[4,navigator.mediaDevices.enumerateDevices()];case 3:return t=(t=n.sent()).filter((function(e){return!!e.deviceId})),e&&e.getTracks().forEach((function(e){return e.stop()})),i=Array.from(ov(ov(ov([],nv(this.deviceMap.audioinput.values()),!1),nv(this.deviceMap.videoinput.values()),!1),nv(this.deviceMap.audiooutput.values()),!1)),t.forEach((function(e){var t=r.deviceMap[e.kind].get(e.deviceId);r.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?r.emit(PD.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&r.emit(PD.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),i.forEach((function(e){t.find((function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(r.deviceMap[e.kind].delete(e.deviceId),e.kind.includes("video")?r.emit(PD.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&r.emit(PD.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))})),[2]}}))}))},t.prototype.getUserMedia=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return t=i.sent(),(null==e?void 0:e.audio)&&(this.isGrantedMicrophonePermission=!0),(null==e?void 0:e.video)&&(this.isGrantedCameraPermission=!0),this.refreshDevices(),[2,t]}}))}))},t.prototype.checkPermissionsByDevices=function(){return tv(this,void 0,void 0,(function(){var e,t;return iv(this,(function(i){switch(i.label){case 0:return e={audio:!1,video:!1},navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2,e];case 1:return t=i.sent(),e.audio=t.filter((function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,e.video=t.filter((function(e){return"videoinput"===e.kind&&e.label&&e.deviceId})).length>0,[2,e]}}))}))},t.prototype.getPermissions=function(e){var t;return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var i,r,n,o,a,s=this;return iv(this,(function(c){switch(c.label){case 0:if(i=e.audio,r=e.video,n=e.force,i||r||(i=!0,r=!0),o={audio:!1,video:!1},n)return[3,3];if(!this.isSupportedPermissionsQuery)return[3,1];if(i&&r){if(this.isGrantedMicrophonePermission&&this.isGrantedCameraPermission)return o.audio=!0,o.video=!0,[2,o]}else if(i&&this.isGrantedMicrophonePermission||r&&this.isGrantedCameraPermission)return o.audio=this.isGrantedMicrophonePermission,o.video=this.isGrantedCameraPermission,[2,o];return[3,3];case 1:return[4,this.checkPermissionsByDevices()];case 2:if(a=c.sent(),i&&r){if(a.audio&&a.video)return[2,a]}else if(i&&a.audio||r&&a.video)return[2,a];c.label=3;case 3:return(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.getUserMedia)?[4,navigator.mediaDevices.getUserMedia({audio:i,video:r}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),i&&(o.audio=!0,s.isGrantedMicrophonePermission=!0),r&&(o.video=!0,s.isGrantedCameraPermission=!0))})).catch((function(){}))]:[3,5];case 4:c.sent(),c.label=5;case 5:return[4,this.refreshDevices()];case 6:return c.sent(),[2,o]}}))}))},t.prototype.enumerateDevices=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions()];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(ov(ov(ov([],nv(this.deviceMap.audioinput.values()),!1),nv(this.deviceMap.videoinput.values()),!1),nv(this.deviceMap.audiooutput.values()),!1))]}}))}))},t.prototype.enumerateAudioCaptureDevices=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({audio:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.audioinput.values())]}}))}))},t.prototype.enumerateVideoCaptureDevices=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({video:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.videoinput.values())]}}))}))},t.prototype.enumerateAudioPlaybackDevices=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({audio:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.audiooutput.values())]}}))}))},t.prototype.getDeviceById=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return[4,this.enumerateDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},t}(JF),TH=new IH;!WL()&&(window.__rtc_dd__=TH);var AH=new XF("VERTC",0),RH=new WeakMap,CH=function(e){return RH.get(e)},OH=function(e){function t(t,i){var r=e.call(this)||this;return r._trackId=t,r.mediaType=i,r}return Z_(t,e),t.prototype.getId=function(){return this._trackId},t}(JF),wH=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n._initListeners(),n}return Z_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.setTrack=function(e){this._mediaTrack=e},t.prototype.close=function(){var e;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()},t.prototype._initListeners=function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){$F.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(OH),kH=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n}return Z_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(OH),NH=function(e){function t(t,i){var r=e.call(this,t,i,"video")||this;return r.dummy=!1,r.resolution={width:0,height:0},r._time=setInterval((function(){t.muted!==r._prevMuted&&AH.print("LocalVideoTrack.mutedChange: ",t.muted),r._prevMuted=t.muted}),100),r}return Z_(t,e),t.prototype.updateVideoCaptureConfig=function(){return tv(this,void 0,void 0,(function(){var e;return iv(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig&&this.getTrack()?(AH.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),delete $_({},this.videoCaptureConfig).contentHint,[4,this.getTrack().applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),((e=this.getTrack().getSettings()).width&&e.width!==this.resolution.width||e.height&&e.height!==this.resolution.height)&&(this.resolution={width:e.width,height:e.height},this.emit("resolution-change",this.resolution)),[2]}}))}))},t.prototype.replaceTrack=function(e){this.setTrack(e)},t.prototype.close=function(){e.prototype.close.call(this),AH.print("LocalVideoTrack.close"),clearInterval(this._time)},t.prototype.setContentHint=function(e){this._mediaTrack&&"contentHint"in this._mediaTrack&&["text","motion","detail"].includes(e)&&(this._mediaTrack.contentHint=e)},t}(wH),PH=function(e){function t(t,i){var r=e.call(this,t,i,"audio")||this;return r.mixType=sG.PLAYOUT_AND_PUBLISH,r}return Z_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new fL(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.checkHasInput=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new fL(this.getTrack())),this._audioLevelFetcher.checkHasInput()},t.prototype.resetAudioLevelFetcher=function(){var e;null===(e=this._audioLevelFetcher)||void 0===e||e.reset()},t.prototype.updateAudioCaptureConfig=function(){var e;return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(AH.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.audioCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t}(wH),DH=function(e){function t(t,i){return e.call(this,t,i,"video")||this}return Z_(t,e),t}(kH),MH=function(e){function t(t,i){return e.call(this,t,i,"audio")||this}return Z_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new fL(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.resetAudioLevelFetcher=function(){var e;null===(e=this._audioLevelFetcher)||void 0===e||e.reset()},t}(kH),LH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(PH),UH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(NH),xH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(NH),VH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(PH),FH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(NH),BH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(PH),jH=function(e){function t(t,i){var r=this,n=document.createElement("video"),o=document.createElement("canvas");n.setAttribute("style","display:none"),o.setAttribute("style","display:none"),n.setAttribute("muted",""),n.muted=!0,n.setAttribute("autoplay",""),n.autoplay=!0,n.setAttribute("playsinline","");var a=t.getSettings(),s=a.width,c=a.height,u=a.frameRate;o.width=s,o.height=c,document.body.append(n),document.body.append(o),n.srcObject=new MediaStream([t]),n.play();var d=o.getContext("2d");if(!d)throw new YB(HB.UNEXPECTED_ERROR,"can not get canvas context");var l=o.captureStream(u).getVideoTracks()[0];return(r=e.call(this,l,i)||this)._originTrack=t,r._video=n,r._ctx=d,r._canvas=o,r._track=l,r._cancelLoop=function(e,t){var i=1/t,r=_L.getAudioContextInstance(),n=r.createGain();n.gain.value=0,n.connect(r.destination);var o=!1;return function t(){if(o)n=null;else{var a=r.createOscillator();a.onended=t,a.connect(n),a.start(0),a.stop(r.currentTime+i),e(r.currentTime)}}(),function(){o=!0}}((function(){return r.draw()}),u),r.__initListeners(),r}return Z_(t,e),t.prototype.draw=function(){this._video.paused&&this._video.play(),this._video.videoWidth===this._canvas.width&&this._video.videoHeight===this._canvas.height||(this._canvas.width=this._video.videoWidth,this._canvas.height=this._video.videoHeight),this._ctx.drawImage(this._video,0,0,this._canvas.width,this._canvas.height),this._track.requestFrame&&this._track.requestFrame()},t.prototype.close=function(){var e,t;this._video.remove(),this._canvas.width=0,this._canvas.remove(),this._canvas=null,this._video=null,this._cancelLoop(),null===(e=this._originTrack)||void 0===e||e.stop(),this._originTrack=null,null===(t=this._track)||void 0===t||t.stop(),this._track=null},t.prototype.__initListeners=function(){var e=this;this._originTrack instanceof MediaStreamTrack&&this._originTrack.addEventListener("ended",(function(){var t;$F.rtcError("track-ended mediaType: ".concat(null===(t=e._originTrack)||void 0===t?void 0:t.kind),-1001),e.emit("track-ended",e)}))},t}(NH);function GH(e,t,i){var r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y;return iv(this,(function(g){switch(g.label){case 0:AH.print("createCameraAndMicrophoneTrack","videoConstraints:",e,"audioConstraints:",t,"audioProfileManager:",i),null===(r=null==t?void 0:t.deviceId)||void 0===r||r.exact,a=(null===(n=null==e?void 0:e.deviceId)||void 0===n?void 0:n.exact)||"default",c=(s=i||{}).sampleRate,u=s.channel,d=s.agc,l=s.ans,h=s.aec,void 0===t.sampleRate&&(t.sampleRate=c),void 0===t.channelCount&&(t.channelCount=u),void 0===t.autoGainControl&&(t.autoGainControl=d),void 0===t.noiseSuppression&&(t.noiseSuppression=l),void 0===t.echoCancellation&&(t.echoCancellation=h),g.label=1;case 1:return g.trys.push([1,3,,4]),$F.rtcVideoCaptureEvent({event_type:xF.START,media_device_id:a}),p=zL(),[4,TH.getUserMedia({video:e,audio:t})];case 2:return o=g.sent(),$F.rtcVideoCaptureEvent({event_type:xF.START_CAPTURE_RESULT,media_device_id:a,reason:FF.SUCCESS,elapse:zL()-p}),[3,4];case 3:throw f=g.sent(),$F.rtcVideoCaptureEvent({event_type:xF.RUNNING_FAILED,media_device_id:a,error_code:f.code,reason:f.name+f.message}),new YB(HB.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",f);case 4:return _=o.getVideoTracks()[0],RH.set(_,o),(v=new UH(_,HL())).videoCaptureConfig=e,m=o.getAudioTracks()[0],RH.set(m,o),y=new LH(m,HL()),[2,{videoTrack:v,audioTrack:y}]}}))}))}function HH(e){var t;return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:r=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",c.label=1;case 1:return c.trys.push([1,3,,4]),AH.print("createCameraVideoTrack","constraints:",e),$F.rtcVideoCaptureEvent({event_type:xF.START,media_device_id:r}),n=zL(),[4,TH.getUserMedia({video:e})];case 2:return i=c.sent(),$F.rtcVideoCaptureEvent({event_type:xF.START_CAPTURE_RESULT,media_device_id:r,reason:FF.SUCCESS,elapse:zL()-n}),[3,4];case 3:throw o=c.sent(),$F.rtcVideoCaptureEvent({event_type:xF.RUNNING_FAILED,media_device_id:r,error_code:o.code,reason:o.name+o.message}),new YB(HB.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=i.getVideoTracks()[0],RH.set(a,i),(s=new UH(a,HL())).videoCaptureConfig=e,[2,s]}}))}))}function zH(e,t){var i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p;return iv(this,(function(f){switch(f.label){case 0:AH.print("createCameraVideoTrack","constraints:",e),n=(null===(i=null==e?void 0:e.deviceId)||void 0===i?void 0:i.exact)||"default",a=(o=t||{}).sampleRate,s=o.channel,c=o.agc,u=o.ans,d=o.aec,void 0===e.sampleRate&&(e.sampleRate=a),void 0===e.channelCount&&(e.channelCount=s),void 0===e.autoGainControl&&(e.autoGainControl=c),void 0===e.noiseSuppression&&(e.noiseSuppression=u),void 0===e.echoCancellation&&(e.echoCancellation=d),f.label=1;case 1:return f.trys.push([1,3,,4]),$F.rtcVideoCaptureEvent({event_type:xF.START,media_device_id:n}),l=zL(),[4,TH.getUserMedia({audio:e})];case 2:return r=f.sent(),$F.rtcVideoCaptureEvent({event_type:xF.START_CAPTURE_RESULT,media_device_id:n,reason:FF.SUCCESS,elapse:zL()-l}),[3,4];case 3:throw h=f.sent(),$F.rtcVideoCaptureEvent({event_type:xF.RUNNING_FAILED,media_device_id:n,error_code:h.code,reason:h.name+h.message}),new YB(HB.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",h);case 4:return p=r.getAudioTracks()[0],RH.set(p,r),[2,new LH(p,HL())]}}))}))}function KH(e,t){return void 0===e&&(e=!1),tv(this,void 0,void 0,(function(){var i,r,n;return iv(this,(function(o){switch(o.label){case 0:AH.print("createScreenTracks","withAudio: %o, constraints: %o",e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),$F.rtcVideoCaptureEvent({event_type:xF.START,media_device_id:"screen"}),r=zL(),[4,navigator.mediaDevices.getDisplayMedia({video:!(t&&(!JL||16!==$L))||t,audio:e})];case 2:return i=o.sent(),$F.rtcVideoCaptureEvent({event_type:xF.START_CAPTURE_RESULT,media_device_id:"screen",reason:FF.SUCCESS,elapse:zL()-r}),[3,4];case 3:throw n=o.sent(),$F.rtcVideoCaptureEvent({event_type:xF.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.name+n.message}),new YB(HB.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,i]}}))}))}var WH,XH=PH;!function(e){e[e.NONE=0]="NONE"}(WH||(WH={}));var qH,YH,JH=function(){function e(){}return e.getNalunits=function(t){if(t.length-t.position<4)return[];var i=t.position;return 1===t.getInt32(i)||0===t.getInt16(i)&&1===t.getInt8(i+2)?e.getAnnexbNals(t):e.getAvccNals(t)},e.getAnnexbNals=function(t){for(var i=[],r=e.getHeaderPositionAnnexB(t),n=r.pos,o=n;n<t.length-4;){var a=new Uint8Array(t.buffer.slice(n,n+r.headerLength));r.pos===t.position&&t.skip(r.headerLength),o=(r=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(n+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&i.push(s),t.skip(o-t.position),n=o}return i},e.getAvccNals=function(t){for(var i=[];t.position<t.length-4;){var r=t.getInt32(t.position);if(!(t.length-t.position>=r))break;var n=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+r));t.skip(r);var a={header:n,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&i.push(a)}return i},e.analyseNal=function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},e.getHeaderPositionAnnexB=function(e){for(var t=e.position,i=0,r=e.length;3!==i&&4!==i&&t<r-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:1===e.getInt8(t+2)?i=3:t++:t++;return t===r-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:t=r:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?i=3:t=r)),{pos:t,headerLength:i}},e.getAvcc=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength+11);i[0]=1,i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=255,i[5]=225;var r=6;return i.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),r),r+=2,i.set(e,r),i[r+=e.byteLength]=1,r++,i.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),r),r+=2,i.set(t,r),i},e}(),QH=function(){function e(e){this._position=0,this._dataview=new DataView(e)}return Object.defineProperty(e.prototype,"length",{get:function(){return this.buffer.byteLength},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._dataview.buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),e.prototype.back=function(e){this.position-=e},e.prototype.getUint8=function(e){return this._dataview.getUint8(e)},e.prototype.getInt8=function(e){return this._dataview.getInt8(e)},e.prototype.getInt16=function(e){return this._dataview.getInt16(e)},e.prototype.getUint16=function(e){return this._dataview.getUint16(e)},e.prototype.getUint32=function(e){return this._dataview.getUint32(e)},e.prototype.getInt32=function(e){return this._dataview.getInt32(e)},e.prototype.skip=function(t){for(var i=Math.floor(t/4),r=t%4,n=0;n<i;n++)e.readByte(this,4);r>0&&e.readByte(this,r)},e.readByte=function(e,t,i){var r;switch(t){case 1:r=i?e.getInt8(e.position):e.getUint8(e.position);break;case 2:r=i?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(i)throw new Error("not supported for readByte 3");r=e.getUint8(e.position)<<16,r|=e.getUint8(e.position+1)<<8,r|=e.getUint8(e.position+2);break;case 4:r=i?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(i)throw new Error("not supported for readBody 8");r=e.getUint32(e.position)<<32,r|=e.getUint32(e.position+4);break;default:r=""}return e.position+=t,r},e.prototype.readUint8=function(){return e.readByte(this,1)},e.prototype.readUint16=function(){return e.readByte(this,2)},e.prototype.readUint24=function(){return e.readByte(this,3)},e.prototype.readUint32=function(){return e.readByte(this,4)},e.prototype.readUint64=function(){return e.readByte(this,8)},e.prototype.readInt8=function(){return e.readByte(this,1,!0)},e.prototype.readInt16=function(){return e.readByte(this,2,!0)},e.prototype.readInt32=function(){return e.readByte(this,4,!0)},e.prototype.writeUint32=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])},e}();!function(e){e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass"}(qH||(qH={})),function(e){e[e.invalid=0]="invalid",e[e.cfgResolution=1]="cfgResolution",e[e.bitstreamHash=2]="bitstreamHash",e[e.screenCodec=3]="screenCodec"}(YH||(YH={}));var ZH=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),$H=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]);function ez(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function tz(e,t){void 0===t&&(t=0);for(var i=0;255===e[t]&&t<e.byteLength;)t++,i+=255;return t<e.byteLength&&(i+=e[t++]),[i,t]}var iz=function(){function e(){}return e.generateSEI=function(e,t){void 0===t&&(t=!1);var i=new Uint8Array([0,0,0,1]),r=new Uint8Array([6]),n=new Uint8Array([5]),o=t?ZH:$H,a=ez(e.byteLength+o.byteLength),s=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]&&t.push(3),t.push(e[i]);return new Uint8Array(t)}(e);return new Uint8Array(ov(ov(ov(ov(ov(ov(ov([],nv(i),!1),nv(r),!1),nv(n),!1),nv(a),!1),nv(o),!1),nv(s),!1),[128],!1))},e.decodeSeiBody=function(e){var t=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]||t.push(e[i]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var i=0;if(5===t[1]||100===t[1]){var r=nv(tz(t,i+=2),2),n=r[0];i=r[1];var o=qH.bypass,a=i+n;return t.byteLength>=$H.byteLength&&n>=$H.byteLength&&t.slice(i,i+$H.byteLength).toString()===$H.toString()?(i+=$H.byteLength,o=qH.external):t.byteLength>=$H.byteLength&&n>=$H.byteLength&&t.slice(i,i+ZH.byteLength).toString()===ZH.toString()&&(i+=ZH.byteLength,o=qH.internal),{type:o,payload:t.slice(i,a)}}}},e.parseInternalSEI=function(e){var t=new Map,i=0;if(e.type===qH.internal){for(;e.payload.byteLength-i>=2;){var r=nv(tz(e.payload,i),2),n=r[0];i=r[1];var o=nv(tz(e.payload,i),2),a=o[0];if(i=o[1],t.get(n)||!(a<e.payload.byteLength-i))break;t.set(n,e.payload.slice(i,i+a))}return t}},e.makeInternalSei=function(e){var t,i,r=[];try{for(var n=rv(e),o=n.next();!o.done;o=n.next()){var a=nv(o.value,2),s=a[0],c=a[1],u=ez(s),d=ez(c.byteLength);r.push(u,d,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}var l=r.reduce((function(e,t){return e+t.byteLength}),0),h=new Uint8Array(l);return r.reduce((function(e,t){return h.set(t,e),e+t.byteLength}),0),h},e}();jr({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new XF("Stats",2);var rz,nz,oz,az,sz,cz,uz=function(){function e(e){this._stream=e}return e.prototype.setVar=function(e,t,i){this.client=e,this.handler=t,this.monitor=i},e.prototype.delStatsEvtInterval=function(){clearTimeout(this._timer),this._timer=void 0},e.prototype.destroy=function(){this.delStatsEvtInterval()},e}(),dz=function(e){function t(t){var i=e.call(this,t)||this;return i._stream=t,i}return Z_(t,e),t.prototype.setLocalStreamStatsEvtInterval=function(e,t,i){var r,n,o=this;if(!this._timer){this.setVar(e,t,i),e.once(wj.ABNORMAL_DISCONNECTION,(function(){o.destroy()}));var a={audio:{},video:{}},s=this._stream,c=null===(r=s.audioTrack)||void 0===r?void 0:r.getTrack(),u=null===(n=s.videoTrack)||void 0===n?void 0:n.getTrack();this.getAudioStats(c,a),this.getVideoStats(u,a),this.delStatsEvtInterval();this._timer&&clearTimeout(this._timer),this._timer=setTimeout((function e(){return tv(o,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:return[4,tv(o,void 0,void 0,(function(){var e,t,i,r,n,o;return iv(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getAudioStats(e,a)];case 1:return i=c.sent(),[4,this.getVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen}]}}))}))];case 1:return t=r.sent(),null===(i=this.client)||void 0===i||i.emit("onLocalStreamStats",t),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(e,2e3),[2]}}))}))}),2e3)}},t.prototype.unpublish=function(){this.delStatsEvtInterval()},t.prototype.getAudioStats=function(e,t){return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l;return iv(this,(function(h){switch(h.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.audioMid,s=n.isScreen,c=n.pubAttributes,u={media_type:"audio",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,n=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,d=e.channels,l=e.audioLevel,h=e.googRtt,p=e.mimeType,f=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,y=e.id,g=e.currentRoundTripTime,S=e.state,E=e.writable,b=e.requestsReceived,I=e.responsesReceived,T=e.requestsSent,A=e.consentRequestsSent,R=e.responsesSent,C=e.jitter,O=e.candidateType,w=e.ip,k=e.address,N=e.networkType,P=e.port,D=e.protocol,M=e.nackCount,L=e.retransmittedBytesSent,U=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType,H=e.fractionLost;"outbound-rtp"===t?(r.packetsSent=n,r.bytesSent=a,u.bytes=a,u.packetsSent=n,u.nackCount=M,u.ssrc=F,u.retransmitted_bytes_sent=L,u.retransmitted_packets_sent=U,r.retransmittedPacketsSent=U):"remote-inbound-rtp"===t?(r.packetsLost=o,u.packetsLost=o,u.jitter=1e3*C,i.rtt=1e3*c,u.rtt=i.rtt,u.round_trip_time_measurements=x,i._fractionLost=H||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=d,u.codecName=p):"media-source"===t?(u.audio_level=l?-10*Math.log10(Math.pow(l,2)):l,u.volume=255*l,u.total_audio_energy=B,u.total_samples_duration=j):"ssrc"===t&&"audio"===G?(u.audio_network_elapse=h,u.send_level=V):"candidate-pair"===t?(u.ice_available_incoming_bitrate=f,u.ice_available_outgoing_bitrate=_,u.ice_bytes_received=v,u.ice_bytes_sent=a,u.ice_nominated=+m,u.ice_pair_id=y,u.ice_pair_rtt=g,u.ice_pair_state=S,u.ice_pair_writable=E,u.recv_ping_requests=b,u.recv_ping_responses=I,u.sent_ping_requests_before_first_response=T,u.sent_ping_requests_total=T+(A||0),u.sent_ping_responses=R):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=w||k,u.local_network_type=N,u.local_port=P,u.protocol=D):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=w||k,u.remote_port=P),yU||"media-source"===t&&(u.send_level=l)})),(l=t.audio).timestamp?(void 0!==r.packetsLost&&(i.audioLossRate=(r.packetsLost-l.packetsLost)/(r.packetsSent-l.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,u.fraction_lost=i.audioLossRate),i.statsInterval=r.timestamp-l.timestamp,u.stats_interval=i.statsInterval,i.sendKBitrate=(r.bytesSent-l.bytesSent||0)/i.statsInterval*8,u.bitrate=Math.round(1e3*i.sendKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=r,u.total_audio_play_energy=this._stream.getRecordAudioEnergy(),this.monitor.rtcMediaStatistics(u,{}),i._retransmittedRate=(r.retransmittedPacketsSent-l.retransmittedPacketsSent)/(r.packetsSent-l.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),[2,i]):(t.audio=r,[2,i])):[2,i]}}))}))},t.prototype.getVideoStats=function(e,t){return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v;return iv(this,(function(m){switch(m.label){case 0:return i={},r={timestamp:Date.now(),simulcast:{}},n=this._stream,o=n.streamId,a=n.videoMid,s=n.isScreen,c=n.pubAttributes,u=n.enableSimulcast,l=[{media_type:"video",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,capture_state:c.localvideo?"capture_state_on":"capture_state_off"}],[4,this._stream.requestVideoFrameCallback()];case 1:return d=$_.apply(void 0,l.concat([m.sent()])),e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 2:return(h=m.sent()).length?(p=0,h.forEach((function(n){var o=n.type,a=n.framesEncoded,s=n.packetsLost,c=n.bytesSent,l=n.framesSent,h=n.roundTripTime,f=n.mimeType,_=n.frameWidth,v=n.frameHeight,m=n.packetsSent,y=n.googActualEncBitrate,g=n.googAvailableReceiveBandwidth,S=n.googAvailableSendBandwidth,E=n.googAvgEncodeMs,b=n.googBucketDelay,I=n.googEncodeUsagePercent,T=n.googFrameRateInput,A=n.availableIncomingBitrate,R=n.availableOutgoingBitrate,C=n.bytesReceived,O=n.nominated,w=n.id,k=n.currentRoundTripTime,N=n.state,P=n.writable,D=n.candidateType,M=n.ip,L=n.address,U=n.networkType,x=n.port,V=n.nackCount,F=n.pliCount,B=n.protocol,j=n.qpSum,G=n.requestsReceived,H=n.responsesReceived,z=n.googRetransmitBitrate,K=n.requestsSent,W=n.consentRequestsSent,X=n.responsesSent,q=n.ssrc,Y=n.googTargetEncBitrate,J=n.googTransmitBitrate,Q=n.googRtt,Z=n.retransmittedPacketsSent,$=n.encoderImplementation,ee=n.jitter,te=n.rid,ie=n.fractionLost,re=n.keyFramesEncoded,ne=n.retransmittedBytesSent,oe=n.totalPacketSendDelay,ae=n.totalEncodeTime;n.getsetting,n.framesPerSecond;var se=n.firCount,ce=n.qualityLimitationReason,ue=n.targetBitrate;if("outbound-rtp"===o?(u&&(te?r.simulcast[te]=n:r.simulcast[p]=n,p++),r.framesEncoded=a||r.framesEncoded,d.key_frames_encoded=re||0,r.bytesSent=c||r.bytesSent,r.framesSent=l||r.framesSent,d.bytes=c||d.bytes,r.packetsSent=m||r.packetsSent,r.retransmittedBytesSent=ne,d.packetsSent=m||d.packetsSent,d.nackCount=V||d.nackCount,d.pli_count=F||d.pli_count,d.qp_sum=j||d.qp_sum,d.ssrc=q||d.ssrc,d.retransmitted_packets_sent=Z,r.retransmittedPacketsSent=Z,d.encoder_implementation=$):"track"===o?(i.encodedFrameWidth=_,i.encodedFrameHeight=v,d.frame_size_height=v,d.frame_size_width=_):"remote-inbound-rtp"===o?(r.packetsLost=s,i.rtt=1e3*h,d.rtt=i.rtt,d.jitter=ee,d.packetsLost=s,i._fractionLost=ie||0):"codec"===o?(i.codecType=f,d.codecName=f):"candidate-pair"===o?(d.ice_available_incoming_bitrate=A,d.ice_available_outgoing_bitrate=R,d.ice_bytes_received=C,d.ice_bytes_sent=c,d.ice_nominated=+O,d.ice_pair_id=w,d.ice_pair_rtt=k,d.ice_pair_state=N,d.ice_pair_writable=P,d.recv_ping_requests=G,d.recv_ping_responses=H,d.sent_ping_requests_before_first_response=K,d.sent_ping_requests_total=K+W,d.sent_ping_responses=X):"local-candidate"===o?(d.local_candidate_type=D,d.local_ip=M||L,d.local_network_type=U,d.local_port=x,d.protocol=B):"remote-candidate"===o?(d.remote_candidate_type=D,d.remote_ip=M||L,d.remote_port=x):"VideoBwe"===o?(d.encBitratebps=y,d.available_receive_bandwidth=g,d.available_send_bandwidth=S,d.bucket_delay=b,d.retransmitBitratebps=z,d.targetEncBitratebps=Y,d.transmit_bitrate=J,i._sendBandWidth=+S):"ssrc"===o&&(d.video_network_elapse=Q,d.avg_encode_ms=E,d.encodeUsage=I,d.frame_rate_input=T,d.orignal_input_Framerate=+T),!yU){var de=t.video,le=r.timestamp-de.timestamp;if("outbound-rtp"===o){var he=c-de.bytesSent,pe=ne-de.retransmittedBytesSent;d.encBitratebps=Math.round(8e3*(he-pe)/le),d.bucket_delay=oe/m,d.retransmitBitratebps=Math.round(8e3*pe/le),d.targetEncBitratebps=ue,d.transmit_bitrate=Math.round(1e3*(c-de.bytesSent)*8/le),d.avg_encode_ms=1e3*ae/a,d.firsReceived=se+F,d.qualityLimitationReason="bandwidth"===ce,d.qualityLimitationDurations="cpu"===ce}else"candidate-pair"===o&&(d.available_send_bandwidth=R,i._sendBandWidth=R);if(e){var fe=null==e?void 0:e.getSettings().frameRate;d.orignal_input_Framerate=fe,d.frameRateSent=e.getSettings().frameRate}}})),(f=t.video).timestamp?(i.statsInterval=r.timestamp-f.timestamp,d.stats_interval=i.statsInterval,_=Object.keys(r.simulcast),u?(d.sim_enc_width=[],d.sim_enc_height=[],d.sim_enc_bps=[],d.sim_enc_framerate=[],d.sim_enc_key_frames=[],d.sim_rids=[],d.sim_enc_bandwidth=[],d.sim_sent_framerate=[],d.sim_fraction_lost=[],v=!1,_.sort((function(e,t){return+e-+t})).forEach((function(e){var t=r.simulcast[e],n=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,l=t.packetsSent,h=t.qualityLimitationReason,p=t.qualityLimitationDurations,_=t.qualityLimitationResolutionChanges,m=t.retransmittedPacketsSent,y=t.keyFramesEncoded;void 0!==h&&(d.sim_qualityLimitationReason||(d.sim_qualityLimitationReason=[],d.sim_qualityLimitationDurations=[],d.sim_qualityLimitationResolutionChanges=[]),d.sim_qualityLimitationReason.push(h),d.sim_qualityLimitationDurations.push(p),d.sim_qualityLimitationResolutionChanges.push(_));var g=f.simulcast[e];if(d.sim_enc_width.push(n||0),d.sim_enc_height.push(o||0),d.sim_enc_key_frames.push(y||0),g){var S=(a-g.bytesSent||0)/i.statsInterval;d.sim_enc_bps.push(Math.round(8e3*S)),d.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var E=1e3*(s-g.framesEncoded)/i.statsInterval;d.sim_enc_framerate.push(Math.round(E)),d.sim_rids.push(e);var b=void 0!==c?c-g.framesSent:s-g.framesEncoded,I=1e3*b/i.statsInterval;d.sim_sent_framerate.push(Math.round(I));var T=(u-g.packetsLost)/(l-g.packetsSent);i._retransmittedRate=(m-g.retransmittedPacketsSent)/(l-g.packetsSent),T=Number.isNaN(T)?0:T,d.sim_fraction_lost.push(T),n>0&&!v&&(i.sentKBitrate=8*S,i.encoderOutputFrameRate=E,i.encodedFrameCount=b,i.sentFrameRate=I,i.videoLossRate=T,v=!0)}})),this.monitor.rtcMediaStatistics(d,{})):(i.encodedFrameCount=void 0!==r.framesSent?r.framesSent-f.framesSent:r.framesEncoded-f.framesEncoded,i.sentKBitrate=(r.bytesSent-f.bytesSent||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.sentKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.encoderOutputFrameRate=1e3*(r.framesEncoded-f.framesEncoded)/i.statsInterval,d.frame_rate_encoded=Math.round(i.encoderOutputFrameRate),i.sentFrameRate=1e3*i.encodedFrameCount/i.statsInterval,d.frame_rate_sent=Math.round(i.sentFrameRate),i.videoLossRate=(r.packetsLost-f.packetsLost)/(r.packetsSent-f.packetsSent),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,i._retransmittedRate=(r.retransmittedPacketsSent-f.retransmittedPacketsSent)/(r.packetsSent-f.packetsSent),this.monitor.rtcMediaStatistics(d,{})),t.video=r,i._fractionLost=Math.max(i._fractionLost,i.videoLossRate),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t}(uz),lz=function(e){function t(t){var i=e.call(this,t)||this;return i._videoInWaiting=!1,i}return Z_(t,e),Object.defineProperty(t,"audioStallConfig",{set:function(e){t.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,t.audioStallRatio=null==e?void 0:e.audio_stall_ratio},enumerable:!1,configurable:!0}),t.prototype.setRemoteStreamStatsEvtInterval=function(e,i,r){var n,o;return tv(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,f,_,v,m=this;return iv(this,(function(y){switch(y.label){case 0:return this._timer?[2]:(this.setVar(e,i,r),e.once(wj.ABNORMAL_DISCONNECTION,(function(){m.destroy()})),this._audioStallInterval=-100,this._audioStallRatio=t.audioStallRatio||.6,a={audio:{},video:{}},s=this._stream,c=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),u=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),this.getRemoteVideoStats(u,a),[4,this.getRemoteAudioStats(c,a)]);case 1:return y.sent(),this.delStatsEvtInterval(),d=0,l=0,p=[],f=0,this._setAudioStallCount=function(){if(m._audioStallInterval>0&&void 0!==a.audio.concealedSamples){var e=a.audio.concealedSamples,t=a.audio.totalSamplesReceived,i=zL(),r={isStall:!1,counted:!1,diff:0},n=.5*m._audioStallInterval;m._audioStallCount=function(){return tv(m,void 0,void 0,(function(){var o,a,c,u,h,_,v,m,y,g,S,E,b,I,T;return iv(this,(function(A){switch(A.label){case 0:return o=s.hasAudio,a=s.subAudio,o&&a?(c=null===(T=s.audioTrack)||void 0===T?void 0:T.getTrack(),u=Date.now(),[4,this.handler.getStats(c,!0)]):(r.isStall=!1,r.counted=!1,p.push({reason:"hasAudio: ".concat(o,", subAudio: ").concat(a)}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]);case 1:return h=A.sent(),_=Date.now(),v=zL(),(m=v-i)<n?(p.push({diff:m,start:i,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_,reason:"diff(".concat(m,") < minInterval(").concat(n,")")}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]):(y=h.length,g=h.find((function(e){return"inbound-rtp"===e.type})),g?(S=g.concealedSamples,E=g.totalSamplesReceived,I=E-t,(b=S-e)>=0&&I>=0&&b>=this._audioStallRatio*I?(p.push({concealed:b,received:I,diff:m,start:i,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_,is_stall:!0}),r.isStall?(r.counted?l+=m:(l=l+r.diff+m,d++),r.counted=!0):m>=200?(l+=m,d++,r.counted=!0):(r.counted=!1,r.diff=m),r.isStall=!0):(p.push({concealed:b,received:I,diff:m,start:i,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_}),r.isStall=!1,r.counted=!1),e=S,t=E,i=v,f++,[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]):(p.push({diff:m,start:i,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_,reason:y?"no inbound-rtp":"no report"}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]))}}))}))},h=function(){return tv(m,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return console.log("=================== stallLoop"),!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),this._audioStallCount?[4,this._audioStallCount()]:[3,2];case 1:e.sent(),this._audioStallTimer&&clearTimeout(this._audioStallTimer),this._audioStallTimer=setTimeout(h,this._audioStallInterval),e.label=2;case 2:return[2]}}))}))},m._audioStallTimer&&clearTimeout(m._audioStallTimer),m._audioStallTimer=setTimeout(h,m._audioStallInterval)}},this._setAudioStallCount(),_=function(){return tv(m,void 0,void 0,(function(){var e,t,i,r,n,o;return iv(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getRemoteAudioStats(e,a)];case 1:return i=c.sent(),d=0,l=0,p=[],f=0,[4,this.getRemoteVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen,userId:s.userId}]}}))}))},v=function(){return tv(m,void 0,void 0,(function(){var e,t;return iv(this,(function(i){switch(i.label){case 0:return[4,_()];case 1:return e=i.sent(),null===(t=this.client)||void 0===t||t.emit("onRemoteStreamStats",e),h&&(this._audioStallTimer&&clearTimeout(this._audioStallTimer),this._audioStallTimer=setTimeout(h,this._audioStallInterval)),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(v,2e3),[2]}}))}))},this._timer&&clearTimeout(this._timer),this._timer=setTimeout(v,2e3),[2]}}))}))},t.prototype.delStatsEvtInterval=function(){e.prototype.delStatsEvtInterval.call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0},t.prototype.unsubscribe=function(){this.delStatsEvtInterval(),this._videoInWaiting=!1},t.prototype.getRemoteAudioStats=function(e,t){return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g;return iv(this,(function(S){switch(S.label){case 0:return i={},r={},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.audioMid,u=n.subMediaType,d=n._attributes,l={media_type:"audio",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:c,track_enabled:null==e?void 0:e.enabled,connection_status:navigator.onLine,mute_state:pU(u)?"mute_state_off":"mute_state_on",remote_user_capture_state:d.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:d.localaudio&&d.audiostream?"mute_state_off":"mute_state_on"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(h=S.sent()).length?(h.forEach((function(e){var t=e.type,n=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,f=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,y=e.currentRoundTripTime,g=e.audioLevel,S=e.totalAudioEnergy,E=e.totalSamplesDuration,b=e.mimeType,I=e.googDecodingNormal,T=e.googDecodingMuted,A=e.fecPacketsReceived,R=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesSent,w=e.nominated,k=e.id,N=e.writable,P=e.jitter,D=e.candidateType,M=e.ip,L=e.address,U=e.networkType,x=e.port,V=e.protocol,F=e.audioOutputLevel,B=e.requestsReceived,j=e.responsesReceived,G=e.requestsSent,H=e.consentRequestsSent,z=e.responsesSent,K=e.ssrc,W=e.kind;"inbound-rtp"===t?(r.packetsLost=n,r.packetsReceived=o,l.packetsReceived=o,r.bytesReceived=a,l.bytes=a,void 0!==s&&(i.jitterBufferDelay=s/c*1e3,l.average_jitter_buffer_delay_ms=i.jitterBufferDelay),void 0!==h&&(r.totalSamplesReceived=h,i.concealedSamples=p,r.concealedSamples=p,r.silentConcealedSamples=f,l.concealedSamples=p,i.concealmentEvents=_,l.totalSamplesReceived=h),void 0!==A&&(l.fec_packets_received=A),l.jitter=1e3*P,l.ssrc=K,void 0!==g&&(l.audio_level=g?-10*Math.log10(Math.pow(g,2)):g),void 0!==g&&(l.volume=255*g),void 0!==S&&(l.total_audio_energy=S),void 0!==E&&(l.totalAudioDuration=E)):"codec"===t?(i.recordSampleRate=u,d&&(i.numChannels=d),l.codecName=b):"candidate-pair"===t?(l.ice_available_incoming_bitrate=R,l.ice_available_outgoing_bitrate=C,l.ice_bytes_received=a,l.ice_bytes_sent=O,l.ice_nominated=+w,l.ice_pair_id=k,l.ice_pair_rtt=y,l.rtt=1e3*y,l.ice_pair_state=m,l.ice_pair_writable=N,l.recv_ping_requests=B,l.recv_ping_responses=j,l.sent_ping_requests_before_first_response=G,l.sent_ping_requests_total=G+(H||0),l.sent_ping_responses=z,"succeeded"===m&&(i.rtt=1e3*y,i.total_rtt=1e3*v)):"track"===t&&"audio"===W?(l.audio_level=g?-10*Math.log10(Math.pow(g,2)):g,l.volume=255*g,l.total_audio_energy=S,l.totalAudioDuration=E):"ssrc"===t?(l.decodingNormal=I,l.recvAudioLevel=F,l.decodingMuted=T):"local-candidate"===t?(l.local_candidate_type=D,l.local_ip=M||L,l.local_network_type=U,l.local_port=x,l.protocol=V):"remote-candidate"===t&&(l.remote_candidate_type=D,l.remote_ip=M||L,l.remote_port=x)})),(p=t.audio).timestamp?(f={},void 0!==r.concealedSamples&&(l.interval_concealed_samples=r.concealedSamples-p.concealedSamples,l.interval_samples_received=r.totalSamplesReceived-p.totalSamplesReceived,l.interval_silent_concealed_samples=r.silentConcealedSamples-p.silentConcealedSamples),this._audioStallInterval>0&&void 0!==p.concealedSamples?(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),this._audioStallCount?[4,this._audioStallCount()]:[3,3]):[3,3]):(r.timestamp=Date.now(),t.audio=r,[2,i])):[2,i];case 2:_=S.sent(),v=_.stall_count,m=_.stall_duration,y=_.stall_list,g=_.stats_count,f.stall_list=y,f.stats_count=g,l.concealedSamples===l.interval_concealed_samples&&l.totalSamplesReceived===l.interval_samples_received?(l.stall_count=0,l.stall_duration=0):(l.stall_count=v,l.stall_duration=m),i.stallCount=l.stall_count,i.stallDuration=l.stall_duration,S.label=3;case 3:return r.timestamp=Date.now(),i.audioLossRate=(r.packetsLost-p.packetsLost)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,l.packetsLost=Math.round(r.packetsLost-p.packetsLost),l.fraction_lost=i.audioLossRate,l.packets_lost_rate=i.audioLossRate,i.statsInterval=r.timestamp-p.timestamp,l.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-p.bytesReceived||0)/i.statsInterval*8,l.bitrate=Math.round(1e3*i.receivedKBitrate),l.bandwidth=Math.round(l.bitrate/1024),void 0!==r.concealedSamples&&(i.receivedSampleRate=1e3*l.interval_samples_received/i.statsInterval),t.audio=r,l.total_audio_play_energy=this._stream.getRecordAudioEnergy(),this.monitor.rtcMediaStatistics(l,{},f),[2,i]}}))}))},t.prototype.getRemoteVideoStats=function(e,t){return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p;return iv(this,(function(f){switch(f.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.subMediaType,u=n._attributes,l=[{media_type:"video",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,mute_state:fU(c)?"mute_state_off":"mute_state_on",remote_user_capture_state:u.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:u.localvideo&&u.videostream?"mute_state_off":"mute_state_on"}],[4,this._stream.requestVideoFrameCallback()];case 1:return d=$_.apply(void 0,l.concat([f.sent()])),e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 2:return(h=f.sent()).length?(h.forEach((function(e){var t=e.type,n=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,f=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,y=e.nominated,g=e.id,S=e.currentRoundTripTime,E=e.state,b=e.writable,I=e.candidateType,T=e.ip,A=e.address,R=e.networkType,C=e.port,O=e.nackCount,w=e.pliCount,k=e.protocol,N=e.requestsReceived,P=e.responsesReceived,D=e.requestsSent,M=e.consentRequestsSent,L=e.responsesSent,U=e.ssrc;e.kind;var x=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(r.packetsLost=a,d.packetsLost=a,r.packetsReceived=s,d.packetsReceived=s,r.bytesReceived=c,d.bytes=c,r.framesDecoded=u,void 0!==l&&(r.jitterBufferDelay=l/h*1e3,d.average_jitter_buffer_delay_ms=r.jitterBufferDelay),d.fir_count=f,d.nackCount=O,r.nackCount=O,d.pli_count=w,r.pliCount=w,d.ssrc=U,d.jitter=x,d.framesReceived=V,r.framesReceived=V,d.framesDecoded=u,d.key_frames_decoded=F,d.total_decode_time=B,d.decoder_name=j,d.last_packet_received_timestamp=G):"track"===t&&void 0!==o?(i.width=o,d.frame_size_width=o,i.height=n,d.frame_size_height=n,void 0!==V&&(d.framesReceived=V,r.framesReceived=V)):"codec"===t?d.codecName=p:"candidate-pair"===t?(d.ice_available_incoming_bitrate=_,d.ice_available_outgoing_bitrate=v,d.ice_bytes_received=c,d.ice_bytes_sent=m,d.ice_nominated=+y,d.ice_pair_id=g,d.ice_pair_rtt=S,d.rtt=1e3*S,i.rtt=d.rtt,d.ice_pair_state=E,d.ice_pair_writable=b,d.recv_ping_requests=N,d.recv_ping_responses=P,d.sent_ping_requests_before_first_response=D,d.sent_ping_requests_total=D+(M||0),d.sent_ping_responses=L):"local-candidate"===t?(d.local_candidate_type=I,d.local_ip=T||A,d.local_network_type=R,d.local_port=C,d.protocol=k):"remote-candidate"===t&&(d.remote_candidate_type=I,d.remote_ip=T||A,d.remote_port=C)})),(p=t.video).timestamp?(i.videoLossRate=(r.packetsLost-p.packetsLost)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i._retransmittedRate=(r.nackCount-p.nackCount)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,d.packets_lost_rate=i.videoLossRate,i.statsInterval=r.timestamp-p.timestamp,d.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-p.bytesReceived||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.decoderOutputFrameRate=1e3*(r.framesDecoded-p.framesDecoded)/i.statsInterval,i.receivedFrameRate=1e3*(r.framesReceived-p.framesReceived)/i.statsInterval,(0===p.framesDecoded&&r.framesReceived>100||r.pliCount>15)&&(i.needResub=!0),d.frame_rate_decoded=Math.round(i.decoderOutputFrameRate),d.frame_rate_received=Math.round(i.receivedFrameRate),t.video=r,this.processStall(this._stream,d,i,s),this.monitor.rtcMediaStatistics(d,{}),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t.prototype.processStall=function(e,t,i,r){var n=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(n+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,n=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=n,r?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,i.stallCount=n,i.stallDuration=o},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1},t}(uz);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(rz||(rz={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed"}(nz||(nz={})),function(e){e.TranscodeStateChanged="TranscodeStateChanged",e.TranscodeStarted="TranscodeStarted",e.TranscodeUpdated="TranscodeUpdated",e.TranscodeStoped="TranscodeStoped"}(oz||(oz={})),function(e){e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED"}(az||(az={})),function(e){e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB"}(sz||(sz={})),function(e){e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB"}(cz||(cz={}));var hz,pz=new XF("Stream",0),fz=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Z_(t,e),t.prototype.stopRecordAudioEnergy=function(){delete this._audioPlaybackEnergy},t.prototype.recordAudioEnergy=function(e){"number"!=typeof this._audioPlaybackEnergy&&(this._audioPlaybackEnergy=0),this._audioPlaybackEnergy+=e},t.prototype.getRecordAudioEnergy=function(){if("number"==typeof this._audioPlaybackEnergy){var e=this._audioPlaybackEnergy;return this._audioPlaybackEnergy=0,e}},t.prototype.requestVideoFrameCallback=function(){var e=this;return new Promise((function(t){var i,r=null===(i=e.videoDom)||void 0===i?void 0:i.requestVideoFrameCallback;if("function"==typeof r){var n=function(e,i){var r={};Object.keys(i).forEach((function(e){var t=e.replace(/[a-z]{1}[A-Z]{1}/g,(function(e){return"".concat(e[0],"_").concat(e[1].toLowerCase())}));r["video_".concat(t)]=i[e]})),clearInterval(o),t(r)};r.call(e.videoDom,n);var o=setTimeout((function(){var i;null===(i=e.videoDom)||void 0===i||i.cancelVideoFrameCallback(n),t({})}),500)}else t({})}))},t}(JF);!function(e){e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED"}(hz||(hz={}));var _z,vz,mz,yz,gz=function(e){function t(){var t=e.call(this)||this;return t.isScreen=!1,t.seiList=[],t.videoEncodeConfig=[qV],t.subVideoDescriptions=[],t.enableSimulcast=!1,t.prevScaleResolutionDownBy=1,t.pubAudio=!1,t.pubVideo=!1,t.stream=new MediaStream,t.videoInputConfig={width:640,height:360,frameRate:30},t.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},t.statsReport=new dz(t),t}return Z_(t,e),Object.defineProperty(t.prototype,"hasPublished",{get:function(){return this.audioMid&&this.videoMid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(hG()){var i=t.createEncodedStreams(),r=i.readable,n=i.writable,o=new TransformStream({transform:function(t,i){var r=e.seiList[0];if(r){var n=iz.generateSEI(r.content),o=new Uint8Array(n.byteLength+t.data.byteLength);0===r.repeatCount&&e.seiList.splice(0,1),r.repeatCount--,o.set(new Uint8Array(t.data)),o.set(n,t.data.byteLength),t.data=o.buffer,i.enqueue(t)}else i.enqueue(t)}});r.pipeThrough(o).pipeTo(n)}}else pz.print("no sender found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else pz.print("no sender found when trying to bind encodedTransform")},t.prototype.clean=function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]},t.prototype.switchTrackEnableState=function(e,t){var i;"audio"===e?i=this.audioTrack:"video"===e&&(i=this.videoTrack);var r=null==i?void 0:i.getTrack();return!(!r||(null==r?void 0:r.enabled)===t)&&(r.enabled=t,!0)},t}(fz),Sz=function(e){function t(t,i,r,n,o,a){void 0===a&&(a=oL.LOW);var s=e.call(this)||this;return s.userPriority=a,s.originalStreamIndex=0,s._vStats="-V",s._aStats="-A",s.userId=t,s.isScreen=r,s.isPublic=n,s.streamId=i,s.hasAudio=o.audiostream&&o.localaudio,s.hasVideo=o.videostream&&o.localvideo,s._attributes=o,s.subVideo=!1,s.subAudio=!1,s._sequenceId=0,s.subMediaType=WH.NONE,s.subLayer={spatialLayer:0,spatialSubLayer:-1},s.streamState=hz.INIT,s.statsReport=new lz(s),s}return Z_(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSubscribed",{get:function(){return this.streamState===hz.SUB_ED},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),i=t.readable,r=t.writable;i.pipeThrough(new TransformStream({transform:function(t,i){try{e.safeEmit("onTransformData",e.userId,t)}catch(e){}var r=JH.getNalunits(new QH(t.data)).find((function(e){return e.sei}));if(r){var n=iz.decodeSeiBody(r.body);n&&n.type!==qH.internal&&e.safeEmit("onSEIMessage",n.payload)}i.enqueue(t)}})).pipeTo(r)}else pz.print("no receiver found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else pz.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,i,r,n,o,a;try{$F.rtcInvokeStatus(JSON.stringify({uid:this.userId,streamId:this.streamId,streams:e.streams.reduce((function(e,t){return e+(null==(i=t)?"undefined | null":"string"==typeof i?i:JSON.stringify({id:i.id,active:i.active}));var i}),""),transceiver:(n=e.transceiver,null==n?"undefined | null":"string"==typeof n?n:JSON.stringify({currentDirection:n.currentDirection,direction:n.direction,mid:n.mid,stopped:n.stopped,receiver:(a=n.receiver,null==a?"undefined | null":"string"==typeof a?a:JSON.stringify({track:vU(a.track)})),sender:(o=n.sender,null==o?"undefined | null":"string"==typeof o?o:JSON.stringify({track:vU(o.track)}))})),track:vU(e.track)}),0,"Stream.ontrack","",0)}catch(e){}if((null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)===this.streamId){var s=e.track;"video"===(null==s?void 0:s.kind)?this._setVideoTrack(s):"audio"===(null===(r=e.track)||void 0===r?void 0:r.kind)&&this._setAudioTrack(s),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;pz.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()},t.prototype.resetHasSubscribed=function(){this.streamState=hz.INIT},t.prototype.setRemoteUserPriority=function(e){this.userPriority=e},t.prototype.getStreamPriority=function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e},t.prototype.getSubscribeFallbackParams=function(e){if(e!==nL.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,cz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===nL.AUDIO_ONLY)return[JM.VIDEO,cz.UNSUB]}return null},t.prototype.getSubscribeRecoverParams=function(){if(this.originalMediaType&&fU(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,cz.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,cz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,i;(null===(i=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new MH(e,HL()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,i;(null===(i=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new DH(e,HL()),this.emit("ontrack",this.videoTrack))},t.prototype._getSubLayerBySpatialLayer=function(e){var t=this._attributes,i=t.videoDescriptions,r=t.subVideoDescriptions,n=void 0===r?[]:r,o=i[e],a=o.width,s=o.height,c=n.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}},t}(fz),Ez=new XF("queue",4);!function(e){e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE"}(mz||(mz={})),function(e){e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack"}(yz||(yz={}));var bz,Iz,Tz,Az=((_z={})[yz.publish]="unpublish",_z[yz.subscribe]="unsubscribe",_z[yz.pushtrack]="removetrack",_z),Rz=((vz={})[yz.publish]=mz.ADD,vz[yz.subscribe]=mz.ADD,vz[yz.pushtrack]=mz.ADD,vz[yz.unpublish]=mz.CLOSE,vz[yz.unsubscribe]=mz.CLOSE,vz[yz.removetrack]=mz.CLOSE,vz),Cz=function(e){function t(){var t=e.call(this)||this;return t._queue=[],t}return Z_(t,e),Object.defineProperty(t.prototype,"queue",{get:function(){return this._queue},enumerable:!1,configurable:!0}),t.prototype.enqueue=function(e){var t=this._queue.length,i="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==Az[t.action]||(i=t.streamId,Ez.print("offsetStreamId",i),!1)})),this._queue.length===t&&this._queue.push(e),this.emit("start"),i},t.prototype.dequeue=function(){if(!this._queue.length)return null;var e=this._queue.length;nU&&(e=Math.min(this._queue.length,5));for(var t=Rz[this._queue[0].action],i=1;i<e;i++)if(Rz[this._queue[i].action]!==t)return{sdpStrategy:t,items:this._queue.splice(0,i)};return{sdpStrategy:t,items:this._queue.splice(0,e)}},t}(zF),Oz=new XF("ChromeHandler",3),wz=hG(),kz=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="chrome",r._queueBusy=!1,r._mid=0,r._offerMlines=[],r._answerMlines=[],r._inactiveMlineIndex=[],r._msidIndexMap={},r._mlinesCache={},r._sdpQueue=new Cz,r._sdpQueue.on("start",(function(){Oz.print("receive dequeue start","queueBusy: %o: , ss: %o: ",r._queueBusy,r._peerConnection.signalingState),r._queueBusy||"stable"!==r._peerConnection.signalingState||(Oz.print("dequeue start"),r.dequeue())})),r}return Z_(t,e),t.prototype.connect=function(e){var t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y=this;return iv(this,(function(g){switch(g.label){case 0:return Oz.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},o=this,[4,LG(e)];case 1:return o._answerIce=g.sent(),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),[4,this._peerConnection.createOffer()];case 2:return a=g.sent(),[4,(s=new RTCPeerConnection(fG)).setRemoteDescription(a)];case 3:return g.sent(),[4,s.createAnswer()];case 4:return c=g.sent(),[4,s.setLocalDescription(c)];case 5:return g.sent(),s.close(),u=yG.parse(a.sdp),d=yG.parse(c.sdp),(l=!this._offerIce.iceUfrag&&!this._offerIce.icePwd)&&((h="renomination"===(null===(r=u.media[0])||void 0===r?void 0:r.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,p=nv(VG({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=u.media[0])||void 0===n?void 0:n.icePwd,options:(m={},m[UG.kICEConfigTypeSrtpDtlsType]=!0,m[UG.kICEConfigTypeRenominationType]=h,m)}),1),f=p[0],this._answerIce.iceUfrag=f,Oz.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:h}))),_=nv(u.media,1),v=_[0],this._offerIce.fingerprint=u.fingerprint||v.fingerprint,Array.isArray(d.media)&&(d.media=d.media.map((function(e){return"video"===(null==e?void 0:e.type)&&FG(e,"H264"),eU&&"inactive"===(null==e?void 0:e.direction)&&(e.direction="sendonly"),e}))),this._offerSession=$_({},u),this._answerSession=$_({},d),u.media.forEach((function(e,t){var i=y._mid++;l&&(y._offerIce.iceUfrag=v.iceUfrag,y._offerIce.icePwd=v.icePwd),e=$_($_($_({},e),y._offerIce),{mid:"".concat(i)}),y._offerMlines.push(e);var r=$_($_($_({},d.media[t]),y._answerIce),{mid:"".concat(i)});"application"===r.type&&(r.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}),y._answerMlines.push(r)})),this.setDescription(),[4,new Promise((function(e,t){y._dataChannel.onopen=function(){Oz.print("connect","dataChannel open"),cB("es.dc.open",""),e("")},y._dataChannel.onerror=function(e){$F.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,dF.INVALID_DATA),cB("es.dc.error",""),t(e)},y._dataChannel.onclose=function(e){cB("es.dc.close",""),t(e)},y._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==y._peerConnection.iceConnectionState&&"closed"!==y._peerConnection.iceConnectionState&&"failed"!==y._peerConnection.connectionState||t(e)}))}))];case 6:return g.sent(),Oz.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){e.prototype.destroy.call(this),this._mlinesCache={}},t.prototype.publish=function(t,i){return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E;return iv(this,(function(b){return r=t.stream,n=t.enableSimulcast,o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,u="".concat(this._mid++),d="".concat(this._mid++),l=$_($_($_({},this._aSendonlyOfferTpl),this._offerIce),{mid:u,msid:"".concat(r.id," ").concat(r.id,"-audio"),ssrcs:PG(r,"audio")}),h=$_($_($_({},this._vSendonlyOfferTpl),this._offerIce),{mid:d,msid:"".concat(r.id," ").concat(r.id,"-video")}),n?(Oz.print("subVideoDesc","desc: %o ",s),delete h.ssrcGroups,delete h.ssrcs,p=[],h.rids=a.map((function(e){var t=e.rid;return p.unshift(t),{id:t,direction:"send"}})),h.simulcast={dir1:"send",list1:p.join(";")}):(f=function(e,t){var i=NG(),r=NG();return{ssrcs:[i,r].reduce((function(i,r){return i.concat(PG(e,t,r))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(i," ").concat(r)}]}}(r,"video"),_=f.ssrcs,v=f.ssrcGroups,h.ssrcs=_,h.ssrcGroups=v),(JL||eU)&&Array.isArray(h.ext)&&(h.ext=h.ext.filter((function(e){var t;return!(null===(t=null==e?void 0:e.uri)||void 0===t?void 0:t.includes("video-orientation"))}))),(null==i?void 0:i.audioRed)&&Array.isArray(l.rtp)&&-1!==(m=l.rtp.findIndex((function(e){return"red"===e.codec})))&&(y=nv(l.rtp.splice(m,1),1),g=y[0],l.rtp.unshift(g)),location.search.includes("__rtc_vp8__")?FG(h,"VP8"):location.search.includes("__rtc_h264__")&&FG(h,"H264"),(S=null==l?void 0:l.rtp.find((function(e){return"opus"===e.codec})))&&l.fmtp&&(E=l.fmtp.find((function(e){return e.payload===S.payload})))&&this._context&&(E.config+=this._context.audioProfileManager.getOpusConfigStr()),n||JL||this.addBitrateLimit(h,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[l,h],[2,{partialSdp:MG(this._offerSession,l,h),audioMid:u,videoMid:d,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}))}))},t.prototype.subscribe=function(e,t){return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,f;return iv(this,(function(_){switch(_.label){case 0:return Oz.print("subscribe","mids: ",t),i="incroffer",r="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl?[3,3]:[4,dU(!0)];case 1:if(!(n=_.sent()))throw new YB(HB.NOT_SUPPORTED,"Get offer Error");return[4,this.createAVMlineOfferTpl(n)];case 2:_.sent(),_.label=3;case 3:return this._mlinesCache[e.streamId]?(o=nv(this._mlinesCache[e.streamId],2),a=o[0],s=o[1],a.mid=e.audioMid,s.mid=e.videoMid,[2,{partialSdp:MG(this._offerSession,a,s),audioMid:a.mid,videoMid:s.mid,type:i,semantics:r}]):(c="".concat(this._mid++),u="".concat(this._mid++),d=$_($_($_({},this._aRecvonlyOfferTpl),this._offerIce),{mid:c}),l=$_($_($_({},this._vRecvonlyOfferTpl),this._offerIce),{mid:u}),this._mlinesCache[e.streamId]=[d,l],e.isPublic&&((null==(h=null==l?void 0:l.rtp.filter((function(e){return"H264"===e.codec})))?void 0:h.length)&&(null==l?void 0:l.fmtp)&&(null==l||l.fmtp.forEach((function(e){h.find((function(t){return t.payload===e.payload}))&&(e.config+=";sps-pps-idr-in-keyframe=1")}))),(null==l?void 0:l.rtcpFb)&&(p=new Map,f=[],l.rtcpFb.forEach((function(e,t){p.set(e.payload,t)})),p.forEach((function(e,t){f.push({payload:t,idx:e})})),f.sort((function(e,t){return e.idx-t.idx})).forEach((function(e,t){var i;null===(i=null==l?void 0:l.rtcpFb)||void 0===i||i.splice(e.idx+t+1,0,{payload:e.payload,type:"rrtr"})})))),[2,{partialSdp:MG(this._offerSession,d,l),audioMid:c,videoMid:u,type:i,semantics:r,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}}])}}))}))},t.prototype.handleAck=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return Oz.print("handleAck()","item: %o",e),[2,this._sdpQueue.enqueue(e)]}))}))},t.prototype.dequeue=function(){var e,t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L,U=this;return iv(this,(function(x){switch(x.label){case 0:if(this._queueBusy=!0,o=this._sdpQueue.dequeue(),Oz.print("dequeue()","ret: %o",o),!o)return this._queueBusy=!1,[2];x.label=1;case 1:if(x.trys.push([1,24,25,26]),a=o.items,s=o.sdpStrategy,c=[],u=[],d=[],s!==mz.ADD)return[3,20];delete(l=$_({},this._answerIce)).candidates,x.label=2;case 2:x.trys.push([2,13,14,19]),h=av(a),x.label=3;case 3:return[4,h.next()];case 4:return(p=x.sent()).done?[3,12]:(f=p.value,_=f.action,v=f.transceiverInit,m=f.signalingAck,y=f.stream,g=y instanceof Sz,f.onSuccess&&d.push(f.onSuccess),g&&(null==m?void 0:m.sequenceId)<y.sequenceId?[3,12]:(S={},E={},b=yG.parse(m.sdp),Array.isArray(b.media)&&(I="",b.media.sort((function(e,t){var i;return null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.localeCompare(null==t?void 0:t.type)})).forEach((function(e){"audio"===(e=$_($_({},e),l)).type?(S=e,Oz.print("audioMsid",e.msid),e.msid&&(I=e.msid.replace("audio","video"))):(E=e,Oz.print("videoMsid",I),I&&(E.msid=I,I=""))}))),T=y.streamId,_===yz.publish&&(T=null===(i=y.stream)||void 0===i?void 0:i.id),this._mlinesCache[T]?(A=nv(this._mlinesCache[T],2),R=A[0],C=A[1],v?(_===yz.publish&&rU&&(null===(r=null==v?void 0:v.videoTransceiverInit)||void 0===r||delete r.sendEncodings),y.audioTransceiver=this._peerConnection.addTransceiver(v.aTrack,v.audioTransceiverInit),y.videoTransceiver=this._peerConnection.addTransceiver(v.vTrack,v.videoTransceiverInit),this.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:vU(v.aTrack),videoStreamTrack:vU(v.vTrack)}),0,"chromeHandler.addTrack","",0),(O=this._inactiveMlineIndex.shift())||(O=this._offerMlines.length),this._offerMlines[O]=$_($_({},R),{mid:S.mid}),this._answerMlines[O]=S,(w=this._inactiveMlineIndex.shift())||(w=this._offerMlines.length),this._offerMlines[w]=$_($_({},C),{mid:E.mid}),this._answerMlines[w]=E,this._msidIndexMap[y.streamId]=[O,w],wz&&(y.initAudioEncodedTransform(),y.initVideoEncodedTransform()),c.push(y.streamId||""),u.push(g?y.userId:"local"),[3,10]):[3,5]):[3,12]));case 5:return g?(k=nv(this._msidIndexMap[y.streamId]||[],2),N=k[0],P=k[1],N&&P?(null===(n=this._offerMlines[N])||void 0===n?void 0:n.mid)===S.mid?[3,8]:(this._offerMlines[N]=DG(this._offerMlines[N]),this._offerMlines[P]=DG(this._offerMlines[P]),this._answerMlines[N]=DG(this._answerMlines[N]),this._answerMlines[P]=DG(this._answerMlines[P]),[4,this._peerConnection.createOffer()]):[3,9]):[3,10];case 6:return x.sent(),[4,this.setDescription()];case 7:x.sent(),this._offerMlines[N]=$_($_({},this._aRecvonlyOfferTpl),{mid:S.mid}),this._offerMlines[P]=$_($_({},this._vRecvonlyOfferTpl),{mid:E.mid}),Oz.print("enqueue","hack: %o",y.streamId),x.label=8;case 8:return this._answerMlines[N]=S,this._answerMlines[P]=E,[3,10];case 9:Oz.print("dequeue","pushtrack before subscribe: %o",y.userId),x.label=10;case 10:g&&(y.sequenceId=null==m?void 0:m.sequenceId),x.label=11;case 11:return[3,3];case 12:return[3,19];case 13:return D=x.sent(),e={error:D},[3,19];case 14:return x.trys.push([14,,17,18]),p&&!p.done&&(t=h.return)?[4,t.call(h)]:[3,16];case 15:x.sent(),x.label=16;case 16:return[3,18];case 17:if(e)throw e.error;return[7];case 18:return[7];case 19:return[3,21];case 20:M={},a.forEach((function(e){var t,i=e.audioMid,r=e.videoMid;M[i]=i,M[r]=r,delete U._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return M[e.mid]&&(e=DG(e),U._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return M[e.mid]&&(e=DG(e)),e})),x.label=21;case 21:return[4,this._peerConnection.createOffer()];case 22:return x.sent(),[4,this.setDescription(c.length?{streamId:c.join(","),streamUserId:u.join(",")}:void 0)];case 23:x.sent();try{d.forEach((function(e){return e()}))}catch(e){}return Oz.print("dequeue","loop"),[3,26];case 24:return L=x.sent(),Oz.print("dequeue","unknown error: %o",L),[3,26];case 25:return this.dequeue(),[7];case 26:return[2]}}))}))},t.prototype.setDescription=function(e){return tv(this,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:return Oz.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,t=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&t.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=t.join(" "),this._answerSession.groups[0].mids=t.join(" ")),i=zL(),e&&$F.rtcBeginCreateOffer("local"===e.streamUserId?pF.UP:pF.DOWN,e.streamId,e.streamUserId),e&&$F.rtcCreateOffer(0,"local"===e.streamUserId?fF.UP:fF.DOWN,e.streamId,e.streamUserId,zL()-i),[4,this.setLocalDescription(yG.write(this._offerSession),e)];case 1:return r.sent(),[4,this.setRemoteDescription(yG.write(this._answerSession),e)];case 2:return r.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return tv(this,void 0,void 0,(function(){var e,t,i;return iv(this,(function(r){switch(r.label){case 0:return[4,dU(!0)];case 1:if(!(e=r.sent()))throw new YB(HB.NOT_SUPPORTED,"Get offer Error");return this.createAVMlineOfferTpl(e),t=yG.parse(e),i=[],t.media=t.media.filter((function(e){return"recvonly"===e.direction&&(i.push(e.mid+""),!0)})),t.groups=[{mids:i.join(" "),type:"BUNDLE"}],[2,{sdp:yG.write(t),semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.rollback=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return delete this._mlinesCache[e],[2]}))}))},t.prototype.createAVMlineOfferTpl=function(e){var t=this;yG.parse(e).media.forEach((function(e){e.icePwd=t._offerIce.icePwd,e.iceUfrag=t._offerIce.iceUfrag,"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:t._aRecvonlyOfferTpl=e:"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:t._vRecvonlyOfferTpl=e)}))},t}(vG),Nz=new XF("FirefoxHandler",3),Pz=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="firefox",r}return Z_(t,e),t.prototype.connect=function(e){var t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_=this;return iv(this,(function(v){switch(v.label){case 0:return Nz.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},o=this,[4,LG(e)];case 1:return o._answerIce=v.sent(),[4,this._peerConnection.createOffer()];case 2:return a=v.sent(),s=yG.parse(a.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((c="renomination"===(null===(r=s.media[0])||void 0===r?void 0:r.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,u=nv(VG({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=s.media[0])||void 0===n?void 0:n.icePwd,options:(f={},f[UG.kICEConfigTypeSrtpDtlsType]=!0,f[UG.kICEConfigTypeRenominationType]=c,f)}),1),d=u[0],this._answerIce.iceUfrag=d,Nz.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:c}))),l=nv(s.media,1),h=l[0],this._offerIce.fingerprint=s.fingerprint||h.fingerprint,s.media=s.media.map((function(e){return $_($_({},e),_._offerIce)})),(p=$_({},s)).fingerprint=this._answerIce.fingerprint,p.media=p.media.map((function(e){return $_($_($_({},e),_._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(yG.write(s))];case 3:return v.sent(),[4,this.setRemoteDescription(yG.write(p))];case 4:return v.sent(),[4,new Promise((function(e,t){_._dataChannel.onopen=function(){Nz.print("connect","dataChannel open"),cB("es.dc.open",""),e("")},_._dataChannel.onerror=function(e){$F.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,dF.INVALID_DATA),cB("es.dc.error",""),t(e)},_._dataChannel.onclose=function(e){cB("es.dc.close",""),t(e)},_._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==_._peerConnection.iceConnectionState&&"closed"!==_._peerConnection.iceConnectionState&&"failed"!==_._peerConnection.connectionState||t(e)}))}))];case 5:return v.sent(),Nz.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,i){var r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v=this;return iv(this,(function(m){switch(m.label){case 0:return o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(c.aTrack,c.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(c.vTrack,c.videoTransceiverInit),u=zL(),$F.rtcBeginCreateOffer(pF.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return d=m.sent(),$F.rtcCreateOffer(0,fF.UP,"","",zL()-u),(l=yG.parse(d.sdp)).media=null===(r=l.media)||void 0===r?void 0:r.map((function(e){return $_($_({},e),v._offerIce)})),[4,this.setLocalDescription(yG.write(l))];case 2:return m.sent(),h=t.audioTransceiver.mid,p=t.videoTransceiver.mid,f=null,_=null,l.media=null===(n=l.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===h){var t=null==(f=e)?void 0:f.rtp.find((function(e){return"opus"===e.codec}));if(t&&f.fmtp){var i=f.fmtp.find((function(e){return e.payload===t.payload}));i&&v._context&&(i.config+=v._context.audioProfileManager.getOpusConfigStr())}}else"".concat(e.mid)===p&&(_=e);return e})),this.addBitrateLimit(_,t.videoEncodeConfig[0].maxKbps),[4,this.setLocalDescription(yG.write(l))];case 3:return m.sent(),[2,{partialSdp:MG(l,f,_),audioMid:h,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}}))}))},t.prototype.subscribe=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d=this;return iv(this,(function(l){switch(l.label){case 0:return Nz.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),r=zL(),$F.rtcBeginCreateOffer(pF.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return n=l.sent(),$F.rtcCreateOffer(0,fF.UP,e.streamId,e.userId,zL()-r),(o=yG.parse(n.sdp)).media=null===(t=o.media)||void 0===t?void 0:t.map((function(e){return $_($_({},e),d._offerIce)})),[4,this.setLocalDescription(yG.write(o),{streamId:e.streamId||"",streamUserId:e.userId})];case 2:return l.sent(),a=e.audioTransceiver.mid,s=e.videoTransceiver.mid,c=null,u=null,null===(i=o.media)||void 0===i||i.forEach((function(e){"".concat(e.mid)===a?c=e:"".concat(e.mid)===s&&(u=e)})),[2,{partialSdp:MG(o,c,u),audioMid:a,videoMid:s,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c=this;return iv(this,(function(u){return e.action===yz.unpublish||e.action===yz.unsubscribe||(r=e.signalingAck,n={},(o=yG.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),yG.parse(null==r?void 0:r.sdp).media.forEach((function(e){n[e.mid]=$_($_({},e),c._answerIce)})),a=[],(s=yG.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media.forEach((function(e){a.push(n[e.mid])})),o.groups=s.groups,o.media=a,this.setRemoteDescription(yG.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){return[2,{semantics:"unified-plan",sdp:"",type:"offer"}]}))}))},t.prototype.rollback=function(e,t){var i,r;return tv(this,void 0,void 0,(function(){var e,n,o;return iv(this,(function(a){switch(a.label){case 0:return Nz.print("rollback()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=yG.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media=n.media.map((function(i){return"".concat(i.mid)!==t.audioMid&&"".concat(i.mid)!==t.videoMid||(i=DG(i)),"inactive"!==i.direction&&e.push(i.mid),i})),(o=yG.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media=o.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=DG(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this._peerConnection.createOffer()]):[3,4];case 1:return a.sent(),[4,this.setLocalDescription(yG.write(n))];case 2:return a.sent(),[4,this.setRemoteDescription(yG.write(o))];case 3:a.sent(),a.label=4;case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this._peerConnection.createOffer()];case 1:return e.sent(),this._peerConnection.localDescription&&this._peerConnection.remoteDescription?[4,this._peerConnection.setLocalDescription(this._peerConnection.localDescription)]:[3,4];case 2:return e.sent(),[4,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},t}(vG),Dz=new XF("FallbackHandler",3),Mz=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="fallback",Dz.print("ctor","using fallback handler"),t.rtcError("using fallback handler",-1),r}return Z_(t,e),t.prototype.connect=function(e){var t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_=this;return iv(this,(function(v){switch(v.label){case 0:return Dz.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},o=this,[4,LG(e)];case 1:return o._answerIce=v.sent(),[4,this._peerConnection.createOffer()];case 2:return a=v.sent(),s=yG.parse(a.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((c="renomination"===(null===(r=s.media[0])||void 0===r?void 0:r.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,u=nv(VG({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=s.media[0])||void 0===n?void 0:n.icePwd,options:(f={},f[UG.kICEConfigTypeSrtpDtlsType]=!0,f[UG.kICEConfigTypeRenominationType]=c,f)}),1),d=u[0],this._answerIce.iceUfrag=d,Dz.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:c}))),l=nv(s.media,1),h=l[0],this._offerIce.fingerprint=s.fingerprint||h.fingerprint,s.media=s.media.map((function(e){return $_($_({},e),_._offerIce)})),(p=$_({},s)).fingerprint=this._answerIce.fingerprint,p.media=p.media.map((function(e){return $_($_($_({},e),_._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(a.sdp)];case 3:return v.sent(),[4,this.setRemoteDescription(yG.write(p))];case 4:return v.sent(),[4,new Promise((function(e,t){_._dataChannel.onopen=function(){Dz.print("connect","dataChannel open"),cB("es.dc.open",""),e("")},_._dataChannel.onerror=function(e){$F.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,dF.INVALID_DATA),cB("es.dc.error",""),t(e)},_._dataChannel.onclose=function(e){cB("es.dc.close",""),t(e)},_._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==_._peerConnection.iceConnectionState&&"closed"!==_._peerConnection.iceConnectionState&&"failed"!==_._peerConnection.connectionState||t(e)}))}))];case 5:return v.sent(),Dz.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,i){var r;return tv(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f;return iv(this,(function(_){switch(_.label){case 0:return n=e.prototype.internalPublish.call(this,t,i),o=n.videoDescriptions,a=n.subVideoDescriptions,s=n.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(s.aTrack,s.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(s.vTrack,s.videoTransceiverInit),c=zL(),$F.rtcBeginCreateOffer(pF.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return u=_.sent(),$F.rtcCreateOffer(0,fF.UP,"","",zL()-c),d=yG.parse(u.sdp),[4,this.setLocalDescription(u.sdp)];case 2:return _.sent(),l=t.audioTransceiver.mid,h=t.videoTransceiver.mid,p=null,f=null,d.media=null===(r=d.media)||void 0===r?void 0:r.map((function(e){return"".concat(e.mid)===l?p=e:"".concat(e.mid)===h&&(f=e),e})),hG()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),[2,{partialSdp:MG(d,p,f),audioMid:l,videoMid:h,type:"incroffer",semantics:"unified-plan",videoDescriptions:o,subVideoDescriptions:a,transceiverInit:s}]}}))}))},t.prototype.subscribe=function(e){var t;return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c;return iv(this,(function(u){switch(u.label){case 0:return Dz.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),i=zL(),$F.rtcBeginCreateOffer(pF.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return r=u.sent(),$F.rtcCreateOffer(0,fF.UP,e.streamId,e.userId,zL()-i),n=yG.parse(r.sdp),[4,this.setLocalDescription(r.sdp,{streamId:e.streamId||"",streamUserId:e.userId})];case 2:return u.sent(),o=e.audioTransceiver.mid,a=e.videoTransceiver.mid,s=null,c=null,null===(t=n.media)||void 0===t||t.forEach((function(e){"".concat(e.mid)===o?s=e:"".concat(e.mid)===a&&(c=e)})),hG()&&(e.initVideoEncodedTransform(),e.initAudioEncodedTransform()),[2,{partialSdp:MG(n,s,c),audioMid:o,videoMid:a,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c=this;return iv(this,(function(u){return e.action===yz.unpublish||e.action===yz.unsubscribe||(r=e.signalingAck,n={},(o=yG.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),yG.parse(null==r?void 0:r.sdp).media.forEach((function(e){n[e.mid]=$_($_({},e),c._answerIce)})),a=[],(s=yG.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media.forEach((function(e){a.push(n[e.mid])})),o.groups=s.groups,o.media=a,this.setRemoteDescription(yG.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){return[2,{semantics:"unified-plan",sdp:"",type:"offer"}]}))}))},t.prototype.rollback=function(e,t){var i,r;return tv(this,void 0,void 0,(function(){var e,n,o,a;return iv(this,(function(s){switch(s.label){case 0:return Dz.print("rollback()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=yG.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media=n.media.map((function(i){return"".concat(i.mid)!==t.audioMid&&"".concat(i.mid)!==t.videoMid||(i=DG(i)),"inactive"!==i.direction&&e.push(i.mid),i})),(o=yG.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media=o.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=DG(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this._peerConnection.createOffer()]):[3,4];case 1:return a=s.sent(),[4,this.setLocalDescription(a.sdp)];case 2:return s.sent(),[4,this.setRemoteDescription(yG.write(o))];case 3:s.sent(),s.label=4;case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this._peerConnection.createOffer()];case 1:return e.sent(),this._peerConnection.localDescription&&this._peerConnection.remoteDescription?[4,this._peerConnection.setLocalDescription(this._peerConnection.localDescription)]:[3,4];case 2:return e.sent(),[4,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},t}(vG),Lz=function(e,t){return(null==t?void 0:t.enableFallbackHandler)?new Mz(e,t):YL?new Pz(e,t):new kz(e,t)},Uz=new XF("Locker",2),xz=1,Vz=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=xz++,e&&(this.name=e),Uz.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return Object.defineProperty(e.prototype,"isLocked",{get:function(){return this.locks>0},enumerable:!1,configurable:!0}),e.prototype.lock=function(){var e,t=this;this.locks+=1,Uz.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var i=new Promise((function(i){e=function(){t.locks-=1,Uz.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),i()}})),r=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return i})),r},e}();!function(e){e[e.communication=0]="communication",e[e.live_broadcasting=1]="live_broadcasting",e[e.game=2]="game",e[e.cloud_game=3]="cloud_game",e[e.low_latency=4]="low_latency",e[e.chat=5]="chat",e[e.chat_room=6]="chat_room",e[e.lw_together=7]="lw_together",e[e.game_hd=8]="game_hd",e[e.co_host=9]="co_host",e[e.interactive_podcast=10]="interactive_podcast",e[e.ktv=11]="ktv",e[e.chorus=12]="chorus",e[e.vr_chat=13]="vr_chat",e[e.game_streaming=14]="game_streaming",e[e.lan_live_streaming=15]="lan_live_streaming",e[e.meeting=16]="meeting",e[e.meeting_room=17]="meeting_room",e[e.classroom=18]="classroom"}(Iz||(Iz={})),function(e){e.IES_living="IES_living",e.FeedShare="FeedShare",e.fluent="fluent",e.IES_chatroom="IES_chatroom",e.standard="standard",e.IES_PK="IES_PK",e.IES_KTV="IES_KTV"}(Tz||(Tz={}));var Fz,Bz=((bz={})[cL.communication]=[Iz.communication],bz[cL.chat]=[Iz.communication],bz[cL.chatRoom]=[Iz.live_broadcasting,Tz.IES_chatroom],bz[cL.coHost]=[Iz.live_broadcasting,Tz.IES_PK],bz[cL.meeting]=[Iz.meeting],bz[cL.classRoom]=[Iz.communication],bz),jz=new XF("MediaServerClient",2);!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(Fz||(Fz={}));var Gz,Hz=function(e,t){jz.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},zz=function(e){function t(t,i){void 0===i&&(i=$F);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._subResolves={},r.supportConcurrent=!1,r._pubConfig={},r._subConfig={},r._roomProfile=cL.communication,r._subStreamQueue={},r.monitor=i,r._pubSubLock=new Vz("pubSubLock"),r._joinLeaveLock=new Vz("joinLeaveLock"),r._state=Fz.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r._context=t,r.on("SUB_END",(function(e){return r._handleSubStreamQueue(e)})),r}return Z_(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){jz.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(wj.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[Cj.ON_ADD_STREAM,Cj.ON_REMOVE_STREAM,Cj.USER_CONNECTION,Cj.USER_DISCONNECTION,Cj.ON_UPDATE_STREAM_ATTRIBUTES,Cj.ON_UPDATE_ROOM_ATTRIBUTES,Cj.ON_PUSH_TRACK,Cj.ON_REMOVE_TRACK,Cj.NODE_CHANGE,Cj.ON_CUSTOM_MESSAGE,Cj.USER_MESSAGE_RECEIVED,Cj.USER_BINARY_MESSAGE_RECEIVED,Cj.POST_PROCESSING_MESSAGE,Cj.ON_USER_TOKEN_WILL_EXPIRE,Cj.STREAM_CONTROL_MESSAGE,Cj.ON_SCENE_CONFIG,Cj.ON_STREAM_FAILED,Oj.RSCP].forEach((function(e){var i;null===(i=t._dataChannelSignal)||void 0===i||i.on(e,(function(i){t.safeEmit(e,i)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){jz.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(wj.ABNORMAL_DISCONNECTION)}))},t.prototype._removeSignalEventHandler=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()},Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(wj.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.connect=function(e,t,i,r){var n;return void 0===t&&(t=""),void 0===i&&(i=""),void 0===r&&(r={}),tv(this,void 0,void 0,(function(){var o,a,s,c,u,d=this;return iv(this,(function(l){switch(l.label){case 0:return this.connectionState=Fz.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),r.node?(o=[r.node],cB("es.join.nodeChange",r),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new zj,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,i,xV.getDeviceId(),null==r?void 0:r.reason,null==r?void 0:r.feedbackNode,this._useCloudProxy)];case 2:if(!(o=l.sent()))throw cB("es.join.getNodeFailed",""),new YB(HB.ICE_SERVER_WRONG,"get ICE config failed");cB("es.join.getNodeSuccess",o),l.label=3;case 3:this._addHandlerEvents(),Promise.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),l.label=4;case 4:return l.trys.push([4,6,,7]),s=!1,c=o.map((function(e){var t=Lz(d.monitor,d._context);return t.connect(e).then((function(i){s?t.destroy():(s=!0,a=i,d.safeEmit("prevIceNode",e),d._handler=t,d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(){t.destroy()}))})),[4,lU(c)];case 5:return l.sent(),jz.print("join","establish peerConnection success"),[3,7];case 6:throw u=l.sent(),this.connectionState=Fz.DISCONNECTED,new YB(HB.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",u);case 7:if(!a)throw this.connectionState=Fz.DISCONNECTED,new YB(HB.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");return this._dataChannelSignal=new jj(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,i,r){var n,o,a,s,c,u,d,l,h,p,f;return void 0===t&&(t={}),void 0===i&&(i=!1),tv(this,void 0,void 0,(function(){var _,v,m,y,g,S,E,b=this;return iv(this,(function(I){switch(I.label){case 0:return jz.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,i,r),this._appId=e.appId,this._token=e.token,this._roomId=e.roomId,this._clientId=e.userInfo.userId,this._businessId=e.userInfo.businessId,this._userInfo=e.userInfo,this._useCloudProxy=e.useCloudProxy,this._roomProfile=e.roomProfile,this._sessionId=t.sessionId,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return I.sent(),S={Authorization:XL.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId||"",timestamp:Date.now(),controlMessage:r,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role}},E={},[4,lG()];case 2:return S.params=(E.supportedCodecs=I.sent(),E.deviceType="web",E.userAgent=window.navigator.userAgent,E.sdkVersion=jV.VERSION,E.deviceId=xV.getDeviceId(),E.appId=this._appId,E.roomId=this._roomId,E.userId=this._clientId,E.businessId=this._businessId,E.enableCloudProxy=this._useCloudProxy,E.channelProfile=Bz[this._roomProfile]?Bz[this._roomProfile][0]+"":"0",E),S.options={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0},S.accessParams=JSON.stringify({requireICEUfragV2:!0}),_=S,"chrome"!==(null===(n=this.handler)||void 0===n?void 0:n.name)?[3,4]:(v=_,[4,null===(o=this._handler)||void 0===o?void 0:o.getDefaultSdp()]);case 3:v.sdpInfo=I.sent(),_.options.enableUnBundleMode=!0,I.label=4;case 4:Promise.resolve().then((function(){return b.emit("onSendingJoinMessageHook")})),I.label=5;case 5:return I.trys.push([5,7,,8]),m=i?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(m,_)];case 6:return y=I.sent(),jz.print("join","send join message success"),this._authorization=_.Authorization,this.connectionState=Fz.CONNECTED,lz.audioStallConfig=null===(a=y.config)||void 0===a?void 0:a.engine_WEB,this._pubConfig.audioRed=!!(null===(c=null===(s=y.config)||void 0===s?void 0:s.engine_WEB)||void 0===c?void 0:c.pub_audio_red),this._subConfig.muteReplaceUnsub=!!(null===(u=y.config)||void 0===u?void 0:u.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!(!1===(null===(h=null===(l=null===(d=y.config)||void 0===d?void 0:d.engine_VPM)||void 0===l?void 0:l.ondemand)||void 0===h?void 0:h.enable)),null===(p=this._context)||void 0===p||p.audioProfileManager.updateEngineBAC(null===(f=y.config)||void 0===f?void 0:f.engine_BAC),[2,y];case 7:if(g=I.sent(),this.connectionState=Fz.DISCONNECTED,(null==g?void 0:g.code)>=700&&(null==g?void 0:g.code)<800)throw new YB(HB.INVALID_TOKEN,(null==g?void 0:g.message)||"Invalid token");if(200!==(null==g?void 0:g.code))throw new YB(HB.JOIN_ROOM_FAILED,(null==g?void 0:g.message)||"Join room failed");return[3,8];case 8:return[2]}}))}))},t.prototype.publish=function(e){var t,i,r,n,o,a,s,c;return tv(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,y,g=this;return iv(this,(function(S){switch(S.label){case 0:jz.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=zL(),h="",p="",S.label=1;case 1:return S.trys.push([1,6,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(f=S.sent()))throw new YB(HB.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return h=f.audioMid,p=f.videoMid,e.pubAttributes={localaudio:!!d,localvideo:!!u,videostream:e.pubVideo,audiostream:e.pubAudio,extvideo:!!(u instanceof FH),extaudio:!!(d instanceof BH)},_={attributes:$_({videoDescriptions:f.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:h,videoMid:p,sdpInfo:{msid:e.stream.id,type:f.type,sdp:f.partialSdp,semantics:f.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(null===(i=f.subVideoDescriptions)||void 0===i?void 0:i.length)&&(_.attributes.subVideoDescriptions=f.subVideoDescriptions),[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("publish",_)];case 3:if(200!==(null==(v=S.sent())?void 0:v.code))throw new YB(HB.PUBLISH_FAILED,(null==v?void 0:v.message)||"publish failed");return $F.rtcRecvAnswer(0,mF.INCRANSWER,(null===(n=null==v?void 0:v.relayMessage)||void 0===n?void 0:n.sequenceId)||0,null===(o=null==v?void 0:v.relayMessage)||void 0===o?void 0:o.sdp,yF.UP,"",""),m=new Promise((function(t,i){var r,n,o,a,s;null===(r=g._handler)||void 0===r||r.handleAck({action:yz.publish,streamId:v.streamId,audioMid:h,videoMid:p,transceiverInit:f.transceiverInit,signalingAck:{audioMid:null===(n=null==v?void 0:v.relayMessage)||void 0===n?void 0:n.audioMid,videoMid:null===(o=null==v?void 0:v.relayMessage)||void 0===o?void 0:o.videoMid,sdp:null===(a=null==v?void 0:v.relayMessage)||void 0===a?void 0:a.sdp,sequenceId:null===(s=null==v?void 0:v.relayMessage)||void 0===s?void 0:s.sequenceId},stream:e,onSuccess:function(){jz.print("publish()","publish success"),t(0)}})})),"chrome"!==(null===(a=this.handler)||void 0===a?void 0:a.name)?[3,5]:[4,m];case 4:S.sent(),S.label=5;case 5:return rU||null===(s=this._handler)||void 0===s||s.updateDegradationPreference(e),e.streamId=v.streamId,e.videoMid=p,e.audioMid=h,e.subVideoDescriptions=f.subVideoDescriptions,this.monitor.rtcPublishStat(gF.SUCCESS,SF.W_0,l,EF.UNKNOWN),e.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 6:return(y=S.sent())instanceof Error&&this.monitor.rtcPublishStat(gF.FAIL,SF.W_0,l,y.message),[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(e.stream.id,e)];case 7:throw S.sent(),y;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,i,r,n,o,a,s,c,u;return tv(this,void 0,void 0,(function(){var d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L,U;return iv(this,(function(x){switch(x.label){case 0:return jz.print("updatePubTrack()","localStream: %o",e),d=e.videoTrack,l=e.audioTrack,h=e.pubAudio,p=e.pubVideo,f=null==l?void 0:l.getTrack(),_=null==d?void 0:d.getTrack(),p&&_?null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack(_):null===(i=e.videoTransceiver)||void 0===i||i.sender.replaceTrack(null),rU?[3,2]:[4,null===(r=this._handler)||void 0===r?void 0:r.updateDegradationPreference(e)];case 1:x.sent(),x.label=2;case 2:null===(n=this._handler)||void 0===n||n.updateMaxBitrate(e),h&&f?(m=(v=l).mixType,(y=v.mixedAudioTrack)&&m!==sG.PLAYOUT&&!0===f.enabled&&(f=y),null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(f)):(null===(a=e.audioTransceiver)||void 0===a||a.sender.replaceTrack(null),this.monitor.rtcInvokeStatus("null",0,"MediaClient.updatePubTrack(audio)","",0));try{this.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:vU(f),videoStreamTrack:vU(_)}),0,"MediaClient.updatePubTrack","",0)}catch(e){}g={localaudio:!!l,localvideo:!!d,videostream:p,audiostream:h,extvideo:!!(d instanceof FH),extaudio:!!(l instanceof BH)},S={};try{for(E=rv(Object.entries(g)),b=E.next();!b.done;b=E.next())I=nv(b.value,2),T=I[0],(A=I[1])!==Reflect.get(e.pubAttributes,T)&&Reflect.set(S,T,A)}catch(e){L={error:e}}finally{try{b&&!b.done&&(U=E.return)&&U.call(E)}finally{if(L)throw L.error}}return Object.keys(S).length?(e.observer&&(R=e.observer,C=S.audiostream,O=S.videostream,w=S.localaudio,N=S.extaudio,P=S.extvideo,void 0!==(k=S.localvideo)?void 0!==P?R.setPushVideo(P):R.setEnableVideo(k):void 0!==O&&R.setUnmuteVideo(O),void 0!==w?void 0!==N?R.setPushAudio(N):R.setEnableAudio(w):void 0!==C&&R.setUnmuteAudio(C)),e.pubAttributes=g,D={roomId:this._roomId,streamId:e.streamId,attributes:S},[4,null===(s=this._dataChannelSignal)||void 0===s?void 0:s.sendSignaling("updateStreamAttributes",D)]):[2];case 3:if(200!==(null==(M=x.sent())?void 0:M.code))throw new YB(HB.UPDATE_TRACK_FAILED,(null==M?void 0:M.message)||"update track failed");return"chrome"===(null===(c=this.handler)||void 0===c?void 0:c.name)?[3,5]:[4,null===(u=this._handler)||void 0===u?void 0:u.setCurrentDescription()];case 4:x.sent(),x.label=5;case 5:return[2]}}))}))},t.prototype.updateToken=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n,o;return iv(this,(function(a){switch(a.label){case 0:if(jz.print("updateToken()","newToken: %o",e),this._token=e,!this._appId||!(null===(t=this._userInfo)||void 0===t?void 0:t.userId)||!this._roomId)return[2];n={roomId:this._roomId,userId:null===(i=this._userInfo)||void 0===i?void 0:i.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateToken",n)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new YB(HB.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new YB(HB.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n;return iv(this,(function(o){switch(o.label){case 0:return jz.print("unpublish()","localStream: %o",e),n={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},null===(t=this._dataChannelSignal)||void 0===t||t.sendSignaling("unpublish",n),[4,null===(i=this._handler)||void 0===i?void 0:i.handleAck({action:yz.unpublish,audioMid:e.audioMid,videoMid:e.videoMid,stream:e,streamId:e.streamId})];case 1:return o.sent(),e.statsReport.unpublish(),[4,null===(r=this._handler)||void 0===r?void 0:r.rollback(e.stream.id,e)];case 2:return o.sent(),[2]}}))}))},t.prototype.subscribe=function(e,t,i){return tv(this,void 0,void 0,(function(){var r=this;return iv(this,(function(n){return[2,new Promise((function(n,o){return tv(r,void 0,void 0,(function(){var r,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L,U,x,V=this;return iv(this,(function(F){switch(F.label){case 0:if(e.streamState===hz.SUB_ED)return[2,this._updateSubTrack(e,t,cz.SUB).then(n,o)];if(e.streamState===hz.SUB_ING)return this._subStreamQueue[e.streamId]||(this._subStreamQueue[e.streamId]=[]),jz.print("_subStreamQueue","streamId: %o, enqueue",e.streamId),this._subStreamQueue[e.streamId].push({fn:this.subscribe,args:[e,t,i],resolve:n,reject:o}),[2];if(jz.print("subscribe()","mediaType: %o",t),Hz("subscribe()",e),e.streamState=hz.SUB_ING,r=!1,a=!1,pU(t)&&(a=!0),fU(t)&&(r=!0),!r&&this._multiChatMode())return e.streamState=hz.INIT,this.emit("SUB_END",e.streamId),[2,n(null)];s=zL(),c=e.audioMid,u=e.videoMid,l=e.paused,h=e.subVideo,F.label=1;case 1:return F.trys.push([1,9,,11]),c&&u?[4,null===(R=this._handler)||void 0===R?void 0:R.subscribe(e,{audioMid:c,videoMid:u})]:[3,3];case 2:return d=F.sent(),[3,5];case 3:return[4,null===(C=this._handler)||void 0===C?void 0:C.subscribe(e)];case 4:if(!(d=F.sent()))throw new YB(HB.ADD_TRANSCEIVER_FAILED,"add transceiver failed");c=d.audioMid,u=d.videoMid,F.label=5;case 5:return e.paused=!r,e.subVideo=r,p={spatialLayer:(null==i?void 0:i.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==i?void 0:i.spatialSubLayer)||-1},f={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:u,audioMid:c,sdpInfo:{sdp:null==d?void 0:d.partialSdp,semantics:null==d?void 0:d.semantics,type:null==d?void 0:d.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||a,video:r},qualityLayer:p}},[4,null===(O=this._dataChannelSignal)||void 0===O?void 0:O.sendSignaling("subscribe",f)];case 6:if(200!==(null==(_=F.sent())?void 0:_.code))throw new YB(HB.SUBSCRIBE_FAILED,(null==_?void 0:_.message)||"subscribe failed");return v=[],m=!this._multiChatMode(),y=!e.videoTrack,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),y&&v.push(new Promise((function(t,i){V._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new YB(HB.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),6e4);e.on("ontrack",(function i(n){"video"===n.mediaType&&(jz.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),m&&v.push(new Promise((function(t,i){V._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new YB(HB.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),6e4);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(jz.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),g=function(t){e.ontrack(t)},null===(w=this._handler)||void 0===w||w.on("ontrack",g),this._ontrackCallbackMap.set(e,g),S=null==_?void 0:_.relayMessage,E=S.audioMid,b=S.videoMid,(A={})[c]=E,A[u]=b,I=A,jz.print("sub midmap",e.userId,I),e.videoMid=b,e.audioMid=E,e._workaround_1_=!1,e.subMediaType=t,e.streamState=hz.SUB_ED,e.subLayer=p,$F.rtcRecvAnswer(0,mF.INCRANSWER,(null===(k=null==_?void 0:_.relayMessage)||void 0===k?void 0:k.sequenceId)||0,null===(N=null==_?void 0:_.relayMessage)||void 0===N?void 0:N.sdp,yF.DOWN,e.streamId,e.userId),[4,null===(P=this._handler)||void 0===P?void 0:P.handleAck({action:yz.subscribe,streamId:e.streamId,audioMid:c,videoMid:u,transceiverInit:null==d?void 0:d.transceiverInit,signalingAck:{audioMid:null===(D=null==_?void 0:_.relayMessage)||void 0===D?void 0:D.audioMid,videoMid:null===(M=null==_?void 0:_.relayMessage)||void 0===M?void 0:M.videoMid,sdp:null===(L=null==_?void 0:_.relayMessage)||void 0===L?void 0:L.sdp,sequenceId:null===(U=null==_?void 0:_.relayMessage)||void 0===U?void 0:U.sequenceId},stream:e})];case 7:return F.sent(),[4,Promise.all(v)];case 8:return F.sent(),this._multiChatMode()||(e.subAudio=a),this.monitor.rtcSubscribeStat(bF.SUCCESS,s,IF.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),n(null),this.emit("SUB_END",e.streamId),[3,11];case 9:return(T=F.sent())instanceof Error&&this.monitor.rtcSubscribeStat(bF.FAIL,s,T.message,e.userId),e.paused=l,e.subVideo=h,e.streamState=hz.INIT,[4,null===(x=this._handler)||void 0===x?void 0:x.rollback(e.streamId,e)];case 10:return F.sent(),o(T),this.emit("SUB_END",e.streamId),[3,11];case 11:return[2]}}))}))}))]}))}))},t.prototype._handleSubStreamQueue=function(e){var t,i=this;if(null===(t=this._subStreamQueue[e])||void 0===t?void 0:t.length){jz.print("_subStreamQueue","streamId: %o, exec",e);var r=this._subStreamQueue[e].shift(),n=r.fn,o=r.args,a=r.resolve,s=r.reject;n.apply(this,o).then(a,s).finally((function(){return i._handleSubStreamQueue(e)}))}else jz.print("_subStreamQueue","streamId: %o, END",e)},t.prototype.controlMessage=function(e){var t;return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:return jz.print("controlMessage()","params: %o",e),i=e,"transcode"===e.type&&(i.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",i)];case 1:return r.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return tv(this,void 0,void 0,(function(){return iv(this,(function(i){switch(i.label){case 0:return jz.print("updateUserAttributes()","attributes: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:e})];case 1:return i.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){return tv(this,void 0,void 0,(function(){return iv(this,(function(r){return[2,this._updateSubTrack(e,t,i)]}))}))},t.prototype.updateSubTrackLayer=function(e,t){var i;return tv(this,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:return jz.print("updateSubTrack()","subLayer: %o",t),r=t||e.subLayer,n={roomId:this._roomId,streamList:[e.streamId],config:{qualityLayer:r}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",n)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new YB(HB.UPDATE_TRACK_FAILED,(null==o?void 0:o.message)||"update track failed");return e.subLayer=r,[2,e]}}))}))},t.prototype._updateSubTrack=function(e,t,i){var r,n,o;return tv(this,void 0,void 0,(function(){var a,s,c,u,d;return iv(this,(function(l){switch(l.label){case 0:return jz.print("updateSubTrack()","mediaType: %o",t),Hz("updateSubTrack()",e),a=0,a=i===cz.SUB?e.subMediaType|t:e.subMediaType-(e.subMediaType&t),jz.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",e.subMediaType,i,t,a),e.subMediaType===a&&jz.print("updateSubTrack","mediaType no change"),s=!1,c=!1,pU(a)&&(c=!0),fU(a)&&(s=!0),u={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:s,audio:!!this._multiChatMode()||c}}},[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateSubscribe",u)];case 1:if(200!==(null==(d=l.sent())?void 0:d.code))throw new YB(HB.UPDATE_TRACK_FAILED,(null==d?void 0:d.message)||"update track failed");return e.paused=!s,this._multiChatMode()||(null===(n=e.observer)||void 0===n||n.setUnmuteAudio(c),e.subAudio=c),null===(o=e.observer)||void 0===o||o.setUnmuteVideo(s),e.subVideo=s,e.subMediaType=a,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var i,r,n,o,a;return tv(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f,_,v,m,y=this;return iv(this,(function(g){switch(g.label){case 0:if(jz.print("subscribe4pushTrack()","streamInfo: %o",t),Hz("subscribe4pushTrack()",e),s=null==t?void 0:t.message,c=s.audioMid,u=s.videoMid,d=s.sequenceId,e.subAudio=!0,d<e.sequenceId)return jz.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];l=e.audioMid,h=e.videoMid,null===(i=e.observer)||void 0===i||i.setPushTrack(!0),g.label=1;case 1:return g.trys.push([1,8,,9]),l&&h?[4,null===(r=this._handler)||void 0===r?void 0:r.subscribe(e,{audioMid:l,videoMid:h})]:[3,3];case 2:return p=g.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(p=g.sent()))throw new YB(HB.ADD_TRANSCEIVER_FAILED,"add transceiver failed");l=p.audioMid,h=p.videoMid,g.label=5;case 5:return(m={})[l]=c,m[h]=u,f=m,jz.print("onpushtrack midmap",e.userId,f),e.audioMid=c,e.videoMid=u,e.sequenceId=d,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),_=[],e.audioTrack||_.push(new Promise((function(t,i){y._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new YB(HB.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),6e4);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(jz.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),v=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",v),this._ontrackCallbackMap.set(e,v),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:yz.pushtrack,streamId:e.streamId,audioMid:l,videoMid:h,stream:e,transceiverInit:null==p?void 0:p.transceiverInit,signalingAck:null==t?void 0:t.message})];case 6:return g.sent(),[4,Promise.all(_)];case 7:return g.sent(),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 8:throw g.sent();case 9:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var i,r,n;return tv(this,void 0,void 0,(function(){return iv(this,(function(o){switch(o.label){case 0:return Hz("unsubscribe4removeTrack()",e),jz.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(jz.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(i=e.observer)||void 0===i||i.setPushTrack(!1),[4,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:yz.removetrack,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})]));case 1:return o.sent(),[4,null===(n=this._handler)||void 0===n?void 0:n.rollback(e.streamId,e)];case 2:return o.sent(),this._subResolves[e.streamId]&&this._subResolves[e.streamId].forEach((function(e){return e(0)})),jz.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.unsubscribe=function(e,t,i){var r,n,o,a,s;return void 0===i&&(i=!1),tv(this,void 0,void 0,(function(){var c,u,d;return iv(this,(function(l){switch(l.label){case 0:return Hz("unsubscribe()",e),c=e.subMediaType-(e.subMediaType&t),i||!this._subConfig.muteReplaceUnsub&&c===WH.NONE?(u={roomId:this._roomId,streamId:e.streamId,userId:e.userId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unsubscribe",u).catch((function(){})),e.streamState=hz.INIT,this._subStreamQueue[e.streamId]&&(this._subStreamQueue[e.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[e.streamId]),e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(n=e.observer)||void 0===n||n.setSubscribeVideo(!1),e.subAudio?[3,3]:(null===(o=e.observer)||void 0===o||o.setSubscribeAudio(!1),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:yz.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})])):[2,this._updateSubTrack(e,t,cz.UNSUB)];case 1:return d=l.sent(),[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(e.streamId,e)];case 2:l.sent(),this._subResolves[d]&&this._subResolves[d].forEach((function(e){return e(0)})),jz.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),l.label=3;case 3:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,i=this._ontrackCallbackMap.get(e);i&&(null===(t=this._handler)||void 0===t||t.off("ontrack",i),this._ontrackCallbackMap.delete(e))},t.prototype.handleRemoveStream=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return Hz("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==Aj.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this._multiChatMode()&&e._workaround_1_?(this.unsubscribe(e,JM.AUDIO_AND_VIDEO,!0),[2]):[2]}))}))},t.prototype.leave=function(){var e;return tv(this,void 0,void 0,(function(){var t,i,r;return iv(this,(function(n){switch(n.label){case 0:return jz.print("leave()"),this.connectionState!==Fz.CONNECTED?[3,7]:(this.connectionState=Fz.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:i=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:return n.sent(),this.connectionState=Fz.DISCONNECTED,[3,6];case 4:throw r=n.sent(),this.connectionState=Fz.CONNECTED,r;case 5:return i(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new YB(HB.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S=this;return iv(this,(function(E){switch(E.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(o=E.sent()))throw new YB(HB.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return a=zL(),s=o.audioMid,c=o.videoMid,y={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:s,videoMid:c,sdpInfo:{sdp:null==o?void 0:o.partialSdp,semantics:null==o?void 0:o.semantics,type:null==o?void 0:o.type}},g={},[4,lG()];case 2:return y.params=(g.supportedCodecs=E.sent(),g.deviceType="web",g.userAgent=window.navigator.userAgent,g.sdkVersion=jV.VERSION,g.deviceId=xV.getDeviceId(),g.appId=this._appId,g.businessId=this._businessId,g.enableCloudProxy=this._useCloudProxy,g),y.config={enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},u=y,[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("startPullStream",u)];case 3:return d=E.sent(),l=[],this._subResolves[e.streamId]=[],l.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new YB(HB.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),6e4);e.on("ontrack",(function i(n){"video"===n.mediaType&&(jz.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),l.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new YB(HB.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),6e4);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(jz.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),h=function(t){e.ontrack(t)},null===(r=this._handler)||void 0===r||r.on("ontrack",h),this._ontrackCallbackMap.set(e,h),p=null==d?void 0:d.relayMessage,f=p.audioMid,_=p.videoMid,v=p.sequenceId,m=p.sdp,e.videoMid=_,e.audioMid=f,e.sequenceId=v,e._workaround_1_=!1,e.paused=!1,e.streamState=hz.SUB_ED,e.subAudio=!0,e.subVideo=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:yz.subscribe,streamId:e.streamId,audioMid:s,videoMid:c,transceiverInit:null==o?void 0:o.transceiverInit,signalingAck:{audioMid:f,videoMid:_,sdp:m,sequenceId:v},stream:e})];case 4:return E.sent(),[4,Promise.all(l)];case 5:return E.sent(),this.monitor.rtcSubscribeStat(bF.SUCCESS,a,IF.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n;return iv(this,(function(o){switch(o.label){case 0:Hz("unsubscribePublicStream()",e),n={appId:this._appId,streamId:e.streamId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("stopPullStream",n)];case 2:case 3:return o.sent(),[3,4];case 4:return e.streamState=hz.INIT,e.subVideo=!1,e.subAudio=!1,[4,null===(i=this._handler)||void 0===i?void 0:i.handleAck({action:yz.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})];case 5:return o.sent(),[4,null===(r=this._handler)||void 0===r?void 0:r.rollback(e.streamId,e)];case 6:return o.sent(),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.destroy=function(){var e,t,i;jz.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(i=this._iceConfigRequestManager)||void 0===i||i.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState=Fz.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})},t.prototype.sendRoomMessage=function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)},t.prototype._multiChatMode=function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode},Object.defineProperty(t.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomAttributes",{get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),ev([Xz],t.prototype,"join",null),ev([Wz,Kz],t.prototype,"publish",null),ev([Wz,Kz],t.prototype,"updatePubTrack",null),ev([Wz,Kz],t.prototype,"unpublish",null),ev([Wz,Kz],t.prototype,"subscribe",null),ev([Kz],t.prototype,"controlMessage",null),ev([Kz],t.prototype,"updateUserAttributes",null),ev([Kz],t.prototype,"updateSubTrack",null),ev([Kz],t.prototype,"updateSubTrackLayer",null),ev([Kz],t.prototype,"subscribe4pushTrack",null),ev([Kz],t.prototype,"unsubscribe4removeTrack",null),ev([Wz,Kz],t.prototype,"unsubscribe",null),ev([Kz],t.prototype,"handleRemoveStream",null),ev([Wz],t.prototype,"subscribePublicStream",null),ev([Wz],t.prototype,"unsubscribePublicStream",null),t}(JF);function Kz(e,t,i){var r=i.value;return i.value=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return tv(this,void 0,void 0,(function(){return iv(this,(function(i){switch(i.label){case 0:return this._handler&&this._state===Fz.CONNECTED?[4,r.apply(this,e)]:[3,2];case 1:return i.sent(),[3,3];case 2:throw new YB(HB.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},i}function Wz(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=i.sent(),this.supportConcurrent&&t(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,r.apply(this,e)];case 3:return[2,i.sent()];case 4:return this.supportConcurrent||t(),[7];case 5:return[2]}}))}))},i}function Xz(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(n){return t=!1,[2,new Promise((function(n,o){return tv(i,void 0,void 0,(function(){var i,a;return iv(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new YB(HB.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.apply(this,e)];case 2:return i=s.sent(),n(i),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},i}!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(Gz||(Gz={}));var qz,Yz=function(){function e(e,t){this._audioEventSessionId=sU(),this._videoEventSessionId=sU(),this._isScreen=!1,this._audioFirstFrameState=Gz.INITIAL,this._videoFirstFrameState=Gz.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:CF.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:CF.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._publishVideo=!1,this._publishAudio=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._stream=e,this._handler=t,this.getTransportDelay()}return e.prototype.beginRecvFrame=function(e,t){var i,r,n,o,a;return tv(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f=this;return iv(this,(function(_){switch(_.label){case 0:return[4,this.getTransportDelay()];case 1:return _.sent(),s=this._transportDelay,c=!0,u=CF.LOGIN,d=CF.UNMUTE,l=CF.SUBSCRIBE,h=CF.PUSH_TRACK,[u,d,l,h].indexOf(t)>=0&&(s=0,c=!1),e===RF.AUDIO?(c||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},p={media_type:e,event_type:AF.BEGIN_RECV,type:t,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){f.stopRecvFrame(RF.AUDIO,OF.TIMEOUT),f._firstAudioFrameInterval&&window.clearInterval(f._firstAudioFrameInterval)}),this._timeout),$F.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=Gz.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===RF.VIDEO&&(c||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t},p={media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?RF.SCREEN_VIDEO:e,event_type:AF.BEGIN_RECV,type:t,start:null===(o=this._currentVideoRecv)||void 0===o?void 0:o.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(a=this._stream)||void 0===a?void 0:a.userId,transport_delay:s},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){f.stopRecvFrame(RF.VIDEO,OF.TIMEOUT),f._firstVideoFrameInterval&&window.clearInterval(f._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),$F.rtcFirstFrame(p),this._videoFirstFrameState=Gz.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var i,r,n,o,a,s,c;if(e===RF.AUDIO){if(this._audioFirstFrameState!==Gz.BEGIN)return;var u={event_type:AF.RECV_END,media_type:e,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,reason:t,result:!1,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,$F.rtcFirstFrame(u),this._audioFirstFrameState=Gz.STOPPED}else if(e===RF.VIDEO){if(this._videoFirstFrameState!==Gz.BEGIN)return;u={event_type:AF.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?RF.SCREEN_VIDEO:e,start:null===(a=this._currentVideoRecv)||void 0===a?void 0:a.startTime,reason:t,result:!1,stream_user_id:null===(s=this._stream)||void 0===s?void 0:s.userId,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,$F.rtcFirstFrame(u),this._videoFirstFrameState=Gz.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p;return iv(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:if(f.sent(),n=this._transportDelay,o=CF.LOGIN,a=CF.UNMUTE,s=CF.SUBSCRIBE,c=CF.PUSH_TRACK,e===RF.AUDIO){if(this._audioFirstFrameState!==Gz.BEGIN)return[2];if(!this._currentAudioRecv)return[2];u=this._currentAudioRecv,l=u.type,h=u.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:AF.RECV_END,media_type:e,start:h,result:!0,stream_user_id:null===(t=this._stream)||void 0===t?void 0:t.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:n},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),$F.rtcFirstFrame(p),this._audioFirstFrameState=Gz.RECEIVED}else if(e===RF.VIDEO){if(this._videoFirstFrameState!==Gz.BEGIN)return[2];if(!this._currentVideoRecv)return[2];d=this._currentVideoRecv,l=d.type,h=d.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:AF.RECV_END,media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?RF.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:n},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),$F.rtcFirstFrame(p),this._videoFirstFrameState=Gz.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var i,r,n,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&t.audio&&this.beginRecvFrame(RF.AUDIO,CF.LOGIN),e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&t.video&&this.beginRecvFrame(RF.VIDEO,CF.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(RF.VIDEO,OF.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(RF.AUDIO,CF.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(RF.AUDIO,CF.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(RF.AUDIO,CF.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(RF.VIDEO,CF.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(RF.VIDEO,OF.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(RF.VIDEO,CF.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.VIDEO,OF.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(RF.VIDEO,CF.ENABLE):this.stopRecvFrame(RF.VIDEO,OF.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal=e},e.prototype.setPushAudio=function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(RF.AUDIO,CF.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(RF.AUDIO,CF.PUSH)},e.prototype.setExternalVideoSource=function(e){this._videoExternal=e},e.prototype.setPushVideo=function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(RF.VIDEO,CF.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(RF.VIDEO,CF.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(RF.VIDEO,CF.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(RF.VIDEO,OF.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(RF.AUDIO,CF.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.UNPUBLISH)},e.prototype.setAutoSubscribe=function(e){this._autoSubscribe=e},e.prototype.setAutoSubscribeVideo=function(e){this._autoSubscribeVideo=e},e.prototype.setAutoSubscribeAudio=function(e){this._autoSubscribeAudio=e},e.prototype.setSubscribeAudio=function(e){var t,i;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(RF.AUDIO,CF.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.UNSUBSCRIBE)},e.prototype.setSubscribeVideo=function(e){var t,i;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(RF.VIDEO,CF.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&this.stopRecvFrame(RF.VIDEO,OF.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(RF.AUDIO,CF.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.REMOVE_TRACK))},e.prototype.setMultiChatMode=function(e){this._multiChatMode=e},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype._watchForFirstVideoFrameRecv=function(){var e=this,t=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval((function(){return tv(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return iv(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())?[4,oG(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.videoTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.framesReceived>t){if(-1===t)return t=i.framesReceived,[2];this.recvFrameFinish(RF.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype._watchForFirstAudioFrameRecv=function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval((function(){return tv(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return iv(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())?[4,oG(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.audioTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.totalSamplesReceived>t){if(-1===t)return t=i.totalSamplesReceived,[2];this.recvFrameFinish(RF.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return tv(this,void 0,void 0,(function(){var e=this;return iv(this,(function(t){switch(t.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return t.sent(),window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval((function(){return tv(e,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return e.sent(),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.getTransportDelayIntl=function(){var e,t;return tv(this,void 0,void 0,(function(){var i,r,n;return iv(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,oG(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:i=o.sent(),r=i.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(n=i.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==r?void 0:r.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*n.currentRoundTripTime/2)),o.label=2;case 2:return[2]}}))}))},e.prototype.reset=function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:CF.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:CF.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)},e}();!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.SENT=3]="SENT"}(qz||(qz={}));var Jz,Qz,Zz,$z,eK=function(){function e(e,t){this._audioEventSessionId=sU(),this._videoEventSessionId=sU(),this._currentAudioSend={startTime:0,eventSessionId:0,type:CF.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:CF.LOGIN},this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._timeout=1e4,this._audioFirstFrameState=qz.INITIAL,this._videoFirstFrameState=qz.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var i,r,n,o=this;if(e===RF.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:AF.BEGIN_SEND,type:t,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){o.stopSendFrame(RF.AUDIO,OF.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),$F.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=qz.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===RF.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?RF.SCREEN_VIDEO:e,event_type:AF.BEGIN_SEND,type:t,start:null===(n=this._currentVideoSend)||void 0===n?void 0:n.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){o.stopSendFrame(RF.VIDEO,OF.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),$F.rtcFirstFrame(a),this._videoFirstFrameState=qz.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}},e.prototype.stopSendFrame=function(e,t){var i,r,n,o,a;if(e===RF.AUDIO){if(this._audioFirstFrameState!==qz.BEGIN)return;var s={event_type:AF.SENT_END,media_type:e,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(r=this._currentAudioSend)||void 0===r?void 0:r.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,$F.rtcFirstFrame(s),this._audioFirstFrameState=qz.STOPPED}else if(e===RF.VIDEO){if(this._videoFirstFrameState!==qz.BEGIN)return;s={event_type:AF.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?RF.SCREEN_VIDEO:e,start:null===(o=this._currentVideoSend)||void 0===o?void 0:o.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(a=this._currentVideoSend)||void 0===a?void 0:a.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,$F.rtcFirstFrame(s),this._videoFirstFrameState=qz.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===RF.AUDIO){if(this._audioFirstFrameState!==qz.BEGIN)return;if(!this._currentAudioSend)return;var i=this._currentAudioSend,r=i.type,n=i.startTime,o={event_type:AF.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:r};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),$F.rtcFirstFrame(o),this._audioFirstFrameState=qz.SENT}else if(e===RF.VIDEO){if(this._videoFirstFrameState!==qz.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;r=a.type,n=a.startTime,o={event_type:AF.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?RF.SCREEN_VIDEO:e,start:n,result:!0,event_session_id:this._videoEventSessionId,type:r};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),$F.rtcFirstFrame(o),this._videoFirstFrameState=qz.SENT}},e.prototype.setLogin=function(e){var t,i;this._login!==e&&(this._login=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(RF.VIDEO,CF.LOGIN),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(RF.AUDIO,CF.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.LEAVE_ROOM))},e.prototype.setPublish=function(e){var t,i;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(RF.VIDEO,CF.PUBLISH),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(RF.AUDIO,CF.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(RF.AUDIO,CF.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(RF.AUDIO,CF.ENABLE),!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(RF.VIDEO,CF.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(RF.VIDEO,CF.ENABLE),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(RF.AUDIO,CF.PUSH),!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(RF.VIDEO,CF.PUSH),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.STOP_PUSH))},e.prototype.setAutoPublish=function(e){this._autoPublish=e},e.prototype.setPublisher=function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.AUDIENCE))},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype.setPCSessionId=function(e){this._pcSessionId=e},e.prototype.setHandler=function(e){this._handler=e},e.prototype._getFirstVideoFrameStats=function(){var e,t,i,r,n,o;return tv(this,void 0,void 0,(function(){var a;return iv(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(i=null===(t=this._stream)||void 0===t?void 0:t.videoTrack)||void 0===i?void 0:i.getTrack())?[4,oG(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._getFirstAudioFrameStats=function(){var e,t,i,r,n,o;return tv(this,void 0,void 0,(function(){var a;return iv(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(i=null===(t=this._stream)||void 0===t?void 0:t.audioTrack)||void 0===i?void 0:i.getTrack())?[4,oG(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._watchForFirstVideoFrameSend=function(){var e=this,t=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval((function(){return tv(e,void 0,void 0,(function(){var e;return iv(this,(function(i){switch(i.label){case 0:return[4,this._getFirstVideoFrameStats()];case 1:if((e=i.sent())&&e.framesSent>t){if(-1===t)return t=e.framesSent,[2];this.sendFrameFinish(RF.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval((function(){return tv(e,void 0,void 0,(function(){var e;return iv(this,(function(i){switch(i.label){case 0:return[4,this._getFirstAudioFrameStats()];case 1:if((e=i.sent())&&e.packetsSent>t){if(-1===t)return t=e.packetsSent,[2];this.sendFrameFinish(RF.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}return[2]}}))}))}),100)},e.prototype.reset=function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=qz.INITIAL,this._videoFirstFrameState=qz.INITIAL,this._currentAudioSend={startTime:0,eventSessionId:0,type:CF.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:CF.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)},e.prototype.destroy=function(){this.reset(),delete this._stream,delete this._handler},Object.defineProperty(e.prototype,"_audioSending",{get:function(){return this._audioFirstFrameState===qz.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===qz.BEGIN},enumerable:!1,configurable:!0}),e}();!function(e){e[e.UNKOWN=0]="UNKOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(Qz||(Qz={})),function(e){e[e.INVALID=0]="INVALID",e[e.GOOD=1]="GOOD",e[e.MEDIUM=2]="MEDIUM",e[e.POOR=3]="POOR"}(Zz||(Zz={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}($z||($z={}));var tK=((Jz={})[$z.AUDIO]={delay:1200,stallRadio:.3},Jz[$z.VIDEO]={delay:1200,stallRadio:.6},Jz[$z.SCREEN_AUDIO]={delay:1600,stallRadio:.8},Jz[$z.SCREEN_VIDEO]={delay:1600,stallRadio:.8},Jz),iK=function(){function e(){this._preUplinkStats=new Map,this._preDownlinkStats=new Map,this._connectionState=Fz.CONNECTED}return e.prototype.updateUplinkStats=function(e){var t=e.audioStats,i=e.videoStats,r=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var n=r?$z.SCREEN_AUDIO:$z.AUDIO,o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,ov(ov([],nv(u),!1),[c],!1).slice(-2))}if(i.sentKBitrate>0&&i.rtt){n=r?$z.SCREEN_VIDEO:$z.VIDEO,o=i.rtt,a=i._fractionLost;i.videoLossRate;var d=i._sendBandWidth;s=i._retransmittedRate;0===d&&(a=Math.max(.65,a));c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,ov(ov([],nv(u),!1),[c],!1).slice(-2))}this._startNetworkQualityReport()},e.prototype.updateDownlinkStats=function(e,t){if(t){var i,r,n=this._getStreamActiveState(t),o=n.audioActive,a=n.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId,l=!0,h=!0;if(o&&s.rtt)if(0===s.receivedKBitrate)l=!1;else{var p=s.rtt,f=s.audioLossRate,_=s.stallDuration,v=s.statsInterval,m=s.e2eDelay,y=_/v,g=u?$z.SCREEN_AUDIO:$z.AUDIO,S=this._getQosLevel(p,f||0,c._retransmittedRate||0),E=this._getDownlinkQoE(g,y,m);i=this._getNetworkQuality(S,E)}if(a)if(0===c.receivedKBitrate||0===c.rtt)h=!1;else{p=c.rtt;var b=c.videoLossRate,I=(_=c.stallDuration,v=c.statsInterval,m=c.e2eDelay,c._retransmittedRate);y=_/v,g=u?$z.SCREEN_VIDEO:$z.VIDEO,S=this._getQosLevel(p,b||0,I||0),E=this._getDownlinkQoE(g,y,m);r=this._getNetworkQuality(S,E)}var T="".concat(d).concat(u?"_screen":"");if(l||h){var A=i&&r?Math.ceil((i+r)/2):i||r;if(A){var R=this._preDownlinkStats.get(T)||[A];this._preDownlinkStats.set(T,ov(ov([],nv(R),!1),[A],!1).slice(-2)),this._startNetworkQualityReport()}}else this._preDownlinkStats.delete(T)}},e.prototype.setConnectionState=function(e){this._connectionState=e},e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()},e.prototype._startNetworkQualityReport=function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))},e.prototype._reportNetworkQuality=function(){var e,t,i=this;if(this._connectionState!==Fz.CONNECTED)e=t=aL.VBAD;else{var r=this._getBetterQualityAndRemoveOldest($z.AUDIO,"up"),n=this._getBetterQualityAndRemoveOldest($z.VIDEO,"up");e=r&&n?Math.ceil((r+n)/2):r||n||this._getBetterQualityAndRemoveOldest($z.SCREEN_VIDEO,"up")||this._getBetterQualityAndRemoveOldest($z.SCREEN_AUDIO,"up")||aL.EXCELLENT;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return i._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||aL.UNKNOWN}this.reportor&&this.reportor(e,t)},e.prototype._getNetworkQuality=function(e,t){return t===Zz.GOOD?Math.max(e-2,1):t===Zz.MEDIUM?e:Math.min(e+1,5)},e.prototype._getQosLevel=function(e,t,i){var r;return r=e<=250&&t<=.15?Qz.EXCELLENT:e<=500&&t<=.3?Qz.GOOD:e<=750&&t<=.45?Qz.POOR:e<=1e3&&t<=.6?Qz.BAD:Qz.VBAD,i>.5?r=Math.max(r,Qz.BAD):i>.35?r=Math.max(r,Qz.POOR):i>.15&&(r=Math.max(r,Qz.GOOD)),r},e.prototype._getUplinkQoE=function(e,t){var i=Zz.INVALID;switch(e){case $z.AUDIO:case $z.VIDEO:i=t<.05?Zz.GOOD:t<.1?Zz.MEDIUM:Zz.POOR;break;case $z.SCREEN_VIDEO:case $z.SCREEN_AUDIO:i=t<.04?Zz.GOOD:t<.08?Zz.MEDIUM:Zz.POOR}return i},e.prototype._getDownlinkQoE=function(e,t,i){var r=tK[e];return t>r.stallRadio||i>r.delay||t>r.stallRadio/2&&i>r.delay/2?Zz.POOR:(t>r.stallRadio/2||r.delay,Zz.MEDIUM)},e.prototype._getBetterQualityAndRemoveOldest=function(e,t){var i=aL.UNKNOWN,r="up"===t?this._preUplinkStats:this._preDownlinkStats,n=r.get(e);if(n){var o=n.filter((function(e){return e}));o.length>0&&(i=Math.min.apply(Math,ov([],nv(o),!1))),n.shift(),0===n.length&&r.delete(e)}return i},e.prototype._getStreamActiveState=function(e){var t=e.subMediaType,i=e._attributes,r=e.subVideo;return{audioActive:e.subAudio&&pU(t)&&i.localaudio&&i.audiostream,videoActive:r&&fU(t)&&i.localvideo&&i.videostream}},e}(),rK=function(){function e(e){this._room=e,this._remoteVideoSizeCache={},this._remoteScreenSizeCache={},this._start()}return e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}},e.prototype._start=function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},i={};e._room.remoteStreams.forEach((function(r,n){r.forEach((function(r){var o,a=null===(o=r.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=r.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[n]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,p=a.getSettings(),f=p.width,_=void 0===f?0:f,v=p.height,m=void 0===v?0:v;h===m&&d===_||e.onchange&&e.onchange(n,r.isScreen,_,m),delete s[n],(r.isScreen?i:t)[n]={width:_,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=i}),1e3))},e}(),nK=Mn.every;jr({target:"Array",proto:!0,forced:!Un("every")},{every:function(e){return nK(this,e,arguments.length>1?arguments[1]:void 0)}});var oK=new XF("SubscribeFallbackManager",2),aK=function(){function e(e){this._room=e,this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,this._inSubscribeRecoverChecking=!1,this._forbidSubRecover=!1,this._forbidSubRecoverDuration=1e4}return e.prototype.updateNetworkQuality=function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===aL.BAD||e===aL.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*aL.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===aL.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")},e.prototype.destroy=function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback},e.prototype._subscribeFallbackOrRecover=function(e){return tv(this,void 0,void 0,(function(){var t,i,r,n,o,a,s,c,u,d=this;return iv(this,(function(l){switch(l.label){case 0:if(this._isSubscribeFallbackOrRecover||this._room.connectionState!==Fz.CONNECTED)return[2];if(this._room.subscribeFallbackOption!==nL.AUDIO_ONLY&&this._room.subscribeFallbackOption!==nL.VIDEO_STREAM_LOW)return[3,5];if(t=new Map,this._room.remoteStreams.forEach((function(i){i.forEach((function(i){if(i.hasSubscribed){var r="fallback"===e?i.getSubscribeFallbackParams(d._room.subscribeFallbackOption):i.getSubscribeRecoverParams();if(r){var n=i.getStreamPriority(),o=t.get(n)||[];o.push({stream:i,fallbackOrRecoverOption:r}),t.set(n,o)}}}))})),!(t.size>0))return[3,5];if(oK.print("_subscribeFallbackOrRecover()","start subscribe ".concat(e,".")),i=Array.from(t.keys()).sort((function(e,t){return e-t}))["fallback"===e?0:t.size-1],r=nv(t.get(i)||[],1),!(n=r[0]))return[3,5];o=n.stream,a=n.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,s=o.subLayer.spatialLayer,c=o.subVideo,oK.print("_subscribeFallbackOrRecover()","".concat(o.userId,"'s stream will be ").concat(e," to: MediaType=").concat(a[0]," subState=").concat(a[1]," subLayer=").concat(a[2])),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,lU([(u=this._room).updateSubTrack.apply(u,ov([o],nv(a),!1)).then((function(){"recover"===e?d._startSubscribeRecoverCheck():oK.print("_subscribeFallbackOrRecover()","fallback success."),d.onSubscribeFallback&&d.onSubscribeFallback({userId:o.userId,isScreen:o.isScreen,beforeEnable:c,beforeVideoIndex:s,afterEnable:o.subVideo,afterVideoIndex:o.subLayer.spatialLayer,reason:"fallback"===e?sL.SubscribeFallbackByBandwidth:sL.SubscribeRecoverByBandwidth})})),(h=2e3,new Promise((function(e){window.setTimeout(e,h)})))])];case 2:case 3:return l.sent(),[3,4];case 4:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,l.label=5;case 5:return[2]}var h}))}))},e.prototype._startSubscribeRecoverCheck=function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=1e4,delete e._subRecoverCheckTimer,oK.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)},e.prototype._stopSubscribeRecoverCheck=function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1},e.prototype._startForbidSubRecover=function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),oK.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)},e.prototype._stopForbidSubRecover=function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)},e}(),sK=new XF("Room",1),cK=function(e){function t(t,i){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._remoteStreamStreamIdUserIdMap={},r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._hasPublished=!1,r._publishOnDemandBusy=!1,r._roomConfig=t,r._mediaServerClient=new zz(i),r._reconnectRecord=new uK,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new iK,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(r),r._videoSizeObserver=new rK(r),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(r),r._subFallbackManager=new aK(r),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(r),r._context=i,r}return Z_(t,e),Object.defineProperty(t.prototype,"hasScreenPublished",{get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPublished",{get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._mediaServerClient.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){return this._remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){return this._remoteStreams},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localStream",{get:function(){return this._localStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenStream",{get:function(){return this._localScreenStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomInfo",{get:function(){return this._roomInfo},enumerable:!1,configurable:!0}),t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T=this;null===(e=this._mediaServerClient)||void 0===e||e.on(Cj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(Cj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(Cj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(Cj.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(Cj.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(Cj.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(Cj.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(Cj.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(Cj.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(Cj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(Cj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(Cj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(Cj.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(Cj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(Cj.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(Cj.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(Cj.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(Oj.RSCP,(function(e){T._publishOnDemandItem=e,T._onPublishOnDemand()})),null===(y=this._mediaServerClient)||void 0===y||y.on(wj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(wj.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on("onRemoteStreamStats",(function(e){T._networkQualityManager.updateDownlinkStats(e,T._findRemoteStreamByScreen(e.userId,e.isScreen)),T.emit(nz.ON_REMOTE_STREAM_STATS,_U(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("onLocalStreamStats",(function(e){T._networkQualityManager.updateUplinkStats(e),T.emit(nz.ON_LOCAL_STREAM_STATS,_U(e))})),null===(b=this._mediaServerClient)||void 0===b||b.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e})),null===(I=this._mediaServerClient)||void 0===I||I.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,i,r,n,o){return tv(this,void 0,void 0,(function(){var a=this;return iv(this,(function(s){return iB.setStats({rtc_app_id:e,room_id:t,user_id:r.userId}),sK.print("join()"),[2,new Promise((function(s,c){return tv(a,void 0,void 0,(function(){var a,u,d=this;return iv(this,(function(l){return this._joinResolveCallback=function(e){var t;$F.joinRoom(NF.END,a,!0,"",{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)},this._joinRejectCallback=function(e){var t;$F.joinRoom(NF.END,a,!1,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)},this._liveControlMessage=n,this._roomInfo={appId:e,roomId:t,token:i,userInfo:r,useCloudProxy:o,roomProfile:this._roomConfig.roomProfileType},a=zL(),this.setSessionId(),$F.joinRoom(NF.BEGIN,a,!1,"",{enable_cloud_proxy:null===(u=this._roomInfo)||void 0===u?void 0:u.useCloudProxy}),this._join(this._joinResolveCallback,this._joinRejectCallback,!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,i){return void 0===i&&(i=!1),tv(this,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:r=zL(),sK.print("_join()"),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},i,this._liveControlMessage)];case 2:return n=a.sent(),this._mediaServerClient.roomAttributes=n.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e({users:n.clients,streams:n.streams}),this._isReconnecting=!1,$F.rtcJoinRoom(0,"web","web",zL()-r),this._onJoinSucc(n,i),[3,4];case 3:return(o=a.sent()).code!==HB.OPERATION_CANCEL&&"function"==typeof t?[2,t(o)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,i,r,n){var o,a,s,c,u,d;return tv(this,void 0,void 0,(function(){var l,h,p,f;return iv(this,(function(_){switch(_.label){case 0:return sK.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new gz,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new eK(this._localScreenStream,this._mediaServerClient.handler))),l=!1,h=!1,p=!1,f=!1,!this._localScreenStream.videoTrack&&t?(t instanceof FH&&(h=!0),l=!0):this._localScreenStream.videoTrack&&!t&&(l=!1),!this._localScreenStream.audioTrack&&i?(i instanceof BH&&(f=!0),p=!0):this._localScreenStream.audioTrack&&!i&&(p=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=i,this._localScreenStream.videoEncodeConfig=e,r&&(pU(r)&&(this._localScreenStream.pubAudio=n===sz.PUB),fU(r)&&(this._localScreenStream.pubVideo=n===sz.PUB),sK.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo?this._localScreenStream.hasPublished?[3,2]:(null===(a=this._localScreenStream.observer)||void 0===a||a.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]):(null===(o=this._localScreenStream)||void 0===o?void 0:o.hasPublished)?[2,this.unpublishScreen()]:[2];case 1:return _.sent(),[3,4];case 2:return h?null===(s=this._localScreenStream.observer)||void 0===s||s.setPushVideo(l):null===(c=this._localScreenStream.observer)||void 0===c||c.setEnableVideo(l),f?null===(u=this._localScreenStream.observer)||void 0===u||u.setPushAudio(p):null===(d=this._localScreenStream.observer)||void 0===d||d.setEnableAudio(p),[4,this.updatePubScreenTrack()];case 3:_.sent(),_.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return sK.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),this._localScreenStream?[4,this._mediaServerClient.updatePubTrack(this._localScreenStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e;return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return sK.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?(null===(e=this._localScreenStream.observer)||void 0===e||e.setPublish(!1),[4,this._mediaServerClient.unpublish(this._localScreenStream)]):[3,2];case 1:t.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,t.label=2;case 2:return[2]}}))}))},t.prototype.liveControlMessage=function(e){var t;return tv(this,void 0,void 0,(function(){var i=this;return iv(this,(function(r){switch(r.label){case 0:return sK.print("controlMessage","Invoke controlMessage"),null===(t=e.transcodeMeta)||void 0===t||t.layout.regions.forEach((function(e){i.roomInfo&&(e.roomID=i.roomInfo.roomId)})),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return r.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return"stopped"===e.action&&delete e.publicStreamMeta,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return sK.print("updateUserAttributes","Invoke updateUserAttributes"),e.role&&this._roomInfo&&(this._roomInfo.userInfo.role=e.role),[4,this._mediaServerClient.updateUserAttributes(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.publish=function(e,t,i,r,n,o,a){var s,c,u,d,l,h;return void 0===a&&(a=!1),tv(this,void 0,void 0,(function(){var p,f,_,v,m,y;return iv(this,(function(g){switch(g.label){case 0:if(sK.print("publish","Invoke publish"),p=!1,this._localStream||(this._localStream=new gz,this._mediaServerClient.handler&&(this._localStream.observer=new eK(this._localStream,this._mediaServerClient.handler)),p=!0),this._localStream.videoTrack=i,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,n&&(pU(n)&&(this._localStream.pubAudio=o===sz.PUB),fU(n)&&(this._localStream.pubVideo=o===sz.PUB),sK.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished)return[3,5];if(!this._localStream.pubAudio&&!this._localStream.pubVideo)return[2];g.label=1;case 1:return g.trys.push([1,3,,4]),a?null===(s=this._localStream.observer)||void 0===s||s.setLogin(!0):p&&(f=!!this._localStream.videoTrack,_=!!this._localStream.audioTrack,v=this._localStream.videoTrack instanceof FH,m=this._localStream.audioTrack instanceof BH,this._roomConfig.isAutoPublish&&!this._hasPublished?(f&&(v?null===(c=this._localStream.observer)||void 0===c||c.setPushVideo(!0):null===(u=this._localStream.observer)||void 0===u||u.setEnableVideo(!0)),_&&(m?null===(d=this._localStream.observer)||void 0===d||d.setPushAudio(!0):null===(l=this._localStream.observer)||void 0===l||l.setEnableAudio(!0))):null===(h=this._localStream.observer)||void 0===h||h.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return g.sent(),this._hasPublished=!0,this.emit(nz.ON_PUBLISH_RESULT,{isScreen:!1,state:WM.PUBLISH_SUCC}),[3,4];case 3:throw y=g.sent(),this.emit(nz.ON_PUBLISH_RESULT,{isScreen:!1,state:WM.PUBLISH_FAIL}),y;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:g.sent(),g.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return sK.print("updatePubTrack","Invoke updatePubTrack"),this._localStream?[4,this._mediaServerClient.updatePubTrack(this._localStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublish=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return sK.print("unpublish","Invoke unpublish"),this._localStream?[4,this._mediaServerClient.unpublish(this._localStream)]:[3,2];case 1:e.sent(),this._localStream.clean(),this._localStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.subscribe=function(e,t,i){return tv(this,void 0,void 0,(function(){var r;return iv(this,(function(n){switch(n.label){case 0:return sK.print("subscribe","remoteStream %o",e),r=void 0,i&&(r=this._getSubLayer(i,e)),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){var n;return tv(this,void 0,void 0,(function(){return iv(this,(function(o){return sK.print("updateSubTrack","Invoke updateSubTrack"),[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(e,t,i,r)]}))}))},t.prototype.updateSubVideoConfig=function(e,t){var i,r,n;return tv(this,void 0,void 0,(function(){var o,a;return iv(this,(function(s){return!(o=this._findRemoteStreamByScreen(e,!1))||!o.hasSubscribed||(null===(r=null===(i=null==o?void 0:o.attributes)||void 0===i?void 0:i.videoDescriptions)||void 0===r?void 0:r.length)<=1?[2]:(a=this._getSubLayer(t,o),o.originalStreamIndex=a.spatialLayer,[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrackLayer(o,a)])}))}))},t.prototype._getSubLayer=function(e,t){for(var i,r,n,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,p=0;p<(null==d?void 0:d.length);p++)if(h>=(null===(i=d[p])||void 0===i?void 0:i.width)*(null===(r=d[p])||void 0===r?void 0:r.height)){l=p;break}var f=d[0];if(-1===l)f=d[l=d.length-1];else if(0!==l){var _=d[l-1].width*d[l-1].height,v=(_-h)/(_-d[l].width*d[l].height);f=v<.1?d[l-1]:d[l],l=v<.1?l-1:l}return a=null!==(n=null==f?void 0:f.sub_index)&&void 0!==n?n:-1,{spatialLayer:null!==(o=null==f?void 0:f.video_index)&&void 0!==o?o:l,spatialSubLayer:a}},t.prototype.unsubscribe=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){switch(i.label){case 0:return sK.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e,t)];case 1:return i.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c;return iv(this,(function(u){switch(u.label){case 0:sK.print("leave","Invoke leave"),i=zL(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(r=rv(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())o=n.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(e){s={error:e}}finally{try{n&&!n.done&&(c=r.return)&&c.call(r)}finally{if(s)throw s.error}}return this._localStream&&(null===(t=this._localStream.observer)||void 0===t||t.setLogin(!1)),[4,this._mediaServerClient.leave()];case 2:return u.sent(),this.destroy(),$F.rtcLeaveRoom(0,"",zL()-i),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&$F.rtcLeaveRoom(-1,a.message,zL()-i),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteUserPriority=function(e,t){var i,r;null===(i=this.remoteStreams.get(e))||void 0===i||i.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(r=this.userPriorityMap)||void 0===r||r.set(e,t)},t.prototype.destroy=function(){var e,t,i,r;sK.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var n=rv(this._remoteStreams),o=n.next();!o.done;o=n.next()){var a=nv(o.value,2)[1];Array.isArray(a)&&a.forEach((function(e){e&&e.clean()}))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._remoteStreams=new Map,this._localStream&&(null===(i=this._localStream)||void 0===i||i.clean(),this._localStream=void 0),this._localScreenStream&&(null===(r=this._localScreenStream)||void 0===r||r.clean(),this._localScreenStream=void 0),this._context=void 0,this._reconnectRecord=new uK,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy(),this._remoteStreamStreamIdUserIdMap={}},t.prototype.updateToken=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return sK.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return tv(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return iv(this,(function(c){t=[];try{for(i=rv(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed){var r=s.updateSubTrack(i,e,cz.UNSUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return tv(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return iv(this,(function(c){t=[];try{for(i=rv(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed&&i.hasSubscribed){var r=s.updateSubTrack(i,e,cz.SUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendUserMessage(e,t)},t.prototype.setSessionId=function(){this._sessionId=bL(),iB.setStats({rtc_session_id:this._sessionId})},t.prototype.sendRoomMessage=function(e,t){var i,r;return void 0===t&&(t=!1),tv(this,void 0,void 0,(function(){var n,o;return iv(this,(function(a){switch(a.label){case 0:return n={clientId:null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo.userId,binary:t,message:""},t?(o=n,[4,XL.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:n.message=e,a.label=3;case 3:return[2,null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendRoomMessage(n)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){sK.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new zz(this._context),this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var i,r,n,o,a,s=this;sK.print("JoinSuccess()"),this._serverConfig=e.config;var c=[],u=[],d=[],l=[],h=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var i=s._remoteUsers.get(t.clientId);i?i._stillExist=!0:c.push(t)}}));try{for(var p=rv(this._remoteUsers.values()),f=p.next();!f.done;f=p.next()){var _=f.value;_._stillExist||u.push({clientId:_.userId}),delete _._stillExist}}catch(e){i={error:e}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(i)throw i.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId,h.push(e)):l.push(e)}));try{for(var v=rv(this._remoteStreams.values()),m=v.next();!m.done;m=v.next()){var y=m.value;Array.isArray(y)&&y.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:Aj.clientDisconnected})}))}}catch(e){n={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(n)throw n.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e,!0,!1)})),h.forEach((function(e){return s._onUpdateStreamAttributes(e)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,i=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));try{for(var r=rv(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return tv(i,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),i.label=1;case 1:return i.trys.push([1,3,,4]),sK.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType)];case 2:return i.sent(),sK.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(nz.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=i.sent(),sK.print("failed resubscribe ".concat(e.userId," with ").concat(e.subMediaType,", error:").concat(t)),e.clean(),null==e||e.resetHasSubscribed(),[3,4];case 4:return[2]}}))}))}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t,i){var r,n,o,a,s,c,u,d,l,h,p;if(void 0===t&&(t=!0),void 0===i&&(i=!0),e.clientId!==(null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId)){var f=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,!f){f=new Sz(e.clientId,e.streamId,e.screen,!1,e.attributes,null===(n=this.userPriorityMap)||void 0===n?void 0:n.get(e.clientId)),this._initStreamListeners(f);var _=this._remoteStreams.get(e.clientId);_?_.push(f):this._remoteStreams.set(e.clientId,[f])}if(this._mediaServerClient.handler&&(f.observer=new Yz(f,this._mediaServerClient.handler)),!f.isScreen&&(i&&f.hasVideo&&(f.attributes.extvideo?(null===(o=f.observer)||void 0===o||o.setExternalVideoSource(!0),null===(a=f.observer)||void 0===a||a.setPushVideo(!0)):(null===(s=f.observer)||void 0===s||s.setExternalVideoSource(!1),null===(c=f.observer)||void 0===c||c.setPublishVideo(!0))),i&&f.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(f.attributes.extaudio?(null===(u=f.observer)||void 0===u||u.setExternalAudioSource(!0),null===(d=f.observer)||void 0===d||d.setPushAudio(!0)):(null===(l=f.observer)||void 0===l||l.setExternalAudioSource(!1),null===(h=f.observer)||void 0===h||h.setPublishAudio(!0))),!0===t&&!1===i)){var v=this._roomConfig,m=v.isAutoSubscribeAudio,y=v.isAutoSubscribeVideo;null===(p=f.observer)||void 0===p||p.setLogin(!0,{audio:!!m,video:!!y})}return t&&this.safeEmit(Cj.ON_ADD_STREAM,{stream:f}),f}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof i)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(i);var r={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,$_({},r)),this.safeEmit(Cj.USER_CONNECTION,{userInfo:r})}},t.prototype._onUserDisconnection=function(e){var t,i=this,r=e.clientId,n=e.tag,o=e.code;if(r)if(r===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;n===kj.kickedByAdmin?a=HB.KICKED_OUT:n===kj.onUserTokenDidExpire?a=HB.TOKEN_EXPIRED:n===kj.userDuplicateLogin&&(a=HB.DUPLICATE_LOGIN),o===Nj.roomDismissByAdmin&&(a=HB.ROOM_DISMISS),a&&this.safeEmit(nz.ON_ROOM_ERROR,{errorCode:a})}else{var s=GM.DROPPED;n===kj.userLeave?s=GM.QUIT:n===kj.kickedByAdmin?s=GM.KICKED_BY_ADMIN:n===kj.roleChanged&&(s=GM.SWITCH_TO_INVISIBLE);var c=function(){var e;i._remoteUsers.delete(r),null===(e=i._remoteStreams.get(r))||void 0===e||e.forEach((function(e){i._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:"client disconnected"})})),i.safeEmit(nz.ON_USER_LEAVE,{userInfo:{userId:r},reason:s})};if(n===kj.userDuplicateLogin){this._userDuplicateLoginTimerMap.has(r)&&(self.clearTimeout(this._userDuplicateLoginTimerMap.get(r)),this._userDuplicateLoginTimerMap.delete(r));var u=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(r,u)}else c()}},t.prototype._onRemoveStream=function(e){var t,i,r,n,o=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=this._remoteStreams.get(e.clientId);if(a){var s=a.find((function(t){return t.streamId==e.streamId}));s&&(null===(i=this._mediaServerClient)||void 0===i||i.handleRemoveStream(s,e).then((function(){if(!(null==s?void 0:s._workaround_1_)){var t=o._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId||(t.clean(),!1)})),o._remoteStreams.set(e.clientId,t)}})).finally((function(){o.safeEmit(Cj.ON_REMOVE_STREAM,{stream:s,reason:e.message})})),s.hasVideo&&(null===(r=s.observer)||void 0===r||r.setPublishVideo(!1)),s.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(null===(n=s.observer)||void 0===n||n.setPublishAudio(!1)))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g=e.clientId,S=e.streamId,E=e.attributes,b=this._findRemoteStream(g,S);if(b){var I=b.attributes,T=$_($_({},I),E),A=!1,R=T.localaudio!==I.localaudio,C=!1,O=!1,w=T.localvideo!==I.localvideo,k=!1,N=WH.NONE,P=WH.NONE;T.audiostream!==I.audiostream&&(A=T.localaudio,C=!!T.audiostream,T.audiostream?N|=JM.AUDIO:P|=JM.AUDIO),T.videostream!==I.videostream&&(O=T.localvideo,k=!!T.videostream,T.videostream?N|=JM.VIDEO:P|=JM.VIDEO),N&&this.safeEmit(nz.ON_USER_PUBLISH_STATE_CHANGE,{userId:g,mediaType:N,isScreen:b.isScreen,pubState:sz.PUB,remoteStream:b}),P&&this.safeEmit(nz.ON_USER_PUBLISH_STATE_CHANGE,{userId:g,mediaType:P,isScreen:b.isScreen,pubState:sz.UNPUB,remoteStream:b}),T.localaudio!==I.localaudio&&(T.localaudio?(T.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(i=b.observer)||void 0===i||i.setPushAudio(!0)):(null===(r=b.observer)||void 0===r||r.setExternalAudioSource(!1),null===(n=b.observer)||void 0===n||n.setEnableAudio(!0)),this.safeEmit(nz.ON_USER_START_AUDIO_CAPTURE,{userId:g})):(T.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),!b.isScreen&&this.safeEmit(nz.ON_USER_STOP_AUDIO_CAPTURE,{userId:g}))),T.localvideo!==I.localvideo&&(T.localvideo?(T.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(nz.ON_USER_START_VIDEO_CAPTURE,{userId:g})):(T.extvideo?(null===(p=b.observer)||void 0===p||p.setExternalVideoSource(!0),null===(f=b.observer)||void 0===f||f.setPushVideo(!1)):(null===(_=b.observer)||void 0===_||_.setExternalVideoSource(!1),null===(v=b.observer)||void 0===v||v.setEnableVideo(!1)),!b.isScreen&&this.safeEmit(nz.ON_USER_STOP_VIDEO_CAPTURE,{userId:g}))),A&&!R&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!w&&(null===(y=b.observer)||void 0===y||y.setRemoteUnmuteVideo(k)),b.attributes=T}},t.prototype._onPushTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=this._findRemoteStream(i,r);n||(n=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){return t.safeEmit(nz.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){sK.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=e.message,o=this._findRemoteStream(i,r);o&&this._mediaServerClient.unsubscribe4removeTrack(o,n).then((function(){var e;if(o._workaround_1_){var n=null===(e=t._remoteStreams.get(i))||void 0===e?void 0:e.filter((function(e){return e.streamId!==r}));t._remoteStreams.set(i,n||[])}t.safeEmit(nz.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){sK.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,i=e.nodes,r=e.reason;xV.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(i)&&i.length?this._getAccessNode=i[0]:this._getAccessFeedback=r,$F.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(r)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,i=this;this._isReconnecting=!0;try{for(var r=rv(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}$F.rtcReconnect(1002,nF.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,oF.PEERCONNECTION),this._join((function(){$F.rtcReconnected(aF.PEERCONNECTION_RECONNECTED,sF.PEERCONNECTION)}),(function(e){i._reconnectRecord.record(e),i._reconnectRecord.shouldReconnect?(sK.print("Reconnecting error, will reconnect after 3s",e),i._reconnectTimer=window.setTimeout(i._reconnect.bind(i),3e3)):(i.safeEmit(nz.RECONNECT_FAILED),i.destroy())}),!0)},t.prototype._handleAbnormalDisconnection=function(){sK.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t,i=this;if(e.next===Fz.DISCONNECTED)t=ZM.CONNECTION_STATE_DISCONNECTED;else if(e.next===Fz.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?ZM.CONNECTION_STATE_RECONNECTED:ZM.CONNECTION_STATE_CONNECTED;else{if(e.next!==Fz.CONNECTING)return;t=this._isReconnecting?ZM.CONNECTION_STATE_RECONNECTING:ZM.CONNECTION_STATE_CONNECTING}e.prev===Fz.CONNECTED&&e.next===Fz.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){i.safeEmit(wj.ON_CONNECTION_STATE_CHANGE,{state:ZM.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(wj.ON_CONNECTION_STATE_CHANGE,{state:t})},t.prototype._initStreamListeners=function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(i){var r;t.emit(nz.ON_SEI_MESSAGED_RECEIVED,{sei:i,remoteStreamKey:{userId:e.userId,roomId:null===(r=t._roomInfo)||void 0===r?void 0:r.roomId,streamIndex:e.isScreen?YM.STREAM_INDEX_SCREEN:YM.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(Cj.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(Cj.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(Cj.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){if(e.body){var t=e.body,i=t.error||0,r=az.START,n=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(r=az.START_FAILED);break;case"TranscodeStateChanged":r=0!==t.error?az.START_FAILED:az.START_SUCCESS;break;case"TranscodeStopped":r=0!==t.error?az.STOP_FAILED:az.STOP_SUCCESS;break;case"TranscodeUpdated":r=0!==t.error?az.UPDATE_FAILED:az.UPDATE_SUCCESS}this.safeEmit(Cj.POST_PROCESSING_MESSAGE,{code:i,protocol:t.protocol,error:t.error,eventType:r,message:n[i]})}this.safeEmit(Cj.POST_PROCESSING_MESSAGE,{code:i,message:n[i],type:e.type})}},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(Cj.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onSceneConfig=function(e){},t.prototype._onStreamFailed=function(e){var t,i,r,n,o,a;return tv(this,void 0,void 0,(function(){var s,c,u;return iv(this,(function(d){switch(d.label){case 0:return"publish"!==e.type?[3,2]:(s=void 0,(null===(t=this.localStream)||void 0===t?void 0:t.streamId)===e.streamId?s=this.localStream:(null===(i=this.localScreenStream)||void 0===i?void 0:i.streamId)===e.streamId&&(s=this.localScreenStream),s?(null==s||s.clean(),[4,null===(r=this._mediaServerClient)||void 0===r?void 0:r.unpublish(s).catch((function(){}))]):[2]);case 1:return d.sent(),null===(n=this._mediaServerClient)||void 0===n||n.publish(s).catch((function(){})),[3,5];case 2:return"subscribe"!==e.type?[3,5]:(c=this._remoteStreamStreamIdUserIdMap[e.streamId],(u=this._findRemoteStream(c,e.streamId))?[4,null===(o=this._mediaServerClient)||void 0===o?void 0:o.unsubscribe(u,JM.AUDIO_AND_VIDEO)]:[3,5]);case 3:return d.sent(),[4,null===(a=this._mediaServerClient)||void 0===a?void 0:a.subscribe(u,u.subMediaType,u.subLayer)];case 4:d.sent(),this.safeEmit(nz.RESUBSCRIBE,{stream:u}),d.label=5;case 5:return[2]}}))}))},t.prototype._onStreamControlMessage=function(e){var t,i;e.type===Rj.PushLimitWarn&&((null===(t=this._localStream)||void 0===t?void 0:t.pubAudio)||(null===(i=this._localStream)||void 0===i?void 0:i.pubVideo)||this.unpublish())},t.prototype._onPublishOnDemand=function(){var e,t,i,r,n,o,a,s,c,u,d;return tv(this,void 0,void 0,(function(){var l,h,p,f,_,v,m,y,g;return iv(this,(function(S){switch(S.label){case 0:return this._publishOnDemandBusy||!1===(null===(i=null===(t=null===(e=this._serverConfig)||void 0===e?void 0:e.engine_VPM)||void 0===t?void 0:t.ondemand)||void 0===i?void 0:i.enable)?[2]:(l=this._publishOnDemandItem,this._publishOnDemandItem=void 0,l?(null===(r=this._localStream)||void 0===r?void 0:r.enableSimulcast)&&(null===(n=this._localStream)||void 0===n?void 0:n.videoTransceiver)?(this._publishOnDemandBusy=!0,h=null===(o=this._localStream)||void 0===o?void 0:o.stream.id,p=null===(a=this._localStream)||void 0===a?void 0:a.videoTransceiver.sender,(f=p.getParameters())&&Array.isArray(f.encodings)&&Array.isArray(l)&&(_={},sK.print("_onPublishOnDemand exec","usedDescriptions: %o",l),l.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(h)){var i=null==e?void 0:e.Metadata.SubvideoIndex;_[i]=i}})),v={},null===(c=null===(s=this._localStream)||void 0===s?void 0:s.subVideoDescriptions)||void 0===c||c.forEach((function(e){void 0!==_[e.sub_index]&&(v[e.video_index]=e)})),m=(null===(d=null===(u=p.track)||void 0===u?void 0:u.getSettings())||void 0===d?void 0:d.height)||720,y=[],g=0,f.encodings=f.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),y.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy,bitrate:e.maxBitrate})):(g++,y.push({type:0,rid:e.rid}),e.active=!1)),e})),g===f.encodings.length&&(f.encodings[0].active=!0,$F.rtcInvokeStatus(JSON.stringify(y),0,"rscp_error",h,0)),$F.rtcInvokeStatus(JSON.stringify(y),0,"rscp",h,0)),[4,p.setParameters(f)]):[3,2]:[2]);case 1:S.sent(),this._publishOnDemandBusy=!1,S.label=2;case 2:return this._onPublishOnDemand(),[2]}}))}))},t.prototype._reportNetworkQuality=function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(nz.ON_NETWORK_QUALITY,e,t)},t.prototype._emitVideoSizeChange=function(e,t,i,r){var n;this.emit(nz.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(n=this.roomInfo)||void 0===n?void 0:n.roomId,userId:e,streamIndex:t?YM.STREAM_INDEX_SCREEN:YM.STREAM_INDEX_MAIN},{width:i,height:r})},t.prototype._emitSubscribeFallback=function(e){this.emit(nz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)},t}(JF),uK=function(){function e(){this._all_201_count=0,this._has_4xx=!1}return Object.defineProperty(e.prototype,"shouldReconnect",{get:function(){return!(this._all_201_count>=3||this._has_4xx)},enumerable:!1,configurable:!0}),e.prototype.record=function(e){var t=!1,i=!1;if(Array.isArray(e)){var r=0;e.map((function(e){var t,n,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(n=e.error)||void 0===n?void 0:n.code)<500&&(i=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&r++})),r===e.length&&(t=!0),t&&this._all_201_count++,i&&(this._has_4xx=!0)}},e.prototype.clear=function(){this._all_201_count=0,this._has_4xx=!1},e}(),dK=function(e,t){void 0===t&&(t={});var i=document.createElement(e);return t.id&&(i.id=t.id),t.classList&&t.classList.forEach((function(e){i.classList.add(e)})),t.style&&Object.assign(i.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=nv(e,2),r=t[0],n=t[1];"muted"===r?i.muted=!0:i.setAttribute(r,n)})),i},lK=new XF("Player",0),hK=new(function(e){function t(){var t=e.call(this)||this;return t._audioPlayMap=new Map,document.body?t._listenPageClick():window.addEventListener("load",(function(){t._listenPageClick()})),t}return Z_(t,e),Object.defineProperty(t.prototype,"players",{get:function(){return this._audioPlayMap},enumerable:!1,configurable:!0}),t.prototype._listenPageClick=function(){document.body.addEventListener("touchstart",this.resumeAudioPlayer.bind(this),!0),document.body.addEventListener("mousedown",this.resumeAudioPlayer.bind(this),!0)},t.prototype.resumeAudioPlayer=function(){this._audioPlayMap.forEach((function(e){e._hasManuallyPause||e.manuallyPlay().then((function(e){})).catch((function(e){lK.print("Replay audio player failed!",e)}))}))},t.prototype.addRequestClickPlayer=function(e){this._audioPlayMap.get(e.userId)||(lK.print("Put ".concat(e.userId," player into waiting array")),this._audioPlayMap.set(e.userId,e))},t.prototype.removeRequestClickPlayer=function(e){lK.print("Remove ".concat(e.userId," player from waiting array")),this._audioPlayMap.delete(e.userId)},t}(zF)),pK=new XF("Player",0),fK=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],_K={playsinline:"","webkit-playsinline":""},vK={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},mK=function(e){function t(t){var i=e.call(this)||this;i.mirrorType=$M.MIRROR_TYPE_NONE,i.played=!1,i._emitPlayFailed=!1,i._hasManuallyPause=!1,i.emitVideoEvent=function(e){var t,r,n={type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:i.isScreen};switch(i.emit("playback_event",n),e.type){case"canplay":case"loadeddata":i._internalPlay();break;case"playing":pK.print("VideoPlayerPlaying","[userId-".concat(i.userId,"] video element playing"))}},i._internalPlay=function(){var e,t;if(cB("_internalPlay video",{paused:null===(e=i._videoDom)||void 0===e?void 0:e.paused,manuallyPause:i._hasManuallyPause}),!i._hasManuallyPause&&(null===(t=i._videoDom)||void 0===t?void 0:t.paused)){var r=i._videoDom.play();(null==r?void 0:r.then)&&r.catch((function(e){var t,r,n,o;if(!i._emitPlayFailed){if("AbortError"===e.name)return $F.rtcError("video play failed, userId: ".concat(i.userId,", ").concat(e.name," ").concat(e.message),-1e3),void i.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:"play-error",currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:i.isScreen});i._emitPlayFailed=!0,$F.rtcError("video autoplay failed, userId: ".concat(i.userId,", ").concat(e.name," ").concat(e.message),-1e3),i.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=i._videoDom)||void 0===n?void 0:n.readyState)||0,userId:i.userId,eventName:"autoplay-error",currentTime:(null===(o=i._videoDom)||void 0===o?void 0:o.currentTime)||0,isScreen:i.isScreen})}}))}};var r=t.renderDom,n=t.userId;i.renderMode=void 0!==t.renderMode?t.renderMode:qM.RENDER_MODE_FIT;var o="string"==typeof r?document.getElementById(r):r;if(!o)throw new YB(HB.CANT_FIND_DOM,"can't find video dom ",r);return i._videoContainer=document.createElement("div"),i._videoContainer.style.width="100%",i._videoContainer.style.height="100%",i._videoContainer.style.position="relative",i._videoContainer.style.overflow="hidden",i._containerDom=o,i.userId=n,i.isScreen=!!t.isScreen,i._initVideo(),i._pausedTimer=setInterval((function(){i._videoDom&&(i._prevPaused!==i._videoDom.paused&&pK.print("VideoPlayer.videoDom.pausedChange",i._videoDom.paused),i._prevPaused=i._videoDom.paused)}),500),JL&&15===$L&&(i._safari15VideoTimer=window.setInterval((function(){try{i._videoContainer.style.display="block",setTimeout((function(){i._videoContainer.style.display="flex"}),500)}catch(e){}}),5e3)),i}return Z_(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=dK("video",{style:{width:"100%",height:"100%"},attributes:vK}),this._videoDom.id="".concat(this.userId,"_").concat(HL()),this.renderMode===qM.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===$M.MIRROR_TYPE_RENDER)),this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&fK.forEach((function(t){var i;null===(i=e._videoDom)||void 0===i||i.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e,t,i=this;this._videoDom&&(fK.forEach((function(e){var t;null===(t=i._videoDom)||void 0===t||t.removeEventListener(e,i.emitVideoEvent)})),null===(e=this._videoDom)||void 0===e||e.removeEventListener("canplay",this._internalPlay),null===(t=this._videoDom)||void 0===t||t.removeEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(i){var r;if("timeupdate"===i.eventName){var n=e.isScreen?1.5:.5;if(0===(null===(r=t._videoDom)||void 0===r?void 0:r.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>n;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var i;return tv(this,void 0,void 0,(function(){var t,r,n=this;return iv(this,(function(o){if(t=this._videoDom,pK.print("playVideo","play video track: ".concat(this.userId)),t&&t.srcObject instanceof MediaStream&&t.srcObject.getTrackById(null===(i=e.getTrack())||void 0===i?void 0:i.id)){try{$F.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(e){}return[2]}return t||(this._initVideo(),t=this._videoDom),pK.print("playVideo","play video by dom: ".concat(null==t?void 0:t.id)),(r=new MediaStream).addTrack(e.getTrack()),t.srcObject=r,t&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),t&&!this._videoContainer.contains(t)&&this._videoContainer.appendChild(t),setTimeout((function(){return n._internalPlay()})),this.played=!0,[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var i=new MediaStream;i.addTrack(t),this._videoDom.srcObject=i}},t.prototype.manuallyPause=function(){if(pK.print("Invoke VideoPlayer.manuallyPause",this.userId,this.isScreen),this.played){if(this._hasManuallyPause=!0,!this._videoDom)throw new YB(HB.INVALID_PARAMS,"Player not found");return this._videoDom.pause()}},t.prototype.manuallyPlay=function(){if(pK.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,this._hasManuallyPause=!1,!this._videoDom)throw new YB(HB.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||tU?this._videoDom.play():Promise.resolve()},t.prototype.mirror=function(e){pK.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?$M.MIRROR_TYPE_RENDER:$M.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e,t=this._containerDom;pK.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,(null==t?void 0:t.contains(this._videoContainer))&&t.removeChild(this._videoContainer),(null===(e=this._videoContainer)||void 0===e?void 0:e.contains(this._videoDom))&&this._videoContainer.removeChild(this._videoDom),clearInterval(this._pausedTimer)),this.__cumulativeTime=void 0,this.played=!1},t.prototype.destroy=function(){pK.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(this._videoDom.srcObject=null,delete this._videoDom),this._safari15VideoTimer&&(window.clearInterval(this._safari15VideoTimer),this._safari15VideoTimer=void 0)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(JV.exports.EventEmitter),yK=new(function(){function e(){this._context=_L.getAudioContextInstance()}return e.prototype.getDestinationNode=function(){return this._context.destination},e.prototype.createMediaElementSource=function(e){return this._context.createMediaElementSource(e)},e}()),gK=null,SK=function(e){function t(t,i){var r=void 0===i?{divId:void 0,muted:!1,isScreen:!1,useWebAudio:!1}:i,n=r.divId,o=r.muted,a=r.isScreen,s=r.useWebAudio,c=e.call(this)||this;if(c._stallCount=0,c.muted=!1,c._emitPlayFailed=!1,c._hasManuallyPause=!1,c.played=!1,c._useWebAudio=!1,c.emitAudioEvent=function(e){var t,i,r={type:"audio",rawEvent:e,readyState:(null===(t=c._audioDom)||void 0===t?void 0:t.readyState)||0,userId:c.userId,eventName:e.type,currentTime:(null===(i=c._audioDom)||void 0===i?void 0:i.currentTime)||0,isScreen:c.isScreen};"playing"===e.type&&(pK.print("AudioPlayerPlaying","[userId-".concat(c.userId,"] audio element playing")),eU&&(gK||(gK=window.setTimeout((function(){pK.print("AudioPlayerPlaying","[userId-".concat(c.userId,"] audio playing workaround"));var e=new AudioContext;e.close(),e=null,gK=null}),2500)))),"pause"===e.type&&pK.print("AudioPlayerPause","[userId-".concat(c.userId,"] audio element pause")),iU&&tU&&("canplay"===e.type?(clearTimeout(c._wechatTimer),c._wechatTimer=window.setTimeout((function(){c._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(c._wechatTimer)),c.emit("playback_event",r)},c._internalPlay=function(){var e,t;if(cB("_internalPlay audio",{paused:null===(e=c._audioDom)||void 0===e?void 0:e.paused,manuallyPause:c._hasManuallyPause}),!c._hasManuallyPause&&(null===(t=c._audioDom)||void 0===t?void 0:t.paused)){try{var i=c._audioDom.play();c._audioDom.volume=1,(null==i?void 0:i.then)&&i.catch((function(e){c._autoPlayError(e),$F.rtcError("audio autoplay failed, userId: ".concat(c.userId,": ").concat(e.message," ").concat(e.name),-1e3)})).then((function(){cB("_internalPlay successfully",{userId:c.userId})}))}catch(e){c._autoPlayError(e),$F.rtcError("audio autoplay failed, userId: ".concat(c.userId,": ").concat(e.message," ").concat(e.name),-1e3)}iU&&hK.addRequestClickPlayer(c)}},n){var u=document.getElementById(n);if(!u)throw new YB(HB.CANT_FIND_DOM,"can't find audio dom ".concat(n));c._containerDom=u}else c._containerDom=document.body;return c.userId=t,c.muted=o,c.isScreen=a,c._useWebAudio=!!s,c._initAudio(),c}return Z_(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=dK("audio",{style:{display:"none"},attributes:_K}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id="".concat(this.userId,"_").concat(HL()),this._containerDom.appendChild(this._audioDom),this._useWebAudio&&(this._sourceNode=yK.createMediaElementSource(this._audioDom),this._sourceNode.connect(yK.getDestinationNode()),pK.print("AudioPlayer","[userId-".concat(this.userId,"] use web audio output")))),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&fK.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.addEventListener(t,e.emitAudioEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(fK.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return tv(this,void 0,void 0,(function(){var i,r,n=this;return iv(this,(function(o){return pK.print("playAudio","play audio track: ".concat(this.userId)),this._track=e,(i=this._audioDom)&&i.srcObject instanceof MediaStream&&i.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)?(i.paused&&this._internalPlay(),[2]):(i||(this._initAudio(),i=this._audioDom),(r=new MediaStream).addTrack(e.getTrack()),i.srcObject=r,null==i||i.addEventListener("canplay",this._internalPlay),null==i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return n._internalPlay()})),this.played=!0,[2])}))}))},t.prototype._autoPlayError=function(e){var t,i;this._emitPlayFailed||(this._emitPlayFailed=!0,$F.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(i=this._audioDom)||void 0===i?void 0:i.currentTime)||0,isScreen:this.isScreen}))},t.prototype.manuallyPause=function(){if(pK.print("Invoke AudioPlayer.manuallyPause",this.userId,this.isScreen),this.played){if(this._hasManuallyPause=!0,!this._audioDom)throw new YB(HB.INVALID_PARAMS,"Player not found");return this._audioDom.pause()}},t.prototype.manuallyPlay=function(){var e;if(this._emitPlayFailed=!1,this._hasManuallyPause=!1,!this._audioDom)throw new YB(HB.INVALID_PARAMS,"Player not found");_L.resume(),this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return(null==t?void 0:t.then)?t:Promise.resolve(t)},t.prototype.setPlaybackDevice=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:return pK.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,TH.enumerateAudioPlaybackDevices()];case 1:return t=i.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return i.sent(),[2]}}))}))},t.prototype.stop=function(){var e,t=this._containerDom;pK.print("stopAudio","stop audio track: ".concat(this.userId)),this._useWebAudio&&(null===(e=this._sourceNode)||void 0===e||e.disconnect()),this._audioDom&&(this._audioDom.srcObject=null,t&&t.contains(this._audioDom)&&t.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){pK.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),delete this._track,this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom),this._useWebAudio&&delete this._sourceNode,iU&&hK.removeRequestClickPlayer(this)},t}(JV.exports.EventEmitter);function EK(e,t,i,r){var n=this,o=function(e,t){return tv(n,void 0,void 0,(function(){var n;return iv(this,(function(o){switch(o.label){case 0:return n=null==r?void 0:r.get(t),Array.isArray(n)&&(n=null==n?void 0:n.find((function(e){return e.isScreen===i}))),e?e.played?[4,e.manuallyPlay()]:[3,2]:[3,3];case 1:return o.sent(),[3,3];case 2:n&&(e instanceof mK&&n.videoTrack&&e.playVideo(n.videoTrack,n),e instanceof SK&&n.audioTrack&&e.playAudio(n.audioTrack)),o.label=3;case 3:return[2]}}))}))};if(t)return o(e.get(t),t);var a=[];return e.forEach((function(e,t){return a.push(o(e,t))})),Promise.all(a)}var bK=function(){function e(){this.userMessage={},this.roomMessage={},this._setTimer()}return e.prototype._setTimer=function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()},e.prototype._reportAndgReset=function(){this._report(),this._reset()},e.prototype._report=function(){var e=this;$F.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")},e.prototype._reset=function(){this.userMessage={},this.roomMessage={}},e.prototype._checkInitUserMessage=function(e,t){this.userMessage["".concat(t,"-").concat(e)]||(this.userMessage["".concat(t,"-").concat(e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:1/0,dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})},e.prototype._sendUserMessage=function(e,t,i){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_send_total++,i&&this.userMessage["".concat(t,"-").concat(e)].dc_send_binary++},e.prototype._recvUserMessage=function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++},e.prototype._sendUserFail=function(e,t){var i=this.userMessage["".concat(t,"-").concat(e)];i&&i.dc_send_fail++},e.prototype._sendUserAck=function(e,t,i,r,n){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=i,o.dc_cost_s2s+=r||0,o.dc_cost_peer_s2e+=n,o.dc_cost_e2s+=i-(r||0)-n,i<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=1e3&&o.dc_send_ack_1s++,i<o.dc_least_time&&(o.dc_least_time=i),i>o.dc_most_time&&(o.dc_most_time=i))},e.prototype.sendRoomMessage=function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:1/0,dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++},e.prototype.sendRoomFail=function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++},e.prototype.sendRoomAck=function(e,t){var i=this.roomMessage[e];i&&(i.dc_send_ack++,i.dc_cost_time+=t,t<i.dc_least_time&&(i.dc_least_time=t),t>i.dc_most_time&&(i.dc_most_time=t),t<=100?(i.dc_send_ack_100++,i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=200?(i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=400?(i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=1e3&&i.dc_send_ack_1s++)},e.prototype.sendP2PMessage=function(e,t){this._sendUserMessage(e,UF.P2P,t)},e.prototype.recvP2PMessage=function(e){this._recvUserMessage(e,UF.P2P)},e.prototype.sendP2PFail=function(e){this._sendUserFail(e,UF.P2P)},e.prototype.sendP2PAck=function(e,t,i,r){this._sendUserAck(e,UF.P2P,t,i,r)},e.prototype.sendP2POutRoomMessage=function(e,t){this._sendUserMessage(e,UF.P2P_OUTSIDE_ROOM,t)},e.prototype.recvP2POutRoomMessage=function(e){this._recvUserMessage(e,UF.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomFail=function(e){this._sendUserFail(e,UF.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomAck=function(e,t,i,r){this._sendUserAck(e,UF.P2P_OUTSIDE_ROOM,t,i,r)},e.prototype.sendP2serverMessage=function(e){this._sendUserMessage("",UF.P2SERVER,e)},e.prototype.sendP2serverFail=function(){this._sendUserFail("",UF.P2SERVER)},e.prototype.sendP2serveAck=function(e){this._sendUserAck("",UF.P2SERVER,e,0,0)},e.prototype.countP2PMessage=function(e,t,i,r,n){this.sendP2PMessage(t,i),e?this.sendP2PAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2PFail(t)},e.prototype.countRoomMessage=function(e,t,i,r){this.sendRoomMessage(t,i),e?this.sendRoomAck(t,Date.now()-r):this.sendRoomFail(t)},e.prototype.countUserMessageOutsideRoom=function(e,t,i,r,n){this.sendP2POutRoomMessage(t,i),e?this.sendP2POutRoomAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2POutRoomFail(t)},e.prototype.countServerMessage=function(e,t,i){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-i):this.sendP2serverFail()},e.prototype.destroy=function(){this._reset(),clearTimeout(this._timer)},e}(),IK="object"==("undefined"==typeof global?"undefined":vs(global))&&global&&global.Object===Object&&global,TK="object"==("undefined"==typeof self?"undefined":vs(self))&&self&&self.Object===Object&&self,AK=IK||TK||Function("return this")(),RK=AK.Symbol,CK=Object.prototype,OK=CK.hasOwnProperty,wK=CK.toString,kK=RK?RK.toStringTag:void 0;var NK=Object.prototype.toString;var PK=RK?RK.toStringTag:void 0;function DK(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":PK&&PK in Object(e)?function(e){var t=OK.call(e,kK),i=e[kK];try{e[kK]=void 0;var r=!0}catch(e){}var n=wK.call(e);return r&&(t?e[kK]=i:delete e[kK]),n}(e):function(e){return NK.call(e)}(e)}function MK(e){return null!=e&&"object"==vs(e)}var LK=Array.isArray;function UK(e){var t=vs(e);return null!=e&&("object"==t||"function"==t)}function xK(e){return e}function VK(e){if(!UK(e))return!1;var t=DK(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var FK=AK["__core-js_shared__"],BK=function(){var e=/[^.]+$/.exec(FK&&FK.keys&&FK.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var jK=Function.prototype.toString;var GK=/^\[object .+?Constructor\]$/,HK=Function.prototype,zK=Object.prototype,KK=HK.toString,WK=zK.hasOwnProperty,XK=RegExp("^"+KK.call(WK).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qK(e){return!(!UK(e)||(t=e,BK&&BK in t))&&(VK(e)?XK:GK).test(function(e){if(null!=e){try{return jK.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function YK(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}var JK=Date.now;var QK,ZK,$K,eW=function(){try{var e=function(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return qK(i)?i:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),tW=eW,iW=tW?function(e,t){return tW(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:xK,rW=(QK=iW,ZK=0,$K=0,function(){var e=JK(),t=16-(e-$K);if($K=e,t>0){if(++ZK>=800)return arguments[0]}else ZK=0;return QK.apply(void 0,arguments)}),nW=/^(?:0|[1-9]\d*)$/;function oW(e,t){var i=vs(e);return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&nW.test(e))&&e>-1&&e%1==0&&e<t}function aW(e,t,i){"__proto__"==t&&tW?tW(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}function sW(e,t){return e===t||e!=e&&t!=t}var cW=Object.prototype.hasOwnProperty;function uW(e,t,i){var r=e[t];cW.call(e,t)&&sW(r,i)&&(void 0!==i||t in e)||aW(e,t,i)}var dW=Math.max;function lW(e,t){return rW(function(e,t,i){return t=dW(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,o=dW(r.length-t,0),a=Array(o);++n<o;)a[n]=r[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=r[n];return s[t]=i(a),YK(e,this,s)}}(e,t,xK),e+"")}function hW(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function pW(e){return null!=e&&hW(e.length)&&!VK(e)}var fW=Object.prototype;function _W(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||fW)}function vW(e){return MK(e)&&"[object Arguments]"==DK(e)}var mW=Object.prototype,yW=mW.hasOwnProperty,gW=mW.propertyIsEnumerable,SW=vW(function(){return arguments}())?vW:function(e){return MK(e)&&yW.call(e,"callee")&&!gW.call(e,"callee")};var EW="object"==("undefined"==typeof exports?"undefined":vs(exports))&&exports&&!exports.nodeType&&exports,bW=EW&&"object"==("undefined"==typeof module?"undefined":vs(module))&&module&&!module.nodeType&&module,IW=bW&&bW.exports===EW?AK.Buffer:void 0,TW=(IW?IW.isBuffer:void 0)||function(){return!1},AW={};AW["[object Float32Array]"]=AW["[object Float64Array]"]=AW["[object Int8Array]"]=AW["[object Int16Array]"]=AW["[object Int32Array]"]=AW["[object Uint8Array]"]=AW["[object Uint8ClampedArray]"]=AW["[object Uint16Array]"]=AW["[object Uint32Array]"]=!0,AW["[object Arguments]"]=AW["[object Array]"]=AW["[object ArrayBuffer]"]=AW["[object Boolean]"]=AW["[object DataView]"]=AW["[object Date]"]=AW["[object Error]"]=AW["[object Function]"]=AW["[object Map]"]=AW["[object Number]"]=AW["[object Object]"]=AW["[object RegExp]"]=AW["[object Set]"]=AW["[object String]"]=AW["[object WeakMap]"]=!1;var RW="object"==("undefined"==typeof exports?"undefined":vs(exports))&&exports&&!exports.nodeType&&exports,CW=RW&&"object"==("undefined"==typeof module?"undefined":vs(module))&&module&&!module.nodeType&&module,OW=CW&&CW.exports===RW&&IK.process,wW=function(){try{var e=CW&&CW.require&&CW.require("util").types;return e||OW&&OW.binding&&OW.binding("util")}catch(e){}}(),kW=wW&&wW.isTypedArray,NW=kW?function(e){return function(t){return e(t)}}(kW):function(e){return MK(e)&&hW(e.length)&&!!AW[DK(e)]},PW=NW,DW=Object.prototype.hasOwnProperty;function MW(e,t){var i=LK(e),r=!i&&SW(e),n=!i&&!r&&TW(e),o=!i&&!r&&!n&&PW(e),a=i||r||n||o,s=a?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],c=s.length;for(var u in e)!t&&!DW.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||oW(u,c))||s.push(u);return s}var LW=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object),UW=LW,xW=Object.prototype.hasOwnProperty;function VW(e){return pW(e)?MW(e):function(e){if(!_W(e))return UW(e);var t=[];for(var i in Object(e))xW.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}var FW=Object.prototype.hasOwnProperty;function BW(e){if(!UK(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=_W(e),i=[];for(var r in e)("constructor"!=r||!t&&FW.call(e,r))&&i.push(r);return i}var jW,GW=(jW=function(e,t){!function(e,t,i,r){var n=!i;i||(i={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=r?r(i[s],e[s],s,i,e):void 0;void 0===c&&(c=e[s]),n?aW(i,s,c):uW(i,s,c)}}(t,function(e){return pW(e)?MW(e,!0):BW(e)}(t),e)},lW((function(e,t){var i=-1,r=t.length,n=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(n=jW.length>3&&"function"==typeof n?(r--,n):void 0,o&&function(e,t,i){if(!UK(i))return!1;var r=vs(t);return!!("number"==r?pW(i)&&oW(t,i.length):"string"==r&&t in i)&&sW(i[t],e)}(t[0],t[1],o)&&(n=r<3?void 0:n,r=1),e=Object(e);++i<r;){var a=t[i];a&&jW(e,a,i,n)}return e}))),HW=GW;function zW(e,t){return function(e,t){for(var i=-1,r=null==e?0:e.length,n=Array(r);++i<r;)n[i]=t(e[i],i,e);return n}(t,(function(t){return e[t]}))}function KW(e){return null==e?[]:zW(e,VW(e))}var WW,XW=function(e,t){return tv(void 0,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:i=new Audio(URL.createObjectURL(new Blob([e],t))),r.label=1;case 1:return r.trys.push([1,3,,4]),i.muted=!0,[4,i.play()];case 2:return r.sent(),i.pause(),[2,!0];case 3:return r.sent(),[2,!1];case 4:return[2]}}))}))},qW=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this._failedAudioList=[],this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],this.id="AudioMixingManager",this._context=e,this._localGainNode.gain.value=1}return e.prototype.mixMediaStream=function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)},e.prototype.startAudioMixing=function(e,t,i){return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,f,_,v,m=this;return iv(this,(function(y){switch(y.label){case 0:if(r=i.playCount,$B(n=i.type,"mixingType",KW(sG)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=CH(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_STOPPED,error:zB.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,4]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw m._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_FAILED,error:zB.AUDIO_MIXING_ERROR_START_FAILED}),new YB(HB.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:return d=y.sent(),l=void 0,t.endsWith("mp3")?l={type:"audio/mpeg"}:t.endsWith("aac")&&(l={type:"audio/aac"}),[4,XW(d,l)];case 3:if(!y.sent())throw this._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_FAILED,error:zB.AUDIO_MIXING_ERROR_START_FAILED}),new YB(HB.LOAD_RESOURCES_FAILED,"invalid audio resource");(c=new Audio).crossOrigin="anonymous",c.src=URL.createObjectURL(new Blob([d],l)),y.label=4;case 4:r<=0?c.loop=!0:r>0&&(h=r,c.onended=function(){--h>0?c.play():(m.mixingMap.delete(e),m._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_FINISHED,error:zB.AUDIO_MIXING_ERROR_OK}))}),y.label=5;case 5:return y.trys.push([5,7,,8]),[4,c.play()];case 6:return y.sent(),[3,8];case 7:return p=y.sent(),console.error(p),this._failedAudioList.push(c),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:YM.STREAM_INDEX_MAIN,mediaType:JM.AUDIO}),[3,8];case 8:if(f=this._sharedAudioContext.createMediaElementSource(c),_=this._sharedAudioContext.createGain(),v=this.volumeConfig.get(e),_.gain.value=v?v/100:1,f.connect(_).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:f,audioNode:c,gainNode:_,type:"file"}),n===sG.PUBLISH)try{_.disconnect(this._sharedAudioContext.destination)}catch(e){}else _.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],i.type),this._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_PLAYING,error:zB.AUDIO_MIXING_ERROR_OK}),[2]}}))}))},e.prototype.stopAudioMixing=function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_STOPPED,error:zB.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_PAUSED,error:zB.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())},e.prototype.resumeAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_PLAYING,error:zB.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return tv(this,void 0,void 0,(function(){var i,r=this;return iv(this,(function(n){switch(n.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw r._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_FAILED,error:zB.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new YB(HB.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(t){throw r._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_FAILED,error:zB.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new YB(HB.LOAD_RESOURCES_FAILED,"Load resources failed",t)}))];case 1:return i=n.sent(),[4,XW(i)];case 2:if(!n.sent())throw this._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_FAILED,error:zB.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new YB(HB.LOAD_RESOURCES_FAILED,"Load resources failed");return this._context.emitMessage({mixId:e,state:cG.AUDIO_MIXING_STATE_PRELOADED,error:zB.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([i])))},filePath:t}),[2]}}))}))},e.prototype.unloadAudioMixing=function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)},e.prototype.getAudioMixingVolume=function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0},e.prototype.setAudioMixingVolume=function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var i=this.mixingMap.get(e);i&&(i.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),i=this.mixingMap.get(e);return t||i?t?1e3*t.audioNode.duration:i?1e3*i.audioNode.duration:0:0},e.prototype.getAudioMixingCurrentPosition=function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0},e.prototype.setAudioMixingPosition=function(e,t){var i=this.mixingMap.get(e);i&&(i.audioNode.currentTime=t/1e3,i.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){$B(e,"type",KW(sG));var t=this._context.getLocalAudioTrack();if(t){var i=CH(t.getTrack());if(i&&this.mixMediaStream(i),e===sG.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:cG.AUDIO_MIXING_STATE_PCM_ENABLED,error:zB.AUDIO_MIXING_ERROR_OK})}},e.prototype.disableAudioMixingBuffer=function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:cG.AUDIO_MIXING_STATE_PCM_DISABLED,error:zB.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(e){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var i=t.cachedBuffer.shift();i&&t.pushAudioMixingBuffer(i)}}}},e.prototype.stopAll=function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,i){e.stopAudioMixing(i)}))},Object.defineProperty(e.prototype,"mixTrack",{get:function(){return this._audioDestination.stream.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sharedAudioContext",{get:function(){return this._sharedAudioContext},enumerable:!1,configurable:!0}),e.prototype.resumeLocalPlay=function(){return tv(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:e=[],c.label=1;case 1:c.trys.push([1,10,11,12]),t=rv(this._failedAudioList),i=t.next(),c.label=2;case 2:if(i.done)return[3,9];r=i.value,c.label=3;case 3:return c.trys.push([3,7,,8]),r instanceof HTMLAudioElement?(r.muted=!1,[4,r.play()]):[3,5];case 4:return c.sent(),[3,6];case 5:r.start(),c.label=6;case 6:return[3,8];case 7:return n=c.sent(),e.push(r),console.error(n),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:YM.STREAM_INDEX_MAIN,mediaType:JM.AUDIO}),[3,9];case 8:return i=t.next(),[3,2];case 9:return[3,12];case 10:return o=c.sent(),a={error:o},[3,12];case 11:try{i&&!i.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 12:return this._failedAudioList=e,[2]}}))}))},e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},ev([aB("default","id","filePath","options")],e.prototype,"startAudioMixing",null),ev([aB("default","id")],e.prototype,"stopAudioMixing",null),ev([aB("default","id")],e.prototype,"pauseAudioMixing",null),ev([aB("default","id")],e.prototype,"resumeAudioMixing",null),ev([aB("default","id")],e.prototype,"preloadAudioMixing",null),ev([aB("default","id")],e.prototype,"unloadAudioMixing",null),ev([aB("default","id")],e.prototype,"getAudioMixingVolume",null),ev([aB("default","id","volume")],e.prototype,"setAudioMixingVolume",null),ev([aB("default","id")],e.prototype,"getAudioMixingDuration",null),ev([aB("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),ev([aB("default","id","position")],e.prototype,"setAudioMixingPosition",null),ev([aB("default","type")],e.prototype,"enableAudioMixingBuffer",null),ev([aB()],e.prototype,"disableAudioMixingBuffer",null),ev([aB("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(WW||(WW={}));var YW=new XF("RTMClient",1),JW=function(e){function t(t){var i=e.call(this)||this;return i._appId=t,i._dataChannelSignal=null,i._handler=null,i._dataChannelSignalState=Fz.DISCONNECTED,i._loginSessionId=null,i._userId=null,i._token=null,i._isReconnecting=!1,i._reconnectTimer=null,i._loginResolveCallback=null,i._loginRejectCallback=null,i._iceConfigNode=null,i._wait_login_token=!1,i}return Z_(t,e),t.prototype.login=function(e,t){var i=this;return new Promise((function(r,n){if(YW.print("login","invoke login, token: %o, userId: %o",e,t),i._loginSessionId)throw new YB(HB.ALREADY_LOGIN,"Already logined");if(i._loginResolveCallback)throw new YB(HB.LOGIN_FAILED,"Is logging in, please try again later.");i._userId=t,i._token=e,rB.setStats({rtc_app_id:i._appId,user_id:t}),i._loginResolveCallback=r,i._loginRejectCallback=n,i._dataChannelSignal?i._login():(YW.print("login","init dataChannelSingling"),i._dataChannelSignalState=Fz.CONNECTING,i._createDataChannelSignaling(t).then((function(e){i._dataChannelSignal=e,i._login()})).catch((function(){i._onDisconnect()})))}))},t.prototype.logout=function(){var e;return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new YB(HB.NOT_LOGIN,"login first");return[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:Vj.C2RTM}).catch((function(){}))];case 1:return t.sent(),this._closeDataChannelSignaling(),this._clearState(),[2]}}))}))},t.prototype.updateLoginToken=function(e){return tv(this,void 0,void 0,(function(){var t=this;return iv(this,(function(i){return this._token=e,[2,new Promise((function(e,i){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=i,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new YB(HB.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:Vj.C2RTM})];case 1:return[2,null==(t=i.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){if(!this._loginSessionId||!this._userId)throw new YB(HB.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})]}))}))},t.prototype.setServerParams=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new YB(HB.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:e,url:t},{functionType:Vj.C2RTM})];case 1:return i.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){if(!this._loginSessionId||!this._userId)throw new YB(HB.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:Mj.BUSINESS_SERVER,msg:e})]}))}))},t.prototype.destroy=function(){this._clearState(),this._closeDataChannelSignaling(),e.prototype.removeAllListeners.call(this)},t.prototype._login=function(){var e=this;if(this._userId){var t=HL();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:XL.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:jV.VERSION,deviceId:xV.getDeviceId(),appId:this._appId,userId:this._userId},accessParams:JSON.stringify({requireICEUfragV2:!0})},{functionType:Vj.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var i,r,n=t||{},o=n.code,a=n.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(i=HB.INVALID_PARAMS,r="Invalid userId"):(i=HB.INVALID_TOKEN,r="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(i=HB.LOGIN_FAILED,r="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new YB(i,a||r))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return iv(this,(function(d){switch(d.label){case 0:if(r=new zj,n=this._iceConfigNode)return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,null==r?void 0:r.getAccessNode(this._appId,"",e,xV.getDeviceId(),"")];case 2:if(o=d.sent(),!(n=o[0]))throw new Error;return[3,4];case 3:throw d.sent(),cB("rtm.login.getNodeFailed","",0,!0),new YB(HB.ICE_SERVER_WRONG,"get ICE config failed");case 4:cB("rtm.login.getNodeSuccess",n,0,!0),YW.print("_createDataChannelSignaling()","get node success",n),this._handler=Lz(eB),null===(t=this._handler)||void 0===t||t.once("disconnect",(function(){YW.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),d.label=5;case 5:return d.trys.push([5,7,,8]),[4,null===(i=this._handler)||void 0===i?void 0:i.connect(n)];case 6:return a=d.sent(),YW.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=Fz.CONNECTED,[3,8];case 7:throw s=d.sent(),this._iceConfigNode=null,this._dataChannelSignalState=Fz.DISCONNECTED,new YB(HB.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 8:return c=new jj(a),YW.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){YW.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(Cj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(Cj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(Cj.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(Cj.NODE_CHANGE,(function(e){cB("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),[2,c]}}))}))},t.prototype._closeDataChannelSignaling=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null},t.prototype._checkDataChannelSignal=function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==Fz.CONNECTED)throw new YB(HB.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=Fz.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._reconnect=function(){var e=this;!this._isReconnecting&&this._userId&&(YW.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){YW.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){YW.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))},t.prototype._clearState=function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)},t}(JV.exports.EventEmitter),QW=function(e){function t(t,i){var r=e.call(this)||this;return r._appId=t,r.remoteStreams=new Map,r.remoteStreamsStats=new Map,r._context=i,r}return Z_(t,e),t.prototype.connect=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new zz(this._context),this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new YB(HB.REPEAT_PLAY,"repeat play public media stream");return(t=new Sz(e,e,!1,!0,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var r=function(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var i={seiCount:0,seis:[]},r=!1,n=2;n<t.byteLength;){var o=t.getUint16(n);if(n+=2,t.byteLength-n<o){r=!0;break}var a=new Uint8Array(e.buffer,n,o);if(n+=o,t.byteLength-n>0&&t.byteLength-n<=2){r=!0;break}i.seiCount++,i.seis.push(a)}return r&&(i.seiCount=1,i.seis=[e]),i}(e),n=0;n<r.seiCount;n++)i.emit(nz.ON_SEI_MESSAGED_RECEIVED,{sei:r.seis[n],publicStreamId:t.streamId})})),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return r.sent(),this.remoteStreams.set(e,t),this.remoteStreamsStats.set(e,{decodeFailedCount:0}),[2,t]}}))}))},t.prototype.stopPlayPublicStream=function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)},t.prototype.destroy=function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()},t.prototype._handleReconnected=function(){return tv(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s,c=this;return iv(this,(function(u){clearTimeout(this._reconnectTimer),e=function(e){t.remoteStreams.delete(e),t.startPlayPublicStream(e).then((function(){var t=c.remoteStreams.get(e);c.safeEmit(nz.RESUBSCRIBE,{stream:t})}))},t=this;try{for(i=rv(this.remoteStreams),r=i.next();!r.done;r=i.next())n=nv(r.value,1),o=n[0],e(o)}catch(e){a={error:e}}finally{try{r&&!r.done&&(s=i.return)&&s.call(i)}finally{if(a)throw a.error}}return[2]}))}))},t.prototype._reconnect=function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)},t.prototype._bindEvents=function(){var e,t,i=this;null===(e=this._mediaServerClient)||void 0===e||e.on(wj.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){if(i.emit("onRemoteStreamStats",e),e.videoStats&&e.receivedKBitrate&&e.receivedFrameRate&&!e.decoderOutputFrameRate){var t=i.remoteStreamsStats.get(e.publicStreamId);t&&(t.decodeFailedCount+=1,3===t.decodeFailedCount&&i.emit("streamDecodeFailed",{publicStreamId:e.publicStreamId}))}}))},t}(JF),ZW=new XF("AudioDeviceManager",1),$W=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return Z_(t,e),t.prototype.startAudioPlaybackDeviceTest=function(e,t){return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:if(this._isAudioPlaybackDeviceTesting||this._isAudioDeviceRecordTesting)throw new YB(HB.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,ZW.print("startAudioPlaybackDeviceTest()","Invoke"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._playAudioFile(e,{loop:!0})];case 2:return r.sent(),[3,4];case 3:throw i=r.sent(),this.stopAudioPlaybackDeviceTest(),i;case 4:return this._startEmitAudioPlaybackDeviceTestVolume(t),[2]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){this._isAudioPlaybackDeviceTesting&&(ZW.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.startAudioDeviceRecordTest=function(e){return tv(this,void 0,void 0,(function(){var t=this;return iv(this,(function(i){switch(i.label){case 0:if(!window.MediaRecorder)throw new YB(HB.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");if(this._isAudioDeviceRecordTesting)throw new YB(HB.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,ZW.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){ZW.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),t._stopAudioCaptureAndRecoder()}),3e4),[4,this._startAudioCaptureAndRecoder(e)];case 1:return i.sent(),delete this._audioCaptureAndRecoderResolve,[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){ZW.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(ZW.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){ZW.print("destroy()","Invoke"),e.prototype.removeAllListeners.call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()},t.prototype._playAudioFile=function(e,t){var i=this;return new Promise((function(r,n){i._audioElement=dK("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),i._audioElement.loop=t.loop,ZW.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),i._audioElement.oncanplay=function(){ZW.print("_playAudioFile()","oncanplay"),r()},i._audioElement.onerror=function(e){var t,r;n(new YB(HB.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(r=null===(t=i._audioElement)||void 0===t?void 0:t.error)||void 0===r?void 0:r.message))))}}))},t.prototype._destroyAudioElement=function(){this._audioElement&&(ZW.print("_destroyAudioElement()","Invoke"),this._audioElement.src="",delete this._audioElement,this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())},t.prototype._startEmitAudioPlaybackDeviceTestVolume=function(e){var t=this;e=Math.max(e,100),this._audioElement&&(ZW.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new fL(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))},t.prototype._stopEmitAudioPlaybackDeviceTestVolume=function(){var e;void 0!==this._playbackDeviceTestTimer&&(ZW.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher},t.prototype._startAudioCaptureAndRecoder=function(e){return tv(this,void 0,void 0,(function(){var t,i,r=this;return iv(this,(function(n){switch(n.label){case 0:return t=this,[4,zH({})];case 1:return t._audioTrack=n.sent(),i=CH(this._audioTrack.getTrack()),ZW.print("startAudioDeviceRecordTest()","create microphone track success!"),[2,new Promise((function(t,n){r._mediaRecorder=new MediaRecorder(i),r._mediaRecorder.ondataavailable=function(i){return tv(r,void 0,void 0,(function(){var r,o,a,s=this;return iv(this,(function(c){switch(c.label){case 0:if(!this._isAudioDeviceRecordTesting)return[3,5];ZW.print("startAudioDeviceRecordTest()","get recorded file."),r=new Blob([i.data]),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._playAudioFile(URL.createObjectURL(r),{loop:!1})];case 2:return c.sent(),[3,4];case 3:return o=c.sent(),[2,n(o)];case 4:return this._startEmitAudioPlaybackDeviceTestVolume(e),null===(a=this._audioElement)||void 0===a||a.addEventListener("ended",(function(){s.stopAudioDevicePlayTest(),t()})),this._audioCaptureAndRecoderResolve=t,[3,6];case 5:t(),c.label=6;case 6:return[2]}}))}))},r._mediaRecorder.onerror=function(e){n(new YB(HB.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},r._mediaRecorder.start()}))]}}))}))},t.prototype._stopAudioCaptureAndRecoder=function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack},t}(JV.exports.EventEmitter),eX=function(){function e(){this.engineBAC={},this.engineANM={},this._init()}return e.prototype._init=function(){return tv(this,void 0,void 0,(function(){var e,t;return iv(this,(function(i){switch(i.label){case 0:return e=new Kj,t=this,[4,e.getAudioProfile()];case 1:return t.engineBAC=i.sent(),[2]}}))}))},e.prototype.updateEngineBAC=function(e){e&&(this.engineBAC={codec:this.engineBAC.codec,play:$_($_({},this.engineBAC.play),e.play),record:$_($_({},this.engineBAC.record),e.record)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))},e.prototype.updateEngineANM=function(e){e&&(this.engineANM={bitrate:e.enc_param.bitrate,channel:e.enc_param.chn})},e.prototype.setAudioProfile=function(e){var t,i,r;switch(e){case uL.fluent:i=16e3,t=24e3;break;case uL.standard:i=48e3,t=48e3;break;case uL.hd:i=48e3,t=128e3,r=2;break;case uL.standardStereo:i=48e3,t=8e4,r=2;break;case uL.hdMono:i=48e3,t=128e3}t&&(this.bitrate=t),r&&(this.channel=r),i&&(this.sampleRate=i)},e.prototype.setBitrate=function(e){e>128e3&&(e=128e3),this.bitrate=e},e.prototype.setAEC=function(e){this.aec=e},e.prototype.setAGC=function(e){this.agc=e},e.prototype.setANS=function(e){this.ans=e},e.prototype.getOpusConfigStr=function(){var e,t,i=";";return this.bitrate&&(i+="maxaveragebitrate=".concat(this.bitrate,";")),(this.sampleRate||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.sr))&&(i+="maxplaybackrate=".concat(this.sampleRate||this.engineBAC.record.sr,";sprop-maxcapturerate=").concat(this.sampleRate||this.engineBAC.record.sr,";")),((this.channel||1)>1||(null===(t=this.engineBAC.record)||void 0===t?void 0:t.chn)>1)&&(i+="stereo=1;sprop-stereo=1;"),i.slice(0,-1)},Object.defineProperty(e.prototype,"config",{get:function(){var e,t,i;return{bitrate:this.bitrate||this.engineANM.bitrate,channel:this.channel||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.chn)||(null===(t=this.engineANM)||void 0===t?void 0:t.chn)||1,aec:!!this.aec,agc:!!this.agc,ans:!!this.ans,sampleRate:this.sampleRate||(null===(i=this.engineBAC.record)||void 0===i?void 0:i.sr)}},enumerable:!1,configurable:!0}),e}(),tX=new WeakMap,iX=function(e,t,i){if(requestAnimationFrame){var r=tX.get(e);(null==r?void 0:r[t])?rX(e,t):r||(r={},tX.set(e,r));var n=e[t];!function o(){var a=requestAnimationFrame(o);r[t]=a;var s=e[t];n!==s&&(n=s,i(s))}()}},rX=function(e,t){var i=tX.get(e);t&&i[t]?cancelAnimationFrame(i[t]):Object.keys(i).length&&Object.keys(i).forEach((function(e){cancelAnimationFrame(i[e])}))},nX=new XF("Engine",0),oX=function(e){function t(t,i){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._remoteScreenAudioPlayer=new Map,r._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._enableSimulcast=!1,r._videoStreamEncodeConfig=[qV],r._screenStreamEncodeConfig=[YV],r._tipDomList=[],r._pauseAllSubscribeState={audio:void 0,video:void 0},r._audioPropertiesReportTimer=null,r._localAudioNoInputCount=0,r._mirrorType=$M.MIRROR_TYPE_RENDER,r._audioDeviceManager=new $W,r._audioProfileManager=new eX,r._remoteVideoConfig=new Map,r._userPriorityMap=new Map,r._subscribeFallbackOption=nL.DISABLE,r._singleStreamRender=!0,r._prevLocalVideoSize={height:0,width:0},r.resubedUserId=new Set,r._videoCaptureStallCount=0,r._vStats="-V",r._aStats="-A",r.audioPlayerUseWebAudio=!1,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=sG.PLAYOUT_AND_PUBLISH),tv(r,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:return nX.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(i=this._room)||void 0===i?void 0:i.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(PD.onAudioMixingStateChanged,e)},r._onAudioMixingAutoplayFailed=function(e){r.safeEmit(PD.onAutoplayFailed,e)},r._appId=t,r._pubLock=new Vz("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new qW({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=r,r._engine_number=Math.floor(100*Math.random()+1),window["__rtc_engine__".concat(r._engine_number)]=r,r._trackSourceType={video:BM.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:BM.VIDEO_SOURCE_TYPE_INTERNAL,audio:jM.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:jM.AUDIO_SOURCE_TYPE_INTERNAL},r._config=i,r._rtmClient=new JW(t),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new bK,location.search.includes("_use_web_audio_")&&(r.audioPlayerUseWebAudio=!0),(new Kj).getWebRtcConfig({appId:r.appId,deviceId:xV.getDeviceId()}),r}return Z_(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:return nX.print("updateToken()","token: %s",e),ZB(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(n=null===(i=this._room)||void 0===i?void 0:i._roomInfo,o=n.roomId,a=n.userInfo,s=this._tempRoomConfig,delete this._tempRoomConfig,[4,this.joinRoom(e,o,a,s)]):[3,2];case 1:return[2,c.sent()];case 2:if(!this._room)throw new YB(HB.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(r=this._room)||void 0===r?void 0:r.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.setVideoCaptureDevice=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:return nX.print("setVideoCaptureDevice()","deviceId: %s",e),ZB(e,"deviceId"),this._localVideoTrack?tU&&iU&&(r=null===(i=null===(t=this._localVideoTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.getSettings())&&r.deviceId===e?[2,Promise.resolve()]:(n=this._videoStreamConstraints,"user"===e||"environment"===e||"left"===e||"right"===e?(delete n.deviceId,n.facingMode=e):!oU||eU?n.deviceId={exact:e}:delete n.deviceId,this._videoStreamConstraints=n,[4,HH(n)]):(this._localVideoDeviceId=e,[2,Promise.resolve()]);case 1:return o=a.sent(),this._initLocalTrackEvents(o),this._localVideoTrack.close(),this._localVideoTrack=o,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(o),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))},t.prototype.setAudioCaptureDevice=function(e){return tv(this,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:return nX.print("setAudioCaptureDevice()","deviceId: %s",e),ZB(e,"deviceId"),this._localAudioTrack?((t=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=t,this._localAudioTrack.close(),[4,zH(t,this._audioProfileManager)]):(this._localAudioDeviceId=e,[2,Promise.resolve()]);case 1:return i=r.sent(),this._initLocalTrackEvents(i),this._localAudioTrack=i,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){TH.on(PD.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),TH.on(PD.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O=this;null===(e=this._room)||void 0===e||e.on(Cj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(Cj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._room)||void 0===i||i.on(Cj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._room)||void 0===r||r.on(nz.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(nz.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(nz.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(Cj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(Cj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(Cj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(Cj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(Cj.POST_PROCESSING_MESSAGE,(function(e){!function(e){return"2.0"===e.protocol}(e)?"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e):O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message})})),null===(l=this._room)||void 0===l||l.on(wj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(nz.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(nz.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(nz.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(nz.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(nz.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=O._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&O.safeEmit(PD.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(nz.ON_REMOTE_STREAM_STATS,(function(e){O._checkRemoteStats(e),O.safeEmit(PD.onRemoteStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(nz.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(PD.onLocalStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(nz.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(S=this._room)||void 0===S||S.on(nz.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(PD.onUserStartAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(nz.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(PD.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(nz.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(PD.onUserStartVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(nz.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(PD.onUserStopVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(nz.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(PD.onSEIMessageReceived,e)})),null===(A=this._room)||void 0===A||A.on(nz.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(PD.onRemoteVideoSizeChanged,e,t)})),null===(R=this._room)||void 0===R||R.on(nz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(PD.onSimulcastSubscribeFallback,e)})),null===(C=this._room)||void 0===C||C.on(nz.RECONNECT_FAILED,(function(){O.safeEmit(PD.onError,{errorCode:HB.RECONNECT_FAILED})}))},t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];return sj(t)&&sB(t,uU(i)),e.prototype.safeEmit.apply(this,ov([t],nv(i),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,i,r){return tv(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h;return iv(this,(function(p){switch(p.label){case 0:if(location.search.includes("__rtc_debug_2__")){try{for(n=rv(Object.keys(localStorage)),o=n.next();!o.done;o=n.next())(a=o.value).startsWith("RTC_ACCESS")&&localStorage.removeItem(a)}catch(e){l={error:e}}finally{try{o&&!o.done&&(h=n.return)&&h.call(n)}finally{if(l)throw l.error}}e=null}if(nX.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,i,r),ij(e)||ZB(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new YB(HB.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){ej(e,"userInfo"),rj(e.userId),ij(e.extraInfo)||ZB(e.extraInfo,"userInfo.extraInfo",1,200)}(i),s={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:cL.communication},HW(s,r),function(e){ej(e,"roomConfig"),JB(e.isAutoPublish,"roomConfig.isAutoPublish"),JB(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),JB(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(s),!this._room||this._room.connectionState===Fz.DISCONNECTED)return[3,1];throw new YB(HB.REPEAT_JOIN,"Already joined");case 1:this._room=new cK(r,{audioProfileManager:this._audioProfileManager,enableFallbackHandler:sX(this.appId)}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),c=this._liveTranscodeConfig&&zV("started",this._liveTranscodeConfig),p.label=2;case 2:return p.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,$_($_({},i),{businessId:this._businessId,role:this._visibility?WW.NORMAL_USER:WW.SILENT_USER}),c,this._useCloudProxy)];case 3:return u=p.sent(),this._roomConfig=r,this._tempRoomConfig&&delete this._tempRoomConfig,(null==r?void 0:r.isAutoPublish)&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:JM.AUDIO_AND_VIDEO}):this.safeEmit(PD.onAutoPublishResult,{isScreen:!1,state:WM.PUBLISH_FAIL})),[2,u];case 4:throw(d=p.sent()).code===HB.INVALID_TOKEN&&(this._tempRoomConfig=r),d;case 5:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,i;return void 0===e&&(e=!1),tv(this,void 0,void 0,(function(){return iv(this,(function(r){switch(r.label){case 0:return nX.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return r.sent(),[3,3];case 2:null===(i=this._room)||void 0===i||i.leave(e).catch(),r.label=3;case 3:return this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map,[2]}}))}))},t.prototype.destroy=function(){var e,t,i;nX.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),this._videoPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[qV],this._screenStreamEncodeConfig=[YV],this._pauseAllSubscribeState={audio:void 0,video:void 0},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(i=this._outsideRoom)||void 0===i||i.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear(),delete window["__rtc_engine__".concat(this._engine_number)]},t.prototype.publishStream=function(e){return tv(this,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:try{t=e!==JM.AUDIO,i=e!==JM.VIDEO,this._vStats=t?"+V":this._vStats,this._aStats=i?"+A":this._aStats}catch(e){}return nX.print("publishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),fU(e)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(n=this._localImgVideoTrack,new UH(n,HL())),this._localVideoTrack.dummy=!0),[4,this._updatePublish({mediaType:e})];case 1:return r.sent(),[2]}var n}))}))},t.prototype.unpublishStream=function(e){return tv(this,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:try{t=e!==JM.AUDIO,i=e!==JM.VIDEO,this._vStats=t?"-V":this._vStats,this._aStats=i?"-A":this._aStats}catch(e){}return nX.print("unpublishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updatePublish({mediaType:e,pubState:sz.UNPUB})];case 1:return r.sent(),[2]}}))}))},t.prototype.publishScreen=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:nX.print("publishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),i.label=1;case 1:return i.trys.push([1,3,,4]),fU(e)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(r=this._localImgScreenTrack,new xH(r,HL())),this._localScreenVideoTrack.dummy=!0),[4,this._updateScreenPublish({mediaType:e,pubState:sz.PUB})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof YB?t:new YB(HB.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}var r}))}))},t.prototype.unpublishScreen=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return nX.print("unpublishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updateScreenPublish({mediaType:e,pubState:sz.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.subscribeStream=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return nX.print("subscribeStream()","userId: %o, mediaType: %o",e,t),[2,this._subscribe(!1,e,t)]}))}))},t.prototype._subscribe=function(e,t,i){var r,n,o,a,s;return tv(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_,v;return iv(this,(function(m){switch(m.label){case 0:if(this._checkMediaType(i),this._assertNotInRoom(),c=this._room.remoteStreams.get(t),!(u=null==c?void 0:c.find((function(t){return t.isScreen===e}))))throw new YB(HB.STREAM_NOT_EXIST,"stream not exist");return d=this._pauseAllSubscribeState.audio,l=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(i-=i&JM.AUDIO),this._pauseAllSubscribeState.video&&(i-=i&JM.VIDEO),nX.print("subscribeStream()","due to pauseAll mediaType: %o",i),h=u.hasSubscribed,p=this._remoteVideoConfig.get(t)||(null===(r=this._roomConfig)||void 0===r?void 0:r.remoteVideoConfig),u.originalMediaType=i,[4,this._room.subscribe(u,i,p)];case 1:return m.sent(),pU(i)&&this._updateAudioPlayerState(u),fU(i)&&this._updateVideoPlayerState(u),f=0,_=0,d!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?f|=JM.AUDIO:_|=JM.AUDIO),l!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?f|=JM.VIDEO:_|=JM.VIDEO),f&&this.pauseAllSubscribedStream(f),_&&this.resumeAllSubscribedStream(_),e||!(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)&&!(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo)||(u.audioTrack||u.videoTrack)&&(v={userId:t,isScreen:!1,state:KM.SUBSCRIBE_SUCC},this.safeEmit(PD.onAutoSubscribeResult,v)),!h&&pU(i)&&(null===(a=u.observer)||void 0===a||a.setSubscribeAudio(!0)),!h&&fU(i)&&(null===(s=u.observer)||void 0===s||s.setSubscribeVideo(!0)),[2]}}))}))},t.prototype.unsubscribeStream=function(e,t){return tv(this,void 0,void 0,(function(){var i,r;return iv(this,(function(n){if(nX.print("unsubscribeStream()","userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return!e.isScreen})))?void 0:r.hasSubscribed))throw new YB(HB.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.subscribeScreen=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return nX.print("subscribeScreen() userId: %o, mediaType: %o",e,t),[2,this._subscribe(!0,e,t)]}))}))},t.prototype.unsubscribeScreen=function(e,t){return tv(this,void 0,void 0,(function(){var i,r;return iv(this,(function(n){if(nX.print("unsubscribeScreen() userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return e.isScreen})))?void 0:r.hasSubscribed))throw new YB(HB.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.setRemoteVideoConfig=function(e,t){var i;return tv(this,void 0,void 0,(function(){return iv(this,(function(r){return nX.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",e,t),rj(e),function(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new YB(HB.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}(t),this._remoteVideoConfig.set(e,t),[2,null===(i=this._room)||void 0===i?void 0:i.updateSubVideoConfig(e,t).then((function(){}))]}))}))},t.prototype.startVideoAndAudioCapture=function(e,t){var i,r,n,o,a,s,c;return tv(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,y=this;return iv(this,(function(g){switch(g.label){case 0:if(nX.print("startVideoCapture()","deviceId: %s",e),nX.print("startAudioCapture()","deviceId: %s",t),ij(e)||ZB(e,"videoDeviceId"),ij(t)||ZB(t,"audioDeviceId"),e=e||this._localVideoDeviceId,t=t||this._localAudioDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new YB(HB.REPEAT_CAPTURE,"Has already capture");if(this._localAudioTrack)throw new YB(HB.REPEAT_CAPTURE,"Has already capture");return u=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?(delete u.deviceId,u.facingMode=e):!oU||eU?u.deviceId={exact:e}:delete u.deviceId,this._videoStreamConstraints=u),d=this._audioStreamConstraints,t&&(oU&&!eU||(d.deviceId={exact:t}),this._audioStreamConstraints=d),$F.rtcInvokeStatus("createCameraAndMicrophoneTrack start",0,"startVideoAndAudioCapture","",0),[4,GH(u,d,this._audioProfileManager)];case 1:return l=g.sent(),h=l.videoTrack,p=l.audioTrack,$F.rtcInvokeStatus("createCameraAndMicrophoneTrack finish",0,"startVideoAndAudioCapture","",0),(null===(i=this._videoStreamEncodeConfig[0])||void 0===i?void 0:i.contentHint)&&h.setContentHint(null===(r=this._videoStreamEncodeConfig[0])||void 0===r?void 0:r.contentHint),this._initLocalTrackEvents(h),this._localVideoTrack=h,null===(n=this._videoPlayer)||void 0===n||n.playVideo(h),(f=null==h?void 0:h.getTrack())&&(_=f.getSettings(),v={width:_.width,height:_.height},this._localVideoTrack.resolution=v,this.autoResetVideoEncoderConfig(_),setTimeout((function(){return y.safeEmit(PD.onLocalVideoSizeChanged,{streamIndex:YM.STREAM_INDEX_MAIN,info:v})}))),this._initLocalTrackEvents(p),this._localAudioTrack=p,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(m=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||m)&&(this._visibility?this._updatePublish():this.safeEmit(PD.onAutoPublishResult,{isScreen:!1,state:WM.PUBLISH_FAIL})),null===(a=null===(o=this._room.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!0),null===(c=null===(s=this._room.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.startVideoCapture=function(e){var t,i,r,n,o;return tv(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return iv(this,(function(p){switch(p.label){case 0:if(nX.print("startVideoCapture()","deviceId: %s",e),ij(e)||ZB(e,"deviceId"),e=e||this._localVideoDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new YB(HB.REPEAT_CAPTURE,"Has already capture");return a=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?(delete a.deviceId,a.facingMode=e):!oU||eU?a.deviceId={exact:e}:delete a.deviceId,this._videoStreamConstraints=a),[4,HH(a)];case 1:return s=p.sent(),window.location.search.includes("_pub_canvas_")&&(nX.print("startVideoCapture()","use canvas track in iOS"),s=new jH(s.getTrack(),HL())),(null===(t=this._videoStreamEncodeConfig[0])||void 0===t?void 0:t.contentHint)&&s.setContentHint(null===(i=this._videoStreamEncodeConfig[0])||void 0===i?void 0:i.contentHint),this._initLocalTrackEvents(s),this._localVideoTrack=s,null===(r=this._videoPlayer)||void 0===r||r.playVideo(s),c={},(u=null==s?void 0:s.getTrack())&&(c=u.getSettings(),d={width:c.width,height:c.height},this._localVideoTrack.resolution=d,this.autoResetVideoEncoderConfig(c),setTimeout((function(){return h.safeEmit(PD.onLocalVideoSizeChanged,{streamIndex:YM.STREAM_INDEX_MAIN,info:d})}))),this._room?(l=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||l)&&(this._visibility?this._updatePublish():this.safeEmit(PD.onAutoPublishResult,{isScreen:!1,state:WM.PUBLISH_FAIL})),null===(o=null===(n=this._room.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableVideo(!0),[2,c]):[2,c]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,i,r,n;return tv(this,void 0,void 0,(function(){return iv(this,(function(o){switch(o.label){case 0:if(nX.print("stopVideoCapture()"),this._trackSourceType.video===BM.VIDEO_SOURCE_TYPE_EXTERNAL)throw new YB(HB.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return null===(e=this._videoPlayer)||void 0===e||e.stop(),null===(t=this._localVideoTrack)||void 0===t||t.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(i=this._localVideoTrack)||void 0===i||i.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:o.sent(),o.label=2;case 2:return null===(n=null===(r=this._room.localStream)||void 0===r?void 0:r.observer)||void 0===n||n.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:if(nX.print("startAudioCapture()","deviceId: $o",e),ij(e)||ZB(e,"deviceId"),e=e||this._localAudioDeviceId,this._localAudioTrack)throw new YB(HB.REPEAT_CAPTURE,"Has already capture");return r=this._audioStreamConstraints,e&&(r.deviceId={exact:e},this._audioStreamConstraints=r),[4,zH(r,this._audioProfileManager)];case 1:return n=a.sent(),this._initLocalTrackEvents(n),this._localAudioTrack=n,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(PD.onAutoPublishResult,{isScreen:!1,state:WM.PUBLISH_FAIL})),null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.stopAudioCapture=function(){var e,t,i;return tv(this,void 0,void 0,(function(){return iv(this,(function(r){switch(r.label){case 0:if(nX.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===jM.AUDIO_SOURCE_TYPE_EXTERNAL)throw new YB(HB.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:r.sent(),r.label=2;case 2:return null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return nX.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,i,r,n,o,a,s;return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_=this;return iv(this,(function(v){switch(v.label){case 0:if(nX.print("startScreenCapture()","config: %o",e),(null===(t=this._localScreenVideoTrack)||void 0===t?void 0:t.dummy)||null===(i=this._localScreenVideoTrack)||void 0===i||i.close(),this._localScreenVideoTrack=void 0,c=e.enableAudio,u=void 0!==c&&c,this._trackSourceType.screenVideo===BM.VIDEO_SOURCE_TYPE_EXTERNAL)throw new YB(HB.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===jM.AUDIO_SOURCE_TYPE_EXTERNAL)throw new YB(HB.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,KH(u,this._screenStreamEncodeConfig[0])];case 1:return d=v.sent(),this._localScreenVideoTrack=new xH(d.getVideoTracks()[0],HL()),(null===(r=this._screenStreamEncodeConfig[0])||void 0===r?void 0:r.contentHint)&&this._localScreenVideoTrack.setContentHint(null===(n=this._screenStreamEncodeConfig[0])||void 0===n?void 0:n.contentHint),(l=null===(o=this._localScreenVideoTrack)||void 0===o?void 0:o.getTrack())&&(h=l.getSettings(),p={width:h.width,height:h.height},this._localScreenVideoTrack.resolution=p,setTimeout((function(){return _.safeEmit(PD.onLocalVideoSizeChanged,{streamIndex:YM.STREAM_INDEX_SCREEN,info:{width:h.width,height:h.height}})}))),(f=d.getAudioTracks()).length&&(this._localScreenAudioTrack=new VH(f[0],HL()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(a=this._screenPlayer)||void 0===a||a.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),(null===(s=this._room)||void 0===s?void 0:s.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,3];case 2:v.sent(),v.label=3;case 3:return[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,i,r;return tv(this,void 0,void 0,(function(){return iv(this,(function(n){switch(n.label){case 0:return nX.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(i=this._localScreenAudioTrack)||void 0===i||i.close(),this._localScreenAudioTrack=void 0,(null===(r=this._room)||void 0===r?void 0:r.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var i,r,n,o,a,s;if(nX.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),$B(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),t&&t.renderDom){var c=$_({userId:this._getUserId()},t);return oj(c),e!==YM.STREAM_INDEX_MAIN||this._videoPlayer?e!=YM.STREAM_INDEX_SCREEN||this._screenPlayer?void 0:(this._screenPlayer=new mK($_($_({},c),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==dL.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),(null===(s=this._room)||void 0===s?void 0:s.localScreenStream)&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),this._screenPlayer.domElement):(this._videoPlayer=new mK(c),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==dL.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),(null===(o=this._room)||void 0===o?void 0:o.localStream)&&(this._room.localStream.videoDom=this._videoPlayer.domElement),this._videoPlayer.domElement)}e==YM.STREAM_INDEX_MAIN?(null===(i=this._videoPlayer)||void 0===i||i.destroy(),delete this._videoPlayer):(null===(r=this._screenPlayer)||void 0===r||r.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:nX.print("startLiveTranscoding()","transcode: %o",e),ZB(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(PD.onStreamMixingEvent,{event:az.START,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(zV("started",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof YB?i:new YB(HB.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:if(nX.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=HW(this._liveTranscodeConfig,e),r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(PD.onStreamMixingEvent,{event:az.UPDATE,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(zV("layoutChanged",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof YB?i:new YB(HB.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:if(nX.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,i.label=1;case 1:return i.trys.push([1,3,,4]),this.safeEmit(PD.onStreamMixingEvent,{event:az.STOP,error:0,message:""}),[4,null===(e=this._room)||void 0===e?void 0:e.liveControlMessage({action:"stopped",type:"transcode"})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof YB?t:new YB(HB.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return nX.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(iB.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t,i;return tv(this,void 0,void 0,(function(){return iv(this,(function(r){switch(r.label){case 0:if(nX.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==Fz.CONNECTED)throw new YB(HB.NOT_CONNECTED_YET,"server not connected");return this._room.localStream&&(null===(t=this._room.localStream.observer)||void 0===t||t.setPublisher(e)),!e?[4,this._room.unpublish()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?WW.NORMAL_USER:WW.SILENT_USER})];case 3:return r.sent(),this._visibility=e,e&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoPublish)&&this._updatePublish({mediaType:JM.AUDIO_AND_VIDEO}),[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("playback_event",(function(r){var n,o,a,s;switch(null===(o=null===(n=i._room)||void 0===n?void 0:n.remoteStreams.get(r.userId||""))||void 0===o||o.find((function(e){return!e.isScreen})),r.eventName){case"timeupdate":return;case"loadeddata":if("audio"===r.type)t?i.safeEmit(PD.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):i.safeEmit(PD.onAudioFirstFrameDecoded,{userId:e.userId}),$F.firstRemoteAudioRender("",r.userId||"");else{var c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0};t?(c.publicStreamId=c.userId,delete c.userId,i.safeEmit(PD.onFirstPublicStreamVideoFrameDecoded,c),i.safeEmit(PD.onFirstPublicStreamVideoFrameRendered,c)):(i.safeEmit(PD.onVideoFirstFrameDecoded,c),i.safeEmit(PD.onVideoFirstFrameRendered,c)),$F.firstRemoteVideoRender("",r.userId||"")}break;case"autoplay-error":return t&&(r.publicStreamId=r.userId),nX.print("autoplay-error","userId: ".concat(r.userId,", kind: ").concat(e instanceof mK,", rawEvent: "),r.rawEvent),void i.safeEmit(PD.onAutoplayFailed,{userId:r.userId,kind:e instanceof mK?"video":"audio",mediaType:e instanceof mK?JM.VIDEO:JM.AUDIO,streamIndex:e.isScreen?YM.STREAM_INDEX_SCREEN:YM.STREAM_INDEX_MAIN})}i.safeEmit(PD.onPlayerEvent,r)}))},t.prototype._initLocalTrackEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("track-ended",(function(e){var t=!1;e!==i._localScreenAudioTrack&&e!==i._localScreenVideoTrack||(t=!0),i.safeEmit(PD.onTrackEnded,{kind:e.getTrack().kind,isScreen:t})})),e.on("resolution-change",(function(e){i.safeEmit(PD.onLocalVideoSizeChanged,{streamIndex:t?YM.STREAM_INDEX_SCREEN:YM.STREAM_INDEX_MAIN,info:e})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var i,r,n,o,a,s;nX.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),$B(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),oj(t);var c=t.userId;if(e==YM.STREAM_INDEX_MAIN){if(null===(i=this._remoteVideoPlayer.get(c))||void 0===i||i.destroy(),!t.renderDom)return;var u=new mK(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(n=null===(r=this._room)||void 0===r?void 0:r.remoteStreams.get(c))||void 0===n?void 0:n.find((function(e){return!e.isScreen})))&&(this._updateVideoPlayerState(d),d.videoDom=u.domElement),u.domElement}if(null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy(),t.renderDom){var d;u=new mK($_($_({},t),{isScreen:!0}));return this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&(this._updateVideoPlayerState(d),d.videoDom=u.domElement),u.domElement}},t.prototype.setLocalVideoMirrorType=function(e){nX.print("setLocalVideoMirrorType()","mirrorType: %o",e),$B(e,"mirrorType",[$M.MIRROR_TYPE_NONE,$M.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:return nX.print("setAudioPlaybackDevice()","deviceId: %s",e),ZB(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(nX.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,TH.getDeviceById(e)];case 1:if(!(t=i.sent()))throw new YB(HB.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._remoteScreenAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._audioPlaybackDeviceId=e,t&&this.safeEmit(PD.onAudioPlaybackDeviceChanged,t),$F.rtcAudioDevice(TF.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e,t,i){var r,n,o,a,s,c;return void 0===t&&(t=JM.AUDIO_AND_VIDEO),tv(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v;return iv(this,(function(m){return nX.print("play()","userId: %s, mediaType: %s, streamIndex: %s",e,t,i),u=!e||e===this._getUserId()||"local_user",d=void 0===i||i===YM.STREAM_INDEX_MAIN,l=void 0===i||i===YM.STREAM_INDEX_SCREEN,h=t!==JM.VIDEO,p=t!==JM.AUDIO,f=[],u&&p&&(d&&this._localVideoTrack&&(null===(r=this._videoPlayer)||void 0===r||r.mirror(!!this._mirrorType),f.push(null===(n=this._videoPlayer)||void 0===n?void 0:n.playVideo(this._localVideoTrack))),l&&this._localScreenVideoTrack&&f.push(null===(o=this._screenPlayer)||void 0===o?void 0:o.playVideo(this._localScreenVideoTrack))),e===(null===(a=this._audioMixingManager)||void 0===a?void 0:a.id)&&f.push(this._audioMixingManager.resumeLocalPlay()),_=null===(s=this._room)||void 0===s?void 0:s.remoteStreams,p&&d&&f.push(EK(this._remoteVideoPlayer,e,!1,_)),p&&l&&f.push(EK(this._remoteScreenPlayer,e,!0,_)),h&&d&&f.push(EK(this._remoteAudioPlayer,e,!1,_)),p&&l&&f.push(EK(this._remoteScreenAudioPlayer,e,!0,_)),v=null===(c=this._outsideRoom)||void 0===c?void 0:c.remoteStreams,h&&f.push(EK(this._publicStreamVideoPlayer,e,!1,v)),p&&f.push(EK(this._publicStreamAudioPlayer,e,!1,v)),[2,Promise.all(f).then((function(){}))]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){return nX.print("pauseAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),t=function(){pU(e)&&(i._pauseAllSubscribeState.audio=!0),fU(e)&&(i._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()])}))}))},t.prototype.resumeAllSubscribedStream=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){return nX.print("resumeAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),t=function(){pU(e)&&(i._pauseAllSubscribeState.audio=!1),fU(e)&&(i._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,r;t(),null===(r=null===(e=i._room)||void 0===e?void 0:e.remoteStreams)||void 0===r||r.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i._updateAudioPlayerState(e),i._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])}))}))},t.prototype.sendUserMessage=function(e,t){var i;return tv(this,void 0,void 0,(function(){var r,n=this;return iv(this,(function(o){if(rj(e),aj(t),!this._room||this._room.connectionState!==Fz.CONNECTED)throw new YB(HB.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!1,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!1,r),t}))]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){var i;return tv(this,void 0,void 0,(function(){var r,n=this;return iv(this,(function(o){if(rj(e),tj(t,"message"),aj(t),!this._room||this._room.connectionState!==Fz.CONNECTED)throw new YB(HB.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!0,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!0,r),t}))]}))}))},t.prototype.sendRoomMessage=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){if(aj(e),!this._room||this._room.connectionState!==Fz.CONNECTED)throw new YB(HB.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e}))]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){if(aj(e),!this._room||this._room.connectionState!==Fz.CONNECTED)throw new YB(HB.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e,!0).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e}))]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:return nX.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,function(e){var t,i;try{var r=navigator.mediaDevices.getSupportedConstraints();try{for(var n=rv(Object.keys(e)),o=n.next();!o.done;o=n.next()){var a=o.value;r[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}}catch(e){}}(e),i=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,i&&(this._audioStreamConstraints.deviceId=i),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:return nX.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,i=this._videoStreamConstraints.deviceId,"number"==typeof e.width&&(e.width={ideal:e.width,max:e.width}),"number"==typeof e.height&&(e.height={ideal:e.height,max:e.height}),this._videoStreamConstraints=e,i&&(this._videoStreamConstraints.deviceId=i),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:r.sent(),this._updatePublish(),r.label=2;case 2:return[2]}}))}))},t.prototype.enableSimulcastMode=function(e){return nX.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){return iv(this,(function(n){return nX.print("setVideoEncoderConfig()"," descriptions: %o",e),Array.isArray(e)||(e=[e]),(e=e.filter((function(e){return e}))).length>3&&(e=e.slice(0,3)),e.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._localVideoTrack&&(null===(t=e[0])||void 0===t?void 0:t.contentHint)&&this._localVideoTrack.setContentHint(null===(i=e[0])||void 0===i?void 0:i.contentHint),this._videoStreamEncodeConfig=e,(null===(r=this._room)||void 0===r?void 0:r.hasPublished)&&this._updatePublish(),[2]}))}))},t.prototype.autoResetVideoEncoderConfig=function(e){var t;if(e){(null===(t=this._videoStreamEncodeConfig)||void 0===t?void 0:t.length)||(this._videoStreamEncodeConfig=[qV]);var i=e.width*e.height,r=this._videoStreamEncodeConfig[0];if(!(mU(r.width)*mU(r.height)<=i)){var n,o,a=XV,s=a[0];a.forEach((function(e,t){var r=mU(e.width)*mU(e.height);n||(i<r?n=e:s=e)})),o=n&&mU(n.width)*mU(n.height)-i<i-mU(s.width)*mU(s.height)?Object.assign({},n):Object.assign({},s),this._videoStreamEncodeConfig=this._videoStreamEncodeConfig.filter((function(e){return!(o&&mU(e.width)*mU(e.height)>=i)||(o.maxKbps=Math.min(e.maxKbps,o.maxKbps),!1)})),this._videoStreamEncodeConfig.unshift({width:e.width,height:e.height,frameRate:e.frameRate?Math.round(e.frameRate):this._videoStreamEncodeConfig[0].frameRate,maxKbps:o.maxKbps}),nX.print("autoResetVideoEncoderConfig() result",JSON.stringify(this._videoStreamEncodeConfig)),$F.rtcInvokeStatus(JSON.stringify(this._videoStreamEncodeConfig),0,"autoResetVideoEncoderConfig","",0)}}},t.prototype.setScreenEncoderConfig=function(e){var t;return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return nX.print("setScreenEncoderConfig()","description: %o",e),this._screenStreamEncodeConfig=[e],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=e,this._localScreenVideoTrack.updateVideoCaptureConfig(),e.contentHint&&this._localScreenVideoTrack.setContentHint(e.contentHint)),(null===(t=this._room)||void 0===t?void 0:t.hasScreenPublished)&&this._updateScreenPublish(),[2]}))}))},t.prototype.sendSEIMessage=function(e,t,i){var r,n,o,a,s,c;nX.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,i),$B(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),QB(i,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(XL.str2ab(t)):t;if(t.length){var d;if(e===YM.STREAM_INDEX_MAIN){if(!(null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.hasPublished))return;d=null===(o=this._room)||void 0===o?void 0:o.localStream}else{if(!(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished))return;d=null===(c=this._room)||void 0===c?void 0:c.localScreenStream}if(u.byteLength>4096)nX.print("sei size must not bigger than 4KB");else{var l=HL();d.seiList.push({content:u,uuid:l,repeatCount:i}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else nX.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;nX.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var i=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,r;i=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var r;if(0!==e.length){var n=e.find((function(e){return!1===e.isScreen})),o=null===(r=null==n?void 0:n.audioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t,volume:o||0})}}));var n=null===(r=t._localAudioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t._getUserId(),volume:n||0}),t.safeEmit(PD.onAudioVolumeIndication,{speakers:i})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t,i,r,n,o,a=this;void 0===e&&(e={}),nX.print("enableAudioPropertiesReport()","config %o: ",e);var s=e.interval,c=void 0===s?100:s,u=e.enableInBackground,d=void 0===u||u;if(this._stopAudioPropertiesReport(),c<=0)return null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){e.forEach((function(e){return e.stopRecordAudioEnergy()}))})),null===(r=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===r||r.stopRecordAudioEnergy(),void(null===(o=null===(n=this._room)||void 0===n?void 0:n.localScreenStream)||void 0===o||o.stopRecordAudioEnergy());c=Math.max(100,c),this._audioPropertiesReportTimer=self.setInterval((function(){var e,t,i,r;if(d||"hidden"!==document.visibilityState){var n=[],o=a._audioDeviceManager.getRecordTrack()||a._localAudioTrack;if(o){var s=o.getAudioLevel();null===(t=null===(e=a._room)||void 0===e?void 0:e.localStream)||void 0===t||t.recordAudioEnergy(s),n.push({streamIndex:YM.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:s,nonlinearVolume:hU(s)}})}if(a._localScreenAudioTrack){s=a._localScreenAudioTrack.getAudioLevel();null===(r=null===(i=a._room)||void 0===i?void 0:i.localScreenStream)||void 0===r||r.recordAudioEnergy(s),n.push({streamIndex:YM.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:s,nonlinearVolume:hU(s)}})}if(a.safeEmit(PD.onLocalAudioPropertiesReport,n),a._room){var c=[];a._room.remoteStreams.forEach((function(e,t){e.forEach((function(e){var i,r;if(e.audioTrack){var n=e.audioTrack.getAudioLevel();e.recordAudioEnergy(n),c.push({streamKey:{userId:t,streamIndex:e.isScreen?YM.STREAM_INDEX_SCREEN:YM.STREAM_INDEX_MAIN,roomId:null===(r=null===(i=a._room)||void 0===i?void 0:i.roomInfo)||void 0===r?void 0:r.roomId},audioPropertiesInfo:{linearVolume:n,nonlinearVolume:hU(n)}})}}))})),a.safeEmit(PD.onRemoteAudioPropertiesReport,c)}}}),c),eU&&(this._localAudioInputTimer=self.setInterval((function(){var e,t;a._localAudioTrack&&(a._localAudioTrack.checkHasInput()?a._localAudioNoInputCount=0:(a._localAudioNoInputCount++,5===a._localAudioNoInputCount&&(null===(e=a.localAudioTrack)||void 0===e||e.resetAudioLevelFetcher(),null===(t=a._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.filter((function(e){return!e.isScreen})).forEach((function(e){var t;null===(t=null==e?void 0:e.audioTrack)||void 0===t||t.resetAudioLevelFetcher()}))})),nX.print("Reset audio level fetcher",""),$F.rtcInvokeStatus("Reset audio level fetcher",0,"_localAudioInputTimer","",0))))}),400))},t.prototype.setVideoSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y;return tv(this,void 0,void 0,(function(){var g,S,E;return iv(this,(function(b){switch(b.label){case 0:return nX.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),$B(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),$B(t,"VideoSourceType",[BM.VIDEO_SOURCE_TYPE_EXTERNAL,BM.VIDEO_SOURCE_TYPE_INTERNAL]),g=e===YM.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[g]===t?[3,4]:(this._trackSourceType[g]=t,nX.print("setVideoSourceType","set ".concat(g," source type to ").concat(t)),this._localVideoTrack&&e===YM.STREAM_INDEX_MAIN?(E=!1,t===BM.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,S=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,E?null===(a=null===(o=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!1):null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushVideo(!1),(null===(d=this._room)||void 0===d?void 0:d.hasPublished)||S?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===YM.STREAM_INDEX_SCREEN?(E=!1,t===BM.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,E?null===(f=null===(p=null===(h=this._room)||void 0===h?void 0:h.localScreenStream)||void 0===p?void 0:p.observer)||void 0===f||f.setEnableVideo(!1):null===(m=null===(v=null===(_=this._room)||void 0===_?void 0:_.localScreenStream)||void 0===v?void 0:v.observer)||void 0===m||m.setPushVideo(!1),(null===(y=this._room)||void 0===y?void 0:y.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var i,r,n,o,a,s,c,u;return tv(this,void 0,void 0,(function(){var d;return iv(this,(function(l){switch(l.label){case 0:if(nX.print("setExternalVideoTrack()","index: %o, track: %o",e,t),$B(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),e!==YM.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==BM.VIDEO_SOURCE_TYPE_EXTERNAL)throw new YB(HB.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new FH(t,HL()),this._initLocalTrackEvents(this._localVideoTrack),null===(i=this._videoPlayer)||void 0===i||i.playVideo(this._localVideoTrack),d=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||d?[4,this._updatePublish()]:[3,2];case 1:l.sent(),l.label=2;case 2:if(e!==YM.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==BM.VIDEO_SOURCE_TYPE_EXTERNAL)throw new YB(HB.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new FH(t,HL()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushVideo(!0),(null===(u=this._room)||void 0===u?void 0:u.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v;return tv(this,void 0,void 0,(function(){var m,y,g;return iv(this,(function(S){switch(S.label){case 0:return nX.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),$B(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),$B(t,"audioSourceType",[jM.AUDIO_SOURCE_TYPE_EXTERNAL,jM.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===YM.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,nX.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===YM.STREAM_INDEX_MAIN?(g=!1,this._trackSourceType.audio===jM.AUDIO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,y=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,g?null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableAudio(!1):null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushAudio(!1),(null===(u=this._room)||void 0===u?void 0:u.hasPublished)||y?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:S.sent(),S.label=2;case 2:return this._localScreenAudioTrack&&e===YM.STREAM_INDEX_SCREEN?(g=!1,this._trackSourceType.audio===jM.AUDIO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,g?null===(h=null===(l=null===(d=this._room)||void 0===d?void 0:d.localScreenStream)||void 0===l?void 0:l.observer)||void 0===h||h.setEnableAudio(!1):null===(_=null===(f=null===(p=this._room)||void 0===p?void 0:p.localScreenStream)||void 0===f?void 0:f.observer)||void 0===_||_.setPushAudio(!1),(null===(v=this._room)||void 0===v?void 0:v.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:S.sent(),S.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var i,r,n,o,a,s,c,u,d;return tv(this,void 0,void 0,(function(){var l;return iv(this,(function(h){switch(h.label){case 0:if(nX.print("setExternalAudioTrack()","index: %o, track: %o",e,t),$B(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),e!==YM.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==jM.AUDIO_SOURCE_TYPE_EXTERNAL)throw new YB(HB.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new BH(t,HL()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setPushAudio(!0),(null===(a=this._room)||void 0===a?void 0:a.hasPublished)||l?[4,this._updatePublish()]:[3,2];case 1:h.sent(),h.label=2;case 2:if(e!==YM.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==jM.AUDIO_SOURCE_TYPE_EXTERNAL)throw new YB(HB.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new BH(t,HL()),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localScreenStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushAudio(!0),(null===(d=this._room)||void 0===d?void 0:d.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.login=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return nX.print("login()","token: %o, userInfo: %o",e,t),ij(e)||ZB(e,"token"),rj(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){return nX.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return nX.print("updateLoginToken()","token: %o",e),ij(e)||ZB(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return nX.print("getPeerOnlineStatus()","userId: %o",e),rj(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return tv(this,void 0,void 0,(function(){var i,r=this;return iv(this,(function(n){rj(e),aj(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!1,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}return[2]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return tv(this,void 0,void 0,(function(){var i,r=this;return iv(this,(function(n){rj(e),tj(t,"message"),aj(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!0,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}return[2]}))}))},t.prototype.setServerParams=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return nX.print("setServerParams()","signature: %o, url: %0",e,t),ZB(e,"signature"),ZB(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){ZB(e,"message"),aj(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!1,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!1,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!1,t),e}return[2]}))}))},t.prototype.sendServerBinaryMessage=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){tj(e,"message"),aj(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!0,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!0,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!0,t),e}return[2]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new YB(HB.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;nX.print("startCloudProxy()",e),ZB(e.logProxy,"logProxy"),ZB(e.accessProxy,"accessProxy"),ZB(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=HV("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=HV("LOG_SERVER_URL"),this._originConfigServerUrls=HV("CONFIG_REQUEST_DOMAINS"),GV("ICE_CONFIG_REQUEST_URLS",e.accessProxy),GV("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),GV("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new YB(HB.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");nX.print("stopCloudProxy()"),GV("ICE_CONFIG_REQUEST_URLS",[]),GV("LOG_SERVER_URL",this._originLogServerUrl),GV("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return tv(this,void 0,void 0,(function(){var i,r=this;return iv(this,(function(n){if(nX.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),nj(e),!this._room||this._room.connectionState!==Fz.CONNECTED)throw new YB(HB.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new YB(HB.REPEAT_PUSH,"repeat push public media stream");return i=KV(e,"started",t),[2,this._room.publicStreamControlMessage(i).then((function(){r._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){if(nX.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),nj(e),!this._room||this._room.connectionState!==Fz.CONNECTED)throw new YB(HB.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return i=KV(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(i)]}))}))},t.prototype.stopPushPublicStream=function(e){return tv(this,void 0,void 0,(function(){var t=this;return iv(this,(function(i){if(nX.print("startPushPublicStream()","publicStreamId: %o",e),nj(e),!this._room||this._room.connectionState!==Fz.CONNECTED)throw new YB(HB.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return[2,this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:e}).then((function(){t._publicStreamIds.delete(e)}))]}))}))},t.prototype.startPlayPublicStream=function(e){var t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c=this;return iv(this,(function(u){switch(u.label){case 0:return nj(e),this._outsideRoom?[3,2]:(this._outsideRoom=new QW(this._appId,{audioProfileManager:this._audioProfileManager,enableFallbackHandler:sX(this._appId)}),this._outsideRoom.on(nz.RESUBSCRIBE,(function(e){var t,i,r=e.stream;if(r){var n=c._publicStreamAudioPlayer.get(r.streamId);n&&r.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var o=c._publicStreamVideoPlayer.get(r.streamId);o&&r.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(t=this._outsideRoom)||void 0===t||t.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,c.safeEmit(PD.onPublicStreamStats,e)})),null===(i=this._outsideRoom)||void 0===i||i.on("streamDecodeFailed",(function(e){c.safeEmit(PD.onError,{errorCode:HB.PUBLIC_STREAM_DECODE_FAILED,publicStreamId:e.publicStreamId})})),null===(r=this._outsideRoom)||void 0===r||r.on(nz.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(PD.onPublicStreamSEIMessageReceived,e)})),[4,this._outsideRoom.connect()]);case 1:u.sent(),u.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return o=u.sent(),(a=this._publicStreamVideoPlayer.get(e))&&(null==o?void 0:o.videoTrack)&&a.playVideo(o.videoTrack,o),!(s=this._publicStreamAudioPlayer.get(e))&&(null==o?void 0:o.audioTrack)&&(s=new SK(e,{muted:(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)===dL.VIDEO_ONLY,isScreen:!1,useWebAudio:this.audioPlayerUseWebAudio}),this._initPlayerEvents(s,!0),s.playAudio(o.audioTrack),this._publicStreamAudioPlayer.set(e,s)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.destroy(),this._publicStreamAudioPlayer.delete(e)),this._outsideRoom.destroy(),this._outsideRoom=void 0,[2]):[2]}))}))},t.prototype.setAudioProfile=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return this._audioProfileManager.setAudioProfile(e),[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var i,r,n;nX.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var o=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&o)return o.destroy(),void this._publicStreamVideoPlayer.delete(e);if(!o){o=new mK($_($_({},t),{userId:e})),this._initPlayerEvents(o,!0),this._publicStreamVideoPlayer.set(e,o);var a=null===(r=null===(i=this._outsideRoom)||void 0===i?void 0:i.remoteStreams)||void 0===r?void 0:r.get(e);(null==a?void 0:a.videoTrack)&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==dL.PLAY_MANUALLY&&o.playVideo(a.videoTrack,a)}},t.prototype.setDummyCaptureImagePath=function(e,t){return tv(this,void 0,void 0,(function(){var i=this;return iv(this,(function(r){return[2,new Promise((function(r,n){ZB(t,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=t,o.onload=function(){try{var t=document.createElement("canvas"),a=t.getContext("2d");if(!a)return n(new YB(HB.UNEXPECTED_ERROR,"Not support canvas"));t.width=o.width,t.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(i._dummyTimer),i._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=t.captureStream(5).getVideoTracks()[0];e===YM.STREAM_INDEX_MAIN?i._localImgVideoTrack=s:i._localImgScreenTrack=s,r()}catch(e){n(new YB(HB.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new YB(HB.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(WV))},t.prototype._updatePublish=function(e){return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var t,i,r;return iv(this,(function(n){switch(n.label){case 0:if(nX.print("_updatePublish()","config: %o",e),t={mediaType:void 0,invokeByJoinRoom:!1,pubState:sz.PUB},e=$_($_({},t),e),!this._visibility)throw new YB(HB.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==Fz.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,e.mediaType,e.pubState,e.invokeByJoinRoom)];case 3:return n.sent(),this._videoPlayer&&this._room.localStream&&(this._room.localStream.videoDom=this._videoPlayer.domElement),[3,6];case 4:throw(r=n.sent())instanceof YB?r:new YB(HB.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype.startAudioPlaybackDeviceTest=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){switch(i.label){case 0:return nX.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),ZB(e,"filePath"),QB(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,i.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){nX.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()},t.prototype.startAudioDeviceRecordTest=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return nX.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),QB(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){nX.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){nX.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype.setRemoteUserPriority=function(e,t){var i;nX.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{rj(e),$B(t,"priority",[oL.HIGH,oL.MEDIUM,oL.LOW])}catch(e){return console.warn(e),!1}return this._userPriorityMap.set(e,t),null===(i=this._room)||void 0===i||i.setRemoteUserPriority(e,t),!0},t.prototype.setSubscribeFallbackOption=function(e){nX.print("setSubscribeFallbackOption()","option: %o",e);try{$B(e,"option",[nL.DISABLE,nL.VIDEO_STREAM_LOW,nL.AUDIO_ONLY])}catch(e){return console.warn(e),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)},t.prototype.getLocalStreamTrack=function(e,t){var i,r,n=this;if(nX.print("getLocalStreamTrack()","streamIndex: ".concat(e,", type: ").concat(t)),e===YM.STREAM_INDEX_MAIN?(i="video"===t?this.localVideoTrack:this.localAudioTrack,r=function(){var e;return null===(e=n._room)||void 0===e?void 0:e.localStream}):(i="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,r=function(){var e;return null===(e=n._room)||void 0===e?void 0:e.localScreenStream}),i){var o=i instanceof XH&&i.mixedAudioTrack?i.mixedAudioTrack:i.getTrack();if(o){var a=r();return iX(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t)),iX(o,"readyState",(function(e){"ended"===e&&(rX(o,"enabled"),rX(o,"readyState")),n._reportMsTrackEvent("readyState",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t,e)})),o.addEventListener("ended",(function(){rX(o,"enabled"),rX(o,"readyState")})),o}}},t.prototype.getRemoteStreamTrack=function(e,t,i){var r,n,o=this;nX.print("getRemoteStreamTrack()","userId: ".concat(e,", streamIndex: ").concat(t,", type: ").concat(i));var a,s=(null===(r=this._room)||void 0===r?void 0:r.remoteStreams.get(e))||[];if(s&&s.length&&(t===YM.STREAM_INDEX_MAIN?(a=s.find((function(e){return!e.isScreen})),n="video"===i?null==a?void 0:a.videoTrack:null==a?void 0:a.audioTrack):(a=s.find((function(e){return e.isScreen})),n="video"===i?null==a?void 0:a.videoTrack:null==a?void 0:a.audioTrack),n)){var c=n.getTrack();if(c&&a){var u=a.streamId;return iX(c,"enabled",this._reportMsTrackEvent.bind(this,"enabled",u,"getRemoteStreamTrack",i)),iX(c,"readyState",(function(e){"ended"===e&&(rX(c,"enabled"),rX(c,"readyState")),o._reportMsTrackEvent("readyState",u,"getRemoteStreamTrack",i,e)})),c.addEventListener("ended",(function(){rX(c,"enabled"),rX(c,"readyState")})),c}}},t.prototype.getPublicStreamTrack=function(e,t){var i=this;if(nX.print("getPublicStreamTrack()","Id: ".concat(e,", type: ").concat(t)),this._outsideRoom&&this._outsideRoom.remoteStreams){var r=this._outsideRoom.remoteStreams.get(e);if(r){var n="video"===t?r.videoTrack:r.audioTrack;if(n){var o=n.getTrack();if(o){var a=r.streamId;return iX(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",a,"getPublicStreamTrack",t)),iX(o,"readyState",(function(e){"ended"===e&&(rX(o,"enabled"),rX(o,"readyState")),i._reportMsTrackEvent("readyState",a,"getPublicStreamTrack",t,e)})),o.addEventListener("ended",(function(){rX(o,"enabled"),rX(o,"readyState")})),o}}}}},t.prototype._reportMsTrackEvent=function(e,t,i,r,n){var o;switch(e){case"readyState":o="live"!==n?"".concat(r," stopped"):"unknown";break;case"enabled":o="".concat(r,!0===n?" unmuted":" muted");break;default:o="unknown"}$F.rtcInvokeStatus(o,0,i,t||"",0,{direction:"getLocalStreamTrack"===i?"up":"down"})},t.prototype._updateScreenPublish=function(e){return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var t,i,r;return iv(this,(function(n){switch(n.label){case 0:return nX.print("_updateScreenPublish()"),t={mediaType:void 0,pubState:sz.PUB},e=$_($_({},t),e),[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==Fz.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,e.mediaType,e.pubState)];case 3:return n.sent(),this._screenPlayer&&this._room.localScreenStream&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),[3,6];case 4:throw(r=n.sent())instanceof YB?r:new YB(HB.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){var t,i;nX.print("_updateAudioPlayerState()");var r=e.userId,n=e.isScreen,o=n?this._remoteScreenAudioPlayer:this._remoteAudioPlayer,a=o.get(r);e.audioTrack?(a||(a=new SK(r,{muted:(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)===dL.VIDEO_ONLY,isScreen:n,useWebAudio:this.audioPlayerUseWebAudio}),this._initPlayerEvents(a),o.set(r,a),this._audioPlaybackDeviceId&&a.setPlaybackDevice(this._audioPlaybackDeviceId)),(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==dL.PLAY_MANUALLY&&a.playAudio(e.audioTrack)):null==a||a.stop()},t.prototype.resetRemoteAudioPlayer=function(e){},t.prototype._updateVideoPlayerState=function(e){var t;nX.print("_updateVideoPlayerState()");var i,r=e.userId;i=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?i&&(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)!==dL.PLAY_MANUALLY&&i.playVideo(e.videoTrack,e):(null==i?void 0:i.played)&&(null==i||i.stop())},t.prototype._checkLocalCameraStall=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n,o;return iv(this,(function(a){switch(a.label){case 0:if("visible"!==document.visibilityState||!(e.videoStats.encoderOutputFrameRate<3&&e.videoStats.encoderOutputFrameRate>0||e.videoStats.sentKBitrate<2&&e.videoStats.sentKBitrate>0))return[3,6];if(this._videoCaptureStallCount++,!(this._videoCaptureStallCount>3))return[3,5];this._videoCaptureStallCount=0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.stopVideoCapture()];case 2:return a.sent(),[4,this.startVideoCapture()];case 3:return a.sent(),n=null===(r=null===(i=null===(t=this._room)||void 0===t?void 0:t._roomInfo)||void 0===i?void 0:i.userInfo)||void 0===r?void 0:r.userId,nX.print("onLocalCameraStalled",n),$F.rtcInvokeStatus(JSON.stringify({userId:n}),0,"Engine.onLocalCameraStalled","",0),[3,5];case 4:return o=a.sent(),console.log(o),[3,5];case 5:return[3,7];case 6:this._videoCaptureStallCount=0,a.label=7;case 7:return[2]}}))}))},t.prototype._checkRemoteStats=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return!e.videoStats.needResub||this.resubedUserId.has(e.userId)?[3,3]:($F.rtcInvokeStatus("[resub user] ".concat(e.userId),0,"resub_user","",0),nX.print("[resub user] ".concat(e.userId)),this.resubedUserId.add(e.userId),[4,this.unsubscribeStream(e.userId,JM.VIDEO)]);case 1:return t.sent(),[4,this.subscribeStream(e.userId,JM.VIDEO)];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},t.prototype._onAddStream=function(e){var t,i=e.stream;i.videoDom=null===(t=this._remoteVideoPlayer.get(i.userId))||void 0===t?void 0:t.domElement;var r=null==i?void 0:i.attributes,n=r.localaudio,o=r.audiostream,a=r.localvideo,s=r.videostream,c=WH.NONE;if(o&&(c|=JM.AUDIO),s&&(c|=JM.VIDEO),c){if(null==i?void 0:i.isScreen)this.safeEmit(PD.onUserPublishScreen,{userId:i.userId,mediaType:c});else{try{var u=c!==JM.AUDIO,d=c!==JM.VIDEO;i._aStats=d?"+oA":i._aStats,i._vStats=u?"+oV":i._vStats}catch(e){}this.safeEmit(PD.onUserPublishStream,{userId:i.userId,mediaType:c}),this._handleAutoSubscribe(i,!0)}(null==i?void 0:i.isScreen)||(n&&this.safeEmit(PD.onUserStartAudioCapture,{userId:i.userId}),a&&this.safeEmit(PD.onUserStartVideoCapture,{userId:i.userId}))}},t.prototype._handleAutoSubscribe=function(e,t){var i,r,n,o,a=WH.NONE;(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(a|=JM.AUDIO),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(a|=JM.VIDEO),nX.print("_onAddStream","autoSubType: ".concat(a)),a&&(t&&pU(a)&&(null===(n=e.observer)||void 0===n||n.setAutoSubscribeAudio(!0)),t&&fU(a)&&(null===(o=e.observer)||void 0===o||o.setAutoSubscribeVideo(!0)),this._subscribe(!1,e.userId,a))},t.prototype._onRemoveStream=function(e){var t,i=this,r=e.stream,n=null!==(t=aX[e.reason])&&void 0!==t?t:QM.STREAM_REMOVE_REASON_OTHER,o=r.isScreen?PD.onUserUnpublishScreen:PD.onUserUnpublishStream,a=WH.NONE;r.attributes.audiostream&&(a|=JM.AUDIO),r.attributes.videostream&&(a|=JM.VIDEO),(null==r?void 0:r._workaround_1_)&&(a=JM.VIDEO),a!==WH.NONE&&this.safeEmit(o,{userId:r.userId,mediaType:a,reason:n}),this._getRemotePlayer(r.userId,r.isScreen).forEach((function(e){(null==r?void 0:r._workaround_1_)||(r.isScreen?(i._remoteScreenPlayer.delete(r.userId),i._remoteScreenAudioPlayer.delete(r.userId)):(i._remoteVideoPlayer.delete(r.userId),i._remoteAudioPlayer.delete(r.userId)),null==e||e.destroy())}))},t.prototype._onUserConnection=function(e){this.safeEmit(PD.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(PD.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(PD.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onNetworkQuality=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.safeEmit.apply(this,ov([PD.onNetworkQuality],nv(e),!1))},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===ZM.CONNECTION_STATE_CONNECTED&&this.safeEmit(PD.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(PD.onConnectionStateChanged,e)},t.prototype._getRemotePlayer=function(e,t){return[(t?this._remoteScreenAudioPlayer:this._remoteAudioPlayer).get(e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]},t.prototype._stopAudioPropertiesReport=function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null),null!==this._localAudioInputTimer&&clearInterval(this._localAudioInputTimer)},t.prototype._onResubscribe=function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))},t.prototype._onSubscribePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onRemovePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onVideoFirstFrameDecoded=function(e){this.safeEmit(PD.onVideoFirstFrameDecoded,e)},t.prototype._onVideoDeviceStateChange=function(e){this.safeEmit(PD.onVideoDeviceStateChanged,e)},t.prototype._onAudioDeviceStateChange=function(e){this.safeEmit(PD.onAudioDeviceStateChanged,e)},t.prototype._onUserPublishStateChange=function(e){var t=e.userId,i=e.isScreen,r=e.mediaType,n=e.pubState,o=e.remoteStream,a={userId:t,mediaType:r};if(i)n===sz.PUB?this.safeEmit(PD.onUserPublishScreen,a):this.safeEmit(PD.onUserUnpublishScreen,$_($_({},a),{reason:QM.STREAM_REMOVE_REASON_UNPUBLISH}));else if(n===sz.PUB){try{var s=r!==JM.AUDIO,c=r!==JM.VIDEO;o._aStats=c?"+oA":o._aStats,o._vStats=s?"+oV":o._vStats}catch(e){}this.safeEmit(PD.onUserPublishStream,a),this._handleAutoSubscribe(o,!0)}else{try{s=r!==JM.AUDIO,c=r!==JM.VIDEO;o._aStats=c?"-oA":o._aStats,o._vStats=s?"-oV":o._vStats}catch(e){}this.safeEmit(PD.onUserUnpublishStream,$_($_({},a),{reason:QM.STREAM_REMOVE_REASON_UNPUBLISH}))}},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(PD.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(PD.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(PD.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(PD.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(PD.onLiveTranscodingResult,e)},t.prototype._onStreamMixingEvent=function(e){this.safeEmit(PD.onStreamMixingEvent,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(PD.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(PD.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(PD.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(PD.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(PD.onError,{errorCode:HB.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(PD.onError,{errorCode:HB.RTM_TOKEN_ERROR})}))},Object.defineProperty(t.prototype,"waitForNewToken",{get:function(){return!!this._tempRoomConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localAudioTrack",{get:function(){return this._localAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localVideoTrack",{get:function(){return this._localVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenAudioTrack",{get:function(){return this._localScreenAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenVideoTrack",{get:function(){return this._localScreenVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){var e,t,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteStreams)&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),i},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){i.push({userId:e.userId})}))),i},enumerable:!1,configurable:!0}),t.prototype._handleAudioDeviceManager=function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(PD.onAudioPlaybackDeviceTestVolume,t)}))},t.prototype._assertNotInRoom=function(){if(!this._room||this._room.connectionState!==Fz.CONNECTED)throw new YB(HB.INVOKED_BEFORE_JOIN_ROOM,"join first")},t.prototype._checkMediaType=function(e){$B(e,"mediaType",[JM.AUDIO,JM.VIDEO,JM.AUDIO_AND_VIDEO])},t.prototype._getUserId=function(){var e,t;return(null===(t=null===(e=this._room)||void 0===e?void 0:e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"},ev([aB()],t.prototype,"updateToken",null),ev([aB()],t.prototype,"setVideoCaptureDevice",null),ev([aB()],t.prototype,"setAudioCaptureDevice",null),ev([aB()],t.prototype,"joinRoom",null),ev([aB()],t.prototype,"leaveRoom",null),ev([aB()],t.prototype,"destroy",null),ev([aB()],t.prototype,"publishStream",null),ev([aB()],t.prototype,"unpublishStream",null),ev([aB()],t.prototype,"publishScreen",null),ev([aB()],t.prototype,"unpublishScreen",null),ev([aB()],t.prototype,"subscribeStream",null),ev([aB()],t.prototype,"unsubscribeStream",null),ev([aB()],t.prototype,"subscribeScreen",null),ev([aB()],t.prototype,"unsubscribeScreen",null),ev([aB()],t.prototype,"setRemoteVideoConfig",null),ev([aB()],t.prototype,"startVideoAndAudioCapture",null),ev([aB()],t.prototype,"startVideoCapture",null),ev([aB()],t.prototype,"stopVideoCapture",null),ev([aB()],t.prototype,"startAudioCapture",null),ev([aB()],t.prototype,"stopAudioCapture",null),ev([aB()],t.prototype,"getAudioMixingManager",null),ev([aB()],t.prototype,"startScreenCapture",null),ev([aB()],t.prototype,"stopScreenCapture",null),ev([aB()],t.prototype,"setLocalVideoPlayer",null),ev([aB()],t.prototype,"startLiveTranscoding",null),ev([aB()],t.prototype,"updateLiveTranscoding",null),ev([aB()],t.prototype,"stopLiveTranscoding",null),ev([aB()],t.prototype,"setBusinessId",null),ev([aB()],t.prototype,"setUserVisibility",null),ev([aB()],t.prototype,"setRemoteVideoPlayer",null),ev([aB()],t.prototype,"setLocalVideoMirrorType",null),ev([aB()],t.prototype,"setAudioPlaybackDevice",null),ev([aB()],t.prototype,"play",null),ev([aB()],t.prototype,"pauseAllSubscribedStream",null),ev([aB()],t.prototype,"resumeAllSubscribedStream",null),ev([aB()],t.prototype,"sendUserMessage",null),ev([aB()],t.prototype,"sendUserBinaryMessage",null),ev([aB()],t.prototype,"sendRoomMessage",null),ev([aB()],t.prototype,"sendRoomBinaryMessage",null),ev([aB()],t.prototype,"setAudioCaptureConfig",null),ev([aB()],t.prototype,"setVideoCaptureConfig",null),ev([aB()],t.prototype,"enableSimulcastMode",null),ev([aB()],t.prototype,"setVideoEncoderConfig",null),ev([aB()],t.prototype,"setScreenEncoderConfig",null),ev([aB()],t.prototype,"sendSEIMessage",null),ev([aB()],t.prototype,"setAudioVolumeIndicationInterval",null),ev([aB()],t.prototype,"enableAudioPropertiesReport",null),ev([aB()],t.prototype,"setVideoSourceType",null),ev([aB()],t.prototype,"setExternalVideoTrack",null),ev([aB()],t.prototype,"setAudioSourceType",null),ev([aB()],t.prototype,"setExternalAudioTrack",null),ev([aB("rtm")],t.prototype,"login",null),ev([aB("rtm")],t.prototype,"logout",null),ev([aB("rtm")],t.prototype,"updateLoginToken",null),ev([aB("rtm")],t.prototype,"getPeerOnlineStatus",null),ev([aB("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),ev([aB("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),ev([aB("rtm")],t.prototype,"setServerParams",null),ev([aB("rtm")],t.prototype,"sendServerMessage",null),ev([aB("rtm")],t.prototype,"sendServerBinaryMessage",null),ev([aB()],t.prototype,"startCloudProxy",null),ev([aB()],t.prototype,"stopCloudProxy",null),ev([aB()],t.prototype,"startPushPublicStream",null),ev([aB()],t.prototype,"updatePublicStreamParam",null),ev([aB()],t.prototype,"stopPushPublicStream",null),ev([aB("outsideRoom","streamId")],t.prototype,"startPlayPublicStream",null),ev([aB("outsideRoom","streamId")],t.prototype,"stopPlayPublicStream",null),ev([aB()],t.prototype,"setAudioProfile",null),ev([aB("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),ev([aB()],t.prototype,"setDummyCaptureImagePath",null),ev([aB()],t.prototype,"startAudioPlaybackDeviceTest",null),ev([aB()],t.prototype,"stopAudioPlaybackDeviceTest",null),ev([aB()],t.prototype,"startAudioDeviceRecordTest",null),ev([aB()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),ev([aB()],t.prototype,"stopAudioDevicePlayTest",null),ev([aB()],t.prototype,"setRemoteUserPriority",null),ev([aB()],t.prototype,"setSubscribeFallbackOption",null),ev([aB()],t.prototype,"getLocalStreamTrack",null),ev([aB()],t.prototype,"getRemoteStreamTrack",null),ev([aB()],t.prototype,"getPublicStreamTrack",null),ev([aB()],t.prototype,"resetRemoteAudioPlayer",null),t}(JF),aX={"client unpublished":QM.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":QM.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":QM.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":QM.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":QM.STREAM_REMOVE_REASON_REPUBLISH};function sX(e){var t=xV.getServerConfig(e).web_rtc_config;return!!(null==t?void 0:t.fallback)||!!HV("ENABLE_FALLBACK_HANDLER")}var cX=new XF("BLWEngine",0),uX=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.singleStreamRenderMode=!1,XV=[{width:192,height:108,frameRate:15,maxKbps:100},{width:320,height:180,frameRate:15,maxKbps:140},{width:640,height:360,frameRate:15,maxKbps:400},{width:1280,height:720,frameRate:15,maxKbps:1e3},{width:1920,height:1080,frameRate:15,maxKbps:2e3}],r._handleEvent(),r}return Z_(t,e),t.prototype.subscribeStream=function(t,i){return tv(this,void 0,void 0,(function(){return iv(this,(function(r){return cX.print("subscribeStream()","userId: %o, mediaType: %o",t,i),this.singleStreamRenderMode&&fU(i)&&e.prototype.subscribeScreen.call(this,t,JM.VIDEO).catch((function(){})),[2,e.prototype.subscribeStream.call(this,t,i)]}))}))},t.prototype.unsubscribeStream=function(t,i){return tv(this,void 0,void 0,(function(){return iv(this,(function(r){return cX.print("unsubscribeStream()","userId: %o, mediaType: %o",t,i),this.singleStreamRenderMode&&fU(i)&&e.prototype.unsubscribeScreen.call(this,t,JM.VIDEO).catch((function(){})),[2,e.prototype.unsubscribeStream.call(this,t,i)]}))}))},t.prototype.setRemoteScreenVideoStreamIndex=function(e){var t;return cX.print("setRemoteScreenVideoStreamIndex()","streamIndex: %o",e),(null===(t=this._room)||void 0===t?void 0:t.connectionState)!==Fz.CONNECTED&&(this.singleStreamRenderMode=e===YM.STREAM_INDEX_MAIN,!0)},t.prototype.setRemoteVideoPlayer=function(t,i){if(cX.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",t,i),!this.singleStreamRenderMode||t!==YM.STREAM_INDEX_SCREEN)return e.prototype.setRemoteVideoPlayer.call(this,t,i)},t.prototype.destroy=function(){this.singleStreamRenderMode=!1,e.prototype.destroy.call(this)},t.prototype._updateVideoPlayerState=function(t){var i,r;if(!this.singleStreamRenderMode)return e.prototype._updateVideoPlayerState.call(this,t);var n,o=t.userId,a=null===(i=this._room)||void 0===i?void 0:i.remoteStreams.get(o);Array.isArray(a)&&a.forEach((function(e){e.isScreen&&(n=e)}));var s=this._remoteVideoPlayer.get(o);s&&(t.isScreen||!(null==n?void 0:n.videoTrack)?t.videoTrack?s&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==dL.PLAY_MANUALLY&&s.playVideo(t.videoTrack,t):(null==s?void 0:s.played)&&(null==s||s.stop()):cX.print("_updateVideoPlayerState","prevent play main stream"))},t.prototype._handleEvent=function(){var e=this;this.on(PD.onUserPublishScreen,(function(t){e.singleStreamRenderMode&&fU(t.mediaType)&&e.subscribeScreen(t.userId,JM.VIDEO)})),this.on(PD.onUserUnpublishScreen,(function(t){if(e.singleStreamRenderMode&&fU(t.mediaType)){var i=e._remoteVideoPlayer.get(t.userId),r=e._room.remoteStreams.get(t.userId),n=null==r?void 0:r.find((function(e){return!e.isScreen}));if(!(null==n?void 0:n.videoTrack)||!i)return;i.playVideo(n.videoTrack)}}))},ev([aB()],t.prototype,"subscribeStream",null),ev([aB()],t.prototype,"unsubscribeStream",null),ev([aB()],t.prototype,"setRemoteScreenVideoStreamIndex",null),ev([aB()],t.prototype,"setRemoteVideoPlayer",null),ev([aB()],t.prototype,"destroy",null),t}(oX),dX=new XF("VERTC",0);[iB,rB,nB].forEach((function(e){return e.setStats({rtc_sdk_version:jV.VERSION,product_line:ZV.RTC,report_version:$V.W_5,os:eF.WEB,device_id:xV.getDeviceId(),user_agent:WL()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var lX=function(e,t){if(location.search.includes("__rtc_debug_2__"))for(var i in e="5a7451222679214f668e7085",GV("ICE_CONFIG_REQUEST_URLS",["rtc-test.bytedance.com","rtc-access-test-hl.bytedance.com"]),localStorage)i.indexOf("RTC_ACCESS")>-1&&localStorage.removeItem(i);return dX.print("createEngine","Invoke VERTC.createEngine"),ZB(e,"appId"),[iB,rB,nB].forEach((function(i){return i.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),$F.sdkInitEngine(Date.now(),kF.BEGIN),new uX(e,t)},hX=function(e){if(dX.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof uX))throw new YB(HB.INVALID_ENGINE,"Invalid engine object");e.destroy(),$F.sdkInitEngine(Date.now(),kF.END)},pX=function(){return tv(void 0,void 0,void 0,(function(){return iv(this,(function(e){return[2,TH.enumerateDevices()]}))}))},fX=function(e){return void 0===e&&(e={video:!0,audio:!0}),tv(void 0,void 0,void 0,(function(){var t,i,r,n;return iv(this,(function(o){switch(o.label){case 0:if(t=e.video,i=e.audio,r={video:!1,audio:!1},!t)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,TH.getPermissions({video:!0,force:!0})];case 2:return n=o.sent(),r.video=n.video,[3,4];case 3:return o.sent(),[3,4];case 4:if(!i)return[3,8];o.label=5;case 5:return o.trys.push([5,7,,8]),[4,TH.getPermissions({audio:!0,force:!0})];case 6:return n=o.sent(),r.audio=n.audio,[3,8];case 7:return o.sent(),[3,8];case 8:return[2,r]}}))}))},_X=function(){return tv(void 0,void 0,void 0,(function(){return iv(this,(function(e){return[2,TH.enumerateAudioCaptureDevices()]}))}))},vX=function(){return tv(void 0,void 0,void 0,(function(){return iv(this,(function(e){return[2,TH.enumerateVideoCaptureDevices()]}))}))},mX=function(){return tv(void 0,void 0,void 0,(function(){return iv(this,(function(e){return[2,TH.enumerateAudioPlaybackDevices()]}))}))},yX=function(){return jV.VERSION},gX=function(){return $F.rtcSdkApiCall("isSupported",0,""),tv(void 0,void 0,void 0,(function(){var e;return iv(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!WL()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,lG()]:[2,!1];case 1:return[2,(null==(e=t.sent())?void 0:e.includes("H264"))||(null==e?void 0:e.includes("vp8"))];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},SX=function(){return $F.rtcSdkApiCall("getSupportedCodecs",0,""),tv(void 0,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,lG()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!WL()&&location.search.includes("_rtc_autotest_");var EX=new function(){this.getSdkVersion=yX,this.createEngine=lX,this.destroyEngine=hX,this.enumerateDevices=pX,this.enableDevices=fX,this.enumerateAudioCaptureDevices=_X,this.enumerateVideoCaptureDevices=vX,this.enumerateAudioPlaybackDevices=mX,this.getParameter=HV,this.setParameter=GV,this.isSupported=gX,this.getSupportedCodecs=SX,this.events=PD,this.ErrorCode=HB,this.platform="BytePlus",this._monitor=$F};export{aG as AudioMixingDualMonoMode,sG as AudioMixingType,uL as AudioProfileType,jM as AudioSourceType,HM as ChannelProfile,ZM as ConnectionState,sL as FallbackOrRecoverReason,eL as LogChannel,JM as MediaType,XM as MirrorMode,$M as MirrorType,aL as NetworkQuality,rL as PublicInterpolationMode,iL as PublicStreamType,WM as PublishState,dL as RTCAutoPlayPolicy,oL as RemoteUserPriority,cL as RoomProfileType,YM as StreamIndex,QM as StreamRemoveReason,nL as SubscribeFallbackOption,zM as SubscribeMode,KM as SubscribeState,tL as USER_ONLINE_STATUS,GM as UserOfflineReason,qM as VideoRenderMode,BM as VideoSourceType,EX as default};
|
|
6
|
+
function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(i){if("default"!==i&&!(i in e)){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}))})),Object.freeze(e)}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})})),t}var r=function(e){return e&&e.Math==Math&&e},n=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")(),o={},a=function(e){try{return!!e()}catch(e){return!0}},s=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),c=!a((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),u=c,d=Function.prototype.call,l=u?d.bind(d):function(){return d.apply(d,arguments)},h={},p={}.propertyIsEnumerable,f=Object.getOwnPropertyDescriptor,_=f&&!p.call({1:2},1);h.f=_?function(e){var t=f(this,e);return!!t&&t.enumerable}:p;var v,m,y=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},g=c,S=Function.prototype,E=S.bind,b=S.call,I=g&&E.bind(b,b),T=g?function(e){return e&&I(e)}:function(e){return e&&function(){return b.apply(e,arguments)}},A=T,R=A({}.toString),C=A("".slice),O=function(e){return C(R(e),8,-1)},w=T,k=a,P=O,N=n.Object,D=w("".split),M=k((function(){return!N("z").propertyIsEnumerable(0)}))?function(e){return"String"==P(e)?D(e,""):N(e)}:N,L=n.TypeError,U=function(e){if(null==e)throw L("Can't call method on "+e);return e},x=M,V=U,F=function(e){return x(V(e))},B=function(e){return"function"==typeof e},j=B,G=function(e){return"object"==typeof e?null!==e:j(e)},H=n,z=B,K=function(e){return z(e)?e:void 0},W=function(e,t){return arguments.length<2?K(H[e]):H[e]&&H[e][t]},q=T({}.isPrototypeOf),X=W("navigator","userAgent")||"",Y=n,J=X,Q=Y.process,Z=Y.Deno,$=Q&&Q.versions||Z&&Z.version,ee=$&&$.v8;ee&&(m=(v=ee.split("."))[0]>0&&v[0]<4?1:+(v[0]+v[1])),!m&&J&&(!(v=J.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=J.match(/Chrome\/(\d+)/))&&(m=+v[1]);var te=m,ie=te,re=a,ne=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ie&&ie<41})),oe=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ae=W,se=B,ce=q,ue=oe,de=n.Object,le=ue?function(e){return"symbol"==typeof e}:function(e){var t=ae("Symbol");return se(t)&&ce(t.prototype,de(e))},he=n.String,pe=function(e){try{return he(e)}catch(e){return"Object"}},fe=B,_e=pe,ve=n.TypeError,me=function(e){if(fe(e))return e;throw ve(_e(e)+" is not a function")},ye=me,ge=function(e,t){var i=e[t];return null==i?void 0:ye(i)},Se=l,Ee=B,be=G,Ie=n.TypeError,Te={exports:{}},Ae=n,Re=Object.defineProperty,Ce=function(e,t){try{Re(Ae,e,{value:t,configurable:!0,writable:!0})}catch(i){Ae[e]=t}return t},Oe=Ce,we=n["__core-js_shared__"]||Oe("__core-js_shared__",{}),ke=we;(Te.exports=function(e,t){return ke[e]||(ke[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Pe=U,Ne=n.Object,De=function(e){return Ne(Pe(e))},Me=De,Le=T({}.hasOwnProperty),Ue=Object.hasOwn||function(e,t){return Le(Me(e),t)},xe=T,Ve=0,Fe=Math.random(),Be=xe(1..toString),je=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Be(++Ve+Fe,36)},Ge=n,He=Te.exports,ze=Ue,Ke=je,We=ne,qe=oe,Xe=He("wks"),Ye=Ge.Symbol,Je=Ye&&Ye.for,Qe=qe?Ye:Ye&&Ye.withoutSetter||Ke,Ze=function(e){if(!ze(Xe,e)||!We&&"string"!=typeof Xe[e]){var t="Symbol."+e;We&&ze(Ye,e)?Xe[e]=Ye[e]:Xe[e]=qe&&Je?Je(t):Qe(t)}return Xe[e]},$e=l,et=G,tt=le,it=ge,rt=function(e,t){var i,r;if("string"===t&&Ee(i=e.toString)&&!be(r=Se(i,e)))return r;if(Ee(i=e.valueOf)&&!be(r=Se(i,e)))return r;if("string"!==t&&Ee(i=e.toString)&&!be(r=Se(i,e)))return r;throw Ie("Can't convert object to primitive value")},nt=Ze,ot=n.TypeError,at=nt("toPrimitive"),st=function(e,t){if(!et(e)||tt(e))return e;var i,r=it(e,at);if(r){if(void 0===t&&(t="default"),i=$e(r,e,t),!et(i)||tt(i))return i;throw ot("Can't convert object to primitive value")}return void 0===t&&(t="number"),rt(e,t)},ct=st,ut=le,dt=function(e){var t=ct(e,"string");return ut(t)?t:t+""},lt=G,ht=n.document,pt=lt(ht)&<(ht.createElement),ft=function(e){return pt?ht.createElement(e):{}},_t=ft,vt=!s&&!a((function(){return 7!=Object.defineProperty(_t("div"),"a",{get:function(){return 7}}).a})),mt=s,yt=l,gt=h,St=y,Et=F,bt=dt,It=Ue,Tt=vt,At=Object.getOwnPropertyDescriptor;o.f=mt?At:function(e,t){if(e=Et(e),t=bt(t),Tt)try{return At(e,t)}catch(e){}if(It(e,t))return St(!yt(gt.f,e,t),e[t])};var Rt={},Ct=s&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ot=n,wt=G,kt=Ot.String,Pt=Ot.TypeError,Nt=function(e){if(wt(e))return e;throw Pt(kt(e)+" is not an object")},Dt=s,Mt=vt,Lt=Ct,Ut=Nt,xt=dt,Vt=n.TypeError,Ft=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor;Rt.f=Dt?Lt?function(e,t,i){if(Ut(e),t=xt(t),Ut(i),"function"==typeof e&&"prototype"===t&&"value"in i&&"writable"in i&&!i.writable){var r=Bt(e,t);r&&r.writable&&(e[t]=i.value,i={configurable:"configurable"in i?i.configurable:r.configurable,enumerable:"enumerable"in i?i.enumerable:r.enumerable,writable:!1})}return Ft(e,t,i)}:Ft:function(e,t,i){if(Ut(e),t=xt(t),Ut(i),Mt)try{return Ft(e,t,i)}catch(e){}if("get"in i||"set"in i)throw Vt("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var jt=Rt,Gt=y,Ht=s?function(e,t,i){return jt.f(e,t,Gt(1,i))}:function(e,t,i){return e[t]=i,e},zt={exports:{}},Kt=B,Wt=we,qt=T(Function.toString);Kt(Wt.inspectSource)||(Wt.inspectSource=function(e){return qt(e)});var Xt,Yt,Jt,Qt=Wt.inspectSource,Zt=B,$t=Qt,ei=n.WeakMap,ti=Zt(ei)&&/native code/.test($t(ei)),ii=Te.exports,ri=je,ni=ii("keys"),oi=function(e){return ni[e]||(ni[e]=ri(e))},ai={},si=ti,ci=n,ui=T,di=G,li=Ht,hi=Ue,pi=we,fi=oi,_i=ai,vi=ci.TypeError,mi=ci.WeakMap;if(si||pi.state){var yi=pi.state||(pi.state=new mi),gi=ui(yi.get),Si=ui(yi.has),Ei=ui(yi.set);Xt=function(e,t){if(Si(yi,e))throw new vi("Object already initialized");return t.facade=e,Ei(yi,e,t),t},Yt=function(e){return gi(yi,e)||{}},Jt=function(e){return Si(yi,e)}}else{var bi=fi("state");_i[bi]=!0,Xt=function(e,t){if(hi(e,bi))throw new vi("Object already initialized");return t.facade=e,li(e,bi,t),t},Yt=function(e){return hi(e,bi)?e[bi]:{}},Jt=function(e){return hi(e,bi)}}var Ii={set:Xt,get:Yt,has:Jt,enforce:function(e){return Jt(e)?Yt(e):Xt(e,{})},getterFor:function(e){return function(t){var i;if(!di(t)||(i=Yt(t)).type!==e)throw vi("Incompatible receiver, "+e+" required");return i}}},Ti=s,Ai=Ue,Ri=Function.prototype,Ci=Ti&&Object.getOwnPropertyDescriptor,Oi=Ai(Ri,"name"),wi={EXISTS:Oi,PROPER:Oi&&"something"===function(){}.name,CONFIGURABLE:Oi&&(!Ti||Ti&&Ci(Ri,"name").configurable)},ki=n,Pi=B,Ni=Ue,Di=Ht,Mi=Ce,Li=Qt,Ui=wi.CONFIGURABLE,xi=Ii.get,Vi=Ii.enforce,Fi=String(String).split("String");(zt.exports=function(e,t,i,r){var n,o=!!r&&!!r.unsafe,a=!!r&&!!r.enumerable,s=!!r&&!!r.noTargetGet,c=r&&void 0!==r.name?r.name:t;Pi(i)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Ni(i,"name")||Ui&&i.name!==c)&&Di(i,"name",c),(n=Vi(i)).source||(n.source=Fi.join("string"==typeof c?c:""))),e!==ki?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=i:Di(e,t,i)):a?e[t]=i:Mi(t,i)})(Function.prototype,"toString",(function(){return Pi(this)&&xi(this).source||Li(this)}));var Bi={},ji=Math.ceil,Gi=Math.floor,Hi=function(e){var t=+e;return t!=t||0===t?0:(t>0?Gi:ji)(t)},zi=Hi,Ki=Math.max,Wi=Math.min,qi=function(e,t){var i=zi(e);return i<0?Ki(i+t,0):Wi(i,t)},Xi=Hi,Yi=Math.min,Ji=function(e){return e>0?Yi(Xi(e),9007199254740991):0},Qi=Ji,Zi=function(e){return Qi(e.length)},$i=F,er=qi,tr=Zi,ir=function(e){return function(t,i,r){var n,o=$i(t),a=tr(o),s=er(r,a);if(e&&i!=i){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===i)return e||s||0;return!e&&-1}},rr={includes:ir(!0),indexOf:ir(!1)},nr=Ue,or=F,ar=rr.indexOf,sr=ai,cr=T([].push),ur=function(e,t){var i,r=or(e),n=0,o=[];for(i in r)!nr(sr,i)&&nr(r,i)&&cr(o,i);for(;t.length>n;)nr(r,i=t[n++])&&(~ar(o,i)||cr(o,i));return o},dr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],lr=ur,hr=dr.concat("length","prototype");Bi.f=Object.getOwnPropertyNames||function(e){return lr(e,hr)};var pr={};pr.f=Object.getOwnPropertySymbols;var fr=W,_r=Bi,vr=pr,mr=Nt,yr=T([].concat),gr=fr("Reflect","ownKeys")||function(e){var t=_r.f(mr(e)),i=vr.f;return i?yr(t,i(e)):t},Sr=Ue,Er=gr,br=o,Ir=Rt,Tr=function(e,t,i){for(var r=Er(t),n=Ir.f,o=br.f,a=0;a<r.length;a++){var s=r[a];Sr(e,s)||i&&Sr(i,s)||n(e,s,o(t,s))}},Ar=a,Rr=B,Cr=/#|\.prototype\./,Or=function(e,t){var i=kr[wr(e)];return i==Nr||i!=Pr&&(Rr(t)?Ar(t):!!t)},wr=Or.normalize=function(e){return String(e).replace(Cr,".").toLowerCase()},kr=Or.data={},Pr=Or.NATIVE="N",Nr=Or.POLYFILL="P",Dr=Or,Mr=n,Lr=o.f,Ur=Ht,xr=zt.exports,Vr=Ce,Fr=Tr,Br=Dr,jr=function(e,t){var i,r,n,o,a,s=e.target,c=e.global,u=e.stat;if(i=c?Mr:u?Mr[s]||Vr(s,{}):(Mr[s]||{}).prototype)for(r in t){if(o=t[r],n=e.noTargetGet?(a=Lr(i,r))&&a.value:i[r],!Br(c?r:s+(u?".":"#")+r,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;Fr(o,n)}(e.sham||n&&n.sham)&&Ur(o,"sham",!0),xr(i,r,o,e)}},Gr=me,Hr=c,zr=T(T.bind),Kr=function(e,t){return Gr(e),void 0===t?e:Hr?zr(e,t):function(){return e.apply(t,arguments)}},Wr=O,qr=Array.isArray||function(e){return"Array"==Wr(e)},Xr={};Xr[Ze("toStringTag")]="z";var Yr="[object z]"===String(Xr),Jr=n,Qr=Yr,Zr=B,$r=O,en=Ze("toStringTag"),tn=Jr.Object,rn="Arguments"==$r(function(){return arguments}()),nn=Qr?$r:function(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=tn(e),en))?i:rn?$r(t):"Object"==(r=$r(t))&&Zr(t.callee)?"Arguments":r},on=T,an=a,sn=B,cn=nn,un=Qt,dn=function(){},ln=[],hn=W("Reflect","construct"),pn=/^\s*(?:class|function)\b/,fn=on(pn.exec),_n=!pn.exec(dn),vn=function(e){if(!sn(e))return!1;try{return hn(dn,ln,e),!0}catch(e){return!1}},mn=function(e){if(!sn(e))return!1;switch(cn(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _n||!!fn(pn,un(e))}catch(e){return!0}};mn.sham=!0;var yn=!hn||an((function(){var e;return vn(vn.call)||!vn(Object)||!vn((function(){e=!0}))||e}))?mn:vn,gn=n,Sn=qr,En=yn,bn=G,In=Ze("species"),Tn=gn.Array,An=function(e){var t;return Sn(e)&&(t=e.constructor,(En(t)&&(t===Tn||Sn(t.prototype))||bn(t)&&null===(t=t[In]))&&(t=void 0)),void 0===t?Tn:t},Rn=function(e,t){return new(An(e))(0===t?0:t)},Cn=Kr,On=M,wn=De,kn=Zi,Pn=Rn,Nn=T([].push),Dn=function(e){var t=1==e,i=2==e,r=3==e,n=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,p,f=wn(c),_=On(f),v=Cn(u,d),m=kn(_),y=0,g=l||Pn,S=t?g(c,m):i||a?g(c,0):void 0;m>y;y++)if((s||y in _)&&(p=v(h=_[y],y,f),e))if(t)S[y]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:Nn(S,h)}else switch(e){case 4:return!1;case 7:Nn(S,h)}return o?-1:r||n?n:S}},Mn={forEach:Dn(0),map:Dn(1),filter:Dn(2),some:Dn(3),every:Dn(4),find:Dn(5),findIndex:Dn(6),filterReject:Dn(7)},Ln=a,Un=function(e,t){var i=[][e];return!!i&&Ln((function(){i.call(null,t||function(){throw 1},1)}))},xn=Mn.forEach,Vn=Un("forEach")?[].forEach:function(e){return xn(this,e,arguments.length>1?arguments[1]:void 0)};jr({target:"Array",proto:!0,forced:[].forEach!=Vn},{forEach:Vn});var Fn=nn,Bn=Yr?{}.toString:function(){return"[object "+Fn(this)+"]"},jn=Yr,Gn=zt.exports,Hn=Bn;jn||Gn(Object.prototype,"toString",Hn,{unsafe:!0});var zn={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},Kn=ft("span").classList,Wn=Kn&&Kn.constructor&&Kn.constructor.prototype,qn=Wn===Object.prototype?void 0:Wn,Xn=n,Yn=zn,Jn=qn,Qn=Vn,Zn=Ht,$n=function(e){if(e&&e.forEach!==Qn)try{Zn(e,"forEach",Qn)}catch(t){e.forEach=Qn}};for(var eo in Yn)Yn[eo]&&$n(Xn[eo]&&Xn[eo].prototype);$n(Jn);var to={},io=ur,ro=dr,no=Object.keys||function(e){return io(e,ro)},oo=s,ao=Ct,so=Rt,co=Nt,uo=F,lo=no;to.f=oo&&!ao?Object.defineProperties:function(e,t){co(e);for(var i,r=uo(t),n=lo(t),o=n.length,a=0;o>a;)so.f(e,i=n[a++],r[i]);return e};var ho,po=W("document","documentElement"),fo=Nt,_o=to,vo=dr,mo=ai,yo=po,go=ft,So=oi("IE_PROTO"),Eo=function(){},bo=function(e){return"<script>"+e+"<\/script>"},Io=function(e){e.write(bo("")),e.close();var t=e.parentWindow.Object;return e=null,t},To=function(){try{ho=new ActiveXObject("htmlfile")}catch(e){}var e,t;To="undefined"!=typeof document?document.domain&&ho?Io(ho):((t=go("iframe")).style.display="none",yo.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(bo("document.F=Object")),e.close(),e.F):Io(ho);for(var i=vo.length;i--;)delete To.prototype[vo[i]];return To()};mo[So]=!0;var Ao=Object.create||function(e,t){var i;return null!==e?(Eo.prototype=fo(e),i=new Eo,Eo.prototype=null,i[So]=e):i=To(),void 0===t?i:_o.f(i,t)},Ro=Ao,Co=Rt,Oo=Ze("unscopables"),wo=Array.prototype;null==wo[Oo]&&Co.f(wo,Oo,{configurable:!0,value:Ro(null)});var ko=function(e){wo[Oo][e]=!0},Po=rr.includes,No=ko;jr({target:"Array",proto:!0},{includes:function(e){return Po(this,e,arguments.length>1?arguments[1]:void 0)}}),No("includes");var Do=G,Mo=O,Lo=Ze("match"),Uo=function(e){var t;return Do(e)&&(void 0!==(t=e[Lo])?!!t:"RegExp"==Mo(e))},xo=Uo,Vo=n.TypeError,Fo=function(e){if(xo(e))throw Vo("The method doesn't accept regular expressions");return e},Bo=nn,jo=n.String,Go=function(e){if("Symbol"===Bo(e))throw TypeError("Cannot convert a Symbol value to a string");return jo(e)},Ho=Ze("match"),zo=function(e){var t=/./;try{"/./"[e](t)}catch(i){try{return t[Ho]=!1,"/./"[e](t)}catch(e){}}return!1},Ko=jr,Wo=Fo,qo=U,Xo=Go,Yo=zo,Jo=T("".indexOf);Ko({target:"String",proto:!0,forced:!Yo("includes")},{includes:function(e){return!!~Jo(Xo(qo(this)),Xo(Wo(e)),arguments.length>1?arguments[1]:void 0)}});var Qo=Nt,Zo=function(){var e=Qo(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},$o=a,ea=n.RegExp,ta=$o((function(){var e=ea("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),ia=ta||$o((function(){return!ea("a","y").sticky})),ra={BROKEN_CARET:ta||$o((function(){var e=ea("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:ia,UNSUPPORTED_Y:ta},na=a,oa=n.RegExp,aa=na((function(){var e=oa(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),sa=a,ca=n.RegExp,ua=sa((function(){var e=ca("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),da=l,la=T,ha=Go,pa=Zo,fa=ra,_a=Te.exports,va=Ao,ma=Ii.get,ya=aa,ga=ua,Sa=_a("native-string-replace",String.prototype.replace),Ea=RegExp.prototype.exec,ba=Ea,Ia=la("".charAt),Ta=la("".indexOf),Aa=la("".replace),Ra=la("".slice),Ca=function(){var e=/a/,t=/b*/g;return da(Ea,e,"a"),da(Ea,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Oa=fa.BROKEN_CARET,wa=void 0!==/()??/.exec("")[1];(Ca||wa||Oa||ya||ga)&&(ba=function(e){var t,i,r,n,o,a,s,c=this,u=ma(c),d=ha(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=da(ba,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=Oa&&c.sticky,f=da(pa,c),_=c.source,v=0,m=d;if(p&&(f=Aa(f,"y",""),-1===Ta(f,"g")&&(f+="g"),m=Ra(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Ia(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),i=new RegExp("^(?:"+_+")",f)),wa&&(i=new RegExp("^"+_+"$(?!\\s)",f)),Ca&&(r=c.lastIndex),n=da(Ea,p?i:c,m),p?n?(n.input=Ra(n.input,v),n[0]=Ra(n[0],v),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:Ca&&n&&(c.lastIndex=c.global?n.index+n[0].length:r),wa&&n&&n.length>1&&da(Sa,n[0],i,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n&&h)for(n.groups=a=va(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=n[s[1]];return n});var ka=ba;jr({target:"RegExp",proto:!0,forced:/./.exec!==ka},{exec:ka});var Pa=T,Na=zt.exports,Da=ka,Ma=a,La=Ze,Ua=Ht,xa=La("species"),Va=RegExp.prototype,Fa=function(e,t,i,r){var n=La(e),o=!Ma((function(){var t={};return t[n]=function(){return 7},7!=""[e](t)})),a=o&&!Ma((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[xa]=function(){return i},i.flags="",i[n]=/./[n]),i.exec=function(){return t=!0,null},i[n](""),!t}));if(!o||!a||i){var s=Pa(/./[n]),c=t(n,""[e],(function(e,t,i,r,n){var a=Pa(e),c=t.exec;return c===Da||c===Va.exec?o&&!n?{done:!0,value:s(t,i,r)}:{done:!0,value:a(i,t,r)}:{done:!1}}));Na(String.prototype,e,c[0]),Na(Va,n,c[1])}r&&Ua(Va[n],"sham",!0)},Ba=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},ja=l,Ga=Nt,Ha=B,za=O,Ka=ka,Wa=n.TypeError,qa=function(e,t){var i=e.exec;if(Ha(i)){var r=ja(i,e,t);return null!==r&&Ga(r),r}if("RegExp"===za(e))return ja(Ka,e,t);throw Wa("RegExp#exec called on incompatible receiver")},Xa=l,Ya=Nt,Ja=U,Qa=Ba,Za=Go,$a=ge,es=qa;Fa("search",(function(e,t,i){return[function(t){var i=Ja(this),r=null==t?void 0:$a(t,e);return r?Xa(r,t,i):new RegExp(t)[e](Za(i))},function(e){var r=Ya(this),n=Za(e),o=i(t,r,n);if(o.done)return o.value;var a=r.lastIndex;Qa(a,0)||(r.lastIndex=0);var s=es(r,n);return Qa(r.lastIndex,a)||(r.lastIndex=a),null===s?-1:s.index}]}));var ts=jr,is=rr.indexOf,rs=Un,ns=T([].indexOf),os=!!ns&&1/ns([1],1,-0)<0,as=rs("indexOf");ts({target:"Array",proto:!0,forced:os||!as},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return os?ns(this,e,t)||0:is(this,e,t)}});var ss=jr,cs=T,us=n.Date,ds=cs(us.prototype.getTime);ss({target:"Date",stat:!0},{now:function(){return ds(new us)}});var ls=T,hs=zt.exports,ps=Date.prototype,fs=ls(ps.toString),_s=ls(ps.getTime);function vs(e){return vs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vs(e)}"Invalid Date"!=String(new Date(NaN))&&hs(ps,"toString",(function(){var e=_s(this);return e==e?fs(this):"Invalid Date"}));var ms=n,ys=B,gs=ms.String,Ss=ms.TypeError,Es=T,bs=Nt,Is=function(e){if("object"==typeof e||ys(e))return e;throw Ss("Can't set "+gs(e)+" as a prototype")},Ts=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=Es(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(i,[]),t=i instanceof Array}catch(e){}return function(i,r){return bs(i),Is(r),t?e(i,r):i.__proto__=r,i}}():void 0);jr({target:"Object",stat:!0},{setPrototypeOf:Ts}),jr({target:"Object",stat:!0,sham:!s},{create:Ao});var As=s,Rs=T,Cs=l,Os=a,ws=no,ks=pr,Ps=h,Ns=De,Ds=M,Ms=Object.assign,Ls=Object.defineProperty,Us=Rs([].concat),xs=!Ms||Os((function(){if(As&&1!==Ms({b:1},Ms(Ls({},"a",{enumerable:!0,get:function(){Ls(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol(),r="abcdefghijklmnopqrst";return e[i]=7,r.split("").forEach((function(e){t[e]=e})),7!=Ms({},e)[i]||ws(Ms({},t)).join("")!=r}))?function(e,t){for(var i=Ns(e),r=arguments.length,n=1,o=ks.f,a=Ps.f;r>n;)for(var s,c=Ds(arguments[n++]),u=o?Us(ws(c),o(c)):ws(c),d=u.length,l=0;d>l;)s=u[l++],As&&!Cs(a,c,s)||(i[s]=c[s]);return i}:Ms,Vs=xs;jr({target:"Object",stat:!0,forced:Object.assign!==Vs},{assign:Vs});var Fs=c,Bs=Function.prototype,js=Bs.apply,Gs=Bs.call,Hs="object"==typeof Reflect&&Reflect.apply||(Fs?Gs.bind(js):function(){return Gs.apply(js,arguments)}),zs={},Ks=dt,Ws=Rt,qs=y,Xs=function(e,t,i){var r=Ks(t);r in e?Ws.f(e,r,qs(0,i)):e[r]=i},Ys=qi,Js=Zi,Qs=Xs,Zs=n.Array,$s=Math.max,ec=function(e,t,i){for(var r=Js(e),n=Ys(t,r),o=Ys(void 0===i?r:i,r),a=Zs($s(o-n,0)),s=0;n<o;n++,s++)Qs(a,s,e[n]);return a.length=s,a},tc=O,ic=F,rc=Bi.f,nc=ec,oc="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];zs.f=function(e){return oc&&"Window"==tc(e)?function(e){try{return rc(e)}catch(e){return nc(oc)}}(e):rc(ic(e))};var ac=T([].slice),sc={},cc=Ze;sc.f=cc;var uc=n,dc=Ue,lc=sc,hc=Rt.f,pc=function(e){var t=uc.Symbol||(uc.Symbol={});dc(t,e)||hc(t,e,{value:lc.f(e)})},fc=Rt.f,_c=Ue,vc=Ze("toStringTag"),mc=function(e,t,i){e&&!i&&(e=e.prototype),e&&!_c(e,vc)&&fc(e,vc,{configurable:!0,value:t})},yc=jr,gc=n,Sc=W,Ec=Hs,bc=l,Ic=T,Tc=s,Ac=ne,Rc=a,Cc=Ue,Oc=qr,wc=B,kc=G,Pc=q,Nc=le,Dc=Nt,Mc=De,Lc=F,Uc=dt,xc=Go,Vc=y,Fc=Ao,Bc=no,jc=Bi,Gc=zs,Hc=pr,zc=o,Kc=Rt,Wc=to,qc=h,Xc=ac,Yc=zt.exports,Jc=Te.exports,Qc=ai,Zc=je,$c=Ze,eu=sc,tu=pc,iu=mc,ru=Ii,nu=Mn.forEach,ou=oi("hidden"),au=$c("toPrimitive"),su=ru.set,cu=ru.getterFor("Symbol"),uu=Object.prototype,du=gc.Symbol,lu=du&&du.prototype,hu=gc.TypeError,pu=gc.QObject,fu=Sc("JSON","stringify"),_u=zc.f,vu=Kc.f,mu=Gc.f,yu=qc.f,gu=Ic([].push),Su=Jc("symbols"),Eu=Jc("op-symbols"),bu=Jc("string-to-symbol-registry"),Iu=Jc("symbol-to-string-registry"),Tu=Jc("wks"),Au=!pu||!pu.prototype||!pu.prototype.findChild,Ru=Tc&&Rc((function(){return 7!=Fc(vu({},"a",{get:function(){return vu(this,"a",{value:7}).a}})).a}))?function(e,t,i){var r=_u(uu,t);r&&delete uu[t],vu(e,t,i),r&&e!==uu&&vu(uu,t,r)}:vu,Cu=function(e,t){var i=Su[e]=Fc(lu);return su(i,{type:"Symbol",tag:e,description:t}),Tc||(i.description=t),i},Ou=function(e,t,i){e===uu&&Ou(Eu,t,i),Dc(e);var r=Uc(t);return Dc(i),Cc(Su,r)?(i.enumerable?(Cc(e,ou)&&e[ou][r]&&(e[ou][r]=!1),i=Fc(i,{enumerable:Vc(0,!1)})):(Cc(e,ou)||vu(e,ou,Vc(1,{})),e[ou][r]=!0),Ru(e,r,i)):vu(e,r,i)},wu=function(e,t){Dc(e);var i=Lc(t),r=Bc(i).concat(Du(i));return nu(r,(function(t){Tc&&!bc(ku,i,t)||Ou(e,t,i[t])})),e},ku=function(e){var t=Uc(e),i=bc(yu,this,t);return!(this===uu&&Cc(Su,t)&&!Cc(Eu,t))&&(!(i||!Cc(this,t)||!Cc(Su,t)||Cc(this,ou)&&this[ou][t])||i)},Pu=function(e,t){var i=Lc(e),r=Uc(t);if(i!==uu||!Cc(Su,r)||Cc(Eu,r)){var n=_u(i,r);return!n||!Cc(Su,r)||Cc(i,ou)&&i[ou][r]||(n.enumerable=!0),n}},Nu=function(e){var t=mu(Lc(e)),i=[];return nu(t,(function(e){Cc(Su,e)||Cc(Qc,e)||gu(i,e)})),i},Du=function(e){var t=e===uu,i=mu(t?Eu:Lc(e)),r=[];return nu(i,(function(e){!Cc(Su,e)||t&&!Cc(uu,e)||gu(r,Su[e])})),r};(Ac||(Yc(lu=(du=function(){if(Pc(lu,this))throw hu("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?xc(arguments[0]):void 0,t=Zc(e),i=function(e){this===uu&&bc(i,Eu,e),Cc(this,ou)&&Cc(this[ou],t)&&(this[ou][t]=!1),Ru(this,t,Vc(1,e))};return Tc&&Au&&Ru(uu,t,{configurable:!0,set:i}),Cu(t,e)}).prototype,"toString",(function(){return cu(this).tag})),Yc(du,"withoutSetter",(function(e){return Cu(Zc(e),e)})),qc.f=ku,Kc.f=Ou,Wc.f=wu,zc.f=Pu,jc.f=Gc.f=Nu,Hc.f=Du,eu.f=function(e){return Cu($c(e),e)},Tc&&(vu(lu,"description",{configurable:!0,get:function(){return cu(this).description}}),Yc(uu,"propertyIsEnumerable",ku,{unsafe:!0}))),yc({global:!0,wrap:!0,forced:!Ac,sham:!Ac},{Symbol:du}),nu(Bc(Tu),(function(e){tu(e)})),yc({target:"Symbol",stat:!0,forced:!Ac},{for:function(e){var t=xc(e);if(Cc(bu,t))return bu[t];var i=du(t);return bu[t]=i,Iu[i]=t,i},keyFor:function(e){if(!Nc(e))throw hu(e+" is not a symbol");if(Cc(Iu,e))return Iu[e]},useSetter:function(){Au=!0},useSimple:function(){Au=!1}}),yc({target:"Object",stat:!0,forced:!Ac,sham:!Tc},{create:function(e,t){return void 0===t?Fc(e):wu(Fc(e),t)},defineProperty:Ou,defineProperties:wu,getOwnPropertyDescriptor:Pu}),yc({target:"Object",stat:!0,forced:!Ac},{getOwnPropertyNames:Nu,getOwnPropertySymbols:Du}),yc({target:"Object",stat:!0,forced:Rc((function(){Hc.f(1)}))},{getOwnPropertySymbols:function(e){return Hc.f(Mc(e))}}),fu)&&yc({target:"JSON",stat:!0,forced:!Ac||Rc((function(){var e=du();return"[null]"!=fu([e])||"{}"!=fu({a:e})||"{}"!=fu(Object(e))}))},{stringify:function(e,t,i){var r=Xc(arguments),n=t;if((kc(t)||void 0!==e)&&!Nc(e))return Oc(t)||(t=function(e,t){if(wc(n)&&(t=bc(n,this,e,t)),!Nc(t))return t}),r[1]=t,Ec(fu,null,r)}});if(!lu[au]){var Mu=lu.valueOf;Yc(lu,au,(function(e){return bc(Mu,this)}))}iu(du,"Symbol"),Qc[ou]=!0;var Lu=jr,Uu=a,xu=F,Vu=o.f,Fu=s,Bu=Uu((function(){Vu(1)}));Lu({target:"Object",stat:!0,forced:!Fu||Bu,sham:!Fu},{getOwnPropertyDescriptor:function(e,t){return Vu(xu(e),t)}});var ju=jr,Gu=s,Hu=Rt.f;ju({target:"Object",stat:!0,forced:Object.defineProperty!==Hu,sham:!Gu},{defineProperty:Hu});var zu=n.Promise,Ku=zt.exports,Wu=function(e,t,i){for(var r in t)Ku(e,r,t[r],i);return e},qu=W,Xu=Rt,Yu=s,Ju=Ze("species"),Qu=function(e){var t=qu(e),i=Xu.f;Yu&&t&&!t[Ju]&&i(t,Ju,{configurable:!0,get:function(){return this}})},Zu=q,$u=n.TypeError,ed=function(e,t){if(Zu(t,e))return e;throw $u("Incorrect invocation")},td={},id=td,rd=Ze("iterator"),nd=Array.prototype,od=function(e){return void 0!==e&&(id.Array===e||nd[rd]===e)},ad=nn,sd=ge,cd=td,ud=Ze("iterator"),dd=function(e){if(null!=e)return sd(e,ud)||sd(e,"@@iterator")||cd[ad(e)]},ld=l,hd=me,pd=Nt,fd=pe,_d=dd,vd=n.TypeError,md=function(e,t){var i=arguments.length<2?_d(e):t;if(hd(i))return pd(ld(i,e));throw vd(fd(e)+" is not iterable")},yd=l,gd=Nt,Sd=ge,Ed=function(e,t,i){var r,n;gd(e);try{if(!(r=Sd(e,"return"))){if("throw"===t)throw i;return i}r=yd(r,e)}catch(e){n=!0,r=e}if("throw"===t)throw i;if(n)throw r;return gd(r),i},bd=Kr,Id=l,Td=Nt,Ad=pe,Rd=od,Cd=Zi,Od=q,wd=md,kd=dd,Pd=Ed,Nd=n.TypeError,Dd=function(e,t){this.stopped=e,this.result=t},Md=Dd.prototype,Ld=function(e,t,i){var r,n,o,a,s,c,u,d=i&&i.that,l=!(!i||!i.AS_ENTRIES),h=!(!i||!i.IS_ITERATOR),p=!(!i||!i.INTERRUPTED),f=bd(t,d),_=function(e){return r&&Pd(r,"normal",e),new Dd(!0,e)},v=function(e){return l?(Td(e),p?f(e[0],e[1],_):f(e[0],e[1])):p?f(e,_):f(e)};if(h)r=e;else{if(!(n=kd(e)))throw Nd(Ad(e)+" is not iterable");if(Rd(n)){for(o=0,a=Cd(e);a>o;o++)if((s=v(e[o]))&&Od(Md,s))return s;return new Dd(!1)}r=wd(e,n)}for(c=r.next;!(u=Id(c,r)).done;){try{s=v(u.value)}catch(e){Pd(r,"throw",e)}if("object"==typeof s&&s&&Od(Md,s))return s}return new Dd(!1)},Ud=Ze("iterator"),xd=!1;try{var Vd=0,Fd={next:function(){return{done:!!Vd++}},return:function(){xd=!0}};Fd[Ud]=function(){return this},Array.from(Fd,(function(){throw 2}))}catch(e){}var Bd,jd,Gd,Hd,zd=function(e,t){if(!t&&!xd)return!1;var i=!1;try{var r={};r[Ud]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(e){}return i},Kd=yn,Wd=pe,qd=n.TypeError,Xd=function(e){if(Kd(e))return e;throw qd(Wd(e)+" is not a constructor")},Yd=Nt,Jd=Xd,Qd=Ze("species"),Zd=function(e,t){var i,r=Yd(e).constructor;return void 0===r||null==(i=Yd(r)[Qd])?t:Jd(i)},$d=n.TypeError,el=function(e,t){if(e<t)throw $d("Not enough arguments");return e},tl=/(?:ipad|iphone|ipod).*applewebkit/i.test(X),il="process"==O(n.process),rl=n,nl=Hs,ol=Kr,al=B,sl=Ue,cl=a,ul=po,dl=ac,ll=ft,hl=el,pl=tl,fl=il,_l=rl.setImmediate,vl=rl.clearImmediate,ml=rl.process,yl=rl.Dispatch,gl=rl.Function,Sl=rl.MessageChannel,El=rl.String,bl=0,Il={};try{Bd=rl.location}catch(e){}var Tl=function(e){if(sl(Il,e)){var t=Il[e];delete Il[e],t()}},Al=function(e){return function(){Tl(e)}},Rl=function(e){Tl(e.data)},Cl=function(e){rl.postMessage(El(e),Bd.protocol+"//"+Bd.host)};_l&&vl||(_l=function(e){hl(arguments.length,1);var t=al(e)?e:gl(e),i=dl(arguments,1);return Il[++bl]=function(){nl(t,void 0,i)},jd(bl),bl},vl=function(e){delete Il[e]},fl?jd=function(e){ml.nextTick(Al(e))}:yl&&yl.now?jd=function(e){yl.now(Al(e))}:Sl&&!pl?(Hd=(Gd=new Sl).port2,Gd.port1.onmessage=Rl,jd=ol(Hd.postMessage,Hd)):rl.addEventListener&&al(rl.postMessage)&&!rl.importScripts&&Bd&&"file:"!==Bd.protocol&&!cl(Cl)?(jd=Cl,rl.addEventListener("message",Rl,!1)):jd="onreadystatechange"in ll("script")?function(e){ul.appendChild(ll("script")).onreadystatechange=function(){ul.removeChild(this),Tl(e)}}:function(e){setTimeout(Al(e),0)});var Ol,wl,kl,Pl,Nl,Dl,Ml,Ll,Ul={set:_l,clear:vl},xl=n,Vl=/ipad|iphone|ipod/i.test(X)&&void 0!==xl.Pebble,Fl=/web0s(?!.*chrome)/i.test(X),Bl=n,jl=Kr,Gl=o.f,Hl=Ul.set,zl=tl,Kl=Vl,Wl=Fl,ql=il,Xl=Bl.MutationObserver||Bl.WebKitMutationObserver,Yl=Bl.document,Jl=Bl.process,Ql=Bl.Promise,Zl=Gl(Bl,"queueMicrotask"),$l=Zl&&Zl.value;$l||(Ol=function(){var e,t;for(ql&&(e=Jl.domain)&&e.exit();wl;){t=wl.fn,wl=wl.next;try{t()}catch(e){throw wl?Pl():kl=void 0,e}}kl=void 0,e&&e.enter()},zl||ql||Wl||!Xl||!Yl?!Kl&&Ql&&Ql.resolve?((Ml=Ql.resolve(void 0)).constructor=Ql,Ll=jl(Ml.then,Ml),Pl=function(){Ll(Ol)}):ql?Pl=function(){Jl.nextTick(Ol)}:(Hl=jl(Hl,Bl),Pl=function(){Hl(Ol)}):(Nl=!0,Dl=Yl.createTextNode(""),new Xl(Ol).observe(Dl,{characterData:!0}),Pl=function(){Dl.data=Nl=!Nl}));var eh=$l||function(e){var t={fn:e,next:void 0};kl&&(kl.next=t),wl||(wl=t,Pl()),kl=t},th={},ih=me,rh=function(e){var t,i;this.promise=new e((function(e,r){if(void 0!==t||void 0!==i)throw TypeError("Bad Promise constructor");t=e,i=r})),this.resolve=ih(t),this.reject=ih(i)};th.f=function(e){return new rh(e)};var nh=Nt,oh=G,ah=th,sh=function(e,t){if(nh(e),oh(t)&&t.constructor===e)return t;var i=ah.f(e);return(0,i.resolve)(t),i.promise},ch=n,uh=function(){this.head=null,this.tail=null};uh.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var dh,lh,hh,ph,fh=uh,_h="object"==typeof window,vh=jr,mh=n,yh=W,gh=l,Sh=zu,Eh=zt.exports,bh=Wu,Ih=Ts,Th=mc,Ah=Qu,Rh=me,Ch=B,Oh=G,wh=ed,kh=Qt,Ph=Ld,Nh=zd,Dh=Zd,Mh=Ul.set,Lh=eh,Uh=sh,xh=function(e,t){var i=ch.console;i&&i.error&&(1==arguments.length?i.error(e):i.error(e,t))},Vh=th,Fh=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Bh=fh,jh=Ii,Gh=Dr,Hh=_h,zh=il,Kh=te,Wh=Ze("species"),qh="Promise",Xh=jh.getterFor(qh),Yh=jh.set,Jh=jh.getterFor(qh),Qh=Sh&&Sh.prototype,Zh=Sh,$h=Qh,ep=mh.TypeError,tp=mh.document,ip=mh.process,rp=Vh.f,np=rp,op=!!(tp&&tp.createEvent&&mh.dispatchEvent),ap=Ch(mh.PromiseRejectionEvent),sp=!1,cp=Gh(qh,(function(){var e=kh(Zh),t=e!==String(Zh);if(!t&&66===Kh)return!0;if(Kh>=51&&/native code/.test(e))return!1;var i=new Zh((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(i.constructor={})[Wh]=r,!(sp=i.then((function(){}))instanceof r)||!t&&Hh&&!ap})),up=cp||!Nh((function(e){Zh.all(e).catch((function(){}))})),dp=function(e){var t;return!(!Oh(e)||!Ch(t=e.then))&&t},lp=function(e,t){var i,r,n,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&vp(t),t.rejection=1),!0===s?i=o:(d&&d.enter(),i=s(o),d&&(d.exit(),n=!0)),i===e.promise?u(ep("Promise-chain cycle")):(r=dp(i))?gh(r,i,c,u):c(i)):u(o)}catch(e){d&&!n&&d.exit(),u(e)}},hp=function(e,t){e.notified||(e.notified=!0,Lh((function(){for(var i,r=e.reactions;i=r.get();)lp(i,e);e.notified=!1,t&&!e.rejection&&fp(e)})))},pp=function(e,t,i){var r,n;op?((r=tp.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),mh.dispatchEvent(r)):r={promise:t,reason:i},!ap&&(n=mh["on"+e])?n(r):"unhandledrejection"===e&&xh("Unhandled promise rejection",i)},fp=function(e){gh(Mh,mh,(function(){var t,i=e.facade,r=e.value;if(_p(e)&&(t=Fh((function(){zh?ip.emit("unhandledRejection",r,i):pp("unhandledrejection",i,r)})),e.rejection=zh||_p(e)?2:1,t.error))throw t.value}))},_p=function(e){return 1!==e.rejection&&!e.parent},vp=function(e){gh(Mh,mh,(function(){var t=e.facade;zh?ip.emit("rejectionHandled",t):pp("rejectionhandled",t,e.value)}))},mp=function(e,t,i){return function(r){e(t,r,i)}},yp=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,hp(e,!0))},gp=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw ep("Promise can't be resolved itself");var r=dp(t);r?Lh((function(){var i={done:!1};try{gh(r,t,mp(gp,i,e),mp(yp,i,e))}catch(t){yp(i,t,e)}})):(e.value=t,e.state=1,hp(e,!1))}catch(t){yp({done:!1},t,e)}}};if(cp&&($h=(Zh=function(e){wh(this,$h),Rh(e),gh(dh,this);var t=Xh(this);try{e(mp(gp,t),mp(yp,t))}catch(e){yp(t,e)}}).prototype,(dh=function(e){Yh(this,{type:qh,done:!1,notified:!1,parent:!1,reactions:new Bh,rejection:!1,state:0,value:void 0})}).prototype=bh($h,{then:function(e,t){var i=Jh(this),r=rp(Dh(this,Zh));return i.parent=!0,r.ok=!Ch(e)||e,r.fail=Ch(t)&&t,r.domain=zh?ip.domain:void 0,0==i.state?i.reactions.add(r):Lh((function(){lp(r,i)})),r.promise},catch:function(e){return this.then(void 0,e)}}),lh=function(){var e=new dh,t=Xh(e);this.promise=e,this.resolve=mp(gp,t),this.reject=mp(yp,t)},Vh.f=rp=function(e){return e===Zh||e===hh?new lh(e):np(e)},Ch(Sh)&&Qh!==Object.prototype)){ph=Qh.then,sp||(Eh(Qh,"then",(function(e,t){var i=this;return new Zh((function(e,t){gh(ph,i,e,t)})).then(e,t)}),{unsafe:!0}),Eh(Qh,"catch",$h.catch,{unsafe:!0}));try{delete Qh.constructor}catch(e){}Ih&&Ih(Qh,$h)}vh({global:!0,wrap:!0,forced:cp},{Promise:Zh}),Th(Zh,qh,!1),Ah(qh),hh=yh(qh),vh({target:qh,stat:!0,forced:cp},{reject:function(e){var t=rp(this);return gh(t.reject,void 0,e),t.promise}}),vh({target:qh,stat:!0,forced:cp},{resolve:function(e){return Uh(this,e)}}),vh({target:qh,stat:!0,forced:up},{all:function(e){var t=this,i=rp(t),r=i.resolve,n=i.reject,o=Fh((function(){var i=Rh(t.resolve),o=[],a=0,s=1;Ph(e,(function(e){var c=a++,u=!1;s++,gh(i,t,e).then((function(e){u||(u=!0,o[c]=e,--s||r(o))}),n)})),--s||r(o)}));return o.error&&n(o.value),i.promise},race:function(e){var t=this,i=rp(t),r=i.reject,n=Fh((function(){var n=Rh(t.resolve);Ph(e,(function(e){gh(n,t,e).then(i.resolve,r)}))}));return n.error&&r(n.value),i.promise}});var Sp=jr,Ep=s,bp=n,Ip=T,Tp=Ue,Ap=B,Rp=q,Cp=Go,Op=Rt.f,wp=Tr,kp=bp.Symbol,Pp=kp&&kp.prototype;if(Ep&&Ap(kp)&&(!("description"in Pp)||void 0!==kp().description)){var Np={},Dp=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:Cp(arguments[0]),t=Rp(Pp,this)?new kp(e):void 0===e?kp():kp(e);return""===e&&(Np[t]=!0),t};wp(Dp,kp),Dp.prototype=Pp,Pp.constructor=Dp;var Mp="Symbol(test)"==String(kp("test")),Lp=Ip(Pp.toString),Up=Ip(Pp.valueOf),xp=/^Symbol\((.*)\)[^)]+$/,Vp=Ip("".replace),Fp=Ip("".slice);Op(Pp,"description",{configurable:!0,get:function(){var e=Up(this),t=Lp(e);if(Tp(Np,e))return"";var i=Mp?Fp(t,7,-1):Vp(t,xp,"$1");return""===i?void 0:i}}),Sp({global:!0,forced:!0},{Symbol:Dp})}pc("iterator");var Bp,jp,Gp,Hp=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),zp=n,Kp=Ue,Wp=B,qp=De,Xp=Hp,Yp=oi("IE_PROTO"),Jp=zp.Object,Qp=Jp.prototype,Zp=Xp?Jp.getPrototypeOf:function(e){var t=qp(e);if(Kp(t,Yp))return t[Yp];var i=t.constructor;return Wp(i)&&t instanceof i?i.prototype:t instanceof Jp?Qp:null},$p=a,ef=B,tf=Zp,rf=zt.exports,nf=Ze("iterator"),of=!1;[].keys&&("next"in(Gp=[].keys())?(jp=tf(tf(Gp)))!==Object.prototype&&(Bp=jp):of=!0);var af=null==Bp||$p((function(){var e={};return Bp[nf].call(e)!==e}));af&&(Bp={}),ef(Bp[nf])||rf(Bp,nf,(function(){return this}));var sf={IteratorPrototype:Bp,BUGGY_SAFARI_ITERATORS:of},cf=sf.IteratorPrototype,uf=Ao,df=y,lf=mc,hf=td,pf=function(){return this},ff=function(e,t,i,r){var n=t+" Iterator";return e.prototype=uf(cf,{next:df(+!r,i)}),lf(e,n,!1),hf[n]=pf,e},_f=jr,vf=l,mf=wi,yf=B,gf=ff,Sf=Zp,Ef=Ts,bf=mc,If=Ht,Tf=zt.exports,Af=td,Rf=mf.PROPER,Cf=mf.CONFIGURABLE,Of=sf.IteratorPrototype,wf=sf.BUGGY_SAFARI_ITERATORS,kf=Ze("iterator"),Pf=function(){return this},Nf=function(e,t,i,r,n,o,a){gf(i,t,r);var s,c,u,d=function(e){if(e===n&&_)return _;if(!wf&&e in p)return p[e];switch(e){case"keys":case"values":case"entries":return function(){return new i(this,e)}}return function(){return new i(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[kf]||p["@@iterator"]||n&&p[n],_=!wf&&f||d(n),v="Array"==t&&p.entries||f;if(v&&(s=Sf(v.call(new e)))!==Object.prototype&&s.next&&(Sf(s)!==Of&&(Ef?Ef(s,Of):yf(s[kf])||Tf(s,kf,Pf)),bf(s,l,!0)),Rf&&"values"==n&&f&&"values"!==f.name&&(Cf?If(p,"name","values"):(h=!0,_=function(){return vf(f,this)})),n)if(c={values:d("values"),keys:o?_:d("keys"),entries:d("entries")},a)for(u in c)(wf||h||!(u in p))&&Tf(p,u,c[u]);else _f({target:t,proto:!0,forced:wf||h},c);return p[kf]!==_&&Tf(p,kf,_,{name:n}),Af[t]=_,c},Df=F,Mf=ko,Lf=td,Uf=Ii,xf=Rt.f,Vf=Nf,Ff=s,Bf=Uf.set,jf=Uf.getterFor("Array Iterator"),Gf=Vf(Array,"Array",(function(e,t){Bf(this,{type:"Array Iterator",target:Df(e),index:0,kind:t})}),(function(){var e=jf(this),t=e.target,i=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:r,done:!1}:"values"==i?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),Hf=Lf.Arguments=Lf.Array;if(Mf("keys"),Mf("values"),Mf("entries"),Ff&&"values"!==Hf.name)try{xf(Hf,"name",{value:"values"})}catch(e){}var zf=T,Kf=Hi,Wf=Go,qf=U,Xf=zf("".charAt),Yf=zf("".charCodeAt),Jf=zf("".slice),Qf=function(e){return function(t,i){var r,n,o=Wf(qf(t)),a=Kf(i),s=o.length;return a<0||a>=s?e?"":void 0:(r=Yf(o,a))<55296||r>56319||a+1===s||(n=Yf(o,a+1))<56320||n>57343?e?Xf(o,a):r:e?Jf(o,a,a+2):n-56320+(r-55296<<10)+65536}},Zf={codeAt:Qf(!1),charAt:Qf(!0)},$f=Zf.charAt,e_=Go,t_=Ii,i_=Nf,r_=t_.set,n_=t_.getterFor("String Iterator");i_(String,"String",(function(e){r_(this,{type:"String Iterator",string:e_(e),index:0})}),(function(){var e,t=n_(this),i=t.string,r=t.index;return r>=i.length?{value:void 0,done:!0}:(e=$f(i,r),t.index+=e.length,{value:e,done:!1})}));var o_=n,a_=zn,s_=qn,c_=Gf,u_=Ht,d_=Ze,l_=d_("iterator"),h_=d_("toStringTag"),p_=c_.values,f_=function(e,t){if(e){if(e[l_]!==p_)try{u_(e,l_,p_)}catch(t){e[l_]=p_}if(e[h_]||u_(e,h_,t),a_[t])for(var i in c_)if(e[i]!==c_[i])try{u_(e,i,c_[i])}catch(t){e[i]=c_[i]}}};for(var __ in a_)f_(o_[__]&&o_[__].prototype,__);f_(s_,"DOMTokenList");var v_=a,m_=te,y_=Ze("species"),g_=function(e){return m_>=51||!v_((function(){var t=[];return(t.constructor={})[y_]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},S_=jr,E_=n,b_=a,I_=qr,T_=G,A_=De,R_=Zi,C_=Xs,O_=Rn,w_=g_,k_=te,P_=Ze("isConcatSpreadable"),N_=E_.TypeError,D_=k_>=51||!b_((function(){var e=[];return e[P_]=!1,e.concat()[0]!==e})),M_=w_("concat"),L_=function(e){if(!T_(e))return!1;var t=e[P_];return void 0!==t?!!t:I_(e)};S_({target:"Array",proto:!0,forced:!D_||!M_},{concat:function(e){var t,i,r,n,o,a=A_(this),s=O_(a,0),c=0;for(t=-1,r=arguments.length;t<r;t++)if(L_(o=-1===t?a:arguments[t])){if(c+(n=R_(o))>9007199254740991)throw N_("Maximum allowed index exceeded");for(i=0;i<n;i++,c++)i in o&&C_(s,c,o[i])}else{if(c>=9007199254740991)throw N_("Maximum allowed index exceeded");C_(s,c++,o)}return s.length=c,s}});var U_=jr,x_=n,V_=qr,F_=yn,B_=G,j_=qi,G_=Zi,H_=F,z_=Xs,K_=Ze,W_=ac,q_=g_("slice"),X_=K_("species"),Y_=x_.Array,J_=Math.max;U_({target:"Array",proto:!0,forced:!q_},{slice:function(e,t){var i,r,n,o=H_(this),a=G_(o),s=j_(e,a),c=j_(void 0===t?a:t,a);if(V_(o)&&(i=o.constructor,(F_(i)&&(i===Y_||V_(i.prototype))||B_(i)&&null===(i=i[X_]))&&(i=void 0),i===Y_||void 0===i))return W_(o,s,c);for(r=new(void 0===i?Y_:i)(J_(c-s,0)),n=0;s<c;s++,n++)s in o&&z_(r,n,o[s]);return r.length=n,r}}),pc("asyncIterator");var Q_=function(e,t){return Q_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},Q_(e,t)};function Z_(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}Q_(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var $_=function(){return $_=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},$_.apply(this,arguments)};function ev(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"===("undefined"==typeof Reflect?"undefined":vs(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a}function tv(e,t,i,r){return new(i||(i=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function iv(e,t){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function rv(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],r=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function nv(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var r,n,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return a}function ov(e,t,i){if(i||2===arguments.length)for(var r,n=0,o=t.length;n<o;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))}function av(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=rv(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(i){t[i]=e[i]&&function(t){return new Promise((function(r,n){(function(e,t,i,r){Promise.resolve(r).then((function(t){e({value:t,done:i})}),t)})(r,n,(t=e[i](t)).done,t.value)}))}}}function sv(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var cv=Zf.charAt,uv=function(e,t,i){return t+(i?cv(e,t).length:1)},dv=l,lv=Nt,hv=Ji,pv=Go,fv=U,_v=ge,vv=uv,mv=qa;Fa("match",(function(e,t,i){return[function(t){var i=fv(this),r=null==t?void 0:_v(t,e);return r?dv(r,t,i):new RegExp(t)[e](pv(i))},function(e){var r=lv(this),n=pv(e),o=i(t,r,n);if(o.done)return o.value;if(!r.global)return mv(r,n);var a=r.unicode;r.lastIndex=0;for(var s,c=[],u=0;null!==(s=mv(r,n));){var d=pv(s[0]);c[u]=d,""===d&&(r.lastIndex=vv(n,hv(r.lastIndex),a)),u++}return 0===u?null:c}]}));var yv="\t\n\v\f\r \u2028\u2029\ufeff",gv=U,Sv=Go,Ev=T("".replace),bv="[\t\n\v\f\r \u2028\u2029\ufeff]",Iv=RegExp("^"+bv+bv+"*"),Tv=RegExp(bv+bv+"*$"),Av=function(e){return function(t){var i=Sv(gv(t));return 1&e&&(i=Ev(i,Iv,"")),2&e&&(i=Ev(i,Tv,"")),i}},Rv={start:Av(1),end:Av(2),trim:Av(3)},Cv=n,Ov=a,wv=T,kv=Go,Pv=Rv.trim,Nv=Cv.parseInt,Dv=Cv.Symbol,Mv=Dv&&Dv.iterator,Lv=/^[+-]?0x/i,Uv=wv(Lv.exec),xv=8!==Nv("\t\n\v\f\r \u2028\u2029\ufeff08")||22!==Nv("\t\n\v\f\r \u2028\u2029\ufeff0x16")||Mv&&!Ov((function(){Nv(Object(Mv))}))?function(e,t){var i=Pv(kv(e));return Nv(i,t>>>0||(Uv(Lv,i)?16:10))}:Nv;jr({global:!0,forced:parseInt!=xv},{parseInt:xv});var Vv={exports:{}},Fv=a((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Bv=a,jv=G,Gv=O,Hv=Fv,zv=Object.isExtensible,Kv=Bv((function(){zv(1)}))||Hv?function(e){return!!jv(e)&&((!Hv||"ArrayBuffer"!=Gv(e))&&(!zv||zv(e)))}:zv,Wv=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),qv=jr,Xv=T,Yv=ai,Jv=G,Qv=Ue,Zv=Rt.f,$v=Bi,em=zs,tm=Kv,im=Wv,rm=!1,nm=je("meta"),om=0,am=function(e){Zv(e,nm,{value:{objectID:"O"+om++,weakData:{}}})},sm=Vv.exports={enable:function(){sm.enable=function(){},rm=!0;var e=$v.f,t=Xv([].splice),i={};i[nm]=1,e(i).length&&($v.f=function(i){for(var r=e(i),n=0,o=r.length;n<o;n++)if(r[n]===nm){t(r,n,1);break}return r},qv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:em.f}))},fastKey:function(e,t){if(!Jv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Qv(e,nm)){if(!tm(e))return"F";if(!t)return"E";am(e)}return e[nm].objectID},getWeakData:function(e,t){if(!Qv(e,nm)){if(!tm(e))return!0;if(!t)return!1;am(e)}return e[nm].weakData},onFreeze:function(e){return im&&rm&&tm(e)&&!Qv(e,nm)&&am(e),e}};Yv[nm]=!0;var cm=B,um=G,dm=Ts,lm=function(e,t,i){var r,n;return dm&&cm(r=t.constructor)&&r!==i&&um(n=r.prototype)&&n!==i.prototype&&dm(e,n),e},hm=jr,pm=n,fm=T,_m=Dr,vm=zt.exports,mm=Vv.exports,ym=Ld,gm=ed,Sm=B,Em=G,bm=a,Im=zd,Tm=mc,Am=lm,Rm=function(e,t,i){var r=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=r?"set":"add",a=pm[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=fm(s[e]);vm(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(n&&!Em(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!Em(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!Em(e))&&t(this,0===e?0:e)}:function(e,i){return t(this,0===e?0:e,i),this})};if(_m(e,!Sm(a)||!(n||s.forEach&&!bm((function(){(new a).entries().next()})))))c=i.getConstructor(t,e,r,o),mm.enable();else if(_m(e,!0)){var l=new c,h=l[o](n?{}:-0,1)!=l,p=bm((function(){l.has(1)})),f=Im((function(e){new a(e)})),_=!n&&bm((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));f||((c=t((function(e,t){gm(e,s);var i=Am(new a,e,c);return null!=t&&ym(t,i[o],{that:i,AS_ENTRIES:r}),i}))).prototype=s,s.constructor=c),(p||_)&&(d("delete"),d("has"),r&&d("get")),(_||h)&&d(o),n&&s.clear&&delete s.clear}return u[e]=c,hm({global:!0,forced:c!=a},u),Tm(c,e),n||i.setStrong(c,e,r),c},Cm=Rt.f,Om=Ao,wm=Wu,km=Kr,Pm=ed,Nm=Ld,Dm=Nf,Mm=Qu,Lm=s,Um=Vv.exports.fastKey,xm=Ii.set,Vm=Ii.getterFor,Fm={getConstructor:function(e,t,i,r){var n=e((function(e,n){Pm(e,o),xm(e,{type:t,index:Om(null),first:void 0,last:void 0,size:0}),Lm||(e.size=0),null!=n&&Nm(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=Vm(t),s=function(e,t,i){var r,n,o=a(e),s=c(e,t);return s?s.value=i:(o.last=s={index:n=Um(t,!0),key:t,value:i,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),Lm?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},c=function(e,t){var i,r=a(e),n=Um(t);if("F"!==n)return r.index[n];for(i=r.first;i;i=i.next)if(i.key==t)return i};return wm(o,{clear:function(){for(var e=a(this),t=e.index,i=e.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete t[i.index],i=i.next;e.first=e.last=void 0,Lm?e.size=0:this.size=0},delete:function(e){var t=this,i=a(t),r=c(t,e);if(r){var n=r.next,o=r.previous;delete i.index[r.index],r.removed=!0,o&&(o.next=n),n&&(n.previous=o),i.first==r&&(i.first=n),i.last==r&&(i.last=o),Lm?i.size--:t.size--}return!!r},forEach:function(e){for(var t,i=a(this),r=km(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:i.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),wm(o,i?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),Lm&&Cm(o,"size",{get:function(){return a(this).size}}),n},setStrong:function(e,t,i){var r=t+" Iterator",n=Vm(t),o=Vm(r);Dm(e,t,(function(e,t){xm(this,{type:r,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,i=e.last;i&&i.removed;)i=i.previous;return e.target&&(e.last=i=i?i.next:e.state.first)?"keys"==t?{value:i.key,done:!1}:"values"==t?{value:i.value,done:!1}:{value:[i.key,i.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),i?"entries":"values",!i,!0),Mm(t)}};Rm("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Fm);var Bm=De,jm=no;jr({target:"Object",stat:!0,forced:a((function(){jm(1)}))},{keys:function(e){return jm(Bm(e))}});var Gm=me,Hm=De,zm=M,Km=Zi,Wm=n.TypeError,qm=function(e){return function(t,i,r,n){Gm(i);var o=Hm(t),a=zm(o),s=Km(o),c=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(c in a){n=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw Wm("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(n=i(n,a[c],c,o));return n}},Xm={left:qm(!1),right:qm(!0)},Ym=Xm.left,Jm=te,Qm=il;jr({target:"Array",proto:!0,forced:!Un("reduce")||!Qm&&Jm>79&&Jm<83},{reduce:function(e){var t=arguments.length;return Ym(this,e,t,t>1?arguments[1]:void 0)}});var Zm,$m=jr,ey=T,ty=o.f,iy=Ji,ry=Go,ny=Fo,oy=U,ay=zo,sy=ey("".endsWith),cy=ey("".slice),uy=Math.min,dy=ay("endsWith");$m({target:"String",proto:!0,forced:!!(dy||(Zm=ty(String.prototype,"endsWith"),!Zm||Zm.writable))&&!dy},{endsWith:function(e){var t=ry(oy(this));ny(e);var i=arguments.length>1?arguments[1]:void 0,r=t.length,n=void 0===i?r:uy(iy(i),r),o=ry(e);return sy?sy(t,o,n):cy(t,n-o.length,n)===o}});var ly=!0,hy=!0;function py(e,t,i){var r=e.match(t);return r&&r.length>=i&&parseInt(r[i],10)}function fy(e,t,i){if(e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,n=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return n.apply(this,arguments);var o=function(e){var t=i(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),n.apply(this,[e,o])};var o=r.removeEventListener;r.removeEventListener=function(e,i){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(i))return o.apply(this,arguments);var r=this._eventMap[t].get(i);return this._eventMap[t].delete(i),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function _y(e){return"boolean"!=typeof e?new Error("Argument type: "+vs(e)+". Please use a boolean."):(ly=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function vy(e){return"boolean"!=typeof e?new Error("Argument type: "+vs(e)+". Please use a boolean."):(hy=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function my(){if("object"===("undefined"==typeof window?"undefined":vs(window))){if(ly)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function yy(e,t){hy&&console.warn(e+" is deprecated, please use "+t+" instead.")}function gy(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var i=e.navigator;if(i.mozGetUserMedia)t.browser="firefox",t.version=py(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=py(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!i.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=py(i.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function Sy(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ey(e){return Sy(e)?Object.keys(e).reduce((function(t,i){var r=Sy(e[i]),n=r?Ey(e[i]):e[i],o=r&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,sv({},i,n))}),{}):e}function by(e,t,i){t&&!i.has(t.id)&&(i.set(t.id,t),Object.keys(t).forEach((function(r){r.endsWith("Id")?by(e,e.get(t[r]),i):r.endsWith("Ids")&&t[r].forEach((function(t){by(e,e.get(t),i)}))})))}function Iy(e,t,i){var r=i?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(i){i.type===r&&i.trackId===t.id&&by(e,i,n)}))})),n}var Ty=jr,Ay=Mn.find,Ry=ko,Cy=!0;"find"in[]&&Array(1).find((function(){Cy=!1})),Ty({target:"Array",proto:!0,forced:Cy},{find:function(e){return Ay(this,e,arguments.length>1?arguments[1]:void 0)}}),Ry("find");var Oy=jr,wy=n,ky=qi,Py=Hi,Ny=Zi,Dy=De,My=Rn,Ly=Xs,Uy=g_("splice"),xy=wy.TypeError,Vy=Math.max,Fy=Math.min;Oy({target:"Array",proto:!0,forced:!Uy},{splice:function(e,t){var i,r,n,o,a,s,c=Dy(this),u=Ny(c),d=ky(e,u),l=arguments.length;if(0===l?i=r=0:1===l?(i=0,r=u-d):(i=l-2,r=Fy(Vy(Py(t),0),u-d)),u+i-r>9007199254740991)throw xy("Maximum allowed length exceeded");for(n=My(c,r),o=0;o<r;o++)(a=d+o)in c&&Ly(n,o,c[a]);if(n.length=r,i<r){for(o=d;o<u-r;o++)s=o+i,(a=o+r)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-r+i;o--)delete c[o-1]}else if(i>r)for(o=u-r;o>d;o--)s=o+i-1,(a=o+r-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<i;o++)c[o+d]=arguments[o+2];return c.length=u-r+i,n}});var By=Mn.map;jr({target:"Array",proto:!0,forced:!g_("map")},{map:function(e){return By(this,e,arguments.length>1?arguments[1]:void 0)}});var jy=Mn.filter;jr({target:"Array",proto:!0,forced:!g_("filter")},{filter:function(e){return jy(this,e,arguments.length>1?arguments[1]:void 0)}});var Gy=T,Hy=De,zy=Math.floor,Ky=Gy("".charAt),Wy=Gy("".replace),qy=Gy("".slice),Xy=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Yy=/\$([$&'`]|\d{1,2})/g,Jy=function(e,t,i,r,n,o){var a=i+e.length,s=r.length,c=Yy;return void 0!==n&&(n=Hy(n),c=Xy),Wy(o,c,(function(o,c){var u;switch(Ky(c,0)){case"$":return"$";case"&":return e;case"`":return qy(t,0,i);case"'":return qy(t,a);case"<":u=n[qy(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=zy(d/10);return 0===l?o:l<=s?void 0===r[l-1]?Ky(c,1):r[l-1]+Ky(c,1):o}u=r[d-1]}return void 0===u?"":u}))},Qy=Hs,Zy=l,$y=T,eg=Fa,tg=a,ig=Nt,rg=B,ng=Hi,og=Ji,ag=Go,sg=U,cg=uv,ug=ge,dg=Jy,lg=qa,hg=Ze("replace"),pg=Math.max,fg=Math.min,_g=$y([].concat),vg=$y([].push),mg=$y("".indexOf),yg=$y("".slice),gg="$0"==="a".replace(/./,"$0"),Sg=!!/./[hg]&&""===/./[hg]("a","$0");eg("replace",(function(e,t,i){var r=Sg?"$":"$0";return[function(e,i){var r=sg(this),n=null==e?void 0:ug(e,hg);return n?Zy(n,e,r,i):Zy(t,ag(r),e,i)},function(e,n){var o=ig(this),a=ag(e);if("string"==typeof n&&-1===mg(n,r)&&-1===mg(n,"$<")){var s=i(t,o,a,n);if(s.done)return s.value}var c=rg(n);c||(n=ag(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=lg(o,a);if(null===h)break;if(vg(l,h),!u)break;""===ag(h[0])&&(o.lastIndex=cg(a,og(o.lastIndex),d))}for(var p,f="",_=0,v=0;v<l.length;v++){for(var m=ag((h=l[v])[0]),y=pg(fg(ng(h.index),a.length),0),g=[],S=1;S<h.length;S++)vg(g,void 0===(p=h[S])?p:String(p));var E=h.groups;if(c){var b=_g([m],g,y,a);void 0!==E&&vg(b,E);var I=ag(Qy(n,void 0,b))}else I=dg(m,a,y,g,E,n);y>=_&&(f+=yg(a,_,y)+I,_=y+m.length)}return f+yg(a,_)}]}),!!tg((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!gg||Sg);var Eg=s,bg=n,Ig=T,Tg=Dr,Ag=lm,Rg=Ht,Cg=Rt.f,Og=Bi.f,wg=q,kg=Uo,Pg=Go,Ng=Zo,Dg=ra,Mg=zt.exports,Lg=a,Ug=Ue,xg=Ii.enforce,Vg=Qu,Fg=aa,Bg=ua,jg=Ze("match"),Gg=bg.RegExp,Hg=Gg.prototype,zg=bg.SyntaxError,Kg=Ig(Ng),Wg=Ig(Hg.exec),qg=Ig("".charAt),Xg=Ig("".replace),Yg=Ig("".indexOf),Jg=Ig("".slice),Qg=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Zg=/a/g,$g=/a/g,eS=new Gg(Zg)!==Zg,tS=Dg.MISSED_STICKY,iS=Dg.UNSUPPORTED_Y,rS=Eg&&(!eS||tS||Fg||Bg||Lg((function(){return $g[jg]=!1,Gg(Zg)!=Zg||Gg($g)==$g||"/a/i"!=Gg(Zg,"i")})));if(Tg("RegExp",rS)){for(var nS=function(e,t){var i,r,n,o,a,s,c=wg(Hg,this),u=kg(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===nS)return e;if((u||wg(Hg,e))&&(e=e.source,d&&(t="flags"in h?h.flags:Kg(h))),e=void 0===e?"":Pg(e),t=void 0===t?"":Pg(t),h=e,Fg&&"dotAll"in Zg&&(r=!!t&&Yg(t,"s")>-1)&&(t=Xg(t,/s/g,"")),i=t,tS&&"sticky"in Zg&&(n=!!t&&Yg(t,"y")>-1)&&iS&&(t=Xg(t,/y/g,"")),Bg&&(o=function(e){for(var t,i=e.length,r=0,n="",o=[],a={},s=!1,c=!1,u=0,d="";r<=i;r++){if("\\"===(t=qg(e,r)))t+=qg(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:Wg(Qg,Jg(e,r+1))&&(r+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||Ug(a,d))throw new zg("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:n+=t}return[n,o]}(e),e=o[0],l=o[1]),a=Ag(Gg(e,t),c?this:Hg,nS),(r||n||l.length)&&(s=xg(a),r&&(s.dotAll=!0,s.raw=nS(function(e){for(var t,i=e.length,r=0,n="",o=!1;r<=i;r++)"\\"!==(t=qg(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+qg(e,++r);return n}(e),i)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{Rg(a,"source",""===h?"(?:)":h)}catch(e){}return a},oS=function(e){e in nS||Cg(nS,e,{configurable:!0,get:function(){return Gg[e]},set:function(t){Gg[e]=t}})},aS=Og(Gg),sS=0;aS.length>sS;)oS(aS[sS++]);Hg.constructor=nS,nS.prototype=Hg,Mg(bg,"RegExp",nS)}Vg("RegExp");var cS=T,uS=wi.PROPER,dS=zt.exports,lS=Nt,hS=q,pS=Go,fS=a,_S=Zo,vS=RegExp.prototype,mS=vS.toString,yS=cS(_S),gS=fS((function(){return"/a/b"!=mS.call({source:"a",flags:"b"})})),SS=uS&&"toString"!=mS.name;(gS||SS)&&dS(RegExp.prototype,"toString",(function(){var e=lS(this),t=pS(e.source),i=e.flags;return"/"+t+"/"+pS(void 0===i&&hS(vS,e)&&!("flags"in vS)?yS(e):i)}),{unsafe:!0});var ES=Mn.some;jr({target:"Array",proto:!0,forced:!Un("some")},{some:function(e){return ES(this,e,arguments.length>1?arguments[1]:void 0)}});var bS=s,IS=wi.EXISTS,TS=T,AS=Rt.f,RS=Function.prototype,CS=TS(RS.toString),OS=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,wS=TS(OS.exec);bS&&!IS&&AS(RS,"name",{configurable:!0,get:function(){try{return wS(OS,CS(this))[1]}catch(e){return""}}});var kS=T,PS=me,NS=G,DS=Ue,MS=ac,LS=c,US=n.Function,xS=kS([].concat),VS=kS([].join),FS={},BS=function(e,t,i){if(!DS(FS,t)){for(var r=[],n=0;n<t;n++)r[n]="a["+n+"]";FS[t]=US("C,a","return new C("+VS(r,",")+")")}return FS[t](e,i)},jS=LS?US.bind:function(e){var t=PS(this),i=t.prototype,r=MS(arguments,1),n=function(){var i=xS(r,MS(arguments));return this instanceof n?BS(t,i.length,i):t.apply(e,i)};return NS(i)&&(n.prototype=i),n},GS=jS;jr({target:"Function",proto:!0,forced:Function.bind!==GS},{bind:GS});var HS=my;function zS(e,t){var i=e&&e.navigator;if(i.mediaDevices){var r=function(e){if("object"!==vs(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(i){if("require"!==i&&"advanced"!==i&&"mediaSource"!==i){var r="object"===vs(e[i])?e[i]:{ideal:e[i]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var o={};"number"==typeof r.ideal?(o[n("min",i)]=r.ideal,t.optional.push(o),(o={})[n("max",i)]=r.ideal,t.optional.push(o)):(o[n("",i)]=r.ideal,t.optional.push(o))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",i)]=r.exact):["min","max"].forEach((function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,i)]=r[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===vs(e.audio)){var o=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"===vs(e.video)){var a=e.video.facingMode;a=a&&("object"===vs(a)?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!i.mediaDevices.getSupportedConstraints||!i.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return i.mediaDevices.enumerateDevices().then((function(t){var i=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return s.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!i&&t.length&&s.includes("back")&&(i=t[t.length-1]),i&&(e.video.deviceId=a.exact?{exact:i.deviceId}:{ideal:i.deviceId}),e.video=r(e.video),HS("chrome: "+JSON.stringify(e)),n(e)}));e.video=r(e.video)}return HS("chrome: "+JSON.stringify(e)),n(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(i.getUserMedia=function(e,t,r){n(e,(function(e){i.webkitGetUserMedia(e,t,(function(e){r&&r(o(e))}))}))}.bind(i),i.mediaDevices.getUserMedia){var a=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(e){return n(e,(function(e){return a(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(o(e))}))}))}}}}function KS(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function WS(e){if("object"===vs(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var i=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find((function(e){return e.track&&e.track.id===r.track.id})):{track:r.track};var o=new Event("track");o.track=r.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[t.stream],i.dispatchEvent(o)})),t.stream.getTracks().forEach((function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?i.getReceivers().find((function(e){return e.track&&e.track.id===r.id})):{track:r};var o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=[t.stream],i.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else fy(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function qS(e){if("object"===vs(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var n=i.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};var r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var i=this;this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((function(e){i._senders.push(t(i,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var i=t._senders.find((function(t){return t.track===e}));i&&t._senders.splice(t._senders.indexOf(i),1)}))}}else if("object"===vs(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function XS(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,i=Array.prototype.slice.call(arguments),r=i[0],n=i[1],o=i[2];if(arguments.length>0&&"function"==typeof r)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof r))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var i={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){i[t]=e.stat(t)})),t[i.id]=i})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){n(s(a(e)))};return t.apply(this,[c,r])}return new Promise((function(i,r){t.apply(e,[function(e){i(s(a(e)))},r])})).then(n,o)}}}function YS(e){if("object"===vs(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return Iy(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var r=e.RTCPeerConnection.prototype.getReceivers;r&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=r.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),fy(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return Iy(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,i,r,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?r=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(i?r=!0:i=e),e.track===o})),r||t&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return n.apply(this,arguments)}}}}function JS(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){if(!i)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var r=t.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(r)&&this._shimmedLocalStreams[i.id].push(r):this._shimmedLocalStreams[i.id]=[i,r],r};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var r=this.getSenders();i.apply(this,arguments);var n=this.getSenders().filter((function(e){return-1===r.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(n)};var r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(i){var r=t._shimmedLocalStreams[i].indexOf(e);-1!==r&&t._shimmedLocalStreams[i].splice(r,1),1===t._shimmedLocalStreams[i].length&&delete t._shimmedLocalStreams[i]})),n.apply(this,arguments)}}function QS(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return JS(e);var i=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=i.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var i=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(i.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,i){var r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[i.id];if(a)a.addTrack(t),Promise.resolve().then((function(){r.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[i.id]=s,this._reverseStreams[s.id]=i,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=sv({},t,(function(){var e=this,t=arguments,r=arguments.length&&"function"==typeof arguments[0];return r?i.apply(this,[function(i){var r=s(e,i);t[0].apply(null,[r])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):i.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=r[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,i=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(r){i._streams[r].getTracks().find((function(t){return e.track===t}))&&(t=i._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(n.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:i})}function c(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(r.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:i})}}function ZS(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=sv({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}))}function $S(e,t){fy(e,"negotiationneeded",(function(e){var i=e.target;if(!(t.version<72||i.getConfiguration&&"plan-b"===i.getConfiguration().sdpSemantics)||"stable"===i.signalingState)return e}))}var eE=Object.freeze({__proto__:null,shimMediaStream:KS,shimOnTrack:WS,shimGetSendersWithDtmf:qS,shimGetStats:XS,shimSenderReceiverGetStats:YS,shimAddTrackRemoveTrackWithNative:JS,shimAddTrackRemoveTrack:QS,shimPeerConnection:ZS,fixNegotiationNeeded:$S,shimGetUserMedia:zS,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then((function(t){var r=i.video&&i.video.width,n=i.video&&i.video.height,o=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(i.video.mandatory.maxWidth=r),n&&(i.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(i)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),tE=n,iE=a,rE=Go,nE=Rv.trim,oE=T("".charAt),aE=tE.parseFloat,sE=tE.Symbol,cE=sE&&sE.iterator,uE=1/aE("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||cE&&!iE((function(){aE(Object(cE))}))?function(e){var t=nE(rE(e)),i=aE(t);return 0===i&&"-"==oE(t,0)?-0:i}:aE;jr({global:!0,forced:parseFloat!=uE},{parseFloat:uE});var dE=jr,lE=zu,hE=a,pE=W,fE=B,_E=Zd,vE=sh,mE=zt.exports;if(dE({target:"Promise",proto:!0,real:!0,forced:!!lE&&hE((function(){lE.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=_E(this,pE("Promise")),i=fE(e);return this.then(i?function(i){return vE(t,e()).then((function(){return i}))}:e,i?function(i){return vE(t,e()).then((function(){throw i}))}:e)}}),fE(lE)){var yE=pE("Promise").prototype.finally;lE.prototype.finally!==yE&&mE(lE.prototype,"finally",yE,{unsafe:!0})}function gE(e,t){var i=e&&e.navigator,r=e&&e.MediaStreamTrack;if(i.getUserMedia=function(e,t,r){yy("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){var n=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])},o=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(e){return"object"===vs(e)&&"object"===vs(e.audio)&&(e=JSON.parse(JSON.stringify(e)),n(e.audio,"autoGainControl","mozAutoGainControl"),n(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},r&&r.prototype.getSettings){var a=r.prototype.getSettings;r.prototype.getSettings=function(){var e=a.apply(this,arguments);return n(e,"mozAutoGainControl","autoGainControl"),n(e,"mozNoiseSuppression","noiseSuppression"),e}}if(r&&r.prototype.applyConstraints){var s=r.prototype.applyConstraints;r.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===vs(e)&&(e=JSON.parse(JSON.stringify(e)),n(e,"autoGainControl","mozAutoGainControl"),n(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function SE(e){"object"===vs(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function EE(e,t){if("object"===vs(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=sv({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}));var i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),n=e[0],o=e[1],a=e[2];return r.apply(this,[n||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=i[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,r){e.set(r,Object.assign({},t,{type:i[t.type]||t.type}))}))}return e})).then(o,a)}}}function bE(e){if("object"===vs(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function IE(e){if("object"===vs(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,i=t.apply(this,[]);return i.forEach((function(t){return t._pc=e})),i}),fy(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function TE(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;yy("removeStream","removeTrack"),this.getSenders().forEach((function(i){i.track&&e.getTracks().includes(i.track)&&t.removeTrack(i)}))})}function AE(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function RE(e){if("object"===vs(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],i=e&&"sendEncodings"in e;i&&e.sendEncodings.forEach((function(e){if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var r=t.apply(this,arguments);if(i){var n=r.sender,o=n.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,n.sendEncodings=e.sendEncodings,this.setParametersPromises.push(n.setParameters(o).then((function(){delete n.sendEncodings})).catch((function(){delete n.sendEncodings}))))}return r})}}function CE(e){if("object"===vs(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function OE(e){if("object"===vs(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,i=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(i,e)})).finally((function(){i.setParametersPromises=[]})):t.apply(this,arguments)}}}function wE(e){if("object"===vs(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,i=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(i,e)})).finally((function(){i.setParametersPromises=[]})):t.apply(this,arguments)}}}var kE=Object.freeze({__proto__:null,shimOnTrack:SE,shimPeerConnection:EE,shimSenderGetStats:bE,shimReceiverGetStats:IE,shimRemoveStream:TE,shimRTCDataChannel:AE,shimAddTransceiver:RE,shimGetParameters:CE,shimCreateOffer:OE,shimCreateAnswer:wE,shimGetUserMedia:gE,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(i){if(!i||!i.video){var r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return!0===i.video?i.video={mediaSource:t}:i.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(i)})}});function PE(e){if("object"===vs(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return t.call(i,r,e)})),e.getVideoTracks().forEach((function(r){return t.call(i,r,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var i=this,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n&&n.forEach((function(e){i._localStreams?i._localStreams.includes(e)||i._localStreams.push(e):i._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var i=this._localStreams.indexOf(e);if(-1!==i){this._localStreams.splice(i,1);var r=e.getTracks();this.getSenders().forEach((function(e){r.includes(e.track)&&t.removeTrack(e)}))}})}}function NE(e){if("object"===vs(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var i=new Event("addstream");i.stream=e,t.dispatchEvent(i)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var i=new Event("addstream");i.stream=t,e.dispatchEvent(i)}}))}),t.apply(e,arguments)}}}function DE(e){if("object"===vs(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,i=t.createOffer,r=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n};var s=function(e,t,i){var r=n.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,i){var r=o.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,i){var r=a.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},t.addIceCandidate=s}}function ME(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var i=t.mediaDevices,r=i.getUserMedia.bind(i);t.mediaDevices.getUserMedia=function(e){return r(LE(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,i,r){t.mediaDevices.getUserMedia(e).then(i,r)}.bind(t))}function LE(e){return e&&void 0!==e.video?Object.assign({},e,{video:Ey(e.video)}):e}function UE(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,i){if(e&&e.iceServers){for(var r=[],n=0;n<e.iceServers.length;n++){var o=e.iceServers[n];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(yy("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,r.push(o)):r.push(e.iceServers[n])}e.iceServers=r}return new t(e,i)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function xE(e){"object"===vs(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function VE(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveAudio||i||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var r=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function FE(e){"object"!==vs(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var BE=Object.freeze({__proto__:null,shimLocalStreamsAPI:PE,shimRemoteStreamsAPI:NE,shimCallbacksAPI:DE,shimGetUserMedia:ME,shimConstraints:LE,shimRTCIceServerUrls:UE,shimTrackEventTransceiver:xE,shimCreateOfferLegacy:VE,shimAudioContext:FE}),jE=De,GE=st;jr({target:"Date",proto:!0,forced:a((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=jE(this),i=GE(t,"number");return"number"!=typeof i||isFinite(i)?t.toISOString():null}});var HE=l;jr({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return HE(URL.prototype.toString,this)}});var zE=T(1..valueOf),KE=s,WE=n,qE=T,XE=Dr,YE=zt.exports,JE=Ue,QE=lm,ZE=q,$E=le,eb=st,tb=a,ib=Bi.f,rb=o.f,nb=Rt.f,ob=zE,ab=Rv.trim,sb=WE.Number,cb=sb.prototype,ub=WE.TypeError,db=qE("".slice),lb=qE("".charCodeAt),hb=function(e){var t=eb(e,"number");return"bigint"==typeof t?t:pb(t)},pb=function(e){var t,i,r,n,o,a,s,c,u=eb(e,"number");if($E(u))throw ub("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=ab(u),43===(t=lb(u,0))||45===t){if(88===(i=lb(u,2))||120===i)return NaN}else if(48===t){switch(lb(u,1)){case 66:case 98:r=2,n=49;break;case 79:case 111:r=8,n=55;break;default:return+u}for(a=(o=db(u,2)).length,s=0;s<a;s++)if((c=lb(o,s))<48||c>n)return NaN;return parseInt(o,r)}return+u};if(XE("Number",!sb(" 0o1")||!sb("0b1")||sb("+0x1"))){for(var fb,_b=function(e){var t=arguments.length<1?0:sb(hb(e)),i=this;return ZE(cb,i)&&tb((function(){ob(i)}))?QE(Object(t),i,_b):t},vb=KE?ib(sb):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),mb=0;vb.length>mb;mb++)JE(sb,fb=vb[mb])&&!JE(_b,fb)&&nb(_b,fb,rb(sb,fb));_b.prototype=cb,cb.constructor=_b,YE(WE,"Number",_b)}var yb=jr,gb=M,Sb=F,Eb=Un,bb=T([].join),Ib=gb!=Object,Tb=Eb("join",",");yb({target:"Array",proto:!0,forced:Ib||!Tb},{join:function(e){return bb(Sb(this),void 0===e?",":e)}});var Ab=Hs,Rb=l,Cb=T,Ob=Fa,wb=Uo,kb=Nt,Pb=U,Nb=Zd,Db=uv,Mb=Ji,Lb=Go,Ub=ge,xb=ec,Vb=qa,Fb=ka,Bb=a,jb=ra.UNSUPPORTED_Y,Gb=Math.min,Hb=[].push,zb=Cb(/./.exec),Kb=Cb(Hb),Wb=Cb("".slice);Ob("split",(function(e,t,i){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,i){var r=Lb(Pb(this)),n=void 0===i?4294967295:i>>>0;if(0===n)return[];if(void 0===e)return[r];if(!wb(e))return Rb(t,r,e,n);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=Rb(Fb,l,r))&&!((a=l.lastIndex)>d&&(Kb(c,Wb(r,d,o.index)),o.length>1&&o.index<r.length&&Ab(Hb,c,xb(o,1)),s=o[0].length,d=a,c.length>=n));)l.lastIndex===o.index&&l.lastIndex++;return d===r.length?!s&&zb(l,"")||Kb(c,""):Kb(c,Wb(r,d)),c.length>n?xb(c,0,n):c}:"0".split(void 0,0).length?function(e,i){return void 0===e&&0===i?[]:Rb(t,this,e,i)}:t,[function(t,i){var n=Pb(this),o=null==t?void 0:Ub(t,e);return o?Rb(o,t,n,i):Rb(r,Lb(n),t,i)},function(e,n){var o=kb(this),a=Lb(e),s=i(r,o,a,n,r!==t);if(s.done)return s.value;var c=Nb(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(jb?"g":"y"),l=new c(jb?"^(?:"+o.source+")":o,d),h=void 0===n?4294967295:n>>>0;if(0===h)return[];if(0===a.length)return null===Vb(l,a)?[a]:[];for(var p=0,f=0,_=[];f<a.length;){l.lastIndex=jb?0:f;var v,m=Vb(l,jb?Wb(a,f):a);if(null===m||(v=Gb(Mb(l.lastIndex+(jb?f:0)),a.length))===p)f=Db(a,f,u);else{if(Kb(_,Wb(a,p,f)),_.length===h)return _;for(var y=1;y<=m.length-1;y++)if(Kb(_,m[y]),_.length===h)return _;f=p=v}}return Kb(_,Wb(a,p)),_}]}),!!Bb((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var i="ab".split(e);return 2!==i.length||"a"!==i[0]||"b"!==i[1]})),jb);var qb=wi.PROPER,Xb=a,Yb=yv,Jb=Rv.trim;jr({target:"String",proto:!0,forced:function(e){return Xb((function(){return!!Yb[e]()||"
"!=="
"[e]()||qb&&Yb[e].name!==e}))}("trim")},{trim:function(){return Jb(this)}});var Qb={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var i=t.splitSections(e);return i&&i[0]},t.getMediaSections=function(e){var i=t.splitSections(e);return i.shift(),i},t.matchPrefix=function(e,i){return t.splitLines(e).filter((function(e){return 0===e.indexOf(i)}))},t.parseCandidate=function(e){for(var t,i={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":i.relatedAddress=t[r+1];break;case"rport":i.relatedPort=parseInt(t[r+1],10);break;case"tcptype":i.tcpType=t[r+1];break;case"ufrag":i.ufrag=t[r+1],i.usernameFragment=t[r+1];break;default:void 0===i[t[r]]&&(i[t[r]]=t[r+1])}return i},t.writeCandidate=function(e){var t=[];t.push(e.foundation);var i=e.component;"rtp"===i?t.push(1):"rtcp"===i?t.push(2):t.push(i),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),i={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),i.name=t[0],i.clockRate=parseInt(t[1],10),i.channels=3===t.length?parseInt(t[2],10):1,i.numChannels=i.channels,i},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var i=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==i?"/"+i:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,i={},r=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<r.length;n++)i[(t=r[n].trim().split("="))[0].trim()]=t[1];return i},t.writeFmtp=function(e){var t="",i=e.payloadType;if(void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+i+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",i=e.payloadType;return void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+i+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),i={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(i.attribute=e.substr(t+1,r-t-1),i.value=e.substr(r+1)):i.attribute=e.substr(t+1),i},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var i=t.matchPrefix(e,"a=mid:")[0];if(i)return i.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,i){return{role:"auto",fingerprints:t.matchPrefix(e+i,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var i="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){i+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),i},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===vs(e.keyParams)?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,i){return t.matchPrefix(e+i,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,i){var r=t.matchPrefix(e+i,"a=ice-ufrag:")[0],n=t.matchPrefix(e+i,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},t.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){for(var i={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var o=r[n],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),i.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":i.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){i.headerExtensions.push(t.parseExtmap(e))})),i},t.writeRtpDescription=function(e,i){var r="";r+="m="+e+" ",r+=i.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=i.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",i.codecs.forEach((function(e){r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));var n=0;return i.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(r+="a=maxptime:"+n+"\r\n"),i.headerExtensions&&i.headerExtensions.forEach((function(e){r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){var i,r=[],n=t.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(i=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&i&&(t.rtx={ssrc:i}),r.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&c&&r.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){var i={},r=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(i.cname=r.value,i.ssrc=r.ssrc);var n=t.matchPrefix(e,"a=rtcp-rsize");i.reducedSize=n.length>0,i.compound=0===n.length;var o=t.matchPrefix(e,"a=rtcp-mux");return i.mux=o.length>0,i},t.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){var i,r=t.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(i=r[0].substr(7).split(" "))[0],track:i[1]};var n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(i=n[0].value.split(" "))[0],track:i[1]}:void 0},t.parseSctpDescription=function(e){var i,r=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");n.length>0&&(i=parseInt(n[0].substr(19),10)),isNaN(i)&&(i=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:r.fmt,maxMessageSize:i};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:i}}},t.writeSctpDescription=function(e,t){var i=[];return i="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&i.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),i.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,i,r){var n=void 0!==i?i:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,i){for(var r=t.splitLines(e),n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].substr(2)}return i?t.getDirection(i):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var i=t.splitLines(e)[0].substr(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},t.parseOLine=function(e){var i=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var i=t.splitLines(e),r=0;r<i.length;r++)if(i[r].length<2||"="!==i[r].charAt(1))return!1;return!0},e.exports=t}(Qb);var Zb=Qb.exports,$b=Object.freeze(e({__proto__:null,default:Zb},[Qb.exports]));function eI(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===vs(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var i=new t(e),r=Zb.parseCandidate(e.candidate),n=Object.assign(i,r);return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,fy(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function tI(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var i=function(e){if(!e||!e.sdp)return!1;var t=Zb.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=Zb.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},r=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var i=parseInt(t[1],10);return i!=i?-1:i},n=function(e){var i=65536;return"firefox"===t.browser&&(i=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),i},o=function(e,i){var r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);var n=Zb.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?r=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==i&&(r=2147483637),r},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(i(arguments[0])){var c,u=r(arguments[0]),d=n(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function iI(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return i(e,this),e},fy(e,"datachannel",(function(e){return i(e.channel,e.target),e}))}function i(e,t){var i=e.send;e.send=function(){var r=arguments[0],n=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return i.apply(e,arguments)}}}function rI(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var i=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var i=new Event("connectionstatechange",e);t.dispatchEvent(i)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}}))}}function nI(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var r=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return i.apply(this,arguments)}}}function oI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.addIceCandidate;i&&0!==i.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function aI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.setLocalDescription;i&&0!==i.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==vs(t)||t.type&&t.sdp)return i.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return i.apply(this,[t]);var r="offer"===t.type?this.createOffer:this.createAnswer;return r.apply(this).then((function(t){return i.apply(e,[t])}))})}}var sI=Object.freeze({__proto__:null,shimRTCIceCandidate:eI,shimMaxMessageSize:tI,shimSendThrowTypeError:iI,shimConnectionState:rI,removeExtmapAllowMixed:nI,shimAddIceCandidateNullOrEmpty:oI,shimParameterlessSetLocalDescription:aI});function cI(e,t,i,r,n,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(r,n)}function uI(e){return function(){var t=this,i=arguments;return new Promise((function(r,n){var o=e.apply(t,i);function a(e){cI(o,r,n,a,s,"next",e)}function s(e){cI(o,r,n,a,s,"throw",e)}a(void 0)}))}}!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},r=my,n=gy(t),o={browserDetails:n,commonShim:sI,extractVersion:py,disableLog:_y,disableWarnings:vy,sdp:$b};switch(n.browser){case"chrome":if(!eE||!ZS||!i.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=eE,oI(t,n),aI(t),zS(t,n),KS(t),ZS(t,n),WS(t),QS(t,n),qS(t),XS(t),YS(t),$S(t,n),eI(t),rI(t),tI(t,n),iI(t),nI(t,n);break;case"firefox":if(!kE||!EE||!i.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=kE,oI(t,n),aI(t),gE(t,n),EE(t,n),SE(t),TE(t),bE(t),IE(t),AE(t),RE(t),CE(t),OE(t),wE(t),eI(t),rI(t),tI(t,n),iI(t);break;case"safari":if(!BE||!i.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=BE,oI(t,n),aI(t),UE(t),VE(t),DE(t),PE(t),NE(t),xE(t),ME(t),FE(t),eI(t),tI(t,n),iI(t),nI(t,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),pc("toStringTag"),mc(n.JSON,"JSON",!0),mc(Math,"Math",!0);var dI=De,lI=Zp,hI=Hp;jr({target:"Object",stat:!0,forced:a((function(){lI(1)})),sham:!hI},{getPrototypeOf:function(e){return lI(dI(e))}});var pI=jr,fI=qr,_I=T([].reverse),vI=[1,2];pI({target:"Array",proto:!0,forced:String(vI)===String(vI.reverse())},{reverse:function(){return fI(this)&&(this.length=this.length),_I(this)}}),jr({global:!0},{globalThis:n});var mI={exports:{}};!function(e){var t=function(e){var t,i=Object.prototype,r=i.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function c(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,i){return e[t]=i}}function u(e,t,i,r){var n=t&&t.prototype instanceof v?t:v,o=Object.create(n.prototype),a=new O(r||[]);return o._invoke=function(e,t,i){var r=l;return function(n,o){if(r===p)throw new Error("Generator is already running");if(r===f){if("throw"===n)throw o;return k()}for(i.method=n,i.arg=o;;){var a=i.delegate;if(a){var s=A(a,i);if(s){if(s===_)continue;return s}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===l)throw r=f,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=p;var c=d(e,t,i);if("normal"===c.type){if(r=i.done?f:h,c.arg===_)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(r=f,i.method="throw",i.arg=c.arg)}}}(e,i,a),o}function d(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l="suspendedStart",h="suspendedYield",p="executing",f="completed",_={};function v(){}function m(){}function y(){}var g={};c(g,o,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(w([])));E&&E!==i&&r.call(E,o)&&(g=E);var b=y.prototype=v.prototype=Object.create(g);function I(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function i(n,o,a,s){var c=d(e[n],e,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"===vs(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return i("throw",e,a,s)}))}s(c.arg)}var n;this._invoke=function(e,r){function o(){return new t((function(t,n){i(e,r,t,n)}))}return n=n?n.then(o,o):o()}}function A(e,i){var r=e.iterator[i.method];if(r===t){if(i.delegate=null,"throw"===i.method){if(e.iterator.return&&(i.method="return",i.arg=t,A(e,i),"throw"===i.method))return _;i.method="throw",i.arg=new TypeError("The iterator does not provide a 'throw' method")}return _}var n=d(r,e.iterator,i.arg);if("throw"===n.type)return i.method="throw",i.arg=n.arg,i.delegate=null,_;var o=n.arg;return o?o.done?(i[e.resultName]=o.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=t),i.delegate=null,_):o:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,_)}function R(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(R,this),this.reset(!0)}function w(e){if(e){var i=e[o];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function i(){for(;++n<e.length;)if(r.call(e,n))return i.value=e[n],i.done=!1,i;return i.value=t,i.done=!0,i};return a.next=a}}return{next:k}}function k(){return{value:t,done:!0}}return m.prototype=y,c(b,"constructor",y),c(y,"constructor",m),m.displayName=c(y,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,c(e,s,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},I(T.prototype),c(T.prototype,a,(function(){return this})),e.AsyncIterator=T,e.async=function(t,i,r,n,o){void 0===o&&(o=Promise);var a=new T(u(t,i,r,n),o);return e.isGeneratorFunction(i)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},I(b),c(b,s,"Generator"),c(b,o,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var i in e)t.push(i);return t.reverse(),function i(){for(;t.length;){var r=t.pop();if(r in e)return i.value=r,i.done=!1,i}return i.done=!0,i}},e.values=w,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var i in this)"t"===i.charAt(0)&&r.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var i=this;function n(r,n){return s.type="throw",s.arg=e,i.next=r,n&&(i.method="next",i.arg=t),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,_):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),C(i),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var r=i.completion;if("throw"===r.type){var n=r.arg;C(i)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,i,r){return this.delegate={iterator:w(e),resultName:i,nextLoc:r},"next"===this.method&&(this.arg=t),_}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":vs(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(mI);var yI=mI.exports,gI=jr,SI=n,EI=Hs,bI=B,II=ac,TI=el,AI=/MSIE .\./.test(X),RI=SI.Function,CI=function(e){return function(t,i){var r=TI(arguments.length,1)>2,n=bI(t)?t:RI(t),o=r?II(arguments,2):void 0;return e(r?function(){EI(n,this,o)}:n,i)}};gI({global:!0,bind:!0,forced:AI},{setTimeout:CI(SI.setTimeout),setInterval:CI(SI.setInterval)});var OI=Nt,wI=Ed,kI=Kr,PI=l,NI=De,DI=function(e,t,i,r){try{return r?t(OI(i)[0],i[1]):t(i)}catch(t){wI(e,"throw",t)}},MI=od,LI=yn,UI=Zi,xI=Xs,VI=md,FI=dd,BI=n.Array,jI=function(e){var t=NI(e),i=LI(this),r=arguments.length,n=r>1?arguments[1]:void 0,o=void 0!==n;o&&(n=kI(n,r>2?arguments[2]:void 0));var a,s,c,u,d,l,h=FI(t),p=0;if(!h||this==BI&&MI(h))for(a=UI(t),s=i?new this(a):BI(a);a>p;p++)l=o?n(t[p],p):t[p],xI(s,p,l);else for(d=(u=VI(t,h)).next,s=i?new this:[];!(c=PI(d,u)).done;p++)l=o?DI(u,n,[c.value,p],!0):c.value,xI(s,p,l);return s.length=p,s},GI=jI;jr({target:"Array",stat:!0,forced:!zd((function(e){Array.from(e)}))},{from:GI});var HI=a,zI=Ze("iterator"),KI=!HI((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[zI]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==i||"x"!==new URL("http://x",void 0).host})),WI=T,qI=/[^\0-\u007E]/,XI=/[.\u3002\uFF0E\uFF61]/g,YI="Overflow: input needs wider integers to process",JI=n.RangeError,QI=WI(XI.exec),ZI=Math.floor,$I=String.fromCharCode,eT=WI("".charCodeAt),tT=WI([].join),iT=WI([].push),rT=WI("".replace),nT=WI("".split),oT=WI("".toLowerCase),aT=function(e){return e+22+75*(e<26)},sT=function(e,t,i){var r=0;for(e=i?ZI(e/700):e>>1,e+=ZI(e/t);e>455;)e=ZI(e/35),r+=36;return ZI(r+36*e/(e+38))},cT=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var n=eT(e,i++);if(n>=55296&&n<=56319&&i<r){var o=eT(e,i++);56320==(64512&o)?iT(t,((1023&n)<<10)+(1023&o)+65536):(iT(t,n),i--)}else iT(t,n)}return t}(e);var i,r,n=e.length,o=128,a=0,s=72;for(i=0;i<e.length;i++)(r=e[i])<128&&iT(t,$I(r));var c=t.length,u=c;for(c&&iT(t,"-");u<n;){var d=2147483647;for(i=0;i<e.length;i++)(r=e[i])>=o&&r<d&&(d=r);var l=u+1;if(d-o>ZI((2147483647-a)/l))throw JI(YI);for(a+=(d-o)*l,o=d,i=0;i<e.length;i++){if((r=e[i])<o&&++a>2147483647)throw JI(YI);if(r==o){for(var h=a,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var _=h-f,v=36-f;iT(t,$I(aT(f+_%v))),h=ZI(_/v),p+=36}iT(t,$I(aT(h))),s=sT(a,l,u==c),a=0,u++}}a++,o++}return tT(t,"")},uT=ec,dT=Math.floor,lT=function(e,t){var i=e.length,r=dT(i/2);return i<8?hT(e,t):pT(e,lT(uT(e,0,r),t),lT(uT(e,r),t),t)},hT=function(e,t){for(var i,r,n=e.length,o=1;o<n;){for(r=o,i=e[o];r&&t(e[r-1],i)>0;)e[r]=e[--r];r!==o++&&(e[r]=i)}return e},pT=function(e,t,i,r){for(var n=t.length,o=i.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?r(t[a],i[s])<=0?t[a++]:i[s++]:a<n?t[a++]:i[s++];return e},fT=lT,_T=jr,vT=n,mT=W,yT=l,gT=T,ST=KI,ET=zt.exports,bT=Wu,IT=mc,TT=ff,AT=Ii,RT=ed,CT=B,OT=Ue,wT=Kr,kT=nn,PT=Nt,NT=G,DT=Go,MT=Ao,LT=y,UT=md,xT=dd,VT=el,FT=fT,BT=Ze("iterator"),jT=AT.set,GT=AT.getterFor("URLSearchParams"),HT=AT.getterFor("URLSearchParamsIterator"),zT=mT("fetch"),KT=mT("Request"),WT=mT("Headers"),qT=KT&&KT.prototype,XT=WT&&WT.prototype,YT=vT.RegExp,JT=vT.TypeError,QT=vT.decodeURIComponent,ZT=vT.encodeURIComponent,$T=gT("".charAt),eA=gT([].join),tA=gT([].push),iA=gT("".replace),rA=gT([].shift),nA=gT([].splice),oA=gT("".split),aA=gT("".slice),sA=/\+/g,cA=Array(4),uA=function(e){return cA[e-1]||(cA[e-1]=YT("((?:%[\\da-f]{2}){"+e+"})","gi"))},dA=function(e){try{return QT(e)}catch(t){return e}},lA=function(e){var t=iA(e,sA," "),i=4;try{return QT(t)}catch(e){for(;i;)t=iA(t,uA(i--),dA);return t}},hA=/[!'()~]|%20/g,pA={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},fA=function(e){return pA[e]},_A=function(e){return iA(ZT(e),hA,fA)},vA=TT((function(e,t){jT(this,{type:"URLSearchParamsIterator",iterator:UT(GT(e).entries),kind:t})}),"Iterator",(function(){var e=HT(this),t=e.kind,i=e.iterator.next(),r=i.value;return i.done||(i.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),i}),!0),mA=function(e){this.entries=[],this.url=null,void 0!==e&&(NT(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===$T(e,0)?aA(e,1):e:DT(e)))};mA.prototype={type:"URLSearchParams",bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,n,o,a,s,c=xT(e);if(c)for(i=(t=UT(e,c)).next;!(r=yT(i,t)).done;){if(o=(n=UT(PT(r.value))).next,(a=yT(o,n)).done||(s=yT(o,n)).done||!yT(o,n).done)throw JT("Expected sequence with length 2");tA(this.entries,{key:DT(a.value),value:DT(s.value)})}else for(var u in e)OT(e,u)&&tA(this.entries,{key:u,value:DT(e[u])})},parseQuery:function(e){if(e)for(var t,i,r=oA(e,"&"),n=0;n<r.length;)(t=r[n++]).length&&(i=oA(t,"="),tA(this.entries,{key:lA(rA(i)),value:lA(eA(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],tA(i,_A(e.key)+"="+_A(e.value));return eA(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var yA=function(){RT(this,gA);var e=arguments.length>0?arguments[0]:void 0;jT(this,new mA(e))},gA=yA.prototype;if(bT(gA,{append:function(e,t){VT(arguments.length,2);var i=GT(this);tA(i.entries,{key:DT(e),value:DT(t)}),i.updateURL()},delete:function(e){VT(arguments.length,1);for(var t=GT(this),i=t.entries,r=DT(e),n=0;n<i.length;)i[n].key===r?nA(i,n,1):n++;t.updateURL()},get:function(e){VT(arguments.length,1);for(var t=GT(this).entries,i=DT(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){VT(arguments.length,1);for(var t=GT(this).entries,i=DT(e),r=[],n=0;n<t.length;n++)t[n].key===i&&tA(r,t[n].value);return r},has:function(e){VT(arguments.length,1);for(var t=GT(this).entries,i=DT(e),r=0;r<t.length;)if(t[r++].key===i)return!0;return!1},set:function(e,t){VT(arguments.length,1);for(var i,r=GT(this),n=r.entries,o=!1,a=DT(e),s=DT(t),c=0;c<n.length;c++)(i=n[c]).key===a&&(o?nA(n,c--,1):(o=!0,i.value=s));o||tA(n,{key:a,value:s}),r.updateURL()},sort:function(){var e=GT(this);FT(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,i=GT(this).entries,r=wT(e,arguments.length>1?arguments[1]:void 0),n=0;n<i.length;)r((t=i[n++]).value,t.key,this)},keys:function(){return new vA(this,"keys")},values:function(){return new vA(this,"values")},entries:function(){return new vA(this,"entries")}},{enumerable:!0}),ET(gA,BT,gA.entries,{name:"entries"}),ET(gA,"toString",(function(){return GT(this).serialize()}),{enumerable:!0}),IT(yA,"URLSearchParams"),_T({global:!0,forced:!ST},{URLSearchParams:yA}),!ST&&CT(WT)){var SA=gT(XT.has),EA=gT(XT.set),bA=function(e){if(NT(e)){var t,i=e.body;if("URLSearchParams"===kT(i))return t=e.headers?new WT(e.headers):new WT,SA(t,"content-type")||EA(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),MT(e,{body:LT(0,DT(i)),headers:LT(0,t)})}return e};if(CT(zT)&&_T({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return zT(e,arguments.length>1?bA(arguments[1]):{})}}),CT(KT)){var IA=function(e){return RT(this,qT),new KT(e,arguments.length>1?bA(arguments[1]):{})};qT.constructor=IA,IA.prototype=qT,_T({global:!0,forced:!0},{Request:IA})}}var TA,AA={URLSearchParams:yA,getState:GT},RA=jr,CA=s,OA=KI,wA=n,kA=Kr,PA=T,NA=to.f,DA=zt.exports,MA=ed,LA=Ue,UA=xs,xA=jI,VA=ec,FA=Zf.codeAt,BA=function(e){var t,i,r=[],n=nT(rT(oT(e),XI,"."),".");for(t=0;t<n.length;t++)i=n[t],iT(r,QI(qI,i)?"xn--"+cT(i):i);return tT(r,".")},jA=Go,GA=mc,HA=el,zA=AA,KA=Ii,WA=KA.set,qA=KA.getterFor("URL"),XA=zA.URLSearchParams,YA=zA.getState,JA=wA.URL,QA=wA.TypeError,ZA=wA.parseInt,$A=Math.floor,eR=Math.pow,tR=PA("".charAt),iR=PA(/./.exec),rR=PA([].join),nR=PA(1..toString),oR=PA([].pop),aR=PA([].push),sR=PA("".replace),cR=PA([].shift),uR=PA("".split),dR=PA("".slice),lR=PA("".toLowerCase),hR=PA([].unshift),pR=/[a-z]/i,fR=/[\d+-.a-z]/i,_R=/\d/,vR=/^0x/i,mR=/^[0-7]+$/,yR=/^\d+$/,gR=/^[\da-f]+$/i,SR=/[\0\t\n\r #%/:<>?@[\\\]^|]/,ER=/[\0\t\n\r #/:<>?@[\\\]^|]/,bR=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,IR=/[\t\n\r]/g,TR=function(e){var t,i,r,n;if("number"==typeof e){for(t=[],i=0;i<4;i++)hR(t,e%256),e=$A(e/256);return rR(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,i=1,r=null,n=0,o=0;o<8;o++)0!==e[o]?(n>i&&(t=r,i=n),r=null,n=0):(null===r&&(r=o),++n);return n>i&&(t=r,i=n),t}(e),i=0;i<8;i++)n&&0===e[i]||(n&&(n=!1),r===i?(t+=i?":":"::",n=!0):(t+=nR(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},AR={},RR=UA({},AR,{" ":1,'"':1,"<":1,">":1,"`":1}),CR=UA({},RR,{"#":1,"?":1,"{":1,"}":1}),OR=UA({},CR,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),wR=function(e,t){var i=FA(e,0);return i>32&&i<127&&!LA(t,e)?e:encodeURIComponent(e)},kR={ftp:21,file:null,http:80,https:443,ws:80,wss:443},PR=function(e,t){var i;return 2==e.length&&iR(pR,tR(e,0))&&(":"==(i=tR(e,1))||!t&&"|"==i)},NR=function(e){var t;return e.length>1&&PR(dR(e,0,2))&&(2==e.length||"/"===(t=tR(e,2))||"\\"===t||"?"===t||"#"===t)},DR=function(e){return"."===e||"%2e"===lR(e)},MR={},LR={},UR={},xR={},VR={},FR={},BR={},jR={},GR={},HR={},zR={},KR={},WR={},qR={},XR={},YR={},JR={},QR={},ZR={},$R={},eC={},tC=function(e,t,i){var r,n,o,a=jA(e);if(t){if(n=this.parse(a))throw QA(n);this.searchParams=null}else{if(void 0!==i&&(r=new tC(i,!0)),n=this.parse(a,null,r))throw QA(n);(o=YA(new XA)).bindURL(this),this.searchParams=o}};tC.prototype={type:"URL",parse:function(e,t,i){var r,n,o,a,s,c=this,u=t||MR,d=0,l="",h=!1,p=!1,f=!1;for(e=jA(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=sR(e,bR,"")),e=sR(e,IR,""),r=xA(e);d<=r.length;){switch(n=r[d],u){case MR:if(!n||!iR(pR,n)){if(t)return"Invalid scheme";u=UR;continue}l+=lR(n),u=LR;break;case LR:if(n&&(iR(fR,n)||"+"==n||"-"==n||"."==n))l+=lR(n);else{if(":"!=n){if(t)return"Invalid scheme";l="",u=UR,d=0;continue}if(t&&(c.isSpecial()!=LA(kR,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&kR[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=qR:c.isSpecial()&&i&&i.scheme==c.scheme?u=xR:c.isSpecial()?u=jR:"/"==r[d+1]?(u=VR,d++):(c.cannotBeABaseURL=!0,aR(c.path,""),u=ZR)}break;case UR:if(!i||i.cannotBeABaseURL&&"#"!=n)return"Invalid scheme";if(i.cannotBeABaseURL&&"#"==n){c.scheme=i.scheme,c.path=VA(i.path),c.query=i.query,c.fragment="",c.cannotBeABaseURL=!0,u=eC;break}u="file"==i.scheme?qR:FR;continue;case xR:if("/"!=n||"/"!=r[d+1]){u=FR;continue}u=GR,d++;break;case VR:if("/"==n){u=HR;break}u=QR;continue;case FR:if(c.scheme=i.scheme,n==TA)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=VA(i.path),c.query=i.query;else if("/"==n||"\\"==n&&c.isSpecial())u=BR;else if("?"==n)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=VA(i.path),c.query="",u=$R;else{if("#"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=VA(i.path),c.path.length--,u=QR;continue}c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=VA(i.path),c.query=i.query,c.fragment="",u=eC}break;case BR:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,u=QR;continue}u=HR}else u=GR;break;case jR:if(u=GR,"/"!=n||"/"!=tR(l,d+1))continue;d++;break;case GR:if("/"!=n&&"\\"!=n){u=HR;continue}break;case HR:if("@"==n){h&&(l="%40"+l),h=!0,o=xA(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||f){var m=wR(v,OR);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(n==TA||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=xA(l).length+1,l="",u=zR}else l+=n;break;case zR:case KR:if(t&&"file"==c.scheme){u=YR;continue}if(":"!=n||p){if(n==TA||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return"Invalid host";if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=JR,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return"Invalid host";if(a=c.parseHost(l))return a;if(l="",u=WR,t==KR)return}break;case WR:if(!iR(_R,n)){if(n==TA||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var y=ZA(l,10);if(y>65535)return"Invalid port";c.port=c.isSpecial()&&y===kR[c.scheme]?null:y,l=""}if(t)return;u=JR;continue}return"Invalid port"}l+=n;break;case qR:if(c.scheme="file","/"==n||"\\"==n)u=XR;else{if(!i||"file"!=i.scheme){u=QR;continue}if(n==TA)c.host=i.host,c.path=VA(i.path),c.query=i.query;else if("?"==n)c.host=i.host,c.path=VA(i.path),c.query="",u=$R;else{if("#"!=n){NR(rR(VA(r,d),""))||(c.host=i.host,c.path=VA(i.path),c.shortenPath()),u=QR;continue}c.host=i.host,c.path=VA(i.path),c.query=i.query,c.fragment="",u=eC}}break;case XR:if("/"==n||"\\"==n){u=YR;break}i&&"file"==i.scheme&&!NR(rR(VA(r,d),""))&&(PR(i.path[0],!0)?aR(c.path,i.path[0]):c.host=i.host),u=QR;continue;case YR:if(n==TA||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&PR(l))u=QR;else if(""==l){if(c.host="",t)return;u=JR}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=JR}continue}l+=n;break;case JR:if(c.isSpecial()){if(u=QR,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=TA&&(u=QR,"/"!=n))continue}else c.fragment="",u=eC;else c.query="",u=$R;break;case QR:if(n==TA||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=lR(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||aR(c.path,"")):DR(l)?"/"==n||"\\"==n&&c.isSpecial()||aR(c.path,""):("file"==c.scheme&&!c.path.length&&PR(l)&&(c.host&&(c.host=""),l=tR(l,0)+":"),aR(c.path,l)),l="","file"==c.scheme&&(n==TA||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)cR(c.path);"?"==n?(c.query="",u=$R):"#"==n&&(c.fragment="",u=eC)}else l+=wR(n,CR);break;case ZR:"?"==n?(c.query="",u=$R):"#"==n?(c.fragment="",u=eC):n!=TA&&(c.path[0]+=wR(n,AR));break;case $R:t||"#"!=n?n!=TA&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":wR(n,AR)):(c.fragment="",u=eC);break;case eC:n!=TA&&(c.fragment+=wR(n,RR))}d++}},parseHost:function(e){var t,i,r;if("["==tR(e,0)){if("]"!=tR(e,e.length-1))return"Invalid host";if(t=function(e){var t,i,r,n,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return tR(e,l)};if(":"==h()){if(":"!=tR(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=i=0;i<4&&iR(gR,h());)t=16*t+ZA(h(),16),l++,i++;if("."==h()){if(0==i)return;if(l-=i,u>6)return;for(r=0;h();){if(n=null,r>0){if(!("."==h()&&r<4))return;l++}if(!iR(_R,h()))return;for(;iR(_R,h());){if(o=ZA(h(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;l++}c[u]=256*c[u]+n,2!=++r&&4!=r||u++}if(4!=r)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(dR(e,1,-1)),!t)return"Invalid host";this.host=t}else if(this.isSpecial()){if(e=BA(e),iR(SR,e))return"Invalid host";if(t=function(e){var t,i,r,n,o,a,s,c=uR(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(i=[],r=0;r<t;r++){if(""==(n=c[r]))return e;if(o=10,n.length>1&&"0"==tR(n,0)&&(o=iR(vR,n)?16:8,n=dR(n,8==o?1:2)),""===n)a=0;else{if(!iR(10==o?yR:8==o?mR:gR,n))return e;a=ZA(n,o)}aR(i,a)}for(r=0;r<t;r++)if(a=i[r],r==t-1){if(a>=eR(256,5-t))return null}else if(a>255)return null;for(s=oR(i),r=0;r<i.length;r++)s+=i[r]*eR(256,3-r);return s}(e),null===t)return"Invalid host";this.host=t}else{if(iR(ER,e))return"Invalid host";for(t="",i=xA(e),r=0;r<i.length;r++)t+=wR(i[r],AR);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return LA(kR,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&PR(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,r=e.password,n=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==n?(u+="//",e.includesCredentials()&&(u+=i+(r?":"+r:"")+"@"),u+=TR(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+rR(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw QA(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new iC(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+TR(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(jA(e)+":",MR)},getUsername:function(){return this.username},setUsername:function(e){var t=xA(jA(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=wR(t[i],OR)}},getPassword:function(){return this.password},setPassword:function(e){var t=xA(jA(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=wR(t[i],OR)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?TR(e):TR(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,zR)},getHostname:function(){var e=this.host;return null===e?"":TR(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,KR)},getPort:function(){var e=this.port;return null===e?"":jA(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=jA(e))?this.port=null:this.parse(e,WR))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+rR(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,JR))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=jA(e))?this.query=null:("?"==tR(e,0)&&(e=dR(e,1)),this.query="",this.parse(e,$R)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=jA(e))?("#"==tR(e,0)&&(e=dR(e,1)),this.fragment="",this.parse(e,eC)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var iC=function(e){var t=MA(this,rC),i=HA(arguments.length,1)>1?arguments[1]:void 0,r=WA(t,new tC(e,!1,i));CA||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},rC=iC.prototype,nC=function(e,t){return{get:function(){return qA(this)[e]()},set:t&&function(e){return qA(this)[t](e)},configurable:!0,enumerable:!0}};if(CA&&NA(rC,{href:nC("serialize","setHref"),origin:nC("getOrigin"),protocol:nC("getProtocol","setProtocol"),username:nC("getUsername","setUsername"),password:nC("getPassword","setPassword"),host:nC("getHost","setHost"),hostname:nC("getHostname","setHostname"),port:nC("getPort","setPort"),pathname:nC("getPathname","setPathname"),search:nC("getSearch","setSearch"),searchParams:nC("getSearchParams"),hash:nC("getHash","setHash")}),DA(rC,"toJSON",(function(){return qA(this).serialize()}),{enumerable:!0}),DA(rC,"toString",(function(){return qA(this).serialize()}),{enumerable:!0}),JA){var oC=JA.createObjectURL,aC=JA.revokeObjectURL;oC&&DA(iC,"createObjectURL",kA(oC,JA)),aC&&DA(iC,"revokeObjectURL",kA(aC,JA))}GA(iC,"URL"),RA({global:!0,forced:!OA,sham:!CA},{URL:iC});var sC=jr,cC=n,uC=l,dC=T,lC=U,hC=B,pC=Uo,fC=Go,_C=ge,vC=Zo,mC=Jy,yC=Ze("replace"),gC=RegExp.prototype,SC=cC.TypeError,EC=dC(vC),bC=dC("".indexOf);dC("".replace);var IC=dC("".slice),TC=Math.max,AC=function(e,t,i){return i>e.length?-1:""===t?i:bC(e,t,i)};sC({target:"String",proto:!0},{replaceAll:function(e,t){var i,r,n,o,a,s,c,u,d=lC(this),l=0,h=0,p="";if(null!=e){if(pC(e)&&(i=fC(lC("flags"in gC?e.flags:EC(e))),!~bC(i,"g")))throw SC("`.replaceAll` does not allow non-global regexes");if(r=_C(e,yC))return uC(r,e,d,t)}for(n=fC(d),o=fC(e),(a=hC(t))||(t=fC(t)),s=o.length,c=TC(1,s),l=AC(n,o,0);-1!==l;)u=a?fC(t(o,l,n)):mC(o,n,l,[],void 0,t),p+=IC(n,h,l)+u,h=l+s,l=AC(n,o,l+c);return h<n.length&&(p+=IC(n,h)),p}});var RC="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,CC=Hi,OC=Ji,wC=n.RangeError,kC=function(e){if(void 0===e)return 0;var t=CC(e),i=OC(t);if(t!==i)throw wC("Wrong length or index");return i},PC=n.Array,NC=Math.abs,DC=Math.pow,MC=Math.floor,LC=Math.log,UC=Math.LN2,xC={pack:function(e,t,i){var r,n,o,a=PC(i),s=8*i-t-1,c=(1<<s)-1,u=c>>1,d=23===t?DC(2,-24)-DC(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=NC(e))!=e||e===1/0?(n=e!=e?1:0,r=c):(r=MC(LC(e)/UC),e*(o=DC(2,-r))<1&&(r--,o*=2),(e+=r+u>=1?d/o:d*DC(2,1-u))*o>=2&&(r++,o/=2),r+u>=c?(n=0,r=c):r+u>=1?(n=(e*o-1)*DC(2,t),r+=u):(n=e*DC(2,u-1)*DC(2,t),r=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(r=r<<t|n,s+=t;s>0;)a[h++]=255&r,r/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var i,r=e.length,n=8*r-t-1,o=(1<<n)-1,a=o>>1,s=n-7,c=r-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(i=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)i=256*i+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return i?NaN:u?-1/0:1/0;i+=DC(2,t),d-=a}return(u?-1:1)*i*DC(2,d-t)}},VC=De,FC=qi,BC=Zi,jC=function(e){for(var t=VC(this),i=BC(t),r=arguments.length,n=FC(r>1?arguments[1]:void 0,i),o=r>2?arguments[2]:void 0,a=void 0===o?i:FC(o,i);a>n;)t[n++]=e;return t},GC=n,HC=T,zC=s,KC=RC,WC=wi,qC=Ht,XC=Wu,YC=a,JC=ed,QC=Hi,ZC=Ji,$C=kC,eO=xC,tO=Zp,iO=Ts,rO=Bi.f,nO=Rt.f,oO=jC,aO=ec,sO=mc,cO=WC.PROPER,uO=WC.CONFIGURABLE,dO=Ii.get,lO=Ii.set,hO=GC.ArrayBuffer,pO=hO,fO=pO&&pO.prototype,_O=GC.DataView,vO=_O&&_O.prototype,mO=Object.prototype,yO=GC.Array,gO=GC.RangeError,SO=HC(oO),EO=HC([].reverse),bO=eO.pack,IO=eO.unpack,TO=function(e){return[255&e]},AO=function(e){return[255&e,e>>8&255]},RO=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},CO=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},OO=function(e){return bO(e,23,4)},wO=function(e){return bO(e,52,8)},kO=function(e,t){nO(e.prototype,t,{get:function(){return dO(this)[t]}})},PO=function(e,t,i,r){var n=$C(i),o=dO(e);if(n+t>o.byteLength)throw gO("Wrong index");var a=dO(o.buffer).bytes,s=n+o.byteOffset,c=aO(a,s,s+t);return r?c:EO(c)},NO=function(e,t,i,r,n,o){var a=$C(i),s=dO(e);if(a+t>s.byteLength)throw gO("Wrong index");for(var c=dO(s.buffer).bytes,u=a+s.byteOffset,d=r(+n),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(KC){var DO=cO&&"ArrayBuffer"!==hO.name;if(YC((function(){hO(1)}))&&YC((function(){new hO(-1)}))&&!YC((function(){return new hO,new hO(1.5),new hO(NaN),DO&&!uO})))DO&&uO&&qC(hO,"name","ArrayBuffer");else{(pO=function(e){return JC(this,fO),new hO($C(e))}).prototype=fO;for(var MO,LO=rO(hO),UO=0;LO.length>UO;)(MO=LO[UO++])in pO||qC(pO,MO,hO[MO]);fO.constructor=pO}iO&&tO(vO)!==mO&&iO(vO,mO);var xO=new _O(new pO(2)),VO=HC(vO.setInt8);xO.setInt8(0,2147483648),xO.setInt8(1,2147483649),!xO.getInt8(0)&&xO.getInt8(1)||XC(vO,{setInt8:function(e,t){VO(this,e,t<<24>>24)},setUint8:function(e,t){VO(this,e,t<<24>>24)}},{unsafe:!0})}else fO=(pO=function(e){JC(this,fO);var t=$C(e);lO(this,{bytes:SO(yO(t),0),byteLength:t}),zC||(this.byteLength=t)}).prototype,vO=(_O=function(e,t,i){JC(this,vO),JC(e,fO);var r=dO(e).byteLength,n=QC(t);if(n<0||n>r)throw gO("Wrong offset");if(n+(i=void 0===i?r-n:ZC(i))>r)throw gO("Wrong length");lO(this,{buffer:e,byteLength:i,byteOffset:n}),zC||(this.buffer=e,this.byteLength=i,this.byteOffset=n)}).prototype,zC&&(kO(pO,"byteLength"),kO(_O,"buffer"),kO(_O,"byteLength"),kO(_O,"byteOffset")),XC(vO,{getInt8:function(e){return PO(this,1,e)[0]<<24>>24},getUint8:function(e){return PO(this,1,e)[0]},getInt16:function(e){var t=PO(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=PO(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return CO(PO(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return CO(PO(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return IO(PO(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return IO(PO(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){NO(this,1,e,TO,t)},setUint8:function(e,t){NO(this,1,e,TO,t)},setInt16:function(e,t){NO(this,2,e,AO,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){NO(this,2,e,AO,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){NO(this,4,e,RO,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){NO(this,4,e,RO,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){NO(this,4,e,OO,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){NO(this,8,e,wO,t,arguments.length>2?arguments[2]:void 0)}});sO(pO,"ArrayBuffer"),sO(_O,"DataView");var FO={ArrayBuffer:pO,DataView:_O},BO=jr,jO=T,GO=a,HO=Nt,zO=qi,KO=Ji,WO=Zd,qO=FO.ArrayBuffer,XO=FO.DataView,YO=XO.prototype,JO=jO(qO.prototype.slice),QO=jO(YO.getUint8),ZO=jO(YO.setUint8);BO({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:GO((function(){return!new qO(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(JO&&void 0===t)return JO(HO(this),e);for(var i=HO(this).byteLength,r=zO(e,i),n=zO(void 0===t?i:t,i),o=new(WO(this,qO))(KO(n-r)),a=new XO(this),s=new XO(o),c=0;r<n;)ZO(s,c++,QO(a,r++));return o}});var $O,ew,tw,iw={exports:{}},rw=RC,nw=s,ow=n,aw=B,sw=G,cw=Ue,uw=nn,dw=pe,lw=Ht,hw=zt.exports,pw=Rt.f,fw=q,_w=Zp,vw=Ts,mw=Ze,yw=je,gw=ow.Int8Array,Sw=gw&&gw.prototype,Ew=ow.Uint8ClampedArray,bw=Ew&&Ew.prototype,Iw=gw&&_w(gw),Tw=Sw&&_w(Sw),Aw=Object.prototype,Rw=ow.TypeError,Cw=mw("toStringTag"),Ow=yw("TYPED_ARRAY_TAG"),ww=yw("TYPED_ARRAY_CONSTRUCTOR"),kw=rw&&!!vw&&"Opera"!==uw(ow.opera),Pw=!1,Nw={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Dw={BigInt64Array:8,BigUint64Array:8},Mw=function(e){if(!sw(e))return!1;var t=uw(e);return cw(Nw,t)||cw(Dw,t)};for($O in Nw)(tw=(ew=ow[$O])&&ew.prototype)?lw(tw,ww,ew):kw=!1;for($O in Dw)(tw=(ew=ow[$O])&&ew.prototype)&&lw(tw,ww,ew);if((!kw||!aw(Iw)||Iw===Function.prototype)&&(Iw=function(){throw Rw("Incorrect invocation")},kw))for($O in Nw)ow[$O]&&vw(ow[$O],Iw);if((!kw||!Tw||Tw===Aw)&&(Tw=Iw.prototype,kw))for($O in Nw)ow[$O]&&vw(ow[$O].prototype,Tw);if(kw&&_w(bw)!==Tw&&vw(bw,Tw),nw&&!cw(Tw,Cw))for($O in Pw=!0,pw(Tw,Cw,{get:function(){return sw(this)?this[Ow]:void 0}}),Nw)ow[$O]&&lw(ow[$O],Ow,$O);var Lw={NATIVE_ARRAY_BUFFER_VIEWS:kw,TYPED_ARRAY_CONSTRUCTOR:ww,TYPED_ARRAY_TAG:Pw&&Ow,aTypedArray:function(e){if(Mw(e))return e;throw Rw("Target is not a typed array")},aTypedArrayConstructor:function(e){if(aw(e)&&(!vw||fw(Iw,e)))return e;throw Rw(dw(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,r){if(nw){if(i)for(var n in Nw){var o=ow[n];if(o&&cw(o.prototype,e))try{delete o.prototype[e]}catch(i){try{o.prototype[e]=t}catch(e){}}}Tw[e]&&!i||hw(Tw,e,i?t:kw&&Sw[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,i){var r,n;if(nw){if(vw){if(i)for(r in Nw)if((n=ow[r])&&cw(n,e))try{delete n[e]}catch(e){}if(Iw[e]&&!i)return;try{return hw(Iw,e,i?t:kw&&Iw[e]||t)}catch(e){}}for(r in Nw)!(n=ow[r])||n[e]&&!i||hw(n,e,t)}},isView:function(e){if(!sw(e))return!1;var t=uw(e);return"DataView"===t||cw(Nw,t)||cw(Dw,t)},isTypedArray:Mw,TypedArray:Iw,TypedArrayPrototype:Tw},Uw=n,xw=a,Vw=zd,Fw=Lw.NATIVE_ARRAY_BUFFER_VIEWS,Bw=Uw.ArrayBuffer,jw=Uw.Int8Array,Gw=!Fw||!xw((function(){jw(1)}))||!xw((function(){new jw(-1)}))||!Vw((function(e){new jw,new jw(null),new jw(1.5),new jw(e)}),!0)||xw((function(){return 1!==new jw(new Bw(2),1,void 0).length})),Hw=G,zw=Math.floor,Kw=Number.isInteger||function(e){return!Hw(e)&&isFinite(e)&&zw(e)===e},Ww=Hi,qw=n.RangeError,Xw=function(e){var t=Ww(e);if(t<0)throw qw("The argument can't be less than 0");return t},Yw=n.RangeError,Jw=function(e,t){var i=Xw(e);if(i%t)throw Yw("Wrong offset");return i},Qw=Kr,Zw=l,$w=Xd,ek=De,tk=Zi,ik=md,rk=dd,nk=od,ok=Lw.aTypedArrayConstructor,ak=jr,sk=n,ck=l,uk=s,dk=Gw,lk=Lw,hk=FO,pk=ed,fk=y,_k=Ht,vk=Kw,mk=Ji,yk=kC,gk=Jw,Sk=dt,Ek=Ue,bk=nn,Ik=G,Tk=le,Ak=Ao,Rk=q,Ck=Ts,Ok=Bi.f,wk=function(e){var t,i,r,n,o,a,s=$w(this),c=ek(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=rk(c);if(h&&!nk(h))for(a=(o=ik(c,h)).next,c=[];!(n=Zw(a,o)).done;)c.push(n.value);for(l&&u>2&&(d=Qw(d,arguments[2])),i=tk(c),r=new(ok(s))(i),t=0;i>t;t++)r[t]=l?d(c[t],t):c[t];return r},kk=Mn.forEach,Pk=Qu,Nk=Rt,Dk=o,Mk=lm,Lk=Ii.get,Uk=Ii.set,xk=Nk.f,Vk=Dk.f,Fk=Math.round,Bk=sk.RangeError,jk=hk.ArrayBuffer,Gk=jk.prototype,Hk=hk.DataView,zk=lk.NATIVE_ARRAY_BUFFER_VIEWS,Kk=lk.TYPED_ARRAY_CONSTRUCTOR,Wk=lk.TYPED_ARRAY_TAG,qk=lk.TypedArray,Xk=lk.TypedArrayPrototype,Yk=lk.aTypedArrayConstructor,Jk=lk.isTypedArray,Qk=function(e,t){Yk(e);for(var i=0,r=t.length,n=new e(r);r>i;)n[i]=t[i++];return n},Zk=function(e,t){xk(e,t,{get:function(){return Lk(this)[t]}})},$k=function(e){var t;return Rk(Gk,e)||"ArrayBuffer"==(t=bk(e))||"SharedArrayBuffer"==t},eP=function(e,t){return Jk(e)&&!Tk(t)&&t in e&&vk(+t)&&t>=0},tP=function(e,t){return t=Sk(t),eP(e,t)?fk(2,e[t]):Vk(e,t)},iP=function(e,t,i){return t=Sk(t),!(eP(e,t)&&Ik(i)&&Ek(i,"value"))||Ek(i,"get")||Ek(i,"set")||i.configurable||Ek(i,"writable")&&!i.writable||Ek(i,"enumerable")&&!i.enumerable?xk(e,t,i):(e[t]=i.value,e)};uk?(zk||(Dk.f=tP,Nk.f=iP,Zk(Xk,"buffer"),Zk(Xk,"byteOffset"),Zk(Xk,"byteLength"),Zk(Xk,"length")),ak({target:"Object",stat:!0,forced:!zk},{getOwnPropertyDescriptor:tP,defineProperty:iP}),iw.exports=function(e,t,i){var r=e.match(/\d+$/)[0]/8,n=e+(i?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=sk[n],c=s,u=c&&c.prototype,d={},l=function(e,t){xk(e,t,{get:function(){return function(e,t){var i=Lk(e);return i.view[o](t*r+i.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=Lk(e);i&&(n=(n=Fk(n))<0?0:n>255?255:255&n),o.view[a](t*r+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};zk?dk&&(c=t((function(e,t,i,n){return pk(e,u),Mk(Ik(t)?$k(t)?void 0!==n?new s(t,gk(i,r),n):void 0!==i?new s(t,gk(i,r)):new s(t):Jk(t)?Qk(c,t):ck(wk,c,t):new s(yk(t)),e,c)})),Ck&&Ck(c,qk),kk(Ok(s),(function(e){e in c||_k(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,i,n){pk(e,u);var o,a,s,d=0,h=0;if(Ik(t)){if(!$k(t))return Jk(t)?Qk(c,t):ck(wk,c,t);o=t,h=gk(i,r);var p=t.byteLength;if(void 0===n){if(p%r)throw Bk("Wrong length");if((a=p-h)<0)throw Bk("Wrong length")}else if((a=mk(n)*r)+h>p)throw Bk("Wrong length");s=a/r}else s=yk(t),o=new jk(a=s*r);for(Uk(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new Hk(o)});d<s;)l(e,d++)})),Ck&&Ck(c,qk),u=c.prototype=Ak(Xk)),u.constructor!==c&&_k(u,"constructor",c),_k(u,Kk,c),Wk&&_k(u,Wk,n),d[n]=c,ak({global:!0,forced:c!=s,sham:!zk},d),"BYTES_PER_ELEMENT"in c||_k(c,"BYTES_PER_ELEMENT",r),"BYTES_PER_ELEMENT"in u||_k(u,"BYTES_PER_ELEMENT",r),Pk(n)}):iw.exports=function(){},(0,iw.exports)("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var rP=De,nP=qi,oP=Zi,aP=Math.min,sP=[].copyWithin||function(e,t){var i=rP(this),r=oP(i),n=nP(e,r),o=nP(t,r),a=arguments.length>2?arguments[2]:void 0,s=aP((void 0===a?r:nP(a,r))-o,r-n),c=1;for(o<n&&n<o+s&&(c=-1,o+=s-1,n+=s-1);s-- >0;)o in i?i[n]=i[o]:delete i[n],n+=c,o+=c;return i},cP=Lw,uP=T(sP),dP=cP.aTypedArray;(0,cP.exportTypedArrayMethod)("copyWithin",(function(e,t){return uP(dP(this),e,t,arguments.length>2?arguments[2]:void 0)}));var lP=Mn.every,hP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("every",(function(e){return lP(hP(this),e,arguments.length>1?arguments[1]:void 0)}));var pP=l,fP=jC,_P=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return pP(fP,_P(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var vP=Zi,mP=Zd,yP=Lw.TYPED_ARRAY_CONSTRUCTOR,gP=Lw.aTypedArrayConstructor,SP=function(e){return gP(mP(e,e[yP]))},EP=function(e,t){for(var i=0,r=vP(t),n=new e(r);r>i;)n[i]=t[i++];return n},bP=SP,IP=Mn.filter,TP=function(e,t){return EP(bP(e),t)},AP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("filter",(function(e){var t=IP(AP(this),e,arguments.length>1?arguments[1]:void 0);return TP(this,t)}));var RP=Mn.find,CP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("find",(function(e){return RP(CP(this),e,arguments.length>1?arguments[1]:void 0)}));var OP=Mn.findIndex,wP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("findIndex",(function(e){return OP(wP(this),e,arguments.length>1?arguments[1]:void 0)}));var kP=Mn.forEach,PP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("forEach",(function(e){kP(PP(this),e,arguments.length>1?arguments[1]:void 0)}));var NP=rr.includes,DP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("includes",(function(e){return NP(DP(this),e,arguments.length>1?arguments[1]:void 0)}));var MP=rr.indexOf,LP=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("indexOf",(function(e){return MP(LP(this),e,arguments.length>1?arguments[1]:void 0)}));var UP=n,xP=a,VP=T,FP=Lw,BP=Gf,jP=Ze("iterator"),GP=UP.Uint8Array,HP=VP(BP.values),zP=VP(BP.keys),KP=VP(BP.entries),WP=FP.aTypedArray,qP=FP.exportTypedArrayMethod,XP=GP&&GP.prototype,YP=!xP((function(){XP[jP].call([1])})),JP=!!XP&&XP.values&&XP[jP]===XP.values&&"values"===XP.values.name,QP=function(){return HP(WP(this))};qP("entries",(function(){return KP(WP(this))}),YP),qP("keys",(function(){return zP(WP(this))}),YP),qP("values",QP,YP||!JP,{name:"values"}),qP(jP,QP,YP||!JP,{name:"values"});var ZP=Lw.aTypedArray,$P=Lw.exportTypedArrayMethod,eN=T([].join);$P("join",(function(e){return eN(ZP(this),e)}));var tN=Hs,iN=F,rN=Hi,nN=Zi,oN=Un,aN=Math.min,sN=[].lastIndexOf,cN=!!sN&&1/[1].lastIndexOf(1,-0)<0,uN=oN("lastIndexOf"),dN=cN||!uN?function(e){if(cN)return tN(sN,this,arguments)||0;var t=iN(this),i=nN(t),r=i-1;for(arguments.length>1&&(r=aN(r,rN(arguments[1]))),r<0&&(r=i+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:sN,lN=Hs,hN=dN,pN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return lN(hN,pN(this),t>1?[e,arguments[1]]:[e])}));var fN=Mn.map,_N=SP,vN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("map",(function(e){return fN(vN(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(_N(e))(t)}))}));var mN=Xm.left,yN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return mN(yN(this),e,t,t>1?arguments[1]:void 0)}));var gN=Xm.right,SN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return gN(SN(this),e,t,t>1?arguments[1]:void 0)}));var EN=Lw.aTypedArray,bN=Lw.exportTypedArrayMethod,IN=Math.floor;bN("reverse",(function(){for(var e,t=this,i=EN(t).length,r=IN(i/2),n=0;n<r;)e=t[n],t[n++]=t[--i],t[i]=e;return t}));var TN=n,AN=l,RN=Lw,CN=Zi,ON=Jw,wN=De,kN=a,PN=TN.RangeError,NN=TN.Int8Array,DN=NN&&NN.prototype,MN=DN&&DN.set,LN=RN.aTypedArray,UN=RN.exportTypedArrayMethod,xN=!kN((function(){var e=new Uint8ClampedArray(2);return AN(MN,e,{length:1,0:3},1),3!==e[1]})),VN=xN&&RN.NATIVE_ARRAY_BUFFER_VIEWS&&kN((function(){var e=new NN(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));UN("set",(function(e){LN(this);var t=ON(arguments.length>1?arguments[1]:void 0,1),i=wN(e);if(xN)return AN(MN,this,i,t);var r=this.length,n=CN(i),o=0;if(n+t>r)throw PN("Wrong length");for(;o<n;)this[t+o]=i[o++]}),!xN||VN);var FN=SP,BN=ac,jN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("slice",(function(e,t){for(var i=BN(jN(this),e,t),r=FN(this),n=0,o=i.length,a=new r(o);o>n;)a[n]=i[n++];return a}),a((function(){new Int8Array(1).slice()})));var GN=Mn.some,HN=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("some",(function(e){return GN(HN(this),e,arguments.length>1?arguments[1]:void 0)}));var zN=X.match(/firefox\/(\d+)/i),KN=!!zN&&+zN[1],WN=/MSIE|Trident/.test(X),qN=X.match(/AppleWebKit\/(\d+)\./),XN=!!qN&&+qN[1],YN=n,JN=T,QN=a,ZN=me,$N=fT,eD=Lw,tD=KN,iD=WN,rD=te,nD=XN,oD=YN.Array,aD=eD.aTypedArray,sD=eD.exportTypedArrayMethod,cD=YN.Uint16Array,uD=cD&&JN(cD.prototype.sort),dD=!(!uD||QN((function(){uD(new cD(2),null)}))&&QN((function(){uD(new cD(2),{})}))),lD=!!uD&&!QN((function(){if(rD)return rD<74;if(tD)return tD<67;if(iD)return!0;if(nD)return nD<602;var e,t,i=new cD(516),r=oD(516);for(e=0;e<516;e++)t=e%4,i[e]=515-e,r[e]=e-2*t+3;for(uD(i,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(i[e]!==r[e])return!0}));sD("sort",(function(e){return void 0!==e&&ZN(e),lD?uD(this,e):$N(aD(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?-1:t!=t?1:0===t&&0===i?1/t>0&&1/i<0?1:-1:t>i}}(e))}),!lD||dD);var hD=Ji,pD=qi,fD=SP,_D=Lw.aTypedArray;(0,Lw.exportTypedArrayMethod)("subarray",(function(e,t){var i=_D(this),r=i.length,n=pD(e,r);return new(fD(i))(i.buffer,i.byteOffset+n*i.BYTES_PER_ELEMENT,hD((void 0===t?r:pD(t,r))-n))}));var vD=Hs,mD=Lw,yD=a,gD=ac,SD=n.Int8Array,ED=mD.aTypedArray,bD=mD.exportTypedArrayMethod,ID=[].toLocaleString,TD=!!SD&&yD((function(){ID.call(new SD(1))}));bD("toLocaleString",(function(){return vD(ID,TD?gD(ED(this)):ED(this),gD(arguments))}),yD((function(){return[1,2].toLocaleString()!=new SD([1,2]).toLocaleString()}))||!yD((function(){SD.prototype.toLocaleString.call([1,2])})));var AD=Lw.exportTypedArrayMethod,RD=a,CD=T,OD=n.Uint8Array,wD=OD&&OD.prototype||{},kD=[].toString,PD=CD([].join);RD((function(){kD.call({})}))&&(kD=function(){return PD(this)});var ND,DD,MD=wD.toString!=kD;AD("toString",kD,MD),jr({target:"Array",stat:!0},{isArray:qr}),function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onLocalCameraStalled="onLocalCameraStalled"}(ND||(ND={})),function(e){e[e.ERR_OK=0]="ERR_OK",e[e.ERR_PARAM_INVALID=1]="ERR_PARAM_INVALID",e[e.ERR_FRAME_TIMEOUT=2]="ERR_FRAME_TIMEOUT",e[e.ERR_POSTPROCESS=3]="ERR_POSTPROCESS",e[e.ERR_PUSH_CDN=4]="ERR_PUSH_CDN",e[e.ERR_UNKNOWN=9999]="ERR_UNKNOWN"}(DD||(DD={}));var LD=s,UD=T,xD=no,VD=F,FD=UD(h.f),BD=UD([].push),jD=function(e){return function(t){for(var i,r=VD(t),n=xD(r),o=n.length,a=0,s=[];o>a;)i=n[a++],LD&&!FD(r,i)||BD(s,e?[i,r[i]]:r[i]);return s}},GD={entries:jD(!0),values:jD(!1)}.entries;jr({target:"Object",stat:!0},{entries:function(e){return GD(e)}});var HD=Hi,zD=Go,KD=U,WD=n.RangeError,qD=function(e){var t=zD(KD(this)),i="",r=HD(e);if(r<0||r==1/0)throw WD("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(i+=t);return i},XD=T,YD=Ji,JD=Go,QD=U,ZD=XD(qD),$D=XD("".slice),eM=Math.ceil,tM=function(e){return function(t,i,r){var n,o,a=JD(QD(t)),s=YD(i),c=a.length,u=void 0===r?" ":JD(r);return s<=c||""==u?a:((o=ZD(u,eM((n=s-c)/u.length))).length>n&&(o=$D(o,0,n)),e?a+o:o+a)}},iM={start:tM(!1),end:tM(!0)},rM=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(X),nM=iM.end;jr({target:"String",proto:!0,forced:rM},{padEnd:function(e){return nM(this,e,arguments.length>1?arguments[1]:void 0)}});var oM=xv;jr({target:"Number",stat:!0,forced:Number.parseInt!=oM},{parseInt:oM});var aM=Qu,sM=FO.ArrayBuffer;jr({global:!0,forced:n.ArrayBuffer!==sM},{ArrayBuffer:sM}),aM("ArrayBuffer");jr({target:"ArrayBuffer",stat:!0,forced:!Lw.NATIVE_ARRAY_BUFFER_VIEWS},{isView:Lw.isView}),jr({global:!0,forced:!RC},{DataView:FO.DataView});var cM=jr,uM=n,dM=T,lM=Hi,hM=zE,pM=qD,fM=a,_M=uM.RangeError,vM=uM.String,mM=Math.floor,yM=dM(pM),gM=dM("".slice),SM=dM(1..toFixed),EM=function(e,t,i){return 0===t?i:t%2==1?EM(e,t-1,i*e):EM(e*e,t/2,i)},bM=function(e,t,i){for(var r=-1,n=i;++r<6;)n+=t*e[r],e[r]=n%1e7,n=mM(n/1e7)},IM=function(e,t){for(var i=6,r=0;--i>=0;)r+=e[i],e[i]=mM(r/t),r=r%t*1e7},TM=function(e){for(var t=6,i="";--t>=0;)if(""!==i||0===t||0!==e[t]){var r=vM(e[t]);i=""===i?r:i+yM("0",7-r.length)+r}return i};cM({target:"Number",proto:!0,forced:fM((function(){return"0.000"!==SM(8e-5,3)||"1"!==SM(.9,0)||"1.25"!==SM(1.255,2)||"1000000000000000128"!==SM(0xde0b6b3a7640080,0)}))||!fM((function(){SM({})}))},{toFixed:function(e){var t,i,r,n,o=hM(this),a=lM(e),s=[0,0,0,0,0,0],c="",u="0";if(a<0||a>20)throw _M("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return vM(o);if(o<0&&(c="-",o=-o),o>1e-21)if(i=(t=function(e){for(var t=0,i=e;i>=4096;)t+=12,i/=4096;for(;i>=2;)t+=1,i/=2;return t}(o*EM(2,69,1))-69)<0?o*EM(2,-t,1):o/EM(2,t,1),i*=4503599627370496,(t=52-t)>0){for(bM(s,0,i),r=a;r>=7;)bM(s,1e7,0),r-=7;for(bM(s,EM(10,r,1),0),r=t-1;r>=23;)IM(s,1<<23),r-=23;IM(s,1<<r),bM(s,1,1),IM(s,2),u=TM(s)}else bM(s,0,i),bM(s,1<<-t,0),u=TM(s)+yM("0",a);return u=a>0?c+((n=u.length)<=a?"0."+yM("0",a-n)+u:gM(u,0,n-a)+"."+gM(u,n-a)):c+u}});var AM=Math.log,RM=Math.LOG10E;jr({target:"Math",stat:!0},{log10:Math.log10||function(e){return AM(e)*RM}});var CM=jr,OM=T,wM=o.f,kM=Ji,PM=Go,NM=Fo,DM=U,MM=zo,LM=OM("".startsWith),UM=OM("".slice),xM=Math.min,VM=MM("startsWith"),FM=!VM&&!!function(){var e=wM(String.prototype,"startsWith");return e&&!e.writable}();CM({target:"String",proto:!0,forced:!FM&&!VM},{startsWith:function(e){var t=PM(DM(this));NM(e);var i=kM(xM(arguments.length>1?arguments[1]:void 0,t.length)),r=PM(e);return LM?LM(t,r,i):UM(t,i,i+r.length)===r}});var BM,jM,GM,HM,zM,KM,WM,qM,XM,YM,JM,QM,ZM,$M,eL,tL,iL,rL,nL,oL,aL,sL,cL,uL,dL,lL,hL=["click","contextmenu","mousedown","mouseup","pointerup","touchend","keydown","keyup"],pL=function(){function e(){var e=this;this._contextStuckAt=0,this._haslistener=!1,this._hasIOSListener=!1;var t=0;setInterval((function(){if(e._audioContextInstance){var i=e._audioContextInstance.currentTime;e._contextStuckAt?e._contextStuckAt!==i&&(e._contextStuckAt=0):t===i&&(e._contextStuckAt=i),t=i}}),5e3)}return e.prototype.resume=function(){var e,t,i=this;"running"!==(null===(e=this._audioContextInstance)||void 0===e?void 0:e.state)&&(null===(t=this._audioContextInstance)||void 0===t||t.resume().then((function(){var e;"running"!==(null===(e=i._audioContextInstance)||void 0===e?void 0:e.state)&&i.addInteractionListener()})).catch((function(){i.addInteractionListener()})))},e.prototype.getAudioContextInstance=function(){var e=this;if(!this._audioContextInstance){var t=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new t,this._audioContextInstance.onstatechange=function(){var t,i,r;"suspended"!==(null===(t=e._audioContextInstance)||void 0===t?void 0:t.state)&&"interrupted"!==(null===(i=e._audioContextInstance)||void 0===i?void 0:i.state)||(null===(r=e._audioContextInstance)||void 0===r||r.resume(),e.addInteractionListener())},this.addInteractionListener()}return this._audioContextInstance},e.prototype.addInteractionListener=function(){var e=this;this._haslistener||(this._resumeContext||(this._resumeContext=function(){var t,i;"running"===(null===(t=e._audioContextInstance)||void 0===t?void 0:t.state)?(hL.forEach((function(t){window.removeEventListener(t,e._resumeContext)})),e._haslistener=!1):null===(i=e._audioContextInstance)||void 0===i||i.resume()}),hL.forEach((function(t){window.addEventListener(t,e._resumeContext)})),this._haslistener=!0),eU&&!this._hasIOSListener&&(this._playSoundInIOS||(this._playSoundInIOS=function(){window.removeEventListener("touchend",e._playSoundInIOS),e._hasIOSListener=!1;var t=e._audioContextInstance;if(t){var i=t.createBuffer(1,1,44100),r=t.createBufferSource();r.buffer=i,r.connect(t.destination),r.start(0),r.disconnect()}}),window.addEventListener("touchend",this._playSoundInIOS),this._hasIOSListener=!0)},e}(),fL=function(){function e(e){this._buffer=[];var t=_L.getAudioContextInstance();if(e instanceof MediaStreamTrack){var i=new MediaStream;i.addTrack(e),this._stream=i,this._audioSource=t.createMediaStreamSource(i)}else this._audioSource=t.createMediaElementSource(e),this._audioSource.connect(t.destination);var r=t.createAnalyser();this._audioSource.connect(r),this._analyserNode=r,this._ctx=t}return e.prototype.getAudioLevel=function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var i=0;return t.forEach((function(e){return i=Math.max(i,Math.abs(e-128))})),i/128*255},e.prototype.checkHasInput=function(){var e=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(e);var t=!1;return e.forEach((function(e){0!==e&&(t=!0)})),t},e.prototype.reset=function(){if(this._stream){this._audioSource.disconnect(),this._analyserNode.disconnect();var e=_L.getAudioContextInstance(),t=e.createAnalyser();this._audioSource=e.createMediaStreamSource(this._stream),this._audioSource.connect(t),this._analyserNode=t,this._ctx=e}},e.prototype.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect(),delete this._stream},e}(),_L=new pL;!function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(BM||(BM={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(jM||(jM={})),function(e){e[e.QUIT=0]="QUIT",e[e.DROPPED=1]="DROPPED",e[e.SWITCH_TO_INVISIBLE=2]="SWITCH_TO_INVISIBLE",e[e.KICKED_BY_ADMIN=3]="KICKED_BY_ADMIN"}(GM||(GM={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(HM||(HM={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(zM||(zM={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(KM||(KM={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(WM||(WM={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(qM||(qM={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(XM||(XM={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(YM||(YM={})),function(e){e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO"}(JM||(JM={})),function(e){e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER"}(QM||(QM={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST"}(ZM||(ZM={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}($M||($M={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(eL||(eL={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(tL||(tL={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY"}(iL||(iL={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(rL||(rL={})),function(e){e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY"}(nL||(nL={})),function(e){e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH"}(oL||(oL={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(aL||(aL={})),function(e){e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth"}(sL||(sL={})),function(e){e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom"}(cL||(cL={})),function(e){e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono"}(uL||(uL={})),function(e){e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY"}(dL||(dL={}));var vL=new Uint8Array(16);function mL(){if(!lL&&!(lL="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return lL(vL)}var yL=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function gL(e){return"string"==typeof e&&yL.test(e)}for(var SL=[],EL=0;EL<256;++EL)SL.push((EL+256).toString(16).substr(1));function bL(e,t,i){var r=(e=e||{}).random||(e.rng||mL)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){i=i||0;for(var n=0;n<16;++n)t[i+n]=r[n];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(SL[e[t+0]]+SL[e[t+1]]+SL[e[t+2]]+SL[e[t+3]]+"-"+SL[e[t+4]]+SL[e[t+5]]+"-"+SL[e[t+6]]+SL[e[t+7]]+"-"+SL[e[t+8]]+SL[e[t+9]]+"-"+SL[e[t+10]]+SL[e[t+11]]+SL[e[t+12]]+SL[e[t+13]]+SL[e[t+14]]+SL[e[t+15]]).toLowerCase();if(!gL(i))throw TypeError("Stringified UUID is invalid");return i}(r)}(0,iw.exports)("Uint32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Int8",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}}),!0),(0,iw.exports)("Int16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Uint16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Int32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Float32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,iw.exports)("Float64",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var IL,TL={exports:{}},AL={exports:{}};AL.exports=(IL=IL||function(e,i){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==t&&t.crypto&&(r=t.crypto),!r)try{r=require("crypto")}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var i;return e.prototype=t,i=new e,e.prototype=null,i}}(),a={},s=a.lib={},c=s.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=s.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=t!=i?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,i=e.words,r=this.sigBytes,n=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<n;o++){var a=i[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=a<<24-(r+o)%4*8}else for(var s=0;s<n;s+=4)t[r+s>>>2]=i[s>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i<e;i+=4)t.push(n());return new u.init(t,e)}}),d=a.enc={},l=d.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],n=0;n<i;n++){var o=t[n>>>2]>>>24-n%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r+=2)i[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(i,t/2)}},h=d.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],n=0;n<i;n++){var o=t[n>>>2]>>>24-n%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r++)i[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(i,t)}},p=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},f=s.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,r=this._data,n=r.words,o=r.sigBytes,a=this.blockSize,s=o/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,d=e.min(4*c,o);if(c){for(var l=0;l<c;l+=a)this._doProcessBlock(n,l);i=n.splice(0,c),r.sigBytes-=d}return new u.init(i,d)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});s.Hasher=f.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e.init(i).finalize(t)}},_createHmacHelper:function(e){return function(t,i){return new _.HMAC.init(e,i).finalize(t)}}});var _=a.algo={};return a}(Math),IL);var RL=TL.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,i=t.init,r=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,r=[],n=0;n<t;n++)r[n>>>2]|=e[n]<<24-n%4*8;i.call(this,r,t)}else i.apply(this,arguments)};r.prototype=t}}(),e.lib.WordArray}(AL.exports),CL={exports:{}},OL={exports:{}};OL.exports=function(e){return function(){var t=e,i=t.lib.WordArray;function r(e,t,r){for(var n=[],o=0,a=0;a<t;a++)if(a%4){var s=r[e.charCodeAt(a-1)]<<a%4*2|r[e.charCodeAt(a)]>>>6-a%4*2;n[o>>>2]|=s<<24-o%4*8,o++}return i.create(n,o)}t.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,r=this._map;e.clamp();for(var n=[],o=0;o<i;o+=3)for(var a=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<i;s++)n.push(r.charAt(a>>>6*(3-s)&63));var c=r.charAt(64);if(c)for(;n.length%4;)n.push(c);return n.join("")},parse:function(e){var t=e.length,i=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o<i.length;o++)n[i.charCodeAt(o)]=o}var a=i.charAt(64);if(a){var s=e.indexOf(a);-1!==s&&(t=s)}return r(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(AL.exports);var wL={exports:{}};wL.exports=function(e){return function(t){var i=e,r=i.lib,n=r.WordArray,o=r.Hasher,a=i.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=a.MD5=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var r=t+i,n=e[r];e[r]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],p=e[t+2],f=e[t+3],_=e[t+4],v=e[t+5],m=e[t+6],y=e[t+7],g=e[t+8],S=e[t+9],E=e[t+10],b=e[t+11],I=e[t+12],T=e[t+13],A=e[t+14],R=e[t+15],C=o[0],O=o[1],w=o[2],k=o[3];C=u(C,O,w,k,a,7,s[0]),k=u(k,C,O,w,c,12,s[1]),w=u(w,k,C,O,p,17,s[2]),O=u(O,w,k,C,f,22,s[3]),C=u(C,O,w,k,_,7,s[4]),k=u(k,C,O,w,v,12,s[5]),w=u(w,k,C,O,m,17,s[6]),O=u(O,w,k,C,y,22,s[7]),C=u(C,O,w,k,g,7,s[8]),k=u(k,C,O,w,S,12,s[9]),w=u(w,k,C,O,E,17,s[10]),O=u(O,w,k,C,b,22,s[11]),C=u(C,O,w,k,I,7,s[12]),k=u(k,C,O,w,T,12,s[13]),w=u(w,k,C,O,A,17,s[14]),C=d(C,O=u(O,w,k,C,R,22,s[15]),w,k,c,5,s[16]),k=d(k,C,O,w,m,9,s[17]),w=d(w,k,C,O,b,14,s[18]),O=d(O,w,k,C,a,20,s[19]),C=d(C,O,w,k,v,5,s[20]),k=d(k,C,O,w,E,9,s[21]),w=d(w,k,C,O,R,14,s[22]),O=d(O,w,k,C,_,20,s[23]),C=d(C,O,w,k,S,5,s[24]),k=d(k,C,O,w,A,9,s[25]),w=d(w,k,C,O,f,14,s[26]),O=d(O,w,k,C,g,20,s[27]),C=d(C,O,w,k,T,5,s[28]),k=d(k,C,O,w,p,9,s[29]),w=d(w,k,C,O,y,14,s[30]),C=l(C,O=d(O,w,k,C,I,20,s[31]),w,k,v,4,s[32]),k=l(k,C,O,w,g,11,s[33]),w=l(w,k,C,O,b,16,s[34]),O=l(O,w,k,C,A,23,s[35]),C=l(C,O,w,k,c,4,s[36]),k=l(k,C,O,w,_,11,s[37]),w=l(w,k,C,O,y,16,s[38]),O=l(O,w,k,C,E,23,s[39]),C=l(C,O,w,k,T,4,s[40]),k=l(k,C,O,w,a,11,s[41]),w=l(w,k,C,O,f,16,s[42]),O=l(O,w,k,C,m,23,s[43]),C=l(C,O,w,k,S,4,s[44]),k=l(k,C,O,w,I,11,s[45]),w=l(w,k,C,O,R,16,s[46]),C=h(C,O=l(O,w,k,C,p,23,s[47]),w,k,a,6,s[48]),k=h(k,C,O,w,y,10,s[49]),w=h(w,k,C,O,A,15,s[50]),O=h(O,w,k,C,v,21,s[51]),C=h(C,O,w,k,I,6,s[52]),k=h(k,C,O,w,f,10,s[53]),w=h(w,k,C,O,E,15,s[54]),O=h(O,w,k,C,c,21,s[55]),C=h(C,O,w,k,g,6,s[56]),k=h(k,C,O,w,R,10,s[57]),w=h(w,k,C,O,m,15,s[58]),O=h(O,w,k,C,T,21,s[59]),C=h(C,O,w,k,_,6,s[60]),k=h(k,C,O,w,b,10,s[61]),w=h(w,k,C,O,p,15,s[62]),O=h(O,w,k,C,S,21,s[63]),o[0]=o[0]+C|0,o[1]=o[1]+O|0,o[2]=o[2]+w|0,o[3]=o[3]+k|0},_doFinalize:function(){var e=this._data,i=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;i[n>>>5]|=128<<24-n%32;var o=t.floor(r/4294967296),a=r;i[15+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),i[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(i.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var d=c[u];c[u]=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,i,r,n,o,a){var s=e+(t&i|~t&r)+n+a;return(s<<o|s>>>32-o)+t}function d(e,t,i,r,n,o,a){var s=e+(t&r|i&~r)+n+a;return(s<<o|s>>>32-o)+t}function l(e,t,i,r,n,o,a){var s=e+(t^i^r)+n+a;return(s<<o|s>>>32-o)+t}function h(e,t,i,r,n,o,a){var s=e+(i^(t|~r))+n+a;return(s<<o|s>>>32-o)+t}i.MD5=o._createHelper(c),i.HmacMD5=o._createHmacHelper(c)}(Math),e.MD5}(AL.exports);var kL={exports:{}},PL={exports:{}};PL.exports=function(e){return function(){var t=e,i=t.lib,r=i.WordArray,n=i.Hasher,o=t.algo,a=[],s=o.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],n=i[1],o=i[2],s=i[3],c=i[4],u=0;u<80;u++){if(u<16)a[u]=0|e[t+u];else{var d=a[u-3]^a[u-8]^a[u-14]^a[u-16];a[u]=d<<1|d>>>31}var l=(r<<5|r>>>27)+c+a[u];l+=u<20?1518500249+(n&o|~n&s):u<40?1859775393+(n^o^s):u<60?(n&o|n&s|o&s)-1894007588:(n^o^s)-899497514,c=s,s=o,o=n<<30|n>>>2,n=r,r=l}i[0]=i[0]+r|0,i[1]=i[1]+n|0,i[2]=i[2]+o|0,i[3]=i[3]+s|0,i[4]=i[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(r+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=n._createHelper(s),t.HmacSHA1=n._createHmacHelper(s)}(),e.SHA1}(AL.exports);var NL={exports:{}};NL.exports=function(e){var t,i,r;i=(t=e).lib.Base,r=t.enc.Utf8,t.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var i=e.blockSize,n=4*i;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),s=o.words,c=a.words,u=0;u<i;u++)s[u]^=1549556828,c[u]^=909522486;o.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,i=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(i))}})}(AL.exports),kL.exports=function(e){return function(){var t=e,i=t.lib,r=i.Base,n=i.WordArray,o=t.algo,a=o.MD5,s=o.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var i,r=this.cfg,o=r.hasher.create(),a=n.create(),s=a.words,c=r.keySize,u=r.iterations;s.length<c;){i&&o.update(i),i=o.update(e).finalize(t),o.reset();for(var d=1;d<u;d++)i=o.finalize(i),o.reset();a.concat(i)}return a.sigBytes=4*c,a}});t.EvpKDF=function(e,t,i){return s.create(i).compute(e,t)}}(),e.EvpKDF}(AL.exports);var DL={exports:{}};DL.exports=function(e){e.lib.Cipher||function(t){var i=e,r=i.lib,n=r.Base,o=r.WordArray,a=r.BufferedBlockAlgorithm,s=i.enc;s.Utf8;var c=s.Base64,u=i.algo.EvpKDF,d=r.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,i){this.cfg=this.cfg.extend(i),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?g:m}return function(t){return{encrypt:function(i,r,n){return e(r).encrypt(t,i,r,n)},decrypt:function(i,r,n){return e(r).decrypt(t,i,r,n)}}}}()});r.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=i.mode={},h=r.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=l.CBC=function(){var e=h.extend();function i(e,i,r){var n,o=this._iv;o?(n=o,this._iv=t):n=this._prevBlock;for(var a=0;a<r;a++)e[i+a]^=n[a]}return e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize;i.call(this,e,t,n),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),e.Decryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=e.slice(t,t+n);r.decryptBlock(e,t),i.call(this,e,t,n),this._prevBlock=o}}),e}(),f=(i.pad={}).Pkcs7={pad:function(e,t){for(var i=4*t,r=i-e.sigBytes%i,n=r<<24|r<<16|r<<8|r,a=[],s=0;s<r;s+=4)a.push(n);var c=o.create(a,r);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};r.BlockCipher=d.extend({cfg:d.cfg.extend({mode:p,padding:f}),reset:function(){var e;d.reset.call(this);var t=this.cfg,i=t.iv,r=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(r,this,i&&i.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var _=r.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),v=(i.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?o.create([1398893684,1701076831]).concat(i).concat(t):t).toString(c)},parse:function(e){var t,i=c.parse(e),r=i.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=o.create(r.slice(2,4)),r.splice(0,4),i.sigBytes-=16),_.create({ciphertext:i,salt:t})}},m=r.SerializableCipher=n.extend({cfg:n.extend({format:v}),encrypt:function(e,t,i,r){r=this.cfg.extend(r);var n=e.createEncryptor(i,r),o=n.finalize(t),a=n.cfg;return _.create({ciphertext:o,key:i,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(i,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(i.kdf={}).OpenSSL={execute:function(e,t,i,r,n){if(r||(r=o.random(8)),n)a=u.create({keySize:t+i,hasher:n}).compute(e,r);else var a=u.create({keySize:t+i}).compute(e,r);var s=o.create(a.words.slice(t),4*i);return a.sigBytes=4*t,_.create({key:a,iv:s,salt:r})}},g=r.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:y}),encrypt:function(e,t,i,r){var n=(r=this.cfg.extend(r)).kdf.execute(i,e.keySize,e.ivSize,r.salt,r.hasher);r.iv=n.iv;var o=m.encrypt.call(this,e,t,n.key,r);return o.mixIn(n),o},decrypt:function(e,t,i,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var n=r.kdf.execute(i,e.keySize,e.ivSize,t.salt,r.hasher);return r.iv=n.iv,m.decrypt.call(this,e,t,n.key,r)}})}()}(AL.exports),CL.exports=function(e){return function(){var t=e,i=t.lib.BlockCipher,r=t.algo,n=[],o=[],a=[],s=[],c=[],u=[],d=[],l=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,r=0;for(t=0;t<256;t++){var f=r^r<<1^r<<2^r<<3^r<<4;f=f>>>8^255&f^99,n[i]=f,o[f]=i;var _=e[i],v=e[_],m=e[v],y=257*e[f]^16843008*f;a[i]=y<<24|y>>>8,s[i]=y<<16|y>>>16,c[i]=y<<8|y>>>24,u[i]=y,y=16843009*m^65537*v^257*_^16843008*i,d[f]=y<<24|y>>>8,l[f]=y<<16|y>>>16,h[f]=y<<8|y>>>24,p[f]=y,i?(i=_^e[e[e[m^_]]],r^=e[e[r]]):i=r=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=r.AES=i.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,r=4*((this._nRounds=i+6)+1),o=this._keySchedule=[],a=0;a<r;a++)a<i?o[a]=t[a]:(u=o[a-1],a%i?i>6&&a%i==4&&(u=n[u>>>24]<<24|n[u>>>16&255]<<16|n[u>>>8&255]<<8|n[255&u]):(u=n[(u=u<<8|u>>>24)>>>24]<<24|n[u>>>16&255]<<16|n[u>>>8&255]<<8|n[255&u],u^=f[a/i|0]<<24),o[a]=o[a-i]^u);for(var s=this._invKeySchedule=[],c=0;c<r;c++){if(a=r-c,c%4)var u=o[a];else u=o[a-4];s[c]=c<4||a<=4?u:d[n[u>>>24]]^l[n[u>>>16&255]]^h[n[u>>>8&255]]^p[n[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,n)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,d,l,h,p,o),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,r,n,o,a,s){for(var c=this._nRounds,u=e[t]^i[0],d=e[t+1]^i[1],l=e[t+2]^i[2],h=e[t+3]^i[3],p=4,f=1;f<c;f++){var _=r[u>>>24]^n[d>>>16&255]^o[l>>>8&255]^a[255&h]^i[p++],v=r[d>>>24]^n[l>>>16&255]^o[h>>>8&255]^a[255&u]^i[p++],m=r[l>>>24]^n[h>>>16&255]^o[u>>>8&255]^a[255&d]^i[p++],y=r[h>>>24]^n[u>>>16&255]^o[d>>>8&255]^a[255&l]^i[p++];u=_,d=v,l=m,h=y}_=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^i[p++],v=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&u])^i[p++],m=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^i[p++],y=(s[h>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^i[p++],e[t]=_,e[t+1]=v,e[t+2]=m,e[t+3]=y},keySize:8});t.AES=i._createHelper(_)}(),e.AES}(AL.exports);var ML,LL={exports:{}},UL=LL.exports=function(e){return e.enc.Hex}(AL.exports),xL={exports:{}},VL=xL.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),i=t.Encryptor=t.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,n=this._iv,o=this._counter;n&&(o=this._counter=n.slice(0),this._iv=void 0);var a=o.slice(0);i.encryptBlock(a,0),o[r-1]=o[r-1]+1|0;for(var s=0;s<r;s++)e[t+s]^=a[s]}}),t.Decryptor=i,t),e.mode.CTR;var t,i}(AL.exports),FL={exports:{}},BL=FL.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(AL.exports),jL=new TextDecoder,GL=new TextEncoder,HL=function(){return bL()},zL=function(){return Date.now()};function KL(e){for(var t,i,r,n,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=rv(o),u=c.next();!u.done;u=c.next()){s+=(f=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=rv(o),p=h.next();!p.done;p=h.next()){var f=p.value;d.set(f,l),l+=f.length}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}return d}var WL=function(){return"undefined"==typeof window},qL=function(){function e(){}return e.token2auth=function(t,i,r,n){return n?"Bearer ".concat(n):"Basic ".concat(e.createUnsafeToken(t,i,r))},e.createUnsafeToken=function(e,t,i){return window.btoa([e,t,i].filter((function(e){return null!==e})).join(":"))},e.merge=function(t,i){var r,n;void 0===t&&(t={}),void 0===i&&(i={});try{for(var o=rv(Object.entries(t)),a=o.next();!a.done;a=o.next()){var s=nv(a.value,2),c=s[0],u=s[1];null!==u&&"object"===vs(u)?e.merge(t[c],i[c]):void 0!==i[c]&&(t[c]=i[c])}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.ab2str=function(e){return jL.decode(e)},e.ab2obj=function(t){try{var i=e.ab2str(t);return JSON.parse(i)}catch(e){return{}}},e.str2ab=function(e){return GL.encode(e).buffer},e.ab2b64str=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var i=new FileReader;i.onload=function(){return t(i.result)},i.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function XL(){var e="none";return WL()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var YL="mozilla"===XL(),JL="safari"===XL(),QL=0,ZL=null===(ML=navigator.userAgent.match(/version\/(\d+)/i))||void 0===ML?void 0:ML[1];JL&&ZL&&(QL=+ZL);var $L=QL,eU=!WL()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!WL()&&/(iPhone|iPod)/i.exec(navigator.userAgent),!WL()&&(/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&document);var tU=!WL()&&/MicroMessenger/i.test(navigator.userAgent),iU=!WL()&&/Android/i.test(navigator.userAgent),rU=!WL()&&navigator.userAgent.toLowerCase().includes("mobile"),nU=!WL()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent),oU=!WL()&&/DingTalk/i.test(navigator.userAgent);function aU(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,i){var r=i===t.length-1?"0":"1";return Number.parseInt(r+e.join(""),2)}))}var sU=function(){return Math.floor(65535*Math.random())};function cU(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function uU(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var i=ArrayBuffer.isView(t)?t.buffer:t,r=i.byteLength,n=[];if(r>10){var o=new DataView(i),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return r-1-t})).reverse().map((function(e){return o.getUint8(e)}));n=ov(ov(ov([],nv(a),!1),["..."],!1),nv(s),!1)}else n=Array.from(new Uint8Array(i));return"".concat(t.constructor.name,"(").concat(r,") [").concat(n.join(", "),"]")}if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var dU=function(e){return void 0===e&&(e=!1),tv(void 0,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),t.addTransceiver("audio",{direction:"recvonly"}),t.addTransceiver("video",{direction:"recvonly"}),e&&(t.addTransceiver("audio",{direction:"sendonly"}),t.addTransceiver("video",{direction:"sendonly"})),[4,t.createOffer()];case 1:return i=r.sent(),t.close(),[2,i.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))},lU=function(e){return new Promise((function(t,i){var r=(e=Array.isArray(e)?e:[]).length,n=[];0===r?i([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){r--,n.push(e),0===r&&i(n)}))}))}))};function hU(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function pU(e){return(e&JM.AUDIO)===JM.AUDIO}function fU(e){return(e&JM.VIDEO)===JM.VIDEO}function _U(e){var t={};return Object.keys(e).forEach((function(i){"object"===vs(e[i])?t[i]=_U(e[i]):i.startsWith("_")||(t[i]=e[i])})),t}function vU(e){return null==e?"undefined | null":"string"==typeof e?e:JSON.stringify({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function mU(e){return"number"==typeof e?e:"number"==typeof(null==e?void 0:e.exact)?e.exact:"number"==typeof(null==e?void 0:e.ideal)?e.ideal:"number"==typeof(null==e?void 0:e.max)?e.max:"number"==typeof(null==e?void 0:e.min)?e.min:1}var yU=function(){if("chrome-stable"===XL()){var e=window.navigator.userAgent.match(/Chrome\/([\d.]+)/);if(e&&e.length>1)if(Number(e[1].split(".")[0])<117)return!0}return!1}();function gU(e){for(var t=atob(e),i=t.length,r=new Uint8Array(i),n=0;n<i;n++)r[n]=t.charCodeAt(n);return r}function SU(e){for(var t="",i=e.byteLength,r=0;r<i;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function EU(e,t,i){var r=bU(e),n=bU(t),o=bU(i);return function(e){for(var t=e.toString(UL),i=new Uint8Array(t.length/2),r=0;r<t.length;r+=2)i[r/2]=parseInt(t.substr(r,2),16);return i}(CL.exports.encrypt(r,n,{iv:o,mode:VL,padding:BL}).ciphertext)}function bU(e){for(var t=[],i=0;i<e.length;i+=4)t.push(e[i]<<24|(e[i+1]||0)<<16|(e[i+2]||0)<<8|(e[i+3]||0));return RL.create(t,e.length)}var IU={};!function(e){var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!==vs(r))throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(e[n]=r[n])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){var t,i,r,n,o,a;for(r=0,t=0,i=e.length;t<i;t++)r+=e[t].length;for(a=new Uint8Array(r),n=0,t=0,i=e.length;t<i;t++)o=e[t],a.set(o,n),n+=o.length;return a}},n={arraySet:function(e,t,i,r,n){for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,r)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,n))},e.setTyped(t)}(IU);var TU={},AU={},RU={},CU=IU;function OU(e){for(var t=e.length;--t>=0;)e[t]=0}var wU=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],kU=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],PU=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],NU=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],DU=new Array(576);OU(DU);var MU=new Array(60);OU(MU);var LU=new Array(512);OU(LU);var UU=new Array(256);OU(UU);var xU=new Array(29);OU(xU);var VU,FU,BU,jU=new Array(30);function GU(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function HU(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function zU(e){return e<256?LU[e]:LU[256+(e>>>7)]}function KU(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function WU(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,KU(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function qU(e,t,i){WU(e,i[2*t],i[2*t+1])}function XU(e,t){var i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1}function YU(e,t,i){var r,n,o=new Array(16),a=0;for(r=1;r<=15;r++)o[r]=a=a+i[r-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=XU(o[s]++,s))}}function JU(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function QU(e){e.bi_valid>8?KU(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function ZU(e,t,i,r){var n=2*t,o=2*i;return e[n]<e[o]||e[n]===e[o]&&r[t]<=r[i]}function $U(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&ZU(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!ZU(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function ex(e,t,i){var r,n,o,a,s=0;if(0!==e.last_lit)do{r=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],n=e.pending_buf[e.l_buf+s],s++,0===r?qU(e,n,t):(qU(e,(o=UU[n])+256+1,t),0!==(a=wU[o])&&WU(e,n-=xU[o],a),qU(e,o=zU(--r),i),0!==(a=kU[o])&&WU(e,r-=jU[o],a))}while(s<e.last_lit);qU(e,256,t)}function tx(e,t){var i,r,n,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<c;i++)0!==o[2*i]?(e.heap[++e.heap_len]=u=i,e.depth[i]=0):o[2*i+1]=0;for(;e.heap_len<2;)o[2*(n=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=a[2*n+1]);for(t.max_code=u,i=e.heap_len>>1;i>=1;i--)$U(e,o,i);n=c;do{i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],$U(e,o,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,o[2*n]=o[2*i]+o[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,o[2*i+1]=o[2*r+1]=n,e.heap[1]=n++,$U(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,f=t.stat_desc.max_length,_=0;for(o=0;o<=15;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)(o=c[2*c[2*(r=e.heap[i])+1]+1]+1)>f&&(o=f,_++),c[2*r+1]=o,r>u||(e.bl_count[o]++,a=0,r>=p&&(a=h[r-p]),s=c[2*r],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*r+1]+a)));if(0!==_){do{for(o=f-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[f]--,_-=2}while(_>0);for(o=f;0!==o;o--)for(r=e.bl_count[o];0!==r;)(n=e.heap[--i])>u||(c[2*n+1]!==o&&(e.opt_len+=(o-c[2*n+1])*c[2*n],c[2*n+1]=o),r--)}}(e,t),YU(o,u,e.bl_count)}function ix(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=a,a=t[2*(r+1)+1],++s<c&&n===a||(s<u?e.bl_tree[2*n]+=s:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4))}function rx(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),r=0;r<=i;r++)if(n=a,a=t[2*(r+1)+1],!(++s<c&&n===a)){if(s<u)do{qU(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(qU(e,n,e.bl_tree),s--),qU(e,16,e.bl_tree),WU(e,s-3,2)):s<=10?(qU(e,17,e.bl_tree),WU(e,s-3,3)):(qU(e,18,e.bl_tree),WU(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}OU(jU);var nx=!1;function ox(e,t,i,r){WU(e,0+(r?1:0),3),function(e,t,i,r){QU(e),r&&(KU(e,i),KU(e,~i)),CU.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}(e,t,i,!0)}RU._tr_init=function(e){nx||(!function(){var e,t,i,r,n,o=new Array(16);for(i=0,r=0;r<28;r++)for(xU[r]=i,e=0;e<1<<wU[r];e++)UU[i++]=r;for(UU[i-1]=r,n=0,r=0;r<16;r++)for(jU[r]=n,e=0;e<1<<kU[r];e++)LU[n++]=r;for(n>>=7;r<30;r++)for(jU[r]=n<<7,e=0;e<1<<kU[r]-7;e++)LU[256+n++]=r;for(t=0;t<=15;t++)o[t]=0;for(e=0;e<=143;)DU[2*e+1]=8,e++,o[8]++;for(;e<=255;)DU[2*e+1]=9,e++,o[9]++;for(;e<=279;)DU[2*e+1]=7,e++,o[7]++;for(;e<=287;)DU[2*e+1]=8,e++,o[8]++;for(YU(DU,287,o),e=0;e<30;e++)MU[2*e+1]=5,MU[2*e]=XU(e,5);VU=new GU(DU,wU,257,286,15),FU=new GU(MU,kU,0,30,15),BU=new GU(new Array(0),PU,0,19,7)}(),nx=!0),e.l_desc=new HU(e.dyn_ltree,VU),e.d_desc=new HU(e.dyn_dtree,FU),e.bl_desc=new HU(e.bl_tree,BU),e.bi_buf=0,e.bi_valid=0,JU(e)},RU._tr_stored_block=ox,RU._tr_flush_block=function(e,t,i,r){var n,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),tx(e,e.l_desc),tx(e,e.d_desc),a=function(e){var t;for(ix(e,e.dyn_ltree,e.l_desc.max_code),ix(e,e.dyn_dtree,e.d_desc.max_code),tx(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*NU[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==t?ox(e,t,i,r):4===e.strategy||o===n?(WU(e,2+(r?1:0),3),ex(e,DU,MU)):(WU(e,4+(r?1:0),3),function(e,t,i,r){var n;for(WU(e,t-257,5),WU(e,i-1,5),WU(e,r-4,4),n=0;n<r;n++)WU(e,e.bl_tree[2*NU[n]+1],3);rx(e,e.dyn_ltree,t-1),rx(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),ex(e,e.dyn_ltree,e.dyn_dtree)),JU(e),r&&QU(e)},RU._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(UU[i]+256+1)]++,e.dyn_dtree[2*zU(t)]++),e.last_lit===e.lit_bufsize-1},RU._tr_align=function(e){WU(e,2,3),qU(e,256,DU),function(e){16===e.bi_valid?(KU(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var ax=function(e,t,i,r){for(var n=65535&e|0,o=e>>>16&65535|0,a=0;0!==i;){i-=a=i>2e3?2e3:i;do{o=o+(n=n+t[r++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0};var sx=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();var cx,ux=function(e,t,i,r){var n=sx,o=r+i;e^=-1;for(var a=r;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},dx={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},lx=IU,hx=RU,px=ax,fx=ux,_x=dx;function vx(e,t){return e.msg=_x[t],t}function mx(e){return(e<<1)-(e>4?9:0)}function yx(e){for(var t=e.length;--t>=0;)e[t]=0}function gx(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(lx.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function Sx(e,t){hx._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,gx(e.strm)}function Ex(e,t){e.pending_buf[e.pending++]=t}function bx(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function Ix(e,t){var i,r,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+258,p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(i=t)+a]===f&&u[i+a-1]===p&&u[i]===u[o]&&u[++i]===u[o+1]){o+=2,i++;do{}while(u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&o<h);if(r=258-(h-o),o=h-258,r>a){if(e.match_start=t,a=r,r>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=l[t&d])>c&&0!=--n);return a<=e.lookahead?a:e.lookahead}function Tx(e){var t,i,r,n,o,a,s,c,u,d,l=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-262)){lx.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=i=e.hash_size;do{r=e.head[--t],e.head[t]=r>=l?r-l:0}while(--i);t=i=l;do{r=e.prev[--t],e.prev[t]=r>=l?r-l:0}while(--i);n+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=n,d=void 0,(d=a.avail_in)>u&&(d=u),i=0===d?0:(a.avail_in-=d,lx.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=px(a.adler,s,d,c):2===a.state.wrap&&(a.adler=fx(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=i,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)}function Ax(e,t){for(var i,r;;){if(e.lookahead<262){if(Tx(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-262&&(e.match_length=Ix(e,i)),e.match_length>=3)if(r=hx._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=hx._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Sx(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(Sx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Sx(e,!1),0===e.strm.avail_out)?1:2}function Rx(e,t){for(var i,r,n;;){if(e.lookahead<262){if(Tx(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-262&&(e.match_length=Ix(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,r=hx._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Sx(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=hx._tr_tally(e,0,e.window[e.strstart-1]))&&Sx(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=hx._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(Sx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Sx(e,!1),0===e.strm.avail_out)?1:2}function Cx(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function Ox(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new lx.Buf16(1146),this.dyn_dtree=new lx.Buf16(122),this.bl_tree=new lx.Buf16(78),yx(this.dyn_ltree),yx(this.dyn_dtree),yx(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new lx.Buf16(16),this.heap=new lx.Buf16(573),yx(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new lx.Buf16(573),yx(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function wx(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=0,hx._tr_init(t),0):vx(e,-2)}function kx(e){var t,i=wx(e);return 0===i&&((t=e.state).window_size=2*t.w_size,yx(t.head),t.max_lazy_match=cx[t.level].max_lazy,t.good_match=cx[t.level].good_length,t.nice_match=cx[t.level].nice_length,t.max_chain_length=cx[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),i}function Px(e,t,i,r,n,o){if(!e)return-2;var a=1;if(-1===t&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),n<1||n>9||8!==i||r<8||r>15||t<0||t>9||o<0||o>4)return vx(e,-2);8===r&&(r=9);var s=new Ox;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new lx.Buf8(2*s.w_size),s.head=new lx.Buf16(s.hash_size),s.prev=new lx.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new lx.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=i,kx(e)}cx=[new Cx(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Tx(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,Sx(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(Sx(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Sx(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(Sx(e,!1),e.strm.avail_out),1)})),new Cx(4,4,8,4,Ax),new Cx(4,5,16,8,Ax),new Cx(4,6,32,32,Ax),new Cx(4,4,16,16,Rx),new Cx(8,16,32,32,Rx),new Cx(8,16,128,128,Rx),new Cx(8,32,128,256,Rx),new Cx(32,128,258,1024,Rx),new Cx(32,258,258,4096,Rx)],AU.deflateInit=function(e,t){return Px(e,t,8,15,8,0)},AU.deflateInit2=Px,AU.deflateReset=kx,AU.deflateResetKeep=wx,AU.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},AU.deflate=function(e,t){var i,r,n,o;if(!e||!e.state||t>5||t<0)return e?vx(e,-2):-2;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||666===r.status&&4!==t)return vx(e,0===e.avail_out?-5:-2);if(r.strm=e,i=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,Ex(r,31),Ex(r,139),Ex(r,8),r.gzhead?(Ex(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Ex(r,255&r.gzhead.time),Ex(r,r.gzhead.time>>8&255),Ex(r,r.gzhead.time>>16&255),Ex(r,r.gzhead.time>>24&255),Ex(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Ex(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Ex(r,255&r.gzhead.extra.length),Ex(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=fx(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(Ex(r,0),Ex(r,0),Ex(r,0),Ex(r,0),Ex(r,0),Ex(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Ex(r,3),r.status=113);else{var a=8+(r.w_bits-8<<4)<<8;a|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(a|=32),a+=31-a%31,r.status=113,bx(r,a),0!==r.strstart&&(bx(r,e.adler>>>16),bx(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(n=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),gx(e),n=r.pending,r.pending!==r.pending_buf_size));)Ex(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),gx(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Ex(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),gx(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Ex(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=fx(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&gx(e),r.pending+2<=r.pending_buf_size&&(Ex(r,255&e.adler),Ex(r,e.adler>>8&255),e.adler=0,r.status=113)):r.status=113),0!==r.pending){if(gx(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&mx(t)<=mx(i)&&4!==t)return vx(e,-5);if(666===r.status&&0!==e.avail_in)return vx(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&666!==r.status){var s=2===r.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(Tx(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=hx._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Sx(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Sx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Sx(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var i,r,n,o,a=e.window;;){if(e.lookahead<=258){if(Tx(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=a[n=e.strstart-1])===a[++n]&&r===a[++n]&&r===a[++n]){o=e.strstart+258;do{}while(r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&n<o);e.match_length=258-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=hx._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=hx._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Sx(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Sx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Sx(e,!1),0===e.strm.avail_out)?1:2}(r,t):cx[r.level].func(r,t);if(3!==s&&4!==s||(r.status=666),1===s||3===s)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===s&&(1===t?hx._tr_align(r):5!==t&&(hx._tr_stored_block(r,0,0,!1),3===t&&(yx(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),gx(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?(Ex(r,255&e.adler),Ex(r,e.adler>>8&255),Ex(r,e.adler>>16&255),Ex(r,e.adler>>24&255),Ex(r,255&e.total_in),Ex(r,e.total_in>>8&255),Ex(r,e.total_in>>16&255),Ex(r,e.total_in>>24&255)):(bx(r,e.adler>>>16),bx(r,65535&e.adler)),gx(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)},AU.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t?vx(e,-2):(e.state=null,113===t?vx(e,-3):0):-2},AU.deflateSetDictionary=function(e,t){var i,r,n,o,a,s,c,u,d=t.length;if(!e||!e.state)return-2;if(2===(o=(i=e.state).wrap)||1===o&&42!==i.status||i.lookahead)return-2;for(1===o&&(e.adler=px(e.adler,t,d,0)),i.wrap=0,d>=i.w_size&&(0===o&&(yx(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new lx.Buf8(i.w_size),lx.arraySet(u,t,d-i.w_size,i.w_size,0),t=u,d=i.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,Tx(i);i.lookahead>=3;){r=i.strstart,n=i.lookahead-2;do{i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++}while(--n);i.strstart=r,i.lookahead=2,Tx(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,i.wrap=o,0},AU.deflateInfo="pako deflate (from Nodeca project)";var Nx={},Dx=IU,Mx=!0,Lx=!0;try{String.fromCharCode.apply(null,[0])}catch(e){Mx=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Lx=!1}for(var Ux=new Dx.Buf8(256),xx=0;xx<256;xx++)Ux[xx]=xx>=252?6:xx>=248?5:xx>=240?4:xx>=224?3:xx>=192?2:1;function Vx(e,t){if(t<65534&&(e.subarray&&Lx||!e.subarray&&Mx))return String.fromCharCode.apply(null,Dx.shrinkBuf(e,t));for(var i="",r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i}Ux[254]=Ux[254]=1,Nx.string2buf=function(e){var t,i,r,n,o,a=e.length,s=0;for(n=0;n<a;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),s+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Dx.Buf8(s),o=0,n=0;o<s;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),i<128?t[o++]=i:i<2048?(t[o++]=192|i>>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},Nx.buf2binstring=function(e){return Vx(e,e.length)},Nx.binstring2buf=function(e){for(var t=new Dx.Buf8(e.length),i=0,r=t.length;i<r;i++)t[i]=e.charCodeAt(i);return t},Nx.buf2string=function(e,t){var i,r,n,o,a=t||e.length,s=new Array(2*a);for(r=0,i=0;i<a;)if((n=e[i++])<128)s[r++]=n;else if((o=Ux[n])>4)s[r++]=65533,i+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&i<a;)n=n<<6|63&e[i++],o--;o>1?s[r++]=65533:n<65536?s[r++]=n:(n-=65536,s[r++]=55296|n>>10&1023,s[r++]=56320|1023&n)}return Vx(s,r)},Nx.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Ux[e[i]]>t?i:t};var Fx=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},Bx=AU,jx=IU,Gx=Nx,Hx=dx,zx=Fx,Kx=Object.prototype.toString;function Wx(e){if(!(this instanceof Wx))return new Wx(e);this.options=jx.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zx,this.strm.avail_out=0;var i=Bx.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(Hx[i]);if(t.header&&Bx.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(r="string"==typeof t.dictionary?Gx.string2buf(t.dictionary):"[object ArrayBuffer]"===Kx.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=Bx.deflateSetDictionary(this.strm,r)))throw new Error(Hx[i]);this._dict_set=!0}}function qx(e,t){var i=new Wx(t);if(i.push(e,!0),i.err)throw i.msg||Hx[i.err];return i.result}Wx.prototype.push=function(e,t){var i,r,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;r=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=Gx.string2buf(e):"[object ArrayBuffer]"===Kx.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new jx.Buf8(o),n.next_out=0,n.avail_out=o),1!==(i=Bx.deflate(n,r))&&0!==i)return this.onEnd(i),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(Gx.buf2binstring(jx.shrinkBuf(n.output,n.next_out))):this.onData(jx.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==i);return 4===r?(i=Bx.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),n.avail_out=0,!0)},Wx.prototype.onData=function(e){this.chunks.push(e)},Wx.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=jx.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},TU.Deflate=Wx,TU.deflate=qx,TU.deflateRaw=function(e,t){return(t=t||{}).raw=!0,qx(e,t)},TU.gzip=function(e,t){return(t=t||{}).gzip=!0,qx(e,t)};var Xx={},Yx=s,Jx=Rt,Qx=Zo,Zx=a,$x=RegExp.prototype;Yx&&Zx((function(){return"sy"!==Object.getOwnPropertyDescriptor($x,"flags").get.call({dotAll:!0,sticky:!0})}))&&Jx.f($x,"flags",{configurable:!0,get:Qx});var eV={},tV=IU,iV=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],rV=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],nV=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],oV=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],aV=IU,sV=ax,cV=ux,uV=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R;i=e.state,r=e.next_in,A=e.input,n=r+(e.avail_in-5),o=e.next_out,R=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=i.dmax,u=i.wsize,d=i.whave,l=i.wnext,h=i.window,p=i.hold,f=i.bits,_=i.lencode,v=i.distcode,m=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;e:do{f<15&&(p+=A[r++]<<f,f+=8,p+=A[r++]<<f,f+=8),g=_[p&m];t:for(;;){if(p>>>=S=g>>>24,f-=S,0===(S=g>>>16&255))R[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=_[(65535&g)+(p&(1<<S)-1)];continue t}if(32&S){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}E=65535&g,(S&=15)&&(f<S&&(p+=A[r++]<<f,f+=8),E+=p&(1<<S)-1,p>>>=S,f-=S),f<15&&(p+=A[r++]<<f,f+=8,p+=A[r++]<<f,f+=8),g=v[p&y];i:for(;;){if(p>>>=S=g>>>24,f-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=v[(65535&g)+(p&(1<<S)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(b=65535&g,f<(S&=15)&&(p+=A[r++]<<f,(f+=8)<S&&(p+=A[r++]<<f,f+=8)),(b+=p&(1<<S)-1)>c){e.msg="invalid distance too far back",i.mode=30;break e}if(p>>>=S,f-=S,b>(S=o-a)){if((S=b-S)>d&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(I=0,T=h,0===l){if(I+=u-S,S<E){E-=S;do{R[o++]=h[I++]}while(--S);I=o-b,T=R}}else if(l<S){if(I+=u+l-S,(S-=l)<E){E-=S;do{R[o++]=h[I++]}while(--S);if(I=0,l<E){E-=S=l;do{R[o++]=h[I++]}while(--S);I=o-b,T=R}}}else if(I+=l-S,S<E){E-=S;do{R[o++]=h[I++]}while(--S);I=o-b,T=R}for(;E>2;)R[o++]=T[I++],R[o++]=T[I++],R[o++]=T[I++],E-=3;E&&(R[o++]=T[I++],E>1&&(R[o++]=T[I++]))}else{I=o-b;do{R[o++]=R[I++],R[o++]=R[I++],R[o++]=R[I++],E-=3}while(E>2);E&&(R[o++]=R[I++],E>1&&(R[o++]=R[I++]))}break}}break}}while(r<n&&o<s);r-=E=f>>3,p&=(1<<(f-=E<<3))-1,e.next_in=r,e.next_out=o,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=o<s?s-o+257:257-(o-s),i.hold=p,i.bits=f},dV=function(e,t,i,r,n,o,a,s){var c,u,d,l,h,p,f,_,v,m=s.bits,y=0,g=0,S=0,E=0,b=0,I=0,T=0,A=0,R=0,C=0,O=null,w=0,k=new tV.Buf16(16),P=new tV.Buf16(16),N=null,D=0;for(y=0;y<=15;y++)k[y]=0;for(g=0;g<r;g++)k[t[i+g]]++;for(b=m,E=15;E>=1&&0===k[E];E--);if(b>E&&(b=E),0===E)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(S=1;S<E&&0===k[S];S++);for(b<S&&(b=S),A=1,y=1;y<=15;y++)if(A<<=1,(A-=k[y])<0)return-1;if(A>0&&(0===e||1!==E))return-1;for(P[1]=0,y=1;y<15;y++)P[y+1]=P[y]+k[y];for(g=0;g<r;g++)0!==t[i+g]&&(a[P[t[i+g]]++]=g);if(0===e?(O=N=a,p=19):1===e?(O=iV,w-=257,N=rV,D-=257,p=256):(O=nV,N=oV,p=-1),C=0,g=0,y=S,h=o,I=b,T=0,d=-1,l=(R=1<<b)-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){f=y-T,a[g]<p?(_=0,v=a[g]):a[g]>p?(_=N[D+a[g]],v=O[w+a[g]]):(_=96,v=0),c=1<<y-T,S=u=1<<I;do{n[h+(C>>T)+(u-=c)]=f<<24|_<<16|v|0}while(0!==u);for(c=1<<y-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,g++,0==--k[y]){if(y===E)break;y=t[i+a[g]]}if(y>b&&(C&l)!==d){for(0===T&&(T=b),h+=S,A=1<<(I=y-T);I+T<E&&!((A-=k[I+T])<=0);)I++,A<<=1;if(R+=1<<I,1===e&&R>852||2===e&&R>592)return 1;n[d=C&l]=b<<24|I<<16|h-o|0}}return 0!==C&&(n[h+C]=y-T<<24|64<<16|0),s.bits=b,0};function lV(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function hV(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new aV.Buf16(320),this.work=new aV.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function pV(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new aV.Buf32(852),t.distcode=t.distdyn=new aV.Buf32(592),t.sane=1,t.back=-1,0):-2}function fV(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,pV(e)):-2}function _V(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,fV(e))):-2}function vV(e,t){var i,r;return e?(r=new hV,e.state=r,r.window=null,0!==(i=_V(e,t))&&(e.state=null),i):-2}var mV,yV,gV=!0;function SV(e){if(gV){var t;for(mV=new aV.Buf32(512),yV=new aV.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(dV(1,e.lens,0,288,mV,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;dV(2,e.lens,0,32,yV,0,e.work,{bits:5}),gV=!1}e.lencode=mV,e.lenbits=9,e.distcode=yV,e.distbits=5}function EV(e,t,i,r){var n,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new aV.Buf8(o.wsize)),r>=o.wsize?(aV.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),aV.arraySet(o.window,t,i-r,n,o.wnext),(r-=n)?(aV.arraySet(o.window,t,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}eV.inflateReset=fV,eV.inflateReset2=_V,eV.inflateResetKeep=pV,eV.inflateInit=function(e){return vV(e,15)},eV.inflateInit2=vV,eV.inflate=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R=0,C=new aV.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(i=e.state).mode&&(i.mode=13),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,l=s,h=c,I=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(2&i.wrap&&35615===u){i.check=0,C[0]=255&u,C[1]=u>>>8&255,i.check=cV(i.check,C,2,0),u=0,d=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",i.mode=30;break}if(d-=4,b=8+(15&(u>>>=4)),0===i.wbits)i.wbits=b;else if(b>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<b,e.adler=i.check=1,i.mode=512&u?10:12,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.flags=u,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=cV(i.check,C,2,0)),u=0,d=0,i.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.time=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,i.check=cV(i.check,C,4,0)),u=0,d=0,i.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=cV(i.check,C,2,0)),u=0,d=0,i.mode=5;case 5:if(1024&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=cV(i.check,C,2,0)),u=0,d=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((p=i.length)>s&&(p=s),p&&(i.head&&(b=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),aV.arraySet(i.head.extra,r,o,p,b)),512&i.flags&&(i.check=cV(i.check,r,p,o)),s-=p,o+=p,i.length-=p),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=cV(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=cV(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}u=0,d=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}e.adler=i.check=lV(u),u=0,d=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){u>>>=7&d,d-=7&d,i.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}switch(i.last=1&u,d-=1,3&(u>>>=1)){case 0:i.mode=14;break;case 1:if(SV(i),i.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&u,u=0,d=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(p=i.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;aV.arraySet(n,r,o,p,a),s-=p,o+=p,c-=p,a+=p,i.length-=p;break}i.mode=12;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.nlen=257+(31&u),u>>>=5,d-=5,i.ndist=1+(31&u),u>>>=5,d-=5,i.ncode=4+(15&u),u>>>=4,d-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.lens[O[i.have++]]=7&u,u>>>=3,d-=3}for(;i.have<19;)i.lens[O[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,T={bits:i.lenbits},I=dV(0,i.lens,0,19,i.lencode,0,i.work,T),i.lenbits=T.bits,I){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;m=(R=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(y<16)u>>>=v,d-=v,i.lens[i.have++]=y;else{if(16===y){for(A=v+2;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u>>>=v,d-=v,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}b=i.lens[i.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===y){for(A=v+3;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(A=v+7;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=11+(127&(u>>>=v)),u>>>=7,d-=7}if(i.have+p>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;p--;)i.lens[i.have++]=b}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,T={bits:i.lenbits},I=dV(1,i.lens,0,i.nlen,i.lencode,0,i.work,T),i.lenbits=T.bits,I){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,T={bits:i.distbits},I=dV(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,T),i.distbits=T.bits,I){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,uV(e,h),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;m=(R=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=v,S=m,E=y;m=(R=i.lencode[E+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&R,!(g+(v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=g,d-=g,i.back+=g}if(u>>>=v,d-=v,i.back+=v,i.length=y,0===m){i.mode=26;break}if(32&m){i.back=-1,i.mode=12;break}if(64&m){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&m,i.mode=22;case 22:if(i.extra){for(A=i.extra;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;m=(R=i.distcode[u&(1<<i.distbits)-1])>>>16&255,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(0==(240&m)){for(g=v,S=m,E=y;m=(R=i.distcode[E+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&R,!(g+(v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=g,d-=g,i.back+=g}if(u>>>=v,d-=v,i.back+=v,64&m){e.msg="invalid distance code",i.mode=30;break}i.offset=y,i.extra=15&m,i.mode=24;case 24:if(i.extra){for(A=i.extra;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===c)break e;if(p=h-c,i.offset>p){if((p=i.offset-p)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}p>i.wnext?(p-=i.wnext,f=i.wsize-p):f=i.wnext-p,p>i.length&&(p=i.length),_=i.window}else _=n,f=a-i.offset,p=i.length;p>c&&(p=c),c-=p,i.length-=p;do{n[a++]=_[f++]}while(--p);0===i.length&&(i.mode=21);break;case 26:if(0===c)break e;n[a++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;d<32;){if(0===s)break e;s--,u|=r[o++]<<d,d+=8}if(h-=c,e.total_out+=h,i.total+=h,h&&(e.adler=i.check=i.flags?cV(i.check,n,h,a-h):sV(i.check,n,h,a-h)),h=c,(i.flags?u:lV(u))!==i.check){e.msg="incorrect data check",i.mode=30;break}u=0,d=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}u=0,d=0}i.mode=29;case 29:I=1;break e;case 30:I=-3;break e;case 31:return-4;default:return-2}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,(i.wsize||h!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&EV(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,i.total+=h,i.wrap&&h&&(e.adler=i.check=i.flags?cV(i.check,n,h,e.next_out-h):sV(i.check,n,h,e.next_out-h)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0===l&&0===h||4===t)&&0===I&&(I=-5),I},eV.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},eV.inflateGetHeader=function(e,t){var i;return e&&e.state?0==(2&(i=e.state).wrap)?-2:(i.head=t,t.done=!1,0):-2},eV.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?-2:11===i.mode&&sV(1,t,r,0)!==i.check?-3:EV(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):-2},eV.inflateInfo="pako inflate (from Nodeca project)";var bV={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var IV=eV,TV=IU,AV=Nx,RV=bV,CV=dx,OV=Fx,wV=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},kV=Object.prototype.toString;function PV(e){if(!(this instanceof PV))return new PV(e);this.options=TV.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new OV,this.strm.avail_out=0;var i=IV.inflateInit2(this.strm,t.windowBits);if(i!==RV.Z_OK)throw new Error(CV[i]);if(this.header=new wV,IV.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=AV.string2buf(t.dictionary):"[object ArrayBuffer]"===kV.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=IV.inflateSetDictionary(this.strm,t.dictionary))!==RV.Z_OK))throw new Error(CV[i])}function NV(e,t){var i=new PV(t);if(i.push(e,!0),i.err)throw i.msg||CV[i.err];return i.result}PV.prototype.push=function(e,t){var i,r,n,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;r=t===~~t?t:!0===t?RV.Z_FINISH:RV.Z_NO_FLUSH,"string"==typeof e?s.input=AV.binstring2buf(e):"[object ArrayBuffer]"===kV.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new TV.Buf8(c),s.next_out=0,s.avail_out=c),(i=IV.inflate(s,RV.Z_NO_FLUSH))===RV.Z_NEED_DICT&&u&&(i=IV.inflateSetDictionary(this.strm,u)),i===RV.Z_BUF_ERROR&&!0===d&&(i=RV.Z_OK,d=!1),i!==RV.Z_STREAM_END&&i!==RV.Z_OK)return this.onEnd(i),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&i!==RV.Z_STREAM_END&&(0!==s.avail_in||r!==RV.Z_FINISH&&r!==RV.Z_SYNC_FLUSH)||("string"===this.options.to?(n=AV.utf8border(s.output,s.next_out),o=s.next_out-n,a=AV.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&TV.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(TV.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&i!==RV.Z_STREAM_END);return i===RV.Z_STREAM_END&&(r=RV.Z_FINISH),r===RV.Z_FINISH?(i=IV.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===RV.Z_OK):r!==RV.Z_SYNC_FLUSH||(this.onEnd(RV.Z_OK),s.avail_out=0,!0)},PV.prototype.onData=function(e){this.chunks.push(e)},PV.prototype.onEnd=function(e){e===RV.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=TV.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Xx.Inflate=PV,Xx.inflate=NV,Xx.inflateRaw=function(e,t){return(t=t||{}).raw=!0,NV(e,t)},Xx.ungzip=NV;var DV={};(0,IU.assign)(DV,TU,Xx,bV);var MV=DV,LV=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);if(!t)return null;try{var i=JSON.parse(t);return i.ttl>0&&Date.now()-i.saveTime>i.ttl?(this.delete(e),null):i.message}catch(e){return null}},e.prototype.set=function(e,t,i){void 0===i&&(i=-1);var r={ttl:i,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(r)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),UV=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._accessVersion="v2",t}return Z_(t,e),t.prototype.getDeviceId=function(){if(WL())return"";var e=this.get("RTC_DEVICE_ID");return e||(e=bL()),this.set("RTC_DEVICE_ID",e),e},t.prototype.setDeviceId=function(e){return[iB,rB,nB].forEach((function(t){return t.setStats({device_id:e})})),this.set("RTC_DEVICE_ID",e),e},t.prototype.getAccessNode=function(e){return this.get("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus-").concat(this._accessVersion))},t.prototype.setAccessNode=function(e,t,i){},t.prototype.clearAccessNode=function(e){this.delete("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat("RTC_ACCESS_URLS","-BytePlus"))},t.prototype.setAccessUrls=function(e){},t.prototype.clearAccessUrls=function(){this.delete("".concat("RTC_ACCESS_URLS","-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get("RTC_H264_BLACK_LIST")},t.prototype.setH264BlackList=function(e){return this.set("RTC_H264_BLACK_LIST",e)},t.prototype.getAudioProfile=function(){return this.get("engine_BAC")},t.prototype.setAudioProfile=function(e){return this.set("engine_BAC",e)},t.prototype.getServerConfig=function(e){var t,i="".concat(e),r=this.get("SERVER_CONFIG");return(null===(t=null==r?void 0:r.find((function(e){return e.key===i})))||void 0===t?void 0:t.config)||{}},t.prototype.setServerConfig=function(e,t){if(t){var i="".concat(e),r=this.get("SERVER_CONFIG")||[];return r=r.filter((function(e){return e.key!==i})),r.push({key:i,config:t}),this.set("SERVER_CONFIG",r.slice(-5))}},t}(LV),xV=new UV,VV="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function FV(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var BV="rtc.rtcplus.com".split(","),jV={VERSION:"4.45.0-blw.15",ICE_CONFIG_REQUEST_URLS_INTERNAL:VV.map(FV),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:"https://web-log-report.rtcplus.com/video/v1/webrtc_log/",CONFIG_REQUEST_DOMAINS:BV,DEVICE_ID:"",OVERSEA:!1,ENABLE_FALLBACK_HANDLER:!1,ENABLE_STANDARD_HANDLER:!1,PC_KILLSWITCH:{}};function GV(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(jV.ICE_CONFIG_REQUEST_URLS=t.map(FV))):void("LOG_SERVER_URL"!==e||t!==eL.overseas?"LOG_SERVER_URL"!==e||t!==eL.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?"ENABLE_FALLBACK_HANDLER"!==e?"ENABLE_STANDARD_HANDLER"!==e?("DEVICE_ID"===e&&xV.setDeviceId(t),jV[e]=t):jV.ENABLE_STANDARD_HANDLER=t:jV.ENABLE_FALLBACK_HANDLER=t:jV.OVERSEA=t:jV.LOG_SERVER_URL=t:jV.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/":jV.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function HV(e){return"DEVICE_ID"===e?xV.getDeviceId():jV[e]}function zV(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:(null===(i=t.audio)||void 0===i?void 0:i.codec)||WV.audio.codec,bitRate:1e3*((null===(r=t.audio)||void 0===r?void 0:r.kBitRate)||WV.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||WV.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||WV.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||WV.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||WV.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||WV.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||WV.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:WV.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||WV.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||WV.video.width,height:(null===(f=t.video)||void 0===f?void 0:f.height)||WV.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||WV.layout.backgroundColor},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(y=t.layout)||void 0===y?void 0:y.appData)||WV.layout.appData}}}}function KV(e,t,i){var r,n,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(r=i.video)||void 0===r?void 0:r.fps)||15,bitrate:1e3*((null===(n=i.video)||void 0===n?void 0:n.kBitRate)||40),width:(null===(o=i.video)||void 0===o?void 0:o.width)||640,height:(null===(a=i.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=i.layout)||void 0===s?void 0:s.interpolationMode)||rL.PREV_FRAME,canvas:{bgColor:(null===(c=i.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=i.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(l=null===(d=i.layout)||void 0===d?void 0:d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:e.alpha,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var WV={url:"",video:{codec:"H264",width:640,height:360,fps:30,gop:60,kBitRate:600,lowLatency:!0},audio:{codec:"AAC",kBitRate:64,sampleRate:48,channels:2,AACProfile:"LC"},layout:{regions:[],appData:"",backgroundColor:"#000000"}},qV=[{width:320,height:180,frameRate:15,maxKbps:200},{width:640,height:360,frameRate:15,maxKbps:500},{width:640,height:480,frameRate:15,maxKbps:600},{width:960,height:540,frameRate:15,maxKbps:900},{width:1280,height:720,frameRate:15,maxKbps:2e3},{width:1920,height:1080,frameRate:15,maxKbps:3500}];var XV={width:640,height:360,frameRate:30,maxKbps:600},YV={width:1920,height:1080,frameRate:15,maxKbps:3e3},JV={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function r(){}function n(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new n(r,o||e,a),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,r,n=[];if(0===this._eventsCount)return n;for(r in e=this._events)t.call(e,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,a=new Array(o);n<o;n++)a[n]=r[n].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,n,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,n),!0;case 5:return d.fn.call(d.context,t,r,n,o),!0;case 6:return d.fn.call(d.context,t,r,n,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,r);break;case 4:d[u].fn.call(d[u].context,t,r,n);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,r,n){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||n&&!s.once||r&&s.context!==r||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||r&&s[c].context!==r)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}(JV);var QV,ZV,$V,eF,tF,iF,rF,nF,oF,aF,sF,cF,uF,dF,lF,hF,pF,fF,_F,vF,mF,yF,gF,SF,EF,bF,IF,TF,AF,RF,CF,OF,wF,kF,PF,NF,DF,MF,LF,UF,xF,VF,FF,BF,jF,GF,HF,zF=JV.exports,KF=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],WF=!WL()&&window.location.search.includes("_rtc_debug_"),qF=function(){function e(e,t,i){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(window._ve_sdk_cb&&window._ve_sdk_cb.apply(window,ov(["".concat("[VERTC]","[").concat(this._module,".").concat(e,"] ").concat(t.shift())],nv(t),!1)),WF){for(var r="",n=0;n<this._indent;n++)r+=" ";console.log.apply(console,ov(["%c".concat(XF(),"-").concat("[VERTC]").concat(r,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(KF[this._indent],";")],nv(t),!1))}},e}(),XF=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},YF=new qF("VERTC",0),JF=function(e){function t(){return e.call(this)||this}return Z_(t,e),t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];var n=this.listenerCount(t);try{return e.prototype.emit.apply(this,ov([t],nv(i),!1))}catch(e){return YF.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(n)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return tv(this,void 0,void 0,(function(){var i=this;return iv(this,(function(r){return[2,new Promise((function(r,n){try{i.emit.apply(i,ov(ov([e],nv(t),!1),[r,n],!1))}catch(t){YF.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}(JV.exports.EventEmitter);!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",e.RTC_GET_CONFIG="rtc_get_config",e.RTC_RECONNECT="rtc_reconnect",e.RTC_RECONNECTED="rtc_reconnected",e.RTC_GET_ACCESS="rtc_get_access",e.RTC_PRE_ICE_STATE="rtc_pre_ice_state",e.RTC_NODE_CHANGE="rtc_node_change",e.RTC_SIGNALING_MSG_ERROR="rtc_signaling_msg_error",e.RTC_SIGNALING="rtc_signaling",e.RTC_JOIN_ROOM="rtc_join_room",e.RTC_LEAVE_ROOM="rtc_leave_room",e.RTC_BEGIN_CREATE_OFFER="rtc_begin_create_offer",e.RTC_CREATE_OFFER="rtc_create_offer",e.RTC_SET_DESCRIPTION="rtc_set_description",e.RTC_RECV_ANSWER="rtc_recv_answer",e.FIRST_REMOTE_AUDIO_RENDER="first_remote_audio_render",e.FIRST_REMOTE_VIDEO_RENDER="first_remote_video_render",e.RTC_PUBLISH_STAT="rtc_publish_stat",e.RTC_SUBSCRIBE_STAT="rtc_subscribe_stat",e.RTC_AUDIO_DEVICE="rtc_audio_device",e.RTC_MEDIA_STATISTICS="rtc_media_statistics",e.RTC_MESSAGE_STATISTICS="rtc_message_statistics",e.RTC_ERROR="rtc_error",e.RTC_INVOKE_STATUS="rtc_invoke_status",e.RTC_FIRST_FRAME="rtc_first_frame",e.RTC_MUTE_REMOTE="rtc_mute_remote",e.SDK_INIT_ENGINE="sdk_init_engine",e.JOIN_ROOM="join_room",e.P2P_CONNECTION_STATUS="p2p_connection_status",e.P2P_CONNECT_CLOSED="p2p_connect_closed",e.RTC_DEVICE_ERROR="rtc_device_error",e.RTC_VIDEO_DEVICE="rtc_video_device",e.RTC_VIDEO_CAPTURE_EVENT="rtc_video_capture_event",e.RTC_ENCODE_FIRST_FRAME="rtc_encode_first_frame",e.RTC_FIRST_FRAME_ENCODED="rtc_first_frame_encoded",e.RTC_SEND_FIRST_PACKET="rtc_send_first_packet",e.RTC_RECV_FIRST_PACKET="rtc_recv_first_packet",e.RTC_RECV_FIRST_FRAME="rtc_recv_first_frame",e.RTC_DECODE_FIRST_FRAME="rtc_decode_first_frame"}(QV||(QV={})),function(e){e.RTC="rtc"}(ZV||(ZV={})),function(e){e.W_5="5"}($V||($V={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(eF||(eF={})),function(e){e.UNKNOWN="unknown",e.DISCONNECTED="disconnected",e.LAN="lan",e.WIFI="wifi",e.W_2="2g",e.W_3="3g",e.W_4="4g",e.W_5="5g"}(tF||(tF={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(iF||(iF={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(rF||(rF={})),function(e){e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN"}(nF||(nF={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(oF||(oF={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(aF||(aF={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(sF||(sF={})),function(e){e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response"}(cF||(cF={})),function(e){e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED"}(uF||(uF={})),function(e){e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed"}(dF||(dF={})),function(e){e.CALL_JOINROOM="call-joinRoom",e.JOINROOM="joinRoom",e.CALL_RECONNECTED="call-reconnected",e.RECONNECTED="reconnected",e.CALL_PUBLISH="call-publish",e.PUBLISH="publish",e.CALL_UPDATESTREAMATTRIBUTES="call-updateStreamAttributes",e.UPDATESTREAMATTRIBUTES="updateStreamAttributes",e.CALL_UNPUBLISH="call-unpublish",e.UNPUBLISH="unpublish",e.CALL_SUBSCRIBE="call-subscribe",e.SUBSCRIBE="subscribe",e.CALL_UPDATESUBSCRIBE="call-updateSubscribe",e.UPDATESUBSCRIBE="updateSubscribe",e.CALL_UNSUBSCRIBE="call-unsubscribe",e.UNSUBSCRIBE="unsubscribe",e.CALL_UPDATEUSERATTRIBUTES="call-updateUserAttributes",e.UPDATEUSERATTRIBUTES="updateUserAttributes",e.CALL_LEAVEROOM="call-leaveRoom",e.LEAVEROOM="leaveRoom",e.ON_USERCONNECTION="on-userConnection",e.ON_USERDISCONNECTION="on-userDisconnection",e.ON_ONADDSTREAM="on-onAddStream",e.ON_ONPUSHSTREAM="on-onPushStream",e.ON_ONREMOVESTREAM="on-onRemoveStream",e.ON_ONPUSHTRACK="on-onPushTrack",e.ON_ONREMOVETRACK="on-onRemoveTrack",e.ON_ONUPDATEUSERATTRIBUTES="on-onUpdateUserAttributes",e.ON_ONUPDATEROOMATTRIBUTES="on-onUpdateRoomAttributes",e.ON_ONUPDATESTREAMATTRIBUTES="on-onUpdateStreamAttributes",e.ON_STREAMFAILED="on-streamFailed",e.ON_POSTPROCESSINGMESSAGE="on-postProcessingMessage",e.ON_ENGINECONTROLMESSAGE="on-engineControlMessage",e.ON_WEBSOCKETENGINECUSTOMMESSAGE="on-websocketEngineCustomMessage",e.UNKNOWN="unknown",e.CALL_UPDATEPUBLISHSTREAMCHANNEL="call-updatePublishStreamChannel",e.UPDATEPUBLISHSTREAMCHANNEL="updatePublishStreamChannel",e.CALL_UPDATESUBSCRIBESTREAMCHANNEL="call-updateSubscribeStreamChannel",e.UPDATESUBSCRIBESTREAMCHANNEL="updateSubscribeStreamChannel",e.ON_ONSTREAMCHANNELCHANGE="on-onStreamChannelChange",e.P2PDIRECT="p2pdirect",e.INTERNAL_CUSTOM="internal_custom",e.REPORT="report",e.CONNECTION_CONTROL="connection_control",e.ON_INTERNAL_CUSTOM="on_internal_custom",e.CONTROLMESSAGE="controlMessage",e.CALL_LOGIN="call-login",e.LOGIN="login",e.CALL_RECONNECTLOGIN="call-reconnectLogin",e.RECONNECTLOGIN="reconnectLogin",e.CALL_LOGOUT="call-logout",e.LOGOUT="logout",e.CALL_UPDATELOGINTOKEN="call-updateLoginToken",e.UPDATELOGINTOKEN="updateLoginToken",e.CALL_SETSERVERPARAMS="call-setServerParams",e.SETSERVERPARAMS="setServerParams",e.CALL_GETPEERONLINESTATUS="call-getPeerOnlineStatus",e.GETPEERONLINESTATUS="getPeerOnlineStatus",e.ON_ONSCENECONFIG="on-onSceneConfig",e.ON_STREAMCONTROLMESSAGE="on-streamControlMessage",e.CALL_STARTPUSHSTREAM="call-startPushStream",e.STARTPUSHSTREAM="startPushStream",e.CALL_STOPPUSHSTREAM="call-stopPushStream",e.STOPPUSHSTREAM="stopPushStream",e.CALL_STARTPULLSTREAM="call-startPullStream",e.STARTPULLSTREAM="startPullStream",e.CALL_STOPPULLSTREAM="call-stopPullStream",e.STOPPULLSTREAM="stopPullStream",e.CALL_UPDATEPULLSTREAM="call-updatePullStream",e.UPDATEPULLSTREAM="updatePullStream",e.ON_ONSTREAMPUSHEDBYOTHER="on-onStreamPushedByOther",e.CALL_UPDATETOKEN="call-updateToken",e.UPDATETOKEN="updateToken",e.ON_ONTOKENWILLEXPIRE="on-onTokenWillExpire",e.ON_ONPUSHCLIENTCONFIG="on-onPushClientConfig",e.CALL_GETCLIENTCONFIG="call-getClientConfig",e.GETCLIENTCONFIG="getClientConfig"}(lF||(lF={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(hF||(hF={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(pF||(pF={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(fF||(fF={})),function(e){e.W_0="0",e.W_1="1"}(_F||(_F={})),function(e){e.UP="up",e.DOWN="down"}(vF||(vF={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(mF||(mF={})),function(e){e.UP="up",e.DOWN="down"}(yF||(yF={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(gF||(gF={})),function(e){e.W_0="0",e.W_1="1"}(SF||(SF={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown"}(EF||(EF={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(bF||(bF={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish"}(IF||(IF={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(TF||(TF={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(AF||(AF={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(RF||(RF={})),function(e){e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p"}(CF||(CF={})),function(e){e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave"}(OF||(OF={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(wF||(wF={})),function(e){e.BEGIN="begin",e.END="end"}(kF||(kF={})),function(e){e.BEGIN="begin",e.END="end"}(PF||(PF={})),function(e){e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60"}(NF||(NF={})),function(e){e.UNKNOWN="unknown",e.NEW="new",e.CHECKING="checking",e.CONNECTED="connected",e.FAILED="failed",e.SELECTED="selected",e.CLOSING="closing",e.CLOSED="closed",e.UNSELECTED="unselected"}(DF||(DF={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(MF||(MF={})),function(e){e.UNKNOWN="UNKNOWN",e.AUDIO_RECORD="AUDIO_RECORD",e.AUDIO_PLAYOUT="AUDIO_PLAYOUT",e.VIDEO="VIDEO",e.SHARE_AUDIO_RECORD="SHARE_AUDIO_RECORD",e.SHARE_VIDEO="SHARE_VIDEO"}(LF||(LF={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(UF||(UF={})),function(e){e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped"}(xF||(xF={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(VF||(VF={})),function(e){e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort"}(FF||(FF={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(BF||(BF={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(jF||(jF={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(GF||(GF={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(HF||(HF={}));var QF=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(i){t["_"+i]=e[i]})),this.monitor.StartUp()},Object.defineProperty(e.prototype,"event_key",{get:function(){return this._event_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_id",{get:function(){return this._device_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_app_id",{get:function(){return this._rtc_app_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"product_line",{get:function(){return this._product_line},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_version",{get:function(){return this._report_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"os",{get:function(){return this._os},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_version",{get:function(){return this._rtc_sdk_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_timestamp",{get:function(){return this._rtc_timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_git_commit",{get:function(){return this._rtc_sdk_git_commit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_id",{get:function(){return this._report_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connection_id",{get:function(){return this._connection_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sid",{get:function(){return this._rtc_sid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"engine_session_id",{get:function(){return this._engine_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_business_id",{get:function(){return this._rtc_business_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"project_key",{get:function(){return this._project_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"network_type",{get:function(){return this._network_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app_version",{get:function(){return this._app_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aid",{get:function(){return this._aid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_model",{get:function(){return this._device_model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_brand",{get:function(){return this._device_brand},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"common_extra_info",{get:function(){return this._common_extra_info},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"had_selected_p2p",{get:function(){return this._had_selected_p2p},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_env_type",{get:function(){return this._rtc_env_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"room_id",{get:function(){return this._room_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_id",{get:function(){return this._user_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_session_id",{get:function(){return this._rtc_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_agent",{get:function(){return this._user_agent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auto_play_policy",{get:function(){return this._auto_play_policy},enumerable:!1,configurable:!0}),e}(),ZF=function(e){function t(){var t=e.call(this)||this;return t.report_id=0,t.dataBuffer=[],t.posting=!1,t.report_common={},t.modify_ids={},t.preSucTime=0,t.errSendDelay=100,t.commonStats=new QF(t),WL()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return Z_(t,e),t.prototype.push=function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))},t.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},t.prototype.send=function(e,t){var i=this;if(e||this.dataBuffer.length){var r={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},n=new XMLHttpRequest;n.timeout=1e4,n.onreadystatechange=function(){if(4===n.readyState){e||(i.posting=!1);var o=void 0;if(200===n.status||304===n.status)try{o=JSON.parse(n.responseText)}catch(e){}o&&0===o.StatusCode?e||t||i.sucSend():e?i.send(e):(i.unshift(r.data),t?i.send():i.errSend())}};var o=jV.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!WL()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",r),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!WL()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(r));else{var a=MV.gzip(JSON.stringify(r));n.setRequestHeader("Content-Encoding","gzip"),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(a)}}},t.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},t.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},t.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,i=t.event_key,r=t.device_id,n=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,p=t.engine_session_id,f=t.rtc_business_id,_=t.project_key,v=t.network_type,m=t.app_version,y=t.aid,g=t.device_model,S=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,I=t.rtc_env_type,T=t.user_agent,A=t.auto_play_policy;Object.assign(e,{event_key:i,device_id:r,rtc_app_id:n,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:p,rtc_business_id:f,project_key:_,network_type:v,app_version:m,aid:y,device_model:g,device_brand:S,common_extra_info:E,had_selected_p2p:b,rtc_env_type:I,user_agent:T,auto_play_policy:A}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),this.commonStats.connection_id&&(this.modify_ids.connection_id=this.commonStats.connection_id)},t.prototype.rtcSdkApiCall=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});r.streamId&&(n.stream_id=r.streamId),this.push(n)},t.prototype.rtcSdkCallback=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcGetConfig=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,host:r,type:n,config_id:o,enable_cloud_proxy:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcReconnect=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:i,reconnect_type:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcReconnected=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcGetAccess=function(e,t,i,r,n,o,a){void 0===a&&(a={});var s=$_($_({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,type:r,host:n,connect_session_id:o},this.modify_ids),{common_extra_info:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcNodeChange=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignalingMsgError=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignaling=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:i,signaling_type:r,direction:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:i,elapse:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcBeginCreateOffer=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcCreateOffer=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:i,stream_user_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:i,direction:r,stream_id:n,stream_user_id:o,elapse:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcRecvAnswer=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:i,message:r,direction:n,stream_id:o,stream_user_id:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.firstRemoteAudioRender=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.firstRemoteVideoRender=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcPublishStat=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:i,message:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:i,stream_user_id:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcMediaStatistics=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcMessageStatistics=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcError=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcInvokeStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:i,stream_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var i=$_($_($_({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcMuteRemote=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.sdkInitEngine=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.joinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:i,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:i,status:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var i=$_($_({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcDeviceError=function(e,t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v){void 0===v&&(v={});var m=$_($_({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:i,system_error_code:r,system_api:n,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:p,device_vid:f,media_mode:_},this.modify_ids),{common_extra_info:JSON.stringify(v)});this.push(m)},t.prototype.rtcVideoDevice=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var i=$_($_($_({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcEncodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcFirstFrameEncoded=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcSendFirstPacket=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstPacket=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcDecodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t}(JF),$F=new ZF,eB=new ZF,tB=new ZF,iB=$F.commonStats,rB=eB.commonStats,nB=tB.commonStats,oB={default:$F,rtm:eB,outsideRoom:tB};function aB(e){void 0===e&&(e="default");for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return function(i,r,n){if("function"==typeof n.value){var o=n.value;n.value=function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var a={};t.forEach((function(e,t){a[e]=i[t]})),"joinRoom"===r&&iB.setStats({room_id:i[1]}),oB[e].rtcSdkApiCall(r,0,JSON.stringify(uU(i)),a);var s=o.apply(this,i);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return oB[e].rtcSdkCallback(r,0,JSON.stringify(uU([t||{}]))),t})).catch((function(t){throw oB[e].rtcSdkCallback(r,t.code,JSON.stringify(t.message)),t})):(oB[e].rtcSdkCallback(r,0,JSON.stringify(uU([s||{}]))),s)}}}}function sB(e,t,i){var r,n;void 0===i&&(i=0);var o=e===ND.onUserMessageReceivedOutsideRoom||e===ND.onUserBinaryMessageReceivedOutsideRoom;Array.isArray(t)&&(null===(r=t[0])||void 0===r?void 0:r.userId)&&(e="".concat(e,"_").concat(null===(n=t[0])||void 0===n?void 0:n.userId)),(o?eB:$F).rtcSdkCallback(e,i,JSON.stringify(t))}function cB(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=!1),(r?eB:$F).rtcInvokeStatus(JSON.stringify(t),i,e,"",0)}var uB=i(Object.freeze({__proto__:null,Monitor:ZF,monitor:$F,reportRtcSdkApiCall:aB,reportRtcSdkCallback:sB,reportRtcInvokeStatus:cB,get CommonEventKey(){return QV},get CommonProductLine(){return ZV},get CommonReportVersion(){return $V},get CommonOs(){return eF},get CommonNetworkType(){return tF},get RoominfoChannelRole(){return iF},get RtcgetconfigType(){return rF},get RtcreconnectMessage(){return nF},get RtcreconnectReconnectType(){return oF},get RtcreconnectedMessage(){return aF},get RtcreconnectedReconnectType(){return sF},get RtcgetaccessType(){return cF},get RtcpreicestateIceState(){return uF},get RtcsignalingmsgerrorReason(){return dF},get RtcsignalingSignalingEvent(){return lF},get RtcsignalingDirection(){return hF},get RtcbegincreateofferDirection(){return pF},get RtccreateofferDirection(){return fF},get RtcsetdescriptionIsLocal(){return _F},get RtcsetdescriptionDirection(){return vF},get RtcrecvanswerAnswerType(){return mF},get RtcrecvanswerDirection(){return yF},get RtcpublishstatResult(){return gF},get RtcpublishstatIsScreen(){return SF},get RtcpublishstatMessage(){return EF},get RtcsubscribestatResult(){return bF},get RtcsubscribestatMessage(){return IF},get RtcaudiodeviceAudioEvent(){return TF},get FirstframeinfoEventType(){return AF},get FirstframeinfoMediaType(){return RF},get FirstframeinfoType(){return CF},get FirstframeinfoReason(){return OF},get RtcmuteremoteMediaType(){return wF},get SdkinitengineType(){return kF},get JoinroomType(){return PF},get JoinroomReason(){return NF},get P2pconnectionstatusStatus(){return DF},get PerformanceinfoThermalState(){return MF},get RtcdeviceerrorDeviceType(){return LF},get DcusermessageDcMessageType(){return UF},get CaptureeventinfoEventType(){return xF},get CaptureeventinfoType(){return VF},get CaptureeventinfoReason(){return FF},get RtcdeviceerrorScenario(){return BF},get RtcdeviceerrorMediaMode(){return jF},get PerformanceinfoDeviceStatus(){return GF},get CommonRtcEnvType(){return HF},commonStats:iB,rtmCommonStats:rB,rtmMonitor:eB,outsideRoomMonitor:tB,outsideRoomCommonStats:nB})).monitor,dB=!1,lB=[];function hB(){var e;if(dB){var t=[].slice.call(arguments);lB.push(t)}(e=console).log.apply(e,arguments)}function pB(){var e=window.__rtc_engine__,t=e._localVideoTrack,i=e._localAudioTrack;function r(e){if(e){var t=e.getTrack(),i=t.kind,r=t.id.slice(-6);hB(i+"track("+r+").getSettings(): ",t.getSettings()),hB(i+"track("+r+").readyState: ",t.readyState),hB(i+"track("+r+").muted: ",t.muted),hB(i+"track("+r+").enabled: ",t.enabled)}}hB("engine._localVideoTrack: ",e._localVideoTrack),hB("engine._localAudioTrack: ",e._localAudioTrack),r(t),r(i)}function fB(){var e=setInterval((function(){__rtc_engine__._room._mediaServerClient._handler.pc.getStats().then((function(e){var t={};e.forEach((function(i){if("track"===i.type){var r=i.trackIdentifier;__rtc_engine__._room._remoteStreams.forEach((function(n){n.forEach((function(n,o){var a,s;n&&n.videoTrack&&n.videoTrack._mediaTrack&&(n.videoTrack.getTrack().id===r&&(e.forEach((function(e){"inbound-rtp"===e.type&&i.id===e.trackId&&(a=e)})),t[n.userId+"(video-".concat(o,")")]={userId:n.userId+"(video-".concat(o,")"),track:i,inboundRTP:a}));n&&n.audioTrack&&n.audioTrack._mediaTrack&&(n.audioTrack.getTrack().id===r&&(e.forEach((function(e){"inbound-rtp"===e.type&&i.id===e.trackId&&(s=e)})),t[n.userId+"(audio-".concat(o,")")]={userId:n.userId+"(audio-".concat(o,")"),track:i,inboundRTP:s}))}))}));try{if(!__rtc_engine__._room._localStream.videoTrack)return;if(__rtc_engine__._room._localStream.videoTrack.getTrack().id===r){var n;e.forEach((function(e){"outbound-rtp"===e.type&&i.id===e.trackId&&(n=e)}));var o=__rtc_engine__._room._roomInfo.userInfo.userId+" (localVideo)";t[o]={userId:o,track:i,outboundRTP:n}}}catch(e){hB(e)}try{if(!__rtc_engine__._room._localStream.audioTrack)return;if(__rtc_engine__._room._localStream.audioTrack.getTrack().id===r){var a;e.forEach((function(e){"outbound-rtp"===e.type&&i.id===e.trackId&&(a=e)}));var s=__rtc_engine__._room._roomInfo.userInfo.userId+" (localAudio)";t[s]={userId:s,track:i,outboundRTP:a}}}catch(e){hB(e)}}})),hB(t)}))}),1e3);setTimeout((function(){clearInterval(e)}),2e3)}function _B(){return(_B=uI(yI.mark((function e(){var t;return yI.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=window.__rtc_engine__,e.next=3,t.stopVideoCapture();case 3:return e.next=5,t.startVideoCapture();case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vB(){return(vB=uI(yI.mark((function e(){var t;return yI.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=window.__rtc_engine__,e.next=3,t.stopAudioCapture();case 3:return e.next=5,t.startAudioCapture();case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mB(){return(mB=uI(yI.mark((function e(t){var i;return yI.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=window.__rtc_engine__,e.next=3,i.unsubscribeStream(t,3);case 3:return e.next=5,i.subscribeStream(t,3);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yB(){for(var e=window.__rtc_engine__,t=0;t<5;t++)setTimeout((function(){e._room._remoteStreams.forEach((function(e){e.forEach((function(e,t){e&&e.audioTrack&&hB(e.userId+" volume:"+e.audioTrack.getAudioLevel())}))})),hB("local volume: ",e._localAudioTrack.getAudioLevel())}),200*t)}function gB(){var e=window.__rtc_engine__._remoteVideoPlayer;hB("videoplayers: ",e.size,Array.from(e.keys())),e&&e.size>=1&&e.forEach((function(e,t){var i=e._videoDom;hB("videoplayer("+t+(e.isScreen?"_screen":"")+").readyState: ",i.readyState),hB("videoplayer("+t+(e.isScreen?"_screen":"")+").currentTime: ",10*Math.floor(i.currentTime/10)),hB("videoplayer("+t+(e.isScreen?"_screen":"")+").paused: ",i.paused),hB("videoplayer("+t+(e.isScreen?"_screen":"")+").srcObject.id: ",i.srcObject.id),hB("videoplayer("+t+(e.isScreen?"_screen":"")+").srcObject.active: ",i.srcObject.active)}))}function SB(){var e=window.__rtc_engine__._remoteAudioPlayer;e&&e.size>=1&&e.forEach((function(e,t){var i=e._audioDom;hB("audioplayer("+t+").readyState: ",i.readyState),hB("audioplayer("+t+").currentTime: ",i.currentTime),hB("audioplayer("+t+").paused: ",i.paused),hB("audioplayer("+t+").srcObject.id: ",i.srcObject.id),hB("audioplayer("+t+").srcObject.active: ",i.srcObject.active)}))}function EB(e){if(!e)return!1;var t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.backgroundColor="rgba(0, 0, 0, 0.2)",t.style.color="wheat",t.style.zIndex="9999999",t.style.pointerEvents="none",document.body.insertBefore(t,document.body.firstChild),window.counter=0,window.panel=t;try{var i=localStorage.getItem("ve_crash_log"),r=URL.createObjectURL(new Blob([i])),n=document.createElement("a");n.download="ve_crash_log.log",n.href=r,n.click(),localStorage.removeItem("ve_crash_log")}catch(e){}function o(e){var t=localStorage.getItem("ve_crash_log");localStorage.setItem("ve_crash_log",t+"\r\n"+e)}window._ve_sdk_cb=function(){var e,t=Array.prototype.slice.call(arguments);try{e=JSON.stringify(t)}catch(t){e="JSON.stringify failed"}e.length>1e3&&(e=e.slice(0,1e3)+"... <too large to show>"),e="seq".concat(window.counter++," - ").concat(e);var i=document.createElement("div");i.style.whiteSpace="nowrap",i.innerHTML=e,panel.childNodes.length>20&&panel.removeChild(panel.childNodes[0]),window.panel.append(i);try{o(e)}catch(e){}}}window.location.search.includes("adp")?EB(!0):EB(!1);var bB=function(){var e=new Date;return e.toDateString().replaceAll(" ","_")+"-"+e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()};window.rvc=function(){return _B.apply(this,arguments)},window.rac=function(){return vB.apply(this,arguments)},window.rs=function(e){return mB.apply(this,arguments)},window.wrv=gB,window.wra=SB,window.wlt=pB,window.ws=function(){var e=window.__rtc_engine__;if(e._room){var t=[];try{t=e._room._mediaServerClient.handler.pc.getSenders()}catch(e){t=[]}hB("senders: ",t.length,";empty senders: ",t.filter((function(e){return!!e.track})).length),t.forEach((function(e,t){var i=e.track,r=Object.assign({},e.getParameters());(r.transactionId&&delete r.transactionId,i)?hB(i.kind+"sender("+i.id.slice(-6)+").getParameters(): ",r):hB("emptysender("+t+").getParameters(): ",r)}))}},window.ss5=fB,window.gv5=yB,window.ap=EB,window.dv=function(e,t,i,r){var n=[],o=null,a=!1,s=__rtc_engine__._room.roomInfo.userInfo.userId,c=function(r,s){if(e===r){if("key"===s.type&&(a=!0,o||(hB(" ============ start dump ============="),o=setTimeout(u,1e3*(t||7)))),i&&!a)return;hB("dump video: ",s),n.push(new Uint8Array(s.data))}},u=function(){__rtc_engine__._room._remoteStreams.get(e)[0].off("onTransformData",c);var t=n.reduce((function(e,t){return e+t.byteLength}),0);hB("byteLength: ",t);var i=n.reduce((function(e,t){return e.data.set(t,e.offset),e.offset+=t.byteLength,e}),{data:new Uint8Array(t),offset:0}),o=i.data.reduce((function(e,t){return e+String.fromCharCode(t)}),""),a=window.btoa(o);console.log("base64str:",a),uB.rtcInvokeStatus(a,0,"dumpVideo_".concat(s,"_sub_").concat(e,"_").concat(bB()),"",0);var u=URL.createObjectURL(new Blob([i.data])),d=document.createElement("a");d.download="dumpVideo_".concat(s,"_sub_").concat(e,"_").concat(bB(),".").concat(r||"h264"),d.href=u,d.click()};__rtc_engine__._room._remoteStreams.get(e)[0].on("onTransformData",c),i||(o=setTimeout(u,1e3*(t||7)))},window.cs=function(){dB=!0,setTimeout((function(){console.log(lB);var e=[],t=JSON.stringify(lB,(function(t,i){if("object"===vs(i)&&null!==i){if(-1!==e.indexOf(i))return;e.push(i)}return i}));e=null,console.log(t.length),uB.rtcInvokeStatus(t,0,"console.monitor","",0),lB=[]}),1e4);try{gB()}catch(e){}try{SB()}catch(e){}try{pB()}catch(e){}try{fB()}catch(e){}try{yB()}catch(e){}},Rm("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Fm);var IB=jr,TB=T,AB=me,RB=De,CB=Zi,OB=Go,wB=a,kB=fT,PB=Un,NB=KN,DB=WN,MB=te,LB=XN,UB=[],xB=TB(UB.sort),VB=TB(UB.push),FB=wB((function(){UB.sort(void 0)})),BB=wB((function(){UB.sort(null)})),jB=PB("sort"),GB=!wB((function(){if(MB)return MB<70;if(!(NB&&NB>3)){if(DB)return!0;if(LB)return LB<603;var e,t,i,r,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(r=0;r<47;r++)UB.push({k:t+r,v:i})}for(UB.sort((function(e,t){return t.v-e.v})),r=0;r<UB.length;r++)t=UB[r].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));IB({target:"Array",proto:!0,forced:FB||!BB||!jB||!GB},{sort:function(e){void 0!==e&&AB(e);var t=RB(this);if(GB)return void 0===e?xB(t):xB(t,e);var i,r,n=[],o=CB(t);for(r=0;r<o;r++)r in t&&VB(n,t[r]);for(kB(n,function(e){return function(t,i){return void 0===i?-1:void 0===t?1:void 0!==e?+e(t,i)||0:OB(t)>OB(i)?1:-1}}(e)),i=n.length,r=0;r<i;)t[r]=n[r++];for(;r<o;)delete t[r++];return t}});var HB=jr,zB=Mn.findIndex,KB=ko,WB=!0;"findIndex"in[]&&Array(1).findIndex((function(){WB=!1})),HB({target:"Array",proto:!0,forced:WB},{findIndex:function(e){return zB(this,e,arguments.length>1?arguments[1]:void 0)}}),KB("findIndex");var qB,XB,YB=Mn.every;jr({target:"Array",proto:!0,forced:!Un("every")},{every:function(e){return YB(this,e,arguments.length>1?arguments[1]:void 0)}}),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED",e.PUBLIC_STREAM_DECODE_FAILED="PUBLIC_STREAM_DECODE_FAILED"}(qB||(qB={})),function(e){e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK"}(XB||(XB={}));var JB=function(e,t,i){this.code=e,this.message=t,this.error=i};function QB(e,t){if("boolean"!=typeof e)throw new JB(qB.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function ZB(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),e<i||e>r||"number"!=typeof e)throw new JB(qB.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(i,", ").concat(r,"]. integer only"))}function $B(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),null==e)throw new JB(qB.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,i){void 0===t&&(t=1);void 0===i&&(i=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=i&&e.length>=t}(e,i,r))throw new JB(qB.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(i,",").concat(r,"]"))}function ej(e,t,i){if(!i.includes(e))throw new JB(qB.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(i)))}function tj(e,t){if(rj(e))throw new JB(qB.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function ij(e,t){if(!(e instanceof ArrayBuffer))throw new JB(qB.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function rj(e){return null==e}function nj(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new JB(qB.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function oj(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new JB(qB.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function aj(e){tj(e,"videoPlayerOption")}function sj(e,t){var i,r;if(void 0===t&&(t=64),!e||0===(null===(i=e)||void 0===i?void 0:i.byteLength))throw new JB(qB.INVALID_PARAMS,"The message cannot be empty");if((null==(r=e instanceof ArrayBuffer?e:qL.str2ab(JSON.stringify(e)))?void 0:r.byteLength)>1e3*t)throw new JB(qB.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function cj(e){return![ND.onRemoteStreamStats,ND.onLocalStreamStats,ND.onAudioVolumeIndication,ND.onLocalAudioPropertiesReport,ND.onRemoteAudioPropertiesReport].includes(e)}var uj=Ue,dj=function(e){return void 0!==e&&(uj(e,"value")||uj(e,"writable"))},lj=l,hj=G,pj=Nt,fj=dj,_j=o,vj=Zp;jr({target:"Reflect",stat:!0},{get:function e(t,i){var r,n,o=arguments.length<3?t:arguments[2];return pj(t)===o?t[i]:(r=_j.f(t,i))?fj(r)?r.value:void 0===r.get?void 0:lj(r.get,o):hj(n=vj(t))?e(n,i,o):void 0}});var mj=jr,yj=l,gj=Nt,Sj=G,Ej=dj,bj=Rt,Ij=o,Tj=Zp,Aj=y;var Rj,Cj,Oj,wj,kj,Pj,Nj,Dj,Mj,Lj,Uj,xj=a((function(){var e=function(){},t=bj.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));mj({target:"Reflect",stat:!0,forced:xj},{set:function e(t,i,r){var n,o,a,s=arguments.length<4?t:arguments[3],c=Ij.f(gj(t),i);if(!c){if(Sj(o=Tj(t)))return e(o,i,r,s);c=Aj(0)}if(Ej(c)){if(!1===c.writable||!Sj(s))return!1;if(n=Ij.f(s,i)){if(n.get||n.set||!1===n.writable)return!1;n.value=r,bj.f(s,i,n)}else bj.f(s,i,Aj(0,r))}else{if(void 0===(a=c.set))return!1;yj(a,s,r)}return!0}}),function(e){e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted"}(Rj||(Rj={})),function(e){e.PushLimitWarn="PushLimitWarn"}(Cj||(Cj={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig",e.ON_STREAM_FAILED="streamFailed"}(Oj||(Oj={})),function(e){e.RSCP="RSCP"}(wj||(wj={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(kj||(kj={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(Pj||(Pj={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(Nj||(Nj={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(Mj||(Mj={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(Lj||(Lj={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.EXCEED_MAX_LENGTH=103]="EXCEED_MAX_LENGTH",e[e.EMPTY_USER=104]="EMPTY_USER",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN"}(Uj||(Uj={}));var Vj,Fj,Bj=((Dj={})[Uj.SUCCESS]=[0,"success"],Dj[Uj.TIMEOUT]=[qB.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],Dj[Uj.BROKEN]=[qB.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],Dj[Uj.NO_RECEIVER]=[qB.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],Dj[Uj.NO_RELAYPATH]=[qB.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],Dj[Uj.SEND_TO_SERVER_ERROR]=[qB.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],Dj[Uj.SERVER_RESPONSE_ERROR]=[qB.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],Dj[Uj.NOT_JOIN]=[qB.USER_MESSAGE_NOT_JOIN,"not join room"],Dj[Uj.INIT]=[qB.USER_MESSAGE_INIT,"not init."],Dj[Uj.NO_CONNECTION]=[qB.USER_MESSAGE_NO_CONNECTION,"no connection."],Dj[Uj.EXCEED_MAX_LENGTH]=[qB.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],Dj[Uj.EMPTY_USER]=[qB.USER_MESSAGE_EMPTY_USER,"user id is empty."],Dj[Uj.NOT_LOGIN]=[qB.USER_MESSAGE_NOT_LOGIN,"not login."],Dj[Uj.SERVER_PARAMS_NOTSET]=[qB.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],Dj[Uj.UNKNOWN]=[qB.USER_MESSAGE_UNKNOWN,"unknown."],Dj),jj=new qF("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(Vj||(Vj={})),function(e){e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM"}(Fj||(Fj={}));var Gj=function(e){function t(t){var i=e.call(this)||this;return i._dataChannel=t,i._singlingCache=new Map,i._p2pCache=new Map,i._rttIds={},i._p2pMessageId=0,i._clearDataChannelListener=i._handleHandler(),window.__rtc_mock_signaling__=i.emit.bind(i),i}return Z_(t,e),t.prototype.destroy=function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}},t.prototype.sendSignaling=function(e,t,i){var r=this;return $F.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",hF.UP),new Promise((function(n,o){var a=r._genHeader(i);a.id=aU();var s=a.id.join("-"),c=setTimeout((function(){r._singlingCache.delete(s),o(new JB(qB.TIME_OUT,"".concat(e," message time out")))}),6e4);r._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),n(e)},error:function(e){clearTimeout(c),o(e)}}),jj.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),r._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:Fj.C2GW})},t.prototype.sendP2PMessage=function(e,t){var i=e.msg,r=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i}(e,["msg"]);return tv(this,void 0,void 0,(function(){var e,n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:return e=i instanceof ArrayBuffer,n=this._sendP2PMessage,o=[$_({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:Mj.SEND,type:Lj.P2P,err:Uj.SUCCESS},r)],s={binary:e},e?[4,qL.ab2b64str(i)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=i,c.label=3;case 3:return[2,n.apply(this,[$_.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var i=this;return void 0===t&&(t={}),cU(e.msg)?this._rttIds[e.id]=e.id:e.dir===Mj.SEND&&jj.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(r,n){var o=i._genHeader($_($_({needAck:!0,functionType:Fj.C2C},t),{id:aU()}));if(e.dir===Mj.SEND){var a=setTimeout((function(){i._p2pCache.delete(e.id),n(new JB(qB.TIME_OUT,"P2P message timeout"))}),6e4);i._p2pCache.set(e.id,{success:function(e,t){clearTimeout(a),r(t)},error:function(e){clearTimeout(a);var t=nv(Bj[e.err]||[qB.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),i=t[0],r=t[1];n({code:i,message:e.msg||r})}})}i._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,i){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new JB(qB.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var r=t.version+(+t.zip<<5)+(+t.encrypt<<6),n=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=qL.str2ab(JSON.stringify([e,i])),a=KL(Uint8Array,ov([r,n],nv(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),i=0,r=t[i++],n=t[i++],o={version:15&r,zip:16==(16&r),encrypt:32==(32&r),needAck:1==(1&n),direction:(2&n)>>1,functionType:(60&n)>>2,binary:64==(64&n)};if(o.needAck||o.direction===Vj.ACK){for(;i<=6;i++)if(128!=(128&t[i])){i++;break}o.id=Array.from(t.slice(2,i))}return{header:o,data:t.slice(i)}},t.prototype._feedbackSignaling=function(e,t){var i=this._genHeader({needAck:!0,direction:Vj.ACK,id:e.split("-").map((function(e){return+e}))});jj.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),i,"")},t.prototype._handleMessage=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,P,N,D,M,L,U,x;return iv(this,(function(V){switch(V.label){case 0:r=this._dispartData(e),n=r.header,o=r.data,n.zip&&((a=new MV.Inflate).push(o,!0),o=a.result),s=qL.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&$F.rtcSignalingMsgError(-1,e.message,dF.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case Fj.C2S:return[3,1];case Fj.C2C:return[3,6];case Fj.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==Vj.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],jj.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,qL.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=V.sent(),V.label=4;case 4:this.emit(d,$_({},c)),$F.rtcSignaling(0,s,"on-".concat(d),"Recv",hF.DOWN),V.label=5;case 5:return[3,19];case 6:switch(Array.isArray(c)&&(c=c[1]),h=null==c?void 0:c.id,this._rttIds[h]||(null==c?void 0:c.dir)===Mj.FEEDBACK||cU(null==c?void 0:c.msg)?delete this._rttIds[h]:jj.print("Signal","<<<<<< p2p response",c),c.dir){case Mj.SEND:return[3,7];case Mj.FEEDBACK:return[3,16]}return[3,17];case 7:return cU(null==c?void 0:c.msg)?[3,15]:(f=(p=c).binary,_=p.msg,v=p.room,m=p.to,y=p.from,g=""===v?f?Oj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:Oj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:f?Oj.USER_BINARY_MESSAGE_RECEIVED:Oj.USER_MESSAGE_RECEIVED,m?[3,11]:(S=this.emit,E=[Oj.ON_CUSTOM_MESSAGE],U={clientId:y,binary:f},f?[4,qL.b64str2ab(_)]:[3,9]));case 8:return b=V.sent(),[3,10];case 9:b=_,V.label=10;case 10:return S.apply(this,E.concat([(U.message=b,U)])),[3,15];case 11:return I=this.emit,T=[g],A=[$_({},c)],x={},f?[4,qL.b64str2ab(_)]:[3,13];case 12:return R=V.sent(),[3,14];case 13:R=_,V.label=14;case 14:I.apply(this,T.concat([$_.apply(void 0,A.concat([(x.msg=R,x)]))])),V.label=15;case 15:return this._sendP2PMessage($_($_({},c),{dir:Mj.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===Uj.SUCCESS?C.success(c.id,c):C.error(c)),[3,17];case 17:return[3,19];case 18:if(n.direction===Vj.ACK)O=(null===(i=n.id)||void 0===i?void 0:i.join("-"))||"",this._handleAckMessage(O,c[0]||{},s);else if(w=nv(c,2),k=w[0],P=w[1],N=void 0===P?{}:P,"RXMediaMsg"===k&&(D=N.type,M=N.data,$F.rtcSignaling(0,s,"on-".concat(D),"Recv",hF.DOWN),"RSCP"===D))try{L=JSON.parse(M),Array.isArray(L)&&this.emit(D,L)}catch(e){}V.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){jj.print("_handleHandler","dataChannel close",t),e.emit("close",t)},i=function(t){jj.print("_handleHandler","dataChannel error",t),e.emit("close",t)},r=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",i),this._dataChannel.addEventListener("message",r),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",i),e._dataChannel.removeEventListener("message",r)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),$_({version:2,zip:!1,encrypt:!1,needAck:!0,direction:Vj.SEND,functionType:Fj.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,i){var r=this._singlingCache.get(e);r&&(this._singlingCache.delete(e),200===t.code?r.success(t):r.error(t),jj.print("Signal","<<<<<< [".concat(r.signalingType,"-ack]"),t)),$F.rtcSignaling(0,i,null==r?void 0:r.signalingType,"Ack",hF.DOWN)},t}(JV.exports.EventEmitter),Hj=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,i=e.method,r=e.url,n=e.body,o=void 0===n?{}:n,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,n){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(i,r,!0);try{for(var l=rv(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=nv(h.value,2),f=p[0],_=p[1];d.setRequestHeader(f,_)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(a)throw a.error}}d.onreadystatechange=function(){4===d.readyState&&(t.isSending=!1,200===d.status?e(JSON.parse(d.responseText)):n({message:d.statusText,code:d.status})),0===d.status&&n({code:0,message:"Request abort"})},d.onerror=function(e){t.isSending=!1,n({code:-1,message:d.responseText||"unknown"})},t.timeout&&(d.timeout=t.timeout),u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,i,r){return this.ajax({method:"POST",url:e,body:t,headers:i,stringify:r})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),zj=new qF("ICE Request",3),Kj=function(){function e(){this._request=new Hj}return e.prototype.getAccessNode=function(e,t,i,r,n,o,a){return tv(this,void 0,void 0,(function(){var s;return iv(this,(function(c){return(s=xV.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,i,r,n,o,a),cB("es.R.node.cache",s),Array.isArray(s)?[2,Promise.resolve(s)]:[2,Promise.resolve([s])]):[2,this.getAccessNodeFromServer(e,t,i,r,n,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,i,r,n,o,a){return tv(this,void 0,void 0,(function(){var s,c,u=this;return iv(this,(function(d){return s=xV.getAccessUrls(),c=!0,cB("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=jV.ICE_CONFIG_REQUEST_URLS,c=!1,cB("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=jV.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,cB("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,i,r,n,o,a).then((function(t){var i=t.nodes;return xV.setAccessNode(e,i,t.ttl||11200),t.dispatchDomains&&xV.setAccessUrls(t.dispatchDomains),i})).catch((function(s){if(c)return cB("es.R.req.fallback",""),xV.clearAccessUrls(),u.getAccessNodeFromServer(e,t,i,r,n,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,i,r,n,o,a,s){var c;return tv(this,void 0,void 0,(function(){var i,u,d,l=this;return iv(this,(function(h){return i={appID:t,userID:r,deviceID:n,connectSessionID:HL(),os:"web",sdkVersion:jV.VERSION,isOversea:jV.OVERSEA,expectedAddr:HV("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s,accessParams:JSON.stringify({requireICEUfragV2:!0})},o&&a&&(i.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NODE_CHANGED",reason:o}}],delete i.expectedAddr),u=Date.now(),$F.rtcGetAccess(0,JSON.stringify(i),0,cF.REQUEST,e.join(","),i.connectSessionID),d=e.map((function(e,t){return tv(l,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,i)];case 1:return r=a.sent(),[3,3];case 2:throw n=a.sent(),new JB(qB.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==r.code)throw new JB(qB.ICE_SERVER_WRONG,"get ICE config failed",{server_code:r.code,message:JSON.stringify(r)});if(!(o=r.nodes[0]))throw new JB(qB.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:r.code,message:JSON.stringify(r)});return[2,{result:r,firstNode:o,index:t}]}}))}))})),[2,lU(d).then((function(t){var r=t.result;t.firstNode;var n=t.index;return $F.rtcGetAccess(200,JSON.stringify(r),Date.now()-u,cF.RESPONSE,e[n],i.connectSessionID),r})).catch((function(t){var r,n,o=null===(r=t[0])||void 0===r?void 0:r.error;throw $F.rtcGetAccess(+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),null===(n=t[0])||void 0===n?void 0:n.message,Date.now()-u,cF.RESPONSE,e.join(","),i.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(zj.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),Wj=function(){function e(){this._request=new Hj}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.45.0-blw.15",deviceType:"web"};this._request.timeout=800;var i=jV.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));$F.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),rF.REQUEST,"",!1);var r=i.map((function(i,r){return tv(e,void 0,void 0,(function(){var e;return iv(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new JB(qB.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new JB(qB.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){lU(r).then((function(t){var r=t.result,n=t.index;xV.setH264BlackList(r.web_h264_black_list),$F.rtcGetConfig(200,JSON.stringify(r),0,i[n],rF.RESPONSE,"",!1),e(r.web_h264_black_list)})).catch((function(t){$F.rtcGetConfig(500,t.message,0,"",rF.RESPONSE,"",!1),e(xV.getH264BlackList()||[])}))}))},e.prototype.getAudioProfile=function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.45.0-blw.15",deviceType:"web"},i=jV.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));$F.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),rF.REQUEST,"",!1);var r=i.map((function(i,r){return tv(e,void 0,void 0,(function(){var e;return iv(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new JB(qB.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.engine_BAC))throw new JB(qB.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){lU(r).then((function(t){var r=t.result,n=t.index;xV.setAudioProfile(r.engine_BAC),$F.rtcGetConfig(200,JSON.stringify(r),0,i[n],rF.RESPONSE,"",!1),e(r.engine_BAC)})).catch((function(t){$F.rtcGetConfig(500,t.message,0,"",rF.RESPONSE,"",!1),e(xV.getAudioProfile()||[])}))}))},e.prototype.getWebRtcConfig=function(e){var t=this,i=e.appId,r=e.deviceId,n={keys:["web_rtc_config"],labelSelector:"",sdkVersion:"4.45.0-blw.15",deviceType:"web",appId:i,deviceId:r,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0},o=jV.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));$F.rtcGetConfig(0,JSON.stringify(n),0,o.join(","),rF.REQUEST,"",!1);var a=o.map((function(e,i){return tv(t,void 0,void 0,(function(){var t;return iv(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._request.post(e,n)];case 1:return t=r.sent(),[3,3];case 2:throw r.sent(),new JB(qB.ICE_SERVER_WRONG,"get config failed");case 3:return[2,{result:t,index:i}]}}))}))}));return new Promise((function(e){lU(a).then((function(t){var r=t.result,n=t.index;xV.setServerConfig(i,r),$F.rtcGetConfig(200,JSON.stringify(r),0,o[n],rF.RESPONSE,"",!1),e(r.web_rtc_config)})).catch((function(t){$F.rtcGetConfig(500,t.message,0,"",rF.RESPONSE,"",!1),e(xV.getServerConfig(i).web_rtc_config||{})}))}))},e}();function qj(e,t){var i=1,r=e;(e.width>t.width||e.height>t.height)&&(i=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,r={width:Math.floor(e.width/i),height:Math.floor(e.height/i)});return $_($_({},r),{scaleResolutionDownBy:i})}var Xj=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],Yj=[{width:1920,height:1080,maxLayers:3,totalPixels:2073600},{width:1280,height:720,maxLayers:3,totalPixels:921600},{width:960,height:540,maxLayers:3,totalPixels:518400},{width:640,height:360,maxLayers:2,totalPixels:230400},{width:480,height:270,maxLayers:2,totalPixels:129600},{width:320,height:180,maxLayers:1,totalPixels:57600},{width:0,height:0,maxLayers:1,totalPixels:0}];var Jj={width:160,height:90,frameRate:15,maxkbps:100},Qj={width:480,height:270,frameRate:15,maxkbps:400};function Zj(e){if(!e.length)return[];var t=e.shift(),i=t.width/t.height,r=0,n=0,o=$_($_({},t),{video_index:n,sub_index:r++});delete o.rid;for(var a=[o],s=0,c=0;c<Xj.length;c++)if(Xj[c].height<t.height){s=c;break}var u=e.shift();for(c=s;c<Xj.length;c++){var d=Xj[c];if(u&&d.height<=(null==u?void 0:u.height)){var l=d.height===(null==u?void 0:u.height),h=$_($_({},u),{video_index:++n,sub_index:r++});if(delete h.rid,a.push(h),u=e.shift(),l)continue}a.push($_($_({},d),{width:Math.floor(d.height*i),video_index:n,sub_index:r++}))}return a}var $j,eG,tG,iG,rG=new Map,nG=function(e){return tv(void 0,void 0,void 0,(function(){return iv(this,(function(t){return[2,new Promise((function(t,i){if("chrome-stable"===XL()&&void 0===window.InstallTrigger)try{e.getStats((function(e){var i=[];e.result().forEach((function(e){if(!dG.includes(e.type)){var t={};e.names().forEach((function(i){t[i]=e.stat(i)})),i.push($_($_({},t),{id:e.id,type:e.type,timestamp:e.timestamp}))}})),t({all:i,getTrackStats:function(e){return i.filter((function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})}))}catch(e){i(e)}else t({all:[],getTrackStats:function(){return[]}})}))]}))}))},oG=function(e){return tv(void 0,void 0,void 0,(function(){var t,i,r,n,o,a;return iv(this,(function(s){switch(s.label){case 0:return[4,e.getStats()];case 1:return t=s.sent(),i={all:[]},r=new Map,t.forEach((function(e){var t=r.get(e.type)||new Map;t.set(e.id,e),r.set(e.type,t),i.all.push(e)})),n=function(e,t){e.forEach((function(e){var i,n,o,a,s,c,u,d,l,h,p=e.codecId,f=e.transportId,_=e.trackId,v=e.playoutId;if(null===(i=r.get($j.codec))||void 0===i||i.forEach((function(e){e.id===p&&t.add(e)})),null===(n=r.get($j.transport))||void 0===n||n.forEach((function(e){e.id===f&&(l=e,t.add(e))})),null===(o=r.get($j.track))||void 0===o||o.forEach((function(e){e.id===_&&t.add(e)})),null===(a=r.get($j.mediaPlayout))||void 0===a||a.forEach((function(e){e.id===v&&t.add(e)})),l){var m=l.localCertificateId,y=l.remoteCertificateId,g=l.selectedCandidatePairId;null===(s=r.get($j.certificate))||void 0===s||s.forEach((function(e){(e.id===m||e.id===y)&&t.add(e)})),null===(c=r.get($j.candidatePair))||void 0===c||c.forEach((function(e){e.id===g&&(h=e,t.add(e))}))}if(h){var S=h.localCandidateId,E=h.remoteCandidateId;null===(u=r.get($j.localCandidate))||void 0===u||u.forEach((function(e){e.id===S&&t.add(e)})),null===(d=r.get($j.remoteCandidate))||void 0===d||d.forEach((function(e){e.id===E&&t.add(e)}))}}))},null===(o=r.get($j.mediaSource))||void 0===o||o.forEach((function(e){var t,o=new Set;o.add(e);var a=[];null===(t=r.get($j.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(o.add(t),a.push(t),null===(i=r.get($j.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&o.add(e)})))})),n(a,o),i[e.trackIdentifier]=Array.from(o)})),null===(a=r.get($j.inboundRtp))||void 0===a||a.forEach((function(e){var t,o,a=new Set;a.add(e),null===(t=r.get($j.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&a.add(t)})),n([e],a);var s=e.trackIdentifier;s||null===(o=r.get($j.track))||void 0===o||o.forEach((function(t){t.id===e.trackId&&(s=t.trackIdentifier)})),i[s]=Array.from(a)})),[2,i]}}))}))},aG=function(e,t,i){return tv(void 0,void 0,void 0,(function(){var r,n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:return r=null==t?void 0:t.id,e instanceof RTCPeerConnection?((!(n=rG.get(e))||Date.now()-n.timestamp>100)&&(n={timestamp:Date.now(),statsPromise:oG(e),extraStatsPromise:yU?nG(e):Promise.resolve(void 0)},rG.set(e,n)),[4,n.statsPromise]):[2,[]];case 1:return o=c.sent(),a=(r?o[r]:o.all)||[],i||!yU?[3,3]:[4,n.extraStatsPromise];case 2:(s=c.sent())&&(a=a.concat((r?s.getTrackStats(r):s.all)||[])),c.label=3;case 3:return[2,a]}}))}))};XL(),function(e){e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server",e.mediaPlayout="media-playout"}($j||($j={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(eG||(eG={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(tG||(tG={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(iG||(iG={}));var sG,cG,uG,dG=["codec","inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","media-source","csrc","peer-connection","data-channel","stream","track","transceiver","sender","receiver","transport","sctp-transport","candidate-pair","local-candidate","remote-candidate","certificate","ice-server"];!function(e){e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX"}(sG||(sG={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(cG||(cG={})),function(e){e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED"}(uG||(uG={}));var lG,hG=function(){return tv(void 0,void 0,void 0,(function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p;return iv(this,(function(f){switch(f.label){case 0:if(lG)return[2,lG];e=[],f.label=1;case 1:return f.trys.push([1,5,,6]),[4,dU()];case 2:if(!(t=f.sent()))return[2,e];i=t.split("\n"),r=!1;try{for(n=rv(i),o=n.next();!o.done;o=n.next())if((a=o.value).includes("level-asymmetry-allowed=1")&&a.includes("packetization-mode=1")&&a.includes("profile-level-id=42e0")){r=!0;break}}catch(e){h={error:e}}finally{try{o&&!o.done&&(p=n.return)&&p.call(n)}finally{if(h)throw h.error}}return r?(s=navigator.userAgent.toLowerCase(),c=!1,u=["mqqbrowser","miuibrowser"],[4,(new Wj).getH264BlackList()]):[3,4];case 3:for(d=f.sent(),u.push.apply(u,ov([],nv(d),!1)),l=0;l<u.length;l++)s.includes(u[l])&&(c=!0);!c&&e.push("H264"),f.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),lG=e,[2,e];case 5:return f.sent(),[2,e];case 6:return[2]}}))}))},pG=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},fG=new qF("BasicHandler",3),_G=pG(),vG={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function mG(e){return Math.ceil(e)}var yG=function(e){function t(t,i){var r=e.call(this)||this;return r._offerIce={},r._answerIce={},r._initSctpEvents=!1,r.monitor=t,r._peerConnection=new RTCPeerConnection(gG(i)),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=i,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,i;fG.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){fG.print("constructor","onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ").concat(r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var e=r._peerConnection.iceConnectionState;t.rtcPreIceState(e,uF["".concat(e.toUpperCase())])},r}return Z_(t,e),t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){fG.print("destroy"),this.disconnect(),this._context=void 0},t.prototype._simulcast=function(e,t,i,r,n){var o=[];1===e.videoEncodeConfig.length?(o=function(e,t){var i=[];if(t<=1)return i;var r=1,n=1;return e.width/e.height>16/9?(r=e.width/Jj.width,n=e.width/Qj.width):(r=e.height/Jj.height,n=e.height/Qj.height),i.push({maxkbps:Jj.maxkbps,scaleResolutionDownBy:r,frameRate:Jj.frameRate,width:Math.floor(e.width/r),height:Math.floor(e.height/r)}),t<=2||r>2&&i.unshift({maxkbps:Qj.maxkbps,scaleResolutionDownBy:n,frameRate:Qj.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),i}(t,n),fG.print("simulcast() ","simulcastLayers: %o",o)):(o=e.videoEncodeConfig.slice(1).slice(1-n).map((function(e){return $_({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},qj(t,e))})),fG.print("simulcast() ","simulcastLayers2: %o",o)),o.forEach((function(e,t){var n={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:mG(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};i.sendEncodings&&i.sendEncodings.unshift(n),r.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))},t.prototype.internalPublish=function(e,t){var i=e.stream,r=e.videoTrack,n=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,c={direction:"sendonly",streams:[i]},u={direction:"sendonly",streams:[i]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==r?void 0:r.getTrack(),p={width:640,height:360,frameRate:30};if(h){var f=null==h?void 0:h.getSettings();p={width:Math.floor(f.width),height:Math.floor(f.height),frameRate:Math.floor(f.frameRate)}}var _=null==e?void 0:e.videoEncodeConfig[0],v=qj(p,_);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=p;var m={maxBitrate:1e3*_.maxKbps,scaleResolutionDownBy:mG(v.scaleResolutionDownBy),rid:"0",maxFramerate:_.frameRate||15};if(u.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:_.frameRate,maxkbps:_.maxKbps,rid:"0"}),o){var y=function(e){for(var t=0,i=e.width*e.height,r=0;r<Yj.length;r++)if(i>=Yj[r].totalPixels){t=r;break}if(0===t)return Yj[t].maxLayers;var n=Yj[t-1].totalPixels;return(n-i)/(n-Yj[t].totalPixels)<.1?Yj[t-1].maxLayers:Yj[t].maxLayers}(v);fG.print("simulcast() ","maxLayers: %o",y),y>1&&(this._simulcast(e,p,u,d,y),(null==t?void 0:t.simulcastOnDemand)&&(l=Zj(ov([],nv(d),!1))),fG.print("subVideoDesc","desc: %o ",l))}}fG.print("publish videoTransceiverInit videoDescriptions","",u,d);var g=null==n?void 0:n.getTrack();(null==n?void 0:n.mixType)!==cG.PLAYOUT&&(null==n?void 0:n.mixedAudioTrack)&&(g=null==n?void 0:n.mixedAudioTrack),g=a&&g?g:"audio";var S=null==r?void 0:r.getTrack();S=s&&S?S:"video";try{this.monitor.rtcInvokeStatus(JSON.stringify({aTrack:vU(g),vTrack:vU(S),audioTransceiverInit:c,videoTransceiverInit:u}),0,"Handler.internalPublish","",0)}catch(e){}return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:g,vTrack:S,audioTransceiverInit:c,videoTransceiverInit:u}}},t.prototype.updateDegradationPreference=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:return fG.print("updateDegradationPreference()"),r=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),n=e.videoTransceiver,r&&e.pubVideo&&n?(o=null===(i=n.sender)||void 0===i?void 0:i.getParameters())?(r.contentHint?o.degradationPreference=r.degradationPreference?r.degradationPreference:"motion"===(s=r.contentHint)?"maintain-framerate":"detail"===s||"text"===s?"maintain-resolution":void 0:delete o.degradationPreference,[4,null==n?void 0:n.sender.setParameters(o)]):[3,2]:(fG.print("updateDegradationPreference()","no pub"),[2]);case 1:a.sent();try{this.monitor.rtcInvokeStatus(JSON.stringify(o),0,"Handler.updateDegradationPreference","",0)}catch(e){}a.label=2;case 2:return[2]}var s}))}))},t.prototype.updateMaxBitrate=function(e){var t,i,r;fG.print("updateMaxBitrate()");var n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver;if(n&&e.pubVideo&&o){var a=null===(i=o.sender)||void 0===i?void 0:i.getParameters();if(a){a.encodings=null===(r=null==a?void 0:a.encodings)||void 0===r?void 0:r.map((function(t){var i,r=+t.rid||0,n=null===(i=e.videoEncodeConfig[r])||void 0===i?void 0:i.maxKbps;return"number"==typeof n&&(t.maxBitrate=1e3*n),t})),null==o||o.sender.setParameters(a);try{this.monitor.rtcInvokeStatus(JSON.stringify(a.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(e){}}}else fG.print("updateMaxBitrate()","no pub")},t.prototype.updateScaleResolutionDownBy=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n,o,a,s,c,u,d;return iv(this,(function(l){if(fG.print("updateScaleResolutionDownBy()"),n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver,!n||!e.pubVideo||!o)return fG.print("updateScaleResolutionDownBy()","no pub"),[2];if(a=null==n?void 0:n.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(c=qj(s,e.videoEncodeConfig[0])).scaleResolutionDownBy===e.prevScaleResolutionDownBy&&fG.print("updateScaleResolutionDownBy()","no change %o",e.prevScaleResolutionDownBy),u=null===(i=o.sender)||void 0===i?void 0:i.getParameters()){d=c.scaleResolutionDownBy/e.prevScaleResolutionDownBy,u.encodings=null===(r=null==u?void 0:u.encodings)||void 0===r?void 0:r.map((function(t){var i;Math.max(t.scaleResolutionDownBy=(t.scaleResolutionDownBy||1)*d,1);var r=+t.rid||0;return t.maxFramerate=(null===(i=e.videoEncodeConfig[r])||void 0===i?void 0:i.frameRate)||t.maxFramerate,t})),e.prevScaleResolutionDownBy=c.scaleResolutionDownBy,e.videoInputConfig=s,null==o||o.sender.setParameters(u);try{this.monitor.rtcInvokeStatus(JSON.stringify(u.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(e){}}return[2]}))}))},t.prototype.getStats=function(e,t){return aG(this._peerConnection,e,t)},t.prototype.setLocalDescription=function(e,t){var i;return tv(this,void 0,void 0,(function(){var r,n,o,a=this;return iv(this,(function(s){switch(s.label){case 0:r=zL(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:e}))];case 2:return s.sent(),this.monitor.rtcSetDescription(0,e,_F.W_1,"local"===(null==t?void 0:t.streamUserId)?vF.UP:vF.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",zL()-r,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(n=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(n.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(n.state),0,"sctp","",0)},n.transport&&(n.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null===(e=null==n?void 0:n.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),[3,4];case 3:return o=s.sent(),this.monitor.rtcSetDescription(-1,o.message+e,_F.W_1,"local"===(null==t?void 0:t.streamUserId)?vF.UP:vF.DOWN,"","",zL()-r,{type:"offer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t){return tv(this,void 0,void 0,(function(){var i,r;return iv(this,(function(n){switch(n.label){case 0:i=zL(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e}))];case 2:return n.sent(),this.monitor.rtcSetDescription(0,e,_F.W_0,"local"===(null==t?void 0:t.streamUserId)?vF.UP:vF.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",zL()-i,{type:"answer"}),[3,4];case 3:return r=n.sent(),this.monitor.rtcSetDescription(-1,r.message+e,_F.W_1,"local"===(null==t?void 0:t.streamUserId)?vF.UP:vF.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",zL()-i,{type:"answer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){return[2]}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t.prototype.addBitrateLimit=function(e,t){null==e||e.rtp.forEach((function(i){var r=i.codec,n=i.payload;if(["vp8","h264"].includes(r.toLocaleLowerCase())){var o=e.fmtp.find((function(e){return e.payload===n}));o?o.config=ov(ov([],nv(o.config.split(";")),!1),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)],!1).join(";"):e.fmtp.push({payload:n,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))},t}(JV.exports.EventEmitter),gG=function(e){var t=$_({},vG);return e&&!e.pcKillSwitch.ctor_sdpsemantics_add||(t.sdpSemantics="unified-plan"),e&&!e.pcKillSwitch.ctor_encodedinsetablestream_add||_G&&(t.encodedInsertableStreams=!0),t},SG=ko;jr({target:"Array",proto:!0},{fill:jC}),SG("fill");var EG={},bG={},IG={exports:{}},TG=IG.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(TG).forEach((function(e){TG[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},i=function(e,i,r){var n=e.name&&e.names;e.push&&!i[e.push]?i[e.push]=[]:n&&!i[e.name]&&(i[e.name]={});var o=e.push?{}:n?i[e.name]:i;!function(e,i,r,n){if(n&&!r)i[n]=t(e[1]);else for(var o=0;o<r.length;o+=1)null!=e[o+1]&&(i[r[o]]=t(e[o+1]))}(r.match(e.reg),o,e.names,e.name),e.push&&i[e.push].push(o)},r=IG.exports,n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach((function(e){var t=e[0],n=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(r[t]||[]).length;s+=1){var c=r[t][s];if(c.reg.test(n))return i(c,a,n)}})),t.media=o,t};var o=function(e,i){var r=i.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&i.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var i=[],r=e.split(" ").map(t),n=0;n<r.length;n+=3)i.push({component:r[n],ip:r[n+1],port:r[n+2]});return i},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var i,r=!1;return"~"!==e[0]?i=t(e):(i=t(e.substring(1,e.length)),r=!0),{scid:i,paused:r}}))}))}}(bG);var AG=IG.exports,RG=/%[sdv%]/g,CG=function(e){var t=1,i=arguments,r=i.length;return e.replace(RG,(function(e){if(t>=r)return e;var n=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(n);case"%d":return Number(n);case"%v":return""}}))},OG=function(e,t,i){var r=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var o=t.names[n];t.name?r.push(i[t.name][o]):r.push(i[t.names[n]])}else r.push(i[t.name]);return CG.apply(null,r)},wG=["v","o","s","i","u","e","p","c","b","t","r","z","a"],kG=["i","c","b","a"],PG=bG,NG=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var i=t.outerOrder||wG,r=t.innerOrder||kG,n=[];return i.forEach((function(t){AG[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(OG(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(OG(t,i,e))}))}))})),e.media.forEach((function(e){n.push(OG("m",AG.m[0],e)),r.forEach((function(t){AG[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(OG(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(OG(t,i,e))}))}))}))})),n.join("\r\n")+"\r\n"};EG.write=NG,EG.parse=PG.parse,EG.parseParams=PG.parseParams,EG.parseFmtpConfig=PG.parseFmtpConfig,EG.parsePayloads=PG.parsePayloads,EG.parseRemoteCandidates=PG.parseRemoteCandidates,EG.parseImageAttributes=PG.parseImageAttributes,EG.parseSimulcastStreamList=PG.parseSimulcastStreamList;var DG=Math.pow(2,32),MG=function(){return Math.floor(Math.random()*DG+1e3)},LG=function(e,t,i){return i||(i=MG()),[{id:i,attribute:"cname",value:"kp34Za0H+aVf862l"},{id:i,attribute:"msid",value:"".concat(e.id," ").concat(e.id,"-").concat(t)},{id:i,attribute:"mslabel",value:"".concat(e.id)},{id:i,attribute:"label",value:"".concat(e.id,"-").concat(t)}]};function UG(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly,e}var xG=function(e,t,i){var r=$_($_({},e),{invalid:[{value:"realx-exts:rscp"}],media:[t,i]});return delete r.groups,delete r.msidSemantic,EG.write(r)};function VG(e){return tv(this,void 0,void 0,(function(){var t,i,r,n,o;return iv(this,(function(a){switch(a.label){case 0:return t={},i=e.publicIPs,r=e.certFingerprint,n=e.iceParams,t.fingerprint={type:"sha-256",hash:r},t.icePwd=n.serverIcePwd,o=t,[4,BG(n.serverIceUfrag)];case 1:return o.iceUfrag=a.sent(),iB.setStats({connection_id:t.iceUfrag}),t.candidates=function(e){if(!Array.isArray(e))return[];var t=0,i=2130706431,r=[];return e.forEach((function(e){var n={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){r.push($_($_({},n),{foundation:t++,transport:"udp",port:e,priority:i}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){r.push($_($_({},n),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:i-1e3}))}))})),r}(i),t.setup="active",t.iceOptions="renomination",[2,t]}}))}))}var FG,BG=function(e){return tv(void 0,void 0,void 0,(function(){var t,i,r,n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:return t=new TextEncoder,i=t.encode("PREC"),n=Uint8Array.bind,[4,qL.b64str2ab(e)];case 1:return r=new(n.apply(Uint8Array,[void 0,c.sent()])),o=t.encode(Date.now().toString()).slice(-4),(a=new Uint8Array(2))[0]=0,a[1]=1,s=KL(Uint8Array,i,r,o,a),[4,qL.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))};function jG(e){var t=e.random,i=e.serverUfrag,r=e.serverPwd,n=e.clientPwd,o=e.options,a=(new TextEncoder).encode("WPRE");t||(t=new Uint8Array(4),crypto.getRandomValues(t));var s=gU(i);s.byteLength;var c=EU(gU(n),gU(r).subarray(0,16),gU(i).subarray(0,16));c.byteLength;var u=new Uint8Array(Object.keys(o).reduce((function(e,t){var i=Number(t);return e.push(i),e.push(o[i]?1:0),e}),[]));u.byteLength;var d=KL(Uint8Array,a,t,[s.byteLength],s,[c.byteLength],c,u);return d.byteLength%3!=0&&(d=KL(Uint8Array,d,new Uint8Array(3-d.byteLength%3).fill(255))),[SU(d),SU(KL(Uint8Array,t,s.subarray(0,20)))]}!function(e){e[e.kICEConfigTypeSrtpDtlsType=0]="kICEConfigTypeSrtpDtlsType",e[e.kICEConfigTypeRenominationType=1]="kICEConfigTypeRenominationType",e[e.kICEConfigTypeTcpType=2]="kICEConfigTypeTcpType",e[e.kICEConfigTypeMultiSendType=3]="kICEConfigTypeMultiSendType",e[e.kICEConfigTypeKcpType=4]="kICEConfigTypeKcpType",e[e.kICEConfigTypeSrtpSdesType=5]="kICEConfigTypeSrtpSdesType"}(FG||(FG={}));var GG=function(e,t){var i,r,n=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){try{for(var o=rv(e.fmtp),a=o.next();!a.done;a=o.next()){var s=a.value;if(s.config.includes("level-asymmetry-allowed=1")&&s.config.includes("packetization-mode=1")&&s.config.includes("profile-level-id=42e0")){n=s.payload;break}}}catch(e){i={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}for(var c=0;c<e.rtp.length;c++){var u=e.rtp[c];if("H264"===t){if(u.payload===n){e.rtp.unshift(e.rtp.splice(c,1)[0]);break}}else if(u.codec===t){e.rtp.unshift(e.rtp.splice(c,1)[0]);break}}var d=[];e.rtp.forEach((function(e){return d.push(e.payload)})),e.payloads=d.join(" ")}},HG=T,zG=Wu,KG=Vv.exports.getWeakData,WG=Nt,qG=G,XG=ed,YG=Ld,JG=Ue,QG=Ii.set,ZG=Ii.getterFor,$G=Mn.find,eH=Mn.findIndex,tH=HG([].splice),iH=0,rH=function(e){return e.frozen||(e.frozen=new nH)},nH=function(){this.entries=[]},oH=function(e,t){return $G(e.entries,(function(e){return e[0]===t}))};nH.prototype={get:function(e){var t=oH(this,e);if(t)return t[1]},has:function(e){return!!oH(this,e)},set:function(e,t){var i=oH(this,e);i?i[1]=t:this.entries.push([e,t])},delete:function(e){var t=eH(this.entries,(function(t){return t[0]===e}));return~t&&tH(this.entries,t,1),!!~t}};var aH,sH={getConstructor:function(e,t,i,r){var n=e((function(e,n){XG(e,o),QG(e,{type:t,id:iH++,frozen:void 0}),null!=n&&YG(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=ZG(t),s=function(e,t,i){var r=a(e),n=KG(WG(t),!0);return!0===n?rH(r).set(t,i):n[r.id]=i,e};return zG(o,{delete:function(e){var t=a(this);if(!qG(e))return!1;var i=KG(e);return!0===i?rH(t).delete(e):i&&JG(i,t.id)&&delete i[t.id]},has:function(e){var t=a(this);if(!qG(e))return!1;var i=KG(e);return!0===i?rH(t).has(e):i&&JG(i,t.id)}}),zG(o,i?{get:function(e){var t=a(this);if(qG(e)){var i=KG(e);return!0===i?rH(t).get(e):i?i[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),n}},cH=n,uH=T,dH=Wu,lH=Vv.exports,hH=Rm,pH=sH,fH=G,_H=Kv,vH=Ii.enforce,mH=ti,yH=!cH.ActiveXObject&&"ActiveXObject"in cH,gH=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},SH=hH("WeakMap",gH,pH);if(mH&&yH){aH=pH.getConstructor(gH,"WeakMap",!0),lH.enable();var EH=SH.prototype,bH=uH(EH.delete),IH=uH(EH.has),TH=uH(EH.get),AH=uH(EH.set);dH(EH,{delete:function(e){if(fH(e)&&!_H(e)){var t=vH(this);return t.frozen||(t.frozen=new aH),bH(this,e)||t.frozen.delete(e)}return bH(this,e)},has:function(e){if(fH(e)&&!_H(e)){var t=vH(this);return t.frozen||(t.frozen=new aH),IH(this,e)||t.frozen.has(e)}return IH(this,e)},get:function(e){if(fH(e)&&!_H(e)){var t=vH(this);return t.frozen||(t.frozen=new aH),IH(this,e)?TH(this,e):t.frozen.get(e)}return TH(this,e)},set:function(e,t){if(fH(e)&&!_H(e)){var i=vH(this);i.frozen||(i.frozen=new aH),IH(this,e)?AH(this,e,t):i.frozen.set(e,t)}else AH(this,e,t);return this}})}var RH=function(e){function t(){var t,i,r=e.call(this)||this;return r.inited=!1,r.deviceMap={audioinput:new Map,audiooutput:new Map,videoinput:new Map},r.checkDeviceChangeTimer=null,r.isSupportedPermissionsQuery=!1,r.isGrantedMicrophonePermission=!1,r.isGrantedCameraPermission=!1,r.isSupportedPermissionsQuery=!WL()&&!!(null===(i=null===(t=navigator)||void 0===t?void 0:t.permissions)||void 0===i?void 0:i.query),r._handleDeviceChange=r._handleDeviceChange.bind(r),!WL()&&r.refreshDevices(),r}return Z_(t,e),t.prototype.refreshDevices=function(){return tv(this,void 0,void 0,(function(){var e,t,i=this;return iv(this,(function(r){switch(r.label){case 0:if(!navigator.mediaDevices)return[2];if(e=void 0,!YL)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 2:return e=r.sent(),[3,4];case 3:return r.sent(),[3,4];case 4:return[4,navigator.mediaDevices.enumerateDevices()];case 5:return t=r.sent(),e&&e.getTracks().forEach((function(e){return e.stop()})),t.forEach((function(e){var t;e.deviceId&&(null===(t=i.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e,t;return tv(this,void 0,void 0,(function(){var i,r,n=this;return iv(this,(function(o){switch(o.label){case 0:if(void 0!==(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.ondevicechange)&&"function"==typeof(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.addEventListener)?navigator.mediaDevices.addEventListener("devicechange",(function(){n._handleDeviceChange(),setTimeout((function(){n._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){n._handleDeviceChange()}),3e3),!this.isSupportedPermissionsQuery)return[3,7];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,navigator.permissions.query({name:"microphone"})];case 2:return i=o.sent(),this.isGrantedMicrophonePermission="granted"===i.state,i.addEventListener("change",(function(){n.isGrantedMicrophonePermission="granted"===i.state})),[3,4];case 3:return o.sent(),[3,4];case 4:return o.trys.push([4,6,,7]),[4,navigator.permissions.query({name:"camera"})];case 5:return r=o.sent(),this.isGrantedCameraPermission="granted"===r.state,r.addEventListener("change",(function(){n.isGrantedCameraPermission="granted"===r.state})),[3,7];case 6:return o.sent(),[3,7];case 7:return[2]}}))}))},t.prototype._handleDeviceChange=function(){return tv(this,void 0,void 0,(function(){var e,t,i,r=this;return iv(this,(function(n){switch(n.label){case 0:return e=void 0,YL?[4,navigator.mediaDevices.getUserMedia({audio:!0})]:[3,2];case 1:e=n.sent(),n.label=2;case 2:return[4,navigator.mediaDevices.enumerateDevices()];case 3:return t=(t=n.sent()).filter((function(e){return!!e.deviceId})),e&&e.getTracks().forEach((function(e){return e.stop()})),i=Array.from(ov(ov(ov([],nv(this.deviceMap.audioinput.values()),!1),nv(this.deviceMap.videoinput.values()),!1),nv(this.deviceMap.audiooutput.values()),!1)),t.forEach((function(e){var t=r.deviceMap[e.kind].get(e.deviceId);r.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?r.emit(ND.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&r.emit(ND.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),i.forEach((function(e){t.find((function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(r.deviceMap[e.kind].delete(e.deviceId),e.kind.includes("video")?r.emit(ND.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&r.emit(ND.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))})),[2]}}))}))},t.prototype.getUserMedia=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return t=i.sent(),(null==e?void 0:e.audio)&&(this.isGrantedMicrophonePermission=!0),(null==e?void 0:e.video)&&(this.isGrantedCameraPermission=!0),this.refreshDevices(),[2,t]}}))}))},t.prototype.checkPermissionsByDevices=function(){return tv(this,void 0,void 0,(function(){var e,t;return iv(this,(function(i){switch(i.label){case 0:return e={audio:!1,video:!1},navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2,e];case 1:return t=i.sent(),e.audio=t.filter((function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,e.video=t.filter((function(e){return"videoinput"===e.kind&&e.label&&e.deviceId})).length>0,[2,e]}}))}))},t.prototype.getPermissions=function(e){var t;return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var i,r,n,o,a,s=this;return iv(this,(function(c){switch(c.label){case 0:if(i=e.audio,r=e.video,n=e.force,i||r||(i=!0,r=!0),o={audio:!1,video:!1},n)return[3,3];if(!this.isSupportedPermissionsQuery)return[3,1];if(i&&r){if(this.isGrantedMicrophonePermission&&this.isGrantedCameraPermission)return o.audio=!0,o.video=!0,[2,o]}else if(i&&this.isGrantedMicrophonePermission||r&&this.isGrantedCameraPermission)return o.audio=this.isGrantedMicrophonePermission,o.video=this.isGrantedCameraPermission,[2,o];return[3,3];case 1:return[4,this.checkPermissionsByDevices()];case 2:if(a=c.sent(),i&&r){if(a.audio&&a.video)return[2,a]}else if(i&&a.audio||r&&a.video)return[2,a];c.label=3;case 3:return(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.getUserMedia)?[4,navigator.mediaDevices.getUserMedia({audio:i,video:r}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),i&&(o.audio=!0,s.isGrantedMicrophonePermission=!0),r&&(o.video=!0,s.isGrantedCameraPermission=!0))})).catch((function(){}))]:[3,5];case 4:c.sent(),c.label=5;case 5:return[4,this.refreshDevices()];case 6:return c.sent(),[2,o]}}))}))},t.prototype.enumerateDevices=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions()];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(ov(ov(ov([],nv(this.deviceMap.audioinput.values()),!1),nv(this.deviceMap.videoinput.values()),!1),nv(this.deviceMap.audiooutput.values()),!1))]}}))}))},t.prototype.enumerateAudioCaptureDevices=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({audio:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.audioinput.values())]}}))}))},t.prototype.enumerateVideoCaptureDevices=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({video:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.videoinput.values())]}}))}))},t.prototype.enumerateAudioPlaybackDevices=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({audio:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.audiooutput.values())]}}))}))},t.prototype.getDeviceById=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return[4,this.enumerateDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},t}(JF),CH=new RH;!WL()&&(window.__rtc_dd__=CH);var OH=new qF("VERTC",0),wH=new WeakMap,kH=function(e){return wH.get(e)},PH=function(e){function t(t,i){var r=e.call(this)||this;return r._trackId=t,r.mediaType=i,r}return Z_(t,e),t.prototype.getId=function(){return this._trackId},t}(JF),NH=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n._initListeners(),n}return Z_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.setTrack=function(e){this._mediaTrack=e},t.prototype.close=function(){var e;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()},t.prototype._initListeners=function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){$F.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(PH),DH=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n}return Z_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(PH),MH=function(e){function t(t,i){var r=e.call(this,t,i,"video")||this;return r.dummy=!1,r.resolution={width:0,height:0},r._time=setInterval((function(){t.muted!==r._prevMuted&&OH.print("LocalVideoTrack.mutedChange: ",t.muted),r._prevMuted=t.muted}),100),r}return Z_(t,e),t.prototype.updateVideoCaptureConfig=function(){return tv(this,void 0,void 0,(function(){var e;return iv(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig&&this.getTrack()?(OH.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),delete $_({},this.videoCaptureConfig).contentHint,[4,this.getTrack().applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),((e=this.getTrack().getSettings()).width&&e.width!==this.resolution.width||e.height&&e.height!==this.resolution.height)&&(this.resolution={width:e.width,height:e.height},this.emit("resolution-change",this.resolution)),[2]}}))}))},t.prototype.replaceTrack=function(e){this.setTrack(e)},t.prototype.close=function(){e.prototype.close.call(this),OH.print("LocalVideoTrack.close"),clearInterval(this._time)},t.prototype.setContentHint=function(e){this._mediaTrack&&"contentHint"in this._mediaTrack&&["text","motion","detail"].includes(e)&&(this._mediaTrack.contentHint=e)},t}(NH),LH=function(e){function t(t,i){var r=e.call(this,t,i,"audio")||this;return r.mixType=cG.PLAYOUT_AND_PUBLISH,r}return Z_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new fL(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.checkHasInput=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new fL(this.getTrack())),this._audioLevelFetcher.checkHasInput()},t.prototype.resetAudioLevelFetcher=function(){var e;null===(e=this._audioLevelFetcher)||void 0===e||e.reset()},t.prototype.updateAudioCaptureConfig=function(){var e;return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(OH.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.audioCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t}(NH),UH=function(e){function t(t,i){return e.call(this,t,i,"video")||this}return Z_(t,e),t}(DH),xH=function(e){function t(t,i){return e.call(this,t,i,"audio")||this}return Z_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new fL(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.resetAudioLevelFetcher=function(){var e;null===(e=this._audioLevelFetcher)||void 0===e||e.reset()},t}(DH),VH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(LH),FH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(MH),BH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(MH),jH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(LH),GH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(MH),HH=function(e){function t(t,i){return e.call(this,t,i)||this}return Z_(t,e),t}(LH),zH=function(e){function t(t,i){var r=this,n=document.createElement("video"),o=document.createElement("canvas");n.setAttribute("style","display:none"),o.setAttribute("style","display:none"),n.setAttribute("muted",""),n.muted=!0,n.setAttribute("autoplay",""),n.autoplay=!0,n.setAttribute("playsinline","");var a=t.getSettings(),s=a.width,c=a.height,u=a.frameRate;o.width=s,o.height=c,document.body.append(n),document.body.append(o),n.srcObject=new MediaStream([t]),n.play();var d=o.getContext("2d");if(!d)throw new JB(qB.UNEXPECTED_ERROR,"can not get canvas context");var l=o.captureStream(u).getVideoTracks()[0];return(r=e.call(this,l,i)||this)._originTrack=t,r._video=n,r._ctx=d,r._canvas=o,r._track=l,r._cancelLoop=function(e,t){var i=1/t,r=_L.getAudioContextInstance(),n=r.createGain();n.gain.value=0,n.connect(r.destination);var o=!1;return function t(){if(o)n=null;else{var a=r.createOscillator();a.onended=t,a.connect(n),a.start(0),a.stop(r.currentTime+i),e(r.currentTime)}}(),function(){o=!0}}((function(){return r.draw()}),u),r.__initListeners(),r}return Z_(t,e),t.prototype.draw=function(){this._video.paused&&this._video.play(),this._video.videoWidth===this._canvas.width&&this._video.videoHeight===this._canvas.height||(this._canvas.width=this._video.videoWidth,this._canvas.height=this._video.videoHeight),this._ctx.drawImage(this._video,0,0,this._canvas.width,this._canvas.height),this._track.requestFrame&&this._track.requestFrame()},t.prototype.close=function(){var e,t;this._video.remove(),this._canvas.width=0,this._canvas.remove(),this._canvas=null,this._video=null,this._cancelLoop(),null===(e=this._originTrack)||void 0===e||e.stop(),this._originTrack=null,null===(t=this._track)||void 0===t||t.stop(),this._track=null},t.prototype.__initListeners=function(){var e=this;this._originTrack instanceof MediaStreamTrack&&this._originTrack.addEventListener("ended",(function(){var t;$F.rtcError("track-ended mediaType: ".concat(null===(t=e._originTrack)||void 0===t?void 0:t.kind),-1001),e.emit("track-ended",e)}))},t}(MH);function KH(e,t,i){var r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y;return iv(this,(function(g){switch(g.label){case 0:OH.print("createCameraAndMicrophoneTrack","videoConstraints:",e,"audioConstraints:",t,"audioProfileManager:",i),null===(r=null==t?void 0:t.deviceId)||void 0===r||r.exact,a=(null===(n=null==e?void 0:e.deviceId)||void 0===n?void 0:n.exact)||"default",c=(s=i||{}).sampleRate,u=s.channel,d=s.agc,l=s.ans,h=s.aec,void 0===t.sampleRate&&(t.sampleRate=c),void 0===t.channelCount&&(t.channelCount=u),void 0===t.autoGainControl&&(t.autoGainControl=d),void 0===t.noiseSuppression&&(t.noiseSuppression=l),void 0===t.echoCancellation&&(t.echoCancellation=h),g.label=1;case 1:return g.trys.push([1,3,,4]),$F.rtcVideoCaptureEvent({event_type:xF.START,media_device_id:a}),p=zL(),[4,CH.getUserMedia({video:e,audio:t})];case 2:return o=g.sent(),$F.rtcVideoCaptureEvent({event_type:xF.START_CAPTURE_RESULT,media_device_id:a,reason:FF.SUCCESS,elapse:zL()-p}),[3,4];case 3:throw f=g.sent(),$F.rtcVideoCaptureEvent({event_type:xF.RUNNING_FAILED,media_device_id:a,error_code:f.code,reason:f.name+f.message}),new JB(qB.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",f);case 4:return _=o.getVideoTracks()[0],wH.set(_,o),(v=new FH(_,HL())).videoCaptureConfig=e,m=o.getAudioTracks()[0],wH.set(m,o),y=new VH(m,HL()),[2,{videoTrack:v,audioTrack:y}]}}))}))}function WH(e){var t;return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:r=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",c.label=1;case 1:return c.trys.push([1,3,,4]),OH.print("createCameraVideoTrack","constraints:",e),$F.rtcVideoCaptureEvent({event_type:xF.START,media_device_id:r}),n=zL(),[4,CH.getUserMedia({video:e})];case 2:return i=c.sent(),$F.rtcVideoCaptureEvent({event_type:xF.START_CAPTURE_RESULT,media_device_id:r,reason:FF.SUCCESS,elapse:zL()-n}),[3,4];case 3:throw o=c.sent(),$F.rtcVideoCaptureEvent({event_type:xF.RUNNING_FAILED,media_device_id:r,error_code:o.code,reason:o.name+o.message}),new JB(qB.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=i.getVideoTracks()[0],wH.set(a,i),(s=new FH(a,HL())).videoCaptureConfig=e,[2,s]}}))}))}function qH(e,t){var i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p;return iv(this,(function(f){switch(f.label){case 0:OH.print("createCameraVideoTrack","constraints:",e),n=(null===(i=null==e?void 0:e.deviceId)||void 0===i?void 0:i.exact)||"default",a=(o=t||{}).sampleRate,s=o.channel,c=o.agc,u=o.ans,d=o.aec,void 0===e.sampleRate&&(e.sampleRate=a),void 0===e.channelCount&&(e.channelCount=s),void 0===e.autoGainControl&&(e.autoGainControl=c),void 0===e.noiseSuppression&&(e.noiseSuppression=u),void 0===e.echoCancellation&&(e.echoCancellation=d),f.label=1;case 1:return f.trys.push([1,3,,4]),$F.rtcVideoCaptureEvent({event_type:xF.START,media_device_id:n}),l=zL(),[4,CH.getUserMedia({audio:e})];case 2:return r=f.sent(),$F.rtcVideoCaptureEvent({event_type:xF.START_CAPTURE_RESULT,media_device_id:n,reason:FF.SUCCESS,elapse:zL()-l}),[3,4];case 3:throw h=f.sent(),$F.rtcVideoCaptureEvent({event_type:xF.RUNNING_FAILED,media_device_id:n,error_code:h.code,reason:h.name+h.message}),new JB(qB.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",h);case 4:return p=r.getAudioTracks()[0],wH.set(p,r),[2,new VH(p,HL())]}}))}))}function XH(e,t){return void 0===e&&(e=!1),tv(this,void 0,void 0,(function(){var i,r,n;return iv(this,(function(o){switch(o.label){case 0:OH.print("createScreenTracks","withAudio: %o, constraints: %o",e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),$F.rtcVideoCaptureEvent({event_type:xF.START,media_device_id:"screen"}),r=zL(),[4,navigator.mediaDevices.getDisplayMedia({video:!(t&&(!JL||16!==$L))||t,audio:e})];case 2:return i=o.sent(),$F.rtcVideoCaptureEvent({event_type:xF.START_CAPTURE_RESULT,media_device_id:"screen",reason:FF.SUCCESS,elapse:zL()-r}),[3,4];case 3:throw n=o.sent(),$F.rtcVideoCaptureEvent({event_type:xF.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.name+n.message}),new JB(qB.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,i]}}))}))}var YH,JH=LH;!function(e){e[e.NONE=0]="NONE"}(YH||(YH={}));var QH,ZH,$H=function(){function e(){}return e.getNalunits=function(t){if(t.length-t.position<4)return[];var i=t.position;return 1===t.getInt32(i)||0===t.getInt16(i)&&1===t.getInt8(i+2)?e.getAnnexbNals(t):e.getAvccNals(t)},e.getAnnexbNals=function(t){for(var i=[],r=e.getHeaderPositionAnnexB(t),n=r.pos,o=n;n<t.length-4;){var a=new Uint8Array(t.buffer.slice(n,n+r.headerLength));r.pos===t.position&&t.skip(r.headerLength),o=(r=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(n+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&i.push(s),t.skip(o-t.position),n=o}return i},e.getAvccNals=function(t){for(var i=[];t.position<t.length-4;){var r=t.getInt32(t.position);if(!(t.length-t.position>=r))break;var n=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+r));t.skip(r);var a={header:n,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&i.push(a)}return i},e.analyseNal=function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},e.getHeaderPositionAnnexB=function(e){for(var t=e.position,i=0,r=e.length;3!==i&&4!==i&&t<r-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:1===e.getInt8(t+2)?i=3:t++:t++;return t===r-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:t=r:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?i=3:t=r)),{pos:t,headerLength:i}},e.getAvcc=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength+11);i[0]=1,i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=255,i[5]=225;var r=6;return i.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),r),r+=2,i.set(e,r),i[r+=e.byteLength]=1,r++,i.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),r),r+=2,i.set(t,r),i},e}(),ez=function(){function e(e){this._position=0,this._dataview=new DataView(e)}return Object.defineProperty(e.prototype,"length",{get:function(){return this.buffer.byteLength},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._dataview.buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),e.prototype.back=function(e){this.position-=e},e.prototype.getUint8=function(e){return this._dataview.getUint8(e)},e.prototype.getInt8=function(e){return this._dataview.getInt8(e)},e.prototype.getInt16=function(e){return this._dataview.getInt16(e)},e.prototype.getUint16=function(e){return this._dataview.getUint16(e)},e.prototype.getUint32=function(e){return this._dataview.getUint32(e)},e.prototype.getInt32=function(e){return this._dataview.getInt32(e)},e.prototype.skip=function(t){for(var i=Math.floor(t/4),r=t%4,n=0;n<i;n++)e.readByte(this,4);r>0&&e.readByte(this,r)},e.readByte=function(e,t,i){var r;switch(t){case 1:r=i?e.getInt8(e.position):e.getUint8(e.position);break;case 2:r=i?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(i)throw new Error("not supported for readByte 3");r=e.getUint8(e.position)<<16,r|=e.getUint8(e.position+1)<<8,r|=e.getUint8(e.position+2);break;case 4:r=i?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(i)throw new Error("not supported for readBody 8");r=e.getUint32(e.position)<<32,r|=e.getUint32(e.position+4);break;default:r=""}return e.position+=t,r},e.prototype.readUint8=function(){return e.readByte(this,1)},e.prototype.readUint16=function(){return e.readByte(this,2)},e.prototype.readUint24=function(){return e.readByte(this,3)},e.prototype.readUint32=function(){return e.readByte(this,4)},e.prototype.readUint64=function(){return e.readByte(this,8)},e.prototype.readInt8=function(){return e.readByte(this,1,!0)},e.prototype.readInt16=function(){return e.readByte(this,2,!0)},e.prototype.readInt32=function(){return e.readByte(this,4,!0)},e.prototype.writeUint32=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])},e}();!function(e){e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass"}(QH||(QH={})),function(e){e[e.invalid=0]="invalid",e[e.cfgResolution=1]="cfgResolution",e[e.bitstreamHash=2]="bitstreamHash",e[e.screenCodec=3]="screenCodec"}(ZH||(ZH={}));var tz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),iz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]);function rz(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function nz(e,t){void 0===t&&(t=0);for(var i=0;255===e[t]&&t<e.byteLength;)t++,i+=255;return t<e.byteLength&&(i+=e[t++]),[i,t]}var oz=function(){function e(){}return e.generateSEI=function(e,t){void 0===t&&(t=!1);var i=new Uint8Array([0,0,0,1]),r=new Uint8Array([6]),n=new Uint8Array([5]),o=t?tz:iz,a=rz(e.byteLength+o.byteLength),s=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]&&t.push(3),t.push(e[i]);return new Uint8Array(t)}(e);return new Uint8Array(ov(ov(ov(ov(ov(ov(ov([],nv(i),!1),nv(r),!1),nv(n),!1),nv(a),!1),nv(o),!1),nv(s),!1),[128],!1))},e.decodeSeiBody=function(e){var t=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]||t.push(e[i]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var i=0;if(5===t[1]||100===t[1]){var r=nv(nz(t,i+=2),2),n=r[0];i=r[1];var o=QH.bypass,a=i+n;return t.byteLength>=iz.byteLength&&n>=iz.byteLength&&t.slice(i,i+iz.byteLength).toString()===iz.toString()?(i+=iz.byteLength,o=QH.external):t.byteLength>=iz.byteLength&&n>=iz.byteLength&&t.slice(i,i+tz.byteLength).toString()===tz.toString()&&(i+=tz.byteLength,o=QH.internal),{type:o,payload:t.slice(i,a)}}}},e.parseInternalSEI=function(e){var t=new Map,i=0;if(e.type===QH.internal){for(;e.payload.byteLength-i>=2;){var r=nv(nz(e.payload,i),2),n=r[0];i=r[1];var o=nv(nz(e.payload,i),2),a=o[0];if(i=o[1],t.get(n)||!(a<e.payload.byteLength-i))break;t.set(n,e.payload.slice(i,i+a))}return t}},e.makeInternalSei=function(e){var t,i,r=[];try{for(var n=rv(e),o=n.next();!o.done;o=n.next()){var a=nv(o.value,2),s=a[0],c=a[1],u=rz(s),d=rz(c.byteLength);r.push(u,d,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}var l=r.reduce((function(e,t){return e+t.byteLength}),0),h=new Uint8Array(l);return r.reduce((function(e,t){return h.set(t,e),e+t.byteLength}),0),h},e}();jr({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new qF("Stats",2);var az,sz,cz,uz,dz,lz,hz=function(){function e(e){this._stream=e}return e.prototype.setVar=function(e,t,i){this.client=e,this.handler=t,this.monitor=i},e.prototype.delStatsEvtInterval=function(){clearTimeout(this._timer),this._timer=void 0},e.prototype.destroy=function(){this.delStatsEvtInterval()},e}(),pz=function(e){function t(t){var i=e.call(this,t)||this;return i._stream=t,i}return Z_(t,e),t.prototype.setLocalStreamStatsEvtInterval=function(e,t,i){var r,n,o=this;if(!this._timer){this.setVar(e,t,i),e.once(kj.ABNORMAL_DISCONNECTION,(function(){o.destroy()}));var a={audio:{},video:{}},s=this._stream,c=null===(r=s.audioTrack)||void 0===r?void 0:r.getTrack(),u=null===(n=s.videoTrack)||void 0===n?void 0:n.getTrack();this.getAudioStats(c,a),this.getVideoStats(u,a),this.delStatsEvtInterval();this._timer&&clearTimeout(this._timer),this._timer=setTimeout((function e(){return tv(o,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:return[4,tv(o,void 0,void 0,(function(){var e,t,i,r,n,o;return iv(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getAudioStats(e,a)];case 1:return i=c.sent(),[4,this.getVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen}]}}))}))];case 1:return t=r.sent(),null===(i=this.client)||void 0===i||i.emit("onLocalStreamStats",t),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(e,2e3),[2]}}))}))}),2e3)}},t.prototype.unpublish=function(){this.delStatsEvtInterval()},t.prototype.getAudioStats=function(e,t){return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l;return iv(this,(function(h){switch(h.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.audioMid,s=n.isScreen,c=n.pubAttributes,u={media_type:"audio",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,n=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,d=e.channels,l=e.audioLevel,h=e.googRtt,p=e.mimeType,f=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,y=e.id,g=e.currentRoundTripTime,S=e.state,E=e.writable,b=e.requestsReceived,I=e.responsesReceived,T=e.requestsSent,A=e.consentRequestsSent,R=e.responsesSent,C=e.jitter,O=e.candidateType,w=e.ip,k=e.address,P=e.networkType,N=e.port,D=e.protocol,M=e.nackCount,L=e.retransmittedBytesSent,U=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType,H=e.fractionLost;"outbound-rtp"===t?(r.packetsSent=n,r.bytesSent=a,u.bytes=a,u.packetsSent=n,u.nackCount=M,u.ssrc=F,u.retransmitted_bytes_sent=L,u.retransmitted_packets_sent=U,r.retransmittedPacketsSent=U):"remote-inbound-rtp"===t?(r.packetsLost=o,u.packetsLost=o,u.jitter=1e3*C,i.rtt=1e3*c,u.rtt=i.rtt,u.round_trip_time_measurements=x,i._fractionLost=H||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=d,u.codecName=p):"media-source"===t?(u.audio_level=l?-10*Math.log10(Math.pow(l,2)):l,u.volume=255*l,u.total_audio_energy=B,u.total_samples_duration=j):"ssrc"===t&&"audio"===G?(u.audio_network_elapse=h,u.send_level=V):"candidate-pair"===t?(u.ice_available_incoming_bitrate=f,u.ice_available_outgoing_bitrate=_,u.ice_bytes_received=v,u.ice_bytes_sent=a,u.ice_nominated=+m,u.ice_pair_id=y,u.ice_pair_rtt=g,u.ice_pair_state=S,u.ice_pair_writable=E,u.recv_ping_requests=b,u.recv_ping_responses=I,u.sent_ping_requests_before_first_response=T,u.sent_ping_requests_total=T+(A||0),u.sent_ping_responses=R):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=w||k,u.local_network_type=P,u.local_port=N,u.protocol=D):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=w||k,u.remote_port=N),yU||"media-source"===t&&(u.send_level=l)})),(l=t.audio).timestamp?(void 0!==r.packetsLost&&(i.audioLossRate=(r.packetsLost-l.packetsLost)/(r.packetsSent-l.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,u.fraction_lost=i.audioLossRate),i.statsInterval=r.timestamp-l.timestamp,u.stats_interval=i.statsInterval,i.sendKBitrate=(r.bytesSent-l.bytesSent||0)/i.statsInterval*8,u.bitrate=Math.round(1e3*i.sendKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=r,u.total_audio_play_energy=this._stream.getRecordAudioEnergy(),this.monitor.rtcMediaStatistics(u,{}),i._retransmittedRate=(r.retransmittedPacketsSent-l.retransmittedPacketsSent)/(r.packetsSent-l.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),[2,i]):(t.audio=r,[2,i])):[2,i]}}))}))},t.prototype.getVideoStats=function(e,t){return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v;return iv(this,(function(m){switch(m.label){case 0:return i={},r={timestamp:Date.now(),simulcast:{}},n=this._stream,o=n.streamId,a=n.videoMid,s=n.isScreen,c=n.pubAttributes,u=n.enableSimulcast,l=[{media_type:"video",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,capture_state:c.localvideo?"capture_state_on":"capture_state_off"}],[4,this._stream.requestVideoFrameCallback()];case 1:return d=$_.apply(void 0,l.concat([m.sent()])),e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 2:return(h=m.sent()).length?(p=0,h.forEach((function(n){var o=n.type,a=n.framesEncoded,s=n.packetsLost,c=n.bytesSent,l=n.framesSent,h=n.roundTripTime,f=n.mimeType,_=n.frameWidth,v=n.frameHeight,m=n.packetsSent,y=n.googActualEncBitrate,g=n.googAvailableReceiveBandwidth,S=n.googAvailableSendBandwidth,E=n.googAvgEncodeMs,b=n.googBucketDelay,I=n.googEncodeUsagePercent,T=n.googFrameRateInput,A=n.availableIncomingBitrate,R=n.availableOutgoingBitrate,C=n.bytesReceived,O=n.nominated,w=n.id,k=n.currentRoundTripTime,P=n.state,N=n.writable,D=n.candidateType,M=n.ip,L=n.address,U=n.networkType,x=n.port,V=n.nackCount,F=n.pliCount,B=n.protocol,j=n.qpSum,G=n.requestsReceived,H=n.responsesReceived,z=n.googRetransmitBitrate,K=n.requestsSent,W=n.consentRequestsSent,q=n.responsesSent,X=n.ssrc,Y=n.googTargetEncBitrate,J=n.googTransmitBitrate,Q=n.googRtt,Z=n.retransmittedPacketsSent,$=n.encoderImplementation,ee=n.jitter,te=n.rid,ie=n.fractionLost,re=n.keyFramesEncoded,ne=n.retransmittedBytesSent,oe=n.totalPacketSendDelay,ae=n.totalEncodeTime;n.getsetting,n.framesPerSecond;var se=n.firCount,ce=n.qualityLimitationReason,ue=n.targetBitrate;if("outbound-rtp"===o?(u&&(te?r.simulcast[te]=n:r.simulcast[p]=n,p++),r.framesEncoded=a||r.framesEncoded,d.key_frames_encoded=re||0,r.bytesSent=c||r.bytesSent,r.framesSent=l||r.framesSent,d.bytes=c||d.bytes,r.packetsSent=m||r.packetsSent,r.retransmittedBytesSent=ne,d.packetsSent=m||d.packetsSent,d.nackCount=V||d.nackCount,d.pli_count=F||d.pli_count,d.qp_sum=j||d.qp_sum,d.ssrc=X||d.ssrc,d.retransmitted_packets_sent=Z,r.retransmittedPacketsSent=Z,d.encoder_implementation=$,void 0!==_&&((!i.encodedFrameWidth||_>i.encodedFrameWidth)&&(i.encodedFrameWidth=_),(!i.encodedFrameHeight||v>i.encodedFrameHeight)&&(i.encodedFrameHeight=v),d.frame_size_height=v,d.frame_size_width=_)):"track"===o?(i.encodedFrameWidth=_,i.encodedFrameHeight=v,d.frame_size_height=v,d.frame_size_width=_):"remote-inbound-rtp"===o?(r.packetsLost=s,i.rtt=1e3*h,d.rtt=i.rtt,d.jitter=ee,d.packetsLost=s,i._fractionLost=ie||0):"codec"===o?(i.codecType=f,d.codecName=f):"candidate-pair"===o?(d.ice_available_incoming_bitrate=A,d.ice_available_outgoing_bitrate=R,d.ice_bytes_received=C,d.ice_bytes_sent=c,d.ice_nominated=+O,d.ice_pair_id=w,d.ice_pair_rtt=k,d.ice_pair_state=P,d.ice_pair_writable=N,d.recv_ping_requests=G,d.recv_ping_responses=H,d.sent_ping_requests_before_first_response=K,d.sent_ping_requests_total=K+W,d.sent_ping_responses=q):"local-candidate"===o?(d.local_candidate_type=D,d.local_ip=M||L,d.local_network_type=U,d.local_port=x,d.protocol=B):"remote-candidate"===o?(d.remote_candidate_type=D,d.remote_ip=M||L,d.remote_port=x):"VideoBwe"===o?(d.encBitratebps=y,d.available_receive_bandwidth=g,d.available_send_bandwidth=S,d.bucket_delay=b,d.retransmitBitratebps=z,d.targetEncBitratebps=Y,d.transmit_bitrate=J,i._sendBandWidth=+S):"ssrc"===o&&(d.video_network_elapse=Q,d.avg_encode_ms=E,d.encodeUsage=I,d.frame_rate_input=T,d.orignal_input_Framerate=+T),!yU){var de=t.video,le=r.timestamp-de.timestamp;if("outbound-rtp"===o){var he=c-de.bytesSent,pe=ne-de.retransmittedBytesSent;d.encBitratebps=Math.round(8e3*(he-pe)/le),d.bucket_delay=oe/m,d.retransmitBitratebps=Math.round(8e3*pe/le),d.targetEncBitratebps=ue,d.transmit_bitrate=Math.round(1e3*(c-de.bytesSent)*8/le),d.avg_encode_ms=1e3*ae/a,d.firsReceived=se+F,d.qualityLimitationReason="bandwidth"===ce,d.qualityLimitationDurations="cpu"===ce}else"candidate-pair"===o&&(d.available_send_bandwidth=R,i._sendBandWidth=R);if(e){var fe=null==e?void 0:e.getSettings().frameRate;d.orignal_input_Framerate=fe,d.frameRateSent=e.getSettings().frameRate}}})),(f=t.video).timestamp?(i.statsInterval=r.timestamp-f.timestamp,d.stats_interval=i.statsInterval,_=Object.keys(r.simulcast),u?(d.sim_enc_width=[],d.sim_enc_height=[],d.sim_enc_bps=[],d.sim_enc_framerate=[],d.sim_enc_key_frames=[],d.sim_rids=[],d.sim_enc_bandwidth=[],d.sim_sent_framerate=[],d.sim_fraction_lost=[],v=!1,_.sort((function(e,t){return+e-+t})).forEach((function(e){var t=r.simulcast[e],n=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,l=t.packetsSent,h=t.qualityLimitationReason,p=t.qualityLimitationDurations,_=t.qualityLimitationResolutionChanges,m=t.retransmittedPacketsSent,y=t.keyFramesEncoded;void 0!==h&&(d.sim_qualityLimitationReason||(d.sim_qualityLimitationReason=[],d.sim_qualityLimitationDurations=[],d.sim_qualityLimitationResolutionChanges=[]),d.sim_qualityLimitationReason.push(h),d.sim_qualityLimitationDurations.push(p),d.sim_qualityLimitationResolutionChanges.push(_));var g=f.simulcast[e];if(d.sim_enc_width.push(n||0),d.sim_enc_height.push(o||0),d.sim_enc_key_frames.push(y||0),g){var S=(a-g.bytesSent||0)/i.statsInterval;d.sim_enc_bps.push(Math.round(8e3*S)),d.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var E=1e3*(s-g.framesEncoded)/i.statsInterval;d.sim_enc_framerate.push(Math.round(E)),d.sim_rids.push(e);var b=void 0!==c?c-g.framesSent:s-g.framesEncoded,I=1e3*b/i.statsInterval;d.sim_sent_framerate.push(Math.round(I));var T=(u-g.packetsLost)/(l-g.packetsSent);i._retransmittedRate=(m-g.retransmittedPacketsSent)/(l-g.packetsSent),T=Number.isNaN(T)?0:T,d.sim_fraction_lost.push(T),n>0&&!v&&(i.sentKBitrate=8*S,i.encoderOutputFrameRate=E,i.encodedFrameCount=b,i.sentFrameRate=I,i.videoLossRate=T,v=!0)}})),this.monitor.rtcMediaStatistics(d,{})):(i.encodedFrameCount=void 0!==r.framesSent?r.framesSent-f.framesSent:r.framesEncoded-f.framesEncoded,i.sentKBitrate=(r.bytesSent-f.bytesSent||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.sentKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.encoderOutputFrameRate=1e3*(r.framesEncoded-f.framesEncoded)/i.statsInterval,d.frame_rate_encoded=Math.round(i.encoderOutputFrameRate),i.sentFrameRate=1e3*i.encodedFrameCount/i.statsInterval,d.frame_rate_sent=Math.round(i.sentFrameRate),i.videoLossRate=(r.packetsLost-f.packetsLost)/(r.packetsSent-f.packetsSent),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,i._retransmittedRate=(r.retransmittedPacketsSent-f.retransmittedPacketsSent)/(r.packetsSent-f.packetsSent),this.monitor.rtcMediaStatistics(d,{})),t.video=r,i._fractionLost=Math.max(i._fractionLost,i.videoLossRate),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t}(hz),fz=function(e){function t(t){var i=e.call(this,t)||this;return i._videoInWaiting=!1,i}return Z_(t,e),Object.defineProperty(t,"audioStallConfig",{set:function(e){t.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,t.audioStallRatio=null==e?void 0:e.audio_stall_ratio},enumerable:!1,configurable:!0}),t.prototype.setRemoteStreamStatsEvtInterval=function(e,i,r){var n,o;return tv(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,f,_,v,m=this;return iv(this,(function(y){switch(y.label){case 0:return this._timer?[2]:(this.setVar(e,i,r),e.once(kj.ABNORMAL_DISCONNECTION,(function(){m.destroy()})),this._audioStallInterval=-100,this._audioStallRatio=t.audioStallRatio||.6,a={audio:{},video:{}},s=this._stream,c=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),u=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),this.getRemoteVideoStats(u,a),[4,this.getRemoteAudioStats(c,a)]);case 1:return y.sent(),this.delStatsEvtInterval(),d=0,l=0,p=[],f=0,this._setAudioStallCount=function(){if(m._audioStallInterval>0&&void 0!==a.audio.concealedSamples){var e=a.audio.concealedSamples,t=a.audio.totalSamplesReceived,i=zL(),r={isStall:!1,counted:!1,diff:0},n=.5*m._audioStallInterval;m._audioStallCount=function(){return tv(m,void 0,void 0,(function(){var o,a,c,u,h,_,v,m,y,g,S,E,b,I,T;return iv(this,(function(A){switch(A.label){case 0:return o=s.hasAudio,a=s.subAudio,o&&a?(c=null===(T=s.audioTrack)||void 0===T?void 0:T.getTrack(),u=Date.now(),[4,this.handler.getStats(c,!0)]):(r.isStall=!1,r.counted=!1,p.push({reason:"hasAudio: ".concat(o,", subAudio: ").concat(a)}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]);case 1:return h=A.sent(),_=Date.now(),v=zL(),(m=v-i)<n?(p.push({diff:m,start:i,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_,reason:"diff(".concat(m,") < minInterval(").concat(n,")")}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]):(y=h.length,g=h.find((function(e){return"inbound-rtp"===e.type})),g?(S=g.concealedSamples,E=g.totalSamplesReceived,I=E-t,(b=S-e)>=0&&I>=0&&b>=this._audioStallRatio*I?(p.push({concealed:b,received:I,diff:m,start:i,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_,is_stall:!0}),r.isStall?(r.counted?l+=m:(l=l+r.diff+m,d++),r.counted=!0):m>=200?(l+=m,d++,r.counted=!0):(r.counted=!1,r.diff=m),r.isStall=!0):(p.push({concealed:b,received:I,diff:m,start:i,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_}),r.isStall=!1,r.counted=!1),e=S,t=E,i=v,f++,[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]):(p.push({diff:m,start:i,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_,reason:y?"no inbound-rtp":"no report"}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]))}}))}))},h=function(){return tv(m,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return console.log("=================== stallLoop"),!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),this._audioStallCount?[4,this._audioStallCount()]:[3,2];case 1:e.sent(),this._audioStallTimer&&clearTimeout(this._audioStallTimer),this._audioStallTimer=setTimeout(h,this._audioStallInterval),e.label=2;case 2:return[2]}}))}))},m._audioStallTimer&&clearTimeout(m._audioStallTimer),m._audioStallTimer=setTimeout(h,m._audioStallInterval)}},this._setAudioStallCount(),_=function(){return tv(m,void 0,void 0,(function(){var e,t,i,r,n,o;return iv(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getRemoteAudioStats(e,a)];case 1:return i=c.sent(),d=0,l=0,p=[],f=0,[4,this.getRemoteVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen,userId:s.userId}]}}))}))},v=function(){return tv(m,void 0,void 0,(function(){var e,t;return iv(this,(function(i){switch(i.label){case 0:return[4,_()];case 1:return e=i.sent(),null===(t=this.client)||void 0===t||t.emit("onRemoteStreamStats",e),h&&(this._audioStallTimer&&clearTimeout(this._audioStallTimer),this._audioStallTimer=setTimeout(h,this._audioStallInterval)),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(v,2e3),[2]}}))}))},this._timer&&clearTimeout(this._timer),this._timer=setTimeout(v,2e3),[2]}}))}))},t.prototype.delStatsEvtInterval=function(){e.prototype.delStatsEvtInterval.call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0},t.prototype.unsubscribe=function(){this.delStatsEvtInterval(),this._videoInWaiting=!1},t.prototype.getRemoteAudioStats=function(e,t){return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g;return iv(this,(function(S){switch(S.label){case 0:return i={},r={},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.audioMid,u=n.subMediaType,d=n._attributes,l={media_type:"audio",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:c,track_enabled:null==e?void 0:e.enabled,connection_status:navigator.onLine,mute_state:pU(u)?"mute_state_off":"mute_state_on",remote_user_capture_state:d.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:d.localaudio&&d.audiostream?"mute_state_off":"mute_state_on"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(h=S.sent()).length?(h.forEach((function(e){var t=e.type,n=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,f=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,y=e.currentRoundTripTime,g=e.audioLevel,S=e.totalAudioEnergy,E=e.totalSamplesDuration,b=e.mimeType,I=e.googDecodingNormal,T=e.googDecodingMuted,A=e.fecPacketsReceived,R=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesSent,w=e.nominated,k=e.id,P=e.writable,N=e.jitter,D=e.candidateType,M=e.ip,L=e.address,U=e.networkType,x=e.port,V=e.protocol,F=e.audioOutputLevel,B=e.requestsReceived,j=e.responsesReceived,G=e.requestsSent,H=e.consentRequestsSent,z=e.responsesSent,K=e.ssrc,W=e.kind;"inbound-rtp"===t?(r.packetsLost=n,r.packetsReceived=o,l.packetsReceived=o,r.bytesReceived=a,l.bytes=a,void 0!==s&&(i.jitterBufferDelay=s/c*1e3,l.average_jitter_buffer_delay_ms=i.jitterBufferDelay),void 0!==h&&(r.totalSamplesReceived=h,i.concealedSamples=p,r.concealedSamples=p,r.silentConcealedSamples=f,l.concealedSamples=p,i.concealmentEvents=_,l.totalSamplesReceived=h),void 0!==A&&(l.fec_packets_received=A),l.jitter=1e3*N,l.ssrc=K,void 0!==g&&(l.audio_level=g?-10*Math.log10(Math.pow(g,2)):g),void 0!==g&&(l.volume=255*g),void 0!==S&&(l.total_audio_energy=S),void 0!==E&&(l.totalAudioDuration=E)):"codec"===t?(i.recordSampleRate=u,d&&(i.numChannels=d),l.codecName=b):"candidate-pair"===t?(l.ice_available_incoming_bitrate=R,l.ice_available_outgoing_bitrate=C,l.ice_bytes_received=a,l.ice_bytes_sent=O,l.ice_nominated=+w,l.ice_pair_id=k,l.ice_pair_rtt=y,l.rtt=1e3*y,l.ice_pair_state=m,l.ice_pair_writable=P,l.recv_ping_requests=B,l.recv_ping_responses=j,l.sent_ping_requests_before_first_response=G,l.sent_ping_requests_total=G+(H||0),l.sent_ping_responses=z,"succeeded"===m&&(i.rtt=1e3*y,i.total_rtt=1e3*v)):"track"===t&&"audio"===W?(l.audio_level=g?-10*Math.log10(Math.pow(g,2)):g,l.volume=255*g,l.total_audio_energy=S,l.totalAudioDuration=E):"ssrc"===t?(l.decodingNormal=I,l.recvAudioLevel=F,l.decodingMuted=T):"local-candidate"===t?(l.local_candidate_type=D,l.local_ip=M||L,l.local_network_type=U,l.local_port=x,l.protocol=V):"remote-candidate"===t&&(l.remote_candidate_type=D,l.remote_ip=M||L,l.remote_port=x)})),(p=t.audio).timestamp?(f={},void 0!==r.concealedSamples&&(l.interval_concealed_samples=r.concealedSamples-p.concealedSamples,l.interval_samples_received=r.totalSamplesReceived-p.totalSamplesReceived,l.interval_silent_concealed_samples=r.silentConcealedSamples-p.silentConcealedSamples),this._audioStallInterval>0&&void 0!==p.concealedSamples?(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),this._audioStallCount?[4,this._audioStallCount()]:[3,3]):[3,3]):(r.timestamp=Date.now(),t.audio=r,[2,i])):[2,i];case 2:_=S.sent(),v=_.stall_count,m=_.stall_duration,y=_.stall_list,g=_.stats_count,f.stall_list=y,f.stats_count=g,l.concealedSamples===l.interval_concealed_samples&&l.totalSamplesReceived===l.interval_samples_received?(l.stall_count=0,l.stall_duration=0):(l.stall_count=v,l.stall_duration=m),i.stallCount=l.stall_count,i.stallDuration=l.stall_duration,S.label=3;case 3:return r.timestamp=Date.now(),i.audioLossRate=(r.packetsLost-p.packetsLost)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,l.packetsLost=Math.round(r.packetsLost-p.packetsLost),l.fraction_lost=i.audioLossRate,l.packets_lost_rate=i.audioLossRate,i.statsInterval=r.timestamp-p.timestamp,l.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-p.bytesReceived||0)/i.statsInterval*8,l.bitrate=Math.round(1e3*i.receivedKBitrate),l.bandwidth=Math.round(l.bitrate/1024),void 0!==r.concealedSamples&&(i.receivedSampleRate=1e3*l.interval_samples_received/i.statsInterval),t.audio=r,l.total_audio_play_energy=this._stream.getRecordAudioEnergy(),this.monitor.rtcMediaStatistics(l,{},f),[2,i]}}))}))},t.prototype.getRemoteVideoStats=function(e,t){return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p;return iv(this,(function(f){switch(f.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.subMediaType,u=n._attributes,l=[{media_type:"video",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,mute_state:fU(c)?"mute_state_off":"mute_state_on",remote_user_capture_state:u.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:u.localvideo&&u.videostream?"mute_state_off":"mute_state_on"}],[4,this._stream.requestVideoFrameCallback()];case 1:return d=$_.apply(void 0,l.concat([f.sent()])),e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 2:return(h=f.sent()).length?(h.forEach((function(e){var t=e.type,n=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,f=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,y=e.nominated,g=e.id,S=e.currentRoundTripTime,E=e.state,b=e.writable,I=e.candidateType,T=e.ip,A=e.address,R=e.networkType,C=e.port,O=e.nackCount,w=e.pliCount,k=e.protocol,P=e.requestsReceived,N=e.responsesReceived,D=e.requestsSent,M=e.consentRequestsSent,L=e.responsesSent,U=e.ssrc;e.kind;var x=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(r.packetsLost=a,d.packetsLost=a,r.packetsReceived=s,d.packetsReceived=s,r.bytesReceived=c,d.bytes=c,r.framesDecoded=u,void 0!==l&&(r.jitterBufferDelay=l/h*1e3,d.average_jitter_buffer_delay_ms=r.jitterBufferDelay),d.fir_count=f,d.nackCount=O,r.nackCount=O,d.pli_count=w,r.pliCount=w,d.ssrc=U,d.jitter=x,d.framesReceived=V,r.framesReceived=V,d.framesDecoded=u,d.key_frames_decoded=F,d.total_decode_time=B,d.decoder_name=j,d.last_packet_received_timestamp=G):"track"===t&&void 0!==o?(i.width=o,d.frame_size_width=o,i.height=n,d.frame_size_height=n,void 0!==V&&(d.framesReceived=V,r.framesReceived=V)):"codec"===t?d.codecName=p:"candidate-pair"===t?(d.ice_available_incoming_bitrate=_,d.ice_available_outgoing_bitrate=v,d.ice_bytes_received=c,d.ice_bytes_sent=m,d.ice_nominated=+y,d.ice_pair_id=g,d.ice_pair_rtt=S,d.rtt=1e3*S,i.rtt=d.rtt,d.ice_pair_state=E,d.ice_pair_writable=b,d.recv_ping_requests=P,d.recv_ping_responses=N,d.sent_ping_requests_before_first_response=D,d.sent_ping_requests_total=D+(M||0),d.sent_ping_responses=L):"local-candidate"===t?(d.local_candidate_type=I,d.local_ip=T||A,d.local_network_type=R,d.local_port=C,d.protocol=k):"remote-candidate"===t&&(d.remote_candidate_type=I,d.remote_ip=T||A,d.remote_port=C)})),(p=t.video).timestamp?(i.videoLossRate=(r.packetsLost-p.packetsLost)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i._retransmittedRate=(r.nackCount-p.nackCount)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,d.packets_lost_rate=i.videoLossRate,i.statsInterval=r.timestamp-p.timestamp,d.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-p.bytesReceived||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.decoderOutputFrameRate=1e3*(r.framesDecoded-p.framesDecoded)/i.statsInterval,i.receivedFrameRate=1e3*(r.framesReceived-p.framesReceived)/i.statsInterval,(0===p.framesDecoded&&r.framesReceived>100||r.pliCount>15)&&(i.needResub=!0),d.frame_rate_decoded=Math.round(i.decoderOutputFrameRate),d.frame_rate_received=Math.round(i.receivedFrameRate),t.video=r,this.processStall(this._stream,d,i,s),this.monitor.rtcMediaStatistics(d,{}),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t.prototype.processStall=function(e,t,i,r){var n=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(n+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,n=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=n,r?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,i.stallCount=n,i.stallDuration=o},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1},t}(hz);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(az||(az={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed"}(sz||(sz={})),function(e){e.TranscodeStateChanged="TranscodeStateChanged",e.TranscodeStarted="TranscodeStarted",e.TranscodeUpdated="TranscodeUpdated",e.TranscodeStoped="TranscodeStoped"}(cz||(cz={})),function(e){e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED"}(uz||(uz={})),function(e){e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB"}(dz||(dz={})),function(e){e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB"}(lz||(lz={}));var _z,vz=new qF("Stream",0),mz=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Z_(t,e),t.prototype.stopRecordAudioEnergy=function(){delete this._audioPlaybackEnergy},t.prototype.recordAudioEnergy=function(e){"number"!=typeof this._audioPlaybackEnergy&&(this._audioPlaybackEnergy=0),this._audioPlaybackEnergy+=e},t.prototype.getRecordAudioEnergy=function(){if("number"==typeof this._audioPlaybackEnergy){var e=this._audioPlaybackEnergy;return this._audioPlaybackEnergy=0,e}},t.prototype.requestVideoFrameCallback=function(){var e=this;return new Promise((function(t){var i,r=null===(i=e.videoDom)||void 0===i?void 0:i.requestVideoFrameCallback;if("function"==typeof r){var n=function(e,i){var r={};Object.keys(i).forEach((function(e){var t=e.replace(/[a-z]{1}[A-Z]{1}/g,(function(e){return"".concat(e[0],"_").concat(e[1].toLowerCase())}));r["video_".concat(t)]=i[e]})),clearInterval(o),t(r)};r.call(e.videoDom,n);var o=setTimeout((function(){var i;null===(i=e.videoDom)||void 0===i||i.cancelVideoFrameCallback(n),t({})}),500)}else t({})}))},t}(JF);!function(e){e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED"}(_z||(_z={}));var yz,gz,Sz,Ez,bz=function(e){function t(){var t=e.call(this)||this;return t.isScreen=!1,t.seiList=[],t.videoEncodeConfig=[XV],t.subVideoDescriptions=[],t.enableSimulcast=!1,t.prevScaleResolutionDownBy=1,t.pubAudio=!1,t.pubVideo=!1,t.stream=new MediaStream,t.videoInputConfig={width:640,height:360,frameRate:30},t.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},t.statsReport=new pz(t),t}return Z_(t,e),Object.defineProperty(t.prototype,"hasPublished",{get:function(){return this.audioMid&&this.videoMid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(pG()){var i=t.createEncodedStreams(),r=i.readable,n=i.writable,o=new TransformStream({transform:function(t,i){var r=e.seiList[0];if(r){var n=oz.generateSEI(r.content),o=new Uint8Array(n.byteLength+t.data.byteLength);0===r.repeatCount&&e.seiList.splice(0,1),r.repeatCount--,o.set(new Uint8Array(t.data)),o.set(n,t.data.byteLength),t.data=o.buffer,i.enqueue(t)}else i.enqueue(t)}});r.pipeThrough(o).pipeTo(n)}}else vz.print("no sender found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else vz.print("no sender found when trying to bind encodedTransform")},t.prototype.clean=function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]},t.prototype.switchTrackEnableState=function(e,t){var i;"audio"===e?i=this.audioTrack:"video"===e&&(i=this.videoTrack);var r=null==i?void 0:i.getTrack();return!(!r||(null==r?void 0:r.enabled)===t)&&(r.enabled=t,!0)},t}(mz),Iz=function(e){function t(t,i,r,n,o,a){void 0===a&&(a=oL.LOW);var s=e.call(this)||this;return s.userPriority=a,s.originalStreamIndex=0,s._vStats="-V",s._aStats="-A",s.userId=t,s.isScreen=r,s.isPublic=n,s.streamId=i,s.hasAudio=o.audiostream&&o.localaudio,s.hasVideo=o.videostream&&o.localvideo,s._attributes=o,s.subVideo=!1,s.subAudio=!1,s._sequenceId=0,s.subMediaType=YH.NONE,s.subLayer={spatialLayer:0,spatialSubLayer:-1},s.streamState=_z.INIT,s.statsReport=new fz(s),s}return Z_(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSubscribed",{get:function(){return this.streamState===_z.SUB_ED},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),i=t.readable,r=t.writable;i.pipeThrough(new TransformStream({transform:function(t,i){try{e.safeEmit("onTransformData",e.userId,t)}catch(e){}var r=$H.getNalunits(new ez(t.data)).find((function(e){return e.sei}));if(r){var n=oz.decodeSeiBody(r.body);n&&n.type!==QH.internal&&e.safeEmit("onSEIMessage",n.payload)}i.enqueue(t)}})).pipeTo(r)}else vz.print("no receiver found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else vz.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,i,r,n,o,a;try{$F.rtcInvokeStatus(JSON.stringify({uid:this.userId,streamId:this.streamId,streams:e.streams.reduce((function(e,t){return e+(null==(i=t)?"undefined | null":"string"==typeof i?i:JSON.stringify({id:i.id,active:i.active}));var i}),""),transceiver:(n=e.transceiver,null==n?"undefined | null":"string"==typeof n?n:JSON.stringify({currentDirection:n.currentDirection,direction:n.direction,mid:n.mid,stopped:n.stopped,receiver:(a=n.receiver,null==a?"undefined | null":"string"==typeof a?a:JSON.stringify({track:vU(a.track)})),sender:(o=n.sender,null==o?"undefined | null":"string"==typeof o?o:JSON.stringify({track:vU(o.track)}))})),track:vU(e.track)}),0,"Stream.ontrack","",0)}catch(e){}if((null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)===this.streamId){var s=e.track;"video"===(null==s?void 0:s.kind)?this._setVideoTrack(s):"audio"===(null===(r=e.track)||void 0===r?void 0:r.kind)&&this._setAudioTrack(s),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;vz.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()},t.prototype.resetHasSubscribed=function(){this.streamState=_z.INIT},t.prototype.setRemoteUserPriority=function(e){this.userPriority=e},t.prototype.getStreamPriority=function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e},t.prototype.getSubscribeFallbackParams=function(e){if(e!==nL.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,lz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===nL.AUDIO_ONLY)return[JM.VIDEO,lz.UNSUB]}return null},t.prototype.getSubscribeRecoverParams=function(){if(this.originalMediaType&&fU(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,lz.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,lz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,i;(null===(i=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new xH(e,HL()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,i;(null===(i=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new UH(e,HL()),this.emit("ontrack",this.videoTrack))},t.prototype._getSubLayerBySpatialLayer=function(e){var t=this._attributes,i=t.videoDescriptions,r=t.subVideoDescriptions,n=void 0===r?[]:r,o=i[e],a=o.width,s=o.height,c=n.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}},t}(mz),Tz=new qF("queue",4);!function(e){e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE"}(Sz||(Sz={})),function(e){e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack"}(Ez||(Ez={}));var Az=((yz={})[Ez.publish]="unpublish",yz[Ez.subscribe]="unsubscribe",yz[Ez.pushtrack]="removetrack",yz),Rz=((gz={})[Ez.publish]=Sz.ADD,gz[Ez.subscribe]=Sz.ADD,gz[Ez.pushtrack]=Sz.ADD,gz[Ez.unpublish]=Sz.CLOSE,gz[Ez.unsubscribe]=Sz.CLOSE,gz[Ez.removetrack]=Sz.CLOSE,gz),Cz=function(e){function t(){var t=e.call(this)||this;return t._queue=[],t}return Z_(t,e),Object.defineProperty(t.prototype,"queue",{get:function(){return this._queue},enumerable:!1,configurable:!0}),t.prototype.enqueue=function(e){var t=this._queue.length,i="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==Az[t.action]||(i=t.streamId,Tz.print("offsetStreamId",i),!1)})),this._queue.length===t&&this._queue.push(e),this.emit("start"),i},t.prototype.dequeue=function(){if(!this._queue.length)return null;var e=this._queue.length;nU&&(e=Math.min(this._queue.length,5));for(var t=Rz[this._queue[0].action],i=1;i<e;i++)if(Rz[this._queue[i].action]!==t)return{sdpStrategy:t,items:this._queue.splice(0,i)};return{sdpStrategy:t,items:this._queue.splice(0,e)}},t}(zF),Oz=new qF("ChromeHandler",3),wz=pG(),kz=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="chrome",r._queueBusy=!1,r._mid=0,r._offerMlines=[],r._answerMlines=[],r._inactiveMlineIndex=[],r._msidIndexMap={},r._mlinesCache={},r._sdpQueue=new Cz,r._sdpQueue.on("start",(function(){Oz.print("receive dequeue start","queueBusy: %o: , ss: %o: ",r._queueBusy,r._peerConnection.signalingState),r._queueBusy||"stable"!==r._peerConnection.signalingState||(Oz.print("dequeue start"),r.dequeue())})),r}return Z_(t,e),t.prototype.connect=function(e){var t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y=this;return iv(this,(function(g){switch(g.label){case 0:return Oz.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},o=this,[4,VG(e)];case 1:return o._answerIce=g.sent(),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),[4,this._peerConnection.createOffer()];case 2:return a=g.sent(),[4,(s=new RTCPeerConnection(vG)).setRemoteDescription(a)];case 3:return g.sent(),[4,s.createAnswer()];case 4:return c=g.sent(),[4,s.setLocalDescription(c)];case 5:return g.sent(),s.close(),u=EG.parse(a.sdp),d=EG.parse(c.sdp),(l=!this._offerIce.iceUfrag&&!this._offerIce.icePwd)&&((h="renomination"===(null===(r=u.media[0])||void 0===r?void 0:r.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,p=nv(jG({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=u.media[0])||void 0===n?void 0:n.icePwd,options:(m={},m[FG.kICEConfigTypeSrtpDtlsType]=!0,m[FG.kICEConfigTypeRenominationType]=h,m)}),1),f=p[0],this._answerIce.iceUfrag=f,Oz.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:h}))),_=nv(u.media,1),v=_[0],this._offerIce.fingerprint=u.fingerprint||v.fingerprint,Array.isArray(d.media)&&(d.media=d.media.map((function(e){return"video"===(null==e?void 0:e.type)&&GG(e,"H264"),eU&&"inactive"===(null==e?void 0:e.direction)&&(e.direction="sendonly"),e}))),this._offerSession=$_({},u),this._answerSession=$_({},d),u.media.forEach((function(e,t){var i=y._mid++;l&&(y._offerIce.iceUfrag=v.iceUfrag,y._offerIce.icePwd=v.icePwd),e=$_($_($_({},e),y._offerIce),{mid:"".concat(i)}),y._offerMlines.push(e);var r=$_($_($_({},d.media[t]),y._answerIce),{mid:"".concat(i)});"application"===r.type&&(r.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}),y._answerMlines.push(r)})),this.setDescription(),[4,new Promise((function(e,t){y._dataChannel.onopen=function(){Oz.print("connect","dataChannel open"),cB("es.dc.open",""),e("")},y._dataChannel.onerror=function(e){$F.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,dF.INVALID_DATA),cB("es.dc.error",""),t(e)},y._dataChannel.onclose=function(e){cB("es.dc.close",""),t(e)},y._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==y._peerConnection.iceConnectionState&&"closed"!==y._peerConnection.iceConnectionState&&"failed"!==y._peerConnection.connectionState||t(e)}))}))];case 6:return g.sent(),Oz.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){e.prototype.destroy.call(this),this._mlinesCache={}},t.prototype.publish=function(t,i){return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E;return iv(this,(function(b){return r=t.stream,n=t.enableSimulcast,o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,u="".concat(this._mid++),d="".concat(this._mid++),l=$_($_($_({},this._aSendonlyOfferTpl),this._offerIce),{mid:u,msid:"".concat(r.id," ").concat(r.id,"-audio"),ssrcs:LG(r,"audio")}),h=$_($_($_({},this._vSendonlyOfferTpl),this._offerIce),{mid:d,msid:"".concat(r.id," ").concat(r.id,"-video")}),n?(Oz.print("subVideoDesc","desc: %o ",s),delete h.ssrcGroups,delete h.ssrcs,p=[],h.rids=a.map((function(e){var t=e.rid;return p.unshift(t),{id:t,direction:"send"}})),h.simulcast={dir1:"send",list1:p.join(";")}):(f=function(e,t){var i=MG(),r=MG();return{ssrcs:[i,r].reduce((function(i,r){return i.concat(LG(e,t,r))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(i," ").concat(r)}]}}(r,"video"),_=f.ssrcs,v=f.ssrcGroups,h.ssrcs=_,h.ssrcGroups=v),(JL||eU)&&Array.isArray(h.ext)&&(h.ext=h.ext.filter((function(e){var t;return!(null===(t=null==e?void 0:e.uri)||void 0===t?void 0:t.includes("video-orientation"))}))),(null==i?void 0:i.audioRed)&&Array.isArray(l.rtp)&&-1!==(m=l.rtp.findIndex((function(e){return"red"===e.codec})))&&(y=nv(l.rtp.splice(m,1),1),g=y[0],l.rtp.unshift(g)),location.search.includes("__rtc_vp8__")?GG(h,"VP8"):location.search.includes("__rtc_h264__")&&GG(h,"H264"),(S=null==l?void 0:l.rtp.find((function(e){return"opus"===e.codec})))&&l.fmtp&&(E=l.fmtp.find((function(e){return e.payload===S.payload})))&&this._context&&(E.config+=this._context.audioProfileManager.getOpusConfigStr()),n||JL||this.addBitrateLimit(h,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[l,h],[2,{partialSdp:xG(this._offerSession,l,h),audioMid:u,videoMid:d,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}))}))},t.prototype.subscribe=function(e,t){return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,f;return iv(this,(function(_){switch(_.label){case 0:return Oz.print("subscribe","mids: ",t),i="incroffer",r="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl?[3,3]:[4,dU(!0)];case 1:if(!(n=_.sent()))throw new JB(qB.NOT_SUPPORTED,"Get offer Error");return[4,this.createAVMlineOfferTpl(n)];case 2:_.sent(),_.label=3;case 3:return this._mlinesCache[e.streamId]?(o=nv(this._mlinesCache[e.streamId],2),a=o[0],s=o[1],a.mid=e.audioMid,s.mid=e.videoMid,[2,{partialSdp:xG(this._offerSession,a,s),audioMid:a.mid,videoMid:s.mid,type:i,semantics:r}]):(c="".concat(this._mid++),u="".concat(this._mid++),d=$_($_($_({},this._aRecvonlyOfferTpl),this._offerIce),{mid:c}),l=$_($_($_({},this._vRecvonlyOfferTpl),this._offerIce),{mid:u}),this._mlinesCache[e.streamId]=[d,l],e.isPublic&&((null==(h=null==l?void 0:l.rtp.filter((function(e){return"H264"===e.codec})))?void 0:h.length)&&(null==l?void 0:l.fmtp)&&(null==l||l.fmtp.forEach((function(e){h.find((function(t){return t.payload===e.payload}))&&(e.config+=";sps-pps-idr-in-keyframe=1")}))),(null==l?void 0:l.rtcpFb)&&(p=new Map,f=[],l.rtcpFb.forEach((function(e,t){p.set(e.payload,t)})),p.forEach((function(e,t){f.push({payload:t,idx:e})})),f.sort((function(e,t){return e.idx-t.idx})).forEach((function(e,t){var i;null===(i=null==l?void 0:l.rtcpFb)||void 0===i||i.splice(e.idx+t+1,0,{payload:e.payload,type:"rrtr"})})))),[2,{partialSdp:xG(this._offerSession,d,l),audioMid:c,videoMid:u,type:i,semantics:r,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}}])}}))}))},t.prototype.handleAck=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return Oz.print("handleAck()","item: %o",e),[2,this._sdpQueue.enqueue(e)]}))}))},t.prototype.dequeue=function(){var e,t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,P,N,D,M,L,U=this;return iv(this,(function(x){switch(x.label){case 0:if(this._queueBusy=!0,o=this._sdpQueue.dequeue(),Oz.print("dequeue()","ret: %o",o),!o)return this._queueBusy=!1,[2];x.label=1;case 1:if(x.trys.push([1,24,25,26]),a=o.items,s=o.sdpStrategy,c=[],u=[],d=[],s!==Sz.ADD)return[3,20];delete(l=$_({},this._answerIce)).candidates,x.label=2;case 2:x.trys.push([2,13,14,19]),h=av(a),x.label=3;case 3:return[4,h.next()];case 4:return(p=x.sent()).done?[3,12]:(f=p.value,_=f.action,v=f.transceiverInit,m=f.signalingAck,y=f.stream,g=y instanceof Iz,f.onSuccess&&d.push(f.onSuccess),g&&(null==m?void 0:m.sequenceId)<y.sequenceId?[3,12]:(S={},E={},b=EG.parse(m.sdp),Array.isArray(b.media)&&(I="",b.media.sort((function(e,t){var i;return null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.localeCompare(null==t?void 0:t.type)})).forEach((function(e){"audio"===(e=$_($_({},e),l)).type?(S=e,Oz.print("audioMsid",e.msid),e.msid&&(I=e.msid.replace("audio","video"))):(E=e,Oz.print("videoMsid",I),I&&(E.msid=I,I=""))}))),T=y.streamId,_===Ez.publish&&(T=null===(i=y.stream)||void 0===i?void 0:i.id),this._mlinesCache[T]?(A=nv(this._mlinesCache[T],2),R=A[0],C=A[1],v?(_===Ez.publish&&rU&&(null===(r=null==v?void 0:v.videoTransceiverInit)||void 0===r||delete r.sendEncodings),y.audioTransceiver=this._peerConnection.addTransceiver(v.aTrack,v.audioTransceiverInit),y.videoTransceiver=this._peerConnection.addTransceiver(v.vTrack,v.videoTransceiverInit),this.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:vU(v.aTrack),videoStreamTrack:vU(v.vTrack)}),0,"chromeHandler.addTrack","",0),(O=this._inactiveMlineIndex.shift())||(O=this._offerMlines.length),this._offerMlines[O]=$_($_({},R),{mid:S.mid}),this._answerMlines[O]=S,(w=this._inactiveMlineIndex.shift())||(w=this._offerMlines.length),this._offerMlines[w]=$_($_({},C),{mid:E.mid}),this._answerMlines[w]=E,this._msidIndexMap[y.streamId]=[O,w],wz&&(y.initAudioEncodedTransform(),y.initVideoEncodedTransform()),c.push(y.streamId||""),u.push(g?y.userId:"local"),[3,10]):[3,5]):[3,12]));case 5:return g?(k=nv(this._msidIndexMap[y.streamId]||[],2),P=k[0],N=k[1],P&&N?(null===(n=this._offerMlines[P])||void 0===n?void 0:n.mid)===S.mid?[3,8]:(this._offerMlines[P]=UG(this._offerMlines[P]),this._offerMlines[N]=UG(this._offerMlines[N]),this._answerMlines[P]=UG(this._answerMlines[P]),this._answerMlines[N]=UG(this._answerMlines[N]),[4,this._peerConnection.createOffer()]):[3,9]):[3,10];case 6:return x.sent(),[4,this.setDescription()];case 7:x.sent(),this._offerMlines[P]=$_($_({},this._aRecvonlyOfferTpl),{mid:S.mid}),this._offerMlines[N]=$_($_({},this._vRecvonlyOfferTpl),{mid:E.mid}),Oz.print("enqueue","hack: %o",y.streamId),x.label=8;case 8:return this._answerMlines[P]=S,this._answerMlines[N]=E,[3,10];case 9:Oz.print("dequeue","pushtrack before subscribe: %o",y.userId),x.label=10;case 10:g&&(y.sequenceId=null==m?void 0:m.sequenceId),x.label=11;case 11:return[3,3];case 12:return[3,19];case 13:return D=x.sent(),e={error:D},[3,19];case 14:return x.trys.push([14,,17,18]),p&&!p.done&&(t=h.return)?[4,t.call(h)]:[3,16];case 15:x.sent(),x.label=16;case 16:return[3,18];case 17:if(e)throw e.error;return[7];case 18:return[7];case 19:return[3,21];case 20:M={},a.forEach((function(e){var t,i=e.audioMid,r=e.videoMid;M[i]=i,M[r]=r,delete U._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return M[e.mid]&&(e=UG(e),U._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return M[e.mid]&&(e=UG(e)),e})),x.label=21;case 21:return[4,this._peerConnection.createOffer()];case 22:return x.sent(),[4,this.setDescription(c.length?{streamId:c.join(","),streamUserId:u.join(",")}:void 0)];case 23:x.sent();try{d.forEach((function(e){return e()}))}catch(e){}return Oz.print("dequeue","loop"),[3,26];case 24:return L=x.sent(),Oz.print("dequeue","unknown error: %o",L),[3,26];case 25:return this.dequeue(),[7];case 26:return[2]}}))}))},t.prototype.setDescription=function(e){return tv(this,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:return Oz.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,t=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&t.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=t.join(" "),this._answerSession.groups[0].mids=t.join(" ")),i=zL(),e&&$F.rtcBeginCreateOffer("local"===e.streamUserId?pF.UP:pF.DOWN,e.streamId,e.streamUserId),e&&$F.rtcCreateOffer(0,"local"===e.streamUserId?fF.UP:fF.DOWN,e.streamId,e.streamUserId,zL()-i),[4,this.setLocalDescription(EG.write(this._offerSession),e)];case 1:return r.sent(),[4,this.setRemoteDescription(EG.write(this._answerSession),e)];case 2:return r.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return tv(this,void 0,void 0,(function(){var e,t,i;return iv(this,(function(r){switch(r.label){case 0:return[4,dU(!0)];case 1:if(!(e=r.sent()))throw new JB(qB.NOT_SUPPORTED,"Get offer Error");return this.createAVMlineOfferTpl(e),t=EG.parse(e),i=[],t.media=t.media.filter((function(e){return"recvonly"===e.direction&&(i.push(e.mid+""),!0)})),t.groups=[{mids:i.join(" "),type:"BUNDLE"}],[2,{sdp:EG.write(t),semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.rollback=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return delete this._mlinesCache[e],[2]}))}))},t.prototype.createAVMlineOfferTpl=function(e){var t=this;EG.parse(e).media.forEach((function(e){e.icePwd=t._offerIce.icePwd,e.iceUfrag=t._offerIce.iceUfrag,"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:t._aRecvonlyOfferTpl=e:"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:t._vRecvonlyOfferTpl=e)}))},t}(yG),Pz=new qF("FirefoxHandler",3),Nz=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="firefox",r}return Z_(t,e),t.prototype.connect=function(e){var t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_=this;return iv(this,(function(v){switch(v.label){case 0:return Pz.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},o=this,[4,VG(e)];case 1:return o._answerIce=v.sent(),[4,this._peerConnection.createOffer()];case 2:return a=v.sent(),s=EG.parse(a.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((c="renomination"===(null===(r=s.media[0])||void 0===r?void 0:r.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,u=nv(jG({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=s.media[0])||void 0===n?void 0:n.icePwd,options:(f={},f[FG.kICEConfigTypeSrtpDtlsType]=!0,f[FG.kICEConfigTypeRenominationType]=c,f)}),1),d=u[0],this._answerIce.iceUfrag=d,Pz.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:c}))),l=nv(s.media,1),h=l[0],this._offerIce.fingerprint=s.fingerprint||h.fingerprint,s.media=s.media.map((function(e){return $_($_({},e),_._offerIce)})),(p=$_({},s)).fingerprint=this._answerIce.fingerprint,p.media=p.media.map((function(e){return $_($_($_({},e),_._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(EG.write(s))];case 3:return v.sent(),[4,this.setRemoteDescription(EG.write(p))];case 4:return v.sent(),[4,new Promise((function(e,t){_._dataChannel.onopen=function(){Pz.print("connect","dataChannel open"),cB("es.dc.open",""),e("")},_._dataChannel.onerror=function(e){$F.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,dF.INVALID_DATA),cB("es.dc.error",""),t(e)},_._dataChannel.onclose=function(e){cB("es.dc.close",""),t(e)},_._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==_._peerConnection.iceConnectionState&&"closed"!==_._peerConnection.iceConnectionState&&"failed"!==_._peerConnection.connectionState||t(e)}))}))];case 5:return v.sent(),Pz.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,i){var r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v=this;return iv(this,(function(m){switch(m.label){case 0:return o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(c.aTrack,c.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(c.vTrack,c.videoTransceiverInit),u=zL(),$F.rtcBeginCreateOffer(pF.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return d=m.sent(),$F.rtcCreateOffer(0,fF.UP,"","",zL()-u),(l=EG.parse(d.sdp)).media=null===(r=l.media)||void 0===r?void 0:r.map((function(e){return $_($_({},e),v._offerIce)})),[4,this.setLocalDescription(EG.write(l))];case 2:return m.sent(),h=t.audioTransceiver.mid,p=t.videoTransceiver.mid,f=null,_=null,l.media=null===(n=l.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===h){var t=null==(f=e)?void 0:f.rtp.find((function(e){return"opus"===e.codec}));if(t&&f.fmtp){var i=f.fmtp.find((function(e){return e.payload===t.payload}));i&&v._context&&(i.config+=v._context.audioProfileManager.getOpusConfigStr())}}else"".concat(e.mid)===p&&(_=e);return e})),this.addBitrateLimit(_,t.videoEncodeConfig[0].maxKbps),[4,this.setLocalDescription(EG.write(l))];case 3:return m.sent(),[2,{partialSdp:xG(l,f,_),audioMid:h,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}}))}))},t.prototype.subscribe=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d=this;return iv(this,(function(l){switch(l.label){case 0:return Pz.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),r=zL(),$F.rtcBeginCreateOffer(pF.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return n=l.sent(),$F.rtcCreateOffer(0,fF.UP,e.streamId,e.userId,zL()-r),(o=EG.parse(n.sdp)).media=null===(t=o.media)||void 0===t?void 0:t.map((function(e){return $_($_({},e),d._offerIce)})),[4,this.setLocalDescription(EG.write(o),{streamId:e.streamId||"",streamUserId:e.userId})];case 2:return l.sent(),a=e.audioTransceiver.mid,s=e.videoTransceiver.mid,c=null,u=null,null===(i=o.media)||void 0===i||i.forEach((function(e){"".concat(e.mid)===a?c=e:"".concat(e.mid)===s&&(u=e)})),[2,{partialSdp:xG(o,c,u),audioMid:a,videoMid:s,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c=this;return iv(this,(function(u){return e.action===Ez.unpublish||e.action===Ez.unsubscribe||(r=e.signalingAck,n={},(o=EG.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),EG.parse(null==r?void 0:r.sdp).media.forEach((function(e){n[e.mid]=$_($_({},e),c._answerIce)})),a=[],(s=EG.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media.forEach((function(e){a.push(n[e.mid])})),o.groups=s.groups,o.media=a,this.setRemoteDescription(EG.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){return[2,{semantics:"unified-plan",sdp:"",type:"offer"}]}))}))},t.prototype.rollback=function(e,t){var i,r;return tv(this,void 0,void 0,(function(){var e,n,o;return iv(this,(function(a){switch(a.label){case 0:return Pz.print("rollback()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=EG.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media=n.media.map((function(i){return"".concat(i.mid)!==t.audioMid&&"".concat(i.mid)!==t.videoMid||(i=UG(i)),"inactive"!==i.direction&&e.push(i.mid),i})),(o=EG.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media=o.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=UG(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this._peerConnection.createOffer()]):[3,4];case 1:return a.sent(),[4,this.setLocalDescription(EG.write(n))];case 2:return a.sent(),[4,this.setRemoteDescription(EG.write(o))];case 3:a.sent(),a.label=4;case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this._peerConnection.createOffer()];case 1:return e.sent(),this._peerConnection.localDescription&&this._peerConnection.remoteDescription?[4,this._peerConnection.setLocalDescription(this._peerConnection.localDescription)]:[3,4];case 2:return e.sent(),[4,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},t}(yG),Dz=new qF("FallbackHandler",3),Mz=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="fallback",Dz.print("ctor","using fallback handler"),t.rtcError("using fallback handler",-1),r}return Z_(t,e),t.prototype.connect=function(e){var t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_=this;return iv(this,(function(v){switch(v.label){case 0:return Dz.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},o=this,[4,VG(e)];case 1:return o._answerIce=v.sent(),[4,this._peerConnection.createOffer()];case 2:return a=v.sent(),s=EG.parse(a.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((c="renomination"===(null===(r=s.media[0])||void 0===r?void 0:r.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,u=nv(jG({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=s.media[0])||void 0===n?void 0:n.icePwd,options:(f={},f[FG.kICEConfigTypeSrtpDtlsType]=!0,f[FG.kICEConfigTypeRenominationType]=c,f)}),1),d=u[0],this._answerIce.iceUfrag=d,Dz.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:c}))),l=nv(s.media,1),h=l[0],this._offerIce.fingerprint=s.fingerprint||h.fingerprint,s.media=s.media.map((function(e){return $_($_({},e),_._offerIce)})),(p=$_({},s)).fingerprint=this._answerIce.fingerprint,p.media=p.media.map((function(e){return $_($_($_({},e),_._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(a.sdp)];case 3:return v.sent(),[4,this.setRemoteDescription(EG.write(p))];case 4:return v.sent(),[4,new Promise((function(e,t){_._dataChannel.onopen=function(){Dz.print("connect","dataChannel open"),cB("es.dc.open",""),e("")},_._dataChannel.onerror=function(e){$F.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,dF.INVALID_DATA),cB("es.dc.error",""),t(e)},_._dataChannel.onclose=function(e){cB("es.dc.close",""),t(e)},_._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==_._peerConnection.iceConnectionState&&"closed"!==_._peerConnection.iceConnectionState&&"failed"!==_._peerConnection.connectionState||t(e)}))}))];case 5:return v.sent(),Dz.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,i){var r;return tv(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f;return iv(this,(function(_){switch(_.label){case 0:return n=e.prototype.internalPublish.call(this,t,i),o=n.videoDescriptions,a=n.subVideoDescriptions,s=n.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(s.aTrack,s.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(s.vTrack,s.videoTransceiverInit),c=zL(),$F.rtcBeginCreateOffer(pF.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return u=_.sent(),$F.rtcCreateOffer(0,fF.UP,"","",zL()-c),d=EG.parse(u.sdp),[4,this.setLocalDescription(u.sdp)];case 2:return _.sent(),l=t.audioTransceiver.mid,h=t.videoTransceiver.mid,p=null,f=null,d.media=null===(r=d.media)||void 0===r?void 0:r.map((function(e){return"".concat(e.mid)===l?p=e:"".concat(e.mid)===h&&(f=e),e})),pG()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),[2,{partialSdp:xG(d,p,f),audioMid:l,videoMid:h,type:"incroffer",semantics:"unified-plan",videoDescriptions:o,subVideoDescriptions:a,transceiverInit:s}]}}))}))},t.prototype.subscribe=function(e){var t;return tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c;return iv(this,(function(u){switch(u.label){case 0:return Dz.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),i=zL(),$F.rtcBeginCreateOffer(pF.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return r=u.sent(),$F.rtcCreateOffer(0,fF.UP,e.streamId,e.userId,zL()-i),n=EG.parse(r.sdp),[4,this.setLocalDescription(r.sdp,{streamId:e.streamId||"",streamUserId:e.userId})];case 2:return u.sent(),o=e.audioTransceiver.mid,a=e.videoTransceiver.mid,s=null,c=null,null===(t=n.media)||void 0===t||t.forEach((function(e){"".concat(e.mid)===o?s=e:"".concat(e.mid)===a&&(c=e)})),pG()&&(e.initVideoEncodedTransform(),e.initAudioEncodedTransform()),[2,{partialSdp:xG(n,s,c),audioMid:o,videoMid:a,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c=this;return iv(this,(function(u){return e.action===Ez.removetrack||e.action===Ez.unpublish||e.action===Ez.unsubscribe||(r=e.signalingAck,n={},(o=EG.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),EG.parse(null==r?void 0:r.sdp).media.forEach((function(t){var i="audio"===t.type?e.audioMid:e.videoMid;n[i]=$_($_($_({},t),c._answerIce),{mid:i})})),a=[],(s=EG.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media.forEach((function(e){a.push(n[e.mid])})),o.groups=s.groups,o.media=a,this.setRemoteDescription(EG.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return tv(this,void 0,void 0,(function(){var e,t,i,r;return iv(this,(function(n){switch(n.label){case 0:return(e=new RTCPeerConnection).addTransceiver("audio",{direction:"recvonly"}),e.addTransceiver("video",{direction:"recvonly"}),[4,e.createOffer()];case 1:return t=n.sent(),i=EG.parse(t.sdp),r=[],i.media=i.media.filter((function(e){if("recvonly"===e.direction){var t="template_".concat(e.type);return e.mid=t,r.push(t),!0}return!1})),i.groups=[{mids:r.join(" "),type:"BUNDLE"}],e.close(),[2,{semantics:"unified-plan",sdp:EG.write(i),type:"offer"}]}}))}))},t.prototype.rollback=function(e,t){var i,r;return tv(this,void 0,void 0,(function(){var e,n,o,a;return iv(this,(function(s){switch(s.label){case 0:return Dz.print("rollback()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=EG.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media=n.media.map((function(i){return"".concat(i.mid)!==t.audioMid&&"".concat(i.mid)!==t.videoMid||(i=UG(i)),"inactive"!==i.direction&&e.push(i.mid),i})),(o=EG.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media=o.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=UG(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this._peerConnection.createOffer()]):[3,4];case 1:return a=s.sent(),[4,this.setLocalDescription(a.sdp)];case 2:return s.sent(),[4,this.setRemoteDescription(EG.write(o))];case 3:s.sent(),s.label=4;case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this._peerConnection.createOffer()];case 1:return e.sent(),this._peerConnection.localDescription&&this._peerConnection.remoteDescription?[4,this._peerConnection.setLocalDescription(this._peerConnection.localDescription)]:[3,4];case 2:return e.sent(),[4,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},t}(yG);function Lz(e,t){for(var i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r]}var Uz=function(){function e(e){this._queue=[],this._runningTask=[],this.busy=!1,this.executor=e}return e.prototype.add=function(e){var t=Hz(),i=t.promise,r=t.resolve,n=t.reject;return this._queue.push({item:e,resolve:r,reject:n}),this.busy||this._emit(),i},e.prototype.destroy=function(){ov(ov([],nv(this._queue),!1),nv(this._runningTask),!1).forEach((function(e){(0,e.reject)(new JB(qB.OPERATION_CANCEL,"queue close"))})),this.busy=!1,this._queue=[]},e.prototype._emit=function(){return tv(this,void 0,void 0,(function(){var e,t,i,r,n,o,a=this;return iv(this,(function(s){switch(s.label){case 0:if(e=this._queue,this._runningTask=e,this._queue=[],0===e.length)return this.busy=!1,[2];t=e.map((function(e){return e.item})),i=e.map((function(e){return e.resolve})),r=e.map((function(e){return e.reject})),s.label=1;case 1:return s.trys.push([1,3,,4]),this.busy=!0,[4,this.executor(t)];case 2:return n=s.sent(),i.forEach((function(e){return e(n)})),[3,4];case 3:return o=s.sent(),r.forEach((function(e){return e(o)})),[3,4];case 4:return this._runningTask=[],setTimeout((function(){a._emit()})),[2]}}))}))},e}(),xz=new qF("StandardHandler",3),Vz=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="standard",r._applyQueue=new Uz(r.apply.bind(r)),r._createQueue=new Uz(r.create.bind(r)),r._pqueue=new Gz,r._midMap=new Map,xz.print("ctor","using standard handler"),t.rtcInvokeStatus("using standard handler",0,"StandardHandler","",0),r}return Z_(t,e),t.prototype.connect=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p=this;return iv(this,(function(f){switch(f.label){case 0:return xz.print("connect","standard invoke. %o",e),this._iceNode=e,this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},r=this,[4,VG(e)];case 1:return r._answerIce=f.sent(),[4,this._peerConnection.createOffer()];case 2:if(n=f.sent(),!(o=n.sdp))throw new JB(qB.NOT_SUPPORTED,"create offer sdp failed.");return a=EG.parse(o),s=a.media.find((function(e){return"application"===e.type})),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((c="renomination"===(null==s?void 0:s.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,u=nv(jG({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null==s?void 0:s.icePwd,options:(h={},h[FG.kICEConfigTypeSrtpDtlsType]=!0,h[FG.kICEConfigTypeRenominationType]=c,h)}),1),d=u[0],this._answerIce.iceUfrag=d,xz.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:c}))),this._offerIce.fingerprint=a.fingerprint||s.fingerprint,(l=$_({},a)).fingerprint=this._answerIce.fingerprint,this._answerSession=$_({},l),l.media=l.media.map((function(e){return"application"===(e=$_($_({},e),p._answerIce)).type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}),e})),"v1"!==this.getIceVersion()?[3,4]:(a.media=a.media.map((function(e){return e=$_($_({},e),p._offerIce)})),[4,this.setLocalDescription(EG.write(a))]);case 3:return f.sent(),[3,6];case 4:return[4,this.setLocalDescription(o)];case 5:f.sent(),f.label=6;case 6:return[4,this.setRemoteDescription(EG.write(l))];case 7:return f.sent(),[4,new Promise((function(e,t){p._dataChannel.onopen=function(){xz.print("connect","dataChannel open"),cB("es.dc.open",""),e("")},p._dataChannel.onerror=function(e){$F.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,dF.INVALID_DATA),cB("es.dc.error",""),t(e)},p._dataChannel.onclose=function(e){cB("es.dc.close",""),t(e)},p._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==p._peerConnection.iceConnectionState&&"closed"!==p._peerConnection.iceConnectionState&&"failed"!==p._peerConnection.connectionState||t(e)}))}))];case 8:return f.sent(),xz.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,i){var r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_;return iv(this,(function(v){switch(v.label){case 0:return xz.print("publish()","streamId: ".concat(t.streamId)),this._pubConfig=i,o=e.prototype.internalPublish.call(this,t),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(c.aTrack,$_($_({},c.audioTransceiverInit),{direction:"sendonly"})),t.videoTransceiver=this._peerConnection.addTransceiver(c.vTrack,$_($_({},c.videoTransceiverInit),{direction:"sendonly"})),u=zL(),$F.rtcBeginCreateOffer(pF.UP,"",""),[4,this._createQueue.add()];case 1:return d=v.sent(),$F.rtcCreateOffer(0,fF.UP,"","",zL()-u),l=t.audioTransceiver.mid,h=t.videoTransceiver.mid,Lz(l&&h,"Transceiver not return MID after setLocalDescription"),t.audioMid=l,t.videoMid=h,p=null,f=null,(_=EG.parse(d)).media=null===(r=_.media)||void 0===r?void 0:r.map((function(e){return"".concat(e.mid)===l?p=e:"".concat(e.mid)===h&&(f=e),e})),(null===(n=this._context)||void 0===n?void 0:n.pcKillSwitch.ctor_encodedinsetablestream_add)&&pG()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),[2,{partialSdp:xG(_,p,f),audioMid:l,videoMid:h,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}}))}))},t.prototype.subscribe=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u;return iv(this,(function(d){switch(d.label){case 0:return xz.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),r=zL(),$F.rtcBeginCreateOffer(pF.UP,e.streamId,e.userId),[4,this._createQueue.add()];case 1:return n=d.sent(),$F.rtcCreateOffer(0,fF.UP,e.streamId,e.userId,zL()-r),o=e.audioTransceiver.mid,a=e.videoTransceiver.mid,s=null,c=null,u=EG.parse(n),null===(t=u.media)||void 0===t||t.forEach((function(e){"".concat(e.mid)===o?s=e:"".concat(e.mid)===a&&(c=e)})),(null===(i=this._context)||void 0===i?void 0:i.pcKillSwitch.ctor_encodedinsetablestream_add)&&pG()&&(e.initVideoEncodedTransform(),e.initAudioEncodedTransform()),[2,{partialSdp:xG(u,s,c),audioMid:o,videoMid:a,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){return tv(this,void 0,void 0,(function(){var t,i,r;return iv(this,(function(n){switch(n.label){case 0:return t=e.signalingAck,(i=e.stream).audioMid=e.audioMid,i.videoMid=e.videoMid,e.action===Ez.removetrack?[2,""]:e.action!==Ez.unpublish&&e.action!==Ez.unsubscribe?[3,2]:[4,this.close(e.stream)];case 1:case 3:return n.sent(),[2,""];case 2:return r=EG.parse(null==t?void 0:t.sdp),[4,this._internalSetRemoteDescription(r.media,i)]}}))}))},t.prototype._internalSetRemoteDescription=function(e,t){return tv(this,void 0,void 0,(function(){var i=this;return iv(this,(function(r){switch(r.label){case 0:return e.forEach((function(e){"audio"===(e=$_($_({},e),i._answerIce)).type&&(t.audioMid?(e.mid=t.audioMid,i._midMap.set(t.audioMid,e)):i._midMap.set(e.mid,e)),"video"===e.type&&(t.videoMid?(e.mid=t.videoMid,i._midMap.set(t.videoMid,e)):i._midMap.set(e.mid,e))})),t instanceof bz?this.handlePublishAction({stream:t}):this.handleSubscribeAction({stream:t}),[4,this._applyQueue.add()];case 1:return r.sent(),[2]}}))}))},t.prototype.handlePublishAction=function(e){var t,i,r,n=e.stream,o=n.audioMid?this._midMap.get(n.audioMid):void 0,a=n.videoMid?this._midMap.get(n.videoMid):void 0,s=(null===(t=this._pubConfig)||void 0===t?void 0:t.audioRed)?"RED":"OPUS";"OPUS"!==s&&o&&function(e,t){if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){for(var i=0;i<e.rtp.length;i++)if(e.rtp[i].codec.toUpperCase()===t.toUpperCase()){e.rtp.unshift(e.rtp.splice(i,1)[0]);break}var r=[];e.rtp.forEach((function(e){return r.push(e.payload)})),e.payloads=r.join(" ")}}(o,s),(null===(i=this._context)||void 0===i?void 0:i.pcKillSwitch.sld_fmtp_opus_add)&&jz.decorateOpusConfig(o,null===(r=this._context)||void 0===r?void 0:r.audioProfileManager),n.audioMid&&o&&this._midMap.set(n.audioMid,o),n.videoMid&&a&&this._midMap.set(n.videoMid,a)},t.prototype.handleSubscribeAction=function(e){var t,i=e.stream,r=i.audioMid?this._midMap.get(i.audioMid):void 0,n=i.videoMid?this._midMap.get(i.videoMid):void 0;(null===(t=this._context)||void 0===t?void 0:t.pcKillSwitch.sld_fmtp_opus_add)&&jz.decorateOpusConfig(r),i.audioMid&&r&&this._midMap.set(i.audioMid,r),i.videoMid&&n&&this._midMap.set(i.videoMid,n)},t.prototype.getDefaultSdp=function(){return tv(this,void 0,void 0,(function(){var e,t,i,r;return iv(this,(function(n){switch(n.label){case 0:return(e=new RTCPeerConnection).addTransceiver("audio",{direction:"recvonly"}),e.addTransceiver("video",{direction:"recvonly"}),[4,e.createOffer()];case 1:return t=n.sent(),i=EG.parse(t.sdp),r=[],i.media=i.media.filter((function(e){if("recvonly"===e.direction){var t="template_".concat(e.type);return e.mid=t,r.push(t),!0}return!1})),i.groups=[{mids:r.join(" "),type:"BUNDLE"}],e.close(),[2,{semantics:"unified-plan",sdp:EG.write(i),type:"offer"}]}}))}))},t.prototype.rollback=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){return[2,this.close(t)]}))}))},t.prototype.close=function(e){return tv(this,void 0,void 0,(function(){var t,i,r,n;return iv(this,(function(o){switch(o.label){case 0:if(xz.print("close()"),t=e.audioMid,i=e.videoMid,e.audioTransceiver&&t)try{e.audioTransceiver.stop(),delete e.audioTransceiver}catch(e){}if(e.videoTransceiver&&i)try{e.videoTransceiver.stop(),delete e.videoTransceiver}catch(e){}return r=t?this._midMap.get(t):void 0,n=i?this._midMap.get(i):void 0,r&&UG(r),n&&UG(n),t&&r&&this._midMap.set(t,r),i&&n&&this._midMap.set(i,n),[4,this._applyQueue.add()];case 1:return o.sent(),[2]}}))}))},t.prototype.setCurrentDescription=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this._applyQueue.add()];case 1:return e.sent(),[2]}}))}))},t.prototype.create=function(){return tv(this,void 0,void 0,(function(){var e,t;return iv(this,(function(i){switch(i.label){case 0:return xz.print("RTCPeerConnection create"),[4,this._peerConnection.createOffer()];case 1:return e=i.sent(),Lz(t=e.sdp,"RTCPeerConnection not return SDP"),[4,this.setLocalDescription(t)];case 2:return i.sent(),[2,t]}}))}))},t.prototype.apply=function(){return tv(this,void 0,void 0,(function(){var e,t,i,r;return iv(this,(function(n){switch(n.label){case 0:return xz.print("RTCPeerConnection apply"),[4,this._peerConnection.createOffer()];case 1:return e=n.sent(),Lz(t=e.sdp,"RTCPeerConnection not return SDP",t),i=EG.parse(t),t=this.generateOffer(i,t),r=this.generateAnswer(i),[4,this.setLocalDescription(t)];case 2:return n.sent(),[4,this.setRemoteDescription(r)];case 3:return n.sent(),[2]}}))}))},t.prototype.generateOffer=function(e,t){var i,r=this,n=!1;return"v1"===this.getIceVersion()&&YL&&(e.media=e.media.map((function(e){return $_($_({},e),r._offerIce)})),n=!0),(null===(i=this._context)||void 0===i?void 0:i.pcKillSwitch.sld_fmtp_opus_add)&&(e.media=e.media.map((function(e){var t;if("audio"===e.type){var i="sendonly"===e.direction;jz.decorateOpusConfig(e,i?null===(t=r._context)||void 0===t?void 0:t.audioProfileManager:void 0)}return e})),n=!0),n?EG.write(e):t},t.prototype.generateAnswer=function(e){var t=this,i=[];return e.media.forEach((function(e){if("application"===e.type){Lz(void 0!==e.mid,"should always have mid in mline",e);var r=t._midMap.get(e.mid);return r||(r=t.generateDCAnswer(e),t._midMap.set(e.mid,r)),void i.push($_({},r))}var n="".concat(e.mid);Lz(n,"No MID in offer m-line: ".concat(e));var o=t._midMap.get(n);o||(xz.print("generateInactiveAnswerMLine","mid: %o, mLine: %o",e.mid,e),o=t.generateInactiveAnswerMLine(e)),i.push(o)})),this.createAnswerSdp(i,e.groups)},t.prototype.generateInactiveAnswerMLine=function(e){return $_($_($_({},e),this._answerIce),{direction:"inactive"})},t.prototype.generateDCAnswer=function(e){var t=$_($_($_({},e),this._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}});return YL&&(delete t.bundleOnly,t.port=9),t},t.prototype.getIceVersion=function(){var e,t;return(null===(e=this._iceNode)||void 0===e?void 0:e.iceParams.clientIceUfrag)||(null===(t=this._iceNode)||void 0===t?void 0:t.iceParams.clientIcePwd)?"v1":"v2"},t.prototype.createAnswerSdp=function(e,t){Lz(this._answerSession,"_answerSession should be existed");var i=$_({},this._answerSession);return i.media=e,i.groups=t,EG.write(i)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this._pqueue.destroy(),this._applyQueue.destroy(),this._createQueue.destroy()},ev([Fz],t.prototype,"create",null),ev([Bz],t.prototype,"apply",null),t}(yG);function Fz(e,t,i){var r=i.value;return i.value=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(n){switch(n.label){case 0:return xz.print("SDP Lock","pending task %o",t),[4,this._pqueue.enqueue(0)];case 1:i=n.sent(),xz.print("SDP Lock","running task %o",t),n.label=2;case 2:return n.trys.push([2,,4,5]),[4,null==r?void 0:r.apply(this,e)];case 3:return[2,n.sent()];case 4:return xz.print("SDP Lock","unlocking by task %o",t),i(),[7];case 5:return[2]}}))}))},i}function Bz(e,t,i){var r=i.value;return i.value=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(n){switch(n.label){case 0:return xz.print("SDP Lock","pending task %o",t),[4,this._pqueue.enqueue(1)];case 1:i=n.sent(),xz.print("SDP Lock","running task %o",t),n.label=2;case 2:return n.trys.push([2,,4,5]),[4,null==r?void 0:r.apply(this,e)];case 3:return[2,n.sent()];case 4:return xz.print("SDP Lock","unlocking by task %o",t),i(),[7];case 5:return[2]}}))}))},i}var jz={decorateOpusConfig:function(e,t){if(e){var i=null==e?void 0:e.rtp.find((function(e){return"opus"===e.codec}));if(i&&e.fmtp){var r=e.fmtp.find((function(e){return e.payload===i.payload}));r&&(t&&(r.config=t.getOpusConfigStr()),r.config=qz(r.config))}}},removeRtxInMLine:function(e){var t;if(e){var i=[];e.rtp=e.rtp.filter((function(e){return"rtx"===e.codec&&i.push(e.payload),"rtx"!==e.codec})),e.fmtp=e.fmtp.filter((function(e){return i.includes(e.payload)})),e.payloads=null===(t=e.payloads)||void 0===t?void 0:t.split(" ").filter((function(e){return!i.includes(parseInt(e))})).join(" ")}},removeExtSdesMid:function(e){var t;e&&(e.ext=null===(t=e.ext)||void 0===t?void 0:t.filter((function(e){return!e.uri.includes("sdes:mid")})))},selectCC:function(e,t){var i,r,n,o;e&&("tcc"===t?(e.ext=null===(i=e.ext)||void 0===i?void 0:i.filter((function(e){return-1===e.uri.indexOf("abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:r.filter((function(e){return"goog-remb"!==e.type}))):"remb"===t&&(e.rtcpFb=null===(n=e.rtcpFb)||void 0===n?void 0:n.filter((function(e){return"transport-cc"!==e.type})),e.ext=null===(o=e.ext)||void 0===o?void 0:o.filter((function(e){return-1===e.uri.indexOf("transport")}))))},addRRTR:function(e){e&&e.rtp.forEach((function(t){e.rtcpFb||(e.rtcpFb=[]),e.rtcpFb.find((function(e){return e.payload===t.payload&&"rrtr"===e.type}))||e.rtcpFb.push({payload:t.payload,type:"rrtr"})}))},removeRtpStreamId:function(e){e&&Array.isArray(e.ext)&&(e.ext=e.ext.filter((function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri})))},decorateSpsPpsIdrInKeyframe:function(e){if(e){var t=e.rtp.filter((function(e){return"H264"===e.codec}));t.length&&e.fmtp&&e.fmtp.forEach((function(e){t.find((function(t){return t.payload===e.payload}))&&(e.config+=";sps-pps-idr-in-keyframe=1")}))}},removeExtVideoOrientation:function(e){e&&Array.isArray(e.ext)&&(e.ext=e.ext.filter((function(e){return!e.uri.includes("video-orientation")})))},removeExtFramemarking:function(e){e&&Array.isArray(e.ext)&&(e.ext=e.ext.filter((function(e){return!e.uri.includes("framemarking")})))}},Gz=function(){function e(){this.queue=[],this.processing=!1}return e.prototype.enqueue=function(e){return void 0===e&&(e=0),tv(this,void 0,void 0,(function(){var t,i,r,n,o,a=this;return iv(this,(function(s){switch(s.label){case 0:return t=Hz(),i=t.promise,r=t.resolve,n={priority:e,resolve:r},o=this.queue.findIndex((function(t){return t.priority>e})),-1===o?this.queue.push(n):this.queue.splice(o,0,n),this.tryProcess(),[4,i];case 1:return s.sent(),this.processing=!0,[2,function(){a.processing=!1,a.tryProcess()}]}}))}))},e.prototype.destroy=function(){this.queue.forEach((function(e){(0,e.resolve)()})),this.queue=[],this.processing=!1},e.prototype.tryProcess=function(){if(!this.processing){var e=this.queue.shift();e&&e.resolve()}},e}();function Hz(){var e=void 0,t=void 0,i=new Promise((function(i,r){e=i,t=r}));if(!e||!t)throw Error("Broken Implement of Promise");return{promise:i,resolve:e,reject:t}}var zz,Kz,Wz,qz=function(e){var t={};return e.split(";").forEach((function(e){var i=nv(e.split("="),2),r=i[0],n=i[1];r&&n&&(t[r]=n)})),t["sprop-stereo"]=1,t.stereo=1,Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).join(";")},Xz=function(e,t){return(null==t?void 0:t.enableFallbackHandler)?new Mz(e,t):(null==t?void 0:t.enableStandardHandler)?new Vz(e,t):YL?new Nz(e,t):new kz(e,t)},Yz=new qF("Locker",2),Jz=1,Qz=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=Jz++,e&&(this.name=e),Yz.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return Object.defineProperty(e.prototype,"isLocked",{get:function(){return this.locks>0},enumerable:!1,configurable:!0}),e.prototype.lock=function(){var e,t=this;this.locks+=1,Yz.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var i=new Promise((function(i){e=function(){t.locks-=1,Yz.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),i()}})),r=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return i})),r},e}();!function(e){e[e.communication=0]="communication",e[e.live_broadcasting=1]="live_broadcasting",e[e.game=2]="game",e[e.cloud_game=3]="cloud_game",e[e.low_latency=4]="low_latency",e[e.chat=5]="chat",e[e.chat_room=6]="chat_room",e[e.lw_together=7]="lw_together",e[e.game_hd=8]="game_hd",e[e.co_host=9]="co_host",e[e.interactive_podcast=10]="interactive_podcast",e[e.ktv=11]="ktv",e[e.chorus=12]="chorus",e[e.vr_chat=13]="vr_chat",e[e.game_streaming=14]="game_streaming",e[e.lan_live_streaming=15]="lan_live_streaming",e[e.meeting=16]="meeting",e[e.meeting_room=17]="meeting_room",e[e.classroom=18]="classroom"}(Kz||(Kz={})),function(e){e.IES_living="IES_living",e.FeedShare="FeedShare",e.fluent="fluent",e.IES_chatroom="IES_chatroom",e.standard="standard",e.IES_PK="IES_PK",e.IES_KTV="IES_KTV"}(Wz||(Wz={}));var Zz,$z=((zz={})[cL.communication]=[Kz.communication],zz[cL.chat]=[Kz.communication],zz[cL.chatRoom]=[Kz.live_broadcasting,Wz.IES_chatroom],zz[cL.coHost]=[Kz.live_broadcasting,Wz.IES_PK],zz[cL.meeting]=[Kz.meeting],zz[cL.classRoom]=[Kz.communication],zz),eK=new qF("MediaServerClient",2);!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(Zz||(Zz={}));var tK,iK=function(e,t){eK.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},rK=function(e){function t(t,i){void 0===i&&(i=$F);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._subResolves={},r.supportConcurrent=!1,r._pubConfig={},r._subConfig={},r._roomProfile=cL.communication,r._subStreamQueue={},r.monitor=i,r._pubSubLock=new Qz("pubSubLock"),r._joinLeaveLock=new Qz("joinLeaveLock"),r._state=Zz.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r._context=t,r.on("SUB_END",(function(e){return r._handleSubStreamQueue(e)})),r}return Z_(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){eK.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(kj.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[Oj.ON_ADD_STREAM,Oj.ON_REMOVE_STREAM,Oj.USER_CONNECTION,Oj.USER_DISCONNECTION,Oj.ON_UPDATE_STREAM_ATTRIBUTES,Oj.ON_UPDATE_ROOM_ATTRIBUTES,Oj.ON_PUSH_TRACK,Oj.ON_REMOVE_TRACK,Oj.NODE_CHANGE,Oj.ON_CUSTOM_MESSAGE,Oj.USER_MESSAGE_RECEIVED,Oj.USER_BINARY_MESSAGE_RECEIVED,Oj.POST_PROCESSING_MESSAGE,Oj.ON_USER_TOKEN_WILL_EXPIRE,Oj.STREAM_CONTROL_MESSAGE,Oj.ON_SCENE_CONFIG,Oj.ON_STREAM_FAILED,wj.RSCP].forEach((function(e){var i;null===(i=t._dataChannelSignal)||void 0===i||i.on(e,(function(i){t.safeEmit(e,i)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){eK.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(kj.ABNORMAL_DISCONNECTION)}))},t.prototype._removeSignalEventHandler=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()},Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(kj.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.connect=function(e,t,i,r){var n;return void 0===t&&(t=""),void 0===i&&(i=""),void 0===r&&(r={}),tv(this,void 0,void 0,(function(){var o,a,s,c,u,d=this;return iv(this,(function(l){switch(l.label){case 0:return this.connectionState=Zz.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),r.node?(o=[r.node],cB("es.join.nodeChange",r),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new Kj,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,i,xV.getDeviceId(),null==r?void 0:r.reason,null==r?void 0:r.feedbackNode,this._useCloudProxy)];case 2:if(!(o=l.sent()))throw cB("es.join.getNodeFailed",""),new JB(qB.ICE_SERVER_WRONG,"get ICE config failed");cB("es.join.getNodeSuccess",o),l.label=3;case 3:this._addHandlerEvents(),Promise.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),l.label=4;case 4:return l.trys.push([4,6,,7]),s=!1,c=o.map((function(e){var t=Xz(d.monitor,d._context);return t.connect(e).then((function(i){s?t.destroy():(s=!0,a=i,d.safeEmit("prevIceNode",e),d._handler=t,d.supportConcurrent="chrome"===t.name||"standard"===t.name,d._addHandlerEvents())})).catch((function(){t.destroy()}))})),[4,lU(c)];case 5:return l.sent(),eK.print("join","establish peerConnection success"),[3,7];case 6:throw u=l.sent(),this.connectionState=Zz.DISCONNECTED,new JB(qB.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",u);case 7:if(!a)throw this.connectionState=Zz.DISCONNECTED,new JB(qB.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");return this._dataChannelSignal=new Gj(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,i,r){var n,o,a,s,c,u,d,l,h,p,f,_,v,m;return void 0===t&&(t={}),void 0===i&&(i=!1),tv(this,void 0,void 0,(function(){var y,g,S,E,b,I,T,A,R=this;return iv(this,(function(C){switch(C.label){case 0:return eK.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,i,r),this._appId=e.appId,this._token=e.token,this._roomId=e.roomId,this._clientId=e.userInfo.userId,this._businessId=e.userInfo.businessId,this._userInfo=e.userInfo,this._useCloudProxy=e.useCloudProxy,this._roomProfile=e.roomProfile,this._sessionId=t.sessionId,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return C.sent(),T={Authorization:qL.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId||"",timestamp:Date.now(),controlMessage:r,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role}},A={},[4,hG()];case 2:return T.params=(A.supportedCodecs=C.sent(),A.deviceType="web",A.userAgent=window.navigator.userAgent,A.sdkVersion=jV.VERSION,A.deviceId=xV.getDeviceId(),A.appId=this._appId,A.roomId=this._roomId,A.userId=this._clientId,A.businessId=this._businessId,A.enableCloudProxy=this._useCloudProxy,A.channelProfile=$z[this._roomProfile]?$z[this._roomProfile][0]+"":"0",A),T.options={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0},T.accessParams=JSON.stringify({requireICEUfragV2:!0}),y=T,"chrome"!==(null===(n=this.handler)||void 0===n?void 0:n.name)?[3,4]:(g=y,[4,null===(o=this._handler)||void 0===o?void 0:o.getDefaultSdp()]);case 3:g.sdpInfo=C.sent(),y.options.enableUnBundleMode=!0,C.label=4;case 4:return"standard"!==(null===(a=this.handler)||void 0===a?void 0:a.name)&&"fallback"!==(null===(s=this.handler)||void 0===s?void 0:s.name)?[3,6]:(S=y,[4,null===(c=this._handler)||void 0===c?void 0:c.getDefaultSdp()]);case 5:S.sdpInfo=C.sent(),y.options.enableUnBundleMode=!0,y.options.enableAudioMux=!0,C.label=6;case 6:Promise.resolve().then((function(){return R.emit("onSendingJoinMessageHook")})),C.label=7;case 7:return C.trys.push([7,9,,10]),E=i?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(E,y)];case 8:return b=C.sent(),eK.print("join","send join message success"),this._authorization=y.Authorization,this.connectionState=Zz.CONNECTED,fz.audioStallConfig=null===(u=b.config)||void 0===u?void 0:u.engine_WEB,this._pubConfig.audioRed=!!(null===(l=null===(d=b.config)||void 0===d?void 0:d.engine_WEB)||void 0===l?void 0:l.pub_audio_red),this._subConfig.muteReplaceUnsub=!!(null===(h=b.config)||void 0===h?void 0:h.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!(!1===(null===(_=null===(f=null===(p=b.config)||void 0===p?void 0:p.engine_VPM)||void 0===f?void 0:f.ondemand)||void 0===_?void 0:_.enable)),null===(v=this._context)||void 0===v||v.audioProfileManager.updateEngineBAC(null===(m=b.config)||void 0===m?void 0:m.engine_BAC),[2,b];case 9:if(I=C.sent(),this.connectionState=Zz.DISCONNECTED,(null==I?void 0:I.code)>=700&&(null==I?void 0:I.code)<800)throw new JB(qB.INVALID_TOKEN,(null==I?void 0:I.message)||"Invalid token");if(200!==(null==I?void 0:I.code))throw new JB(qB.JOIN_ROOM_FAILED,(null==I?void 0:I.message)||"Join room failed");return[3,10];case 10:return[2]}}))}))},t.prototype.publish=function(e){var t,i,r,n,o,a,s,c;return tv(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,y,g=this;return iv(this,(function(S){switch(S.label){case 0:eK.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=zL(),h="",p="",S.label=1;case 1:return S.trys.push([1,6,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(f=S.sent()))throw new JB(qB.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return h=f.audioMid,p=f.videoMid,e.pubAttributes={localaudio:!!d,localvideo:!!u,videostream:e.pubVideo,audiostream:e.pubAudio,extvideo:!!(u instanceof GH),extaudio:!!(d instanceof HH)},_={attributes:$_({videoDescriptions:f.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:h,videoMid:p,sdpInfo:{msid:e.stream.id,type:f.type,sdp:f.partialSdp,semantics:f.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(null===(i=f.subVideoDescriptions)||void 0===i?void 0:i.length)&&(_.attributes.subVideoDescriptions=f.subVideoDescriptions),[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("publish",_)];case 3:if(200!==(null==(v=S.sent())?void 0:v.code))throw new JB(qB.PUBLISH_FAILED,(null==v?void 0:v.message)||"publish failed");return $F.rtcRecvAnswer(0,mF.INCRANSWER,(null===(n=null==v?void 0:v.relayMessage)||void 0===n?void 0:n.sequenceId)||0,null===(o=null==v?void 0:v.relayMessage)||void 0===o?void 0:o.sdp,yF.UP,"",""),m=new Promise((function(t,i){var r,n,o,a,s;null===(r=g._handler)||void 0===r||r.handleAck({action:Ez.publish,streamId:v.streamId,audioMid:h,videoMid:p,transceiverInit:f.transceiverInit,signalingAck:{audioMid:null===(n=null==v?void 0:v.relayMessage)||void 0===n?void 0:n.audioMid,videoMid:null===(o=null==v?void 0:v.relayMessage)||void 0===o?void 0:o.videoMid,sdp:null===(a=null==v?void 0:v.relayMessage)||void 0===a?void 0:a.sdp,sequenceId:null===(s=null==v?void 0:v.relayMessage)||void 0===s?void 0:s.sequenceId},stream:e,onSuccess:function(){eK.print("publish()","publish success"),t(0)}})})),"chrome"!==(null===(a=this.handler)||void 0===a?void 0:a.name)?[3,5]:[4,m];case 4:S.sent(),S.label=5;case 5:return rU||null===(s=this._handler)||void 0===s||s.updateDegradationPreference(e),e.streamId=v.streamId,e.videoMid=p,e.audioMid=h,e.subVideoDescriptions=f.subVideoDescriptions,this.monitor.rtcPublishStat(gF.SUCCESS,SF.W_0,l,EF.UNKNOWN),e.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 6:return(y=S.sent())instanceof Error&&this.monitor.rtcPublishStat(gF.FAIL,SF.W_0,l,y.message),[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(e.stream.id,e)];case 7:throw S.sent(),y;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,i,r,n,o,a,s,c,u;return tv(this,void 0,void 0,(function(){var d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,P,N,D,M,L,U;return iv(this,(function(x){switch(x.label){case 0:return eK.print("updatePubTrack()","localStream: %o",e),d=e.videoTrack,l=e.audioTrack,h=e.pubAudio,p=e.pubVideo,f=null==l?void 0:l.getTrack(),_=null==d?void 0:d.getTrack(),p&&_?null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack(_):null===(i=e.videoTransceiver)||void 0===i||i.sender.replaceTrack(null),rU?[3,2]:[4,null===(r=this._handler)||void 0===r?void 0:r.updateDegradationPreference(e)];case 1:x.sent(),x.label=2;case 2:null===(n=this._handler)||void 0===n||n.updateMaxBitrate(e),h&&f?(m=(v=l).mixType,(y=v.mixedAudioTrack)&&m!==cG.PLAYOUT&&!0===f.enabled&&(f=y),null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(f)):(null===(a=e.audioTransceiver)||void 0===a||a.sender.replaceTrack(null),this.monitor.rtcInvokeStatus("null",0,"MediaClient.updatePubTrack(audio)","",0));try{this.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:vU(f),videoStreamTrack:vU(_)}),0,"MediaClient.updatePubTrack","",0)}catch(e){}g={localaudio:!!l,localvideo:!!d,videostream:p,audiostream:h,extvideo:!!(d instanceof GH),extaudio:!!(l instanceof HH)},S={};try{for(E=rv(Object.entries(g)),b=E.next();!b.done;b=E.next())I=nv(b.value,2),T=I[0],(A=I[1])!==Reflect.get(e.pubAttributes,T)&&Reflect.set(S,T,A)}catch(e){L={error:e}}finally{try{b&&!b.done&&(U=E.return)&&U.call(E)}finally{if(L)throw L.error}}return Object.keys(S).length?(e.observer&&(R=e.observer,C=S.audiostream,O=S.videostream,w=S.localaudio,P=S.extaudio,N=S.extvideo,void 0!==(k=S.localvideo)?void 0!==N?R.setPushVideo(N):R.setEnableVideo(k):void 0!==O&&R.setUnmuteVideo(O),void 0!==w?void 0!==P?R.setPushAudio(P):R.setEnableAudio(w):void 0!==C&&R.setUnmuteAudio(C)),e.pubAttributes=g,D={roomId:this._roomId,streamId:e.streamId,attributes:S},[4,null===(s=this._dataChannelSignal)||void 0===s?void 0:s.sendSignaling("updateStreamAttributes",D)]):[2];case 3:if(200!==(null==(M=x.sent())?void 0:M.code))throw new JB(qB.UPDATE_TRACK_FAILED,(null==M?void 0:M.message)||"update track failed");return"chrome"===(null===(c=this._handler)||void 0===c?void 0:c.name)?[3,5]:[4,null===(u=this._handler)||void 0===u?void 0:u.setCurrentDescription()];case 4:x.sent(),x.label=5;case 5:return[2]}}))}))},t.prototype.updateToken=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n,o;return iv(this,(function(a){switch(a.label){case 0:if(eK.print("updateToken()","newToken: %o",e),this._token=e,!this._appId||!(null===(t=this._userInfo)||void 0===t?void 0:t.userId)||!this._roomId)return[2];n={roomId:this._roomId,userId:null===(i=this._userInfo)||void 0===i?void 0:i.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateToken",n)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new JB(qB.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new JB(qB.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n;return iv(this,(function(o){switch(o.label){case 0:return eK.print("unpublish()","localStream: %o",e),n={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},null===(t=this._dataChannelSignal)||void 0===t||t.sendSignaling("unpublish",n),[4,null===(i=this._handler)||void 0===i?void 0:i.handleAck({action:Ez.unpublish,audioMid:e.audioMid,videoMid:e.videoMid,stream:e,streamId:e.streamId})];case 1:return o.sent(),e.statsReport.unpublish(),[4,null===(r=this._handler)||void 0===r?void 0:r.rollback(e.stream.id,e)];case 2:return o.sent(),[2]}}))}))},t.prototype.subscribe=function(e,t,i){return tv(this,void 0,void 0,(function(){var r=this;return iv(this,(function(n){return[2,new Promise((function(n,o){return tv(r,void 0,void 0,(function(){var r,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,P,N,D,M,L,U,x,V=this;return iv(this,(function(F){switch(F.label){case 0:if(e.streamState===_z.SUB_ED)return[2,this._updateSubTrack(e,t,lz.SUB).then(n,o)];if(e.streamState===_z.SUB_ING)return this._subStreamQueue[e.streamId]||(this._subStreamQueue[e.streamId]=[]),eK.print("_subStreamQueue","streamId: %o, enqueue",e.streamId),this._subStreamQueue[e.streamId].push({fn:this.subscribe,args:[e,t,i],resolve:n,reject:o}),[2];if(eK.print("subscribe()","mediaType: %o",t),iK("subscribe()",e),e.streamState=_z.SUB_ING,r=!1,a=!1,pU(t)&&(a=!0),fU(t)&&(r=!0),!r&&this._multiChatMode())return e.streamState=_z.INIT,this.emit("SUB_END",e.streamId),[2,n(null)];s=zL(),c=e.audioMid,u=e.videoMid,l=e.paused,h=e.subVideo,F.label=1;case 1:return F.trys.push([1,9,,11]),c&&u?[4,null===(R=this._handler)||void 0===R?void 0:R.subscribe(e,{audioMid:c,videoMid:u})]:[3,3];case 2:return d=F.sent(),[3,5];case 3:return[4,null===(C=this._handler)||void 0===C?void 0:C.subscribe(e)];case 4:if(!(d=F.sent()))throw new JB(qB.ADD_TRANSCEIVER_FAILED,"add transceiver failed");c=d.audioMid,u=d.videoMid,F.label=5;case 5:return e.paused=!r,e.subVideo=r,p={spatialLayer:(null==i?void 0:i.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==i?void 0:i.spatialSubLayer)||-1},f={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:u,audioMid:c,sdpInfo:{sdp:null==d?void 0:d.partialSdp,semantics:null==d?void 0:d.semantics,type:null==d?void 0:d.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||a,video:r},qualityLayer:p}},[4,null===(O=this._dataChannelSignal)||void 0===O?void 0:O.sendSignaling("subscribe",f)];case 6:if(200!==(null==(_=F.sent())?void 0:_.code))throw new JB(qB.SUBSCRIBE_FAILED,(null==_?void 0:_.message)||"subscribe failed");return v=[],m=!this._multiChatMode(),y=!e.videoTrack,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),y&&v.push(new Promise((function(t,i){V._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new JB(qB.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),6e4);e.on("ontrack",(function i(n){"video"===n.mediaType&&(eK.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),m&&v.push(new Promise((function(t,i){V._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new JB(qB.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),6e4);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(eK.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),g=function(t){e.ontrack(t)},null===(w=this._handler)||void 0===w||w.on("ontrack",g),this._ontrackCallbackMap.set(e,g),S=null==_?void 0:_.relayMessage,E=S.audioMid,b=S.videoMid,(A={})[c]=E,A[u]=b,I=A,eK.print("sub midmap",e.userId,I),e.videoMid=b,e.audioMid=E,e._workaround_1_=!1,e.subMediaType=t,e.streamState=_z.SUB_ED,e.subLayer=p,$F.rtcRecvAnswer(0,mF.INCRANSWER,(null===(k=null==_?void 0:_.relayMessage)||void 0===k?void 0:k.sequenceId)||0,null===(P=null==_?void 0:_.relayMessage)||void 0===P?void 0:P.sdp,yF.DOWN,e.streamId,e.userId),[4,null===(N=this._handler)||void 0===N?void 0:N.handleAck({action:Ez.subscribe,streamId:e.streamId,audioMid:c,videoMid:u,transceiverInit:null==d?void 0:d.transceiverInit,signalingAck:{audioMid:null===(D=null==_?void 0:_.relayMessage)||void 0===D?void 0:D.audioMid,videoMid:null===(M=null==_?void 0:_.relayMessage)||void 0===M?void 0:M.videoMid,sdp:null===(L=null==_?void 0:_.relayMessage)||void 0===L?void 0:L.sdp,sequenceId:null===(U=null==_?void 0:_.relayMessage)||void 0===U?void 0:U.sequenceId},stream:e})];case 7:return F.sent(),[4,Promise.all(v)];case 8:return F.sent(),this._multiChatMode()||(e.subAudio=a),this.monitor.rtcSubscribeStat(bF.SUCCESS,s,IF.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),n(null),this.emit("SUB_END",e.streamId),[3,11];case 9:return(T=F.sent())instanceof Error&&this.monitor.rtcSubscribeStat(bF.FAIL,s,T.message,e.userId),e.paused=l,e.subVideo=h,e.streamState=_z.INIT,[4,null===(x=this._handler)||void 0===x?void 0:x.rollback(e.streamId,e)];case 10:return F.sent(),o(T),this.emit("SUB_END",e.streamId),[3,11];case 11:return[2]}}))}))}))]}))}))},t.prototype._handleSubStreamQueue=function(e){var t,i=this;if(null===(t=this._subStreamQueue[e])||void 0===t?void 0:t.length){eK.print("_subStreamQueue","streamId: %o, exec",e);var r=this._subStreamQueue[e].shift(),n=r.fn,o=r.args,a=r.resolve,s=r.reject;n.apply(this,o).then(a,s).finally((function(){return i._handleSubStreamQueue(e)}))}else eK.print("_subStreamQueue","streamId: %o, END",e)},t.prototype.controlMessage=function(e){var t;return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:return eK.print("controlMessage()","params: %o",e),i=e,"transcode"===e.type&&(i.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",i)];case 1:return r.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return tv(this,void 0,void 0,(function(){return iv(this,(function(i){switch(i.label){case 0:return eK.print("updateUserAttributes()","attributes: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:e})];case 1:return i.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){return tv(this,void 0,void 0,(function(){return iv(this,(function(r){return[2,this._updateSubTrack(e,t,i)]}))}))},t.prototype.updateSubTrackLayer=function(e,t){var i;return tv(this,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:return eK.print("updateSubTrack()","subLayer: %o",t),r=t||e.subLayer,n={roomId:this._roomId,streamList:[e.streamId],config:{qualityLayer:r}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",n)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new JB(qB.UPDATE_TRACK_FAILED,(null==o?void 0:o.message)||"update track failed");return e.subLayer=r,[2,e]}}))}))},t.prototype._updateSubTrack=function(e,t,i){var r,n,o;return tv(this,void 0,void 0,(function(){var a,s,c,u,d;return iv(this,(function(l){switch(l.label){case 0:return eK.print("updateSubTrack()","mediaType: %o",t),iK("updateSubTrack()",e),a=0,a=i===lz.SUB?e.subMediaType|t:e.subMediaType-(e.subMediaType&t),eK.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",e.subMediaType,i,t,a),e.subMediaType===a&&eK.print("updateSubTrack","mediaType no change"),s=!1,c=!1,pU(a)&&(c=!0),fU(a)&&(s=!0),u={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:s,audio:!!this._multiChatMode()||c}}},[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateSubscribe",u)];case 1:if(200!==(null==(d=l.sent())?void 0:d.code))throw new JB(qB.UPDATE_TRACK_FAILED,(null==d?void 0:d.message)||"update track failed");return e.paused=!s,this._multiChatMode()||(null===(n=e.observer)||void 0===n||n.setUnmuteAudio(c),e.subAudio=c),null===(o=e.observer)||void 0===o||o.setUnmuteVideo(s),e.subVideo=s,e.subMediaType=a,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var i,r,n,o,a;return tv(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f,_,v,m,y=this;return iv(this,(function(g){switch(g.label){case 0:if(eK.print("subscribe4pushTrack()","streamInfo: %o",t),iK("subscribe4pushTrack()",e),s=null==t?void 0:t.message,c=s.audioMid,u=s.videoMid,d=s.sequenceId,e.subAudio=!0,d<e.sequenceId)return eK.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];l=e.audioMid,h=e.videoMid,null===(i=e.observer)||void 0===i||i.setPushTrack(!0),g.label=1;case 1:return g.trys.push([1,8,,9]),l&&h?[4,null===(r=this._handler)||void 0===r?void 0:r.subscribe(e,{audioMid:l,videoMid:h})]:[3,3];case 2:return p=g.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(p=g.sent()))throw new JB(qB.ADD_TRANSCEIVER_FAILED,"add transceiver failed");l=p.audioMid,h=p.videoMid,g.label=5;case 5:return(m={})[l]=c,m[h]=u,f=m,eK.print("onpushtrack midmap",e.userId,f),e.audioMid=c,e.videoMid=u,e.sequenceId=d,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),_=[],e.audioTrack||_.push(new Promise((function(t,i){y._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new JB(qB.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),6e4);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(eK.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),v=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",v),this._ontrackCallbackMap.set(e,v),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:Ez.pushtrack,streamId:e.streamId,audioMid:l,videoMid:h,stream:e,transceiverInit:null==p?void 0:p.transceiverInit,signalingAck:null==t?void 0:t.message})];case 6:return g.sent(),[4,Promise.all(_)];case 7:return g.sent(),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 8:throw g.sent();case 9:return[2]}}))}))},t.prototype.subscribe4pushTrackV2=function(e,t){var i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d=this;return iv(this,(function(l){switch(l.label){case 0:return eK.print("subscribe4pushTrackV2()","streamInfo: %o",t),iK("subscribe4pushTrackV2()",e),[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e)];case 1:return(o=l.sent())?(a=o.audioMid,s=o.videoMid,e.subAudio=!0,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),c=[],e.audioTrack||c.push(new Promise((function(t,i){d._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new JB(qB.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),6e4);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(eK.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),u=function(t){e.ontrack(t)},null===(r=this._handler)||void 0===r||r.on("ontrack",u),this._ontrackCallbackMap.set(e,u),e.audioMid=a,e.videoMid=s,[4,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:Ez.pushtrack,streamId:e.streamId,audioMid:a,videoMid:s,stream:e,transceiverInit:null==o?void 0:o.transceiverInit,signalingAck:null==t?void 0:t.message})]):[2];case 2:return l.sent(),[4,Promise.all(c)];case 3:return l.sent(),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var i,r,n;return tv(this,void 0,void 0,(function(){return iv(this,(function(o){switch(o.label){case 0:return iK("unsubscribe4removeTrack()",e),eK.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(eK.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(i=e.observer)||void 0===i||i.setPushTrack(!1),[4,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:Ez.removetrack,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})]));case 1:return o.sent(),[4,null===(n=this._handler)||void 0===n?void 0:n.rollback(e.streamId,e)];case 2:return o.sent(),this._subResolves[e.streamId]&&this._subResolves[e.streamId].forEach((function(e){return e(0)})),eK.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.unsubscribe=function(e,t,i){var r,n,o,a,s;return void 0===i&&(i=!1),tv(this,void 0,void 0,(function(){var c,u,d;return iv(this,(function(l){switch(l.label){case 0:return iK("unsubscribe()",e),c=e.subMediaType-(e.subMediaType&t),i||!this._subConfig.muteReplaceUnsub&&c===YH.NONE?(u={roomId:this._roomId,streamId:e.streamId,userId:e.userId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unsubscribe",u).catch((function(){})),e.streamState=_z.INIT,this._subStreamQueue[e.streamId]&&(this._subStreamQueue[e.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[e.streamId]),e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(n=e.observer)||void 0===n||n.setSubscribeVideo(!1),e.subAudio?[3,3]:(null===(o=e.observer)||void 0===o||o.setSubscribeAudio(!1),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:Ez.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})])):[2,this._updateSubTrack(e,t,lz.UNSUB)];case 1:return d=l.sent(),[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(e.streamId,e)];case 2:l.sent(),this._subResolves[d]&&this._subResolves[d].forEach((function(e){return e(0)})),eK.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),l.label=3;case 3:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,i=this._ontrackCallbackMap.get(e);i&&(null===(t=this._handler)||void 0===t||t.off("ontrack",i),this._ontrackCallbackMap.delete(e))},t.prototype.handleRemoveStream=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return iK("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==Rj.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this._multiChatMode()&&e._workaround_1_?(this.unsubscribe(e,JM.AUDIO_AND_VIDEO,!0),[2]):[2]}))}))},t.prototype.leave=function(){var e;return tv(this,void 0,void 0,(function(){var t,i,r;return iv(this,(function(n){switch(n.label){case 0:return eK.print("leave()"),this.connectionState!==Zz.CONNECTED?[3,7]:(this.connectionState=Zz.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:i=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:return n.sent(),this.connectionState=Zz.DISCONNECTED,[3,6];case 4:throw r=n.sent(),this.connectionState=Zz.CONNECTED,r;case 5:return i(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new JB(qB.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S=this;return iv(this,(function(E){switch(E.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(o=E.sent()))throw new JB(qB.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return a=zL(),s=o.audioMid,c=o.videoMid,y={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:s,videoMid:c,sdpInfo:{sdp:null==o?void 0:o.partialSdp,semantics:null==o?void 0:o.semantics,type:null==o?void 0:o.type}},g={},[4,hG()];case 2:return y.params=(g.supportedCodecs=E.sent(),g.deviceType="web",g.userAgent=window.navigator.userAgent,g.sdkVersion=jV.VERSION,g.deviceId=xV.getDeviceId(),g.appId=this._appId,g.businessId=this._businessId,g.enableCloudProxy=this._useCloudProxy,g),y.config={enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},u=y,[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("startPullStream",u)];case 3:return d=E.sent(),l=[],this._subResolves[e.streamId]=[],l.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new JB(qB.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),6e4);e.on("ontrack",(function i(n){"video"===n.mediaType&&(eK.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),l.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new JB(qB.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),6e4);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(eK.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),h=function(t){e.ontrack(t)},null===(r=this._handler)||void 0===r||r.on("ontrack",h),this._ontrackCallbackMap.set(e,h),p=null==d?void 0:d.relayMessage,f=p.audioMid,_=p.videoMid,v=p.sequenceId,m=p.sdp,e.videoMid=_,e.audioMid=f,e.sequenceId=v,e._workaround_1_=!1,e.paused=!1,e.streamState=_z.SUB_ED,e.subAudio=!0,e.subVideo=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:Ez.subscribe,streamId:e.streamId,audioMid:s,videoMid:c,transceiverInit:null==o?void 0:o.transceiverInit,signalingAck:{audioMid:f,videoMid:_,sdp:m,sequenceId:v},stream:e})];case 4:return E.sent(),[4,Promise.all(l)];case 5:return E.sent(),this.monitor.rtcSubscribeStat(bF.SUCCESS,a,IF.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n;return iv(this,(function(o){switch(o.label){case 0:iK("unsubscribePublicStream()",e),n={appId:this._appId,streamId:e.streamId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("stopPullStream",n)];case 2:case 3:return o.sent(),[3,4];case 4:return e.streamState=_z.INIT,e.subVideo=!1,e.subAudio=!1,[4,null===(i=this._handler)||void 0===i?void 0:i.handleAck({action:Ez.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})];case 5:return o.sent(),[4,null===(r=this._handler)||void 0===r?void 0:r.rollback(e.streamId,e)];case 6:return o.sent(),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.destroy=function(){var e,t,i;eK.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(i=this._iceConfigRequestManager)||void 0===i||i.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState=Zz.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})},t.prototype.sendRoomMessage=function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)},t.prototype._multiChatMode=function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode},Object.defineProperty(t.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomAttributes",{get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),ev([aK],t.prototype,"join",null),ev([oK,nK],t.prototype,"publish",null),ev([oK,nK],t.prototype,"updatePubTrack",null),ev([oK,nK],t.prototype,"unpublish",null),ev([oK,nK],t.prototype,"subscribe",null),ev([nK],t.prototype,"controlMessage",null),ev([nK],t.prototype,"updateUserAttributes",null),ev([nK],t.prototype,"updateSubTrack",null),ev([nK],t.prototype,"updateSubTrackLayer",null),ev([nK],t.prototype,"subscribe4pushTrack",null),ev([nK,oK],t.prototype,"subscribe4pushTrackV2",null),ev([nK],t.prototype,"unsubscribe4removeTrack",null),ev([oK,nK],t.prototype,"unsubscribe",null),ev([nK],t.prototype,"handleRemoveStream",null),ev([oK],t.prototype,"subscribePublicStream",null),ev([oK],t.prototype,"unsubscribePublicStream",null),t}(JF);function nK(e,t,i){var r=i.value;return i.value=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return tv(this,void 0,void 0,(function(){return iv(this,(function(i){switch(i.label){case 0:return this._handler&&this._state===Zz.CONNECTED?[4,r.apply(this,e)]:[3,2];case 1:return i.sent(),[3,3];case 2:throw new JB(qB.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},i}function oK(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=i.sent(),this.supportConcurrent&&t(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,r.apply(this,e)];case 3:return[2,i.sent()];case 4:return this.supportConcurrent||t(),[7];case 5:return[2]}}))}))},i}function aK(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(n){return t=!1,[2,new Promise((function(n,o){return tv(i,void 0,void 0,(function(){var i,a;return iv(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new JB(qB.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.apply(this,e)];case 2:return i=s.sent(),n(i),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},i}!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(tK||(tK={}));var sK,cK=function(){function e(e,t){this._audioEventSessionId=sU(),this._videoEventSessionId=sU(),this._isScreen=!1,this._audioFirstFrameState=tK.INITIAL,this._videoFirstFrameState=tK.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:CF.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:CF.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._publishVideo=!1,this._publishAudio=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._stream=e,this._handler=t,this.getTransportDelay()}return e.prototype.beginRecvFrame=function(e,t){var i,r,n,o,a;return tv(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f=this;return iv(this,(function(_){switch(_.label){case 0:return[4,this.getTransportDelay()];case 1:return _.sent(),s=this._transportDelay,c=!0,u=CF.LOGIN,d=CF.UNMUTE,l=CF.SUBSCRIBE,h=CF.PUSH_TRACK,[u,d,l,h].indexOf(t)>=0&&(s=0,c=!1),e===RF.AUDIO?(c||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},p={media_type:e,event_type:AF.BEGIN_RECV,type:t,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){f.stopRecvFrame(RF.AUDIO,OF.TIMEOUT),f._firstAudioFrameInterval&&window.clearInterval(f._firstAudioFrameInterval)}),this._timeout),$F.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=tK.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===RF.VIDEO&&(c||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t},p={media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?RF.SCREEN_VIDEO:e,event_type:AF.BEGIN_RECV,type:t,start:null===(o=this._currentVideoRecv)||void 0===o?void 0:o.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(a=this._stream)||void 0===a?void 0:a.userId,transport_delay:s},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){f.stopRecvFrame(RF.VIDEO,OF.TIMEOUT),f._firstVideoFrameInterval&&window.clearInterval(f._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),$F.rtcFirstFrame(p),this._videoFirstFrameState=tK.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var i,r,n,o,a,s,c;if(e===RF.AUDIO){if(this._audioFirstFrameState!==tK.BEGIN)return;var u={event_type:AF.RECV_END,media_type:e,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,reason:t,result:!1,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,$F.rtcFirstFrame(u),this._audioFirstFrameState=tK.STOPPED}else if(e===RF.VIDEO){if(this._videoFirstFrameState!==tK.BEGIN)return;u={event_type:AF.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?RF.SCREEN_VIDEO:e,start:null===(a=this._currentVideoRecv)||void 0===a?void 0:a.startTime,reason:t,result:!1,stream_user_id:null===(s=this._stream)||void 0===s?void 0:s.userId,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,$F.rtcFirstFrame(u),this._videoFirstFrameState=tK.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p;return iv(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:if(f.sent(),n=this._transportDelay,o=CF.LOGIN,a=CF.UNMUTE,s=CF.SUBSCRIBE,c=CF.PUSH_TRACK,e===RF.AUDIO){if(this._audioFirstFrameState!==tK.BEGIN)return[2];if(!this._currentAudioRecv)return[2];u=this._currentAudioRecv,l=u.type,h=u.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:AF.RECV_END,media_type:e,start:h,result:!0,stream_user_id:null===(t=this._stream)||void 0===t?void 0:t.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:n},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),$F.rtcFirstFrame(p),this._audioFirstFrameState=tK.RECEIVED}else if(e===RF.VIDEO){if(this._videoFirstFrameState!==tK.BEGIN)return[2];if(!this._currentVideoRecv)return[2];d=this._currentVideoRecv,l=d.type,h=d.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:AF.RECV_END,media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?RF.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:n},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),$F.rtcFirstFrame(p),this._videoFirstFrameState=tK.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var i,r,n,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&t.audio&&this.beginRecvFrame(RF.AUDIO,CF.LOGIN),e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&t.video&&this.beginRecvFrame(RF.VIDEO,CF.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(RF.VIDEO,OF.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(RF.AUDIO,CF.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(RF.AUDIO,CF.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(RF.AUDIO,CF.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(RF.VIDEO,CF.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(RF.VIDEO,OF.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(RF.VIDEO,CF.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.VIDEO,OF.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(RF.VIDEO,CF.ENABLE):this.stopRecvFrame(RF.VIDEO,OF.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal=e},e.prototype.setPushAudio=function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(RF.AUDIO,CF.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(RF.AUDIO,CF.PUSH)},e.prototype.setExternalVideoSource=function(e){this._videoExternal=e},e.prototype.setPushVideo=function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(RF.VIDEO,CF.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(RF.VIDEO,CF.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(RF.VIDEO,CF.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(RF.VIDEO,OF.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(RF.AUDIO,CF.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.UNPUBLISH)},e.prototype.setAutoSubscribe=function(e){this._autoSubscribe=e},e.prototype.setAutoSubscribeVideo=function(e){this._autoSubscribeVideo=e},e.prototype.setAutoSubscribeAudio=function(e){this._autoSubscribeAudio=e},e.prototype.setSubscribeAudio=function(e){var t,i;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(RF.AUDIO,CF.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.UNSUBSCRIBE)},e.prototype.setSubscribeVideo=function(e){var t,i;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(RF.VIDEO,CF.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&this.stopRecvFrame(RF.VIDEO,OF.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(RF.AUDIO,CF.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(RF.AUDIO,OF.REMOVE_TRACK))},e.prototype.setMultiChatMode=function(e){this._multiChatMode=e},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype._watchForFirstVideoFrameRecv=function(){var e=this,t=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval((function(){return tv(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return iv(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())?[4,aG(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.videoTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.framesReceived>t){if(-1===t)return t=i.framesReceived,[2];this.recvFrameFinish(RF.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype._watchForFirstAudioFrameRecv=function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval((function(){return tv(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return iv(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())?[4,aG(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.audioTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.totalSamplesReceived>t){if(-1===t)return t=i.totalSamplesReceived,[2];this.recvFrameFinish(RF.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return tv(this,void 0,void 0,(function(){var e=this;return iv(this,(function(t){switch(t.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return t.sent(),window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval((function(){return tv(e,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return e.sent(),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.getTransportDelayIntl=function(){var e,t;return tv(this,void 0,void 0,(function(){var i,r,n;return iv(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,aG(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:i=o.sent(),r=i.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(n=i.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==r?void 0:r.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*n.currentRoundTripTime/2)),o.label=2;case 2:return[2]}}))}))},e.prototype.reset=function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:CF.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:CF.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)},e}();!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.SENT=3]="SENT"}(sK||(sK={}));var uK,dK,lK,hK,pK=function(){function e(e,t){this._audioEventSessionId=sU(),this._videoEventSessionId=sU(),this._currentAudioSend={startTime:0,eventSessionId:0,type:CF.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:CF.LOGIN},this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._timeout=1e4,this._audioFirstFrameState=sK.INITIAL,this._videoFirstFrameState=sK.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var i,r,n,o=this;if(e===RF.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:AF.BEGIN_SEND,type:t,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){o.stopSendFrame(RF.AUDIO,OF.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),$F.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=sK.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===RF.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?RF.SCREEN_VIDEO:e,event_type:AF.BEGIN_SEND,type:t,start:null===(n=this._currentVideoSend)||void 0===n?void 0:n.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){o.stopSendFrame(RF.VIDEO,OF.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),$F.rtcFirstFrame(a),this._videoFirstFrameState=sK.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}},e.prototype.stopSendFrame=function(e,t){var i,r,n,o,a;if(e===RF.AUDIO){if(this._audioFirstFrameState!==sK.BEGIN)return;var s={event_type:AF.SENT_END,media_type:e,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(r=this._currentAudioSend)||void 0===r?void 0:r.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,$F.rtcFirstFrame(s),this._audioFirstFrameState=sK.STOPPED}else if(e===RF.VIDEO){if(this._videoFirstFrameState!==sK.BEGIN)return;s={event_type:AF.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?RF.SCREEN_VIDEO:e,start:null===(o=this._currentVideoSend)||void 0===o?void 0:o.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(a=this._currentVideoSend)||void 0===a?void 0:a.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,$F.rtcFirstFrame(s),this._videoFirstFrameState=sK.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===RF.AUDIO){if(this._audioFirstFrameState!==sK.BEGIN)return;if(!this._currentAudioSend)return;var i=this._currentAudioSend,r=i.type,n=i.startTime,o={event_type:AF.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:r};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),$F.rtcFirstFrame(o),this._audioFirstFrameState=sK.SENT}else if(e===RF.VIDEO){if(this._videoFirstFrameState!==sK.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;r=a.type,n=a.startTime,o={event_type:AF.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?RF.SCREEN_VIDEO:e,start:n,result:!0,event_session_id:this._videoEventSessionId,type:r};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),$F.rtcFirstFrame(o),this._videoFirstFrameState=sK.SENT}},e.prototype.setLogin=function(e){var t,i;this._login!==e&&(this._login=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(RF.VIDEO,CF.LOGIN),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(RF.AUDIO,CF.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.LEAVE_ROOM))},e.prototype.setPublish=function(e){var t,i;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(RF.VIDEO,CF.PUBLISH),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(RF.AUDIO,CF.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(RF.AUDIO,CF.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(RF.AUDIO,CF.ENABLE),!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(RF.VIDEO,CF.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(RF.VIDEO,CF.ENABLE),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(RF.AUDIO,CF.PUSH),!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(RF.VIDEO,CF.PUSH),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.STOP_PUSH))},e.prototype.setAutoPublish=function(e){this._autoPublish=e},e.prototype.setPublisher=function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(RF.AUDIO,OF.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(RF.VIDEO,OF.AUDIENCE))},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype.setPCSessionId=function(e){this._pcSessionId=e},e.prototype.setHandler=function(e){this._handler=e},e.prototype._getFirstVideoFrameStats=function(){var e,t,i,r,n,o;return tv(this,void 0,void 0,(function(){var a;return iv(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(i=null===(t=this._stream)||void 0===t?void 0:t.videoTrack)||void 0===i?void 0:i.getTrack())?[4,aG(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._getFirstAudioFrameStats=function(){var e,t,i,r,n,o;return tv(this,void 0,void 0,(function(){var a;return iv(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(i=null===(t=this._stream)||void 0===t?void 0:t.audioTrack)||void 0===i?void 0:i.getTrack())?[4,aG(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._watchForFirstVideoFrameSend=function(){var e=this,t=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval((function(){return tv(e,void 0,void 0,(function(){var e;return iv(this,(function(i){switch(i.label){case 0:return[4,this._getFirstVideoFrameStats()];case 1:if((e=i.sent())&&e.framesSent>t){if(-1===t)return t=e.framesSent,[2];this.sendFrameFinish(RF.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval((function(){return tv(e,void 0,void 0,(function(){var e;return iv(this,(function(i){switch(i.label){case 0:return[4,this._getFirstAudioFrameStats()];case 1:if((e=i.sent())&&e.packetsSent>t){if(-1===t)return t=e.packetsSent,[2];this.sendFrameFinish(RF.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}return[2]}}))}))}),100)},e.prototype.reset=function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=sK.INITIAL,this._videoFirstFrameState=sK.INITIAL,this._currentAudioSend={startTime:0,eventSessionId:0,type:CF.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:CF.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)},e.prototype.destroy=function(){this.reset(),delete this._stream,delete this._handler},Object.defineProperty(e.prototype,"_audioSending",{get:function(){return this._audioFirstFrameState===sK.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===sK.BEGIN},enumerable:!1,configurable:!0}),e}();!function(e){e[e.UNKOWN=0]="UNKOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(dK||(dK={})),function(e){e[e.INVALID=0]="INVALID",e[e.GOOD=1]="GOOD",e[e.MEDIUM=2]="MEDIUM",e[e.POOR=3]="POOR"}(lK||(lK={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(hK||(hK={}));var fK=((uK={})[hK.AUDIO]={delay:1200,stallRadio:.3},uK[hK.VIDEO]={delay:1200,stallRadio:.6},uK[hK.SCREEN_AUDIO]={delay:1600,stallRadio:.8},uK[hK.SCREEN_VIDEO]={delay:1600,stallRadio:.8},uK),_K=function(){function e(){this._preUplinkStats=new Map,this._preDownlinkStats=new Map,this._connectionState=Zz.CONNECTED}return e.prototype.updateUplinkStats=function(e){var t=e.audioStats,i=e.videoStats,r=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var n=r?hK.SCREEN_AUDIO:hK.AUDIO,o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,ov(ov([],nv(u),!1),[c],!1).slice(-2))}if(i.sentKBitrate>0&&i.rtt){n=r?hK.SCREEN_VIDEO:hK.VIDEO,o=i.rtt,a=i._fractionLost;i.videoLossRate;var d=i._sendBandWidth;s=i._retransmittedRate;0===d&&(a=Math.max(.65,a));c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,ov(ov([],nv(u),!1),[c],!1).slice(-2))}this._startNetworkQualityReport()},e.prototype.updateDownlinkStats=function(e,t){if(t){var i,r,n=this._getStreamActiveState(t),o=n.audioActive,a=n.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId,l=!0,h=!0;if(o&&s.rtt)if(0===s.receivedKBitrate)l=!1;else{var p=s.rtt,f=s.audioLossRate,_=s.stallDuration,v=s.statsInterval,m=s.e2eDelay,y=_/v,g=u?hK.SCREEN_AUDIO:hK.AUDIO,S=this._getQosLevel(p,f||0,c._retransmittedRate||0),E=this._getDownlinkQoE(g,y,m);i=this._getNetworkQuality(S,E)}if(a)if(0===c.receivedKBitrate||0===c.rtt)h=!1;else{p=c.rtt;var b=c.videoLossRate,I=(_=c.stallDuration,v=c.statsInterval,m=c.e2eDelay,c._retransmittedRate);y=_/v,g=u?hK.SCREEN_VIDEO:hK.VIDEO,S=this._getQosLevel(p,b||0,I||0),E=this._getDownlinkQoE(g,y,m);r=this._getNetworkQuality(S,E)}var T="".concat(d).concat(u?"_screen":"");if(l||h){var A=i&&r?Math.ceil((i+r)/2):i||r;if(A){var R=this._preDownlinkStats.get(T)||[A];this._preDownlinkStats.set(T,ov(ov([],nv(R),!1),[A],!1).slice(-2)),this._startNetworkQualityReport()}}else this._preDownlinkStats.delete(T)}},e.prototype.setConnectionState=function(e){this._connectionState=e},e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()},e.prototype._startNetworkQualityReport=function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))},e.prototype._reportNetworkQuality=function(){var e,t,i=this;if(this._connectionState!==Zz.CONNECTED)e=t=aL.VBAD;else{var r=this._getBetterQualityAndRemoveOldest(hK.AUDIO,"up"),n=this._getBetterQualityAndRemoveOldest(hK.VIDEO,"up");e=r&&n?Math.ceil((r+n)/2):r||n||this._getBetterQualityAndRemoveOldest(hK.SCREEN_VIDEO,"up")||this._getBetterQualityAndRemoveOldest(hK.SCREEN_AUDIO,"up")||aL.EXCELLENT;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return i._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||aL.UNKNOWN}this.reportor&&this.reportor(e,t)},e.prototype._getNetworkQuality=function(e,t){return t===lK.GOOD?Math.max(e-2,1):t===lK.MEDIUM?e:Math.min(e+1,5)},e.prototype._getQosLevel=function(e,t,i){var r;return r=e<=250&&t<=.15?dK.EXCELLENT:e<=500&&t<=.3?dK.GOOD:e<=750&&t<=.45?dK.POOR:e<=1e3&&t<=.6?dK.BAD:dK.VBAD,i>.5?r=Math.max(r,dK.BAD):i>.35?r=Math.max(r,dK.POOR):i>.15&&(r=Math.max(r,dK.GOOD)),r},e.prototype._getUplinkQoE=function(e,t){var i=lK.INVALID;switch(e){case hK.AUDIO:case hK.VIDEO:i=t<.05?lK.GOOD:t<.1?lK.MEDIUM:lK.POOR;break;case hK.SCREEN_VIDEO:case hK.SCREEN_AUDIO:i=t<.04?lK.GOOD:t<.08?lK.MEDIUM:lK.POOR}return i},e.prototype._getDownlinkQoE=function(e,t,i){var r=fK[e];return t>r.stallRadio||i>r.delay||t>r.stallRadio/2&&i>r.delay/2?lK.POOR:(t>r.stallRadio/2||r.delay,lK.MEDIUM)},e.prototype._getBetterQualityAndRemoveOldest=function(e,t){var i=aL.UNKNOWN,r="up"===t?this._preUplinkStats:this._preDownlinkStats,n=r.get(e);if(n){var o=n.filter((function(e){return e}));o.length>0&&(i=Math.min.apply(Math,ov([],nv(o),!1))),n.shift(),0===n.length&&r.delete(e)}return i},e.prototype._getStreamActiveState=function(e){var t=e.subMediaType,i=e._attributes,r=e.subVideo;return{audioActive:e.subAudio&&pU(t)&&i.localaudio&&i.audiostream,videoActive:r&&fU(t)&&i.localvideo&&i.videostream}},e}(),vK=function(){function e(e){this._room=e,this._remoteVideoSizeCache={},this._remoteScreenSizeCache={},this._start()}return e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}},e.prototype._start=function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},i={};e._room.remoteStreams.forEach((function(r,n){r.forEach((function(r){var o,a=null===(o=r.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=r.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[n]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,p=a.getSettings(),f=p.width,_=void 0===f?0:f,v=p.height,m=void 0===v?0:v;h===m&&d===_||e.onchange&&e.onchange(n,r.isScreen,_,m),delete s[n],(r.isScreen?i:t)[n]={width:_,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=i}),1e3))},e}(),mK=new qF("SubscribeFallbackManager",2),yK=function(){function e(e){this._room=e,this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,this._inSubscribeRecoverChecking=!1,this._forbidSubRecover=!1,this._forbidSubRecoverDuration=1e4}return e.prototype.updateNetworkQuality=function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===aL.BAD||e===aL.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*aL.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===aL.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")},e.prototype.destroy=function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback},e.prototype._subscribeFallbackOrRecover=function(e){return tv(this,void 0,void 0,(function(){var t,i,r,n,o,a,s,c,u,d=this;return iv(this,(function(l){switch(l.label){case 0:if(this._isSubscribeFallbackOrRecover||this._room.connectionState!==Zz.CONNECTED)return[2];if(this._room.subscribeFallbackOption!==nL.AUDIO_ONLY&&this._room.subscribeFallbackOption!==nL.VIDEO_STREAM_LOW)return[3,5];if(t=new Map,this._room.remoteStreams.forEach((function(i){i.forEach((function(i){if(i.hasSubscribed){var r="fallback"===e?i.getSubscribeFallbackParams(d._room.subscribeFallbackOption):i.getSubscribeRecoverParams();if(r){var n=i.getStreamPriority(),o=t.get(n)||[];o.push({stream:i,fallbackOrRecoverOption:r}),t.set(n,o)}}}))})),!(t.size>0))return[3,5];if(mK.print("_subscribeFallbackOrRecover()","start subscribe ".concat(e,".")),i=Array.from(t.keys()).sort((function(e,t){return e-t}))["fallback"===e?0:t.size-1],r=nv(t.get(i)||[],1),!(n=r[0]))return[3,5];o=n.stream,a=n.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,s=o.subLayer.spatialLayer,c=o.subVideo,mK.print("_subscribeFallbackOrRecover()","".concat(o.userId,"'s stream will be ").concat(e," to: MediaType=").concat(a[0]," subState=").concat(a[1]," subLayer=").concat(a[2])),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,lU([(u=this._room).updateSubTrack.apply(u,ov([o],nv(a),!1)).then((function(){"recover"===e?d._startSubscribeRecoverCheck():mK.print("_subscribeFallbackOrRecover()","fallback success."),d.onSubscribeFallback&&d.onSubscribeFallback({userId:o.userId,isScreen:o.isScreen,beforeEnable:c,beforeVideoIndex:s,afterEnable:o.subVideo,afterVideoIndex:o.subLayer.spatialLayer,reason:"fallback"===e?sL.SubscribeFallbackByBandwidth:sL.SubscribeRecoverByBandwidth})})),(h=2e3,new Promise((function(e){window.setTimeout(e,h)})))])];case 2:case 3:return l.sent(),[3,4];case 4:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,l.label=5;case 5:return[2]}var h}))}))},e.prototype._startSubscribeRecoverCheck=function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=1e4,delete e._subRecoverCheckTimer,mK.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)},e.prototype._stopSubscribeRecoverCheck=function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1},e.prototype._startForbidSubRecover=function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),mK.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)},e.prototype._stopForbidSubRecover=function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)},e}(),gK=new qF("Room",1),SK=function(e){function t(t,i){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._remoteStreamStreamIdUserIdMap={},r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._hasPublished=!1,r._publishOnDemandBusy=!1,r._roomConfig=t,r._mediaServerClient=new rK(i),r._reconnectRecord=new EK,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new _K,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(r),r._videoSizeObserver=new vK(r),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(r),r._subFallbackManager=new yK(r),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(r),r._context=i,r}return Z_(t,e),Object.defineProperty(t.prototype,"hasScreenPublished",{get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPublished",{get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._mediaServerClient.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){return this._remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){return this._remoteStreams},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localStream",{get:function(){return this._localStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenStream",{get:function(){return this._localScreenStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomInfo",{get:function(){return this._roomInfo},enumerable:!1,configurable:!0}),t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T=this;null===(e=this._mediaServerClient)||void 0===e||e.on(Oj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(Oj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(Oj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(Oj.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(Oj.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(Oj.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(Oj.ON_PUSH_TRACK,(function(e){var t,i;"standard"===(null===(t=T._mediaServerClient.handler)||void 0===t?void 0:t.name)||"fallback"===(null===(i=T._mediaServerClient.handler)||void 0===i?void 0:i.name)?T._onPushTrackV2.bind(T)(e):T._onPushTrack.bind(T)(e)})),null===(s=this._mediaServerClient)||void 0===s||s.on(Oj.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(Oj.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(Oj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(Oj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(Oj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(Oj.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(Oj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(Oj.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(Oj.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(Oj.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(wj.RSCP,(function(e){T._publishOnDemandItem=e,T._onPublishOnDemand()})),null===(y=this._mediaServerClient)||void 0===y||y.on(kj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(kj.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on("onRemoteStreamStats",(function(e){T._networkQualityManager.updateDownlinkStats(e,T._findRemoteStreamByScreen(e.userId,e.isScreen)),T.emit(sz.ON_REMOTE_STREAM_STATS,_U(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("onLocalStreamStats",(function(e){T._networkQualityManager.updateUplinkStats(e),T.emit(sz.ON_LOCAL_STREAM_STATS,_U(e))})),null===(b=this._mediaServerClient)||void 0===b||b.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e})),null===(I=this._mediaServerClient)||void 0===I||I.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,i,r,n,o){return tv(this,void 0,void 0,(function(){var a=this;return iv(this,(function(s){return iB.setStats({rtc_app_id:e,room_id:t,user_id:r.userId}),gK.print("join()"),[2,new Promise((function(s,c){return tv(a,void 0,void 0,(function(){var a,u,d=this;return iv(this,(function(l){return this._joinResolveCallback=function(e){var t;$F.joinRoom(PF.END,a,!0,"",{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)},this._joinRejectCallback=function(e){var t;$F.joinRoom(PF.END,a,!1,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)},this._liveControlMessage=n,this._roomInfo={appId:e,roomId:t,token:i,userInfo:r,useCloudProxy:o,roomProfile:this._roomConfig.roomProfileType},a=zL(),this.setSessionId(),$F.joinRoom(PF.BEGIN,a,!1,"",{enable_cloud_proxy:null===(u=this._roomInfo)||void 0===u?void 0:u.useCloudProxy}),this._join(this._joinResolveCallback,this._joinRejectCallback,!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,i){return void 0===i&&(i=!1),tv(this,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:r=zL(),gK.print("_join()"),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},i,this._liveControlMessage)];case 2:return n=a.sent(),this._mediaServerClient.roomAttributes=n.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e({users:n.clients,streams:n.streams}),this._isReconnecting=!1,$F.rtcJoinRoom(0,"web","web",zL()-r),this._onJoinSucc(n,i),[3,4];case 3:return(o=a.sent()).code!==qB.OPERATION_CANCEL&&"function"==typeof t?[2,t(o)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,i,r,n){var o,a,s,c,u,d;return tv(this,void 0,void 0,(function(){var l,h,p,f;return iv(this,(function(_){switch(_.label){case 0:return gK.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new bz,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new pK(this._localScreenStream,this._mediaServerClient.handler))),l=!1,h=!1,p=!1,f=!1,!this._localScreenStream.videoTrack&&t?(t instanceof GH&&(h=!0),l=!0):this._localScreenStream.videoTrack&&!t&&(l=!1),!this._localScreenStream.audioTrack&&i?(i instanceof HH&&(f=!0),p=!0):this._localScreenStream.audioTrack&&!i&&(p=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=i,this._localScreenStream.videoEncodeConfig=e,r&&(pU(r)&&(this._localScreenStream.pubAudio=n===dz.PUB),fU(r)&&(this._localScreenStream.pubVideo=n===dz.PUB),gK.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo?this._localScreenStream.hasPublished?[3,2]:(null===(a=this._localScreenStream.observer)||void 0===a||a.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]):(null===(o=this._localScreenStream)||void 0===o?void 0:o.hasPublished)?[2,this.unpublishScreen()]:[2];case 1:return _.sent(),[3,4];case 2:return h?null===(s=this._localScreenStream.observer)||void 0===s||s.setPushVideo(l):null===(c=this._localScreenStream.observer)||void 0===c||c.setEnableVideo(l),f?null===(u=this._localScreenStream.observer)||void 0===u||u.setPushAudio(p):null===(d=this._localScreenStream.observer)||void 0===d||d.setEnableAudio(p),[4,this.updatePubScreenTrack()];case 3:_.sent(),_.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return gK.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),this._localScreenStream?[4,this._mediaServerClient.updatePubTrack(this._localScreenStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e;return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return gK.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?(null===(e=this._localScreenStream.observer)||void 0===e||e.setPublish(!1),[4,this._mediaServerClient.unpublish(this._localScreenStream)]):[3,2];case 1:t.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,t.label=2;case 2:return[2]}}))}))},t.prototype.liveControlMessage=function(e){var t;return tv(this,void 0,void 0,(function(){var i=this;return iv(this,(function(r){switch(r.label){case 0:return gK.print("controlMessage","Invoke controlMessage"),null===(t=e.transcodeMeta)||void 0===t||t.layout.regions.forEach((function(e){i.roomInfo&&(e.roomID=i.roomInfo.roomId)})),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return r.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return"stopped"===e.action&&delete e.publicStreamMeta,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return gK.print("updateUserAttributes","Invoke updateUserAttributes"),e.role&&this._roomInfo&&(this._roomInfo.userInfo.role=e.role),[4,this._mediaServerClient.updateUserAttributes(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.publish=function(e,t,i,r,n,o,a){var s,c,u,d,l,h;return void 0===a&&(a=!1),tv(this,void 0,void 0,(function(){var p,f,_,v,m,y;return iv(this,(function(g){switch(g.label){case 0:if(gK.print("publish","Invoke publish"),p=!1,this._localStream||(this._localStream=new bz,this._mediaServerClient.handler&&(this._localStream.observer=new pK(this._localStream,this._mediaServerClient.handler)),p=!0),this._localStream.videoTrack=i,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,n&&(pU(n)&&(this._localStream.pubAudio=o===dz.PUB),fU(n)&&(this._localStream.pubVideo=o===dz.PUB),gK.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished)return[3,5];if(!this._localStream.pubAudio&&!this._localStream.pubVideo)return[2];g.label=1;case 1:return g.trys.push([1,3,,4]),a?null===(s=this._localStream.observer)||void 0===s||s.setLogin(!0):p&&(f=!!this._localStream.videoTrack,_=!!this._localStream.audioTrack,v=this._localStream.videoTrack instanceof GH,m=this._localStream.audioTrack instanceof HH,this._roomConfig.isAutoPublish&&!this._hasPublished?(f&&(v?null===(c=this._localStream.observer)||void 0===c||c.setPushVideo(!0):null===(u=this._localStream.observer)||void 0===u||u.setEnableVideo(!0)),_&&(m?null===(d=this._localStream.observer)||void 0===d||d.setPushAudio(!0):null===(l=this._localStream.observer)||void 0===l||l.setEnableAudio(!0))):null===(h=this._localStream.observer)||void 0===h||h.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return g.sent(),this._hasPublished=!0,this.emit(sz.ON_PUBLISH_RESULT,{isScreen:!1,state:WM.PUBLISH_SUCC}),[3,4];case 3:throw y=g.sent(),this.emit(sz.ON_PUBLISH_RESULT,{isScreen:!1,state:WM.PUBLISH_FAIL}),y;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:g.sent(),g.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return gK.print("updatePubTrack","Invoke updatePubTrack"),this._localStream?[4,this._mediaServerClient.updatePubTrack(this._localStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublish=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return gK.print("unpublish","Invoke unpublish"),this._localStream?[4,this._mediaServerClient.unpublish(this._localStream)]:[3,2];case 1:e.sent(),this._localStream.clean(),this._localStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.subscribe=function(e,t,i){return tv(this,void 0,void 0,(function(){var r;return iv(this,(function(n){switch(n.label){case 0:return gK.print("subscribe","remoteStream %o",e),r=void 0,i&&(r=this._getSubLayer(i,e)),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){var n;return tv(this,void 0,void 0,(function(){return iv(this,(function(o){return gK.print("updateSubTrack","Invoke updateSubTrack"),[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(e,t,i,r)]}))}))},t.prototype.updateSubVideoConfig=function(e,t){var i,r,n;return tv(this,void 0,void 0,(function(){var o,a;return iv(this,(function(s){return!(o=this._findRemoteStreamByScreen(e,!1))||!o.hasSubscribed||(null===(r=null===(i=null==o?void 0:o.attributes)||void 0===i?void 0:i.videoDescriptions)||void 0===r?void 0:r.length)<=1?[2]:(a=this._getSubLayer(t,o),o.originalStreamIndex=a.spatialLayer,[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrackLayer(o,a)])}))}))},t.prototype._getSubLayer=function(e,t){for(var i,r,n,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,p=0;p<(null==d?void 0:d.length);p++)if(h>=(null===(i=d[p])||void 0===i?void 0:i.width)*(null===(r=d[p])||void 0===r?void 0:r.height)){l=p;break}var f=d[0];if(-1===l)f=d[l=d.length-1];else if(0!==l){var _=d[l-1].width*d[l-1].height,v=(_-h)/(_-d[l].width*d[l].height);f=v<.1?d[l-1]:d[l],l=v<.1?l-1:l}return a=null!==(n=null==f?void 0:f.sub_index)&&void 0!==n?n:-1,{spatialLayer:null!==(o=null==f?void 0:f.video_index)&&void 0!==o?o:l,spatialSubLayer:a}},t.prototype.unsubscribe=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){switch(i.label){case 0:return gK.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e,t)];case 1:return i.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),tv(this,void 0,void 0,(function(){var i,r,n,o,a,s,c;return iv(this,(function(u){switch(u.label){case 0:gK.print("leave","Invoke leave"),i=zL(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(r=rv(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())o=n.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(e){s={error:e}}finally{try{n&&!n.done&&(c=r.return)&&c.call(r)}finally{if(s)throw s.error}}return this._localStream&&(null===(t=this._localStream.observer)||void 0===t||t.setLogin(!1)),[4,this._mediaServerClient.leave()];case 2:return u.sent(),this.destroy(),$F.rtcLeaveRoom(0,"",zL()-i),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&$F.rtcLeaveRoom(-1,a.message,zL()-i),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteUserPriority=function(e,t){var i,r;null===(i=this.remoteStreams.get(e))||void 0===i||i.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(r=this.userPriorityMap)||void 0===r||r.set(e,t)},t.prototype.destroy=function(){var e,t,i,r;gK.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var n=rv(this._remoteStreams),o=n.next();!o.done;o=n.next()){var a=nv(o.value,2)[1];Array.isArray(a)&&a.forEach((function(e){e&&e.clean()}))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._remoteStreams=new Map,this._localStream&&(null===(i=this._localStream)||void 0===i||i.clean(),this._localStream=void 0),this._localScreenStream&&(null===(r=this._localScreenStream)||void 0===r||r.clean(),this._localScreenStream=void 0),this._context=void 0,this._reconnectRecord=new EK,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy(),this._remoteStreamStreamIdUserIdMap={}},t.prototype.updateToken=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return gK.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return tv(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return iv(this,(function(c){t=[];try{for(i=rv(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed){var r=s.updateSubTrack(i,e,lz.UNSUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return tv(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return iv(this,(function(c){t=[];try{for(i=rv(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed&&i.hasSubscribed){var r=s.updateSubTrack(i,e,lz.SUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendUserMessage(e,t)},t.prototype.setSessionId=function(){this._sessionId=bL(),iB.setStats({rtc_session_id:this._sessionId})},t.prototype.sendRoomMessage=function(e,t){var i,r;return void 0===t&&(t=!1),tv(this,void 0,void 0,(function(){var n,o;return iv(this,(function(a){switch(a.label){case 0:return n={clientId:null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo.userId,binary:t,message:""},t?(o=n,[4,qL.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:n.message=e,a.label=3;case 3:return[2,null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendRoomMessage(n)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){gK.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new rK(this._context),this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var i,r,n,o,a,s=this;gK.print("JoinSuccess()"),this._serverConfig=e.config;var c=[],u=[],d=[],l=[],h=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var i=s._remoteUsers.get(t.clientId);i?i._stillExist=!0:c.push(t)}}));try{for(var p=rv(this._remoteUsers.values()),f=p.next();!f.done;f=p.next()){var _=f.value;_._stillExist||u.push({clientId:_.userId}),delete _._stillExist}}catch(e){i={error:e}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(i)throw i.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId,h.push(e)):l.push(e)}));try{for(var v=rv(this._remoteStreams.values()),m=v.next();!m.done;m=v.next()){var y=m.value;Array.isArray(y)&&y.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:Rj.clientDisconnected})}))}}catch(e){n={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(n)throw n.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e,!0,!1)})),h.forEach((function(e){return s._onUpdateStreamAttributes(e)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,i=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));try{for(var r=rv(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return tv(i,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),i.label=1;case 1:return i.trys.push([1,3,,4]),gK.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType)];case 2:return i.sent(),gK.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(sz.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=i.sent(),gK.print("failed resubscribe ".concat(e.userId," with ").concat(e.subMediaType,", error:").concat(t)),e.clean(),null==e||e.resetHasSubscribed(),[3,4];case 4:return[2]}}))}))}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t,i){var r,n,o,a,s,c,u,d,l,h,p;if(void 0===t&&(t=!0),void 0===i&&(i=!0),e.clientId!==(null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId)){var f=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,!f){f=new Iz(e.clientId,e.streamId,e.screen,!1,e.attributes,null===(n=this.userPriorityMap)||void 0===n?void 0:n.get(e.clientId)),this._initStreamListeners(f);var _=this._remoteStreams.get(e.clientId);_?_.push(f):this._remoteStreams.set(e.clientId,[f])}if(this._mediaServerClient.handler&&(f.observer=new cK(f,this._mediaServerClient.handler)),!f.isScreen&&(i&&f.hasVideo&&(f.attributes.extvideo?(null===(o=f.observer)||void 0===o||o.setExternalVideoSource(!0),null===(a=f.observer)||void 0===a||a.setPushVideo(!0)):(null===(s=f.observer)||void 0===s||s.setExternalVideoSource(!1),null===(c=f.observer)||void 0===c||c.setPublishVideo(!0))),i&&f.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(f.attributes.extaudio?(null===(u=f.observer)||void 0===u||u.setExternalAudioSource(!0),null===(d=f.observer)||void 0===d||d.setPushAudio(!0)):(null===(l=f.observer)||void 0===l||l.setExternalAudioSource(!1),null===(h=f.observer)||void 0===h||h.setPublishAudio(!0))),!0===t&&!1===i)){var v=this._roomConfig,m=v.isAutoSubscribeAudio,y=v.isAutoSubscribeVideo;null===(p=f.observer)||void 0===p||p.setLogin(!0,{audio:!!m,video:!!y})}return t&&this.safeEmit(Oj.ON_ADD_STREAM,{stream:f}),f}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof i)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(i);var r={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,$_({},r)),this.safeEmit(Oj.USER_CONNECTION,{userInfo:r})}},t.prototype._onUserDisconnection=function(e){var t,i=this,r=e.clientId,n=e.tag,o=e.code;if(r)if(r===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;n===Pj.kickedByAdmin?a=qB.KICKED_OUT:n===Pj.onUserTokenDidExpire?a=qB.TOKEN_EXPIRED:n===Pj.userDuplicateLogin&&(a=qB.DUPLICATE_LOGIN),o===Nj.roomDismissByAdmin&&(a=qB.ROOM_DISMISS),a&&this.safeEmit(sz.ON_ROOM_ERROR,{errorCode:a})}else{var s=GM.DROPPED;n===Pj.userLeave?s=GM.QUIT:n===Pj.kickedByAdmin?s=GM.KICKED_BY_ADMIN:n===Pj.roleChanged&&(s=GM.SWITCH_TO_INVISIBLE);var c=function(){var e;i._remoteUsers.delete(r),null===(e=i._remoteStreams.get(r))||void 0===e||e.forEach((function(e){i._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:"client disconnected"})})),i.safeEmit(sz.ON_USER_LEAVE,{userInfo:{userId:r},reason:s})};if(n===Pj.userDuplicateLogin){this._userDuplicateLoginTimerMap.has(r)&&(self.clearTimeout(this._userDuplicateLoginTimerMap.get(r)),this._userDuplicateLoginTimerMap.delete(r));var u=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(r,u)}else c()}},t.prototype._onRemoveStream=function(e){var t,i,r,n,o=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=this._remoteStreams.get(e.clientId);if(a){var s=a.find((function(t){return t.streamId==e.streamId}));s&&(null===(i=this._mediaServerClient)||void 0===i||i.handleRemoveStream(s,e).then((function(){if(!(null==s?void 0:s._workaround_1_)){var t=o._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId||(t.clean(),!1)})),o._remoteStreams.set(e.clientId,t)}})).finally((function(){o.safeEmit(Oj.ON_REMOVE_STREAM,{stream:s,reason:e.message})})),s.hasVideo&&(null===(r=s.observer)||void 0===r||r.setPublishVideo(!1)),s.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(null===(n=s.observer)||void 0===n||n.setPublishAudio(!1)))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g=e.clientId,S=e.streamId,E=e.attributes,b=this._findRemoteStream(g,S);if(b){var I=b.attributes,T=$_($_({},I),E),A=!1,R=T.localaudio!==I.localaudio,C=!1,O=!1,w=T.localvideo!==I.localvideo,k=!1,P=YH.NONE,N=YH.NONE;T.audiostream!==I.audiostream&&(A=T.localaudio,C=!!T.audiostream,T.audiostream?P|=JM.AUDIO:N|=JM.AUDIO),T.videostream!==I.videostream&&(O=T.localvideo,k=!!T.videostream,T.videostream?P|=JM.VIDEO:N|=JM.VIDEO),P&&this.safeEmit(sz.ON_USER_PUBLISH_STATE_CHANGE,{userId:g,mediaType:P,isScreen:b.isScreen,pubState:dz.PUB,remoteStream:b}),N&&this.safeEmit(sz.ON_USER_PUBLISH_STATE_CHANGE,{userId:g,mediaType:N,isScreen:b.isScreen,pubState:dz.UNPUB,remoteStream:b}),T.localaudio!==I.localaudio&&(T.localaudio?(T.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(i=b.observer)||void 0===i||i.setPushAudio(!0)):(null===(r=b.observer)||void 0===r||r.setExternalAudioSource(!1),null===(n=b.observer)||void 0===n||n.setEnableAudio(!0)),this.safeEmit(sz.ON_USER_START_AUDIO_CAPTURE,{userId:g})):(T.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),!b.isScreen&&this.safeEmit(sz.ON_USER_STOP_AUDIO_CAPTURE,{userId:g}))),T.localvideo!==I.localvideo&&(T.localvideo?(T.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(sz.ON_USER_START_VIDEO_CAPTURE,{userId:g})):(T.extvideo?(null===(p=b.observer)||void 0===p||p.setExternalVideoSource(!0),null===(f=b.observer)||void 0===f||f.setPushVideo(!1)):(null===(_=b.observer)||void 0===_||_.setExternalVideoSource(!1),null===(v=b.observer)||void 0===v||v.setEnableVideo(!1)),!b.isScreen&&this.safeEmit(sz.ON_USER_STOP_VIDEO_CAPTURE,{userId:g}))),A&&!R&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!w&&(null===(y=b.observer)||void 0===y||y.setRemoteUnmuteVideo(k)),b.attributes=T}},t.prototype._onPushTrackV2=function(e){var t,i=this;if(null===(t=e.streamId)||void 0===t?void 0:t.startsWith("audio_mux")){var r=new Iz(e.clientId,e.streamId,!1,!1,{audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1});this._mediaServerClient.subscribe4pushTrackV2(r,e).then((function(){return i.safeEmit(sz.SUBSCRIBE_PUSH_TRACK,{stream:r})})).catch((function(e){gK.print("subscribe push track failed: ".concat(e))}))}},t.prototype._onPushTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=this._findRemoteStream(i,r);n||(n=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){return t.safeEmit(sz.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){gK.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=e.message,o=this._findRemoteStream(i,r);o&&this._mediaServerClient.unsubscribe4removeTrack(o,n).then((function(){var e;if(o._workaround_1_){var n=null===(e=t._remoteStreams.get(i))||void 0===e?void 0:e.filter((function(e){return e.streamId!==r}));t._remoteStreams.set(i,n||[])}t.safeEmit(sz.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){gK.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,i=e.nodes,r=e.reason;xV.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(i)&&i.length?this._getAccessNode=i[0]:this._getAccessFeedback=r,$F.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(r)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,i=this;this._isReconnecting=!0;try{for(var r=rv(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}$F.rtcReconnect(1002,nF.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,oF.PEERCONNECTION),this._join((function(){$F.rtcReconnected(aF.PEERCONNECTION_RECONNECTED,sF.PEERCONNECTION)}),(function(e){i._reconnectRecord.record(e),i._reconnectRecord.shouldReconnect?(gK.print("Reconnecting error, will reconnect after 3s",e),i._reconnectTimer=window.setTimeout(i._reconnect.bind(i),3e3)):(i.safeEmit(sz.RECONNECT_FAILED),i.destroy())}),!0)},t.prototype._handleAbnormalDisconnection=function(){gK.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t,i=this;if(e.next===Zz.DISCONNECTED)t=ZM.CONNECTION_STATE_DISCONNECTED;else if(e.next===Zz.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?ZM.CONNECTION_STATE_RECONNECTED:ZM.CONNECTION_STATE_CONNECTED;else{if(e.next!==Zz.CONNECTING)return;t=this._isReconnecting?ZM.CONNECTION_STATE_RECONNECTING:ZM.CONNECTION_STATE_CONNECTING}e.prev===Zz.CONNECTED&&e.next===Zz.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){i.safeEmit(kj.ON_CONNECTION_STATE_CHANGE,{state:ZM.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(kj.ON_CONNECTION_STATE_CHANGE,{state:t})},t.prototype._initStreamListeners=function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(i){var r;t.emit(sz.ON_SEI_MESSAGED_RECEIVED,{sei:i,remoteStreamKey:{userId:e.userId,roomId:null===(r=t._roomInfo)||void 0===r?void 0:r.roomId,streamIndex:e.isScreen?YM.STREAM_INDEX_SCREEN:YM.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(Oj.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(Oj.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(Oj.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){if(e.body){var t=e.body,i=t.error||0,r=uz.START,n=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(r=uz.START_FAILED);break;case"TranscodeStateChanged":r=0!==t.error?uz.START_FAILED:uz.START_SUCCESS;break;case"TranscodeStopped":r=0!==t.error?uz.STOP_FAILED:uz.STOP_SUCCESS;break;case"TranscodeUpdated":r=0!==t.error?uz.UPDATE_FAILED:uz.UPDATE_SUCCESS}this.safeEmit(Oj.POST_PROCESSING_MESSAGE,{code:i,protocol:t.protocol,error:t.error,eventType:r,message:n[i]})}this.safeEmit(Oj.POST_PROCESSING_MESSAGE,{code:i,message:n[i],type:e.type})}},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(Oj.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onSceneConfig=function(e){},t.prototype._onStreamFailed=function(e){var t,i,r,n,o,a;return tv(this,void 0,void 0,(function(){var s,c,u;return iv(this,(function(d){switch(d.label){case 0:return"publish"!==e.type?[3,2]:(s=void 0,(null===(t=this.localStream)||void 0===t?void 0:t.streamId)===e.streamId?s=this.localStream:(null===(i=this.localScreenStream)||void 0===i?void 0:i.streamId)===e.streamId&&(s=this.localScreenStream),s?(null==s||s.clean(),[4,null===(r=this._mediaServerClient)||void 0===r?void 0:r.unpublish(s).catch((function(){}))]):[2]);case 1:return d.sent(),null===(n=this._mediaServerClient)||void 0===n||n.publish(s).catch((function(){})),[3,5];case 2:return"subscribe"!==e.type?[3,5]:(c=this._remoteStreamStreamIdUserIdMap[e.streamId],(u=this._findRemoteStream(c,e.streamId))?[4,null===(o=this._mediaServerClient)||void 0===o?void 0:o.unsubscribe(u,JM.AUDIO_AND_VIDEO)]:[3,5]);case 3:return d.sent(),[4,null===(a=this._mediaServerClient)||void 0===a?void 0:a.subscribe(u,u.subMediaType,u.subLayer)];case 4:d.sent(),this.safeEmit(sz.RESUBSCRIBE,{stream:u}),d.label=5;case 5:return[2]}}))}))},t.prototype._onStreamControlMessage=function(e){var t,i;e.type===Cj.PushLimitWarn&&((null===(t=this._localStream)||void 0===t?void 0:t.pubAudio)||(null===(i=this._localStream)||void 0===i?void 0:i.pubVideo)||this.unpublish())},t.prototype._onPublishOnDemand=function(){var e,t,i,r,n,o,a,s,c,u,d;return tv(this,void 0,void 0,(function(){var l,h,p,f,_,v,m,y,g;return iv(this,(function(S){switch(S.label){case 0:return this._publishOnDemandBusy||!1===(null===(i=null===(t=null===(e=this._serverConfig)||void 0===e?void 0:e.engine_VPM)||void 0===t?void 0:t.ondemand)||void 0===i?void 0:i.enable)?[2]:(l=this._publishOnDemandItem,this._publishOnDemandItem=void 0,l?(null===(r=this._localStream)||void 0===r?void 0:r.enableSimulcast)&&(null===(n=this._localStream)||void 0===n?void 0:n.videoTransceiver)?(this._publishOnDemandBusy=!0,h=null===(o=this._localStream)||void 0===o?void 0:o.stream.id,p=null===(a=this._localStream)||void 0===a?void 0:a.videoTransceiver.sender,(f=p.getParameters())&&Array.isArray(f.encodings)&&Array.isArray(l)&&(_={},gK.print("_onPublishOnDemand exec","usedDescriptions: %o",l),l.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(h)){var i=null==e?void 0:e.Metadata.SubvideoIndex;_[i]=i}})),v={},null===(c=null===(s=this._localStream)||void 0===s?void 0:s.subVideoDescriptions)||void 0===c||c.forEach((function(e){void 0!==_[e.sub_index]&&(v[e.video_index]=e)})),m=(null===(d=null===(u=p.track)||void 0===u?void 0:u.getSettings())||void 0===d?void 0:d.height)||720,y=[],g=0,f.encodings=f.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),y.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy,bitrate:e.maxBitrate})):(g++,y.push({type:0,rid:e.rid}),e.active=!1)),e})),g===f.encodings.length&&(f.encodings[0].active=!0,$F.rtcInvokeStatus(JSON.stringify(y),0,"rscp_error",h,0)),$F.rtcInvokeStatus(JSON.stringify(y),0,"rscp",h,0)),[4,p.setParameters(f)]):[3,2]:[2]);case 1:S.sent(),this._publishOnDemandBusy=!1,S.label=2;case 2:return this._onPublishOnDemand(),[2]}}))}))},t.prototype._reportNetworkQuality=function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(sz.ON_NETWORK_QUALITY,e,t)},t.prototype._emitVideoSizeChange=function(e,t,i,r){var n;this.emit(sz.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(n=this.roomInfo)||void 0===n?void 0:n.roomId,userId:e,streamIndex:t?YM.STREAM_INDEX_SCREEN:YM.STREAM_INDEX_MAIN},{width:i,height:r})},t.prototype._emitSubscribeFallback=function(e){this.emit(sz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)},t}(JF),EK=function(){function e(){this._all_201_count=0,this._has_4xx=!1}return Object.defineProperty(e.prototype,"shouldReconnect",{get:function(){return!(this._all_201_count>=3||this._has_4xx)},enumerable:!1,configurable:!0}),e.prototype.record=function(e){var t=!1,i=!1;if(Array.isArray(e)){var r=0;e.map((function(e){var t,n,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(n=e.error)||void 0===n?void 0:n.code)<500&&(i=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&r++})),r===e.length&&(t=!0),t&&this._all_201_count++,i&&(this._has_4xx=!0)}},e.prototype.clear=function(){this._all_201_count=0,this._has_4xx=!1},e}(),bK=function(e,t){void 0===t&&(t={});var i=document.createElement(e);return t.id&&(i.id=t.id),t.classList&&t.classList.forEach((function(e){i.classList.add(e)})),t.style&&Object.assign(i.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=nv(e,2),r=t[0],n=t[1];"muted"===r?i.muted=!0:i.setAttribute(r,n)})),i},IK=new qF("Player",0),TK=new(function(e){function t(){var t=e.call(this)||this;return t._audioPlayMap=new Map,document.body?t._listenPageClick():window.addEventListener("load",(function(){t._listenPageClick()})),t}return Z_(t,e),Object.defineProperty(t.prototype,"players",{get:function(){return this._audioPlayMap},enumerable:!1,configurable:!0}),t.prototype._listenPageClick=function(){document.body.addEventListener("touchstart",this.resumeAudioPlayer.bind(this),!0),document.body.addEventListener("mousedown",this.resumeAudioPlayer.bind(this),!0)},t.prototype.resumeAudioPlayer=function(){this._audioPlayMap.forEach((function(e){e._hasManuallyPause||e.manuallyPlay().then((function(e){})).catch((function(e){IK.print("Replay audio player failed!",e)}))}))},t.prototype.addRequestClickPlayer=function(e){this._audioPlayMap.get(e.userId)||(IK.print("Put ".concat(e.userId," player into waiting array")),this._audioPlayMap.set(e.userId,e))},t.prototype.removeRequestClickPlayer=function(e){IK.print("Remove ".concat(e.userId," player from waiting array")),this._audioPlayMap.delete(e.userId)},t}(zF)),AK=new qF("Player",0),RK=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],CK={playsinline:"","webkit-playsinline":""},OK={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},wK=function(e){function t(t){var i=e.call(this)||this;i.mirrorType=$M.MIRROR_TYPE_NONE,i.played=!1,i._emitPlayFailed=!1,i._hasManuallyPause=!1,i.emitVideoEvent=function(e){var t,r,n={type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:i.isScreen};switch(i.emit("playback_event",n),e.type){case"canplay":case"loadeddata":i._internalPlay();break;case"playing":AK.print("VideoPlayerPlaying","[userId-".concat(i.userId,"] video element playing"))}},i._internalPlay=function(){var e,t;if(cB("_internalPlay video",{paused:null===(e=i._videoDom)||void 0===e?void 0:e.paused,manuallyPause:i._hasManuallyPause}),!i._hasManuallyPause&&(null===(t=i._videoDom)||void 0===t?void 0:t.paused)){var r=i._videoDom.play();(null==r?void 0:r.then)&&r.catch((function(e){var t,r,n,o;if(!i._emitPlayFailed){if("AbortError"===e.name)return $F.rtcError("video play failed, userId: ".concat(i.userId,", ").concat(e.name," ").concat(e.message),-1e3),void i.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:"play-error",currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:i.isScreen});i._emitPlayFailed=!0,$F.rtcError("video autoplay failed, userId: ".concat(i.userId,", ").concat(e.name," ").concat(e.message),-1e3),i.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=i._videoDom)||void 0===n?void 0:n.readyState)||0,userId:i.userId,eventName:"autoplay-error",currentTime:(null===(o=i._videoDom)||void 0===o?void 0:o.currentTime)||0,isScreen:i.isScreen})}}))}};var r=t.renderDom,n=t.userId;i.renderMode=void 0!==t.renderMode?t.renderMode:XM.RENDER_MODE_FIT;var o="string"==typeof r?document.getElementById(r):r;if(!o)throw new JB(qB.CANT_FIND_DOM,"can't find video dom ",r);return i._videoContainer=document.createElement("div"),i._videoContainer.style.width="100%",i._videoContainer.style.height="100%",i._videoContainer.style.position="relative",i._videoContainer.style.overflow="hidden",i._containerDom=o,i.userId=n,i.isScreen=!!t.isScreen,i._initVideo(),i._pausedTimer=setInterval((function(){i._videoDom&&(i._prevPaused!==i._videoDom.paused&&AK.print("VideoPlayer.videoDom.pausedChange",i._videoDom.paused),i._prevPaused=i._videoDom.paused)}),500),JL&&15===$L&&(i._safari15VideoTimer=window.setInterval((function(){try{i._videoContainer.style.display="block",setTimeout((function(){i._videoContainer.style.display="flex"}),500)}catch(e){}}),5e3)),i}return Z_(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=bK("video",{style:{width:"100%",height:"100%"},attributes:OK}),this._videoDom.id="".concat(this.userId,"_").concat(HL()),this.renderMode===XM.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===$M.MIRROR_TYPE_RENDER)),this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&RK.forEach((function(t){var i;null===(i=e._videoDom)||void 0===i||i.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e,t,i=this;this._videoDom&&(RK.forEach((function(e){var t;null===(t=i._videoDom)||void 0===t||t.removeEventListener(e,i.emitVideoEvent)})),null===(e=this._videoDom)||void 0===e||e.removeEventListener("canplay",this._internalPlay),null===(t=this._videoDom)||void 0===t||t.removeEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(i){var r;if("timeupdate"===i.eventName){var n=e.isScreen?1.5:.5;if(0===(null===(r=t._videoDom)||void 0===r?void 0:r.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>n;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var i;return tv(this,void 0,void 0,(function(){var t,r,n=this;return iv(this,(function(o){if(t=this._videoDom,AK.print("playVideo","play video track: ".concat(this.userId)),t&&t.srcObject instanceof MediaStream&&t.srcObject.getTrackById(null===(i=e.getTrack())||void 0===i?void 0:i.id)){try{$F.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(e){}return[2]}return t||(this._initVideo(),t=this._videoDom),AK.print("playVideo","play video by dom: ".concat(null==t?void 0:t.id)),(r=new MediaStream).addTrack(e.getTrack()),t.srcObject=r,t&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),t&&!this._videoContainer.contains(t)&&this._videoContainer.appendChild(t),setTimeout((function(){return n._internalPlay()})),this.played=!0,[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var i=new MediaStream;i.addTrack(t),this._videoDom.srcObject=i}},t.prototype.manuallyPause=function(){if(AK.print("Invoke VideoPlayer.manuallyPause",this.userId,this.isScreen),this.played){if(this._hasManuallyPause=!0,!this._videoDom)throw new JB(qB.INVALID_PARAMS,"Player not found");return this._videoDom.pause()}},t.prototype.manuallyPlay=function(){if(AK.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,this._hasManuallyPause=!1,!this._videoDom)throw new JB(qB.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||tU?this._videoDom.play():Promise.resolve()},t.prototype.mirror=function(e){AK.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?$M.MIRROR_TYPE_RENDER:$M.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e,t=this._containerDom;AK.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,(null==t?void 0:t.contains(this._videoContainer))&&t.removeChild(this._videoContainer),(null===(e=this._videoContainer)||void 0===e?void 0:e.contains(this._videoDom))&&this._videoContainer.removeChild(this._videoDom),clearInterval(this._pausedTimer)),this.__cumulativeTime=void 0,this.played=!1},t.prototype.destroy=function(){AK.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(this._videoDom.srcObject=null,delete this._videoDom),this._safari15VideoTimer&&(window.clearInterval(this._safari15VideoTimer),this._safari15VideoTimer=void 0)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(JV.exports.EventEmitter),kK=new(function(){function e(){this._context=_L.getAudioContextInstance()}return e.prototype.getDestinationNode=function(){return this._context.destination},e.prototype.createMediaElementSource=function(e){return this._context.createMediaElementSource(e)},e}()),PK=null,NK=function(e){function t(t,i){var r=void 0===i?{divId:void 0,muted:!1,isScreen:!1,useWebAudio:!1}:i,n=r.divId,o=r.muted,a=r.isScreen,s=r.useWebAudio,c=e.call(this)||this;if(c._stallCount=0,c.muted=!1,c._emitPlayFailed=!1,c._hasManuallyPause=!1,c.played=!1,c._useWebAudio=!1,c.emitAudioEvent=function(e){var t,i,r={type:"audio",rawEvent:e,readyState:(null===(t=c._audioDom)||void 0===t?void 0:t.readyState)||0,userId:c.userId,eventName:e.type,currentTime:(null===(i=c._audioDom)||void 0===i?void 0:i.currentTime)||0,isScreen:c.isScreen};"playing"===e.type&&(AK.print("AudioPlayerPlaying","[userId-".concat(c.userId,"] audio element playing")),eU&&(PK||(PK=window.setTimeout((function(){AK.print("AudioPlayerPlaying","[userId-".concat(c.userId,"] audio playing workaround"));var e=new AudioContext;e.close(),e=null,PK=null}),2500)))),"pause"===e.type&&AK.print("AudioPlayerPause","[userId-".concat(c.userId,"] audio element pause")),iU&&tU&&("canplay"===e.type?(clearTimeout(c._wechatTimer),c._wechatTimer=window.setTimeout((function(){c._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(c._wechatTimer)),c.emit("playback_event",r)},c._internalPlay=function(){var e,t;if(cB("_internalPlay audio",{paused:null===(e=c._audioDom)||void 0===e?void 0:e.paused,manuallyPause:c._hasManuallyPause}),!c._hasManuallyPause&&(null===(t=c._audioDom)||void 0===t?void 0:t.paused)){try{var i=c._audioDom.play();c._audioDom.volume=1,(null==i?void 0:i.then)&&i.catch((function(e){c._autoPlayError(e),$F.rtcError("audio autoplay failed, userId: ".concat(c.userId,": ").concat(e.message," ").concat(e.name),-1e3)})).then((function(){cB("_internalPlay successfully",{userId:c.userId})}))}catch(e){c._autoPlayError(e),$F.rtcError("audio autoplay failed, userId: ".concat(c.userId,": ").concat(e.message," ").concat(e.name),-1e3)}iU&&TK.addRequestClickPlayer(c)}},n){var u=document.getElementById(n);if(!u)throw new JB(qB.CANT_FIND_DOM,"can't find audio dom ".concat(n));c._containerDom=u}else c._containerDom=document.body;return c.userId=t,c.muted=o,c.isScreen=a,c._useWebAudio=!!s,c._initAudio(),c}return Z_(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=bK("audio",{style:{display:"none"},attributes:CK}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id="".concat(this.userId,"_").concat(HL()),this._containerDom.appendChild(this._audioDom),this._useWebAudio&&(this._sourceNode=kK.createMediaElementSource(this._audioDom),this._sourceNode.connect(kK.getDestinationNode()),AK.print("AudioPlayer","[userId-".concat(this.userId,"] use web audio output")))),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&RK.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.addEventListener(t,e.emitAudioEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(RK.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return tv(this,void 0,void 0,(function(){var i,r,n=this;return iv(this,(function(o){return AK.print("playAudio","play audio track: ".concat(this.userId)),this._track=e,(i=this._audioDom)&&i.srcObject instanceof MediaStream&&i.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)?(i.paused&&this._internalPlay(),[2]):(i||(this._initAudio(),i=this._audioDom),(r=new MediaStream).addTrack(e.getTrack()),i.srcObject=r,null==i||i.addEventListener("canplay",this._internalPlay),null==i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return n._internalPlay()})),this.played=!0,[2])}))}))},t.prototype._autoPlayError=function(e){var t,i;this._emitPlayFailed||(this._emitPlayFailed=!0,$F.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(i=this._audioDom)||void 0===i?void 0:i.currentTime)||0,isScreen:this.isScreen}))},t.prototype.manuallyPause=function(){if(AK.print("Invoke AudioPlayer.manuallyPause",this.userId,this.isScreen),this.played){if(this._hasManuallyPause=!0,!this._audioDom)throw new JB(qB.INVALID_PARAMS,"Player not found");return this._audioDom.pause()}},t.prototype.manuallyPlay=function(){var e;if(this._emitPlayFailed=!1,this._hasManuallyPause=!1,!this._audioDom)throw new JB(qB.INVALID_PARAMS,"Player not found");_L.resume(),this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return(null==t?void 0:t.then)?t:Promise.resolve(t)},t.prototype.setPlaybackDevice=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:return AK.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,CH.enumerateAudioPlaybackDevices()];case 1:return t=i.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return i.sent(),[2]}}))}))},t.prototype.stop=function(){var e,t=this._containerDom;AK.print("stopAudio","stop audio track: ".concat(this.userId)),this._useWebAudio&&(null===(e=this._sourceNode)||void 0===e||e.disconnect()),this._audioDom&&(this._audioDom.srcObject=null,t&&t.contains(this._audioDom)&&t.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){AK.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),delete this._track,this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom),this._useWebAudio&&delete this._sourceNode,iU&&TK.removeRequestClickPlayer(this)},t}(JV.exports.EventEmitter);function DK(e,t,i,r){var n=this,o=function(e,t){return tv(n,void 0,void 0,(function(){var n;return iv(this,(function(o){switch(o.label){case 0:return n=null==r?void 0:r.get(t),Array.isArray(n)&&(n=null==n?void 0:n.find((function(e){return e.isScreen===i}))),e?e.played?[4,e.manuallyPlay()]:[3,2]:[3,3];case 1:return o.sent(),[3,3];case 2:n&&(e instanceof wK&&n.videoTrack&&e.playVideo(n.videoTrack,n),e instanceof NK&&n.audioTrack&&e.playAudio(n.audioTrack)),o.label=3;case 3:return[2]}}))}))};if(t)return o(e.get(t),t);var a=[];return e.forEach((function(e,t){return a.push(o(e,t))})),Promise.all(a)}var MK=function(){function e(){this.userMessage={},this.roomMessage={},this._setTimer()}return e.prototype._setTimer=function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()},e.prototype._reportAndgReset=function(){this._report(),this._reset()},e.prototype._report=function(){var e=this;$F.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")},e.prototype._reset=function(){this.userMessage={},this.roomMessage={}},e.prototype._checkInitUserMessage=function(e,t){this.userMessage["".concat(t,"-").concat(e)]||(this.userMessage["".concat(t,"-").concat(e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:1/0,dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})},e.prototype._sendUserMessage=function(e,t,i){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_send_total++,i&&this.userMessage["".concat(t,"-").concat(e)].dc_send_binary++},e.prototype._recvUserMessage=function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++},e.prototype._sendUserFail=function(e,t){var i=this.userMessage["".concat(t,"-").concat(e)];i&&i.dc_send_fail++},e.prototype._sendUserAck=function(e,t,i,r,n){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=i,o.dc_cost_s2s+=r||0,o.dc_cost_peer_s2e+=n,o.dc_cost_e2s+=i-(r||0)-n,i<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=1e3&&o.dc_send_ack_1s++,i<o.dc_least_time&&(o.dc_least_time=i),i>o.dc_most_time&&(o.dc_most_time=i))},e.prototype.sendRoomMessage=function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:1/0,dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++},e.prototype.sendRoomFail=function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++},e.prototype.sendRoomAck=function(e,t){var i=this.roomMessage[e];i&&(i.dc_send_ack++,i.dc_cost_time+=t,t<i.dc_least_time&&(i.dc_least_time=t),t>i.dc_most_time&&(i.dc_most_time=t),t<=100?(i.dc_send_ack_100++,i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=200?(i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=400?(i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=1e3&&i.dc_send_ack_1s++)},e.prototype.sendP2PMessage=function(e,t){this._sendUserMessage(e,UF.P2P,t)},e.prototype.recvP2PMessage=function(e){this._recvUserMessage(e,UF.P2P)},e.prototype.sendP2PFail=function(e){this._sendUserFail(e,UF.P2P)},e.prototype.sendP2PAck=function(e,t,i,r){this._sendUserAck(e,UF.P2P,t,i,r)},e.prototype.sendP2POutRoomMessage=function(e,t){this._sendUserMessage(e,UF.P2P_OUTSIDE_ROOM,t)},e.prototype.recvP2POutRoomMessage=function(e){this._recvUserMessage(e,UF.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomFail=function(e){this._sendUserFail(e,UF.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomAck=function(e,t,i,r){this._sendUserAck(e,UF.P2P_OUTSIDE_ROOM,t,i,r)},e.prototype.sendP2serverMessage=function(e){this._sendUserMessage("",UF.P2SERVER,e)},e.prototype.sendP2serverFail=function(){this._sendUserFail("",UF.P2SERVER)},e.prototype.sendP2serveAck=function(e){this._sendUserAck("",UF.P2SERVER,e,0,0)},e.prototype.countP2PMessage=function(e,t,i,r,n){this.sendP2PMessage(t,i),e?this.sendP2PAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2PFail(t)},e.prototype.countRoomMessage=function(e,t,i,r){this.sendRoomMessage(t,i),e?this.sendRoomAck(t,Date.now()-r):this.sendRoomFail(t)},e.prototype.countUserMessageOutsideRoom=function(e,t,i,r,n){this.sendP2POutRoomMessage(t,i),e?this.sendP2POutRoomAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2POutRoomFail(t)},e.prototype.countServerMessage=function(e,t,i){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-i):this.sendP2serverFail()},e.prototype.destroy=function(){this._reset(),clearTimeout(this._timer)},e}(),LK="object"==("undefined"==typeof global?"undefined":vs(global))&&global&&global.Object===Object&&global,UK="object"==("undefined"==typeof self?"undefined":vs(self))&&self&&self.Object===Object&&self,xK=LK||UK||Function("return this")(),VK=xK.Symbol,FK=Object.prototype,BK=FK.hasOwnProperty,jK=FK.toString,GK=VK?VK.toStringTag:void 0;var HK=Object.prototype.toString;var zK=VK?VK.toStringTag:void 0;function KK(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":zK&&zK in Object(e)?function(e){var t=BK.call(e,GK),i=e[GK];try{e[GK]=void 0;var r=!0}catch(e){}var n=jK.call(e);return r&&(t?e[GK]=i:delete e[GK]),n}(e):function(e){return HK.call(e)}(e)}function WK(e){return null!=e&&"object"==vs(e)}var qK=Array.isArray;function XK(e){var t=vs(e);return null!=e&&("object"==t||"function"==t)}function YK(e){return e}function JK(e){if(!XK(e))return!1;var t=KK(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var QK=xK["__core-js_shared__"],ZK=function(){var e=/[^.]+$/.exec(QK&&QK.keys&&QK.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var $K=Function.prototype.toString;var eW=/^\[object .+?Constructor\]$/,tW=Function.prototype,iW=Object.prototype,rW=tW.toString,nW=iW.hasOwnProperty,oW=RegExp("^"+rW.call(nW).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function aW(e){return!(!XK(e)||(t=e,ZK&&ZK in t))&&(JK(e)?oW:eW).test(function(e){if(null!=e){try{return $K.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function sW(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}var cW=Date.now;var uW,dW,lW,hW=function(){try{var e=function(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return aW(i)?i:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),pW=hW,fW=pW?function(e,t){return pW(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:YK,_W=(uW=fW,dW=0,lW=0,function(){var e=cW(),t=16-(e-lW);if(lW=e,t>0){if(++dW>=800)return arguments[0]}else dW=0;return uW.apply(void 0,arguments)}),vW=/^(?:0|[1-9]\d*)$/;function mW(e,t){var i=vs(e);return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&vW.test(e))&&e>-1&&e%1==0&&e<t}function yW(e,t,i){"__proto__"==t&&pW?pW(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}function gW(e,t){return e===t||e!=e&&t!=t}var SW=Object.prototype.hasOwnProperty;function EW(e,t,i){var r=e[t];SW.call(e,t)&&gW(r,i)&&(void 0!==i||t in e)||yW(e,t,i)}var bW=Math.max;function IW(e,t){return _W(function(e,t,i){return t=bW(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,o=bW(r.length-t,0),a=Array(o);++n<o;)a[n]=r[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=r[n];return s[t]=i(a),sW(e,this,s)}}(e,t,YK),e+"")}function TW(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function AW(e){return null!=e&&TW(e.length)&&!JK(e)}var RW=Object.prototype;function CW(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||RW)}function OW(e){return WK(e)&&"[object Arguments]"==KK(e)}var wW=Object.prototype,kW=wW.hasOwnProperty,PW=wW.propertyIsEnumerable,NW=OW(function(){return arguments}())?OW:function(e){return WK(e)&&kW.call(e,"callee")&&!PW.call(e,"callee")};var DW="object"==("undefined"==typeof exports?"undefined":vs(exports))&&exports&&!exports.nodeType&&exports,MW=DW&&"object"==("undefined"==typeof module?"undefined":vs(module))&&module&&!module.nodeType&&module,LW=MW&&MW.exports===DW?xK.Buffer:void 0,UW=(LW?LW.isBuffer:void 0)||function(){return!1},xW={};xW["[object Float32Array]"]=xW["[object Float64Array]"]=xW["[object Int8Array]"]=xW["[object Int16Array]"]=xW["[object Int32Array]"]=xW["[object Uint8Array]"]=xW["[object Uint8ClampedArray]"]=xW["[object Uint16Array]"]=xW["[object Uint32Array]"]=!0,xW["[object Arguments]"]=xW["[object Array]"]=xW["[object ArrayBuffer]"]=xW["[object Boolean]"]=xW["[object DataView]"]=xW["[object Date]"]=xW["[object Error]"]=xW["[object Function]"]=xW["[object Map]"]=xW["[object Number]"]=xW["[object Object]"]=xW["[object RegExp]"]=xW["[object Set]"]=xW["[object String]"]=xW["[object WeakMap]"]=!1;var VW="object"==("undefined"==typeof exports?"undefined":vs(exports))&&exports&&!exports.nodeType&&exports,FW=VW&&"object"==("undefined"==typeof module?"undefined":vs(module))&&module&&!module.nodeType&&module,BW=FW&&FW.exports===VW&&LK.process,jW=function(){try{var e=FW&&FW.require&&FW.require("util").types;return e||BW&&BW.binding&&BW.binding("util")}catch(e){}}(),GW=jW&&jW.isTypedArray,HW=GW?function(e){return function(t){return e(t)}}(GW):function(e){return WK(e)&&TW(e.length)&&!!xW[KK(e)]},zW=HW,KW=Object.prototype.hasOwnProperty;function WW(e,t){var i=qK(e),r=!i&&NW(e),n=!i&&!r&&UW(e),o=!i&&!r&&!n&&zW(e),a=i||r||n||o,s=a?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],c=s.length;for(var u in e)!t&&!KW.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||mW(u,c))||s.push(u);return s}var qW=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object),XW=qW,YW=Object.prototype.hasOwnProperty;function JW(e){return AW(e)?WW(e):function(e){if(!CW(e))return XW(e);var t=[];for(var i in Object(e))YW.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}var QW=Object.prototype.hasOwnProperty;function ZW(e){if(!XK(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=CW(e),i=[];for(var r in e)("constructor"!=r||!t&&QW.call(e,r))&&i.push(r);return i}var $W,eq=($W=function(e,t){!function(e,t,i,r){var n=!i;i||(i={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=r?r(i[s],e[s],s,i,e):void 0;void 0===c&&(c=e[s]),n?yW(i,s,c):EW(i,s,c)}}(t,function(e){return AW(e)?WW(e,!0):ZW(e)}(t),e)},IW((function(e,t){var i=-1,r=t.length,n=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(n=$W.length>3&&"function"==typeof n?(r--,n):void 0,o&&function(e,t,i){if(!XK(i))return!1;var r=vs(t);return!!("number"==r?AW(i)&&mW(t,i.length):"string"==r&&t in i)&&gW(i[t],e)}(t[0],t[1],o)&&(n=r<3?void 0:n,r=1),e=Object(e);++i<r;){var a=t[i];a&&$W(e,a,i,n)}return e}))),tq=eq;function iq(e,t){return function(e,t){for(var i=-1,r=null==e?0:e.length,n=Array(r);++i<r;)n[i]=t(e[i],i,e);return n}(t,(function(t){return e[t]}))}function rq(e){return null==e?[]:iq(e,JW(e))}var nq,oq=function(e,t){return tv(void 0,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:i=new Audio(URL.createObjectURL(new Blob([e],t))),r.label=1;case 1:return r.trys.push([1,3,,4]),i.muted=!0,[4,i.play()];case 2:return r.sent(),i.pause(),[2,!0];case 3:return r.sent(),[2,!1];case 4:return[2]}}))}))},aq=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this._failedAudioList=[],this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],this.id="AudioMixingManager",this._context=e,this._localGainNode.gain.value=1}return e.prototype.mixMediaStream=function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)},e.prototype.startAudioMixing=function(e,t,i){return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,f,_,v,m=this;return iv(this,(function(y){switch(y.label){case 0:if(r=i.playCount,ej(n=i.type,"mixingType",rq(cG)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=kH(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_STOPPED,error:XB.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,4]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw m._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_FAILED,error:XB.AUDIO_MIXING_ERROR_START_FAILED}),new JB(qB.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:return d=y.sent(),l=void 0,t.endsWith("mp3")?l={type:"audio/mpeg"}:t.endsWith("aac")&&(l={type:"audio/aac"}),[4,oq(d,l)];case 3:if(!y.sent())throw this._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_FAILED,error:XB.AUDIO_MIXING_ERROR_START_FAILED}),new JB(qB.LOAD_RESOURCES_FAILED,"invalid audio resource");(c=new Audio).crossOrigin="anonymous",c.src=URL.createObjectURL(new Blob([d],l)),y.label=4;case 4:r<=0?c.loop=!0:r>0&&(h=r,c.onended=function(){--h>0?c.play():(m.mixingMap.delete(e),m._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_FINISHED,error:XB.AUDIO_MIXING_ERROR_OK}))}),y.label=5;case 5:return y.trys.push([5,7,,8]),[4,c.play()];case 6:return y.sent(),[3,8];case 7:return p=y.sent(),console.error(p),this._failedAudioList.push(c),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:YM.STREAM_INDEX_MAIN,mediaType:JM.AUDIO}),[3,8];case 8:if(f=this._sharedAudioContext.createMediaElementSource(c),_=this._sharedAudioContext.createGain(),v=this.volumeConfig.get(e),_.gain.value=v?v/100:1,f.connect(_).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:f,audioNode:c,gainNode:_,type:"file"}),n===cG.PUBLISH)try{_.disconnect(this._sharedAudioContext.destination)}catch(e){}else _.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],i.type),this._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_PLAYING,error:XB.AUDIO_MIXING_ERROR_OK}),[2]}}))}))},e.prototype.stopAudioMixing=function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_STOPPED,error:XB.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_PAUSED,error:XB.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())},e.prototype.resumeAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_PLAYING,error:XB.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return tv(this,void 0,void 0,(function(){var i,r=this;return iv(this,(function(n){switch(n.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw r._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_FAILED,error:XB.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new JB(qB.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(t){throw r._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_FAILED,error:XB.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new JB(qB.LOAD_RESOURCES_FAILED,"Load resources failed",t)}))];case 1:return i=n.sent(),[4,oq(i)];case 2:if(!n.sent())throw this._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_FAILED,error:XB.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new JB(qB.LOAD_RESOURCES_FAILED,"Load resources failed");return this._context.emitMessage({mixId:e,state:uG.AUDIO_MIXING_STATE_PRELOADED,error:XB.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([i])))},filePath:t}),[2]}}))}))},e.prototype.unloadAudioMixing=function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)},e.prototype.getAudioMixingVolume=function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0},e.prototype.setAudioMixingVolume=function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var i=this.mixingMap.get(e);i&&(i.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),i=this.mixingMap.get(e);return t||i?t?1e3*t.audioNode.duration:i?1e3*i.audioNode.duration:0:0},e.prototype.getAudioMixingCurrentPosition=function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0},e.prototype.setAudioMixingPosition=function(e,t){var i=this.mixingMap.get(e);i&&(i.audioNode.currentTime=t/1e3,i.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){ej(e,"type",rq(cG));var t=this._context.getLocalAudioTrack();if(t){var i=kH(t.getTrack());if(i&&this.mixMediaStream(i),e===cG.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:uG.AUDIO_MIXING_STATE_PCM_ENABLED,error:XB.AUDIO_MIXING_ERROR_OK})}},e.prototype.disableAudioMixingBuffer=function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:uG.AUDIO_MIXING_STATE_PCM_DISABLED,error:XB.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(e){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var i=t.cachedBuffer.shift();i&&t.pushAudioMixingBuffer(i)}}}},e.prototype.stopAll=function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,i){e.stopAudioMixing(i)}))},Object.defineProperty(e.prototype,"mixTrack",{get:function(){return this._audioDestination.stream.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sharedAudioContext",{get:function(){return this._sharedAudioContext},enumerable:!1,configurable:!0}),e.prototype.resumeLocalPlay=function(){return tv(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:e=[],c.label=1;case 1:c.trys.push([1,10,11,12]),t=rv(this._failedAudioList),i=t.next(),c.label=2;case 2:if(i.done)return[3,9];r=i.value,c.label=3;case 3:return c.trys.push([3,7,,8]),r instanceof HTMLAudioElement?(r.muted=!1,[4,r.play()]):[3,5];case 4:return c.sent(),[3,6];case 5:r.start(),c.label=6;case 6:return[3,8];case 7:return n=c.sent(),e.push(r),console.error(n),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:YM.STREAM_INDEX_MAIN,mediaType:JM.AUDIO}),[3,9];case 8:return i=t.next(),[3,2];case 9:return[3,12];case 10:return o=c.sent(),a={error:o},[3,12];case 11:try{i&&!i.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 12:return this._failedAudioList=e,[2]}}))}))},e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},ev([aB("default","id","filePath","options")],e.prototype,"startAudioMixing",null),ev([aB("default","id")],e.prototype,"stopAudioMixing",null),ev([aB("default","id")],e.prototype,"pauseAudioMixing",null),ev([aB("default","id")],e.prototype,"resumeAudioMixing",null),ev([aB("default","id")],e.prototype,"preloadAudioMixing",null),ev([aB("default","id")],e.prototype,"unloadAudioMixing",null),ev([aB("default","id")],e.prototype,"getAudioMixingVolume",null),ev([aB("default","id","volume")],e.prototype,"setAudioMixingVolume",null),ev([aB("default","id")],e.prototype,"getAudioMixingDuration",null),ev([aB("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),ev([aB("default","id","position")],e.prototype,"setAudioMixingPosition",null),ev([aB("default","type")],e.prototype,"enableAudioMixingBuffer",null),ev([aB()],e.prototype,"disableAudioMixingBuffer",null),ev([aB("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(nq||(nq={}));var sq=new qF("RTMClient",1),cq=function(e){function t(t,i){var r=e.call(this)||this;return r._appId=t,r._ctx=i,r._dataChannelSignal=null,r._handler=null,r._dataChannelSignalState=Zz.DISCONNECTED,r._loginSessionId=null,r._userId=null,r._token=null,r._isReconnecting=!1,r._reconnectTimer=null,r._loginResolveCallback=null,r._loginRejectCallback=null,r._iceConfigNode=null,r._wait_login_token=!1,r}return Z_(t,e),t.prototype.login=function(e,t){var i=this;return new Promise((function(r,n){if(sq.print("login","invoke login, token: %o, userId: %o",e,t),i._loginSessionId)throw new JB(qB.ALREADY_LOGIN,"Already logined");if(i._loginResolveCallback)throw new JB(qB.LOGIN_FAILED,"Is logging in, please try again later.");i._userId=t,i._token=e,rB.setStats({rtc_app_id:i._appId,user_id:t}),i._loginResolveCallback=r,i._loginRejectCallback=n,i._dataChannelSignal?i._login():(sq.print("login","init dataChannelSingling"),i._dataChannelSignalState=Zz.CONNECTING,i._createDataChannelSignaling(t).then((function(e){i._dataChannelSignal=e,i._login()})).catch((function(){i._onDisconnect()})))}))},t.prototype.logout=function(){var e;return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new JB(qB.NOT_LOGIN,"login first");return[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:Fj.C2RTM}).catch((function(){}))];case 1:return t.sent(),this._closeDataChannelSignaling(),this._clearState(),[2]}}))}))},t.prototype.updateLoginToken=function(e){return tv(this,void 0,void 0,(function(){var t=this;return iv(this,(function(i){return this._token=e,[2,new Promise((function(e,i){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=i,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new JB(qB.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:Fj.C2RTM})];case 1:return[2,null==(t=i.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){if(!this._loginSessionId||!this._userId)throw new JB(qB.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})]}))}))},t.prototype.setServerParams=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new JB(qB.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:e,url:t},{functionType:Fj.C2RTM})];case 1:return i.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){if(!this._loginSessionId||!this._userId)throw new JB(qB.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:Lj.BUSINESS_SERVER,msg:e})]}))}))},t.prototype.destroy=function(){this._clearState(),this._closeDataChannelSignaling(),e.prototype.removeAllListeners.call(this)},t.prototype._login=function(){var e=this;if(this._userId){var t=HL();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:qL.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:jV.VERSION,deviceId:xV.getDeviceId(),appId:this._appId,userId:this._userId},accessParams:JSON.stringify({requireICEUfragV2:!0})},{functionType:Fj.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var i,r,n=t||{},o=n.code,a=n.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(i=qB.INVALID_PARAMS,r="Invalid userId"):(i=qB.INVALID_TOKEN,r="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(i=qB.LOGIN_FAILED,r="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new JB(i,a||r))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return iv(this,(function(d){switch(d.label){case 0:if(r=new Kj,n=this._iceConfigNode)return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,null==r?void 0:r.getAccessNode(this._appId,"",e,xV.getDeviceId(),"")];case 2:if(o=d.sent(),!(n=o[0]))throw new Error;return[3,4];case 3:throw d.sent(),cB("rtm.login.getNodeFailed","",0,!0),new JB(qB.ICE_SERVER_WRONG,"get ICE config failed");case 4:cB("rtm.login.getNodeSuccess",n,0,!0),sq.print("_createDataChannelSignaling()","get node success",n),this._handler=Xz(eB,this._ctx),null===(t=this._handler)||void 0===t||t.once("disconnect",(function(){sq.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),d.label=5;case 5:return d.trys.push([5,7,,8]),[4,null===(i=this._handler)||void 0===i?void 0:i.connect(n)];case 6:return a=d.sent(),sq.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=Zz.CONNECTED,[3,8];case 7:throw s=d.sent(),this._iceConfigNode=null,this._dataChannelSignalState=Zz.DISCONNECTED,new JB(qB.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 8:return c=new Gj(a),sq.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){sq.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(Oj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(Oj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(Oj.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(Oj.NODE_CHANGE,(function(e){cB("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),[2,c]}}))}))},t.prototype._closeDataChannelSignaling=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null},t.prototype._checkDataChannelSignal=function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==Zz.CONNECTED)throw new JB(qB.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=Zz.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._reconnect=function(){var e=this;!this._isReconnecting&&this._userId&&(sq.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){sq.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){sq.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))},t.prototype._clearState=function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)},t}(JV.exports.EventEmitter),uq=function(e){function t(t,i){var r=e.call(this)||this;return r._appId=t,r.remoteStreams=new Map,r.remoteStreamsStats=new Map,r._context=i,r}return Z_(t,e),t.prototype.connect=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new rK(this._context),this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new JB(qB.REPEAT_PLAY,"repeat play public media stream");return(t=new Iz(e,e,!1,!0,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var r=function(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var i={seiCount:0,seis:[]},r=!1,n=2;n<t.byteLength;){var o=t.getUint16(n);if(n+=2,t.byteLength-n<o){r=!0;break}var a=new Uint8Array(e.buffer,n,o);if(n+=o,t.byteLength-n>0&&t.byteLength-n<=2){r=!0;break}i.seiCount++,i.seis.push(a)}return r&&(i.seiCount=1,i.seis=[e]),i}(e),n=0;n<r.seiCount;n++)i.emit(sz.ON_SEI_MESSAGED_RECEIVED,{sei:r.seis[n],publicStreamId:t.streamId})})),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return r.sent(),this.remoteStreams.set(e,t),this.remoteStreamsStats.set(e,{decodeFailedCount:0}),[2,t]}}))}))},t.prototype.stopPlayPublicStream=function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)},t.prototype.destroy=function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()},t.prototype._handleReconnected=function(){return tv(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s,c=this;return iv(this,(function(u){clearTimeout(this._reconnectTimer),e=function(e){t.remoteStreams.delete(e),t.startPlayPublicStream(e).then((function(){var t=c.remoteStreams.get(e);c.safeEmit(sz.RESUBSCRIBE,{stream:t})}))},t=this;try{for(i=rv(this.remoteStreams),r=i.next();!r.done;r=i.next())n=nv(r.value,1),o=n[0],e(o)}catch(e){a={error:e}}finally{try{r&&!r.done&&(s=i.return)&&s.call(i)}finally{if(a)throw a.error}}return[2]}))}))},t.prototype._reconnect=function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)},t.prototype._bindEvents=function(){var e,t,i=this;null===(e=this._mediaServerClient)||void 0===e||e.on(kj.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){if(i.emit("onRemoteStreamStats",e),e.videoStats&&e.receivedKBitrate&&e.receivedFrameRate&&!e.decoderOutputFrameRate){var t=i.remoteStreamsStats.get(e.publicStreamId);t&&(t.decodeFailedCount+=1,3===t.decodeFailedCount&&i.emit("streamDecodeFailed",{publicStreamId:e.publicStreamId}))}}))},t}(JF),dq=new qF("AudioDeviceManager",1),lq=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return Z_(t,e),t.prototype.startAudioPlaybackDeviceTest=function(e,t){return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:if(this._isAudioPlaybackDeviceTesting||this._isAudioDeviceRecordTesting)throw new JB(qB.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,dq.print("startAudioPlaybackDeviceTest()","Invoke"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._playAudioFile(e,{loop:!0})];case 2:return r.sent(),[3,4];case 3:throw i=r.sent(),this.stopAudioPlaybackDeviceTest(),i;case 4:return this._startEmitAudioPlaybackDeviceTestVolume(t),[2]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){this._isAudioPlaybackDeviceTesting&&(dq.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.startAudioDeviceRecordTest=function(e){return tv(this,void 0,void 0,(function(){var t=this;return iv(this,(function(i){switch(i.label){case 0:if(!window.MediaRecorder)throw new JB(qB.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");if(this._isAudioDeviceRecordTesting)throw new JB(qB.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,dq.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){dq.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),t._stopAudioCaptureAndRecoder()}),3e4),[4,this._startAudioCaptureAndRecoder(e)];case 1:return i.sent(),delete this._audioCaptureAndRecoderResolve,[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){dq.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(dq.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){dq.print("destroy()","Invoke"),e.prototype.removeAllListeners.call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()},t.prototype._playAudioFile=function(e,t){var i=this;return new Promise((function(r,n){i._audioElement=bK("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),i._audioElement.loop=t.loop,dq.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),i._audioElement.oncanplay=function(){dq.print("_playAudioFile()","oncanplay"),r()},i._audioElement.onerror=function(e){var t,r;n(new JB(qB.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(r=null===(t=i._audioElement)||void 0===t?void 0:t.error)||void 0===r?void 0:r.message))))}}))},t.prototype._destroyAudioElement=function(){this._audioElement&&(dq.print("_destroyAudioElement()","Invoke"),this._audioElement.src="",delete this._audioElement,this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())},t.prototype._startEmitAudioPlaybackDeviceTestVolume=function(e){var t=this;e=Math.max(e,100),this._audioElement&&(dq.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new fL(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))},t.prototype._stopEmitAudioPlaybackDeviceTestVolume=function(){var e;void 0!==this._playbackDeviceTestTimer&&(dq.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher},t.prototype._startAudioCaptureAndRecoder=function(e){return tv(this,void 0,void 0,(function(){var t,i,r=this;return iv(this,(function(n){switch(n.label){case 0:return t=this,[4,qH({})];case 1:return t._audioTrack=n.sent(),i=kH(this._audioTrack.getTrack()),dq.print("startAudioDeviceRecordTest()","create microphone track success!"),[2,new Promise((function(t,n){r._mediaRecorder=new MediaRecorder(i),r._mediaRecorder.ondataavailable=function(i){return tv(r,void 0,void 0,(function(){var r,o,a,s=this;return iv(this,(function(c){switch(c.label){case 0:if(!this._isAudioDeviceRecordTesting)return[3,5];dq.print("startAudioDeviceRecordTest()","get recorded file."),r=new Blob([i.data]),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._playAudioFile(URL.createObjectURL(r),{loop:!1})];case 2:return c.sent(),[3,4];case 3:return o=c.sent(),[2,n(o)];case 4:return this._startEmitAudioPlaybackDeviceTestVolume(e),null===(a=this._audioElement)||void 0===a||a.addEventListener("ended",(function(){s.stopAudioDevicePlayTest(),t()})),this._audioCaptureAndRecoderResolve=t,[3,6];case 5:t(),c.label=6;case 6:return[2]}}))}))},r._mediaRecorder.onerror=function(e){n(new JB(qB.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},r._mediaRecorder.start()}))]}}))}))},t.prototype._stopAudioCaptureAndRecoder=function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack},t}(JV.exports.EventEmitter),hq=function(){function e(){this.engineBAC={},this.engineANM={},this._init()}return e.prototype._init=function(){return tv(this,void 0,void 0,(function(){var e,t;return iv(this,(function(i){switch(i.label){case 0:return e=new Wj,t=this,[4,e.getAudioProfile()];case 1:return t.engineBAC=i.sent(),[2]}}))}))},e.prototype.updateEngineBAC=function(e){e&&(this.engineBAC={codec:this.engineBAC.codec,play:$_($_({},this.engineBAC.play),e.play),record:$_($_({},this.engineBAC.record),e.record)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))},e.prototype.updateEngineANM=function(e){e&&(this.engineANM={bitrate:e.enc_param.bitrate,channel:e.enc_param.chn})},e.prototype.setAudioProfile=function(e){var t,i,r;switch(e){case uL.fluent:i=16e3,t=24e3;break;case uL.standard:i=48e3,t=48e3;break;case uL.hd:i=48e3,t=128e3,r=2;break;case uL.standardStereo:i=48e3,t=8e4,r=2;break;case uL.hdMono:i=48e3,t=128e3}t&&(this.bitrate=t),r&&(this.channel=r),i&&(this.sampleRate=i)},e.prototype.setBitrate=function(e){e>128e3&&(e=128e3),this.bitrate=e},e.prototype.setAEC=function(e){this.aec=e},e.prototype.setAGC=function(e){this.agc=e},e.prototype.setANS=function(e){this.ans=e},e.prototype.getOpusConfigStr=function(){var e,t,i=";";return this.bitrate&&(i+="maxaveragebitrate=".concat(this.bitrate,";")),(this.sampleRate||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.sr))&&(i+="maxplaybackrate=".concat(this.sampleRate||this.engineBAC.record.sr,";sprop-maxcapturerate=").concat(this.sampleRate||this.engineBAC.record.sr,";")),((this.channel||1)>1||(null===(t=this.engineBAC.record)||void 0===t?void 0:t.chn)>1)&&(i+="stereo=1;sprop-stereo=1;"),i.slice(0,-1)},Object.defineProperty(e.prototype,"config",{get:function(){var e,t,i;return{bitrate:this.bitrate||this.engineANM.bitrate,channel:this.channel||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.chn)||(null===(t=this.engineANM)||void 0===t?void 0:t.chn)||1,aec:!!this.aec,agc:!!this.agc,ans:!!this.ans,sampleRate:this.sampleRate||(null===(i=this.engineBAC.record)||void 0===i?void 0:i.sr)}},enumerable:!1,configurable:!0}),e}(),pq=new WeakMap,fq=function(e,t,i){if(requestAnimationFrame){var r=pq.get(e);(null==r?void 0:r[t])?_q(e,t):r||(r={},pq.set(e,r));var n=e[t];!function o(){var a=requestAnimationFrame(o);r[t]=a;var s=e[t];n!==s&&(n=s,i(s))}()}},_q=function(e,t){var i=pq.get(e);t&&i[t]?cancelAnimationFrame(i[t]):Object.keys(i).length&&Object.keys(i).forEach((function(e){cancelAnimationFrame(i[e])}))},vq=new qF("Engine",0),mq=function(e){function t(t,i){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._remoteScreenAudioPlayer=new Map,r._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._enableSimulcast=!1,r._videoStreamEncodeConfig=[XV],r._screenStreamEncodeConfig=[YV],r._tipDomList=[],r._pauseAllSubscribeState={audio:void 0,video:void 0},r._audioPropertiesReportTimer=null,r._localAudioNoInputCount=0,r._mirrorType=$M.MIRROR_TYPE_RENDER,r._audioDeviceManager=new lq,r._audioProfileManager=new hq,r._remoteVideoConfig=new Map,r._userPriorityMap=new Map,r._subscribeFallbackOption=nL.DISABLE,r._singleStreamRender=!0,r._prevLocalVideoSize={height:0,width:0},r.resubedUserId=new Set,r._videoCaptureStallCount=0,r._vStats="-V",r._aStats="-A",r.audioPlayerUseWebAudio=!1,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=cG.PLAYOUT_AND_PUBLISH),tv(r,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:return vq.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(i=this._room)||void 0===i?void 0:i.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(ND.onAudioMixingStateChanged,e)},r._onAudioMixingAutoplayFailed=function(e){r.safeEmit(ND.onAutoplayFailed,e)},r._appId=t,r._pubLock=new Qz("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new aq({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=r,r._engine_number=Math.floor(100*Math.random()+1),window["__rtc_engine__".concat(r._engine_number)]=r,r._trackSourceType={video:BM.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:BM.VIDEO_SOURCE_TYPE_INTERNAL,audio:jM.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:jM.AUDIO_SOURCE_TYPE_INTERNAL},r._config=i,r._rtmClient=new cq(t,{audioProfileManager:r._audioProfileManager,enableFallbackHandler:Sq(t),enableStandardHandler:Eq(t),pcKillSwitch:$_({ctor_sdpsemantics_add:!0,ctor_encodedinsetablestream_add:!0,sld_rtcpfb_rrtr_add:!0,sld_ext_sdesmid_remove:!0,sld_fmtp_sps_add:!0,sld_fmtp_bitrate_add:!0,sld_fmtp_opus_add:!0},gq(t))}),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new MK,location.search.includes("_use_web_audio_")&&(r.audioPlayerUseWebAudio=!0),(new Wj).getWebRtcConfig({appId:r.appId,deviceId:xV.getDeviceId()}).finally((function(){r.emit("__onGetServerConfigFinishHook")})),r}return Z_(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n,o,a,s;return iv(this,(function(c){switch(c.label){case 0:return vq.print("updateToken()","token: %s",e),$B(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(n=null===(i=this._room)||void 0===i?void 0:i._roomInfo,o=n.roomId,a=n.userInfo,s=this._tempRoomConfig,delete this._tempRoomConfig,[4,this.joinRoom(e,o,a,s)]):[3,2];case 1:return[2,c.sent()];case 2:if(!this._room)throw new JB(qB.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(r=this._room)||void 0===r?void 0:r.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.setVideoCaptureDevice=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:return vq.print("setVideoCaptureDevice()","deviceId: %s",e),$B(e,"deviceId"),this._localVideoTrack?tU&&iU&&(r=null===(i=null===(t=this._localVideoTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.getSettings())&&r.deviceId===e?[2,Promise.resolve()]:(n=this._videoStreamConstraints,"user"===e||"environment"===e||"left"===e||"right"===e?(delete n.deviceId,n.facingMode=e):!oU||eU?n.deviceId={exact:e}:delete n.deviceId,this._videoStreamConstraints=n,[4,WH(n)]):(this._localVideoDeviceId=e,[2,Promise.resolve()]);case 1:return o=a.sent(),this._initLocalTrackEvents(o),this._localVideoTrack.close(),this._localVideoTrack=o,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(o),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))},t.prototype.setAudioCaptureDevice=function(e){return tv(this,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:return vq.print("setAudioCaptureDevice()","deviceId: %s",e),$B(e,"deviceId"),this._localAudioTrack?((t=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=t,this._localAudioTrack.close(),[4,qH(t,this._audioProfileManager)]):(this._localAudioDeviceId=e,[2,Promise.resolve()]);case 1:return i=r.sent(),this._initLocalTrackEvents(i),this._localAudioTrack=i,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){CH.on(ND.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),CH.on(ND.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O=this;null===(e=this._room)||void 0===e||e.on(Oj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(Oj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._room)||void 0===i||i.on(Oj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._room)||void 0===r||r.on(sz.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(sz.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(sz.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(Oj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(Oj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(Oj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(Oj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(Oj.POST_PROCESSING_MESSAGE,(function(e){!function(e){return"2.0"===e.protocol}(e)?"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e):O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message})})),null===(l=this._room)||void 0===l||l.on(kj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(sz.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(sz.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(sz.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(sz.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(sz.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=O._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&O.safeEmit(ND.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(sz.ON_REMOTE_STREAM_STATS,(function(e){O._checkRemoteStats(e),O.safeEmit(ND.onRemoteStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(sz.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(ND.onLocalStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(sz.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(S=this._room)||void 0===S||S.on(sz.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ND.onUserStartAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(sz.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ND.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(sz.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ND.onUserStartVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(sz.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ND.onUserStopVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(sz.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(ND.onSEIMessageReceived,e)})),null===(A=this._room)||void 0===A||A.on(sz.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(ND.onRemoteVideoSizeChanged,e,t)})),null===(R=this._room)||void 0===R||R.on(sz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(ND.onSimulcastSubscribeFallback,e)})),null===(C=this._room)||void 0===C||C.on(sz.RECONNECT_FAILED,(function(){O.safeEmit(ND.onError,{errorCode:qB.RECONNECT_FAILED})}))},t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];return cj(t)&&sB(t,uU(i)),e.prototype.safeEmit.apply(this,ov([t],nv(i),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,i,r){return void 0===r&&(r={}),tv(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h;return iv(this,(function(p){switch(p.label){case 0:if(location.search.includes("__rtc_debug_2__")){try{for(n=rv(Object.keys(localStorage)),o=n.next();!o.done;o=n.next())(a=o.value).startsWith("RTC_ACCESS")&&localStorage.removeItem(a)}catch(e){l={error:e}}finally{try{o&&!o.done&&(h=n.return)&&h.call(n)}finally{if(l)throw l.error}}e=null}if(vq.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,i,r),rj(e)||$B(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new JB(qB.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){tj(e,"userInfo"),nj(e.userId),rj(e.extraInfo)||$B(e.extraInfo,"userInfo.extraInfo",1,200)}(i),s={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:cL.communication},tq(s,r),function(e){tj(e,"roomConfig"),QB(e.isAutoPublish,"roomConfig.isAutoPublish"),QB(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),QB(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(s),$F.rtcSdkApiCall("host",0,location.host),!this._room||this._room.connectionState===Zz.DISCONNECTED)return[3,1];throw new JB(qB.REPEAT_JOIN,"Already joined");case 1:this._room=new SK(s,{audioProfileManager:this._audioProfileManager,enableFallbackHandler:Sq(this.appId),enableStandardHandler:Eq(this.appId),pcKillSwitch:$_($_({ctor_sdpsemantics_add:!0,ctor_encodedinsetablestream_add:!0,sld_rtcpfb_rrtr_add:!0,sld_ext_sdesmid_remove:!0,sld_fmtp_sps_add:!0,sld_fmtp_bitrate_add:!0,sld_fmtp_opus_add:!0},HV("PC_KILLSWITCH")),gq(this._appId))}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),c=this._liveTranscodeConfig&&zV("started",this._liveTranscodeConfig),p.label=2;case 2:return p.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,$_($_({},i),{businessId:this._businessId,role:this._visibility?nq.NORMAL_USER:nq.SILENT_USER}),c,this._useCloudProxy)];case 3:return u=p.sent(),this._roomConfig=s,this._tempRoomConfig&&delete this._tempRoomConfig,(null==s?void 0:s.isAutoPublish)&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:JM.AUDIO_AND_VIDEO}):this.safeEmit(ND.onAutoPublishResult,{isScreen:!1,state:WM.PUBLISH_FAIL})),[2,u];case 4:throw(d=p.sent()).code===qB.INVALID_TOKEN&&(this._tempRoomConfig=s),d;case 5:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,i;return void 0===e&&(e=!1),tv(this,void 0,void 0,(function(){return iv(this,(function(r){switch(r.label){case 0:return vq.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return r.sent(),[3,3];case 2:null===(i=this._room)||void 0===i||i.leave(e).catch(),r.label=3;case 3:return this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map,[2]}}))}))},t.prototype.destroy=function(){var e,t,i;vq.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),this._videoPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[XV],this._screenStreamEncodeConfig=[YV],this._pauseAllSubscribeState={audio:void 0,video:void 0},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(i=this._outsideRoom)||void 0===i||i.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear(),delete window["__rtc_engine__".concat(this._engine_number)]},t.prototype.publishStream=function(e){return tv(this,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:try{t=e!==JM.AUDIO,i=e!==JM.VIDEO,this._vStats=t?"+V":this._vStats,this._aStats=i?"+A":this._aStats}catch(e){}return vq.print("publishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),fU(e)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(n=this._localImgVideoTrack,new FH(n,HL())),this._localVideoTrack.dummy=!0),[4,this._updatePublish({mediaType:e})];case 1:return r.sent(),[2]}var n}))}))},t.prototype.unpublishStream=function(e){return tv(this,void 0,void 0,(function(){var t,i;return iv(this,(function(r){switch(r.label){case 0:try{t=e!==JM.AUDIO,i=e!==JM.VIDEO,this._vStats=t?"-V":this._vStats,this._aStats=i?"-A":this._aStats}catch(e){}return vq.print("unpublishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updatePublish({mediaType:e,pubState:dz.UNPUB})];case 1:return r.sent(),[2]}}))}))},t.prototype.publishScreen=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:vq.print("publishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),i.label=1;case 1:return i.trys.push([1,3,,4]),fU(e)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(r=this._localImgScreenTrack,new BH(r,HL())),this._localScreenVideoTrack.dummy=!0),[4,this._updateScreenPublish({mediaType:e,pubState:dz.PUB})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof JB?t:new JB(qB.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}var r}))}))},t.prototype.unpublishScreen=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return vq.print("unpublishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updateScreenPublish({mediaType:e,pubState:dz.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.subscribeStream=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return vq.print("subscribeStream()","userId: %o, mediaType: %o",e,t),[2,this._subscribe(!1,e,t)]}))}))},t.prototype._subscribe=function(e,t,i){var r,n,o,a,s;return tv(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_,v;return iv(this,(function(m){switch(m.label){case 0:if(this._checkMediaType(i),this._assertNotInRoom(),c=this._room.remoteStreams.get(t),!(u=null==c?void 0:c.find((function(t){return t.isScreen===e}))))throw new JB(qB.STREAM_NOT_EXIST,"stream not exist");return d=this._pauseAllSubscribeState.audio,l=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(i-=i&JM.AUDIO),this._pauseAllSubscribeState.video&&(i-=i&JM.VIDEO),vq.print("subscribeStream()","due to pauseAll mediaType: %o",i),h=u.hasSubscribed,p=this._remoteVideoConfig.get(t)||(null===(r=this._roomConfig)||void 0===r?void 0:r.remoteVideoConfig),u.originalMediaType=i,[4,this._room.subscribe(u,i,p)];case 1:return m.sent(),pU(i)&&this._updateAudioPlayerState(u),fU(i)&&this._updateVideoPlayerState(u),f=0,_=0,d!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?f|=JM.AUDIO:_|=JM.AUDIO),l!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?f|=JM.VIDEO:_|=JM.VIDEO),f&&this.pauseAllSubscribedStream(f),_&&this.resumeAllSubscribedStream(_),e||!(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)&&!(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo)||(u.audioTrack||u.videoTrack)&&(v={userId:t,isScreen:!1,state:KM.SUBSCRIBE_SUCC},this.safeEmit(ND.onAutoSubscribeResult,v)),!h&&pU(i)&&(null===(a=u.observer)||void 0===a||a.setSubscribeAudio(!0)),!h&&fU(i)&&(null===(s=u.observer)||void 0===s||s.setSubscribeVideo(!0)),[2]}}))}))},t.prototype.unsubscribeStream=function(e,t){return tv(this,void 0,void 0,(function(){var i,r;return iv(this,(function(n){if(vq.print("unsubscribeStream()","userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return!e.isScreen})))?void 0:r.hasSubscribed))throw new JB(qB.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.subscribeScreen=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return vq.print("subscribeScreen() userId: %o, mediaType: %o",e,t),[2,this._subscribe(!0,e,t)]}))}))},t.prototype.unsubscribeScreen=function(e,t){return tv(this,void 0,void 0,(function(){var i,r;return iv(this,(function(n){if(vq.print("unsubscribeScreen() userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return e.isScreen})))?void 0:r.hasSubscribed))throw new JB(qB.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.setRemoteVideoConfig=function(e,t){var i;return tv(this,void 0,void 0,(function(){return iv(this,(function(r){return vq.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",e,t),nj(e),function(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new JB(qB.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}(t),this._remoteVideoConfig.set(e,t),[2,null===(i=this._room)||void 0===i?void 0:i.updateSubVideoConfig(e,t).then((function(){}))]}))}))},t.prototype.startVideoAndAudioCapture=function(e,t){var i,r,n,o,a,s,c;return tv(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,y=this;return iv(this,(function(g){switch(g.label){case 0:if(vq.print("startVideoCapture()","deviceId: %s",e),vq.print("startAudioCapture()","deviceId: %s",t),rj(e)||$B(e,"videoDeviceId"),rj(t)||$B(t,"audioDeviceId"),e=e||this._localVideoDeviceId,t=t||this._localAudioDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new JB(qB.REPEAT_CAPTURE,"Has already capture");if(this._localAudioTrack)throw new JB(qB.REPEAT_CAPTURE,"Has already capture");return u=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?(delete u.deviceId,u.facingMode=e):!oU||eU?u.deviceId={exact:e}:delete u.deviceId,this._videoStreamConstraints=u),d=this._audioStreamConstraints,t&&(oU&&!eU||(d.deviceId={exact:t}),this._audioStreamConstraints=d),$F.rtcInvokeStatus("createCameraAndMicrophoneTrack start",0,"startVideoAndAudioCapture","",0),[4,KH(u,d,this._audioProfileManager)];case 1:return l=g.sent(),h=l.videoTrack,p=l.audioTrack,$F.rtcInvokeStatus("createCameraAndMicrophoneTrack finish",0,"startVideoAndAudioCapture","",0),(null===(i=this._videoStreamEncodeConfig[0])||void 0===i?void 0:i.contentHint)&&h.setContentHint(null===(r=this._videoStreamEncodeConfig[0])||void 0===r?void 0:r.contentHint),this._initLocalTrackEvents(h),this._localVideoTrack=h,null===(n=this._videoPlayer)||void 0===n||n.playVideo(h),(f=null==h?void 0:h.getTrack())&&(_=f.getSettings(),v={width:_.width,height:_.height},this._localVideoTrack.resolution=v,this.autoResetVideoEncoderConfig(_),setTimeout((function(){return y.safeEmit(ND.onLocalVideoSizeChanged,{streamIndex:YM.STREAM_INDEX_MAIN,info:v})}))),this._initLocalTrackEvents(p),this._localAudioTrack=p,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(m=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||m)&&(this._visibility?this._updatePublish():this.safeEmit(ND.onAutoPublishResult,{isScreen:!1,state:WM.PUBLISH_FAIL})),null===(a=null===(o=this._room.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!0),null===(c=null===(s=this._room.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.startVideoCapture=function(e){var t,i,r,n,o;return tv(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return iv(this,(function(p){switch(p.label){case 0:if(vq.print("startVideoCapture()","deviceId: %s",e),rj(e)||$B(e,"deviceId"),e=e||this._localVideoDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new JB(qB.REPEAT_CAPTURE,"Has already capture");return a=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?(delete a.deviceId,a.facingMode=e):!oU||eU?a.deviceId={exact:e}:delete a.deviceId,this._videoStreamConstraints=a),[4,WH(a)];case 1:return s=p.sent(),window.location.search.includes("_pub_canvas_")&&(vq.print("startVideoCapture()","use canvas track in iOS"),s=new zH(s.getTrack(),HL())),(null===(t=this._videoStreamEncodeConfig[0])||void 0===t?void 0:t.contentHint)&&s.setContentHint(null===(i=this._videoStreamEncodeConfig[0])||void 0===i?void 0:i.contentHint),this._initLocalTrackEvents(s),this._localVideoTrack=s,null===(r=this._videoPlayer)||void 0===r||r.playVideo(s),c={},(u=null==s?void 0:s.getTrack())&&(c=u.getSettings(),d={width:c.width,height:c.height},this._localVideoTrack.resolution=d,this.autoResetVideoEncoderConfig(c),setTimeout((function(){return h.safeEmit(ND.onLocalVideoSizeChanged,{streamIndex:YM.STREAM_INDEX_MAIN,info:d})}))),this._room?(l=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||l)&&(this._visibility?this._updatePublish():this.safeEmit(ND.onAutoPublishResult,{isScreen:!1,state:WM.PUBLISH_FAIL})),null===(o=null===(n=this._room.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableVideo(!0),[2,c]):[2,c]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,i,r,n;return tv(this,void 0,void 0,(function(){return iv(this,(function(o){switch(o.label){case 0:if(vq.print("stopVideoCapture()"),this._trackSourceType.video===BM.VIDEO_SOURCE_TYPE_EXTERNAL)throw new JB(qB.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return null===(e=this._videoPlayer)||void 0===e||e.stop(),null===(t=this._localVideoTrack)||void 0===t||t.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(i=this._localVideoTrack)||void 0===i||i.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:o.sent(),o.label=2;case 2:return null===(n=null===(r=this._room.localStream)||void 0===r?void 0:r.observer)||void 0===n||n.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,i;return tv(this,void 0,void 0,(function(){var r,n,o;return iv(this,(function(a){switch(a.label){case 0:if(vq.print("startAudioCapture()","deviceId: $o",e),rj(e)||$B(e,"deviceId"),e=e||this._localAudioDeviceId,this._localAudioTrack)throw new JB(qB.REPEAT_CAPTURE,"Has already capture");return r=this._audioStreamConstraints,e&&(r.deviceId={exact:e},this._audioStreamConstraints=r),[4,qH(r,this._audioProfileManager)];case 1:return n=a.sent(),this._initLocalTrackEvents(n),this._localAudioTrack=n,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(ND.onAutoPublishResult,{isScreen:!1,state:WM.PUBLISH_FAIL})),null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.stopAudioCapture=function(){var e,t,i;return tv(this,void 0,void 0,(function(){return iv(this,(function(r){switch(r.label){case 0:if(vq.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===jM.AUDIO_SOURCE_TYPE_EXTERNAL)throw new JB(qB.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:r.sent(),r.label=2;case 2:return null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return vq.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,i,r,n,o,a,s;return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_=this;return iv(this,(function(v){switch(v.label){case 0:if(vq.print("startScreenCapture()","config: %o",e),(null===(t=this._localScreenVideoTrack)||void 0===t?void 0:t.dummy)||null===(i=this._localScreenVideoTrack)||void 0===i||i.close(),this._localScreenVideoTrack=void 0,c=e.enableAudio,u=void 0!==c&&c,this._trackSourceType.screenVideo===BM.VIDEO_SOURCE_TYPE_EXTERNAL)throw new JB(qB.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===jM.AUDIO_SOURCE_TYPE_EXTERNAL)throw new JB(qB.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,XH(u,this._screenStreamEncodeConfig[0])];case 1:return d=v.sent(),this._localScreenVideoTrack=new BH(d.getVideoTracks()[0],HL()),(null===(r=this._screenStreamEncodeConfig[0])||void 0===r?void 0:r.contentHint)&&this._localScreenVideoTrack.setContentHint(null===(n=this._screenStreamEncodeConfig[0])||void 0===n?void 0:n.contentHint),(l=null===(o=this._localScreenVideoTrack)||void 0===o?void 0:o.getTrack())&&(h=l.getSettings(),p={width:h.width,height:h.height},this._localScreenVideoTrack.resolution=p,setTimeout((function(){return _.safeEmit(ND.onLocalVideoSizeChanged,{streamIndex:YM.STREAM_INDEX_SCREEN,info:{width:h.width,height:h.height}})}))),(f=d.getAudioTracks()).length&&(this._localScreenAudioTrack=new jH(f[0],HL()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(a=this._screenPlayer)||void 0===a||a.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),(null===(s=this._room)||void 0===s?void 0:s.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,3];case 2:v.sent(),v.label=3;case 3:return[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,i,r;return tv(this,void 0,void 0,(function(){return iv(this,(function(n){switch(n.label){case 0:return vq.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(i=this._localScreenAudioTrack)||void 0===i||i.close(),this._localScreenAudioTrack=void 0,(null===(r=this._room)||void 0===r?void 0:r.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var i,r,n,o,a,s;if(vq.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),ej(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),t&&t.renderDom){var c=$_({userId:this._getUserId()},t);return aj(c),e!==YM.STREAM_INDEX_MAIN||this._videoPlayer?e!=YM.STREAM_INDEX_SCREEN||this._screenPlayer?void 0:(this._screenPlayer=new wK($_($_({},c),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==dL.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),(null===(s=this._room)||void 0===s?void 0:s.localScreenStream)&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),this._screenPlayer.domElement):(this._videoPlayer=new wK(c),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==dL.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),(null===(o=this._room)||void 0===o?void 0:o.localStream)&&(this._room.localStream.videoDom=this._videoPlayer.domElement),this._videoPlayer.domElement)}e==YM.STREAM_INDEX_MAIN?(null===(i=this._videoPlayer)||void 0===i||i.destroy(),delete this._videoPlayer):(null===(r=this._screenPlayer)||void 0===r||r.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:vq.print("startLiveTranscoding()","transcode: %o",e),$B(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(ND.onStreamMixingEvent,{event:uz.START,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(zV("started",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof JB?i:new JB(qB.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:if(vq.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=tq(this._liveTranscodeConfig,e),r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(ND.onStreamMixingEvent,{event:uz.UPDATE,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(zV("layoutChanged",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof JB?i:new JB(qB.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:if(vq.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,i.label=1;case 1:return i.trys.push([1,3,,4]),this.safeEmit(ND.onStreamMixingEvent,{event:uz.STOP,error:0,message:""}),[4,null===(e=this._room)||void 0===e?void 0:e.liveControlMessage({action:"stopped",type:"transcode"})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof JB?t:new JB(qB.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return vq.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(iB.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t,i;return tv(this,void 0,void 0,(function(){return iv(this,(function(r){switch(r.label){case 0:if(vq.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==Zz.CONNECTED)throw new JB(qB.NOT_CONNECTED_YET,"server not connected");return this._room.localStream&&(null===(t=this._room.localStream.observer)||void 0===t||t.setPublisher(e)),!e?[4,this._room.unpublish()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?nq.NORMAL_USER:nq.SILENT_USER})];case 3:return r.sent(),this._visibility=e,e&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoPublish)&&this._updatePublish({mediaType:JM.AUDIO_AND_VIDEO}),[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("playback_event",(function(r){var n,o,a,s;switch(null===(o=null===(n=i._room)||void 0===n?void 0:n.remoteStreams.get(r.userId||""))||void 0===o||o.find((function(e){return!e.isScreen})),r.eventName){case"timeupdate":return;case"loadeddata":if("audio"===r.type)t?i.safeEmit(ND.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):i.safeEmit(ND.onAudioFirstFrameDecoded,{userId:e.userId}),$F.firstRemoteAudioRender("",r.userId||"");else{var c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0};t?(c.publicStreamId=c.userId,delete c.userId,i.safeEmit(ND.onFirstPublicStreamVideoFrameDecoded,c),i.safeEmit(ND.onFirstPublicStreamVideoFrameRendered,c)):(i.safeEmit(ND.onVideoFirstFrameDecoded,c),i.safeEmit(ND.onVideoFirstFrameRendered,c)),$F.firstRemoteVideoRender("",r.userId||"")}break;case"autoplay-error":return t&&(r.publicStreamId=r.userId),vq.print("autoplay-error","userId: ".concat(r.userId,", kind: ").concat(e instanceof wK,", rawEvent: "),r.rawEvent),void i.safeEmit(ND.onAutoplayFailed,{userId:r.userId,kind:e instanceof wK?"video":"audio",mediaType:e instanceof wK?JM.VIDEO:JM.AUDIO,streamIndex:e.isScreen?YM.STREAM_INDEX_SCREEN:YM.STREAM_INDEX_MAIN})}i.safeEmit(ND.onPlayerEvent,r)}))},t.prototype._initLocalTrackEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("track-ended",(function(e){var t=!1;e!==i._localScreenAudioTrack&&e!==i._localScreenVideoTrack||(t=!0),i.safeEmit(ND.onTrackEnded,{kind:e.getTrack().kind,isScreen:t})})),e.on("resolution-change",(function(e){i.safeEmit(ND.onLocalVideoSizeChanged,{streamIndex:t?YM.STREAM_INDEX_SCREEN:YM.STREAM_INDEX_MAIN,info:e})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var i,r,n,o,a,s;vq.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),ej(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),aj(t);var c=t.userId;if(e==YM.STREAM_INDEX_MAIN){if(null===(i=this._remoteVideoPlayer.get(c))||void 0===i||i.destroy(),!t.renderDom)return;var u=new wK(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(n=null===(r=this._room)||void 0===r?void 0:r.remoteStreams.get(c))||void 0===n?void 0:n.find((function(e){return!e.isScreen})))&&(this._updateVideoPlayerState(d),d.videoDom=u.domElement),u.domElement}if(null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy(),t.renderDom){var d;u=new wK($_($_({},t),{isScreen:!0}));return this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&(this._updateVideoPlayerState(d),d.videoDom=u.domElement),u.domElement}},t.prototype.setLocalVideoMirrorType=function(e){vq.print("setLocalVideoMirrorType()","mirrorType: %o",e),ej(e,"mirrorType",[$M.MIRROR_TYPE_NONE,$M.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){switch(i.label){case 0:return vq.print("setAudioPlaybackDevice()","deviceId: %s",e),$B(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(vq.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,CH.getDeviceById(e)];case 1:if(!(t=i.sent()))throw new JB(qB.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._remoteScreenAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._audioPlaybackDeviceId=e,t&&this.safeEmit(ND.onAudioPlaybackDeviceChanged,t),$F.rtcAudioDevice(TF.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e,t,i){var r,n,o,a,s,c;return void 0===t&&(t=JM.AUDIO_AND_VIDEO),tv(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v;return iv(this,(function(m){return vq.print("play()","userId: %s, mediaType: %s, streamIndex: %s",e,t,i),u=!e||e===this._getUserId()||"local_user",d=void 0===i||i===YM.STREAM_INDEX_MAIN,l=void 0===i||i===YM.STREAM_INDEX_SCREEN,h=t!==JM.VIDEO,p=t!==JM.AUDIO,f=[],u&&p&&(d&&this._localVideoTrack&&(null===(r=this._videoPlayer)||void 0===r||r.mirror(!!this._mirrorType),f.push(null===(n=this._videoPlayer)||void 0===n?void 0:n.playVideo(this._localVideoTrack))),l&&this._localScreenVideoTrack&&f.push(null===(o=this._screenPlayer)||void 0===o?void 0:o.playVideo(this._localScreenVideoTrack))),e===(null===(a=this._audioMixingManager)||void 0===a?void 0:a.id)&&f.push(this._audioMixingManager.resumeLocalPlay()),_=null===(s=this._room)||void 0===s?void 0:s.remoteStreams,p&&d&&f.push(DK(this._remoteVideoPlayer,e,!1,_)),p&&l&&f.push(DK(this._remoteScreenPlayer,e,!0,_)),h&&d&&f.push(DK(this._remoteAudioPlayer,e,!1,_)),p&&l&&f.push(DK(this._remoteScreenAudioPlayer,e,!0,_)),v=null===(c=this._outsideRoom)||void 0===c?void 0:c.remoteStreams,h&&f.push(DK(this._publicStreamVideoPlayer,e,!1,v)),p&&f.push(DK(this._publicStreamAudioPlayer,e,!1,v)),[2,Promise.all(f).then((function(){}))]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){return vq.print("pauseAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),t=function(){pU(e)&&(i._pauseAllSubscribeState.audio=!0),fU(e)&&(i._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()])}))}))},t.prototype.resumeAllSubscribedStream=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){return vq.print("resumeAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),t=function(){pU(e)&&(i._pauseAllSubscribeState.audio=!1),fU(e)&&(i._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,r;t(),null===(r=null===(e=i._room)||void 0===e?void 0:e.remoteStreams)||void 0===r||r.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i._updateAudioPlayerState(e),i._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])}))}))},t.prototype.sendUserMessage=function(e,t){var i;return tv(this,void 0,void 0,(function(){var r,n=this;return iv(this,(function(o){if(nj(e),sj(t),!this._room||this._room.connectionState!==Zz.CONNECTED)throw new JB(qB.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!1,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!1,r),t}))]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){var i;return tv(this,void 0,void 0,(function(){var r,n=this;return iv(this,(function(o){if(nj(e),ij(t,"message"),sj(t),!this._room||this._room.connectionState!==Zz.CONNECTED)throw new JB(qB.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!0,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!0,r),t}))]}))}))},t.prototype.sendRoomMessage=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){if(sj(e),!this._room||this._room.connectionState!==Zz.CONNECTED)throw new JB(qB.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e}))]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){if(sj(e),!this._room||this._room.connectionState!==Zz.CONNECTED)throw new JB(qB.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e,!0).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e}))]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:return vq.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,function(e){var t,i;try{var r=navigator.mediaDevices.getSupportedConstraints();try{for(var n=rv(Object.keys(e)),o=n.next();!o.done;o=n.next()){var a=o.value;r[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}}catch(e){}}(e),i=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,i&&(this._audioStreamConstraints.deviceId=i),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){switch(r.label){case 0:return vq.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,i=this._videoStreamConstraints.deviceId,"number"==typeof e.width&&(e.width={ideal:e.width,max:e.width}),"number"==typeof e.height&&(e.height={ideal:e.height,max:e.height}),this._videoStreamConstraints=e,i&&(this._videoStreamConstraints.deviceId=i),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:r.sent(),this._updatePublish(),r.label=2;case 2:return[2]}}))}))},t.prototype.enableSimulcastMode=function(e){return vq.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){return iv(this,(function(n){return vq.print("setVideoEncoderConfig()"," descriptions: %o",e),Array.isArray(e)||(e=[e]),(e=e.filter((function(e){return e}))).length>3&&(e=e.slice(0,3)),e.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._localVideoTrack&&(null===(t=e[0])||void 0===t?void 0:t.contentHint)&&this._localVideoTrack.setContentHint(null===(i=e[0])||void 0===i?void 0:i.contentHint),this._videoStreamEncodeConfig=e,(null===(r=this._room)||void 0===r?void 0:r.hasPublished)&&this._updatePublish(),[2]}))}))},t.prototype.autoResetVideoEncoderConfig=function(e){var t;if(e){(null===(t=this._videoStreamEncodeConfig)||void 0===t?void 0:t.length)||(this._videoStreamEncodeConfig=[XV]);var i=e.width*e.height,r=this._videoStreamEncodeConfig[0];if(!(mU(r.width)*mU(r.height)<=i)){var n,o,a=qV,s=a[0];a.forEach((function(e,t){var r=mU(e.width)*mU(e.height);n||(i<r?n=e:s=e)})),o=n&&mU(n.width)*mU(n.height)-i<i-mU(s.width)*mU(s.height)?Object.assign({},n):Object.assign({},s),this._videoStreamEncodeConfig=this._videoStreamEncodeConfig.filter((function(e){return!(o&&mU(e.width)*mU(e.height)>=i)||(o.maxKbps=Math.min(e.maxKbps,o.maxKbps),!1)})),this._videoStreamEncodeConfig.unshift({width:e.width,height:e.height,frameRate:e.frameRate?Math.round(e.frameRate):this._videoStreamEncodeConfig[0].frameRate,maxKbps:o.maxKbps}),vq.print("autoResetVideoEncoderConfig() result",JSON.stringify(this._videoStreamEncodeConfig)),$F.rtcInvokeStatus(JSON.stringify(this._videoStreamEncodeConfig),0,"autoResetVideoEncoderConfig","",0)}}},t.prototype.setScreenEncoderConfig=function(e){var t;return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return vq.print("setScreenEncoderConfig()","description: %o",e),this._screenStreamEncodeConfig=[e],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=e,this._localScreenVideoTrack.updateVideoCaptureConfig(),e.contentHint&&this._localScreenVideoTrack.setContentHint(e.contentHint)),(null===(t=this._room)||void 0===t?void 0:t.hasScreenPublished)&&this._updateScreenPublish(),[2]}))}))},t.prototype.sendSEIMessage=function(e,t,i){var r,n,o,a,s,c;vq.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,i),ej(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),ZB(i,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(qL.str2ab(t)):t;if(t.length){var d;if(e===YM.STREAM_INDEX_MAIN){if(!(null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.hasPublished))return;d=null===(o=this._room)||void 0===o?void 0:o.localStream}else{if(!(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished))return;d=null===(c=this._room)||void 0===c?void 0:c.localScreenStream}if(u.byteLength>4096)vq.print("sei size must not bigger than 4KB");else{var l=HL();d.seiList.push({content:u,uuid:l,repeatCount:i}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else vq.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;vq.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var i=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,r;i=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var r;if(0!==e.length){var n=e.find((function(e){return!1===e.isScreen})),o=null===(r=null==n?void 0:n.audioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t,volume:o||0})}}));var n=null===(r=t._localAudioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t._getUserId(),volume:n||0}),t.safeEmit(ND.onAudioVolumeIndication,{speakers:i})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t,i,r,n,o,a=this;void 0===e&&(e={}),vq.print("enableAudioPropertiesReport()","config %o: ",e);var s=e.interval,c=void 0===s?100:s,u=e.enableInBackground,d=void 0===u||u;if(this._stopAudioPropertiesReport(),c<=0)return null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){e.forEach((function(e){return e.stopRecordAudioEnergy()}))})),null===(r=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===r||r.stopRecordAudioEnergy(),void(null===(o=null===(n=this._room)||void 0===n?void 0:n.localScreenStream)||void 0===o||o.stopRecordAudioEnergy());c=Math.max(100,c),this._audioPropertiesReportTimer=self.setInterval((function(){var e,t,i,r;if(d||"hidden"!==document.visibilityState){var n=[],o=a._audioDeviceManager.getRecordTrack()||a._localAudioTrack;if(o){var s=o.getAudioLevel();null===(t=null===(e=a._room)||void 0===e?void 0:e.localStream)||void 0===t||t.recordAudioEnergy(s),n.push({streamIndex:YM.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:s,nonlinearVolume:hU(s)}})}if(a._localScreenAudioTrack){s=a._localScreenAudioTrack.getAudioLevel();null===(r=null===(i=a._room)||void 0===i?void 0:i.localScreenStream)||void 0===r||r.recordAudioEnergy(s),n.push({streamIndex:YM.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:s,nonlinearVolume:hU(s)}})}if(a.safeEmit(ND.onLocalAudioPropertiesReport,n),a._room){var c=[];a._room.remoteStreams.forEach((function(e,t){e.forEach((function(e){var i,r;if(e.audioTrack){var n=e.audioTrack.getAudioLevel();e.recordAudioEnergy(n),c.push({streamKey:{userId:t,streamIndex:e.isScreen?YM.STREAM_INDEX_SCREEN:YM.STREAM_INDEX_MAIN,roomId:null===(r=null===(i=a._room)||void 0===i?void 0:i.roomInfo)||void 0===r?void 0:r.roomId},audioPropertiesInfo:{linearVolume:n,nonlinearVolume:hU(n)}})}}))})),a.safeEmit(ND.onRemoteAudioPropertiesReport,c)}}}),c),eU&&(this._localAudioInputTimer=self.setInterval((function(){var e,t;a._localAudioTrack&&(a._localAudioTrack.checkHasInput()?a._localAudioNoInputCount=0:(a._localAudioNoInputCount++,5===a._localAudioNoInputCount&&(null===(e=a.localAudioTrack)||void 0===e||e.resetAudioLevelFetcher(),null===(t=a._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.filter((function(e){return!e.isScreen})).forEach((function(e){var t;null===(t=null==e?void 0:e.audioTrack)||void 0===t||t.resetAudioLevelFetcher()}))})),vq.print("Reset audio level fetcher",""),$F.rtcInvokeStatus("Reset audio level fetcher",0,"_localAudioInputTimer","",0))))}),400))},t.prototype.setVideoSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y;return tv(this,void 0,void 0,(function(){var g,S,E;return iv(this,(function(b){switch(b.label){case 0:return vq.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),ej(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),ej(t,"VideoSourceType",[BM.VIDEO_SOURCE_TYPE_EXTERNAL,BM.VIDEO_SOURCE_TYPE_INTERNAL]),g=e===YM.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[g]===t?[3,4]:(this._trackSourceType[g]=t,vq.print("setVideoSourceType","set ".concat(g," source type to ").concat(t)),this._localVideoTrack&&e===YM.STREAM_INDEX_MAIN?(E=!1,t===BM.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,S=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,E?null===(a=null===(o=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!1):null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushVideo(!1),(null===(d=this._room)||void 0===d?void 0:d.hasPublished)||S?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===YM.STREAM_INDEX_SCREEN?(E=!1,t===BM.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,E?null===(f=null===(p=null===(h=this._room)||void 0===h?void 0:h.localScreenStream)||void 0===p?void 0:p.observer)||void 0===f||f.setEnableVideo(!1):null===(m=null===(v=null===(_=this._room)||void 0===_?void 0:_.localScreenStream)||void 0===v?void 0:v.observer)||void 0===m||m.setPushVideo(!1),(null===(y=this._room)||void 0===y?void 0:y.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var i,r,n,o,a,s,c,u;return tv(this,void 0,void 0,(function(){var d;return iv(this,(function(l){switch(l.label){case 0:if(vq.print("setExternalVideoTrack()","index: %o, track: %o",e,t),ej(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),e!==YM.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==BM.VIDEO_SOURCE_TYPE_EXTERNAL)throw new JB(qB.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new GH(t,HL()),this._initLocalTrackEvents(this._localVideoTrack),null===(i=this._videoPlayer)||void 0===i||i.playVideo(this._localVideoTrack),d=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||d?[4,this._updatePublish()]:[3,2];case 1:l.sent(),l.label=2;case 2:if(e!==YM.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==BM.VIDEO_SOURCE_TYPE_EXTERNAL)throw new JB(qB.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new GH(t,HL()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushVideo(!0),(null===(u=this._room)||void 0===u?void 0:u.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v;return tv(this,void 0,void 0,(function(){var m,y,g;return iv(this,(function(S){switch(S.label){case 0:return vq.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),ej(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),ej(t,"audioSourceType",[jM.AUDIO_SOURCE_TYPE_EXTERNAL,jM.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===YM.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,vq.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===YM.STREAM_INDEX_MAIN?(g=!1,this._trackSourceType.audio===jM.AUDIO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,y=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,g?null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableAudio(!1):null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushAudio(!1),(null===(u=this._room)||void 0===u?void 0:u.hasPublished)||y?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:S.sent(),S.label=2;case 2:return this._localScreenAudioTrack&&e===YM.STREAM_INDEX_SCREEN?(g=!1,this._trackSourceType.audio===jM.AUDIO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,g?null===(h=null===(l=null===(d=this._room)||void 0===d?void 0:d.localScreenStream)||void 0===l?void 0:l.observer)||void 0===h||h.setEnableAudio(!1):null===(_=null===(f=null===(p=this._room)||void 0===p?void 0:p.localScreenStream)||void 0===f?void 0:f.observer)||void 0===_||_.setPushAudio(!1),(null===(v=this._room)||void 0===v?void 0:v.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:S.sent(),S.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var i,r,n,o,a,s,c,u,d;return tv(this,void 0,void 0,(function(){var l;return iv(this,(function(h){switch(h.label){case 0:if(vq.print("setExternalAudioTrack()","index: %o, track: %o",e,t),ej(e,"streamIndex",[YM.STREAM_INDEX_MAIN,YM.STREAM_INDEX_SCREEN]),e!==YM.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==jM.AUDIO_SOURCE_TYPE_EXTERNAL)throw new JB(qB.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new HH(t,HL()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setPushAudio(!0),(null===(a=this._room)||void 0===a?void 0:a.hasPublished)||l?[4,this._updatePublish()]:[3,2];case 1:h.sent(),h.label=2;case 2:if(e!==YM.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==jM.AUDIO_SOURCE_TYPE_EXTERNAL)throw new JB(qB.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new HH(t,HL()),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localScreenStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushAudio(!0),(null===(d=this._room)||void 0===d?void 0:d.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.login=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return vq.print("login()","token: %o, userInfo: %o",e,t),rj(e)||$B(e,"token"),nj(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return tv(this,void 0,void 0,(function(){return iv(this,(function(e){return vq.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return vq.print("updateLoginToken()","token: %o",e),rj(e)||$B(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return vq.print("getPeerOnlineStatus()","userId: %o",e),nj(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return tv(this,void 0,void 0,(function(){var i,r=this;return iv(this,(function(n){nj(e),sj(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!1,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}return[2]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return tv(this,void 0,void 0,(function(){var i,r=this;return iv(this,(function(n){nj(e),ij(t,"message"),sj(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!0,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}return[2]}))}))},t.prototype.setServerParams=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){return vq.print("setServerParams()","signature: %o, url: %0",e,t),$B(e,"signature"),$B(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){$B(e,"message"),sj(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!1,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!1,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!1,t),e}return[2]}))}))},t.prototype.sendServerBinaryMessage=function(e){return tv(this,void 0,void 0,(function(){var t,i=this;return iv(this,(function(r){ij(e,"message"),sj(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!0,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!0,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!0,t),e}return[2]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new JB(qB.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;vq.print("startCloudProxy()",e),$B(e.logProxy,"logProxy"),$B(e.accessProxy,"accessProxy"),$B(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=HV("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=HV("LOG_SERVER_URL"),this._originConfigServerUrls=HV("CONFIG_REQUEST_DOMAINS"),GV("ICE_CONFIG_REQUEST_URLS",e.accessProxy),GV("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),GV("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new JB(qB.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");vq.print("stopCloudProxy()"),GV("ICE_CONFIG_REQUEST_URLS",[]),GV("LOG_SERVER_URL",this._originLogServerUrl),GV("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return tv(this,void 0,void 0,(function(){var i,r=this;return iv(this,(function(n){if(vq.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),oj(e),!this._room||this._room.connectionState!==Zz.CONNECTED)throw new JB(qB.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new JB(qB.REPEAT_PUSH,"repeat push public media stream");return i=KV(e,"started",t),[2,this._room.publicStreamControlMessage(i).then((function(){r._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return tv(this,void 0,void 0,(function(){var i;return iv(this,(function(r){if(vq.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),oj(e),!this._room||this._room.connectionState!==Zz.CONNECTED)throw new JB(qB.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return i=KV(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(i)]}))}))},t.prototype.stopPushPublicStream=function(e){return tv(this,void 0,void 0,(function(){var t=this;return iv(this,(function(i){if(vq.print("startPushPublicStream()","publicStreamId: %o",e),oj(e),!this._room||this._room.connectionState!==Zz.CONNECTED)throw new JB(qB.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return[2,this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:e}).then((function(){t._publicStreamIds.delete(e)}))]}))}))},t.prototype.startPlayPublicStream=function(e){var t,i,r,n;return tv(this,void 0,void 0,(function(){var o,a,s,c=this;return iv(this,(function(u){switch(u.label){case 0:return oj(e),this._outsideRoom?[3,2]:(this._outsideRoom=new uq(this._appId,{audioProfileManager:this._audioProfileManager,enableFallbackHandler:Sq(this._appId),enableStandardHandler:Eq(this._appId),pcKillSwitch:$_($_({ctor_sdpsemantics_add:!0,ctor_encodedinsetablestream_add:!0,sld_rtcpfb_rrtr_add:!0,sld_ext_sdesmid_remove:!0,sld_fmtp_sps_add:!0,sld_fmtp_bitrate_add:!0,sld_fmtp_opus_add:!0},HV("PC_KILLSWITCH")),gq(this._appId))}),this._outsideRoom.on(sz.RESUBSCRIBE,(function(e){var t,i,r=e.stream;if(r){var n=c._publicStreamAudioPlayer.get(r.streamId);n&&r.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var o=c._publicStreamVideoPlayer.get(r.streamId);o&&r.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(t=this._outsideRoom)||void 0===t||t.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,c.safeEmit(ND.onPublicStreamStats,e)})),null===(i=this._outsideRoom)||void 0===i||i.on("streamDecodeFailed",(function(e){c.safeEmit(ND.onError,{errorCode:qB.PUBLIC_STREAM_DECODE_FAILED,publicStreamId:e.publicStreamId})})),null===(r=this._outsideRoom)||void 0===r||r.on(sz.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(ND.onPublicStreamSEIMessageReceived,e)})),[4,this._outsideRoom.connect()]);case 1:u.sent(),u.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return o=u.sent(),(a=this._publicStreamVideoPlayer.get(e))&&(null==o?void 0:o.videoTrack)&&a.playVideo(o.videoTrack,o),!(s=this._publicStreamAudioPlayer.get(e))&&(null==o?void 0:o.audioTrack)&&(s=new NK(e,{muted:(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)===dL.VIDEO_ONLY,isScreen:!1,useWebAudio:this.audioPlayerUseWebAudio}),this._initPlayerEvents(s,!0),s.playAudio(o.audioTrack),this._publicStreamAudioPlayer.set(e,s)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return tv(this,void 0,void 0,(function(){var t;return iv(this,(function(i){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.destroy(),this._publicStreamAudioPlayer.delete(e)),this._outsideRoom.destroy(),this._outsideRoom=void 0,[2]):[2]}))}))},t.prototype.setAudioProfile=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){return this._audioProfileManager.setAudioProfile(e),[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var i,r,n;vq.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var o=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&o)return o.destroy(),void this._publicStreamVideoPlayer.delete(e);if(!o){o=new wK($_($_({},t),{userId:e})),this._initPlayerEvents(o,!0),this._publicStreamVideoPlayer.set(e,o);var a=null===(r=null===(i=this._outsideRoom)||void 0===i?void 0:i.remoteStreams)||void 0===r?void 0:r.get(e);(null==a?void 0:a.videoTrack)&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==dL.PLAY_MANUALLY&&o.playVideo(a.videoTrack,a)}},t.prototype.setDummyCaptureImagePath=function(e,t){return tv(this,void 0,void 0,(function(){var i=this;return iv(this,(function(r){return[2,new Promise((function(r,n){$B(t,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=t,o.onload=function(){try{var t=document.createElement("canvas"),a=t.getContext("2d");if(!a)return n(new JB(qB.UNEXPECTED_ERROR,"Not support canvas"));t.width=o.width,t.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(i._dummyTimer),i._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=t.captureStream(5).getVideoTracks()[0];e===YM.STREAM_INDEX_MAIN?i._localImgVideoTrack=s:i._localImgScreenTrack=s,r()}catch(e){n(new JB(qB.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new JB(qB.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(WV))},t.prototype._updatePublish=function(e){return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var t,i,r;return iv(this,(function(n){switch(n.label){case 0:if(vq.print("_updatePublish()","config: %o",e),t={mediaType:void 0,invokeByJoinRoom:!1,pubState:dz.PUB},e=$_($_({},t),e),!this._visibility)throw new JB(qB.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==Zz.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,e.mediaType,e.pubState,e.invokeByJoinRoom)];case 3:return n.sent(),this._videoPlayer&&this._room.localStream&&(this._room.localStream.videoDom=this._videoPlayer.domElement),[3,6];case 4:throw(r=n.sent())instanceof JB?r:new JB(qB.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype.startAudioPlaybackDeviceTest=function(e,t){return tv(this,void 0,void 0,(function(){return iv(this,(function(i){switch(i.label){case 0:return vq.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),$B(e,"filePath"),ZB(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,i.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){vq.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()},t.prototype.startAudioDeviceRecordTest=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return vq.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),ZB(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){vq.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){vq.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype.setRemoteUserPriority=function(e,t){var i;vq.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{nj(e),ej(t,"priority",[oL.HIGH,oL.MEDIUM,oL.LOW])}catch(e){return console.warn(e),!1}return this._userPriorityMap.set(e,t),null===(i=this._room)||void 0===i||i.setRemoteUserPriority(e,t),!0},t.prototype.setSubscribeFallbackOption=function(e){vq.print("setSubscribeFallbackOption()","option: %o",e);try{ej(e,"option",[nL.DISABLE,nL.VIDEO_STREAM_LOW,nL.AUDIO_ONLY])}catch(e){return console.warn(e),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)},t.prototype.getLocalStreamTrack=function(e,t){var i,r,n=this;if(vq.print("getLocalStreamTrack()","streamIndex: ".concat(e,", type: ").concat(t)),e===YM.STREAM_INDEX_MAIN?(i="video"===t?this.localVideoTrack:this.localAudioTrack,r=function(){var e;return null===(e=n._room)||void 0===e?void 0:e.localStream}):(i="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,r=function(){var e;return null===(e=n._room)||void 0===e?void 0:e.localScreenStream}),i){var o=i instanceof JH&&i.mixedAudioTrack?i.mixedAudioTrack:i.getTrack();if(o){var a=r();return fq(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t)),fq(o,"readyState",(function(e){"ended"===e&&(_q(o,"enabled"),_q(o,"readyState")),n._reportMsTrackEvent("readyState",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t,e)})),o.addEventListener("ended",(function(){_q(o,"enabled"),_q(o,"readyState")})),o}}},t.prototype.getRemoteStreamTrack=function(e,t,i){var r,n,o=this;vq.print("getRemoteStreamTrack()","userId: ".concat(e,", streamIndex: ").concat(t,", type: ").concat(i));var a,s=(null===(r=this._room)||void 0===r?void 0:r.remoteStreams.get(e))||[];if(s&&s.length&&(t===YM.STREAM_INDEX_MAIN?(a=s.find((function(e){return!e.isScreen})),n="video"===i?null==a?void 0:a.videoTrack:null==a?void 0:a.audioTrack):(a=s.find((function(e){return e.isScreen})),n="video"===i?null==a?void 0:a.videoTrack:null==a?void 0:a.audioTrack),n)){var c=n.getTrack();if(c&&a){var u=a.streamId;return fq(c,"enabled",this._reportMsTrackEvent.bind(this,"enabled",u,"getRemoteStreamTrack",i)),fq(c,"readyState",(function(e){"ended"===e&&(_q(c,"enabled"),_q(c,"readyState")),o._reportMsTrackEvent("readyState",u,"getRemoteStreamTrack",i,e)})),c.addEventListener("ended",(function(){_q(c,"enabled"),_q(c,"readyState")})),c}}},t.prototype.getPublicStreamTrack=function(e,t){var i=this;if(vq.print("getPublicStreamTrack()","Id: ".concat(e,", type: ").concat(t)),this._outsideRoom&&this._outsideRoom.remoteStreams){var r=this._outsideRoom.remoteStreams.get(e);if(r){var n="video"===t?r.videoTrack:r.audioTrack;if(n){var o=n.getTrack();if(o){var a=r.streamId;return fq(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",a,"getPublicStreamTrack",t)),fq(o,"readyState",(function(e){"ended"===e&&(_q(o,"enabled"),_q(o,"readyState")),i._reportMsTrackEvent("readyState",a,"getPublicStreamTrack",t,e)})),o.addEventListener("ended",(function(){_q(o,"enabled"),_q(o,"readyState")})),o}}}}},t.prototype._reportMsTrackEvent=function(e,t,i,r,n){var o;switch(e){case"readyState":o="live"!==n?"".concat(r," stopped"):"unknown";break;case"enabled":o="".concat(r,!0===n?" unmuted":" muted");break;default:o="unknown"}$F.rtcInvokeStatus(o,0,i,t||"",0,{direction:"getLocalStreamTrack"===i?"up":"down"})},t.prototype._updateScreenPublish=function(e){return void 0===e&&(e={}),tv(this,void 0,void 0,(function(){var t,i,r;return iv(this,(function(n){switch(n.label){case 0:return vq.print("_updateScreenPublish()"),t={mediaType:void 0,pubState:dz.PUB},e=$_($_({},t),e),[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==Zz.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,e.mediaType,e.pubState)];case 3:return n.sent(),this._screenPlayer&&this._room.localScreenStream&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),[3,6];case 4:throw(r=n.sent())instanceof JB?r:new JB(qB.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){var t,i;vq.print("_updateAudioPlayerState()");var r=e.userId,n=e.isScreen,o=n?this._remoteScreenAudioPlayer:this._remoteAudioPlayer,a=o.get(r);e.audioTrack?(a||(a=new NK(r,{muted:(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)===dL.VIDEO_ONLY,isScreen:n,useWebAudio:this.audioPlayerUseWebAudio}),this._initPlayerEvents(a),o.set(r,a),this._audioPlaybackDeviceId&&a.setPlaybackDevice(this._audioPlaybackDeviceId)),(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==dL.PLAY_MANUALLY&&a.playAudio(e.audioTrack)):null==a||a.stop()},t.prototype.resetRemoteAudioPlayer=function(e){},t.prototype._updateVideoPlayerState=function(e){var t;vq.print("_updateVideoPlayerState()");var i,r=e.userId;i=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?i&&(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)!==dL.PLAY_MANUALLY&&i.playVideo(e.videoTrack,e):(null==i?void 0:i.played)&&(null==i||i.stop())},t.prototype._checkLocalCameraStall=function(e){var t,i,r;return tv(this,void 0,void 0,(function(){var n,o;return iv(this,(function(a){switch(a.label){case 0:if("visible"!==document.visibilityState||!(e.videoStats.encoderOutputFrameRate<3&&e.videoStats.encoderOutputFrameRate>0||e.videoStats.sentKBitrate<2&&e.videoStats.sentKBitrate>0))return[3,6];if(this._videoCaptureStallCount++,!(this._videoCaptureStallCount>3))return[3,5];this._videoCaptureStallCount=0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.stopVideoCapture()];case 2:return a.sent(),[4,this.startVideoCapture()];case 3:return a.sent(),n=null===(r=null===(i=null===(t=this._room)||void 0===t?void 0:t._roomInfo)||void 0===i?void 0:i.userInfo)||void 0===r?void 0:r.userId,vq.print("onLocalCameraStalled",n),$F.rtcInvokeStatus(JSON.stringify({userId:n}),0,"Engine.onLocalCameraStalled","",0),[3,5];case 4:return o=a.sent(),console.log(o),[3,5];case 5:return[3,7];case 6:this._videoCaptureStallCount=0,a.label=7;case 7:return[2]}}))}))},t.prototype._checkRemoteStats=function(e){return tv(this,void 0,void 0,(function(){return iv(this,(function(t){switch(t.label){case 0:return!e.videoStats.needResub||this.resubedUserId.has(e.userId)?[3,3]:($F.rtcInvokeStatus("[resub user] ".concat(e.userId),0,"resub_user","",0),vq.print("[resub user] ".concat(e.userId)),this.resubedUserId.add(e.userId),[4,this.unsubscribeStream(e.userId,JM.VIDEO)]);case 1:return t.sent(),[4,this.subscribeStream(e.userId,JM.VIDEO)];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},t.prototype._onAddStream=function(e){var t,i=e.stream;i.videoDom=null===(t=this._remoteVideoPlayer.get(i.userId))||void 0===t?void 0:t.domElement;var r=null==i?void 0:i.attributes,n=r.localaudio,o=r.audiostream,a=r.localvideo,s=r.videostream,c=YH.NONE;if(o&&(c|=JM.AUDIO),s&&(c|=JM.VIDEO),c){if(null==i?void 0:i.isScreen)this.safeEmit(ND.onUserPublishScreen,{userId:i.userId,mediaType:c});else{try{var u=c!==JM.AUDIO,d=c!==JM.VIDEO;i._aStats=d?"+oA":i._aStats,i._vStats=u?"+oV":i._vStats}catch(e){}this.safeEmit(ND.onUserPublishStream,{userId:i.userId,mediaType:c}),this._handleAutoSubscribe(i,!0)}(null==i?void 0:i.isScreen)||(n&&this.safeEmit(ND.onUserStartAudioCapture,{userId:i.userId}),a&&this.safeEmit(ND.onUserStartVideoCapture,{userId:i.userId}))}},t.prototype._handleAutoSubscribe=function(e,t){var i,r,n,o,a=YH.NONE;(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(a|=JM.AUDIO),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(a|=JM.VIDEO),vq.print("_onAddStream","autoSubType: ".concat(a)),a&&(t&&pU(a)&&(null===(n=e.observer)||void 0===n||n.setAutoSubscribeAudio(!0)),t&&fU(a)&&(null===(o=e.observer)||void 0===o||o.setAutoSubscribeVideo(!0)),this._subscribe(!1,e.userId,a))},t.prototype._onRemoveStream=function(e){var t,i=this,r=e.stream,n=null!==(t=yq[e.reason])&&void 0!==t?t:QM.STREAM_REMOVE_REASON_OTHER,o=r.isScreen?ND.onUserUnpublishScreen:ND.onUserUnpublishStream,a=YH.NONE;r.attributes.audiostream&&(a|=JM.AUDIO),r.attributes.videostream&&(a|=JM.VIDEO),(null==r?void 0:r._workaround_1_)&&(a=JM.VIDEO),a!==YH.NONE&&this.safeEmit(o,{userId:r.userId,mediaType:a,reason:n}),this._getRemotePlayer(r.userId,r.isScreen).forEach((function(e){(null==r?void 0:r._workaround_1_)||(r.isScreen?(i._remoteScreenPlayer.delete(r.userId),i._remoteScreenAudioPlayer.delete(r.userId)):(i._remoteVideoPlayer.delete(r.userId),i._remoteAudioPlayer.delete(r.userId)),null==e||e.destroy())}))},t.prototype._onUserConnection=function(e){this.safeEmit(ND.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(ND.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(ND.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onNetworkQuality=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.safeEmit.apply(this,ov([ND.onNetworkQuality],nv(e),!1))},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===ZM.CONNECTION_STATE_CONNECTED&&this.safeEmit(ND.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(ND.onConnectionStateChanged,e)},t.prototype._getRemotePlayer=function(e,t){return[(t?this._remoteScreenAudioPlayer:this._remoteAudioPlayer).get(e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]},t.prototype._stopAudioPropertiesReport=function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null),null!==this._localAudioInputTimer&&clearInterval(this._localAudioInputTimer)},t.prototype._onResubscribe=function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))},t.prototype._onSubscribePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onRemovePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onVideoFirstFrameDecoded=function(e){this.safeEmit(ND.onVideoFirstFrameDecoded,e)},t.prototype._onVideoDeviceStateChange=function(e){this.safeEmit(ND.onVideoDeviceStateChanged,e)},t.prototype._onAudioDeviceStateChange=function(e){this.safeEmit(ND.onAudioDeviceStateChanged,e)},t.prototype._onUserPublishStateChange=function(e){var t=e.userId,i=e.isScreen,r=e.mediaType,n=e.pubState,o=e.remoteStream,a={userId:t,mediaType:r};if(i)n===dz.PUB?this.safeEmit(ND.onUserPublishScreen,a):this.safeEmit(ND.onUserUnpublishScreen,$_($_({},a),{reason:QM.STREAM_REMOVE_REASON_UNPUBLISH}));else if(n===dz.PUB){try{var s=r!==JM.AUDIO,c=r!==JM.VIDEO;o._aStats=c?"+oA":o._aStats,o._vStats=s?"+oV":o._vStats}catch(e){}this.safeEmit(ND.onUserPublishStream,a),this._handleAutoSubscribe(o,!0)}else{try{s=r!==JM.AUDIO,c=r!==JM.VIDEO;o._aStats=c?"-oA":o._aStats,o._vStats=s?"-oV":o._vStats}catch(e){}this.safeEmit(ND.onUserUnpublishStream,$_($_({},a),{reason:QM.STREAM_REMOVE_REASON_UNPUBLISH}))}},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(ND.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(ND.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ND.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ND.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(ND.onLiveTranscodingResult,e)},t.prototype._onStreamMixingEvent=function(e){this.safeEmit(ND.onStreamMixingEvent,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(ND.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(ND.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ND.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ND.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(ND.onError,{errorCode:qB.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(ND.onError,{errorCode:qB.RTM_TOKEN_ERROR})}))},Object.defineProperty(t.prototype,"waitForNewToken",{get:function(){return!!this._tempRoomConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localAudioTrack",{get:function(){return this._localAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localVideoTrack",{get:function(){return this._localVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenAudioTrack",{get:function(){return this._localScreenAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenVideoTrack",{get:function(){return this._localScreenVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){var e,t,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteStreams)&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),i},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){i.push({userId:e.userId})}))),i},enumerable:!1,configurable:!0}),t.prototype._handleAudioDeviceManager=function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(ND.onAudioPlaybackDeviceTestVolume,t)}))},t.prototype._assertNotInRoom=function(){if(!this._room||this._room.connectionState!==Zz.CONNECTED)throw new JB(qB.INVOKED_BEFORE_JOIN_ROOM,"join first")},t.prototype._checkMediaType=function(e){ej(e,"mediaType",[JM.AUDIO,JM.VIDEO,JM.AUDIO_AND_VIDEO])},t.prototype._getUserId=function(){var e,t;return(null===(t=null===(e=this._room)||void 0===e?void 0:e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"},ev([aB()],t.prototype,"updateToken",null),ev([aB()],t.prototype,"setVideoCaptureDevice",null),ev([aB()],t.prototype,"setAudioCaptureDevice",null),ev([aB()],t.prototype,"joinRoom",null),ev([aB()],t.prototype,"leaveRoom",null),ev([aB()],t.prototype,"destroy",null),ev([aB()],t.prototype,"publishStream",null),ev([aB()],t.prototype,"unpublishStream",null),ev([aB()],t.prototype,"publishScreen",null),ev([aB()],t.prototype,"unpublishScreen",null),ev([aB()],t.prototype,"subscribeStream",null),ev([aB()],t.prototype,"unsubscribeStream",null),ev([aB()],t.prototype,"subscribeScreen",null),ev([aB()],t.prototype,"unsubscribeScreen",null),ev([aB()],t.prototype,"setRemoteVideoConfig",null),ev([aB()],t.prototype,"startVideoAndAudioCapture",null),ev([aB()],t.prototype,"startVideoCapture",null),ev([aB()],t.prototype,"stopVideoCapture",null),ev([aB()],t.prototype,"startAudioCapture",null),ev([aB()],t.prototype,"stopAudioCapture",null),ev([aB()],t.prototype,"getAudioMixingManager",null),ev([aB()],t.prototype,"startScreenCapture",null),ev([aB()],t.prototype,"stopScreenCapture",null),ev([aB()],t.prototype,"setLocalVideoPlayer",null),ev([aB()],t.prototype,"startLiveTranscoding",null),ev([aB()],t.prototype,"updateLiveTranscoding",null),ev([aB()],t.prototype,"stopLiveTranscoding",null),ev([aB()],t.prototype,"setBusinessId",null),ev([aB()],t.prototype,"setUserVisibility",null),ev([aB()],t.prototype,"setRemoteVideoPlayer",null),ev([aB()],t.prototype,"setLocalVideoMirrorType",null),ev([aB()],t.prototype,"setAudioPlaybackDevice",null),ev([aB()],t.prototype,"play",null),ev([aB()],t.prototype,"pauseAllSubscribedStream",null),ev([aB()],t.prototype,"resumeAllSubscribedStream",null),ev([aB()],t.prototype,"sendUserMessage",null),ev([aB()],t.prototype,"sendUserBinaryMessage",null),ev([aB()],t.prototype,"sendRoomMessage",null),ev([aB()],t.prototype,"sendRoomBinaryMessage",null),ev([aB()],t.prototype,"setAudioCaptureConfig",null),ev([aB()],t.prototype,"setVideoCaptureConfig",null),ev([aB()],t.prototype,"enableSimulcastMode",null),ev([aB()],t.prototype,"setVideoEncoderConfig",null),ev([aB()],t.prototype,"setScreenEncoderConfig",null),ev([aB()],t.prototype,"sendSEIMessage",null),ev([aB()],t.prototype,"setAudioVolumeIndicationInterval",null),ev([aB()],t.prototype,"enableAudioPropertiesReport",null),ev([aB()],t.prototype,"setVideoSourceType",null),ev([aB()],t.prototype,"setExternalVideoTrack",null),ev([aB()],t.prototype,"setAudioSourceType",null),ev([aB()],t.prototype,"setExternalAudioTrack",null),ev([aB("rtm")],t.prototype,"login",null),ev([aB("rtm")],t.prototype,"logout",null),ev([aB("rtm")],t.prototype,"updateLoginToken",null),ev([aB("rtm")],t.prototype,"getPeerOnlineStatus",null),ev([aB("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),ev([aB("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),ev([aB("rtm")],t.prototype,"setServerParams",null),ev([aB("rtm")],t.prototype,"sendServerMessage",null),ev([aB("rtm")],t.prototype,"sendServerBinaryMessage",null),ev([aB()],t.prototype,"startCloudProxy",null),ev([aB()],t.prototype,"stopCloudProxy",null),ev([aB()],t.prototype,"startPushPublicStream",null),ev([aB()],t.prototype,"updatePublicStreamParam",null),ev([aB()],t.prototype,"stopPushPublicStream",null),ev([aB("outsideRoom","streamId")],t.prototype,"startPlayPublicStream",null),ev([aB("outsideRoom","streamId")],t.prototype,"stopPlayPublicStream",null),ev([aB()],t.prototype,"setAudioProfile",null),ev([aB("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),ev([aB()],t.prototype,"setDummyCaptureImagePath",null),ev([aB()],t.prototype,"startAudioPlaybackDeviceTest",null),ev([aB()],t.prototype,"stopAudioPlaybackDeviceTest",null),ev([aB()],t.prototype,"startAudioDeviceRecordTest",null),ev([aB()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),ev([aB()],t.prototype,"stopAudioDevicePlayTest",null),ev([aB()],t.prototype,"setRemoteUserPriority",null),ev([aB()],t.prototype,"setSubscribeFallbackOption",null),ev([aB()],t.prototype,"getLocalStreamTrack",null),ev([aB()],t.prototype,"getRemoteStreamTrack",null),ev([aB()],t.prototype,"getPublicStreamTrack",null),ev([aB()],t.prototype,"resetRemoteAudioPlayer",null),t}(JF),yq={"client unpublished":QM.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":QM.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":QM.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":QM.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":QM.STREAM_REMOVE_REASON_REPUBLISH};function gq(e){var t=xV.getServerConfig(e).web_rtc_config;return(null==t?void 0:t.web_pc_killswitch)?null==t?void 0:t.web_pc_killswitch:{}}function Sq(e){var t=xV.getServerConfig(e).web_rtc_config;return"boolean"==typeof(null==t?void 0:t.fallback)?!1!==t.fallback&&(!!Array.isArray(null==t?void 0:t.fallback_ua_reg)&&t.fallback_ua_reg.every((function(e){return"string"==typeof e&&new RegExp(e).test(navigator.userAgent)}))):!!HV("ENABLE_FALLBACK_HANDLER")}function Eq(e){var t=xV.getServerConfig(e).web_rtc_config;return"boolean"==typeof(null==t?void 0:t.standard)?!1!==t.standard&&(!!Array.isArray(null==t?void 0:t.standard_ua_reg)&&t.standard_ua_reg.every((function(e){return"string"==typeof e&&new RegExp(e).test(navigator.userAgent)}))):!!HV("ENABLE_STANDARD_HANDLER")}var bq=new qF("BLWEngine",0),Iq=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.singleStreamRenderMode=!1,qV=[{width:192,height:108,frameRate:15,maxKbps:100},{width:320,height:180,frameRate:15,maxKbps:140},{width:640,height:360,frameRate:15,maxKbps:400},{width:1280,height:720,frameRate:15,maxKbps:1e3},{width:1920,height:1080,frameRate:15,maxKbps:2e3}],r._handleEvent(),r}return Z_(t,e),t.prototype.subscribeStream=function(t,i){return tv(this,void 0,void 0,(function(){return iv(this,(function(r){return bq.print("subscribeStream()","userId: %o, mediaType: %o",t,i),this.singleStreamRenderMode&&fU(i)&&e.prototype.subscribeScreen.call(this,t,JM.VIDEO).catch((function(){})),[2,e.prototype.subscribeStream.call(this,t,i)]}))}))},t.prototype.unsubscribeStream=function(t,i){return tv(this,void 0,void 0,(function(){return iv(this,(function(r){return bq.print("unsubscribeStream()","userId: %o, mediaType: %o",t,i),this.singleStreamRenderMode&&fU(i)&&e.prototype.unsubscribeScreen.call(this,t,JM.VIDEO).catch((function(){})),[2,e.prototype.unsubscribeStream.call(this,t,i)]}))}))},t.prototype.setRemoteScreenVideoStreamIndex=function(e){var t;return bq.print("setRemoteScreenVideoStreamIndex()","streamIndex: %o",e),(null===(t=this._room)||void 0===t?void 0:t.connectionState)!==Zz.CONNECTED&&(this.singleStreamRenderMode=e===YM.STREAM_INDEX_MAIN,!0)},t.prototype.setRemoteVideoPlayer=function(t,i){if(bq.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",t,i),!this.singleStreamRenderMode||t!==YM.STREAM_INDEX_SCREEN)return e.prototype.setRemoteVideoPlayer.call(this,t,i)},t.prototype.destroy=function(){this.singleStreamRenderMode=!1,e.prototype.destroy.call(this)},t.prototype._updateVideoPlayerState=function(t){var i,r;if(!this.singleStreamRenderMode)return e.prototype._updateVideoPlayerState.call(this,t);var n,o=t.userId,a=null===(i=this._room)||void 0===i?void 0:i.remoteStreams.get(o);Array.isArray(a)&&a.forEach((function(e){e.isScreen&&(n=e)}));var s=this._remoteVideoPlayer.get(o);s&&(t.isScreen||!(null==n?void 0:n.videoTrack)?t.videoTrack?s&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==dL.PLAY_MANUALLY&&s.playVideo(t.videoTrack,t):(null==s?void 0:s.played)&&(null==s||s.stop()):bq.print("_updateVideoPlayerState","prevent play main stream"))},t.prototype._handleEvent=function(){var e=this;this.on(ND.onUserPublishScreen,(function(t){e.singleStreamRenderMode&&fU(t.mediaType)&&e.subscribeScreen(t.userId,JM.VIDEO)})),this.on(ND.onUserUnpublishScreen,(function(t){if(e.singleStreamRenderMode&&fU(t.mediaType)){var i=e._remoteVideoPlayer.get(t.userId),r=e._room.remoteStreams.get(t.userId),n=null==r?void 0:r.find((function(e){return!e.isScreen}));if(!(null==n?void 0:n.videoTrack)||!i)return;i.playVideo(n.videoTrack)}}))},ev([aB()],t.prototype,"subscribeStream",null),ev([aB()],t.prototype,"unsubscribeStream",null),ev([aB()],t.prototype,"setRemoteScreenVideoStreamIndex",null),ev([aB()],t.prototype,"setRemoteVideoPlayer",null),ev([aB()],t.prototype,"destroy",null),t}(mq),Tq=new qF("VERTC",0);[iB,rB,nB].forEach((function(e){return e.setStats({rtc_sdk_version:jV.VERSION,product_line:ZV.RTC,report_version:$V.W_5,os:eF.WEB,device_id:xV.getDeviceId(),user_agent:WL()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var Aq=function(e,t){if(location.search.includes("__rtc_debug_2__"))for(var i in e="5a7451222679214f668e7085",GV("ICE_CONFIG_REQUEST_URLS",["rtc-test.bytedance.com","rtc-access-test-hl.bytedance.com"]),localStorage)i.indexOf("RTC_ACCESS")>-1&&localStorage.removeItem(i);return Tq.print("createEngine","Invoke VERTC.createEngine"),$B(e,"appId"),[iB,rB,nB].forEach((function(i){return i.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),$F.sdkInitEngine(Date.now(),kF.BEGIN),new Iq(e,t)},Rq=function(e){if(Tq.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof Iq))throw new JB(qB.INVALID_ENGINE,"Invalid engine object");e.destroy(),$F.sdkInitEngine(Date.now(),kF.END)},Cq=function(){return tv(void 0,void 0,void 0,(function(){return iv(this,(function(e){return[2,CH.enumerateDevices()]}))}))},Oq=function(e){return void 0===e&&(e={video:!0,audio:!0}),tv(void 0,void 0,void 0,(function(){var t,i,r,n;return iv(this,(function(o){switch(o.label){case 0:if(t=e.video,i=e.audio,r={video:!1,audio:!1},!t)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,CH.getPermissions({video:!0,force:!0})];case 2:return n=o.sent(),r.video=n.video,[3,4];case 3:return o.sent(),[3,4];case 4:if(!i)return[3,8];o.label=5;case 5:return o.trys.push([5,7,,8]),[4,CH.getPermissions({audio:!0,force:!0})];case 6:return n=o.sent(),r.audio=n.audio,[3,8];case 7:return o.sent(),[3,8];case 8:return[2,r]}}))}))},wq=function(){return tv(void 0,void 0,void 0,(function(){return iv(this,(function(e){return[2,CH.enumerateAudioCaptureDevices()]}))}))},kq=function(){return tv(void 0,void 0,void 0,(function(){return iv(this,(function(e){return[2,CH.enumerateVideoCaptureDevices()]}))}))},Pq=function(){return tv(void 0,void 0,void 0,(function(){return iv(this,(function(e){return[2,CH.enumerateAudioPlaybackDevices()]}))}))},Nq=function(){return jV.VERSION},Dq=function(){return $F.rtcSdkApiCall("isSupported",0,""),tv(void 0,void 0,void 0,(function(){var e;return iv(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!WL()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,hG()]:[2,!1];case 1:return[2,(null==(e=t.sent())?void 0:e.includes("H264"))||(null==e?void 0:e.includes("vp8"))];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},Mq=function(){return $F.rtcSdkApiCall("getSupportedCodecs",0,""),tv(void 0,void 0,void 0,(function(){return iv(this,(function(e){switch(e.label){case 0:return[4,hG()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!WL()&&location.search.includes("_rtc_autotest_");var Lq=new function(){this.getSdkVersion=Nq,this.createEngine=Aq,this.destroyEngine=Rq,this.enumerateDevices=Cq,this.enableDevices=Oq,this.enumerateAudioCaptureDevices=wq,this.enumerateVideoCaptureDevices=kq,this.enumerateAudioPlaybackDevices=Pq,this.getParameter=HV,this.setParameter=GV,this.isSupported=Dq,this.getSupportedCodecs=Mq,this.events=ND,this.ErrorCode=qB,this.platform="BytePlus",this._monitor=$F};export{sG as AudioMixingDualMonoMode,cG as AudioMixingType,uL as AudioProfileType,jM as AudioSourceType,HM as ChannelProfile,ZM as ConnectionState,sL as FallbackOrRecoverReason,eL as LogChannel,JM as MediaType,qM as MirrorMode,$M as MirrorType,aL as NetworkQuality,rL as PublicInterpolationMode,iL as PublicStreamType,WM as PublishState,dL as RTCAutoPlayPolicy,oL as RemoteUserPriority,cL as RoomProfileType,YM as StreamIndex,QM as StreamRemoveReason,nL as SubscribeFallbackOption,zM as SubscribeMode,KM as SubscribeState,tL as USER_ONLINE_STATUS,GM as UserOfflineReason,XM as VideoRenderMode,BM as VideoSourceType,Lq as default};
|