@byteplus/rtc 4.42.3 → 4.42.4
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/index.esm.min.js +2 -2
- package/index.min.js +2 -2
- package/package.json +1 -1
package/index.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.42.
|
|
4
|
+
* version: 4.42.4
|
|
5
5
|
*/
|
|
6
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}function t(e){return t="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},t(e)}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i=function(e){return e&&e.Math==Math&&e},n=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof r&&r)||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,S=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},E=c,y=Function.prototype,g=y.bind,b=y.call,T=E&&g.bind(b,b),I=E?function(e){return e&&T(e)}:function(e){return e&&function(){return b.apply(e,arguments)}},R=I,A=R({}.toString),C=R("".slice),O=function(e){return C(A(e),8,-1)},N=I,w=a,D=O,P=n.Object,k=N("".split),M=w((function(){return!P("z").propertyIsEnumerable(0)}))?function(e){return"String"==D(e)?k(e,""):P(e)}:P,U=n.TypeError,L=function(e){if(null==e)throw U("Can't call method on "+e);return e},x=M,V=L,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},Y=function(e,t){return arguments.length<2?K(H[e]):H[e]&&H[e][t]},X=I({}.isPrototypeOf),W=Y("navigator","userAgent")||"",J=n,q=W,Z=J.process,$=J.Deno,Q=Z&&Z.versions||$&&$.version,ee=Q&&Q.v8;ee&&(m=(v=ee.split("."))[0]>0&&v[0]<4?1:+(v[0]+v[1])),!m&&q&&(!(v=q.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=q.match(/Chrome\/(\d+)/))&&(m=+v[1]);var te=m,re=te,ie=a,ne=!!Object.getOwnPropertySymbols&&!ie((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&re&&re<41})),oe=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ae=Y,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")},Se=me,Ee=function(e,t){var r=e[t];return null==r?void 0:Se(r)},ye=l,ge=B,be=G,Te=n.TypeError,Ie={exports:{}},Re=n,Ae=Object.defineProperty,Ce=function(e,t){try{Ae(Re,e,{value:t,configurable:!0,writable:!0})}catch(r){Re[e]=t}return t},Oe=Ce,Ne="__core-js_shared__",we=n[Ne]||Oe(Ne,{}),De=we;(Ie.exports=function(e,t){return De[e]||(De[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=L,ke=n.Object,Me=function(e){return ke(Pe(e))},Ue=Me,Le=I({}.hasOwnProperty),xe=Object.hasOwn||function(e,t){return Le(Ue(e),t)},Ve=I,Fe=0,Be=Math.random(),je=Ve(1..toString),Ge=function(e){return"Symbol("+(void 0===e?"":e)+")_"+je(++Fe+Be,36)},He=n,ze=Ie.exports,Ke=xe,Ye=Ge,Xe=ne,We=oe,Je=ze("wks"),qe=He.Symbol,Ze=qe&&qe.for,$e=We?qe:qe&&qe.withoutSetter||Ye,Qe=function(e){if(!Ke(Je,e)||!Xe&&"string"!=typeof Je[e]){var t="Symbol."+e;Xe&&Ke(qe,e)?Je[e]=qe[e]:Je[e]=We&&Ze?Ze(t):$e(t)}return Je[e]},et=l,tt=G,rt=le,it=Ee,nt=function(e,t){var r,i;if("string"===t&&ge(r=e.toString)&&!be(i=ye(r,e)))return i;if(ge(r=e.valueOf)&&!be(i=ye(r,e)))return i;if("string"!==t&&ge(r=e.toString)&&!be(i=ye(r,e)))return i;throw Te("Can't convert object to primitive value")},ot=Qe,at=n.TypeError,st=ot("toPrimitive"),ct=function(e,t){if(!tt(e)||rt(e))return e;var r,i=it(e,st);if(i){if(void 0===t&&(t="default"),r=et(i,e,t),!tt(r)||rt(r))return r;throw at("Can't convert object to primitive value")}return void 0===t&&(t="number"),nt(e,t)},ut=ct,dt=le,lt=function(e){var t=ut(e,"string");return dt(t)?t:t+""},ht=G,pt=n.document,ft=ht(pt)&&ht(pt.createElement),_t=function(e){return ft?pt.createElement(e):{}},vt=_t,mt=!s&&!a((function(){return 7!=Object.defineProperty(vt("div"),"a",{get:function(){return 7}}).a})),St=s,Et=l,yt=h,gt=S,bt=F,Tt=lt,It=xe,Rt=mt,At=Object.getOwnPropertyDescriptor;o.f=St?At:function(e,t){if(e=bt(e),t=Tt(t),Rt)try{return At(e,t)}catch(e){}if(It(e,t))return gt(!Et(yt.f,e,t),e[t])};var Ct={},Ot=s&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Nt=n,wt=G,Dt=Nt.String,Pt=Nt.TypeError,kt=function(e){if(wt(e))return e;throw Pt(Dt(e)+" is not an object")},Mt=s,Ut=mt,Lt=Ot,xt=kt,Vt=lt,Ft=n.TypeError,Bt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,Gt="enumerable",Ht="configurable",zt="writable";Ct.f=Mt?Lt?function(e,t,r){if(xt(e),t=Vt(t),xt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&zt in r&&!r.writable){var i=jt(e,t);i&&i.writable&&(e[t]=r.value,r={configurable:Ht in r?r.configurable:i.configurable,enumerable:Gt in r?r.enumerable:i.enumerable,writable:!1})}return Bt(e,t,r)}:Bt:function(e,t,r){if(xt(e),t=Vt(t),xt(r),Ut)try{return Bt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Ft("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Kt=Ct,Yt=S,Xt=s?function(e,t,r){return Kt.f(e,t,Yt(1,r))}:function(e,t,r){return e[t]=r,e},Wt={exports:{}},Jt=B,qt=we,Zt=I(Function.toString);Jt(qt.inspectSource)||(qt.inspectSource=function(e){return Zt(e)});var $t,Qt,er,tr=qt.inspectSource,rr=B,ir=tr,nr=n.WeakMap,or=rr(nr)&&/native code/.test(ir(nr)),ar=Ie.exports,sr=Ge,cr=ar("keys"),ur=function(e){return cr[e]||(cr[e]=sr(e))},dr={},lr=or,hr=n,pr=I,fr=G,_r=Xt,vr=xe,mr=we,Sr=ur,Er=dr,yr="Object already initialized",gr=hr.TypeError,br=hr.WeakMap;if(lr||mr.state){var Tr=mr.state||(mr.state=new br),Ir=pr(Tr.get),Rr=pr(Tr.has),Ar=pr(Tr.set);$t=function(e,t){if(Rr(Tr,e))throw new gr(yr);return t.facade=e,Ar(Tr,e,t),t},Qt=function(e){return Ir(Tr,e)||{}},er=function(e){return Rr(Tr,e)}}else{var Cr=Sr("state");Er[Cr]=!0,$t=function(e,t){if(vr(e,Cr))throw new gr(yr);return t.facade=e,_r(e,Cr,t),t},Qt=function(e){return vr(e,Cr)?e[Cr]:{}},er=function(e){return vr(e,Cr)}}var Or={set:$t,get:Qt,has:er,enforce:function(e){return er(e)?Qt(e):$t(e,{})},getterFor:function(e){return function(t){var r;if(!fr(t)||(r=Qt(t)).type!==e)throw gr("Incompatible receiver, "+e+" required");return r}}},Nr=s,wr=xe,Dr=Function.prototype,Pr=Nr&&Object.getOwnPropertyDescriptor,kr=wr(Dr,"name"),Mr={EXISTS:kr,PROPER:kr&&"something"===function(){}.name,CONFIGURABLE:kr&&(!Nr||Nr&&Pr(Dr,"name").configurable)},Ur=n,Lr=B,xr=xe,Vr=Xt,Fr=Ce,Br=tr,jr=Mr.CONFIGURABLE,Gr=Or.get,Hr=Or.enforce,zr=String(String).split("String");(Wt.exports=function(e,t,r,i){var n,o=!!i&&!!i.unsafe,a=!!i&&!!i.enumerable,s=!!i&&!!i.noTargetGet,c=i&&void 0!==i.name?i.name:t;Lr(r)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!xr(r,"name")||jr&&r.name!==c)&&Vr(r,"name",c),(n=Hr(r)).source||(n.source=zr.join("string"==typeof c?c:""))),e!==Ur?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=r:Vr(e,t,r)):a?e[t]=r:Fr(t,r)})(Function.prototype,"toString",(function(){return Lr(this)&&Gr(this).source||Br(this)}));var Kr={},Yr=Math.ceil,Xr=Math.floor,Wr=function(e){var t=+e;return t!=t||0===t?0:(t>0?Xr:Yr)(t)},Jr=Wr,qr=Math.max,Zr=Math.min,$r=function(e,t){var r=Jr(e);return r<0?qr(r+t,0):Zr(r,t)},Qr=Wr,ei=Math.min,ti=function(e){return e>0?ei(Qr(e),9007199254740991):0},ri=ti,ii=function(e){return ri(e.length)},ni=F,oi=$r,ai=ii,si=function(e){return function(t,r,i){var n,o=ni(t),a=ai(o),s=oi(i,a);if(e&&r!=r){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},ci={includes:si(!0),indexOf:si(!1)},ui=xe,di=F,li=ci.indexOf,hi=dr,pi=I([].push),fi=function(e,t){var r,i=di(e),n=0,o=[];for(r in i)!ui(hi,r)&&ui(i,r)&&pi(o,r);for(;t.length>n;)ui(i,r=t[n++])&&(~li(o,r)||pi(o,r));return o},_i=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],vi=fi,mi=_i.concat("length","prototype");Kr.f=Object.getOwnPropertyNames||function(e){return vi(e,mi)};var Si={};Si.f=Object.getOwnPropertySymbols;var Ei=Y,yi=Kr,gi=Si,bi=kt,Ti=I([].concat),Ii=Ei("Reflect","ownKeys")||function(e){var t=yi.f(bi(e)),r=gi.f;return r?Ti(t,r(e)):t},Ri=xe,Ai=Ii,Ci=o,Oi=Ct,Ni=function(e,t,r){for(var i=Ai(t),n=Oi.f,o=Ci.f,a=0;a<i.length;a++){var s=i[a];Ri(e,s)||r&&Ri(r,s)||n(e,s,o(t,s))}},wi=a,Di=B,Pi=/#|\.prototype\./,ki=function(e,t){var r=Ui[Mi(e)];return r==xi||r!=Li&&(Di(t)?wi(t):!!t)},Mi=ki.normalize=function(e){return String(e).replace(Pi,".").toLowerCase()},Ui=ki.data={},Li=ki.NATIVE="N",xi=ki.POLYFILL="P",Vi=ki,Fi=n,Bi=o.f,ji=Xt,Gi=Wt.exports,Hi=Ce,zi=Ni,Ki=Vi,Yi=function(e,t){var r,i,n,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?Fi:u?Fi[s]||Hi(s,{}):(Fi[s]||{}).prototype)for(i in t){if(o=t[i],n=e.noTargetGet?(a=Bi(r,i))&&a.value:r[i],!Ki(c?i:s+(u?".":"#")+i,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;zi(o,n)}(e.sham||n&&n.sham)&&ji(o,"sham",!0),Gi(r,i,o,e)}},Xi=n,Wi=B,Ji=Xi.String,qi=Xi.TypeError,Zi=I,$i=kt,Qi=function(e){if("object"==typeof e||Wi(e))return e;throw qi("Can't set "+Ji(e)+" as a prototype")},en=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Zi(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return $i(r),Qi(i),t?e(r,i):r.__proto__=i,r}}():void 0);Yi({target:"Object",stat:!0},{setPrototypeOf:en});var tn={},rn=fi,nn=_i,on=Object.keys||function(e){return rn(e,nn)},an=s,sn=Ot,cn=Ct,un=kt,dn=F,ln=on;tn.f=an&&!sn?Object.defineProperties:function(e,t){un(e);for(var r,i=dn(t),n=ln(t),o=n.length,a=0;o>a;)cn.f(e,r=n[a++],i[r]);return e};var hn,pn=Y("document","documentElement"),fn=kt,_n=tn,vn=_i,mn=dr,Sn=pn,En=_t,yn=ur("IE_PROTO"),gn=function(){},bn=function(e){return"<script>"+e+"</"+"script>"},Tn=function(e){e.write(bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},In=function(){try{hn=new ActiveXObject("htmlfile")}catch(e){}var e,t;In="undefined"!=typeof document?document.domain&&hn?Tn(hn):((t=En("iframe")).style.display="none",Sn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(bn("document.F=Object")),e.close(),e.F):Tn(hn);for(var r=vn.length;r--;)delete In.prototype[vn[r]];return In()};mn[yn]=!0;var Rn=Object.create||function(e,t){var r;return null!==e?(gn.prototype=fn(e),r=new gn,gn.prototype=null,r[yn]=e):r=In(),void 0===t?r:_n.f(r,t)};Yi({target:"Object",stat:!0,sham:!s},{create:Rn});var An=s,Cn=I,On=l,Nn=a,wn=on,Dn=Si,Pn=h,kn=Me,Mn=M,Un=Object.assign,Ln=Object.defineProperty,xn=Cn([].concat),Vn=!Un||Nn((function(){if(An&&1!==Un({b:1},Un(Ln({},"a",{enumerable:!0,get:function(){Ln(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!=Un({},e)[r]||wn(Un({},t)).join("")!=i}))?function(e,t){for(var r=kn(e),i=arguments.length,n=1,o=Dn.f,a=Pn.f;i>n;)for(var s,c=Mn(arguments[n++]),u=o?xn(wn(c),o(c)):wn(c),d=u.length,l=0;d>l;)s=u[l++],An&&!On(a,c,s)||(r[s]=c[s]);return r}:Un,Fn=Vn;Yi({target:"Object",stat:!0,forced:Object.assign!==Fn},{assign:Fn});var Bn=a,jn=function(e,t){var r=[][e];return!!r&&Bn((function(){r.call(null,t||function(){throw 1},1)}))},Gn=Yi,Hn=ci.indexOf,zn=jn,Kn=I([].indexOf),Yn=!!Kn&&1/Kn([1],1,-0)<0,Xn=zn("indexOf");Gn({target:"Array",proto:!0,forced:Yn||!Xn},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Yn?Kn(this,e,t)||0:Hn(this,e,t)}});var Wn=c,Jn=Function.prototype,qn=Jn.apply,Zn=Jn.call,$n="object"==typeof Reflect&&Reflect.apply||(Wn?Zn.bind(qn):function(){return Zn.apply(qn,arguments)}),Qn=O,eo=Array.isArray||function(e){return"Array"==Qn(e)},to={};to[Qe("toStringTag")]="z";var ro="[object z]"===String(to),io=n,no=ro,oo=B,ao=O,so=Qe("toStringTag"),co=io.Object,uo="Arguments"==ao(function(){return arguments}()),lo=no?ao:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=co(e),so))?r:uo?ao(t):"Object"==(i=ao(t))&&oo(t.callee)?"Arguments":i},ho=lo,po=n.String,fo=function(e){if("Symbol"===ho(e))throw TypeError("Cannot convert a Symbol value to a string");return po(e)},_o={},vo=lt,mo=Ct,So=S,Eo=function(e,t,r){var i=vo(t);i in e?mo.f(e,i,So(0,r)):e[i]=r},yo=$r,go=ii,bo=Eo,To=n.Array,Io=Math.max,Ro=function(e,t,r){for(var i=go(e),n=yo(t,i),o=yo(void 0===r?i:r,i),a=To(Io(o-n,0)),s=0;n<o;n++,s++)bo(a,s,e[n]);return a.length=s,a},Ao=O,Co=F,Oo=Kr.f,No=Ro,wo="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];_o.f=function(e){return wo&&"Window"==Ao(e)?function(e){try{return Oo(e)}catch(e){return No(wo)}}(e):Oo(Co(e))};var Do=I([].slice),Po={},ko=Qe;Po.f=ko;var Mo=n,Uo=xe,Lo=Po,xo=Ct.f,Vo=function(e){var t=Mo.Symbol||(Mo.Symbol={});Uo(t,e)||xo(t,e,{value:Lo.f(e)})},Fo=Ct.f,Bo=xe,jo=Qe("toStringTag"),Go=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Bo(e,jo)&&Fo(e,jo,{configurable:!0,value:t})},Ho=me,zo=c,Ko=I(I.bind),Yo=function(e,t){return Ho(e),void 0===t?e:zo?Ko(e,t):function(){return e.apply(t,arguments)}},Xo=I,Wo=a,Jo=B,qo=lo,Zo=tr,$o=function(){},Qo=[],ea=Y("Reflect","construct"),ta=/^\s*(?:class|function)\b/,ra=Xo(ta.exec),ia=!ta.exec($o),na=function(e){if(!Jo(e))return!1;try{return ea($o,Qo,e),!0}catch(e){return!1}},oa=function(e){if(!Jo(e))return!1;switch(qo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ia||!!ra(ta,Zo(e))}catch(e){return!0}};oa.sham=!0;var aa=!ea||Wo((function(){var e;return na(na.call)||!na(Object)||!na((function(){e=!0}))||e}))?oa:na,sa=n,ca=eo,ua=aa,da=G,la=Qe("species"),ha=sa.Array,pa=function(e){var t;return ca(e)&&(t=e.constructor,(ua(t)&&(t===ha||ca(t.prototype))||da(t)&&null===(t=t[la]))&&(t=void 0)),void 0===t?ha:t},fa=function(e,t){return new(pa(e))(0===t?0:t)},_a=Yo,va=M,ma=Me,Sa=ii,Ea=fa,ya=I([].push),ga=function(e){var t=1==e,r=2==e,i=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=ma(c),_=va(f),v=_a(u,d),m=Sa(_),S=0,E=l||Ea,y=t?E(c,m):r||a?E(c,0):void 0;m>S;S++)if((s||S in _)&&(p=v(h=_[S],S,f),e))if(t)y[S]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return S;case 2:ya(y,h)}else switch(e){case 4:return!1;case 7:ya(y,h)}return o?-1:i||n?n:y}},ba={forEach:ga(0),map:ga(1),filter:ga(2),some:ga(3),every:ga(4),find:ga(5),findIndex:ga(6),filterReject:ga(7)},Ta=Yi,Ia=n,Ra=Y,Aa=$n,Ca=l,Oa=I,Na=s,wa=ne,Da=a,Pa=xe,ka=eo,Ma=B,Ua=G,La=X,xa=le,Va=kt,Fa=Me,Ba=F,ja=lt,Ga=fo,Ha=S,za=Rn,Ka=on,Ya=Kr,Xa=_o,Wa=Si,Ja=o,qa=Ct,Za=tn,$a=h,Qa=Do,es=Wt.exports,ts=Ie.exports,rs=dr,is=Ge,ns=Qe,os=Po,as=Vo,ss=Go,cs=Or,us=ba.forEach,ds=ur("hidden"),ls="Symbol",hs=ns("toPrimitive"),ps=cs.set,fs=cs.getterFor(ls),_s=Object.prototype,vs=Ia.Symbol,ms=vs&&vs.prototype,Ss=Ia.TypeError,Es=Ia.QObject,ys=Ra("JSON","stringify"),gs=Ja.f,bs=qa.f,Ts=Xa.f,Is=$a.f,Rs=Oa([].push),As=ts("symbols"),Cs=ts("op-symbols"),Os=ts("string-to-symbol-registry"),Ns=ts("symbol-to-string-registry"),ws=ts("wks"),Ds=!Es||!Es.prototype||!Es.prototype.findChild,Ps=Na&&Da((function(){return 7!=za(bs({},"a",{get:function(){return bs(this,"a",{value:7}).a}})).a}))?function(e,t,r){var i=gs(_s,t);i&&delete _s[t],bs(e,t,r),i&&e!==_s&&bs(_s,t,i)}:bs,ks=function(e,t){var r=As[e]=za(ms);return ps(r,{type:ls,tag:e,description:t}),Na||(r.description=t),r},Ms=function(e,t,r){e===_s&&Ms(Cs,t,r),Va(e);var i=ja(t);return Va(r),Pa(As,i)?(r.enumerable?(Pa(e,ds)&&e[ds][i]&&(e[ds][i]=!1),r=za(r,{enumerable:Ha(0,!1)})):(Pa(e,ds)||bs(e,ds,Ha(1,{})),e[ds][i]=!0),Ps(e,i,r)):bs(e,i,r)},Us=function(e,t){Va(e);var r=Ba(t),i=Ka(r).concat(Fs(r));return us(i,(function(t){Na&&!Ca(Ls,r,t)||Ms(e,t,r[t])})),e},Ls=function(e){var t=ja(e),r=Ca(Is,this,t);return!(this===_s&&Pa(As,t)&&!Pa(Cs,t))&&(!(r||!Pa(this,t)||!Pa(As,t)||Pa(this,ds)&&this[ds][t])||r)},xs=function(e,t){var r=Ba(e),i=ja(t);if(r!==_s||!Pa(As,i)||Pa(Cs,i)){var n=gs(r,i);return!n||!Pa(As,i)||Pa(r,ds)&&r[ds][i]||(n.enumerable=!0),n}},Vs=function(e){var t=Ts(Ba(e)),r=[];return us(t,(function(e){Pa(As,e)||Pa(rs,e)||Rs(r,e)})),r},Fs=function(e){var t=e===_s,r=Ts(t?Cs:Ba(e)),i=[];return us(r,(function(e){!Pa(As,e)||t&&!Pa(_s,e)||Rs(i,As[e])})),i};(wa||(vs=function(){if(La(ms,this))throw Ss("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Ga(arguments[0]):void 0,t=is(e),r=function(e){this===_s&&Ca(r,Cs,e),Pa(this,ds)&&Pa(this[ds],t)&&(this[ds][t]=!1),Ps(this,t,Ha(1,e))};return Na&&Ds&&Ps(_s,t,{configurable:!0,set:r}),ks(t,e)},es(ms=vs.prototype,"toString",(function(){return fs(this).tag})),es(vs,"withoutSetter",(function(e){return ks(is(e),e)})),$a.f=Ls,qa.f=Ms,Za.f=Us,Ja.f=xs,Ya.f=Xa.f=Vs,Wa.f=Fs,os.f=function(e){return ks(ns(e),e)},Na&&(bs(ms,"description",{configurable:!0,get:function(){return fs(this).description}}),es(_s,"propertyIsEnumerable",Ls,{unsafe:!0}))),Ta({global:!0,wrap:!0,forced:!wa,sham:!wa},{Symbol:vs}),us(Ka(ws),(function(e){as(e)})),Ta({target:ls,stat:!0,forced:!wa},{for:function(e){var t=Ga(e);if(Pa(Os,t))return Os[t];var r=vs(t);return Os[t]=r,Ns[r]=t,r},keyFor:function(e){if(!xa(e))throw Ss(e+" is not a symbol");if(Pa(Ns,e))return Ns[e]},useSetter:function(){Ds=!0},useSimple:function(){Ds=!1}}),Ta({target:"Object",stat:!0,forced:!wa,sham:!Na},{create:function(e,t){return void 0===t?za(e):Us(za(e),t)},defineProperty:Ms,defineProperties:Us,getOwnPropertyDescriptor:xs}),Ta({target:"Object",stat:!0,forced:!wa},{getOwnPropertyNames:Vs,getOwnPropertySymbols:Fs}),Ta({target:"Object",stat:!0,forced:Da((function(){Wa.f(1)}))},{getOwnPropertySymbols:function(e){return Wa.f(Fa(e))}}),ys)&&Ta({target:"JSON",stat:!0,forced:!wa||Da((function(){var e=vs();return"[null]"!=ys([e])||"{}"!=ys({a:e})||"{}"!=ys(Object(e))}))},{stringify:function(e,t,r){var i=Qa(arguments),n=t;if((Ua(t)||void 0!==e)&&!xa(e))return ka(t)||(t=function(e,t){if(Ma(n)&&(t=Ca(n,this,e,t)),!xa(t))return t}),i[1]=t,Aa(ys,null,i)}});if(!ms[hs]){var Bs=ms.valueOf;es(ms,hs,(function(e){return Ca(Bs,this)}))}ss(vs,ls),rs[ds]=!0;var js=Yi,Gs=a,Hs=F,zs=o.f,Ks=s,Ys=Gs((function(){zs(1)}));js({target:"Object",stat:!0,forced:!Ks||Ys,sham:!Ks},{getOwnPropertyDescriptor:function(e,t){return zs(Hs(e),t)}});var Xs=lo,Ws=ro?{}.toString:function(){return"[object "+Xs(this)+"]"},Js=ro,qs=Wt.exports,Zs=Ws;Js||qs(Object.prototype,"toString",Zs,{unsafe:!0});var $s=Yi,Qs=s,ec=Ct.f;$s({target:"Object",stat:!0,forced:Object.defineProperty!==ec,sham:!Qs},{defineProperty:ec});var tc=n.Promise,rc=Wt.exports,ic=function(e,t,r){for(var i in t)rc(e,i,t[i],r);return e},nc=Y,oc=Ct,ac=s,sc=Qe("species"),cc=function(e){var t=nc(e),r=oc.f;ac&&t&&!t[sc]&&r(t,sc,{configurable:!0,get:function(){return this}})},uc=X,dc=n.TypeError,lc=function(e,t){if(uc(t,e))return e;throw dc("Incorrect invocation")},hc={},pc=hc,fc=Qe("iterator"),_c=Array.prototype,vc=function(e){return void 0!==e&&(pc.Array===e||_c[fc]===e)},mc=lo,Sc=Ee,Ec=hc,yc=Qe("iterator"),gc=function(e){if(null!=e)return Sc(e,yc)||Sc(e,"@@iterator")||Ec[mc(e)]},bc=l,Tc=me,Ic=kt,Rc=pe,Ac=gc,Cc=n.TypeError,Oc=function(e,t){var r=arguments.length<2?Ac(e):t;if(Tc(r))return Ic(bc(r,e));throw Cc(Rc(e)+" is not iterable")},Nc=l,wc=kt,Dc=Ee,Pc=function(e,t,r){var i,n;wc(e);try{if(!(i=Dc(e,"return"))){if("throw"===t)throw r;return r}i=Nc(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return wc(i),r},kc=Yo,Mc=l,Uc=kt,Lc=pe,xc=vc,Vc=ii,Fc=X,Bc=Oc,jc=gc,Gc=Pc,Hc=n.TypeError,zc=function(e,t){this.stopped=e,this.result=t},Kc=zc.prototype,Yc=function(e,t,r){var i,n,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),f=kc(t,d),_=function(e){return i&&Gc(i,"normal",e),new zc(!0,e)},v=function(e){return l?(Uc(e),p?f(e[0],e[1],_):f(e[0],e[1])):p?f(e,_):f(e)};if(h)i=e;else{if(!(n=jc(e)))throw Hc(Lc(e)+" is not iterable");if(xc(n)){for(o=0,a=Vc(e);a>o;o++)if((s=v(e[o]))&&Fc(Kc,s))return s;return new zc(!1)}i=Bc(e,n)}for(c=i.next;!(u=Mc(c,i)).done;){try{s=v(u.value)}catch(e){Gc(i,"throw",e)}if("object"==typeof s&&s&&Fc(Kc,s))return s}return new zc(!1)},Xc=Qe("iterator"),Wc=!1;try{var Jc=0,qc={next:function(){return{done:!!Jc++}},return:function(){Wc=!0}};qc[Xc]=function(){return this},Array.from(qc,(function(){throw 2}))}catch(e){}var Zc,$c,Qc,eu,tu=function(e,t){if(!t&&!Wc)return!1;var r=!1;try{var i={};i[Xc]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},ru=aa,iu=pe,nu=n.TypeError,ou=function(e){if(ru(e))return e;throw nu(iu(e)+" is not a constructor")},au=kt,su=ou,cu=Qe("species"),uu=function(e,t){var r,i=au(e).constructor;return void 0===i||null==(r=au(i)[cu])?t:su(r)},du=n.TypeError,lu=function(e,t){if(e<t)throw du("Not enough arguments");return e},hu=/(?:ipad|iphone|ipod).*applewebkit/i.test(W),pu="process"==O(n.process),fu=n,_u=$n,vu=Yo,mu=B,Su=xe,Eu=a,yu=pn,gu=Do,bu=_t,Tu=lu,Iu=hu,Ru=pu,Au=fu.setImmediate,Cu=fu.clearImmediate,Ou=fu.process,Nu=fu.Dispatch,wu=fu.Function,Du=fu.MessageChannel,Pu=fu.String,ku=0,Mu={},Uu="onreadystatechange";try{Zc=fu.location}catch(e){}var Lu=function(e){if(Su(Mu,e)){var t=Mu[e];delete Mu[e],t()}},xu=function(e){return function(){Lu(e)}},Vu=function(e){Lu(e.data)},Fu=function(e){fu.postMessage(Pu(e),Zc.protocol+"//"+Zc.host)};Au&&Cu||(Au=function(e){Tu(arguments.length,1);var t=mu(e)?e:wu(e),r=gu(arguments,1);return Mu[++ku]=function(){_u(t,void 0,r)},$c(ku),ku},Cu=function(e){delete Mu[e]},Ru?$c=function(e){Ou.nextTick(xu(e))}:Nu&&Nu.now?$c=function(e){Nu.now(xu(e))}:Du&&!Iu?(eu=(Qc=new Du).port2,Qc.port1.onmessage=Vu,$c=vu(eu.postMessage,eu)):fu.addEventListener&&mu(fu.postMessage)&&!fu.importScripts&&Zc&&"file:"!==Zc.protocol&&!Eu(Fu)?($c=Fu,fu.addEventListener("message",Vu,!1)):$c=Uu in bu("script")?function(e){yu.appendChild(bu("script")).onreadystatechange=function(){yu.removeChild(this),Lu(e)}}:function(e){setTimeout(xu(e),0)});var Bu,ju,Gu,Hu,zu,Ku,Yu,Xu,Wu={set:Au,clear:Cu},Ju=n,qu=/ipad|iphone|ipod/i.test(W)&&void 0!==Ju.Pebble,Zu=/web0s(?!.*chrome)/i.test(W),$u=n,Qu=Yo,ed=o.f,td=Wu.set,rd=hu,id=qu,nd=Zu,od=pu,ad=$u.MutationObserver||$u.WebKitMutationObserver,sd=$u.document,cd=$u.process,ud=$u.Promise,dd=ed($u,"queueMicrotask"),ld=dd&&dd.value;ld||(Bu=function(){var e,t;for(od&&(e=cd.domain)&&e.exit();ju;){t=ju.fn,ju=ju.next;try{t()}catch(e){throw ju?Hu():Gu=void 0,e}}Gu=void 0,e&&e.enter()},rd||od||nd||!ad||!sd?!id&&ud&&ud.resolve?((Yu=ud.resolve(void 0)).constructor=ud,Xu=Qu(Yu.then,Yu),Hu=function(){Xu(Bu)}):od?Hu=function(){cd.nextTick(Bu)}:(td=Qu(td,$u),Hu=function(){td(Bu)}):(zu=!0,Ku=sd.createTextNode(""),new ad(Bu).observe(Ku,{characterData:!0}),Hu=function(){Ku.data=zu=!zu}));var hd=ld||function(e){var t={fn:e,next:void 0};Gu&&(Gu.next=t),ju||(ju=t,Hu()),Gu=t},pd={},fd=me,_d=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=i})),this.resolve=fd(t),this.reject=fd(r)};pd.f=function(e){return new _d(e)};var vd=kt,md=G,Sd=pd,Ed=function(e,t){if(vd(e),md(t)&&t.constructor===e)return t;var r=Sd.f(e);return(0,r.resolve)(t),r.promise},yd=n,gd=function(){this.head=null,this.tail=null};gd.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 bd,Td,Id,Rd,Ad=gd,Cd="object"==typeof window,Od=Yi,Nd=n,wd=Y,Dd=l,Pd=tc,kd=Wt.exports,Md=ic,Ud=en,Ld=Go,xd=cc,Vd=me,Fd=B,Bd=G,jd=lc,Gd=tr,Hd=Yc,zd=tu,Kd=uu,Yd=Wu.set,Xd=hd,Wd=Ed,Jd=function(e,t){var r=yd.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},qd=pd,Zd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},$d=Ad,Qd=Or,el=Vi,tl=Cd,rl=pu,il=te,nl=Qe("species"),ol="Promise",al=Qd.getterFor(ol),sl=Qd.set,cl=Qd.getterFor(ol),ul=Pd&&Pd.prototype,dl=Pd,ll=ul,hl=Nd.TypeError,pl=Nd.document,fl=Nd.process,_l=qd.f,vl=_l,ml=!!(pl&&pl.createEvent&&Nd.dispatchEvent),Sl=Fd(Nd.PromiseRejectionEvent),El="unhandledrejection",yl=!1,gl=el(ol,(function(){var e=Gd(dl),t=e!==String(dl);if(!t&&66===il)return!0;if(il>=51&&/native code/.test(e))return!1;var r=new dl((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};return(r.constructor={})[nl]=i,!(yl=r.then((function(){}))instanceof i)||!t&&tl&&!Sl})),bl=gl||!zd((function(e){dl.all(e).catch((function(){}))})),Tl=function(e){var t;return!(!Bd(e)||!Fd(t=e.then))&&t},Il=function(e,t){var r,i,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&&Nl(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),n=!0)),r===e.promise?u(hl("Promise-chain cycle")):(i=Tl(r))?Dd(i,r,c,u):c(r)):u(o)}catch(e){d&&!n&&d.exit(),u(e)}},Rl=function(e,t){e.notified||(e.notified=!0,Xd((function(){for(var r,i=e.reactions;r=i.get();)Il(r,e);e.notified=!1,t&&!e.rejection&&Cl(e)})))},Al=function(e,t,r){var i,n;ml?((i=pl.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),Nd.dispatchEvent(i)):i={promise:t,reason:r},!Sl&&(n=Nd["on"+e])?n(i):e===El&&Jd("Unhandled promise rejection",r)},Cl=function(e){Dd(Yd,Nd,(function(){var t,r=e.facade,i=e.value;if(Ol(e)&&(t=Zd((function(){rl?fl.emit("unhandledRejection",i,r):Al(El,r,i)})),e.rejection=rl||Ol(e)?2:1,t.error))throw t.value}))},Ol=function(e){return 1!==e.rejection&&!e.parent},Nl=function(e){Dd(Yd,Nd,(function(){var t=e.facade;rl?fl.emit("rejectionHandled",t):Al("rejectionhandled",t,e.value)}))},wl=function(e,t,r){return function(i){e(t,i,r)}},Dl=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Rl(e,!0))},Pl=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw hl("Promise can't be resolved itself");var i=Tl(t);i?Xd((function(){var r={done:!1};try{Dd(i,t,wl(Pl,r,e),wl(Dl,r,e))}catch(t){Dl(r,t,e)}})):(e.value=t,e.state=1,Rl(e,!1))}catch(t){Dl({done:!1},t,e)}}};if(gl&&(ll=(dl=function(e){jd(this,ll),Vd(e),Dd(bd,this);var t=al(this);try{e(wl(Pl,t),wl(Dl,t))}catch(e){Dl(t,e)}}).prototype,(bd=function(e){sl(this,{type:ol,done:!1,notified:!1,parent:!1,reactions:new $d,rejection:!1,state:0,value:void 0})}).prototype=Md(ll,{then:function(e,t){var r=cl(this),i=_l(Kd(this,dl));return r.parent=!0,i.ok=!Fd(e)||e,i.fail=Fd(t)&&t,i.domain=rl?fl.domain:void 0,0==r.state?r.reactions.add(i):Xd((function(){Il(i,r)})),i.promise},catch:function(e){return this.then(void 0,e)}}),Td=function(){var e=new bd,t=al(e);this.promise=e,this.resolve=wl(Pl,t),this.reject=wl(Dl,t)},qd.f=_l=function(e){return e===dl||e===Id?new Td(e):vl(e)},Fd(Pd)&&ul!==Object.prototype)){Rd=ul.then,yl||(kd(ul,"then",(function(e,t){var r=this;return new dl((function(e,t){Dd(Rd,r,e,t)})).then(e,t)}),{unsafe:!0}),kd(ul,"catch",ll.catch,{unsafe:!0}));try{delete ul.constructor}catch(e){}Ud&&Ud(ul,ll)}Od({global:!0,wrap:!0,forced:gl},{Promise:dl}),Ld(dl,ol,!1),xd(ol),Id=wd(ol),Od({target:ol,stat:!0,forced:gl},{reject:function(e){var t=_l(this);return Dd(t.reject,void 0,e),t.promise}}),Od({target:ol,stat:!0,forced:gl},{resolve:function(e){return Wd(this,e)}}),Od({target:ol,stat:!0,forced:bl},{all:function(e){var t=this,r=_l(t),i=r.resolve,n=r.reject,o=Zd((function(){var r=Vd(t.resolve),o=[],a=0,s=1;Hd(e,(function(e){var c=a++,u=!1;s++,Dd(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||i(o))}),n)})),--s||i(o)}));return o.error&&n(o.value),r.promise},race:function(e){var t=this,r=_l(t),i=r.reject,n=Zd((function(){var n=Vd(t.resolve);Hd(e,(function(e){Dd(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var kl=Yi,Ml=s,Ul=n,Ll=I,xl=xe,Vl=B,Fl=X,Bl=fo,jl=Ct.f,Gl=Ni,Hl=Ul.Symbol,zl=Hl&&Hl.prototype;if(Ml&&Vl(Hl)&&(!("description"in zl)||void 0!==Hl().description)){var Kl={},Yl=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:Bl(arguments[0]),t=Fl(zl,this)?new Hl(e):void 0===e?Hl():Hl(e);return""===e&&(Kl[t]=!0),t};Gl(Yl,Hl),Yl.prototype=zl,zl.constructor=Yl;var Xl="Symbol(test)"==String(Hl("test")),Wl=Ll(zl.toString),Jl=Ll(zl.valueOf),ql=/^Symbol\((.*)\)[^)]+$/,Zl=Ll("".replace),$l=Ll("".slice);jl(zl,"description",{configurable:!0,get:function(){var e=Jl(this),t=Wl(e);if(xl(Kl,e))return"";var r=Xl?$l(t,7,-1):Zl(t,ql,"$1");return""===r?void 0:r}}),kl({global:!0,forced:!0},{Symbol:Yl})}Vo("iterator");var Ql=Rn,eh=Ct,th=Qe("unscopables"),rh=Array.prototype;null==rh[th]&&eh.f(rh,th,{configurable:!0,value:Ql(null)});var ih,nh,oh,ah=function(e){rh[th][e]=!0},sh=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),ch=n,uh=xe,dh=B,lh=Me,hh=sh,ph=ur("IE_PROTO"),fh=ch.Object,_h=fh.prototype,vh=hh?fh.getPrototypeOf:function(e){var t=lh(e);if(uh(t,ph))return t[ph];var r=t.constructor;return dh(r)&&t instanceof r?r.prototype:t instanceof fh?_h:null},mh=a,Sh=B,Eh=vh,yh=Wt.exports,gh=Qe("iterator"),bh=!1;[].keys&&("next"in(oh=[].keys())?(nh=Eh(Eh(oh)))!==Object.prototype&&(ih=nh):bh=!0);var Th=null==ih||mh((function(){var e={};return ih[gh].call(e)!==e}));Th&&(ih={}),Sh(ih[gh])||yh(ih,gh,(function(){return this}));var Ih={IteratorPrototype:ih,BUGGY_SAFARI_ITERATORS:bh},Rh=Ih.IteratorPrototype,Ah=Rn,Ch=S,Oh=Go,Nh=hc,wh=function(){return this},Dh=function(e,t,r,i){var n=t+" Iterator";return e.prototype=Ah(Rh,{next:Ch(+!i,r)}),Oh(e,n,!1),Nh[n]=wh,e},Ph=Yi,kh=l,Mh=Mr,Uh=B,Lh=Dh,xh=vh,Vh=en,Fh=Go,Bh=Xt,jh=Wt.exports,Gh=hc,Hh=Mh.PROPER,zh=Mh.CONFIGURABLE,Kh=Ih.IteratorPrototype,Yh=Ih.BUGGY_SAFARI_ITERATORS,Xh=Qe("iterator"),Wh="keys",Jh="values",qh="entries",Zh=function(){return this},$h=function(e,t,r,i,n,o,a){Lh(r,t,i);var s,c,u,d=function(e){if(e===n&&_)return _;if(!Yh&&e in p)return p[e];switch(e){case Wh:case Jh:case qh:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[Xh]||p["@@iterator"]||n&&p[n],_=!Yh&&f||d(n),v="Array"==t&&p.entries||f;if(v&&(s=xh(v.call(new e)))!==Object.prototype&&s.next&&(xh(s)!==Kh&&(Vh?Vh(s,Kh):Uh(s[Xh])||jh(s,Xh,Zh)),Fh(s,l,!0)),Hh&&n==Jh&&f&&f.name!==Jh&&(zh?Bh(p,"name",Jh):(h=!0,_=function(){return kh(f,this)})),n)if(c={values:d(Jh),keys:o?_:d(Wh),entries:d(qh)},a)for(u in c)(Yh||h||!(u in p))&&jh(p,u,c[u]);else Ph({target:t,proto:!0,forced:Yh||h},c);return p[Xh]!==_&&jh(p,Xh,_,{name:n}),Gh[t]=_,c},Qh=F,ep=ah,tp=hc,rp=Or,ip=Ct.f,np=$h,op=s,ap="Array Iterator",sp=rp.set,cp=rp.getterFor(ap),up=np(Array,"Array",(function(e,t){sp(this,{type:ap,target:Qh(e),index:0,kind:t})}),(function(){var e=cp(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:i,done:!1}:"values"==r?{value:t[i],done:!1}:{value:[i,t[i]],done:!1}}),"values"),dp=tp.Arguments=tp.Array;if(ep("keys"),ep("values"),ep("entries"),op&&"values"!==dp.name)try{ip(dp,"name",{value:"values"})}catch(e){}var lp=I,hp=Wr,pp=fo,fp=L,_p=lp("".charAt),vp=lp("".charCodeAt),mp=lp("".slice),Sp=function(e){return function(t,r){var i,n,o=pp(fp(t)),a=hp(r),s=o.length;return a<0||a>=s?e?"":void 0:(i=vp(o,a))<55296||i>56319||a+1===s||(n=vp(o,a+1))<56320||n>57343?e?_p(o,a):i:e?mp(o,a,a+2):n-56320+(i-55296<<10)+65536}},Ep={codeAt:Sp(!1),charAt:Sp(!0)},yp=Ep.charAt,gp=fo,bp=Or,Tp=$h,Ip="String Iterator",Rp=bp.set,Ap=bp.getterFor(Ip);Tp(String,"String",(function(e){Rp(this,{type:Ip,string:gp(e),index:0})}),(function(){var e,t=Ap(this),r=t.string,i=t.index;return i>=r.length?{value:void 0,done:!0}:(e=yp(r,i),t.index+=e.length,{value:e,done:!1})}));var Cp={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},Op=_t("span").classList,Np=Op&&Op.constructor&&Op.constructor.prototype,wp=Np===Object.prototype?void 0:Np,Dp=n,Pp=Cp,kp=wp,Mp=up,Up=Xt,Lp=Qe,xp=Lp("iterator"),Vp=Lp("toStringTag"),Fp=Mp.values,Bp=function(e,t){if(e){if(e[xp]!==Fp)try{Up(e,xp,Fp)}catch(t){e[xp]=Fp}if(e[Vp]||Up(e,Vp,t),Pp[t])for(var r in Mp)if(e[r]!==Mp[r])try{Up(e,r,Mp[r])}catch(t){e[r]=Mp[r]}}};for(var jp in Pp)Bp(Dp[jp]&&Dp[jp].prototype,jp);Bp(kp,"DOMTokenList");var Gp=a,Hp=te,zp=Qe("species"),Kp=function(e){return Hp>=51||!Gp((function(){var t=[];return(t.constructor={})[zp]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Yp=Yi,Xp=n,Wp=a,Jp=eo,qp=G,Zp=Me,$p=ii,Qp=Eo,ef=fa,tf=Kp,rf=te,nf=Qe("isConcatSpreadable"),of=9007199254740991,af="Maximum allowed index exceeded",sf=Xp.TypeError,cf=rf>=51||!Wp((function(){var e=[];return e[nf]=!1,e.concat()[0]!==e})),uf=tf("concat"),df=function(e){if(!qp(e))return!1;var t=e[nf];return void 0!==t?!!t:Jp(e)};Yp({target:"Array",proto:!0,forced:!cf||!uf},{concat:function(e){var t,r,i,n,o,a=Zp(this),s=ef(a,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(df(o=-1===t?a:arguments[t])){if(c+(n=$p(o))>of)throw sf(af);for(r=0;r<n;r++,c++)r in o&&Qp(s,c,o[r])}else{if(c>=of)throw sf(af);Qp(s,c++,o)}return s.length=c,s}});var lf=Yi,hf=n,pf=eo,ff=aa,_f=G,vf=$r,mf=ii,Sf=F,Ef=Eo,yf=Qe,gf=Do,bf=Kp("slice"),Tf=yf("species"),If=hf.Array,Rf=Math.max;lf({target:"Array",proto:!0,forced:!bf},{slice:function(e,t){var r,i,n,o=Sf(this),a=mf(o),s=vf(e,a),c=vf(void 0===t?a:t,a);if(pf(o)&&(r=o.constructor,(ff(r)&&(r===If||pf(r.prototype))||_f(r)&&null===(r=r[Tf]))&&(r=void 0),r===If||void 0===r))return gf(o,s,c);for(i=new(void 0===r?If:r)(Rf(c-s,0)),n=0;s<c;s++,n++)s in o&&Ef(i,n,o[s]);return i.length=n,i}}),Vo("asyncIterator");var Af=function(e,t){return Af=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Af(e,t)};function Cf(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Af(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Of,Nf,wf,Df,Pf,kf,Mf,Uf,Lf,xf,Vf,Ff,Bf,jf,Gf,Hf,zf,Kf,Yf,Xf,Wf,Jf=function(){return Jf=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Jf.apply(this,arguments)};function qf(e,r,i,n){var o,a=arguments.length,s=a<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,i):n;if("object"===("undefined"==typeof Reflect?"undefined":t(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,i,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(s=(a<3?o(s):a>3?o(r,i,s):o(r,i))||s);return a>3&&s&&Object.defineProperty(r,i,s),s}function Zf(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function $f(e,t){var r,i,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=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++,i=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],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function Qf(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function e_(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function t_(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}!function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(Of||(Of={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(Nf||(Nf={})),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"}(wf||(wf={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(Df||(Df={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(Pf||(Pf={})),function(e){e[e.MUTE_STATE_OFF=0]="MUTE_STATE_OFF",e[e.MUTE_STATE_ON=1]="MUTE_STATE_ON"}(kf||(kf={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(Mf||(Mf={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(Uf||(Uf={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(Lf||(Lf={})),function(e){e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO=0]="RTC_PAUSE_RESUME_CONTROL_AUDIO",e[e.RTC_PAUSE_RESUME_CONTROL_VIDEO=1]="RTC_PAUSE_RESUME_CONTROL_VIDEO",e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO=2]="RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO"}(xf||(xf={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(Vf||(Vf={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(Ff||(Ff={})),function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_AND_VIDEO=2]="AUDIO_AND_VIDEO",e[e.NONE=3]="NONE"}(Bf||(Bf={})),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"}(jf||(jf={})),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"}(Gf||(Gf={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(Hf||(Hf={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(zf||(zf={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(Kf||(Kf={})),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"}(Yf||(Yf={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(Xf||(Xf={})),function(e){e.AUTO="auto",e.FORCE_TCP="forceTCP",e.FORCE_UDP="forceUDP"}(Wf||(Wf={}));var r_,i_,n_,o_=Object.freeze({__proto__:null,get VideoSourceType(){return Of},get AudioSourceType(){return Nf},get UserOfflineReason(){return wf},get ChannelProfile(){return Df},get SubscribeMode(){return Pf},get MuteState(){return kf},get SubscribeState(){return Mf},get PublishState(){return Uf},get MirrorMode(){return Lf},get PauseResumeControlMediaType(){return xf},get VideoRenderMode(){return Vf},get StreamIndex(){return Ff},get SubscribeMediaType(){return Bf},get StreamRemoveReason(){return jf},get ConnectionState(){return Gf},get MirrorType(){return Hf},get LogChannel(){return zf},get USER_ONLINE_STATUS(){return Kf},get PublicStreamType(){return Yf},get PublicInterpolationMode(){return Xf},get ConnectionMode(){return Wf}});!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"}(r_||(r_={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(i_||(i_={})),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"}(n_||(n_={}));var a_,s_=Object.freeze({__proto__:null,get AudioMixingDualMonoMode(){return r_},get AudioMixingType(){return i_},get AudioMixingState(){return n_}});!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onStreamAdd="onStreamAdd",e.onStreamRemove="onStreamRemove",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onUserMuteAudio="onUserMuteAudio",e.onUserMuteVideo="onUserMuteVideo",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onMediaDeviceStateChanged="onMediaDeviceStateChanged",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.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"}(a_||(a_={}));var c_=ba.forEach,u_=jn("forEach")?[].forEach:function(e){return c_(this,e,arguments.length>1?arguments[1]:void 0)};Yi({target:"Array",proto:!0,forced:[].forEach!=u_},{forEach:u_});var d_=n,l_=Cp,h_=wp,p_=u_,f_=Xt,__=function(e){if(e&&e.forEach!==p_)try{f_(e,"forEach",p_)}catch(t){e.forEach=p_}};for(var v_ in l_)l_[v_]&&__(d_[v_]&&d_[v_].prototype);__(h_);var m_=Yi,S_=I,E_=n.Date,y_=S_(E_.prototype.getTime);m_({target:"Date",stat:!0},{now:function(){return y_(new E_)}});var g_=I,b_=Wt.exports,T_=Date.prototype,I_="Invalid Date",R_="toString",A_=g_(T_.toString),C_=g_(T_.getTime);String(new Date(NaN))!=I_&&b_(T_,R_,(function(){var e=C_(this);return e==e?A_(this):I_}));var O_=ci.includes,N_=ah;Yi({target:"Array",proto:!0},{includes:function(e){return O_(this,e,arguments.length>1?arguments[1]:void 0)}}),N_("includes");var w_=G,D_=O,P_=Qe("match"),k_=function(e){var t;return w_(e)&&(void 0!==(t=e[P_])?!!t:"RegExp"==D_(e))},M_=k_,U_=n.TypeError,L_=function(e){if(M_(e))throw U_("The method doesn't accept regular expressions");return e},x_=Qe("match"),V_=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[x_]=!1,"/./"[e](t)}catch(e){}}return!1},F_=Yi,B_=L_,j_=L,G_=fo,H_=V_,z_=I("".indexOf);F_({target:"String",proto:!0,forced:!H_("includes")},{includes:function(e){return!!~z_(G_(j_(this)),G_(B_(e)),arguments.length>1?arguments[1]:void 0)}});var K_=kt,Y_=function(){var e=K_(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},X_=a,W_=n.RegExp,J_=X_((function(){var e=W_("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),q_=J_||X_((function(){return!W_("a","y").sticky})),Z_={BROKEN_CARET:J_||X_((function(){var e=W_("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:q_,UNSUPPORTED_Y:J_},$_=a,Q_=n.RegExp,ev=$_((function(){var e=Q_(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),tv=a,rv=n.RegExp,iv=tv((function(){var e=rv("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),nv=l,ov=I,av=fo,sv=Y_,cv=Z_,uv=Ie.exports,dv=Rn,lv=Or.get,hv=ev,pv=iv,fv=uv("native-string-replace",String.prototype.replace),_v=RegExp.prototype.exec,vv=_v,mv=ov("".charAt),Sv=ov("".indexOf),Ev=ov("".replace),yv=ov("".slice),gv=function(){var e=/a/,t=/b*/g;return nv(_v,e,"a"),nv(_v,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),bv=cv.BROKEN_CARET,Tv=void 0!==/()??/.exec("")[1];(gv||Tv||bv||hv||pv)&&(vv=function(e){var t,r,i,n,o,a,s,c=this,u=lv(c),d=av(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=nv(vv,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=bv&&c.sticky,f=nv(sv,c),_=c.source,v=0,m=d;if(p&&(f=Ev(f,"y",""),-1===Sv(f,"g")&&(f+="g"),m=yv(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==mv(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",f)),Tv&&(r=new RegExp("^"+_+"$(?!\\s)",f)),gv&&(i=c.lastIndex),n=nv(_v,p?r:c,m),p?n?(n.input=yv(n.input,v),n[0]=yv(n[0],v),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:gv&&n&&(c.lastIndex=c.global?n.index+n[0].length:i),Tv&&n&&n.length>1&&nv(fv,n[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n&&h)for(n.groups=a=dv(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=n[s[1]];return n});var Iv=vv;Yi({target:"RegExp",proto:!0,forced:/./.exec!==Iv},{exec:Iv});var Rv=I,Av=Wt.exports,Cv=Iv,Ov=a,Nv=Qe,wv=Xt,Dv=Nv("species"),Pv=RegExp.prototype,kv=function(e,t,r,i){var n=Nv(e),o=!Ov((function(){var t={};return t[n]=function(){return 7},7!=""[e](t)})),a=o&&!Ov((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Dv]=function(){return r},r.flags="",r[n]=/./[n]),r.exec=function(){return t=!0,null},r[n](""),!t}));if(!o||!a||r){var s=Rv(/./[n]),c=t(n,""[e],(function(e,t,r,i,n){var a=Rv(e),c=t.exec;return c===Cv||c===Pv.exec?o&&!n?{done:!0,value:s(t,r,i)}:{done:!0,value:a(r,t,i)}:{done:!1}}));Av(String.prototype,e,c[0]),Av(Pv,n,c[1])}i&&wv(Pv[n],"sham",!0)},Mv=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Uv=l,Lv=kt,xv=B,Vv=O,Fv=Iv,Bv=n.TypeError,jv=function(e,t){var r=e.exec;if(xv(r)){var i=Uv(r,e,t);return null!==i&&Lv(i),i}if("RegExp"===Vv(e))return Uv(Fv,e,t);throw Bv("RegExp#exec called on incompatible receiver")},Gv=l,Hv=kt,zv=L,Kv=Mv,Yv=fo,Xv=Ee,Wv=jv;function Jv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}kv("search",(function(e,t,r){return[function(t){var r=zv(this),i=null==t?void 0:Xv(t,e);return i?Gv(i,t,r):new RegExp(t)[e](Yv(r))},function(e){var i=Hv(this),n=Yv(e),o=r(t,i,n);if(o.done)return o.value;var a=i.lastIndex;Kv(a,0)||(i.lastIndex=0);var s=Wv(i,n);return Kv(i.lastIndex,a)||(i.lastIndex=a),null===s?-1:s.index}]}));var qv=Ep.charAt,Zv=function(e,t,r){return t+(r?qv(e,t).length:1)},$v=l,Qv=kt,em=ti,tm=fo,rm=L,im=Ee,nm=Zv,om=jv;kv("match",(function(e,t,r){return[function(t){var r=rm(this),i=null==t?void 0:im(t,e);return i?$v(i,t,r):new RegExp(t)[e](tm(r))},function(e){var i=Qv(this),n=tm(e),o=r(t,i,n);if(o.done)return o.value;if(!i.global)return om(i,n);var a=i.unicode;i.lastIndex=0;for(var s,c=[],u=0;null!==(s=om(i,n));){var d=tm(s[0]);c[u]=d,""===d&&(i.lastIndex=nm(n,em(i.lastIndex),a)),u++}return 0===u?null:c}]}));var am="\t\n\v\f\r \u2028\u2029\ufeff",sm=L,cm=fo,um=I("".replace),dm="[\t\n\v\f\r \u2028\u2029\ufeff]",lm=RegExp("^"+dm+dm+"*"),hm=RegExp(dm+dm+"*$"),pm=function(e){return function(t){var r=cm(sm(t));return 1&e&&(r=um(r,lm,"")),2&e&&(r=um(r,hm,"")),r}},fm={start:pm(1),end:pm(2),trim:pm(3)},_m=n,vm=a,mm=I,Sm=fo,Em=fm.trim,ym=am,gm=_m.parseInt,bm=_m.Symbol,Tm=bm&&bm.iterator,Im=/^[+-]?0x/i,Rm=mm(Im.exec),Am=8!==gm(ym+"08")||22!==gm(ym+"0x16")||Tm&&!vm((function(){gm(Object(Tm))}))?function(e,t){var r=Em(Sm(e));return gm(r,t>>>0||(Rm(Im,r)?16:10))}:gm;Yi({global:!0,forced:parseInt!=Am},{parseInt:Am});var Cm={exports:{}},Om=a((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Nm=a,wm=G,Dm=O,Pm=Om,km=Object.isExtensible,Mm=Nm((function(){km(1)}))||Pm?function(e){return!!wm(e)&&((!Pm||"ArrayBuffer"!=Dm(e))&&(!km||km(e)))}:km,Um=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),Lm=Yi,xm=I,Vm=dr,Fm=G,Bm=xe,jm=Ct.f,Gm=Kr,Hm=_o,zm=Mm,Km=Um,Ym=!1,Xm=Ge("meta"),Wm=0,Jm=function(e){jm(e,Xm,{value:{objectID:"O"+Wm++,weakData:{}}})},qm=Cm.exports={enable:function(){qm.enable=function(){},Ym=!0;var e=Gm.f,t=xm([].splice),r={};r[Xm]=1,e(r).length&&(Gm.f=function(r){for(var i=e(r),n=0,o=i.length;n<o;n++)if(i[n]===Xm){t(i,n,1);break}return i},Lm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Hm.f}))},fastKey:function(e,t){if(!Fm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Bm(e,Xm)){if(!zm(e))return"F";if(!t)return"E";Jm(e)}return e[Xm].objectID},getWeakData:function(e,t){if(!Bm(e,Xm)){if(!zm(e))return!0;if(!t)return!1;Jm(e)}return e[Xm].weakData},onFreeze:function(e){return Km&&Ym&&zm(e)&&!Bm(e,Xm)&&Jm(e),e}};Vm[Xm]=!0;var Zm=B,$m=G,Qm=en,eS=function(e,t,r){var i,n;return Qm&&Zm(i=t.constructor)&&i!==r&&$m(n=i.prototype)&&n!==r.prototype&&Qm(e,n),e},tS=Yi,rS=n,iS=I,nS=Vi,oS=Wt.exports,aS=Cm.exports,sS=Yc,cS=lc,uS=B,dS=G,lS=a,hS=tu,pS=Go,fS=eS,_S=function(e,t,r){var i=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=i?"set":"add",a=rS[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=iS(s[e]);oS(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(n&&!dS(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!dS(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!dS(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(nS(e,!uS(a)||!(n||s.forEach&&!lS((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,i,o),aS.enable();else if(nS(e,!0)){var l=new c,h=l[o](n?{}:-0,1)!=l,p=lS((function(){l.has(1)})),f=hS((function(e){new a(e)})),_=!n&&lS((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));f||((c=t((function(e,t){cS(e,s);var r=fS(new a,e,c);return null!=t&&sS(t,r[o],{that:r,AS_ENTRIES:i}),r}))).prototype=s,s.constructor=c),(p||_)&&(d("delete"),d("has"),i&&d("get")),(_||h)&&d(o),n&&s.clear&&delete s.clear}return u[e]=c,tS({global:!0,forced:c!=a},u),pS(c,e),n||r.setStrong(c,e,i),c},vS=Ct.f,mS=Rn,SS=ic,ES=Yo,yS=lc,gS=Yc,bS=$h,TS=cc,IS=s,RS=Cm.exports.fastKey,AS=Or.set,CS=Or.getterFor,OS={getConstructor:function(e,t,r,i){var n=e((function(e,n){yS(e,o),AS(e,{type:t,index:mS(null),first:void 0,last:void 0,size:0}),IS||(e.size=0),null!=n&&gS(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=CS(t),s=function(e,t,r){var i,n,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:n=RS(t,!0),key:t,value:r,previous:i=o.last,next:void 0,removed:!1},o.first||(o.first=s),i&&(i.next=s),IS?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},c=function(e,t){var r,i=a(e),n=RS(t);if("F"!==n)return i.index[n];for(r=i.first;r;r=r.next)if(r.key==t)return r};return SS(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,IS?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),i=c(t,e);if(i){var n=i.next,o=i.previous;delete r.index[i.index],i.removed=!0,o&&(o.next=n),n&&(n.previous=o),r.first==i&&(r.first=n),r.last==i&&(r.last=o),IS?r.size--:t.size--}return!!i},forEach:function(e){for(var t,r=a(this),i=ES(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(i(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),SS(o,r?{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)}}),IS&&vS(o,"size",{get:function(){return a(this).size}}),n},setStrong:function(e,t,r){var i=t+" Iterator",n=CS(t),o=CS(i);bS(e,t,(function(e,t){AS(this,{type:i,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?"keys"==t?{value:r.key,done:!1}:"values"==t?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),TS(t)}};_S("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),OS);var NS=Me,wS=on;Yi({target:"Object",stat:!0,forced:a((function(){wS(1)}))},{keys:function(e){return wS(NS(e))}});var DS=me,PS=Me,kS=M,MS=ii,US=n.TypeError,LS=function(e){return function(t,r,i,n){DS(r);var o=PS(t),a=kS(o),s=MS(o),c=e?s-1:0,u=e?-1:1;if(i<2)for(;;){if(c in a){n=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw US("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(n=r(n,a[c],c,o));return n}},xS={left:LS(!1),right:LS(!0)},VS=xS.left,FS=te,BS=pu;Yi({target:"Array",proto:!0,forced:!jn("reduce")||!BS&&FS>79&&FS<83},{reduce:function(e){var t=arguments.length;return VS(this,e,t,t>1?arguments[1]:void 0)}});var jS,GS=Yi,HS=I,zS=o.f,KS=ti,YS=fo,XS=L_,WS=L,JS=V_,qS=HS("".endsWith),ZS=HS("".slice),$S=Math.min,QS=JS("endsWith");GS({target:"String",proto:!0,forced:!!(QS||(jS=zS(String.prototype,"endsWith"),!jS||jS.writable))&&!QS},{endsWith:function(e){var t=YS(WS(this));XS(e);var r=arguments.length>1?arguments[1]:void 0,i=t.length,n=void 0===r?i:$S(KS(r),i),o=YS(e);return qS?qS(t,o,n):ZS(t,n-o.length,n)===o}});var eE=!0,tE=!0;function rE(e,t,r){var i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function iE(e,t,r){if(e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);var o=function(e){var t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};var o=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var i=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,i])},Object.defineProperty(i,"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 nE(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(eE=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function oE(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(tE=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function aE(){if("object"===("undefined"==typeof window?"undefined":t(window))){if(eE)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function sE(e,t){tE&&console.warn(e+" is deprecated, please use "+t+" instead.")}function cE(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var r=e.navigator;if(r.mozGetUserMedia)t.browser="firefox",t.version=rE(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=rE(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=rE(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function uE(e){return"[object Object]"===Object.prototype.toString.call(e)}function dE(e){return uE(e)?Object.keys(e).reduce((function(t,r){var i=uE(e[r]),n=i?dE(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,Jv({},r,n))}),{}):e}function lE(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(i){i.endsWith("Id")?lE(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((function(t){lE(e,e.get(t),r)}))})))}function hE(e,t,r){var i=r?"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(r){r.type===i&&r.trackId===t.id&&lE(e,r,n)}))})),n}var pE=Yi,fE=ba.find,_E=ah,vE="find",mE=!0;vE in[]&&Array(1).find((function(){mE=!1})),pE({target:"Array",proto:!0,forced:mE},{find:function(e){return fE(this,e,arguments.length>1?arguments[1]:void 0)}}),_E(vE);var SE=Yi,EE=n,yE=$r,gE=Wr,bE=ii,TE=Me,IE=fa,RE=Eo,AE=Kp("splice"),CE=EE.TypeError,OE=Math.max,NE=Math.min,wE=9007199254740991,DE="Maximum allowed length exceeded";SE({target:"Array",proto:!0,forced:!AE},{splice:function(e,t){var r,i,n,o,a,s,c=TE(this),u=bE(c),d=yE(e,u),l=arguments.length;if(0===l?r=i=0:1===l?(r=0,i=u-d):(r=l-2,i=NE(OE(gE(t),0),u-d)),u+r-i>wE)throw CE(DE);for(n=IE(c,i),o=0;o<i;o++)(a=d+o)in c&&RE(n,o,c[a]);if(n.length=i,r<i){for(o=d;o<u-i;o++)s=o+r,(a=o+i)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-i+r;o--)delete c[o-1]}else if(r>i)for(o=u-i;o>d;o--)s=o+r-1,(a=o+i-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<r;o++)c[o+d]=arguments[o+2];return c.length=u-i+r,n}});var PE=ba.map;Yi({target:"Array",proto:!0,forced:!Kp("map")},{map:function(e){return PE(this,e,arguments.length>1?arguments[1]:void 0)}});var kE=ba.filter;Yi({target:"Array",proto:!0,forced:!Kp("filter")},{filter:function(e){return kE(this,e,arguments.length>1?arguments[1]:void 0)}});var ME=I,UE=Me,LE=Math.floor,xE=ME("".charAt),VE=ME("".replace),FE=ME("".slice),BE=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,jE=/\$([$&'`]|\d{1,2})/g,GE=$n,HE=l,zE=I,KE=kv,YE=a,XE=kt,WE=B,JE=Wr,qE=ti,ZE=fo,$E=L,QE=Zv,ey=Ee,ty=function(e,t,r,i,n,o){var a=r+e.length,s=i.length,c=jE;return void 0!==n&&(n=UE(n),c=BE),VE(o,c,(function(o,c){var u;switch(xE(c,0)){case"$":return"$";case"&":return e;case"`":return FE(t,0,r);case"'":return FE(t,a);case"<":u=n[FE(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=LE(d/10);return 0===l?o:l<=s?void 0===i[l-1]?xE(c,1):i[l-1]+xE(c,1):o}u=i[d-1]}return void 0===u?"":u}))},ry=jv,iy=Qe("replace"),ny=Math.max,oy=Math.min,ay=zE([].concat),sy=zE([].push),cy=zE("".indexOf),uy=zE("".slice),dy="$0"==="a".replace(/./,"$0"),ly=!!/./[iy]&&""===/./[iy]("a","$0");KE("replace",(function(e,t,r){var i=ly?"$":"$0";return[function(e,r){var i=$E(this),n=null==e?void 0:ey(e,iy);return n?HE(n,e,i,r):HE(t,ZE(i),e,r)},function(e,n){var o=XE(this),a=ZE(e);if("string"==typeof n&&-1===cy(n,i)&&-1===cy(n,"$<")){var s=r(t,o,a,n);if(s.done)return s.value}var c=WE(n);c||(n=ZE(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=ry(o,a);if(null===h)break;if(sy(l,h),!u)break;""===ZE(h[0])&&(o.lastIndex=QE(a,qE(o.lastIndex),d))}for(var p,f="",_=0,v=0;v<l.length;v++){for(var m=ZE((h=l[v])[0]),S=ny(oy(JE(h.index),a.length),0),E=[],y=1;y<h.length;y++)sy(E,void 0===(p=h[y])?p:String(p));var g=h.groups;if(c){var b=ay([m],E,S,a);void 0!==g&&sy(b,g);var T=ZE(GE(n,void 0,b))}else T=ty(m,a,S,E,g,n);S>=_&&(f+=uy(a,_,S)+T,_=S+m.length)}return f+uy(a,_)}]}),!!YE((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!dy||ly);var hy=s,py=n,fy=I,_y=Vi,vy=eS,my=Xt,Sy=Ct.f,Ey=Kr.f,yy=X,gy=k_,by=fo,Ty=Y_,Iy=Z_,Ry=Wt.exports,Ay=a,Cy=xe,Oy=Or.enforce,Ny=cc,wy=ev,Dy=iv,Py=Qe("match"),ky=py.RegExp,My=ky.prototype,Uy=py.SyntaxError,Ly=fy(Ty),xy=fy(My.exec),Vy=fy("".charAt),Fy=fy("".replace),By=fy("".indexOf),jy=fy("".slice),Gy=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Hy=/a/g,zy=/a/g,Ky=new ky(Hy)!==Hy,Yy=Iy.MISSED_STICKY,Xy=Iy.UNSUPPORTED_Y,Wy=hy&&(!Ky||Yy||wy||Dy||Ay((function(){return zy[Py]=!1,ky(Hy)!=Hy||ky(zy)==zy||"/a/i"!=ky(Hy,"i")})));if(_y("RegExp",Wy)){for(var Jy=function(e,t){var r,i,n,o,a,s,c=yy(My,this),u=gy(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===Jy)return e;if((u||yy(My,e))&&(e=e.source,d&&(t="flags"in h?h.flags:Ly(h))),e=void 0===e?"":by(e),t=void 0===t?"":by(t),h=e,wy&&"dotAll"in Hy&&(i=!!t&&By(t,"s")>-1)&&(t=Fy(t,/s/g,"")),r=t,Yy&&"sticky"in Hy&&(n=!!t&&By(t,"y")>-1)&&Xy&&(t=Fy(t,/y/g,"")),Dy&&(o=function(e){for(var t,r=e.length,i=0,n="",o=[],a={},s=!1,c=!1,u=0,d="";i<=r;i++){if("\\"===(t=Vy(e,i)))t+=Vy(e,++i);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:xy(Gy,jy(e,i+1))&&(i+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||Cy(a,d))throw new Uy("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=vy(ky(e,t),c?this:My,Jy),(i||n||l.length)&&(s=Oy(a),i&&(s.dotAll=!0,s.raw=Jy(function(e){for(var t,r=e.length,i=0,n="",o=!1;i<=r;i++)"\\"!==(t=Vy(e,i))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+Vy(e,++i);return n}(e),r)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{my(a,"source",""===h?"(?:)":h)}catch(e){}return a},qy=function(e){e in Jy||Sy(Jy,e,{configurable:!0,get:function(){return ky[e]},set:function(t){ky[e]=t}})},Zy=Ey(ky),$y=0;Zy.length>$y;)qy(Zy[$y++]);My.constructor=Jy,Jy.prototype=My,Ry(py,"RegExp",Jy)}Ny("RegExp");var Qy=I,eg=Mr.PROPER,tg=Wt.exports,rg=kt,ig=X,ng=fo,og=a,ag=Y_,sg="toString",cg=RegExp.prototype,ug=cg.toString,dg=Qy(ag),lg=og((function(){return"/a/b"!=ug.call({source:"a",flags:"b"})})),hg=eg&&ug.name!=sg;(lg||hg)&&tg(RegExp.prototype,sg,(function(){var e=rg(this),t=ng(e.source),r=e.flags;return"/"+t+"/"+ng(void 0===r&&ig(cg,e)&&!("flags"in cg)?dg(e):r)}),{unsafe:!0});var pg=ba.some;Yi({target:"Array",proto:!0,forced:!jn("some")},{some:function(e){return pg(this,e,arguments.length>1?arguments[1]:void 0)}});var fg=s,_g=Mr.EXISTS,vg=I,mg=Ct.f,Sg=Function.prototype,Eg=vg(Sg.toString),yg=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,gg=vg(yg.exec);fg&&!_g&&mg(Sg,"name",{configurable:!0,get:function(){try{return gg(yg,Eg(this))[1]}catch(e){return""}}});var bg=I,Tg=me,Ig=G,Rg=xe,Ag=Do,Cg=c,Og=n.Function,Ng=bg([].concat),wg=bg([].join),Dg={},Pg=function(e,t,r){if(!Rg(Dg,t)){for(var i=[],n=0;n<t;n++)i[n]="a["+n+"]";Dg[t]=Og("C,a","return new C("+wg(i,",")+")")}return Dg[t](e,r)},kg=Cg?Og.bind:function(e){var t=Tg(this),r=t.prototype,i=Ag(arguments,1),n=function(){var r=Ng(i,Ag(arguments));return this instanceof n?Pg(t,r.length,r):t.apply(e,r)};return Ig(r)&&(n.prototype=r),n},Mg=kg;Yi({target:"Function",proto:!0,forced:Function.bind!==Mg},{bind:Mg});var Ug=aE;function Lg(e,r){var i=e&&e.navigator;if(i.mediaDevices){var n=function(e){if("object"!==t(e)||e.mandatory||e.optional)return e;var r={};return Object.keys(e).forEach((function(i){if("require"!==i&&"advanced"!==i&&"mediaSource"!==i){var n="object"===t(e[i])?e[i]:{ideal:e[i]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){r.optional=r.optional||[];var a={};"number"==typeof n.ideal?(a[o("min",i)]=n.ideal,r.optional.push(a),(a={})[o("max",i)]=n.ideal,r.optional.push(a)):(a[o("",i)]=n.ideal,r.optional.push(a))}void 0!==n.exact&&"number"!=typeof n.exact?(r.mandatory=r.mandatory||{},r.mandatory[o("",i)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(r.mandatory=r.mandatory||{},r.mandatory[o(e,i)]=n[e])}))}})),e.advanced&&(r.optional=(r.optional||[]).concat(e.advanced)),r},o=function(e,o){if(r.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===t(e.audio)){var a=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===t(e.video)){var s=e.video.facingMode;s=s&&("object"===t(s)?s:{ideal:s});var c,u=r.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!i.mediaDevices.getSupportedConstraints||!i.mediaDevices.getSupportedConstraints().facingMode||u))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?c=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(c=["front"]),c)return i.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return c.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&c.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=s.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),Ug("chrome: "+JSON.stringify(e)),o(e)}));e.video=n(e.video)}return Ug("chrome: "+JSON.stringify(e)),o(e)},a=function(e){return r.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){o(e,(function(e){i.webkitGetUserMedia(e,t,(function(e){r&&r(a(e))}))}))}.bind(i),i.mediaDevices.getUserMedia){var s=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(e){return o(e,(function(e){return s(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(a(e))}))}))}}}}function xg(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Vg(e){if("object"===t(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 r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var t=this;return this._ontrackpoly||(this._ontrackpoly=function(r){r.stream.addEventListener("addtrack",(function(i){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===i.track.id})):{track:i.track};var o=new Event("track");o.track=i.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[r.stream],t.dispatchEvent(o)})),r.stream.getTracks().forEach((function(i){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===i.id})):{track:i};var o=new Event("track");o.track=i,o.receiver=n,o.transceiver={receiver:n},o.streams=[r.stream],t.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),r.apply(this,arguments)}}else iE(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Fg(e){if("object"===t(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var r=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,t){var n=i.apply(this,arguments);return n||(n=r(this,e),this._senders.push(n)),n};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var o=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){t._senders.push(r(t,e))}))};var a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],a.apply(this,[e]),e.getTracks().forEach((function(e){var r=t._senders.find((function(t){return t.track===e}));r&&t._senders.splice(t._senders.indexOf(r),1)}))}}else if("object"===t(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.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 Bg(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),i=r[0],n=r[1],o=r[2];if(arguments.length>0&&"function"==typeof i)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof i))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),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,i])}return new Promise((function(r,i){t.apply(e,[function(e){r(s(a(e)))},i])})).then(n,o)}}}function jg(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var r=e.RTCPeerConnection.prototype.getSenders;r&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=r.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});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 hE(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),iE(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 hE(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var o=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,i,n=arguments[0];return this.getSenders().forEach((function(e){e.track===n&&(t?i=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===n&&(r?i=!0:r=e),e.track===n})),i||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return o.apply(this,arguments)}}}}function Gg(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,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};var r=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 i=this.getSenders();r.apply(this,arguments);var n=this.getSenders().filter((function(e){return-1===i.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(n)};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.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(r){var i=t._shimmedLocalStreams[r].indexOf(e);-1!==i&&t._shimmedLocalStreams[r].splice(i,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),n.apply(this,arguments)}}function Hg(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Gg(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(r.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}i.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,r){var i=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[r.id];if(a)a.addTrack(t),Promise.resolve().then((function(){i.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[r.id]=s,this._reverseStreams[s.id]=r,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],i=Jv({},t,(function(){var e=this,t=arguments,i=arguments.length&&"function"==typeof arguments[0];return i?r.apply(this,[function(r){var i=s(e,r);t[0].apply(null,[i])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=i[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,r=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(i){r._streams[i].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[i])})),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 r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function zg(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],i=Jv({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=i[t]}))}function Kg(e,t){iE(e,"negotiationneeded",(function(e){var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var Yg=Object.freeze({__proto__:null,shimMediaStream:xg,shimOnTrack:Vg,shimGetSendersWithDtmf:Fg,shimGetStats:Bg,shimSenderReceiverGetStats:jg,shimAddTrackRemoveTrackWithNative:Gg,shimAddTrackRemoveTrack:Hg,shimPeerConnection:zg,fixNegotiationNeeded:Kg,shimGetUserMedia:Lg,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),Xg=n,Wg=a,Jg=fo,qg=fm.trim,Zg=I("".charAt),$g=Xg.parseFloat,Qg=Xg.Symbol,eb=Qg&&Qg.iterator,tb=1/$g("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||eb&&!Wg((function(){$g(Object(eb))}))?function(e){var t=qg(Jg(e)),r=$g(t);return 0===r&&"-"==Zg(t,0)?-0:r}:$g;Yi({global:!0,forced:parseFloat!=tb},{parseFloat:tb});var rb=Yi,ib=tc,nb=a,ob=Y,ab=B,sb=uu,cb=Ed,ub=Wt.exports;if(rb({target:"Promise",proto:!0,real:!0,forced:!!ib&&nb((function(){ib.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=sb(this,ob("Promise")),r=ab(e);return this.then(r?function(r){return cb(t,e()).then((function(){return r}))}:e,r?function(r){return cb(t,e()).then((function(){throw r}))}:e)}}),ab(ib)){var db=ob("Promise").prototype.finally;ib.prototype.finally!==db&&ub(ib.prototype,"finally",db,{unsafe:!0})}function lb(e,r){var i=e&&e.navigator,n=e&&e.MediaStreamTrack;if(i.getUserMedia=function(e,t,r){sE("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(e).then(t,r)},!(r.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},a=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(e){return"object"===t(e)&&"object"===t(e.audio)&&(e=JSON.parse(JSON.stringify(e)),o(e.audio,"autoGainControl","mozAutoGainControl"),o(e.audio,"noiseSuppression","mozNoiseSuppression")),a(e)},n&&n.prototype.getSettings){var s=n.prototype.getSettings;n.prototype.getSettings=function(){var e=s.apply(this,arguments);return o(e,"mozAutoGainControl","autoGainControl"),o(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var c=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===t(e)&&(e=JSON.parse(JSON.stringify(e)),o(e,"autoGainControl","mozAutoGainControl"),o(e,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[e])}}}}function hb(e){"object"===t(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 pb(e,r){if("object"===t(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),r.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],i=Jv({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=i[t]}));var i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),t=e[0],o=e[1],a=e[2];return n.apply(this,[t||null]).then((function(e){if(r.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 fb(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var r=e.RTCPeerConnection.prototype.getSenders;r&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=r.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});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 _b(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("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}),iE(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function vb(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;sE("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function mb(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Sb(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype.addTransceiver;r&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],t=e&&"sendEncodings"in e;t&&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 i=r.apply(this,arguments);if(t){var n=i.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 i})}}function Eb(e){if("object"===t(e)&&e.RTCRtpSender){var r=e.RTCRtpSender.prototype.getParameters;r&&(e.RTCRtpSender.prototype.getParameters=function(){var e=r.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function yb(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,t=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return r.apply(t,e)})).finally((function(){t.setParametersPromises=[]})):r.apply(this,arguments)}}}function gb(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,t=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return r.apply(t,e)})).finally((function(){t.setParametersPromises=[]})):r.apply(this,arguments)}}}var bb=Object.freeze({__proto__:null,shimOnTrack:hb,shimPeerConnection:pb,shimSenderGetStats:fb,shimReceiverGetStats:_b,shimRemoveStream:vb,shimRTCDataChannel:mb,shimAddTransceiver:Sb,shimGetParameters:Eb,shimCreateOffer:yb,shimCreateAnswer:gb,shimGetUserMedia:lb,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function Tb(e){if("object"===t(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 r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(i){return r.call(t,i,e)})),e.getVideoTracks().forEach((function(i){return r.call(t,i,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var t=this,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return n&&n.forEach((function(e){t._localStreams?t._localStreams.includes(e)||t._localStreams.push(e):t._localStreams=[e]})),r.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var i=e.getTracks();this.getSenders().forEach((function(e){i.includes(e.track)&&t.removeTrack(e)}))}})}}function Ib(e){if("object"===t(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 r=new Event("addstream");r.stream=e,t.dispatchEvent(r)}}))})}});var r=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 r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),r.apply(e,arguments)}}}function Rb(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,i=r.createOffer,n=r.createAnswer,o=r.setLocalDescription,a=r.setRemoteDescription,s=r.addIceCandidate;r.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},r.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};var c=function(e,t,r){var i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};r.setLocalDescription=c,c=function(e,t,r){var i=a.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},r.setRemoteDescription=c,c=function(e,t,r){var i=s.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},r.addIceCandidate=c}}function Ab(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,i=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return i(Cb(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function Cb(e){return e&&void 0!==e.video?Object.assign({},e,{video:dE(e.video)}):e}function Ob(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var i=[],n=0;n<e.iceServers.length;n++){var o=e.iceServers[n];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(sE("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,i.push(o)):i.push(e.iceServers[n])}e.iceServers=i}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function Nb(e){"object"===t(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 wb(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&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.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var i=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&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.offerToReceiveVideo||i||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Db(e){"object"!==t(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Pb=Object.freeze({__proto__:null,shimLocalStreamsAPI:Tb,shimRemoteStreamsAPI:Ib,shimCallbacksAPI:Rb,shimGetUserMedia:Ab,shimConstraints:Cb,shimRTCIceServerUrls:Ob,shimTrackEventTransceiver:Nb,shimCreateOfferLegacy:wb,shimAudioContext:Db}),kb=Me,Mb=ct;Yi({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=kb(this),r=Mb(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}});var Ub=l;Yi({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Ub(URL.prototype.toString,this)}});var Lb=I(1..valueOf),xb=s,Vb=n,Fb=I,Bb=Vi,jb=Wt.exports,Gb=xe,Hb=eS,zb=X,Kb=le,Yb=ct,Xb=a,Wb=Kr.f,Jb=o.f,qb=Ct.f,Zb=Lb,$b=fm.trim,Qb="Number",eT=Vb.Number,tT=eT.prototype,rT=Vb.TypeError,iT=Fb("".slice),nT=Fb("".charCodeAt),oT=function(e){var t=Yb(e,"number");return"bigint"==typeof t?t:aT(t)},aT=function(e){var t,r,i,n,o,a,s,c,u=Yb(e,"number");if(Kb(u))throw rT("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=$b(u),43===(t=nT(u,0))||45===t){if(88===(r=nT(u,2))||120===r)return NaN}else if(48===t){switch(nT(u,1)){case 66:case 98:i=2,n=49;break;case 79:case 111:i=8,n=55;break;default:return+u}for(a=(o=iT(u,2)).length,s=0;s<a;s++)if((c=nT(o,s))<48||c>n)return NaN;return parseInt(o,i)}return+u};if(Bb(Qb,!eT(" 0o1")||!eT("0b1")||eT("+0x1"))){for(var sT,cT=function(e){var t=arguments.length<1?0:eT(oT(e)),r=this;return zb(tT,r)&&Xb((function(){Zb(r)}))?Hb(Object(t),r,cT):t},uT=xb?Wb(eT):"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(","),dT=0;uT.length>dT;dT++)Gb(eT,sT=uT[dT])&&!Gb(cT,sT)&&qb(cT,sT,Jb(eT,sT));cT.prototype=tT,tT.constructor=cT,jb(Vb,Qb,cT)}var lT=Yi,hT=M,pT=F,fT=jn,_T=I([].join),vT=hT!=Object,mT=fT("join",",");lT({target:"Array",proto:!0,forced:vT||!mT},{join:function(e){return _T(pT(this),void 0===e?",":e)}});var ST=$n,ET=l,yT=I,gT=kv,bT=k_,TT=kt,IT=L,RT=uu,AT=Zv,CT=ti,OT=fo,NT=Ee,wT=Ro,DT=jv,PT=Iv,kT=a,MT=Z_.UNSUPPORTED_Y,UT=4294967295,LT=Math.min,xT=[].push,VT=yT(/./.exec),FT=yT(xT),BT=yT("".slice),jT=!kT((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]}));gT("split",(function(e,t,r){var i;return i="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,r){var i=OT(IT(this)),n=void 0===r?UT:r>>>0;if(0===n)return[];if(void 0===e)return[i];if(!bT(e))return ET(t,i,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=ET(PT,l,i))&&!((a=l.lastIndex)>d&&(FT(c,BT(i,d,o.index)),o.length>1&&o.index<i.length&&ST(xT,c,wT(o,1)),s=o[0].length,d=a,c.length>=n));)l.lastIndex===o.index&&l.lastIndex++;return d===i.length?!s&&VT(l,"")||FT(c,""):FT(c,BT(i,d)),c.length>n?wT(c,0,n):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:ET(t,this,e,r)}:t,[function(t,r){var n=IT(this),o=null==t?void 0:NT(t,e);return o?ET(o,t,n,r):ET(i,OT(n),t,r)},function(e,n){var o=TT(this),a=OT(e),s=r(i,o,a,n,i!==t);if(s.done)return s.value;var c=RT(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(MT?"g":"y"),l=new c(MT?"^(?:"+o.source+")":o,d),h=void 0===n?UT:n>>>0;if(0===h)return[];if(0===a.length)return null===DT(l,a)?[a]:[];for(var p=0,f=0,_=[];f<a.length;){l.lastIndex=MT?0:f;var v,m=DT(l,MT?BT(a,f):a);if(null===m||(v=LT(CT(l.lastIndex+(MT?f:0)),a.length))===p)f=AT(a,f,u);else{if(FT(_,BT(a,p,f)),_.length===h)return _;for(var S=1;S<=m.length-1;S++)if(FT(_,m[S]),_.length===h)return _;f=p=v}}return FT(_,BT(a,p)),_}]}),!jT,MT);var GT=Mr.PROPER,HT=a,zT=am,KT=fm.trim;Yi({target:"String",proto:!0,forced:function(e){return HT((function(){return!!zT[e]()||"
"!=="
"[e]()||GT&&zT[e].name!==e}))}("trim")},{trim:function(){return KT(this)}});var YT={exports:{}};!function(e){var r={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};r.localCName=r.generateIdentifier(),r.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},r.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},r.getDescription=function(e){var t=r.splitSections(e);return t&&t[0]},r.getMediaSections=function(e){var t=r.splitSections(e);return t.shift(),t},r.matchPrefix=function(e,t){return r.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},r.parseCandidate=function(e){for(var t,r={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]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":r.relatedAddress=t[i+1];break;case"rport":r.relatedPort=parseInt(t[i+1],10);break;case"tcptype":r.tcpType=t[i+1];break;case"ufrag":r.ufrag=t[i+1],r.usernameFragment=t[i+1];break;default:void 0===r[t[i]]&&(r[t[i]]=t[i+1])}return r},r.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var i=e.type;return t.push("typ"),t.push(i),"host"!==i&&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(" ")},r.parseIceOptions=function(e){return e.substr(14).split(" ")},r.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},r.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},r.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]}},r.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},r.parseFmtp=function(e){for(var t,r={},i=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<i.length;n++)r[(t=i[n].trim().split("="))[0].trim()]=t[1];return r},r.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var i=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},r.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},r.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},r.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+1)):r.attribute=e.substr(t+1),r},r.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},r.getMid=function(e){var t=r.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},r.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},r.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:r.matchPrefix(e+t,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},r.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)}},r.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===t(e.keyParams)?r.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},r.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}},r.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},r.getCryptoParameters=function(e,t){return r.matchPrefix(e+t,"a=crypto:").map(r.parseCryptoLine)},r.getIceParameters=function(e,t){var i=r.matchPrefix(e+t,"a=ice-ufrag:")[0],n=r.matchPrefix(e+t,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substr(12),password:n.substr(10)}:null},r.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},r.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=r.splitLines(e)[0].split(" "),n=3;n<i.length;n++){var o=i[n],a=r.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=r.parseRtpMap(a),c=r.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?r.parseFmtp(c[0]):{},s.rtcpFeedback=r.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(r.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return r.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(r.parseExtmap(e))})),t},r.writeRtpDescription=function(e,t){var i="";i+="m="+e+" ",i+=t.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=t.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){i+=r.writeRtpMap(e),i+=r.writeFmtp(e),i+=r.writeRtcpFb(e)}));var n=0;return t.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){i+=r.writeExtmap(e)})),i},r.parseRtpEncodingParameters=function(e){var t,i=[],n=r.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=r.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&&(t=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var r={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&t&&(r.rtx={ssrc:t}),i.push(r),o&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},i.push(r))}})),0===i.length&&c&&i.push({ssrc:c});var d=r.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,i.forEach((function(e){e.maxBitrate=d}))),i},r.parseRtcpParameters=function(e){var t={},i=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];i&&(t.cname=i.value,t.ssrc=i.ssrc);var n=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var o=r.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},r.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},r.parseMsid=function(e){var t,i=r.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(t=i[0].substr(7).split(" "))[0],track:t[1]};var n=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(t=n[0].value.split(" "))[0],track:t[1]}:void 0},r.parseSctpDescription=function(e){var t,i=r.parseMLine(e),n=r.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var o=r.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:i.fmt,maxMessageSize:t};var a=r.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:t}}},r.writeSctpDescription=function(e,t){var r=[];return r="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&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},r.generateSessionId=function(){return Math.random().toString().substr(2,21)},r.writeSessionBoilerplate=function(e,t,i){var n=void 0!==t?t:2;return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||r.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.getDirection=function(e,t){for(var i=r.splitLines(e),n=0;n<i.length;n++)switch(i[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[n].substr(2)}return t?r.getDirection(t):"sendrecv"},r.getKind=function(e){return r.splitLines(e)[0].split(" ")[0].substr(2)},r.isRejected=function(e){return"0"===e.split(" ",2)[1]},r.parseMLine=function(e){var t=r.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},r.parseOLine=function(e){var t=r.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},r.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=r.splitLines(e),i=0;i<t.length;i++)if(t[i].length<2||"="!==t[i].charAt(1))return!1;return!0},e.exports=r}(YT);var XT=YT.exports,WT=Object.freeze(e({__proto__:null,default:XT},[YT.exports]));function JT(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var r=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===t(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 r(e),n=XT.parseCandidate(e.candidate),o=Object.assign(i,n);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new r(e)},e.RTCIceCandidate.prototype=r.prototype,iE(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function qT(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 r=function(e){if(!e||!e.sdp)return!1;var t=XT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=XT.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},i=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r},n=function(e){var r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){var i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);var n=XT.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i},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(r(arguments[0])){var c,u=i(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 ZT(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 r(e,this),e},iE(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var i=arguments[0],n=i.length||i.size||i.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 r.apply(e,arguments)}}}function $T(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 r=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 r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function QT(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var i=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:i}):t.sdp=i}return r.apply(this,arguments)}}}function eI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.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():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function tI(e,r){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.setLocalDescription;i&&0!==i.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,r=arguments[0]||{};if("object"!==t(r)||r.type&&r.sdp)return i.apply(this,arguments);if(!(r={type:r.type,sdp:r.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":r.type="offer";break;default:r.type="answer"}if(r.sdp||"offer"!==r.type&&"answer"!==r.type)return i.apply(this,[r]);var n="offer"===r.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return i.apply(e,[t])}))})}}var rI=Object.freeze({__proto__:null,shimRTCIceCandidate:JT,shimMaxMessageSize:qT,shimSendThrowTypeError:ZT,shimConnectionState:$T,removeExtmapAllowMixed:QT,shimAddIceCandidateNullOrEmpty:eI,shimParameterlessSetLocalDescription:tI});!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},i=aE,n=cE(t),o={browserDetails:n,commonShim:rI,extractVersion:rE,disableLog:nE,disableWarnings:oE,sdp:WT};switch(n.browser){case"chrome":if(!Yg||!zg||!r.shimChrome)return i("Chrome shim is not included in this adapter release."),o;if(null===n.version)return i("Chrome shim can not determine version, not shimming."),o;i("adapter.js shimming chrome."),o.browserShim=Yg,eI(t,n),tI(t),Lg(t,n),xg(t),zg(t,n),Vg(t),Hg(t,n),Fg(t),Bg(t),jg(t),Kg(t,n),JT(t),$T(t),qT(t,n),ZT(t),QT(t,n);break;case"firefox":if(!bb||!pb||!r.shimFirefox)return i("Firefox shim is not included in this adapter release."),o;i("adapter.js shimming firefox."),o.browserShim=bb,eI(t,n),tI(t),lb(t,n),pb(t,n),hb(t),vb(t),fb(t),_b(t),mb(t),Sb(t),Eb(t),yb(t),gb(t),JT(t),$T(t),qT(t,n),ZT(t);break;case"safari":if(!Pb||!r.shimSafari)return i("Safari shim is not included in this adapter release."),o;i("adapter.js shimming safari."),o.browserShim=Pb,eI(t,n),tI(t),Ob(t),wb(t),Rb(t),Tb(t),Ib(t),Nb(t),Ab(t),Db(t),JT(t),qT(t,n),ZT(t),QT(t,n);break;default:i("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),Yi({target:"Array",stat:!0},{isArray:eo});var iI=Ro,nI=Math.floor,oI=function(e,t){var r=e.length,i=nI(r/2);return r<8?aI(e,t):sI(e,oI(iI(e,0,i),t),oI(iI(e,i),t),t)},aI=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},sI=function(e,t,r,i){for(var n=t.length,o=r.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?i(t[a],r[s])<=0?t[a++]:r[s++]:a<n?t[a++]:r[s++];return e},cI=oI,uI=W.match(/firefox\/(\d+)/i),dI=!!uI&&+uI[1],lI=/MSIE|Trident/.test(W),hI=W.match(/AppleWebKit\/(\d+)\./),pI=!!hI&&+hI[1],fI=Yi,_I=I,vI=me,mI=Me,SI=ii,EI=fo,yI=a,gI=cI,bI=jn,TI=dI,II=lI,RI=te,AI=pI,CI=[],OI=_I(CI.sort),NI=_I(CI.push),wI=yI((function(){CI.sort(void 0)})),DI=yI((function(){CI.sort(null)})),PI=bI("sort"),kI=!yI((function(){if(RI)return RI<70;if(!(TI&&TI>3)){if(II)return!0;if(AI)return AI<603;var e,t,r,i,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(i=0;i<47;i++)CI.push({k:t+i,v:r})}for(CI.sort((function(e,t){return t.v-e.v})),i=0;i<CI.length;i++)t=CI[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));fI({target:"Array",proto:!0,forced:wI||!DI||!PI||!kI},{sort:function(e){void 0!==e&&vI(e);var t=mI(this);if(kI)return void 0===e?OI(t):OI(t,e);var r,i,n=[],o=SI(t);for(i=0;i<o;i++)i in t&&NI(n,t[i]);for(gI(n,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:EI(t)>EI(r)?1:-1}}(e)),r=n.length,i=0;i<r;)t[i]=n[i++];for(;i<o;)delete t[i++];return t}});var MI="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,UI=Wr,LI=ti,xI=n.RangeError,VI=function(e){if(void 0===e)return 0;var t=UI(e),r=LI(t);if(t!==r)throw xI("Wrong length or index");return r},FI=n.Array,BI=Math.abs,jI=Math.pow,GI=Math.floor,HI=Math.log,zI=Math.LN2,KI={pack:function(e,t,r){var i,n,o,a=FI(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?jI(2,-24)-jI(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=BI(e))!=e||e===1/0?(n=e!=e?1:0,i=c):(i=GI(HI(e)/zI),e*(o=jI(2,-i))<1&&(i--,o*=2),(e+=i+u>=1?d/o:d*jI(2,1-u))*o>=2&&(i++,o/=2),i+u>=c?(n=0,i=c):i+u>=1?(n=(e*o-1)*jI(2,t),i+=u):(n=e*jI(2,u-1)*jI(2,t),i=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(i=i<<t|n,s+=t;s>0;)a[h++]=255&i,i/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,i=e.length,n=8*i-t-1,o=(1<<n)-1,a=o>>1,s=n-7,c=i-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:u?-1/0:1/0;r+=jI(2,t),d-=a}return(u?-1:1)*r*jI(2,d-t)}},YI=Me,XI=$r,WI=ii,JI=function(e){for(var t=YI(this),r=WI(t),i=arguments.length,n=XI(i>1?arguments[1]:void 0,r),o=i>2?arguments[2]:void 0,a=void 0===o?r:XI(o,r);a>n;)t[n++]=e;return t},qI=n,ZI=I,$I=s,QI=MI,eR=Mr,tR=Xt,rR=ic,iR=a,nR=lc,oR=Wr,aR=ti,sR=VI,cR=KI,uR=vh,dR=en,lR=Kr.f,hR=Ct.f,pR=JI,fR=Ro,_R=Go,vR=eR.PROPER,mR=eR.CONFIGURABLE,SR=Or.get,ER=Or.set,yR="ArrayBuffer",gR="DataView",bR="Wrong index",TR=qI.ArrayBuffer,IR=TR,RR=IR&&IR.prototype,AR=qI.DataView,CR=AR&&AR.prototype,OR=Object.prototype,NR=qI.Array,wR=qI.RangeError,DR=ZI(pR),PR=ZI([].reverse),kR=cR.pack,MR=cR.unpack,UR=function(e){return[255&e]},LR=function(e){return[255&e,e>>8&255]},xR=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},VR=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},FR=function(e){return kR(e,23,4)},BR=function(e){return kR(e,52,8)},jR=function(e,t){hR(e.prototype,t,{get:function(){return SR(this)[t]}})},GR=function(e,t,r,i){var n=sR(r),o=SR(e);if(n+t>o.byteLength)throw wR(bR);var a=SR(o.buffer).bytes,s=n+o.byteOffset,c=fR(a,s,s+t);return i?c:PR(c)},HR=function(e,t,r,i,n,o){var a=sR(r),s=SR(e);if(a+t>s.byteLength)throw wR(bR);for(var c=SR(s.buffer).bytes,u=a+s.byteOffset,d=i(+n),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(QI){var zR=vR&&TR.name!==yR;if(iR((function(){TR(1)}))&&iR((function(){new TR(-1)}))&&!iR((function(){return new TR,new TR(1.5),new TR(NaN),zR&&!mR})))zR&&mR&&tR(TR,"name",yR);else{(IR=function(e){return nR(this,RR),new TR(sR(e))}).prototype=RR;for(var KR,YR=lR(TR),XR=0;YR.length>XR;)(KR=YR[XR++])in IR||tR(IR,KR,TR[KR]);RR.constructor=IR}dR&&uR(CR)!==OR&&dR(CR,OR);var WR=new AR(new IR(2)),JR=ZI(CR.setInt8);WR.setInt8(0,2147483648),WR.setInt8(1,2147483649),!WR.getInt8(0)&&WR.getInt8(1)||rR(CR,{setInt8:function(e,t){JR(this,e,t<<24>>24)},setUint8:function(e,t){JR(this,e,t<<24>>24)}},{unsafe:!0})}else RR=(IR=function(e){nR(this,RR);var t=sR(e);ER(this,{bytes:DR(NR(t),0),byteLength:t}),$I||(this.byteLength=t)}).prototype,CR=(AR=function(e,t,r){nR(this,CR),nR(e,RR);var i=SR(e).byteLength,n=oR(t);if(n<0||n>i)throw wR("Wrong offset");if(n+(r=void 0===r?i-n:aR(r))>i)throw wR("Wrong length");ER(this,{buffer:e,byteLength:r,byteOffset:n}),$I||(this.buffer=e,this.byteLength=r,this.byteOffset=n)}).prototype,$I&&(jR(IR,"byteLength"),jR(AR,"buffer"),jR(AR,"byteLength"),jR(AR,"byteOffset")),rR(CR,{getInt8:function(e){return GR(this,1,e)[0]<<24>>24},getUint8:function(e){return GR(this,1,e)[0]},getInt16:function(e){var t=GR(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=GR(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return VR(GR(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return VR(GR(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return MR(GR(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return MR(GR(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){HR(this,1,e,UR,t)},setUint8:function(e,t){HR(this,1,e,UR,t)},setInt16:function(e,t){HR(this,2,e,LR,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){HR(this,2,e,LR,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){HR(this,4,e,xR,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){HR(this,4,e,xR,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){HR(this,4,e,FR,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){HR(this,8,e,BR,t,arguments.length>2?arguments[2]:void 0)}});_R(IR,yR),_R(AR,gR);var qR={ArrayBuffer:IR,DataView:AR},ZR=Yi,$R=I,QR=a,eA=kt,tA=$r,rA=ti,iA=uu,nA=qR.ArrayBuffer,oA=qR.DataView,aA=oA.prototype,sA=$R(nA.prototype.slice),cA=$R(aA.getUint8),uA=$R(aA.setUint8);ZR({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:QR((function(){return!new nA(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(sA&&void 0===t)return sA(eA(this),e);for(var r=eA(this).byteLength,i=tA(e,r),n=tA(void 0===t?r:t,r),o=new(iA(this,nA))(rA(n-i)),a=new oA(this),s=new oA(o),c=0;i<n;)uA(s,c++,cA(a,i++));return o}});var dA,lA,hA,pA={exports:{}},fA=MI,_A=s,vA=n,mA=B,SA=G,EA=xe,yA=lo,gA=pe,bA=Xt,TA=Wt.exports,IA=Ct.f,RA=X,AA=vh,CA=en,OA=Qe,NA=Ge,wA=vA.Int8Array,DA=wA&&wA.prototype,PA=vA.Uint8ClampedArray,kA=PA&&PA.prototype,MA=wA&&AA(wA),UA=DA&&AA(DA),LA=Object.prototype,xA=vA.TypeError,VA=OA("toStringTag"),FA=NA("TYPED_ARRAY_TAG"),BA=NA("TYPED_ARRAY_CONSTRUCTOR"),jA=fA&&!!CA&&"Opera"!==yA(vA.opera),GA=!1,HA={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},zA={BigInt64Array:8,BigUint64Array:8},KA=function(e){if(!SA(e))return!1;var t=yA(e);return EA(HA,t)||EA(zA,t)};for(dA in HA)(hA=(lA=vA[dA])&&lA.prototype)?bA(hA,BA,lA):jA=!1;for(dA in zA)(hA=(lA=vA[dA])&&lA.prototype)&&bA(hA,BA,lA);if((!jA||!mA(MA)||MA===Function.prototype)&&(MA=function(){throw xA("Incorrect invocation")},jA))for(dA in HA)vA[dA]&&CA(vA[dA],MA);if((!jA||!UA||UA===LA)&&(UA=MA.prototype,jA))for(dA in HA)vA[dA]&&CA(vA[dA].prototype,UA);if(jA&&AA(kA)!==UA&&CA(kA,UA),_A&&!EA(UA,VA))for(dA in GA=!0,IA(UA,VA,{get:function(){return SA(this)?this[FA]:void 0}}),HA)vA[dA]&&bA(vA[dA],FA,dA);var YA={NATIVE_ARRAY_BUFFER_VIEWS:jA,TYPED_ARRAY_CONSTRUCTOR:BA,TYPED_ARRAY_TAG:GA&&FA,aTypedArray:function(e){if(KA(e))return e;throw xA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(mA(e)&&(!CA||RA(MA,e)))return e;throw xA(gA(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,i){if(_A){if(r)for(var n in HA){var o=vA[n];if(o&&EA(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}UA[e]&&!r||TA(UA,e,r?t:jA&&DA[e]||t,i)}},exportTypedArrayStaticMethod:function(e,t,r){var i,n;if(_A){if(CA){if(r)for(i in HA)if((n=vA[i])&&EA(n,e))try{delete n[e]}catch(e){}if(MA[e]&&!r)return;try{return TA(MA,e,r?t:jA&&MA[e]||t)}catch(e){}}for(i in HA)!(n=vA[i])||n[e]&&!r||TA(n,e,t)}},isView:function(e){if(!SA(e))return!1;var t=yA(e);return"DataView"===t||EA(HA,t)||EA(zA,t)},isTypedArray:KA,TypedArray:MA,TypedArrayPrototype:UA},XA=n,WA=a,JA=tu,qA=YA.NATIVE_ARRAY_BUFFER_VIEWS,ZA=XA.ArrayBuffer,$A=XA.Int8Array,QA=!qA||!WA((function(){$A(1)}))||!WA((function(){new $A(-1)}))||!JA((function(e){new $A,new $A(null),new $A(1.5),new $A(e)}),!0)||WA((function(){return 1!==new $A(new ZA(2),1,void 0).length})),eC=G,tC=Math.floor,rC=Number.isInteger||function(e){return!eC(e)&&isFinite(e)&&tC(e)===e},iC=Wr,nC=n.RangeError,oC=function(e){var t=iC(e);if(t<0)throw nC("The argument can't be less than 0");return t},aC=n.RangeError,sC=function(e,t){var r=oC(e);if(r%t)throw aC("Wrong offset");return r},cC=Yo,uC=l,dC=ou,lC=Me,hC=ii,pC=Oc,fC=gc,_C=vc,vC=YA.aTypedArrayConstructor,mC=Yi,SC=n,EC=l,yC=s,gC=QA,bC=YA,TC=qR,IC=lc,RC=S,AC=Xt,CC=rC,OC=ti,NC=VI,wC=sC,DC=lt,PC=xe,kC=lo,MC=G,UC=le,LC=Rn,xC=X,VC=en,FC=Kr.f,BC=function(e){var t,r,i,n,o,a,s=dC(this),c=lC(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=fC(c);if(h&&!_C(h))for(a=(o=pC(c,h)).next,c=[];!(n=uC(a,o)).done;)c.push(n.value);for(l&&u>2&&(d=cC(d,arguments[2])),r=hC(c),i=new(vC(s))(r),t=0;r>t;t++)i[t]=l?d(c[t],t):c[t];return i},jC=ba.forEach,GC=cc,HC=Ct,zC=o,KC=eS,YC=Or.get,XC=Or.set,WC=HC.f,JC=zC.f,qC=Math.round,ZC=SC.RangeError,$C=TC.ArrayBuffer,QC=$C.prototype,eO=TC.DataView,tO=bC.NATIVE_ARRAY_BUFFER_VIEWS,rO=bC.TYPED_ARRAY_CONSTRUCTOR,iO=bC.TYPED_ARRAY_TAG,nO=bC.TypedArray,oO=bC.TypedArrayPrototype,aO=bC.aTypedArrayConstructor,sO=bC.isTypedArray,cO="BYTES_PER_ELEMENT",uO="Wrong length",dO=function(e,t){aO(e);for(var r=0,i=t.length,n=new e(i);i>r;)n[r]=t[r++];return n},lO=function(e,t){WC(e,t,{get:function(){return YC(this)[t]}})},hO=function(e){var t;return xC(QC,e)||"ArrayBuffer"==(t=kC(e))||"SharedArrayBuffer"==t},pO=function(e,t){return sO(e)&&!UC(t)&&t in e&&CC(+t)&&t>=0},fO=function(e,t){return t=DC(t),pO(e,t)?RC(2,e[t]):JC(e,t)},_O=function(e,t,r){return t=DC(t),!(pO(e,t)&&MC(r)&&PC(r,"value"))||PC(r,"get")||PC(r,"set")||r.configurable||PC(r,"writable")&&!r.writable||PC(r,"enumerable")&&!r.enumerable?WC(e,t,r):(e[t]=r.value,e)};yC?(tO||(zC.f=fO,HC.f=_O,lO(oO,"buffer"),lO(oO,"byteOffset"),lO(oO,"byteLength"),lO(oO,"length")),mC({target:"Object",stat:!0,forced:!tO},{getOwnPropertyDescriptor:fO,defineProperty:_O}),pA.exports=function(e,t,r){var i=e.match(/\d+$/)[0]/8,n=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=SC[n],c=s,u=c&&c.prototype,d={},l=function(e,t){WC(e,t,{get:function(){return function(e,t){var r=YC(e);return r.view[o](t*i+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=YC(e);r&&(n=(n=qC(n))<0?0:n>255?255:255&n),o.view[a](t*i+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};tO?gC&&(c=t((function(e,t,r,n){return IC(e,u),KC(MC(t)?hO(t)?void 0!==n?new s(t,wC(r,i),n):void 0!==r?new s(t,wC(r,i)):new s(t):sO(t)?dO(c,t):EC(BC,c,t):new s(NC(t)),e,c)})),VC&&VC(c,nO),jC(FC(s),(function(e){e in c||AC(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,n){IC(e,u);var o,a,s,d=0,h=0;if(MC(t)){if(!hO(t))return sO(t)?dO(c,t):EC(BC,c,t);o=t,h=wC(r,i);var p=t.byteLength;if(void 0===n){if(p%i)throw ZC(uO);if((a=p-h)<0)throw ZC(uO)}else if((a=OC(n)*i)+h>p)throw ZC(uO);s=a/i}else s=NC(t),o=new $C(a=s*i);for(XC(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new eO(o)});d<s;)l(e,d++)})),VC&&VC(c,nO),u=c.prototype=LC(oO)),u.constructor!==c&&AC(u,"constructor",c),AC(u,rO,c),iO&&AC(u,iO,n),d[n]=c,mC({global:!0,forced:c!=s,sham:!tO},d),cO in c||AC(c,cO,i),cO in u||AC(u,cO,i),GC(n)}):pA.exports=function(){},(0,pA.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var vO=Me,mO=$r,SO=ii,EO=Math.min,yO=[].copyWithin||function(e,t){var r=vO(this),i=SO(r),n=mO(e,i),o=mO(t,i),a=arguments.length>2?arguments[2]:void 0,s=EO((void 0===a?i:mO(a,i))-o,i-n),c=1;for(o<n&&n<o+s&&(c=-1,o+=s-1,n+=s-1);s-- >0;)o in r?r[n]=r[o]:delete r[n],n+=c,o+=c;return r},gO=YA,bO=I(yO),TO=gO.aTypedArray;(0,gO.exportTypedArrayMethod)("copyWithin",(function(e,t){return bO(TO(this),e,t,arguments.length>2?arguments[2]:void 0)}));var IO=ba.every,RO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("every",(function(e){return IO(RO(this),e,arguments.length>1?arguments[1]:void 0)}));var AO=l,CO=JI,OO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return AO(CO,OO(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var NO=ii,wO=uu,DO=YA.TYPED_ARRAY_CONSTRUCTOR,PO=YA.aTypedArrayConstructor,kO=function(e){return PO(wO(e,e[DO]))},MO=function(e,t){for(var r=0,i=NO(t),n=new e(i);i>r;)n[r]=t[r++];return n},UO=kO,LO=ba.filter,xO=function(e,t){return MO(UO(e),t)},VO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("filter",(function(e){var t=LO(VO(this),e,arguments.length>1?arguments[1]:void 0);return xO(this,t)}));var FO=ba.find,BO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("find",(function(e){return FO(BO(this),e,arguments.length>1?arguments[1]:void 0)}));var jO=ba.findIndex,GO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("findIndex",(function(e){return jO(GO(this),e,arguments.length>1?arguments[1]:void 0)}));var HO=ba.forEach,zO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("forEach",(function(e){HO(zO(this),e,arguments.length>1?arguments[1]:void 0)}));var KO=ci.includes,YO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("includes",(function(e){return KO(YO(this),e,arguments.length>1?arguments[1]:void 0)}));var XO=ci.indexOf,WO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("indexOf",(function(e){return XO(WO(this),e,arguments.length>1?arguments[1]:void 0)}));var JO=n,qO=a,ZO=I,$O=YA,QO=up,eN=Qe("iterator"),tN=JO.Uint8Array,rN=ZO(QO.values),iN=ZO(QO.keys),nN=ZO(QO.entries),oN=$O.aTypedArray,aN=$O.exportTypedArrayMethod,sN=tN&&tN.prototype,cN=!qO((function(){sN[eN].call([1])})),uN=!!sN&&sN.values&&sN[eN]===sN.values&&"values"===sN.values.name,dN=function(){return rN(oN(this))};aN("entries",(function(){return nN(oN(this))}),cN),aN("keys",(function(){return iN(oN(this))}),cN),aN("values",dN,cN||!uN,{name:"values"}),aN(eN,dN,cN||!uN,{name:"values"});var lN=YA.aTypedArray,hN=YA.exportTypedArrayMethod,pN=I([].join);hN("join",(function(e){return pN(lN(this),e)}));var fN=$n,_N=F,vN=Wr,mN=ii,SN=jn,EN=Math.min,yN=[].lastIndexOf,gN=!!yN&&1/[1].lastIndexOf(1,-0)<0,bN=SN("lastIndexOf"),TN=gN||!bN?function(e){if(gN)return fN(yN,this,arguments)||0;var t=_N(this),r=mN(t),i=r-1;for(arguments.length>1&&(i=EN(i,vN(arguments[1]))),i<0&&(i=r+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:yN,IN=$n,RN=TN,AN=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return IN(RN,AN(this),t>1?[e,arguments[1]]:[e])}));var CN=ba.map,ON=kO,NN=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("map",(function(e){return CN(NN(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(ON(e))(t)}))}));var wN=xS.left,DN=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return wN(DN(this),e,t,t>1?arguments[1]:void 0)}));var PN=xS.right,kN=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return PN(kN(this),e,t,t>1?arguments[1]:void 0)}));var MN=YA.aTypedArray,UN=YA.exportTypedArrayMethod,LN=Math.floor;UN("reverse",(function(){for(var e,t=this,r=MN(t).length,i=LN(r/2),n=0;n<i;)e=t[n],t[n++]=t[--r],t[r]=e;return t}));var xN=n,VN=l,FN=YA,BN=ii,jN=sC,GN=Me,HN=a,zN=xN.RangeError,KN=xN.Int8Array,YN=KN&&KN.prototype,XN=YN&&YN.set,WN=FN.aTypedArray,JN=FN.exportTypedArrayMethod,qN=!HN((function(){var e=new Uint8ClampedArray(2);return VN(XN,e,{length:1,0:3},1),3!==e[1]})),ZN=qN&&FN.NATIVE_ARRAY_BUFFER_VIEWS&&HN((function(){var e=new KN(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));JN("set",(function(e){WN(this);var t=jN(arguments.length>1?arguments[1]:void 0,1),r=GN(e);if(qN)return VN(XN,this,r,t);var i=this.length,n=BN(r),o=0;if(n+t>i)throw zN("Wrong length");for(;o<n;)this[t+o]=r[o++]}),!qN||ZN);var $N=kO,QN=Do,ew=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=QN(ew(this),e,t),i=$N(this),n=0,o=r.length,a=new i(o);o>n;)a[n]=r[n++];return a}),a((function(){new Int8Array(1).slice()})));var tw=ba.some,rw=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("some",(function(e){return tw(rw(this),e,arguments.length>1?arguments[1]:void 0)}));var iw=n,nw=I,ow=a,aw=me,sw=cI,cw=YA,uw=dI,dw=lI,lw=te,hw=pI,pw=iw.Array,fw=cw.aTypedArray,_w=cw.exportTypedArrayMethod,vw=iw.Uint16Array,mw=vw&&nw(vw.prototype.sort),Sw=!(!mw||ow((function(){mw(new vw(2),null)}))&&ow((function(){mw(new vw(2),{})}))),Ew=!!mw&&!ow((function(){if(lw)return lw<74;if(uw)return uw<67;if(dw)return!0;if(hw)return hw<602;var e,t,r=new vw(516),i=pw(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,i[e]=e-2*t+3;for(mw(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==i[e])return!0}));_w("sort",(function(e){return void 0!==e&&aw(e),Ew?mw(this,e):sw(fw(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!Ew||Sw);var yw=ti,gw=$r,bw=kO,Tw=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("subarray",(function(e,t){var r=Tw(this),i=r.length,n=gw(e,i);return new(bw(r))(r.buffer,r.byteOffset+n*r.BYTES_PER_ELEMENT,yw((void 0===t?i:gw(t,i))-n))}));var Iw=$n,Rw=YA,Aw=a,Cw=Do,Ow=n.Int8Array,Nw=Rw.aTypedArray,ww=Rw.exportTypedArrayMethod,Dw=[].toLocaleString,Pw=!!Ow&&Aw((function(){Dw.call(new Ow(1))}));ww("toLocaleString",(function(){return Iw(Dw,Pw?Cw(Nw(this)):Nw(this),Cw(arguments))}),Aw((function(){return[1,2].toLocaleString()!=new Ow([1,2]).toLocaleString()}))||!Aw((function(){Ow.prototype.toLocaleString.call([1,2])})));var kw=YA.exportTypedArrayMethod,Mw=a,Uw=I,Lw=n.Uint8Array,xw=Lw&&Lw.prototype||{},Vw=[].toString,Fw=Uw([].join);Mw((function(){Vw.call({})}))&&(Vw=function(){return Fw(this)});var Bw=xw.toString!=Vw;kw("toString",Vw,Bw);var jw=Yi,Gw=n,Hw=$n,zw=B,Kw=Do,Yw=lu,Xw=/MSIE .\./.test(W),Ww=Gw.Function,Jw=function(e){return function(t,r){var i=Yw(arguments.length,1)>2,n=zw(t)?t:Ww(t),o=i?Kw(arguments,2):void 0;return e(i?function(){Hw(n,this,o)}:n,r)}};jw({global:!0,bind:!0,forced:Xw},{setTimeout:Jw(Gw.setTimeout),setInterval:Jw(Gw.setInterval)});var qw=Yi,Zw=ba.findIndex,$w=ah,Qw="findIndex",eD=!0;Qw in[]&&Array(1).findIndex((function(){eD=!1})),qw({target:"Array",proto:!0,forced:eD},{findIndex:function(e){return Zw(this,e,arguments.length>1?arguments[1]:void 0)}}),$w(Qw);var tD,rD,iD=cc,nD="ArrayBuffer",oD=qR.ArrayBuffer;Yi({global:!0,forced:n.ArrayBuffer!==oD},{ArrayBuffer:oD}),iD(nD),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",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"}(tD||(tD={})),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"}(rD||(rD={}));var aD=function(e,t,r){this.code=e,this.message=t,this.error=r},sD=s,cD=I,uD=on,dD=F,lD=cD(h.f),hD=cD([].push),pD=function(e){return function(t){for(var r,i=dD(t),n=uD(i),o=n.length,a=0,s=[];o>a;)r=n[a++],sD&&!lD(i,r)||hD(s,e?[r,i[r]]:i[r]);return s}},fD={entries:pD(!0),values:pD(!1)}.entries;Yi({target:"Object",stat:!0},{entries:function(e){return fD(e)}});var _D=Wr,vD=fo,mD=L,SD=n.RangeError,ED=function(e){var t=vD(mD(this)),r="",i=_D(e);if(i<0||i==1/0)throw SD("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(r+=t);return r},yD=I,gD=ti,bD=fo,TD=L,ID=yD(ED),RD=yD("".slice),AD=Math.ceil,CD=function(e){return function(t,r,i){var n,o,a=bD(TD(t)),s=gD(r),c=a.length,u=void 0===i?" ":bD(i);return s<=c||""==u?a:((o=ID(u,AD((n=s-c)/u.length))).length>n&&(o=RD(o,0,n)),e?a+o:o+a)}},OD={start:CD(!1),end:CD(!0)},ND=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(W),wD=OD.end;Yi({target:"String",proto:!0,forced:ND},{padEnd:function(e){return wD(this,e,arguments.length>1?arguments[1]:void 0)}});var DD=Am;Yi({target:"Number",stat:!0,forced:Number.parseInt!=DD},{parseInt:DD});Yi({target:"ArrayBuffer",stat:!0,forced:!YA.NATIVE_ARRAY_BUFFER_VIEWS},{isView:YA.isView}),Yi({global:!0,forced:!MI},{DataView:qR.DataView});var PD=kt,kD=Pc,MD=Yo,UD=l,LD=Me,xD=function(e,t,r,i){try{return i?t(PD(r)[0],r[1]):t(r)}catch(t){kD(e,"throw",t)}},VD=vc,FD=aa,BD=ii,jD=Eo,GD=Oc,HD=gc,zD=n.Array,KD=function(e){var t=LD(e),r=FD(this),i=arguments.length,n=i>1?arguments[1]:void 0,o=void 0!==n;o&&(n=MD(n,i>2?arguments[2]:void 0));var a,s,c,u,d,l,h=HD(t),p=0;if(!h||this==zD&&VD(h))for(a=BD(t),s=r?new this(a):zD(a);a>p;p++)l=o?n(t[p],p):t[p],jD(s,p,l);else for(d=(u=GD(t,h)).next,s=r?new this:[];!(c=UD(d,u)).done;p++)l=o?xD(u,n,[c.value,p],!0):c.value,jD(s,p,l);return s.length=p,s},YD=KD;Yi({target:"Array",stat:!0,forced:!tu((function(e){Array.from(e)}))},{from:YD});var XD=Yi,WD=eo,JD=I([].reverse),qD=[1,2];XD({target:"Array",proto:!0,forced:String(qD)===String(qD.reverse())},{reverse:function(){return WD(this)&&(this.length=this.length),JD(this)}});var ZD=Yi,$D=n,QD=I,eP=Wr,tP=Lb,rP=ED,iP=a,nP=$D.RangeError,oP=$D.String,aP=Math.floor,sP=QD(rP),cP=QD("".slice),uP=QD(1..toFixed),dP=function(e,t,r){return 0===t?r:t%2==1?dP(e,t-1,r*e):dP(e*e,t/2,r)},lP=function(e,t,r){for(var i=-1,n=r;++i<6;)n+=t*e[i],e[i]=n%1e7,n=aP(n/1e7)},hP=function(e,t){for(var r=6,i=0;--r>=0;)i+=e[r],e[r]=aP(i/t),i=i%t*1e7},pP=function(e){for(var t=6,r="";--t>=0;)if(""!==r||0===t||0!==e[t]){var i=oP(e[t]);r=""===r?i:r+sP("0",7-i.length)+i}return r};ZD({target:"Number",proto:!0,forced:iP((function(){return"0.000"!==uP(8e-5,3)||"1"!==uP(.9,0)||"1.25"!==uP(1.255,2)||"1000000000000000128"!==uP(0xde0b6b3a7640080,0)}))||!iP((function(){uP({})}))},{toFixed:function(e){var t,r,i,n,o=tP(this),a=eP(e),s=[0,0,0,0,0,0],c="",u="0";if(a<0||a>20)throw nP("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return oP(o);if(o<0&&(c="-",o=-o),o>1e-21)if(r=(t=function(e){for(var t=0,r=e;r>=4096;)t+=12,r/=4096;for(;r>=2;)t+=1,r/=2;return t}(o*dP(2,69,1))-69)<0?o*dP(2,-t,1):o/dP(2,t,1),r*=4503599627370496,(t=52-t)>0){for(lP(s,0,r),i=a;i>=7;)lP(s,1e7,0),i-=7;for(lP(s,dP(10,i,1),0),i=t-1;i>=23;)hP(s,1<<23),i-=23;hP(s,1<<i),lP(s,1,1),hP(s,2),u=pP(s)}else lP(s,0,r),lP(s,1<<-t,0),u=pP(s)+sP("0",a);return u=a>0?c+((n=u.length)<=a?"0."+sP("0",a-n)+u:cP(u,0,n-a)+"."+cP(u,n-a)):c+u}});var fP,_P=Math.log,vP=Math.LOG10E;Yi({target:"Math",stat:!0},{log10:Math.log10||function(e){return _P(e)*vP}});var mP=new Uint8Array(16);function SP(){if(!fP&&!(fP="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 fP(mP)}var EP=/^(?:[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 yP(e){return"string"==typeof e&&EP.test(e)}for(var gP=[],bP=0;bP<256;++bP)gP.push((bP+256).toString(16).substr(1));function TP(e,t,r){var i=(e=e||{}).random||(e.rng||SP)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){r=r||0;for(var n=0;n<16;++n)t[r+n]=i[n];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(gP[e[t+0]]+gP[e[t+1]]+gP[e[t+2]]+gP[e[t+3]]+"-"+gP[e[t+4]]+gP[e[t+5]]+"-"+gP[e[t+6]]+gP[e[t+7]]+"-"+gP[e[t+8]]+gP[e[t+9]]+"-"+gP[e[t+10]]+gP[e[t+11]]+gP[e[t+12]]+gP[e[t+13]]+gP[e[t+14]]+gP[e[t+15]]).toLowerCase();if(!yP(r))throw TypeError("Stringified UUID is invalid");return r}(i)}var IP=new TextDecoder,RP=new TextEncoder,AP=function(){return TP()},CP=function(){return Date.now()};function OP(e){for(var t,r,i,n,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=Qf(o),u=c.next();!u.done;u=c.next()){s+=(f=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=Qf(o),p=h.next();!p.done;p=h.next()){var f=p.value;d.set(f,l),l+=f.length}}catch(e){i={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}return d}var NP=function(){return"undefined"==typeof window},wP=function(){function e(){}return e.token2auth=function(t,r,i,n){return n?"Bearer ".concat(n):"Basic ".concat(e.createUnsafeToken(t,r,i))},e.createUnsafeToken=function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))},e.merge=function(r,i){var n,o;void 0===r&&(r={}),void 0===i&&(i={});try{for(var a=Qf(Object.entries(r)),s=a.next();!s.done;s=a.next()){var c=e_(s.value,2),u=c[0],d=c[1];null!==d&&"object"===t(d)?e.merge(r[u],i[u]):void 0!==i[u]&&(r[u]=i[u])}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.ab2str=function(e){return IP.decode(e)},e.ab2obj=function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}},e.str2ab=function(e){return RP.encode(e).buffer},e.ab2b64str=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var r=new FileReader;r.onload=function(){return t(r.result)},r.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function DP(){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,r){var i=r===t.length-1?"0":"1";return Number.parseInt(i+e.join(""),2)}))}var PP=function(){return Math.floor(65535*Math.random())};function kP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function MP(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,i=r.byteLength,n=[];if(i>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return i-1-t})).reverse().map((function(e){return o.getUint8(e)}));n=t_(t_(t_([],e_(a),!1),["..."],!1),e_(s),!1)}else n=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(i,") [").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 UP=function(){return Zf(void 0,void 0,void 0,(function(){var e,t;return $f(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),e.addTransceiver("audio",{direction:"recvonly"}),e.addTransceiver("video",{direction:"recvonly"}),[4,e.createOffer()];case 1:return t=r.sent(),e.close(),[2,t.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))},LP=function(e){return new Promise((function(t,r){var i=(e=Array.isArray(e)?e:[]).length,n=[];0===i?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){i--,n.push(e),0===i&&r(n)}))}))}))};function xP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function VP(e,t){if("boolean"!=typeof e)throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function FP(e,t,r,i){if(void 0===r&&(r=1),void 0===i&&(i=Number.POSITIVE_INFINITY),e<r||e>i||"number"!=typeof e)throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(i,"]. integer only"))}function BP(e,t,r,i){if(void 0===r&&(r=1),void 0===i&&(i=Number.POSITIVE_INFINITY),null==e)throw new aD(tD.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,r){void 0===t&&(t=1);void 0===r&&(r=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=r&&e.length>=t}(e,r,i))throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(i,"]"))}function jP(e,t,r){if(!r.includes(e))throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function GP(e,t){if(KP(e))throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function HP(e,t){if(!(e instanceof ArrayBuffer))throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function zP(e){var t,r;try{var i=navigator.mediaDevices.getSupportedConstraints();try{for(var n=Qf(Object.keys(e)),o=n.next();!o.done;o=n.next()){var a=o.value;i[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}catch(e){}}function KP(e){return null==e}function YP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new aD(tD.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function XP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new aD(tD.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function WP(e){GP(e,"videoPlayerOption")}function JP(e,t){var r,i;if(void 0===t&&(t=64),!e||0===(null===(r=e)||void 0===r?void 0:r.byteLength))throw new aD(tD.INVALID_PARAMS,"The message cannot be empty");if((null==(i=e instanceof ArrayBuffer?e:wP.str2ab(JSON.stringify(e)))?void 0:i.byteLength)>1e3*t)throw new aD(tD.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function qP(e){return![a_.onRemoteStreamStats,a_.onLocalStreamStats].includes(e)}var ZP={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,i,o,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new n(i,o||e,a),c=r?r+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 i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,o=i.length,a=new Array(o);n<o;n++)a[n]=i[n].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,n,o,a){var s=r?r+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,i),!0;case 4:return d.fn.call(d.context,t,i,n),!0;case 5:return d.fn.call(d.context,t,i,n,o),!0;case 6:return d.fn.call(d.context,t,i,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,i);break;case 4:d[u].fn.call(d[u].context,t,i,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,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,i,n){var o=r?r+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||i&&s.context!==i||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||i&&s[c].context!==i)&&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=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(ZP);var $P="[VERTC]",QP=["#0050b3","#0050b3","#0050b3","#0050b3"],ek=!NP()&&window.location.search.includes("_rtc_debug_"),tk=function(){function e(e,t,r){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(ek){for(var i="",n=0;n<this._indent;n++)i+=" ";console.log.apply(console,t_(["%c".concat($P).concat(i,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(QP[this._indent],";")],e_(t),!1))}},e}(),rk=new tk("VERTC",0),ik=function(e){function t(){return e.call(this)||this}return Cf(t,e),t.prototype.safeEmit=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=this.listenerCount(t);try{return e.prototype.emit.apply(this,t_([t],e_(r),!1))}catch(e){return rk.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(n)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Zf(this,void 0,void 0,(function(){var r=this;return $f(this,(function(i){return[2,new Promise((function(i,n){try{r.emit.apply(r,t_(t_([e],e_(t),!1),[i,n],!1))}catch(t){rk.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}(ZP.exports.EventEmitter),nk=xe,ok=function(e){return void 0!==e&&(nk(e,"value")||nk(e,"writable"))},ak=l,sk=G,ck=kt,uk=ok,dk=o,lk=vh;Yi({target:"Reflect",stat:!0},{get:function e(t,r){var i,n,o=arguments.length<3?t:arguments[2];return ck(t)===o?t[r]:(i=dk.f(t,r))?uk(i)?i.value:void 0===i.get?void 0:ak(i.get,o):sk(n=lk(t))?e(n,r,o):void 0}});var hk=Yi,pk=l,fk=kt,_k=G,vk=ok,mk=Ct,Sk=o,Ek=vh,yk=S;var gk=a((function(){var e=function(){},t=mk.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));hk({target:"Reflect",stat:!0,forced:gk},{set:function e(t,r,i){var n,o,a,s=arguments.length<4?t:arguments[3],c=Sk.f(fk(t),r);if(!c){if(_k(o=Ek(t)))return e(o,r,i,s);c=yk(0)}if(vk(c)){if(!1===c.writable||!_k(s))return!1;if(n=Sk.f(s,r)){if(n.get||n.set||!1===n.writable)return!1;n.value=i,mk.f(s,r,n)}else mk.f(s,r,yk(0,i))}else{if(void 0===(a=c.set))return!1;pk(a,s,i)}return!0}});var bk="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function Tk(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var Ik="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",Rk="rtc.rtcplus.com".split(","),Ak={VERSION:"4.42.3",ICE_CONFIG_REQUEST_URLS_INTERNAL:bk.map(Tk),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:Ik,CONFIG_REQUEST_DOMAINS:Rk,CONNECTION_MODE:Wf.AUTO};function Ck(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(Ak.ICE_CONFIG_REQUEST_URLS=t.map(Tk))):void("LOG_SERVER_URL"!==e||t!==zf.overseas?"LOG_SERVER_URL"!==e||t!==zf.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?Ak[e]=t:Ak.LOG_SERVER_URL=t:Ak.LOG_SERVER_URL=Ik:Ak.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function Ok(e){return Ak[e]}function Nk(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||Dk.audio.codec,bitRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.kBitRate)||Dk.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||Dk.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||Dk.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||Dk.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||Dk.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||Dk.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||Dk.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:Dk.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||Dk.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||Dk.video.width,height:(null===(f=t.video)||void 0===f?void 0:f.height)||Dk.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||Dk.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===(S=t.layout)||void 0===S?void 0:S.appData)||Dk.layout.appData}}}}function wk(e,t,r){var i,n,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(i=r.video)||void 0===i?void 0:i.fps)||15,bitrate:1e3*((null===(n=r.video)||void 0===n?void 0:n.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||Xf.PREV_FRAME,canvas:{bgColor:(null===(c=r.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=r.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(l=null===(d=r.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 Dk={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"}},Pk={width:640,height:360,frameRate:30,maxKbps:600},kk={width:1920,height:1080,frameRate:15,maxKbps:3e3};(0,pA.exports)("Uint16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,pA.exports)("Int32",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var Mk={};!function(e){var r="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 r=Array.prototype.slice.call(arguments,1);r.length;){var n=r.shift();if(n){if("object"!==t(n))throw new TypeError(n+"must be non-object");for(var o in n)i(n,o)&&(e[o]=n[o])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var o=0;o<i;o++)e[n+o]=t[r+o]},flattenChunks:function(e){var t,r,i,n,o,a;for(i=0,t=0,r=e.length;t<r;t++)i+=e[t].length;for(a=new Uint8Array(i),n=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,n),n+=o.length;return a}},o={arraySet:function(e,t,r,i,n){for(var o=0;o<i;o++)e[n+o]=t[r+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,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,o))},e.setTyped(r)}(Mk);var Uk={},Lk={},xk={},Vk=Mk;function Fk(e){for(var t=e.length;--t>=0;)e[t]=0}var Bk=256,jk=286,Gk=30,Hk=15,zk=[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],Kk=[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],Yk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Xk=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Wk=new Array(576);Fk(Wk);var Jk=new Array(60);Fk(Jk);var qk=new Array(512);Fk(qk);var Zk=new Array(256);Fk(Zk);var $k=new Array(29);Fk($k);var Qk,eM,tM,rM=new Array(Gk);function iM(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function nM(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function oM(e){return e<256?qk[e]:qk[256+(e>>>7)]}function aM(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function sM(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,aM(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function cM(e,t,r){sM(e,r[2*t],r[2*t+1])}function uM(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function dM(e,t,r){var i,n,o=new Array(16),a=0;for(i=1;i<=Hk;i++)o[i]=a=a+r[i-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=uM(o[s]++,s))}}function lM(e){var t;for(t=0;t<jk;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Gk;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 hM(e){e.bi_valid>8?aM(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 pM(e,t,r,i){var n=2*t,o=2*r;return e[n]<e[o]||e[n]===e[o]&&i[t]<=i[r]}function fM(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&pM(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!pM(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i}function _M(e,t,r){var i,n,o,a,s=0;if(0!==e.last_lit)do{i=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===i?cM(e,n,t):(cM(e,(o=Zk[n])+Bk+1,t),0!==(a=zk[o])&&sM(e,n-=$k[o],a),cM(e,o=oM(--i),r),0!==(a=Kk[o])&&sM(e,i-=rM[o],a))}while(s<e.last_lit);cM(e,256,t)}function vM(e,t){var r,i,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,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+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,r=e.heap_len>>1;r>=1;r--)fM(e,o,r);n=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],fM(e,o,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,o[2*n]=o[2*r]+o[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,o[2*r+1]=o[2*i+1]=n,e.heap[1]=n++,fM(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,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<=Hk;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(i=e.heap[r])+1]+1]+1)>f&&(o=f,_++),c[2*i+1]=o,i>u||(e.bl_count[o]++,a=0,i>=p&&(a=h[i-p]),s=c[2*i],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*i+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(i=e.bl_count[o];0!==i;)(n=e.heap[--r])>u||(c[2*n+1]!==o&&(e.opt_len+=(o-c[2*n+1])*c[2*n],c[2*n+1]=o),i--)}}(e,t),dM(o,u,e.bl_count)}function mM(e,t,r){var i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=t[2*(i+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 SM(e,t,r){var i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),i=0;i<=r;i++)if(n=a,a=t[2*(i+1)+1],!(++s<c&&n===a)){if(s<u)do{cM(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(cM(e,n,e.bl_tree),s--),cM(e,16,e.bl_tree),sM(e,s-3,2)):s<=10?(cM(e,17,e.bl_tree),sM(e,s-3,3)):(cM(e,18,e.bl_tree),sM(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}Fk(rM);var EM=!1;function yM(e,t,r,i){sM(e,0+(i?1:0),3),function(e,t,r,i){hM(e),i&&(aM(e,r),aM(e,~r)),Vk.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}xk._tr_init=function(e){EM||(!function(){var e,t,r,i,n,o=new Array(16);for(r=0,i=0;i<28;i++)for($k[i]=r,e=0;e<1<<zk[i];e++)Zk[r++]=i;for(Zk[r-1]=i,n=0,i=0;i<16;i++)for(rM[i]=n,e=0;e<1<<Kk[i];e++)qk[n++]=i;for(n>>=7;i<Gk;i++)for(rM[i]=n<<7,e=0;e<1<<Kk[i]-7;e++)qk[256+n++]=i;for(t=0;t<=Hk;t++)o[t]=0;for(e=0;e<=143;)Wk[2*e+1]=8,e++,o[8]++;for(;e<=255;)Wk[2*e+1]=9,e++,o[9]++;for(;e<=279;)Wk[2*e+1]=7,e++,o[7]++;for(;e<=287;)Wk[2*e+1]=8,e++,o[8]++;for(dM(Wk,287,o),e=0;e<Gk;e++)Jk[2*e+1]=5,Jk[2*e]=uM(e,5);Qk=new iM(Wk,zk,257,jk,Hk),eM=new iM(Jk,Kk,0,Gk,Hk),tM=new iM(new Array(0),Yk,0,19,7)}(),EM=!0),e.l_desc=new nM(e.dyn_ltree,Qk),e.d_desc=new nM(e.dyn_dtree,eM),e.bl_desc=new nM(e.bl_tree,tM),e.bi_buf=0,e.bi_valid=0,lM(e)},xk._tr_stored_block=yM,xk._tr_flush_block=function(e,t,r,i){var n,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&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<Bk;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),vM(e,e.l_desc),vM(e,e.d_desc),a=function(e){var t;for(mM(e,e.dyn_ltree,e.l_desc.max_code),mM(e,e.dyn_dtree,e.d_desc.max_code),vM(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Xk[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=r+5,r+4<=n&&-1!==t?yM(e,t,r,i):4===e.strategy||o===n?(sM(e,2+(i?1:0),3),_M(e,Wk,Jk)):(sM(e,4+(i?1:0),3),function(e,t,r,i){var n;for(sM(e,t-257,5),sM(e,r-1,5),sM(e,i-4,4),n=0;n<i;n++)sM(e,e.bl_tree[2*Xk[n]+1],3);SM(e,e.dyn_ltree,t-1),SM(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),_M(e,e.dyn_ltree,e.dyn_dtree)),lM(e),i&&hM(e)},xk._tr_tally=function(e,t,r){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&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(Zk[r]+Bk+1)]++,e.dyn_dtree[2*oM(t)]++),e.last_lit===e.lit_bufsize-1},xk._tr_align=function(e){sM(e,2,3),cM(e,256,Wk),function(e){16===e.bi_valid?(aM(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 gM=function(e,t,r,i){for(var n=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(n=n+t[i++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0};var bM=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var TM,IM=function(e,t,r,i){var n=bM,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},RM={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"},AM=Mk,CM=xk,OM=gM,NM=IM,wM=RM,DM=-2,PM=258,kM=262,MM=103,UM=113,LM=666;function xM(e,t){return e.msg=wM[t],t}function VM(e){return(e<<1)-(e>4?9:0)}function FM(e){for(var t=e.length;--t>=0;)e[t]=0}function BM(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(AM.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function jM(e,t){CM._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,BM(e.strm)}function GM(e,t){e.pending_buf[e.pending++]=t}function HM(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function zM(e,t){var r,i,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-kM?e.strstart-(e.w_size-kM):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+PM,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[(r=t)+a]===f&&u[r+a-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(i=PM-(h-o),o=h-PM,i>a){if(e.match_start=t,a=i,i>=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 KM(e){var t,r,i,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-kM)){AM.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{i=e.head[--t],e.head[t]=i>=l?i-l:0}while(--r);t=r=l;do{i=e.prev[--t],e.prev[t]=i>=l?i-l:0}while(--r);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),r=0===d?0:(a.avail_in-=d,AM.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=OM(a.adler,s,d,c):2===a.state.wrap&&(a.adler=NM(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=r,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<kM&&0!==e.strm.avail_in)}function YM(e,t){for(var r,i;;){if(e.lookahead<kM){if(KM(e),e.lookahead<kM&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-kM&&(e.match_length=zM(e,r)),e.match_length>=3)if(i=CM._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,r=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 i=CM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(jM(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(jM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(jM(e,!1),0===e.strm.avail_out)?1:2}function XM(e,t){for(var r,i,n;;){if(e.lookahead<kM){if(KM(e),e.lookahead<kM&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=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!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-kM&&(e.match_length=zM(e,r),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,i=CM._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,r=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++,i&&(jM(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=CM._tr_tally(e,0,e.window[e.strstart-1]))&&jM(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&&(i=CM._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(jM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(jM(e,!1),0===e.strm.avail_out)?1:2}function WM(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}function JM(){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 AM.Buf16(1146),this.dyn_dtree=new AM.Buf16(122),this.bl_tree=new AM.Buf16(78),FM(this.dyn_ltree),FM(this.dyn_dtree),FM(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new AM.Buf16(16),this.heap=new AM.Buf16(573),FM(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new AM.Buf16(573),FM(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 qM(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:UM,e.adler=2===t.wrap?0:1,t.last_flush=0,CM._tr_init(t),0):xM(e,DM)}function ZM(e){var t,r=qM(e);return 0===r&&((t=e.state).window_size=2*t.w_size,FM(t.head),t.max_lazy_match=TM[t.level].max_lazy,t.good_match=TM[t.level].good_length,t.nice_match=TM[t.level].nice_length,t.max_chain_length=TM[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),r}function $M(e,t,r,i,n,o){if(!e)return DM;var a=1;if(-1===t&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>9||8!==r||i<8||i>15||t<0||t>9||o<0||o>4)return xM(e,DM);8===i&&(i=9);var s=new JM;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=i,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 AM.Buf8(2*s.w_size),s.head=new AM.Buf16(s.hash_size),s.prev=new AM.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new AM.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=r,ZM(e)}TM=[new WM(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(KM(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,jM(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-kM&&(jM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(jM(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(jM(e,!1),e.strm.avail_out),1)})),new WM(4,4,8,4,YM),new WM(4,5,16,8,YM),new WM(4,6,32,32,YM),new WM(4,4,16,16,XM),new WM(8,16,32,32,XM),new WM(8,16,128,128,XM),new WM(8,32,128,256,XM),new WM(32,128,258,1024,XM),new WM(32,258,258,4096,XM)],Lk.deflateInit=function(e,t){return $M(e,t,8,15,8,0)},Lk.deflateInit2=$M,Lk.deflateReset=ZM,Lk.deflateResetKeep=qM,Lk.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?DM:(e.state.gzhead=t,0):DM},Lk.deflate=function(e,t){var r,i,n,o;if(!e||!e.state||t>5||t<0)return e?xM(e,DM):DM;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||i.status===LM&&4!==t)return xM(e,0===e.avail_out?-5:DM);if(i.strm=e,r=i.last_flush,i.last_flush=t,42===i.status)if(2===i.wrap)e.adler=0,GM(i,31),GM(i,139),GM(i,8),i.gzhead?(GM(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),GM(i,255&i.gzhead.time),GM(i,i.gzhead.time>>8&255),GM(i,i.gzhead.time>>16&255),GM(i,i.gzhead.time>>24&255),GM(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),GM(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(GM(i,255&i.gzhead.extra.length),GM(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=NM(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(GM(i,0),GM(i,0),GM(i,0),GM(i,0),GM(i,0),GM(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),GM(i,3),i.status=UM);else{var a=8+(i.w_bits-8<<4)<<8;a|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(a|=32),a+=31-a%31,i.status=UM,HM(i,a),0!==i.strstart&&(HM(i,e.adler>>>16),HM(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>n&&(e.adler=NM(e.adler,i.pending_buf,i.pending-n,n)),BM(e),n=i.pending,i.pending!==i.pending_buf_size));)GM(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(e.adler=NM(e.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(e.adler=NM(e.adler,i.pending_buf,i.pending-n,n)),BM(e),n=i.pending,i.pending===i.pending_buf_size)){o=1;break}o=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,GM(i,o)}while(0!==o);i.gzhead.hcrc&&i.pending>n&&(e.adler=NM(e.adler,i.pending_buf,i.pending-n,n)),0===o&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(e.adler=NM(e.adler,i.pending_buf,i.pending-n,n)),BM(e),n=i.pending,i.pending===i.pending_buf_size)){o=1;break}o=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,GM(i,o)}while(0!==o);i.gzhead.hcrc&&i.pending>n&&(e.adler=NM(e.adler,i.pending_buf,i.pending-n,n)),0===o&&(i.status=MM)}else i.status=MM;if(i.status===MM&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&BM(e),i.pending+2<=i.pending_buf_size&&(GM(i,255&e.adler),GM(i,e.adler>>8&255),e.adler=0,i.status=UM)):i.status=UM),0!==i.pending){if(BM(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&VM(t)<=VM(r)&&4!==t)return xM(e,-5);if(i.status===LM&&0!==e.avail_in)return xM(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&i.status!==LM){var s=2===i.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(KM(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=CM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(jM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(jM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(jM(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var r,i,n,o,a=e.window;;){if(e.lookahead<=PM){if(KM(e),e.lookahead<=PM&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+PM;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=PM-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=CM._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=CM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(jM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(jM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(jM(e,!1),0===e.strm.avail_out)?1:2}(i,t):TM[i.level].func(i,t);if(3!==s&&4!==s||(i.status=LM),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===s&&(1===t?CM._tr_align(i):5!==t&&(CM._tr_stored_block(i,0,0,!1),3===t&&(FM(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),BM(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(GM(i,255&e.adler),GM(i,e.adler>>8&255),GM(i,e.adler>>16&255),GM(i,e.adler>>24&255),GM(i,255&e.total_in),GM(i,e.total_in>>8&255),GM(i,e.total_in>>16&255),GM(i,e.total_in>>24&255)):(HM(i,e.adler>>>16),HM(i,65535&e.adler)),BM(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},Lk.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==MM&&t!==UM&&t!==LM?xM(e,DM):(e.state=null,t===UM?xM(e,-3):0):DM},Lk.deflateSetDictionary=function(e,t){var r,i,n,o,a,s,c,u,d=t.length;if(!e||!e.state)return DM;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return DM;for(1===o&&(e.adler=OM(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(FM(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new AM.Buf8(r.w_size),AM.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,KM(r);r.lookahead>=3;){i=r.strstart,n=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+3-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++}while(--n);r.strstart=i,r.lookahead=2,KM(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,r.wrap=o,0},Lk.deflateInfo="pako deflate (from Nodeca project)";var QM={},eU=Mk,tU=!0,rU=!0;try{String.fromCharCode.apply(null,[0])}catch(e){tU=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){rU=!1}for(var iU=new eU.Buf8(256),nU=0;nU<256;nU++)iU[nU]=nU>=252?6:nU>=248?5:nU>=240?4:nU>=224?3:nU>=192?2:1;function oU(e,t){if(t<65534&&(e.subarray&&rU||!e.subarray&&tU))return String.fromCharCode.apply(null,eU.shrinkBuf(e,t));for(var r="",i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r}iU[254]=iU[254]=1,QM.string2buf=function(e){var t,r,i,n,o,a=e.length,s=0;for(n=0;n<a;n++)55296==(64512&(r=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=e.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new eU.Buf8(s),o=0,n=0;o<s;n++)55296==(64512&(r=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=e.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},QM.buf2binstring=function(e){return oU(e,e.length)},QM.binstring2buf=function(e){for(var t=new eU.Buf8(e.length),r=0,i=t.length;r<i;r++)t[r]=e.charCodeAt(r);return t},QM.buf2string=function(e,t){var r,i,n,o,a=t||e.length,s=new Array(2*a);for(i=0,r=0;r<a;)if((n=e[r++])<128)s[i++]=n;else if((o=iU[n])>4)s[i++]=65533,r+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&r<a;)n=n<<6|63&e[r++],o--;o>1?s[i++]=65533:n<65536?s[i++]=n:(n-=65536,s[i++]=55296|n>>10&1023,s[i++]=56320|1023&n)}return oU(s,i)},QM.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+iU[e[r]]>t?r:t};var aU=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},sU=Lk,cU=Mk,uU=QM,dU=RM,lU=aU,hU=Object.prototype.toString;function pU(e){if(!(this instanceof pU))return new pU(e);this.options=cU.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 lU,this.strm.avail_out=0;var r=sU.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(dU[r]);if(t.header&&sU.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(i="string"==typeof t.dictionary?uU.string2buf(t.dictionary):"[object ArrayBuffer]"===hU.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=sU.deflateSetDictionary(this.strm,i)))throw new Error(dU[r]);this._dict_set=!0}}function fU(e,t){var r=new pU(t);if(r.push(e,!0),r.err)throw r.msg||dU[r.err];return r.result}pU.prototype.push=function(e,t){var r,i,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;i=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=uU.string2buf(e):"[object ArrayBuffer]"===hU.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 cU.Buf8(o),n.next_out=0,n.avail_out=o),1!==(r=sU.deflate(n,i))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(uU.buf2binstring(cU.shrinkBuf(n.output,n.next_out))):this.onData(cU.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==r);return 4===i?(r=sU.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==i||(this.onEnd(0),n.avail_out=0,!0)},pU.prototype.onData=function(e){this.chunks.push(e)},pU.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=cU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Uk.Deflate=pU,Uk.deflate=fU,Uk.deflateRaw=function(e,t){return(t=t||{}).raw=!0,fU(e,t)},Uk.gzip=function(e,t){return(t=t||{}).gzip=!0,fU(e,t)};var _U={},vU=s,mU=Ct,SU=Y_,EU=a,yU=RegExp.prototype;vU&&EU((function(){return"sy"!==Object.getOwnPropertyDescriptor(yU,"flags").get.call({dotAll:!0,sticky:!0})}))&&mU.f(yU,"flags",{configurable:!0,get:SU});var gU={},bU=Mk,TU=15,IU=[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],RU=[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],AU=[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],CU=[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],OU=Mk,NU=gM,wU=IM,DU=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A;r=e.state,i=e.next_in,R=e.input,n=i+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,p=r.hold,f=r.bits,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,S=(1<<r.distbits)-1;e:do{f<15&&(p+=R[i++]<<f,f+=8,p+=R[i++]<<f,f+=8),E=_[p&m];t:for(;;){if(p>>>=y=E>>>24,f-=y,0===(y=E>>>16&255))A[o++]=65535&E;else{if(!(16&y)){if(0==(64&y)){E=_[(65535&E)+(p&(1<<y)-1)];continue t}if(32&y){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}g=65535&E,(y&=15)&&(f<y&&(p+=R[i++]<<f,f+=8),g+=p&(1<<y)-1,p>>>=y,f-=y),f<15&&(p+=R[i++]<<f,f+=8,p+=R[i++]<<f,f+=8),E=v[p&S];r:for(;;){if(p>>>=y=E>>>24,f-=y,!(16&(y=E>>>16&255))){if(0==(64&y)){E=v[(65535&E)+(p&(1<<y)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&E,f<(y&=15)&&(p+=R[i++]<<f,(f+=8)<y&&(p+=R[i++]<<f,f+=8)),(b+=p&(1<<y)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=y,f-=y,b>(y=o-a)){if((y=b-y)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(T=0,I=h,0===l){if(T+=u-y,y<g){g-=y;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}}else if(l<y){if(T+=u+l-y,(y-=l)<g){g-=y;do{A[o++]=h[T++]}while(--y);if(T=0,l<g){g-=y=l;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}}}else if(T+=l-y,y<g){g-=y;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}for(;g>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],g-=3;g&&(A[o++]=I[T++],g>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],g-=3}while(g>2);g&&(A[o++]=A[T++],g>1&&(A[o++]=A[T++]))}break}}break}}while(i<n&&o<s);i-=g=f>>3,p&=(1<<(f-=g<<3))-1,e.next_in=i,e.next_out=o,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=p,r.bits=f},PU=function(e,t,r,i,n,o,a,s){var c,u,d,l,h,p,f,_,v,m=s.bits,S=0,E=0,y=0,g=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,N=0,w=new bU.Buf16(16),D=new bU.Buf16(16),P=null,k=0;for(S=0;S<=TU;S++)w[S]=0;for(E=0;E<i;E++)w[t[r+E]]++;for(b=m,g=TU;g>=1&&0===w[g];g--);if(b>g&&(b=g),0===g)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(y=1;y<g&&0===w[y];y++);for(b<y&&(b=y),R=1,S=1;S<=TU;S++)if(R<<=1,(R-=w[S])<0)return-1;if(R>0&&(0===e||1!==g))return-1;for(D[1]=0,S=1;S<TU;S++)D[S+1]=D[S]+w[S];for(E=0;E<i;E++)0!==t[r+E]&&(a[D[t[r+E]]++]=E);if(0===e?(O=P=a,p=19):1===e?(O=IU,N-=257,P=RU,k-=257,p=256):(O=AU,P=CU,p=-1),C=0,E=0,S=y,h=o,T=b,I=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){f=S-I,a[E]<p?(_=0,v=a[E]):a[E]>p?(_=P[k+a[E]],v=O[N+a[E]]):(_=96,v=0),c=1<<S-I,y=u=1<<T;do{n[h+(C>>I)+(u-=c)]=f<<24|_<<16|v|0}while(0!==u);for(c=1<<S-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,E++,0==--w[S]){if(S===g)break;S=t[r+a[E]]}if(S>b&&(C&l)!==d){for(0===I&&(I=b),h+=y,R=1<<(T=S-I);T+I<g&&!((R-=w[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;n[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(n[h+C]=S-I<<24|64<<16|0),s.bits=b,0},kU=-2,MU=12,UU=30;function LU(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function xU(){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 OU.Buf16(320),this.work=new OU.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function VU(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 OU.Buf32(852),t.distcode=t.distdyn=new OU.Buf32(592),t.sane=1,t.back=-1,0):kU}function FU(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,VU(e)):kU}function BU(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?kU:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,FU(e))):kU}function jU(e,t){var r,i;return e?(i=new xU,e.state=i,i.window=null,0!==(r=BU(e,t))&&(e.state=null),r):kU}var GU,HU,zU=!0;function KU(e){if(zU){var t;for(GU=new OU.Buf32(512),HU=new OU.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(PU(1,e.lens,0,288,GU,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;PU(2,e.lens,0,32,HU,0,e.work,{bits:5}),zU=!1}e.lencode=GU,e.lenbits=9,e.distcode=HU,e.distbits=5}function YU(e,t,r,i){var n,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new OU.Buf8(o.wsize)),i>=o.wsize?(OU.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>i&&(n=i),OU.arraySet(o.window,t,r-i,n,o.wnext),(i-=n)?(OU.arraySet(o.window,t,r-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}gU.inflateReset=FU,gU.inflateReset2=BU,gU.inflateResetKeep=VU,gU.inflateInit=function(e){return jU(e,15)},gU.inflateInit2=jU,gU.inflate=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A=0,C=new OU.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 kU;(r=e.state).mode===MU&&(r.mode=13),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,T=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,C[0]=255&u,C[1]=u>>>8&255,r.check=wU(r.check,C,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=UU;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=UU;break}if(d-=4,b=8+(15&(u>>>=4)),0===r.wbits)r.wbits=b;else if(b>r.wbits){e.msg="invalid window size",r.mode=UU;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:MU,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=UU;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=UU;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=wU(r.check,C,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.head&&(r.head.time=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,r.check=wU(r.check,C,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=wU(r.check,C,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=wU(r.check,C,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=r.length)>s&&(p=s),p&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),OU.arraySet(r.head.extra,i,o,p,b)),512&r.flags&&(r.check=wU(r.check,i,p,o)),s-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;p=0;do{b=i[o+p++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&r.flags&&(r.check=wU(r.check,i,p,o)),s-=p,o+=p,b)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;p=0;do{b=i[o+p++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&r.flags&&(r.check=wU(r.check,i,p,o)),s-=p,o+=p,b)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=UU;break}u=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=MU;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}e.adler=r.check=LU(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=MU;case MU:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(KU(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=UU}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=UU;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;OU.arraySet(n,i,o,p,a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=MU;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=UU;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.lens[O[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,I={bits:r.lenbits},T=PU(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid code lengths set",r.mode=UU;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(S<16)u>>>=v,d-=v,r.lens[r.have++]=S;else{if(16===S){for(R=v+2;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=UU;break}b=r.lens[r.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===S){for(R=v+3;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}d-=v,b=0,p=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(R=v+7;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}d-=v,b=0,p=11+(127&(u>>>=v)),u>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=UU;break}for(;p--;)r.lens[r.have++]=b}}if(r.mode===UU)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=UU;break}if(r.lenbits=9,I={bits:r.lenbits},T=PU(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid literal/lengths set",r.mode=UU;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},T=PU(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,T){e.msg="invalid distances set",r.mode=UU;break}if(r.mode=20,6===t)break e;case 20:r.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,r.hold=u,r.bits=d,DU(e,h),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===MU&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(m&&0==(240&m)){for(E=v,y=m,g=S;m=(A=r.lencode[g+((u&(1<<E+y)-1)>>E)])>>>16&255,S=65535&A,!(E+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}u>>>=E,d-=E,r.back+=E}if(u>>>=v,d-=v,r.back+=v,r.length=S,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=MU;break}if(64&m){e.msg="invalid literal/length code",r.mode=UU;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(R=r.extra;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<<r.distbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(0==(240&m)){for(E=v,y=m,g=S;m=(A=r.distcode[g+((u&(1<<E+y)-1)>>E)])>>>16&255,S=65535&A,!(E+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}u>>>=E,d-=E,r.back+=E}if(u>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=UU;break}r.offset=S,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(R=r.extra;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=UU;break}r.mode=25;case 25:if(0===c)break e;if(p=h-c,r.offset>p){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=UU;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),_=r.window}else _=n,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{n[a++]=_[f++]}while(--p);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;n[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=i[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?wU(r.check,n,h,a-h):NU(r.check,n,h,a-h)),h=c,(r.flags?u:LU(u))!==r.check){e.msg="incorrect data check",r.mode=UU;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=UU;break}u=0,d=0}r.mode=29;case 29:T=1;break e;case UU:T=-3;break e;case 31:return-4;default:return kU}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<UU&&(r.mode<27||4!==t))&&YU(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,r.total+=h,r.wrap&&h&&(e.adler=r.check=r.flags?wU(r.check,n,h,e.next_out-h):NU(r.check,n,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===MU?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},gU.inflateEnd=function(e){if(!e||!e.state)return kU;var t=e.state;return t.window&&(t.window=null),e.state=null,0},gU.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?kU:(r.head=t,t.done=!1,0):kU},gU.inflateSetDictionary=function(e,t){var r,i=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?kU:11===r.mode&&NU(1,t,i,0)!==r.check?-3:YU(e,t,i,i)?(r.mode=31,-4):(r.havedict=1,0):kU},gU.inflateInfo="pako inflate (from Nodeca project)";var XU={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 WU=gU,JU=Mk,qU=QM,ZU=XU,$U=RM,QU=aU,eL=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},tL=Object.prototype.toString;function rL(e){if(!(this instanceof rL))return new rL(e);this.options=JU.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 QU,this.strm.avail_out=0;var r=WU.inflateInit2(this.strm,t.windowBits);if(r!==ZU.Z_OK)throw new Error($U[r]);if(this.header=new eL,WU.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=qU.string2buf(t.dictionary):"[object ArrayBuffer]"===tL.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=WU.inflateSetDictionary(this.strm,t.dictionary))!==ZU.Z_OK))throw new Error($U[r])}function iL(e,t){var r=new rL(t);if(r.push(e,!0),r.err)throw r.msg||$U[r.err];return r.result}rL.prototype.push=function(e,t){var r,i,n,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?ZU.Z_FINISH:ZU.Z_NO_FLUSH,"string"==typeof e?s.input=qU.binstring2buf(e):"[object ArrayBuffer]"===tL.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 JU.Buf8(c),s.next_out=0,s.avail_out=c),(r=WU.inflate(s,ZU.Z_NO_FLUSH))===ZU.Z_NEED_DICT&&u&&(r=WU.inflateSetDictionary(this.strm,u)),r===ZU.Z_BUF_ERROR&&!0===d&&(r=ZU.Z_OK,d=!1),r!==ZU.Z_STREAM_END&&r!==ZU.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==ZU.Z_STREAM_END&&(0!==s.avail_in||i!==ZU.Z_FINISH&&i!==ZU.Z_SYNC_FLUSH)||("string"===this.options.to?(n=qU.utf8border(s.output,s.next_out),o=s.next_out-n,a=qU.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&JU.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(JU.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)&&r!==ZU.Z_STREAM_END);return r===ZU.Z_STREAM_END&&(i=ZU.Z_FINISH),i===ZU.Z_FINISH?(r=WU.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ZU.Z_OK):i!==ZU.Z_SYNC_FLUSH||(this.onEnd(ZU.Z_OK),s.avail_out=0,!0)},rL.prototype.onData=function(e){this.chunks.push(e)},rL.prototype.onEnd=function(e){e===ZU.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=JU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},_U.Inflate=rL,_U.inflate=iL,_U.inflateRaw=function(e,t){return(t=t||{}).raw=!0,iL(e,t)},_U.ungzip=iL;var nL={};(0,Mk.assign)(nL,Uk,_U,XU);var oL,aL,sL,cL,uL,dL,lL,hL,pL,fL,_L,vL,mL,SL,EL,yL,gL,bL,TL,IL,RL,AL,CL,OL,NL,wL,DL,PL,kL,ML,UL,LL,xL,VL,FL,BL,jL,GL,HL,zL,KL,YL,XL,WL,JL,qL,ZL,$L=nL,QL=new tk("monitor",0);!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"}(oL||(oL={})),function(e){e.RTC="rtc"}(aL||(aL={})),function(e){e.W_5="5"}(sL||(sL={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(cL||(cL={})),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"}(uL||(uL={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(dL||(dL={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(lL||(lL={})),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"}(hL||(hL={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(pL||(pL={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(fL||(fL={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(_L||(_L={})),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"}(vL||(vL={})),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"}(mL||(mL={})),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"}(SL||(SL={})),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"}(EL||(EL={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(yL||(yL={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(gL||(gL={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(bL||(bL={})),function(e){e.W_0="0",e.W_1="1"}(TL||(TL={})),function(e){e.UP="up",e.DOWN="down"}(IL||(IL={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(RL||(RL={})),function(e){e.UP="up",e.DOWN="down"}(AL||(AL={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(CL||(CL={})),function(e){e.W_0="0",e.W_1="1"}(OL||(OL={})),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"}(NL||(NL={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(wL||(wL={})),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"}(DL||(DL={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(PL||(PL={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(kL||(kL={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(ML||(ML={})),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"}(UL||(UL={})),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"}(LL||(LL={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(xL||(xL={})),function(e){e.BEGIN="begin",e.END="end"}(VL||(VL={})),function(e){e.BEGIN="begin",e.END="end"}(FL||(FL={})),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"}(BL||(BL={})),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"}(jL||(jL={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(GL||(GL={})),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"}(HL||(HL={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(zL||(zL={})),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"}(KL||(KL={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(YL||(YL={})),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"}(XL||(XL={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(WL||(WL={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(JL||(JL={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(qL||(qL={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(ZL||(ZL={}));var ex,tx,rx,ix,nx,ox,ax,sx,cx,ux,dx=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(r){t["_"+r]=e[r]})),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}),e}(),lx=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 dx(t),NP()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return Cf(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 r=this;if(e||this.dataBuffer.length){var i={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||(r.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||r.sucSend():e?r.send(e):(r.unshift(i.data),t?r.send():r.errSend())}};var o=Ak.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!NP()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",i),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!NP()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(i));else{var a=$L.gzip(JSON.stringify(i));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,r=t.event_key,i=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.connection_id,p=t.rtc_sid,f=t.engine_session_id,_=t.rtc_business_id,v=t.project_key,m=t.network_type,S=t.app_version,E=t.aid,y=t.device_model,g=t.device_brand,b=t.common_extra_info,T=t.had_selected_p2p,I=t.rtc_env_type,R=t.user_agent;Object.assign(e,{event_key:r,device_id:i,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,connection_id:h,rtc_sid:p,engine_session_id:f,rtc_business_id:_,project_key:v,network_type:m,app_version:S,aid:E,device_model:y,device_brand:g,common_extra_info:b,had_selected_p2p:T,rtc_env_type:I,user_agent:R}),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)},t.prototype.rtcSdkApiCall=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcSdkCallback=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcGetConfig=function(e,t,r,i,n,o,a,s){void 0===s&&(s={});var c=Jf(Jf({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:i,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,r,i,n){void 0===n&&(n={});var o=Jf(Jf({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcReconnected=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.rtcGetAccess=function(e,t,r,i,n,o,a){void 0===a&&(a={});var s=Jf(Jf({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:i,host:n,connect_session_id:o},this.modify_ids),{common_extra_info:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.rtcNodeChange=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcSignalingMsgError=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcSignaling=function(e,t,r,i,n,o){void 0===o&&(o={});var a=Jf(Jf({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:i,direction:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,r,i,n){void 0===n&&(n={});var o=Jf(Jf({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcBeginCreateOffer=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcCreateOffer=function(e,t,r,i,n,o){void 0===o&&(o={});var a=Jf(Jf({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:i,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,r,i,n,o,a,s){void 0===s&&(s={});var c=Jf(Jf({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:i,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,r,i,n,o,a,s){void 0===s&&(s={});var c=Jf(Jf({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:i,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,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.firstRemoteVideoRender=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.rtcPublishStat=function(e,t,r,i,n){void 0===n&&(n={});var o=Jf(Jf({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,r,i,n){void 0===n&&(n={});var o=Jf(Jf({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcMediaStatistics=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcMessageStatistics=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf(Jf(Jf(Jf({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),{media_server_ip:r}),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcError=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.rtcInvokeStatus=function(e,t,r,i,n,o){void 0===o&&(o={});var a=Jf(Jf({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:i,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 r=Jf(Jf(Jf({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});QL.print("rtcFirstFrame",JSON.stringify(e)),this.push(r)},t.prototype.rtcMuteRemote=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now()},e),{media_type:t}),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.sdkInitEngine=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.joinRoom=function(e,t,r,i,n){void 0===n&&(n={});var o=Jf(Jf({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,r,i,n,o){void 0===o&&(o={});var a=Jf(Jf({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:i,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 r=Jf(Jf({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(r)},t.prototype.rtcDeviceError=function(e,t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v){void 0===v&&(v={});var m=Jf(Jf({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:i,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,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var r=Jf(Jf(Jf({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(r)},t.prototype.rtcEncodeFirstFrame=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t.prototype.rtcFirstFrameEncoded=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t.prototype.rtcSendFirstPacket=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t.prototype.rtcRecvFirstPacket=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t.prototype.rtcRecvFirstFrame=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t.prototype.rtcDecodeFirstFrame=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t}(ik),hx=new lx,px=new lx,fx=new lx,_x=hx.commonStats,vx=px.commonStats,mx=fx.commonStats,Sx={default:hx,rtm:px,outsideRoom:fx};function Ex(e){void 0===e&&(e="default");for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,i,n){if("function"==typeof n.value){var o=n.value;n.value=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var a={};t.forEach((function(e,t){a[e]=r[t]})),Sx[e].rtcSdkApiCall(i,0,JSON.stringify(MP(r)),a);var s=o.apply(this,r);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return Sx[e].rtcSdkCallback(i,0,JSON.stringify(MP([t||{}]))),t})).catch((function(t){throw Sx[e].rtcSdkCallback(i,t.code,JSON.stringify(t.message)),t})):(Sx[e].rtcSdkCallback(i,0,JSON.stringify(MP([s||{}]))),s)}}}}function yx(e,t,r){void 0===r&&(r=0),(e===a_.onUserMessageReceivedOutsideRoom||e===a_.onUserBinaryMessageReceivedOutsideRoom?px:hx).rtcSdkCallback(e,r,JSON.stringify(t))}function gx(e,t,r,i){void 0===r&&(r=0),void 0===i&&(i=!1),(i?px:hx).rtcInvokeStatus(JSON.stringify(t),r,e,"",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"}(ex||(ex={})),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"}(tx||(tx={})),function(e){e.RSCP="RSCP"}(rx||(rx={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(ix||(ix={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(nx||(nx={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(ox||(ox={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(sx||(sx={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(cx||(cx={})),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"}(ux||(ux={}));var bx,Tx,Ix=((ax={})[ux.SUCCESS]=[0,"success"],ax[ux.TIMEOUT]=[tD.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],ax[ux.BROKEN]=[tD.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],ax[ux.NO_RECEIVER]=[tD.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],ax[ux.NO_RELAYPATH]=[tD.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],ax[ux.SEND_TO_SERVER_ERROR]=[tD.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],ax[ux.SERVER_RESPONSE_ERROR]=[tD.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],ax[ux.NOT_JOIN]=[tD.USER_MESSAGE_NOT_JOIN,"not join room"],ax[ux.INIT]=[tD.USER_MESSAGE_INIT,"not init."],ax[ux.NO_CONNECTION]=[tD.USER_MESSAGE_NO_CONNECTION,"no connection."],ax[ux.EXCEED_MAX_LENGTH]=[tD.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],ax[ux.EMPTY_USER]=[tD.USER_MESSAGE_EMPTY_USER,"user id is empty."],ax[ux.NOT_LOGIN]=[tD.USER_MESSAGE_NOT_LOGIN,"not login."],ax[ux.SERVER_PARAMS_NOTSET]=[tD.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],ax[ux.UNKNOWN]=[tD.USER_MESSAGE_UNKNOWN,"unknown."],ax),Rx=new tk("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(bx||(bx={})),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"}(Tx||(Tx={}));var Ax=function(e){function t(t){var r=e.call(this)||this;return r._dataChannel=t,r._singlingCache=new Map,r._p2pCache=new Map,r._rttIds={},r._p2pMessageId=0,r._clearDataChannelListener=r._handleHandler(),window.__rtc_mock_signaling__=r.emit.bind(r),r}return Cf(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,r){var i=this;return hx.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",yL.UP),new Promise((function(n,o){var a=i._genHeader(r);a.id=DP();var s=a.id.join("-"),c=setTimeout((function(){i._singlingCache.delete(s),o(new aD(tD.TIME_OUT,"".concat(e," message time out")))}),6e4);i._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),n(e)},error:function(e){clearTimeout(c),o(e)}}),Rx.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),i._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:Tx.C2GW})},t.prototype.sendP2PMessage=function(e,t){var r=e.msg,i=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(e,["msg"]);return Zf(this,void 0,void 0,(function(){var e,n,o,a,s;return $f(this,(function(c){switch(c.label){case 0:return e=r instanceof ArrayBuffer,n=this._sendP2PMessage,o=[Jf({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:sx.SEND,type:cx.P2P,err:ux.SUCCESS},i)],s={binary:e},e?[4,wP.ab2b64str(r)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=r,c.label=3;case 3:return[2,n.apply(this,[Jf.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var r=this;return void 0===t&&(t={}),kP(e.msg)?this._rttIds[e.id]=e.id:Rx.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(i,n){var o=r._genHeader(Jf(Jf({needAck:!0,functionType:Tx.C2C},t),{id:DP()}));if(e.dir===sx.SEND){var a=setTimeout((function(){r._p2pCache.delete(e.id),n(new aD(tD.TIME_OUT,"P2P message timeout"))}),6e4);r._p2pCache.set(e.id,{success:function(e){clearTimeout(a),i(e)},error:function(e){clearTimeout(a);var t=e_(Ix[e.err]||[tD.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],i=t[1];n({code:r,message:e.msg||i})}})}r._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new aD(tD.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var i=t.version+(+t.zip<<5)+(+t.encrypt<<6),n=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=wP.str2ab(JSON.stringify([e,r])),a=OP(Uint8Array,t_([i,n],e_(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),r=0,i=t[r++],n=t[r++],o={version:15&i,zip:16==(16&i),encrypt:32==(32&i),needAck:1==(1&n),direction:(2&n)>>1,functionType:(60&n)>>2,binary:64==(64&n)};if(o.needAck||o.direction===bx.ACK){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}o.id=Array.from(t.slice(2,r))}return{header:o,data:t.slice(r)}},t.prototype._feedbackSignaling=function(e,t){var r=this._genHeader({needAck:!0,direction:bx.ACK,id:e.split("-").map((function(e){return+e}))});Rx.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")},t.prototype._handleMessage=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A,C,O,N,w,D,P,k,M,U,L,x;return $f(this,(function(V){switch(V.label){case 0:i=this._dispartData(e),n=i.header,o=i.data,n.zip&&((a=new $L.Inflate).push(o,!0),o=a.result),s=wP.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&hx.rtcSignalingMsgError(-1,e.message,SL.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case Tx.C2S:return[3,1];case Tx.C2C:return[3,6];case Tx.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==bx.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],Rx.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,wP.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=V.sent(),V.label=4;case 4:this.emit(d,Jf({},c)),hx.rtcSignaling(0,s,"on-".concat(d),"Recv",yL.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)===sx.FEEDBACK||kP(null==c?void 0:c.msg)?delete this._rttIds[h]:Rx.print("Signal","<<<<<< p2p response",c),c.dir){case sx.SEND:return[3,7];case sx.FEEDBACK:return[3,16]}return[3,17];case 7:return kP(null==c?void 0:c.msg)?[3,15]:(f=(p=c).binary,_=p.msg,v=p.room,m=p.to,S=p.from,E=""===v?f?tx.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:tx.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:f?tx.USER_BINARY_MESSAGE_RECEIVED:tx.USER_MESSAGE_RECEIVED,m?[3,11]:(y=this.emit,g=[tx.ON_CUSTOM_MESSAGE],L={clientId:S,binary:f},f?[4,wP.b64str2ab(_)]:[3,9]));case 8:return b=V.sent(),[3,10];case 9:b=_,V.label=10;case 10:return y.apply(this,g.concat([(L.message=b,L)])),[3,17];case 11:return T=this.emit,I=[E],R=[Jf({},c)],x={},f?[4,wP.b64str2ab(_)]:[3,13];case 12:return A=V.sent(),[3,14];case 13:A=_,V.label=14;case 14:T.apply(this,I.concat([Jf.apply(void 0,R.concat([(x.msg=A,x)]))])),V.label=15;case 15:return this._sendP2PMessage(Jf(Jf({},c),{dir:sx.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===ux.SUCCESS?C.success(c.id):C.error(c)),[3,17];case 17:return[3,19];case 18:if(n.direction===bx.ACK)O=(null===(r=n.id)||void 0===r?void 0:r.join("-"))||"",this._handleAckMessage(O,c[0]||{},s);else if(N=e_(c,2),w=N[0],D=N[1],P=void 0===D?{}:D,"RXMediaMsg"===w&&(k=P.type,M=P.data,hx.rtcSignaling(0,s,"on-".concat(k),"Recv",yL.DOWN),"RSCP"===k))try{U=JSON.parse(M),Array.isArray(U)&&this.emit(k,U)}catch(e){}V.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){Rx.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){Rx.print("_handleHandler","dataChannel error",t),e.emit("close",t)},i=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",i),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",i)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),Jf({version:2,zip:!1,encrypt:!1,needAck:!0,direction:bx.SEND,functionType:Tx.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,r){var i=this._singlingCache.get(e);i&&(this._singlingCache.delete(e),200===t.code?i.success(t):i.error(t),Rx.print("Signal","<<<<<< [".concat(i.signalingType,"-ack]"),t)),hx.rtcSignaling(0,r,null==i?void 0:i.signalingType,"Ack",yL.DOWN)},t}(ZP.exports.EventEmitter),Cx=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,r=e.method,i=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(r,i,!0);try{for(var l=Qf(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=e_(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"})},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,r,i){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:i})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),Ox="RTC_DEVICE_ID",Nx="RTC_ACCESS_NODE",wx="RTC_ACCESS_URLS",Dx="RTC_H264_BLACK_LIST",Px=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(e){return null}},e.prototype.set=function(e,t,r){void 0===r&&(r=-1);var i={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(i)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),kx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Cf(t,e),t.prototype.getDeviceId=function(){if(NP())return"";var e=this.get(Ox);return e||(e=TP()),this.set(Ox,e),e},t.prototype.getAccessNode=function(e){return this.get("".concat(Nx,"_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,r){return this.set("".concat(Nx,"_").concat(e,"-BytePlus"),t,1e3*r)},t.prototype.clearAccessNode=function(e){this.delete("".concat(Nx,"_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat(wx,"-BytePlus"))},t.prototype.setAccessUrls=function(e){var t=e.map((function(e){var t=e.host,r=e.path;return"https://".concat(t).concat(r)}));return this.set("".concat(wx,"-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat(wx,"-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get(Dx)},t.prototype.setH264BlackList=function(e){return this.set(Dx,e)},t}(Px),Mx=new kx,Ux=new tk("ICE Request",3),Lx=function(){function e(){this._request=new Cx}return e.prototype.getAccessNode=function(e,t,r,i,n,o,a){return Zf(this,void 0,void 0,(function(){var s;return $f(this,(function(c){return(s=Mx.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,r,i,n,o,a),gx("es.R.node.cache",s),[2,Promise.resolve(s)]):[2,this.getAccessNodeFromServer(e,t,r,i,n,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,r,i,n,o,a){return Zf(this,void 0,void 0,(function(){var s,c,u=this;return $f(this,(function(d){return s=Mx.getAccessUrls(),c=!0,gx("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=Ak.ICE_CONFIG_REQUEST_URLS,c=!1,gx("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=Ak.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,gx("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,r,i,n,o,a).then((function(t){var r=t.nodes[0];return Mx.setAccessNode(e,r,t.ttl||11200),t.dispatchDomains&&Mx.setAccessUrls(t.dispatchDomains),r})).catch((function(s){if(c)return gx("es.R.req.fallback",""),Mx.clearAccessUrls(),u.getAccessNodeFromServer(e,t,r,i,n,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,r,i,n,o,a,s){var c;return Zf(this,void 0,void 0,(function(){var r,u,d,l=this;return $f(this,(function(h){return r={appID:t,userID:i,deviceID:n,connectSessionID:AP(),os:"web",sdkVersion:Ak.VERSION,expectedAddr:Ok("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s},o&&a&&(r.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NodeChanged",reason:o}}],delete r.expectedAddr),u=Date.now(),hx.rtcGetAccess(0,JSON.stringify(r),0,vL.REQUEST,e.join(","),r.connectSessionID),d=e.map((function(e,t){return Zf(l,void 0,void 0,(function(){var i,n,o;return $f(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,r)];case 1:return i=a.sent(),[3,3];case 2:throw n=a.sent(),new aD(tD.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==i.code)throw new aD(tD.ICE_SERVER_WRONG,"get ICE config failed",{server_code:i.code,message:JSON.stringify(i)});if(!(o=i.nodes[0]))throw new aD(tD.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:i.code,message:JSON.stringify(i)});return[2,{result:i,firstNode:o,index:t}]}}))}))})),[2,LP(d).then((function(t){var i=t.result;t.firstNode;var n=t.index;return hx.rtcGetAccess(200,JSON.stringify(i),Date.now()-u,vL.RESPONSE,e[n],r.connectSessionID),i})).catch((function(t){var i,n,o=null===(i=t[0])||void 0===i?void 0:i.error;throw hx.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,vL.RESPONSE,e.join(","),r.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(Ux.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),xx=function(){function e(){this._request=new Cx}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.42.3",deviceType:"web"},r=Ak.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));hx.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),lL.REQUEST,"",!1);var i=r.map((function(r,i){return Zf(e,void 0,void 0,(function(){var e;return $f(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(r,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new aD(tD.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new aD(tD.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:i}]}}))}))}));return new Promise((function(e){LP(i).then((function(t){var i=t.result,n=t.index;Mx.setH264BlackList(i.web_h264_black_list),hx.rtcGetConfig(200,JSON.stringify(i),0,r[n],lL.RESPONSE,"",!1),e(i.web_h264_black_list)})).catch((function(t){hx.rtcGetConfig(500,t.message,0,"",lL.RESPONSE,"",!1),e(Mx.getH264BlackList()||[])}))}))},e}(),Vx={},Fx={},Bx={exports:{}},jx=Bx.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(jx).forEach((function(e){jx[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},r=function(e,r,i){var n=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:n&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:n?r[e.name]:r;!function(e,r,i,n){if(n&&!i)r[n]=t(e[1]);else for(var o=0;o<i.length;o+=1)null!=e[o+1]&&(r[i[o]]=t(e[o+1]))}(i.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},i=Bx.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<(i[t]||[]).length;s+=1){var c=i[t][s];if(c.reg.test(n))return r(c,a,n)}})),t.media=o,t};var o=function(e,r){var i=r.split(/=(.+)/,2);return 2===i.length?e[i[0]]=t(i[1]):1===i.length&&r.length>1&&(e[i[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 r=[],i=e.split(" ").map(t),n=0;n<i.length;n+=3)r.push({component:i[n],ip:i[n+1],port:i[n+2]});return r},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 r,i=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),i=!0),{scid:r,paused:i}}))}))}}(Fx);var Gx=Bx.exports,Hx=/%[sdv%]/g,zx=function(e){var t=1,r=arguments,i=r.length;return e.replace(Hx,(function(e){if(t>=i)return e;var n=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(n);case"%d":return Number(n);case"%v":return""}}))},Kx=function(e,t,r){var i=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var o=t.names[n];t.name?i.push(r[t.name][o]):i.push(r[t.names[n]])}else i.push(r[t.name]);return zx.apply(null,i)},Yx=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Xx=["i","c","b","a"],Wx=Fx,Jx=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 r=t.outerOrder||Yx,i=t.innerOrder||Xx,n=[];return r.forEach((function(t){Gx[t].forEach((function(r){r.name in e&&null!=e[r.name]?n.push(Kx(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){n.push(Kx(t,r,e))}))}))})),e.media.forEach((function(e){n.push(Kx("m",Gx.m[0],e)),i.forEach((function(t){Gx[t].forEach((function(r){r.name in e&&null!=e[r.name]?n.push(Kx(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){n.push(Kx(t,r,e))}))}))}))})),n.join("\r\n")+"\r\n"};Vx.write=Jx,Vx.parse=Wx.parse,Vx.parseParams=Wx.parseParams,Vx.parseFmtpConfig=Wx.parseFmtpConfig,Vx.parsePayloads=Wx.parsePayloads,Vx.parseRemoteCandidates=Wx.parseRemoteCandidates,Vx.parseImageAttributes=Wx.parseImageAttributes,Vx.parseSimulcastStreamList=Wx.parseSimulcastStreamList;var qx=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this._iceConfigNode.iceParams,i=Vx.parse(e);return null===(t=i.media)||void 0===t||t.forEach((function(e){e.iceUfrag=null==r?void 0:r.clientIceUfrag,e.icePwd=null==r?void 0:r.clientIcePwd,e.iceOptions="renomination"})),Vx.write(i)},e}(),Zx=function(){function e(e){this._iceConfigNode=e}return e.prototype.getServerUfrag=function(){return Zf(this,void 0,void 0,(function(){var e,t;return $f(this,(function(r){switch(r.label){case 0:return e=this._iceConfigNode.iceParams,t=this,[4,rV(e.serverIceUfrag)];case 1:return t._iceUfrag=r.sent(),_x.setStats({connection_id:this._iceUfrag}),[2]}}))}))},e.prototype.modifyByIceNode=function(e){var t,r=this,i=this._iceConfigNode.certFingerprint,n=Vx.parse(e);return(null==n?void 0:n.fingerprint)&&(n.fingerprint={type:"sha-256",hash:i}),null===(t=null==n?void 0:n.media)||void 0===t||t.forEach((function(e){return r.modifyMlineByIceNode(e)})),Vx.write(n)},e.prototype.modifyMlineByIceNode=function(e){var t=this._iceConfigNode,r=t.publicIPs,i=t.certFingerprint,n=t.iceParams;e.fingerprint&&(e.fingerprint={type:"sha-256",hash:i}),e.icePwd=n.serverIcePwd,e.iceUfrag=this._iceUfrag,e.setup="active",this._candidates||(this._candidates=tV(r)),e.candidates=this._candidates,e.iceOptions="renomination","application"===e.type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144})},e}();function $x(e,t){var r,i=Vx.parse(e),n=[];return i.media=i.media.map((function(e){return t.includes(e.mid+"")?(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):"inactive"!==e.direction&&n.push(e.mid),e})),(null===(r=i.groups)||void 0===r?void 0:r[0])&&(i.groups[0].mids=n.join(" ")),i}var Qx=function(e,t){var r,i;try{var n=Vx.parse(e),o=Vx.parse(t),a="".concat(null===(r=o.groups)||void 0===r?void 0:r[0].mids).split(" "),s="".concat(null===(i=n.groups)||void 0===i?void 0:i[0].mids).split(" "),c={};a.forEach((function(e){return c[e]=e}));var u={};s.forEach((function(e){c[e]||(u[e]=e)}));var d="",l="";return n.media=n.media.filter((function(e){return u[e.mid]&&"audio"===e.type?d="".concat(e.mid):u[e.mid]&&"video"===e.type&&(l="".concat(e.mid)),u[e.mid]})),delete n.groups,delete n.msidSemantic,{partialSdp:Vx.write(n),audioMid:d,videoMid:l}}catch(e){return null}},eV=function(e,t){var r;try{var i=Vx.parse(e),n=[];return null===(r=i.media)||void 0===r||r.forEach((function(e){(null==t?void 0:t.includes("".concat(e.mid)))&&n.push(e)})),i.media=n,delete i.groups,delete i.msidSemantic,Vx.write(i)}catch(e){return""}},tV=function(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,i=[],n=Ok("CONNECTION_MODE");return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&n!==Wf.FORCE_TCP&&e.udpPorts.forEach((function(e){i.push(Jf(Jf({},o),{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&n!==Wf.FORCE_UDP&&e.tcpPorts.forEach((function(e){i.push(Jf(Jf({},o),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),i},rV=function(e){return Zf(void 0,void 0,void 0,(function(){var t,r,i,n,o,a,s;return $f(this,(function(c){switch(c.label){case 0:return t=new TextEncoder,r=t.encode("PREC"),n=Uint8Array.bind,[4,wP.b64str2ab(e)];case 1:return i=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=OP(Uint8Array,r,i,o,a),[4,wP.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))};function iV(e,t){var r=1,i=e;(e.width>t.width||e.height>t.height)&&(r=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,i={width:Math.floor(e.width/r),height:Math.floor(e.height/r)});return Jf(Jf({},i),{scaleResolutionDownBy:r})}var nV=[{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 oV={width:160,height:90,frameRate:15,maxkbps:100},aV={width:320,height:180,frameRate:15,maxkbps:300};var sV,cV,uV,dV,lV,hV="safari"===(sV="none",NP()||(null!==window.navigator.userAgent.match("Firefox")?sV="mozilla":null!==window.navigator.userAgent.match("Chrome")?(sV="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(sV="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(sV="safari")),sV);!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"}(cV||(cV={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(uV||(uV={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(dV||(dV={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(lV||(lV={}));var pV,fV=function(){function e(e){this.peer=e,this.stats=[]}return e.prototype.handleCodec=function(e){return e},e.prototype.handleInboundRtp=function(e){return e},e.prototype.handleOutboundRtp=function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e},e.prototype.handleRemoteInboundRtp=function(e){return e},e.prototype.handleRemoteOutboundRtp=function(e){return e},e.prototype.handleMediaSource=function(e){return e},e.prototype.handleCsrc=function(e){return e},e.prototype.handlePeerConnection=function(e){return e},e.prototype.handleDataChannel=function(e){return e},e.prototype.handleStream=function(e){return e},e.prototype.handleTrack=function(e){return e},e.prototype.handleTransceiver=function(e){return e},e.prototype.handleSender=function(e){return e},e.prototype.handleReceiver=function(e){return e},e.prototype.handleTransport=function(e){return e},e.prototype.handleSctpTransport=function(e){return e},e.prototype.handleCandidatePair=function(e){return e},e.prototype.handleLocalCandidate=function(e){return e},e.prototype.handleRemoteCandidate=function(e){return e},e.prototype.handleCertificate=function(e){return e},e.prototype.handleIceServer=function(e){return e},e.prototype.processStats=function(e){var t=this;e.forEach((function(e){var r;switch(e.type){case cV.candidatePair:r=t.handleCandidatePair;break;case cV.certificate:r=t.handleCertificate;break;case cV.remoteCandidate:r=t.handleRemoteCandidate;break;case cV.remoteInboundRtp:r=t.handleInboundRtp;break;case cV.remoteOutboundRtp:r=t.handleOutboundRtp;break;case cV.sctpTransport:r=t.handleSctpTransport;break;case cV.sender:r=t.handleSender;break;case cV.stream:r=t.handleStream;break;case cV.track:r=t.handleTrack;break;case cV.transceiver:r=t.handleTransceiver;break;case cV.transport:r=t.handleTransport;break;case cV.codec:r=t.handleCodec;break;case cV.csrc:r=t.handleCsrc;break;case cV.dataChannel:r=t.handleDataChannel;break;case cV.iceServer:r=t.handleIceServer;break;case cV.mediaSource:r=t.handleMediaSource;break;case cV.outboundRtp:r=t.handleOutboundRtp;break;case cV.inboundRtp:r=t.handleInboundRtp;break;case cV.peerConnection:r=t.handlePeerConnection;break;case cV.receiver:r=t.handleReceiver;break;case cV.localCandidate:r=t.handleLocalCandidate;break;default:r=function(e){return e}}r=r.bind(t),t.stats.push(r(e))}))},e.prototype.getExtraStats=function(){return Zf(this,void 0,void 0,(function(){var e=this;return $f(this,(function(t){return[2,new Promise((function(t,r){if(hV||void 0!==window.InstallTrigger)return t(e.stats);try{e.peer.getStats((function(r){r.result().forEach((function(t){if(!_V.includes(t.type)){var r={};t.names().forEach((function(e){r[e]=t.stat(e)})),r.id=t.id,r.type=t.type,r.timestamp=t.timestamp,e.stats.push(r)}})),t(e.stats)}))}catch(e){r(e)}}))]}))}))},e.prototype.getStats=function(e,t){return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return i.trys.push([0,7,,8]),[4,this.peer.getStats(e)];case 1:r=i.sent(),this.processStats(r),i.label=2;case 2:return i.trys.push([2,5,,6]),t?[3,4]:[4,this.getExtraStats()];case 3:i.sent(),i.label=4;case 4:return[3,6];case 5:return i.sent(),[3,6];case 6:return[3,8];case 7:return i.sent(),[3,8];case 8:return[2,this.stats]}}))}))},e}(),_V=["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"],vV=function(e,t,r){return Zf(void 0,void 0,void 0,(function(){var i;return $f(this,(function(n){switch(n.label){case 0:return i=[],e instanceof RTCPeerConnection?[4,new fV(e).getStats(t,r)]:[2,i];case 1:return[2,i=n.sent()]}}))}))},mV=function(){return Zf(void 0,void 0,void 0,(function(){var e,t,r,i,n,o,a;return $f(this,(function(s){switch(s.label){case 0:if(pV)return[2,pV];e=[],s.label=1;case 1:return s.trys.push([1,5,,6]),[4,UP()];case 2:return(t=s.sent())?(null==t?void 0:t.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))?(r=navigator.userAgent.toLowerCase(),i=!1,n=["heytapbrowser","mqqbrowser","miuibrowser"],[4,(new xx).getH264BlackList()]):[3,4]:[2,e];case 3:for(o=s.sent(),n.push.apply(n,t_([],e_(o),!1)),a=0;a<n.length;a++)r.includes(n[a])&&(i=!0);!i&&e.push("H264"),s.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),pV=e,[2,e];case 5:return s.sent(),[2,e];case 6:return[2]}}))}))},SV=function(){return"undefined"!=typeof TransformStream&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},EV=new tk("BasicHandler",3),yV=SV(),gV={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!yV||void 0},bV=function(e){function t(t){var r=e.call(this)||this;return r.monitor=t,r._peerConnection=new RTCPeerConnection(gV),r._dataChannel=r._peerConnection.createDataChannel("signaling"),r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,i;EV.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){EV.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,mL["".concat(e.toUpperCase())])},r}return Cf(t,e),t.prototype.connect=function(e){return Zf(this,void 0,void 0,(function(){var t,r,i=this;return $f(this,(function(n){switch(n.label){case 0:return EV.print("connect","invoke connect"),[4,this._peerConnection.createOffer()];case 1:return t=n.sent(),this._localSdp=new qx(e),[4,this.setLocalDescription(t.sdp)];case 2:return n.sent(),this._remoteSdp=new Zx(e),[4,this._remoteSdp.getServerUfrag()];case 3:return n.sent(),r=this._remoteSdp.modifyByIceNode(t.sdp),[4,this.setRemoteDescription(r)];case 4:return n.sent(),[4,new Promise((function(e,t){i._dataChannel.onopen=function(){EV.print("connect","dataChannel open"),gx("es.dc.open",""),e("")},i._dataChannel.onerror=function(e){hx.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,SL.INVALID_DATA),gx("es.dc.error",""),t(e)},i._dataChannel.onclose=function(e){gx("es.dc.close",""),t(e)},i._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==i._peerConnection.iceConnectionState&&"closed"!==i._peerConnection.iceConnectionState&&"failed"!==i._peerConnection.connectionState||t(e)}))}))];case 5:return n.sent(),EV.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(){this.disconnect(),this._localSdp=void 0,this._remoteSdp=void 0},t.prototype.publish=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T;return $f(this,(function(I){switch(I.label){case 0:return r=e.stream,i=null==e?void 0:e.videoTrack,n=null==e?void 0:e.audioTrack,o={},a=[],Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length&&(s=null==i?void 0:i.getTrack(),c={width:640,height:360,frameRate:30},s&&(u=null==s?void 0:s.getSettings(),c={width:Math.floor(u.width),height:Math.floor(u.height),frameRate:Math.floor(u.frameRate)}),d=null==e?void 0:e.videoEncodeConfig[0],l=iV(c,d),e.prevScaleResolutionDownBy=l.scaleResolutionDownBy,h={maxBitrate:1e3*d.maxKbps,scaleResolutionDownBy:l.scaleResolutionDownBy,rid:"0",maxFramerate:d.frameRate||15},o.sendEncodings=[h],a.push({width:l.width,height:l.height,framerate:d.frameRate,maxkbps:d.maxKbps,rid:"0"}),e.enableSimulcast&&(p=[],f=function(e){for(var t=0,r=e.width*e.height,i=0;i<nV.length;i++)if(r>=nV[i].totalPixels){t=i;break}if(0===t)return nV[t].maxLayers;var n=nV[t-1].totalPixels;return(n-r)/(n-nV[t].totalPixels)<.1?nV[t-1].maxLayers:nV[t].maxLayers}(l),EV.print("simulcast() ","maxLayers: %o",f),1===e.videoEncodeConfig.length?(p=function(e,t){var r=[];if(t<=1)return r;var i=1,n=1;return e.width/e.height>16/9?(i=e.width/oV.width,n=e.width/aV.width):(i=e.height/oV.height,n=e.height/aV.height),r.push({maxkbps:oV.maxkbps,scaleResolutionDownBy:i,frameRate:oV.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),t<=2||i>2&&r.unshift({maxkbps:aV.maxkbps,scaleResolutionDownBy:n,frameRate:aV.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),r}(c,f),EV.print("simulcast() ","simulcastLayers: %o",p)):(p=e.videoEncodeConfig.slice(1).slice(1-f).map((function(e){return Jf({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},iV(c,e))})),EV.print("simulcast() ","simulcastLayers2: %o",p)),p.forEach((function(e,t){var r={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};o.sendEncodings&&o.sendEncodings.unshift(r),a.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})})))),EV.print("publish videoTransceiverInit videoDescriptions","",o,a),_=null==n?void 0:n.getTrack(),(null==n?void 0:n.mixType)!==i_.PLAYOUT&&(null==n?void 0:n.mixedAudioTrack)&&(_=null==n?void 0:n.mixedAudioTrack),e.audioTransceiver=this._peerConnection.addTransceiver(_||"audio",{direction:"sendonly",streams:[r]}),v=e.audioTransceiver,(null==t?void 0:t.audioRed)&&RTCRtpSender.getCapabilities&&v.setCodecPreferences&&(EV.print("publish","publish audio red is true"),(m=(RTCRtpSender.getCapabilities("audio")||{}).codecs)&&(S=m.findIndex((function(e){return"audio/red"===e.mimeType})),E=e_(m.splice(S,1),1),y=E[0],m.unshift(y),v.setCodecPreferences(m),EV.print("publish","audio preferences codecs",m))),yV&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver((null==i?void 0:i.getTrack())||"video",Jf({direction:"sendonly",streams:[r]},o)),yV&&e.initVideoEncodedTransform(),EV.print("sender.getParameters()",e.videoTransceiver.sender.getParameters()),g=CP(),hx.rtcBeginCreateOffer(gL.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:if(b=I.sent(),hx.rtcCreateOffer(0,bL.UP,e.streamId,e.userId,CP()-g),T=Qx(b.sdp,this.getLocalDescriptionSdp()),!b.sdp||!T)throw new aD(tD.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Jf(Jf({sdp:b.sdp},T),{type:"incroffer",semantics:"unified-plan",videoDescriptions:a})]}}))}))},t.prototype.updateScaleResolutionDownBy=function(e){var t,r,i,n,o;return Zf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h;return $f(this,(function(p){return(a=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack())&&(s=null==a?void 0:a.getSettings(),c={width:Math.floor(s.width),height:Math.floor(s.height),frameRate:Math.floor(s.frameRate)},u=iV(c,e.videoEncodeConfig[0]),(d=null===(i=null===(r=e.videoTransceiver)||void 0===r?void 0:r.sender)||void 0===i?void 0:i.getParameters())&&(l=u.scaleResolutionDownBy/e.prevScaleResolutionDownBy,h=1,d.encodings=null===(n=null==d?void 0:d.encodings)||void 0===n?void 0:n.map((function(e){var t=Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*l,1);return t>h&&(h=t),e})),e.prevScaleResolutionDownBy=h,null===(o=e.videoTransceiver)||void 0===o||o.sender.setParameters(d))),[2]}))}))},t.prototype.subscribe=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i,n,o,a;return $f(this,(function(s){switch(s.label){case 0:return r="incroffer",i="unified-plan",t?[2,{sdp:this.getLocalDescriptionSdp(),partialSdp:eV(this.getLocalDescriptionSdp(),[t.audioMid,t.videoMid]),audioMid:t.audioMid,videoMid:t.videoMid,type:r,semantics:i}]:(e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),yV&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),yV&&e.initVideoEncodedTransform(),n=CP(),hx.rtcBeginCreateOffer(gL.DOWN,e.streamId,e.userId),[4,this._peerConnection.createOffer()]);case 1:if(o=s.sent(),hx.rtcCreateOffer(0,bL.DOWN,e.streamId,e.userId,CP()-n),a=Qx(o.sdp,this.getLocalDescriptionSdp()),!o.sdp||!a)throw new aD(tD.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Jf(Jf({sdp:o.sdp},a),{type:r,semantics:i})]}}))}))},t.prototype.setAnswerSdp=function(e,t,r,i,n){var o;return Zf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return $f(this,(function(p){switch(p.label){case 0:return hx.rtcRecvAnswer(0,RL.INCRANSWER,0,t,n,i.streamId,i.userId),a=this._peerConnection.remoteDescription,s=Vx.parse(null==a?void 0:a.sdp),c=null===(o=s.media)||void 0===o?void 0:o.reduce((function(e,t){return e[t.mid]=t,e}),{}),Vx.parse(t).media.forEach((function(e){return c[e.mid]=e})),u=[],d=Vx.parse(e),l=d.media.map((function(e){var t;r&&r[e.mid]&&(e.mid=r[e.mid]),"inactive"!==e.direction&&u.push(e.mid);var i=c[e.mid];return null===(t=h._remoteSdp)||void 0===t||t.modifyMlineByIceNode(i),e.bundleOnly||(i.port=e.port),i})),s.media=l,d.groups=[{mids:u.join(" "),type:"BUNDLE"}],s.groups=d.groups,[4,this.setLocalDescription(Vx.write(d),i,n)];case 1:return p.sent(),[4,this.setRemoteDescription(Vx.write(s),i,n)];case 2:return p.sent(),[2]}}))}))},t.prototype.setLocalDescription=function(e,t,r){var i,n;return Zf(this,void 0,void 0,(function(){var o,a,s,c,u,d,l;return $f(this,(function(h){switch(h.label){case 0:o=null===(i=this._localSdp)||void 0===i?void 0:i.modifyByIceNode(e),a=new RTCSessionDescription({type:"offer",sdp:o}),s=CP(),c=r||IL.UP,u=(null==t?void 0:t.streamId)||"",d=(null===(n=t)||void 0===n?void 0:n.userId)||"",h.label=1;case 1:return h.trys.push([1,3,,4]),EV.print("setOffer","set offer: ",a),[4,this._peerConnection.setLocalDescription(a)];case 2:return h.sent(),hx.rtcSetDescription(0,a.sdp,TL.W_1,c,u,d,CP()-s,{type:"offer"}),[3,4];case 3:throw(l=h.sent())instanceof Error&&hx.rtcSetDescription(-1,l.message,TL.W_1,c,u,d,CP()-s,{type:"offer"}),l;case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t,r){var i;return Zf(this,void 0,void 0,(function(){var n,o,a,s,c,u;return $f(this,(function(d){switch(d.label){case 0:n=new RTCSessionDescription({type:"answer",sdp:e}),o=CP(),a=r||IL.UP,s=(null==t?void 0:t.streamId)||"",c=(null===(i=t)||void 0===i?void 0:i.userId)||"",d.label=1;case 1:return d.trys.push([1,3,,4]),EV.print("setAnswer","set answer: ",n),[4,this._peerConnection.setRemoteDescription(n)];case 2:return d.sent(),hx.rtcSetDescription(0,n.sdp,TL.W_0,a,s,c,CP()-o,{type:"answer"}),[3,4];case 3:throw(u=d.sent())instanceof Error&&hx.rtcSetDescription(-1,u.message,TL.W_0,a,s,c,CP()-o,{type:"answer"}),u;case 4:return[2]}}))}))},t.prototype.getLocalDescriptionSdp=function(){var e,t,r,i;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.localDescription)||void 0===t?void 0:t.sdp)return null===(i=null===(r=this._peerConnection)||void 0===r?void 0:r.localDescription)||void 0===i?void 0:i.sdp;throw Error()},t.prototype.getRemoteDescriptionSdp=function(){var e,t,r,i;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.remoteDescription)||void 0===t?void 0:t.sdp)return null===(i=null===(r=this._peerConnection)||void 0===r?void 0:r.remoteDescription)||void 0===i?void 0:i.sdp;throw Error()},t.prototype.closeMLine=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n,o,a,s=this;return $f(this,(function(c){switch(c.label){case 0:return EV.print("closeMids","closeMids: ",e),i=this.getLocalDescriptionSdp(),n=$x(i,e),o=this.getRemoteDescriptionSdp(),a=$x(o,e),[4,this._peerConnection.createOffer()];case 1:return c.sent(),[4,this.setLocalDescription(Vx.write(n))];case 2:return c.sent(),(null===(t=null==n?void 0:n.media)||void 0===t?void 0:t.length)!==(null===(r=null==a?void 0:a.media)||void 0===r?void 0:r.length)&&n.media.slice(a.media.length).forEach((function(e){var t;null===(t=s._remoteSdp)||void 0===t||t.modifyMlineByIceNode(e),a.media.push(e)})),Array.isArray(n.media)&&Array.isArray(a.media)&&n.media.forEach((function(e,t){a.media[t]&&(a.media[t].mid=e.mid)})),[4,this.setRemoteDescription(Vx.write(a))];case 3:return c.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return Zf(this,void 0,void 0,(function(){var e;return $f(this,(function(t){switch(t.label){case 0:return[4,UP()];case 1:if(!(e=t.sent()))throw new aD(tD.NOT_SUPPORTED,"Get offer Error");return[2,{sdp:e,semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.getStats=function(e,t){return vV(this._peerConnection,e,t)},t.prototype.rollback=function(e,t){var r;return Zf(this,void 0,void 0,(function(){return $f(this,(function(i){switch(i.label){case 0:return EV.print("rollback()","signalingState: %o",this._peerConnection.signalingState),"stable"!==this._peerConnection.signalingState?[3,2]:[4,null===(r=this._peerConnection)||void 0===r?void 0:r.setLocalDescription(new RTCSessionDescription({sdp:e,type:"offer"}))];case 1:i.sent(),i.label=2;case 2:return[4,this.closeMLine(t)];case 3:return i.sent(),[2]}}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}(ZP.exports.EventEmitter),TV=new tk("Locker",2),IV=1,RV=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=IV++,e&&(this.name=e),TV.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,TV.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var r=new Promise((function(r){e=function(){t.locks-=1,TV.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),i=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),i},e}(),AV=I,CV=ic,OV=Cm.exports.getWeakData,NV=kt,wV=G,DV=lc,PV=Yc,kV=xe,MV=Or.set,UV=Or.getterFor,LV=ba.find,xV=ba.findIndex,VV=AV([].splice),FV=0,BV=function(e){return e.frozen||(e.frozen=new jV)},jV=function(){this.entries=[]},GV=function(e,t){return LV(e.entries,(function(e){return e[0]===t}))};jV.prototype={get:function(e){var t=GV(this,e);if(t)return t[1]},has:function(e){return!!GV(this,e)},set:function(e,t){var r=GV(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=xV(this.entries,(function(t){return t[0]===e}));return~t&&VV(this.entries,t,1),!!~t}};var HV,zV={getConstructor:function(e,t,r,i){var n=e((function(e,n){DV(e,o),MV(e,{type:t,id:FV++,frozen:void 0}),null!=n&&PV(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=UV(t),s=function(e,t,r){var i=a(e),n=OV(NV(t),!0);return!0===n?BV(i).set(t,r):n[i.id]=r,e};return CV(o,{delete:function(e){var t=a(this);if(!wV(e))return!1;var r=OV(e);return!0===r?BV(t).delete(e):r&&kV(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!wV(e))return!1;var r=OV(e);return!0===r?BV(t).has(e):r&&kV(r,t.id)}}),CV(o,r?{get:function(e){var t=a(this);if(wV(e)){var r=OV(e);return!0===r?BV(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),n}},KV=n,YV=I,XV=ic,WV=Cm.exports,JV=_S,qV=zV,ZV=G,$V=Mm,QV=Or.enforce,eF=or,tF=!KV.ActiveXObject&&"ActiveXObject"in KV,rF=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},iF=JV("WeakMap",rF,qV);if(eF&&tF){HV=qV.getConstructor(rF,"WeakMap",!0),WV.enable();var nF=iF.prototype,oF=YV(nF.delete),aF=YV(nF.has),sF=YV(nF.get),cF=YV(nF.set);XV(nF,{delete:function(e){if(ZV(e)&&!$V(e)){var t=QV(this);return t.frozen||(t.frozen=new HV),oF(this,e)||t.frozen.delete(e)}return oF(this,e)},has:function(e){if(ZV(e)&&!$V(e)){var t=QV(this);return t.frozen||(t.frozen=new HV),aF(this,e)||t.frozen.has(e)}return aF(this,e)},get:function(e){if(ZV(e)&&!$V(e)){var t=QV(this);return t.frozen||(t.frozen=new HV),aF(this,e)?sF(this,e):t.frozen.get(e)}return sF(this,e)},set:function(e,t){if(ZV(e)&&!$V(e)){var r=QV(this);r.frozen||(r.frozen=new HV),aF(this,e)?cF(this,e,t):r.frozen.set(e,t)}else cF(this,e,t);return this}})}var uF=function(e){function t(){var t=e.call(this)||this;return t._hasVideoPermission=!1,t._hasAudioPermission=!1,t.inited=!1,t.deviceMap={audioinput:new Map,audiooutput:new Map,videoinput:new Map},t._handleDeviceChange=t._handleDeviceChange.bind(t),!NP()&&t.refreshDevices(),t}return Cf(t,e),t.prototype.refreshDevices=function(){return Zf(this,void 0,void 0,(function(){var e,t=this;return $f(this,(function(r){switch(r.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return(e=r.sent()).forEach((function(r){var i;null===(i=t.deviceMap[r.kind])||void 0===i||i.set(r.deviceId,{deviceName:r.label||dF(r,e),deviceInfo:r,deviceId:r.deviceId,deviceType:r.kind,deviceState:"active"})})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e;return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return"function"==typeof(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",this._handleDeviceChange),[2]}))}))},t.prototype._handleDeviceChange=function(){return Zf(this,void 0,void 0,(function(){var e,t,r=this;return $f(this,(function(i){switch(i.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=i.sent(),t=Array.from(t_(t_(t_([],e_(this.deviceMap.audioinput.values()),!1),e_(this.deviceMap.videoinput.values()),!1),e_(this.deviceMap.audiooutput.values()),!1)),e.forEach((function(t){var i=r.deviceMap[t.kind].get(t.deviceId),n={deviceName:t.label||dF(t,e),deviceType:t.kind,deviceId:t.deviceId,deviceInfo:t,deviceState:"active"};r.deviceMap[t.kind].set(t.deviceId,n),i&&"inactive"!==i.deviceState||r.emit("onMediaDeviceStateChanged",Jf({},n))})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId&&e.kind===t.deviceType}))||(t.deviceState="inactive",r.deviceMap[t.deviceType].delete(t.deviceId),r.emit(a_.onMediaDeviceStateChanged,t))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return Zf(this,void 0,void 0,(function(){var e=this;return $f(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new aD(tD.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasVideoPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasVideoPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasVideoPermission]}}))}))},t.prototype.getAudioPermission=function(){return Zf(this,void 0,void 0,(function(){var e=this;return $f(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new aD(tD.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasAudioPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasAudioPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasAudioPermission]}}))}))},t.prototype.getDevices=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getAudioPermission()];case 1:case 2:return e.sent(),[3,3];case 3:return e.trys.push([3,5,,6]),[4,this.getVideoPermission()];case 4:case 5:return e.sent(),[3,6];case 6:return[4,this.refreshDevices()];case 7:return e.sent(),[2,Array.from(t_(t_(t_([],e_(this.deviceMap.audioinput.values()),!1),e_(this.deviceMap.videoinput.values()),!1),e_(this.deviceMap.audiooutput.values()),!1)).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getMicrophones=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.audioinput.values()).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getCameras=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.videoinput.values()).filter((function(e){return"active"===e.deviceState}))]}))}))},t.prototype.getAudioPlayback=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.audiooutput.values()).filter((function(e){return"active"===e.deviceState}))]}))}))},t.prototype.getDeviceById=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return[4,this.getDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},Object.defineProperty(t.prototype,"hasAudioPermission",{get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new aD(tD.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVideoPermission",{get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new aD(tD.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(ik),dF=function(e,t){var r=t.filter((function(t){return t.kind===e.kind})).findIndex((function(t){return t===e}));return{audioinput:"microphone_",audiooutput:"speaker_",videoinput:"camera_"}[e.kind]+r},lF=new uF,hF=function(){function e(){}return e.prototype.getAudioContextInstance=function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance},e}(),pF=function(){function e(e){var t=fF.getAudioContextInstance();if(e instanceof MediaStreamTrack){var r=new MediaStream;r.addTrack(e),this._audioSource=t.createMediaStreamSource(r)}else e instanceof AudioNode?this._audioSource=e:(this._audioSource=t.createMediaElementSource(e),this._audioSource.connect(t.destination));var i=t.createAnalyser();this._audioSource.connect(i),this._analyserNode=i}return e.prototype.getAudioLevel=function(){var e=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(e);var t=0;return e.forEach((function(e){return t=Math.max(t,Math.abs(e-128))})),t/128*255},e.prototype.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect()},e}(),fF=new hF,_F=new tk("VERTC",0),vF=new WeakMap,mF=function(e){return vF.get(e)},SF=function(e){function t(t,r){var i=e.call(this)||this;return i._trackId=t,i.mediaType=r,i}return Cf(t,e),t.prototype.getId=function(){return this._trackId},t}(ik),EF=function(e){function t(t,r,i){var n=e.call(this,r,i)||this;return n._mediaTrack=t,n._initListeners(),n}return Cf(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.setTrack=function(e){this._mediaTrack=e},t.prototype.close=function(){var e;return 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(){hx.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(SF),yF=function(e){function t(t,r,i){var n=e.call(this,r,i)||this;return n._mediaTrack=t,n}return Cf(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(SF),gF=function(e){function t(t,r){var i=e.call(this,t,r,"video")||this;return i.dummy=!1,i}return Cf(t,e),t.prototype.updateVideoCaptureConfig=function(){var e;return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig?(_F.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t.prototype.replaceTrack=function(e){this.setTrack(e)},t}(EF),bF=function(e){function t(t,r){var i=e.call(this,t,r,"audio")||this;return i.mixType=i_.PLAYOUT_AND_PUBLISH,i}return Cf(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new pF(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(_F.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}(EF),TF=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Cf(t,e),t}(yF),IF=function(e){function t(t,r){return e.call(this,t,r,"audio")||this}return Cf(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new pF(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(yF),RF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(bF),AF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(gF),CF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(gF),OF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(bF),NF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(gF),wF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(bF);function DF(e){return new AF(e,AP())}function PF(e){var t;return Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s;return $f(this,(function(c){switch(c.label){case 0:i=(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]),_F.print("createCameraVideoTrack","constraints:",e),hx.rtcVideoCaptureEvent({event_type:KL.START,media_device_id:i}),n=CP(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return r=c.sent(),hx.rtcVideoCaptureEvent({event_type:KL.START_CAPTURE_RESULT,media_device_id:i,reason:XL.SUCCESS,elapse:CP()-n}),lF.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),hx.rtcVideoCaptureEvent({event_type:KL.RUNNING_FAILED,media_device_id:i,error_code:o.code,reason:o.message}),new aD(tD.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getVideoTracks()[0],vF.set(a,r),(s=new AF(a,AP())).videoCaptureConfig=e,[2,s]}}))}))}function kF(e){var t;return Zf(this,void 0,void 0,(function(){var r,i,n,o,a;return $f(this,(function(s){switch(s.label){case 0:_F.print("createCameraVideoTrack","constraints:",e),i=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",s.label=1;case 1:return s.trys.push([1,3,,4]),hx.rtcVideoCaptureEvent({event_type:KL.START,media_device_id:i}),n=CP(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=s.sent(),hx.rtcVideoCaptureEvent({event_type:KL.START_CAPTURE_RESULT,media_device_id:i,reason:XL.SUCCESS,elapse:CP()-n}),lF.hasAudioPermission=!0,[3,4];case 3:throw o=s.sent(),hx.rtcVideoCaptureEvent({event_type:KL.RUNNING_FAILED,media_device_id:i,error_code:o.code,reason:o.message}),new aD(tD.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getAudioTracks()[0],vF.set(a,r),[2,new RF(a,AP())]}}))}))}function MF(e){return void 0===e&&(e=!1),Zf(this,void 0,void 0,(function(){var t,r,i;return $f(this,(function(n){switch(n.label){case 0:_F.print("createScreenStream","withAudio:",e),n.label=1;case 1:return n.trys.push([1,3,,4]),hx.rtcVideoCaptureEvent({event_type:KL.START,media_device_id:"screen"}),r=CP(),[4,navigator.mediaDevices.getDisplayMedia({video:!0,audio:e})];case 2:return t=n.sent(),hx.rtcVideoCaptureEvent({event_type:KL.START_CAPTURE_RESULT,media_device_id:"screen",reason:XL.SUCCESS,elapse:CP()-r}),[3,4];case 3:throw i=n.sent(),hx.rtcVideoCaptureEvent({event_type:KL.RUNNING_FAILED,media_device_id:"screen",error_code:i.code,reason:i.message}),new aD(tD.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",i);case 4:return[2,t]}}))}))}Yi({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new tk("Stats",2);var UF,LF=function(){function e(e,t,r,i){this._client=e,this._handler=t,this.dataChannelRTT={},this._rttTimer={},this._remoteStreamStasEvtIntervals={},this._remoteStreamAudioStallInterval={},this._localStreamStasEvtIntervals={},this._videoInWaiting={},this.monitor=r,this._audioStallInterval=((null==i?void 0:i.audio_stall_interval)||200)/2,this._audioStallRatio=(null==i?void 0:i.audio_stall_ratio)||.6}return e.prototype.setRemoteStreamStatsEvtInterval=function(e,t){var r,i;return void 0===t&&(t={rtt:!0}),Zf(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f,_=this;return $f(this,(function(v){switch(v.label){case 0:return t.rtt&&this.getDataChannelRTT(e.userId),n={audio:{},video:{},remoteStream:e},o=null===(r=e.audioTrack)||void 0===r?void 0:r.getTrack(),a=null===(i=e.videoTrack)||void 0===i?void 0:i.getTrack(),this.getRemoteVideoStats(a,n),[4,this.getRemoteAudioStats(o,n)];case 1:return v.sent(),this.delRemoteStreamStatsEvtInterval(e),s=0,c=0,this._audioStallInterval>0&&void 0!==n.audio.concealedSamples&&(u=n.audio.concealedSamples,d=n.audio.totalSamplesReceived,n.audio.silentConcealedSamples,l=CP(),h={isStall:!1,counted:!1,diff:0},p=.5*this._audioStallInterval,this._remoteStreamAudioStallInterval[e.streamId]=setInterval((function(){return Zf(_,void 0,void 0,(function(){var t,r,i,n,a,f,_,v,m,S,E;return $f(this,(function(y){switch(y.label){case 0:return t=CP(),(r=t-l)<p?[2]:(i=e.hasAudio,n=e.subAudio,i&&n?[4,this._handler.getStats(o,!0)]:(h.isStall=!1,h.counted=!1,[2]));case 1:for(a=y.sent(),f=a.length,_=0;_<f;_++)if(v=a[_],m=v.concealedSamples,S=v.totalSamplesReceived,"inbound-rtp"===v.type){E=S-d,m-u>=this._audioStallRatio*E?(h.isStall?(h.counted?c+=r:(c=c+h.diff+r,s++),h.counted=!0):(h.counted=!1,h.diff=r),h.isStall=!0):(h.isStall=!1,h.counted=!1),u=m,d=S,l=t;break}return[2]}}))}))}),this._audioStallInterval)),f=function(){return Zf(_,void 0,void 0,(function(){var t,r,i,o,a,u;return $f(this,(function(d){switch(d.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(u=e.videoTrack)||void 0===u?void 0:u.getTrack(),[4,this.getRemoteAudioStats(t,n,s,c)];case 1:return i=d.sent(),s=0,c=0,[4,this.getRemoteVideoStats(r,n)];case 2:return o=d.sent(),[2,{audioStats:i,videoStats:o,isScreen:e.isScreen,userId:e.userId}]}}))}))},this._remoteStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Zf(_,void 0,void 0,(function(){var e;return $f(this,(function(t){switch(t.label){case 0:return[4,f()];case 1:return e=t.sent(),this._client.emit("onRemoteStreamStats",e),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.delRemoteStreamStatsEvtInterval=function(e){clearInterval(this._remoteStreamStasEvtIntervals[e.streamId]),clearInterval(this._remoteStreamAudioStallInterval[e.streamId]),delete this._remoteStreamAudioStallInterval[e.streamId]},e.prototype.unsubscribe=function(e){this.delRemoteStreamStatsEvtInterval(e),clearTimeout(this._rttTimer[e.userId]),this._videoInWaiting[e.streamId]=!1},e.prototype.getRemoteAudioStats=function(e,t,r,i){return Zf(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f,_,v;return $f(this,(function(m){switch(m.label){case 0:return n={},o={timestamp:Date.now()},a=t.remoteStream,s=a.streamId,c=a.userId,u=a.isScreen,d=a.audioMid,l=a.subMediaType,h=a._attributes,p={media_type:"audio",is_screen:!!u,direction:"down",stream_id:s,stream_user_id:c,vid:d,connection_status:navigator.onLine,mute_state:l===Bf.AUDIO_AND_VIDEO||l===Bf.AUDIO_ONLY?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localaudio&&h.audiostream?"mute_state_off":"mute_state_on"},e&&this._handler?[4,this._handler.getStats(e)]:[2,n];case 1:return(f=m.sent()).length?(f.forEach((function(e){var t=e.type,r=e.packetsLost,i=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,l=e.totalSamplesReceived,h=e.concealedSamples,f=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,S=e.currentRoundTripTime,E=e.audioLevel,y=e.totalAudioEnergy,g=e.totalSamplesDuration,b=e.mimeType,T=e.googDecodingNormal,I=e.fecPacketsReceived,R=e.availableIncomingBitrate,A=e.availableOutgoingBitrate,C=e.bytesSent,O=e.nominated,N=e.id,w=e.writable,D=e.jitter,P=e.candidateType,k=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc,K=e.kind;"inbound-rtp"===t?(o.packetsLost=r,o.packetsReceived=i,p.packetsReceived=i,o.bytesReceived=a,p.bytes=a,void 0!==s&&(n.jitterBufferDelay=s/c*1e3,p.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==l&&(o.totalSamplesReceived=l,n.concealedSamples=h,o.concealedSamples=h,o.silentConcealedSamples=f,p.concealedSamples=h,n.concealmentEvents=_,p.totalSamplesReceived=l),void 0!==I&&(p.fec_packets_received=I),p.jitter=1e3*D,p.ssrc=z):"codec"===t?(n.recordSampleRate=u,d&&(n.numChannels=d),p.codecName=b):"candidate-pair"===t?(p.ice_available_incoming_bitrate=R,p.ice_available_outgoing_bitrate=A,p.ice_bytes_received=a,p.ice_bytes_sent=C,p.ice_nominated=+O,p.ice_pair_id=N,p.ice_pair_rtt=S,p.rtt=1e3*S,p.ice_pair_state=m,p.ice_pair_writable=w,p.recv_ping_requests=F,p.recv_ping_responses=B,p.sent_ping_requests_before_first_response=j,p.sent_ping_requests_total=j+(G||0),p.sent_ping_responses=H,"succeeded"===m&&(n.rtt=1e3*S,n.total_rtt=1e3*v)):"track"===t&&"audio"===K?(p.audio_level=-10*Math.log10(Math.pow(E,2)),p.volume=255*E,p.total_audio_energy=y,p.totalAudioDuration=g):"ssrc"===t?(p.decodingNormal=T,p.recvAudioLevel=V):"local-candidate"===t?(p.local_candidate_type=P,p.local_ip=k||M,p.local_network_type=U,p.local_port=L,p.protocol=x):"remote-candidate"===t&&(p.remote_candidate_type=P,p.remote_ip=k||M,p.remote_port=L)})),(_=t.audio).timestamp?(n.audioLossRate=(o.packetsLost-_.packetsLost)/(o.packetsReceived-_.packetsReceived+(o.packetsLost-_.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,p.packetsLost=Math.round(o.packetsLost-_.packetsLost),p.fraction_lost=n.audioLossRate,p.packets_lost_rate=n.audioLossRate,n.statsInterval=o.timestamp-_.timestamp,p.stats_interval=n.statsInterval,n.receivedKBitrate=(o.bytesReceived-_.bytesReceived||0)/n.statsInterval,p.bitrate=Math.round(8e3*n.receivedKBitrate),p.bandwidth=Math.round(p.bitrate/1024),void 0!==o.concealedSamples&&(p.interval_concealed_samples=o.concealedSamples-_.concealedSamples,p.interval_samples_received=o.totalSamplesReceived-_.totalSamplesReceived,p.interval_silent_concealed_samples=o.silentConcealedSamples-_.silentConcealedSamples,n.receivedSampleRate=1e3*p.interval_samples_received/n.statsInterval),t.audio=o,this.dataChannelRTT[t.remoteStream.userId]&&(v=this.dataChannelRTT[t.remoteStream.userId]/2,n.e2eDelay=v+(n.jitterBufferDelay||0),p.e2e_delay_ms=n.e2eDelay,p.total_rtt_ms=v),this._audioStallInterval>0&&void 0!==o.concealedSamples&&(p.concealed_samples===p.interval_concealed_samples&&p.total_samples_received===p.interval_samples_received?(p.stall_count=0,p.stall_duration=0):(p.stall_count=r,p.stall_duration=i),n.stallCount=p.stall_count,n.stallDuration=p.stall_duration),this.monitor.rtcMediaStatistics(p,{}),[2,n]):(t.audio=o,[2,n])):[2,n]}}))}))},e.prototype.getRemoteVideoStats=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f;return $f(this,(function(_){switch(_.label){case 0:return r={},i={timestamp:Date.now()},n=t.remoteStream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.subMediaType,u=n._attributes,d={media_type:"video",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:t.remoteStream.videoMid,connection_status:navigator.onLine,mute_state:c===Bf.AUDIO_AND_VIDEO||c===Bf.VIDEO_ONLY?"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"},e&&this._handler?(r.isScreen=s,[4,this._handler.getStats(e)]):[2,r];case 1:return(l=_.sent()).length?(l.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,S=e.nominated,E=e.id,y=e.currentRoundTripTime,g=e.state,b=e.writable,T=e.candidateType,I=e.ip,R=e.address,A=e.networkType,C=e.port,O=e.nackCount,N=e.pliCount,w=e.protocol,D=e.requestsReceived,P=e.responsesReceived,k=e.requestsSent,M=e.consentRequestsSent,U=e.responsesSent,L=e.ssrc,x=e.kind,V=e.jitter,F=e.framesReceived,B=e.keyFramesDecoded,j=e.totalDecodeTime,G=e.decoderImplementation,H=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(i.packetsLost=a,d.packetsLost=a,i.packetsReceived=s,d.packetsReceived=s,i.bytesReceived=c,d.bytes=c,i.framesDecoded=u,void 0!==l&&(i.jitterBufferDelay=l/h*1e3,d.average_jitter_buffer_delay_ms=i.jitterBufferDelay),d.fir_count=f,d.nackCount=O,d.pli_count=N,d.ssrc=L,d.jitter=V,d.framesReceived=F,i.framesReceived=F,d.framesDecoded=u,d.key_frames_decoded=B,d.total_decode_time=j,d.decoder_name=G,d.last_packet_received_timestamp=H):"track"===t&&"video"===x?(r.width=o,d.frame_size_width=o,r.height=n,d.frame_size_height=n,void 0!==F&&(d.framesReceived=F,i.framesReceived=F)):"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=+S,d.ice_pair_id=E,d.ice_pair_rtt=y,d.rtt=1e3*y,r.rtt=d.rtt,d.ice_pair_state=g,d.ice_pair_writable=b,d.recv_ping_requests=D,d.recv_ping_responses=P,d.sent_ping_requests_before_first_response=k,d.sent_ping_requests_total=k+(M||0),d.sent_ping_responses=U):"local-candidate"===t?(d.local_candidate_type=T,d.local_ip=I||R,d.local_network_type=A,d.local_port=C,d.protocol=w):"remote-candidate"===t&&(d.remote_candidate_type=T,d.remote_ip=I||R,d.remote_port=C)})),h=t.video,p=t.remoteStream,h.timestamp?(r.videoLossRate=(i.packetsLost-h.packetsLost)/(i.packetsReceived-h.packetsReceived+(i.packetsLost-h.packetsLost)),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,d.fraction_lost=r.videoLossRate,d.packets_lost_rate=r.videoLossRate,r.statsInterval=i.timestamp-h.timestamp,d.stats_interval=r.statsInterval,r.receivedKBitrate=(i.bytesReceived-h.bytesReceived||0)/r.statsInterval,d.bitrate=Math.round(8e3*r.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),r.decoderOutputFrameRate=1e3*(i.framesDecoded-h.framesDecoded)/r.statsInterval,r.receivedFrameRate=1e3*(i.framesReceived-h.framesReceived)/r.statsInterval,d.frame_rate_decoded=Math.round(r.decoderOutputFrameRate),d.frame_rate_received=d.frame_rate_decoded,t.video=i,this.dataChannelRTT[t.remoteStream.userId]&&(f=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=f+(i.jitterBufferDelay||0),d.e2e_delay_ms=r.e2eDelay,d.total_rtt_ms=f),this.processStall(p,d,r,s),this.monitor.rtcMediaStatistics(d,{}),[2,r]):(t.video=i,[2,r])):[2,r]}}))}))},e.prototype.processStall=function(e,t,r,i){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[e.streamId]?0:1,this._videoInWaiting[e.streamId]=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting[e.streamId]=!0:this._videoInWaiting[e.streamId]=!1),e.recordedVideoFrames=[]}t.stall_count=n,i?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,r.stallCount=n,r.stallDuration=o},e.prototype.setLocalStreamStatsEvtInterval=function(e){var t,r,i=this,n={audio:{},video:{},localStream:e},o=null===(t=e.audioTrack)||void 0===t?void 0:t.getTrack(),a=null===(r=e.videoTrack)||void 0===r?void 0:r.getTrack();this.getAudioStats(o,n),this.getVideoStats(a,n),this.delLocalStreamStatsEvtInterval(e);this._localStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Zf(i,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:return[4,Zf(i,void 0,void 0,(function(){var t,r,i,o,a,s;return $f(this,(function(c){switch(c.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(s=e.videoTrack)||void 0===s?void 0:s.getTrack(),[4,this.getAudioStats(t,n)];case 1:return i=c.sent(),[4,this.getVideoStats(r,n)];case 2:return o=c.sent(),[2,{audioStats:i,videoStats:o,isScreen:e.isScreen}]}}))}))];case 1:return t=r.sent(),this._client.emit("onLocalStreamStats",t),[2]}}))}))}),2e3)},e.prototype.delLocalStreamStatsEvtInterval=function(e){clearInterval(this._localStreamStasEvtIntervals[e.streamId])},e.prototype.unpublish=function(e){this.delLocalStreamStatsEvtInterval(e)},e.prototype.getAudioStats=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l;return $f(this,(function(h){switch(h.label){case 0:return r={},i={timestamp:Date.now()},n=t.localStream,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,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this._handler?[4,this._handler.getStats(e)]:[2,r];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,S=e.id,E=e.currentRoundTripTime,y=e.state,g=e.writable,b=e.requestsReceived,T=e.responsesReceived,I=e.requestsSent,R=e.consentRequestsSent,A=e.responsesSent,C=e.jitter,O=e.candidateType,N=e.ip,w=e.address,D=e.networkType,P=e.port,k=e.protocol,M=e.nackCount,U=e.retransmittedBytesSent,L=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType;"outbound-rtp"===t?(i.packetsSent=n,i.bytesSent=a,u.bytes=a,u.packetsSent=n,u.nackCount=M,u.ssrc=F,u.retransmitted_bytes_sent=U,u.retransmitted_packets_sent=L):"remote-inbound-rtp"===t?(i.packetsLost=o,u.packetsLost=o,u.jitter=1e3*C,r.rtt=1e3*c,u.rtt=r.rtt,u.round_trip_time_measurements=x):"codec"===t?(r.recordSampleRate=s,r.numChannels=d,u.codecName=p):"media-source"===t?(u.audio_level=-10*Math.log10(Math.pow(l,2)),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=S,u.ice_pair_rtt=E,u.ice_pair_state=y,u.ice_pair_writable=g,u.recv_ping_requests=b,u.recv_ping_responses=T,u.sent_ping_requests_before_first_response=I,u.sent_ping_requests_total=I+(R||0),u.sent_ping_responses=A):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=N||w,u.local_network_type=D,u.local_port=P,u.protocol=k):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=N||w,u.remote_port=P)})),(l=t.audio).timestamp?(void 0!==i.packetsLost&&(r.audioLossRate=(i.packetsLost-l.packetsLost)/(i.packetsSent-l.packetsSent),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,u.fraction_lost=r.audioLossRate),r.statsInterval=i.timestamp-l.timestamp,u.stats_interval=r.statsInterval,r.sendKBitrate=(i.bytesSent-l.bytesSent||0)/r.statsInterval*8,u.bitrate=Math.round(1e3*r.sendKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=i,this.monitor.rtcMediaStatistics(u,{}),[2,r]):(t.audio=i,[2,r])):[2,r]}}))}))},e.prototype.getVideoStats=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f,_;return $f(this,(function(v){switch(v.label){case 0:return r={},i={timestamp:Date.now(),simulcast:{}},n=t.localStream,o=n.streamId,a=n.videoMid,s=n.isScreen,c=n.pubAttributes,u=n.enableSimulcast,d={media_type:"video",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},e&&this._handler?(r.isScreen=s,[4,this._handler.getStats(e)]):[2,r];case 1:return(l=v.sent()).length?(h=0,l.forEach((function(e){var t=e.type,n=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,c=e.roundTripTime,l=e.mimeType,p=e.frameWidth,f=e.frameHeight,_=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,S=e.googAvailableSendBandwidth,E=e.googAvgEncodeMs,y=e.googBucketDelay,g=e.googEncodeUsagePercent,b=e.googFrameRateInput,T=e.availableIncomingBitrate,I=e.availableOutgoingBitrate,R=e.bytesReceived,A=e.nominated,C=e.id,O=e.currentRoundTripTime,N=e.state,w=e.writable,D=e.candidateType,P=e.ip,k=e.address,M=e.networkType,U=e.port,L=e.nackCount,x=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,K=e.responsesSent,Y=e.ssrc,X=e.googTargetEncBitrate,W=e.googTransmitBitrate,J=e.googRtt,q=e.retransmittedPacketsSent,Z=e.encoderImplementation,$=e.jitter,Q=e.rid;"outbound-rtp"===t?(u&&(Q?i.simulcast[Q]=e:i.simulcast[h]=e,h++),i.framesEncoded=n,i.bytesSent=a,i.framesSent=s,d.bytes=a,i.packetsSent=_,d.packetsSent=_,d.nackCount=L,d.pli_count=x,d.qp_sum=F,d.ssrc=Y,d.retransmitted_packets_sent=q,d.encoder_implementation=Z):"track"===t?(r.encodedFrameWidth=p,r.encodedFrameHeight=f,d.frame_size_height=f,d.frame_size_width=p):"remote-inbound-rtp"===t?(i.packetsLost=o,r.rtt=1e3*c,d.rtt=r.rtt,d.jitter=$,d.packetsLost=o):"codec"===t?(r.codecType=l,d.codecName=l):"candidate-pair"===t?(d.ice_available_incoming_bitrate=T,d.ice_available_outgoing_bitrate=I,d.ice_bytes_received=R,d.ice_bytes_sent=a,d.ice_nominated=+A,d.ice_pair_id=C,d.ice_pair_rtt=O,d.ice_pair_state=N,d.ice_pair_writable=w,d.recv_ping_requests=B,d.recv_ping_responses=j,d.sent_ping_requests_before_first_response=H,d.sent_ping_requests_total=H+z,d.sent_ping_responses=K):"local-candidate"===t?(d.local_candidate_type=D,d.local_ip=P||k,d.local_network_type=M,d.local_port=U,d.protocol=V):"remote-candidate"===t?(d.remote_candidate_type=D,d.remote_ip=P||k,d.remote_port=U):"VideoBwe"===t?(d.encBitratebps=v,d.available_receive_bandwidth=m,d.available_send_bandwidth=S,d.bucket_delay=y,d.retransmitBitratebps=G,d.targetEncBitratebps=X,d.transmit_bitrate=W):"ssrc"===t&&(d.video_network_elapse=J,d.avg_encode_ms=E,d.encodeUsage=g,d.frame_rate_input=b,d.orignal_input_Framerate=+b)})),(p=t.video).timestamp?(r.statsInterval=i.timestamp-p.timestamp,d.stats_interval=r.statsInterval,f=Object.keys(i.simulcast),u?(d.sim_enc_width=[],d.sim_enc_height=[],d.sim_enc_bps=[],d.sim_enc_framerate=[],d.sim_rids=[],d.sim_enc_bandwidth=[],d.sim_sent_framerate=[],d.sim_fraction_lost=[],_=!1,f.sort((function(e,t){return+e-+t})).forEach((function(e){var t=i.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,f=t.qualityLimitationDurations,v=t.qualityLimitationResolutionChanges;void 0!==h&&(d.sim_qualityLimitationReason||(d.sim_qualityLimitationReason=[],d.sim_qualityLimitationDurations=[],d.sim_qualityLimitationResolutionChanges=[]),d.sim_qualityLimitationReason.push(h),d.sim_qualityLimitationDurations.push(f),d.sim_qualityLimitationResolutionChanges.push(v));var m=p.simulcast[e];if(d.sim_enc_width.push(n||0),d.sim_enc_height.push(o||0),m){var S=(a-m.bytesSent||0)/r.statsInterval;d.sim_enc_bps.push(Math.round(8e3*S)),d.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var E=1e3*(s-m.framesEncoded)/r.statsInterval;d.sim_enc_framerate.push(Math.round(E)),d.sim_rids.push(e);var y=void 0!==c?c-m.framesSent:s-m.framesEncoded,g=1e3*y/r.statsInterval;d.sim_sent_framerate.push(Math.round(g));var b=(u-m.packetsLost)/(l-m.packetsSent);b=Number.isNaN(b)?0:b,d.sim_fraction_lost.push(b),n>0&&!_&&(r.sentKBitrate=8*S,r.encoderOutputFrameRate=E,r.encodedFrameCount=y,r.sentFrameRate=g,r.videoLossRate=b,_=!0)}})),this.monitor.rtcMediaStatistics(d,{})):(r.encodedFrameCount=void 0!==i.framesSent?i.framesSent-p.framesSent:i.framesEncoded-p.framesEncoded,r.sentKBitrate=(i.bytesSent-p.bytesSent||0)/r.statsInterval*8,d.bitrate=Math.round(1e3*r.sentKBitrate),d.bandwidth=Math.round(d.bitrate/1024),r.encoderOutputFrameRate=1e3*(i.framesEncoded-p.framesEncoded)/r.statsInterval,d.frame_rate_encoded=Math.round(r.encoderOutputFrameRate),r.sentFrameRate=1e3*r.encodedFrameCount/r.statsInterval,d.frame_rate_sent=Math.round(r.sentFrameRate),r.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsSent-p.packetsSent),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,d.fraction_lost=r.videoLossRate,this.monitor.rtcMediaStatistics(d,{})),t.video=i,[2,r]):(t.video=i,[2,r])):[2,r]}}))}))},e.prototype.getDataChannelRTT=function(e){var t,r=this,i=CP();null===(t=this._client.sendUserMessage(e,"__web__rtc__rtt__"))||void 0===t||t.then((function(t){if("timeout"!==t){var n=Date.now()-i;n>0&&n<2e3&&(r.dataChannelRTT[e]=n)}else clearTimeout(r._rttTimer[e])})).catch((function(){clearTimeout(r._rttTimer[e])})),clearTimeout(this._rttTimer[e]),this._rttTimer[e]=setTimeout((function(){r.getDataChannelRTT(e)}),2e3)},e.prototype.destroy=function(){var e=this;Object.keys(this._localStreamStasEvtIntervals).forEach((function(t){clearInterval(e._localStreamStasEvtIntervals[t])})),Object.keys(this._remoteStreamStasEvtIntervals).forEach((function(t){clearInterval(e._remoteStreamStasEvtIntervals[t])})),Object.keys(this._rttTimer).forEach((function(t){clearTimeout(e._rttTimer[t])})),Object.keys(this._remoteStreamAudioStallInterval).forEach((function(t){clearTimeout(e._remoteStreamAudioStallInterval[t])})),this._rttTimer={},this.dataChannelRTT={},this._videoInWaiting={}},e}(),xF=new tk("MediaServerClient",2),VF=5e3;!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(UF||(UF={}));var FF=function(e,t){xF.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)},BF=function(e){function t(t){void 0===t&&(t=hx);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._pubConfig={},r.monitor=t,r._pubSubLock=new RV("pubSubLock"),r._joinLeaveLock=new RV("joinLeaveLock"),r._state=UF.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r}return Cf(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){xF.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(ix.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[tx.ON_ADD_STREAM,tx.ON_REMOVE_STREAM,tx.USER_CONNECTION,tx.USER_DISCONNECTION,tx.ON_UPDATE_STREAM_ATTRIBUTES,tx.ON_UPDATE_ROOM_ATTRIBUTES,tx.ON_PUSH_TRACK,tx.ON_REMOVE_TRACK,tx.NODE_CHANGE,tx.ON_CUSTOM_MESSAGE,tx.USER_MESSAGE_RECEIVED,tx.USER_BINARY_MESSAGE_RECEIVED,tx.POST_PROCESSING_MESSAGE,tx.ON_USER_TOKEN_WILL_EXPIRE,rx.RSCP].forEach((function(e){var r;null===(r=t._dataChannelSignal)||void 0===r||r.on(e,(function(r){t.safeEmit(e,r)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){xF.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(ix.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(ix.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.connect=function(e,t,r,i){var n;return void 0===t&&(t=""),void 0===r&&(r=""),void 0===i&&(i={}),Zf(this,void 0,void 0,(function(){var o,a,s,c=this;return $f(this,(function(u){switch(u.label){case 0:return this.connectionState=UF.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),i.node?(o=i.node,gx("es.join.nodeChange",i),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return c.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new Lx,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,r,Mx.getDeviceId(),null==i?void 0:i.reason,this._prevICENode,this._useCloudProxy)];case 2:if(!(o=u.sent()))throw gx("es.join.getNodeFailed",""),new aD(tD.ICE_SERVER_WRONG,"get ICE config failed");gx("es.join.getNodeSuccess",o),u.label=3;case 3:this._prevICENode=o,this._handler=new bV(this.monitor),this._addHandlerEvents(),Promise.resolve().then((function(){return c.emit("onEstablishConnectionHook")})),u.label=4;case 4:return u.trys.push([4,6,,7]),[4,this._handler.connect(o)];case 5:return a=u.sent(),xF.print("join","establish peerConnection success"),[3,7];case 6:throw s=u.sent(),this.connectionState=UF.DISCONNECTED,new aD(tD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 7:return this._dataChannelSignal=new Ax(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,r,i){var n,o,a,s,c,u;return void 0===t&&(t={}),void 0===r&&(r=!1),Zf(this,void 0,void 0,(function(){var d,l,h,p,f,_,v,m=this;return $f(this,(function(S){switch(S.label){case 0:return xF.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,r,i),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._sessionId=t.sessionId,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return S.sent(),[4,null===(n=this._handler)||void 0===n?void 0:n.getDefaultSdp()];case 2:return d=S.sent(),_={Authorization:wP.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId||"",timestamp:Date.now(),controlMessage:i,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role}},v={},[4,mV()];case 3:_.params=(v.supportedCodecs=S.sent(),v.deviceType="web",v.userAgent=window.navigator.userAgent,v.sdkVersion=Ak.VERSION,v.deviceId=Mx.getDeviceId(),v.appId=this._appId,v.roomId=this._roomId,v.userId=this._clientId,v.businessId=this._businessId,v.enable_cloud_proxy=this._useCloudProxy,v),_.options={enableUnBundleMode:!0,supportTokenExpireCallBack:!0},_.sdpInfo=d,l=_,Promise.resolve().then((function(){return m.emit("onSendingJoinMessageHook")})),S.label=4;case 4:return S.trys.push([4,6,,7]),h=r?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(h,l)];case 5:return p=S.sent(),xF.print("join","send join message success"),this._authorization=l.Authorization,this.connectionState=UF.CONNECTED,this._statsReport=new LF(this,this._handler,this.monitor,null===(o=p.config)||void 0===o?void 0:o.engine_WEB),this._pubConfig.audioRed=!!(null===(s=null===(a=p.config)||void 0===a?void 0:a.engine_WEB)||void 0===s?void 0:s.pub_audio_red),this._pubConfig.simulcastOnDemand=!!(null===(u=null===(c=p.config)||void 0===c?void 0:c.engine_WEB)||void 0===u?void 0:u.sim_on_demand),[2,p];case 6:if(f=S.sent(),this.connectionState=UF.DISCONNECTED,(null==f?void 0:f.code)>=700&&(null==f?void 0:f.code)<800)throw new aD(tD.INVALID_TOKEN,(null==f?void 0:f.message)||"Invalid token");if(200!==(null==f?void 0:f.code))throw new aD(tD.JOIN_ROOM_FAILED,(null==f?void 0:f.message)||"Join room failed");return[3,7];case 7:return[2]}}))}))},t.prototype.publish=function(e){var t,r,i,n,o,a,s,c;return Zf(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,S,E;return $f(this,(function(y){switch(y.label){case 0:xF.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=CP(),h="",p="",f="",y.label=1;case 1:return y.trys.push([1,5,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(_=y.sent()))throw new aD(tD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return h=_.audioMid,p=_.videoMid,f=_.sdp,e.pubAttributes={localaudio:!!d,localvideo:!!u,videostream:!!(null===(r=null==u?void 0:u.getTrack())||void 0===r?void 0:r.enabled),audiostream:!!(null===(i=null==d?void 0:d.getTrack())||void 0===i?void 0:i.enabled),extvideo:!!(u instanceof NF),extaudio:!!(d instanceof wF)},v={attributes:Jf({videoDescriptions:_.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:h,videoMid:p,sdpInfo:{msid:e.stream.id,type:_.type,sdp:_.partialSdp,semantics:_.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(v.attributes.subVideoDescriptions=_.videoDescriptions.map((function(e,t){return e.video_index=t,e}))),[4,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("publish",v)];case 3:if(200!==(null==(m=y.sent())?void 0:m.code))throw new aD(tD.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");return S=null===(o=null==m?void 0:m.relayMessage)||void 0===o?void 0:o.sdp,[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(_.sdp,S,void 0,e,IL.UP)];case 4:return y.sent(),e.streamId=m.streamId,e.videoMid=p,e.audioMid=h,this.monitor.rtcPublishStat(CL.SUCCESS,OL.W_0,l,NL.UNKNOWN),null===(s=this._statsReport)||void 0===s||s.setLocalStreamStatsEvtInterval(e),[2];case 5:return(E=y.sent())instanceof Error&&this.monitor.rtcPublishStat(CL.FAIL,OL.W_0,l,E.message),h&&p?[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(f,[h,p])]:[3,7];case 6:y.sent(),y.label=7;case 7:throw E;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,r,i,n,o,a,s,c,u;return Zf(this,void 0,void 0,(function(){var d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A,C;return $f(this,(function(O){switch(O.label){case 0:xF.print("updatePubTrack()","localStream: %o",e),d=e.videoTrack,l=e.audioTrack,h=!!(null===(r=null===(t=e.videoTransceiver)||void 0===t?void 0:t.sender)||void 0===r?void 0:r.track),p=null==d?void 0:d.getTrack(),null===(i=e.videoTransceiver)||void 0===i||i.sender.replaceTrack(p||null),!h&&p&&(null===(n=this._handler)||void 0===n||n.updateScaleResolutionDownBy(e)),l?(f=l.mixType,_=l.mixedAudioTrack,v=null==l?void 0:l.getTrack(),_&&f!==i_.PLAYOUT&&!0===v.enabled&&(v=_),null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(v)):null===(a=e.audioTransceiver)||void 0===a||a.sender.replaceTrack(null),m={localaudio:!!l,localvideo:!!d,videostream:!!(null===(s=null==d?void 0:d.getTrack())||void 0===s?void 0:s.enabled),audiostream:!!(null===(c=null==l?void 0:l.getTrack())||void 0===c?void 0:c.enabled),extvideo:!!(d instanceof NF),extaudio:!!(l instanceof wF)},S={};try{for(E=Qf(Object.entries(m)),y=E.next();!y.done;y=E.next())g=e_(y.value,2),b=g[0],(T=g[1])!==Reflect.get(e.pubAttributes,b)&&Reflect.set(S,b,T)}catch(e){A={error:e}}finally{try{y&&!y.done&&(C=E.return)&&C.call(E)}finally{if(A)throw A.error}}return Object.keys(S).length?(e.pubAttributes=m,I={roomId:this._roomId,streamId:e.streamId,attributes:S},[4,null===(u=this._dataChannelSignal)||void 0===u?void 0:u.sendSignaling("updateStreamAttributes",I)]):[2];case 1:if(200!==(null==(R=O.sent())?void 0:R.code))throw new aD(tD.UPDATE_TRACK_FAILED,(null==R?void 0:R.message)||"update track failed");return[2]}}))}))},t.prototype.updateToken=function(e){var t,r,i;return Zf(this,void 0,void 0,(function(){var n,o;return $f(this,(function(a){switch(a.label){case 0:if(xF.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===(r=this._userInfo)||void 0===r?void 0:r.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateToken",n)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new aD(tD.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new aD(tD.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,r,i;return Zf(this,void 0,void 0,(function(){var n,o;return $f(this,(function(a){switch(a.label){case 0:return xF.print("unpublish()","localStream: %o",e),n={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unpublish",n)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new aD(tD.UNPUBLISH_FAILED,(null==o?void 0:o.message)||"unpublish failed");return[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 2:return a.sent(),null===(i=this._statsReport)||void 0===i||i.unpublish(e),[2]}}))}))},t.prototype.subscribe=function(e,t,r){var i,n,o,a,s,c,u,d,l;return Zf(this,void 0,void 0,(function(){var h,p,f,_,v,m,S,E,y,g,b,T,I,R,A,C,O,N,w,D;return $f(this,(function(P){switch(P.label){case 0:if(e.hasSubscribed)return[2,this._updateSubTrack(e,t,r)];if(xF.print("subscribe()","mediaType: %o, config: %o",t,r),FF("subscribe()",e),h=!1,p=!1,t===Bf.VIDEO_ONLY?h=!0:t===Bf.AUDIO_ONLY?p=!0:t===Bf.AUDIO_AND_VIDEO?(h=!0,p=!0):t===Bf.NONE&&(h=!1,p=!1),!h&&this._multiChatMode())return[2];f=CP(),_=e.audioMid,v=e.videoMid,S=!1,P.label=1;case 1:return P.trys.push([1,12,,15]),_&&v?(S=!0,[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e,{audioMid:_,videoMid:v})]):[3,3];case 2:return m=P.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(m=P.sent()))throw new aD(tD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,P.label=5;case 5:return E={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:v,audioMid:_,sdpInfo:{sdp:null==m?void 0:m.partialSdp,semantics:null==m?void 0:m.semantics,type:null==m?void 0:m.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||p,video:h},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("subscribe",E)];case 6:if(200!==(null==(y=P.sent())?void 0:y.code))throw new aD(tD.SUBSCRIBE_FAILED,(null==y?void 0:y.message)||"subscribe failed");return g=[],b=!this._multiChatMode(),!(_&&v)&&g.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new aD(tD.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),VF);e.on("ontrack",(function r(n){"video"===n.mediaType&&(xF.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),b&&g.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new aD(tD.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),VF);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(xF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),T=function(t){e.ontrack(t)},null===(a=this._handler)||void 0===a||a.on("ontrack",T),this._ontrackCallbackMap.set(e,T),I=null==y?void 0:y.relayMessage,R=I.audioMid,A=I.videoMid,C=I.sequenceId,O=I.sdp,S&&_!==R?(xF.print("subscribe","mid mot match",_,R),[4,null===(s=this._handler)||void 0===s?void 0:s.closeMLine([_,v])]):[3,9];case 7:return P.sent(),[4,null===(c=this._handler)||void 0===c?void 0:c.subscribe(e)];case 8:if(!(m=P.sent()))throw new aD(tD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,P.label=9;case 9:return(D={})[_]=R,D[v]=A,N=D,e.videoMid=A,e.audioMid=R,e.sequenceId=C,e.subConfig=r,e._workaround_1_=!1,e.paused=!1,e.subMediaType=t,e.hasSubscribed=!0,[4,null===(u=this._handler)||void 0===u?void 0:u.setAnswerSdp(null==m?void 0:m.sdp,O,N,e,IL.DOWN)];case 10:return P.sent(),[4,Promise.all(g)];case 11:return P.sent(),this._multiChatMode()||(e.subAudio=p),e.subVideo=h,this.monitor.rtcSubscribeStat(wL.SUCCESS,f,DL.UNKNOWN,e.userId),null===(d=this._statsReport)||void 0===d||d.setRemoteStreamStatsEvtInterval(e),[2];case 12:return(w=P.sent())instanceof Error&&this.monitor.rtcSubscribeStat(wL.FAIL,f,w.message,e.userId),_&&v?[4,null===(l=this._handler)||void 0===l?void 0:l.rollback(null==m?void 0:m.sdp,[_,v])]:[3,14];case 13:P.sent(),P.label=14;case 14:throw w;case 15:return[2]}}))}))},t.prototype.controlMessage=function(e){var t;return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return xF.print("controlMessage()","params: %o",e),r=e,"transcode"===e.type&&(r.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",r)];case 1:return i.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:return xF.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 r.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){return Zf(this,void 0,void 0,(function(){return $f(this,(function(i){return[2,this._updateSubTrack(e,t,r)]}))}))},t.prototype._updateSubTrack=function(e,t,r){var i,n,o;return Zf(this,void 0,void 0,(function(){var a,s,c,u;return $f(this,(function(d){switch(d.label){case 0:return xF.print("updateSubTrack()","mediaType: %o, config: %o",t,r),FF("updateSubTrack()",e),a=!1,s=!1,t===Bf.VIDEO_ONLY?(a=!0,s=!1):t===Bf.AUDIO_ONLY?(s=!0,a=!1):t===Bf.AUDIO_AND_VIDEO?(a=!0,s=!0):t===Bf.NONE&&(a=!1,s=!1),c={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:a,audio:!!this._multiChatMode()||s},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",c)];case 1:if(200!==(null==(u=d.sent())?void 0:u.code))throw new aD(tD.UPDATE_TRACK_FAILED,(null==u?void 0:u.message)||"update track failed");return e.paused=!a,this._multiChatMode()||(null===(n=e.observer)||void 0===n||n.setUnmuteAudio(s),e.subAudio=s),null===(o=e.observer)||void 0===o||o.setUnmuteVideo(a),e.subVideo=a,e.subMediaType=t,e.subConfig=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var r,i,n,o,a,s;return Zf(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_,v,m,S,E,y;return $f(this,(function(g){switch(g.label){case 0:if(xF.print("subscribe4pushTrack()","streamInfo: %o",t),FF("subscribe4pushTrack()",e),c=null==t?void 0:t.message,u=c.audioMid,d=c.videoMid,l=c.sequenceId,h=c.sdp,e.subAudio=!0,l<e.sequenceId)return xF.print("subscribe4pushTrack","sequenceId return",l,e.sequenceId),[2];p=e.audioMid,f=e.videoMid,null===(r=e.observer)||void 0===r||r.setPushTrack(!0),g.label=1;case 1:return g.trys.push([1,8,,11]),p&&f?[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e,{audioMid:p,videoMid:f})]:[3,3];case 2:return _=g.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(_=g.sent()))throw new aD(tD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");p=_.audioMid,f=_.videoMid,g.label=5;case 5:return(y={})[p]=u,y[f]=d,v=y,xF.print("onpushtrack midmap",e.userId,v),e.audioMid=u,e.videoMid=d,e.sequenceId=l,m=[],e.audioTrack||m.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new aD(tD.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),VF);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(xF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),S=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",S),this._ontrackCallbackMap.set(e,S),[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(null==_?void 0:_.sdp,h,v,e,IL.DOWN)];case 6:return g.sent(),[4,Promise.all(m)];case 7:return g.sent(),[2];case 8:return E=g.sent(),_?[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(null==_?void 0:_.sdp,[p,f])]:[3,10];case 9:g.sent(),g.label=10;case 10:throw E;case 11:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var r,i;return Zf(this,void 0,void 0,(function(){return $f(this,(function(n){switch(n.label){case 0:return FF("unsubscribe4removeTrack()",e),xF.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(xF.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(r=e.observer)||void 0===r||r.setPushTrack(!1),[4,null===(i=this._handler)||void 0===i?void 0:i.closeMLine([e.videoMid||"",e.audioMid||""])]));case 1:return n.sent(),xF.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),[2]}}))}))},t.prototype.unsubscribe=function(e){var t,r,i,n,o;return Zf(this,void 0,void 0,(function(){var a;return $f(this,(function(s){switch(s.label){case 0:FF("unsubscribe()",e),a={roomId:this._roomId,streamId:e.streamId,userId:e.userId},s.label=1;case 1:return s.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unsubscribe",a)];case 2:case 3:return s.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(r=e.observer)||void 0===r||r.setSubscribeVideo(!1),e.subAudio?[3,6]:(null===(i=e.observer)||void 0===i||i.setSubscribeAudio(!1),[4,null===(n=this._handler)||void 0===n?void 0:n.closeMLine([e.videoMid||"",e.audioMid||""])]);case 5:s.sent(),xF.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(o=this._statsReport)||void 0===o||o.unsubscribe(e),s.label=6;case 6:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,r=this._ontrackCallbackMap.get(e);r&&(null===(t=this._handler)||void 0===t||t.off("ontrack",r),this._ontrackCallbackMap.delete(e))},t.prototype.handleRemoveStream=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return FF("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==ex.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this.unsubscribe(e),[2]}))}))},t.prototype.leave=function(){var e;return Zf(this,void 0,void 0,(function(){var t,r,i;return $f(this,(function(n){switch(n.label){case 0:return xF.print("leave()"),this.connectionState!==UF.CONNECTED?[3,7]:(this.connectionState=UF.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:r=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=UF.DISCONNECTED,[3,6];case 4:throw i=n.sent(),this.connectionState=UF.CONNECTED,i;case 5:return r(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new aD(tD.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,r,i,n,o;return Zf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,f,_,v,m,S;return $f(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(!(a=E.sent()))throw new aD(tD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return s=CP(),c=a.audioMid,u=a.videoMid,d={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:c,videoMid:u,sdpInfo:{sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("startPullStream",d)];case 2:return l=E.sent(),(h=[]).push(new Promise((function(t,r){var i=setTimeout((function(){return r(new aD(tD.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),VF);e.on("ontrack",(function r(n){"video"===n.mediaType&&(xF.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),h.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new aD(tD.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),VF);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(xF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),p=function(t){e.ontrack(t)},null===(i=this._handler)||void 0===i||i.on("ontrack",p),this._ontrackCallbackMap.set(e,p),f=null==l?void 0:l.relayMessage,_=f.audioMid,v=f.videoMid,m=f.sequenceId,S=f.sdp,e.videoMid=v,e.audioMid=_,e.sequenceId=m,e._workaround_1_=!1,e.paused=!1,e.hasSubscribed=!0,e.subAudio=!0,e.subVideo=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.setAnswerSdp(null==a?void 0:a.sdp,S,{},e,IL.DOWN)];case 3:return E.sent(),[4,Promise.all(h)];case 4:return E.sent(),this.monitor.rtcSubscribeStat(wL.SUCCESS,s,DL.UNKNOWN,e.userId),this._statsReport||(this._statsReport=new LF(this,this._handler,this.monitor)),null===(o=this._statsReport)||void 0===o||o.setRemoteStreamStatsEvtInterval(e,{rtt:!1}),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,r,i;return Zf(this,void 0,void 0,(function(){var n;return $f(this,(function(o){switch(o.label){case 0:FF("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.hasSubscribed=!1,e.subVideo=!1,e.subAudio=!1,[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 5:return o.sent(),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(i=this._statsReport)||void 0===i||i.unsubscribe(e),[2]}}))}))},t.prototype.destroy=function(){var e,t,r,i;xF.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,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),null===(i=this._statsReport)||void 0===i||i.destroy(),this.connectionState=UF.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._dataChannelSignal)||void 0===r?void 0:r.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}),qf([HF],t.prototype,"join",null),qf([GF,jF],t.prototype,"publish",null),qf([GF,jF],t.prototype,"updatePubTrack",null),qf([GF,jF],t.prototype,"unpublish",null),qf([GF,jF],t.prototype,"subscribe",null),qf([jF],t.prototype,"controlMessage",null),qf([jF],t.prototype,"updateUserAttributes",null),qf([GF,jF],t.prototype,"updateSubTrack",null),qf([GF,jF],t.prototype,"subscribe4pushTrack",null),qf([GF,jF],t.prototype,"unsubscribe4removeTrack",null),qf([GF,jF],t.prototype,"unsubscribe",null),qf([GF,jF],t.prototype,"handleRemoveStream",null),qf([GF],t.prototype,"subscribePublicStream",null),qf([GF],t.prototype,"unsubscribePublicStream",null),t}(ik);function jF(e,t,r){var i=r.value;return r.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:return this._handler&&this._state===UF.CONNECTED?[4,i.apply(this,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:throw new aD(tD.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},r}function GF(e,t,r){var i=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,i.apply(this,e)];case 3:return[2,r.sent()];case 4:return t(),[7];case 5:return[2]}}))}))},r}function HF(e,t,r){var i=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Zf(this,void 0,void 0,(function(){var t,r=this;return $f(this,(function(n){return t=!1,[2,new Promise((function(n,o){return Zf(r,void 0,void 0,(function(){var r,a;return $f(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new aD(tD.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,i.apply(this,e)];case 2:return r=s.sent(),n(r),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},r}var zF,KF,YF,XF=function(){function e(){}return e.getNalunits=function(t){if(t.length-t.position<4)return[];var r=t.position;return 1===t.getInt32(r)||0===t.getInt16(r)&&1===t.getInt8(r+2)?e.getAnnexbNals(t):e.getAvccNals(t)},e.getAnnexbNals=function(t){for(var r=[],i=e.getHeaderPositionAnnexB(t),n=i.pos,o=n;n<t.length-4;){var a=new Uint8Array(t.buffer.slice(n,n+i.headerLength));i.pos===t.position&&t.skip(i.headerLength),o=(i=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&&r.push(s),t.skip(o-t.position),n=o}return r},e.getAvccNals=function(t){for(var r=[];t.position<t.length-4;){var i=t.getInt32(t.position);if(!(t.length-t.position>=i))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+i));t.skip(i);var a={header:n,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r},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,r=0,i=e.length;3!==r&&4!==r&&t<i-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===i-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=i:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=i)),{pos:t,headerLength:r}},e.getAvcc=function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var i=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),i),i+=2,r.set(e,i),r[i+=e.byteLength]=1,i++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),i),i+=2,r.set(t,i),r},e}(),WF=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 r=Math.floor(t/4),i=t%4,n=0;n<r;n++)e.readByte(this,4);i>0&&e.readByte(this,i)},e.readByte=function(e,t,r){var i;switch(t){case 1:i=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:i=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");i=e.getUint8(e.position)<<16,i|=e.getUint8(e.position+1)<<8,i|=e.getUint8(e.position+2);break;case 4:i=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");i=e.getUint32(e.position)<<32,i|=e.getUint32(e.position+4);break;default:i=""}return e.position+=t,i},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}(),JF=new tk("Stream",0),qF=function(){function e(){this.isScreen=!1,this.seiList=[],this.enableSimulcast=!1,this.prevScaleResolutionDownBy=1,this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1}}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(SV()){var r=t.createEncodedStreams(),i=r.readable,n=r.writable,o=new TransformStream({transform:function(t,r){var i=e.seiList[0];if(i){var n=new Uint8Array(i.content.byteLength+5);n.set([0,0,0,1,6]),n.set(i.content,5);var o=new Uint8Array(n.byteLength+t.data.byteLength);0===i.repeatCount&&e.seiList.splice(0,1),i.repeatCount--,o.set(new Uint8Array(t.data)),o.set(n,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});i.pipeThrough(o).pipeTo(n)}}else JF.print("no sender found when trying to bind encodedTransform")},e.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else JF.print("no sender found when trying to bind encodedTransform")},e.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.destroy(),this.observer=void 0,this.prevScaleResolutionDownBy=1},e.prototype.switchTrackEnableState=function(e,t){var r;"audio"===e?r=this.audioTrack:"video"===e&&(r=this.videoTrack);var i=null==r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)},e}(),ZF=function(e){function t(t,r,i,n){var o=e.call(this)||this;return o.userId=t,o.isScreen=i,o.streamId=r,o.hasAudio=n.audiostream,o.hasVideo=n.videostream,o._attributes=n,o.subVideo=!1,o.subAudio=!1,o._sequenceId=0,o.subMediaType=Bf.NONE,o.subConfig={videoIndex:0},o.hasSubscribed=!1,o}return Cf(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,this.hasAudio=e.localaudio,this._attributes=e},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,i=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){var i=XF.getNalunits(new WF(t.data)).find((function(e){return e.sei}));i&&e.safeEmit("onSEIMessage",i.body.slice(1)),r.enqueue(t)}})).pipeTo(i)}else JF.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,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else JF.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,r,i;if((null===(r=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===r?void 0:r.id)===this.streamId){var n=e.track;"video"===(null==n?void 0:n.kind)?this._setVideoTrack(n):"audio"===(null===(i=e.track)||void 0===i?void 0:i.kind)&&this._setAudioTrack(n),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;JF.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.observer=void 0},t.prototype.resetHasSubscribed=function(){this.hasSubscribed=!1},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,r;(null===(r=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new IF(e,AP()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,r;(null===(r=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new TF(e,AP()),this.emit("ontrack",this.videoTrack))},t}(ik);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(zF||(zF={})),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_MUTE_AUDIO="on_user_mute_audio",e.ON_USER_MUTE_VIDEO="on_user_mute_video",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"}(KF||(KF={})),function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(YF||(YF={}));var $F,QF=function(){function e(e,t){this._audioEventSessionId=PP(),this._videoEventSessionId=PP(),this._isScreen=!1,this._audioFirstFrameState=YF.INITIAL,this._videoFirstFrameState=YF.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:UL.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:UL.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 r,i,n,o,a;return Zf(this,void 0,void 0,(function(){var s,c,u,d,l,h,p=this;return $f(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:return f.sent(),s=this._transportDelay,c=UL.LOGIN,u=UL.UNMUTE,d=UL.SUBSCRIBE,l=UL.PUSH_TRACK,[c,u,d,l].indexOf(t)>=0&&(s=0),e===ML.AUDIO?(this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},h={media_type:e,event_type:kL.BEGIN_RECV,type:t,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){p.stopRecvFrame(ML.AUDIO,LL.TIMEOUT),p._firstAudioFrameInterval&&window.clearInterval(p._firstAudioFrameInterval)}),this._timeout),hx.rtcFirstFrame(h),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=YF.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===ML.VIDEO&&(this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t},h={media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?ML.SCREEN_VIDEO:e,event_type:kL.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(){p.stopRecvFrame(ML.VIDEO,LL.TIMEOUT),p._firstVideoFrameInterval&&window.clearInterval(p._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),hx.rtcFirstFrame(h),this._videoFirstFrameState=YF.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var r,i,n,o,a,s,c;if(e===ML.AUDIO){if(this._audioFirstFrameState!==YF.BEGIN)return;var u={event_type:kL.RECV_END,media_type:e,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,reason:t,result:!1,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.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,hx.rtcFirstFrame(u),this._audioFirstFrameState=YF.STOPPED}else if(e===ML.VIDEO){if(this._videoFirstFrameState!==YF.BEGIN)return;u={event_type:kL.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?ML.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,hx.rtcFirstFrame(u),this._videoFirstFrameState=YF.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,r,i;return Zf(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p;return $f(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:if(f.sent(),n=this._transportDelay,o=UL.LOGIN,a=UL.UNMUTE,s=UL.SUBSCRIBE,c=UL.PUSH_TRACK,e===ML.AUDIO){if(this._audioFirstFrameState!==YF.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:kL.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),hx.rtcFirstFrame(p),this._audioFirstFrameState=YF.RECEIVED}else if(e===ML.VIDEO){if(this._videoFirstFrameState!==YF.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:kL.RECV_END,media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?ML.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:n},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),hx.rtcFirstFrame(p),this._videoFirstFrameState=YF.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var r,i,n,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&t.audio&&this.beginRecvFrame(ML.AUDIO,UL.LOGIN),e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&t.video&&this.beginRecvFrame(ML.VIDEO,UL.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(ML.AUDIO,LL.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(ML.VIDEO,LL.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(ML.AUDIO,UL.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(ML.AUDIO,LL.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(ML.AUDIO,UL.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(ML.AUDIO,LL.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(ML.AUDIO,UL.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(ML.AUDIO,LL.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(ML.VIDEO,UL.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(ML.VIDEO,LL.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(ML.VIDEO,UL.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(ML.VIDEO,LL.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(ML.VIDEO,UL.ENABLE):this.stopRecvFrame(ML.VIDEO,LL.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(ML.AUDIO,UL.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(ML.AUDIO,UL.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(ML.VIDEO,UL.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(ML.VIDEO,UL.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(ML.VIDEO,UL.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(ML.VIDEO,LL.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(ML.AUDIO,UL.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(ML.AUDIO,LL.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,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(ML.AUDIO,UL.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&this.stopRecvFrame(ML.AUDIO,LL.UNSUBSCRIBE)},e.prototype.setSubscribeVideo=function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(ML.VIDEO,UL.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&this.stopRecvFrame(ML.VIDEO,LL.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(ML.AUDIO,UL.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(ML.AUDIO,LL.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.setInterval((function(){return Zf(e,void 0,void 0,(function(){var e,r,i,n,o,a,s,c;return $f(this,(function(u){switch(u.label){case 0:return(null===(i=this._handler)||void 0===i?void 0:i.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())?[4,vV(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(),(r=e.find((function(e){return"inbound-rtp"===e.type})))&&r.framesReceived>t){if(-1===t)return t=r.framesReceived,[2];this.recvFrameFinish(ML.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.setInterval((function(){return Zf(e,void 0,void 0,(function(){var e,r,i,n,o,a,s,c;return $f(this,(function(u){switch(u.label){case 0:return(null===(i=this._handler)||void 0===i?void 0:i.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())?[4,vV(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(),(r=e.find((function(e){return"inbound-rtp"===e.type})))&&r.totalSamplesReceived>t){if(-1===t)return t=r.totalSamplesReceived,[2];this.recvFrameFinish(ML.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return Zf(this,void 0,void 0,(function(){var e=this;return $f(this,(function(t){switch(t.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return t.sent(),this._transportDelayInterval=window.setInterval((function(){return Zf(e,void 0,void 0,(function(){return $f(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 Zf(this,void 0,void 0,(function(){var r,i,n;return $f(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,vV(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:r=o.sent(),i=r.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(n=r.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.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:UL.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:UL.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"}($F||($F={}));var eB=function(){function e(e,t){this._audioEventSessionId=PP(),this._videoEventSessionId=PP(),this._currentAudioSend={startTime:0,eventSessionId:0,type:UL.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:UL.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=$F.INITIAL,this._videoFirstFrameState=$F.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var r,i,n,o=this;if(e===ML.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:kL.BEGIN_SEND,type:t,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){o.stopSendFrame(ML.AUDIO,LL.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),hx.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=$F.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===ML.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?ML.SCREEN_VIDEO:e,event_type:kL.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(ML.VIDEO,LL.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),hx.rtcFirstFrame(a),this._videoFirstFrameState=$F.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 r,i,n,o,a;if(e===ML.AUDIO){if(this._audioFirstFrameState!==$F.BEGIN)return;var s={event_type:kL.SENT_END,media_type:e,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioSend)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,hx.rtcFirstFrame(s),this._audioFirstFrameState=$F.STOPPED}else if(e===ML.VIDEO){if(this._videoFirstFrameState!==$F.BEGIN)return;s={event_type:kL.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?ML.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,hx.rtcFirstFrame(s),this._videoFirstFrameState=$F.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===ML.AUDIO){if(this._audioFirstFrameState!==$F.BEGIN)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,i=r.type,n=r.startTime,o={event_type:kL.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:i};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),hx.rtcFirstFrame(o),this._audioFirstFrameState=$F.SENT}else if(e===ML.VIDEO){if(this._videoFirstFrameState!==$F.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;i=a.type,n=a.startTime,o={event_type:kL.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?ML.SCREEN_VIDEO:e,start:n,result:!0,event_session_id:this._videoEventSessionId,type:i};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),hx.rtcFirstFrame(o),this._videoFirstFrameState=$F.SENT}},e.prototype.setLogin=function(e){var t,r;this._login!==e&&(this._login=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(ML.VIDEO,UL.LOGIN),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(ML.AUDIO,UL.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(ML.AUDIO,LL.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(ML.VIDEO,LL.LEAVE_ROOM))},e.prototype.setPublish=function(e){var t,r;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(ML.VIDEO,UL.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(ML.AUDIO,UL.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(ML.AUDIO,LL.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(ML.VIDEO,LL.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(ML.AUDIO,UL.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(ML.AUDIO,LL.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(ML.AUDIO,UL.ENABLE),!e&&this._audioSending&&this.stopSendFrame(ML.AUDIO,LL.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(ML.VIDEO,UL.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(ML.VIDEO,LL.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(ML.VIDEO,UL.ENABLE),!e&&this._videoSending&&this.stopSendFrame(ML.VIDEO,LL.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(ML.AUDIO,LL.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(ML.AUDIO,LL.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(ML.AUDIO,UL.PUSH),!e&&this._audioSending&&this.stopSendFrame(ML.AUDIO,LL.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(ML.VIDEO,LL.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(ML.VIDEO,LL.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(ML.VIDEO,UL.PUSH),!e&&this._videoSending&&this.stopSendFrame(ML.VIDEO,LL.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(ML.AUDIO,LL.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(ML.VIDEO,LL.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,r,i,n,o;return Zf(this,void 0,void 0,(function(){var a;return $f(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(r=null===(t=this._stream)||void 0===t?void 0:t.videoTrack)||void 0===r?void 0:r.getTrack())?[4,vV(null===(i=this._handler)||void 0===i?void 0:i.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,r,i,n,o;return Zf(this,void 0,void 0,(function(){var a;return $f(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(r=null===(t=this._stream)||void 0===t?void 0:t.audioTrack)||void 0===r?void 0:r.getTrack())?[4,vV(null===(i=this._handler)||void 0===i?void 0:i.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.setInterval((function(){return Zf(e,void 0,void 0,(function(){var e;return $f(this,(function(r){switch(r.label){case 0:return[4,this._getFirstVideoFrameStats()];case 1:if((e=r.sent())&&e.framesSent>t){if(-1===t)return t=e.framesSent,[2];this.sendFrameFinish(ML.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return Zf(e,void 0,void 0,(function(){var e;return $f(this,(function(r){switch(r.label){case 0:return[4,this._getFirstAudioFrameStats()];case 1:if((e=r.sent())&&e.packetsSent>t){if(-1===t)return t=e.packetsSent,[2];this.sendFrameFinish(ML.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}return[2]}}))}))}),100)},e.prototype.destroy=function(){delete this._stream,delete this._handler,window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)},Object.defineProperty(e.prototype,"_audioSending",{get:function(){return this._audioFirstFrameState===$F.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===$F.BEGIN},enumerable:!1,configurable:!0}),e}(),tB=new tk("Room",1),rB=function(e){function t(t){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._roomConfig=t,r._mediaServerClient=new BF,r._addHandlerEventHandler(),r._isReconnecting=!1,r}return Cf(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,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E=this;null===(e=this._mediaServerClient)||void 0===e||e.on(tx.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(tx.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(tx.USER_CONNECTION,this._onUserConnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(tx.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(tx.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(tx.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(tx.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(tx.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(tx.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(tx.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(tx.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(tx.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(tx.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(tx.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(rx.RSCP,this._onPublishOnDemand.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(ix.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(ix.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on("onRemoteStreamStats",(function(e){E.emit(KF.ON_REMOTE_STREAM_STATS,e)})),null===(S=this._mediaServerClient)||void 0===S||S.on("onLocalStreamStats",(function(e){E.emit(KF.ON_LOCAL_STREAM_STATS,e)}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,r,i,n,o){return Zf(this,void 0,void 0,(function(){var a=this;return $f(this,(function(s){return _x.setStats({rtc_app_id:e,room_id:t,user_id:i.userId}),tB.print("join()"),[2,new Promise((function(s,c){return Zf(a,void 0,void 0,(function(){var a,u,d=this;return $f(this,(function(l){return this._joinResolveCallback=s,this._joinRejectCallback=c,this._liveControlMessage=n,this._roomInfo={appId:e,roomId:t,token:r,userInfo:i,useCloudProxy:o},a=CP(),this.setSessionId(),hx.joinRoom(FL.BEGIN,a,!1,"",{enable_cloud_proxy:null===(u=this._roomInfo)||void 0===u?void 0:u.useCloudProxy}),this._join((function(e){var t;hx.joinRoom(FL.END,a,!0,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)}),(function(e){var t;hx.joinRoom(FL.END,a,!1,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)}),!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,r){var i;return void 0===r&&(r=!1),Zf(this,void 0,void 0,(function(){var n,o,a;return $f(this,(function(s){switch(s.label){case 0:n=CP(),tB.print("_join()"),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId},r,this._liveControlMessage)];case 2:return o=s.sent(),this._mediaServerClient.roomAttributes=o.roomAttributes,this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e(null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo),this._isReconnecting=!1,hx.rtcJoinRoom(0,"web","web",CP()-n),this._onJoinSucc(o,r),[3,4];case 3:return(a=s.sent()).code!==tD.OPERATION_CANCEL&&"function"==typeof t?[2,t(a)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,r){var i,n,o,a,s;return Zf(this,void 0,void 0,(function(){var c,u,d,l;return $f(this,(function(h){switch(h.label){case 0:return tB.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new qF,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new eB(this._localScreenStream,this._mediaServerClient.handler))),c=!1,u=!1,d=!1,l=!1,!this._localScreenStream.videoTrack&&t?(t instanceof NF&&(u=!0),c=!0):this._localScreenStream.videoTrack&&!t&&(c=!1),!this._localScreenStream.audioTrack&&r?(r instanceof wF&&(l=!0),d=!0):this._localScreenStream.audioTrack&&!r&&(d=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=r,this._localScreenStream.videoEncodeConfig=e,this._localScreenStream.hasPublished?[3,2]:(null===(i=this._localScreenStream.observer)||void 0===i||i.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]);case 1:return h.sent(),[3,4];case 2:return u?null===(n=this._localScreenStream.observer)||void 0===n||n.setPushVideo(c):null===(o=this._localScreenStream.observer)||void 0===o||o.setEnableVideo(c),l?null===(a=this._localScreenStream.observer)||void 0===a||a.setPushAudio(d):null===(s=this._localScreenStream.observer)||void 0===s||s.setEnableAudio(d),[4,this.updatePubScreenTrack()];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return tB.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 Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return tB.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){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return tB.print("controlMessage","Invoke controlMessage"),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(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 Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return tB.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,r,i,n){var o,a,s,c,u,d;return void 0===n&&(n=!1),Zf(this,void 0,void 0,(function(){var l,h,p,f,_,v;return $f(this,(function(m){switch(m.label){case 0:if(tB.print("publish","Invoke publish"),l=!1,this._localStream||(this._localStream=new qF,this._mediaServerClient.handler&&(this._localStream.observer=new eB(this._localStream,this._mediaServerClient.handler)),l=!0),this._localStream.videoTrack=r,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,this._localStream.hasPublished)return[3,5];m.label=1;case 1:return m.trys.push([1,3,,4]),n?null===(o=this._localStream.observer)||void 0===o||o.setLogin(!0):l&&(h=!!this._localStream.videoTrack,p=!!this._localStream.audioTrack,f=this._localStream.videoTrack instanceof NF,_=this._localStream.audioTrack instanceof wF,this._roomConfig.isAutoPublish?(h&&(f?null===(a=this._localStream.observer)||void 0===a||a.setPushVideo(!0):null===(s=this._localStream.observer)||void 0===s||s.setEnableVideo(!0)),p&&(_?null===(c=this._localStream.observer)||void 0===c||c.setPushAudio(!0):null===(u=this._localStream.observer)||void 0===u||u.setEnableAudio(!0))):null===(d=this._localStream.observer)||void 0===d||d.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return m.sent(),this.emit(KF.ON_PUBLISH_RESULT,{isScreen:!1,state:Uf.PUBLISH_SUCC}),[3,4];case 3:throw v=m.sent(),this.emit(KF.ON_PUBLISH_RESULT,{isScreen:!1,state:Uf.PUBLISH_FAIL}),v;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:m.sent(),m.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return tB.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 Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return tB.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,r){return Zf(this,void 0,void 0,(function(){return $f(this,(function(i){switch(i.label){case 0:return tB.print("subscribe","remoteStream %o",e),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return i.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){var i,n;return Zf(this,void 0,void 0,(function(){return $f(this,(function(o){return tB.print("updateSubTrack","Invoke updateSubTrack"),e.subMediaType===t&&(null===(i=null==e?void 0:e.subConfig)||void 0===i?void 0:i.videoIndex)===(null==r?void 0:r.videoIndex)?[2,Promise.resolve(e)]:[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(e,t,r)]}))}))},t.prototype.unsubscribe=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return tB.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s,c;return $f(this,(function(u){switch(u.label){case 0:tB.print("leave","Invoke leave"),r=CP(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(i=Qf(this._remoteStreams.values()),n=i.next();!n.done;n=i.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=i.return)&&c.call(i)}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(),hx.rtcLeaveRoom(0,"",CP()-r),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&hx.rtcLeaveRoom(-1,a.message,CP()-r),[3,4];case 4:return[2]}}))}))},t.prototype.destroy=function(){var e,t,r,i;tB.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var n=Qf(this._remoteStreams),o=n.next();!o.done;o=n.next()){var a=e_(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===(r=this._localStream)||void 0===r||r.clean(),this._localStream=void 0),this._localScreenStream&&(null===(i=this._localScreenStream)||void 0===i||i.clean(),this._localScreenStream=void 0),this._removeHandlerEventHandler(),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear()},t.prototype.updateToken=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return tB.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.muteLocalTrack=function(e,t){var r,i,n,o,a,s;return Zf(this,void 0,void 0,(function(){var c,u;return $f(this,(function(d){switch(d.label){case 0:return this._localStream&&(null===(r=this._localStream)||void 0===r?void 0:r.hasPublished)?(c=t!==kf.MUTE_STATE_OFF,u=this._localStream.switchTrackEnableState(e,c),"audio"===e?null===(n=null===(i=this.localStream)||void 0===i?void 0:i.observer)||void 0===n||n.setUnmuteAudio(c):null===(a=null===(o=this.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setUnmuteVideo(c),u?[4,null===(s=this._mediaServerClient)||void 0===s?void 0:s.updatePubTrack(this._localStream)]:[3,2]):[2,!1];case 1:d.sent(),d.label=2;case 2:return[2,u]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Zf(this,void 0,void 0,(function(){var t,r,i,n,o,a,s=this;return $f(this,(function(c){t=[];try{for(r=Qf(this._remoteStreams.values()),i=r.next();!i.done;i=r.next())n=i.value,Array.isArray(n)&&n.forEach((function(r){if(r.hasSubscribed){var i=null;switch(e){case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===Bf.AUDIO_ONLY?i=Bf.NONE:r.subMediaType===Bf.AUDIO_AND_VIDEO&&(i=Bf.VIDEO_ONLY);break;case xf.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===Bf.VIDEO_ONLY?i=Bf.NONE:r.subMediaType===Bf.AUDIO_AND_VIDEO&&(i=Bf.AUDIO_ONLY);break;case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==Bf.NONE&&(i=Bf.NONE)}if(null!==i){var n=s.updateSubTrack(r,i,r.subConfig);n&&t.push(n)}}}))}catch(e){o={error:e}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return Zf(this,void 0,void 0,(function(){var t,r,i,n,o,a,s=this;return $f(this,(function(c){t=[];try{for(r=Qf(this._remoteStreams.values()),i=r.next();!i.done;i=r.next())n=i.value,Array.isArray(n)&&n.forEach((function(r){if(r.hasSubscribed){var i=null;switch(e){case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===Bf.NONE?i=Bf.AUDIO_ONLY:r.subMediaType===Bf.VIDEO_ONLY&&(i=Bf.AUDIO_AND_VIDEO);break;case xf.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===Bf.NONE?i=Bf.VIDEO_ONLY:r.subMediaType===Bf.AUDIO_ONLY&&(i=Bf.AUDIO_AND_VIDEO);break;case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==Bf.AUDIO_AND_VIDEO&&(i=Bf.AUDIO_AND_VIDEO)}if(null!==i){var n=s.updateSubTrack(r,i,r.subConfig);n&&t.push(n)}}}))}catch(e){o={error:e}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)},t.prototype.setSessionId=function(){this._sessionId=TP(),_x.setStats({rtc_session_id:this._sessionId})},t.prototype.sendRoomMessage=function(e,t){var r,i;return void 0===t&&(t=!1),Zf(this,void 0,void 0,(function(){var n,o;return $f(this,(function(a){switch(a.label){case 0:return n={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:t,message:""},t?(o=n,[4,wP.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===(i=this._mediaServerClient)||void 0===i?void 0:i.sendRoomMessage(n)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){tB.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new BF,this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var r,i,n,o,a,s=this;tB.print("JoinSuccess()");var c=[],u=[],d=[],l=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var r=s._remoteUsers.get(t.clientId);r?r._stillExist=!0:c.push(t)}}));try{for(var h=Qf(this._remoteUsers.values()),p=h.next();!p.done;p=h.next()){var f=p.value;f._stillExist||u.push({clientId:f.userId}),delete f._stillExist}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):l.push(e)}));try{for(var _=Qf(this._remoteStreams.values()),v=_.next();!v.done;v=_.next()){var m=v.value;Array.isArray(m)&&m.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:ex.clientDisconnected})}))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(o=_.return)&&o.call(_)}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)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,r=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 i=Qf(this._remoteStreams.values()),n=i.next();!n.done;n=i.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return Zf(r,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),r.label=1;case 1:return r.trys.push([1,3,,4]),tB.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType,e.subConfig)];case 2:return r.sent(),tB.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(KF.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=r.sent(),tB.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=i.return)&&t.call(i)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t,r){var i,n,o,a,s,c,u,d,l,h,p,f;if(void 0===t&&(t=!0),void 0===r&&(r=!0),e.clientId!==(null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo.userId)){var _=this._findRemoteStream(e.clientId,e.streamId);if(!_){_=new ZF(e.clientId,e.streamId,e.screen,e.attributes),this._initStreamListeners(_);var v=this._remoteStreams.get(e.clientId);v?v.push(_):this._remoteStreams.set(e.clientId,[_])}if(this._mediaServerClient.handler&&(_.observer=new QF(_,this._mediaServerClient.handler)),!_.isScreen&&(r&&_.hasVideo&&(_.attributes.extvideo?(null===(n=_.observer)||void 0===n||n.setExternalVideoSource(!0),null===(o=_.observer)||void 0===o||o.setPushVideo(!0)):(null===(a=_.observer)||void 0===a||a.setExternalVideoSource(!1),null===(s=_.observer)||void 0===s||s.setPublishVideo(!0))),r&&_.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(_.attributes.extaudio?(null===(c=_.observer)||void 0===c||c.setExternalAudioSource(!0),null===(u=_.observer)||void 0===u||u.setPushAudio(!0)):(null===(d=_.observer)||void 0===d||d.setExternalAudioSource(!1),null===(l=_.observer)||void 0===l||l.setPublishAudio(!0))),!0===t&&!1===r)){var m=this._roomConfig,S=m.isAutoSubscribeAudio,E=m.isAutoSubscribeVideo;null===(h=_.observer)||void 0===h||h.setLogin(!0,{audio:S,video:E})}return t&&this.safeEmit(tx.ON_ADD_STREAM,{stream:_}),!_.isScreen&&(null===(p=null==e?void 0:e.attributes)||void 0===p?void 0:p.localvideo)&&this.safeEmit(KF.ON_USER_START_VIDEO_CAPTURE,{userId:_.userId}),!_.isScreen&&(null===(f=null==e?void 0:e.attributes)||void 0===f?void 0:f.localaudio)&&this.safeEmit(KF.ON_USER_START_AUDIO_CAPTURE,{userId:_.userId}),_}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof r)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(r);var i={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,Jf({},i)),this.safeEmit(tx.USER_CONNECTION,{userInfo:i})}},t.prototype._onUserDisconnection=function(e){var t,r=this,i=e.clientId,n=e.tag,o=e.code;if(i)if(i===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;n===nx.kickedByAdmin?a=tD.KICKED_OUT:n===nx.onUserTokenDidExpire?a=tD.TOKEN_EXPIRED:n===nx.userDuplicateLogin&&(a=tD.DUPLICATE_LOGIN),o===ox.roomDismissByAdmin&&(a=tD.ROOM_DISMISS),a&&this.safeEmit(KF.ON_ROOM_ERROR,{errorCode:a})}else{var s=wf.DROPPED;n===nx.userLeave?s=wf.QUIT:n===nx.kickedByAdmin?s=wf.KICKED_BY_ADMIN:n===nx.roleChanged&&(s=wf.SWITCH_TO_INVISIBLE);var c=function(){r._remoteUsers.delete(i);var e=r._remoteStreams.get(i);Array.isArray(e)&&e.length&&(e.forEach((function(e){r.safeEmit(tx.ON_REMOVE_STREAM,{stream:e,reason:"Client leave"})})),r._remoteStreams.delete(i)),r.safeEmit(KF.ON_USER_LEAVE,{userInfo:{userId:i},reason:s})};if(n===nx.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(i);null!=u||self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(i,d)}else c()}},t.prototype._onRemoveStream=function(e){var t,r,i,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===(r=this._mediaServerClient)||void 0===r||r.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})),o._remoteStreams.set(e.clientId,t)}})),this.safeEmit(tx.ON_REMOVE_STREAM,{stream:s,reason:e.message}),s.hasVideo&&(null===(i=s.observer)||void 0===i||i.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,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E=e.clientId,y=e.streamId,g=e.attributes,b=this._findRemoteStream(E,y);if(b){var T=b.attributes,I=Jf(Jf({},T),g),R=!1,A=I.localaudio!==T.localaudio,C=!1,O=!1,N=I.localvideo!==T.localvideo,w=!1;I.audiostream!==T.audiostream&&(R=!0,C=!!I.audiostream,I.audiostream?this.safeEmit(KF.ON_USER_MUTE_AUDIO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_ON}):this.safeEmit(KF.ON_USER_MUTE_AUDIO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_OFF})),I.videostream!==T.videostream&&(O=!0,w=!!I.videostream,I.videostream?this.safeEmit(KF.ON_USER_MUTE_VIDEO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_ON}):this.safeEmit(KF.ON_USER_MUTE_VIDEO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_OFF})),I.localaudio!==T.localaudio&&(I.localaudio?(I.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(r=b.observer)||void 0===r||r.setPushAudio(!0)):(null===(i=b.observer)||void 0===i||i.setExternalAudioSource(!1),null===(n=b.observer)||void 0===n||n.setEnableAudio(!0)),this.safeEmit(KF.ON_USER_START_AUDIO_CAPTURE,{userId:E})):(I.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)),this.safeEmit(KF.ON_USER_STOP_AUDIO_CAPTURE,{userId:E}))),I.localvideo!==T.localvideo&&(I.localvideo?(I.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(KF.ON_USER_START_VIDEO_CAPTURE,{userId:E})):(I.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)),this.safeEmit(KF.ON_USER_STOP_VIDEO_CAPTURE,{userId:E}))),R&&!A&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!N&&(null===(S=b.observer)||void 0===S||S.setRemoteUnmuteVideo(w)),b.attributes=I}},t.prototype._onPushTrack=function(e){var t=this,r=e.clientId,i=e.streamId,n=this._findRemoteStream(r,i);n||(n=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){return t.safeEmit(KF.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){tB.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,r=e.clientId,i=e.streamId,n=e.message,o=this._findRemoteStream(r,i);o&&this._mediaServerClient.unsubscribe4removeTrack(o,n).then((function(){var e;if(o._workaround_1_){var n=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==i}));t._remoteStreams.set(r,n||[])}t.safeEmit(KF.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){tB.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,r=e.nodes,i=e.reason;Mx.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(r)&&r.length?this._getAccessNode=r[0]:this._getAccessFeedback=i,hx.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(i)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,r=this;this._isReconnecting=!0;try{for(var i=Qf(this._remoteStreams.values()),n=i.next();!n.done;n=i.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=i.return)&&t.call(i)}finally{if(e)throw e.error}}hx.rtcReconnect(1002,hL.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,pL.PEERCONNECTION),this._join((function(){hx.rtcReconnected(fL.PEERCONNECTION_RECONNECTED,_L.PEERCONNECTION)}),(function(e){tB.print("Reconnecting error, will reconnect after 3s",e),r._reconnectTimer=setTimeout(r._reconnect.bind(r),3e3)}),!0)},t.prototype._handleAbnormalDisconnection=function(){tB.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t;if(e.next===UF.DISCONNECTED)t=Gf.CONNECTION_STATE_DISCONNECTED;else if(e.next===UF.CONNECTED)t=this._isReconnecting?Gf.CONNECTION_STATE_RECONNECTED:Gf.CONNECTION_STATE_CONNECTED;else{if(e.next!==UF.CONNECTING)return;t=this._isReconnecting?Gf.CONNECTION_STATE_RECONNECTING:Gf.CONNECTION_STATE_CONNECTING}this.safeEmit(ix.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(r){var i;t.emit(KF.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(i=t._roomInfo)||void 0===i?void 0:i.roomId,streamIndex:e.isScreen?Ff.STREAM_INDEX_SCREEN:Ff.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(tx.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(tx.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(tx.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){var t,r=(null===(t=e.body)||void 0===t?void 0:t.error)||0;this.safeEmit(tx.POST_PROCESSING_MESSAGE,{code:r,message:["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"][r],type:e.type})},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(tx.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onPublishOnDemand=function(e){var t,r,i,n;if((null===(t=this._localStream)||void 0===t?void 0:t.enableSimulcast)&&(null===(r=this._localStream)||void 0===r?void 0:r.videoTransceiver)){var o=null===(i=this._localStream)||void 0===i?void 0:i.stream.id,a=null===(n=this._localStream)||void 0===n?void 0:n.videoTransceiver.sender,s=a.getParameters();if(Array.isArray(s.encodings)&&Array.isArray(e)){var c={};tB.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(o)){var r=null==e?void 0:e.Metadata.SubvideoIndex;c[r]=r}})),s.encodings=s.encodings.map((function(e){return e.rid&&(c[e.rid]===+e.rid?e.active=!0:e.active=!1),e}))}a.setParameters(s)}},t}(ik),iB=function(e,t){void 0===t&&(t={});var r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=e_(e,2),i=t[0],n=t[1];"muted"===i?r.muted=!0:r.setAttribute(i,n)})),r},nB=function(e,t){return void 0===t&&(t={}),t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var r=e_(t,2),i=r[0],n=r[1];e.setAttribute(i,n)})),e},oB=new tk("Player",0),aB=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],sB={playsinline:"","webkit-playsinline":""},cB={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},uB=new(function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var r="audio"===e?sB:cB;if("video"===e&&this.videoCache.length>0){if(i=this.videoCache.pop())return nB(i,{style:t,attributes:r}),i}else if("audio"===e&&this.audioCache.length>0){var i;if(i=this.audioCache.pop())return nB(i,{style:t,attributes:r}),i}return iB(e,{style:t,attributes:r})},e.prototype.recycle=function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)},e}()),dB=function(e){function t(t){var r=e.call(this)||this;r.mirrorType=Hf.MIRROR_TYPE_NONE,r.emitVideoEvent=function(e){var t,i,n={type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:e.type,currentTime:(null===(i=r._videoDom)||void 0===i?void 0:i.currentTime)||0,isScreen:r.isScreen};r.emit("playback_event",n)},r._internalPlay=function(){var e;if(null===(e=r._videoDom)||void 0===e?void 0:e.paused){var t=r._videoDom.play();(null==t?void 0:t.then)&&t.catch((function(e){var t,i;hx.rtcError("video autoplay failed, userId: ".concat(r.userId),-1e3),r.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:"autoplay-error",currentTime:(null===(i=r._videoDom)||void 0===i?void 0:i.currentTime)||0})}))}};var i=t.renderDom,n=t.userId;r.renderMode=void 0!==t.renderMode?t.renderMode:Vf.RENDER_MODE_FIT;var o="string"==typeof i?document.getElementById(i):i;if(!o)throw new aD(tD.CANT_FIND_DOM,"can't find dom");return r._containerDom=o,r.userId=n,r.isScreen=!!t.isScreen,r._initVideo(),r}return Cf(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=uB.getOrCreate("video",{width:"100%",height:"100%",background:"black"}),this._videoDom.id="".concat(this.userId,"_").concat(AP()),this.renderMode===Vf.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===Hf.MIRROR_TYPE_RENDER)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&aB.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._videoDom&&(aB.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(r){var i;if("timeupdate"===r.eventName){var n=e.isScreen?1.5:.5;if(void 0===t.__cumulativeTime&&(t.__cumulativeTime=0),0===(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime))return;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 r;return Zf(this,void 0,void 0,(function(){var i,n,o=this;return $f(this,(function(a){return i=this._videoDom,oB.print("playVideo","play video track: ".concat(this.userId)),i&&i.srcObject instanceof MediaStream&&i.srcObject.getTrackById(null===(r=e.getTrack())||void 0===r?void 0:r.id)||(i||(this._initVideo(),i=this._videoDom),oB.print("playVideo","play video by dom: ".concat(null==i?void 0:i.id)),(n=new MediaStream).addTrack(e.getTrack()),i.srcObject=n,this._containerDom.appendChild(i),i.addEventListener("canplay",this._internalPlay),i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return o._internalPlay()})),t&&this._recordFrame(t)),[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}},t.prototype.manuallyPlay=function(){if(oB.print("Invoke AudioPlayer.manuallyPlay"),!this._videoDom)throw new aD(tD.INVALID_PARAMS,"Player not found");var e=this._videoDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.mirror=function(e){oB.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?Hf.MIRROR_TYPE_RENDER:Hf.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;oB.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0},t.prototype.destroy=function(){oB.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(uB.recycle(this._videoDom),delete this._videoDom)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(ZP.exports.EventEmitter),lB=function(e){function t(t,r){var i=e.call(this)||this;if(i.emitVideoEvent=function(e){var t,r,n={type:"audio",rawEvent:e,readyState:(null===(t=i._audioDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._audioDom)||void 0===r?void 0:r.currentTime)||0};i.emit("playback_event",n)},i._internalPlay=function(){var e,t;if(gx("_internalPlay",{paused:null===(e=i._audioDom)||void 0===e?void 0:e.paused}),null===(t=i._audioDom)||void 0===t?void 0:t.paused)try{var r=i._audioDom.play();(null==r?void 0:r.then)&&r.catch((function(e){i._autoPlayError(e)})).then((function(){gx("_internalPlay successfully",{userId:i.userId})}))}catch(e){i._autoPlayError(e)}},r){var n=document.getElementById(r);if(!n)throw new aD(tD.CANT_FIND_DOM,"can't find dom");i._containerDom=n}else i._containerDom=document.body;return i.userId=t,i._initAudio(),i}return Cf(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=uB.getOrCreate("audio",{display:"none"}),this._audioDom.id="".concat(this.userId,"_").concat(AP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&aB.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(aB.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return Zf(this,void 0,void 0,(function(){var r,i,n=this;return $f(this,(function(o){return oB.print("playAudio","play audio track: ".concat(this.userId)),(r=this._audioDom)&&r.srcObject instanceof MediaStream&&r.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)||(r||(this._initAudio(),r=this._audioDom),(i=new MediaStream).addTrack(e.getTrack()),r.srcObject=i,null==r||r.addEventListener("canplay",this._internalPlay),null==r||r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return n._internalPlay()}))),[2]}))}))},t.prototype._autoPlayError=function(e){var t,r;hx.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===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0})},t.prototype.manuallyPlay=function(){if(oB.print("Invoke AudioPlayer.manuallyPlay"),!this._audioDom)throw new aD(tD.INVALID_PARAMS,"Player not found");var e=this._audioDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.setPlaybackDevice=function(e){return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:return oB.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,lF.getAudioPlayback()];case 1:return t=r.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return r.sent(),[2]}}))}))},t.prototype.stop=function(){var e=this._containerDom;oB.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom))},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){oB.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._audioDom&&(uB.recycle(this._audioDom),delete this._audioDom)},t}(ZP.exports.EventEmitter),hB="object"==("undefined"==typeof global?"undefined":t(global))&&global&&global.Object===Object&&global,pB="object"==("undefined"==typeof self?"undefined":t(self))&&self&&self.Object===Object&&self,fB=hB||pB||Function("return this")(),_B=fB.Symbol,vB=Object.prototype,mB=vB.hasOwnProperty,SB=vB.toString,EB=_B?_B.toStringTag:void 0;var yB=Object.prototype.toString;var gB=_B?_B.toStringTag:void 0;function bB(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":gB&&gB in Object(e)?function(e){var t=mB.call(e,EB),r=e[EB];try{e[EB]=void 0;var i=!0}catch(e){}var n=SB.call(e);return i&&(t?e[EB]=r:delete e[EB]),n}(e):function(e){return yB.call(e)}(e)}function TB(e){return null!=e&&"object"==t(e)}var IB=Array.isArray;function RB(e){var r=t(e);return null!=e&&("object"==r||"function"==r)}function AB(e){return e}function CB(e){if(!RB(e))return!1;var t=bB(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var OB=fB["__core-js_shared__"],NB=function(){var e=/[^.]+$/.exec(OB&&OB.keys&&OB.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var wB=Function.prototype.toString;var DB=/^\[object .+?Constructor\]$/,PB=Function.prototype,kB=Object.prototype,MB=PB.toString,UB=kB.hasOwnProperty,LB=RegExp("^"+MB.call(UB).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xB(e){return!(!RB(e)||(t=e,NB&&NB in t))&&(CB(e)?LB:DB).test(function(e){if(null!=e){try{return wB.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function VB(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var FB=Date.now;var BB,jB,GB,HB=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return xB(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),zB=HB,KB=zB?function(e,t){return zB(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:AB,YB=(BB=KB,jB=0,GB=0,function(){var e=FB(),t=16-(e-GB);if(GB=e,t>0){if(++jB>=800)return arguments[0]}else jB=0;return BB.apply(void 0,arguments)}),XB=YB,WB=/^(?:0|[1-9]\d*)$/;function JB(e,r){var i=t(e);return!!(r=null==r?9007199254740991:r)&&("number"==i||"symbol"!=i&&WB.test(e))&&e>-1&&e%1==0&&e<r}function qB(e,t,r){"__proto__"==t&&zB?zB(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function ZB(e,t){return e===t||e!=e&&t!=t}var $B=Object.prototype.hasOwnProperty;function QB(e,t,r){var i=e[t];$B.call(e,t)&&ZB(i,r)&&(void 0!==r||t in e)||qB(e,t,r)}var ej=Math.max;function tj(e,t){return XB(function(e,t,r){return t=ej(void 0===t?e.length-1:t,0),function(){for(var i=arguments,n=-1,o=ej(i.length-t,0),a=Array(o);++n<o;)a[n]=i[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=i[n];return s[t]=r(a),VB(e,this,s)}}(e,t,AB),e+"")}function rj(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function ij(e){return null!=e&&rj(e.length)&&!CB(e)}var nj=Object.prototype;function oj(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||nj)}function aj(e){return TB(e)&&"[object Arguments]"==bB(e)}var sj=Object.prototype,cj=sj.hasOwnProperty,uj=sj.propertyIsEnumerable,dj=aj(function(){return arguments}())?aj:function(e){return TB(e)&&cj.call(e,"callee")&&!uj.call(e,"callee")},lj=dj;var hj="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,pj=hj&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,fj=pj&&pj.exports===hj?fB.Buffer:void 0,_j=(fj?fj.isBuffer:void 0)||function(){return!1},vj={};vj["[object Float32Array]"]=vj["[object Float64Array]"]=vj["[object Int8Array]"]=vj["[object Int16Array]"]=vj["[object Int32Array]"]=vj["[object Uint8Array]"]=vj["[object Uint8ClampedArray]"]=vj["[object Uint16Array]"]=vj["[object Uint32Array]"]=!0,vj["[object Arguments]"]=vj["[object Array]"]=vj["[object ArrayBuffer]"]=vj["[object Boolean]"]=vj["[object DataView]"]=vj["[object Date]"]=vj["[object Error]"]=vj["[object Function]"]=vj["[object Map]"]=vj["[object Number]"]=vj["[object Object]"]=vj["[object RegExp]"]=vj["[object Set]"]=vj["[object String]"]=vj["[object WeakMap]"]=!1;var mj="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,Sj=mj&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,Ej=Sj&&Sj.exports===mj&&hB.process,yj=function(){try{var e=Sj&&Sj.require&&Sj.require("util").types;return e||Ej&&Ej.binding&&Ej.binding("util")}catch(e){}}(),gj=yj&&yj.isTypedArray,bj=gj?function(e){return function(t){return e(t)}}(gj):function(e){return TB(e)&&rj(e.length)&&!!vj[bB(e)]},Tj=bj,Ij=Object.prototype.hasOwnProperty;function Rj(e,t){var r=IB(e),i=!r&&lj(e),n=!r&&!i&&_j(e),o=!r&&!i&&!n&&Tj(e),a=r||i||n||o,s=a?function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],c=s.length;for(var u in e)!t&&!Ij.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||JB(u,c))||s.push(u);return s}var Aj=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Cj=Aj,Oj=Object.prototype.hasOwnProperty;function Nj(e){return ij(e)?Rj(e):function(e){if(!oj(e))return Cj(e);var t=[];for(var r in Object(e))Oj.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var wj=Object.prototype.hasOwnProperty;function Dj(e){if(!RB(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=oj(e),r=[];for(var i in e)("constructor"!=i||!t&&wj.call(e,i))&&r.push(i);return r}var Pj,kj=(Pj=function(e,t){!function(e,t,r,i){var n=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=i?i(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),n?qB(r,s,c):QB(r,s,c)}}(t,function(e){return ij(e)?Rj(e,!0):Dj(e)}(t),e)},tj((function(e,r){var i=-1,n=r.length,o=n>1?r[n-1]:void 0,a=n>2?r[2]:void 0;for(o=Pj.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,r,i){if(!RB(i))return!1;var n=t(r);return!!("number"==n?ij(i)&&JB(r,i.length):"string"==n&&r in i)&&ZB(i[r],e)}(r[0],r[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++i<n;){var s=r[i];s&&Pj(e,s,i,o)}return e}))),Mj=kj;function Uj(e,t){return function(e,t){for(var r=-1,i=null==e?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n}(t,(function(t){return e[t]}))}function Lj(e){return null==e?[]:Uj(e,Nj(e))}var xj=a,Vj=Qe("iterator"),Fj=!xj((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,i){t.delete("b"),r+=i+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[Vj]||"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"!==r||"x"!==new URL("http://x",void 0).host})),Bj=I,jj=2147483647,Gj=/[^\0-\u007E]/,Hj=/[.\u3002\uFF0E\uFF61]/g,zj="Overflow: input needs wider integers to process",Kj=n.RangeError,Yj=Bj(Hj.exec),Xj=Math.floor,Wj=String.fromCharCode,Jj=Bj("".charCodeAt),qj=Bj([].join),Zj=Bj([].push),$j=Bj("".replace),Qj=Bj("".split),eG=Bj("".toLowerCase),tG=function(e){return e+22+75*(e<26)},rG=function(e,t,r){var i=0;for(e=r?Xj(e/700):e>>1,e+=Xj(e/t);e>455;)e=Xj(e/35),i+=36;return Xj(i+36*e/(e+38))},iG=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=Jj(e,r++);if(n>=55296&&n<=56319&&r<i){var o=Jj(e,r++);56320==(64512&o)?Zj(t,((1023&n)<<10)+(1023&o)+65536):(Zj(t,n),r--)}else Zj(t,n)}return t}(e);var r,i,n=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(i=e[r])<128&&Zj(t,Wj(i));var c=t.length,u=c;for(c&&Zj(t,"-");u<n;){var d=jj;for(r=0;r<e.length;r++)(i=e[r])>=o&&i<d&&(d=i);var l=u+1;if(d-o>Xj((jj-a)/l))throw Kj(zj);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((i=e[r])<o&&++a>jj)throw Kj(zj);if(i==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;Zj(t,Wj(tG(f+_%v))),h=Xj(_/v),p+=36}Zj(t,Wj(tG(h))),s=rG(a,l,u==c),a=0,u++}}a++,o++}return qj(t,"")},nG=Yi,oG=n,aG=Y,sG=l,cG=I,uG=Fj,dG=Wt.exports,lG=ic,hG=Go,pG=Dh,fG=Or,_G=lc,vG=B,mG=xe,SG=Yo,EG=lo,yG=kt,gG=G,bG=fo,TG=Rn,IG=S,RG=Oc,AG=gc,CG=lu,OG=cI,NG=Qe("iterator"),wG="URLSearchParams",DG="URLSearchParamsIterator",PG=fG.set,kG=fG.getterFor(wG),MG=fG.getterFor(DG),UG=aG("fetch"),LG=aG("Request"),xG=aG("Headers"),VG=LG&&LG.prototype,FG=xG&&xG.prototype,BG=oG.RegExp,jG=oG.TypeError,GG=oG.decodeURIComponent,HG=oG.encodeURIComponent,zG=cG("".charAt),KG=cG([].join),YG=cG([].push),XG=cG("".replace),WG=cG([].shift),JG=cG([].splice),qG=cG("".split),ZG=cG("".slice),$G=/\+/g,QG=Array(4),eH=function(e){return QG[e-1]||(QG[e-1]=BG("((?:%[\\da-f]{2}){"+e+"})","gi"))},tH=function(e){try{return GG(e)}catch(t){return e}},rH=function(e){var t=XG(e,$G," "),r=4;try{return GG(t)}catch(e){for(;r;)t=XG(t,eH(r--),tH);return t}},iH=/[!'()~]|%20/g,nH={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},oH=function(e){return nH[e]},aH=function(e){return XG(HG(e),iH,oH)},sH=pG((function(e,t){PG(this,{type:DG,iterator:RG(kG(e).entries),kind:t})}),"Iterator",(function(){var e=MG(this),t=e.kind,r=e.iterator.next(),i=r.value;return r.done||(r.value="keys"===t?i.key:"values"===t?i.value:[i.key,i.value]),r}),!0),cH=function(e){this.entries=[],this.url=null,void 0!==e&&(gG(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===zG(e,0)?ZG(e,1):e:bG(e)))};cH.prototype={type:wG,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,a,s,c=AG(e);if(c)for(r=(t=RG(e,c)).next;!(i=sG(r,t)).done;){if(o=(n=RG(yG(i.value))).next,(a=sG(o,n)).done||(s=sG(o,n)).done||!sG(o,n).done)throw jG("Expected sequence with length 2");YG(this.entries,{key:bG(a.value),value:bG(s.value)})}else for(var u in e)mG(e,u)&&YG(this.entries,{key:u,value:bG(e[u])})},parseQuery:function(e){if(e)for(var t,r,i=qG(e,"&"),n=0;n<i.length;)(t=i[n++]).length&&(r=qG(t,"="),YG(this.entries,{key:rH(WG(r)),value:rH(KG(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],YG(r,aH(e.key)+"="+aH(e.value));return KG(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var uH=function(){_G(this,dH);var e=arguments.length>0?arguments[0]:void 0;PG(this,new cH(e))},dH=uH.prototype;if(lG(dH,{append:function(e,t){CG(arguments.length,2);var r=kG(this);YG(r.entries,{key:bG(e),value:bG(t)}),r.updateURL()},delete:function(e){CG(arguments.length,1);for(var t=kG(this),r=t.entries,i=bG(e),n=0;n<r.length;)r[n].key===i?JG(r,n,1):n++;t.updateURL()},get:function(e){CG(arguments.length,1);for(var t=kG(this).entries,r=bG(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){CG(arguments.length,1);for(var t=kG(this).entries,r=bG(e),i=[],n=0;n<t.length;n++)t[n].key===r&&YG(i,t[n].value);return i},has:function(e){CG(arguments.length,1);for(var t=kG(this).entries,r=bG(e),i=0;i<t.length;)if(t[i++].key===r)return!0;return!1},set:function(e,t){CG(arguments.length,1);for(var r,i=kG(this),n=i.entries,o=!1,a=bG(e),s=bG(t),c=0;c<n.length;c++)(r=n[c]).key===a&&(o?JG(n,c--,1):(o=!0,r.value=s));o||YG(n,{key:a,value:s}),i.updateURL()},sort:function(){var e=kG(this);OG(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=kG(this).entries,i=SG(e,arguments.length>1?arguments[1]:void 0),n=0;n<r.length;)i((t=r[n++]).value,t.key,this)},keys:function(){return new sH(this,"keys")},values:function(){return new sH(this,"values")},entries:function(){return new sH(this,"entries")}},{enumerable:!0}),dG(dH,NG,dH.entries,{name:"entries"}),dG(dH,"toString",(function(){return kG(this).serialize()}),{enumerable:!0}),hG(uH,wG),nG({global:!0,forced:!uG},{URLSearchParams:uH}),!uG&&vG(xG)){var lH=cG(FG.has),hH=cG(FG.set),pH=function(e){if(gG(e)){var t,r=e.body;if(EG(r)===wG)return t=e.headers?new xG(e.headers):new xG,lH(t,"content-type")||hH(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),TG(e,{body:IG(0,bG(r)),headers:IG(0,t)})}return e};if(vG(UG)&&nG({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return UG(e,arguments.length>1?pH(arguments[1]):{})}}),vG(LG)){var fH=function(e){return _G(this,VG),new LG(e,arguments.length>1?pH(arguments[1]):{})};VG.constructor=fH,fH.prototype=VG,nG({global:!0,forced:!0},{Request:fH})}}var _H,vH={URLSearchParams:uH,getState:kG},mH=Yi,SH=s,EH=Fj,yH=n,gH=Yo,bH=I,TH=tn.f,IH=Wt.exports,RH=lc,AH=xe,CH=Vn,OH=KD,NH=Ro,wH=Ep.codeAt,DH=function(e){var t,r,i=[],n=Qj($j(eG(e),Hj,"."),".");for(t=0;t<n.length;t++)r=n[t],Zj(i,Yj(Gj,r)?"xn--"+iG(r):r);return qj(i,".")},PH=fo,kH=Go,MH=lu,UH=vH,LH=Or,xH=LH.set,VH=LH.getterFor("URL"),FH=UH.URLSearchParams,BH=UH.getState,jH=yH.URL,GH=yH.TypeError,HH=yH.parseInt,zH=Math.floor,KH=Math.pow,YH=bH("".charAt),XH=bH(/./.exec),WH=bH([].join),JH=bH(1..toString),qH=bH([].pop),ZH=bH([].push),$H=bH("".replace),QH=bH([].shift),ez=bH("".split),tz=bH("".slice),rz=bH("".toLowerCase),iz=bH([].unshift),nz="Invalid scheme",oz="Invalid host",az="Invalid port",sz=/[a-z]/i,cz=/[\d+-.a-z]/i,uz=/\d/,dz=/^0x/i,lz=/^[0-7]+$/,hz=/^\d+$/,pz=/^[\da-f]+$/i,fz=/[\0\t\n\r #%/:<>?@[\\\]^|]/,_z=/[\0\t\n\r #/:<>?@[\\\]^|]/,vz=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,mz=/[\t\n\r]/g,Sz=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)iz(t,e%256),e=zH(e/256);return WH(t,".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,r=1,i=null,n=0,o=0;o<8;o++)0!==e[o]?(n>r&&(t=i,r=n),i=null,n=0):(null===i&&(i=o),++n);return n>r&&(t=i,r=n),t}(e),r=0;r<8;r++)n&&0===e[r]||(n&&(n=!1),i===r?(t+=r?":":"::",n=!0):(t+=JH(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},Ez={},yz=CH({},Ez,{" ":1,'"':1,"<":1,">":1,"`":1}),gz=CH({},yz,{"#":1,"?":1,"{":1,"}":1}),bz=CH({},gz,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Tz=function(e,t){var r=wH(e,0);return r>32&&r<127&&!AH(t,e)?e:encodeURIComponent(e)},Iz={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Rz=function(e,t){var r;return 2==e.length&&XH(sz,YH(e,0))&&(":"==(r=YH(e,1))||!t&&"|"==r)},Az=function(e){var t;return e.length>1&&Rz(tz(e,0,2))&&(2==e.length||"/"===(t=YH(e,2))||"\\"===t||"?"===t||"#"===t)},Cz=function(e){return"."===e||"%2e"===rz(e)},Oz={},Nz={},wz={},Dz={},Pz={},kz={},Mz={},Uz={},Lz={},xz={},Vz={},Fz={},Bz={},jz={},Gz={},Hz={},zz={},Kz={},Yz={},Xz={},Wz={},Jz=function(e,t,r){var i,n,o,a=PH(e);if(t){if(n=this.parse(a))throw GH(n);this.searchParams=null}else{if(void 0!==r&&(i=new Jz(r,!0)),n=this.parse(a,null,i))throw GH(n);(o=BH(new FH)).bindURL(this),this.searchParams=o}};Jz.prototype={type:"URL",parse:function(e,t,r){var i,n,o,a,s,c=this,u=t||Oz,d=0,l="",h=!1,p=!1,f=!1;for(e=PH(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=$H(e,vz,"")),e=$H(e,mz,""),i=OH(e);d<=i.length;){switch(n=i[d],u){case Oz:if(!n||!XH(sz,n)){if(t)return nz;u=wz;continue}l+=rz(n),u=Nz;break;case Nz:if(n&&(XH(cz,n)||"+"==n||"-"==n||"."==n))l+=rz(n);else{if(":"!=n){if(t)return nz;l="",u=wz,d=0;continue}if(t&&(c.isSpecial()!=AH(Iz,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&Iz[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=jz:c.isSpecial()&&r&&r.scheme==c.scheme?u=Dz:c.isSpecial()?u=Uz:"/"==i[d+1]?(u=Pz,d++):(c.cannotBeABaseURL=!0,ZH(c.path,""),u=Yz)}break;case wz:if(!r||r.cannotBeABaseURL&&"#"!=n)return nz;if(r.cannotBeABaseURL&&"#"==n){c.scheme=r.scheme,c.path=NH(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=Wz;break}u="file"==r.scheme?jz:kz;continue;case Dz:if("/"!=n||"/"!=i[d+1]){u=kz;continue}u=Lz,d++;break;case Pz:if("/"==n){u=xz;break}u=Kz;continue;case kz:if(c.scheme=r.scheme,n==_H)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=NH(r.path),c.query=r.query;else if("/"==n||"\\"==n&&c.isSpecial())u=Mz;else if("?"==n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=NH(r.path),c.query="",u=Xz;else{if("#"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=NH(r.path),c.path.length--,u=Kz;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=NH(r.path),c.query=r.query,c.fragment="",u=Wz}break;case Mz:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=Kz;continue}u=xz}else u=Lz;break;case Uz:if(u=Lz,"/"!=n||"/"!=YH(l,d+1))continue;d++;break;case Lz:if("/"!=n&&"\\"!=n){u=xz;continue}break;case xz:if("@"==n){h&&(l="%40"+l),h=!0,o=OH(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||f){var m=Tz(v,bz);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(n==_H||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=OH(l).length+1,l="",u=Vz}else l+=n;break;case Vz:case Fz:if(t&&"file"==c.scheme){u=Hz;continue}if(":"!=n||p){if(n==_H||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return oz;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=zz,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return oz;if(a=c.parseHost(l))return a;if(l="",u=Bz,t==Fz)return}break;case Bz:if(!XH(uz,n)){if(n==_H||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var S=HH(l,10);if(S>65535)return az;c.port=c.isSpecial()&&S===Iz[c.scheme]?null:S,l=""}if(t)return;u=zz;continue}return az}l+=n;break;case jz:if(c.scheme="file","/"==n||"\\"==n)u=Gz;else{if(!r||"file"!=r.scheme){u=Kz;continue}if(n==_H)c.host=r.host,c.path=NH(r.path),c.query=r.query;else if("?"==n)c.host=r.host,c.path=NH(r.path),c.query="",u=Xz;else{if("#"!=n){Az(WH(NH(i,d),""))||(c.host=r.host,c.path=NH(r.path),c.shortenPath()),u=Kz;continue}c.host=r.host,c.path=NH(r.path),c.query=r.query,c.fragment="",u=Wz}}break;case Gz:if("/"==n||"\\"==n){u=Hz;break}r&&"file"==r.scheme&&!Az(WH(NH(i,d),""))&&(Rz(r.path[0],!0)?ZH(c.path,r.path[0]):c.host=r.host),u=Kz;continue;case Hz:if(n==_H||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&Rz(l))u=Kz;else if(""==l){if(c.host="",t)return;u=zz}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=zz}continue}l+=n;break;case zz:if(c.isSpecial()){if(u=Kz,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=_H&&(u=Kz,"/"!=n))continue}else c.fragment="",u=Wz;else c.query="",u=Xz;break;case Kz:if(n==_H||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=rz(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||ZH(c.path,"")):Cz(l)?"/"==n||"\\"==n&&c.isSpecial()||ZH(c.path,""):("file"==c.scheme&&!c.path.length&&Rz(l)&&(c.host&&(c.host=""),l=YH(l,0)+":"),ZH(c.path,l)),l="","file"==c.scheme&&(n==_H||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)QH(c.path);"?"==n?(c.query="",u=Xz):"#"==n&&(c.fragment="",u=Wz)}else l+=Tz(n,gz);break;case Yz:"?"==n?(c.query="",u=Xz):"#"==n?(c.fragment="",u=Wz):n!=_H&&(c.path[0]+=Tz(n,Ez));break;case Xz:t||"#"!=n?n!=_H&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":Tz(n,Ez)):(c.fragment="",u=Wz);break;case Wz:n!=_H&&(c.fragment+=Tz(n,yz))}d++}},parseHost:function(e){var t,r,i;if("["==YH(e,0)){if("]"!=YH(e,e.length-1))return oz;if(t=function(e){var t,r,i,n,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return YH(e,l)};if(":"==h()){if(":"!=YH(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&XH(pz,h());)t=16*t+HH(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(i=0;h();){if(n=null,i>0){if(!("."==h()&&i<4))return;l++}if(!XH(uz,h()))return;for(;XH(uz,h());){if(o=HH(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!=++i&&4!=i||u++}if(4!=i)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}(tz(e,1,-1)),!t)return oz;this.host=t}else if(this.isSpecial()){if(e=DH(e),XH(fz,e))return oz;if(t=function(e){var t,r,i,n,o,a,s,c=ez(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],i=0;i<t;i++){if(""==(n=c[i]))return e;if(o=10,n.length>1&&"0"==YH(n,0)&&(o=XH(dz,n)?16:8,n=tz(n,8==o?1:2)),""===n)a=0;else{if(!XH(10==o?hz:8==o?lz:pz,n))return e;a=HH(n,o)}ZH(r,a)}for(i=0;i<t;i++)if(a=r[i],i==t-1){if(a>=KH(256,5-t))return null}else if(a>255)return null;for(s=qH(r),i=0;i<r.length;i++)s+=r[i]*KH(256,3-i);return s}(e),null===t)return oz;this.host=t}else{if(XH(_z,e))return oz;for(t="",r=OH(e),i=0;i<r.length;i++)t+=Tz(r[i],Ez);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return AH(Iz,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&Rz(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,i=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+=r+(i?":"+i:"")+"@"),u+=Sz(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+WH(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw GH(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new qz(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+Sz(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(PH(e)+":",Oz)},getUsername:function(){return this.username},setUsername:function(e){var t=OH(PH(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=Tz(t[r],bz)}},getPassword:function(){return this.password},setPassword:function(e){var t=OH(PH(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=Tz(t[r],bz)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?Sz(e):Sz(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,Vz)},getHostname:function(){var e=this.host;return null===e?"":Sz(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Fz)},getPort:function(){var e=this.port;return null===e?"":PH(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=PH(e))?this.port=null:this.parse(e,Bz))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+WH(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,zz))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=PH(e))?this.query=null:("?"==YH(e,0)&&(e=tz(e,1)),this.query="",this.parse(e,Xz)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=PH(e))?("#"==YH(e,0)&&(e=tz(e,1)),this.fragment="",this.parse(e,Wz)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var qz=function(e){var t=RH(this,Zz),r=MH(arguments.length,1)>1?arguments[1]:void 0,i=xH(t,new Jz(e,!1,r));SH||(t.href=i.serialize(),t.origin=i.getOrigin(),t.protocol=i.getProtocol(),t.username=i.getUsername(),t.password=i.getPassword(),t.host=i.getHost(),t.hostname=i.getHostname(),t.port=i.getPort(),t.pathname=i.getPathname(),t.search=i.getSearch(),t.searchParams=i.getSearchParams(),t.hash=i.getHash())},Zz=qz.prototype,$z=function(e,t){return{get:function(){return VH(this)[e]()},set:t&&function(e){return VH(this)[t](e)},configurable:!0,enumerable:!0}};if(SH&&TH(Zz,{href:$z("serialize","setHref"),origin:$z("getOrigin"),protocol:$z("getProtocol","setProtocol"),username:$z("getUsername","setUsername"),password:$z("getPassword","setPassword"),host:$z("getHost","setHost"),hostname:$z("getHostname","setHostname"),port:$z("getPort","setPort"),pathname:$z("getPathname","setPathname"),search:$z("getSearch","setSearch"),searchParams:$z("getSearchParams"),hash:$z("getHash","setHash")}),IH(Zz,"toJSON",(function(){return VH(this).serialize()}),{enumerable:!0}),IH(Zz,"toString",(function(){return VH(this).serialize()}),{enumerable:!0}),jH){var Qz=jH.createObjectURL,eK=jH.revokeObjectURL;Qz&&IH(qz,"createObjectURL",gH(Qz,jH)),eK&&IH(qz,"revokeObjectURL",gH(eK,jH))}kH(qz,"URL"),mH({global:!0,forced:!EH,sham:!SH},{URL:qz});var tK,rK=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],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,r){return Zf(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p,f,_=this;return $f(this,(function(v){switch(v.label){case 0:if(i=r.playCount,jP(n=r.type,"mixingType",Lj(i_)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=mF(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_STOPPED,error:rD.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,3]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw _._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_FAILED,error:rD.AUDIO_MIXING_ERROR_START_FAILED}),new aD(tD.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:d=v.sent(),c=new Audio(URL.createObjectURL(new Blob([d]))),v.label=3;case 3:return c.crossOrigin="anonymous",i<=0?c.loop=!0:i>0&&(l=i,c.onended=function(){--l>0?c.play():_._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_FINISHED,error:rD.AUDIO_MIXING_ERROR_OK})}),[4,c.play()];case 4:if(v.sent(),h=this._sharedAudioContext.createMediaElementSource(c),p=this._sharedAudioContext.createGain(),f=this.volumeConfig.get(e),p.gain.value=f?f/100:1,h.connect(p).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:h,audioNode:c,gainNode:p,type:"file"}),n===i_.PUBLISH)try{p.disconnect(this._sharedAudioContext.destination)}catch(e){}else p.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],r.type),this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_PLAYING,error:rD.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.updateLocalAudioTrack(),this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_STOPPED,error:rD.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_PAUSED,error:rD.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:n_.AUDIO_MIXING_STATE_PLAYING,error:rD.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i=this;return $f(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 i._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_PRELOADED,error:rD.AUDIO_MIXING_ERROR_OK}),t.arrayBuffer();throw i._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_FAILED,error:rD.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new aD(tD.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(e){throw new aD(tD.LOAD_RESOURCES_FAILED,"Load resources failed",e)}))];case 1:return r=n.sent(),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([r])))},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 r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),r=this.mixingMap.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.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 r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){jP(e,"type",Lj(i_));var t=this._context.getLocalAudioTrack();if(t){var r=mF(t.getTrack());if(r&&this.mixMediaStream(r),e===i_.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:n_.AUDIO_MIXING_STATE_PCM_ENABLED,error:rD.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:n_.AUDIO_MIXING_STATE_PCM_DISABLED,error:rD.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0)||(this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode),this._audioBufferSource.start(),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 r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}})},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,r){e.stopAudioMixing(r)}))},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.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()},qf([Ex("default","id","filePath","options")],e.prototype,"startAudioMixing",null),qf([Ex("default","id")],e.prototype,"stopAudioMixing",null),qf([Ex("default","id")],e.prototype,"pauseAudioMixing",null),qf([Ex("default","id")],e.prototype,"resumeAudioMixing",null),qf([Ex("default","id")],e.prototype,"preloadAudioMixing",null),qf([Ex("default","id")],e.prototype,"unloadAudioMixing",null),qf([Ex("default","id")],e.prototype,"getAudioMixingVolume",null),qf([Ex("default","id","volume")],e.prototype,"setAudioMixingVolume",null),qf([Ex("default","id")],e.prototype,"getAudioMixingDuration",null),qf([Ex("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),qf([Ex("default","id","position")],e.prototype,"setAudioMixingPosition",null),qf([Ex("default","type")],e.prototype,"enableAudioMixingBuffer",null),qf([Ex()],e.prototype,"disableAudioMixingBuffer",null),qf([Ex("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(tK||(tK={}));var iK=new tk("RTMClient",1),nK=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r._dataChannelSignal=null,r._handler=null,r._dataChannelSignalState=UF.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 Cf(t,e),t.prototype.login=function(e,t){var r=this;return new Promise((function(i,n){if(iK.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new aD(tD.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new aD(tD.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,vx.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=i,r._loginRejectCallback=n,r._dataChannelSignal?r._login():(iK.print("login","init dataChannelSingling"),r._dataChannelSignalState=UF.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))},t.prototype.logout=function(){var e;return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){if(!this._loginSessionId||!this._userId)throw new aD(tD.NOT_LOGIN,"login first");return null===(e=this._dataChannelSignal)||void 0===e||e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:Tx.C2RTM}).catch((function(){})),this._closeDataChannelSignaling(),this._clearState(),[2]}))}))},t.prototype.updateLoginToken=function(e){return Zf(this,void 0,void 0,(function(){var t=this;return $f(this,(function(r){return this._token=e,[2,new Promise((function(e,r){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=r,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new aD(tD.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:Tx.C2RTM})];case 1:return[2,null==(t=r.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new aD(tD.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})];case 1:return r.sent(),[2]}}))}))},t.prototype.setServerParams=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new aD(tD.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:Tx.C2RTM})];case 1:return r.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new aD(tD.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:cx.BUSINESS_SERVER,msg:e})];case 1:return t.sent(),[2]}}))}))},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=AP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:wP.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:Ak.VERSION,deviceId:Mx.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:Tx.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var r,i,n=t||{},o=n.code,a=n.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=tD.INVALID_PARAMS,i="Invalid userId"):(r=tD.INVALID_TOKEN,i="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=tD.LOGIN_FAILED,i="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new aD(r,a||i))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){return Zf(this,void 0,void 0,(function(){var t,r,i,n,o,a=this;return $f(this,(function(s){switch(s.label){case 0:if(t=new Lx,r=this._iceConfigNode)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,null==t?void 0:t.getAccessNode(this._appId,"",e,Mx.getDeviceId(),"")];case 2:if(!(r=s.sent()))throw new Error;return[3,4];case 3:throw s.sent(),gx("rtm.login.getNodeFailed","",0,!0),new aD(tD.ICE_SERVER_WRONG,"get ICE config failed");case 4:gx("rtm.login.getNodeSuccess",r,0,!0),iK.print("_createDataChannelSignaling()","get node success",r),this._handler=new bV(px),this._handler.once("disconnect",(function(){iK.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),a._onDisconnect()})),s.label=5;case 5:return s.trys.push([5,7,,8]),[4,this._handler.connect(r)];case 6:return i=s.sent(),iK.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=UF.CONNECTED,[3,8];case 7:throw n=s.sent(),this._iceConfigNode=null,this._dataChannelSignalState=UF.DISCONNECTED,new aD(tD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",n);case 8:return o=new Ax(i),iK.print("_createDataChannelSignaling()","send ping"),o.sendPingSignaling(),o.once("close",(function(){iK.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),a._onDisconnect()})),o.on(tx.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(tx.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(tx.USER_DISCONNECTION,(function(){a.emit("onUserDisconnection"),a._clearState()})),o.on(tx.NODE_CHANGE,(function(e){gx("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(a._iceConfigNode=e.nodes[0]),a._loginResolveCallback&&a._loginRejectCallback?a._login():a._reconnect()})),[2,o]}}))}))},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!==UF.CONNECTED)throw new aD(tD.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=UF.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&&(iK.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){iK.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){iK.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}(ZP.exports.EventEmitter),oK=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r.remoteStreams=new Map,r}return Cf(t,e),t.prototype.connect=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new BF,this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new aD(tD.REPEAT_PLAY,"repeat play public media stream");return t=new ZF(e,e,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]}),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return r.sent(),this.remoteStreams.set(e,t),[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 Zf(this,void 0,void 0,(function(){var e,t,r,i,n,o,a,s,c=this;return $f(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(KF.RESUBSCRIBE,{stream:t})}))},t=this;try{for(r=Qf(this.remoteStreams),i=r.next();!i.done;i=r.next())n=e_(i.value,1),o=n[0],e(o)}catch(e){a={error:e}}finally{try{i&&!i.done&&(s=r.return)&&s.call(r)}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,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(ix.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))},t}(ik),aK=new tk("AudioDeviceManager",1),sK=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return Cf(t,e),t.prototype.startAudioPlaybackDeviceTest=function(e,t){return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:if(this._isAudioPlaybackDeviceTesting||this._isAudioDeviceRecordTesting)throw new aD(tD.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,aK.print("startAudioPlaybackDeviceTest()","Invoke"),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._playAudioFile(e,{loop:!0})];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.stopAudioPlaybackDeviceTest(),r;case 4:return this._startEmitAudioPlaybackDeviceTestVolume(t),[2]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){this._isAudioPlaybackDeviceTesting&&(aK.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.startAudioDeviceRecordTest=function(e){return Zf(this,void 0,void 0,(function(){var t=this;return $f(this,(function(r){switch(r.label){case 0:if(this._isAudioDeviceRecordTesting)throw new aD(tD.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,aK.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){aK.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),t._stopAudioCaptureAndRecoder()}),3e4),[4,this._startAudioCaptureAndRecoder(e)];case 1:return r.sent(),delete this._audioCaptureAndRecoderResolve,[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){aK.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(aK.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){aK.print("destroy()","Invoke"),e.prototype.removeAllListeners.call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()},t.prototype._playAudioFile=function(e,t){var r=this;return new Promise((function(i,n){r._audioElement=iB("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,aK.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){aK.print("_playAudioFile()","oncanplay"),i()},r._audioElement.onerror=function(e){var t,i;n(new aD(tD.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(i=null===(t=r._audioElement)||void 0===t?void 0:t.error)||void 0===i?void 0:i.message))))}}))},t.prototype._destroyAudioElement=function(){this._audioElement&&(aK.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&&(aK.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new pF(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&&(aK.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 Zf(this,void 0,void 0,(function(){var t,r,i=this;return $f(this,(function(n){switch(n.label){case 0:return t=this,[4,kF({})];case 1:return t._audioTrack=n.sent(),r=mF(this._audioTrack.getTrack()),aK.print("startAudioDeviceRecordTest()","create microphone track success!"),[2,new Promise((function(t,n){i._mediaRecorder=new MediaRecorder(r),i._mediaRecorder.ondataavailable=function(r){return Zf(i,void 0,void 0,(function(){var i,o,a,s=this;return $f(this,(function(c){switch(c.label){case 0:if(!this._isAudioDeviceRecordTesting)return[3,5];aK.print("startAudioDeviceRecordTest()","get recorded file."),i=new Blob([r.data]),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._playAudioFile(URL.createObjectURL(i),{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]}}))}))},i._mediaRecorder.onerror=function(e){n(new aD(tD.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},i._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}(ZP.exports.EventEmitter),cK=new tk("Engine",0),uK=function(e){function t(t){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._enableSimulcast=!1,r._videoStreamEncodeConfig=[Pk],r._screenStreamEncodeConfig=[kk],r._pauseAllSubscribeState={audio:!1,video:!1},r._audioPropertiesReportTimer=null,r._mirrorType=Hf.MIRROR_TYPE_RENDER,r._audioDeviceManager=new sK,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=i_.PLAYOUT_AND_PUBLISH),Zf(r,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return cK.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(r=this._room)||void 0===r?void 0:r.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(a_.onAudioMixingStateChanged,e)},r._appId=t,r._pubLock=new RV("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new rK({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage}),window.__rtc_engine__=r,window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=r,r._trackSourceType={video:Of.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:Of.VIDEO_SOURCE_TYPE_INTERNAL,audio:Nf.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:Nf.AUDIO_SOURCE_TYPE_INTERNAL},r._rtmClient=new nK(t),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r}return Cf(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,r,i;return Zf(this,void 0,void 0,(function(){var n,o,a,s;return $f(this,(function(c){switch(c.label){case 0:return cK.print("updateToken()","token: %s",e),BP(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(n=null===(r=this._room)||void 0===r?void 0:r._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 aD(tD.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(i=this._room)||void 0===i?void 0:i.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.switchCamera=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n;return $f(this,(function(o){switch(o.label){case 0:return cK.print("switchCamera()","deviceId: %s",e),BP(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((i=this._videoStreamConstraints).deviceId={exact:e},this._videoStreamConstraints=i,[4,PF(i)]);case 1:return n=o.sent(),this._initLocalTrackEvents(n),this._localVideoTrack&&this._localVideoTrack.close(),this._localVideoTrack=n,this._videoPlayer&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(n),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype.switchMicrophone=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n;return $f(this,(function(o){switch(o.label){case 0:return cK.print("switchMicrophone()","deviceId: %s",e),BP(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((i=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=i,[4,kF(i)]);case 1:return n=o.sent(),this._initLocalTrackEvents(n),this._localAudioTrack&&this._localAudioTrack.close(),this._localAudioTrack=n,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){lF.on(a_.onMediaDeviceStateChanged,this._onDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R=this;null===(e=this._room)||void 0===e||e.on(tx.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(tx.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(tx.USER_CONNECTION,this._onUserConnection.bind(this)),null===(i=this._room)||void 0===i||i.on(KF.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(KF.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(tx.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(a=this._room)||void 0===a||a.on(tx.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(s=this._room)||void 0===s||s.on(tx.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(tx.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(u=this._room)||void 0===u||u.on(tx.POST_PROCESSING_MESSAGE,(function(e){"publicStreamCallback"===e.type?R._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&R._onLiveTranscodingResult(e)})),null===(d=this._room)||void 0===d||d.on(ix.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(l=this._room)||void 0===l||l.on(KF.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(h=this._room)||void 0===h||h.on(KF.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(KF.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(KF.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(_=this._room)||void 0===_||_.on(KF.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=R._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&R.safeEmit(a_.onAutoPublishResult,e)})),null===(v=this._room)||void 0===v||v.on(KF.ON_REMOTE_STREAM_STATS,(function(e){R.safeEmit(a_.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(KF.ON_LOCAL_STREAM_STATS,(function(e){R.safeEmit(a_.onLocalStreamStats,e)})),null===(S=this._room)||void 0===S||S.on(KF.ON_USER_MUTE_AUDIO,this._onUserMuteAudio.bind(this)),null===(E=this._room)||void 0===E||E.on(KF.ON_USER_MUTE_VIDEO,this._onUserMuteVideo.bind(this)),null===(y=this._room)||void 0===y||y.on(KF.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(a_.onUserStartAudioCapture,{userId:t})})),null===(g=this._room)||void 0===g||g.on(KF.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(a_.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(KF.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(a_.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(KF.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(a_.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(KF.ON_SEI_MESSAGED_RECEIVED,(function(e){R.safeEmit(a_.onSEIMessageReceived,e)}))},t.prototype.safeEmit=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return qP(t)&&yx(t,MP(r)),e.prototype.safeEmit.apply(this,t_([t],e_(r),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.setConnectionMode=function(e){jP(e,"mode",[Wf.AUTO,Wf.FORCE_TCP,Wf.FORCE_UDP]),Ck("CONNECTION_MODE",e)},t.prototype.joinRoom=function(e,t,r,i){return void 0===i&&(i={isAutoPublish:!1,isAutoSubscribeAudio:!1,isAutoSubscribeVideo:!1}),Zf(this,void 0,void 0,(function(){var n,o;return $f(this,(function(a){switch(a.label){case 0:if(cK.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,r,i),KP(e)||BP(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new aD(tD.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){GP(e,"userInfo"),YP(e.userId),KP(e.extraInfo)||BP(e.extraInfo,"userInfo.extraInfo",1,200)}(r),function(e){GP(e,"roomConfig"),VP(e.isAutoPublish,"roomConfig.isAutoPublish"),VP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),VP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(i),!this._room||this._room.connectionState===UF.DISCONNECTED)return[3,1];throw new aD(tD.REPEAT_JOIN,"Already joined");case 1:this._room=new rB(i),this._addHandlerEventHandler(),n=this._liveTranscodeConfig&&Nk("started",this._liveTranscodeConfig),a.label=2;case 2:return a.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,Jf(Jf({},r),{businessId:this._businessId,role:this._visibility?tK.NORMAL_USER:tK.SILENT_USER}),n,this._useCloudProxy)];case 3:return a.sent(),this._roomConfig=i,this._tempRoomConfig&&delete this._tempRoomConfig,[3,5];case 4:throw(o=a.sent()).code===tD.INVALID_TOKEN&&(this._tempRoomConfig=i),o;case 5:(this._localAudioTrack||this._localVideoTrack)&&i.isAutoPublish&&(this._visibility?this._updatePublish(!0):this.safeEmit(a_.onAutoPublishResult,{isScreen:!1,state:Uf.PUBLISH_FAIL})),a.label=6;case 6:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,r;return void 0===e&&(e=!1),Zf(this,void 0,void 0,(function(){return $f(this,(function(i){switch(i.label){case 0:return cK.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return i.sent(),[3,3];case 2:null===(r=this._room)||void 0===r||r.leave(e).catch(),i.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._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,r,i;cK.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(),null===(r=this._audioPlayer)||void 0===r||r.destroy(),this._videoPlayer=void 0,this._audioPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[Pk],this._screenStreamEncodeConfig=[kk],this._pauseAllSubscribeState={audio:!1,video:!1},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._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()},t.prototype.publish=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:if(cK.print("publish()"),!this._room||this._room.connectionState!==UF.CONNECTED)throw new aD(tD.PUBLISH_BEFORE_JOIN,"join first");return!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=DF(this._localImgVideoTrack),this._localVideoTrack.dummy=!0),[4,this._updatePublish()];case 1:return e.sent(),[2]}}))}))},t.prototype.unpublish=function(){var e,t;return Zf(this,void 0,void 0,(function(){var r,i;return $f(this,(function(n){switch(n.label){case 0:if(cK.print("unpublish()"),!this._room)throw new aD(tD.UNPUBLISH_BEFORE_JOIN,"join first");return null===(t=null===(e=this._room.localStream)||void 0===e?void 0:e.observer)||void 0===t||t.setPublish(!1),[4,this._pubLock.lock()];case 1:r=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.unpublish()];case 3:return n.sent(),[3,6];case 4:throw(i=n.sent())instanceof aD?i:new aD(tD.UNEXPECTED_ERROR,"unexpected error",i);case 5:return r(),[7];case 6:return[2]}}))}))},t.prototype.subscribeUserStream=function(e,t,r,i){var n,o,a,s,c,u;return void 0===r&&(r=Ff.STREAM_INDEX_MAIN),void 0===i&&(i={videoIndex:0}),Zf(this,void 0,void 0,(function(){var d,l,h,p,f,_,v;return $f(this,(function(m){switch(m.label){case 0:if(cK.print("subscribeStream()","userId: %o, mediaType: %o, streamType: %o, configure: %o",e,t,r,i),YP(e),jP(t,"mediaType",[Bf.AUDIO_AND_VIDEO,Bf.AUDIO_ONLY,Bf.VIDEO_ONLY,Bf.NONE]),jP(r,"streamType",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),FP(i.videoIndex,"config.videoIndex",0,2),!this._room||this._room.connectionState!==UF.CONNECTED)throw new aD(tD.SUBSCRIBE_BEFORE_JOIN,"join first");if(d=this._room.remoteStreams.get(e),h=r===Ff.STREAM_INDEX_SCREEN,!(l=h?null==d?void 0:d.find((function(e){return e.isScreen})):null==d?void 0:d.find((function(e){return!e.isScreen}))))throw new aD(tD.STREAM_NOT_EXIST,"stream not exist");m.label=1;case 1:return m.trys.push([1,3,,4]),p=t,this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?t=Bf.NONE:this._pauseAllSubscribeState.audio&&!this._pauseAllSubscribeState.video?t===Bf.AUDIO_AND_VIDEO?t=Bf.VIDEO_ONLY:t===Bf.AUDIO_ONLY&&(t=Bf.NONE):!this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video&&(t===Bf.AUDIO_AND_VIDEO?t=Bf.AUDIO_ONLY:t===Bf.VIDEO_ONLY&&(t=Bf.NONE)),t!==p&&cK.print("subscribeUserStream","due to pauseAllState change sub mediaType from ".concat(p," to ").concat(t)),f=l.hasSubscribed,[4,this._room.subscribe(l,t,i)];case 2:return m.sent(),t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.AUDIO_ONLY||this._updateAudioPlayerState(l),t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.VIDEO_ONLY||this._updateVideoPlayerState(l),((null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)||(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo))&&(l.audioTrack||l.videoTrack)&&(v={userId:e,isScreen:h,state:Mf.SUBSCRIBE_SUCC},this.safeEmit(a_.onAutoSubscribeResult,v)),f||t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.VIDEO_ONLY||null===(a=l.observer)||void 0===a||a.setSubscribeVideo(!0),f||t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.AUDIO_ONLY||null===(s=l.observer)||void 0===s||s.setSubscribeAudio(!0),[3,4];case 3:throw _=m.sent(),((null===(c=this._roomConfig)||void 0===c?void 0:c.isAutoSubscribeAudio)||(null===(u=this._roomConfig)||void 0===u?void 0:u.isAutoSubscribeVideo))&&(v={userId:e,isScreen:h,state:Mf.SUBSCRIBE_FAIL},this.safeEmit(a_.onAutoSubscribeResult,v)),_;case 4:return[2]}}))}))},t.prototype.unSubscribe=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i;return $f(this,(function(n){switch(n.label){case 0:if(cK.print("unSubscribe()","userId: %s, isScreen: %o",e,t),YP(e),VP(t,"isScreen"),!this._room||this._room.connectionState!==UF.CONNECTED)throw new aD(tD.SUBSCRIBE_BEFORE_JOIN,"join first");if(r=this._room.remoteStreams.get(e),!(i=t?null==r?void 0:r.find((function(e){return e.isScreen})):null==r?void 0:r.find((function(e){return!e.isScreen}))))throw new aD(tD.STREAM_NOT_EXIST,"stream not exist");return[4,this._room.unsubscribe(i)];case 1:return n.sent(),this._updateAudioPlayerState(i),this._updateVideoPlayerState(i),[2]}}))}))},t.prototype.startVideoCapture=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n,o,a,s;return $f(this,(function(c){switch(c.label){case 0:if(cK.print("startVideoCapture()","deviceId: %s",e),KP(e)||BP(e,"deviceId"),this._localVideoTrack&&!this._localVideoTrack.dummy)throw new aD(tD.REPEAT_CAPTURE,"Has already capture");return i=this._videoStreamConstraints,e&&(i.deviceId={exact:e},this._videoStreamConstraints=i),[4,PF(i)];case 1:return n=c.sent(),this._initLocalTrackEvents(n),this._localVideoTrack=n,this._videoPlayer&&this._videoPlayer.playVideo(n),o={},(a=null==n?void 0:n.getTrack())&&(o=a.getSettings()),this._room?(s=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||s)&&(this._visibility?this._updatePublish():this.safeEmit(a_.onAutoPublishResult,{isScreen:!1,state:Uf.PUBLISH_FAIL})),null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableVideo(!0),[2,o]):[2,o]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,r,i,n;return Zf(this,void 0,void 0,(function(){return $f(this,(function(o){switch(o.label){case 0:if(cK.print("stopVideoCapture()"),this._trackSourceType.video===Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.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===(r=this._localVideoTrack)||void 0===r||r.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===(i=this._room.localStream)||void 0===i?void 0:i.observer)||void 0===n||n.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n,o;return $f(this,(function(a){switch(a.label){case 0:if(cK.print("startAudioCapture()","deviceId: $o",e),KP(e)||BP(e,"deviceId"),this._localAudioTrack)throw new aD(tD.REPEAT_CAPTURE,"Has already capture");return i=this._audioStreamConstraints,e&&(i.deviceId={exact:e},this._audioStreamConstraints=i),[4,kF(i)];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(a_.onAutoPublishResult,{isScreen:!1,state:Uf.PUBLISH_FAIL})),null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.stopAudioCapture=function(){var e,t,r;return Zf(this,void 0,void 0,(function(){return $f(this,(function(i){switch(i.label){case 0:if(cK.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:i.sent(),i.label=2;case 2:return null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return cK.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,r,i,n;return void 0===e&&(e={}),Zf(this,void 0,void 0,(function(){var o,a,s,c;return $f(this,(function(u){switch(u.label){case 0:if(cK.print("startScreenCapture()","config: %o",e),(null===(t=this._localScreenVideoTrack)||void 0===t?void 0:t.dummy)||null===(r=this._localScreenVideoTrack)||void 0===r||r.close(),this._localScreenVideoTrack=void 0,o=e.enableAudio,a=void 0!==o&&o,this._trackSourceType.screenVideo===Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,MF(a)];case 1:return s=u.sent(),this._localScreenVideoTrack=new CF(s.getVideoTracks()[0],AP()),(c=s.getAudioTracks()).length&&(this._localScreenAudioTrack=new OF(c[0],AP()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(i=this._screenPlayer)||void 0===i||i.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),(null===(n=this._room)||void 0===n?void 0:n.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,3];case 2:u.sent(),u.label=3;case 3:return[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,r,i;return Zf(this,void 0,void 0,(function(){return $f(this,(function(n){switch(n.label){case 0:return cK.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,(null===(r=this._room)||void 0===r?void 0:r.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,2]):[3,3];case 1:n.sent(),n.label=2;case 2:return[3,4];case 3:this._localScreenVideoTrack=void 0,n.label=4;case 4:return null===(i=this._localScreenAudioTrack)||void 0===i||i.close(),this._localScreenAudioTrack=void 0,[2]}}))}))},t.prototype.publishScreen=function(){return Zf(this,void 0,void 0,(function(){var e;return $f(this,(function(t){switch(t.label){case 0:if(cK.print("publishScreen()"),!this._room||this._room.connectionState!==UF.CONNECTED)throw new aD(tD.PUBLISH_BEFORE_JOIN,"join first");if(!this._visibility)throw new aD(tD.NO_PUBLISH_PERMISSION,"no publish permission");t.label=1;case 1:return t.trys.push([1,3,,4]),!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=DF(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof aD?e:new aD(tD.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e,t;return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:if(cK.print("unpublishScreen()"),!this._room)throw new aD(tD.UNPUBLISH_BEFORE_JOIN,"join first");null===(t=null===(e=this._room.localScreenStream)||void 0===e?void 0:e.observer)||void 0===t||t.setPublish(!1),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._room.unpublishScreen()];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof aD?r:new aD(tD.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var r,i;if(cK.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),jP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),t&&t.renderDom)return WP(t),e==Ff.STREAM_INDEX_MAIN?(this._videoPlayer=new dB(t),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement):(this._screenPlayer=new dB(Jf(Jf({},t),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement);e==Ff.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(i=this._screenPlayer)||void 0===i||i.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:cK.print("startLiveTranscoding()","transcode: %o",e),BP(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(Nk("started",this._liveTranscodeConfig))];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof aD?r:new aD(tD.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:if(cK.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=Mj(this._liveTranscodeConfig,e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(Nk("layoutChanged",this._liveTranscodeConfig))];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof aD?r:new aD(tD.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:if(cK.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,null===(e=this._room)||void 0===e?void 0:e.liveControlMessage({action:"stopped",type:"transcode"})];case 2:return r.sent(),[3,4];case 3:throw(t=r.sent())instanceof aD?t:new aD(tD.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return cK.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(_x.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t;return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:if(cK.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==UF.CONNECTED)throw new aD(tD.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?tK.NORMAL_USER:tK.SILENT_USER})];case 3:return r.sent(),this._visibility=e,[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var r=this;void 0===t&&(t=!1),e.on("playback_event",(function(i){var n,o,a,s;switch(null===(o=null===(n=r._room)||void 0===n?void 0:n.remoteStreams.get(i.userId))||void 0===o||o.find((function(e){return!e.isScreen})),i.eventName){case"timeupdate":return;case"loadeddata":if("audio"===i.type)t?r.safeEmit(a_.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):r.safeEmit(a_.onAudioFirstFrameDecoded,{userId:e.userId}),hx.firstRemoteAudioRender("",i.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,r.safeEmit(a_.onFirstPublicStreamVideoFrameDecoded,c),r.safeEmit(a_.onFirstPublicStreamVideoFrameRendered,c)):(r.safeEmit(a_.onVideoFirstFrameDecoded,c),r.safeEmit(a_.onVideoFirstFrameRendered,c)),hx.firstRemoteVideoRender("",i.userId)}break;case"autoplay-error":return t&&(i.publicStreamId=i.userId),void r.safeEmit(a_.onAutoplayFailed,i)}r.safeEmit(a_.onPlayerEvent,i)}))},t.prototype._initLocalTrackEvents=function(e){var t=this;e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(a_.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var r,i,n,o,a,s;cK.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),jP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),WP(t);var c=t.userId;if(t.renderDom){if(e==Ff.STREAM_INDEX_MAIN){null===(r=this._remoteVideoPlayer.get(c))||void 0===r||r.destroy();var u=new dB(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(n=null===(i=this._room)||void 0===i?void 0:i.remoteStreams.get(c))||void 0===n?void 0:n.find((function(e){return!e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy();var d;u=new dB(Jf(Jf({},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),u.domElement}this._getRemotePlayer(c,e===Ff.STREAM_INDEX_SCREEN).forEach((function(e){return null==e?void 0:e.destroy()}))},t.prototype.setLocalVideoMirrorType=function(e){cK.print("setLocalVideoMirrorType()","mirrorType: %o",e),jP(e,"mirrorType",[Hf.MIRROR_TYPE_NONE,Hf.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){var t;return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return cK.print("setAudioPlaybackDevice()","deviceId: %s",e),BP(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(cK.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,lF.getDeviceById(e)];case 1:if(!(r=i.sent()))throw new aD(tD.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),null===(t=this._audioPlayer)||void 0===t||t.setPlaybackDevice(e),this._audioPlaybackDeviceId=e,r&&this.safeEmit(a_.onAudioPlaybackDeviceChanged,r),hx.rtcAudioDevice(PL.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){return Zf(this,void 0,void 0,(function(){var t,r;return $f(this,(function(i){if(cK.print("play()","userId | publicStreamId: %s",e),YP(e),t=this._remoteAudioPlayer.get(e),r=this._remoteVideoPlayer.get(e),t||(t=this._publicStreamAudioPlayer.get(e)),r||(r=this._publicStreamVideoPlayer.get(e)),t||(t=this._audioPlayer),r||(r=this._videoPlayer),!t&&!r)throw new aD(tD.INVALID_PARAMS,"Player not found");return t&&t.manuallyPlay(),r&&r.manuallyPlay(),[2]}))}))},t.prototype.muteLocalAudio=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){if(cK.print("muteLocalAudio()","muteState: %o",e),jP(e,"muteState",[kf.MUTE_STATE_OFF,kf.MUTE_STATE_ON]),!this._room)throw new aD(tD.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("audio",e)]}))}))},t.prototype.muteLocalVideo=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){if(cK.print("muteLocalVideo()","muteState: %o",e),jP(e,"muteState",[kf.MUTE_STATE_OFF,kf.MUTE_STATE_ON]),!this._room)throw new aD(tD.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("video",e)]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Zf(this,void 0,void 0,(function(){var t,r=this;return $f(this,(function(i){return cK.print("pauseAllSubscribedStream()","mediaType: %o",e),jP(e,"mediaType",[xf.RTC_PAUSE_RESUME_CONTROL_AUDIO,xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,xf.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){e===xf.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!0:e===xf.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!0:e===xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!0,r._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()]))}))}))},t.prototype.resumeAllSubscribedStream=function(e){return Zf(this,void 0,void 0,(function(){var t,r=this;return $f(this,(function(i){return cK.print("resumeAllSubscribedStream()","mediaType: %o",e),jP(e,"mediaType",[xf.RTC_PAUSE_RESUME_CONTROL_AUDIO,xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,xf.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){e===xf.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!1:e===xf.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!1:e===xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!1,r._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,i;t(),null===(i=null===(e=r._room)||void 0===e?void 0:e.remoteStreams)||void 0===i||i.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r._updateAudioPlayerState(e),r._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])):[2,Promise.resolve()]}))}))},t.prototype.sendUserMessage=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){if(YP(e),JP(t),!this._room||this._room.connectionState!==UF.CONNECTED)throw new aD(tD.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){if(YP(e),HP(t,"message"),JP(t),!this._room||this._room.connectionState!==UF.CONNECTED)throw new aD(tD.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendRoomMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){if(JP(e),!this._room||this._room.connectionState!==UF.CONNECTED)throw new aD(tD.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e)]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){if(JP(e),!this._room||this._room.connectionState!==UF.CONNECTED)throw new aD(tD.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e,!0)]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return cK.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,zP(e),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,r&&(this._audioStreamConstraints.deviceId=r),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return cK.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,zP(e),r=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=e,r&&(this._videoStreamConstraints.deviceId=r),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.prototype.enableSimulcastMode=function(e){return cK.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return cK.print("setVideoEncoderConfig()","streamIndex: %o, descriptions: %o",e,t),Array.isArray(t)||(t=[t]),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),e===Ff.STREAM_INDEX_MAIN?this._videoStreamEncodeConfig=t:this._screenStreamEncodeConfig=t,[2]}))}))},t.prototype.sendSEIMessage=function(e,t,r){var i,n,o,a,s,c;cK.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),jP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),FP(r,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(wP.str2ab(t)):t;if(t.length){var d;if(e===Ff.STREAM_INDEX_MAIN){if(!(null===(n=null===(i=this._room)||void 0===i?void 0:i.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)cK.print("sei size must not bigger than 4KB");else{var l=AP();d.seiList.push({content:u,uuid:l,repeatCount:r}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else cK.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;cK.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,i,n,o;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var i;if(0!==e.length){var n=e.find((function(e){return!1===e.isScreen})),o=null===(i=null==n?void 0:n.audioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:t,volume:o||0})}}));var a=null===(i=t._localAudioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:(null===(o=null===(n=t._room)||void 0===n?void 0:n.roomInfo)||void 0===o?void 0:o.userInfo.userId)||"local_user",volume:a||0}),t.safeEmit(a_.onAudioVolumeIndication,{speakers:r})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t=this;void 0===e&&(e={}),cK.print("enableAudioPropertiesReport()","config %o: ",e);var r=e.interval,i=void 0===r?100:r,n=e.enableInBackground,o=void 0===n||n;this._stopAudioPropertiesReport(),i<=0||(i=Math.max(100,i),this._audioPropertiesReportTimer=self.setInterval((function(){if(o||"hidden"!==document.visibilityState){var e=[],r=t._audioDeviceManager.getRecordTrack()||t._localAudioTrack;if(r){var i=r.getAudioLevel();e.push({streamIndex:Ff.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:xP(i)}})}if(t._localScreenAudioTrack){i=t._localScreenAudioTrack.getAudioLevel();e.push({streamIndex:Ff.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:xP(i)}})}if(t.safeEmit(a_.onLocalAudioPropertiesReport,e),t._room){var n=[];t._room.remoteStreams.forEach((function(e,r){e.forEach((function(e){var i,o;if(e.audioTrack){var a=e.audioTrack.getAudioLevel();n.push({streamKey:{userId:r,streamIndex:e.isScreen?Ff.STREAM_INDEX_SCREEN:Ff.STREAM_INDEX_MAIN,roomId:null===(o=null===(i=t._room)||void 0===i?void 0:i.roomInfo)||void 0===o?void 0:o.roomId},audioPropertiesInfo:{linearVolume:a,nonlinearVolume:xP(a)}})}}))})),t.safeEmit(a_.onRemoteAudioPropertiesReport,n)}}}),i))},t.prototype.setVideoSourceType=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S;return Zf(this,void 0,void 0,(function(){var E,y,g;return $f(this,(function(b){switch(b.label){case 0:return cK.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),jP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),jP(t,"VideoSourceType",[Of.VIDEO_SOURCE_TYPE_EXTERNAL,Of.VIDEO_SOURCE_TYPE_INTERNAL]),E=e===Ff.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[E]===t?[3,4]:(this._trackSourceType[E]=t,cK.print("setVideoSourceType","set ".concat(E," source type to ").concat(t)),this._localVideoTrack&&e===Ff.STREAM_INDEX_MAIN?(g=!1,t===Of.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localVideoTrack.close()),null===(r=this._videoPlayer)||void 0===r||r.stop(),this._localVideoTrack=void 0,y=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,g?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)||y?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===Ff.STREAM_INDEX_SCREEN?(g=!1,t===Of.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,g?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===(S=this._room)||void 0===S?void 0:S.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 r,i,n,o,a,s,c,u;return Zf(this,void 0,void 0,(function(){var d;return $f(this,(function(l){switch(l.label){case 0:if(cK.print("setExternalVideoTrack()","index: %o, track: %o",e,t),jP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),e!==Ff.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new NF(t,AP()),this._initLocalTrackEvents(this._localVideoTrack),null===(r=this._videoPlayer)||void 0===r||r.playVideo(this._localVideoTrack),d=null===(i=this._room)||void 0===i?void 0:i._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!==Ff.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new NF(t,AP()),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 r,i,n,o,a,s,c,u,d,l,h,p,f,_,v;return Zf(this,void 0,void 0,(function(){var m,S,E;return $f(this,(function(y){switch(y.label){case 0:return cK.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),jP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),jP(t,"audioSourceType",[Nf.AUDIO_SOURCE_TYPE_EXTERNAL,Nf.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===Ff.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,cK.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===Ff.STREAM_INDEX_MAIN?(E=!1,this._trackSourceType.audio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,S=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,E?null===(o=null===(n=null===(i=this._room)||void 0===i?void 0:i.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)||S?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:y.sent(),y.label=2;case 2:return this._localScreenAudioTrack&&e===Ff.STREAM_INDEX_SCREEN?(E=!1,this._trackSourceType.audio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,E?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:y.sent(),y.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var r,i,n,o,a,s,c,u,d;return Zf(this,void 0,void 0,(function(){var l;return $f(this,(function(h){switch(h.label){case 0:if(cK.print("setExternalAudioTrack()","index: %o, track: %o",e,t),jP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),e!==Ff.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new wF(t,AP()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,null===(o=null===(n=null===(i=this._room)||void 0===i?void 0:i.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!==Ff.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new wF(t,AP()),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 Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return cK.print("login()","token: %o, userInfo: %o",e,t),KP(e)||BP(e,"token"),YP(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){return cK.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return cK.print("updateLoginToken()","token: %o",e),KP(e)||BP(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return cK.print("getPeerOnlineStatus()","userId: %o",e),YP(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return YP(e),JP(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return YP(e),HP(t,"message"),JP(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.setServerParams=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return cK.print("setServerParams()","signature: %o, url: %0",e,t),BP(e,"signature"),BP(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return BP(e,"message"),JP(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.sendServerBinaryMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return HP(e,"message"),JP(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new aD(tD.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;cK.print("startCloudProxy()",e),BP(e.logProxy,"logProxy"),BP(e.accessProxy,"accessProxy"),BP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=Ok("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=Ok("LOG_SERVER_URL"),this._originConfigServerUrls=Ok("CONFIG_REQUEST_DOMAINS"),Ck("ICE_CONFIG_REQUEST_URLS",e.accessProxy),Ck("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),Ck("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new aD(tD.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");cK.print("stopCloudProxy()"),Ck("ICE_CONFIG_REQUEST_URLS",[]),Ck("LOG_SERVER_URL",this._originLogServerUrl),Ck("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i=this;return $f(this,(function(n){if(cK.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),XP(e),!this._room||this._room.connectionState!==UF.CONNECTED)throw new aD(tD.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new aD(tD.REPEAT_PUSH,"repeat push public media stream");return r=wk(e,"started",t),[2,this._room.publicStreamControlMessage(r).then((function(){i._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){if(cK.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),XP(e),!this._room||this._room.connectionState!==UF.CONNECTED)throw new aD(tD.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return r=wk(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(r)]}))}))},t.prototype.stopPushPublicStream=function(e){return Zf(this,void 0,void 0,(function(){var t=this;return $f(this,(function(r){if(cK.print("startPushPublicStream()","publicStreamId: %o",e),XP(e),!this._room||this._room.connectionState!==UF.CONNECTED)throw new aD(tD.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;return Zf(this,void 0,void 0,(function(){var r,i,n,o=this;return $f(this,(function(a){switch(a.label){case 0:return XP(e),this._outsideRoom?[3,2]:(this._outsideRoom=new oK(this._appId),this._outsideRoom.on(KF.RESUBSCRIBE,(function(e){var t,r,i=e.stream;if(i){var n=o._publicStreamAudioPlayer.get(i.streamId);n&&i.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var a=o._publicStreamVideoPlayer.get(i.streamId);a&&i.videoTrack&&a.playVideo(null===(r=e.stream)||void 0===r?void 0:r.videoTrack)}})),null===(t=this._outsideRoom)||void 0===t||t.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,o.safeEmit(a_.onPublicStreamStats,e)})),[4,this._outsideRoom.connect()]);case 1:a.sent(),a.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return r=a.sent(),(i=this._publicStreamVideoPlayer.get(e))&&(null==r?void 0:r.videoTrack)&&i.playVideo(r.videoTrack,r),!(n=this._publicStreamAudioPlayer.get(e))&&(null==r?void 0:r.audioTrack)&&(n=new lB(e),this._initPlayerEvents(n,!0),n.playAudio(r.audioTrack),this._publicStreamAudioPlayer.set(e,n)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.destroy(),this._publicStreamAudioPlayer.delete(e)),[2]):[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var r,i;cK.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var n=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&n)return n.destroy(),void this._publicStreamVideoPlayer.delete(e);if(!n){n=new dB(Jf(Jf({},t),{userId:e})),this._initPlayerEvents(n,!0),this._publicStreamVideoPlayer.set(e,n);var o=null===(i=null===(r=this._outsideRoom)||void 0===r?void 0:r.remoteStreams)||void 0===i?void 0:i.get(e);(null==o?void 0:o.videoTrack)&&n.playVideo(o.videoTrack,o)}},t.prototype.setDummyCaptureImagePath=function(e,t){return Zf(this,void 0,void 0,(function(){var r=this;return $f(this,(function(i){return[2,new Promise((function(i,n){BP(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 aD(tD.UNEXPECTED_ERROR,"Not support canvas"));t.width=o.width,t.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(r._dummyTimer),r._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=t.captureStream(5).getVideoTracks()[0];e===Ff.STREAM_INDEX_MAIN?r._localImgVideoTrack=s:r._localImgScreenTrack=s,i()}catch(e){n(new aD(tD.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new aD(tD.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(Dk))},t.prototype._updatePublish=function(e){return void 0===e&&(e=!1),Zf(this,void 0,void 0,(function(){var t,r;return $f(this,(function(i){switch(i.label){case 0:if(cK.print("_updatePublish()"),!this._visibility)throw new aD(tD.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(t=i.sent(),!this._room||this._room.connectionState!==UF.CONNECTED)return t(),[2];i.label=2;case 2:return i.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,e)];case 3:return i.sent(),[3,6];case 4:throw(r=i.sent())instanceof aD?r:new aD(tD.UNEXPECTED_ERROR,"unexpected error",r);case 5:return t(),[7];case 6:return[2]}}))}))},t.prototype.startAudioPlaybackDeviceTest=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:return cK.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),BP(e,"filePath"),FP(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,r.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){cK.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()},t.prototype.startAudioDeviceRecordTest=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return cK.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),FP(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){cK.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){cK.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype._updateScreenPublish=function(){return Zf(this,void 0,void 0,(function(){var e,t;return $f(this,(function(r){switch(r.label){case 0:return cK.print("_updateScreenPublish()"),[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==UF.CONNECTED)return e(),[2];r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof aD?t:new aD(tD.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){cK.print("_updateAudioPlayerState()");var t,r=e.userId,i=e.isScreen;if(t=i?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack){if(!t){var n=i?"".concat(r,"_screen"):r;t=new lB(n),this._initPlayerEvents(t),this._remoteAudioPlayer.set(n,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}t.playAudio(e.audioTrack)}else null==t||t.stop()},t.prototype._updateVideoPlayerState=function(e){cK.print("_updateVideoPlayerState()");var t,r=e.userId;t=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?t&&t.playVideo(e.videoTrack,e):null==t||t.stop()},t.prototype._onAddStream=function(e){var t,r,i,n,o,a,s,c,u=e.stream,d={userId:u.userId,isScreen:u.isScreen,hasVideo:u.hasVideo,hasAudio:u.hasAudio,videoStreamDescriptions:u.attributes.videoDescriptions};this.safeEmit(a_.onStreamAdd,{stream:d});var l=null;(null===(t=this._roomConfig)||void 0===t?void 0:t.isAutoSubscribeAudio)&&(l=Bf.AUDIO_ONLY),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(l=Bf.VIDEO_ONLY),(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeVideo)&&(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)&&(l=Bf.AUDIO_AND_VIDEO),cK.print("_onAddStream","autoSubType: ".concat(l)),null===l||u.isScreen||(l===Bf.AUDIO_AND_VIDEO?(null===(o=u.observer)||void 0===o||o.setAutoSubscribeVideo(!0),null===(a=u.observer)||void 0===a||a.setAutoSubscribeAudio(!0)):l===Bf.AUDIO_ONLY?null===(s=u.observer)||void 0===s||s.setAutoSubscribeAudio(!0):l===Bf.VIDEO_ONLY&&(null===(c=u.observer)||void 0===c||c.setAutoSubscribeVideo(!0)),this.subscribeUserStream(u.userId,l))},t.prototype._onRemoveStream=function(e){var t,r=e.stream,i={userId:r.userId,isScreen:r.isScreen,hasVideo:r.hasVideo,hasAudio:r.hasAudio,videoStreamDescriptions:[]},n=null!==(t=dK[e.reason])&&void 0!==t?t:jf.STREAM_REMOVE_REASON_OTHER;this.safeEmit(a_.onStreamRemove,{stream:i,reason:n}),this._getRemotePlayer(r.userId,r.isScreen).forEach((function(e){return null==e?void 0:e.destroy()}))},t.prototype._onUserConnection=function(e){this.safeEmit(a_.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(a_.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(a_.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===Gf.CONNECTION_STATE_CONNECTED&&this.safeEmit(a_.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(a_.onConnectionStateChanged,e)},t.prototype._getRemotePlayer=function(e,t){return[this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]},t.prototype._stopAudioPropertiesReport=function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)},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(a_.onVideoFirstFrameDecoded,e)},t.prototype._onDeviceStateChange=function(e){this.safeEmit(a_.onMediaDeviceStateChanged,e)},t.prototype._onUserMuteAudio=function(e){this.safeEmit(a_.onUserMuteAudio,e)},t.prototype._onUserMuteVideo=function(e){this.safeEmit(a_.onUserMuteVideo,e)},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(a_.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(a_.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this.safeEmit(a_.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(a_.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(a_.onLiveTranscodingResult,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(a_.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(a_.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t.safeEmit(a_.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t.safeEmit(a_.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(a_.onError,{errorCode:tD.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(a_.onError,{errorCode:tD.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,r=[];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){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,r=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})}))),r},enumerable:!1,configurable:!0}),t.prototype._handleAudioDeviceManager=function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(a_.onAudioPlaybackDeviceTestVolume,t)}))},qf([Ex()],t.prototype,"updateToken",null),qf([Ex()],t.prototype,"switchCamera",null),qf([Ex()],t.prototype,"switchMicrophone",null),qf([Ex()],t.prototype,"joinRoom",null),qf([Ex()],t.prototype,"leaveRoom",null),qf([Ex()],t.prototype,"destroy",null),qf([Ex()],t.prototype,"publish",null),qf([Ex()],t.prototype,"unpublish",null),qf([Ex()],t.prototype,"subscribeUserStream",null),qf([Ex()],t.prototype,"unSubscribe",null),qf([Ex()],t.prototype,"startVideoCapture",null),qf([Ex()],t.prototype,"stopVideoCapture",null),qf([Ex()],t.prototype,"startAudioCapture",null),qf([Ex()],t.prototype,"stopAudioCapture",null),qf([Ex()],t.prototype,"getAudioMixingManager",null),qf([Ex()],t.prototype,"startScreenCapture",null),qf([Ex()],t.prototype,"stopScreenCapture",null),qf([Ex()],t.prototype,"publishScreen",null),qf([Ex()],t.prototype,"unpublishScreen",null),qf([Ex()],t.prototype,"setLocalVideoPlayer",null),qf([Ex()],t.prototype,"startLiveTranscoding",null),qf([Ex()],t.prototype,"updateLiveTranscoding",null),qf([Ex()],t.prototype,"stopLiveTranscoding",null),qf([Ex()],t.prototype,"setBusinessId",null),qf([Ex()],t.prototype,"setUserVisibility",null),qf([Ex()],t.prototype,"setRemoteVideoPlayer",null),qf([Ex()],t.prototype,"setLocalVideoMirrorType",null),qf([Ex()],t.prototype,"setAudioPlaybackDevice",null),qf([Ex()],t.prototype,"play",null),qf([Ex()],t.prototype,"muteLocalAudio",null),qf([Ex()],t.prototype,"muteLocalVideo",null),qf([Ex()],t.prototype,"pauseAllSubscribedStream",null),qf([Ex()],t.prototype,"resumeAllSubscribedStream",null),qf([Ex()],t.prototype,"sendUserMessage",null),qf([Ex()],t.prototype,"sendUserBinaryMessage",null),qf([Ex()],t.prototype,"sendRoomMessage",null),qf([Ex()],t.prototype,"sendRoomBinaryMessage",null),qf([Ex()],t.prototype,"setAudioCaptureConfig",null),qf([Ex()],t.prototype,"setVideoCaptureConfig",null),qf([Ex()],t.prototype,"enableSimulcastMode",null),qf([Ex()],t.prototype,"setVideoEncoderConfig",null),qf([Ex()],t.prototype,"sendSEIMessage",null),qf([Ex()],t.prototype,"setAudioVolumeIndicationInterval",null),qf([Ex()],t.prototype,"enableAudioPropertiesReport",null),qf([Ex()],t.prototype,"setVideoSourceType",null),qf([Ex()],t.prototype,"setExternalVideoTrack",null),qf([Ex()],t.prototype,"setAudioSourceType",null),qf([Ex()],t.prototype,"setExternalAudioTrack",null),qf([Ex("rtm")],t.prototype,"login",null),qf([Ex("rtm")],t.prototype,"logout",null),qf([Ex("rtm")],t.prototype,"updateLoginToken",null),qf([Ex("rtm")],t.prototype,"getPeerOnlineStatus",null),qf([Ex("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),qf([Ex("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),qf([Ex("rtm")],t.prototype,"setServerParams",null),qf([Ex("rtm")],t.prototype,"sendServerMessage",null),qf([Ex("rtm")],t.prototype,"sendServerBinaryMessage",null),qf([Ex()],t.prototype,"startCloudProxy",null),qf([Ex()],t.prototype,"stopCloudProxy",null),qf([Ex()],t.prototype,"startPushPublicStream",null),qf([Ex()],t.prototype,"updatePublicStreamParam",null),qf([Ex()],t.prototype,"stopPushPublicStream",null),qf([Ex("outsideRoom")],t.prototype,"startPlayPublicStream",null),qf([Ex("outsideRoom")],t.prototype,"stopPlayPublicStream",null),qf([Ex("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),qf([Ex()],t.prototype,"setDummyCaptureImagePath",null),qf([Ex()],t.prototype,"startAudioPlaybackDeviceTest",null),qf([Ex()],t.prototype,"stopAudioPlaybackDeviceTest",null),qf([Ex()],t.prototype,"startAudioDeviceRecordTest",null),qf([Ex()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),qf([Ex()],t.prototype,"stopAudioDevicePlayTest",null),t}(ik),dK={"client unpublished":jf.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":jf.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":jf.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":jf.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":jf.STREAM_REMOVE_REASON_REPUBLISH},lK=new tk("VERTC",0);[_x,vx,mx].forEach((function(e){return e.setStats({rtc_sdk_version:Ak.VERSION,product_line:aL.RTC,report_version:sL.W_5,os:cL.WEB,device_id:Mx.getDeviceId(),user_agent:NP()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var hK=function(e){return lK.print("createEngine","Invoke VERTC.createEngine"),BP(e,"appId"),[_x,vx,mx].forEach((function(t){return t.setStats({rtc_app_id:e})})),hx.sdkInitEngine(Date.now(),VL.BEGIN),new uK(e)},pK=function(e){if(lK.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof uK))throw new aD(tD.INVALID_ENGINE,"Invalid engine object");e.destroy(),hx.sdkInitEngine(Date.now(),VL.END)},fK=function(){return Zf(void 0,void 0,void 0,(function(){return $f(this,(function(e){return[2,lF.getDevices()]}))}))},_K=function(e){return void 0===e&&(e={video:!0,audio:!0}),Zf(void 0,void 0,void 0,(function(){var t,r,i,n,o;return $f(this,(function(a){switch(a.label){case 0:if(t=e.video,r=e.audio,i={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),n=i,[4,lF.getVideoPermission()];case 2:return n.video=a.sent(),[3,4];case 3:return a.sent(),[3,4];case 4:if(!r)return[3,8];a.label=5;case 5:return a.trys.push([5,7,,8]),o=i,[4,lF.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,i]}}))}))},vK=function(){return Zf(void 0,void 0,void 0,(function(){return $f(this,(function(e){return[2,lF.getMicrophones()]}))}))},mK=function(){return Zf(void 0,void 0,void 0,(function(){return $f(this,(function(e){return[2,lF.getCameras()]}))}))},SK=function(){return Zf(void 0,void 0,void 0,(function(){return $f(this,(function(e){return[2,lF.getAudioPlayback()]}))}))},EK=function(){return Ak.VERSION},yK=function(){return hx.rtcSdkApiCall("isSupported",0,""),Zf(void 0,void 0,void 0,(function(){var e;return $f(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!NP()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,mV()]:[2,!1];case 1:return[2,null==(e=t.sent())?void 0:e.includes("H264")];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},gK=function(){return hx.rtcSdkApiCall("getSupportedCodecs",0,""),Zf(void 0,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return[4,mV()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!NP()&&location.search.includes("_rtc_autotest_");var bK=new function(){this.getSdkVersion=EK,this.createEngine=hK,this.destroyEngine=pK,this.getDevices=fK,this.enableDevices=_K,this.getMicrophones=vK,this.getCameras=mK,this.getAudioPlayback=SK,this.getParameter=Ok,this.setParameter=Ck,this.isSupported=yK,this.getSupportedCodecs=gK,this.ConnectionMode=Wf,this.events=a_,this.ErrorCode=tD,this.platform="BytePlus",this._monitor=hx};return Jf(Jf(Jf(Jf({},bK),o_),s_),{events:a_})}));
|
|
6
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}function t(e){return t="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},t(e)}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i=function(e){return e&&e.Math==Math&&e},n=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof r&&r)||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,S=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},E=c,y=Function.prototype,g=y.bind,b=y.call,T=E&&g.bind(b,b),I=E?function(e){return e&&T(e)}:function(e){return e&&function(){return b.apply(e,arguments)}},R=I,A=R({}.toString),C=R("".slice),O=function(e){return C(A(e),8,-1)},N=I,w=a,D=O,P=n.Object,k=N("".split),M=w((function(){return!P("z").propertyIsEnumerable(0)}))?function(e){return"String"==D(e)?k(e,""):P(e)}:P,U=n.TypeError,L=function(e){if(null==e)throw U("Can't call method on "+e);return e},x=M,V=L,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},Y=function(e,t){return arguments.length<2?K(H[e]):H[e]&&H[e][t]},X=I({}.isPrototypeOf),W=Y("navigator","userAgent")||"",J=n,q=W,Z=J.process,$=J.Deno,Q=Z&&Z.versions||$&&$.version,ee=Q&&Q.v8;ee&&(m=(v=ee.split("."))[0]>0&&v[0]<4?1:+(v[0]+v[1])),!m&&q&&(!(v=q.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=q.match(/Chrome\/(\d+)/))&&(m=+v[1]);var te=m,re=te,ie=a,ne=!!Object.getOwnPropertySymbols&&!ie((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&re&&re<41})),oe=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ae=Y,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")},Se=me,Ee=function(e,t){var r=e[t];return null==r?void 0:Se(r)},ye=l,ge=B,be=G,Te=n.TypeError,Ie={exports:{}},Re=n,Ae=Object.defineProperty,Ce=function(e,t){try{Ae(Re,e,{value:t,configurable:!0,writable:!0})}catch(r){Re[e]=t}return t},Oe=Ce,Ne="__core-js_shared__",we=n[Ne]||Oe(Ne,{}),De=we;(Ie.exports=function(e,t){return De[e]||(De[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=L,ke=n.Object,Me=function(e){return ke(Pe(e))},Ue=Me,Le=I({}.hasOwnProperty),xe=Object.hasOwn||function(e,t){return Le(Ue(e),t)},Ve=I,Fe=0,Be=Math.random(),je=Ve(1..toString),Ge=function(e){return"Symbol("+(void 0===e?"":e)+")_"+je(++Fe+Be,36)},He=n,ze=Ie.exports,Ke=xe,Ye=Ge,Xe=ne,We=oe,Je=ze("wks"),qe=He.Symbol,Ze=qe&&qe.for,$e=We?qe:qe&&qe.withoutSetter||Ye,Qe=function(e){if(!Ke(Je,e)||!Xe&&"string"!=typeof Je[e]){var t="Symbol."+e;Xe&&Ke(qe,e)?Je[e]=qe[e]:Je[e]=We&&Ze?Ze(t):$e(t)}return Je[e]},et=l,tt=G,rt=le,it=Ee,nt=function(e,t){var r,i;if("string"===t&&ge(r=e.toString)&&!be(i=ye(r,e)))return i;if(ge(r=e.valueOf)&&!be(i=ye(r,e)))return i;if("string"!==t&&ge(r=e.toString)&&!be(i=ye(r,e)))return i;throw Te("Can't convert object to primitive value")},ot=Qe,at=n.TypeError,st=ot("toPrimitive"),ct=function(e,t){if(!tt(e)||rt(e))return e;var r,i=it(e,st);if(i){if(void 0===t&&(t="default"),r=et(i,e,t),!tt(r)||rt(r))return r;throw at("Can't convert object to primitive value")}return void 0===t&&(t="number"),nt(e,t)},ut=ct,dt=le,lt=function(e){var t=ut(e,"string");return dt(t)?t:t+""},ht=G,pt=n.document,ft=ht(pt)&&ht(pt.createElement),_t=function(e){return ft?pt.createElement(e):{}},vt=_t,mt=!s&&!a((function(){return 7!=Object.defineProperty(vt("div"),"a",{get:function(){return 7}}).a})),St=s,Et=l,yt=h,gt=S,bt=F,Tt=lt,It=xe,Rt=mt,At=Object.getOwnPropertyDescriptor;o.f=St?At:function(e,t){if(e=bt(e),t=Tt(t),Rt)try{return At(e,t)}catch(e){}if(It(e,t))return gt(!Et(yt.f,e,t),e[t])};var Ct={},Ot=s&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Nt=n,wt=G,Dt=Nt.String,Pt=Nt.TypeError,kt=function(e){if(wt(e))return e;throw Pt(Dt(e)+" is not an object")},Mt=s,Ut=mt,Lt=Ot,xt=kt,Vt=lt,Ft=n.TypeError,Bt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,Gt="enumerable",Ht="configurable",zt="writable";Ct.f=Mt?Lt?function(e,t,r){if(xt(e),t=Vt(t),xt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&zt in r&&!r.writable){var i=jt(e,t);i&&i.writable&&(e[t]=r.value,r={configurable:Ht in r?r.configurable:i.configurable,enumerable:Gt in r?r.enumerable:i.enumerable,writable:!1})}return Bt(e,t,r)}:Bt:function(e,t,r){if(xt(e),t=Vt(t),xt(r),Ut)try{return Bt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Ft("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Kt=Ct,Yt=S,Xt=s?function(e,t,r){return Kt.f(e,t,Yt(1,r))}:function(e,t,r){return e[t]=r,e},Wt={exports:{}},Jt=B,qt=we,Zt=I(Function.toString);Jt(qt.inspectSource)||(qt.inspectSource=function(e){return Zt(e)});var $t,Qt,er,tr=qt.inspectSource,rr=B,ir=tr,nr=n.WeakMap,or=rr(nr)&&/native code/.test(ir(nr)),ar=Ie.exports,sr=Ge,cr=ar("keys"),ur=function(e){return cr[e]||(cr[e]=sr(e))},dr={},lr=or,hr=n,pr=I,fr=G,_r=Xt,vr=xe,mr=we,Sr=ur,Er=dr,yr="Object already initialized",gr=hr.TypeError,br=hr.WeakMap;if(lr||mr.state){var Tr=mr.state||(mr.state=new br),Ir=pr(Tr.get),Rr=pr(Tr.has),Ar=pr(Tr.set);$t=function(e,t){if(Rr(Tr,e))throw new gr(yr);return t.facade=e,Ar(Tr,e,t),t},Qt=function(e){return Ir(Tr,e)||{}},er=function(e){return Rr(Tr,e)}}else{var Cr=Sr("state");Er[Cr]=!0,$t=function(e,t){if(vr(e,Cr))throw new gr(yr);return t.facade=e,_r(e,Cr,t),t},Qt=function(e){return vr(e,Cr)?e[Cr]:{}},er=function(e){return vr(e,Cr)}}var Or={set:$t,get:Qt,has:er,enforce:function(e){return er(e)?Qt(e):$t(e,{})},getterFor:function(e){return function(t){var r;if(!fr(t)||(r=Qt(t)).type!==e)throw gr("Incompatible receiver, "+e+" required");return r}}},Nr=s,wr=xe,Dr=Function.prototype,Pr=Nr&&Object.getOwnPropertyDescriptor,kr=wr(Dr,"name"),Mr={EXISTS:kr,PROPER:kr&&"something"===function(){}.name,CONFIGURABLE:kr&&(!Nr||Nr&&Pr(Dr,"name").configurable)},Ur=n,Lr=B,xr=xe,Vr=Xt,Fr=Ce,Br=tr,jr=Mr.CONFIGURABLE,Gr=Or.get,Hr=Or.enforce,zr=String(String).split("String");(Wt.exports=function(e,t,r,i){var n,o=!!i&&!!i.unsafe,a=!!i&&!!i.enumerable,s=!!i&&!!i.noTargetGet,c=i&&void 0!==i.name?i.name:t;Lr(r)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!xr(r,"name")||jr&&r.name!==c)&&Vr(r,"name",c),(n=Hr(r)).source||(n.source=zr.join("string"==typeof c?c:""))),e!==Ur?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=r:Vr(e,t,r)):a?e[t]=r:Fr(t,r)})(Function.prototype,"toString",(function(){return Lr(this)&&Gr(this).source||Br(this)}));var Kr={},Yr=Math.ceil,Xr=Math.floor,Wr=function(e){var t=+e;return t!=t||0===t?0:(t>0?Xr:Yr)(t)},Jr=Wr,qr=Math.max,Zr=Math.min,$r=function(e,t){var r=Jr(e);return r<0?qr(r+t,0):Zr(r,t)},Qr=Wr,ei=Math.min,ti=function(e){return e>0?ei(Qr(e),9007199254740991):0},ri=ti,ii=function(e){return ri(e.length)},ni=F,oi=$r,ai=ii,si=function(e){return function(t,r,i){var n,o=ni(t),a=ai(o),s=oi(i,a);if(e&&r!=r){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},ci={includes:si(!0),indexOf:si(!1)},ui=xe,di=F,li=ci.indexOf,hi=dr,pi=I([].push),fi=function(e,t){var r,i=di(e),n=0,o=[];for(r in i)!ui(hi,r)&&ui(i,r)&&pi(o,r);for(;t.length>n;)ui(i,r=t[n++])&&(~li(o,r)||pi(o,r));return o},_i=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],vi=fi,mi=_i.concat("length","prototype");Kr.f=Object.getOwnPropertyNames||function(e){return vi(e,mi)};var Si={};Si.f=Object.getOwnPropertySymbols;var Ei=Y,yi=Kr,gi=Si,bi=kt,Ti=I([].concat),Ii=Ei("Reflect","ownKeys")||function(e){var t=yi.f(bi(e)),r=gi.f;return r?Ti(t,r(e)):t},Ri=xe,Ai=Ii,Ci=o,Oi=Ct,Ni=function(e,t,r){for(var i=Ai(t),n=Oi.f,o=Ci.f,a=0;a<i.length;a++){var s=i[a];Ri(e,s)||r&&Ri(r,s)||n(e,s,o(t,s))}},wi=a,Di=B,Pi=/#|\.prototype\./,ki=function(e,t){var r=Ui[Mi(e)];return r==xi||r!=Li&&(Di(t)?wi(t):!!t)},Mi=ki.normalize=function(e){return String(e).replace(Pi,".").toLowerCase()},Ui=ki.data={},Li=ki.NATIVE="N",xi=ki.POLYFILL="P",Vi=ki,Fi=n,Bi=o.f,ji=Xt,Gi=Wt.exports,Hi=Ce,zi=Ni,Ki=Vi,Yi=function(e,t){var r,i,n,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?Fi:u?Fi[s]||Hi(s,{}):(Fi[s]||{}).prototype)for(i in t){if(o=t[i],n=e.noTargetGet?(a=Bi(r,i))&&a.value:r[i],!Ki(c?i:s+(u?".":"#")+i,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;zi(o,n)}(e.sham||n&&n.sham)&&ji(o,"sham",!0),Gi(r,i,o,e)}},Xi=n,Wi=B,Ji=Xi.String,qi=Xi.TypeError,Zi=I,$i=kt,Qi=function(e){if("object"==typeof e||Wi(e))return e;throw qi("Can't set "+Ji(e)+" as a prototype")},en=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Zi(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return $i(r),Qi(i),t?e(r,i):r.__proto__=i,r}}():void 0);Yi({target:"Object",stat:!0},{setPrototypeOf:en});var tn={},rn=fi,nn=_i,on=Object.keys||function(e){return rn(e,nn)},an=s,sn=Ot,cn=Ct,un=kt,dn=F,ln=on;tn.f=an&&!sn?Object.defineProperties:function(e,t){un(e);for(var r,i=dn(t),n=ln(t),o=n.length,a=0;o>a;)cn.f(e,r=n[a++],i[r]);return e};var hn,pn=Y("document","documentElement"),fn=kt,_n=tn,vn=_i,mn=dr,Sn=pn,En=_t,yn=ur("IE_PROTO"),gn=function(){},bn=function(e){return"<script>"+e+"</"+"script>"},Tn=function(e){e.write(bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},In=function(){try{hn=new ActiveXObject("htmlfile")}catch(e){}var e,t;In="undefined"!=typeof document?document.domain&&hn?Tn(hn):((t=En("iframe")).style.display="none",Sn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(bn("document.F=Object")),e.close(),e.F):Tn(hn);for(var r=vn.length;r--;)delete In.prototype[vn[r]];return In()};mn[yn]=!0;var Rn=Object.create||function(e,t){var r;return null!==e?(gn.prototype=fn(e),r=new gn,gn.prototype=null,r[yn]=e):r=In(),void 0===t?r:_n.f(r,t)};Yi({target:"Object",stat:!0,sham:!s},{create:Rn});var An=s,Cn=I,On=l,Nn=a,wn=on,Dn=Si,Pn=h,kn=Me,Mn=M,Un=Object.assign,Ln=Object.defineProperty,xn=Cn([].concat),Vn=!Un||Nn((function(){if(An&&1!==Un({b:1},Un(Ln({},"a",{enumerable:!0,get:function(){Ln(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!=Un({},e)[r]||wn(Un({},t)).join("")!=i}))?function(e,t){for(var r=kn(e),i=arguments.length,n=1,o=Dn.f,a=Pn.f;i>n;)for(var s,c=Mn(arguments[n++]),u=o?xn(wn(c),o(c)):wn(c),d=u.length,l=0;d>l;)s=u[l++],An&&!On(a,c,s)||(r[s]=c[s]);return r}:Un,Fn=Vn;Yi({target:"Object",stat:!0,forced:Object.assign!==Fn},{assign:Fn});var Bn=a,jn=function(e,t){var r=[][e];return!!r&&Bn((function(){r.call(null,t||function(){throw 1},1)}))},Gn=Yi,Hn=ci.indexOf,zn=jn,Kn=I([].indexOf),Yn=!!Kn&&1/Kn([1],1,-0)<0,Xn=zn("indexOf");Gn({target:"Array",proto:!0,forced:Yn||!Xn},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Yn?Kn(this,e,t)||0:Hn(this,e,t)}});var Wn=c,Jn=Function.prototype,qn=Jn.apply,Zn=Jn.call,$n="object"==typeof Reflect&&Reflect.apply||(Wn?Zn.bind(qn):function(){return Zn.apply(qn,arguments)}),Qn=O,eo=Array.isArray||function(e){return"Array"==Qn(e)},to={};to[Qe("toStringTag")]="z";var ro="[object z]"===String(to),io=n,no=ro,oo=B,ao=O,so=Qe("toStringTag"),co=io.Object,uo="Arguments"==ao(function(){return arguments}()),lo=no?ao:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=co(e),so))?r:uo?ao(t):"Object"==(i=ao(t))&&oo(t.callee)?"Arguments":i},ho=lo,po=n.String,fo=function(e){if("Symbol"===ho(e))throw TypeError("Cannot convert a Symbol value to a string");return po(e)},_o={},vo=lt,mo=Ct,So=S,Eo=function(e,t,r){var i=vo(t);i in e?mo.f(e,i,So(0,r)):e[i]=r},yo=$r,go=ii,bo=Eo,To=n.Array,Io=Math.max,Ro=function(e,t,r){for(var i=go(e),n=yo(t,i),o=yo(void 0===r?i:r,i),a=To(Io(o-n,0)),s=0;n<o;n++,s++)bo(a,s,e[n]);return a.length=s,a},Ao=O,Co=F,Oo=Kr.f,No=Ro,wo="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];_o.f=function(e){return wo&&"Window"==Ao(e)?function(e){try{return Oo(e)}catch(e){return No(wo)}}(e):Oo(Co(e))};var Do=I([].slice),Po={},ko=Qe;Po.f=ko;var Mo=n,Uo=xe,Lo=Po,xo=Ct.f,Vo=function(e){var t=Mo.Symbol||(Mo.Symbol={});Uo(t,e)||xo(t,e,{value:Lo.f(e)})},Fo=Ct.f,Bo=xe,jo=Qe("toStringTag"),Go=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Bo(e,jo)&&Fo(e,jo,{configurable:!0,value:t})},Ho=me,zo=c,Ko=I(I.bind),Yo=function(e,t){return Ho(e),void 0===t?e:zo?Ko(e,t):function(){return e.apply(t,arguments)}},Xo=I,Wo=a,Jo=B,qo=lo,Zo=tr,$o=function(){},Qo=[],ea=Y("Reflect","construct"),ta=/^\s*(?:class|function)\b/,ra=Xo(ta.exec),ia=!ta.exec($o),na=function(e){if(!Jo(e))return!1;try{return ea($o,Qo,e),!0}catch(e){return!1}},oa=function(e){if(!Jo(e))return!1;switch(qo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ia||!!ra(ta,Zo(e))}catch(e){return!0}};oa.sham=!0;var aa=!ea||Wo((function(){var e;return na(na.call)||!na(Object)||!na((function(){e=!0}))||e}))?oa:na,sa=n,ca=eo,ua=aa,da=G,la=Qe("species"),ha=sa.Array,pa=function(e){var t;return ca(e)&&(t=e.constructor,(ua(t)&&(t===ha||ca(t.prototype))||da(t)&&null===(t=t[la]))&&(t=void 0)),void 0===t?ha:t},fa=function(e,t){return new(pa(e))(0===t?0:t)},_a=Yo,va=M,ma=Me,Sa=ii,Ea=fa,ya=I([].push),ga=function(e){var t=1==e,r=2==e,i=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=ma(c),_=va(f),v=_a(u,d),m=Sa(_),S=0,E=l||Ea,y=t?E(c,m):r||a?E(c,0):void 0;m>S;S++)if((s||S in _)&&(p=v(h=_[S],S,f),e))if(t)y[S]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return S;case 2:ya(y,h)}else switch(e){case 4:return!1;case 7:ya(y,h)}return o?-1:i||n?n:y}},ba={forEach:ga(0),map:ga(1),filter:ga(2),some:ga(3),every:ga(4),find:ga(5),findIndex:ga(6),filterReject:ga(7)},Ta=Yi,Ia=n,Ra=Y,Aa=$n,Ca=l,Oa=I,Na=s,wa=ne,Da=a,Pa=xe,ka=eo,Ma=B,Ua=G,La=X,xa=le,Va=kt,Fa=Me,Ba=F,ja=lt,Ga=fo,Ha=S,za=Rn,Ka=on,Ya=Kr,Xa=_o,Wa=Si,Ja=o,qa=Ct,Za=tn,$a=h,Qa=Do,es=Wt.exports,ts=Ie.exports,rs=dr,is=Ge,ns=Qe,os=Po,as=Vo,ss=Go,cs=Or,us=ba.forEach,ds=ur("hidden"),ls="Symbol",hs=ns("toPrimitive"),ps=cs.set,fs=cs.getterFor(ls),_s=Object.prototype,vs=Ia.Symbol,ms=vs&&vs.prototype,Ss=Ia.TypeError,Es=Ia.QObject,ys=Ra("JSON","stringify"),gs=Ja.f,bs=qa.f,Ts=Xa.f,Is=$a.f,Rs=Oa([].push),As=ts("symbols"),Cs=ts("op-symbols"),Os=ts("string-to-symbol-registry"),Ns=ts("symbol-to-string-registry"),ws=ts("wks"),Ds=!Es||!Es.prototype||!Es.prototype.findChild,Ps=Na&&Da((function(){return 7!=za(bs({},"a",{get:function(){return bs(this,"a",{value:7}).a}})).a}))?function(e,t,r){var i=gs(_s,t);i&&delete _s[t],bs(e,t,r),i&&e!==_s&&bs(_s,t,i)}:bs,ks=function(e,t){var r=As[e]=za(ms);return ps(r,{type:ls,tag:e,description:t}),Na||(r.description=t),r},Ms=function(e,t,r){e===_s&&Ms(Cs,t,r),Va(e);var i=ja(t);return Va(r),Pa(As,i)?(r.enumerable?(Pa(e,ds)&&e[ds][i]&&(e[ds][i]=!1),r=za(r,{enumerable:Ha(0,!1)})):(Pa(e,ds)||bs(e,ds,Ha(1,{})),e[ds][i]=!0),Ps(e,i,r)):bs(e,i,r)},Us=function(e,t){Va(e);var r=Ba(t),i=Ka(r).concat(Fs(r));return us(i,(function(t){Na&&!Ca(Ls,r,t)||Ms(e,t,r[t])})),e},Ls=function(e){var t=ja(e),r=Ca(Is,this,t);return!(this===_s&&Pa(As,t)&&!Pa(Cs,t))&&(!(r||!Pa(this,t)||!Pa(As,t)||Pa(this,ds)&&this[ds][t])||r)},xs=function(e,t){var r=Ba(e),i=ja(t);if(r!==_s||!Pa(As,i)||Pa(Cs,i)){var n=gs(r,i);return!n||!Pa(As,i)||Pa(r,ds)&&r[ds][i]||(n.enumerable=!0),n}},Vs=function(e){var t=Ts(Ba(e)),r=[];return us(t,(function(e){Pa(As,e)||Pa(rs,e)||Rs(r,e)})),r},Fs=function(e){var t=e===_s,r=Ts(t?Cs:Ba(e)),i=[];return us(r,(function(e){!Pa(As,e)||t&&!Pa(_s,e)||Rs(i,As[e])})),i};(wa||(vs=function(){if(La(ms,this))throw Ss("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Ga(arguments[0]):void 0,t=is(e),r=function(e){this===_s&&Ca(r,Cs,e),Pa(this,ds)&&Pa(this[ds],t)&&(this[ds][t]=!1),Ps(this,t,Ha(1,e))};return Na&&Ds&&Ps(_s,t,{configurable:!0,set:r}),ks(t,e)},es(ms=vs.prototype,"toString",(function(){return fs(this).tag})),es(vs,"withoutSetter",(function(e){return ks(is(e),e)})),$a.f=Ls,qa.f=Ms,Za.f=Us,Ja.f=xs,Ya.f=Xa.f=Vs,Wa.f=Fs,os.f=function(e){return ks(ns(e),e)},Na&&(bs(ms,"description",{configurable:!0,get:function(){return fs(this).description}}),es(_s,"propertyIsEnumerable",Ls,{unsafe:!0}))),Ta({global:!0,wrap:!0,forced:!wa,sham:!wa},{Symbol:vs}),us(Ka(ws),(function(e){as(e)})),Ta({target:ls,stat:!0,forced:!wa},{for:function(e){var t=Ga(e);if(Pa(Os,t))return Os[t];var r=vs(t);return Os[t]=r,Ns[r]=t,r},keyFor:function(e){if(!xa(e))throw Ss(e+" is not a symbol");if(Pa(Ns,e))return Ns[e]},useSetter:function(){Ds=!0},useSimple:function(){Ds=!1}}),Ta({target:"Object",stat:!0,forced:!wa,sham:!Na},{create:function(e,t){return void 0===t?za(e):Us(za(e),t)},defineProperty:Ms,defineProperties:Us,getOwnPropertyDescriptor:xs}),Ta({target:"Object",stat:!0,forced:!wa},{getOwnPropertyNames:Vs,getOwnPropertySymbols:Fs}),Ta({target:"Object",stat:!0,forced:Da((function(){Wa.f(1)}))},{getOwnPropertySymbols:function(e){return Wa.f(Fa(e))}}),ys)&&Ta({target:"JSON",stat:!0,forced:!wa||Da((function(){var e=vs();return"[null]"!=ys([e])||"{}"!=ys({a:e})||"{}"!=ys(Object(e))}))},{stringify:function(e,t,r){var i=Qa(arguments),n=t;if((Ua(t)||void 0!==e)&&!xa(e))return ka(t)||(t=function(e,t){if(Ma(n)&&(t=Ca(n,this,e,t)),!xa(t))return t}),i[1]=t,Aa(ys,null,i)}});if(!ms[hs]){var Bs=ms.valueOf;es(ms,hs,(function(e){return Ca(Bs,this)}))}ss(vs,ls),rs[ds]=!0;var js=Yi,Gs=a,Hs=F,zs=o.f,Ks=s,Ys=Gs((function(){zs(1)}));js({target:"Object",stat:!0,forced:!Ks||Ys,sham:!Ks},{getOwnPropertyDescriptor:function(e,t){return zs(Hs(e),t)}});var Xs=lo,Ws=ro?{}.toString:function(){return"[object "+Xs(this)+"]"},Js=ro,qs=Wt.exports,Zs=Ws;Js||qs(Object.prototype,"toString",Zs,{unsafe:!0});var $s=Yi,Qs=s,ec=Ct.f;$s({target:"Object",stat:!0,forced:Object.defineProperty!==ec,sham:!Qs},{defineProperty:ec});var tc=n.Promise,rc=Wt.exports,ic=function(e,t,r){for(var i in t)rc(e,i,t[i],r);return e},nc=Y,oc=Ct,ac=s,sc=Qe("species"),cc=function(e){var t=nc(e),r=oc.f;ac&&t&&!t[sc]&&r(t,sc,{configurable:!0,get:function(){return this}})},uc=X,dc=n.TypeError,lc=function(e,t){if(uc(t,e))return e;throw dc("Incorrect invocation")},hc={},pc=hc,fc=Qe("iterator"),_c=Array.prototype,vc=function(e){return void 0!==e&&(pc.Array===e||_c[fc]===e)},mc=lo,Sc=Ee,Ec=hc,yc=Qe("iterator"),gc=function(e){if(null!=e)return Sc(e,yc)||Sc(e,"@@iterator")||Ec[mc(e)]},bc=l,Tc=me,Ic=kt,Rc=pe,Ac=gc,Cc=n.TypeError,Oc=function(e,t){var r=arguments.length<2?Ac(e):t;if(Tc(r))return Ic(bc(r,e));throw Cc(Rc(e)+" is not iterable")},Nc=l,wc=kt,Dc=Ee,Pc=function(e,t,r){var i,n;wc(e);try{if(!(i=Dc(e,"return"))){if("throw"===t)throw r;return r}i=Nc(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return wc(i),r},kc=Yo,Mc=l,Uc=kt,Lc=pe,xc=vc,Vc=ii,Fc=X,Bc=Oc,jc=gc,Gc=Pc,Hc=n.TypeError,zc=function(e,t){this.stopped=e,this.result=t},Kc=zc.prototype,Yc=function(e,t,r){var i,n,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),f=kc(t,d),_=function(e){return i&&Gc(i,"normal",e),new zc(!0,e)},v=function(e){return l?(Uc(e),p?f(e[0],e[1],_):f(e[0],e[1])):p?f(e,_):f(e)};if(h)i=e;else{if(!(n=jc(e)))throw Hc(Lc(e)+" is not iterable");if(xc(n)){for(o=0,a=Vc(e);a>o;o++)if((s=v(e[o]))&&Fc(Kc,s))return s;return new zc(!1)}i=Bc(e,n)}for(c=i.next;!(u=Mc(c,i)).done;){try{s=v(u.value)}catch(e){Gc(i,"throw",e)}if("object"==typeof s&&s&&Fc(Kc,s))return s}return new zc(!1)},Xc=Qe("iterator"),Wc=!1;try{var Jc=0,qc={next:function(){return{done:!!Jc++}},return:function(){Wc=!0}};qc[Xc]=function(){return this},Array.from(qc,(function(){throw 2}))}catch(e){}var Zc,$c,Qc,eu,tu=function(e,t){if(!t&&!Wc)return!1;var r=!1;try{var i={};i[Xc]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},ru=aa,iu=pe,nu=n.TypeError,ou=function(e){if(ru(e))return e;throw nu(iu(e)+" is not a constructor")},au=kt,su=ou,cu=Qe("species"),uu=function(e,t){var r,i=au(e).constructor;return void 0===i||null==(r=au(i)[cu])?t:su(r)},du=n.TypeError,lu=function(e,t){if(e<t)throw du("Not enough arguments");return e},hu=/(?:ipad|iphone|ipod).*applewebkit/i.test(W),pu="process"==O(n.process),fu=n,_u=$n,vu=Yo,mu=B,Su=xe,Eu=a,yu=pn,gu=Do,bu=_t,Tu=lu,Iu=hu,Ru=pu,Au=fu.setImmediate,Cu=fu.clearImmediate,Ou=fu.process,Nu=fu.Dispatch,wu=fu.Function,Du=fu.MessageChannel,Pu=fu.String,ku=0,Mu={},Uu="onreadystatechange";try{Zc=fu.location}catch(e){}var Lu=function(e){if(Su(Mu,e)){var t=Mu[e];delete Mu[e],t()}},xu=function(e){return function(){Lu(e)}},Vu=function(e){Lu(e.data)},Fu=function(e){fu.postMessage(Pu(e),Zc.protocol+"//"+Zc.host)};Au&&Cu||(Au=function(e){Tu(arguments.length,1);var t=mu(e)?e:wu(e),r=gu(arguments,1);return Mu[++ku]=function(){_u(t,void 0,r)},$c(ku),ku},Cu=function(e){delete Mu[e]},Ru?$c=function(e){Ou.nextTick(xu(e))}:Nu&&Nu.now?$c=function(e){Nu.now(xu(e))}:Du&&!Iu?(eu=(Qc=new Du).port2,Qc.port1.onmessage=Vu,$c=vu(eu.postMessage,eu)):fu.addEventListener&&mu(fu.postMessage)&&!fu.importScripts&&Zc&&"file:"!==Zc.protocol&&!Eu(Fu)?($c=Fu,fu.addEventListener("message",Vu,!1)):$c=Uu in bu("script")?function(e){yu.appendChild(bu("script")).onreadystatechange=function(){yu.removeChild(this),Lu(e)}}:function(e){setTimeout(xu(e),0)});var Bu,ju,Gu,Hu,zu,Ku,Yu,Xu,Wu={set:Au,clear:Cu},Ju=n,qu=/ipad|iphone|ipod/i.test(W)&&void 0!==Ju.Pebble,Zu=/web0s(?!.*chrome)/i.test(W),$u=n,Qu=Yo,ed=o.f,td=Wu.set,rd=hu,id=qu,nd=Zu,od=pu,ad=$u.MutationObserver||$u.WebKitMutationObserver,sd=$u.document,cd=$u.process,ud=$u.Promise,dd=ed($u,"queueMicrotask"),ld=dd&&dd.value;ld||(Bu=function(){var e,t;for(od&&(e=cd.domain)&&e.exit();ju;){t=ju.fn,ju=ju.next;try{t()}catch(e){throw ju?Hu():Gu=void 0,e}}Gu=void 0,e&&e.enter()},rd||od||nd||!ad||!sd?!id&&ud&&ud.resolve?((Yu=ud.resolve(void 0)).constructor=ud,Xu=Qu(Yu.then,Yu),Hu=function(){Xu(Bu)}):od?Hu=function(){cd.nextTick(Bu)}:(td=Qu(td,$u),Hu=function(){td(Bu)}):(zu=!0,Ku=sd.createTextNode(""),new ad(Bu).observe(Ku,{characterData:!0}),Hu=function(){Ku.data=zu=!zu}));var hd=ld||function(e){var t={fn:e,next:void 0};Gu&&(Gu.next=t),ju||(ju=t,Hu()),Gu=t},pd={},fd=me,_d=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=i})),this.resolve=fd(t),this.reject=fd(r)};pd.f=function(e){return new _d(e)};var vd=kt,md=G,Sd=pd,Ed=function(e,t){if(vd(e),md(t)&&t.constructor===e)return t;var r=Sd.f(e);return(0,r.resolve)(t),r.promise},yd=n,gd=function(){this.head=null,this.tail=null};gd.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 bd,Td,Id,Rd,Ad=gd,Cd="object"==typeof window,Od=Yi,Nd=n,wd=Y,Dd=l,Pd=tc,kd=Wt.exports,Md=ic,Ud=en,Ld=Go,xd=cc,Vd=me,Fd=B,Bd=G,jd=lc,Gd=tr,Hd=Yc,zd=tu,Kd=uu,Yd=Wu.set,Xd=hd,Wd=Ed,Jd=function(e,t){var r=yd.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},qd=pd,Zd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},$d=Ad,Qd=Or,el=Vi,tl=Cd,rl=pu,il=te,nl=Qe("species"),ol="Promise",al=Qd.getterFor(ol),sl=Qd.set,cl=Qd.getterFor(ol),ul=Pd&&Pd.prototype,dl=Pd,ll=ul,hl=Nd.TypeError,pl=Nd.document,fl=Nd.process,_l=qd.f,vl=_l,ml=!!(pl&&pl.createEvent&&Nd.dispatchEvent),Sl=Fd(Nd.PromiseRejectionEvent),El="unhandledrejection",yl=!1,gl=el(ol,(function(){var e=Gd(dl),t=e!==String(dl);if(!t&&66===il)return!0;if(il>=51&&/native code/.test(e))return!1;var r=new dl((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};return(r.constructor={})[nl]=i,!(yl=r.then((function(){}))instanceof i)||!t&&tl&&!Sl})),bl=gl||!zd((function(e){dl.all(e).catch((function(){}))})),Tl=function(e){var t;return!(!Bd(e)||!Fd(t=e.then))&&t},Il=function(e,t){var r,i,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&&Nl(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),n=!0)),r===e.promise?u(hl("Promise-chain cycle")):(i=Tl(r))?Dd(i,r,c,u):c(r)):u(o)}catch(e){d&&!n&&d.exit(),u(e)}},Rl=function(e,t){e.notified||(e.notified=!0,Xd((function(){for(var r,i=e.reactions;r=i.get();)Il(r,e);e.notified=!1,t&&!e.rejection&&Cl(e)})))},Al=function(e,t,r){var i,n;ml?((i=pl.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),Nd.dispatchEvent(i)):i={promise:t,reason:r},!Sl&&(n=Nd["on"+e])?n(i):e===El&&Jd("Unhandled promise rejection",r)},Cl=function(e){Dd(Yd,Nd,(function(){var t,r=e.facade,i=e.value;if(Ol(e)&&(t=Zd((function(){rl?fl.emit("unhandledRejection",i,r):Al(El,r,i)})),e.rejection=rl||Ol(e)?2:1,t.error))throw t.value}))},Ol=function(e){return 1!==e.rejection&&!e.parent},Nl=function(e){Dd(Yd,Nd,(function(){var t=e.facade;rl?fl.emit("rejectionHandled",t):Al("rejectionhandled",t,e.value)}))},wl=function(e,t,r){return function(i){e(t,i,r)}},Dl=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Rl(e,!0))},Pl=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw hl("Promise can't be resolved itself");var i=Tl(t);i?Xd((function(){var r={done:!1};try{Dd(i,t,wl(Pl,r,e),wl(Dl,r,e))}catch(t){Dl(r,t,e)}})):(e.value=t,e.state=1,Rl(e,!1))}catch(t){Dl({done:!1},t,e)}}};if(gl&&(ll=(dl=function(e){jd(this,ll),Vd(e),Dd(bd,this);var t=al(this);try{e(wl(Pl,t),wl(Dl,t))}catch(e){Dl(t,e)}}).prototype,(bd=function(e){sl(this,{type:ol,done:!1,notified:!1,parent:!1,reactions:new $d,rejection:!1,state:0,value:void 0})}).prototype=Md(ll,{then:function(e,t){var r=cl(this),i=_l(Kd(this,dl));return r.parent=!0,i.ok=!Fd(e)||e,i.fail=Fd(t)&&t,i.domain=rl?fl.domain:void 0,0==r.state?r.reactions.add(i):Xd((function(){Il(i,r)})),i.promise},catch:function(e){return this.then(void 0,e)}}),Td=function(){var e=new bd,t=al(e);this.promise=e,this.resolve=wl(Pl,t),this.reject=wl(Dl,t)},qd.f=_l=function(e){return e===dl||e===Id?new Td(e):vl(e)},Fd(Pd)&&ul!==Object.prototype)){Rd=ul.then,yl||(kd(ul,"then",(function(e,t){var r=this;return new dl((function(e,t){Dd(Rd,r,e,t)})).then(e,t)}),{unsafe:!0}),kd(ul,"catch",ll.catch,{unsafe:!0}));try{delete ul.constructor}catch(e){}Ud&&Ud(ul,ll)}Od({global:!0,wrap:!0,forced:gl},{Promise:dl}),Ld(dl,ol,!1),xd(ol),Id=wd(ol),Od({target:ol,stat:!0,forced:gl},{reject:function(e){var t=_l(this);return Dd(t.reject,void 0,e),t.promise}}),Od({target:ol,stat:!0,forced:gl},{resolve:function(e){return Wd(this,e)}}),Od({target:ol,stat:!0,forced:bl},{all:function(e){var t=this,r=_l(t),i=r.resolve,n=r.reject,o=Zd((function(){var r=Vd(t.resolve),o=[],a=0,s=1;Hd(e,(function(e){var c=a++,u=!1;s++,Dd(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||i(o))}),n)})),--s||i(o)}));return o.error&&n(o.value),r.promise},race:function(e){var t=this,r=_l(t),i=r.reject,n=Zd((function(){var n=Vd(t.resolve);Hd(e,(function(e){Dd(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var kl=Yi,Ml=s,Ul=n,Ll=I,xl=xe,Vl=B,Fl=X,Bl=fo,jl=Ct.f,Gl=Ni,Hl=Ul.Symbol,zl=Hl&&Hl.prototype;if(Ml&&Vl(Hl)&&(!("description"in zl)||void 0!==Hl().description)){var Kl={},Yl=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:Bl(arguments[0]),t=Fl(zl,this)?new Hl(e):void 0===e?Hl():Hl(e);return""===e&&(Kl[t]=!0),t};Gl(Yl,Hl),Yl.prototype=zl,zl.constructor=Yl;var Xl="Symbol(test)"==String(Hl("test")),Wl=Ll(zl.toString),Jl=Ll(zl.valueOf),ql=/^Symbol\((.*)\)[^)]+$/,Zl=Ll("".replace),$l=Ll("".slice);jl(zl,"description",{configurable:!0,get:function(){var e=Jl(this),t=Wl(e);if(xl(Kl,e))return"";var r=Xl?$l(t,7,-1):Zl(t,ql,"$1");return""===r?void 0:r}}),kl({global:!0,forced:!0},{Symbol:Yl})}Vo("iterator");var Ql=Rn,eh=Ct,th=Qe("unscopables"),rh=Array.prototype;null==rh[th]&&eh.f(rh,th,{configurable:!0,value:Ql(null)});var ih,nh,oh,ah=function(e){rh[th][e]=!0},sh=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),ch=n,uh=xe,dh=B,lh=Me,hh=sh,ph=ur("IE_PROTO"),fh=ch.Object,_h=fh.prototype,vh=hh?fh.getPrototypeOf:function(e){var t=lh(e);if(uh(t,ph))return t[ph];var r=t.constructor;return dh(r)&&t instanceof r?r.prototype:t instanceof fh?_h:null},mh=a,Sh=B,Eh=vh,yh=Wt.exports,gh=Qe("iterator"),bh=!1;[].keys&&("next"in(oh=[].keys())?(nh=Eh(Eh(oh)))!==Object.prototype&&(ih=nh):bh=!0);var Th=null==ih||mh((function(){var e={};return ih[gh].call(e)!==e}));Th&&(ih={}),Sh(ih[gh])||yh(ih,gh,(function(){return this}));var Ih={IteratorPrototype:ih,BUGGY_SAFARI_ITERATORS:bh},Rh=Ih.IteratorPrototype,Ah=Rn,Ch=S,Oh=Go,Nh=hc,wh=function(){return this},Dh=function(e,t,r,i){var n=t+" Iterator";return e.prototype=Ah(Rh,{next:Ch(+!i,r)}),Oh(e,n,!1),Nh[n]=wh,e},Ph=Yi,kh=l,Mh=Mr,Uh=B,Lh=Dh,xh=vh,Vh=en,Fh=Go,Bh=Xt,jh=Wt.exports,Gh=hc,Hh=Mh.PROPER,zh=Mh.CONFIGURABLE,Kh=Ih.IteratorPrototype,Yh=Ih.BUGGY_SAFARI_ITERATORS,Xh=Qe("iterator"),Wh="keys",Jh="values",qh="entries",Zh=function(){return this},$h=function(e,t,r,i,n,o,a){Lh(r,t,i);var s,c,u,d=function(e){if(e===n&&_)return _;if(!Yh&&e in p)return p[e];switch(e){case Wh:case Jh:case qh:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[Xh]||p["@@iterator"]||n&&p[n],_=!Yh&&f||d(n),v="Array"==t&&p.entries||f;if(v&&(s=xh(v.call(new e)))!==Object.prototype&&s.next&&(xh(s)!==Kh&&(Vh?Vh(s,Kh):Uh(s[Xh])||jh(s,Xh,Zh)),Fh(s,l,!0)),Hh&&n==Jh&&f&&f.name!==Jh&&(zh?Bh(p,"name",Jh):(h=!0,_=function(){return kh(f,this)})),n)if(c={values:d(Jh),keys:o?_:d(Wh),entries:d(qh)},a)for(u in c)(Yh||h||!(u in p))&&jh(p,u,c[u]);else Ph({target:t,proto:!0,forced:Yh||h},c);return p[Xh]!==_&&jh(p,Xh,_,{name:n}),Gh[t]=_,c},Qh=F,ep=ah,tp=hc,rp=Or,ip=Ct.f,np=$h,op=s,ap="Array Iterator",sp=rp.set,cp=rp.getterFor(ap),up=np(Array,"Array",(function(e,t){sp(this,{type:ap,target:Qh(e),index:0,kind:t})}),(function(){var e=cp(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:i,done:!1}:"values"==r?{value:t[i],done:!1}:{value:[i,t[i]],done:!1}}),"values"),dp=tp.Arguments=tp.Array;if(ep("keys"),ep("values"),ep("entries"),op&&"values"!==dp.name)try{ip(dp,"name",{value:"values"})}catch(e){}var lp=I,hp=Wr,pp=fo,fp=L,_p=lp("".charAt),vp=lp("".charCodeAt),mp=lp("".slice),Sp=function(e){return function(t,r){var i,n,o=pp(fp(t)),a=hp(r),s=o.length;return a<0||a>=s?e?"":void 0:(i=vp(o,a))<55296||i>56319||a+1===s||(n=vp(o,a+1))<56320||n>57343?e?_p(o,a):i:e?mp(o,a,a+2):n-56320+(i-55296<<10)+65536}},Ep={codeAt:Sp(!1),charAt:Sp(!0)},yp=Ep.charAt,gp=fo,bp=Or,Tp=$h,Ip="String Iterator",Rp=bp.set,Ap=bp.getterFor(Ip);Tp(String,"String",(function(e){Rp(this,{type:Ip,string:gp(e),index:0})}),(function(){var e,t=Ap(this),r=t.string,i=t.index;return i>=r.length?{value:void 0,done:!0}:(e=yp(r,i),t.index+=e.length,{value:e,done:!1})}));var Cp={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},Op=_t("span").classList,Np=Op&&Op.constructor&&Op.constructor.prototype,wp=Np===Object.prototype?void 0:Np,Dp=n,Pp=Cp,kp=wp,Mp=up,Up=Xt,Lp=Qe,xp=Lp("iterator"),Vp=Lp("toStringTag"),Fp=Mp.values,Bp=function(e,t){if(e){if(e[xp]!==Fp)try{Up(e,xp,Fp)}catch(t){e[xp]=Fp}if(e[Vp]||Up(e,Vp,t),Pp[t])for(var r in Mp)if(e[r]!==Mp[r])try{Up(e,r,Mp[r])}catch(t){e[r]=Mp[r]}}};for(var jp in Pp)Bp(Dp[jp]&&Dp[jp].prototype,jp);Bp(kp,"DOMTokenList");var Gp=a,Hp=te,zp=Qe("species"),Kp=function(e){return Hp>=51||!Gp((function(){var t=[];return(t.constructor={})[zp]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Yp=Yi,Xp=n,Wp=a,Jp=eo,qp=G,Zp=Me,$p=ii,Qp=Eo,ef=fa,tf=Kp,rf=te,nf=Qe("isConcatSpreadable"),of=9007199254740991,af="Maximum allowed index exceeded",sf=Xp.TypeError,cf=rf>=51||!Wp((function(){var e=[];return e[nf]=!1,e.concat()[0]!==e})),uf=tf("concat"),df=function(e){if(!qp(e))return!1;var t=e[nf];return void 0!==t?!!t:Jp(e)};Yp({target:"Array",proto:!0,forced:!cf||!uf},{concat:function(e){var t,r,i,n,o,a=Zp(this),s=ef(a,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(df(o=-1===t?a:arguments[t])){if(c+(n=$p(o))>of)throw sf(af);for(r=0;r<n;r++,c++)r in o&&Qp(s,c,o[r])}else{if(c>=of)throw sf(af);Qp(s,c++,o)}return s.length=c,s}});var lf=Yi,hf=n,pf=eo,ff=aa,_f=G,vf=$r,mf=ii,Sf=F,Ef=Eo,yf=Qe,gf=Do,bf=Kp("slice"),Tf=yf("species"),If=hf.Array,Rf=Math.max;lf({target:"Array",proto:!0,forced:!bf},{slice:function(e,t){var r,i,n,o=Sf(this),a=mf(o),s=vf(e,a),c=vf(void 0===t?a:t,a);if(pf(o)&&(r=o.constructor,(ff(r)&&(r===If||pf(r.prototype))||_f(r)&&null===(r=r[Tf]))&&(r=void 0),r===If||void 0===r))return gf(o,s,c);for(i=new(void 0===r?If:r)(Rf(c-s,0)),n=0;s<c;s++,n++)s in o&&Ef(i,n,o[s]);return i.length=n,i}}),Vo("asyncIterator");var Af=function(e,t){return Af=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Af(e,t)};function Cf(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Af(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Of,Nf,wf,Df,Pf,kf,Mf,Uf,Lf,xf,Vf,Ff,Bf,jf,Gf,Hf,zf,Kf,Yf,Xf,Wf,Jf=function(){return Jf=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Jf.apply(this,arguments)};function qf(e,r,i,n){var o,a=arguments.length,s=a<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,i):n;if("object"===("undefined"==typeof Reflect?"undefined":t(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,i,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(s=(a<3?o(s):a>3?o(r,i,s):o(r,i))||s);return a>3&&s&&Object.defineProperty(r,i,s),s}function Zf(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function $f(e,t){var r,i,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=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++,i=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],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function Qf(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function e_(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function t_(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}!function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(Of||(Of={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(Nf||(Nf={})),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"}(wf||(wf={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(Df||(Df={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(Pf||(Pf={})),function(e){e[e.MUTE_STATE_OFF=0]="MUTE_STATE_OFF",e[e.MUTE_STATE_ON=1]="MUTE_STATE_ON"}(kf||(kf={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(Mf||(Mf={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(Uf||(Uf={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(Lf||(Lf={})),function(e){e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO=0]="RTC_PAUSE_RESUME_CONTROL_AUDIO",e[e.RTC_PAUSE_RESUME_CONTROL_VIDEO=1]="RTC_PAUSE_RESUME_CONTROL_VIDEO",e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO=2]="RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO"}(xf||(xf={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(Vf||(Vf={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(Ff||(Ff={})),function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_AND_VIDEO=2]="AUDIO_AND_VIDEO",e[e.NONE=3]="NONE"}(Bf||(Bf={})),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"}(jf||(jf={})),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"}(Gf||(Gf={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(Hf||(Hf={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(zf||(zf={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(Kf||(Kf={})),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"}(Yf||(Yf={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(Xf||(Xf={})),function(e){e.AUTO="auto",e.FORCE_TCP="forceTCP",e.FORCE_UDP="forceUDP"}(Wf||(Wf={}));var r_,i_,n_,o_=Object.freeze({__proto__:null,get VideoSourceType(){return Of},get AudioSourceType(){return Nf},get UserOfflineReason(){return wf},get ChannelProfile(){return Df},get SubscribeMode(){return Pf},get MuteState(){return kf},get SubscribeState(){return Mf},get PublishState(){return Uf},get MirrorMode(){return Lf},get PauseResumeControlMediaType(){return xf},get VideoRenderMode(){return Vf},get StreamIndex(){return Ff},get SubscribeMediaType(){return Bf},get StreamRemoveReason(){return jf},get ConnectionState(){return Gf},get MirrorType(){return Hf},get LogChannel(){return zf},get USER_ONLINE_STATUS(){return Kf},get PublicStreamType(){return Yf},get PublicInterpolationMode(){return Xf},get ConnectionMode(){return Wf}});!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"}(r_||(r_={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(i_||(i_={})),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"}(n_||(n_={}));var a_,s_=Object.freeze({__proto__:null,get AudioMixingDualMonoMode(){return r_},get AudioMixingType(){return i_},get AudioMixingState(){return n_}});!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onStreamAdd="onStreamAdd",e.onStreamRemove="onStreamRemove",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onUserMuteAudio="onUserMuteAudio",e.onUserMuteVideo="onUserMuteVideo",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onMediaDeviceStateChanged="onMediaDeviceStateChanged",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.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"}(a_||(a_={}));var c_=ba.forEach,u_=jn("forEach")?[].forEach:function(e){return c_(this,e,arguments.length>1?arguments[1]:void 0)};Yi({target:"Array",proto:!0,forced:[].forEach!=u_},{forEach:u_});var d_=n,l_=Cp,h_=wp,p_=u_,f_=Xt,__=function(e){if(e&&e.forEach!==p_)try{f_(e,"forEach",p_)}catch(t){e.forEach=p_}};for(var v_ in l_)l_[v_]&&__(d_[v_]&&d_[v_].prototype);__(h_);var m_=Yi,S_=I,E_=n.Date,y_=S_(E_.prototype.getTime);m_({target:"Date",stat:!0},{now:function(){return y_(new E_)}});var g_=I,b_=Wt.exports,T_=Date.prototype,I_="Invalid Date",R_="toString",A_=g_(T_.toString),C_=g_(T_.getTime);String(new Date(NaN))!=I_&&b_(T_,R_,(function(){var e=C_(this);return e==e?A_(this):I_}));var O_=ci.includes,N_=ah;Yi({target:"Array",proto:!0},{includes:function(e){return O_(this,e,arguments.length>1?arguments[1]:void 0)}}),N_("includes");var w_=G,D_=O,P_=Qe("match"),k_=function(e){var t;return w_(e)&&(void 0!==(t=e[P_])?!!t:"RegExp"==D_(e))},M_=k_,U_=n.TypeError,L_=function(e){if(M_(e))throw U_("The method doesn't accept regular expressions");return e},x_=Qe("match"),V_=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[x_]=!1,"/./"[e](t)}catch(e){}}return!1},F_=Yi,B_=L_,j_=L,G_=fo,H_=V_,z_=I("".indexOf);F_({target:"String",proto:!0,forced:!H_("includes")},{includes:function(e){return!!~z_(G_(j_(this)),G_(B_(e)),arguments.length>1?arguments[1]:void 0)}});var K_=kt,Y_=function(){var e=K_(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},X_=a,W_=n.RegExp,J_=X_((function(){var e=W_("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),q_=J_||X_((function(){return!W_("a","y").sticky})),Z_={BROKEN_CARET:J_||X_((function(){var e=W_("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:q_,UNSUPPORTED_Y:J_},$_=a,Q_=n.RegExp,ev=$_((function(){var e=Q_(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),tv=a,rv=n.RegExp,iv=tv((function(){var e=rv("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),nv=l,ov=I,av=fo,sv=Y_,cv=Z_,uv=Ie.exports,dv=Rn,lv=Or.get,hv=ev,pv=iv,fv=uv("native-string-replace",String.prototype.replace),_v=RegExp.prototype.exec,vv=_v,mv=ov("".charAt),Sv=ov("".indexOf),Ev=ov("".replace),yv=ov("".slice),gv=function(){var e=/a/,t=/b*/g;return nv(_v,e,"a"),nv(_v,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),bv=cv.BROKEN_CARET,Tv=void 0!==/()??/.exec("")[1];(gv||Tv||bv||hv||pv)&&(vv=function(e){var t,r,i,n,o,a,s,c=this,u=lv(c),d=av(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=nv(vv,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=bv&&c.sticky,f=nv(sv,c),_=c.source,v=0,m=d;if(p&&(f=Ev(f,"y",""),-1===Sv(f,"g")&&(f+="g"),m=yv(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==mv(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",f)),Tv&&(r=new RegExp("^"+_+"$(?!\\s)",f)),gv&&(i=c.lastIndex),n=nv(_v,p?r:c,m),p?n?(n.input=yv(n.input,v),n[0]=yv(n[0],v),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:gv&&n&&(c.lastIndex=c.global?n.index+n[0].length:i),Tv&&n&&n.length>1&&nv(fv,n[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n&&h)for(n.groups=a=dv(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=n[s[1]];return n});var Iv=vv;Yi({target:"RegExp",proto:!0,forced:/./.exec!==Iv},{exec:Iv});var Rv=I,Av=Wt.exports,Cv=Iv,Ov=a,Nv=Qe,wv=Xt,Dv=Nv("species"),Pv=RegExp.prototype,kv=function(e,t,r,i){var n=Nv(e),o=!Ov((function(){var t={};return t[n]=function(){return 7},7!=""[e](t)})),a=o&&!Ov((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Dv]=function(){return r},r.flags="",r[n]=/./[n]),r.exec=function(){return t=!0,null},r[n](""),!t}));if(!o||!a||r){var s=Rv(/./[n]),c=t(n,""[e],(function(e,t,r,i,n){var a=Rv(e),c=t.exec;return c===Cv||c===Pv.exec?o&&!n?{done:!0,value:s(t,r,i)}:{done:!0,value:a(r,t,i)}:{done:!1}}));Av(String.prototype,e,c[0]),Av(Pv,n,c[1])}i&&wv(Pv[n],"sham",!0)},Mv=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Uv=l,Lv=kt,xv=B,Vv=O,Fv=Iv,Bv=n.TypeError,jv=function(e,t){var r=e.exec;if(xv(r)){var i=Uv(r,e,t);return null!==i&&Lv(i),i}if("RegExp"===Vv(e))return Uv(Fv,e,t);throw Bv("RegExp#exec called on incompatible receiver")},Gv=l,Hv=kt,zv=L,Kv=Mv,Yv=fo,Xv=Ee,Wv=jv;function Jv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}kv("search",(function(e,t,r){return[function(t){var r=zv(this),i=null==t?void 0:Xv(t,e);return i?Gv(i,t,r):new RegExp(t)[e](Yv(r))},function(e){var i=Hv(this),n=Yv(e),o=r(t,i,n);if(o.done)return o.value;var a=i.lastIndex;Kv(a,0)||(i.lastIndex=0);var s=Wv(i,n);return Kv(i.lastIndex,a)||(i.lastIndex=a),null===s?-1:s.index}]}));var qv=Ep.charAt,Zv=function(e,t,r){return t+(r?qv(e,t).length:1)},$v=l,Qv=kt,em=ti,tm=fo,rm=L,im=Ee,nm=Zv,om=jv;kv("match",(function(e,t,r){return[function(t){var r=rm(this),i=null==t?void 0:im(t,e);return i?$v(i,t,r):new RegExp(t)[e](tm(r))},function(e){var i=Qv(this),n=tm(e),o=r(t,i,n);if(o.done)return o.value;if(!i.global)return om(i,n);var a=i.unicode;i.lastIndex=0;for(var s,c=[],u=0;null!==(s=om(i,n));){var d=tm(s[0]);c[u]=d,""===d&&(i.lastIndex=nm(n,em(i.lastIndex),a)),u++}return 0===u?null:c}]}));var am="\t\n\v\f\r \u2028\u2029\ufeff",sm=L,cm=fo,um=I("".replace),dm="[\t\n\v\f\r \u2028\u2029\ufeff]",lm=RegExp("^"+dm+dm+"*"),hm=RegExp(dm+dm+"*$"),pm=function(e){return function(t){var r=cm(sm(t));return 1&e&&(r=um(r,lm,"")),2&e&&(r=um(r,hm,"")),r}},fm={start:pm(1),end:pm(2),trim:pm(3)},_m=n,vm=a,mm=I,Sm=fo,Em=fm.trim,ym=am,gm=_m.parseInt,bm=_m.Symbol,Tm=bm&&bm.iterator,Im=/^[+-]?0x/i,Rm=mm(Im.exec),Am=8!==gm(ym+"08")||22!==gm(ym+"0x16")||Tm&&!vm((function(){gm(Object(Tm))}))?function(e,t){var r=Em(Sm(e));return gm(r,t>>>0||(Rm(Im,r)?16:10))}:gm;Yi({global:!0,forced:parseInt!=Am},{parseInt:Am});var Cm={exports:{}},Om=a((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Nm=a,wm=G,Dm=O,Pm=Om,km=Object.isExtensible,Mm=Nm((function(){km(1)}))||Pm?function(e){return!!wm(e)&&((!Pm||"ArrayBuffer"!=Dm(e))&&(!km||km(e)))}:km,Um=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),Lm=Yi,xm=I,Vm=dr,Fm=G,Bm=xe,jm=Ct.f,Gm=Kr,Hm=_o,zm=Mm,Km=Um,Ym=!1,Xm=Ge("meta"),Wm=0,Jm=function(e){jm(e,Xm,{value:{objectID:"O"+Wm++,weakData:{}}})},qm=Cm.exports={enable:function(){qm.enable=function(){},Ym=!0;var e=Gm.f,t=xm([].splice),r={};r[Xm]=1,e(r).length&&(Gm.f=function(r){for(var i=e(r),n=0,o=i.length;n<o;n++)if(i[n]===Xm){t(i,n,1);break}return i},Lm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Hm.f}))},fastKey:function(e,t){if(!Fm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Bm(e,Xm)){if(!zm(e))return"F";if(!t)return"E";Jm(e)}return e[Xm].objectID},getWeakData:function(e,t){if(!Bm(e,Xm)){if(!zm(e))return!0;if(!t)return!1;Jm(e)}return e[Xm].weakData},onFreeze:function(e){return Km&&Ym&&zm(e)&&!Bm(e,Xm)&&Jm(e),e}};Vm[Xm]=!0;var Zm=B,$m=G,Qm=en,eS=function(e,t,r){var i,n;return Qm&&Zm(i=t.constructor)&&i!==r&&$m(n=i.prototype)&&n!==r.prototype&&Qm(e,n),e},tS=Yi,rS=n,iS=I,nS=Vi,oS=Wt.exports,aS=Cm.exports,sS=Yc,cS=lc,uS=B,dS=G,lS=a,hS=tu,pS=Go,fS=eS,_S=function(e,t,r){var i=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=i?"set":"add",a=rS[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=iS(s[e]);oS(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(n&&!dS(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!dS(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!dS(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(nS(e,!uS(a)||!(n||s.forEach&&!lS((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,i,o),aS.enable();else if(nS(e,!0)){var l=new c,h=l[o](n?{}:-0,1)!=l,p=lS((function(){l.has(1)})),f=hS((function(e){new a(e)})),_=!n&&lS((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));f||((c=t((function(e,t){cS(e,s);var r=fS(new a,e,c);return null!=t&&sS(t,r[o],{that:r,AS_ENTRIES:i}),r}))).prototype=s,s.constructor=c),(p||_)&&(d("delete"),d("has"),i&&d("get")),(_||h)&&d(o),n&&s.clear&&delete s.clear}return u[e]=c,tS({global:!0,forced:c!=a},u),pS(c,e),n||r.setStrong(c,e,i),c},vS=Ct.f,mS=Rn,SS=ic,ES=Yo,yS=lc,gS=Yc,bS=$h,TS=cc,IS=s,RS=Cm.exports.fastKey,AS=Or.set,CS=Or.getterFor,OS={getConstructor:function(e,t,r,i){var n=e((function(e,n){yS(e,o),AS(e,{type:t,index:mS(null),first:void 0,last:void 0,size:0}),IS||(e.size=0),null!=n&&gS(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=CS(t),s=function(e,t,r){var i,n,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:n=RS(t,!0),key:t,value:r,previous:i=o.last,next:void 0,removed:!1},o.first||(o.first=s),i&&(i.next=s),IS?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},c=function(e,t){var r,i=a(e),n=RS(t);if("F"!==n)return i.index[n];for(r=i.first;r;r=r.next)if(r.key==t)return r};return SS(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,IS?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),i=c(t,e);if(i){var n=i.next,o=i.previous;delete r.index[i.index],i.removed=!0,o&&(o.next=n),n&&(n.previous=o),r.first==i&&(r.first=n),r.last==i&&(r.last=o),IS?r.size--:t.size--}return!!i},forEach:function(e){for(var t,r=a(this),i=ES(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(i(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),SS(o,r?{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)}}),IS&&vS(o,"size",{get:function(){return a(this).size}}),n},setStrong:function(e,t,r){var i=t+" Iterator",n=CS(t),o=CS(i);bS(e,t,(function(e,t){AS(this,{type:i,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?"keys"==t?{value:r.key,done:!1}:"values"==t?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),TS(t)}};_S("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),OS);var NS=Me,wS=on;Yi({target:"Object",stat:!0,forced:a((function(){wS(1)}))},{keys:function(e){return wS(NS(e))}});var DS=me,PS=Me,kS=M,MS=ii,US=n.TypeError,LS=function(e){return function(t,r,i,n){DS(r);var o=PS(t),a=kS(o),s=MS(o),c=e?s-1:0,u=e?-1:1;if(i<2)for(;;){if(c in a){n=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw US("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(n=r(n,a[c],c,o));return n}},xS={left:LS(!1),right:LS(!0)},VS=xS.left,FS=te,BS=pu;Yi({target:"Array",proto:!0,forced:!jn("reduce")||!BS&&FS>79&&FS<83},{reduce:function(e){var t=arguments.length;return VS(this,e,t,t>1?arguments[1]:void 0)}});var jS,GS=Yi,HS=I,zS=o.f,KS=ti,YS=fo,XS=L_,WS=L,JS=V_,qS=HS("".endsWith),ZS=HS("".slice),$S=Math.min,QS=JS("endsWith");GS({target:"String",proto:!0,forced:!!(QS||(jS=zS(String.prototype,"endsWith"),!jS||jS.writable))&&!QS},{endsWith:function(e){var t=YS(WS(this));XS(e);var r=arguments.length>1?arguments[1]:void 0,i=t.length,n=void 0===r?i:$S(KS(r),i),o=YS(e);return qS?qS(t,o,n):ZS(t,n-o.length,n)===o}});var eE=!0,tE=!0;function rE(e,t,r){var i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function iE(e,t,r){if(e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);var o=function(e){var t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};var o=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var i=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,i])},Object.defineProperty(i,"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 nE(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(eE=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function oE(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(tE=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function aE(){if("object"===("undefined"==typeof window?"undefined":t(window))){if(eE)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function sE(e,t){tE&&console.warn(e+" is deprecated, please use "+t+" instead.")}function cE(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var r=e.navigator;if(r.mozGetUserMedia)t.browser="firefox",t.version=rE(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=rE(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=rE(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function uE(e){return"[object Object]"===Object.prototype.toString.call(e)}function dE(e){return uE(e)?Object.keys(e).reduce((function(t,r){var i=uE(e[r]),n=i?dE(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,Jv({},r,n))}),{}):e}function lE(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(i){i.endsWith("Id")?lE(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((function(t){lE(e,e.get(t),r)}))})))}function hE(e,t,r){var i=r?"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(r){r.type===i&&r.trackId===t.id&&lE(e,r,n)}))})),n}var pE=Yi,fE=ba.find,_E=ah,vE="find",mE=!0;vE in[]&&Array(1).find((function(){mE=!1})),pE({target:"Array",proto:!0,forced:mE},{find:function(e){return fE(this,e,arguments.length>1?arguments[1]:void 0)}}),_E(vE);var SE=Yi,EE=n,yE=$r,gE=Wr,bE=ii,TE=Me,IE=fa,RE=Eo,AE=Kp("splice"),CE=EE.TypeError,OE=Math.max,NE=Math.min,wE=9007199254740991,DE="Maximum allowed length exceeded";SE({target:"Array",proto:!0,forced:!AE},{splice:function(e,t){var r,i,n,o,a,s,c=TE(this),u=bE(c),d=yE(e,u),l=arguments.length;if(0===l?r=i=0:1===l?(r=0,i=u-d):(r=l-2,i=NE(OE(gE(t),0),u-d)),u+r-i>wE)throw CE(DE);for(n=IE(c,i),o=0;o<i;o++)(a=d+o)in c&&RE(n,o,c[a]);if(n.length=i,r<i){for(o=d;o<u-i;o++)s=o+r,(a=o+i)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-i+r;o--)delete c[o-1]}else if(r>i)for(o=u-i;o>d;o--)s=o+r-1,(a=o+i-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<r;o++)c[o+d]=arguments[o+2];return c.length=u-i+r,n}});var PE=ba.map;Yi({target:"Array",proto:!0,forced:!Kp("map")},{map:function(e){return PE(this,e,arguments.length>1?arguments[1]:void 0)}});var kE=ba.filter;Yi({target:"Array",proto:!0,forced:!Kp("filter")},{filter:function(e){return kE(this,e,arguments.length>1?arguments[1]:void 0)}});var ME=I,UE=Me,LE=Math.floor,xE=ME("".charAt),VE=ME("".replace),FE=ME("".slice),BE=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,jE=/\$([$&'`]|\d{1,2})/g,GE=$n,HE=l,zE=I,KE=kv,YE=a,XE=kt,WE=B,JE=Wr,qE=ti,ZE=fo,$E=L,QE=Zv,ey=Ee,ty=function(e,t,r,i,n,o){var a=r+e.length,s=i.length,c=jE;return void 0!==n&&(n=UE(n),c=BE),VE(o,c,(function(o,c){var u;switch(xE(c,0)){case"$":return"$";case"&":return e;case"`":return FE(t,0,r);case"'":return FE(t,a);case"<":u=n[FE(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=LE(d/10);return 0===l?o:l<=s?void 0===i[l-1]?xE(c,1):i[l-1]+xE(c,1):o}u=i[d-1]}return void 0===u?"":u}))},ry=jv,iy=Qe("replace"),ny=Math.max,oy=Math.min,ay=zE([].concat),sy=zE([].push),cy=zE("".indexOf),uy=zE("".slice),dy="$0"==="a".replace(/./,"$0"),ly=!!/./[iy]&&""===/./[iy]("a","$0");KE("replace",(function(e,t,r){var i=ly?"$":"$0";return[function(e,r){var i=$E(this),n=null==e?void 0:ey(e,iy);return n?HE(n,e,i,r):HE(t,ZE(i),e,r)},function(e,n){var o=XE(this),a=ZE(e);if("string"==typeof n&&-1===cy(n,i)&&-1===cy(n,"$<")){var s=r(t,o,a,n);if(s.done)return s.value}var c=WE(n);c||(n=ZE(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=ry(o,a);if(null===h)break;if(sy(l,h),!u)break;""===ZE(h[0])&&(o.lastIndex=QE(a,qE(o.lastIndex),d))}for(var p,f="",_=0,v=0;v<l.length;v++){for(var m=ZE((h=l[v])[0]),S=ny(oy(JE(h.index),a.length),0),E=[],y=1;y<h.length;y++)sy(E,void 0===(p=h[y])?p:String(p));var g=h.groups;if(c){var b=ay([m],E,S,a);void 0!==g&&sy(b,g);var T=ZE(GE(n,void 0,b))}else T=ty(m,a,S,E,g,n);S>=_&&(f+=uy(a,_,S)+T,_=S+m.length)}return f+uy(a,_)}]}),!!YE((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!dy||ly);var hy=s,py=n,fy=I,_y=Vi,vy=eS,my=Xt,Sy=Ct.f,Ey=Kr.f,yy=X,gy=k_,by=fo,Ty=Y_,Iy=Z_,Ry=Wt.exports,Ay=a,Cy=xe,Oy=Or.enforce,Ny=cc,wy=ev,Dy=iv,Py=Qe("match"),ky=py.RegExp,My=ky.prototype,Uy=py.SyntaxError,Ly=fy(Ty),xy=fy(My.exec),Vy=fy("".charAt),Fy=fy("".replace),By=fy("".indexOf),jy=fy("".slice),Gy=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Hy=/a/g,zy=/a/g,Ky=new ky(Hy)!==Hy,Yy=Iy.MISSED_STICKY,Xy=Iy.UNSUPPORTED_Y,Wy=hy&&(!Ky||Yy||wy||Dy||Ay((function(){return zy[Py]=!1,ky(Hy)!=Hy||ky(zy)==zy||"/a/i"!=ky(Hy,"i")})));if(_y("RegExp",Wy)){for(var Jy=function(e,t){var r,i,n,o,a,s,c=yy(My,this),u=gy(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===Jy)return e;if((u||yy(My,e))&&(e=e.source,d&&(t="flags"in h?h.flags:Ly(h))),e=void 0===e?"":by(e),t=void 0===t?"":by(t),h=e,wy&&"dotAll"in Hy&&(i=!!t&&By(t,"s")>-1)&&(t=Fy(t,/s/g,"")),r=t,Yy&&"sticky"in Hy&&(n=!!t&&By(t,"y")>-1)&&Xy&&(t=Fy(t,/y/g,"")),Dy&&(o=function(e){for(var t,r=e.length,i=0,n="",o=[],a={},s=!1,c=!1,u=0,d="";i<=r;i++){if("\\"===(t=Vy(e,i)))t+=Vy(e,++i);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:xy(Gy,jy(e,i+1))&&(i+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||Cy(a,d))throw new Uy("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=vy(ky(e,t),c?this:My,Jy),(i||n||l.length)&&(s=Oy(a),i&&(s.dotAll=!0,s.raw=Jy(function(e){for(var t,r=e.length,i=0,n="",o=!1;i<=r;i++)"\\"!==(t=Vy(e,i))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+Vy(e,++i);return n}(e),r)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{my(a,"source",""===h?"(?:)":h)}catch(e){}return a},qy=function(e){e in Jy||Sy(Jy,e,{configurable:!0,get:function(){return ky[e]},set:function(t){ky[e]=t}})},Zy=Ey(ky),$y=0;Zy.length>$y;)qy(Zy[$y++]);My.constructor=Jy,Jy.prototype=My,Ry(py,"RegExp",Jy)}Ny("RegExp");var Qy=I,eg=Mr.PROPER,tg=Wt.exports,rg=kt,ig=X,ng=fo,og=a,ag=Y_,sg="toString",cg=RegExp.prototype,ug=cg.toString,dg=Qy(ag),lg=og((function(){return"/a/b"!=ug.call({source:"a",flags:"b"})})),hg=eg&&ug.name!=sg;(lg||hg)&&tg(RegExp.prototype,sg,(function(){var e=rg(this),t=ng(e.source),r=e.flags;return"/"+t+"/"+ng(void 0===r&&ig(cg,e)&&!("flags"in cg)?dg(e):r)}),{unsafe:!0});var pg=ba.some;Yi({target:"Array",proto:!0,forced:!jn("some")},{some:function(e){return pg(this,e,arguments.length>1?arguments[1]:void 0)}});var fg=s,_g=Mr.EXISTS,vg=I,mg=Ct.f,Sg=Function.prototype,Eg=vg(Sg.toString),yg=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,gg=vg(yg.exec);fg&&!_g&&mg(Sg,"name",{configurable:!0,get:function(){try{return gg(yg,Eg(this))[1]}catch(e){return""}}});var bg=I,Tg=me,Ig=G,Rg=xe,Ag=Do,Cg=c,Og=n.Function,Ng=bg([].concat),wg=bg([].join),Dg={},Pg=function(e,t,r){if(!Rg(Dg,t)){for(var i=[],n=0;n<t;n++)i[n]="a["+n+"]";Dg[t]=Og("C,a","return new C("+wg(i,",")+")")}return Dg[t](e,r)},kg=Cg?Og.bind:function(e){var t=Tg(this),r=t.prototype,i=Ag(arguments,1),n=function(){var r=Ng(i,Ag(arguments));return this instanceof n?Pg(t,r.length,r):t.apply(e,r)};return Ig(r)&&(n.prototype=r),n},Mg=kg;Yi({target:"Function",proto:!0,forced:Function.bind!==Mg},{bind:Mg});var Ug=aE;function Lg(e,r){var i=e&&e.navigator;if(i.mediaDevices){var n=function(e){if("object"!==t(e)||e.mandatory||e.optional)return e;var r={};return Object.keys(e).forEach((function(i){if("require"!==i&&"advanced"!==i&&"mediaSource"!==i){var n="object"===t(e[i])?e[i]:{ideal:e[i]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){r.optional=r.optional||[];var a={};"number"==typeof n.ideal?(a[o("min",i)]=n.ideal,r.optional.push(a),(a={})[o("max",i)]=n.ideal,r.optional.push(a)):(a[o("",i)]=n.ideal,r.optional.push(a))}void 0!==n.exact&&"number"!=typeof n.exact?(r.mandatory=r.mandatory||{},r.mandatory[o("",i)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(r.mandatory=r.mandatory||{},r.mandatory[o(e,i)]=n[e])}))}})),e.advanced&&(r.optional=(r.optional||[]).concat(e.advanced)),r},o=function(e,o){if(r.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===t(e.audio)){var a=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===t(e.video)){var s=e.video.facingMode;s=s&&("object"===t(s)?s:{ideal:s});var c,u=r.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!i.mediaDevices.getSupportedConstraints||!i.mediaDevices.getSupportedConstraints().facingMode||u))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?c=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(c=["front"]),c)return i.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return c.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&c.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=s.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),Ug("chrome: "+JSON.stringify(e)),o(e)}));e.video=n(e.video)}return Ug("chrome: "+JSON.stringify(e)),o(e)},a=function(e){return r.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){o(e,(function(e){i.webkitGetUserMedia(e,t,(function(e){r&&r(a(e))}))}))}.bind(i),i.mediaDevices.getUserMedia){var s=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(e){return o(e,(function(e){return s(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(a(e))}))}))}}}}function xg(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Vg(e){if("object"===t(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 r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var t=this;return this._ontrackpoly||(this._ontrackpoly=function(r){r.stream.addEventListener("addtrack",(function(i){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===i.track.id})):{track:i.track};var o=new Event("track");o.track=i.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[r.stream],t.dispatchEvent(o)})),r.stream.getTracks().forEach((function(i){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===i.id})):{track:i};var o=new Event("track");o.track=i,o.receiver=n,o.transceiver={receiver:n},o.streams=[r.stream],t.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),r.apply(this,arguments)}}else iE(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Fg(e){if("object"===t(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var r=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,t){var n=i.apply(this,arguments);return n||(n=r(this,e),this._senders.push(n)),n};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var o=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){t._senders.push(r(t,e))}))};var a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],a.apply(this,[e]),e.getTracks().forEach((function(e){var r=t._senders.find((function(t){return t.track===e}));r&&t._senders.splice(t._senders.indexOf(r),1)}))}}else if("object"===t(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.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 Bg(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),i=r[0],n=r[1],o=r[2];if(arguments.length>0&&"function"==typeof i)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof i))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),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,i])}return new Promise((function(r,i){t.apply(e,[function(e){r(s(a(e)))},i])})).then(n,o)}}}function jg(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var r=e.RTCPeerConnection.prototype.getSenders;r&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=r.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});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 hE(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),iE(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 hE(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var o=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,i,n=arguments[0];return this.getSenders().forEach((function(e){e.track===n&&(t?i=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===n&&(r?i=!0:r=e),e.track===n})),i||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return o.apply(this,arguments)}}}}function Gg(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,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};var r=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 i=this.getSenders();r.apply(this,arguments);var n=this.getSenders().filter((function(e){return-1===i.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(n)};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.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(r){var i=t._shimmedLocalStreams[r].indexOf(e);-1!==i&&t._shimmedLocalStreams[r].splice(i,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),n.apply(this,arguments)}}function Hg(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Gg(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(r.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}i.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,r){var i=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[r.id];if(a)a.addTrack(t),Promise.resolve().then((function(){i.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[r.id]=s,this._reverseStreams[s.id]=r,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],i=Jv({},t,(function(){var e=this,t=arguments,i=arguments.length&&"function"==typeof arguments[0];return i?r.apply(this,[function(r){var i=s(e,r);t[0].apply(null,[i])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=i[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,r=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(i){r._streams[i].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[i])})),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 r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function zg(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],i=Jv({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=i[t]}))}function Kg(e,t){iE(e,"negotiationneeded",(function(e){var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var Yg=Object.freeze({__proto__:null,shimMediaStream:xg,shimOnTrack:Vg,shimGetSendersWithDtmf:Fg,shimGetStats:Bg,shimSenderReceiverGetStats:jg,shimAddTrackRemoveTrackWithNative:Gg,shimAddTrackRemoveTrack:Hg,shimPeerConnection:zg,fixNegotiationNeeded:Kg,shimGetUserMedia:Lg,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),Xg=n,Wg=a,Jg=fo,qg=fm.trim,Zg=I("".charAt),$g=Xg.parseFloat,Qg=Xg.Symbol,eb=Qg&&Qg.iterator,tb=1/$g("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||eb&&!Wg((function(){$g(Object(eb))}))?function(e){var t=qg(Jg(e)),r=$g(t);return 0===r&&"-"==Zg(t,0)?-0:r}:$g;Yi({global:!0,forced:parseFloat!=tb},{parseFloat:tb});var rb=Yi,ib=tc,nb=a,ob=Y,ab=B,sb=uu,cb=Ed,ub=Wt.exports;if(rb({target:"Promise",proto:!0,real:!0,forced:!!ib&&nb((function(){ib.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=sb(this,ob("Promise")),r=ab(e);return this.then(r?function(r){return cb(t,e()).then((function(){return r}))}:e,r?function(r){return cb(t,e()).then((function(){throw r}))}:e)}}),ab(ib)){var db=ob("Promise").prototype.finally;ib.prototype.finally!==db&&ub(ib.prototype,"finally",db,{unsafe:!0})}function lb(e,r){var i=e&&e.navigator,n=e&&e.MediaStreamTrack;if(i.getUserMedia=function(e,t,r){sE("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(e).then(t,r)},!(r.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},a=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(e){return"object"===t(e)&&"object"===t(e.audio)&&(e=JSON.parse(JSON.stringify(e)),o(e.audio,"autoGainControl","mozAutoGainControl"),o(e.audio,"noiseSuppression","mozNoiseSuppression")),a(e)},n&&n.prototype.getSettings){var s=n.prototype.getSettings;n.prototype.getSettings=function(){var e=s.apply(this,arguments);return o(e,"mozAutoGainControl","autoGainControl"),o(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var c=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===t(e)&&(e=JSON.parse(JSON.stringify(e)),o(e,"autoGainControl","mozAutoGainControl"),o(e,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[e])}}}}function hb(e){"object"===t(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 pb(e,r){if("object"===t(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),r.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],i=Jv({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=i[t]}));var i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),t=e[0],o=e[1],a=e[2];return n.apply(this,[t||null]).then((function(e){if(r.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 fb(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var r=e.RTCPeerConnection.prototype.getSenders;r&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=r.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});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 _b(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("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}),iE(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function vb(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;sE("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function mb(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Sb(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype.addTransceiver;r&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],t=e&&"sendEncodings"in e;t&&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 i=r.apply(this,arguments);if(t){var n=i.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 i})}}function Eb(e){if("object"===t(e)&&e.RTCRtpSender){var r=e.RTCRtpSender.prototype.getParameters;r&&(e.RTCRtpSender.prototype.getParameters=function(){var e=r.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function yb(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,t=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return r.apply(t,e)})).finally((function(){t.setParametersPromises=[]})):r.apply(this,arguments)}}}function gb(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,t=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return r.apply(t,e)})).finally((function(){t.setParametersPromises=[]})):r.apply(this,arguments)}}}var bb=Object.freeze({__proto__:null,shimOnTrack:hb,shimPeerConnection:pb,shimSenderGetStats:fb,shimReceiverGetStats:_b,shimRemoveStream:vb,shimRTCDataChannel:mb,shimAddTransceiver:Sb,shimGetParameters:Eb,shimCreateOffer:yb,shimCreateAnswer:gb,shimGetUserMedia:lb,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function Tb(e){if("object"===t(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 r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(i){return r.call(t,i,e)})),e.getVideoTracks().forEach((function(i){return r.call(t,i,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var t=this,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return n&&n.forEach((function(e){t._localStreams?t._localStreams.includes(e)||t._localStreams.push(e):t._localStreams=[e]})),r.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var i=e.getTracks();this.getSenders().forEach((function(e){i.includes(e.track)&&t.removeTrack(e)}))}})}}function Ib(e){if("object"===t(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 r=new Event("addstream");r.stream=e,t.dispatchEvent(r)}}))})}});var r=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 r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),r.apply(e,arguments)}}}function Rb(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,i=r.createOffer,n=r.createAnswer,o=r.setLocalDescription,a=r.setRemoteDescription,s=r.addIceCandidate;r.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},r.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};var c=function(e,t,r){var i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};r.setLocalDescription=c,c=function(e,t,r){var i=a.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},r.setRemoteDescription=c,c=function(e,t,r){var i=s.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},r.addIceCandidate=c}}function Ab(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,i=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return i(Cb(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function Cb(e){return e&&void 0!==e.video?Object.assign({},e,{video:dE(e.video)}):e}function Ob(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var i=[],n=0;n<e.iceServers.length;n++){var o=e.iceServers[n];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(sE("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,i.push(o)):i.push(e.iceServers[n])}e.iceServers=i}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function Nb(e){"object"===t(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 wb(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&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.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var i=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&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.offerToReceiveVideo||i||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Db(e){"object"!==t(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Pb=Object.freeze({__proto__:null,shimLocalStreamsAPI:Tb,shimRemoteStreamsAPI:Ib,shimCallbacksAPI:Rb,shimGetUserMedia:Ab,shimConstraints:Cb,shimRTCIceServerUrls:Ob,shimTrackEventTransceiver:Nb,shimCreateOfferLegacy:wb,shimAudioContext:Db}),kb=Me,Mb=ct;Yi({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=kb(this),r=Mb(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}});var Ub=l;Yi({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Ub(URL.prototype.toString,this)}});var Lb=I(1..valueOf),xb=s,Vb=n,Fb=I,Bb=Vi,jb=Wt.exports,Gb=xe,Hb=eS,zb=X,Kb=le,Yb=ct,Xb=a,Wb=Kr.f,Jb=o.f,qb=Ct.f,Zb=Lb,$b=fm.trim,Qb="Number",eT=Vb.Number,tT=eT.prototype,rT=Vb.TypeError,iT=Fb("".slice),nT=Fb("".charCodeAt),oT=function(e){var t=Yb(e,"number");return"bigint"==typeof t?t:aT(t)},aT=function(e){var t,r,i,n,o,a,s,c,u=Yb(e,"number");if(Kb(u))throw rT("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=$b(u),43===(t=nT(u,0))||45===t){if(88===(r=nT(u,2))||120===r)return NaN}else if(48===t){switch(nT(u,1)){case 66:case 98:i=2,n=49;break;case 79:case 111:i=8,n=55;break;default:return+u}for(a=(o=iT(u,2)).length,s=0;s<a;s++)if((c=nT(o,s))<48||c>n)return NaN;return parseInt(o,i)}return+u};if(Bb(Qb,!eT(" 0o1")||!eT("0b1")||eT("+0x1"))){for(var sT,cT=function(e){var t=arguments.length<1?0:eT(oT(e)),r=this;return zb(tT,r)&&Xb((function(){Zb(r)}))?Hb(Object(t),r,cT):t},uT=xb?Wb(eT):"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(","),dT=0;uT.length>dT;dT++)Gb(eT,sT=uT[dT])&&!Gb(cT,sT)&&qb(cT,sT,Jb(eT,sT));cT.prototype=tT,tT.constructor=cT,jb(Vb,Qb,cT)}var lT=Yi,hT=M,pT=F,fT=jn,_T=I([].join),vT=hT!=Object,mT=fT("join",",");lT({target:"Array",proto:!0,forced:vT||!mT},{join:function(e){return _T(pT(this),void 0===e?",":e)}});var ST=$n,ET=l,yT=I,gT=kv,bT=k_,TT=kt,IT=L,RT=uu,AT=Zv,CT=ti,OT=fo,NT=Ee,wT=Ro,DT=jv,PT=Iv,kT=a,MT=Z_.UNSUPPORTED_Y,UT=4294967295,LT=Math.min,xT=[].push,VT=yT(/./.exec),FT=yT(xT),BT=yT("".slice),jT=!kT((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]}));gT("split",(function(e,t,r){var i;return i="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,r){var i=OT(IT(this)),n=void 0===r?UT:r>>>0;if(0===n)return[];if(void 0===e)return[i];if(!bT(e))return ET(t,i,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=ET(PT,l,i))&&!((a=l.lastIndex)>d&&(FT(c,BT(i,d,o.index)),o.length>1&&o.index<i.length&&ST(xT,c,wT(o,1)),s=o[0].length,d=a,c.length>=n));)l.lastIndex===o.index&&l.lastIndex++;return d===i.length?!s&&VT(l,"")||FT(c,""):FT(c,BT(i,d)),c.length>n?wT(c,0,n):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:ET(t,this,e,r)}:t,[function(t,r){var n=IT(this),o=null==t?void 0:NT(t,e);return o?ET(o,t,n,r):ET(i,OT(n),t,r)},function(e,n){var o=TT(this),a=OT(e),s=r(i,o,a,n,i!==t);if(s.done)return s.value;var c=RT(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(MT?"g":"y"),l=new c(MT?"^(?:"+o.source+")":o,d),h=void 0===n?UT:n>>>0;if(0===h)return[];if(0===a.length)return null===DT(l,a)?[a]:[];for(var p=0,f=0,_=[];f<a.length;){l.lastIndex=MT?0:f;var v,m=DT(l,MT?BT(a,f):a);if(null===m||(v=LT(CT(l.lastIndex+(MT?f:0)),a.length))===p)f=AT(a,f,u);else{if(FT(_,BT(a,p,f)),_.length===h)return _;for(var S=1;S<=m.length-1;S++)if(FT(_,m[S]),_.length===h)return _;f=p=v}}return FT(_,BT(a,p)),_}]}),!jT,MT);var GT=Mr.PROPER,HT=a,zT=am,KT=fm.trim;Yi({target:"String",proto:!0,forced:function(e){return HT((function(){return!!zT[e]()||"
"!=="
"[e]()||GT&&zT[e].name!==e}))}("trim")},{trim:function(){return KT(this)}});var YT={exports:{}};!function(e){var r={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};r.localCName=r.generateIdentifier(),r.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},r.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},r.getDescription=function(e){var t=r.splitSections(e);return t&&t[0]},r.getMediaSections=function(e){var t=r.splitSections(e);return t.shift(),t},r.matchPrefix=function(e,t){return r.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},r.parseCandidate=function(e){for(var t,r={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]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":r.relatedAddress=t[i+1];break;case"rport":r.relatedPort=parseInt(t[i+1],10);break;case"tcptype":r.tcpType=t[i+1];break;case"ufrag":r.ufrag=t[i+1],r.usernameFragment=t[i+1];break;default:void 0===r[t[i]]&&(r[t[i]]=t[i+1])}return r},r.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var i=e.type;return t.push("typ"),t.push(i),"host"!==i&&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(" ")},r.parseIceOptions=function(e){return e.substr(14).split(" ")},r.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},r.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},r.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]}},r.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},r.parseFmtp=function(e){for(var t,r={},i=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<i.length;n++)r[(t=i[n].trim().split("="))[0].trim()]=t[1];return r},r.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var i=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},r.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},r.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},r.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+1)):r.attribute=e.substr(t+1),r},r.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},r.getMid=function(e){var t=r.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},r.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},r.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:r.matchPrefix(e+t,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},r.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)}},r.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===t(e.keyParams)?r.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},r.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}},r.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},r.getCryptoParameters=function(e,t){return r.matchPrefix(e+t,"a=crypto:").map(r.parseCryptoLine)},r.getIceParameters=function(e,t){var i=r.matchPrefix(e+t,"a=ice-ufrag:")[0],n=r.matchPrefix(e+t,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substr(12),password:n.substr(10)}:null},r.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},r.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=r.splitLines(e)[0].split(" "),n=3;n<i.length;n++){var o=i[n],a=r.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=r.parseRtpMap(a),c=r.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?r.parseFmtp(c[0]):{},s.rtcpFeedback=r.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(r.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return r.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(r.parseExtmap(e))})),t},r.writeRtpDescription=function(e,t){var i="";i+="m="+e+" ",i+=t.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=t.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){i+=r.writeRtpMap(e),i+=r.writeFmtp(e),i+=r.writeRtcpFb(e)}));var n=0;return t.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){i+=r.writeExtmap(e)})),i},r.parseRtpEncodingParameters=function(e){var t,i=[],n=r.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=r.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&&(t=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var r={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&t&&(r.rtx={ssrc:t}),i.push(r),o&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},i.push(r))}})),0===i.length&&c&&i.push({ssrc:c});var d=r.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,i.forEach((function(e){e.maxBitrate=d}))),i},r.parseRtcpParameters=function(e){var t={},i=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];i&&(t.cname=i.value,t.ssrc=i.ssrc);var n=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var o=r.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},r.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},r.parseMsid=function(e){var t,i=r.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(t=i[0].substr(7).split(" "))[0],track:t[1]};var n=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(t=n[0].value.split(" "))[0],track:t[1]}:void 0},r.parseSctpDescription=function(e){var t,i=r.parseMLine(e),n=r.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var o=r.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:i.fmt,maxMessageSize:t};var a=r.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:t}}},r.writeSctpDescription=function(e,t){var r=[];return r="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&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},r.generateSessionId=function(){return Math.random().toString().substr(2,21)},r.writeSessionBoilerplate=function(e,t,i){var n=void 0!==t?t:2;return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||r.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.getDirection=function(e,t){for(var i=r.splitLines(e),n=0;n<i.length;n++)switch(i[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[n].substr(2)}return t?r.getDirection(t):"sendrecv"},r.getKind=function(e){return r.splitLines(e)[0].split(" ")[0].substr(2)},r.isRejected=function(e){return"0"===e.split(" ",2)[1]},r.parseMLine=function(e){var t=r.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},r.parseOLine=function(e){var t=r.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},r.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=r.splitLines(e),i=0;i<t.length;i++)if(t[i].length<2||"="!==t[i].charAt(1))return!1;return!0},e.exports=r}(YT);var XT=YT.exports,WT=Object.freeze(e({__proto__:null,default:XT},[YT.exports]));function JT(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var r=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===t(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 r(e),n=XT.parseCandidate(e.candidate),o=Object.assign(i,n);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new r(e)},e.RTCIceCandidate.prototype=r.prototype,iE(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function qT(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 r=function(e){if(!e||!e.sdp)return!1;var t=XT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=XT.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},i=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r},n=function(e){var r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){var i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);var n=XT.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i},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(r(arguments[0])){var c,u=i(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 ZT(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 r(e,this),e},iE(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var i=arguments[0],n=i.length||i.size||i.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 r.apply(e,arguments)}}}function $T(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 r=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 r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function QT(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var i=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:i}):t.sdp=i}return r.apply(this,arguments)}}}function eI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.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():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function tI(e,r){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.setLocalDescription;i&&0!==i.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,r=arguments[0]||{};if("object"!==t(r)||r.type&&r.sdp)return i.apply(this,arguments);if(!(r={type:r.type,sdp:r.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":r.type="offer";break;default:r.type="answer"}if(r.sdp||"offer"!==r.type&&"answer"!==r.type)return i.apply(this,[r]);var n="offer"===r.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return i.apply(e,[t])}))})}}var rI=Object.freeze({__proto__:null,shimRTCIceCandidate:JT,shimMaxMessageSize:qT,shimSendThrowTypeError:ZT,shimConnectionState:$T,removeExtmapAllowMixed:QT,shimAddIceCandidateNullOrEmpty:eI,shimParameterlessSetLocalDescription:tI});!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},i=aE,n=cE(t),o={browserDetails:n,commonShim:rI,extractVersion:rE,disableLog:nE,disableWarnings:oE,sdp:WT};switch(n.browser){case"chrome":if(!Yg||!zg||!r.shimChrome)return i("Chrome shim is not included in this adapter release."),o;if(null===n.version)return i("Chrome shim can not determine version, not shimming."),o;i("adapter.js shimming chrome."),o.browserShim=Yg,eI(t,n),tI(t),Lg(t,n),xg(t),zg(t,n),Vg(t),Hg(t,n),Fg(t),Bg(t),jg(t),Kg(t,n),JT(t),$T(t),qT(t,n),ZT(t),QT(t,n);break;case"firefox":if(!bb||!pb||!r.shimFirefox)return i("Firefox shim is not included in this adapter release."),o;i("adapter.js shimming firefox."),o.browserShim=bb,eI(t,n),tI(t),lb(t,n),pb(t,n),hb(t),vb(t),fb(t),_b(t),mb(t),Sb(t),Eb(t),yb(t),gb(t),JT(t),$T(t),qT(t,n),ZT(t);break;case"safari":if(!Pb||!r.shimSafari)return i("Safari shim is not included in this adapter release."),o;i("adapter.js shimming safari."),o.browserShim=Pb,eI(t,n),tI(t),Ob(t),wb(t),Rb(t),Tb(t),Ib(t),Nb(t),Ab(t),Db(t),JT(t),qT(t,n),ZT(t),QT(t,n);break;default:i("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),Yi({target:"Array",stat:!0},{isArray:eo});var iI=Ro,nI=Math.floor,oI=function(e,t){var r=e.length,i=nI(r/2);return r<8?aI(e,t):sI(e,oI(iI(e,0,i),t),oI(iI(e,i),t),t)},aI=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},sI=function(e,t,r,i){for(var n=t.length,o=r.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?i(t[a],r[s])<=0?t[a++]:r[s++]:a<n?t[a++]:r[s++];return e},cI=oI,uI=W.match(/firefox\/(\d+)/i),dI=!!uI&&+uI[1],lI=/MSIE|Trident/.test(W),hI=W.match(/AppleWebKit\/(\d+)\./),pI=!!hI&&+hI[1],fI=Yi,_I=I,vI=me,mI=Me,SI=ii,EI=fo,yI=a,gI=cI,bI=jn,TI=dI,II=lI,RI=te,AI=pI,CI=[],OI=_I(CI.sort),NI=_I(CI.push),wI=yI((function(){CI.sort(void 0)})),DI=yI((function(){CI.sort(null)})),PI=bI("sort"),kI=!yI((function(){if(RI)return RI<70;if(!(TI&&TI>3)){if(II)return!0;if(AI)return AI<603;var e,t,r,i,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(i=0;i<47;i++)CI.push({k:t+i,v:r})}for(CI.sort((function(e,t){return t.v-e.v})),i=0;i<CI.length;i++)t=CI[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));fI({target:"Array",proto:!0,forced:wI||!DI||!PI||!kI},{sort:function(e){void 0!==e&&vI(e);var t=mI(this);if(kI)return void 0===e?OI(t):OI(t,e);var r,i,n=[],o=SI(t);for(i=0;i<o;i++)i in t&&NI(n,t[i]);for(gI(n,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:EI(t)>EI(r)?1:-1}}(e)),r=n.length,i=0;i<r;)t[i]=n[i++];for(;i<o;)delete t[i++];return t}});var MI="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,UI=Wr,LI=ti,xI=n.RangeError,VI=function(e){if(void 0===e)return 0;var t=UI(e),r=LI(t);if(t!==r)throw xI("Wrong length or index");return r},FI=n.Array,BI=Math.abs,jI=Math.pow,GI=Math.floor,HI=Math.log,zI=Math.LN2,KI={pack:function(e,t,r){var i,n,o,a=FI(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?jI(2,-24)-jI(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=BI(e))!=e||e===1/0?(n=e!=e?1:0,i=c):(i=GI(HI(e)/zI),e*(o=jI(2,-i))<1&&(i--,o*=2),(e+=i+u>=1?d/o:d*jI(2,1-u))*o>=2&&(i++,o/=2),i+u>=c?(n=0,i=c):i+u>=1?(n=(e*o-1)*jI(2,t),i+=u):(n=e*jI(2,u-1)*jI(2,t),i=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(i=i<<t|n,s+=t;s>0;)a[h++]=255&i,i/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,i=e.length,n=8*i-t-1,o=(1<<n)-1,a=o>>1,s=n-7,c=i-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:u?-1/0:1/0;r+=jI(2,t),d-=a}return(u?-1:1)*r*jI(2,d-t)}},YI=Me,XI=$r,WI=ii,JI=function(e){for(var t=YI(this),r=WI(t),i=arguments.length,n=XI(i>1?arguments[1]:void 0,r),o=i>2?arguments[2]:void 0,a=void 0===o?r:XI(o,r);a>n;)t[n++]=e;return t},qI=n,ZI=I,$I=s,QI=MI,eR=Mr,tR=Xt,rR=ic,iR=a,nR=lc,oR=Wr,aR=ti,sR=VI,cR=KI,uR=vh,dR=en,lR=Kr.f,hR=Ct.f,pR=JI,fR=Ro,_R=Go,vR=eR.PROPER,mR=eR.CONFIGURABLE,SR=Or.get,ER=Or.set,yR="ArrayBuffer",gR="DataView",bR="Wrong index",TR=qI.ArrayBuffer,IR=TR,RR=IR&&IR.prototype,AR=qI.DataView,CR=AR&&AR.prototype,OR=Object.prototype,NR=qI.Array,wR=qI.RangeError,DR=ZI(pR),PR=ZI([].reverse),kR=cR.pack,MR=cR.unpack,UR=function(e){return[255&e]},LR=function(e){return[255&e,e>>8&255]},xR=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},VR=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},FR=function(e){return kR(e,23,4)},BR=function(e){return kR(e,52,8)},jR=function(e,t){hR(e.prototype,t,{get:function(){return SR(this)[t]}})},GR=function(e,t,r,i){var n=sR(r),o=SR(e);if(n+t>o.byteLength)throw wR(bR);var a=SR(o.buffer).bytes,s=n+o.byteOffset,c=fR(a,s,s+t);return i?c:PR(c)},HR=function(e,t,r,i,n,o){var a=sR(r),s=SR(e);if(a+t>s.byteLength)throw wR(bR);for(var c=SR(s.buffer).bytes,u=a+s.byteOffset,d=i(+n),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(QI){var zR=vR&&TR.name!==yR;if(iR((function(){TR(1)}))&&iR((function(){new TR(-1)}))&&!iR((function(){return new TR,new TR(1.5),new TR(NaN),zR&&!mR})))zR&&mR&&tR(TR,"name",yR);else{(IR=function(e){return nR(this,RR),new TR(sR(e))}).prototype=RR;for(var KR,YR=lR(TR),XR=0;YR.length>XR;)(KR=YR[XR++])in IR||tR(IR,KR,TR[KR]);RR.constructor=IR}dR&&uR(CR)!==OR&&dR(CR,OR);var WR=new AR(new IR(2)),JR=ZI(CR.setInt8);WR.setInt8(0,2147483648),WR.setInt8(1,2147483649),!WR.getInt8(0)&&WR.getInt8(1)||rR(CR,{setInt8:function(e,t){JR(this,e,t<<24>>24)},setUint8:function(e,t){JR(this,e,t<<24>>24)}},{unsafe:!0})}else RR=(IR=function(e){nR(this,RR);var t=sR(e);ER(this,{bytes:DR(NR(t),0),byteLength:t}),$I||(this.byteLength=t)}).prototype,CR=(AR=function(e,t,r){nR(this,CR),nR(e,RR);var i=SR(e).byteLength,n=oR(t);if(n<0||n>i)throw wR("Wrong offset");if(n+(r=void 0===r?i-n:aR(r))>i)throw wR("Wrong length");ER(this,{buffer:e,byteLength:r,byteOffset:n}),$I||(this.buffer=e,this.byteLength=r,this.byteOffset=n)}).prototype,$I&&(jR(IR,"byteLength"),jR(AR,"buffer"),jR(AR,"byteLength"),jR(AR,"byteOffset")),rR(CR,{getInt8:function(e){return GR(this,1,e)[0]<<24>>24},getUint8:function(e){return GR(this,1,e)[0]},getInt16:function(e){var t=GR(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=GR(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return VR(GR(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return VR(GR(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return MR(GR(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return MR(GR(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){HR(this,1,e,UR,t)},setUint8:function(e,t){HR(this,1,e,UR,t)},setInt16:function(e,t){HR(this,2,e,LR,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){HR(this,2,e,LR,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){HR(this,4,e,xR,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){HR(this,4,e,xR,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){HR(this,4,e,FR,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){HR(this,8,e,BR,t,arguments.length>2?arguments[2]:void 0)}});_R(IR,yR),_R(AR,gR);var qR={ArrayBuffer:IR,DataView:AR},ZR=Yi,$R=I,QR=a,eA=kt,tA=$r,rA=ti,iA=uu,nA=qR.ArrayBuffer,oA=qR.DataView,aA=oA.prototype,sA=$R(nA.prototype.slice),cA=$R(aA.getUint8),uA=$R(aA.setUint8);ZR({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:QR((function(){return!new nA(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(sA&&void 0===t)return sA(eA(this),e);for(var r=eA(this).byteLength,i=tA(e,r),n=tA(void 0===t?r:t,r),o=new(iA(this,nA))(rA(n-i)),a=new oA(this),s=new oA(o),c=0;i<n;)uA(s,c++,cA(a,i++));return o}});var dA,lA,hA,pA={exports:{}},fA=MI,_A=s,vA=n,mA=B,SA=G,EA=xe,yA=lo,gA=pe,bA=Xt,TA=Wt.exports,IA=Ct.f,RA=X,AA=vh,CA=en,OA=Qe,NA=Ge,wA=vA.Int8Array,DA=wA&&wA.prototype,PA=vA.Uint8ClampedArray,kA=PA&&PA.prototype,MA=wA&&AA(wA),UA=DA&&AA(DA),LA=Object.prototype,xA=vA.TypeError,VA=OA("toStringTag"),FA=NA("TYPED_ARRAY_TAG"),BA=NA("TYPED_ARRAY_CONSTRUCTOR"),jA=fA&&!!CA&&"Opera"!==yA(vA.opera),GA=!1,HA={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},zA={BigInt64Array:8,BigUint64Array:8},KA=function(e){if(!SA(e))return!1;var t=yA(e);return EA(HA,t)||EA(zA,t)};for(dA in HA)(hA=(lA=vA[dA])&&lA.prototype)?bA(hA,BA,lA):jA=!1;for(dA in zA)(hA=(lA=vA[dA])&&lA.prototype)&&bA(hA,BA,lA);if((!jA||!mA(MA)||MA===Function.prototype)&&(MA=function(){throw xA("Incorrect invocation")},jA))for(dA in HA)vA[dA]&&CA(vA[dA],MA);if((!jA||!UA||UA===LA)&&(UA=MA.prototype,jA))for(dA in HA)vA[dA]&&CA(vA[dA].prototype,UA);if(jA&&AA(kA)!==UA&&CA(kA,UA),_A&&!EA(UA,VA))for(dA in GA=!0,IA(UA,VA,{get:function(){return SA(this)?this[FA]:void 0}}),HA)vA[dA]&&bA(vA[dA],FA,dA);var YA={NATIVE_ARRAY_BUFFER_VIEWS:jA,TYPED_ARRAY_CONSTRUCTOR:BA,TYPED_ARRAY_TAG:GA&&FA,aTypedArray:function(e){if(KA(e))return e;throw xA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(mA(e)&&(!CA||RA(MA,e)))return e;throw xA(gA(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,i){if(_A){if(r)for(var n in HA){var o=vA[n];if(o&&EA(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}UA[e]&&!r||TA(UA,e,r?t:jA&&DA[e]||t,i)}},exportTypedArrayStaticMethod:function(e,t,r){var i,n;if(_A){if(CA){if(r)for(i in HA)if((n=vA[i])&&EA(n,e))try{delete n[e]}catch(e){}if(MA[e]&&!r)return;try{return TA(MA,e,r?t:jA&&MA[e]||t)}catch(e){}}for(i in HA)!(n=vA[i])||n[e]&&!r||TA(n,e,t)}},isView:function(e){if(!SA(e))return!1;var t=yA(e);return"DataView"===t||EA(HA,t)||EA(zA,t)},isTypedArray:KA,TypedArray:MA,TypedArrayPrototype:UA},XA=n,WA=a,JA=tu,qA=YA.NATIVE_ARRAY_BUFFER_VIEWS,ZA=XA.ArrayBuffer,$A=XA.Int8Array,QA=!qA||!WA((function(){$A(1)}))||!WA((function(){new $A(-1)}))||!JA((function(e){new $A,new $A(null),new $A(1.5),new $A(e)}),!0)||WA((function(){return 1!==new $A(new ZA(2),1,void 0).length})),eC=G,tC=Math.floor,rC=Number.isInteger||function(e){return!eC(e)&&isFinite(e)&&tC(e)===e},iC=Wr,nC=n.RangeError,oC=function(e){var t=iC(e);if(t<0)throw nC("The argument can't be less than 0");return t},aC=n.RangeError,sC=function(e,t){var r=oC(e);if(r%t)throw aC("Wrong offset");return r},cC=Yo,uC=l,dC=ou,lC=Me,hC=ii,pC=Oc,fC=gc,_C=vc,vC=YA.aTypedArrayConstructor,mC=Yi,SC=n,EC=l,yC=s,gC=QA,bC=YA,TC=qR,IC=lc,RC=S,AC=Xt,CC=rC,OC=ti,NC=VI,wC=sC,DC=lt,PC=xe,kC=lo,MC=G,UC=le,LC=Rn,xC=X,VC=en,FC=Kr.f,BC=function(e){var t,r,i,n,o,a,s=dC(this),c=lC(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=fC(c);if(h&&!_C(h))for(a=(o=pC(c,h)).next,c=[];!(n=uC(a,o)).done;)c.push(n.value);for(l&&u>2&&(d=cC(d,arguments[2])),r=hC(c),i=new(vC(s))(r),t=0;r>t;t++)i[t]=l?d(c[t],t):c[t];return i},jC=ba.forEach,GC=cc,HC=Ct,zC=o,KC=eS,YC=Or.get,XC=Or.set,WC=HC.f,JC=zC.f,qC=Math.round,ZC=SC.RangeError,$C=TC.ArrayBuffer,QC=$C.prototype,eO=TC.DataView,tO=bC.NATIVE_ARRAY_BUFFER_VIEWS,rO=bC.TYPED_ARRAY_CONSTRUCTOR,iO=bC.TYPED_ARRAY_TAG,nO=bC.TypedArray,oO=bC.TypedArrayPrototype,aO=bC.aTypedArrayConstructor,sO=bC.isTypedArray,cO="BYTES_PER_ELEMENT",uO="Wrong length",dO=function(e,t){aO(e);for(var r=0,i=t.length,n=new e(i);i>r;)n[r]=t[r++];return n},lO=function(e,t){WC(e,t,{get:function(){return YC(this)[t]}})},hO=function(e){var t;return xC(QC,e)||"ArrayBuffer"==(t=kC(e))||"SharedArrayBuffer"==t},pO=function(e,t){return sO(e)&&!UC(t)&&t in e&&CC(+t)&&t>=0},fO=function(e,t){return t=DC(t),pO(e,t)?RC(2,e[t]):JC(e,t)},_O=function(e,t,r){return t=DC(t),!(pO(e,t)&&MC(r)&&PC(r,"value"))||PC(r,"get")||PC(r,"set")||r.configurable||PC(r,"writable")&&!r.writable||PC(r,"enumerable")&&!r.enumerable?WC(e,t,r):(e[t]=r.value,e)};yC?(tO||(zC.f=fO,HC.f=_O,lO(oO,"buffer"),lO(oO,"byteOffset"),lO(oO,"byteLength"),lO(oO,"length")),mC({target:"Object",stat:!0,forced:!tO},{getOwnPropertyDescriptor:fO,defineProperty:_O}),pA.exports=function(e,t,r){var i=e.match(/\d+$/)[0]/8,n=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=SC[n],c=s,u=c&&c.prototype,d={},l=function(e,t){WC(e,t,{get:function(){return function(e,t){var r=YC(e);return r.view[o](t*i+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=YC(e);r&&(n=(n=qC(n))<0?0:n>255?255:255&n),o.view[a](t*i+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};tO?gC&&(c=t((function(e,t,r,n){return IC(e,u),KC(MC(t)?hO(t)?void 0!==n?new s(t,wC(r,i),n):void 0!==r?new s(t,wC(r,i)):new s(t):sO(t)?dO(c,t):EC(BC,c,t):new s(NC(t)),e,c)})),VC&&VC(c,nO),jC(FC(s),(function(e){e in c||AC(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,n){IC(e,u);var o,a,s,d=0,h=0;if(MC(t)){if(!hO(t))return sO(t)?dO(c,t):EC(BC,c,t);o=t,h=wC(r,i);var p=t.byteLength;if(void 0===n){if(p%i)throw ZC(uO);if((a=p-h)<0)throw ZC(uO)}else if((a=OC(n)*i)+h>p)throw ZC(uO);s=a/i}else s=NC(t),o=new $C(a=s*i);for(XC(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new eO(o)});d<s;)l(e,d++)})),VC&&VC(c,nO),u=c.prototype=LC(oO)),u.constructor!==c&&AC(u,"constructor",c),AC(u,rO,c),iO&&AC(u,iO,n),d[n]=c,mC({global:!0,forced:c!=s,sham:!tO},d),cO in c||AC(c,cO,i),cO in u||AC(u,cO,i),GC(n)}):pA.exports=function(){},(0,pA.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var vO=Me,mO=$r,SO=ii,EO=Math.min,yO=[].copyWithin||function(e,t){var r=vO(this),i=SO(r),n=mO(e,i),o=mO(t,i),a=arguments.length>2?arguments[2]:void 0,s=EO((void 0===a?i:mO(a,i))-o,i-n),c=1;for(o<n&&n<o+s&&(c=-1,o+=s-1,n+=s-1);s-- >0;)o in r?r[n]=r[o]:delete r[n],n+=c,o+=c;return r},gO=YA,bO=I(yO),TO=gO.aTypedArray;(0,gO.exportTypedArrayMethod)("copyWithin",(function(e,t){return bO(TO(this),e,t,arguments.length>2?arguments[2]:void 0)}));var IO=ba.every,RO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("every",(function(e){return IO(RO(this),e,arguments.length>1?arguments[1]:void 0)}));var AO=l,CO=JI,OO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return AO(CO,OO(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var NO=ii,wO=uu,DO=YA.TYPED_ARRAY_CONSTRUCTOR,PO=YA.aTypedArrayConstructor,kO=function(e){return PO(wO(e,e[DO]))},MO=function(e,t){for(var r=0,i=NO(t),n=new e(i);i>r;)n[r]=t[r++];return n},UO=kO,LO=ba.filter,xO=function(e,t){return MO(UO(e),t)},VO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("filter",(function(e){var t=LO(VO(this),e,arguments.length>1?arguments[1]:void 0);return xO(this,t)}));var FO=ba.find,BO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("find",(function(e){return FO(BO(this),e,arguments.length>1?arguments[1]:void 0)}));var jO=ba.findIndex,GO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("findIndex",(function(e){return jO(GO(this),e,arguments.length>1?arguments[1]:void 0)}));var HO=ba.forEach,zO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("forEach",(function(e){HO(zO(this),e,arguments.length>1?arguments[1]:void 0)}));var KO=ci.includes,YO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("includes",(function(e){return KO(YO(this),e,arguments.length>1?arguments[1]:void 0)}));var XO=ci.indexOf,WO=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("indexOf",(function(e){return XO(WO(this),e,arguments.length>1?arguments[1]:void 0)}));var JO=n,qO=a,ZO=I,$O=YA,QO=up,eN=Qe("iterator"),tN=JO.Uint8Array,rN=ZO(QO.values),iN=ZO(QO.keys),nN=ZO(QO.entries),oN=$O.aTypedArray,aN=$O.exportTypedArrayMethod,sN=tN&&tN.prototype,cN=!qO((function(){sN[eN].call([1])})),uN=!!sN&&sN.values&&sN[eN]===sN.values&&"values"===sN.values.name,dN=function(){return rN(oN(this))};aN("entries",(function(){return nN(oN(this))}),cN),aN("keys",(function(){return iN(oN(this))}),cN),aN("values",dN,cN||!uN,{name:"values"}),aN(eN,dN,cN||!uN,{name:"values"});var lN=YA.aTypedArray,hN=YA.exportTypedArrayMethod,pN=I([].join);hN("join",(function(e){return pN(lN(this),e)}));var fN=$n,_N=F,vN=Wr,mN=ii,SN=jn,EN=Math.min,yN=[].lastIndexOf,gN=!!yN&&1/[1].lastIndexOf(1,-0)<0,bN=SN("lastIndexOf"),TN=gN||!bN?function(e){if(gN)return fN(yN,this,arguments)||0;var t=_N(this),r=mN(t),i=r-1;for(arguments.length>1&&(i=EN(i,vN(arguments[1]))),i<0&&(i=r+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:yN,IN=$n,RN=TN,AN=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return IN(RN,AN(this),t>1?[e,arguments[1]]:[e])}));var CN=ba.map,ON=kO,NN=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("map",(function(e){return CN(NN(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(ON(e))(t)}))}));var wN=xS.left,DN=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return wN(DN(this),e,t,t>1?arguments[1]:void 0)}));var PN=xS.right,kN=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return PN(kN(this),e,t,t>1?arguments[1]:void 0)}));var MN=YA.aTypedArray,UN=YA.exportTypedArrayMethod,LN=Math.floor;UN("reverse",(function(){for(var e,t=this,r=MN(t).length,i=LN(r/2),n=0;n<i;)e=t[n],t[n++]=t[--r],t[r]=e;return t}));var xN=n,VN=l,FN=YA,BN=ii,jN=sC,GN=Me,HN=a,zN=xN.RangeError,KN=xN.Int8Array,YN=KN&&KN.prototype,XN=YN&&YN.set,WN=FN.aTypedArray,JN=FN.exportTypedArrayMethod,qN=!HN((function(){var e=new Uint8ClampedArray(2);return VN(XN,e,{length:1,0:3},1),3!==e[1]})),ZN=qN&&FN.NATIVE_ARRAY_BUFFER_VIEWS&&HN((function(){var e=new KN(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));JN("set",(function(e){WN(this);var t=jN(arguments.length>1?arguments[1]:void 0,1),r=GN(e);if(qN)return VN(XN,this,r,t);var i=this.length,n=BN(r),o=0;if(n+t>i)throw zN("Wrong length");for(;o<n;)this[t+o]=r[o++]}),!qN||ZN);var $N=kO,QN=Do,ew=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=QN(ew(this),e,t),i=$N(this),n=0,o=r.length,a=new i(o);o>n;)a[n]=r[n++];return a}),a((function(){new Int8Array(1).slice()})));var tw=ba.some,rw=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("some",(function(e){return tw(rw(this),e,arguments.length>1?arguments[1]:void 0)}));var iw=n,nw=I,ow=a,aw=me,sw=cI,cw=YA,uw=dI,dw=lI,lw=te,hw=pI,pw=iw.Array,fw=cw.aTypedArray,_w=cw.exportTypedArrayMethod,vw=iw.Uint16Array,mw=vw&&nw(vw.prototype.sort),Sw=!(!mw||ow((function(){mw(new vw(2),null)}))&&ow((function(){mw(new vw(2),{})}))),Ew=!!mw&&!ow((function(){if(lw)return lw<74;if(uw)return uw<67;if(dw)return!0;if(hw)return hw<602;var e,t,r=new vw(516),i=pw(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,i[e]=e-2*t+3;for(mw(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==i[e])return!0}));_w("sort",(function(e){return void 0!==e&&aw(e),Ew?mw(this,e):sw(fw(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!Ew||Sw);var yw=ti,gw=$r,bw=kO,Tw=YA.aTypedArray;(0,YA.exportTypedArrayMethod)("subarray",(function(e,t){var r=Tw(this),i=r.length,n=gw(e,i);return new(bw(r))(r.buffer,r.byteOffset+n*r.BYTES_PER_ELEMENT,yw((void 0===t?i:gw(t,i))-n))}));var Iw=$n,Rw=YA,Aw=a,Cw=Do,Ow=n.Int8Array,Nw=Rw.aTypedArray,ww=Rw.exportTypedArrayMethod,Dw=[].toLocaleString,Pw=!!Ow&&Aw((function(){Dw.call(new Ow(1))}));ww("toLocaleString",(function(){return Iw(Dw,Pw?Cw(Nw(this)):Nw(this),Cw(arguments))}),Aw((function(){return[1,2].toLocaleString()!=new Ow([1,2]).toLocaleString()}))||!Aw((function(){Ow.prototype.toLocaleString.call([1,2])})));var kw=YA.exportTypedArrayMethod,Mw=a,Uw=I,Lw=n.Uint8Array,xw=Lw&&Lw.prototype||{},Vw=[].toString,Fw=Uw([].join);Mw((function(){Vw.call({})}))&&(Vw=function(){return Fw(this)});var Bw=xw.toString!=Vw;kw("toString",Vw,Bw);var jw=Yi,Gw=n,Hw=$n,zw=B,Kw=Do,Yw=lu,Xw=/MSIE .\./.test(W),Ww=Gw.Function,Jw=function(e){return function(t,r){var i=Yw(arguments.length,1)>2,n=zw(t)?t:Ww(t),o=i?Kw(arguments,2):void 0;return e(i?function(){Hw(n,this,o)}:n,r)}};jw({global:!0,bind:!0,forced:Xw},{setTimeout:Jw(Gw.setTimeout),setInterval:Jw(Gw.setInterval)});var qw=Yi,Zw=ba.findIndex,$w=ah,Qw="findIndex",eD=!0;Qw in[]&&Array(1).findIndex((function(){eD=!1})),qw({target:"Array",proto:!0,forced:eD},{findIndex:function(e){return Zw(this,e,arguments.length>1?arguments[1]:void 0)}}),$w(Qw);var tD,rD,iD=cc,nD="ArrayBuffer",oD=qR.ArrayBuffer;Yi({global:!0,forced:n.ArrayBuffer!==oD},{ArrayBuffer:oD}),iD(nD),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",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"}(tD||(tD={})),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"}(rD||(rD={}));var aD=function(e,t,r){this.code=e,this.message=t,this.error=r},sD=s,cD=I,uD=on,dD=F,lD=cD(h.f),hD=cD([].push),pD=function(e){return function(t){for(var r,i=dD(t),n=uD(i),o=n.length,a=0,s=[];o>a;)r=n[a++],sD&&!lD(i,r)||hD(s,e?[r,i[r]]:i[r]);return s}},fD={entries:pD(!0),values:pD(!1)}.entries;Yi({target:"Object",stat:!0},{entries:function(e){return fD(e)}});var _D=Wr,vD=fo,mD=L,SD=n.RangeError,ED=function(e){var t=vD(mD(this)),r="",i=_D(e);if(i<0||i==1/0)throw SD("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(r+=t);return r},yD=I,gD=ti,bD=fo,TD=L,ID=yD(ED),RD=yD("".slice),AD=Math.ceil,CD=function(e){return function(t,r,i){var n,o,a=bD(TD(t)),s=gD(r),c=a.length,u=void 0===i?" ":bD(i);return s<=c||""==u?a:((o=ID(u,AD((n=s-c)/u.length))).length>n&&(o=RD(o,0,n)),e?a+o:o+a)}},OD={start:CD(!1),end:CD(!0)},ND=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(W),wD=OD.end;Yi({target:"String",proto:!0,forced:ND},{padEnd:function(e){return wD(this,e,arguments.length>1?arguments[1]:void 0)}});var DD=Am;Yi({target:"Number",stat:!0,forced:Number.parseInt!=DD},{parseInt:DD});Yi({target:"ArrayBuffer",stat:!0,forced:!YA.NATIVE_ARRAY_BUFFER_VIEWS},{isView:YA.isView}),Yi({global:!0,forced:!MI},{DataView:qR.DataView});var PD=kt,kD=Pc,MD=Yo,UD=l,LD=Me,xD=function(e,t,r,i){try{return i?t(PD(r)[0],r[1]):t(r)}catch(t){kD(e,"throw",t)}},VD=vc,FD=aa,BD=ii,jD=Eo,GD=Oc,HD=gc,zD=n.Array,KD=function(e){var t=LD(e),r=FD(this),i=arguments.length,n=i>1?arguments[1]:void 0,o=void 0!==n;o&&(n=MD(n,i>2?arguments[2]:void 0));var a,s,c,u,d,l,h=HD(t),p=0;if(!h||this==zD&&VD(h))for(a=BD(t),s=r?new this(a):zD(a);a>p;p++)l=o?n(t[p],p):t[p],jD(s,p,l);else for(d=(u=GD(t,h)).next,s=r?new this:[];!(c=UD(d,u)).done;p++)l=o?xD(u,n,[c.value,p],!0):c.value,jD(s,p,l);return s.length=p,s},YD=KD;Yi({target:"Array",stat:!0,forced:!tu((function(e){Array.from(e)}))},{from:YD});var XD=Yi,WD=eo,JD=I([].reverse),qD=[1,2];XD({target:"Array",proto:!0,forced:String(qD)===String(qD.reverse())},{reverse:function(){return WD(this)&&(this.length=this.length),JD(this)}});var ZD=Yi,$D=n,QD=I,eP=Wr,tP=Lb,rP=ED,iP=a,nP=$D.RangeError,oP=$D.String,aP=Math.floor,sP=QD(rP),cP=QD("".slice),uP=QD(1..toFixed),dP=function(e,t,r){return 0===t?r:t%2==1?dP(e,t-1,r*e):dP(e*e,t/2,r)},lP=function(e,t,r){for(var i=-1,n=r;++i<6;)n+=t*e[i],e[i]=n%1e7,n=aP(n/1e7)},hP=function(e,t){for(var r=6,i=0;--r>=0;)i+=e[r],e[r]=aP(i/t),i=i%t*1e7},pP=function(e){for(var t=6,r="";--t>=0;)if(""!==r||0===t||0!==e[t]){var i=oP(e[t]);r=""===r?i:r+sP("0",7-i.length)+i}return r};ZD({target:"Number",proto:!0,forced:iP((function(){return"0.000"!==uP(8e-5,3)||"1"!==uP(.9,0)||"1.25"!==uP(1.255,2)||"1000000000000000128"!==uP(0xde0b6b3a7640080,0)}))||!iP((function(){uP({})}))},{toFixed:function(e){var t,r,i,n,o=tP(this),a=eP(e),s=[0,0,0,0,0,0],c="",u="0";if(a<0||a>20)throw nP("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return oP(o);if(o<0&&(c="-",o=-o),o>1e-21)if(r=(t=function(e){for(var t=0,r=e;r>=4096;)t+=12,r/=4096;for(;r>=2;)t+=1,r/=2;return t}(o*dP(2,69,1))-69)<0?o*dP(2,-t,1):o/dP(2,t,1),r*=4503599627370496,(t=52-t)>0){for(lP(s,0,r),i=a;i>=7;)lP(s,1e7,0),i-=7;for(lP(s,dP(10,i,1),0),i=t-1;i>=23;)hP(s,1<<23),i-=23;hP(s,1<<i),lP(s,1,1),hP(s,2),u=pP(s)}else lP(s,0,r),lP(s,1<<-t,0),u=pP(s)+sP("0",a);return u=a>0?c+((n=u.length)<=a?"0."+sP("0",a-n)+u:cP(u,0,n-a)+"."+cP(u,n-a)):c+u}});var fP,_P=Math.log,vP=Math.LOG10E;Yi({target:"Math",stat:!0},{log10:Math.log10||function(e){return _P(e)*vP}});var mP=new Uint8Array(16);function SP(){if(!fP&&!(fP="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 fP(mP)}var EP=/^(?:[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 yP(e){return"string"==typeof e&&EP.test(e)}for(var gP=[],bP=0;bP<256;++bP)gP.push((bP+256).toString(16).substr(1));function TP(e,t,r){var i=(e=e||{}).random||(e.rng||SP)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){r=r||0;for(var n=0;n<16;++n)t[r+n]=i[n];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(gP[e[t+0]]+gP[e[t+1]]+gP[e[t+2]]+gP[e[t+3]]+"-"+gP[e[t+4]]+gP[e[t+5]]+"-"+gP[e[t+6]]+gP[e[t+7]]+"-"+gP[e[t+8]]+gP[e[t+9]]+"-"+gP[e[t+10]]+gP[e[t+11]]+gP[e[t+12]]+gP[e[t+13]]+gP[e[t+14]]+gP[e[t+15]]).toLowerCase();if(!yP(r))throw TypeError("Stringified UUID is invalid");return r}(i)}var IP=new TextDecoder,RP=new TextEncoder,AP=function(){return TP()},CP=function(){return Date.now()};function OP(e){for(var t,r,i,n,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=Qf(o),u=c.next();!u.done;u=c.next()){s+=(f=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=Qf(o),p=h.next();!p.done;p=h.next()){var f=p.value;d.set(f,l),l+=f.length}}catch(e){i={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}return d}var NP=function(){return"undefined"==typeof window},wP=function(){function e(){}return e.token2auth=function(t,r,i,n){return n?"Bearer ".concat(n):"Basic ".concat(e.createUnsafeToken(t,r,i))},e.createUnsafeToken=function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))},e.merge=function(r,i){var n,o;void 0===r&&(r={}),void 0===i&&(i={});try{for(var a=Qf(Object.entries(r)),s=a.next();!s.done;s=a.next()){var c=e_(s.value,2),u=c[0],d=c[1];null!==d&&"object"===t(d)?e.merge(r[u],i[u]):void 0!==i[u]&&(r[u]=i[u])}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.ab2str=function(e){return IP.decode(e)},e.ab2obj=function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}},e.str2ab=function(e){return RP.encode(e).buffer},e.ab2b64str=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var r=new FileReader;r.onload=function(){return t(r.result)},r.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function DP(){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,r){var i=r===t.length-1?"0":"1";return Number.parseInt(i+e.join(""),2)}))}var PP=function(){return Math.floor(65535*Math.random())};function kP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function MP(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,i=r.byteLength,n=[];if(i>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return i-1-t})).reverse().map((function(e){return o.getUint8(e)}));n=t_(t_(t_([],e_(a),!1),["..."],!1),e_(s),!1)}else n=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(i,") [").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 UP=function(){return Zf(void 0,void 0,void 0,(function(){var e,t;return $f(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),e.addTransceiver("audio",{direction:"recvonly"}),e.addTransceiver("video",{direction:"recvonly"}),[4,e.createOffer()];case 1:return t=r.sent(),e.close(),[2,t.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))},LP=function(e){return new Promise((function(t,r){var i=(e=Array.isArray(e)?e:[]).length,n=[];0===i?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){i--,n.push(e),0===i&&r(n)}))}))}))};function xP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}var VP=function(){function e(){this._running=!1,this._queue=[]}return e.prototype.add=function(e,t){this._queue.push([e,t]),this._running||(this._running=!0,this._process())},e.prototype._process=function(){var e=this,t=e_(this._queue.shift()||[],2),r=t[0],i=t[1];r&&i?r.then((function(t){i(t),e._process()})).catch((function(){e._process()})):this._running=!1},e}();function FP(e,t){if("boolean"!=typeof e)throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function BP(e,t,r,i){if(void 0===r&&(r=1),void 0===i&&(i=Number.POSITIVE_INFINITY),e<r||e>i||"number"!=typeof e)throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(i,"]. integer only"))}function jP(e,t,r,i){if(void 0===r&&(r=1),void 0===i&&(i=Number.POSITIVE_INFINITY),null==e)throw new aD(tD.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,r){void 0===t&&(t=1);void 0===r&&(r=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=r&&e.length>=t}(e,r,i))throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(i,"]"))}function GP(e,t,r){if(!r.includes(e))throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function HP(e,t){if(YP(e))throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function zP(e,t){if(!(e instanceof ArrayBuffer))throw new aD(tD.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function KP(e){var t,r;try{var i=navigator.mediaDevices.getSupportedConstraints();try{for(var n=Qf(Object.keys(e)),o=n.next();!o.done;o=n.next()){var a=o.value;i[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}catch(e){}}function YP(e){return null==e}function XP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new aD(tD.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function WP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new aD(tD.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function JP(e){HP(e,"videoPlayerOption")}function qP(e,t){var r,i;if(void 0===t&&(t=64),!e||0===(null===(r=e)||void 0===r?void 0:r.byteLength))throw new aD(tD.INVALID_PARAMS,"The message cannot be empty");if((null==(i=e instanceof ArrayBuffer?e:wP.str2ab(JSON.stringify(e)))?void 0:i.byteLength)>1e3*t)throw new aD(tD.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function ZP(e){return![a_.onRemoteStreamStats,a_.onLocalStreamStats].includes(e)}var $P={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,i,o,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new n(i,o||e,a),c=r?r+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 i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,o=i.length,a=new Array(o);n<o;n++)a[n]=i[n].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,n,o,a){var s=r?r+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,i),!0;case 4:return d.fn.call(d.context,t,i,n),!0;case 5:return d.fn.call(d.context,t,i,n,o),!0;case 6:return d.fn.call(d.context,t,i,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,i);break;case 4:d[u].fn.call(d[u].context,t,i,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,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,i,n){var o=r?r+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||i&&s.context!==i||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||i&&s[c].context!==i)&&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=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}($P);var QP="[VERTC]",ek=["#0050b3","#0050b3","#0050b3","#0050b3"],tk=!NP()&&window.location.search.includes("_rtc_debug_"),rk=function(){function e(e,t,r){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(tk){for(var i="",n=0;n<this._indent;n++)i+=" ";console.log.apply(console,t_(["%c".concat(QP).concat(i,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(ek[this._indent],";")],e_(t),!1))}},e}(),ik=new rk("VERTC",0),nk=function(e){function t(){return e.call(this)||this}return Cf(t,e),t.prototype.safeEmit=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=this.listenerCount(t);try{return e.prototype.emit.apply(this,t_([t],e_(r),!1))}catch(e){return ik.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(n)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Zf(this,void 0,void 0,(function(){var r=this;return $f(this,(function(i){return[2,new Promise((function(i,n){try{r.emit.apply(r,t_(t_([e],e_(t),!1),[i,n],!1))}catch(t){ik.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}($P.exports.EventEmitter),ok=xe,ak=function(e){return void 0!==e&&(ok(e,"value")||ok(e,"writable"))},sk=l,ck=G,uk=kt,dk=ak,lk=o,hk=vh;Yi({target:"Reflect",stat:!0},{get:function e(t,r){var i,n,o=arguments.length<3?t:arguments[2];return uk(t)===o?t[r]:(i=lk.f(t,r))?dk(i)?i.value:void 0===i.get?void 0:sk(i.get,o):ck(n=hk(t))?e(n,r,o):void 0}});var pk=Yi,fk=l,_k=kt,vk=G,mk=ak,Sk=Ct,Ek=o,yk=vh,gk=S;var bk=a((function(){var e=function(){},t=Sk.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));pk({target:"Reflect",stat:!0,forced:bk},{set:function e(t,r,i){var n,o,a,s=arguments.length<4?t:arguments[3],c=Ek.f(_k(t),r);if(!c){if(vk(o=yk(t)))return e(o,r,i,s);c=gk(0)}if(mk(c)){if(!1===c.writable||!vk(s))return!1;if(n=Ek.f(s,r)){if(n.get||n.set||!1===n.writable)return!1;n.value=i,Sk.f(s,r,n)}else Sk.f(s,r,gk(0,i))}else{if(void 0===(a=c.set))return!1;fk(a,s,i)}return!0}});var Tk="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function Ik(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var Rk="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",Ak="rtc.rtcplus.com".split(","),Ck={VERSION:"4.42.4",ICE_CONFIG_REQUEST_URLS_INTERNAL:Tk.map(Ik),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:Rk,CONFIG_REQUEST_DOMAINS:Ak,CONNECTION_MODE:Wf.AUTO};function Ok(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(Ck.ICE_CONFIG_REQUEST_URLS=t.map(Ik))):void("LOG_SERVER_URL"!==e||t!==zf.overseas?"LOG_SERVER_URL"!==e||t!==zf.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?Ck[e]=t:Ck.LOG_SERVER_URL=t:Ck.LOG_SERVER_URL=Rk:Ck.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function Nk(e){return Ck[e]}function wk(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||Pk.audio.codec,bitRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.kBitRate)||Pk.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||Pk.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||Pk.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||Pk.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||Pk.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||Pk.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||Pk.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:Pk.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||Pk.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||Pk.video.width,height:(null===(f=t.video)||void 0===f?void 0:f.height)||Pk.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||Pk.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===(S=t.layout)||void 0===S?void 0:S.appData)||Pk.layout.appData}}}}function Dk(e,t,r){var i,n,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(i=r.video)||void 0===i?void 0:i.fps)||15,bitrate:1e3*((null===(n=r.video)||void 0===n?void 0:n.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||Xf.PREV_FRAME,canvas:{bgColor:(null===(c=r.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=r.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(l=null===(d=r.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 Pk={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"}},kk={width:640,height:360,frameRate:30,maxKbps:600},Mk={width:1920,height:1080,frameRate:15,maxKbps:3e3};(0,pA.exports)("Uint16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,pA.exports)("Int32",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var Uk={};!function(e){var r="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 r=Array.prototype.slice.call(arguments,1);r.length;){var n=r.shift();if(n){if("object"!==t(n))throw new TypeError(n+"must be non-object");for(var o in n)i(n,o)&&(e[o]=n[o])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var o=0;o<i;o++)e[n+o]=t[r+o]},flattenChunks:function(e){var t,r,i,n,o,a;for(i=0,t=0,r=e.length;t<r;t++)i+=e[t].length;for(a=new Uint8Array(i),n=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,n),n+=o.length;return a}},o={arraySet:function(e,t,r,i,n){for(var o=0;o<i;o++)e[n+o]=t[r+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,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,o))},e.setTyped(r)}(Uk);var Lk={},xk={},Vk={},Fk=Uk;function Bk(e){for(var t=e.length;--t>=0;)e[t]=0}var jk=256,Gk=286,Hk=30,zk=15,Kk=[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],Yk=[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],Xk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Wk=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Jk=new Array(576);Bk(Jk);var qk=new Array(60);Bk(qk);var Zk=new Array(512);Bk(Zk);var $k=new Array(256);Bk($k);var Qk=new Array(29);Bk(Qk);var eM,tM,rM,iM=new Array(Hk);function nM(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function oM(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function aM(e){return e<256?Zk[e]:Zk[256+(e>>>7)]}function sM(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function cM(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,sM(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function uM(e,t,r){cM(e,r[2*t],r[2*t+1])}function dM(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function lM(e,t,r){var i,n,o=new Array(16),a=0;for(i=1;i<=zk;i++)o[i]=a=a+r[i-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=dM(o[s]++,s))}}function hM(e){var t;for(t=0;t<Gk;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Hk;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 pM(e){e.bi_valid>8?sM(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 fM(e,t,r,i){var n=2*t,o=2*r;return e[n]<e[o]||e[n]===e[o]&&i[t]<=i[r]}function _M(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&fM(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!fM(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i}function vM(e,t,r){var i,n,o,a,s=0;if(0!==e.last_lit)do{i=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===i?uM(e,n,t):(uM(e,(o=$k[n])+jk+1,t),0!==(a=Kk[o])&&cM(e,n-=Qk[o],a),uM(e,o=aM(--i),r),0!==(a=Yk[o])&&cM(e,i-=iM[o],a))}while(s<e.last_lit);uM(e,256,t)}function mM(e,t){var r,i,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,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+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,r=e.heap_len>>1;r>=1;r--)_M(e,o,r);n=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],_M(e,o,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,o[2*n]=o[2*r]+o[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,o[2*r+1]=o[2*i+1]=n,e.heap[1]=n++,_M(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,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<=zk;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(i=e.heap[r])+1]+1]+1)>f&&(o=f,_++),c[2*i+1]=o,i>u||(e.bl_count[o]++,a=0,i>=p&&(a=h[i-p]),s=c[2*i],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*i+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(i=e.bl_count[o];0!==i;)(n=e.heap[--r])>u||(c[2*n+1]!==o&&(e.opt_len+=(o-c[2*n+1])*c[2*n],c[2*n+1]=o),i--)}}(e,t),lM(o,u,e.bl_count)}function SM(e,t,r){var i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=t[2*(i+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 EM(e,t,r){var i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),i=0;i<=r;i++)if(n=a,a=t[2*(i+1)+1],!(++s<c&&n===a)){if(s<u)do{uM(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(uM(e,n,e.bl_tree),s--),uM(e,16,e.bl_tree),cM(e,s-3,2)):s<=10?(uM(e,17,e.bl_tree),cM(e,s-3,3)):(uM(e,18,e.bl_tree),cM(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}Bk(iM);var yM=!1;function gM(e,t,r,i){cM(e,0+(i?1:0),3),function(e,t,r,i){pM(e),i&&(sM(e,r),sM(e,~r)),Fk.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}Vk._tr_init=function(e){yM||(!function(){var e,t,r,i,n,o=new Array(16);for(r=0,i=0;i<28;i++)for(Qk[i]=r,e=0;e<1<<Kk[i];e++)$k[r++]=i;for($k[r-1]=i,n=0,i=0;i<16;i++)for(iM[i]=n,e=0;e<1<<Yk[i];e++)Zk[n++]=i;for(n>>=7;i<Hk;i++)for(iM[i]=n<<7,e=0;e<1<<Yk[i]-7;e++)Zk[256+n++]=i;for(t=0;t<=zk;t++)o[t]=0;for(e=0;e<=143;)Jk[2*e+1]=8,e++,o[8]++;for(;e<=255;)Jk[2*e+1]=9,e++,o[9]++;for(;e<=279;)Jk[2*e+1]=7,e++,o[7]++;for(;e<=287;)Jk[2*e+1]=8,e++,o[8]++;for(lM(Jk,287,o),e=0;e<Hk;e++)qk[2*e+1]=5,qk[2*e]=dM(e,5);eM=new nM(Jk,Kk,257,Gk,zk),tM=new nM(qk,Yk,0,Hk,zk),rM=new nM(new Array(0),Xk,0,19,7)}(),yM=!0),e.l_desc=new oM(e.dyn_ltree,eM),e.d_desc=new oM(e.dyn_dtree,tM),e.bl_desc=new oM(e.bl_tree,rM),e.bi_buf=0,e.bi_valid=0,hM(e)},Vk._tr_stored_block=gM,Vk._tr_flush_block=function(e,t,r,i){var n,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&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<jk;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),mM(e,e.l_desc),mM(e,e.d_desc),a=function(e){var t;for(SM(e,e.dyn_ltree,e.l_desc.max_code),SM(e,e.dyn_dtree,e.d_desc.max_code),mM(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Wk[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=r+5,r+4<=n&&-1!==t?gM(e,t,r,i):4===e.strategy||o===n?(cM(e,2+(i?1:0),3),vM(e,Jk,qk)):(cM(e,4+(i?1:0),3),function(e,t,r,i){var n;for(cM(e,t-257,5),cM(e,r-1,5),cM(e,i-4,4),n=0;n<i;n++)cM(e,e.bl_tree[2*Wk[n]+1],3);EM(e,e.dyn_ltree,t-1),EM(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),vM(e,e.dyn_ltree,e.dyn_dtree)),hM(e),i&&pM(e)},Vk._tr_tally=function(e,t,r){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&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*($k[r]+jk+1)]++,e.dyn_dtree[2*aM(t)]++),e.last_lit===e.lit_bufsize-1},Vk._tr_align=function(e){cM(e,2,3),uM(e,256,Jk),function(e){16===e.bi_valid?(sM(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 bM=function(e,t,r,i){for(var n=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(n=n+t[i++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0};var TM=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var IM,RM=function(e,t,r,i){var n=TM,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},AM={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"},CM=Uk,OM=Vk,NM=bM,wM=RM,DM=AM,PM=-2,kM=258,MM=262,UM=103,LM=113,xM=666;function VM(e,t){return e.msg=DM[t],t}function FM(e){return(e<<1)-(e>4?9:0)}function BM(e){for(var t=e.length;--t>=0;)e[t]=0}function jM(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(CM.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function GM(e,t){OM._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,jM(e.strm)}function HM(e,t){e.pending_buf[e.pending++]=t}function zM(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function KM(e,t){var r,i,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-MM?e.strstart-(e.w_size-MM):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+kM,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[(r=t)+a]===f&&u[r+a-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(i=kM-(h-o),o=h-kM,i>a){if(e.match_start=t,a=i,i>=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 YM(e){var t,r,i,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-MM)){CM.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{i=e.head[--t],e.head[t]=i>=l?i-l:0}while(--r);t=r=l;do{i=e.prev[--t],e.prev[t]=i>=l?i-l:0}while(--r);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),r=0===d?0:(a.avail_in-=d,CM.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=NM(a.adler,s,d,c):2===a.state.wrap&&(a.adler=wM(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=r,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<MM&&0!==e.strm.avail_in)}function XM(e,t){for(var r,i;;){if(e.lookahead<MM){if(YM(e),e.lookahead<MM&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-MM&&(e.match_length=KM(e,r)),e.match_length>=3)if(i=OM._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,r=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 i=OM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(GM(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(GM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GM(e,!1),0===e.strm.avail_out)?1:2}function WM(e,t){for(var r,i,n;;){if(e.lookahead<MM){if(YM(e),e.lookahead<MM&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=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!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-MM&&(e.match_length=KM(e,r),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,i=OM._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,r=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++,i&&(GM(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=OM._tr_tally(e,0,e.window[e.strstart-1]))&&GM(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&&(i=OM._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(GM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GM(e,!1),0===e.strm.avail_out)?1:2}function JM(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}function qM(){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 CM.Buf16(1146),this.dyn_dtree=new CM.Buf16(122),this.bl_tree=new CM.Buf16(78),BM(this.dyn_ltree),BM(this.dyn_dtree),BM(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new CM.Buf16(16),this.heap=new CM.Buf16(573),BM(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new CM.Buf16(573),BM(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 ZM(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:LM,e.adler=2===t.wrap?0:1,t.last_flush=0,OM._tr_init(t),0):VM(e,PM)}function $M(e){var t,r=ZM(e);return 0===r&&((t=e.state).window_size=2*t.w_size,BM(t.head),t.max_lazy_match=IM[t.level].max_lazy,t.good_match=IM[t.level].good_length,t.nice_match=IM[t.level].nice_length,t.max_chain_length=IM[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),r}function QM(e,t,r,i,n,o){if(!e)return PM;var a=1;if(-1===t&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>9||8!==r||i<8||i>15||t<0||t>9||o<0||o>4)return VM(e,PM);8===i&&(i=9);var s=new qM;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=i,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 CM.Buf8(2*s.w_size),s.head=new CM.Buf16(s.hash_size),s.prev=new CM.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new CM.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=r,$M(e)}IM=[new JM(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(YM(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,GM(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-MM&&(GM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(GM(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(GM(e,!1),e.strm.avail_out),1)})),new JM(4,4,8,4,XM),new JM(4,5,16,8,XM),new JM(4,6,32,32,XM),new JM(4,4,16,16,WM),new JM(8,16,32,32,WM),new JM(8,16,128,128,WM),new JM(8,32,128,256,WM),new JM(32,128,258,1024,WM),new JM(32,258,258,4096,WM)],xk.deflateInit=function(e,t){return QM(e,t,8,15,8,0)},xk.deflateInit2=QM,xk.deflateReset=$M,xk.deflateResetKeep=ZM,xk.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?PM:(e.state.gzhead=t,0):PM},xk.deflate=function(e,t){var r,i,n,o;if(!e||!e.state||t>5||t<0)return e?VM(e,PM):PM;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||i.status===xM&&4!==t)return VM(e,0===e.avail_out?-5:PM);if(i.strm=e,r=i.last_flush,i.last_flush=t,42===i.status)if(2===i.wrap)e.adler=0,HM(i,31),HM(i,139),HM(i,8),i.gzhead?(HM(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),HM(i,255&i.gzhead.time),HM(i,i.gzhead.time>>8&255),HM(i,i.gzhead.time>>16&255),HM(i,i.gzhead.time>>24&255),HM(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),HM(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(HM(i,255&i.gzhead.extra.length),HM(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=wM(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(HM(i,0),HM(i,0),HM(i,0),HM(i,0),HM(i,0),HM(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),HM(i,3),i.status=LM);else{var a=8+(i.w_bits-8<<4)<<8;a|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(a|=32),a+=31-a%31,i.status=LM,zM(i,a),0!==i.strstart&&(zM(i,e.adler>>>16),zM(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>n&&(e.adler=wM(e.adler,i.pending_buf,i.pending-n,n)),jM(e),n=i.pending,i.pending!==i.pending_buf_size));)HM(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(e.adler=wM(e.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(e.adler=wM(e.adler,i.pending_buf,i.pending-n,n)),jM(e),n=i.pending,i.pending===i.pending_buf_size)){o=1;break}o=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,HM(i,o)}while(0!==o);i.gzhead.hcrc&&i.pending>n&&(e.adler=wM(e.adler,i.pending_buf,i.pending-n,n)),0===o&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(e.adler=wM(e.adler,i.pending_buf,i.pending-n,n)),jM(e),n=i.pending,i.pending===i.pending_buf_size)){o=1;break}o=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,HM(i,o)}while(0!==o);i.gzhead.hcrc&&i.pending>n&&(e.adler=wM(e.adler,i.pending_buf,i.pending-n,n)),0===o&&(i.status=UM)}else i.status=UM;if(i.status===UM&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&jM(e),i.pending+2<=i.pending_buf_size&&(HM(i,255&e.adler),HM(i,e.adler>>8&255),e.adler=0,i.status=LM)):i.status=LM),0!==i.pending){if(jM(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&FM(t)<=FM(r)&&4!==t)return VM(e,-5);if(i.status===xM&&0!==e.avail_in)return VM(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&i.status!==xM){var s=2===i.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(YM(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=OM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(GM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(GM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GM(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var r,i,n,o,a=e.window;;){if(e.lookahead<=kM){if(YM(e),e.lookahead<=kM&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+kM;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=kM-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=OM._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=OM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(GM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(GM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(GM(e,!1),0===e.strm.avail_out)?1:2}(i,t):IM[i.level].func(i,t);if(3!==s&&4!==s||(i.status=xM),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===s&&(1===t?OM._tr_align(i):5!==t&&(OM._tr_stored_block(i,0,0,!1),3===t&&(BM(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),jM(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(HM(i,255&e.adler),HM(i,e.adler>>8&255),HM(i,e.adler>>16&255),HM(i,e.adler>>24&255),HM(i,255&e.total_in),HM(i,e.total_in>>8&255),HM(i,e.total_in>>16&255),HM(i,e.total_in>>24&255)):(zM(i,e.adler>>>16),zM(i,65535&e.adler)),jM(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},xk.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==UM&&t!==LM&&t!==xM?VM(e,PM):(e.state=null,t===LM?VM(e,-3):0):PM},xk.deflateSetDictionary=function(e,t){var r,i,n,o,a,s,c,u,d=t.length;if(!e||!e.state)return PM;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return PM;for(1===o&&(e.adler=NM(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(BM(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new CM.Buf8(r.w_size),CM.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,YM(r);r.lookahead>=3;){i=r.strstart,n=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+3-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++}while(--n);r.strstart=i,r.lookahead=2,YM(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,r.wrap=o,0},xk.deflateInfo="pako deflate (from Nodeca project)";var eU={},tU=Uk,rU=!0,iU=!0;try{String.fromCharCode.apply(null,[0])}catch(e){rU=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){iU=!1}for(var nU=new tU.Buf8(256),oU=0;oU<256;oU++)nU[oU]=oU>=252?6:oU>=248?5:oU>=240?4:oU>=224?3:oU>=192?2:1;function aU(e,t){if(t<65534&&(e.subarray&&iU||!e.subarray&&rU))return String.fromCharCode.apply(null,tU.shrinkBuf(e,t));for(var r="",i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r}nU[254]=nU[254]=1,eU.string2buf=function(e){var t,r,i,n,o,a=e.length,s=0;for(n=0;n<a;n++)55296==(64512&(r=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=e.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new tU.Buf8(s),o=0,n=0;o<s;n++)55296==(64512&(r=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=e.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},eU.buf2binstring=function(e){return aU(e,e.length)},eU.binstring2buf=function(e){for(var t=new tU.Buf8(e.length),r=0,i=t.length;r<i;r++)t[r]=e.charCodeAt(r);return t},eU.buf2string=function(e,t){var r,i,n,o,a=t||e.length,s=new Array(2*a);for(i=0,r=0;r<a;)if((n=e[r++])<128)s[i++]=n;else if((o=nU[n])>4)s[i++]=65533,r+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&r<a;)n=n<<6|63&e[r++],o--;o>1?s[i++]=65533:n<65536?s[i++]=n:(n-=65536,s[i++]=55296|n>>10&1023,s[i++]=56320|1023&n)}return aU(s,i)},eU.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+nU[e[r]]>t?r:t};var sU=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},cU=xk,uU=Uk,dU=eU,lU=AM,hU=sU,pU=Object.prototype.toString;function fU(e){if(!(this instanceof fU))return new fU(e);this.options=uU.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 hU,this.strm.avail_out=0;var r=cU.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(lU[r]);if(t.header&&cU.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(i="string"==typeof t.dictionary?dU.string2buf(t.dictionary):"[object ArrayBuffer]"===pU.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=cU.deflateSetDictionary(this.strm,i)))throw new Error(lU[r]);this._dict_set=!0}}function _U(e,t){var r=new fU(t);if(r.push(e,!0),r.err)throw r.msg||lU[r.err];return r.result}fU.prototype.push=function(e,t){var r,i,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;i=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=dU.string2buf(e):"[object ArrayBuffer]"===pU.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 uU.Buf8(o),n.next_out=0,n.avail_out=o),1!==(r=cU.deflate(n,i))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(dU.buf2binstring(uU.shrinkBuf(n.output,n.next_out))):this.onData(uU.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==r);return 4===i?(r=cU.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==i||(this.onEnd(0),n.avail_out=0,!0)},fU.prototype.onData=function(e){this.chunks.push(e)},fU.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=uU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Lk.Deflate=fU,Lk.deflate=_U,Lk.deflateRaw=function(e,t){return(t=t||{}).raw=!0,_U(e,t)},Lk.gzip=function(e,t){return(t=t||{}).gzip=!0,_U(e,t)};var vU={},mU=s,SU=Ct,EU=Y_,yU=a,gU=RegExp.prototype;mU&&yU((function(){return"sy"!==Object.getOwnPropertyDescriptor(gU,"flags").get.call({dotAll:!0,sticky:!0})}))&&SU.f(gU,"flags",{configurable:!0,get:EU});var bU={},TU=Uk,IU=15,RU=[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],AU=[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],CU=[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],OU=[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],NU=Uk,wU=bM,DU=RM,PU=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A;r=e.state,i=e.next_in,R=e.input,n=i+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,p=r.hold,f=r.bits,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,S=(1<<r.distbits)-1;e:do{f<15&&(p+=R[i++]<<f,f+=8,p+=R[i++]<<f,f+=8),E=_[p&m];t:for(;;){if(p>>>=y=E>>>24,f-=y,0===(y=E>>>16&255))A[o++]=65535&E;else{if(!(16&y)){if(0==(64&y)){E=_[(65535&E)+(p&(1<<y)-1)];continue t}if(32&y){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}g=65535&E,(y&=15)&&(f<y&&(p+=R[i++]<<f,f+=8),g+=p&(1<<y)-1,p>>>=y,f-=y),f<15&&(p+=R[i++]<<f,f+=8,p+=R[i++]<<f,f+=8),E=v[p&S];r:for(;;){if(p>>>=y=E>>>24,f-=y,!(16&(y=E>>>16&255))){if(0==(64&y)){E=v[(65535&E)+(p&(1<<y)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&E,f<(y&=15)&&(p+=R[i++]<<f,(f+=8)<y&&(p+=R[i++]<<f,f+=8)),(b+=p&(1<<y)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=y,f-=y,b>(y=o-a)){if((y=b-y)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(T=0,I=h,0===l){if(T+=u-y,y<g){g-=y;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}}else if(l<y){if(T+=u+l-y,(y-=l)<g){g-=y;do{A[o++]=h[T++]}while(--y);if(T=0,l<g){g-=y=l;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}}}else if(T+=l-y,y<g){g-=y;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}for(;g>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],g-=3;g&&(A[o++]=I[T++],g>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],g-=3}while(g>2);g&&(A[o++]=A[T++],g>1&&(A[o++]=A[T++]))}break}}break}}while(i<n&&o<s);i-=g=f>>3,p&=(1<<(f-=g<<3))-1,e.next_in=i,e.next_out=o,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=p,r.bits=f},kU=function(e,t,r,i,n,o,a,s){var c,u,d,l,h,p,f,_,v,m=s.bits,S=0,E=0,y=0,g=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,N=0,w=new TU.Buf16(16),D=new TU.Buf16(16),P=null,k=0;for(S=0;S<=IU;S++)w[S]=0;for(E=0;E<i;E++)w[t[r+E]]++;for(b=m,g=IU;g>=1&&0===w[g];g--);if(b>g&&(b=g),0===g)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(y=1;y<g&&0===w[y];y++);for(b<y&&(b=y),R=1,S=1;S<=IU;S++)if(R<<=1,(R-=w[S])<0)return-1;if(R>0&&(0===e||1!==g))return-1;for(D[1]=0,S=1;S<IU;S++)D[S+1]=D[S]+w[S];for(E=0;E<i;E++)0!==t[r+E]&&(a[D[t[r+E]]++]=E);if(0===e?(O=P=a,p=19):1===e?(O=RU,N-=257,P=AU,k-=257,p=256):(O=CU,P=OU,p=-1),C=0,E=0,S=y,h=o,T=b,I=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){f=S-I,a[E]<p?(_=0,v=a[E]):a[E]>p?(_=P[k+a[E]],v=O[N+a[E]]):(_=96,v=0),c=1<<S-I,y=u=1<<T;do{n[h+(C>>I)+(u-=c)]=f<<24|_<<16|v|0}while(0!==u);for(c=1<<S-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,E++,0==--w[S]){if(S===g)break;S=t[r+a[E]]}if(S>b&&(C&l)!==d){for(0===I&&(I=b),h+=y,R=1<<(T=S-I);T+I<g&&!((R-=w[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;n[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(n[h+C]=S-I<<24|64<<16|0),s.bits=b,0},MU=-2,UU=12,LU=30;function xU(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function VU(){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 NU.Buf16(320),this.work=new NU.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function FU(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 NU.Buf32(852),t.distcode=t.distdyn=new NU.Buf32(592),t.sane=1,t.back=-1,0):MU}function BU(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,FU(e)):MU}function jU(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?MU:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,BU(e))):MU}function GU(e,t){var r,i;return e?(i=new VU,e.state=i,i.window=null,0!==(r=jU(e,t))&&(e.state=null),r):MU}var HU,zU,KU=!0;function YU(e){if(KU){var t;for(HU=new NU.Buf32(512),zU=new NU.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(kU(1,e.lens,0,288,HU,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;kU(2,e.lens,0,32,zU,0,e.work,{bits:5}),KU=!1}e.lencode=HU,e.lenbits=9,e.distcode=zU,e.distbits=5}function XU(e,t,r,i){var n,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new NU.Buf8(o.wsize)),i>=o.wsize?(NU.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>i&&(n=i),NU.arraySet(o.window,t,r-i,n,o.wnext),(i-=n)?(NU.arraySet(o.window,t,r-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}bU.inflateReset=BU,bU.inflateReset2=jU,bU.inflateResetKeep=FU,bU.inflateInit=function(e){return GU(e,15)},bU.inflateInit2=GU,bU.inflate=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A=0,C=new NU.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 MU;(r=e.state).mode===UU&&(r.mode=13),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,T=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,C[0]=255&u,C[1]=u>>>8&255,r.check=DU(r.check,C,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=LU;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=LU;break}if(d-=4,b=8+(15&(u>>>=4)),0===r.wbits)r.wbits=b;else if(b>r.wbits){e.msg="invalid window size",r.mode=LU;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:UU,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=LU;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=LU;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=DU(r.check,C,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.head&&(r.head.time=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,r.check=DU(r.check,C,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=DU(r.check,C,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=DU(r.check,C,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=r.length)>s&&(p=s),p&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),NU.arraySet(r.head.extra,i,o,p,b)),512&r.flags&&(r.check=DU(r.check,i,p,o)),s-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;p=0;do{b=i[o+p++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&r.flags&&(r.check=DU(r.check,i,p,o)),s-=p,o+=p,b)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;p=0;do{b=i[o+p++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&r.flags&&(r.check=DU(r.check,i,p,o)),s-=p,o+=p,b)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=LU;break}u=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=UU;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}e.adler=r.check=xU(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=UU;case UU:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(YU(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=LU}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=LU;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;NU.arraySet(n,i,o,p,a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=UU;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=LU;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.lens[O[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,I={bits:r.lenbits},T=kU(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid code lengths set",r.mode=LU;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(S<16)u>>>=v,d-=v,r.lens[r.have++]=S;else{if(16===S){for(R=v+2;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=LU;break}b=r.lens[r.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===S){for(R=v+3;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}d-=v,b=0,p=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(R=v+7;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}d-=v,b=0,p=11+(127&(u>>>=v)),u>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=LU;break}for(;p--;)r.lens[r.have++]=b}}if(r.mode===LU)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=LU;break}if(r.lenbits=9,I={bits:r.lenbits},T=kU(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid literal/lengths set",r.mode=LU;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},T=kU(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,T){e.msg="invalid distances set",r.mode=LU;break}if(r.mode=20,6===t)break e;case 20:r.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,r.hold=u,r.bits=d,PU(e,h),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===UU&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(m&&0==(240&m)){for(E=v,y=m,g=S;m=(A=r.lencode[g+((u&(1<<E+y)-1)>>E)])>>>16&255,S=65535&A,!(E+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}u>>>=E,d-=E,r.back+=E}if(u>>>=v,d-=v,r.back+=v,r.length=S,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=UU;break}if(64&m){e.msg="invalid literal/length code",r.mode=LU;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(R=r.extra;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<<r.distbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(0==(240&m)){for(E=v,y=m,g=S;m=(A=r.distcode[g+((u&(1<<E+y)-1)>>E)])>>>16&255,S=65535&A,!(E+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}u>>>=E,d-=E,r.back+=E}if(u>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=LU;break}r.offset=S,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(R=r.extra;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=LU;break}r.mode=25;case 25:if(0===c)break e;if(p=h-c,r.offset>p){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=LU;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),_=r.window}else _=n,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{n[a++]=_[f++]}while(--p);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;n[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=i[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?DU(r.check,n,h,a-h):wU(r.check,n,h,a-h)),h=c,(r.flags?u:xU(u))!==r.check){e.msg="incorrect data check",r.mode=LU;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=LU;break}u=0,d=0}r.mode=29;case 29:T=1;break e;case LU:T=-3;break e;case 31:return-4;default:return MU}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<LU&&(r.mode<27||4!==t))&&XU(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,r.total+=h,r.wrap&&h&&(e.adler=r.check=r.flags?DU(r.check,n,h,e.next_out-h):wU(r.check,n,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===UU?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},bU.inflateEnd=function(e){if(!e||!e.state)return MU;var t=e.state;return t.window&&(t.window=null),e.state=null,0},bU.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?MU:(r.head=t,t.done=!1,0):MU},bU.inflateSetDictionary=function(e,t){var r,i=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?MU:11===r.mode&&wU(1,t,i,0)!==r.check?-3:XU(e,t,i,i)?(r.mode=31,-4):(r.havedict=1,0):MU},bU.inflateInfo="pako inflate (from Nodeca project)";var WU={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 JU=bU,qU=Uk,ZU=eU,$U=WU,QU=AM,eL=sU,tL=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},rL=Object.prototype.toString;function iL(e){if(!(this instanceof iL))return new iL(e);this.options=qU.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 eL,this.strm.avail_out=0;var r=JU.inflateInit2(this.strm,t.windowBits);if(r!==$U.Z_OK)throw new Error(QU[r]);if(this.header=new tL,JU.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=ZU.string2buf(t.dictionary):"[object ArrayBuffer]"===rL.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=JU.inflateSetDictionary(this.strm,t.dictionary))!==$U.Z_OK))throw new Error(QU[r])}function nL(e,t){var r=new iL(t);if(r.push(e,!0),r.err)throw r.msg||QU[r.err];return r.result}iL.prototype.push=function(e,t){var r,i,n,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?$U.Z_FINISH:$U.Z_NO_FLUSH,"string"==typeof e?s.input=ZU.binstring2buf(e):"[object ArrayBuffer]"===rL.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 qU.Buf8(c),s.next_out=0,s.avail_out=c),(r=JU.inflate(s,$U.Z_NO_FLUSH))===$U.Z_NEED_DICT&&u&&(r=JU.inflateSetDictionary(this.strm,u)),r===$U.Z_BUF_ERROR&&!0===d&&(r=$U.Z_OK,d=!1),r!==$U.Z_STREAM_END&&r!==$U.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==$U.Z_STREAM_END&&(0!==s.avail_in||i!==$U.Z_FINISH&&i!==$U.Z_SYNC_FLUSH)||("string"===this.options.to?(n=ZU.utf8border(s.output,s.next_out),o=s.next_out-n,a=ZU.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&qU.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(qU.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)&&r!==$U.Z_STREAM_END);return r===$U.Z_STREAM_END&&(i=$U.Z_FINISH),i===$U.Z_FINISH?(r=JU.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===$U.Z_OK):i!==$U.Z_SYNC_FLUSH||(this.onEnd($U.Z_OK),s.avail_out=0,!0)},iL.prototype.onData=function(e){this.chunks.push(e)},iL.prototype.onEnd=function(e){e===$U.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=qU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},vU.Inflate=iL,vU.inflate=nL,vU.inflateRaw=function(e,t){return(t=t||{}).raw=!0,nL(e,t)},vU.ungzip=nL;var oL={};(0,Uk.assign)(oL,Lk,vU,WU);var aL,sL,cL,uL,dL,lL,hL,pL,fL,_L,vL,mL,SL,EL,yL,gL,bL,TL,IL,RL,AL,CL,OL,NL,wL,DL,PL,kL,ML,UL,LL,xL,VL,FL,BL,jL,GL,HL,zL,KL,YL,XL,WL,JL,qL,ZL,$L,QL=oL,ex=new rk("monitor",0);!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"}(aL||(aL={})),function(e){e.RTC="rtc"}(sL||(sL={})),function(e){e.W_5="5"}(cL||(cL={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(uL||(uL={})),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"}(dL||(dL={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(lL||(lL={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(hL||(hL={})),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"}(pL||(pL={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(fL||(fL={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(_L||(_L={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(vL||(vL={})),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"}(mL||(mL={})),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"}(SL||(SL={})),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"}(EL||(EL={})),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"}(yL||(yL={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(gL||(gL={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(bL||(bL={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(TL||(TL={})),function(e){e.W_0="0",e.W_1="1"}(IL||(IL={})),function(e){e.UP="up",e.DOWN="down"}(RL||(RL={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(AL||(AL={})),function(e){e.UP="up",e.DOWN="down"}(CL||(CL={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(OL||(OL={})),function(e){e.W_0="0",e.W_1="1"}(NL||(NL={})),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"}(wL||(wL={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(DL||(DL={})),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"}(PL||(PL={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(kL||(kL={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(ML||(ML={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(UL||(UL={})),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"}(LL||(LL={})),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"}(xL||(xL={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(VL||(VL={})),function(e){e.BEGIN="begin",e.END="end"}(FL||(FL={})),function(e){e.BEGIN="begin",e.END="end"}(BL||(BL={})),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"}(jL||(jL={})),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"}(GL||(GL={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(HL||(HL={})),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"}(zL||(zL={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(KL||(KL={})),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"}(YL||(YL={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(XL||(XL={})),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"}(WL||(WL={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(JL||(JL={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(qL||(qL={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(ZL||(ZL={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}($L||($L={}));var tx,rx,ix,nx,ox,ax,sx,cx,ux,dx,lx=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(r){t["_"+r]=e[r]})),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}),e}(),hx=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 lx(t),NP()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return Cf(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 r=this;if(e||this.dataBuffer.length){var i={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||(r.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||r.sucSend():e?r.send(e):(r.unshift(i.data),t?r.send():r.errSend())}};var o=Ck.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!NP()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",i),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!NP()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(i));else{var a=QL.gzip(JSON.stringify(i));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,r=t.event_key,i=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.connection_id,p=t.rtc_sid,f=t.engine_session_id,_=t.rtc_business_id,v=t.project_key,m=t.network_type,S=t.app_version,E=t.aid,y=t.device_model,g=t.device_brand,b=t.common_extra_info,T=t.had_selected_p2p,I=t.rtc_env_type,R=t.user_agent;Object.assign(e,{event_key:r,device_id:i,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,connection_id:h,rtc_sid:p,engine_session_id:f,rtc_business_id:_,project_key:v,network_type:m,app_version:S,aid:E,device_model:y,device_brand:g,common_extra_info:b,had_selected_p2p:T,rtc_env_type:I,user_agent:R}),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)},t.prototype.rtcSdkApiCall=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcSdkCallback=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcGetConfig=function(e,t,r,i,n,o,a,s){void 0===s&&(s={});var c=Jf(Jf({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:i,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,r,i,n){void 0===n&&(n={});var o=Jf(Jf({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcReconnected=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.rtcGetAccess=function(e,t,r,i,n,o,a){void 0===a&&(a={});var s=Jf(Jf({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:i,host:n,connect_session_id:o},this.modify_ids),{common_extra_info:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.rtcNodeChange=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcSignalingMsgError=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcSignaling=function(e,t,r,i,n,o){void 0===o&&(o={});var a=Jf(Jf({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:i,direction:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,r,i,n){void 0===n&&(n={});var o=Jf(Jf({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcBeginCreateOffer=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcCreateOffer=function(e,t,r,i,n,o){void 0===o&&(o={});var a=Jf(Jf({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:i,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,r,i,n,o,a,s){void 0===s&&(s={});var c=Jf(Jf({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:i,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,r,i,n,o,a,s){void 0===s&&(s={});var c=Jf(Jf({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:i,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,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.firstRemoteVideoRender=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.rtcPublishStat=function(e,t,r,i,n){void 0===n&&(n={});var o=Jf(Jf({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,r,i,n){void 0===n&&(n={});var o=Jf(Jf({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcMediaStatistics=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcMessageStatistics=function(e,t,r,i){void 0===i&&(i={});var n=Jf(Jf(Jf(Jf(Jf({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),{media_server_ip:r}),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcError=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.rtcInvokeStatus=function(e,t,r,i,n,o){void 0===o&&(o={});var a=Jf(Jf({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:i,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 r=Jf(Jf(Jf({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});ex.print("rtcFirstFrame",JSON.stringify(e)),this.push(r)},t.prototype.rtcMuteRemote=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now()},e),{media_type:t}),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.sdkInitEngine=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.joinRoom=function(e,t,r,i,n){void 0===n&&(n={});var o=Jf(Jf({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,r,i,n,o){void 0===o&&(o={});var a=Jf(Jf({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:i,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 r=Jf(Jf({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(r)},t.prototype.rtcDeviceError=function(e,t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v){void 0===v&&(v={});var m=Jf(Jf({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:i,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,r){void 0===r&&(r={});var i=Jf(Jf({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(r)});this.push(i)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var r=Jf(Jf(Jf({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(r)},t.prototype.rtcEncodeFirstFrame=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t.prototype.rtcFirstFrameEncoded=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t.prototype.rtcSendFirstPacket=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t.prototype.rtcRecvFirstPacket=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t.prototype.rtcRecvFirstFrame=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t.prototype.rtcDecodeFirstFrame=function(e,t,r){void 0===r&&(r={});var i=Jf(Jf(Jf(Jf({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(r)});this.push(i)},t}(nk),px=new hx,fx=new hx,_x=new hx,vx=px.commonStats,mx=fx.commonStats,Sx=_x.commonStats,Ex={default:px,rtm:fx,outsideRoom:_x};function yx(e){void 0===e&&(e="default");for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,i,n){if("function"==typeof n.value){var o=n.value;n.value=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var a={};t.forEach((function(e,t){a[e]=r[t]})),Ex[e].rtcSdkApiCall(i,0,JSON.stringify(MP(r)),a);var s=o.apply(this,r);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return Ex[e].rtcSdkCallback(i,0,JSON.stringify(MP([t||{}]))),t})).catch((function(t){throw Ex[e].rtcSdkCallback(i,t.code,JSON.stringify(t.message)),t})):(Ex[e].rtcSdkCallback(i,0,JSON.stringify(MP([s||{}]))),s)}}}}function gx(e,t,r){void 0===r&&(r=0),(e===a_.onUserMessageReceivedOutsideRoom||e===a_.onUserBinaryMessageReceivedOutsideRoom?fx:px).rtcSdkCallback(e,r,JSON.stringify(t))}function bx(e,t,r,i){void 0===r&&(r=0),void 0===i&&(i=!1),(i?fx:px).rtcInvokeStatus(JSON.stringify(t),r,e,"",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"}(tx||(tx={})),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"}(rx||(rx={})),function(e){e.RSCP="RSCP"}(ix||(ix={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(nx||(nx={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(ox||(ox={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(ax||(ax={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(cx||(cx={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(ux||(ux={})),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"}(dx||(dx={}));var Tx,Ix,Rx=((sx={})[dx.SUCCESS]=[0,"success"],sx[dx.TIMEOUT]=[tD.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],sx[dx.BROKEN]=[tD.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],sx[dx.NO_RECEIVER]=[tD.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],sx[dx.NO_RELAYPATH]=[tD.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],sx[dx.SEND_TO_SERVER_ERROR]=[tD.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],sx[dx.SERVER_RESPONSE_ERROR]=[tD.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],sx[dx.NOT_JOIN]=[tD.USER_MESSAGE_NOT_JOIN,"not join room"],sx[dx.INIT]=[tD.USER_MESSAGE_INIT,"not init."],sx[dx.NO_CONNECTION]=[tD.USER_MESSAGE_NO_CONNECTION,"no connection."],sx[dx.EXCEED_MAX_LENGTH]=[tD.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],sx[dx.EMPTY_USER]=[tD.USER_MESSAGE_EMPTY_USER,"user id is empty."],sx[dx.NOT_LOGIN]=[tD.USER_MESSAGE_NOT_LOGIN,"not login."],sx[dx.SERVER_PARAMS_NOTSET]=[tD.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],sx[dx.UNKNOWN]=[tD.USER_MESSAGE_UNKNOWN,"unknown."],sx),Ax=new rk("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(Tx||(Tx={})),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"}(Ix||(Ix={}));var Cx=function(e){function t(t){var r=e.call(this)||this;return r._dataChannel=t,r._singlingCache=new Map,r._p2pCache=new Map,r._rttIds={},r._p2pMessageId=0,r._asyncQueue=new VP,r._clearDataChannelListener=r._handleHandler(),window.__rtc_mock_signaling__=r.emit.bind(r),r}return Cf(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,r){var i=this;return px.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",gL.UP),new Promise((function(n,o){var a=i._genHeader(r);a.id=DP();var s=a.id.join("-"),c=setTimeout((function(){i._singlingCache.delete(s),o(new aD(tD.TIME_OUT,"".concat(e," message time out")))}),6e4);i._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),n(e)},error:function(e){clearTimeout(c),o(e)}}),Ax.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),i._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:Ix.C2GW})},t.prototype.sendP2PMessage=function(e,t){var r=e.msg,i=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(e,["msg"]);return Zf(this,void 0,void 0,(function(){var e,n,o,a,s;return $f(this,(function(c){switch(c.label){case 0:return e=r instanceof ArrayBuffer,n=this._sendP2PMessage,o=[Jf({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:cx.SEND,type:ux.P2P,err:dx.SUCCESS},i)],s={binary:e},e?[4,wP.ab2b64str(r)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=r,c.label=3;case 3:return[2,n.apply(this,[Jf.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var r=this;return void 0===t&&(t={}),kP(e.msg)?this._rttIds[e.id]=e.id:Ax.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(i,n){var o=r._genHeader(Jf(Jf({needAck:!0,functionType:Ix.C2C},t),{id:DP()}));if(e.dir===cx.SEND){var a=setTimeout((function(){r._p2pCache.delete(e.id),n(new aD(tD.TIME_OUT,"P2P message timeout"))}),6e4);r._p2pCache.set(e.id,{success:function(e){clearTimeout(a),i(e)},error:function(e){clearTimeout(a);var t=e_(Rx[e.err]||[tD.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],i=t[1];n({code:r,message:e.msg||i})}})}r._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new aD(tD.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var i=t.version+(+t.zip<<5)+(+t.encrypt<<6),n=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=wP.str2ab(JSON.stringify([e,r])),a=OP(Uint8Array,t_([i,n],e_(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),r=0,i=t[r++],n=t[r++],o={version:15&i,zip:16==(16&i),encrypt:32==(32&i),needAck:1==(1&n),direction:(2&n)>>1,functionType:(60&n)>>2,binary:64==(64&n)};if(o.needAck||o.direction===Tx.ACK){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}o.id=Array.from(t.slice(2,r))}return{header:o,data:t.slice(r)}},t.prototype._feedbackSignaling=function(e,t){var r=this._genHeader({needAck:!0,direction:Tx.ACK,id:e.split("-").map((function(e){return+e}))});Ax.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")},t.prototype._handleMessage=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A,C,O,N,w,D,P,k=this;return $f(this,(function(M){switch(M.label){case 0:i=this._dispartData(e),n=i.header,o=i.data,n.zip&&((a=new QL.Inflate).push(o,!0),o=a.result),s=wP.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&px.rtcSignalingMsgError(-1,e.message,EL.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case Ix.C2S:return[3,1];case Ix.C2C:return[3,6];case Ix.C2GW:return[3,15]}return[3,16];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==Tx.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],Ax.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,wP.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=M.sent(),M.label=4;case 4:this.emit(d,Jf({},c)),px.rtcSignaling(0,s,"on-".concat(d),"Recv",gL.DOWN),M.label=5;case 5:return[3,16];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)===cx.FEEDBACK||kP(null==c?void 0:c.msg)?delete this._rttIds[h]:Ax.print("Signal","<<<<<< p2p response",c),c.dir){case cx.SEND:return[3,7];case cx.FEEDBACK:return[3,13]}return[3,14];case 7:return kP(null==c?void 0:c.msg)?[3,12]:(f=(p=c).binary,_=p.msg,v=p.room,m=p.to,S=p.from,E=""===v?f?rx.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:rx.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:f?rx.USER_BINARY_MESSAGE_RECEIVED:rx.USER_MESSAGE_RECEIVED,m?[3,11]:(y=this.emit,g=[rx.ON_CUSTOM_MESSAGE],P={clientId:S,binary:f},f?[4,wP.b64str2ab(_)]:[3,9]));case 8:return b=M.sent(),[3,10];case 9:b=_,M.label=10;case 10:return y.apply(this,g.concat([(P.message=b,P)])),[3,14];case 11:f?this._asyncQueue.add(wP.b64str2ab(_),(function(e){return k.emit(E,Jf(Jf({},c),{msg:e}))})):this.emit(E,Jf(Jf({},c),{msg:_})),M.label=12;case 12:return this._sendP2PMessage(Jf(Jf({},c),{dir:cx.FEEDBACK,msg:""})),[3,14];case 13:return(T=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===dx.SUCCESS?T.success(c.id):T.error(c)),[3,14];case 14:return[3,16];case 15:if(n.direction===Tx.ACK)I=(null===(r=n.id)||void 0===r?void 0:r.join("-"))||"",this._handleAckMessage(I,c[0]||{},s);else if(R=e_(c,2),A=R[0],C=R[1],O=void 0===C?{}:C,"RXMediaMsg"===A&&(N=O.type,w=O.data,px.rtcSignaling(0,s,"on-".concat(N),"Recv",gL.DOWN),"RSCP"===N))try{D=JSON.parse(w),Array.isArray(D)&&this.emit(N,D)}catch(e){}M.label=16;case 16:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){Ax.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){Ax.print("_handleHandler","dataChannel error",t),e.emit("close",t)},i=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",i),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",i)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),Jf({version:2,zip:!1,encrypt:!1,needAck:!0,direction:Tx.SEND,functionType:Ix.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,r){var i=this._singlingCache.get(e);i&&(this._singlingCache.delete(e),200===t.code?i.success(t):i.error(t),Ax.print("Signal","<<<<<< [".concat(i.signalingType,"-ack]"),t)),px.rtcSignaling(0,r,null==i?void 0:i.signalingType,"Ack",gL.DOWN)},t}($P.exports.EventEmitter),Ox=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,r=e.method,i=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(r,i,!0);try{for(var l=Qf(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=e_(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"})},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,r,i){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:i})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),Nx="RTC_DEVICE_ID",wx="RTC_ACCESS_NODE",Dx="RTC_ACCESS_URLS",Px="RTC_H264_BLACK_LIST",kx=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(e){return null}},e.prototype.set=function(e,t,r){void 0===r&&(r=-1);var i={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(i)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),Mx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Cf(t,e),t.prototype.getDeviceId=function(){if(NP())return"";var e=this.get(Nx);return e||(e=TP()),this.set(Nx,e),e},t.prototype.getAccessNode=function(e){return this.get("".concat(wx,"_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,r){return this.set("".concat(wx,"_").concat(e,"-BytePlus"),t,1e3*r)},t.prototype.clearAccessNode=function(e){this.delete("".concat(wx,"_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat(Dx,"-BytePlus"))},t.prototype.setAccessUrls=function(e){var t=e.map((function(e){var t=e.host,r=e.path;return"https://".concat(t).concat(r)}));return this.set("".concat(Dx,"-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat(Dx,"-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get(Px)},t.prototype.setH264BlackList=function(e){return this.set(Px,e)},t}(kx),Ux=new Mx,Lx=new rk("ICE Request",3),xx=function(){function e(){this._request=new Ox}return e.prototype.getAccessNode=function(e,t,r,i,n,o,a){return Zf(this,void 0,void 0,(function(){var s;return $f(this,(function(c){return(s=Ux.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,r,i,n,o,a),bx("es.R.node.cache",s),[2,Promise.resolve(s)]):[2,this.getAccessNodeFromServer(e,t,r,i,n,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,r,i,n,o,a){return Zf(this,void 0,void 0,(function(){var s,c,u=this;return $f(this,(function(d){return s=Ux.getAccessUrls(),c=!0,bx("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=Ck.ICE_CONFIG_REQUEST_URLS,c=!1,bx("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=Ck.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,bx("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,r,i,n,o,a).then((function(t){var r=t.nodes[0];return Ux.setAccessNode(e,r,t.ttl||11200),t.dispatchDomains&&Ux.setAccessUrls(t.dispatchDomains),r})).catch((function(s){if(c)return bx("es.R.req.fallback",""),Ux.clearAccessUrls(),u.getAccessNodeFromServer(e,t,r,i,n,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,r,i,n,o,a,s){var c;return Zf(this,void 0,void 0,(function(){var r,u,d,l=this;return $f(this,(function(h){return r={appID:t,userID:i,deviceID:n,connectSessionID:AP(),os:"web",sdkVersion:Ck.VERSION,expectedAddr:Nk("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s},o&&a&&(r.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NodeChanged",reason:o}}],delete r.expectedAddr),u=Date.now(),px.rtcGetAccess(0,JSON.stringify(r),0,mL.REQUEST,e.join(","),r.connectSessionID),d=e.map((function(e,t){return Zf(l,void 0,void 0,(function(){var i,n,o;return $f(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,r)];case 1:return i=a.sent(),[3,3];case 2:throw n=a.sent(),new aD(tD.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==i.code)throw new aD(tD.ICE_SERVER_WRONG,"get ICE config failed",{server_code:i.code,message:JSON.stringify(i)});if(!(o=i.nodes[0]))throw new aD(tD.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:i.code,message:JSON.stringify(i)});return[2,{result:i,firstNode:o,index:t}]}}))}))})),[2,LP(d).then((function(t){var i=t.result;t.firstNode;var n=t.index;return px.rtcGetAccess(200,JSON.stringify(i),Date.now()-u,mL.RESPONSE,e[n],r.connectSessionID),i})).catch((function(t){var i,n,o=null===(i=t[0])||void 0===i?void 0:i.error;throw px.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,mL.RESPONSE,e.join(","),r.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(Lx.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),Vx=function(){function e(){this._request=new Ox}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.42.4",deviceType:"web"},r=Ck.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));px.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),hL.REQUEST,"",!1);var i=r.map((function(r,i){return Zf(e,void 0,void 0,(function(){var e;return $f(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(r,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new aD(tD.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new aD(tD.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:i}]}}))}))}));return new Promise((function(e){LP(i).then((function(t){var i=t.result,n=t.index;Ux.setH264BlackList(i.web_h264_black_list),px.rtcGetConfig(200,JSON.stringify(i),0,r[n],hL.RESPONSE,"",!1),e(i.web_h264_black_list)})).catch((function(t){px.rtcGetConfig(500,t.message,0,"",hL.RESPONSE,"",!1),e(Ux.getH264BlackList()||[])}))}))},e}(),Fx={},Bx={},jx={exports:{}},Gx=jx.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(Gx).forEach((function(e){Gx[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},r=function(e,r,i){var n=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:n&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:n?r[e.name]:r;!function(e,r,i,n){if(n&&!i)r[n]=t(e[1]);else for(var o=0;o<i.length;o+=1)null!=e[o+1]&&(r[i[o]]=t(e[o+1]))}(i.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},i=jx.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<(i[t]||[]).length;s+=1){var c=i[t][s];if(c.reg.test(n))return r(c,a,n)}})),t.media=o,t};var o=function(e,r){var i=r.split(/=(.+)/,2);return 2===i.length?e[i[0]]=t(i[1]):1===i.length&&r.length>1&&(e[i[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 r=[],i=e.split(" ").map(t),n=0;n<i.length;n+=3)r.push({component:i[n],ip:i[n+1],port:i[n+2]});return r},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 r,i=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),i=!0),{scid:r,paused:i}}))}))}}(Bx);var Hx=jx.exports,zx=/%[sdv%]/g,Kx=function(e){var t=1,r=arguments,i=r.length;return e.replace(zx,(function(e){if(t>=i)return e;var n=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(n);case"%d":return Number(n);case"%v":return""}}))},Yx=function(e,t,r){var i=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var o=t.names[n];t.name?i.push(r[t.name][o]):i.push(r[t.names[n]])}else i.push(r[t.name]);return Kx.apply(null,i)},Xx=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Wx=["i","c","b","a"],Jx=Bx,qx=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 r=t.outerOrder||Xx,i=t.innerOrder||Wx,n=[];return r.forEach((function(t){Hx[t].forEach((function(r){r.name in e&&null!=e[r.name]?n.push(Yx(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){n.push(Yx(t,r,e))}))}))})),e.media.forEach((function(e){n.push(Yx("m",Hx.m[0],e)),i.forEach((function(t){Hx[t].forEach((function(r){r.name in e&&null!=e[r.name]?n.push(Yx(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){n.push(Yx(t,r,e))}))}))}))})),n.join("\r\n")+"\r\n"};Fx.write=qx,Fx.parse=Jx.parse,Fx.parseParams=Jx.parseParams,Fx.parseFmtpConfig=Jx.parseFmtpConfig,Fx.parsePayloads=Jx.parsePayloads,Fx.parseRemoteCandidates=Jx.parseRemoteCandidates,Fx.parseImageAttributes=Jx.parseImageAttributes,Fx.parseSimulcastStreamList=Jx.parseSimulcastStreamList;var Zx=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this._iceConfigNode.iceParams,i=Fx.parse(e);return null===(t=i.media)||void 0===t||t.forEach((function(e){e.iceUfrag=null==r?void 0:r.clientIceUfrag,e.icePwd=null==r?void 0:r.clientIcePwd,e.iceOptions="renomination"})),Fx.write(i)},e}(),$x=function(){function e(e){this._iceConfigNode=e}return e.prototype.getServerUfrag=function(){return Zf(this,void 0,void 0,(function(){var e,t;return $f(this,(function(r){switch(r.label){case 0:return e=this._iceConfigNode.iceParams,t=this,[4,iV(e.serverIceUfrag)];case 1:return t._iceUfrag=r.sent(),vx.setStats({connection_id:this._iceUfrag}),[2]}}))}))},e.prototype.modifyByIceNode=function(e){var t,r=this,i=this._iceConfigNode.certFingerprint,n=Fx.parse(e);return(null==n?void 0:n.fingerprint)&&(n.fingerprint={type:"sha-256",hash:i}),null===(t=null==n?void 0:n.media)||void 0===t||t.forEach((function(e){return r.modifyMlineByIceNode(e)})),Fx.write(n)},e.prototype.modifyMlineByIceNode=function(e){var t=this._iceConfigNode,r=t.publicIPs,i=t.certFingerprint,n=t.iceParams;e.fingerprint&&(e.fingerprint={type:"sha-256",hash:i}),e.icePwd=n.serverIcePwd,e.iceUfrag=this._iceUfrag,e.setup="active",this._candidates||(this._candidates=rV(r)),e.candidates=this._candidates,e.iceOptions="renomination","application"===e.type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144})},e}();function Qx(e,t){var r,i=Fx.parse(e),n=[];return i.media=i.media.map((function(e){return t.includes(e.mid+"")?(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):"inactive"!==e.direction&&n.push(e.mid),e})),(null===(r=i.groups)||void 0===r?void 0:r[0])&&(i.groups[0].mids=n.join(" ")),i}var eV=function(e,t){var r,i;try{var n=Fx.parse(e),o=Fx.parse(t),a="".concat(null===(r=o.groups)||void 0===r?void 0:r[0].mids).split(" "),s="".concat(null===(i=n.groups)||void 0===i?void 0:i[0].mids).split(" "),c={};a.forEach((function(e){return c[e]=e}));var u={};s.forEach((function(e){c[e]||(u[e]=e)}));var d="",l="";return n.media=n.media.filter((function(e){return u[e.mid]&&"audio"===e.type?d="".concat(e.mid):u[e.mid]&&"video"===e.type&&(l="".concat(e.mid)),u[e.mid]})),delete n.groups,delete n.msidSemantic,{partialSdp:Fx.write(n),audioMid:d,videoMid:l}}catch(e){return null}},tV=function(e,t){var r;try{var i=Fx.parse(e),n=[];return null===(r=i.media)||void 0===r||r.forEach((function(e){(null==t?void 0:t.includes("".concat(e.mid)))&&n.push(e)})),i.media=n,delete i.groups,delete i.msidSemantic,Fx.write(i)}catch(e){return""}},rV=function(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,i=[],n=Nk("CONNECTION_MODE");return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&n!==Wf.FORCE_TCP&&e.udpPorts.forEach((function(e){i.push(Jf(Jf({},o),{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&n!==Wf.FORCE_UDP&&e.tcpPorts.forEach((function(e){i.push(Jf(Jf({},o),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),i},iV=function(e){return Zf(void 0,void 0,void 0,(function(){var t,r,i,n,o,a,s;return $f(this,(function(c){switch(c.label){case 0:return t=new TextEncoder,r=t.encode("PREC"),n=Uint8Array.bind,[4,wP.b64str2ab(e)];case 1:return i=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=OP(Uint8Array,r,i,o,a),[4,wP.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))};function nV(e,t){var r=1,i=e;(e.width>t.width||e.height>t.height)&&(r=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,i={width:Math.floor(e.width/r),height:Math.floor(e.height/r)});return Jf(Jf({},i),{scaleResolutionDownBy:r})}var oV=[{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 aV={width:160,height:90,frameRate:15,maxkbps:100},sV={width:320,height:180,frameRate:15,maxkbps:300};var cV,uV,dV,lV,hV,pV="safari"===(cV="none",NP()||(null!==window.navigator.userAgent.match("Firefox")?cV="mozilla":null!==window.navigator.userAgent.match("Chrome")?(cV="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(cV="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(cV="safari")),cV);!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"}(uV||(uV={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(dV||(dV={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(lV||(lV={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(hV||(hV={}));var fV,_V=function(){function e(e){this.peer=e,this.stats=[]}return e.prototype.handleCodec=function(e){return e},e.prototype.handleInboundRtp=function(e){return e},e.prototype.handleOutboundRtp=function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e},e.prototype.handleRemoteInboundRtp=function(e){return e},e.prototype.handleRemoteOutboundRtp=function(e){return e},e.prototype.handleMediaSource=function(e){return e},e.prototype.handleCsrc=function(e){return e},e.prototype.handlePeerConnection=function(e){return e},e.prototype.handleDataChannel=function(e){return e},e.prototype.handleStream=function(e){return e},e.prototype.handleTrack=function(e){return e},e.prototype.handleTransceiver=function(e){return e},e.prototype.handleSender=function(e){return e},e.prototype.handleReceiver=function(e){return e},e.prototype.handleTransport=function(e){return e},e.prototype.handleSctpTransport=function(e){return e},e.prototype.handleCandidatePair=function(e){return e},e.prototype.handleLocalCandidate=function(e){return e},e.prototype.handleRemoteCandidate=function(e){return e},e.prototype.handleCertificate=function(e){return e},e.prototype.handleIceServer=function(e){return e},e.prototype.processStats=function(e){var t=this;e.forEach((function(e){var r;switch(e.type){case uV.candidatePair:r=t.handleCandidatePair;break;case uV.certificate:r=t.handleCertificate;break;case uV.remoteCandidate:r=t.handleRemoteCandidate;break;case uV.remoteInboundRtp:r=t.handleInboundRtp;break;case uV.remoteOutboundRtp:r=t.handleOutboundRtp;break;case uV.sctpTransport:r=t.handleSctpTransport;break;case uV.sender:r=t.handleSender;break;case uV.stream:r=t.handleStream;break;case uV.track:r=t.handleTrack;break;case uV.transceiver:r=t.handleTransceiver;break;case uV.transport:r=t.handleTransport;break;case uV.codec:r=t.handleCodec;break;case uV.csrc:r=t.handleCsrc;break;case uV.dataChannel:r=t.handleDataChannel;break;case uV.iceServer:r=t.handleIceServer;break;case uV.mediaSource:r=t.handleMediaSource;break;case uV.outboundRtp:r=t.handleOutboundRtp;break;case uV.inboundRtp:r=t.handleInboundRtp;break;case uV.peerConnection:r=t.handlePeerConnection;break;case uV.receiver:r=t.handleReceiver;break;case uV.localCandidate:r=t.handleLocalCandidate;break;default:r=function(e){return e}}r=r.bind(t),t.stats.push(r(e))}))},e.prototype.getExtraStats=function(){return Zf(this,void 0,void 0,(function(){var e=this;return $f(this,(function(t){return[2,new Promise((function(t,r){if(pV||void 0!==window.InstallTrigger)return t(e.stats);try{e.peer.getStats((function(r){r.result().forEach((function(t){if(!vV.includes(t.type)){var r={};t.names().forEach((function(e){r[e]=t.stat(e)})),r.id=t.id,r.type=t.type,r.timestamp=t.timestamp,e.stats.push(r)}})),t(e.stats)}))}catch(e){r(e)}}))]}))}))},e.prototype.getStats=function(e,t){return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return i.trys.push([0,7,,8]),[4,this.peer.getStats(e)];case 1:r=i.sent(),this.processStats(r),i.label=2;case 2:return i.trys.push([2,5,,6]),t?[3,4]:[4,this.getExtraStats()];case 3:i.sent(),i.label=4;case 4:return[3,6];case 5:return i.sent(),[3,6];case 6:return[3,8];case 7:return i.sent(),[3,8];case 8:return[2,this.stats]}}))}))},e}(),vV=["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"],mV=function(e,t,r){return Zf(void 0,void 0,void 0,(function(){var i;return $f(this,(function(n){switch(n.label){case 0:return i=[],e instanceof RTCPeerConnection?[4,new _V(e).getStats(t,r)]:[2,i];case 1:return[2,i=n.sent()]}}))}))},SV=function(){return Zf(void 0,void 0,void 0,(function(){var e,t,r,i,n,o,a;return $f(this,(function(s){switch(s.label){case 0:if(fV)return[2,fV];e=[],s.label=1;case 1:return s.trys.push([1,5,,6]),[4,UP()];case 2:return(t=s.sent())?(null==t?void 0:t.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))?(r=navigator.userAgent.toLowerCase(),i=!1,n=["heytapbrowser","mqqbrowser","miuibrowser"],[4,(new Vx).getH264BlackList()]):[3,4]:[2,e];case 3:for(o=s.sent(),n.push.apply(n,t_([],e_(o),!1)),a=0;a<n.length;a++)r.includes(n[a])&&(i=!0);!i&&e.push("H264"),s.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),fV=e,[2,e];case 5:return s.sent(),[2,e];case 6:return[2]}}))}))},EV=function(){return"undefined"!=typeof TransformStream&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},yV=new rk("BasicHandler",3),gV=EV(),bV={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!gV||void 0},TV=function(e){function t(t){var r=e.call(this)||this;return r.monitor=t,r._peerConnection=new RTCPeerConnection(bV),r._dataChannel=r._peerConnection.createDataChannel("signaling"),r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,i;yV.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){yV.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,SL["".concat(e.toUpperCase())])},r}return Cf(t,e),t.prototype.connect=function(e){return Zf(this,void 0,void 0,(function(){var t,r,i=this;return $f(this,(function(n){switch(n.label){case 0:return yV.print("connect","invoke connect"),[4,this._peerConnection.createOffer()];case 1:return t=n.sent(),this._localSdp=new Zx(e),[4,this.setLocalDescription(t.sdp)];case 2:return n.sent(),this._remoteSdp=new $x(e),[4,this._remoteSdp.getServerUfrag()];case 3:return n.sent(),r=this._remoteSdp.modifyByIceNode(t.sdp),[4,this.setRemoteDescription(r)];case 4:return n.sent(),[4,new Promise((function(e,t){i._dataChannel.onopen=function(){yV.print("connect","dataChannel open"),bx("es.dc.open",""),e("")},i._dataChannel.onerror=function(e){px.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,EL.INVALID_DATA),bx("es.dc.error",""),t(e)},i._dataChannel.onclose=function(e){bx("es.dc.close",""),t(e)},i._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==i._peerConnection.iceConnectionState&&"closed"!==i._peerConnection.iceConnectionState&&"failed"!==i._peerConnection.connectionState||t(e)}))}))];case 5:return n.sent(),yV.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(){this.disconnect(),this._localSdp=void 0,this._remoteSdp=void 0},t.prototype.publish=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T;return $f(this,(function(I){switch(I.label){case 0:return r=e.stream,i=null==e?void 0:e.videoTrack,n=null==e?void 0:e.audioTrack,o={},a=[],Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length&&(s=null==i?void 0:i.getTrack(),c={width:640,height:360,frameRate:30},s&&(u=null==s?void 0:s.getSettings(),c={width:Math.floor(u.width),height:Math.floor(u.height),frameRate:Math.floor(u.frameRate)}),d=null==e?void 0:e.videoEncodeConfig[0],l=nV(c,d),e.prevScaleResolutionDownBy=l.scaleResolutionDownBy,h={maxBitrate:1e3*d.maxKbps,scaleResolutionDownBy:l.scaleResolutionDownBy,rid:"0",maxFramerate:d.frameRate||15},o.sendEncodings=[h],a.push({width:l.width,height:l.height,framerate:d.frameRate,maxkbps:d.maxKbps,rid:"0"}),e.enableSimulcast&&(p=[],f=function(e){for(var t=0,r=e.width*e.height,i=0;i<oV.length;i++)if(r>=oV[i].totalPixels){t=i;break}if(0===t)return oV[t].maxLayers;var n=oV[t-1].totalPixels;return(n-r)/(n-oV[t].totalPixels)<.1?oV[t-1].maxLayers:oV[t].maxLayers}(l),yV.print("simulcast() ","maxLayers: %o",f),1===e.videoEncodeConfig.length?(p=function(e,t){var r=[];if(t<=1)return r;var i=1,n=1;return e.width/e.height>16/9?(i=e.width/aV.width,n=e.width/sV.width):(i=e.height/aV.height,n=e.height/sV.height),r.push({maxkbps:aV.maxkbps,scaleResolutionDownBy:i,frameRate:aV.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),t<=2||i>2&&r.unshift({maxkbps:sV.maxkbps,scaleResolutionDownBy:n,frameRate:sV.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),r}(c,f),yV.print("simulcast() ","simulcastLayers: %o",p)):(p=e.videoEncodeConfig.slice(1).slice(1-f).map((function(e){return Jf({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},nV(c,e))})),yV.print("simulcast() ","simulcastLayers2: %o",p)),p.forEach((function(e,t){var r={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};o.sendEncodings&&o.sendEncodings.unshift(r),a.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})})))),yV.print("publish videoTransceiverInit videoDescriptions","",o,a),_=null==n?void 0:n.getTrack(),(null==n?void 0:n.mixType)!==i_.PLAYOUT&&(null==n?void 0:n.mixedAudioTrack)&&(_=null==n?void 0:n.mixedAudioTrack),e.audioTransceiver=this._peerConnection.addTransceiver(_||"audio",{direction:"sendonly",streams:[r]}),v=e.audioTransceiver,(null==t?void 0:t.audioRed)&&RTCRtpSender.getCapabilities&&v.setCodecPreferences&&(yV.print("publish","publish audio red is true"),(m=(RTCRtpSender.getCapabilities("audio")||{}).codecs)&&(S=m.findIndex((function(e){return"audio/red"===e.mimeType})),E=e_(m.splice(S,1),1),y=E[0],m.unshift(y),v.setCodecPreferences(m),yV.print("publish","audio preferences codecs",m))),gV&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver((null==i?void 0:i.getTrack())||"video",Jf({direction:"sendonly",streams:[r]},o)),gV&&e.initVideoEncodedTransform(),yV.print("sender.getParameters()",e.videoTransceiver.sender.getParameters()),g=CP(),px.rtcBeginCreateOffer(bL.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:if(b=I.sent(),px.rtcCreateOffer(0,TL.UP,e.streamId,e.userId,CP()-g),T=eV(b.sdp,this.getLocalDescriptionSdp()),!b.sdp||!T)throw new aD(tD.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Jf(Jf({sdp:b.sdp},T),{type:"incroffer",semantics:"unified-plan",videoDescriptions:a})]}}))}))},t.prototype.updateScaleResolutionDownBy=function(e){var t,r,i,n,o;return Zf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h;return $f(this,(function(p){return(a=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack())&&(s=null==a?void 0:a.getSettings(),c={width:Math.floor(s.width),height:Math.floor(s.height),frameRate:Math.floor(s.frameRate)},u=nV(c,e.videoEncodeConfig[0]),(d=null===(i=null===(r=e.videoTransceiver)||void 0===r?void 0:r.sender)||void 0===i?void 0:i.getParameters())&&(l=u.scaleResolutionDownBy/e.prevScaleResolutionDownBy,h=1,d.encodings=null===(n=null==d?void 0:d.encodings)||void 0===n?void 0:n.map((function(e){var t=Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*l,1);return t>h&&(h=t),e})),e.prevScaleResolutionDownBy=h,null===(o=e.videoTransceiver)||void 0===o||o.sender.setParameters(d))),[2]}))}))},t.prototype.subscribe=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i,n,o,a;return $f(this,(function(s){switch(s.label){case 0:return r="incroffer",i="unified-plan",t?[2,{sdp:this.getLocalDescriptionSdp(),partialSdp:tV(this.getLocalDescriptionSdp(),[t.audioMid,t.videoMid]),audioMid:t.audioMid,videoMid:t.videoMid,type:r,semantics:i}]:(e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),gV&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),gV&&e.initVideoEncodedTransform(),n=CP(),px.rtcBeginCreateOffer(bL.DOWN,e.streamId,e.userId),[4,this._peerConnection.createOffer()]);case 1:if(o=s.sent(),px.rtcCreateOffer(0,TL.DOWN,e.streamId,e.userId,CP()-n),a=eV(o.sdp,this.getLocalDescriptionSdp()),!o.sdp||!a)throw new aD(tD.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Jf(Jf({sdp:o.sdp},a),{type:r,semantics:i})]}}))}))},t.prototype.setAnswerSdp=function(e,t,r,i,n){var o;return Zf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return $f(this,(function(p){switch(p.label){case 0:return px.rtcRecvAnswer(0,AL.INCRANSWER,0,t,n,i.streamId,i.userId),a=this._peerConnection.remoteDescription,s=Fx.parse(null==a?void 0:a.sdp),c=null===(o=s.media)||void 0===o?void 0:o.reduce((function(e,t){return e[t.mid]=t,e}),{}),Fx.parse(t).media.forEach((function(e){return c[e.mid]=e})),u=[],d=Fx.parse(e),l=d.media.map((function(e){var t;r&&r[e.mid]&&(e.mid=r[e.mid]),"inactive"!==e.direction&&u.push(e.mid);var i=c[e.mid];return null===(t=h._remoteSdp)||void 0===t||t.modifyMlineByIceNode(i),e.bundleOnly||(i.port=e.port),i})),s.media=l,d.groups=[{mids:u.join(" "),type:"BUNDLE"}],s.groups=d.groups,[4,this.setLocalDescription(Fx.write(d),i,n)];case 1:return p.sent(),[4,this.setRemoteDescription(Fx.write(s),i,n)];case 2:return p.sent(),[2]}}))}))},t.prototype.setLocalDescription=function(e,t,r){var i,n;return Zf(this,void 0,void 0,(function(){var o,a,s,c,u,d,l;return $f(this,(function(h){switch(h.label){case 0:o=null===(i=this._localSdp)||void 0===i?void 0:i.modifyByIceNode(e),a=new RTCSessionDescription({type:"offer",sdp:o}),s=CP(),c=r||RL.UP,u=(null==t?void 0:t.streamId)||"",d=(null===(n=t)||void 0===n?void 0:n.userId)||"",h.label=1;case 1:return h.trys.push([1,3,,4]),yV.print("setOffer","set offer: ",a),[4,this._peerConnection.setLocalDescription(a)];case 2:return h.sent(),px.rtcSetDescription(0,a.sdp,IL.W_1,c,u,d,CP()-s,{type:"offer"}),[3,4];case 3:throw(l=h.sent())instanceof Error&&px.rtcSetDescription(-1,l.message,IL.W_1,c,u,d,CP()-s,{type:"offer"}),l;case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t,r){var i;return Zf(this,void 0,void 0,(function(){var n,o,a,s,c,u;return $f(this,(function(d){switch(d.label){case 0:n=new RTCSessionDescription({type:"answer",sdp:e}),o=CP(),a=r||RL.UP,s=(null==t?void 0:t.streamId)||"",c=(null===(i=t)||void 0===i?void 0:i.userId)||"",d.label=1;case 1:return d.trys.push([1,3,,4]),yV.print("setAnswer","set answer: ",n),[4,this._peerConnection.setRemoteDescription(n)];case 2:return d.sent(),px.rtcSetDescription(0,n.sdp,IL.W_0,a,s,c,CP()-o,{type:"answer"}),[3,4];case 3:throw(u=d.sent())instanceof Error&&px.rtcSetDescription(-1,u.message,IL.W_0,a,s,c,CP()-o,{type:"answer"}),u;case 4:return[2]}}))}))},t.prototype.getLocalDescriptionSdp=function(){var e,t,r,i;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.localDescription)||void 0===t?void 0:t.sdp)return null===(i=null===(r=this._peerConnection)||void 0===r?void 0:r.localDescription)||void 0===i?void 0:i.sdp;throw Error()},t.prototype.getRemoteDescriptionSdp=function(){var e,t,r,i;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.remoteDescription)||void 0===t?void 0:t.sdp)return null===(i=null===(r=this._peerConnection)||void 0===r?void 0:r.remoteDescription)||void 0===i?void 0:i.sdp;throw Error()},t.prototype.closeMLine=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n,o,a,s=this;return $f(this,(function(c){switch(c.label){case 0:return yV.print("closeMids","closeMids: ",e),i=this.getLocalDescriptionSdp(),n=Qx(i,e),o=this.getRemoteDescriptionSdp(),a=Qx(o,e),[4,this._peerConnection.createOffer()];case 1:return c.sent(),[4,this.setLocalDescription(Fx.write(n))];case 2:return c.sent(),(null===(t=null==n?void 0:n.media)||void 0===t?void 0:t.length)!==(null===(r=null==a?void 0:a.media)||void 0===r?void 0:r.length)&&n.media.slice(a.media.length).forEach((function(e){var t;null===(t=s._remoteSdp)||void 0===t||t.modifyMlineByIceNode(e),a.media.push(e)})),Array.isArray(n.media)&&Array.isArray(a.media)&&n.media.forEach((function(e,t){a.media[t]&&(a.media[t].mid=e.mid)})),[4,this.setRemoteDescription(Fx.write(a))];case 3:return c.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return Zf(this,void 0,void 0,(function(){var e;return $f(this,(function(t){switch(t.label){case 0:return[4,UP()];case 1:if(!(e=t.sent()))throw new aD(tD.NOT_SUPPORTED,"Get offer Error");return[2,{sdp:e,semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.getStats=function(e,t){return mV(this._peerConnection,e,t)},t.prototype.rollback=function(e,t){var r;return Zf(this,void 0,void 0,(function(){return $f(this,(function(i){switch(i.label){case 0:return yV.print("rollback()","signalingState: %o",this._peerConnection.signalingState),"stable"!==this._peerConnection.signalingState?[3,2]:[4,null===(r=this._peerConnection)||void 0===r?void 0:r.setLocalDescription(new RTCSessionDescription({sdp:e,type:"offer"}))];case 1:i.sent(),i.label=2;case 2:return[4,this.closeMLine(t)];case 3:return i.sent(),[2]}}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}($P.exports.EventEmitter),IV=new rk("Locker",2),RV=1,AV=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=RV++,e&&(this.name=e),IV.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,IV.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var r=new Promise((function(r){e=function(){t.locks-=1,IV.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),i=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),i},e}(),CV=I,OV=ic,NV=Cm.exports.getWeakData,wV=kt,DV=G,PV=lc,kV=Yc,MV=xe,UV=Or.set,LV=Or.getterFor,xV=ba.find,VV=ba.findIndex,FV=CV([].splice),BV=0,jV=function(e){return e.frozen||(e.frozen=new GV)},GV=function(){this.entries=[]},HV=function(e,t){return xV(e.entries,(function(e){return e[0]===t}))};GV.prototype={get:function(e){var t=HV(this,e);if(t)return t[1]},has:function(e){return!!HV(this,e)},set:function(e,t){var r=HV(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=VV(this.entries,(function(t){return t[0]===e}));return~t&&FV(this.entries,t,1),!!~t}};var zV,KV={getConstructor:function(e,t,r,i){var n=e((function(e,n){PV(e,o),UV(e,{type:t,id:BV++,frozen:void 0}),null!=n&&kV(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=LV(t),s=function(e,t,r){var i=a(e),n=NV(wV(t),!0);return!0===n?jV(i).set(t,r):n[i.id]=r,e};return OV(o,{delete:function(e){var t=a(this);if(!DV(e))return!1;var r=NV(e);return!0===r?jV(t).delete(e):r&&MV(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!DV(e))return!1;var r=NV(e);return!0===r?jV(t).has(e):r&&MV(r,t.id)}}),OV(o,r?{get:function(e){var t=a(this);if(DV(e)){var r=NV(e);return!0===r?jV(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),n}},YV=n,XV=I,WV=ic,JV=Cm.exports,qV=_S,ZV=KV,$V=G,QV=Mm,eF=Or.enforce,tF=or,rF=!YV.ActiveXObject&&"ActiveXObject"in YV,iF=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},nF=qV("WeakMap",iF,ZV);if(tF&&rF){zV=ZV.getConstructor(iF,"WeakMap",!0),JV.enable();var oF=nF.prototype,aF=XV(oF.delete),sF=XV(oF.has),cF=XV(oF.get),uF=XV(oF.set);WV(oF,{delete:function(e){if($V(e)&&!QV(e)){var t=eF(this);return t.frozen||(t.frozen=new zV),aF(this,e)||t.frozen.delete(e)}return aF(this,e)},has:function(e){if($V(e)&&!QV(e)){var t=eF(this);return t.frozen||(t.frozen=new zV),sF(this,e)||t.frozen.has(e)}return sF(this,e)},get:function(e){if($V(e)&&!QV(e)){var t=eF(this);return t.frozen||(t.frozen=new zV),sF(this,e)?cF(this,e):t.frozen.get(e)}return cF(this,e)},set:function(e,t){if($V(e)&&!QV(e)){var r=eF(this);r.frozen||(r.frozen=new zV),sF(this,e)?uF(this,e,t):r.frozen.set(e,t)}else uF(this,e,t);return this}})}var dF=function(e){function t(){var t=e.call(this)||this;return t._hasVideoPermission=!1,t._hasAudioPermission=!1,t.inited=!1,t.deviceMap={audioinput:new Map,audiooutput:new Map,videoinput:new Map},t._handleDeviceChange=t._handleDeviceChange.bind(t),!NP()&&t.refreshDevices(),t}return Cf(t,e),t.prototype.refreshDevices=function(){return Zf(this,void 0,void 0,(function(){var e,t=this;return $f(this,(function(r){switch(r.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return(e=r.sent()).forEach((function(r){var i;null===(i=t.deviceMap[r.kind])||void 0===i||i.set(r.deviceId,{deviceName:r.label||lF(r,e),deviceInfo:r,deviceId:r.deviceId,deviceType:r.kind,deviceState:"active"})})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e;return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return"function"==typeof(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",this._handleDeviceChange),[2]}))}))},t.prototype._handleDeviceChange=function(){return Zf(this,void 0,void 0,(function(){var e,t,r=this;return $f(this,(function(i){switch(i.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=i.sent(),t=Array.from(t_(t_(t_([],e_(this.deviceMap.audioinput.values()),!1),e_(this.deviceMap.videoinput.values()),!1),e_(this.deviceMap.audiooutput.values()),!1)),e.forEach((function(t){var i=r.deviceMap[t.kind].get(t.deviceId),n={deviceName:t.label||lF(t,e),deviceType:t.kind,deviceId:t.deviceId,deviceInfo:t,deviceState:"active"};r.deviceMap[t.kind].set(t.deviceId,n),i&&"inactive"!==i.deviceState||r.emit("onMediaDeviceStateChanged",Jf({},n))})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId&&e.kind===t.deviceType}))||(t.deviceState="inactive",r.deviceMap[t.deviceType].delete(t.deviceId),r.emit(a_.onMediaDeviceStateChanged,t))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return Zf(this,void 0,void 0,(function(){var e=this;return $f(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new aD(tD.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasVideoPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasVideoPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasVideoPermission]}}))}))},t.prototype.getAudioPermission=function(){return Zf(this,void 0,void 0,(function(){var e=this;return $f(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new aD(tD.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasAudioPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasAudioPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasAudioPermission]}}))}))},t.prototype.getDevices=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getAudioPermission()];case 1:case 2:return e.sent(),[3,3];case 3:return e.trys.push([3,5,,6]),[4,this.getVideoPermission()];case 4:case 5:return e.sent(),[3,6];case 6:return[4,this.refreshDevices()];case 7:return e.sent(),[2,Array.from(t_(t_(t_([],e_(this.deviceMap.audioinput.values()),!1),e_(this.deviceMap.videoinput.values()),!1),e_(this.deviceMap.audiooutput.values()),!1)).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getMicrophones=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.audioinput.values()).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getCameras=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.videoinput.values()).filter((function(e){return"active"===e.deviceState}))]}))}))},t.prototype.getAudioPlayback=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.audiooutput.values()).filter((function(e){return"active"===e.deviceState}))]}))}))},t.prototype.getDeviceById=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return[4,this.getDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},Object.defineProperty(t.prototype,"hasAudioPermission",{get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new aD(tD.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVideoPermission",{get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new aD(tD.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(nk),lF=function(e,t){var r=t.filter((function(t){return t.kind===e.kind})).findIndex((function(t){return t===e}));return{audioinput:"microphone_",audiooutput:"speaker_",videoinput:"camera_"}[e.kind]+r},hF=new dF,pF=function(){function e(){}return e.prototype.getAudioContextInstance=function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance},e}(),fF=function(){function e(e){var t=_F.getAudioContextInstance();if(e instanceof MediaStreamTrack){var r=new MediaStream;r.addTrack(e),this._audioSource=t.createMediaStreamSource(r)}else e instanceof AudioNode?this._audioSource=e:(this._audioSource=t.createMediaElementSource(e),this._audioSource.connect(t.destination));var i=t.createAnalyser();this._audioSource.connect(i),this._analyserNode=i}return e.prototype.getAudioLevel=function(){var e=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(e);var t=0;return e.forEach((function(e){return t=Math.max(t,Math.abs(e-128))})),t/128*255},e.prototype.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect()},e}(),_F=new pF,vF=new rk("VERTC",0),mF=new WeakMap,SF=function(e){return mF.get(e)},EF=function(e){function t(t,r){var i=e.call(this)||this;return i._trackId=t,i.mediaType=r,i}return Cf(t,e),t.prototype.getId=function(){return this._trackId},t}(nk),yF=function(e){function t(t,r,i){var n=e.call(this,r,i)||this;return n._mediaTrack=t,n._initListeners(),n}return Cf(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.setTrack=function(e){this._mediaTrack=e},t.prototype.close=function(){var e;return 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(){px.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(EF),gF=function(e){function t(t,r,i){var n=e.call(this,r,i)||this;return n._mediaTrack=t,n}return Cf(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(EF),bF=function(e){function t(t,r){var i=e.call(this,t,r,"video")||this;return i.dummy=!1,i}return Cf(t,e),t.prototype.updateVideoCaptureConfig=function(){var e;return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig?(vF.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t.prototype.replaceTrack=function(e){this.setTrack(e)},t}(yF),TF=function(e){function t(t,r){var i=e.call(this,t,r,"audio")||this;return i.mixType=i_.PLAYOUT_AND_PUBLISH,i}return Cf(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new fF(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(vF.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}(yF),IF=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Cf(t,e),t}(gF),RF=function(e){function t(t,r){return e.call(this,t,r,"audio")||this}return Cf(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new fF(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(gF),AF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(TF),CF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(bF),OF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(bF),NF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(TF),wF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(bF),DF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(TF);function PF(e){return new CF(e,AP())}function kF(e){var t;return Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s;return $f(this,(function(c){switch(c.label){case 0:i=(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]),vF.print("createCameraVideoTrack","constraints:",e),px.rtcVideoCaptureEvent({event_type:YL.START,media_device_id:i}),n=CP(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return r=c.sent(),px.rtcVideoCaptureEvent({event_type:YL.START_CAPTURE_RESULT,media_device_id:i,reason:WL.SUCCESS,elapse:CP()-n}),hF.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),px.rtcVideoCaptureEvent({event_type:YL.RUNNING_FAILED,media_device_id:i,error_code:o.code,reason:o.message}),new aD(tD.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getVideoTracks()[0],mF.set(a,r),(s=new CF(a,AP())).videoCaptureConfig=e,[2,s]}}))}))}function MF(e){var t;return Zf(this,void 0,void 0,(function(){var r,i,n,o,a;return $f(this,(function(s){switch(s.label){case 0:vF.print("createCameraVideoTrack","constraints:",e),i=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",s.label=1;case 1:return s.trys.push([1,3,,4]),px.rtcVideoCaptureEvent({event_type:YL.START,media_device_id:i}),n=CP(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=s.sent(),px.rtcVideoCaptureEvent({event_type:YL.START_CAPTURE_RESULT,media_device_id:i,reason:WL.SUCCESS,elapse:CP()-n}),hF.hasAudioPermission=!0,[3,4];case 3:throw o=s.sent(),px.rtcVideoCaptureEvent({event_type:YL.RUNNING_FAILED,media_device_id:i,error_code:o.code,reason:o.message}),new aD(tD.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getAudioTracks()[0],mF.set(a,r),[2,new AF(a,AP())]}}))}))}function UF(e){return void 0===e&&(e=!1),Zf(this,void 0,void 0,(function(){var t,r,i;return $f(this,(function(n){switch(n.label){case 0:vF.print("createScreenStream","withAudio:",e),n.label=1;case 1:return n.trys.push([1,3,,4]),px.rtcVideoCaptureEvent({event_type:YL.START,media_device_id:"screen"}),r=CP(),[4,navigator.mediaDevices.getDisplayMedia({video:!0,audio:e})];case 2:return t=n.sent(),px.rtcVideoCaptureEvent({event_type:YL.START_CAPTURE_RESULT,media_device_id:"screen",reason:WL.SUCCESS,elapse:CP()-r}),[3,4];case 3:throw i=n.sent(),px.rtcVideoCaptureEvent({event_type:YL.RUNNING_FAILED,media_device_id:"screen",error_code:i.code,reason:i.message}),new aD(tD.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",i);case 4:return[2,t]}}))}))}Yi({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new rk("Stats",2);var LF,xF=function(){function e(e,t,r,i){this._client=e,this._handler=t,this.dataChannelRTT={},this._rttTimer={},this._remoteStreamStasEvtIntervals={},this._remoteStreamAudioStallInterval={},this._localStreamStasEvtIntervals={},this._videoInWaiting={},this.monitor=r,this._audioStallInterval=((null==i?void 0:i.audio_stall_interval)||200)/2,this._audioStallRatio=(null==i?void 0:i.audio_stall_ratio)||.6}return e.prototype.setRemoteStreamStatsEvtInterval=function(e,t){var r,i;return void 0===t&&(t={rtt:!0}),Zf(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f,_=this;return $f(this,(function(v){switch(v.label){case 0:return t.rtt&&this.getDataChannelRTT(e.userId),n={audio:{},video:{},remoteStream:e},o=null===(r=e.audioTrack)||void 0===r?void 0:r.getTrack(),a=null===(i=e.videoTrack)||void 0===i?void 0:i.getTrack(),this.getRemoteVideoStats(a,n),[4,this.getRemoteAudioStats(o,n)];case 1:return v.sent(),this.delRemoteStreamStatsEvtInterval(e),s=0,c=0,this._audioStallInterval>0&&void 0!==n.audio.concealedSamples&&(u=n.audio.concealedSamples,d=n.audio.totalSamplesReceived,n.audio.silentConcealedSamples,l=CP(),h={isStall:!1,counted:!1,diff:0},p=.5*this._audioStallInterval,this._remoteStreamAudioStallInterval[e.streamId]=setInterval((function(){return Zf(_,void 0,void 0,(function(){var t,r,i,n,a,f,_,v,m,S,E;return $f(this,(function(y){switch(y.label){case 0:return t=CP(),(r=t-l)<p?[2]:(i=e.hasAudio,n=e.subAudio,i&&n?[4,this._handler.getStats(o,!0)]:(h.isStall=!1,h.counted=!1,[2]));case 1:for(a=y.sent(),f=a.length,_=0;_<f;_++)if(v=a[_],m=v.concealedSamples,S=v.totalSamplesReceived,"inbound-rtp"===v.type){E=S-d,m-u>=this._audioStallRatio*E?(h.isStall?(h.counted?c+=r:(c=c+h.diff+r,s++),h.counted=!0):(h.counted=!1,h.diff=r),h.isStall=!0):(h.isStall=!1,h.counted=!1),u=m,d=S,l=t;break}return[2]}}))}))}),this._audioStallInterval)),f=function(){return Zf(_,void 0,void 0,(function(){var t,r,i,o,a,u;return $f(this,(function(d){switch(d.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(u=e.videoTrack)||void 0===u?void 0:u.getTrack(),[4,this.getRemoteAudioStats(t,n,s,c)];case 1:return i=d.sent(),s=0,c=0,[4,this.getRemoteVideoStats(r,n)];case 2:return o=d.sent(),[2,{audioStats:i,videoStats:o,isScreen:e.isScreen,userId:e.userId}]}}))}))},this._remoteStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Zf(_,void 0,void 0,(function(){var e;return $f(this,(function(t){switch(t.label){case 0:return[4,f()];case 1:return e=t.sent(),this._client.emit("onRemoteStreamStats",e),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.delRemoteStreamStatsEvtInterval=function(e){clearInterval(this._remoteStreamStasEvtIntervals[e.streamId]),clearInterval(this._remoteStreamAudioStallInterval[e.streamId]),delete this._remoteStreamAudioStallInterval[e.streamId]},e.prototype.unsubscribe=function(e){this.delRemoteStreamStatsEvtInterval(e),clearTimeout(this._rttTimer[e.userId]),this._videoInWaiting[e.streamId]=!1},e.prototype.getRemoteAudioStats=function(e,t,r,i){return Zf(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f,_,v;return $f(this,(function(m){switch(m.label){case 0:return n={},o={timestamp:Date.now()},a=t.remoteStream,s=a.streamId,c=a.userId,u=a.isScreen,d=a.audioMid,l=a.subMediaType,h=a._attributes,p={media_type:"audio",is_screen:!!u,direction:"down",stream_id:s,stream_user_id:c,vid:d,connection_status:navigator.onLine,mute_state:l===Bf.AUDIO_AND_VIDEO||l===Bf.AUDIO_ONLY?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localaudio&&h.audiostream?"mute_state_off":"mute_state_on"},e&&this._handler?[4,this._handler.getStats(e)]:[2,n];case 1:return(f=m.sent()).length?(f.forEach((function(e){var t=e.type,r=e.packetsLost,i=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,l=e.totalSamplesReceived,h=e.concealedSamples,f=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,S=e.currentRoundTripTime,E=e.audioLevel,y=e.totalAudioEnergy,g=e.totalSamplesDuration,b=e.mimeType,T=e.googDecodingNormal,I=e.fecPacketsReceived,R=e.availableIncomingBitrate,A=e.availableOutgoingBitrate,C=e.bytesSent,O=e.nominated,N=e.id,w=e.writable,D=e.jitter,P=e.candidateType,k=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc,K=e.kind;"inbound-rtp"===t?(o.packetsLost=r,o.packetsReceived=i,p.packetsReceived=i,o.bytesReceived=a,p.bytes=a,void 0!==s&&(n.jitterBufferDelay=s/c*1e3,p.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==l&&(o.totalSamplesReceived=l,n.concealedSamples=h,o.concealedSamples=h,o.silentConcealedSamples=f,p.concealedSamples=h,n.concealmentEvents=_,p.totalSamplesReceived=l),void 0!==I&&(p.fec_packets_received=I),p.jitter=1e3*D,p.ssrc=z):"codec"===t?(n.recordSampleRate=u,d&&(n.numChannels=d),p.codecName=b):"candidate-pair"===t?(p.ice_available_incoming_bitrate=R,p.ice_available_outgoing_bitrate=A,p.ice_bytes_received=a,p.ice_bytes_sent=C,p.ice_nominated=+O,p.ice_pair_id=N,p.ice_pair_rtt=S,p.rtt=1e3*S,p.ice_pair_state=m,p.ice_pair_writable=w,p.recv_ping_requests=F,p.recv_ping_responses=B,p.sent_ping_requests_before_first_response=j,p.sent_ping_requests_total=j+(G||0),p.sent_ping_responses=H,"succeeded"===m&&(n.rtt=1e3*S,n.total_rtt=1e3*v)):"track"===t&&"audio"===K?(p.audio_level=-10*Math.log10(Math.pow(E,2)),p.volume=255*E,p.total_audio_energy=y,p.totalAudioDuration=g):"ssrc"===t?(p.decodingNormal=T,p.recvAudioLevel=V):"local-candidate"===t?(p.local_candidate_type=P,p.local_ip=k||M,p.local_network_type=U,p.local_port=L,p.protocol=x):"remote-candidate"===t&&(p.remote_candidate_type=P,p.remote_ip=k||M,p.remote_port=L)})),(_=t.audio).timestamp?(n.audioLossRate=(o.packetsLost-_.packetsLost)/(o.packetsReceived-_.packetsReceived+(o.packetsLost-_.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,p.packetsLost=Math.round(o.packetsLost-_.packetsLost),p.fraction_lost=n.audioLossRate,p.packets_lost_rate=n.audioLossRate,n.statsInterval=o.timestamp-_.timestamp,p.stats_interval=n.statsInterval,n.receivedKBitrate=(o.bytesReceived-_.bytesReceived||0)/n.statsInterval,p.bitrate=Math.round(8e3*n.receivedKBitrate),p.bandwidth=Math.round(p.bitrate/1024),void 0!==o.concealedSamples&&(p.interval_concealed_samples=o.concealedSamples-_.concealedSamples,p.interval_samples_received=o.totalSamplesReceived-_.totalSamplesReceived,p.interval_silent_concealed_samples=o.silentConcealedSamples-_.silentConcealedSamples,n.receivedSampleRate=1e3*p.interval_samples_received/n.statsInterval),t.audio=o,this.dataChannelRTT[t.remoteStream.userId]&&(v=this.dataChannelRTT[t.remoteStream.userId]/2,n.e2eDelay=v+(n.jitterBufferDelay||0),p.e2e_delay_ms=n.e2eDelay,p.total_rtt_ms=v),this._audioStallInterval>0&&void 0!==o.concealedSamples&&(p.concealed_samples===p.interval_concealed_samples&&p.total_samples_received===p.interval_samples_received?(p.stall_count=0,p.stall_duration=0):(p.stall_count=r,p.stall_duration=i),n.stallCount=p.stall_count,n.stallDuration=p.stall_duration),this.monitor.rtcMediaStatistics(p,{}),[2,n]):(t.audio=o,[2,n])):[2,n]}}))}))},e.prototype.getRemoteVideoStats=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f;return $f(this,(function(_){switch(_.label){case 0:return r={},i={timestamp:Date.now()},n=t.remoteStream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.subMediaType,u=n._attributes,d={media_type:"video",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:t.remoteStream.videoMid,connection_status:navigator.onLine,mute_state:c===Bf.AUDIO_AND_VIDEO||c===Bf.VIDEO_ONLY?"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"},e&&this._handler?(r.isScreen=s,[4,this._handler.getStats(e)]):[2,r];case 1:return(l=_.sent()).length?(l.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,S=e.nominated,E=e.id,y=e.currentRoundTripTime,g=e.state,b=e.writable,T=e.candidateType,I=e.ip,R=e.address,A=e.networkType,C=e.port,O=e.nackCount,N=e.pliCount,w=e.protocol,D=e.requestsReceived,P=e.responsesReceived,k=e.requestsSent,M=e.consentRequestsSent,U=e.responsesSent,L=e.ssrc,x=e.kind,V=e.jitter,F=e.framesReceived,B=e.keyFramesDecoded,j=e.totalDecodeTime,G=e.decoderImplementation,H=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(i.packetsLost=a,d.packetsLost=a,i.packetsReceived=s,d.packetsReceived=s,i.bytesReceived=c,d.bytes=c,i.framesDecoded=u,void 0!==l&&(i.jitterBufferDelay=l/h*1e3,d.average_jitter_buffer_delay_ms=i.jitterBufferDelay),d.fir_count=f,d.nackCount=O,d.pli_count=N,d.ssrc=L,d.jitter=V,d.framesReceived=F,i.framesReceived=F,d.framesDecoded=u,d.key_frames_decoded=B,d.total_decode_time=j,d.decoder_name=G,d.last_packet_received_timestamp=H):"track"===t&&"video"===x?(r.width=o,d.frame_size_width=o,r.height=n,d.frame_size_height=n,void 0!==F&&(d.framesReceived=F,i.framesReceived=F)):"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=+S,d.ice_pair_id=E,d.ice_pair_rtt=y,d.rtt=1e3*y,r.rtt=d.rtt,d.ice_pair_state=g,d.ice_pair_writable=b,d.recv_ping_requests=D,d.recv_ping_responses=P,d.sent_ping_requests_before_first_response=k,d.sent_ping_requests_total=k+(M||0),d.sent_ping_responses=U):"local-candidate"===t?(d.local_candidate_type=T,d.local_ip=I||R,d.local_network_type=A,d.local_port=C,d.protocol=w):"remote-candidate"===t&&(d.remote_candidate_type=T,d.remote_ip=I||R,d.remote_port=C)})),h=t.video,p=t.remoteStream,h.timestamp?(r.videoLossRate=(i.packetsLost-h.packetsLost)/(i.packetsReceived-h.packetsReceived+(i.packetsLost-h.packetsLost)),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,d.fraction_lost=r.videoLossRate,d.packets_lost_rate=r.videoLossRate,r.statsInterval=i.timestamp-h.timestamp,d.stats_interval=r.statsInterval,r.receivedKBitrate=(i.bytesReceived-h.bytesReceived||0)/r.statsInterval,d.bitrate=Math.round(8e3*r.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),r.decoderOutputFrameRate=1e3*(i.framesDecoded-h.framesDecoded)/r.statsInterval,r.receivedFrameRate=1e3*(i.framesReceived-h.framesReceived)/r.statsInterval,d.frame_rate_decoded=Math.round(r.decoderOutputFrameRate),d.frame_rate_received=d.frame_rate_decoded,t.video=i,this.dataChannelRTT[t.remoteStream.userId]&&(f=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=f+(i.jitterBufferDelay||0),d.e2e_delay_ms=r.e2eDelay,d.total_rtt_ms=f),this.processStall(p,d,r,s),this.monitor.rtcMediaStatistics(d,{}),[2,r]):(t.video=i,[2,r])):[2,r]}}))}))},e.prototype.processStall=function(e,t,r,i){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[e.streamId]?0:1,this._videoInWaiting[e.streamId]=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting[e.streamId]=!0:this._videoInWaiting[e.streamId]=!1),e.recordedVideoFrames=[]}t.stall_count=n,i?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,r.stallCount=n,r.stallDuration=o},e.prototype.setLocalStreamStatsEvtInterval=function(e){var t,r,i=this,n={audio:{},video:{},localStream:e},o=null===(t=e.audioTrack)||void 0===t?void 0:t.getTrack(),a=null===(r=e.videoTrack)||void 0===r?void 0:r.getTrack();this.getAudioStats(o,n),this.getVideoStats(a,n),this.delLocalStreamStatsEvtInterval(e);this._localStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Zf(i,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:return[4,Zf(i,void 0,void 0,(function(){var t,r,i,o,a,s;return $f(this,(function(c){switch(c.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(s=e.videoTrack)||void 0===s?void 0:s.getTrack(),[4,this.getAudioStats(t,n)];case 1:return i=c.sent(),[4,this.getVideoStats(r,n)];case 2:return o=c.sent(),[2,{audioStats:i,videoStats:o,isScreen:e.isScreen}]}}))}))];case 1:return t=r.sent(),this._client.emit("onLocalStreamStats",t),[2]}}))}))}),2e3)},e.prototype.delLocalStreamStatsEvtInterval=function(e){clearInterval(this._localStreamStasEvtIntervals[e.streamId])},e.prototype.unpublish=function(e){this.delLocalStreamStatsEvtInterval(e)},e.prototype.getAudioStats=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l;return $f(this,(function(h){switch(h.label){case 0:return r={},i={timestamp:Date.now()},n=t.localStream,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,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this._handler?[4,this._handler.getStats(e)]:[2,r];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,S=e.id,E=e.currentRoundTripTime,y=e.state,g=e.writable,b=e.requestsReceived,T=e.responsesReceived,I=e.requestsSent,R=e.consentRequestsSent,A=e.responsesSent,C=e.jitter,O=e.candidateType,N=e.ip,w=e.address,D=e.networkType,P=e.port,k=e.protocol,M=e.nackCount,U=e.retransmittedBytesSent,L=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType;"outbound-rtp"===t?(i.packetsSent=n,i.bytesSent=a,u.bytes=a,u.packetsSent=n,u.nackCount=M,u.ssrc=F,u.retransmitted_bytes_sent=U,u.retransmitted_packets_sent=L):"remote-inbound-rtp"===t?(i.packetsLost=o,u.packetsLost=o,u.jitter=1e3*C,r.rtt=1e3*c,u.rtt=r.rtt,u.round_trip_time_measurements=x):"codec"===t?(r.recordSampleRate=s,r.numChannels=d,u.codecName=p):"media-source"===t?(u.audio_level=-10*Math.log10(Math.pow(l,2)),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=S,u.ice_pair_rtt=E,u.ice_pair_state=y,u.ice_pair_writable=g,u.recv_ping_requests=b,u.recv_ping_responses=T,u.sent_ping_requests_before_first_response=I,u.sent_ping_requests_total=I+(R||0),u.sent_ping_responses=A):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=N||w,u.local_network_type=D,u.local_port=P,u.protocol=k):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=N||w,u.remote_port=P)})),(l=t.audio).timestamp?(void 0!==i.packetsLost&&(r.audioLossRate=(i.packetsLost-l.packetsLost)/(i.packetsSent-l.packetsSent),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,u.fraction_lost=r.audioLossRate),r.statsInterval=i.timestamp-l.timestamp,u.stats_interval=r.statsInterval,r.sendKBitrate=(i.bytesSent-l.bytesSent||0)/r.statsInterval*8,u.bitrate=Math.round(1e3*r.sendKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=i,this.monitor.rtcMediaStatistics(u,{}),[2,r]):(t.audio=i,[2,r])):[2,r]}}))}))},e.prototype.getVideoStats=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f,_;return $f(this,(function(v){switch(v.label){case 0:return r={},i={timestamp:Date.now(),simulcast:{}},n=t.localStream,o=n.streamId,a=n.videoMid,s=n.isScreen,c=n.pubAttributes,u=n.enableSimulcast,d={media_type:"video",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},e&&this._handler?(r.isScreen=s,[4,this._handler.getStats(e)]):[2,r];case 1:return(l=v.sent()).length?(h=0,l.forEach((function(e){var t=e.type,n=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,c=e.roundTripTime,l=e.mimeType,p=e.frameWidth,f=e.frameHeight,_=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,S=e.googAvailableSendBandwidth,E=e.googAvgEncodeMs,y=e.googBucketDelay,g=e.googEncodeUsagePercent,b=e.googFrameRateInput,T=e.availableIncomingBitrate,I=e.availableOutgoingBitrate,R=e.bytesReceived,A=e.nominated,C=e.id,O=e.currentRoundTripTime,N=e.state,w=e.writable,D=e.candidateType,P=e.ip,k=e.address,M=e.networkType,U=e.port,L=e.nackCount,x=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,K=e.responsesSent,Y=e.ssrc,X=e.googTargetEncBitrate,W=e.googTransmitBitrate,J=e.googRtt,q=e.retransmittedPacketsSent,Z=e.encoderImplementation,$=e.jitter,Q=e.rid;"outbound-rtp"===t?(u&&(Q?i.simulcast[Q]=e:i.simulcast[h]=e,h++),i.framesEncoded=n,i.bytesSent=a,i.framesSent=s,d.bytes=a,i.packetsSent=_,d.packetsSent=_,d.nackCount=L,d.pli_count=x,d.qp_sum=F,d.ssrc=Y,d.retransmitted_packets_sent=q,d.encoder_implementation=Z):"track"===t?(r.encodedFrameWidth=p,r.encodedFrameHeight=f,d.frame_size_height=f,d.frame_size_width=p):"remote-inbound-rtp"===t?(i.packetsLost=o,r.rtt=1e3*c,d.rtt=r.rtt,d.jitter=$,d.packetsLost=o):"codec"===t?(r.codecType=l,d.codecName=l):"candidate-pair"===t?(d.ice_available_incoming_bitrate=T,d.ice_available_outgoing_bitrate=I,d.ice_bytes_received=R,d.ice_bytes_sent=a,d.ice_nominated=+A,d.ice_pair_id=C,d.ice_pair_rtt=O,d.ice_pair_state=N,d.ice_pair_writable=w,d.recv_ping_requests=B,d.recv_ping_responses=j,d.sent_ping_requests_before_first_response=H,d.sent_ping_requests_total=H+z,d.sent_ping_responses=K):"local-candidate"===t?(d.local_candidate_type=D,d.local_ip=P||k,d.local_network_type=M,d.local_port=U,d.protocol=V):"remote-candidate"===t?(d.remote_candidate_type=D,d.remote_ip=P||k,d.remote_port=U):"VideoBwe"===t?(d.encBitratebps=v,d.available_receive_bandwidth=m,d.available_send_bandwidth=S,d.bucket_delay=y,d.retransmitBitratebps=G,d.targetEncBitratebps=X,d.transmit_bitrate=W):"ssrc"===t&&(d.video_network_elapse=J,d.avg_encode_ms=E,d.encodeUsage=g,d.frame_rate_input=b,d.orignal_input_Framerate=+b)})),(p=t.video).timestamp?(r.statsInterval=i.timestamp-p.timestamp,d.stats_interval=r.statsInterval,f=Object.keys(i.simulcast),u?(d.sim_enc_width=[],d.sim_enc_height=[],d.sim_enc_bps=[],d.sim_enc_framerate=[],d.sim_rids=[],d.sim_enc_bandwidth=[],d.sim_sent_framerate=[],d.sim_fraction_lost=[],_=!1,f.sort((function(e,t){return+e-+t})).forEach((function(e){var t=i.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,f=t.qualityLimitationDurations,v=t.qualityLimitationResolutionChanges;void 0!==h&&(d.sim_qualityLimitationReason||(d.sim_qualityLimitationReason=[],d.sim_qualityLimitationDurations=[],d.sim_qualityLimitationResolutionChanges=[]),d.sim_qualityLimitationReason.push(h),d.sim_qualityLimitationDurations.push(f),d.sim_qualityLimitationResolutionChanges.push(v));var m=p.simulcast[e];if(d.sim_enc_width.push(n||0),d.sim_enc_height.push(o||0),m){var S=(a-m.bytesSent||0)/r.statsInterval;d.sim_enc_bps.push(Math.round(8e3*S)),d.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var E=1e3*(s-m.framesEncoded)/r.statsInterval;d.sim_enc_framerate.push(Math.round(E)),d.sim_rids.push(e);var y=void 0!==c?c-m.framesSent:s-m.framesEncoded,g=1e3*y/r.statsInterval;d.sim_sent_framerate.push(Math.round(g));var b=(u-m.packetsLost)/(l-m.packetsSent);b=Number.isNaN(b)?0:b,d.sim_fraction_lost.push(b),n>0&&!_&&(r.sentKBitrate=8*S,r.encoderOutputFrameRate=E,r.encodedFrameCount=y,r.sentFrameRate=g,r.videoLossRate=b,_=!0)}})),this.monitor.rtcMediaStatistics(d,{})):(r.encodedFrameCount=void 0!==i.framesSent?i.framesSent-p.framesSent:i.framesEncoded-p.framesEncoded,r.sentKBitrate=(i.bytesSent-p.bytesSent||0)/r.statsInterval*8,d.bitrate=Math.round(1e3*r.sentKBitrate),d.bandwidth=Math.round(d.bitrate/1024),r.encoderOutputFrameRate=1e3*(i.framesEncoded-p.framesEncoded)/r.statsInterval,d.frame_rate_encoded=Math.round(r.encoderOutputFrameRate),r.sentFrameRate=1e3*r.encodedFrameCount/r.statsInterval,d.frame_rate_sent=Math.round(r.sentFrameRate),r.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsSent-p.packetsSent),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,d.fraction_lost=r.videoLossRate,this.monitor.rtcMediaStatistics(d,{})),t.video=i,[2,r]):(t.video=i,[2,r])):[2,r]}}))}))},e.prototype.getDataChannelRTT=function(e){var t,r=this,i=CP();null===(t=this._client.sendUserMessage(e,"__web__rtc__rtt__"))||void 0===t||t.then((function(t){if("timeout"!==t){var n=Date.now()-i;n>0&&n<2e3&&(r.dataChannelRTT[e]=n)}else clearTimeout(r._rttTimer[e])})).catch((function(){clearTimeout(r._rttTimer[e])})),clearTimeout(this._rttTimer[e]),this._rttTimer[e]=setTimeout((function(){r.getDataChannelRTT(e)}),2e3)},e.prototype.destroy=function(){var e=this;Object.keys(this._localStreamStasEvtIntervals).forEach((function(t){clearInterval(e._localStreamStasEvtIntervals[t])})),Object.keys(this._remoteStreamStasEvtIntervals).forEach((function(t){clearInterval(e._remoteStreamStasEvtIntervals[t])})),Object.keys(this._rttTimer).forEach((function(t){clearTimeout(e._rttTimer[t])})),Object.keys(this._remoteStreamAudioStallInterval).forEach((function(t){clearTimeout(e._remoteStreamAudioStallInterval[t])})),this._rttTimer={},this.dataChannelRTT={},this._videoInWaiting={}},e}(),VF=new rk("MediaServerClient",2),FF=5e3;!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(LF||(LF={}));var BF=function(e,t){VF.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)},jF=function(e){function t(t){void 0===t&&(t=px);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._pubConfig={},r.monitor=t,r._pubSubLock=new AV("pubSubLock"),r._joinLeaveLock=new AV("joinLeaveLock"),r._state=LF.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r}return Cf(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){VF.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(nx.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[rx.ON_ADD_STREAM,rx.ON_REMOVE_STREAM,rx.USER_CONNECTION,rx.USER_DISCONNECTION,rx.ON_UPDATE_STREAM_ATTRIBUTES,rx.ON_UPDATE_ROOM_ATTRIBUTES,rx.ON_PUSH_TRACK,rx.ON_REMOVE_TRACK,rx.NODE_CHANGE,rx.ON_CUSTOM_MESSAGE,rx.USER_MESSAGE_RECEIVED,rx.USER_BINARY_MESSAGE_RECEIVED,rx.POST_PROCESSING_MESSAGE,rx.ON_USER_TOKEN_WILL_EXPIRE,ix.RSCP].forEach((function(e){var r;null===(r=t._dataChannelSignal)||void 0===r||r.on(e,(function(r){t.safeEmit(e,r)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){VF.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(nx.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(nx.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.connect=function(e,t,r,i){var n;return void 0===t&&(t=""),void 0===r&&(r=""),void 0===i&&(i={}),Zf(this,void 0,void 0,(function(){var o,a,s,c=this;return $f(this,(function(u){switch(u.label){case 0:return this.connectionState=LF.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),i.node?(o=i.node,bx("es.join.nodeChange",i),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return c.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new xx,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,r,Ux.getDeviceId(),null==i?void 0:i.reason,this._prevICENode,this._useCloudProxy)];case 2:if(!(o=u.sent()))throw bx("es.join.getNodeFailed",""),new aD(tD.ICE_SERVER_WRONG,"get ICE config failed");bx("es.join.getNodeSuccess",o),u.label=3;case 3:this._prevICENode=o,this._handler=new TV(this.monitor),this._addHandlerEvents(),Promise.resolve().then((function(){return c.emit("onEstablishConnectionHook")})),u.label=4;case 4:return u.trys.push([4,6,,7]),[4,this._handler.connect(o)];case 5:return a=u.sent(),VF.print("join","establish peerConnection success"),[3,7];case 6:throw s=u.sent(),this.connectionState=LF.DISCONNECTED,new aD(tD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 7:return this._dataChannelSignal=new Cx(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,r,i){var n,o,a,s,c,u;return void 0===t&&(t={}),void 0===r&&(r=!1),Zf(this,void 0,void 0,(function(){var d,l,h,p,f,_,v,m=this;return $f(this,(function(S){switch(S.label){case 0:return VF.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,r,i),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._sessionId=t.sessionId,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return S.sent(),[4,null===(n=this._handler)||void 0===n?void 0:n.getDefaultSdp()];case 2:return d=S.sent(),_={Authorization:wP.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId||"",timestamp:Date.now(),controlMessage:i,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role}},v={},[4,SV()];case 3:_.params=(v.supportedCodecs=S.sent(),v.deviceType="web",v.userAgent=window.navigator.userAgent,v.sdkVersion=Ck.VERSION,v.deviceId=Ux.getDeviceId(),v.appId=this._appId,v.roomId=this._roomId,v.userId=this._clientId,v.businessId=this._businessId,v.enable_cloud_proxy=this._useCloudProxy,v),_.options={enableUnBundleMode:!0,supportTokenExpireCallBack:!0},_.sdpInfo=d,l=_,Promise.resolve().then((function(){return m.emit("onSendingJoinMessageHook")})),S.label=4;case 4:return S.trys.push([4,6,,7]),h=r?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(h,l)];case 5:return p=S.sent(),VF.print("join","send join message success"),this._authorization=l.Authorization,this.connectionState=LF.CONNECTED,this._statsReport=new xF(this,this._handler,this.monitor,null===(o=p.config)||void 0===o?void 0:o.engine_WEB),this._pubConfig.audioRed=!!(null===(s=null===(a=p.config)||void 0===a?void 0:a.engine_WEB)||void 0===s?void 0:s.pub_audio_red),this._pubConfig.simulcastOnDemand=!!(null===(u=null===(c=p.config)||void 0===c?void 0:c.engine_WEB)||void 0===u?void 0:u.sim_on_demand),[2,p];case 6:if(f=S.sent(),this.connectionState=LF.DISCONNECTED,(null==f?void 0:f.code)>=700&&(null==f?void 0:f.code)<800)throw new aD(tD.INVALID_TOKEN,(null==f?void 0:f.message)||"Invalid token");if(200!==(null==f?void 0:f.code))throw new aD(tD.JOIN_ROOM_FAILED,(null==f?void 0:f.message)||"Join room failed");return[3,7];case 7:return[2]}}))}))},t.prototype.publish=function(e){var t,r,i,n,o,a,s,c;return Zf(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,S,E;return $f(this,(function(y){switch(y.label){case 0:VF.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=CP(),h="",p="",f="",y.label=1;case 1:return y.trys.push([1,5,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(_=y.sent()))throw new aD(tD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return h=_.audioMid,p=_.videoMid,f=_.sdp,e.pubAttributes={localaudio:!!d,localvideo:!!u,videostream:!!(null===(r=null==u?void 0:u.getTrack())||void 0===r?void 0:r.enabled),audiostream:!!(null===(i=null==d?void 0:d.getTrack())||void 0===i?void 0:i.enabled),extvideo:!!(u instanceof wF),extaudio:!!(d instanceof DF)},v={attributes:Jf({videoDescriptions:_.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:h,videoMid:p,sdpInfo:{msid:e.stream.id,type:_.type,sdp:_.partialSdp,semantics:_.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(v.attributes.subVideoDescriptions=_.videoDescriptions.map((function(e,t){return e.video_index=t,e}))),[4,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("publish",v)];case 3:if(200!==(null==(m=y.sent())?void 0:m.code))throw new aD(tD.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");return S=null===(o=null==m?void 0:m.relayMessage)||void 0===o?void 0:o.sdp,[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(_.sdp,S,void 0,e,RL.UP)];case 4:return y.sent(),e.streamId=m.streamId,e.videoMid=p,e.audioMid=h,this.monitor.rtcPublishStat(OL.SUCCESS,NL.W_0,l,wL.UNKNOWN),null===(s=this._statsReport)||void 0===s||s.setLocalStreamStatsEvtInterval(e),[2];case 5:return(E=y.sent())instanceof Error&&this.monitor.rtcPublishStat(OL.FAIL,NL.W_0,l,E.message),h&&p?[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(f,[h,p])]:[3,7];case 6:y.sent(),y.label=7;case 7:throw E;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,r,i,n,o,a,s,c,u;return Zf(this,void 0,void 0,(function(){var d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A,C;return $f(this,(function(O){switch(O.label){case 0:VF.print("updatePubTrack()","localStream: %o",e),d=e.videoTrack,l=e.audioTrack,h=!!(null===(r=null===(t=e.videoTransceiver)||void 0===t?void 0:t.sender)||void 0===r?void 0:r.track),p=null==d?void 0:d.getTrack(),null===(i=e.videoTransceiver)||void 0===i||i.sender.replaceTrack(p||null),!h&&p&&(null===(n=this._handler)||void 0===n||n.updateScaleResolutionDownBy(e)),l?(f=l.mixType,_=l.mixedAudioTrack,v=null==l?void 0:l.getTrack(),_&&f!==i_.PLAYOUT&&!0===v.enabled&&(v=_),null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(v)):null===(a=e.audioTransceiver)||void 0===a||a.sender.replaceTrack(null),m={localaudio:!!l,localvideo:!!d,videostream:!!(null===(s=null==d?void 0:d.getTrack())||void 0===s?void 0:s.enabled),audiostream:!!(null===(c=null==l?void 0:l.getTrack())||void 0===c?void 0:c.enabled),extvideo:!!(d instanceof wF),extaudio:!!(l instanceof DF)},S={};try{for(E=Qf(Object.entries(m)),y=E.next();!y.done;y=E.next())g=e_(y.value,2),b=g[0],(T=g[1])!==Reflect.get(e.pubAttributes,b)&&Reflect.set(S,b,T)}catch(e){A={error:e}}finally{try{y&&!y.done&&(C=E.return)&&C.call(E)}finally{if(A)throw A.error}}return Object.keys(S).length?(e.pubAttributes=m,I={roomId:this._roomId,streamId:e.streamId,attributes:S},[4,null===(u=this._dataChannelSignal)||void 0===u?void 0:u.sendSignaling("updateStreamAttributes",I)]):[2];case 1:if(200!==(null==(R=O.sent())?void 0:R.code))throw new aD(tD.UPDATE_TRACK_FAILED,(null==R?void 0:R.message)||"update track failed");return[2]}}))}))},t.prototype.updateToken=function(e){var t,r,i;return Zf(this,void 0,void 0,(function(){var n,o;return $f(this,(function(a){switch(a.label){case 0:if(VF.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===(r=this._userInfo)||void 0===r?void 0:r.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateToken",n)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new aD(tD.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new aD(tD.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,r,i;return Zf(this,void 0,void 0,(function(){var n,o;return $f(this,(function(a){switch(a.label){case 0:return VF.print("unpublish()","localStream: %o",e),n={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unpublish",n)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new aD(tD.UNPUBLISH_FAILED,(null==o?void 0:o.message)||"unpublish failed");return[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 2:return a.sent(),null===(i=this._statsReport)||void 0===i||i.unpublish(e),[2]}}))}))},t.prototype.subscribe=function(e,t,r){var i,n,o,a,s,c,u,d,l;return Zf(this,void 0,void 0,(function(){var h,p,f,_,v,m,S,E,y,g,b,T,I,R,A,C,O,N,w,D;return $f(this,(function(P){switch(P.label){case 0:if(e.hasSubscribed)return[2,this._updateSubTrack(e,t,r)];if(VF.print("subscribe()","mediaType: %o, config: %o",t,r),BF("subscribe()",e),h=!1,p=!1,t===Bf.VIDEO_ONLY?h=!0:t===Bf.AUDIO_ONLY?p=!0:t===Bf.AUDIO_AND_VIDEO?(h=!0,p=!0):t===Bf.NONE&&(h=!1,p=!1),!h&&this._multiChatMode())return[2];f=CP(),_=e.audioMid,v=e.videoMid,S=!1,P.label=1;case 1:return P.trys.push([1,12,,15]),_&&v?(S=!0,[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e,{audioMid:_,videoMid:v})]):[3,3];case 2:return m=P.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(m=P.sent()))throw new aD(tD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,P.label=5;case 5:return E={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:v,audioMid:_,sdpInfo:{sdp:null==m?void 0:m.partialSdp,semantics:null==m?void 0:m.semantics,type:null==m?void 0:m.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||p,video:h},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("subscribe",E)];case 6:if(200!==(null==(y=P.sent())?void 0:y.code))throw new aD(tD.SUBSCRIBE_FAILED,(null==y?void 0:y.message)||"subscribe failed");return g=[],b=!this._multiChatMode(),!(_&&v)&&g.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new aD(tD.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),FF);e.on("ontrack",(function r(n){"video"===n.mediaType&&(VF.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),b&&g.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new aD(tD.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),FF);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(VF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),T=function(t){e.ontrack(t)},null===(a=this._handler)||void 0===a||a.on("ontrack",T),this._ontrackCallbackMap.set(e,T),I=null==y?void 0:y.relayMessage,R=I.audioMid,A=I.videoMid,C=I.sequenceId,O=I.sdp,S&&_!==R?(VF.print("subscribe","mid mot match",_,R),[4,null===(s=this._handler)||void 0===s?void 0:s.closeMLine([_,v])]):[3,9];case 7:return P.sent(),[4,null===(c=this._handler)||void 0===c?void 0:c.subscribe(e)];case 8:if(!(m=P.sent()))throw new aD(tD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,P.label=9;case 9:return(D={})[_]=R,D[v]=A,N=D,e.videoMid=A,e.audioMid=R,e.sequenceId=C,e.subConfig=r,e._workaround_1_=!1,e.paused=!1,e.subMediaType=t,e.hasSubscribed=!0,[4,null===(u=this._handler)||void 0===u?void 0:u.setAnswerSdp(null==m?void 0:m.sdp,O,N,e,RL.DOWN)];case 10:return P.sent(),[4,Promise.all(g)];case 11:return P.sent(),this._multiChatMode()||(e.subAudio=p),e.subVideo=h,this.monitor.rtcSubscribeStat(DL.SUCCESS,f,PL.UNKNOWN,e.userId),null===(d=this._statsReport)||void 0===d||d.setRemoteStreamStatsEvtInterval(e),[2];case 12:return(w=P.sent())instanceof Error&&this.monitor.rtcSubscribeStat(DL.FAIL,f,w.message,e.userId),_&&v?[4,null===(l=this._handler)||void 0===l?void 0:l.rollback(null==m?void 0:m.sdp,[_,v])]:[3,14];case 13:P.sent(),P.label=14;case 14:throw w;case 15:return[2]}}))}))},t.prototype.controlMessage=function(e){var t;return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return VF.print("controlMessage()","params: %o",e),r=e,"transcode"===e.type&&(r.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",r)];case 1:return i.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:return VF.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 r.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){return Zf(this,void 0,void 0,(function(){return $f(this,(function(i){return[2,this._updateSubTrack(e,t,r)]}))}))},t.prototype._updateSubTrack=function(e,t,r){var i,n,o;return Zf(this,void 0,void 0,(function(){var a,s,c,u;return $f(this,(function(d){switch(d.label){case 0:return VF.print("updateSubTrack()","mediaType: %o, config: %o",t,r),BF("updateSubTrack()",e),a=!1,s=!1,t===Bf.VIDEO_ONLY?(a=!0,s=!1):t===Bf.AUDIO_ONLY?(s=!0,a=!1):t===Bf.AUDIO_AND_VIDEO?(a=!0,s=!0):t===Bf.NONE&&(a=!1,s=!1),c={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:a,audio:!!this._multiChatMode()||s},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",c)];case 1:if(200!==(null==(u=d.sent())?void 0:u.code))throw new aD(tD.UPDATE_TRACK_FAILED,(null==u?void 0:u.message)||"update track failed");return e.paused=!a,this._multiChatMode()||(null===(n=e.observer)||void 0===n||n.setUnmuteAudio(s),e.subAudio=s),null===(o=e.observer)||void 0===o||o.setUnmuteVideo(a),e.subVideo=a,e.subMediaType=t,e.subConfig=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var r,i,n,o,a,s;return Zf(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_,v,m,S,E,y;return $f(this,(function(g){switch(g.label){case 0:if(VF.print("subscribe4pushTrack()","streamInfo: %o",t),BF("subscribe4pushTrack()",e),c=null==t?void 0:t.message,u=c.audioMid,d=c.videoMid,l=c.sequenceId,h=c.sdp,e.subAudio=!0,l<e.sequenceId)return VF.print("subscribe4pushTrack","sequenceId return",l,e.sequenceId),[2];p=e.audioMid,f=e.videoMid,null===(r=e.observer)||void 0===r||r.setPushTrack(!0),g.label=1;case 1:return g.trys.push([1,8,,11]),p&&f?[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e,{audioMid:p,videoMid:f})]:[3,3];case 2:return _=g.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(_=g.sent()))throw new aD(tD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");p=_.audioMid,f=_.videoMid,g.label=5;case 5:return(y={})[p]=u,y[f]=d,v=y,VF.print("onpushtrack midmap",e.userId,v),e.audioMid=u,e.videoMid=d,e.sequenceId=l,m=[],e.audioTrack||m.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new aD(tD.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),FF);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(VF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),S=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",S),this._ontrackCallbackMap.set(e,S),[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(null==_?void 0:_.sdp,h,v,e,RL.DOWN)];case 6:return g.sent(),[4,Promise.all(m)];case 7:return g.sent(),[2];case 8:return E=g.sent(),_?[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(null==_?void 0:_.sdp,[p,f])]:[3,10];case 9:g.sent(),g.label=10;case 10:throw E;case 11:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var r,i;return Zf(this,void 0,void 0,(function(){return $f(this,(function(n){switch(n.label){case 0:return BF("unsubscribe4removeTrack()",e),VF.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(VF.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(r=e.observer)||void 0===r||r.setPushTrack(!1),[4,null===(i=this._handler)||void 0===i?void 0:i.closeMLine([e.videoMid||"",e.audioMid||""])]));case 1:return n.sent(),VF.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),[2]}}))}))},t.prototype.unsubscribe=function(e){var t,r,i,n,o;return Zf(this,void 0,void 0,(function(){var a;return $f(this,(function(s){switch(s.label){case 0:BF("unsubscribe()",e),a={roomId:this._roomId,streamId:e.streamId,userId:e.userId},s.label=1;case 1:return s.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unsubscribe",a)];case 2:case 3:return s.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(r=e.observer)||void 0===r||r.setSubscribeVideo(!1),e.subAudio?[3,6]:(null===(i=e.observer)||void 0===i||i.setSubscribeAudio(!1),[4,null===(n=this._handler)||void 0===n?void 0:n.closeMLine([e.videoMid||"",e.audioMid||""])]);case 5:s.sent(),VF.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(o=this._statsReport)||void 0===o||o.unsubscribe(e),s.label=6;case 6:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,r=this._ontrackCallbackMap.get(e);r&&(null===(t=this._handler)||void 0===t||t.off("ontrack",r),this._ontrackCallbackMap.delete(e))},t.prototype.handleRemoveStream=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return BF("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==tx.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this.unsubscribe(e),[2]}))}))},t.prototype.leave=function(){var e;return Zf(this,void 0,void 0,(function(){var t,r,i;return $f(this,(function(n){switch(n.label){case 0:return VF.print("leave()"),this.connectionState!==LF.CONNECTED?[3,7]:(this.connectionState=LF.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:r=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=LF.DISCONNECTED,[3,6];case 4:throw i=n.sent(),this.connectionState=LF.CONNECTED,i;case 5:return r(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new aD(tD.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,r,i,n,o;return Zf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,f,_,v,m,S;return $f(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(!(a=E.sent()))throw new aD(tD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return s=CP(),c=a.audioMid,u=a.videoMid,d={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:c,videoMid:u,sdpInfo:{sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("startPullStream",d)];case 2:return l=E.sent(),(h=[]).push(new Promise((function(t,r){var i=setTimeout((function(){return r(new aD(tD.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),FF);e.on("ontrack",(function r(n){"video"===n.mediaType&&(VF.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),h.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new aD(tD.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),FF);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(VF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),p=function(t){e.ontrack(t)},null===(i=this._handler)||void 0===i||i.on("ontrack",p),this._ontrackCallbackMap.set(e,p),f=null==l?void 0:l.relayMessage,_=f.audioMid,v=f.videoMid,m=f.sequenceId,S=f.sdp,e.videoMid=v,e.audioMid=_,e.sequenceId=m,e._workaround_1_=!1,e.paused=!1,e.hasSubscribed=!0,e.subAudio=!0,e.subVideo=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.setAnswerSdp(null==a?void 0:a.sdp,S,{},e,RL.DOWN)];case 3:return E.sent(),[4,Promise.all(h)];case 4:return E.sent(),this.monitor.rtcSubscribeStat(DL.SUCCESS,s,PL.UNKNOWN,e.userId),this._statsReport||(this._statsReport=new xF(this,this._handler,this.monitor)),null===(o=this._statsReport)||void 0===o||o.setRemoteStreamStatsEvtInterval(e,{rtt:!1}),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,r,i;return Zf(this,void 0,void 0,(function(){var n;return $f(this,(function(o){switch(o.label){case 0:BF("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.hasSubscribed=!1,e.subVideo=!1,e.subAudio=!1,[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 5:return o.sent(),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(i=this._statsReport)||void 0===i||i.unsubscribe(e),[2]}}))}))},t.prototype.destroy=function(){var e,t,r,i;VF.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,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),null===(i=this._statsReport)||void 0===i||i.destroy(),this.connectionState=LF.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._dataChannelSignal)||void 0===r?void 0:r.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}),qf([zF],t.prototype,"join",null),qf([HF,GF],t.prototype,"publish",null),qf([HF,GF],t.prototype,"updatePubTrack",null),qf([HF,GF],t.prototype,"unpublish",null),qf([HF,GF],t.prototype,"subscribe",null),qf([GF],t.prototype,"controlMessage",null),qf([GF],t.prototype,"updateUserAttributes",null),qf([HF,GF],t.prototype,"updateSubTrack",null),qf([HF,GF],t.prototype,"subscribe4pushTrack",null),qf([HF,GF],t.prototype,"unsubscribe4removeTrack",null),qf([HF,GF],t.prototype,"unsubscribe",null),qf([HF,GF],t.prototype,"handleRemoveStream",null),qf([HF],t.prototype,"subscribePublicStream",null),qf([HF],t.prototype,"unsubscribePublicStream",null),t}(nk);function GF(e,t,r){var i=r.value;return r.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:return this._handler&&this._state===LF.CONNECTED?[4,i.apply(this,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:throw new aD(tD.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},r}function HF(e,t,r){var i=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,i.apply(this,e)];case 3:return[2,r.sent()];case 4:return t(),[7];case 5:return[2]}}))}))},r}function zF(e,t,r){var i=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Zf(this,void 0,void 0,(function(){var t,r=this;return $f(this,(function(n){return t=!1,[2,new Promise((function(n,o){return Zf(r,void 0,void 0,(function(){var r,a;return $f(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new aD(tD.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,i.apply(this,e)];case 2:return r=s.sent(),n(r),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},r}var KF,YF,XF,WF=function(){function e(){}return e.getNalunits=function(t){if(t.length-t.position<4)return[];var r=t.position;return 1===t.getInt32(r)||0===t.getInt16(r)&&1===t.getInt8(r+2)?e.getAnnexbNals(t):e.getAvccNals(t)},e.getAnnexbNals=function(t){for(var r=[],i=e.getHeaderPositionAnnexB(t),n=i.pos,o=n;n<t.length-4;){var a=new Uint8Array(t.buffer.slice(n,n+i.headerLength));i.pos===t.position&&t.skip(i.headerLength),o=(i=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&&r.push(s),t.skip(o-t.position),n=o}return r},e.getAvccNals=function(t){for(var r=[];t.position<t.length-4;){var i=t.getInt32(t.position);if(!(t.length-t.position>=i))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+i));t.skip(i);var a={header:n,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r},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,r=0,i=e.length;3!==r&&4!==r&&t<i-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===i-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=i:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=i)),{pos:t,headerLength:r}},e.getAvcc=function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var i=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),i),i+=2,r.set(e,i),r[i+=e.byteLength]=1,i++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),i),i+=2,r.set(t,i),r},e}(),JF=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 r=Math.floor(t/4),i=t%4,n=0;n<r;n++)e.readByte(this,4);i>0&&e.readByte(this,i)},e.readByte=function(e,t,r){var i;switch(t){case 1:i=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:i=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");i=e.getUint8(e.position)<<16,i|=e.getUint8(e.position+1)<<8,i|=e.getUint8(e.position+2);break;case 4:i=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");i=e.getUint32(e.position)<<32,i|=e.getUint32(e.position+4);break;default:i=""}return e.position+=t,i},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}(),qF=new rk("Stream",0),ZF=function(){function e(){this.isScreen=!1,this.seiList=[],this.enableSimulcast=!1,this.prevScaleResolutionDownBy=1,this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1}}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(EV()){var r=t.createEncodedStreams(),i=r.readable,n=r.writable,o=new TransformStream({transform:function(t,r){var i=e.seiList[0];if(i){var n=new Uint8Array(i.content.byteLength+5);n.set([0,0,0,1,6]),n.set(i.content,5);var o=new Uint8Array(n.byteLength+t.data.byteLength);0===i.repeatCount&&e.seiList.splice(0,1),i.repeatCount--,o.set(new Uint8Array(t.data)),o.set(n,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});i.pipeThrough(o).pipeTo(n)}}else qF.print("no sender found when trying to bind encodedTransform")},e.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else qF.print("no sender found when trying to bind encodedTransform")},e.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.destroy(),this.observer=void 0,this.prevScaleResolutionDownBy=1},e.prototype.switchTrackEnableState=function(e,t){var r;"audio"===e?r=this.audioTrack:"video"===e&&(r=this.videoTrack);var i=null==r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)},e}(),$F=function(e){function t(t,r,i,n){var o=e.call(this)||this;return o.userId=t,o.isScreen=i,o.streamId=r,o.hasAudio=n.audiostream,o.hasVideo=n.videostream,o._attributes=n,o.subVideo=!1,o.subAudio=!1,o._sequenceId=0,o.subMediaType=Bf.NONE,o.subConfig={videoIndex:0},o.hasSubscribed=!1,o}return Cf(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,this.hasAudio=e.localaudio,this._attributes=e},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,i=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){var i=WF.getNalunits(new JF(t.data)).find((function(e){return e.sei}));i&&e.safeEmit("onSEIMessage",i.body.slice(1)),r.enqueue(t)}})).pipeTo(i)}else qF.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,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else qF.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,r,i;if((null===(r=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===r?void 0:r.id)===this.streamId){var n=e.track;"video"===(null==n?void 0:n.kind)?this._setVideoTrack(n):"audio"===(null===(i=e.track)||void 0===i?void 0:i.kind)&&this._setAudioTrack(n),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;qF.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.observer=void 0},t.prototype.resetHasSubscribed=function(){this.hasSubscribed=!1},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,r;(null===(r=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new RF(e,AP()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,r;(null===(r=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new IF(e,AP()),this.emit("ontrack",this.videoTrack))},t}(nk);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(KF||(KF={})),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_MUTE_AUDIO="on_user_mute_audio",e.ON_USER_MUTE_VIDEO="on_user_mute_video",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"}(YF||(YF={})),function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(XF||(XF={}));var QF,eB=function(){function e(e,t){this._audioEventSessionId=PP(),this._videoEventSessionId=PP(),this._isScreen=!1,this._audioFirstFrameState=XF.INITIAL,this._videoFirstFrameState=XF.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:LL.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:LL.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 r,i,n,o,a;return Zf(this,void 0,void 0,(function(){var s,c,u,d,l,h,p=this;return $f(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:return f.sent(),s=this._transportDelay,c=LL.LOGIN,u=LL.UNMUTE,d=LL.SUBSCRIBE,l=LL.PUSH_TRACK,[c,u,d,l].indexOf(t)>=0&&(s=0),e===UL.AUDIO?(this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},h={media_type:e,event_type:ML.BEGIN_RECV,type:t,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){p.stopRecvFrame(UL.AUDIO,xL.TIMEOUT),p._firstAudioFrameInterval&&window.clearInterval(p._firstAudioFrameInterval)}),this._timeout),px.rtcFirstFrame(h),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=XF.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===UL.VIDEO&&(this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t},h={media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?UL.SCREEN_VIDEO:e,event_type:ML.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(){p.stopRecvFrame(UL.VIDEO,xL.TIMEOUT),p._firstVideoFrameInterval&&window.clearInterval(p._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),px.rtcFirstFrame(h),this._videoFirstFrameState=XF.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var r,i,n,o,a,s,c;if(e===UL.AUDIO){if(this._audioFirstFrameState!==XF.BEGIN)return;var u={event_type:ML.RECV_END,media_type:e,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,reason:t,result:!1,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.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,px.rtcFirstFrame(u),this._audioFirstFrameState=XF.STOPPED}else if(e===UL.VIDEO){if(this._videoFirstFrameState!==XF.BEGIN)return;u={event_type:ML.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?UL.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,px.rtcFirstFrame(u),this._videoFirstFrameState=XF.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,r,i;return Zf(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p;return $f(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:if(f.sent(),n=this._transportDelay,o=LL.LOGIN,a=LL.UNMUTE,s=LL.SUBSCRIBE,c=LL.PUSH_TRACK,e===UL.AUDIO){if(this._audioFirstFrameState!==XF.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:ML.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),px.rtcFirstFrame(p),this._audioFirstFrameState=XF.RECEIVED}else if(e===UL.VIDEO){if(this._videoFirstFrameState!==XF.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:ML.RECV_END,media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?UL.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:n},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),px.rtcFirstFrame(p),this._videoFirstFrameState=XF.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var r,i,n,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&t.audio&&this.beginRecvFrame(UL.AUDIO,LL.LOGIN),e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&t.video&&this.beginRecvFrame(UL.VIDEO,LL.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(UL.AUDIO,xL.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(UL.VIDEO,xL.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(UL.AUDIO,LL.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(UL.AUDIO,xL.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(UL.AUDIO,LL.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(UL.AUDIO,xL.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(UL.AUDIO,LL.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(UL.AUDIO,xL.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(UL.VIDEO,LL.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(UL.VIDEO,xL.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(UL.VIDEO,LL.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(UL.VIDEO,xL.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(UL.VIDEO,LL.ENABLE):this.stopRecvFrame(UL.VIDEO,xL.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(UL.AUDIO,LL.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(UL.AUDIO,LL.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(UL.VIDEO,LL.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(UL.VIDEO,LL.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(UL.VIDEO,LL.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(UL.VIDEO,xL.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(UL.AUDIO,LL.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(UL.AUDIO,xL.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,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(UL.AUDIO,LL.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&this.stopRecvFrame(UL.AUDIO,xL.UNSUBSCRIBE)},e.prototype.setSubscribeVideo=function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(UL.VIDEO,LL.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&this.stopRecvFrame(UL.VIDEO,xL.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(UL.AUDIO,LL.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(UL.AUDIO,xL.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.setInterval((function(){return Zf(e,void 0,void 0,(function(){var e,r,i,n,o,a,s,c;return $f(this,(function(u){switch(u.label){case 0:return(null===(i=this._handler)||void 0===i?void 0:i.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())?[4,mV(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(),(r=e.find((function(e){return"inbound-rtp"===e.type})))&&r.framesReceived>t){if(-1===t)return t=r.framesReceived,[2];this.recvFrameFinish(UL.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.setInterval((function(){return Zf(e,void 0,void 0,(function(){var e,r,i,n,o,a,s,c;return $f(this,(function(u){switch(u.label){case 0:return(null===(i=this._handler)||void 0===i?void 0:i.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())?[4,mV(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(),(r=e.find((function(e){return"inbound-rtp"===e.type})))&&r.totalSamplesReceived>t){if(-1===t)return t=r.totalSamplesReceived,[2];this.recvFrameFinish(UL.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return Zf(this,void 0,void 0,(function(){var e=this;return $f(this,(function(t){switch(t.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return t.sent(),this._transportDelayInterval=window.setInterval((function(){return Zf(e,void 0,void 0,(function(){return $f(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 Zf(this,void 0,void 0,(function(){var r,i,n;return $f(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,mV(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:r=o.sent(),i=r.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(n=r.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.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:LL.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:LL.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"}(QF||(QF={}));var tB=function(){function e(e,t){this._audioEventSessionId=PP(),this._videoEventSessionId=PP(),this._currentAudioSend={startTime:0,eventSessionId:0,type:LL.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:LL.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=QF.INITIAL,this._videoFirstFrameState=QF.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var r,i,n,o=this;if(e===UL.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:ML.BEGIN_SEND,type:t,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){o.stopSendFrame(UL.AUDIO,xL.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),px.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=QF.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===UL.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?UL.SCREEN_VIDEO:e,event_type:ML.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(UL.VIDEO,xL.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),px.rtcFirstFrame(a),this._videoFirstFrameState=QF.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 r,i,n,o,a;if(e===UL.AUDIO){if(this._audioFirstFrameState!==QF.BEGIN)return;var s={event_type:ML.SENT_END,media_type:e,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioSend)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,px.rtcFirstFrame(s),this._audioFirstFrameState=QF.STOPPED}else if(e===UL.VIDEO){if(this._videoFirstFrameState!==QF.BEGIN)return;s={event_type:ML.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?UL.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,px.rtcFirstFrame(s),this._videoFirstFrameState=QF.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===UL.AUDIO){if(this._audioFirstFrameState!==QF.BEGIN)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,i=r.type,n=r.startTime,o={event_type:ML.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:i};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),px.rtcFirstFrame(o),this._audioFirstFrameState=QF.SENT}else if(e===UL.VIDEO){if(this._videoFirstFrameState!==QF.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;i=a.type,n=a.startTime,o={event_type:ML.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?UL.SCREEN_VIDEO:e,start:n,result:!0,event_session_id:this._videoEventSessionId,type:i};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),px.rtcFirstFrame(o),this._videoFirstFrameState=QF.SENT}},e.prototype.setLogin=function(e){var t,r;this._login!==e&&(this._login=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(UL.VIDEO,LL.LOGIN),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(UL.AUDIO,LL.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(UL.AUDIO,xL.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(UL.VIDEO,xL.LEAVE_ROOM))},e.prototype.setPublish=function(e){var t,r;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(UL.VIDEO,LL.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(UL.AUDIO,LL.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(UL.AUDIO,xL.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(UL.VIDEO,xL.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(UL.AUDIO,LL.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(UL.AUDIO,xL.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(UL.AUDIO,LL.ENABLE),!e&&this._audioSending&&this.stopSendFrame(UL.AUDIO,xL.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(UL.VIDEO,LL.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(UL.VIDEO,xL.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(UL.VIDEO,LL.ENABLE),!e&&this._videoSending&&this.stopSendFrame(UL.VIDEO,xL.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(UL.AUDIO,xL.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(UL.AUDIO,xL.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(UL.AUDIO,LL.PUSH),!e&&this._audioSending&&this.stopSendFrame(UL.AUDIO,xL.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(UL.VIDEO,xL.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(UL.VIDEO,xL.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(UL.VIDEO,LL.PUSH),!e&&this._videoSending&&this.stopSendFrame(UL.VIDEO,xL.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(UL.AUDIO,xL.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(UL.VIDEO,xL.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,r,i,n,o;return Zf(this,void 0,void 0,(function(){var a;return $f(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(r=null===(t=this._stream)||void 0===t?void 0:t.videoTrack)||void 0===r?void 0:r.getTrack())?[4,mV(null===(i=this._handler)||void 0===i?void 0:i.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,r,i,n,o;return Zf(this,void 0,void 0,(function(){var a;return $f(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(r=null===(t=this._stream)||void 0===t?void 0:t.audioTrack)||void 0===r?void 0:r.getTrack())?[4,mV(null===(i=this._handler)||void 0===i?void 0:i.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.setInterval((function(){return Zf(e,void 0,void 0,(function(){var e;return $f(this,(function(r){switch(r.label){case 0:return[4,this._getFirstVideoFrameStats()];case 1:if((e=r.sent())&&e.framesSent>t){if(-1===t)return t=e.framesSent,[2];this.sendFrameFinish(UL.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return Zf(e,void 0,void 0,(function(){var e;return $f(this,(function(r){switch(r.label){case 0:return[4,this._getFirstAudioFrameStats()];case 1:if((e=r.sent())&&e.packetsSent>t){if(-1===t)return t=e.packetsSent,[2];this.sendFrameFinish(UL.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}return[2]}}))}))}),100)},e.prototype.destroy=function(){delete this._stream,delete this._handler,window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)},Object.defineProperty(e.prototype,"_audioSending",{get:function(){return this._audioFirstFrameState===QF.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===QF.BEGIN},enumerable:!1,configurable:!0}),e}(),rB=new rk("Room",1),iB=function(e){function t(t){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._roomConfig=t,r._mediaServerClient=new jF,r._addHandlerEventHandler(),r._isReconnecting=!1,r}return Cf(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,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E=this;null===(e=this._mediaServerClient)||void 0===e||e.on(rx.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(rx.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(rx.USER_CONNECTION,this._onUserConnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(rx.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(rx.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(rx.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(rx.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(rx.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(rx.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(rx.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(rx.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(rx.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(rx.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(rx.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(ix.RSCP,this._onPublishOnDemand.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(nx.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(nx.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on("onRemoteStreamStats",(function(e){E.emit(YF.ON_REMOTE_STREAM_STATS,e)})),null===(S=this._mediaServerClient)||void 0===S||S.on("onLocalStreamStats",(function(e){E.emit(YF.ON_LOCAL_STREAM_STATS,e)}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,r,i,n,o){return Zf(this,void 0,void 0,(function(){var a=this;return $f(this,(function(s){return vx.setStats({rtc_app_id:e,room_id:t,user_id:i.userId}),rB.print("join()"),[2,new Promise((function(s,c){return Zf(a,void 0,void 0,(function(){var a,u,d=this;return $f(this,(function(l){return this._joinResolveCallback=s,this._joinRejectCallback=c,this._liveControlMessage=n,this._roomInfo={appId:e,roomId:t,token:r,userInfo:i,useCloudProxy:o},a=CP(),this.setSessionId(),px.joinRoom(BL.BEGIN,a,!1,"",{enable_cloud_proxy:null===(u=this._roomInfo)||void 0===u?void 0:u.useCloudProxy}),this._join((function(e){var t;px.joinRoom(BL.END,a,!0,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)}),(function(e){var t;px.joinRoom(BL.END,a,!1,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)}),!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,r){var i;return void 0===r&&(r=!1),Zf(this,void 0,void 0,(function(){var n,o,a;return $f(this,(function(s){switch(s.label){case 0:n=CP(),rB.print("_join()"),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId},r,this._liveControlMessage)];case 2:return o=s.sent(),this._mediaServerClient.roomAttributes=o.roomAttributes,this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e(null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo),this._isReconnecting=!1,px.rtcJoinRoom(0,"web","web",CP()-n),this._onJoinSucc(o,r),[3,4];case 3:return(a=s.sent()).code!==tD.OPERATION_CANCEL&&"function"==typeof t?[2,t(a)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,r){var i,n,o,a,s;return Zf(this,void 0,void 0,(function(){var c,u,d,l;return $f(this,(function(h){switch(h.label){case 0:return rB.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new ZF,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new tB(this._localScreenStream,this._mediaServerClient.handler))),c=!1,u=!1,d=!1,l=!1,!this._localScreenStream.videoTrack&&t?(t instanceof wF&&(u=!0),c=!0):this._localScreenStream.videoTrack&&!t&&(c=!1),!this._localScreenStream.audioTrack&&r?(r instanceof DF&&(l=!0),d=!0):this._localScreenStream.audioTrack&&!r&&(d=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=r,this._localScreenStream.videoEncodeConfig=e,this._localScreenStream.hasPublished?[3,2]:(null===(i=this._localScreenStream.observer)||void 0===i||i.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]);case 1:return h.sent(),[3,4];case 2:return u?null===(n=this._localScreenStream.observer)||void 0===n||n.setPushVideo(c):null===(o=this._localScreenStream.observer)||void 0===o||o.setEnableVideo(c),l?null===(a=this._localScreenStream.observer)||void 0===a||a.setPushAudio(d):null===(s=this._localScreenStream.observer)||void 0===s||s.setEnableAudio(d),[4,this.updatePubScreenTrack()];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return rB.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 Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return rB.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){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return rB.print("controlMessage","Invoke controlMessage"),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(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 Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return rB.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,r,i,n){var o,a,s,c,u,d;return void 0===n&&(n=!1),Zf(this,void 0,void 0,(function(){var l,h,p,f,_,v;return $f(this,(function(m){switch(m.label){case 0:if(rB.print("publish","Invoke publish"),l=!1,this._localStream||(this._localStream=new ZF,this._mediaServerClient.handler&&(this._localStream.observer=new tB(this._localStream,this._mediaServerClient.handler)),l=!0),this._localStream.videoTrack=r,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,this._localStream.hasPublished)return[3,5];m.label=1;case 1:return m.trys.push([1,3,,4]),n?null===(o=this._localStream.observer)||void 0===o||o.setLogin(!0):l&&(h=!!this._localStream.videoTrack,p=!!this._localStream.audioTrack,f=this._localStream.videoTrack instanceof wF,_=this._localStream.audioTrack instanceof DF,this._roomConfig.isAutoPublish?(h&&(f?null===(a=this._localStream.observer)||void 0===a||a.setPushVideo(!0):null===(s=this._localStream.observer)||void 0===s||s.setEnableVideo(!0)),p&&(_?null===(c=this._localStream.observer)||void 0===c||c.setPushAudio(!0):null===(u=this._localStream.observer)||void 0===u||u.setEnableAudio(!0))):null===(d=this._localStream.observer)||void 0===d||d.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return m.sent(),this.emit(YF.ON_PUBLISH_RESULT,{isScreen:!1,state:Uf.PUBLISH_SUCC}),[3,4];case 3:throw v=m.sent(),this.emit(YF.ON_PUBLISH_RESULT,{isScreen:!1,state:Uf.PUBLISH_FAIL}),v;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:m.sent(),m.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return rB.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 Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return rB.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,r){return Zf(this,void 0,void 0,(function(){return $f(this,(function(i){switch(i.label){case 0:return rB.print("subscribe","remoteStream %o",e),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return i.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){var i,n;return Zf(this,void 0,void 0,(function(){return $f(this,(function(o){return rB.print("updateSubTrack","Invoke updateSubTrack"),e.subMediaType===t&&(null===(i=null==e?void 0:e.subConfig)||void 0===i?void 0:i.videoIndex)===(null==r?void 0:r.videoIndex)?[2,Promise.resolve(e)]:[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(e,t,r)]}))}))},t.prototype.unsubscribe=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return rB.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),Zf(this,void 0,void 0,(function(){var r,i,n,o,a,s,c;return $f(this,(function(u){switch(u.label){case 0:rB.print("leave","Invoke leave"),r=CP(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(i=Qf(this._remoteStreams.values()),n=i.next();!n.done;n=i.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=i.return)&&c.call(i)}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(),px.rtcLeaveRoom(0,"",CP()-r),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&px.rtcLeaveRoom(-1,a.message,CP()-r),[3,4];case 4:return[2]}}))}))},t.prototype.destroy=function(){var e,t,r,i;rB.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var n=Qf(this._remoteStreams),o=n.next();!o.done;o=n.next()){var a=e_(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===(r=this._localStream)||void 0===r||r.clean(),this._localStream=void 0),this._localScreenStream&&(null===(i=this._localScreenStream)||void 0===i||i.clean(),this._localScreenStream=void 0),this._removeHandlerEventHandler(),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear()},t.prototype.updateToken=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return rB.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.muteLocalTrack=function(e,t){var r,i,n,o,a,s;return Zf(this,void 0,void 0,(function(){var c,u;return $f(this,(function(d){switch(d.label){case 0:return this._localStream&&(null===(r=this._localStream)||void 0===r?void 0:r.hasPublished)?(c=t!==kf.MUTE_STATE_OFF,u=this._localStream.switchTrackEnableState(e,c),"audio"===e?null===(n=null===(i=this.localStream)||void 0===i?void 0:i.observer)||void 0===n||n.setUnmuteAudio(c):null===(a=null===(o=this.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setUnmuteVideo(c),u?[4,null===(s=this._mediaServerClient)||void 0===s?void 0:s.updatePubTrack(this._localStream)]:[3,2]):[2,!1];case 1:d.sent(),d.label=2;case 2:return[2,u]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Zf(this,void 0,void 0,(function(){var t,r,i,n,o,a,s=this;return $f(this,(function(c){t=[];try{for(r=Qf(this._remoteStreams.values()),i=r.next();!i.done;i=r.next())n=i.value,Array.isArray(n)&&n.forEach((function(r){if(r.hasSubscribed){var i=null;switch(e){case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===Bf.AUDIO_ONLY?i=Bf.NONE:r.subMediaType===Bf.AUDIO_AND_VIDEO&&(i=Bf.VIDEO_ONLY);break;case xf.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===Bf.VIDEO_ONLY?i=Bf.NONE:r.subMediaType===Bf.AUDIO_AND_VIDEO&&(i=Bf.AUDIO_ONLY);break;case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==Bf.NONE&&(i=Bf.NONE)}if(null!==i){var n=s.updateSubTrack(r,i,r.subConfig);n&&t.push(n)}}}))}catch(e){o={error:e}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return Zf(this,void 0,void 0,(function(){var t,r,i,n,o,a,s=this;return $f(this,(function(c){t=[];try{for(r=Qf(this._remoteStreams.values()),i=r.next();!i.done;i=r.next())n=i.value,Array.isArray(n)&&n.forEach((function(r){if(r.hasSubscribed){var i=null;switch(e){case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===Bf.NONE?i=Bf.AUDIO_ONLY:r.subMediaType===Bf.VIDEO_ONLY&&(i=Bf.AUDIO_AND_VIDEO);break;case xf.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===Bf.NONE?i=Bf.VIDEO_ONLY:r.subMediaType===Bf.AUDIO_ONLY&&(i=Bf.AUDIO_AND_VIDEO);break;case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==Bf.AUDIO_AND_VIDEO&&(i=Bf.AUDIO_AND_VIDEO)}if(null!==i){var n=s.updateSubTrack(r,i,r.subConfig);n&&t.push(n)}}}))}catch(e){o={error:e}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)},t.prototype.setSessionId=function(){this._sessionId=TP(),vx.setStats({rtc_session_id:this._sessionId})},t.prototype.sendRoomMessage=function(e,t){var r,i;return void 0===t&&(t=!1),Zf(this,void 0,void 0,(function(){var n,o;return $f(this,(function(a){switch(a.label){case 0:return n={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:t,message:""},t?(o=n,[4,wP.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===(i=this._mediaServerClient)||void 0===i?void 0:i.sendRoomMessage(n)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){rB.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new jF,this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var r,i,n,o,a,s=this;rB.print("JoinSuccess()");var c=[],u=[],d=[],l=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var r=s._remoteUsers.get(t.clientId);r?r._stillExist=!0:c.push(t)}}));try{for(var h=Qf(this._remoteUsers.values()),p=h.next();!p.done;p=h.next()){var f=p.value;f._stillExist||u.push({clientId:f.userId}),delete f._stillExist}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):l.push(e)}));try{for(var _=Qf(this._remoteStreams.values()),v=_.next();!v.done;v=_.next()){var m=v.value;Array.isArray(m)&&m.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:tx.clientDisconnected})}))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(o=_.return)&&o.call(_)}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)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,r=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 i=Qf(this._remoteStreams.values()),n=i.next();!n.done;n=i.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return Zf(r,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),r.label=1;case 1:return r.trys.push([1,3,,4]),rB.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType,e.subConfig)];case 2:return r.sent(),rB.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(YF.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=r.sent(),rB.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=i.return)&&t.call(i)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t,r){var i,n,o,a,s,c,u,d,l,h,p,f;if(void 0===t&&(t=!0),void 0===r&&(r=!0),e.clientId!==(null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo.userId)){var _=this._findRemoteStream(e.clientId,e.streamId);if(!_){_=new $F(e.clientId,e.streamId,e.screen,e.attributes),this._initStreamListeners(_);var v=this._remoteStreams.get(e.clientId);v?v.push(_):this._remoteStreams.set(e.clientId,[_])}if(this._mediaServerClient.handler&&(_.observer=new eB(_,this._mediaServerClient.handler)),!_.isScreen&&(r&&_.hasVideo&&(_.attributes.extvideo?(null===(n=_.observer)||void 0===n||n.setExternalVideoSource(!0),null===(o=_.observer)||void 0===o||o.setPushVideo(!0)):(null===(a=_.observer)||void 0===a||a.setExternalVideoSource(!1),null===(s=_.observer)||void 0===s||s.setPublishVideo(!0))),r&&_.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(_.attributes.extaudio?(null===(c=_.observer)||void 0===c||c.setExternalAudioSource(!0),null===(u=_.observer)||void 0===u||u.setPushAudio(!0)):(null===(d=_.observer)||void 0===d||d.setExternalAudioSource(!1),null===(l=_.observer)||void 0===l||l.setPublishAudio(!0))),!0===t&&!1===r)){var m=this._roomConfig,S=m.isAutoSubscribeAudio,E=m.isAutoSubscribeVideo;null===(h=_.observer)||void 0===h||h.setLogin(!0,{audio:S,video:E})}return t&&this.safeEmit(rx.ON_ADD_STREAM,{stream:_}),!_.isScreen&&(null===(p=null==e?void 0:e.attributes)||void 0===p?void 0:p.localvideo)&&this.safeEmit(YF.ON_USER_START_VIDEO_CAPTURE,{userId:_.userId}),!_.isScreen&&(null===(f=null==e?void 0:e.attributes)||void 0===f?void 0:f.localaudio)&&this.safeEmit(YF.ON_USER_START_AUDIO_CAPTURE,{userId:_.userId}),_}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof r)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(r);var i={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,Jf({},i)),this.safeEmit(rx.USER_CONNECTION,{userInfo:i})}},t.prototype._onUserDisconnection=function(e){var t,r=this,i=e.clientId,n=e.tag,o=e.code;if(i)if(i===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;n===ox.kickedByAdmin?a=tD.KICKED_OUT:n===ox.onUserTokenDidExpire?a=tD.TOKEN_EXPIRED:n===ox.userDuplicateLogin&&(a=tD.DUPLICATE_LOGIN),o===ax.roomDismissByAdmin&&(a=tD.ROOM_DISMISS),a&&this.safeEmit(YF.ON_ROOM_ERROR,{errorCode:a})}else{var s=wf.DROPPED;n===ox.userLeave?s=wf.QUIT:n===ox.kickedByAdmin?s=wf.KICKED_BY_ADMIN:n===ox.roleChanged&&(s=wf.SWITCH_TO_INVISIBLE);var c=function(){r._remoteUsers.delete(i);var e=r._remoteStreams.get(i);Array.isArray(e)&&e.length&&(e.forEach((function(e){r.safeEmit(rx.ON_REMOVE_STREAM,{stream:e,reason:"Client leave"})})),r._remoteStreams.delete(i)),r.safeEmit(YF.ON_USER_LEAVE,{userInfo:{userId:i},reason:s})};if(n===ox.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(i);null!=u||self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(i,d)}else c()}},t.prototype._onRemoveStream=function(e){var t,r,i,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===(r=this._mediaServerClient)||void 0===r||r.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})),o._remoteStreams.set(e.clientId,t)}})),this.safeEmit(rx.ON_REMOVE_STREAM,{stream:s,reason:e.message}),s.hasVideo&&(null===(i=s.observer)||void 0===i||i.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,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E=e.clientId,y=e.streamId,g=e.attributes,b=this._findRemoteStream(E,y);if(b){var T=b.attributes,I=Jf(Jf({},T),g),R=!1,A=I.localaudio!==T.localaudio,C=!1,O=!1,N=I.localvideo!==T.localvideo,w=!1;I.audiostream!==T.audiostream&&(R=!0,C=!!I.audiostream,I.audiostream?this.safeEmit(YF.ON_USER_MUTE_AUDIO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_ON}):this.safeEmit(YF.ON_USER_MUTE_AUDIO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_OFF})),I.videostream!==T.videostream&&(O=!0,w=!!I.videostream,I.videostream?this.safeEmit(YF.ON_USER_MUTE_VIDEO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_ON}):this.safeEmit(YF.ON_USER_MUTE_VIDEO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_OFF})),I.localaudio!==T.localaudio&&(I.localaudio?(I.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(r=b.observer)||void 0===r||r.setPushAudio(!0)):(null===(i=b.observer)||void 0===i||i.setExternalAudioSource(!1),null===(n=b.observer)||void 0===n||n.setEnableAudio(!0)),this.safeEmit(YF.ON_USER_START_AUDIO_CAPTURE,{userId:E})):(I.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)),this.safeEmit(YF.ON_USER_STOP_AUDIO_CAPTURE,{userId:E}))),I.localvideo!==T.localvideo&&(I.localvideo?(I.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(YF.ON_USER_START_VIDEO_CAPTURE,{userId:E})):(I.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)),this.safeEmit(YF.ON_USER_STOP_VIDEO_CAPTURE,{userId:E}))),R&&!A&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!N&&(null===(S=b.observer)||void 0===S||S.setRemoteUnmuteVideo(w)),b.attributes=I}},t.prototype._onPushTrack=function(e){var t=this,r=e.clientId,i=e.streamId,n=this._findRemoteStream(r,i);n||(n=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){return t.safeEmit(YF.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){rB.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,r=e.clientId,i=e.streamId,n=e.message,o=this._findRemoteStream(r,i);o&&this._mediaServerClient.unsubscribe4removeTrack(o,n).then((function(){var e;if(o._workaround_1_){var n=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==i}));t._remoteStreams.set(r,n||[])}t.safeEmit(YF.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){rB.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,r=e.nodes,i=e.reason;Ux.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(r)&&r.length?this._getAccessNode=r[0]:this._getAccessFeedback=i,px.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(i)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,r=this;this._isReconnecting=!0;try{for(var i=Qf(this._remoteStreams.values()),n=i.next();!n.done;n=i.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=i.return)&&t.call(i)}finally{if(e)throw e.error}}px.rtcReconnect(1002,pL.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,fL.PEERCONNECTION),this._join((function(){px.rtcReconnected(_L.PEERCONNECTION_RECONNECTED,vL.PEERCONNECTION)}),(function(e){rB.print("Reconnecting error, will reconnect after 3s",e),r._reconnectTimer=setTimeout(r._reconnect.bind(r),3e3)}),!0)},t.prototype._handleAbnormalDisconnection=function(){rB.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t;if(e.next===LF.DISCONNECTED)t=Gf.CONNECTION_STATE_DISCONNECTED;else if(e.next===LF.CONNECTED)t=this._isReconnecting?Gf.CONNECTION_STATE_RECONNECTED:Gf.CONNECTION_STATE_CONNECTED;else{if(e.next!==LF.CONNECTING)return;t=this._isReconnecting?Gf.CONNECTION_STATE_RECONNECTING:Gf.CONNECTION_STATE_CONNECTING}this.safeEmit(nx.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(r){var i;t.emit(YF.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(i=t._roomInfo)||void 0===i?void 0:i.roomId,streamIndex:e.isScreen?Ff.STREAM_INDEX_SCREEN:Ff.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(rx.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(rx.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(rx.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){var t,r=(null===(t=e.body)||void 0===t?void 0:t.error)||0;this.safeEmit(rx.POST_PROCESSING_MESSAGE,{code:r,message:["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"][r],type:e.type})},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(rx.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onPublishOnDemand=function(e){var t,r,i,n;if((null===(t=this._localStream)||void 0===t?void 0:t.enableSimulcast)&&(null===(r=this._localStream)||void 0===r?void 0:r.videoTransceiver)){var o=null===(i=this._localStream)||void 0===i?void 0:i.stream.id,a=null===(n=this._localStream)||void 0===n?void 0:n.videoTransceiver.sender,s=a.getParameters();if(Array.isArray(s.encodings)&&Array.isArray(e)){var c={};rB.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(o)){var r=null==e?void 0:e.Metadata.SubvideoIndex;c[r]=r}})),s.encodings=s.encodings.map((function(e){return e.rid&&(c[e.rid]===+e.rid?e.active=!0:e.active=!1),e}))}a.setParameters(s)}},t}(nk),nB=function(e,t){void 0===t&&(t={});var r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=e_(e,2),i=t[0],n=t[1];"muted"===i?r.muted=!0:r.setAttribute(i,n)})),r},oB=function(e,t){return void 0===t&&(t={}),t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var r=e_(t,2),i=r[0],n=r[1];e.setAttribute(i,n)})),e},aB=new rk("Player",0),sB=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],cB={playsinline:"","webkit-playsinline":""},uB={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},dB=new(function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var r="audio"===e?cB:uB;if("video"===e&&this.videoCache.length>0){if(i=this.videoCache.pop())return oB(i,{style:t,attributes:r}),i}else if("audio"===e&&this.audioCache.length>0){var i;if(i=this.audioCache.pop())return oB(i,{style:t,attributes:r}),i}return nB(e,{style:t,attributes:r})},e.prototype.recycle=function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)},e}()),lB=function(e){function t(t){var r=e.call(this)||this;r.mirrorType=Hf.MIRROR_TYPE_NONE,r.emitVideoEvent=function(e){var t,i,n={type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:e.type,currentTime:(null===(i=r._videoDom)||void 0===i?void 0:i.currentTime)||0,isScreen:r.isScreen};r.emit("playback_event",n)},r._internalPlay=function(){var e;if(null===(e=r._videoDom)||void 0===e?void 0:e.paused){var t=r._videoDom.play();(null==t?void 0:t.then)&&t.catch((function(e){var t,i;px.rtcError("video autoplay failed, userId: ".concat(r.userId),-1e3),r.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:"autoplay-error",currentTime:(null===(i=r._videoDom)||void 0===i?void 0:i.currentTime)||0})}))}};var i=t.renderDom,n=t.userId;r.renderMode=void 0!==t.renderMode?t.renderMode:Vf.RENDER_MODE_FIT;var o="string"==typeof i?document.getElementById(i):i;if(!o)throw new aD(tD.CANT_FIND_DOM,"can't find dom");return r._containerDom=o,r.userId=n,r.isScreen=!!t.isScreen,r._initVideo(),r}return Cf(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=dB.getOrCreate("video",{width:"100%",height:"100%",background:"black"}),this._videoDom.id="".concat(this.userId,"_").concat(AP()),this.renderMode===Vf.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===Hf.MIRROR_TYPE_RENDER)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&sB.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._videoDom&&(sB.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(r){var i;if("timeupdate"===r.eventName){var n=e.isScreen?1.5:.5;if(void 0===t.__cumulativeTime&&(t.__cumulativeTime=0),0===(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime))return;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 r;return Zf(this,void 0,void 0,(function(){var i,n,o=this;return $f(this,(function(a){return i=this._videoDom,aB.print("playVideo","play video track: ".concat(this.userId)),i&&i.srcObject instanceof MediaStream&&i.srcObject.getTrackById(null===(r=e.getTrack())||void 0===r?void 0:r.id)||(i||(this._initVideo(),i=this._videoDom),aB.print("playVideo","play video by dom: ".concat(null==i?void 0:i.id)),(n=new MediaStream).addTrack(e.getTrack()),i.srcObject=n,this._containerDom.appendChild(i),i.addEventListener("canplay",this._internalPlay),i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return o._internalPlay()})),t&&this._recordFrame(t)),[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}},t.prototype.manuallyPlay=function(){if(aB.print("Invoke AudioPlayer.manuallyPlay"),!this._videoDom)throw new aD(tD.INVALID_PARAMS,"Player not found");var e=this._videoDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.mirror=function(e){aB.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?Hf.MIRROR_TYPE_RENDER:Hf.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;aB.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0},t.prototype.destroy=function(){aB.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(dB.recycle(this._videoDom),delete this._videoDom)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}($P.exports.EventEmitter),hB=function(e){function t(t,r){var i=e.call(this)||this;if(i.emitVideoEvent=function(e){var t,r,n={type:"audio",rawEvent:e,readyState:(null===(t=i._audioDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._audioDom)||void 0===r?void 0:r.currentTime)||0};i.emit("playback_event",n)},i._internalPlay=function(){var e,t;if(bx("_internalPlay",{paused:null===(e=i._audioDom)||void 0===e?void 0:e.paused}),null===(t=i._audioDom)||void 0===t?void 0:t.paused)try{var r=i._audioDom.play();(null==r?void 0:r.then)&&r.catch((function(e){i._autoPlayError(e)})).then((function(){bx("_internalPlay successfully",{userId:i.userId})}))}catch(e){i._autoPlayError(e)}},r){var n=document.getElementById(r);if(!n)throw new aD(tD.CANT_FIND_DOM,"can't find dom");i._containerDom=n}else i._containerDom=document.body;return i.userId=t,i._initAudio(),i}return Cf(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=dB.getOrCreate("audio",{display:"none"}),this._audioDom.id="".concat(this.userId,"_").concat(AP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&sB.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(sB.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return Zf(this,void 0,void 0,(function(){var r,i,n=this;return $f(this,(function(o){return aB.print("playAudio","play audio track: ".concat(this.userId)),(r=this._audioDom)&&r.srcObject instanceof MediaStream&&r.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)||(r||(this._initAudio(),r=this._audioDom),(i=new MediaStream).addTrack(e.getTrack()),r.srcObject=i,null==r||r.addEventListener("canplay",this._internalPlay),null==r||r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return n._internalPlay()}))),[2]}))}))},t.prototype._autoPlayError=function(e){var t,r;px.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===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0})},t.prototype.manuallyPlay=function(){if(aB.print("Invoke AudioPlayer.manuallyPlay"),!this._audioDom)throw new aD(tD.INVALID_PARAMS,"Player not found");var e=this._audioDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.setPlaybackDevice=function(e){return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:return aB.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,hF.getAudioPlayback()];case 1:return t=r.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return r.sent(),[2]}}))}))},t.prototype.stop=function(){var e=this._containerDom;aB.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom))},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){aB.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._audioDom&&(dB.recycle(this._audioDom),delete this._audioDom)},t}($P.exports.EventEmitter),pB="object"==("undefined"==typeof global?"undefined":t(global))&&global&&global.Object===Object&&global,fB="object"==("undefined"==typeof self?"undefined":t(self))&&self&&self.Object===Object&&self,_B=pB||fB||Function("return this")(),vB=_B.Symbol,mB=Object.prototype,SB=mB.hasOwnProperty,EB=mB.toString,yB=vB?vB.toStringTag:void 0;var gB=Object.prototype.toString;var bB=vB?vB.toStringTag:void 0;function TB(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":bB&&bB in Object(e)?function(e){var t=SB.call(e,yB),r=e[yB];try{e[yB]=void 0;var i=!0}catch(e){}var n=EB.call(e);return i&&(t?e[yB]=r:delete e[yB]),n}(e):function(e){return gB.call(e)}(e)}function IB(e){return null!=e&&"object"==t(e)}var RB=Array.isArray;function AB(e){var r=t(e);return null!=e&&("object"==r||"function"==r)}function CB(e){return e}function OB(e){if(!AB(e))return!1;var t=TB(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var NB=_B["__core-js_shared__"],wB=function(){var e=/[^.]+$/.exec(NB&&NB.keys&&NB.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var DB=Function.prototype.toString;var PB=/^\[object .+?Constructor\]$/,kB=Function.prototype,MB=Object.prototype,UB=kB.toString,LB=MB.hasOwnProperty,xB=RegExp("^"+UB.call(LB).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function VB(e){return!(!AB(e)||(t=e,wB&&wB in t))&&(OB(e)?xB:PB).test(function(e){if(null!=e){try{return DB.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function FB(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var BB=Date.now;var jB,GB,HB,zB=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return VB(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),KB=zB,YB=KB?function(e,t){return KB(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:CB,XB=(jB=YB,GB=0,HB=0,function(){var e=BB(),t=16-(e-HB);if(HB=e,t>0){if(++GB>=800)return arguments[0]}else GB=0;return jB.apply(void 0,arguments)}),WB=XB,JB=/^(?:0|[1-9]\d*)$/;function qB(e,r){var i=t(e);return!!(r=null==r?9007199254740991:r)&&("number"==i||"symbol"!=i&&JB.test(e))&&e>-1&&e%1==0&&e<r}function ZB(e,t,r){"__proto__"==t&&KB?KB(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function $B(e,t){return e===t||e!=e&&t!=t}var QB=Object.prototype.hasOwnProperty;function ej(e,t,r){var i=e[t];QB.call(e,t)&&$B(i,r)&&(void 0!==r||t in e)||ZB(e,t,r)}var tj=Math.max;function rj(e,t){return WB(function(e,t,r){return t=tj(void 0===t?e.length-1:t,0),function(){for(var i=arguments,n=-1,o=tj(i.length-t,0),a=Array(o);++n<o;)a[n]=i[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=i[n];return s[t]=r(a),FB(e,this,s)}}(e,t,CB),e+"")}function ij(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function nj(e){return null!=e&&ij(e.length)&&!OB(e)}var oj=Object.prototype;function aj(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||oj)}function sj(e){return IB(e)&&"[object Arguments]"==TB(e)}var cj=Object.prototype,uj=cj.hasOwnProperty,dj=cj.propertyIsEnumerable,lj=sj(function(){return arguments}())?sj:function(e){return IB(e)&&uj.call(e,"callee")&&!dj.call(e,"callee")},hj=lj;var pj="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,fj=pj&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,_j=fj&&fj.exports===pj?_B.Buffer:void 0,vj=(_j?_j.isBuffer:void 0)||function(){return!1},mj={};mj["[object Float32Array]"]=mj["[object Float64Array]"]=mj["[object Int8Array]"]=mj["[object Int16Array]"]=mj["[object Int32Array]"]=mj["[object Uint8Array]"]=mj["[object Uint8ClampedArray]"]=mj["[object Uint16Array]"]=mj["[object Uint32Array]"]=!0,mj["[object Arguments]"]=mj["[object Array]"]=mj["[object ArrayBuffer]"]=mj["[object Boolean]"]=mj["[object DataView]"]=mj["[object Date]"]=mj["[object Error]"]=mj["[object Function]"]=mj["[object Map]"]=mj["[object Number]"]=mj["[object Object]"]=mj["[object RegExp]"]=mj["[object Set]"]=mj["[object String]"]=mj["[object WeakMap]"]=!1;var Sj="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,Ej=Sj&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,yj=Ej&&Ej.exports===Sj&&pB.process,gj=function(){try{var e=Ej&&Ej.require&&Ej.require("util").types;return e||yj&&yj.binding&&yj.binding("util")}catch(e){}}(),bj=gj&&gj.isTypedArray,Tj=bj?function(e){return function(t){return e(t)}}(bj):function(e){return IB(e)&&ij(e.length)&&!!mj[TB(e)]},Ij=Tj,Rj=Object.prototype.hasOwnProperty;function Aj(e,t){var r=RB(e),i=!r&&hj(e),n=!r&&!i&&vj(e),o=!r&&!i&&!n&&Ij(e),a=r||i||n||o,s=a?function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],c=s.length;for(var u in e)!t&&!Rj.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||qB(u,c))||s.push(u);return s}var Cj=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Oj=Cj,Nj=Object.prototype.hasOwnProperty;function wj(e){return nj(e)?Aj(e):function(e){if(!aj(e))return Oj(e);var t=[];for(var r in Object(e))Nj.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var Dj=Object.prototype.hasOwnProperty;function Pj(e){if(!AB(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=aj(e),r=[];for(var i in e)("constructor"!=i||!t&&Dj.call(e,i))&&r.push(i);return r}var kj,Mj=(kj=function(e,t){!function(e,t,r,i){var n=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=i?i(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),n?ZB(r,s,c):ej(r,s,c)}}(t,function(e){return nj(e)?Aj(e,!0):Pj(e)}(t),e)},rj((function(e,r){var i=-1,n=r.length,o=n>1?r[n-1]:void 0,a=n>2?r[2]:void 0;for(o=kj.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,r,i){if(!AB(i))return!1;var n=t(r);return!!("number"==n?nj(i)&&qB(r,i.length):"string"==n&&r in i)&&$B(i[r],e)}(r[0],r[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++i<n;){var s=r[i];s&&kj(e,s,i,o)}return e}))),Uj=Mj;function Lj(e,t){return function(e,t){for(var r=-1,i=null==e?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n}(t,(function(t){return e[t]}))}function xj(e){return null==e?[]:Lj(e,wj(e))}var Vj=a,Fj=Qe("iterator"),Bj=!Vj((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,i){t.delete("b"),r+=i+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[Fj]||"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"!==r||"x"!==new URL("http://x",void 0).host})),jj=I,Gj=2147483647,Hj=/[^\0-\u007E]/,zj=/[.\u3002\uFF0E\uFF61]/g,Kj="Overflow: input needs wider integers to process",Yj=n.RangeError,Xj=jj(zj.exec),Wj=Math.floor,Jj=String.fromCharCode,qj=jj("".charCodeAt),Zj=jj([].join),$j=jj([].push),Qj=jj("".replace),eG=jj("".split),tG=jj("".toLowerCase),rG=function(e){return e+22+75*(e<26)},iG=function(e,t,r){var i=0;for(e=r?Wj(e/700):e>>1,e+=Wj(e/t);e>455;)e=Wj(e/35),i+=36;return Wj(i+36*e/(e+38))},nG=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=qj(e,r++);if(n>=55296&&n<=56319&&r<i){var o=qj(e,r++);56320==(64512&o)?$j(t,((1023&n)<<10)+(1023&o)+65536):($j(t,n),r--)}else $j(t,n)}return t}(e);var r,i,n=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(i=e[r])<128&&$j(t,Jj(i));var c=t.length,u=c;for(c&&$j(t,"-");u<n;){var d=Gj;for(r=0;r<e.length;r++)(i=e[r])>=o&&i<d&&(d=i);var l=u+1;if(d-o>Wj((Gj-a)/l))throw Yj(Kj);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((i=e[r])<o&&++a>Gj)throw Yj(Kj);if(i==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;$j(t,Jj(rG(f+_%v))),h=Wj(_/v),p+=36}$j(t,Jj(rG(h))),s=iG(a,l,u==c),a=0,u++}}a++,o++}return Zj(t,"")},oG=Yi,aG=n,sG=Y,cG=l,uG=I,dG=Bj,lG=Wt.exports,hG=ic,pG=Go,fG=Dh,_G=Or,vG=lc,mG=B,SG=xe,EG=Yo,yG=lo,gG=kt,bG=G,TG=fo,IG=Rn,RG=S,AG=Oc,CG=gc,OG=lu,NG=cI,wG=Qe("iterator"),DG="URLSearchParams",PG="URLSearchParamsIterator",kG=_G.set,MG=_G.getterFor(DG),UG=_G.getterFor(PG),LG=sG("fetch"),xG=sG("Request"),VG=sG("Headers"),FG=xG&&xG.prototype,BG=VG&&VG.prototype,jG=aG.RegExp,GG=aG.TypeError,HG=aG.decodeURIComponent,zG=aG.encodeURIComponent,KG=uG("".charAt),YG=uG([].join),XG=uG([].push),WG=uG("".replace),JG=uG([].shift),qG=uG([].splice),ZG=uG("".split),$G=uG("".slice),QG=/\+/g,eH=Array(4),tH=function(e){return eH[e-1]||(eH[e-1]=jG("((?:%[\\da-f]{2}){"+e+"})","gi"))},rH=function(e){try{return HG(e)}catch(t){return e}},iH=function(e){var t=WG(e,QG," "),r=4;try{return HG(t)}catch(e){for(;r;)t=WG(t,tH(r--),rH);return t}},nH=/[!'()~]|%20/g,oH={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},aH=function(e){return oH[e]},sH=function(e){return WG(zG(e),nH,aH)},cH=fG((function(e,t){kG(this,{type:PG,iterator:AG(MG(e).entries),kind:t})}),"Iterator",(function(){var e=UG(this),t=e.kind,r=e.iterator.next(),i=r.value;return r.done||(r.value="keys"===t?i.key:"values"===t?i.value:[i.key,i.value]),r}),!0),uH=function(e){this.entries=[],this.url=null,void 0!==e&&(bG(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===KG(e,0)?$G(e,1):e:TG(e)))};uH.prototype={type:DG,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,a,s,c=CG(e);if(c)for(r=(t=AG(e,c)).next;!(i=cG(r,t)).done;){if(o=(n=AG(gG(i.value))).next,(a=cG(o,n)).done||(s=cG(o,n)).done||!cG(o,n).done)throw GG("Expected sequence with length 2");XG(this.entries,{key:TG(a.value),value:TG(s.value)})}else for(var u in e)SG(e,u)&&XG(this.entries,{key:u,value:TG(e[u])})},parseQuery:function(e){if(e)for(var t,r,i=ZG(e,"&"),n=0;n<i.length;)(t=i[n++]).length&&(r=ZG(t,"="),XG(this.entries,{key:iH(JG(r)),value:iH(YG(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],XG(r,sH(e.key)+"="+sH(e.value));return YG(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var dH=function(){vG(this,lH);var e=arguments.length>0?arguments[0]:void 0;kG(this,new uH(e))},lH=dH.prototype;if(hG(lH,{append:function(e,t){OG(arguments.length,2);var r=MG(this);XG(r.entries,{key:TG(e),value:TG(t)}),r.updateURL()},delete:function(e){OG(arguments.length,1);for(var t=MG(this),r=t.entries,i=TG(e),n=0;n<r.length;)r[n].key===i?qG(r,n,1):n++;t.updateURL()},get:function(e){OG(arguments.length,1);for(var t=MG(this).entries,r=TG(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){OG(arguments.length,1);for(var t=MG(this).entries,r=TG(e),i=[],n=0;n<t.length;n++)t[n].key===r&&XG(i,t[n].value);return i},has:function(e){OG(arguments.length,1);for(var t=MG(this).entries,r=TG(e),i=0;i<t.length;)if(t[i++].key===r)return!0;return!1},set:function(e,t){OG(arguments.length,1);for(var r,i=MG(this),n=i.entries,o=!1,a=TG(e),s=TG(t),c=0;c<n.length;c++)(r=n[c]).key===a&&(o?qG(n,c--,1):(o=!0,r.value=s));o||XG(n,{key:a,value:s}),i.updateURL()},sort:function(){var e=MG(this);NG(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=MG(this).entries,i=EG(e,arguments.length>1?arguments[1]:void 0),n=0;n<r.length;)i((t=r[n++]).value,t.key,this)},keys:function(){return new cH(this,"keys")},values:function(){return new cH(this,"values")},entries:function(){return new cH(this,"entries")}},{enumerable:!0}),lG(lH,wG,lH.entries,{name:"entries"}),lG(lH,"toString",(function(){return MG(this).serialize()}),{enumerable:!0}),pG(dH,DG),oG({global:!0,forced:!dG},{URLSearchParams:dH}),!dG&&mG(VG)){var hH=uG(BG.has),pH=uG(BG.set),fH=function(e){if(bG(e)){var t,r=e.body;if(yG(r)===DG)return t=e.headers?new VG(e.headers):new VG,hH(t,"content-type")||pH(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),IG(e,{body:RG(0,TG(r)),headers:RG(0,t)})}return e};if(mG(LG)&&oG({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return LG(e,arguments.length>1?fH(arguments[1]):{})}}),mG(xG)){var _H=function(e){return vG(this,FG),new xG(e,arguments.length>1?fH(arguments[1]):{})};FG.constructor=_H,_H.prototype=FG,oG({global:!0,forced:!0},{Request:_H})}}var vH,mH={URLSearchParams:dH,getState:MG},SH=Yi,EH=s,yH=Bj,gH=n,bH=Yo,TH=I,IH=tn.f,RH=Wt.exports,AH=lc,CH=xe,OH=Vn,NH=KD,wH=Ro,DH=Ep.codeAt,PH=function(e){var t,r,i=[],n=eG(Qj(tG(e),zj,"."),".");for(t=0;t<n.length;t++)r=n[t],$j(i,Xj(Hj,r)?"xn--"+nG(r):r);return Zj(i,".")},kH=fo,MH=Go,UH=lu,LH=mH,xH=Or,VH=xH.set,FH=xH.getterFor("URL"),BH=LH.URLSearchParams,jH=LH.getState,GH=gH.URL,HH=gH.TypeError,zH=gH.parseInt,KH=Math.floor,YH=Math.pow,XH=TH("".charAt),WH=TH(/./.exec),JH=TH([].join),qH=TH(1..toString),ZH=TH([].pop),$H=TH([].push),QH=TH("".replace),ez=TH([].shift),tz=TH("".split),rz=TH("".slice),iz=TH("".toLowerCase),nz=TH([].unshift),oz="Invalid scheme",az="Invalid host",sz="Invalid port",cz=/[a-z]/i,uz=/[\d+-.a-z]/i,dz=/\d/,lz=/^0x/i,hz=/^[0-7]+$/,pz=/^\d+$/,fz=/^[\da-f]+$/i,_z=/[\0\t\n\r #%/:<>?@[\\\]^|]/,vz=/[\0\t\n\r #/:<>?@[\\\]^|]/,mz=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,Sz=/[\t\n\r]/g,Ez=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)nz(t,e%256),e=KH(e/256);return JH(t,".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,r=1,i=null,n=0,o=0;o<8;o++)0!==e[o]?(n>r&&(t=i,r=n),i=null,n=0):(null===i&&(i=o),++n);return n>r&&(t=i,r=n),t}(e),r=0;r<8;r++)n&&0===e[r]||(n&&(n=!1),i===r?(t+=r?":":"::",n=!0):(t+=qH(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},yz={},gz=OH({},yz,{" ":1,'"':1,"<":1,">":1,"`":1}),bz=OH({},gz,{"#":1,"?":1,"{":1,"}":1}),Tz=OH({},bz,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Iz=function(e,t){var r=DH(e,0);return r>32&&r<127&&!CH(t,e)?e:encodeURIComponent(e)},Rz={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Az=function(e,t){var r;return 2==e.length&&WH(cz,XH(e,0))&&(":"==(r=XH(e,1))||!t&&"|"==r)},Cz=function(e){var t;return e.length>1&&Az(rz(e,0,2))&&(2==e.length||"/"===(t=XH(e,2))||"\\"===t||"?"===t||"#"===t)},Oz=function(e){return"."===e||"%2e"===iz(e)},Nz={},wz={},Dz={},Pz={},kz={},Mz={},Uz={},Lz={},xz={},Vz={},Fz={},Bz={},jz={},Gz={},Hz={},zz={},Kz={},Yz={},Xz={},Wz={},Jz={},qz=function(e,t,r){var i,n,o,a=kH(e);if(t){if(n=this.parse(a))throw HH(n);this.searchParams=null}else{if(void 0!==r&&(i=new qz(r,!0)),n=this.parse(a,null,i))throw HH(n);(o=jH(new BH)).bindURL(this),this.searchParams=o}};qz.prototype={type:"URL",parse:function(e,t,r){var i,n,o,a,s,c=this,u=t||Nz,d=0,l="",h=!1,p=!1,f=!1;for(e=kH(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=QH(e,mz,"")),e=QH(e,Sz,""),i=NH(e);d<=i.length;){switch(n=i[d],u){case Nz:if(!n||!WH(cz,n)){if(t)return oz;u=Dz;continue}l+=iz(n),u=wz;break;case wz:if(n&&(WH(uz,n)||"+"==n||"-"==n||"."==n))l+=iz(n);else{if(":"!=n){if(t)return oz;l="",u=Dz,d=0;continue}if(t&&(c.isSpecial()!=CH(Rz,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&Rz[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=Gz:c.isSpecial()&&r&&r.scheme==c.scheme?u=Pz:c.isSpecial()?u=Lz:"/"==i[d+1]?(u=kz,d++):(c.cannotBeABaseURL=!0,$H(c.path,""),u=Xz)}break;case Dz:if(!r||r.cannotBeABaseURL&&"#"!=n)return oz;if(r.cannotBeABaseURL&&"#"==n){c.scheme=r.scheme,c.path=wH(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=Jz;break}u="file"==r.scheme?Gz:Mz;continue;case Pz:if("/"!=n||"/"!=i[d+1]){u=Mz;continue}u=xz,d++;break;case kz:if("/"==n){u=Vz;break}u=Yz;continue;case Mz:if(c.scheme=r.scheme,n==vH)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=wH(r.path),c.query=r.query;else if("/"==n||"\\"==n&&c.isSpecial())u=Uz;else if("?"==n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=wH(r.path),c.query="",u=Wz;else{if("#"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=wH(r.path),c.path.length--,u=Yz;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=wH(r.path),c.query=r.query,c.fragment="",u=Jz}break;case Uz:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=Yz;continue}u=Vz}else u=xz;break;case Lz:if(u=xz,"/"!=n||"/"!=XH(l,d+1))continue;d++;break;case xz:if("/"!=n&&"\\"!=n){u=Vz;continue}break;case Vz:if("@"==n){h&&(l="%40"+l),h=!0,o=NH(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||f){var m=Iz(v,Tz);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(n==vH||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=NH(l).length+1,l="",u=Fz}else l+=n;break;case Fz:case Bz:if(t&&"file"==c.scheme){u=zz;continue}if(":"!=n||p){if(n==vH||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return az;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=Kz,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return az;if(a=c.parseHost(l))return a;if(l="",u=jz,t==Bz)return}break;case jz:if(!WH(dz,n)){if(n==vH||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var S=zH(l,10);if(S>65535)return sz;c.port=c.isSpecial()&&S===Rz[c.scheme]?null:S,l=""}if(t)return;u=Kz;continue}return sz}l+=n;break;case Gz:if(c.scheme="file","/"==n||"\\"==n)u=Hz;else{if(!r||"file"!=r.scheme){u=Yz;continue}if(n==vH)c.host=r.host,c.path=wH(r.path),c.query=r.query;else if("?"==n)c.host=r.host,c.path=wH(r.path),c.query="",u=Wz;else{if("#"!=n){Cz(JH(wH(i,d),""))||(c.host=r.host,c.path=wH(r.path),c.shortenPath()),u=Yz;continue}c.host=r.host,c.path=wH(r.path),c.query=r.query,c.fragment="",u=Jz}}break;case Hz:if("/"==n||"\\"==n){u=zz;break}r&&"file"==r.scheme&&!Cz(JH(wH(i,d),""))&&(Az(r.path[0],!0)?$H(c.path,r.path[0]):c.host=r.host),u=Yz;continue;case zz:if(n==vH||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&Az(l))u=Yz;else if(""==l){if(c.host="",t)return;u=Kz}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=Kz}continue}l+=n;break;case Kz:if(c.isSpecial()){if(u=Yz,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=vH&&(u=Yz,"/"!=n))continue}else c.fragment="",u=Jz;else c.query="",u=Wz;break;case Yz:if(n==vH||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=iz(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||$H(c.path,"")):Oz(l)?"/"==n||"\\"==n&&c.isSpecial()||$H(c.path,""):("file"==c.scheme&&!c.path.length&&Az(l)&&(c.host&&(c.host=""),l=XH(l,0)+":"),$H(c.path,l)),l="","file"==c.scheme&&(n==vH||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)ez(c.path);"?"==n?(c.query="",u=Wz):"#"==n&&(c.fragment="",u=Jz)}else l+=Iz(n,bz);break;case Xz:"?"==n?(c.query="",u=Wz):"#"==n?(c.fragment="",u=Jz):n!=vH&&(c.path[0]+=Iz(n,yz));break;case Wz:t||"#"!=n?n!=vH&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":Iz(n,yz)):(c.fragment="",u=Jz);break;case Jz:n!=vH&&(c.fragment+=Iz(n,gz))}d++}},parseHost:function(e){var t,r,i;if("["==XH(e,0)){if("]"!=XH(e,e.length-1))return az;if(t=function(e){var t,r,i,n,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return XH(e,l)};if(":"==h()){if(":"!=XH(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&WH(fz,h());)t=16*t+zH(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(i=0;h();){if(n=null,i>0){if(!("."==h()&&i<4))return;l++}if(!WH(dz,h()))return;for(;WH(dz,h());){if(o=zH(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!=++i&&4!=i||u++}if(4!=i)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}(rz(e,1,-1)),!t)return az;this.host=t}else if(this.isSpecial()){if(e=PH(e),WH(_z,e))return az;if(t=function(e){var t,r,i,n,o,a,s,c=tz(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],i=0;i<t;i++){if(""==(n=c[i]))return e;if(o=10,n.length>1&&"0"==XH(n,0)&&(o=WH(lz,n)?16:8,n=rz(n,8==o?1:2)),""===n)a=0;else{if(!WH(10==o?pz:8==o?hz:fz,n))return e;a=zH(n,o)}$H(r,a)}for(i=0;i<t;i++)if(a=r[i],i==t-1){if(a>=YH(256,5-t))return null}else if(a>255)return null;for(s=ZH(r),i=0;i<r.length;i++)s+=r[i]*YH(256,3-i);return s}(e),null===t)return az;this.host=t}else{if(WH(vz,e))return az;for(t="",r=NH(e),i=0;i<r.length;i++)t+=Iz(r[i],yz);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return CH(Rz,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&Az(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,i=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+=r+(i?":"+i:"")+"@"),u+=Ez(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+JH(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw HH(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new Zz(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+Ez(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(kH(e)+":",Nz)},getUsername:function(){return this.username},setUsername:function(e){var t=NH(kH(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=Iz(t[r],Tz)}},getPassword:function(){return this.password},setPassword:function(e){var t=NH(kH(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=Iz(t[r],Tz)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?Ez(e):Ez(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,Fz)},getHostname:function(){var e=this.host;return null===e?"":Ez(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Bz)},getPort:function(){var e=this.port;return null===e?"":kH(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=kH(e))?this.port=null:this.parse(e,jz))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+JH(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,Kz))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=kH(e))?this.query=null:("?"==XH(e,0)&&(e=rz(e,1)),this.query="",this.parse(e,Wz)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=kH(e))?("#"==XH(e,0)&&(e=rz(e,1)),this.fragment="",this.parse(e,Jz)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Zz=function(e){var t=AH(this,$z),r=UH(arguments.length,1)>1?arguments[1]:void 0,i=VH(t,new qz(e,!1,r));EH||(t.href=i.serialize(),t.origin=i.getOrigin(),t.protocol=i.getProtocol(),t.username=i.getUsername(),t.password=i.getPassword(),t.host=i.getHost(),t.hostname=i.getHostname(),t.port=i.getPort(),t.pathname=i.getPathname(),t.search=i.getSearch(),t.searchParams=i.getSearchParams(),t.hash=i.getHash())},$z=Zz.prototype,Qz=function(e,t){return{get:function(){return FH(this)[e]()},set:t&&function(e){return FH(this)[t](e)},configurable:!0,enumerable:!0}};if(EH&&IH($z,{href:Qz("serialize","setHref"),origin:Qz("getOrigin"),protocol:Qz("getProtocol","setProtocol"),username:Qz("getUsername","setUsername"),password:Qz("getPassword","setPassword"),host:Qz("getHost","setHost"),hostname:Qz("getHostname","setHostname"),port:Qz("getPort","setPort"),pathname:Qz("getPathname","setPathname"),search:Qz("getSearch","setSearch"),searchParams:Qz("getSearchParams"),hash:Qz("getHash","setHash")}),RH($z,"toJSON",(function(){return FH(this).serialize()}),{enumerable:!0}),RH($z,"toString",(function(){return FH(this).serialize()}),{enumerable:!0}),GH){var eK=GH.createObjectURL,tK=GH.revokeObjectURL;eK&&RH(Zz,"createObjectURL",bH(eK,GH)),tK&&RH(Zz,"revokeObjectURL",bH(tK,GH))}MH(Zz,"URL"),SH({global:!0,forced:!yH,sham:!EH},{URL:Zz});var rK,iK=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],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,r){return Zf(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p,f,_=this;return $f(this,(function(v){switch(v.label){case 0:if(i=r.playCount,GP(n=r.type,"mixingType",xj(i_)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=SF(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_STOPPED,error:rD.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,3]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw _._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_FAILED,error:rD.AUDIO_MIXING_ERROR_START_FAILED}),new aD(tD.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:d=v.sent(),c=new Audio(URL.createObjectURL(new Blob([d]))),v.label=3;case 3:return c.crossOrigin="anonymous",i<=0?c.loop=!0:i>0&&(l=i,c.onended=function(){--l>0?c.play():_._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_FINISHED,error:rD.AUDIO_MIXING_ERROR_OK})}),[4,c.play()];case 4:if(v.sent(),h=this._sharedAudioContext.createMediaElementSource(c),p=this._sharedAudioContext.createGain(),f=this.volumeConfig.get(e),p.gain.value=f?f/100:1,h.connect(p).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:h,audioNode:c,gainNode:p,type:"file"}),n===i_.PUBLISH)try{p.disconnect(this._sharedAudioContext.destination)}catch(e){}else p.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],r.type),this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_PLAYING,error:rD.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.updateLocalAudioTrack(),this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_STOPPED,error:rD.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_PAUSED,error:rD.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:n_.AUDIO_MIXING_STATE_PLAYING,error:rD.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i=this;return $f(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 i._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_PRELOADED,error:rD.AUDIO_MIXING_ERROR_OK}),t.arrayBuffer();throw i._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_FAILED,error:rD.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new aD(tD.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(e){throw new aD(tD.LOAD_RESOURCES_FAILED,"Load resources failed",e)}))];case 1:return r=n.sent(),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([r])))},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 r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),r=this.mixingMap.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.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 r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){GP(e,"type",xj(i_));var t=this._context.getLocalAudioTrack();if(t){var r=SF(t.getTrack());if(r&&this.mixMediaStream(r),e===i_.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:n_.AUDIO_MIXING_STATE_PCM_ENABLED,error:rD.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:n_.AUDIO_MIXING_STATE_PCM_DISABLED,error:rD.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0)||(this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode),this._audioBufferSource.start(),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 r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}})},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,r){e.stopAudioMixing(r)}))},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.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()},qf([yx("default","id","filePath","options")],e.prototype,"startAudioMixing",null),qf([yx("default","id")],e.prototype,"stopAudioMixing",null),qf([yx("default","id")],e.prototype,"pauseAudioMixing",null),qf([yx("default","id")],e.prototype,"resumeAudioMixing",null),qf([yx("default","id")],e.prototype,"preloadAudioMixing",null),qf([yx("default","id")],e.prototype,"unloadAudioMixing",null),qf([yx("default","id")],e.prototype,"getAudioMixingVolume",null),qf([yx("default","id","volume")],e.prototype,"setAudioMixingVolume",null),qf([yx("default","id")],e.prototype,"getAudioMixingDuration",null),qf([yx("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),qf([yx("default","id","position")],e.prototype,"setAudioMixingPosition",null),qf([yx("default","type")],e.prototype,"enableAudioMixingBuffer",null),qf([yx()],e.prototype,"disableAudioMixingBuffer",null),qf([yx("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(rK||(rK={}));var nK=new rk("RTMClient",1),oK=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r._dataChannelSignal=null,r._handler=null,r._dataChannelSignalState=LF.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 Cf(t,e),t.prototype.login=function(e,t){var r=this;return new Promise((function(i,n){if(nK.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new aD(tD.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new aD(tD.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,mx.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=i,r._loginRejectCallback=n,r._dataChannelSignal?r._login():(nK.print("login","init dataChannelSingling"),r._dataChannelSignalState=LF.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))},t.prototype.logout=function(){var e;return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){if(!this._loginSessionId||!this._userId)throw new aD(tD.NOT_LOGIN,"login first");return null===(e=this._dataChannelSignal)||void 0===e||e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:Ix.C2RTM}).catch((function(){})),this._closeDataChannelSignaling(),this._clearState(),[2]}))}))},t.prototype.updateLoginToken=function(e){return Zf(this,void 0,void 0,(function(){var t=this;return $f(this,(function(r){return this._token=e,[2,new Promise((function(e,r){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=r,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new aD(tD.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:Ix.C2RTM})];case 1:return[2,null==(t=r.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new aD(tD.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})];case 1:return r.sent(),[2]}}))}))},t.prototype.setServerParams=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new aD(tD.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:Ix.C2RTM})];case 1:return r.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new aD(tD.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:ux.BUSINESS_SERVER,msg:e})];case 1:return t.sent(),[2]}}))}))},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=AP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:wP.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:Ck.VERSION,deviceId:Ux.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:Ix.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var r,i,n=t||{},o=n.code,a=n.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=tD.INVALID_PARAMS,i="Invalid userId"):(r=tD.INVALID_TOKEN,i="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=tD.LOGIN_FAILED,i="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new aD(r,a||i))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){return Zf(this,void 0,void 0,(function(){var t,r,i,n,o,a=this;return $f(this,(function(s){switch(s.label){case 0:if(t=new xx,r=this._iceConfigNode)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,null==t?void 0:t.getAccessNode(this._appId,"",e,Ux.getDeviceId(),"")];case 2:if(!(r=s.sent()))throw new Error;return[3,4];case 3:throw s.sent(),bx("rtm.login.getNodeFailed","",0,!0),new aD(tD.ICE_SERVER_WRONG,"get ICE config failed");case 4:bx("rtm.login.getNodeSuccess",r,0,!0),nK.print("_createDataChannelSignaling()","get node success",r),this._handler=new TV(fx),this._handler.once("disconnect",(function(){nK.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),a._onDisconnect()})),s.label=5;case 5:return s.trys.push([5,7,,8]),[4,this._handler.connect(r)];case 6:return i=s.sent(),nK.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=LF.CONNECTED,[3,8];case 7:throw n=s.sent(),this._iceConfigNode=null,this._dataChannelSignalState=LF.DISCONNECTED,new aD(tD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",n);case 8:return o=new Cx(i),nK.print("_createDataChannelSignaling()","send ping"),o.sendPingSignaling(),o.once("close",(function(){nK.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),a._onDisconnect()})),o.on(rx.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(rx.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(rx.USER_DISCONNECTION,(function(){a.emit("onUserDisconnection"),a._clearState()})),o.on(rx.NODE_CHANGE,(function(e){bx("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(a._iceConfigNode=e.nodes[0]),a._loginResolveCallback&&a._loginRejectCallback?a._login():a._reconnect()})),[2,o]}}))}))},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!==LF.CONNECTED)throw new aD(tD.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=LF.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&&(nK.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){nK.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){nK.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}($P.exports.EventEmitter),aK=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r.remoteStreams=new Map,r}return Cf(t,e),t.prototype.connect=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new jF,this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new aD(tD.REPEAT_PLAY,"repeat play public media stream");return t=new $F(e,e,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]}),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return r.sent(),this.remoteStreams.set(e,t),[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 Zf(this,void 0,void 0,(function(){var e,t,r,i,n,o,a,s,c=this;return $f(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(YF.RESUBSCRIBE,{stream:t})}))},t=this;try{for(r=Qf(this.remoteStreams),i=r.next();!i.done;i=r.next())n=e_(i.value,1),o=n[0],e(o)}catch(e){a={error:e}}finally{try{i&&!i.done&&(s=r.return)&&s.call(r)}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,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(nx.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))},t}(nk),sK=new rk("AudioDeviceManager",1),cK=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return Cf(t,e),t.prototype.startAudioPlaybackDeviceTest=function(e,t){return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:if(this._isAudioPlaybackDeviceTesting||this._isAudioDeviceRecordTesting)throw new aD(tD.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,sK.print("startAudioPlaybackDeviceTest()","Invoke"),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._playAudioFile(e,{loop:!0})];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.stopAudioPlaybackDeviceTest(),r;case 4:return this._startEmitAudioPlaybackDeviceTestVolume(t),[2]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){this._isAudioPlaybackDeviceTesting&&(sK.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.startAudioDeviceRecordTest=function(e){return Zf(this,void 0,void 0,(function(){var t=this;return $f(this,(function(r){switch(r.label){case 0:if(this._isAudioDeviceRecordTesting)throw new aD(tD.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,sK.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){sK.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),t._stopAudioCaptureAndRecoder()}),3e4),[4,this._startAudioCaptureAndRecoder(e)];case 1:return r.sent(),delete this._audioCaptureAndRecoderResolve,[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){sK.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(sK.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){sK.print("destroy()","Invoke"),e.prototype.removeAllListeners.call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()},t.prototype._playAudioFile=function(e,t){var r=this;return new Promise((function(i,n){r._audioElement=nB("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,sK.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){sK.print("_playAudioFile()","oncanplay"),i()},r._audioElement.onerror=function(e){var t,i;n(new aD(tD.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(i=null===(t=r._audioElement)||void 0===t?void 0:t.error)||void 0===i?void 0:i.message))))}}))},t.prototype._destroyAudioElement=function(){this._audioElement&&(sK.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&&(sK.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new fF(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&&(sK.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 Zf(this,void 0,void 0,(function(){var t,r,i=this;return $f(this,(function(n){switch(n.label){case 0:return t=this,[4,MF({})];case 1:return t._audioTrack=n.sent(),r=SF(this._audioTrack.getTrack()),sK.print("startAudioDeviceRecordTest()","create microphone track success!"),[2,new Promise((function(t,n){i._mediaRecorder=new MediaRecorder(r),i._mediaRecorder.ondataavailable=function(r){return Zf(i,void 0,void 0,(function(){var i,o,a,s=this;return $f(this,(function(c){switch(c.label){case 0:if(!this._isAudioDeviceRecordTesting)return[3,5];sK.print("startAudioDeviceRecordTest()","get recorded file."),i=new Blob([r.data]),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._playAudioFile(URL.createObjectURL(i),{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]}}))}))},i._mediaRecorder.onerror=function(e){n(new aD(tD.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},i._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}($P.exports.EventEmitter),uK=new rk("Engine",0),dK=function(e){function t(t){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._enableSimulcast=!1,r._videoStreamEncodeConfig=[kk],r._screenStreamEncodeConfig=[Mk],r._pauseAllSubscribeState={audio:!1,video:!1},r._audioPropertiesReportTimer=null,r._mirrorType=Hf.MIRROR_TYPE_RENDER,r._audioDeviceManager=new cK,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=i_.PLAYOUT_AND_PUBLISH),Zf(r,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return uK.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(r=this._room)||void 0===r?void 0:r.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(a_.onAudioMixingStateChanged,e)},r._appId=t,r._pubLock=new AV("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new iK({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage}),window.__rtc_engine__=r,window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=r,r._trackSourceType={video:Of.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:Of.VIDEO_SOURCE_TYPE_INTERNAL,audio:Nf.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:Nf.AUDIO_SOURCE_TYPE_INTERNAL},r._rtmClient=new oK(t),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r}return Cf(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,r,i;return Zf(this,void 0,void 0,(function(){var n,o,a,s;return $f(this,(function(c){switch(c.label){case 0:return uK.print("updateToken()","token: %s",e),jP(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(n=null===(r=this._room)||void 0===r?void 0:r._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 aD(tD.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(i=this._room)||void 0===i?void 0:i.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.switchCamera=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n;return $f(this,(function(o){switch(o.label){case 0:return uK.print("switchCamera()","deviceId: %s",e),jP(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((i=this._videoStreamConstraints).deviceId={exact:e},this._videoStreamConstraints=i,[4,kF(i)]);case 1:return n=o.sent(),this._initLocalTrackEvents(n),this._localVideoTrack&&this._localVideoTrack.close(),this._localVideoTrack=n,this._videoPlayer&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(n),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype.switchMicrophone=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n;return $f(this,(function(o){switch(o.label){case 0:return uK.print("switchMicrophone()","deviceId: %s",e),jP(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((i=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=i,[4,MF(i)]);case 1:return n=o.sent(),this._initLocalTrackEvents(n),this._localAudioTrack&&this._localAudioTrack.close(),this._localAudioTrack=n,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){hF.on(a_.onMediaDeviceStateChanged,this._onDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R=this;null===(e=this._room)||void 0===e||e.on(rx.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(rx.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(rx.USER_CONNECTION,this._onUserConnection.bind(this)),null===(i=this._room)||void 0===i||i.on(YF.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(YF.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(rx.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(a=this._room)||void 0===a||a.on(rx.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(s=this._room)||void 0===s||s.on(rx.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(rx.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(u=this._room)||void 0===u||u.on(rx.POST_PROCESSING_MESSAGE,(function(e){"publicStreamCallback"===e.type?R._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&R._onLiveTranscodingResult(e)})),null===(d=this._room)||void 0===d||d.on(nx.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(l=this._room)||void 0===l||l.on(YF.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(h=this._room)||void 0===h||h.on(YF.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(YF.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(YF.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(_=this._room)||void 0===_||_.on(YF.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=R._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&R.safeEmit(a_.onAutoPublishResult,e)})),null===(v=this._room)||void 0===v||v.on(YF.ON_REMOTE_STREAM_STATS,(function(e){R.safeEmit(a_.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(YF.ON_LOCAL_STREAM_STATS,(function(e){R.safeEmit(a_.onLocalStreamStats,e)})),null===(S=this._room)||void 0===S||S.on(YF.ON_USER_MUTE_AUDIO,this._onUserMuteAudio.bind(this)),null===(E=this._room)||void 0===E||E.on(YF.ON_USER_MUTE_VIDEO,this._onUserMuteVideo.bind(this)),null===(y=this._room)||void 0===y||y.on(YF.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(a_.onUserStartAudioCapture,{userId:t})})),null===(g=this._room)||void 0===g||g.on(YF.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(a_.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(YF.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(a_.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(YF.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(a_.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(YF.ON_SEI_MESSAGED_RECEIVED,(function(e){R.safeEmit(a_.onSEIMessageReceived,e)}))},t.prototype.safeEmit=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return ZP(t)&&gx(t,MP(r)),e.prototype.safeEmit.apply(this,t_([t],e_(r),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.setConnectionMode=function(e){GP(e,"mode",[Wf.AUTO,Wf.FORCE_TCP,Wf.FORCE_UDP]),Ok("CONNECTION_MODE",e)},t.prototype.joinRoom=function(e,t,r,i){return void 0===i&&(i={isAutoPublish:!1,isAutoSubscribeAudio:!1,isAutoSubscribeVideo:!1}),Zf(this,void 0,void 0,(function(){var n,o;return $f(this,(function(a){switch(a.label){case 0:if(uK.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,r,i),YP(e)||jP(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new aD(tD.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){HP(e,"userInfo"),XP(e.userId),YP(e.extraInfo)||jP(e.extraInfo,"userInfo.extraInfo",1,200)}(r),function(e){HP(e,"roomConfig"),FP(e.isAutoPublish,"roomConfig.isAutoPublish"),FP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),FP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(i),!this._room||this._room.connectionState===LF.DISCONNECTED)return[3,1];throw new aD(tD.REPEAT_JOIN,"Already joined");case 1:this._room=new iB(i),this._addHandlerEventHandler(),n=this._liveTranscodeConfig&&wk("started",this._liveTranscodeConfig),a.label=2;case 2:return a.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,Jf(Jf({},r),{businessId:this._businessId,role:this._visibility?rK.NORMAL_USER:rK.SILENT_USER}),n,this._useCloudProxy)];case 3:return a.sent(),this._roomConfig=i,this._tempRoomConfig&&delete this._tempRoomConfig,[3,5];case 4:throw(o=a.sent()).code===tD.INVALID_TOKEN&&(this._tempRoomConfig=i),o;case 5:(this._localAudioTrack||this._localVideoTrack)&&i.isAutoPublish&&(this._visibility?this._updatePublish(!0):this.safeEmit(a_.onAutoPublishResult,{isScreen:!1,state:Uf.PUBLISH_FAIL})),a.label=6;case 6:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,r;return void 0===e&&(e=!1),Zf(this,void 0,void 0,(function(){return $f(this,(function(i){switch(i.label){case 0:return uK.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return i.sent(),[3,3];case 2:null===(r=this._room)||void 0===r||r.leave(e).catch(),i.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._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,r,i;uK.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(),null===(r=this._audioPlayer)||void 0===r||r.destroy(),this._videoPlayer=void 0,this._audioPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[kk],this._screenStreamEncodeConfig=[Mk],this._pauseAllSubscribeState={audio:!1,video:!1},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._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()},t.prototype.publish=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:if(uK.print("publish()"),!this._room||this._room.connectionState!==LF.CONNECTED)throw new aD(tD.PUBLISH_BEFORE_JOIN,"join first");return!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=PF(this._localImgVideoTrack),this._localVideoTrack.dummy=!0),[4,this._updatePublish()];case 1:return e.sent(),[2]}}))}))},t.prototype.unpublish=function(){var e,t;return Zf(this,void 0,void 0,(function(){var r,i;return $f(this,(function(n){switch(n.label){case 0:if(uK.print("unpublish()"),!this._room)throw new aD(tD.UNPUBLISH_BEFORE_JOIN,"join first");return null===(t=null===(e=this._room.localStream)||void 0===e?void 0:e.observer)||void 0===t||t.setPublish(!1),[4,this._pubLock.lock()];case 1:r=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.unpublish()];case 3:return n.sent(),[3,6];case 4:throw(i=n.sent())instanceof aD?i:new aD(tD.UNEXPECTED_ERROR,"unexpected error",i);case 5:return r(),[7];case 6:return[2]}}))}))},t.prototype.subscribeUserStream=function(e,t,r,i){var n,o,a,s,c,u;return void 0===r&&(r=Ff.STREAM_INDEX_MAIN),void 0===i&&(i={videoIndex:0}),Zf(this,void 0,void 0,(function(){var d,l,h,p,f,_,v;return $f(this,(function(m){switch(m.label){case 0:if(uK.print("subscribeStream()","userId: %o, mediaType: %o, streamType: %o, configure: %o",e,t,r,i),XP(e),GP(t,"mediaType",[Bf.AUDIO_AND_VIDEO,Bf.AUDIO_ONLY,Bf.VIDEO_ONLY,Bf.NONE]),GP(r,"streamType",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),BP(i.videoIndex,"config.videoIndex",0,2),!this._room||this._room.connectionState!==LF.CONNECTED)throw new aD(tD.SUBSCRIBE_BEFORE_JOIN,"join first");if(d=this._room.remoteStreams.get(e),h=r===Ff.STREAM_INDEX_SCREEN,!(l=h?null==d?void 0:d.find((function(e){return e.isScreen})):null==d?void 0:d.find((function(e){return!e.isScreen}))))throw new aD(tD.STREAM_NOT_EXIST,"stream not exist");m.label=1;case 1:return m.trys.push([1,3,,4]),p=t,this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?t=Bf.NONE:this._pauseAllSubscribeState.audio&&!this._pauseAllSubscribeState.video?t===Bf.AUDIO_AND_VIDEO?t=Bf.VIDEO_ONLY:t===Bf.AUDIO_ONLY&&(t=Bf.NONE):!this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video&&(t===Bf.AUDIO_AND_VIDEO?t=Bf.AUDIO_ONLY:t===Bf.VIDEO_ONLY&&(t=Bf.NONE)),t!==p&&uK.print("subscribeUserStream","due to pauseAllState change sub mediaType from ".concat(p," to ").concat(t)),f=l.hasSubscribed,[4,this._room.subscribe(l,t,i)];case 2:return m.sent(),t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.AUDIO_ONLY||this._updateAudioPlayerState(l),t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.VIDEO_ONLY||this._updateVideoPlayerState(l),((null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)||(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo))&&(l.audioTrack||l.videoTrack)&&(v={userId:e,isScreen:h,state:Mf.SUBSCRIBE_SUCC},this.safeEmit(a_.onAutoSubscribeResult,v)),f||t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.VIDEO_ONLY||null===(a=l.observer)||void 0===a||a.setSubscribeVideo(!0),f||t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.AUDIO_ONLY||null===(s=l.observer)||void 0===s||s.setSubscribeAudio(!0),[3,4];case 3:throw _=m.sent(),((null===(c=this._roomConfig)||void 0===c?void 0:c.isAutoSubscribeAudio)||(null===(u=this._roomConfig)||void 0===u?void 0:u.isAutoSubscribeVideo))&&(v={userId:e,isScreen:h,state:Mf.SUBSCRIBE_FAIL},this.safeEmit(a_.onAutoSubscribeResult,v)),_;case 4:return[2]}}))}))},t.prototype.unSubscribe=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i;return $f(this,(function(n){switch(n.label){case 0:if(uK.print("unSubscribe()","userId: %s, isScreen: %o",e,t),XP(e),FP(t,"isScreen"),!this._room||this._room.connectionState!==LF.CONNECTED)throw new aD(tD.SUBSCRIBE_BEFORE_JOIN,"join first");if(r=this._room.remoteStreams.get(e),!(i=t?null==r?void 0:r.find((function(e){return e.isScreen})):null==r?void 0:r.find((function(e){return!e.isScreen}))))throw new aD(tD.STREAM_NOT_EXIST,"stream not exist");return[4,this._room.unsubscribe(i)];case 1:return n.sent(),this._updateAudioPlayerState(i),this._updateVideoPlayerState(i),[2]}}))}))},t.prototype.startVideoCapture=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n,o,a,s;return $f(this,(function(c){switch(c.label){case 0:if(uK.print("startVideoCapture()","deviceId: %s",e),YP(e)||jP(e,"deviceId"),this._localVideoTrack&&!this._localVideoTrack.dummy)throw new aD(tD.REPEAT_CAPTURE,"Has already capture");return i=this._videoStreamConstraints,e&&(i.deviceId={exact:e},this._videoStreamConstraints=i),[4,kF(i)];case 1:return n=c.sent(),this._initLocalTrackEvents(n),this._localVideoTrack=n,this._videoPlayer&&this._videoPlayer.playVideo(n),o={},(a=null==n?void 0:n.getTrack())&&(o=a.getSettings()),this._room?(s=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||s)&&(this._visibility?this._updatePublish():this.safeEmit(a_.onAutoPublishResult,{isScreen:!1,state:Uf.PUBLISH_FAIL})),null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableVideo(!0),[2,o]):[2,o]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,r,i,n;return Zf(this,void 0,void 0,(function(){return $f(this,(function(o){switch(o.label){case 0:if(uK.print("stopVideoCapture()"),this._trackSourceType.video===Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.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===(r=this._localVideoTrack)||void 0===r||r.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===(i=this._room.localStream)||void 0===i?void 0:i.observer)||void 0===n||n.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,r;return Zf(this,void 0,void 0,(function(){var i,n,o;return $f(this,(function(a){switch(a.label){case 0:if(uK.print("startAudioCapture()","deviceId: $o",e),YP(e)||jP(e,"deviceId"),this._localAudioTrack)throw new aD(tD.REPEAT_CAPTURE,"Has already capture");return i=this._audioStreamConstraints,e&&(i.deviceId={exact:e},this._audioStreamConstraints=i),[4,MF(i)];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(a_.onAutoPublishResult,{isScreen:!1,state:Uf.PUBLISH_FAIL})),null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.stopAudioCapture=function(){var e,t,r;return Zf(this,void 0,void 0,(function(){return $f(this,(function(i){switch(i.label){case 0:if(uK.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:i.sent(),i.label=2;case 2:return null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return uK.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,r,i,n;return void 0===e&&(e={}),Zf(this,void 0,void 0,(function(){var o,a,s,c;return $f(this,(function(u){switch(u.label){case 0:if(uK.print("startScreenCapture()","config: %o",e),(null===(t=this._localScreenVideoTrack)||void 0===t?void 0:t.dummy)||null===(r=this._localScreenVideoTrack)||void 0===r||r.close(),this._localScreenVideoTrack=void 0,o=e.enableAudio,a=void 0!==o&&o,this._trackSourceType.screenVideo===Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,UF(a)];case 1:return s=u.sent(),this._localScreenVideoTrack=new OF(s.getVideoTracks()[0],AP()),(c=s.getAudioTracks()).length&&(this._localScreenAudioTrack=new NF(c[0],AP()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(i=this._screenPlayer)||void 0===i||i.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),(null===(n=this._room)||void 0===n?void 0:n.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,3];case 2:u.sent(),u.label=3;case 3:return[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,r,i;return Zf(this,void 0,void 0,(function(){return $f(this,(function(n){switch(n.label){case 0:return uK.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,(null===(r=this._room)||void 0===r?void 0:r.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,2]):[3,3];case 1:n.sent(),n.label=2;case 2:return[3,4];case 3:this._localScreenVideoTrack=void 0,n.label=4;case 4:return null===(i=this._localScreenAudioTrack)||void 0===i||i.close(),this._localScreenAudioTrack=void 0,[2]}}))}))},t.prototype.publishScreen=function(){return Zf(this,void 0,void 0,(function(){var e;return $f(this,(function(t){switch(t.label){case 0:if(uK.print("publishScreen()"),!this._room||this._room.connectionState!==LF.CONNECTED)throw new aD(tD.PUBLISH_BEFORE_JOIN,"join first");if(!this._visibility)throw new aD(tD.NO_PUBLISH_PERMISSION,"no publish permission");t.label=1;case 1:return t.trys.push([1,3,,4]),!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=PF(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof aD?e:new aD(tD.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e,t;return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:if(uK.print("unpublishScreen()"),!this._room)throw new aD(tD.UNPUBLISH_BEFORE_JOIN,"join first");null===(t=null===(e=this._room.localScreenStream)||void 0===e?void 0:e.observer)||void 0===t||t.setPublish(!1),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._room.unpublishScreen()];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof aD?r:new aD(tD.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var r,i;if(uK.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),GP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),t&&t.renderDom)return JP(t),e==Ff.STREAM_INDEX_MAIN?(this._videoPlayer=new lB(t),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement):(this._screenPlayer=new lB(Jf(Jf({},t),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement);e==Ff.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(i=this._screenPlayer)||void 0===i||i.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:uK.print("startLiveTranscoding()","transcode: %o",e),jP(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(wk("started",this._liveTranscodeConfig))];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof aD?r:new aD(tD.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:if(uK.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=Uj(this._liveTranscodeConfig,e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(wk("layoutChanged",this._liveTranscodeConfig))];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof aD?r:new aD(tD.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){switch(r.label){case 0:if(uK.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,null===(e=this._room)||void 0===e?void 0:e.liveControlMessage({action:"stopped",type:"transcode"})];case 2:return r.sent(),[3,4];case 3:throw(t=r.sent())instanceof aD?t:new aD(tD.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return uK.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(vx.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t;return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:if(uK.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==LF.CONNECTED)throw new aD(tD.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?rK.NORMAL_USER:rK.SILENT_USER})];case 3:return r.sent(),this._visibility=e,[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var r=this;void 0===t&&(t=!1),e.on("playback_event",(function(i){var n,o,a,s;switch(null===(o=null===(n=r._room)||void 0===n?void 0:n.remoteStreams.get(i.userId))||void 0===o||o.find((function(e){return!e.isScreen})),i.eventName){case"timeupdate":return;case"loadeddata":if("audio"===i.type)t?r.safeEmit(a_.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):r.safeEmit(a_.onAudioFirstFrameDecoded,{userId:e.userId}),px.firstRemoteAudioRender("",i.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,r.safeEmit(a_.onFirstPublicStreamVideoFrameDecoded,c),r.safeEmit(a_.onFirstPublicStreamVideoFrameRendered,c)):(r.safeEmit(a_.onVideoFirstFrameDecoded,c),r.safeEmit(a_.onVideoFirstFrameRendered,c)),px.firstRemoteVideoRender("",i.userId)}break;case"autoplay-error":return t&&(i.publicStreamId=i.userId),void r.safeEmit(a_.onAutoplayFailed,i)}r.safeEmit(a_.onPlayerEvent,i)}))},t.prototype._initLocalTrackEvents=function(e){var t=this;e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(a_.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var r,i,n,o,a,s;uK.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),GP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),JP(t);var c=t.userId;if(t.renderDom){if(e==Ff.STREAM_INDEX_MAIN){null===(r=this._remoteVideoPlayer.get(c))||void 0===r||r.destroy();var u=new lB(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(n=null===(i=this._room)||void 0===i?void 0:i.remoteStreams.get(c))||void 0===n?void 0:n.find((function(e){return!e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy();var d;u=new lB(Jf(Jf({},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),u.domElement}this._getRemotePlayer(c,e===Ff.STREAM_INDEX_SCREEN).forEach((function(e){return null==e?void 0:e.destroy()}))},t.prototype.setLocalVideoMirrorType=function(e){uK.print("setLocalVideoMirrorType()","mirrorType: %o",e),GP(e,"mirrorType",[Hf.MIRROR_TYPE_NONE,Hf.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){var t;return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return uK.print("setAudioPlaybackDevice()","deviceId: %s",e),jP(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(uK.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,hF.getDeviceById(e)];case 1:if(!(r=i.sent()))throw new aD(tD.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),null===(t=this._audioPlayer)||void 0===t||t.setPlaybackDevice(e),this._audioPlaybackDeviceId=e,r&&this.safeEmit(a_.onAudioPlaybackDeviceChanged,r),px.rtcAudioDevice(kL.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){return Zf(this,void 0,void 0,(function(){var t,r;return $f(this,(function(i){if(uK.print("play()","userId | publicStreamId: %s",e),XP(e),t=this._remoteAudioPlayer.get(e),r=this._remoteVideoPlayer.get(e),t||(t=this._publicStreamAudioPlayer.get(e)),r||(r=this._publicStreamVideoPlayer.get(e)),t||(t=this._audioPlayer),r||(r=this._videoPlayer),!t&&!r)throw new aD(tD.INVALID_PARAMS,"Player not found");return t&&t.manuallyPlay(),r&&r.manuallyPlay(),[2]}))}))},t.prototype.muteLocalAudio=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){if(uK.print("muteLocalAudio()","muteState: %o",e),GP(e,"muteState",[kf.MUTE_STATE_OFF,kf.MUTE_STATE_ON]),!this._room)throw new aD(tD.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("audio",e)]}))}))},t.prototype.muteLocalVideo=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){if(uK.print("muteLocalVideo()","muteState: %o",e),GP(e,"muteState",[kf.MUTE_STATE_OFF,kf.MUTE_STATE_ON]),!this._room)throw new aD(tD.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("video",e)]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Zf(this,void 0,void 0,(function(){var t,r=this;return $f(this,(function(i){return uK.print("pauseAllSubscribedStream()","mediaType: %o",e),GP(e,"mediaType",[xf.RTC_PAUSE_RESUME_CONTROL_AUDIO,xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,xf.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){e===xf.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!0:e===xf.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!0:e===xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!0,r._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()]))}))}))},t.prototype.resumeAllSubscribedStream=function(e){return Zf(this,void 0,void 0,(function(){var t,r=this;return $f(this,(function(i){return uK.print("resumeAllSubscribedStream()","mediaType: %o",e),GP(e,"mediaType",[xf.RTC_PAUSE_RESUME_CONTROL_AUDIO,xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,xf.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){e===xf.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!1:e===xf.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!1:e===xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!1,r._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,i;t(),null===(i=null===(e=r._room)||void 0===e?void 0:e.remoteStreams)||void 0===i||i.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r._updateAudioPlayerState(e),r._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])):[2,Promise.resolve()]}))}))},t.prototype.sendUserMessage=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){if(XP(e),qP(t),!this._room||this._room.connectionState!==LF.CONNECTED)throw new aD(tD.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){if(XP(e),zP(t,"message"),qP(t),!this._room||this._room.connectionState!==LF.CONNECTED)throw new aD(tD.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendRoomMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){if(qP(e),!this._room||this._room.connectionState!==LF.CONNECTED)throw new aD(tD.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e)]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){if(qP(e),!this._room||this._room.connectionState!==LF.CONNECTED)throw new aD(tD.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e,!0)]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return uK.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,KP(e),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,r&&(this._audioStreamConstraints.deviceId=r),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){switch(i.label){case 0:return uK.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,KP(e),r=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=e,r&&(this._videoStreamConstraints.deviceId=r),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.prototype.enableSimulcastMode=function(e){return uK.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return uK.print("setVideoEncoderConfig()","streamIndex: %o, descriptions: %o",e,t),Array.isArray(t)||(t=[t]),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),e===Ff.STREAM_INDEX_MAIN?this._videoStreamEncodeConfig=t:this._screenStreamEncodeConfig=t,[2]}))}))},t.prototype.sendSEIMessage=function(e,t,r){var i,n,o,a,s,c;uK.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),GP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),BP(r,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(wP.str2ab(t)):t;if(t.length){var d;if(e===Ff.STREAM_INDEX_MAIN){if(!(null===(n=null===(i=this._room)||void 0===i?void 0:i.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)uK.print("sei size must not bigger than 4KB");else{var l=AP();d.seiList.push({content:u,uuid:l,repeatCount:r}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else uK.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;uK.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,i,n,o;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var i;if(0!==e.length){var n=e.find((function(e){return!1===e.isScreen})),o=null===(i=null==n?void 0:n.audioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:t,volume:o||0})}}));var a=null===(i=t._localAudioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:(null===(o=null===(n=t._room)||void 0===n?void 0:n.roomInfo)||void 0===o?void 0:o.userInfo.userId)||"local_user",volume:a||0}),t.safeEmit(a_.onAudioVolumeIndication,{speakers:r})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t=this;void 0===e&&(e={}),uK.print("enableAudioPropertiesReport()","config %o: ",e);var r=e.interval,i=void 0===r?100:r,n=e.enableInBackground,o=void 0===n||n;this._stopAudioPropertiesReport(),i<=0||(i=Math.max(100,i),this._audioPropertiesReportTimer=self.setInterval((function(){if(o||"hidden"!==document.visibilityState){var e=[],r=t._audioDeviceManager.getRecordTrack()||t._localAudioTrack;if(r){var i=r.getAudioLevel();e.push({streamIndex:Ff.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:xP(i)}})}if(t._localScreenAudioTrack){i=t._localScreenAudioTrack.getAudioLevel();e.push({streamIndex:Ff.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:xP(i)}})}if(t.safeEmit(a_.onLocalAudioPropertiesReport,e),t._room){var n=[];t._room.remoteStreams.forEach((function(e,r){e.forEach((function(e){var i,o;if(e.audioTrack){var a=e.audioTrack.getAudioLevel();n.push({streamKey:{userId:r,streamIndex:e.isScreen?Ff.STREAM_INDEX_SCREEN:Ff.STREAM_INDEX_MAIN,roomId:null===(o=null===(i=t._room)||void 0===i?void 0:i.roomInfo)||void 0===o?void 0:o.roomId},audioPropertiesInfo:{linearVolume:a,nonlinearVolume:xP(a)}})}}))})),t.safeEmit(a_.onRemoteAudioPropertiesReport,n)}}}),i))},t.prototype.setVideoSourceType=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S;return Zf(this,void 0,void 0,(function(){var E,y,g;return $f(this,(function(b){switch(b.label){case 0:return uK.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),GP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),GP(t,"VideoSourceType",[Of.VIDEO_SOURCE_TYPE_EXTERNAL,Of.VIDEO_SOURCE_TYPE_INTERNAL]),E=e===Ff.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[E]===t?[3,4]:(this._trackSourceType[E]=t,uK.print("setVideoSourceType","set ".concat(E," source type to ").concat(t)),this._localVideoTrack&&e===Ff.STREAM_INDEX_MAIN?(g=!1,t===Of.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localVideoTrack.close()),null===(r=this._videoPlayer)||void 0===r||r.stop(),this._localVideoTrack=void 0,y=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,g?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)||y?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===Ff.STREAM_INDEX_SCREEN?(g=!1,t===Of.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,g?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===(S=this._room)||void 0===S?void 0:S.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 r,i,n,o,a,s,c,u;return Zf(this,void 0,void 0,(function(){var d;return $f(this,(function(l){switch(l.label){case 0:if(uK.print("setExternalVideoTrack()","index: %o, track: %o",e,t),GP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),e!==Ff.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new wF(t,AP()),this._initLocalTrackEvents(this._localVideoTrack),null===(r=this._videoPlayer)||void 0===r||r.playVideo(this._localVideoTrack),d=null===(i=this._room)||void 0===i?void 0:i._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!==Ff.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new wF(t,AP()),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 r,i,n,o,a,s,c,u,d,l,h,p,f,_,v;return Zf(this,void 0,void 0,(function(){var m,S,E;return $f(this,(function(y){switch(y.label){case 0:return uK.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),GP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),GP(t,"audioSourceType",[Nf.AUDIO_SOURCE_TYPE_EXTERNAL,Nf.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===Ff.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,uK.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===Ff.STREAM_INDEX_MAIN?(E=!1,this._trackSourceType.audio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,S=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,E?null===(o=null===(n=null===(i=this._room)||void 0===i?void 0:i.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)||S?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:y.sent(),y.label=2;case 2:return this._localScreenAudioTrack&&e===Ff.STREAM_INDEX_SCREEN?(E=!1,this._trackSourceType.audio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,E?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:y.sent(),y.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var r,i,n,o,a,s,c,u,d;return Zf(this,void 0,void 0,(function(){var l;return $f(this,(function(h){switch(h.label){case 0:if(uK.print("setExternalAudioTrack()","index: %o, track: %o",e,t),GP(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),e!==Ff.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new DF(t,AP()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,null===(o=null===(n=null===(i=this._room)||void 0===i?void 0:i.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!==Ff.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new aD(tD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new DF(t,AP()),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 Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return uK.print("login()","token: %o, userInfo: %o",e,t),YP(e)||jP(e,"token"),XP(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return Zf(this,void 0,void 0,(function(){return $f(this,(function(e){return uK.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return uK.print("updateLoginToken()","token: %o",e),YP(e)||jP(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return uK.print("getPeerOnlineStatus()","userId: %o",e),XP(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return XP(e),qP(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return XP(e),zP(t,"message"),qP(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.setServerParams=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){return uK.print("setServerParams()","signature: %o, url: %0",e,t),jP(e,"signature"),jP(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return jP(e,"message"),qP(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.sendServerBinaryMessage=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){return zP(e,"message"),qP(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new aD(tD.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;uK.print("startCloudProxy()",e),jP(e.logProxy,"logProxy"),jP(e.accessProxy,"accessProxy"),jP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=Nk("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=Nk("LOG_SERVER_URL"),this._originConfigServerUrls=Nk("CONFIG_REQUEST_DOMAINS"),Ok("ICE_CONFIG_REQUEST_URLS",e.accessProxy),Ok("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),Ok("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new aD(tD.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");uK.print("stopCloudProxy()"),Ok("ICE_CONFIG_REQUEST_URLS",[]),Ok("LOG_SERVER_URL",this._originLogServerUrl),Ok("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return Zf(this,void 0,void 0,(function(){var r,i=this;return $f(this,(function(n){if(uK.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),WP(e),!this._room||this._room.connectionState!==LF.CONNECTED)throw new aD(tD.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new aD(tD.REPEAT_PUSH,"repeat push public media stream");return r=Dk(e,"started",t),[2,this._room.publicStreamControlMessage(r).then((function(){i._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return Zf(this,void 0,void 0,(function(){var r;return $f(this,(function(i){if(uK.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),WP(e),!this._room||this._room.connectionState!==LF.CONNECTED)throw new aD(tD.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return r=Dk(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(r)]}))}))},t.prototype.stopPushPublicStream=function(e){return Zf(this,void 0,void 0,(function(){var t=this;return $f(this,(function(r){if(uK.print("startPushPublicStream()","publicStreamId: %o",e),WP(e),!this._room||this._room.connectionState!==LF.CONNECTED)throw new aD(tD.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;return Zf(this,void 0,void 0,(function(){var r,i,n,o=this;return $f(this,(function(a){switch(a.label){case 0:return WP(e),this._outsideRoom?[3,2]:(this._outsideRoom=new aK(this._appId),this._outsideRoom.on(YF.RESUBSCRIBE,(function(e){var t,r,i=e.stream;if(i){var n=o._publicStreamAudioPlayer.get(i.streamId);n&&i.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var a=o._publicStreamVideoPlayer.get(i.streamId);a&&i.videoTrack&&a.playVideo(null===(r=e.stream)||void 0===r?void 0:r.videoTrack)}})),null===(t=this._outsideRoom)||void 0===t||t.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,o.safeEmit(a_.onPublicStreamStats,e)})),[4,this._outsideRoom.connect()]);case 1:a.sent(),a.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return r=a.sent(),(i=this._publicStreamVideoPlayer.get(e))&&(null==r?void 0:r.videoTrack)&&i.playVideo(r.videoTrack,r),!(n=this._publicStreamAudioPlayer.get(e))&&(null==r?void 0:r.audioTrack)&&(n=new hB(e),this._initPlayerEvents(n,!0),n.playAudio(r.audioTrack),this._publicStreamAudioPlayer.set(e,n)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return Zf(this,void 0,void 0,(function(){var t;return $f(this,(function(r){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.destroy(),this._publicStreamAudioPlayer.delete(e)),[2]):[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var r,i;uK.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var n=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&n)return n.destroy(),void this._publicStreamVideoPlayer.delete(e);if(!n){n=new lB(Jf(Jf({},t),{userId:e})),this._initPlayerEvents(n,!0),this._publicStreamVideoPlayer.set(e,n);var o=null===(i=null===(r=this._outsideRoom)||void 0===r?void 0:r.remoteStreams)||void 0===i?void 0:i.get(e);(null==o?void 0:o.videoTrack)&&n.playVideo(o.videoTrack,o)}},t.prototype.setDummyCaptureImagePath=function(e,t){return Zf(this,void 0,void 0,(function(){var r=this;return $f(this,(function(i){return[2,new Promise((function(i,n){jP(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 aD(tD.UNEXPECTED_ERROR,"Not support canvas"));t.width=o.width,t.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(r._dummyTimer),r._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=t.captureStream(5).getVideoTracks()[0];e===Ff.STREAM_INDEX_MAIN?r._localImgVideoTrack=s:r._localImgScreenTrack=s,i()}catch(e){n(new aD(tD.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new aD(tD.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(Pk))},t.prototype._updatePublish=function(e){return void 0===e&&(e=!1),Zf(this,void 0,void 0,(function(){var t,r;return $f(this,(function(i){switch(i.label){case 0:if(uK.print("_updatePublish()"),!this._visibility)throw new aD(tD.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(t=i.sent(),!this._room||this._room.connectionState!==LF.CONNECTED)return t(),[2];i.label=2;case 2:return i.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,e)];case 3:return i.sent(),[3,6];case 4:throw(r=i.sent())instanceof aD?r:new aD(tD.UNEXPECTED_ERROR,"unexpected error",r);case 5:return t(),[7];case 6:return[2]}}))}))},t.prototype.startAudioPlaybackDeviceTest=function(e,t){return Zf(this,void 0,void 0,(function(){return $f(this,(function(r){switch(r.label){case 0:return uK.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),jP(e,"filePath"),BP(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,r.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){uK.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()},t.prototype.startAudioDeviceRecordTest=function(e){return Zf(this,void 0,void 0,(function(){return $f(this,(function(t){switch(t.label){case 0:return uK.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),BP(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){uK.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){uK.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype._updateScreenPublish=function(){return Zf(this,void 0,void 0,(function(){var e,t;return $f(this,(function(r){switch(r.label){case 0:return uK.print("_updateScreenPublish()"),[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==LF.CONNECTED)return e(),[2];r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof aD?t:new aD(tD.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){uK.print("_updateAudioPlayerState()");var t,r=e.userId,i=e.isScreen;if(t=i?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack){if(!t){var n=i?"".concat(r,"_screen"):r;t=new hB(n),this._initPlayerEvents(t),this._remoteAudioPlayer.set(n,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}t.playAudio(e.audioTrack)}else null==t||t.stop()},t.prototype._updateVideoPlayerState=function(e){uK.print("_updateVideoPlayerState()");var t,r=e.userId;t=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?t&&t.playVideo(e.videoTrack,e):null==t||t.stop()},t.prototype._onAddStream=function(e){var t,r,i,n,o,a,s,c,u=e.stream,d={userId:u.userId,isScreen:u.isScreen,hasVideo:u.hasVideo,hasAudio:u.hasAudio,videoStreamDescriptions:u.attributes.videoDescriptions};this.safeEmit(a_.onStreamAdd,{stream:d});var l=null;(null===(t=this._roomConfig)||void 0===t?void 0:t.isAutoSubscribeAudio)&&(l=Bf.AUDIO_ONLY),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(l=Bf.VIDEO_ONLY),(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeVideo)&&(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)&&(l=Bf.AUDIO_AND_VIDEO),uK.print("_onAddStream","autoSubType: ".concat(l)),null===l||u.isScreen||(l===Bf.AUDIO_AND_VIDEO?(null===(o=u.observer)||void 0===o||o.setAutoSubscribeVideo(!0),null===(a=u.observer)||void 0===a||a.setAutoSubscribeAudio(!0)):l===Bf.AUDIO_ONLY?null===(s=u.observer)||void 0===s||s.setAutoSubscribeAudio(!0):l===Bf.VIDEO_ONLY&&(null===(c=u.observer)||void 0===c||c.setAutoSubscribeVideo(!0)),this.subscribeUserStream(u.userId,l))},t.prototype._onRemoveStream=function(e){var t,r=e.stream,i={userId:r.userId,isScreen:r.isScreen,hasVideo:r.hasVideo,hasAudio:r.hasAudio,videoStreamDescriptions:[]},n=null!==(t=lK[e.reason])&&void 0!==t?t:jf.STREAM_REMOVE_REASON_OTHER;this.safeEmit(a_.onStreamRemove,{stream:i,reason:n}),this._getRemotePlayer(r.userId,r.isScreen).forEach((function(e){return null==e?void 0:e.destroy()}))},t.prototype._onUserConnection=function(e){this.safeEmit(a_.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(a_.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(a_.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===Gf.CONNECTION_STATE_CONNECTED&&this.safeEmit(a_.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(a_.onConnectionStateChanged,e)},t.prototype._getRemotePlayer=function(e,t){return[this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]},t.prototype._stopAudioPropertiesReport=function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)},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(a_.onVideoFirstFrameDecoded,e)},t.prototype._onDeviceStateChange=function(e){this.safeEmit(a_.onMediaDeviceStateChanged,e)},t.prototype._onUserMuteAudio=function(e){this.safeEmit(a_.onUserMuteAudio,e)},t.prototype._onUserMuteVideo=function(e){this.safeEmit(a_.onUserMuteVideo,e)},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(a_.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(a_.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this.safeEmit(a_.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(a_.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(a_.onLiveTranscodingResult,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(a_.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(a_.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t.safeEmit(a_.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t.safeEmit(a_.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(a_.onError,{errorCode:tD.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(a_.onError,{errorCode:tD.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,r=[];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){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,r=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})}))),r},enumerable:!1,configurable:!0}),t.prototype._handleAudioDeviceManager=function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(a_.onAudioPlaybackDeviceTestVolume,t)}))},qf([yx()],t.prototype,"updateToken",null),qf([yx()],t.prototype,"switchCamera",null),qf([yx()],t.prototype,"switchMicrophone",null),qf([yx()],t.prototype,"joinRoom",null),qf([yx()],t.prototype,"leaveRoom",null),qf([yx()],t.prototype,"destroy",null),qf([yx()],t.prototype,"publish",null),qf([yx()],t.prototype,"unpublish",null),qf([yx()],t.prototype,"subscribeUserStream",null),qf([yx()],t.prototype,"unSubscribe",null),qf([yx()],t.prototype,"startVideoCapture",null),qf([yx()],t.prototype,"stopVideoCapture",null),qf([yx()],t.prototype,"startAudioCapture",null),qf([yx()],t.prototype,"stopAudioCapture",null),qf([yx()],t.prototype,"getAudioMixingManager",null),qf([yx()],t.prototype,"startScreenCapture",null),qf([yx()],t.prototype,"stopScreenCapture",null),qf([yx()],t.prototype,"publishScreen",null),qf([yx()],t.prototype,"unpublishScreen",null),qf([yx()],t.prototype,"setLocalVideoPlayer",null),qf([yx()],t.prototype,"startLiveTranscoding",null),qf([yx()],t.prototype,"updateLiveTranscoding",null),qf([yx()],t.prototype,"stopLiveTranscoding",null),qf([yx()],t.prototype,"setBusinessId",null),qf([yx()],t.prototype,"setUserVisibility",null),qf([yx()],t.prototype,"setRemoteVideoPlayer",null),qf([yx()],t.prototype,"setLocalVideoMirrorType",null),qf([yx()],t.prototype,"setAudioPlaybackDevice",null),qf([yx()],t.prototype,"play",null),qf([yx()],t.prototype,"muteLocalAudio",null),qf([yx()],t.prototype,"muteLocalVideo",null),qf([yx()],t.prototype,"pauseAllSubscribedStream",null),qf([yx()],t.prototype,"resumeAllSubscribedStream",null),qf([yx()],t.prototype,"sendUserMessage",null),qf([yx()],t.prototype,"sendUserBinaryMessage",null),qf([yx()],t.prototype,"sendRoomMessage",null),qf([yx()],t.prototype,"sendRoomBinaryMessage",null),qf([yx()],t.prototype,"setAudioCaptureConfig",null),qf([yx()],t.prototype,"setVideoCaptureConfig",null),qf([yx()],t.prototype,"enableSimulcastMode",null),qf([yx()],t.prototype,"setVideoEncoderConfig",null),qf([yx()],t.prototype,"sendSEIMessage",null),qf([yx()],t.prototype,"setAudioVolumeIndicationInterval",null),qf([yx()],t.prototype,"enableAudioPropertiesReport",null),qf([yx()],t.prototype,"setVideoSourceType",null),qf([yx()],t.prototype,"setExternalVideoTrack",null),qf([yx()],t.prototype,"setAudioSourceType",null),qf([yx()],t.prototype,"setExternalAudioTrack",null),qf([yx("rtm")],t.prototype,"login",null),qf([yx("rtm")],t.prototype,"logout",null),qf([yx("rtm")],t.prototype,"updateLoginToken",null),qf([yx("rtm")],t.prototype,"getPeerOnlineStatus",null),qf([yx("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),qf([yx("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),qf([yx("rtm")],t.prototype,"setServerParams",null),qf([yx("rtm")],t.prototype,"sendServerMessage",null),qf([yx("rtm")],t.prototype,"sendServerBinaryMessage",null),qf([yx()],t.prototype,"startCloudProxy",null),qf([yx()],t.prototype,"stopCloudProxy",null),qf([yx()],t.prototype,"startPushPublicStream",null),qf([yx()],t.prototype,"updatePublicStreamParam",null),qf([yx()],t.prototype,"stopPushPublicStream",null),qf([yx("outsideRoom")],t.prototype,"startPlayPublicStream",null),qf([yx("outsideRoom")],t.prototype,"stopPlayPublicStream",null),qf([yx("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),qf([yx()],t.prototype,"setDummyCaptureImagePath",null),qf([yx()],t.prototype,"startAudioPlaybackDeviceTest",null),qf([yx()],t.prototype,"stopAudioPlaybackDeviceTest",null),qf([yx()],t.prototype,"startAudioDeviceRecordTest",null),qf([yx()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),qf([yx()],t.prototype,"stopAudioDevicePlayTest",null),t}(nk),lK={"client unpublished":jf.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":jf.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":jf.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":jf.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":jf.STREAM_REMOVE_REASON_REPUBLISH},hK=new rk("VERTC",0);[vx,mx,Sx].forEach((function(e){return e.setStats({rtc_sdk_version:Ck.VERSION,product_line:sL.RTC,report_version:cL.W_5,os:uL.WEB,device_id:Ux.getDeviceId(),user_agent:NP()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var pK=function(e){return hK.print("createEngine","Invoke VERTC.createEngine"),jP(e,"appId"),[vx,mx,Sx].forEach((function(t){return t.setStats({rtc_app_id:e})})),px.sdkInitEngine(Date.now(),FL.BEGIN),new dK(e)},fK=function(e){if(hK.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof dK))throw new aD(tD.INVALID_ENGINE,"Invalid engine object");e.destroy(),px.sdkInitEngine(Date.now(),FL.END)},_K=function(){return Zf(void 0,void 0,void 0,(function(){return $f(this,(function(e){return[2,hF.getDevices()]}))}))},vK=function(e){return void 0===e&&(e={video:!0,audio:!0}),Zf(void 0,void 0,void 0,(function(){var t,r,i,n,o;return $f(this,(function(a){switch(a.label){case 0:if(t=e.video,r=e.audio,i={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),n=i,[4,hF.getVideoPermission()];case 2:return n.video=a.sent(),[3,4];case 3:return a.sent(),[3,4];case 4:if(!r)return[3,8];a.label=5;case 5:return a.trys.push([5,7,,8]),o=i,[4,hF.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,i]}}))}))},mK=function(){return Zf(void 0,void 0,void 0,(function(){return $f(this,(function(e){return[2,hF.getMicrophones()]}))}))},SK=function(){return Zf(void 0,void 0,void 0,(function(){return $f(this,(function(e){return[2,hF.getCameras()]}))}))},EK=function(){return Zf(void 0,void 0,void 0,(function(){return $f(this,(function(e){return[2,hF.getAudioPlayback()]}))}))},yK=function(){return Ck.VERSION},gK=function(){return px.rtcSdkApiCall("isSupported",0,""),Zf(void 0,void 0,void 0,(function(){var e;return $f(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!NP()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,SV()]:[2,!1];case 1:return[2,null==(e=t.sent())?void 0:e.includes("H264")];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},bK=function(){return px.rtcSdkApiCall("getSupportedCodecs",0,""),Zf(void 0,void 0,void 0,(function(){return $f(this,(function(e){switch(e.label){case 0:return[4,SV()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!NP()&&location.search.includes("_rtc_autotest_");var TK=new function(){this.getSdkVersion=yK,this.createEngine=pK,this.destroyEngine=fK,this.getDevices=_K,this.enableDevices=vK,this.getMicrophones=mK,this.getCameras=SK,this.getAudioPlayback=EK,this.getParameter=Nk,this.setParameter=Ok,this.isSupported=gK,this.getSupportedCodecs=bK,this.ConnectionMode=Wf,this.events=a_,this.ErrorCode=tD,this.platform="BytePlus",this._monitor=px};return Jf(Jf(Jf(Jf({},TK),o_),s_),{events:a_})}));
|