@byteplus/rtc 4.40.0 → 4.41.2

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.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.40.0
4
+ * version: 4.41.2
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={},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_})}));
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,S=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},E=c,y=Function.prototype,g=y.bind,b=y.call,T=E&&g.bind(b,b),I=E?function(e){return e&&T(e)}:function(e){return e&&function(){return b.apply(e,arguments)}},A=I,R=A({}.toString),C=A("".slice),O=function(e){return C(R(e),8,-1)},N=I,w=a,P=O,D=i.Object,k=N("".split),M=w((function(){return!D("z").propertyIsEnumerable(0)}))?function(e){return"String"==P(e)?k(e,""):D(e)}:D,U=i.TypeError,L=function(e){if(null==e)throw U("Can't call method on "+e);return e},x=M,V=L,F=function(e){return x(V(e))},B=function(e){return"function"==typeof e},j=B,G=function(e){return"object"==typeof e?null!==e:j(e)},H=i,z=B,K=function(e){return z(e)?e:void 0},Y=function(e,t){return arguments.length<2?K(H[e]):H[e]&&H[e][t]},X=I({}.isPrototypeOf),W=Y("navigator","userAgent")||"",J=i,q=W,Z=J.process,$=J.Deno,Q=Z&&Z.versions||$&&$.version,ee=Q&&Q.v8;ee&&(m=(v=ee.split("."))[0]>0&&v[0]<4?1:+(v[0]+v[1])),!m&&q&&(!(v=q.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=q.match(/Chrome\/(\d+)/))&&(m=+v[1]);var te=m,re=te,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=B,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=B,_e=pe,ve=i.TypeError,me=function(e){if(fe(e))return e;throw ve(_e(e)+" is not a function")},Se=me,Ee=function(e,t){var r=e[t];return null==r?void 0:Se(r)},ye=l,ge=B,be=G,Te=i.TypeError,Ie={exports:{}},Ae=i,Re=Object.defineProperty,Ce=function(e,t){try{Re(Ae,e,{value:t,configurable:!0,writable:!0})}catch(r){Ae[e]=t}return t},Oe=Ce,Ne="__core-js_shared__",we=i[Ne]||Oe(Ne,{}),Pe=we;(Ie.exports=function(e,t){return Pe[e]||(Pe[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 De=L,ke=i.Object,Me=function(e){return ke(De(e))},Ue=Me,Le=I({}.hasOwnProperty),xe=Object.hasOwn||function(e,t){return Le(Ue(e),t)},Ve=I,Fe=0,Be=Math.random(),je=Ve(1..toString),Ge=function(e){return"Symbol("+(void 0===e?"":e)+")_"+je(++Fe+Be,36)},He=i,ze=Ie.exports,Ke=xe,Ye=Ge,Xe=ie,We=oe,Je=ze("wks"),qe=He.Symbol,Ze=qe&&qe.for,$e=We?qe:qe&&qe.withoutSetter||Ye,Qe=function(e){if(!Ke(Je,e)||!Xe&&"string"!=typeof Je[e]){var t="Symbol."+e;Xe&&Ke(qe,e)?Je[e]=qe[e]:Je[e]=We&&Ze?Ze(t):$e(t)}return Je[e]},et=l,tt=G,rt=le,nt=Ee,it=function(e,t){var r,n;if("string"===t&&ge(r=e.toString)&&!be(n=ye(r,e)))return n;if(ge(r=e.valueOf)&&!be(n=ye(r,e)))return n;if("string"!==t&&ge(r=e.toString)&&!be(n=ye(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})),St=s,Et=l,yt=h,gt=S,bt=F,Tt=lt,It=xe,At=mt,Rt=Object.getOwnPropertyDescriptor;o.f=St?Rt:function(e,t){if(e=bt(e),t=Tt(t),At)try{return Rt(e,t)}catch(e){}if(It(e,t))return gt(!Et(yt.f,e,t),e[t])};var Ct={},Ot=s&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Nt=i,wt=G,Pt=Nt.String,Dt=Nt.TypeError,kt=function(e){if(wt(e))return e;throw Dt(Pt(e)+" is not an object")},Mt=s,Ut=mt,Lt=Ot,xt=kt,Vt=lt,Ft=i.TypeError,Bt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,Gt="enumerable",Ht="configurable",zt="writable";Ct.f=Mt?Lt?function(e,t,r){if(xt(e),t=Vt(t),xt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&zt in r&&!r.writable){var n=jt(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 Bt(e,t,r)}:Bt:function(e,t,r){if(xt(e),t=Vt(t),xt(r),Ut)try{return Bt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Ft("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Kt=Ct,Yt=S,Xt=s?function(e,t,r){return Kt.f(e,t,Yt(1,r))}:function(e,t,r){return e[t]=r,e},Wt={exports:{}},Jt=B,qt=we,Zt=I(Function.toString);Jt(qt.inspectSource)||(qt.inspectSource=function(e){return Zt(e)});var $t,Qt,er,tr=qt.inspectSource,rr=B,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,Sr=ur,Er=dr,yr="Object already initialized",gr=hr.TypeError,br=hr.WeakMap;if(lr||mr.state){var Tr=mr.state||(mr.state=new br),Ir=pr(Tr.get),Ar=pr(Tr.has),Rr=pr(Tr.set);$t=function(e,t){if(Ar(Tr,e))throw new gr(yr);return t.facade=e,Rr(Tr,e,t),t},Qt=function(e){return Ir(Tr,e)||{}},er=function(e){return Ar(Tr,e)}}else{var Cr=Sr("state");Er[Cr]=!0,$t=function(e,t){if(vr(e,Cr))throw new gr(yr);return t.facade=e,_r(e,Cr,t),t},Qt=function(e){return vr(e,Cr)?e[Cr]:{}},er=function(e){return vr(e,Cr)}}var Or={set:$t,get:Qt,has:er,enforce:function(e){return er(e)?Qt(e):$t(e,{})},getterFor:function(e){return function(t){var r;if(!fr(t)||(r=Qt(t)).type!==e)throw gr("Incompatible receiver, "+e+" required");return r}}},Nr=s,wr=xe,Pr=Function.prototype,Dr=Nr&&Object.getOwnPropertyDescriptor,kr=wr(Pr,"name"),Mr={EXISTS:kr,PROPER:kr&&"something"===function(){}.name,CONFIGURABLE:kr&&(!Nr||Nr&&Dr(Pr,"name").configurable)},Ur=i,Lr=B,xr=xe,Vr=Xt,Fr=Ce,Br=tr,jr=Mr.CONFIGURABLE,Gr=Or.get,Hr=Or.enforce,zr=String(String).split("String");(Wt.exports=function(e,t,r,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")||jr&&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:Fr(t,r)})(Function.prototype,"toString",(function(){return Lr(this)&&Gr(this).source||Br(this)}));var Kr={},Yr=Math.ceil,Xr=Math.floor,Wr=function(e){var t=+e;return t!=t||0===t?0:(t>0?Xr:Yr)(t)},Jr=Wr,qr=Math.max,Zr=Math.min,$r=function(e,t){var r=Jr(e);return r<0?qr(r+t,0):Zr(r,t)},Qr=Wr,en=Math.min,tn=function(e){return e>0?en(Qr(e),9007199254740991):0},rn=tn,nn=function(e){return rn(e.length)},on=F,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=F,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,Sn=vn.concat("length","prototype");Kr.f=Object.getOwnPropertyNames||function(e){return mn(e,Sn)};var En={};En.f=Object.getOwnPropertySymbols;var yn=Y,gn=Kr,bn=En,Tn=kt,In=I([].concat),An=yn("Reflect","ownKeys")||function(e){var t=gn.f(Tn(e)),r=bn.f;return r?In(t,r(e)):t},Rn=xe,Cn=An,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];Rn(e,s)||r&&Rn(r,s)||i(e,s,o(t,s))}},Pn=a,Dn=B,kn=/#|\.prototype\./,Mn=function(e,t){var r=Ln[Un(e)];return r==Vn||r!=xn&&(Dn(t)?Pn(t):!!t)},Un=Mn.normalize=function(e){return String(e).replace(kn,".").toLowerCase()},Ln=Mn.data={},xn=Mn.NATIVE="N",Vn=Mn.POLYFILL="P",Fn=Mn,Bn=i,jn=o.f,Gn=Xt,Hn=Wt.exports,zn=Ce,Kn=wn,Yn=Fn,Xn=function(e,t){var r,n,i,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?Bn:u?Bn[s]||zn(s,{}):(Bn[s]||{}).prototype)for(n in t){if(o=t[n],i=e.noTargetGet?(a=jn(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,Jn=B,qn=Wn.String,Zn=Wn.TypeError,$n=I,Qn=kt,ei=function(e){if("object"==typeof e||Jn(e))return e;throw Zn("Can't set "+qn(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=kt,di=F,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=kt,_i=ri,vi=vn,mi=dr,Si=pi,Ei=_t,yi=ur("IE_PROTO"),gi=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=Ei("iframe")).style.display="none",Si.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[yi]=!0;var Ai=Object.create||function(e,t){var r;return null!==e?(gi.prototype=fi(e),r=new gi,gi.prototype=null,r[yi]=e):r=Ii(),void 0===t?r:_i.f(r,t)};Xn({target:"Object",stat:!0,sham:!s},{create:Ai});var Ri=s,Ci=I,Oi=l,Ni=a,wi=oi,Pi=En,Di=h,ki=Me,Mi=M,Ui=Object.assign,Li=Object.defineProperty,xi=Ci([].concat),Vi=!Ui||Ni((function(){if(Ri&&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=ki(e),n=arguments.length,i=1,o=Pi.f,a=Di.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++],Ri&&!Oi(a,c,s)||(r[s]=c[s]);return r}:Ui,Fi=Vi;Xn({target:"Object",stat:!0,forced:Object.assign!==Fi},{assign:Fi});var Bi=a,ji=function(e,t){var r=[][e];return!!r&&Bi((function(){r.call(null,t||function(){throw 1},1)}))},Gi=Xn,Hi=un.indexOf,zi=ji,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,Ji=Function.prototype,qi=Ji.apply,Zi=Ji.call,$i="object"==typeof Reflect&&Reflect.apply||(Wi?Zi.bind(qi):function(){return Zi.apply(qi,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=B,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,So=S,Eo=function(e,t,r){var n=vo(t);n in e?mo.f(e,n,So(0,r)):e[n]=r},yo=$r,go=nn,bo=Eo,To=i.Array,Io=Math.max,Ao=function(e,t,r){for(var n=go(e),i=yo(t,n),o=yo(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},Ro=O,Co=F,Oo=Kr.f,No=Ao,wo="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];_o.f=function(e){return wo&&"Window"==Ro(e)?function(e){try{return Oo(e)}catch(e){return No(wo)}}(e):Oo(Co(e))};var Po=I([].slice),Do={},ko=Qe;Do.f=ko;var Mo=i,Uo=xe,Lo=Do,xo=Ct.f,Vo=function(e){var t=Mo.Symbol||(Mo.Symbol={});Uo(t,e)||xo(t,e,{value:Lo.f(e)})},Fo=Ct.f,Bo=xe,jo=Qe("toStringTag"),Go=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Bo(e,jo)&&Fo(e,jo,{configurable:!0,value:t})},Ho=me,zo=c,Ko=I(I.bind),Yo=function(e,t){return Ho(e),void 0===t?e:zo?Ko(e,t):function(){return e.apply(t,arguments)}},Xo=I,Wo=a,Jo=B,qo=lo,Zo=tr,$o=function(){},Qo=[],ea=Y("Reflect","construct"),ta=/^\s*(?:class|function)\b/,ra=Xo(ta.exec),na=!ta.exec($o),ia=function(e){if(!Jo(e))return!1;try{return ea($o,Qo,e),!0}catch(e){return!1}},oa=function(e){if(!Jo(e))return!1;switch(qo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return 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,Sa=nn,Ea=fa,ya=I([].push),ga=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=Sa(_),S=0,E=l||Ea,y=t?E(c,m):r||a?E(c,0):void 0;m>S;S++)if((s||S in _)&&(p=v(h=_[S],S,f),e))if(t)y[S]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return S;case 2:ya(y,h)}else switch(e){case 4:return!1;case 7:ya(y,h)}return o?-1:n||i?i:y}},ba={forEach:ga(0),map:ga(1),filter:ga(2),some:ga(3),every:ga(4),find:ga(5),findIndex:ga(6),filterReject:ga(7)},Ta=Xn,Ia=i,Aa=Y,Ra=$i,Ca=l,Oa=I,Na=s,wa=ie,Pa=a,Da=xe,ka=eo,Ma=B,Ua=G,La=X,xa=le,Va=kt,Fa=Me,Ba=F,ja=lt,Ga=fo,Ha=S,za=Ai,Ka=oi,Ya=Kr,Xa=_o,Wa=En,Ja=o,qa=Ct,Za=ri,$a=h,Qa=Po,es=Wt.exports,ts=Ie.exports,rs=dr,ns=Ge,is=Qe,os=Do,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,Ss=Ia.TypeError,Es=Ia.QObject,ys=Aa("JSON","stringify"),gs=Ja.f,bs=qa.f,Ts=Xa.f,Is=$a.f,As=Oa([].push),Rs=ts("symbols"),Cs=ts("op-symbols"),Os=ts("string-to-symbol-registry"),Ns=ts("symbol-to-string-registry"),ws=ts("wks"),Ps=!Es||!Es.prototype||!Es.prototype.findChild,Ds=Na&&Pa((function(){return 7!=za(bs({},"a",{get:function(){return bs(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=gs(_s,t);n&&delete _s[t],bs(e,t,r),n&&e!==_s&&bs(_s,t,n)}:bs,ks=function(e,t){var r=Rs[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=ja(t);return Va(r),Da(Rs,n)?(r.enumerable?(Da(e,ds)&&e[ds][n]&&(e[ds][n]=!1),r=za(r,{enumerable:Ha(0,!1)})):(Da(e,ds)||bs(e,ds,Ha(1,{})),e[ds][n]=!0),Ds(e,n,r)):bs(e,n,r)},Us=function(e,t){Va(e);var r=Ba(t),n=Ka(r).concat(Fs(r));return us(n,(function(t){Na&&!Ca(Ls,r,t)||Ms(e,t,r[t])})),e},Ls=function(e){var t=ja(e),r=Ca(Is,this,t);return!(this===_s&&Da(Rs,t)&&!Da(Cs,t))&&(!(r||!Da(this,t)||!Da(Rs,t)||Da(this,ds)&&this[ds][t])||r)},xs=function(e,t){var r=Ba(e),n=ja(t);if(r!==_s||!Da(Rs,n)||Da(Cs,n)){var i=gs(r,n);return!i||!Da(Rs,n)||Da(r,ds)&&r[ds][n]||(i.enumerable=!0),i}},Vs=function(e){var t=Ts(Ba(e)),r=[];return us(t,(function(e){Da(Rs,e)||Da(rs,e)||As(r,e)})),r},Fs=function(e){var t=e===_s,r=Ts(t?Cs:Ba(e)),n=[];return us(r,(function(e){!Da(Rs,e)||t&&!Da(_s,e)||As(n,Rs[e])})),n};(wa||(vs=function(){if(La(ms,this))throw Ss("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Ga(arguments[0]):void 0,t=ns(e),r=function(e){this===_s&&Ca(r,Cs,e),Da(this,ds)&&Da(this[ds],t)&&(this[ds][t]=!1),Ds(this,t,Ha(1,e))};return Na&&Ps&&Ds(_s,t,{configurable:!0,set:r}),ks(t,e)},es(ms=vs.prototype,"toString",(function(){return fs(this).tag})),es(vs,"withoutSetter",(function(e){return ks(ns(e),e)})),$a.f=Ls,qa.f=Ms,Za.f=Us,Ja.f=xs,Ya.f=Xa.f=Vs,Wa.f=Fs,os.f=function(e){return ks(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(Da(Os,t))return Os[t];var r=vs(t);return Os[t]=r,Ns[r]=t,r},keyFor:function(e){if(!xa(e))throw Ss(e+" is not a symbol");if(Da(Ns,e))return Ns[e]},useSetter:function(){Ps=!0},useSimple:function(){Ps=!1}}),Ta({target:"Object",stat:!0,forced:!wa,sham:!Na},{create:function(e,t){return void 0===t?za(e):Us(za(e),t)},defineProperty:Ms,defineProperties:Us,getOwnPropertyDescriptor:xs}),Ta({target:"Object",stat:!0,forced:!wa},{getOwnPropertyNames:Vs,getOwnPropertySymbols:Fs}),Ta({target:"Object",stat:!0,forced:Pa((function(){Wa.f(1)}))},{getOwnPropertySymbols:function(e){return Wa.f(Fa(e))}}),ys)&&Ta({target:"JSON",stat:!0,forced:!wa||Pa((function(){var e=vs();return"[null]"!=ys([e])||"{}"!=ys({a:e})||"{}"!=ys(Object(e))}))},{stringify:function(e,t,r){var n=Qa(arguments),i=t;if((Ua(t)||void 0!==e)&&!xa(e))return ka(t)||(t=function(e,t){if(Ma(i)&&(t=Ca(i,this,e,t)),!xa(t))return t}),n[1]=t,Ra(ys,null,n)}});if(!ms[hs]){var Bs=ms.valueOf;es(ms,hs,(function(e){return Ca(Bs,this)}))}ss(vs,ls),rs[ds]=!0;var js=Xn,Gs=a,Hs=F,zs=o.f,Ks=s,Ys=Gs((function(){zs(1)}));js({target:"Object",stat:!0,forced:!Ks||Ys,sham:!Ks},{getOwnPropertyDescriptor:function(e,t){return zs(Hs(e),t)}});var Xs=lo,Ws=ro?{}.toString:function(){return"[object "+Xs(this)+"]"},Js=ro,qs=Wt.exports,Zs=Ws;Js||qs(Object.prototype,"toString",Zs,{unsafe:!0});var $s=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,Sc=Ee,Ec=hc,yc=Qe("iterator"),gc=function(e){if(null!=e)return Sc(e,yc)||Sc(e,"@@iterator")||Ec[mc(e)]},bc=l,Tc=me,Ic=kt,Ac=pe,Rc=gc,Cc=i.TypeError,Oc=function(e,t){var r=arguments.length<2?Rc(e):t;if(Tc(r))return Ic(bc(r,e));throw Cc(Ac(e)+" is not iterable")},Nc=l,wc=kt,Pc=Ee,Dc=function(e,t,r){var n,i;wc(e);try{if(!(n=Pc(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},kc=Yo,Mc=l,Uc=kt,Lc=pe,xc=vc,Vc=nn,Fc=X,Bc=Oc,jc=gc,Gc=Dc,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=kc(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=jc(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]))&&Fc(Kc,s))return s;return new zc(!1)}n=Bc(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&&Fc(Kc,s))return s}return new zc(!1)},Xc=Qe("iterator"),Wc=!1;try{var Jc=0,qc={next:function(){return{done:!!Jc++}},return:function(){Wc=!0}};qc[Xc]=function(){return this},Array.from(qc,(function(){throw 2}))}catch(e){}var Zc,$c,Qc,eu,tu=function(e,t){if(!t&&!Wc)return!1;var r=!1;try{var 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=kt,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=B,Su=xe,Eu=a,yu=pi,gu=Po,bu=_t,Tu=lu,Iu=hu,Au=pu,Ru=fu.setImmediate,Cu=fu.clearImmediate,Ou=fu.process,Nu=fu.Dispatch,wu=fu.Function,Pu=fu.MessageChannel,Du=fu.String,ku=0,Mu={},Uu="onreadystatechange";try{Zc=fu.location}catch(e){}var Lu=function(e){if(Su(Mu,e)){var t=Mu[e];delete Mu[e],t()}},xu=function(e){return function(){Lu(e)}},Vu=function(e){Lu(e.data)},Fu=function(e){fu.postMessage(Du(e),Zc.protocol+"//"+Zc.host)};Ru&&Cu||(Ru=function(e){Tu(arguments.length,1);var t=mu(e)?e:wu(e),r=gu(arguments,1);return Mu[++ku]=function(){_u(t,void 0,r)},$c(ku),ku},Cu=function(e){delete Mu[e]},Au?$c=function(e){Ou.nextTick(xu(e))}:Nu&&Nu.now?$c=function(e){Nu.now(xu(e))}:Pu&&!Iu?(eu=(Qc=new Pu).port2,Qc.port1.onmessage=Vu,$c=vu(eu.postMessage,eu)):fu.addEventListener&&mu(fu.postMessage)&&!fu.importScripts&&Zc&&"file:"!==Zc.protocol&&!Eu(Fu)?($c=Fu,fu.addEventListener("message",Vu,!1)):$c=Uu in bu("script")?function(e){yu.appendChild(bu("script")).onreadystatechange=function(){yu.removeChild(this),Lu(e)}}:function(e){setTimeout(xu(e),0)});var Bu,ju,Gu,Hu,zu,Ku,Yu,Xu,Wu={set:Ru,clear:Cu},Ju=i,qu=/ipad|iphone|ipod/i.test(W)&&void 0!==Ju.Pebble,Zu=/web0s(?!.*chrome)/i.test(W),$u=i,Qu=Yo,ed=o.f,td=Wu.set,rd=hu,nd=qu,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||(Bu=function(){var e,t;for(od&&(e=cd.domain)&&e.exit();ju;){t=ju.fn,ju=ju.next;try{t()}catch(e){throw ju?Hu():Gu=void 0,e}}Gu=void 0,e&&e.enter()},rd||od||id||!ad||!sd?!nd&&ud&&ud.resolve?((Yu=ud.resolve(void 0)).constructor=ud,Xu=Qu(Yu.then,Yu),Hu=function(){Xu(Bu)}):od?Hu=function(){cd.nextTick(Bu)}:(td=Qu(td,$u),Hu=function(){td(Bu)}):(zu=!0,Ku=sd.createTextNode(""),new ad(Bu).observe(Ku,{characterData:!0}),Hu=function(){Ku.data=zu=!zu}));var hd=ld||function(e){var t={fn:e,next:void 0};Gu&&(Gu.next=t),ju||(ju=t,Hu()),Gu=t},pd={},fd=me,_d=function(e){var t,r;this.promise=new e((function(e,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=kt,md=G,Sd=pd,Ed=function(e,t){if(vd(e),md(t)&&t.constructor===e)return t;var r=Sd.f(e);return(0,r.resolve)(t),r.promise},yd=i,gd=function(){this.head=null,this.tail=null};gd.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var bd,Td,Id,Ad,Rd=gd,Cd="object"==typeof window,Od=Xn,Nd=i,wd=Y,Pd=l,Dd=tc,kd=Wt.exports,Md=nc,Ud=ti,Ld=Go,xd=cc,Vd=me,Fd=B,Bd=G,jd=lc,Gd=tr,Hd=Yc,zd=tu,Kd=uu,Yd=Wu.set,Xd=hd,Wd=Ed,Jd=function(e,t){var r=yd.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},qd=pd,Zd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},$d=Rd,Qd=Or,el=Fn,tl=Cd,rl=pu,nl=te,il=Qe("species"),ol="Promise",al=Qd.getterFor(ol),sl=Qd.set,cl=Qd.getterFor(ol),ul=Dd&&Dd.prototype,dl=Dd,ll=ul,hl=Nd.TypeError,pl=Nd.document,fl=Nd.process,_l=qd.f,vl=_l,ml=!!(pl&&pl.createEvent&&Nd.dispatchEvent),Sl=Fd(Nd.PromiseRejectionEvent),El="unhandledrejection",yl=!1,gl=el(ol,(function(){var e=Gd(dl),t=e!==String(dl);if(!t&&66===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,!(yl=r.then((function(){}))instanceof n)||!t&&tl&&!Sl})),bl=gl||!zd((function(e){dl.all(e).catch((function(){}))})),Tl=function(e){var t;return!(!Bd(e)||!Fd(t=e.then))&&t},Il=function(e,t){var r,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))?Pd(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},Al=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)})))},Rl=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},!Sl&&(i=Nd["on"+e])?i(n):e===El&&Jd("Unhandled promise rejection",r)},Cl=function(e){Pd(Yd,Nd,(function(){var t,r=e.facade,n=e.value;if(Ol(e)&&(t=Zd((function(){rl?fl.emit("unhandledRejection",n,r):Rl(El,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){Pd(Yd,Nd,(function(){var t=e.facade;rl?fl.emit("rejectionHandled",t):Rl("rejectionhandled",t,e.value)}))},wl=function(e,t,r){return function(n){e(t,n,r)}},Pl=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Al(e,!0))},Dl=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{Pd(n,t,wl(Dl,r,e),wl(Pl,r,e))}catch(t){Pl(r,t,e)}})):(e.value=t,e.state=1,Al(e,!1))}catch(t){Pl({done:!1},t,e)}}};if(gl&&(ll=(dl=function(e){jd(this,ll),Vd(e),Pd(bd,this);var t=al(this);try{e(wl(Dl,t),wl(Pl,t))}catch(e){Pl(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=!Fd(e)||e,n.fail=Fd(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(Dl,t),this.reject=wl(Pl,t)},qd.f=_l=function(e){return e===dl||e===Id?new Td(e):vl(e)},Fd(Dd)&&ul!==Object.prototype)){Ad=ul.then,yl||(kd(ul,"then",(function(e,t){var r=this;return new dl((function(e,t){Pd(Ad,r,e,t)})).then(e,t)}),{unsafe:!0}),kd(ul,"catch",ll.catch,{unsafe:!0}));try{delete ul.constructor}catch(e){}Ud&&Ud(ul,ll)}Od({global:!0,wrap:!0,forced:gl},{Promise:dl}),Ld(dl,ol,!1),xd(ol),Id=wd(ol),Od({target:ol,stat:!0,forced:gl},{reject:function(e){var t=_l(this);return Pd(t.reject,void 0,e),t.promise}}),Od({target:ol,stat:!0,forced:gl},{resolve:function(e){return Wd(this,e)}}),Od({target:ol,stat:!0,forced:bl},{all:function(e){var t=this,r=_l(t),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++,Pd(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){Pd(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var kl=Xn,Ml=s,Ul=i,Ll=I,xl=xe,Vl=B,Fl=X,Bl=fo,jl=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:Bl(arguments[0]),t=Fl(zl,this)?new Hl(e):void 0===e?Hl():Hl(e);return""===e&&(Kl[t]=!0),t};Gl(Yl,Hl),Yl.prototype=zl,zl.constructor=Yl;var Xl="Symbol(test)"==String(Hl("test")),Wl=Ll(zl.toString),Jl=Ll(zl.valueOf),ql=/^Symbol\((.*)\)[^)]+$/,Zl=Ll("".replace),$l=Ll("".slice);jl(zl,"description",{configurable:!0,get:function(){var e=Jl(this),t=Wl(e);if(xl(Kl,e))return"";var r=Xl?$l(t,7,-1):Zl(t,ql,"$1");return""===r?void 0:r}}),kl({global:!0,forced:!0},{Symbol:Yl})}Vo("iterator");var Ql=Ai,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=B,lh=Me,hh=sh,ph=ur("IE_PROTO"),fh=ch.Object,_h=fh.prototype,vh=hh?fh.getPrototypeOf:function(e){var t=lh(e);if(uh(t,ph))return t[ph];var r=t.constructor;return dh(r)&&t instanceof r?r.prototype:t instanceof fh?_h:null},mh=a,Sh=B,Eh=vh,yh=Wt.exports,gh=Qe("iterator"),bh=!1;[].keys&&("next"in(oh=[].keys())?(ih=Eh(Eh(oh)))!==Object.prototype&&(nh=ih):bh=!0);var Th=null==nh||mh((function(){var e={};return nh[gh].call(e)!==e}));Th&&(nh={}),Sh(nh[gh])||yh(nh,gh,(function(){return this}));var Ih={IteratorPrototype:nh,BUGGY_SAFARI_ITERATORS:bh},Ah=Ih.IteratorPrototype,Rh=Ai,Ch=S,Oh=Go,Nh=hc,wh=function(){return this},Ph=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Rh(Ah,{next:Ch(+!n,r)}),Oh(e,i,!1),Nh[i]=wh,e},Dh=Xn,kh=l,Mh=Mr,Uh=B,Lh=Ph,xh=vh,Vh=ti,Fh=Go,Bh=Xt,jh=Wt.exports,Gh=hc,Hh=Mh.PROPER,zh=Mh.CONFIGURABLE,Kh=Ih.IteratorPrototype,Yh=Ih.BUGGY_SAFARI_ITERATORS,Xh=Qe("iterator"),Wh="keys",Jh="values",qh="entries",Zh=function(){return this},$h=function(e,t,r,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 Jh:case qh:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[Xh]||p["@@iterator"]||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])||jh(s,Xh,Zh)),Fh(s,l,!0)),Hh&&i==Jh&&f&&f.name!==Jh&&(zh?Bh(p,"name",Jh):(h=!0,_=function(){return kh(f,this)})),i)if(c={values:d(Jh),keys:o?_:d(Wh),entries:d(qh)},a)for(u in c)(Yh||h||!(u in p))&&jh(p,u,c[u]);else Dh({target:t,proto:!0,forced:Yh||h},c);return p[Xh]!==_&&jh(p,Xh,_,{name:i}),Gh[t]=_,c},Qh=F,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),Sp=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}},Ep={codeAt:Sp(!1),charAt:Sp(!0)},yp=Ep.charAt,gp=fo,bp=Or,Tp=$h,Ip="String Iterator",Ap=bp.set,Rp=bp.getterFor(Ip);Tp(String,"String",(function(e){Ap(this,{type:Ip,string:gp(e),index:0})}),(function(){var e,t=Rp(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=yp(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,Pp=i,Dp=Cp,kp=wp,Mp=up,Up=Xt,Lp=Qe,xp=Lp("iterator"),Vp=Lp("toStringTag"),Fp=Mp.values,Bp=function(e,t){if(e){if(e[xp]!==Fp)try{Up(e,xp,Fp)}catch(t){e[xp]=Fp}if(e[Vp]||Up(e,Vp,t),Dp[t])for(var r in Mp)if(e[r]!==Mp[r])try{Up(e,r,Mp[r])}catch(t){e[r]=Mp[r]}}};for(var jp in Dp)Bp(Pp[jp]&&Pp[jp].prototype,jp);Bp(kp,"DOMTokenList");var Gp=a,Hp=te,zp=Qe("species"),Kp=function(e){return Hp>=51||!Gp((function(){var t=[];return(t.constructor={})[zp]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Yp=Xn,Xp=i,Wp=a,Jp=eo,qp=G,Zp=Me,$p=nn,Qp=Eo,ef=fa,tf=Kp,rf=te,nf=Qe("isConcatSpreadable"),of=9007199254740991,af="Maximum allowed index exceeded",sf=Xp.TypeError,cf=rf>=51||!Wp((function(){var e=[];return e[nf]=!1,e.concat()[0]!==e})),uf=tf("concat"),df=function(e){if(!qp(e))return!1;var t=e[nf];return void 0!==t?!!t:Jp(e)};Yp({target:"Array",proto:!0,forced:!cf||!uf},{concat:function(e){var t,r,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,Sf=F,Ef=Eo,yf=Qe,gf=Po,bf=Kp("slice"),Tf=yf("species"),If=hf.Array,Af=Math.max;lf({target:"Array",proto:!0,forced:!bf},{slice:function(e,t){var r,n,i,o=Sf(this),a=mf(o),s=vf(e,a),c=vf(void 0===t?a:t,a);if(pf(o)&&(r=o.constructor,(ff(r)&&(r===If||pf(r.prototype))||_f(r)&&null===(r=r[Tf]))&&(r=void 0),r===If||void 0===r))return gf(o,s,c);for(n=new(void 0===r?If:r)(Af(c-s,0)),i=0;s<c;s++,i++)s in o&&Ef(n,i,o[s]);return n.length=i,n}}),Vo("asyncIterator");var Rf=function(e,t){return Rf=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])},Rf(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}Rf(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Of,Nf,wf,Pf,Df,kf,Mf,Uf,Lf,xf,Vf,Ff,Bf,jf,Gf,Hf,zf,Kf,Yf,Xf,Wf=function(){return Wf=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},Wf.apply(this,arguments)};function Jf(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 qf(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 Zf(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 $f(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 Qf(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 e_(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"}(Pf||(Pf={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(Df||(Df={})),function(e){e[e.MUTE_STATE_OFF=0]="MUTE_STATE_OFF",e[e.MUTE_STATE_ON=1]="MUTE_STATE_ON"}(kf||(kf={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(Mf||(Mf={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(Uf||(Uf={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(Lf||(Lf={})),function(e){e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO=0]="RTC_PAUSE_RESUME_CONTROL_AUDIO",e[e.RTC_PAUSE_RESUME_CONTROL_VIDEO=1]="RTC_PAUSE_RESUME_CONTROL_VIDEO",e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO=2]="RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO"}(xf||(xf={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(Vf||(Vf={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(Ff||(Ff={})),function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_AND_VIDEO=2]="AUDIO_AND_VIDEO",e[e.NONE=3]="NONE"}(Bf||(Bf={})),function(e){e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER"}(jf||(jf={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED"}(Gf||(Gf={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(Hf||(Hf={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(zf||(zf={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(Kf||(Kf={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY"}(Yf||(Yf={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(Xf||(Xf={}));var t_,r_,n_,i_=Object.freeze({__proto__:null,get VideoSourceType(){return Of},get AudioSourceType(){return Nf},get UserOfflineReason(){return wf},get ChannelProfile(){return Pf},get SubscribeMode(){return Df},get MuteState(){return kf},get SubscribeState(){return Mf},get PublishState(){return Uf},get MirrorMode(){return Lf},get PauseResumeControlMediaType(){return xf},get VideoRenderMode(){return Vf},get StreamIndex(){return Ff},get SubscribeMediaType(){return Bf},get StreamRemoveReason(){return jf},get ConnectionState(){return Gf},get MirrorType(){return Hf},get LogChannel(){return zf},get USER_ONLINE_STATUS(){return Kf},get PublicStreamType(){return Yf},get PublicInterpolationMode(){return Xf}});!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"}(t_||(t_={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(r_||(r_={})),function(e){e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED"}(n_||(n_={}));var o_,a_=Object.freeze({__proto__:null,get AudioMixingDualMonoMode(){return t_},get AudioMixingType(){return r_},get AudioMixingState(){return n_}});!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onStreamAdd="onStreamAdd",e.onStreamRemove="onStreamRemove",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onUserMuteAudio="onUserMuteAudio",e.onUserMuteVideo="onUserMuteVideo",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onMediaDeviceStateChanged="onMediaDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.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",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived"}(o_||(o_={}));var s_=ba.forEach,c_=ji("forEach")?[].forEach:function(e){return s_(this,e,arguments.length>1?arguments[1]:void 0)};Xn({target:"Array",proto:!0,forced:[].forEach!=c_},{forEach:c_});var u_=i,d_=Cp,l_=wp,h_=c_,p_=Xt,f_=function(e){if(e&&e.forEach!==h_)try{p_(e,"forEach",h_)}catch(t){e.forEach=h_}};for(var __ in d_)d_[__]&&f_(u_[__]&&u_[__].prototype);f_(l_);var v_=Xn,m_=I,S_=i.Date,E_=m_(S_.prototype.getTime);v_({target:"Date",stat:!0},{now:function(){return E_(new S_)}});var y_=I,g_=Wt.exports,b_=Date.prototype,T_="Invalid Date",I_="toString",A_=y_(b_.toString),R_=y_(b_.getTime);String(new Date(NaN))!=T_&&g_(b_,I_,(function(){var e=R_(this);return e==e?A_(this):T_}));var C_=un.includes,O_=ah;Xn({target:"Array",proto:!0},{includes:function(e){return C_(this,e,arguments.length>1?arguments[1]:void 0)}}),O_("includes");var N_=G,w_=O,P_=Qe("match"),D_=function(e){var t;return N_(e)&&(void 0!==(t=e[P_])?!!t:"RegExp"==w_(e))},k_=D_,M_=i.TypeError,U_=function(e){if(k_(e))throw M_("The method doesn't accept regular expressions");return e},L_=Qe("match"),x_=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[L_]=!1,"/./"[e](t)}catch(e){}}return!1},V_=Xn,F_=U_,B_=L,j_=fo,G_=x_,H_=I("".indexOf);V_({target:"String",proto:!0,forced:!G_("includes")},{includes:function(e){return!!~H_(j_(B_(this)),j_(F_(e)),arguments.length>1?arguments[1]:void 0)}});var z_=kt,K_=function(){var e=z_(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},Y_=a,X_=i.RegExp,W_=Y_((function(){var e=X_("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),J_=W_||Y_((function(){return!X_("a","y").sticky})),q_={BROKEN_CARET:W_||Y_((function(){var e=X_("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:J_,UNSUPPORTED_Y:W_},Z_=a,$_=i.RegExp,Q_=Z_((function(){var e=$_(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),ev=a,tv=i.RegExp,rv=ev((function(){var e=tv("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),nv=l,iv=I,ov=fo,av=K_,sv=q_,cv=Ie.exports,uv=Ai,dv=Or.get,lv=Q_,hv=rv,pv=cv("native-string-replace",String.prototype.replace),fv=RegExp.prototype.exec,_v=fv,vv=iv("".charAt),mv=iv("".indexOf),Sv=iv("".replace),Ev=iv("".slice),yv=function(){var e=/a/,t=/b*/g;return nv(fv,e,"a"),nv(fv,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),gv=sv.BROKEN_CARET,bv=void 0!==/()??/.exec("")[1];(yv||bv||gv||lv||hv)&&(_v=function(e){var t,r,n,i,o,a,s,c=this,u=dv(c),d=ov(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=nv(_v,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=gv&&c.sticky,f=nv(av,c),_=c.source,v=0,m=d;if(p&&(f=Sv(f,"y",""),-1===mv(f,"g")&&(f+="g"),m=Ev(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==vv(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",f)),bv&&(r=new RegExp("^"+_+"$(?!\\s)",f)),yv&&(n=c.lastIndex),i=nv(fv,p?r:c,m),p?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:yv&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),bv&&i&&i.length>1&&nv(pv,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=uv(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var Tv=_v;Xn({target:"RegExp",proto:!0,forced:/./.exec!==Tv},{exec:Tv});var Iv=I,Av=Wt.exports,Rv=Tv,Cv=a,Ov=Qe,Nv=Xt,wv=Ov("species"),Pv=RegExp.prototype,Dv=function(e,t,r,n){var i=Ov(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[wv]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=Iv(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var a=Iv(e),c=t.exec;return c===Rv||c===Pv.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(Pv,i,c[1])}n&&Nv(Pv[i],"sham",!0)},kv=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Mv=l,Uv=kt,Lv=B,xv=O,Vv=Tv,Fv=i.TypeError,Bv=function(e,t){var r=e.exec;if(Lv(r)){var n=Mv(r,e,t);return null!==n&&Uv(n),n}if("RegExp"===xv(e))return Mv(Vv,e,t);throw Fv("RegExp#exec called on incompatible receiver")},jv=l,Gv=kt,Hv=L,zv=kv,Kv=fo,Yv=Ee,Xv=Bv;function Wv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Dv("search",(function(e,t,r){return[function(t){var r=Hv(this),n=null==t?void 0:Yv(t,e);return n?jv(n,t,r):new RegExp(t)[e](Kv(r))},function(e){var n=Gv(this),i=Kv(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;zv(a,0)||(n.lastIndex=0);var s=Xv(n,i);return zv(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var Jv=Ep.charAt,qv=function(e,t,r){return t+(r?Jv(e,t).length:1)},Zv=l,$v=kt,Qv=tn,em=fo,tm=L,rm=Ee,nm=qv,im=Bv;Dv("match",(function(e,t,r){return[function(t){var r=tm(this),n=null==t?void 0:rm(t,e);return n?Zv(n,t,r):new RegExp(t)[e](em(r))},function(e){var n=$v(this),i=em(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return im(n,i);var a=n.unicode;n.lastIndex=0;for(var s,c=[],u=0;null!==(s=im(n,i));){var d=em(s[0]);c[u]=d,""===d&&(n.lastIndex=nm(i,Qv(n.lastIndex),a)),u++}return 0===u?null:c}]}));var om="\t\n\v\f\r                 \u2028\u2029\ufeff",am=L,sm=fo,cm=I("".replace),um="[\t\n\v\f\r                 \u2028\u2029\ufeff]",dm=RegExp("^"+um+um+"*"),lm=RegExp(um+um+"*$"),hm=function(e){return function(t){var r=sm(am(t));return 1&e&&(r=cm(r,dm,"")),2&e&&(r=cm(r,lm,"")),r}},pm={start:hm(1),end:hm(2),trim:hm(3)},fm=i,_m=a,vm=I,mm=fo,Sm=pm.trim,Em=om,ym=fm.parseInt,gm=fm.Symbol,bm=gm&&gm.iterator,Tm=/^[+-]?0x/i,Im=vm(Tm.exec),Am=8!==ym(Em+"08")||22!==ym(Em+"0x16")||bm&&!_m((function(){ym(Object(bm))}))?function(e,t){var r=Sm(mm(e));return ym(r,t>>>0||(Im(Tm,r)?16:10))}:ym;Xn({global:!0,forced:parseInt!=Am},{parseInt:Am});var Rm={exports:{}},Cm=a((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Om=a,Nm=G,wm=O,Pm=Cm,Dm=Object.isExtensible,km=Om((function(){Dm(1)}))||Pm?function(e){return!!Nm(e)&&((!Pm||"ArrayBuffer"!=wm(e))&&(!Dm||Dm(e)))}:Dm,Mm=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),Um=Xn,Lm=I,xm=dr,Vm=G,Fm=xe,Bm=Ct.f,jm=Kr,Gm=_o,Hm=km,zm=Mm,Km=!1,Ym=Ge("meta"),Xm=0,Wm=function(e){Bm(e,Ym,{value:{objectID:"O"+Xm++,weakData:{}}})},Jm=Rm.exports={enable:function(){Jm.enable=function(){},Km=!0;var e=jm.f,t=Lm([].splice),r={};r[Ym]=1,e(r).length&&(jm.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Ym){t(n,i,1);break}return n},Um({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Gm.f}))},fastKey:function(e,t){if(!Vm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Fm(e,Ym)){if(!Hm(e))return"F";if(!t)return"E";Wm(e)}return e[Ym].objectID},getWeakData:function(e,t){if(!Fm(e,Ym)){if(!Hm(e))return!0;if(!t)return!1;Wm(e)}return e[Ym].weakData},onFreeze:function(e){return zm&&Km&&Hm(e)&&!Fm(e,Ym)&&Wm(e),e}};xm[Ym]=!0;var qm=B,Zm=G,$m=ti,Qm=function(e,t,r){var n,i;return $m&&qm(n=t.constructor)&&n!==r&&Zm(i=n.prototype)&&i!==r.prototype&&$m(e,i),e},eS=Xn,tS=i,rS=I,nS=Fn,iS=Wt.exports,oS=Rm.exports,aS=Yc,sS=lc,cS=B,uS=G,dS=a,lS=tu,hS=Go,pS=Qm,fS=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=tS[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=rS(s[e]);iS(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!uS(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!uS(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!uS(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(nS(e,!cS(a)||!(i||s.forEach&&!dS((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,n,o),oS.enable();else if(nS(e,!0)){var l=new c,h=l[o](i?{}:-0,1)!=l,p=dS((function(){l.has(1)})),f=lS((function(e){new a(e)})),_=!i&&dS((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));f||((c=t((function(e,t){sS(e,s);var r=pS(new a,e,c);return null!=t&&aS(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,eS({global:!0,forced:c!=a},u),hS(c,e),i||r.setStrong(c,e,n),c},_S=Ct.f,vS=Ai,mS=nc,SS=Yo,ES=lc,yS=Yc,gS=$h,bS=cc,TS=s,IS=Rm.exports.fastKey,AS=Or.set,RS=Or.getterFor,CS={getConstructor:function(e,t,r,n){var i=e((function(e,i){ES(e,o),AS(e,{type:t,index:vS(null),first:void 0,last:void 0,size:0}),TS||(e.size=0),null!=i&&yS(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=RS(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=IS(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),TS?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=IS(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return mS(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,TS?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),TS?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=SS(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)}}),mS(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)}}),TS&&_S(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=RS(t),o=RS(n);gS(e,t,(function(e,t){AS(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),bS(t)}};fS("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),CS);var OS=Me,NS=oi;Xn({target:"Object",stat:!0,forced:a((function(){NS(1)}))},{keys:function(e){return NS(OS(e))}});var wS=me,PS=Me,DS=M,kS=nn,MS=i.TypeError,US=function(e){return function(t,r,n,i){wS(r);var o=PS(t),a=DS(o),s=kS(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 MS("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}},LS={left:US(!1),right:US(!0)},xS=LS.left,VS=te,FS=pu;Xn({target:"Array",proto:!0,forced:!ji("reduce")||!FS&&VS>79&&VS<83},{reduce:function(e){var t=arguments.length;return xS(this,e,t,t>1?arguments[1]:void 0)}});var BS,jS=Xn,GS=I,HS=o.f,zS=tn,KS=fo,YS=U_,XS=L,WS=x_,JS=GS("".endsWith),qS=GS("".slice),ZS=Math.min,$S=WS("endsWith");jS({target:"String",proto:!0,forced:!!($S||(BS=HS(String.prototype,"endsWith"),!BS||BS.writable))&&!$S},{endsWith:function(e){var t=KS(XS(this));YS(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:ZS(zS(r),n),o=KS(e);return JS?JS(t,o,i):qS(t,i-o.length,i)===o}});var QS=!0,eE=!0;function tE(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function rE(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 nE(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(QS=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function iE(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(eE=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function oE(){if("object"===("undefined"==typeof window?"undefined":t(window))){if(QS)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function aE(e,t){eE&&console.warn(e+" is deprecated, please use "+t+" instead.")}function sE(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=tE(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=tE(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=tE(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function cE(e){return"[object Object]"===Object.prototype.toString.call(e)}function uE(e){return cE(e)?Object.keys(e).reduce((function(t,r){var n=cE(e[r]),i=n?uE(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,Wv({},r,i))}),{}):e}function dE(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?dE(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){dE(e,e.get(t),r)}))})))}function lE(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&&dE(e,r,i)}))})),i}var hE=Xn,pE=ba.find,fE=ah,_E="find",vE=!0;_E in[]&&Array(1).find((function(){vE=!1})),hE({target:"Array",proto:!0,forced:vE},{find:function(e){return pE(this,e,arguments.length>1?arguments[1]:void 0)}}),fE(_E);var mE=Xn,SE=i,EE=$r,yE=Wr,gE=nn,bE=Me,TE=fa,IE=Eo,AE=Kp("splice"),RE=SE.TypeError,CE=Math.max,OE=Math.min,NE=9007199254740991,wE="Maximum allowed length exceeded";mE({target:"Array",proto:!0,forced:!AE},{splice:function(e,t){var r,n,i,o,a,s,c=bE(this),u=gE(c),d=EE(e,u),l=arguments.length;if(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=OE(CE(yE(t),0),u-d)),u+r-n>NE)throw RE(wE);for(i=TE(c,n),o=0;o<n;o++)(a=d+o)in c&&IE(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 PE=ba.map;Xn({target:"Array",proto:!0,forced:!Kp("map")},{map:function(e){return PE(this,e,arguments.length>1?arguments[1]:void 0)}});var DE=ba.filter;Xn({target:"Array",proto:!0,forced:!Kp("filter")},{filter:function(e){return DE(this,e,arguments.length>1?arguments[1]:void 0)}});var kE=I,ME=Me,UE=Math.floor,LE=kE("".charAt),xE=kE("".replace),VE=kE("".slice),FE=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,BE=/\$([$&'`]|\d{1,2})/g,jE=$i,GE=l,HE=I,zE=Dv,KE=a,YE=kt,XE=B,WE=Wr,JE=tn,qE=fo,ZE=L,$E=qv,QE=Ee,ey=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,c=BE;return void 0!==i&&(i=ME(i),c=FE),xE(o,c,(function(o,c){var u;switch(LE(c,0)){case"$":return"$";case"&":return e;case"`":return VE(t,0,r);case"'":return VE(t,a);case"<":u=i[VE(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=UE(d/10);return 0===l?o:l<=s?void 0===n[l-1]?LE(c,1):n[l-1]+LE(c,1):o}u=n[d-1]}return void 0===u?"":u}))},ty=Bv,ry=Qe("replace"),ny=Math.max,iy=Math.min,oy=HE([].concat),ay=HE([].push),sy=HE("".indexOf),cy=HE("".slice),uy="$0"==="a".replace(/./,"$0"),dy=!!/./[ry]&&""===/./[ry]("a","$0");zE("replace",(function(e,t,r){var n=dy?"$":"$0";return[function(e,r){var n=ZE(this),i=null==e?void 0:QE(e,ry);return i?GE(i,e,n,r):GE(t,qE(n),e,r)},function(e,i){var o=YE(this),a=qE(e);if("string"==typeof i&&-1===sy(i,n)&&-1===sy(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var c=XE(i);c||(i=qE(i));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=ty(o,a);if(null===h)break;if(ay(l,h),!u)break;""===qE(h[0])&&(o.lastIndex=$E(a,JE(o.lastIndex),d))}for(var p,f="",_=0,v=0;v<l.length;v++){for(var m=qE((h=l[v])[0]),S=ny(iy(WE(h.index),a.length),0),E=[],y=1;y<h.length;y++)ay(E,void 0===(p=h[y])?p:String(p));var g=h.groups;if(c){var b=oy([m],E,S,a);void 0!==g&&ay(b,g);var T=qE(jE(i,void 0,b))}else T=ey(m,a,S,E,g,i);S>=_&&(f+=cy(a,_,S)+T,_=S+m.length)}return f+cy(a,_)}]}),!!KE((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!uy||dy);var ly=s,hy=i,py=I,fy=Fn,_y=Qm,vy=Xt,my=Ct.f,Sy=Kr.f,Ey=X,yy=D_,gy=fo,by=K_,Ty=q_,Iy=Wt.exports,Ay=a,Ry=xe,Cy=Or.enforce,Oy=cc,Ny=Q_,wy=rv,Py=Qe("match"),Dy=hy.RegExp,ky=Dy.prototype,My=hy.SyntaxError,Uy=py(by),Ly=py(ky.exec),xy=py("".charAt),Vy=py("".replace),Fy=py("".indexOf),By=py("".slice),jy=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Gy=/a/g,Hy=/a/g,zy=new Dy(Gy)!==Gy,Ky=Ty.MISSED_STICKY,Yy=Ty.UNSUPPORTED_Y,Xy=ly&&(!zy||Ky||Ny||wy||Ay((function(){return Hy[Py]=!1,Dy(Gy)!=Gy||Dy(Hy)==Hy||"/a/i"!=Dy(Gy,"i")})));if(fy("RegExp",Xy)){for(var Wy=function(e,t){var r,n,i,o,a,s,c=Ey(ky,this),u=yy(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===Wy)return e;if((u||Ey(ky,e))&&(e=e.source,d&&(t="flags"in h?h.flags:Uy(h))),e=void 0===e?"":gy(e),t=void 0===t?"":gy(t),h=e,Ny&&"dotAll"in Gy&&(n=!!t&&Fy(t,"s")>-1)&&(t=Vy(t,/s/g,"")),r=t,Ky&&"sticky"in Gy&&(i=!!t&&Fy(t,"y")>-1)&&Yy&&(t=Vy(t,/y/g,"")),wy&&(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=xy(e,n)))t+=xy(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:Ly(jy,By(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||Ry(a,d))throw new My("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=_y(Dy(e,t),c?this:ky,Wy),(n||i||l.length)&&(s=Cy(a),n&&(s.dotAll=!0,s.raw=Wy(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=xy(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+xy(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{vy(a,"source",""===h?"(?:)":h)}catch(e){}return a},Jy=function(e){e in Wy||my(Wy,e,{configurable:!0,get:function(){return Dy[e]},set:function(t){Dy[e]=t}})},qy=Sy(Dy),Zy=0;qy.length>Zy;)Jy(qy[Zy++]);ky.constructor=Wy,Wy.prototype=ky,Iy(hy,"RegExp",Wy)}Oy("RegExp");var $y=I,Qy=Mr.PROPER,eg=Wt.exports,tg=kt,rg=X,ng=fo,ig=a,og=K_,ag="toString",sg=RegExp.prototype,cg=sg.toString,ug=$y(og),dg=ig((function(){return"/a/b"!=cg.call({source:"a",flags:"b"})})),lg=Qy&&cg.name!=ag;(dg||lg)&&eg(RegExp.prototype,ag,(function(){var e=tg(this),t=ng(e.source),r=e.flags;return"/"+t+"/"+ng(void 0===r&&rg(sg,e)&&!("flags"in sg)?ug(e):r)}),{unsafe:!0});var hg=ba.some;Xn({target:"Array",proto:!0,forced:!ji("some")},{some:function(e){return hg(this,e,arguments.length>1?arguments[1]:void 0)}});var pg=s,fg=Mr.EXISTS,_g=I,vg=Ct.f,mg=Function.prototype,Sg=_g(mg.toString),Eg=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,yg=_g(Eg.exec);pg&&!fg&&vg(mg,"name",{configurable:!0,get:function(){try{return yg(Eg,Sg(this))[1]}catch(e){return""}}});var gg=I,bg=me,Tg=G,Ig=xe,Ag=Po,Rg=c,Cg=i.Function,Og=gg([].concat),Ng=gg([].join),wg={},Pg=function(e,t,r){if(!Ig(wg,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";wg[t]=Cg("C,a","return new C("+Ng(n,",")+")")}return wg[t](e,r)},Dg=Rg?Cg.bind:function(e){var t=bg(this),r=t.prototype,n=Ag(arguments,1),i=function(){var r=Og(n,Ag(arguments));return this instanceof i?Pg(t,r.length,r):t.apply(e,r)};return Tg(r)&&(i.prototype=r),i},kg=Dg;Xn({target:"Function",proto:!0,forced:Function.bind!==kg},{bind:kg});var Mg=oE;function Ug(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),Mg("chrome: "+JSON.stringify(e)),o(e)}));e.video=i(e.video)}return Mg("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 Lg(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function xg(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 rE(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Vg(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 Fg(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 Bg(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 lE(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}),rE(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 lE(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 jg(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 Gg(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return jg(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=Wv({},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 Hg(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=Wv({},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 zg(e,t){rE(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 Kg=Object.freeze({__proto__:null,shimMediaStream:Lg,shimOnTrack:xg,shimGetSendersWithDtmf:Vg,shimGetStats:Fg,shimSenderReceiverGetStats:Bg,shimAddTrackRemoveTrackWithNative:jg,shimAddTrackRemoveTrack:Gg,shimPeerConnection:Hg,fixNegotiationNeeded:zg,shimGetUserMedia:Ug,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"))}}),Yg=i,Xg=a,Wg=fo,Jg=pm.trim,qg=I("".charAt),Zg=Yg.parseFloat,$g=Yg.Symbol,Qg=$g&&$g.iterator,eb=1/Zg("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||Qg&&!Xg((function(){Zg(Object(Qg))}))?function(e){var t=Jg(Wg(e)),r=Zg(t);return 0===r&&"-"==qg(t,0)?-0:r}:Zg;Xn({global:!0,forced:parseFloat!=eb},{parseFloat:eb});var tb=Xn,rb=tc,nb=a,ib=Y,ob=B,ab=uu,sb=Ed,cb=Wt.exports;if(tb({target:"Promise",proto:!0,real:!0,forced:!!rb&&nb((function(){rb.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=ab(this,ib("Promise")),r=ob(e);return this.then(r?function(r){return sb(t,e()).then((function(){return r}))}:e,r?function(r){return sb(t,e()).then((function(){throw r}))}:e)}}),ob(rb)){var ub=ib("Promise").prototype.finally;rb.prototype.finally!==ub&&cb(rb.prototype,"finally",ub,{unsafe:!0})}function db(e,r){var n=e&&e.navigator,i=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){aE("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 lb(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 hb(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=Wv({},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 pb(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 fb(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}),rE(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function _b(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;aE("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function vb(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function mb(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 Eb(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 yb(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:lb,shimPeerConnection:hb,shimSenderGetStats:pb,shimReceiverGetStats:fb,shimRemoveStream:_b,shimRTCDataChannel:vb,shimAddTransceiver:mb,shimGetParameters:Sb,shimCreateOffer:Eb,shimCreateAnswer:yb,shimGetUserMedia:db,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 bb(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 Tb(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 Ib(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 Ab(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(Rb(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function Rb(e){return e&&void 0!==e.video?Object.assign({},e,{video:uE(e.video)}):e}function Cb(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")?(aE("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 Ob(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 Nb(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 wb(e){"object"!==t(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Pb=Object.freeze({__proto__:null,shimLocalStreamsAPI:bb,shimRemoteStreamsAPI:Tb,shimCallbacksAPI:Ib,shimGetUserMedia:Ab,shimConstraints:Rb,shimRTCIceServerUrls:Cb,shimTrackEventTransceiver:Ob,shimCreateOfferLegacy:Nb,shimAudioContext:wb}),Db=Me,kb=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=Db(this),r=kb(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}});var Mb=l;Xn({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Mb(URL.prototype.toString,this)}});var Ub=I(1..valueOf),Lb=s,xb=i,Vb=I,Fb=Fn,Bb=Wt.exports,jb=xe,Gb=Qm,Hb=X,zb=le,Kb=ct,Yb=a,Xb=Kr.f,Wb=o.f,Jb=Ct.f,qb=Ub,Zb=pm.trim,$b="Number",Qb=xb.Number,eT=Qb.prototype,tT=xb.TypeError,rT=Vb("".slice),nT=Vb("".charCodeAt),iT=function(e){var t=Kb(e,"number");return"bigint"==typeof t?t:oT(t)},oT=function(e){var t,r,n,i,o,a,s,c,u=Kb(e,"number");if(zb(u))throw tT("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=Zb(u),43===(t=nT(u,0))||45===t){if(88===(r=nT(u,2))||120===r)return NaN}else if(48===t){switch(nT(u,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+u}for(a=(o=rT(u,2)).length,s=0;s<a;s++)if((c=nT(o,s))<48||c>i)return NaN;return parseInt(o,n)}return+u};if(Fb($b,!Qb(" 0o1")||!Qb("0b1")||Qb("+0x1"))){for(var aT,sT=function(e){var t=arguments.length<1?0:Qb(iT(e)),r=this;return Hb(eT,r)&&Yb((function(){qb(r)}))?Gb(Object(t),r,sT):t},cT=Lb?Xb(Qb):"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(","),uT=0;cT.length>uT;uT++)jb(Qb,aT=cT[uT])&&!jb(sT,aT)&&Jb(sT,aT,Wb(Qb,aT));sT.prototype=eT,eT.constructor=sT,Bb(xb,$b,sT)}var dT=Xn,lT=M,hT=F,pT=ji,fT=I([].join),_T=lT!=Object,vT=pT("join",",");dT({target:"Array",proto:!0,forced:_T||!vT},{join:function(e){return fT(hT(this),void 0===e?",":e)}});var mT=$i,ST=l,ET=I,yT=Dv,gT=D_,bT=kt,TT=L,IT=uu,AT=qv,RT=tn,CT=fo,OT=Ee,NT=Ao,wT=Bv,PT=Tv,DT=a,kT=q_.UNSUPPORTED_Y,MT=4294967295,UT=Math.min,LT=[].push,xT=ET(/./.exec),VT=ET(LT),FT=ET("".slice),BT=!DT((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]}));yT("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=CT(TT(this)),i=void 0===r?MT:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!gT(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(PT,l,n))&&!((a=l.lastIndex)>d&&(VT(c,FT(n,d,o.index)),o.length>1&&o.index<n.length&&mT(LT,c,NT(o,1)),s=o[0].length,d=a,c.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&xT(l,"")||VT(c,""):VT(c,FT(n,d)),c.length>i?NT(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=TT(this),o=null==t?void 0:OT(t,e);return o?ST(o,t,i,r):ST(n,CT(i),t,r)},function(e,i){var o=bT(this),a=CT(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var c=IT(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(kT?"g":"y"),l=new c(kT?"^(?:"+o.source+")":o,d),h=void 0===i?MT:i>>>0;if(0===h)return[];if(0===a.length)return null===wT(l,a)?[a]:[];for(var p=0,f=0,_=[];f<a.length;){l.lastIndex=kT?0:f;var v,m=wT(l,kT?FT(a,f):a);if(null===m||(v=UT(RT(l.lastIndex+(kT?f:0)),a.length))===p)f=AT(a,f,u);else{if(VT(_,FT(a,p,f)),_.length===h)return _;for(var S=1;S<=m.length-1;S++)if(VT(_,m[S]),_.length===h)return _;f=p=v}}return VT(_,FT(a,p)),_}]}),!BT,kT);var jT=Mr.PROPER,GT=a,HT=om,zT=pm.trim;Xn({target:"String",proto:!0,forced:function(e){return GT((function(){return!!HT[e]()||"​…᠎"!=="​…᠎"[e]()||jT&&HT[e].name!==e}))}("trim")},{trim:function(){return zT(this)}});var KT={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}(KT);var YT=KT.exports,XT=Object.freeze(e({__proto__:null,default:YT},[KT.exports]));function WT(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=YT.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,rE(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function JT(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=YT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=YT.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=YT.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 qT(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},rE(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 ZT(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 $T(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 QT(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 eI(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 tI=Object.freeze({__proto__:null,shimRTCIceCandidate:WT,shimMaxMessageSize:JT,shimSendThrowTypeError:qT,shimConnectionState:ZT,removeExtmapAllowMixed:$T,shimAddIceCandidateNullOrEmpty:QT,shimParameterlessSetLocalDescription:eI});!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=oE,i=sE(t),o={browserDetails:i,commonShim:tI,extractVersion:tE,disableLog:nE,disableWarnings:iE,sdp:XT};switch(i.browser){case"chrome":if(!Kg||!Hg||!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=Kg,QT(t,i),eI(t),Ug(t,i),Lg(t),Hg(t,i),xg(t),Gg(t,i),Vg(t),Fg(t),Bg(t),zg(t,i),WT(t),ZT(t),JT(t,i),qT(t),$T(t,i);break;case"firefox":if(!gb||!hb||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=gb,QT(t,i),eI(t),db(t,i),hb(t,i),lb(t),_b(t),pb(t),fb(t),vb(t),mb(t),Sb(t),Eb(t),yb(t),WT(t),ZT(t),JT(t,i),qT(t);break;case"safari":if(!Pb||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=Pb,QT(t,i),eI(t),Cb(t),Nb(t),Ib(t),bb(t),Tb(t),Ob(t),Ab(t),wb(t),WT(t),JT(t,i),qT(t),$T(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),Xn({target:"Array",stat:!0},{isArray:eo});var rI=Ao,nI=Math.floor,iI=function(e,t){var r=e.length,n=nI(r/2);return r<8?oI(e,t):aI(e,iI(rI(e,0,n),t),iI(rI(e,n),t),t)},oI=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},aI=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},sI=iI,cI=W.match(/firefox\/(\d+)/i),uI=!!cI&&+cI[1],dI=/MSIE|Trident/.test(W),lI=W.match(/AppleWebKit\/(\d+)\./),hI=!!lI&&+lI[1],pI=Xn,fI=I,_I=me,vI=Me,mI=nn,SI=fo,EI=a,yI=sI,gI=ji,bI=uI,TI=dI,II=te,AI=hI,RI=[],CI=fI(RI.sort),OI=fI(RI.push),NI=EI((function(){RI.sort(void 0)})),wI=EI((function(){RI.sort(null)})),PI=gI("sort"),DI=!EI((function(){if(II)return II<70;if(!(bI&&bI>3)){if(TI)return!0;if(AI)return AI<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++)RI.push({k:t+n,v:r})}for(RI.sort((function(e,t){return t.v-e.v})),n=0;n<RI.length;n++)t=RI[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));pI({target:"Array",proto:!0,forced:NI||!wI||!PI||!DI},{sort:function(e){void 0!==e&&_I(e);var t=vI(this);if(DI)return void 0===e?CI(t):CI(t,e);var r,n,i=[],o=mI(t);for(n=0;n<o;n++)n in t&&OI(i,t[n]);for(yI(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 kI="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,MI=Wr,UI=tn,LI=i.RangeError,xI=function(e){if(void 0===e)return 0;var t=MI(e),r=UI(t);if(t!==r)throw LI("Wrong length or index");return r},VI=i.Array,FI=Math.abs,BI=Math.pow,jI=Math.floor,GI=Math.log,HI=Math.LN2,zI={pack:function(e,t,r){var n,i,o,a=VI(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?BI(2,-24)-BI(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=FI(e))!=e||e===1/0?(i=e!=e?1:0,n=c):(n=jI(GI(e)/HI),e*(o=BI(2,-n))<1&&(n--,o*=2),(e+=n+u>=1?d/o:d*BI(2,1-u))*o>=2&&(n++,o/=2),n+u>=c?(i=0,n=c):n+u>=1?(i=(e*o-1)*BI(2,t),n+=u):(i=e*BI(2,u-1)*BI(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+=BI(2,t),d-=a}return(u?-1:1)*r*BI(2,d-t)}},KI=Me,YI=$r,XI=nn,WI=function(e){for(var t=KI(this),r=XI(t),n=arguments.length,i=YI(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:YI(o,r);a>i;)t[i++]=e;return t},JI=i,qI=I,ZI=s,$I=kI,QI=Mr,eA=Xt,tA=nc,rA=a,nA=lc,iA=Wr,oA=tn,aA=xI,sA=zI,cA=vh,uA=ti,dA=Kr.f,lA=Ct.f,hA=WI,pA=Ao,fA=Go,_A=QI.PROPER,vA=QI.CONFIGURABLE,mA=Or.get,SA=Or.set,EA="ArrayBuffer",yA="DataView",gA="Wrong index",bA=JI.ArrayBuffer,TA=bA,IA=TA&&TA.prototype,AA=JI.DataView,RA=AA&&AA.prototype,CA=Object.prototype,OA=JI.Array,NA=JI.RangeError,wA=qI(hA),PA=qI([].reverse),DA=sA.pack,kA=sA.unpack,MA=function(e){return[255&e]},UA=function(e){return[255&e,e>>8&255]},LA=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},xA=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},VA=function(e){return DA(e,23,4)},FA=function(e){return DA(e,52,8)},BA=function(e,t){lA(e.prototype,t,{get:function(){return mA(this)[t]}})},jA=function(e,t,r,n){var i=aA(r),o=mA(e);if(i+t>o.byteLength)throw NA(gA);var a=mA(o.buffer).bytes,s=i+o.byteOffset,c=pA(a,s,s+t);return n?c:PA(c)},GA=function(e,t,r,n,i,o){var a=aA(r),s=mA(e);if(a+t>s.byteLength)throw NA(gA);for(var c=mA(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($I){var HA=_A&&bA.name!==EA;if(rA((function(){bA(1)}))&&rA((function(){new bA(-1)}))&&!rA((function(){return new bA,new bA(1.5),new bA(NaN),HA&&!vA})))HA&&vA&&eA(bA,"name",EA);else{(TA=function(e){return nA(this,IA),new bA(aA(e))}).prototype=IA;for(var zA,KA=dA(bA),YA=0;KA.length>YA;)(zA=KA[YA++])in TA||eA(TA,zA,bA[zA]);IA.constructor=TA}uA&&cA(RA)!==CA&&uA(RA,CA);var XA=new AA(new TA(2)),WA=qI(RA.setInt8);XA.setInt8(0,2147483648),XA.setInt8(1,2147483649),!XA.getInt8(0)&&XA.getInt8(1)||tA(RA,{setInt8:function(e,t){WA(this,e,t<<24>>24)},setUint8:function(e,t){WA(this,e,t<<24>>24)}},{unsafe:!0})}else IA=(TA=function(e){nA(this,IA);var t=aA(e);SA(this,{bytes:wA(OA(t),0),byteLength:t}),ZI||(this.byteLength=t)}).prototype,RA=(AA=function(e,t,r){nA(this,RA),nA(e,IA);var n=mA(e).byteLength,i=iA(t);if(i<0||i>n)throw NA("Wrong offset");if(i+(r=void 0===r?n-i:oA(r))>n)throw NA("Wrong length");SA(this,{buffer:e,byteLength:r,byteOffset:i}),ZI||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,ZI&&(BA(TA,"byteLength"),BA(AA,"buffer"),BA(AA,"byteLength"),BA(AA,"byteOffset")),tA(RA,{getInt8:function(e){return jA(this,1,e)[0]<<24>>24},getUint8:function(e){return jA(this,1,e)[0]},getInt16:function(e){var t=jA(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=jA(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return xA(jA(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return xA(jA(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return kA(jA(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return kA(jA(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){GA(this,1,e,MA,t)},setUint8:function(e,t){GA(this,1,e,MA,t)},setInt16:function(e,t){GA(this,2,e,UA,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){GA(this,2,e,UA,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){GA(this,4,e,LA,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){GA(this,4,e,LA,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){GA(this,4,e,VA,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){GA(this,8,e,FA,t,arguments.length>2?arguments[2]:void 0)}});fA(TA,EA),fA(AA,yA);var JA={ArrayBuffer:TA,DataView:AA},qA=Xn,ZA=I,$A=a,QA=kt,eR=$r,tR=tn,rR=uu,nR=JA.ArrayBuffer,iR=JA.DataView,oR=iR.prototype,aR=ZA(nR.prototype.slice),sR=ZA(oR.getUint8),cR=ZA(oR.setUint8);qA({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:$A((function(){return!new nR(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(aR&&void 0===t)return aR(QA(this),e);for(var r=QA(this).byteLength,n=eR(e,r),i=eR(void 0===t?r:t,r),o=new(rR(this,nR))(tR(i-n)),a=new iR(this),s=new iR(o),c=0;n<i;)cR(s,c++,sR(a,n++));return o}});var uR,dR,lR,hR={exports:{}},pR=kI,fR=s,_R=i,vR=B,mR=G,SR=xe,ER=lo,yR=pe,gR=Xt,bR=Wt.exports,TR=Ct.f,IR=X,AR=vh,RR=ti,CR=Qe,OR=Ge,NR=_R.Int8Array,wR=NR&&NR.prototype,PR=_R.Uint8ClampedArray,DR=PR&&PR.prototype,kR=NR&&AR(NR),MR=wR&&AR(wR),UR=Object.prototype,LR=_R.TypeError,xR=CR("toStringTag"),VR=OR("TYPED_ARRAY_TAG"),FR=OR("TYPED_ARRAY_CONSTRUCTOR"),BR=pR&&!!RR&&"Opera"!==ER(_R.opera),jR=!1,GR={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},HR={BigInt64Array:8,BigUint64Array:8},zR=function(e){if(!mR(e))return!1;var t=ER(e);return SR(GR,t)||SR(HR,t)};for(uR in GR)(lR=(dR=_R[uR])&&dR.prototype)?gR(lR,FR,dR):BR=!1;for(uR in HR)(lR=(dR=_R[uR])&&dR.prototype)&&gR(lR,FR,dR);if((!BR||!vR(kR)||kR===Function.prototype)&&(kR=function(){throw LR("Incorrect invocation")},BR))for(uR in GR)_R[uR]&&RR(_R[uR],kR);if((!BR||!MR||MR===UR)&&(MR=kR.prototype,BR))for(uR in GR)_R[uR]&&RR(_R[uR].prototype,MR);if(BR&&AR(DR)!==MR&&RR(DR,MR),fR&&!SR(MR,xR))for(uR in jR=!0,TR(MR,xR,{get:function(){return mR(this)?this[VR]:void 0}}),GR)_R[uR]&&gR(_R[uR],VR,uR);var KR={NATIVE_ARRAY_BUFFER_VIEWS:BR,TYPED_ARRAY_CONSTRUCTOR:FR,TYPED_ARRAY_TAG:jR&&VR,aTypedArray:function(e){if(zR(e))return e;throw LR("Target is not a typed array")},aTypedArrayConstructor:function(e){if(vR(e)&&(!RR||IR(kR,e)))return e;throw LR(yR(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(fR){if(r)for(var i in GR){var o=_R[i];if(o&&SR(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}MR[e]&&!r||bR(MR,e,r?t:BR&&wR[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(fR){if(RR){if(r)for(n in GR)if((i=_R[n])&&SR(i,e))try{delete i[e]}catch(e){}if(kR[e]&&!r)return;try{return bR(kR,e,r?t:BR&&kR[e]||t)}catch(e){}}for(n in GR)!(i=_R[n])||i[e]&&!r||bR(i,e,t)}},isView:function(e){if(!mR(e))return!1;var t=ER(e);return"DataView"===t||SR(GR,t)||SR(HR,t)},isTypedArray:zR,TypedArray:kR,TypedArrayPrototype:MR},YR=i,XR=a,WR=tu,JR=KR.NATIVE_ARRAY_BUFFER_VIEWS,qR=YR.ArrayBuffer,ZR=YR.Int8Array,$R=!JR||!XR((function(){ZR(1)}))||!XR((function(){new ZR(-1)}))||!WR((function(e){new ZR,new ZR(null),new ZR(1.5),new ZR(e)}),!0)||XR((function(){return 1!==new ZR(new qR(2),1,void 0).length})),QR=G,eC=Math.floor,tC=Number.isInteger||function(e){return!QR(e)&&isFinite(e)&&eC(e)===e},rC=Wr,nC=i.RangeError,iC=function(e){var t=rC(e);if(t<0)throw nC("The argument can't be less than 0");return t},oC=i.RangeError,aC=function(e,t){var r=iC(e);if(r%t)throw oC("Wrong offset");return r},sC=Yo,cC=l,uC=ou,dC=Me,lC=nn,hC=Oc,pC=gc,fC=vc,_C=KR.aTypedArrayConstructor,vC=Xn,mC=i,SC=l,EC=s,yC=$R,gC=KR,bC=JA,TC=lc,IC=S,AC=Xt,RC=tC,CC=tn,OC=xI,NC=aC,wC=lt,PC=xe,DC=lo,kC=G,MC=le,UC=Ai,LC=X,xC=ti,VC=Kr.f,FC=function(e){var t,r,n,i,o,a,s=uC(this),c=dC(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=pC(c);if(h&&!fC(h))for(a=(o=hC(c,h)).next,c=[];!(i=cC(a,o)).done;)c.push(i.value);for(l&&u>2&&(d=sC(d,arguments[2])),r=lC(c),n=new(_C(s))(r),t=0;r>t;t++)n[t]=l?d(c[t],t):c[t];return n},BC=ba.forEach,jC=cc,GC=Ct,HC=o,zC=Qm,KC=Or.get,YC=Or.set,XC=GC.f,WC=HC.f,JC=Math.round,qC=mC.RangeError,ZC=bC.ArrayBuffer,$C=ZC.prototype,QC=bC.DataView,eO=gC.NATIVE_ARRAY_BUFFER_VIEWS,tO=gC.TYPED_ARRAY_CONSTRUCTOR,rO=gC.TYPED_ARRAY_TAG,nO=gC.TypedArray,iO=gC.TypedArrayPrototype,oO=gC.aTypedArrayConstructor,aO=gC.isTypedArray,sO="BYTES_PER_ELEMENT",cO="Wrong length",uO=function(e,t){oO(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},dO=function(e,t){XC(e,t,{get:function(){return KC(this)[t]}})},lO=function(e){var t;return LC($C,e)||"ArrayBuffer"==(t=DC(e))||"SharedArrayBuffer"==t},hO=function(e,t){return aO(e)&&!MC(t)&&t in e&&RC(+t)&&t>=0},pO=function(e,t){return t=wC(t),hO(e,t)?IC(2,e[t]):WC(e,t)},fO=function(e,t,r){return t=wC(t),!(hO(e,t)&&kC(r)&&PC(r,"value"))||PC(r,"get")||PC(r,"set")||r.configurable||PC(r,"writable")&&!r.writable||PC(r,"enumerable")&&!r.enumerable?XC(e,t,r):(e[t]=r.value,e)};EC?(eO||(HC.f=pO,GC.f=fO,dO(iO,"buffer"),dO(iO,"byteOffset"),dO(iO,"byteLength"),dO(iO,"length")),vC({target:"Object",stat:!0,forced:!eO},{getOwnPropertyDescriptor:pO,defineProperty:fO}),hR.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=mC[i],c=s,u=c&&c.prototype,d={},l=function(e,t){XC(e,t,{get:function(){return function(e,t){var r=KC(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=KC(e);r&&(i=(i=JC(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};eO?yC&&(c=t((function(e,t,r,i){return TC(e,u),zC(kC(t)?lO(t)?void 0!==i?new s(t,NC(r,n),i):void 0!==r?new s(t,NC(r,n)):new s(t):aO(t)?uO(c,t):SC(FC,c,t):new s(OC(t)),e,c)})),xC&&xC(c,nO),BC(VC(s),(function(e){e in c||AC(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,i){TC(e,u);var o,a,s,d=0,h=0;if(kC(t)){if(!lO(t))return aO(t)?uO(c,t):SC(FC,c,t);o=t,h=NC(r,n);var p=t.byteLength;if(void 0===i){if(p%n)throw qC(cO);if((a=p-h)<0)throw qC(cO)}else if((a=CC(i)*n)+h>p)throw qC(cO);s=a/n}else s=OC(t),o=new ZC(a=s*n);for(YC(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new QC(o)});d<s;)l(e,d++)})),xC&&xC(c,nO),u=c.prototype=UC(iO)),u.constructor!==c&&AC(u,"constructor",c),AC(u,tO,c),rO&&AC(u,rO,i),d[i]=c,vC({global:!0,forced:c!=s,sham:!eO},d),sO in c||AC(c,sO,n),sO in u||AC(u,sO,n),jC(i)}):hR.exports=function(){},(0,hR.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var _O=Me,vO=$r,mO=nn,SO=Math.min,EO=[].copyWithin||function(e,t){var r=_O(this),n=mO(r),i=vO(e,n),o=vO(t,n),a=arguments.length>2?arguments[2]:void 0,s=SO((void 0===a?n:vO(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},yO=KR,gO=I(EO),bO=yO.aTypedArray;(0,yO.exportTypedArrayMethod)("copyWithin",(function(e,t){return gO(bO(this),e,t,arguments.length>2?arguments[2]:void 0)}));var TO=ba.every,IO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("every",(function(e){return TO(IO(this),e,arguments.length>1?arguments[1]:void 0)}));var AO=l,RO=WI,CO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return AO(RO,CO(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var OO=nn,NO=uu,wO=KR.TYPED_ARRAY_CONSTRUCTOR,PO=KR.aTypedArrayConstructor,DO=function(e){return PO(NO(e,e[wO]))},kO=function(e,t){for(var r=0,n=OO(t),i=new e(n);n>r;)i[r]=t[r++];return i},MO=DO,UO=ba.filter,LO=function(e,t){return kO(MO(e),t)},xO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("filter",(function(e){var t=UO(xO(this),e,arguments.length>1?arguments[1]:void 0);return LO(this,t)}));var VO=ba.find,FO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("find",(function(e){return VO(FO(this),e,arguments.length>1?arguments[1]:void 0)}));var BO=ba.findIndex,jO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("findIndex",(function(e){return BO(jO(this),e,arguments.length>1?arguments[1]:void 0)}));var GO=ba.forEach,HO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("forEach",(function(e){GO(HO(this),e,arguments.length>1?arguments[1]:void 0)}));var zO=un.includes,KO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("includes",(function(e){return zO(KO(this),e,arguments.length>1?arguments[1]:void 0)}));var YO=un.indexOf,XO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("indexOf",(function(e){return YO(XO(this),e,arguments.length>1?arguments[1]:void 0)}));var WO=i,JO=a,qO=I,ZO=KR,$O=up,QO=Qe("iterator"),eN=WO.Uint8Array,tN=qO($O.values),rN=qO($O.keys),nN=qO($O.entries),iN=ZO.aTypedArray,oN=ZO.exportTypedArrayMethod,aN=eN&&eN.prototype,sN=!JO((function(){aN[QO].call([1])})),cN=!!aN&&aN.values&&aN[QO]===aN.values&&"values"===aN.values.name,uN=function(){return tN(iN(this))};oN("entries",(function(){return nN(iN(this))}),sN),oN("keys",(function(){return rN(iN(this))}),sN),oN("values",uN,sN||!cN,{name:"values"}),oN(QO,uN,sN||!cN,{name:"values"});var dN=KR.aTypedArray,lN=KR.exportTypedArrayMethod,hN=I([].join);lN("join",(function(e){return hN(dN(this),e)}));var pN=$i,fN=F,_N=Wr,vN=nn,mN=ji,SN=Math.min,EN=[].lastIndexOf,yN=!!EN&&1/[1].lastIndexOf(1,-0)<0,gN=mN("lastIndexOf"),bN=yN||!gN?function(e){if(yN)return pN(EN,this,arguments)||0;var t=fN(this),r=vN(t),n=r-1;for(arguments.length>1&&(n=SN(n,_N(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:EN,TN=$i,IN=bN,AN=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return TN(IN,AN(this),t>1?[e,arguments[1]]:[e])}));var RN=ba.map,CN=DO,ON=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("map",(function(e){return RN(ON(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(CN(e))(t)}))}));var NN=LS.left,wN=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return NN(wN(this),e,t,t>1?arguments[1]:void 0)}));var PN=LS.right,DN=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return PN(DN(this),e,t,t>1?arguments[1]:void 0)}));var kN=KR.aTypedArray,MN=KR.exportTypedArrayMethod,UN=Math.floor;MN("reverse",(function(){for(var e,t=this,r=kN(t).length,n=UN(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var LN=i,xN=l,VN=KR,FN=nn,BN=aC,jN=Me,GN=a,HN=LN.RangeError,zN=LN.Int8Array,KN=zN&&zN.prototype,YN=KN&&KN.set,XN=VN.aTypedArray,WN=VN.exportTypedArrayMethod,JN=!GN((function(){var e=new Uint8ClampedArray(2);return xN(YN,e,{length:1,0:3},1),3!==e[1]})),qN=JN&&VN.NATIVE_ARRAY_BUFFER_VIEWS&&GN((function(){var e=new zN(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));WN("set",(function(e){XN(this);var t=BN(arguments.length>1?arguments[1]:void 0,1),r=jN(e);if(JN)return xN(YN,this,r,t);var n=this.length,i=FN(r),o=0;if(i+t>n)throw HN("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!JN||qN);var ZN=DO,$N=Po,QN=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("slice",(function(e,t){for(var r=$N(QN(this),e,t),n=ZN(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 ew=ba.some,tw=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("some",(function(e){return ew(tw(this),e,arguments.length>1?arguments[1]:void 0)}));var rw=i,nw=I,iw=a,ow=me,aw=sI,sw=KR,cw=uI,uw=dI,dw=te,lw=hI,hw=rw.Array,pw=sw.aTypedArray,fw=sw.exportTypedArrayMethod,_w=rw.Uint16Array,vw=_w&&nw(_w.prototype.sort),mw=!(!vw||iw((function(){vw(new _w(2),null)}))&&iw((function(){vw(new _w(2),{})}))),Sw=!!vw&&!iw((function(){if(dw)return dw<74;if(cw)return cw<67;if(uw)return!0;if(lw)return lw<602;var e,t,r=new _w(516),n=hw(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(vw(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));fw("sort",(function(e){return void 0!==e&&ow(e),Sw?vw(this,e):aw(pw(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||mw);var Ew=tn,yw=$r,gw=DO,bw=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("subarray",(function(e,t){var r=bw(this),n=r.length,i=yw(e,n);return new(gw(r))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,Ew((void 0===t?n:yw(t,n))-i))}));var Tw=$i,Iw=KR,Aw=a,Rw=Po,Cw=i.Int8Array,Ow=Iw.aTypedArray,Nw=Iw.exportTypedArrayMethod,ww=[].toLocaleString,Pw=!!Cw&&Aw((function(){ww.call(new Cw(1))}));Nw("toLocaleString",(function(){return Tw(ww,Pw?Rw(Ow(this)):Ow(this),Rw(arguments))}),Aw((function(){return[1,2].toLocaleString()!=new Cw([1,2]).toLocaleString()}))||!Aw((function(){Cw.prototype.toLocaleString.call([1,2])})));var Dw=KR.exportTypedArrayMethod,kw=a,Mw=I,Uw=i.Uint8Array,Lw=Uw&&Uw.prototype||{},xw=[].toString,Vw=Mw([].join);kw((function(){xw.call({})}))&&(xw=function(){return Vw(this)});var Fw=Lw.toString!=xw;Dw("toString",xw,Fw);var Bw=Xn,jw=i,Gw=$i,Hw=B,zw=Po,Kw=lu,Yw=/MSIE .\./.test(W),Xw=jw.Function,Ww=function(e){return function(t,r){var n=Kw(arguments.length,1)>2,i=Hw(t)?t:Xw(t),o=n?zw(arguments,2):void 0;return e(n?function(){Gw(i,this,o)}:i,r)}};Bw({global:!0,bind:!0,forced:Yw},{setTimeout:Ww(jw.setTimeout),setInterval:Ww(jw.setInterval)});var Jw=Xn,qw=ba.findIndex,Zw=ah,$w="findIndex",Qw=!0;$w in[]&&Array(1).findIndex((function(){Qw=!1})),Jw({target:"Array",proto:!0,forced:Qw},{findIndex:function(e){return qw(this,e,arguments.length>1?arguments[1]:void 0)}}),Zw($w);var eP,tP,rP=cc,nP="ArrayBuffer",iP=JA.ArrayBuffer;Xn({global:!0,forced:i.ArrayBuffer!==iP},{ArrayBuffer:iP}),rP(nP),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN"}(eP||(eP={})),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"}(tP||(tP={}));var oP=function(e,t,r){this.code=e,this.message=t,this.error=r},aP=s,sP=I,cP=oi,uP=F,dP=sP(h.f),lP=sP([].push),hP=function(e){return function(t){for(var r,n=uP(t),i=cP(n),o=i.length,a=0,s=[];o>a;)r=i[a++],aP&&!dP(n,r)||lP(s,e?[r,n[r]]:n[r]);return s}},pP={entries:hP(!0),values:hP(!1)}.entries;Xn({target:"Object",stat:!0},{entries:function(e){return pP(e)}});var fP=Wr,_P=fo,vP=L,mP=i.RangeError,SP=I,EP=tn,yP=fo,gP=function(e){var t=_P(vP(this)),r="",n=fP(e);if(n<0||n==1/0)throw mP("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},bP=L,TP=SP(gP),IP=SP("".slice),AP=Math.ceil,RP=function(e){return function(t,r,n){var i,o,a=yP(bP(t)),s=EP(r),c=a.length,u=void 0===n?" ":yP(n);return s<=c||""==u?a:((o=TP(u,AP((i=s-c)/u.length))).length>i&&(o=IP(o,0,i)),e?a+o:o+a)}},CP={start:RP(!1),end:RP(!0)},OP=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(W),NP=CP.end;Xn({target:"String",proto:!0,forced:OP},{padEnd:function(e){return NP(this,e,arguments.length>1?arguments[1]:void 0)}});var wP=Am;Xn({target:"Number",stat:!0,forced:Number.parseInt!=wP},{parseInt:wP});Xn({target:"ArrayBuffer",stat:!0,forced:!KR.NATIVE_ARRAY_BUFFER_VIEWS},{isView:KR.isView}),Xn({global:!0,forced:!kI},{DataView:JA.DataView});var PP=kt,DP=Dc,kP=Yo,MP=l,UP=Me,LP=function(e,t,r,n){try{return n?t(PP(r)[0],r[1]):t(r)}catch(t){DP(e,"throw",t)}},xP=vc,VP=aa,FP=nn,BP=Eo,jP=Oc,GP=gc,HP=i.Array,zP=function(e){var t=UP(e),r=VP(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=kP(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=GP(t),p=0;if(!h||this==HP&&xP(h))for(a=FP(t),s=r?new this(a):HP(a);a>p;p++)l=o?i(t[p],p):t[p],BP(s,p,l);else for(d=(u=jP(t,h)).next,s=r?new this:[];!(c=MP(d,u)).done;p++)l=o?LP(u,i,[c.value,p],!0):c.value,BP(s,p,l);return s.length=p,s},KP=zP;Xn({target:"Array",stat:!0,forced:!tu((function(e){Array.from(e)}))},{from:KP});var YP,XP=Xn,WP=eo,JP=I([].reverse),qP=[1,2];XP({target:"Array",proto:!0,forced:String(qP)===String(qP.reverse())},{reverse:function(){return WP(this)&&(this.length=this.length),JP(this)}});var ZP=new Uint8Array(16);function $P(){if(!YP&&!(YP="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 YP(ZP)}var QP=/^(?:[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 eD(e){return"string"==typeof e&&QP.test(e)}for(var tD=[],rD=0;rD<256;++rD)tD.push((rD+256).toString(16).substr(1));function nD(e,t,r){var n=(e=e||{}).random||(e.rng||$P)();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=(tD[e[t+0]]+tD[e[t+1]]+tD[e[t+2]]+tD[e[t+3]]+"-"+tD[e[t+4]]+tD[e[t+5]]+"-"+tD[e[t+6]]+tD[e[t+7]]+"-"+tD[e[t+8]]+tD[e[t+9]]+"-"+tD[e[t+10]]+tD[e[t+11]]+tD[e[t+12]]+tD[e[t+13]]+tD[e[t+14]]+tD[e[t+15]]).toLowerCase();if(!eD(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var iD=new TextDecoder,oD=new TextEncoder,aD=function(){return nD()},sD=function(){return Date.now()};function cD(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=$f(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=$f(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 uD=function(){return"undefined"==typeof window},dD=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=$f(Object.entries(r)),s=a.next();!s.done;s=a.next()){var c=Qf(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 iD.decode(e)},e.ab2obj=function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}},e.str2ab=function(e){return oD.encode(e).buffer},e.ab2b64str=function(e){return qf(this,void 0,void 0,(function(){return Zf(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 qf(this,void 0,void 0,(function(){return Zf(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function lD(){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)}))}var hD=function(){return Math.floor(65535*Math.random())};function pD(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function fD(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=e_(e_(e_([],Qf(a),!1),["..."],!1),Qf(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 _D=function(){return qf(void 0,void 0,void 0,(function(){var e,t;return Zf(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]}}))}))},vD=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 mD(e,t){if("boolean"!=typeof e)throw new oP(eP.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function SD(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 oP(eP.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function ED(e,t,r,n){if(void 0===r&&(r=1),void 0===n&&(n=Number.POSITIVE_INFINITY),null==e)throw new oP(eP.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 oP(eP.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function yD(e,t,r){if(!r.includes(e))throw new oP(eP.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function gD(e,t){if(ID(e))throw new oP(eP.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function bD(e,t){if(!(e instanceof ArrayBuffer))throw new oP(eP.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function TD(e){var t,r;try{var n=navigator.mediaDevices.getSupportedConstraints();try{for(var i=$f(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 ID(e){return null==e}function AD(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new oP(eP.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function RD(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new oP(eP.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function CD(e){gD(e,"videoPlayerOption")}function OD(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 oP(eP.INVALID_PARAMS,"The message cannot be empty");if((null==(n=e instanceof ArrayBuffer?e:dD.str2ab(JSON.stringify(e)))?void 0:n.byteLength)>1e3*t)throw new oP(eP.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function ND(e){return![o_.onRemoteStreamStats,o_.onLocalStreamStats].includes(e)}var wD={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}(wD);var PD="[VERTC]",DD=["#0050b3","#0050b3","#0050b3","#0050b3"],kD=!uD()&&window.location.search.includes("_rtc_debug_"),MD=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(kD){for(var n="",i=0;i<this._indent;i++)n+=" ";console.log.apply(console,e_(["%c".concat(PD).concat(n,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(DD[this._indent],";")],Qf(t),!1))}},e}(),UD=new MD("VERTC",0),LD=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,e_([t],Qf(r),!1))}catch(e){return UD.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 qf(this,void 0,void 0,(function(){var r=this;return Zf(this,(function(n){return[2,new Promise((function(n,i){try{r.emit.apply(r,e_(e_([e],Qf(t),!1),[n,i],!1))}catch(t){UD.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),i(t)}}))]}))}))},t}(wD.exports.EventEmitter),xD=xe,VD=function(e){return void 0!==e&&(xD(e,"value")||xD(e,"writable"))},FD=l,BD=G,jD=kt,GD=VD,HD=o,zD=vh;Xn({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return jD(t)===o?t[r]:(n=HD.f(t,r))?GD(n)?n.value:void 0===n.get?void 0:FD(n.get,o):BD(i=zD(t))?e(i,r,o):void 0}});var KD=Xn,YD=l,XD=kt,WD=G,JD=VD,qD=Ct,ZD=o,$D=vh,QD=S;var ek=a((function(){var e=function(){},t=qD.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));KD({target:"Reflect",stat:!0,forced:ek},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=ZD.f(XD(t),r);if(!c){if(WD(o=$D(t)))return e(o,r,n,s);c=QD(0)}if(JD(c)){if(!1===c.writable||!WD(s))return!1;if(i=ZD.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,qD.f(s,r,i)}else qD.f(s,r,QD(0,n))}else{if(void 0===(a=c.set))return!1;YD(a,s,n)}return!0}});var tk="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function rk(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var nk="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",ik="rtc.rtcplus.com".split(","),ok={VERSION:"4.41.2",ICE_CONFIG_REQUEST_URLS_INTERNAL:tk.map(rk),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:nk,CONFIG_REQUEST_DOMAINS:ik};function ak(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(ok.ICE_CONFIG_REQUEST_URLS=t.map(rk))):void("LOG_SERVER_URL"!==e||t!==zf.overseas?"LOG_SERVER_URL"!==e||t!==zf.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?ok[e]=t:ok.LOG_SERVER_URL=t:ok.LOG_SERVER_URL=nk:ok.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function sk(e){return ok[e]}function ck(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||dk.audio.codec,bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||dk.audio.kBitRate),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||dk.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||dk.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||dk.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||dk.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||dk.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||dk.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:dk.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||dk.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||dk.video.width,height:(null===(f=t.video)||void 0===f?void 0:f.height)||dk.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||dk.layout.backgroundColor},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(S=t.layout)||void 0===S?void 0:S.appData)||dk.layout.appData}}}}function uk(e,t,r){var n,i,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(n=r.video)||void 0===n?void 0:n.fps)||15,bitrate:1e3*((null===(i=r.video)||void 0===i?void 0:i.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||Xf.PREV_FRAME,canvas:{bgColor:(null===(c=r.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=r.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(l=null===(d=r.layout)||void 0===d?void 0:d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:e.alpha,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var dk={url:"",video:{codec:"H264",width:640,height:360,fps:30,gop:60,kBitRate:600,lowLatency:!0},audio:{codec:"AAC",kBitRate:64,sampleRate:48,channels:2,AACProfile:"LC"},layout:{regions:[],appData:"",backgroundColor:"#000000"}};(0,hR.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,hR.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var lk={};!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)}(lk);var hk={},pk={},fk={},_k=lk;function vk(e){for(var t=e.length;--t>=0;)e[t]=0}var mk=256,Sk=286,Ek=30,yk=15,gk=[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],bk=[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],Tk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Ik=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Ak=new Array(576);vk(Ak);var Rk=new Array(60);vk(Rk);var Ck=new Array(512);vk(Ck);var Ok=new Array(256);vk(Ok);var Nk=new Array(29);vk(Nk);var wk,Pk,Dk,kk=new Array(Ek);function Mk(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 Uk(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Lk(e){return e<256?Ck[e]:Ck[256+(e>>>7)]}function xk(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function Vk(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,xk(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 Fk(e,t,r){Vk(e,r[2*t],r[2*t+1])}function Bk(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function jk(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=yk;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]=Bk(o[s]++,s))}}function Gk(e){var t;for(t=0;t<Sk;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Ek;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 Hk(e){e.bi_valid>8?xk(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 zk(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 Kk(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&zk(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!zk(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function Yk(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?Fk(e,i,t):(Fk(e,(o=Ok[i])+mk+1,t),0!==(a=gk[o])&&Vk(e,i-=Nk[o],a),Fk(e,o=Lk(--n),r),0!==(a=bk[o])&&Vk(e,n-=kk[o],a))}while(s<e.last_lit);Fk(e,256,t)}function Xk(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--)Kk(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Kk(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++,Kk(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<=yk;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),jk(o,u,e.bl_count)}function Wk(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 Jk(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{Fk(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(Fk(e,i,e.bl_tree),s--),Fk(e,16,e.bl_tree),Vk(e,s-3,2)):s<=10?(Fk(e,17,e.bl_tree),Vk(e,s-3,3)):(Fk(e,18,e.bl_tree),Vk(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}vk(kk);var qk=!1;function Zk(e,t,r,n){Vk(e,0+(n?1:0),3),function(e,t,r,n){Hk(e),n&&(xk(e,r),xk(e,~r)),_k.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}fk._tr_init=function(e){qk||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(Nk[n]=r,e=0;e<1<<gk[n];e++)Ok[r++]=n;for(Ok[r-1]=n,i=0,n=0;n<16;n++)for(kk[n]=i,e=0;e<1<<bk[n];e++)Ck[i++]=n;for(i>>=7;n<Ek;n++)for(kk[n]=i<<7,e=0;e<1<<bk[n]-7;e++)Ck[256+i++]=n;for(t=0;t<=yk;t++)o[t]=0;for(e=0;e<=143;)Ak[2*e+1]=8,e++,o[8]++;for(;e<=255;)Ak[2*e+1]=9,e++,o[9]++;for(;e<=279;)Ak[2*e+1]=7,e++,o[7]++;for(;e<=287;)Ak[2*e+1]=8,e++,o[8]++;for(jk(Ak,287,o),e=0;e<Ek;e++)Rk[2*e+1]=5,Rk[2*e]=Bk(e,5);wk=new Mk(Ak,gk,257,Sk,yk),Pk=new Mk(Rk,bk,0,Ek,yk),Dk=new Mk(new Array(0),Tk,0,19,7)}(),qk=!0),e.l_desc=new Uk(e.dyn_ltree,wk),e.d_desc=new Uk(e.dyn_dtree,Pk),e.bl_desc=new Uk(e.bl_tree,Dk),e.bi_buf=0,e.bi_valid=0,Gk(e)},fk._tr_stored_block=Zk,fk._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<mk;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),Xk(e,e.l_desc),Xk(e,e.d_desc),a=function(e){var t;for(Wk(e,e.dyn_ltree,e.l_desc.max_code),Wk(e,e.dyn_dtree,e.d_desc.max_code),Xk(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Ik[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?Zk(e,t,r,n):4===e.strategy||o===i?(Vk(e,2+(n?1:0),3),Yk(e,Ak,Rk)):(Vk(e,4+(n?1:0),3),function(e,t,r,n){var i;for(Vk(e,t-257,5),Vk(e,r-1,5),Vk(e,n-4,4),i=0;i<n;i++)Vk(e,e.bl_tree[2*Ik[i]+1],3);Jk(e,e.dyn_ltree,t-1),Jk(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Yk(e,e.dyn_ltree,e.dyn_dtree)),Gk(e),n&&Hk(e)},fk._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*(Ok[r]+mk+1)]++,e.dyn_dtree[2*Lk(t)]++),e.last_lit===e.lit_bufsize-1},fk._tr_align=function(e){Vk(e,2,3),Fk(e,256,Ak),function(e){16===e.bi_valid?(xk(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 $k=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 Qk=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 eM,tM=function(e,t,r,n){var i=Qk,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},rM={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},nM=lk,iM=fk,oM=$k,aM=tM,sM=rM,cM=-2,uM=258,dM=262,lM=103,hM=113,pM=666;function fM(e,t){return e.msg=sM[t],t}function _M(e){return(e<<1)-(e>4?9:0)}function vM(e){for(var t=e.length;--t>=0;)e[t]=0}function mM(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(nM.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 SM(e,t){iM._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,mM(e.strm)}function EM(e,t){e.pending_buf[e.pending++]=t}function yM(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function gM(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-dM?e.strstart-(e.w_size-dM):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+uM,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=uM-(h-o),o=h-uM,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 bM(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-dM)){nM.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,nM.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=oM(a.adler,s,d,c):2===a.state.wrap&&(a.adler=aM(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<dM&&0!==e.strm.avail_in)}function TM(e,t){for(var r,n;;){if(e.lookahead<dM){if(bM(e),e.lookahead<dM&&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-dM&&(e.match_length=gM(e,r)),e.match_length>=3)if(n=iM._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=iM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(SM(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(SM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(SM(e,!1),0===e.strm.avail_out)?1:2}function IM(e,t){for(var r,n,i;;){if(e.lookahead<dM){if(bM(e),e.lookahead<dM&&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-dM&&(e.match_length=gM(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=iM._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&&(SM(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=iM._tr_tally(e,0,e.window[e.strstart-1]))&&SM(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=iM._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(SM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(SM(e,!1),0===e.strm.avail_out)?1:2}function AM(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 RM(){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 nM.Buf16(1146),this.dyn_dtree=new nM.Buf16(122),this.bl_tree=new nM.Buf16(78),vM(this.dyn_ltree),vM(this.dyn_dtree),vM(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new nM.Buf16(16),this.heap=new nM.Buf16(573),vM(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new nM.Buf16(573),vM(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 CM(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:hM,e.adler=2===t.wrap?0:1,t.last_flush=0,iM._tr_init(t),0):fM(e,cM)}function OM(e){var t,r=CM(e);return 0===r&&((t=e.state).window_size=2*t.w_size,vM(t.head),t.max_lazy_match=eM[t.level].max_lazy,t.good_match=eM[t.level].good_length,t.nice_match=eM[t.level].nice_length,t.max_chain_length=eM[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 NM(e,t,r,n,i,o){if(!e)return cM;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 fM(e,cM);8===n&&(n=9);var s=new RM;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 nM.Buf8(2*s.w_size),s.head=new nM.Buf16(s.hash_size),s.prev=new nM.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new nM.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,OM(e)}eM=[new AM(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(bM(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,SM(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-dM&&(SM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(SM(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(SM(e,!1),e.strm.avail_out),1)})),new AM(4,4,8,4,TM),new AM(4,5,16,8,TM),new AM(4,6,32,32,TM),new AM(4,4,16,16,IM),new AM(8,16,32,32,IM),new AM(8,16,128,128,IM),new AM(8,32,128,256,IM),new AM(32,128,258,1024,IM),new AM(32,258,258,4096,IM)],pk.deflateInit=function(e,t){return NM(e,t,8,15,8,0)},pk.deflateInit2=NM,pk.deflateReset=OM,pk.deflateResetKeep=CM,pk.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?cM:(e.state.gzhead=t,0):cM},pk.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?fM(e,cM):cM;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===pM&&4!==t)return fM(e,0===e.avail_out?-5:cM);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,EM(n,31),EM(n,139),EM(n,8),n.gzhead?(EM(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)),EM(n,255&n.gzhead.time),EM(n,n.gzhead.time>>8&255),EM(n,n.gzhead.time>>16&255),EM(n,n.gzhead.time>>24&255),EM(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),EM(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(EM(n,255&n.gzhead.extra.length),EM(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=aM(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(EM(n,0),EM(n,0),EM(n,0),EM(n,0),EM(n,0),EM(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),EM(n,3),n.status=hM);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=hM,yM(n,a),0!==n.strstart&&(yM(n,e.adler>>>16),yM(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=aM(e.adler,n.pending_buf,n.pending-i,i)),mM(e),i=n.pending,n.pending!==n.pending_buf_size));)EM(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=aM(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=aM(e.adler,n.pending_buf,n.pending-i,i)),mM(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,EM(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=aM(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=aM(e.adler,n.pending_buf,n.pending-i,i)),mM(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,EM(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=aM(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=lM)}else n.status=lM;if(n.status===lM&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&mM(e),n.pending+2<=n.pending_buf_size&&(EM(n,255&e.adler),EM(n,e.adler>>8&255),e.adler=0,n.status=hM)):n.status=hM),0!==n.pending){if(mM(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&_M(t)<=_M(r)&&4!==t)return fM(e,-5);if(n.status===pM&&0!==e.avail_in)return fM(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==pM){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(bM(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=iM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(SM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(SM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(SM(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<=uM){if(bM(e),e.lookahead<=uM&&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+uM;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=uM-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=iM._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=iM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(SM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(SM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(SM(e,!1),0===e.strm.avail_out)?1:2}(n,t):eM[n.level].func(n,t);if(3!==s&&4!==s||(n.status=pM),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?iM._tr_align(n):5!==t&&(iM._tr_stored_block(n,0,0,!1),3===t&&(vM(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),mM(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(EM(n,255&e.adler),EM(n,e.adler>>8&255),EM(n,e.adler>>16&255),EM(n,e.adler>>24&255),EM(n,255&e.total_in),EM(n,e.total_in>>8&255),EM(n,e.total_in>>16&255),EM(n,e.total_in>>24&255)):(yM(n,e.adler>>>16),yM(n,65535&e.adler)),mM(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},pk.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==lM&&t!==hM&&t!==pM?fM(e,cM):(e.state=null,t===hM?fM(e,-3):0):cM},pk.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return cM;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return cM;for(1===o&&(e.adler=oM(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(vM(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new nM.Buf8(r.w_size),nM.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,bM(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,bM(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},pk.deflateInfo="pako deflate (from Nodeca project)";var wM={},PM=lk,DM=!0,kM=!0;try{String.fromCharCode.apply(null,[0])}catch(e){DM=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){kM=!1}for(var MM=new PM.Buf8(256),UM=0;UM<256;UM++)MM[UM]=UM>=252?6:UM>=248?5:UM>=240?4:UM>=224?3:UM>=192?2:1;function LM(e,t){if(t<65534&&(e.subarray&&kM||!e.subarray&&DM))return String.fromCharCode.apply(null,PM.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}MM[254]=MM[254]=1,wM.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 PM.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},wM.buf2binstring=function(e){return LM(e,e.length)},wM.binstring2buf=function(e){for(var t=new PM.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},wM.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=MM[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 LM(s,n)},wM.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+MM[e[r]]>t?r:t};var xM=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},VM=pk,FM=lk,BM=wM,jM=rM,GM=xM,HM=Object.prototype.toString;function zM(e){if(!(this instanceof zM))return new zM(e);this.options=FM.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 GM,this.strm.avail_out=0;var r=VM.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(jM[r]);if(t.header&&VM.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?BM.string2buf(t.dictionary):"[object ArrayBuffer]"===HM.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=VM.deflateSetDictionary(this.strm,n)))throw new Error(jM[r]);this._dict_set=!0}}function KM(e,t){var r=new zM(t);if(r.push(e,!0),r.err)throw r.msg||jM[r.err];return r.result}zM.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=BM.string2buf(e):"[object ArrayBuffer]"===HM.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 FM.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=VM.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(BM.buf2binstring(FM.shrinkBuf(i.output,i.next_out))):this.onData(FM.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=VM.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},zM.prototype.onData=function(e){this.chunks.push(e)},zM.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=FM.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},hk.Deflate=zM,hk.deflate=KM,hk.deflateRaw=function(e,t){return(t=t||{}).raw=!0,KM(e,t)},hk.gzip=function(e,t){return(t=t||{}).gzip=!0,KM(e,t)};var YM={},XM=s,WM=Ct,JM=K_,qM=a,ZM=RegExp.prototype;XM&&qM((function(){return"sy"!==Object.getOwnPropertyDescriptor(ZM,"flags").get.call({dotAll:!0,sticky:!0})}))&&WM.f(ZM,"flags",{configurable:!0,get:JM});var $M={},QM=lk,eU=15,tU=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],rU=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],nU=[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],iU=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],oU=lk,aU=$k,sU=tM,cU=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,A,R;r=e.state,n=e.next_in,A=e.input,i=n+(e.avail_in-5),o=e.next_out,R=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,p=r.hold,f=r.bits,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,S=(1<<r.distbits)-1;e:do{f<15&&(p+=A[n++]<<f,f+=8,p+=A[n++]<<f,f+=8),E=_[p&m];t:for(;;){if(p>>>=y=E>>>24,f-=y,0===(y=E>>>16&255))R[o++]=65535&E;else{if(!(16&y)){if(0==(64&y)){E=_[(65535&E)+(p&(1<<y)-1)];continue t}if(32&y){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}g=65535&E,(y&=15)&&(f<y&&(p+=A[n++]<<f,f+=8),g+=p&(1<<y)-1,p>>>=y,f-=y),f<15&&(p+=A[n++]<<f,f+=8,p+=A[n++]<<f,f+=8),E=v[p&S];r:for(;;){if(p>>>=y=E>>>24,f-=y,!(16&(y=E>>>16&255))){if(0==(64&y)){E=v[(65535&E)+(p&(1<<y)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&E,f<(y&=15)&&(p+=A[n++]<<f,(f+=8)<y&&(p+=A[n++]<<f,f+=8)),(b+=p&(1<<y)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=y,f-=y,b>(y=o-a)){if((y=b-y)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(T=0,I=h,0===l){if(T+=u-y,y<g){g-=y;do{R[o++]=h[T++]}while(--y);T=o-b,I=R}}else if(l<y){if(T+=u+l-y,(y-=l)<g){g-=y;do{R[o++]=h[T++]}while(--y);if(T=0,l<g){g-=y=l;do{R[o++]=h[T++]}while(--y);T=o-b,I=R}}}else if(T+=l-y,y<g){g-=y;do{R[o++]=h[T++]}while(--y);T=o-b,I=R}for(;g>2;)R[o++]=I[T++],R[o++]=I[T++],R[o++]=I[T++],g-=3;g&&(R[o++]=I[T++],g>1&&(R[o++]=I[T++]))}else{T=o-b;do{R[o++]=R[T++],R[o++]=R[T++],R[o++]=R[T++],g-=3}while(g>2);g&&(R[o++]=R[T++],g>1&&(R[o++]=R[T++]))}break}}break}}while(n<i&&o<s);n-=g=f>>3,p&=(1<<(f-=g<<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},uU=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,p,f,_,v,m=s.bits,S=0,E=0,y=0,g=0,b=0,T=0,I=0,A=0,R=0,C=0,O=null,N=0,w=new QM.Buf16(16),P=new QM.Buf16(16),D=null,k=0;for(S=0;S<=eU;S++)w[S]=0;for(E=0;E<n;E++)w[t[r+E]]++;for(b=m,g=eU;g>=1&&0===w[g];g--);if(b>g&&(b=g),0===g)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(y=1;y<g&&0===w[y];y++);for(b<y&&(b=y),A=1,S=1;S<=eU;S++)if(A<<=1,(A-=w[S])<0)return-1;if(A>0&&(0===e||1!==g))return-1;for(P[1]=0,S=1;S<eU;S++)P[S+1]=P[S]+w[S];for(E=0;E<n;E++)0!==t[r+E]&&(a[P[t[r+E]]++]=E);if(0===e?(O=D=a,p=19):1===e?(O=tU,N-=257,D=rU,k-=257,p=256):(O=nU,D=iU,p=-1),C=0,E=0,S=y,h=o,T=b,I=0,d=-1,l=(R=1<<b)-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){f=S-I,a[E]<p?(_=0,v=a[E]):a[E]>p?(_=D[k+a[E]],v=O[N+a[E]]):(_=96,v=0),c=1<<S-I,y=u=1<<T;do{i[h+(C>>I)+(u-=c)]=f<<24|_<<16|v|0}while(0!==u);for(c=1<<S-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,E++,0==--w[S]){if(S===g)break;S=t[r+a[E]]}if(S>b&&(C&l)!==d){for(0===I&&(I=b),h+=y,A=1<<(T=S-I);T+I<g&&!((A-=w[T+I])<=0);)T++,A<<=1;if(R+=1<<T,1===e&&R>852||2===e&&R>592)return 1;i[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(i[h+C]=S-I<<24|64<<16|0),s.bits=b,0},dU=-2,lU=12,hU=30;function pU(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function fU(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new oU.Buf16(320),this.work=new oU.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _U(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new oU.Buf32(852),t.distcode=t.distdyn=new oU.Buf32(592),t.sane=1,t.back=-1,0):dU}function vU(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_U(e)):dU}function mU(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)?dU:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,vU(e))):dU}function SU(e,t){var r,n;return e?(n=new fU,e.state=n,n.window=null,0!==(r=mU(e,t))&&(e.state=null),r):dU}var EU,yU,gU=!0;function bU(e){if(gU){var t;for(EU=new oU.Buf32(512),yU=new oU.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(uU(1,e.lens,0,288,EU,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;uU(2,e.lens,0,32,yU,0,e.work,{bits:5}),gU=!1}e.lencode=EU,e.lenbits=9,e.distcode=yU,e.distbits=5}function TU(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 oU.Buf8(o.wsize)),n>=o.wsize?(oU.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),oU.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(oU.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}$M.inflateReset=vU,$M.inflateReset2=mU,$M.inflateResetKeep=_U,$M.inflateInit=function(e){return SU(e,15)},$M.inflateInit2=SU,$M.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,A,R=0,C=new oU.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return dU;(r=e.state).mode===lU&&(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=sU(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=hU;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=hU;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=hU;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:lU,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=hU;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=hU;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=sU(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=sU(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=sU(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=sU(r.check,C,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((p=r.length)>s&&(p=s),p&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),oU.arraySet(r.head.extra,n,o,p,b)),512&r.flags&&(r.check=sU(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=sU(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=sU(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=hU;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=lU;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=pU(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=lU;case lU: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(bU(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=hU}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=hU;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;oU.arraySet(i,n,o,p,a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=lU;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=hU;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=uU(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid code lengths set",r.mode=hU;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(R=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,S=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(S<16)u>>>=v,d-=v,r.lens[r.have++]=S;else{if(16===S){for(A=v+2;d<A;){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=hU;break}b=r.lens[r.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===S){for(A=v+3;d<A;){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(A=v+7;d<A;){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=hU;break}for(;p--;)r.lens[r.have++]=b}}if(r.mode===hU)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=hU;break}if(r.lenbits=9,I={bits:r.lenbits},T=uU(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=hU;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},T=uU(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=hU;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,cU(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===lU&&(r.back=-1);break}for(r.back=0;m=(R=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,S=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(E=v,y=m,g=S;m=(R=r.lencode[g+((u&(1<<E+y)-1)>>E)])>>>16&255,S=65535&R,!(E+(v=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=E,d-=E,r.back+=E}if(u>>>=v,d-=v,r.back+=v,r.length=S,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=lU;break}if(64&m){e.msg="invalid literal/length code",r.mode=hU;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(A=r.extra;d<A;){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=(R=r.distcode[u&(1<<r.distbits)-1])>>>16&255,S=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(E=v,y=m,g=S;m=(R=r.distcode[g+((u&(1<<E+y)-1)>>E)])>>>16&255,S=65535&R,!(E+(v=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=E,d-=E,r.back+=E}if(u>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=hU;break}r.offset=S,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(A=r.extra;d<A;){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=hU;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=hU;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?sU(r.check,i,h,a-h):aU(r.check,i,h,a-h)),h=c,(r.flags?u:pU(u))!==r.check){e.msg="incorrect data check",r.mode=hU;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=hU;break}u=0,d=0}r.mode=29;case 29:T=1;break e;case hU:T=-3;break e;case 31:return-4;default:return dU}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<hU&&(r.mode<27||4!==t))&&TU(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?sU(r.check,i,h,e.next_out-h):aU(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===lU?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},$M.inflateEnd=function(e){if(!e||!e.state)return dU;var t=e.state;return t.window&&(t.window=null),e.state=null,0},$M.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?dU:(r.head=t,t.done=!1,0):dU},$M.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?dU:11===r.mode&&aU(1,t,n,0)!==r.check?-3:TU(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):dU},$M.inflateInfo="pako inflate (from Nodeca project)";var IU={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 AU=$M,RU=lk,CU=wM,OU=IU,NU=rM,wU=xM,PU=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},DU=Object.prototype.toString;function kU(e){if(!(this instanceof kU))return new kU(e);this.options=RU.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 wU,this.strm.avail_out=0;var r=AU.inflateInit2(this.strm,t.windowBits);if(r!==OU.Z_OK)throw new Error(NU[r]);if(this.header=new PU,AU.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=CU.string2buf(t.dictionary):"[object ArrayBuffer]"===DU.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=AU.inflateSetDictionary(this.strm,t.dictionary))!==OU.Z_OK))throw new Error(NU[r])}function MU(e,t){var r=new kU(t);if(r.push(e,!0),r.err)throw r.msg||NU[r.err];return r.result}kU.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?OU.Z_FINISH:OU.Z_NO_FLUSH,"string"==typeof e?s.input=CU.binstring2buf(e):"[object ArrayBuffer]"===DU.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 RU.Buf8(c),s.next_out=0,s.avail_out=c),(r=AU.inflate(s,OU.Z_NO_FLUSH))===OU.Z_NEED_DICT&&u&&(r=AU.inflateSetDictionary(this.strm,u)),r===OU.Z_BUF_ERROR&&!0===d&&(r=OU.Z_OK,d=!1),r!==OU.Z_STREAM_END&&r!==OU.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==OU.Z_STREAM_END&&(0!==s.avail_in||n!==OU.Z_FINISH&&n!==OU.Z_SYNC_FLUSH)||("string"===this.options.to?(i=CU.utf8border(s.output,s.next_out),o=s.next_out-i,a=CU.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&RU.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(RU.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!==OU.Z_STREAM_END);return r===OU.Z_STREAM_END&&(n=OU.Z_FINISH),n===OU.Z_FINISH?(r=AU.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===OU.Z_OK):n!==OU.Z_SYNC_FLUSH||(this.onEnd(OU.Z_OK),s.avail_out=0,!0)},kU.prototype.onData=function(e){this.chunks.push(e)},kU.prototype.onEnd=function(e){e===OU.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=RU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},YM.Inflate=kU,YM.inflate=MU,YM.inflateRaw=function(e,t){return(t=t||{}).raw=!0,MU(e,t)},YM.ungzip=MU;var UU={};(0,lk.assign)(UU,hk,YM,IU);var LU,xU,VU,FU,BU,jU,GU,HU,zU,KU,YU,XU,WU,JU,qU,ZU,$U,QU,eL,tL,rL,nL,iL,oL,aL,sL,cL,uL,dL,lL,hL,pL,fL,_L,vL,mL,SL,EL,yL,gL,bL,TL,IL,AL,RL,CL,OL,NL=UU,wL=new MD("monitor",0);!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",e.RTC_GET_CONFIG="rtc_get_config",e.RTC_RECONNECT="rtc_reconnect",e.RTC_RECONNECTED="rtc_reconnected",e.RTC_GET_ACCESS="rtc_get_access",e.RTC_PRE_ICE_STATE="rtc_pre_ice_state",e.RTC_NODE_CHANGE="rtc_node_change",e.RTC_SIGNALING_MSG_ERROR="rtc_signaling_msg_error",e.RTC_SIGNALING="rtc_signaling",e.RTC_JOIN_ROOM="rtc_join_room",e.RTC_LEAVE_ROOM="rtc_leave_room",e.RTC_BEGIN_CREATE_OFFER="rtc_begin_create_offer",e.RTC_CREATE_OFFER="rtc_create_offer",e.RTC_SET_DESCRIPTION="rtc_set_description",e.RTC_RECV_ANSWER="rtc_recv_answer",e.FIRST_REMOTE_AUDIO_RENDER="first_remote_audio_render",e.FIRST_REMOTE_VIDEO_RENDER="first_remote_video_render",e.RTC_PUBLISH_STAT="rtc_publish_stat",e.RTC_SUBSCRIBE_STAT="rtc_subscribe_stat",e.RTC_AUDIO_DEVICE="rtc_audio_device",e.RTC_MEDIA_STATISTICS="rtc_media_statistics",e.RTC_MESSAGE_STATISTICS="rtc_message_statistics",e.RTC_ERROR="rtc_error",e.RTC_INVOKE_STATUS="rtc_invoke_status",e.RTC_FIRST_FRAME="rtc_first_frame",e.RTC_MUTE_REMOTE="rtc_mute_remote",e.SDK_INIT_ENGINE="sdk_init_engine",e.JOIN_ROOM="join_room",e.P2P_CONNECTION_STATUS="p2p_connection_status",e.P2P_CONNECT_CLOSED="p2p_connect_closed",e.RTC_DEVICE_ERROR="rtc_device_error",e.RTC_VIDEO_DEVICE="rtc_video_device",e.RTC_VIDEO_CAPTURE_EVENT="rtc_video_capture_event",e.RTC_ENCODE_FIRST_FRAME="rtc_encode_first_frame",e.RTC_FIRST_FRAME_ENCODED="rtc_first_frame_encoded",e.RTC_SEND_FIRST_PACKET="rtc_send_first_packet",e.RTC_RECV_FIRST_PACKET="rtc_recv_first_packet",e.RTC_RECV_FIRST_FRAME="rtc_recv_first_frame",e.RTC_DECODE_FIRST_FRAME="rtc_decode_first_frame"}(LU||(LU={})),function(e){e.RTC="rtc"}(xU||(xU={})),function(e){e.W_5="5"}(VU||(VU={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(FU||(FU={})),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"}(BU||(BU={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(jU||(jU={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(GU||(GU={})),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"}(HU||(HU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(zU||(zU={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(KU||(KU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(YU||(YU={})),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"}(WU||(WU={})),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"}(JU||(JU={})),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"}(qU||(qU={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(ZU||(ZU={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}($U||($U={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(QU||(QU={})),function(e){e.W_0="0",e.W_1="1"}(eL||(eL={})),function(e){e.UP="up",e.DOWN="down"}(tL||(tL={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(rL||(rL={})),function(e){e.UP="up",e.DOWN="down"}(nL||(nL={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(iL||(iL={})),function(e){e.W_0="0",e.W_1="1"}(oL||(oL={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown"}(aL||(aL={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(sL||(sL={})),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"}(cL||(cL={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(uL||(uL={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(dL||(dL={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(lL||(lL={})),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"}(hL||(hL={})),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"}(pL||(pL={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(fL||(fL={})),function(e){e.BEGIN="begin",e.END="end"}(_L||(_L={})),function(e){e.BEGIN="begin",e.END="end"}(vL||(vL={})),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"}(mL||(mL={})),function(e){e.UNKNOWN="unknown",e.NEW="new",e.CHECKING="checking",e.CONNECTED="connected",e.FAILED="failed",e.SELECTED="selected",e.CLOSING="closing",e.CLOSED="closed",e.UNSELECTED="unselected"}(SL||(SL={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(EL||(EL={})),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"}(yL||(yL={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(gL||(gL={})),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"}(bL||(bL={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(TL||(TL={})),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"}(IL||(IL={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(AL||(AL={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(RL||(RL={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(CL||(CL={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(OL||(OL={}));var PL,DL,kL,ML,UL,LL,xL,VL,FL,BL=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}(),jL=function(e){function t(){var t=e.call(this)||this;return t.report_id=0,t.dataBuffer=[],t.posting=!1,t.report_common={},t.modify_ids={},t.preSucTime=0,t.errSendDelay=100,t.commonStats=new BL(t),uD()||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;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())}};var o=ok.LOG_SERVER_URL;if(i.open("POST",o,!0),e||(this.posting=!0),!uD()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",n),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!uD()&&location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var a=NL.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(a)}}},t.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},t.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},t.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,r=t.event_key,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,S=t.app_version,E=t.aid,y=t.device_model,g=t.device_brand,b=t.common_extra_info,T=t.had_selected_p2p,I=t.rtc_env_type,A=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:S,aid:E,device_model:y,device_brand:g,common_extra_info:b,had_selected_p2p:T,rtc_env_type:I,user_agent:A}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id)},t.prototype.rtcSdkApiCall=function(e,t,r,n){void 0===n&&(n={});var i=Wf(Wf({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(i)},t.prototype.rtcSdkCallback=function(e,t,r,n){void 0===n&&(n={});var i=Wf(Wf({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(i)},t.prototype.rtcGetConfig=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=Wf(Wf({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:n,type:i,config_id:o,enable_cloud_proxy:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcReconnect=function(e,t,r,n,i){void 0===i&&(i={});var o=Wf(Wf({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(o)},t.prototype.rtcReconnected=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcGetAccess=function(e,t,r,n,i,o,a){void 0===a&&(a={});var s=Wf(Wf({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},this.modify_ids),{common_extra_info:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcNodeChange=function(e,t,r,n){void 0===n&&(n={});var i=Wf(Wf({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(i)},t.prototype.rtcSignalingMsgError=function(e,t,r,n){void 0===n&&(n={});var i=Wf(Wf({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(i)},t.prototype.rtcSignaling=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Wf(Wf({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},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=Wf(Wf({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,r,n){void 0===n&&(n={});var i=Wf(Wf({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(i)},t.prototype.rtcBeginCreateOffer=function(e,t,r,n){void 0===n&&(n={});var i=Wf(Wf({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(i)},t.prototype.rtcCreateOffer=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Wf(Wf({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},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=Wf(Wf({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},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcRecvAnswer=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=Wf(Wf({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},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.firstRemoteAudioRender=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.firstRemoteVideoRender=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcPublishStat=function(e,t,r,n,i){void 0===i&&(i={});var o=Wf(Wf({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,r,n,i){void 0===i&&(i={});var o=Wf(Wf({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,r,n){void 0===n&&(n={});var i=Wf(Wf({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(i)},t.prototype.rtcMediaStatistics=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf(Wf(Wf({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcMessageStatistics=function(e,t,r,n){void 0===n&&(n={});var i=Wf(Wf(Wf(Wf(Wf({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),{media_server_ip:r}),this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(i)},t.prototype.rtcError=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcInvokeStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Wf(Wf({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},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var r=Wf(Wf(Wf({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});wL.print("rtcFirstFrame",JSON.stringify(e)),this.push(r)},t.prototype.rtcMuteRemote=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf(Wf(Wf({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now()},e),{media_type:t}),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.sdkInitEngine=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.joinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=Wf(Wf({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=Wf(Wf({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},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var r=Wf(Wf({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(r)},t.prototype.rtcDeviceError=function(e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,_,v){void 0===v&&(v={});var m=Wf(Wf({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:_},this.modify_ids),{common_extra_info:JSON.stringify(v)});this.push(m)},t.prototype.rtcVideoDevice=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var r=Wf(Wf(Wf({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(r)},t.prototype.rtcEncodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf(Wf(Wf({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcFirstFrameEncoded=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf(Wf(Wf({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSendFirstPacket=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf(Wf(Wf({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcRecvFirstPacket=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf(Wf(Wf({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcRecvFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf(Wf(Wf({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcDecodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=Wf(Wf(Wf(Wf({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t}(LD),GL=new jL,HL=new jL,zL=new jL,KL=GL.commonStats,YL=HL.commonStats,XL=zL.commonStats,WL={default:GL,rtm:HL,outsideRoom:zL};function JL(e){void 0===e&&(e="default");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={};t.forEach((function(e,t){a[e]=r[t]})),WL[e].rtcSdkApiCall(n,0,JSON.stringify(fD(r)),a);var s=o.apply(this,r);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return WL[e].rtcSdkCallback(n,0,JSON.stringify(fD([t||{}]))),t})).catch((function(t){throw WL[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(WL[e].rtcSdkCallback(n,0,JSON.stringify(fD([s||{}]))),s)}}}}function qL(e,t,r){void 0===r&&(r=0),(e===o_.onUserMessageReceivedOutsideRoom||e===o_.onUserBinaryMessageReceivedOutsideRoom?HL:GL).rtcSdkCallback(e,r,JSON.stringify(t))}function ZL(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=!1),(n?HL:GL).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"}(PL||(PL={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire"}(DL||(DL={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(kL||(kL={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(ML||(ML={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(UL||(UL={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(xL||(xL={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(VL||(VL={})),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"}(FL||(FL={}));var $L,QL,ex=((LL={})[FL.SUCCESS]=[0,"success"],LL[FL.TIMEOUT]=[eP.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],LL[FL.BROKEN]=[eP.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],LL[FL.NO_RECEIVER]=[eP.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],LL[FL.NO_RELAYPATH]=[eP.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],LL[FL.SEND_TO_SERVER_ERROR]=[eP.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],LL[FL.SERVER_RESPONSE_ERROR]=[eP.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],LL[FL.NOT_JOIN]=[eP.USER_MESSAGE_NOT_JOIN,"not join room"],LL[FL.INIT]=[eP.USER_MESSAGE_INIT,"not init."],LL[FL.NO_CONNECTION]=[eP.USER_MESSAGE_NO_CONNECTION,"no connection."],LL[FL.EXCEED_MAX_LENGTH]=[eP.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],LL[FL.EMPTY_USER]=[eP.USER_MESSAGE_EMPTY_USER,"user id is empty."],LL[FL.NOT_LOGIN]=[eP.USER_MESSAGE_NOT_LOGIN,"not login."],LL[FL.SERVER_PARAMS_NOTSET]=[eP.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],LL[FL.UNKNOWN]=[eP.USER_MESSAGE_UNKNOWN,"unknown."],LL),tx=new MD("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}($L||($L={})),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"}(QL||(QL={}));var rx=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 GL.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",ZU.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=lD();var s=a.id.join("-"),c=setTimeout((function(){n._singlingCache.delete(s),o(new oP(eP.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)}}),tx.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),n._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:QL.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 qf(this,void 0,void 0,(function(){var e,i,o,a,s;return Zf(this,(function(c){switch(c.label){case 0:return e=r instanceof ArrayBuffer,i=this._sendP2PMessage,o=[Wf({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:xL.SEND,type:VL.P2P,err:FL.SUCCESS},n)],s={binary:e},e?[4,dD.ab2b64str(r)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=r,c.label=3;case 3:return[2,i.apply(this,[Wf.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var r=this;return void 0===t&&(t={}),pD(e.msg)?this._rttIds[e.id]=e.id:tx.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(n,i){var o=r._genHeader(Wf(Wf({needAck:!0,functionType:QL.C2C},t),{id:lD()}));if(e.dir===xL.SEND){var a=setTimeout((function(){r._p2pCache.delete(e.id),i(new oP(eP.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=Qf(ex[e.err]||[eP.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 oP(eP.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=dD.str2ab(JSON.stringify([e,r])),a=cD(Uint8Array,e_([n,i],Qf(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===$L.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:$L.ACK,id:e.split("-").map((function(e){return+e}))});tx.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")},t.prototype._handleMessage=function(e){var t,r;return qf(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,A,R,C,O,N,w;return Zf(this,(function(P){switch(P.label){case 0:n=this._dispartData(e),i=n.header,o=n.data,i.zip&&((a=new NL.Inflate).push(o,!0),o=a.result),s=dD.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&GL.rtcSignalingMsgError(-1,e.message,JU.MESSAGE_PARSE_FAILED),[2]}switch(i.functionType){case QL.C2S:return[3,1];case QL.C2C:return[3,6];case QL.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=i.id)||void 0===t?void 0:t.join("-"))||"",i.direction!==$L.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],tx.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,dD.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=P.sent(),P.label=4;case 4:this.emit(d,Wf({},c)),GL.rtcSignaling(0,s,"on-".concat(d),"Recv",ZU.DOWN),P.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)===xL.FEEDBACK||pD(null==c?void 0:c.msg)?delete this._rttIds[h]:tx.print("Signal","<<<<<< p2p response",c),c.dir){case xL.SEND:return[3,7];case xL.FEEDBACK:return[3,16]}return[3,17];case 7:return pD(null==c?void 0:c.msg)?[3,15]:(f=(p=c).binary,_=p.msg,v=p.room,m=p.to,S=p.from,E=""===v?f?DL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:DL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:f?DL.USER_BINARY_MESSAGE_RECEIVED:DL.USER_MESSAGE_RECEIVED,m?[3,11]:(y=this.emit,g=[DL.ON_CUSTOM_MESSAGE],N={clientId:S,binary:f},f?[4,dD.b64str2ab(_)]:[3,9]));case 8:return b=P.sent(),[3,10];case 9:b=_,P.label=10;case 10:return y.apply(this,g.concat([(N.message=b,N)])),[3,17];case 11:return T=this.emit,I=[E],A=[Wf({},c)],w={},f?[4,dD.b64str2ab(_)]:[3,13];case 12:return R=P.sent(),[3,14];case 13:R=_,P.label=14;case 14:T.apply(this,I.concat([Wf.apply(void 0,A.concat([(w.msg=R,w)]))])),P.label=15;case 15:return this._sendP2PMessage(Wf(Wf({},c),{dir:xL.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===FL.SUCCESS?C.success(c.id):C.error(c)),[3,17];case 17:return[3,19];case 18:i.direction===$L.ACK&&(O=(null===(r=i.id)||void 0===r?void 0:r.join("-"))||"",this._handleAckMessage(O,c[0]||{},s)),P.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){tx.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){tx.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={}),Wf({version:2,zip:!1,encrypt:!1,needAck:!0,direction:$L.SEND,functionType:QL.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),tx.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),GL.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",ZU.DOWN)},t}(wD.exports.EventEmitter),nx=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=$f(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=Qf(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){t.isSending=!1,i({code:-1,message:d.responseText||"unknown"})},u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,r,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}(),ix="RTC_DEVICE_ID",ox="RTC_ACCESS_NODE",ax="RTC_ACCESS_URLS",sx="RTC_H264_BLACK_LIST",cx=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}(),ux=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Cf(t,e),t.prototype.getDeviceId=function(){if(uD())return"";var e=this.get(ix);return e||(e=nD()),this.set(ix,e),e},t.prototype.getAccessNode=function(e){return this.get("".concat(ox,"_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,r){return this.set("".concat(ox,"_").concat(e,"-BytePlus"),t,1e3*r)},t.prototype.clearAccessNode=function(e){this.delete("".concat(ox,"_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat(ax,"-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(ax,"-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat(ax,"-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get(sx)},t.prototype.setH264BlackList=function(e){return this.set(sx,e)},t}(cx),dx=new ux,lx=new MD("ICE Request",3),hx=function(){function e(){this._request=new nx}return e.prototype.getAccessNode=function(e,t,r,n,i,o,a){return qf(this,void 0,void 0,(function(){var s;return Zf(this,(function(c){return(s=dx.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,r,n,i,o,a),ZL("es.R.node.cache",s),[2,Promise.resolve(s)]):[2,this.getAccessNodeFromServer(e,t,r,n,i,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,r,n,i,o,a){return qf(this,void 0,void 0,(function(){var s,c,u=this;return Zf(this,(function(d){return s=dx.getAccessUrls(),c=!0,ZL("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=ok.ICE_CONFIG_REQUEST_URLS,c=!1,ZL("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=ok.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,ZL("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,r,n,i,o,a).then((function(t){var r=t.nodes[0];return dx.setAccessNode(e,r,t.ttl||11200),t.dispatchDomains&&dx.setAccessUrls(t.dispatchDomains),r})).catch((function(s){if(c)return ZL("es.R.req.fallback",""),dx.clearAccessUrls(),u.getAccessNodeFromServer(e,t,r,n,i,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,r,n,i,o,a,s){var c;return qf(this,void 0,void 0,(function(){var r,u,d,l=this;return Zf(this,(function(h){return r={appID:t,userID:n,deviceID:i,connectSessionID:aD(),os:"web",sdkVersion:ok.VERSION,expectedAddr:sk("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s},o&&a&&(r.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NodeChanged",reason:o}}],delete r.expectedAddr),u=Date.now(),GL.rtcGetAccess(0,JSON.stringify(r),0,XU.REQUEST,e.join(","),r.connectSessionID),d=e.map((function(e,t){return qf(l,void 0,void 0,(function(){var n,i,o;return Zf(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 oP(eP.ICE_SERVER_WRONG,"get ICE config failed",i);case 3:if(200!==n.code)throw new oP(eP.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:JSON.stringify(n)});if(!(o=n.nodes[0]))throw new oP(eP.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,vD(d).then((function(t){var n=t.result;t.firstNode;var i=t.index;return GL.rtcGetAccess(200,JSON.stringify(n),Date.now()-u,XU.RESPONSE,e[i],r.connectSessionID),n})).catch((function(t){var n,i,o=null===(n=t[0])||void 0===n?void 0:n.error;throw GL.rtcGetAccess(+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),null===(i=t[0])||void 0===i?void 0:i.message,Date.now()-u,XU.RESPONSE,e.join(","),r.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(lx.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),px=function(){function e(){this._request=new nx}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.41.2",deviceType:"web"},r=ok.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));GL.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),GU.REQUEST,"",!1);var n=r.map((function(r,n){return qf(e,void 0,void 0,(function(){var e;return Zf(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._request.post(r,t)];case 1:return e=i.sent(),[3,3];case 2:throw i.sent(),new oP(eP.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new oP(eP.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:n}]}}))}))}));return new Promise((function(e){vD(n).then((function(t){var n=t.result,i=t.index;dx.setH264BlackList(n.web_h264_black_list),GL.rtcGetConfig(200,JSON.stringify(n),0,r[i],GU.RESPONSE,"",!1),e(n.web_h264_black_list)})).catch((function(t){GL.rtcGetConfig(500,t.message,0,"",GU.RESPONSE,"",!1),e(dx.getH264BlackList()||[])}))}))},e}(),fx={},_x={},vx={exports:{}},mx=vx.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(mx).forEach((function(e){mx[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=vx.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}}))}))}}(_x);var Sx=vx.exports,Ex=/%[sdv%]/g,yx=function(e){var t=1,r=arguments,n=r.length;return e.replace(Ex,(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""}}))},gx=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 yx.apply(null,n)},bx=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Tx=["i","c","b","a"],Ix=_x,Ax=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||bx,n=t.innerOrder||Tx,i=[];return r.forEach((function(t){Sx[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(gx(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(gx(t,r,e))}))}))})),e.media.forEach((function(e){i.push(gx("m",Sx.m[0],e)),n.forEach((function(t){Sx[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(gx(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(gx(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};fx.write=Ax,fx.parse=Ix.parse,fx.parseParams=Ix.parseParams,fx.parseFmtpConfig=Ix.parseFmtpConfig,fx.parsePayloads=Ix.parsePayloads,fx.parseRemoteCandidates=Ix.parseRemoteCandidates,fx.parseImageAttributes=Ix.parseImageAttributes,fx.parseSimulcastStreamList=Ix.parseSimulcastStreamList;var Rx=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this._iceConfigNode.iceParams,n=fx.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"})),fx.write(n)},e}(),Cx=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this,n=this._iceConfigNode.certFingerprint,i=fx.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)})),fx.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=xx(i.serverIceUfrag),KL.setStats({connection_id:this._iceUfrag})),e.iceUfrag=this._iceUfrag,e.setup="active",this._candidates||(this._candidates=Lx(r)),e.candidates=this._candidates,e.iceOptions="renomination","application"===e.type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144})},e}();function Ox(e,t){var r,n=fx.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 Nx,wx,Px,Dx,kx,Mx=function(e,t){var r,n;try{var i=fx.parse(e),o=fx.parse(t),a="".concat(null===(r=o.groups)||void 0===r?void 0:r[0].mids).split(" "),s="".concat(null===(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:fx.write(i),audioMid:d,videoMid:l}}catch(e){return null}},Ux=function(e,t){var r;try{var n=fx.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,fx.write(n)}catch(e){return""}},Lx=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(Wf(Wf({},i),{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(Wf(Wf({},i),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n},xx=function(e){var t=new TextEncoder,r=t.encode("PREC"),n=new Uint8Array(dD.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=cD(Uint8Array,r,n,i,o),s=dD.ab2str(a.buffer);return window.btoa(s)},Vx="safari"===(Nx="none",uD()||(null!==window.navigator.userAgent.match("Firefox")?Nx="mozilla":null!==window.navigator.userAgent.match("Chrome")?(Nx="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(Nx="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(Nx="safari")),Nx);!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"}(wx||(wx={})),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"}(Dx||(Dx={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(kx||(kx={}));var Fx,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 wx.candidatePair:r=t.handleCandidatePair;break;case wx.certificate:r=t.handleCertificate;break;case wx.remoteCandidate:r=t.handleRemoteCandidate;break;case wx.remoteInboundRtp:r=t.handleInboundRtp;break;case wx.remoteOutboundRtp:r=t.handleOutboundRtp;break;case wx.sctpTransport:r=t.handleSctpTransport;break;case wx.sender:r=t.handleSender;break;case wx.stream:r=t.handleStream;break;case wx.track:r=t.handleTrack;break;case wx.transceiver:r=t.handleTransceiver;break;case wx.transport:r=t.handleTransport;break;case wx.codec:r=t.handleCodec;break;case wx.csrc:r=t.handleCsrc;break;case wx.dataChannel:r=t.handleDataChannel;break;case wx.iceServer:r=t.handleIceServer;break;case wx.mediaSource:r=t.handleMediaSource;break;case wx.outboundRtp:r=t.handleOutboundRtp;break;case wx.inboundRtp:r=t.handleInboundRtp;break;case wx.peerConnection:r=t.handlePeerConnection;break;case wx.receiver:r=t.handleReceiver;break;case wx.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 qf(this,void 0,void 0,(function(){var e=this;return Zf(this,(function(t){return[2,new Promise((function(t,r){if(Vx||void 0!==window.InstallTrigger)return t(e.stats);try{e.peer.getStats((function(r){r.result().forEach((function(t){if(!jx.includes(t.type)){var r={};t.names().forEach((function(e){r[e]=t.stat(e)})),r.id=t.id,r.type=t.type,r.timestamp=t.timestamp,e.stats.push(r)}})),t(e.stats)}))}catch(e){r(e)}}))]}))}))},e.prototype.getStats=function(e,t){return qf(this,void 0,void 0,(function(){var r;return Zf(this,(function(n){switch(n.label){case 0:return n.trys.push([0,7,,8]),[4,this.peer.getStats(e)];case 1:r=n.sent(),this.processStats(r),n.label=2;case 2:return n.trys.push([2,5,,6]),t?[3,4]:[4,this.getExtraStats()];case 3:n.sent(),n.label=4;case 4:return[3,6];case 5:return n.sent(),[3,6];case 6:return[3,8];case 7:return n.sent(),[3,8];case 8:return[2,this.stats]}}))}))},e}(),jx=["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"],Gx=function(e,t,r){return qf(void 0,void 0,void 0,(function(){var n;return Zf(this,(function(i){switch(i.label){case 0:return n=[],e instanceof RTCPeerConnection?[4,new Bx(e).getStats(t,r)]:[2,n];case 1:return[2,n=i.sent()]}}))}))},Hx=function(){return qf(void 0,void 0,void 0,(function(){var e,t,r,n,i,o,a;return Zf(this,(function(s){switch(s.label){case 0:if(Fx)return[2,Fx];e=[],s.label=1;case 1:return s.trys.push([1,5,,6]),[4,_D()];case 2:return(t=s.sent())?(null==t?void 0:t.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))?(r=navigator.userAgent.toLowerCase(),n=!1,i=["heytapbrowser","mqqbrowser","miuibrowser"],[4,(new px).getH264BlackList()]):[3,4]:[2,e];case 3:for(o=s.sent(),i.push.apply(i,e_([],Qf(o),!1)),a=0;a<i.length;a++)r.includes(i[a])&&(n=!0);!n&&e.push("H264"),s.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),Fx=e,[2,e];case 5:return s.sent(),[2,e];case 6:return[2]}}))}))},zx=function(){return"undefined"!=typeof TransformStream&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Kx=new MD("BasicHandler",3),Yx=zx(),Xx={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!Yx||void 0},Wx=function(e){function t(t){var r=e.call(this)||this;return r.monitor=t,r._peerConnection=new RTCPeerConnection(Xx),r._dataChannel=r._peerConnection.createDataChannel("signaling"),r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,n;Kx.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(n=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===n?void 0:n.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){Kx.print("constructor","onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ").concat(r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var e=r._peerConnection.iceConnectionState;t.rtcPreIceState(e,WU["".concat(e.toUpperCase())])},r}return Cf(t,e),t.prototype.connect=function(e){return qf(this,void 0,void 0,(function(){var t,r,n=this;return Zf(this,(function(i){switch(i.label){case 0:return Kx.print("connect","invoke connect"),[4,this._peerConnection.createOffer()];case 1:return t=i.sent(),this._localSdp=new Rx(e),[4,this.setLocalDescription(t.sdp)];case 2:return i.sent(),this._remoteSdp=new Cx(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(){Kx.print("connect","dataChannel open"),ZL("es.dc.open",""),e("")},n._dataChannel.onerror=function(e){GL.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,JU.INVALID_DATA),ZL("es.dc.error",""),t(e)},n._dataChannel.onclose=function(e){ZL("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(),Kx.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){this.disconnect(),this._localSdp=void 0,this._remoteSdp=void 0},t.prototype.publish=function(e,t){var r;return qf(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I;return Zf(this,(function(A){switch(A.label){case 0:if(n=e.stream,i=null==e?void 0:e.videoTrack,o=null==e?void 0:e.audioTrack,a={},s=[],Array.isArray(null==e?void 0:e.videoEncodeConfig))for(c=null==e?void 0:e.videoEncodeConfig.length,u=null==i?void 0:i.getTrack(),d={width:640,height:480,framerate:30},u&&(l=null==u?void 0:u.getSettings(),d={width:Math.floor(l.width),height:Math.floor(l.height),framerate:Math.floor(l.frameRate)}),a.sendEncodings=[],h=0;h<c;h++)p=null==e?void 0:e.videoEncodeConfig[h],f={maxBitrate:1e3*p.maxKbps},_=Math.pow(2,h),c>1&&(f.rid="".concat(h),f.scaleResolutionDownBy=_),null===(r=a.sendEncodings)||void 0===r||r.unshift(f),s.push({width:Math.floor(d.width/_),height:Math.floor(d.height/_),framerate:d.framerate,maxkbps:p.maxKbps,rid:"".concat(h)});return Kx.print("publish videoTransceiverInit videoDescriptions","",a,s),v=null==o?void 0:o.getTrack(),(null==o?void 0:o.mixType)!==r_.PLAYOUT&&(null==o?void 0:o.mixedAudioTrack)&&(v=null==o?void 0:o.mixedAudioTrack),e.audioTransceiver=this._peerConnection.addTransceiver(v||"audio",{direction:"sendonly",streams:[n]}),m=e.audioTransceiver,(null==t?void 0:t.audioRed)&&RTCRtpSender.getCapabilities&&m.setCodecPreferences&&(Kx.print("publish","publish audio red is true"),(S=(RTCRtpSender.getCapabilities("audio")||{}).codecs)&&(E=S.findIndex((function(e){return"audio/red"===e.mimeType})),y=Qf(S.splice(E,1),1),g=y[0],S.unshift(g),m.setCodecPreferences(S),Kx.print("publish","audio preferences codecs",S))),Yx&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver((null==i?void 0:i.getTrack())||"video",Wf({direction:"sendonly",streams:[n]},a)),Yx&&e.initVideoEncodedTransform(),Kx.print("sender.getParameters()",e.videoTransceiver.sender.getParameters()),b=sD(),GL.rtcBeginCreateOffer($U.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:if(T=A.sent(),GL.rtcCreateOffer(0,QU.UP,e.streamId,e.userId,sD()-b),I=Mx(T.sdp,this.getLocalDescriptionSdp()),!T.sdp||!I)throw new oP(eP.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Wf(Wf({sdp:T.sdp},I),{type:"incroffer",semantics:"unified-plan",videoDescriptions:s})]}}))}))},t.prototype.subscribe=function(e,t){return qf(this,void 0,void 0,(function(){var r,n,i,o,a;return Zf(this,(function(s){switch(s.label){case 0:return r="incroffer",n="unified-plan",t?[2,{sdp:this.getLocalDescriptionSdp(),partialSdp:Ux(this.getLocalDescriptionSdp(),[t.audioMid,t.videoMid]),audioMid:t.audioMid,videoMid:t.videoMid,type:r,semantics:n}]:(e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),Yx&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),Yx&&e.initVideoEncodedTransform(),i=sD(),GL.rtcBeginCreateOffer($U.DOWN,e.streamId,e.userId),[4,this._peerConnection.createOffer()]);case 1:if(o=s.sent(),GL.rtcCreateOffer(0,QU.DOWN,e.streamId,e.userId,sD()-i),a=Mx(o.sdp,this.getLocalDescriptionSdp()),!o.sdp||!a)throw new oP(eP.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,Wf(Wf({sdp:o.sdp},a),{type:r,semantics:n})]}}))}))},t.prototype.setAnswerSdp=function(e,t,r,n,i){var o;return qf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return Zf(this,(function(p){switch(p.label){case 0:return GL.rtcRecvAnswer(0,rL.INCRANSWER,0,t,i,n.streamId,n.userId),a=this._peerConnection.remoteDescription,s=fx.parse(null==a?void 0:a.sdp),c=null===(o=s.media)||void 0===o?void 0:o.reduce((function(e,t){return e[t.mid]=t,e}),{}),fx.parse(t).media.forEach((function(e){return c[e.mid]=e})),u=[],d=fx.parse(e),l=d.media.map((function(e){var t;r&&r[e.mid]&&(e.mid=r[e.mid]),"inactive"!==e.direction&&u.push(e.mid);var 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(fx.write(d),n,i)];case 1:return p.sent(),[4,this.setRemoteDescription(fx.write(s),n,i)];case 2:return p.sent(),[2]}}))}))},t.prototype.setLocalDescription=function(e,t,r){var n,i;return qf(this,void 0,void 0,(function(){var o,a,s,c,u,d,l;return Zf(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=sD(),c=r||tL.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]),Kx.print("setOffer","set offer: ",a),[4,this._peerConnection.setLocalDescription(a)];case 2:return h.sent(),GL.rtcSetDescription(0,a.sdp,eL.W_1,c,u,d,sD()-s,{type:"offer"}),[3,4];case 3:throw(l=h.sent())instanceof Error&&GL.rtcSetDescription(-1,l.message,eL.W_1,c,u,d,sD()-s,{type:"offer"}),l;case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t,r){var n;return qf(this,void 0,void 0,(function(){var i,o,a,s,c,u;return Zf(this,(function(d){switch(d.label){case 0:i=new RTCSessionDescription({type:"answer",sdp:e}),o=sD(),a=r||tL.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]),Kx.print("setAnswer","set answer: ",i),[4,this._peerConnection.setRemoteDescription(i)];case 2:return d.sent(),GL.rtcSetDescription(0,i.sdp,eL.W_0,a,s,c,sD()-o,{type:"answer"}),[3,4];case 3:throw(u=d.sent())instanceof Error&&GL.rtcSetDescription(-1,u.message,eL.W_0,a,s,c,sD()-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 qf(this,void 0,void 0,(function(){var n,i,o,a,s=this;return Zf(this,(function(c){switch(c.label){case 0:return Kx.print("closeMids","closeMids: ",e),n=this.getLocalDescriptionSdp(),i=Ox(n,e),o=this.getRemoteDescriptionSdp(),a=Ox(o,e),[4,this._peerConnection.createOffer()];case 1:return c.sent(),[4,this.setLocalDescription(fx.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(fx.write(a))];case 3:return c.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return qf(this,void 0,void 0,(function(){var e;return Zf(this,(function(t){switch(t.label){case 0:return[4,_D()];case 1:if(!(e=t.sent()))throw new oP(eP.NOT_SUPPORTED,"Get offer Error");return[2,{sdp:e,semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.getStats=function(e,t){return Gx(this._peerConnection,e,t)},t.prototype.rollback=function(e,t){var r;return qf(this,void 0,void 0,(function(){return Zf(this,(function(n){switch(n.label){case 0:return Kx.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}(wD.exports.EventEmitter),Jx=new MD("Locker",2),qx=1,Zx=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=qx++,e&&(this.name=e),Jx.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,Jx.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,Jx.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}(),$x=I,Qx=nc,eV=Rm.exports.getWeakData,tV=kt,rV=G,nV=lc,iV=Yc,oV=xe,aV=Or.set,sV=Or.getterFor,cV=ba.find,uV=ba.findIndex,dV=$x([].splice),lV=0,hV=function(e){return e.frozen||(e.frozen=new pV)},pV=function(){this.entries=[]},fV=function(e,t){return cV(e.entries,(function(e){return e[0]===t}))};pV.prototype={get:function(e){var t=fV(this,e);if(t)return t[1]},has:function(e){return!!fV(this,e)},set:function(e,t){var r=fV(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=uV(this.entries,(function(t){return t[0]===e}));return~t&&dV(this.entries,t,1),!!~t}};var _V,vV={getConstructor:function(e,t,r,n){var i=e((function(e,i){nV(e,o),aV(e,{type:t,id:lV++,frozen:void 0}),null!=i&&iV(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=sV(t),s=function(e,t,r){var n=a(e),i=eV(tV(t),!0);return!0===i?hV(n).set(t,r):i[n.id]=r,e};return Qx(o,{delete:function(e){var t=a(this);if(!rV(e))return!1;var r=eV(e);return!0===r?hV(t).delete(e):r&&oV(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!rV(e))return!1;var r=eV(e);return!0===r?hV(t).has(e):r&&oV(r,t.id)}}),Qx(o,r?{get:function(e){var t=a(this);if(rV(e)){var r=eV(e);return!0===r?hV(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}},mV=i,SV=I,EV=nc,yV=Rm.exports,gV=fS,bV=vV,TV=G,IV=km,AV=Or.enforce,RV=or,CV=!mV.ActiveXObject&&"ActiveXObject"in mV,OV=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},NV=gV("WeakMap",OV,bV);if(RV&&CV){_V=bV.getConstructor(OV,"WeakMap",!0),yV.enable();var wV=NV.prototype,PV=SV(wV.delete),DV=SV(wV.has),kV=SV(wV.get),MV=SV(wV.set);EV(wV,{delete:function(e){if(TV(e)&&!IV(e)){var t=AV(this);return t.frozen||(t.frozen=new _V),PV(this,e)||t.frozen.delete(e)}return PV(this,e)},has:function(e){if(TV(e)&&!IV(e)){var t=AV(this);return t.frozen||(t.frozen=new _V),DV(this,e)||t.frozen.has(e)}return DV(this,e)},get:function(e){if(TV(e)&&!IV(e)){var t=AV(this);return t.frozen||(t.frozen=new _V),DV(this,e)?kV(this,e):t.frozen.get(e)}return kV(this,e)},set:function(e,t){if(TV(e)&&!IV(e)){var r=AV(this);r.frozen||(r.frozen=new _V),DV(this,e)?MV(this,e,t):r.frozen.set(e,t)}else MV(this,e,t);return this}})}var UV=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),!uD()&&t.refreshDevices(),t}return Cf(t,e),t.prototype.refreshDevices=function(){return qf(this,void 0,void 0,(function(){var e,t=this;return Zf(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||LV(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 qf(this,void 0,void 0,(function(){return Zf(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 qf(this,void 0,void 0,(function(){var e,t,r=this;return Zf(this,(function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=n.sent(),t=Array.from(e_(e_(e_([],Qf(this.deviceMap.audioinput.values()),!1),Qf(this.deviceMap.videoinput.values()),!1),Qf(this.deviceMap.audiooutput.values()),!1)),e.forEach((function(t){var n=r.deviceMap[t.kind].get(t.deviceId),i={deviceName:t.label||LV(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",Wf({},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(o_.onMediaDeviceStateChanged,t))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return qf(this,void 0,void 0,(function(){var e=this;return Zf(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new oP(eP.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 qf(this,void 0,void 0,(function(){var e=this;return Zf(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new oP(eP.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 qf(this,void 0,void 0,(function(){return Zf(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(e_(e_(e_([],Qf(this.deviceMap.audioinput.values()),!1),Qf(this.deviceMap.videoinput.values()),!1),Qf(this.deviceMap.audiooutput.values()),!1)).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getMicrophones=function(){return qf(this,void 0,void 0,(function(){return Zf(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 qf(this,void 0,void 0,(function(){return Zf(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 qf(this,void 0,void 0,(function(){return Zf(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 qf(this,void 0,void 0,(function(){return Zf(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 oP(eP.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 oP(eP.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(LD),LV=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},xV=new UV,VV=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}(),FV=function(){function e(e){var t=BV.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}(),BV=new VV,jV=new MD("VERTC",0),GV=new WeakMap,HV=function(e){return GV.get(e)},zV=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}(LD),KV=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(){GL.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(zV),YV=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}(zV),XV=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 qf(this,void 0,void 0,(function(){return Zf(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig?(jV.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}(KV),WV=function(e){function t(t,r){var n=e.call(this,t,r,"audio")||this;return n.mixType=r_.PLAYOUT_AND_PUBLISH,n}return Cf(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new FV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(jV.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}(KV),JV=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Cf(t,e),t}(YV),qV=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 FV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(YV),ZV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(WV),$V=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(XV),QV=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(XV),eF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(WV),tF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(XV),rF=function(e){function t(t,r){return e.call(this,t,r)||this}return Cf(t,e),t}(WV);function nF(e){var t;return qf(this,void 0,void 0,(function(){var r,n,i,o,a,s;return Zf(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]),jV.print("createCameraVideoTrack","constraints:",e),GL.rtcVideoCaptureEvent({event_type:bL.START,media_device_id:n}),i=sD(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return r=c.sent(),GL.rtcVideoCaptureEvent({event_type:bL.START_CAPTURE_RESULT,media_device_id:n,reason:IL.SUCCESS,elapse:sD()-i}),xV.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),GL.rtcVideoCaptureEvent({event_type:bL.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new oP(eP.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getVideoTracks()[0],GV.set(a,r),(s=new $V(a,aD())).videoCaptureConfig=e,[2,s]}}))}))}function iF(e){var t;return qf(this,void 0,void 0,(function(){var r,n,i,o,a;return Zf(this,(function(s){switch(s.label){case 0:jV.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]),GL.rtcVideoCaptureEvent({event_type:bL.START,media_device_id:n}),i=sD(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=s.sent(),GL.rtcVideoCaptureEvent({event_type:bL.START_CAPTURE_RESULT,media_device_id:n,reason:IL.SUCCESS,elapse:sD()-i}),xV.hasAudioPermission=!0,[3,4];case 3:throw o=s.sent(),GL.rtcVideoCaptureEvent({event_type:bL.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new oP(eP.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getAudioTracks()[0],GV.set(a,r),[2,new ZV(a,aD())]}}))}))}function oF(e){return void 0===e&&(e=!1),qf(this,void 0,void 0,(function(){var t,r,n;return Zf(this,(function(i){switch(i.label){case 0:jV.print("createScreenStream","withAudio:",e),i.label=1;case 1:return i.trys.push([1,3,,4]),GL.rtcVideoCaptureEvent({event_type:bL.START,media_device_id:"screen"}),r=sD(),[4,navigator.mediaDevices.getDisplayMedia({video:!0,audio:e})];case 2:return t=i.sent(),GL.rtcVideoCaptureEvent({event_type:bL.START_CAPTURE_RESULT,media_device_id:"screen",reason:IL.SUCCESS,elapse:sD()-r}),[3,4];case 3:throw n=i.sent(),GL.rtcVideoCaptureEvent({event_type:bL.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.message}),new oP(eP.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,t]}}))}))}var aF=Math.log,sF=Math.LOG10E;Xn({target:"Math",stat:!0},{log10:Math.log10||function(e){return aF(e)*sF}}),Xn({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new MD("Stats",2);var cF,uF=function(){function e(e,t,r,n){this._client=e,this._handler=t,this.dataChannelRTT={},this._rttTimer={},this._remoteStreamStasEvtIntervals={},this._remoteStreamAudioStallInterval={},this._localStreamStasEvtIntervals={},this._videoInWaiting={},this.monitor=r,this._audioStallInterval=((null==n?void 0:n.audio_stall_interval)||200)/2,this._audioStallRatio=(null==n?void 0:n.audio_stall_ratio)||.6}return e.prototype.setRemoteStreamStatsEvtInterval=function(e,t){var r,n;return void 0===t&&(t={rtt:!0}),qf(this,void 0,void 0,(function(){var i,o,a,s,c,u,d,l,h,p,f,_=this;return Zf(this,(function(v){switch(v.label){case 0:return t.rtt&&this.getDataChannelRTT(e.userId),i={audio:{},video:{},remoteStream:e},o=null===(r=e.audioTrack)||void 0===r?void 0:r.getTrack(),a=null===(n=e.videoTrack)||void 0===n?void 0:n.getTrack(),this.getRemoteVideoStats(a,i),[4,this.getRemoteAudioStats(o,i)];case 1:return v.sent(),this.delRemoteStreamStatsEvtInterval(e),s=0,c=0,this._audioStallInterval>0&&void 0!==i.audio.concealedSamples&&(u=i.audio.concealedSamples,d=i.audio.totalSamplesReceived,i.audio.silentConcealedSamples,l=sD(),h={isStall:!1,counted:!1,diff:0},p=.5*this._audioStallInterval,this._remoteStreamAudioStallInterval[e.streamId]=setInterval((function(){return qf(_,void 0,void 0,(function(){var t,r,n,i,a,f,_,v,m,S,E;return Zf(this,(function(y){switch(y.label){case 0:return t=sD(),(r=t-l)<p?[2]:(n=e.hasAudio,i=e.subAudio,n&&i?[4,this._handler.getStats(o,!0)]:(h.isStall=!1,h.counted=!1,[2]));case 1:for(a=y.sent(),f=a.length,_=0;_<f;_++)if(v=a[_],m=v.concealedSamples,S=v.totalSamplesReceived,"inbound-rtp"===v.type){E=S-d,m-u>=this._audioStallRatio*E?(h.isStall?(h.counted?c+=r:(c=c+h.diff+r,s++),h.counted=!0):(h.counted=!1,h.diff=r),h.isStall=!0):(h.isStall=!1,h.counted=!1),u=m,d=S,l=t;break}return[2]}}))}))}),this._audioStallInterval)),f=function(){return qf(_,void 0,void 0,(function(){var t,r,n,o,a,u;return Zf(this,(function(d){switch(d.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(u=e.videoTrack)||void 0===u?void 0:u.getTrack(),[4,this.getRemoteAudioStats(t,i,s,c)];case 1:return n=d.sent(),s=0,c=0,[4,this.getRemoteVideoStats(r,i)];case 2:return o=d.sent(),[2,{audioStats:n,videoStats:o,isScreen:e.isScreen,userId:e.userId}]}}))}))},this._remoteStreamStasEvtIntervals[e.streamId]=setInterval((function(){return qf(_,void 0,void 0,(function(){var e;return Zf(this,(function(t){switch(t.label){case 0:return[4,f()];case 1:return e=t.sent(),this._client.emit("onRemoteStreamStats",e),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.delRemoteStreamStatsEvtInterval=function(e){clearInterval(this._remoteStreamStasEvtIntervals[e.streamId]),clearInterval(this._remoteStreamAudioStallInterval[e.streamId]),delete this._remoteStreamAudioStallInterval[e.streamId]},e.prototype.unsubscribe=function(e){this.delRemoteStreamStatsEvtInterval(e),clearTimeout(this._rttTimer[e.userId]),this._videoInWaiting[e.streamId]=!1},e.prototype.getRemoteAudioStats=function(e,t,r,n){return qf(this,void 0,void 0,(function(){var i,o,a,s,c,u,d,l,h,p,f,_,v;return Zf(this,(function(m){switch(m.label){case 0:return i={},o={timestamp:Date.now()},a=t.remoteStream,s=a.streamId,c=a.userId,u=a.isScreen,d=a.audioMid,l=a.subMediaType,h=a._attributes,p={media_type:"audio",is_screen:+u,direction:"down",stream_id:s,stream_user_id:c,vid:d,connection_status:navigator.onLine,mute_state:l===Bf.AUDIO_AND_VIDEO||l===Bf.AUDIO_ONLY?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localaudio&&h.audiostream?"mute_state_off":"mute_state_on"},e&&this._handler?[4,this._handler.getStats(e)]:[2,i];case 1:return(f=m.sent()).length?(f.forEach((function(e){var t=e.type,r=e.packetsLost,n=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,l=e.totalSamplesReceived,h=e.concealedSamples,f=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,S=e.currentRoundTripTime,E=e.audioLevel,y=e.totalAudioEnergy,g=e.totalSamplesDuration,b=e.mimeType,T=e.googDecodingNormal,I=e.fecPacketsReceived,A=e.availableIncomingBitrate,R=e.availableOutgoingBitrate,C=e.bytesSent,O=e.nominated,N=e.id,w=e.writable,P=e.jitter,D=e.candidateType,k=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc,K=e.kind;"inbound-rtp"===t?(o.packetsLost=r,o.packetsReceived=n,p.packets=n,o.bytesReceived=a,p.bytes=a,void 0!==s&&(i.jitterBufferDelay=s/c*1e3,p.jitter_buffer_delay=i.jitterBufferDelay),void 0!==l&&(o.totalSamplesReceived=l,i.concealedSamples=h,o.concealedSamples=h,o.silentConcealedSamples=f,p.concealed_samples=h,i.concealmentEvents=_,p.total_samples_received=l),void 0!==I&&(p.fec_packets_received=I),p.jitter=1e3*P,p.ssrc=z):"codec"===t?(i.recordSampleRate=u,d&&(i.numChannels=d),p.codec=b):"candidate-pair"===t?(p.ice_available_incoming_bitrate=A,p.ice_available_outgoing_bitrate=R,p.ice_bytes_received=a,p.ice_bytes_sent=C,p.ice_nominated=+O,p.ice_pair_id=N,p.ice_pair_rtt=S,p.rtt=1e3*S,p.ice_pair_state=m,p.ice_pair_writable=w,p.recv_ping_requests=F,p.recv_ping_responses=B,p.sent_ping_requests_before_first_response=j,p.sent_ping_requests_total=j+(G||0),p.sent_ping_responses=H,"succeeded"===m&&(i.rtt=1e3*S,i.total_rtt=1e3*v)):"track"===t&&"audio"===K?(p.audio_level=-10*Math.log10(Math.pow(E,2)),p.volume=255*E,p.total_audio_energy=y,p.total_samples_duration=g):"ssrc"===t?(p.decoding_normal=T,p.recv_level=V):"local-candidate"===t?(p.local_candidate_type=D,p.local_ip=k||M,p.local_network_type=U,p.local_port=L,p.protocol=x):"remote-candidate"===t&&(p.remote_candidate_type=D,p.remote_ip=k||M,p.remote_port=L)})),(_=t.audio).timestamp?(i.audioLossRate=(o.packetsLost-_.packetsLost)/(o.packetsReceived-_.packetsReceived+(o.packetsLost-_.packetsLost)),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,p.packets_lost=Math.round(o.packetsLost-_.packetsLost),p.fraction_lost=i.audioLossRate,p.packets_lost_rate=i.audioLossRate,i.statsInterval=o.timestamp-_.timestamp,p.stats_interval=i.statsInterval,i.receivedKBitrate=(o.bytesReceived-_.bytesReceived||0)/i.statsInterval,p.bitrate=Math.round(8e3*i.receivedKBitrate),p.bandwidth=Math.round(p.bitrate/1024),void 0!==o.concealedSamples&&(p.interval_concealed_samples=o.concealedSamples-_.concealedSamples,p.interval_samples_received=o.totalSamplesReceived-_.totalSamplesReceived,p.interval_silent_concealed_samples=o.silentConcealedSamples-_.silentConcealedSamples,i.receivedSampleRate=1e3*p.interval_samples_received/i.statsInterval),t.audio=o,this.dataChannelRTT[t.remoteStream.userId]&&(v=this.dataChannelRTT[t.remoteStream.userId]/2,i.e2eDelay=v+(i.jitterBufferDelay||0),p.web_e2e_delay=i.e2eDelay,p.total_rtt_ms=v),this._audioStallInterval>0&&void 0!==o.concealedSamples&&(p.concealed_samples===p.interval_concealed_samples&&p.total_samples_received===p.interval_samples_received?(p.stall_count=0,p.stall_duration=0):(p.stall_count=r,p.stall_duration=n)),this.monitor.rtcMediaStatistics(p,{}),[2,i]):(t.audio=o,[2,i])):[2,i]}}))}))},e.prototype.getRemoteVideoStats=function(e,t){return qf(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,p,f;return Zf(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.subMediaType,u=i._attributes,d={media_type:"video",is_screen:+s,direction:"down",stream_id:o,stream_user_id:a,vid:t.remoteStream.videoMid,connection_status:navigator.onLine,mute_state:c===Bf.AUDIO_AND_VIDEO||c===Bf.VIDEO_ONLY?"mute_state_off":"mute_state_on",remote_user_capture_state:u.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:u.localvideo&&u.videostream?"mute_state_off":"mute_state_on"},e&&this._handler?(r.isScreen=s,[4,this._handler.getStats(e)]):[2,r];case 1:return(l=_.sent()).length?(l.forEach((function(e){var t=e.type,i=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded;e.roundTripTime;var l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,f=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,S=e.nominated,E=e.id,y=e.currentRoundTripTime,g=e.state,b=e.writable,T=e.candidateType,I=e.ip,A=e.address,R=e.networkType,C=e.port,O=e.nackCount,N=e.pliCount,w=e.protocol,P=e.requestsReceived,D=e.responsesReceived,k=e.requestsSent,M=e.consentRequestsSent,U=e.responsesSent,L=e.ssrc;e.totalRoundTripTime;var x=e.kind,V=e.jitter,F=e.framesReceived,B=e.keyFramesDecoded,j=e.totalDecodeTime,G=e.decoderImplementation,H=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(n.packetsLost=a,d.packets_lost=a,n.packetsReceived=s,d.packets=s,n.bytesReceived=c,d.bytes=c,n.framesDecoded=u,void 0!==l&&(n.jitterBufferDelay=l/h*1e3,d.jitter_buffer_delay=n.jitterBufferDelay),d.fir_count=f,d.nack_count=O,d.pli_count=N,d.ssrc=L,d.jitter=V,d.frames_received=F,d.frames_decoded=u,d.key_frames_decoded=B,d.total_decode_time=j,d.decoder_implementation=G,d.last_packet_received_timestamp=H):"track"===t&&"video"===x?(r.width=o,d.frame_size_width=o,r.height=i,d.frame_size_height=i,void 0!==F&&(d.frames_received=F)):"codec"===t?d.codec=p:"candidate-pair"===t?(d.ice_available_incoming_bitrate=_,d.ice_available_outgoing_bitrate=v,d.ice_bytes_received=c,d.ice_bytes_sent=m,d.ice_nominated=+S,d.ice_pair_id=E,d.ice_pair_rtt=y,d.rtt=1e3*y,r.rtt=d.rtt,d.ice_pair_state=g,d.ice_pair_writable=b,d.recv_ping_requests=P,d.recv_ping_responses=D,d.sent_ping_requests_before_first_response=k,d.sent_ping_requests_total=k+(M||0),d.sent_ping_responses=U):"local-candidate"===t?(d.local_candidate_type=T,d.local_ip=I||A,d.local_network_type=R,d.local_port=C,d.protocol=w):"remote-candidate"===t&&(d.remote_candidate_type=T,d.remote_ip=I||A,d.remote_port=C)})),h=t.video,p=t.remoteStream,h.timestamp?(r.videoLossRate=(n.packetsLost-h.packetsLost)/(n.packetsReceived-h.packetsReceived+(n.packetsLost-h.packetsLost)),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,d.fraction_lost=r.videoLossRate,d.packets_lost_rate=r.videoLossRate,r.statsInterval=n.timestamp-h.timestamp,d.stats_interval=r.statsInterval,r.receivedKBitrate=(n.bytesReceived-h.bytesReceived||0)/r.statsInterval,d.bitrate=Math.round(8e3*r.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),r.decoderOutputFrameRate=1e3*(n.framesDecoded-h.framesDecoded)/r.statsInterval,d.frame_rate_decoded=Math.round(r.decoderOutputFrameRate),d.frame_rate_received=d.frame_rate_decoded,t.video=n,this.dataChannelRTT[t.remoteStream.userId]&&(f=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=f+(n.jitterBufferDelay||0),d.web_e2e_delay=r.e2eDelay,d.total_rtt_ms=f),this.processStall(p,d,s),this.monitor.rtcMediaStatistics(d,{}),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.processStall=function(e,t,r){var n=0,i=0,o=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(n+=e.stallCount,i+=e.stallDuration),o=e.playTime})),e.recordedVideoFrames.length||(i=2e3,n=this._videoInWaiting[e.streamId]?0:1,this._videoInWaiting[e.streamId]=!0);var a=e.recordedVideoFrames.pop();a&&(a.isStall?this._videoInWaiting[e.streamId]=!0:this._videoInWaiting[e.streamId]=!1),e.recordedVideoFrames=[]}t.stall_count=n,r?(t.stuck_length=i,t.stall_duration=void 0):(t.stall_duration=i,t.stuck_length=void 0),t.play_time=o},e.prototype.setLocalStreamStatsEvtInterval=function(e){var t,r,n=this,i={audio:{},video:{},localStream:e},o=null===(t=e.audioTrack)||void 0===t?void 0:t.getTrack(),a=null===(r=e.videoTrack)||void 0===r?void 0:r.getTrack();this.getAudioStats(o,i),this.getVideoStats(a,i),this.delLocalStreamStatsEvtInterval(e);this._localStreamStasEvtIntervals[e.streamId]=setInterval((function(){return qf(n,void 0,void 0,(function(){var t;return Zf(this,(function(r){switch(r.label){case 0:return[4,qf(n,void 0,void 0,(function(){var t,r,n,o,a,s;return Zf(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(),[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)},e.prototype.getAudioStats=function(e,t){return qf(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l;return Zf(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=i.pubAttributes,u={media_type:"audio",is_screen:+s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this._handler?[4,this._handler.getStats(e)]:[2,r];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,i=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,d=e.channels,l=e.audioLevel,h=e.googRtt,p=e.mimeType,f=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,S=e.id,E=e.currentRoundTripTime,y=e.state,g=e.writable,b=e.requestsReceived,T=e.responsesReceived,I=e.requestsSent,A=e.consentRequestsSent,R=e.responsesSent,C=e.jitter,O=e.candidateType,N=e.ip,w=e.address,P=e.networkType,D=e.port,k=e.protocol,M=e.nackCount,U=e.retransmittedBytesSent,L=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType;"outbound-rtp"===t?(n.packetsSent=i,n.bytesSent=a,u.bytes=a,u.packets=i,u.nack_count=M,u.ssrc=F,u.retransmitted_bytes_sent=U,u.retransmitted_packets_sent=L):"remote-inbound-rtp"===t?(n.packetsLost=o,u.packets_lost=o,u.jitter=1e3*C,r.rtt=1e3*c,u.rtt=r.rtt,u.round_trip_time_measurements=x):"codec"===t?(r.recordSampleRate=s,r.numChannels=d,u.codec=p):"media-source"===t?(u.audio_level=-10*Math.log10(Math.pow(l,2)),u.volume=255*l,u.total_audio_energy=B,u.total_samples_duration=j):"ssrc"===t&&"audio"===G?(u.audio_network_elapse=h,u.send_level=V):"candidate-pair"===t?(u.ice_available_incoming_bitrate=f,u.ice_available_outgoing_bitrate=_,u.ice_bytes_received=v,u.ice_bytes_sent=a,u.ice_nominated=+m,u.ice_pair_id=S,u.ice_pair_rtt=E,u.ice_pair_state=y,u.ice_pair_writable=g,u.recv_ping_requests=b,u.recv_ping_responses=T,u.sent_ping_requests_before_first_response=I,u.sent_ping_requests_total=I+(A||0),u.sent_ping_responses=R):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=N||w,u.local_network_type=P,u.local_port=D,u.protocol=k):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=N||w,u.remote_port=D)})),(l=t.audio).timestamp?(void 0!==n.packetsLost&&(r.audioLossRate=(n.packetsLost-l.packetsLost)/(n.packetsSent-l.packetsSent),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,u.fraction_lost=r.audioLossRate),r.statsInterval=n.timestamp-l.timestamp,u.stats_interval=r.statsInterval,r.sentKBitrate=(n.bytesSent-l.bytesSent||0)/r.statsInterval,u.bitrate=Math.round(8e3*r.sentKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=n,this.monitor.rtcMediaStatistics(u,{}),[2,r]):(t.audio=n,[2,r])):[2,r]}}))}))},e.prototype.getVideoStats=function(e,t){return qf(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l;return Zf(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=i.pubAttributes,u={media_type:"video",is_screen:+s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},e&&this._handler?(r.isScreen=s,[4,this._handler.getStats(e)]):[2,r];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,i=e.framesEncoded,o=e.packetsLost,a=e.bytesSent;e.framesSent;var s=e.roundTripTime,c=e.mimeType,d=e.frameWidth,l=e.frameHeight;e.clockRate;var h=e.packetsSent,p=e.googActualEncBitrate,f=e.googAvailableReceiveBandwidth,_=e.googAvailableSendBandwidth,v=e.googAvgEncodeMs,m=e.googBucketDelay,S=e.googEncodeUsagePercent,E=e.googFrameRateInput,y=e.availableIncomingBitrate,g=e.availableOutgoingBitrate,b=e.bytesReceived,T=e.nominated,I=e.id,A=e.currentRoundTripTime,R=e.state,C=e.writable,O=e.candidateType,N=e.ip,w=e.address,P=e.networkType,D=e.port,k=e.nackCount,M=e.pliCount,U=e.protocol,L=e.qpSum,x=e.requestsReceived,V=e.responsesReceived,F=e.googRetransmitBitrate,B=e.requestsSent,j=e.consentRequestsSent,G=e.responsesSent,H=e.ssrc,z=e.googTargetEncBitrate,K=e.googTransmitBitrate,Y=e.googRtt,X=e.retransmittedPacketsSent,W=e.encoderImplementation,J=e.jitter;"outbound-rtp"===t?(n.framesEncoded=i,n.bytesSent=a,u.bytes=a,n.packetsSent=h,u.packets=h,u.nack_count=k,u.pli_count=M,u.qp_sum=L,u.ssrc=H,u.retransmitted_packets_sent=X,u.encoder_implementation=W):"track"===t?(r.encodedFrameWidth=d,r.encodedFrameHeight=l,u.frame_size_height=l,u.frame_size_width=d):"remote-inbound-rtp"===t?(n.packetsLost=o,r.rtt=1e3*s,u.rtt=r.rtt,u.jitter=J,u.packets_lost=o):"codec"===t?(r.codecType=c,u.codec=c):"candidate-pair"===t?(u.ice_available_incoming_bitrate=y,u.ice_available_outgoing_bitrate=g,u.ice_bytes_received=b,u.ice_bytes_sent=a,u.ice_nominated=+T,u.ice_pair_id=I,u.ice_pair_rtt=A,u.ice_pair_state=R,u.ice_pair_writable=C,u.recv_ping_requests=x,u.recv_ping_responses=V,u.sent_ping_requests_before_first_response=B,u.sent_ping_requests_total=B+j,u.sent_ping_responses=G):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=N||w,u.local_network_type=P,u.local_port=D,u.protocol=U):"remote-candidate"===t?(u.remote_candidate_type=O,u.remote_ip=N||w,u.remote_port=D):"VideoBwe"===t?(u.actual_enc_bitrate=p,u.available_receive_bandwidth=f,u.available_send_bandwidth=_,u.bucket_delay=m,u.retransmit_bitrate=F,u.target_enc_bitrate=z,u.transmit_bitrate=K):"ssrc"===t&&(u.video_network_elapse=Y,u.avg_encode_ms=v,u.encode_usage_percent=S,u.frame_rate_input=E,u.orignal_input_Framerate=+E)})),(l=t.video).timestamp?(r.statsInterval=n.timestamp-l.timestamp,u.stats_interval=r.statsInterval,r.encodedFrameCount=void 0!==n.framesSent?n.framesSent-l.framesSent:n.framesEncoded-l.framesEncoded,r.sentKBitrate=(n.bytesSent-l.bytesSent||0)/r.statsInterval,u.bitrate=Math.round(8e3*r.sentKBitrate),u.bandwidth=Math.round(u.bitrate/1024),r.encoderOutputFrameRate=1e3*(n.framesEncoded-l.framesEncoded)/r.statsInterval,u.frame_rate_encoded=Math.round(r.encoderOutputFrameRate),r.sentFrameRate=1e3*r.encodedFrameCount/r.statsInterval,u.frame_rate_sent=Math.round(r.sentFrameRate),r.videoLossRate=(n.packetsLost-l.packetsLost)/(n.packetsSent-l.packetsSent),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,u.fraction_lost=r.videoLossRate,t.video=n,this.monitor.rtcMediaStatistics(u,{}),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.getDataChannelRTT=function(e){var t,r=this,n=sD();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])})),Object.keys(this._remoteStreamAudioStallInterval).forEach((function(t){clearTimeout(e._remoteStreamAudioStallInterval[t])})),this._rttTimer={},this.dataChannelRTT={},this._videoInWaiting={}},e}(),dF=new MD("MediaServerClient",2),lF=5e3;!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(cF||(cF={}));var hF=function(e,t){dF.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)},pF=function(e){function t(t){void 0===t&&(t=GL);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._pubConfig={},r.monitor=t,r._pubSubLock=new Zx("pubSubLock"),r._joinLeaveLock=new Zx("joinLeaveLock"),r._state=cF.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r}return Cf(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){dF.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(kL.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[DL.ON_ADD_STREAM,DL.ON_REMOVE_STREAM,DL.USER_CONNECTION,DL.USER_DISCONNECTION,DL.ON_UPDATE_STREAM_ATTRIBUTES,DL.ON_UPDATE_ROOM_ATTRIBUTES,DL.ON_PUSH_TRACK,DL.ON_REMOVE_TRACK,DL.NODE_CHANGE,DL.ON_CUSTOM_MESSAGE,DL.USER_MESSAGE_RECEIVED,DL.USER_BINARY_MESSAGE_RECEIVED,DL.POST_PROCESSING_MESSAGE,DL.ON_USER_TOKEN_WILL_EXPIRE].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(){dF.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(kL.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(kL.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.setSessionId=function(){this._sessionId=nD(),KL.setStats({rtc_session_id:this._sessionId})},t.prototype.connect=function(e,t,r,n){var i;return void 0===t&&(t=""),void 0===r&&(r=""),void 0===n&&(n={}),qf(this,void 0,void 0,(function(){var o,a,s,c=this;return Zf(this,(function(u){switch(u.label){case 0:return this.connectionState=cF.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),n.node?(o=n.node,ZL("es.join.nodeChange",n),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return c.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new hx,[4,null===(i=this._iceConfigRequestManager)||void 0===i?void 0:i.getAccessNode(e,t,r,dx.getDeviceId(),null==n?void 0:n.reason,this._prevICENode,this._useCloudProxy)];case 2:if(!(o=u.sent()))throw ZL("es.join.getNodeFailed",""),new oP(eP.ICE_SERVER_WRONG,"get ICE config failed");ZL("es.join.getNodeSuccess",o),u.label=3;case 3:this._prevICENode=o,this._handler=new Wx(this.monitor),this._addHandlerEvents(),Promise.resolve().then((function(){return c.emit("onEstablishConnectionHook")})),u.label=4;case 4:return u.trys.push([4,6,,7]),[4,this._handler.connect(o)];case 5:return a=u.sent(),dF.print("join","establish peerConnection success"),[3,7];case 6:throw s=u.sent(),this.connectionState=cF.DISCONNECTED,new oP(eP.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 7:return this._dataChannelSignal=new rx(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,r,n){var i,o,a,s;return void 0===t&&(t={}),void 0===r&&(r=!1),qf(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_=this;return Zf(this,(function(v){switch(v.label){case 0:return dF.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._useCloudProxy=e.useCloudProxy,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return v.sent(),[4,null===(i=this._handler)||void 0===i?void 0:i.getDefaultSdp()];case 2:return c=v.sent(),p={Authorization:dD.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}},f={},[4,Hx()];case 3:p.params=(f.supportedCodecs=v.sent(),f.deviceType="web",f.userAgent=window.navigator.userAgent,f.sdkVersion=ok.VERSION,f.deviceId=dx.getDeviceId(),f.appId=this._appId,f.roomId=this._roomId,f.userId=this._clientId,f.businessId=this._businessId,f.enable_cloud_proxy=this._useCloudProxy,f),p.options={enableUnBundleMode:!0,supportTokenExpireCallBack:!0},p.sdpInfo=c,u=p,Promise.resolve().then((function(){return _.emit("onSendingJoinMessageHook")})),v.label=4;case 4:return v.trys.push([4,6,,7]),d=r?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(d,u)];case 5:return l=v.sent(),dF.print("join","send join message success"),this._authorization=u.Authorization,this.connectionState=cF.CONNECTED,this._statsReport=new uF(this,this._handler,this.monitor,null===(o=l.config)||void 0===o?void 0:o.engine_WEB),this._pubConfig.audioRed=!!(null===(s=null===(a=l.config)||void 0===a?void 0:a.engine_WEB)||void 0===s?void 0:s.pub_audio_red),[2,l];case 6:if(h=v.sent(),this.connectionState=cF.DISCONNECTED,(null==h?void 0:h.code)>=700&&(null==h?void 0:h.code)<800)throw new oP(eP.INVALID_TOKEN,(null==h?void 0:h.message)||"Invalid token");if(200!==(null==h?void 0:h.code))throw new oP(eP.JOIN_ROOM_FAILED,(null==h?void 0:h.message)||"Join room failed");return[3,7];case 7:return[2]}}))}))},t.prototype.publish=function(e){var t,r,n,i,o,a,s,c;return qf(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,S,E;return Zf(this,(function(y){switch(y.label){case 0:dF.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=sD(),h="",p="",f="",y.label=1;case 1:return y.trys.push([1,5,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(_=y.sent()))throw new oP(eP.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),extvideo:!!(u instanceof tF),extaudio:!!(d instanceof rF)},v={attributes:Wf({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=y.sent())?void 0:m.code))throw new oP(eP.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");return S=null===(o=null==m?void 0:m.relayMessage)||void 0===o?void 0:o.sdp,[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(_.sdp,S,void 0,e,tL.UP)];case 4:return y.sent(),e.streamId=m.streamId,e.videoMid=p,e.audioMid=h,this.monitor.rtcPublishStat(iL.SUCCESS,oL.W_0,l,aL.UNKNOWN),null===(s=this._statsReport)||void 0===s||s.setLocalStreamStatsEvtInterval(e),[2];case 5:return(E=y.sent())instanceof Error&&this.monitor.rtcPublishStat(iL.FAIL,oL.W_0,l,E.message),h&&p?[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(f,[h,p])]:[3,7];case 6:y.sent(),y.label=7;case 7:throw E;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,r,n,i,o,a;return qf(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b;return Zf(this,(function(T){switch(T.label){case 0:dF.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!==r_.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),extvideo:!!(s instanceof tF),extaudio:!!(c instanceof rF)},p={};try{for(f=$f(Object.entries(h)),_=f.next();!_.done;_=f.next())v=Qf(_.value,2),m=v[0],(S=v[1])!==Reflect.get(e.pubAttributes,m)&&Reflect.set(p,m,S)}catch(e){g={error:e}}finally{try{_&&!_.done&&(b=f.return)&&b.call(f)}finally{if(g)throw g.error}}return Object.keys(p).length?(e.pubAttributes=h,E={roomId:this._roomId,streamId:e.streamId,attributes:p},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateStreamAttributes",E)]):[2];case 1:if(200!==(null==(y=T.sent())?void 0:y.code))throw new oP(eP.UPDATE_TRACK_FAILED,(null==y?void 0:y.message)||"update track failed");return[2]}}))}))},t.prototype.updateToken=function(e){var t,r,n;return qf(this,void 0,void 0,(function(){var i,o;return Zf(this,(function(a){switch(a.label){case 0:if(dF.print("updateToken()","newToken: %o",e),this._token=e,!this._appId||!(null===(t=this._userInfo)||void 0===t?void 0:t.userId)||!this._roomId)return[2];i={roomId:this._roomId,userId:null===(r=this._userInfo)||void 0===r?void 0:r.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateToken",i)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new oP(eP.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new oP(eP.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,r,n;return qf(this,void 0,void 0,(function(){var i,o;return Zf(this,(function(a){switch(a.label){case 0:return dF.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 oP(eP.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 qf(this,void 0,void 0,(function(){var h,p,f,_,v,m,S,E,y,g,b,T,I,A,R,C,O,N,w,P;return Zf(this,(function(D){switch(D.label){case 0:if(e.hasSubscribed)return[2,this._updateSubTrack(e,t,r)];dF.print("subscribe()","mediaType: %o, config: %o",t,r),hF("subscribe()",e),h=!1,p=!1,t===Bf.VIDEO_ONLY?h=!0:t===Bf.AUDIO_ONLY?p=!0:t===Bf.AUDIO_AND_VIDEO?(h=!0,p=!0):t===Bf.NONE&&(h=!1,p=!1),f=sD(),_=e.audioMid,v=e.videoMid,S=!1,D.label=1;case 1:return D.trys.push([1,12,,15]),_&&v?(S=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e,{audioMid:_,videoMid:v})]):[3,3];case 2:return m=D.sent(),[3,5];case 3:return[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e)];case 4:if(!(m=D.sent()))throw new oP(eP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,D.label=5;case 5:return E={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:v,audioMid:_,sdpInfo:{sdp:null==m?void 0:m.partialSdp,semantics:null==m?void 0:m.semantics,type:null==m?void 0:m.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||p,video:h},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("subscribe",E)];case 6:if(200!==(null==(y=D.sent())?void 0:y.code))throw new oP(eP.SUBSCRIBE_FAILED,(null==y?void 0:y.message)||"subscribe failed");return g=[],b=!this._multiChatMode(),!(_&&v)&&g.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new oP(eP.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),lF);e.on("ontrack",(function r(i){"video"===i.mediaType&&(dF.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),b&&g.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new oP(eP.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),lF);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(dF.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==y?void 0:y.relayMessage,A=I.audioMid,R=I.videoMid,C=I.sequenceId,O=I.sdp,S&&_!==A?(dF.print("subscribe","mid mot match",_,A),[4,null===(s=this._handler)||void 0===s?void 0:s.closeMLine([_,v])]):[3,9];case 7:return D.sent(),[4,null===(c=this._handler)||void 0===c?void 0:c.subscribe(e)];case 8:if(!(m=D.sent()))throw new oP(eP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,D.label=9;case 9:return(P={})[_]=A,P[v]=R,N=P,e.videoMid=R,e.audioMid=A,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,tL.DOWN)];case 10:return D.sent(),[4,Promise.all(g)];case 11:return D.sent(),this._multiChatMode()||(e.subAudio=p),e.subVideo=h,this.monitor.rtcSubscribeStat(sL.SUCCESS,f,cL.UNKNOWN,e.userId),null===(d=this._statsReport)||void 0===d||d.setRemoteStreamStatsEvtInterval(e),[2];case 12:return(w=D.sent())instanceof Error&&this.monitor.rtcSubscribeStat(sL.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:D.sent(),D.label=14;case 14:throw w;case 15:return[2]}}))}))},t.prototype.controlMessage=function(e){var t;return qf(this,void 0,void 0,(function(){var r;return Zf(this,(function(n){switch(n.label){case 0:return dF.print("controlMessage()","params: %o",e),r=e,"transcode"===e.type&&(r.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return qf(this,void 0,void 0,(function(){return Zf(this,(function(r){switch(r.label){case 0:return dF.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 qf(this,void 0,void 0,(function(){return Zf(this,(function(n){return[2,this._updateSubTrack(e,t,r)]}))}))},t.prototype._updateSubTrack=function(e,t,r){var n,i,o;return qf(this,void 0,void 0,(function(){var a,s,c,u;return Zf(this,(function(d){switch(d.label){case 0:return dF.print("updateSubTrack()","mediaType: %o, config: %o",t,r),hF("updateSubTrack()",e),a=!1,s=!1,t===Bf.VIDEO_ONLY?(a=!0,s=!1):t===Bf.AUDIO_ONLY?(s=!0,a=!1):t===Bf.AUDIO_AND_VIDEO?(a=!0,s=!0):t===Bf.NONE&&(a=!1,s=!1),c={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:a,audio:!!this._multiChatMode()||s},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",c)];case 1:if(200!==(null==(u=d.sent())?void 0:u.code))throw new oP(eP.UPDATE_TRACK_FAILED,(null==u?void 0:u.message)||"update track failed");return e.paused=!a,this._multiChatMode()||(null===(i=e.observer)||void 0===i||i.setUnmuteAudio(s),e.subAudio=s),null===(o=e.observer)||void 0===o||o.setUnmuteVideo(a),e.subVideo=a,e.subMediaType=t,e.subConfig=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var r,n,i,o,a,s;return qf(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_,v,m,S,E,y;return Zf(this,(function(g){switch(g.label){case 0:if(dF.print("subscribe4pushTrack()","streamInfo: %o",t),hF("subscribe4pushTrack()",e),c=null==t?void 0:t.message,u=c.audioMid,d=c.videoMid,l=c.sequenceId,h=c.sdp,e.subAudio=!0,l<e.sequenceId)return dF.print("subscribe4pushTrack","sequenceId return",l,e.sequenceId),[2];p=e.audioMid,f=e.videoMid,null===(r=e.observer)||void 0===r||r.setPushTrack(!0),g.label=1;case 1:return g.trys.push([1,8,,11]),p&&f?[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e,{audioMid:p,videoMid:f})]:[3,3];case 2:return _=g.sent(),[3,5];case 3:return[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e)];case 4:if(!(_=g.sent()))throw new oP(eP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");p=_.audioMid,f=_.videoMid,g.label=5;case 5:return(y={})[p]=u,y[f]=d,v=y,dF.print("onpushtrack midmap",e.userId,v),e.audioMid=u,e.videoMid=d,e.sequenceId=l,m=[],e.audioTrack||m.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new oP(eP.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),lF);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(dF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),S=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",S),this._ontrackCallbackMap.set(e,S),[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(null==_?void 0:_.sdp,h,v,e,tL.DOWN)];case 6:return g.sent(),[4,Promise.all(m)];case 7:return g.sent(),[2];case 8:return E=g.sent(),_?[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(null==_?void 0:_.sdp,[p,f])]:[3,10];case 9:g.sent(),g.label=10;case 10:throw E;case 11:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var r,n;return qf(this,void 0,void 0,(function(){return Zf(this,(function(i){switch(i.label){case 0:return hF("unsubscribe4removeTrack()",e),dF.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(dF.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(r=e.observer)||void 0===r||r.setPushTrack(!1),[4,null===(n=this._handler)||void 0===n?void 0:n.closeMLine([e.videoMid||"",e.audioMid||""])]));case 1:return i.sent(),dF.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),[2]}}))}))},t.prototype.unsubscribe=function(e){var t,r,n,i,o;return qf(this,void 0,void 0,(function(){var a;return Zf(this,(function(s){switch(s.label){case 0:hF("unsubscribe()",e),a={roomId:this._roomId,streamId:e.streamId,userId:e.userId},s.label=1;case 1:return s.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unsubscribe",a)];case 2:case 3:return s.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(r=e.observer)||void 0===r||r.setSubscribeVideo(!1),e.subAudio?[3,6]:(null===(n=e.observer)||void 0===n||n.setSubscribeAudio(!1),[4,null===(i=this._handler)||void 0===i?void 0:i.closeMLine([e.videoMid||"",e.audioMid||""])]);case 5:s.sent(),dF.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(o=this._statsReport)||void 0===o||o.unsubscribe(e),s.label=6;case 6:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,r=this._ontrackCallbackMap.get(e);r&&(null===(t=this._handler)||void 0===t||t.off("ontrack",r),this._ontrackCallbackMap.delete(e))},t.prototype.handleRemoveStream=function(e,t){return qf(this,void 0,void 0,(function(){return Zf(this,(function(r){return hF("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==PL.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this.unsubscribe(e),[2]}))}))},t.prototype.leave=function(){var e;return qf(this,void 0,void 0,(function(){var t,r,n;return Zf(this,(function(i){switch(i.label){case 0:return dF.print("leave()"),this.connectionState!==cF.CONNECTED?[3,7]:(this.connectionState=cF.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:r=i.sent(),i.label=2;case 2:return i.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:return i.sent(),this.connectionState=cF.DISCONNECTED,[3,6];case 4:throw n=i.sent(),this.connectionState=cF.CONNECTED,n;case 5:return r(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new oP(eP.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,r,n,i,o;return qf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,f,_,v,m,S;return Zf(this,(function(E){switch(E.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(a=E.sent()))throw new oP(eP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return s=sD(),c=a.audioMid,u=a.videoMid,d={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:c,videoMid:u,sdpInfo:{sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("startPullStream",d)];case 2:return l=E.sent(),(h=[]).push(new Promise((function(t,r){var n=setTimeout((function(){return r(new oP(eP.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),lF);e.on("ontrack",(function r(i){"video"===i.mediaType&&(dF.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),h.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new oP(eP.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),lF);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(dF.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),p=function(t){e.ontrack(t)},null===(n=this._handler)||void 0===n||n.on("ontrack",p),this._ontrackCallbackMap.set(e,p),f=null==l?void 0:l.relayMessage,_=f.audioMid,v=f.videoMid,m=f.sequenceId,S=f.sdp,e.videoMid=v,e.audioMid=_,e.sequenceId=m,e._workaround_1_=!1,e.paused=!1,e.hasSubscribed=!0,e.subAudio=!0,e.subVideo=!0,[4,null===(i=this._handler)||void 0===i?void 0:i.setAnswerSdp(null==a?void 0:a.sdp,S,{},e,tL.DOWN)];case 3:return E.sent(),[4,Promise.all(h)];case 4:return E.sent(),this.monitor.rtcSubscribeStat(sL.SUCCESS,s,cL.UNKNOWN,e.userId),null===(o=this._statsReport)||void 0===o||o.setRemoteStreamStatsEvtInterval(e,{rtt:!1}),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,r,n;return qf(this,void 0,void 0,(function(){var i;return Zf(this,(function(o){switch(o.label){case 0:hF("unsubscribePublicStream()",e),i={appId:this._appId,streamId:e.streamId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("stopPullStream",i)];case 2:case 3:return o.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.subAudio=!1,[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 5:return o.sent(),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(n=this._statsReport)||void 0===n||n.unsubscribe(e),[2]}}))}))},t.prototype.destroy=function(){var e,t,r,n;dF.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=cF.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})},t.prototype.sendRoomMessage=function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)},t.prototype._multiChatMode=function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode},Object.defineProperty(t.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomAttributes",{get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),Jf([vF],t.prototype,"join",null),Jf([_F,fF],t.prototype,"publish",null),Jf([_F,fF],t.prototype,"updatePubTrack",null),Jf([_F,fF],t.prototype,"unpublish",null),Jf([_F,fF],t.prototype,"subscribe",null),Jf([fF],t.prototype,"controlMessage",null),Jf([fF],t.prototype,"updateUserAttributes",null),Jf([_F,fF],t.prototype,"updateSubTrack",null),Jf([_F,fF],t.prototype,"subscribe4pushTrack",null),Jf([_F,fF],t.prototype,"unsubscribe4removeTrack",null),Jf([_F,fF],t.prototype,"unsubscribe",null),Jf([_F,fF],t.prototype,"handleRemoveStream",null),Jf([_F],t.prototype,"subscribePublicStream",null),Jf([_F],t.prototype,"unsubscribePublicStream",null),t}(LD);function fF(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 qf(this,void 0,void 0,(function(){return Zf(this,(function(r){switch(r.label){case 0:return this._handler&&this._state===cF.CONNECTED?[4,n.apply(this,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:throw new oP(eP.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},r}function _F(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 qf(this,void 0,void 0,(function(){var t;return Zf(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 vF(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 qf(this,void 0,void 0,(function(){var t,r=this;return Zf(this,(function(i){return t=!1,[2,new Promise((function(i,o){return qf(r,void 0,void 0,(function(){var r,a;return Zf(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new oP(eP.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 mF,SF,EF,yF=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}(),gF=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}(),bF=new MD("Stream",0),TF=function(){function e(){this.isScreen=!1,this.seiList=[],this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1}}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(zx()){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 bF.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 bF.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.destroy(),this.observer=void 0},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,bF.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}(),IF=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=Bf.NONE,o.subConfig={videoIndex:0},o.hasSubscribed=!1,o}return Cf(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo,this.hasAudio=e.localaudio,this._attributes=e},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){var n=yF.getNalunits(new gF(t.data)).find((function(e){return e.sei}));n&&e.safeEmit("onSEIMessage",n.body.slice(1)),r.enqueue(t)}})).pipeTo(n)}else bF.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 bF.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(){var e;bF.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.observer=void 0},t.prototype.resetHasSubscribed=function(){this.hasSubscribed=!1},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,r;(null===(r=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new qV(e,aD()),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,aD()),this.emit("ontrack",this.videoTrack))},t}(LD);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(mF||(mF={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_MUTE_AUDIO="on_user_mute_audio",e.ON_USER_MUTE_VIDEO="on_user_mute_video",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error"}(SF||(SF={})),function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(EF||(EF={}));var AF,RF=function(){function e(e,t){this._audioEventSessionId=hD(),this._videoEventSessionId=hD(),this._isScreen=!1,this._audioFirstFrameState=EF.INITIAL,this._videoFirstFrameState=EF.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:hL.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:hL.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._publishVideo=!1,this._publishAudio=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._stream=e,this._handler=t,this.getTransportDelay()}return e.prototype.beginRecvFrame=function(e,t){var r,n,i,o,a;return qf(this,void 0,void 0,(function(){var s,c,u,d,l,h,p=this;return Zf(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:return f.sent(),s=this._transportDelay,c=hL.LOGIN,u=hL.UNMUTE,d=hL.SUBSCRIBE,l=hL.PUSH_TRACK,[c,u,d,l].indexOf(t)>=0&&(s=0),e===lL.AUDIO?(this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},h={media_type:e,event_type:dL.BEGIN_RECV,type:t,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(n=this._stream)||void 0===n?void 0:n.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){p.stopRecvFrame(lL.AUDIO,pL.TIMEOUT),p._firstAudioFrameInterval&&window.clearInterval(p._firstAudioFrameInterval)}),this._timeout),GL.rtcFirstFrame(h),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=EF.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===lL.VIDEO&&(this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t},h={media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?lL.SCREEN_VIDEO:e,event_type:dL.BEGIN_RECV,type:t,start:null===(o=this._currentVideoRecv)||void 0===o?void 0:o.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(a=this._stream)||void 0===a?void 0:a.userId,transport_delay:s},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){p.stopRecvFrame(lL.VIDEO,pL.TIMEOUT),p._firstVideoFrameInterval&&window.clearInterval(p._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),GL.rtcFirstFrame(h),this._videoFirstFrameState=EF.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var r,n,i,o,a,s,c;if(e===lL.AUDIO){if(this._audioFirstFrameState!==EF.BEGIN)return;var u={event_type:dL.RECV_END,media_type:e,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,reason:t,result:!1,stream_user_id:null===(n=this._stream)||void 0===n?void 0:n.userId,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,GL.rtcFirstFrame(u),this._audioFirstFrameState=EF.STOPPED}else if(e===lL.VIDEO){if(this._videoFirstFrameState!==EF.BEGIN)return;u={event_type:dL.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?lL.SCREEN_VIDEO:e,start:null===(a=this._currentVideoRecv)||void 0===a?void 0:a.startTime,reason:t,result:!1,stream_user_id:null===(s=this._stream)||void 0===s?void 0:s.userId,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,GL.rtcFirstFrame(u),this._videoFirstFrameState=EF.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,r,n;return qf(this,void 0,void 0,(function(){var i,o,a,s,c,u,d,l,h,p;return Zf(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:if(f.sent(),i=this._transportDelay,o=hL.LOGIN,a=hL.UNMUTE,s=hL.SUBSCRIBE,c=hL.PUSH_TRACK,e===lL.AUDIO){if(this._audioFirstFrameState!==EF.BEGIN)return[2];if(!this._currentAudioRecv)return[2];u=this._currentAudioRecv,l=u.type,h=u.startTime,[o,a,s,c].indexOf(l)>=0&&(i=0),p={event_type:dL.RECV_END,media_type:e,start:h,result:!0,stream_user_id:null===(t=this._stream)||void 0===t?void 0:t.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:i},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),GL.rtcFirstFrame(p),this._audioFirstFrameState=EF.RECEIVED}else if(e===lL.VIDEO){if(this._videoFirstFrameState!==EF.BEGIN)return[2];if(!this._currentVideoRecv)return[2];d=this._currentVideoRecv,l=d.type,h=d.startTime,[o,a,s,c].indexOf(l)>=0&&(i=0),p={event_type:dL.RECV_END,media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?lL.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(n=this._stream)||void 0===n?void 0:n.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:i},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),GL.rtcFirstFrame(p),this._videoFirstFrameState=EF.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var r,n,i,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&t.audio&&this.beginRecvFrame(lL.AUDIO,hL.LOGIN),e&&(null===(n=this._stream)||void 0===n?void 0:n.hasVideo)&&t.video&&this.beginRecvFrame(lL.VIDEO,hL.LOGIN),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&this.stopRecvFrame(lL.AUDIO,pL.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(lL.VIDEO,pL.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(lL.AUDIO,hL.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(lL.AUDIO,pL.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(lL.AUDIO,hL.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(lL.AUDIO,pL.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(lL.AUDIO,hL.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(lL.AUDIO,pL.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(lL.VIDEO,hL.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(lL.VIDEO,pL.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(lL.VIDEO,hL.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(lL.VIDEO,pL.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(lL.VIDEO,hL.ENABLE):this.stopRecvFrame(lL.VIDEO,pL.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal=e},e.prototype.setPushAudio=function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(lL.AUDIO,hL.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(lL.AUDIO,hL.PUSH)},e.prototype.setExternalVideoSource=function(e){this._videoExternal=e},e.prototype.setPushVideo=function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(lL.VIDEO,hL.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(lL.VIDEO,hL.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(lL.VIDEO,hL.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(lL.VIDEO,pL.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(lL.AUDIO,hL.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(lL.AUDIO,pL.UNPUBLISH)},e.prototype.setAutoSubscribe=function(e){this._autoSubscribe=e},e.prototype.setAutoSubscribeVideo=function(e){this._autoSubscribeVideo=e},e.prototype.setAutoSubscribeAudio=function(e){this._autoSubscribeAudio=e},e.prototype.setSubscribeAudio=function(e){var t,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(lL.AUDIO,hL.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&this.stopRecvFrame(lL.AUDIO,pL.UNSUBSCRIBE)},e.prototype.setSubscribeVideo=function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(lL.VIDEO,hL.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&this.stopRecvFrame(lL.VIDEO,pL.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(lL.AUDIO,hL.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(lL.AUDIO,pL.REMOVE_TRACK))},e.prototype.setMultiChatMode=function(e){this._multiChatMode=e},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype._watchForFirstVideoFrameRecv=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return qf(e,void 0,void 0,(function(){var e,r,n,i,o,a,s,c;return Zf(this,(function(u){switch(u.label){case 0:return(null===(n=this._handler)||void 0===n?void 0:n.pc)&&(null===(o=null===(i=this._stream)||void 0===i?void 0:i.videoTrack)||void 0===o?void 0:o.getTrack())?[4,Gx(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.videoTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(r=e.find((function(e){return"inbound-rtp"===e.type})))&&r.framesReceived>t){if(-1===t)return t=r.framesReceived,[2];this.recvFrameFinish(lL.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype._watchForFirstAudioFrameRecv=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return qf(e,void 0,void 0,(function(){var e,r,n,i,o,a,s,c;return Zf(this,(function(u){switch(u.label){case 0:return(null===(n=this._handler)||void 0===n?void 0:n.pc)&&(null===(o=null===(i=this._stream)||void 0===i?void 0:i.audioTrack)||void 0===o?void 0:o.getTrack())?[4,Gx(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.audioTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(r=e.find((function(e){return"inbound-rtp"===e.type})))&&r.totalSamplesReceived>t){if(-1===t)return t=r.totalSamplesReceived,[2];this.recvFrameFinish(lL.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return qf(this,void 0,void 0,(function(){var e=this;return Zf(this,(function(t){switch(t.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return t.sent(),this._transportDelayInterval=window.setInterval((function(){return qf(e,void 0,void 0,(function(){return Zf(this,(function(e){switch(e.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return e.sent(),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.getTransportDelayIntl=function(){var e,t;return qf(this,void 0,void 0,(function(){var r,n,i;return Zf(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,Gx(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:r=o.sent(),n=r.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(i=r.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==n?void 0:n.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*i.currentRoundTripTime/2)),o.label=2;case 2:return[2]}}))}))},e.prototype.reset=function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:hL.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:hL.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)},e}();!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.SENT=3]="SENT"}(AF||(AF={}));var CF=function(){function e(e,t){this._audioEventSessionId=hD(),this._videoEventSessionId=hD(),this._currentAudioSend={startTime:0,eventSessionId:0,type:hL.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:hL.LOGIN},this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._timeout=1e4,this._audioFirstFrameState=AF.INITIAL,this._videoFirstFrameState=AF.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var r,n,i,o=this;if(e===lL.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:dL.BEGIN_SEND,type:t,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){o.stopSendFrame(lL.AUDIO,pL.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),GL.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=AF.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===lL.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?lL.SCREEN_VIDEO:e,event_type:dL.BEGIN_SEND,type:t,start:null===(i=this._currentVideoSend)||void 0===i?void 0:i.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){o.stopSendFrame(lL.VIDEO,pL.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),GL.rtcFirstFrame(a),this._videoFirstFrameState=AF.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}},e.prototype.stopSendFrame=function(e,t){var r,n,i,o,a;if(e===lL.AUDIO){if(this._audioFirstFrameState!==AF.BEGIN)return;var s={event_type:dL.SENT_END,media_type:e,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioSend)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,GL.rtcFirstFrame(s),this._audioFirstFrameState=AF.STOPPED}else if(e===lL.VIDEO){if(this._videoFirstFrameState!==AF.BEGIN)return;s={event_type:dL.SENT_END,media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?lL.SCREEN_VIDEO:e,start:null===(o=this._currentVideoSend)||void 0===o?void 0:o.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(a=this._currentVideoSend)||void 0===a?void 0:a.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,GL.rtcFirstFrame(s),this._videoFirstFrameState=AF.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===lL.AUDIO){if(this._audioFirstFrameState!==AF.BEGIN)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,n=r.type,i=r.startTime,o={event_type:dL.SENT_END,media_type:e,start:i,result:!0,event_session_id:this._audioEventSessionId,type:n};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),GL.rtcFirstFrame(o),this._audioFirstFrameState=AF.SENT}else if(e===lL.VIDEO){if(this._videoFirstFrameState!==AF.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;n=a.type,i=a.startTime,o={event_type:dL.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?lL.SCREEN_VIDEO:e,start:i,result:!0,event_session_id:this._videoEventSessionId,type:n};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),GL.rtcFirstFrame(o),this._videoFirstFrameState=AF.SENT}},e.prototype.setLogin=function(e){var t,r;this._login!==e&&(this._login=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(lL.VIDEO,hL.LOGIN),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(lL.AUDIO,hL.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(lL.AUDIO,pL.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(lL.VIDEO,pL.LEAVE_ROOM))},e.prototype.setPublish=function(e){var t,r;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(lL.VIDEO,hL.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(lL.AUDIO,hL.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(lL.AUDIO,pL.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(lL.VIDEO,pL.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(lL.AUDIO,hL.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(lL.AUDIO,pL.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(lL.AUDIO,hL.ENABLE),!e&&this._audioSending&&this.stopSendFrame(lL.AUDIO,pL.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(lL.VIDEO,hL.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(lL.VIDEO,pL.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(lL.VIDEO,hL.ENABLE),!e&&this._videoSending&&this.stopSendFrame(lL.VIDEO,pL.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(lL.AUDIO,pL.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(lL.AUDIO,pL.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(lL.AUDIO,hL.PUSH),!e&&this._audioSending&&this.stopSendFrame(lL.AUDIO,pL.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(lL.VIDEO,pL.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(lL.VIDEO,pL.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(lL.VIDEO,hL.PUSH),!e&&this._videoSending&&this.stopSendFrame(lL.VIDEO,pL.STOP_PUSH))},e.prototype.setAutoPublish=function(e){this._autoPublish=e},e.prototype.setPublisher=function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(lL.AUDIO,pL.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(lL.VIDEO,pL.AUDIENCE))},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype.setPCSessionId=function(e){this._pcSessionId=e},e.prototype.setHandler=function(e){this._handler=e},e.prototype._getFirstVideoFrameStats=function(){var e,t,r,n,i,o;return qf(this,void 0,void 0,(function(){var a;return Zf(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(r=null===(t=this._stream)||void 0===t?void 0:t.videoTrack)||void 0===r?void 0:r.getTrack())?[4,Gx(null===(n=this._handler)||void 0===n?void 0:n.pc,null===(o=null===(i=this._stream)||void 0===i?void 0:i.videoTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._getFirstAudioFrameStats=function(){var e,t,r,n,i,o;return qf(this,void 0,void 0,(function(){var a;return Zf(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(r=null===(t=this._stream)||void 0===t?void 0:t.audioTrack)||void 0===r?void 0:r.getTrack())?[4,Gx(null===(n=this._handler)||void 0===n?void 0:n.pc,null===(o=null===(i=this._stream)||void 0===i?void 0:i.audioTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._watchForFirstVideoFrameSend=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return qf(e,void 0,void 0,(function(){var e;return Zf(this,(function(r){switch(r.label){case 0:return[4,this._getFirstVideoFrameStats()];case 1:if((e=r.sent())&&e.framesSent>t){if(-1===t)return t=e.framesSent,[2];this.sendFrameFinish(lL.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return qf(e,void 0,void 0,(function(){var e;return Zf(this,(function(r){switch(r.label){case 0:return[4,this._getFirstAudioFrameStats()];case 1:if((e=r.sent())&&e.packetsSent>t){if(-1===t)return t=e.packetsSent,[2];this.sendFrameFinish(lL.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}return[2]}}))}))}),100)},e.prototype.destroy=function(){delete this._stream,delete this._handler,window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)},Object.defineProperty(e.prototype,"_audioSending",{get:function(){return this._audioFirstFrameState===AF.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===AF.BEGIN},enumerable:!1,configurable:!0}),e}(),OF=new MD("Room",1),NF=function(e){function t(t){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._roomConfig=t,r._mediaServerClient=new pF,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,S=this;null===(e=this._mediaServerClient)||void 0===e||e.on(DL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(DL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(DL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(DL.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(DL.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(DL.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(DL.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(DL.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(DL.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(DL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(DL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(DL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(DL.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(DL.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(kL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(kL.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on("onRemoteStreamStats",(function(e){S.emit(SF.ON_REMOTE_STREAM_STATS,e)})),null===(m=this._mediaServerClient)||void 0===m||m.on("onLocalStreamStats",(function(e){S.emit(SF.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,o){return qf(this,void 0,void 0,(function(){var a=this;return Zf(this,(function(s){return KL.setStats({rtc_app_id:e,room_id:t,user_id:n.userId}),OF.print("join()"),[2,new Promise((function(s,c){return qf(a,void 0,void 0,(function(){var a,u,d,l=this;return Zf(this,(function(h){return this._joinResolveCallback=s,this._joinRejectCallback=c,this._liveControlMessage=i,this._roomInfo={appId:e,roomId:t,token:r,userInfo:n,useCloudProxy:o},a=sD(),null===(u=this._mediaServerClient)||void 0===u||u.setSessionId(),GL.joinRoom(vL.BEGIN,a,!1,"",{enable_cloud_proxy:null===(d=this._roomInfo)||void 0===d?void 0:d.useCloudProxy}),this._join((function(e){var t;GL.joinRoom(vL.END,a,!0,e.message,{enable_cloud_proxy:null===(t=l._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)}),(function(e){var t;GL.joinRoom(vL.END,a,!1,e.message,{enable_cloud_proxy:null===(t=l._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)}),!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,r){var n;return void 0===r&&(r=!1),qf(this,void 0,void 0,(function(){var i,o,a;return Zf(this,(function(s){switch(s.label){case 0:i=sD(),OF.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._liveControlMessage)];case 2:return o=s.sent(),this._mediaServerClient.roomAttributes=o.roomAttributes,this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e(null===(n=this._roomInfo)||void 0===n?void 0:n.userInfo),this._isReconnecting=!1,GL.rtcJoinRoom(0,"web","web",sD()-i),this._onJoinSucc(o,r),[3,4];case 3:return(a=s.sent()).code!==eP.OPERATION_CANCEL&&"function"==typeof t?[2,t(a)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,r){var n,i,o,a,s;return qf(this,void 0,void 0,(function(){var c,u,d,l;return Zf(this,(function(h){switch(h.label){case 0:return OF.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new TF,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new CF(this._localScreenStream,this._mediaServerClient.handler))),c=!1,u=!1,d=!1,l=!1,!this._localScreenStream.videoTrack&&t?(t instanceof tF&&(u=!0),c=!0):this._localScreenStream.videoTrack&&!t&&(c=!1),!this._localScreenStream.audioTrack&&r?(r instanceof rF&&(l=!0),d=!0):this._localScreenStream.audioTrack&&!r&&(d=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=r,this._localScreenStream.videoEncodeConfig=e,this._localScreenStream.hasPublished?[3,2]:(null===(n=this._localScreenStream.observer)||void 0===n||n.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]);case 1:return h.sent(),[3,4];case 2:return u?null===(i=this._localScreenStream.observer)||void 0===i||i.setPushVideo(c):null===(o=this._localScreenStream.observer)||void 0===o||o.setEnableVideo(c),l?null===(a=this._localScreenStream.observer)||void 0===a||a.setPushAudio(d):null===(s=this._localScreenStream.observer)||void 0===s||s.setEnableAudio(d),[4,this.updatePubScreenTrack()];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return qf(this,void 0,void 0,(function(){return Zf(this,(function(e){switch(e.label){case 0:return OF.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),this._localScreenStream?[4,this._mediaServerClient.updatePubTrack(this._localScreenStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e;return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){switch(t.label){case 0:return OF.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?(null===(e=this._localScreenStream.observer)||void 0===e||e.setPublish(!1),[4,this._mediaServerClient.unpublish(this._localScreenStream)]):[3,2];case 1:t.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,t.label=2;case 2:return[2]}}))}))},t.prototype.liveControlMessage=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){switch(t.label){case 0:return OF.print("controlMessage","Invoke controlMessage"),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){switch(t.label){case 0:return"stopped"===e.action&&delete e.publicStreamMeta,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){switch(t.label){case 0:return OF.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,n){var i,o,a,s,c,u;return void 0===n&&(n=!1),qf(this,void 0,void 0,(function(){var d,l,h,p,f,_;return Zf(this,(function(v){switch(v.label){case 0:if(OF.print("publish","Invoke publish"),d=!1,this._localStream||(this._localStream=new TF,this._mediaServerClient.handler&&(this._localStream.observer=new CF(this._localStream,this._mediaServerClient.handler)),d=!0),this._localStream.videoTrack=t,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.hasPublished)return[3,5];v.label=1;case 1:return v.trys.push([1,3,,4]),n?null===(i=this._localStream.observer)||void 0===i||i.setLogin(!0):d&&(l=!!this._localStream.videoTrack,h=!!this._localStream.audioTrack,p=this._localStream.videoTrack instanceof tF,f=this._localStream.audioTrack instanceof rF,this._roomConfig.isAutoPublish?(l&&(p?null===(o=this._localStream.observer)||void 0===o||o.setPushVideo(!0):null===(a=this._localStream.observer)||void 0===a||a.setEnableVideo(!0)),h&&(f?null===(s=this._localStream.observer)||void 0===s||s.setPushAudio(!0):null===(c=this._localStream.observer)||void 0===c||c.setEnableAudio(!0))):null===(u=this._localStream.observer)||void 0===u||u.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return v.sent(),this.emit(SF.ON_PUBLISH_RESULT,{isScreen:!1,state:Uf.PUBLISH_SUCC}),[3,4];case 3:throw _=v.sent(),this.emit(SF.ON_PUBLISH_RESULT,{isScreen:!1,state:Uf.PUBLISH_FAIL}),_;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:v.sent(),v.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return qf(this,void 0,void 0,(function(){return Zf(this,(function(e){switch(e.label){case 0:return OF.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 qf(this,void 0,void 0,(function(){return Zf(this,(function(e){switch(e.label){case 0:return OF.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 qf(this,void 0,void 0,(function(){return Zf(this,(function(n){switch(n.label){case 0:return OF.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 qf(this,void 0,void 0,(function(){return Zf(this,(function(o){return OF.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 qf(this,void 0,void 0,(function(){return Zf(this,(function(t){switch(t.label){case 0:return OF.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),qf(this,void 0,void 0,(function(){var r,n,i,o,a,s,c;return Zf(this,(function(u){switch(u.label){case 0:OF.print("leave","Invoke leave"),r=sD(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(n=$f(this._remoteStreams.values()),i=n.next();!i.done;i=n.next())o=i.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(e){s={error:e}}finally{try{i&&!i.done&&(c=n.return)&&c.call(n)}finally{if(s)throw s.error}}return this._localStream&&(null===(t=this._localStream.observer)||void 0===t||t.setLogin(!1)),[4,this._mediaServerClient.leave()];case 2:return u.sent(),this.destroy(),GL.rtcLeaveRoom(0,"",sD()-r),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&GL.rtcLeaveRoom(-1,a.message,sD()-r),[3,4];case 4:return[2]}}))}))},t.prototype.destroy=function(){var e,t,r,n;OF.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var i=$f(this._remoteStreams),o=i.next();!o.done;o=i.next()){var a=Qf(o.value,2)[1];Array.isArray(a)&&a.forEach((function(e){e&&e.clean()}))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}this._remoteStreams=new Map,this._localStream&&(null===(r=this._localStream)||void 0===r||r.clean(),this._localStream=void 0),this._localScreenStream&&(null===(n=this._localScreenStream)||void 0===n||n.clean(),this._localScreenStream=void 0),this._removeHandlerEventHandler(),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear()},t.prototype.updateToken=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){switch(t.label){case 0:return OF.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.muteLocalTrack=function(e,t){var r,n,i,o,a,s;return qf(this,void 0,void 0,(function(){var c,u;return Zf(this,(function(d){switch(d.label){case 0:return this._localStream&&(null===(r=this._localStream)||void 0===r?void 0:r.hasPublished)?(c=t!==kf.MUTE_STATE_OFF,u=this._localStream.switchTrackEnableState(e,c),"audio"===e?null===(i=null===(n=this.localStream)||void 0===n?void 0:n.observer)||void 0===i||i.setUnmuteAudio(c):null===(a=null===(o=this.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setUnmuteVideo(c),u?[4,null===(s=this._mediaServerClient)||void 0===s?void 0:s.updatePubTrack(this._localStream)]:[3,2]):[2,!1];case 1:d.sent(),d.label=2;case 2:return[2,u]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return qf(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return Zf(this,(function(c){t=[];try{for(r=$f(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===Bf.AUDIO_ONLY?n=Bf.NONE:r.subMediaType===Bf.AUDIO_AND_VIDEO&&(n=Bf.VIDEO_ONLY);break;case xf.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===Bf.VIDEO_ONLY?n=Bf.NONE:r.subMediaType===Bf.AUDIO_AND_VIDEO&&(n=Bf.AUDIO_ONLY);break;case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==Bf.NONE&&(n=Bf.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 qf(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return Zf(this,(function(c){t=[];try{for(r=$f(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===Bf.NONE?n=Bf.AUDIO_ONLY:r.subMediaType===Bf.VIDEO_ONLY&&(n=Bf.AUDIO_AND_VIDEO);break;case xf.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===Bf.NONE?n=Bf.VIDEO_ONLY:r.subMediaType===Bf.AUDIO_ONLY&&(n=Bf.AUDIO_AND_VIDEO);break;case xf.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==Bf.AUDIO_AND_VIDEO&&(n=Bf.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),qf(this,void 0,void 0,(function(){var i,o;return Zf(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,dD.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(){OF.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new pF,this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var r,n,i,o,a,s=this;OF.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=$f(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 _=$f(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:PL.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,!0,!1)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,r=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));try{for(var n=$f(this._remoteStreams.values()),i=n.next();!i.done;i=n.next()){var o=i.value;Array.isArray(o)&&o.forEach((function(e){return qf(r,void 0,void 0,(function(){var t;return Zf(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]),OF.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType,e.subConfig)];case 2:return r.sent(),OF.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(SF.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=r.sent(),OF.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,r){var n,i,o,a,s,c,u,d,l,h;if(void 0===t&&(t=!0),void 0===r&&(r=!0),e.clientId!==(null===(n=this._roomInfo)||void 0===n?void 0:n.userInfo.userId)){var p=this._findRemoteStream(e.clientId,e.streamId);if(!p){p=new IF(e.clientId,e.streamId,e.screen,e.attributes),this._initStreamListeners(p);var f=this._remoteStreams.get(e.clientId);f?f.push(p):this._remoteStreams.set(e.clientId,[p])}if(this._mediaServerClient.handler&&(p.observer=new RF(p,this._mediaServerClient.handler)),!p.isScreen&&(r&&p.hasVideo&&(p.attributes.extvideo?(null===(i=p.observer)||void 0===i||i.setExternalVideoSource(!0),null===(o=p.observer)||void 0===o||o.setPushVideo(!0)):(null===(a=p.observer)||void 0===a||a.setExternalVideoSource(!1),null===(s=p.observer)||void 0===s||s.setPublishVideo(!0))),r&&p.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(p.attributes.extaudio?(null===(c=p.observer)||void 0===c||c.setExternalAudioSource(!0),null===(u=p.observer)||void 0===u||u.setPushAudio(!0)):(null===(d=p.observer)||void 0===d||d.setExternalAudioSource(!1),null===(l=p.observer)||void 0===l||l.setPublishAudio(!0))),!0===t&&!1===r)){var _=this._roomConfig,v=_.isAutoSubscribeAudio,m=_.isAutoSubscribeVideo;null===(h=p.observer)||void 0===h||h.setLogin(!0,{audio:v,video:m})}return t&&this.safeEmit(DL.ON_ADD_STREAM,{stream:p}),!p.isScreen&&p.hasVideo&&this.safeEmit(SF.ON_USER_START_VIDEO_CAPTURE,{userId:p.userId}),!p.isScreen&&p.hasAudio&&this.safeEmit(SF.ON_USER_START_AUDIO_CAPTURE,{userId:p.userId}),p}},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,Wf({},n)),this.safeEmit(DL.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===ML.kickedByAdmin?a=eP.KICKED_OUT:i===ML.onUserTokenDidExpire?a=eP.TOKEN_EXPIRED:i===ML.userDuplicateLogin&&(a=eP.DUPLICATE_LOGIN),o===UL.roomDismissByAdmin&&(a=eP.ROOM_DISMISS),a&&this.safeEmit(SF.ON_ROOM_ERROR,{errorCode:a})}else{var s=wf.DROPPED;i===ML.userLeave?s=wf.QUIT:i===ML.kickedByAdmin?s=wf.KICKED_BY_ADMIN:i===ML.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(DL.ON_REMOVE_STREAM,{stream:e,reason:"Client leave"})})),r._remoteStreams.delete(n)),r.safeEmit(SF.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===ML.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,i,o=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=this._remoteStreams.get(e.clientId);if(a){var s=a.find((function(t){return t.streamId==e.streamId}));s&&(null===(r=this._mediaServerClient)||void 0===r||r.handleRemoveStream(s,e).then((function(){if(!(null==s?void 0:s._workaround_1_)){var t=o._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),o._remoteStreams.set(e.clientId,t)}})),this.safeEmit(DL.ON_REMOVE_STREAM,{stream:s,reason:e.message}),s.hasVideo&&(null===(n=s.observer)||void 0===n||n.setPublishVideo(!1)),s.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(null===(i=s.observer)||void 0===i||i.setPublishAudio(!1)))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t,r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E=e.clientId,y=e.streamId,g=e.attributes,b=this._findRemoteStream(E,y);if(b){var T=b.attributes,I=Wf(Wf({},T),g),A=!1,R=I.localaudio!==T.localaudio,C=!1,O=!1,N=I.localvideo!==T.localvideo,w=!1;I.audiostream!==T.audiostream&&(A=!0,C=!!I.audiostream,I.audiostream?this.safeEmit(SF.ON_USER_MUTE_AUDIO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_ON}):this.safeEmit(SF.ON_USER_MUTE_AUDIO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_OFF})),I.videostream!==T.videostream&&(O=!0,w=!!I.videostream,I.videostream?this.safeEmit(SF.ON_USER_MUTE_VIDEO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_ON}):this.safeEmit(SF.ON_USER_MUTE_VIDEO,{userInfo:{userId:E},muteState:kf.MUTE_STATE_OFF})),I.localaudio!==T.localaudio&&(I.localaudio?(I.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(r=b.observer)||void 0===r||r.setPushAudio(!0)):(null===(n=b.observer)||void 0===n||n.setExternalAudioSource(!1),null===(i=b.observer)||void 0===i||i.setEnableAudio(!0)),this.safeEmit(SF.ON_USER_START_AUDIO_CAPTURE,{userId:E})):(I.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),this.safeEmit(SF.ON_USER_STOP_AUDIO_CAPTURE,{userId:E}))),I.localvideo!==T.localvideo&&(I.localvideo?(I.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(SF.ON_USER_START_VIDEO_CAPTURE,{userId:E})):(I.extvideo?(null===(p=b.observer)||void 0===p||p.setExternalVideoSource(!0),null===(f=b.observer)||void 0===f||f.setPushVideo(!1)):(null===(_=b.observer)||void 0===_||_.setExternalVideoSource(!1),null===(v=b.observer)||void 0===v||v.setEnableVideo(!1)),this.safeEmit(SF.ON_USER_STOP_VIDEO_CAPTURE,{userId:E}))),A&&!R&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!N&&(null===(S=b.observer)||void 0===S||S.setRemoteUnmuteVideo(w)),b.attributes=I}},t.prototype._onPushTrack=function(e){var t=this,r=e.clientId,n=e.streamId,i=this._findRemoteStream(r,n);i||(i=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(i,e).then((function(){return t.safeEmit(SF.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){OF.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(SF.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){OF.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,r=e.nodes,n=e.reason;dx.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(r)&&r.length?this._getAccessNode=r[0]:this._getAccessFeedback=n,GL.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,r=this;this._isReconnecting=!0;try{for(var n=$f(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}}GL.rtcReconnect(1002,HU.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,zU.PEERCONNECTION),this._join((function(){GL.rtcReconnected(KU.PEERCONNECTION_RECONNECTED,YU.PEERCONNECTION)}),(function(e){OF.print("Reconnecting error, will reconnect after 3s",e),r._reconnectTimer=setTimeout(r._reconnect.bind(r),3e3)}),!0)},t.prototype._handleAbnormalDisconnection=function(){OF.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===cF.DISCONNECTED)t=Gf.CONNECTION_STATE_DISCONNECTED;else if(e.next===cF.CONNECTED)t=this._isReconnecting?Gf.CONNECTION_STATE_RECONNECTED:Gf.CONNECTION_STATE_CONNECTED;else{if(e.next!==cF.CONNECTING)return;t=this._isReconnecting?Gf.CONNECTION_STATE_RECONNECTING:Gf.CONNECTION_STATE_CONNECTING}this.safeEmit(kL.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(SF.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?Ff.STREAM_INDEX_SCREEN:Ff.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(DL.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(DL.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(DL.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(DL.POST_PROCESSING_MESSAGE,{code:r,message:["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"][r],type:e.type})},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(DL.ON_USER_TOKEN_WILL_EXPIRE,null)},t}(LD),wF=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=Qf(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},PF=new MD("Player",0),DF=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],kF={playsinline:"","webkit-playsinline":""},MF={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},UF=function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var r="audio"===e?kF:MF;if("video"===e&&this.videoCache.length>0){if(n=this.videoCache.pop())return wF(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var n;if(n=this.audioCache.pop())return wF(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=Qf(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}(),LF=new UF,xF=function(e){function t(t){var r=e.call(this)||this;r.mirrorType=Hf.MIRROR_TYPE_NONE,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,n;GL.rtcError("video autoplay failed, userId: ".concat(r.userId),-1e3),r.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:"autoplay-error",currentTime:(null===(n=r._videoDom)||void 0===n?void 0:n.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 oP(eP.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=LF.getOrCreate("video",{width:"100%",height:"100%",background:"black"}),this._videoDom.id="".concat(this.userId,"_").concat(aD()),this.renderMode===Vf.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===Hf.MIRROR_TYPE_RENDER)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&DF.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&&(DF.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){var i=e.isScreen?1.5:.5;if(void 0===t.__cumulativeTime&&(t.__cumulativeTime=0),0===(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime))return;if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>i;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var r;return qf(this,void 0,void 0,(function(){var n,i,o=this;return Zf(this,(function(a){return n=this._videoDom,PF.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),PF.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(PF.print("Invoke AudioPlayer.manuallyPlay"),!this._videoDom)throw new oP(eP.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){PF.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?Hf.MIRROR_TYPE_RENDER:Hf.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;PF.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom),LF.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}(wD.exports.EventEmitter),VF=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(ZL("_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(){ZL("_internalPlay successfully",{userId:n.userId})}))}catch(e){n._autoPlayError(e)}},r){var i=document.getElementById(r);if(!i)throw new oP(eP.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=LF.getOrCreate("audio",{display:"none"}),this._audioDom.id="".concat(this.userId,"_").concat(aD()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&DF.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&&(DF.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 qf(this,void 0,void 0,(function(){var r,n,i=this;return Zf(this,(function(o){return PF.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,r;GL.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0})},t.prototype.manuallyPlay=function(){if(PF.print("Invoke AudioPlayer.manuallyPlay"),!this._audioDom)throw new oP(eP.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 qf(this,void 0,void 0,(function(){var t;return Zf(this,(function(r){switch(r.label){case 0:return PF.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,xV.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;PF.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom),LF.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}(wD.exports.EventEmitter),FF="object"==("undefined"==typeof global?"undefined":t(global))&&global&&global.Object===Object&&global,BF="object"==("undefined"==typeof self?"undefined":t(self))&&self&&self.Object===Object&&self,jF=FF||BF||Function("return this")(),GF=jF.Symbol,HF=Object.prototype,zF=HF.hasOwnProperty,KF=HF.toString,YF=GF?GF.toStringTag:void 0;var XF=Object.prototype.toString;var WF=GF?GF.toStringTag:void 0;function JF(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":WF&&WF in Object(e)?function(e){var t=zF.call(e,YF),r=e[YF];try{e[YF]=void 0;var n=!0}catch(e){}var i=KF.call(e);return n&&(t?e[YF]=r:delete e[YF]),i}(e):function(e){return XF.call(e)}(e)}function qF(e){return null!=e&&"object"==t(e)}var ZF=Array.isArray;function $F(e){var r=t(e);return null!=e&&("object"==r||"function"==r)}function QF(e){return e}function eB(e){if(!$F(e))return!1;var t=JF(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var tB=jF["__core-js_shared__"],rB=function(){var e=/[^.]+$/.exec(tB&&tB.keys&&tB.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var nB=Function.prototype.toString;var iB=/^\[object .+?Constructor\]$/,oB=Function.prototype,aB=Object.prototype,sB=oB.toString,cB=aB.hasOwnProperty,uB=RegExp("^"+sB.call(cB).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function dB(e){return!(!$F(e)||(t=e,rB&&rB in t))&&(eB(e)?uB:iB).test(function(e){if(null!=e){try{return nB.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function lB(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 hB=Date.now;var pB,fB,_B,vB=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return dB(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),mB=vB,SB=mB?function(e,t){return mB(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:QF,EB=(pB=SB,fB=0,_B=0,function(){var e=hB(),t=16-(e-_B);if(_B=e,t>0){if(++fB>=800)return arguments[0]}else fB=0;return pB.apply(void 0,arguments)}),yB=EB,gB=/^(?:0|[1-9]\d*)$/;function bB(e,r){var n=t(e);return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&gB.test(e))&&e>-1&&e%1==0&&e<r}function TB(e,t,r){"__proto__"==t&&mB?mB(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function IB(e,t){return e===t||e!=e&&t!=t}var AB=Object.prototype.hasOwnProperty;function RB(e,t,r){var n=e[t];AB.call(e,t)&&IB(n,r)&&(void 0!==r||t in e)||TB(e,t,r)}var CB=Math.max;function OB(e,t){return yB(function(e,t,r){return t=CB(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=CB(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),lB(e,this,s)}}(e,t,QF),e+"")}function NB(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function wB(e){return null!=e&&NB(e.length)&&!eB(e)}var PB=Object.prototype;function DB(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||PB)}function kB(e){return qF(e)&&"[object Arguments]"==JF(e)}var MB=Object.prototype,UB=MB.hasOwnProperty,LB=MB.propertyIsEnumerable,xB=kB(function(){return arguments}())?kB:function(e){return qF(e)&&UB.call(e,"callee")&&!LB.call(e,"callee")},VB=xB;var FB="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,BB=FB&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,jB=BB&&BB.exports===FB?jF.Buffer:void 0,GB=(jB?jB.isBuffer:void 0)||function(){return!1},HB={};HB["[object Float32Array]"]=HB["[object Float64Array]"]=HB["[object Int8Array]"]=HB["[object Int16Array]"]=HB["[object Int32Array]"]=HB["[object Uint8Array]"]=HB["[object Uint8ClampedArray]"]=HB["[object Uint16Array]"]=HB["[object Uint32Array]"]=!0,HB["[object Arguments]"]=HB["[object Array]"]=HB["[object ArrayBuffer]"]=HB["[object Boolean]"]=HB["[object DataView]"]=HB["[object Date]"]=HB["[object Error]"]=HB["[object Function]"]=HB["[object Map]"]=HB["[object Number]"]=HB["[object Object]"]=HB["[object RegExp]"]=HB["[object Set]"]=HB["[object String]"]=HB["[object WeakMap]"]=!1;var zB="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,KB=zB&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,YB=KB&&KB.exports===zB&&FF.process,XB=function(){try{var e=KB&&KB.require&&KB.require("util").types;return e||YB&&YB.binding&&YB.binding("util")}catch(e){}}(),WB=XB&&XB.isTypedArray,JB=WB?function(e){return function(t){return e(t)}}(WB):function(e){return qF(e)&&NB(e.length)&&!!HB[JF(e)]},qB=JB,ZB=Object.prototype.hasOwnProperty;function $B(e,t){var r=ZF(e),n=!r&&VB(e),i=!r&&!n&&GB(e),o=!r&&!n&&!i&&qB(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&&!ZB.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||bB(u,c))||s.push(u);return s}var QB=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),ej=QB,tj=Object.prototype.hasOwnProperty;function rj(e){return wB(e)?$B(e):function(e){if(!DB(e))return ej(e);var t=[];for(var r in Object(e))tj.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var nj=Object.prototype.hasOwnProperty;function ij(e){if(!$F(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=DB(e),r=[];for(var n in e)("constructor"!=n||!t&&nj.call(e,n))&&r.push(n);return r}var oj,aj=(oj=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?TB(r,s,c):RB(r,s,c)}}(t,function(e){return wB(e)?$B(e,!0):ij(e)}(t),e)},OB((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=oj.length>3&&"function"==typeof o?(i--,o):void 0,a&&function(e,r,n){if(!$F(n))return!1;var i=t(r);return!!("number"==i?wB(n)&&bB(r,n.length):"string"==i&&r in n)&&IB(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&&oj(e,s,n,o)}return e}))),sj=aj;function cj(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 uj(e){return null==e?[]:cj(e,rj(e))}var dj=a,lj=Qe("iterator"),hj=!dj((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[lj]||"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})),pj=I,fj=2147483647,_j=/[^\0-\u007E]/,vj=/[.\u3002\uFF0E\uFF61]/g,mj="Overflow: input needs wider integers to process",Sj=i.RangeError,Ej=pj(vj.exec),yj=Math.floor,gj=String.fromCharCode,bj=pj("".charCodeAt),Tj=pj([].join),Ij=pj([].push),Aj=pj("".replace),Rj=pj("".split),Cj=pj("".toLowerCase),Oj=function(e){return e+22+75*(e<26)},Nj=function(e,t,r){var n=0;for(e=r?yj(e/700):e>>1,e+=yj(e/t);e>455;)e=yj(e/35),n+=36;return yj(n+36*e/(e+38))},wj=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=bj(e,r++);if(i>=55296&&i<=56319&&r<n){var o=bj(e,r++);56320==(64512&o)?Ij(t,((1023&i)<<10)+(1023&o)+65536):(Ij(t,i),r--)}else Ij(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&&Ij(t,gj(n));var c=t.length,u=c;for(c&&Ij(t,"-");u<i;){var d=fj;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>yj((fj-a)/l))throw Sj(mj);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>fj)throw Sj(mj);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;Ij(t,gj(Oj(f+_%v))),h=yj(_/v),p+=36}Ij(t,gj(Oj(h))),s=Nj(a,l,u==c),a=0,u++}}a++,o++}return Tj(t,"")},Pj=Xn,Dj=i,kj=Y,Mj=l,Uj=I,Lj=hj,xj=Wt.exports,Vj=nc,Fj=Go,Bj=Ph,jj=Or,Gj=lc,Hj=B,zj=xe,Kj=Yo,Yj=lo,Xj=kt,Wj=G,Jj=fo,qj=Ai,Zj=S,$j=Oc,Qj=gc,eG=lu,tG=sI,rG=Qe("iterator"),nG="URLSearchParams",iG="URLSearchParamsIterator",oG=jj.set,aG=jj.getterFor(nG),sG=jj.getterFor(iG),cG=kj("fetch"),uG=kj("Request"),dG=kj("Headers"),lG=uG&&uG.prototype,hG=dG&&dG.prototype,pG=Dj.RegExp,fG=Dj.TypeError,_G=Dj.decodeURIComponent,vG=Dj.encodeURIComponent,mG=Uj("".charAt),SG=Uj([].join),EG=Uj([].push),yG=Uj("".replace),gG=Uj([].shift),bG=Uj([].splice),TG=Uj("".split),IG=Uj("".slice),AG=/\+/g,RG=Array(4),CG=function(e){return RG[e-1]||(RG[e-1]=pG("((?:%[\\da-f]{2}){"+e+"})","gi"))},OG=function(e){try{return _G(e)}catch(t){return e}},NG=function(e){var t=yG(e,AG," "),r=4;try{return _G(t)}catch(e){for(;r;)t=yG(t,CG(r--),OG);return t}},wG=/[!'()~]|%20/g,PG={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},DG=function(e){return PG[e]},kG=function(e){return yG(vG(e),wG,DG)},MG=Bj((function(e,t){oG(this,{type:iG,iterator:$j(aG(e).entries),kind:t})}),"Iterator",(function(){var e=sG(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),UG=function(e){this.entries=[],this.url=null,void 0!==e&&(Wj(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===mG(e,0)?IG(e,1):e:Jj(e)))};UG.prototype={type:nG,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=Qj(e);if(c)for(r=(t=$j(e,c)).next;!(n=Mj(r,t)).done;){if(o=(i=$j(Xj(n.value))).next,(a=Mj(o,i)).done||(s=Mj(o,i)).done||!Mj(o,i).done)throw fG("Expected sequence with length 2");EG(this.entries,{key:Jj(a.value),value:Jj(s.value)})}else for(var u in e)zj(e,u)&&EG(this.entries,{key:u,value:Jj(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=TG(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=TG(t,"="),EG(this.entries,{key:NG(gG(r)),value:NG(SG(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],EG(r,kG(e.key)+"="+kG(e.value));return SG(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var LG=function(){Gj(this,xG);var e=arguments.length>0?arguments[0]:void 0;oG(this,new UG(e))},xG=LG.prototype;if(Vj(xG,{append:function(e,t){eG(arguments.length,2);var r=aG(this);EG(r.entries,{key:Jj(e),value:Jj(t)}),r.updateURL()},delete:function(e){eG(arguments.length,1);for(var t=aG(this),r=t.entries,n=Jj(e),i=0;i<r.length;)r[i].key===n?bG(r,i,1):i++;t.updateURL()},get:function(e){eG(arguments.length,1);for(var t=aG(this).entries,r=Jj(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){eG(arguments.length,1);for(var t=aG(this).entries,r=Jj(e),n=[],i=0;i<t.length;i++)t[i].key===r&&EG(n,t[i].value);return n},has:function(e){eG(arguments.length,1);for(var t=aG(this).entries,r=Jj(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){eG(arguments.length,1);for(var r,n=aG(this),i=n.entries,o=!1,a=Jj(e),s=Jj(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?bG(i,c--,1):(o=!0,r.value=s));o||EG(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=aG(this);tG(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=aG(this).entries,n=Kj(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 MG(this,"keys")},values:function(){return new MG(this,"values")},entries:function(){return new MG(this,"entries")}},{enumerable:!0}),xj(xG,rG,xG.entries,{name:"entries"}),xj(xG,"toString",(function(){return aG(this).serialize()}),{enumerable:!0}),Fj(LG,nG),Pj({global:!0,forced:!Lj},{URLSearchParams:LG}),!Lj&&Hj(dG)){var VG=Uj(hG.has),FG=Uj(hG.set),BG=function(e){if(Wj(e)){var t,r=e.body;if(Yj(r)===nG)return t=e.headers?new dG(e.headers):new dG,VG(t,"content-type")||FG(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),qj(e,{body:Zj(0,Jj(r)),headers:Zj(0,t)})}return e};if(Hj(cG)&&Pj({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return cG(e,arguments.length>1?BG(arguments[1]):{})}}),Hj(uG)){var jG=function(e){return Gj(this,lG),new uG(e,arguments.length>1?BG(arguments[1]):{})};lG.constructor=jG,jG.prototype=lG,Pj({global:!0,forced:!0},{Request:jG})}}var GG,HG={URLSearchParams:LG,getState:aG},zG=Xn,KG=s,YG=hj,XG=i,WG=Yo,JG=I,qG=ri.f,ZG=Wt.exports,$G=lc,QG=xe,eH=Vi,tH=zP,rH=Ao,nH=Ep.codeAt,iH=function(e){var t,r,n=[],i=Rj(Aj(Cj(e),vj,"."),".");for(t=0;t<i.length;t++)r=i[t],Ij(n,Ej(_j,r)?"xn--"+wj(r):r);return Tj(n,".")},oH=fo,aH=Go,sH=lu,cH=HG,uH=Or,dH=uH.set,lH=uH.getterFor("URL"),hH=cH.URLSearchParams,pH=cH.getState,fH=XG.URL,_H=XG.TypeError,vH=XG.parseInt,mH=Math.floor,SH=Math.pow,EH=JG("".charAt),yH=JG(/./.exec),gH=JG([].join),bH=JG(1..toString),TH=JG([].pop),IH=JG([].push),AH=JG("".replace),RH=JG([].shift),CH=JG("".split),OH=JG("".slice),NH=JG("".toLowerCase),wH=JG([].unshift),PH="Invalid scheme",DH="Invalid host",kH="Invalid port",MH=/[a-z]/i,UH=/[\d+-.a-z]/i,LH=/\d/,xH=/^0x/i,VH=/^[0-7]+$/,FH=/^\d+$/,BH=/^[\da-f]+$/i,jH=/[\0\t\n\r #%/:<>?@[\\\]^|]/,GH=/[\0\t\n\r #/:<>?@[\\\]^|]/,HH=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,zH=/[\t\n\r]/g,KH=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)wH(t,e%256),e=mH(e/256);return gH(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+=bH(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},YH={},XH=eH({},YH,{" ":1,'"':1,"<":1,">":1,"`":1}),WH=eH({},XH,{"#":1,"?":1,"{":1,"}":1}),JH=eH({},WH,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),qH=function(e,t){var r=nH(e,0);return r>32&&r<127&&!QG(t,e)?e:encodeURIComponent(e)},ZH={ftp:21,file:null,http:80,https:443,ws:80,wss:443},$H=function(e,t){var r;return 2==e.length&&yH(MH,EH(e,0))&&(":"==(r=EH(e,1))||!t&&"|"==r)},QH=function(e){var t;return e.length>1&&$H(OH(e,0,2))&&(2==e.length||"/"===(t=EH(e,2))||"\\"===t||"?"===t||"#"===t)},ez=function(e){return"."===e||"%2e"===NH(e)},tz={},rz={},nz={},iz={},oz={},az={},sz={},cz={},uz={},dz={},lz={},hz={},pz={},fz={},_z={},vz={},mz={},Sz={},Ez={},yz={},gz={},bz=function(e,t,r){var n,i,o,a=oH(e);if(t){if(i=this.parse(a))throw _H(i);this.searchParams=null}else{if(void 0!==r&&(n=new bz(r,!0)),i=this.parse(a,null,n))throw _H(i);(o=pH(new hH)).bindURL(this),this.searchParams=o}};bz.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||tz,d=0,l="",h=!1,p=!1,f=!1;for(e=oH(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=AH(e,HH,"")),e=AH(e,zH,""),n=tH(e);d<=n.length;){switch(i=n[d],u){case tz:if(!i||!yH(MH,i)){if(t)return PH;u=nz;continue}l+=NH(i),u=rz;break;case rz:if(i&&(yH(UH,i)||"+"==i||"-"==i||"."==i))l+=NH(i);else{if(":"!=i){if(t)return PH;l="",u=nz,d=0;continue}if(t&&(c.isSpecial()!=QG(ZH,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&ZH[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=fz:c.isSpecial()&&r&&r.scheme==c.scheme?u=iz:c.isSpecial()?u=cz:"/"==n[d+1]?(u=oz,d++):(c.cannotBeABaseURL=!0,IH(c.path,""),u=Ez)}break;case nz:if(!r||r.cannotBeABaseURL&&"#"!=i)return PH;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=rH(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=gz;break}u="file"==r.scheme?fz:az;continue;case iz:if("/"!=i||"/"!=n[d+1]){u=az;continue}u=uz,d++;break;case oz:if("/"==i){u=dz;break}u=Sz;continue;case az:if(c.scheme=r.scheme,i==GG)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=rH(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=sz;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=rH(r.path),c.query="",u=yz;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=rH(r.path),c.path.length--,u=Sz;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=rH(r.path),c.query=r.query,c.fragment="",u=gz}break;case sz:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=Sz;continue}u=dz}else u=uz;break;case cz:if(u=uz,"/"!=i||"/"!=EH(l,d+1))continue;d++;break;case uz:if("/"!=i&&"\\"!=i){u=dz;continue}break;case dz:if("@"==i){h&&(l="%40"+l),h=!0,o=tH(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||f){var m=qH(v,JH);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(i==GG||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=tH(l).length+1,l="",u=lz}else l+=i;break;case lz:case hz:if(t&&"file"==c.scheme){u=vz;continue}if(":"!=i||p){if(i==GG||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return DH;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=mz,t)return;continue}"["==i?p=!0:"]"==i&&(p=!1),l+=i}else{if(""==l)return DH;if(a=c.parseHost(l))return a;if(l="",u=pz,t==hz)return}break;case pz:if(!yH(LH,i)){if(i==GG||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var S=vH(l,10);if(S>65535)return kH;c.port=c.isSpecial()&&S===ZH[c.scheme]?null:S,l=""}if(t)return;u=mz;continue}return kH}l+=i;break;case fz:if(c.scheme="file","/"==i||"\\"==i)u=_z;else{if(!r||"file"!=r.scheme){u=Sz;continue}if(i==GG)c.host=r.host,c.path=rH(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=rH(r.path),c.query="",u=yz;else{if("#"!=i){QH(gH(rH(n,d),""))||(c.host=r.host,c.path=rH(r.path),c.shortenPath()),u=Sz;continue}c.host=r.host,c.path=rH(r.path),c.query=r.query,c.fragment="",u=gz}}break;case _z:if("/"==i||"\\"==i){u=vz;break}r&&"file"==r.scheme&&!QH(gH(rH(n,d),""))&&($H(r.path[0],!0)?IH(c.path,r.path[0]):c.host=r.host),u=Sz;continue;case vz:if(i==GG||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&$H(l))u=Sz;else if(""==l){if(c.host="",t)return;u=mz}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=mz}continue}l+=i;break;case mz:if(c.isSpecial()){if(u=Sz,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=GG&&(u=Sz,"/"!=i))continue}else c.fragment="",u=gz;else c.query="",u=yz;break;case Sz:if(i==GG||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=NH(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||IH(c.path,"")):ez(l)?"/"==i||"\\"==i&&c.isSpecial()||IH(c.path,""):("file"==c.scheme&&!c.path.length&&$H(l)&&(c.host&&(c.host=""),l=EH(l,0)+":"),IH(c.path,l)),l="","file"==c.scheme&&(i==GG||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)RH(c.path);"?"==i?(c.query="",u=yz):"#"==i&&(c.fragment="",u=gz)}else l+=qH(i,WH);break;case Ez:"?"==i?(c.query="",u=yz):"#"==i?(c.fragment="",u=gz):i!=GG&&(c.path[0]+=qH(i,YH));break;case yz:t||"#"!=i?i!=GG&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":qH(i,YH)):(c.fragment="",u=gz);break;case gz:i!=GG&&(c.fragment+=qH(i,XH))}d++}},parseHost:function(e){var t,r,n;if("["==EH(e,0)){if("]"!=EH(e,e.length-1))return DH;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 EH(e,l)};if(":"==h()){if(":"!=EH(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&yH(BH,h());)t=16*t+vH(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(!yH(LH,h()))return;for(;yH(LH,h());){if(o=vH(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}(OH(e,1,-1)),!t)return DH;this.host=t}else if(this.isSpecial()){if(e=iH(e),yH(jH,e))return DH;if(t=function(e){var t,r,n,i,o,a,s,c=CH(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"==EH(i,0)&&(o=yH(xH,i)?16:8,i=OH(i,8==o?1:2)),""===i)a=0;else{if(!yH(10==o?FH:8==o?VH:BH,i))return e;a=vH(i,o)}IH(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=SH(256,5-t))return null}else if(a>255)return null;for(s=TH(r),n=0;n<r.length;n++)s+=r[n]*SH(256,3-n);return s}(e),null===t)return DH;this.host=t}else{if(yH(GH,e))return DH;for(t="",r=tH(e),n=0;n<r.length;n++)t+=qH(r[n],YH);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return QG(ZH,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&$H(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+=KH(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+gH(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw _H(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new Tz(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+KH(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(oH(e)+":",tz)},getUsername:function(){return this.username},setUsername:function(e){var t=tH(oH(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=qH(t[r],JH)}},getPassword:function(){return this.password},setPassword:function(e){var t=tH(oH(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=qH(t[r],JH)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?KH(e):KH(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,lz)},getHostname:function(){var e=this.host;return null===e?"":KH(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,hz)},getPort:function(){var e=this.port;return null===e?"":oH(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=oH(e))?this.port=null:this.parse(e,pz))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+gH(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,mz))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=oH(e))?this.query=null:("?"==EH(e,0)&&(e=OH(e,1)),this.query="",this.parse(e,yz)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=oH(e))?("#"==EH(e,0)&&(e=OH(e,1)),this.fragment="",this.parse(e,gz)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Tz=function(e){var t=$G(this,Iz),r=sH(arguments.length,1)>1?arguments[1]:void 0,n=dH(t,new bz(e,!1,r));KG||(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())},Iz=Tz.prototype,Az=function(e,t){return{get:function(){return lH(this)[e]()},set:t&&function(e){return lH(this)[t](e)},configurable:!0,enumerable:!0}};if(KG&&qG(Iz,{href:Az("serialize","setHref"),origin:Az("getOrigin"),protocol:Az("getProtocol","setProtocol"),username:Az("getUsername","setUsername"),password:Az("getPassword","setPassword"),host:Az("getHost","setHost"),hostname:Az("getHostname","setHostname"),port:Az("getPort","setPort"),pathname:Az("getPathname","setPathname"),search:Az("getSearch","setSearch"),searchParams:Az("getSearchParams"),hash:Az("getHash","setHash")}),ZG(Iz,"toJSON",(function(){return lH(this).serialize()}),{enumerable:!0}),ZG(Iz,"toString",(function(){return lH(this).serialize()}),{enumerable:!0}),fH){var Rz=fH.createObjectURL,Cz=fH.revokeObjectURL;Rz&&ZG(Tz,"createObjectURL",WG(Rz,fH)),Cz&&ZG(Tz,"revokeObjectURL",WG(Cz,fH))}aH(Tz,"URL"),zG({global:!0,forced:!YG,sham:!KG},{URL:Tz});var Oz,Nz=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 qf(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,p,f,_=this;return Zf(this,(function(v){switch(v.label){case 0:if(n=r.playCount,yD(i=r.type,"mixingType",uj(r_)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=HV(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_STOPPED,error:tP.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,3]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw _._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_FAILED,error:tP.AUDIO_MIXING_ERROR_START_FAILED}),new oP(eP.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:n_.AUDIO_MIXING_STATE_FINISHED,error:tP.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===r_.PUBLISH)try{p.disconnect(this._sharedAudioContext.destination)}catch(e){}else p.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],r.type),this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_PLAYING,error:tP.AUDIO_MIXING_ERROR_OK}),[2]}}))}))},e.prototype.stopAudioMixing=function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_STOPPED,error:tP.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_PAUSED,error:tP.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())},e.prototype.resumeAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_PLAYING,error:tP.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return qf(this,void 0,void 0,(function(){var r,n=this;return Zf(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:n_.AUDIO_MIXING_STATE_PRELOADED,error:tP.AUDIO_MIXING_ERROR_OK}),t.arrayBuffer();throw n._context.emitMessage({mixId:e,state:n_.AUDIO_MIXING_STATE_FAILED,error:tP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new oP(eP.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(e){throw new oP(eP.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){yD(e,"type",uj(r_));var t=this._context.getLocalAudioTrack();if(t){var r=HV(t.getTrack());if(r&&this.mixMediaStream(r),e===r_.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:n_.AUDIO_MIXING_STATE_PCM_ENABLED,error:tP.AUDIO_MIXING_ERROR_OK})}},e.prototype.disableAudioMixingBuffer=function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:n_.AUDIO_MIXING_STATE_PCM_DISABLED,error:tP.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0)||(this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode),this._audioBufferSource.start(),this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}})},e.prototype.stopAll=function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))},Object.defineProperty(e.prototype,"mixTrack",{get:function(){return this._audioDestination.stream.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sharedAudioContext",{get:function(){return this._sharedAudioContext},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},Jf([JL("default","id","filePath","options")],e.prototype,"startAudioMixing",null),Jf([JL("default","id")],e.prototype,"stopAudioMixing",null),Jf([JL("default","id")],e.prototype,"pauseAudioMixing",null),Jf([JL("default","id")],e.prototype,"resumeAudioMixing",null),Jf([JL("default","id")],e.prototype,"preloadAudioMixing",null),Jf([JL("default","id")],e.prototype,"unloadAudioMixing",null),Jf([JL("default","id")],e.prototype,"getAudioMixingVolume",null),Jf([JL("default","id","volume")],e.prototype,"setAudioMixingVolume",null),Jf([JL("default","id")],e.prototype,"getAudioMixingDuration",null),Jf([JL("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),Jf([JL("default","id","position")],e.prototype,"setAudioMixingPosition",null),Jf([JL("default","type")],e.prototype,"enableAudioMixingBuffer",null),Jf([JL()],e.prototype,"disableAudioMixingBuffer",null),Jf([JL("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(Oz||(Oz={}));var wz=new MD("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=cF.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(wz.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new oP(eP.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new oP(eP.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,YL.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(wz.print("login","init dataChannelSingling"),r._dataChannelSignalState=cF.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))},t.prototype.logout=function(){var e;return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){if(!this._loginSessionId||!this._userId)throw new oP(eP.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:QL.C2RTM}).catch((function(){})),this._closeDataChannelSignaling(),this._clearState(),[2]}))}))},t.prototype.updateLoginToken=function(e){return qf(this,void 0,void 0,(function(){var t=this;return Zf(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 qf(this,void 0,void 0,(function(){var t;return Zf(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new oP(eP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:QL.C2RTM})];case 1:return[2,null==(t=r.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return qf(this,void 0,void 0,(function(){return Zf(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new oP(eP.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 qf(this,void 0,void 0,(function(){return Zf(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new oP(eP.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:QL.C2RTM})];case 1:return r.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new oP(eP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:VL.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=aD();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:dD.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now().toString(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:ok.VERSION,deviceId:dx.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:QL.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=eP.INVALID_PARAMS,n="Invalid userId"):(r=eP.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=eP.LOGIN_FAILED,n="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new oP(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){return qf(this,void 0,void 0,(function(){var t,r,n,i,o,a=this;return Zf(this,(function(s){switch(s.label){case 0:if(t=new hx,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,dx.getDeviceId(),"")];case 2:if(!(r=s.sent()))throw new Error;return[3,4];case 3:throw s.sent(),ZL("rtm.login.getNodeFailed","",0,!0),new oP(eP.ICE_SERVER_WRONG,"get ICE config failed");case 4:ZL("rtm.login.getNodeSuccess",r,0,!0),wz.print("_createDataChannelSignaling()","get node success",r),this._handler=new Wx(HL),this._handler.once("disconnect",(function(){wz.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(),wz.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=cF.CONNECTED,[3,8];case 7:throw i=s.sent(),this._iceConfigNode=null,this._dataChannelSignalState=cF.DISCONNECTED,new oP(eP.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",i);case 8:return o=new rx(n),wz.print("_createDataChannelSignaling()","send ping"),o.sendPingSignaling(),o.once("close",(function(){wz.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),a._onDisconnect()})),o.on(DL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(DL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(DL.USER_DISCONNECTION,(function(){a.emit("onUserDisconnection"),a._clearState()})),o.on(DL.NODE_CHANGE,(function(e){ZL("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!==cF.CONNECTED)throw new oP(eP.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=cF.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&&(wz.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){wz.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){wz.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}(wD.exports.EventEmitter),Dz=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r.remoteStreams=new Map,r}return Cf(t,e),t.prototype.connect=function(){return qf(this,void 0,void 0,(function(){return Zf(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new pF,this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return qf(this,void 0,void 0,(function(){var t;return Zf(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new oP(eP.REPEAT_PLAY,"repeat play public media stream");return t=new IF(e,e,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]}),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return r.sent(),this.remoteStreams.set(e,t),[2,t]}}))}))},t.prototype.stopPlayPublicStream=function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)},t.prototype.destroy=function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()},t.prototype._handleReconnected=function(){return qf(this,void 0,void 0,(function(){var e,t,r,n,i,o,a,s,c=this;return Zf(this,(function(u){clearTimeout(this._reconnectTimer),e=function(e){t.remoteStreams.delete(e),t.startPlayPublicStream(e).then((function(){var t=c.remoteStreams.get(e);c.safeEmit(SF.RESUBSCRIBE,{stream:t})}))},t=this;try{for(r=$f(this.remoteStreams),n=r.next();!n.done;n=r.next())i=Qf(n.value,1),o=i[0],e(o)}catch(e){a={error:e}}finally{try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(a)throw a.error}}return[2]}))}))},t.prototype._reconnect=function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)},t.prototype._bindEvents=function(){var e,t,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(kL.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))},t}(LD),kz=new MD("Engine",0),Mz=function(e){function t(t){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._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=r_.PLAYOUT_AND_PUBLISH),qf(r,void 0,void 0,(function(){var r;return Zf(this,(function(n){switch(n.label){case 0:return kz.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(o_.onAudioMixingStateChanged,e)},r._appId=t,r._pubLock=new Zx("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new Nz({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._useCloudProxy=!1,r}return Cf(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,r,n;return qf(this,void 0,void 0,(function(){var i,o,a,s;return Zf(this,(function(c){switch(c.label){case 0:return kz.print("updateToken()","token: %s",e),ED(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(i=null===(r=this._room)||void 0===r?void 0:r._roomInfo,o=i.roomId,a=i.userInfo,s=this._tempRoomConfig,delete this._tempRoomConfig,[4,this.joinRoom(e,o,a,s)]):[3,2];case 1:return[2,c.sent()];case 2:if(!this._room)throw new oP(eP.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(n=this._room)||void 0===n?void 0:n.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.switchCamera=function(e){var t,r;return qf(this,void 0,void 0,(function(){var n,i;return Zf(this,(function(o){switch(o.label){case 0:return kz.print("switchCamera()","deviceId: %s",e),ED(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,nF(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 qf(this,void 0,void 0,(function(){var n,i;return Zf(this,(function(o){switch(o.label){case 0:return kz.print("switchMicrophone()","deviceId: %s",e),ED(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,iF(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(){xV.on(o_.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,S,E,y,g,b,T,I,A=this;null===(e=this._room)||void 0===e||e.on(DL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(DL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(DL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(SF.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(SF.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(DL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(a=this._room)||void 0===a||a.on(DL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(s=this._room)||void 0===s||s.on(DL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(DL.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(u=this._room)||void 0===u||u.on(DL.POST_PROCESSING_MESSAGE,(function(e){"publicStreamCallback"===e.type?A._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&A._onLiveTranscodingResult(e)})),null===(d=this._room)||void 0===d||d.on(kL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(l=this._room)||void 0===l||l.on(SF.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(h=this._room)||void 0===h||h.on(SF.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(SF.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(SF.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(_=this._room)||void 0===_||_.on(SF.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=A._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&A.safeEmit(o_.onAutoPublishResult,e)})),null===(v=this._room)||void 0===v||v.on(SF.ON_REMOTE_STREAM_STATS,(function(e){A.safeEmit(o_.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(SF.ON_LOCAL_STREAM_STATS,(function(e){A.safeEmit(o_.onLocalStreamStats,e)})),null===(S=this._room)||void 0===S||S.on(SF.ON_USER_MUTE_AUDIO,this._onUserMuteAudio.bind(this)),null===(E=this._room)||void 0===E||E.on(SF.ON_USER_MUTE_VIDEO,this._onUserMuteVideo.bind(this)),null===(y=this._room)||void 0===y||y.on(SF.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;A.safeEmit(o_.onUserStartAudioCapture,{userId:t})})),null===(g=this._room)||void 0===g||g.on(SF.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;A.safeEmit(o_.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(SF.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;A.safeEmit(o_.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(SF.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;A.safeEmit(o_.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(SF.ON_SEI_MESSAGED_RECEIVED,(function(e){A.safeEmit(o_.onSEIMessageReceived,e)}))},t.prototype.safeEmit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return ND(t)&&qL(t,fD(r)),e.prototype.safeEmit.apply(this,e_([t],Qf(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}),qf(this,void 0,void 0,(function(){var i,o;return Zf(this,(function(a){switch(a.label){case 0:if(kz.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,r,n),ID(e)||ED(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new oP(eP.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){gD(e,"userInfo"),AD(e.userId),ID(e.extraInfo)||ED(e.extraInfo,"userInfo.extraInfo",1,200)}(r),function(e){gD(e,"roomConfig"),mD(e.isAutoPublish,"roomConfig.isAutoPublish"),mD(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),mD(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(n),!this._room||this._room.connectionState===cF.DISCONNECTED)return[3,1];throw new oP(eP.REPEAT_JOIN,"Already joined");case 1:this._room=new NF(n),this._addHandlerEventHandler(),i=this._liveTranscodeConfig&&ck("started",this._liveTranscodeConfig),a.label=2;case 2:return a.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,Wf(Wf({},r),{businessId:this._businessId,role:this._visibility?Oz.NORMAL_USER:Oz.SILENT_USER}),i,this._useCloudProxy)];case 3:return a.sent(),this._roomConfig=n,this._tempRoomConfig&&delete this._tempRoomConfig,[3,5];case 4:throw(o=a.sent()).code===eP.INVALID_TOKEN&&(this._tempRoomConfig=n),o;case 5:(this._localAudioTrack||this._localVideoTrack)&&n.isAutoPublish&&(this._visibility?this._updatePublish(!0):this.safeEmit(o_.onAutoPublishResult,{isScreen:!1,state:Uf.PUBLISH_FAIL})),a.label=6;case 6:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,r;return void 0===e&&(e=!1),qf(this,void 0,void 0,(function(){return Zf(this,(function(n){switch(n.label){case 0:return kz.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return n.sent(),[3,3];case 2:null===(r=this._room)||void 0===r||r.leave(e).catch(),n.label=3;case 3:return this._removeHandlerEventHandler(),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,this._publicStreamIds=new Map,[2]}}))}))},t.prototype.destroy=function(){var e,t,r,n;kz.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._publicStreamAudioPlayer.forEach((function(e){return e.stop()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.stop()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(n=this._outsideRoom)||void 0===n||n.destroy(),this._publicStreamIds=new Map},t.prototype.publish=function(){return qf(this,void 0,void 0,(function(){return Zf(this,(function(e){switch(e.label){case 0:if(kz.print("publish()"),!this._room||this._room.connectionState!==cF.CONNECTED)throw new oP(eP.PUBLISH_BEFORE_JOIN,"join first");return[4,this._updatePublish()];case 1:return e.sent(),[2]}}))}))},t.prototype.unpublish=function(){var e,t;return qf(this,void 0,void 0,(function(){var r,n;return Zf(this,(function(i){switch(i.label){case 0:if(kz.print("unpublish()"),!this._room)throw new oP(eP.UNPUBLISH_BEFORE_JOIN,"join first");return null===(t=null===(e=this._room.localStream)||void 0===e?void 0:e.observer)||void 0===t||t.setPublish(!1),[4,this._pubLock.lock()];case 1:r=i.sent(),i.label=2;case 2:return i.trys.push([2,4,5,6]),[4,this._room.unpublish()];case 3:return i.sent(),[3,6];case 4:throw(n=i.sent())instanceof oP?n:new oP(eP.UNEXPECTED_ERROR,"unexpected error",n);case 5:return r(),[7];case 6:return[2]}}))}))},t.prototype.subscribeUserStream=function(e,t,r,n){var i,o,a,s,c,u;return void 0===r&&(r=Ff.STREAM_INDEX_MAIN),void 0===n&&(n={videoIndex:0}),qf(this,void 0,void 0,(function(){var d,l,h,p,f,_,v;return Zf(this,(function(m){switch(m.label){case 0:if(kz.print("subscribeStream()","userId: %o, mediaType: %o, streamType: %o, configure: %o",e,t,r,n),AD(e),yD(t,"mediaType",[Bf.AUDIO_AND_VIDEO,Bf.AUDIO_ONLY,Bf.VIDEO_ONLY,Bf.NONE]),yD(r,"streamType",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),SD(n.videoIndex,"config.videoIndex",0,2),!this._room||this._room.connectionState!==cF.CONNECTED)throw new oP(eP.SUBSCRIBE_BEFORE_JOIN,"join first");if(d=this._room.remoteStreams.get(e),h=r===Ff.STREAM_INDEX_SCREEN,!(l=h?null==d?void 0:d.find((function(e){return e.isScreen})):null==d?void 0:d.find((function(e){return!e.isScreen}))))throw new oP(eP.STREAM_NOT_EXIST,"stream not exist");m.label=1;case 1:return m.trys.push([1,3,,4]),p=t,this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?t=Bf.NONE:this._pauseAllSubscribeState.audio&&!this._pauseAllSubscribeState.video?t===Bf.AUDIO_AND_VIDEO?t=Bf.VIDEO_ONLY:t===Bf.AUDIO_ONLY&&(t=Bf.NONE):!this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video&&(t===Bf.AUDIO_AND_VIDEO?t=Bf.AUDIO_ONLY:t===Bf.VIDEO_ONLY&&(t=Bf.NONE)),t!==p&&kz.print("subscribeUserStream","due to pauseAllState change sub mediaType from ".concat(p," to ").concat(t)),f=l.hasSubscribed,[4,this._room.subscribe(l,t,n)];case 2:return m.sent(),t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.AUDIO_ONLY||this._updateAudioPlayerState(l),t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.VIDEO_ONLY||this._updateVideoPlayerState(l),((null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)||(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo))&&(l.audioTrack||l.videoTrack)&&(v={userId:e,isScreen:h,state:Mf.SUBSCRIBE_SUCC},this.safeEmit(o_.onAutoSubscribeResult,v)),f||t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.VIDEO_ONLY||null===(a=l.observer)||void 0===a||a.setSubscribeVideo(!0),f||t!==Bf.AUDIO_AND_VIDEO&&t!==Bf.AUDIO_ONLY||null===(s=l.observer)||void 0===s||s.setSubscribeAudio(!0),[3,4];case 3:throw _=m.sent(),((null===(c=this._roomConfig)||void 0===c?void 0:c.isAutoSubscribeAudio)||(null===(u=this._roomConfig)||void 0===u?void 0:u.isAutoSubscribeVideo))&&(v={userId:e,isScreen:h,state:Mf.SUBSCRIBE_FAIL},this.safeEmit(o_.onAutoSubscribeResult,v)),_;case 4:return[2]}}))}))},t.prototype.unSubscribe=function(e,t){return qf(this,void 0,void 0,(function(){var r,n;return Zf(this,(function(i){switch(i.label){case 0:if(kz.print("unSubscribe()","userId: %s, isScreen: %o",e,t),AD(e),mD(t,"isScreen"),!this._room||this._room.connectionState!==cF.CONNECTED)throw new oP(eP.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 oP(eP.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){var t,r;return qf(this,void 0,void 0,(function(){var n,i,o;return Zf(this,(function(a){switch(a.label){case 0:if(kz.print("startVideoCapture()","deviceId: %s",e),ID(e)||ED(e,"deviceId"),this._localVideoTrack)throw new oP(eP.REPEAT_CAPTURE,"Has already capture");return n=this._videoStreamConstraints,e&&(n.deviceId={exact:e},this._videoStreamConstraints=n),[4,nF(n)];case 1:return i=a.sent(),this._initLocalTrackEvents(i),this._localVideoTrack=i,this._videoPlayer&&this._videoPlayer.playVideo(i),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(o_.onAutoPublishResult,{isScreen:!1,state:Uf.PUBLISH_FAIL})),null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableVideo(!0),[2]):[2]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,r;return qf(this,void 0,void 0,(function(){return Zf(this,(function(n){switch(n.label){case 0:if(kz.print("stopVideoCapture()"),this._trackSourceType.video===Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new oP(eP.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:n.sent(),n.label=2;case 2:return null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,r;return qf(this,void 0,void 0,(function(){var n,i,o;return Zf(this,(function(a){switch(a.label){case 0:if(kz.print("startAudioCapture()","deviceId: $o",e),ID(e)||ED(e,"deviceId"),this._localAudioTrack)throw new oP(eP.REPEAT_CAPTURE,"Has already capture");return n=this._audioStreamConstraints,e&&(n.deviceId={exact:e},this._audioStreamConstraints=n),[4,iF(n)];case 1:return i=a.sent(),this._initLocalTrackEvents(i),this._localAudioTrack=i,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(o_.onAutoPublishResult,{isScreen:!1,state:Uf.PUBLISH_FAIL})),null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.stopAudioCapture=function(){var e,t,r;return qf(this,void 0,void 0,(function(){return Zf(this,(function(n){switch(n.label){case 0:if(kz.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 oP(eP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:n.sent(),n.label=2;case 2:return null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return kz.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,r;return void 0===e&&(e={}),qf(this,void 0,void 0,(function(){var n,i,o,a;return Zf(this,(function(s){switch(s.label){case 0:if(kz.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 oP(eP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new oP(eP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,oF(i)];case 1:return o=s.sent(),this._localScreenVideoTrack=new QV(o.getVideoTracks()[0],aD()),(a=o.getAudioTracks()).length&&(this._localScreenAudioTrack=new eF(a[0],aD()),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 qf(this,void 0,void 0,(function(){return Zf(this,(function(n){return kz.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 qf(this,void 0,void 0,(function(){var e;return Zf(this,(function(t){switch(t.label){case 0:if(kz.print("publishScreen()"),!this._room||this._room.connectionState!==cF.CONNECTED)throw new oP(eP.PUBLISH_BEFORE_JOIN,"join first");if(!this._visibility)throw new oP(eP.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 oP?e:new oP(eP.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e,t;return qf(this,void 0,void 0,(function(){var r;return Zf(this,(function(n){switch(n.label){case 0:if(kz.print("unpublishScreen()"),!this._room)throw new oP(eP.UNPUBLISH_BEFORE_JOIN,"join first");null===(t=null===(e=this._room.localScreenStream)||void 0===e?void 0:e.observer)||void 0===t||t.setPublish(!1),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._room.unpublishScreen()];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof oP?r:new oP(eP.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var r,n;if(kz.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),yD(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),t&&t.renderDom)return CD(t),e==Ff.STREAM_INDEX_MAIN?(this._videoPlayer=new xF(t),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement):(this._screenPlayer=new xF(Wf(Wf({},t),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement);e==Ff.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(n=this._screenPlayer)||void 0===n||n.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return qf(this,void 0,void 0,(function(){var r;return Zf(this,(function(n){switch(n.label){case 0:kz.print("startLiveTranscoding()","transcode: %o",e),ED(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.liveControlMessage(ck("started",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof oP?r:new oP(eP.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return qf(this,void 0,void 0,(function(){var r;return Zf(this,(function(n){switch(n.label){case 0:if(kz.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=sj(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.liveControlMessage(ck("layoutChanged",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof oP?r:new oP(eP.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return qf(this,void 0,void 0,(function(){var t;return Zf(this,(function(r){switch(r.label){case 0:if(kz.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,null===(e=this._room)||void 0===e?void 0:e.liveControlMessage({action:"stopped",type:"transcode"})];case 2:return r.sent(),[3,4];case 3:throw(t=r.sent())instanceof oP?t:new oP(eP.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return kz.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(KL.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t;return qf(this,void 0,void 0,(function(){return Zf(this,(function(r){switch(r.label){case 0:if(kz.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==cF.CONNECTED)throw new oP(eP.NOT_CONNECTED_YET,"server not connected");return this._room.localStream&&(null===(t=this._room.localStream.observer)||void 0===t||t.setPublisher(e)),!e?[4,this._room.unpublish()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?Oz.NORMAL_USER:Oz.SILENT_USER})];case 3:return r.sent(),this._visibility=e,[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var r=this;void 0===t&&(t=!1),e.on("playback_event",(function(n){var i,o,a,s;switch(null===(o=null===(i=r._room)||void 0===i?void 0:i.remoteStreams.get(n.userId))||void 0===o||o.find((function(e){return!e.isScreen})),n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type)t?r.safeEmit(o_.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):r.safeEmit(o_.onAudioFirstFrameDecoded,{userId:e.userId}),GL.firstRemoteAudioRender("",n.userId);else{var c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0};t?(c.publicStreamId=c.userId,delete c.userId,r.safeEmit(o_.onFirstPublicStreamVideoFrameDecoded,c),r.safeEmit(o_.onFirstPublicStreamVideoFrameRendered,c)):(r.safeEmit(o_.onVideoFirstFrameDecoded,c),r.safeEmit(o_.onVideoFirstFrameRendered,c)),GL.firstRemoteVideoRender("",n.userId)}break;case"autoplay-error":return t&&(n.publicStreamId=n.userId),void r.safeEmit(o_.onAutoplayFailed,n)}r.safeEmit(o_.onPlayerEvent,n)}))},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(o_.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var r,n,i,o,a,s;kz.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),yD(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),CD(t);var c=t.userId;if(t.renderDom){if(e==Ff.STREAM_INDEX_MAIN){null===(r=this._remoteVideoPlayer.get(c))||void 0===r||r.destroy();var u=new xF(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 xF(Wf(Wf({},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===Ff.STREAM_INDEX_SCREEN)},t.prototype.setLocalVideoMirrorType=function(e){kz.print("setLocalVideoMirrorType()","mirrorType: %o",e),yD(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 qf(this,void 0,void 0,(function(){var r;return Zf(this,(function(n){switch(n.label){case 0:return kz.print("setAudioPlaybackDevice()","deviceId: %s",e),ED(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(kz.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,xV.getDeviceById(e)];case 1:if(!(r=n.sent()))throw new oP(eP.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(o_.onAudioPlaybackDeviceChanged,r),GL.rtcAudioDevice(uL.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){return qf(this,void 0,void 0,(function(){var t,r;return Zf(this,(function(n){if(kz.print("play()","userId | publicStreamId: %s",e),AD(e),t=this._remoteAudioPlayer.get(e),r=this._remoteVideoPlayer.get(e),t||(t=this._publicStreamAudioPlayer.get(e)),r||(r=this._publicStreamVideoPlayer.get(e)),t||(t=this._audioPlayer),r||(r=this._videoPlayer),!t&&!r)throw new oP(eP.INVALID_PARAMS,"Player not found");return t&&t.manuallyPlay(),r&&r.manuallyPlay(),[2]}))}))},t.prototype.muteLocalAudio=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){if(kz.print("muteLocalAudio()","muteState: %o",e),yD(e,"muteState",[kf.MUTE_STATE_OFF,kf.MUTE_STATE_ON]),!this._room)throw new oP(eP.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("audio",e)]}))}))},t.prototype.muteLocalVideo=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){if(kz.print("muteLocalVideo()","muteState: %o",e),yD(e,"muteState",[kf.MUTE_STATE_OFF,kf.MUTE_STATE_ON]),!this._room)throw new oP(eP.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("video",e)]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return qf(this,void 0,void 0,(function(){var t,r=this;return Zf(this,(function(n){return kz.print("pauseAllSubscribedStream()","mediaType: %o",e),yD(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 qf(this,void 0,void 0,(function(){var t,r=this;return Zf(this,(function(n){return kz.print("resumeAllSubscribedStream()","mediaType: %o",e),yD(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 qf(this,void 0,void 0,(function(){return Zf(this,(function(r){if(AD(e),OD(t),!this._room||this._room.connectionState!==cF.CONNECTED)throw new oP(eP.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){return qf(this,void 0,void 0,(function(){return Zf(this,(function(r){if(AD(e),bD(t,"message"),OD(t),!this._room||this._room.connectionState!==cF.CONNECTED)throw new oP(eP.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendRoomMessage=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){if(OD(e),!this._room||this._room.connectionState!==cF.CONNECTED)throw new oP(eP.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e)]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){if(OD(e),!this._room||this._room.connectionState!==cF.CONNECTED)throw new oP(eP.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e,!0)]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),qf(this,void 0,void 0,(function(){var r;return Zf(this,(function(n){switch(n.label){case 0:return kz.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,TD(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={}),qf(this,void 0,void 0,(function(){var r;return Zf(this,(function(n){switch(n.label){case 0:return kz.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,TD(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 qf(this,void 0,void 0,(function(){return Zf(this,(function(d){if(kz.print("setVideoEncoderConfig()","streamIndex: %o, descriptions: %o",e,t),yD(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),function(e,t){if(!Array.isArray(e))throw new oP(eP.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===Ff.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 oP(eP.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 oP(eP.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;kz.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),yD(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),SD(r,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(dD.str2ab(t)):t;if(t.length){var d;if(e===Ff.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)kz.print("sei size must not bigger than 4KB");else{var l=aD();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 kz.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;kz.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;if(0!==e.length){var i=e.find((function(e){return!1===e.isScreen})),o=null===(n=null==i?void 0:i.audioTrack)||void 0===n?void 0:n.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(o_.onAudioVolumeIndication,{speakers:r})}),e)},t.prototype.setVideoSourceType=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S;return qf(this,void 0,void 0,(function(){var E,y,g;return Zf(this,(function(b){switch(b.label){case 0:return kz.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),yD(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),yD(t,"VideoSourceType",[Of.VIDEO_SOURCE_TYPE_EXTERNAL,Of.VIDEO_SOURCE_TYPE_INTERNAL]),E=e===Ff.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[E]===t?[3,4]:(this._trackSourceType[E]=t,kz.print("setVideoSourceType","set ".concat(E," source type to ").concat(t)),this._localVideoTrack&&e===Ff.STREAM_INDEX_MAIN?(g=!1,t===Of.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localVideoTrack.close()),null===(r=this._videoPlayer)||void 0===r||r.stop(),this._localVideoTrack=void 0,y=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,g?null===(a=null===(o=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!1):null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushVideo(!1),(null===(d=this._room)||void 0===d?void 0:d.hasPublished)||y?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===Ff.STREAM_INDEX_SCREEN?(g=!1,t===Of.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,g?null===(f=null===(p=null===(h=this._room)||void 0===h?void 0:h.localScreenStream)||void 0===p?void 0:p.observer)||void 0===f||f.setEnableVideo(!1):null===(m=null===(v=null===(_=this._room)||void 0===_?void 0:_.localScreenStream)||void 0===v?void 0:v.observer)||void 0===m||m.setPushVideo(!1),(null===(S=this._room)||void 0===S?void 0:S.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var r,n,i,o,a,s,c,u;return qf(this,void 0,void 0,(function(){var d;return Zf(this,(function(l){switch(l.label){case 0:if(kz.print("setExternalVideoTrack()","index: %o, track: %o",e,t),yD(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),e!==Ff.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new oP(eP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new tF(t,aD()),this._initLocalTrackEvents(this._localVideoTrack),null===(r=this._videoPlayer)||void 0===r||r.playVideo(this._localVideoTrack),d=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,(null===(i=this._room)||void 0===i?void 0:i.hasPublished)||d?[4,this._updatePublish()]:[3,2];case 1:l.sent(),l.label=2;case 2:if(e!==Ff.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new oP(eP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new tF(t,aD()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushVideo(!0),(null===(u=this._room)||void 0===u?void 0:u.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v;return qf(this,void 0,void 0,(function(){var m,S,E;return Zf(this,(function(y){switch(y.label){case 0:return kz.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),yD(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),yD(t,"audioSourceType",[Nf.AUDIO_SOURCE_TYPE_EXTERNAL,Nf.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===Ff.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,kz.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===Ff.STREAM_INDEX_MAIN?(E=!1,this._trackSourceType.audio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,S=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,E?null===(o=null===(i=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===i?void 0:i.observer)||void 0===o||o.setEnableAudio(!1):null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushAudio(!1),(null===(u=this._room)||void 0===u?void 0:u.hasPublished)||S?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:y.sent(),y.label=2;case 2:return this._localScreenAudioTrack&&e===Ff.STREAM_INDEX_SCREEN?(E=!1,this._trackSourceType.audio===Nf.AUDIO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,E?null===(h=null===(l=null===(d=this._room)||void 0===d?void 0:d.localScreenStream)||void 0===l?void 0:l.observer)||void 0===h||h.setEnableAudio(!1):null===(_=null===(f=null===(p=this._room)||void 0===p?void 0:p.localScreenStream)||void 0===f?void 0:f.observer)||void 0===_||_.setPushAudio(!1),(null===(v=this._room)||void 0===v?void 0:v.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:y.sent(),y.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var r,n,i,o,a,s,c,u,d;return qf(this,void 0,void 0,(function(){var l;return Zf(this,(function(h){switch(h.label){case 0:if(kz.print("setExternalAudioTrack()","index: %o, track: %o",e,t),yD(e,"streamIndex",[Ff.STREAM_INDEX_MAIN,Ff.STREAM_INDEX_SCREEN]),e!==Ff.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new oP(eP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new rF(t,aD()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,null===(o=null===(i=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===i?void 0:i.observer)||void 0===o||o.setPushAudio(!0),(null===(a=this._room)||void 0===a?void 0:a.hasPublished)||l?[4,this._updatePublish()]:[3,2];case 1:h.sent(),h.label=2;case 2:if(e!==Ff.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==Nf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new oP(eP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new rF(t,aD()),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localScreenStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushAudio(!0),(null===(d=this._room)||void 0===d?void 0:d.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.login=function(e,t){return qf(this,void 0,void 0,(function(){return Zf(this,(function(r){return kz.print("login()","token: %o, userInfo: %o",e,t),ID(e)||ED(e,"token"),AD(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return qf(this,void 0,void 0,(function(){return Zf(this,(function(e){return kz.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){return kz.print("updateLoginToken()","token: %o",e),ID(e)||ED(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){return kz.print("getPeerOnlineStatus()","userId: %o",e),AD(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return qf(this,void 0,void 0,(function(){return Zf(this,(function(r){return AD(e),OD(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return qf(this,void 0,void 0,(function(){return Zf(this,(function(r){return AD(e),bD(t,"message"),OD(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.setServerParams=function(e,t){return qf(this,void 0,void 0,(function(){return Zf(this,(function(r){return kz.print("setServerParams()","signature: %o, url: %0",e,t),ED(e,"signature"),ED(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){return ED(e,"message"),OD(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.sendServerBinaryMessage=function(e){return qf(this,void 0,void 0,(function(){return Zf(this,(function(t){return bD(e,"message"),OD(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new oP(eP.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;kz.print("startCloudProxy()",e),ED(e.logProxy,"logProxy"),ED(e.accessProxy,"accessProxy"),ED(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=sk("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=sk("LOG_SERVER_URL"),this._originConfigServerUrls=sk("CONFIG_REQUEST_DOMAINS"),ak("ICE_CONFIG_REQUEST_URLS",e.accessProxy),ak("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),ak("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new oP(eP.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");kz.print("stopCloudProxy()"),ak("ICE_CONFIG_REQUEST_URLS",[]),ak("LOG_SERVER_URL",this._originLogServerUrl),ak("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return qf(this,void 0,void 0,(function(){var r,n=this;return Zf(this,(function(i){if(kz.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),RD(e),!this._room||this._room.connectionState!==cF.CONNECTED)throw new oP(eP.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new oP(eP.REPEAT_PUSH,"repeat push public media stream");return r=uk(e,"started",t),[2,this._room.publicStreamControlMessage(r).then((function(){n._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return qf(this,void 0,void 0,(function(){var r;return Zf(this,(function(n){if(kz.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),RD(e),!this._room||this._room.connectionState!==cF.CONNECTED)throw new oP(eP.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return r=uk(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(r)]}))}))},t.prototype.stopPushPublicStream=function(e){return qf(this,void 0,void 0,(function(){var t=this;return Zf(this,(function(r){if(kz.print("startPushPublicStream()","publicStreamId: %o",e),RD(e),!this._room||this._room.connectionState!==cF.CONNECTED)throw new oP(eP.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return[2,this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:e}).then((function(){t._publicStreamIds.delete(e)}))]}))}))},t.prototype.startPlayPublicStream=function(e){var t;return qf(this,void 0,void 0,(function(){var r,n,i,o=this;return Zf(this,(function(a){switch(a.label){case 0:return RD(e),this._outsideRoom?[3,2]:(this._outsideRoom=new Dz(this._appId),this._outsideRoom.on(SF.RESUBSCRIBE,(function(e){var t,r,n=e.stream;if(n){var i=o._publicStreamAudioPlayer.get(n.streamId);i&&n.audioTrack&&(i.stop(),i.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var a=o._publicStreamVideoPlayer.get(n.streamId);a&&n.videoTrack&&a.playVideo(null===(r=e.stream)||void 0===r?void 0:r.videoTrack)}})),null===(t=this._outsideRoom)||void 0===t||t.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,o.safeEmit(o_.onPublicStreamStats,e)})),[4,this._outsideRoom.connect()]);case 1:a.sent(),a.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return r=a.sent(),(n=this._publicStreamVideoPlayer.get(e))&&(null==r?void 0:r.videoTrack)&&n.playVideo(r.videoTrack,r),!(i=this._publicStreamAudioPlayer.get(e))&&(null==r?void 0:r.audioTrack)&&(i=new VF(e),this._initPlayerEvents(i,!0),i.playAudio(r.audioTrack),this._publicStreamAudioPlayer.set(e,i)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return qf(this,void 0,void 0,(function(){var t;return Zf(this,(function(r){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.stop(),this._publicStreamAudioPlayer.delete(e)),[2]):[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var r,n;kz.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var i=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&i)return i.stop(),void this._publicStreamVideoPlayer.delete(e);if(!i){i=new xF(Wf(Wf({},t),{userId:e})),this._initPlayerEvents(i,!0),this._publicStreamVideoPlayer.set(e,i);var o=null===(n=null===(r=this._outsideRoom)||void 0===r?void 0:r.remoteStreams)||void 0===n?void 0:n.get(e);(null==o?void 0:o.videoTrack)&&i.playVideo(o.videoTrack,o)}},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(dk))},t.prototype._updatePublish=function(e){return void 0===e&&(e=!1),qf(this,void 0,void 0,(function(){var t,r;return Zf(this,(function(n){switch(n.label){case 0:if(kz.print("_updatePublish()"),!this._visibility)throw new oP(eP.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(t=n.sent(),!this._room||this._room.connectionState!==cF.CONNECTED)return t(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._localVideoTrack,this._localAudioTrack,e)];case 3:return n.sent(),[3,6];case 4:throw(r=n.sent())instanceof oP?r:new oP(eP.UNEXPECTED_ERROR,"unexpected error",r);case 5:return t(),[7];case 6:return[2]}}))}))},t.prototype._updateScreenPublish=function(){return qf(this,void 0,void 0,(function(){var e,t;return Zf(this,(function(r){switch(r.label){case 0:return kz.print("_updateScreenPublish()"),[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==cF.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 oP?t:new oP(eP.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){kz.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 VF(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){kz.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,a,s,c,u=e.stream,d={userId:u.userId,isScreen:u.isScreen,hasVideo:u.hasVideo,hasAudio:u.hasAudio,videoStreamDescriptions:u.attributes.videoDescriptions};this.safeEmit(o_.onStreamAdd,{stream:d});var l=null;(null===(t=this._roomConfig)||void 0===t?void 0:t.isAutoSubscribeAudio)&&(l=Bf.AUDIO_ONLY),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(l=Bf.VIDEO_ONLY),(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeVideo)&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(l=Bf.AUDIO_AND_VIDEO),kz.print("_onAddStream","autoSubType: ".concat(l)),null===l||u.isScreen||(l===Bf.AUDIO_AND_VIDEO?(null===(o=u.observer)||void 0===o||o.setAutoSubscribeVideo(!0),null===(a=u.observer)||void 0===a||a.setAutoSubscribeAudio(!0)):l===Bf.AUDIO_ONLY?null===(s=u.observer)||void 0===s||s.setAutoSubscribeAudio(!0):l===Bf.VIDEO_ONLY&&(null===(c=u.observer)||void 0===c||c.setAutoSubscribeVideo(!0)),this.subscribeUserStream(u.userId,l))},t.prototype._onRemoveStream=function(e){var t=e.stream,r={userId:t.userId,isScreen:t.isScreen,hasVideo:t.hasVideo,hasAudio:t.hasAudio,videoStreamDescriptions:[]},n=Uz[e.reason]||jf.STREAM_REMOVE_REASON_OTHER;this.safeEmit(o_.onStreamRemove,{stream:r,reason:n}),this._stopRemotePlayer(t.userId,t.isScreen)},t.prototype._onUserConnection=function(e){this.safeEmit(o_.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(o_.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(o_.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===Gf.CONNECTION_STATE_CONNECTED&&this.safeEmit(o_.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(o_.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(o_.onVideoFirstFrameDecoded,e)},t.prototype._onDeviceStateChange=function(e){this.safeEmit(o_.onMediaDeviceStateChanged,e)},t.prototype._onUserMuteAudio=function(e){this.safeEmit(o_.onUserMuteAudio,e)},t.prototype._onUserMuteVideo=function(e){this.safeEmit(o_.onUserMuteVideo,e)},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(o_.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(o_.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this.safeEmit(o_.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(o_.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(o_.onLiveTranscodingResult,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(o_.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(o_.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t.safeEmit(o_.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t.safeEmit(o_.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(o_.onError,{errorCode:eP.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(o_.onError,{errorCode:eP.RTM_TOKEN_ERROR})}))},Object.defineProperty(t.prototype,"waitForNewToken",{get:function(){return!!this._tempRoomConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localAudioTrack",{get:function(){return this._localAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localVideoTrack",{get:function(){return this._localVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenAudioTrack",{get:function(){return this._localScreenAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenVideoTrack",{get:function(){return this._localScreenVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){var e,t,r=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteStreams)&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,r=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})}))),r},enumerable:!1,configurable:!0}),Jf([JL()],t.prototype,"updateToken",null),Jf([JL()],t.prototype,"switchCamera",null),Jf([JL()],t.prototype,"switchMicrophone",null),Jf([JL()],t.prototype,"joinRoom",null),Jf([JL()],t.prototype,"leaveRoom",null),Jf([JL()],t.prototype,"destroy",null),Jf([JL()],t.prototype,"publish",null),Jf([JL()],t.prototype,"unpublish",null),Jf([JL()],t.prototype,"subscribeUserStream",null),Jf([JL()],t.prototype,"unSubscribe",null),Jf([JL()],t.prototype,"startVideoCapture",null),Jf([JL()],t.prototype,"stopVideoCapture",null),Jf([JL()],t.prototype,"startAudioCapture",null),Jf([JL()],t.prototype,"stopAudioCapture",null),Jf([JL()],t.prototype,"getAudioMixingManager",null),Jf([JL()],t.prototype,"startScreenCapture",null),Jf([JL()],t.prototype,"stopScreenCapture",null),Jf([JL()],t.prototype,"publishScreen",null),Jf([JL()],t.prototype,"unpublishScreen",null),Jf([JL()],t.prototype,"setLocalVideoPlayer",null),Jf([JL()],t.prototype,"startLiveTranscoding",null),Jf([JL()],t.prototype,"updateLiveTranscoding",null),Jf([JL()],t.prototype,"stopLiveTranscoding",null),Jf([JL()],t.prototype,"setBusinessId",null),Jf([JL()],t.prototype,"setUserVisibility",null),Jf([JL()],t.prototype,"setRemoteVideoPlayer",null),Jf([JL()],t.prototype,"setLocalVideoMirrorType",null),Jf([JL()],t.prototype,"setAudioPlaybackDevice",null),Jf([JL()],t.prototype,"play",null),Jf([JL()],t.prototype,"muteLocalAudio",null),Jf([JL()],t.prototype,"muteLocalVideo",null),Jf([JL()],t.prototype,"pauseAllSubscribedStream",null),Jf([JL()],t.prototype,"resumeAllSubscribedStream",null),Jf([JL()],t.prototype,"sendUserMessage",null),Jf([JL()],t.prototype,"sendUserBinaryMessage",null),Jf([JL()],t.prototype,"sendRoomMessage",null),Jf([JL()],t.prototype,"sendRoomBinaryMessage",null),Jf([JL()],t.prototype,"setAudioCaptureConfig",null),Jf([JL()],t.prototype,"setVideoCaptureConfig",null),Jf([JL()],t.prototype,"setVideoEncoderConfig",null),Jf([JL()],t.prototype,"sendSEIMessage",null),Jf([JL()],t.prototype,"setAudioVolumeIndicationInterval",null),Jf([JL()],t.prototype,"setVideoSourceType",null),Jf([JL()],t.prototype,"setExternalVideoTrack",null),Jf([JL()],t.prototype,"setAudioSourceType",null),Jf([JL()],t.prototype,"setExternalAudioTrack",null),Jf([JL("rtm")],t.prototype,"login",null),Jf([JL("rtm")],t.prototype,"logout",null),Jf([JL("rtm")],t.prototype,"updateLoginToken",null),Jf([JL("rtm")],t.prototype,"getPeerOnlineStatus",null),Jf([JL("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),Jf([JL("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),Jf([JL("rtm")],t.prototype,"setServerParams",null),Jf([JL("rtm")],t.prototype,"sendServerMessage",null),Jf([JL("rtm")],t.prototype,"sendServerBinaryMessage",null),Jf([JL()],t.prototype,"startCloudProxy",null),Jf([JL()],t.prototype,"stopCloudProxy",null),Jf([JL()],t.prototype,"startPushPublicStream",null),Jf([JL()],t.prototype,"updatePublicStreamParam",null),Jf([JL()],t.prototype,"stopPushPublicStream",null),Jf([JL("outsideRoom")],t.prototype,"startPlayPublicStream",null),Jf([JL("outsideRoom")],t.prototype,"stopPlayPublicStream",null),Jf([JL("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),t}(LD),Uz={"client unpublished":jf.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":jf.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":jf.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":jf.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":jf.STREAM_REMOVE_REASON_REPUBLISH},Lz=new MD("VERTC",0);[KL,YL,XL].forEach((function(e){return e.setStats({rtc_sdk_version:ok.VERSION,product_line:xU.RTC,report_version:VU.W_5,os:FU.WEB,device_id:dx.getDeviceId(),user_agent:uD()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var xz=function(e){return Lz.print("createEngine","Invoke VERTC.createEngine"),ED(e,"appId"),[KL,YL,XL].forEach((function(t){return t.setStats({rtc_app_id:e})})),GL.sdkInitEngine(Date.now(),_L.BEGIN),new Mz(e)},Vz=function(e){if(Lz.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof Mz))throw new oP(eP.INVALID_ENGINE,"Invalid engine object");e.destroy(),GL.sdkInitEngine(Date.now(),_L.END)},Fz=function(){return qf(void 0,void 0,void 0,(function(){return Zf(this,(function(e){return[2,xV.getDevices()]}))}))},Bz=function(e){return void 0===e&&(e={video:!0,audio:!0}),qf(void 0,void 0,void 0,(function(){var t,r,n,i,o;return Zf(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,xV.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,xV.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,n]}}))}))},jz=function(){return qf(void 0,void 0,void 0,(function(){return Zf(this,(function(e){return[2,xV.getMicrophones()]}))}))},Gz=function(){return qf(void 0,void 0,void 0,(function(){return Zf(this,(function(e){return[2,xV.getCameras()]}))}))},Hz=function(){return qf(void 0,void 0,void 0,(function(){return Zf(this,(function(e){return[2,xV.getAudioPlayback()]}))}))},zz=function(){return ok.VERSION},Kz=function(){return GL.rtcSdkApiCall("isSupported",0,""),qf(void 0,void 0,void 0,(function(){var e;return Zf(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!uD()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,Hx()]:[2,!1];case 1:return[2,null==(e=t.sent())?void 0:e.includes("H264")];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},Yz=function(){return GL.rtcSdkApiCall("getSupportedCodecs",0,""),qf(void 0,void 0,void 0,(function(){return Zf(this,(function(e){switch(e.label){case 0:return[4,Hx()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!uD()&&location.search.includes("_rtc_autotest_");var Xz=new function(){this.getSdkVersion=zz,this.createEngine=xz,this.destroyEngine=Vz,this.getDevices=Fz,this.enableDevices=Bz,this.getMicrophones=jz,this.getCameras=Gz,this.getAudioPlayback=Hz,this.getParameter=sk,this.setParameter=ak,this.isSupported=Kz,this.getSupportedCodecs=Yz,this.events=o_,this.ErrorCode=eP,this.platform="BytePlus",this._monitor=GL};return Wf(Wf(Wf(Wf({},Xz),i_),a_),{events:o_})}));