@byteplus/rtc 4.38.0 → 4.40.0
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.d.ts +799 -607
- package/index.esm.min.js +2 -2
- package/index.min.js +2 -2
- package/package.json +4 -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.
|
|
4
|
+
* version: 4.40.0
|
|
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 n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{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:{},n=function(e){return e&&e.Math==Math&&e},i=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("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={},f={}.propertyIsEnumerable,p=Object.getOwnPropertyDescriptor,_=p&&!f.call({1:2},1);h.f=_?function(e){var t=p(this,e);return!!t&&t.enumerable}:f;var v,m,E=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},g=c,S=Function.prototype,y=S.bind,b=S.call,T=g&&y.bind(b,b),I=g?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,k=i.Object,P=N("".split),M=w((function(){return!k("z").propertyIsEnumerable(0)}))?function(e){return"String"==D(e)?P(e,""):k(e)}:k,U=i.TypeError,L=function(e){if(null==e)throw U("Can't call method on "+e);return e},x=M,V=L,B=function(e){return x(V(e))},j=function(e){return"function"==typeof e},F=j,G=function(e){return"object"==typeof e?null!==e:F(e)},H=i,z=j,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")||"",q=i,J=W,Z=q.process,$=q.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&&J&&(!(v=J.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=J.match(/Chrome\/(\d+)/))&&(m=+v[1]);var te=m,re=te,ne=a,ie=!!Object.getOwnPropertySymbols&&!ne((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&re&&re<41})),oe=ie&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ae=Y,se=j,ce=X,ue=oe,de=i.Object,le=ue?function(e){return"symbol"==typeof e}:function(e){var t=ae("Symbol");return se(t)&&ce(t.prototype,de(e))},he=i.String,fe=function(e){try{return he(e)}catch(e){return"Object"}},pe=j,_e=fe,ve=i.TypeError,me=function(e){if(pe(e))return e;throw ve(_e(e)+" is not a function")},Ee=me,ge=function(e,t){var r=e[t];return null==r?void 0:Ee(r)},Se=l,ye=j,be=G,Te=i.TypeError,Ie={exports:{}},Re=i,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=i[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 ke=L,Pe=i.Object,Me=function(e){return Pe(ke(e))},Ue=Me,Le=I({}.hasOwnProperty),xe=Object.hasOwn||function(e,t){return Le(Ue(e),t)},Ve=I,Be=0,je=Math.random(),Fe=Ve(1..toString),Ge=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Fe(++Be+je,36)},He=i,ze=Ie.exports,Ke=xe,Ye=Ge,Xe=ie,We=oe,qe=ze("wks"),Je=He.Symbol,Ze=Je&&Je.for,$e=We?Je:Je&&Je.withoutSetter||Ye,Qe=function(e){if(!Ke(qe,e)||!Xe&&"string"!=typeof qe[e]){var t="Symbol."+e;Xe&&Ke(Je,e)?qe[e]=Je[e]:qe[e]=We&&Ze?Ze(t):$e(t)}return qe[e]},et=l,tt=G,rt=le,nt=ge,it=function(e,t){var r,n;if("string"===t&&ye(r=e.toString)&&!be(n=Se(r,e)))return n;if(ye(r=e.valueOf)&&!be(n=Se(r,e)))return n;if("string"!==t&&ye(r=e.toString)&&!be(n=Se(r,e)))return n;throw Te("Can't convert object to primitive value")},ot=Qe,at=i.TypeError,st=ot("toPrimitive"),ct=function(e,t){if(!tt(e)||rt(e))return e;var r,n=nt(e,st);if(n){if(void 0===t&&(t="default"),r=et(n,e,t),!tt(r)||rt(r))return r;throw at("Can't convert object to primitive value")}return void 0===t&&(t="number"),it(e,t)},ut=ct,dt=le,lt=function(e){var t=ut(e,"string");return dt(t)?t:t+""},ht=G,ft=i.document,pt=ht(ft)&&ht(ft.createElement),_t=function(e){return pt?ft.createElement(e):{}},vt=_t,mt=!s&&!a((function(){return 7!=Object.defineProperty(vt("div"),"a",{get:function(){return 7}}).a})),Et=s,gt=l,St=h,yt=E,bt=B,Tt=lt,It=xe,Rt=mt,At=Object.getOwnPropertyDescriptor;o.f=Et?At:function(e,t){if(e=bt(e),t=Tt(t),Rt)try{return At(e,t)}catch(e){}if(It(e,t))return yt(!gt(St.f,e,t),e[t])};var Ct={},Ot=s&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Nt=i,wt=G,Dt=Nt.String,kt=Nt.TypeError,Pt=function(e){if(wt(e))return e;throw kt(Dt(e)+" is not an object")},Mt=s,Ut=mt,Lt=Ot,xt=Pt,Vt=lt,Bt=i.TypeError,jt=Object.defineProperty,Ft=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 n=Ft(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:Ht in r?r.configurable:n.configurable,enumerable:Gt in r?r.enumerable:n.enumerable,writable:!1})}return jt(e,t,r)}:jt:function(e,t,r){if(xt(e),t=Vt(t),xt(r),Ut)try{return jt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Bt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Kt=Ct,Yt=E,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:{}},qt=j,Jt=we,Zt=I(Function.toString);qt(Jt.inspectSource)||(Jt.inspectSource=function(e){return Zt(e)});var $t,Qt,er,tr=Jt.inspectSource,rr=j,nr=tr,ir=i.WeakMap,or=rr(ir)&&/native code/.test(nr(ir)),ar=Ie.exports,sr=Ge,cr=ar("keys"),ur=function(e){return cr[e]||(cr[e]=sr(e))},dr={},lr=or,hr=i,fr=I,pr=G,_r=Xt,vr=xe,mr=we,Er=ur,gr=dr,Sr="Object already initialized",yr=hr.TypeError,br=hr.WeakMap;if(lr||mr.state){var Tr=mr.state||(mr.state=new br),Ir=fr(Tr.get),Rr=fr(Tr.has),Ar=fr(Tr.set);$t=function(e,t){if(Rr(Tr,e))throw new yr(Sr);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=Er("state");gr[Cr]=!0,$t=function(e,t){if(vr(e,Cr))throw new yr(Sr);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(!pr(t)||(r=Qt(t)).type!==e)throw yr("Incompatible receiver, "+e+" required");return r}}},Nr=s,wr=xe,Dr=Function.prototype,kr=Nr&&Object.getOwnPropertyDescriptor,Pr=wr(Dr,"name"),Mr={EXISTS:Pr,PROPER:Pr&&"something"===function(){}.name,CONFIGURABLE:Pr&&(!Nr||Nr&&kr(Dr,"name").configurable)},Ur=i,Lr=j,xr=xe,Vr=Xt,Br=Ce,jr=tr,Fr=Mr.CONFIGURABLE,Gr=Or.get,Hr=Or.enforce,zr=String(String).split("String");(Wt.exports=function(e,t,r,n){var i,o=!!n&&!!n.unsafe,a=!!n&&!!n.enumerable,s=!!n&&!!n.noTargetGet,c=n&&void 0!==n.name?n.name:t;Lr(r)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!xr(r,"name")||Fr&&r.name!==c)&&Vr(r,"name",c),(i=Hr(r)).source||(i.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:Br(t,r)})(Function.prototype,"toString",(function(){return Lr(this)&&Gr(this).source||jr(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)},qr=Wr,Jr=Math.max,Zr=Math.min,$r=function(e,t){var r=qr(e);return r<0?Jr(r+t,0):Zr(r,t)},Qr=Wr,en=Math.min,tn=function(e){return e>0?en(Qr(e),9007199254740991):0},rn=tn,nn=function(e){return rn(e.length)},on=B,an=$r,sn=nn,cn=function(e){return function(t,r,n){var i,o=on(t),a=sn(o),s=an(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},un={includes:cn(!0),indexOf:cn(!1)},dn=xe,ln=B,hn=un.indexOf,fn=dr,pn=I([].push),_n=function(e,t){var r,n=ln(e),i=0,o=[];for(r in n)!dn(fn,r)&&dn(n,r)&&pn(o,r);for(;t.length>i;)dn(n,r=t[i++])&&(~hn(o,r)||pn(o,r));return o},vn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],mn=_n,En=vn.concat("length","prototype");Kr.f=Object.getOwnPropertyNames||function(e){return mn(e,En)};var gn={};gn.f=Object.getOwnPropertySymbols;var Sn=Y,yn=Kr,bn=gn,Tn=Pt,In=I([].concat),Rn=Sn("Reflect","ownKeys")||function(e){var t=yn.f(Tn(e)),r=bn.f;return r?In(t,r(e)):t},An=xe,Cn=Rn,On=o,Nn=Ct,wn=function(e,t,r){for(var n=Cn(t),i=Nn.f,o=On.f,a=0;a<n.length;a++){var s=n[a];An(e,s)||r&&An(r,s)||i(e,s,o(t,s))}},Dn=a,kn=j,Pn=/#|\.prototype\./,Mn=function(e,t){var r=Ln[Un(e)];return r==Vn||r!=xn&&(kn(t)?Dn(t):!!t)},Un=Mn.normalize=function(e){return String(e).replace(Pn,".").toLowerCase()},Ln=Mn.data={},xn=Mn.NATIVE="N",Vn=Mn.POLYFILL="P",Bn=Mn,jn=i,Fn=o.f,Gn=Xt,Hn=Wt.exports,zn=Ce,Kn=wn,Yn=Bn,Xn=function(e,t){var r,n,i,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?jn:u?jn[s]||zn(s,{}):(jn[s]||{}).prototype)for(n in t){if(o=t[n],i=e.noTargetGet?(a=Fn(r,n))&&a.value:r[n],!Yn(c?n:s+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Kn(o,i)}(e.sham||i&&i.sham)&&Gn(o,"sham",!0),Hn(r,n,o,e)}},Wn=i,qn=j,Jn=Wn.String,Zn=Wn.TypeError,$n=I,Qn=Pt,ei=function(e){if("object"==typeof e||qn(e))return e;throw Zn("Can't set "+Jn(e)+" as a prototype")},ti=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=$n(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return Qn(r),ei(n),t?e(r,n):r.__proto__=n,r}}():void 0);Xn({target:"Object",stat:!0},{setPrototypeOf:ti});var ri={},ni=_n,ii=vn,oi=Object.keys||function(e){return ni(e,ii)},ai=s,si=Ot,ci=Ct,ui=Pt,di=B,li=oi;ri.f=ai&&!si?Object.defineProperties:function(e,t){ui(e);for(var r,n=di(t),i=li(t),o=i.length,a=0;o>a;)ci.f(e,r=i[a++],n[r]);return e};var hi,fi=Y("document","documentElement"),pi=Pt,_i=ri,vi=vn,mi=dr,Ei=fi,gi=_t,Si=ur("IE_PROTO"),yi=function(){},bi=function(e){return"<script>"+e+"</"+"script>"},Ti=function(e){e.write(bi("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ii=function(){try{hi=new ActiveXObject("htmlfile")}catch(e){}var e,t;Ii="undefined"!=typeof document?document.domain&&hi?Ti(hi):((t=gi("iframe")).style.display="none",Ei.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(bi("document.F=Object")),e.close(),e.F):Ti(hi);for(var r=vi.length;r--;)delete Ii.prototype[vi[r]];return Ii()};mi[Si]=!0;var Ri=Object.create||function(e,t){var r;return null!==e?(yi.prototype=pi(e),r=new yi,yi.prototype=null,r[Si]=e):r=Ii(),void 0===t?r:_i.f(r,t)};Xn({target:"Object",stat:!0,sham:!s},{create:Ri});var Ai=s,Ci=I,Oi=l,Ni=a,wi=oi,Di=gn,ki=h,Pi=Me,Mi=M,Ui=Object.assign,Li=Object.defineProperty,xi=Ci([].concat),Vi=!Ui||Ni((function(){if(Ai&&1!==Ui({b:1},Ui(Li({},"a",{enumerable:!0,get:function(){Li(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=Ui({},e)[r]||wi(Ui({},t)).join("")!=n}))?function(e,t){for(var r=Pi(e),n=arguments.length,i=1,o=Di.f,a=ki.f;n>i;)for(var s,c=Mi(arguments[i++]),u=o?xi(wi(c),o(c)):wi(c),d=u.length,l=0;d>l;)s=u[l++],Ai&&!Oi(a,c,s)||(r[s]=c[s]);return r}:Ui,Bi=Vi;Xn({target:"Object",stat:!0,forced:Object.assign!==Bi},{assign:Bi});var ji=a,Fi=function(e,t){var r=[][e];return!!r&&ji((function(){r.call(null,t||function(){throw 1},1)}))},Gi=Xn,Hi=un.indexOf,zi=Fi,Ki=I([].indexOf),Yi=!!Ki&&1/Ki([1],1,-0)<0,Xi=zi("indexOf");Gi({target:"Array",proto:!0,forced:Yi||!Xi},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Yi?Ki(this,e,t)||0:Hi(this,e,t)}});var Wi=c,qi=Function.prototype,Ji=qi.apply,Zi=qi.call,$i="object"==typeof Reflect&&Reflect.apply||(Wi?Zi.bind(Ji):function(){return Zi.apply(Ji,arguments)}),Qi=O,eo=Array.isArray||function(e){return"Array"==Qi(e)},to={};to[Qe("toStringTag")]="z";var ro="[object z]"===String(to),no=i,io=ro,oo=j,ao=O,so=Qe("toStringTag"),co=no.Object,uo="Arguments"==ao(function(){return arguments}()),lo=io?ao:function(e){var t,r,n;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"==(n=ao(t))&&oo(t.callee)?"Arguments":n},ho=lo,fo=i.String,po=function(e){if("Symbol"===ho(e))throw TypeError("Cannot convert a Symbol value to a string");return fo(e)},_o={},vo=lt,mo=Ct,Eo=E,go=function(e,t,r){var n=vo(t);n in e?mo.f(e,n,Eo(0,r)):e[n]=r},So=$r,yo=nn,bo=go,To=i.Array,Io=Math.max,Ro=function(e,t,r){for(var n=yo(e),i=So(t,n),o=So(void 0===r?n:r,n),a=To(Io(o-i,0)),s=0;i<o;i++,s++)bo(a,s,e[i]);return a.length=s,a},Ao=O,Co=B,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),ko={},Po=Qe;ko.f=Po;var Mo=i,Uo=xe,Lo=ko,xo=Ct.f,Vo=function(e){var t=Mo.Symbol||(Mo.Symbol={});Uo(t,e)||xo(t,e,{value:Lo.f(e)})},Bo=Ct.f,jo=xe,Fo=Qe("toStringTag"),Go=function(e,t,r){e&&!r&&(e=e.prototype),e&&!jo(e,Fo)&&Bo(e,Fo,{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,qo=j,Jo=lo,Zo=tr,$o=function(){},Qo=[],ea=Y("Reflect","construct"),ta=/^\s*(?:class|function)\b/,ra=Xo(ta.exec),na=!ta.exec($o),ia=function(e){if(!qo(e))return!1;try{return ea($o,Qo,e),!0}catch(e){return!1}},oa=function(e){if(!qo(e))return!1;switch(Jo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return na||!!ra(ta,Zo(e))}catch(e){return!0}};oa.sham=!0;var aa=!ea||Wo((function(){var e;return ia(ia.call)||!ia(Object)||!ia((function(){e=!0}))||e}))?oa:ia,sa=i,ca=eo,ua=aa,da=G,la=Qe("species"),ha=sa.Array,fa=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},pa=function(e,t){return new(fa(e))(0===t?0:t)},_a=Yo,va=M,ma=Me,Ea=nn,ga=pa,Sa=I([].push),ya=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,f,p=ma(c),_=va(p),v=_a(u,d),m=Ea(_),E=0,g=l||ga,S=t?g(c,m):r||a?g(c,0):void 0;m>E;E++)if((s||E in _)&&(f=v(h=_[E],E,p),e))if(t)S[E]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return E;case 2:Sa(S,h)}else switch(e){case 4:return!1;case 7:Sa(S,h)}return o?-1:n||i?i:S}},ba={forEach:ya(0),map:ya(1),filter:ya(2),some:ya(3),every:ya(4),find:ya(5),findIndex:ya(6),filterReject:ya(7)},Ta=Xn,Ia=i,Ra=Y,Aa=$i,Ca=l,Oa=I,Na=s,wa=ie,Da=a,ka=xe,Pa=eo,Ma=j,Ua=G,La=X,xa=le,Va=Pt,Ba=Me,ja=B,Fa=lt,Ga=po,Ha=E,za=Ri,Ka=oi,Ya=Kr,Xa=_o,Wa=gn,qa=o,Ja=Ct,Za=ri,$a=h,Qa=Do,es=Wt.exports,ts=Ie.exports,rs=dr,ns=Ge,is=Qe,os=ko,as=Vo,ss=Go,cs=Or,us=ba.forEach,ds=ur("hidden"),ls="Symbol",hs=is("toPrimitive"),fs=cs.set,ps=cs.getterFor(ls),_s=Object.prototype,vs=Ia.Symbol,ms=vs&&vs.prototype,Es=Ia.TypeError,gs=Ia.QObject,Ss=Ra("JSON","stringify"),ys=qa.f,bs=Ja.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=!gs||!gs.prototype||!gs.prototype.findChild,ks=Na&&Da((function(){return 7!=za(bs({},"a",{get:function(){return bs(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=ys(_s,t);n&&delete _s[t],bs(e,t,r),n&&e!==_s&&bs(_s,t,n)}:bs,Ps=function(e,t){var r=As[e]=za(ms);return fs(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 n=Fa(t);return Va(r),ka(As,n)?(r.enumerable?(ka(e,ds)&&e[ds][n]&&(e[ds][n]=!1),r=za(r,{enumerable:Ha(0,!1)})):(ka(e,ds)||bs(e,ds,Ha(1,{})),e[ds][n]=!0),ks(e,n,r)):bs(e,n,r)},Us=function(e,t){Va(e);var r=ja(t),n=Ka(r).concat(Bs(r));return us(n,(function(t){Na&&!Ca(Ls,r,t)||Ms(e,t,r[t])})),e},Ls=function(e){var t=Fa(e),r=Ca(Is,this,t);return!(this===_s&&ka(As,t)&&!ka(Cs,t))&&(!(r||!ka(this,t)||!ka(As,t)||ka(this,ds)&&this[ds][t])||r)},xs=function(e,t){var r=ja(e),n=Fa(t);if(r!==_s||!ka(As,n)||ka(Cs,n)){var i=ys(r,n);return!i||!ka(As,n)||ka(r,ds)&&r[ds][n]||(i.enumerable=!0),i}},Vs=function(e){var t=Ts(ja(e)),r=[];return us(t,(function(e){ka(As,e)||ka(rs,e)||Rs(r,e)})),r},Bs=function(e){var t=e===_s,r=Ts(t?Cs:ja(e)),n=[];return us(r,(function(e){!ka(As,e)||t&&!ka(_s,e)||Rs(n,As[e])})),n};(wa||(vs=function(){if(La(ms,this))throw Es("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Ga(arguments[0]):void 0,t=ns(e),r=function(e){this===_s&&Ca(r,Cs,e),ka(this,ds)&&ka(this[ds],t)&&(this[ds][t]=!1),ks(this,t,Ha(1,e))};return Na&&Ds&&ks(_s,t,{configurable:!0,set:r}),Ps(t,e)},es(ms=vs.prototype,"toString",(function(){return ps(this).tag})),es(vs,"withoutSetter",(function(e){return Ps(ns(e),e)})),$a.f=Ls,Ja.f=Ms,Za.f=Us,qa.f=xs,Ya.f=Xa.f=Vs,Wa.f=Bs,os.f=function(e){return Ps(is(e),e)},Na&&(bs(ms,"description",{configurable:!0,get:function(){return ps(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(ka(Os,t))return Os[t];var r=vs(t);return Os[t]=r,Ns[r]=t,r},keyFor:function(e){if(!xa(e))throw Es(e+" is not a symbol");if(ka(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:Bs}),Ta({target:"Object",stat:!0,forced:Da((function(){Wa.f(1)}))},{getOwnPropertySymbols:function(e){return Wa.f(Ba(e))}}),Ss)&&Ta({target:"JSON",stat:!0,forced:!wa||Da((function(){var e=vs();return"[null]"!=Ss([e])||"{}"!=Ss({a:e})||"{}"!=Ss(Object(e))}))},{stringify:function(e,t,r){var n=Qa(arguments),i=t;if((Ua(t)||void 0!==e)&&!xa(e))return Pa(t)||(t=function(e,t){if(Ma(i)&&(t=Ca(i,this,e,t)),!xa(t))return t}),n[1]=t,Aa(Ss,null,n)}});if(!ms[hs]){var js=ms.valueOf;es(ms,hs,(function(e){return Ca(js,this)}))}ss(vs,ls),rs[ds]=!0;var Fs=Xn,Gs=a,Hs=B,zs=o.f,Ks=s,Ys=Gs((function(){zs(1)}));Fs({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)+"]"},qs=ro,Js=Wt.exports,Zs=Ws;qs||Js(Object.prototype,"toString",Zs,{unsafe:!0});var $s=Xn,Qs=s,ec=Ct.f;$s({target:"Object",stat:!0,forced:Object.defineProperty!==ec,sham:!Qs},{defineProperty:ec});var tc=i.Promise,rc=Wt.exports,nc=function(e,t,r){for(var n in t)rc(e,n,t[n],r);return e},ic=Y,oc=Ct,ac=s,sc=Qe("species"),cc=function(e){var t=ic(e),r=oc.f;ac&&t&&!t[sc]&&r(t,sc,{configurable:!0,get:function(){return this}})},uc=X,dc=i.TypeError,lc=function(e,t){if(uc(t,e))return e;throw dc("Incorrect invocation")},hc={},fc=hc,pc=Qe("iterator"),_c=Array.prototype,vc=function(e){return void 0!==e&&(fc.Array===e||_c[pc]===e)},mc=lo,Ec=ge,gc=hc,Sc=Qe("iterator"),yc=function(e){if(null!=e)return Ec(e,Sc)||Ec(e,"@@iterator")||gc[mc(e)]},bc=l,Tc=me,Ic=Pt,Rc=fe,Ac=yc,Cc=i.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=Pt,Dc=ge,kc=function(e,t,r){var n,i;wc(e);try{if(!(n=Dc(e,"return"))){if("throw"===t)throw r;return r}n=Nc(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return wc(n),r},Pc=Yo,Mc=l,Uc=Pt,Lc=fe,xc=vc,Vc=nn,Bc=X,jc=Oc,Fc=yc,Gc=kc,Hc=i.TypeError,zc=function(e,t){this.stopped=e,this.result=t},Kc=zc.prototype,Yc=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),p=Pc(t,d),_=function(e){return n&&Gc(n,"normal",e),new zc(!0,e)},v=function(e){return l?(Uc(e),f?p(e[0],e[1],_):p(e[0],e[1])):f?p(e,_):p(e)};if(h)n=e;else{if(!(i=Fc(e)))throw Hc(Lc(e)+" is not iterable");if(xc(i)){for(o=0,a=Vc(e);a>o;o++)if((s=v(e[o]))&&Bc(Kc,s))return s;return new zc(!1)}n=jc(e,i)}for(c=n.next;!(u=Mc(c,n)).done;){try{s=v(u.value)}catch(e){Gc(n,"throw",e)}if("object"==typeof s&&s&&Bc(Kc,s))return s}return new zc(!1)},Xc=Qe("iterator"),Wc=!1;try{var qc=0,Jc={next:function(){return{done:!!qc++}},return:function(){Wc=!0}};Jc[Xc]=function(){return this},Array.from(Jc,(function(){throw 2}))}catch(e){}var Zc,$c,Qc,eu,tu=function(e,t){if(!t&&!Wc)return!1;var r=!1;try{var n={};n[Xc]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},ru=aa,nu=fe,iu=i.TypeError,ou=function(e){if(ru(e))return e;throw iu(nu(e)+" is not a constructor")},au=Pt,su=ou,cu=Qe("species"),uu=function(e,t){var r,n=au(e).constructor;return void 0===n||null==(r=au(n)[cu])?t:su(r)},du=i.TypeError,lu=function(e,t){if(e<t)throw du("Not enough arguments");return e},hu=/(?:ipad|iphone|ipod).*applewebkit/i.test(W),fu="process"==O(i.process),pu=i,_u=$i,vu=Yo,mu=j,Eu=xe,gu=a,Su=fi,yu=Do,bu=_t,Tu=lu,Iu=hu,Ru=fu,Au=pu.setImmediate,Cu=pu.clearImmediate,Ou=pu.process,Nu=pu.Dispatch,wu=pu.Function,Du=pu.MessageChannel,ku=pu.String,Pu=0,Mu={},Uu="onreadystatechange";try{Zc=pu.location}catch(e){}var Lu=function(e){if(Eu(Mu,e)){var t=Mu[e];delete Mu[e],t()}},xu=function(e){return function(){Lu(e)}},Vu=function(e){Lu(e.data)},Bu=function(e){pu.postMessage(ku(e),Zc.protocol+"//"+Zc.host)};Au&&Cu||(Au=function(e){Tu(arguments.length,1);var t=mu(e)?e:wu(e),r=yu(arguments,1);return Mu[++Pu]=function(){_u(t,void 0,r)},$c(Pu),Pu},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)):pu.addEventListener&&mu(pu.postMessage)&&!pu.importScripts&&Zc&&"file:"!==Zc.protocol&&!gu(Bu)?($c=Bu,pu.addEventListener("message",Vu,!1)):$c=Uu in bu("script")?function(e){Su.appendChild(bu("script")).onreadystatechange=function(){Su.removeChild(this),Lu(e)}}:function(e){setTimeout(xu(e),0)});var ju,Fu,Gu,Hu,zu,Ku,Yu,Xu,Wu={set:Au,clear:Cu},qu=i,Ju=/ipad|iphone|ipod/i.test(W)&&void 0!==qu.Pebble,Zu=/web0s(?!.*chrome)/i.test(W),$u=i,Qu=Yo,ed=o.f,td=Wu.set,rd=hu,nd=Ju,id=Zu,od=fu,ad=$u.MutationObserver||$u.WebKitMutationObserver,sd=$u.document,cd=$u.process,ud=$u.Promise,dd=ed($u,"queueMicrotask"),ld=dd&&dd.value;ld||(ju=function(){var e,t;for(od&&(e=cd.domain)&&e.exit();Fu;){t=Fu.fn,Fu=Fu.next;try{t()}catch(e){throw Fu?Hu():Gu=void 0,e}}Gu=void 0,e&&e.enter()},rd||od||id||!ad||!sd?!nd&&ud&&ud.resolve?((Yu=ud.resolve(void 0)).constructor=ud,Xu=Qu(Yu.then,Yu),Hu=function(){Xu(ju)}):od?Hu=function(){cd.nextTick(ju)}:(td=Qu(td,$u),Hu=function(){td(ju)}):(zu=!0,Ku=sd.createTextNode(""),new ad(ju).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),Fu||(Fu=t,Hu()),Gu=t},fd={},pd=me,_d=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=pd(t),this.reject=pd(r)};fd.f=function(e){return new _d(e)};var vd=Pt,md=G,Ed=fd,gd=function(e,t){if(vd(e),md(t)&&t.constructor===e)return t;var r=Ed.f(e);return(0,r.resolve)(t),r.promise},Sd=i,yd=function(){this.head=null,this.tail=null};yd.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=yd,Cd="object"==typeof window,Od=Xn,Nd=i,wd=Y,Dd=l,kd=tc,Pd=Wt.exports,Md=nc,Ud=ti,Ld=Go,xd=cc,Vd=me,Bd=j,jd=G,Fd=lc,Gd=tr,Hd=Yc,zd=tu,Kd=uu,Yd=Wu.set,Xd=hd,Wd=gd,qd=function(e,t){var r=Sd.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},Jd=fd,Zd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},$d=Ad,Qd=Or,el=Bn,tl=Cd,rl=fu,nl=te,il=Qe("species"),ol="Promise",al=Qd.getterFor(ol),sl=Qd.set,cl=Qd.getterFor(ol),ul=kd&&kd.prototype,dl=kd,ll=ul,hl=Nd.TypeError,fl=Nd.document,pl=Nd.process,_l=Jd.f,vl=_l,ml=!!(fl&&fl.createEvent&&Nd.dispatchEvent),El=Bd(Nd.PromiseRejectionEvent),gl="unhandledrejection",Sl=!1,yl=el(ol,(function(){var e=Gd(dl),t=e!==String(dl);if(!t&&66===nl)return!0;if(nl>=51&&/native code/.test(e))return!1;var r=new dl((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[il]=n,!(Sl=r.then((function(){}))instanceof n)||!t&&tl&&!El})),bl=yl||!zd((function(e){dl.all(e).catch((function(){}))})),Tl=function(e){var t;return!(!jd(e)||!Bd(t=e.then))&&t},Il=function(e,t){var r,n,i,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(),i=!0)),r===e.promise?u(hl("Promise-chain cycle")):(n=Tl(r))?Dd(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},Rl=function(e,t){e.notified||(e.notified=!0,Xd((function(){for(var r,n=e.reactions;r=n.get();)Il(r,e);e.notified=!1,t&&!e.rejection&&Cl(e)})))},Al=function(e,t,r){var n,i;ml?((n=fl.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),Nd.dispatchEvent(n)):n={promise:t,reason:r},!El&&(i=Nd["on"+e])?i(n):e===gl&&qd("Unhandled promise rejection",r)},Cl=function(e){Dd(Yd,Nd,(function(){var t,r=e.facade,n=e.value;if(Ol(e)&&(t=Zd((function(){rl?pl.emit("unhandledRejection",n,r):Al(gl,r,n)})),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?pl.emit("rejectionHandled",t):Al("rejectionhandled",t,e.value)}))},wl=function(e,t,r){return function(n){e(t,n,r)}},Dl=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Rl(e,!0))},kl=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 n=Tl(t);n?Xd((function(){var r={done:!1};try{Dd(n,t,wl(kl,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(yl&&(ll=(dl=function(e){Fd(this,ll),Vd(e),Dd(bd,this);var t=al(this);try{e(wl(kl,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),n=_l(Kd(this,dl));return r.parent=!0,n.ok=!Bd(e)||e,n.fail=Bd(t)&&t,n.domain=rl?pl.domain:void 0,0==r.state?r.reactions.add(n):Xd((function(){Il(n,r)})),n.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(kl,t),this.reject=wl(Dl,t)},Jd.f=_l=function(e){return e===dl||e===Id?new Td(e):vl(e)},Bd(kd)&&ul!==Object.prototype)){Rd=ul.then,Sl||(Pd(ul,"then",(function(e,t){var r=this;return new dl((function(e,t){Dd(Rd,r,e,t)})).then(e,t)}),{unsafe:!0}),Pd(ul,"catch",ll.catch,{unsafe:!0}));try{delete ul.constructor}catch(e){}Ud&&Ud(ul,ll)}Od({global:!0,wrap:!0,forced:yl},{Promise:dl}),Ld(dl,ol,!1),xd(ol),Id=wd(ol),Od({target:ol,stat:!0,forced:yl},{reject:function(e){var t=_l(this);return Dd(t.reject,void 0,e),t.promise}}),Od({target:ol,stat:!0,forced:yl},{resolve:function(e){return Wd(this,e)}}),Od({target:ol,stat:!0,forced:bl},{all:function(e){var t=this,r=_l(t),n=r.resolve,i=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||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise},race:function(e){var t=this,r=_l(t),n=r.reject,i=Zd((function(){var i=Vd(t.resolve);Hd(e,(function(e){Dd(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var Pl=Xn,Ml=s,Ul=i,Ll=I,xl=xe,Vl=j,Bl=X,jl=po,Fl=Ct.f,Gl=wn,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:jl(arguments[0]),t=Bl(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),ql=Ll(zl.valueOf),Jl=/^Symbol\((.*)\)[^)]+$/,Zl=Ll("".replace),$l=Ll("".slice);Fl(zl,"description",{configurable:!0,get:function(){var e=ql(this),t=Wl(e);if(xl(Kl,e))return"";var r=Xl?$l(t,7,-1):Zl(t,Jl,"$1");return""===r?void 0:r}}),Pl({global:!0,forced:!0},{Symbol:Yl})}Vo("iterator");var Ql=Ri,eh=Ct,th=Qe("unscopables"),rh=Array.prototype;null==rh[th]&&eh.f(rh,th,{configurable:!0,value:Ql(null)});var nh,ih,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=i,uh=xe,dh=j,lh=Me,hh=sh,fh=ur("IE_PROTO"),ph=ch.Object,_h=ph.prototype,vh=hh?ph.getPrototypeOf:function(e){var t=lh(e);if(uh(t,fh))return t[fh];var r=t.constructor;return dh(r)&&t instanceof r?r.prototype:t instanceof ph?_h:null},mh=a,Eh=j,gh=vh,Sh=Wt.exports,yh=Qe("iterator"),bh=!1;[].keys&&("next"in(oh=[].keys())?(ih=gh(gh(oh)))!==Object.prototype&&(nh=ih):bh=!0);var Th=null==nh||mh((function(){var e={};return nh[yh].call(e)!==e}));Th&&(nh={}),Eh(nh[yh])||Sh(nh,yh,(function(){return this}));var Ih={IteratorPrototype:nh,BUGGY_SAFARI_ITERATORS:bh},Rh=Ih.IteratorPrototype,Ah=Ri,Ch=E,Oh=Go,Nh=hc,wh=function(){return this},Dh=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Ah(Rh,{next:Ch(+!n,r)}),Oh(e,i,!1),Nh[i]=wh,e},kh=Xn,Ph=l,Mh=Mr,Uh=j,Lh=Dh,xh=vh,Vh=ti,Bh=Go,jh=Xt,Fh=Wt.exports,Gh=hc,Hh=Mh.PROPER,zh=Mh.CONFIGURABLE,Kh=Ih.IteratorPrototype,Yh=Ih.BUGGY_SAFARI_ITERATORS,Xh=Qe("iterator"),Wh="keys",qh="values",Jh="entries",Zh=function(){return this},$h=function(e,t,r,n,i,o,a){Lh(r,t,n);var s,c,u,d=function(e){if(e===i&&_)return _;if(!Yh&&e in f)return f[e];switch(e){case Wh:case qh:case Jh:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[Xh]||f["@@iterator"]||i&&f[i],_=!Yh&&p||d(i),v="Array"==t&&f.entries||p;if(v&&(s=xh(v.call(new e)))!==Object.prototype&&s.next&&(xh(s)!==Kh&&(Vh?Vh(s,Kh):Uh(s[Xh])||Fh(s,Xh,Zh)),Bh(s,l,!0)),Hh&&i==qh&&p&&p.name!==qh&&(zh?jh(f,"name",qh):(h=!0,_=function(){return Ph(p,this)})),i)if(c={values:d(qh),keys:o?_:d(Wh),entries:d(Jh)},a)for(u in c)(Yh||h||!(u in f))&&Fh(f,u,c[u]);else kh({target:t,proto:!0,forced:Yh||h},c);return f[Xh]!==_&&Fh(f,Xh,_,{name:i}),Gh[t]=_,c},Qh=B,ef=ah,tf=hc,rf=Or,nf=Ct.f,of=$h,af=s,sf="Array Iterator",cf=rf.set,uf=rf.getterFor(sf),df=of(Array,"Array",(function(e,t){cf(this,{type:sf,target:Qh(e),index:0,kind:t})}),(function(){var e=uf(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),lf=tf.Arguments=tf.Array;if(ef("keys"),ef("values"),ef("entries"),af&&"values"!==lf.name)try{nf(lf,"name",{value:"values"})}catch(e){}var hf=I,ff=Wr,pf=po,_f=L,vf=hf("".charAt),mf=hf("".charCodeAt),Ef=hf("".slice),gf=function(e){return function(t,r){var n,i,o=pf(_f(t)),a=ff(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=mf(o,a))<55296||n>56319||a+1===s||(i=mf(o,a+1))<56320||i>57343?e?vf(o,a):n:e?Ef(o,a,a+2):i-56320+(n-55296<<10)+65536}},Sf={codeAt:gf(!1),charAt:gf(!0)},yf=Sf.charAt,bf=po,Tf=Or,If=$h,Rf="String Iterator",Af=Tf.set,Cf=Tf.getterFor(Rf);If(String,"String",(function(e){Af(this,{type:Rf,string:bf(e),index:0})}),(function(){var e,t=Cf(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=yf(r,n),t.index+=e.length,{value:e,done:!1})}));var Of={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},Nf=_t("span").classList,wf=Nf&&Nf.constructor&&Nf.constructor.prototype,Df=wf===Object.prototype?void 0:wf,kf=i,Pf=Of,Mf=Df,Uf=df,Lf=Xt,xf=Qe,Vf=xf("iterator"),Bf=xf("toStringTag"),jf=Uf.values,Ff=function(e,t){if(e){if(e[Vf]!==jf)try{Lf(e,Vf,jf)}catch(t){e[Vf]=jf}if(e[Bf]||Lf(e,Bf,t),Pf[t])for(var r in Uf)if(e[r]!==Uf[r])try{Lf(e,r,Uf[r])}catch(t){e[r]=Uf[r]}}};for(var Gf in Pf)Ff(kf[Gf]&&kf[Gf].prototype,Gf);Ff(Mf,"DOMTokenList");var Hf=a,zf=te,Kf=Qe("species"),Yf=function(e){return zf>=51||!Hf((function(){var t=[];return(t.constructor={})[Kf]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Xf=Xn,Wf=i,qf=a,Jf=eo,Zf=G,$f=Me,Qf=nn,ep=go,tp=pa,rp=Yf,np=te,ip=Qe("isConcatSpreadable"),op=9007199254740991,ap="Maximum allowed index exceeded",sp=Wf.TypeError,cp=np>=51||!qf((function(){var e=[];return e[ip]=!1,e.concat()[0]!==e})),up=rp("concat"),dp=function(e){if(!Zf(e))return!1;var t=e[ip];return void 0!==t?!!t:Jf(e)};Xf({target:"Array",proto:!0,forced:!cp||!up},{concat:function(e){var t,r,n,i,o,a=$f(this),s=tp(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(dp(o=-1===t?a:arguments[t])){if(c+(i=Qf(o))>op)throw sp(ap);for(r=0;r<i;r++,c++)r in o&&ep(s,c,o[r])}else{if(c>=op)throw sp(ap);ep(s,c++,o)}return s.length=c,s}});var lp=Xn,hp=i,fp=eo,pp=aa,_p=G,vp=$r,mp=nn,Ep=B,gp=go,Sp=Qe,yp=Do,bp=Yf("slice"),Tp=Sp("species"),Ip=hp.Array,Rp=Math.max;lp({target:"Array",proto:!0,forced:!bp},{slice:function(e,t){var r,n,i,o=Ep(this),a=mp(o),s=vp(e,a),c=vp(void 0===t?a:t,a);if(fp(o)&&(r=o.constructor,(pp(r)&&(r===Ip||fp(r.prototype))||_p(r)&&null===(r=r[Tp]))&&(r=void 0),r===Ip||void 0===r))return yp(o,s,c);for(n=new(void 0===r?Ip:r)(Rp(c-s,0)),i=0;s<c;s++,i++)s in o&&gp(n,i,o[s]);return n.length=i,n}}),Vo("asyncIterator");var Ap=function(e,t){return Ap=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])},Ap(e,t)};function Cp(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}Ap(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Op,Np,wp,Dp,kp,Pp,Mp,Up,Lp,xp,Vp,Bp,jp,Fp,Gp,Hp,zp,Kp=function(){return Kp=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Kp.apply(this,arguments)};function Yp(e,r,n,i){var o,a=arguments.length,s=a<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,n):i;if("object"===("undefined"==typeof Reflect?"undefined":t(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(s=(a<3?o(s):a>3?o(r,n,s):o(r,n))||s);return a>3&&s&&Object.defineProperty(r,n,s),s}function Xp(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function Wp(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[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,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function qp(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Jp(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function Zp(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||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"}(Op||(Op={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(Np||(Np={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(wp||(wp={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(Dp||(Dp={})),function(e){e[e.MUTE_STATE_OFF=0]="MUTE_STATE_OFF",e[e.MUTE_STATE_ON=1]="MUTE_STATE_ON"}(kp||(kp={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(Pp||(Pp={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(Mp||(Mp={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(Up||(Up={})),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"}(Lp||(Lp={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(xp||(xp={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(Vp||(Vp={})),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"}(Bp||(Bp={})),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"}(jp||(jp={})),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"}(Fp||(Fp={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(Gp||(Gp={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(Hp||(Hp={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(zp||(zp={}));var $p,Qp,e_,t_=Object.freeze({__proto__:null,get VideoSourceType(){return Op},get AudioSourceType(){return Np},get ChannelProfile(){return wp},get SubscribeMode(){return Dp},get MuteState(){return kp},get SubscribeState(){return Pp},get PublishState(){return Mp},get MirrorMode(){return Up},get PauseResumeControlMediaType(){return Lp},get VideoRenderMode(){return xp},get StreamIndex(){return Vp},get SubscribeMediaType(){return Bp},get StreamRemoveReason(){return jp},get ConnectionState(){return Fp},get MirrorType(){return Gp},get LogChannel(){return Hp},get USER_ONLINE_STATUS(){return zp}});!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"}($p||($p={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(Qp||(Qp={})),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"}(e_||(e_={}));var r_,n_=Object.freeze({__proto__:null,get AudioMixingDualMonoMode(){return $p},get AudioMixingType(){return Qp},get AudioMixingState(){return e_}});!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.onMediaDeviceStateChanged="onMediaDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",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.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom"}(r_||(r_={}));var i_=ba.forEach,o_=Fi("forEach")?[].forEach:function(e){return i_(this,e,arguments.length>1?arguments[1]:void 0)};Xn({target:"Array",proto:!0,forced:[].forEach!=o_},{forEach:o_});var a_=i,s_=Of,c_=Df,u_=o_,d_=Xt,l_=function(e){if(e&&e.forEach!==u_)try{d_(e,"forEach",u_)}catch(t){e.forEach=u_}};for(var h_ in s_)s_[h_]&&l_(a_[h_]&&a_[h_].prototype);l_(c_);var f_=Xn,p_=I,__=i.Date,v_=p_(__.prototype.getTime);f_({target:"Date",stat:!0},{now:function(){return v_(new __)}});var m_=I,E_=Wt.exports,g_=Date.prototype,S_="Invalid Date",y_="toString",b_=m_(g_.toString),T_=m_(g_.getTime);function I_(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}String(new Date(NaN))!=S_&&E_(g_,y_,(function(){var e=T_(this);return e==e?b_(this):S_}));var R_=Pt,A_=function(){var e=R_(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},C_=a,O_=i.RegExp,N_=C_((function(){var e=O_("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),w_=N_||C_((function(){return!O_("a","y").sticky})),D_={BROKEN_CARET:N_||C_((function(){var e=O_("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:w_,UNSUPPORTED_Y:N_},k_=a,P_=i.RegExp,M_=k_((function(){var e=P_(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),U_=a,L_=i.RegExp,x_=U_((function(){var e=L_("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),V_=l,B_=I,j_=po,F_=A_,G_=D_,H_=Ie.exports,z_=Ri,K_=Or.get,Y_=M_,X_=x_,W_=H_("native-string-replace",String.prototype.replace),q_=RegExp.prototype.exec,J_=q_,Z_=B_("".charAt),$_=B_("".indexOf),Q_=B_("".replace),ev=B_("".slice),tv=function(){var e=/a/,t=/b*/g;return V_(q_,e,"a"),V_(q_,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),rv=G_.BROKEN_CARET,nv=void 0!==/()??/.exec("")[1];(tv||nv||rv||Y_||X_)&&(J_=function(e){var t,r,n,i,o,a,s,c=this,u=K_(c),d=j_(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=V_(J_,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,f=rv&&c.sticky,p=V_(F_,c),_=c.source,v=0,m=d;if(f&&(p=Q_(p,"y",""),-1===$_(p,"g")&&(p+="g"),m=ev(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Z_(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",p)),nv&&(r=new RegExp("^"+_+"$(?!\\s)",p)),tv&&(n=c.lastIndex),i=V_(q_,f?r:c,m),f?i?(i.input=ev(i.input,v),i[0]=ev(i[0],v),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:tv&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),nv&&i&&i.length>1&&V_(W_,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=z_(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var iv=J_;Xn({target:"RegExp",proto:!0,forced:/./.exec!==iv},{exec:iv});var ov=I,av=Wt.exports,sv=iv,cv=a,uv=Qe,dv=Xt,lv=uv("species"),hv=RegExp.prototype,fv=function(e,t,r,n){var i=uv(e),o=!cv((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!cv((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[lv]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=ov(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var a=ov(e),c=t.exec;return c===sv||c===hv.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));av(String.prototype,e,c[0]),av(hv,i,c[1])}n&&dv(hv[i],"sham",!0)},pv=Sf.charAt,_v=function(e,t,r){return t+(r?pv(e,t).length:1)},vv=l,mv=Pt,Ev=j,gv=O,Sv=iv,yv=i.TypeError,bv=function(e,t){var r=e.exec;if(Ev(r)){var n=vv(r,e,t);return null!==n&&mv(n),n}if("RegExp"===gv(e))return vv(Sv,e,t);throw yv("RegExp#exec called on incompatible receiver")},Tv=l,Iv=Pt,Rv=tn,Av=po,Cv=L,Ov=ge,Nv=_v,wv=bv;fv("match",(function(e,t,r){return[function(t){var r=Cv(this),n=null==t?void 0:Ov(t,e);return n?Tv(n,t,r):new RegExp(t)[e](Av(r))},function(e){var n=Iv(this),i=Av(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return wv(n,i);var a=n.unicode;n.lastIndex=0;for(var s,c=[],u=0;null!==(s=wv(n,i));){var d=Av(s[0]);c[u]=d,""===d&&(n.lastIndex=Nv(i,Rv(n.lastIndex),a)),u++}return 0===u?null:c}]}));var Dv="\t\n\v\f\r \u2028\u2029\ufeff",kv=L,Pv=po,Mv=I("".replace),Uv="[\t\n\v\f\r \u2028\u2029\ufeff]",Lv=RegExp("^"+Uv+Uv+"*"),xv=RegExp(Uv+Uv+"*$"),Vv=function(e){return function(t){var r=Pv(kv(t));return 1&e&&(r=Mv(r,Lv,"")),2&e&&(r=Mv(r,xv,"")),r}},Bv={start:Vv(1),end:Vv(2),trim:Vv(3)},jv=i,Fv=a,Gv=I,Hv=po,zv=Bv.trim,Kv=Dv,Yv=jv.parseInt,Xv=jv.Symbol,Wv=Xv&&Xv.iterator,qv=/^[+-]?0x/i,Jv=Gv(qv.exec),Zv=8!==Yv(Kv+"08")||22!==Yv(Kv+"0x16")||Wv&&!Fv((function(){Yv(Object(Wv))}))?function(e,t){var r=zv(Hv(e));return Yv(r,t>>>0||(Jv(qv,r)?16:10))}:Yv;Xn({global:!0,forced:parseInt!=Zv},{parseInt:Zv});var $v={exports:{}},Qv=a((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),em=a,tm=G,rm=O,nm=Qv,im=Object.isExtensible,om=em((function(){im(1)}))||nm?function(e){return!!tm(e)&&((!nm||"ArrayBuffer"!=rm(e))&&(!im||im(e)))}:im,am=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),sm=Xn,cm=I,um=dr,dm=G,lm=xe,hm=Ct.f,fm=Kr,pm=_o,_m=om,vm=am,mm=!1,Em=Ge("meta"),gm=0,Sm=function(e){hm(e,Em,{value:{objectID:"O"+gm++,weakData:{}}})},ym=$v.exports={enable:function(){ym.enable=function(){},mm=!0;var e=fm.f,t=cm([].splice),r={};r[Em]=1,e(r).length&&(fm.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Em){t(n,i,1);break}return n},sm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:pm.f}))},fastKey:function(e,t){if(!dm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!lm(e,Em)){if(!_m(e))return"F";if(!t)return"E";Sm(e)}return e[Em].objectID},getWeakData:function(e,t){if(!lm(e,Em)){if(!_m(e))return!0;if(!t)return!1;Sm(e)}return e[Em].weakData},onFreeze:function(e){return vm&&mm&&_m(e)&&!lm(e,Em)&&Sm(e),e}};um[Em]=!0;var bm=j,Tm=G,Im=ti,Rm=function(e,t,r){var n,i;return Im&&bm(n=t.constructor)&&n!==r&&Tm(i=n.prototype)&&i!==r.prototype&&Im(e,i),e},Am=Xn,Cm=i,Om=I,Nm=Bn,wm=Wt.exports,Dm=$v.exports,km=Yc,Pm=lc,Mm=j,Um=G,Lm=a,xm=tu,Vm=Go,Bm=Rm,jm=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=Cm[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=Om(s[e]);wm(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!Um(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!Um(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!Um(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(Nm(e,!Mm(a)||!(i||s.forEach&&!Lm((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,n,o),Dm.enable();else if(Nm(e,!0)){var l=new c,h=l[o](i?{}:-0,1)!=l,f=Lm((function(){l.has(1)})),p=xm((function(e){new a(e)})),_=!i&&Lm((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((c=t((function(e,t){Pm(e,s);var r=Bm(new a,e,c);return null!=t&&km(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=c),(f||_)&&(d("delete"),d("has"),n&&d("get")),(_||h)&&d(o),i&&s.clear&&delete s.clear}return u[e]=c,Am({global:!0,forced:c!=a},u),Vm(c,e),i||r.setStrong(c,e,n),c},Fm=Ct.f,Gm=Ri,Hm=nc,zm=Yo,Km=lc,Ym=Yc,Xm=$h,Wm=cc,qm=s,Jm=$v.exports.fastKey,Zm=Or.set,$m=Or.getterFor,Qm={getConstructor:function(e,t,r,n){var i=e((function(e,i){Km(e,o),Zm(e,{type:t,index:Gm(null),first:void 0,last:void 0,size:0}),qm||(e.size=0),null!=i&&Ym(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=$m(t),s=function(e,t,r){var n,i,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:i=Jm(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),qm?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=Jm(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Hm(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,qm?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),qm?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=zm(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Hm(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)}}),qm&&Fm(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=$m(t),o=$m(n);Xm(e,t,(function(e,t){Zm(this,{type:n,target:e,state:i(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),Wm(t)}};jm("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Qm);var eE=Me,tE=oi;Xn({target:"Object",stat:!0,forced:a((function(){tE(1)}))},{keys:function(e){return tE(eE(e))}});var rE=me,nE=Me,iE=M,oE=nn,aE=i.TypeError,sE=function(e){return function(t,r,n,i){rE(r);var o=nE(t),a=iE(o),s=oE(o),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw aE("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(i=r(i,a[c],c,o));return i}},cE={left:sE(!1),right:sE(!0)},uE=cE.left,dE=te,lE=fu;Xn({target:"Array",proto:!0,forced:!Fi("reduce")||!lE&&dE>79&&dE<83},{reduce:function(e){var t=arguments.length;return uE(this,e,t,t>1?arguments[1]:void 0)}});var hE,fE=G,pE=O,_E=Qe("match"),vE=function(e){var t;return fE(e)&&(void 0!==(t=e[_E])?!!t:"RegExp"==pE(e))},mE=vE,EE=i.TypeError,gE=function(e){if(mE(e))throw EE("The method doesn't accept regular expressions");return e},SE=Qe("match"),yE=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[SE]=!1,"/./"[e](t)}catch(e){}}return!1},bE=Xn,TE=I,IE=o.f,RE=tn,AE=po,CE=gE,OE=L,NE=yE,wE=TE("".endsWith),DE=TE("".slice),kE=Math.min,PE=NE("endsWith");bE({target:"String",proto:!0,forced:!!(PE||(hE=IE(String.prototype,"endsWith"),!hE||hE.writable))&&!PE},{endsWith:function(e){var t=AE(OE(this));CE(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:kE(RE(r),n),o=AE(e);return wE?wE(t,o,i):DE(t,i-o.length,i)===o}});var ME=!0,UE=!0;function LE(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function xE(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.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 n=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,n])},Object.defineProperty(n,"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 VE(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(ME=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function BE(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(UE=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function jE(){if("object"===("undefined"==typeof window?"undefined":t(window))){if(ME)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function FE(e,t){UE&&console.warn(e+" is deprecated, please use "+t+" instead.")}function GE(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=LE(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=LE(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=LE(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function HE(e){return"[object Object]"===Object.prototype.toString.call(e)}function zE(e){return HE(e)?Object.keys(e).reduce((function(t,r){var n=HE(e[r]),i=n?zE(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,I_({},r,i))}),{}):e}function KE(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?KE(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){KE(e,e.get(t),r)}))})))}function YE(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;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===n&&r.trackId===t.id&&KE(e,r,i)}))})),i}var XE=Xn,WE=ba.find,qE=ah,JE="find",ZE=!0;JE in[]&&Array(1).find((function(){ZE=!1})),XE({target:"Array",proto:!0,forced:ZE},{find:function(e){return WE(this,e,arguments.length>1?arguments[1]:void 0)}}),qE(JE);var $E=Xn,QE=i,eg=$r,tg=Wr,rg=nn,ng=Me,ig=pa,og=go,ag=Yf("splice"),sg=QE.TypeError,cg=Math.max,ug=Math.min,dg=9007199254740991,lg="Maximum allowed length exceeded";$E({target:"Array",proto:!0,forced:!ag},{splice:function(e,t){var r,n,i,o,a,s,c=ng(this),u=rg(c),d=eg(e,u),l=arguments.length;if(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=ug(cg(tg(t),0),u-d)),u+r-n>dg)throw sg(lg);for(i=ig(c,n),o=0;o<n;o++)(a=d+o)in c&&og(i,o,c[a]);if(i.length=n,r<n){for(o=d;o<u-n;o++)s=o+r,(a=o+n)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-n+r;o--)delete c[o-1]}else if(r>n)for(o=u-n;o>d;o--)s=o+r-1,(a=o+n-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-n+r,i}});var hg=ba.map;Xn({target:"Array",proto:!0,forced:!Yf("map")},{map:function(e){return hg(this,e,arguments.length>1?arguments[1]:void 0)}});var fg=ba.filter;Xn({target:"Array",proto:!0,forced:!Yf("filter")},{filter:function(e){return fg(this,e,arguments.length>1?arguments[1]:void 0)}});var pg=I,_g=Me,vg=Math.floor,mg=pg("".charAt),Eg=pg("".replace),gg=pg("".slice),Sg=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,yg=/\$([$&'`]|\d{1,2})/g,bg=$i,Tg=l,Ig=I,Rg=fv,Ag=a,Cg=Pt,Og=j,Ng=Wr,wg=tn,Dg=po,kg=L,Pg=_v,Mg=ge,Ug=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,c=yg;return void 0!==i&&(i=_g(i),c=Sg),Eg(o,c,(function(o,c){var u;switch(mg(c,0)){case"$":return"$";case"&":return e;case"`":return gg(t,0,r);case"'":return gg(t,a);case"<":u=i[gg(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=vg(d/10);return 0===l?o:l<=s?void 0===n[l-1]?mg(c,1):n[l-1]+mg(c,1):o}u=n[d-1]}return void 0===u?"":u}))},Lg=bv,xg=Qe("replace"),Vg=Math.max,Bg=Math.min,jg=Ig([].concat),Fg=Ig([].push),Gg=Ig("".indexOf),Hg=Ig("".slice),zg="$0"==="a".replace(/./,"$0"),Kg=!!/./[xg]&&""===/./[xg]("a","$0");Rg("replace",(function(e,t,r){var n=Kg?"$":"$0";return[function(e,r){var n=kg(this),i=null==e?void 0:Mg(e,xg);return i?Tg(i,e,n,r):Tg(t,Dg(n),e,r)},function(e,i){var o=Cg(this),a=Dg(e);if("string"==typeof i&&-1===Gg(i,n)&&-1===Gg(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var c=Og(i);c||(i=Dg(i));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=Lg(o,a);if(null===h)break;if(Fg(l,h),!u)break;""===Dg(h[0])&&(o.lastIndex=Pg(a,wg(o.lastIndex),d))}for(var f,p="",_=0,v=0;v<l.length;v++){for(var m=Dg((h=l[v])[0]),E=Vg(Bg(Ng(h.index),a.length),0),g=[],S=1;S<h.length;S++)Fg(g,void 0===(f=h[S])?f:String(f));var y=h.groups;if(c){var b=jg([m],g,E,a);void 0!==y&&Fg(b,y);var T=Dg(bg(i,void 0,b))}else T=Ug(m,a,E,g,y,i);E>=_&&(p+=Hg(a,_,E)+T,_=E+m.length)}return p+Hg(a,_)}]}),!!Ag((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!zg||Kg);var Yg=s,Xg=i,Wg=I,qg=Bn,Jg=Rm,Zg=Xt,$g=Ct.f,Qg=Kr.f,eS=X,tS=vE,rS=po,nS=A_,iS=D_,oS=Wt.exports,aS=a,sS=xe,cS=Or.enforce,uS=cc,dS=M_,lS=x_,hS=Qe("match"),fS=Xg.RegExp,pS=fS.prototype,_S=Xg.SyntaxError,vS=Wg(nS),mS=Wg(pS.exec),ES=Wg("".charAt),gS=Wg("".replace),SS=Wg("".indexOf),yS=Wg("".slice),bS=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,TS=/a/g,IS=/a/g,RS=new fS(TS)!==TS,AS=iS.MISSED_STICKY,CS=iS.UNSUPPORTED_Y,OS=Yg&&(!RS||AS||dS||lS||aS((function(){return IS[hS]=!1,fS(TS)!=TS||fS(IS)==IS||"/a/i"!=fS(TS,"i")})));if(qg("RegExp",OS)){for(var NS=function(e,t){var r,n,i,o,a,s,c=eS(pS,this),u=tS(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===NS)return e;if((u||eS(pS,e))&&(e=e.source,d&&(t="flags"in h?h.flags:vS(h))),e=void 0===e?"":rS(e),t=void 0===t?"":rS(t),h=e,dS&&"dotAll"in TS&&(n=!!t&&SS(t,"s")>-1)&&(t=gS(t,/s/g,"")),r=t,AS&&"sticky"in TS&&(i=!!t&&SS(t,"y")>-1)&&CS&&(t=gS(t,/y/g,"")),lS&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,c=!1,u=0,d="";n<=r;n++){if("\\"===(t=ES(e,n)))t+=ES(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:mS(bS,yS(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||sS(a,d))throw new _S("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=Jg(fS(e,t),c?this:pS,NS),(n||i||l.length)&&(s=cS(a),n&&(s.dotAll=!0,s.raw=NS(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=ES(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+ES(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{Zg(a,"source",""===h?"(?:)":h)}catch(e){}return a},wS=function(e){e in NS||$g(NS,e,{configurable:!0,get:function(){return fS[e]},set:function(t){fS[e]=t}})},DS=Qg(fS),kS=0;DS.length>kS;)wS(DS[kS++]);pS.constructor=NS,NS.prototype=pS,oS(Xg,"RegExp",NS)}uS("RegExp");var PS=I,MS=Mr.PROPER,US=Wt.exports,LS=Pt,xS=X,VS=po,BS=a,jS=A_,FS="toString",GS=RegExp.prototype,HS=GS.toString,zS=PS(jS),KS=BS((function(){return"/a/b"!=HS.call({source:"a",flags:"b"})})),YS=MS&&HS.name!=FS;(KS||YS)&&US(RegExp.prototype,FS,(function(){var e=LS(this),t=VS(e.source),r=e.flags;return"/"+t+"/"+VS(void 0===r&&xS(GS,e)&&!("flags"in GS)?zS(e):r)}),{unsafe:!0});var XS=ba.some;Xn({target:"Array",proto:!0,forced:!Fi("some")},{some:function(e){return XS(this,e,arguments.length>1?arguments[1]:void 0)}});var WS=un.includes,qS=ah;Xn({target:"Array",proto:!0},{includes:function(e){return WS(this,e,arguments.length>1?arguments[1]:void 0)}}),qS("includes");var JS=Xn,ZS=gE,$S=L,QS=po,ey=yE,ty=I("".indexOf);JS({target:"String",proto:!0,forced:!ey("includes")},{includes:function(e){return!!~ty(QS($S(this)),QS(ZS(e)),arguments.length>1?arguments[1]:void 0)}});var ry=s,ny=Mr.EXISTS,iy=I,oy=Ct.f,ay=Function.prototype,sy=iy(ay.toString),cy=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,uy=iy(cy.exec);ry&&!ny&&oy(ay,"name",{configurable:!0,get:function(){try{return uy(cy,sy(this))[1]}catch(e){return""}}});var dy=I,ly=me,hy=G,fy=xe,py=Do,_y=c,vy=i.Function,my=dy([].concat),Ey=dy([].join),gy={},Sy=function(e,t,r){if(!fy(gy,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";gy[t]=vy("C,a","return new C("+Ey(n,",")+")")}return gy[t](e,r)},yy=_y?vy.bind:function(e){var t=ly(this),r=t.prototype,n=py(arguments,1),i=function(){var r=my(n,py(arguments));return this instanceof i?Sy(t,r.length,r):t.apply(e,r)};return hy(r)&&(i.prototype=r),i},by=yy;Xn({target:"Function",proto:!0,forced:Function.bind!==by},{bind:by});var Ty=jE;function Iy(e,r){var n=e&&e.navigator;if(n.mediaDevices){var i=function(e){if("object"!==t(e)||e.mandatory||e.optional)return e;var r={};return Object.keys(e).forEach((function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var i="object"===t(e[n])?e[n]:{ideal:e[n]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){r.optional=r.optional||[];var a={};"number"==typeof i.ideal?(a[o("min",n)]=i.ideal,r.optional.push(a),(a={})[o("max",n)]=i.ideal,r.optional.push(a)):(a[o("",n)]=i.ideal,r.optional.push(a))}void 0!==i.exact&&"number"!=typeof i.exact?(r.mandatory=r.mandatory||{},r.mandatory[o("",n)]=i.exact):["min","max"].forEach((function(e){void 0!==i[e]&&(r.mandatory=r.mandatory||{},r.mandatory[o(e,n)]=i[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=i(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)&&(!n.mediaDevices.getSupportedConstraints||!n.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 n.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=i(e.video),Ty("chrome: "+JSON.stringify(e)),o(e)}));e.video=i(e.video)}return Ty("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(n.getUserMedia=function(e,t,r){o(e,(function(e){n.webkitGetUserMedia(e,t,(function(e){r&&r(a(e))}))}))}.bind(n),n.mediaDevices.getUserMedia){var s=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.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 Ry(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ay(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(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===n.track.id})):{track:n.track};var o=new Event("track");o.track=n.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[r.stream],t.dispatchEvent(o)})),r.stream.getTracks().forEach((function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===n.id})):{track:n};var o=new Event("track");o.track=n,o.receiver=i,o.transceiver={receiver:i},o.streams=[r.stream],t.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),r.apply(this,arguments)}}else xE(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Cy(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 n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,t){var i=n.apply(this,arguments);return i||(i=r(this,e),this._senders.push(i)),i};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.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 Oy(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),n=r[0],i=r[1],o=r[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))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){i(s(a(e)))};return t.apply(this,[c,n])}return new Promise((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function Ny(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 n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return YE(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var i=e.RTCPeerConnection.prototype.getReceivers;i&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),xE(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 YE(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,n,i=arguments[0];return this.getSenders().forEach((function(e){e.track===i&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===i&&(r?n=!0:r=e),e.track===i})),n||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 wy(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 n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};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 n=this.getSenders();r.apply(this,arguments);var i=this.getSenders().filter((function(e){return-1===n.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(i)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=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 n=t._shimmedLocalStreams[r].indexOf(e);-1!==n&&t._shimmedLocalStreams[r].splice(n,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function Dy(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return wy(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 n=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 i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.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 n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[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(){n.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],n=I_({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},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]=n[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(n){r._streams[n].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[n])})),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 n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.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 n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function ky(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],n=I_({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}))}function Py(e,t){xE(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 My=Object.freeze({__proto__:null,shimMediaStream:Ry,shimOnTrack:Ay,shimGetSendersWithDtmf:Cy,shimGetStats:Oy,shimSenderReceiverGetStats:Ny,shimAddTrackRemoveTrackWithNative:wy,shimAddTrackRemoveTrack:Dy,shimPeerConnection:ky,fixNegotiationNeeded:Py,shimGetUserMedia:Iy,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 n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),Uy=i,Ly=a,xy=po,Vy=Bv.trim,By=I("".charAt),jy=Uy.parseFloat,Fy=Uy.Symbol,Gy=Fy&&Fy.iterator,Hy=1/jy("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||Gy&&!Ly((function(){jy(Object(Gy))}))?function(e){var t=Vy(xy(e)),r=jy(t);return 0===r&&"-"==By(t,0)?-0:r}:jy;Xn({global:!0,forced:parseFloat!=Hy},{parseFloat:Hy});var zy=Xn,Ky=tc,Yy=a,Xy=Y,Wy=j,qy=uu,Jy=gd,Zy=Wt.exports;if(zy({target:"Promise",proto:!0,real:!0,forced:!!Ky&&Yy((function(){Ky.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=qy(this,Xy("Promise")),r=Wy(e);return this.then(r?function(r){return Jy(t,e()).then((function(){return r}))}:e,r?function(r){return Jy(t,e()).then((function(){throw r}))}:e)}}),Wy(Ky)){var $y=Xy("Promise").prototype.finally;Ky.prototype.finally!==$y&&Zy(Ky.prototype,"finally",$y,{unsafe:!0})}function Qy(e,r){var n=e&&e.navigator,i=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){FE("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(r.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},a=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.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)},i&&i.prototype.getSettings){var s=i.prototype.getSettings;i.prototype.getSettings=function(){var e=s.apply(this,arguments);return o(e,"mozAutoGainControl","autoGainControl"),o(e,"mozNoiseSuppression","noiseSuppression"),e}}if(i&&i.prototype.applyConstraints){var c=i.prototype.applyConstraints;i.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 eb(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 tb(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],n=I_({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}));var n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=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 i.apply(this,[t||null]).then((function(e){if(r.version<53&&!o)try{e.forEach((function(e){e.type=n[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,r){e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))}))}return e})).then(o,a)}}}function rb(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 n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.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 nb(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}),xE(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function ib(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;FE("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function ob(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function ab(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 n=r.apply(this,arguments);if(t){var i=n.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,i.sendEncodings=e.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function sb(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 cb(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 ub(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 db=Object.freeze({__proto__:null,shimOnTrack:eb,shimPeerConnection:tb,shimSenderGetStats:rb,shimReceiverGetStats:nb,shimRemoveStream:ib,shimRTCDataChannel:ob,shimAddTransceiver:ab,shimGetParameters:sb,shimCreateOffer:cb,shimCreateAnswer:ub,shimGetUserMedia:Qy,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 n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function lb(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(n){return r.call(t,n,e)})),e.getVideoTracks().forEach((function(n){return r.call(t,n,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var t=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return i&&i.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 n=e.getTracks();this.getSenders().forEach((function(e){n.includes(e.track)&&t.removeTrack(e)}))}})}}function hb(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 fb(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,n=r.createOffer,i=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],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},r.createAnswer=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};var c=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};r.setLocalDescription=c,c=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},r.setRemoteDescription=c,c=function(e,t,r){var n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},r.addIceCandidate=c}}function pb(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return n(_b(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function _b(e){return e&&void 0!==e.video?Object.assign({},e,{video:zE(e.video)}):e}function vb(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(FE("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function mb(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 Eb(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 n=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function gb(e){"object"!==t(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Sb=Object.freeze({__proto__:null,shimLocalStreamsAPI:lb,shimRemoteStreamsAPI:hb,shimCallbacksAPI:fb,shimGetUserMedia:pb,shimConstraints:_b,shimRTCIceServerUrls:vb,shimTrackEventTransceiver:mb,shimCreateOfferLegacy:Eb,shimAudioContext:gb}),yb=Me,bb=ct;Xn({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=yb(this),r=bb(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}});var Tb=l;Xn({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Tb(URL.prototype.toString,this)}});var Ib=I(1..valueOf),Rb=s,Ab=i,Cb=I,Ob=Bn,Nb=Wt.exports,wb=xe,Db=Rm,kb=X,Pb=le,Mb=ct,Ub=a,Lb=Kr.f,xb=o.f,Vb=Ct.f,Bb=Ib,jb=Bv.trim,Fb="Number",Gb=Ab.Number,Hb=Gb.prototype,zb=Ab.TypeError,Kb=Cb("".slice),Yb=Cb("".charCodeAt),Xb=function(e){var t=Mb(e,"number");return"bigint"==typeof t?t:Wb(t)},Wb=function(e){var t,r,n,i,o,a,s,c,u=Mb(e,"number");if(Pb(u))throw zb("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=jb(u),43===(t=Yb(u,0))||45===t){if(88===(r=Yb(u,2))||120===r)return NaN}else if(48===t){switch(Yb(u,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+u}for(a=(o=Kb(u,2)).length,s=0;s<a;s++)if((c=Yb(o,s))<48||c>i)return NaN;return parseInt(o,n)}return+u};if(Ob(Fb,!Gb(" 0o1")||!Gb("0b1")||Gb("+0x1"))){for(var qb,Jb=function(e){var t=arguments.length<1?0:Gb(Xb(e)),r=this;return kb(Hb,r)&&Ub((function(){Bb(r)}))?Db(Object(t),r,Jb):t},Zb=Rb?Lb(Gb):"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(","),$b=0;Zb.length>$b;$b++)wb(Gb,qb=Zb[$b])&&!wb(Jb,qb)&&Vb(Jb,qb,xb(Gb,qb));Jb.prototype=Hb,Hb.constructor=Jb,Nb(Ab,Fb,Jb)}var Qb=Xn,eT=M,tT=B,rT=Fi,nT=I([].join),iT=eT!=Object,oT=rT("join",",");Qb({target:"Array",proto:!0,forced:iT||!oT},{join:function(e){return nT(tT(this),void 0===e?",":e)}});var aT=$i,sT=l,cT=I,uT=fv,dT=vE,lT=Pt,hT=L,fT=uu,pT=_v,_T=tn,vT=po,mT=ge,ET=Ro,gT=bv,ST=iv,yT=a,bT=D_.UNSUPPORTED_Y,TT=4294967295,IT=Math.min,RT=[].push,AT=cT(/./.exec),CT=cT(RT),OT=cT("".slice),NT=!yT((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]}));uT("split",(function(e,t,r){var n;return n="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 n=vT(hT(this)),i=void 0===r?TT:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!dT(e))return sT(t,n,e,i);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=sT(ST,l,n))&&!((a=l.lastIndex)>d&&(CT(c,OT(n,d,o.index)),o.length>1&&o.index<n.length&&aT(RT,c,ET(o,1)),s=o[0].length,d=a,c.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&AT(l,"")||CT(c,""):CT(c,OT(n,d)),c.length>i?ET(c,0,i):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:sT(t,this,e,r)}:t,[function(t,r){var i=hT(this),o=null==t?void 0:mT(t,e);return o?sT(o,t,i,r):sT(n,vT(i),t,r)},function(e,i){var o=lT(this),a=vT(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var c=fT(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(bT?"g":"y"),l=new c(bT?"^(?:"+o.source+")":o,d),h=void 0===i?TT:i>>>0;if(0===h)return[];if(0===a.length)return null===gT(l,a)?[a]:[];for(var f=0,p=0,_=[];p<a.length;){l.lastIndex=bT?0:p;var v,m=gT(l,bT?OT(a,p):a);if(null===m||(v=IT(_T(l.lastIndex+(bT?p:0)),a.length))===f)p=pT(a,p,u);else{if(CT(_,OT(a,f,p)),_.length===h)return _;for(var E=1;E<=m.length-1;E++)if(CT(_,m[E]),_.length===h)return _;p=f=v}}return CT(_,OT(a,f)),_}]}),!NT,bT);var wT=Mr.PROPER,DT=a,kT=Dv,PT=Bv.trim;Xn({target:"String",proto:!0,forced:function(e){return DT((function(){return!!kT[e]()||"
"!=="
"[e]()||wT&&kT[e].name!==e}))}("trim")},{trim:function(){return PT(this)}});var MT={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]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+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 n=e.type;return t.push("typ"),t.push(n),"host"!==n&&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={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].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 n=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.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)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+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 n=r.matchPrefix(e+t,"a=ice-ufrag:")[0],i=r.matchPrefix(e+t,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.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:[]},n=r.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],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 n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=t.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){n+=r.writeRtpMap(e),n+=r.writeFmtp(e),n+=r.writeRtcpFb(e)}));var i=0;return t.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){n+=r.writeExtmap(e)})),n},r.parseRtpEncodingParameters=function(e){var t,n=[],i=r.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.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]),i.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}),n.push(r),o&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(r))}})),0===n.length&&c&&n.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,n.forEach((function(e){e.maxBitrate=d}))),n},r.parseRtcpParameters=function(e){var t={},n=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);var i=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=i.length>0,t.compound=0===i.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,n=r.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(t=n[0].substr(7).split(" "))[0],track:t[1]};var i=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(t=i[0].value.split(" "))[0],track:t[1]}:void 0},r.parseSctpDescription=function(e){var t,n=r.parseMLine(e),i=r.matchPrefix(e,"a=max-message-size:");i.length>0&&(t=parseInt(i[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:n.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,n){var i=void 0!==t?t:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||r.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.getDirection=function(e,t){for(var n=r.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].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),n=0;n<t.length;n++)if(t[n].length<2||"="!==t[n].charAt(1))return!1;return!0},e.exports=r}(MT);var UT=MT.exports,LT=Object.freeze(e({__proto__:null,default:UT},[MT.exports]));function xT(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 n=new r(e),i=UT.parseCandidate(e.candidate),o=Object.assign(n,i);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,xE(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function VT(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=UT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=UT.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=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},i=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 n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=UT.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},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=n(arguments[0]),d=i(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 BT(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},xE(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function jT(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 FT(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 n=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:n}):t.sdp=n}return r.apply(this,arguments)}}}function GT(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 HT(e,r){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var n=e.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,r=arguments[0]||{};if("object"!==t(r)||r.type&&r.sdp)return n.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 n.apply(this,[r]);var i="offer"===r.type?this.createOffer:this.createAnswer;return i.apply(this).then((function(t){return n.apply(e,[t])}))})}}var zT=Object.freeze({__proto__:null,shimRTCIceCandidate:xT,shimMaxMessageSize:VT,shimSendThrowTypeError:BT,shimConnectionState:jT,removeExtmapAllowMixed:FT,shimAddIceCandidateNullOrEmpty:GT,shimParameterlessSetLocalDescription:HT});!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},n=jE,i=GE(t),o={browserDetails:i,commonShim:zT,extractVersion:LE,disableLog:VE,disableWarnings:BE,sdp:LT};switch(i.browser){case"chrome":if(!My||!ky||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),o;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),o;n("adapter.js shimming chrome."),o.browserShim=My,GT(t,i),HT(t),Iy(t,i),Ry(t),ky(t,i),Ay(t),Dy(t,i),Cy(t),Oy(t),Ny(t),Py(t,i),xT(t),jT(t),VT(t,i),BT(t),FT(t,i);break;case"firefox":if(!db||!tb||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=db,GT(t,i),HT(t),Qy(t,i),tb(t,i),eb(t),ib(t),rb(t),nb(t),ob(t),ab(t),sb(t),cb(t),ub(t),xT(t),jT(t),VT(t,i),BT(t);break;case"safari":if(!Sb||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=Sb,GT(t,i),HT(t),vb(t),Eb(t),fb(t),lb(t),hb(t),mb(t),pb(t),gb(t),xT(t),VT(t,i),BT(t),FT(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),Xn({target:"Array",stat:!0},{isArray:eo});var KT=Ro,YT=Math.floor,XT=function(e,t){var r=e.length,n=YT(r/2);return r<8?WT(e,t):qT(e,XT(KT(e,0,n),t),XT(KT(e,n),t),t)},WT=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},qT=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},JT=XT,ZT=W.match(/firefox\/(\d+)/i),$T=!!ZT&&+ZT[1],QT=/MSIE|Trident/.test(W),eI=W.match(/AppleWebKit\/(\d+)\./),tI=!!eI&&+eI[1],rI=Xn,nI=I,iI=me,oI=Me,aI=nn,sI=po,cI=a,uI=JT,dI=Fi,lI=$T,hI=QT,fI=te,pI=tI,_I=[],vI=nI(_I.sort),mI=nI(_I.push),EI=cI((function(){_I.sort(void 0)})),gI=cI((function(){_I.sort(null)})),SI=dI("sort"),yI=!cI((function(){if(fI)return fI<70;if(!(lI&&lI>3)){if(hI)return!0;if(pI)return pI<603;var e,t,r,n,i="";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(n=0;n<47;n++)_I.push({k:t+n,v:r})}for(_I.sort((function(e,t){return t.v-e.v})),n=0;n<_I.length;n++)t=_I[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));rI({target:"Array",proto:!0,forced:EI||!gI||!SI||!yI},{sort:function(e){void 0!==e&&iI(e);var t=oI(this);if(yI)return void 0===e?vI(t):vI(t,e);var r,n,i=[],o=aI(t);for(n=0;n<o;n++)n in t&&mI(i,t[n]);for(uI(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:sI(t)>sI(r)?1:-1}}(e)),r=i.length,n=0;n<r;)t[n]=i[n++];for(;n<o;)delete t[n++];return t}});var bI="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,TI=Wr,II=tn,RI=i.RangeError,AI=function(e){if(void 0===e)return 0;var t=TI(e),r=II(t);if(t!==r)throw RI("Wrong length or index");return r},CI=i.Array,OI=Math.abs,NI=Math.pow,wI=Math.floor,DI=Math.log,kI=Math.LN2,PI={pack:function(e,t,r){var n,i,o,a=CI(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?NI(2,-24)-NI(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=OI(e))!=e||e===1/0?(i=e!=e?1:0,n=c):(n=wI(DI(e)/kI),e*(o=NI(2,-n))<1&&(n--,o*=2),(e+=n+u>=1?d/o:d*NI(2,1-u))*o>=2&&(n++,o/=2),n+u>=c?(i=0,n=c):n+u>=1?(i=(e*o-1)*NI(2,t),n+=u):(i=e*NI(2,u-1)*NI(2,t),n=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[h++]=255&n,n/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,n=e.length,i=8*n-t-1,o=(1<<i)-1,a=o>>1,s=i-7,c=n-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+=NI(2,t),d-=a}return(u?-1:1)*r*NI(2,d-t)}},MI=Me,UI=$r,LI=nn,xI=function(e){for(var t=MI(this),r=LI(t),n=arguments.length,i=UI(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:UI(o,r);a>i;)t[i++]=e;return t},VI=i,BI=I,jI=s,FI=bI,GI=Mr,HI=Xt,zI=nc,KI=a,YI=lc,XI=Wr,WI=tn,qI=AI,JI=PI,ZI=vh,$I=ti,QI=Kr.f,eR=Ct.f,tR=xI,rR=Ro,nR=Go,iR=GI.PROPER,oR=GI.CONFIGURABLE,aR=Or.get,sR=Or.set,cR="ArrayBuffer",uR="DataView",dR="Wrong index",lR=VI.ArrayBuffer,hR=lR,fR=hR&&hR.prototype,pR=VI.DataView,_R=pR&&pR.prototype,vR=Object.prototype,mR=VI.Array,ER=VI.RangeError,gR=BI(tR),SR=BI([].reverse),yR=JI.pack,bR=JI.unpack,TR=function(e){return[255&e]},IR=function(e){return[255&e,e>>8&255]},RR=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},AR=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},CR=function(e){return yR(e,23,4)},OR=function(e){return yR(e,52,8)},NR=function(e,t){eR(e.prototype,t,{get:function(){return aR(this)[t]}})},wR=function(e,t,r,n){var i=qI(r),o=aR(e);if(i+t>o.byteLength)throw ER(dR);var a=aR(o.buffer).bytes,s=i+o.byteOffset,c=rR(a,s,s+t);return n?c:SR(c)},DR=function(e,t,r,n,i,o){var a=qI(r),s=aR(e);if(a+t>s.byteLength)throw ER(dR);for(var c=aR(s.buffer).bytes,u=a+s.byteOffset,d=n(+i),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(FI){var kR=iR&&lR.name!==cR;if(KI((function(){lR(1)}))&&KI((function(){new lR(-1)}))&&!KI((function(){return new lR,new lR(1.5),new lR(NaN),kR&&!oR})))kR&&oR&&HI(lR,"name",cR);else{(hR=function(e){return YI(this,fR),new lR(qI(e))}).prototype=fR;for(var PR,MR=QI(lR),UR=0;MR.length>UR;)(PR=MR[UR++])in hR||HI(hR,PR,lR[PR]);fR.constructor=hR}$I&&ZI(_R)!==vR&&$I(_R,vR);var LR=new pR(new hR(2)),xR=BI(_R.setInt8);LR.setInt8(0,2147483648),LR.setInt8(1,2147483649),!LR.getInt8(0)&&LR.getInt8(1)||zI(_R,{setInt8:function(e,t){xR(this,e,t<<24>>24)},setUint8:function(e,t){xR(this,e,t<<24>>24)}},{unsafe:!0})}else fR=(hR=function(e){YI(this,fR);var t=qI(e);sR(this,{bytes:gR(mR(t),0),byteLength:t}),jI||(this.byteLength=t)}).prototype,_R=(pR=function(e,t,r){YI(this,_R),YI(e,fR);var n=aR(e).byteLength,i=XI(t);if(i<0||i>n)throw ER("Wrong offset");if(i+(r=void 0===r?n-i:WI(r))>n)throw ER("Wrong length");sR(this,{buffer:e,byteLength:r,byteOffset:i}),jI||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,jI&&(NR(hR,"byteLength"),NR(pR,"buffer"),NR(pR,"byteLength"),NR(pR,"byteOffset")),zI(_R,{getInt8:function(e){return wR(this,1,e)[0]<<24>>24},getUint8:function(e){return wR(this,1,e)[0]},getInt16:function(e){var t=wR(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=wR(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return AR(wR(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return AR(wR(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return bR(wR(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return bR(wR(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){DR(this,1,e,TR,t)},setUint8:function(e,t){DR(this,1,e,TR,t)},setInt16:function(e,t){DR(this,2,e,IR,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){DR(this,2,e,IR,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){DR(this,4,e,RR,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){DR(this,4,e,RR,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){DR(this,4,e,CR,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){DR(this,8,e,OR,t,arguments.length>2?arguments[2]:void 0)}});nR(hR,cR),nR(pR,uR);var VR={ArrayBuffer:hR,DataView:pR},BR=Xn,jR=I,FR=a,GR=Pt,HR=$r,zR=tn,KR=uu,YR=VR.ArrayBuffer,XR=VR.DataView,WR=XR.prototype,qR=jR(YR.prototype.slice),JR=jR(WR.getUint8),ZR=jR(WR.setUint8);BR({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:FR((function(){return!new YR(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(qR&&void 0===t)return qR(GR(this),e);for(var r=GR(this).byteLength,n=HR(e,r),i=HR(void 0===t?r:t,r),o=new(KR(this,YR))(zR(i-n)),a=new XR(this),s=new XR(o),c=0;n<i;)ZR(s,c++,JR(a,n++));return o}});var $R,QR,eA,tA={exports:{}},rA=bI,nA=s,iA=i,oA=j,aA=G,sA=xe,cA=lo,uA=fe,dA=Xt,lA=Wt.exports,hA=Ct.f,fA=X,pA=vh,_A=ti,vA=Qe,mA=Ge,EA=iA.Int8Array,gA=EA&&EA.prototype,SA=iA.Uint8ClampedArray,yA=SA&&SA.prototype,bA=EA&&pA(EA),TA=gA&&pA(gA),IA=Object.prototype,RA=iA.TypeError,AA=vA("toStringTag"),CA=mA("TYPED_ARRAY_TAG"),OA=mA("TYPED_ARRAY_CONSTRUCTOR"),NA=rA&&!!_A&&"Opera"!==cA(iA.opera),wA=!1,DA={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},kA={BigInt64Array:8,BigUint64Array:8},PA=function(e){if(!aA(e))return!1;var t=cA(e);return sA(DA,t)||sA(kA,t)};for($R in DA)(eA=(QR=iA[$R])&&QR.prototype)?dA(eA,OA,QR):NA=!1;for($R in kA)(eA=(QR=iA[$R])&&QR.prototype)&&dA(eA,OA,QR);if((!NA||!oA(bA)||bA===Function.prototype)&&(bA=function(){throw RA("Incorrect invocation")},NA))for($R in DA)iA[$R]&&_A(iA[$R],bA);if((!NA||!TA||TA===IA)&&(TA=bA.prototype,NA))for($R in DA)iA[$R]&&_A(iA[$R].prototype,TA);if(NA&&pA(yA)!==TA&&_A(yA,TA),nA&&!sA(TA,AA))for($R in wA=!0,hA(TA,AA,{get:function(){return aA(this)?this[CA]:void 0}}),DA)iA[$R]&&dA(iA[$R],CA,$R);var MA={NATIVE_ARRAY_BUFFER_VIEWS:NA,TYPED_ARRAY_CONSTRUCTOR:OA,TYPED_ARRAY_TAG:wA&&CA,aTypedArray:function(e){if(PA(e))return e;throw RA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(oA(e)&&(!_A||fA(bA,e)))return e;throw RA(uA(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(nA){if(r)for(var i in DA){var o=iA[i];if(o&&sA(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}TA[e]&&!r||lA(TA,e,r?t:NA&&gA[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(nA){if(_A){if(r)for(n in DA)if((i=iA[n])&&sA(i,e))try{delete i[e]}catch(e){}if(bA[e]&&!r)return;try{return lA(bA,e,r?t:NA&&bA[e]||t)}catch(e){}}for(n in DA)!(i=iA[n])||i[e]&&!r||lA(i,e,t)}},isView:function(e){if(!aA(e))return!1;var t=cA(e);return"DataView"===t||sA(DA,t)||sA(kA,t)},isTypedArray:PA,TypedArray:bA,TypedArrayPrototype:TA},UA=i,LA=a,xA=tu,VA=MA.NATIVE_ARRAY_BUFFER_VIEWS,BA=UA.ArrayBuffer,jA=UA.Int8Array,FA=!VA||!LA((function(){jA(1)}))||!LA((function(){new jA(-1)}))||!xA((function(e){new jA,new jA(null),new jA(1.5),new jA(e)}),!0)||LA((function(){return 1!==new jA(new BA(2),1,void 0).length})),GA=G,HA=Math.floor,zA=Number.isInteger||function(e){return!GA(e)&&isFinite(e)&&HA(e)===e},KA=Wr,YA=i.RangeError,XA=function(e){var t=KA(e);if(t<0)throw YA("The argument can't be less than 0");return t},WA=i.RangeError,qA=function(e,t){var r=XA(e);if(r%t)throw WA("Wrong offset");return r},JA=Yo,ZA=l,$A=ou,QA=Me,eC=nn,tC=Oc,rC=yc,nC=vc,iC=MA.aTypedArrayConstructor,oC=Xn,aC=i,sC=l,cC=s,uC=FA,dC=MA,lC=VR,hC=lc,fC=E,pC=Xt,_C=zA,vC=tn,mC=AI,EC=qA,gC=lt,SC=xe,yC=lo,bC=G,TC=le,IC=Ri,RC=X,AC=ti,CC=Kr.f,OC=function(e){var t,r,n,i,o,a,s=$A(this),c=QA(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=rC(c);if(h&&!nC(h))for(a=(o=tC(c,h)).next,c=[];!(i=ZA(a,o)).done;)c.push(i.value);for(l&&u>2&&(d=JA(d,arguments[2])),r=eC(c),n=new(iC(s))(r),t=0;r>t;t++)n[t]=l?d(c[t],t):c[t];return n},NC=ba.forEach,wC=cc,DC=Ct,kC=o,PC=Rm,MC=Or.get,UC=Or.set,LC=DC.f,xC=kC.f,VC=Math.round,BC=aC.RangeError,jC=lC.ArrayBuffer,FC=jC.prototype,GC=lC.DataView,HC=dC.NATIVE_ARRAY_BUFFER_VIEWS,zC=dC.TYPED_ARRAY_CONSTRUCTOR,KC=dC.TYPED_ARRAY_TAG,YC=dC.TypedArray,XC=dC.TypedArrayPrototype,WC=dC.aTypedArrayConstructor,qC=dC.isTypedArray,JC="BYTES_PER_ELEMENT",ZC="Wrong length",$C=function(e,t){WC(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},QC=function(e,t){LC(e,t,{get:function(){return MC(this)[t]}})},eO=function(e){var t;return RC(FC,e)||"ArrayBuffer"==(t=yC(e))||"SharedArrayBuffer"==t},tO=function(e,t){return qC(e)&&!TC(t)&&t in e&&_C(+t)&&t>=0},rO=function(e,t){return t=gC(t),tO(e,t)?fC(2,e[t]):xC(e,t)},nO=function(e,t,r){return t=gC(t),!(tO(e,t)&&bC(r)&&SC(r,"value"))||SC(r,"get")||SC(r,"set")||r.configurable||SC(r,"writable")&&!r.writable||SC(r,"enumerable")&&!r.enumerable?LC(e,t,r):(e[t]=r.value,e)};cC?(HC||(kC.f=rO,DC.f=nO,QC(XC,"buffer"),QC(XC,"byteOffset"),QC(XC,"byteLength"),QC(XC,"length")),oC({target:"Object",stat:!0,forced:!HC},{getOwnPropertyDescriptor:rO,defineProperty:nO}),tA.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=aC[i],c=s,u=c&&c.prototype,d={},l=function(e,t){LC(e,t,{get:function(){return function(e,t){var r=MC(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=MC(e);r&&(i=(i=VC(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};HC?uC&&(c=t((function(e,t,r,i){return hC(e,u),PC(bC(t)?eO(t)?void 0!==i?new s(t,EC(r,n),i):void 0!==r?new s(t,EC(r,n)):new s(t):qC(t)?$C(c,t):sC(OC,c,t):new s(mC(t)),e,c)})),AC&&AC(c,YC),NC(CC(s),(function(e){e in c||pC(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,i){hC(e,u);var o,a,s,d=0,h=0;if(bC(t)){if(!eO(t))return qC(t)?$C(c,t):sC(OC,c,t);o=t,h=EC(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw BC(ZC);if((a=f-h)<0)throw BC(ZC)}else if((a=vC(i)*n)+h>f)throw BC(ZC);s=a/n}else s=mC(t),o=new jC(a=s*n);for(UC(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new GC(o)});d<s;)l(e,d++)})),AC&&AC(c,YC),u=c.prototype=IC(XC)),u.constructor!==c&&pC(u,"constructor",c),pC(u,zC,c),KC&&pC(u,KC,i),d[i]=c,oC({global:!0,forced:c!=s,sham:!HC},d),JC in c||pC(c,JC,n),JC in u||pC(u,JC,n),wC(i)}):tA.exports=function(){},(0,tA.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var iO=Me,oO=$r,aO=nn,sO=Math.min,cO=[].copyWithin||function(e,t){var r=iO(this),n=aO(r),i=oO(e,n),o=oO(t,n),a=arguments.length>2?arguments[2]:void 0,s=sO((void 0===a?n:oO(a,n))-o,n-i),c=1;for(o<i&&i<o+s&&(c=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:delete r[i],i+=c,o+=c;return r},uO=MA,dO=I(cO),lO=uO.aTypedArray;(0,uO.exportTypedArrayMethod)("copyWithin",(function(e,t){return dO(lO(this),e,t,arguments.length>2?arguments[2]:void 0)}));var hO=ba.every,fO=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("every",(function(e){return hO(fO(this),e,arguments.length>1?arguments[1]:void 0)}));var pO=l,_O=xI,vO=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return pO(_O,vO(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var mO=nn,EO=uu,gO=MA.TYPED_ARRAY_CONSTRUCTOR,SO=MA.aTypedArrayConstructor,yO=function(e){return SO(EO(e,e[gO]))},bO=function(e,t){for(var r=0,n=mO(t),i=new e(n);n>r;)i[r]=t[r++];return i},TO=yO,IO=ba.filter,RO=function(e,t){return bO(TO(e),t)},AO=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("filter",(function(e){var t=IO(AO(this),e,arguments.length>1?arguments[1]:void 0);return RO(this,t)}));var CO=ba.find,OO=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("find",(function(e){return CO(OO(this),e,arguments.length>1?arguments[1]:void 0)}));var NO=ba.findIndex,wO=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("findIndex",(function(e){return NO(wO(this),e,arguments.length>1?arguments[1]:void 0)}));var DO=ba.forEach,kO=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("forEach",(function(e){DO(kO(this),e,arguments.length>1?arguments[1]:void 0)}));var PO=un.includes,MO=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("includes",(function(e){return PO(MO(this),e,arguments.length>1?arguments[1]:void 0)}));var UO=un.indexOf,LO=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("indexOf",(function(e){return UO(LO(this),e,arguments.length>1?arguments[1]:void 0)}));var xO=i,VO=a,BO=I,jO=MA,FO=df,GO=Qe("iterator"),HO=xO.Uint8Array,zO=BO(FO.values),KO=BO(FO.keys),YO=BO(FO.entries),XO=jO.aTypedArray,WO=jO.exportTypedArrayMethod,qO=HO&&HO.prototype,JO=!VO((function(){qO[GO].call([1])})),ZO=!!qO&&qO.values&&qO[GO]===qO.values&&"values"===qO.values.name,$O=function(){return zO(XO(this))};WO("entries",(function(){return YO(XO(this))}),JO),WO("keys",(function(){return KO(XO(this))}),JO),WO("values",$O,JO||!ZO,{name:"values"}),WO(GO,$O,JO||!ZO,{name:"values"});var QO=MA.aTypedArray,eN=MA.exportTypedArrayMethod,tN=I([].join);eN("join",(function(e){return tN(QO(this),e)}));var rN=$i,nN=B,iN=Wr,oN=nn,aN=Fi,sN=Math.min,cN=[].lastIndexOf,uN=!!cN&&1/[1].lastIndexOf(1,-0)<0,dN=aN("lastIndexOf"),lN=uN||!dN?function(e){if(uN)return rN(cN,this,arguments)||0;var t=nN(this),r=oN(t),n=r-1;for(arguments.length>1&&(n=sN(n,iN(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:cN,hN=$i,fN=lN,pN=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return hN(fN,pN(this),t>1?[e,arguments[1]]:[e])}));var _N=ba.map,vN=yO,mN=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("map",(function(e){return _N(mN(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(vN(e))(t)}))}));var EN=cE.left,gN=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return EN(gN(this),e,t,t>1?arguments[1]:void 0)}));var SN=cE.right,yN=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return SN(yN(this),e,t,t>1?arguments[1]:void 0)}));var bN=MA.aTypedArray,TN=MA.exportTypedArrayMethod,IN=Math.floor;TN("reverse",(function(){for(var e,t=this,r=bN(t).length,n=IN(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var RN=i,AN=l,CN=MA,ON=nn,NN=qA,wN=Me,DN=a,kN=RN.RangeError,PN=RN.Int8Array,MN=PN&&PN.prototype,UN=MN&&MN.set,LN=CN.aTypedArray,xN=CN.exportTypedArrayMethod,VN=!DN((function(){var e=new Uint8ClampedArray(2);return AN(UN,e,{length:1,0:3},1),3!==e[1]})),BN=VN&&CN.NATIVE_ARRAY_BUFFER_VIEWS&&DN((function(){var e=new PN(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));xN("set",(function(e){LN(this);var t=NN(arguments.length>1?arguments[1]:void 0,1),r=wN(e);if(VN)return AN(UN,this,r,t);var n=this.length,i=ON(r),o=0;if(i+t>n)throw kN("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!VN||BN);var jN=yO,FN=Do,GN=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=FN(GN(this),e,t),n=jN(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),a((function(){new Int8Array(1).slice()})));var HN=ba.some,zN=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("some",(function(e){return HN(zN(this),e,arguments.length>1?arguments[1]:void 0)}));var KN=i,YN=I,XN=a,WN=me,qN=JT,JN=MA,ZN=$T,$N=QT,QN=te,ew=tI,tw=KN.Array,rw=JN.aTypedArray,nw=JN.exportTypedArrayMethod,iw=KN.Uint16Array,ow=iw&&YN(iw.prototype.sort),aw=!(!ow||XN((function(){ow(new iw(2),null)}))&&XN((function(){ow(new iw(2),{})}))),sw=!!ow&&!XN((function(){if(QN)return QN<74;if(ZN)return ZN<67;if($N)return!0;if(ew)return ew<602;var e,t,r=new iw(516),n=tw(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(ow(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));nw("sort",(function(e){return void 0!==e&&WN(e),sw?ow(this,e):qN(rw(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))}),!sw||aw);var cw=tn,uw=$r,dw=yO,lw=MA.aTypedArray;(0,MA.exportTypedArrayMethod)("subarray",(function(e,t){var r=lw(this),n=r.length,i=uw(e,n);return new(dw(r))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,cw((void 0===t?n:uw(t,n))-i))}));var hw=$i,fw=MA,pw=a,_w=Do,vw=i.Int8Array,mw=fw.aTypedArray,Ew=fw.exportTypedArrayMethod,gw=[].toLocaleString,Sw=!!vw&&pw((function(){gw.call(new vw(1))}));Ew("toLocaleString",(function(){return hw(gw,Sw?_w(mw(this)):mw(this),_w(arguments))}),pw((function(){return[1,2].toLocaleString()!=new vw([1,2]).toLocaleString()}))||!pw((function(){vw.prototype.toLocaleString.call([1,2])})));var yw=MA.exportTypedArrayMethod,bw=a,Tw=I,Iw=i.Uint8Array,Rw=Iw&&Iw.prototype||{},Aw=[].toString,Cw=Tw([].join);bw((function(){Aw.call({})}))&&(Aw=function(){return Cw(this)});var Ow=Rw.toString!=Aw;yw("toString",Aw,Ow);var Nw=Xn,ww=i,Dw=$i,kw=j,Pw=Do,Mw=lu,Uw=/MSIE .\./.test(W),Lw=ww.Function,xw=function(e){return function(t,r){var n=Mw(arguments.length,1)>2,i=kw(t)?t:Lw(t),o=n?Pw(arguments,2):void 0;return e(n?function(){Dw(i,this,o)}:i,r)}};Nw({global:!0,bind:!0,forced:Uw},{setTimeout:xw(ww.setTimeout),setInterval:xw(ww.setInterval)});var Vw=Xn,Bw=ba.findIndex,jw=ah,Fw="findIndex",Gw=!0;Fw in[]&&Array(1).findIndex((function(){Gw=!1})),Vw({target:"Array",proto:!0,forced:Gw},{findIndex:function(e){return Bw(this,e,arguments.length>1?arguments[1]:void 0)}}),jw(Fw);var Hw,zw,Kw=cc,Yw="ArrayBuffer",Xw=VR.ArrayBuffer;Xn({global:!0,forced:i.ArrayBuffer!==Xw},{ArrayBuffer:Xw}),Kw(Yw),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVALID_TOKEN="INVALID_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",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.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.UNEXPECTED_ERROR="UNEXPECTED_ERROR",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"}(Hw||(Hw={})),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"}(zw||(zw={}));var Ww=function(e,t,r){this.code=e,this.message=t,this.error=r},qw=s,Jw=I,Zw=oi,$w=B,Qw=Jw(h.f),eD=Jw([].push),tD=function(e){return function(t){for(var r,n=$w(t),i=Zw(n),o=i.length,a=0,s=[];o>a;)r=i[a++],qw&&!Qw(n,r)||eD(s,e?[r,n[r]]:n[r]);return s}},rD={entries:tD(!0),values:tD(!1)}.entries;Xn({target:"Object",stat:!0},{entries:function(e){return rD(e)}});var nD=Wr,iD=po,oD=L,aD=i.RangeError,sD=I,cD=tn,uD=po,dD=function(e){var t=iD(oD(this)),r="",n=nD(e);if(n<0||n==1/0)throw aD("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},lD=L,hD=sD(dD),fD=sD("".slice),pD=Math.ceil,_D=function(e){return function(t,r,n){var i,o,a=uD(lD(t)),s=cD(r),c=a.length,u=void 0===n?" ":uD(n);return s<=c||""==u?a:((o=hD(u,pD((i=s-c)/u.length))).length>i&&(o=fD(o,0,i)),e?a+o:o+a)}},vD={start:_D(!1),end:_D(!0)},mD=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(W),ED=vD.end;Xn({target:"String",proto:!0,forced:mD},{padEnd:function(e){return ED(this,e,arguments.length>1?arguments[1]:void 0)}});var gD=Zv;Xn({target:"Number",stat:!0,forced:Number.parseInt!=gD},{parseInt:gD});Xn({target:"ArrayBuffer",stat:!0,forced:!MA.NATIVE_ARRAY_BUFFER_VIEWS},{isView:MA.isView}),Xn({global:!0,forced:!bI},{DataView:VR.DataView});var SD=Pt,yD=kc,bD=Yo,TD=l,ID=Me,RD=function(e,t,r,n){try{return n?t(SD(r)[0],r[1]):t(r)}catch(t){yD(e,"throw",t)}},AD=vc,CD=aa,OD=nn,ND=go,wD=Oc,DD=yc,kD=i.Array,PD=function(e){var t=ID(e),r=CD(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=bD(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=DD(t),f=0;if(!h||this==kD&&AD(h))for(a=OD(t),s=r?new this(a):kD(a);a>f;f++)l=o?i(t[f],f):t[f],ND(s,f,l);else for(d=(u=wD(t,h)).next,s=r?new this:[];!(c=TD(d,u)).done;f++)l=o?RD(u,i,[c.value,f],!0):c.value,ND(s,f,l);return s.length=f,s},MD=PD;Xn({target:"Array",stat:!0,forced:!tu((function(e){Array.from(e)}))},{from:MD});var UD,LD=Xn,xD=eo,VD=I([].reverse),BD=[1,2];LD({target:"Array",proto:!0,forced:String(BD)===String(BD.reverse())},{reverse:function(){return xD(this)&&(this.length=this.length),VD(this)}});var jD=new Uint8Array(16);function FD(){if(!UD&&!(UD="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 UD(jD)}var GD=/^(?:[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 HD(e){return"string"==typeof e&&GD.test(e)}for(var zD=[],KD=0;KD<256;++KD)zD.push((KD+256).toString(16).substr(1));function YD(e,t,r){var n=(e=e||{}).random||(e.rng||FD)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(zD[e[t+0]]+zD[e[t+1]]+zD[e[t+2]]+zD[e[t+3]]+"-"+zD[e[t+4]]+zD[e[t+5]]+"-"+zD[e[t+6]]+zD[e[t+7]]+"-"+zD[e[t+8]]+zD[e[t+9]]+"-"+zD[e[t+10]]+zD[e[t+11]]+zD[e[t+12]]+zD[e[t+13]]+zD[e[t+14]]+zD[e[t+15]]).toLowerCase();if(!HD(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var XD=new TextDecoder,WD=new TextEncoder,qD=function(){return YD()},JD=function(){return Date.now()};function ZD(e){for(var t,r,n,i,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=qp(o),u=c.next();!u.done;u=c.next()){s+=(p=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=qp(o),f=h.next();!f.done;f=h.next()){var p=f.value;d.set(p,l),l+=p.length}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return d}var $D=function(){return"undefined"==typeof window},QD=function(){function e(){}return e.token2auth=function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))},e.createUnsafeToken=function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))},e.merge=function(r,n){var i,o;void 0===r&&(r={}),void 0===n&&(n={});try{for(var a=qp(Object.entries(r)),s=a.next();!s.done;s=a.next()){var c=Jp(s.value,2),u=c[0],d=c[1];null!==d&&"object"===t(d)?e.merge(r[u],n[u]):void 0!==n[u]&&(r[u]=n[u])}}catch(e){i={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}},e.ab2str=function(e){return XD.decode(e)},e.ab2obj=function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}},e.str2ab=function(e){return WD.encode(e).buffer},e.ab2b64str=function(e){return Xp(this,void 0,void 0,(function(){return Wp(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 Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function ek(){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 n=r===t.length-1?"0":"1";return Number.parseInt(n+e.join(""),2)}))}function tk(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function rk(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,n=r.byteLength,i=[];if(n>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 n-1-t})).reverse().map((function(e){return o.getUint8(e)}));i=Zp(Zp(Zp([],Jp(a),!1),["..."],!1),Jp(s),!1)}else i=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(n,") [").concat(i.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 nk=function(){return Xp(void 0,void 0,void 0,(function(){var e,t;return Wp(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]}}))}))};function ik(e,t){if("boolean"!=typeof e)throw new Ww(Hw.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function ok(e,t,r,n){if(void 0===r&&(r=1),void 0===n&&(n=Number.POSITIVE_INFINITY),e<r||e>n||"number"!=typeof e)throw new Ww(Hw.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function ak(e,t,r,n){if(void 0===r&&(r=1),void 0===n&&(n=Number.POSITIVE_INFINITY),null==e)throw new Ww(Hw.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,n))throw new Ww(Hw.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function sk(e,t,r){if(!r.includes(e))throw new Ww(Hw.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function ck(e,t){if(lk(e))throw new Ww(Hw.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function uk(e,t){if(!(e instanceof ArrayBuffer))throw new Ww(Hw.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function dk(e){var t,r;try{var n=navigator.mediaDevices.getSupportedConstraints();try{for(var i=qp(Object.keys(e)),o=i.next();!o.done;o=i.next()){var a=o.value;n[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}catch(e){}}function lk(e){return null==e}function hk(e){if("string"!=typeof e||!/^[a-zA-Z0-9 \_\-\@]{1,128}$/.test(e))throw new Ww(Hw.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_")}function fk(e){ck(e,"videoPlayerOption")}function pk(e,t){var r,n;if(void 0===t&&(t=64),!e||0===(null===(r=e)||void 0===r?void 0:r.byteLength))throw new Ww(Hw.INVALID_PARAMS,"The message cannot be empty");if((null==(n=e instanceof ArrayBuffer?e:QD.str2ab(JSON.stringify(e)))?void 0:n.byteLength)>1e3*t)throw new Ww(Hw.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function _k(e){return![r_.onRemoteStreamStats,r_.onLocalStreamStats].includes(e)}var vk={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,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 n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,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,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,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,f=d.length;for(u=0;u<f;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,n);break;case 4:d[u].fn.call(d[u].context,t,n,i);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,n,i){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||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&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 n,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}(vk);var mk=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Ek=l,gk=Pt,Sk=L,yk=mk,bk=po,Tk=ge,Ik=bv;fv("search",(function(e,t,r){return[function(t){var r=Sk(this),n=null==t?void 0:Tk(t,e);return n?Ek(n,t,r):new RegExp(t)[e](bk(r))},function(e){var n=gk(this),i=bk(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;yk(a,0)||(n.lastIndex=0);var s=Ik(n,i);return yk(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var Rk="[VERTC]",Ak=["#0050b3","#0050b3","#0050b3","#0050b3"],Ck=!$D()&&window.location.search.includes("_rtc_debug_"),Ok=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(Ck){for(var n="",i=0;i<this._indent;i++)n+=" ";console.log.apply(console,Zp(["%c".concat(Rk).concat(n,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(Ak[this._indent],";")],Jp(t),!1))}},e}(),Nk=new Ok("VERTC",0),wk=function(e){function t(){return e.call(this)||this}return Cp(t,e),t.prototype.safeEmit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=this.listenerCount(t);try{return e.prototype.emit.apply(this,Zp([t],Jp(r),!1))}catch(e){return Nk.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(i)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Xp(this,void 0,void 0,(function(){var r=this;return Wp(this,(function(n){return[2,new Promise((function(n,i){try{r.emit.apply(r,Zp(Zp([e],Jp(t),!1),[n,i],!1))}catch(t){Nk.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),i(t)}}))]}))}))},t}(vk.exports.EventEmitter),Dk=xe,kk=function(e){return void 0!==e&&(Dk(e,"value")||Dk(e,"writable"))},Pk=l,Mk=G,Uk=Pt,Lk=kk,xk=o,Vk=vh;Xn({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return Uk(t)===o?t[r]:(n=xk.f(t,r))?Lk(n)?n.value:void 0===n.get?void 0:Pk(n.get,o):Mk(i=Vk(t))?e(i,r,o):void 0}});var Bk=Xn,jk=l,Fk=Pt,Gk=G,Hk=kk,zk=Ct,Kk=o,Yk=vh,Xk=E;var Wk=a((function(){var e=function(){},t=zk.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));Bk({target:"Reflect",stat:!0,forced:Wk},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=Kk.f(Fk(t),r);if(!c){if(Gk(o=Yk(t)))return e(o,r,n,s);c=Xk(0)}if(Hk(c)){if(!1===c.writable||!Gk(s))return!1;if(i=Kk.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,zk.f(s,r,i)}else zk.f(s,r,Xk(0,n))}else{if(void 0===(a=c.set))return!1;jk(a,s,n)}return!0}});var qk="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function Jk(e){return void 0===e&&(e=""),e.endsWith("com")||e.endsWith("net")||e.endsWith("org")?"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo"):e}var Zk="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",$k={VERSION:"4.38.0",ICE_CONFIG_REQUEST_URLS_INTERNAL:qk.map(Jk),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:Zk};function Qk(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void($k.ICE_CONFIG_REQUEST_URLS=t.map(Jk))):void("LOG_SERVER_URL"!==e||t!==Hp.overseas?"LOG_SERVER_URL"!==e||t!==Hp.domestic?$k[e]=t:$k.LOG_SERVER_URL=Zk:$k.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function eP(e){return $k[e]}function tP(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||"AAC",bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||48),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||44.1),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||1,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||"LC"},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||"H264",fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||15,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||30,lowLatency:null===(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)||void 0===l||l,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||40),width:(null===(f=t.video)||void 0===f?void 0:f.width)||640,height:(null===(p=t.video)||void 0===p?void 0:p.height)||360},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||"#000000"},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===(E=t.layout)||void 0===E?void 0:E.appData)||""}}}}(0,tA.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,tA.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var rP={};!function(e){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function n(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 i=r.shift();if(i){if("object"!==t(i))throw new TypeError(i+"must be non-object");for(var o in i)n(i,o)&&(e[o]=i[o])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},o={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+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,i)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,o))},e.setTyped(r)}(rP);var nP={},iP={},oP={},aP=rP;function sP(e){for(var t=e.length;--t>=0;)e[t]=0}var cP=256,uP=286,dP=30,lP=15,hP=[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],fP=[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],pP=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],_P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],vP=new Array(576);sP(vP);var mP=new Array(60);sP(mP);var EP=new Array(512);sP(EP);var gP=new Array(256);sP(gP);var SP=new Array(29);sP(SP);var yP,bP,TP,IP=new Array(dP);function RP(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function AP(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function CP(e){return e<256?EP[e]:EP[256+(e>>>7)]}function OP(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function NP(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,OP(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 wP(e,t,r){NP(e,r[2*t],r[2*t+1])}function DP(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function kP(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=lP;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=DP(o[s]++,s))}}function PP(e){var t;for(t=0;t<uP;t++)e.dyn_ltree[2*t]=0;for(t=0;t<dP;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 MP(e){e.bi_valid>8?OP(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 UP(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function LP(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&UP(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!UP(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function xP(e,t,r){var n,i,o,a,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?wP(e,i,t):(wP(e,(o=gP[i])+cP+1,t),0!==(a=hP[o])&&NP(e,i-=SP[o],a),wP(e,o=CP(--n),r),0!==(a=fP[o])&&NP(e,n-=IP[o],a))}while(s<e.last_lit);wP(e,256,t)}function VP(e,t){var r,n,i,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*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)LP(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],LP(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,LP(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,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,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,_=0;for(o=0;o<=lP;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*(n=e.heap[r])+1]+1]+1)>p&&(o=p,_++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==_){do{for(o=p-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[p]--,_-=2}while(_>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),kP(o,u,e.bl_count)}function BP(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))}function jP(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{wP(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(wP(e,i,e.bl_tree),s--),wP(e,16,e.bl_tree),NP(e,s-3,2)):s<=10?(wP(e,17,e.bl_tree),NP(e,s-3,3)):(wP(e,18,e.bl_tree),NP(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}sP(IP);var FP=!1;function GP(e,t,r,n){NP(e,0+(n?1:0),3),function(e,t,r,n){MP(e),n&&(OP(e,r),OP(e,~r)),aP.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}oP._tr_init=function(e){FP||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(SP[n]=r,e=0;e<1<<hP[n];e++)gP[r++]=n;for(gP[r-1]=n,i=0,n=0;n<16;n++)for(IP[n]=i,e=0;e<1<<fP[n];e++)EP[i++]=n;for(i>>=7;n<dP;n++)for(IP[n]=i<<7,e=0;e<1<<fP[n]-7;e++)EP[256+i++]=n;for(t=0;t<=lP;t++)o[t]=0;for(e=0;e<=143;)vP[2*e+1]=8,e++,o[8]++;for(;e<=255;)vP[2*e+1]=9,e++,o[9]++;for(;e<=279;)vP[2*e+1]=7,e++,o[7]++;for(;e<=287;)vP[2*e+1]=8,e++,o[8]++;for(kP(vP,287,o),e=0;e<dP;e++)mP[2*e+1]=5,mP[2*e]=DP(e,5);yP=new RP(vP,hP,257,uP,lP),bP=new RP(mP,fP,0,dP,lP),TP=new RP(new Array(0),pP,0,19,7)}(),FP=!0),e.l_desc=new AP(e.dyn_ltree,yP),e.d_desc=new AP(e.dyn_dtree,bP),e.bl_desc=new AP(e.bl_tree,TP),e.bi_buf=0,e.bi_valid=0,PP(e)},oP._tr_stored_block=GP,oP._tr_flush_block=function(e,t,r,n){var i,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<cP;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),VP(e,e.l_desc),VP(e,e.d_desc),a=function(e){var t;for(BP(e,e.dyn_ltree,e.l_desc.max_code),BP(e,e.dyn_dtree,e.d_desc.max_code),VP(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*_P[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?GP(e,t,r,n):4===e.strategy||o===i?(NP(e,2+(n?1:0),3),xP(e,vP,mP)):(NP(e,4+(n?1:0),3),function(e,t,r,n){var i;for(NP(e,t-257,5),NP(e,r-1,5),NP(e,n-4,4),i=0;i<n;i++)NP(e,e.bl_tree[2*_P[i]+1],3);jP(e,e.dyn_ltree,t-1),jP(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),xP(e,e.dyn_ltree,e.dyn_dtree)),PP(e),n&&MP(e)},oP._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*(gP[r]+cP+1)]++,e.dyn_dtree[2*CP(t)]++),e.last_lit===e.lit_bufsize-1},oP._tr_align=function(e){NP(e,2,3),wP(e,256,vP),function(e){16===e.bi_valid?(OP(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 HP=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};var zP=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var KP,YP=function(e,t,r,n){var i=zP,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},XP={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"},WP=rP,qP=oP,JP=HP,ZP=YP,$P=XP,QP=-2,eM=258,tM=262,rM=103,nM=113,iM=666;function oM(e,t){return e.msg=$P[t],t}function aM(e){return(e<<1)-(e>4?9:0)}function sM(e){for(var t=e.length;--t>=0;)e[t]=0}function cM(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(WP.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 uM(e,t){qP._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,cM(e.strm)}function dM(e,t){e.pending_buf[e.pending++]=t}function lM(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function hM(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-tM?e.strstart-(e.w_size-tM):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+eM,f=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===f&&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(n=eM-(h-o),o=h-eM,n>a){if(e.match_start=t,a=n,n>=s)break;f=u[o+a-1],p=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function fM(e){var t,r,n,i,o,a,s,c,u,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-tM)){WP.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{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=i,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,WP.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=JP(a.adler,s,d,c):2===a.state.wrap&&(a.adler=ZP(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<tM&&0!==e.strm.avail_in)}function pM(e,t){for(var r,n;;){if(e.lookahead<tM){if(fM(e),e.lookahead<tM&&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-tM&&(e.match_length=hM(e,r)),e.match_length>=3)if(n=qP._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 n=qP._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(uM(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(uM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(uM(e,!1),0===e.strm.avail_out)?1:2}function _M(e,t){for(var r,n,i;;){if(e.lookahead<tM){if(fM(e),e.lookahead<tM&&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-tM&&(e.match_length=hM(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){i=e.strstart+e.lookahead-3,n=qP._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<=i&&(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++,n&&(uM(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=qP._tr_tally(e,0,e.window[e.strstart-1]))&&uM(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&&(n=qP._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(uM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(uM(e,!1),0===e.strm.avail_out)?1:2}function vM(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function mM(){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 WP.Buf16(1146),this.dyn_dtree=new WP.Buf16(122),this.bl_tree=new WP.Buf16(78),sM(this.dyn_ltree),sM(this.dyn_dtree),sM(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new WP.Buf16(16),this.heap=new WP.Buf16(573),sM(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new WP.Buf16(573),sM(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 EM(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:nM,e.adler=2===t.wrap?0:1,t.last_flush=0,qP._tr_init(t),0):oM(e,QP)}function gM(e){var t,r=EM(e);return 0===r&&((t=e.state).window_size=2*t.w_size,sM(t.head),t.max_lazy_match=KP[t.level].max_lazy,t.good_match=KP[t.level].good_length,t.nice_match=KP[t.level].nice_length,t.max_chain_length=KP[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 SM(e,t,r,n,i,o){if(!e)return QP;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||8!==r||n<8||n>15||t<0||t>9||o<0||o>4)return oM(e,QP);8===n&&(n=9);var s=new mM;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+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 WP.Buf8(2*s.w_size),s.head=new WP.Buf16(s.hash_size),s.prev=new WP.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new WP.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,gM(e)}KP=[new vM(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(fM(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,uM(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-tM&&(uM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(uM(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(uM(e,!1),e.strm.avail_out),1)})),new vM(4,4,8,4,pM),new vM(4,5,16,8,pM),new vM(4,6,32,32,pM),new vM(4,4,16,16,_M),new vM(8,16,32,32,_M),new vM(8,16,128,128,_M),new vM(8,32,128,256,_M),new vM(32,128,258,1024,_M),new vM(32,258,258,4096,_M)],iP.deflateInit=function(e,t){return SM(e,t,8,15,8,0)},iP.deflateInit2=SM,iP.deflateReset=gM,iP.deflateResetKeep=EM,iP.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?QP:(e.state.gzhead=t,0):QP},iP.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?oM(e,QP):QP;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===iM&&4!==t)return oM(e,0===e.avail_out?-5:QP);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,dM(n,31),dM(n,139),dM(n,8),n.gzhead?(dM(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),dM(n,255&n.gzhead.time),dM(n,n.gzhead.time>>8&255),dM(n,n.gzhead.time>>16&255),dM(n,n.gzhead.time>>24&255),dM(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),dM(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(dM(n,255&n.gzhead.extra.length),dM(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=ZP(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(dM(n,0),dM(n,0),dM(n,0),dM(n,0),dM(n,0),dM(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),dM(n,3),n.status=nM);else{var a=8+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=nM,lM(n,a),0!==n.strstart&&(lM(n,e.adler>>>16),lM(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=ZP(e.adler,n.pending_buf,n.pending-i,i)),cM(e),i=n.pending,n.pending!==n.pending_buf_size));)dM(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=ZP(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=ZP(e.adler,n.pending_buf,n.pending-i,i)),cM(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,dM(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=ZP(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=ZP(e.adler,n.pending_buf,n.pending-i,i)),cM(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,dM(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=ZP(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=rM)}else n.status=rM;if(n.status===rM&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&cM(e),n.pending+2<=n.pending_buf_size&&(dM(n,255&e.adler),dM(n,e.adler>>8&255),e.adler=0,n.status=nM)):n.status=nM),0!==n.pending){if(cM(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&aM(t)<=aM(r)&&4!==t)return oM(e,-5);if(n.status===iM&&0!==e.avail_in)return oM(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==iM){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(fM(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=qP._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(uM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(uM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(uM(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=eM){if(fM(e),e.lookahead<=eM&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+eM;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=eM-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=qP._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=qP._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(uM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(uM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(uM(e,!1),0===e.strm.avail_out)?1:2}(n,t):KP[n.level].func(n,t);if(3!==s&&4!==s||(n.status=iM),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?qP._tr_align(n):5!==t&&(qP._tr_stored_block(n,0,0,!1),3===t&&(sM(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),cM(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(dM(n,255&e.adler),dM(n,e.adler>>8&255),dM(n,e.adler>>16&255),dM(n,e.adler>>24&255),dM(n,255&e.total_in),dM(n,e.total_in>>8&255),dM(n,e.total_in>>16&255),dM(n,e.total_in>>24&255)):(lM(n,e.adler>>>16),lM(n,65535&e.adler)),cM(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},iP.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==rM&&t!==nM&&t!==iM?oM(e,QP):(e.state=null,t===nM?oM(e,-3):0):QP},iP.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return QP;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return QP;for(1===o&&(e.adler=JP(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(sM(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new WP.Buf8(r.w_size),WP.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,fM(r);r.lookahead>=3;){n=r.strstart,i=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=2,fM(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},iP.deflateInfo="pako deflate (from Nodeca project)";var yM={},bM=rP,TM=!0,IM=!0;try{String.fromCharCode.apply(null,[0])}catch(e){TM=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){IM=!1}for(var RM=new bM.Buf8(256),AM=0;AM<256;AM++)RM[AM]=AM>=252?6:AM>=248?5:AM>=240?4:AM>=224?3:AM>=192?2:1;function CM(e,t){if(t<65534&&(e.subarray&&IM||!e.subarray&&TM))return String.fromCharCode.apply(null,bM.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}RM[254]=RM[254]=1,yM.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new bM.Buf8(s),o=0,i=0;o<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),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},yM.buf2binstring=function(e){return CM(e,e.length)},yM.binstring2buf=function(e){for(var t=new bM.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},yM.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)s[n++]=i;else if((o=RM[i])>4)s[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return CM(s,n)},yM.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+RM[e[r]]>t?r:t};var OM=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},NM=iP,wM=rP,DM=yM,kM=XP,PM=OM,MM=Object.prototype.toString;function UM(e){if(!(this instanceof UM))return new UM(e);this.options=wM.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 PM,this.strm.avail_out=0;var r=NM.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(kM[r]);if(t.header&&NM.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?DM.string2buf(t.dictionary):"[object ArrayBuffer]"===MM.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=NM.deflateSetDictionary(this.strm,n)))throw new Error(kM[r]);this._dict_set=!0}}function LM(e,t){var r=new UM(t);if(r.push(e,!0),r.err)throw r.msg||kM[r.err];return r.result}UM.prototype.push=function(e,t){var r,n,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=DM.string2buf(e):"[object ArrayBuffer]"===MM.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new wM.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=NM.deflate(i,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(DM.buf2binstring(wM.shrinkBuf(i.output,i.next_out))):this.onData(wM.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=NM.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},UM.prototype.onData=function(e){this.chunks.push(e)},UM.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=wM.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},nP.Deflate=UM,nP.deflate=LM,nP.deflateRaw=function(e,t){return(t=t||{}).raw=!0,LM(e,t)},nP.gzip=function(e,t){return(t=t||{}).gzip=!0,LM(e,t)};var xM={},VM=s,BM=Ct,jM=A_,FM=a,GM=RegExp.prototype;VM&&FM((function(){return"sy"!==Object.getOwnPropertyDescriptor(GM,"flags").get.call({dotAll:!0,sticky:!0})}))&&BM.f(GM,"flags",{configurable:!0,get:jM});var HM={},zM=rP,KM=15,YM=[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],XM=[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],WM=[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],qM=[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],JM=rP,ZM=HP,$M=YP,QM=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,g,S,y,b,T,I,R,A;r=e.state,n=e.next_in,R=e.input,i=n+(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,f=r.hold,p=r.bits,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,E=(1<<r.distbits)-1;e:do{p<15&&(f+=R[n++]<<p,p+=8,f+=R[n++]<<p,p+=8),g=_[f&m];t:for(;;){if(f>>>=S=g>>>24,p-=S,0===(S=g>>>16&255))A[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=_[(65535&g)+(f&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}y=65535&g,(S&=15)&&(p<S&&(f+=R[n++]<<p,p+=8),y+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=R[n++]<<p,p+=8,f+=R[n++]<<p,p+=8),g=v[f&E];r:for(;;){if(f>>>=S=g>>>24,p-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=v[(65535&g)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&g,p<(S&=15)&&(f+=R[n++]<<p,(p+=8)<S&&(f+=R[n++]<<p,p+=8)),(b+=f&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,b>(S=o-a)){if((S=b-S)>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-S,S<y){y-=S;do{A[o++]=h[T++]}while(--S);T=o-b,I=A}}else if(l<S){if(T+=u+l-S,(S-=l)<y){y-=S;do{A[o++]=h[T++]}while(--S);if(T=0,l<y){y-=S=l;do{A[o++]=h[T++]}while(--S);T=o-b,I=A}}}else if(T+=l-S,S<y){y-=S;do{A[o++]=h[T++]}while(--S);T=o-b,I=A}for(;y>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],y-=3;y&&(A[o++]=I[T++],y>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],y-=3}while(y>2);y&&(A[o++]=A[T++],y>1&&(A[o++]=A[T++]))}break}}break}}while(n<i&&o<s);n-=y=p>>3,f&=(1<<(p-=y<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=f,r.bits=p},eU=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,f,p,_,v,m=s.bits,E=0,g=0,S=0,y=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,N=0,w=new zM.Buf16(16),D=new zM.Buf16(16),k=null,P=0;for(E=0;E<=KM;E++)w[E]=0;for(g=0;g<n;g++)w[t[r+g]]++;for(b=m,y=KM;y>=1&&0===w[y];y--);if(b>y&&(b=y),0===y)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<y&&0===w[S];S++);for(b<S&&(b=S),R=1,E=1;E<=KM;E++)if(R<<=1,(R-=w[E])<0)return-1;if(R>0&&(0===e||1!==y))return-1;for(D[1]=0,E=1;E<KM;E++)D[E+1]=D[E]+w[E];for(g=0;g<n;g++)0!==t[r+g]&&(a[D[t[r+g]]++]=g);if(0===e?(O=k=a,f=19):1===e?(O=YM,N-=257,k=XM,P-=257,f=256):(O=WM,k=qM,f=-1),C=0,g=0,E=S,h=o,T=b,I=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){p=E-I,a[g]<f?(_=0,v=a[g]):a[g]>f?(_=k[P+a[g]],v=O[N+a[g]]):(_=96,v=0),c=1<<E-I,S=u=1<<T;do{i[h+(C>>I)+(u-=c)]=p<<24|_<<16|v|0}while(0!==u);for(c=1<<E-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,g++,0==--w[E]){if(E===y)break;E=t[r+a[g]]}if(E>b&&(C&l)!==d){for(0===I&&(I=b),h+=S,R=1<<(T=E-I);T+I<y&&!((R-=w[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;i[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(i[h+C]=E-I<<24|64<<16|0),s.bits=b,0},tU=-2,rU=12,nU=30;function iU(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function oU(){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 JM.Buf16(320),this.work=new JM.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function aU(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 JM.Buf32(852),t.distcode=t.distdyn=new JM.Buf32(592),t.sane=1,t.back=-1,0):tU}function sU(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,aU(e)):tU}function cU(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?tU:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,sU(e))):tU}function uU(e,t){var r,n;return e?(n=new oU,e.state=n,n.window=null,0!==(r=cU(e,t))&&(e.state=null),r):tU}var dU,lU,hU=!0;function fU(e){if(hU){var t;for(dU=new JM.Buf32(512),lU=new JM.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(eU(1,e.lens,0,288,dU,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;eU(2,e.lens,0,32,lU,0,e.work,{bits:5}),hU=!1}e.lencode=dU,e.lenbits=9,e.distcode=lU,e.distbits=5}function pU(e,t,r,n){var i,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new JM.Buf8(o.wsize)),n>=o.wsize?(JM.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),JM.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(JM.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}HM.inflateReset=sU,HM.inflateReset2=cU,HM.inflateResetKeep=aU,HM.inflateInit=function(e){return uU(e,15)},HM.inflateInit2=uU,HM.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,g,S,y,b,T,I,R,A=0,C=new JM.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 tU;(r=e.state).mode===rU&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=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+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,C[0]=255&u,C[1]=u>>>8&255,r.check=$M(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=nU;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=nU;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=nU;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:rU,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=nU;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=nU;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=$M(r.check,C,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[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=$M(r.check,C,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[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=$M(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+=n[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=$M(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&&((f=r.length)>s&&(f=s),f&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),JM.arraySet(r.head.extra,n,o,f,b)),512&r.flags&&(r.check=$M(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&f<s);if(512&r.flags&&(r.check=$M(r.check,n,f,o)),s-=f,o+=f,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;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&f<s);if(512&r.flags&&(r.check=$M(r.check,n,f,o)),s-=f,o+=f,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+=n[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=nU;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=rU;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=iU(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=rU;case rU: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+=n[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(fU(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=nU}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=nU;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(f=r.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break e;JM.arraySet(i,n,o,f,a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=rU;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[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=nU;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[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=eU(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid code lengths set",r.mode=nU;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,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(E<16)u>>>=v,d-=v,r.lens[r.have++]=E;else{if(16===E){for(R=v+2;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=nU;break}b=r.lens[r.have-1],f=3+(3&u),u>>>=2,d-=2}else if(17===E){for(R=v+3;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=v,b=0,f=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(R=v+7;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=v,b=0,f=11+(127&(u>>>=v)),u>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=nU;break}for(;f--;)r.lens[r.have++]=b}}if(r.mode===nU)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=nU;break}if(r.lenbits=9,I={bits:r.lenbits},T=eU(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=nU;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},T=eU(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=nU;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,QM(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===rU&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=v,S=m,y=E;m=(A=r.lencode[y+((u&(1<<g+S)-1)>>g)])>>>16&255,E=65535&A,!(g+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=v,d-=v,r.back+=v,r.length=E,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=rU;break}if(64&m){e.msg="invalid literal/length code",r.mode=nU;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+=n[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,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(g=v,S=m,y=E;m=(A=r.distcode[y+((u&(1<<g+S)-1)>>g)])>>>16&255,E=65535&A,!(g+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=nU;break}r.offset=E,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+=n[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=nU;break}r.mode=25;case 25:if(0===c)break e;if(f=h-c,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=nU;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),_=r.window}else _=i,p=a-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do{i[a++]=_[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?$M(r.check,i,h,a-h):ZM(r.check,i,h,a-h)),h=c,(r.flags?u:iU(u))!==r.check){e.msg="incorrect data check",r.mode=nU;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+=n[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=nU;break}u=0,d=0}r.mode=29;case 29:T=1;break e;case nU:T=-3;break e;case 31:return-4;default:return tU}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<nU&&(r.mode<27||4!==t))&&pU(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?$M(r.check,i,h,e.next_out-h):ZM(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===rU?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},HM.inflateEnd=function(e){if(!e||!e.state)return tU;var t=e.state;return t.window&&(t.window=null),e.state=null,0},HM.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?tU:(r.head=t,t.done=!1,0):tU},HM.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?tU:11===r.mode&&ZM(1,t,n,0)!==r.check?-3:pU(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):tU},HM.inflateInfo="pako inflate (from Nodeca project)";var _U={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 vU=HM,mU=rP,EU=yM,gU=_U,SU=XP,yU=OM,bU=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},TU=Object.prototype.toString;function IU(e){if(!(this instanceof IU))return new IU(e);this.options=mU.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 yU,this.strm.avail_out=0;var r=vU.inflateInit2(this.strm,t.windowBits);if(r!==gU.Z_OK)throw new Error(SU[r]);if(this.header=new bU,vU.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=EU.string2buf(t.dictionary):"[object ArrayBuffer]"===TU.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=vU.inflateSetDictionary(this.strm,t.dictionary))!==gU.Z_OK))throw new Error(SU[r])}function RU(e,t){var r=new IU(t);if(r.push(e,!0),r.err)throw r.msg||SU[r.err];return r.result}IU.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?gU.Z_FINISH:gU.Z_NO_FLUSH,"string"==typeof e?s.input=EU.binstring2buf(e):"[object ArrayBuffer]"===TU.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 mU.Buf8(c),s.next_out=0,s.avail_out=c),(r=vU.inflate(s,gU.Z_NO_FLUSH))===gU.Z_NEED_DICT&&u&&(r=vU.inflateSetDictionary(this.strm,u)),r===gU.Z_BUF_ERROR&&!0===d&&(r=gU.Z_OK,d=!1),r!==gU.Z_STREAM_END&&r!==gU.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==gU.Z_STREAM_END&&(0!==s.avail_in||n!==gU.Z_FINISH&&n!==gU.Z_SYNC_FLUSH)||("string"===this.options.to?(i=EU.utf8border(s.output,s.next_out),o=s.next_out-i,a=EU.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&mU.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(mU.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!==gU.Z_STREAM_END);return r===gU.Z_STREAM_END&&(n=gU.Z_FINISH),n===gU.Z_FINISH?(r=vU.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===gU.Z_OK):n!==gU.Z_SYNC_FLUSH||(this.onEnd(gU.Z_OK),s.avail_out=0,!0)},IU.prototype.onData=function(e){this.chunks.push(e)},IU.prototype.onEnd=function(e){e===gU.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=mU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},xM.Inflate=IU,xM.inflate=RU,xM.inflateRaw=function(e,t){return(t=t||{}).raw=!0,RU(e,t)},xM.ungzip=RU;var AU={};(0,rP.assign)(AU,nP,xM,_U);var CU,OU,NU,wU,DU,kU,PU,MU,UU,LU,xU,VU,BU,jU,FU,GU,HU,zU,KU,YU,XU,WU,qU,JU,ZU,$U,QU,eL,tL,rL,nL,iL,oL,aL,sL,cL,uL,dL,lL,hL,fL,pL,_L,vL,mL,EL,gL=AU;!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",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"}(CU||(CU={})),function(e){e.RTC="rtc"}(OU||(OU={})),function(e){e.W_5="5"}(NU||(NU={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(wU||(wU={})),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"}(DU||(DU={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(kU||(kU={})),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"}(PU||(PU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(MU||(MU={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(UU||(UU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(LU||(LU={})),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"}(xU||(xU={})),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"}(VU||(VU={})),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"}(BU||(BU={})),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"}(jU||(jU={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(FU||(FU={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(GU||(GU={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(HU||(HU={})),function(e){e.W_0="0",e.W_1="1"}(zU||(zU={})),function(e){e.UP="up",e.DOWN="down"}(KU||(KU={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(YU||(YU={})),function(e){e.UP="up",e.DOWN="down"}(XU||(XU={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(WU||(WU={})),function(e){e.W_0="0",e.W_1="1"}(qU||(qU={})),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"}(JU||(JU={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(ZU||(ZU={})),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"}($U||($U={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(QU||(QU={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(eL||(eL={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(tL||(tL={})),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"}(rL||(rL={})),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"}(nL||(nL={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(iL||(iL={})),function(e){e.BEGIN="begin",e.END="end"}(oL||(oL={})),function(e){e.BEGIN="begin",e.END="end"}(aL||(aL={})),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"}(sL||(sL={})),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"}(cL||(cL={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(uL||(uL={})),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"}(dL||(dL={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(lL||(lL={})),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"}(hL||(hL={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2"}(fL||(fL={})),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"}(pL||(pL={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(_L||(_L={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(vL||(vL={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(mL||(mL={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(EL||(EL={}));var SL,yL,bL,TL,IL,RL,AL,CL=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}(),OL=$k.LOG_SERVER_URL,NL=function(){function e(){var e=this;this.report_id=0,this.dataBuffer=[],this.posting=!1,this.report_common={},this.preSucTime=0,this.errSendDelay=100,this.commonStats=new CL(this),$D()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)}))}return e.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()))},e.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},e.prototype.send=function(e,t){var r=this;if(e||this.dataBuffer.length){var n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;if(i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){e||(r.posting=!1);var o=void 0;if(200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(e){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}},i.open("POST",OL,!0),e||(this.posting=!0),!$D()&&window.location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var o=gL.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(o)}}},e.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},e.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},e.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=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,f=t.rtc_sid,p=t.engine_session_id,_=t.rtc_business_id,v=t.project_key,m=t.network_type,E=t.app_version,g=t.aid,S=t.device_model,y=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:n,rtc_app_id:i,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:f,engine_session_id:p,rtc_business_id:_,project_key:v,network_type:m,app_version:E,aid:g,device_model:S,device_brand:y,common_extra_info:b,had_selected_p2p:T,rtc_env_type:I,user_agent:R}),this.commonStats.room_id&&(e.room_id=this.commonStats.room_id),this.commonStats.user_id&&(e.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(e.rtc_session_id=this.commonStats.rtc_session_id)},e.prototype.rtcSdkApiCall=function(e,t,r,n){void 0===n&&(n={});var i=Kp({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},n);this.push(i)},e.prototype.rtcSdkCallback=function(e,t,r,n){void 0===n&&(n={});var i=Kp({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},n);this.push(i)},e.prototype.rtcReconnect=function(e,t,r,n,i){void 0===i&&(i={});var o=Kp({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},i);this.push(o)},e.prototype.rtcReconnected=function(e,t,r){void 0===r&&(r={});var n=Kp({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},r);this.push(n)},e.prototype.rtcGetAccess=function(e,t,r,n,i,o,a){void 0===a&&(a={});var s=Kp({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:i,connect_session_id:o},a);this.push(s)},e.prototype.rtcPreIceState=function(e,t,r){void 0===r&&(r={});var n=Kp({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},r);this.push(n)},e.prototype.rtcNodeChange=function(e,t,r,n){void 0===n&&(n={});var i=Kp({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},n);this.push(i)},e.prototype.rtcSignalingMsgError=function(e,t,r,n){void 0===n&&(n={});var i=Kp({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},n);this.push(i)},e.prototype.rtcSignaling=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Kp({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,direction:i},o);this.push(a)},e.prototype.rtcJoinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=Kp({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},i);this.push(o)},e.prototype.rtcLeaveRoom=function(e,t,r,n){void 0===n&&(n={});var i=Kp({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},n);this.push(i)},e.prototype.rtcBeginCreateOffer=function(e,t,r,n){void 0===n&&(n={});var i=Kp({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},n);this.push(i)},e.prototype.rtcCreateOffer=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Kp({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:n,elapse:i},o);this.push(a)},e.prototype.rtcSetDescription=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=Kp({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:i,stream_user_id:o,elapse:a},s);this.push(c)},e.prototype.rtcRecvAnswer=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=Kp({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:i,stream_id:o,stream_user_id:a},s);this.push(c)},e.prototype.firstRemoteAudioRender=function(e,t,r){void 0===r&&(r={});var n=Kp({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},r);this.push(n)},e.prototype.firstRemoteVideoRender=function(e,t,r){void 0===r&&(r={});var n=Kp({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},r);this.push(n)},e.prototype.rtcPublishStat=function(e,t,r,n,i){void 0===i&&(i={});var o=Kp({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},i);this.push(o)},e.prototype.rtcSubscribeStat=function(e,t,r,n,i){void 0===i&&(i={});var o=Kp({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},i);this.push(o)},e.prototype.rtcAudioDevice=function(e,t,r,n){void 0===n&&(n={});var i=Kp({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},n);this.push(i)},e.prototype.rtcMediaStatistics=function(e,t,r){void 0===r&&(r={});var n=Kp(Kp(Kp({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcMessageStatistics=function(e,t,r,n){void 0===n&&(n={});var i=Kp(Kp(Kp(Kp({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),{media_server_ip:r}),n);this.push(i)},e.prototype.rtcError=function(e,t,r){void 0===r&&(r={});var n=Kp({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},r);this.push(n)},e.prototype.rtcInvokeStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Kp({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:n,elapse:i},o);this.push(a)},e.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var r=Kp(Kp({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t);this.push(r)},e.prototype.rtcMuteRemote=function(e,t,r){void 0===r&&(r={});var n=Kp(Kp(Kp({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now()},e),{media_type:t}),r);this.push(n)},e.prototype.sdkInitEngine=function(e,t,r){void 0===r&&(r={});var n=Kp({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},r);this.push(n)},e.prototype.joinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=Kp({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},i);this.push(o)},e.prototype.p2pConnectionStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Kp({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:n,elapse:i},o);this.push(a)},e.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var r=Kp({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},t);this.push(r)},e.prototype.rtcDeviceError=function(e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,_,v){void 0===v&&(v={});var m=Kp({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:n,system_api:i,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:f,device_vid:p,media_mode:_},v);this.push(m)},e.prototype.rtcVideoDevice=function(e,t,r){void 0===r&&(r={});var n=Kp({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},r);this.push(n)},e.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var r=Kp(Kp({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t);this.push(r)},e.prototype.rtcEncodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Kp(Kp(Kp({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcFirstFrameEncoded=function(e,t,r){void 0===r&&(r={});var n=Kp(Kp(Kp({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcSendFirstPacket=function(e,t,r){void 0===r&&(r={});var n=Kp(Kp(Kp({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcRecvFirstPacket=function(e,t,r){void 0===r&&(r={});var n=Kp(Kp(Kp({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcRecvFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Kp(Kp(Kp({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e.prototype.rtcDecodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Kp(Kp(Kp({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},e}(),wL=new NL,DL=new NL,kL=wL.commonStats,PL=DL.commonStats;function ML(e){void 0===e&&(e=!1);for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,n,i){if("function"==typeof i.value){var o=i.value;i.value=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a={};return t.forEach((function(e,t){a[e]=r[t]})),(e?DL:wL).rtcSdkApiCall(n,0,JSON.stringify(rk(r)),a),o.apply(this,r)}}}}function UL(e,t,r){void 0===r&&(r=0),(e===r_.onUserMessageReceivedOutsideRoom||e===r_.onUserBinaryMessageReceivedOutsideRoom?DL:wL).rtcSdkCallback(e,r,JSON.stringify(t))}function LL(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=!1),(n?DL:wL).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"}(SL||(SL={})),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"}(yL||(yL={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(bL||(bL={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(IL||(IL={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(RL||(RL={})),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"}(AL||(AL={}));var xL,VL,BL=((TL={})[AL.SUCCESS]=[0,"success"],TL[AL.TIMEOUT]=[Hw.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],TL[AL.BROKEN]=[Hw.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],TL[AL.NO_RECEIVER]=[Hw.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],TL[AL.NO_RELAYPATH]=[Hw.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],TL[AL.SEND_TO_SERVER_ERROR]=[Hw.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],TL[AL.SERVER_RESPONSE_ERROR]=[Hw.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],TL[AL.NOT_JOIN]=[Hw.USER_MESSAGE_NOT_JOIN,"not join room"],TL[AL.INIT]=[Hw.USER_MESSAGE_INIT,"not init."],TL[AL.NO_CONNECTION]=[Hw.USER_MESSAGE_NO_CONNECTION,"no connection."],TL[AL.EXCEED_MAX_LENGTH]=[Hw.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],TL[AL.EMPTY_USER]=[Hw.USER_MESSAGE_EMPTY_USER,"user id is empty."],TL[AL.NOT_LOGIN]=[Hw.USER_MESSAGE_NOT_LOGIN,"not login."],TL[AL.SERVER_PARAMS_NOTSET]=[Hw.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],TL[AL.UNKNOWN]=[Hw.USER_MESSAGE_UNKNOWN,"unknown."],TL),jL=new Ok("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(xL||(xL={})),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"}(VL||(VL={}));var FL=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 Cp(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 n=this;return wL.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",FU.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=ek();var s=a.id.join("-"),c=setTimeout((function(){n._singlingCache.delete(s),o(new Ww(Hw.TIME_OUT,"".concat(e," message time out")))}),6e4);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),i(e)},error:function(e){clearTimeout(c),o(e)}}),jL.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),n._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:VL.C2GW})},t.prototype.sendP2PMessage=function(e,t){var r=e.msg,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["msg"]);return Xp(this,void 0,void 0,(function(){var e,i,o,a,s;return Wp(this,(function(c){switch(c.label){case 0:return e=r instanceof ArrayBuffer,i=this._sendP2PMessage,o=[Kp({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:IL.SEND,type:RL.P2P,err:AL.SUCCESS},n)],s={binary:e},e?[4,QD.ab2b64str(r)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=JSON.stringify(r),c.label=3;case 3:return[2,i.apply(this,[Kp.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var r=this;return void 0===t&&(t={}),tk(e.msg)?this._rttIds[e.id]=e.id:jL.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(n,i){var o=r._genHeader(Kp(Kp({needAck:!0,functionType:VL.C2C},t),{id:ek()}));if(e.dir===IL.SEND){var a=setTimeout((function(){r._p2pCache.delete(e.id),i(new Ww(Hw.TIME_OUT,"P2P message timeout"))}),6e4);r._p2pCache.set(e.id,{success:function(e){clearTimeout(a),n(e)},error:function(e){clearTimeout(a);var t=Jp(BL[e.err]||[Hw.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];i({code:r,message:e.msg||n})}})}r._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new Ww(Hw.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var n=t.version+(+t.zip<<5)+(+t.encrypt<<6),i=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=QD.str2ab(JSON.stringify([e,r])),a=ZD(Uint8Array,Zp([n,i],Jp(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],o={version:15&n,zip:16==(16&n),encrypt:32==(32&n),needAck:1==(1&i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:64==(64&i)};if(o.needAck||o.direction===xL.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:xL.ACK,id:e.split("-").map((function(e){return+e}))});jL.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")},t.prototype._handleMessage=function(e){var t,r;return Xp(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,g,S,y,b,T,I,R,A,C,O,N,w;return Wp(this,(function(D){switch(D.label){case 0:n=this._dispartData(e),i=n.header,o=n.data,i.zip&&((a=new gL.Inflate).push(o,!0),o=a.result),s=QD.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&wL.rtcSignalingMsgError(-1,e.message,BU.MESSAGE_PARSE_FAILED),[2]}switch(i.functionType){case VL.C2S:return[3,1];case VL.C2C:return[3,6];case VL.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=i.id)||void 0===t?void 0:t.join("-"))||"",i.direction!==xL.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],jL.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,QD.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=D.sent(),D.label=4;case 4:this.emit(d,Kp({},c)),wL.rtcSignaling(0,s,"on-".concat(d),"Recv",FU.DOWN),D.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)===IL.FEEDBACK||tk(null==c?void 0:c.msg)?delete this._rttIds[h]:jL.print("Signal","<<<<<< p2p response",c),c.dir){case IL.SEND:return[3,7];case IL.FEEDBACK:return[3,16]}return[3,17];case 7:return tk(null==c?void 0:c.msg)?[3,15]:(p=(f=c).binary,_=f.msg,v=f.room,m=f.to,E=f.from,g=""===v?p?yL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:yL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:p?yL.USER_BINARY_MESSAGE_RECEIVED:yL.USER_MESSAGE_RECEIVED,m?[3,11]:(S=this.emit,y=[yL.ON_CUSTOM_MESSAGE],N={clientId:E,binary:p},p?[4,QD.b64str2ab(_)]:[3,9]));case 8:return b=D.sent(),[3,10];case 9:b=_,D.label=10;case 10:return S.apply(this,y.concat([(N.message=b,N)])),[3,17];case 11:return T=this.emit,I=[g],R=[Kp({},c)],w={},p?[4,QD.b64str2ab(_)]:[3,13];case 12:return A=D.sent(),[3,14];case 13:A=_,D.label=14;case 14:T.apply(this,I.concat([Kp.apply(void 0,R.concat([(w.msg=A,w)]))])),D.label=15;case 15:return this._sendP2PMessage(Kp(Kp({},c),{dir:IL.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===AL.SUCCESS?C.success(c.id):C.error(c)),[3,17];case 17:return[3,19];case 18:i.direction===xL.ACK&&(O=(null===(r=i.id)||void 0===r?void 0:r.join("-"))||"",this._handleAckMessage(O,c[0]||{},s)),D.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){jL.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){jL.print("_handleHandler","dataChannel error",t),e.emit("close",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",n)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),Kp({version:2,zip:!1,encrypt:!1,needAck:!0,direction:xL.SEND,functionType:VL.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,r){var n=this._singlingCache.get(e);n&&(this._singlingCache.delete(e),200===t.code?n.success(t):n.error(t),jL.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),wL.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",FU.DOWN)},t}(vk.exports.EventEmitter),GL=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,r=e.method,n=e.url,i=e.body,o=void 0===i?{}:i,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,i){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(r,n,!0);try{for(var l=qp(Object.entries(s)),h=l.next();!h.done;h=l.next()){var f=Jp(h.value,2),p=f[0],_=f[1];d.setRequestHeader(p,_)}}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)):i({message:d.statusText,code:d.status})),0===d.status&&i({code:0,message:"Request abort"})},d.onerror=function(e){var r=Hw.UNEXPECTED_ERROR;t.isSending=!1,i({code:r,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,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),HL="RTC_DEVICE_ID",zL="RTC_ACCESS_NODE",KL="RTC_ACCESS_URLS",YL=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 n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(n)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),XL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Cp(t,e),t.prototype.getDeviceId=function(){var e=this.get(HL);return e||(e=YD()),this.set(HL,e),e},t.prototype.getAccessNode=function(e){return this.get("".concat(zL,"_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,r){return this.set("".concat(zL,"_").concat(e,"-BytePlus"),t,1e3*r)},t.prototype.getAccessUrls=function(){return this.get("".concat(KL,"-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(KL,"-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat(KL,"-BytePlus"))},t}(YL),WL=new XL,qL=new Ok("ICE Request",3),JL=function(){function e(){this._request=new GL}return e.prototype.getAccessNode=function(e,t,r,n,i,o){return Xp(this,void 0,void 0,(function(){var a;return Wp(this,(function(s){return(a=WL.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,r,n,i,o),LL("es.R.node.cache",a),[2,Promise.resolve(a)]):[2,this.getAccessNodeFromServer(e,t,r,n,i,o)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,r,n,i,o){return Xp(this,void 0,void 0,(function(){var a,s,c=this;return Wp(this,(function(u){return a=WL.getAccessUrls(),s=!0,LL("es.R.req.cache.urls",a),(null==a?void 0:a.length)>0||(a=$k.ICE_CONFIG_REQUEST_URLS,s=!1,LL("es.R.req.external.urls",a)),(null==a?void 0:a.length)>0||(a=$k.ICE_CONFIG_REQUEST_URLS_INTERNAL,s=!1,LL("es.R.req.internal.urls",a)),[2,this.getICEConfigFromServer(a,e,t,r,n,i,o).then((function(t){var r=t.nodes[0];return WL.setAccessNode(e,r,t.ttl||11200),WL.setAccessUrls(t.dispatchDomains),r})).catch((function(a){if(s)return LL("es.R.req.fallback",""),WL.clearAccessUrls(),c.getAccessNodeFromServer(e,t,r,n,i,o);throw a}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,r,n,i,o,a){var s;return Xp(this,void 0,void 0,(function(){var c,u,d,l=this;return Wp(this,(function(h){return c={appID:t,roomID:r,userID:n,deviceID:i,connectSessionID:qD(),os:"web",sdkVersion:$k.VERSION,expectedAddr:eP("EXPECTED_ADDR"),productPlatform:"BytePlus"},o&&a&&(c.feedbackInfo=[{feedbackIP:null===(s=a.publicIPs[0])||void 0===s?void 0:s.ip,feedbackReason:{type:"NodeChanged",reason:o}}],delete c.expectedAddr),u=Date.now(),wL.rtcGetAccess(0,JSON.stringify(c),0,xU.REQUEST,e.join(","),c.connectSessionID),d=e.map((function(e,t){return Xp(l,void 0,void 0,(function(){var r,n,i;return Wp(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._request.post(e,c)];case 1:return r=o.sent(),[3,3];case 2:throw n=o.sent(),new Ww(Hw.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==r.code)throw new Ww(Hw.ICE_SERVER_WRONG,"get ICE config failed",{server_code:r.code,message:JSON.stringify(r)});if(!(i=r.nodes[0]))throw new Ww(Hw.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:r.code,message:JSON.stringify(r)});return[2,{result:r,firstNode:i,index:t}]}}))}))})),[2,Promise.race(d).then((function(t){var r=t.result;t.firstNode;var n=t.index;return wL.rtcGetAccess(200,JSON.stringify(r),Date.now()-u,xU.RESPONSE,e[n],c.connectSessionID),r})).catch((function(t){throw wL.rtcGetAccess(t.error.code||t.error.server_code,t.error.message,Date.now()-u,xU.RESPONSE,e.join(","),c.connectSessionID),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(qL.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),ZL={},$L={},QL={exports:{}},ex=QL.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(ex).forEach((function(e){ex[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,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=QL.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var c=n[t][s];if(c.reg.test(i))return r(c,a,i)}})),t.media=o,t};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[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=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+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,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}($L);var tx=QL.exports,rx=/%[sdv%]/g,nx=function(e){var t=1,r=arguments,n=r.length;return e.replace(rx,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},ix=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return nx.apply(null,n)},ox=["v","o","s","i","u","e","p","c","b","t","r","z","a"],ax=["i","c","b","a"],sx=$L,cx=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||ox,n=t.innerOrder||ax,i=[];return r.forEach((function(t){tx[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(ix(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(ix(t,r,e))}))}))})),e.media.forEach((function(e){i.push(ix("m",tx.m[0],e)),n.forEach((function(t){tx[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(ix(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(ix(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};ZL.write=cx,ZL.parse=sx.parse,ZL.parseParams=sx.parseParams,ZL.parseFmtpConfig=sx.parseFmtpConfig,ZL.parsePayloads=sx.parsePayloads,ZL.parseRemoteCandidates=sx.parseRemoteCandidates,ZL.parseImageAttributes=sx.parseImageAttributes,ZL.parseSimulcastStreamList=sx.parseSimulcastStreamList;var ux=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this._iceConfigNode.iceParams,n=ZL.parse(e);return null===(t=n.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"})),ZL.write(n)},e}(),dx=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this,n=this._iceConfigNode.certFingerprint,i=ZL.parse(e);return(null==i?void 0:i.fingerprint)&&(i.fingerprint={type:"sha-256",hash:n}),null===(t=null==i?void 0:i.media)||void 0===t||t.forEach((function(e){return r.modifyMlineByIceNode(e)})),ZL.write(i)},e.prototype.modifyMlineByIceNode=function(e){var t=this._iceConfigNode,r=t.publicIPs,n=t.certFingerprint,i=t.iceParams;e.fingerprint&&(e.fingerprint={type:"sha-256",hash:n}),e.icePwd=i.serverIcePwd,this._iceUfrag||(this._iceUfrag=Sx(i.serverIceUfrag),kL.setStats({connection_id:this._iceUfrag})),e.iceUfrag=this._iceUfrag,e.setup="active",this._candidates||(this._candidates=gx(r)),e.candidates=this._candidates,e.iceOptions="renomination","application"===e.type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144})},e}();function lx(e,t){var r,n=ZL.parse(e),i=[];return n.media=n.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&&i.push(e.mid),e})),(null===(r=n.groups)||void 0===r?void 0:r[0])&&(n.groups[0].mids=i.join(" ")),n}var hx,fx,px,_x,vx,mx=function(e,t){var r,n;try{var i=ZL.parse(e),o=ZL.parse(t),a="".concat(null===(r=o.groups)||void 0===r?void 0:r[0].mids).split(" "),s="".concat(null===(n=i.groups)||void 0===n?void 0:n[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 i.media=i.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 i.groups,delete i.msidSemantic,{partialSdp:ZL.write(i),audioMid:d,videoMid:l}}catch(e){return null}},Ex=function(e,t){var r;try{var n=ZL.parse(e),i=[];return null===(r=n.media)||void 0===r||r.forEach((function(e){(null==t?void 0:t.includes("".concat(e.mid)))&&i.push(e)})),n.media=i,delete n.groups,delete n.msidSemantic,ZL.write(n)}catch(e){return""}},gx=function(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var i={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push(Kp(Kp({},i),{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(Kp(Kp({},i),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n},Sx=function(e){var t=new TextEncoder,r=t.encode("PREC"),n=new Uint8Array(QD.str2ab(e)),i=t.encode(Date.now().toString()).slice(-4),o=new Uint8Array(4);o[0]=0,o[1]=1,o[2]=1,o[3]=1;var a=ZD(Uint8Array,r,n,i,o),s=QD.ab2str(a.buffer);return window.btoa(s)},yx="safari"===(hx="none",$D()||(null!==window.navigator.userAgent.match("Firefox")?hx="mozilla":null!==window.navigator.userAgent.match("Chrome")?(hx="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(hx="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(hx="safari")),hx);!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"}(fx||(fx={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(px||(px={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(_x||(_x={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(vx||(vx={}));var bx=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 fx.candidatePair:r=t.handleCandidatePair;break;case fx.certificate:r=t.handleCertificate;break;case fx.remoteCandidate:r=t.handleRemoteCandidate;break;case fx.remoteInboundRtp:r=t.handleInboundRtp;break;case fx.remoteOutboundRtp:r=t.handleOutboundRtp;break;case fx.sctpTransport:r=t.handleSctpTransport;break;case fx.sender:r=t.handleSender;break;case fx.stream:r=t.handleStream;break;case fx.track:r=t.handleTrack;break;case fx.transceiver:r=t.handleTransceiver;break;case fx.transport:r=t.handleTransport;break;case fx.codec:r=t.handleCodec;break;case fx.csrc:r=t.handleCsrc;break;case fx.dataChannel:r=t.handleDataChannel;break;case fx.iceServer:r=t.handleIceServer;break;case fx.mediaSource:r=t.handleMediaSource;break;case fx.outboundRtp:r=t.handleOutboundRtp;break;case fx.inboundRtp:r=t.handleInboundRtp;break;case fx.peerConnection:r=t.handlePeerConnection;break;case fx.receiver:r=t.handleReceiver;break;case fx.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 Xp(this,void 0,void 0,(function(){var e=this;return Wp(this,(function(t){return[2,new Promise((function(t,r){if(yx||void 0!==window.InstallTrigger)return t(e.stats);try{e.peer.getStats((function(r){r.result().forEach((function(t){if(!Tx.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){return Xp(this,void 0,void 0,(function(){var t;return Wp(this,(function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,this.peer.getStats(e)];case 1:t=r.sent(),this.processStats(t),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.getExtraStats()];case 3:case 4:return r.sent(),[3,5];case 5:return[3,7];case 6:return r.sent(),[3,7];case 7:return[2,this.stats]}}))}))},e}(),Tx=["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"],Ix=function(){return Xp(void 0,void 0,void 0,(function(){var e,t,r,n;return Wp(this,(function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),$D()||!window.RTCPeerConnection||!window.RTCPeerConnection.prototype.addTransceiver||!window.RTCPeerConnection.prototype.createDataChannel)return[2,!1];for(e=navigator.userAgent.toLowerCase(),t=["heytapbrowser","mqqbrowser","miuibrowser"],r=0;r<t.length;r++)if(e.includes(t[r]))return[2,!1];return[4,nk()];case 1:return(n=i.sent())&&(null==n?void 0:n.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))?[2,!0]:[2,!1];case 2:return i.sent(),[2,!1];case 3:return[2]}}))}))},Rx=function(){return"undefined"!=typeof TransformStream&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Ax=new Ok("BasicHandler",3),Cx=Rx(),Ox={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!Cx||void 0},Nx=function(e){function t(){var t=e.call(this)||this;return t._peerConnection=new RTCPeerConnection(Ox),t._dataChannel=t._peerConnection.createDataChannel("signaling"),t._dataChannel.binaryType="arraybuffer",t._peerConnection.ontrack=function(e){var r,n;Ax.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(n=null===(r=e.streams)||void 0===r?void 0:r[0])||void 0===n?void 0:n.id)),t.emit("ontrack",e)},t._peerConnection.onconnectionstatechange=function(e){Ax.print("constructor","onconnectionstatechange ".concat(t._peerConnection.iceConnectionState," -> ").concat(t._peerConnection.connectionState)),"failed"!==t._peerConnection.iceConnectionState&&"closed"!==t._peerConnection.iceConnectionState&&"failed"!==t._peerConnection.connectionState||t.emit("disconnect")},t._peerConnection.oniceconnectionstatechange=function(){var e=t._peerConnection.iceConnectionState;wL.rtcPreIceState(e,VU["".concat(e.toUpperCase())])},t}return Cp(t,e),t.prototype.connect=function(e){return Xp(this,void 0,void 0,(function(){var t,r,n=this;return Wp(this,(function(i){switch(i.label){case 0:return Ax.print("connect","invoke connect"),[4,this._peerConnection.createOffer()];case 1:return t=i.sent(),this._localSdp=new ux(e),[4,this.setLocalDescription(t.sdp)];case 2:return i.sent(),this._remoteSdp=new dx(e),r=this._remoteSdp.modifyByIceNode(t.sdp),[4,this.setRemoteDescription(r)];case 3:return i.sent(),[4,new Promise((function(e,t){n._dataChannel.onopen=function(){Ax.print("connect","dataChannel open"),LL("es.dc.open",""),e("")},n._dataChannel.onerror=function(e){wL.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,BU.INVALID_DATA),LL("es.dc.error",""),t(e)},n._dataChannel.onclose=function(e){LL("es.dc.close",""),t(e)},n._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==n._peerConnection.iceConnectionState&&"closed"!==n._peerConnection.iceConnectionState&&"failed"!==n._peerConnection.connectionState||t(e)}))}))];case 4:return i.sent(),Ax.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){var t;return Xp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E;return Wp(this,(function(g){switch(g.label){case 0:if(r=e.stream,n=null==e?void 0:e.videoTrack,i=null==e?void 0:e.audioTrack,o={},a=[],Array.isArray(null==e?void 0:e.videoEncodeConfig))for(s=null==e?void 0:e.videoEncodeConfig.length,c=null==n?void 0:n.getTrack(),u={width:640,height:480,framerate:30},c&&(d=null==c?void 0:c.getSettings(),u={width:Math.floor(d.width),height:Math.floor(d.height),framerate:Math.floor(d.frameRate)}),o.sendEncodings=[],l=0;l<s;l++)h=null==e?void 0:e.videoEncodeConfig[l],f={maxBitrate:1e3*h.maxKbps},p=Math.pow(2,l),s>1&&(f.rid="".concat(l),f.scaleResolutionDownBy=p),null===(t=o.sendEncodings)||void 0===t||t.unshift(f),a.push({width:Math.floor(u.width/p),height:Math.floor(u.height/p),framerate:u.framerate,maxkbps:h.maxKbps,rid:"".concat(l)});return Ax.print("publish videoTransceiverInit videoDescriptions","",o,a),_=null==i?void 0:i.getTrack(),(null==i?void 0:i.mixType)!==Qp.PLAYOUT&&(null==i?void 0:i.mixedAudioTrack)&&(_=null==i?void 0:i.mixedAudioTrack),e.audioTransceiver=this._peerConnection.addTransceiver(_||"audio",{direction:"sendonly",streams:[r]}),Cx&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver((null==n?void 0:n.getTrack())||"video",Kp({direction:"sendonly",streams:[r]},o)),Cx&&e.initVideoEncodedTransform(),Ax.print("sender.getParameters()",e.videoTransceiver.sender.getParameters()),v=JD(),wL.rtcBeginCreateOffer(GU.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:if(m=g.sent(),wL.rtcCreateOffer(0,HU.UP,e.streamId,e.userId,JD()-v),E=mx(m.sdp,this.getLocalDescriptionSdp()),!m.sdp||!E)throw new Ww(Hw.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Kp(Kp({sdp:m.sdp},E),{type:"incroffer",semantics:"unified-plan",videoDescriptions:a})]}}))}))},t.prototype.subscribe=function(e,t){return Xp(this,void 0,void 0,(function(){var r,n,i,o,a;return Wp(this,(function(s){switch(s.label){case 0:return r="incroffer",n="unified-plan",t?[2,{sdp:this.getLocalDescriptionSdp(),partialSdp:Ex(this.getLocalDescriptionSdp(),[t.audioMid,t.videoMid]),audioMid:t.audioMid,videoMid:t.videoMid,type:r,semantics:n}]:(e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),Cx&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),Cx&&e.initVideoEncodedTransform(),i=JD(),wL.rtcBeginCreateOffer(GU.DOWN,e.streamId,e.userId),[4,this._peerConnection.createOffer()]);case 1:if(o=s.sent(),wL.rtcCreateOffer(0,HU.DOWN,e.streamId,e.userId,JD()-i),a=mx(o.sdp,this.getLocalDescriptionSdp()),!o.sdp||!a)throw new Ww(Hw.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Kp(Kp({sdp:o.sdp},a),{type:r,semantics:n})]}}))}))},t.prototype.setAnswerSdp=function(e,t,r,n,i){var o;return Xp(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return Wp(this,(function(f){switch(f.label){case 0:return wL.rtcRecvAnswer(0,YU.INCRANSWER,0,t,i,n.streamId,n.userId),a=this._peerConnection.remoteDescription,s=ZL.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}),{}),ZL.parse(t).media.forEach((function(e){return c[e.mid]=e})),u=[],d=ZL.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 n=c[e.mid];return null===(t=h._remoteSdp)||void 0===t||t.modifyMlineByIceNode(n),e.bundleOnly||(n.port=e.port),n})),s.media=l,d.groups=[{mids:u.join(" "),type:"BUNDLE"}],s.groups=d.groups,[4,this.setLocalDescription(ZL.write(d),n,i)];case 1:return f.sent(),[4,this.setRemoteDescription(ZL.write(s),n,i)];case 2:return f.sent(),[2]}}))}))},t.prototype.setLocalDescription=function(e,t,r){var n,i;return Xp(this,void 0,void 0,(function(){var o,a,s,c,u,d,l;return Wp(this,(function(h){switch(h.label){case 0:o=null===(n=this._localSdp)||void 0===n?void 0:n.modifyByIceNode(e),a=new RTCSessionDescription({type:"offer",sdp:o}),s=JD(),c=r||KU.UP,u=(null==t?void 0:t.streamId)||"",d=(null===(i=t)||void 0===i?void 0:i.userId)||"",h.label=1;case 1:return h.trys.push([1,3,,4]),Ax.print("setOffer","set offer: ",a),[4,this._peerConnection.setLocalDescription(a)];case 2:return h.sent(),wL.rtcSetDescription(0,a.sdp,zU.W_1,c,u,d,JD()-s,{type:"offer"}),[3,4];case 3:throw(l=h.sent())instanceof Error&&wL.rtcSetDescription(-1,l.message,zU.W_1,c,u,d,JD()-s,{type:"offer"}),l;case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t,r){var n;return Xp(this,void 0,void 0,(function(){var i,o,a,s,c,u;return Wp(this,(function(d){switch(d.label){case 0:i=new RTCSessionDescription({type:"answer",sdp:e}),o=JD(),a=r||KU.UP,s=(null==t?void 0:t.streamId)||"",c=(null===(n=t)||void 0===n?void 0:n.userId)||"",d.label=1;case 1:return d.trys.push([1,3,,4]),Ax.print("setAnswer","set answer: ",i),[4,this._peerConnection.setRemoteDescription(i)];case 2:return d.sent(),wL.rtcSetDescription(0,i.sdp,zU.W_0,a,s,c,JD()-o,{type:"answer"}),[3,4];case 3:throw(u=d.sent())instanceof Error&&wL.rtcSetDescription(-1,u.message,zU.W_0,a,s,c,JD()-o,{type:"answer"}),u;case 4:return[2]}}))}))},t.prototype.getLocalDescriptionSdp=function(){var e,t,r,n;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.localDescription)||void 0===t?void 0:t.sdp)return null===(n=null===(r=this._peerConnection)||void 0===r?void 0:r.localDescription)||void 0===n?void 0:n.sdp;throw Error()},t.prototype.getRemoteDescriptionSdp=function(){var e,t,r,n;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.remoteDescription)||void 0===t?void 0:t.sdp)return null===(n=null===(r=this._peerConnection)||void 0===r?void 0:r.remoteDescription)||void 0===n?void 0:n.sdp;throw Error()},t.prototype.closeMLine=function(e){var t,r;return Xp(this,void 0,void 0,(function(){var n,i,o,a,s=this;return Wp(this,(function(c){switch(c.label){case 0:return Ax.print("closeMids","closeMids: ",e),n=this.getLocalDescriptionSdp(),i=lx(n,e),o=this.getRemoteDescriptionSdp(),a=lx(o,e),[4,this._peerConnection.createOffer()];case 1:return c.sent(),[4,this.setLocalDescription(ZL.write(i))];case 2:return c.sent(),(null===(t=null==i?void 0:i.media)||void 0===t?void 0:t.length)!==(null===(r=null==a?void 0:a.media)||void 0===r?void 0:r.length)&&i.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(i.media)&&Array.isArray(a.media)&&i.media.forEach((function(e,t){a.media[t]&&(a.media[t].mid=e.mid)})),[4,this.setRemoteDescription(ZL.write(a))];case 3:return c.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return Xp(this,void 0,void 0,(function(){var e;return Wp(this,(function(t){switch(t.label){case 0:return[4,nk()];case 1:if(!(e=t.sent()))throw new Ww(Hw.NOT_SUPPORTED,"Get offer Error");return[2,{sdp:e,semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.getStats=function(e){return t=this._peerConnection,r=e,Xp(void 0,void 0,void 0,(function(){var e;return Wp(this,(function(n){switch(n.label){case 0:return e=[],t instanceof RTCPeerConnection?[4,new bx(t).getStats(r)]:[2,e];case 1:return[2,e=n.sent()]}}))}));var t,r},t.prototype.rollback=function(e,t){var r;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(n){switch(n.label){case 0:return Ax.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:n.sent(),n.label=2;case 2:return[4,this.closeMLine(t)];case 3:return n.sent(),[2]}}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}(vk.exports.EventEmitter),wx=new Ok("Locker",2),Dx=1,kx=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=Dx++,e&&(this.name=e),wx.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,wx.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,wx.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),n=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),n},e}(),Px=Math.log,Mx=Math.LOG10E;Xn({target:"Math",stat:!0},{log10:Math.log10||function(e){return Px(e)*Mx}}),Xn({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new Ok("Stats",2);var Ux,Lx=function(){function e(e,t){this._client=e,this._handler=t,this.dataChannelRTT={},this._rttTimer={},this._remoteStreamStasEvtIntervals={},this._localStreamStasEvtIntervals={},this._firstFrameStarted={},this._videoInWaiting={}}return e.prototype.setRemoteStreamStatsEvtInterval=function(e){var t,r,n=this;this.getDataChannelRTT(e.userId);var i={audio:{},video:{},remoteStream: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.getRemoteAudioStats(o,i),this.getRemoteVideoStats(a,i),this.delRemoteStreamStatsEvtInterval(e);this._remoteStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Xp(n,void 0,void 0,(function(){var t;return Wp(this,(function(r){switch(r.label){case 0:return[4,Xp(n,void 0,void 0,(function(){var t,r,n,o,a,s;return Wp(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.getRemoteAudioStats(t,i)];case 1:return n=c.sent(),[4,this.getRemoteVideoStats(r,i)];case 2:return(o=c.sent()).isScreen=e.isScreen,[2,{audioStats:n,videoStats:o,isScreen:e.isScreen,userId:e.userId}]}}))}))];case 1:return t=r.sent(),this._client.emit("onRemoteStreamStats",t),[2]}}))}))}),2e3)},e.prototype.delRemoteStreamStatsEvtInterval=function(e){clearInterval(this._remoteStreamStasEvtIntervals[e.streamId])},e.prototype.unsubscribe=function(e){this.delRemoteStreamStatsEvtInterval(e),clearTimeout(this._rttTimer[e.userId]),this._videoInWaiting[e.streamId]=!1,this._firstFrameStarted["".concat(e.streamId,"-audio")]&&(wL.rtcFirstFrame({event_type:eL.RECV_END,media_type:e.isScreen?tL.SCREEN_AUDIO:tL.AUDIO,type:rL.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-audio")],event_session_id:e.streamId,result:!1,reason:nL.UNSUBSCRIBE,stream_user_id:e.userId}),delete this._firstFrameStarted["".concat(e.streamId,"-audio")]),this._firstFrameStarted["".concat(e.streamId,"-video")]&&(wL.rtcFirstFrame({event_type:eL.RECV_END,media_type:e.isScreen?tL.SCREEN_VIDEO:tL.VIDEO,type:rL.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-video")],event_session_id:e.streamId,result:!1,reason:nL.UNSUBSCRIBE,stream_user_id:e.userId}),delete this._firstFrameStarted["".concat(e.streamId,"-video")])},e.prototype.getRemoteAudioStats=function(e,t){return Xp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,f,p=this;return Wp(this,(function(_){switch(_.label){case 0:return r={},n={timestamp:Date.now()},i=t.remoteStream,o=i.streamId,a=i.userId,s=i.isScreen,c=i.audioMid,u=i.hasAudio,d={media_type:"audio",direction:"down",stream_id:o,stream_user_id:a,vid:c,remote_muted:!u},e&&this._handler?(t.audioStart||(t.audioStart=JD(),wL.rtcFirstFrame({event_type:eL.BEGIN_RECV,media_type:s?tL.SCREEN_AUDIO:tL.AUDIO,type:rL.SUBSCRIBE,start:t.audioStart,event_session_id:o,stream_user_id:a}),u?this._firstFrameStarted["".concat(o,"-audio")]=t.audioStart:wL.rtcFirstFrame({event_type:eL.RECV_END,media_type:s?tL.SCREEN_AUDIO:tL.AUDIO,type:rL.PUBLISH,start:t.audioStart,event_session_id:o,result:!1,reason:nL.DISABLE,stream_user_id:a})),[4,this._handler.getStats(e)]):[2,r];case 1:return(l=_.sent()).length?(l.forEach((function(e){var i=e.type,c=e.packetsLost,u=e.packetsReceived,l=e.bytesReceived,h=e.jitterBufferDelay,f=e.jitterBufferEmittedCount,_=e.clockRate,v=e.channels,m=e.totalSamplesReceived,E=e.concealedSamples,g=e.concealmentEvents,S=e.totalRoundTripTime,y=e.state,b=e.currentRoundTripTime,T=e.audioLevel,I=e.totalAudioEnergy,R=e.totalSamplesDuration,A=e.mimeType,C=e.googDecodingNormal,O=e.fecPacketsReceived,N=e.availableIncomingBitrate,w=e.availableOutgoingBitrate,D=e.bytesSent,k=e.nominated,P=e.id,M=e.writable,U=e.jitter,L=e.candidateType,x=e.ip,V=e.address,B=e.networkType,j=e.port,F=e.protocol,G=e.audioOutputLevel,H=e.requestsReceived,z=e.responsesReceived,K=e.requestsSent,Y=e.consentRequestsSent,X=e.responsesSent,W=e.ssrc,q=e.kind;"inbound-rtp"===i?(n.packetsLost=c,n.packetsReceived=u,d.packets=u,n.bytesReceived=l,d.bytes=l,void 0!==h&&(r.jitterBufferDelay=h/f*1e3,d.jitter_buffer_delay=r.jitterBufferDelay),void 0!==m&&(n.totalSamplesReceived=m,r.concealedSamples=E,n.concealedSamples=E,d.concealed_samples=E,r.concealmentEvents=g,d.total_samples_received=m),void 0!==O&&(d.fec_packets_received=O),d.jitter=1e3*U,d.ssrc=W,m>0&&p._firstFrameStarted["".concat(o,"-audio")]&&(wL.rtcFirstFrame({event_type:eL.RECV_END,media_type:s?tL.SCREEN_AUDIO:tL.AUDIO,type:rL.SUBSCRIBE,event_session_id:o,result:!0,start:t.audioStart,stream_user_id:a}),delete p._firstFrameStarted["".concat(o,"-audio")])):"codec"===i?(r.recordSampleRate=_,v&&(r.numChannels=v),d.codec=A):"candidate-pair"===i?(d.ice_available_incoming_bitrate=N,d.ice_available_outgoing_bitrate=w,d.ice_bytes_received=l,d.ice_bytes_sent=D,d.ice_nominated=+k,d.ice_pair_id=P,d.ice_pair_rtt=b,d.rtt=1e3*b,d.ice_pair_state=y,d.ice_pair_writable=M,d.recv_ping_requests=H,d.recv_ping_responses=z,d.sent_ping_requests_before_first_response=K,d.sent_ping_requests_total=K+(Y||0),d.sent_ping_responses=X,"succeeded"===y&&(r.rtt=1e3*b,r.total_rtt=1e3*S)):"track"===i&&"audio"===q?(d.audio_level=-10*Math.log10(Math.pow(T,2)),d.volume=255*T,d.total_audio_energy=I,d.total_samples_duration=R):"ssrc"===i?(d.decoding_normal=C,d.recv_level=G):"local-candidate"===i?(d.local_candidate_type=L,d.local_ip=x||V,d.local_network_type=B,d.local_port=j,d.protocol=F):"remote-candidate"===i&&(d.remote_candidate_type=L,d.remote_ip=x||V,d.remote_port=j)})),(h=t.audio).timestamp?(r.audioLossRate=(n.packetsLost-h.packetsLost)/(n.packetsReceived-h.packetsReceived+(n.packetsLost-h.packetsLost)),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,d.packets_lost=Math.round(n.packetsLost-h.packetsLost),d.fraction_lost=r.audioLossRate,d.packets_lost_rate=r.audioLossRate,r.statsInterval=n.timestamp-h.timestamp,r.receivedKBitrate=(n.bytesReceived-h.bytesReceived||0)/r.statsInterval,d.bitrate=Math.round(8e3*r.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),void 0!==n.concealedSamples&&(d.interval_concealed_samples=n.concealedSamples-h.concealedSamples,d.interval_samples_received=n.totalSamplesReceived-h.totalSamplesReceived,r.receivedSampleRate=1e3*d.interval_samples_received/r.statsInterval),t.audio=n,this.dataChannelRTT[t.remoteStream.userId]&&(f=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=f+(r.jitterBufferDelay||0),d.web_e2e_delay=r.e2eDelay,d.total_rtt_ms=f),t.remoteStream.subAudio&&wL.rtcMediaStatistics(d,{}),[2,r]):(t.audio=n,[2,r])):[2,r]}}))}))},e.prototype.getRemoteVideoStats=function(e,t){return Xp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,f,p=this;return Wp(this,(function(_){switch(_.label){case 0:return r={},n={timestamp:Date.now()},i=t.remoteStream,o=i.streamId,a=i.userId,s=i.isScreen,c=i.hasVideo,u={media_type:"video",direction:"down",stream_id:o,stream_user_id:a,vid:t.remoteStream.videoMid,remote_muted:!c},e&&this._handler?(t.videoStart||(t.videoStart=JD(),wL.rtcFirstFrame({event_type:eL.BEGIN_RECV,media_type:s?tL.SCREEN_VIDEO:tL.VIDEO,type:rL.SUBSCRIBE,start:t.videoStart,event_session_id:o,stream_user_id:a}),c?this._firstFrameStarted["".concat(o,"-video")]=t.videoStart:wL.rtcFirstFrame({event_type:eL.RECV_END,media_type:s?tL.SCREEN_VIDEO:tL.VIDEO,type:rL.PUBLISH,start:t.videoStart,event_session_id:o,result:!1,reason:nL.DISABLE,stream_user_id:a})),[4,this._handler.getStats(e)]):[2,r];case 1:return(d=_.sent()).length?(d.forEach((function(e){var i=e.type,c=e.frameHeight,d=e.frameWidth,l=e.packetsLost,h=e.packetsReceived,f=e.bytesReceived,_=e.framesDecoded;e.roundTripTime;var v=e.jitterBufferDelay,m=e.jitterBufferEmittedCount,E=e.mimeType,g=e.firCount,S=e.availableIncomingBitrate,y=e.availableOutgoingBitrate,b=e.bytesSent,T=e.nominated,I=e.id,R=e.currentRoundTripTime,A=e.state,C=e.writable,O=e.candidateType,N=e.ip,w=e.address,D=e.networkType,k=e.port,P=e.nackCount,M=e.pliCount,U=e.protocol,L=e.requestsReceived,x=e.responsesReceived,V=e.requestsSent,B=e.consentRequestsSent,j=e.responsesSent,F=e.ssrc;e.totalRoundTripTime;var G=e.kind,H=e.jitter,z=e.framesReceived,K=e.keyFramesDecoded,Y=e.totalDecodeTime,X=e.decoderImplementation,W=e.lastPacketReceivedTimestamp;"inbound-rtp"===i?(n.packetsLost=l,u.packets_lost=l,n.packetsReceived=h,u.packets=h,n.bytesReceived=f,u.bytes=f,n.framesDecoded=_,void 0!==v&&(n.jitterBufferDelay=v/m*1e3,u.jitter_buffer_delay=n.jitterBufferDelay),u.fir_count=g,u.nack_count=P,u.pli_count=M,u.ssrc=F,u.jitter=H,u.frames_received=z,u.frames_decoded=_,u.key_frames_decoded=K,u.total_decode_time=Y,u.decoder_implementation=X,u.last_packet_received_timestamp=W,_>0&&p._firstFrameStarted["".concat(o,"-video")]&&(wL.rtcFirstFrame({event_type:eL.RECV_END,media_type:s?tL.SCREEN_VIDEO:tL.VIDEO,type:rL.SUBSCRIBE,event_session_id:o,result:!0,start:t.videoStart,stream_user_id:a}),delete p._firstFrameStarted["".concat(o,"-video")])):"track"===i&&"video"===G?(r.width=d,u.frame_size_width=d,r.height=c,u.frame_size_height=c,void 0!==z&&(u.frames_received=z)):"codec"===i?u.codec=E:"candidate-pair"===i?(u.ice_available_incoming_bitrate=S,u.ice_available_outgoing_bitrate=y,u.ice_bytes_received=f,u.ice_bytes_sent=b,u.ice_nominated=+T,u.ice_pair_id=I,u.ice_pair_rtt=R,u.rtt=1e3*R,r.rtt=u.rtt,u.ice_pair_state=A,u.ice_pair_writable=C,u.recv_ping_requests=L,u.recv_ping_responses=x,u.sent_ping_requests_before_first_response=V,u.sent_ping_requests_total=V+(B||0),u.sent_ping_responses=j):"local-candidate"===i?(u.local_candidate_type=O,u.local_ip=N||w,u.local_network_type=D,u.local_port=k,u.protocol=U):"remote-candidate"===i&&(u.remote_candidate_type=O,u.remote_ip=N||w,u.remote_port=k)})),l=t.video,h=t.remoteStream,l.timestamp?(r.videoLossRate=(n.packetsLost-l.packetsLost)/(n.packetsReceived-l.packetsReceived+(n.packetsLost-l.packetsLost)),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,u.fraction_lost=r.videoLossRate,u.packets_lost_rate=r.videoLossRate,r.statsInterval=n.timestamp-l.timestamp,r.receivedKBitrate=(n.bytesReceived-l.bytesReceived||0)/r.statsInterval,u.bitrate=Math.round(8e3*r.receivedKBitrate),u.bandwidth=Math.round(u.bitrate/1024),r.decoderOutputFrameRate=1e3*(n.framesDecoded-l.framesDecoded)/r.statsInterval,u.frame_rate_decoded=Math.round(r.decoderOutputFrameRate),u.frame_rate_received=u.frame_rate_decoded,t.video=n,this.dataChannelRTT[t.remoteStream.userId]&&(f=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=f+(n.jitterBufferDelay||0),u.web_e2e_delay=r.e2eDelay,u.total_rtt_ms=f),h.subVideo&&(this.processStall(h,u),wL.rtcMediaStatistics(u,{})),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.processStall=function(e,t){var r=0,n=0,i=0;e.recordedVideoFrames.forEach((function(e){e.isStall&&(r+=e.stallCount,n+=e.stallDuration),i=e.playTime})),e.recordedVideoFrames.length||(n=2e3,r=this._videoInWaiting[e.streamId]?0:1,this._videoInWaiting[e.streamId]=!0);var o=e.recordedVideoFrames.pop();o&&(o.isStall?this._videoInWaiting[e.streamId]=!0:this._videoInWaiting[e.streamId]=!1),e.recordedVideoFrames=[],t.stall_count=r,t.stall_duration=n,t.play_time=i},e.prototype.setLocalStreamStatsEvtInterval=function(e){var t,r,n=this,i={audio:{},video:{},localStream:e,firstframeReported:!1},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,i),this.getVideoStats(a,i),this.delLocalStreamStatsEvtInterval(e);this._localStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Xp(n,void 0,void 0,(function(){var t;return Wp(this,(function(r){switch(r.label){case 0:return[4,Xp(n,void 0,void 0,(function(){var t,r,n,o,a,s;return Wp(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,i)];case 1:return n=c.sent(),[4,this.getVideoStats(r,i)];case 2:return(o=c.sent()).isScreen=e.isScreen,[2,{audioStats:n,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),this._firstFrameStarted["".concat(e.streamId,"-audio")]&&(wL.rtcFirstFrame({event_type:eL.SENT_END,media_type:e.isScreen?tL.SCREEN_AUDIO:tL.AUDIO,type:rL.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-audio")],event_session_id:e.streamId,result:!1,reason:nL.UNPUBLISH}),delete this._firstFrameStarted["".concat(e.streamId,"-audio")]),this._firstFrameStarted["".concat(e.streamId,"-video")]&&(wL.rtcFirstFrame({event_type:eL.SENT_END,media_type:e.isScreen?tL.SCREEN_VIDEO:tL.VIDEO,type:rL.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-video")],event_session_id:e.streamId,result:!1,reason:nL.UNPUBLISH}),delete this._firstFrameStarted["".concat(e.streamId,"-video")])},e.prototype.getAudioStats=function(e,t){return Xp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l=this;return Wp(this,(function(h){switch(h.label){case 0:return r={},n={timestamp:Date.now()},i=t.localStream,o=i.streamId,a=i.audioMid,s=i.isScreen,c={media_type:"audio",direction:"up",stream_id:o,vid:a},e&&this._handler?(t.audioStart||(t.audioStart=JD(),wL.rtcFirstFrame({event_type:eL.BEGIN_SEND,media_type:s?tL.SCREEN_AUDIO:tL.AUDIO,type:rL.PUBLISH,start:t.audioStart,event_session_id:o}),this._firstFrameStarted["".concat(o,"-audio")]=t.audioStart),[4,this._handler.getStats(e)]):[2,r];case 1:return(u=h.sent()).length?(u.forEach((function(e){var i=e.type,a=e.packetsSent,u=e.packetsLost,d=e.bytesSent,h=e.clockRate,f=e.roundTripTime,p=e.channels,_=e.audioLevel,v=e.googRtt,m=e.mimeType,E=e.availableIncomingBitrate,g=e.availableOutgoingBitrate,S=e.bytesReceived,y=e.nominated,b=e.id,T=e.currentRoundTripTime,I=e.state,R=e.writable,A=e.requestsReceived,C=e.responsesReceived,O=e.requestsSent,N=e.consentRequestsSent,w=e.responsesSent,D=e.jitter,k=e.candidateType,P=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.nackCount,B=e.retransmittedBytesSent,j=e.retransmittedPacketsSent,F=e.roundTripTimeMeasurements,G=e.audioInputLevel,H=e.ssrc,z=e.totalAudioEnergy,K=e.totalSamplesDuration,Y=e.mediaType;"outbound-rtp"===i?(n.packetsSent=a,a>0&&l._firstFrameStarted["".concat(o,"-audio")]&&(wL.rtcFirstFrame({event_type:eL.SENT_END,media_type:s?tL.SCREEN_AUDIO:tL.AUDIO,type:rL.PUBLISH,event_session_id:o,result:!0,start:t.audioStart}),delete l._firstFrameStarted["".concat(o,"-audio")]),n.bytesSent=d,c.bytes=d,c.packets=a,c.nack_count=V,c.ssrc=H,c.retransmitted_bytes_sent=B,c.retransmitted_packets_sent=j):"remote-inbound-rtp"===i?(n.packetsLost=u,c.packets_lost=u,c.jitter=1e3*D,r.rtt=1e3*f,c.rtt=r.rtt,c.round_trip_time_measurements=F):"codec"===i?(r.recordSampleRate=h,r.numChannels=p,c.codec=m):"media-source"===i?(c.audio_level=-10*Math.log10(Math.pow(_,2)),c.volume=255*_,c.total_audio_energy=z,c.total_samples_duration=K):"ssrc"===i&&"audio"===Y?(c.audio_network_elapse=v,c.send_level=G):"candidate-pair"===i?(c.ice_available_incoming_bitrate=E,c.ice_available_outgoing_bitrate=g,c.ice_bytes_received=S,c.ice_bytes_sent=d,c.ice_nominated=+y,c.ice_pair_id=b,c.ice_pair_rtt=T,c.ice_pair_state=I,c.ice_pair_writable=R,c.recv_ping_requests=A,c.recv_ping_responses=C,c.sent_ping_requests_before_first_response=O,c.sent_ping_requests_total=O+(N||0),c.sent_ping_responses=w):"local-candidate"===i?(c.local_candidate_type=k,c.local_ip=P||M,c.local_network_type=U,c.local_port=L,c.protocol=x):"remote-candidate"===i&&(c.remote_candidate_type=k,c.remote_ip=P||M,c.remote_port=L)})),(d=t.audio).timestamp?(void 0!==n.packetsLost&&(r.audioLossRate=(n.packetsLost-d.packetsLost)/(n.packetsSent-d.packetsSent),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,c.fraction_lost=r.audioLossRate),r.statsInterval=n.timestamp-d.timestamp,r.sentKBitrate=(n.bytesSent-d.bytesSent||0)/r.statsInterval,c.bitrate=Math.round(8e3*r.sentKBitrate),c.bandwidth=Math.round(c.bitrate/1024),t.audio=n,wL.rtcMediaStatistics(c,{}),[2,r]):(t.audio=n,[2,r])):[2,r]}}))}))},e.prototype.getVideoStats=function(e,t){return Xp(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l=this;return Wp(this,(function(h){switch(h.label){case 0:return r={},n={timestamp:Date.now()},i=t.localStream,o=i.streamId,a=i.videoMid,s=i.isScreen,c={media_type:"video",direction:"up",stream_id:o,vid:a},e&&this._handler?(t.videoStart||(t.videoStart=JD(),wL.rtcFirstFrame({event_type:eL.BEGIN_SEND,media_type:s?tL.SCREEN_VIDEO:tL.VIDEO,type:rL.PUBLISH,start:t.videoStart,event_session_id:o}),this._firstFrameStarted["".concat(o,"-video")]=t.videoStart),[4,this._handler.getStats(e)]):[2,r];case 1:return(u=h.sent()).length?(u.forEach((function(e){var i=e.type,a=e.framesEncoded,u=e.packetsLost,d=e.bytesSent,h=e.framesSent,f=e.roundTripTime,p=e.mimeType,_=e.frameWidth,v=e.frameHeight,m=e.clockRate,E=e.packetsSent,g=e.googActualEncBitrate,S=e.googAvailableReceiveBandwidth,y=e.googAvailableSendBandwidth,b=e.googAvgEncodeMs,T=e.googBucketDelay,I=e.googEncodeUsagePercent,R=e.googFrameRateInput,A=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesReceived,N=e.nominated,w=e.id,D=e.currentRoundTripTime,k=e.state,P=e.writable,M=e.candidateType,U=e.ip,L=e.address,x=e.networkType,V=e.port,B=e.nackCount,j=e.pliCount,F=e.protocol,G=e.qpSum,H=e.requestsReceived,z=e.responsesReceived,K=e.googRetransmitBitrate,Y=e.requestsSent,X=e.consentRequestsSent,W=e.responsesSent,q=e.ssrc,J=e.googTargetEncBitrate,Z=e.googTransmitBitrate,$=e.googRtt,Q=e.retransmittedPacketsSent,ee=e.encoderImplementation,te=e.jitter;"outbound-rtp"===i?(n.framesEncoded=a,n.bytesSent=d,c.bytes=d,n.packetsSent=E,c.packets=E,c.nack_count=B,c.pli_count=j,c.qp_sum=G,c.ssrc=q,c.retransmitted_packets_sent=Q,c.encoder_implementation=ee):"track"===i?(h&&(n.framesSent=h,h>0&&l._firstFrameStarted["".concat(o,"-video")]&&(t.firstframeVideoReported=!0,wL.rtcFirstFrame({event_type:eL.SENT_END,media_type:s?tL.SCREEN_VIDEO:tL.VIDEO,type:rL.PUBLISH,start:t.videoStart,event_session_id:o,result:!0}),delete l._firstFrameStarted["".concat(o,"-video")])),r.encodedFrameWidth=_,r.encodedFrameHeight=v,c.frame_size_height=v,c.frame_size_width=_):"remote-inbound-rtp"===i?(n.packetsLost=u,r.rtt=1e3*f,c.rtt=r.rtt,c.jitter=te,c.packets_lost=u):"codec"===i?(r.codecType=p,c.codec=p,r.inputFrameRate=m):"candidate-pair"===i?(c.ice_available_incoming_bitrate=A,c.ice_available_outgoing_bitrate=C,c.ice_bytes_received=O,c.ice_bytes_sent=d,c.ice_nominated=+N,c.ice_pair_id=w,c.ice_pair_rtt=D,c.ice_pair_state=k,c.ice_pair_writable=P,c.recv_ping_requests=H,c.recv_ping_responses=z,c.sent_ping_requests_before_first_response=Y,c.sent_ping_requests_total=Y+X,c.sent_ping_responses=W):"local-candidate"===i?(c.local_candidate_type=M,c.local_ip=U||L,c.local_network_type=x,c.local_port=V,c.protocol=F):"remote-candidate"===i?(c.remote_candidate_type=M,c.remote_ip=U||L,c.remote_port=V):"VideoBwe"===i?(c.actual_enc_bitrate=g,c.available_receive_bandwidth=S,c.available_send_bandwidth=y,c.bucket_delay=T,c.retransmit_bitrate=K,c.target_enc_bitrate=J,c.transmit_bitrate=Z):"ssrc"===i&&(c.video_network_elapse=$,c.avg_encode_ms=b,c.encode_usage_percent=I,c.frame_rate_input=R)})),(d=t.video).timestamp?(r.statsInterval=n.timestamp-d.timestamp,r.encodedFrameCount=void 0!==n.framesSent?n.framesSent-d.framesSent:n.framesEncoded-d.framesEncoded,r.sentKBitrate=(n.bytesSent-d.bytesSent||0)/r.statsInterval,c.bitrate=Math.round(8e3*r.sentKBitrate),c.bandwidth=Math.round(c.bitrate/1024),r.encoderOutputFrameRate=1e3*(n.framesEncoded-d.framesEncoded)/r.statsInterval,c.frame_rate_encoded=Math.round(r.encoderOutputFrameRate),r.sentFrameRate=1e3*r.encodedFrameCount/r.statsInterval,c.frame_rate_sent=Math.round(r.sentFrameRate),r.videoLossRate=(n.packetsLost-d.packetsLost)/(n.packetsSent-d.packetsSent),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,c.fraction_lost=r.videoLossRate,t.video=n,wL.rtcMediaStatistics(c,{}),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.getDataChannelRTT=function(e){var t,r=this,n=JD();null===(t=this._client.sendUserMessage(e,"__web__rtc__rtt__"))||void 0===t||t.then((function(t){if("timeout"!==t){var i=Date.now()-n;i>0&&i<2e3&&(r.dataChannelRTT[e]=i)}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])})),this._rttTimer={},this.dataChannelRTT={},this._videoInWaiting={}},e}(),xx=new Ok("MediaServerClient",2),Vx=5e3;!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(Ux||(Ux={}));var Bx=function(e,t){xx.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)},jx=function(e){function t(){var t=e.call(this)||this;return t._ontrackCallbackMap=new Map,t._pubSubLock=new kx("pubSubLock"),t._joinLeaveLock=new kx("joinLeaveLock"),t._state=Ux.DISCONNECTED,t._roomAttributes={multiChatMode:!1,bigRoomMode:!1},t}return Cp(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){xx.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(bL.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[yL.ON_ADD_STREAM,yL.ON_REMOVE_STREAM,yL.USER_CONNECTION,yL.USER_DISCONNECTION,yL.ON_UPDATE_STREAM_ATTRIBUTES,yL.ON_UPDATE_ROOM_ATTRIBUTES,yL.ON_PUSH_TRACK,yL.ON_REMOVE_TRACK,yL.NODE_CHANGE,yL.ON_CUSTOM_MESSAGE,yL.USER_MESSAGE_RECEIVED,yL.USER_BINARY_MESSAGE_RECEIVED,yL.POST_PROCESSING_MESSAGE].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(){xx.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(bL.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(bL.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.join=function(e,t,r,n){var i,o;return void 0===t&&(t={}),void 0===r&&(r=!1),Xp(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,f,p=this;return Wp(this,(function(_){switch(_.label){case 0:return xx.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,r,n),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._sessionId=YD(),kL.setStats({rtc_session_id:this._sessionId}),this.connectionState=Ux.CONNECTING,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),t.node?(a=t.node,LL("es.join.nodeChange",t),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return p.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new JL,[4,null===(i=this._iceConfigRequestManager)||void 0===i?void 0:i.getAccessNode(this._appId,this._roomId,this._clientId,WL.getDeviceId(),null==t?void 0:t.reason,this._prevICENode)];case 2:if(!(a=_.sent()))throw LL("es.join.getNodeFailed",""),new Ww(Hw.ICE_SERVER_WRONG,"get ICE config failed");LL("es.join.getNodeSuccess",a),_.label=3;case 3:this._prevICENode=a,this._handler=new Nx,this._addHandlerEvents(),this._statsReport=new Lx(this,this._handler),Promise.resolve().then((function(){return p.emit("onEstablishConnectionHook")})),_.label=4;case 4:return _.trys.push([4,6,,7]),[4,this._handler.connect(a)];case 5:return s=_.sent(),xx.print("join","establish peerConnection success"),[3,7];case 6:throw c=_.sent(),this.connectionState=Ux.DISCONNECTED,new Ww(Hw.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",c);case 7:return this._dataChannelSignal=new FL(s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[4,null===(o=this._handler)||void 0===o?void 0:o.getDefaultSdp()];case 8:u=_.sent(),d={Authorization:QD.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId,timestamp:Date.now(),controlMessage:n,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role},params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:$k.VERSION,deviceId:WL.getDeviceId(),appId:this._appId,roomId:this._roomId,userId:this._clientId,businessId:this._businessId},options:{enableUnBundleMode:!0},sdpInfo:u},Promise.resolve().then((function(){return p.emit("onSendingJoinMessageHook")})),_.label=9;case 9:return _.trys.push([9,11,,12]),l=r?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(l,d)];case 10:return h=_.sent(),xx.print("join","send join message success"),this._authorization=d.Authorization,this.connectionState=Ux.CONNECTED,[2,h];case 11:if(f=_.sent(),this.connectionState=Ux.DISCONNECTED,705===(null==f?void 0:f.code))throw new Ww(Hw.INVALID_TOKEN,(null==f?void 0:f.message)||"Invalid token");if(200!==(null==f?void 0:f.code))throw new Ww(Hw.JOIN_ROOM_FAILED,(null==f?void 0:f.message)||"Join room failed");return[3,12];case 12:return[2]}}))}))},t.prototype.publish=function(e){var t,r,n,i,o,a,s,c;return Xp(this,void 0,void 0,(function(){var u,d,l,h,f,p,_,v,m,E,g;return Wp(this,(function(S){switch(S.label){case 0:xx.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=JD(),h="",f="",p="",S.label=1;case 1:return S.trys.push([1,5,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e)];case 2:if(!(_=S.sent()))throw new Ww(Hw.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return h=_.audioMid,f=_.videoMid,p=_.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===(n=null==d?void 0:d.getTrack())||void 0===n?void 0:n.enabled)},v={attributes:Kp({videoDescriptions:_.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:h,videoMid:f,sdpInfo:{msid:e.stream.id,type:_.type,sdp:_.partialSdp,semantics:_.semantics}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("publish",v)];case 3:if(200!==(null==(m=S.sent())?void 0:m.code))throw new Ww(Hw.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");return E=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,E,void 0,e,KU.UP)];case 4:return S.sent(),e.streamId=m.streamId,e.videoMid=f,e.audioMid=h,wL.rtcPublishStat(WU.SUCCESS,qU.W_0,l,JU.UNKNOWN),null===(s=this._statsReport)||void 0===s||s.setLocalStreamStatsEvtInterval(e),[2];case 5:return(g=S.sent())instanceof Error&&wL.rtcPublishStat(WU.FAIL,qU.W_0,l,g.message),h&&f?[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(p,[h,f])]:[3,7];case 6:S.sent(),S.label=7;case 7:throw g;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,r,n,i,o,a;return Xp(this,void 0,void 0,(function(){var s,c,u,d,l,h,f,p,_,v,m,E,g,S,y,b;return Wp(this,(function(T){switch(T.label){case 0:xx.print("updatePubTrack()","localStream: %o",e),s=e.videoTrack,c=e.audioTrack,null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack((null==s?void 0:s.getTrack())||null),c?(u=c.mixType,d=c.mixedAudioTrack,l=null==c?void 0:c.getTrack(),d&&u!==Qp.PLAYOUT&&!0===l.enabled&&(l=d),null===(r=e.audioTransceiver)||void 0===r||r.sender.replaceTrack(l)):null===(n=e.audioTransceiver)||void 0===n||n.sender.replaceTrack(null),h={localaudio:!!c,localvideo:!!s,videostream:!!(null===(i=null==s?void 0:s.getTrack())||void 0===i?void 0:i.enabled),audiostream:!!(null===(o=null==c?void 0:c.getTrack())||void 0===o?void 0:o.enabled)},f={};try{for(p=qp(Object.entries(h)),_=p.next();!_.done;_=p.next())v=Jp(_.value,2),m=v[0],(E=v[1])!==Reflect.get(e.pubAttributes,m)&&Reflect.set(f,m,E)}catch(e){y={error:e}}finally{try{_&&!_.done&&(b=p.return)&&b.call(p)}finally{if(y)throw y.error}}return Object.keys(f).length?(e.pubAttributes=h,g={roomId:this._roomId,streamId:e.streamId,attributes:f},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateStreamAttributes",g)]):[2];case 1:if(200!==(null==(S=T.sent())?void 0:S.code))throw new Ww(Hw.UPDATE_TRACK_FAILED,(null==S?void 0:S.message)||"update track failed");return[2]}}))}))},t.prototype.unpublish=function(e){var t,r,n;return Xp(this,void 0,void 0,(function(){var i,o;return Wp(this,(function(a){switch(a.label){case 0:return xx.print("unpublish()","localStream: %o",e),i={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unpublish",i)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new Ww(Hw.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===(n=this._statsReport)||void 0===n||n.unpublish(e),[2]}}))}))},t.prototype.subscribe=function(e,t,r){var n,i,o,a,s,c,u,d,l;return Xp(this,void 0,void 0,(function(){var h,f,p,_,v,m,E,g,S,y,b,T,I,R,A,C,O,N,w,D;return Wp(this,(function(k){switch(k.label){case 0:if(e.hasSubscribed)return[2,this._updateSubTrack(e,t,r)];xx.print("subscribe()","mediaType: %o, config: %o",t,r),Bx("subscribe()",e),h=!1,f=!1,t===Bp.VIDEO_ONLY?h=!0:t===Bp.AUDIO_ONLY?f=!0:t===Bp.AUDIO_AND_VIDEO?(h=!0,f=!0):t===Bp.NONE&&(h=!1,f=!1),p=JD(),_=e.audioMid,v=e.videoMid,E=!1,k.label=1;case 1:return k.trys.push([1,12,,15]),_&&v?(E=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e,{audioMid:_,videoMid:v})]):[3,3];case 2:return m=k.sent(),[3,5];case 3:return[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e)];case 4:if(!(m=k.sent()))throw new Ww(Hw.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,k.label=5;case 5:return g={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()||f,video:h},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("subscribe",g)];case 6:if(200!==(null==(S=k.sent())?void 0:S.code))throw new Ww(Hw.SUBSCRIBE_FAILED,(null==S?void 0:S.message)||"subscribe failed");return y=[],b=!this._multiChatMode(),!(_&&v)&&y.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new Ww(Hw.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),Vx);e.on("ontrack",(function r(i){"video"===i.mediaType&&(xx.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),b&&y.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new Ww(Hw.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),Vx);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(xx.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),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==S?void 0:S.relayMessage,R=I.audioMid,A=I.videoMid,C=I.sequenceId,O=I.sdp,E&&_!==R?(xx.print("subscribe","mid mot match",_,R),[4,null===(s=this._handler)||void 0===s?void 0:s.closeMLine([_,v])]):[3,9];case 7:return k.sent(),[4,null===(c=this._handler)||void 0===c?void 0:c.subscribe(e)];case 8:if(!(m=k.sent()))throw new Ww(Hw.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,k.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,KU.DOWN)];case 10:return k.sent(),[4,Promise.all(y)];case 11:return k.sent(),this._multiChatMode()||(e.subAudio=f),e.subVideo=h,wL.rtcSubscribeStat(ZU.SUCCESS,p,$U.UNKNOWN,e.userId),null===(d=this._statsReport)||void 0===d||d.setRemoteStreamStatsEvtInterval(e),[2];case 12:return(w=k.sent())instanceof Error&&wL.rtcSubscribeStat(ZU.FAIL,p,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:k.sent(),k.label=14;case 14:throw w;case 15:return[2]}}))}))},t.prototype.controlMessage=function(e){var t;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){switch(r.label){case 0:return xx.print("controlMessage()","params: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",Kp(Kp({},e),{roomId:this._roomId}))];case 1:return r.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){switch(r.label){case 0:return xx.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 Xp(this,void 0,void 0,(function(){return Wp(this,(function(n){return[2,this._updateSubTrack(e,t,r)]}))}))},t.prototype._updateSubTrack=function(e,t,r){var n;return Xp(this,void 0,void 0,(function(){var i,o,a,s;return Wp(this,(function(c){switch(c.label){case 0:return xx.print("updateSubTrack()","mediaType: %o, config: %o",t,r),Bx("updateSubTrack()",e),i=!1,o=!1,t===Bp.VIDEO_ONLY?(i=!0,o=!1):t===Bp.AUDIO_ONLY?(o=!0,i=!1):t===Bp.AUDIO_AND_VIDEO?(i=!0,o=!0):t===Bp.NONE&&(i=!1,o=!1),a={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:i,audio:!!this._multiChatMode()||o},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",a)];case 1:if(200!==(null==(s=c.sent())?void 0:s.code))throw new Ww(Hw.UPDATE_TRACK_FAILED,(null==s?void 0:s.message)||"update track failed");return e.paused=!i,this._multiChatMode()||(e.subAudio=o),e.subVideo=i,e.subMediaType=t,e.subConfig=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var r,n,i,o,a;return Xp(this,void 0,void 0,(function(){var s,c,u,d,l,h,f,p,_,v,m,E,g;return Wp(this,(function(S){switch(S.label){case 0:if(xx.print("subscribe4pushTrack()","streamInfo: %o",t),Bx("subscribe4pushTrack()",e),s=null==t?void 0:t.message,c=s.audioMid,u=s.videoMid,d=s.sequenceId,l=s.sdp,e.subAudio=!0,d<e.sequenceId)return xx.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];h=e.audioMid,f=e.videoMid,S.label=1;case 1:return S.trys.push([1,8,,11]),h&&f?[4,null===(r=this._handler)||void 0===r?void 0:r.subscribe(e,{audioMid:h,videoMid:f})]:[3,3];case 2:return p=S.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(p=S.sent()))throw new Ww(Hw.ADD_TRANSCEIVER_FAILED,"add transceiver failed");h=p.audioMid,f=p.videoMid,S.label=5;case 5:return(g={})[h]=c,g[f]=u,_=g,xx.print("onpushtrack midmap",e.userId,_),e.audioMid=c,e.videoMid=u,e.sequenceId=d,v=[],e.audioTrack||v.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new Ww(Hw.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),Vx);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(xx.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),m=function(t){e.ontrack(t)},null===(i=this._handler)||void 0===i||i.on("ontrack",m),this._ontrackCallbackMap.set(e,m),[4,null===(o=this._handler)||void 0===o?void 0:o.setAnswerSdp(null==p?void 0:p.sdp,l,_,e,KU.DOWN)];case 6:return S.sent(),[4,Promise.all(v)];case 7:return S.sent(),[2];case 8:return E=S.sent(),p?[4,null===(a=this._handler)||void 0===a?void 0:a.rollback(null==p?void 0:p.sdp,[h,f])]:[3,10];case 9:S.sent(),S.label=10;case 10:throw E;case 11:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var r;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(n){switch(n.label){case 0:return Bx("unsubscribe4removeTrack()",e),xx.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(xx.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])]);case 1:return n.sent(),xx.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),[2]}}))}))},t.prototype.unsubscribe=function(e){var t,r,n;return Xp(this,void 0,void 0,(function(){var i;return Wp(this,(function(o){switch(o.label){case 0:Bx("unsubscribe()",e),i={roomId:this._roomId,streamId:e.streamId,userId:e.userId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unsubscribe",i)];case 2:case 3:return o.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),e.subAudio?[3,6]:[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 5:o.sent(),xx.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(n=this._statsReport)||void 0===n||n.unsubscribe(e),o.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 Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){return Bx("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==SL.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this.unsubscribe(e),[2]}))}))},t.prototype.leave=function(){var e;return Xp(this,void 0,void 0,(function(){var t,r;return Wp(this,(function(n){switch(n.label){case 0:return xx.print("leave()"),(this.connectionState=Ux.CONNECTED)?(this.connectionState=Ux.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]):[3,7];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:case 4:return n.sent(),[3,6];case 5:return r(),[7];case 6:return[3,8];case 7:return[2,Promise.resolve()];case 8:return[2]}}))}))},t.prototype.destroy=function(){var e,t,r,n;xx.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===(n=this._statsReport)||void 0===n||n.destroy(),this.connectionState=Ux.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",{set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),Yp([Hx],t.prototype,"join",null),Yp([Gx,Fx],t.prototype,"publish",null),Yp([Gx,Fx],t.prototype,"updatePubTrack",null),Yp([Gx,Fx],t.prototype,"unpublish",null),Yp([Gx,Fx],t.prototype,"subscribe",null),Yp([Fx],t.prototype,"controlMessage",null),Yp([Fx],t.prototype,"updateUserAttributes",null),Yp([Gx,Fx],t.prototype,"updateSubTrack",null),Yp([Gx,Fx],t.prototype,"subscribe4pushTrack",null),Yp([Gx,Fx],t.prototype,"unsubscribe4removeTrack",null),Yp([Gx,Fx],t.prototype,"unsubscribe",null),Yp([Gx,Fx],t.prototype,"handleRemoveStream",null),t}(wk);function Fx(e,t,r){var n=r.value;return r.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){switch(r.label){case 0:return this._handler&&this._state===Ux.CONNECTED?[4,n.apply(this,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:throw new Ww(Hw.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},r}function Gx(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Xp(this,void 0,void 0,(function(){var t;return Wp(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,n.apply(this,e)];case 3:return[2,r.sent()];case 4:return t(),[7];case 5:return[2]}}))}))},r}function Hx(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Xp(this,void 0,void 0,(function(){var t,r=this;return Wp(this,(function(i){return t=!1,[2,new Promise((function(i,o){return Xp(r,void 0,void 0,(function(){var r,a;return Wp(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new Ww(Hw.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.apply(this,e)];case 2:return r=s.sent(),i(r),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},r}var zx=I,Kx=nc,Yx=$v.exports.getWeakData,Xx=Pt,Wx=G,qx=lc,Jx=Yc,Zx=xe,$x=Or.set,Qx=Or.getterFor,eV=ba.find,tV=ba.findIndex,rV=zx([].splice),nV=0,iV=function(e){return e.frozen||(e.frozen=new oV)},oV=function(){this.entries=[]},aV=function(e,t){return eV(e.entries,(function(e){return e[0]===t}))};oV.prototype={get:function(e){var t=aV(this,e);if(t)return t[1]},has:function(e){return!!aV(this,e)},set:function(e,t){var r=aV(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=tV(this.entries,(function(t){return t[0]===e}));return~t&&rV(this.entries,t,1),!!~t}};var sV,cV={getConstructor:function(e,t,r,n){var i=e((function(e,i){qx(e,o),$x(e,{type:t,id:nV++,frozen:void 0}),null!=i&&Jx(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=Qx(t),s=function(e,t,r){var n=a(e),i=Yx(Xx(t),!0);return!0===i?iV(n).set(t,r):i[n.id]=r,e};return Kx(o,{delete:function(e){var t=a(this);if(!Wx(e))return!1;var r=Yx(e);return!0===r?iV(t).delete(e):r&&Zx(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!Wx(e))return!1;var r=Yx(e);return!0===r?iV(t).has(e):r&&Zx(r,t.id)}}),Kx(o,r?{get:function(e){var t=a(this);if(Wx(e)){var r=Yx(e);return!0===r?iV(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)}}),i}},uV=i,dV=I,lV=nc,hV=$v.exports,fV=jm,pV=cV,_V=G,vV=om,mV=Or.enforce,EV=or,gV=!uV.ActiveXObject&&"ActiveXObject"in uV,SV=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},yV=fV("WeakMap",SV,pV);if(EV&&gV){sV=pV.getConstructor(SV,"WeakMap",!0),hV.enable();var bV=yV.prototype,TV=dV(bV.delete),IV=dV(bV.has),RV=dV(bV.get),AV=dV(bV.set);lV(bV,{delete:function(e){if(_V(e)&&!vV(e)){var t=mV(this);return t.frozen||(t.frozen=new sV),TV(this,e)||t.frozen.delete(e)}return TV(this,e)},has:function(e){if(_V(e)&&!vV(e)){var t=mV(this);return t.frozen||(t.frozen=new sV),IV(this,e)||t.frozen.has(e)}return IV(this,e)},get:function(e){if(_V(e)&&!vV(e)){var t=mV(this);return t.frozen||(t.frozen=new sV),IV(this,e)?RV(this,e):t.frozen.get(e)}return RV(this,e)},set:function(e,t){if(_V(e)&&!vV(e)){var r=mV(this);r.frozen||(r.frozen=new sV),IV(this,e)?AV(this,e,t):r.frozen.set(e,t)}else AV(this,e,t);return this}})}var CV=function(e){function t(){var t=e.call(this)||this;return t._hasVideoPermission=!1,t._hasAudioPermission=!1,t.inited=!1,t.deviceMap=new Map,t._handleDeviceChange=t._handleDeviceChange.bind(t),!$D()&&t.refreshDevices(),t}return Cp(t,e),t.prototype.refreshDevices=function(){return Xp(this,void 0,void 0,(function(){var e=this;return Wp(this,(function(t){switch(t.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return t.sent().filter((function(e){return""!==e.deviceId})).forEach((function(t){e.deviceMap.set(t.deviceId,{deviceName:t.label,deviceInfo:t,deviceId:t.deviceId,deviceType:t.kind,deviceState:"active"})})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e;return Xp(this,void 0,void 0,(function(){return Wp(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 Xp(this,void 0,void 0,(function(){var e,t,r=this;return Wp(this,(function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=n.sent(),t=Array.from(this.deviceMap.values()),e.forEach((function(e){var t=r.deviceMap.get(e.deviceId);r.deviceMap.set(e.deviceId,{deviceName:e.label,deviceType:e.kind,deviceId:e.deviceId,deviceInfo:e,deviceState:"active"}),t&&"inactive"!==t.deviceState||r.emit("onMediaDeviceStateChanged",{deviceName:e.label,deviceType:e.kind,deviceId:e.deviceId,deviceInfo:e,deviceState:"active"})})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId}))||(t.deviceState="inactive",r.deviceMap.delete(t.deviceId),r.emit(r_.onMediaDeviceStateChanged,t))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return Xp(this,void 0,void 0,(function(){var e=this;return Wp(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Ww(Hw.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 Xp(this,void 0,void 0,(function(){var e=this;return Wp(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Ww(Hw.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 Xp(this,void 0,void 0,(function(){return Wp(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(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getMicrophones=function(){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState})).filter((function(e){return"audioinput"===e.deviceType}))]}}))}))},t.prototype.getCameras=function(){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState})).filter((function(e){return"videoinput"===e.deviceType}))]}))}))},t.prototype.getAudioPlayback=function(){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.values()).filter((function(e){return"active"===e.deviceState})).filter((function(e){return"audiooutput"===e.deviceType}))]}))}))},t.prototype.getDeviceById=function(e){return Xp(this,void 0,void 0,(function(){return Wp(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 Ww(Hw.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 Ww(Hw.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(wk),OV=new CV,NV=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}(),wV=function(){function e(e){var t=DV.getAudioContextInstance();this._track=e;var r=new MediaStream;r.addTrack(e);var n=t.createMediaStreamSource(r),i=t.createAnalyser();n.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}(),DV=new NV,kV=new Ok("VERTC",0),PV=new WeakMap,MV=function(e){return PV.get(e)},UV=function(e){function t(t,r){var n=e.call(this)||this;return n._trackId=t,n.mediaType=r,n}return Cp(t,e),t.prototype.getId=function(){return this._trackId},t}(wk),LV=function(e){function t(t,r,n){var i=e.call(this,r,n)||this;return i._mediaTrack=t,i._initListeners(),i}return Cp(t,e),t.prototype.getTrack=function(){return this._mediaTrack},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(){wL.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(UV),xV=function(e){function t(t,r,n){var i=e.call(this,r,n)||this;return i._mediaTrack=t,i}return Cp(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(UV),VV=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Cp(t,e),t.prototype.updateVideoCaptureConfig=function(){var e;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig?(kV.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}(LV),BV=function(e){function t(t,r){var n=e.call(this,t,r,"audio")||this;return n.mixType=Qp.PLAYOUT_AND_PUBLISH,n}return Cp(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new wV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(kV.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}(LV),jV=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Cp(t,e),t}(xV),FV=function(e){function t(t,r){return e.call(this,t,r,"audio")||this}return Cp(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new wV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(xV),GV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cp(t,e),t}(BV),HV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cp(t,e),t}(VV),zV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cp(t,e),t}(VV),KV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cp(t,e),t}(BV),YV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cp(t,e),t}(VV),XV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cp(t,e),t}(BV);function WV(e){var t;return Xp(this,void 0,void 0,(function(){var r,n,i,o,a,s;return Wp(this,(function(c){switch(c.label){case 0:n=(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]),kV.print("createCameraVideoTrack","constraints:",e),wL.rtcVideoCaptureEvent({event_type:hL.START,media_device_id:n}),i=JD(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return r=c.sent(),wL.rtcVideoCaptureEvent({event_type:hL.START_CAPTURE_RESULT,media_device_id:n,reason:pL.SUCCESS,elapse:JD()-i}),OV.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),wL.rtcVideoCaptureEvent({event_type:hL.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new Ww(Hw.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getVideoTracks()[0],PV.set(a,r),(s=new HV(a,qD())).videoCaptureConfig=e,[2,s]}}))}))}function qV(e){var t;return Xp(this,void 0,void 0,(function(){var r,n,i,o,a;return Wp(this,(function(s){switch(s.label){case 0:kV.print("createCameraVideoTrack","constraints:",e),n=(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]),wL.rtcVideoCaptureEvent({event_type:hL.START,media_device_id:n}),i=JD(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=s.sent(),wL.rtcVideoCaptureEvent({event_type:hL.START_CAPTURE_RESULT,media_device_id:n,reason:pL.SUCCESS,elapse:JD()-i}),OV.hasAudioPermission=!0,[3,4];case 3:throw o=s.sent(),wL.rtcVideoCaptureEvent({event_type:hL.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new Ww(Hw.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getAudioTracks()[0],PV.set(a,r),[2,new GV(a,qD())]}}))}))}function JV(e){return void 0===e&&(e=!1),Xp(this,void 0,void 0,(function(){var t,r,n;return Wp(this,(function(i){switch(i.label){case 0:kV.print("createScreenStream","withAudio:",e),i.label=1;case 1:return i.trys.push([1,3,,4]),wL.rtcVideoCaptureEvent({event_type:hL.START,media_device_id:"screen"}),r=JD(),[4,navigator.mediaDevices.getDisplayMedia({video:!0,audio:e})];case 2:return t=i.sent(),wL.rtcVideoCaptureEvent({event_type:hL.START_CAPTURE_RESULT,media_device_id:"screen",reason:pL.SUCCESS,elapse:JD()-r}),[3,4];case 3:throw n=i.sent(),wL.rtcVideoCaptureEvent({event_type:hL.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.message}),new Ww(Hw.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,t]}}))}))}var ZV,$V,QV=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=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,o=i;i<t.length-4;){var a=new Uint8Array(t.buffer.slice(i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(i+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),i=o}return r},e.getAvccNals=function(t){for(var r=[];t.position<t.length-4;){var n=t.getInt32(t.position);if(!(t.length-t.position>=n))break;var i=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+n));t.skip(n);var a={header:i,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,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{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 n=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),n),n+=2,r.set(e,n),r[n+=e.byteLength]=1,n++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),n),n+=2,r.set(t,n),r},e}(),eB=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),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)},e.readByte=function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n},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}(),tB=new Ok("Stream",0),rB=function(){function e(){this.isScreen=!1,this.seiList=[],this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!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(Rx()){var r=t.createEncodedStreams(),n=r.readable,i=r.writable,o=new TransformStream({transform:function(t,r){var n=e.seiList[0];if(n){var i=new Uint8Array(n.content.byteLength+5);i.set([0,0,0,1,6]),i.set(n.content,5);var o=new Uint8Array(i.byteLength+t.data.byteLength);0===n.repeatCount&&e.seiList.splice(0,1),n.repeatCount--,o.set(new Uint8Array(t.data)),o.set(i,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else tB.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 tB.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0},e.prototype.updateVideoBitrate=function(e){var t,r=null===(t=null==e?void 0:e[0])||void 0===t?void 0:t.maxKbps;if("number"==typeof r&&r&&this.videoTransceiver){var n=this.videoTransceiver.sender,i=n.getParameters();i.encodings&&0!==i.encodings.length||(i.encodings=[{}]),i.encodings[0].maxBitrate=1e3*r,tB.print("updateVideoBitrate","set sendEncodings: ",i),n.setParameters(i)}},e.prototype.switchTrackEnableState=function(e,t){var r;"audio"===e?r=this.audioTrack:"video"===e&&(r=this.videoTrack);var n=null==r?void 0:r.getTrack();return!(!n||(null==n?void 0:n.enabled)===t)&&(n.enabled=t,!0)},e}(),nB=function(e){function t(t,r,n,i){var o=e.call(this)||this;return o.userId=t,o.isScreen=n,o.streamId=r,o.hasAudio=i.localaudio,o.hasVideo=i.localvideo,o._attributes=i,o.subVideo=!1,o.subAudio=!1,o._sequenceId=0,o.subMediaType=Bp.NONE,o.recordedVideoFrames=[],o.subConfig={videoIndex:0},o.hasSubscribed=!1,o}return Cp(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,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){var n=QV.getNalunits(new eB(t.data)).find((function(e){return e.sei}));n&&e.safeEmit("onSEIMessage",n.body.slice(1)),r.enqueue(t)}})).pipeTo(n)}else tB.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 tB.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,r,n;if((null===(r=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===r?void 0:r.id)===this.streamId){var i=e.track;"video"===(null==i?void 0:i.kind)?this._setVideoTrack(i):"audio"===(null===(n=e.track)||void 0===n?void 0:n.kind)&&this._setAudioTrack(i),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){tB.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=[],this.paused=!1,this._workaround_1_=!1},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 FV(e,qD()),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 jV(e,qD()),this.emit("ontrack",this.videoTrack))},t}(wk);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(ZV||(ZV={})),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"}($V||($V={}));var iB=new Ok("Room",1),oB=function(e){function t(t){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._roomConfig=t,r._mediaServerClient=new jx,r._addHandlerEventHandler(),r._isReconnecting=!1,r}return Cp(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,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m=this;null===(e=this._mediaServerClient)||void 0===e||e.on(yL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(yL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(yL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(yL.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(yL.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(yL.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(yL.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(yL.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(yL.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(yL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(yL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(yL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(yL.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(bL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(bL.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on("onRemoteStreamStats",(function(e){m.emit("onRemoteStreamStats",e)})),null===(v=this._mediaServerClient)||void 0===v||v.on("onLocalStreamStats",(function(e){m.emit("onLocalStreamStats",e)}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,r,n,i){return Xp(this,void 0,void 0,(function(){var o=this;return Wp(this,(function(a){return kL.setStats({rtc_app_id:e,room_id:t,user_id:n.userId}),iB.print("join()"),[2,new Promise((function(a,s){return Xp(o,void 0,void 0,(function(){var o;return Wp(this,(function(c){return this._joinResolveCallback=a,this._joinRejectCallback=s,this._controlMessage=i,this._roomInfo={appId:e,roomId:t,token:r,userInfo:n},o=JD(),wL.joinRoom(aL.BEGIN,o,!1,""),this._join((function(e){wL.joinRoom(aL.END,o,!0,e.message),a(e)}),(function(e){wL.joinRoom(aL.END,o,!1,e.message),s(e)})),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,r){var n;return void 0===r&&(r=!1),Xp(this,void 0,void 0,(function(){var i,o,a;return Wp(this,(function(s){switch(s.label){case 0:i=JD(),iB.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},r,this._controlMessage)];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===(n=this._roomInfo)||void 0===n?void 0:n.userInfo),this._isReconnecting=!1,wL.rtcJoinRoom(0,"web","web",JD()-i),this._onJoinSucc(o,r),[3,4];case 3:return(a=s.sent()).code!==Hw.OPERATION_CANCEL&&"function"==typeof t?[2,t(a)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,r){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(n){switch(n.label){case 0:return iB.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new rB,this._localScreenStream.isScreen=!0),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=r,this._localScreenStream.videoEncodeConfig=e,this._localScreenStream.hasPublished?[3,2]:[4,this._mediaServerClient.publish(this._localScreenStream)];case 1:return n.sent(),[3,4];case 2:return[4,this.updatePubScreenTrack()];case 3:n.sent(),n.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(e){switch(e.label){case 0:return iB.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(){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(e){switch(e.label){case 0:return iB.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?[4,this._mediaServerClient.unpublish(this._localScreenStream)]:[3,2];case 1:e.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.controlMessage=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){switch(t.label){case 0:return iB.print("controlMessage","Invoke controlMessage"),this._controlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),"stopped"===e.action&&delete this._controlMessage,[2]}}))}))},t.prototype.updateUserAttributes=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){switch(t.label){case 0:return iB.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){return Xp(this,void 0,void 0,(function(){var n;return Wp(this,(function(i){switch(i.label){case 0:if(iB.print("publish","Invoke publish"),this._localStream||(this._localStream=new rB),this._localStream.videoTrack=t,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.hasPublished)return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._mediaServerClient.publish(this._localStream)];case 2:return i.sent(),this.emit($V.ON_PUBLISH_RESULT,{isScreen:!1,state:Mp.PUBLISH_SUCC}),[3,4];case 3:throw n=i.sent(),this.emit($V.ON_PUBLISH_RESULT,{isScreen:!1,state:Mp.PUBLISH_FAIL}),n;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:i.sent(),i.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(e){switch(e.label){case 0:return iB.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 Xp(this,void 0,void 0,(function(){return Wp(this,(function(e){switch(e.label){case 0:return iB.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 Xp(this,void 0,void 0,(function(){return Wp(this,(function(n){switch(n.label){case 0:return iB.print("subscribe","remoteStream %o",e),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){var n,i;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(o){return iB.print("updateSubTrack","Invoke updateSubTrack"),e.subMediaType===t&&(null===(n=null==e?void 0:e.subConfig)||void 0===n?void 0:n.videoIndex)===(null==r?void 0:r.videoIndex)?[2,Promise.resolve(e)]:[2,null===(i=this._mediaServerClient)||void 0===i?void 0:i.updateSubTrack(e,t,r)]}))}))},t.prototype.unsubscribe=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){switch(t.label){case 0:return iB.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.leave=function(){return Xp(this,void 0,void 0,(function(){var e,t;return Wp(this,(function(r){switch(r.label){case 0:iB.print("leave","Invoke leave"),e=JD(),r.label=1;case 1:return r.trys.push([1,3,4,5]),clearTimeout(this._reconnectTimer),[4,this._mediaServerClient.leave()];case 2:return r.sent(),wL.rtcLeaveRoom(0,"",JD()-e),[3,5];case 3:return(t=r.sent())instanceof Error&&wL.rtcLeaveRoom(-1,t.message,JD()-e),[3,5];case 4:return this.destroy(),[7];case 5:return[2]}}))}))},t.prototype.destroy=function(){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(e){switch(e.label){case 0:return iB.print("destroy","Invoke destroy"),this.connectionState!==Ux.CONNECTED?[3,2]:[4,this.leave()];case 1:e.sent(),e.label=2;case 2:return this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map,this._remoteStreams=new Map,this._localStream=void 0,this._localScreenStream=void 0,this._removeHandlerEventHandler(),[2]}}))}))},t.prototype.updateToken=function(e){iB.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e)},t.prototype.muteLocalTrack=function(e,t){var r,n;return Xp(this,void 0,void 0,(function(){var i,o;return Wp(this,(function(a){switch(a.label){case 0:return this._localStream&&(null===(r=this._localStream)||void 0===r?void 0:r.hasPublished)?(i=t!==kp.MUTE_STATE_OFF,(o=this._localStream.switchTrackEnableState(e,i))?[4,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updatePubTrack(this._localStream)]:[3,2]):[2,!1];case 1:a.sent(),a.label=2;case 2:return[2,o]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Xp(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return Wp(this,(function(c){t=[];try{for(r=qp(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())i=n.value,Array.isArray(i)&&i.forEach((function(r){if(r.hasSubscribed){var n=null;switch(e){case Lp.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===Bp.AUDIO_ONLY?n=Bp.NONE:r.subMediaType===Bp.AUDIO_AND_VIDEO&&(n=Bp.VIDEO_ONLY);break;case Lp.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===Bp.VIDEO_ONLY?n=Bp.NONE:r.subMediaType===Bp.AUDIO_AND_VIDEO&&(n=Bp.AUDIO_ONLY);break;case Lp.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==Bp.NONE&&(n=Bp.NONE)}if(null!==n){var i=s.updateSubTrack(r,n,r.subConfig);i&&t.push(i)}}}))}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return Xp(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return Wp(this,(function(c){t=[];try{for(r=qp(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())i=n.value,Array.isArray(i)&&i.forEach((function(r){if(r.hasSubscribed){var n=null;switch(e){case Lp.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===Bp.NONE?n=Bp.AUDIO_ONLY:r.subMediaType===Bp.VIDEO_ONLY&&(n=Bp.AUDIO_AND_VIDEO);break;case Lp.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===Bp.NONE?n=Bp.VIDEO_ONLY:r.subMediaType===Bp.AUDIO_ONLY&&(n=Bp.AUDIO_AND_VIDEO);break;case Lp.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==Bp.AUDIO_AND_VIDEO&&(n=Bp.AUDIO_AND_VIDEO)}if(null!==n){var i=s.updateSubTrack(r,n,r.subConfig);i&&t.push(i)}}}))}catch(e){o={error:e}}finally{try{n&&!n.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.sendRoomMessage=function(e,t){var r,n;return void 0===t&&(t=!1),Xp(this,void 0,void 0,(function(){var i,o;return Wp(this,(function(a){switch(a.label){case 0:return i={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:t,message:""},t?(o=i,[4,QD.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:i.message=e,a.label=3;case 3:return[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(i)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){iB.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new jx,this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var r,n,i,o,a,s=this;iB.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=qp(this._remoteUsers.values()),f=h.next();!f.done;f=h.next()){var p=f.value;p._stillExist?delete p._stillExist:u.push({clientId:p.userId,leaveReason:"Left during disconnection"})}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=h.return)&&n.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 _=qp(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:SL.clientDisconnected})}))}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=_.return)&&o.call(_)}finally{if(i)throw i.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)})),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 n=qp(this._remoteStreams.values()),i=n.next();!i.done;i=n.next()){var o=i.value;Array.isArray(o)&&o.forEach((function(e){return Xp(r,void 0,void 0,(function(){var t;return Wp(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]),iB.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType,e.subConfig)];case 2:return r.sent(),iB.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit($V.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=r.sent(),iB.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{i&&!i.done&&(t=n.return)&&t.call(n)}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){var r;if(void 0===t&&(t=!0),e.clientId!==(null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId)){var n=this._findRemoteStream(e.clientId,e.streamId);if(!n){n=new nB(e.clientId,e.streamId,e.screen,e.attributes),this._initStreamListeners(n);var i=this._remoteStreams.get(e.clientId);i?i.push(n):this._remoteStreams.set(e.clientId,[n])}return t&&this.safeEmit(yL.ON_ADD_STREAM,{stream:n}),!n.isScreen&&n.hasVideo&&this.safeEmit($V.ON_USER_START_VIDEO_CAPTURE,{userId:n.userId}),!n.isScreen&&n.hasAudio&&this.safeEmit($V.ON_USER_START_AUDIO_CAPTURE,{userId:n.userId}),n}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,Kp(Kp({},r),{_stillExist:!0})),this.safeEmit(yL.USER_CONNECTION,{userInfo:r})}},t.prototype._onUserDisconnection=function(e){var t,r,n=this,i=e.clientId,o=e.leaveReason,a=this._remoteUsers.get(i);this._remoteUsers.delete(i);var s=this._remoteStreams.get(i);Array.isArray(s)&&s.length&&(s.forEach((function(e){n.safeEmit(yL.ON_REMOVE_STREAM,{stream:e,reason:"Client leave"})})),this._remoteStreams.delete(i)),"userDuplicateLogin"===e.tag&&i===(null===(r=null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo)||void 0===r?void 0:r.userId)&&(a={userId:i},o=e.tag),(null==a?void 0:a.userId)&&this.safeEmit(yL.USER_DISCONNECTION,{userInfo:{userId:null==a?void 0:a.userId},reason:o})},t.prototype._onRemoveStream=function(e){var t,r,n=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._remoteStreams.get(e.clientId);if(i){var o=i.find((function(t){return t.streamId==e.streamId}));o&&(null===(r=this._mediaServerClient)||void 0===r||r.handleRemoveStream(o,e).then((function(){if(!(null==o?void 0:o._workaround_1_)){var t=n._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),n._remoteStreams.set(e.clientId,t)}})),this.safeEmit(yL.ON_REMOVE_STREAM,{stream:o,reason:e.message}))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t=e.clientId,r=e.streamId,n=e.attributes,i=this._findRemoteStream(t,r);if(i){var o=i.attributes,a=Kp(Kp({},o),n);i.attributes=a,a.localaudio!==o.localaudio&&(a.localaudio?this.safeEmit($V.ON_USER_START_AUDIO_CAPTURE,{userId:t}):this.safeEmit($V.ON_USER_STOP_AUDIO_CAPTURE,{userId:t})),a.localvideo!==o.localvideo&&(a.localvideo?this.safeEmit($V.ON_USER_START_VIDEO_CAPTURE,{userId:t}):this.safeEmit($V.ON_USER_STOP_VIDEO_CAPTURE,{userId:t})),a.audiostream!==o.audiostream&&(a.audiostream?this.safeEmit($V.ON_USER_MUTE_AUDIO,{userInfo:{userId:t},muteState:kp.MUTE_STATE_ON}):this.safeEmit($V.ON_USER_MUTE_AUDIO,{userInfo:{userId:t},muteState:kp.MUTE_STATE_OFF})),a.videostream!==o.videostream&&(a.videostream?this.safeEmit($V.ON_USER_MUTE_VIDEO,{userInfo:{userId:t},muteState:kp.MUTE_STATE_ON}):this.safeEmit($V.ON_USER_MUTE_VIDEO,{userInfo:{userId:t},muteState:kp.MUTE_STATE_OFF}))}},t.prototype._onPushTrack=function(e){var t=this,r=e.clientId,n=e.streamId,i=this._findRemoteStream(r,n);i||(i=this._onAddStream(e,!1)),this._mediaServerClient.subscribe4pushTrack(i,e).then((function(){return t.safeEmit($V.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){iB.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,r=e.clientId,n=e.streamId,i=e.message,o=this._findRemoteStream(r,n);o&&this._mediaServerClient.unsubscribe4removeTrack(o,i).then((function(){var e;if(o._workaround_1_){var i=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==n}));t._remoteStreams.set(r,i||[])}t.safeEmit($V.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){iB.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t=e.nodes,r=e.reason;this._destroyAndInitMediaServerClient(),Array.isArray(t)&&t.length?this._getAccessNode=t[0]:this._getAccessFeedback=r,wL.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(r)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,r=this;this._isReconnecting=!0,wL.rtcReconnect(1002,PU.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,MU.PEERCONNECTION);try{for(var n=qp(this._remoteStreams.values()),i=n.next();!i.done;i=n.next()){var o=i.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._join((function(){wL.rtcReconnected(UU.PEERCONNECTION_RECONNECTED,LU.PEERCONNECTION)}),(function(e){iB.print("Reconnecting error, will reconnect after 3s",e),r._reconnectTimer=setTimeout(r._reconnect.bind(r),3e3)}),!0)},t.prototype._handleAbnormalDisconnection=function(){iB.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===Ux.DISCONNECTED)t=Fp.CONNECTION_STATE_DISCONNECTED;else if(e.next===Ux.CONNECTED)t=this._isReconnecting?Fp.CONNECTION_STATE_RECONNECTED:Fp.CONNECTION_STATE_CONNECTED;else{if(e.next!==Ux.CONNECTING)return;t=this._isReconnecting?Fp.CONNECTION_STATE_RECONNECTING:Fp.CONNECTION_STATE_CONNECTING}this.safeEmit(bL.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 n;t.emit($V.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(n=t._roomInfo)||void 0===n?void 0:n.roomId,streamIndex:e.isScreen?Vp.STREAM_INDEX_SCREEN:Vp.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(yL.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){var t=e.msg;try{t=JSON.parse(t)}catch(e){}this.safeEmit(yL.USER_MESSAGE_RECEIVED,{userId:e.from,message:t})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(yL.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(yL.POST_PROCESSING_MESSAGE,{code:r,message:["success","parameter error","subscription timeout","ffmpeg error","cdn error"][r]})},t}(wk),aB=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=Jp(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},sB=new Ok("Player",0),cB=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],uB={playsinline:"","webkit-playsinline":""},dB={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},lB=function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var r="audio"===e?uB:dB;if("video"===e&&this.videoCache.length>0){if(n=this.videoCache.pop())return aB(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var n;if(n=this.audioCache.pop())return aB(n,{style:t,attributes:r}),n}return 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=Jp(e,2),n=t[0],i=t[1];r.setAttribute(n,i)})),r}(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}(),hB=new lB,fB=function(e){function t(t){var r=e.call(this)||this;r.emitVideoEvent=function(e){var t,n,i={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===(n=r._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:r.isScreen};r.emit("playback_event",i)},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;wL.rtcError("video autoplay failed, userId: ".concat(r.userId),-1e3),r.emit("playback_event",{type:"video",rawEvent:e,readyState:r._videoDom.readyState||0,userId:r.userId,eventName:"autoplay-error",currentTime:(null===(t=r._videoDom)||void 0===t?void 0:t.currentTime)||0})}))}};var n=t.renderDom,i=t.userId;r.renderMode=void 0!==t.renderMode?t.renderMode:xp.RENDER_MODE_FIT;var o="string"==typeof n?document.getElementById(n):n;if(!o)throw new Ww(Hw.CANT_FIND_DOM,"can't find dom");return r._containerDom=o,r.userId=i,r.isScreen=!!t.isScreen,r._initVideo(),r}return Cp(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=hB.getOrCreate("video",{width:"100%",height:"100%",background:"black"}),this._videoDom.id="".concat(this.userId,"_").concat(qD()),this.renderMode===xp.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover"),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&cB.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&&(cB.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 n;if("timeupdate"===r.eventName){if(void 0===t.__cumulativeTime&&(t.__cumulativeTime=0),0===(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime))return;if(t._videoDom.currentTime>t.__cumulativeTime){var i=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),o=t._videoDom.currentTime-t.__cumulativeTime>.5;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:o,stallCount:o?1:0,stallDuration:i%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var r;return Xp(this,void 0,void 0,(function(){var n,i,o=this;return Wp(this,(function(a){return n=this._videoDom,sB.print("playVideo","play video track: ".concat(this.userId)),n&&n.srcObject instanceof MediaStream&&n.srcObject.getTrackById(null===(r=e.getTrack())||void 0===r?void 0:r.id)||(n||(this._initVideo(),n=this._videoDom),sB.print("playVideo","play video by dom: ".concat(null==n?void 0:n.id)),(i=new MediaStream).addTrack(e.getTrack()),n.srcObject=i,this._containerDom.appendChild(n),n.addEventListener("canplay",this._internalPlay),n.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(sB.print("Invoke AudioPlayer.manuallyPlay"),!this._videoDom)throw new Ww(Hw.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){sB.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;sB.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom),hB.recycle(this._videoDom),this._removeListeners(),delete this._videoDom),this._videoDom=void 0,this.__cumulativeTime=void 0},t.prototype.destroy=function(){this.stop(),e.prototype.removeAllListeners.call(this)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(vk.exports.EventEmitter),pB=function(e){function t(t,r){var n=e.call(this)||this;if(n.emitVideoEvent=function(e){var t,r,i={type:"audio",rawEvent:e,readyState:(null===(t=n._audioDom)||void 0===t?void 0:t.readyState)||0,userId:n.userId,eventName:e.type,currentTime:(null===(r=n._audioDom)||void 0===r?void 0:r.currentTime)||0};n.emit("playback_event",i)},n._internalPlay=function(){var e,t;if(LL("_internalPlay",{paused:null===(e=n._audioDom)||void 0===e?void 0:e.paused}),null===(t=n._audioDom)||void 0===t?void 0:t.paused)try{var r=n._audioDom.play();(null==r?void 0:r.then)&&r.catch((function(e){n._autoPlayError(e)})).then((function(){LL("_internalPlay successfully",{userId:n.userId})}))}catch(e){n._autoPlayError(e)}},r){var i=document.getElementById(r);if(!i)throw new Ww(Hw.CANT_FIND_DOM,"can't find dom");n._containerDom=i}else n._containerDom=document.body;return n.userId=t,n._initAudio(),n}return Cp(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=hB.getOrCreate("audio",{display:"none"}),this._audioDom.id="".concat(this.userId,"_").concat(qD()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&cB.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&&(cB.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 Xp(this,void 0,void 0,(function(){var r,n,i=this;return Wp(this,(function(o){return sB.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),(n=new MediaStream).addTrack(e.getTrack()),r.srcObject=n,null==r||r.addEventListener("canplay",this._internalPlay),null==r||r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return i._internalPlay()}))),[2]}))}))},t.prototype._autoPlayError=function(e){var t;wL.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:this._audioDom.readyState||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(t=this._audioDom)||void 0===t?void 0:t.currentTime)||0})},t.prototype.manuallyPlay=function(){if(sB.print("Invoke AudioPlayer.manuallyPlay"),!this._audioDom)throw new Ww(Hw.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 Xp(this,void 0,void 0,(function(){var t;return Wp(this,(function(r){switch(r.label){case 0:return sB.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,OV.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;sB.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom),hB.recycle(this._audioDom),this._removeListeners(),delete this._audioDom),this._audioDom=void 0},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){this.stop(),e.prototype.removeAllListeners.call(this)},t}(vk.exports.EventEmitter),_B="object"==("undefined"==typeof global?"undefined":t(global))&&global&&global.Object===Object&&global,vB="object"==("undefined"==typeof self?"undefined":t(self))&&self&&self.Object===Object&&self,mB=_B||vB||Function("return this")(),EB=mB.Symbol,gB=Object.prototype,SB=gB.hasOwnProperty,yB=gB.toString,bB=EB?EB.toStringTag:void 0;var TB=Object.prototype.toString;var IB=EB?EB.toStringTag:void 0;function RB(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":IB&&IB in Object(e)?function(e){var t=SB.call(e,bB),r=e[bB];try{e[bB]=void 0;var n=!0}catch(e){}var i=yB.call(e);return n&&(t?e[bB]=r:delete e[bB]),i}(e):function(e){return TB.call(e)}(e)}function AB(e){return null!=e&&"object"==t(e)}var CB=Array.isArray;function OB(e){var r=t(e);return null!=e&&("object"==r||"function"==r)}function NB(e){return e}function wB(e){if(!OB(e))return!1;var t=RB(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var DB=mB["__core-js_shared__"],kB=function(){var e=/[^.]+$/.exec(DB&&DB.keys&&DB.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var PB=Function.prototype.toString;var MB=/^\[object .+?Constructor\]$/,UB=Function.prototype,LB=Object.prototype,xB=UB.toString,VB=LB.hasOwnProperty,BB=RegExp("^"+xB.call(VB).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function jB(e){return!(!OB(e)||(t=e,kB&&kB in t))&&(wB(e)?BB:MB).test(function(e){if(null!=e){try{return PB.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 GB=Date.now;var HB,zB,KB,YB=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return jB(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),XB=YB,WB=XB?function(e,t){return XB(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:NB,qB=(HB=WB,zB=0,KB=0,function(){var e=GB(),t=16-(e-KB);if(KB=e,t>0){if(++zB>=800)return arguments[0]}else zB=0;return HB.apply(void 0,arguments)}),JB=qB,ZB=/^(?:0|[1-9]\d*)$/;function $B(e,r){var n=t(e);return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&ZB.test(e))&&e>-1&&e%1==0&&e<r}function QB(e,t,r){"__proto__"==t&&XB?XB(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function ej(e,t){return e===t||e!=e&&t!=t}var tj=Object.prototype.hasOwnProperty;function rj(e,t,r){var n=e[t];tj.call(e,t)&&ej(n,r)&&(void 0!==r||t in e)||QB(e,t,r)}var nj=Math.max;function ij(e,t){return JB(function(e,t,r){return t=nj(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=nj(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),FB(e,this,s)}}(e,t,NB),e+"")}function oj(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function aj(e){return null!=e&&oj(e.length)&&!wB(e)}var sj=Object.prototype;function cj(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||sj)}function uj(e){return AB(e)&&"[object Arguments]"==RB(e)}var dj=Object.prototype,lj=dj.hasOwnProperty,hj=dj.propertyIsEnumerable,fj=uj(function(){return arguments}())?uj:function(e){return AB(e)&&lj.call(e,"callee")&&!hj.call(e,"callee")},pj=fj;var _j="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,vj=_j&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,mj=vj&&vj.exports===_j?mB.Buffer:void 0,Ej=(mj?mj.isBuffer:void 0)||function(){return!1},gj={};gj["[object Float32Array]"]=gj["[object Float64Array]"]=gj["[object Int8Array]"]=gj["[object Int16Array]"]=gj["[object Int32Array]"]=gj["[object Uint8Array]"]=gj["[object Uint8ClampedArray]"]=gj["[object Uint16Array]"]=gj["[object Uint32Array]"]=!0,gj["[object Arguments]"]=gj["[object Array]"]=gj["[object ArrayBuffer]"]=gj["[object Boolean]"]=gj["[object DataView]"]=gj["[object Date]"]=gj["[object Error]"]=gj["[object Function]"]=gj["[object Map]"]=gj["[object Number]"]=gj["[object Object]"]=gj["[object RegExp]"]=gj["[object Set]"]=gj["[object String]"]=gj["[object WeakMap]"]=!1;var Sj="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,yj=Sj&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,bj=yj&&yj.exports===Sj&&_B.process,Tj=function(){try{var e=yj&&yj.require&&yj.require("util").types;return e||bj&&bj.binding&&bj.binding("util")}catch(e){}}(),Ij=Tj&&Tj.isTypedArray,Rj=Ij?function(e){return function(t){return e(t)}}(Ij):function(e){return AB(e)&&oj(e.length)&&!!gj[RB(e)]},Aj=Rj,Cj=Object.prototype.hasOwnProperty;function Oj(e,t){var r=CB(e),n=!r&&pj(e),i=!r&&!n&&Ej(e),o=!r&&!n&&!i&&Aj(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!Cj.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||$B(u,c))||s.push(u);return s}var Nj=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),wj=Nj,Dj=Object.prototype.hasOwnProperty;function kj(e){return aj(e)?Oj(e):function(e){if(!cj(e))return wj(e);var t=[];for(var r in Object(e))Dj.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var Pj=Object.prototype.hasOwnProperty;function Mj(e){if(!OB(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=cj(e),r=[];for(var n in e)("constructor"!=n||!t&&Pj.call(e,n))&&r.push(n);return r}var Uj,Lj=(Uj=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?QB(r,s,c):rj(r,s,c)}}(t,function(e){return aj(e)?Oj(e,!0):Mj(e)}(t),e)},ij((function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=Uj.length>3&&"function"==typeof o?(i--,o):void 0,a&&function(e,r,n){if(!OB(n))return!1;var i=t(r);return!!("number"==i?aj(n)&&$B(r,n.length):"string"==i&&r in n)&&ej(n[r],e)}(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var s=r[n];s&&Uj(e,s,n,o)}return e}))),xj=Lj;function Vj(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function Bj(e){return null==e?[]:Vj(e,kj(e))}var jj=a,Fj=Qe("iterator"),Gj=!jj((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,n){t.delete("b"),r+=n+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})),Hj=I,zj=2147483647,Kj=/[^\0-\u007E]/,Yj=/[.\u3002\uFF0E\uFF61]/g,Xj="Overflow: input needs wider integers to process",Wj=i.RangeError,qj=Hj(Yj.exec),Jj=Math.floor,Zj=String.fromCharCode,$j=Hj("".charCodeAt),Qj=Hj([].join),eF=Hj([].push),tF=Hj("".replace),rF=Hj("".split),nF=Hj("".toLowerCase),iF=function(e){return e+22+75*(e<26)},oF=function(e,t,r){var n=0;for(e=r?Jj(e/700):e>>1,e+=Jj(e/t);e>455;)e=Jj(e/35),n+=36;return Jj(n+36*e/(e+38))},aF=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=$j(e,r++);if(i>=55296&&i<=56319&&r<n){var o=$j(e,r++);56320==(64512&o)?eF(t,((1023&i)<<10)+(1023&o)+65536):(eF(t,i),r--)}else eF(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&eF(t,Zj(n));var c=t.length,u=c;for(c&&eF(t,"-");u<i;){var d=zj;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>Jj((zj-a)/l))throw Wj(Xj);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>zj)throw Wj(Xj);if(n==o){for(var h=a,f=36;;){var p=f<=s?1:f>=s+26?26:f-s;if(h<p)break;var _=h-p,v=36-p;eF(t,Zj(iF(p+_%v))),h=Jj(_/v),f+=36}eF(t,Zj(iF(h))),s=oF(a,l,u==c),a=0,u++}}a++,o++}return Qj(t,"")},sF=Xn,cF=i,uF=Y,dF=l,lF=I,hF=Gj,fF=Wt.exports,pF=nc,_F=Go,vF=Dh,mF=Or,EF=lc,gF=j,SF=xe,yF=Yo,bF=lo,TF=Pt,IF=G,RF=po,AF=Ri,CF=E,OF=Oc,NF=yc,wF=lu,DF=JT,kF=Qe("iterator"),PF="URLSearchParams",MF="URLSearchParamsIterator",UF=mF.set,LF=mF.getterFor(PF),xF=mF.getterFor(MF),VF=uF("fetch"),BF=uF("Request"),jF=uF("Headers"),FF=BF&&BF.prototype,GF=jF&&jF.prototype,HF=cF.RegExp,zF=cF.TypeError,KF=cF.decodeURIComponent,YF=cF.encodeURIComponent,XF=lF("".charAt),WF=lF([].join),qF=lF([].push),JF=lF("".replace),ZF=lF([].shift),$F=lF([].splice),QF=lF("".split),eG=lF("".slice),tG=/\+/g,rG=Array(4),nG=function(e){return rG[e-1]||(rG[e-1]=HF("((?:%[\\da-f]{2}){"+e+"})","gi"))},iG=function(e){try{return KF(e)}catch(t){return e}},oG=function(e){var t=JF(e,tG," "),r=4;try{return KF(t)}catch(e){for(;r;)t=JF(t,nG(r--),iG);return t}},aG=/[!'()~]|%20/g,sG={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},cG=function(e){return sG[e]},uG=function(e){return JF(YF(e),aG,cG)},dG=vF((function(e,t){UF(this,{type:MF,iterator:OF(LF(e).entries),kind:t})}),"Iterator",(function(){var e=xF(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),lG=function(e){this.entries=[],this.url=null,void 0!==e&&(IF(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===XF(e,0)?eG(e,1):e:RF(e)))};lG.prototype={type:PF,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=NF(e);if(c)for(r=(t=OF(e,c)).next;!(n=dF(r,t)).done;){if(o=(i=OF(TF(n.value))).next,(a=dF(o,i)).done||(s=dF(o,i)).done||!dF(o,i).done)throw zF("Expected sequence with length 2");qF(this.entries,{key:RF(a.value),value:RF(s.value)})}else for(var u in e)SF(e,u)&&qF(this.entries,{key:u,value:RF(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=QF(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=QF(t,"="),qF(this.entries,{key:oG(ZF(r)),value:oG(WF(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],qF(r,uG(e.key)+"="+uG(e.value));return WF(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var hG=function(){EF(this,fG);var e=arguments.length>0?arguments[0]:void 0;UF(this,new lG(e))},fG=hG.prototype;if(pF(fG,{append:function(e,t){wF(arguments.length,2);var r=LF(this);qF(r.entries,{key:RF(e),value:RF(t)}),r.updateURL()},delete:function(e){wF(arguments.length,1);for(var t=LF(this),r=t.entries,n=RF(e),i=0;i<r.length;)r[i].key===n?$F(r,i,1):i++;t.updateURL()},get:function(e){wF(arguments.length,1);for(var t=LF(this).entries,r=RF(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){wF(arguments.length,1);for(var t=LF(this).entries,r=RF(e),n=[],i=0;i<t.length;i++)t[i].key===r&&qF(n,t[i].value);return n},has:function(e){wF(arguments.length,1);for(var t=LF(this).entries,r=RF(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){wF(arguments.length,1);for(var r,n=LF(this),i=n.entries,o=!1,a=RF(e),s=RF(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?$F(i,c--,1):(o=!0,r.value=s));o||qF(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=LF(this);DF(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=LF(this).entries,n=yF(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new dG(this,"keys")},values:function(){return new dG(this,"values")},entries:function(){return new dG(this,"entries")}},{enumerable:!0}),fF(fG,kF,fG.entries,{name:"entries"}),fF(fG,"toString",(function(){return LF(this).serialize()}),{enumerable:!0}),_F(hG,PF),sF({global:!0,forced:!hF},{URLSearchParams:hG}),!hF&&gF(jF)){var pG=lF(GF.has),_G=lF(GF.set),vG=function(e){if(IF(e)){var t,r=e.body;if(bF(r)===PF)return t=e.headers?new jF(e.headers):new jF,pG(t,"content-type")||_G(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),AF(e,{body:CF(0,RF(r)),headers:CF(0,t)})}return e};if(gF(VF)&&sF({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return VF(e,arguments.length>1?vG(arguments[1]):{})}}),gF(BF)){var mG=function(e){return EF(this,FF),new BF(e,arguments.length>1?vG(arguments[1]):{})};FF.constructor=mG,mG.prototype=FF,sF({global:!0,forced:!0},{Request:mG})}}var EG,gG={URLSearchParams:hG,getState:LF},SG=Xn,yG=s,bG=Gj,TG=i,IG=Yo,RG=I,AG=ri.f,CG=Wt.exports,OG=lc,NG=xe,wG=Vi,DG=PD,kG=Ro,PG=Sf.codeAt,MG=function(e){var t,r,n=[],i=rF(tF(nF(e),Yj,"."),".");for(t=0;t<i.length;t++)r=i[t],eF(n,qj(Kj,r)?"xn--"+aF(r):r);return Qj(n,".")},UG=po,LG=Go,xG=lu,VG=gG,BG=Or,jG=BG.set,FG=BG.getterFor("URL"),GG=VG.URLSearchParams,HG=VG.getState,zG=TG.URL,KG=TG.TypeError,YG=TG.parseInt,XG=Math.floor,WG=Math.pow,qG=RG("".charAt),JG=RG(/./.exec),ZG=RG([].join),$G=RG(1..toString),QG=RG([].pop),eH=RG([].push),tH=RG("".replace),rH=RG([].shift),nH=RG("".split),iH=RG("".slice),oH=RG("".toLowerCase),aH=RG([].unshift),sH="Invalid scheme",cH="Invalid host",uH="Invalid port",dH=/[a-z]/i,lH=/[\d+-.a-z]/i,hH=/\d/,fH=/^0x/i,pH=/^[0-7]+$/,_H=/^\d+$/,vH=/^[\da-f]+$/i,mH=/[\0\t\n\r #%/:<>?@[\\\]^|]/,EH=/[\0\t\n\r #/:<>?@[\\\]^|]/,gH=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,SH=/[\t\n\r]/g,yH=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)aH(t,e%256),e=XG(e/256);return ZG(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=$G(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},bH={},TH=wG({},bH,{" ":1,'"':1,"<":1,">":1,"`":1}),IH=wG({},TH,{"#":1,"?":1,"{":1,"}":1}),RH=wG({},IH,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),AH=function(e,t){var r=PG(e,0);return r>32&&r<127&&!NG(t,e)?e:encodeURIComponent(e)},CH={ftp:21,file:null,http:80,https:443,ws:80,wss:443},OH=function(e,t){var r;return 2==e.length&&JG(dH,qG(e,0))&&(":"==(r=qG(e,1))||!t&&"|"==r)},NH=function(e){var t;return e.length>1&&OH(iH(e,0,2))&&(2==e.length||"/"===(t=qG(e,2))||"\\"===t||"?"===t||"#"===t)},wH=function(e){return"."===e||"%2e"===oH(e)},DH={},kH={},PH={},MH={},UH={},LH={},xH={},VH={},BH={},jH={},FH={},GH={},HH={},zH={},KH={},YH={},XH={},WH={},qH={},JH={},ZH={},$H=function(e,t,r){var n,i,o,a=UG(e);if(t){if(i=this.parse(a))throw KG(i);this.searchParams=null}else{if(void 0!==r&&(n=new $H(r,!0)),i=this.parse(a,null,n))throw KG(i);(o=HG(new GG)).bindURL(this),this.searchParams=o}};$H.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||DH,d=0,l="",h=!1,f=!1,p=!1;for(e=UG(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=tH(e,gH,"")),e=tH(e,SH,""),n=DG(e);d<=n.length;){switch(i=n[d],u){case DH:if(!i||!JG(dH,i)){if(t)return sH;u=PH;continue}l+=oH(i),u=kH;break;case kH:if(i&&(JG(lH,i)||"+"==i||"-"==i||"."==i))l+=oH(i);else{if(":"!=i){if(t)return sH;l="",u=PH,d=0;continue}if(t&&(c.isSpecial()!=NG(CH,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&CH[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=zH:c.isSpecial()&&r&&r.scheme==c.scheme?u=MH:c.isSpecial()?u=VH:"/"==n[d+1]?(u=UH,d++):(c.cannotBeABaseURL=!0,eH(c.path,""),u=qH)}break;case PH:if(!r||r.cannotBeABaseURL&&"#"!=i)return sH;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=kG(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=ZH;break}u="file"==r.scheme?zH:LH;continue;case MH:if("/"!=i||"/"!=n[d+1]){u=LH;continue}u=BH,d++;break;case UH:if("/"==i){u=jH;break}u=WH;continue;case LH:if(c.scheme=r.scheme,i==EG)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=kG(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=xH;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=kG(r.path),c.query="",u=JH;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=kG(r.path),c.path.length--,u=WH;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=kG(r.path),c.query=r.query,c.fragment="",u=ZH}break;case xH:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=WH;continue}u=jH}else u=BH;break;case VH:if(u=BH,"/"!=i||"/"!=qG(l,d+1))continue;d++;break;case BH:if("/"!=i&&"\\"!=i){u=jH;continue}break;case jH:if("@"==i){h&&(l="%40"+l),h=!0,o=DG(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||p){var m=AH(v,RH);p?c.password+=m:c.username+=m}else p=!0}l=""}else if(i==EG||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=DG(l).length+1,l="",u=FH}else l+=i;break;case FH:case GH:if(t&&"file"==c.scheme){u=YH;continue}if(":"!=i||f){if(i==EG||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return cH;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=XH,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return cH;if(a=c.parseHost(l))return a;if(l="",u=HH,t==GH)return}break;case HH:if(!JG(hH,i)){if(i==EG||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var E=YG(l,10);if(E>65535)return uH;c.port=c.isSpecial()&&E===CH[c.scheme]?null:E,l=""}if(t)return;u=XH;continue}return uH}l+=i;break;case zH:if(c.scheme="file","/"==i||"\\"==i)u=KH;else{if(!r||"file"!=r.scheme){u=WH;continue}if(i==EG)c.host=r.host,c.path=kG(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=kG(r.path),c.query="",u=JH;else{if("#"!=i){NH(ZG(kG(n,d),""))||(c.host=r.host,c.path=kG(r.path),c.shortenPath()),u=WH;continue}c.host=r.host,c.path=kG(r.path),c.query=r.query,c.fragment="",u=ZH}}break;case KH:if("/"==i||"\\"==i){u=YH;break}r&&"file"==r.scheme&&!NH(ZG(kG(n,d),""))&&(OH(r.path[0],!0)?eH(c.path,r.path[0]):c.host=r.host),u=WH;continue;case YH:if(i==EG||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&OH(l))u=WH;else if(""==l){if(c.host="",t)return;u=XH}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=XH}continue}l+=i;break;case XH:if(c.isSpecial()){if(u=WH,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=EG&&(u=WH,"/"!=i))continue}else c.fragment="",u=ZH;else c.query="",u=JH;break;case WH:if(i==EG||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=oH(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||eH(c.path,"")):wH(l)?"/"==i||"\\"==i&&c.isSpecial()||eH(c.path,""):("file"==c.scheme&&!c.path.length&&OH(l)&&(c.host&&(c.host=""),l=qG(l,0)+":"),eH(c.path,l)),l="","file"==c.scheme&&(i==EG||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)rH(c.path);"?"==i?(c.query="",u=JH):"#"==i&&(c.fragment="",u=ZH)}else l+=AH(i,IH);break;case qH:"?"==i?(c.query="",u=JH):"#"==i?(c.fragment="",u=ZH):i!=EG&&(c.path[0]+=AH(i,bH));break;case JH:t||"#"!=i?i!=EG&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":AH(i,bH)):(c.fragment="",u=ZH);break;case ZH:i!=EG&&(c.fragment+=AH(i,TH))}d++}},parseHost:function(e){var t,r,n;if("["==qG(e,0)){if("]"!=qG(e,e.length-1))return cH;if(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return qG(e,l)};if(":"==h()){if(":"!=qG(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&JG(vH,h());)t=16*t+YG(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!JG(hH,h()))return;for(;JG(hH,h());){if(o=YG(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!=n||u++}if(4!=n)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}(iH(e,1,-1)),!t)return cH;this.host=t}else if(this.isSpecial()){if(e=MG(e),JG(mH,e))return cH;if(t=function(e){var t,r,n,i,o,a,s,c=nH(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==qG(i,0)&&(o=JG(fH,i)?16:8,i=iH(i,8==o?1:2)),""===i)a=0;else{if(!JG(10==o?_H:8==o?pH:vH,i))return e;a=YG(i,o)}eH(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=WG(256,5-t))return null}else if(a>255)return null;for(s=QG(r),n=0;n<r.length;n++)s+=r[n]*WG(256,3-n);return s}(e),null===t)return cH;this.host=t}else{if(JG(EH,e))return cH;for(t="",r=DG(e),n=0;n<r.length;n++)t+=AH(r[n],bH);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return NG(CH,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&OH(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=yH(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+ZG(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw KG(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new QH(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+yH(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(UG(e)+":",DH)},getUsername:function(){return this.username},setUsername:function(e){var t=DG(UG(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=AH(t[r],RH)}},getPassword:function(){return this.password},setPassword:function(e){var t=DG(UG(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=AH(t[r],RH)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?yH(e):yH(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,FH)},getHostname:function(){var e=this.host;return null===e?"":yH(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,GH)},getPort:function(){var e=this.port;return null===e?"":UG(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=UG(e))?this.port=null:this.parse(e,HH))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+ZG(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,XH))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=UG(e))?this.query=null:("?"==qG(e,0)&&(e=iH(e,1)),this.query="",this.parse(e,JH)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=UG(e))?("#"==qG(e,0)&&(e=iH(e,1)),this.fragment="",this.parse(e,ZH)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var QH=function(e){var t=OG(this,ez),r=xG(arguments.length,1)>1?arguments[1]:void 0,n=jG(t,new $H(e,!1,r));yG||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},ez=QH.prototype,tz=function(e,t){return{get:function(){return FG(this)[e]()},set:t&&function(e){return FG(this)[t](e)},configurable:!0,enumerable:!0}};if(yG&&AG(ez,{href:tz("serialize","setHref"),origin:tz("getOrigin"),protocol:tz("getProtocol","setProtocol"),username:tz("getUsername","setUsername"),password:tz("getPassword","setPassword"),host:tz("getHost","setHost"),hostname:tz("getHostname","setHostname"),port:tz("getPort","setPort"),pathname:tz("getPathname","setPathname"),search:tz("getSearch","setSearch"),searchParams:tz("getSearchParams"),hash:tz("getHash","setHash")}),CG(ez,"toJSON",(function(){return FG(this).serialize()}),{enumerable:!0}),CG(ez,"toString",(function(){return FG(this).serialize()}),{enumerable:!0}),zG){var rz=zG.createObjectURL,nz=zG.revokeObjectURL;rz&&CG(QH,"createObjectURL",IG(rz,zG)),nz&&CG(QH,"revokeObjectURL",IG(nz,zG))}LG(QH,"URL"),SG({global:!0,forced:!bG,sham:!yG},{URL:QH});var iz,oz=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 Xp(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,f,p,_=this;return Wp(this,(function(v){switch(v.label){case 0:if(n=r.playCount,sk(i=r.type,"mixingType",Bj(Qp)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=MV(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:e_.AUDIO_MIXING_STATE_STOPPED,error:zw.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:e_.AUDIO_MIXING_STATE_FAILED,error:zw.AUDIO_MIXING_ERROR_START_FAILED}),new Ww(Hw.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",n<=0?c.loop=!0:n>0&&(l=n,c.onended=function(){--l>0?c.play():_._context.emitMessage({mixId:e,state:e_.AUDIO_MIXING_STATE_FINISHED,error:zw.AUDIO_MIXING_ERROR_OK})}),[4,c.play()];case 4:if(v.sent(),h=this._sharedAudioContext.createMediaElementSource(c),f=this._sharedAudioContext.createGain(),p=this.volumeConfig.get(e),f.gain.value=p?p/100:1,h.connect(f).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:h,audioNode:c,gainNode:f,type:"file"}),i===Qp.PUBLISH)try{f.disconnect(this._sharedAudioContext.destination)}catch(e){}else f.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],r.type),this._context.emitMessage({mixId:e,state:e_.AUDIO_MIXING_STATE_PLAYING,error:zw.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:e_.AUDIO_MIXING_STATE_STOPPED,error:zw.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:e_.AUDIO_MIXING_STATE_PAUSED,error:zw.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:e_.AUDIO_MIXING_STATE_PLAYING,error:zw.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return Xp(this,void 0,void 0,(function(){var r,n=this;return Wp(this,(function(i){switch(i.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return n._context.emitMessage({mixId:e,state:e_.AUDIO_MIXING_STATE_PRELOADED,error:zw.AUDIO_MIXING_ERROR_OK}),t.arrayBuffer();throw n._context.emitMessage({mixId:e,state:e_.AUDIO_MIXING_STATE_FAILED,error:zw.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new Ww(Hw.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(e){throw new Ww(Hw.LOAD_RESOURCES_FAILED,"Load resources failed",e)}))];case 1:return r=i.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){sk(e,"type",Bj(Qp));var t=this._context.getLocalAudioTrack();if(t){var r=MV(t.getTrack());if(r&&this.mixMediaStream(r),e===Qp.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:e_.AUDIO_MIXING_STATE_PCM_ENABLED,error:zw.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:e_.AUDIO_MIXING_STATE_PCM_DISABLED,error:zw.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;this._audioBufferSource&&this.cachedBuffer.push(e),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}),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()},Yp([ML(!1,"id","filePath","options")],e.prototype,"startAudioMixing",null),Yp([ML(!1,"id")],e.prototype,"stopAudioMixing",null),Yp([ML(!1,"id")],e.prototype,"pauseAudioMixing",null),Yp([ML(!1,"id")],e.prototype,"resumeAudioMixing",null),Yp([ML(!1,"id")],e.prototype,"preloadAudioMixing",null),Yp([ML(!1,"id")],e.prototype,"unloadAudioMixing",null),Yp([ML(!1,"id")],e.prototype,"getAudioMixingVolume",null),Yp([ML(!1,"id","volume")],e.prototype,"setAudioMixingVolume",null),Yp([ML(!1,"id")],e.prototype,"getAudioMixingDuration",null),Yp([ML(!1,"id")],e.prototype,"getAudioMixingCurrentPosition",null),Yp([ML(!1,"id","position")],e.prototype,"setAudioMixingPosition",null),Yp([ML(!1,"type")],e.prototype,"enableAudioMixingBuffer",null),Yp([ML()],e.prototype,"disableAudioMixingBuffer",null),Yp([ML(!1,"buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(iz||(iz={}));var az=new Ok("RTMClient",1),sz=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r._dataChannelSignal=null,r._handler=null,r._dataChannelSignalState=Ux.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 Cp(t,e),t.prototype.login=function(e,t){var r=this;return new Promise((function(n,i){if(az.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new Ww(Hw.ALREADY_LOGIN,"Already logined");r._userId=t,r._token=e,PL.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(az.print("login","init dataChannelSingling"),r._dataChannelSignalState=Ux.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))},t.prototype.logout=function(){var e;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){if(!this._loginSessionId||!this._userId)throw new Ww(Hw.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:VL.C2RTM}).catch((function(){})),this._closeDataChannelSignaling(),this._clearState(),[2]}))}))},t.prototype.updateLoginToken=function(e){return Xp(this,void 0,void 0,(function(){var t=this;return Wp(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 Xp(this,void 0,void 0,(function(){var t;return Wp(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new Ww(Hw.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:VL.C2RTM})];case 1:return[2,null==(t=r.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new Ww(Hw.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 Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new Ww(Hw.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:VL.C2RTM})];case 1:return r.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new Ww(Hw.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:RL.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=qD();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:QD.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now().toString(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:$k.VERSION,deviceId:WL.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:VL.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var r,n,i=t||{},o=i.code,a=i.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=Hw.INVALID_PARAMS,n="Invalid userId"):(r=Hw.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=Hw.LOGIN_FAILED,n="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new Ww(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){return Xp(this,void 0,void 0,(function(){var t,r,n,i,o,a=this;return Wp(this,(function(s){switch(s.label){case 0:if(t=new JL,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,WL.getDeviceId(),"")];case 2:if(!(r=s.sent()))throw new Error;return[3,4];case 3:throw s.sent(),LL("rtm.login.getNodeFailed","",0,!0),new Ww(Hw.ICE_SERVER_WRONG,"get ICE config failed");case 4:LL("rtm.login.getNodeSuccess",r,0,!0),az.print("_createDataChannelSignaling()","get node success",r),this._handler=new Nx,this._handler.once("disconnect",(function(){az.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 n=s.sent(),az.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=Ux.CONNECTED,[3,8];case 7:throw i=s.sent(),this._iceConfigNode=null,this._dataChannelSignalState=Ux.DISCONNECTED,new Ww(Hw.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",i);case 8:return o=new FL(n),az.print("_createDataChannelSignaling()","send ping"),o.sendPingSignaling(),o.once("close",(function(){az.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),a._onDisconnect()})),o.on(yL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(yL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(yL.USER_DISCONNECTION,(function(){a.emit("onUserDisconnection"),a._clearState()})),o.on(yL.NODE_CHANGE,(function(e){LL("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!==Ux.CONNECTED)throw new Ww(Hw.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=Ux.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&&(az.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){az.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){az.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}(vk.exports.EventEmitter),cz=new Ok("Engine",0),uz=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._videoStreamConstraints={},r._audioStreamConstraints={},r._videoStreamEncodeConfig=[{maxKbps:500}],r._screenStreamEncodeConfig=[{maxKbps:500}],r._pauseAllSubscribeState={audio:!1,video:!1},r._mirrorType=Gp.MIRROR_TYPE_RENDER,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=Qp.PLAYOUT_AND_PUBLISH),Xp(r,void 0,void 0,(function(){var r;return Wp(this,(function(n){switch(n.label){case 0:return cz.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:n.sent(),n.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(r_.onAudioMixingStateChanged,e)},r._appId=t,r._pubLock=new kx("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new oz({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage}),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=r,r._trackSourceType={video:Op.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:Op.VIDEO_SOURCE_TYPE_INTERNAL,audio:Np.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:Np.AUDIO_SOURCE_TYPE_INTERNAL},r._rtmClient=new sz(t),r._handleRTMClient(r._rtmClient),r}return Cp(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t;cz.print("updateToken()","token: %s",e),ak(e,"token"),null===(t=this._room)||void 0===t||t.updateToken(e)},t.prototype.switchCamera=function(e){var t,r;return Xp(this,void 0,void 0,(function(){var n,i;return Wp(this,(function(o){switch(o.label){case 0:return cz.print("switchCamera()","deviceId: %s",e),ak(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((n=this._videoStreamConstraints).deviceId={exact:e},this._videoStreamConstraints=n,[4,WV(n)]);case 1:return i=o.sent(),this._initLocalTrackEvents(i),this._localVideoTrack&&this._localVideoTrack.close(),this._localVideoTrack=i,this._videoPlayer&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(i),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 Xp(this,void 0,void 0,(function(){var n,i;return Wp(this,(function(o){switch(o.label){case 0:return cz.print("switchMicrophone()","deviceId: %s",e),ak(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((n=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=n,[4,qV(n)]);case 1:return i=o.sent(),this._initLocalTrackEvents(i),this._localAudioTrack&&this._localAudioTrack.close(),this._localAudioTrack=i,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(){OV.on(r_.onMediaDeviceStateChanged,this._onDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,E,g,S,y,b,T=this;null===(e=this._room)||void 0===e||e.on(yL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(yL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(yL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(yL.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._room)||void 0===i||i.on(yL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(o=this._room)||void 0===o||o.on(yL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(a=this._room)||void 0===a||a.on(yL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(s=this._room)||void 0===s||s.on(yL.POST_PROCESSING_MESSAGE,this._onLiveTranscodingResult.bind(this)),null===(c=this._room)||void 0===c||c.on(bL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(u=this._room)||void 0===u||u.on($V.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(d=this._room)||void 0===d||d.on($V.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(l=this._room)||void 0===l||l.on($V.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(h=this._room)||void 0===h||h.on($V.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(f=this._room)||void 0===f||f.on($V.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=T._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&T.safeEmit(r_.onAutoPublishResult,e)})),null===(p=this._room)||void 0===p||p.on("onRemoteStreamStats",(function(e){T.safeEmit(r_.onRemoteStreamStats,e)})),null===(_=this._room)||void 0===_||_.on("onLocalStreamStats",(function(e){T.safeEmit(r_.onLocalStreamStats,e)})),null===(v=this._room)||void 0===v||v.on($V.ON_USER_MUTE_AUDIO,this._onUserMuteAudio.bind(this)),null===(m=this._room)||void 0===m||m.on($V.ON_USER_MUTE_VIDEO,this._onUserMuteVideo.bind(this)),null===(E=this._room)||void 0===E||E.on($V.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(r_.onUserStartAudioCapture,{userId:t})})),null===(g=this._room)||void 0===g||g.on($V.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(r_.onUserStopAudioCapture,{userId:t})})),null===(S=this._room)||void 0===S||S.on($V.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(r_.onUserStartVideoCapture,{userId:t})})),null===(y=this._room)||void 0===y||y.on($V.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;T.safeEmit(r_.onUserStopVideoCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on($V.ON_SEI_MESSAGED_RECEIVED,(function(e){T.safeEmit(r_.onSEIMessageReceived,e)}))},t.prototype.safeEmit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return _k(t)&&UL(t,rk(r)),e.prototype.safeEmit.apply(this,Zp([t],Jp(r),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,r,n){return void 0===n&&(n={isAutoPublish:!1,isAutoSubscribeAudio:!1,isAutoSubscribeVideo:!1}),Xp(this,void 0,void 0,(function(){var i;return Wp(this,(function(o){switch(o.label){case 0:if(cz.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,r,n),lk(e)||ak(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9 \_\-\@]{1,128}$/.test(e))throw new Ww(Hw.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_")}(t),function(e){ck(e,"userInfo"),hk(e.userId),lk(e.extraInfo)||ak(e.extraInfo,"userInfo.extraInfo",1,200)}(r),function(e){ck(e,"roomConfig"),ik(e.isAutoPublish,"roomConfig.isAutoPublish"),ik(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),ik(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(n),!this._room||this._room.connectionState===Ux.DISCONNECTED)return[3,1];throw new Ww(Hw.REPEAT_JOIN,"Already joined");case 1:return this._room=new oB(n),this._addHandlerEventHandler(),i=this._liveTranscodeConfig&&tP("started",this._liveTranscodeConfig),[4,this._room.join(this._appId,t,e,Kp(Kp({},r),{businessId:this._businessId,role:this._visibility?iz.NORMAL_USER:iz.SILENT_USER}),i)];case 2:return o.sent(),this._roomConfig=n,(this._localAudioTrack||this._localVideoTrack)&&n.isAutoPublish?[4,this._updatePublish()]:[3,4];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},t.prototype.leaveRoom=function(){var e;cz.print("leaveRoom()"),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.leave().catch,this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.stop()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.stop()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.stop()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0},t.prototype.destroy=function(){var e,t,r;cz.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=[{maxKbps:500}],this._screenStreamEncodeConfig=[{maxKbps:500}],this._pauseAllSubscribeState={audio:!1,video:!1},clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=void 0,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._remoteAudioPlayer.forEach((function(e){return e.stop()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.stop()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.stop()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy()},t.prototype.publish=function(){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(e){switch(e.label){case 0:if(cz.print("publish()"),!this._room||this._room.connectionState!==Ux.CONNECTED)throw new Ww(Hw.PUBLISH_BEFORE_JOIN,"join first");return[4,this._updatePublish()];case 1:return e.sent(),[2]}}))}))},t.prototype.unpublish=function(){return Xp(this,void 0,void 0,(function(){var e,t;return Wp(this,(function(r){switch(r.label){case 0:if(cz.print("unpublish()"),!this._room)throw new Ww(Hw.UNPUBLISH_BEFORE_JOIN,"join first");return[4,this._pubLock.lock()];case 1:e=r.sent(),r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.unpublish()];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof Ww?t:new Ww(Hw.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype.subscribeUserStream=function(e,t,r,n){var i,o,a,s;return void 0===r&&(r=Vp.STREAM_INDEX_MAIN),void 0===n&&(n={videoIndex:0}),Xp(this,void 0,void 0,(function(){var c,u,d,l,h,f;return Wp(this,(function(p){switch(p.label){case 0:if(cz.print("subscribeStream()","userId: %o, mediaType: %o, streamType: %o, configure: %o",e,t,r,n),hk(e),sk(t,"mediaType",[Bp.AUDIO_AND_VIDEO,Bp.AUDIO_ONLY,Bp.VIDEO_ONLY,Bp.NONE]),sk(r,"streamType",[Vp.STREAM_INDEX_MAIN,Vp.STREAM_INDEX_SCREEN]),ok(n.videoIndex,"config.videoIndex",0,2),!this._room||this._room.connectionState!==Ux.CONNECTED)throw new Ww(Hw.SUBSCRIBE_BEFORE_JOIN,"join first");if(c=this._room.remoteStreams.get(e),d=r===Vp.STREAM_INDEX_SCREEN,!(u=d?null==c?void 0:c.find((function(e){return e.isScreen})):null==c?void 0:c.find((function(e){return!e.isScreen}))))throw new Ww(Hw.STREAM_NOT_EXIST,"stream not exist");p.label=1;case 1:return p.trys.push([1,3,,4]),l=t,this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?t=Bp.NONE:this._pauseAllSubscribeState.audio&&!this._pauseAllSubscribeState.video?t===Bp.AUDIO_AND_VIDEO?t=Bp.VIDEO_ONLY:t===Bp.AUDIO_ONLY&&(t=Bp.NONE):!this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video&&(t===Bp.AUDIO_AND_VIDEO?t=Bp.AUDIO_ONLY:t===Bp.VIDEO_ONLY&&(t=Bp.NONE)),t!==l&&cz.print("subscribeUserStream","due to pauseAllState change sub mediaType from ".concat(l," to ").concat(t)),[4,this._room.subscribe(u,t,n)];case 2:return p.sent(),t!==Bp.AUDIO_AND_VIDEO&&t!==Bp.AUDIO_ONLY||this._updateAudioPlayerState(u),t!==Bp.AUDIO_AND_VIDEO&&t!==Bp.VIDEO_ONLY||this._updateVideoPlayerState(u),((null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)||(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo))&&(u.audioTrack||u.videoTrack)&&(f={userId:e,isScreen:d,state:Pp.SUBSCRIBE_SUCC},this.safeEmit(r_.onAutoSubscribeResult,f)),[3,4];case 3:throw h=p.sent(),((null===(a=this._roomConfig)||void 0===a?void 0:a.isAutoSubscribeAudio)||(null===(s=this._roomConfig)||void 0===s?void 0:s.isAutoSubscribeVideo))&&(f={userId:e,isScreen:d,state:Pp.SUBSCRIBE_FAIL},this.safeEmit(r_.onAutoSubscribeResult,f)),h;case 4:return[2]}}))}))},t.prototype.unSubscribe=function(e,t){return Xp(this,void 0,void 0,(function(){var r,n;return Wp(this,(function(i){switch(i.label){case 0:if(cz.print("unSubscribe()","userId: %s, isScreen: %o",e,t),hk(e),ik(t,"isScreen"),!this._room||this._room.connectionState!==Ux.CONNECTED)throw new Ww(Hw.SUBSCRIBE_BEFORE_JOIN,"join first");if(r=this._room.remoteStreams.get(e),!(n=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 Ww(Hw.STREAM_NOT_EXIST,"stream not exist");return[4,this._room.unsubscribe(n)];case 1:return i.sent(),this._updateAudioPlayerState(n),this._updateVideoPlayerState(n),[2]}}))}))},t.prototype.startVideoCapture=function(e){return Xp(this,void 0,void 0,(function(){var t,r,n;return Wp(this,(function(i){switch(i.label){case 0:if(cz.print("startVideoCapture()","deviceId: %s",e),lk(e)||ak(e,"deviceId"),this._localVideoTrack)throw new Ww(Hw.REPEAT_CAPTURE,"Has already capture");return t=this._videoStreamConstraints,e&&(t.deviceId={exact:e},this._videoStreamConstraints=t),[4,WV(t)];case 1:return r=i.sent(),this._initLocalTrackEvents(r),this._localVideoTrack=r,this._videoPlayer&&this._videoPlayer.playVideo(r),this._room?(n=this._room._roomConfig.isAutoPublish,this._room.hasPublished||n?[4,this._updatePublish()]:[3,3]):[2];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype.stopVideoCapture=function(){var e;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){switch(t.label){case 0:if(cz.print("stopVideoCapture()"),this._trackSourceType.video===Op.VIDEO_SOURCE_TYPE_EXTERNAL)throw new Ww(Hw.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return this._videoPlayer&&this._videoPlayer.stop(),null===(e=this._localVideoTrack)||void 0===e||e.close(),this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.startAudioCapture=function(e){return Xp(this,void 0,void 0,(function(){var t,r,n;return Wp(this,(function(i){switch(i.label){case 0:if(cz.print("startAudioCapture()","deviceId: $o",e),lk(e)||ak(e,"deviceId"),this._localAudioTrack)throw new Ww(Hw.REPEAT_CAPTURE,"Has already capture");return t=this._audioStreamConstraints,e&&(t.deviceId={exact:e},this._audioStreamConstraints=t),[4,qV(t)];case 1:return r=i.sent(),this._initLocalTrackEvents(r),this._localAudioTrack=r,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(n=this._room._roomConfig.isAutoPublish,this._room.hasPublished||n?[4,this._updatePublish()]:[3,3]):[2];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype.stopAudioCapture=function(){var e;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){switch(t.label){case 0:if(cz.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===Np.AUDIO_SOURCE_TYPE_EXTERNAL)throw new Ww(Hw.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.getAudioMixingManager=function(){return cz.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,r;return void 0===e&&(e={}),Xp(this,void 0,void 0,(function(){var n,i,o,a;return Wp(this,(function(s){switch(s.label){case 0:if(cz.print("startScreenCapture()","config: %o",e),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localScreenVideoTrack=void 0,n=e.enableAudio,i=void 0!==n&&n,this._trackSourceType.screenVideo===Op.VIDEO_SOURCE_TYPE_EXTERNAL)throw new Ww(Hw.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===Np.AUDIO_SOURCE_TYPE_EXTERNAL)throw new Ww(Hw.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,JV(i)];case 1:return o=s.sent(),this._localScreenVideoTrack=new zV(o.getVideoTracks()[0],qD()),(a=o.getAudioTracks()).length&&(this._localScreenAudioTrack=new KV(a[0],qD()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(r=this._screenPlayer)||void 0===r||r.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,r;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(n){return cz.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localScreenVideoTrack=void 0,null===(r=this._localScreenAudioTrack)||void 0===r||r.close(),this._localScreenAudioTrack=void 0,[2]}))}))},t.prototype.publishScreen=function(){return Xp(this,void 0,void 0,(function(){var e;return Wp(this,(function(t){switch(t.label){case 0:if(cz.print("publishScreen()"),!this._room||this._room.connectionState!==Ux.CONNECTED)throw new Ww(Hw.PUBLISH_BEFORE_JOIN,"join first");if(!this._visibility)throw new Ww(Hw.NO_PUBLISH_PERMISSION,"no publish permission");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof Ww?e:new Ww(Hw.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.unpublishScreen=function(){return Xp(this,void 0,void 0,(function(){var e;return Wp(this,(function(t){switch(t.label){case 0:if(cz.print("unpublishScreen()"),!this._room)throw new Ww(Hw.UNPUBLISH_BEFORE_JOIN,"join first");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._room.unpublishScreen()];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof Ww?e:new Ww(Hw.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var r,n;cz.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),sk(e,"streamIndex",[Vp.STREAM_INDEX_MAIN,Vp.STREAM_INDEX_SCREEN]),t&&t.renderDom?(fk(t),e==Vp.STREAM_INDEX_MAIN?(this._videoPlayer=new fB(t),this._initPlayerEvents(this._videoPlayer),this._localVideoTrack&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.mirror(!!this._mirrorType)):(this._screenPlayer=new fB(Kp(Kp({},t),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&this._screenPlayer.playVideo(this._localScreenVideoTrack))):e==Vp.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(n=this._screenPlayer)||void 0===n||n.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return Xp(this,void 0,void 0,(function(){var r;return Wp(this,(function(n){switch(n.label){case 0:cz.print("startLiveTranscoding()","transcode: %o",e),ak(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.controlMessage(tP("started",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof Ww?r:new Ww(Hw.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return Xp(this,void 0,void 0,(function(){var r;return Wp(this,(function(n){switch(n.label){case 0:if(cz.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=xj(this._liveTranscodeConfig,e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.controlMessage(tP("layoutChanged",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof Ww?r:new Ww(Hw.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return Xp(this,void 0,void 0,(function(){var t;return Wp(this,(function(r){switch(r.label){case 0:if(cz.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.controlMessage({action:"stopped",type:"transcode"})];case 2:return r.sent(),[3,4];case 3:throw(t=r.sent())instanceof Ww?t:new Ww(Hw.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){if(cz.print("setBusinessId()","businessId: %s",e),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9 \_\-\@]{1,128}$/.test(e))throw new Ww(Hw.INVALID_PARAMS,"The businessId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_")}(e),this._room)throw new Ww(Hw.ALREADY_IN_ROOM,"You should invoke setBusinessId before joinRoom");kL.setStats({rtc_business_id:e}),this._businessId=e},t.prototype.setUserVisibility=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){switch(t.label){case 0:if(cz.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==Ux.CONNECTED)throw new Ww(Hw.NOT_CONNECTED_YET,"server not connected");return!e?[4,this._room.unpublish()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?iz.NORMAL_USER:iz.SILENT_USER})];case 3:return t.sent(),this._visibility=e,[2]}}))}))},t.prototype._initPlayerEvents=function(e){var t=this;e.on("playback_event",(function(r){var n,i;switch(r.eventName){case"timeupdate":return;case"loadeddata":if("audio"===r.type)t.safeEmit(r_.onAudioFirstFrameDecoded,{userId:e.userId}),wL.firstRemoteAudioRender("",r.userId);else{var o={userId:e.userId,height:(null===(n=e.domElement)||void 0===n?void 0:n.videoHeight)||0,width:(null===(i=e.domElement)||void 0===i?void 0:i.videoWidth)||0};t.safeEmit(r_.onVideoFirstFrameDecoded,o),t.safeEmit(r_.onVideoFirstFrameRendered,o),wL.firstRemoteVideoRender("",r.userId)}break;case"autoplay-error":return void t.safeEmit(r_.onAutoplayFailed,r)}t.safeEmit(r_.onPlayerEvent,r)}))},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(r_.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var r,n,i,o,a,s;if(cz.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),sk(e,"streamIndex",[Vp.STREAM_INDEX_MAIN,Vp.STREAM_INDEX_SCREEN]),t.renderDom){fk(t);var c=t.userId;if(e==Vp.STREAM_INDEX_MAIN){var u=new fB(t);this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(o=null===(i=this._room)||void 0===i?void 0:i.remoteStreams.get(c))||void 0===o?void 0:o.find((function(e){return!e.isScreen})))&&this._updateVideoPlayerState(d)}else{var d;u=new fB(Kp(Kp({},t),{isScreen:!0}));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)}}else e==Vp.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(n=this._screenPlayer)||void 0===n||n.destroy(),delete this._screenPlayer)},t.prototype.setLocalVideoMirrorType=function(e){cz.print("setLocalVideoMirrorType()","mirrorType: %o",e),sk(e,"mirrorType",[Gp.MIRROR_TYPE_NONE,Gp.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){var t;return Xp(this,void 0,void 0,(function(){var r;return Wp(this,(function(n){switch(n.label){case 0:return cz.print("setAudioPlaybackDevice()","deviceId: %s",e),ak(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(cz.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,OV.getDeviceById(e)];case 1:if(!(r=n.sent()))throw new Ww(Hw.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(r_.onAudioPlaybackDeviceChanged,r),wL.rtcAudioDevice(QU.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){return Xp(this,void 0,void 0,(function(){var t,r;return Wp(this,(function(n){if(cz.print("play()","userId: %s",e),hk(e),t=this._remoteAudioPlayer.get(e),r=this._remoteVideoPlayer.get(e),t||(t=this._audioPlayer),r||(r=this._videoPlayer),!t&&!r)throw new Ww(Hw.INVALID_PARAMS,"Player not found");return t&&t.manuallyPlay(),r&&r.manuallyPlay(),[2]}))}))},t.prototype.muteLocalAudio=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){if(cz.print("muteLocalAudio()","muteState: %o",e),sk(e,"muteState",[kp.MUTE_STATE_OFF,kp.MUTE_STATE_ON]),!this._room)throw new Ww(Hw.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("audio",e)]}))}))},t.prototype.muteLocalVideo=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){if(cz.print("muteLocalVideo()","muteState: %o",e),sk(e,"muteState",[kp.MUTE_STATE_OFF,kp.MUTE_STATE_ON]),!this._room)throw new Ww(Hw.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("video",e)]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Xp(this,void 0,void 0,(function(){var t,r=this;return Wp(this,(function(n){return cz.print("pauseAllSubscribedStream()","mediaType: %o",e),sk(e,"mediaType",[Lp.RTC_PAUSE_RESUME_CONTROL_AUDIO,Lp.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,Lp.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){e===Lp.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!0:e===Lp.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!0:e===Lp.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 Xp(this,void 0,void 0,(function(){var t,r=this;return Wp(this,(function(n){return cz.print("resumeAllSubscribedStream()","mediaType: %o",e),sk(e,"mediaType",[Lp.RTC_PAUSE_RESUME_CONTROL_AUDIO,Lp.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,Lp.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){e===Lp.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!1:e===Lp.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!1:e===Lp.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,n;t(),null===(n=null===(e=r._room)||void 0===e?void 0:e.remoteStreams)||void 0===n||n.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 Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){if(hk(e),pk(t),!this._room||this._room.connectionState!==Ux.CONNECTED)throw new Ww(Hw.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){if(hk(e),uk(t,"message"),pk(t),!this._room||this._room.connectionState!==Ux.CONNECTED)throw new Ww(Hw.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendRoomMessage=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){if(pk(e),!this._room||this._room.connectionState!==Ux.CONNECTED)throw new Ww(Hw.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e)]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){if(pk(e),!this._room||this._room.connectionState!==Ux.CONNECTED)throw new Ww(Hw.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e,!0)]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),Xp(this,void 0,void 0,(function(){var r;return Wp(this,(function(n){switch(n.label){case 0:return cz.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,dk(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:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),Xp(this,void 0,void 0,(function(){var r;return Wp(this,(function(n){switch(n.label){case 0:return cz.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,dk(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:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setVideoEncoderConfig=function(e,t){var r,n,i,o,a,s,c,u;return Xp(this,void 0,void 0,(function(){return Wp(this,(function(d){if(cz.print("setVideoEncoderConfig()","streamIndex: %o, descriptions: %o",e,t),sk(e,"streamIndex",[Vp.STREAM_INDEX_MAIN,Vp.STREAM_INDEX_SCREEN]),function(e,t){if(!Array.isArray(e))throw new Ww(Hw.INVALID_PARAMS,"Invalid ".concat(t,", should be array"))}(t,"descriptions"),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),e===Vp.STREAM_INDEX_MAIN){if(null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.hasPublished){if(1!==this._videoStreamEncodeConfig.length||1!==(null==t?void 0:t.length))throw new Ww(Hw.INVALID_PARAMS,"After publishing, only non simulcast streams can be modified");null===(o=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===o||o.updateVideoBitrate(t)}this._videoStreamEncodeConfig=t}else{if(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished){if(1!==this._screenStreamEncodeConfig.length||1!==(null==t?void 0:t.length))throw new Ww(Hw.INVALID_PARAMS,"After publishing, only non simulcast streams can be modified");null===(u=null===(c=this._room)||void 0===c?void 0:c.localScreenStream)||void 0===u||u.updateVideoBitrate([t[0]])}this._screenStreamEncodeConfig=t}return[2]}))}))},t.prototype.sendSEIMessage=function(e,t,r){var n,i,o,a,s,c;cz.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),sk(e,"streamIndex",[Vp.STREAM_INDEX_MAIN,Vp.STREAM_INDEX_SCREEN]),ok(r,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(QD.str2ab(t)):t;if(t.length){var d;if(e===Vp.STREAM_INDEX_MAIN){if(!(null===(i=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===i?void 0:i.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)cz.print("sei size must not bigger than 4KB");else{var l=qD();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 cz.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;cz.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,n,i,o;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n,i;if(0!==e.length){var o=null===(i=null===(n=e[0])||void 0===n?void 0:n.audioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:t,volume:o||0})}}));var a=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:(null===(o=null===(i=t._room)||void 0===i?void 0:i.roomInfo)||void 0===o?void 0:o.userInfo.userId)||"local_user",volume:a||0}),t.safeEmit(r_.onAudioVolumeIndication,{speakers:r})}),e)},t.prototype.setVideoSourceType=function(e,t){var r,n,i,o,a;return Xp(this,void 0,void 0,(function(){var s,c;return Wp(this,(function(u){switch(u.label){case 0:return cz.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),sk(e,"streamIndex",[Vp.STREAM_INDEX_MAIN,Vp.STREAM_INDEX_SCREEN]),sk(t,"VideoSourceType",[Op.VIDEO_SOURCE_TYPE_EXTERNAL,Op.VIDEO_SOURCE_TYPE_INTERNAL]),s=e===Vp.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[s]===t?[3,4]:(this._trackSourceType[s]=t,cz.print("setVideoSourceType","set ".concat(s," source type to ").concat(t)),this._localVideoTrack&&e===Vp.STREAM_INDEX_MAIN?(t===Op.VIDEO_SOURCE_TYPE_EXTERNAL&&this._localVideoTrack.close(),null===(r=this._videoPlayer)||void 0===r||r.stop(),this._localVideoTrack=void 0,c=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,(null===(i=this._room)||void 0===i?void 0:i.hasPublished)||c?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:u.sent(),u.label=2;case 2:return this._localScreenVideoTrack&&e===Vp.STREAM_INDEX_SCREEN?(t===Op.VIDEO_SOURCE_TYPE_EXTERNAL&&this._localScreenVideoTrack.close(),null===(o=this._screenPlayer)||void 0===o||o.stop(),this._localScreenVideoTrack=void 0,(null===(a=this._room)||void 0===a?void 0:a.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:u.sent(),u.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var r,n,i,o,a;return Xp(this,void 0,void 0,(function(){var s;return Wp(this,(function(c){switch(c.label){case 0:if(cz.print("setExternalVideoTrack()","index: %o, track: %o",e,t),sk(e,"streamIndex",[Vp.STREAM_INDEX_MAIN,Vp.STREAM_INDEX_SCREEN]),e!==Vp.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==Op.VIDEO_SOURCE_TYPE_EXTERNAL)throw new Ww(Hw.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new YV(t,qD()),this._initLocalTrackEvents(this._localVideoTrack),null===(r=this._videoPlayer)||void 0===r||r.playVideo(this._localVideoTrack),s=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,(null===(i=this._room)||void 0===i?void 0:i.hasPublished)||s?[4,this._updatePublish()]:[3,2];case 1:c.sent(),c.label=2;case 2:if(e!==Vp.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==Op.VIDEO_SOURCE_TYPE_EXTERNAL)throw new Ww(Hw.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new YV(t,qD()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),(null===(a=this._room)||void 0===a?void 0:a.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:c.sent(),c.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var r,n,i;return Xp(this,void 0,void 0,(function(){var o,a;return Wp(this,(function(s){switch(s.label){case 0:return cz.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),sk(e,"streamIndex",[Vp.STREAM_INDEX_MAIN,Vp.STREAM_INDEX_SCREEN]),sk(t,"audioSourceType",[Np.AUDIO_SOURCE_TYPE_EXTERNAL,Np.AUDIO_SOURCE_TYPE_INTERNAL]),o=e===Vp.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[o]===t?[3,4]:(this._trackSourceType[o]=t,cz.print("setVideoSourceType","set ".concat(o," source type to ").concat(t)),this._localAudioTrack&&e===Vp.STREAM_INDEX_MAIN?(this._trackSourceType.audio===Np.AUDIO_SOURCE_TYPE_EXTERNAL&&this._localAudioTrack.close(),this._localAudioTrack=void 0,a=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||a?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:s.sent(),s.label=2;case 2:return this._localScreenAudioTrack&&e===Vp.STREAM_INDEX_SCREEN?(this._trackSourceType.audio===Np.AUDIO_SOURCE_TYPE_EXTERNAL&&this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0,(null===(i=this._room)||void 0===i?void 0:i.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:s.sent(),s.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var r,n,i;return Xp(this,void 0,void 0,(function(){var o;return Wp(this,(function(a){switch(a.label){case 0:if(cz.print("setExternalAudioTrack()","index: %o, track: %o",e,t),sk(e,"streamIndex",[Vp.STREAM_INDEX_MAIN,Vp.STREAM_INDEX_SCREEN]),e!==Vp.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==Np.AUDIO_SOURCE_TYPE_EXTERNAL)throw new Ww(Hw.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new XV(t,qD()),this._initLocalTrackEvents(this._localAudioTrack),o=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||o?[4,this._updatePublish()]:[3,2];case 1:a.sent(),a.label=2;case 2:if(e!==Vp.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==Np.AUDIO_SOURCE_TYPE_EXTERNAL)throw new Ww(Hw.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new XV(t,qD()),this._initLocalTrackEvents(this._localScreenAudioTrack),(null===(i=this._room)||void 0===i?void 0:i.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:a.sent(),a.label=4;case 4:return[2]}}))}))},t.prototype.login=function(e,t){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){return cz.print("login()","token: %o, userInfo: %o",e,t),lk(e)||ak(e,"token"),hk(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(e){return cz.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){return cz.print("updateLoginToken()","token: %o",e),lk(e)||ak(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){return cz.print("getPeerOnlineStatus()","userId: %o",e),hk(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){return hk(e),pk(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){return hk(e),uk(t,"message"),pk(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.setServerParams=function(e,t){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(r){return cz.print("setServerParams()","signature: %o, url: %0",e,t),ak(e,"signature"),ak(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){return ak(e,"message"),pk(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.sendServerBinaryMessage=function(e){return Xp(this,void 0,void 0,(function(){return Wp(this,(function(t){return uk(e,"message"),pk(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype._updatePublish=function(){return Xp(this,void 0,void 0,(function(){var e,t;return Wp(this,(function(r){switch(r.label){case 0:if(cz.print("_updatePublish()"),!this._visibility)throw new Ww(Hw.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==Ux.CONNECTED)return e(),[2];r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._localVideoTrack,this._localAudioTrack)];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof Ww?t:new Ww(Hw.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateScreenPublish=function(){return Xp(this,void 0,void 0,(function(){var e,t;return Wp(this,(function(r){switch(r.label){case 0:return cz.print("_updateScreenPublish()"),[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==Ux.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 Ww?t:new Ww(Hw.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){cz.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen;if(t=n?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack){if(!t){var i=n?"".concat(r,"_screen"):r;t=new pB(i),this._initPlayerEvents(t),this._remoteAudioPlayer.set(i,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}t.playAudio(e.audioTrack)}else null==t||t.stop()},t.prototype._updateVideoPlayerState=function(e){cz.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,n,i,o=e.stream,a={userId:o.userId,isScreen:o.isScreen,hasVideo:o.hasVideo,hasAudio:o.hasAudio,videoStreamDescriptions:o.attributes.videoDescriptions};this.safeEmit(r_.onStreamAdd,{stream:a});var s=null;(null===(t=this._roomConfig)||void 0===t?void 0:t.isAutoSubscribeAudio)&&(s=Bp.AUDIO_ONLY),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(s=Bp.VIDEO_ONLY),(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeVideo)&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(s=Bp.AUDIO_AND_VIDEO),cz.print("_onAddStream","autoSubType: ".concat(s)),null===s||o.isScreen||this.subscribeUserStream(o.userId,s)},t.prototype._onRemoveStream=function(e){var t=e.stream,r={userId:t.userId,isScreen:t.isScreen,hasVideo:t.hasVideo,hasAudio:t.hasAudio,videoStreamDescriptions:[]},n=dz[e.reason]||jp.STREAM_REMOVE_REASON_OTHER;this.safeEmit(r_.onStreamRemove,{stream:r,reason:n}),this._stopRemotePlayer(t.userId,t.isScreen)},t.prototype._onUserConnection=function(e){this.safeEmit(r_.onUserJoined,e)},t.prototype._onUserDisconnection=function(e){var t,r,n,i;(null===(t=null==e?void 0:e.userInfo)||void 0===t?void 0:t.userId)===(null===(i=null===(n=null===(r=this._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.userInfo)||void 0===i?void 0:i.userId)?"userDuplicateLogin"===(null==e?void 0:e.reason)&&this.safeEmit(r_.onError,{errorCode:Hw.DUPLICATE_LOGIN}):this.safeEmit(r_.onUserLeave,{userInfo:e.userInfo,reason:"userLeave"===e.reason?0:1})},t.prototype._onConnectionStateChange=function(e){this.safeEmit(r_.onConnectionStateChanged,e)},t.prototype._stopRemotePlayer=function(e,t){var r=t?"".concat(e,"_screen"):e,n=this._remoteAudioPlayer.get(r),i=this._remoteVideoPlayer.get(r);n&&n.stop(),i&&i.stop()},t.prototype._onResubscribe=function(e){e.stream&&(this._stopRemotePlayer(e.stream.userId,e.stream.isScreen),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(r_.onVideoFirstFrameDecoded,e)},t.prototype._onDeviceStateChange=function(e){this.safeEmit(r_.onMediaDeviceStateChanged,e)},t.prototype._onUserMuteAudio=function(e){this.safeEmit(r_.onUserMuteAudio,e)},t.prototype._onUserMuteVideo=function(e){this.safeEmit(r_.onUserMuteVideo,e)},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(r_.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(r_.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this.safeEmit(r_.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(r_.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(r_.onLiveTranscodingResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t.safeEmit(r_.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t.safeEmit(r_.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(r_.onError,{errorCode:Hw.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(r_.onError,{errorCode:Hw.RTM_TOKEN_ERROR})}))},Yp([ML()],t.prototype,"updateToken",null),Yp([ML()],t.prototype,"switchCamera",null),Yp([ML()],t.prototype,"switchMicrophone",null),Yp([ML()],t.prototype,"joinRoom",null),Yp([ML()],t.prototype,"leaveRoom",null),Yp([ML()],t.prototype,"destroy",null),Yp([ML()],t.prototype,"publish",null),Yp([ML()],t.prototype,"unpublish",null),Yp([ML()],t.prototype,"subscribeUserStream",null),Yp([ML()],t.prototype,"unSubscribe",null),Yp([ML()],t.prototype,"startVideoCapture",null),Yp([ML()],t.prototype,"stopVideoCapture",null),Yp([ML()],t.prototype,"startAudioCapture",null),Yp([ML()],t.prototype,"stopAudioCapture",null),Yp([ML()],t.prototype,"getAudioMixingManager",null),Yp([ML()],t.prototype,"startScreenCapture",null),Yp([ML()],t.prototype,"stopScreenCapture",null),Yp([ML()],t.prototype,"publishScreen",null),Yp([ML()],t.prototype,"unpublishScreen",null),Yp([ML()],t.prototype,"setLocalVideoPlayer",null),Yp([ML()],t.prototype,"startLiveTranscoding",null),Yp([ML()],t.prototype,"updateLiveTranscoding",null),Yp([ML()],t.prototype,"stopLiveTranscoding",null),Yp([ML()],t.prototype,"setBusinessId",null),Yp([ML()],t.prototype,"setUserVisibility",null),Yp([ML()],t.prototype,"setRemoteVideoPlayer",null),Yp([ML()],t.prototype,"setLocalVideoMirrorType",null),Yp([ML()],t.prototype,"setAudioPlaybackDevice",null),Yp([ML()],t.prototype,"play",null),Yp([ML()],t.prototype,"muteLocalAudio",null),Yp([ML()],t.prototype,"muteLocalVideo",null),Yp([ML()],t.prototype,"pauseAllSubscribedStream",null),Yp([ML()],t.prototype,"resumeAllSubscribedStream",null),Yp([ML()],t.prototype,"sendUserMessage",null),Yp([ML()],t.prototype,"sendUserBinaryMessage",null),Yp([ML()],t.prototype,"sendRoomMessage",null),Yp([ML()],t.prototype,"sendRoomBinaryMessage",null),Yp([ML()],t.prototype,"setAudioCaptureConfig",null),Yp([ML()],t.prototype,"setVideoCaptureConfig",null),Yp([ML()],t.prototype,"setVideoEncoderConfig",null),Yp([ML()],t.prototype,"sendSEIMessage",null),Yp([ML()],t.prototype,"setAudioVolumeIndicationInterval",null),Yp([ML()],t.prototype,"setVideoSourceType",null),Yp([ML()],t.prototype,"setExternalVideoTrack",null),Yp([ML()],t.prototype,"setAudioSourceType",null),Yp([ML()],t.prototype,"setExternalAudioTrack",null),Yp([ML(!0)],t.prototype,"login",null),Yp([ML(!0)],t.prototype,"logout",null),Yp([ML(!0)],t.prototype,"updateLoginToken",null),Yp([ML(!0)],t.prototype,"getPeerOnlineStatus",null),Yp([ML(!0)],t.prototype,"sendUserMessageOutsideRoom",null),Yp([ML(!0)],t.prototype,"sendUserBinaryMessageOutsideRoom",null),Yp([ML(!0)],t.prototype,"setServerParams",null),Yp([ML(!0)],t.prototype,"sendServerMessage",null),Yp([ML(!0)],t.prototype,"sendServerBinaryMessage",null),t}(wk),dz={"client unpublished":jp.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":jp.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":jp.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":jp.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":jp.STREAM_REMOVE_REASON_REPUBLISH},lz=new Ok("VERTC",0),hz=function(e){return lz.print("createEngine","Invoke VERTC.createEngine"),ak(e,"appId"),[kL,PL].forEach((function(t){return t.setStats({rtc_app_id:e,rtc_sdk_version:gz(),product_line:OU.RTC,report_version:NU.W_5,os:wU.WEB,device_id:WL.getDeviceId(),user_agent:null===navigator||void 0===navigator?void 0:navigator.userAgent})})),wL.sdkInitEngine(Date.now(),oL.BEGIN),new uz(e)},fz=function(e){if(lz.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof uz))throw new Ww(Hw.INVALID_ENGINE,"Invalid engine object");e.destroy(),wL.sdkInitEngine(Date.now(),oL.END)},pz=function(){return Xp(void 0,void 0,void 0,(function(){return Wp(this,(function(e){return[2,OV.getDevices()]}))}))},_z=function(e){return void 0===e&&(e={video:!0,audio:!0}),Xp(void 0,void 0,void 0,(function(){var t,r,n,i,o;return Wp(this,(function(a){switch(a.label){case 0:if(t=e.video,r=e.audio,n={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),i=n,[4,OV.getVideoPermission()];case 2:return i.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=n,[4,OV.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,n]}}))}))},vz=function(){return Xp(void 0,void 0,void 0,(function(){return Wp(this,(function(e){return[2,OV.getMicrophones()]}))}))},mz=function(){return Xp(void 0,void 0,void 0,(function(){return Wp(this,(function(e){return[2,OV.getCameras()]}))}))},Ez=function(){return Xp(void 0,void 0,void 0,(function(){return Wp(this,(function(e){return[2,OV.getAudioPlayback()]}))}))},gz=function(){return $k.VERSION},Sz=new function(){this.getSdkVersion=gz,this.createEngine=hz,this.destroyEngine=fz,this.getDevices=pz,this.enableDevices=_z,this.getMicrophones=vz,this.getCameras=mz,this.getAudioPlayback=Ez,this.getParameter=eP,this.setParameter=Qk,this.isSupported=Ix,this.events=r_,this.ErrorCode=Hw,this.platform="BytePlus"};return Kp(Kp(Kp(Kp({},Sz),t_),n_),{events:r_})}));
|
|
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 n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{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:{},n=function(e){return e&&e.Math==Math&&e},i=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("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,E=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},g=c,S=Function.prototype,y=S.bind,b=S.call,T=g&&y.bind(b,b),I=g?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,k=i.Object,P=N("".split),M=w((function(){return!k("z").propertyIsEnumerable(0)}))?function(e){return"String"==D(e)?P(e,""):k(e)}:k,U=i.TypeError,L=function(e){if(null==e)throw U("Can't call method on "+e);return e},x=M,V=L,B=function(e){return x(V(e))},j=function(e){return"function"==typeof e},F=j,G=function(e){return"object"==typeof e?null!==e:F(e)},H=i,z=j,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")||"",q=i,J=W,Z=q.process,$=q.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&&J&&(!(v=J.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=J.match(/Chrome\/(\d+)/))&&(m=+v[1]);var te=m,re=te,ne=a,ie=!!Object.getOwnPropertySymbols&&!ne((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&re&&re<41})),oe=ie&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ae=Y,se=j,ce=X,ue=oe,de=i.Object,le=ue?function(e){return"symbol"==typeof e}:function(e){var t=ae("Symbol");return se(t)&&ce(t.prototype,de(e))},he=i.String,pe=function(e){try{return he(e)}catch(e){return"Object"}},fe=j,_e=pe,ve=i.TypeError,me=function(e){if(fe(e))return e;throw ve(_e(e)+" is not a function")},Ee=me,ge=function(e,t){var r=e[t];return null==r?void 0:Ee(r)},Se=l,ye=j,be=G,Te=i.TypeError,Ie={exports:{}},Re=i,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=i[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 ke=L,Pe=i.Object,Me=function(e){return Pe(ke(e))},Ue=Me,Le=I({}.hasOwnProperty),xe=Object.hasOwn||function(e,t){return Le(Ue(e),t)},Ve=I,Be=0,je=Math.random(),Fe=Ve(1..toString),Ge=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Fe(++Be+je,36)},He=i,ze=Ie.exports,Ke=xe,Ye=Ge,Xe=ie,We=oe,qe=ze("wks"),Je=He.Symbol,Ze=Je&&Je.for,$e=We?Je:Je&&Je.withoutSetter||Ye,Qe=function(e){if(!Ke(qe,e)||!Xe&&"string"!=typeof qe[e]){var t="Symbol."+e;Xe&&Ke(Je,e)?qe[e]=Je[e]:qe[e]=We&&Ze?Ze(t):$e(t)}return qe[e]},et=l,tt=G,rt=le,nt=ge,it=function(e,t){var r,n;if("string"===t&&ye(r=e.toString)&&!be(n=Se(r,e)))return n;if(ye(r=e.valueOf)&&!be(n=Se(r,e)))return n;if("string"!==t&&ye(r=e.toString)&&!be(n=Se(r,e)))return n;throw Te("Can't convert object to primitive value")},ot=Qe,at=i.TypeError,st=ot("toPrimitive"),ct=function(e,t){if(!tt(e)||rt(e))return e;var r,n=nt(e,st);if(n){if(void 0===t&&(t="default"),r=et(n,e,t),!tt(r)||rt(r))return r;throw at("Can't convert object to primitive value")}return void 0===t&&(t="number"),it(e,t)},ut=ct,dt=le,lt=function(e){var t=ut(e,"string");return dt(t)?t:t+""},ht=G,pt=i.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})),Et=s,gt=l,St=h,yt=E,bt=B,Tt=lt,It=xe,Rt=mt,At=Object.getOwnPropertyDescriptor;o.f=Et?At:function(e,t){if(e=bt(e),t=Tt(t),Rt)try{return At(e,t)}catch(e){}if(It(e,t))return yt(!gt(St.f,e,t),e[t])};var Ct={},Ot=s&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Nt=i,wt=G,Dt=Nt.String,kt=Nt.TypeError,Pt=function(e){if(wt(e))return e;throw kt(Dt(e)+" is not an object")},Mt=s,Ut=mt,Lt=Ot,xt=Pt,Vt=lt,Bt=i.TypeError,jt=Object.defineProperty,Ft=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 n=Ft(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:Ht in r?r.configurable:n.configurable,enumerable:Gt in r?r.enumerable:n.enumerable,writable:!1})}return jt(e,t,r)}:jt:function(e,t,r){if(xt(e),t=Vt(t),xt(r),Ut)try{return jt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Bt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Kt=Ct,Yt=E,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:{}},qt=j,Jt=we,Zt=I(Function.toString);qt(Jt.inspectSource)||(Jt.inspectSource=function(e){return Zt(e)});var $t,Qt,er,tr=Jt.inspectSource,rr=j,nr=tr,ir=i.WeakMap,or=rr(ir)&&/native code/.test(nr(ir)),ar=Ie.exports,sr=Ge,cr=ar("keys"),ur=function(e){return cr[e]||(cr[e]=sr(e))},dr={},lr=or,hr=i,pr=I,fr=G,_r=Xt,vr=xe,mr=we,Er=ur,gr=dr,Sr="Object already initialized",yr=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 yr(Sr);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=Er("state");gr[Cr]=!0,$t=function(e,t){if(vr(e,Cr))throw new yr(Sr);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 yr("Incompatible receiver, "+e+" required");return r}}},Nr=s,wr=xe,Dr=Function.prototype,kr=Nr&&Object.getOwnPropertyDescriptor,Pr=wr(Dr,"name"),Mr={EXISTS:Pr,PROPER:Pr&&"something"===function(){}.name,CONFIGURABLE:Pr&&(!Nr||Nr&&kr(Dr,"name").configurable)},Ur=i,Lr=j,xr=xe,Vr=Xt,Br=Ce,jr=tr,Fr=Mr.CONFIGURABLE,Gr=Or.get,Hr=Or.enforce,zr=String(String).split("String");(Wt.exports=function(e,t,r,n){var i,o=!!n&&!!n.unsafe,a=!!n&&!!n.enumerable,s=!!n&&!!n.noTargetGet,c=n&&void 0!==n.name?n.name:t;Lr(r)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!xr(r,"name")||Fr&&r.name!==c)&&Vr(r,"name",c),(i=Hr(r)).source||(i.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:Br(t,r)})(Function.prototype,"toString",(function(){return Lr(this)&&Gr(this).source||jr(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)},qr=Wr,Jr=Math.max,Zr=Math.min,$r=function(e,t){var r=qr(e);return r<0?Jr(r+t,0):Zr(r,t)},Qr=Wr,en=Math.min,tn=function(e){return e>0?en(Qr(e),9007199254740991):0},rn=tn,nn=function(e){return rn(e.length)},on=B,an=$r,sn=nn,cn=function(e){return function(t,r,n){var i,o=on(t),a=sn(o),s=an(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},un={includes:cn(!0),indexOf:cn(!1)},dn=xe,ln=B,hn=un.indexOf,pn=dr,fn=I([].push),_n=function(e,t){var r,n=ln(e),i=0,o=[];for(r in n)!dn(pn,r)&&dn(n,r)&&fn(o,r);for(;t.length>i;)dn(n,r=t[i++])&&(~hn(o,r)||fn(o,r));return o},vn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],mn=_n,En=vn.concat("length","prototype");Kr.f=Object.getOwnPropertyNames||function(e){return mn(e,En)};var gn={};gn.f=Object.getOwnPropertySymbols;var Sn=Y,yn=Kr,bn=gn,Tn=Pt,In=I([].concat),Rn=Sn("Reflect","ownKeys")||function(e){var t=yn.f(Tn(e)),r=bn.f;return r?In(t,r(e)):t},An=xe,Cn=Rn,On=o,Nn=Ct,wn=function(e,t,r){for(var n=Cn(t),i=Nn.f,o=On.f,a=0;a<n.length;a++){var s=n[a];An(e,s)||r&&An(r,s)||i(e,s,o(t,s))}},Dn=a,kn=j,Pn=/#|\.prototype\./,Mn=function(e,t){var r=Ln[Un(e)];return r==Vn||r!=xn&&(kn(t)?Dn(t):!!t)},Un=Mn.normalize=function(e){return String(e).replace(Pn,".").toLowerCase()},Ln=Mn.data={},xn=Mn.NATIVE="N",Vn=Mn.POLYFILL="P",Bn=Mn,jn=i,Fn=o.f,Gn=Xt,Hn=Wt.exports,zn=Ce,Kn=wn,Yn=Bn,Xn=function(e,t){var r,n,i,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?jn:u?jn[s]||zn(s,{}):(jn[s]||{}).prototype)for(n in t){if(o=t[n],i=e.noTargetGet?(a=Fn(r,n))&&a.value:r[n],!Yn(c?n:s+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Kn(o,i)}(e.sham||i&&i.sham)&&Gn(o,"sham",!0),Hn(r,n,o,e)}},Wn=i,qn=j,Jn=Wn.String,Zn=Wn.TypeError,$n=I,Qn=Pt,ei=function(e){if("object"==typeof e||qn(e))return e;throw Zn("Can't set "+Jn(e)+" as a prototype")},ti=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=$n(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return Qn(r),ei(n),t?e(r,n):r.__proto__=n,r}}():void 0);Xn({target:"Object",stat:!0},{setPrototypeOf:ti});var ri={},ni=_n,ii=vn,oi=Object.keys||function(e){return ni(e,ii)},ai=s,si=Ot,ci=Ct,ui=Pt,di=B,li=oi;ri.f=ai&&!si?Object.defineProperties:function(e,t){ui(e);for(var r,n=di(t),i=li(t),o=i.length,a=0;o>a;)ci.f(e,r=i[a++],n[r]);return e};var hi,pi=Y("document","documentElement"),fi=Pt,_i=ri,vi=vn,mi=dr,Ei=pi,gi=_t,Si=ur("IE_PROTO"),yi=function(){},bi=function(e){return"<script>"+e+"</"+"script>"},Ti=function(e){e.write(bi("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ii=function(){try{hi=new ActiveXObject("htmlfile")}catch(e){}var e,t;Ii="undefined"!=typeof document?document.domain&&hi?Ti(hi):((t=gi("iframe")).style.display="none",Ei.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(bi("document.F=Object")),e.close(),e.F):Ti(hi);for(var r=vi.length;r--;)delete Ii.prototype[vi[r]];return Ii()};mi[Si]=!0;var Ri=Object.create||function(e,t){var r;return null!==e?(yi.prototype=fi(e),r=new yi,yi.prototype=null,r[Si]=e):r=Ii(),void 0===t?r:_i.f(r,t)};Xn({target:"Object",stat:!0,sham:!s},{create:Ri});var Ai=s,Ci=I,Oi=l,Ni=a,wi=oi,Di=gn,ki=h,Pi=Me,Mi=M,Ui=Object.assign,Li=Object.defineProperty,xi=Ci([].concat),Vi=!Ui||Ni((function(){if(Ai&&1!==Ui({b:1},Ui(Li({},"a",{enumerable:!0,get:function(){Li(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=Ui({},e)[r]||wi(Ui({},t)).join("")!=n}))?function(e,t){for(var r=Pi(e),n=arguments.length,i=1,o=Di.f,a=ki.f;n>i;)for(var s,c=Mi(arguments[i++]),u=o?xi(wi(c),o(c)):wi(c),d=u.length,l=0;d>l;)s=u[l++],Ai&&!Oi(a,c,s)||(r[s]=c[s]);return r}:Ui,Bi=Vi;Xn({target:"Object",stat:!0,forced:Object.assign!==Bi},{assign:Bi});var ji=a,Fi=function(e,t){var r=[][e];return!!r&&ji((function(){r.call(null,t||function(){throw 1},1)}))},Gi=Xn,Hi=un.indexOf,zi=Fi,Ki=I([].indexOf),Yi=!!Ki&&1/Ki([1],1,-0)<0,Xi=zi("indexOf");Gi({target:"Array",proto:!0,forced:Yi||!Xi},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Yi?Ki(this,e,t)||0:Hi(this,e,t)}});var Wi=c,qi=Function.prototype,Ji=qi.apply,Zi=qi.call,$i="object"==typeof Reflect&&Reflect.apply||(Wi?Zi.bind(Ji):function(){return Zi.apply(Ji,arguments)}),Qi=O,eo=Array.isArray||function(e){return"Array"==Qi(e)},to={};to[Qe("toStringTag")]="z";var ro="[object z]"===String(to),no=i,io=ro,oo=j,ao=O,so=Qe("toStringTag"),co=no.Object,uo="Arguments"==ao(function(){return arguments}()),lo=io?ao:function(e){var t,r,n;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"==(n=ao(t))&&oo(t.callee)?"Arguments":n},ho=lo,po=i.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,Eo=E,go=function(e,t,r){var n=vo(t);n in e?mo.f(e,n,Eo(0,r)):e[n]=r},So=$r,yo=nn,bo=go,To=i.Array,Io=Math.max,Ro=function(e,t,r){for(var n=yo(e),i=So(t,n),o=So(void 0===r?n:r,n),a=To(Io(o-i,0)),s=0;i<o;i++,s++)bo(a,s,e[i]);return a.length=s,a},Ao=O,Co=B,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),ko={},Po=Qe;ko.f=Po;var Mo=i,Uo=xe,Lo=ko,xo=Ct.f,Vo=function(e){var t=Mo.Symbol||(Mo.Symbol={});Uo(t,e)||xo(t,e,{value:Lo.f(e)})},Bo=Ct.f,jo=xe,Fo=Qe("toStringTag"),Go=function(e,t,r){e&&!r&&(e=e.prototype),e&&!jo(e,Fo)&&Bo(e,Fo,{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,qo=j,Jo=lo,Zo=tr,$o=function(){},Qo=[],ea=Y("Reflect","construct"),ta=/^\s*(?:class|function)\b/,ra=Xo(ta.exec),na=!ta.exec($o),ia=function(e){if(!qo(e))return!1;try{return ea($o,Qo,e),!0}catch(e){return!1}},oa=function(e){if(!qo(e))return!1;switch(Jo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return na||!!ra(ta,Zo(e))}catch(e){return!0}};oa.sham=!0;var aa=!ea||Wo((function(){var e;return ia(ia.call)||!ia(Object)||!ia((function(){e=!0}))||e}))?oa:ia,sa=i,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,Ea=nn,ga=fa,Sa=I([].push),ya=function(e){var t=1==e,r=2==e,n=3==e,i=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=Ea(_),E=0,g=l||ga,S=t?g(c,m):r||a?g(c,0):void 0;m>E;E++)if((s||E in _)&&(p=v(h=_[E],E,f),e))if(t)S[E]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return E;case 2:Sa(S,h)}else switch(e){case 4:return!1;case 7:Sa(S,h)}return o?-1:n||i?i:S}},ba={forEach:ya(0),map:ya(1),filter:ya(2),some:ya(3),every:ya(4),find:ya(5),findIndex:ya(6),filterReject:ya(7)},Ta=Xn,Ia=i,Ra=Y,Aa=$i,Ca=l,Oa=I,Na=s,wa=ie,Da=a,ka=xe,Pa=eo,Ma=j,Ua=G,La=X,xa=le,Va=Pt,Ba=Me,ja=B,Fa=lt,Ga=fo,Ha=E,za=Ri,Ka=oi,Ya=Kr,Xa=_o,Wa=gn,qa=o,Ja=Ct,Za=ri,$a=h,Qa=Do,es=Wt.exports,ts=Ie.exports,rs=dr,ns=Ge,is=Qe,os=ko,as=Vo,ss=Go,cs=Or,us=ba.forEach,ds=ur("hidden"),ls="Symbol",hs=is("toPrimitive"),ps=cs.set,fs=cs.getterFor(ls),_s=Object.prototype,vs=Ia.Symbol,ms=vs&&vs.prototype,Es=Ia.TypeError,gs=Ia.QObject,Ss=Ra("JSON","stringify"),ys=qa.f,bs=Ja.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=!gs||!gs.prototype||!gs.prototype.findChild,ks=Na&&Da((function(){return 7!=za(bs({},"a",{get:function(){return bs(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=ys(_s,t);n&&delete _s[t],bs(e,t,r),n&&e!==_s&&bs(_s,t,n)}:bs,Ps=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 n=Fa(t);return Va(r),ka(As,n)?(r.enumerable?(ka(e,ds)&&e[ds][n]&&(e[ds][n]=!1),r=za(r,{enumerable:Ha(0,!1)})):(ka(e,ds)||bs(e,ds,Ha(1,{})),e[ds][n]=!0),ks(e,n,r)):bs(e,n,r)},Us=function(e,t){Va(e);var r=ja(t),n=Ka(r).concat(Bs(r));return us(n,(function(t){Na&&!Ca(Ls,r,t)||Ms(e,t,r[t])})),e},Ls=function(e){var t=Fa(e),r=Ca(Is,this,t);return!(this===_s&&ka(As,t)&&!ka(Cs,t))&&(!(r||!ka(this,t)||!ka(As,t)||ka(this,ds)&&this[ds][t])||r)},xs=function(e,t){var r=ja(e),n=Fa(t);if(r!==_s||!ka(As,n)||ka(Cs,n)){var i=ys(r,n);return!i||!ka(As,n)||ka(r,ds)&&r[ds][n]||(i.enumerable=!0),i}},Vs=function(e){var t=Ts(ja(e)),r=[];return us(t,(function(e){ka(As,e)||ka(rs,e)||Rs(r,e)})),r},Bs=function(e){var t=e===_s,r=Ts(t?Cs:ja(e)),n=[];return us(r,(function(e){!ka(As,e)||t&&!ka(_s,e)||Rs(n,As[e])})),n};(wa||(vs=function(){if(La(ms,this))throw Es("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Ga(arguments[0]):void 0,t=ns(e),r=function(e){this===_s&&Ca(r,Cs,e),ka(this,ds)&&ka(this[ds],t)&&(this[ds][t]=!1),ks(this,t,Ha(1,e))};return Na&&Ds&&ks(_s,t,{configurable:!0,set:r}),Ps(t,e)},es(ms=vs.prototype,"toString",(function(){return fs(this).tag})),es(vs,"withoutSetter",(function(e){return Ps(ns(e),e)})),$a.f=Ls,Ja.f=Ms,Za.f=Us,qa.f=xs,Ya.f=Xa.f=Vs,Wa.f=Bs,os.f=function(e){return Ps(is(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(ka(Os,t))return Os[t];var r=vs(t);return Os[t]=r,Ns[r]=t,r},keyFor:function(e){if(!xa(e))throw Es(e+" is not a symbol");if(ka(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:Bs}),Ta({target:"Object",stat:!0,forced:Da((function(){Wa.f(1)}))},{getOwnPropertySymbols:function(e){return Wa.f(Ba(e))}}),Ss)&&Ta({target:"JSON",stat:!0,forced:!wa||Da((function(){var e=vs();return"[null]"!=Ss([e])||"{}"!=Ss({a:e})||"{}"!=Ss(Object(e))}))},{stringify:function(e,t,r){var n=Qa(arguments),i=t;if((Ua(t)||void 0!==e)&&!xa(e))return Pa(t)||(t=function(e,t){if(Ma(i)&&(t=Ca(i,this,e,t)),!xa(t))return t}),n[1]=t,Aa(Ss,null,n)}});if(!ms[hs]){var js=ms.valueOf;es(ms,hs,(function(e){return Ca(js,this)}))}ss(vs,ls),rs[ds]=!0;var Fs=Xn,Gs=a,Hs=B,zs=o.f,Ks=s,Ys=Gs((function(){zs(1)}));Fs({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)+"]"},qs=ro,Js=Wt.exports,Zs=Ws;qs||Js(Object.prototype,"toString",Zs,{unsafe:!0});var $s=Xn,Qs=s,ec=Ct.f;$s({target:"Object",stat:!0,forced:Object.defineProperty!==ec,sham:!Qs},{defineProperty:ec});var tc=i.Promise,rc=Wt.exports,nc=function(e,t,r){for(var n in t)rc(e,n,t[n],r);return e},ic=Y,oc=Ct,ac=s,sc=Qe("species"),cc=function(e){var t=ic(e),r=oc.f;ac&&t&&!t[sc]&&r(t,sc,{configurable:!0,get:function(){return this}})},uc=X,dc=i.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,Ec=ge,gc=hc,Sc=Qe("iterator"),yc=function(e){if(null!=e)return Ec(e,Sc)||Ec(e,"@@iterator")||gc[mc(e)]},bc=l,Tc=me,Ic=Pt,Rc=pe,Ac=yc,Cc=i.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=Pt,Dc=ge,kc=function(e,t,r){var n,i;wc(e);try{if(!(n=Dc(e,"return"))){if("throw"===t)throw r;return r}n=Nc(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return wc(n),r},Pc=Yo,Mc=l,Uc=Pt,Lc=pe,xc=vc,Vc=nn,Bc=X,jc=Oc,Fc=yc,Gc=kc,Hc=i.TypeError,zc=function(e,t){this.stopped=e,this.result=t},Kc=zc.prototype,Yc=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),f=Pc(t,d),_=function(e){return n&&Gc(n,"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)n=e;else{if(!(i=Fc(e)))throw Hc(Lc(e)+" is not iterable");if(xc(i)){for(o=0,a=Vc(e);a>o;o++)if((s=v(e[o]))&&Bc(Kc,s))return s;return new zc(!1)}n=jc(e,i)}for(c=n.next;!(u=Mc(c,n)).done;){try{s=v(u.value)}catch(e){Gc(n,"throw",e)}if("object"==typeof s&&s&&Bc(Kc,s))return s}return new zc(!1)},Xc=Qe("iterator"),Wc=!1;try{var qc=0,Jc={next:function(){return{done:!!qc++}},return:function(){Wc=!0}};Jc[Xc]=function(){return this},Array.from(Jc,(function(){throw 2}))}catch(e){}var Zc,$c,Qc,eu,tu=function(e,t){if(!t&&!Wc)return!1;var r=!1;try{var n={};n[Xc]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},ru=aa,nu=pe,iu=i.TypeError,ou=function(e){if(ru(e))return e;throw iu(nu(e)+" is not a constructor")},au=Pt,su=ou,cu=Qe("species"),uu=function(e,t){var r,n=au(e).constructor;return void 0===n||null==(r=au(n)[cu])?t:su(r)},du=i.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(i.process),fu=i,_u=$i,vu=Yo,mu=j,Eu=xe,gu=a,Su=pi,yu=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,ku=fu.String,Pu=0,Mu={},Uu="onreadystatechange";try{Zc=fu.location}catch(e){}var Lu=function(e){if(Eu(Mu,e)){var t=Mu[e];delete Mu[e],t()}},xu=function(e){return function(){Lu(e)}},Vu=function(e){Lu(e.data)},Bu=function(e){fu.postMessage(ku(e),Zc.protocol+"//"+Zc.host)};Au&&Cu||(Au=function(e){Tu(arguments.length,1);var t=mu(e)?e:wu(e),r=yu(arguments,1);return Mu[++Pu]=function(){_u(t,void 0,r)},$c(Pu),Pu},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&&!gu(Bu)?($c=Bu,fu.addEventListener("message",Vu,!1)):$c=Uu in bu("script")?function(e){Su.appendChild(bu("script")).onreadystatechange=function(){Su.removeChild(this),Lu(e)}}:function(e){setTimeout(xu(e),0)});var ju,Fu,Gu,Hu,zu,Ku,Yu,Xu,Wu={set:Au,clear:Cu},qu=i,Ju=/ipad|iphone|ipod/i.test(W)&&void 0!==qu.Pebble,Zu=/web0s(?!.*chrome)/i.test(W),$u=i,Qu=Yo,ed=o.f,td=Wu.set,rd=hu,nd=Ju,id=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||(ju=function(){var e,t;for(od&&(e=cd.domain)&&e.exit();Fu;){t=Fu.fn,Fu=Fu.next;try{t()}catch(e){throw Fu?Hu():Gu=void 0,e}}Gu=void 0,e&&e.enter()},rd||od||id||!ad||!sd?!nd&&ud&&ud.resolve?((Yu=ud.resolve(void 0)).constructor=ud,Xu=Qu(Yu.then,Yu),Hu=function(){Xu(ju)}):od?Hu=function(){cd.nextTick(ju)}:(td=Qu(td,$u),Hu=function(){td(ju)}):(zu=!0,Ku=sd.createTextNode(""),new ad(ju).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),Fu||(Fu=t,Hu()),Gu=t},pd={},fd=me,_d=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=fd(t),this.reject=fd(r)};pd.f=function(e){return new _d(e)};var vd=Pt,md=G,Ed=pd,gd=function(e,t){if(vd(e),md(t)&&t.constructor===e)return t;var r=Ed.f(e);return(0,r.resolve)(t),r.promise},Sd=i,yd=function(){this.head=null,this.tail=null};yd.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=yd,Cd="object"==typeof window,Od=Xn,Nd=i,wd=Y,Dd=l,kd=tc,Pd=Wt.exports,Md=nc,Ud=ti,Ld=Go,xd=cc,Vd=me,Bd=j,jd=G,Fd=lc,Gd=tr,Hd=Yc,zd=tu,Kd=uu,Yd=Wu.set,Xd=hd,Wd=gd,qd=function(e,t){var r=Sd.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},Jd=pd,Zd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},$d=Ad,Qd=Or,el=Bn,tl=Cd,rl=pu,nl=te,il=Qe("species"),ol="Promise",al=Qd.getterFor(ol),sl=Qd.set,cl=Qd.getterFor(ol),ul=kd&&kd.prototype,dl=kd,ll=ul,hl=Nd.TypeError,pl=Nd.document,fl=Nd.process,_l=Jd.f,vl=_l,ml=!!(pl&&pl.createEvent&&Nd.dispatchEvent),El=Bd(Nd.PromiseRejectionEvent),gl="unhandledrejection",Sl=!1,yl=el(ol,(function(){var e=Gd(dl),t=e!==String(dl);if(!t&&66===nl)return!0;if(nl>=51&&/native code/.test(e))return!1;var r=new dl((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[il]=n,!(Sl=r.then((function(){}))instanceof n)||!t&&tl&&!El})),bl=yl||!zd((function(e){dl.all(e).catch((function(){}))})),Tl=function(e){var t;return!(!jd(e)||!Bd(t=e.then))&&t},Il=function(e,t){var r,n,i,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(),i=!0)),r===e.promise?u(hl("Promise-chain cycle")):(n=Tl(r))?Dd(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},Rl=function(e,t){e.notified||(e.notified=!0,Xd((function(){for(var r,n=e.reactions;r=n.get();)Il(r,e);e.notified=!1,t&&!e.rejection&&Cl(e)})))},Al=function(e,t,r){var n,i;ml?((n=pl.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),Nd.dispatchEvent(n)):n={promise:t,reason:r},!El&&(i=Nd["on"+e])?i(n):e===gl&&qd("Unhandled promise rejection",r)},Cl=function(e){Dd(Yd,Nd,(function(){var t,r=e.facade,n=e.value;if(Ol(e)&&(t=Zd((function(){rl?fl.emit("unhandledRejection",n,r):Al(gl,r,n)})),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(n){e(t,n,r)}},Dl=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Rl(e,!0))},kl=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 n=Tl(t);n?Xd((function(){var r={done:!1};try{Dd(n,t,wl(kl,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(yl&&(ll=(dl=function(e){Fd(this,ll),Vd(e),Dd(bd,this);var t=al(this);try{e(wl(kl,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),n=_l(Kd(this,dl));return r.parent=!0,n.ok=!Bd(e)||e,n.fail=Bd(t)&&t,n.domain=rl?fl.domain:void 0,0==r.state?r.reactions.add(n):Xd((function(){Il(n,r)})),n.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(kl,t),this.reject=wl(Dl,t)},Jd.f=_l=function(e){return e===dl||e===Id?new Td(e):vl(e)},Bd(kd)&&ul!==Object.prototype)){Rd=ul.then,Sl||(Pd(ul,"then",(function(e,t){var r=this;return new dl((function(e,t){Dd(Rd,r,e,t)})).then(e,t)}),{unsafe:!0}),Pd(ul,"catch",ll.catch,{unsafe:!0}));try{delete ul.constructor}catch(e){}Ud&&Ud(ul,ll)}Od({global:!0,wrap:!0,forced:yl},{Promise:dl}),Ld(dl,ol,!1),xd(ol),Id=wd(ol),Od({target:ol,stat:!0,forced:yl},{reject:function(e){var t=_l(this);return Dd(t.reject,void 0,e),t.promise}}),Od({target:ol,stat:!0,forced:yl},{resolve:function(e){return Wd(this,e)}}),Od({target:ol,stat:!0,forced:bl},{all:function(e){var t=this,r=_l(t),n=r.resolve,i=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||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise},race:function(e){var t=this,r=_l(t),n=r.reject,i=Zd((function(){var i=Vd(t.resolve);Hd(e,(function(e){Dd(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var Pl=Xn,Ml=s,Ul=i,Ll=I,xl=xe,Vl=j,Bl=X,jl=fo,Fl=Ct.f,Gl=wn,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:jl(arguments[0]),t=Bl(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),ql=Ll(zl.valueOf),Jl=/^Symbol\((.*)\)[^)]+$/,Zl=Ll("".replace),$l=Ll("".slice);Fl(zl,"description",{configurable:!0,get:function(){var e=ql(this),t=Wl(e);if(xl(Kl,e))return"";var r=Xl?$l(t,7,-1):Zl(t,Jl,"$1");return""===r?void 0:r}}),Pl({global:!0,forced:!0},{Symbol:Yl})}Vo("iterator");var Ql=Ri,eh=Ct,th=Qe("unscopables"),rh=Array.prototype;null==rh[th]&&eh.f(rh,th,{configurable:!0,value:Ql(null)});var nh,ih,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=i,uh=xe,dh=j,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,Eh=j,gh=vh,Sh=Wt.exports,yh=Qe("iterator"),bh=!1;[].keys&&("next"in(oh=[].keys())?(ih=gh(gh(oh)))!==Object.prototype&&(nh=ih):bh=!0);var Th=null==nh||mh((function(){var e={};return nh[yh].call(e)!==e}));Th&&(nh={}),Eh(nh[yh])||Sh(nh,yh,(function(){return this}));var Ih={IteratorPrototype:nh,BUGGY_SAFARI_ITERATORS:bh},Rh=Ih.IteratorPrototype,Ah=Ri,Ch=E,Oh=Go,Nh=hc,wh=function(){return this},Dh=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Ah(Rh,{next:Ch(+!n,r)}),Oh(e,i,!1),Nh[i]=wh,e},kh=Xn,Ph=l,Mh=Mr,Uh=j,Lh=Dh,xh=vh,Vh=ti,Bh=Go,jh=Xt,Fh=Wt.exports,Gh=hc,Hh=Mh.PROPER,zh=Mh.CONFIGURABLE,Kh=Ih.IteratorPrototype,Yh=Ih.BUGGY_SAFARI_ITERATORS,Xh=Qe("iterator"),Wh="keys",qh="values",Jh="entries",Zh=function(){return this},$h=function(e,t,r,n,i,o,a){Lh(r,t,n);var s,c,u,d=function(e){if(e===i&&_)return _;if(!Yh&&e in p)return p[e];switch(e){case Wh:case qh:case Jh: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"]||i&&p[i],_=!Yh&&f||d(i),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])||Fh(s,Xh,Zh)),Bh(s,l,!0)),Hh&&i==qh&&f&&f.name!==qh&&(zh?jh(p,"name",qh):(h=!0,_=function(){return Ph(f,this)})),i)if(c={values:d(qh),keys:o?_:d(Wh),entries:d(Jh)},a)for(u in c)(Yh||h||!(u in p))&&Fh(p,u,c[u]);else kh({target:t,proto:!0,forced:Yh||h},c);return p[Xh]!==_&&Fh(p,Xh,_,{name:i}),Gh[t]=_,c},Qh=B,ep=ah,tp=hc,rp=Or,np=Ct.f,ip=$h,op=s,ap="Array Iterator",sp=rp.set,cp=rp.getterFor(ap),up=ip(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,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),dp=tp.Arguments=tp.Array;if(ep("keys"),ep("values"),ep("entries"),op&&"values"!==dp.name)try{np(dp,"name",{value:"values"})}catch(e){}var lp=I,hp=Wr,pp=fo,fp=L,_p=lp("".charAt),vp=lp("".charCodeAt),mp=lp("".slice),Ep=function(e){return function(t,r){var n,i,o=pp(fp(t)),a=hp(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=vp(o,a))<55296||n>56319||a+1===s||(i=vp(o,a+1))<56320||i>57343?e?_p(o,a):n:e?mp(o,a,a+2):i-56320+(n-55296<<10)+65536}},gp={codeAt:Ep(!1),charAt:Ep(!0)},Sp=gp.charAt,yp=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:yp(e),index:0})}),(function(){var e,t=Ap(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=Sp(r,n),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=i,kp=Cp,Pp=wp,Mp=up,Up=Xt,Lp=Qe,xp=Lp("iterator"),Vp=Lp("toStringTag"),Bp=Mp.values,jp=function(e,t){if(e){if(e[xp]!==Bp)try{Up(e,xp,Bp)}catch(t){e[xp]=Bp}if(e[Vp]||Up(e,Vp,t),kp[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 Fp in kp)jp(Dp[Fp]&&Dp[Fp].prototype,Fp);jp(Pp,"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=Xn,Xp=i,Wp=a,qp=eo,Jp=G,Zp=Me,$p=nn,Qp=go,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(!Jp(e))return!1;var t=e[nf];return void 0!==t?!!t:qp(e)};Yp({target:"Array",proto:!0,forced:!cf||!uf},{concat:function(e){var t,r,n,i,o,a=Zp(this),s=ef(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(df(o=-1===t?a:arguments[t])){if(c+(i=$p(o))>of)throw sf(af);for(r=0;r<i;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=Xn,hf=i,pf=eo,ff=aa,_f=G,vf=$r,mf=nn,Ef=B,gf=go,Sf=Qe,yf=Do,bf=Kp("slice"),Tf=Sf("species"),If=hf.Array,Rf=Math.max;lf({target:"Array",proto:!0,forced:!bf},{slice:function(e,t){var r,n,i,o=Ef(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 yf(o,s,c);for(n=new(void 0===r?If:r)(Rf(c-s,0)),i=0;s<c;s++,i++)s in o&&gf(n,i,o[s]);return n.length=i,n}}),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,kf,Pf,Mf,Uf,Lf,xf,Vf,Bf,jf,Ff,Gf,Hf,zf,Kf,Yf=function(){return Yf=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Yf.apply(this,arguments)};function Xf(e,r,n,i){var o,a=arguments.length,s=a<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,n):i;if("object"===("undefined"==typeof Reflect?"undefined":t(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,n,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(s=(a<3?o(s):a>3?o(r,n,s):o(r,n))||s);return a>3&&s&&Object.defineProperty(r,n,s),s}function Wf(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function qf(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[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,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function Jf(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Zf(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function $f(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||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"}(kf||(kf={})),function(e){e[e.MUTE_STATE_OFF=0]="MUTE_STATE_OFF",e[e.MUTE_STATE_ON=1]="MUTE_STATE_ON"}(Pf||(Pf={})),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"}(Bf||(Bf={})),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"}(jf||(jf={})),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"}(Ff||(Ff={})),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={}));var Qf,e_,t_,r_=Object.freeze({__proto__:null,get VideoSourceType(){return Of},get AudioSourceType(){return Nf},get UserOfflineReason(){return wf},get ChannelProfile(){return Df},get SubscribeMode(){return kf},get MuteState(){return Pf},get SubscribeState(){return Mf},get PublishState(){return Uf},get MirrorMode(){return Lf},get PauseResumeControlMediaType(){return xf},get VideoRenderMode(){return Vf},get StreamIndex(){return Bf},get SubscribeMediaType(){return jf},get StreamRemoveReason(){return Ff},get ConnectionState(){return Gf},get MirrorType(){return Hf},get LogChannel(){return zf},get USER_ONLINE_STATUS(){return Kf}});!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"}(Qf||(Qf={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(e_||(e_={})),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"}(t_||(t_={}));var n_,i_=Object.freeze({__proto__:null,get AudioMixingDualMonoMode(){return Qf},get AudioMixingType(){return e_},get AudioMixingState(){return t_}});!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.onMediaDeviceStateChanged="onMediaDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",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.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom"}(n_||(n_={}));var o_=ba.forEach,a_=Fi("forEach")?[].forEach:function(e){return o_(this,e,arguments.length>1?arguments[1]:void 0)};Xn({target:"Array",proto:!0,forced:[].forEach!=a_},{forEach:a_});var s_=i,c_=Cp,u_=wp,d_=a_,l_=Xt,h_=function(e){if(e&&e.forEach!==d_)try{l_(e,"forEach",d_)}catch(t){e.forEach=d_}};for(var p_ in c_)c_[p_]&&h_(s_[p_]&&s_[p_].prototype);h_(u_);var f_=Xn,__=I,v_=i.Date,m_=__(v_.prototype.getTime);f_({target:"Date",stat:!0},{now:function(){return m_(new v_)}});var E_=I,g_=Wt.exports,S_=Date.prototype,y_="Invalid Date",b_="toString",T_=E_(S_.toString),I_=E_(S_.getTime);String(new Date(NaN))!=y_&&g_(S_,b_,(function(){var e=I_(this);return e==e?T_(this):y_}));var R_=un.includes,A_=ah;Xn({target:"Array",proto:!0},{includes:function(e){return R_(this,e,arguments.length>1?arguments[1]:void 0)}}),A_("includes");var C_=G,O_=O,N_=Qe("match"),w_=function(e){var t;return C_(e)&&(void 0!==(t=e[N_])?!!t:"RegExp"==O_(e))},D_=w_,k_=i.TypeError,P_=function(e){if(D_(e))throw k_("The method doesn't accept regular expressions");return e},M_=Qe("match"),U_=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[M_]=!1,"/./"[e](t)}catch(e){}}return!1},L_=Xn,x_=P_,V_=L,B_=fo,j_=U_,F_=I("".indexOf);L_({target:"String",proto:!0,forced:!j_("includes")},{includes:function(e){return!!~F_(B_(V_(this)),B_(x_(e)),arguments.length>1?arguments[1]:void 0)}});var G_=Pt,H_=function(){var e=G_(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},z_=a,K_=i.RegExp,Y_=z_((function(){var e=K_("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),X_=Y_||z_((function(){return!K_("a","y").sticky})),W_={BROKEN_CARET:Y_||z_((function(){var e=K_("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:X_,UNSUPPORTED_Y:Y_},q_=a,J_=i.RegExp,Z_=q_((function(){var e=J_(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),$_=a,Q_=i.RegExp,ev=$_((function(){var e=Q_("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),tv=l,rv=I,nv=fo,iv=H_,ov=W_,av=Ie.exports,sv=Ri,cv=Or.get,uv=Z_,dv=ev,lv=av("native-string-replace",String.prototype.replace),hv=RegExp.prototype.exec,pv=hv,fv=rv("".charAt),_v=rv("".indexOf),vv=rv("".replace),mv=rv("".slice),Ev=function(){var e=/a/,t=/b*/g;return tv(hv,e,"a"),tv(hv,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),gv=ov.BROKEN_CARET,Sv=void 0!==/()??/.exec("")[1];(Ev||Sv||gv||uv||dv)&&(pv=function(e){var t,r,n,i,o,a,s,c=this,u=cv(c),d=nv(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=tv(pv,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=gv&&c.sticky,f=tv(iv,c),_=c.source,v=0,m=d;if(p&&(f=vv(f,"y",""),-1===_v(f,"g")&&(f+="g"),m=mv(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==fv(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",f)),Sv&&(r=new RegExp("^"+_+"$(?!\\s)",f)),Ev&&(n=c.lastIndex),i=tv(hv,p?r:c,m),p?i?(i.input=mv(i.input,v),i[0]=mv(i[0],v),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:Ev&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),Sv&&i&&i.length>1&&tv(lv,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=sv(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var yv=pv;Xn({target:"RegExp",proto:!0,forced:/./.exec!==yv},{exec:yv});var bv=I,Tv=Wt.exports,Iv=yv,Rv=a,Av=Qe,Cv=Xt,Ov=Av("species"),Nv=RegExp.prototype,wv=function(e,t,r,n){var i=Av(e),o=!Rv((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!Rv((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Ov]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=bv(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var a=bv(e),c=t.exec;return c===Iv||c===Nv.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));Tv(String.prototype,e,c[0]),Tv(Nv,i,c[1])}n&&Cv(Nv[i],"sham",!0)},Dv=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},kv=l,Pv=Pt,Mv=j,Uv=O,Lv=yv,xv=i.TypeError,Vv=function(e,t){var r=e.exec;if(Mv(r)){var n=kv(r,e,t);return null!==n&&Pv(n),n}if("RegExp"===Uv(e))return kv(Lv,e,t);throw xv("RegExp#exec called on incompatible receiver")},Bv=l,jv=Pt,Fv=L,Gv=Dv,Hv=fo,zv=ge,Kv=Vv;function Yv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}wv("search",(function(e,t,r){return[function(t){var r=Fv(this),n=null==t?void 0:zv(t,e);return n?Bv(n,t,r):new RegExp(t)[e](Hv(r))},function(e){var n=jv(this),i=Hv(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;Gv(a,0)||(n.lastIndex=0);var s=Kv(n,i);return Gv(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var Xv=gp.charAt,Wv=function(e,t,r){return t+(r?Xv(e,t).length:1)},qv=l,Jv=Pt,Zv=tn,$v=fo,Qv=L,em=ge,tm=Wv,rm=Vv;wv("match",(function(e,t,r){return[function(t){var r=Qv(this),n=null==t?void 0:em(t,e);return n?qv(n,t,r):new RegExp(t)[e]($v(r))},function(e){var n=Jv(this),i=$v(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return rm(n,i);var a=n.unicode;n.lastIndex=0;for(var s,c=[],u=0;null!==(s=rm(n,i));){var d=$v(s[0]);c[u]=d,""===d&&(n.lastIndex=tm(i,Zv(n.lastIndex),a)),u++}return 0===u?null:c}]}));var nm="\t\n\v\f\r \u2028\u2029\ufeff",im=L,om=fo,am=I("".replace),sm="[\t\n\v\f\r \u2028\u2029\ufeff]",cm=RegExp("^"+sm+sm+"*"),um=RegExp(sm+sm+"*$"),dm=function(e){return function(t){var r=om(im(t));return 1&e&&(r=am(r,cm,"")),2&e&&(r=am(r,um,"")),r}},lm={start:dm(1),end:dm(2),trim:dm(3)},hm=i,pm=a,fm=I,_m=fo,vm=lm.trim,mm=nm,Em=hm.parseInt,gm=hm.Symbol,Sm=gm&&gm.iterator,ym=/^[+-]?0x/i,bm=fm(ym.exec),Tm=8!==Em(mm+"08")||22!==Em(mm+"0x16")||Sm&&!pm((function(){Em(Object(Sm))}))?function(e,t){var r=vm(_m(e));return Em(r,t>>>0||(bm(ym,r)?16:10))}:Em;Xn({global:!0,forced:parseInt!=Tm},{parseInt:Tm});var Im={exports:{}},Rm=a((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Am=a,Cm=G,Om=O,Nm=Rm,wm=Object.isExtensible,Dm=Am((function(){wm(1)}))||Nm?function(e){return!!Cm(e)&&((!Nm||"ArrayBuffer"!=Om(e))&&(!wm||wm(e)))}:wm,km=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),Pm=Xn,Mm=I,Um=dr,Lm=G,xm=xe,Vm=Ct.f,Bm=Kr,jm=_o,Fm=Dm,Gm=km,Hm=!1,zm=Ge("meta"),Km=0,Ym=function(e){Vm(e,zm,{value:{objectID:"O"+Km++,weakData:{}}})},Xm=Im.exports={enable:function(){Xm.enable=function(){},Hm=!0;var e=Bm.f,t=Mm([].splice),r={};r[zm]=1,e(r).length&&(Bm.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===zm){t(n,i,1);break}return n},Pm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:jm.f}))},fastKey:function(e,t){if(!Lm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!xm(e,zm)){if(!Fm(e))return"F";if(!t)return"E";Ym(e)}return e[zm].objectID},getWeakData:function(e,t){if(!xm(e,zm)){if(!Fm(e))return!0;if(!t)return!1;Ym(e)}return e[zm].weakData},onFreeze:function(e){return Gm&&Hm&&Fm(e)&&!xm(e,zm)&&Ym(e),e}};Um[zm]=!0;var Wm=j,qm=G,Jm=ti,Zm=function(e,t,r){var n,i;return Jm&&Wm(n=t.constructor)&&n!==r&&qm(i=n.prototype)&&i!==r.prototype&&Jm(e,i),e},$m=Xn,Qm=i,eE=I,tE=Bn,rE=Wt.exports,nE=Im.exports,iE=Yc,oE=lc,aE=j,sE=G,cE=a,uE=tu,dE=Go,lE=Zm,hE=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=Qm[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=eE(s[e]);rE(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!sE(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!sE(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!sE(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(tE(e,!aE(a)||!(i||s.forEach&&!cE((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,n,o),nE.enable();else if(tE(e,!0)){var l=new c,h=l[o](i?{}:-0,1)!=l,p=cE((function(){l.has(1)})),f=uE((function(e){new a(e)})),_=!i&&cE((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));f||((c=t((function(e,t){oE(e,s);var r=lE(new a,e,c);return null!=t&&iE(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=c),(p||_)&&(d("delete"),d("has"),n&&d("get")),(_||h)&&d(o),i&&s.clear&&delete s.clear}return u[e]=c,$m({global:!0,forced:c!=a},u),dE(c,e),i||r.setStrong(c,e,n),c},pE=Ct.f,fE=Ri,_E=nc,vE=Yo,mE=lc,EE=Yc,gE=$h,SE=cc,yE=s,bE=Im.exports.fastKey,TE=Or.set,IE=Or.getterFor,RE={getConstructor:function(e,t,r,n){var i=e((function(e,i){mE(e,o),TE(e,{type:t,index:fE(null),first:void 0,last:void 0,size:0}),yE||(e.size=0),null!=i&&EE(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=IE(t),s=function(e,t,r){var n,i,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:i=bE(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),yE?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=bE(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return _E(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,yE?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),yE?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=vE(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),_E(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)}}),yE&&pE(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=IE(t),o=IE(n);gE(e,t,(function(e,t){TE(this,{type:n,target:e,state:i(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),SE(t)}};hE("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),RE);var AE=Me,CE=oi;Xn({target:"Object",stat:!0,forced:a((function(){CE(1)}))},{keys:function(e){return CE(AE(e))}});var OE=me,NE=Me,wE=M,DE=nn,kE=i.TypeError,PE=function(e){return function(t,r,n,i){OE(r);var o=NE(t),a=wE(o),s=DE(o),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw kE("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(i=r(i,a[c],c,o));return i}},ME={left:PE(!1),right:PE(!0)},UE=ME.left,LE=te,xE=pu;Xn({target:"Array",proto:!0,forced:!Fi("reduce")||!xE&&LE>79&&LE<83},{reduce:function(e){var t=arguments.length;return UE(this,e,t,t>1?arguments[1]:void 0)}});var VE,BE=Xn,jE=I,FE=o.f,GE=tn,HE=fo,zE=P_,KE=L,YE=U_,XE=jE("".endsWith),WE=jE("".slice),qE=Math.min,JE=YE("endsWith");BE({target:"String",proto:!0,forced:!!(JE||(VE=FE(String.prototype,"endsWith"),!VE||VE.writable))&&!JE},{endsWith:function(e){var t=HE(KE(this));zE(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:qE(GE(r),n),o=HE(e);return XE?XE(t,o,i):WE(t,i-o.length,i)===o}});var ZE=!0,$E=!0;function QE(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function eg(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.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 n=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,n])},Object.defineProperty(n,"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 tg(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(ZE=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function rg(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):($E=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function ng(){if("object"===("undefined"==typeof window?"undefined":t(window))){if(ZE)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function ig(e,t){$E&&console.warn(e+" is deprecated, please use "+t+" instead.")}function og(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=QE(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=QE(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=QE(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function ag(e){return"[object Object]"===Object.prototype.toString.call(e)}function sg(e){return ag(e)?Object.keys(e).reduce((function(t,r){var n=ag(e[r]),i=n?sg(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,Yv({},r,i))}),{}):e}function cg(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?cg(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){cg(e,e.get(t),r)}))})))}function ug(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;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===n&&r.trackId===t.id&&cg(e,r,i)}))})),i}var dg=Xn,lg=ba.find,hg=ah,pg="find",fg=!0;pg in[]&&Array(1).find((function(){fg=!1})),dg({target:"Array",proto:!0,forced:fg},{find:function(e){return lg(this,e,arguments.length>1?arguments[1]:void 0)}}),hg(pg);var _g=Xn,vg=i,mg=$r,Eg=Wr,gg=nn,Sg=Me,yg=fa,bg=go,Tg=Kp("splice"),Ig=vg.TypeError,Rg=Math.max,Ag=Math.min,Cg=9007199254740991,Og="Maximum allowed length exceeded";_g({target:"Array",proto:!0,forced:!Tg},{splice:function(e,t){var r,n,i,o,a,s,c=Sg(this),u=gg(c),d=mg(e,u),l=arguments.length;if(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=Ag(Rg(Eg(t),0),u-d)),u+r-n>Cg)throw Ig(Og);for(i=yg(c,n),o=0;o<n;o++)(a=d+o)in c&&bg(i,o,c[a]);if(i.length=n,r<n){for(o=d;o<u-n;o++)s=o+r,(a=o+n)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-n+r;o--)delete c[o-1]}else if(r>n)for(o=u-n;o>d;o--)s=o+r-1,(a=o+n-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-n+r,i}});var Ng=ba.map;Xn({target:"Array",proto:!0,forced:!Kp("map")},{map:function(e){return Ng(this,e,arguments.length>1?arguments[1]:void 0)}});var wg=ba.filter;Xn({target:"Array",proto:!0,forced:!Kp("filter")},{filter:function(e){return wg(this,e,arguments.length>1?arguments[1]:void 0)}});var Dg=I,kg=Me,Pg=Math.floor,Mg=Dg("".charAt),Ug=Dg("".replace),Lg=Dg("".slice),xg=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Vg=/\$([$&'`]|\d{1,2})/g,Bg=$i,jg=l,Fg=I,Gg=wv,Hg=a,zg=Pt,Kg=j,Yg=Wr,Xg=tn,Wg=fo,qg=L,Jg=Wv,Zg=ge,$g=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,c=Vg;return void 0!==i&&(i=kg(i),c=xg),Ug(o,c,(function(o,c){var u;switch(Mg(c,0)){case"$":return"$";case"&":return e;case"`":return Lg(t,0,r);case"'":return Lg(t,a);case"<":u=i[Lg(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=Pg(d/10);return 0===l?o:l<=s?void 0===n[l-1]?Mg(c,1):n[l-1]+Mg(c,1):o}u=n[d-1]}return void 0===u?"":u}))},Qg=Vv,eS=Qe("replace"),tS=Math.max,rS=Math.min,nS=Fg([].concat),iS=Fg([].push),oS=Fg("".indexOf),aS=Fg("".slice),sS="$0"==="a".replace(/./,"$0"),cS=!!/./[eS]&&""===/./[eS]("a","$0");Gg("replace",(function(e,t,r){var n=cS?"$":"$0";return[function(e,r){var n=qg(this),i=null==e?void 0:Zg(e,eS);return i?jg(i,e,n,r):jg(t,Wg(n),e,r)},function(e,i){var o=zg(this),a=Wg(e);if("string"==typeof i&&-1===oS(i,n)&&-1===oS(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var c=Kg(i);c||(i=Wg(i));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=Qg(o,a);if(null===h)break;if(iS(l,h),!u)break;""===Wg(h[0])&&(o.lastIndex=Jg(a,Xg(o.lastIndex),d))}for(var p,f="",_=0,v=0;v<l.length;v++){for(var m=Wg((h=l[v])[0]),E=tS(rS(Yg(h.index),a.length),0),g=[],S=1;S<h.length;S++)iS(g,void 0===(p=h[S])?p:String(p));var y=h.groups;if(c){var b=nS([m],g,E,a);void 0!==y&&iS(b,y);var T=Wg(Bg(i,void 0,b))}else T=$g(m,a,E,g,y,i);E>=_&&(f+=aS(a,_,E)+T,_=E+m.length)}return f+aS(a,_)}]}),!!Hg((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!sS||cS);var uS=s,dS=i,lS=I,hS=Bn,pS=Zm,fS=Xt,_S=Ct.f,vS=Kr.f,mS=X,ES=w_,gS=fo,SS=H_,yS=W_,bS=Wt.exports,TS=a,IS=xe,RS=Or.enforce,AS=cc,CS=Z_,OS=ev,NS=Qe("match"),wS=dS.RegExp,DS=wS.prototype,kS=dS.SyntaxError,PS=lS(SS),MS=lS(DS.exec),US=lS("".charAt),LS=lS("".replace),xS=lS("".indexOf),VS=lS("".slice),BS=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,jS=/a/g,FS=/a/g,GS=new wS(jS)!==jS,HS=yS.MISSED_STICKY,zS=yS.UNSUPPORTED_Y,KS=uS&&(!GS||HS||CS||OS||TS((function(){return FS[NS]=!1,wS(jS)!=jS||wS(FS)==FS||"/a/i"!=wS(jS,"i")})));if(hS("RegExp",KS)){for(var YS=function(e,t){var r,n,i,o,a,s,c=mS(DS,this),u=ES(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===YS)return e;if((u||mS(DS,e))&&(e=e.source,d&&(t="flags"in h?h.flags:PS(h))),e=void 0===e?"":gS(e),t=void 0===t?"":gS(t),h=e,CS&&"dotAll"in jS&&(n=!!t&&xS(t,"s")>-1)&&(t=LS(t,/s/g,"")),r=t,HS&&"sticky"in jS&&(i=!!t&&xS(t,"y")>-1)&&zS&&(t=LS(t,/y/g,"")),OS&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,c=!1,u=0,d="";n<=r;n++){if("\\"===(t=US(e,n)))t+=US(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:MS(BS,VS(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||IS(a,d))throw new kS("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=pS(wS(e,t),c?this:DS,YS),(n||i||l.length)&&(s=RS(a),n&&(s.dotAll=!0,s.raw=YS(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=US(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+US(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{fS(a,"source",""===h?"(?:)":h)}catch(e){}return a},XS=function(e){e in YS||_S(YS,e,{configurable:!0,get:function(){return wS[e]},set:function(t){wS[e]=t}})},WS=vS(wS),qS=0;WS.length>qS;)XS(WS[qS++]);DS.constructor=YS,YS.prototype=DS,bS(dS,"RegExp",YS)}AS("RegExp");var JS=I,ZS=Mr.PROPER,$S=Wt.exports,QS=Pt,ey=X,ty=fo,ry=a,ny=H_,iy="toString",oy=RegExp.prototype,ay=oy.toString,sy=JS(ny),cy=ry((function(){return"/a/b"!=ay.call({source:"a",flags:"b"})})),uy=ZS&&ay.name!=iy;(cy||uy)&&$S(RegExp.prototype,iy,(function(){var e=QS(this),t=ty(e.source),r=e.flags;return"/"+t+"/"+ty(void 0===r&&ey(oy,e)&&!("flags"in oy)?sy(e):r)}),{unsafe:!0});var dy=ba.some;Xn({target:"Array",proto:!0,forced:!Fi("some")},{some:function(e){return dy(this,e,arguments.length>1?arguments[1]:void 0)}});var ly=s,hy=Mr.EXISTS,py=I,fy=Ct.f,_y=Function.prototype,vy=py(_y.toString),my=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Ey=py(my.exec);ly&&!hy&&fy(_y,"name",{configurable:!0,get:function(){try{return Ey(my,vy(this))[1]}catch(e){return""}}});var gy=I,Sy=me,yy=G,by=xe,Ty=Do,Iy=c,Ry=i.Function,Ay=gy([].concat),Cy=gy([].join),Oy={},Ny=function(e,t,r){if(!by(Oy,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";Oy[t]=Ry("C,a","return new C("+Cy(n,",")+")")}return Oy[t](e,r)},wy=Iy?Ry.bind:function(e){var t=Sy(this),r=t.prototype,n=Ty(arguments,1),i=function(){var r=Ay(n,Ty(arguments));return this instanceof i?Ny(t,r.length,r):t.apply(e,r)};return yy(r)&&(i.prototype=r),i},Dy=wy;Xn({target:"Function",proto:!0,forced:Function.bind!==Dy},{bind:Dy});var ky=ng;function Py(e,r){var n=e&&e.navigator;if(n.mediaDevices){var i=function(e){if("object"!==t(e)||e.mandatory||e.optional)return e;var r={};return Object.keys(e).forEach((function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var i="object"===t(e[n])?e[n]:{ideal:e[n]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){r.optional=r.optional||[];var a={};"number"==typeof i.ideal?(a[o("min",n)]=i.ideal,r.optional.push(a),(a={})[o("max",n)]=i.ideal,r.optional.push(a)):(a[o("",n)]=i.ideal,r.optional.push(a))}void 0!==i.exact&&"number"!=typeof i.exact?(r.mandatory=r.mandatory||{},r.mandatory[o("",n)]=i.exact):["min","max"].forEach((function(e){void 0!==i[e]&&(r.mandatory=r.mandatory||{},r.mandatory[o(e,n)]=i[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=i(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)&&(!n.mediaDevices.getSupportedConstraints||!n.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 n.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=i(e.video),ky("chrome: "+JSON.stringify(e)),o(e)}));e.video=i(e.video)}return ky("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(n.getUserMedia=function(e,t,r){o(e,(function(e){n.webkitGetUserMedia(e,t,(function(e){r&&r(a(e))}))}))}.bind(n),n.mediaDevices.getUserMedia){var s=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.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 My(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Uy(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(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===n.track.id})):{track:n.track};var o=new Event("track");o.track=n.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[r.stream],t.dispatchEvent(o)})),r.stream.getTracks().forEach((function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===n.id})):{track:n};var o=new Event("track");o.track=n,o.receiver=i,o.transceiver={receiver:i},o.streams=[r.stream],t.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),r.apply(this,arguments)}}else eg(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Ly(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 n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,t){var i=n.apply(this,arguments);return i||(i=r(this,e),this._senders.push(i)),i};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.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 xy(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),n=r[0],i=r[1],o=r[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))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){i(s(a(e)))};return t.apply(this,[c,n])}return new Promise((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function Vy(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 n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return ug(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var i=e.RTCPeerConnection.prototype.getReceivers;i&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),eg(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 ug(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,n,i=arguments[0];return this.getSenders().forEach((function(e){e.track===i&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===i&&(r?n=!0:r=e),e.track===i})),n||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 By(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 n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};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 n=this.getSenders();r.apply(this,arguments);var i=this.getSenders().filter((function(e){return-1===n.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(i)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=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 n=t._shimmedLocalStreams[r].indexOf(e);-1!==n&&t._shimmedLocalStreams[r].splice(n,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function jy(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return By(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 n=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 i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.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 n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[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(){n.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],n=Yv({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},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]=n[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(n){r._streams[n].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[n])})),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 n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.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 n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function Fy(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],n=Yv({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}))}function Gy(e,t){eg(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 Hy=Object.freeze({__proto__:null,shimMediaStream:My,shimOnTrack:Uy,shimGetSendersWithDtmf:Ly,shimGetStats:xy,shimSenderReceiverGetStats:Vy,shimAddTrackRemoveTrackWithNative:By,shimAddTrackRemoveTrack:jy,shimPeerConnection:Fy,fixNegotiationNeeded:Gy,shimGetUserMedia:Py,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 n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),zy=i,Ky=a,Yy=fo,Xy=lm.trim,Wy=I("".charAt),qy=zy.parseFloat,Jy=zy.Symbol,Zy=Jy&&Jy.iterator,$y=1/qy("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||Zy&&!Ky((function(){qy(Object(Zy))}))?function(e){var t=Xy(Yy(e)),r=qy(t);return 0===r&&"-"==Wy(t,0)?-0:r}:qy;Xn({global:!0,forced:parseFloat!=$y},{parseFloat:$y});var Qy=Xn,eb=tc,tb=a,rb=Y,nb=j,ib=uu,ob=gd,ab=Wt.exports;if(Qy({target:"Promise",proto:!0,real:!0,forced:!!eb&&tb((function(){eb.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=ib(this,rb("Promise")),r=nb(e);return this.then(r?function(r){return ob(t,e()).then((function(){return r}))}:e,r?function(r){return ob(t,e()).then((function(){throw r}))}:e)}}),nb(eb)){var sb=rb("Promise").prototype.finally;eb.prototype.finally!==sb&&ab(eb.prototype,"finally",sb,{unsafe:!0})}function cb(e,r){var n=e&&e.navigator,i=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){ig("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(r.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},a=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.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)},i&&i.prototype.getSettings){var s=i.prototype.getSettings;i.prototype.getSettings=function(){var e=s.apply(this,arguments);return o(e,"mozAutoGainControl","autoGainControl"),o(e,"mozNoiseSuppression","noiseSuppression"),e}}if(i&&i.prototype.applyConstraints){var c=i.prototype.applyConstraints;i.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 ub(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 db(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],n=Yv({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}));var n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=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 i.apply(this,[t||null]).then((function(e){if(r.version<53&&!o)try{e.forEach((function(e){e.type=n[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,r){e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))}))}return e})).then(o,a)}}}function lb(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 n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.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 hb(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}),eg(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function pb(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;ig("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function fb(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function _b(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 n=r.apply(this,arguments);if(t){var i=n.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,i.sendEncodings=e.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function vb(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 mb(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 Eb(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 gb=Object.freeze({__proto__:null,shimOnTrack:ub,shimPeerConnection:db,shimSenderGetStats:lb,shimReceiverGetStats:hb,shimRemoveStream:pb,shimRTCDataChannel:fb,shimAddTransceiver:_b,shimGetParameters:vb,shimCreateOffer:mb,shimCreateAnswer:Eb,shimGetUserMedia:cb,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 n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function Sb(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(n){return r.call(t,n,e)})),e.getVideoTracks().forEach((function(n){return r.call(t,n,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var t=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return i&&i.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 n=e.getTracks();this.getSenders().forEach((function(e){n.includes(e.track)&&t.removeTrack(e)}))}})}}function yb(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 bb(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,n=r.createOffer,i=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],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},r.createAnswer=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};var c=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};r.setLocalDescription=c,c=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},r.setRemoteDescription=c,c=function(e,t,r){var n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},r.addIceCandidate=c}}function Tb(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return n(Ib(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function Ib(e){return e&&void 0!==e.video?Object.assign({},e,{video:sg(e.video)}):e}function Rb(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(ig("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function Ab(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 Cb(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 n=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Ob(e){"object"!==t(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Nb=Object.freeze({__proto__:null,shimLocalStreamsAPI:Sb,shimRemoteStreamsAPI:yb,shimCallbacksAPI:bb,shimGetUserMedia:Tb,shimConstraints:Ib,shimRTCIceServerUrls:Rb,shimTrackEventTransceiver:Ab,shimCreateOfferLegacy:Cb,shimAudioContext:Ob}),wb=Me,Db=ct;Xn({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=wb(this),r=Db(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}});var kb=l;Xn({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return kb(URL.prototype.toString,this)}});var Pb=I(1..valueOf),Mb=s,Ub=i,Lb=I,xb=Bn,Vb=Wt.exports,Bb=xe,jb=Zm,Fb=X,Gb=le,Hb=ct,zb=a,Kb=Kr.f,Yb=o.f,Xb=Ct.f,Wb=Pb,qb=lm.trim,Jb="Number",Zb=Ub.Number,$b=Zb.prototype,Qb=Ub.TypeError,eT=Lb("".slice),tT=Lb("".charCodeAt),rT=function(e){var t=Hb(e,"number");return"bigint"==typeof t?t:nT(t)},nT=function(e){var t,r,n,i,o,a,s,c,u=Hb(e,"number");if(Gb(u))throw Qb("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=qb(u),43===(t=tT(u,0))||45===t){if(88===(r=tT(u,2))||120===r)return NaN}else if(48===t){switch(tT(u,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+u}for(a=(o=eT(u,2)).length,s=0;s<a;s++)if((c=tT(o,s))<48||c>i)return NaN;return parseInt(o,n)}return+u};if(xb(Jb,!Zb(" 0o1")||!Zb("0b1")||Zb("+0x1"))){for(var iT,oT=function(e){var t=arguments.length<1?0:Zb(rT(e)),r=this;return Fb($b,r)&&zb((function(){Wb(r)}))?jb(Object(t),r,oT):t},aT=Mb?Kb(Zb):"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(","),sT=0;aT.length>sT;sT++)Bb(Zb,iT=aT[sT])&&!Bb(oT,iT)&&Xb(oT,iT,Yb(Zb,iT));oT.prototype=$b,$b.constructor=oT,Vb(Ub,Jb,oT)}var cT=Xn,uT=M,dT=B,lT=Fi,hT=I([].join),pT=uT!=Object,fT=lT("join",",");cT({target:"Array",proto:!0,forced:pT||!fT},{join:function(e){return hT(dT(this),void 0===e?",":e)}});var _T=$i,vT=l,mT=I,ET=wv,gT=w_,ST=Pt,yT=L,bT=uu,TT=Wv,IT=tn,RT=fo,AT=ge,CT=Ro,OT=Vv,NT=yv,wT=a,DT=W_.UNSUPPORTED_Y,kT=4294967295,PT=Math.min,MT=[].push,UT=mT(/./.exec),LT=mT(MT),xT=mT("".slice),VT=!wT((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]}));ET("split",(function(e,t,r){var n;return n="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 n=RT(yT(this)),i=void 0===r?kT:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!gT(e))return vT(t,n,e,i);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=vT(NT,l,n))&&!((a=l.lastIndex)>d&&(LT(c,xT(n,d,o.index)),o.length>1&&o.index<n.length&&_T(MT,c,CT(o,1)),s=o[0].length,d=a,c.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&UT(l,"")||LT(c,""):LT(c,xT(n,d)),c.length>i?CT(c,0,i):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:vT(t,this,e,r)}:t,[function(t,r){var i=yT(this),o=null==t?void 0:AT(t,e);return o?vT(o,t,i,r):vT(n,RT(i),t,r)},function(e,i){var o=ST(this),a=RT(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var c=bT(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(DT?"g":"y"),l=new c(DT?"^(?:"+o.source+")":o,d),h=void 0===i?kT:i>>>0;if(0===h)return[];if(0===a.length)return null===OT(l,a)?[a]:[];for(var p=0,f=0,_=[];f<a.length;){l.lastIndex=DT?0:f;var v,m=OT(l,DT?xT(a,f):a);if(null===m||(v=PT(IT(l.lastIndex+(DT?f:0)),a.length))===p)f=TT(a,f,u);else{if(LT(_,xT(a,p,f)),_.length===h)return _;for(var E=1;E<=m.length-1;E++)if(LT(_,m[E]),_.length===h)return _;f=p=v}}return LT(_,xT(a,p)),_}]}),!VT,DT);var BT=Mr.PROPER,jT=a,FT=nm,GT=lm.trim;Xn({target:"String",proto:!0,forced:function(e){return jT((function(){return!!FT[e]()||"
"!=="
"[e]()||BT&&FT[e].name!==e}))}("trim")},{trim:function(){return GT(this)}});var HT={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]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+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 n=e.type;return t.push("typ"),t.push(n),"host"!==n&&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={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].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 n=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.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)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+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 n=r.matchPrefix(e+t,"a=ice-ufrag:")[0],i=r.matchPrefix(e+t,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.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:[]},n=r.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],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 n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=t.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){n+=r.writeRtpMap(e),n+=r.writeFmtp(e),n+=r.writeRtcpFb(e)}));var i=0;return t.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){n+=r.writeExtmap(e)})),n},r.parseRtpEncodingParameters=function(e){var t,n=[],i=r.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.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]),i.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}),n.push(r),o&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(r))}})),0===n.length&&c&&n.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,n.forEach((function(e){e.maxBitrate=d}))),n},r.parseRtcpParameters=function(e){var t={},n=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);var i=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=i.length>0,t.compound=0===i.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,n=r.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(t=n[0].substr(7).split(" "))[0],track:t[1]};var i=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(t=i[0].value.split(" "))[0],track:t[1]}:void 0},r.parseSctpDescription=function(e){var t,n=r.parseMLine(e),i=r.matchPrefix(e,"a=max-message-size:");i.length>0&&(t=parseInt(i[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:n.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,n){var i=void 0!==t?t:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||r.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.getDirection=function(e,t){for(var n=r.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].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),n=0;n<t.length;n++)if(t[n].length<2||"="!==t[n].charAt(1))return!1;return!0},e.exports=r}(HT);var zT=HT.exports,KT=Object.freeze(e({__proto__:null,default:zT},[HT.exports]));function YT(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 n=new r(e),i=zT.parseCandidate(e.candidate),o=Object.assign(n,i);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,eg(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function XT(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=zT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=zT.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=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},i=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 n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=zT.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},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=n(arguments[0]),d=i(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 WT(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},eg(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function qT(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 JT(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 n=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:n}):t.sdp=n}return r.apply(this,arguments)}}}function ZT(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 $T(e,r){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var n=e.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,r=arguments[0]||{};if("object"!==t(r)||r.type&&r.sdp)return n.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 n.apply(this,[r]);var i="offer"===r.type?this.createOffer:this.createAnswer;return i.apply(this).then((function(t){return n.apply(e,[t])}))})}}var QT=Object.freeze({__proto__:null,shimRTCIceCandidate:YT,shimMaxMessageSize:XT,shimSendThrowTypeError:WT,shimConnectionState:qT,removeExtmapAllowMixed:JT,shimAddIceCandidateNullOrEmpty:ZT,shimParameterlessSetLocalDescription:$T});!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},n=ng,i=og(t),o={browserDetails:i,commonShim:QT,extractVersion:QE,disableLog:tg,disableWarnings:rg,sdp:KT};switch(i.browser){case"chrome":if(!Hy||!Fy||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),o;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),o;n("adapter.js shimming chrome."),o.browserShim=Hy,ZT(t,i),$T(t),Py(t,i),My(t),Fy(t,i),Uy(t),jy(t,i),Ly(t),xy(t),Vy(t),Gy(t,i),YT(t),qT(t),XT(t,i),WT(t),JT(t,i);break;case"firefox":if(!gb||!db||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=gb,ZT(t,i),$T(t),cb(t,i),db(t,i),ub(t),pb(t),lb(t),hb(t),fb(t),_b(t),vb(t),mb(t),Eb(t),YT(t),qT(t),XT(t,i),WT(t);break;case"safari":if(!Nb||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=Nb,ZT(t,i),$T(t),Rb(t),Cb(t),bb(t),Sb(t),yb(t),Ab(t),Tb(t),Ob(t),YT(t),XT(t,i),WT(t),JT(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),Xn({target:"Array",stat:!0},{isArray:eo});var eI=Ro,tI=Math.floor,rI=function(e,t){var r=e.length,n=tI(r/2);return r<8?nI(e,t):iI(e,rI(eI(e,0,n),t),rI(eI(e,n),t),t)},nI=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},iI=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},oI=rI,aI=W.match(/firefox\/(\d+)/i),sI=!!aI&&+aI[1],cI=/MSIE|Trident/.test(W),uI=W.match(/AppleWebKit\/(\d+)\./),dI=!!uI&&+uI[1],lI=Xn,hI=I,pI=me,fI=Me,_I=nn,vI=fo,mI=a,EI=oI,gI=Fi,SI=sI,yI=cI,bI=te,TI=dI,II=[],RI=hI(II.sort),AI=hI(II.push),CI=mI((function(){II.sort(void 0)})),OI=mI((function(){II.sort(null)})),NI=gI("sort"),wI=!mI((function(){if(bI)return bI<70;if(!(SI&&SI>3)){if(yI)return!0;if(TI)return TI<603;var e,t,r,n,i="";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(n=0;n<47;n++)II.push({k:t+n,v:r})}for(II.sort((function(e,t){return t.v-e.v})),n=0;n<II.length;n++)t=II[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));lI({target:"Array",proto:!0,forced:CI||!OI||!NI||!wI},{sort:function(e){void 0!==e&&pI(e);var t=fI(this);if(wI)return void 0===e?RI(t):RI(t,e);var r,n,i=[],o=_I(t);for(n=0;n<o;n++)n in t&&AI(i,t[n]);for(EI(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:vI(t)>vI(r)?1:-1}}(e)),r=i.length,n=0;n<r;)t[n]=i[n++];for(;n<o;)delete t[n++];return t}});var DI="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,kI=Wr,PI=tn,MI=i.RangeError,UI=function(e){if(void 0===e)return 0;var t=kI(e),r=PI(t);if(t!==r)throw MI("Wrong length or index");return r},LI=i.Array,xI=Math.abs,VI=Math.pow,BI=Math.floor,jI=Math.log,FI=Math.LN2,GI={pack:function(e,t,r){var n,i,o,a=LI(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?VI(2,-24)-VI(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=xI(e))!=e||e===1/0?(i=e!=e?1:0,n=c):(n=BI(jI(e)/FI),e*(o=VI(2,-n))<1&&(n--,o*=2),(e+=n+u>=1?d/o:d*VI(2,1-u))*o>=2&&(n++,o/=2),n+u>=c?(i=0,n=c):n+u>=1?(i=(e*o-1)*VI(2,t),n+=u):(i=e*VI(2,u-1)*VI(2,t),n=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[h++]=255&n,n/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,n=e.length,i=8*n-t-1,o=(1<<i)-1,a=o>>1,s=i-7,c=n-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+=VI(2,t),d-=a}return(u?-1:1)*r*VI(2,d-t)}},HI=Me,zI=$r,KI=nn,YI=function(e){for(var t=HI(this),r=KI(t),n=arguments.length,i=zI(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:zI(o,r);a>i;)t[i++]=e;return t},XI=i,WI=I,qI=s,JI=DI,ZI=Mr,$I=Xt,QI=nc,eR=a,tR=lc,rR=Wr,nR=tn,iR=UI,oR=GI,aR=vh,sR=ti,cR=Kr.f,uR=Ct.f,dR=YI,lR=Ro,hR=Go,pR=ZI.PROPER,fR=ZI.CONFIGURABLE,_R=Or.get,vR=Or.set,mR="ArrayBuffer",ER="DataView",gR="Wrong index",SR=XI.ArrayBuffer,yR=SR,bR=yR&&yR.prototype,TR=XI.DataView,IR=TR&&TR.prototype,RR=Object.prototype,AR=XI.Array,CR=XI.RangeError,OR=WI(dR),NR=WI([].reverse),wR=oR.pack,DR=oR.unpack,kR=function(e){return[255&e]},PR=function(e){return[255&e,e>>8&255]},MR=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},UR=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},LR=function(e){return wR(e,23,4)},xR=function(e){return wR(e,52,8)},VR=function(e,t){uR(e.prototype,t,{get:function(){return _R(this)[t]}})},BR=function(e,t,r,n){var i=iR(r),o=_R(e);if(i+t>o.byteLength)throw CR(gR);var a=_R(o.buffer).bytes,s=i+o.byteOffset,c=lR(a,s,s+t);return n?c:NR(c)},jR=function(e,t,r,n,i,o){var a=iR(r),s=_R(e);if(a+t>s.byteLength)throw CR(gR);for(var c=_R(s.buffer).bytes,u=a+s.byteOffset,d=n(+i),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(JI){var FR=pR&&SR.name!==mR;if(eR((function(){SR(1)}))&&eR((function(){new SR(-1)}))&&!eR((function(){return new SR,new SR(1.5),new SR(NaN),FR&&!fR})))FR&&fR&&$I(SR,"name",mR);else{(yR=function(e){return tR(this,bR),new SR(iR(e))}).prototype=bR;for(var GR,HR=cR(SR),zR=0;HR.length>zR;)(GR=HR[zR++])in yR||$I(yR,GR,SR[GR]);bR.constructor=yR}sR&&aR(IR)!==RR&&sR(IR,RR);var KR=new TR(new yR(2)),YR=WI(IR.setInt8);KR.setInt8(0,2147483648),KR.setInt8(1,2147483649),!KR.getInt8(0)&&KR.getInt8(1)||QI(IR,{setInt8:function(e,t){YR(this,e,t<<24>>24)},setUint8:function(e,t){YR(this,e,t<<24>>24)}},{unsafe:!0})}else bR=(yR=function(e){tR(this,bR);var t=iR(e);vR(this,{bytes:OR(AR(t),0),byteLength:t}),qI||(this.byteLength=t)}).prototype,IR=(TR=function(e,t,r){tR(this,IR),tR(e,bR);var n=_R(e).byteLength,i=rR(t);if(i<0||i>n)throw CR("Wrong offset");if(i+(r=void 0===r?n-i:nR(r))>n)throw CR("Wrong length");vR(this,{buffer:e,byteLength:r,byteOffset:i}),qI||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,qI&&(VR(yR,"byteLength"),VR(TR,"buffer"),VR(TR,"byteLength"),VR(TR,"byteOffset")),QI(IR,{getInt8:function(e){return BR(this,1,e)[0]<<24>>24},getUint8:function(e){return BR(this,1,e)[0]},getInt16:function(e){var t=BR(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=BR(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return UR(BR(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return UR(BR(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return DR(BR(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return DR(BR(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){jR(this,1,e,kR,t)},setUint8:function(e,t){jR(this,1,e,kR,t)},setInt16:function(e,t){jR(this,2,e,PR,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){jR(this,2,e,PR,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){jR(this,4,e,MR,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){jR(this,4,e,MR,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){jR(this,4,e,LR,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){jR(this,8,e,xR,t,arguments.length>2?arguments[2]:void 0)}});hR(yR,mR),hR(TR,ER);var XR={ArrayBuffer:yR,DataView:TR},WR=Xn,qR=I,JR=a,ZR=Pt,$R=$r,QR=tn,eA=uu,tA=XR.ArrayBuffer,rA=XR.DataView,nA=rA.prototype,iA=qR(tA.prototype.slice),oA=qR(nA.getUint8),aA=qR(nA.setUint8);WR({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:JR((function(){return!new tA(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(iA&&void 0===t)return iA(ZR(this),e);for(var r=ZR(this).byteLength,n=$R(e,r),i=$R(void 0===t?r:t,r),o=new(eA(this,tA))(QR(i-n)),a=new rA(this),s=new rA(o),c=0;n<i;)aA(s,c++,oA(a,n++));return o}});var sA,cA,uA,dA={exports:{}},lA=DI,hA=s,pA=i,fA=j,_A=G,vA=xe,mA=lo,EA=pe,gA=Xt,SA=Wt.exports,yA=Ct.f,bA=X,TA=vh,IA=ti,RA=Qe,AA=Ge,CA=pA.Int8Array,OA=CA&&CA.prototype,NA=pA.Uint8ClampedArray,wA=NA&&NA.prototype,DA=CA&&TA(CA),kA=OA&&TA(OA),PA=Object.prototype,MA=pA.TypeError,UA=RA("toStringTag"),LA=AA("TYPED_ARRAY_TAG"),xA=AA("TYPED_ARRAY_CONSTRUCTOR"),VA=lA&&!!IA&&"Opera"!==mA(pA.opera),BA=!1,jA={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},FA={BigInt64Array:8,BigUint64Array:8},GA=function(e){if(!_A(e))return!1;var t=mA(e);return vA(jA,t)||vA(FA,t)};for(sA in jA)(uA=(cA=pA[sA])&&cA.prototype)?gA(uA,xA,cA):VA=!1;for(sA in FA)(uA=(cA=pA[sA])&&cA.prototype)&&gA(uA,xA,cA);if((!VA||!fA(DA)||DA===Function.prototype)&&(DA=function(){throw MA("Incorrect invocation")},VA))for(sA in jA)pA[sA]&&IA(pA[sA],DA);if((!VA||!kA||kA===PA)&&(kA=DA.prototype,VA))for(sA in jA)pA[sA]&&IA(pA[sA].prototype,kA);if(VA&&TA(wA)!==kA&&IA(wA,kA),hA&&!vA(kA,UA))for(sA in BA=!0,yA(kA,UA,{get:function(){return _A(this)?this[LA]:void 0}}),jA)pA[sA]&&gA(pA[sA],LA,sA);var HA={NATIVE_ARRAY_BUFFER_VIEWS:VA,TYPED_ARRAY_CONSTRUCTOR:xA,TYPED_ARRAY_TAG:BA&&LA,aTypedArray:function(e){if(GA(e))return e;throw MA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(fA(e)&&(!IA||bA(DA,e)))return e;throw MA(EA(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(hA){if(r)for(var i in jA){var o=pA[i];if(o&&vA(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}kA[e]&&!r||SA(kA,e,r?t:VA&&OA[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(hA){if(IA){if(r)for(n in jA)if((i=pA[n])&&vA(i,e))try{delete i[e]}catch(e){}if(DA[e]&&!r)return;try{return SA(DA,e,r?t:VA&&DA[e]||t)}catch(e){}}for(n in jA)!(i=pA[n])||i[e]&&!r||SA(i,e,t)}},isView:function(e){if(!_A(e))return!1;var t=mA(e);return"DataView"===t||vA(jA,t)||vA(FA,t)},isTypedArray:GA,TypedArray:DA,TypedArrayPrototype:kA},zA=i,KA=a,YA=tu,XA=HA.NATIVE_ARRAY_BUFFER_VIEWS,WA=zA.ArrayBuffer,qA=zA.Int8Array,JA=!XA||!KA((function(){qA(1)}))||!KA((function(){new qA(-1)}))||!YA((function(e){new qA,new qA(null),new qA(1.5),new qA(e)}),!0)||KA((function(){return 1!==new qA(new WA(2),1,void 0).length})),ZA=G,$A=Math.floor,QA=Number.isInteger||function(e){return!ZA(e)&&isFinite(e)&&$A(e)===e},eC=Wr,tC=i.RangeError,rC=function(e){var t=eC(e);if(t<0)throw tC("The argument can't be less than 0");return t},nC=i.RangeError,iC=function(e,t){var r=rC(e);if(r%t)throw nC("Wrong offset");return r},oC=Yo,aC=l,sC=ou,cC=Me,uC=nn,dC=Oc,lC=yc,hC=vc,pC=HA.aTypedArrayConstructor,fC=Xn,_C=i,vC=l,mC=s,EC=JA,gC=HA,SC=XR,yC=lc,bC=E,TC=Xt,IC=QA,RC=tn,AC=UI,CC=iC,OC=lt,NC=xe,wC=lo,DC=G,kC=le,PC=Ri,MC=X,UC=ti,LC=Kr.f,xC=function(e){var t,r,n,i,o,a,s=sC(this),c=cC(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=lC(c);if(h&&!hC(h))for(a=(o=dC(c,h)).next,c=[];!(i=aC(a,o)).done;)c.push(i.value);for(l&&u>2&&(d=oC(d,arguments[2])),r=uC(c),n=new(pC(s))(r),t=0;r>t;t++)n[t]=l?d(c[t],t):c[t];return n},VC=ba.forEach,BC=cc,jC=Ct,FC=o,GC=Zm,HC=Or.get,zC=Or.set,KC=jC.f,YC=FC.f,XC=Math.round,WC=_C.RangeError,qC=SC.ArrayBuffer,JC=qC.prototype,ZC=SC.DataView,$C=gC.NATIVE_ARRAY_BUFFER_VIEWS,QC=gC.TYPED_ARRAY_CONSTRUCTOR,eO=gC.TYPED_ARRAY_TAG,tO=gC.TypedArray,rO=gC.TypedArrayPrototype,nO=gC.aTypedArrayConstructor,iO=gC.isTypedArray,oO="BYTES_PER_ELEMENT",aO="Wrong length",sO=function(e,t){nO(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},cO=function(e,t){KC(e,t,{get:function(){return HC(this)[t]}})},uO=function(e){var t;return MC(JC,e)||"ArrayBuffer"==(t=wC(e))||"SharedArrayBuffer"==t},dO=function(e,t){return iO(e)&&!kC(t)&&t in e&&IC(+t)&&t>=0},lO=function(e,t){return t=OC(t),dO(e,t)?bC(2,e[t]):YC(e,t)},hO=function(e,t,r){return t=OC(t),!(dO(e,t)&&DC(r)&&NC(r,"value"))||NC(r,"get")||NC(r,"set")||r.configurable||NC(r,"writable")&&!r.writable||NC(r,"enumerable")&&!r.enumerable?KC(e,t,r):(e[t]=r.value,e)};mC?($C||(FC.f=lO,jC.f=hO,cO(rO,"buffer"),cO(rO,"byteOffset"),cO(rO,"byteLength"),cO(rO,"length")),fC({target:"Object",stat:!0,forced:!$C},{getOwnPropertyDescriptor:lO,defineProperty:hO}),dA.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=_C[i],c=s,u=c&&c.prototype,d={},l=function(e,t){KC(e,t,{get:function(){return function(e,t){var r=HC(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=HC(e);r&&(i=(i=XC(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};$C?EC&&(c=t((function(e,t,r,i){return yC(e,u),GC(DC(t)?uO(t)?void 0!==i?new s(t,CC(r,n),i):void 0!==r?new s(t,CC(r,n)):new s(t):iO(t)?sO(c,t):vC(xC,c,t):new s(AC(t)),e,c)})),UC&&UC(c,tO),VC(LC(s),(function(e){e in c||TC(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,i){yC(e,u);var o,a,s,d=0,h=0;if(DC(t)){if(!uO(t))return iO(t)?sO(c,t):vC(xC,c,t);o=t,h=CC(r,n);var p=t.byteLength;if(void 0===i){if(p%n)throw WC(aO);if((a=p-h)<0)throw WC(aO)}else if((a=RC(i)*n)+h>p)throw WC(aO);s=a/n}else s=AC(t),o=new qC(a=s*n);for(zC(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new ZC(o)});d<s;)l(e,d++)})),UC&&UC(c,tO),u=c.prototype=PC(rO)),u.constructor!==c&&TC(u,"constructor",c),TC(u,QC,c),eO&&TC(u,eO,i),d[i]=c,fC({global:!0,forced:c!=s,sham:!$C},d),oO in c||TC(c,oO,n),oO in u||TC(u,oO,n),BC(i)}):dA.exports=function(){},(0,dA.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var pO=Me,fO=$r,_O=nn,vO=Math.min,mO=[].copyWithin||function(e,t){var r=pO(this),n=_O(r),i=fO(e,n),o=fO(t,n),a=arguments.length>2?arguments[2]:void 0,s=vO((void 0===a?n:fO(a,n))-o,n-i),c=1;for(o<i&&i<o+s&&(c=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:delete r[i],i+=c,o+=c;return r},EO=HA,gO=I(mO),SO=EO.aTypedArray;(0,EO.exportTypedArrayMethod)("copyWithin",(function(e,t){return gO(SO(this),e,t,arguments.length>2?arguments[2]:void 0)}));var yO=ba.every,bO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("every",(function(e){return yO(bO(this),e,arguments.length>1?arguments[1]:void 0)}));var TO=l,IO=YI,RO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return TO(IO,RO(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var AO=nn,CO=uu,OO=HA.TYPED_ARRAY_CONSTRUCTOR,NO=HA.aTypedArrayConstructor,wO=function(e){return NO(CO(e,e[OO]))},DO=function(e,t){for(var r=0,n=AO(t),i=new e(n);n>r;)i[r]=t[r++];return i},kO=wO,PO=ba.filter,MO=function(e,t){return DO(kO(e),t)},UO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("filter",(function(e){var t=PO(UO(this),e,arguments.length>1?arguments[1]:void 0);return MO(this,t)}));var LO=ba.find,xO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("find",(function(e){return LO(xO(this),e,arguments.length>1?arguments[1]:void 0)}));var VO=ba.findIndex,BO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("findIndex",(function(e){return VO(BO(this),e,arguments.length>1?arguments[1]:void 0)}));var jO=ba.forEach,FO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("forEach",(function(e){jO(FO(this),e,arguments.length>1?arguments[1]:void 0)}));var GO=un.includes,HO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("includes",(function(e){return GO(HO(this),e,arguments.length>1?arguments[1]:void 0)}));var zO=un.indexOf,KO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("indexOf",(function(e){return zO(KO(this),e,arguments.length>1?arguments[1]:void 0)}));var YO=i,XO=a,WO=I,qO=HA,JO=up,ZO=Qe("iterator"),$O=YO.Uint8Array,QO=WO(JO.values),eN=WO(JO.keys),tN=WO(JO.entries),rN=qO.aTypedArray,nN=qO.exportTypedArrayMethod,iN=$O&&$O.prototype,oN=!XO((function(){iN[ZO].call([1])})),aN=!!iN&&iN.values&&iN[ZO]===iN.values&&"values"===iN.values.name,sN=function(){return QO(rN(this))};nN("entries",(function(){return tN(rN(this))}),oN),nN("keys",(function(){return eN(rN(this))}),oN),nN("values",sN,oN||!aN,{name:"values"}),nN(ZO,sN,oN||!aN,{name:"values"});var cN=HA.aTypedArray,uN=HA.exportTypedArrayMethod,dN=I([].join);uN("join",(function(e){return dN(cN(this),e)}));var lN=$i,hN=B,pN=Wr,fN=nn,_N=Fi,vN=Math.min,mN=[].lastIndexOf,EN=!!mN&&1/[1].lastIndexOf(1,-0)<0,gN=_N("lastIndexOf"),SN=EN||!gN?function(e){if(EN)return lN(mN,this,arguments)||0;var t=hN(this),r=fN(t),n=r-1;for(arguments.length>1&&(n=vN(n,pN(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:mN,yN=$i,bN=SN,TN=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return yN(bN,TN(this),t>1?[e,arguments[1]]:[e])}));var IN=ba.map,RN=wO,AN=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("map",(function(e){return IN(AN(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(RN(e))(t)}))}));var CN=ME.left,ON=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return CN(ON(this),e,t,t>1?arguments[1]:void 0)}));var NN=ME.right,wN=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return NN(wN(this),e,t,t>1?arguments[1]:void 0)}));var DN=HA.aTypedArray,kN=HA.exportTypedArrayMethod,PN=Math.floor;kN("reverse",(function(){for(var e,t=this,r=DN(t).length,n=PN(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var MN=i,UN=l,LN=HA,xN=nn,VN=iC,BN=Me,jN=a,FN=MN.RangeError,GN=MN.Int8Array,HN=GN&&GN.prototype,zN=HN&&HN.set,KN=LN.aTypedArray,YN=LN.exportTypedArrayMethod,XN=!jN((function(){var e=new Uint8ClampedArray(2);return UN(zN,e,{length:1,0:3},1),3!==e[1]})),WN=XN&&LN.NATIVE_ARRAY_BUFFER_VIEWS&&jN((function(){var e=new GN(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));YN("set",(function(e){KN(this);var t=VN(arguments.length>1?arguments[1]:void 0,1),r=BN(e);if(XN)return UN(zN,this,r,t);var n=this.length,i=xN(r),o=0;if(i+t>n)throw FN("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!XN||WN);var qN=wO,JN=Do,ZN=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=JN(ZN(this),e,t),n=qN(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),a((function(){new Int8Array(1).slice()})));var $N=ba.some,QN=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("some",(function(e){return $N(QN(this),e,arguments.length>1?arguments[1]:void 0)}));var ew=i,tw=I,rw=a,nw=me,iw=oI,ow=HA,aw=sI,sw=cI,cw=te,uw=dI,dw=ew.Array,lw=ow.aTypedArray,hw=ow.exportTypedArrayMethod,pw=ew.Uint16Array,fw=pw&&tw(pw.prototype.sort),_w=!(!fw||rw((function(){fw(new pw(2),null)}))&&rw((function(){fw(new pw(2),{})}))),vw=!!fw&&!rw((function(){if(cw)return cw<74;if(aw)return aw<67;if(sw)return!0;if(uw)return uw<602;var e,t,r=new pw(516),n=dw(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(fw(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));hw("sort",(function(e){return void 0!==e&&nw(e),vw?fw(this,e):iw(lw(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))}),!vw||_w);var mw=tn,Ew=$r,gw=wO,Sw=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("subarray",(function(e,t){var r=Sw(this),n=r.length,i=Ew(e,n);return new(gw(r))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,mw((void 0===t?n:Ew(t,n))-i))}));var yw=$i,bw=HA,Tw=a,Iw=Do,Rw=i.Int8Array,Aw=bw.aTypedArray,Cw=bw.exportTypedArrayMethod,Ow=[].toLocaleString,Nw=!!Rw&&Tw((function(){Ow.call(new Rw(1))}));Cw("toLocaleString",(function(){return yw(Ow,Nw?Iw(Aw(this)):Aw(this),Iw(arguments))}),Tw((function(){return[1,2].toLocaleString()!=new Rw([1,2]).toLocaleString()}))||!Tw((function(){Rw.prototype.toLocaleString.call([1,2])})));var ww=HA.exportTypedArrayMethod,Dw=a,kw=I,Pw=i.Uint8Array,Mw=Pw&&Pw.prototype||{},Uw=[].toString,Lw=kw([].join);Dw((function(){Uw.call({})}))&&(Uw=function(){return Lw(this)});var xw=Mw.toString!=Uw;ww("toString",Uw,xw);var Vw=Xn,Bw=i,jw=$i,Fw=j,Gw=Do,Hw=lu,zw=/MSIE .\./.test(W),Kw=Bw.Function,Yw=function(e){return function(t,r){var n=Hw(arguments.length,1)>2,i=Fw(t)?t:Kw(t),o=n?Gw(arguments,2):void 0;return e(n?function(){jw(i,this,o)}:i,r)}};Vw({global:!0,bind:!0,forced:zw},{setTimeout:Yw(Bw.setTimeout),setInterval:Yw(Bw.setInterval)});var Xw=Xn,Ww=ba.findIndex,qw=ah,Jw="findIndex",Zw=!0;Jw in[]&&Array(1).findIndex((function(){Zw=!1})),Xw({target:"Array",proto:!0,forced:Zw},{findIndex:function(e){return Ww(this,e,arguments.length>1?arguments[1]:void 0)}}),qw(Jw);var $w,Qw,eD=cc,tD="ArrayBuffer",rD=XR.ArrayBuffer;Xn({global:!0,forced:i.ArrayBuffer!==rD},{ArrayBuffer:rD}),eD(tD),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVALID_TOKEN="INVALID_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",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.UNEXPECTED_ERROR="UNEXPECTED_ERROR",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"}($w||($w={})),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"}(Qw||(Qw={}));var nD=function(e,t,r){this.code=e,this.message=t,this.error=r},iD=s,oD=I,aD=oi,sD=B,cD=oD(h.f),uD=oD([].push),dD=function(e){return function(t){for(var r,n=sD(t),i=aD(n),o=i.length,a=0,s=[];o>a;)r=i[a++],iD&&!cD(n,r)||uD(s,e?[r,n[r]]:n[r]);return s}},lD={entries:dD(!0),values:dD(!1)}.entries;Xn({target:"Object",stat:!0},{entries:function(e){return lD(e)}});var hD=Wr,pD=fo,fD=L,_D=i.RangeError,vD=I,mD=tn,ED=fo,gD=function(e){var t=pD(fD(this)),r="",n=hD(e);if(n<0||n==1/0)throw _D("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},SD=L,yD=vD(gD),bD=vD("".slice),TD=Math.ceil,ID=function(e){return function(t,r,n){var i,o,a=ED(SD(t)),s=mD(r),c=a.length,u=void 0===n?" ":ED(n);return s<=c||""==u?a:((o=yD(u,TD((i=s-c)/u.length))).length>i&&(o=bD(o,0,i)),e?a+o:o+a)}},RD={start:ID(!1),end:ID(!0)},AD=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(W),CD=RD.end;Xn({target:"String",proto:!0,forced:AD},{padEnd:function(e){return CD(this,e,arguments.length>1?arguments[1]:void 0)}});var OD=Tm;Xn({target:"Number",stat:!0,forced:Number.parseInt!=OD},{parseInt:OD});Xn({target:"ArrayBuffer",stat:!0,forced:!HA.NATIVE_ARRAY_BUFFER_VIEWS},{isView:HA.isView}),Xn({global:!0,forced:!DI},{DataView:XR.DataView});var ND=Pt,wD=kc,DD=Yo,kD=l,PD=Me,MD=function(e,t,r,n){try{return n?t(ND(r)[0],r[1]):t(r)}catch(t){wD(e,"throw",t)}},UD=vc,LD=aa,xD=nn,VD=go,BD=Oc,jD=yc,FD=i.Array,GD=function(e){var t=PD(e),r=LD(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=DD(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=jD(t),p=0;if(!h||this==FD&&UD(h))for(a=xD(t),s=r?new this(a):FD(a);a>p;p++)l=o?i(t[p],p):t[p],VD(s,p,l);else for(d=(u=BD(t,h)).next,s=r?new this:[];!(c=kD(d,u)).done;p++)l=o?MD(u,i,[c.value,p],!0):c.value,VD(s,p,l);return s.length=p,s},HD=GD;Xn({target:"Array",stat:!0,forced:!tu((function(e){Array.from(e)}))},{from:HD});var zD,KD=Xn,YD=eo,XD=I([].reverse),WD=[1,2];KD({target:"Array",proto:!0,forced:String(WD)===String(WD.reverse())},{reverse:function(){return YD(this)&&(this.length=this.length),XD(this)}});var qD=new Uint8Array(16);function JD(){if(!zD&&!(zD="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 zD(qD)}var ZD=/^(?:[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 $D(e){return"string"==typeof e&&ZD.test(e)}for(var QD=[],ek=0;ek<256;++ek)QD.push((ek+256).toString(16).substr(1));function tk(e,t,r){var n=(e=e||{}).random||(e.rng||JD)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(QD[e[t+0]]+QD[e[t+1]]+QD[e[t+2]]+QD[e[t+3]]+"-"+QD[e[t+4]]+QD[e[t+5]]+"-"+QD[e[t+6]]+QD[e[t+7]]+"-"+QD[e[t+8]]+QD[e[t+9]]+"-"+QD[e[t+10]]+QD[e[t+11]]+QD[e[t+12]]+QD[e[t+13]]+QD[e[t+14]]+QD[e[t+15]]).toLowerCase();if(!$D(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var rk=new TextDecoder,nk=new TextEncoder,ik=function(){return tk()},ok=function(){return Date.now()};function ak(e){for(var t,r,n,i,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=Jf(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=Jf(o),p=h.next();!p.done;p=h.next()){var f=p.value;d.set(f,l),l+=f.length}}catch(e){n={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return d}var sk=function(){return"undefined"==typeof window},ck=function(){function e(){}return e.token2auth=function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))},e.createUnsafeToken=function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))},e.merge=function(r,n){var i,o;void 0===r&&(r={}),void 0===n&&(n={});try{for(var a=Jf(Object.entries(r)),s=a.next();!s.done;s=a.next()){var c=Zf(s.value,2),u=c[0],d=c[1];null!==d&&"object"===t(d)?e.merge(r[u],n[u]):void 0!==n[u]&&(r[u]=n[u])}}catch(e){i={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}},e.ab2str=function(e){return rk.decode(e)},e.ab2obj=function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}},e.str2ab=function(e){return nk.encode(e).buffer},e.ab2b64str=function(e){return Wf(this,void 0,void 0,(function(){return qf(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 Wf(this,void 0,void 0,(function(){return qf(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function uk(){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 n=r===t.length-1?"0":"1";return Number.parseInt(n+e.join(""),2)}))}function dk(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function lk(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,n=r.byteLength,i=[];if(n>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 n-1-t})).reverse().map((function(e){return o.getUint8(e)}));i=$f($f($f([],Zf(a),!1),["..."],!1),Zf(s),!1)}else i=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(n,") [").concat(i.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 hk=function(){return Wf(void 0,void 0,void 0,(function(){var e,t;return qf(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]}}))}))},pk=function(e){return new Promise((function(t,r){var n=(e=Array.isArray(e)?e:[]).length,i=[];0===n?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){n--,i.push(e),0===n&&r(i)}))}))}))};function fk(e,t){if("boolean"!=typeof e)throw new nD($w.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function _k(e,t,r,n){if(void 0===r&&(r=1),void 0===n&&(n=Number.POSITIVE_INFINITY),e<r||e>n||"number"!=typeof e)throw new nD($w.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function vk(e,t,r,n){if(void 0===r&&(r=1),void 0===n&&(n=Number.POSITIVE_INFINITY),null==e)throw new nD($w.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,n))throw new nD($w.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function mk(e,t,r){if(!r.includes(e))throw new nD($w.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function Ek(e,t){if(yk(e))throw new nD($w.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function gk(e,t){if(!(e instanceof ArrayBuffer))throw new nD($w.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function Sk(e){var t,r;try{var n=navigator.mediaDevices.getSupportedConstraints();try{for(var i=Jf(Object.keys(e)),o=i.next();!o.done;o=i.next()){var a=o.value;n[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}catch(e){}}function yk(e){return null==e}function bk(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new nD($w.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function Tk(e){Ek(e,"videoPlayerOption")}function Ik(e,t){var r,n;if(void 0===t&&(t=64),!e||0===(null===(r=e)||void 0===r?void 0:r.byteLength))throw new nD($w.INVALID_PARAMS,"The message cannot be empty");if((null==(n=e instanceof ArrayBuffer?e:ck.str2ab(JSON.stringify(e)))?void 0:n.byteLength)>1e3*t)throw new nD($w.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function Rk(e){return![n_.onRemoteStreamStats,n_.onLocalStreamStats].includes(e)}var Ak={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,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 n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,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,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,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,n);break;case 4:d[u].fn.call(d[u].context,t,n,i);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,n,i){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||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&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 n,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}(Ak);var Ck="[VERTC]",Ok=["#0050b3","#0050b3","#0050b3","#0050b3"],Nk=!sk()&&window.location.search.includes("_rtc_debug_"),wk=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(Nk){for(var n="",i=0;i<this._indent;i++)n+=" ";console.log.apply(console,$f(["%c".concat(Ck).concat(n,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(Ok[this._indent],";")],Zf(t),!1))}},e}(),Dk=new wk("VERTC",0),kk=function(e){function t(){return e.call(this)||this}return Cf(t,e),t.prototype.safeEmit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=this.listenerCount(t);try{return e.prototype.emit.apply(this,$f([t],Zf(r),!1))}catch(e){return Dk.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(i)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Wf(this,void 0,void 0,(function(){var r=this;return qf(this,(function(n){return[2,new Promise((function(n,i){try{r.emit.apply(r,$f($f([e],Zf(t),!1),[n,i],!1))}catch(t){Dk.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),i(t)}}))]}))}))},t}(Ak.exports.EventEmitter),Pk=xe,Mk=function(e){return void 0!==e&&(Pk(e,"value")||Pk(e,"writable"))},Uk=l,Lk=G,xk=Pt,Vk=Mk,Bk=o,jk=vh;Xn({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return xk(t)===o?t[r]:(n=Bk.f(t,r))?Vk(n)?n.value:void 0===n.get?void 0:Uk(n.get,o):Lk(i=jk(t))?e(i,r,o):void 0}});var Fk=Xn,Gk=l,Hk=Pt,zk=G,Kk=Mk,Yk=Ct,Xk=o,Wk=vh,qk=E;var Jk=a((function(){var e=function(){},t=Yk.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));Fk({target:"Reflect",stat:!0,forced:Jk},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=Xk.f(Hk(t),r);if(!c){if(zk(o=Wk(t)))return e(o,r,n,s);c=qk(0)}if(Kk(c)){if(!1===c.writable||!zk(s))return!1;if(i=Xk.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,Yk.f(s,r,i)}else Yk.f(s,r,qk(0,n))}else{if(void 0===(a=c.set))return!1;Gk(a,s,n)}return!0}});var Zk="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function $k(e){return void 0===e&&(e=""),e.endsWith("com")||e.endsWith("net")||e.endsWith("org")?"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo"):e}var Qk="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",eP={VERSION:"4.40.0",ICE_CONFIG_REQUEST_URLS_INTERNAL:Zk.map($k),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:Qk};function tP(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(eP.ICE_CONFIG_REQUEST_URLS=t.map($k))):void("LOG_SERVER_URL"!==e||t!==zf.overseas?"LOG_SERVER_URL"!==e||t!==zf.domestic?eP[e]=t:eP.LOG_SERVER_URL=Qk:eP.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function rP(e){return eP[e]}function nP(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,E;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||iP.audio.codec,bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||iP.audio.kBitRate),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||iP.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||iP.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||iP.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||iP.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||iP.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||iP.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:iP.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||iP.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||iP.video.width,height:(null===(f=t.video)||void 0===f?void 0:f.height)||iP.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||iP.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===(E=t.layout)||void 0===E?void 0:E.appData)||iP.layout.appData}}}}var iP={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"}};(0,dA.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,dA.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var oP={};!function(e){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function n(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 i=r.shift();if(i){if("object"!==t(i))throw new TypeError(i+"must be non-object");for(var o in i)n(i,o)&&(e[o]=i[o])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},o={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+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,i)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,o))},e.setTyped(r)}(oP);var aP={},sP={},cP={},uP=oP;function dP(e){for(var t=e.length;--t>=0;)e[t]=0}var lP=256,hP=286,pP=30,fP=15,_P=[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],vP=[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],mP=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],EP=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],gP=new Array(576);dP(gP);var SP=new Array(60);dP(SP);var yP=new Array(512);dP(yP);var bP=new Array(256);dP(bP);var TP=new Array(29);dP(TP);var IP,RP,AP,CP=new Array(pP);function OP(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function NP(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function wP(e){return e<256?yP[e]:yP[256+(e>>>7)]}function DP(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function kP(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,DP(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 PP(e,t,r){kP(e,r[2*t],r[2*t+1])}function MP(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function UP(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=fP;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=MP(o[s]++,s))}}function LP(e){var t;for(t=0;t<hP;t++)e.dyn_ltree[2*t]=0;for(t=0;t<pP;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 xP(e){e.bi_valid>8?DP(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 VP(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function BP(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&VP(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!VP(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function jP(e,t,r){var n,i,o,a,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?PP(e,i,t):(PP(e,(o=bP[i])+lP+1,t),0!==(a=_P[o])&&kP(e,i-=TP[o],a),PP(e,o=wP(--n),r),0!==(a=vP[o])&&kP(e,n-=CP[o],a))}while(s<e.last_lit);PP(e,256,t)}function FP(e,t){var r,n,i,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*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)BP(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],BP(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,BP(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,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<=fP;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*(n=e.heap[r])+1]+1]+1)>f&&(o=f,_++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=p&&(a=h[n-p]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+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(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),UP(o,u,e.bl_count)}function GP(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))}function HP(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{PP(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(PP(e,i,e.bl_tree),s--),PP(e,16,e.bl_tree),kP(e,s-3,2)):s<=10?(PP(e,17,e.bl_tree),kP(e,s-3,3)):(PP(e,18,e.bl_tree),kP(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}dP(CP);var zP=!1;function KP(e,t,r,n){kP(e,0+(n?1:0),3),function(e,t,r,n){xP(e),n&&(DP(e,r),DP(e,~r)),uP.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}cP._tr_init=function(e){zP||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(TP[n]=r,e=0;e<1<<_P[n];e++)bP[r++]=n;for(bP[r-1]=n,i=0,n=0;n<16;n++)for(CP[n]=i,e=0;e<1<<vP[n];e++)yP[i++]=n;for(i>>=7;n<pP;n++)for(CP[n]=i<<7,e=0;e<1<<vP[n]-7;e++)yP[256+i++]=n;for(t=0;t<=fP;t++)o[t]=0;for(e=0;e<=143;)gP[2*e+1]=8,e++,o[8]++;for(;e<=255;)gP[2*e+1]=9,e++,o[9]++;for(;e<=279;)gP[2*e+1]=7,e++,o[7]++;for(;e<=287;)gP[2*e+1]=8,e++,o[8]++;for(UP(gP,287,o),e=0;e<pP;e++)SP[2*e+1]=5,SP[2*e]=MP(e,5);IP=new OP(gP,_P,257,hP,fP),RP=new OP(SP,vP,0,pP,fP),AP=new OP(new Array(0),mP,0,19,7)}(),zP=!0),e.l_desc=new NP(e.dyn_ltree,IP),e.d_desc=new NP(e.dyn_dtree,RP),e.bl_desc=new NP(e.bl_tree,AP),e.bi_buf=0,e.bi_valid=0,LP(e)},cP._tr_stored_block=KP,cP._tr_flush_block=function(e,t,r,n){var i,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<lP;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),FP(e,e.l_desc),FP(e,e.d_desc),a=function(e){var t;for(GP(e,e.dyn_ltree,e.l_desc.max_code),GP(e,e.dyn_dtree,e.d_desc.max_code),FP(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*EP[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?KP(e,t,r,n):4===e.strategy||o===i?(kP(e,2+(n?1:0),3),jP(e,gP,SP)):(kP(e,4+(n?1:0),3),function(e,t,r,n){var i;for(kP(e,t-257,5),kP(e,r-1,5),kP(e,n-4,4),i=0;i<n;i++)kP(e,e.bl_tree[2*EP[i]+1],3);HP(e,e.dyn_ltree,t-1),HP(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),jP(e,e.dyn_ltree,e.dyn_dtree)),LP(e),n&&xP(e)},cP._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*(bP[r]+lP+1)]++,e.dyn_dtree[2*wP(t)]++),e.last_lit===e.lit_bufsize-1},cP._tr_align=function(e){kP(e,2,3),PP(e,256,gP),function(e){16===e.bi_valid?(DP(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 YP=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};var XP=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var WP,qP=function(e,t,r,n){var i=XP,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},JP={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"},ZP=oP,$P=cP,QP=YP,eM=qP,tM=JP,rM=-2,nM=258,iM=262,oM=103,aM=113,sM=666;function cM(e,t){return e.msg=tM[t],t}function uM(e){return(e<<1)-(e>4?9:0)}function dM(e){for(var t=e.length;--t>=0;)e[t]=0}function lM(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(ZP.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 hM(e,t){$P._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,lM(e.strm)}function pM(e,t){e.pending_buf[e.pending++]=t}function fM(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function _M(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-iM?e.strstart-(e.w_size-iM):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+nM,p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(i>>=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(n=nM-(h-o),o=h-nM,n>a){if(e.match_start=t,a=n,n>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function vM(e){var t,r,n,i,o,a,s,c,u,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-iM)){ZP.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{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=i,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,ZP.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=QP(a.adler,s,d,c):2===a.state.wrap&&(a.adler=eM(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<iM&&0!==e.strm.avail_in)}function mM(e,t){for(var r,n;;){if(e.lookahead<iM){if(vM(e),e.lookahead<iM&&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-iM&&(e.match_length=_M(e,r)),e.match_length>=3)if(n=$P._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 n=$P._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(hM(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(hM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hM(e,!1),0===e.strm.avail_out)?1:2}function EM(e,t){for(var r,n,i;;){if(e.lookahead<iM){if(vM(e),e.lookahead<iM&&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-iM&&(e.match_length=_M(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){i=e.strstart+e.lookahead-3,n=$P._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<=i&&(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++,n&&(hM(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=$P._tr_tally(e,0,e.window[e.strstart-1]))&&hM(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&&(n=$P._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(hM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hM(e,!1),0===e.strm.avail_out)?1:2}function gM(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function SM(){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 ZP.Buf16(1146),this.dyn_dtree=new ZP.Buf16(122),this.bl_tree=new ZP.Buf16(78),dM(this.dyn_ltree),dM(this.dyn_dtree),dM(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new ZP.Buf16(16),this.heap=new ZP.Buf16(573),dM(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new ZP.Buf16(573),dM(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 yM(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:aM,e.adler=2===t.wrap?0:1,t.last_flush=0,$P._tr_init(t),0):cM(e,rM)}function bM(e){var t,r=yM(e);return 0===r&&((t=e.state).window_size=2*t.w_size,dM(t.head),t.max_lazy_match=WP[t.level].max_lazy,t.good_match=WP[t.level].good_length,t.nice_match=WP[t.level].nice_length,t.max_chain_length=WP[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 TM(e,t,r,n,i,o){if(!e)return rM;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||8!==r||n<8||n>15||t<0||t>9||o<0||o>4)return cM(e,rM);8===n&&(n=9);var s=new SM;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+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 ZP.Buf8(2*s.w_size),s.head=new ZP.Buf16(s.hash_size),s.prev=new ZP.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new ZP.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,bM(e)}WP=[new gM(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(vM(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,hM(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-iM&&(hM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(hM(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(hM(e,!1),e.strm.avail_out),1)})),new gM(4,4,8,4,mM),new gM(4,5,16,8,mM),new gM(4,6,32,32,mM),new gM(4,4,16,16,EM),new gM(8,16,32,32,EM),new gM(8,16,128,128,EM),new gM(8,32,128,256,EM),new gM(32,128,258,1024,EM),new gM(32,258,258,4096,EM)],sP.deflateInit=function(e,t){return TM(e,t,8,15,8,0)},sP.deflateInit2=TM,sP.deflateReset=bM,sP.deflateResetKeep=yM,sP.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?rM:(e.state.gzhead=t,0):rM},sP.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?cM(e,rM):rM;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===sM&&4!==t)return cM(e,0===e.avail_out?-5:rM);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,pM(n,31),pM(n,139),pM(n,8),n.gzhead?(pM(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),pM(n,255&n.gzhead.time),pM(n,n.gzhead.time>>8&255),pM(n,n.gzhead.time>>16&255),pM(n,n.gzhead.time>>24&255),pM(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),pM(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(pM(n,255&n.gzhead.extra.length),pM(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=eM(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(pM(n,0),pM(n,0),pM(n,0),pM(n,0),pM(n,0),pM(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),pM(n,3),n.status=aM);else{var a=8+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=aM,fM(n,a),0!==n.strstart&&(fM(n,e.adler>>>16),fM(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=eM(e.adler,n.pending_buf,n.pending-i,i)),lM(e),i=n.pending,n.pending!==n.pending_buf_size));)pM(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=eM(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=eM(e.adler,n.pending_buf,n.pending-i,i)),lM(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,pM(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=eM(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=eM(e.adler,n.pending_buf,n.pending-i,i)),lM(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,pM(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=eM(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=oM)}else n.status=oM;if(n.status===oM&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&lM(e),n.pending+2<=n.pending_buf_size&&(pM(n,255&e.adler),pM(n,e.adler>>8&255),e.adler=0,n.status=aM)):n.status=aM),0!==n.pending){if(lM(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&uM(t)<=uM(r)&&4!==t)return cM(e,-5);if(n.status===sM&&0!==e.avail_in)return cM(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==sM){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(vM(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=$P._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(hM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(hM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hM(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=nM){if(vM(e),e.lookahead<=nM&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+nM;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=nM-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=$P._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=$P._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(hM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(hM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hM(e,!1),0===e.strm.avail_out)?1:2}(n,t):WP[n.level].func(n,t);if(3!==s&&4!==s||(n.status=sM),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?$P._tr_align(n):5!==t&&($P._tr_stored_block(n,0,0,!1),3===t&&(dM(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),lM(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(pM(n,255&e.adler),pM(n,e.adler>>8&255),pM(n,e.adler>>16&255),pM(n,e.adler>>24&255),pM(n,255&e.total_in),pM(n,e.total_in>>8&255),pM(n,e.total_in>>16&255),pM(n,e.total_in>>24&255)):(fM(n,e.adler>>>16),fM(n,65535&e.adler)),lM(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},sP.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==oM&&t!==aM&&t!==sM?cM(e,rM):(e.state=null,t===aM?cM(e,-3):0):rM},sP.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return rM;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return rM;for(1===o&&(e.adler=QP(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(dM(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new ZP.Buf8(r.w_size),ZP.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,vM(r);r.lookahead>=3;){n=r.strstart,i=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=2,vM(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},sP.deflateInfo="pako deflate (from Nodeca project)";var IM={},RM=oP,AM=!0,CM=!0;try{String.fromCharCode.apply(null,[0])}catch(e){AM=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){CM=!1}for(var OM=new RM.Buf8(256),NM=0;NM<256;NM++)OM[NM]=NM>=252?6:NM>=248?5:NM>=240?4:NM>=224?3:NM>=192?2:1;function wM(e,t){if(t<65534&&(e.subarray&&CM||!e.subarray&&AM))return String.fromCharCode.apply(null,RM.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}OM[254]=OM[254]=1,IM.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new RM.Buf8(s),o=0,i=0;o<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),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},IM.buf2binstring=function(e){return wM(e,e.length)},IM.binstring2buf=function(e){for(var t=new RM.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},IM.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)s[n++]=i;else if((o=OM[i])>4)s[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return wM(s,n)},IM.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+OM[e[r]]>t?r:t};var DM=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},kM=sP,PM=oP,MM=IM,UM=JP,LM=DM,xM=Object.prototype.toString;function VM(e){if(!(this instanceof VM))return new VM(e);this.options=PM.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 LM,this.strm.avail_out=0;var r=kM.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(UM[r]);if(t.header&&kM.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?MM.string2buf(t.dictionary):"[object ArrayBuffer]"===xM.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=kM.deflateSetDictionary(this.strm,n)))throw new Error(UM[r]);this._dict_set=!0}}function BM(e,t){var r=new VM(t);if(r.push(e,!0),r.err)throw r.msg||UM[r.err];return r.result}VM.prototype.push=function(e,t){var r,n,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=MM.string2buf(e):"[object ArrayBuffer]"===xM.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new PM.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=kM.deflate(i,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(MM.buf2binstring(PM.shrinkBuf(i.output,i.next_out))):this.onData(PM.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=kM.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},VM.prototype.onData=function(e){this.chunks.push(e)},VM.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=PM.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},aP.Deflate=VM,aP.deflate=BM,aP.deflateRaw=function(e,t){return(t=t||{}).raw=!0,BM(e,t)},aP.gzip=function(e,t){return(t=t||{}).gzip=!0,BM(e,t)};var jM={},FM=s,GM=Ct,HM=H_,zM=a,KM=RegExp.prototype;FM&&zM((function(){return"sy"!==Object.getOwnPropertyDescriptor(KM,"flags").get.call({dotAll:!0,sticky:!0})}))&&GM.f(KM,"flags",{configurable:!0,get:HM});var YM={},XM=oP,WM=15,qM=[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],JM=[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],ZM=[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],$M=[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],QM=oP,eU=YP,tU=qP,rU=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,E,g,S,y,b,T,I,R,A;r=e.state,n=e.next_in,R=e.input,i=n+(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,E=(1<<r.distbits)-1;e:do{f<15&&(p+=R[n++]<<f,f+=8,p+=R[n++]<<f,f+=8),g=_[p&m];t:for(;;){if(p>>>=S=g>>>24,f-=S,0===(S=g>>>16&255))A[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=_[(65535&g)+(p&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}y=65535&g,(S&=15)&&(f<S&&(p+=R[n++]<<f,f+=8),y+=p&(1<<S)-1,p>>>=S,f-=S),f<15&&(p+=R[n++]<<f,f+=8,p+=R[n++]<<f,f+=8),g=v[p&E];r:for(;;){if(p>>>=S=g>>>24,f-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=v[(65535&g)+(p&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&g,f<(S&=15)&&(p+=R[n++]<<f,(f+=8)<S&&(p+=R[n++]<<f,f+=8)),(b+=p&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=S,f-=S,b>(S=o-a)){if((S=b-S)>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-S,S<y){y-=S;do{A[o++]=h[T++]}while(--S);T=o-b,I=A}}else if(l<S){if(T+=u+l-S,(S-=l)<y){y-=S;do{A[o++]=h[T++]}while(--S);if(T=0,l<y){y-=S=l;do{A[o++]=h[T++]}while(--S);T=o-b,I=A}}}else if(T+=l-S,S<y){y-=S;do{A[o++]=h[T++]}while(--S);T=o-b,I=A}for(;y>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],y-=3;y&&(A[o++]=I[T++],y>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],y-=3}while(y>2);y&&(A[o++]=A[T++],y>1&&(A[o++]=A[T++]))}break}}break}}while(n<i&&o<s);n-=y=f>>3,p&=(1<<(f-=y<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=p,r.bits=f},nU=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,p,f,_,v,m=s.bits,E=0,g=0,S=0,y=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,N=0,w=new XM.Buf16(16),D=new XM.Buf16(16),k=null,P=0;for(E=0;E<=WM;E++)w[E]=0;for(g=0;g<n;g++)w[t[r+g]]++;for(b=m,y=WM;y>=1&&0===w[y];y--);if(b>y&&(b=y),0===y)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<y&&0===w[S];S++);for(b<S&&(b=S),R=1,E=1;E<=WM;E++)if(R<<=1,(R-=w[E])<0)return-1;if(R>0&&(0===e||1!==y))return-1;for(D[1]=0,E=1;E<WM;E++)D[E+1]=D[E]+w[E];for(g=0;g<n;g++)0!==t[r+g]&&(a[D[t[r+g]]++]=g);if(0===e?(O=k=a,p=19):1===e?(O=qM,N-=257,k=JM,P-=257,p=256):(O=ZM,k=$M,p=-1),C=0,g=0,E=S,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=E-I,a[g]<p?(_=0,v=a[g]):a[g]>p?(_=k[P+a[g]],v=O[N+a[g]]):(_=96,v=0),c=1<<E-I,S=u=1<<T;do{i[h+(C>>I)+(u-=c)]=f<<24|_<<16|v|0}while(0!==u);for(c=1<<E-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,g++,0==--w[E]){if(E===y)break;E=t[r+a[g]]}if(E>b&&(C&l)!==d){for(0===I&&(I=b),h+=S,R=1<<(T=E-I);T+I<y&&!((R-=w[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;i[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(i[h+C]=E-I<<24|64<<16|0),s.bits=b,0},iU=-2,oU=12,aU=30;function sU(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function cU(){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 QM.Buf16(320),this.work=new QM.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function uU(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 QM.Buf32(852),t.distcode=t.distdyn=new QM.Buf32(592),t.sane=1,t.back=-1,0):iU}function dU(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,uU(e)):iU}function lU(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?iU:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,dU(e))):iU}function hU(e,t){var r,n;return e?(n=new cU,e.state=n,n.window=null,0!==(r=lU(e,t))&&(e.state=null),r):iU}var pU,fU,_U=!0;function vU(e){if(_U){var t;for(pU=new QM.Buf32(512),fU=new QM.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(nU(1,e.lens,0,288,pU,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;nU(2,e.lens,0,32,fU,0,e.work,{bits:5}),_U=!1}e.lencode=pU,e.lenbits=9,e.distcode=fU,e.distbits=5}function mU(e,t,r,n){var i,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new QM.Buf8(o.wsize)),n>=o.wsize?(QM.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),QM.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(QM.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}YM.inflateReset=dU,YM.inflateReset2=lU,YM.inflateResetKeep=uU,YM.inflateInit=function(e){return hU(e,15)},YM.inflateInit2=hU,YM.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,E,g,S,y,b,T,I,R,A=0,C=new QM.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 iU;(r=e.state).mode===oU&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=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+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,C[0]=255&u,C[1]=u>>>8&255,r.check=tU(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=aU;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=aU;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=aU;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:oU,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=aU;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=aU;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=tU(r.check,C,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[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=tU(r.check,C,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[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=tU(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+=n[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=tU(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)),QM.arraySet(r.head.extra,n,o,p,b)),512&r.flags&&(r.check=tU(r.check,n,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=n[o+p++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&r.flags&&(r.check=tU(r.check,n,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=n[o+p++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&r.flags&&(r.check=tU(r.check,n,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+=n[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=aU;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=oU;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=sU(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=oU;case oU: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+=n[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(vU(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=aU}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=aU;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;QM.arraySet(i,n,o,p,a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=oU;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[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=aU;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[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=nU(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid code lengths set",r.mode=aU;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,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(E<16)u>>>=v,d-=v,r.lens[r.have++]=E;else{if(16===E){for(R=v+2;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=aU;break}b=r.lens[r.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===E){for(R=v+3;d<R;){if(0===s)break e;s--,u+=n[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+=n[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=aU;break}for(;p--;)r.lens[r.have++]=b}}if(r.mode===aU)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=aU;break}if(r.lenbits=9,I={bits:r.lenbits},T=nU(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=aU;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},T=nU(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=aU;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,rU(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===oU&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=v,S=m,y=E;m=(A=r.lencode[y+((u&(1<<g+S)-1)>>g)])>>>16&255,E=65535&A,!(g+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=v,d-=v,r.back+=v,r.length=E,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=oU;break}if(64&m){e.msg="invalid literal/length code",r.mode=aU;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+=n[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,E=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(g=v,S=m,y=E;m=(A=r.distcode[y+((u&(1<<g+S)-1)>>g)])>>>16&255,E=65535&A,!(g+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=aU;break}r.offset=E,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+=n[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=aU;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=aU;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),_=r.window}else _=i,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{i[a++]=_[f++]}while(--p);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?tU(r.check,i,h,a-h):eU(r.check,i,h,a-h)),h=c,(r.flags?u:sU(u))!==r.check){e.msg="incorrect data check",r.mode=aU;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+=n[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=aU;break}u=0,d=0}r.mode=29;case 29:T=1;break e;case aU:T=-3;break e;case 31:return-4;default:return iU}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<aU&&(r.mode<27||4!==t))&&mU(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?tU(r.check,i,h,e.next_out-h):eU(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===oU?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},YM.inflateEnd=function(e){if(!e||!e.state)return iU;var t=e.state;return t.window&&(t.window=null),e.state=null,0},YM.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?iU:(r.head=t,t.done=!1,0):iU},YM.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?iU:11===r.mode&&eU(1,t,n,0)!==r.check?-3:mU(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):iU},YM.inflateInfo="pako inflate (from Nodeca project)";var EU={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 gU=YM,SU=oP,yU=IM,bU=EU,TU=JP,IU=DM,RU=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},AU=Object.prototype.toString;function CU(e){if(!(this instanceof CU))return new CU(e);this.options=SU.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 IU,this.strm.avail_out=0;var r=gU.inflateInit2(this.strm,t.windowBits);if(r!==bU.Z_OK)throw new Error(TU[r]);if(this.header=new RU,gU.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=yU.string2buf(t.dictionary):"[object ArrayBuffer]"===AU.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=gU.inflateSetDictionary(this.strm,t.dictionary))!==bU.Z_OK))throw new Error(TU[r])}function OU(e,t){var r=new CU(t);if(r.push(e,!0),r.err)throw r.msg||TU[r.err];return r.result}CU.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?bU.Z_FINISH:bU.Z_NO_FLUSH,"string"==typeof e?s.input=yU.binstring2buf(e):"[object ArrayBuffer]"===AU.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 SU.Buf8(c),s.next_out=0,s.avail_out=c),(r=gU.inflate(s,bU.Z_NO_FLUSH))===bU.Z_NEED_DICT&&u&&(r=gU.inflateSetDictionary(this.strm,u)),r===bU.Z_BUF_ERROR&&!0===d&&(r=bU.Z_OK,d=!1),r!==bU.Z_STREAM_END&&r!==bU.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==bU.Z_STREAM_END&&(0!==s.avail_in||n!==bU.Z_FINISH&&n!==bU.Z_SYNC_FLUSH)||("string"===this.options.to?(i=yU.utf8border(s.output,s.next_out),o=s.next_out-i,a=yU.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&SU.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(SU.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!==bU.Z_STREAM_END);return r===bU.Z_STREAM_END&&(n=bU.Z_FINISH),n===bU.Z_FINISH?(r=gU.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===bU.Z_OK):n!==bU.Z_SYNC_FLUSH||(this.onEnd(bU.Z_OK),s.avail_out=0,!0)},CU.prototype.onData=function(e){this.chunks.push(e)},CU.prototype.onEnd=function(e){e===bU.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=SU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},jM.Inflate=CU,jM.inflate=OU,jM.inflateRaw=function(e,t){return(t=t||{}).raw=!0,OU(e,t)},jM.ungzip=OU;var NU={};(0,oP.assign)(NU,aP,jM,EU);var wU,DU,kU,PU,MU,UU,LU,xU,VU,BU,jU,FU,GU,HU,zU,KU,YU,XU,WU,qU,JU,ZU,$U,QU,eL,tL,rL,nL,iL,oL,aL,sL,cL,uL,dL,lL,hL,pL,fL,_L,vL,mL,EL,gL,SL,yL,bL=NU;!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",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"}(wU||(wU={})),function(e){e.RTC="rtc"}(DU||(DU={})),function(e){e.W_5="5"}(kU||(kU={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(PU||(PU={})),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"}(MU||(MU={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(UU||(UU={})),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"}(LU||(LU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(xU||(xU={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(VU||(VU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(BU||(BU={})),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"}(jU||(jU={})),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"}(FU||(FU={})),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"}(GU||(GU={})),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"}(HU||(HU={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(zU||(zU={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(KU||(KU={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(YU||(YU={})),function(e){e.W_0="0",e.W_1="1"}(XU||(XU={})),function(e){e.UP="up",e.DOWN="down"}(WU||(WU={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(qU||(qU={})),function(e){e.UP="up",e.DOWN="down"}(JU||(JU={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(ZU||(ZU={})),function(e){e.W_0="0",e.W_1="1"}($U||($U={})),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"}(QU||(QU={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(eL||(eL={})),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"}(tL||(tL={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(rL||(rL={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(nL||(nL={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(iL||(iL={})),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"}(oL||(oL={})),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"}(aL||(aL={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(sL||(sL={})),function(e){e.BEGIN="begin",e.END="end"}(cL||(cL={})),function(e){e.BEGIN="begin",e.END="end"}(uL||(uL={})),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"}(dL||(dL={})),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"}(lL||(lL={})),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"}(pL||(pL={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(fL||(fL={})),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"}(_L||(_L={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(vL||(vL={})),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"}(mL||(mL={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(EL||(EL={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(gL||(gL={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(SL||(SL={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(yL||(yL={}));var TL,IL,RL,AL,CL,OL,NL,wL,DL,kL=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}(),PL=eP.LOG_SERVER_URL,ML=function(e){function t(){var t=e.call(this)||this;return t.report_id=0,t.dataBuffer=[],t.posting=!1,t.report_common={},t.preSucTime=0,t.errSendDelay=100,t.commonStats=new kL(t),sk()||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 n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;if(i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){e||(r.posting=!1);var o=void 0;if(200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(e){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}},i.open("POST",PL,!0),e||(this.posting=!0),!sk()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",n),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!sk()&&location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var o=bL.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(o)}}},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,n=t.device_id,i=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,E=t.app_version,g=t.aid,S=t.device_model,y=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:n,rtc_app_id:i,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:E,aid:g,device_model:S,device_brand:y,common_extra_info:b,had_selected_p2p:T,rtc_env_type:I,user_agent:R}),this.commonStats.room_id&&(e.room_id=this.commonStats.room_id),this.commonStats.user_id&&(e.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(e.rtc_session_id=this.commonStats.rtc_session_id)},t.prototype.rtcSdkApiCall=function(e,t,r,n){void 0===n&&(n={});var i=Yf({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},n);this.push(i)},t.prototype.rtcSdkCallback=function(e,t,r,n){void 0===n&&(n={});var i=Yf({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},n);this.push(i)},t.prototype.rtcReconnect=function(e,t,r,n,i){void 0===i&&(i={});var o=Yf({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},i);this.push(o)},t.prototype.rtcReconnected=function(e,t,r){void 0===r&&(r={});var n=Yf({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},r);this.push(n)},t.prototype.rtcGetAccess=function(e,t,r,n,i,o,a){void 0===a&&(a={});var s=Yf({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:i,connect_session_id:o},a);this.push(s)},t.prototype.rtcPreIceState=function(e,t,r){void 0===r&&(r={});var n=Yf({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},r);this.push(n)},t.prototype.rtcNodeChange=function(e,t,r,n){void 0===n&&(n={});var i=Yf({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},n);this.push(i)},t.prototype.rtcSignalingMsgError=function(e,t,r,n){void 0===n&&(n={});var i=Yf({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},n);this.push(i)},t.prototype.rtcSignaling=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Yf({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,direction:i},o);this.push(a)},t.prototype.rtcJoinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=Yf({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},i);this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,r,n){void 0===n&&(n={});var i=Yf({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},n);this.push(i)},t.prototype.rtcBeginCreateOffer=function(e,t,r,n){void 0===n&&(n={});var i=Yf({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},n);this.push(i)},t.prototype.rtcCreateOffer=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Yf({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:n,elapse:i},o);this.push(a)},t.prototype.rtcSetDescription=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=Yf({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:i,stream_user_id:o,elapse:a},s);this.push(c)},t.prototype.rtcRecvAnswer=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=Yf({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:i,stream_id:o,stream_user_id:a},s);this.push(c)},t.prototype.firstRemoteAudioRender=function(e,t,r){void 0===r&&(r={});var n=Yf({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},r);this.push(n)},t.prototype.firstRemoteVideoRender=function(e,t,r){void 0===r&&(r={});var n=Yf({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},r);this.push(n)},t.prototype.rtcPublishStat=function(e,t,r,n,i){void 0===i&&(i={});var o=Yf({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},i);this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,r,n,i){void 0===i&&(i={});var o=Yf({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},i);this.push(o)},t.prototype.rtcAudioDevice=function(e,t,r,n){void 0===n&&(n={});var i=Yf({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},n);this.push(i)},t.prototype.rtcMediaStatistics=function(e,t,r){void 0===r&&(r={});var n=Yf(Yf(Yf({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},t.prototype.rtcMessageStatistics=function(e,t,r,n){void 0===n&&(n={});var i=Yf(Yf(Yf(Yf({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),{media_server_ip:r}),n);this.push(i)},t.prototype.rtcError=function(e,t,r){void 0===r&&(r={});var n=Yf({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},r);this.push(n)},t.prototype.rtcInvokeStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Yf({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:n,elapse:i},o);this.push(a)},t.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var r=Yf(Yf({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t);this.push(r)},t.prototype.rtcMuteRemote=function(e,t,r){void 0===r&&(r={});var n=Yf(Yf(Yf({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now()},e),{media_type:t}),r);this.push(n)},t.prototype.sdkInitEngine=function(e,t,r){void 0===r&&(r={});var n=Yf({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},r);this.push(n)},t.prototype.joinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=Yf({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},i);this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Yf({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:n,elapse:i},o);this.push(a)},t.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var r=Yf({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},t);this.push(r)},t.prototype.rtcDeviceError=function(e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,_,v){void 0===v&&(v={});var m=Yf({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:n,system_api:i,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:_},v);this.push(m)},t.prototype.rtcVideoDevice=function(e,t,r){void 0===r&&(r={});var n=Yf({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},r);this.push(n)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var r=Yf(Yf({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t);this.push(r)},t.prototype.rtcEncodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Yf(Yf(Yf({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},t.prototype.rtcFirstFrameEncoded=function(e,t,r){void 0===r&&(r={});var n=Yf(Yf(Yf({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},t.prototype.rtcSendFirstPacket=function(e,t,r){void 0===r&&(r={});var n=Yf(Yf(Yf({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},t.prototype.rtcRecvFirstPacket=function(e,t,r){void 0===r&&(r={});var n=Yf(Yf(Yf({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},t.prototype.rtcRecvFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Yf(Yf(Yf({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},t.prototype.rtcDecodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Yf(Yf(Yf({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),r);this.push(n)},t}(kk),UL=new ML,LL=new ML,xL=UL.commonStats,VL=LL.commonStats;function BL(e){void 0===e&&(e=!1);for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,n,i){if("function"==typeof i.value){var o=i.value;i.value=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a={};return t.forEach((function(e,t){a[e]=r[t]})),(e?LL:UL).rtcSdkApiCall(n,0,JSON.stringify(lk(r)),a),o.apply(this,r)}}}}function jL(e,t,r){void 0===r&&(r=0),(e===n_.onUserMessageReceivedOutsideRoom||e===n_.onUserBinaryMessageReceivedOutsideRoom?LL:UL).rtcSdkCallback(e,r,JSON.stringify(t))}function FL(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=!1),(n?LL:UL).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"}(TL||(TL={})),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"}(IL||(IL={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(RL||(RL={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(AL||(AL={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(CL||(CL={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(NL||(NL={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(wL||(wL={})),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"}(DL||(DL={}));var GL,HL,zL=((OL={})[DL.SUCCESS]=[0,"success"],OL[DL.TIMEOUT]=[$w.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],OL[DL.BROKEN]=[$w.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],OL[DL.NO_RECEIVER]=[$w.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],OL[DL.NO_RELAYPATH]=[$w.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],OL[DL.SEND_TO_SERVER_ERROR]=[$w.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],OL[DL.SERVER_RESPONSE_ERROR]=[$w.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],OL[DL.NOT_JOIN]=[$w.USER_MESSAGE_NOT_JOIN,"not join room"],OL[DL.INIT]=[$w.USER_MESSAGE_INIT,"not init."],OL[DL.NO_CONNECTION]=[$w.USER_MESSAGE_NO_CONNECTION,"no connection."],OL[DL.EXCEED_MAX_LENGTH]=[$w.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],OL[DL.EMPTY_USER]=[$w.USER_MESSAGE_EMPTY_USER,"user id is empty."],OL[DL.NOT_LOGIN]=[$w.USER_MESSAGE_NOT_LOGIN,"not login."],OL[DL.SERVER_PARAMS_NOTSET]=[$w.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],OL[DL.UNKNOWN]=[$w.USER_MESSAGE_UNKNOWN,"unknown."],OL),KL=new wk("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(GL||(GL={})),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"}(HL||(HL={}));var YL=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 n=this;return UL.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",zU.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=uk();var s=a.id.join("-"),c=setTimeout((function(){n._singlingCache.delete(s),o(new nD($w.TIME_OUT,"".concat(e," message time out")))}),6e4);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),i(e)},error:function(e){clearTimeout(c),o(e)}}),KL.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),n._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:HL.C2GW})},t.prototype.sendP2PMessage=function(e,t){var r=e.msg,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["msg"]);return Wf(this,void 0,void 0,(function(){var e,i,o,a,s;return qf(this,(function(c){switch(c.label){case 0:return e=r instanceof ArrayBuffer,i=this._sendP2PMessage,o=[Yf({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:NL.SEND,type:wL.P2P,err:DL.SUCCESS},n)],s={binary:e},e?[4,ck.ab2b64str(r)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=JSON.stringify(r),c.label=3;case 3:return[2,i.apply(this,[Yf.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var r=this;return void 0===t&&(t={}),dk(e.msg)?this._rttIds[e.id]=e.id:KL.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(n,i){var o=r._genHeader(Yf(Yf({needAck:!0,functionType:HL.C2C},t),{id:uk()}));if(e.dir===NL.SEND){var a=setTimeout((function(){r._p2pCache.delete(e.id),i(new nD($w.TIME_OUT,"P2P message timeout"))}),6e4);r._p2pCache.set(e.id,{success:function(e){clearTimeout(a),n(e)},error:function(e){clearTimeout(a);var t=Zf(zL[e.err]||[$w.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];i({code:r,message:e.msg||n})}})}r._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new nD($w.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var n=t.version+(+t.zip<<5)+(+t.encrypt<<6),i=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=ck.str2ab(JSON.stringify([e,r])),a=ak(Uint8Array,$f([n,i],Zf(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],o={version:15&n,zip:16==(16&n),encrypt:32==(32&n),needAck:1==(1&i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:64==(64&i)};if(o.needAck||o.direction===GL.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:GL.ACK,id:e.split("-").map((function(e){return+e}))});KL.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")},t.prototype._handleMessage=function(e){var t,r;return Wf(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,E,g,S,y,b,T,I,R,A,C,O,N,w;return qf(this,(function(D){switch(D.label){case 0:n=this._dispartData(e),i=n.header,o=n.data,i.zip&&((a=new bL.Inflate).push(o,!0),o=a.result),s=ck.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&UL.rtcSignalingMsgError(-1,e.message,GU.MESSAGE_PARSE_FAILED),[2]}switch(i.functionType){case HL.C2S:return[3,1];case HL.C2C:return[3,6];case HL.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=i.id)||void 0===t?void 0:t.join("-"))||"",i.direction!==GL.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],KL.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,ck.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=D.sent(),D.label=4;case 4:this.emit(d,Yf({},c)),UL.rtcSignaling(0,s,"on-".concat(d),"Recv",zU.DOWN),D.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)===NL.FEEDBACK||dk(null==c?void 0:c.msg)?delete this._rttIds[h]:KL.print("Signal","<<<<<< p2p response",c),c.dir){case NL.SEND:return[3,7];case NL.FEEDBACK:return[3,16]}return[3,17];case 7:return dk(null==c?void 0:c.msg)?[3,15]:(f=(p=c).binary,_=p.msg,v=p.room,m=p.to,E=p.from,g=""===v?f?IL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:IL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:f?IL.USER_BINARY_MESSAGE_RECEIVED:IL.USER_MESSAGE_RECEIVED,m?[3,11]:(S=this.emit,y=[IL.ON_CUSTOM_MESSAGE],N={clientId:E,binary:f},f?[4,ck.b64str2ab(_)]:[3,9]));case 8:return b=D.sent(),[3,10];case 9:b=_,D.label=10;case 10:return S.apply(this,y.concat([(N.message=b,N)])),[3,17];case 11:return T=this.emit,I=[g],R=[Yf({},c)],w={},f?[4,ck.b64str2ab(_)]:[3,13];case 12:return A=D.sent(),[3,14];case 13:A=_,D.label=14;case 14:T.apply(this,I.concat([Yf.apply(void 0,R.concat([(w.msg=A,w)]))])),D.label=15;case 15:return this._sendP2PMessage(Yf(Yf({},c),{dir:NL.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===DL.SUCCESS?C.success(c.id):C.error(c)),[3,17];case 17:return[3,19];case 18:i.direction===GL.ACK&&(O=(null===(r=i.id)||void 0===r?void 0:r.join("-"))||"",this._handleAckMessage(O,c[0]||{},s)),D.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){KL.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){KL.print("_handleHandler","dataChannel error",t),e.emit("close",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",n)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),Yf({version:2,zip:!1,encrypt:!1,needAck:!0,direction:GL.SEND,functionType:HL.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,r){var n=this._singlingCache.get(e);n&&(this._singlingCache.delete(e),200===t.code?n.success(t):n.error(t),KL.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),UL.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",zU.DOWN)},t}(Ak.exports.EventEmitter),XL=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,r=e.method,n=e.url,i=e.body,o=void 0===i?{}:i,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,i){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(r,n,!0);try{for(var l=Jf(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=Zf(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)):i({message:d.statusText,code:d.status})),0===d.status&&i({code:0,message:"Request abort"})},d.onerror=function(e){var r=$w.UNEXPECTED_ERROR;t.isSending=!1,i({code:r,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,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),WL="RTC_DEVICE_ID",qL="RTC_ACCESS_NODE",JL="RTC_ACCESS_URLS",ZL=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 n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(n)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),$L=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Cf(t,e),t.prototype.getDeviceId=function(){var e=this.get(WL);return e||(e=tk()),this.set(WL,e),e},t.prototype.getAccessNode=function(e){return this.get("".concat(qL,"_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,r){return this.set("".concat(qL,"_").concat(e,"-BytePlus"),t,1e3*r)},t.prototype.getAccessUrls=function(){return this.get("".concat(JL,"-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(JL,"-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat(JL,"-BytePlus"))},t}(ZL),QL=new $L,ex=new wk("ICE Request",3),tx=function(){function e(){this._request=new XL}return e.prototype.getAccessNode=function(e,t,r,n,i,o){return Wf(this,void 0,void 0,(function(){var a;return qf(this,(function(s){return(a=QL.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,r,n,i,o),FL("es.R.node.cache",a),[2,Promise.resolve(a)]):[2,this.getAccessNodeFromServer(e,t,r,n,i,o)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,r,n,i,o){return Wf(this,void 0,void 0,(function(){var a,s,c=this;return qf(this,(function(u){return a=QL.getAccessUrls(),s=!0,FL("es.R.req.cache.urls",a),(null==a?void 0:a.length)>0||(a=eP.ICE_CONFIG_REQUEST_URLS,s=!1,FL("es.R.req.external.urls",a)),(null==a?void 0:a.length)>0||(a=eP.ICE_CONFIG_REQUEST_URLS_INTERNAL,s=!1,FL("es.R.req.internal.urls",a)),[2,this.getICEConfigFromServer(a,e,t,r,n,i,o).then((function(t){var r=t.nodes[0];return QL.setAccessNode(e,r,t.ttl||11200),QL.setAccessUrls(t.dispatchDomains),r})).catch((function(a){if(s)return FL("es.R.req.fallback",""),QL.clearAccessUrls(),c.getAccessNodeFromServer(e,t,r,n,i,o);throw a}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,r,n,i,o,a){var s;return Wf(this,void 0,void 0,(function(){var r,c,u,d=this;return qf(this,(function(l){return r={appID:t,userID:n,deviceID:i,connectSessionID:ik(),os:"web",sdkVersion:eP.VERSION,expectedAddr:rP("EXPECTED_ADDR"),productPlatform:"BytePlus"},o&&a&&(r.feedbackInfo=[{feedbackIP:null===(s=a.publicIPs[0])||void 0===s?void 0:s.ip,feedbackReason:{type:"NodeChanged",reason:o}}],delete r.expectedAddr),c=Date.now(),UL.rtcGetAccess(0,JSON.stringify(r),0,jU.REQUEST,e.join(","),r.connectSessionID),u=e.map((function(e,t){return Wf(d,void 0,void 0,(function(){var n,i,o;return qf(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,r)];case 1:return n=a.sent(),[3,3];case 2:throw i=a.sent(),new nD($w.ICE_SERVER_WRONG,"get ICE config failed",i);case 3:if(200!==n.code)throw new nD($w.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:JSON.stringify(n)});if(!(o=n.nodes[0]))throw new nD($w.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:JSON.stringify(n)});return[2,{result:n,firstNode:o,index:t}]}}))}))})),[2,pk(u).then((function(t){var n=t.result;t.firstNode;var i=t.index;return UL.rtcGetAccess(200,JSON.stringify(n),Date.now()-c,jU.RESPONSE,e[i],r.connectSessionID),n})).catch((function(t){var n,i,o;throw UL.rtcGetAccess((null===(n=t[0])||void 0===n?void 0:n.code)||(null===(i=t[0])||void 0===i?void 0:i.server_code),null===(o=t[0])||void 0===o?void 0:o.message,Date.now()-c,jU.RESPONSE,e.join(","),r.connectSessionID),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(ex.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),rx={},nx={},ix={exports:{}},ox=ix.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(ox).forEach((function(e){ox[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,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=ix.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var c=n[t][s];if(c.reg.test(i))return r(c,a,i)}})),t.media=o,t};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[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=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+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,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(nx);var ax=ix.exports,sx=/%[sdv%]/g,cx=function(e){var t=1,r=arguments,n=r.length;return e.replace(sx,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},ux=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return cx.apply(null,n)},dx=["v","o","s","i","u","e","p","c","b","t","r","z","a"],lx=["i","c","b","a"],hx=nx,px=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||dx,n=t.innerOrder||lx,i=[];return r.forEach((function(t){ax[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(ux(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(ux(t,r,e))}))}))})),e.media.forEach((function(e){i.push(ux("m",ax.m[0],e)),n.forEach((function(t){ax[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(ux(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(ux(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};rx.write=px,rx.parse=hx.parse,rx.parseParams=hx.parseParams,rx.parseFmtpConfig=hx.parseFmtpConfig,rx.parsePayloads=hx.parsePayloads,rx.parseRemoteCandidates=hx.parseRemoteCandidates,rx.parseImageAttributes=hx.parseImageAttributes,rx.parseSimulcastStreamList=hx.parseSimulcastStreamList;var fx=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this._iceConfigNode.iceParams,n=rx.parse(e);return null===(t=n.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"})),rx.write(n)},e}(),_x=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this,n=this._iceConfigNode.certFingerprint,i=rx.parse(e);return(null==i?void 0:i.fingerprint)&&(i.fingerprint={type:"sha-256",hash:n}),null===(t=null==i?void 0:i.media)||void 0===t||t.forEach((function(e){return r.modifyMlineByIceNode(e)})),rx.write(i)},e.prototype.modifyMlineByIceNode=function(e){var t=this._iceConfigNode,r=t.publicIPs,n=t.certFingerprint,i=t.iceParams;e.fingerprint&&(e.fingerprint={type:"sha-256",hash:n}),e.icePwd=i.serverIcePwd,this._iceUfrag||(this._iceUfrag=Rx(i.serverIceUfrag),xL.setStats({connection_id:this._iceUfrag})),e.iceUfrag=this._iceUfrag,e.setup="active",this._candidates||(this._candidates=Ix(r)),e.candidates=this._candidates,e.iceOptions="renomination","application"===e.type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144})},e}();function vx(e,t){var r,n=rx.parse(e),i=[];return n.media=n.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&&i.push(e.mid),e})),(null===(r=n.groups)||void 0===r?void 0:r[0])&&(n.groups[0].mids=i.join(" ")),n}var mx,Ex,gx,Sx,yx,bx=function(e,t){var r,n;try{var i=rx.parse(e),o=rx.parse(t),a="".concat(null===(r=o.groups)||void 0===r?void 0:r[0].mids).split(" "),s="".concat(null===(n=i.groups)||void 0===n?void 0:n[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 i.media=i.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 i.groups,delete i.msidSemantic,{partialSdp:rx.write(i),audioMid:d,videoMid:l}}catch(e){return null}},Tx=function(e,t){var r;try{var n=rx.parse(e),i=[];return null===(r=n.media)||void 0===r||r.forEach((function(e){(null==t?void 0:t.includes("".concat(e.mid)))&&i.push(e)})),n.media=i,delete n.groups,delete n.msidSemantic,rx.write(n)}catch(e){return""}},Ix=function(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var i={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push(Yf(Yf({},i),{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(Yf(Yf({},i),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n},Rx=function(e){var t=new TextEncoder,r=t.encode("PREC"),n=new Uint8Array(ck.str2ab(e)),i=t.encode(Date.now().toString()).slice(-4),o=new Uint8Array(4);o[0]=0,o[1]=1,o[2]=1,o[3]=1;var a=ak(Uint8Array,r,n,i,o),s=ck.ab2str(a.buffer);return window.btoa(s)},Ax="safari"===(mx="none",sk()||(null!==window.navigator.userAgent.match("Firefox")?mx="mozilla":null!==window.navigator.userAgent.match("Chrome")?(mx="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(mx="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(mx="safari")),mx);!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"}(Ex||(Ex={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(gx||(gx={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(Sx||(Sx={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(yx||(yx={}));var Cx=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 Ex.candidatePair:r=t.handleCandidatePair;break;case Ex.certificate:r=t.handleCertificate;break;case Ex.remoteCandidate:r=t.handleRemoteCandidate;break;case Ex.remoteInboundRtp:r=t.handleInboundRtp;break;case Ex.remoteOutboundRtp:r=t.handleOutboundRtp;break;case Ex.sctpTransport:r=t.handleSctpTransport;break;case Ex.sender:r=t.handleSender;break;case Ex.stream:r=t.handleStream;break;case Ex.track:r=t.handleTrack;break;case Ex.transceiver:r=t.handleTransceiver;break;case Ex.transport:r=t.handleTransport;break;case Ex.codec:r=t.handleCodec;break;case Ex.csrc:r=t.handleCsrc;break;case Ex.dataChannel:r=t.handleDataChannel;break;case Ex.iceServer:r=t.handleIceServer;break;case Ex.mediaSource:r=t.handleMediaSource;break;case Ex.outboundRtp:r=t.handleOutboundRtp;break;case Ex.inboundRtp:r=t.handleInboundRtp;break;case Ex.peerConnection:r=t.handlePeerConnection;break;case Ex.receiver:r=t.handleReceiver;break;case Ex.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 Wf(this,void 0,void 0,(function(){var e=this;return qf(this,(function(t){return[2,new Promise((function(t,r){if(Ax||void 0!==window.InstallTrigger)return t(e.stats);try{e.peer.getStats((function(r){r.result().forEach((function(t){if(!Ox.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){return Wf(this,void 0,void 0,(function(){var t;return qf(this,(function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),[4,this.peer.getStats(e)];case 1:t=r.sent(),this.processStats(t),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.getExtraStats()];case 3:case 4:return r.sent(),[3,5];case 5:return[3,7];case 6:return r.sent(),[3,7];case 7:return[2,this.stats]}}))}))},e}(),Ox=["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"],Nx=function(){return Wf(void 0,void 0,void 0,(function(){var e,t,r,n;return qf(this,(function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),sk()||!window.RTCPeerConnection||!window.RTCPeerConnection.prototype.addTransceiver||!window.RTCPeerConnection.prototype.createDataChannel)return[2,!1];for(e=navigator.userAgent.toLowerCase(),t=["heytapbrowser","mqqbrowser","miuibrowser"],r=0;r<t.length;r++)if(e.includes(t[r]))return[2,!1];return[4,hk()];case 1:return(n=i.sent())&&(null==n?void 0:n.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))?[2,!0]:[2,!1];case 2:return i.sent(),[2,!1];case 3:return[2]}}))}))},wx=function(){return"undefined"!=typeof TransformStream&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Dx=new wk("BasicHandler",3),kx=wx(),Px={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!kx||void 0},Mx=function(e){function t(){var t=e.call(this)||this;return t._peerConnection=new RTCPeerConnection(Px),t._dataChannel=t._peerConnection.createDataChannel("signaling"),t._dataChannel.binaryType="arraybuffer",t._peerConnection.ontrack=function(e){var r,n;Dx.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(n=null===(r=e.streams)||void 0===r?void 0:r[0])||void 0===n?void 0:n.id)),t.emit("ontrack",e)},t._peerConnection.onconnectionstatechange=function(e){Dx.print("constructor","onconnectionstatechange ".concat(t._peerConnection.iceConnectionState," -> ").concat(t._peerConnection.connectionState)),"failed"!==t._peerConnection.iceConnectionState&&"closed"!==t._peerConnection.iceConnectionState&&"failed"!==t._peerConnection.connectionState||t.emit("disconnect")},t._peerConnection.oniceconnectionstatechange=function(){var e=t._peerConnection.iceConnectionState;UL.rtcPreIceState(e,FU["".concat(e.toUpperCase())])},t}return Cf(t,e),t.prototype.connect=function(e){return Wf(this,void 0,void 0,(function(){var t,r,n=this;return qf(this,(function(i){switch(i.label){case 0:return Dx.print("connect","invoke connect"),[4,this._peerConnection.createOffer()];case 1:return t=i.sent(),this._localSdp=new fx(e),[4,this.setLocalDescription(t.sdp)];case 2:return i.sent(),this._remoteSdp=new _x(e),r=this._remoteSdp.modifyByIceNode(t.sdp),[4,this.setRemoteDescription(r)];case 3:return i.sent(),[4,new Promise((function(e,t){n._dataChannel.onopen=function(){Dx.print("connect","dataChannel open"),FL("es.dc.open",""),e("")},n._dataChannel.onerror=function(e){UL.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,GU.INVALID_DATA),FL("es.dc.error",""),t(e)},n._dataChannel.onclose=function(e){FL("es.dc.close",""),t(e)},n._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==n._peerConnection.iceConnectionState&&"closed"!==n._peerConnection.iceConnectionState&&"failed"!==n._peerConnection.connectionState||t(e)}))}))];case 4:return i.sent(),Dx.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){var t;return Wf(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,E;return qf(this,(function(g){switch(g.label){case 0:if(r=e.stream,n=null==e?void 0:e.videoTrack,i=null==e?void 0:e.audioTrack,o={},a=[],Array.isArray(null==e?void 0:e.videoEncodeConfig))for(s=null==e?void 0:e.videoEncodeConfig.length,c=null==n?void 0:n.getTrack(),u={width:640,height:480,framerate:30},c&&(d=null==c?void 0:c.getSettings(),u={width:Math.floor(d.width),height:Math.floor(d.height),framerate:Math.floor(d.frameRate)}),o.sendEncodings=[],l=0;l<s;l++)h=null==e?void 0:e.videoEncodeConfig[l],p={maxBitrate:1e3*h.maxKbps},f=Math.pow(2,l),s>1&&(p.rid="".concat(l),p.scaleResolutionDownBy=f),null===(t=o.sendEncodings)||void 0===t||t.unshift(p),a.push({width:Math.floor(u.width/f),height:Math.floor(u.height/f),framerate:u.framerate,maxkbps:h.maxKbps,rid:"".concat(l)});return Dx.print("publish videoTransceiverInit videoDescriptions","",o,a),_=null==i?void 0:i.getTrack(),(null==i?void 0:i.mixType)!==e_.PLAYOUT&&(null==i?void 0:i.mixedAudioTrack)&&(_=null==i?void 0:i.mixedAudioTrack),e.audioTransceiver=this._peerConnection.addTransceiver(_||"audio",{direction:"sendonly",streams:[r]}),kx&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver((null==n?void 0:n.getTrack())||"video",Yf({direction:"sendonly",streams:[r]},o)),kx&&e.initVideoEncodedTransform(),Dx.print("sender.getParameters()",e.videoTransceiver.sender.getParameters()),v=ok(),UL.rtcBeginCreateOffer(KU.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:if(m=g.sent(),UL.rtcCreateOffer(0,YU.UP,e.streamId,e.userId,ok()-v),E=bx(m.sdp,this.getLocalDescriptionSdp()),!m.sdp||!E)throw new nD($w.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Yf(Yf({sdp:m.sdp},E),{type:"incroffer",semantics:"unified-plan",videoDescriptions:a})]}}))}))},t.prototype.subscribe=function(e,t){return Wf(this,void 0,void 0,(function(){var r,n,i,o,a;return qf(this,(function(s){switch(s.label){case 0:return r="incroffer",n="unified-plan",t?[2,{sdp:this.getLocalDescriptionSdp(),partialSdp:Tx(this.getLocalDescriptionSdp(),[t.audioMid,t.videoMid]),audioMid:t.audioMid,videoMid:t.videoMid,type:r,semantics:n}]:(e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),kx&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),kx&&e.initVideoEncodedTransform(),i=ok(),UL.rtcBeginCreateOffer(KU.DOWN,e.streamId,e.userId),[4,this._peerConnection.createOffer()]);case 1:if(o=s.sent(),UL.rtcCreateOffer(0,YU.DOWN,e.streamId,e.userId,ok()-i),a=bx(o.sdp,this.getLocalDescriptionSdp()),!o.sdp||!a)throw new nD($w.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Yf(Yf({sdp:o.sdp},a),{type:r,semantics:n})]}}))}))},t.prototype.setAnswerSdp=function(e,t,r,n,i){var o;return Wf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return qf(this,(function(p){switch(p.label){case 0:return UL.rtcRecvAnswer(0,qU.INCRANSWER,0,t,i,n.streamId,n.userId),a=this._peerConnection.remoteDescription,s=rx.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}),{}),rx.parse(t).media.forEach((function(e){return c[e.mid]=e})),u=[],d=rx.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 n=c[e.mid];return null===(t=h._remoteSdp)||void 0===t||t.modifyMlineByIceNode(n),e.bundleOnly||(n.port=e.port),n})),s.media=l,d.groups=[{mids:u.join(" "),type:"BUNDLE"}],s.groups=d.groups,[4,this.setLocalDescription(rx.write(d),n,i)];case 1:return p.sent(),[4,this.setRemoteDescription(rx.write(s),n,i)];case 2:return p.sent(),[2]}}))}))},t.prototype.setLocalDescription=function(e,t,r){var n,i;return Wf(this,void 0,void 0,(function(){var o,a,s,c,u,d,l;return qf(this,(function(h){switch(h.label){case 0:o=null===(n=this._localSdp)||void 0===n?void 0:n.modifyByIceNode(e),a=new RTCSessionDescription({type:"offer",sdp:o}),s=ok(),c=r||WU.UP,u=(null==t?void 0:t.streamId)||"",d=(null===(i=t)||void 0===i?void 0:i.userId)||"",h.label=1;case 1:return h.trys.push([1,3,,4]),Dx.print("setOffer","set offer: ",a),[4,this._peerConnection.setLocalDescription(a)];case 2:return h.sent(),UL.rtcSetDescription(0,a.sdp,XU.W_1,c,u,d,ok()-s,{type:"offer"}),[3,4];case 3:throw(l=h.sent())instanceof Error&&UL.rtcSetDescription(-1,l.message,XU.W_1,c,u,d,ok()-s,{type:"offer"}),l;case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t,r){var n;return Wf(this,void 0,void 0,(function(){var i,o,a,s,c,u;return qf(this,(function(d){switch(d.label){case 0:i=new RTCSessionDescription({type:"answer",sdp:e}),o=ok(),a=r||WU.UP,s=(null==t?void 0:t.streamId)||"",c=(null===(n=t)||void 0===n?void 0:n.userId)||"",d.label=1;case 1:return d.trys.push([1,3,,4]),Dx.print("setAnswer","set answer: ",i),[4,this._peerConnection.setRemoteDescription(i)];case 2:return d.sent(),UL.rtcSetDescription(0,i.sdp,XU.W_0,a,s,c,ok()-o,{type:"answer"}),[3,4];case 3:throw(u=d.sent())instanceof Error&&UL.rtcSetDescription(-1,u.message,XU.W_0,a,s,c,ok()-o,{type:"answer"}),u;case 4:return[2]}}))}))},t.prototype.getLocalDescriptionSdp=function(){var e,t,r,n;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.localDescription)||void 0===t?void 0:t.sdp)return null===(n=null===(r=this._peerConnection)||void 0===r?void 0:r.localDescription)||void 0===n?void 0:n.sdp;throw Error()},t.prototype.getRemoteDescriptionSdp=function(){var e,t,r,n;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.remoteDescription)||void 0===t?void 0:t.sdp)return null===(n=null===(r=this._peerConnection)||void 0===r?void 0:r.remoteDescription)||void 0===n?void 0:n.sdp;throw Error()},t.prototype.closeMLine=function(e){var t,r;return Wf(this,void 0,void 0,(function(){var n,i,o,a,s=this;return qf(this,(function(c){switch(c.label){case 0:return Dx.print("closeMids","closeMids: ",e),n=this.getLocalDescriptionSdp(),i=vx(n,e),o=this.getRemoteDescriptionSdp(),a=vx(o,e),[4,this._peerConnection.createOffer()];case 1:return c.sent(),[4,this.setLocalDescription(rx.write(i))];case 2:return c.sent(),(null===(t=null==i?void 0:i.media)||void 0===t?void 0:t.length)!==(null===(r=null==a?void 0:a.media)||void 0===r?void 0:r.length)&&i.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(i.media)&&Array.isArray(a.media)&&i.media.forEach((function(e,t){a.media[t]&&(a.media[t].mid=e.mid)})),[4,this.setRemoteDescription(rx.write(a))];case 3:return c.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return Wf(this,void 0,void 0,(function(){var e;return qf(this,(function(t){switch(t.label){case 0:return[4,hk()];case 1:if(!(e=t.sent()))throw new nD($w.NOT_SUPPORTED,"Get offer Error");return[2,{sdp:e,semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.getStats=function(e){return t=this._peerConnection,r=e,Wf(void 0,void 0,void 0,(function(){var e;return qf(this,(function(n){switch(n.label){case 0:return e=[],t instanceof RTCPeerConnection?[4,new Cx(t).getStats(r)]:[2,e];case 1:return[2,e=n.sent()]}}))}));var t,r},t.prototype.rollback=function(e,t){var r;return Wf(this,void 0,void 0,(function(){return qf(this,(function(n){switch(n.label){case 0:return Dx.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:n.sent(),n.label=2;case 2:return[4,this.closeMLine(t)];case 3:return n.sent(),[2]}}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}(Ak.exports.EventEmitter),Ux=new wk("Locker",2),Lx=1,xx=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=Lx++,e&&(this.name=e),Ux.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,Ux.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,Ux.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),n=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),n},e}(),Vx=Math.log,Bx=Math.LOG10E;Xn({target:"Math",stat:!0},{log10:Math.log10||function(e){return Vx(e)*Bx}}),Xn({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new wk("Stats",2);var jx,Fx=function(){function e(e,t){this._client=e,this._handler=t,this.dataChannelRTT={},this._rttTimer={},this._remoteStreamStasEvtIntervals={},this._localStreamStasEvtIntervals={},this._firstFrameStarted={},this._videoInWaiting={}}return e.prototype.setRemoteStreamStatsEvtInterval=function(e){var t,r,n=this;this.getDataChannelRTT(e.userId);var i={audio:{},video:{},remoteStream: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.getRemoteAudioStats(o,i),this.getRemoteVideoStats(a,i),this.delRemoteStreamStatsEvtInterval(e);this._remoteStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Wf(n,void 0,void 0,(function(){var t;return qf(this,(function(r){switch(r.label){case 0:return[4,Wf(n,void 0,void 0,(function(){var t,r,n,o,a,s;return qf(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.getRemoteAudioStats(t,i)];case 1:return n=c.sent(),[4,this.getRemoteVideoStats(r,i)];case 2:return(o=c.sent()).isScreen=e.isScreen,[2,{audioStats:n,videoStats:o,isScreen:e.isScreen,userId:e.userId}]}}))}))];case 1:return t=r.sent(),this._client.emit("onRemoteStreamStats",t),[2]}}))}))}),2e3)},e.prototype.delRemoteStreamStatsEvtInterval=function(e){clearInterval(this._remoteStreamStasEvtIntervals[e.streamId])},e.prototype.unsubscribe=function(e){this.delRemoteStreamStatsEvtInterval(e),clearTimeout(this._rttTimer[e.userId]),this._videoInWaiting[e.streamId]=!1,this._firstFrameStarted["".concat(e.streamId,"-audio")]&&(UL.rtcFirstFrame({event_type:nL.RECV_END,media_type:e.isScreen?iL.SCREEN_AUDIO:iL.AUDIO,type:oL.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-audio")],event_session_id:e.streamId,result:!1,reason:aL.UNSUBSCRIBE,stream_user_id:e.userId}),delete this._firstFrameStarted["".concat(e.streamId,"-audio")]),this._firstFrameStarted["".concat(e.streamId,"-video")]&&(UL.rtcFirstFrame({event_type:nL.RECV_END,media_type:e.isScreen?iL.SCREEN_VIDEO:iL.VIDEO,type:oL.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-video")],event_session_id:e.streamId,result:!1,reason:aL.UNSUBSCRIBE,stream_user_id:e.userId}),delete this._firstFrameStarted["".concat(e.streamId,"-video")])},e.prototype.getRemoteAudioStats=function(e,t){return Wf(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,p,f=this;return qf(this,(function(_){switch(_.label){case 0:return r={},n={timestamp:Date.now()},i=t.remoteStream,o=i.streamId,a=i.userId,s=i.isScreen,c=i.audioMid,u=i.hasAudio,d={media_type:"audio",direction:"down",stream_id:o,stream_user_id:a,vid:c,remote_muted:!u},e&&this._handler?(t.audioStart||(t.audioStart=ok(),UL.rtcFirstFrame({event_type:nL.BEGIN_RECV,media_type:s?iL.SCREEN_AUDIO:iL.AUDIO,type:oL.SUBSCRIBE,start:t.audioStart,event_session_id:o,stream_user_id:a}),u?this._firstFrameStarted["".concat(o,"-audio")]=t.audioStart:UL.rtcFirstFrame({event_type:nL.RECV_END,media_type:s?iL.SCREEN_AUDIO:iL.AUDIO,type:oL.PUBLISH,start:t.audioStart,event_session_id:o,result:!1,reason:aL.DISABLE,stream_user_id:a})),[4,this._handler.getStats(e)]):[2,r];case 1:return(l=_.sent()).length?(l.forEach((function(e){var i=e.type,c=e.packetsLost,u=e.packetsReceived,l=e.bytesReceived,h=e.jitterBufferDelay,p=e.jitterBufferEmittedCount,_=e.clockRate,v=e.channels,m=e.totalSamplesReceived,E=e.concealedSamples,g=e.concealmentEvents,S=e.totalRoundTripTime,y=e.state,b=e.currentRoundTripTime,T=e.audioLevel,I=e.totalAudioEnergy,R=e.totalSamplesDuration,A=e.mimeType,C=e.googDecodingNormal,O=e.fecPacketsReceived,N=e.availableIncomingBitrate,w=e.availableOutgoingBitrate,D=e.bytesSent,k=e.nominated,P=e.id,M=e.writable,U=e.jitter,L=e.candidateType,x=e.ip,V=e.address,B=e.networkType,j=e.port,F=e.protocol,G=e.audioOutputLevel,H=e.requestsReceived,z=e.responsesReceived,K=e.requestsSent,Y=e.consentRequestsSent,X=e.responsesSent,W=e.ssrc,q=e.kind;"inbound-rtp"===i?(n.packetsLost=c,n.packetsReceived=u,d.packets=u,n.bytesReceived=l,d.bytes=l,void 0!==h&&(r.jitterBufferDelay=h/p*1e3,d.jitter_buffer_delay=r.jitterBufferDelay),void 0!==m&&(n.totalSamplesReceived=m,r.concealedSamples=E,n.concealedSamples=E,d.concealed_samples=E,r.concealmentEvents=g,d.total_samples_received=m),void 0!==O&&(d.fec_packets_received=O),d.jitter=1e3*U,d.ssrc=W,m>0&&f._firstFrameStarted["".concat(o,"-audio")]&&(UL.rtcFirstFrame({event_type:nL.RECV_END,media_type:s?iL.SCREEN_AUDIO:iL.AUDIO,type:oL.SUBSCRIBE,event_session_id:o,result:!0,start:t.audioStart,stream_user_id:a}),delete f._firstFrameStarted["".concat(o,"-audio")])):"codec"===i?(r.recordSampleRate=_,v&&(r.numChannels=v),d.codec=A):"candidate-pair"===i?(d.ice_available_incoming_bitrate=N,d.ice_available_outgoing_bitrate=w,d.ice_bytes_received=l,d.ice_bytes_sent=D,d.ice_nominated=+k,d.ice_pair_id=P,d.ice_pair_rtt=b,d.rtt=1e3*b,d.ice_pair_state=y,d.ice_pair_writable=M,d.recv_ping_requests=H,d.recv_ping_responses=z,d.sent_ping_requests_before_first_response=K,d.sent_ping_requests_total=K+(Y||0),d.sent_ping_responses=X,"succeeded"===y&&(r.rtt=1e3*b,r.total_rtt=1e3*S)):"track"===i&&"audio"===q?(d.audio_level=-10*Math.log10(Math.pow(T,2)),d.volume=255*T,d.total_audio_energy=I,d.total_samples_duration=R):"ssrc"===i?(d.decoding_normal=C,d.recv_level=G):"local-candidate"===i?(d.local_candidate_type=L,d.local_ip=x||V,d.local_network_type=B,d.local_port=j,d.protocol=F):"remote-candidate"===i&&(d.remote_candidate_type=L,d.remote_ip=x||V,d.remote_port=j)})),(h=t.audio).timestamp?(r.audioLossRate=(n.packetsLost-h.packetsLost)/(n.packetsReceived-h.packetsReceived+(n.packetsLost-h.packetsLost)),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,d.packets_lost=Math.round(n.packetsLost-h.packetsLost),d.fraction_lost=r.audioLossRate,d.packets_lost_rate=r.audioLossRate,r.statsInterval=n.timestamp-h.timestamp,r.receivedKBitrate=(n.bytesReceived-h.bytesReceived||0)/r.statsInterval,d.bitrate=Math.round(8e3*r.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),void 0!==n.concealedSamples&&(d.interval_concealed_samples=n.concealedSamples-h.concealedSamples,d.interval_samples_received=n.totalSamplesReceived-h.totalSamplesReceived,r.receivedSampleRate=1e3*d.interval_samples_received/r.statsInterval),t.audio=n,this.dataChannelRTT[t.remoteStream.userId]&&(p=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=p+(r.jitterBufferDelay||0),d.web_e2e_delay=r.e2eDelay,d.total_rtt_ms=p),t.remoteStream.subAudio&&UL.rtcMediaStatistics(d,{}),[2,r]):(t.audio=n,[2,r])):[2,r]}}))}))},e.prototype.getRemoteVideoStats=function(e,t){return Wf(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,p,f=this;return qf(this,(function(_){switch(_.label){case 0:return r={},n={timestamp:Date.now()},i=t.remoteStream,o=i.streamId,a=i.userId,s=i.isScreen,c=i.hasVideo,u={media_type:"video",direction:"down",stream_id:o,stream_user_id:a,vid:t.remoteStream.videoMid,remote_muted:!c},e&&this._handler?(t.videoStart||(t.videoStart=ok(),UL.rtcFirstFrame({event_type:nL.BEGIN_RECV,media_type:s?iL.SCREEN_VIDEO:iL.VIDEO,type:oL.SUBSCRIBE,start:t.videoStart,event_session_id:o,stream_user_id:a}),c?this._firstFrameStarted["".concat(o,"-video")]=t.videoStart:UL.rtcFirstFrame({event_type:nL.RECV_END,media_type:s?iL.SCREEN_VIDEO:iL.VIDEO,type:oL.PUBLISH,start:t.videoStart,event_session_id:o,result:!1,reason:aL.DISABLE,stream_user_id:a})),[4,this._handler.getStats(e)]):[2,r];case 1:return(d=_.sent()).length?(d.forEach((function(e){var i=e.type,c=e.frameHeight,d=e.frameWidth,l=e.packetsLost,h=e.packetsReceived,p=e.bytesReceived,_=e.framesDecoded;e.roundTripTime;var v=e.jitterBufferDelay,m=e.jitterBufferEmittedCount,E=e.mimeType,g=e.firCount,S=e.availableIncomingBitrate,y=e.availableOutgoingBitrate,b=e.bytesSent,T=e.nominated,I=e.id,R=e.currentRoundTripTime,A=e.state,C=e.writable,O=e.candidateType,N=e.ip,w=e.address,D=e.networkType,k=e.port,P=e.nackCount,M=e.pliCount,U=e.protocol,L=e.requestsReceived,x=e.responsesReceived,V=e.requestsSent,B=e.consentRequestsSent,j=e.responsesSent,F=e.ssrc;e.totalRoundTripTime;var G=e.kind,H=e.jitter,z=e.framesReceived,K=e.keyFramesDecoded,Y=e.totalDecodeTime,X=e.decoderImplementation,W=e.lastPacketReceivedTimestamp;"inbound-rtp"===i?(n.packetsLost=l,u.packets_lost=l,n.packetsReceived=h,u.packets=h,n.bytesReceived=p,u.bytes=p,n.framesDecoded=_,void 0!==v&&(n.jitterBufferDelay=v/m*1e3,u.jitter_buffer_delay=n.jitterBufferDelay),u.fir_count=g,u.nack_count=P,u.pli_count=M,u.ssrc=F,u.jitter=H,u.frames_received=z,u.frames_decoded=_,u.key_frames_decoded=K,u.total_decode_time=Y,u.decoder_implementation=X,u.last_packet_received_timestamp=W,_>0&&f._firstFrameStarted["".concat(o,"-video")]&&(UL.rtcFirstFrame({event_type:nL.RECV_END,media_type:s?iL.SCREEN_VIDEO:iL.VIDEO,type:oL.SUBSCRIBE,event_session_id:o,result:!0,start:t.videoStart,stream_user_id:a}),delete f._firstFrameStarted["".concat(o,"-video")])):"track"===i&&"video"===G?(r.width=d,u.frame_size_width=d,r.height=c,u.frame_size_height=c,void 0!==z&&(u.frames_received=z)):"codec"===i?u.codec=E:"candidate-pair"===i?(u.ice_available_incoming_bitrate=S,u.ice_available_outgoing_bitrate=y,u.ice_bytes_received=p,u.ice_bytes_sent=b,u.ice_nominated=+T,u.ice_pair_id=I,u.ice_pair_rtt=R,u.rtt=1e3*R,r.rtt=u.rtt,u.ice_pair_state=A,u.ice_pair_writable=C,u.recv_ping_requests=L,u.recv_ping_responses=x,u.sent_ping_requests_before_first_response=V,u.sent_ping_requests_total=V+(B||0),u.sent_ping_responses=j):"local-candidate"===i?(u.local_candidate_type=O,u.local_ip=N||w,u.local_network_type=D,u.local_port=k,u.protocol=U):"remote-candidate"===i&&(u.remote_candidate_type=O,u.remote_ip=N||w,u.remote_port=k)})),l=t.video,h=t.remoteStream,l.timestamp?(r.videoLossRate=(n.packetsLost-l.packetsLost)/(n.packetsReceived-l.packetsReceived+(n.packetsLost-l.packetsLost)),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,u.fraction_lost=r.videoLossRate,u.packets_lost_rate=r.videoLossRate,r.statsInterval=n.timestamp-l.timestamp,r.receivedKBitrate=(n.bytesReceived-l.bytesReceived||0)/r.statsInterval,u.bitrate=Math.round(8e3*r.receivedKBitrate),u.bandwidth=Math.round(u.bitrate/1024),r.decoderOutputFrameRate=1e3*(n.framesDecoded-l.framesDecoded)/r.statsInterval,u.frame_rate_decoded=Math.round(r.decoderOutputFrameRate),u.frame_rate_received=u.frame_rate_decoded,t.video=n,this.dataChannelRTT[t.remoteStream.userId]&&(p=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=p+(n.jitterBufferDelay||0),u.web_e2e_delay=r.e2eDelay,u.total_rtt_ms=p),h.subVideo&&(this.processStall(h,u),UL.rtcMediaStatistics(u,{})),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.processStall=function(e,t){var r=0,n=0,i=0;e.recordedVideoFrames.forEach((function(e){e.isStall&&(r+=e.stallCount,n+=e.stallDuration),i=e.playTime})),e.recordedVideoFrames.length||(n=2e3,r=this._videoInWaiting[e.streamId]?0:1,this._videoInWaiting[e.streamId]=!0);var o=e.recordedVideoFrames.pop();o&&(o.isStall?this._videoInWaiting[e.streamId]=!0:this._videoInWaiting[e.streamId]=!1),e.recordedVideoFrames=[],t.stall_count=r,t.stall_duration=n,t.play_time=i},e.prototype.setLocalStreamStatsEvtInterval=function(e){var t,r,n=this,i={audio:{},video:{},localStream:e,firstframeReported:!1},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,i),this.getVideoStats(a,i),this.delLocalStreamStatsEvtInterval(e);this._localStreamStasEvtIntervals[e.streamId]=setInterval((function(){return Wf(n,void 0,void 0,(function(){var t;return qf(this,(function(r){switch(r.label){case 0:return[4,Wf(n,void 0,void 0,(function(){var t,r,n,o,a,s;return qf(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,i)];case 1:return n=c.sent(),[4,this.getVideoStats(r,i)];case 2:return(o=c.sent()).isScreen=e.isScreen,[2,{audioStats:n,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),this._firstFrameStarted["".concat(e.streamId,"-audio")]&&(UL.rtcFirstFrame({event_type:nL.SENT_END,media_type:e.isScreen?iL.SCREEN_AUDIO:iL.AUDIO,type:oL.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-audio")],event_session_id:e.streamId,result:!1,reason:aL.UNPUBLISH}),delete this._firstFrameStarted["".concat(e.streamId,"-audio")]),this._firstFrameStarted["".concat(e.streamId,"-video")]&&(UL.rtcFirstFrame({event_type:nL.SENT_END,media_type:e.isScreen?iL.SCREEN_VIDEO:iL.VIDEO,type:oL.PUBLISH,start:this._firstFrameStarted["".concat(e.streamId,"-video")],event_session_id:e.streamId,result:!1,reason:aL.UNPUBLISH}),delete this._firstFrameStarted["".concat(e.streamId,"-video")])},e.prototype.getAudioStats=function(e,t){return Wf(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l=this;return qf(this,(function(h){switch(h.label){case 0:return r={},n={timestamp:Date.now()},i=t.localStream,o=i.streamId,a=i.audioMid,s=i.isScreen,c={media_type:"audio",direction:"up",stream_id:o,vid:a},e&&this._handler?(t.audioStart||(t.audioStart=ok(),UL.rtcFirstFrame({event_type:nL.BEGIN_SEND,media_type:s?iL.SCREEN_AUDIO:iL.AUDIO,type:oL.PUBLISH,start:t.audioStart,event_session_id:o}),this._firstFrameStarted["".concat(o,"-audio")]=t.audioStart),[4,this._handler.getStats(e)]):[2,r];case 1:return(u=h.sent()).length?(u.forEach((function(e){var i=e.type,a=e.packetsSent,u=e.packetsLost,d=e.bytesSent,h=e.clockRate,p=e.roundTripTime,f=e.channels,_=e.audioLevel,v=e.googRtt,m=e.mimeType,E=e.availableIncomingBitrate,g=e.availableOutgoingBitrate,S=e.bytesReceived,y=e.nominated,b=e.id,T=e.currentRoundTripTime,I=e.state,R=e.writable,A=e.requestsReceived,C=e.responsesReceived,O=e.requestsSent,N=e.consentRequestsSent,w=e.responsesSent,D=e.jitter,k=e.candidateType,P=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.nackCount,B=e.retransmittedBytesSent,j=e.retransmittedPacketsSent,F=e.roundTripTimeMeasurements,G=e.audioInputLevel,H=e.ssrc,z=e.totalAudioEnergy,K=e.totalSamplesDuration,Y=e.mediaType;"outbound-rtp"===i?(n.packetsSent=a,a>0&&l._firstFrameStarted["".concat(o,"-audio")]&&(UL.rtcFirstFrame({event_type:nL.SENT_END,media_type:s?iL.SCREEN_AUDIO:iL.AUDIO,type:oL.PUBLISH,event_session_id:o,result:!0,start:t.audioStart}),delete l._firstFrameStarted["".concat(o,"-audio")]),n.bytesSent=d,c.bytes=d,c.packets=a,c.nack_count=V,c.ssrc=H,c.retransmitted_bytes_sent=B,c.retransmitted_packets_sent=j):"remote-inbound-rtp"===i?(n.packetsLost=u,c.packets_lost=u,c.jitter=1e3*D,r.rtt=1e3*p,c.rtt=r.rtt,c.round_trip_time_measurements=F):"codec"===i?(r.recordSampleRate=h,r.numChannels=f,c.codec=m):"media-source"===i?(c.audio_level=-10*Math.log10(Math.pow(_,2)),c.volume=255*_,c.total_audio_energy=z,c.total_samples_duration=K):"ssrc"===i&&"audio"===Y?(c.audio_network_elapse=v,c.send_level=G):"candidate-pair"===i?(c.ice_available_incoming_bitrate=E,c.ice_available_outgoing_bitrate=g,c.ice_bytes_received=S,c.ice_bytes_sent=d,c.ice_nominated=+y,c.ice_pair_id=b,c.ice_pair_rtt=T,c.ice_pair_state=I,c.ice_pair_writable=R,c.recv_ping_requests=A,c.recv_ping_responses=C,c.sent_ping_requests_before_first_response=O,c.sent_ping_requests_total=O+(N||0),c.sent_ping_responses=w):"local-candidate"===i?(c.local_candidate_type=k,c.local_ip=P||M,c.local_network_type=U,c.local_port=L,c.protocol=x):"remote-candidate"===i&&(c.remote_candidate_type=k,c.remote_ip=P||M,c.remote_port=L)})),(d=t.audio).timestamp?(void 0!==n.packetsLost&&(r.audioLossRate=(n.packetsLost-d.packetsLost)/(n.packetsSent-d.packetsSent),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,c.fraction_lost=r.audioLossRate),r.statsInterval=n.timestamp-d.timestamp,r.sentKBitrate=(n.bytesSent-d.bytesSent||0)/r.statsInterval,c.bitrate=Math.round(8e3*r.sentKBitrate),c.bandwidth=Math.round(c.bitrate/1024),t.audio=n,UL.rtcMediaStatistics(c,{}),[2,r]):(t.audio=n,[2,r])):[2,r]}}))}))},e.prototype.getVideoStats=function(e,t){return Wf(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l=this;return qf(this,(function(h){switch(h.label){case 0:return r={},n={timestamp:Date.now()},i=t.localStream,o=i.streamId,a=i.videoMid,s=i.isScreen,c={media_type:"video",direction:"up",stream_id:o,vid:a},e&&this._handler?(t.videoStart||(t.videoStart=ok(),UL.rtcFirstFrame({event_type:nL.BEGIN_SEND,media_type:s?iL.SCREEN_VIDEO:iL.VIDEO,type:oL.PUBLISH,start:t.videoStart,event_session_id:o}),this._firstFrameStarted["".concat(o,"-video")]=t.videoStart),[4,this._handler.getStats(e)]):[2,r];case 1:return(u=h.sent()).length?(u.forEach((function(e){var i=e.type,a=e.framesEncoded,u=e.packetsLost,d=e.bytesSent,h=e.framesSent,p=e.roundTripTime,f=e.mimeType,_=e.frameWidth,v=e.frameHeight,m=e.clockRate,E=e.packetsSent,g=e.googActualEncBitrate,S=e.googAvailableReceiveBandwidth,y=e.googAvailableSendBandwidth,b=e.googAvgEncodeMs,T=e.googBucketDelay,I=e.googEncodeUsagePercent,R=e.googFrameRateInput,A=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesReceived,N=e.nominated,w=e.id,D=e.currentRoundTripTime,k=e.state,P=e.writable,M=e.candidateType,U=e.ip,L=e.address,x=e.networkType,V=e.port,B=e.nackCount,j=e.pliCount,F=e.protocol,G=e.qpSum,H=e.requestsReceived,z=e.responsesReceived,K=e.googRetransmitBitrate,Y=e.requestsSent,X=e.consentRequestsSent,W=e.responsesSent,q=e.ssrc,J=e.googTargetEncBitrate,Z=e.googTransmitBitrate,$=e.googRtt,Q=e.retransmittedPacketsSent,ee=e.encoderImplementation,te=e.jitter;"outbound-rtp"===i?(n.framesEncoded=a,n.bytesSent=d,c.bytes=d,n.packetsSent=E,c.packets=E,c.nack_count=B,c.pli_count=j,c.qp_sum=G,c.ssrc=q,c.retransmitted_packets_sent=Q,c.encoder_implementation=ee):"track"===i?(h&&(n.framesSent=h,h>0&&l._firstFrameStarted["".concat(o,"-video")]&&(t.firstframeVideoReported=!0,UL.rtcFirstFrame({event_type:nL.SENT_END,media_type:s?iL.SCREEN_VIDEO:iL.VIDEO,type:oL.PUBLISH,start:t.videoStart,event_session_id:o,result:!0}),delete l._firstFrameStarted["".concat(o,"-video")])),r.encodedFrameWidth=_,r.encodedFrameHeight=v,c.frame_size_height=v,c.frame_size_width=_):"remote-inbound-rtp"===i?(n.packetsLost=u,r.rtt=1e3*p,c.rtt=r.rtt,c.jitter=te,c.packets_lost=u):"codec"===i?(r.codecType=f,c.codec=f,r.inputFrameRate=m):"candidate-pair"===i?(c.ice_available_incoming_bitrate=A,c.ice_available_outgoing_bitrate=C,c.ice_bytes_received=O,c.ice_bytes_sent=d,c.ice_nominated=+N,c.ice_pair_id=w,c.ice_pair_rtt=D,c.ice_pair_state=k,c.ice_pair_writable=P,c.recv_ping_requests=H,c.recv_ping_responses=z,c.sent_ping_requests_before_first_response=Y,c.sent_ping_requests_total=Y+X,c.sent_ping_responses=W):"local-candidate"===i?(c.local_candidate_type=M,c.local_ip=U||L,c.local_network_type=x,c.local_port=V,c.protocol=F):"remote-candidate"===i?(c.remote_candidate_type=M,c.remote_ip=U||L,c.remote_port=V):"VideoBwe"===i?(c.actual_enc_bitrate=g,c.available_receive_bandwidth=S,c.available_send_bandwidth=y,c.bucket_delay=T,c.retransmit_bitrate=K,c.target_enc_bitrate=J,c.transmit_bitrate=Z):"ssrc"===i&&(c.video_network_elapse=$,c.avg_encode_ms=b,c.encode_usage_percent=I,c.frame_rate_input=R)})),(d=t.video).timestamp?(r.statsInterval=n.timestamp-d.timestamp,r.encodedFrameCount=void 0!==n.framesSent?n.framesSent-d.framesSent:n.framesEncoded-d.framesEncoded,r.sentKBitrate=(n.bytesSent-d.bytesSent||0)/r.statsInterval,c.bitrate=Math.round(8e3*r.sentKBitrate),c.bandwidth=Math.round(c.bitrate/1024),r.encoderOutputFrameRate=1e3*(n.framesEncoded-d.framesEncoded)/r.statsInterval,c.frame_rate_encoded=Math.round(r.encoderOutputFrameRate),r.sentFrameRate=1e3*r.encodedFrameCount/r.statsInterval,c.frame_rate_sent=Math.round(r.sentFrameRate),r.videoLossRate=(n.packetsLost-d.packetsLost)/(n.packetsSent-d.packetsSent),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,c.fraction_lost=r.videoLossRate,t.video=n,UL.rtcMediaStatistics(c,{}),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.getDataChannelRTT=function(e){var t,r=this,n=ok();null===(t=this._client.sendUserMessage(e,"__web__rtc__rtt__"))||void 0===t||t.then((function(t){if("timeout"!==t){var i=Date.now()-n;i>0&&i<2e3&&(r.dataChannelRTT[e]=i)}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])})),this._rttTimer={},this.dataChannelRTT={},this._videoInWaiting={}},e}(),Gx=new wk("MediaServerClient",2),Hx=5e3;!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(jx||(jx={}));var zx=function(e,t){Gx.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)},Kx=function(e){function t(){var t=e.call(this)||this;return t._ontrackCallbackMap=new Map,t._pubSubLock=new xx("pubSubLock"),t._joinLeaveLock=new xx("joinLeaveLock"),t._state=jx.DISCONNECTED,t._roomAttributes={multiChatMode:!1,bigRoomMode:!1},t}return Cf(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){Gx.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(RL.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[IL.ON_ADD_STREAM,IL.ON_REMOVE_STREAM,IL.USER_CONNECTION,IL.USER_DISCONNECTION,IL.ON_UPDATE_STREAM_ATTRIBUTES,IL.ON_UPDATE_ROOM_ATTRIBUTES,IL.ON_PUSH_TRACK,IL.ON_REMOVE_TRACK,IL.NODE_CHANGE,IL.ON_CUSTOM_MESSAGE,IL.USER_MESSAGE_RECEIVED,IL.USER_BINARY_MESSAGE_RECEIVED,IL.POST_PROCESSING_MESSAGE].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(){Gx.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(RL.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(RL.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.join=function(e,t,r,n){var i,o;return void 0===t&&(t={}),void 0===r&&(r=!1),Wf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,f=this;return qf(this,(function(_){switch(_.label){case 0:return Gx.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,r,n),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._sessionId=tk(),xL.setStats({rtc_session_id:this._sessionId}),this.connectionState=jx.CONNECTING,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),t.node?(a=t.node,FL("es.join.nodeChange",t),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return f.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new tx,[4,null===(i=this._iceConfigRequestManager)||void 0===i?void 0:i.getAccessNode(this._appId,this._roomId,this._clientId,QL.getDeviceId(),null==t?void 0:t.reason,this._prevICENode)];case 2:if(!(a=_.sent()))throw FL("es.join.getNodeFailed",""),new nD($w.ICE_SERVER_WRONG,"get ICE config failed");FL("es.join.getNodeSuccess",a),_.label=3;case 3:this._prevICENode=a,this._handler=new Mx,this._addHandlerEvents(),this._statsReport=new Fx(this,this._handler),Promise.resolve().then((function(){return f.emit("onEstablishConnectionHook")})),_.label=4;case 4:return _.trys.push([4,6,,7]),[4,this._handler.connect(a)];case 5:return s=_.sent(),Gx.print("join","establish peerConnection success"),[3,7];case 6:throw c=_.sent(),this.connectionState=jx.DISCONNECTED,new nD($w.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",c);case 7:return this._dataChannelSignal=new YL(s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[4,null===(o=this._handler)||void 0===o?void 0:o.getDefaultSdp()];case 8:u=_.sent(),d={Authorization:ck.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId,timestamp:Date.now(),controlMessage:n,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role},params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:eP.VERSION,deviceId:QL.getDeviceId(),appId:this._appId,roomId:this._roomId,userId:this._clientId,businessId:this._businessId},options:{enableUnBundleMode:!0,supportTokenExpireCallBack:!0},sdpInfo:u},Promise.resolve().then((function(){return f.emit("onSendingJoinMessageHook")})),_.label=9;case 9:return _.trys.push([9,11,,12]),l=r?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(l,d)];case 10:return h=_.sent(),Gx.print("join","send join message success"),this._authorization=d.Authorization,this.connectionState=jx.CONNECTED,[2,h];case 11:if(p=_.sent(),this.connectionState=jx.DISCONNECTED,705===(null==p?void 0:p.code))throw new nD($w.INVALID_TOKEN,(null==p?void 0:p.message)||"Invalid token");if(200!==(null==p?void 0:p.code))throw new nD($w.JOIN_ROOM_FAILED,(null==p?void 0:p.message)||"Join room failed");return[3,12];case 12:return[2]}}))}))},t.prototype.publish=function(e){var t,r,n,i,o,a,s,c;return Wf(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,E,g;return qf(this,(function(S){switch(S.label){case 0:Gx.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=ok(),h="",p="",f="",S.label=1;case 1:return S.trys.push([1,5,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e)];case 2:if(!(_=S.sent()))throw new nD($w.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===(n=null==d?void 0:d.getTrack())||void 0===n?void 0:n.enabled)},v={attributes:Yf({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}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("publish",v)];case 3:if(200!==(null==(m=S.sent())?void 0:m.code))throw new nD($w.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");return E=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,E,void 0,e,WU.UP)];case 4:return S.sent(),e.streamId=m.streamId,e.videoMid=p,e.audioMid=h,UL.rtcPublishStat(ZU.SUCCESS,$U.W_0,l,QU.UNKNOWN),null===(s=this._statsReport)||void 0===s||s.setLocalStreamStatsEvtInterval(e),[2];case 5:return(g=S.sent())instanceof Error&&UL.rtcPublishStat(ZU.FAIL,$U.W_0,l,g.message),h&&p?[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(f,[h,p])]:[3,7];case 6:S.sent(),S.label=7;case 7:throw g;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,r,n,i,o,a;return Wf(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f,_,v,m,E,g,S,y,b;return qf(this,(function(T){switch(T.label){case 0:Gx.print("updatePubTrack()","localStream: %o",e),s=e.videoTrack,c=e.audioTrack,null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack((null==s?void 0:s.getTrack())||null),c?(u=c.mixType,d=c.mixedAudioTrack,l=null==c?void 0:c.getTrack(),d&&u!==e_.PLAYOUT&&!0===l.enabled&&(l=d),null===(r=e.audioTransceiver)||void 0===r||r.sender.replaceTrack(l)):null===(n=e.audioTransceiver)||void 0===n||n.sender.replaceTrack(null),h={localaudio:!!c,localvideo:!!s,videostream:!!(null===(i=null==s?void 0:s.getTrack())||void 0===i?void 0:i.enabled),audiostream:!!(null===(o=null==c?void 0:c.getTrack())||void 0===o?void 0:o.enabled)},p={};try{for(f=Jf(Object.entries(h)),_=f.next();!_.done;_=f.next())v=Zf(_.value,2),m=v[0],(E=v[1])!==Reflect.get(e.pubAttributes,m)&&Reflect.set(p,m,E)}catch(e){y={error:e}}finally{try{_&&!_.done&&(b=f.return)&&b.call(f)}finally{if(y)throw y.error}}return Object.keys(p).length?(e.pubAttributes=h,g={roomId:this._roomId,streamId:e.streamId,attributes:p},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateStreamAttributes",g)]):[2];case 1:if(200!==(null==(S=T.sent())?void 0:S.code))throw new nD($w.UPDATE_TRACK_FAILED,(null==S?void 0:S.message)||"update track failed");return[2]}}))}))},t.prototype.unpublish=function(e){var t,r,n;return Wf(this,void 0,void 0,(function(){var i,o;return qf(this,(function(a){switch(a.label){case 0:return Gx.print("unpublish()","localStream: %o",e),i={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unpublish",i)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new nD($w.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===(n=this._statsReport)||void 0===n||n.unpublish(e),[2]}}))}))},t.prototype.subscribe=function(e,t,r){var n,i,o,a,s,c,u,d,l;return Wf(this,void 0,void 0,(function(){var h,p,f,_,v,m,E,g,S,y,b,T,I,R,A,C,O,N,w,D;return qf(this,(function(k){switch(k.label){case 0:if(e.hasSubscribed)return[2,this._updateSubTrack(e,t,r)];Gx.print("subscribe()","mediaType: %o, config: %o",t,r),zx("subscribe()",e),h=!1,p=!1,t===jf.VIDEO_ONLY?h=!0:t===jf.AUDIO_ONLY?p=!0:t===jf.AUDIO_AND_VIDEO?(h=!0,p=!0):t===jf.NONE&&(h=!1,p=!1),f=ok(),_=e.audioMid,v=e.videoMid,E=!1,k.label=1;case 1:return k.trys.push([1,12,,15]),_&&v?(E=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e,{audioMid:_,videoMid:v})]):[3,3];case 2:return m=k.sent(),[3,5];case 3:return[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e)];case 4:if(!(m=k.sent()))throw new nD($w.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,k.label=5;case 5:return g={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",g)];case 6:if(200!==(null==(S=k.sent())?void 0:S.code))throw new nD($w.SUBSCRIBE_FAILED,(null==S?void 0:S.message)||"subscribe failed");return y=[],b=!this._multiChatMode(),!(_&&v)&&y.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new nD($w.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),Hx);e.on("ontrack",(function r(i){"video"===i.mediaType&&(Gx.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),b&&y.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new nD($w.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),Hx);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(Gx.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),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==S?void 0:S.relayMessage,R=I.audioMid,A=I.videoMid,C=I.sequenceId,O=I.sdp,E&&_!==R?(Gx.print("subscribe","mid mot match",_,R),[4,null===(s=this._handler)||void 0===s?void 0:s.closeMLine([_,v])]):[3,9];case 7:return k.sent(),[4,null===(c=this._handler)||void 0===c?void 0:c.subscribe(e)];case 8:if(!(m=k.sent()))throw new nD($w.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,k.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,WU.DOWN)];case 10:return k.sent(),[4,Promise.all(y)];case 11:return k.sent(),this._multiChatMode()||(e.subAudio=p),e.subVideo=h,UL.rtcSubscribeStat(eL.SUCCESS,f,tL.UNKNOWN,e.userId),null===(d=this._statsReport)||void 0===d||d.setRemoteStreamStatsEvtInterval(e),[2];case 12:return(w=k.sent())instanceof Error&&UL.rtcSubscribeStat(eL.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:k.sent(),k.label=14;case 14:throw w;case 15:return[2]}}))}))},t.prototype.controlMessage=function(e){var t;return Wf(this,void 0,void 0,(function(){return qf(this,(function(r){switch(r.label){case 0:return Gx.print("controlMessage()","params: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",Yf(Yf({},e),{roomId:this._roomId}))];case 1:return r.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return Wf(this,void 0,void 0,(function(){return qf(this,(function(r){switch(r.label){case 0:return Gx.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 Wf(this,void 0,void 0,(function(){return qf(this,(function(n){return[2,this._updateSubTrack(e,t,r)]}))}))},t.prototype._updateSubTrack=function(e,t,r){var n;return Wf(this,void 0,void 0,(function(){var i,o,a,s;return qf(this,(function(c){switch(c.label){case 0:return Gx.print("updateSubTrack()","mediaType: %o, config: %o",t,r),zx("updateSubTrack()",e),i=!1,o=!1,t===jf.VIDEO_ONLY?(i=!0,o=!1):t===jf.AUDIO_ONLY?(o=!0,i=!1):t===jf.AUDIO_AND_VIDEO?(i=!0,o=!0):t===jf.NONE&&(i=!1,o=!1),a={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:i,audio:!!this._multiChatMode()||o},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",a)];case 1:if(200!==(null==(s=c.sent())?void 0:s.code))throw new nD($w.UPDATE_TRACK_FAILED,(null==s?void 0:s.message)||"update track failed");return e.paused=!i,this._multiChatMode()||(e.subAudio=o),e.subVideo=i,e.subMediaType=t,e.subConfig=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var r,n,i,o,a;return Wf(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f,_,v,m,E,g;return qf(this,(function(S){switch(S.label){case 0:if(Gx.print("subscribe4pushTrack()","streamInfo: %o",t),zx("subscribe4pushTrack()",e),s=null==t?void 0:t.message,c=s.audioMid,u=s.videoMid,d=s.sequenceId,l=s.sdp,e.subAudio=!0,d<e.sequenceId)return Gx.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];h=e.audioMid,p=e.videoMid,S.label=1;case 1:return S.trys.push([1,8,,11]),h&&p?[4,null===(r=this._handler)||void 0===r?void 0:r.subscribe(e,{audioMid:h,videoMid:p})]:[3,3];case 2:return f=S.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(f=S.sent()))throw new nD($w.ADD_TRANSCEIVER_FAILED,"add transceiver failed");h=f.audioMid,p=f.videoMid,S.label=5;case 5:return(g={})[h]=c,g[p]=u,_=g,Gx.print("onpushtrack midmap",e.userId,_),e.audioMid=c,e.videoMid=u,e.sequenceId=d,v=[],e.audioTrack||v.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new nD($w.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),Hx);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(Gx.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),m=function(t){e.ontrack(t)},null===(i=this._handler)||void 0===i||i.on("ontrack",m),this._ontrackCallbackMap.set(e,m),[4,null===(o=this._handler)||void 0===o?void 0:o.setAnswerSdp(null==f?void 0:f.sdp,l,_,e,WU.DOWN)];case 6:return S.sent(),[4,Promise.all(v)];case 7:return S.sent(),[2];case 8:return E=S.sent(),f?[4,null===(a=this._handler)||void 0===a?void 0:a.rollback(null==f?void 0:f.sdp,[h,p])]:[3,10];case 9:S.sent(),S.label=10;case 10:throw E;case 11:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var r;return Wf(this,void 0,void 0,(function(){return qf(this,(function(n){switch(n.label){case 0:return zx("unsubscribe4removeTrack()",e),Gx.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(Gx.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])]);case 1:return n.sent(),Gx.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),[2]}}))}))},t.prototype.unsubscribe=function(e){var t,r,n;return Wf(this,void 0,void 0,(function(){var i;return qf(this,(function(o){switch(o.label){case 0:zx("unsubscribe()",e),i={roomId:this._roomId,streamId:e.streamId,userId:e.userId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unsubscribe",i)];case 2:case 3:return o.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),e.subAudio?[3,6]:[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 5:o.sent(),Gx.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(n=this._statsReport)||void 0===n||n.unsubscribe(e),o.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 Wf(this,void 0,void 0,(function(){return qf(this,(function(r){return zx("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==TL.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this.unsubscribe(e),[2]}))}))},t.prototype.leave=function(){var e;return Wf(this,void 0,void 0,(function(){var t,r;return qf(this,(function(n){switch(n.label){case 0:return Gx.print("leave()"),(this.connectionState=jx.CONNECTED)?(this.connectionState=jx.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]):[3,7];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:case 4:return n.sent(),[3,6];case 5:return r(),[7];case 6:return[3,8];case 7:return[2,Promise.resolve()];case 8:return[2]}}))}))},t.prototype.destroy=function(){var e,t,r,n;Gx.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===(n=this._statsReport)||void 0===n||n.destroy(),this.connectionState=jx.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",{set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),Xf([Wx],t.prototype,"join",null),Xf([Xx,Yx],t.prototype,"publish",null),Xf([Xx,Yx],t.prototype,"updatePubTrack",null),Xf([Xx,Yx],t.prototype,"unpublish",null),Xf([Xx,Yx],t.prototype,"subscribe",null),Xf([Yx],t.prototype,"controlMessage",null),Xf([Yx],t.prototype,"updateUserAttributes",null),Xf([Xx,Yx],t.prototype,"updateSubTrack",null),Xf([Xx,Yx],t.prototype,"subscribe4pushTrack",null),Xf([Xx,Yx],t.prototype,"unsubscribe4removeTrack",null),Xf([Xx,Yx],t.prototype,"unsubscribe",null),Xf([Xx,Yx],t.prototype,"handleRemoveStream",null),t}(kk);function Yx(e,t,r){var n=r.value;return r.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Wf(this,void 0,void 0,(function(){return qf(this,(function(r){switch(r.label){case 0:return this._handler&&this._state===jx.CONNECTED?[4,n.apply(this,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:throw new nD($w.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},r}function Xx(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Wf(this,void 0,void 0,(function(){var t;return qf(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,n.apply(this,e)];case 3:return[2,r.sent()];case 4:return t(),[7];case 5:return[2]}}))}))},r}function Wx(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Wf(this,void 0,void 0,(function(){var t,r=this;return qf(this,(function(i){return t=!1,[2,new Promise((function(i,o){return Wf(r,void 0,void 0,(function(){var r,a;return qf(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new nD($w.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.apply(this,e)];case 2:return r=s.sent(),i(r),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},r}var qx=I,Jx=nc,Zx=Im.exports.getWeakData,$x=Pt,Qx=G,eV=lc,tV=Yc,rV=xe,nV=Or.set,iV=Or.getterFor,oV=ba.find,aV=ba.findIndex,sV=qx([].splice),cV=0,uV=function(e){return e.frozen||(e.frozen=new dV)},dV=function(){this.entries=[]},lV=function(e,t){return oV(e.entries,(function(e){return e[0]===t}))};dV.prototype={get:function(e){var t=lV(this,e);if(t)return t[1]},has:function(e){return!!lV(this,e)},set:function(e,t){var r=lV(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=aV(this.entries,(function(t){return t[0]===e}));return~t&&sV(this.entries,t,1),!!~t}};var hV,pV={getConstructor:function(e,t,r,n){var i=e((function(e,i){eV(e,o),nV(e,{type:t,id:cV++,frozen:void 0}),null!=i&&tV(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=iV(t),s=function(e,t,r){var n=a(e),i=Zx($x(t),!0);return!0===i?uV(n).set(t,r):i[n.id]=r,e};return Jx(o,{delete:function(e){var t=a(this);if(!Qx(e))return!1;var r=Zx(e);return!0===r?uV(t).delete(e):r&&rV(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!Qx(e))return!1;var r=Zx(e);return!0===r?uV(t).has(e):r&&rV(r,t.id)}}),Jx(o,r?{get:function(e){var t=a(this);if(Qx(e)){var r=Zx(e);return!0===r?uV(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)}}),i}},fV=i,_V=I,vV=nc,mV=Im.exports,EV=hE,gV=pV,SV=G,yV=Dm,bV=Or.enforce,TV=or,IV=!fV.ActiveXObject&&"ActiveXObject"in fV,RV=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},AV=EV("WeakMap",RV,gV);if(TV&&IV){hV=gV.getConstructor(RV,"WeakMap",!0),mV.enable();var CV=AV.prototype,OV=_V(CV.delete),NV=_V(CV.has),wV=_V(CV.get),DV=_V(CV.set);vV(CV,{delete:function(e){if(SV(e)&&!yV(e)){var t=bV(this);return t.frozen||(t.frozen=new hV),OV(this,e)||t.frozen.delete(e)}return OV(this,e)},has:function(e){if(SV(e)&&!yV(e)){var t=bV(this);return t.frozen||(t.frozen=new hV),NV(this,e)||t.frozen.has(e)}return NV(this,e)},get:function(e){if(SV(e)&&!yV(e)){var t=bV(this);return t.frozen||(t.frozen=new hV),NV(this,e)?wV(this,e):t.frozen.get(e)}return wV(this,e)},set:function(e,t){if(SV(e)&&!yV(e)){var r=bV(this);r.frozen||(r.frozen=new hV),NV(this,e)?DV(this,e,t):r.frozen.set(e,t)}else DV(this,e,t);return this}})}var kV=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),!sk()&&t.refreshDevices(),t}return Cf(t,e),t.prototype.refreshDevices=function(){return Wf(this,void 0,void 0,(function(){var e,t=this;return qf(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 n;null===(n=t.deviceMap[r.kind])||void 0===n||n.set(r.deviceId,{deviceName:r.label||PV(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 Wf(this,void 0,void 0,(function(){return qf(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 Wf(this,void 0,void 0,(function(){var e,t,r=this;return qf(this,(function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=n.sent(),t=Array.from($f($f($f([],Zf(this.deviceMap.audioinput.values()),!1),Zf(this.deviceMap.videoinput.values()),!1),Zf(this.deviceMap.audiooutput.values()),!1)),e.forEach((function(t){var n=r.deviceMap[t.kind].get(t.deviceId),i={deviceName:t.label||PV(t,e),deviceType:t.kind,deviceId:t.deviceId,deviceInfo:t,deviceState:"active"};r.deviceMap[t.kind].set(t.deviceId,i),n&&"inactive"!==n.deviceState||r.emit("onMediaDeviceStateChanged",Yf({},i))})),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(n_.onMediaDeviceStateChanged,t))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return Wf(this,void 0,void 0,(function(){var e=this;return qf(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new nD($w.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 Wf(this,void 0,void 0,(function(){var e=this;return qf(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new nD($w.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 Wf(this,void 0,void 0,(function(){return qf(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($f($f($f([],Zf(this.deviceMap.audioinput.values()),!1),Zf(this.deviceMap.videoinput.values()),!1),Zf(this.deviceMap.audiooutput.values()),!1)).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getMicrophones=function(){return Wf(this,void 0,void 0,(function(){return qf(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 Wf(this,void 0,void 0,(function(){return qf(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 Wf(this,void 0,void 0,(function(){return qf(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 Wf(this,void 0,void 0,(function(){return qf(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 nD($w.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 nD($w.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(kk),PV=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},MV=new kV,UV=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}(),LV=function(){function e(e){var t=xV.getAudioContextInstance();this._track=e;var r=new MediaStream;r.addTrack(e);var n=t.createMediaStreamSource(r),i=t.createAnalyser();n.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}(),xV=new UV,VV=new wk("VERTC",0),BV=new WeakMap,jV=function(e){return BV.get(e)},FV=function(e){function t(t,r){var n=e.call(this)||this;return n._trackId=t,n.mediaType=r,n}return Cf(t,e),t.prototype.getId=function(){return this._trackId},t}(kk),GV=function(e){function t(t,r,n){var i=e.call(this,r,n)||this;return i._mediaTrack=t,i._initListeners(),i}return Cf(t,e),t.prototype.getTrack=function(){return this._mediaTrack},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(){UL.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(FV),HV=function(e){function t(t,r,n){var i=e.call(this,r,n)||this;return i._mediaTrack=t,i}return Cf(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(FV),zV=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Cf(t,e),t.prototype.updateVideoCaptureConfig=function(){var e;return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig?(VV.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}(GV),KV=function(e){function t(t,r){var n=e.call(this,t,r,"audio")||this;return n.mixType=e_.PLAYOUT_AND_PUBLISH,n}return Cf(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new LV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(VV.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}(GV),YV=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Cf(t,e),t}(HV),XV=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 LV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(HV),WV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(KV),qV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(zV),JV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(zV),ZV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(KV),$V=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(zV),QV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(KV);function eB(e){var t;return Wf(this,void 0,void 0,(function(){var r,n,i,o,a,s;return qf(this,(function(c){switch(c.label){case 0:n=(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]),VV.print("createCameraVideoTrack","constraints:",e),UL.rtcVideoCaptureEvent({event_type:_L.START,media_device_id:n}),i=ok(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return r=c.sent(),UL.rtcVideoCaptureEvent({event_type:_L.START_CAPTURE_RESULT,media_device_id:n,reason:mL.SUCCESS,elapse:ok()-i}),MV.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),UL.rtcVideoCaptureEvent({event_type:_L.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new nD($w.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getVideoTracks()[0],BV.set(a,r),(s=new qV(a,ik())).videoCaptureConfig=e,[2,s]}}))}))}function tB(e){var t;return Wf(this,void 0,void 0,(function(){var r,n,i,o,a;return qf(this,(function(s){switch(s.label){case 0:VV.print("createCameraVideoTrack","constraints:",e),n=(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]),UL.rtcVideoCaptureEvent({event_type:_L.START,media_device_id:n}),i=ok(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=s.sent(),UL.rtcVideoCaptureEvent({event_type:_L.START_CAPTURE_RESULT,media_device_id:n,reason:mL.SUCCESS,elapse:ok()-i}),MV.hasAudioPermission=!0,[3,4];case 3:throw o=s.sent(),UL.rtcVideoCaptureEvent({event_type:_L.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new nD($w.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getAudioTracks()[0],BV.set(a,r),[2,new WV(a,ik())]}}))}))}function rB(e){return void 0===e&&(e=!1),Wf(this,void 0,void 0,(function(){var t,r,n;return qf(this,(function(i){switch(i.label){case 0:VV.print("createScreenStream","withAudio:",e),i.label=1;case 1:return i.trys.push([1,3,,4]),UL.rtcVideoCaptureEvent({event_type:_L.START,media_device_id:"screen"}),r=ok(),[4,navigator.mediaDevices.getDisplayMedia({video:!0,audio:e})];case 2:return t=i.sent(),UL.rtcVideoCaptureEvent({event_type:_L.START_CAPTURE_RESULT,media_device_id:"screen",reason:mL.SUCCESS,elapse:ok()-r}),[3,4];case 3:throw n=i.sent(),UL.rtcVideoCaptureEvent({event_type:_L.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.message}),new nD($w.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,t]}}))}))}var nB,iB,oB=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=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,o=i;i<t.length-4;){var a=new Uint8Array(t.buffer.slice(i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(i+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),i=o}return r},e.getAvccNals=function(t){for(var r=[];t.position<t.length-4;){var n=t.getInt32(t.position);if(!(t.length-t.position>=n))break;var i=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+n));t.skip(n);var a={header:i,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,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{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 n=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),n),n+=2,r.set(e,n),r[n+=e.byteLength]=1,n++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),n),n+=2,r.set(t,n),r},e}(),aB=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),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)},e.readByte=function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n},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}(),sB=new wk("Stream",0),cB=function(){function e(){this.isScreen=!1,this.seiList=[],this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!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(wx()){var r=t.createEncodedStreams(),n=r.readable,i=r.writable,o=new TransformStream({transform:function(t,r){var n=e.seiList[0];if(n){var i=new Uint8Array(n.content.byteLength+5);i.set([0,0,0,1,6]),i.set(n.content,5);var o=new Uint8Array(i.byteLength+t.data.byteLength);0===n.repeatCount&&e.seiList.splice(0,1),n.repeatCount--,o.set(new Uint8Array(t.data)),o.set(i,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else sB.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 sB.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0},e.prototype.updateVideoBitrate=function(e){var t,r=null===(t=null==e?void 0:e[0])||void 0===t?void 0:t.maxKbps;if("number"==typeof r&&r&&this.videoTransceiver){var n=this.videoTransceiver.sender,i=n.getParameters();i.encodings&&0!==i.encodings.length||(i.encodings=[{}]),i.encodings[0].maxBitrate=1e3*r,sB.print("updateVideoBitrate","set sendEncodings: ",i),n.setParameters(i)}},e.prototype.switchTrackEnableState=function(e,t){var r;"audio"===e?r=this.audioTrack:"video"===e&&(r=this.videoTrack);var n=null==r?void 0:r.getTrack();return!(!n||(null==n?void 0:n.enabled)===t)&&(n.enabled=t,!0)},e}(),uB=function(e){function t(t,r,n,i){var o=e.call(this)||this;return o.userId=t,o.isScreen=n,o.streamId=r,o.hasAudio=i.localaudio,o.hasVideo=i.localvideo,o._attributes=i,o.subVideo=!1,o.subAudio=!1,o._sequenceId=0,o.subMediaType=jf.NONE,o.recordedVideoFrames=[],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,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){var n=oB.getNalunits(new aB(t.data)).find((function(e){return e.sei}));n&&e.safeEmit("onSEIMessage",n.body.slice(1)),r.enqueue(t)}})).pipeTo(n)}else sB.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 sB.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,r,n;if((null===(r=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===r?void 0:r.id)===this.streamId){var i=e.track;"video"===(null==i?void 0:i.kind)?this._setVideoTrack(i):"audio"===(null===(n=e.track)||void 0===n?void 0:n.kind)&&this._setAudioTrack(i),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){sB.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=[],this.paused=!1,this._workaround_1_=!1},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 XV(e,ik()),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 YV(e,ik()),this.emit("ontrack",this.videoTrack))},t}(kk);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(nB||(nB={})),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_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error"}(iB||(iB={}));var dB=new wk("Room",1),lB=function(e){function t(t){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._userDuplicateLoginTimerMap=new Map,r._roomConfig=t,r._mediaServerClient=new Kx,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,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m=this;null===(e=this._mediaServerClient)||void 0===e||e.on(IL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(IL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(IL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(IL.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(IL.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(IL.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(IL.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(IL.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(IL.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(IL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(IL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(IL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(IL.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(RL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(RL.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on("onRemoteStreamStats",(function(e){m.emit(iB.ON_REMOTE_STREAM_STATS,e)})),null===(v=this._mediaServerClient)||void 0===v||v.on("onLocalStreamStats",(function(e){m.emit(iB.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,n,i){return Wf(this,void 0,void 0,(function(){var o=this;return qf(this,(function(a){return xL.setStats({rtc_app_id:e,room_id:t,user_id:n.userId}),dB.print("join()"),[2,new Promise((function(a,s){return Wf(o,void 0,void 0,(function(){var o;return qf(this,(function(c){return this._joinResolveCallback=a,this._joinRejectCallback=s,this._controlMessage=i,this._roomInfo={appId:e,roomId:t,token:r,userInfo:n},o=ok(),UL.joinRoom(uL.BEGIN,o,!1,""),this._join((function(e){UL.joinRoom(uL.END,o,!0,e.message),a(e)}),(function(e){UL.joinRoom(uL.END,o,!1,e.message),s(e)})),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,r){var n;return void 0===r&&(r=!1),Wf(this,void 0,void 0,(function(){var i,o,a;return qf(this,(function(s){switch(s.label){case 0:i=ok(),dB.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},r,this._controlMessage)];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===(n=this._roomInfo)||void 0===n?void 0:n.userInfo),this._isReconnecting=!1,UL.rtcJoinRoom(0,"web","web",ok()-i),this._onJoinSucc(o,r),[3,4];case 3:return(a=s.sent()).code!==$w.OPERATION_CANCEL&&"function"==typeof t?[2,t(a)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,r){return Wf(this,void 0,void 0,(function(){return qf(this,(function(n){switch(n.label){case 0:return dB.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new cB,this._localScreenStream.isScreen=!0),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=r,this._localScreenStream.videoEncodeConfig=e,this._localScreenStream.hasPublished?[3,2]:[4,this._mediaServerClient.publish(this._localScreenStream)];case 1:return n.sent(),[3,4];case 2:return[4,this.updatePubScreenTrack()];case 3:n.sent(),n.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return Wf(this,void 0,void 0,(function(){return qf(this,(function(e){switch(e.label){case 0:return dB.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(){return Wf(this,void 0,void 0,(function(){return qf(this,(function(e){switch(e.label){case 0:return dB.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?[4,this._mediaServerClient.unpublish(this._localScreenStream)]:[3,2];case 1:e.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.controlMessage=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){switch(t.label){case 0:return dB.print("controlMessage","Invoke controlMessage"),this._controlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),"stopped"===e.action&&delete this._controlMessage,[2]}}))}))},t.prototype.updateUserAttributes=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){switch(t.label){case 0:return dB.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){return Wf(this,void 0,void 0,(function(){var n;return qf(this,(function(i){switch(i.label){case 0:if(dB.print("publish","Invoke publish"),this._localStream||(this._localStream=new cB),this._localStream.videoTrack=t,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.hasPublished)return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._mediaServerClient.publish(this._localStream)];case 2:return i.sent(),this.emit(iB.ON_PUBLISH_RESULT,{isScreen:!1,state:Uf.PUBLISH_SUCC}),[3,4];case 3:throw n=i.sent(),this.emit(iB.ON_PUBLISH_RESULT,{isScreen:!1,state:Uf.PUBLISH_FAIL}),n;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:i.sent(),i.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return Wf(this,void 0,void 0,(function(){return qf(this,(function(e){switch(e.label){case 0:return dB.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 Wf(this,void 0,void 0,(function(){return qf(this,(function(e){switch(e.label){case 0:return dB.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 Wf(this,void 0,void 0,(function(){return qf(this,(function(n){switch(n.label){case 0:return dB.print("subscribe","remoteStream %o",e),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){var n,i;return Wf(this,void 0,void 0,(function(){return qf(this,(function(o){return dB.print("updateSubTrack","Invoke updateSubTrack"),e.subMediaType===t&&(null===(n=null==e?void 0:e.subConfig)||void 0===n?void 0:n.videoIndex)===(null==r?void 0:r.videoIndex)?[2,Promise.resolve(e)]:[2,null===(i=this._mediaServerClient)||void 0===i?void 0:i.updateSubTrack(e,t,r)]}))}))},t.prototype.unsubscribe=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){switch(t.label){case 0:return dB.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.leave=function(){return Wf(this,void 0,void 0,(function(){var e,t;return qf(this,(function(r){switch(r.label){case 0:dB.print("leave","Invoke leave"),e=ok(),r.label=1;case 1:return r.trys.push([1,3,4,5]),clearTimeout(this._reconnectTimer),[4,this._mediaServerClient.leave()];case 2:return r.sent(),UL.rtcLeaveRoom(0,"",ok()-e),[3,5];case 3:return(t=r.sent())instanceof Error&&UL.rtcLeaveRoom(-1,t.message,ok()-e),[3,5];case 4:return this.destroy(),[7];case 5:return[2]}}))}))},t.prototype.destroy=function(){return Wf(this,void 0,void 0,(function(){return qf(this,(function(e){switch(e.label){case 0:return dB.print("destroy","Invoke destroy"),this.connectionState!==jx.CONNECTED?[3,2]:[4,this.leave()];case 1:e.sent(),e.label=2;case 2:return this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map,this._remoteStreams=new Map,this._localStream=void 0,this._localScreenStream=void 0,this._removeHandlerEventHandler(),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),[2]}}))}))},t.prototype.updateToken=function(e){dB.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e)},t.prototype.muteLocalTrack=function(e,t){var r,n;return Wf(this,void 0,void 0,(function(){var i,o;return qf(this,(function(a){switch(a.label){case 0:return this._localStream&&(null===(r=this._localStream)||void 0===r?void 0:r.hasPublished)?(i=t!==Pf.MUTE_STATE_OFF,(o=this._localStream.switchTrackEnableState(e,i))?[4,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updatePubTrack(this._localStream)]:[3,2]):[2,!1];case 1:a.sent(),a.label=2;case 2:return[2,o]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Wf(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return qf(this,(function(c){t=[];try{for(r=Jf(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())i=n.value,Array.isArray(i)&&i.forEach((function(r){if(r.hasSubscribed){var n=null;switch(e){case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===jf.AUDIO_ONLY?n=jf.NONE:r.subMediaType===jf.AUDIO_AND_VIDEO&&(n=jf.VIDEO_ONLY);break;case xf.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===jf.VIDEO_ONLY?n=jf.NONE:r.subMediaType===jf.AUDIO_AND_VIDEO&&(n=jf.AUDIO_ONLY);break;case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==jf.NONE&&(n=jf.NONE)}if(null!==n){var i=s.updateSubTrack(r,n,r.subConfig);i&&t.push(i)}}}))}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return Wf(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return qf(this,(function(c){t=[];try{for(r=Jf(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())i=n.value,Array.isArray(i)&&i.forEach((function(r){if(r.hasSubscribed){var n=null;switch(e){case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===jf.NONE?n=jf.AUDIO_ONLY:r.subMediaType===jf.VIDEO_ONLY&&(n=jf.AUDIO_AND_VIDEO);break;case xf.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===jf.NONE?n=jf.VIDEO_ONLY:r.subMediaType===jf.AUDIO_ONLY&&(n=jf.AUDIO_AND_VIDEO);break;case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==jf.AUDIO_AND_VIDEO&&(n=jf.AUDIO_AND_VIDEO)}if(null!==n){var i=s.updateSubTrack(r,n,r.subConfig);i&&t.push(i)}}}))}catch(e){o={error:e}}finally{try{n&&!n.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.sendRoomMessage=function(e,t){var r,n;return void 0===t&&(t=!1),Wf(this,void 0,void 0,(function(){var i,o;return qf(this,(function(a){switch(a.label){case 0:return i={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:t,message:""},t?(o=i,[4,ck.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:i.message=e,a.label=3;case 3:return[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(i)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){dB.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new Kx,this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var r,n,i,o,a,s=this;dB.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=Jf(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&&(n=h.return)&&n.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 _=Jf(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:TL.clientDisconnected})}))}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=_.return)&&o.call(_)}finally{if(i)throw i.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)})),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 n=Jf(this._remoteStreams.values()),i=n.next();!i.done;i=n.next()){var o=i.value;Array.isArray(o)&&o.forEach((function(e){return Wf(r,void 0,void 0,(function(){var t;return qf(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]),dB.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType,e.subConfig)];case 2:return r.sent(),dB.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(iB.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=r.sent(),dB.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{i&&!i.done&&(t=n.return)&&t.call(n)}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){var r;if(void 0===t&&(t=!0),e.clientId!==(null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId)){var n=this._findRemoteStream(e.clientId,e.streamId);if(!n){n=new uB(e.clientId,e.streamId,e.screen,e.attributes),this._initStreamListeners(n);var i=this._remoteStreams.get(e.clientId);i?i.push(n):this._remoteStreams.set(e.clientId,[n])}return t&&this.safeEmit(IL.ON_ADD_STREAM,{stream:n}),!n.isScreen&&n.hasVideo&&this.safeEmit(iB.ON_USER_START_VIDEO_CAPTURE,{userId:n.userId}),!n.isScreen&&n.hasAudio&&this.safeEmit(iB.ON_USER_START_AUDIO_CAPTURE,{userId:n.userId}),n}},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 n={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,Yf({},n)),this.safeEmit(IL.USER_CONNECTION,{userInfo:n})}},t.prototype._onUserDisconnection=function(e){var t,r=this,n=e.clientId,i=e.tag,o=e.code;if(n)if(n===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;i===AL.kickedByAdmin?a=$w.KICKED_OUT:i===AL.onUserTokenDidExpire?a=$w.TOKEN_EXPIRED:i===AL.userDuplicateLogin&&(a=$w.DUPLICATE_LOGIN),o===CL.roomDismissByAdmin&&(a=$w.ROOM_DISMISS),a&&this.safeEmit(iB.ON_ROOM_ERROR,{errorCode:a})}else{var s=wf.DROPPED;i===AL.userLeave?s=wf.QUIT:i===AL.kickedByAdmin?s=wf.KICKED_BY_ADMIN:i===AL.roleChanged&&(s=wf.SWITCH_TO_INVISIBLE);var c=function(){r._remoteUsers.delete(n);var e=r._remoteStreams.get(n);Array.isArray(e)&&e.length&&(e.forEach((function(e){r.safeEmit(IL.ON_REMOVE_STREAM,{stream:e,reason:"Client leave"})})),r._remoteStreams.delete(n)),r.safeEmit(iB.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===AL.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(n);null!=u||self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else c()}},t.prototype._onRemoveStream=function(e){var t,r,n=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._remoteStreams.get(e.clientId);if(i){var o=i.find((function(t){return t.streamId==e.streamId}));o&&(null===(r=this._mediaServerClient)||void 0===r||r.handleRemoveStream(o,e).then((function(){if(!(null==o?void 0:o._workaround_1_)){var t=n._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),n._remoteStreams.set(e.clientId,t)}})),this.safeEmit(IL.ON_REMOVE_STREAM,{stream:o,reason:e.message}))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t=e.clientId,r=e.streamId,n=e.attributes,i=this._findRemoteStream(t,r);if(i){var o=i.attributes,a=Yf(Yf({},o),n);i.attributes=a,a.localaudio!==o.localaudio&&(a.localaudio?this.safeEmit(iB.ON_USER_START_AUDIO_CAPTURE,{userId:t}):this.safeEmit(iB.ON_USER_STOP_AUDIO_CAPTURE,{userId:t})),a.localvideo!==o.localvideo&&(a.localvideo?this.safeEmit(iB.ON_USER_START_VIDEO_CAPTURE,{userId:t}):this.safeEmit(iB.ON_USER_STOP_VIDEO_CAPTURE,{userId:t})),a.audiostream!==o.audiostream&&(a.audiostream?this.safeEmit(iB.ON_USER_MUTE_AUDIO,{userInfo:{userId:t},muteState:Pf.MUTE_STATE_ON}):this.safeEmit(iB.ON_USER_MUTE_AUDIO,{userInfo:{userId:t},muteState:Pf.MUTE_STATE_OFF})),a.videostream!==o.videostream&&(a.videostream?this.safeEmit(iB.ON_USER_MUTE_VIDEO,{userInfo:{userId:t},muteState:Pf.MUTE_STATE_ON}):this.safeEmit(iB.ON_USER_MUTE_VIDEO,{userInfo:{userId:t},muteState:Pf.MUTE_STATE_OFF}))}},t.prototype._onPushTrack=function(e){var t=this,r=e.clientId,n=e.streamId,i=this._findRemoteStream(r,n);i||(i=this._onAddStream(e,!1)),this._mediaServerClient.subscribe4pushTrack(i,e).then((function(){return t.safeEmit(iB.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){dB.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,r=e.clientId,n=e.streamId,i=e.message,o=this._findRemoteStream(r,n);o&&this._mediaServerClient.unsubscribe4removeTrack(o,i).then((function(){var e;if(o._workaround_1_){var i=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==n}));t._remoteStreams.set(r,i||[])}t.safeEmit(iB.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){dB.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t=e.nodes,r=e.reason;this._destroyAndInitMediaServerClient(),Array.isArray(t)&&t.length?this._getAccessNode=t[0]:this._getAccessFeedback=r,UL.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(r)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,r=this;this._isReconnecting=!0,UL.rtcReconnect(1002,LU.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,xU.PEERCONNECTION);try{for(var n=Jf(this._remoteStreams.values()),i=n.next();!i.done;i=n.next()){var o=i.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._join((function(){UL.rtcReconnected(VU.PEERCONNECTION_RECONNECTED,BU.PEERCONNECTION)}),(function(e){dB.print("Reconnecting error, will reconnect after 3s",e),r._reconnectTimer=setTimeout(r._reconnect.bind(r),3e3)}),!0)},t.prototype._handleAbnormalDisconnection=function(){dB.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===jx.DISCONNECTED)t=Gf.CONNECTION_STATE_DISCONNECTED;else if(e.next===jx.CONNECTED)t=this._isReconnecting?Gf.CONNECTION_STATE_RECONNECTED:Gf.CONNECTION_STATE_CONNECTED;else{if(e.next!==jx.CONNECTING)return;t=this._isReconnecting?Gf.CONNECTION_STATE_RECONNECTING:Gf.CONNECTION_STATE_CONNECTING}this.safeEmit(RL.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 n;t.emit(iB.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(n=t._roomInfo)||void 0===n?void 0:n.roomId,streamIndex:e.isScreen?Bf.STREAM_INDEX_SCREEN:Bf.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(IL.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){var t=e.msg;try{t=JSON.parse(t)}catch(e){}this.safeEmit(IL.USER_MESSAGE_RECEIVED,{userId:e.from,message:t})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(IL.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(IL.POST_PROCESSING_MESSAGE,{code:r,message:["success","parameter error","subscription timeout","ffmpeg error","cdn error"][r]})},t}(kk),hB=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=Zf(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},pB=new wk("Player",0),fB=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],_B={playsinline:"","webkit-playsinline":""},vB={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},mB=function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var r="audio"===e?_B:vB;if("video"===e&&this.videoCache.length>0){if(n=this.videoCache.pop())return hB(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var n;if(n=this.audioCache.pop())return hB(n,{style:t,attributes:r}),n}return 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=Zf(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r}(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}(),EB=new mB,gB=function(e){function t(t){var r=e.call(this)||this;r.emitVideoEvent=function(e){var t,n,i={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===(n=r._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:r.isScreen};r.emit("playback_event",i)},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;UL.rtcError("video autoplay failed, userId: ".concat(r.userId),-1e3),r.emit("playback_event",{type:"video",rawEvent:e,readyState:r._videoDom.readyState||0,userId:r.userId,eventName:"autoplay-error",currentTime:(null===(t=r._videoDom)||void 0===t?void 0:t.currentTime)||0})}))}};var n=t.renderDom,i=t.userId;r.renderMode=void 0!==t.renderMode?t.renderMode:Vf.RENDER_MODE_FIT;var o="string"==typeof n?document.getElementById(n):n;if(!o)throw new nD($w.CANT_FIND_DOM,"can't find dom");return r._containerDom=o,r.userId=i,r.isScreen=!!t.isScreen,r._initVideo(),r}return Cf(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=EB.getOrCreate("video",{width:"100%",height:"100%",background:"black"}),this._videoDom.id="".concat(this.userId,"_").concat(ik()),this.renderMode===Vf.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover"),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&fB.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&&(fB.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 n;if("timeupdate"===r.eventName){if(void 0===t.__cumulativeTime&&(t.__cumulativeTime=0),0===(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime))return;if(t._videoDom.currentTime>t.__cumulativeTime){var i=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),o=t._videoDom.currentTime-t.__cumulativeTime>.5;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:o,stallCount:o?1:0,stallDuration:i%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var r;return Wf(this,void 0,void 0,(function(){var n,i,o=this;return qf(this,(function(a){return n=this._videoDom,pB.print("playVideo","play video track: ".concat(this.userId)),n&&n.srcObject instanceof MediaStream&&n.srcObject.getTrackById(null===(r=e.getTrack())||void 0===r?void 0:r.id)||(n||(this._initVideo(),n=this._videoDom),pB.print("playVideo","play video by dom: ".concat(null==n?void 0:n.id)),(i=new MediaStream).addTrack(e.getTrack()),n.srcObject=i,this._containerDom.appendChild(n),n.addEventListener("canplay",this._internalPlay),n.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(pB.print("Invoke AudioPlayer.manuallyPlay"),!this._videoDom)throw new nD($w.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){pB.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;pB.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom),EB.recycle(this._videoDom),this._removeListeners(),delete this._videoDom),this._videoDom=void 0,this.__cumulativeTime=void 0},t.prototype.destroy=function(){this.stop(),e.prototype.removeAllListeners.call(this)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(Ak.exports.EventEmitter),SB=function(e){function t(t,r){var n=e.call(this)||this;if(n.emitVideoEvent=function(e){var t,r,i={type:"audio",rawEvent:e,readyState:(null===(t=n._audioDom)||void 0===t?void 0:t.readyState)||0,userId:n.userId,eventName:e.type,currentTime:(null===(r=n._audioDom)||void 0===r?void 0:r.currentTime)||0};n.emit("playback_event",i)},n._internalPlay=function(){var e,t;if(FL("_internalPlay",{paused:null===(e=n._audioDom)||void 0===e?void 0:e.paused}),null===(t=n._audioDom)||void 0===t?void 0:t.paused)try{var r=n._audioDom.play();(null==r?void 0:r.then)&&r.catch((function(e){n._autoPlayError(e)})).then((function(){FL("_internalPlay successfully",{userId:n.userId})}))}catch(e){n._autoPlayError(e)}},r){var i=document.getElementById(r);if(!i)throw new nD($w.CANT_FIND_DOM,"can't find dom");n._containerDom=i}else n._containerDom=document.body;return n.userId=t,n._initAudio(),n}return Cf(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=EB.getOrCreate("audio",{display:"none"}),this._audioDom.id="".concat(this.userId,"_").concat(ik()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&fB.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&&(fB.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 Wf(this,void 0,void 0,(function(){var r,n,i=this;return qf(this,(function(o){return pB.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),(n=new MediaStream).addTrack(e.getTrack()),r.srcObject=n,null==r||r.addEventListener("canplay",this._internalPlay),null==r||r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return i._internalPlay()}))),[2]}))}))},t.prototype._autoPlayError=function(e){var t;UL.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:this._audioDom.readyState||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(t=this._audioDom)||void 0===t?void 0:t.currentTime)||0})},t.prototype.manuallyPlay=function(){if(pB.print("Invoke AudioPlayer.manuallyPlay"),!this._audioDom)throw new nD($w.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 Wf(this,void 0,void 0,(function(){var t;return qf(this,(function(r){switch(r.label){case 0:return pB.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,MV.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;pB.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom),EB.recycle(this._audioDom),this._removeListeners(),delete this._audioDom),this._audioDom=void 0},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){this.stop(),e.prototype.removeAllListeners.call(this)},t}(Ak.exports.EventEmitter),yB="object"==("undefined"==typeof global?"undefined":t(global))&&global&&global.Object===Object&&global,bB="object"==("undefined"==typeof self?"undefined":t(self))&&self&&self.Object===Object&&self,TB=yB||bB||Function("return this")(),IB=TB.Symbol,RB=Object.prototype,AB=RB.hasOwnProperty,CB=RB.toString,OB=IB?IB.toStringTag:void 0;var NB=Object.prototype.toString;var wB=IB?IB.toStringTag:void 0;function DB(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":wB&&wB in Object(e)?function(e){var t=AB.call(e,OB),r=e[OB];try{e[OB]=void 0;var n=!0}catch(e){}var i=CB.call(e);return n&&(t?e[OB]=r:delete e[OB]),i}(e):function(e){return NB.call(e)}(e)}function kB(e){return null!=e&&"object"==t(e)}var PB=Array.isArray;function MB(e){var r=t(e);return null!=e&&("object"==r||"function"==r)}function UB(e){return e}function LB(e){if(!MB(e))return!1;var t=DB(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var xB=TB["__core-js_shared__"],VB=function(){var e=/[^.]+$/.exec(xB&&xB.keys&&xB.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var BB=Function.prototype.toString;var jB=/^\[object .+?Constructor\]$/,FB=Function.prototype,GB=Object.prototype,HB=FB.toString,zB=GB.hasOwnProperty,KB=RegExp("^"+HB.call(zB).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function YB(e){return!(!MB(e)||(t=e,VB&&VB in t))&&(LB(e)?KB:jB).test(function(e){if(null!=e){try{return BB.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function XB(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 WB=Date.now;var qB,JB,ZB,$B=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return YB(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),QB=$B,ej=QB?function(e,t){return QB(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:UB,tj=(qB=ej,JB=0,ZB=0,function(){var e=WB(),t=16-(e-ZB);if(ZB=e,t>0){if(++JB>=800)return arguments[0]}else JB=0;return qB.apply(void 0,arguments)}),rj=tj,nj=/^(?:0|[1-9]\d*)$/;function ij(e,r){var n=t(e);return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&nj.test(e))&&e>-1&&e%1==0&&e<r}function oj(e,t,r){"__proto__"==t&&QB?QB(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function aj(e,t){return e===t||e!=e&&t!=t}var sj=Object.prototype.hasOwnProperty;function cj(e,t,r){var n=e[t];sj.call(e,t)&&aj(n,r)&&(void 0!==r||t in e)||oj(e,t,r)}var uj=Math.max;function dj(e,t){return rj(function(e,t,r){return t=uj(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=uj(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),XB(e,this,s)}}(e,t,UB),e+"")}function lj(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function hj(e){return null!=e&&lj(e.length)&&!LB(e)}var pj=Object.prototype;function fj(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||pj)}function _j(e){return kB(e)&&"[object Arguments]"==DB(e)}var vj=Object.prototype,mj=vj.hasOwnProperty,Ej=vj.propertyIsEnumerable,gj=_j(function(){return arguments}())?_j:function(e){return kB(e)&&mj.call(e,"callee")&&!Ej.call(e,"callee")},Sj=gj;var yj="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,bj=yj&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,Tj=bj&&bj.exports===yj?TB.Buffer:void 0,Ij=(Tj?Tj.isBuffer:void 0)||function(){return!1},Rj={};Rj["[object Float32Array]"]=Rj["[object Float64Array]"]=Rj["[object Int8Array]"]=Rj["[object Int16Array]"]=Rj["[object Int32Array]"]=Rj["[object Uint8Array]"]=Rj["[object Uint8ClampedArray]"]=Rj["[object Uint16Array]"]=Rj["[object Uint32Array]"]=!0,Rj["[object Arguments]"]=Rj["[object Array]"]=Rj["[object ArrayBuffer]"]=Rj["[object Boolean]"]=Rj["[object DataView]"]=Rj["[object Date]"]=Rj["[object Error]"]=Rj["[object Function]"]=Rj["[object Map]"]=Rj["[object Number]"]=Rj["[object Object]"]=Rj["[object RegExp]"]=Rj["[object Set]"]=Rj["[object String]"]=Rj["[object WeakMap]"]=!1;var Aj="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,Cj=Aj&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,Oj=Cj&&Cj.exports===Aj&&yB.process,Nj=function(){try{var e=Cj&&Cj.require&&Cj.require("util").types;return e||Oj&&Oj.binding&&Oj.binding("util")}catch(e){}}(),wj=Nj&&Nj.isTypedArray,Dj=wj?function(e){return function(t){return e(t)}}(wj):function(e){return kB(e)&&lj(e.length)&&!!Rj[DB(e)]},kj=Dj,Pj=Object.prototype.hasOwnProperty;function Mj(e,t){var r=PB(e),n=!r&&Sj(e),i=!r&&!n&&Ij(e),o=!r&&!n&&!i&&kj(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!Pj.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ij(u,c))||s.push(u);return s}var Uj=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Lj=Uj,xj=Object.prototype.hasOwnProperty;function Vj(e){return hj(e)?Mj(e):function(e){if(!fj(e))return Lj(e);var t=[];for(var r in Object(e))xj.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var Bj=Object.prototype.hasOwnProperty;function jj(e){if(!MB(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=fj(e),r=[];for(var n in e)("constructor"!=n||!t&&Bj.call(e,n))&&r.push(n);return r}var Fj,Gj=(Fj=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?oj(r,s,c):cj(r,s,c)}}(t,function(e){return hj(e)?Mj(e,!0):jj(e)}(t),e)},dj((function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=Fj.length>3&&"function"==typeof o?(i--,o):void 0,a&&function(e,r,n){if(!MB(n))return!1;var i=t(r);return!!("number"==i?hj(n)&&ij(r,n.length):"string"==i&&r in n)&&aj(n[r],e)}(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var s=r[n];s&&Fj(e,s,n,o)}return e}))),Hj=Gj;function zj(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function Kj(e){return null==e?[]:zj(e,Vj(e))}var Yj=a,Xj=Qe("iterator"),Wj=!Yj((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,n){t.delete("b"),r+=n+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[Xj]||"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})),qj=I,Jj=2147483647,Zj=/[^\0-\u007E]/,$j=/[.\u3002\uFF0E\uFF61]/g,Qj="Overflow: input needs wider integers to process",eF=i.RangeError,tF=qj($j.exec),rF=Math.floor,nF=String.fromCharCode,iF=qj("".charCodeAt),oF=qj([].join),aF=qj([].push),sF=qj("".replace),cF=qj("".split),uF=qj("".toLowerCase),dF=function(e){return e+22+75*(e<26)},lF=function(e,t,r){var n=0;for(e=r?rF(e/700):e>>1,e+=rF(e/t);e>455;)e=rF(e/35),n+=36;return rF(n+36*e/(e+38))},hF=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=iF(e,r++);if(i>=55296&&i<=56319&&r<n){var o=iF(e,r++);56320==(64512&o)?aF(t,((1023&i)<<10)+(1023&o)+65536):(aF(t,i),r--)}else aF(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&aF(t,nF(n));var c=t.length,u=c;for(c&&aF(t,"-");u<i;){var d=Jj;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>rF((Jj-a)/l))throw eF(Qj);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>Jj)throw eF(Qj);if(n==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;aF(t,nF(dF(f+_%v))),h=rF(_/v),p+=36}aF(t,nF(dF(h))),s=lF(a,l,u==c),a=0,u++}}a++,o++}return oF(t,"")},pF=Xn,fF=i,_F=Y,vF=l,mF=I,EF=Wj,gF=Wt.exports,SF=nc,yF=Go,bF=Dh,TF=Or,IF=lc,RF=j,AF=xe,CF=Yo,OF=lo,NF=Pt,wF=G,DF=fo,kF=Ri,PF=E,MF=Oc,UF=yc,LF=lu,xF=oI,VF=Qe("iterator"),BF="URLSearchParams",jF="URLSearchParamsIterator",FF=TF.set,GF=TF.getterFor(BF),HF=TF.getterFor(jF),zF=_F("fetch"),KF=_F("Request"),YF=_F("Headers"),XF=KF&&KF.prototype,WF=YF&&YF.prototype,qF=fF.RegExp,JF=fF.TypeError,ZF=fF.decodeURIComponent,$F=fF.encodeURIComponent,QF=mF("".charAt),eG=mF([].join),tG=mF([].push),rG=mF("".replace),nG=mF([].shift),iG=mF([].splice),oG=mF("".split),aG=mF("".slice),sG=/\+/g,cG=Array(4),uG=function(e){return cG[e-1]||(cG[e-1]=qF("((?:%[\\da-f]{2}){"+e+"})","gi"))},dG=function(e){try{return ZF(e)}catch(t){return e}},lG=function(e){var t=rG(e,sG," "),r=4;try{return ZF(t)}catch(e){for(;r;)t=rG(t,uG(r--),dG);return t}},hG=/[!'()~]|%20/g,pG={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},fG=function(e){return pG[e]},_G=function(e){return rG($F(e),hG,fG)},vG=bF((function(e,t){FF(this,{type:jF,iterator:MF(GF(e).entries),kind:t})}),"Iterator",(function(){var e=HF(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),mG=function(e){this.entries=[],this.url=null,void 0!==e&&(wF(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===QF(e,0)?aG(e,1):e:DF(e)))};mG.prototype={type:BF,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=UF(e);if(c)for(r=(t=MF(e,c)).next;!(n=vF(r,t)).done;){if(o=(i=MF(NF(n.value))).next,(a=vF(o,i)).done||(s=vF(o,i)).done||!vF(o,i).done)throw JF("Expected sequence with length 2");tG(this.entries,{key:DF(a.value),value:DF(s.value)})}else for(var u in e)AF(e,u)&&tG(this.entries,{key:u,value:DF(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=oG(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=oG(t,"="),tG(this.entries,{key:lG(nG(r)),value:lG(eG(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],tG(r,_G(e.key)+"="+_G(e.value));return eG(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var EG=function(){IF(this,gG);var e=arguments.length>0?arguments[0]:void 0;FF(this,new mG(e))},gG=EG.prototype;if(SF(gG,{append:function(e,t){LF(arguments.length,2);var r=GF(this);tG(r.entries,{key:DF(e),value:DF(t)}),r.updateURL()},delete:function(e){LF(arguments.length,1);for(var t=GF(this),r=t.entries,n=DF(e),i=0;i<r.length;)r[i].key===n?iG(r,i,1):i++;t.updateURL()},get:function(e){LF(arguments.length,1);for(var t=GF(this).entries,r=DF(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){LF(arguments.length,1);for(var t=GF(this).entries,r=DF(e),n=[],i=0;i<t.length;i++)t[i].key===r&&tG(n,t[i].value);return n},has:function(e){LF(arguments.length,1);for(var t=GF(this).entries,r=DF(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){LF(arguments.length,1);for(var r,n=GF(this),i=n.entries,o=!1,a=DF(e),s=DF(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?iG(i,c--,1):(o=!0,r.value=s));o||tG(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=GF(this);xF(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=GF(this).entries,n=CF(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new vG(this,"keys")},values:function(){return new vG(this,"values")},entries:function(){return new vG(this,"entries")}},{enumerable:!0}),gF(gG,VF,gG.entries,{name:"entries"}),gF(gG,"toString",(function(){return GF(this).serialize()}),{enumerable:!0}),yF(EG,BF),pF({global:!0,forced:!EF},{URLSearchParams:EG}),!EF&&RF(YF)){var SG=mF(WF.has),yG=mF(WF.set),bG=function(e){if(wF(e)){var t,r=e.body;if(OF(r)===BF)return t=e.headers?new YF(e.headers):new YF,SG(t,"content-type")||yG(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),kF(e,{body:PF(0,DF(r)),headers:PF(0,t)})}return e};if(RF(zF)&&pF({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return zF(e,arguments.length>1?bG(arguments[1]):{})}}),RF(KF)){var TG=function(e){return IF(this,XF),new KF(e,arguments.length>1?bG(arguments[1]):{})};XF.constructor=TG,TG.prototype=XF,pF({global:!0,forced:!0},{Request:TG})}}var IG,RG={URLSearchParams:EG,getState:GF},AG=Xn,CG=s,OG=Wj,NG=i,wG=Yo,DG=I,kG=ri.f,PG=Wt.exports,MG=lc,UG=xe,LG=Vi,xG=GD,VG=Ro,BG=gp.codeAt,jG=function(e){var t,r,n=[],i=cF(sF(uF(e),$j,"."),".");for(t=0;t<i.length;t++)r=i[t],aF(n,tF(Zj,r)?"xn--"+hF(r):r);return oF(n,".")},FG=fo,GG=Go,HG=lu,zG=RG,KG=Or,YG=KG.set,XG=KG.getterFor("URL"),WG=zG.URLSearchParams,qG=zG.getState,JG=NG.URL,ZG=NG.TypeError,$G=NG.parseInt,QG=Math.floor,eH=Math.pow,tH=DG("".charAt),rH=DG(/./.exec),nH=DG([].join),iH=DG(1..toString),oH=DG([].pop),aH=DG([].push),sH=DG("".replace),cH=DG([].shift),uH=DG("".split),dH=DG("".slice),lH=DG("".toLowerCase),hH=DG([].unshift),pH="Invalid scheme",fH="Invalid host",_H="Invalid port",vH=/[a-z]/i,mH=/[\d+-.a-z]/i,EH=/\d/,gH=/^0x/i,SH=/^[0-7]+$/,yH=/^\d+$/,bH=/^[\da-f]+$/i,TH=/[\0\t\n\r #%/:<>?@[\\\]^|]/,IH=/[\0\t\n\r #/:<>?@[\\\]^|]/,RH=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,AH=/[\t\n\r]/g,CH=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)hH(t,e%256),e=QG(e/256);return nH(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=iH(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},OH={},NH=LG({},OH,{" ":1,'"':1,"<":1,">":1,"`":1}),wH=LG({},NH,{"#":1,"?":1,"{":1,"}":1}),DH=LG({},wH,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),kH=function(e,t){var r=BG(e,0);return r>32&&r<127&&!UG(t,e)?e:encodeURIComponent(e)},PH={ftp:21,file:null,http:80,https:443,ws:80,wss:443},MH=function(e,t){var r;return 2==e.length&&rH(vH,tH(e,0))&&(":"==(r=tH(e,1))||!t&&"|"==r)},UH=function(e){var t;return e.length>1&&MH(dH(e,0,2))&&(2==e.length||"/"===(t=tH(e,2))||"\\"===t||"?"===t||"#"===t)},LH=function(e){return"."===e||"%2e"===lH(e)},xH={},VH={},BH={},jH={},FH={},GH={},HH={},zH={},KH={},YH={},XH={},WH={},qH={},JH={},ZH={},$H={},QH={},ez={},tz={},rz={},nz={},iz=function(e,t,r){var n,i,o,a=FG(e);if(t){if(i=this.parse(a))throw ZG(i);this.searchParams=null}else{if(void 0!==r&&(n=new iz(r,!0)),i=this.parse(a,null,n))throw ZG(i);(o=qG(new WG)).bindURL(this),this.searchParams=o}};iz.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||xH,d=0,l="",h=!1,p=!1,f=!1;for(e=FG(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=sH(e,RH,"")),e=sH(e,AH,""),n=xG(e);d<=n.length;){switch(i=n[d],u){case xH:if(!i||!rH(vH,i)){if(t)return pH;u=BH;continue}l+=lH(i),u=VH;break;case VH:if(i&&(rH(mH,i)||"+"==i||"-"==i||"."==i))l+=lH(i);else{if(":"!=i){if(t)return pH;l="",u=BH,d=0;continue}if(t&&(c.isSpecial()!=UG(PH,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&PH[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=JH:c.isSpecial()&&r&&r.scheme==c.scheme?u=jH:c.isSpecial()?u=zH:"/"==n[d+1]?(u=FH,d++):(c.cannotBeABaseURL=!0,aH(c.path,""),u=tz)}break;case BH:if(!r||r.cannotBeABaseURL&&"#"!=i)return pH;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=VG(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=nz;break}u="file"==r.scheme?JH:GH;continue;case jH:if("/"!=i||"/"!=n[d+1]){u=GH;continue}u=KH,d++;break;case FH:if("/"==i){u=YH;break}u=ez;continue;case GH:if(c.scheme=r.scheme,i==IG)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=VG(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=HH;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=VG(r.path),c.query="",u=rz;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=VG(r.path),c.path.length--,u=ez;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=VG(r.path),c.query=r.query,c.fragment="",u=nz}break;case HH:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=ez;continue}u=YH}else u=KH;break;case zH:if(u=KH,"/"!=i||"/"!=tH(l,d+1))continue;d++;break;case KH:if("/"!=i&&"\\"!=i){u=YH;continue}break;case YH:if("@"==i){h&&(l="%40"+l),h=!0,o=xG(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||f){var m=kH(v,DH);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(i==IG||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=xG(l).length+1,l="",u=XH}else l+=i;break;case XH:case WH:if(t&&"file"==c.scheme){u=$H;continue}if(":"!=i||p){if(i==IG||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return fH;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=QH,t)return;continue}"["==i?p=!0:"]"==i&&(p=!1),l+=i}else{if(""==l)return fH;if(a=c.parseHost(l))return a;if(l="",u=qH,t==WH)return}break;case qH:if(!rH(EH,i)){if(i==IG||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var E=$G(l,10);if(E>65535)return _H;c.port=c.isSpecial()&&E===PH[c.scheme]?null:E,l=""}if(t)return;u=QH;continue}return _H}l+=i;break;case JH:if(c.scheme="file","/"==i||"\\"==i)u=ZH;else{if(!r||"file"!=r.scheme){u=ez;continue}if(i==IG)c.host=r.host,c.path=VG(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=VG(r.path),c.query="",u=rz;else{if("#"!=i){UH(nH(VG(n,d),""))||(c.host=r.host,c.path=VG(r.path),c.shortenPath()),u=ez;continue}c.host=r.host,c.path=VG(r.path),c.query=r.query,c.fragment="",u=nz}}break;case ZH:if("/"==i||"\\"==i){u=$H;break}r&&"file"==r.scheme&&!UH(nH(VG(n,d),""))&&(MH(r.path[0],!0)?aH(c.path,r.path[0]):c.host=r.host),u=ez;continue;case $H:if(i==IG||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&MH(l))u=ez;else if(""==l){if(c.host="",t)return;u=QH}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=QH}continue}l+=i;break;case QH:if(c.isSpecial()){if(u=ez,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=IG&&(u=ez,"/"!=i))continue}else c.fragment="",u=nz;else c.query="",u=rz;break;case ez:if(i==IG||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=lH(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||aH(c.path,"")):LH(l)?"/"==i||"\\"==i&&c.isSpecial()||aH(c.path,""):("file"==c.scheme&&!c.path.length&&MH(l)&&(c.host&&(c.host=""),l=tH(l,0)+":"),aH(c.path,l)),l="","file"==c.scheme&&(i==IG||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)cH(c.path);"?"==i?(c.query="",u=rz):"#"==i&&(c.fragment="",u=nz)}else l+=kH(i,wH);break;case tz:"?"==i?(c.query="",u=rz):"#"==i?(c.fragment="",u=nz):i!=IG&&(c.path[0]+=kH(i,OH));break;case rz:t||"#"!=i?i!=IG&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":kH(i,OH)):(c.fragment="",u=nz);break;case nz:i!=IG&&(c.fragment+=kH(i,NH))}d++}},parseHost:function(e){var t,r,n;if("["==tH(e,0)){if("]"!=tH(e,e.length-1))return fH;if(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return tH(e,l)};if(":"==h()){if(":"!=tH(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&rH(bH,h());)t=16*t+$G(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!rH(EH,h()))return;for(;rH(EH,h());){if(o=$G(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!=n||u++}if(4!=n)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}(dH(e,1,-1)),!t)return fH;this.host=t}else if(this.isSpecial()){if(e=jG(e),rH(TH,e))return fH;if(t=function(e){var t,r,n,i,o,a,s,c=uH(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==tH(i,0)&&(o=rH(gH,i)?16:8,i=dH(i,8==o?1:2)),""===i)a=0;else{if(!rH(10==o?yH:8==o?SH:bH,i))return e;a=$G(i,o)}aH(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=eH(256,5-t))return null}else if(a>255)return null;for(s=oH(r),n=0;n<r.length;n++)s+=r[n]*eH(256,3-n);return s}(e),null===t)return fH;this.host=t}else{if(rH(IH,e))return fH;for(t="",r=xG(e),n=0;n<r.length;n++)t+=kH(r[n],OH);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return UG(PH,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&MH(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=CH(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+nH(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw ZG(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new oz(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+CH(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(FG(e)+":",xH)},getUsername:function(){return this.username},setUsername:function(e){var t=xG(FG(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=kH(t[r],DH)}},getPassword:function(){return this.password},setPassword:function(e){var t=xG(FG(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=kH(t[r],DH)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?CH(e):CH(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,XH)},getHostname:function(){var e=this.host;return null===e?"":CH(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,WH)},getPort:function(){var e=this.port;return null===e?"":FG(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=FG(e))?this.port=null:this.parse(e,qH))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+nH(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,QH))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=FG(e))?this.query=null:("?"==tH(e,0)&&(e=dH(e,1)),this.query="",this.parse(e,rz)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=FG(e))?("#"==tH(e,0)&&(e=dH(e,1)),this.fragment="",this.parse(e,nz)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var oz=function(e){var t=MG(this,az),r=HG(arguments.length,1)>1?arguments[1]:void 0,n=YG(t,new iz(e,!1,r));CG||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},az=oz.prototype,sz=function(e,t){return{get:function(){return XG(this)[e]()},set:t&&function(e){return XG(this)[t](e)},configurable:!0,enumerable:!0}};if(CG&&kG(az,{href:sz("serialize","setHref"),origin:sz("getOrigin"),protocol:sz("getProtocol","setProtocol"),username:sz("getUsername","setUsername"),password:sz("getPassword","setPassword"),host:sz("getHost","setHost"),hostname:sz("getHostname","setHostname"),port:sz("getPort","setPort"),pathname:sz("getPathname","setPathname"),search:sz("getSearch","setSearch"),searchParams:sz("getSearchParams"),hash:sz("getHash","setHash")}),PG(az,"toJSON",(function(){return XG(this).serialize()}),{enumerable:!0}),PG(az,"toString",(function(){return XG(this).serialize()}),{enumerable:!0}),JG){var cz=JG.createObjectURL,uz=JG.revokeObjectURL;cz&&PG(oz,"createObjectURL",wG(cz,JG)),uz&&PG(oz,"revokeObjectURL",wG(uz,JG))}GG(oz,"URL"),AG({global:!0,forced:!OG,sham:!CG},{URL:oz});var dz,lz=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 Wf(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,p,f,_=this;return qf(this,(function(v){switch(v.label){case 0:if(n=r.playCount,mk(i=r.type,"mixingType",Kj(e_)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=jV(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:t_.AUDIO_MIXING_STATE_STOPPED,error:Qw.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:t_.AUDIO_MIXING_STATE_FAILED,error:Qw.AUDIO_MIXING_ERROR_START_FAILED}),new nD($w.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",n<=0?c.loop=!0:n>0&&(l=n,c.onended=function(){--l>0?c.play():_._context.emitMessage({mixId:e,state:t_.AUDIO_MIXING_STATE_FINISHED,error:Qw.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"}),i===e_.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:t_.AUDIO_MIXING_STATE_PLAYING,error:Qw.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:t_.AUDIO_MIXING_STATE_STOPPED,error:Qw.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:t_.AUDIO_MIXING_STATE_PAUSED,error:Qw.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:t_.AUDIO_MIXING_STATE_PLAYING,error:Qw.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return Wf(this,void 0,void 0,(function(){var r,n=this;return qf(this,(function(i){switch(i.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return n._context.emitMessage({mixId:e,state:t_.AUDIO_MIXING_STATE_PRELOADED,error:Qw.AUDIO_MIXING_ERROR_OK}),t.arrayBuffer();throw n._context.emitMessage({mixId:e,state:t_.AUDIO_MIXING_STATE_FAILED,error:Qw.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new nD($w.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(e){throw new nD($w.LOAD_RESOURCES_FAILED,"Load resources failed",e)}))];case 1:return r=i.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){mk(e,"type",Kj(e_));var t=this._context.getLocalAudioTrack();if(t){var r=jV(t.getTrack());if(r&&this.mixMediaStream(r),e===e_.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:t_.AUDIO_MIXING_STATE_PCM_ENABLED,error:Qw.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:t_.AUDIO_MIXING_STATE_PCM_DISABLED,error:Qw.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;this._audioBufferSource&&this.cachedBuffer.push(e),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()},Xf([BL(!1,"id","filePath","options")],e.prototype,"startAudioMixing",null),Xf([BL(!1,"id")],e.prototype,"stopAudioMixing",null),Xf([BL(!1,"id")],e.prototype,"pauseAudioMixing",null),Xf([BL(!1,"id")],e.prototype,"resumeAudioMixing",null),Xf([BL(!1,"id")],e.prototype,"preloadAudioMixing",null),Xf([BL(!1,"id")],e.prototype,"unloadAudioMixing",null),Xf([BL(!1,"id")],e.prototype,"getAudioMixingVolume",null),Xf([BL(!1,"id","volume")],e.prototype,"setAudioMixingVolume",null),Xf([BL(!1,"id")],e.prototype,"getAudioMixingDuration",null),Xf([BL(!1,"id")],e.prototype,"getAudioMixingCurrentPosition",null),Xf([BL(!1,"id","position")],e.prototype,"setAudioMixingPosition",null),Xf([BL(!1,"type")],e.prototype,"enableAudioMixingBuffer",null),Xf([BL()],e.prototype,"disableAudioMixingBuffer",null),Xf([BL(!1,"buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(dz||(dz={}));var hz=new wk("RTMClient",1),pz=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r._dataChannelSignal=null,r._handler=null,r._dataChannelSignalState=jx.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(n,i){if(hz.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new nD($w.ALREADY_LOGIN,"Already logined");r._userId=t,r._token=e,VL.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(hz.print("login","init dataChannelSingling"),r._dataChannelSignalState=jx.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))},t.prototype.logout=function(){var e;return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){if(!this._loginSessionId||!this._userId)throw new nD($w.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:HL.C2RTM}).catch((function(){})),this._closeDataChannelSignaling(),this._clearState(),[2]}))}))},t.prototype.updateLoginToken=function(e){return Wf(this,void 0,void 0,(function(){var t=this;return qf(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 Wf(this,void 0,void 0,(function(){var t;return qf(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new nD($w.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:HL.C2RTM})];case 1:return[2,null==(t=r.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Wf(this,void 0,void 0,(function(){return qf(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new nD($w.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 Wf(this,void 0,void 0,(function(){return qf(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new nD($w.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:HL.C2RTM})];case 1:return r.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new nD($w.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:wL.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=ik();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:ck.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now().toString(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:eP.VERSION,deviceId:QL.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:HL.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var r,n,i=t||{},o=i.code,a=i.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=$w.INVALID_PARAMS,n="Invalid userId"):(r=$w.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=$w.LOGIN_FAILED,n="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new nD(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){return Wf(this,void 0,void 0,(function(){var t,r,n,i,o,a=this;return qf(this,(function(s){switch(s.label){case 0:if(t=new tx,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,QL.getDeviceId(),"")];case 2:if(!(r=s.sent()))throw new Error;return[3,4];case 3:throw s.sent(),FL("rtm.login.getNodeFailed","",0,!0),new nD($w.ICE_SERVER_WRONG,"get ICE config failed");case 4:FL("rtm.login.getNodeSuccess",r,0,!0),hz.print("_createDataChannelSignaling()","get node success",r),this._handler=new Mx,this._handler.once("disconnect",(function(){hz.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 n=s.sent(),hz.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=jx.CONNECTED,[3,8];case 7:throw i=s.sent(),this._iceConfigNode=null,this._dataChannelSignalState=jx.DISCONNECTED,new nD($w.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",i);case 8:return o=new YL(n),hz.print("_createDataChannelSignaling()","send ping"),o.sendPingSignaling(),o.once("close",(function(){hz.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),a._onDisconnect()})),o.on(IL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(IL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(IL.USER_DISCONNECTION,(function(){a.emit("onUserDisconnection"),a._clearState()})),o.on(IL.NODE_CHANGE,(function(e){FL("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!==jx.CONNECTED)throw new nD($w.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=jx.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&&(hz.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){hz.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){hz.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}(Ak.exports.EventEmitter),fz=new wk("Engine",0),_z=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._videoStreamConstraints={},r._audioStreamConstraints={},r._videoStreamEncodeConfig=[{maxKbps:500}],r._screenStreamEncodeConfig=[{maxKbps:500}],r._pauseAllSubscribeState={audio:!1,video:!1},r._mirrorType=Hf.MIRROR_TYPE_RENDER,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=e_.PLAYOUT_AND_PUBLISH),Wf(r,void 0,void 0,(function(){var r;return qf(this,(function(n){switch(n.label){case 0:return fz.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:n.sent(),n.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(n_.onAudioMixingStateChanged,e)},r._appId=t,r._pubLock=new xx("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new lz({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage}),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 pz(t),r._handleRTMClient(r._rtmClient),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;fz.print("updateToken()","token: %s",e),vk(e,"token"),null===(t=this._room)||void 0===t||t.updateToken(e)},t.prototype.switchCamera=function(e){var t,r;return Wf(this,void 0,void 0,(function(){var n,i;return qf(this,(function(o){switch(o.label){case 0:return fz.print("switchCamera()","deviceId: %s",e),vk(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((n=this._videoStreamConstraints).deviceId={exact:e},this._videoStreamConstraints=n,[4,eB(n)]);case 1:return i=o.sent(),this._initLocalTrackEvents(i),this._localVideoTrack&&this._localVideoTrack.close(),this._localVideoTrack=i,this._videoPlayer&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(i),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 Wf(this,void 0,void 0,(function(){var n,i;return qf(this,(function(o){switch(o.label){case 0:return fz.print("switchMicrophone()","deviceId: %s",e),vk(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((n=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=n,[4,tB(n)]);case 1:return i=o.sent(),this._initLocalTrackEvents(i),this._localAudioTrack&&this._localAudioTrack.close(),this._localAudioTrack=i,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(){MV.on(n_.onMediaDeviceStateChanged,this._onDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,E,g,S,y,b,T,I=this;null===(e=this._room)||void 0===e||e.on(IL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(IL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(IL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(iB.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(iB.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(IL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(a=this._room)||void 0===a||a.on(IL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(s=this._room)||void 0===s||s.on(IL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(IL.POST_PROCESSING_MESSAGE,this._onLiveTranscodingResult.bind(this)),null===(u=this._room)||void 0===u||u.on(RL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(d=this._room)||void 0===d||d.on(iB.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(l=this._room)||void 0===l||l.on(iB.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(h=this._room)||void 0===h||h.on(iB.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(iB.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(f=this._room)||void 0===f||f.on(iB.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=I._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&I.safeEmit(n_.onAutoPublishResult,e)})),null===(_=this._room)||void 0===_||_.on(iB.ON_REMOTE_STREAM_STATS,(function(e){I.safeEmit(n_.onRemoteStreamStats,e)})),null===(v=this._room)||void 0===v||v.on(iB.ON_LOCAL_STREAM_STATS,(function(e){I.safeEmit(n_.onLocalStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(iB.ON_USER_MUTE_AUDIO,this._onUserMuteAudio.bind(this)),null===(E=this._room)||void 0===E||E.on(iB.ON_USER_MUTE_VIDEO,this._onUserMuteVideo.bind(this)),null===(g=this._room)||void 0===g||g.on(iB.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;I.safeEmit(n_.onUserStartAudioCapture,{userId:t})})),null===(S=this._room)||void 0===S||S.on(iB.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;I.safeEmit(n_.onUserStopAudioCapture,{userId:t})})),null===(y=this._room)||void 0===y||y.on(iB.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;I.safeEmit(n_.onUserStartVideoCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(iB.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;I.safeEmit(n_.onUserStopVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(iB.ON_SEI_MESSAGED_RECEIVED,(function(e){I.safeEmit(n_.onSEIMessageReceived,e)}))},t.prototype.safeEmit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return Rk(t)&&jL(t,lk(r)),e.prototype.safeEmit.apply(this,$f([t],Zf(r),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,r,n){return void 0===n&&(n={isAutoPublish:!1,isAutoSubscribeAudio:!1,isAutoSubscribeVideo:!1}),Wf(this,void 0,void 0,(function(){var i;return qf(this,(function(o){switch(o.label){case 0:if(fz.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,r,n),yk(e)||vk(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new nD($w.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){Ek(e,"userInfo"),bk(e.userId),yk(e.extraInfo)||vk(e.extraInfo,"userInfo.extraInfo",1,200)}(r),function(e){Ek(e,"roomConfig"),fk(e.isAutoPublish,"roomConfig.isAutoPublish"),fk(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),fk(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(n),!this._room||this._room.connectionState===jx.DISCONNECTED)return[3,1];throw new nD($w.REPEAT_JOIN,"Already joined");case 1:return this._room=new lB(n),this._addHandlerEventHandler(),i=this._liveTranscodeConfig&&nP("started",this._liveTranscodeConfig),[4,this._room.join(this._appId,t,e,Yf(Yf({},r),{businessId:this._businessId,role:this._visibility?dz.NORMAL_USER:dz.SILENT_USER}),i)];case 2:return o.sent(),this._roomConfig=n,(this._localAudioTrack||this._localVideoTrack)&&n.isAutoPublish?[4,this._updatePublish()]:[3,4];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},t.prototype.leaveRoom=function(){var e;fz.print("leaveRoom()"),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.leave().catch,this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.stop()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.stop()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.stop()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0},t.prototype.destroy=function(){var e,t,r;fz.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=[{maxKbps:500}],this._screenStreamEncodeConfig=[{maxKbps:500}],this._pauseAllSubscribeState={audio:!1,video:!1},clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=void 0,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._remoteAudioPlayer.forEach((function(e){return e.stop()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.stop()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.stop()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy()},t.prototype.publish=function(){return Wf(this,void 0,void 0,(function(){return qf(this,(function(e){switch(e.label){case 0:if(fz.print("publish()"),!this._room||this._room.connectionState!==jx.CONNECTED)throw new nD($w.PUBLISH_BEFORE_JOIN,"join first");return[4,this._updatePublish()];case 1:return e.sent(),[2]}}))}))},t.prototype.unpublish=function(){return Wf(this,void 0,void 0,(function(){var e,t;return qf(this,(function(r){switch(r.label){case 0:if(fz.print("unpublish()"),!this._room)throw new nD($w.UNPUBLISH_BEFORE_JOIN,"join first");return[4,this._pubLock.lock()];case 1:e=r.sent(),r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.unpublish()];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof nD?t:new nD($w.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype.subscribeUserStream=function(e,t,r,n){var i,o,a,s;return void 0===r&&(r=Bf.STREAM_INDEX_MAIN),void 0===n&&(n={videoIndex:0}),Wf(this,void 0,void 0,(function(){var c,u,d,l,h,p;return qf(this,(function(f){switch(f.label){case 0:if(fz.print("subscribeStream()","userId: %o, mediaType: %o, streamType: %o, configure: %o",e,t,r,n),bk(e),mk(t,"mediaType",[jf.AUDIO_AND_VIDEO,jf.AUDIO_ONLY,jf.VIDEO_ONLY,jf.NONE]),mk(r,"streamType",[Bf.STREAM_INDEX_MAIN,Bf.STREAM_INDEX_SCREEN]),_k(n.videoIndex,"config.videoIndex",0,2),!this._room||this._room.connectionState!==jx.CONNECTED)throw new nD($w.SUBSCRIBE_BEFORE_JOIN,"join first");if(c=this._room.remoteStreams.get(e),d=r===Bf.STREAM_INDEX_SCREEN,!(u=d?null==c?void 0:c.find((function(e){return e.isScreen})):null==c?void 0:c.find((function(e){return!e.isScreen}))))throw new nD($w.STREAM_NOT_EXIST,"stream not exist");f.label=1;case 1:return f.trys.push([1,3,,4]),l=t,this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?t=jf.NONE:this._pauseAllSubscribeState.audio&&!this._pauseAllSubscribeState.video?t===jf.AUDIO_AND_VIDEO?t=jf.VIDEO_ONLY:t===jf.AUDIO_ONLY&&(t=jf.NONE):!this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video&&(t===jf.AUDIO_AND_VIDEO?t=jf.AUDIO_ONLY:t===jf.VIDEO_ONLY&&(t=jf.NONE)),t!==l&&fz.print("subscribeUserStream","due to pauseAllState change sub mediaType from ".concat(l," to ").concat(t)),[4,this._room.subscribe(u,t,n)];case 2:return f.sent(),t!==jf.AUDIO_AND_VIDEO&&t!==jf.AUDIO_ONLY||this._updateAudioPlayerState(u),t!==jf.AUDIO_AND_VIDEO&&t!==jf.VIDEO_ONLY||this._updateVideoPlayerState(u),((null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)||(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo))&&(u.audioTrack||u.videoTrack)&&(p={userId:e,isScreen:d,state:Mf.SUBSCRIBE_SUCC},this.safeEmit(n_.onAutoSubscribeResult,p)),[3,4];case 3:throw h=f.sent(),((null===(a=this._roomConfig)||void 0===a?void 0:a.isAutoSubscribeAudio)||(null===(s=this._roomConfig)||void 0===s?void 0:s.isAutoSubscribeVideo))&&(p={userId:e,isScreen:d,state:Mf.SUBSCRIBE_FAIL},this.safeEmit(n_.onAutoSubscribeResult,p)),h;case 4:return[2]}}))}))},t.prototype.unSubscribe=function(e,t){return Wf(this,void 0,void 0,(function(){var r,n;return qf(this,(function(i){switch(i.label){case 0:if(fz.print("unSubscribe()","userId: %s, isScreen: %o",e,t),bk(e),fk(t,"isScreen"),!this._room||this._room.connectionState!==jx.CONNECTED)throw new nD($w.SUBSCRIBE_BEFORE_JOIN,"join first");if(r=this._room.remoteStreams.get(e),!(n=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 nD($w.STREAM_NOT_EXIST,"stream not exist");return[4,this._room.unsubscribe(n)];case 1:return i.sent(),this._updateAudioPlayerState(n),this._updateVideoPlayerState(n),[2]}}))}))},t.prototype.startVideoCapture=function(e){return Wf(this,void 0,void 0,(function(){var t,r,n;return qf(this,(function(i){switch(i.label){case 0:if(fz.print("startVideoCapture()","deviceId: %s",e),yk(e)||vk(e,"deviceId"),this._localVideoTrack)throw new nD($w.REPEAT_CAPTURE,"Has already capture");return t=this._videoStreamConstraints,e&&(t.deviceId={exact:e},this._videoStreamConstraints=t),[4,eB(t)];case 1:return r=i.sent(),this._initLocalTrackEvents(r),this._localVideoTrack=r,this._videoPlayer&&this._videoPlayer.playVideo(r),this._room?(n=this._room._roomConfig.isAutoPublish,this._room.hasPublished||n?[4,this._updatePublish()]:[3,3]):[2];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype.stopVideoCapture=function(){var e;return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){switch(t.label){case 0:if(fz.print("stopVideoCapture()"),this._trackSourceType.video===Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new nD($w.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return this._videoPlayer&&this._videoPlayer.stop(),null===(e=this._localVideoTrack)||void 0===e||e.close(),this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.startAudioCapture=function(e){return Wf(this,void 0,void 0,(function(){var t,r,n;return qf(this,(function(i){switch(i.label){case 0:if(fz.print("startAudioCapture()","deviceId: $o",e),yk(e)||vk(e,"deviceId"),this._localAudioTrack)throw new nD($w.REPEAT_CAPTURE,"Has already capture");return t=this._audioStreamConstraints,e&&(t.deviceId={exact:e},this._audioStreamConstraints=t),[4,tB(t)];case 1:return r=i.sent(),this._initLocalTrackEvents(r),this._localAudioTrack=r,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(n=this._room._roomConfig.isAutoPublish,this._room.hasPublished||n?[4,this._updatePublish()]:[3,3]):[2];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype.stopAudioCapture=function(){var e;return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){switch(t.label){case 0:if(fz.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 nD($w.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.getAudioMixingManager=function(){return fz.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,r;return void 0===e&&(e={}),Wf(this,void 0,void 0,(function(){var n,i,o,a;return qf(this,(function(s){switch(s.label){case 0:if(fz.print("startScreenCapture()","config: %o",e),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localScreenVideoTrack=void 0,n=e.enableAudio,i=void 0!==n&&n,this._trackSourceType.screenVideo===Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new nD($w.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new nD($w.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,rB(i)];case 1:return o=s.sent(),this._localScreenVideoTrack=new JV(o.getVideoTracks()[0],ik()),(a=o.getAudioTracks()).length&&(this._localScreenAudioTrack=new ZV(a[0],ik()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(r=this._screenPlayer)||void 0===r||r.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,r;return Wf(this,void 0,void 0,(function(){return qf(this,(function(n){return fz.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localScreenVideoTrack=void 0,null===(r=this._localScreenAudioTrack)||void 0===r||r.close(),this._localScreenAudioTrack=void 0,[2]}))}))},t.prototype.publishScreen=function(){return Wf(this,void 0,void 0,(function(){var e;return qf(this,(function(t){switch(t.label){case 0:if(fz.print("publishScreen()"),!this._room||this._room.connectionState!==jx.CONNECTED)throw new nD($w.PUBLISH_BEFORE_JOIN,"join first");if(!this._visibility)throw new nD($w.NO_PUBLISH_PERMISSION,"no publish permission");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof nD?e:new nD($w.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.unpublishScreen=function(){return Wf(this,void 0,void 0,(function(){var e;return qf(this,(function(t){switch(t.label){case 0:if(fz.print("unpublishScreen()"),!this._room)throw new nD($w.UNPUBLISH_BEFORE_JOIN,"join first");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._room.unpublishScreen()];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof nD?e:new nD($w.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var r,n;if(fz.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),mk(e,"streamIndex",[Bf.STREAM_INDEX_MAIN,Bf.STREAM_INDEX_SCREEN]),t&&t.renderDom)return Tk(t),e==Bf.STREAM_INDEX_MAIN?(this._videoPlayer=new gB(t),this._initPlayerEvents(this._videoPlayer),this._localVideoTrack&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.mirror(!!this._mirrorType),this._videoPlayer.domElement):(this._screenPlayer=new gB(Yf(Yf({},t),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement);e==Bf.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(n=this._screenPlayer)||void 0===n||n.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return Wf(this,void 0,void 0,(function(){var r;return qf(this,(function(n){switch(n.label){case 0:fz.print("startLiveTranscoding()","transcode: %o",e),vk(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.controlMessage(nP("started",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof nD?r:new nD($w.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return Wf(this,void 0,void 0,(function(){var r;return qf(this,(function(n){switch(n.label){case 0:if(fz.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=Hj(this._liveTranscodeConfig,e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.controlMessage(nP("layoutChanged",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof nD?r:new nD($w.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return Wf(this,void 0,void 0,(function(){var t;return qf(this,(function(r){switch(r.label){case 0:if(fz.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.controlMessage({action:"stopped",type:"transcode"})];case 2:return r.sent(),[3,4];case 3:throw(t=r.sent())instanceof nD?t:new nD($w.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return fz.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(xL.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){switch(t.label){case 0:if(fz.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==jx.CONNECTED)throw new nD($w.NOT_CONNECTED_YET,"server not connected");return!e?[4,this._room.unpublish()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?dz.NORMAL_USER:dz.SILENT_USER})];case 3:return t.sent(),this._visibility=e,[2]}}))}))},t.prototype._initPlayerEvents=function(e){var t=this;e.on("playback_event",(function(r){var n,i;switch(r.eventName){case"timeupdate":return;case"loadeddata":if("audio"===r.type)t.safeEmit(n_.onAudioFirstFrameDecoded,{userId:e.userId}),UL.firstRemoteAudioRender("",r.userId);else{var o={userId:e.userId,height:(null===(n=e.domElement)||void 0===n?void 0:n.videoHeight)||0,width:(null===(i=e.domElement)||void 0===i?void 0:i.videoWidth)||0};t.safeEmit(n_.onVideoFirstFrameDecoded,o),t.safeEmit(n_.onVideoFirstFrameRendered,o),UL.firstRemoteVideoRender("",r.userId)}break;case"autoplay-error":return void t.safeEmit(n_.onAutoplayFailed,r)}t.safeEmit(n_.onPlayerEvent,r)}))},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(n_.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var r,n,i,o,a,s;fz.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),mk(e,"streamIndex",[Bf.STREAM_INDEX_MAIN,Bf.STREAM_INDEX_SCREEN]),Tk(t);var c=t.userId;if(t.renderDom){if(e==Bf.STREAM_INDEX_MAIN){null===(r=this._remoteVideoPlayer.get(c))||void 0===r||r.destroy();var u=new gB(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(i=null===(n=this._room)||void 0===n?void 0:n.remoteStreams.get(c))||void 0===i?void 0:i.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 gB(Yf(Yf({},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._stopRemotePlayer(c,e===Bf.STREAM_INDEX_SCREEN)},t.prototype.setLocalVideoMirrorType=function(e){fz.print("setLocalVideoMirrorType()","mirrorType: %o",e),mk(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 Wf(this,void 0,void 0,(function(){var r;return qf(this,(function(n){switch(n.label){case 0:return fz.print("setAudioPlaybackDevice()","deviceId: %s",e),vk(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(fz.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,MV.getDeviceById(e)];case 1:if(!(r=n.sent()))throw new nD($w.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(n_.onAudioPlaybackDeviceChanged,r),UL.rtcAudioDevice(rL.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){return Wf(this,void 0,void 0,(function(){var t,r;return qf(this,(function(n){if(fz.print("play()","userId: %s",e),bk(e),t=this._remoteAudioPlayer.get(e),r=this._remoteVideoPlayer.get(e),t||(t=this._audioPlayer),r||(r=this._videoPlayer),!t&&!r)throw new nD($w.INVALID_PARAMS,"Player not found");return t&&t.manuallyPlay(),r&&r.manuallyPlay(),[2]}))}))},t.prototype.muteLocalAudio=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){if(fz.print("muteLocalAudio()","muteState: %o",e),mk(e,"muteState",[Pf.MUTE_STATE_OFF,Pf.MUTE_STATE_ON]),!this._room)throw new nD($w.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("audio",e)]}))}))},t.prototype.muteLocalVideo=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){if(fz.print("muteLocalVideo()","muteState: %o",e),mk(e,"muteState",[Pf.MUTE_STATE_OFF,Pf.MUTE_STATE_ON]),!this._room)throw new nD($w.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("video",e)]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return Wf(this,void 0,void 0,(function(){var t,r=this;return qf(this,(function(n){return fz.print("pauseAllSubscribedStream()","mediaType: %o",e),mk(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 Wf(this,void 0,void 0,(function(){var t,r=this;return qf(this,(function(n){return fz.print("resumeAllSubscribedStream()","mediaType: %o",e),mk(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,n;t(),null===(n=null===(e=r._room)||void 0===e?void 0:e.remoteStreams)||void 0===n||n.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 Wf(this,void 0,void 0,(function(){return qf(this,(function(r){if(bk(e),Ik(t),!this._room||this._room.connectionState!==jx.CONNECTED)throw new nD($w.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){return Wf(this,void 0,void 0,(function(){return qf(this,(function(r){if(bk(e),gk(t,"message"),Ik(t),!this._room||this._room.connectionState!==jx.CONNECTED)throw new nD($w.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendRoomMessage=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){if(Ik(e),!this._room||this._room.connectionState!==jx.CONNECTED)throw new nD($w.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e)]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){if(Ik(e),!this._room||this._room.connectionState!==jx.CONNECTED)throw new nD($w.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e,!0)]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),Wf(this,void 0,void 0,(function(){var r;return qf(this,(function(n){switch(n.label){case 0:return fz.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,Sk(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:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),Wf(this,void 0,void 0,(function(){var r;return qf(this,(function(n){switch(n.label){case 0:return fz.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,Sk(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:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setVideoEncoderConfig=function(e,t){var r,n,i,o,a,s,c,u;return Wf(this,void 0,void 0,(function(){return qf(this,(function(d){if(fz.print("setVideoEncoderConfig()","streamIndex: %o, descriptions: %o",e,t),mk(e,"streamIndex",[Bf.STREAM_INDEX_MAIN,Bf.STREAM_INDEX_SCREEN]),function(e,t){if(!Array.isArray(e))throw new nD($w.INVALID_PARAMS,"Invalid ".concat(t,", should be array"))}(t,"descriptions"),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),e===Bf.STREAM_INDEX_MAIN){if(null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.hasPublished){if(1!==this._videoStreamEncodeConfig.length||1!==(null==t?void 0:t.length))throw new nD($w.INVALID_PARAMS,"After publishing, only non simulcast streams can be modified");null===(o=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===o||o.updateVideoBitrate(t)}this._videoStreamEncodeConfig=t}else{if(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished){if(1!==this._screenStreamEncodeConfig.length||1!==(null==t?void 0:t.length))throw new nD($w.INVALID_PARAMS,"After publishing, only non simulcast streams can be modified");null===(u=null===(c=this._room)||void 0===c?void 0:c.localScreenStream)||void 0===u||u.updateVideoBitrate([t[0]])}this._screenStreamEncodeConfig=t}return[2]}))}))},t.prototype.sendSEIMessage=function(e,t,r){var n,i,o,a,s,c;fz.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),mk(e,"streamIndex",[Bf.STREAM_INDEX_MAIN,Bf.STREAM_INDEX_SCREEN]),_k(r,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(ck.str2ab(t)):t;if(t.length){var d;if(e===Bf.STREAM_INDEX_MAIN){if(!(null===(i=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===i?void 0:i.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)fz.print("sei size must not bigger than 4KB");else{var l=ik();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 fz.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;fz.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,n,i,o;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n,i;if(0!==e.length){var o=null===(i=null===(n=e[0])||void 0===n?void 0:n.audioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:t,volume:o||0})}}));var a=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:(null===(o=null===(i=t._room)||void 0===i?void 0:i.roomInfo)||void 0===o?void 0:o.userInfo.userId)||"local_user",volume:a||0}),t.safeEmit(n_.onAudioVolumeIndication,{speakers:r})}),e)},t.prototype.setVideoSourceType=function(e,t){var r,n,i,o,a;return Wf(this,void 0,void 0,(function(){var s,c;return qf(this,(function(u){switch(u.label){case 0:return fz.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),mk(e,"streamIndex",[Bf.STREAM_INDEX_MAIN,Bf.STREAM_INDEX_SCREEN]),mk(t,"VideoSourceType",[Of.VIDEO_SOURCE_TYPE_EXTERNAL,Of.VIDEO_SOURCE_TYPE_INTERNAL]),s=e===Bf.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[s]===t?[3,4]:(this._trackSourceType[s]=t,fz.print("setVideoSourceType","set ".concat(s," source type to ").concat(t)),this._localVideoTrack&&e===Bf.STREAM_INDEX_MAIN?(t===Of.VIDEO_SOURCE_TYPE_EXTERNAL&&this._localVideoTrack.close(),null===(r=this._videoPlayer)||void 0===r||r.stop(),this._localVideoTrack=void 0,c=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,(null===(i=this._room)||void 0===i?void 0:i.hasPublished)||c?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:u.sent(),u.label=2;case 2:return this._localScreenVideoTrack&&e===Bf.STREAM_INDEX_SCREEN?(t===Of.VIDEO_SOURCE_TYPE_EXTERNAL&&this._localScreenVideoTrack.close(),null===(o=this._screenPlayer)||void 0===o||o.stop(),this._localScreenVideoTrack=void 0,(null===(a=this._room)||void 0===a?void 0:a.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:u.sent(),u.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var r,n,i,o,a;return Wf(this,void 0,void 0,(function(){var s;return qf(this,(function(c){switch(c.label){case 0:if(fz.print("setExternalVideoTrack()","index: %o, track: %o",e,t),mk(e,"streamIndex",[Bf.STREAM_INDEX_MAIN,Bf.STREAM_INDEX_SCREEN]),e!==Bf.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new nD($w.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new $V(t,ik()),this._initLocalTrackEvents(this._localVideoTrack),null===(r=this._videoPlayer)||void 0===r||r.playVideo(this._localVideoTrack),s=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,(null===(i=this._room)||void 0===i?void 0:i.hasPublished)||s?[4,this._updatePublish()]:[3,2];case 1:c.sent(),c.label=2;case 2:if(e!==Bf.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new nD($w.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new $V(t,ik()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),(null===(a=this._room)||void 0===a?void 0:a.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:c.sent(),c.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var r,n,i;return Wf(this,void 0,void 0,(function(){var o,a;return qf(this,(function(s){switch(s.label){case 0:return fz.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),mk(e,"streamIndex",[Bf.STREAM_INDEX_MAIN,Bf.STREAM_INDEX_SCREEN]),mk(t,"audioSourceType",[Nf.AUDIO_SOURCE_TYPE_EXTERNAL,Nf.AUDIO_SOURCE_TYPE_INTERNAL]),o=e===Bf.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[o]===t?[3,4]:(this._trackSourceType[o]=t,fz.print("setVideoSourceType","set ".concat(o," source type to ").concat(t)),this._localAudioTrack&&e===Bf.STREAM_INDEX_MAIN?(this._trackSourceType.audio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL&&this._localAudioTrack.close(),this._localAudioTrack=void 0,a=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||a?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:s.sent(),s.label=2;case 2:return this._localScreenAudioTrack&&e===Bf.STREAM_INDEX_SCREEN?(this._trackSourceType.audio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL&&this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0,(null===(i=this._room)||void 0===i?void 0:i.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:s.sent(),s.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var r,n,i;return Wf(this,void 0,void 0,(function(){var o;return qf(this,(function(a){switch(a.label){case 0:if(fz.print("setExternalAudioTrack()","index: %o, track: %o",e,t),mk(e,"streamIndex",[Bf.STREAM_INDEX_MAIN,Bf.STREAM_INDEX_SCREEN]),e!==Bf.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new nD($w.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new QV(t,ik()),this._initLocalTrackEvents(this._localAudioTrack),o=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||o?[4,this._updatePublish()]:[3,2];case 1:a.sent(),a.label=2;case 2:if(e!==Bf.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new nD($w.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new QV(t,ik()),this._initLocalTrackEvents(this._localScreenAudioTrack),(null===(i=this._room)||void 0===i?void 0:i.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:a.sent(),a.label=4;case 4:return[2]}}))}))},t.prototype.login=function(e,t){return Wf(this,void 0,void 0,(function(){return qf(this,(function(r){return fz.print("login()","token: %o, userInfo: %o",e,t),yk(e)||vk(e,"token"),bk(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return Wf(this,void 0,void 0,(function(){return qf(this,(function(e){return fz.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){return fz.print("updateLoginToken()","token: %o",e),yk(e)||vk(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){return fz.print("getPeerOnlineStatus()","userId: %o",e),bk(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return Wf(this,void 0,void 0,(function(){return qf(this,(function(r){return bk(e),Ik(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return Wf(this,void 0,void 0,(function(){return qf(this,(function(r){return bk(e),gk(t,"message"),Ik(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.setServerParams=function(e,t){return Wf(this,void 0,void 0,(function(){return qf(this,(function(r){return fz.print("setServerParams()","signature: %o, url: %0",e,t),vk(e,"signature"),vk(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){return vk(e,"message"),Ik(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.sendServerBinaryMessage=function(e){return Wf(this,void 0,void 0,(function(){return qf(this,(function(t){return gk(e,"message"),Ik(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(iP))},t.prototype._updatePublish=function(){return Wf(this,void 0,void 0,(function(){var e,t;return qf(this,(function(r){switch(r.label){case 0:if(fz.print("_updatePublish()"),!this._visibility)throw new nD($w.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==jx.CONNECTED)return e(),[2];r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._localVideoTrack,this._localAudioTrack)];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof nD?t:new nD($w.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateScreenPublish=function(){return Wf(this,void 0,void 0,(function(){var e,t;return qf(this,(function(r){switch(r.label){case 0:return fz.print("_updateScreenPublish()"),[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==jx.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 nD?t:new nD($w.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){fz.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen;if(t=n?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack){if(!t){var i=n?"".concat(r,"_screen"):r;t=new SB(i),this._initPlayerEvents(t),this._remoteAudioPlayer.set(i,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}t.playAudio(e.audioTrack)}else null==t||t.stop()},t.prototype._updateVideoPlayerState=function(e){fz.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,n,i,o=e.stream,a={userId:o.userId,isScreen:o.isScreen,hasVideo:o.hasVideo,hasAudio:o.hasAudio,videoStreamDescriptions:o.attributes.videoDescriptions};this.safeEmit(n_.onStreamAdd,{stream:a});var s=null;(null===(t=this._roomConfig)||void 0===t?void 0:t.isAutoSubscribeAudio)&&(s=jf.AUDIO_ONLY),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(s=jf.VIDEO_ONLY),(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeVideo)&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(s=jf.AUDIO_AND_VIDEO),fz.print("_onAddStream","autoSubType: ".concat(s)),null===s||o.isScreen||this.subscribeUserStream(o.userId,s)},t.prototype._onRemoveStream=function(e){var t=e.stream,r={userId:t.userId,isScreen:t.isScreen,hasVideo:t.hasVideo,hasAudio:t.hasAudio,videoStreamDescriptions:[]},n=vz[e.reason]||Ff.STREAM_REMOVE_REASON_OTHER;this.safeEmit(n_.onStreamRemove,{stream:r,reason:n}),this._stopRemotePlayer(t.userId,t.isScreen)},t.prototype._onUserConnection=function(e){this.safeEmit(n_.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(n_.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(n_.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onConnectionStateChange=function(e){this.safeEmit(n_.onConnectionStateChanged,e)},t.prototype._stopRemotePlayer=function(e,t){var r,n,i;null===(r=this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):e))||void 0===r||r.stop(),t?null===(n=this._remoteScreenPlayer.get(e))||void 0===n||n.stop():null===(i=this._remoteVideoPlayer.get(e))||void 0===i||i.stop()},t.prototype._onResubscribe=function(e){e.stream&&(this._stopRemotePlayer(e.stream.userId,e.stream.isScreen),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(n_.onVideoFirstFrameDecoded,e)},t.prototype._onDeviceStateChange=function(e){this.safeEmit(n_.onMediaDeviceStateChanged,e)},t.prototype._onUserMuteAudio=function(e){this.safeEmit(n_.onUserMuteAudio,e)},t.prototype._onUserMuteVideo=function(e){this.safeEmit(n_.onUserMuteVideo,e)},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(n_.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(n_.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this.safeEmit(n_.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(n_.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(n_.onLiveTranscodingResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t.safeEmit(n_.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t.safeEmit(n_.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(n_.onError,{errorCode:$w.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(n_.onError,{errorCode:$w.RTM_TOKEN_ERROR})}))},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}),Xf([BL()],t.prototype,"updateToken",null),Xf([BL()],t.prototype,"switchCamera",null),Xf([BL()],t.prototype,"switchMicrophone",null),Xf([BL()],t.prototype,"joinRoom",null),Xf([BL()],t.prototype,"leaveRoom",null),Xf([BL()],t.prototype,"destroy",null),Xf([BL()],t.prototype,"publish",null),Xf([BL()],t.prototype,"unpublish",null),Xf([BL()],t.prototype,"subscribeUserStream",null),Xf([BL()],t.prototype,"unSubscribe",null),Xf([BL()],t.prototype,"startVideoCapture",null),Xf([BL()],t.prototype,"stopVideoCapture",null),Xf([BL()],t.prototype,"startAudioCapture",null),Xf([BL()],t.prototype,"stopAudioCapture",null),Xf([BL()],t.prototype,"getAudioMixingManager",null),Xf([BL()],t.prototype,"startScreenCapture",null),Xf([BL()],t.prototype,"stopScreenCapture",null),Xf([BL()],t.prototype,"publishScreen",null),Xf([BL()],t.prototype,"unpublishScreen",null),Xf([BL()],t.prototype,"setLocalVideoPlayer",null),Xf([BL()],t.prototype,"startLiveTranscoding",null),Xf([BL()],t.prototype,"updateLiveTranscoding",null),Xf([BL()],t.prototype,"stopLiveTranscoding",null),Xf([BL()],t.prototype,"setBusinessId",null),Xf([BL()],t.prototype,"setUserVisibility",null),Xf([BL()],t.prototype,"setRemoteVideoPlayer",null),Xf([BL()],t.prototype,"setLocalVideoMirrorType",null),Xf([BL()],t.prototype,"setAudioPlaybackDevice",null),Xf([BL()],t.prototype,"play",null),Xf([BL()],t.prototype,"muteLocalAudio",null),Xf([BL()],t.prototype,"muteLocalVideo",null),Xf([BL()],t.prototype,"pauseAllSubscribedStream",null),Xf([BL()],t.prototype,"resumeAllSubscribedStream",null),Xf([BL()],t.prototype,"sendUserMessage",null),Xf([BL()],t.prototype,"sendUserBinaryMessage",null),Xf([BL()],t.prototype,"sendRoomMessage",null),Xf([BL()],t.prototype,"sendRoomBinaryMessage",null),Xf([BL()],t.prototype,"setAudioCaptureConfig",null),Xf([BL()],t.prototype,"setVideoCaptureConfig",null),Xf([BL()],t.prototype,"setVideoEncoderConfig",null),Xf([BL()],t.prototype,"sendSEIMessage",null),Xf([BL()],t.prototype,"setAudioVolumeIndicationInterval",null),Xf([BL()],t.prototype,"setVideoSourceType",null),Xf([BL()],t.prototype,"setExternalVideoTrack",null),Xf([BL()],t.prototype,"setAudioSourceType",null),Xf([BL()],t.prototype,"setExternalAudioTrack",null),Xf([BL(!0)],t.prototype,"login",null),Xf([BL(!0)],t.prototype,"logout",null),Xf([BL(!0)],t.prototype,"updateLoginToken",null),Xf([BL(!0)],t.prototype,"getPeerOnlineStatus",null),Xf([BL(!0)],t.prototype,"sendUserMessageOutsideRoom",null),Xf([BL(!0)],t.prototype,"sendUserBinaryMessageOutsideRoom",null),Xf([BL(!0)],t.prototype,"setServerParams",null),Xf([BL(!0)],t.prototype,"sendServerMessage",null),Xf([BL(!0)],t.prototype,"sendServerBinaryMessage",null),t}(kk),vz={"client unpublished":Ff.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":Ff.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":Ff.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":Ff.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":Ff.STREAM_REMOVE_REASON_REPUBLISH},mz=new wk("VERTC",0),Ez=function(e){return mz.print("createEngine","Invoke VERTC.createEngine"),vk(e,"appId"),[xL,VL].forEach((function(t){return t.setStats({rtc_app_id:e,rtc_sdk_version:Rz(),product_line:DU.RTC,report_version:kU.W_5,os:PU.WEB,device_id:QL.getDeviceId(),user_agent:null===navigator||void 0===navigator?void 0:navigator.userAgent})})),UL.sdkInitEngine(Date.now(),cL.BEGIN),new _z(e)},gz=function(e){if(mz.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof _z))throw new nD($w.INVALID_ENGINE,"Invalid engine object");e.destroy(),UL.sdkInitEngine(Date.now(),cL.END)},Sz=function(){return Wf(void 0,void 0,void 0,(function(){return qf(this,(function(e){return[2,MV.getDevices()]}))}))},yz=function(e){return void 0===e&&(e={video:!0,audio:!0}),Wf(void 0,void 0,void 0,(function(){var t,r,n,i,o;return qf(this,(function(a){switch(a.label){case 0:if(t=e.video,r=e.audio,n={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),i=n,[4,MV.getVideoPermission()];case 2:return i.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=n,[4,MV.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,n]}}))}))},bz=function(){return Wf(void 0,void 0,void 0,(function(){return qf(this,(function(e){return[2,MV.getMicrophones()]}))}))},Tz=function(){return Wf(void 0,void 0,void 0,(function(){return qf(this,(function(e){return[2,MV.getCameras()]}))}))},Iz=function(){return Wf(void 0,void 0,void 0,(function(){return qf(this,(function(e){return[2,MV.getAudioPlayback()]}))}))},Rz=function(){return eP.VERSION};!sk()&&location.search.includes("_rtc_autotest_");var Az=new function(){this.getSdkVersion=Rz,this.createEngine=Ez,this.destroyEngine=gz,this.getDevices=Sz,this.enableDevices=yz,this.getMicrophones=bz,this.getCameras=Tz,this.getAudioPlayback=Iz,this.getParameter=rP,this.setParameter=tP,this.isSupported=Nx,this.events=n_,this.ErrorCode=$w,this.platform="BytePlus",this._monitor=UL};return Yf(Yf(Yf(Yf({},Az),r_),i_),{events:n_})}));
|